diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-02-03 22:52:20 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-02-03 22:52:20 +0100 |
commit | f8d795820e780a6322e054c26c581570613c14f0 (patch) | |
tree | 99d3ae01ce564752807341c5743863b4c92513f8 | |
parent | d2cb200e10ada6fa44c54a29292bb4665728fff0 (diff) | |
download | php-git-f8d795820e780a6322e054c26c581570613c14f0.tar.gz |
Reindent phpt files
5414 files changed, 78610 insertions, 78610 deletions
diff --git a/Zend/tests/001.phpt b/Zend/tests/001.phpt index c7c2060dc2..d041d20a3b 100644 --- a/Zend/tests/001.phpt +++ b/Zend/tests/001.phpt @@ -4,39 +4,39 @@ func_num_args() tests <?php function test1() { - var_dump(func_num_args()); + var_dump(func_num_args()); } function test2($a) { - var_dump(func_num_args()); + var_dump(func_num_args()); } function test3($a, $b) { - var_dump(func_num_args()); + var_dump(func_num_args()); } test1(); test2(1); try { - test2(); + test2(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } test3(1,2); call_user_func("test1"); try { - call_user_func("test3", 1); + call_user_func("test3", 1); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } call_user_func("test3", 1, 2); class test { - static function test1($a) { - var_dump(func_num_args()); - } + static function test1($a) { + var_dump(func_num_args()); + } } test::test1(1); diff --git a/Zend/tests/002.phpt b/Zend/tests/002.phpt index e89f71ef51..1311e3b570 100644 --- a/Zend/tests/002.phpt +++ b/Zend/tests/002.phpt @@ -4,45 +4,45 @@ func_get_arg() tests <?php function test1() { - var_dump(func_get_arg(-10)); - var_dump(func_get_arg(0)); - var_dump(func_get_arg(1)); + var_dump(func_get_arg(-10)); + var_dump(func_get_arg(0)); + var_dump(func_get_arg(1)); } function test2($a) { - var_dump(func_get_arg(0)); - var_dump(func_get_arg(1)); + var_dump(func_get_arg(0)); + var_dump(func_get_arg(1)); } function test3($a, $b) { - var_dump(func_get_arg(0)); - var_dump(func_get_arg(1)); - var_dump(func_get_arg(2)); + var_dump(func_get_arg(0)); + var_dump(func_get_arg(1)); + var_dump(func_get_arg(2)); } test1(); test1(10); test2(1); try { - test2(); + test2(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } test3(1,2); call_user_func("test1"); try { - call_user_func("test3", 1); + call_user_func("test3", 1); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } call_user_func("test3", 1, 2); class test { - static function test1($a) { - var_dump(func_get_arg(0)); - var_dump(func_get_arg(1)); - } + static function test1($a) { + var_dump(func_get_arg(0)); + var_dump(func_get_arg(1)); + } } test::test1(1); diff --git a/Zend/tests/003.phpt b/Zend/tests/003.phpt index b1ef79ebcb..6680956f7e 100644 --- a/Zend/tests/003.phpt +++ b/Zend/tests/003.phpt @@ -4,39 +4,39 @@ func_get_args() tests <?php function test1() { - var_dump(func_get_args()); + var_dump(func_get_args()); } function test2($a) { - var_dump(func_get_args()); + var_dump(func_get_args()); } function test3($a, $b) { - var_dump(func_get_args()); + var_dump(func_get_args()); } test1(); test1(10); test2(1); try { - test2(); + test2(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } test3(1,2); call_user_func("test1"); try { - call_user_func("test3", 1); + call_user_func("test3", 1); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } call_user_func("test3", 1, 2); class test { - static function test1($a) { - var_dump(func_get_args()); - } + static function test1($a) { + var_dump(func_get_args()); + } } test::test1(1); diff --git a/Zend/tests/009.phpt b/Zend/tests/009.phpt index 15449df3d1..d6ac1be4e2 100644 --- a/Zend/tests/009.phpt +++ b/Zend/tests/009.phpt @@ -4,9 +4,9 @@ get_class() tests <?php class foo { - function bar () { - var_dump(get_class()); - } + function bar () { + var_dump(get_class()); + } function testNull () { try { diff --git a/Zend/tests/010.phpt b/Zend/tests/010.phpt index eef3bc594f..a4a862cac2 100644 --- a/Zend/tests/010.phpt +++ b/Zend/tests/010.phpt @@ -4,19 +4,19 @@ get_parent_class() tests <?php interface i { - function test(); + function test(); } class foo implements i { - function test() { - var_dump(get_parent_class()); - } + function test() { + var_dump(get_parent_class()); + } } class bar extends foo { - function test_bar() { - var_dump(get_parent_class()); - } + function test_bar() { + var_dump(get_parent_class()); + } } $bar = new bar; diff --git a/Zend/tests/011.phpt b/Zend/tests/011.phpt index d36ae80ae8..36213af171 100644 --- a/Zend/tests/011.phpt +++ b/Zend/tests/011.phpt @@ -4,23 +4,23 @@ property_exists() tests <?php class foo { - public $pp1 = 1; - private $pp2 = 2; - protected $pp3 = 3; + public $pp1 = 1; + private $pp2 = 2; + protected $pp3 = 3; - function bar() { - var_dump(property_exists("foo","pp1")); - var_dump(property_exists("foo","pp2")); - var_dump(property_exists("foo","pp3")); - } + function bar() { + var_dump(property_exists("foo","pp1")); + var_dump(property_exists("foo","pp2")); + var_dump(property_exists("foo","pp3")); + } } class bar extends foo { - function test() { - var_dump(property_exists("foo","pp1")); - var_dump(property_exists("foo","pp2")); - var_dump(property_exists("foo","pp3")); - } + function test() { + var_dump(property_exists("foo","pp1")); + var_dump(property_exists("foo","pp2")); + var_dump(property_exists("foo","pp3")); + } } var_dump(property_exists("foo","pp1")); diff --git a/Zend/tests/020.phpt b/Zend/tests/020.phpt index efc221cb4f..dc7a34be06 100644 --- a/Zend/tests/020.phpt +++ b/Zend/tests/020.phpt @@ -6,11 +6,11 @@ func_get_arg() invalid usage var_dump(func_get_arg(1)); function bar() { - var_dump(func_get_arg(1)); + var_dump(func_get_arg(1)); } function foo() { - bar(func_get_arg(1)); + bar(func_get_arg(1)); } foo(1,2); diff --git a/Zend/tests/022.phpt b/Zend/tests/022.phpt index 88a6ec384d..d2b4075627 100644 --- a/Zend/tests/022.phpt +++ b/Zend/tests/022.phpt @@ -5,15 +5,15 @@ Implementing abstracting methods and optional parameters abstract class Base { - abstract function someMethod($param); + abstract function someMethod($param); } class Ext extends Base { - function someMethod($param = "default") - { - echo $param, "\n"; - } + function someMethod($param = "default") + { + echo $param, "\n"; + } } $a = new Ext(); diff --git a/Zend/tests/023.phpt b/Zend/tests/023.phpt index 6f975c655b..b96433fd66 100644 --- a/Zend/tests/023.phpt +++ b/Zend/tests/023.phpt @@ -10,20 +10,20 @@ print "\n"; class bar { - public function a() { - return "bar!"; - } + public function a() { + return "bar!"; + } } class foo { - public function test() { - print "foo!\n"; - return new bar; - } + public function test() { + print "foo!\n"; + return new bar; + } } function test() { - return new foo; + return new foo; } $a = 'test'; diff --git a/Zend/tests/025.phpt b/Zend/tests/025.phpt index 24e5520ee1..0d3c7e823e 100644 --- a/Zend/tests/025.phpt +++ b/Zend/tests/025.phpt @@ -4,9 +4,9 @@ Testing dynamic calls <?php class foo { - static public function a() { - print "ok\n"; - } + static public function a() { + print "ok\n"; + } } $a = 'a'; diff --git a/Zend/tests/026.phpt b/Zend/tests/026.phpt index 0524487c5f..9008abb791 100644 --- a/Zend/tests/026.phpt +++ b/Zend/tests/026.phpt @@ -4,8 +4,8 @@ Trying assign value to property when an object is not returned in a function <?php class foo { - public function a() { - } + public function a() { + } } $test = new foo; diff --git a/Zend/tests/030.phpt b/Zend/tests/030.phpt index 6f3bda27d7..fb67ef0c9d 100644 --- a/Zend/tests/030.phpt +++ b/Zend/tests/030.phpt @@ -4,26 +4,26 @@ Overriding $this in catch and checking the object properties later. <?php class foo { - public $test = 0; - private $test_2 = 1; - protected $test_3 = 2; + public $test = 0; + private $test_2 = 1; + protected $test_3 = 2; - public function bar() { - try { - throw new Exception('foo'); - } catch (Exception $this) { - var_dump($this); - } + public function bar() { + try { + throw new Exception('foo'); + } catch (Exception $this) { + var_dump($this); + } - $this->baz(); - } + $this->baz(); + } - public function baz() { - foreach ($this as $k => $v) { - printf("'%s' => '%s'\n", $k, $v); - } - print "ok\n"; - } + public function baz() { + foreach ($this as $k => $v) { + printf("'%s' => '%s'\n", $k, $v); + } + print "ok\n"; + } } $test = new foo; diff --git a/Zend/tests/034.phpt b/Zend/tests/034.phpt index 132fbf78f5..c608ef96c9 100644 --- a/Zend/tests/034.phpt +++ b/Zend/tests/034.phpt @@ -4,21 +4,21 @@ Testing multiples 'default:' in switch <?php switch (1) { - case 2: - print 'foo'; - break; - case 3: - print 'bar'; - break; - default: - print 1; - break; - default: - print 2; - break; - default: - print 3; - break; + case 2: + print 'foo'; + break; + case 3: + print 'bar'; + break; + default: + print 1; + break; + default: + print 2; + break; + default: + print 3; + break; } ?> diff --git a/Zend/tests/access_modifiers_001.phpt b/Zend/tests/access_modifiers_001.phpt index f89d55bd93..6ffb40eb6d 100644 --- a/Zend/tests/access_modifiers_001.phpt +++ b/Zend/tests/access_modifiers_001.phpt @@ -4,8 +4,8 @@ using multiple access modifiers (methods) <?php class test { - static public public static final public final function foo() { - } + static public public static final public final function foo() { + } } echo "Done\n"; diff --git a/Zend/tests/access_modifiers_002.phpt b/Zend/tests/access_modifiers_002.phpt index f0b15e43dc..9830258c61 100644 --- a/Zend/tests/access_modifiers_002.phpt +++ b/Zend/tests/access_modifiers_002.phpt @@ -4,7 +4,7 @@ using multiple access modifiers (attributes) <?php class test { - static public public static final public final $var; + static public public static final public final $var; } echo "Done\n"; diff --git a/Zend/tests/access_modifiers_003.phpt b/Zend/tests/access_modifiers_003.phpt index 7f5d922f3b..296aac07bb 100644 --- a/Zend/tests/access_modifiers_003.phpt +++ b/Zend/tests/access_modifiers_003.phpt @@ -4,7 +4,7 @@ using multiple access modifiers (classes) <?php final final class test { - function foo() {} + function foo() {} } echo "Done\n"; diff --git a/Zend/tests/access_modifiers_004.phpt b/Zend/tests/access_modifiers_004.phpt index 2be203a917..2abff66c1d 100644 --- a/Zend/tests/access_modifiers_004.phpt +++ b/Zend/tests/access_modifiers_004.phpt @@ -4,8 +4,8 @@ using multiple access modifiers (abstract methods) <?php class test { - abstract abstract function foo() { - } + abstract abstract function foo() { + } } echo "Done\n"; diff --git a/Zend/tests/access_modifiers_005.phpt b/Zend/tests/access_modifiers_005.phpt index 7780cf4ca6..6569402be1 100644 --- a/Zend/tests/access_modifiers_005.phpt +++ b/Zend/tests/access_modifiers_005.phpt @@ -4,8 +4,8 @@ using multiple access modifiers (final methods) <?php class test { - final final function foo() { - } + final final function foo() { + } } echo "Done\n"; diff --git a/Zend/tests/access_modifiers_006.phpt b/Zend/tests/access_modifiers_006.phpt index aefe27c68a..102276aba1 100644 --- a/Zend/tests/access_modifiers_006.phpt +++ b/Zend/tests/access_modifiers_006.phpt @@ -4,8 +4,8 @@ using multiple access modifiers (static methods) <?php class test { - static static function foo() { - } + static static function foo() { + } } echo "Done\n"; diff --git a/Zend/tests/access_modifiers_007.phpt b/Zend/tests/access_modifiers_007.phpt index 4860c52c29..a34e1940d5 100644 --- a/Zend/tests/access_modifiers_007.phpt +++ b/Zend/tests/access_modifiers_007.phpt @@ -4,7 +4,7 @@ abstract final methods errmsg <?php class test { - final abstract function foo(); + final abstract function foo(); } echo "Done\n"; diff --git a/Zend/tests/access_modifiers_008.phpt b/Zend/tests/access_modifiers_008.phpt index 67886cfa7e..2d4d584a8f 100644 --- a/Zend/tests/access_modifiers_008.phpt +++ b/Zend/tests/access_modifiers_008.phpt @@ -6,13 +6,13 @@ Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2 <?php class A { - static protected function f() {return 'A::f()';} + static protected function f() {return 'A::f()';} } class B1 extends A { - static protected function f() {return 'B1::f()';} + static protected function f() {return 'B1::f()';} } class B2 extends A { - static public function test() {echo B1::f();} + static public function test() {echo B1::f();} } B2::test(); diff --git a/Zend/tests/access_modifiers_009.phpt b/Zend/tests/access_modifiers_009.phpt index cb01fa13fb..452b5406eb 100644 --- a/Zend/tests/access_modifiers_009.phpt +++ b/Zend/tests/access_modifiers_009.phpt @@ -6,16 +6,16 @@ Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2 <?php class A { - static protected function f() {return 'A::f()';} + static protected function f() {return 'A::f()';} } class B1 extends A { - static protected function f() {return 'B1::f()';} + static protected function f() {return 'B1::f()';} } class B2 extends A { - static public function test() { - var_dump(is_callable('B1::f')); - B1::f(); - } + static public function test() { + var_dump(is_callable('B1::f')); + B1::f(); + } } B2::test(); diff --git a/Zend/tests/access_modifiers_010.phpt b/Zend/tests/access_modifiers_010.phpt index dd2e3e36b9..50597ff552 100644 --- a/Zend/tests/access_modifiers_010.phpt +++ b/Zend/tests/access_modifiers_010.phpt @@ -4,24 +4,24 @@ Testing visibility of methods <?php class d { - private function test2() { - print "Bar\n"; - } + private function test2() { + print "Bar\n"; + } } abstract class a extends d { - public function test() { - $this->test2(); - } + public function test() { + $this->test2(); + } } abstract class b extends a { } class c extends b { - public function __construct() { - $this->test(); - } + public function __construct() { + $this->test(); + } } new c; diff --git a/Zend/tests/access_modifiers_011.phpt b/Zend/tests/access_modifiers_011.phpt index 23846fc040..ef24df6431 100644 --- a/Zend/tests/access_modifiers_011.phpt +++ b/Zend/tests/access_modifiers_011.phpt @@ -4,25 +4,25 @@ __call() for private/protected methods <?php class A { - private $var1 = 'var1 value'; - protected $var2 = 'var2 value'; + private $var1 = 'var1 value'; + protected $var2 = 'var2 value'; - private function func1() - { - return "in func1"; - } - protected function func2() - { - return "in func2"; - } - public function __get($var) - { - return $this->$var; - } - public function __call($func, array $args = array()) - { - return call_user_func_array(array($this, $func), $args); - } + private function func1() + { + return "in func1"; + } + protected function func2() + { + return "in func2"; + } + public function __get($var) + { + return $this->$var; + } + public function __call($func, array $args = array()) + { + return call_user_func_array(array($this, $func), $args); + } } $a = new A(); diff --git a/Zend/tests/access_modifiers_012.phpt b/Zend/tests/access_modifiers_012.phpt index 86f678634b..4d07102cf2 100644 --- a/Zend/tests/access_modifiers_012.phpt +++ b/Zend/tests/access_modifiers_012.phpt @@ -3,9 +3,9 @@ Trigger __call() in lieu of non visible methods when called via a callback. --FILE-- <?php class C { - protected function prot() { } - private function priv() { } - public function __call($name, $args) { + protected function prot() { } + private function priv() { } + public function __call($name, $args) { echo "In __call() for method $name()\n"; } } diff --git a/Zend/tests/access_modifiers_013.phpt b/Zend/tests/access_modifiers_013.phpt index f9b72c1f52..3f1c3111ab 100644 --- a/Zend/tests/access_modifiers_013.phpt +++ b/Zend/tests/access_modifiers_013.phpt @@ -4,7 +4,7 @@ Prevent abstract and final in the same class declaration <?php final abstract class C { - private function priv() { } + private function priv() { } } ?> diff --git a/Zend/tests/add_002.phpt b/Zend/tests/add_002.phpt index de0a3e8a63..5d862ef729 100644 --- a/Zend/tests/add_002.phpt +++ b/Zend/tests/add_002.phpt @@ -9,9 +9,9 @@ $o = new stdclass; $o->prop = "value"; try { - var_dump($a + $o); + var_dump($a + $o); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo "\nException: " . $e->getMessage() . "\n"; } $c = $a + $o; diff --git a/Zend/tests/add_003.phpt b/Zend/tests/add_003.phpt index f0066ee3cd..b70ff022ec 100644 --- a/Zend/tests/add_003.phpt +++ b/Zend/tests/add_003.phpt @@ -9,9 +9,9 @@ $o = new stdclass; $o->prop = "value"; try { - var_dump($o + $a); + var_dump($o + $a); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo "\nException: " . $e->getMessage() . "\n"; } $c = $o + $a; diff --git a/Zend/tests/add_004.phpt b/Zend/tests/add_004.phpt index a46f70b818..161c4c2b39 100644 --- a/Zend/tests/add_004.phpt +++ b/Zend/tests/add_004.phpt @@ -6,9 +6,9 @@ adding numbers to arrays $a = array(1,2,3); try { - var_dump($a + 5); + var_dump($a + 5); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo "\nException: " . $e->getMessage() . "\n"; } $c = $a + 5; diff --git a/Zend/tests/add_007.phpt b/Zend/tests/add_007.phpt index 3b24a1c99c..e490826d8f 100644 --- a/Zend/tests/add_007.phpt +++ b/Zend/tests/add_007.phpt @@ -8,9 +8,9 @@ $a = array(1,2,3); $s1 = "some string"; try { - var_dump($a + $s1); + var_dump($a + $s1); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo "\nException: " . $e->getMessage() . "\n"; } $c = $a + $s1; diff --git a/Zend/tests/anon/011.phpt b/Zend/tests/anon/011.phpt index 0d16c874e8..1435d5353e 100644 --- a/Zend/tests/anon/011.phpt +++ b/Zend/tests/anon/011.phpt @@ -5,9 +5,9 @@ Ensure proper inheritance with get_class(anon class instance) used via class_ali class_alias(get_class(new class { protected $foo = 1; }), "AnonBase"); var_dump((new class extends AnonBase { - function getFoo() { - return $this->foo; - } + function getFoo() { + return $this->foo; + } })->getFoo()); ?> --EXPECT-- diff --git a/Zend/tests/arg_unpack/non_integer_keys.phpt b/Zend/tests/arg_unpack/non_integer_keys.phpt index 19ed61f2ee..6b73efa416 100644 --- a/Zend/tests/arg_unpack/non_integer_keys.phpt +++ b/Zend/tests/arg_unpack/non_integer_keys.phpt @@ -3,17 +3,17 @@ Argument unpacking does not work with non-integer keys --FILE-- <?php function foo(...$args) { - var_dump($args); + var_dump($args); } function gen() { - yield 1.23 => 123; - yield "2.34" => 234; + yield 1.23 => 123; + yield "2.34" => 234; } try { - foo(...gen()); + foo(...gen()); } catch (Error $ex) { - echo "Exception: " . $ex->getMessage() . "\n"; + echo "Exception: " . $ex->getMessage() . "\n"; } ?> diff --git a/Zend/tests/arg_unpack/string_keys.phpt b/Zend/tests/arg_unpack/string_keys.phpt index c2913db5b4..7b620b0830 100644 --- a/Zend/tests/arg_unpack/string_keys.phpt +++ b/Zend/tests/arg_unpack/string_keys.phpt @@ -8,14 +8,14 @@ set_error_handler(function($errno, $errstr) { }); try { - var_dump(...[1, 2, "foo" => 3, 4]); + var_dump(...[1, 2, "foo" => 3, 4]); } catch (Error $ex) { - var_dump($ex->getMessage()); + var_dump($ex->getMessage()); } try { - var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4])); + var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4])); } catch (Error $ex) { - var_dump($ex->getMessage()); + var_dump($ex->getMessage()); } ?> diff --git a/Zend/tests/argument_restriction_001.phpt b/Zend/tests/argument_restriction_001.phpt index 2cd527f4fa..c7deb760a0 100644 --- a/Zend/tests/argument_restriction_001.phpt +++ b/Zend/tests/argument_restriction_001.phpt @@ -3,13 +3,13 @@ Bug #55719 (Argument restriction should come with a more specific error message) --FILE-- <?php Class Base { - public function &test($foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") { - } + public function &test($foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") { + } } class Sub extends Base { - public function &test() { - } + public function &test() { + } } ?> --EXPECTF-- diff --git a/Zend/tests/argument_restriction_002.phpt b/Zend/tests/argument_restriction_002.phpt index 511e4d3332..f80e9779ff 100644 --- a/Zend/tests/argument_restriction_002.phpt +++ b/Zend/tests/argument_restriction_002.phpt @@ -3,13 +3,13 @@ Bug #55719 (Argument restriction should come with a more specific error message) --FILE-- <?php Abstract Class Base { - public function test($foo, array &$bar, $option = NULL, $extra = 3.141592653589793238462643383279502884197169399375105 ) { - } + public function test($foo, array &$bar, $option = NULL, $extra = 3.141592653589793238462643383279502884197169399375105 ) { + } } class Sub extends Base { - public function test($foo, array &$bar) { - } + public function test($foo, array &$bar) { + } } ?> --EXPECTF-- diff --git a/Zend/tests/argument_restriction_003.phpt b/Zend/tests/argument_restriction_003.phpt index fb602194bb..7857d377ae 100644 --- a/Zend/tests/argument_restriction_003.phpt +++ b/Zend/tests/argument_restriction_003.phpt @@ -6,13 +6,13 @@ class Foo { } Abstract Class Base { - public function test(Foo $foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") { - } + public function test(Foo $foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") { + } } class Sub extends Base { - public function test() { - } + public function test() { + } } ?> --EXPECTF-- diff --git a/Zend/tests/argument_restriction_004.phpt b/Zend/tests/argument_restriction_004.phpt index 8313d6908c..90736e8783 100644 --- a/Zend/tests/argument_restriction_004.phpt +++ b/Zend/tests/argument_restriction_004.phpt @@ -6,12 +6,12 @@ class Foo { } Abstract Class Base { - abstract public function test(Foo $foo, array $bar, $option = NULL, $extra = 16777215) ; + abstract public function test(Foo $foo, array $bar, $option = NULL, $extra = 16777215) ; } class Sub extends Base { - public function test(Foo $foo, array $bar, $option = NULL, $extra = 0xffffff ) { - } + public function test(Foo $foo, array $bar, $option = NULL, $extra = 0xffffff ) { + } } ?> --EXPECT-- diff --git a/Zend/tests/argument_restriction_005.phpt b/Zend/tests/argument_restriction_005.phpt index 712ccc878a..0982ccde4a 100644 --- a/Zend/tests/argument_restriction_005.phpt +++ b/Zend/tests/argument_restriction_005.phpt @@ -3,8 +3,8 @@ Bug #55719 (Argument restriction should come with a more specific error message) --FILE-- <?php class Sub implements ArrayAccess { - public function offsetSet() { - } + public function offsetSet() { + } } ?> --EXPECTF-- diff --git a/Zend/tests/argument_restriction_006.phpt b/Zend/tests/argument_restriction_006.phpt index 788670cd51..5298c6959d 100644 --- a/Zend/tests/argument_restriction_006.phpt +++ b/Zend/tests/argument_restriction_006.phpt @@ -3,13 +3,13 @@ Bug #60174 (Notice when array in method prototype error) --FILE-- <?php Abstract Class Base { - public function test($foo, $extra = array("test")) { - } + public function test($foo, $extra = array("test")) { + } } class Sub extends Base { - public function test($foo, $extra) { - } + public function test($foo, $extra) { + } } ?> --EXPECTF-- diff --git a/Zend/tests/array_append_COW.phpt b/Zend/tests/array_append_COW.phpt index 0e3008589b..b9965742bc 100644 --- a/Zend/tests/array_append_COW.phpt +++ b/Zend/tests/array_append_COW.phpt @@ -2,12 +2,12 @@ Tests that array manipulation code is correctly dealing with copy on write and splitting on reference --FILE-- <?php - $a=array(); - $b=1; - $c=&$b; - $a[]=$b; - $b=2; - var_dump ($a); + $a=array(); + $b=1; + $c=&$b; + $a[]=$b; + $b=2; + var_dump ($a); ?> --EXPECT-- array(1) { diff --git a/Zend/tests/array_hash_zero.phpt b/Zend/tests/array_hash_zero.phpt index 337cdfd1a2..0939d5bf12 100644 --- a/Zend/tests/array_hash_zero.phpt +++ b/Zend/tests/array_hash_zero.phpt @@ -4,12 +4,12 @@ Accept hashes being equal to zero <?php $hashes = [ - "\x8e\x1a\x63\x0f\x61" => 32, - "\xf7\x17\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x6b\x03\x6a\x13\x63\x17\x6b\x1d\x67" => 64, + "\x8e\x1a\x63\x0f\x61" => 32, + "\xf7\x17\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x6b\x03\x6a\x13\x63\x17\x6b\x1d\x67" => 64, ]; foreach ($hashes as $hash => $bits) { - var_dump($hashes[$hash], $bits); + var_dump($hashes[$hash], $bits); } ?> diff --git a/Zend/tests/array_unpack/basic.phpt b/Zend/tests/array_unpack/basic.phpt index 3363c487ec..dece3b8265 100644 --- a/Zend/tests/array_unpack/basic.phpt +++ b/Zend/tests/array_unpack/basic.phpt @@ -5,13 +5,13 @@ Basic array unpacking $array = [1, 2, 3]; function getArr() { - return [4, 5]; + return [4, 5]; } function arrGen() { - for($i = 11; $i < 15; $i++) { - yield $i; - } + for($i = 11; $i < 15; $i++) { + yield $i; + } } var_dump([...[]]); diff --git a/Zend/tests/array_unpack/classes.phpt b/Zend/tests/array_unpack/classes.phpt index 573c5f1c32..a459a229e3 100644 --- a/Zend/tests/array_unpack/classes.phpt +++ b/Zend/tests/array_unpack/classes.phpt @@ -4,23 +4,23 @@ Array unpacking with classes <?php class C { - public const FOO = [0, ...self::ARR, 4]; - public const ARR = [1, 2, 3]; - public static $bar = [...self::ARR]; + public const FOO = [0, ...self::ARR, 4]; + public const ARR = [1, 2, 3]; + public static $bar = [...self::ARR]; } class D { - public const A = [...self::B]; - public const B = [...self::A]; + public const A = [...self::B]; + public const B = [...self::A]; } var_dump(C::FOO); var_dump(C::$bar); try { - var_dump(D::A); + var_dump(D::A); } catch (Error $ex) { - echo "Exception: " . $ex->getMessage() . "\n"; + echo "Exception: " . $ex->getMessage() . "\n"; } --EXPECT-- array(5) { diff --git a/Zend/tests/array_unpack/non_integer_keys.phpt b/Zend/tests/array_unpack/non_integer_keys.phpt index 5c93102907..0e082e71f3 100644 --- a/Zend/tests/array_unpack/non_integer_keys.phpt +++ b/Zend/tests/array_unpack/non_integer_keys.phpt @@ -3,14 +3,14 @@ Array unpacking does not work with non-integer keys --FILE-- <?php function gen() { - yield [] => 1; - yield 1.23 => 123; + yield [] => 1; + yield 1.23 => 123; } try { - [...gen()]; + [...gen()]; } catch (Error $ex) { - echo "Exception: " . $ex->getMessage() . "\n"; + echo "Exception: " . $ex->getMessage() . "\n"; } --EXPECT-- diff --git a/Zend/tests/array_unpack/string_keys.phpt b/Zend/tests/array_unpack/string_keys.phpt index 6032d7cc3f..c06a2b4b8b 100644 --- a/Zend/tests/array_unpack/string_keys.phpt +++ b/Zend/tests/array_unpack/string_keys.phpt @@ -4,16 +4,16 @@ array unpacking with string keys (not supported) <?php try { - $array = [1, 2, "foo" => 3, 4]; - var_dump([...$array]); + $array = [1, 2, "foo" => 3, 4]; + var_dump([...$array]); } catch (Error $ex) { - var_dump($ex->getMessage()); + var_dump($ex->getMessage()); } try { - $iterator = new ArrayIterator([1, 2, "foo" => 3, 4]); - var_dump([...$iterator]); + $iterator = new ArrayIterator([1, 2, "foo" => 3, 4]); + var_dump([...$iterator]); } catch (Error $ex) { - var_dump($ex->getMessage()); + var_dump($ex->getMessage()); } --EXPECT-- diff --git a/Zend/tests/array_unshift_COW.phpt b/Zend/tests/array_unshift_COW.phpt index ecc42bb0f4..a3110693ab 100644 --- a/Zend/tests/array_unshift_COW.phpt +++ b/Zend/tests/array_unshift_COW.phpt @@ -2,12 +2,12 @@ Tests that array unshift code is correctly dealing with copy on write and splitting on reference --FILE-- <?php - $a=array(); - $b=1; - $c=&$b; - array_unshift ($a,$b); - $b=2; - var_dump ($a); + $a=array(); + $b=1; + $c=&$b; + array_unshift ($a,$b); + $b=2; + var_dump ($a); ?> --EXPECT-- array(1) { diff --git a/Zend/tests/assert/expect_015.phpt b/Zend/tests/assert/expect_015.phpt index 5d172649af..9b2cabd59f 100644 --- a/Zend/tests/assert/expect_015.phpt +++ b/Zend/tests/assert/expect_015.phpt @@ -6,137 +6,137 @@ assert.exception=0 --FILE-- <?php assert(0 && ($a = function () { - global $a, $$b; - static $c, $d = 0; - unset($e); - $x = isset($a) && !empty($b) || eval($c); - $x = $a ? $b : $c; - $x = $a ?: $c; - $x = $a ?? $b; - list($a, $b, $c) = [1, 2=>'x', 'z'=>'c']; - @foo(); - $y = clone $x; - yield 1 => 2; - yield from $x; + global $a, $$b; + static $c, $d = 0; + unset($e); + $x = isset($a) && !empty($b) || eval($c); + $x = $a ? $b : $c; + $x = $a ?: $c; + $x = $a ?? $b; + list($a, $b, $c) = [1, 2=>'x', 'z'=>'c']; + @foo(); + $y = clone $x; + yield 1 => 2; + yield from $x; })); assert(0 && ($a = function &(array &$a, ?X $b = null) use ($c,&$d) : ?X { - abstract class A extends B implements C, D { - const X = 12; - const Y = self::X, Z = "aaa"; + abstract class A extends B implements C, D { + const X = 12; + const Y = self::X, Z = "aaa"; - public $a = 1, $b; - protected $c; - static private $d = null; + public $a = 1, $b; + protected $c; + static private $d = null; - abstract function foo(); + abstract function foo(); - static private function f1() { - for ($i = 0, $j = 100; $i < $j; $i++, --$j) { - $s[$i] = $a[$j]; - } - foreach ($a as $key => &$val) { - print "$key => $val\n"; - } - while ($s[$i]) { - $i++; - } - do { - $i--; - } while ($s[$i]); - $x = foo($a + 1, 4, ...[1,2,3]); - $x = ${$a . "_1"}(); - $x = A::foo(); - $x = ${$a . "_1"}::foo(); - $x = A::${$a . "_1"}(); - $x = $x->foo(); - $x = ${$a . "_1"}->foo(); - $x = $x->{$a . "_1"}(); - $x->a = C::C; - ${$a . "_1"}->a = ${$a . "_1"}::C; - $x->{a . "_1"} = C::C; - $x = C::$z; - $x = ${$a . "_1"}::$z; - $x = C::${$z . "_1"}; - } - } + static private function f1() { + for ($i = 0, $j = 100; $i < $j; $i++, --$j) { + $s[$i] = $a[$j]; + } + foreach ($a as $key => &$val) { + print "$key => $val\n"; + } + while ($s[$i]) { + $i++; + } + do { + $i--; + } while ($s[$i]); + $x = foo($a + 1, 4, ...[1,2,3]); + $x = ${$a . "_1"}(); + $x = A::foo(); + $x = ${$a . "_1"}::foo(); + $x = A::${$a . "_1"}(); + $x = $x->foo(); + $x = ${$a . "_1"}->foo(); + $x = $x->{$a . "_1"}(); + $x->a = C::C; + ${$a . "_1"}->a = ${$a . "_1"}::C; + $x->{a . "_1"} = C::C; + $x = C::$z; + $x = ${$a . "_1"}::$z; + $x = C::${$z . "_1"}; + } + } })); assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use ($c,&$d) : X { - final class A { - final protected function f2() { - if (!$x) { - return 0; - } - if ($x == 1) { - return 1; - } else if ($x == 2) { - return 2; - } else if ($x == 3) { - return 3; - } else { - if ($x == 9) { - return 9; - } + final class A { + final protected function f2() { + if (!$x) { + return 0; + } + if ($x == 1) { + return 1; + } else if ($x == 2) { + return 2; + } else if ($x == 3) { + return 3; + } else { + if ($x == 9) { + return 9; + } L0: do { - switch ($x) { - case 4: break; - case 5: continue; - case 6: break 2; - case 7: continue 2; - case 8: goto L0; - default: return; - } - } while (0); - } - } - } + switch ($x) { + case 4: break; + case 5: continue; + case 6: break 2; + case 7: continue 2; + case 8: goto L0; + default: return; + } + } while (0); + } + } + } })); assert(0 && ($a = function &(?array &$a, X $b = null) use ($c,&$d) : X { - class A { - use T1, T2 { - T1::foo insteadof foo; - T2::foo as bar; - baz as public; - ops as protected x; - } - use T3; - } + class A { + use T1, T2 { + T1::foo insteadof foo; + T2::foo as bar; + baz as public; + ops as protected x; + } + use T3; + } })); assert(0 && ($a = function &(array &...$a) { - declare(A=1,B=2); - try { - $i++; - } catch (MyException $e) { - echo 1; - } catch (Exception $e) { - echo 2; - } finally { - echo 3; - } + declare(A=1,B=2); + try { + $i++; + } catch (MyException $e) { + echo 1; + } catch (Exception $e) { + echo 2; + } finally { + echo 3; + } })); assert(0 && ($a = function () { - declare(C=1) { echo 1; } - $x = '\'"`$a'; - $x = "'\"`$a"; - $x = `'"\`$a`; - $x = "{$a}b"; - $x = "${a}b"; - $x = " {$foo->bar} ${$foo->bar} "; - $x = " ${'---'} "; - foo(); - \foo(); - namespace\foo(); - $x = foo; - $x = \foo; - $x = namespace\foo; - $x = new foo(); - $x = new \foo(); - $x = new namespace\foo(); + declare(C=1) { echo 1; } + $x = '\'"`$a'; + $x = "'\"`$a"; + $x = `'"\`$a`; + $x = "{$a}b"; + $x = "${a}b"; + $x = " {$foo->bar} ${$foo->bar} "; + $x = " ${'---'} "; + foo(); + \foo(); + namespace\foo(); + $x = foo; + $x = \foo; + $x = namespace\foo; + $x = new foo(); + $x = new \foo(); + $x = new namespace\foo(); if ($a) { } elseif ($b) { } diff --git a/Zend/tests/assert/expect_020.phpt b/Zend/tests/assert/expect_020.phpt index ef8fd5ec12..91b303a42f 100644 --- a/Zend/tests/assert/expect_020.phpt +++ b/Zend/tests/assert/expect_020.phpt @@ -6,8 +6,8 @@ assert.exception=0 --FILE-- <?php assert(0 && ($a = function () { - $var = 'test'; - $str = "$var, $var[1], {$var}[], {$var[1]}[], ${var}[], ${var[1]}[]"; + $var = 'test'; + $str = "$var, $var[1], {$var}[], {$var[1]}[], ${var}[], ${var[1]}[]"; })); ?> --EXPECTF-- diff --git a/Zend/tests/assign_to_obj_002.phpt b/Zend/tests/assign_to_obj_002.phpt index 0ab2e84163..a911c06f36 100644 --- a/Zend/tests/assign_to_obj_002.phpt +++ b/Zend/tests/assign_to_obj_002.phpt @@ -4,7 +4,7 @@ Assign to $this leaks when $this not defined <?php try { - $this->a = new stdClass; + $this->a = new stdClass; } catch (Error $e) { echo $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/break_error_001.phpt b/Zend/tests/break_error_001.phpt index d823f50563..63c9cc3c8e 100644 --- a/Zend/tests/break_error_001.phpt +++ b/Zend/tests/break_error_001.phpt @@ -3,7 +3,7 @@ --FILE-- <?php function foo () { - break 0; + break 0; } ?> --EXPECTF-- diff --git a/Zend/tests/break_error_002.phpt b/Zend/tests/break_error_002.phpt index e78fd7594e..afc889d0fd 100644 --- a/Zend/tests/break_error_002.phpt +++ b/Zend/tests/break_error_002.phpt @@ -3,7 +3,7 @@ --FILE-- <?php function foo () { - break $x; + break $x; } ?> --EXPECTF-- diff --git a/Zend/tests/break_error_003.phpt b/Zend/tests/break_error_003.phpt index fa782343b1..44a0e849ff 100644 --- a/Zend/tests/break_error_003.phpt +++ b/Zend/tests/break_error_003.phpt @@ -3,7 +3,7 @@ --FILE-- <?php function foo () { - break; + break; } ?> --EXPECTF-- diff --git a/Zend/tests/break_error_004.phpt b/Zend/tests/break_error_004.phpt index 1b99a99ee9..e82d96f727 100644 --- a/Zend/tests/break_error_004.phpt +++ b/Zend/tests/break_error_004.phpt @@ -3,9 +3,9 @@ --FILE-- <?php function foo () { - while (1) { - break 2; - } + while (1) { + break 2; + } } ?> --EXPECTF-- diff --git a/Zend/tests/bug18556.phpt b/Zend/tests/bug18556.phpt index da083937c5..94e12097de 100644 --- a/Zend/tests/bug18556.phpt +++ b/Zend/tests/bug18556.phpt @@ -23,8 +23,8 @@ echo "\n"; setlocale(LC_ALL, "tr_TR.utf8"); foreach(get_declared_classes() as $class) { - if(!class_exists($class)) - echo "$class No Longer Exists!\n"; + if(!class_exists($class)) + echo "$class No Longer Exists!\n"; } echo "Done.\n"; diff --git a/Zend/tests/bug20242.phpt b/Zend/tests/bug20242.phpt index 064f8235fa..f1223a03c6 100644 --- a/Zend/tests/bug20242.phpt +++ b/Zend/tests/bug20242.phpt @@ -8,12 +8,12 @@ $t = new test; $t->show_method(); class test { - static function show_static() { - echo "static\n"; - } - function show_method() { - echo "method\n"; - } + static function show_static() { + echo "static\n"; + } + function show_method() { + echo "method\n"; + } } ?> --EXPECT-- diff --git a/Zend/tests/bug22836.phpt b/Zend/tests/bug22836.phpt index 8141f178c6..a9597c4bb4 100644 --- a/Zend/tests/bug22836.phpt +++ b/Zend/tests/bug22836.phpt @@ -4,13 +4,13 @@ Bug #22836 (returning references to NULL) <?php function &f() { - $x = "foo"; - var_dump($x); - print "'$x'\n"; - return ($a); + $x = "foo"; + var_dump($x); + print "'$x'\n"; + return ($a); } for ($i = 0; $i < 8; $i++) { - $h =& f(); + $h =& f(); } ?> --EXPECT-- diff --git a/Zend/tests/bug23104.phpt b/Zend/tests/bug23104.phpt index 04df3bdeb5..38f7d652a4 100644 --- a/Zend/tests/bug23104.phpt +++ b/Zend/tests/bug23104.phpt @@ -4,7 +4,7 @@ Bug #23104 (Hash position not reset for constant arrays) <?php function foo($bar = array("a", "b", "c")) { - var_dump(current($bar)); + var_dump(current($bar)); } foo(); ?> diff --git a/Zend/tests/bug24635.phpt b/Zend/tests/bug24635.phpt index 7235859d3a..7210f83743 100644 --- a/Zend/tests/bug24635.phpt +++ b/Zend/tests/bug24635.phpt @@ -3,21 +3,21 @@ Bug #24635 (crash on dtor calling other functions) --FILE-- <?php class SiteClass { - function __construct() { $this->page = new PageClass(); } + function __construct() { $this->page = new PageClass(); } } class PageClass { - function Display() { - $section = new SectionClass("PageClass::Display"); - } + function Display() { + $section = new SectionClass("PageClass::Display"); + } } class SectionClass { - function __construct($comment) { - $this->Comment = $comment; - } - function __destruct() { - out($this->Comment); // this line doesn't crash PHP - out("\n<!-- End Section: " . $this->Comment . "-->"); // this line - } + function __construct($comment) { + $this->Comment = $comment; + } + function __destruct() { + out($this->Comment); // this line doesn't crash PHP + out("\n<!-- End Section: " . $this->Comment . "-->"); // this line + } } function out($code) { return; } $site = new SiteClass(); diff --git a/Zend/tests/bug24773.phpt b/Zend/tests/bug24773.phpt index 4116492807..1a73b3df1b 100644 --- a/Zend/tests/bug24773.phpt +++ b/Zend/tests/bug24773.phpt @@ -2,8 +2,8 @@ Bug #24773 (unset() of integers treated as arrays causes a crash) --FILE-- <?php - $array = 'test'; - unset($array["lvl1"]["lvl2"]["b"]); + $array = 'test'; + unset($array["lvl1"]["lvl2"]["b"]); ?> --EXPECTF-- Fatal error: Uncaught Error: Cannot use string offset as an array in %s:%d diff --git a/Zend/tests/bug26010.phpt b/Zend/tests/bug26010.phpt index 9761700bb8..bb5789ae29 100644 --- a/Zend/tests/bug26010.phpt +++ b/Zend/tests/bug26010.phpt @@ -3,9 +3,9 @@ Bug #26010 (private / protected variables get exposed by get_object_vars()) --FILE-- <?php class foo { - private $private = 'private'; - protected $protected = 'protected'; - public $public = 'public'; + private $private = 'private'; + protected $protected = 'protected'; + public $public = 'public'; } $data = new foo(); $obj_vars = get_object_vars($data); diff --git a/Zend/tests/bug26166.phpt b/Zend/tests/bug26166.phpt index bd16050a87..7e5668e47f 100644 --- a/Zend/tests/bug26166.phpt +++ b/Zend/tests/bug26166.phpt @@ -33,8 +33,8 @@ echo "===NONE===\n"; class NoneTest { - function __toString() { - } + function __toString() { + } } $o = new NoneTest; @@ -48,16 +48,16 @@ echo "===THROW===\n"; class ErrorTest { - function __toString() { - throw new Exception("This is an error!"); - } + function __toString() { + throw new Exception("This is an error!"); + } } $o = new ErrorTest; try { - echo $o; + echo $o; } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/bug26229.phpt b/Zend/tests/bug26229.phpt index 393b49f3d0..ffc6995f43 100644 --- a/Zend/tests/bug26229.phpt +++ b/Zend/tests/bug26229.phpt @@ -13,14 +13,14 @@ $obj = new array_iterator; try { - foreach ($obj as $property => $value) - { - var_dump($value); - } + foreach ($obj as $property => $value) + { + var_dump($value); + } } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/Zend/tests/bug26281.phpt b/Zend/tests/bug26281.phpt index e1888a88dd..9844d31538 100644 --- a/Zend/tests/bug26281.phpt +++ b/Zend/tests/bug26281.phpt @@ -2,12 +2,12 @@ Bug #26281 (switch() crash when condition is a string offset) --FILE-- <?php - $x = 'abc'; - switch ($x[0]) { - case 'a': - echo "no crash\n"; - break; - } + $x = 'abc'; + switch ($x[0]) { + case 'a': + echo "no crash\n"; + break; + } ?> --EXPECT-- no crash diff --git a/Zend/tests/bug26696.phpt b/Zend/tests/bug26696.phpt index 57ba310c1d..a55dcf6ee5 100644 --- a/Zend/tests/bug26696.phpt +++ b/Zend/tests/bug26696.phpt @@ -5,14 +5,14 @@ Bug #26696 (crash in switch() when string index is used) $str = 'asdd/?'; $len = strlen($str); for ($i = 0; $i < $len; $i++) { - switch ($str[$i]) { - case '?': - echo "?+\n"; - break; - default: - echo $str[$i].'-'; - break; - } + switch ($str[$i]) { + case '?': + echo "?+\n"; + break; + default: + echo $str[$i].'-'; + break; + } } ?> diff --git a/Zend/tests/bug26697.phpt b/Zend/tests/bug26697.phpt index 1692e388ef..d5e3592764 100644 --- a/Zend/tests/bug26697.phpt +++ b/Zend/tests/bug26697.phpt @@ -4,9 +4,9 @@ Bug #26697 (calling class_exists on a nonexistent class in autoloader results in <?php spl_autoload_register(function ($name) { - echo __METHOD__ . "($name)\n"; - var_dump(class_exists('NotExistingClass')); - echo __METHOD__ . "($name), done\n"; + echo __METHOD__ . "($name)\n"; + var_dump(class_exists('NotExistingClass')); + echo __METHOD__ . "($name), done\n"; }); var_dump(class_exists('NotExistingClass')); diff --git a/Zend/tests/bug26698.phpt b/Zend/tests/bug26698.phpt index 066fdc3a37..834e0b77c2 100644 --- a/Zend/tests/bug26698.phpt +++ b/Zend/tests/bug26698.phpt @@ -7,56 +7,56 @@ ini_set("report_memleaks", 0); // the exception thrown in this test results in class ObjectOne { - function getNone() - { - throw new Exception('NONE'); - } + function getNone() + { + throw new Exception('NONE'); + } } class Proxy { - function three($a, $b, $c) - { - } + function three($a, $b, $c) + { + } - function callOne() - { - try - { - $res = new ObjectOne(); - $this->three($res->getNone()); - } - catch(Exception $e) - { - echo 'Caught: '.$e->getMessage()."\n"; - } - } + function callOne() + { + try + { + $res = new ObjectOne(); + $this->three($res->getNone()); + } + catch(Exception $e) + { + echo 'Caught: '.$e->getMessage()."\n"; + } + } - function callTwo() - { - try - { - $res = new ObjectOne(); - $this->three(1, $res->getNone()); - } - catch(Exception $e) - { - echo 'Caught: '.$e->getMessage()."\n"; - } - } + function callTwo() + { + try + { + $res = new ObjectOne(); + $this->three(1, $res->getNone()); + } + catch(Exception $e) + { + echo 'Caught: '.$e->getMessage()."\n"; + } + } - function callThree() - { - try - { - $res = new ObjectOne(); - $this->three(1, 2, $res->getNone()); - } - catch(Exception $e) - { - echo 'Caught: '.$e->getMessage()."\n"; - } - } + function callThree() + { + try + { + $res = new ObjectOne(); + $this->three(1, 2, $res->getNone()); + } + catch(Exception $e) + { + echo 'Caught: '.$e->getMessage()."\n"; + } + } } $p = new Proxy(); diff --git a/Zend/tests/bug26801.phpt b/Zend/tests/bug26801.phpt index b8cc37aa16..34f1a693fd 100644 --- a/Zend/tests/bug26801.phpt +++ b/Zend/tests/bug26801.phpt @@ -6,14 +6,14 @@ Bug #26801 (switch ($a{0}) crash) $a = '11'; $b = $a[0]; switch ($b) { - case '-': - break; + case '-': + break; } $a = '22'; switch ($a[0]) { - case '-': - break; + case '-': + break; } ?> diff --git a/Zend/tests/bug26802.phpt b/Zend/tests/bug26802.phpt index 11e468d088..52dc45b3b0 100644 --- a/Zend/tests/bug26802.phpt +++ b/Zend/tests/bug26802.phpt @@ -5,7 +5,7 @@ Bug #26802 (Can't call static method using a variable) function global_func() { - echo __METHOD__ . "\n"; + echo __METHOD__ . "\n"; } $function = 'global_func'; @@ -13,12 +13,12 @@ $function(); class foo { - static $method = 'global_func'; + static $method = 'global_func'; - static public function foo_func() - { - echo __METHOD__ . "\n"; - } + static public function foo_func() + { + echo __METHOD__ . "\n"; + } } /* The following is a BC break with PHP 4 where it would diff --git a/Zend/tests/bug27304.phpt b/Zend/tests/bug27304.phpt index f9ca3e2ecf..7400a8fa1f 100644 --- a/Zend/tests/bug27304.phpt +++ b/Zend/tests/bug27304.phpt @@ -5,10 +5,10 @@ Bug #27304 (Static functions don't function properly) class Staticexample { - static function test() - { - var_dump(isset($this)); - } + static function test() + { + var_dump(isset($this)); + } } $b = new Staticexample(); diff --git a/Zend/tests/bug27669.phpt b/Zend/tests/bug27669.phpt index 679c7a6105..7067c23e0d 100644 --- a/Zend/tests/bug27669.phpt +++ b/Zend/tests/bug27669.phpt @@ -2,13 +2,13 @@ Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dynamically) --FILE-- <?php - class A { - static function hello() { - echo "Hello World\n"; - } - } - $y[0] = 'hello'; - A::{$y[0]}(); + class A { + static function hello() { + echo "Hello World\n"; + } + } + $y[0] = 'hello'; + A::{$y[0]}(); ?> --EXPECTF-- Hello World diff --git a/Zend/tests/bug27731.phpt b/Zend/tests/bug27731.phpt index 408e4242ad..655fffd515 100644 --- a/Zend/tests/bug27731.phpt +++ b/Zend/tests/bug27731.phpt @@ -2,9 +2,9 @@ Bug #27731 (error_reporing() call inside @ block does not work correctly) --FILE-- <?php - error_reporting(E_ALL ^ E_NOTICE); - @error_reporting(E_WARNING); - var_dump(error_reporting()); + error_reporting(E_ALL ^ E_NOTICE); + @error_reporting(E_WARNING); + var_dump(error_reporting()); ?> --EXPECT-- int(2) diff --git a/Zend/tests/bug27798.phpt b/Zend/tests/bug27798.phpt index 9c84731fe6..310fd97991 100644 --- a/Zend/tests/bug27798.phpt +++ b/Zend/tests/bug27798.phpt @@ -5,27 +5,27 @@ Bug #27798 (private / protected variables not exposed by get_object_vars() insid class Base { - public $Foo = 1; - protected $Bar = 2; - private $Baz = 3; + public $Foo = 1; + protected $Bar = 2; + private $Baz = 3; - function __construct() - { - echo __METHOD__ . "\n"; - var_dump(get_object_vars($this)); - } + function __construct() + { + echo __METHOD__ . "\n"; + var_dump(get_object_vars($this)); + } } class Child extends Base { - private $Baz = 4; + private $Baz = 4; - function __construct() - { - parent::__construct(); - echo __METHOD__ . "\n"; - var_dump(get_object_vars($this)); - } + function __construct() + { + parent::__construct(); + echo __METHOD__ . "\n"; + var_dump(get_object_vars($this)); + } } var_dump(get_object_vars(new Base)); diff --git a/Zend/tests/bug28444.phpt b/Zend/tests/bug28444.phpt index 245a1f2704..586976a675 100644 --- a/Zend/tests/bug28444.phpt +++ b/Zend/tests/bug28444.phpt @@ -5,39 +5,39 @@ Bug #28444 (Cannot access undefined property for object with overloaded property class ObjectOne { - public $x; + public $x; - function __construct($x) - { - $this->x = $x; - } + function __construct($x) + { + $this->x = $x; + } - function __toString() { - return "Object"; - } + function __toString() { + return "Object"; + } } class Overloaded { - public $props = array(); - public $x; + public $props = array(); + public $x; - function __construct($x) - { - $this->x = new ObjectOne($x); - } + function __construct($x) + { + $this->x = new ObjectOne($x); + } - function __get($prop) - { - echo __METHOD__ . "($prop)\n"; - return $this->props[$prop]; - } + function __get($prop) + { + echo __METHOD__ . "($prop)\n"; + return $this->props[$prop]; + } - function __set($prop, $val) - { - echo __METHOD__ . "($prop,$val)\n"; - $this->props[$prop] = $val; - } + function __set($prop, $val) + { + echo __METHOD__ . "($prop,$val)\n"; + $this->props[$prop] = $val; + } } $y = new Overloaded(2); var_dump($y->x); diff --git a/Zend/tests/bug29210.phpt b/Zend/tests/bug29210.phpt index db3a67bee6..e50b7c2905 100644 --- a/Zend/tests/bug29210.phpt +++ b/Zend/tests/bug29210.phpt @@ -4,35 +4,35 @@ Bug #29210 (Function is_callable does not support private and protected methods) <?php class test_class { private function test_func1() { - echo "test_func1\n"; + echo "test_func1\n"; } protected function test_func2() { - echo "test_func2\n"; + echo "test_func2\n"; } static private function test_func3() { - echo "test_func3\n"; + echo "test_func3\n"; } static protected function test_func4() { - echo "test_func4\n"; + echo "test_func4\n"; } function test() { if (is_callable(array($this,'test_func1'))) { - $this->test_func1(); + $this->test_func1(); } else { echo "test_func1 isn't callable from inside\n"; } if (is_callable(array($this,'test_func2'))) { - $this->test_func2(); + $this->test_func2(); } else { echo "test_func2 isn't callable from inside\n"; } if (is_callable(array('test_class','test_func3'))) { - test_class::test_func3(); + test_class::test_func3(); } else { echo "test_func3 isn't callable from inside\n"; } if (is_callable(array('test_class','test_func4'))) { - test_class::test_func4(); + test_class::test_func4(); } else { echo "test_func4 isn't callable from inside\n"; } @@ -42,22 +42,22 @@ class test_class { class foo extends test_class { function test() { if (is_callable(array($this,'test_func1'))) { - $this->test_func1(); + $this->test_func1(); } else { echo "test_func1 isn't callable from child\n"; } if (is_callable(array($this,'test_func2'))) { - $this->test_func2(); + $this->test_func2(); } else { echo "test_func2 isn't callable from child\n"; } if (is_callable(array('test_class','test_func3'))) { - test_class::test_func3(); + test_class::test_func3(); } else { echo "test_func3 isn't callable from child\n"; } if (is_callable(array('test_class','test_func4'))) { - test_class::test_func4(); + test_class::test_func4(); } else { echo "test_func4 isn't callable from child\n"; } @@ -67,12 +67,12 @@ class foo extends test_class { $object = new test_class; $object->test(); if (is_callable(array($object,'test_func1'))) { - $object->test_func1(); + $object->test_func1(); } else { echo "test_func1 isn't callable from outside\n"; } if (is_callable(array($object,'test_func2'))) { - $object->test_func2(); + $object->test_func2(); } else { echo "test_func2 isn't callable from outside\n"; } diff --git a/Zend/tests/bug29368.phpt b/Zend/tests/bug29368.phpt index 20dc59a644..ae6139efc6 100644 --- a/Zend/tests/bug29368.phpt +++ b/Zend/tests/bug29368.phpt @@ -5,23 +5,23 @@ Bug #29368 (The destructor is called when an exception is thrown from the constr class Foo { - function __construct() - { - echo __METHOD__ . "\n"; - throw new Exception; - } - function __destruct() - { - echo __METHOD__ . "\n"; - } + function __construct() + { + echo __METHOD__ . "\n"; + throw new Exception; + } + function __destruct() + { + echo __METHOD__ . "\n"; + } } try { - $bar = new Foo; + $bar = new Foo; } catch(Exception $exc) { - echo "Caught exception!\n"; + echo "Caught exception!\n"; } unset($bar); diff --git a/Zend/tests/bug29368_2.phpt b/Zend/tests/bug29368_2.phpt index acecefcb9b..e13d6da884 100644 --- a/Zend/tests/bug29368_2.phpt +++ b/Zend/tests/bug29368_2.phpt @@ -3,16 +3,16 @@ Bug #29368.2 (The destructor is called when an exception is thrown from the cons --FILE-- <?php class Bomb { - function foo() { - } - function __destruct() { - throw new Exception("bomb!"); - } + function foo() { + } + function __destruct() { + throw new Exception("bomb!"); + } } try { - $x = new ReflectionMethod(new Bomb(), "foo"); + $x = new ReflectionMethod(new Bomb(), "foo"); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } echo "ok\n"; ?> diff --git a/Zend/tests/bug29368_3.phpt b/Zend/tests/bug29368_3.phpt index fafcc2a0ef..5193a91c89 100644 --- a/Zend/tests/bug29368_3.phpt +++ b/Zend/tests/bug29368_3.phpt @@ -3,27 +3,27 @@ Bug #29368.3 (The destructor is called when an exception is thrown from the cons --FILE-- <?php class Foo { - function __construct() { - echo __METHOD__ . "\n"; - } - function __destruct() { - echo __METHOD__ . "\n"; - } + function __construct() { + echo __METHOD__ . "\n"; + } + function __destruct() { + echo __METHOD__ . "\n"; + } } class Bar { - function __construct() { - echo __METHOD__ . "\n"; - throw new Exception; - } - function __destruct() { - echo __METHOD__ . "\n"; - } + function __construct() { + echo __METHOD__ . "\n"; + throw new Exception; + } + function __destruct() { + echo __METHOD__ . "\n"; + } } try { - new Foo() + new Bar(); + new Foo() + new Bar(); } catch(Exception $exc) { - echo "Caught exception!\n"; + echo "Caught exception!\n"; } ?> --EXPECT-- diff --git a/Zend/tests/bug29674.phpt b/Zend/tests/bug29674.phpt index f1706cabb7..b9cb4230fe 100644 --- a/Zend/tests/bug29674.phpt +++ b/Zend/tests/bug29674.phpt @@ -5,18 +5,18 @@ Bug #29674 (inherited method doesn't have access to private variables of the der class BaseClass { - private $private_base = "Base"; + private $private_base = "Base"; - function printVars () - { - var_dump($this->private_base); - var_dump($this->private_child); - } + function printVars () + { + var_dump($this->private_base); + var_dump($this->private_child); + } } class ChildClass extends BaseClass { - private $private_child = "Child"; + private $private_child = "Child"; } echo "===BASE===\n"; diff --git a/Zend/tests/bug30140.phpt b/Zend/tests/bug30140.phpt index 1dfb83500f..157e7071cc 100644 --- a/Zend/tests/bug30140.phpt +++ b/Zend/tests/bug30140.phpt @@ -3,9 +3,9 @@ Bug #30140 (Problem with array in static properties) --FILE-- <?php class A { - public static $test1 = true; - public static $test2 = array(); - public static $test3 = "str"; + public static $test1 = true; + public static $test2 = array(); + public static $test3 = "str"; } class B extends A { diff --git a/Zend/tests/bug30162.phpt b/Zend/tests/bug30162.phpt index 4b2739ab2e..6cefd62ea7 100644 --- a/Zend/tests/bug30162.phpt +++ b/Zend/tests/bug30162.phpt @@ -4,35 +4,35 @@ Bug #30162 (Catching exception in constructor couses lose of $this) <?php class FIIFO { - public function __construct() { - $this->x = "x"; - throw new Exception; - } + public function __construct() { + $this->x = "x"; + throw new Exception; + } } class hariCow extends FIIFO { - public function __construct() { - try { - parent::__construct(); - } catch(Exception $e) { - } - $this->y = "y"; - try { - $this->z = new FIIFO; - } catch(Exception $e) { - } - } - - public function __toString() { - return "Rusticus in asino sedet."; - } + public function __construct() { + try { + parent::__construct(); + } catch(Exception $e) { + } + $this->y = "y"; + try { + $this->z = new FIIFO; + } catch(Exception $e) { + } + } + + public function __toString() { + return "Rusticus in asino sedet."; + } } try { - $db = new FIIFO(); + $db = new FIIFO(); } catch(Exception $e) { } var_dump($db); diff --git a/Zend/tests/bug30394.phpt b/Zend/tests/bug30394.phpt index 516bea2d2d..895326359b 100644 --- a/Zend/tests/bug30394.phpt +++ b/Zend/tests/bug30394.phpt @@ -4,17 +4,17 @@ Bug #30394 (Assignment operators yield wrong result with __get/__set) <?php class Container { - public function __get( $what ) - { - return $this->_p[ $what ]; - } + public function __get( $what ) + { + return $this->_p[ $what ]; + } - public function __set( $what, $value ) - { - $this->_p[ $what ] = $value; - } + public function __set( $what, $value ) + { + $this->_p[ $what ] = $value; + } - private $_p = array(); + private $_p = array(); } $c = new Container(); diff --git a/Zend/tests/bug30407.phpt b/Zend/tests/bug30407.phpt index ad1993897d..16cadaa780 100644 --- a/Zend/tests/bug30407.phpt +++ b/Zend/tests/bug30407.phpt @@ -4,8 +4,8 @@ Bug #30407 (Strange behaviour of default arguments) <?php function haricow($a = 'one') { - var_dump($a); - $a = 'two'; + var_dump($a); + $a = 'two'; } haricow(); diff --git a/Zend/tests/bug30451.phpt b/Zend/tests/bug30451.phpt index 5e9696f128..2c3b62788d 100644 --- a/Zend/tests/bug30451.phpt +++ b/Zend/tests/bug30451.phpt @@ -5,25 +5,25 @@ Bug #30451 (static properties permissions broken) class A { - protected static $property = TRUE; + protected static $property = TRUE; - protected static function method() { - return TRUE; - } + protected static function method() { + return TRUE; + } } class B extends A { - public function __construct() { + public function __construct() { - var_dump(self::method()); - var_dump(parent::method()); + var_dump(self::method()); + var_dump(parent::method()); - var_dump(self::$property); - var_dump(parent::$property); + var_dump(self::$property); + var_dump(parent::$property); - } + } } diff --git a/Zend/tests/bug30702.phpt b/Zend/tests/bug30702.phpt index f23b1ecd44..e9bb585859 100644 --- a/Zend/tests/bug30702.phpt +++ b/Zend/tests/bug30702.phpt @@ -3,7 +3,7 @@ Bug #30702 (cannot initialize class variable from class constant) --FILE-- <?php class foo { - const C1=1; + const C1=1; } class bar extends foo { diff --git a/Zend/tests/bug30707.phpt b/Zend/tests/bug30707.phpt index 89db55c36a..17ccb17c19 100644 --- a/Zend/tests/bug30707.phpt +++ b/Zend/tests/bug30707.phpt @@ -3,23 +3,23 @@ Bug #30707 (Segmentation fault on exception in method) --FILE-- <?php class C { - function byePHP($plop) { - echo "ok\n"; - } + function byePHP($plop) { + echo "ok\n"; + } - function plip() { - try { - $this->plap($this->plop()); - } catch(Exception $e) { - } - } + function plip() { + try { + $this->plap($this->plop()); + } catch(Exception $e) { + } + } - function plap($a) { - } + function plap($a) { + } - function plop() { - throw new Exception; - } + function plop() { + throw new Exception; + } } $x = new C; diff --git a/Zend/tests/bug30725.phpt b/Zend/tests/bug30725.phpt index bbcf09dfdd..b2ed209bcd 100644 --- a/Zend/tests/bug30725.phpt +++ b/Zend/tests/bug30725.phpt @@ -5,24 +5,24 @@ Bug #30725 (PHP segfaults when an exception is thrown in getIterator() within fo class Test implements IteratorAggregate { - function getIterator() - { - throw new Exception(); - } + function getIterator() + { + throw new Exception(); + } } try { - $it = new Test; - foreach($it as $v) - { - echo "Fail\n"; - } - echo "Wrong\n"; + $it = new Test; + foreach($it as $v) + { + echo "Fail\n"; + } + echo "Wrong\n"; } catch(Exception $e) { - echo "Caught\n"; + echo "Caught\n"; } ?> diff --git a/Zend/tests/bug30828.phpt b/Zend/tests/bug30828.phpt index d05dbb606d..4e921403b7 100644 --- a/Zend/tests/bug30828.phpt +++ b/Zend/tests/bug30828.phpt @@ -3,43 +3,43 @@ Bug #30828 (debug_backtrace() reports incorrect class in overridden methods) --FILE-- <?php class A { - function __construct() { - debug_print_backtrace(); - $bt = debug_backtrace(); - foreach ($bt as $t) { - print $t['class'].$t['type'].$t['function']."\n"; - } - } + function __construct() { + debug_print_backtrace(); + $bt = debug_backtrace(); + foreach ($bt as $t) { + print $t['class'].$t['type'].$t['function']."\n"; + } + } - function foo() { - debug_print_backtrace(); - $bt = debug_backtrace(); - foreach ($bt as $t) { + function foo() { + debug_print_backtrace(); + $bt = debug_backtrace(); + foreach ($bt as $t) { print $t['class'].$t['type'].$t['function']."\n"; - } - } + } + } - static function bar() { - debug_print_backtrace(); - $bt = debug_backtrace(); - foreach ($bt as $t) { - print $t['class'].$t['type'].$t['function']."\n"; - } - } + static function bar() { + debug_print_backtrace(); + $bt = debug_backtrace(); + foreach ($bt as $t) { + print $t['class'].$t['type'].$t['function']."\n"; + } + } } class B extends A { - function __construct() { - parent::__construct(); - } + function __construct() { + parent::__construct(); + } - function foo() { - parent::foo(); - } + function foo() { + parent::foo(); + } - static function bar() { - parent::bar(); - } + static function bar() { + parent::bar(); + } } $b = new B(); diff --git a/Zend/tests/bug31102.phpt b/Zend/tests/bug31102.phpt index c01c2e004a..fd3a4332fd 100644 --- a/Zend/tests/bug31102.phpt +++ b/Zend/tests/bug31102.phpt @@ -6,33 +6,33 @@ Bug #31102 (Exception not handled when thrown inside autoloader) $test = 0; spl_autoload_register(function ($class) { - global $test; + global $test; - echo __METHOD__ . "($class,$test)\n"; - switch($test) - { - case 1: - eval("class $class { function __construct(){throw new Exception('$class::__construct');}}"); - return; - case 2: - eval("class $class { function __construct(){throw new Exception('$class::__construct');}}"); - throw new Exception(__METHOD__); - return; - case 3: - return; - } + echo __METHOD__ . "($class,$test)\n"; + switch($test) + { + case 1: + eval("class $class { function __construct(){throw new Exception('$class::__construct');}}"); + return; + case 2: + eval("class $class { function __construct(){throw new Exception('$class::__construct');}}"); + throw new Exception(__METHOD__); + return; + case 3: + return; + } }); while($test++ < 5) { - try - { - eval("\$bug = new Test$test();"); - } - catch (Exception $e) - { - echo "Caught: " . $e->getMessage() . "\n"; - } + try + { + eval("\$bug = new Test$test();"); + } + catch (Exception $e) + { + echo "Caught: " . $e->getMessage() . "\n"; + } } ?> ===DONE=== diff --git a/Zend/tests/bug31177.phpt b/Zend/tests/bug31177.phpt index c443420118..2cd3dac920 100644 --- a/Zend/tests/bug31177.phpt +++ b/Zend/tests/bug31177.phpt @@ -4,39 +4,39 @@ Bug #31177 (Memory leak) <?php class DbGow { - public function query() { - throw new Exception; - } + public function query() { + throw new Exception; + } - public function select() { - return new DbGowRecordSet($this->query()); - } + public function select() { + return new DbGowRecordSet($this->query()); + } - public function select2() { - new DbGowRecordSet($this->query()); - } + public function select2() { + new DbGowRecordSet($this->query()); + } } class DbGowRecordSet { - public function __construct($resource) { - } + public function __construct($resource) { + } } $db = new DbGow; try { - $rs = $db->select(); + $rs = $db->select(); } catch(Exception $e) { - echo "ok\n"; + echo "ok\n"; } try { - $db->select2(); + $db->select2(); } catch(Exception $e) { - echo "ok\n"; + echo "ok\n"; } ?> --EXPECT-- diff --git a/Zend/tests/bug31341.phpt b/Zend/tests/bug31341.phpt index 309a54d76b..289e03a0ba 100644 --- a/Zend/tests/bug31341.phpt +++ b/Zend/tests/bug31341.phpt @@ -3,18 +3,18 @@ Bug #31341 (escape on curly inconsistent) --FILE-- <?php $a = array( - "$ \{ ", - " \{ $", - " \{$ ", - " $\{ ", - " \$\{ ", - " \{\$ ", - "\$ \{ ", - " \{ \$", - "% \{ "); + "$ \{ ", + " \{ $", + " \{$ ", + " $\{ ", + " \$\{ ", + " \{\$ ", + "\$ \{ ", + " \{ \$", + "% \{ "); foreach ($a as $v) { - echo("'$v'\n"); + echo("'$v'\n"); } ?> --EXPECT-- diff --git a/Zend/tests/bug32226.phpt b/Zend/tests/bug32226.phpt index d3432c4247..f56f06f107 100644 --- a/Zend/tests/bug32226.phpt +++ b/Zend/tests/bug32226.phpt @@ -26,7 +26,7 @@ $a = new A(); } catch(Exception $e) { - echo "Caught\n"; + echo "Caught\n"; } ?> diff --git a/Zend/tests/bug32252.phpt b/Zend/tests/bug32252.phpt index ce97384c0e..f138857175 100644 --- a/Zend/tests/bug32252.phpt +++ b/Zend/tests/bug32252.phpt @@ -5,28 +5,28 @@ Bug #32252 (Segfault when offsetSet throws an Exception (only without debug)) class Test implements ArrayAccess { - function offsetExists($offset) - { - echo __METHOD__ . "($offset)\n"; - return false; - } + function offsetExists($offset) + { + echo __METHOD__ . "($offset)\n"; + return false; + } - function offsetGet($offset) - { - echo __METHOD__ . "($offset)\n"; - return null; - } + function offsetGet($offset) + { + echo __METHOD__ . "($offset)\n"; + return null; + } - function offsetSet($offset, $value) - { - echo __METHOD__ . "($offset, $value)\n"; - throw new Exception("Ooops"); - } + function offsetSet($offset, $value) + { + echo __METHOD__ . "($offset, $value)\n"; + throw new Exception("Ooops"); + } - function offsetUnset($offset) - { - echo __METHOD__ . "($offset)\n"; - } + function offsetUnset($offset) + { + echo __METHOD__ . "($offset)\n"; + } } $list = new Test(); @@ -36,7 +36,7 @@ try } catch (Exception $e) { - echo "CAUGHT\n"; + echo "CAUGHT\n"; } ?> diff --git a/Zend/tests/bug32290.phpt b/Zend/tests/bug32290.phpt index a58bcf4ce3..957bbd44a1 100644 --- a/Zend/tests/bug32290.phpt +++ b/Zend/tests/bug32290.phpt @@ -7,78 +7,78 @@ error_reporting=8191 class TestA { - public function doSomething($i) - { - echo __METHOD__ . "($i)\n"; - return --$i; - } - - public function doSomethingThis($i) - { - echo __METHOD__ . "($i)\n"; - return --$i; - } - - public function doSomethingParent($i) - { - echo __METHOD__ . "($i)\n"; - return --$i; - } - - public function doSomethingParentThis($i) - { - echo __METHOD__ . "($i)\n"; - return --$i; - } - - public static function doSomethingStatic($i) - { - echo __METHOD__ . "($i)\n"; - return --$i; - } + public function doSomething($i) + { + echo __METHOD__ . "($i)\n"; + return --$i; + } + + public function doSomethingThis($i) + { + echo __METHOD__ . "($i)\n"; + return --$i; + } + + public function doSomethingParent($i) + { + echo __METHOD__ . "($i)\n"; + return --$i; + } + + public function doSomethingParentThis($i) + { + echo __METHOD__ . "($i)\n"; + return --$i; + } + + public static function doSomethingStatic($i) + { + echo __METHOD__ . "($i)\n"; + return --$i; + } } class TestB extends TestA { - public function doSomething($i) - { - echo __METHOD__ . "($i)\n"; - $i++; - if ($i >= 5) return 5; - return call_user_func_array(array("TestA", "doSomething"), array($i)); - } - - public function doSomethingThis($i) - { - echo __METHOD__ . "($i)\n"; - $i++; - if ($i >= 5) return 5; - return call_user_func_array(array($this, "TestA::doSomethingThis"), array($i)); - } - - public function doSomethingParent($i) - { - echo __METHOD__ . "($i)\n"; - $i++; - if ($i >= 5) return 5; - return call_user_func_array(array("parent", "doSomethingParent"), array($i)); - } - - public function doSomethingParentThis($i) - { - echo __METHOD__ . "($i)\n"; - $i++; - if ($i >= 5) return 5; - return call_user_func_array(array($this, "parent::doSomethingParentThis"), array($i)); - } - - public static function doSomethingStatic($i) - { - echo __METHOD__ . "($i)\n"; - $i++; - if ($i >= 5) return 5; - return call_user_func_array(array("TestA", "doSomethingStatic"), array($i)); - } + public function doSomething($i) + { + echo __METHOD__ . "($i)\n"; + $i++; + if ($i >= 5) return 5; + return call_user_func_array(array("TestA", "doSomething"), array($i)); + } + + public function doSomethingThis($i) + { + echo __METHOD__ . "($i)\n"; + $i++; + if ($i >= 5) return 5; + return call_user_func_array(array($this, "TestA::doSomethingThis"), array($i)); + } + + public function doSomethingParent($i) + { + echo __METHOD__ . "($i)\n"; + $i++; + if ($i >= 5) return 5; + return call_user_func_array(array("parent", "doSomethingParent"), array($i)); + } + + public function doSomethingParentThis($i) + { + echo __METHOD__ . "($i)\n"; + $i++; + if ($i >= 5) return 5; + return call_user_func_array(array($this, "parent::doSomethingParentThis"), array($i)); + } + + public static function doSomethingStatic($i) + { + echo __METHOD__ . "($i)\n"; + $i++; + if ($i >= 5) return 5; + return call_user_func_array(array("TestA", "doSomethingStatic"), array($i)); + } } $x = new TestB(); diff --git a/Zend/tests/bug32296.phpt b/Zend/tests/bug32296.phpt index b3e705ec14..16914a71b4 100644 --- a/Zend/tests/bug32296.phpt +++ b/Zend/tests/bug32296.phpt @@ -3,26 +3,26 @@ Bug #32296 (get_class_methods output has changed between 5.0.2 and 5.0.3) --FILE-- <?php abstract class space{ - function __construct(){} - abstract protected function unfold(); + function __construct(){} + abstract protected function unfold(); } abstract class shape extends space{ - private function x1() {} - protected final function unfold(){} + private function x1() {} + protected final function unfold(){} } abstract class quad extends shape{ - private function x2() {} - function buggy(){ - $c = get_class($this); - $a = get_class_methods(get_class($this)); - $b = get_class_methods($this); - print($c."\n".'a:'); - print_r($a); - print('b:'); - print_r($b); - } + private function x2() {} + function buggy(){ + $c = get_class($this); + $a = get_class_methods(get_class($this)); + $b = get_class_methods($this); + print($c."\n".'a:'); + print_r($a); + print('b:'); + print_r($b); + } } class square extends quad{} diff --git a/Zend/tests/bug32427.phpt b/Zend/tests/bug32427.phpt index 9b2d818659..ee41021f51 100644 --- a/Zend/tests/bug32427.phpt +++ b/Zend/tests/bug32427.phpt @@ -4,13 +4,13 @@ Bug #32427 (Interfaces are not allowed 'static' access modifier) <?php interface Example { - public static function sillyError(); + public static function sillyError(); } class ExampleImpl implements Example { - public static function sillyError() { - echo "I am a silly error\n"; - } + public static function sillyError() { + echo "I am a silly error\n"; + } } ExampleImpl::sillyError(); diff --git a/Zend/tests/bug32429.phpt b/Zend/tests/bug32429.phpt index b711831afb..c9e7828f02 100644 --- a/Zend/tests/bug32429.phpt +++ b/Zend/tests/bug32429.phpt @@ -4,21 +4,21 @@ Bug #32429 (method_exists() always return TRUE if __call method exists) <?php class TestClass { - public function __construct() { - var_dump(method_exists($this, 'test')); + public function __construct() { + var_dump(method_exists($this, 'test')); - if (method_exists($this, 'test')) { - $this->test(); - } - } + if (method_exists($this, 'test')) { + $this->test(); + } + } - public function __call($name, $args) { - throw new Exception('Call to undefined method'.get_class($this).'::'.$name.'()'); - } + public function __call($name, $args) { + throw new Exception('Call to undefined method'.get_class($this).'::'.$name.'()'); + } } try { - $test = new TestClass; + $test = new TestClass; } catch (Exception $e) { exit($e->getMessage()); } diff --git a/Zend/tests/bug32660.phpt b/Zend/tests/bug32660.phpt index 8651d491f8..1a6e4d8068 100644 --- a/Zend/tests/bug32660.phpt +++ b/Zend/tests/bug32660.phpt @@ -4,17 +4,17 @@ Bug #32660 (Assignment by reference causes crash when field access is overloaded <?php class A { - public $q; + public $q; - function __construct() - { - $this->q = 3;//array(); - } + function __construct() + { + $this->q = 3;//array(); + } - function __get($name) - { - return $this->q; - } + function __get($name) + { + return $this->q; + } } $a = new A; diff --git a/Zend/tests/bug32674.phpt b/Zend/tests/bug32674.phpt index f932517d9b..8f4cef4157 100644 --- a/Zend/tests/bug32674.phpt +++ b/Zend/tests/bug32674.phpt @@ -48,14 +48,14 @@ $obj = new class2(); $col = new collection(); try { - foreach($col as $co) { - //irrelevant - } - echo 'shouldn`t get here'; - //$dummy = 'this will not crash'; - $obj->dummy = 'this will crash'; + foreach($col as $co) { + //irrelevant + } + echo 'shouldn`t get here'; + //$dummy = 'this will not crash'; + $obj->dummy = 'this will crash'; } catch (Exception $e) { - echo "ok\n"; + echo "ok\n"; } ?> --EXPECT-- diff --git a/Zend/tests/bug32799.phpt b/Zend/tests/bug32799.phpt index c76daeddef..036d94711d 100644 --- a/Zend/tests/bug32799.phpt +++ b/Zend/tests/bug32799.phpt @@ -5,13 +5,13 @@ Bug #32799 (crash: calling the corresponding global var during the destruct) class test{ public $c=1; function __destruct (){ - if (!isset($GLOBALS['p'])) { - echo "NULL\n"; - } else { - $GLOBALS['p']->c++; // no warning - print $GLOBALS['p']->c."\n"; // segfault - var_dump($GLOBALS['p']); - } + if (!isset($GLOBALS['p'])) { + echo "NULL\n"; + } else { + $GLOBALS['p']->c++; // no warning + print $GLOBALS['p']->c."\n"; // segfault + var_dump($GLOBALS['p']); + } } } $p=new test; diff --git a/Zend/tests/bug33171.phpt b/Zend/tests/bug33171.phpt index a342e10439..5fb1a30f9a 100644 --- a/Zend/tests/bug33171.phpt +++ b/Zend/tests/bug33171.phpt @@ -4,20 +4,20 @@ Bug #33171 (foreach enumerates private fields declared in base classes) <?php class A { - private $c = "A's c"; + private $c = "A's c"; } class B extends A { - private $c = "B's c"; + private $c = "B's c"; - public function go() - { - foreach ($this as $key => $val) - { - echo "$key => $val\n"; - } - } + public function go() + { + foreach ($this as $key => $val) + { + echo "$key => $val\n"; + } + } }; $x = new B; diff --git a/Zend/tests/bug33282.phpt b/Zend/tests/bug33282.phpt index 27f399046e..d75c2684a4 100644 --- a/Zend/tests/bug33282.phpt +++ b/Zend/tests/bug33282.phpt @@ -2,11 +2,11 @@ Bug #33282 (Re-assignment by reference does not clear the is_ref flag) --FILE-- <?php - $a = array(1, 2, 3); - $r = &$a[0]; - $r = &$a[1]; - $r = &$a[2]; - var_dump($a); + $a = array(1, 2, 3); + $r = &$a[0]; + $r = &$a[1]; + $r = &$a[2]; + var_dump($a); ?> --EXPECT-- array(3) { diff --git a/Zend/tests/bug33512.phpt b/Zend/tests/bug33512.phpt index 0a0e4e7b11..dbeee22bab 100644 --- a/Zend/tests/bug33512.phpt +++ b/Zend/tests/bug33512.phpt @@ -3,59 +3,59 @@ Bug #33512 (unset() overloaded properties doesn't work) --FILE-- <?php class TheObj { - public $RealVar1, $RealVar2, $RealVar3, $RealVar4; - public $Var = array(); + public $RealVar1, $RealVar2, $RealVar3, $RealVar4; + public $Var = array(); - function __set($var, $val) { - $this->Var[$var] = $val; - } - function __get($var) { - if(isset($this->Var[$var])) return $this->Var[$var]; - else return -1; - } - function __unset($var) { - unset($this->Var[$var]); - } - } + function __set($var, $val) { + $this->Var[$var] = $val; + } + function __get($var) { + if(isset($this->Var[$var])) return $this->Var[$var]; + else return -1; + } + function __unset($var) { + unset($this->Var[$var]); + } + } - $SomeObj = new TheObj; + $SomeObj = new TheObj; - // this will fine - $SomeObj->RealVar1 = 'somevalue'; - $SomeObj->{'RealVar2'} = 'othervalue'; - $SomeObj->{'RealVar'.(3)} = 'othervaluetoo'; - $SomeObj->{'RealVar'.'4'} = 'anothervalue'; + // this will fine + $SomeObj->RealVar1 = 'somevalue'; + $SomeObj->{'RealVar2'} = 'othervalue'; + $SomeObj->{'RealVar'.(3)} = 'othervaluetoo'; + $SomeObj->{'RealVar'.'4'} = 'anothervalue'; - // this will fine too - $SomeObj->Virtual1 = 'somevalue'; - $SomeObj->{'Virtual2'} = 'othervalue'; + // this will fine too + $SomeObj->Virtual1 = 'somevalue'; + $SomeObj->{'Virtual2'} = 'othervalue'; - // it's can't be used since this will encounter error - $SomeObj->{'Virtual'.(3)} = 'othervaluetoo'; - $SomeObj->{'Virtual'.'4'} = 'anothervalue'; + // it's can't be used since this will encounter error + $SomeObj->{'Virtual'.(3)} = 'othervaluetoo'; + $SomeObj->{'Virtual'.'4'} = 'anothervalue'; - // but this will fine, ofcourse - $SomeObj->Var['Virtual'.(3)] = 'othervaluetoo'; - $SomeObj->Var['Virtual'.'4'] = 'anothervalue'; + // but this will fine, ofcourse + $SomeObj->Var['Virtual'.(3)] = 'othervaluetoo'; + $SomeObj->Var['Virtual'.'4'] = 'anothervalue'; - var_dump($SomeObj->RealVar1); - print $SomeObj->{'RealVar'.(3)}."\n"; + var_dump($SomeObj->RealVar1); + print $SomeObj->{'RealVar'.(3)}."\n"; - unset($SomeObj->RealVar1); - unset($SomeObj->{'RealVar'.(3)}); + unset($SomeObj->RealVar1); + unset($SomeObj->{'RealVar'.(3)}); - //the lines below will catch by '__get' magic method since these variables are unavailable anymore - var_dump($SomeObj->RealVar1); - print $SomeObj->{'RealVar'.(3)}."\n"; + //the lines below will catch by '__get' magic method since these variables are unavailable anymore + var_dump($SomeObj->RealVar1); + print $SomeObj->{'RealVar'.(3)}."\n"; - // now we will try to unset these variables - unset($SomeObj->Virtual1); - unset($SomeObj->{'Virtual'.(3)}); + // now we will try to unset these variables + unset($SomeObj->Virtual1); + unset($SomeObj->{'Virtual'.(3)}); - //but, these variables are still available??? even though they're "unset"-ed - print $SomeObj->Virtual1."\n"; - print $SomeObj->{'Virtual'.(3)}."\n"; + //but, these variables are still available??? even though they're "unset"-ed + print $SomeObj->Virtual1."\n"; + print $SomeObj->{'Virtual'.(3)}."\n"; ?> --EXPECT-- string(9) "somevalue" diff --git a/Zend/tests/bug33710.phpt b/Zend/tests/bug33710.phpt index f65576074b..f731c39509 100644 --- a/Zend/tests/bug33710.phpt +++ b/Zend/tests/bug33710.phpt @@ -5,21 +5,21 @@ Bug #33710 (ArrayAccess objects doesn't initialize $this) class Foo implements ArrayAccess { - function offsetExists($offset) {/*...*/} - function offsetGet($offset) {/*...*/} - function offsetSet($offset, $value) {/*...*/} - function offsetUnset($offset) {/*...*/} + function offsetExists($offset) {/*...*/} + function offsetGet($offset) {/*...*/} + function offsetSet($offset, $value) {/*...*/} + function offsetUnset($offset) {/*...*/} - function fail() - { - $this['blah']; - } + function fail() + { + $this['blah']; + } - function succeed() - { - $this; - $this['blah']; - } + function succeed() + { + $this; + $this['blah']; + } } $bar = new Foo(); diff --git a/Zend/tests/bug33771.phpt b/Zend/tests/bug33771.phpt index 6eea49edbe..368a1662a8 100644 --- a/Zend/tests/bug33771.phpt +++ b/Zend/tests/bug33771.phpt @@ -20,13 +20,13 @@ function make_exception_and_change_err_reporting() try { - @make_exception(); + @make_exception(); } catch (Exception $e) {} var_dump(error_reporting()); try { - @make_exception_and_change_err_reporting(); + @make_exception_and_change_err_reporting(); } catch (Exception $e) {} var_dump(error_reporting()); diff --git a/Zend/tests/bug33996.phpt b/Zend/tests/bug33996.phpt index 3936eb8845..d5ec3386d6 100644 --- a/Zend/tests/bug33996.phpt +++ b/Zend/tests/bug33996.phpt @@ -20,14 +20,14 @@ function NormalTest($a) } try { - NormalTest(); + NormalTest(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } try { - FooTest(); + FooTest(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } FooTest(new Foo()); ?> diff --git a/Zend/tests/bug34062.phpt b/Zend/tests/bug34062.phpt index f1c0e477a9..456682753d 100644 --- a/Zend/tests/bug34062.phpt +++ b/Zend/tests/bug34062.phpt @@ -8,13 +8,13 @@ function f2() { echo "here\n"; } try { // Currently it's the minimum required number of zeros // If you remove one, it won't crash - max(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + max(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, f1()); } catch (Exception $e) { - echo "(((\n"; - f2(0, 0, 0); // Won't crash if less than 3 zeros here - echo ")))\n"; + echo "(((\n"; + f2(0, 0, 0); // Won't crash if less than 3 zeros here + echo ")))\n"; } ?> --EXPECT-- diff --git a/Zend/tests/bug34064.phpt b/Zend/tests/bug34064.phpt index 83c6902803..3cdd709238 100644 --- a/Zend/tests/bug34064.phpt +++ b/Zend/tests/bug34064.phpt @@ -6,7 +6,7 @@ class XmlTest { function test_ref(&$test) { - $test = "ok"; + $test = "ok"; } function test($test) diff --git a/Zend/tests/bug34310.phpt b/Zend/tests/bug34310.phpt index 1d2bb03ad3..2a5a36daea 100644 --- a/Zend/tests/bug34310.phpt +++ b/Zend/tests/bug34310.phpt @@ -5,7 +5,7 @@ Bug #34310 (foreach($arr as $c->d => $x) crashes) class C { - public $d; + public $d; } $c = new C(); @@ -15,13 +15,13 @@ $arr = array (1 => 'a', 2 => 'b', 3 => 'c'); // Works fine: foreach($arr as $x => $c->d) { - echo "{$x} => {$c->d}\n"; + echo "{$x} => {$c->d}\n"; } // Crashes: foreach($arr as $c->d => $x) { - echo "{$c->d} => {$x}\n"; + echo "{$c->d} => {$x}\n"; } ?> diff --git a/Zend/tests/bug34467.phpt b/Zend/tests/bug34467.phpt index fa1d8de2cd..e301291e3c 100644 --- a/Zend/tests/bug34467.phpt +++ b/Zend/tests/bug34467.phpt @@ -3,19 +3,19 @@ Bug #34467 (foreach + __get + __set incosistency) --FILE-- <?php class abc { - private $arr; + private $arr; - function __set ($key, $value) { + function __set ($key, $value) { $this->arr[$key] = $value; } - function __get ($key) { - return $this->arr[$key]; - } + function __get ($key) { + return $this->arr[$key]; + } } $abc = new abc(); foreach (array (1,2,3) as $abc->k => $abc->v) { - var_dump($abc->k,$abc->v); + var_dump($abc->k,$abc->v); } ?> --EXPECT-- diff --git a/Zend/tests/bug34678.phpt b/Zend/tests/bug34678.phpt index 2a13201f26..86db44357e 100644 --- a/Zend/tests/bug34678.phpt +++ b/Zend/tests/bug34678.phpt @@ -3,22 +3,22 @@ Bug #34678 (__call(), is_callable() and static methods) --FILE-- <?php class A { - public function __call($m, $a) { - echo "__call\n"; - } + public function __call($m, $a) { + echo "__call\n"; + } } class B extends A { - public static function foo() { - echo "foo\n"; - } + public static function foo() { + echo "foo\n"; + } } if (is_callable(array('B', 'foo'))) { - call_user_func(array('B', 'foo')); + call_user_func(array('B', 'foo')); } if (is_callable(array('A', 'foo'))) { - call_user_func(array('A', 'foo')); + call_user_func(array('A', 'foo')); } ?> --EXPECT-- diff --git a/Zend/tests/bug34873.phpt b/Zend/tests/bug34873.phpt index da11276458..fd31842d59 100644 --- a/Zend/tests/bug34873.phpt +++ b/Zend/tests/bug34873.phpt @@ -3,19 +3,19 @@ Bug #34873 (Segmentation Fault on foreach in object) --FILE-- <?php class pwa { - public $var; + public $var; - function __construct(){ - $this->var = array(); - } + function __construct(){ + $this->var = array(); + } - function test (){ - $cont = array(); - $cont["mykey"] = "myvalue"; + function test (){ + $cont = array(); + $cont["mykey"] = "myvalue"; - foreach ($cont as $this->var['key'] => $this->var['value']) - var_dump($this->var['value']); - } + foreach ($cont as $this->var['key'] => $this->var['value']) + var_dump($this->var['value']); + } } $myPwa = new Pwa(); $myPwa->test(); diff --git a/Zend/tests/bug34893.phpt b/Zend/tests/bug34893.phpt index bbe02358e9..c821875a99 100644 --- a/Zend/tests/bug34893.phpt +++ b/Zend/tests/bug34893.phpt @@ -3,22 +3,22 @@ Bug #34893 (PHP5.1 overloading, Cannot access private property) --FILE-- <?php class A { - private $p; - function __get($name){ - return $this->$name; - } - function __set($name, $value) { - $this->$name = $value; - } + private $p; + function __get($name){ + return $this->$name; + } + function __set($name, $value) { + $this->$name = $value; + } } class B { - private $t; - function __get($name){ - return $this->$name; - } - function __set($name, $value) { - $this->$name = $value; - } + private $t; + function __get($name){ + return $this->$name; + } + function __set($name, $value) { + $this->$name = $value; + } } $a = new A; $b = new B; diff --git a/Zend/tests/bug35017.phpt b/Zend/tests/bug35017.phpt index 8a747be7e1..0b9e9a95e2 100644 --- a/Zend/tests/bug35017.phpt +++ b/Zend/tests/bug35017.phpt @@ -4,17 +4,17 @@ Bug #35017 (Exception thrown in error handler may cause unexpected behavior) <?php set_error_handler('errorHandler'); try { - if ($a) { - echo "1\n"; - } else { - echo "0\n"; - } - echo "?\n"; + if ($a) { + echo "1\n"; + } else { + echo "0\n"; + } + echo "?\n"; } catch(Exception $e) { echo "This Exception should be caught\n"; } function errorHandler($errno, $errstr, $errfile, $errline) { - throw new Exception('Some Exception'); + throw new Exception('Some Exception'); } ?> --EXPECT-- diff --git a/Zend/tests/bug36006.phpt b/Zend/tests/bug36006.phpt index 79f9897d13..f86c4b5a29 100644 --- a/Zend/tests/bug36006.phpt +++ b/Zend/tests/bug36006.phpt @@ -4,22 +4,22 @@ Bug #36006 (Problem with $this in __destruct()) <?php class Person { - public $dad; - public function __destruct() { - $this->dad = null; /* no segfault if this is commented out */ - } + public $dad; + public function __destruct() { + $this->dad = null; /* no segfault if this is commented out */ + } } class Dad extends Person { - public $son; - public function __construct() { - $this->son = new Person; - $this->son->dad = $this; /* no segfault if this is commented out */ - } - public function __destruct() { - $this->son = null; - parent::__destruct(); /* segfault here */ - } + public $son; + public function __construct() { + $this->son = new Person; + $this->son->dad = $this; /* no segfault if this is commented out */ + } + public function __destruct() { + $this->son = null; + parent::__destruct(); /* segfault here */ + } } $o = new Dad; diff --git a/Zend/tests/bug36268.phpt b/Zend/tests/bug36268.phpt index 3bec61ff49..e95b91cc3e 100644 --- a/Zend/tests/bug36268.phpt +++ b/Zend/tests/bug36268.phpt @@ -3,9 +3,9 @@ Bug #36268 (Object destructors called even after fatal errors) --FILE-- <?php class Foo { - function __destruct() { - echo "Ha!\n"; - } + function __destruct() { + echo "Ha!\n"; + } } $x = new Foo(); bar(); diff --git a/Zend/tests/bug37138.phpt b/Zend/tests/bug37138.phpt index c0aa1fdfa8..67dfa987da 100644 --- a/Zend/tests/bug37138.phpt +++ b/Zend/tests/bug37138.phpt @@ -4,11 +4,11 @@ Bug #37138 (autoloader tries to load callback'ed self and parent) <?php spl_autoload_register(function ($CN) { var_dump ($CN); }); class st { - public static function e () {echo ("EHLO\n");} - public static function e2 () {call_user_func (array ('self', 'e'));} + public static function e () {echo ("EHLO\n");} + public static function e2 () {call_user_func (array ('self', 'e'));} } class stch extends st { - public static function g () {call_user_func (array ('parent', 'e'));} + public static function g () {call_user_func (array ('parent', 'e'));} } st::e (); st::e2 (); diff --git a/Zend/tests/bug37251.phpt b/Zend/tests/bug37251.phpt index 0e5ac8fd48..d790c46dca 100644 --- a/Zend/tests/bug37251.phpt +++ b/Zend/tests/bug37251.phpt @@ -3,15 +3,15 @@ Bug #37251 (deadlock when custom error handler is to catch array type hint error --FILE-- <?php class Foo { - function bar(array $foo) { - } + function bar(array $foo) { + } } try { - $foo = new Foo(); - $foo->bar(); + $foo = new Foo(); + $foo->bar(); } catch (Error $e) { - echo 'OK'; + echo 'OK'; } --EXPECT-- OK diff --git a/Zend/tests/bug37632.phpt b/Zend/tests/bug37632.phpt index a5a782508c..fbfae5b254 100644 --- a/Zend/tests/bug37632.phpt +++ b/Zend/tests/bug37632.phpt @@ -5,27 +5,27 @@ Bug #37632 (Protected method access problem) class A1 { - protected function test() - { - echo __METHOD__ . "\n"; - } + protected function test() + { + echo __METHOD__ . "\n"; + } } class B1 extends A1 { - public function doTest(A1 $obj) - { - echo __METHOD__ . "\n"; - $obj->test(); - } + public function doTest(A1 $obj) + { + echo __METHOD__ . "\n"; + $obj->test(); + } } class C1 extends A1 { - protected function test() - { - echo __METHOD__ . "\n"; - } + protected function test() + { + echo __METHOD__ . "\n"; + } } $b = new B1; @@ -33,27 +33,27 @@ $b->doTest(new C1); class A2 { - static protected function test() - { - echo __METHOD__ . "\n"; - } + static protected function test() + { + echo __METHOD__ . "\n"; + } } class B2 extends A2 { - static public function doTest(A2 $obj) - { - echo __METHOD__ . "\n"; - $obj->test(); - } + static public function doTest(A2 $obj) + { + echo __METHOD__ . "\n"; + $obj->test(); + } } class C2 extends A2 { - static protected function test() - { - echo __METHOD__ . "\n"; - } + static protected function test() + { + echo __METHOD__ . "\n"; + } } B2::doTest(new C2); @@ -64,32 +64,32 @@ B2::doTest(new C2); interface Ctor { - function __construct($x); + function __construct($x); } class A3 implements Ctor { - protected function __construct() - { - echo __METHOD__ . "\n"; - } + protected function __construct() + { + echo __METHOD__ . "\n"; + } } class B3 extends A3 { - static public function doTest() - { - echo __METHOD__ . "\n"; - new C3; - } + static public function doTest() + { + echo __METHOD__ . "\n"; + new C3; + } } class C3 extends A3 { - protected function __construct() - { - echo __METHOD__ . "\n"; - } + protected function __construct() + { + echo __METHOD__ . "\n"; + } } B3::doTest(); @@ -98,27 +98,27 @@ B3::doTest(); class A4 { - protected function __construct() - { - echo __METHOD__ . "\n"; - } + protected function __construct() + { + echo __METHOD__ . "\n"; + } } class B4 extends A4 { - static public function doTest() - { - echo __METHOD__ . "\n"; - new C4; - } + static public function doTest() + { + echo __METHOD__ . "\n"; + new C4; + } } class C4 extends A4 { - protected function __construct() - { - echo __METHOD__ . "\n"; - } + protected function __construct() + { + echo __METHOD__ . "\n"; + } } B4::doTest(); diff --git a/Zend/tests/bug37667.phpt b/Zend/tests/bug37667.phpt index 83a87a9688..38adb4e998 100644 --- a/Zend/tests/bug37667.phpt +++ b/Zend/tests/bug37667.phpt @@ -5,12 +5,12 @@ Bug #37667 (Object is not added into array returned by __get) class Test { - protected $property = array('foo' => 'bar'); + protected $property = array('foo' => 'bar'); - function __get($name) - { - return $this->property; - } + function __get($name) + { + return $this->property; + } } $obj = new Test; diff --git a/Zend/tests/bug37707.phpt b/Zend/tests/bug37707.phpt index ac2dfb8777..6781804aa5 100644 --- a/Zend/tests/bug37707.phpt +++ b/Zend/tests/bug37707.phpt @@ -3,9 +3,9 @@ Bug #37707 (clone without assigning leaks memory) --FILE-- <?php class testme { - function __clone() { - echo "clonned\n"; - } + function __clone() { + echo "clonned\n"; + } } clone new testme(); echo "NO LEAK\n"; diff --git a/Zend/tests/bug37811.phpt b/Zend/tests/bug37811.phpt index 8321459d5d..d1d5872da0 100644 --- a/Zend/tests/bug37811.phpt +++ b/Zend/tests/bug37811.phpt @@ -5,10 +5,10 @@ Bug #37811 (define not using toString on objects) class TestClass { - function __toString() - { - return "Foo"; - } + function __toString() + { + return "Foo"; + } } define("Bar",new TestClass); diff --git a/Zend/tests/bug38220.phpt b/Zend/tests/bug38220.phpt index bee3ffc75d..2700299a10 100644 --- a/Zend/tests/bug38220.phpt +++ b/Zend/tests/bug38220.phpt @@ -3,53 +3,53 @@ Bug #38220 (Crash on some object operations) --FILE-- <?php class drv { - public $obj; + public $obj; - function func1() { - echo "func1(): {$this->obj->i}\n"; - } + function func1() { + echo "func1(): {$this->obj->i}\n"; + } - function close() { - echo "close(): {$this->obj->i}\n"; - } + function close() { + echo "close(): {$this->obj->i}\n"; + } } class A { - public $i; + public $i; - function __construct($i) { - $this->i = $i; + function __construct($i) { + $this->i = $i; - } + } - function __call($method, $args) { - $drv = myserv::drv(); + function __call($method, $args) { + $drv = myserv::drv(); - $drv->obj = $this; + $drv->obj = $this; - echo "before call $method\n"; - print_r($this); - call_user_func_array(array($drv, $method), $args); - echo "after call $method\n"; + echo "before call $method\n"; + print_r($this); + call_user_func_array(array($drv, $method), $args); + echo "after call $method\n"; - // Uncomment this line to work without crash + // Uncomment this line to work without crash // $drv->obj = null; - } + } - function __destruct() { - echo "A::__destruct()\n"; - $this->close(); - } + function __destruct() { + echo "A::__destruct()\n"; + $this->close(); + } } class myserv { - private static $drv = null; + private static $drv = null; - static function drv() { - if (is_null(self::$drv)) - self::$drv = new drv; - return self::$drv; - } + static function drv() { + if (is_null(self::$drv)) + self::$drv = new drv; + return self::$drv; + } } $obj1 = new A(1); diff --git a/Zend/tests/bug38234.phpt b/Zend/tests/bug38234.phpt index a81a3aadcc..413ebf721f 100644 --- a/Zend/tests/bug38234.phpt +++ b/Zend/tests/bug38234.phpt @@ -3,13 +3,13 @@ Bug #38234 (Exception in __clone makes memory leak) --FILE-- <?php class Foo { - function __clone() { - throw new Exception(); - } + function __clone() { + throw new Exception(); + } } try { - $x = new Foo(); - $y = clone $x; + $x = new Foo(); + $y = clone $x; } catch (Exception $e) { } echo "ok\n"; diff --git a/Zend/tests/bug38469.phpt b/Zend/tests/bug38469.phpt index 6afcaf5fd3..b211dd76e9 100644 --- a/Zend/tests/bug38469.phpt +++ b/Zend/tests/bug38469.phpt @@ -10,12 +10,12 @@ $b[0][0] = $b; var_dump($b); function f() { - $a = array(); - $a[0] = $a; - var_dump($a); - $b = array(array()); - $b[0][0] = $b; - var_dump($b); + $a = array(); + $a[0] = $a; + var_dump($a); + $b = array(array()); + $b[0][0] = $b; + var_dump($b); } f(); ?> diff --git a/Zend/tests/bug38623.phpt b/Zend/tests/bug38623.phpt index 9b042a9141..873cdf42d4 100644 --- a/Zend/tests/bug38623.phpt +++ b/Zend/tests/bug38623.phpt @@ -3,11 +3,11 @@ Bug #38623 (leaks in a tricky code with switch() and exceptions) --FILE-- <?php try { - switch(strtolower("apache")) { - case "apache": - throw new Exception("test"); - break; - } + switch(strtolower("apache")) { + case "apache": + throw new Exception("test"); + break; + } } catch (Exception $e) { echo "ok\n"; } diff --git a/Zend/tests/bug38772.phpt b/Zend/tests/bug38772.phpt index 0be6457d72..b4de5f10c4 100644 --- a/Zend/tests/bug38772.phpt +++ b/Zend/tests/bug38772.phpt @@ -4,25 +4,25 @@ Bug #38772 (inconsistent overriding of methods in different visibility contexts) <?php class A { - public function __construct() { - $this -> foo(); - } + public function __construct() { + $this -> foo(); + } - private function foo() { - echo __METHOD__ . "\r\n"; - } + private function foo() { + echo __METHOD__ . "\r\n"; + } } class B extends A { - public function foo() { - echo __METHOD__ . "\r\n"; - } + public function foo() { + echo __METHOD__ . "\r\n"; + } } class C extends A { - protected function foo() { - echo __METHOD__ . "\r\n"; - } + protected function foo() { + echo __METHOD__ . "\r\n"; + } } class D extends A { diff --git a/Zend/tests/bug38779.phpt b/Zend/tests/bug38779.phpt index d552f8e20d..7260a709d0 100644 --- a/Zend/tests/bug38779.phpt +++ b/Zend/tests/bug38779.phpt @@ -4,27 +4,27 @@ Bug #38779 (engine crashes when require()'ing file with syntax error through use <?php class Loader { - private $position; - private $data; - public function stream_open($path, $mode, $options, &$opened_path) { - $this->data = '<' . "?php \n\"\";ll l\n ?" . '>'; - $this->position = 0; - return true; - } - function stream_read($count) { - $ret = substr($this->data, $this->position, $count); - $this->position += strlen($ret); - return $ret; - } - function stream_eof() { - return $this->position >= strlen($this->data); - } - function stream_stat() { - return array('size' => strlen($this->data)); - } - function stream_set_option($option, $arg1, $arg2) { - return false; - } + private $position; + private $data; + public function stream_open($path, $mode, $options, &$opened_path) { + $this->data = '<' . "?php \n\"\";ll l\n ?" . '>'; + $this->position = 0; + return true; + } + function stream_read($count) { + $ret = substr($this->data, $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + function stream_eof() { + return $this->position >= strlen($this->data); + } + function stream_stat() { + return array('size' => strlen($this->data)); + } + function stream_set_option($option, $arg1, $arg2) { + return false; + } } stream_wrapper_register('Loader', 'Loader'); require 'Loader://qqq.php'; diff --git a/Zend/tests/bug38779_1.phpt b/Zend/tests/bug38779_1.phpt index f4f89235a4..084463116a 100644 --- a/Zend/tests/bug38779_1.phpt +++ b/Zend/tests/bug38779_1.phpt @@ -4,28 +4,28 @@ Bug #38779 (engine crashes when require()'ing file with syntax error through use <?php class Loader { - private $position; - private $data; - public function stream_open($path, $mode, $options, &$opened_path) { - $this->data = '<' . "?php \n\"\";ll l\n ?" . '>'; - $this->position = 0; - return true; - } - function stream_read($count) { - $ret = substr($this->data, $this->position, $count); - $this->position += strlen($ret); - return $ret; - } - function stream_eof() { - return $this->position >= strlen($this->data); - } - function stream_flush() { - var_dump("flush!"); - } - function stream_close() { - @unlink(__DIR__."/bug38779.txt"); - var_dump("close!"); - } + private $position; + private $data; + public function stream_open($path, $mode, $options, &$opened_path) { + $this->data = '<' . "?php \n\"\";ll l\n ?" . '>'; + $this->position = 0; + return true; + } + function stream_read($count) { + $ret = substr($this->data, $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + function stream_eof() { + return $this->position >= strlen($this->data); + } + function stream_flush() { + var_dump("flush!"); + } + function stream_close() { + @unlink(__DIR__."/bug38779.txt"); + var_dump("close!"); + } } stream_wrapper_register('Loader', 'Loader'); $fp = fopen ('Loader://qqq.php', 'r'); diff --git a/Zend/tests/bug39003.phpt b/Zend/tests/bug39003.phpt index 791e11b614..9fa3e0d26b 100644 --- a/Zend/tests/bug39003.phpt +++ b/Zend/tests/bug39003.phpt @@ -5,7 +5,7 @@ Bug #39003 (autoloader is called for type hinting) class ClassName { - public $var = 'bla'; + public $var = 'bla'; } function test (OtherClassName $object) { } diff --git a/Zend/tests/bug39036.phpt b/Zend/tests/bug39036.phpt index 0cdd75150d..4179ba5420 100644 --- a/Zend/tests/bug39036.phpt +++ b/Zend/tests/bug39036.phpt @@ -6,7 +6,7 @@ Bug #39036 (Unsetting key of foreach() yields segmentation fault) $key = 'asdf'; foreach (get_defined_vars() as $key => $value) { - unset($$key); + unset($$key); } var_dump($key); diff --git a/Zend/tests/bug39297.phpt b/Zend/tests/bug39297.phpt index 36c0af7dbb..6ea989da46 100644 --- a/Zend/tests/bug39297.phpt +++ b/Zend/tests/bug39297.phpt @@ -17,14 +17,14 @@ class MyTree implements ArrayAccess { } public function offsetSet($offset, $value) { - echo "offsetSet()\n"; + echo "offsetSet()\n"; $cannonicalName = strtolower($offset); $this->children[$cannonicalName] = $value; $value->parent = $this; } public function offsetGet($offset) { - echo "offsetGet()\n"; + echo "offsetGet()\n"; $cannonicalName = strtolower($offset); return $this->children[$cannonicalName]; } diff --git a/Zend/tests/bug39346.phpt b/Zend/tests/bug39346.phpt index bde88edb9d..6e47ca037d 100644 --- a/Zend/tests/bug39346.phpt +++ b/Zend/tests/bug39346.phpt @@ -4,17 +4,17 @@ Bug #39346 (Unsetting a static variable inside a destructor causes segfault late <?php class test { - protected $_id; - static $instances; + protected $_id; + static $instances; - public function __construct($id) { - $this->_id = $id; - self::$instances[$this->_id] = $this; - } + public function __construct($id) { + $this->_id = $id; + self::$instances[$this->_id] = $this; + } - function __destruct() { - unset(self::$instances[$this->_id]); - } + function __destruct() { + unset(self::$instances[$this->_id]); + } } $test = new test(2); $test = new test(1); diff --git a/Zend/tests/bug39438.phpt b/Zend/tests/bug39438.phpt index d10e6d9ab7..5336d3ad81 100644 --- a/Zend/tests/bug39438.phpt +++ b/Zend/tests/bug39438.phpt @@ -7,36 +7,36 @@ memory_limit=16M $i=0; $test2=array( 'a1_teasermenu' => array( - 'downloadcounter' => 2777, + 'downloadcounter' => 2777, 'versions' => array( - '0.1.0' => array ( - 'title' => 'A1 Teasermenu', - 'description' => 'Displays a teaser for advanced subpages or a selection of advanced pages', - 'state' => 'stable', - 'reviewstate' => 0, - 'category' => 'plugin', - 'downloadcounter' => 2787, - 'lastuploaddate' => 1088427240, - 'dependencies' => array ( - 'depends' => array( - 'typo3' =>'', - 'php' =>'', - 'cms' => '' - ), - 'conflicts' => array('' =>'') - ), - 'authorname' => 'Mirko Balluff', - 'authoremail' => 'balluff@amt1.de', - 'ownerusername' => 'amt1', - 't3xfilemd5' => '3a4ec198b6ea8d0bc2d69d9b7400398f', - ) - ) - ) + '0.1.0' => array ( + 'title' => 'A1 Teasermenu', + 'description' => 'Displays a teaser for advanced subpages or a selection of advanced pages', + 'state' => 'stable', + 'reviewstate' => 0, + 'category' => 'plugin', + 'downloadcounter' => 2787, + 'lastuploaddate' => 1088427240, + 'dependencies' => array ( + 'depends' => array( + 'typo3' =>'', + 'php' =>'', + 'cms' => '' + ), + 'conflicts' => array('' =>'') + ), + 'authorname' => 'Mirko Balluff', + 'authoremail' => 'balluff@amt1.de', + 'ownerusername' => 'amt1', + 't3xfilemd5' => '3a4ec198b6ea8d0bc2d69d9b7400398f', + ) + ) + ) ); $test=array(); while($i<1200) { - $test[]=$test2; - $i++; + $test[]=$test2; + $i++; } $out=serialize($test); echo "ok\n"; diff --git a/Zend/tests/bug39445.phpt b/Zend/tests/bug39445.phpt index cf1607f2dd..d86b2ce19e 100644 --- a/Zend/tests/bug39445.phpt +++ b/Zend/tests/bug39445.phpt @@ -3,14 +3,14 @@ Bug #39445 (Calling debug_backtrace() in the __toString() function produces a cr --FILE-- <?php class test { - public function __toString() { - debug_backtrace(); - return 'lowercase'; - } + public function __toString() { + debug_backtrace(); + return 'lowercase'; + } } - $test = new test(); - echo strtoupper($test); + $test = new test(); + echo strtoupper($test); ?> --EXPECT-- LOWERCASE diff --git a/Zend/tests/bug39542.phpt b/Zend/tests/bug39542.phpt index 336deb7f18..79c1c56e91 100644 --- a/Zend/tests/bug39542.phpt +++ b/Zend/tests/bug39542.phpt @@ -5,9 +5,9 @@ Bug #39542 (Behaviour of require_once/include_once different to < 5.2.0) $oldcwd = getcwd(); chdir(__DIR__); if (substr(PHP_OS, 0, 3) == 'WIN') { - set_include_path(__DIR__.'/bug39542;.'); + set_include_path(__DIR__.'/bug39542;.'); } else { - set_include_path(__DIR__.'/bug39542:.'); + set_include_path(__DIR__.'/bug39542:.'); } spl_autoload_register(function ($class) { diff --git a/Zend/tests/bug39542/bug39542.inc b/Zend/tests/bug39542/bug39542.inc index 13b3b3eaf4..c0dcada750 100644 --- a/Zend/tests/bug39542/bug39542.inc +++ b/Zend/tests/bug39542/bug39542.inc @@ -1,7 +1,7 @@ <?php class bug39542 { - function __construct() { - echo "ok\n"; - } + function __construct() { + echo "ok\n"; + } } ?> diff --git a/Zend/tests/bug39721.phpt b/Zend/tests/bug39721.phpt index aa0df793ff..e25cfe8820 100644 --- a/Zend/tests/bug39721.phpt +++ b/Zend/tests/bug39721.phpt @@ -3,21 +3,21 @@ Bug #39721 (Runtime inheritance causes data corruption) --FILE-- <?php class test2 { - private static $instances = 0; - public $instance; + private static $instances = 0; + public $instance; - public function __construct() { - $this->instance = ++self::$instances; - } + public function __construct() { + $this->instance = ++self::$instances; + } } $foo = new test2(); if (is_object($foo)) { - class test2_child extends test2 { + class test2_child extends test2 { - } + } } $child = new test2_child(); diff --git a/Zend/tests/bug39775.phpt b/Zend/tests/bug39775.phpt index 4c6ce6baf1..ed6d66a9cc 100644 --- a/Zend/tests/bug39775.phpt +++ b/Zend/tests/bug39775.phpt @@ -3,11 +3,11 @@ Bug #39775 ("Indirect modification ..." message is not shown) --FILE-- <?php class test { - var $array = array(); - function __get($var) { - $v =& $this->array; - return $this->array; - } + var $array = array(); + function __get($var) { + $v =& $this->array; + return $this->array; + } } $t = new test; $t->anything[] = 'bar'; diff --git a/Zend/tests/bug39825.phpt b/Zend/tests/bug39825.phpt index a241e0de36..305ed895d5 100644 --- a/Zend/tests/bug39825.phpt +++ b/Zend/tests/bug39825.phpt @@ -5,7 +5,7 @@ Bug #39825 (foreach produces memory error) $array = array(1 => 2, "foo" => "bar"); $obj = (object)$array; foreach ($obj as $name => $value) { - echo "$name -> $value\n"; + echo "$name -> $value\n"; } ?> --EXPECT-- diff --git a/Zend/tests/bug39944.phpt b/Zend/tests/bug39944.phpt index d602a45b88..f68b656504 100644 --- a/Zend/tests/bug39944.phpt +++ b/Zend/tests/bug39944.phpt @@ -26,12 +26,12 @@ echo "intTheValue = {$intTheValue}\n"; $arrTheArray = array(); function &getArray() { - global $arrTheArray; - return $arrTheArray; + global $arrTheArray; + return $arrTheArray; } function addToArray(&$arr, $strToAdd) { - $arr[] = $strToAdd; + $arr[] = $strToAdd; } addToArray(getArray(), "xx1"); @@ -47,21 +47,21 @@ echo "arrTheArray = " . print_r($arrTheArray, 1); /****/ class RefTest { - protected $arr; + protected $arr; - function Add($strToAdd) { - $this->addToArray($this->getArray(), $strToAdd); - } + function Add($strToAdd) { + $this->addToArray($this->getArray(), $strToAdd); + } - function &getArray() { - if (!$this->arr) - $this->arr = array(); - return $this->arr; - } + function &getArray() { + if (!$this->arr) + $this->arr = array(); + return $this->arr; + } - private function addToArray(&$arr, $strToAdd) { - $arr[] = $strToAdd; - } + private function addToArray(&$arr, $strToAdd) { + $arr[] = $strToAdd; + } } $objRefTest = new RefTest(); diff --git a/Zend/tests/bug40509.phpt b/Zend/tests/bug40509.phpt index 5b7dfa09c8..473e5cb43a 100644 --- a/Zend/tests/bug40509.phpt +++ b/Zend/tests/bug40509.phpt @@ -4,10 +4,10 @@ Bug #40509 (key() function changed behaviour if global array is used within func <?php function foo() { - global $arr; + global $arr; - $c = $arr["v"]; - foreach ($c as $v) {} + $c = $arr["v"]; + foreach ($c as $v) {} } $arr["v"] = array("a"); @@ -16,7 +16,7 @@ var_dump(key($arr["v"])); foo(); var_dump(key($arr["v"])); foreach ($arr["v"] as $k => $v) { - var_dump($k); + var_dump($k); } var_dump(key($arr["v"])); --EXPECT-- diff --git a/Zend/tests/bug40621.phpt b/Zend/tests/bug40621.phpt index 8650fd56fa..4025958060 100644 --- a/Zend/tests/bug40621.phpt +++ b/Zend/tests/bug40621.phpt @@ -4,10 +4,10 @@ Bug #40621 (Crash when constructor called inappropriately (statically)) <?php class Foo { - private function __construct() { } - function get() { - self::__construct(); - } + private function __construct() { } + function get() { + self::__construct(); + } } Foo::get(); diff --git a/Zend/tests/bug40705.phpt b/Zend/tests/bug40705.phpt index 8a679654d5..3a11637fec 100644 --- a/Zend/tests/bug40705.phpt +++ b/Zend/tests/bug40705.phpt @@ -14,7 +14,7 @@ var_dump(key($foo)); doForeach($foo); var_dump(key($foo)); foreach ($foo as $k => $v) { - var_dump($k); + var_dump($k); } var_dump(key($foo)); --EXPECT-- diff --git a/Zend/tests/bug40815.phpt b/Zend/tests/bug40815.phpt index 3386097523..542a820f52 100644 --- a/Zend/tests/bug40815.phpt +++ b/Zend/tests/bug40815.phpt @@ -4,9 +4,9 @@ Bug #40815 (using strings like "class::func" and static methods in set_exception <?php class ehandle{ - static public function exh ($ex) { - echo 'foo'; - } + static public function exh ($ex) { + echo 'foo'; + } } set_exception_handler("ehandle::exh"); diff --git a/Zend/tests/bug40833.phpt b/Zend/tests/bug40833.phpt index 625103a6c0..6a050eed8b 100644 --- a/Zend/tests/bug40833.phpt +++ b/Zend/tests/bug40833.phpt @@ -2,71 +2,71 @@ Bug #40833 (Crash when using unset() on an ArrayAccess object retrieved via __get) --FILE-- <?php - class entity - { - private $data; - private $modified; + class entity + { + private $data; + private $modified; - function __get($name) - { - if ( isset($this->data[$name]) ) - return $this->data[$name]; - else - return $this->data[$name] = new set($this); - } + function __get($name) + { + if ( isset($this->data[$name]) ) + return $this->data[$name]; + else + return $this->data[$name] = new set($this); + } - function __set($name, $value) - { - $this->modified[$name] = $value; - } - } + function __set($name, $value) + { + $this->modified[$name] = $value; + } + } - class set implements ArrayAccess - { - private $entity; + class set implements ArrayAccess + { + private $entity; - function __construct($entity) - { - $this->entity = $entity; - $this->entity->whatever = $this; - } + function __construct($entity) + { + $this->entity = $entity; + $this->entity->whatever = $this; + } - function clear() { - $this->entity->whatever = null; - } + function clear() { + $this->entity->whatever = null; + } - function offsetUnset($offset) - { - $this->clear(); + function offsetUnset($offset) + { + $this->clear(); // $this->entity->{$this->name} = null; - } + } - function offsetSet($offset, $value) - { - } + function offsetSet($offset, $value) + { + } - function offsetGet($offset) - { - return 'Bogus '; - } + function offsetGet($offset) + { + return 'Bogus '; + } - function offsetExists($offset) - { - } - } + function offsetExists($offset) + { + } + } - $entity = new entity(); - echo($entity->whatever[0]); + $entity = new entity(); + echo($entity->whatever[0]); - //This will crash + //This will crash // $entity->whatever->clear(); - unset($entity->whatever[0]); + unset($entity->whatever[0]); - //This will not crash (comment previous & uncomment this to test + //This will not crash (comment previous & uncomment this to test // $test = $entity->whatever; unset($test[0]); - echo($entity->whatever[0]); - echo "ok\n"; + echo($entity->whatever[0]); + echo "ok\n"; ?> --EXPECT-- Bogus Bogus ok diff --git a/Zend/tests/bug41026.phpt b/Zend/tests/bug41026.phpt index e159ad36f6..055e5f574d 100644 --- a/Zend/tests/bug41026.phpt +++ b/Zend/tests/bug41026.phpt @@ -5,15 +5,15 @@ Bug #41026 (segfault when calling "self::method()" in shutdown functions) class try_class { - static public function main () - { - register_shutdown_function (array ("self", "on_shutdown")); - } + static public function main () + { + register_shutdown_function (array ("self", "on_shutdown")); + } - static public function on_shutdown () - { - printf ("CHECKPOINT\n"); /* never reached */ - } + static public function on_shutdown () + { + printf ("CHECKPOINT\n"); /* never reached */ + } } try_class::main (); diff --git a/Zend/tests/bug41421.phpt b/Zend/tests/bug41421.phpt index e4fa9447de..0cfee271a4 100644 --- a/Zend/tests/bug41421.phpt +++ b/Zend/tests/bug41421.phpt @@ -4,12 +4,12 @@ Bug #41421 (Uncaught exception from a stream wrapper segfaults) <?php class wrapper { - function stream_open() { - return true; - } - function stream_eof() { - throw new exception(); - } + function stream_open() { + return true; + } + function stream_eof() { + throw new exception(); + } } stream_wrapper_register("wrap", "wrapper"); diff --git a/Zend/tests/bug41633_1.phpt b/Zend/tests/bug41633_1.phpt index 1c1d552dd7..7d32c7ff89 100644 --- a/Zend/tests/bug41633_1.phpt +++ b/Zend/tests/bug41633_1.phpt @@ -3,8 +3,8 @@ Bug #41633.1 (self:: doesn't work for constants) --FILE-- <?php class Foo { - const A = self::B; - const B = "ok"; + const A = self::B; + const B = "ok"; } echo Foo::A."\n"; ?> diff --git a/Zend/tests/bug41633_2.phpt b/Zend/tests/bug41633_2.phpt index df6705645f..180e6ac970 100644 --- a/Zend/tests/bug41633_2.phpt +++ b/Zend/tests/bug41633_2.phpt @@ -3,7 +3,7 @@ Bug #41633.2 (Undefined class constants must not be substituted by strings) --FILE-- <?php class Foo { - const A = self::B; + const A = self::B; } echo Foo::A."\n"; ?> diff --git a/Zend/tests/bug41633_3.phpt b/Zend/tests/bug41633_3.phpt index dd4b75c9d9..c7afb65a87 100644 --- a/Zend/tests/bug41633_3.phpt +++ b/Zend/tests/bug41633_3.phpt @@ -3,8 +3,8 @@ Bug #41633.3 (Crash instantiating classes with self-referencing constants) --FILE-- <?php class Foo { - const A = Foo::B; - const B = Foo::A; + const A = Foo::B; + const B = Foo::A; } echo Foo::A; ?> diff --git a/Zend/tests/bug41633_4.phpt b/Zend/tests/bug41633_4.phpt index 3507f6a08c..c74cd7e45b 100644 --- a/Zend/tests/bug41633_4.phpt +++ b/Zend/tests/bug41633_4.phpt @@ -3,8 +3,8 @@ Bug #41633.4 (self:: doesn't work for constants) --FILE-- <?php class Foo { - const A = self::B; - const B = "ok"; + const A = self::B; + const B = "ok"; } var_dump(defined("Foo::A")); ?> diff --git a/Zend/tests/bug42802.phpt b/Zend/tests/bug42802.phpt index ebfb528827..1294bdbb2f 100644 --- a/Zend/tests/bug42802.phpt +++ b/Zend/tests/bug42802.phpt @@ -8,7 +8,7 @@ class bar { } function test1(bar $bar) { - echo "ok\n"; + echo "ok\n"; } function test2(\foo\bar $bar) { @@ -18,7 +18,7 @@ function test3(\foo\bar $bar) { echo "ok\n"; } function test4(\Exception $e) { - echo "ok\n"; + echo "ok\n"; } function test5(\bar $bar) { echo "bug\n"; diff --git a/Zend/tests/bug42819.phpt b/Zend/tests/bug42819.phpt index d0b5c0b2ee..615aabc8ed 100644 --- a/Zend/tests/bug42819.phpt +++ b/Zend/tests/bug42819.phpt @@ -19,65 +19,65 @@ const C = "foo\\C\n"; const I = 11; class foo { - const C = "foo\\foo::C\n"; - const I = 22; - const C1 = C; - const C2 = foo\C; - const C3 = foo\foo::C; - const C4 = \foo\C; - const C5 = \foo\foo::C; - const C6 = ArrayObject::STD_PROP_LIST; - const C7 = E_ERROR; + const C = "foo\\foo::C\n"; + const I = 22; + const C1 = C; + const C2 = foo\C; + const C3 = foo\foo::C; + const C4 = \foo\C; + const C5 = \foo\foo::C; + const C6 = ArrayObject::STD_PROP_LIST; + const C7 = E_ERROR; } class bar1 { - static $a1 = array(I => 0); - static $a2 = array(foo\I => 0); - static $a3 = array(foo\foo::I => 0); - static $a4 = array(\foo\I => 0); - static $a5 = array(\foo\foo::I => 0); - static $a6 = array(ArrayObject::STD_PROP_LIST => 0); - static $a7 = array(E_ERROR => 0); + static $a1 = array(I => 0); + static $a2 = array(foo\I => 0); + static $a3 = array(foo\foo::I => 0); + static $a4 = array(\foo\I => 0); + static $a5 = array(\foo\foo::I => 0); + static $a6 = array(ArrayObject::STD_PROP_LIST => 0); + static $a7 = array(E_ERROR => 0); } class bar2 { - static $a1 = array(I => I); - static $a2 = array(foo\I => I); - static $a3 = array(foo\foo::I => I); - static $a4 = array(\foo\I => I); - static $a5 = array(\foo\foo::I => I); - static $a6 = array(ArrayObject::STD_PROP_LIST => I); - static $a7 = array(E_ERROR => I); + static $a1 = array(I => I); + static $a2 = array(foo\I => I); + static $a3 = array(foo\foo::I => I); + static $a4 = array(\foo\I => I); + static $a5 = array(\foo\foo::I => I); + static $a6 = array(ArrayObject::STD_PROP_LIST => I); + static $a7 = array(E_ERROR => I); } class bar3 { - static $a1 = array(I => foo\I); - static $a2 = array(foo\I => foo\I); - static $a3 = array(foo\foo::I => foo\I); - static $a4 = array(\foo\I => foo\I); - static $a5 = array(\foo\foo::I => foo\I); - static $a6 = array(ArrayObject::STD_PROP_LIST => foo\I); - static $a7 = array(E_ERROR => foo\I); + static $a1 = array(I => foo\I); + static $a2 = array(foo\I => foo\I); + static $a3 = array(foo\foo::I => foo\I); + static $a4 = array(\foo\I => foo\I); + static $a5 = array(\foo\foo::I => foo\I); + static $a6 = array(ArrayObject::STD_PROP_LIST => foo\I); + static $a7 = array(E_ERROR => foo\I); } class bar4 { - static $a1 = array(I => ArrayObject::STD_PROP_LIST); - static $a2 = array(foo\I => ArrayObject::STD_PROP_LIST); - static $a3 = array(foo\foo::I => ArrayObject::STD_PROP_LIST); - static $a4 = array(\foo\I => ArrayObject::STD_PROP_LIST); - static $a5 = array(\foo\foo::I => ArrayObject::STD_PROP_LIST); - static $a6 = array(ArrayObject::STD_PROP_LIST => ArrayObject::STD_PROP_LIST); - static $a7 = array(E_ERROR => ArrayObject::STD_PROP_LIST); + static $a1 = array(I => ArrayObject::STD_PROP_LIST); + static $a2 = array(foo\I => ArrayObject::STD_PROP_LIST); + static $a3 = array(foo\foo::I => ArrayObject::STD_PROP_LIST); + static $a4 = array(\foo\I => ArrayObject::STD_PROP_LIST); + static $a5 = array(\foo\foo::I => ArrayObject::STD_PROP_LIST); + static $a6 = array(ArrayObject::STD_PROP_LIST => ArrayObject::STD_PROP_LIST); + static $a7 = array(E_ERROR => ArrayObject::STD_PROP_LIST); } class bar5 { - static $a1 = array(I => E_ERROR); - static $a2 = array(foo\I => E_ERROR); - static $a3 = array(foo\foo::I => E_ERROR); - static $a4 = array(\foo\I => E_ERROR); - static $a5 = array(\foo\foo::I => E_ERROR); - static $a6 = array(ArrayObject::STD_PROP_LIST => E_ERROR); - static $a7 = array(E_ERROR => E_ERROR); + static $a1 = array(I => E_ERROR); + static $a2 = array(foo\I => E_ERROR); + static $a3 = array(foo\foo::I => E_ERROR); + static $a4 = array(\foo\I => E_ERROR); + static $a5 = array(\foo\foo::I => E_ERROR); + static $a6 = array(ArrayObject::STD_PROP_LIST => E_ERROR); + static $a7 = array(E_ERROR => E_ERROR); } echo "first\n"; diff --git a/Zend/tests/bug42820.phpt b/Zend/tests/bug42820.phpt index a53ed1af68..af9230be10 100644 --- a/Zend/tests/bug42820.phpt +++ b/Zend/tests/bug42820.phpt @@ -5,7 +5,7 @@ Bug #42820 (defined() on constant with namespace prefixes tries to load class) namespace ns; const ok = 0; class foo { - const ok = 0; + const ok = 0; } var_dump(defined('ns\\ok')); var_dump(defined('ns\\bug')); diff --git a/Zend/tests/bug42937.phpt b/Zend/tests/bug42937.phpt index 2ade186b9c..0aeeec8637 100644 --- a/Zend/tests/bug42937.phpt +++ b/Zend/tests/bug42937.phpt @@ -3,26 +3,26 @@ Bug #42937 (__call() method not invoked when methods are called on parent from c --FILE-- <?php class A { - function __call($strMethod, $arrArgs) { - echo "$strMethod\n"; - } + function __call($strMethod, $arrArgs) { + echo "$strMethod\n"; + } } class C { - function __call($strMethod, $arrArgs) { - echo "$strMethod\n"; - } + function __call($strMethod, $arrArgs) { + echo "$strMethod\n"; + } } class B extends A { - function test() { - self::test1(); - parent::test2(); - static::test3(); - A::test4(); - B::test5(); - C::test6(); - } + function test() { + self::test1(); + parent::test2(); + static::test3(); + A::test4(); + B::test5(); + C::test6(); + } } $a = new A(); diff --git a/Zend/tests/bug43200.phpt b/Zend/tests/bug43200.phpt index be94a64531..e0da6e16ae 100644 --- a/Zend/tests/bug43200.phpt +++ b/Zend/tests/bug43200.phpt @@ -4,19 +4,19 @@ Bug #43200 (Interface implementation / inheritance not possible in abstract clas <?php interface a { - function foo(); - function bar(); + function foo(); + function bar(); } interface b { - function foo(); + function foo(); } abstract class c { - function bar() { } + function bar() { } } class x extends c implements a, b { - function foo() { } + function foo() { } } echo new ReflectionClass('x'); diff --git a/Zend/tests/bug43200_2.phpt b/Zend/tests/bug43200_2.phpt index 8926173aee..f20fe3ddce 100644 --- a/Zend/tests/bug43200_2.phpt +++ b/Zend/tests/bug43200_2.phpt @@ -4,17 +4,17 @@ Bug #43200.2 (Interface implementation / inheritance not possible in abstract cl <?php interface A { - function foo(); + function foo(); } abstract class B implements A { - abstract public function foo(); + abstract public function foo(); } class C extends B { - public function foo() { - echo 'works'; - } + public function foo() { + echo 'works'; + } } $o = new C(); diff --git a/Zend/tests/bug43201.phpt b/Zend/tests/bug43201.phpt index fa14b162d4..3608effab7 100644 --- a/Zend/tests/bug43201.phpt +++ b/Zend/tests/bug43201.phpt @@ -3,12 +3,12 @@ Bug #43201 (Crash on using uninitialized vals and __get/__set) --FILE-- <?php class Foo { - function __get($k) { - return null; - } - function __set($k, $v) { - $this->$k = $v; - } + function __get($k) { + return null; + } + function __set($k, $v) { + $this->$k = $v; + } } $c = new Foo(); @@ -16,8 +16,8 @@ $c = new Foo(); $c->arr[0]["k"] = 1; $c->arr[0]["k2"] = $ref; for($cnt=0;$cnt<6;$cnt++) { - $ref = chop($undef); - $c->arr[$cnt]["k2"] = $ref; + $ref = chop($undef); + $c->arr[$cnt]["k2"] = $ref; } echo "ok\n"; ?> diff --git a/Zend/tests/bug43344_1.phpt b/Zend/tests/bug43344_1.phpt index 28af70dc67..aca548ba5f 100644 --- a/Zend/tests/bug43344_1.phpt +++ b/Zend/tests/bug43344_1.phpt @@ -6,14 +6,14 @@ namespace Foo; use Error; function f1($a=bar) { - return $a; + return $a; } function f2($a=array(bar)) { - return $a[0]; + return $a[0]; } function f3($a=array(bar=>0)) { - reset($a); - return key($a); + reset($a); + return key($a); } try { diff --git a/Zend/tests/bug43344_11.phpt b/Zend/tests/bug43344_11.phpt index 27c3160f5a..47a59eb280 100644 --- a/Zend/tests/bug43344_11.phpt +++ b/Zend/tests/bug43344_11.phpt @@ -3,7 +3,7 @@ Bug #43344.11 (Wrong error message for undefined namespace constant) --FILE-- <?php function f($a=namespace\bar) { - return $a; + return $a; } echo f()."\n"; ?> diff --git a/Zend/tests/bug43344_12.phpt b/Zend/tests/bug43344_12.phpt index 71031f5819..3224a7de92 100644 --- a/Zend/tests/bug43344_12.phpt +++ b/Zend/tests/bug43344_12.phpt @@ -3,7 +3,7 @@ Bug #43344.12 (Wrong error message for undefined namespace constant) --FILE-- <?php function f($a=array(namespace\bar)) { - return $a[0]; + return $a[0]; } echo f()."\n"; ?> diff --git a/Zend/tests/bug43344_13.phpt b/Zend/tests/bug43344_13.phpt index bdce5a8a75..6b08562b29 100644 --- a/Zend/tests/bug43344_13.phpt +++ b/Zend/tests/bug43344_13.phpt @@ -3,8 +3,8 @@ Bug #43344.13 (Wrong error message for undefined namespace constant) --FILE-- <?php function f($a=array(namespace\bar=>0)) { - reset($a); - return key($a); + reset($a); + return key($a); } echo f()."\n"; ?> diff --git a/Zend/tests/bug43344_3.phpt b/Zend/tests/bug43344_3.phpt index 5450759bcc..6b1b6c46c9 100644 --- a/Zend/tests/bug43344_3.phpt +++ b/Zend/tests/bug43344_3.phpt @@ -4,7 +4,7 @@ Bug #43344.3 (Wrong error message for undefined namespace constant) <?php namespace Foo; function f($a=Foo::bar) { - return $a; + return $a; } echo f()."\n"; ?> diff --git a/Zend/tests/bug43344_4.phpt b/Zend/tests/bug43344_4.phpt index c147766bf6..0e2e3c7886 100644 --- a/Zend/tests/bug43344_4.phpt +++ b/Zend/tests/bug43344_4.phpt @@ -4,7 +4,7 @@ Bug #43344.4 (Wrong error message for undefined namespace constant) <?php namespace Foo; function f($a=array(Foo::bar)) { - return $a[0]; + return $a[0]; } echo f()."\n"; ?> diff --git a/Zend/tests/bug43344_5.phpt b/Zend/tests/bug43344_5.phpt index 8cc333fd31..5ca2144438 100644 --- a/Zend/tests/bug43344_5.phpt +++ b/Zend/tests/bug43344_5.phpt @@ -4,8 +4,8 @@ Bug #43344.5 (Wrong error message for undefined namespace constant) <?php namespace Foo; function f($a=array(Foo::bar=>0)) { - reset($a); - return key($a); + reset($a); + return key($a); } echo f()."\n"; ?> diff --git a/Zend/tests/bug43344_7.phpt b/Zend/tests/bug43344_7.phpt index dfab0cad90..965419c12a 100644 --- a/Zend/tests/bug43344_7.phpt +++ b/Zend/tests/bug43344_7.phpt @@ -4,7 +4,7 @@ Bug #43344.7 (Wrong error message for undefined namespace constant) <?php namespace Foo; function f($a=namespace\bar) { - return $a; + return $a; } echo f()."\n"; ?> diff --git a/Zend/tests/bug43344_8.phpt b/Zend/tests/bug43344_8.phpt index b1e6f61a54..b0c247c8e3 100644 --- a/Zend/tests/bug43344_8.phpt +++ b/Zend/tests/bug43344_8.phpt @@ -4,7 +4,7 @@ Bug #43344.8 (Wrong error message for undefined namespace constant) <?php namespace Foo; function f($a=array(namespace\bar)) { - return $a[0]; + return $a[0]; } echo f()."\n"; ?> diff --git a/Zend/tests/bug43344_9.phpt b/Zend/tests/bug43344_9.phpt index 7f7f2df38f..edaa332b93 100644 --- a/Zend/tests/bug43344_9.phpt +++ b/Zend/tests/bug43344_9.phpt @@ -4,8 +4,8 @@ Bug #43344.9 (Wrong error message for undefined namespace constant) <?php namespace Foo; function f($a=array(namespace\bar=>0)) { - reset($a); - return key($a); + reset($a); + return key($a); } echo f()."\n"; ?> diff --git a/Zend/tests/bug43450.phpt b/Zend/tests/bug43450.phpt index 05f2f7cbf6..f47f491471 100644 --- a/Zend/tests/bug43450.phpt +++ b/Zend/tests/bug43450.phpt @@ -8,9 +8,9 @@ opcache.enable_cli=0 class Foo { public function __toString() - { - return __CLASS__; - } + { + return __CLASS__; + } } $num_repeats = 100000; @@ -18,15 +18,15 @@ $num_repeats = 100000; $start = memory_get_usage() / 1024; for ($i=1;$i<$num_repeats;$i++) { - $foo = new Foo(); - md5($foo); + $foo = new Foo(); + md5($foo); } $end = memory_get_usage() / 1024; if ($start + 16 < $end) { - echo 'FAIL'; + echo 'FAIL'; } else { - echo 'PASS'; + echo 'PASS'; } ?> diff --git a/Zend/tests/bug43483.phpt b/Zend/tests/bug43483.phpt index 0cfbfe8780..b82fc96aea 100644 --- a/Zend/tests/bug43483.phpt +++ b/Zend/tests/bug43483.phpt @@ -3,15 +3,15 @@ Bug #43483 (get_class_methods() does not list all visible methods) --FILE-- <?php class C { - public static function test() { - D::prot(); - print_r(get_class_methods("D")); - } + public static function test() { + D::prot(); + print_r(get_class_methods("D")); + } } class D extends C { - protected static function prot() { - echo "Successfully called D::prot().\n"; - } + protected static function prot() { + echo "Successfully called D::prot().\n"; + } } D::test(); ?> diff --git a/Zend/tests/bug43851.phpt b/Zend/tests/bug43851.phpt index e19e393df0..7b0de5b117 100644 --- a/Zend/tests/bug43851.phpt +++ b/Zend/tests/bug43851.phpt @@ -4,9 +4,9 @@ Bug #43851 (Memory corrution on reuse of assigned value) <?php foo(); function foo() { - global $LAST; - ($LAST = $LAST + 0) * 1; - echo "ok\n"; + global $LAST; + ($LAST = $LAST + 0) * 1; + echo "ok\n"; } ?> --EXPECT-- diff --git a/Zend/tests/bug44069.phpt b/Zend/tests/bug44069.phpt index 75beaafed7..b18e16b254 100644 --- a/Zend/tests/bug44069.phpt +++ b/Zend/tests/bug44069.phpt @@ -8,12 +8,12 @@ $string = str_repeat('This is a teststring.', 50); for($i = 1; $i <= 2000; $i++) { // $newstring .= $string; //This uses an expected amount of mem. - $newstring = $newstring . $string; //This uses very much mem. + $newstring = $newstring . $string; //This uses very much mem. - for($j = 1; $j <= 10; $j++) - { - $array[] = 'test'; - } + for($j = 1; $j <= 10; $j++) + { + $array[] = 'test'; + } } echo "ok\n"; ?> diff --git a/Zend/tests/bug44184.phpt b/Zend/tests/bug44184.phpt index 7f277acc74..e6e72554ad 100644 --- a/Zend/tests/bug44184.phpt +++ b/Zend/tests/bug44184.phpt @@ -3,18 +3,18 @@ Bug #44184 (Double free of loop-variable on exception) --FILE-- <?php function foo() { - $x = array(1,2,3); - foreach ($x as $a) { - while (1) { - throw new Exception(); - } - return; - } + $x = array(1,2,3); + foreach ($x as $a) { + while (1) { + throw new Exception(); + } + return; + } } try { - foo(); + foo(); } catch (Exception $ex) { - echo "ok\n"; + echo "ok\n"; } ?> --EXPECT-- diff --git a/Zend/tests/bug44653.phpt b/Zend/tests/bug44653.phpt index 28e1d8ef71..8657beba00 100644 --- a/Zend/tests/bug44653.phpt +++ b/Zend/tests/bug44653.phpt @@ -8,10 +8,10 @@ function fooBar() { echo __FUNCTION__ . PHP_EOL; } namespace B; class A { - static function fooBar() { echo "bag1\n"; } + static function fooBar() { echo "bag1\n"; } } class B { - static function fooBar() { echo "bag2\n"; } + static function fooBar() { echo "bag2\n"; } } function fooBar() { echo __FUNCTION__ . PHP_EOL; } var_dump(\A\XX); diff --git a/Zend/tests/bug44899.phpt b/Zend/tests/bug44899.phpt index d9c0de0ef7..bebbe33a9f 100644 --- a/Zend/tests/bug44899.phpt +++ b/Zend/tests/bug44899.phpt @@ -5,17 +5,17 @@ Bug #44899 (__isset usage changes behavior of empty()) class myclass { - private $_data = array(); + private $_data = array(); - function __construct($data) - { - $this->_data = $data; - } + function __construct($data) + { + $this->_data = $data; + } - function __isset($field_name) - { - return isset($this->_data[$field_name]); - } + function __isset($field_name) + { + return isset($this->_data[$field_name]); + } } $arr = array('foo' => ''); diff --git a/Zend/tests/bug44899_2.phpt b/Zend/tests/bug44899_2.phpt index f3ff50604c..ff4412979a 100644 --- a/Zend/tests/bug44899_2.phpt +++ b/Zend/tests/bug44899_2.phpt @@ -5,22 +5,22 @@ Bug #44899 (__isset usage changes behavior of empty()) - 2 class myclass { - private $_data = array(); - - function __construct($data) - { - $this->_data = $data; - } - - function __isset($field_name) - { - return isset($this->_data[$field_name]); - } - - function __get($var) { - var_dump(empty($this->_data[$var])); - return $this->_data[$var]; - } + private $_data = array(); + + function __construct($data) + { + $this->_data = $data; + } + + function __isset($field_name) + { + return isset($this->_data[$field_name]); + } + + function __get($var) { + var_dump(empty($this->_data[$var])); + return $this->_data[$var]; + } } $arr = array('foo' => ''); diff --git a/Zend/tests/bug45147.phpt b/Zend/tests/bug45147.phpt index b940777d12..eb5d89c702 100644 --- a/Zend/tests/bug45147.phpt +++ b/Zend/tests/bug45147.phpt @@ -2,7 +2,7 @@ Bug #45147 (unexpected T_ENDFOR) --FILE-- <?php for ($i = 0; $i == 0; $i++): ?> - <?php if (true): ?>#<?php else: ?>#<?php endif; ?> + <?php if (true): ?>#<?php else: ?>#<?php endif; ?> <?php endfor; ?> --EXPECT-- # diff --git a/Zend/tests/bug45180.phpt b/Zend/tests/bug45180.phpt index 285543aaf0..77daa07b4d 100644 --- a/Zend/tests/bug45180.phpt +++ b/Zend/tests/bug45180.phpt @@ -4,21 +4,21 @@ Testing callback formats within class method <?php class foo { - public function test() { - call_user_func(array('FOO', 'ABC')); - call_user_func(array($this, 'ABC')); - foo::XYZ(); - self::WWW(); - call_user_func('FOO::ABC'); - } - function __call($a, $b) { - print "__call:\n"; - var_dump($a); - } - static public function __callStatic($a, $b) { - print "__callstatic:\n"; - var_dump($a); - } + public function test() { + call_user_func(array('FOO', 'ABC')); + call_user_func(array($this, 'ABC')); + foo::XYZ(); + self::WWW(); + call_user_func('FOO::ABC'); + } + function __call($a, $b) { + print "__call:\n"; + var_dump($a); + } + static public function __callStatic($a, $b) { + print "__callstatic:\n"; + var_dump($a); + } } $x = new foo; diff --git a/Zend/tests/bug45186.phpt b/Zend/tests/bug45186.phpt index 1c25a86921..11968091e3 100644 --- a/Zend/tests/bug45186.phpt +++ b/Zend/tests/bug45186.phpt @@ -4,25 +4,25 @@ Bug #45186 (__call depends on __callstatic in class scope) <?php class bar { - public function __call($a, $b) { - print "__call:\n"; - var_dump($a); - } - static public function __callstatic($a, $b) { - print "__callstatic:\n"; - var_dump($a); - } - public function test() { - self::ABC(); - bar::ABC(); - call_user_func(array('BAR', 'xyz')); - call_user_func('BAR::www'); - call_user_func(array('self', 'y')); - call_user_func('self::y'); - } - static function x() { - print "ok\n"; - } + public function __call($a, $b) { + print "__call:\n"; + var_dump($a); + } + static public function __callstatic($a, $b) { + print "__callstatic:\n"; + var_dump($a); + } + public function test() { + self::ABC(); + bar::ABC(); + call_user_func(array('BAR', 'xyz')); + call_user_func('BAR::www'); + call_user_func(array('self', 'y')); + call_user_func('self::y'); + } + static function x() { + print "ok\n"; + } } $x = new bar; diff --git a/Zend/tests/bug45186_2.phpt b/Zend/tests/bug45186_2.phpt index cb098136a0..5e962dd29a 100644 --- a/Zend/tests/bug45186_2.phpt +++ b/Zend/tests/bug45186_2.phpt @@ -4,21 +4,21 @@ Bug #45186.2 (__call depends on __callstatic in class scope) <?php class bar { - public function __call($a, $b) { - print "__call:\n"; - var_dump($a); - } - public function test() { - self::ABC(); - bar::ABC(); - call_user_func(array('BAR', 'xyz')); - call_user_func('BAR::www'); - call_user_func(array('self', 'y')); - call_user_func('self::y'); - } - static function x() { - print "ok\n"; - } + public function __call($a, $b) { + print "__call:\n"; + var_dump($a); + } + public function test() { + self::ABC(); + bar::ABC(); + call_user_func(array('BAR', 'xyz')); + call_user_func('BAR::www'); + call_user_func(array('self', 'y')); + call_user_func('self::y'); + } + static function x() { + print "ok\n"; + } } $x = new bar; diff --git a/Zend/tests/bug45744.phpt b/Zend/tests/bug45744.phpt index c1e2a4841c..0984b8591d 100644 --- a/Zend/tests/bug45744.phpt +++ b/Zend/tests/bug45744.phpt @@ -4,14 +4,14 @@ Bug #45744 (Case sensitive callback behaviour) <?php class Foo { public function __construct(array $data) { - var_dump(array_map(array($this, 'callback'), $data)); + var_dump(array_map(array($this, 'callback'), $data)); } private function callback($value) { if (!is_array($value)) { return stripslashes($value); } - return array_map(array($this, 'callback'), $value); + return array_map(array($this, 'callback'), $value); } } @@ -22,7 +22,7 @@ new Bar(array()); class Foo2 { public function __construct(array $data) { - var_dump(array_map(array($this, 'callBack'), $data)); + var_dump(array_map(array($this, 'callBack'), $data)); } private function callBack($value) { diff --git a/Zend/tests/bug45877.phpt b/Zend/tests/bug45877.phpt index ec44cb061f..79c3020f20 100644 --- a/Zend/tests/bug45877.phpt +++ b/Zend/tests/bug45877.phpt @@ -5,10 +5,10 @@ precision=16 --FILE-- <?php $keys = array(PHP_INT_MAX, - (string) PHP_INT_MAX, - (string) (-PHP_INT_MAX - 1), - -PHP_INT_MAX - 1, - (string) (PHP_INT_MAX + 1)); + (string) PHP_INT_MAX, + (string) (-PHP_INT_MAX - 1), + -PHP_INT_MAX - 1, + (string) (PHP_INT_MAX + 1)); var_dump(array_fill_keys($keys, 1)); ?> diff --git a/Zend/tests/bug45910.phpt b/Zend/tests/bug45910.phpt index 7f2ea8b205..172443482a 100644 --- a/Zend/tests/bug45910.phpt +++ b/Zend/tests/bug45910.phpt @@ -4,20 +4,20 @@ Bug #45910 (Cannot declare self-referencing constant) <?php class foo { - const AAA = 'x'; - const BBB = 'a'; - const CCC = 'a'; - const DDD = self::AAA; + const AAA = 'x'; + const BBB = 'a'; + const CCC = 'a'; + const DDD = self::AAA; - private static $foo = array( - self::BBB => 'a', - self::CCC => 'b', - self::DDD => self::AAA - ); + private static $foo = array( + self::BBB => 'a', + self::CCC => 'b', + self::DDD => self::AAA + ); - public static function test() { - self::$foo; - } + public static function test() { + self::$foo; + } } foo::test(); diff --git a/Zend/tests/bug45910_2.phpt b/Zend/tests/bug45910_2.phpt index dec6565c0e..a93f424f4d 100644 --- a/Zend/tests/bug45910_2.phpt +++ b/Zend/tests/bug45910_2.phpt @@ -4,20 +4,20 @@ Bug #45910.2 (Cannot declare self-referencing constant) <?php class foo { - const AAA = 'x'; - const BBB = 'a'; - const CCC = 'a'; - const DDD = self::AAA; + const AAA = 'x'; + const BBB = 'a'; + const CCC = 'a'; + const DDD = self::AAA; - private static $foo = array( - self::BBB => 'a', - self::CCC => 'b', - self::DDD => 11 - ); + private static $foo = array( + self::BBB => 'a', + self::CCC => 'b', + self::DDD => 11 + ); - public static function test() { - self::$foo; - } + public static function test() { + self::$foo; + } } foo::test(); diff --git a/Zend/tests/bug46106.phpt b/Zend/tests/bug46106.phpt index b0e769e05a..525c4df6c5 100644 --- a/Zend/tests/bug46106.phpt +++ b/Zend/tests/bug46106.phpt @@ -9,9 +9,9 @@ function foobar($errno, $errstr, $errfile, $errline) { } set_error_handler('foobar'); function test($x) { - global $foo; + global $foo; - $x->invokeArgs(array(0)); + $x->invokeArgs(array(0)); } $x = new ReflectionFunction('str_pad'); diff --git a/Zend/tests/bug46246.phpt b/Zend/tests/bug46246.phpt index 12be587d74..6671c5a125 100644 --- a/Zend/tests/bug46246.phpt +++ b/Zend/tests/bug46246.phpt @@ -4,25 +4,25 @@ Bug #46246 (difference between call_user_func(array($this, $method)) and $this-> <?php class A { - private function Test() - { - echo 'Hello from '.get_class($this)."\n"; - } + private function Test() + { + echo 'Hello from '.get_class($this)."\n"; + } - public function call($method, $args = array()) - { - $this->Test(); - $this->$method(); - call_user_func(array($this, $method)); - } + public function call($method, $args = array()) + { + $this->Test(); + $this->$method(); + call_user_func(array($this, $method)); + } } class B extends A { - protected function Test() - { - echo 'Overridden hello from '.get_class($this)."\n"; - } + protected function Test() + { + echo 'Overridden hello from '.get_class($this)."\n"; + } } $a = new A; diff --git a/Zend/tests/bug46381.phpt b/Zend/tests/bug46381.phpt index ce4e399284..db948832e6 100644 --- a/Zend/tests/bug46381.phpt +++ b/Zend/tests/bug46381.phpt @@ -4,9 +4,9 @@ Bug #46381 (wrong $this passed to internal methods causes segfault) <?php class test { - public function method() { - return ArrayIterator::current(); - } + public function method() { + return ArrayIterator::current(); + } } $test = new test(); $test->method(); diff --git a/Zend/tests/bug46701.phpt b/Zend/tests/bug46701.phpt index 523a96735f..5da5a9afc7 100644 --- a/Zend/tests/bug46701.phpt +++ b/Zend/tests/bug46701.phpt @@ -6,8 +6,8 @@ Bug #46701 (Creating associative array with long values in the key fails on 32bi <?php $test_array = array( - 0xcc5c4600 => 1, - 0xce331a00 => 2 + 0xcc5c4600 => 1, + 0xce331a00 => 2 ); $test_array[0xce359000] = 3; @@ -15,12 +15,12 @@ var_dump($test_array); var_dump($test_array[0xce331a00]); class foo { - public $x; + public $x; - public function __construct() { - $this->x[0xce359000] = 3; - var_dump($this->x); - } + public function __construct() { + $this->x[0xce359000] = 3; + var_dump($this->x); + } } new foo; diff --git a/Zend/tests/bug46813.phpt b/Zend/tests/bug46813.phpt index b1505fc07d..321c5775b5 100644 --- a/Zend/tests/bug46813.phpt +++ b/Zend/tests/bug46813.phpt @@ -4,10 +4,10 @@ Bug #46813: class_exists doesn`t work with fully qualified namespace <?php namespace test; { - class inner - { + class inner + { - } + } } $inner = new \test\inner(); diff --git a/Zend/tests/bug47165.phpt b/Zend/tests/bug47165.phpt index 2cf648d855..7f47242a1e 100644 --- a/Zend/tests/bug47165.phpt +++ b/Zend/tests/bug47165.phpt @@ -3,13 +3,13 @@ Bug #47165 (Possible memory corruption when passing return value by reference) --FILE-- <?php class Foo { - var $bar = array(); + var $bar = array(); - static function bar() { - static $instance = null; - $instance = new Foo(); - return $instance->bar; - } + static function bar() { + static $instance = null; + $instance = new Foo(); + return $instance->bar; + } } extract(Foo::bar()); echo "ok\n"; diff --git a/Zend/tests/bug47343.phpt b/Zend/tests/bug47343.phpt index bf1a5d2b31..f6168acf74 100644 --- a/Zend/tests/bug47343.phpt +++ b/Zend/tests/bug47343.phpt @@ -4,38 +4,38 @@ Bug #47343 (gc_collect_cycles causes a segfault when called within a destructor <?php class A { - public function __destruct() - { - gc_collect_cycles(); - } + public function __destruct() + { + gc_collect_cycles(); + } - public function getB() - { - $this->data['foo'] = new B($this); - $this->data['bar'] = new B($this); - // Return either of the above - return $this->data['foo']; - } + public function getB() + { + $this->data['foo'] = new B($this); + $this->data['bar'] = new B($this); + // Return either of the above + return $this->data['foo']; + } } class B { - public function __construct($A) - { - $this->A = $A; - } + public function __construct($A) + { + $this->A = $A; + } - public function __destruct() - { - } + public function __destruct() + { + } } for ($i = 0; $i < 2; $i++) { - $Aobj = new A; - $Bobj = $Aobj->getB(); - unset($Bobj); - unset($Aobj); + $Aobj = new A; + $Bobj = $Aobj->getB(); + unset($Bobj); + unset($Aobj); } echo "DONE\n"; diff --git a/Zend/tests/bug47353.phpt b/Zend/tests/bug47353.phpt index 189b1f51a6..de5c280e6a 100644 --- a/Zend/tests/bug47353.phpt +++ b/Zend/tests/bug47353.phpt @@ -5,17 +5,17 @@ Bug #47353 (crash when creating a lot of objects in object destructor) class A { - function __destruct() - { - $myArray = array(); + function __destruct() + { + $myArray = array(); - for($i = 1; $i <= 3000; $i++) { - if(!isset($myArray[$i])) - $myArray[$i] = array(); - $ref = & $myArray[$i]; - $ref[] = new stdClass(); - } - } + for($i = 1; $i <= 3000; $i++) { + if(!isset($myArray[$i])) + $myArray[$i] = array(); + $ref = & $myArray[$i]; + $ref[] = new stdClass(); + } + } } $a = new A(); diff --git a/Zend/tests/bug47593.phpt b/Zend/tests/bug47593.phpt index ffbe7c8dbb..fb3bfeab52 100644 --- a/Zend/tests/bug47593.phpt +++ b/Zend/tests/bug47593.phpt @@ -7,8 +7,8 @@ namespace test; const TEST = 11; class foo { - public function xyz() { - } + public function xyz() { + } } interface baz { diff --git a/Zend/tests/bug47699.phpt b/Zend/tests/bug47699.phpt index 6d4871bc2d..a30c8a8170 100644 --- a/Zend/tests/bug47699.phpt +++ b/Zend/tests/bug47699.phpt @@ -3,9 +3,9 @@ Bug #47699 (autoload and late static binding) --FILE-- <?php class A { - static function test($v='') { - print_r(get_called_class()); - } + static function test($v='') { + print_r(get_called_class()); + } } class B extends A { } diff --git a/Zend/tests/bug48215.phpt b/Zend/tests/bug48215.phpt index 6af1867361..4e905df19a 100644 --- a/Zend/tests/bug48215.phpt +++ b/Zend/tests/bug48215.phpt @@ -4,25 +4,25 @@ Bug #48215 - parent::method() calls __construct <?php class A { - public function __construct() { - echo __METHOD__ . "\n"; - } - protected function A() - { - echo __METHOD__ . "\n"; - } + public function __construct() { + echo __METHOD__ . "\n"; + } + protected function A() + { + echo __METHOD__ . "\n"; + } } class B extends A { - public function __construct() { - echo __METHOD__ . "\n"; - parent::__construct(); - } - public function A() - { - echo __METHOD__ . "\n"; - parent::A(); - } + public function __construct() { + echo __METHOD__ . "\n"; + parent::__construct(); + } + public function A() + { + echo __METHOD__ . "\n"; + parent::A(); + } } $b = new B(); $b->A(); diff --git a/Zend/tests/bug48215_2.phpt b/Zend/tests/bug48215_2.phpt index 67380063c6..aa687196e1 100644 --- a/Zend/tests/bug48215_2.phpt +++ b/Zend/tests/bug48215_2.phpt @@ -3,14 +3,14 @@ Bug #48215 - parent::method() calls __construct, case sensitive test --FILE-- <?php class a { - public function __CONSTRUCT() { echo __METHOD__ . "\n"; } - public function a() { echo __METHOD__ . "\n"; } + public function __CONSTRUCT() { echo __METHOD__ . "\n"; } + public function a() { echo __METHOD__ . "\n"; } } class b extends a {} class c extends b { - function __construct() { - b::b(); - } + function __construct() { + b::b(); + } } $c = new c(); ?> diff --git a/Zend/tests/bug48228.phpt b/Zend/tests/bug48228.phpt index d91ded28be..a4fa5483b9 100644 --- a/Zend/tests/bug48228.phpt +++ b/Zend/tests/bug48228.phpt @@ -4,19 +4,19 @@ Bug #48228 (crash when exception is thrown while passing function arguments) <?php function do_throw() { - throw new Exception(); + throw new Exception(); } class aa { - function check() - { - } + function check() + { + } - function dosome() - { - $this->check(do_throw()); - } + function dosome() + { + $this->check(do_throw()); + } } $l_aa=new aa(); diff --git a/Zend/tests/bug48408.phpt b/Zend/tests/bug48408.phpt index 3315f40962..cc34e17424 100644 --- a/Zend/tests/bug48408.phpt +++ b/Zend/tests/bug48408.phpt @@ -3,22 +3,22 @@ Bug #48408 (crash when exception is thrown while passing function arguments) --FILE-- <?php class B{ - public function process($x){ - return $x; - } + public function process($x){ + return $x; + } } class C{ - public function generate($x){ - throw new Exception; - } + public function generate($x){ + throw new Exception; + } } $b = new B; $c = new C; try{ - $b->process($c->generate(0)); + $b->process($c->generate(0)); } catch(Exception $e){ - $c->generate(0); + $c->generate(0); } ?> --EXPECTF-- diff --git a/Zend/tests/bug48409.phpt b/Zend/tests/bug48409.phpt index 7ba99cdbf4..d05f5c42f4 100644 --- a/Zend/tests/bug48409.phpt +++ b/Zend/tests/bug48409.phpt @@ -7,59 +7,59 @@ class ABCException extends Exception {} class BBB { - public function xyz($d, $x) - { - if ($x == 34) { - throw new ABCException; - } - return array('foo' => 'xyz'); - } + public function xyz($d, $x) + { + if ($x == 34) { + throw new ABCException; + } + return array('foo' => 'xyz'); + } } class CCC { - public function process($p) - { - return $p; - } + public function process($p) + { + return $p; + } } class AAA { - public function func() - { - $b = new BBB; - $c = new CCC; - $i = 34; - $item = array('foo' => 'bar'); - try { - $c->process($b->xyz($item['foo'], $i)); - } - catch(ABCException $e) { - $b->xyz($item['foo'], $i); - } - } // end func(); + public function func() + { + $b = new BBB; + $c = new CCC; + $i = 34; + $item = array('foo' => 'bar'); + try { + $c->process($b->xyz($item['foo'], $i)); + } + catch(ABCException $e) { + $b->xyz($item['foo'], $i); + } + } // end func(); } class Runner { - public function run($x) - { - try { - $x->func(); - } - catch(ABCException $e) { - throw new Exception; - } - } + public function run($x) + { + try { + $x->func(); + } + catch(ABCException $e) { + throw new Exception; + } + } } try { - $runner = new Runner; - $runner->run(new AAA); + $runner = new Runner; + $runner->run(new AAA); } catch(Exception $e) { - die('Exception thrown'); + die('Exception thrown'); } ?> diff --git a/Zend/tests/bug48428.phpt b/Zend/tests/bug48428.phpt index ae9ac936a3..0cda84dea4 100644 --- a/Zend/tests/bug48428.phpt +++ b/Zend/tests/bug48428.phpt @@ -3,10 +3,10 @@ Bug #48428 (crash when exception is thrown while passing function arguments) --FILE-- <?php try { - function x() { throw new Exception("ERROR"); } - x(x()); + function x() { throw new Exception("ERROR"); } + x(x()); } catch(Exception $e) { - echo($e -> getMessage()); + echo($e -> getMessage()); } ?> --EXPECT-- diff --git a/Zend/tests/bug48533.phpt b/Zend/tests/bug48533.phpt index 3dfbc658ec..39b1db9ee7 100644 --- a/Zend/tests/bug48533.phpt +++ b/Zend/tests/bug48533.phpt @@ -4,21 +4,21 @@ Bug #48533 (__callStatic is not invoked for private/protected methods) <?php class foo { - private function a() { - var_dump(1); - } - public function b() { - var_dump(2); - } - protected function c() { - var_dump(3); - } - static function __callstatic($a, $b) { - var_dump('__callStatic::'. $a); - } - public function __call($a, $b) { - var_dump('__call::'. $a); - } + private function a() { + var_dump(1); + } + public function b() { + var_dump(2); + } + protected function c() { + var_dump(3); + } + static function __callstatic($a, $b) { + var_dump('__callStatic::'. $a); + } + public function __call($a, $b) { + var_dump('__call::'. $a); + } } $x = new foo; diff --git a/Zend/tests/bug48770.phpt b/Zend/tests/bug48770.phpt index 6ae972a7ab..e96047c79b 100644 --- a/Zend/tests/bug48770.phpt +++ b/Zend/tests/bug48770.phpt @@ -6,43 +6,43 @@ See Bug #48770 <?php class A { - public function func($str) { - var_dump(__METHOD__ .': '. $str); - } - private function func2($str) { - var_dump(__METHOD__ .': '. $str); - } - protected function func3($str) { - var_dump(__METHOD__ .': '. $str); - } - private function func22($str) { - var_dump(__METHOD__ .': '. $str); - } + public function func($str) { + var_dump(__METHOD__ .': '. $str); + } + private function func2($str) { + var_dump(__METHOD__ .': '. $str); + } + protected function func3($str) { + var_dump(__METHOD__ .': '. $str); + } + private function func22($str) { + var_dump(__METHOD__ .': '. $str); + } } class B extends A { - public function func($str) { - static $avoid_crash = 0; + public function func($str) { + static $avoid_crash = 0; - if ($avoid_crash++ == 1) { - print "This method shouldn't be called when using parent::func!\n"; - return; - } + if ($avoid_crash++ == 1) { + print "This method shouldn't be called when using parent::func!\n"; + return; + } - call_user_func_array(array($this, 'parent::func'), array($str)); - } - private function func2($str) { - var_dump(__METHOD__ .': '. $str); - } - protected function func3($str) { - var_dump(__METHOD__ .': '. $str); - } + call_user_func_array(array($this, 'parent::func'), array($str)); + } + private function func2($str) { + var_dump(__METHOD__ .': '. $str); + } + protected function func3($str) { + var_dump(__METHOD__ .': '. $str); + } } class C extends B { - public function func($str) { - parent::func($str); - } + public function func($str) { + parent::func($str); + } } $c = new C; diff --git a/Zend/tests/bug48770_2.phpt b/Zend/tests/bug48770_2.phpt index d7984eac4f..3666ebc9ce 100644 --- a/Zend/tests/bug48770_2.phpt +++ b/Zend/tests/bug48770_2.phpt @@ -6,39 +6,39 @@ See Bug #48770 <?php class A { - public function func($str) { - var_dump(__METHOD__ .': '. $str); - } - private function func2($str) { - var_dump(__METHOD__ .': '. $str); - } - protected function func3($str) { - var_dump(__METHOD__ .': '. $str); - } - private function func22($str) { - var_dump(__METHOD__ .': '. $str); - } + public function func($str) { + var_dump(__METHOD__ .': '. $str); + } + private function func2($str) { + var_dump(__METHOD__ .': '. $str); + } + protected function func3($str) { + var_dump(__METHOD__ .': '. $str); + } + private function func22($str) { + var_dump(__METHOD__ .': '. $str); + } } class B extends A { - public function func($str) { - call_user_func_array(array($this, 'parent::func2'), array($str)); - call_user_func_array(array($this, 'parent::func3'), array($str)); - call_user_func_array(array($this, 'parent::func22'), array($str)); - call_user_func_array(array($this, 'parent::inexistent'), array($str)); - } - private function func2($str) { - var_dump(__METHOD__ .': '. $str); - } - protected function func3($str) { - var_dump(__METHOD__ .': '. $str); - } + public function func($str) { + call_user_func_array(array($this, 'parent::func2'), array($str)); + call_user_func_array(array($this, 'parent::func3'), array($str)); + call_user_func_array(array($this, 'parent::func22'), array($str)); + call_user_func_array(array($this, 'parent::inexistent'), array($str)); + } + private function func2($str) { + var_dump(__METHOD__ .': '. $str); + } + protected function func3($str) { + var_dump(__METHOD__ .': '. $str); + } } class C extends B { - public function func($str) { - parent::func($str); - } + public function func($str) { + parent::func($str); + } } $c = new C; diff --git a/Zend/tests/bug48770_3.phpt b/Zend/tests/bug48770_3.phpt index 5c6eacb470..0b5150d518 100644 --- a/Zend/tests/bug48770_3.phpt +++ b/Zend/tests/bug48770_3.phpt @@ -6,38 +6,38 @@ See Bug #48770 <?php class A { - public function func($str) { - var_dump(__METHOD__ .': '. $str); - } - private function func2($str) { - var_dump(__METHOD__ .': '. $str); - } - protected function func3($str) { - var_dump(__METHOD__ .': '. $str); - } - private function func22($str) { - var_dump(__METHOD__ .': '. $str); - } + public function func($str) { + var_dump(__METHOD__ .': '. $str); + } + private function func2($str) { + var_dump(__METHOD__ .': '. $str); + } + protected function func3($str) { + var_dump(__METHOD__ .': '. $str); + } + private function func22($str) { + var_dump(__METHOD__ .': '. $str); + } } class B extends A { - public function func($str) { - call_user_func_array(array($this, 'self::func2'), array($str)); - call_user_func_array(array($this, 'self::func3'), array($str)); - call_user_func_array(array($this, 'self::inexistent'), array($str)); - } - private function func2($str) { - var_dump(__METHOD__ .': '. $str); - } - protected function func3($str) { - var_dump(__METHOD__ .': '. $str); - } + public function func($str) { + call_user_func_array(array($this, 'self::func2'), array($str)); + call_user_func_array(array($this, 'self::func3'), array($str)); + call_user_func_array(array($this, 'self::inexistent'), array($str)); + } + private function func2($str) { + var_dump(__METHOD__ .': '. $str); + } + protected function func3($str) { + var_dump(__METHOD__ .': '. $str); + } } class C extends B { - public function func($str) { - parent::func($str); - } + public function func($str) { + parent::func($str); + } } $c = new C; diff --git a/Zend/tests/bug48899.phpt b/Zend/tests/bug48899.phpt index ff640543cb..2cbf308c3e 100644 --- a/Zend/tests/bug48899.phpt +++ b/Zend/tests/bug48899.phpt @@ -6,12 +6,12 @@ Bug #48899 (is_callable returns true even if method does not exist in parent cla class ParentClass { } class ChildClass extends ParentClass { - public function testIsCallable() { - var_dump(is_callable(array($this, 'parent::testIsCallable'))); - } - public function testIsCallable2() { - var_dump(is_callable(array($this, 'static::testIsCallable2'))); - } + public function testIsCallable() { + var_dump(is_callable(array($this, 'parent::testIsCallable'))); + } + public function testIsCallable2() { + var_dump(is_callable(array($this, 'static::testIsCallable2'))); + } } $child = new ChildClass(); diff --git a/Zend/tests/bug48912.phpt b/Zend/tests/bug48912.phpt index dc021a2efc..b2cee06bf1 100644 --- a/Zend/tests/bug48912.phpt +++ b/Zend/tests/bug48912.phpt @@ -6,7 +6,7 @@ namespace A; function test() { - extract(func_get_arg(0)); + extract(func_get_arg(0)); } test(array('x' => 1)); diff --git a/Zend/tests/bug49472.phpt b/Zend/tests/bug49472.phpt index 2d7ae514f2..e5b21fd500 100644 --- a/Zend/tests/bug49472.phpt +++ b/Zend/tests/bug49472.phpt @@ -12,12 +12,12 @@ class Foo implements ia { } class FooBar extends Foo implements ia { - const x = 1; - const c = 'Ocean'; + const x = 1; + const c = 'Ocean'; - public function show() { - return ia::c; - } + public function show() { + return ia::c; + } } new FooBar; diff --git a/Zend/tests/bug49893.phpt b/Zend/tests/bug49893.phpt index addf447073..adab4421dd 100644 --- a/Zend/tests/bug49893.phpt +++ b/Zend/tests/bug49893.phpt @@ -3,24 +3,24 @@ Bug #49893 (Crash while creating an instance of Zend_Mail_Storage_Pop3) --FILE-- <?php class A { - function __destruct() { - try { - throw new Exception("2"); - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - } - } + function __destruct() { + try { + throw new Exception("2"); + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + } + } } class B { - function __construct() { - $this->a = new A(); - throw new Exception("1"); - } + function __construct() { + $this->a = new A(); + throw new Exception("1"); + } } try { - $b = new B(); + $b = new B(); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/Zend/tests/bug49908.phpt b/Zend/tests/bug49908.phpt index 8ab6307180..e108918b13 100644 --- a/Zend/tests/bug49908.phpt +++ b/Zend/tests/bug49908.phpt @@ -4,13 +4,13 @@ Bug #49908 (throwing exception in autoloader crashes when interface is not defin <?php spl_autoload_register(function ($className) { - var_dump($className); + var_dump($className); - if ($className == 'Foo') { - class Foo implements Bar {}; - } else { - throw new Exception($className); - } + if ($className == 'Foo') { + class Foo implements Bar {}; + } else { + throw new Exception($className); + } }); try { diff --git a/Zend/tests/bug50005.phpt b/Zend/tests/bug50005.phpt index 2ed055a129..8b3817cd5f 100644 --- a/Zend/tests/bug50005.phpt +++ b/Zend/tests/bug50005.phpt @@ -4,9 +4,9 @@ Bug #50005 (Throwing through Reflection modified Exception object makes segmenta <?php class a extends exception { - public function __construct() { - $this->file = null; - } + public function __construct() { + $this->file = null; + } } throw new a; diff --git a/Zend/tests/bug50174.phpt b/Zend/tests/bug50174.phpt index 6ed5733b67..5f0bbd7dd4 100644 --- a/Zend/tests/bug50174.phpt +++ b/Zend/tests/bug50174.phpt @@ -5,10 +5,10 @@ Bug #50174 (Incorrectly matched docComment) class TestClass { - /** const comment */ - const C = 0; + /** const comment */ + const C = 0; - function x() {} + function x() {} } $rm = new ReflectionMethod('TestClass', 'x'); @@ -16,10 +16,10 @@ var_dump($rm->getDocComment()); class TestClass2 { - /** const comment */ - const C = 0; + /** const comment */ + const C = 0; - public $x; + public $x; } $rp = new ReflectionProperty('TestClass2', 'x'); diff --git a/Zend/tests/bug50383.phpt b/Zend/tests/bug50383.phpt index de81facd05..2f72ea51f8 100644 --- a/Zend/tests/bug50383.phpt +++ b/Zend/tests/bug50383.phpt @@ -4,34 +4,34 @@ Bug #50383 (Exceptions thrown in __call / __callStatic do not include file and l <?php class myClass { - public static function __callStatic($method, $args) { - throw new Exception("Missing static method '$method'\n"); - } - public function __call($method, $args) { - throw new Exception("Missing method '$method'\n"); - } + public static function __callStatic($method, $args) { + throw new Exception("Missing static method '$method'\n"); + } + public function __call($method, $args) { + throw new Exception("Missing method '$method'\n"); + } } function thrower() { - myClass::ThrowException(); + myClass::ThrowException(); } function thrower2() { - $x = new myClass; - $x->foo(); + $x = new myClass; + $x->foo(); } try { - thrower(); + thrower(); } catch(Exception $e) { - print $e->getMessage(); - print_r($e->getTrace()); + print $e->getMessage(); + print_r($e->getTrace()); } try { - thrower2(); + thrower2(); } catch (Exception $e) { - print $e->getMessage(); - print_r($e->getTrace()); + print $e->getMessage(); + print_r($e->getTrace()); } ?> diff --git a/Zend/tests/bug50394.phpt b/Zend/tests/bug50394.phpt index 60b9d34582..e3beb2a2e4 100644 --- a/Zend/tests/bug50394.phpt +++ b/Zend/tests/bug50394.phpt @@ -6,7 +6,7 @@ function inc( &$x ) { $x++; } class Proxy { function __call( $name, $args ) { - echo "$name called!\n"; + echo "$name called!\n"; call_user_func_array( 'inc', $args ); } } diff --git a/Zend/tests/bug51176.phpt b/Zend/tests/bug51176.phpt index c5185cc5fa..cf47b74da8 100644 --- a/Zend/tests/bug51176.phpt +++ b/Zend/tests/bug51176.phpt @@ -4,22 +4,22 @@ Bug #51176 (Static calling in non-static method behaves like $this->) <?php class Foo { - public function start() - { - self::bar(); - static::bar(); - Foo::bar(); - } + public function start() + { + self::bar(); + static::bar(); + Foo::bar(); + } - public function __call($n, $a) - { - echo "instance\n"; - } + public function __call($n, $a) + { + echo "instance\n"; + } - public static function __callStatic($n, $a) - { - echo "static\n"; - } + public static function __callStatic($n, $a) + { + echo "static\n"; + } } $foo = new Foo(); diff --git a/Zend/tests/bug51394.phpt b/Zend/tests/bug51394.phpt index e31bc230cd..48623b30f2 100644 --- a/Zend/tests/bug51394.phpt +++ b/Zend/tests/bug51394.phpt @@ -6,8 +6,8 @@ error_reporting=-1 <?php function eh() { - throw new Exception("error!"); - return false; + throw new Exception("error!"); + return false; } set_error_handler("eh"); diff --git a/Zend/tests/bug51421.phpt b/Zend/tests/bug51421.phpt index bc1758c300..f6daf1eae7 100644 --- a/Zend/tests/bug51421.phpt +++ b/Zend/tests/bug51421.phpt @@ -6,11 +6,11 @@ Bug #51421 (Abstract __construct constructor argument list not enforced) class ExampleClass {} abstract class TestInterface { - abstract public function __construct(ExampleClass $var); + abstract public function __construct(ExampleClass $var); } class Test extends TestInterface { - public function __construct() {} + public function __construct() {} } ?> diff --git a/Zend/tests/bug51822.phpt b/Zend/tests/bug51822.phpt index c097395283..0a3813b2f1 100644 --- a/Zend/tests/bug51822.phpt +++ b/Zend/tests/bug51822.phpt @@ -4,24 +4,24 @@ Bug #51822 (Segfault with strange __destruct() for static class variables) <?php class DestructableObject { - public function __destruct() - { - echo "2\n"; - } + public function __destruct() + { + echo "2\n"; + } } class DestructorCreator { - public function __destruct() - { - $this->test = new DestructableObject; - echo "1\n"; - } + public function __destruct() + { + $this->test = new DestructableObject; + echo "1\n"; + } } class Test { - public static $mystatic; + public static $mystatic; } // Uncomment this to avoid segfault @@ -30,7 +30,7 @@ class Test $x = new Test(); if (!isset(Test::$mystatic)) - Test::$mystatic = new DestructorCreator(); + Test::$mystatic = new DestructorCreator(); echo "bla\n"; ?> diff --git a/Zend/tests/bug51827.phpt b/Zend/tests/bug51827.phpt index 77bdc069c3..6c3d721716 100644 --- a/Zend/tests/bug51827.phpt +++ b/Zend/tests/bug51827.phpt @@ -5,7 +5,7 @@ Bug #51827 (Bad warning when register_shutdown_function called with wrong num of function abc() { - var_dump(1); + var_dump(1); } register_shutdown_function('timE'); diff --git a/Zend/tests/bug52041.phpt b/Zend/tests/bug52041.phpt index 467a29fe77..e5aca5c82e 100644 --- a/Zend/tests/bug52041.phpt +++ b/Zend/tests/bug52041.phpt @@ -3,7 +3,7 @@ Bug #52041 (Memory leak when writing on uninitialized variable returned from fun --FILE-- <?php function foo() { - return $x; + return $x; } try { diff --git a/Zend/tests/bug52193.phpt b/Zend/tests/bug52193.phpt index 7452672e31..12b9868bcc 100644 --- a/Zend/tests/bug52193.phpt +++ b/Zend/tests/bug52193.phpt @@ -10,7 +10,7 @@ var_dump($h = (array) function () { return 2; }); var_dump($h[0]()); $i = function () use (&$h) { - return $h; + return $h; }; var_dump($x = (array)$i); diff --git a/Zend/tests/bug52361.phpt b/Zend/tests/bug52361.phpt index 5ffe569e4a..1937fee020 100644 --- a/Zend/tests/bug52361.phpt +++ b/Zend/tests/bug52361.phpt @@ -3,23 +3,23 @@ Bug #52361 (Throwing an exception in a destructor causes invalid catching) --FILE-- <?php class aaa { - public function __destruct() { - try { - throw new Exception(__CLASS__); - } catch(Exception $ex) { - echo "1. $ex\n"; - } - } + public function __destruct() { + try { + throw new Exception(__CLASS__); + } catch(Exception $ex) { + echo "1. $ex\n"; + } + } } function bbb() { - $a = new aaa(); - throw new Exception(__FUNCTION__); + $a = new aaa(); + throw new Exception(__FUNCTION__); } try { - bbb(); - echo "must be skipped !!!"; + bbb(); + echo "must be skipped !!!"; } catch(Exception $ex) { - echo "2. $ex\n"; + echo "2. $ex\n"; } ?> --EXPECTF-- diff --git a/Zend/tests/bug52484.phpt b/Zend/tests/bug52484.phpt index b8202a4504..9b40b4cae7 100644 --- a/Zend/tests/bug52484.phpt +++ b/Zend/tests/bug52484.phpt @@ -4,9 +4,9 @@ Bug #52484 (__set() ignores setting properties with empty names) <?php class A { - function __unset($prop) { - unset($this->$prop); - } + function __unset($prop) { + unset($this->$prop); + } } $a = new A(); diff --git a/Zend/tests/bug52484_2.phpt b/Zend/tests/bug52484_2.phpt index 3b12950c66..698f2d94b5 100644 --- a/Zend/tests/bug52484_2.phpt +++ b/Zend/tests/bug52484_2.phpt @@ -4,9 +4,9 @@ Bug #52484.2 (__set() ignores setting properties with empty names) <?php class A { - function __set($prop, $val) { - $this->$prop = $val; - } + function __set($prop, $val) { + $this->$prop = $val; + } } $a = new A(); diff --git a/Zend/tests/bug52484_3.phpt b/Zend/tests/bug52484_3.phpt index 995e624dfc..3bb5743963 100644 --- a/Zend/tests/bug52484_3.phpt +++ b/Zend/tests/bug52484_3.phpt @@ -4,9 +4,9 @@ Bug #52484.3 (__set() ignores setting properties with empty names) <?php class A { - function __get($prop) { - var_dump($this->$prop); - } + function __get($prop) { + var_dump($this->$prop); + } } $a = new A(); diff --git a/Zend/tests/bug52614.phpt b/Zend/tests/bug52614.phpt index 77a5f30f67..30c1fc488a 100644 --- a/Zend/tests/bug52614.phpt +++ b/Zend/tests/bug52614.phpt @@ -3,41 +3,41 @@ Bug #52614 (Memory leak when writing on uninitialized variable returned from met --FILE-- <?php class foo { - public $a1; - public $a2 = array(); - public $a3; - public $o1; - public $o2; + public $a1; + public $a2 = array(); + public $a3; + public $o1; + public $o2; - public function f1() { - return $this->a1; - } + public function f1() { + return $this->a1; + } - public function f2() { - return $this->a2; - } + public function f2() { + return $this->a2; + } - public function f3() { - $this->a3 = array(); - return $this->a3; - } + public function f3() { + $this->a3 = array(); + return $this->a3; + } - public function f4() { - return $this->o1; - } + public function f4() { + return $this->o1; + } - public function f5() { - $this->o2 = new stdClass; - return $this->o2; - } + public function f5() { + $this->o2 = new stdClass; + return $this->o2; + } - public function &f6() { - return $this->a1; - } + public function &f6() { + return $this->a1; + } - public function f7(&$x) { - $x = 2; - } + public function f7(&$x) { + $x = 2; + } } diff --git a/Zend/tests/bug52879.phpt b/Zend/tests/bug52879.phpt index 6c3232f32d..09369d2d2f 100644 --- a/Zend/tests/bug52879.phpt +++ b/Zend/tests/bug52879.phpt @@ -3,10 +3,10 @@ Bug #52879 (Objects unreferenced in __get, __set, __isset or __unset can be free --FILE-- <?php class MyClass { - public $myRef; - public function __set($property,$value) { - $this->myRef = $value; - } + public $myRef; + public function __set($property,$value) { + $this->myRef = $value; + } } $myGlobal=new MyClass(); $myGlobal->myRef=&$myGlobal; diff --git a/Zend/tests/bug52940.phpt b/Zend/tests/bug52940.phpt index 51137c091e..a3a130619f 100644 --- a/Zend/tests/bug52940.phpt +++ b/Zend/tests/bug52940.phpt @@ -3,8 +3,8 @@ Bug #52940 (call_user_func_array still allows call-time pass-by-reference) --FILE-- <?php function foo($a) { - $a++; - var_dump($a); + $a++; + var_dump($a); } function bar(&$a) { $a++; diff --git a/Zend/tests/bug53511.phpt b/Zend/tests/bug53511.phpt index 0075655428..620ceb4e9c 100644 --- a/Zend/tests/bug53511.phpt +++ b/Zend/tests/bug53511.phpt @@ -3,18 +3,18 @@ Bug #53511 (Exceptions are lost in case an exception is thrown in catch operator --FILE-- <?php class Foo { - function __destruct() { - throw new Exception("ops 1"); - } + function __destruct() { + throw new Exception("ops 1"); + } } function test() { - $e = new Foo(); - try { - throw new Exception("ops 2"); - } catch (Exception $e) { - echo $e->getMessage()."\n"; - } + $e = new Foo(); + try { + throw new Exception("ops 2"); + } catch (Exception $e) { + echo $e->getMessage()."\n"; + } } test(); diff --git a/Zend/tests/bug54039.phpt b/Zend/tests/bug54039.phpt index ccdfe94305..aade872bf2 100644 --- a/Zend/tests/bug54039.phpt +++ b/Zend/tests/bug54039.phpt @@ -3,41 +3,41 @@ Bug #54039 (use() of static variables in lambda functions can break staticness) --FILE-- <?php function test_1() { - static $v = 0; - ++$v; - echo "Outer function increments \$v to $v\n"; - $f = function() use($v) { - echo "Inner function reckons \$v is $v\n"; - }; - return $f; + static $v = 0; + ++$v; + echo "Outer function increments \$v to $v\n"; + $f = function() use($v) { + echo "Inner function reckons \$v is $v\n"; + }; + return $f; } $f = test_1(); $f(); $f = test_1(); $f(); function test_2() { - static $v = 0; - $f = function() use($v) { - echo "Inner function reckons \$v is $v\n"; - }; - ++$v; - echo "Outer function increments \$v to $v\n"; - return $f; + static $v = 0; + $f = function() use($v) { + echo "Inner function reckons \$v is $v\n"; + }; + ++$v; + echo "Outer function increments \$v to $v\n"; + return $f; } $f = test_2(); $f(); $f = test_2(); $f(); function test_3() { - static $v = ""; - $v .= 'b'; - echo "Outer function catenates 'b' onto \$v to give $v\n"; - $f = function() use($v) { - echo "Inner function reckons \$v is $v\n"; - }; - $v .= 'a'; - echo "Outer function catenates 'a' onto \$v to give $v\n"; - return $f; + static $v = ""; + $v .= 'b'; + echo "Outer function catenates 'b' onto \$v to give $v\n"; + $f = function() use($v) { + echo "Inner function reckons \$v is $v\n"; + }; + $v .= 'a'; + echo "Outer function catenates 'a' onto \$v to give $v\n"; + return $f; } $f = test_3(); $f(); $f = test_3(); $f(); diff --git a/Zend/tests/bug54358.phpt b/Zend/tests/bug54358.phpt index faeeeacc55..28d8edb4fd 100644 --- a/Zend/tests/bug54358.phpt +++ b/Zend/tests/bug54358.phpt @@ -3,8 +3,8 @@ Bug #54358 (Closure, use and reference) --FILE-- <?php class asserter { - public function call($function) { - } + public function call($function) { + } } $asserter = new asserter(); diff --git a/Zend/tests/bug54367.phpt b/Zend/tests/bug54367.phpt index 1ca6ad4252..e926b8937e 100644 --- a/Zend/tests/bug54367.phpt +++ b/Zend/tests/bug54367.phpt @@ -10,7 +10,7 @@ class MyObjet implements ArrayAccess public function offsetGet ($offset) { - return function ($var) use ($offset) { // here is the problem + return function ($var) use ($offset) { // here is the problem var_dump($offset, $var); }; } diff --git a/Zend/tests/bug54624.phpt b/Zend/tests/bug54624.phpt index 66239120a4..883c60ff80 100644 --- a/Zend/tests/bug54624.phpt +++ b/Zend/tests/bug54624.phpt @@ -4,20 +4,20 @@ Bug #54624 (class_alias and type hint) <?php class A { - function foo(A $param) { - } + function foo(A $param) { + } } class_alias('A', 'AliasA'); -eval(' - class B extends A - { - function foo(AliasA $param) { - } +eval(' + class B extends A + { + function foo(AliasA $param) { + } - } + } '); echo "DONE\n"; diff --git a/Zend/tests/bug55156.phpt b/Zend/tests/bug55156.phpt index 53cdf1337a..2dc47a1134 100644 --- a/Zend/tests/bug55156.phpt +++ b/Zend/tests/bug55156.phpt @@ -7,22 +7,22 @@ opcache.save_comments=1 /** test */ namespace foo { - function test() { } + function test() { } - $x = new \ReflectionFunction('foo\test'); - var_dump($x->getDocComment()); + $x = new \ReflectionFunction('foo\test'); + var_dump($x->getDocComment()); - /** test1 */ - class bar { } + /** test1 */ + class bar { } - /** test2 */ - class foo extends namespace\bar { } + /** test2 */ + class foo extends namespace\bar { } - $x = new \ReflectionClass('foo\bar'); - var_dump($x->getDocComment()); + $x = new \ReflectionClass('foo\bar'); + var_dump($x->getDocComment()); - $x = new \ReflectionClass('foo\foo'); - var_dump($x->getDocComment()); + $x = new \ReflectionClass('foo\foo'); + var_dump($x->getDocComment()); } ?> diff --git a/Zend/tests/bug55247.phpt b/Zend/tests/bug55247.phpt index 8c21019abd..163cc721fb 100644 --- a/Zend/tests/bug55247.phpt +++ b/Zend/tests/bug55247.phpt @@ -4,11 +4,11 @@ Request #55247 (Parser problem with static calls using string method name) <?php class Test{ public static function __callStatic($method, $arguments) - { + { echo $method . PHP_EOL; } public function __call($method, $arguments) - { + { echo $method . PHP_EOL; } } diff --git a/Zend/tests/bug55578.phpt b/Zend/tests/bug55578.phpt index b67d3824e0..79bd0c75ab 100644 --- a/Zend/tests/bug55578.phpt +++ b/Zend/tests/bug55578.phpt @@ -11,7 +11,7 @@ class Foo { } function test($options, $queryPart) { - return ''. (0 ? 1 : $queryPart); + return ''. (0 ? 1 : $queryPart); } var_dump(test($options, new Foo())); diff --git a/Zend/tests/bug55825.phpt b/Zend/tests/bug55825.phpt index 23fc933ee6..8ce75c4431 100644 --- a/Zend/tests/bug55825.phpt +++ b/Zend/tests/bug55825.phpt @@ -3,10 +3,10 @@ Bug #55825 (Missing initial value of static locals in trait methods) --FILE-- <?php trait T1 { - public function inc() { - static $x=1; - echo $x++ . "\n"; - } + public function inc() { + static $x=1; + echo $x++ . "\n"; + } } class C { use T1; } $c1 = new C; diff --git a/Zend/tests/bug60099.phpt b/Zend/tests/bug60099.phpt index 8cca3440fb..a8745fa522 100644 --- a/Zend/tests/bug60099.phpt +++ b/Zend/tests/bug60099.phpt @@ -3,7 +3,7 @@ Bug #60099 (__halt_compiler() works in braced namespaces) --FILE-- <?php namespace foo { - __halt_compiler(); + __halt_compiler(); ?> --EXPECTF-- diff --git a/Zend/tests/bug60444.phpt b/Zend/tests/bug60444.phpt index 38f81bc413..a86e1d422f 100644 --- a/Zend/tests/bug60444.phpt +++ b/Zend/tests/bug60444.phpt @@ -3,14 +3,14 @@ Bug #60444 (Segmentation fault with include & class extending) --FILE-- <?php class Foo { - public function __construct() { - eval("class Bar extends Foo {}"); - Some::foo($this); - } + public function __construct() { + eval("class Bar extends Foo {}"); + Some::foo($this); + } } class Some { - public static function foo(Foo $foo) { - } + public static function foo(Foo $foo) { + } } new Foo; echo "done\n"; diff --git a/Zend/tests/bug60536_001.phpt b/Zend/tests/bug60536_001.phpt index b4630f4b87..f4129452eb 100644 --- a/Zend/tests/bug60536_001.phpt +++ b/Zend/tests/bug60536_001.phpt @@ -4,17 +4,17 @@ Bug #60536 (Traits Segfault) <?php trait T { private $x = 0; } class X { - use T; + use T; } class Y extends X { - use T; - function __construct() { - return ++$this->x; + use T; + function __construct() { + return ++$this->x; } } class Z extends Y { - function __construct() { - return ++$this->x; + function __construct() { + return ++$this->x; } } $a = new Z(); diff --git a/Zend/tests/bug60536_002.phpt b/Zend/tests/bug60536_002.phpt index 2701ac34cd..4d49caa28b 100644 --- a/Zend/tests/bug60536_002.phpt +++ b/Zend/tests/bug60536_002.phpt @@ -21,7 +21,7 @@ echo "POST-CLASS-GUARD\n"; // now we do the test for a fatal error class TraitsTest { - use THello1; + use THello1; public $hello; } diff --git a/Zend/tests/bug60569.phpt b/Zend/tests/bug60569.phpt Binary files differindex 56aaa2c602..480c9c8f8a 100644 --- a/Zend/tests/bug60569.phpt +++ b/Zend/tests/bug60569.phpt diff --git a/Zend/tests/bug60598.phpt b/Zend/tests/bug60598.phpt index 143ac79504..2db0402fa9 100644 --- a/Zend/tests/bug60598.phpt +++ b/Zend/tests/bug60598.phpt @@ -9,12 +9,12 @@ $containers = array(); class ObjectOne { protected $_guid = 0; public function __construct() { - global $containers; - $this->guid = 1; + global $containers; + $this->guid = 1; $containers[spl_object_hash($this)] = $this; } public function __destruct() { - global $containers; + global $containers; $containers[spl_object_hash($this)] = NULL; } } diff --git a/Zend/tests/bug60611.phpt b/Zend/tests/bug60611.phpt index abd04b0891..e90479f6ba 100644 --- a/Zend/tests/bug60611.phpt +++ b/Zend/tests/bug60611.phpt @@ -3,10 +3,10 @@ Bug #60611 (Segmentation fault with Cls::{expr}() syntax) --FILE-- <?php class Cls { - function __call($name, $arg) { - } - static function __callStatic($name, $arg) { - } + function __call($name, $arg) { + } + static function __callStatic($name, $arg) { + } } $cls = new Cls; diff --git a/Zend/tests/bug60825.phpt b/Zend/tests/bug60825.phpt index f2f5b602ad..c4c4975f9e 100644 --- a/Zend/tests/bug60825.phpt +++ b/Zend/tests/bug60825.phpt @@ -5,11 +5,11 @@ run this with valgrind --FILE-- <?php class test { - public static $x; - public function __toString() { - self::$x = $this; - return __FILE__; - } + public static $x; + public function __toString() { + self::$x = $this; + return __FILE__; + } } $a = new test; require_once $a; diff --git a/Zend/tests/bug60833.phpt b/Zend/tests/bug60833.phpt index fee6d01362..19cd2a4e53 100644 --- a/Zend/tests/bug60833.phpt +++ b/Zend/tests/bug60833.phpt @@ -3,21 +3,21 @@ Bug #60833 (self, parent, static behave inconsistently case-sensitive) --FILE-- <?php class A { - static $x = "A"; - function testit() { - $this->v1 = new sELF; - $this->v2 = new SELF; - } + static $x = "A"; + function testit() { + $this->v1 = new sELF; + $this->v2 = new SELF; + } } class B extends A { - static $x = "B"; - function testit() { - PARENT::testit(); - $this->v3 = new sELF; - $this->v4 = new PARENT; - $this->v4 = STATIC::$x; - } + static $x = "B"; + function testit() { + PARENT::testit(); + $this->v3 = new sELF; + $this->v4 = new PARENT; + $this->v4 = STATIC::$x; + } } $t = new B(); $t->testit(); diff --git a/Zend/tests/bug61011.phpt b/Zend/tests/bug61011.phpt index b9088c68f1..53fd7a2fbc 100644 --- a/Zend/tests/bug61011.phpt +++ b/Zend/tests/bug61011.phpt @@ -3,33 +3,33 @@ Bug #61011 (Crash when an exception is thrown by autoloader accessing a static p --FILE-- <?php spl_autoload_register(function ($name) { - throw new Exception($name); + throw new Exception($name); }); try { - echo AAA::$a; //zend_fetch_var_address_helper + echo AAA::$a; //zend_fetch_var_address_helper } catch (Exception $e) { - try { - echo AAA::XXX; //ZEND_FETCH_CONSTANT - } catch (Exception $e) { - try { - echo AAA::foo(); //ZEND_INIT_STATIC_METHOD_CALL - } catch (Exception $e) { - try { - unset(AAA::$a); // ZEND_UNSET_VAR - } catch (Exception $e){ - try { - isset(AAAA::$a); // ZEND_ISSET_ISEMPTY_VAR - } catch (Exception $e) { - try { - $a = array("AAA", "foo"); - $a(); //ZEND_INIT_FCALL_BY_NAME - } catch (Exception $e) { - } - } - } - } - } + try { + echo AAA::XXX; //ZEND_FETCH_CONSTANT + } catch (Exception $e) { + try { + echo AAA::foo(); //ZEND_INIT_STATIC_METHOD_CALL + } catch (Exception $e) { + try { + unset(AAA::$a); // ZEND_UNSET_VAR + } catch (Exception $e){ + try { + isset(AAAA::$a); // ZEND_ISSET_ISEMPTY_VAR + } catch (Exception $e) { + try { + $a = array("AAA", "foo"); + $a(); //ZEND_INIT_FCALL_BY_NAME + } catch (Exception $e) { + } + } + } + } + } } echo 'okey'; --EXPECT-- diff --git a/Zend/tests/bug61165.phpt b/Zend/tests/bug61165.phpt index 900a7a8d2b..68f6797ccf 100644 --- a/Zend/tests/bug61165.phpt +++ b/Zend/tests/bug61165.phpt @@ -8,8 +8,8 @@ class T { public $_this; public function __toString() { - global $handler; - $handler = $this; + global $handler; + $handler = $this; $this->_this = $this; // <-- uncomment this return 'A'; } @@ -18,7 +18,7 @@ class T { $t = new T; for ($i = 0; $i < 3; $i++) { strip_tags($t); - strip_tags(new T); + strip_tags(new T); } var_dump($handler); --EXPECTF-- diff --git a/Zend/tests/bug61362.phpt b/Zend/tests/bug61362.phpt index af216b566f..ac9e976f3f 100644 --- a/Zend/tests/bug61362.phpt +++ b/Zend/tests/bug61362.phpt @@ -3,15 +3,15 @@ Bug #61362 (Exception::getTraceAsString, Exception::__toString not able to handl --FILE-- <?php function test($arg){ - throw new Exception(); + throw new Exception(); } try { - test('теÑÑ‚'); + test('теÑÑ‚'); } catch(Exception $e) { - echo $e->getTraceAsString(), "\n"; - echo (string)$e; + echo $e->getTraceAsString(), "\n"; + echo (string)$e; } ?> --EXPECTF-- diff --git a/Zend/tests/bug62097.phpt b/Zend/tests/bug62097.phpt index 07e93bfa88..dda3b34a26 100644 --- a/Zend/tests/bug62097.phpt +++ b/Zend/tests/bug62097.phpt @@ -7,9 +7,9 @@ if (PHP_INT_MAX !== 2147483647) --FILE-- <?php var_dump("02147483647" == "2147483647", - "02147483648" == "2147483648", - "09007199254740991" == "9007199254740991", - "09007199254740992" == "9007199254740992"); + "02147483648" == "2147483648", + "09007199254740991" == "9007199254740991", + "09007199254740992" == "9007199254740992"); --EXPECT-- bool(true) bool(true) diff --git a/Zend/tests/bug62956.phpt b/Zend/tests/bug62956.phpt index fab180b4c3..803a2f7d6e 100644 --- a/Zend/tests/bug62956.phpt +++ b/Zend/tests/bug62956.phpt @@ -4,14 +4,14 @@ Bug #62956: "incompatible" signatures for private methods should not cause E_WAR <?php class Base { - private function test() - {} + private function test() + {} } class Extension extends Base { - private function test($arg) - {} + private function test($arg) + {} } ?> diff --git a/Zend/tests/bug63111.phpt b/Zend/tests/bug63111.phpt index 077e350bc2..2b06d3583a 100644 --- a/Zend/tests/bug63111.phpt +++ b/Zend/tests/bug63111.phpt @@ -9,9 +9,9 @@ interface MyInterface { static function bar(); } abstract class Bar { - static function foo() { - echo "ok\n"; - } + static function foo() { + echo "ok\n"; + } } var_dump(is_callable(array("Foo", "bar"))); var_dump(is_callable("Foo::bar")); diff --git a/Zend/tests/bug63462.phpt b/Zend/tests/bug63462.phpt index bcc2c67997..03182224ef 100644 --- a/Zend/tests/bug63462.phpt +++ b/Zend/tests/bug63462.phpt @@ -5,32 +5,32 @@ Marco Pivetta <ocramius@gmail.com> --FILE-- <?php class Test { - public $publicProperty; - protected $protectedProperty; - private $privateProperty; + public $publicProperty; + protected $protectedProperty; + private $privateProperty; - public function __construct() { - unset( - $this->publicProperty, - $this->protectedProperty, - $this->privateProperty - ); - } + public function __construct() { + unset( + $this->publicProperty, + $this->protectedProperty, + $this->privateProperty + ); + } - function __get($name) { - echo '__get ' . $name . "\n"; - return $this->$name; - } + function __get($name) { + echo '__get ' . $name . "\n"; + return $this->$name; + } - function __set($name, $value) { - echo '__set ' . $name . "\n"; - $this->$name = $value; - } + function __set($name, $value) { + echo '__set ' . $name . "\n"; + $this->$name = $value; + } - function __isset($name) { - echo '__isset ' . $name . "\n"; - return isset($this->$name); - } + function __isset($name) { + echo '__isset ' . $name . "\n"; + return isset($this->$name); + } } $test = new Test(); diff --git a/Zend/tests/bug63468.phpt b/Zend/tests/bug63468.phpt index 02c3c06c17..ca66c4caed 100644 --- a/Zend/tests/bug63468.phpt +++ b/Zend/tests/bug63468.phpt @@ -4,23 +4,23 @@ Bug #63468 (wrong called method as callback with inheritance) <?php class Foo { - public function run() - { - return call_user_func(array('Bar', 'getValue')); - } + public function run() + { + return call_user_func(array('Bar', 'getValue')); + } - private static function getValue() - { - return 'Foo'; - } + private static function getValue() + { + return 'Foo'; + } } class Bar extends Foo { - public static function getValue() - { - return 'Bar'; - } + public static function getValue() + { + return 'Bar'; + } } $x = new Bar; diff --git a/Zend/tests/bug63635.phpt b/Zend/tests/bug63635.phpt index 035588b295..df3afef178 100644 --- a/Zend/tests/bug63635.phpt +++ b/Zend/tests/bug63635.phpt @@ -3,35 +3,35 @@ Bug #63635 (Segfault in gc_collect_cycles) --FILE-- <?php class Node { - public $parent = NULL; - public $children = array(); + public $parent = NULL; + public $children = array(); - function __construct(Node $parent=NULL) { - if ($parent) { - $parent->children[] = $this; - } - $this->children[] = $this; - } + function __construct(Node $parent=NULL) { + if ($parent) { + $parent->children[] = $this; + } + $this->children[] = $this; + } - function __destruct() { - $this->children = NULL; - } + function __destruct() { + $this->children = NULL; + } } define("MAX", 16); for ($n = 0; $n < 20; $n++) { - $top = new Node(); - for ($i=0 ; $i<MAX ; $i++) { - $ci = new Node($top); - for ($j=0 ; $j<MAX ; $j++) { - $cj = new Node($ci); - for ($k=0 ; $k<MAX ; $k++) { - $ck = new Node($cj); - } - } - } - echo "$n\n"; + $top = new Node(); + for ($i=0 ; $i<MAX ; $i++) { + $ci = new Node($top); + for ($j=0 ; $j<MAX ; $j++) { + $cj = new Node($ci); + for ($k=0 ; $k<MAX ; $k++) { + $ck = new Node($cj); + } + } + } + echo "$n\n"; } echo "ok\n"; --EXPECT-- diff --git a/Zend/tests/bug64239_1.phpt b/Zend/tests/bug64239_1.phpt index 10d44c1817..aa20578b89 100644 --- a/Zend/tests/bug64239_1.phpt +++ b/Zend/tests/bug64239_1.phpt @@ -3,15 +3,15 @@ Bug #64239 (get_class_methods() changed behavior) --FILE-- <?php class A { - use T2 { t2method as Bmethod; } + use T2 { t2method as Bmethod; } } class B extends A { } trait T2 { - public function t2method() { - } + public function t2method() { + } } print_r(get_class_methods("A")); print_r(get_class_methods("B")); diff --git a/Zend/tests/bug64239_2.phpt b/Zend/tests/bug64239_2.phpt index 26cf8ee1af..1a96de8b52 100644 --- a/Zend/tests/bug64239_2.phpt +++ b/Zend/tests/bug64239_2.phpt @@ -3,27 +3,27 @@ Bug #64239 (debug_backtrace() changed behavior) --FILE-- <?php class A { - use T1; - public function test() { $this->backtrace(); } + use T1; + public function test() { $this->backtrace(); } } class B { - use T2 { t2method as Bmethod; } + use T2 { t2method as Bmethod; } } class C extends A { } trait T1 { - protected function backtrace() { - $b = new B(); - $b->Bmethod(); - } + protected function backtrace() { + $b = new B(); + $b->Bmethod(); + } } trait T2 { - public function t2method() { - print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)); - } + public function t2method() { + print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)); + } } $a = new A(); $a->test(); diff --git a/Zend/tests/bug64239_3.phpt b/Zend/tests/bug64239_3.phpt index 15faeb9852..1a7da60e3c 100644 --- a/Zend/tests/bug64239_3.phpt +++ b/Zend/tests/bug64239_3.phpt @@ -3,19 +3,19 @@ Bug #64239 (debug_print_backtrace() changed behavior) --FILE-- <?php class A { - use T2 { t2method as Bmethod; } + use T2 { t2method as Bmethod; } } class C extends A { - public function Bmethod() { - debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); + public function Bmethod() { + debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); } } trait T2 { - public function t2method() { - debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); - } + public function t2method() { + debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); + } } $a = new A(); diff --git a/Zend/tests/bug64239_4.phpt b/Zend/tests/bug64239_4.phpt index 7ab761ef72..8204a5b843 100644 --- a/Zend/tests/bug64239_4.phpt +++ b/Zend/tests/bug64239_4.phpt @@ -3,19 +3,19 @@ Bug #64239 (debug_print_backtrace() changed behavior) --FILE-- <?php class A { - use T2 { t2method as Bmethod; } + use T2 { t2method as Bmethod; } } class C extends A { - public static function Bmethod() { - debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); + public static function Bmethod() { + debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); } } trait T2 { - public static function t2method() { - debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); - } + public static function t2method() { + debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); + } } A::Bmethod(); diff --git a/Zend/tests/bug64417.phpt b/Zend/tests/bug64417.phpt index 9b192f31b5..c81caf72dc 100644 --- a/Zend/tests/bug64417.phpt +++ b/Zend/tests/bug64417.phpt @@ -18,7 +18,7 @@ trait aa { unset($this->container[$offset]); } public function &offsetGet($offset) { - $result = null; + $result = null; if (isset($this->container[$offset])) { $result = &$this->container[$offset]; } diff --git a/Zend/tests/bug64515.phpt b/Zend/tests/bug64515.phpt index b101c17c3a..aeb2cd1564 100644 --- a/Zend/tests/bug64515.phpt +++ b/Zend/tests/bug64515.phpt @@ -3,7 +3,7 @@ Bug #64515 (Memoryleak when using the same variablename 2times in function decla --FILE-- <?php function foo($unused = null, $unused = null, $arg = array()) { - return 1; + return 1; } foo(); echo "okey"; diff --git a/Zend/tests/bug64677.phpt b/Zend/tests/bug64677.phpt index 44a7c5fc6f..2dcd00ce0a 100644 --- a/Zend/tests/bug64677.phpt +++ b/Zend/tests/bug64677.phpt @@ -3,8 +3,8 @@ Bug #64677 (execution operator `` stealing surrounding arguments) --FILE-- <?PHP class cat { - public function show_output($prepend, $output = '') { - } + public function show_output($prepend, $output = '') { + } } $cat = new cat(); $cat->show_output('Files: ', trim(`cd .`)); // this gives invalid args to shell_exec @@ -12,7 +12,7 @@ $cat->show_output('Files: ', `cd .`); // this causes a segmentation fault $cat->show_output(`cd .`); // this causes a segmentation fault function show_outputa($prepend, $output) { - echo "Okey"; + echo "Okey"; } show_outputa('Files: ', `cd .`); // this works as expected diff --git a/Zend/tests/bug64821.1.phpt b/Zend/tests/bug64821.1.phpt index 39bec77a45..52713e2211 100644 --- a/Zend/tests/bug64821.1.phpt +++ b/Zend/tests/bug64821.1.phpt @@ -4,12 +4,12 @@ Bug #64821 Custom Exceptions crash when internal properties overridden (variatio <?php class a extends exception { - public function __construct() { - $this->message = NULL; - $this->string = NULL; - $this->code = array(); - $this->line = "hello"; - } + public function __construct() { + $this->message = NULL; + $this->string = NULL; + $this->code = array(); + $this->line = "hello"; + } } throw new a; diff --git a/Zend/tests/bug64821.2.phpt b/Zend/tests/bug64821.2.phpt index 5650c48872..cac0a948f9 100644 --- a/Zend/tests/bug64821.2.phpt +++ b/Zend/tests/bug64821.2.phpt @@ -4,9 +4,9 @@ Bug #64821 Custom Exceptions crash when internal properties overridden (variatio <?php class a extends exception { - public function __construct() { - $this->line = array(); - } + public function __construct() { + $this->line = array(); + } } throw new a; diff --git a/Zend/tests/bug64821.3.phpt b/Zend/tests/bug64821.3.phpt index 831665e364..d94f1ba361 100644 --- a/Zend/tests/bug64821.3.phpt +++ b/Zend/tests/bug64821.3.phpt @@ -4,10 +4,10 @@ Bug #64821 Custom Exceptions crash when internal properties overridden (variatio <?php class a extends exception { - public function __construct() { - $this->line = array(); - $this->file = NULL; - } + public function __construct() { + $this->line = array(); + $this->file = NULL; + } } throw new a; diff --git a/Zend/tests/bug64896.phpt b/Zend/tests/bug64896.phpt index 59c59b7fe2..cae45e3b2e 100644 --- a/Zend/tests/bug64896.phpt +++ b/Zend/tests/bug64896.phpt @@ -7,18 +7,18 @@ zend.enable_gc=1 $bar = NULL; class bad { - private $_private = array(); + private $_private = array(); - public function __construct() - { - $this->_private[] = 'php'; - } + public function __construct() + { + $this->_private[] = 'php'; + } - public function __destruct() - { - global $bar; - $bar = $this; - } + public function __destruct() + { + global $bar; + $bar = $this; + } } $foo = new stdclass; diff --git a/Zend/tests/bug64960.phpt b/Zend/tests/bug64960.phpt index 3c1d38ad9e..360b5bf722 100644 --- a/Zend/tests/bug64960.phpt +++ b/Zend/tests/bug64960.phpt @@ -6,11 +6,11 @@ Bug #64960 (Segfault in gc_zval_possible_root) ob_end_flush(); class ExceptionHandler { - public function __invoke (Exception $e) - { - // this triggers the custom error handler - ob_end_clean(); - } + public function __invoke (Exception $e) + { + // this triggers the custom error handler + ob_end_clean(); + } } // this must be a class, closure does not trigger segfault @@ -19,10 +19,10 @@ set_exception_handler(new ExceptionHandler()); // exception must be thrown from error handler. set_error_handler(function() { - $e = new Exception; - $e->_trace = debug_backtrace(); + $e = new Exception; + $e->_trace = debug_backtrace(); - throw $e; + throw $e; }); // trigger error handler diff --git a/Zend/tests/bug64966.phpt b/Zend/tests/bug64966.phpt index 329503e5af..0d610ce2ff 100644 --- a/Zend/tests/bug64966.phpt +++ b/Zend/tests/bug64966.phpt @@ -3,18 +3,18 @@ Bug #64966 (segfault in zend_do_fcall_common_helper_SPEC) --FILE-- <?php function test($func) { - try { - $a = $func(""); - } catch (Error $e) { - throw new Exception(); - } - return true; + try { + $a = $func(""); + } catch (Error $e) { + throw new Exception(); + } + return true; } class A { - public function b() { - test("strlen"); - test("iterator_apply"); - } + public function b() { + test("strlen"); + test("iterator_apply"); + } } $a = new A(); diff --git a/Zend/tests/bug64988.phpt b/Zend/tests/bug64988.phpt index 7e2289f5b2..490c47194b 100644 --- a/Zend/tests/bug64988.phpt +++ b/Zend/tests/bug64988.phpt @@ -3,23 +3,23 @@ Bug #64988 (Class loading order affects E_WARNING warning) --FILE-- <?php abstract class Base1 { - public function insert(array $data){ - return array_reverse($data); - } + public function insert(array $data){ + return array_reverse($data); + } } class Noisy1 extends Base1 { - public function insert(array $data, $option1 = Null) { - if (!empty($option1)) { - $data['option1'] = $option1; - } - return parent::insert($data); - } + public function insert(array $data, $option1 = Null) { + if (!empty($option1)) { + $data['option1'] = $option1; + } + return parent::insert($data); + } } class Smooth1 extends Noisy1 { - public function insert(array $data) { - return parent::insert($data, count($data)); - } + public function insert(array $data) { + return parent::insert($data, count($data)); + } } $o = new Smooth1(); diff --git a/Zend/tests/bug65108.phpt b/Zend/tests/bug65108.phpt index 23e1e856d7..55c6b8c5b3 100644 --- a/Zend/tests/bug65108.phpt +++ b/Zend/tests/bug65108.phpt @@ -3,15 +3,15 @@ Bug #65108 (is_callable() triggers Fatal Error) --FILE-- <?php class C { - private function f() {} - static function __callStatic($name, $args) {} + private function f() {} + static function __callStatic($name, $args) {} } class B { - public function __construct() { - $isCallable = is_callable(array(new C, 'f')); - var_dump($isCallable); - } + public function __construct() { + $isCallable = is_callable(array(new C, 'f')); + var_dump($isCallable); + } } new B(); diff --git a/Zend/tests/bug65291.phpt b/Zend/tests/bug65291.phpt index 7bc76331c0..c02e8d6409 100644 --- a/Zend/tests/bug65291.phpt +++ b/Zend/tests/bug65291.phpt @@ -5,14 +5,14 @@ Bug #65291 - get_defined_constants() causes PHP to crash in a very limited case. trait TestTrait { - public static function testStaticFunction() - { - return __CLASS__; - } + public static function testStaticFunction() + { + return __CLASS__; + } } class Tester { - use TestTrait; + use TestTrait; } $foo = Tester::testStaticFunction(); diff --git a/Zend/tests/bug65784.phpt b/Zend/tests/bug65784.phpt index 43369e2d60..8982048e12 100644 --- a/Zend/tests/bug65784.phpt +++ b/Zend/tests/bug65784.phpt @@ -3,53 +3,53 @@ Fixed Bug #65784 (Segfault with finally) --FILE-- <?php function foo1() { - try { - throw new Exception("not catch"); - return true; - } finally { - try { - throw new Exception("caught"); - } catch (Exception $e) { - } - } + try { + throw new Exception("not catch"); + return true; + } finally { + try { + throw new Exception("caught"); + } catch (Exception $e) { + } + } } try { - $foo = foo1(); - var_dump($foo); + $foo = foo1(); + var_dump($foo); } catch (Exception $e) { - do { - var_dump($e->getMessage()); - } while ($e = $e->getPrevious()); + do { + var_dump($e->getMessage()); + } while ($e = $e->getPrevious()); } function foo2() { - try { - try { - throw new Exception("caught"); - return true; - } finally { - try { - throw new Exception("caught"); - } catch (Exception $e) { - } - } - } catch (Exception $e) { - } + try { + try { + throw new Exception("caught"); + return true; + } finally { + try { + throw new Exception("caught"); + } catch (Exception $e) { + } + } + } catch (Exception $e) { + } } $foo = foo2(); var_dump($foo); function foo3() { - try { - throw new Exception("not caught"); - return true; - } finally { - try { - throw new NotExists(); - } catch (Exception $e) { - } - } + try { + throw new Exception("not caught"); + return true; + } finally { + try { + throw new NotExists(); + } catch (Exception $e) { + } + } } $bar = foo3(); diff --git a/Zend/tests/bug65911.phpt b/Zend/tests/bug65911.phpt index 753c8c6c7d..b9d973eb45 100644 --- a/Zend/tests/bug65911.phpt +++ b/Zend/tests/bug65911.phpt @@ -6,11 +6,11 @@ class A {} class B { - public function go() - { - $this->foo = 'bar'; - echo A::$this->foo; // should not output 'bar' - } + public function go() + { + $this->foo = 'bar'; + echo A::$this->foo; // should not output 'bar' + } } $obj = new B(); diff --git a/Zend/tests/bug66218.phpt b/Zend/tests/bug66218.phpt index db3c7c655a..5809af741e 100644 --- a/Zend/tests/bug66218.phpt +++ b/Zend/tests/bug66218.phpt @@ -9,9 +9,9 @@ if (!function_exists("dl")) die("skip need dl"); $tab = get_extension_funcs("standard"); $fcts = array("dl"); foreach ($fcts as $fct) { - if (in_array($fct, $tab)) { - echo "$fct Ok\n"; - } + if (in_array($fct, $tab)) { + echo "$fct Ok\n"; + } } ?> Done diff --git a/Zend/tests/bug66252.phpt b/Zend/tests/bug66252.phpt index 93f6253a55..8b5919801e 100644 --- a/Zend/tests/bug66252.phpt +++ b/Zend/tests/bug66252.phpt @@ -3,10 +3,10 @@ Bug #66252 (Problems in AST evaluation invalidating valid parent:: reference) --FILE-- <?php class A { - const HW = "this is A"; + const HW = "this is A"; } class B extends A { - const BHW = parent::HW . " extended by B"; + const BHW = parent::HW . " extended by B"; } const C = B::BHW; echo C, "\n"; diff --git a/Zend/tests/bug66608.phpt b/Zend/tests/bug66608.phpt index 5a499a1dab..b4e761ddc4 100644 --- a/Zend/tests/bug66608.phpt +++ b/Zend/tests/bug66608.phpt @@ -3,58 +3,58 @@ Bug #66608 (Incorrect behavior with nested "finally" blocks) --FILE-- <?php function bar() { - try { - echo "1\n"; - try { - } finally { - try { - } finally { - } - echo "2\n"; - } - } finally { - try { - throw new Exception (""); - } catch (Exception $ab) { - echo "3\n"; - } finally { - try { - } finally { - echo "4\n"; - try { - } finally { - } - echo "5\n"; - } - } - echo "6\n"; - try { - } finally { - while (1) { - try { - echo "7\n"; - break; - } finally { - echo "8\n"; - } - echo "bad"; - } - echo "9\n"; - while (1) { - try { - throw new Exception(""); - } catch(Exception $e) { - echo "10\n"; - break; - } finally { - echo "11\n"; - } - echo "bak\n"; - } - } - echo "12\n"; - } - echo "13\n"; + try { + echo "1\n"; + try { + } finally { + try { + } finally { + } + echo "2\n"; + } + } finally { + try { + throw new Exception (""); + } catch (Exception $ab) { + echo "3\n"; + } finally { + try { + } finally { + echo "4\n"; + try { + } finally { + } + echo "5\n"; + } + } + echo "6\n"; + try { + } finally { + while (1) { + try { + echo "7\n"; + break; + } finally { + echo "8\n"; + } + echo "bad"; + } + echo "9\n"; + while (1) { + try { + throw new Exception(""); + } catch(Exception $e) { + echo "10\n"; + break; + } finally { + echo "11\n"; + } + echo "bak\n"; + } + } + echo "12\n"; + } + echo "13\n"; } bar(); --EXPECT-- diff --git a/Zend/tests/bug66609.phpt b/Zend/tests/bug66609.phpt index 880f5a58a4..f8c0d9ce67 100644 --- a/Zend/tests/bug66609.phpt +++ b/Zend/tests/bug66609.phpt @@ -5,16 +5,16 @@ Bug #66609 (php crashes with __get() and ++ operator in some cases) $bar = new Bar; $foo = new Foo; class Bar { - public function __get($x) { - global $foo; - return $foo->foo; - } + public function __get($x) { + global $foo; + return $foo->foo; + } } class Foo { - public function __get($x) { - global $bar; - return $bar->bar; - } + public function __get($x) { + global $bar; + return $bar->bar; + } } $foo->blah += 1; //crash ++$foo->blah; //crash diff --git a/Zend/tests/bug67368.phpt b/Zend/tests/bug67368.phpt index b3aff293a0..39d8bd30d6 100644 --- a/Zend/tests/bug67368.phpt +++ b/Zend/tests/bug67368.phpt @@ -5,7 +5,7 @@ report_memleaks=1 --FILE-- <?php class FooBar { - const bar = ["bar" => 3]["bar"]; + const bar = ["bar" => 3]["bar"]; } echo "okey"; --EXPECT-- diff --git a/Zend/tests/bug67436/a.inc b/Zend/tests/bug67436/a.inc index c560c2db7d..f49556c84d 100644 --- a/Zend/tests/bug67436/a.inc +++ b/Zend/tests/bug67436/a.inc @@ -1,10 +1,10 @@ <?php class a { - public function test($arg = c::TESTCONSTANT) { - echo __METHOD__ . "($arg)\n"; - } + public function test($arg = c::TESTCONSTANT) { + echo __METHOD__ . "($arg)\n"; + } - static public function staticTest() { - } + static public function staticTest() { + } } diff --git a/Zend/tests/bug67436/b.inc b/Zend/tests/bug67436/b.inc index bb2521f61f..86817825f6 100644 --- a/Zend/tests/bug67436/b.inc +++ b/Zend/tests/bug67436/b.inc @@ -1,10 +1,10 @@ <?php class b extends a { - private function __invoke() {} + private function __invoke() {} - public function test($arg = c::TESTCONSTANT) { - echo __METHOD__ . "()\n"; - parent::test(); - } + public function test($arg = c::TESTCONSTANT) { + echo __METHOD__ . "()\n"; + parent::test(); + } } diff --git a/Zend/tests/bug67436/bug67436.phpt b/Zend/tests/bug67436/bug67436.phpt index 14db266831..0d8ec87006 100644 --- a/Zend/tests/bug67436/bug67436.phpt +++ b/Zend/tests/bug67436/bug67436.phpt @@ -8,9 +8,9 @@ error_reporting=-1 <?php spl_autoload_register(function($classname) { - if (in_array($classname, array('a','b','c'))) { - require_once __DIR__ . "/{$classname}.inc"; - } + if (in_array($classname, array('a','b','c'))) { + require_once __DIR__ . "/{$classname}.inc"; + } }); set_error_handler(function ($errno, $errstr, $errfile, $errline) { diff --git a/Zend/tests/bug67436/bug67436_nohandler.phpt b/Zend/tests/bug67436/bug67436_nohandler.phpt index 5394177064..64c7f70642 100644 --- a/Zend/tests/bug67436/bug67436_nohandler.phpt +++ b/Zend/tests/bug67436/bug67436_nohandler.phpt @@ -4,9 +4,9 @@ bug67436: E_WARNING instead of custom error handler <?php spl_autoload_register(function($classname) { - if (in_array($classname, array('a','b','c'))) { - require_once __DIR__ . "/{$classname}.inc"; - } + if (in_array($classname, array('a','b','c'))) { + require_once __DIR__ . "/{$classname}.inc"; + } }); a::staticTest(); diff --git a/Zend/tests/bug67436/c.inc b/Zend/tests/bug67436/c.inc index 47c848bfa0..368e2b1f85 100644 --- a/Zend/tests/bug67436/c.inc +++ b/Zend/tests/bug67436/c.inc @@ -1,5 +1,5 @@ <?php class c { - const TESTCONSTANT = "c::TESTCONSTANT"; + const TESTCONSTANT = "c::TESTCONSTANT"; } diff --git a/Zend/tests/bug67922.phpt b/Zend/tests/bug67922.phpt index 8be3f2eba0..c6ca10d8b6 100644 --- a/Zend/tests/bug67922.phpt +++ b/Zend/tests/bug67922.phpt @@ -4,9 +4,9 @@ Bug #67922: Member function not found when dereferencing in write-context <?php class C { - public function test() { - return new stdClass; - } + public function test() { + return new stdClass; + } } $b = new stdClass; diff --git a/Zend/tests/bug68215.phpt b/Zend/tests/bug68215.phpt index c4e8da8515..0a18ef64ce 100644 --- a/Zend/tests/bug68215.phpt +++ b/Zend/tests/bug68215.phpt @@ -3,53 +3,53 @@ Bug #68215 (Behavior of foreach has changed) --FILE-- <?php $arr = array( - 'a' => array( - 'a' => 'apple', - 'b' => 'banana', - 'c' => 'cranberry', - 'd' => 'mango', - 'e' => 'pineapple' - ), - 'b' => array( - 'a' => 'apple', - 'b' => 'banana', - 'c' => 'cranberry', - 'd' => 'mango', - 'e' => 'pineapple' - ), - 'c' => 'cranberry', - 'd' => 'mango', - 'e' => 'pineapple' + 'a' => array( + 'a' => 'apple', + 'b' => 'banana', + 'c' => 'cranberry', + 'd' => 'mango', + 'e' => 'pineapple' + ), + 'b' => array( + 'a' => 'apple', + 'b' => 'banana', + 'c' => 'cranberry', + 'd' => 'mango', + 'e' => 'pineapple' + ), + 'c' => 'cranberry', + 'd' => 'mango', + 'e' => 'pineapple' ); function test(&$child, $entry) { - $i = 1; + $i = 1; - foreach ($child AS $key => $fruit) - { - if (!is_numeric($key)) - { - $child[$i] = $fruit; - unset($child[$key]); - $i++; - } - } + foreach ($child AS $key => $fruit) + { + if (!is_numeric($key)) + { + $child[$i] = $fruit; + unset($child[$key]); + $i++; + } + } } $i = 1; foreach ($arr AS $key => $fruit) { - $arr[$i] = $fruit; + $arr[$i] = $fruit; - if (is_array($fruit)) - { - test($arr[$i], $fruit); - } + if (is_array($fruit)) + { + test($arr[$i], $fruit); + } - unset($arr[$key]); - $i++; + unset($arr[$key]); + $i++; } var_dump($arr); diff --git a/Zend/tests/bug68370.phpt b/Zend/tests/bug68370.phpt index 73411ca9b9..b480bffab5 100644 --- a/Zend/tests/bug68370.phpt +++ b/Zend/tests/bug68370.phpt @@ -3,10 +3,10 @@ Bug #68370 "unset($this)" can make the program crash --FILE-- <?php class C { - public function test() { - unset($this); - return get_defined_vars(); - } + public function test() { + unset($this); + return get_defined_vars(); + } } $c = new C(); $x = $c->test(); diff --git a/Zend/tests/bug68446.phpt b/Zend/tests/bug68446.phpt index 91685ebb5e..1f682af9aa 100644 --- a/Zend/tests/bug68446.phpt +++ b/Zend/tests/bug68446.phpt @@ -6,11 +6,11 @@ const FOO = [1]; const BAR = null; function a(array $a = FOO) { - var_dump($a); + var_dump($a); } function b(?array $b = BAR) { - var_dump($b); + var_dump($b); } b(null); diff --git a/Zend/tests/bug68896.phpt b/Zend/tests/bug68896.phpt index 31823a2873..988e98e31e 100644 --- a/Zend/tests/bug68896.phpt +++ b/Zend/tests/bug68896.phpt @@ -3,10 +3,10 @@ Bug #68896 (Changing ArrayObject value cause Segment Fault) --FILE-- <?php class A implements ArrayAccess { - private $a = []; - function offsetGet($offset) { - return $this->a[$offset]; - } + private $a = []; + function offsetGet($offset) { + return $this->a[$offset]; + } function offsetSet($offset, $value) { $this->a[$offset] = $value; } diff --git a/Zend/tests/bug69017.phpt b/Zend/tests/bug69017.phpt index d6d20d7c08..d1608ebbf9 100644 --- a/Zend/tests/bug69017.phpt +++ b/Zend/tests/bug69017.phpt @@ -5,12 +5,12 @@ class c1 { - const ZERO = 0; - const ONE = 1; - const MAX = PHP_INT_MAX; - public static $a1 = array(self::ONE => 'one'); - public static $a2 = array(self::ZERO => 'zero'); - public static $a3 = array(self::MAX => 'zero'); + const ZERO = 0; + const ONE = 1; + const MAX = PHP_INT_MAX; + public static $a1 = array(self::ONE => 'one'); + public static $a2 = array(self::ZERO => 'zero'); + public static $a3 = array(self::MAX => 'zero'); } diff --git a/Zend/tests/bug69025.phpt b/Zend/tests/bug69025.phpt index 389c09f75f..8cb5f878f2 100644 --- a/Zend/tests/bug69025.phpt +++ b/Zend/tests/bug69025.phpt @@ -3,9 +3,9 @@ Bug #69025 (Invalid read of size 4 when calling __callStatic) --FILE-- <?php class A { - public static function __callStatic($method, $args) - { - } + public static function __callStatic($method, $args) + { + } } A::init(); diff --git a/Zend/tests/bug69092.2.phpt b/Zend/tests/bug69092.2.phpt index d19116c598..f774820056 100644 --- a/Zend/tests/bug69092.2.phpt +++ b/Zend/tests/bug69092.2.phpt @@ -7,7 +7,7 @@ zend.multibyte=0 echo "Hi"; function foo() { - declare(encoding="UTF-8"); + declare(encoding="UTF-8"); } echo "Bye" diff --git a/Zend/tests/bug69092.phpt b/Zend/tests/bug69092.phpt index d80954b16f..f1863ccc6b 100644 --- a/Zend/tests/bug69092.phpt +++ b/Zend/tests/bug69092.phpt @@ -13,7 +13,7 @@ zend.multibyte=On echo "Hi"; function foo() { - declare(encoding="utf-8"); + declare(encoding="utf-8"); } echo "Bye" diff --git a/Zend/tests/bug69124.phpt b/Zend/tests/bug69124.phpt index 1959332fbf..c704a49b3e 100644 --- a/Zend/tests/bug69124.phpt +++ b/Zend/tests/bug69124.phpt @@ -3,13 +3,13 @@ Bug 69124: Method name must be as string (invalid error message when using refer --FILE-- <?php class Foo { - public function bar() { - print "Success\n"; - } + public function bar() { + print "Success\n"; + } } function test(&$instance, &$method) { - $instance->{$method}(); + $instance->{$method}(); } $instance = new Foo; diff --git a/Zend/tests/bug69167.phpt b/Zend/tests/bug69167.phpt index cae3528406..d75f0500fc 100644 --- a/Zend/tests/bug69167.phpt +++ b/Zend/tests/bug69167.phpt @@ -3,7 +3,7 @@ Bug #69167 (call_user_func does not support references anymore) --FILE-- <?php function l($m) { - echo $m . "\n"; + echo $m . "\n"; } $cb = 'l'; diff --git a/Zend/tests/bug69174.phpt b/Zend/tests/bug69174.phpt index eec0957470..8c77cb2563 100644 --- a/Zend/tests/bug69174.phpt +++ b/Zend/tests/bug69174.phpt @@ -3,12 +3,12 @@ Bug #69174 (leaks when unused inner class use traits precedence) --FILE-- <?php function test() { - class C1 { - use T1, T2 { - T1::foo insteadof T2; - T1::bar insteadof T2; - } - } + class C1 { + use T1, T2 { + T1::foo insteadof T2; + T1::bar insteadof T2; + } + } } ?> ==DONE== diff --git a/Zend/tests/bug69201.phpt b/Zend/tests/bug69201.phpt index 7e2944c49f..7a70912cf0 100644 --- a/Zend/tests/bug69201.phpt +++ b/Zend/tests/bug69201.phpt @@ -5,17 +5,17 @@ Bug #69201 (Memory leak using iterator and get by reference on PHP 7) class Entity { - protected $_properties = []; + protected $_properties = []; - public function &__get($property) - { - $value = null; - return $value; - } + public function &__get($property) + { + $value = null; + return $value; + } - public function __set($property, $value) - { - } + public function __set($property, $value) + { + } } $e = new Entity; diff --git a/Zend/tests/bug69212.phpt b/Zend/tests/bug69212.phpt index 5f20faaf4e..418753c3d6 100644 --- a/Zend/tests/bug69212.phpt +++ b/Zend/tests/bug69212.phpt @@ -22,17 +22,17 @@ try { } try { - $f = function () {}; - $f->__invoke(do_throw()); + $f = function () {}; + $f->__invoke(do_throw()); } catch (Exception $e) { - echo "Caught!\n"; + echo "Caught!\n"; } try { - $t = new Test; - $f->__invoke($t->bar(Test::foo(do_throw()))); + $t = new Test; + $f->__invoke($t->bar(Test::foo(do_throw()))); } catch (Exception $e) { - echo "Caught!\n"; + echo "Caught!\n"; } ?> diff --git a/Zend/tests/bug69221.phpt b/Zend/tests/bug69221.phpt index 72f242f995..a681e5bb68 100644 --- a/Zend/tests/bug69221.phpt +++ b/Zend/tests/bug69221.phpt @@ -4,7 +4,7 @@ Bug #69221: Segmentation fault when using a generator in combination with an Ite <?php function gen() { - yield 1; + yield 1; }; $gen1 = gen(); diff --git a/Zend/tests/bug69388.phpt b/Zend/tests/bug69388.phpt index 3846cca4ca..c874db715d 100644 --- a/Zend/tests/bug69388.phpt +++ b/Zend/tests/bug69388.phpt @@ -4,10 +4,10 @@ Bug #69388: Use after free on recursive calls to PHP compiler <?php function handle_error($code, $message, $file, $line) { - if (!function_exists("bla")) { - eval('function bla($s) {echo "$s\n";}'); - } - bla($message); + if (!function_exists("bla")) { + eval('function bla($s) {echo "$s\n";}'); + } + bla($message); } set_error_handler('handle_error'); diff --git a/Zend/tests/bug69420.phpt b/Zend/tests/bug69420.phpt index 060d69c839..87f30fb474 100644 --- a/Zend/tests/bug69420.phpt +++ b/Zend/tests/bug69420.phpt @@ -4,22 +4,22 @@ Bug #69420 (Invalid read in zend_std_get_method) <?php trait T { - protected function test() { - echo "okey"; - } + protected function test() { + echo "okey"; + } } class A { - protected function test() { - } + protected function test() { + } } class B extends A { - use T; - public function foo() { - $this->test(); - } + use T; + public function foo() { + $this->test(); + } } diff --git a/Zend/tests/bug69427.phpt b/Zend/tests/bug69427.phpt index 6b739df961..e482fa85f3 100644 --- a/Zend/tests/bug69427.phpt +++ b/Zend/tests/bug69427.phpt @@ -9,15 +9,15 @@ class SubClass extends BaseClass abstract class BaseClass { - public function __call($name, $arguments) - { - return $this->$name(); - } + public function __call($name, $arguments) + { + return $this->$name(); + } - private function foobar() - { - return 'okey'; - } + private function foobar() + { + return 'okey'; + } } $test = new SubClass(); diff --git a/Zend/tests/bug69446.phpt b/Zend/tests/bug69446.phpt index 66595c170c..e68443b803 100644 --- a/Zend/tests/bug69446.phpt +++ b/Zend/tests/bug69446.phpt @@ -6,11 +6,11 @@ zend.enable_gc = 1 <?php $bar = NULL; class bad { - public function __destruct() { - global $bar; - $bar = $this; - $bar->y = new stdClass; - } + public function __destruct() { + global $bar; + $bar = $this; + $bar->y = new stdClass; + } } $foo = new stdClass; diff --git a/Zend/tests/bug69446_2.phpt b/Zend/tests/bug69446_2.phpt index b7c6e0e329..8ef2300e93 100644 --- a/Zend/tests/bug69446_2.phpt +++ b/Zend/tests/bug69446_2.phpt @@ -7,18 +7,18 @@ zend.enable_gc = 1 $bar = NULL; class bad { - public $_private = array(); + public $_private = array(); - public function __construct() - { - $this->_private[] = 'php'; - } + public function __construct() + { + $this->_private[] = 'php'; + } - public function __destruct() - { - global $bar; - $bar = $this; - } + public function __destruct() + { + global $bar; + $bar = $this; + } } $foo = new stdclass; diff --git a/Zend/tests/bug69676.phpt b/Zend/tests/bug69676.phpt index 54b9d40047..c18eb8f601 100644 --- a/Zend/tests/bug69676.phpt +++ b/Zend/tests/bug69676.phpt @@ -3,12 +3,12 @@ Bug #69676: Resolution of self::FOO in class constants not correct --FILE-- <?php class A { - const myConst = "const in A"; - const myDynConst = self::myConst; + const myConst = "const in A"; + const myDynConst = self::myConst; } class B extends A { - const myConst = "const in B"; + const myConst = "const in B"; } var_dump(B::myDynConst); diff --git a/Zend/tests/bug69732.phpt b/Zend/tests/bug69732.phpt index 578cb8d143..690318fbfa 100644 --- a/Zend/tests/bug69732.phpt +++ b/Zend/tests/bug69732.phpt @@ -11,7 +11,7 @@ class wpq { } function ret_assoc() { - $x = "XXX"; + $x = "XXX"; return array('foo' => 'bar', $x); } diff --git a/Zend/tests/bug69754.phpt b/Zend/tests/bug69754.phpt index be55ae2b78..d496b8913e 100644 --- a/Zend/tests/bug69754.phpt +++ b/Zend/tests/bug69754.phpt @@ -4,11 +4,11 @@ Bug #69754 (Use of ::class inside array causes compile error) <?php class Example { - public function test() { - var_dump(static::class); - var_dump(static::class . 'IsAwesome'); - var_dump(static::class . date('Ymd')); - var_dump([static::class]); + public function test() { + var_dump(static::class); + var_dump(static::class . 'IsAwesome'); + var_dump(static::class . date('Ymd')); + var_dump([static::class]); } } diff --git a/Zend/tests/bug69832.phpt b/Zend/tests/bug69832.phpt index 5ad88d94bc..503de16422 100644 --- a/Zend/tests/bug69832.phpt +++ b/Zend/tests/bug69832.phpt @@ -4,15 +4,15 @@ Bug #69832 (Assertion failed in zend_compile_const_expr_magic_const) <?php class Test { - public $foo = [Bar::A, __CLASS__][__CLASS__ != ""]; - public $bar = Bar::A && __CLASS__; - public $baz = Bar::A ?: __CLASS__; - public $buzz = Bar::A ? __CLASS__ : 0; + public $foo = [Bar::A, __CLASS__][__CLASS__ != ""]; + public $bar = Bar::A && __CLASS__; + public $baz = Bar::A ?: __CLASS__; + public $buzz = Bar::A ? __CLASS__ : 0; } eval(<<<'PHP' class Bar { - const A = 1; + const A = 1; } PHP ); diff --git a/Zend/tests/bug69871.phpt b/Zend/tests/bug69871.phpt index f77be25885..705d12e488 100644 --- a/Zend/tests/bug69871.phpt +++ b/Zend/tests/bug69871.phpt @@ -7,9 +7,9 @@ opcache.enable=0 $a = true; if (isset($a) && 0) { - var_dump(true); + var_dump(true); } else { - var_dump(false); + var_dump(false); } ?> diff --git a/Zend/tests/bug69957.phpt b/Zend/tests/bug69957.phpt index 01b024e778..188e56405b 100644 --- a/Zend/tests/bug69957.phpt +++ b/Zend/tests/bug69957.phpt @@ -4,59 +4,59 @@ Bug #69957 (Different ways of handling div/mod by zero) <?php try { - $divisor = 0; - $result = 1 / $divisor; - var_dump($result); + $divisor = 0; + $result = 1 / $divisor; + var_dump($result); } catch (DivisionByZeroError $t){ - echo "Variable div\n"; - printf("Type: %s\n", get_class($t)); - printf("Message: %s\n", $t->getMessage()); + echo "Variable div\n"; + printf("Type: %s\n", get_class($t)); + printf("Message: %s\n", $t->getMessage()); } try { - $divisor = 0; - $result = 1 % $divisor; - var_dump($result); + $divisor = 0; + $result = 1 % $divisor; + var_dump($result); } catch (DivisionByZeroError $t){ - echo "\nVariable mod\n"; - printf("Type: %s\n", get_class($t)); - printf("Message: %s\n", $t->getMessage()); + echo "\nVariable mod\n"; + printf("Type: %s\n", get_class($t)); + printf("Message: %s\n", $t->getMessage()); } try { - $result = 1 / 0; - var_dump($result); + $result = 1 / 0; + var_dump($result); } catch (DivisionByZeroError $t){ - echo "\nLiteral div\n"; - printf("Type: %s\n", get_class($t)); - printf("Message: %s\n", $t->getMessage()); + echo "\nLiteral div\n"; + printf("Type: %s\n", get_class($t)); + printf("Message: %s\n", $t->getMessage()); } try { - $result = 1 % 0; - var_dump($result); + $result = 1 % 0; + var_dump($result); } catch (DivisionByZeroError $t){ - echo "\nLiteral mod\n"; - printf("Type: %s\n", get_class($t)); - printf("Message: %s\n", $t->getMessage()); + echo "\nLiteral mod\n"; + printf("Type: %s\n", get_class($t)); + printf("Message: %s\n", $t->getMessage()); } try { - $result = 1 / 0.0; - var_dump($result); + $result = 1 / 0.0; + var_dump($result); } catch (DivisionByZeroError $t){ - echo "\nDouble div\n"; - printf("Type: %s\n", get_class($t)); - printf("Message: %s\n", $t->getMessage()); + echo "\nDouble div\n"; + printf("Type: %s\n", get_class($t)); + printf("Message: %s\n", $t->getMessage()); } try { - $result = 1 % 0.0; - var_dump($result); + $result = 1 % 0.0; + var_dump($result); } catch (DivisionByZeroError $t){ - echo "\nDouble mod\n"; - printf("Type: %s\n", get_class($t)); - printf("Message: %s\n", $t->getMessage()); + echo "\nDouble mod\n"; + printf("Type: %s\n", get_class($t)); + printf("Message: %s\n", $t->getMessage()); } ?> diff --git a/Zend/tests/bug69996.phpt b/Zend/tests/bug69996.phpt index 178e36837a..f9044677cd 100644 --- a/Zend/tests/bug69996.phpt +++ b/Zend/tests/bug69996.phpt @@ -4,17 +4,17 @@ Bug #69996 (Changing the property of a cloned object affects the original) <?php function method($cache) { - $prepared = clone $cache; - var_dump($prepared->data); - $prepared->data = "bad"; - return $prepared; + $prepared = clone $cache; + var_dump($prepared->data); + $prepared->data = "bad"; + return $prepared; } $cache = new stdClass(); $cache->data = "good"; for ($i = 0; $i < 5; ++$i) { - method($cache); + method($cache); } ?> --EXPECT-- diff --git a/Zend/tests/bug70012.phpt b/Zend/tests/bug70012.phpt index 9e532218a9..3892fefcf2 100644 --- a/Zend/tests/bug70012.phpt +++ b/Zend/tests/bug70012.phpt @@ -3,23 +3,23 @@ Bug #70012 (Exception lost with nested finally block) --FILE-- <?php try { - echo "Outer try\n"; - try { - echo " Middle try\n"; - throw new Exception(); - } finally { - echo " Middle finally\n"; - try { - echo " Inner try\n"; - } finally { - echo " Inner finally\n"; - } - } - echo "Outer shouldn't get here\n"; + echo "Outer try\n"; + try { + echo " Middle try\n"; + throw new Exception(); + } finally { + echo " Middle finally\n"; + try { + echo " Inner try\n"; + } finally { + echo " Inner finally\n"; + } + } + echo "Outer shouldn't get here\n"; } catch (Exception $e) { - echo "Outer catch\n"; + echo "Outer catch\n"; } finally { - echo "Outer finally\n"; + echo "Outer finally\n"; } ?> --EXPECT-- diff --git a/Zend/tests/bug70083.phpt b/Zend/tests/bug70083.phpt index 5bc3656e9f..691e6a4125 100644 --- a/Zend/tests/bug70083.phpt +++ b/Zend/tests/bug70083.phpt @@ -4,10 +4,10 @@ Bug #70083 (Use after free with assign by ref to overloaded objects) <?php class foo { - private $var; - function __get($e) { - return $this; - } + private $var; + function __get($e) { + return $this; + } } function &noref() { $foo = 1; return $foo; } diff --git a/Zend/tests/bug70089.phpt b/Zend/tests/bug70089.phpt index 1bfc38ae09..657c532622 100644 --- a/Zend/tests/bug70089.phpt +++ b/Zend/tests/bug70089.phpt @@ -8,26 +8,26 @@ function dummy($a) { } try { - chr(0)[0][] = 1; + chr(0)[0][] = 1; } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } try { - unset(chr(0)[0][0]); + unset(chr(0)[0][0]); } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } eval("function runtimetest(&\$a) {} "); try { - runtimetest(chr(0)[0]); + runtimetest(chr(0)[0]); } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } try { - ++chr(0)[0]; + ++chr(0)[0]; } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> --EXPECT-- diff --git a/Zend/tests/bug70117.phpt b/Zend/tests/bug70117.phpt index 4bdd12caef..cc46be6458 100644 --- a/Zend/tests/bug70117.phpt +++ b/Zend/tests/bug70117.phpt @@ -4,14 +4,14 @@ Bug #70117 (Unexpected return type error) <?php function &foo() :string { - $a = array(1); - $b = &$a[0]; - return $b; + $a = array(1); + $b = &$a[0]; + return $b; } function &foo1() :string { - $a = array("ref"); - return $a[0]; + $a = array("ref"); + return $a[0]; } var_dump(foo()); diff --git a/Zend/tests/bug70124.phpt b/Zend/tests/bug70124.phpt index 2155e73b30..4a6c46cbfa 100644 --- a/Zend/tests/bug70124.phpt +++ b/Zend/tests/bug70124.phpt @@ -4,38 +4,38 @@ Bug #70124 (null ptr deref / seg fault in ZEND_HANDLE_EXCEPTION_SPEC_HANDLER) <?php try { - echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),$f("test"))],chr(48)); + echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),$f("test"))],chr(48)); } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } class A { } try { - echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),a::y("test"))],chr(48)); + echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),a::y("test"))],chr(48)); } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } $a = new A; try { - echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),$a->y("test"))],chr(48)); + echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),$a->y("test"))],chr(48)); } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } try { - echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),\bar\y("test"))],chr(48)); + echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),\bar\y("test"))],chr(48)); } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } try { - echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),y("test"))],chr(48)); + echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),y("test"))],chr(48)); } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> --EXPECTF-- diff --git a/Zend/tests/bug70156.phpt b/Zend/tests/bug70156.phpt index 6b5e383337..0d20b38181 100644 --- a/Zend/tests/bug70156.phpt +++ b/Zend/tests/bug70156.phpt @@ -3,30 +3,30 @@ Bug #70156 (Segfault in zend_find_alias_name) --FILE-- <?php trait T1 { - protected function foo1() - { - $this->bar(); - } + protected function foo1() + { + $this->bar(); + } } trait T2 { - protected function foo2() - { - debug_print_backtrace(); - } + protected function foo2() + { + debug_print_backtrace(); + } } class dummy { - use T1 { - foo1 as private; - } - use T2 { - foo2 as bar; - } - public function __construct() - { - $this->foo1(); - } + use T1 { + foo1 as private; + } + use T2 { + foo2 as bar; + } + public function __construct() + { + $this->foo1(); + } } new dummy(); diff --git a/Zend/tests/bug70164.phpt b/Zend/tests/bug70164.phpt index 7777be4ee0..258d594421 100644 --- a/Zend/tests/bug70164.phpt +++ b/Zend/tests/bug70164.phpt @@ -4,14 +4,14 @@ __COMPILER_HALT_OFFSET__ is a "magic" constant, which should work if referenced <?php namespace { - echo __COMPILER_HALT_OFFSET__, "\n"; - echo \__COMPILER_HALT_OFFSET__, "\n"; + echo __COMPILER_HALT_OFFSET__, "\n"; + echo \__COMPILER_HALT_OFFSET__, "\n"; } namespace Foo { - echo __COMPILER_HALT_OFFSET__, "\n"; - echo \__COMPILER_HALT_OFFSET__, "\n"; - echo namespace\__COMPILER_HALT_OFFSET__, "\n"; + echo __COMPILER_HALT_OFFSET__, "\n"; + echo \__COMPILER_HALT_OFFSET__, "\n"; + echo namespace\__COMPILER_HALT_OFFSET__, "\n"; } diff --git a/Zend/tests/bug70179.phpt b/Zend/tests/bug70179.phpt index a5bdb98805..7ab924eedb 100644 --- a/Zend/tests/bug70179.phpt +++ b/Zend/tests/bug70179.phpt @@ -4,9 +4,9 @@ Bug #70179 ($this refcount issue) <?php class X { - function __invoke() { - var_dump($this); - } + function __invoke() { + var_dump($this); + } } (new X)(); diff --git a/Zend/tests/bug70187.phpt b/Zend/tests/bug70187.phpt index a30f13b3ea..a675fff507 100644 --- a/Zend/tests/bug70187.phpt +++ b/Zend/tests/bug70187.phpt @@ -3,7 +3,7 @@ Bug #70187 (Notice: unserialize(): Unexpected end of serialized data) --FILE-- <?php class A { - public $b; + public $b; } $a = new A; diff --git a/Zend/tests/bug70215.phpt b/Zend/tests/bug70215.phpt index 527920cbb5..851a6b855e 100644 --- a/Zend/tests/bug70215.phpt +++ b/Zend/tests/bug70215.phpt @@ -4,9 +4,9 @@ Bug #70215 (Segfault when invoke is static) <?php class A { - public static function __invoke() { - echo __CLASS__; - } + public static function __invoke() { + echo __CLASS__; + } } class B extends A { } diff --git a/Zend/tests/bug70241.phpt b/Zend/tests/bug70241.phpt index 74218e9bf9..bc3729982f 100644 --- a/Zend/tests/bug70241.phpt +++ b/Zend/tests/bug70241.phpt @@ -6,8 +6,8 @@ zend.assertions=-1 <?php function foo () { - assert(yield 1); - return null; + assert(yield 1); + return null; } var_dump(foo() instanceof Generator); diff --git a/Zend/tests/bug70258.phpt b/Zend/tests/bug70258.phpt index 5ffd7bf512..11f59dd95b 100644 --- a/Zend/tests/bug70258.phpt +++ b/Zend/tests/bug70258.phpt @@ -12,13 +12,13 @@ if ($zend_mm_enabled === "0") { --FILE-- <?php class A { - public $arr; - public function core() { - $this->arr["no_pack"] = 1; - while (1) { - $this->arr[] = 1; - } - } + public $arr; + public function core() { + $this->arr["no_pack"] = 1; + while (1) { + $this->arr[] = 1; + } + } } $a = new A; diff --git a/Zend/tests/bug70288.phpt b/Zend/tests/bug70288.phpt index 4b55d0b476..502bfc7bf0 100644 --- a/Zend/tests/bug70288.phpt +++ b/Zend/tests/bug70288.phpt @@ -3,13 +3,13 @@ Bug #70288 (Apache crash related to ZEND_SEND_REF) --FILE-- <?php class A { - public function __get($name) { - return new Stdclass(); - } + public function __get($name) { + return new Stdclass(); + } } function test(&$obj) { - var_dump($obj); + var_dump($obj); } $a = new A; test($a->dummy); diff --git a/Zend/tests/bug70321.phpt b/Zend/tests/bug70321.phpt index 19f691f418..6e490555be 100644 --- a/Zend/tests/bug70321.phpt +++ b/Zend/tests/bug70321.phpt @@ -4,27 +4,27 @@ bug #70321 (Magic getter breaks reference to array property) <?php class foo implements arrayAccess { - private $bar; - public function __construct() - { - $this->bar = new bar(); - } - public function & __get($key) - { - $bar = $this->bar; - return $bar; - } + private $bar; + public function __construct() + { + $this->bar = new bar(); + } + public function & __get($key) + { + $bar = $this->bar; + return $bar; + } - public function & offsetGet($key) { - $bar = $this->bar; - return $bar; - } - public function offsetSet($key, $val) { - } - public function offsetUnset($key) { - } - public function offsetExists($key) { - } + public function & offsetGet($key) { + $bar = $this->bar; + return $bar; + } + public function offsetSet($key, $val) { + } + public function offsetUnset($key) { + } + public function offsetExists($key) { + } } class bar { public $onBaz = []; } diff --git a/Zend/tests/bug70332.phpt b/Zend/tests/bug70332.phpt index 217070f133..f078a65a2f 100644 --- a/Zend/tests/bug70332.phpt +++ b/Zend/tests/bug70332.phpt @@ -3,7 +3,7 @@ Bug #70332 (Wrong behavior while returning reference on object) --FILE-- <?php function & test($arg) { - return $arg; + return $arg; } $arg = new Stdclass(); diff --git a/Zend/tests/bug70478.phpt b/Zend/tests/bug70478.phpt index 1785a97324..eb58cde36b 100644 --- a/Zend/tests/bug70478.phpt +++ b/Zend/tests/bug70478.phpt @@ -4,12 +4,12 @@ Bug #70478 (**= does no longer work) <?php class foo { - public $a = 3; - private $b = 4; + public $a = 3; + private $b = 4; - function __construct() { - $this->a **= $this->b; - } + function __construct() { + $this->a **= $this->b; + } } $a = new foo; diff --git a/Zend/tests/bug70547.phpt b/Zend/tests/bug70547.phpt index f793e70781..d185cbc3a6 100644 --- a/Zend/tests/bug70547.phpt +++ b/Zend/tests/bug70547.phpt @@ -3,29 +3,29 @@ Bug #70547 (unsetting function variables corrupts backtrace) --FILE-- <?php function brokenTrace($arg1, &$arg2, $arg3){ - backtraceWrapper(); - var_dump(func_get_args()); - unset($arg3); - var_dump(func_get_arg(0)); - var_dump(func_get_arg(1)); - var_dump(func_get_arg(2)); - var_dump(func_get_arg(3)); - backtraceWrapper(); - unset($arg1); - var_dump(func_get_args()); - backtraceWrapper(); - unset($arg2); - backtraceWrapper(); - var_dump(func_get_arg(0)); - var_dump(func_get_arg(1)); - var_dump(func_get_arg(2)); - var_dump(func_get_arg(3)); + backtraceWrapper(); + var_dump(func_get_args()); + unset($arg3); + var_dump(func_get_arg(0)); + var_dump(func_get_arg(1)); + var_dump(func_get_arg(2)); + var_dump(func_get_arg(3)); + backtraceWrapper(); + unset($arg1); + var_dump(func_get_args()); + backtraceWrapper(); + unset($arg2); + backtraceWrapper(); + var_dump(func_get_arg(0)); + var_dump(func_get_arg(1)); + var_dump(func_get_arg(2)); + var_dump(func_get_arg(3)); } $arg2 = "2nd"; brokenTrace("1st", $arg2, "3th", "4th"); function backtraceWrapper(){ - $bt = debug_backtrace(); - var_dump($bt[1]['args']); + $bt = debug_backtrace(); + var_dump($bt[1]['args']); } ?> --EXPECT-- diff --git a/Zend/tests/bug70689.phpt b/Zend/tests/bug70689.phpt index 882dd89b75..d1895cf39e 100644 --- a/Zend/tests/bug70689.phpt +++ b/Zend/tests/bug70689.phpt @@ -4,17 +4,17 @@ Bug #70689 (Exception handler does not work as expected) <?php function foo($foo) { - echo "Executing foo\n"; + echo "Executing foo\n"; } set_error_handler(function($errno, $errstr) { - throw new Exception($errstr); + throw new Exception($errstr); }); try { - foo(); + foo(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/bug70785.phpt b/Zend/tests/bug70785.phpt index f48bc3cdb9..05b1b6afa0 100644 --- a/Zend/tests/bug70785.phpt +++ b/Zend/tests/bug70785.phpt @@ -4,19 +4,19 @@ Bug #70785 (Infinite loop due to exception during identical comparison) <?php set_error_handler(function($no, $msg) { - throw new Exception($msg); + throw new Exception($msg); }); try { - if ($a === null) { // ZEND_VM_SMART_BRANCH - undefined_function('Null'); - } + if ($a === null) { // ZEND_VM_SMART_BRANCH + undefined_function('Null'); + } } catch (Exception $e) { } try { - $c === 3; // ZEND_VM_NEXT_OPCODE - undefined_function(); + $c === 3; // ZEND_VM_NEXT_OPCODE + undefined_function(); } catch (Exception $e) { } ?> diff --git a/Zend/tests/bug70805.phpt b/Zend/tests/bug70805.phpt index 1177233184..86c8a2c800 100644 --- a/Zend/tests/bug70805.phpt +++ b/Zend/tests/bug70805.phpt @@ -9,12 +9,12 @@ class B { } class C { - public function __destruct() { - if (isset($GLOBALS["a"])) { - unset($GLOBALS["array"]); - unset($GLOBALS["a"]); // this will be called in gc_colloct_roots and put $a into gc roots buf - } - } + public function __destruct() { + if (isset($GLOBALS["a"])) { + unset($GLOBALS["array"]); + unset($GLOBALS["a"]); // this will be called in gc_colloct_roots and put $a into gc roots buf + } + } } $a = new A; @@ -28,9 +28,9 @@ $array = array($c); //This is used to leave a room for $GLOBALS["a"] unset($c); while ($i++ < 9998) { - $t = []; - $t[] = &$t; - unset($t); + $t = []; + $t[] = &$t; + unset($t); } $t = [new C]; $t[] = &$t; @@ -39,7 +39,7 @@ unset($t); // This is used to trigger C::__destruct while doing gc_colloct_roots $e = $a; unset($a); // This one can not be putted into roots buf because it's full, thus gc_colloct_roots will be called, // but C::__destructor which is called in gc_colloct_roots will put $a into buf - // which will make $a be putted into gc roots buf twice + // which will make $a be putted into gc roots buf twice var_dump(gc_collect_cycles()); ?> --EXPECT-- diff --git a/Zend/tests/bug70805_1.phpt b/Zend/tests/bug70805_1.phpt index 035ec6884f..7d699e25e3 100644 --- a/Zend/tests/bug70805_1.phpt +++ b/Zend/tests/bug70805_1.phpt @@ -11,12 +11,12 @@ class B { } class C { - public function __destruct() { - if (isset($GLOBALS["a"])) { - unset($GLOBALS["array"]); - unset($GLOBALS["a"]); - } - } + public function __destruct() { + if (isset($GLOBALS["a"])) { + unset($GLOBALS["array"]); + unset($GLOBALS["a"]); + } + } } $a = new A; @@ -30,9 +30,9 @@ $array = array($c); unset($c); while ($i++ < 9998) { - $t = []; - $t[] = &$t; - unset($t); + $t = []; + $t[] = &$t; + unset($t); } $t = [new C]; $t[] = &$t; diff --git a/Zend/tests/bug70805_2.phpt b/Zend/tests/bug70805_2.phpt index a4d01aa626..b33d47a6a9 100644 --- a/Zend/tests/bug70805_2.phpt +++ b/Zend/tests/bug70805_2.phpt @@ -11,11 +11,11 @@ class B { } class C { - public function __destruct() { - if (isset($GLOBALS["a"])) { - unset($GLOBALS["a"]); - } - } + public function __destruct() { + if (isset($GLOBALS["a"])) { + unset($GLOBALS["a"]); + } + } } $a = new A; @@ -25,9 +25,9 @@ $a->b->a = $a; $i = 0; while ($i++ < 9999) { - $t = []; - $t[] = &$t; - unset($t); + $t = []; + $t[] = &$t; + unset($t); } $t = [new C]; $t[] = &$t; diff --git a/Zend/tests/bug70873.phpt b/Zend/tests/bug70873.phpt index aecc0e879b..fd6274c4d2 100644 --- a/Zend/tests/bug70873.phpt +++ b/Zend/tests/bug70873.phpt @@ -4,19 +4,19 @@ Bug #70873 (Regression on private static properties access) <?php class A { - private static $x = 1; + private static $x = 1; } class B extends A { - function bar() { - var_dump(self::$x); - } + function bar() { + var_dump(self::$x); + } }; class C extends A { - function bar() { - var_dump(A::$x); - } + function bar() { + var_dump(A::$x); + } }; diff --git a/Zend/tests/bug70912.phpt b/Zend/tests/bug70912.phpt index 3d6d4303a6..912ffc601e 100644 --- a/Zend/tests/bug70912.phpt +++ b/Zend/tests/bug70912.phpt @@ -3,7 +3,7 @@ Bug #70912 (Null ptr dereference when class property is initialised to a derefer --FILE-- <?php class A { - public $a=[][]; + public $a=[][]; } ?> --EXPECTF-- diff --git a/Zend/tests/bug70918.phpt b/Zend/tests/bug70918.phpt index 81e2192d8a..d376d2147a 100644 --- a/Zend/tests/bug70918.phpt +++ b/Zend/tests/bug70918.phpt @@ -3,39 +3,39 @@ Bug #70918 (Segfault using static outside of class scope) --FILE-- <?php try { - static::x; + static::x; } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } try { - parent::x; + parent::x; } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } try { - self::x; + self::x; } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } try { - new static; + new static; } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } try { - static::x(); + static::x(); } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } try { - static::$i; + static::$i; } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> --EXPECT-- diff --git a/Zend/tests/bug70944.phpt b/Zend/tests/bug70944.phpt index afb10bc27f..6a617f5e46 100644 --- a/Zend/tests/bug70944.phpt +++ b/Zend/tests/bug70944.phpt @@ -3,25 +3,25 @@ Bug #70944 (try{ } finally{} can create infinite chains of exceptions) --FILE-- <?php try { - $e = new Exception("Foo"); - try { - throw new Exception("Bar", 0, $e); - } finally { - throw $e; - } + $e = new Exception("Foo"); + try { + throw new Exception("Bar", 0, $e); + } finally { + throw $e; + } } catch (Exception $e) { - var_dump((string)$e); + var_dump((string)$e); } try { - $e = new Exception("Foo"); - try { - throw new Exception("Bar", 0, $e); - } finally { - throw new Exception("Dummy", 0, $e); - } + $e = new Exception("Foo"); + try { + throw new Exception("Bar", 0, $e); + } finally { + throw new Exception("Dummy", 0, $e); + } } catch (Exception $e) { - var_dump((string)$e); + var_dump((string)$e); } ?> --EXPECTF-- diff --git a/Zend/tests/bug70958.phpt b/Zend/tests/bug70958.phpt index faa75e0b16..5a0d605ad3 100644 --- a/Zend/tests/bug70958.phpt +++ b/Zend/tests/bug70958.phpt @@ -4,13 +4,13 @@ Bug #70958 (Invalid opcode while using ::class as trait method parameter default <?php trait Foo { - function bar($a = self::class) { - var_dump($a); - } + function bar($a = self::class) { + var_dump($a); + } } class B { - use Foo; + use Foo; } $b = new B; diff --git a/Zend/tests/bug70967.phpt b/Zend/tests/bug70967.phpt index d254ea8d89..03f3021e39 100644 --- a/Zend/tests/bug70967.phpt +++ b/Zend/tests/bug70967.phpt @@ -3,9 +3,9 @@ Bug #70967 (Weird error handling for __toString when Error is thrown) --FILE-- <?php class A { - public function __toString() { - undefined_function(); - } + public function __toString() { + undefined_function(); + } } echo (new A); diff --git a/Zend/tests/bug71067.phpt b/Zend/tests/bug71067.phpt index b2a1b31811..efad6e4c11 100644 --- a/Zend/tests/bug71067.phpt +++ b/Zend/tests/bug71067.phpt @@ -6,13 +6,13 @@ error_reporting=0 --FILE-- <?php class Test { - public function test(){ - $arr = (object) [ - 'children' => [] - ]; - $arr->children[] = 1; - return $arr; - } + public function test(){ + $arr = (object) [ + 'children' => [] + ]; + $arr->children[] = 1; + return $arr; + } } $o = new Test(); diff --git a/Zend/tests/bug71163.phpt b/Zend/tests/bug71163.phpt index f87b951480..71470027ba 100644 --- a/Zend/tests/bug71163.phpt +++ b/Zend/tests/bug71163.phpt @@ -3,20 +3,20 @@ Bug #71163 (Segmentation Fault (cleanup_unfinished_calls)) --FILE-- <?php spl_autoload_register(function ($name) { - eval ("class $name extends Exception { public static function foo() {}}"); - throw new Exception("boom"); + eval ("class $name extends Exception { public static function foo() {}}"); + throw new Exception("boom"); }); function test2() { - try { - Test::foo(); - } catch (Exception $e) { - echo "okey"; - } + try { + Test::foo(); + } catch (Exception $e) { + echo "okey"; + } } function test() { - test2(); + test2(); } test(); diff --git a/Zend/tests/bug71275.phpt b/Zend/tests/bug71275.phpt index 52443734b7..efca70ba5c 100644 --- a/Zend/tests/bug71275.phpt +++ b/Zend/tests/bug71275.phpt @@ -4,18 +4,18 @@ Bug #71275 (Bad method called on cloning an object having a trait) <?php trait MyTrait { - public function _() { - throw new RuntimeException('Should not be called'); - } + public function _() { + throw new RuntimeException('Should not be called'); + } } class MyClass { - use MyTrait; + use MyTrait; - public function __clone() { - echo "I'm working hard to clone"; - } + public function __clone() { + echo "I'm working hard to clone"; + } } diff --git a/Zend/tests/bug71300.phpt b/Zend/tests/bug71300.phpt index fc4b23681a..40734b0549 100644 --- a/Zend/tests/bug71300.phpt +++ b/Zend/tests/bug71300.phpt @@ -3,20 +3,20 @@ Bug #71300 (Segfault in zend_fetch_string_offset) --FILE-- <?php function test1() { - for ($n = 'a'; $n < 'g'; $n++) { - $$n = 1; - } - $$n = $$n[++$n] = "test"; - return $$n; + for ($n = 'a'; $n < 'g'; $n++) { + $$n = 1; + } + $$n = $$n[++$n] = "test"; + return $$n; } var_dump(test1()); function test2() { /* See #71303 for why not using for loop here */ - $n = "a"; - $$n .= $$n[++$n] = "test"; - return $$n; + $n = "a"; + $$n .= $$n[++$n] = "test"; + return $$n; } var_dump(test2()); diff --git a/Zend/tests/bug71336.phpt b/Zend/tests/bug71336.phpt index c5da420da0..bf38224235 100644 --- a/Zend/tests/bug71336.phpt +++ b/Zend/tests/bug71336.phpt @@ -4,23 +4,23 @@ Bug #71336 (Wrong is_ref on properties as exposed via get_object_vars()) <?php class A { - protected $bar = array('baz'); + protected $bar = array('baz'); - function bar() - { - array_pop($this->bar); - $vars = get_object_vars($this); - $this->bar[] = array('buz'); - print_r($vars); - } + function bar() + { + array_pop($this->bar); + $vars = get_object_vars($this); + $this->bar[] = array('buz'); + print_r($vars); + } - function foo() { - array_pop($this->bar); - $dummy = &$this->bar; - $vars = get_object_vars($this); - $this->bar[] = array('buz'); - print_r($vars); - } + function foo() { + array_pop($this->bar); + $dummy = &$this->bar; + $vars = get_object_vars($this); + $this->bar[] = array('buz'); + print_r($vars); + } } (new A())->bar(); diff --git a/Zend/tests/bug71428.2.phpt b/Zend/tests/bug71428.2.phpt index 0056bd8144..9cc7304e4a 100644 --- a/Zend/tests/bug71428.2.phpt +++ b/Zend/tests/bug71428.2.phpt @@ -5,13 +5,13 @@ bug #71428.2: inheritance of ye olde dynamic interfaces --FILE-- <?php interface StatementInterface { - public function fetch(int $first = PDO::FETCH_BOTH, int $second = PDO::FETCH_ORI_NEXT, int $third = 0); + public function fetch(int $first = PDO::FETCH_BOTH, int $second = PDO::FETCH_ORI_NEXT, int $third = 0); } class Statement extends PDOStatement implements StatementInterface {} interface StatementInterface1 { - public function fetch(int $first = PDO::FETCH_ASSOC, int $second = PDO::FETCH_ORI_PRIOR, int $third = 1); + public function fetch(int $first = PDO::FETCH_ASSOC, int $second = PDO::FETCH_ORI_PRIOR, int $third = 1); } class Statement1 extends PDOStatement implements StatementInterface1 {} diff --git a/Zend/tests/bug71474.phpt b/Zend/tests/bug71474.phpt index 72b0db91a1..5000377237 100644 --- a/Zend/tests/bug71474.phpt +++ b/Zend/tests/bug71474.phpt @@ -3,17 +3,17 @@ 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 __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); - } + if ($n > 0) { + $x->bug(); + test($n - 1, $x); + } } test(3000, new foo()); diff --git a/Zend/tests/bug71622.phpt b/Zend/tests/bug71622.phpt index 3ef0ba80e1..c23547788a 100644 --- a/Zend/tests/bug71622.phpt +++ b/Zend/tests/bug71622.phpt @@ -4,22 +4,22 @@ Bug #71622 (Strings used in pass-as-reference cannot be used to invoke C::$calla <?php function getMethodName(&$methodName) { - $methodName = Abc::METHOD_NAME; + $methodName = Abc::METHOD_NAME; } class Abc { - const METHOD_NAME = "goal"; + const METHOD_NAME = "goal"; - private static function goal() { - echo "success\n"; - } + private static function goal() { + echo "success\n"; + } - public static function run() { - $method = "foobar"; - getMethodName($method); - var_dump(is_callable("self::$method")); - self::$method(); - } + public static function run() { + $method = "foobar"; + getMethodName($method); + var_dump(is_callable("self::$method")); + self::$method(); + } } Abc::run(); diff --git a/Zend/tests/bug71695.phpt b/Zend/tests/bug71695.phpt index 6747ce0e14..31ae73a99d 100644 --- a/Zend/tests/bug71695.phpt +++ b/Zend/tests/bug71695.phpt @@ -3,9 +3,9 @@ Bug #71695 (Global variables are reserved before execution) --FILE-- <?php function provideGlobals() { - var_dump(array_key_exists("foo", $GLOBALS)); - var_dump(isset($GLOBALS["foo"])); - $GLOBALS += array("foo" => "foo"); + var_dump(array_key_exists("foo", $GLOBALS)); + var_dump(isset($GLOBALS["foo"])); + $GLOBALS += array("foo" => "foo"); } provideGlobals(); diff --git a/Zend/tests/bug71756.phpt b/Zend/tests/bug71756.phpt index 1f43c082f0..9bf88c0792 100644 --- a/Zend/tests/bug71756.phpt +++ b/Zend/tests/bug71756.phpt @@ -3,20 +3,20 @@ Bug #71756 (Call-by-reference widens scope to uninvolved functions when used in --FILE-- <?php function a ($option) { - b($option['bla']); - c($option); - var_dump($option); + b($option['bla']); + c($option); + var_dump($option); } function b (&$string) { - $string = 'changed'; + $string = 'changed'; } function c ($option) { - switch ($option['bla']) { - case 'changed': - $copy = $option; - $copy['bla'] = 'copy'; - break; - } + switch ($option['bla']) { + case 'changed': + $copy = $option; + $copy['bla'] = 'copy'; + break; + } } a(array('bla' => 'false')); ?> diff --git a/Zend/tests/bug71914.phpt b/Zend/tests/bug71914.phpt index a43eb56bbd..d7cae342f6 100644 --- a/Zend/tests/bug71914.phpt +++ b/Zend/tests/bug71914.phpt @@ -4,26 +4,26 @@ Bug #71914 (Reference is lost in "switch") <?php function bug(&$value) { - switch ($value) { - case "xxxx": - $value = true; - break; - } + switch ($value) { + case "xxxx": + $value = true; + break; + } } function returnArray() { - $array = array(); - $array["str"] = "xxxx"; - return $array; + $array = array(); + $array["str"] = "xxxx"; + return $array; } class Foo { - public $array = array("str" => "xxxx"); + public $array = array("str" => "xxxx"); } function test($arr, &$dummy) { - bug($arr["str"]); - var_dump($arr["str"]); + bug($arr["str"]); + var_dump($arr["str"]); } $foo = new Foo(); diff --git a/Zend/tests/bug71930.phpt b/Zend/tests/bug71930.phpt index 40348cc904..1aa64bf583 100644 --- a/Zend/tests/bug71930.phpt +++ b/Zend/tests/bug71930.phpt @@ -10,8 +10,8 @@ if (!extension_loaded("curl")) { <?php class A { - public static function dummy() { - } + public static function dummy() { + } } $a = array(); diff --git a/Zend/tests/bug72215_2.phpt b/Zend/tests/bug72215_2.phpt index cefb6d9632..029bf874fe 100644 --- a/Zend/tests/bug72215_2.phpt +++ b/Zend/tests/bug72215_2.phpt @@ -8,7 +8,7 @@ function &test(&$b) { return $a; } finally { $a =& $c; - $a = 2; + $a = 2; } } $x = 1; diff --git a/Zend/tests/bug72441.phpt b/Zend/tests/bug72441.phpt index af57b3adb0..8e0a12a1c5 100644 --- a/Zend/tests/bug72441.phpt +++ b/Zend/tests/bug72441.phpt @@ -6,8 +6,8 @@ Bug #72441 (Segmentation fault: RFC list_keys) $array = []; list( - '' => $foo, - $bar + '' => $foo, + $bar ) = $array; ?> --EXPECTF-- diff --git a/Zend/tests/bug72508.phpt b/Zend/tests/bug72508.phpt index b39aa16d02..86ad749a40 100644 --- a/Zend/tests/bug72508.phpt +++ b/Zend/tests/bug72508.phpt @@ -3,20 +3,20 @@ Bug #72508 (strange references after recursive function call and "switch" statem --FILE-- <?php function a ($option) { - b($option['bla']); - c($option); - var_dump($option); + b($option['bla']); + c($option); + var_dump($option); } function b (&$string) { - $string = 'changed'; + $string = 'changed'; } function c ($option) { - switch ($option['bla']) { - default: - $copy = $option; - $copy['bla'] = 'copy'; - break; - } + switch ($option['bla']) { + default: + $copy = $option; + $copy['bla'] = 'copy'; + break; + } } a(array('bla' => 'fasel')); diff --git a/Zend/tests/bug72594.phpt b/Zend/tests/bug72594.phpt index c67e68e4ac..5ffbe1ef34 100644 --- a/Zend/tests/bug72594.phpt +++ b/Zend/tests/bug72594.phpt @@ -5,12 +5,12 @@ opcache.enable=0 --FILE-- <?php if (isset($runtime)) { - return new class { - public $bar; - public function bing($foo = null) { - if ($foo) $foo->bing(); - } - }; + return new class { + public $bar; + public function bing($foo = null) { + if ($foo) $foo->bing(); + } + }; } $runtime = 1; diff --git a/Zend/tests/bug72598.phpt b/Zend/tests/bug72598.phpt index dfb09a05b8..eeee510279 100644 --- a/Zend/tests/bug72598.phpt +++ b/Zend/tests/bug72598.phpt @@ -3,7 +3,7 @@ Bug #72598 (Reference is lost after array_slice()) --FILE-- <?php function ref(&$ref) { - var_dump($ref); + var_dump($ref); } new class { diff --git a/Zend/tests/bug72598_2.phpt b/Zend/tests/bug72598_2.phpt index c3943806ff..d58e18c978 100644 --- a/Zend/tests/bug72598_2.phpt +++ b/Zend/tests/bug72598_2.phpt @@ -3,15 +3,15 @@ Bug #72598.2 (Reference is lost after array_slice()) --FILE-- <?php function ref(&$ref) { - var_dump($ref); - $ref = 1; + var_dump($ref); + $ref = 1; } new class { function __construct() { - $b = 0; + $b = 0; $args = [&$b]; - unset($b); + unset($b); for ($i = 0; $i < 2; $i++) { $a = array_slice($args, 0, 1); call_user_func_array('ref', $a); diff --git a/Zend/tests/bug73288.phpt b/Zend/tests/bug73288.phpt index fefcf3bbcd..52e8eedeaf 100644 --- a/Zend/tests/bug73288.phpt +++ b/Zend/tests/bug73288.phpt @@ -7,20 +7,20 @@ opcache.enable_cli=1 <?php class NoClone { - public function __clone() { - throw new Exception("No Cloneable"); - } + public function __clone() { + throw new Exception("No Cloneable"); + } } class C { - public function __get($name) { - return new NoClone; - } + public function __get($name) { + return new NoClone; + } } function test_clone() { - $c = new C; - $b = clone $c->x; + $c = new C; + $b = clone $c->x; } test_clone(); diff --git a/Zend/tests/bug73663.phpt b/Zend/tests/bug73663.phpt index 06dd7f6700..85b61b0f46 100644 --- a/Zend/tests/bug73663.phpt +++ b/Zend/tests/bug73663.phpt @@ -3,12 +3,12 @@ Bug #73663 ("Invalid opcode 65/16/8" occurs with a variable created with list()) --FILE-- <?php function change(&$ref) { - $ref = range(1, 10); - return; + $ref = range(1, 10); + return; } $func = function (&$ref) { - return change($ref); + return change($ref); }; $array = [1]; diff --git a/Zend/tests/bug73663_2.phpt b/Zend/tests/bug73663_2.phpt index 660a4f845e..6c82fd28db 100644 --- a/Zend/tests/bug73663_2.phpt +++ b/Zend/tests/bug73663_2.phpt @@ -3,8 +3,8 @@ Bug #73663.2 ("Invalid opcode 65/16/8" occurs with a variable created with list( --FILE-- <?php function change(&$ref) { - $ref = range(1, 10); - return; + $ref = range(1, 10); + return; } $array = [1]; diff --git a/Zend/tests/bug73792.phpt b/Zend/tests/bug73792.phpt index ac4f265aaf..8af16b169b 100644 --- a/Zend/tests/bug73792.phpt +++ b/Zend/tests/bug73792.phpt @@ -5,7 +5,7 @@ Bug #73792 (invalid foreach loop hangs script) $a = 'aaa'; foreach ($a['bbb'] as &$value) { - echo 'loop'; + echo 'loop'; } unset($value); diff --git a/Zend/tests/bug73916.phpt b/Zend/tests/bug73916.phpt index ba2567ed0c..7b51f8f31a 100644 --- a/Zend/tests/bug73916.phpt +++ b/Zend/tests/bug73916.phpt @@ -9,7 +9,7 @@ $test[] =& $a; $test[] =& $b; test($test); function test() { - debug_print_backtrace(); + debug_print_backtrace(); } ?> --EXPECTF-- diff --git a/Zend/tests/bug73989.phpt b/Zend/tests/bug73989.phpt index 48e5a7a734..04d776cb9e 100644 --- a/Zend/tests/bug73989.phpt +++ b/Zend/tests/bug73989.phpt @@ -8,13 +8,13 @@ class Cycle public function __construct() { - $obj = $this; + $obj = $this; $this->thing = function() use($obj) {}; } public function __destruct() { - ($this->thing)(); + ($this->thing)(); } } diff --git a/Zend/tests/bug74053.phpt b/Zend/tests/bug74053.phpt index b1936a58e9..16d430405b 100644 --- a/Zend/tests/bug74053.phpt +++ b/Zend/tests/bug74053.phpt @@ -4,7 +4,7 @@ Bug #74053 (Corrupted class entries on shutdown when a destructor spawns another <?php class b { function __destruct() { - echo "b::destruct\n"; + echo "b::destruct\n"; } } class a { @@ -12,10 +12,10 @@ class a { static $new; static $max = 10; function __destruct() { - if (self::$max-- <= 0) return; - echo "a::destruct\n"; - self::$b = new b; - self::$new[] = new a; + if (self::$max-- <= 0) return; + echo "a::destruct\n"; + self::$b = new b; + self::$new[] = new a; } } new a; diff --git a/Zend/tests/bug74164.phpt b/Zend/tests/bug74164.phpt index 354b2f51e0..b623dcb1db 100644 --- a/Zend/tests/bug74164.phpt +++ b/Zend/tests/bug74164.phpt @@ -6,7 +6,7 @@ Bug #74164 (PHP hangs when an invalid value is dynamically passed to typehinted namespace Foo; set_error_handler(function ($type, $msg) { - throw new \Exception($msg); + throw new \Exception($msg); }); call_user_func(function (array &$ref) {var_dump("xxx");}, 'not_an_array_variable'); diff --git a/Zend/tests/bug74657.phpt b/Zend/tests/bug74657.phpt index 4c84bde7bd..fb9b3d6a4d 100644 --- a/Zend/tests/bug74657.phpt +++ b/Zend/tests/bug74657.phpt @@ -7,13 +7,13 @@ interface I { } class C { - const FOO = I::FOO; + const FOO = I::FOO; - public $options = [self::FOO => "bar"]; + public $options = [self::FOO => "bar"]; } try { - var_dump((new C)->options); + var_dump((new C)->options); } catch (Throwable $e) {} var_dump((new C)->options); diff --git a/Zend/tests/bug74840.phpt b/Zend/tests/bug74840.phpt index 68e27cba84..713e7908dd 100644 --- a/Zend/tests/bug74840.phpt +++ b/Zend/tests/bug74840.phpt @@ -4,13 +4,13 @@ Bug #74840: Opcache overwrites argument of GENERATOR_RETURN within finally <?php $g = (function($a) { - try { - return $a + 1; - } finally { - $b = $a + 2; - var_dump($b); - } - yield; // Generator + try { + return $a + 1; + } finally { + $b = $a + 2; + var_dump($b); + } + yield; // Generator })(1); $g->next(); var_dump($g->getReturn()); diff --git a/Zend/tests/bug75420.1.phpt b/Zend/tests/bug75420.1.phpt index 80e951ac9e..fe7fbabcc5 100644 --- a/Zend/tests/bug75420.1.phpt +++ b/Zend/tests/bug75420.1.phpt @@ -3,8 +3,8 @@ Bug #75420.1 (Indirect modification of magic method argument) --FILE-- <?php class Test { - public function __isset($x) { $GLOBALS["name"] = 24; return true; } - public function __get($x) { var_dump($x); return 42; } + public function __isset($x) { $GLOBALS["name"] = 24; return true; } + public function __get($x) { var_dump($x); return 42; } } $obj = new Test; diff --git a/Zend/tests/bug75420.10.phpt b/Zend/tests/bug75420.10.phpt index c2ae3aa55d..224a6494c9 100644 --- a/Zend/tests/bug75420.10.phpt +++ b/Zend/tests/bug75420.10.phpt @@ -3,10 +3,10 @@ Bug #75420.10 (Indirect modification of magic method argument) --FILE-- <?php class Test implements ArrayAccess { - public function offsetExists($x) { $GLOBALS["name"] = 24; return true; } - public function offsetGet($x) { var_dump($x); return 42; } - public function offsetSet($x, $y) { } - public function offsetUnset($x) { } + public function offsetExists($x) { $GLOBALS["name"] = 24; return true; } + public function offsetGet($x) { var_dump($x); return 42; } + public function offsetSet($x, $y) { } + public function offsetUnset($x) { } } $obj = new Test; diff --git a/Zend/tests/bug75420.11.phpt b/Zend/tests/bug75420.11.phpt index 1ec623e41c..d4b5a9a6d1 100644 --- a/Zend/tests/bug75420.11.phpt +++ b/Zend/tests/bug75420.11.phpt @@ -3,10 +3,10 @@ Bug #75420.11 (Indirect modification of magic method argument) --FILE-- <?php class Test implements ArrayAccess { - public function offsetExists($x) { $GLOBALS["name"] = 24; return true; } - public function offsetGet($x) { var_dump($x); return 42; } - public function offsetSet($x, $y) { } - public function offsetUnset($x) { } + public function offsetExists($x) { $GLOBALS["name"] = 24; return true; } + public function offsetGet($x) { var_dump($x); return 42; } + public function offsetSet($x, $y) { } + public function offsetUnset($x) { } } $obj = new Test; diff --git a/Zend/tests/bug75420.12.phpt b/Zend/tests/bug75420.12.phpt index 7ed6f1474b..93567e069d 100644 --- a/Zend/tests/bug75420.12.phpt +++ b/Zend/tests/bug75420.12.phpt @@ -3,10 +3,10 @@ Bug #75420.12 (Indirect modification of magic method argument) --FILE-- <?php class Test implements ArrayAccess { - public function offsetExists($x) { $GLOBALS["name"] = 24; return true; } - public function offsetGet($x) { var_dump($x); return 42; } - public function offsetSet($x, $y) { } - public function offsetUnset($x) { } + public function offsetExists($x) { $GLOBALS["name"] = 24; return true; } + public function offsetGet($x) { var_dump($x); return 42; } + public function offsetSet($x, $y) { } + public function offsetUnset($x) { } } $obj = new Test; diff --git a/Zend/tests/bug75420.13.phpt b/Zend/tests/bug75420.13.phpt index 38031badd7..2526021ded 100644 --- a/Zend/tests/bug75420.13.phpt +++ b/Zend/tests/bug75420.13.phpt @@ -3,10 +3,10 @@ Bug #75420.13 (Indirect modification of magic method argument) --FILE-- <?php class Test implements ArrayAccess { - public function offsetExists($x) { $GLOBALS["obj"] = 24; return true; } - public function offsetGet($x) { var_dump($x); return 42; } - public function offsetSet($x, $y) { } - public function offsetUnset($x) { } + public function offsetExists($x) { $GLOBALS["obj"] = 24; return true; } + public function offsetGet($x) { var_dump($x); return 42; } + public function offsetSet($x, $y) { } + public function offsetUnset($x) { } } $obj = new Test; diff --git a/Zend/tests/bug75420.14.phpt b/Zend/tests/bug75420.14.phpt index 07fb2cd984..7d2a349951 100644 --- a/Zend/tests/bug75420.14.phpt +++ b/Zend/tests/bug75420.14.phpt @@ -3,10 +3,10 @@ Bug #75420.14 (Indirect modification of magic method argument) --FILE-- <?php class Test implements ArrayAccess { - public function offsetExists($x) { $GLOBALS["obj"] = 24; return true; } - public function offsetGet($x) { var_dump($x); return 42; } - public function offsetSet($x, $y) { } - public function offsetUnset($x) { } + public function offsetExists($x) { $GLOBALS["obj"] = 24; return true; } + public function offsetGet($x) { var_dump($x); return 42; } + public function offsetSet($x, $y) { } + public function offsetUnset($x) { } } $obj = new Test; diff --git a/Zend/tests/bug75420.15.phpt b/Zend/tests/bug75420.15.phpt index f747b4c887..421cadf11a 100644 --- a/Zend/tests/bug75420.15.phpt +++ b/Zend/tests/bug75420.15.phpt @@ -3,10 +3,10 @@ Bug #75420.15 (Indirect modification of magic method argument) --FILE-- <?php class Test implements ArrayAccess { - public function offsetExists($x) { } - public function offsetGet($x) { } - public function offsetSet($x, $y) { $GLOBALS["name"] = 24; var_dump($x); } - public function offsetUnset($x) { } + public function offsetExists($x) { } + public function offsetGet($x) { } + public function offsetSet($x, $y) { $GLOBALS["name"] = 24; var_dump($x); } + public function offsetUnset($x) { } } $obj = new Test; diff --git a/Zend/tests/bug75420.16.phpt b/Zend/tests/bug75420.16.phpt index 6c3982eacc..31a6957d89 100644 --- a/Zend/tests/bug75420.16.phpt +++ b/Zend/tests/bug75420.16.phpt @@ -3,10 +3,10 @@ Bug #75420.16 (Indirect modification of magic method argument) --FILE-- <?php class Test implements ArrayAccess { - public function offsetExists($x) { } - public function offsetGet($x) { } - public function offsetSet($x, $y) { $GLOBALS["obj"] = 24; var_dump($this); } - public function offsetUnset($x) { } + public function offsetExists($x) { } + public function offsetGet($x) { } + public function offsetSet($x, $y) { $GLOBALS["obj"] = 24; var_dump($this); } + public function offsetUnset($x) { } } $obj = new Test; diff --git a/Zend/tests/bug75420.2.phpt b/Zend/tests/bug75420.2.phpt index 994327d195..b078175a6e 100644 --- a/Zend/tests/bug75420.2.phpt +++ b/Zend/tests/bug75420.2.phpt @@ -3,8 +3,8 @@ Bug #75420.2 (Indirect modification of magic method argument) --FILE-- <?php class Test { - public function __isset($x) { $GLOBALS["name"] = 24; return true; } - public function __get($x) { var_dump($x); return 42; } + public function __isset($x) { $GLOBALS["name"] = 24; return true; } + public function __get($x) { var_dump($x); return 42; } } $obj = new Test; diff --git a/Zend/tests/bug75420.3.phpt b/Zend/tests/bug75420.3.phpt index 4810618d15..46c81fc7c9 100644 --- a/Zend/tests/bug75420.3.phpt +++ b/Zend/tests/bug75420.3.phpt @@ -3,8 +3,8 @@ Bug #75420.3 (Indirect modification of magic method argument) --FILE-- <?php class Test { - public function __isset($x) { $GLOBALS["name"] = 24; return true; } - public function __get($x) { var_dump($x); return 42; } + public function __isset($x) { $GLOBALS["name"] = 24; return true; } + public function __get($x) { var_dump($x); return 42; } } $obj = new Test; diff --git a/Zend/tests/bug75420.4.phpt b/Zend/tests/bug75420.4.phpt index e25bf313cb..216b4d82e5 100644 --- a/Zend/tests/bug75420.4.phpt +++ b/Zend/tests/bug75420.4.phpt @@ -3,8 +3,8 @@ Bug #75420.4 (Indirect modification of magic method argument) --FILE-- <?php class Test { - public function __isset($x) { $GLOBALS["name"] = 24; return true; } - public function __get($x) { var_dump($x); return 42; } + public function __isset($x) { $GLOBALS["name"] = 24; return true; } + public function __get($x) { var_dump($x); return 42; } } $obj = new Test; diff --git a/Zend/tests/bug75420.5.phpt b/Zend/tests/bug75420.5.phpt index 85fedc4679..3bcd1110ad 100644 --- a/Zend/tests/bug75420.5.phpt +++ b/Zend/tests/bug75420.5.phpt @@ -3,8 +3,8 @@ Bug #75420.5 (Indirect modification of magic method argument) --FILE-- <?php class Test { - public function __isset($x) { $GLOBALS["obj"] = 24; return true; } - public function __get($x) { var_dump($this); return 42; } + public function __isset($x) { $GLOBALS["obj"] = 24; return true; } + public function __get($x) { var_dump($this); return 42; } } $obj = new Test; diff --git a/Zend/tests/bug75420.6.phpt b/Zend/tests/bug75420.6.phpt index e4aa230b48..0902292326 100644 --- a/Zend/tests/bug75420.6.phpt +++ b/Zend/tests/bug75420.6.phpt @@ -3,8 +3,8 @@ Bug #75420.6 (Indirect modification of magic method argument) --FILE-- <?php class Test { - public function __isset($x) { $GLOBALS["obj"] = 24; return true; } - public function __get($x) { var_dump($this); return 42; } + public function __isset($x) { $GLOBALS["obj"] = 24; return true; } + public function __get($x) { var_dump($this); return 42; } } $obj = new Test; diff --git a/Zend/tests/bug75420.7.phpt b/Zend/tests/bug75420.7.phpt index 0b9743a880..47b7a5f2f1 100644 --- a/Zend/tests/bug75420.7.phpt +++ b/Zend/tests/bug75420.7.phpt @@ -3,7 +3,7 @@ Bug #75420.7 (Indirect modification of magic method argument) --FILE-- <?php class Test { - public function __set($x,$v) { $GLOBALS["name"] = 24; var_dump($x); } + public function __set($x,$v) { $GLOBALS["name"] = 24; var_dump($x); } } $obj = new Test; diff --git a/Zend/tests/bug75420.8.phpt b/Zend/tests/bug75420.8.phpt index 2d57c8b1cb..1d0f5ece3e 100644 --- a/Zend/tests/bug75420.8.phpt +++ b/Zend/tests/bug75420.8.phpt @@ -3,7 +3,7 @@ Bug #75420.8 (Indirect modification of magic method argument) --FILE-- <?php class Test { - public function __set($x,$v) { $GLOBALS["obj"] = 24; var_dump($this); } + public function __set($x,$v) { $GLOBALS["obj"] = 24; var_dump($this); } } $obj = new Test; diff --git a/Zend/tests/bug75420.9.phpt b/Zend/tests/bug75420.9.phpt index d83878e773..0bb96edda4 100644 --- a/Zend/tests/bug75420.9.phpt +++ b/Zend/tests/bug75420.9.phpt @@ -3,10 +3,10 @@ Bug #75420.9 (Indirect modification of magic method argument) --FILE-- <?php class Test implements ArrayAccess { - public function offsetExists($x) { $GLOBALS["name"] = 24; return true; } - public function offsetGet($x) { var_dump($x); return 42; } - public function offsetSet($x, $y) { } - public function offsetUnset($x) { } + public function offsetExists($x) { $GLOBALS["name"] = 24; return true; } + public function offsetGet($x) { var_dump($x); return 42; } + public function offsetSet($x, $y) { } + public function offsetUnset($x) { } } $obj = new Test; diff --git a/Zend/tests/bug75420.phpt b/Zend/tests/bug75420.phpt index 05ef892879..4fda3d833f 100644 --- a/Zend/tests/bug75420.phpt +++ b/Zend/tests/bug75420.phpt @@ -4,7 +4,7 @@ Bug #75420 (Crash when modifying property name in __isset for BP_VAR_IS) <?php class Test { - public function __isset($x) { $GLOBALS["name"] = 24; return true; } + public function __isset($x) { $GLOBALS["name"] = 24; return true; } public function __get($x) { var_dump($x); return 42; } } diff --git a/Zend/tests/bug75573.phpt b/Zend/tests/bug75573.phpt index 867f5d597f..09458f742e 100644 --- a/Zend/tests/bug75573.phpt +++ b/Zend/tests/bug75573.phpt @@ -5,41 +5,41 @@ Bug #75573 (Segmentation fault in 7.1.12 and 7.0.26) class A { - var $_stdObject; + var $_stdObject; function __construct() { $this->_stdObject = new stdClass; } - function &__get($property) - { - if (isset($this->_stdObject->{$property})) { - $retval =& $this->_stdObject->{$property}; - return $retval; - } else { - return NULL; - } - } - function &__set($property, $value) - { - return $this->_stdObject->{$property} = $value; - } - function __isset($property_name) - { - return isset($this->_stdObject->{$property_name}); - } + function &__get($property) + { + if (isset($this->_stdObject->{$property})) { + $retval =& $this->_stdObject->{$property}; + return $retval; + } else { + return NULL; + } + } + function &__set($property, $value) + { + return $this->_stdObject->{$property} = $value; + } + function __isset($property_name) + { + return isset($this->_stdObject->{$property_name}); + } } class B extends A { - function &__get($property) - { - if (isset($this->settings) && isset($this->settings[$property])) { - $retval =& $this->settings[$property]; - return $retval; - } else { - return parent::__get($property); - } - } + function &__get($property) + { + if (isset($this->settings) && isset($this->settings[$property])) { + $retval =& $this->settings[$property]; + return $retval; + } else { + return parent::__get($property); + } + } } $b = new B(); diff --git a/Zend/tests/bug76025.phpt b/Zend/tests/bug76025.phpt index 903cec2607..ba89e8a3f9 100644 --- a/Zend/tests/bug76025.phpt +++ b/Zend/tests/bug76025.phpt @@ -4,8 +4,8 @@ Bug #76025 (Segfault while throwing exception in error_handler) <?php function handleError($errno, $errstr, $errfile, $errline) { - $exception = new exception("blah"); - throw $exception; + $exception = new exception("blah"); + throw $exception; } set_error_handler('handleError', E_ALL); $c = $b[$a]; diff --git a/Zend/tests/bug76534.phpt b/Zend/tests/bug76534.phpt index 457d09f400..17d1550562 100644 --- a/Zend/tests/bug76534.phpt +++ b/Zend/tests/bug76534.phpt @@ -3,7 +3,7 @@ Bug #76534 (PHP hangs on 'illegal string offset on string references with an err --FILE-- <?php set_error_handler(function ($severity, $message, $file, $line) { - throw new \Exception($message); + throw new \Exception($message); }); $x = "foo"; diff --git a/Zend/tests/bug76667.phpt b/Zend/tests/bug76667.phpt index 09f17b56c7..1510c0f73a 100644 --- a/Zend/tests/bug76667.phpt +++ b/Zend/tests/bug76667.phpt @@ -4,15 +4,15 @@ Bug #76667 (Segfault with divide-assign op and __get + __set) <?php class T { - public function __get($k) - { - return $undefined->$k; - } - - public function __set($k, $v) - { - return $this->$v /= 0; - } + public function __get($k) + { + return $undefined->$k; + } + + public function __set($k, $v) + { + return $this->$v /= 0; + } }; $x = new T; diff --git a/Zend/tests/bug76754.phpt b/Zend/tests/bug76754.phpt index 424f1fbffc..5cdac04fcf 100644 --- a/Zend/tests/bug76754.phpt +++ b/Zend/tests/bug76754.phpt @@ -8,7 +8,7 @@ opcache.enable_cli=0 class FOO { - private const FOO = 'BAR'; + private const FOO = 'BAR'; } class BAR extends FOO { } diff --git a/Zend/tests/bug76860.phpt b/Zend/tests/bug76860.phpt index 67baa3996f..defe6153ba 100644 --- a/Zend/tests/bug76860.phpt +++ b/Zend/tests/bug76860.phpt @@ -7,7 +7,7 @@ class A { protected static $b = "b"; public static $c = "c"; public function __construct() { - var_dump($this->a, $this->b, $this->c); + var_dump($this->a, $this->b, $this->c); } } class B extends A { diff --git a/Zend/tests/bug76860_2.phpt b/Zend/tests/bug76860_2.phpt index 1ab85f69f2..2a64a97c2f 100644 --- a/Zend/tests/bug76860_2.phpt +++ b/Zend/tests/bug76860_2.phpt @@ -7,7 +7,7 @@ class A { private static $b = "b"; private static $c = "c"; public function __construct() { - var_dump($this->a, $this->b, $this->c); + var_dump($this->a, $this->b, $this->c); } } class B extends A { diff --git a/Zend/tests/bug76869.phpt b/Zend/tests/bug76869.phpt index 0193bf2102..825bed0eb1 100644 --- a/Zend/tests/bug76869.phpt +++ b/Zend/tests/bug76869.phpt @@ -3,20 +3,20 @@ Bug #76869 (Incorrect bypassing protected method accessibility check) --FILE-- <?php class A { - private function f() { - return "A"; - } + private function f() { + return "A"; + } } class B extends A { - protected function f() { - return "B"; - } + protected function f() { + return "B"; + } } $b = new B(); try { - var_dump($b->f()); + var_dump($b->f()); } catch (Throwable $e) { - echo "Exception: ", $e->getMessage(), "\n"; + echo "Exception: ", $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/Zend/tests/bug76965.phpt b/Zend/tests/bug76965.phpt index ce157733a5..64165e81f6 100644 --- a/Zend/tests/bug76965.phpt +++ b/Zend/tests/bug76965.phpt @@ -4,10 +4,10 @@ Bug #76965 (INI_SCANNER_RAW doesn't strip trailing whitespace) <?php // the trailing whitespace is intentional $ini = <<<END -1="foo" -2="bar" ; comment -3= baz -4= "foo;bar" +1="foo" +2="bar" ; comment +3= baz +4= "foo;bar" 5= "foo" ; bar ; baz 6= "foo;bar" ; baz 7= foo"bar ; "ok diff --git a/Zend/tests/bug77339.phpt b/Zend/tests/bug77339.phpt index 2e749bcd5a..c21b8cbad2 100644 --- a/Zend/tests/bug77339.phpt +++ b/Zend/tests/bug77339.phpt @@ -11,7 +11,7 @@ class Foo var_dump($arguments); exit; } - } + } echo "OK\n"; } diff --git a/Zend/tests/bug77877.phpt b/Zend/tests/bug77877.phpt index d4627f77c8..6ed35213ef 100644 --- a/Zend/tests/bug77877.phpt +++ b/Zend/tests/bug77877.phpt @@ -3,19 +3,19 @@ Bug #77877 call_user_func() passes $this to static methods --FILE-- <?php class Foo { - static public function bar() { - var_dump($this); - } + static public function bar() { + var_dump($this); + } } try { - array_map([new Foo, 'bar'],[1]); + array_map([new Foo, 'bar'],[1]); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - call_user_func([new Foo, 'bar']); + call_user_func([new Foo, 'bar']); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/Zend/tests/bug78379.phpt b/Zend/tests/bug78379.phpt index e48e9b7ca4..ebe0d1e329 100644 --- a/Zend/tests/bug78379.phpt +++ b/Zend/tests/bug78379.phpt @@ -5,9 +5,9 @@ opcache.enable=0 --FILE-- <?php class C { - public function __construct() { - $this->p = (object)["x" => [1]]; - } + public function __construct() { + $this->p = (object)["x" => [1]]; + } } class E { } diff --git a/Zend/tests/bug78379_2.phpt b/Zend/tests/bug78379_2.phpt index 0a515a2b07..b1e7e3527f 100644 --- a/Zend/tests/bug78379_2.phpt +++ b/Zend/tests/bug78379_2.phpt @@ -4,12 +4,12 @@ Bug #78379.2 (Cast to object confuses GC, causes crash) <?php class E {} function f() { - $e1 = new E; - $e2 = new E; - $a = ['e2' => $e2]; - $e1->a = (object)$a; - $e2->e1 = $e1; - $e2->a = (object)$a; + $e1 = new E; + $e2 = new E; + $a = ['e2' => $e2]; + $e1->a = (object)$a; + $e2->e1 = $e1; + $e2->a = (object)$a; } f(); gc_collect_cycles(); diff --git a/Zend/tests/bug78396.phpt b/Zend/tests/bug78396.phpt index 1f08a47dc4..f5d8281941 100644 --- a/Zend/tests/bug78396.phpt +++ b/Zend/tests/bug78396.phpt @@ -2,7 +2,7 @@ Bug #78396: Second file_put_contents in Shutdown hangs script --FILE-- <?php - + register_shutdown_function(function () { file_put_contents(__DIR__ . '/bug78396.txt', '1', FILE_APPEND | LOCK_EX); file_put_contents(__DIR__ . '/bug78396.txt', '2', FILE_APPEND | LOCK_EX); diff --git a/Zend/tests/bug78868.phpt b/Zend/tests/bug78868.phpt index 172af2a930..f6b66c765e 100644 --- a/Zend/tests/bug78868.phpt +++ b/Zend/tests/bug78868.phpt @@ -3,22 +3,22 @@ Bug #78868: Calling __autoload() with incorrect EG(fake_scope) value --FILE-- <?php class C { - private $private = 1; + private $private = 1; - function foo() { - $this->private++; //fails with EG(fake_scope) != NULL && EG(fake_scope) != "C" - } + function foo() { + $this->private++; //fails with EG(fake_scope) != NULL && EG(fake_scope) != "C" + } } class A { - static $foo = B::foo; //not resolved on include() + static $foo = B::foo; //not resolved on include() } function main_autoload($class_name) { - $c = new C; - $c->foo(); - //doesn't affect the error - eval("class B {const foo = 1;}"); + $c = new C; + $c->foo(); + //doesn't affect the error + eval("class B {const foo = 1;}"); } spl_autoload_register('main_autoload', false); diff --git a/Zend/tests/bug78898.phpt b/Zend/tests/bug78898.phpt index 9efd1416e2..248195e551 100644 --- a/Zend/tests/bug78898.phpt +++ b/Zend/tests/bug78898.phpt @@ -5,25 +5,25 @@ Bug #78898: call_user_func(['parent', ...]) fails while other succeed class A { - protected function _x() - { - echo "a"; - } + protected function _x() + { + echo "a"; + } - public function __call($methodName, array $arguments) - { - throw new Exception("Unknown method."); - } + public function __call($methodName, array $arguments) + { + throw new Exception("Unknown method."); + } } class B extends A { - public function x() - { - parent::_x(); - call_user_func('parent::_x'); - call_user_func(['parent', '_x']); - } + public function x() + { + parent::_x(); + call_user_func('parent::_x'); + call_user_func(['parent', '_x']); + } } $b = new B; diff --git a/Zend/tests/bug78999.phpt b/Zend/tests/bug78999.phpt index d4ec16b972..e44a38f077 100644 --- a/Zend/tests/bug78999.phpt +++ b/Zend/tests/bug78999.phpt @@ -3,9 +3,9 @@ Bug #78999 (Cycle leak when using function result as temporary) --FILE-- <?php function get() { - $t = new stdClass; - $t->prop = $t; - return $t; + $t = new stdClass; + $t->prop = $t; + return $t; } var_dump(get()); var_dump(gc_collect_cycles()); diff --git a/Zend/tests/bug79022.phpt b/Zend/tests/bug79022.phpt index 0657b20355..904195518e 100644 --- a/Zend/tests/bug79022.phpt +++ b/Zend/tests/bug79022.phpt @@ -4,31 +4,31 @@ Bug #79022 (class_exists returns True for classes that are not ready to be used) <?php function my_autoloader($class) { if (class_exists('Foo', 0)) { - new Foo(); + new Foo(); + } + if ($class == 'Foo') { + eval("class Foo extends Bar{}"); } - if ($class == 'Foo') { - eval("class Foo extends Bar{}"); - } - if ($class == 'Bar') { - eval("class Bar {}"); + if ($class == 'Bar') { + eval("class Bar {}"); } - if ($class == 'Dummy') { - eval ("class Dummy implements iFoo {}"); - } + if ($class == 'Dummy') { + eval ("class Dummy implements iFoo {}"); + } - if (interface_exists('iFoo', 0)) { - new Dummy(); - } - if ($class == 'iFoo') { - eval ("interface iFoo extends iBar {}"); - } + if (interface_exists('iFoo', 0)) { + new Dummy(); + } + if ($class == 'iFoo') { + eval ("interface iFoo extends iBar {}"); + } - if ($class == 'iBar') { - eval ("interface iBar {}"); - } + if ($class == 'iBar') { + eval ("interface iBar {}"); + } } spl_autoload_register('my_autoloader'); new Foo(); diff --git a/Zend/tests/bug79155.phpt b/Zend/tests/bug79155.phpt index be9488da86..d3b31436bd 100644 --- a/Zend/tests/bug79155.phpt +++ b/Zend/tests/bug79155.phpt @@ -4,8 +4,8 @@ Bug #79155: Property nullability lost when using multiple property definition <?php class Foo { - public ?string $a, $b; - public ?stdClass $c, $d; + public ?string $a, $b; + public ?stdClass $c, $d; } $t = new Foo; diff --git a/Zend/tests/call_static.phpt b/Zend/tests/call_static.phpt index 355a1570f3..4debb412dc 100644 --- a/Zend/tests/call_static.phpt +++ b/Zend/tests/call_static.phpt @@ -4,10 +4,10 @@ __callStatic() Magic method <?php class Test { - static function __callStatic($fname, $args) - { - echo $fname, '() called with ', count($args), " arguments\n"; - } + static function __callStatic($fname, $args) + { + echo $fname, '() called with ', count($args), " arguments\n"; + } } call_user_func("Test::Two", 'A', 'B'); diff --git a/Zend/tests/call_static_002.phpt b/Zend/tests/call_static_002.phpt index ac30636ded..3c633aa712 100644 --- a/Zend/tests/call_static_002.phpt +++ b/Zend/tests/call_static_002.phpt @@ -4,14 +4,14 @@ Testing __call and __callstatic with callbacks <?php class Foo { - public function __call($a, $b) { - print "nonstatic\n"; - var_dump($a); - } - static public function __callStatic($a, $b) { - print "static\n"; - var_dump($a); - } + public function __call($a, $b) { + print "nonstatic\n"; + var_dump($a); + } + static public function __callStatic($a, $b) { + print "static\n"; + var_dump($a); + } } $a = new Foo; diff --git a/Zend/tests/call_static_003.phpt b/Zend/tests/call_static_003.phpt index 566ff0fdf2..adfd1b3318 100644 --- a/Zend/tests/call_static_003.phpt +++ b/Zend/tests/call_static_003.phpt @@ -4,19 +4,19 @@ Testing method name case <?php class Foo { - public function __call($a, $b) { - print "nonstatic\n"; - var_dump($a); - } - static public function __callStatic($a, $b) { - print "static\n"; - var_dump($a); - } - public function test() { - $this->fOoBaR(); - self::foOBAr(); - $this::fOOBAr(); - } + public function __call($a, $b) { + print "nonstatic\n"; + var_dump($a); + } + static public function __callStatic($a, $b) { + print "static\n"; + var_dump($a); + } + public function test() { + $this->fOoBaR(); + self::foOBAr(); + $this::fOOBAr(); + } } $a = new Foo; diff --git a/Zend/tests/call_static_004.phpt b/Zend/tests/call_static_004.phpt index af53afb12b..af49b1b2a2 100644 --- a/Zend/tests/call_static_004.phpt +++ b/Zend/tests/call_static_004.phpt @@ -4,9 +4,9 @@ Invalid method name in dynamic static call <?php class foo { - static function __callstatic($a, $b) { - var_dump($a); - } + static function __callstatic($a, $b) { + var_dump($a); + } } foo::AaA(); diff --git a/Zend/tests/call_static_006.phpt b/Zend/tests/call_static_006.phpt index 946be2a3c9..2439f14893 100644 --- a/Zend/tests/call_static_006.phpt +++ b/Zend/tests/call_static_006.phpt @@ -4,9 +4,9 @@ Testing __callStatic <?php class foo { - static function __callstatic($a, $b) { - var_dump($a); - } + static function __callstatic($a, $b) { + var_dump($a); + } } foo::__construct(); diff --git a/Zend/tests/call_static_007.phpt b/Zend/tests/call_static_007.phpt index 419f102310..00ae448b9a 100644 --- a/Zend/tests/call_static_007.phpt +++ b/Zend/tests/call_static_007.phpt @@ -4,15 +4,15 @@ Testing __call and __callstatic <?php class a { - public function __call($a, $b) { - print "__call: ". $a ."\n"; - } - static public function __callStatic($a, $b) { - print "__callstatic: ". $a ."\n"; - } - public function baz() { - self::Bar(); - } + public function __call($a, $b) { + print "__call: ". $a ."\n"; + } + static public function __callStatic($a, $b) { + print "__callstatic: ". $a ."\n"; + } + public function baz() { + self::Bar(); + } } diff --git a/Zend/tests/call_user_func_001.phpt b/Zend/tests/call_user_func_001.phpt index a6e43f3060..3d2becdc78 100644 --- a/Zend/tests/call_user_func_001.phpt +++ b/Zend/tests/call_user_func_001.phpt @@ -4,30 +4,30 @@ Testing call_user_func inside namespace <?php namespace testing { - function foobar($str) { - var_dump($str); - } + function foobar($str) { + var_dump($str); + } - abstract class bar { - protected function prot($str) { - print "Shouldn't be called!\n"; - } - } - class foo extends bar { - private function priv($str) { - print "Shouldn't be called!\n"; - } - } + abstract class bar { + protected function prot($str) { + print "Shouldn't be called!\n"; + } + } + class foo extends bar { + private function priv($str) { + print "Shouldn't be called!\n"; + } + } - call_user_func(__NAMESPACE__ .'\foobar', 'foobar'); + call_user_func(__NAMESPACE__ .'\foobar', 'foobar'); - $class = __NAMESPACE__ .'\foo'; + $class = __NAMESPACE__ .'\foo'; try { call_user_func(array(new $class, 'priv'), 'foobar'); } catch (\TypeError $e) { echo $e->getMessage(), "\n"; } - try { + try { call_user_func(array(new $class, 'prot'), 'foobar'); } catch (\TypeError $e) { echo $e->getMessage(), "\n"; diff --git a/Zend/tests/call_user_func_003.phpt b/Zend/tests/call_user_func_003.phpt index 1aad22fba7..b501d803e7 100644 --- a/Zend/tests/call_user_func_003.phpt +++ b/Zend/tests/call_user_func_003.phpt @@ -4,15 +4,15 @@ Testing call_user_func() with closures <?php $foo = function() { - static $instance; + static $instance; - if (is_null($instance)) { - $instance = function () { - return 'OK!'; - }; - } + if (is_null($instance)) { + $instance = function () { + return 'OK!'; + }; + } - return $instance; + return $instance; }; var_dump(call_user_func(array($foo, '__invoke'))->__invoke()); diff --git a/Zend/tests/call_user_func_005.phpt b/Zend/tests/call_user_func_005.phpt index 13d69fd60d..fd130eb773 100644 --- a/Zend/tests/call_user_func_005.phpt +++ b/Zend/tests/call_user_func_005.phpt @@ -4,14 +4,14 @@ Passing Closure as parameter to an non-existent function <?php class foo { - public static function __callstatic($x, $y) { - var_dump($x,$y); - return 1; - } + public static function __callstatic($x, $y) { + var_dump($x,$y); + return 1; + } - public static function teste() { - return foo::x(function &($a=1,$b) { }); - } + public static function teste() { + return foo::x(function &($a=1,$b) { }); + } } var_dump(call_user_func(array('foo', 'teste'))); diff --git a/Zend/tests/cast_to_array.phpt b/Zend/tests/cast_to_array.phpt Binary files differindex 12261c8e84..f43879df5f 100644 --- a/Zend/tests/cast_to_array.phpt +++ b/Zend/tests/cast_to_array.phpt diff --git a/Zend/tests/cast_to_bool.phpt b/Zend/tests/cast_to_bool.phpt index ebb1df6dfd..ba25614bd2 100644 --- a/Zend/tests/cast_to_bool.phpt +++ b/Zend/tests/cast_to_bool.phpt @@ -6,32 +6,32 @@ casting different variables to boolean $r = fopen(__FILE__, "r"); class test { - function __toString() { - return "10"; - } + function __toString() { + return "10"; + } } $o = new test; $vars = array( - "string", - "8754456", - "", - "\0", - 9876545, - 0.10, - array(), - array(1,2,3), - false, - true, - NULL, - $r, - $o + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o ); foreach ($vars as $var) { - $tmp = (bool)$var; - var_dump($tmp); + $tmp = (bool)$var; + var_dump($tmp); } echo "Done\n"; diff --git a/Zend/tests/cast_to_double.phpt b/Zend/tests/cast_to_double.phpt index d2ee8ca1e9..6151c00f84 100644 --- a/Zend/tests/cast_to_double.phpt +++ b/Zend/tests/cast_to_double.phpt @@ -8,32 +8,32 @@ precision=14 $r = fopen(__FILE__, "r"); class test { - function __toString() { - return "10"; - } + function __toString() { + return "10"; + } } $o = new test; $vars = array( - "string", - "8754456", - "", - "\0", - 9876545, - 0.10, - array(), - array(1,2,3), - false, - true, - NULL, - $r, - $o + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o ); foreach ($vars as $var) { - $tmp = (double)$var; - var_dump($tmp); + $tmp = (double)$var; + var_dump($tmp); } echo "Done\n"; diff --git a/Zend/tests/cast_to_int.phpt b/Zend/tests/cast_to_int.phpt index 2a637e15e5..5dbab23fd2 100644 --- a/Zend/tests/cast_to_int.phpt +++ b/Zend/tests/cast_to_int.phpt @@ -6,32 +6,32 @@ casting different variables to integer $r = fopen(__FILE__, "r"); class test { - function __toString() { - return "10"; - } + function __toString() { + return "10"; + } } $o = new test; $vars = array( - "string", - "8754456", - "", - "\0", - 9876545, - 0.10, - array(), - array(1,2,3), - false, - true, - NULL, - $r, - $o + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o ); foreach ($vars as $var) { - $tmp = (int)$var; - var_dump($tmp); + $tmp = (int)$var; + var_dump($tmp); } echo "Done\n"; diff --git a/Zend/tests/cast_to_object.phpt b/Zend/tests/cast_to_object.phpt Binary files differindex b7e5f219f6..2b0d22a6ec 100644 --- a/Zend/tests/cast_to_object.phpt +++ b/Zend/tests/cast_to_object.phpt diff --git a/Zend/tests/cast_to_string.phpt b/Zend/tests/cast_to_string.phpt Binary files differindex cdff53c38f..1fb94dfa8d 100644 --- a/Zend/tests/cast_to_string.phpt +++ b/Zend/tests/cast_to_string.phpt diff --git a/Zend/tests/catch.phpt b/Zend/tests/catch.phpt index 2e61fef935..e7173d2621 100644 --- a/Zend/tests/catch.phpt +++ b/Zend/tests/catch.phpt @@ -4,8 +4,8 @@ catch shouldn't call autoloader <?php spl_autoload_register(function ($name) { - echo("AUTOLOAD '$name'\n"); - eval("class $name {}"); + echo("AUTOLOAD '$name'\n"); + eval("class $name {}"); }); try { @@ -16,7 +16,7 @@ try { throw new Exception(); } catch (B $e) { } catch (Exception $e) { - echo "ok\n"; + echo "ok\n"; } ?> --EXPECT-- diff --git a/Zend/tests/class_alias_005.phpt b/Zend/tests/class_alias_005.phpt index ecc96c8cfa..15f5b28d50 100644 --- a/Zend/tests/class_alias_005.phpt +++ b/Zend/tests/class_alias_005.phpt @@ -4,9 +4,9 @@ Testing static call method using the original class name <?php class foo { - static public function msg() { - print "hello\n"; - } + static public function msg() { + print "hello\n"; + } } interface test { } @@ -15,9 +15,9 @@ interface test { } class_alias('foo', 'baz'); class bar extends baz { - public function __construct() { - foo::msg(); - } + public function __construct() { + foo::msg(); + } } new bar; diff --git a/Zend/tests/class_alias_007.phpt b/Zend/tests/class_alias_007.phpt index edcc096ade..eb953dc15c 100644 --- a/Zend/tests/class_alias_007.phpt +++ b/Zend/tests/class_alias_007.phpt @@ -4,7 +4,7 @@ Testing class_alias() using autoload <?php spl_autoload_register(function ($a) { - class foo { } + class foo { } }); class_alias('foo', 'bar', 1); diff --git a/Zend/tests/class_alias_011.phpt b/Zend/tests/class_alias_011.phpt index 6db2ec7b58..ab1343e484 100644 --- a/Zend/tests/class_alias_011.phpt +++ b/Zend/tests/class_alias_011.phpt @@ -4,12 +4,12 @@ Testing callback in alias <?php class foo { - static public function test() { - print "hello\n"; - } - public function test2() { - print "foobar!\n"; - } + static public function test() { + print "hello\n"; + } + public function test2() { + print "foobar!\n"; + } } class_alias('FOO', 'bar'); diff --git a/Zend/tests/class_alias_017.phpt b/Zend/tests/class_alias_017.phpt index 555e776227..bc2eaf5467 100644 --- a/Zend/tests/class_alias_017.phpt +++ b/Zend/tests/class_alias_017.phpt @@ -4,12 +4,12 @@ Testing alias with get_called_class() and get_class() <?php class foo { - public function __construct() { - echo get_called_class(), "\n"; - } - static public function test() { - echo get_class(), "\n"; - } + public function __construct() { + echo get_called_class(), "\n"; + } + static public function test() { + echo get_class(), "\n"; + } } class_alias('foo', 'bar'); diff --git a/Zend/tests/class_constants_001.phpt b/Zend/tests/class_constants_001.phpt index 484157fe4b..68b4e289b8 100644 --- a/Zend/tests/class_constants_001.phpt +++ b/Zend/tests/class_constants_001.phpt @@ -4,8 +4,8 @@ class constants basic tests <?php class test { - const val = "string"; - const val2 = 1; + const val = "string"; + const val2 = 1; } var_dump(test::val); diff --git a/Zend/tests/class_constants_002.phpt b/Zend/tests/class_constants_002.phpt index 259c724372..c34b3620e1 100644 --- a/Zend/tests/class_constants_002.phpt +++ b/Zend/tests/class_constants_002.phpt @@ -4,15 +4,15 @@ class constants as default function arguments <?php class test { - const val = 1; + const val = 1; } function foo($v = test::val) { - var_dump($v); + var_dump($v); } function bar($b = NoSuchClass::val) { - var_dump($b); + var_dump($b); } foo(); diff --git a/Zend/tests/class_constants_003.phpt b/Zend/tests/class_constants_003.phpt index 3e61a8ab97..dcf94aaa0b 100644 --- a/Zend/tests/class_constants_003.phpt +++ b/Zend/tests/class_constants_003.phpt @@ -6,7 +6,7 @@ class constants as default function arguments and dynamically loaded classes $class_data = <<<DATA <?php class test { - const val = 1; + const val = 1; } ?> DATA; @@ -15,7 +15,7 @@ $filename = __DIR__."/cc003.dat"; file_put_contents($filename, $class_data); function foo($v = test::val) { - var_dump($v); + var_dump($v); } include $filename; diff --git a/Zend/tests/class_constants_004.phpt b/Zend/tests/class_constants_004.phpt index 1ca49ebdf0..7f1247e6fd 100644 --- a/Zend/tests/class_constants_004.phpt +++ b/Zend/tests/class_constants_004.phpt @@ -10,26 +10,26 @@ define('foo', 3); const foo = 1; class foo { - const foo = 2; + const foo = 2; } interface Ifoo { - const foo = 4; + const foo = 4; } $const = __NAMESPACE__ .'\\foo'; // class $const2 = __NAMESPACE__ .'\\Ifoo'; // interface var_dump( foo, - \foo\foo, - namespace\foo, - \foo\foo::foo, - $const::foo, - \foo, - constant('foo'), - Ifoo::foo, - $const2::foo - ); + \foo\foo, + namespace\foo, + \foo\foo::foo, + $const::foo, + \foo, + constant('foo'), + Ifoo::foo, + $const2::foo + ); ?> --EXPECT-- diff --git a/Zend/tests/class_properties_dynamic.phpt b/Zend/tests/class_properties_dynamic.phpt index 456bcf4a5b..db8ed9b7d0 100644 --- a/Zend/tests/class_properties_dynamic.phpt +++ b/Zend/tests/class_properties_dynamic.phpt @@ -3,9 +3,9 @@ Class Property Expressions --FILE-- <?php class Foo { - const BAR = 1 << 0; - const BAZ = 1 << 1; - public $bar = self::BAR | self::BAZ; + const BAR = 1 << 0; + const BAZ = 1 << 1; + public $bar = self::BAR | self::BAZ; } echo (new Foo)->bar; ?> diff --git a/Zend/tests/class_properties_static.phpt b/Zend/tests/class_properties_static.phpt index 9a56466340..309c0f7ef4 100644 --- a/Zend/tests/class_properties_static.phpt +++ b/Zend/tests/class_properties_static.phpt @@ -3,15 +3,15 @@ Static Class Property Expressions --FILE-- <?php class Foo { - public $b1 = 1 + 1; - public $b2 = 1 << 2; - public $b3 = "foo " . " bar " . " baz"; + public $b1 = 1 + 1; + public $b2 = 1 << 2; + public $b3 = "foo " . " bar " . " baz"; } $f = new Foo; var_dump( - $f->b1, - $f->b2, - $f->b3 + $f->b1, + $f->b2, + $f->b3 ); ?> --EXPECT-- diff --git a/Zend/tests/clone_004.phpt b/Zend/tests/clone_004.phpt index c97bb032c0..812eb6dfdd 100644 --- a/Zend/tests/clone_004.phpt +++ b/Zend/tests/clone_004.phpt @@ -4,9 +4,9 @@ Testing usage of object as array on clone statement <?php class foo { - public function __get($a) { - return new $this; - } + public function __get($a) { + return new $this; + } } $c = new foo; diff --git a/Zend/tests/closure_001.phpt b/Zend/tests/closure_001.phpt index 7385c42f12..1c379c8c49 100644 --- a/Zend/tests/closure_001.phpt +++ b/Zend/tests/closure_001.phpt @@ -4,11 +4,11 @@ Closure 001: Lambda without lexical variables <?php $lambda1 = function () { - echo "Hello World!\n"; + echo "Hello World!\n"; }; $lambda2 = function ($x) { - echo "Hello $x!\n"; + echo "Hello $x!\n"; }; var_dump(is_callable($lambda1)); diff --git a/Zend/tests/closure_002.phpt b/Zend/tests/closure_002.phpt index 023d4ecff1..80483f7994 100644 --- a/Zend/tests/closure_002.phpt +++ b/Zend/tests/closure_002.phpt @@ -6,11 +6,11 @@ Closure 002: Lambda with lexical variables (global scope) $x = 4; $lambda1 = function () use ($x) { - echo "$x\n"; + echo "$x\n"; }; $lambda2 = function () use (&$x) { - echo "$x\n"; + echo "$x\n"; }; $lambda1(); diff --git a/Zend/tests/closure_003.phpt b/Zend/tests/closure_003.phpt index 6f5cc70bf1..64a956ed4f 100644 --- a/Zend/tests/closure_003.phpt +++ b/Zend/tests/closure_003.phpt @@ -4,21 +4,21 @@ Closure 003: Lambda with lexical variables (local scope) <?php function run () { - $x = 4; + $x = 4; - $lambda1 = function () use ($x) { - echo "$x\n"; - }; + $lambda1 = function () use ($x) { + echo "$x\n"; + }; - $lambda2 = function () use (&$x) { - echo "$x\n"; - }; + $lambda2 = function () use (&$x) { + echo "$x\n"; + }; - $lambda1(); - $lambda2(); - $x++; - $lambda1(); - $lambda2(); + $lambda1(); + $lambda2(); + $x++; + $lambda1(); + $lambda2(); } run(); diff --git a/Zend/tests/closure_004.phpt b/Zend/tests/closure_004.phpt index c1c2efb25c..c3de1372e9 100644 --- a/Zend/tests/closure_004.phpt +++ b/Zend/tests/closure_004.phpt @@ -4,18 +4,18 @@ Closure 004: Lambda with lexical variables (scope lifetime) <?php function run () { - $x = 4; + $x = 4; - $lambda1 = function () use ($x) { - echo "$x\n"; - }; + $lambda1 = function () use ($x) { + echo "$x\n"; + }; - $lambda2 = function () use (&$x) { - echo "$x\n"; - $x++; - }; + $lambda2 = function () use (&$x) { + echo "$x\n"; + $x++; + }; - return array($lambda1, $lambda2); + return array($lambda1, $lambda2); } list ($lambda1, $lambda2) = run(); diff --git a/Zend/tests/closure_005.phpt b/Zend/tests/closure_005.phpt index b3be877216..52b8d49059 100644 --- a/Zend/tests/closure_005.phpt +++ b/Zend/tests/closure_005.phpt @@ -4,37 +4,37 @@ Closure 005: Lambda inside class, lifetime of $this <?php class A { - private $x; - - function __construct($x) { - $this->x = $x; - } - - function __destruct() { - echo "Destroyed\n"; - } - - function getIncer($val) { - return function() use ($val) { - $this->x += $val; - }; - } - - function getPrinter() { - return function() { - echo $this->x."\n"; - }; - } - - function getError() { - return static function() { - echo $this->x."\n"; - }; - } - - function printX() { - echo $this->x."\n"; - } + private $x; + + function __construct($x) { + $this->x = $x; + } + + function __destruct() { + echo "Destroyed\n"; + } + + function getIncer($val) { + return function() use ($val) { + $this->x += $val; + }; + } + + function getPrinter() { + return function() { + echo $this->x."\n"; + }; + } + + function getError() { + return static function() { + echo $this->x."\n"; + }; + } + + function printX() { + echo $this->x."\n"; + } } $a = new A(3); diff --git a/Zend/tests/closure_006.phpt b/Zend/tests/closure_006.phpt index aa0ec11995..a3707cb1f7 100644 --- a/Zend/tests/closure_006.phpt +++ b/Zend/tests/closure_006.phpt @@ -4,9 +4,9 @@ Closure 006: Nested lambdas <?php $getClosure = function ($v) { - return function () use ($v) { - echo "Hello World: $v!\n"; - }; + return function () use ($v) { + echo "Hello World: $v!\n"; + }; }; $closure = $getClosure (2); diff --git a/Zend/tests/closure_007.phpt b/Zend/tests/closure_007.phpt index 89cd06d8a1..f484b56a35 100644 --- a/Zend/tests/closure_007.phpt +++ b/Zend/tests/closure_007.phpt @@ -4,19 +4,19 @@ Closure 007: Nested lambdas in classes <?php class A { - private $x = 0; + private $x = 0; - function getClosureGetter () { - return function () { - return function () { - $this->x++; - }; - }; - } + function getClosureGetter () { + return function () { + return function () { + $this->x++; + }; + }; + } - function printX () { - echo $this->x."\n"; - } + function printX () { + echo $this->x."\n"; + } } $a = new A; diff --git a/Zend/tests/closure_008.phpt b/Zend/tests/closure_008.phpt index 64c7e659e6..238bbea002 100644 --- a/Zend/tests/closure_008.phpt +++ b/Zend/tests/closure_008.phpt @@ -4,10 +4,10 @@ Closure 008: Use in preg_replace_callback() <?php function replace_spaces($text) { - $lambda = function ($matches) { - return str_replace(' ', ' ', $matches[1]).' '; - }; - return preg_replace_callback('/( +) /', $lambda, $text); + $lambda = function ($matches) { + return str_replace(' ', ' ', $matches[1]).' '; + }; + return preg_replace_callback('/( +) /', $lambda, $text); } echo replace_spaces("1 2 3\n"); diff --git a/Zend/tests/closure_013.phpt b/Zend/tests/closure_013.phpt index 72d2b3f963..42622916af 100644 --- a/Zend/tests/closure_013.phpt +++ b/Zend/tests/closure_013.phpt @@ -3,15 +3,15 @@ Closure 013: __invoke() on temporary result --FILE-- <?php class Foo { - function __invoke() { - echo "Hello World!\n"; - } + function __invoke() { + echo "Hello World!\n"; + } } function foo() { - return function() { - echo "Hello World!\n"; - }; + return function() { + echo "Hello World!\n"; + }; } $test = new Foo; $test->__invoke(); diff --git a/Zend/tests/closure_014.phpt b/Zend/tests/closure_014.phpt index 9e4819b9dd..fbd1109dc8 100644 --- a/Zend/tests/closure_014.phpt +++ b/Zend/tests/closure_014.phpt @@ -3,18 +3,18 @@ Closure 014: return by value/reference --FILE-- <?php class C1 { - function __invoke() { - return 0; - } + function __invoke() { + return 0; + } } class C2 { - function &__invoke(&$a) { - return $a; - } + function &__invoke(&$a) { + return $a; + } } class C3 { - function __invoke() { - } + function __invoke() { + } } $x = new C1(); @@ -23,7 +23,7 @@ var_dump($x->__invoke()); $x(); $x->__invoke(); $x = function() { - return 0; + return 0; }; var_dump($x()); var_dump($x->__invoke()); @@ -41,7 +41,7 @@ var_dump($b); $x($b); $x->__invoke($b); $x = function & (&$a) { - return $a; + return $a; }; $e =& $x($c); $e = 4; diff --git a/Zend/tests/closure_016.phpt b/Zend/tests/closure_016.phpt index ae0036586c..0f87f20f43 100644 --- a/Zend/tests/closure_016.phpt +++ b/Zend/tests/closure_016.phpt @@ -3,15 +3,15 @@ Closure 016: closures and is_callable() --FILE-- <?php class Foo { - function __invoke() { - echo "Hello World!\n"; - } + function __invoke() { + echo "Hello World!\n"; + } } function foo() { - return function() { - echo "Hello World!\n"; - }; + return function() { + echo "Hello World!\n"; + }; } $test = new Foo; var_dump(is_callable($test, true, $name)); diff --git a/Zend/tests/closure_018.phpt b/Zend/tests/closure_018.phpt index 0241d3e8ee..9afef5b7c4 100644 --- a/Zend/tests/closure_018.phpt +++ b/Zend/tests/closure_018.phpt @@ -4,13 +4,13 @@ Closure 018: Assigning lambda to static var and returning by ref <?php class foo { - public function test(&$x) { - static $lambda; - $lambda = function &() use (&$x) { - return $x = $x * $x; - }; - return $lambda(); - } + public function test(&$x) { + static $lambda; + $lambda = function &() use (&$x) { + return $x = $x * $x; + }; + return $lambda(); + } } $test = new foo; diff --git a/Zend/tests/closure_019.phpt b/Zend/tests/closure_019.phpt index 22aaec1bba..05efffb9d4 100644 --- a/Zend/tests/closure_019.phpt +++ b/Zend/tests/closure_019.phpt @@ -4,16 +4,16 @@ Closure 019: Calling lambda using $GLOBALS and global $var <?php $lambda = function &(&$x) { - return $x = $x * $x; + return $x = $x * $x; }; function test() { - global $lambda; + global $lambda; - $y = 3; - var_dump($GLOBALS['lambda']($y)); - var_dump($lambda($y)); - var_dump($GLOBALS['lambda'](1)); + $y = 3; + var_dump($GLOBALS['lambda']($y)); + var_dump($lambda($y)); + var_dump($GLOBALS['lambda'](1)); } test(); diff --git a/Zend/tests/closure_020.phpt b/Zend/tests/closure_020.phpt index 9325e020c3..7d98dd2dc6 100644 --- a/Zend/tests/closure_020.phpt +++ b/Zend/tests/closure_020.phpt @@ -4,17 +4,17 @@ Closure 020: Trying to access private property outside class <?php class foo { - private $test = 3; + private $test = 3; - public function x() { - $a = &$this; - $this->a = function() use (&$a) { return $a; }; - var_dump($this->a->__invoke()); - var_dump(is_a($this->a, 'closure')); - var_dump(is_callable($this->a)); + public function x() { + $a = &$this; + $this->a = function() use (&$a) { return $a; }; + var_dump($this->a->__invoke()); + var_dump(is_a($this->a, 'closure')); + var_dump(is_callable($this->a)); - return $this->a; - } + return $this->a; + } } $foo = new foo; diff --git a/Zend/tests/closure_021.phpt b/Zend/tests/closure_021.phpt index 76be762f08..95ff7d889f 100644 --- a/Zend/tests/closure_021.phpt +++ b/Zend/tests/closure_021.phpt @@ -4,17 +4,17 @@ Closure 021: Throwing exception inside lambda <?php $foo = function() { - try { - throw new Exception('test!'); - } catch(Exception $e) { - throw $e; - } + try { + throw new Exception('test!'); + } catch(Exception $e) { + throw $e; + } }; try { - $foo(); + $foo(); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> diff --git a/Zend/tests/closure_026.phpt b/Zend/tests/closure_026.phpt index 50c850e787..62702a5e03 100644 --- a/Zend/tests/closure_026.phpt +++ b/Zend/tests/closure_026.phpt @@ -4,17 +4,17 @@ Closure 026: Assigning a closure object to an array in $this <?php class foo { - public function __construct() { - $a =& $this; + public function __construct() { + $a =& $this; - $a->a[] = function() { - return 1; - }; + $a->a[] = function() { + return 1; + }; - var_dump($this); + var_dump($this); - var_dump($this->a[0]()); - } + var_dump($this->a[0]()); + } } $x = new foo; @@ -22,8 +22,8 @@ $x = new foo; print "--------------\n"; foreach ($x as $b => $c) { - var_dump($b, $c); - var_dump($c[0]()); + var_dump($b, $c); + var_dump($c[0]()); } ?> diff --git a/Zend/tests/closure_027.phpt b/Zend/tests/closure_027.phpt index 9fc29a4f18..ab5fde2026 100644 --- a/Zend/tests/closure_027.phpt +++ b/Zend/tests/closure_027.phpt @@ -4,7 +4,7 @@ Closure 027: Testing Closure type-hint <?php function test(closure $a) { - var_dump($a()); + var_dump($a()); } @@ -14,9 +14,9 @@ test(function() { }); $a = function($x) use ($y) {}; try { - test($a); + test($a); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } test(new stdclass); diff --git a/Zend/tests/closure_028.phpt b/Zend/tests/closure_028.phpt index c28849f448..2449f2bfdc 100644 --- a/Zend/tests/closure_028.phpt +++ b/Zend/tests/closure_028.phpt @@ -4,7 +4,7 @@ Closure 028: Trying to use lambda directly in foreach <?php foreach (function(){ return 1; } as $y) { - var_dump($y); + var_dump($y); } print "ok\n"; diff --git a/Zend/tests/closure_031.phpt b/Zend/tests/closure_031.phpt index 042bf8c145..e757f67748 100644 --- a/Zend/tests/closure_031.phpt +++ b/Zend/tests/closure_031.phpt @@ -3,15 +3,15 @@ Closure 031: Closure properties with custom error handlers --FILE-- <?php function foo($errno, $errstr, $errfile, $errline) { - echo "Error: $errstr\n"; + echo "Error: $errstr\n"; } set_error_handler('foo'); $foo = function() { }; try { - var_dump($foo->a); + var_dump($foo->a); } catch (Error $ex) { - echo "Error: {$ex->getMessage()}\n"; + echo "Error: {$ex->getMessage()}\n"; } ?> --EXPECT-- diff --git a/Zend/tests/closure_033.phpt b/Zend/tests/closure_033.phpt index c83a53898d..d86f590682 100644 --- a/Zend/tests/closure_033.phpt +++ b/Zend/tests/closure_033.phpt @@ -4,15 +4,15 @@ Closure 033: Dynamic closure property and private function <?php class Test { - public $func; - function __construct() { - $this->func = function() { - echo __METHOD__ . "()\n"; - }; - } - private function func() { - echo __METHOD__ . "()\n"; - } + public $func; + function __construct() { + $this->func = function() { + echo __METHOD__ . "()\n"; + }; + } + private function func() { + echo __METHOD__ . "()\n"; + } } $o = new Test; diff --git a/Zend/tests/closure_035.phpt b/Zend/tests/closure_035.phpt index d06d0bb25b..14c11a8219 100644 --- a/Zend/tests/closure_035.phpt +++ b/Zend/tests/closure_035.phpt @@ -4,11 +4,11 @@ Testing recursion detection with Closures <?php $x = function () use (&$x) { - $h = function () use ($x) { - var_dump($x); - return 1; - }; - return $h(); + $h = function () use ($x) { + var_dump($x); + return 1; + }; + return $h(); }; var_dump($x()); diff --git a/Zend/tests/closure_036.phpt b/Zend/tests/closure_036.phpt index 9123a1ba47..555a195faa 100644 --- a/Zend/tests/closure_036.phpt +++ b/Zend/tests/closure_036.phpt @@ -4,15 +4,15 @@ Closure 036: Rebinding closures, keep calling scope <?php class A { - private $x; + private $x; - public function __construct($v) { - $this->x = $v; - } + public function __construct($v) { + $this->x = $v; + } - public function getIncrementor() { - return function() { return ++$this->x; }; - } + public function getIncrementor() { + return function() { return ++$this->x; }; + } } $a = new A(0); diff --git a/Zend/tests/closure_037.phpt b/Zend/tests/closure_037.phpt index 1257d6bc7e..ba4cfd6464 100644 --- a/Zend/tests/closure_037.phpt +++ b/Zend/tests/closure_037.phpt @@ -3,30 +3,30 @@ Closure 037: self:: and static:: within closures --FILE-- <?php class A { - private $x = 0; + private $x = 0; - function getClosure () { - return function () { - $this->x++; - self::printX(); - self::print42(); - static::print42(); - }; - } + function getClosure () { + return function () { + $this->x++; + self::printX(); + self::print42(); + static::print42(); + }; + } - function printX () { - echo $this->x."\n"; - } + function printX () { + echo $this->x."\n"; + } - function print42() { - echo "42\n"; - } + function print42() { + echo "42\n"; + } } class B extends A { - function print42() { - echo "forty two\n"; - } + function print42() { + echo "forty two\n"; + } } $a = new A; diff --git a/Zend/tests/closure_038.phpt b/Zend/tests/closure_038.phpt index d1ec446c9d..b89ff93c4f 100644 --- a/Zend/tests/closure_038.phpt +++ b/Zend/tests/closure_038.phpt @@ -4,22 +4,22 @@ Closure 038: Rebinding closures, change scope, different runtime type <?php class A { - private $x; + private $x; - public function __construct($v) { - $this->x = $v; - } + public function __construct($v) { + $this->x = $v; + } - public function getIncrementor() { - return function() { return ++$this->x; }; - } + public function getIncrementor() { + return function() { return ++$this->x; }; + } } class B extends A { - private $x; - public function __construct($v) { - parent::__construct($v); - $this->x = $v*2; - } + private $x; + public function __construct($v) { + parent::__construct($v); + $this->x = $v*2; + } } $a = new A(0); diff --git a/Zend/tests/closure_039.phpt b/Zend/tests/closure_039.phpt index fa454c38c4..760ad716e5 100644 --- a/Zend/tests/closure_039.phpt +++ b/Zend/tests/closure_039.phpt @@ -4,22 +4,22 @@ Closure 039: Rebinding closures, change scope, same runtime type <?php class A { - private $x; + private $x; - public function __construct($v) { - $this->x = $v; - } + public function __construct($v) { + $this->x = $v; + } - public function getIncrementor() { - return function() { return ++$this->x; }; - } + public function getIncrementor() { + return function() { return ++$this->x; }; + } } class B extends A { - private $x; - public function __construct($v) { - parent::__construct($v); - $this->x = $v*2; - } + private $x; + public function __construct($v) { + parent::__construct($v); + $this->x = $v*2; + } } $a = new B(-5); diff --git a/Zend/tests/closure_040.phpt b/Zend/tests/closure_040.phpt index a5f52e70b0..9c59e798f7 100644 --- a/Zend/tests/closure_040.phpt +++ b/Zend/tests/closure_040.phpt @@ -4,19 +4,19 @@ Closure 040: Rebinding closures, bad arguments <?php class A { - private $x; - private static $xs = 10; - - public function __construct($v) { - $this->x = $v; - } - - public function getIncrementor() { - return function() { return ++$this->x; }; - } - public function getStaticIncrementor() { - return static function() { return ++static::$xs; }; - } + private $x; + private static $xs = 10; + + public function __construct($v) { + $this->x = $v; + } + + public function getIncrementor() { + return function() { return ++$this->x; }; + } + public function getStaticIncrementor() { + return static function() { return ++static::$xs; }; + } } $a = new A(20); diff --git a/Zend/tests/closure_041.phpt b/Zend/tests/closure_041.phpt index 42fc55dfe7..20e5217095 100644 --- a/Zend/tests/closure_041.phpt +++ b/Zend/tests/closure_041.phpt @@ -8,29 +8,29 @@ Closure 041: Rebinding: preservation of previous scope when not given as arg unl * to having a bound instance. */ $staticUnscoped = static function () { - echo "scoped to A: "; var_dump(isset(A::$priv)); - echo "bound: ", isset($this)?get_class($this):"no"; + echo "scoped to A: "; var_dump(isset(A::$priv)); + echo "bound: ", isset($this)?get_class($this):"no"; }; $nonstaticUnscoped = function () { - echo "scoped to A: "; var_dump(isset(A::$priv)); - echo "bound: ", isset($this)?get_class($this):"no"; + echo "scoped to A: "; var_dump(isset(A::$priv)); + echo "bound: ", isset($this)?get_class($this):"no"; }; class A { - private static $priv = 7; - function getClosure() { - return function () { - echo "scoped to A: "; var_dump(isset(A::$priv)); - echo "bound: ", isset($this)?get_class($this):"no"; - }; - } - function getStaticClosure() { - return static function () { - echo "scoped to A: "; var_dump(isset(A::$priv)); - echo "bound: ", isset($this)?get_class($this):"no"; - }; - } + private static $priv = 7; + function getClosure() { + return function () { + echo "scoped to A: "; var_dump(isset(A::$priv)); + echo "bound: ", isset($this)?get_class($this):"no"; + }; + } + function getStaticClosure() { + return static function () { + echo "scoped to A: "; var_dump(isset(A::$priv)); + echo "bound: ", isset($this)?get_class($this):"no"; + }; + } } class B extends A {} diff --git a/Zend/tests/closure_043.phpt b/Zend/tests/closure_043.phpt index 2390aa153b..13c3e519b9 100644 --- a/Zend/tests/closure_043.phpt +++ b/Zend/tests/closure_043.phpt @@ -9,10 +9,10 @@ Closure 043: Scope/bounding combination invariants; static closures $staticUnscoped = static function () { var_dump(isset(A::$priv)); var_dump(isset($this)); }; class A { - private static $priv = 7; - static function getStaticClosure() { - return static function() { var_dump(isset(A::$priv)); var_dump(isset($this)); }; - } + private static $priv = 7; + static function getStaticClosure() { + return static function() { var_dump(isset(A::$priv)); var_dump(isset($this)); }; + } } $staticScoped = A::getStaticClosure(); diff --git a/Zend/tests/closure_044.phpt b/Zend/tests/closure_044.phpt index a848c0b17a..e886f5e764 100644 --- a/Zend/tests/closure_044.phpt +++ b/Zend/tests/closure_044.phpt @@ -8,10 +8,10 @@ Closure 044: Scope/bounding combination invariants; non static closures $nonstaticUnscoped = function () { var_dump(isset(A::$priv)); var_dump(isset($this)); }; class A { - private static $priv = 7; - function getClosure() { - return function() { var_dump(isset(A::$priv)); var_dump(isset($this)); }; - } + private static $priv = 7; + function getClosure() { + return function() { var_dump(isset(A::$priv)); var_dump(isset($this)); }; + } } $a = new A(); diff --git a/Zend/tests/closure_046.phpt b/Zend/tests/closure_046.phpt index 7d94df33b6..5f0a0ba160 100644 --- a/Zend/tests/closure_046.phpt +++ b/Zend/tests/closure_046.phpt @@ -10,10 +10,10 @@ Closure 046: Rebinding: preservation of previous scope when "static" given as sc $nonstaticUnscoped = function () { var_dump(isset(A::$priv)); var_dump(isset($this)); }; class A { - private static $priv = 7; - function getClosure() { - return function() { var_dump(isset(A::$priv)); var_dump(isset($this)); }; - } + private static $priv = 7; + function getClosure() { + return function() { var_dump(isset(A::$priv)); var_dump(isset($this)); }; + } } class B extends A {} diff --git a/Zend/tests/closure_047.phpt b/Zend/tests/closure_047.phpt index 736793448d..60d7916198 100644 --- a/Zend/tests/closure_047.phpt +++ b/Zend/tests/closure_047.phpt @@ -5,13 +5,13 @@ Closure 047: Use in preg_replace_callback() using variables by reference function replace_variables($text, $params) { - preg_replace_callback( '/(\?)/', function($matches) use (&$params, &$text) { + preg_replace_callback( '/(\?)/', function($matches) use (&$params, &$text) { - $text = preg_replace( '/(\?)/', array_shift( $params ), $text, 1 ); + $text = preg_replace( '/(\?)/', array_shift( $params ), $text, 1 ); - }, $text ); + }, $text ); - return $text; + return $text; } echo replace_variables('a=?', array('0')) . "\n"; diff --git a/Zend/tests/closure_048.phpt b/Zend/tests/closure_048.phpt index 47781641a8..8365109934 100644 --- a/Zend/tests/closure_048.phpt +++ b/Zend/tests/closure_048.phpt @@ -5,13 +5,13 @@ Closure 048: Use in preg_replace_callback() using variables by reference function replace_variables($text, $params) { - $c = function($matches) use (&$params, &$text) { - $text = preg_replace( '/(\?)/', array_shift( $params ), $text, 1 ); - }; + $c = function($matches) use (&$params, &$text) { + $text = preg_replace( '/(\?)/', array_shift( $params ), $text, 1 ); + }; - preg_replace_callback( '/(\?)/', $c, $text ); + preg_replace_callback( '/(\?)/', $c, $text ); - return $text; + return $text; } echo replace_variables('a=?', array('0')) . "\n"; diff --git a/Zend/tests/closure_057.phpt b/Zend/tests/closure_057.phpt index f0062244d2..db998c5184 100644 --- a/Zend/tests/closure_057.phpt +++ b/Zend/tests/closure_057.phpt @@ -6,12 +6,12 @@ class A { } function getfunc() { - $b = function() { - $a = function() { - }; - $a(); - }; - return $b->bindTo(new A()); + $b = function() { + $a = function() { + }; + $a(); + }; + return $b->bindTo(new A()); } call_user_func(getfunc()); diff --git a/Zend/tests/closure_058.phpt b/Zend/tests/closure_058.phpt index 128661f4fc..2a83778954 100644 --- a/Zend/tests/closure_058.phpt +++ b/Zend/tests/closure_058.phpt @@ -3,12 +3,12 @@ Closure 058: Closure scope and object --FILE-- <?php class A { - static function foo() { - return function () {var_dump(get_class(),get_called_class());}; - } - function bar() { - return function () {var_dump(get_class(),get_called_class(),$this);}; - } + static function foo() { + return function () {var_dump(get_class(),get_called_class());}; + } + function bar() { + return function () {var_dump(get_class(),get_called_class(),$this);}; + } } $z = "call_user_func"; diff --git a/Zend/tests/closure_059.phpt b/Zend/tests/closure_059.phpt index 299d8f5d9d..68fd10321f 100644 --- a/Zend/tests/closure_059.phpt +++ b/Zend/tests/closure_059.phpt @@ -18,19 +18,19 @@ $f->__invoke($a); call_user_func(array($f,"__invoke"), $a); try { - $f($b); + $f($b); } catch (Error $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } try { - $f->__invoke($b); + $f->__invoke($b); } catch (Error $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } try { - call_user_func(array($f,"__invoke"), $b); + call_user_func(array($f,"__invoke"), $b); } catch (Error $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } --EXPECTF-- Exception: Argument 1 passed to {closure}() must be an instance of A, instance of B %s diff --git a/Zend/tests/closure_060.phpt b/Zend/tests/closure_060.phpt index f03160dab9..9762318469 100644 --- a/Zend/tests/closure_060.phpt +++ b/Zend/tests/closure_060.phpt @@ -4,13 +4,13 @@ runtime cache must be invalidated for Closure::call() <?php class A { - private static $priv = 7; + private static $priv = 7; - static function get() { - return function() { - var_dump(isset(A::$priv)); - }; - } + static function get() { + return function() { + var_dump(isset(A::$priv)); + }; + } } $closure = A::get(); diff --git a/Zend/tests/closure_call_leak_with_exception.phpt b/Zend/tests/closure_call_leak_with_exception.phpt index f6545ee520..420dd9a735 100644 --- a/Zend/tests/closure_call_leak_with_exception.phpt +++ b/Zend/tests/closure_call_leak_with_exception.phpt @@ -4,8 +4,8 @@ Closure must not leak during a dynamic call interrupted by an exception <?php (function() { - $closure = function($foo) { var_dump($foo); }; - $closure(yield); + $closure = function($foo) { var_dump($foo); }; + $closure(yield); })()->valid(); // start ?> diff --git a/Zend/tests/closures/closure_from_callable.inc b/Zend/tests/closures/closure_from_callable.inc index cef6105ec1..d691ef1757 100644 --- a/Zend/tests/closures/closure_from_callable.inc +++ b/Zend/tests/closures/closure_from_callable.inc @@ -2,186 +2,186 @@ function bar($param1) { - return $param1; + return $param1; } $closure = function($param1) { - return $param1; + return $param1; }; function test($fn) { - static $count = 0; - $input = "foo".$count; - $count++; + static $count = 0; + $input = "foo".$count; + $count++; - $output = $fn($input); - return $input === $output; + $output = $fn($input); + return $input === $output; } class Foo { - public static function publicStaticFunction($param1) - { - return $param1; - } - - private static function privateStaticFunction($param1) - { - return $param1; - } - - protected static function protectedStaticFunction($param1) - { - return $param1; - } - - private function privateInstanceFunc($param1) - { - return $param1; - } - - protected function protectedInstanceFunc($param1) - { - return $param1; - } - - - public function publicInstanceFunc($param1) - { - return $param1; - } - - public function closePrivateValid() - { - return Closure::fromCallable([$this, 'privateInstanceFunc']); - } - - public function closePrivateStatic() - { - return Closure::fromCallable([__CLASS__, 'privateStaticFunction']); - } - - public function bar($param1) - { - echo "this is bar\n"; - } - - public function getCallable() - { - return Closure::fromCallable([$this, 'publicInstanceFunc']); - } - - public function getSelfPublicInstance() - { - return Closure::fromCallable([$this, 'publicInstanceFunc']); - } - - public function getSelfColonPublicInstanceMethod() - { - return Closure::fromCallable('self::publicInstanceFunc'); - } + public static function publicStaticFunction($param1) + { + return $param1; + } + + private static function privateStaticFunction($param1) + { + return $param1; + } + + protected static function protectedStaticFunction($param1) + { + return $param1; + } + + private function privateInstanceFunc($param1) + { + return $param1; + } + + protected function protectedInstanceFunc($param1) + { + return $param1; + } + + + public function publicInstanceFunc($param1) + { + return $param1; + } + + public function closePrivateValid() + { + return Closure::fromCallable([$this, 'privateInstanceFunc']); + } + + public function closePrivateStatic() + { + return Closure::fromCallable([__CLASS__, 'privateStaticFunction']); + } + + public function bar($param1) + { + echo "this is bar\n"; + } + + public function getCallable() + { + return Closure::fromCallable([$this, 'publicInstanceFunc']); + } + + public function getSelfPublicInstance() + { + return Closure::fromCallable([$this, 'publicInstanceFunc']); + } + + public function getSelfColonPublicInstanceMethod() + { + return Closure::fromCallable('self::publicInstanceFunc'); + } } class SubFoo extends Foo { - public function closePrivateStaticInvalid() - { - return Closure::fromCallable([__CLASS__, 'privateStaticFunction']); - } + public function closePrivateStaticInvalid() + { + return Closure::fromCallable([__CLASS__, 'privateStaticFunction']); + } - public function closePrivateInvalid() - { - return Closure::fromCallable([$this, 'privateInstanceFunc']); - } + public function closePrivateInvalid() + { + return Closure::fromCallable([$this, 'privateInstanceFunc']); + } - public function closeProtectedStaticMethod() - { - return Closure::fromCallable([__CLASS__, 'protectedStaticFunction']); - } + public function closeProtectedStaticMethod() + { + return Closure::fromCallable([__CLASS__, 'protectedStaticFunction']); + } - public function closeProtectedValid() - { - return Closure::fromCallable([$this, 'protectedInstanceFunc']); - } + public function closeProtectedValid() + { + return Closure::fromCallable([$this, 'protectedInstanceFunc']); + } - public function getParentPublicInstanceMethod() - { - return Closure::fromCallable('parent::publicInstanceFunc'); - } + public function getParentPublicInstanceMethod() + { + return Closure::fromCallable('parent::publicInstanceFunc'); + } - public function getSelfColonParentPublicInstanceMethod() - { - return Closure::fromCallable('self::publicInstanceFunc'); - } + public function getSelfColonParentPublicInstanceMethod() + { + return Closure::fromCallable('self::publicInstanceFunc'); + } - public function getSelfColonParentProtectedInstanceMethod() - { - return Closure::fromCallable('self::protectedInstanceFunc'); - } + public function getSelfColonParentProtectedInstanceMethod() + { + return Closure::fromCallable('self::protectedInstanceFunc'); + } - public function getSelfColonParentPrivateInstanceMethod() - { - return Closure::fromCallable('self::privateInstanceFunc'); - } + public function getSelfColonParentPrivateInstanceMethod() + { + return Closure::fromCallable('self::privateInstanceFunc'); + } } class MagicCall { - public function __call($name, $arguments) - { - $info = ['__call']; - $info[] = $name; - $info = array_merge($info, $arguments); - return implode(',', $info); - } - - public static function __callStatic($name, $arguments) - { - $info = ['__callStatic']; - $info[] = $name; - $info = array_merge($info, $arguments); - return implode(',', $info); - } + public function __call($name, $arguments) + { + $info = ['__call']; + $info[] = $name; + $info = array_merge($info, $arguments); + return implode(',', $info); + } + + public static function __callStatic($name, $arguments) + { + $info = ['__callStatic']; + $info[] = $name; + $info = array_merge($info, $arguments); + return implode(',', $info); + } } class PublicInvocable { - public function __invoke($param1) - { - return $param1; - } + public function __invoke($param1) + { + return $param1; + } } function functionAccessProtected() { - $foo = new Foo; + $foo = new Foo; - return Closure::fromCallable([$foo, 'protectedStaticFunction']); + return Closure::fromCallable([$foo, 'protectedStaticFunction']); } function functionAccessPrivate() { - $foo = new Foo; + $foo = new Foo; - return Closure::fromCallable([$foo, 'privateStaticFunction']); + return Closure::fromCallable([$foo, 'privateStaticFunction']); } function functionAccessMethodDoesntExist() { - $foo = new Foo; + $foo = new Foo; - return Closure::fromCallable([$foo, 'thisDoesNotExist']); + return Closure::fromCallable([$foo, 'thisDoesNotExist']); } ?> diff --git a/Zend/tests/closures/closure_from_callable_error.phpt b/Zend/tests/closures/closure_from_callable_error.phpt index 5ada0ef2bf..5d1e078c1e 100644 --- a/Zend/tests/closures/closure_from_callable_error.phpt +++ b/Zend/tests/closures/closure_from_callable_error.phpt @@ -7,187 +7,187 @@ include('closure_from_callable.inc'); echo 'Cannot access privateInstance method statically'."\n"; try { - $fn = Closure::fromCallable(['Foo', 'privateInstanceFunc']); - echo "Test failed to fail and return was : ".var_export($fn, true)."\n"; + $fn = Closure::fromCallable(['Foo', 'privateInstanceFunc']); + echo "Test failed to fail and return was : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Cannot access privateInstance method statically with colon scheme'."\n"; try { - $fn = Closure::fromCallable('Foo::privateInstanceFunc'); - echo "Test failed to fail and return was : ".var_export($fn, true)."\n"; + $fn = Closure::fromCallable('Foo::privateInstanceFunc'); + echo "Test failed to fail and return was : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Cannot access privateInstance method'."\n"; try { - $fn = Closure::fromCallable([new Foo, 'privateInstanceFunc']); - echo "Test failed to fail and return was : ".var_export($fn, true)."\n"; + $fn = Closure::fromCallable([new Foo, 'privateInstanceFunc']); + echo "Test failed to fail and return was : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'SubClass cannot access private instance method'."\n"; try { - $fn = Closure::fromCallable([new SubFoo, 'privateInstanceFunc']); - echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; + $fn = Closure::fromCallable([new SubFoo, 'privateInstanceFunc']); + echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Cannot access private static function of instance'."\n"; try { - $fn = Closure::fromCallable([new Foo, 'privateStaticFunction']); - echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; + $fn = Closure::fromCallable([new Foo, 'privateStaticFunction']); + echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Cannot access private static method statically'."\n"; try { - $fn = Closure::fromCallable(['Foo', 'privateStaticFunction']); - echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; + $fn = Closure::fromCallable(['Foo', 'privateStaticFunction']); + echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Cannot access private static method statically with colon scheme'."\n"; try { - $fn = Closure::fromCallable('Foo::privateStaticFunction'); - echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; + $fn = Closure::fromCallable('Foo::privateStaticFunction'); + echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Non-existent method should fail'."\n"; try { - $fn = Closure::fromCallable('Foo::nonExistentFunction'); - echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; + $fn = Closure::fromCallable('Foo::nonExistentFunction'); + echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Non-existent class should fail'."\n"; try { - $fn = Closure::fromCallable(['NonExistentClass', 'foo']); - echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; + $fn = Closure::fromCallable(['NonExistentClass', 'foo']); + echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Non-existent function should fail'."\n"; try { - $fn = Closure::fromCallable('thisDoesNotExist'); - echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; + $fn = Closure::fromCallable('thisDoesNotExist'); + echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Subclass cannot closure over parent private instance method'."\n"; try { - $subFoo = new SubFoo; - $fn = $subFoo->closePrivateInvalid(); - echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; + $subFoo = new SubFoo; + $fn = $subFoo->closePrivateInvalid(); + echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Subclass cannot closure over parant private static method'."\n"; try { - $subFoo = new SubFoo; - $fn = $subFoo->closePrivateStaticInvalid(); - echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; + $subFoo = new SubFoo; + $fn = $subFoo->closePrivateStaticInvalid(); + echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Function scope cannot closure over protected instance method'."\n"; try { - $fn = functionAccessProtected(); - echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; + $fn = functionAccessProtected(); + echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Function scope cannot closure over private instance method'."\n"; try { - $fn = functionAccessPrivate(); - echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; + $fn = functionAccessPrivate(); + echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Access private instance method of parent object through "self::" to parent method'."\n"; try { - $foo = new SubFoo; - $fn = $foo->getSelfColonParentPrivateInstanceMethod(); - echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; + $foo = new SubFoo; + $fn = $foo->getSelfColonParentPrivateInstanceMethod(); + echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { - //This is the expected outcome. + //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo "OK\n"; diff --git a/Zend/tests/closures/closure_from_callable_reflection.phpt b/Zend/tests/closures/closure_from_callable_reflection.phpt index 111115a44a..4cd8504266 100644 --- a/Zend/tests/closures/closure_from_callable_reflection.phpt +++ b/Zend/tests/closures/closure_from_callable_reflection.phpt @@ -4,8 +4,8 @@ Testing Closure::fromCallable() functionality: Reflection <?php class Bar { - public static function staticMethod(Bar $bar, int $int, $none) {} - public static function instanceMethod(Bar $bar, int $int, $none) {} + public static function staticMethod(Bar $bar, int $int, $none) {} + public static function instanceMethod(Bar $bar, int $int, $none) {} } function foo(Bar $bar, int $int, $none) { @@ -16,22 +16,22 @@ $fn = function (Bar $bar, int $x, $none) {}; $bar = new Bar(); $callables = [ - 'foo', - $fn, - 'Bar::staticMethod', - [$bar, 'instanceMethod'] + 'foo', + $fn, + 'Bar::staticMethod', + [$bar, 'instanceMethod'] ]; foreach ($callables as $callable) { - $closure = Closure::fromCallable($callable); - $refl = new ReflectionFunction($closure); - foreach ($refl->getParameters() as $param) { - if ($param->hasType()) { - $type = $param->getType(); - echo $type->getName() . "\n"; - } - } + $closure = Closure::fromCallable($callable); + $refl = new ReflectionFunction($closure); + foreach ($refl->getParameters() as $param) { + if ($param->hasType()) { + $type = $param->getType(); + echo $type->getName() . "\n"; + } + } } ?> diff --git a/Zend/tests/compare_001.phpt b/Zend/tests/compare_001.phpt index d9f3f080bc..dcf305d742 100644 --- a/Zend/tests/compare_001.phpt +++ b/Zend/tests/compare_001.phpt @@ -9,41 +9,41 @@ class test { } $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - new stdclass, - new test, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + new stdclass, + new test, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); $var_cnt = count($a); function my_dump($var) { - ob_start(); - var_dump($var); - $buf = ob_get_clean(); - echo str_replace("\n", "", $buf); + ob_start(); + var_dump($var); + $buf = ob_get_clean(); + echo str_replace("\n", "", $buf); } foreach($a as $var) { - for ($i = 0; $i < $var_cnt; $i++) { - my_dump($var); - echo ($var == $a[$i]) ? " == " : " != "; - my_dump($a[$i]); - echo "\n"; - } + for ($i = 0; $i < $var_cnt; $i++) { + my_dump($var); + echo ($var == $a[$i]) ? " == " : " != "; + my_dump($a[$i]); + echo "\n"; + } } echo "Done\n"; diff --git a/Zend/tests/compare_001_64bit.phpt b/Zend/tests/compare_001_64bit.phpt index f72f91d17b..2536073089 100644 --- a/Zend/tests/compare_001_64bit.phpt +++ b/Zend/tests/compare_001_64bit.phpt @@ -9,41 +9,41 @@ class test { } $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - new stdclass, - new test, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + new stdclass, + new test, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); $var_cnt = count($a); function my_dump($var) { - ob_start(); - var_dump($var); - $buf = ob_get_clean(); - echo str_replace("\n", "", $buf); + ob_start(); + var_dump($var); + $buf = ob_get_clean(); + echo str_replace("\n", "", $buf); } foreach($a as $var) { - for ($i = 0; $i < $var_cnt; $i++) { - my_dump($var); - echo ($var == $a[$i]) ? " == " : " != "; - my_dump($a[$i]); - echo "\n"; - } + for ($i = 0; $i < $var_cnt; $i++) { + my_dump($var); + echo ($var == $a[$i]) ? " == " : " != "; + my_dump($a[$i]); + echo "\n"; + } } echo "Done\n"; diff --git a/Zend/tests/compare_002.phpt b/Zend/tests/compare_002.phpt index 9e3eb86d57..f4646c84fa 100644 --- a/Zend/tests/compare_002.phpt +++ b/Zend/tests/compare_002.phpt @@ -9,41 +9,41 @@ class test { } $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - new stdclass, - new test, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + new stdclass, + new test, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); $var_cnt = count($a); function my_dump($var) { - ob_start(); - var_dump($var); - $buf = ob_get_clean(); - echo str_replace("\n", "", $buf); + ob_start(); + var_dump($var); + $buf = ob_get_clean(); + echo str_replace("\n", "", $buf); } foreach($a as $var) { - for ($i = 0; $i < $var_cnt; $i++) { - my_dump($var); - echo ($var === $a[$i]) ? " === " : " !== "; - my_dump($a[$i]); - echo "\n"; - } + for ($i = 0; $i < $var_cnt; $i++) { + my_dump($var); + echo ($var === $a[$i]) ? " === " : " !== "; + my_dump($a[$i]); + echo "\n"; + } } echo "Done\n"; diff --git a/Zend/tests/compare_002_64bit.phpt b/Zend/tests/compare_002_64bit.phpt index a18269e9f3..b0418cca11 100644 --- a/Zend/tests/compare_002_64bit.phpt +++ b/Zend/tests/compare_002_64bit.phpt @@ -9,41 +9,41 @@ class test { } $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - new stdclass, - new test, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + new stdclass, + new test, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); $var_cnt = count($a); function my_dump($var) { - ob_start(); - var_dump($var); - $buf = ob_get_clean(); - echo str_replace("\n", "", $buf); + ob_start(); + var_dump($var); + $buf = ob_get_clean(); + echo str_replace("\n", "", $buf); } foreach($a as $var) { - for ($i = 0; $i < $var_cnt; $i++) { - my_dump($var); - echo ($var === $a[$i]) ? " === " : " !== "; - my_dump($a[$i]); - echo "\n"; - } + for ($i = 0; $i < $var_cnt; $i++) { + my_dump($var); + echo ($var === $a[$i]) ? " === " : " !== "; + my_dump($a[$i]); + echo "\n"; + } } echo "Done\n"; diff --git a/Zend/tests/compare_003.phpt b/Zend/tests/compare_003.phpt index 4cb7a027cd..c52df79634 100644 --- a/Zend/tests/compare_003.phpt +++ b/Zend/tests/compare_003.phpt @@ -9,41 +9,41 @@ class test { } $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - new stdclass, - new test, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + new stdclass, + new test, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); $var_cnt = count($a); function my_dump($var) { - ob_start(); - var_dump($var); - $buf = ob_get_clean(); - echo str_replace("\n", "", $buf); + ob_start(); + var_dump($var); + $buf = ob_get_clean(); + echo str_replace("\n", "", $buf); } foreach($a as $var) { - for ($i = 0; $i < $var_cnt; $i++) { - my_dump($var); - echo ($var > $a[$i]) ? " > " : " <= "; - my_dump($a[$i]); - echo "\n"; - } + for ($i = 0; $i < $var_cnt; $i++) { + my_dump($var); + echo ($var > $a[$i]) ? " > " : " <= "; + my_dump($a[$i]); + echo "\n"; + } } echo "Done\n"; diff --git a/Zend/tests/compare_003_64bit.phpt b/Zend/tests/compare_003_64bit.phpt index 2c361257ae..af18782857 100644 --- a/Zend/tests/compare_003_64bit.phpt +++ b/Zend/tests/compare_003_64bit.phpt @@ -9,41 +9,41 @@ class test { } $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - new stdclass, - new test, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + new stdclass, + new test, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); $var_cnt = count($a); function my_dump($var) { - ob_start(); - var_dump($var); - $buf = ob_get_clean(); - echo str_replace("\n", "", $buf); + ob_start(); + var_dump($var); + $buf = ob_get_clean(); + echo str_replace("\n", "", $buf); } foreach($a as $var) { - for ($i = 0; $i < $var_cnt; $i++) { - my_dump($var); - echo ($var > $a[$i]) ? " > " : " <= "; - my_dump($a[$i]); - echo "\n"; - } + for ($i = 0; $i < $var_cnt; $i++) { + my_dump($var); + echo ($var > $a[$i]) ? " > " : " <= "; + my_dump($a[$i]); + echo "\n"; + } } echo "Done\n"; diff --git a/Zend/tests/compare_004.phpt b/Zend/tests/compare_004.phpt index 1d13f36334..f53f22a9e5 100644 --- a/Zend/tests/compare_004.phpt +++ b/Zend/tests/compare_004.phpt @@ -9,41 +9,41 @@ class test { } $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - new stdclass, - new test, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + new stdclass, + new test, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); $var_cnt = count($a); function my_dump($var) { - ob_start(); - var_dump($var); - $buf = ob_get_clean(); - echo str_replace("\n", "", $buf); + ob_start(); + var_dump($var); + $buf = ob_get_clean(); + echo str_replace("\n", "", $buf); } foreach($a as $var) { - for ($i = 0; $i < $var_cnt; $i++) { - my_dump($var); - echo ($var < $a[$i]) ? " < " : " >= "; - my_dump($a[$i]); - echo "\n"; - } + for ($i = 0; $i < $var_cnt; $i++) { + my_dump($var); + echo ($var < $a[$i]) ? " < " : " >= "; + my_dump($a[$i]); + echo "\n"; + } } echo "Done\n"; diff --git a/Zend/tests/compare_004_64bit.phpt b/Zend/tests/compare_004_64bit.phpt index 8a69ae7816..cdd8802996 100644 --- a/Zend/tests/compare_004_64bit.phpt +++ b/Zend/tests/compare_004_64bit.phpt @@ -9,41 +9,41 @@ class test { } $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - new stdclass, - new test, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + new stdclass, + new test, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); $var_cnt = count($a); function my_dump($var) { - ob_start(); - var_dump($var); - $buf = ob_get_clean(); - echo str_replace("\n", "", $buf); + ob_start(); + var_dump($var); + $buf = ob_get_clean(); + echo str_replace("\n", "", $buf); } foreach($a as $var) { - for ($i = 0; $i < $var_cnt; $i++) { - my_dump($var); - echo ($var < $a[$i]) ? " < " : " >= "; - my_dump($a[$i]); - echo "\n"; - } + for ($i = 0; $i < $var_cnt; $i++) { + my_dump($var); + echo ($var < $a[$i]) ? " < " : " >= "; + my_dump($a[$i]); + echo "\n"; + } } echo "Done\n"; diff --git a/Zend/tests/compare_005.phpt b/Zend/tests/compare_005.phpt index 43ed96e70b..87241a50e2 100644 --- a/Zend/tests/compare_005.phpt +++ b/Zend/tests/compare_005.phpt @@ -9,41 +9,41 @@ class test { } $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - new stdclass, - new test, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + new stdclass, + new test, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); $var_cnt = count($a); function my_dump($var) { - ob_start(); - var_dump($var); - $buf = ob_get_clean(); - echo str_replace("\n", "", $buf); + ob_start(); + var_dump($var); + $buf = ob_get_clean(); + echo str_replace("\n", "", $buf); } foreach($a as $var) { - for ($i = 0; $i < $var_cnt; $i++) { - my_dump($var); - echo ($var >= $a[$i]) ? " >= " : " < "; - my_dump($a[$i]); - echo "\n"; - } + for ($i = 0; $i < $var_cnt; $i++) { + my_dump($var); + echo ($var >= $a[$i]) ? " >= " : " < "; + my_dump($a[$i]); + echo "\n"; + } } echo "Done\n"; diff --git a/Zend/tests/compare_005_64bit.phpt b/Zend/tests/compare_005_64bit.phpt index 821f2a0ee4..ab3d0cf0bc 100644 --- a/Zend/tests/compare_005_64bit.phpt +++ b/Zend/tests/compare_005_64bit.phpt @@ -9,41 +9,41 @@ class test { } $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - new stdclass, - new test, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + new stdclass, + new test, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); $var_cnt = count($a); function my_dump($var) { - ob_start(); - var_dump($var); - $buf = ob_get_clean(); - echo str_replace("\n", "", $buf); + ob_start(); + var_dump($var); + $buf = ob_get_clean(); + echo str_replace("\n", "", $buf); } foreach($a as $var) { - for ($i = 0; $i < $var_cnt; $i++) { - my_dump($var); - echo ($var >= $a[$i]) ? " >= " : " < "; - my_dump($a[$i]); - echo "\n"; - } + for ($i = 0; $i < $var_cnt; $i++) { + my_dump($var); + echo ($var >= $a[$i]) ? " >= " : " < "; + my_dump($a[$i]); + echo "\n"; + } } echo "Done\n"; diff --git a/Zend/tests/compare_006.phpt b/Zend/tests/compare_006.phpt index 1c212c5487..824c162b82 100644 --- a/Zend/tests/compare_006.phpt +++ b/Zend/tests/compare_006.phpt @@ -9,41 +9,41 @@ class test { } $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - new stdclass, - new test, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + new stdclass, + new test, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); $var_cnt = count($a); function my_dump($var) { - ob_start(); - var_dump($var); - $buf = ob_get_clean(); - echo str_replace("\n", "", $buf); + ob_start(); + var_dump($var); + $buf = ob_get_clean(); + echo str_replace("\n", "", $buf); } foreach($a as $var) { - for ($i = 0; $i < $var_cnt; $i++) { - my_dump($var); - echo ($var <= $a[$i]) ? " <= " : " > "; - my_dump($a[$i]); - echo "\n"; - } + for ($i = 0; $i < $var_cnt; $i++) { + my_dump($var); + echo ($var <= $a[$i]) ? " <= " : " > "; + my_dump($a[$i]); + echo "\n"; + } } echo "Done\n"; diff --git a/Zend/tests/compare_006_64bit.phpt b/Zend/tests/compare_006_64bit.phpt index 41973a990d..f85b0d28c0 100644 --- a/Zend/tests/compare_006_64bit.phpt +++ b/Zend/tests/compare_006_64bit.phpt @@ -9,41 +9,41 @@ class test { } $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - new stdclass, - new test, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + new stdclass, + new test, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); $var_cnt = count($a); function my_dump($var) { - ob_start(); - var_dump($var); - $buf = ob_get_clean(); - echo str_replace("\n", "", $buf); + ob_start(); + var_dump($var); + $buf = ob_get_clean(); + echo str_replace("\n", "", $buf); } foreach($a as $var) { - for ($i = 0; $i < $var_cnt; $i++) { - my_dump($var); - echo ($var <= $a[$i]) ? " <= " : " > "; - my_dump($a[$i]); - echo "\n"; - } + for ($i = 0; $i < $var_cnt; $i++) { + my_dump($var); + echo ($var <= $a[$i]) ? " <= " : " > "; + my_dump($a[$i]); + echo "\n"; + } } echo "Done\n"; diff --git a/Zend/tests/compound_assign_failure.phpt b/Zend/tests/compound_assign_failure.phpt index 2e35ab4fff..673baecff0 100644 --- a/Zend/tests/compound_assign_failure.phpt +++ b/Zend/tests/compound_assign_failure.phpt @@ -6,30 +6,30 @@ opcache.optimization_level=0 <?php try { - $a = 1; - $a %= 0; + $a = 1; + $a %= 0; } catch (Error $e) { var_dump($a); } try { - $a = 1; - $a >>= -1; + $a = 1; + $a >>= -1; } catch (Error $e) { var_dump($a); } try { - $a = 1; - $a <<= -1; + $a = 1; + $a <<= -1; } catch (Error $e) { var_dump($a); } set_error_handler(function($type, $msg) { throw new Exception($msg); }); try { - $a = []; - $a .= "foo"; + $a = []; + $a .= "foo"; } catch (Throwable $e) { var_dump($a); } try { - $a = "foo"; - $a .= []; + $a = "foo"; + $a .= []; } catch (Throwable $e) { var_dump($a); } $x = new stdClass; diff --git a/Zend/tests/compound_assign_with_numeric_strings.phpt b/Zend/tests/compound_assign_with_numeric_strings.phpt index e5cdb344ef..a801991a1e 100644 --- a/Zend/tests/compound_assign_with_numeric_strings.phpt +++ b/Zend/tests/compound_assign_with_numeric_strings.phpt @@ -12,7 +12,7 @@ try { $n <<= $n; var_dump($n); } catch (ArithmeticError $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo "\nException: " . $e->getMessage() . "\n"; } $n = "65"; @@ -24,7 +24,7 @@ try { $n >>= $n; var_dump($n); } catch (ArithmeticError $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo "\nException: " . $e->getMessage() . "\n"; } $n = "0"; @@ -32,7 +32,7 @@ try{ $n %= $n; var_dump($n); } catch (DivisionByZeroError $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo "\nException: " . $e->getMessage() . "\n"; } $n = "-1"; diff --git a/Zend/tests/concat_001.phpt b/Zend/tests/concat_001.phpt index b8fad29674..887370aee7 100644 --- a/Zend/tests/concat_001.phpt +++ b/Zend/tests/concat_001.phpt @@ -6,9 +6,9 @@ precision=14 <?php class test { - function __toString() { - return "this is test object"; - } + function __toString() { + return "this is test object"; + } } $a = array(1,2,3); diff --git a/Zend/tests/constant_expressions_arrays.phpt b/Zend/tests/constant_expressions_arrays.phpt index 2ab03453de..d087f7928e 100644 --- a/Zend/tests/constant_expressions_arrays.phpt +++ b/Zend/tests/constant_expressions_arrays.phpt @@ -11,13 +11,13 @@ const e = ["string" => [1]]["string"][0]; var_dump(b, c, e); function test ($a = d[1][0]) { - var_dump($a); + var_dump($a); } test(); class foo { - const bar = [1][0]; + const bar = [1][0]; } var_dump(foo::bar); diff --git a/Zend/tests/constant_expressions_classes.phpt b/Zend/tests/constant_expressions_classes.phpt index 9deec49561..6cca717672 100644 --- a/Zend/tests/constant_expressions_classes.phpt +++ b/Zend/tests/constant_expressions_classes.phpt @@ -20,11 +20,11 @@ $classlist = [ ]; spl_autoload_register(function ($class) use ($classlist) { - if (isset($classlist[$class])) { - eval($classlist[$class]); - } else { - die("Cannot autoload $class\n"); - } + if (isset($classlist[$class])) { + eval($classlist[$class]); + } else { + die("Cannot autoload $class\n"); + } }); printf("B::HW = %s\n", B::HW); diff --git a/Zend/tests/constant_expressions_exceptions_002.phpt b/Zend/tests/constant_expressions_exceptions_002.phpt index fc15af5e9a..c10bd10843 100644 --- a/Zend/tests/constant_expressions_exceptions_002.phpt +++ b/Zend/tests/constant_expressions_exceptions_002.phpt @@ -3,9 +3,9 @@ Constant Expressions with unsupported operands 002 --FILE-- <?php try { - require("constant_expressions_exceptions.inc"); + require("constant_expressions_exceptions.inc"); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; } ?> DONE diff --git a/Zend/tests/constants_006.phpt b/Zend/tests/constants_006.phpt index 6458a07825..77e71de437 100644 --- a/Zend/tests/constants_006.phpt +++ b/Zend/tests/constants_006.phpt @@ -10,11 +10,11 @@ var_dump(__file__); var_dump(__line__); class foo { - public function __construct() { - var_dump(__method__); - var_dump(__class__); - var_dump(__function__); - } + public function __construct() { + var_dump(__method__); + var_dump(__class__); + var_dump(__function__); + } } new foo; diff --git a/Zend/tests/constants_007.phpt b/Zend/tests/constants_007.phpt index 7d9f3feb72..c1242dc0c3 100644 --- a/Zend/tests/constants_007.phpt +++ b/Zend/tests/constants_007.phpt @@ -8,8 +8,8 @@ const A = 'b'; class a { - const a = 'c'; - const A = 'd'; + const a = 'c'; + const A = 'd'; } var_dump(a, A, a::a, a::A); diff --git a/Zend/tests/constants_008.phpt b/Zend/tests/constants_008.phpt index 226e147ffd..6a8f00edec 100644 --- a/Zend/tests/constants_008.phpt +++ b/Zend/tests/constants_008.phpt @@ -8,7 +8,7 @@ const a = 1; if (defined('a')) { - print a; + print a; } ?> diff --git a/Zend/tests/constants_009.phpt b/Zend/tests/constants_009.phpt index 35c64dff16..953bc91965 100644 --- a/Zend/tests/constants_009.phpt +++ b/Zend/tests/constants_009.phpt @@ -8,7 +8,7 @@ namespace foo\x; const x = 2; class x { - const x = 1; + const x = 1; } diff --git a/Zend/tests/debug_backtrace_options.phpt b/Zend/tests/debug_backtrace_options.phpt index a35eb64ff6..94842279ea 100644 --- a/Zend/tests/debug_backtrace_options.phpt +++ b/Zend/tests/debug_backtrace_options.phpt @@ -5,39 +5,39 @@ debug_backtrace options function backtrace_print($opt = null) { - if(is_null($opt)) { - print_r(debug_backtrace()); - } else { - print_r(debug_backtrace($opt)); - } + if(is_null($opt)) { + print_r(debug_backtrace()); + } else { + print_r(debug_backtrace($opt)); + } } function doit($a, $b, $how) { - echo "==default\n"; - $how(); - echo "==true\n"; - $how(true); - echo "==false\n"; - $how(false); - echo "==DEBUG_BACKTRACE_PROVIDE_OBJECT\n"; - $how(DEBUG_BACKTRACE_PROVIDE_OBJECT); - echo "==DEBUG_BACKTRACE_IGNORE_ARGS\n"; - $how(DEBUG_BACKTRACE_IGNORE_ARGS); - echo "==both\n"; - $how(DEBUG_BACKTRACE_PROVIDE_OBJECT|DEBUG_BACKTRACE_IGNORE_ARGS); + echo "==default\n"; + $how(); + echo "==true\n"; + $how(true); + echo "==false\n"; + $how(false); + echo "==DEBUG_BACKTRACE_PROVIDE_OBJECT\n"; + $how(DEBUG_BACKTRACE_PROVIDE_OBJECT); + echo "==DEBUG_BACKTRACE_IGNORE_ARGS\n"; + $how(DEBUG_BACKTRACE_IGNORE_ARGS); + echo "==both\n"; + $how(DEBUG_BACKTRACE_PROVIDE_OBJECT|DEBUG_BACKTRACE_IGNORE_ARGS); } class foo { - protected function doCall($dowhat, $how) - { - $dowhat('a','b', $how); - } - static function statCall($dowhat, $how) - { - $obj = new self(); - $obj->doCall($dowhat, $how); - } + protected function doCall($dowhat, $how) + { + $dowhat('a','b', $how); + } + static function statCall($dowhat, $how) + { + $obj = new self(); + $obj->doCall($dowhat, $how); + } } foo::statCall("doit", "debug_print_backtrace"); foo::statCall("doit", "backtrace_print"); diff --git a/Zend/tests/decrement_001.phpt b/Zend/tests/decrement_001.phpt index b768b5a8e5..22d95b16ac 100644 --- a/Zend/tests/decrement_001.phpt +++ b/Zend/tests/decrement_001.phpt @@ -8,26 +8,26 @@ precision=14 <?php $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); foreach ($a as $var) { - $var--; - var_dump($var); + $var--; + var_dump($var); } echo "Done\n"; diff --git a/Zend/tests/decrement_001_64bit.phpt b/Zend/tests/decrement_001_64bit.phpt index ac4f10d682..cce9875a78 100644 --- a/Zend/tests/decrement_001_64bit.phpt +++ b/Zend/tests/decrement_001_64bit.phpt @@ -8,26 +8,26 @@ precision=14 <?php $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - array(), - -PHP_INT_MAX-1, - (string)(-PHP_INT_MAX-1), + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + array(), + -PHP_INT_MAX-1, + (string)(-PHP_INT_MAX-1), ); foreach ($a as $var) { - $var--; - var_dump($var); + $var--; + var_dump($var); } echo "Done\n"; diff --git a/Zend/tests/dereference_001.phpt b/Zend/tests/dereference_001.phpt index 7873d624aa..048196012f 100644 --- a/Zend/tests/dereference_001.phpt +++ b/Zend/tests/dereference_001.phpt @@ -5,38 +5,38 @@ Testing array dereference error_reporting(E_ALL); function a() { - return array(1,array(5)); + return array(1,array(5)); } var_dump(a()[1][0]); // int(5) function b() { - return array(); + return array(); } var_dump(b()[0]); // Notice: Undefined offset: 0 class foo { - public $y = 1; + public $y = 1; - public function test() { - return array(array(array('foobar'))); - } + public function test() { + return array(array(array('foobar'))); + } } function c() { - return array(new foo); + return array(new foo); } var_dump(c()[0]->y); // int(1) function d() { - $obj = new foo; - return $obj->test(); + $obj = new foo; + return $obj->test(); } var_dump(d()[0][0][0][3]); // string(1) "b" function e() { - $y = 'bar'; - $x = array('a' => 'foo', 'b' => $y); - return $x; + $y = 'bar'; + $x = array('a' => 'foo', 'b' => $y); + return $x; } var_dump(e()['b']); // string(3) "bar" diff --git a/Zend/tests/dereference_002.phpt b/Zend/tests/dereference_002.phpt index e17e5e85b6..e196b91e67 100644 --- a/Zend/tests/dereference_002.phpt +++ b/Zend/tests/dereference_002.phpt @@ -6,13 +6,13 @@ Testing array dereference on method calls error_reporting(E_ALL); class foo { - public function bar() { - $x = array(); - $x[] = 3; - $x[] = array(1, 5); - $x[] = new foo; - return $x; - } + public function bar() { + $x = array(); + $x[] = 3; + $x[] = array(1, 5); + $x[] = new foo; + return $x; + } } $foo = new foo; diff --git a/Zend/tests/dereference_003.phpt b/Zend/tests/dereference_003.phpt index 3a54875964..93bdb19684 100644 --- a/Zend/tests/dereference_003.phpt +++ b/Zend/tests/dereference_003.phpt @@ -6,24 +6,24 @@ Testing array dereference on method calls error_reporting(E_ALL); class foo { - public $x = 2; - public function a() { - $x = array(); - $x[] = new foo; - return $x; - } - public function b() { - return array(1.2, array(new self)); - } - public function c() { - $a = array(); - $b = &$a; - $b[] = true; - return $a; - } - public function d() { - return $this->b(); - } + public $x = 2; + public function a() { + $x = array(); + $x[] = new foo; + return $x; + } + public function b() { + return array(1.2, array(new self)); + } + public function c() { + $a = array(); + $b = &$a; + $b[] = true; + return $a; + } + public function d() { + return $this->b(); + } } $foo = new foo; diff --git a/Zend/tests/dereference_004.phpt b/Zend/tests/dereference_004.phpt index a77cf032ed..1ffe4bf388 100644 --- a/Zend/tests/dereference_004.phpt +++ b/Zend/tests/dereference_004.phpt @@ -6,15 +6,15 @@ Testing array dereference on __invoke() result error_reporting(E_ALL); class foo { - public $x = array(); - public function __construct() { - $h = array(); - $h[] = new stdclass; - $this->x = $h; - } - public function __invoke() { - return $this->x; - } + public $x = array(); + public function __construct() { + $h = array(); + $h[] = new stdclass; + $this->x = $h; + } + public function __invoke() { + return $this->x; + } } diff --git a/Zend/tests/dereference_005.phpt b/Zend/tests/dereference_005.phpt index cca87571cd..5dba2276e9 100644 --- a/Zend/tests/dereference_005.phpt +++ b/Zend/tests/dereference_005.phpt @@ -29,7 +29,7 @@ class obj implements arrayaccess { } function x() { - return new obj; + return new obj; } var_dump(x()['two']); diff --git a/Zend/tests/dereference_006.phpt b/Zend/tests/dereference_006.phpt index 61a07353a4..694ded85b7 100644 --- a/Zend/tests/dereference_006.phpt +++ b/Zend/tests/dereference_006.phpt @@ -6,7 +6,7 @@ Testing array dereference and references error_reporting(E_ALL); function &foo(&$foo) { - return $foo; + return $foo; } $a = array(1); diff --git a/Zend/tests/dereference_007.phpt b/Zend/tests/dereference_007.phpt index afe6e9d5b2..4d677c6ea1 100644 --- a/Zend/tests/dereference_007.phpt +++ b/Zend/tests/dereference_007.phpt @@ -6,19 +6,19 @@ Trying to write on method return error_reporting(E_ALL); class foo { - public $x = array(); + public $x = array(); - public function b() { - return $this->x; - } + public function b() { + return $this->x; + } - public function c() { - return $x; - } + public function c() { + return $x; + } - static public function d() { + static public function d() { - } + } } $foo = new foo; diff --git a/Zend/tests/dereference_008.phpt b/Zend/tests/dereference_008.phpt index c615b9cd85..973fd24ffd 100644 --- a/Zend/tests/dereference_008.phpt +++ b/Zend/tests/dereference_008.phpt @@ -6,11 +6,11 @@ Testing array dereference with dynamic method name and references error_reporting(E_ALL); class foo { - public $x = array(1); + public $x = array(1); - public function &b() { - return $this->x; - } + public function &b() { + return $this->x; + } } $foo = new foo; diff --git a/Zend/tests/dereference_009.phpt b/Zend/tests/dereference_009.phpt index e579c44bae..5cf36a4758 100644 --- a/Zend/tests/dereference_009.phpt +++ b/Zend/tests/dereference_009.phpt @@ -8,7 +8,7 @@ error_reporting(E_ALL); $a = array(); function &a() { - return $GLOBALS['a']; + return $GLOBALS['a']; } var_dump($h =& a()); diff --git a/Zend/tests/dereference_010.phpt b/Zend/tests/dereference_010.phpt index c916352afa..191da8f348 100644 --- a/Zend/tests/dereference_010.phpt +++ b/Zend/tests/dereference_010.phpt @@ -6,7 +6,7 @@ Testing dereference in non-array values error_reporting(E_ALL); function a() { - return 1; + return 1; } $a = 1; @@ -14,7 +14,7 @@ var_dump($a[1]); var_dump(a()[1]); function b() { - return new stdClass; + return new stdClass; } var_dump(b()[1]); diff --git a/Zend/tests/dereference_011.phpt b/Zend/tests/dereference_011.phpt index 43fec9b92a..26c7771824 100644 --- a/Zend/tests/dereference_011.phpt +++ b/Zend/tests/dereference_011.phpt @@ -6,11 +6,11 @@ Testing array dereference with chaining error_reporting(E_ALL); class foo { - public $arr; + public $arr; - public function &a() { - return $this->arr; - } + public function &a() { + return $this->arr; + } } $foo = new foo; diff --git a/Zend/tests/dereference_012.phpt b/Zend/tests/dereference_012.phpt index ab70957a0a..7c1501e73f 100644 --- a/Zend/tests/dereference_012.phpt +++ b/Zend/tests/dereference_012.phpt @@ -4,18 +4,18 @@ Testing array dereferencing on return of a method with and without reference <?php class foo { - static $x = array(); - - public function &a() { - self::$x = array(1, 2, 3); - return self::$x; - } - - public function b() { - $x = array(1); - $x[] = 2; - return $x; - } + static $x = array(); + + public function &a() { + self::$x = array(1, 2, 3); + return self::$x; + } + + public function b() { + $x = array(1); + $x[] = 2; + return $x; + } } $foo = new foo; diff --git a/Zend/tests/dereference_013.phpt b/Zend/tests/dereference_013.phpt index 139cd480b7..f3a2e9c6f1 100644 --- a/Zend/tests/dereference_013.phpt +++ b/Zend/tests/dereference_013.phpt @@ -6,14 +6,14 @@ Testing array dereferencing on array returned from __call method error_reporting(E_ALL); class foo { - public $x = array(2); - - public function __call($x, $y) { - if (count($this->x) == 1) { - $this->x[] = $y[0]; - } - return $this->x; - } + public $x = array(2); + + public function __call($x, $y) { + if (count($this->x) == 1) { + $this->x[] = $y[0]; + } + return $this->x; + } } $foo = new foo; diff --git a/Zend/tests/dereference_014.phpt b/Zend/tests/dereference_014.phpt index 470c233a19..c6f21ab0ed 100644 --- a/Zend/tests/dereference_014.phpt +++ b/Zend/tests/dereference_014.phpt @@ -6,16 +6,16 @@ Trying to create an object from dereferencing uninitialized variable error_reporting(E_ALL); class foo { - public $x; - static public $y; + public $x; + static public $y; - public function a() { - return $this->x; - } + public function a() { + return $this->x; + } - static public function b() { - return self::$y; - } + static public function b() { + return self::$y; + } } $foo = new foo; diff --git a/Zend/tests/div_002.phpt b/Zend/tests/div_002.phpt index be7b38e5b2..1fc006def5 100644 --- a/Zend/tests/div_002.phpt +++ b/Zend/tests/div_002.phpt @@ -7,9 +7,9 @@ $a = array(1,2,3); $b = array(1); try { - var_dump($a / $b); + var_dump($a / $b); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo "\nException: " . $e->getMessage() . "\n"; } $c = $a / $b; diff --git a/Zend/tests/double_to_string.phpt b/Zend/tests/double_to_string.phpt index a778017a63..808024b0e5 100644 --- a/Zend/tests/double_to_string.phpt +++ b/Zend/tests/double_to_string.phpt @@ -8,26 +8,26 @@ precision=14 <?php $doubles = array( - 290000000000000000, - 290000000000000, - 29000000000000, - 29000000000000.123123, - 29000000000000.7123123, - 29000.7123123, - 239234242.7123123, - 0.12345678901234567890, - 10000000000000, - 100000000000000, - 1000000000000000001, - 100000000000001, - 10000000000, - 999999999999999, - 9999999999999999, - (float)0 - ); + 290000000000000000, + 290000000000000, + 29000000000000, + 29000000000000.123123, + 29000000000000.7123123, + 29000.7123123, + 239234242.7123123, + 0.12345678901234567890, + 10000000000000, + 100000000000000, + 1000000000000000001, + 100000000000001, + 10000000000, + 999999999999999, + 9999999999999999, + (float)0 + ); foreach ($doubles as $d) { - var_dump((string)$d); + var_dump((string)$d); } echo "Done\n"; diff --git a/Zend/tests/dval_to_lval_32.phpt b/Zend/tests/dval_to_lval_32.phpt index f2acc39f51..9aeea65060 100644 --- a/Zend/tests/dval_to_lval_32.phpt +++ b/Zend/tests/dval_to_lval_32.phpt @@ -7,20 +7,20 @@ if (PHP_INT_SIZE != 4) ?> --FILE-- <?php - /* test doubles around -4e21 */ - $values = [ - -4000000000000001048576., - -4000000000000000524288., - -4000000000000000000000., - -3999999999999999475712., - -3999999999999998951424., - ]; - /* see if we're rounding negative numbers right */ - $values[] = -2147483649.8; + /* test doubles around -4e21 */ + $values = [ + -4000000000000001048576., + -4000000000000000524288., + -4000000000000000000000., + -3999999999999999475712., + -3999999999999998951424., + ]; + /* see if we're rounding negative numbers right */ + $values[] = -2147483649.8; - foreach ($values as $v) { - var_dump((int)$v); - } + foreach ($values as $v) { + var_dump((int)$v); + } ?> --EXPECT-- diff --git a/Zend/tests/dval_to_lval_64.phpt b/Zend/tests/dval_to_lval_64.phpt index da7f56d81c..3d6b736b8f 100644 --- a/Zend/tests/dval_to_lval_64.phpt +++ b/Zend/tests/dval_to_lval_64.phpt @@ -7,18 +7,18 @@ if (PHP_INT_SIZE != 8) ?> --FILE-- <?php - /* test doubles around -4e21 */ - $values = [ - -4000000000000001048576., - -4000000000000000524288., - -4000000000000000000000., - -3999999999999999475712., - -3999999999999998951424., - ]; + /* test doubles around -4e21 */ + $values = [ + -4000000000000001048576., + -4000000000000000524288., + -4000000000000000000000., + -3999999999999999475712., + -3999999999999998951424., + ]; - foreach ($values as $v) { - var_dump((int)$v); - } + foreach ($values as $v) { + var_dump((int)$v); + } ?> --EXPECT-- diff --git a/Zend/tests/errmsg_001.phpt b/Zend/tests/errmsg_001.phpt index c17764cdec..e629f19c40 100644 --- a/Zend/tests/errmsg_001.phpt +++ b/Zend/tests/errmsg_001.phpt @@ -7,7 +7,7 @@ abstract class test { } class Impl extends Test { - function Foo(); + function Foo(); } echo "Done\n"; diff --git a/Zend/tests/errmsg_002.phpt b/Zend/tests/errmsg_002.phpt index d1c4cb893f..b00a850fad 100644 --- a/Zend/tests/errmsg_002.phpt +++ b/Zend/tests/errmsg_002.phpt @@ -4,8 +4,8 @@ errmsg: function cannot be declared private <?php abstract class test { - abstract private function foo() { - } + abstract private function foo() { + } } echo "Done\n"; diff --git a/Zend/tests/errmsg_003.phpt b/Zend/tests/errmsg_003.phpt index 8daa66ae10..d13b4ccfbd 100644 --- a/Zend/tests/errmsg_003.phpt +++ b/Zend/tests/errmsg_003.phpt @@ -4,10 +4,10 @@ errmsg: cannot reassign $this (by ref) <?php class test { - function foo() { - $a = new test; - $this = &$a; - } + function foo() { + $a = new test; + $this = &$a; + } } $t = new test; diff --git a/Zend/tests/errmsg_004.phpt b/Zend/tests/errmsg_004.phpt index e322b66429..7e71b41087 100644 --- a/Zend/tests/errmsg_004.phpt +++ b/Zend/tests/errmsg_004.phpt @@ -4,7 +4,7 @@ errmsg: can't use function return value in write context <?php function foo() { - return "blah"; + return "blah"; } foo() = 1; diff --git a/Zend/tests/errmsg_005.phpt b/Zend/tests/errmsg_005.phpt index a7a2dc803c..6089a771f4 100644 --- a/Zend/tests/errmsg_005.phpt +++ b/Zend/tests/errmsg_005.phpt @@ -4,9 +4,9 @@ errmsg: can't use method return value in write context <?php class test { - function foo() { - return "blah"; - } + function foo() { + return "blah"; + } } $t = new test; diff --git a/Zend/tests/errmsg_009.phpt b/Zend/tests/errmsg_009.phpt index c65b40e0d5..6f8acd6c7b 100644 --- a/Zend/tests/errmsg_009.phpt +++ b/Zend/tests/errmsg_009.phpt @@ -4,7 +4,7 @@ errmsg: multiple access type modifiers are not allowed (properties) <?php class test { - public private $var; + public private $var; } echo "Done\n"; diff --git a/Zend/tests/errmsg_010.phpt b/Zend/tests/errmsg_010.phpt index b283d2ce65..f93cd58be8 100644 --- a/Zend/tests/errmsg_010.phpt +++ b/Zend/tests/errmsg_010.phpt @@ -4,7 +4,7 @@ errmsg: multiple access type modifiers are not allowed (methods) <?php class test { - private protected function foo() {} + private protected function foo() {} } echo "Done\n"; diff --git a/Zend/tests/errmsg_011.phpt b/Zend/tests/errmsg_011.phpt index 5333f3b23c..ac29c6e081 100644 --- a/Zend/tests/errmsg_011.phpt +++ b/Zend/tests/errmsg_011.phpt @@ -5,8 +5,8 @@ errmsg: cannot redeclare (method) class test { - function foo() {} - function foo() {} + function foo() {} + function foo() {} } diff --git a/Zend/tests/errmsg_013.phpt b/Zend/tests/errmsg_013.phpt index 037ef9b1aa..6346868679 100644 --- a/Zend/tests/errmsg_013.phpt +++ b/Zend/tests/errmsg_013.phpt @@ -4,8 +4,8 @@ errmsg: default value for parameters with array type can only be an array or NUL <?php class test { - function foo(array $a = "s") { - } + function foo(array $a = "s") { + } } echo "Done\n"; diff --git a/Zend/tests/errmsg_015.phpt b/Zend/tests/errmsg_015.phpt index 948dee2f76..ceac72c5d2 100644 --- a/Zend/tests/errmsg_015.phpt +++ b/Zend/tests/errmsg_015.phpt @@ -4,8 +4,8 @@ errmsg: __clone() cannot accept any arguments <?php class test { - function __clone($var) { - } + function __clone($var) { + } } echo "Done\n"; diff --git a/Zend/tests/errmsg_016.phpt b/Zend/tests/errmsg_016.phpt index 05e10b41ab..4b57023230 100644 --- a/Zend/tests/errmsg_016.phpt +++ b/Zend/tests/errmsg_016.phpt @@ -4,8 +4,8 @@ errmsg: __isset() must take exactly 1 argument <?php class test { - function __isset() { - } + function __isset() { + } } echo "Done\n"; diff --git a/Zend/tests/errmsg_017.phpt b/Zend/tests/errmsg_017.phpt index ba55c1a2c5..386465d531 100644 --- a/Zend/tests/errmsg_017.phpt +++ b/Zend/tests/errmsg_017.phpt @@ -4,8 +4,8 @@ errmsg: __unset() must take exactly 1 argument <?php class test { - function __unset() { - } + function __unset() { + } } echo "Done\n"; diff --git a/Zend/tests/errmsg_018.phpt b/Zend/tests/errmsg_018.phpt index fd34c8031e..13a0cf4511 100644 --- a/Zend/tests/errmsg_018.phpt +++ b/Zend/tests/errmsg_018.phpt @@ -4,7 +4,7 @@ errmsg: static abstract function <?php class test { - static abstract function foo (); + static abstract function foo (); } echo "Done\n"; diff --git a/Zend/tests/errmsg_019.phpt b/Zend/tests/errmsg_019.phpt index bb8ebff5ab..5f6ab0f08f 100644 --- a/Zend/tests/errmsg_019.phpt +++ b/Zend/tests/errmsg_019.phpt @@ -4,8 +4,8 @@ errmsg: __destruct() cannot take arguments <?php class test { - function __destruct($var) { - } + function __destruct($var) { + } } echo "Done\n"; diff --git a/Zend/tests/errmsg_023.phpt b/Zend/tests/errmsg_023.phpt index 4532e2ad3a..551a7c5305 100644 --- a/Zend/tests/errmsg_023.phpt +++ b/Zend/tests/errmsg_023.phpt @@ -4,11 +4,11 @@ errmsg: access level must be the same or weaker <?php class test1 { - protected $var; + protected $var; } class test extends test1 { - private $var; + private $var; } echo "Done\n"; diff --git a/Zend/tests/errmsg_024.phpt b/Zend/tests/errmsg_024.phpt index 0755d2b75c..275ed47a99 100644 --- a/Zend/tests/errmsg_024.phpt +++ b/Zend/tests/errmsg_024.phpt @@ -4,11 +4,11 @@ No more errmsg: can now change initial value of property <?php class test1 { - static protected $var = 1; + static protected $var = 1; } class test extends test1 { - static $var = 10; + static $var = 10; } echo "Done\n"; diff --git a/Zend/tests/errmsg_025.phpt b/Zend/tests/errmsg_025.phpt index 014b409479..d003ec859d 100644 --- a/Zend/tests/errmsg_025.phpt +++ b/Zend/tests/errmsg_025.phpt @@ -4,11 +4,11 @@ errmsg: cannot inherit previously inherited constant <?php interface test1 { - const FOO = 10; + const FOO = 10; } interface test2 { - const FOO = 10; + const FOO = 10; } class test implements test1, test2 { diff --git a/Zend/tests/errmsg_027.phpt b/Zend/tests/errmsg_027.phpt index b2cd4e1655..3d96ec27b4 100644 --- a/Zend/tests/errmsg_027.phpt +++ b/Zend/tests/errmsg_027.phpt @@ -4,10 +4,10 @@ errmsg: class declarations may not be nested <?php class test { - function foo() { - class test2 { - } - } + function foo() { + class test2 { + } + } } echo "Done\n"; diff --git a/Zend/tests/errmsg_032.phpt b/Zend/tests/errmsg_032.phpt index f21e269a89..20c2762a32 100644 --- a/Zend/tests/errmsg_032.phpt +++ b/Zend/tests/errmsg_032.phpt @@ -5,8 +5,8 @@ errmsg: __construct() cannot be static class test { - static function __construct() { - } + static function __construct() { + } } echo "Done\n"; diff --git a/Zend/tests/errmsg_033.phpt b/Zend/tests/errmsg_033.phpt index e5f36912b0..72b1490ea5 100644 --- a/Zend/tests/errmsg_033.phpt +++ b/Zend/tests/errmsg_033.phpt @@ -5,8 +5,8 @@ errmsg: __destruct() cannot be static class test { - static function __destruct() { - } + static function __destruct() { + } } echo "Done\n"; diff --git a/Zend/tests/errmsg_034.phpt b/Zend/tests/errmsg_034.phpt index a8bfc80b9a..940754ad7b 100644 --- a/Zend/tests/errmsg_034.phpt +++ b/Zend/tests/errmsg_034.phpt @@ -5,8 +5,8 @@ errmsg: __clone() cannot be static class test { - static function __clone() { - } + static function __clone() { + } } echo "Done\n"; diff --git a/Zend/tests/errmsg_037.phpt b/Zend/tests/errmsg_037.phpt index b67ce0b5d0..f15fea89f3 100644 --- a/Zend/tests/errmsg_037.phpt +++ b/Zend/tests/errmsg_037.phpt @@ -4,7 +4,7 @@ errmsg: properties cannot be abstract <?php class test { - abstract $var = 1; + abstract $var = 1; } echo "Done\n"; diff --git a/Zend/tests/errmsg_038.phpt b/Zend/tests/errmsg_038.phpt index 6312ef64ce..d5ae50ded0 100644 --- a/Zend/tests/errmsg_038.phpt +++ b/Zend/tests/errmsg_038.phpt @@ -4,7 +4,7 @@ errmsg: properties cannot be final <?php class test { - final $var = 1; + final $var = 1; } echo "Done\n"; diff --git a/Zend/tests/errmsg_039.phpt b/Zend/tests/errmsg_039.phpt index 5371ba56c6..cc07106f5e 100644 --- a/Zend/tests/errmsg_039.phpt +++ b/Zend/tests/errmsg_039.phpt @@ -4,8 +4,8 @@ errmsg: cannot redeclare property <?php class test { - var $var; - var $var; + var $var; + var $var; } echo "Done\n"; diff --git a/Zend/tests/errmsg_040.phpt b/Zend/tests/errmsg_040.phpt index d8ebc67bf6..6715eab1c9 100644 --- a/Zend/tests/errmsg_040.phpt +++ b/Zend/tests/errmsg_040.phpt @@ -4,7 +4,7 @@ errmsg: arrays are not allowed in class constants <?php class test { - const TEST = array(1,2,3); + const TEST = array(1,2,3); } var_dump(test::TEST); echo "Done\n"; diff --git a/Zend/tests/errmsg_045.phpt b/Zend/tests/errmsg_045.phpt index 6311eb30e5..8ecee5ca3b 100644 --- a/Zend/tests/errmsg_045.phpt +++ b/Zend/tests/errmsg_045.phpt @@ -4,8 +4,8 @@ Error message in error handler during compilation <?php set_error_handler(function($_, $msg, $file) { - var_dump($msg, $file); - echo $undefined; + var_dump($msg, $file); + echo $undefined; }); /* This is just a particular example of a non-fatal compile-time error diff --git a/Zend/tests/error_reporting01.phpt b/Zend/tests/error_reporting01.phpt index 75c4189ce2..97524b43fd 100644 --- a/Zend/tests/error_reporting01.phpt +++ b/Zend/tests/error_reporting01.phpt @@ -9,11 +9,11 @@ function foo($arg) { } function bar() { - throw new Exception("test"); + throw new Exception("test"); } try { - @foo(@bar()); + @foo(@bar()); } catch (Exception $e) { } diff --git a/Zend/tests/error_reporting02.phpt b/Zend/tests/error_reporting02.phpt index c76c5b54c8..5caf265d76 100644 --- a/Zend/tests/error_reporting02.phpt +++ b/Zend/tests/error_reporting02.phpt @@ -9,12 +9,12 @@ function foo($arg) { } function bar() { - error_reporting(E_ALL); - throw new Exception("test"); + error_reporting(E_ALL); + throw new Exception("test"); } try { - @foo(@bar()); + @foo(@bar()); } catch (Exception $e) { } diff --git a/Zend/tests/error_reporting03.phpt b/Zend/tests/error_reporting03.phpt index b4fbbecca8..c21b363113 100644 --- a/Zend/tests/error_reporting03.phpt +++ b/Zend/tests/error_reporting03.phpt @@ -6,22 +6,22 @@ testing @ and error_reporting - 3 error_reporting(E_ALL & ~E_DEPRECATED); function foo($arg) { - echo @$nonex_foo; + echo @$nonex_foo; } function bar() { - echo @$nonex_bar; - throw new Exception("test"); + echo @$nonex_bar; + throw new Exception("test"); } function foo1() { - echo $undef1; - error_reporting(E_ALL); - echo $undef2; + echo $undef1; + error_reporting(E_ALL); + echo $undef2; } try { - @foo(@bar(@foo1())); + @foo(@bar(@foo1())); } catch (Exception $e) { } diff --git a/Zend/tests/error_reporting04.phpt b/Zend/tests/error_reporting04.phpt index 7cd555716a..8a70e7d17b 100644 --- a/Zend/tests/error_reporting04.phpt +++ b/Zend/tests/error_reporting04.phpt @@ -6,8 +6,8 @@ testing @ and error_reporting - 4 error_reporting(E_ALL & ~E_DEPRECATED); function foo() { - echo $undef; - error_reporting(E_ALL); + echo $undef; + error_reporting(E_ALL); } diff --git a/Zend/tests/error_reporting05.phpt b/Zend/tests/error_reporting05.phpt index 9c1a7c48d6..77b3914e7a 100644 --- a/Zend/tests/error_reporting05.phpt +++ b/Zend/tests/error_reporting05.phpt @@ -6,12 +6,12 @@ testing @ and error_reporting - 5 error_reporting(E_ALL); class test { - function __get($name) { - return $undef_name; - } - function __set($name, $value) { - return $undef_value; - } + function __get($name) { + return $undef_name; + } + function __set($name, $value) { + return $undef_value; + } } $test = new test; diff --git a/Zend/tests/error_reporting06.phpt b/Zend/tests/error_reporting06.phpt index 8f286f75ae..809c1d614b 100644 --- a/Zend/tests/error_reporting06.phpt +++ b/Zend/tests/error_reporting06.phpt @@ -12,12 +12,12 @@ function foo2($arg) { } function foo3() { - echo $undef3; - throw new Exception("test"); + echo $undef3; + throw new Exception("test"); } try { - @foo1(@foo2(@foo3())); + @foo1(@foo2(@foo3())); } catch (Exception $e) { } diff --git a/Zend/tests/error_reporting07.phpt b/Zend/tests/error_reporting07.phpt index 84cf6264b9..8b57847b0b 100644 --- a/Zend/tests/error_reporting07.phpt +++ b/Zend/tests/error_reporting07.phpt @@ -12,12 +12,12 @@ function foo2($arg) { } function foo3() { - echo $undef3; - throw new Exception("test"); + echo $undef3; + throw new Exception("test"); } try { - @error_reporting(@foo1(@foo2(@foo3()))); + @error_reporting(@foo1(@foo2(@foo3()))); } catch (Exception $e) { } diff --git a/Zend/tests/error_reporting08.phpt b/Zend/tests/error_reporting08.phpt index 868c879160..3b6d3cb487 100644 --- a/Zend/tests/error_reporting08.phpt +++ b/Zend/tests/error_reporting08.phpt @@ -12,13 +12,13 @@ function foo2($arg) { } function foo3() { - error_reporting(E_ALL); - echo $undef3; - throw new Exception("test"); + error_reporting(E_ALL); + echo $undef3; + throw new Exception("test"); } try { - @foo1(@foo2(@foo3())); + @foo1(@foo2(@foo3())); } catch (Exception $e) { } diff --git a/Zend/tests/error_reporting09.phpt b/Zend/tests/error_reporting09.phpt index 287c25460f..216365a3a1 100644 --- a/Zend/tests/error_reporting09.phpt +++ b/Zend/tests/error_reporting09.phpt @@ -6,15 +6,15 @@ testing @ and error_reporting - 9 error_reporting(E_ALL & ~E_DEPRECATED); function bar() { - echo @$blah; - echo $undef2; + echo @$blah; + echo $undef2; } function foo() { - echo @$undef; - error_reporting(E_ALL); - echo $blah; - return bar(); + echo @$undef; + error_reporting(E_ALL); + echo $blah; + return bar(); } @foo(); diff --git a/Zend/tests/error_reporting10.phpt b/Zend/tests/error_reporting10.phpt index c18c04d8f0..c3ad2668cd 100644 --- a/Zend/tests/error_reporting10.phpt +++ b/Zend/tests/error_reporting10.phpt @@ -7,13 +7,13 @@ error_reporting(E_ALL); function make_exception() { - @$blah; - error_reporting(0); - throw new Exception(); + @$blah; + error_reporting(0); + throw new Exception(); } try { - @make_exception(); + @make_exception(); } catch (Exception $e) {} var_dump(error_reporting()); @@ -21,7 +21,7 @@ var_dump(error_reporting()); error_reporting(E_ALL&~E_NOTICE); try { - @make_exception(); + @make_exception(); } catch (Exception $e) {} var_dump(error_reporting()); diff --git a/Zend/tests/exception_001.phpt b/Zend/tests/exception_001.phpt index a206f3461c..232ef012ed 100644 --- a/Zend/tests/exception_001.phpt +++ b/Zend/tests/exception_001.phpt @@ -4,25 +4,25 @@ Testing nested exceptions <?php try { - try { - try { - try { - throw new Exception(NULL); - } catch (Exception $e) { - var_dump($e->getMessage()); - throw $e; - } - } catch (Exception $e) { - var_dump($e->getMessage()); - throw $e; - } - } catch (Exception $e) { - var_dump($e->getMessage()); - throw $e; - } + try { + try { + try { + throw new Exception(NULL); + } catch (Exception $e) { + var_dump($e->getMessage()); + throw $e; + } + } catch (Exception $e) { + var_dump($e->getMessage()); + throw $e; + } + } catch (Exception $e) { + var_dump($e->getMessage()); + throw $e; + } } catch (Exception $e) { - var_dump($e->getMessage()); - throw $e; + var_dump($e->getMessage()); + throw $e; } ?> diff --git a/Zend/tests/exception_002.phpt b/Zend/tests/exception_002.phpt index 4554200aab..fee76de0ee 100644 --- a/Zend/tests/exception_002.phpt +++ b/Zend/tests/exception_002.phpt @@ -6,10 +6,10 @@ Testing exception and GOTO goto foo; try { - print 1; + print 1; - foo: - print 2; + foo: + print 2; } catch (Exception $e) { } diff --git a/Zend/tests/exception_004.phpt b/Zend/tests/exception_004.phpt index d9ffc748a4..e94f0e1b6e 100644 --- a/Zend/tests/exception_004.phpt +++ b/Zend/tests/exception_004.phpt @@ -6,9 +6,9 @@ Throwing exception using a class that isn't derived from the Exception base clas class Foo { } try { - throw new Foo(); + throw new Foo(); } catch (Foo $e) { - var_dump($e); + var_dump($e); } ?> diff --git a/Zend/tests/exception_007.phpt b/Zend/tests/exception_007.phpt index b3da7099a2..c24dac1d8d 100644 --- a/Zend/tests/exception_007.phpt +++ b/Zend/tests/exception_007.phpt @@ -4,15 +4,15 @@ Setting previous exception <?php try { - try { - throw new Exception("First", 1, new Exception("Another", 0, NULL)); - } - catch (Exception $e) { - throw new Exception("Second", 2, $e); - } + try { + throw new Exception("First", 1, new Exception("Another", 0, NULL)); + } + catch (Exception $e) { + throw new Exception("Second", 2, $e); + } } catch (Exception $e) { - throw new Exception("Third", 3, $e); + throw new Exception("Third", 3, $e); } ?> diff --git a/Zend/tests/exception_008.phpt b/Zend/tests/exception_008.phpt index b88198302b..4640ec965a 100644 --- a/Zend/tests/exception_008.phpt +++ b/Zend/tests/exception_008.phpt @@ -5,16 +5,16 @@ Exception in __destruct while exception is pending class TestFirst { - function __destruct() { - throw new Exception("First"); - } + function __destruct() { + throw new Exception("First"); + } } class TestSecond { - function __destruct() { - throw new Exception("Second"); - } + function __destruct() { + throw new Exception("Second"); + } } $ar = array(new TestFirst, new TestSecond); diff --git a/Zend/tests/exception_013.phpt b/Zend/tests/exception_013.phpt index d8f5d907e3..4f5d07c7cf 100644 --- a/Zend/tests/exception_013.phpt +++ b/Zend/tests/exception_013.phpt @@ -3,25 +3,25 @@ Exceptions on improper access to static class properties --FILE-- <?php class C { - static private $p = 0; + static private $p = 0; } try { - var_dump(C::$a); + var_dump(C::$a); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; } try { - var_dump(C::$p); + var_dump(C::$p); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; } try { - unset(C::$a); + unset(C::$a); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; } var_dump(C::$a); diff --git a/Zend/tests/exception_014.phpt b/Zend/tests/exception_014.phpt index fedeee21c9..aaf411dae5 100644 --- a/Zend/tests/exception_014.phpt +++ b/Zend/tests/exception_014.phpt @@ -3,14 +3,14 @@ Exceptions on improper access to static class properties --FILE-- <?php class C { - private $p = 0; + private $p = 0; } $x = new C; try { - var_dump($x->p); + var_dump($x->p); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; } var_dump($x->p); diff --git a/Zend/tests/exception_015.phpt b/Zend/tests/exception_015.phpt index e35a1eefe2..a2b27154f6 100644 --- a/Zend/tests/exception_015.phpt +++ b/Zend/tests/exception_015.phpt @@ -4,9 +4,9 @@ Exceptions on improper access to string <?php $s = "ABC"; try { - $s[] = "D"; + $s[] = "D"; } catch (Error $e) { - echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; } $s[] = "D"; diff --git a/Zend/tests/exception_016.phpt b/Zend/tests/exception_016.phpt index 98831d933a..5b52cf72cd 100644 --- a/Zend/tests/exception_016.phpt +++ b/Zend/tests/exception_016.phpt @@ -3,9 +3,9 @@ Exceptions on improper usage of $this --FILE-- <?php try { - $this->foo(); + $this->foo(); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; } $this->foo(); diff --git a/Zend/tests/exception_017.phpt b/Zend/tests/exception_017.phpt index 77fbf2d844..260cfbd8e2 100644 --- a/Zend/tests/exception_017.phpt +++ b/Zend/tests/exception_017.phpt @@ -3,20 +3,20 @@ Exceptions on improper usage of $this --FILE-- <?php abstract class C { - abstract static function foo(); + abstract static function foo(); } function foo(callable $x) { } try { - C::foo(); + C::foo(); } catch (Error $e) { echo $e, "\n\n"; } try { - foo("C::foo"); + foo("C::foo"); } catch (Error $e) { echo $e, "\n\n"; } diff --git a/Zend/tests/exception_023.phpt b/Zend/tests/exception_023.phpt index 34de77a476..76892c82f2 100644 --- a/Zend/tests/exception_023.phpt +++ b/Zend/tests/exception_023.phpt @@ -4,7 +4,7 @@ Ensure proper backtraces with anon classes <?php (function($obj) { - throw new Exception(); + throw new Exception(); })(new class {}); ?> diff --git a/Zend/tests/exception_from_toString.phpt b/Zend/tests/exception_from_toString.phpt index ee6dde9187..dd4de341ca 100644 --- a/Zend/tests/exception_from_toString.phpt +++ b/Zend/tests/exception_from_toString.phpt @@ -19,7 +19,7 @@ try { $x = $badStr . $str; } catch (Exception $e) { echo $e->getMessage(), "\n"; } try { $x = $str .= $badStr; } catch (Exception $e) { echo $e->getMessage(), "\n"; } -var_dump($str); +var_dump($str); try { $x = $num . $badStr; } catch (Exception $e) { echo $e->getMessage(), "\n"; } try { $x = $badStr . $num; } diff --git a/Zend/tests/exception_handler_001.phpt b/Zend/tests/exception_handler_001.phpt index d4e205cceb..bb3cf4eb7a 100644 --- a/Zend/tests/exception_handler_001.phpt +++ b/Zend/tests/exception_handler_001.phpt @@ -6,7 +6,7 @@ exception handler tests - 1 set_exception_handler("foo"); function foo($e) { - var_dump(get_class($e)." thrown!"); + var_dump(get_class($e)." thrown!"); } class test extends Exception { diff --git a/Zend/tests/exception_handler_002.phpt b/Zend/tests/exception_handler_002.phpt index da57572300..4570cc85ab 100644 --- a/Zend/tests/exception_handler_002.phpt +++ b/Zend/tests/exception_handler_002.phpt @@ -6,8 +6,8 @@ exception handler tests - 2 set_exception_handler("foo"); function foo($e) { - var_dump(get_class($e)." thrown!"); - throw new Exception(); + var_dump(get_class($e)." thrown!"); + throw new Exception(); } class test extends Exception { diff --git a/Zend/tests/exception_handler_003.phpt b/Zend/tests/exception_handler_003.phpt index 8d3635c4b8..a398a16df7 100644 --- a/Zend/tests/exception_handler_003.phpt +++ b/Zend/tests/exception_handler_003.phpt @@ -5,13 +5,13 @@ exception handler tests - 3 class test { - function foo () { - set_exception_handler(array($this, "bar")); - } + function foo () { + set_exception_handler(array($this, "bar")); + } - function bar($e) { - var_dump(get_class($e)." thrown!"); - } + function bar($e) { + var_dump(get_class($e)." thrown!"); + } } $a = new test; diff --git a/Zend/tests/exception_handler_005.phpt b/Zend/tests/exception_handler_005.phpt index af96627561..cad39dc401 100644 --- a/Zend/tests/exception_handler_005.phpt +++ b/Zend/tests/exception_handler_005.phpt @@ -7,11 +7,11 @@ set_exception_handler("foo"); set_exception_handler("foo1"); function foo($e) { - var_dump(__FUNCTION__."(): ".get_class($e)." thrown!"); + var_dump(__FUNCTION__."(): ".get_class($e)." thrown!"); } function foo1($e) { - var_dump(__FUNCTION__."(): ".get_class($e)." thrown!"); + var_dump(__FUNCTION__."(): ".get_class($e)." thrown!"); } diff --git a/Zend/tests/exception_handler_006.phpt b/Zend/tests/exception_handler_006.phpt index 861a10ffa1..7bed20bbf7 100644 --- a/Zend/tests/exception_handler_006.phpt +++ b/Zend/tests/exception_handler_006.phpt @@ -9,11 +9,11 @@ set_exception_handler("foo1"); restore_exception_handler(); function foo($e) { - var_dump(__FUNCTION__."(): ".get_class($e)." thrown!"); + var_dump(__FUNCTION__."(): ".get_class($e)." thrown!"); } function foo1($e) { - var_dump(__FUNCTION__."(): ".get_class($e)." thrown!"); + var_dump(__FUNCTION__."(): ".get_class($e)." thrown!"); } diff --git a/Zend/tests/foreach.phpt b/Zend/tests/foreach.phpt index 0835e40aaf..059a3a4c32 100644 --- a/Zend/tests/foreach.phpt +++ b/Zend/tests/foreach.phpt @@ -4,11 +4,11 @@ foreach() by-ref bug <?php $foo = array(1,2,3,4); foreach($foo as $key => &$val) { - if($val == 3) { - $foo[$key] = 0; - } else { - $val++; - } + if($val == 3) { + $foo[$key] = 0; + } else { + $val++; + } } var_dump($foo); ?> diff --git a/Zend/tests/foreach_002.phpt b/Zend/tests/foreach_002.phpt index 77fe20cb64..2daa48c3f6 100644 --- a/Zend/tests/foreach_002.phpt +++ b/Zend/tests/foreach_002.phpt @@ -8,7 +8,7 @@ zend.enable_gc=1 error_reporting(E_ALL); foreach (($a = array('a' => array('a' => &$a))) as $a) { - var_dump($a); + var_dump($a); } ?> diff --git a/Zend/tests/foreach_003.phpt b/Zend/tests/foreach_003.phpt index 71b0f2a5a3..95863e71ba 100644 --- a/Zend/tests/foreach_003.phpt +++ b/Zend/tests/foreach_003.phpt @@ -8,14 +8,14 @@ class IT implements Iterator { private $trap = null; function __construct($count, $trap = null) { - $this->count = $count; - $this->trap = $trap; + $this->count = $count; + $this->trap = $trap; } function trap($trap) { - if ($trap === $this->trap) { - throw new Exception($trap); - } + if ($trap === $this->trap) { + throw new Exception($trap); + } } function rewind() {$this->trap(__FUNCTION__); $this->n = 0;} @@ -26,28 +26,28 @@ class IT implements Iterator { } foreach(['rewind', 'valid', 'key', 'current', 'next'] as $trap) { - $obj = new IT(3, $trap); - try { - // IS_CV - foreach ($obj as $key => $val) echo "$val\n"; - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - } - unset($obj); + $obj = new IT(3, $trap); + try { + // IS_CV + foreach ($obj as $key => $val) echo "$val\n"; + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + } + unset($obj); - try { - // IS_VAR - foreach (new IT(3, $trap) as $key => $val) echo "$val\n"; - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - } + try { + // IS_VAR + foreach (new IT(3, $trap) as $key => $val) echo "$val\n"; + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + } - try { - // IS_TMP_VAR - foreach ((object)new IT(2, $trap) as $key => $val) echo "$val\n"; - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - } + try { + // IS_TMP_VAR + foreach ((object)new IT(2, $trap) as $key => $val) echo "$val\n"; + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + } } ?> --EXPECT-- diff --git a/Zend/tests/foreach_004.phpt b/Zend/tests/foreach_004.phpt index 1f754a77ed..8a7b915c2e 100644 --- a/Zend/tests/foreach_004.phpt +++ b/Zend/tests/foreach_004.phpt @@ -6,14 +6,14 @@ class IT extends ArrayIterator { private $n = 0; function __construct($trap = null) { - parent::__construct([0, 1]); - $this->trap = $trap; + parent::__construct([0, 1]); + $this->trap = $trap; } function trap($trap) { - if ($trap === $this->trap) { - throw new Exception($trap); - } + if ($trap === $this->trap) { + throw new Exception($trap); + } } function rewind() {$this->trap(__FUNCTION__); return parent::rewind();} @@ -23,28 +23,28 @@ class IT extends ArrayIterator { } foreach(['rewind', 'valid', 'key', 'next'] as $trap) { - $obj = new IT($trap); - try { - // IS_CV - foreach ($obj as $key => &$val) echo "$val\n"; - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - } - unset($obj); + $obj = new IT($trap); + try { + // IS_CV + foreach ($obj as $key => &$val) echo "$val\n"; + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + } + unset($obj); - try { - // IS_VAR - foreach (new IT($trap) as $key => &$val) echo "$val\n"; - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - } + try { + // IS_VAR + foreach (new IT($trap) as $key => &$val) echo "$val\n"; + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + } - try { - // IS_TMP_VAR - foreach ((object)new IT($trap) as $key => &$val) echo "$val\n"; - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - } + try { + // IS_TMP_VAR + foreach ((object)new IT($trap) as $key => &$val) echo "$val\n"; + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + } } ?> --EXPECT-- diff --git a/Zend/tests/foreach_005.phpt b/Zend/tests/foreach_005.phpt index 063dc70de0..097d74d4fd 100644 --- a/Zend/tests/foreach_005.phpt +++ b/Zend/tests/foreach_005.phpt @@ -4,10 +4,10 @@ Nested foreach by reference on the same array <?php $a = [1,2,3]; foreach($a as &$x) { - foreach($a as &$y) { - echo "$x-$y\n"; - $y++; - } + foreach($a as &$y) { + echo "$x-$y\n"; + $y++; + } } ?> --EXPECT-- diff --git a/Zend/tests/foreach_006.phpt b/Zend/tests/foreach_006.phpt index 65d6fdc52c..8e81a686b5 100644 --- a/Zend/tests/foreach_006.phpt +++ b/Zend/tests/foreach_006.phpt @@ -3,9 +3,9 @@ Foreach by reference on constant --FILE-- <?php for ($i = 0; $i < 3; $i++) { - foreach ([1,2,3] as &$val) { - echo "$val\n"; - } + foreach ([1,2,3] as &$val) { + echo "$val\n"; + } } ?> --EXPECT-- diff --git a/Zend/tests/foreach_007.phpt b/Zend/tests/foreach_007.phpt index b99bc73ebe..09cf60246e 100644 --- a/Zend/tests/foreach_007.phpt +++ b/Zend/tests/foreach_007.phpt @@ -4,8 +4,8 @@ Foreach by reference and inserting new element when we are already at the end <?php $a = [1]; foreach($a as &$v) { - echo "$v\n"; - $a[1]=2; + echo "$v\n"; + $a[1]=2; } ?> --EXPECT-- diff --git a/Zend/tests/foreach_008.phpt b/Zend/tests/foreach_008.phpt index c68bcd89da..c412ac3f8d 100644 --- a/Zend/tests/foreach_008.phpt +++ b/Zend/tests/foreach_008.phpt @@ -4,13 +4,13 @@ Nested foreach by reference and array modification <?php $a = [0, 1, 2, 3]; foreach ($a as &$x) { - foreach ($a as &$y) { - echo "$x - $y\n"; - if ($x == 0 && $y == 1) { - unset($a[2]); - unset($a[1]); - } - } + foreach ($a as &$y) { + echo "$x - $y\n"; + if ($x == 0 && $y == 1) { + unset($a[2]); + unset($a[1]); + } + } } ?> --EXPECT-- diff --git a/Zend/tests/foreach_009.phpt b/Zend/tests/foreach_009.phpt index 754d9acb2f..a1859fc7ef 100644 --- a/Zend/tests/foreach_009.phpt +++ b/Zend/tests/foreach_009.phpt @@ -5,12 +5,12 @@ Nested foreach by reference and array modification with resize $a = [0, 1, 2, 3, 4, 5, 6, 7]; unset($a[0], $a[1], $a[2], $a[3]); foreach ($a as &$ref) { - foreach ($a as &$ref2) { - echo "$ref-$ref2\n"; - if ($ref == 5 && $ref2 == 6) { - $a[42] = 8; - } - } + foreach ($a as &$ref2) { + echo "$ref-$ref2\n"; + if ($ref == 5 && $ref2 == 6) { + $a[42] = 8; + } + } } ?> --EXPECT-- diff --git a/Zend/tests/foreach_010.phpt b/Zend/tests/foreach_010.phpt index a86f87f6df..8a60b89dc2 100644 --- a/Zend/tests/foreach_010.phpt +++ b/Zend/tests/foreach_010.phpt @@ -5,12 +5,12 @@ Nested foreach by value over object and object modification with resize $o = (object)['a'=>0, 'b'=>1, 'c'=>2, 'd'=>3, 'e'=>4, 'f'=>5, 'g'=>6, 'h'=>7]; unset($o->a, $o->b, $o->c, $o->d); foreach ($o as $v1) { - foreach ($o as $v2) { - echo "$v1-$v2\n"; - if ($v1 == 5 && $v2 == 6) { - $o->i = 8; - } - } + foreach ($o as $v2) { + echo "$v1-$v2\n"; + if ($v1 == 5 && $v2 == 6) { + $o->i = 8; + } + } } ?> --EXPECT-- diff --git a/Zend/tests/foreach_011.phpt b/Zend/tests/foreach_011.phpt index e91426fb27..37eb55a126 100644 --- a/Zend/tests/foreach_011.phpt +++ b/Zend/tests/foreach_011.phpt @@ -4,10 +4,10 @@ sort() functions precerve foreach by reference iterator pointer <?php $a = [1,2,3,4,5,0]; foreach($a as &$v) { - echo "$v\n"; - if ($v == 3) { - rsort($a); - } + echo "$v\n"; + if ($v == 3) { + rsort($a); + } } ?> --EXPECT-- diff --git a/Zend/tests/foreach_012.phpt b/Zend/tests/foreach_012.phpt index 517e0ac943..59a5aff0a8 100644 --- a/Zend/tests/foreach_012.phpt +++ b/Zend/tests/foreach_012.phpt @@ -4,10 +4,10 @@ array_walk() function precerve foreach by reference iterator pointer <?php $a = [1,2,3,4,5]; foreach($a as &$v) { - echo "$v\n"; - if ($v == 3) { - array_walk($a, function (&$x) {$x+=10;}); - } + echo "$v\n"; + if ($v == 3) { + array_walk($a, function (&$x) {$x+=10;}); + } } ?> --EXPECT-- diff --git a/Zend/tests/foreach_013.phpt b/Zend/tests/foreach_013.phpt index cfbb3d7f79..8a88c459ec 100644 --- a/Zend/tests/foreach_013.phpt +++ b/Zend/tests/foreach_013.phpt @@ -4,10 +4,10 @@ array_push() function precerve foreach by reference iterator pointer <?php $a = [1,2,3]; foreach($a as &$v) { - echo "$v\n"; - if ($v == 3) { - array_push($a, 4); - } + echo "$v\n"; + if ($v == 3) { + array_push($a, 4); + } } ?> --EXPECT-- diff --git a/Zend/tests/foreach_014.phpt b/Zend/tests/foreach_014.phpt index 8d0ac582a9..ce05ad1410 100644 --- a/Zend/tests/foreach_014.phpt +++ b/Zend/tests/foreach_014.phpt @@ -4,10 +4,10 @@ array_pop() function precerve foreach by reference iterator pointer <?php $a = [1,2,3]; foreach($a as &$v) { - echo "$v\n"; - if ($v == 2) { - array_pop($a); - } + echo "$v\n"; + if ($v == 2) { + array_pop($a); + } } ?> --EXPECT-- diff --git a/Zend/tests/foreach_015.phpt b/Zend/tests/foreach_015.phpt index b7482b66a0..865356db1b 100644 --- a/Zend/tests/foreach_015.phpt +++ b/Zend/tests/foreach_015.phpt @@ -4,8 +4,8 @@ array_shift() function precerve foreach by reference iterator pointer <?php $a = [1,2,3,4]; foreach($a as &$v) { - echo "$v\n"; - array_shift($a); + echo "$v\n"; + array_shift($a); } var_dump($a); ?> diff --git a/Zend/tests/foreach_016.phpt b/Zend/tests/foreach_016.phpt index 423c8dd0a6..461c5b2431 100644 --- a/Zend/tests/foreach_016.phpt +++ b/Zend/tests/foreach_016.phpt @@ -4,10 +4,10 @@ array_unshift() function precerve foreach by reference iterator pointer <?php $a = [1,2,3]; foreach($a as &$v) { - echo "$v\n"; - if ($v == 2) { - array_unshift($a, 0, 0, 0, 0, 0, 0, 0, 0); - } + echo "$v\n"; + if ($v == 2) { + array_unshift($a, 0, 0, 0, 0, 0, 0, 0, 0); + } } var_dump(count($a)); ?> diff --git a/Zend/tests/foreach_017.phpt b/Zend/tests/foreach_017.phpt index e27b04c934..0220862363 100644 --- a/Zend/tests/foreach_017.phpt +++ b/Zend/tests/foreach_017.phpt @@ -6,11 +6,11 @@ array_splice() function precerve foreach by reference iterator pointer $done = 0; $a = [0,1,2,3,4]; foreach($a as &$v) { - echo "$v\n"; - if (!$done && $v == 3) { - $done = 1; - array_splice($a, 1, 2); - } + echo "$v\n"; + if (!$done && $v == 3) { + $done = 1; + array_splice($a, 1, 2); + } } echo "\n"; @@ -18,11 +18,11 @@ echo "\n"; $done = 0; $a = [0,1,2,3,4]; foreach($a as &$v) { - echo "$v\n"; - if (!$done && $v == 0) { - $done = 1; - array_splice($a, 2, 2); - } + echo "$v\n"; + if (!$done && $v == 0) { + $done = 1; + array_splice($a, 2, 2); + } } echo "\n"; @@ -30,11 +30,11 @@ echo "\n"; $done = 0; $a = [0,1,2,3,4]; foreach($a as &$v) { - echo "$v\n"; - if (!$done && $v == 2) { - $done = 1; - array_splice($a, 1, 3); - } + echo "$v\n"; + if (!$done && $v == 2) { + $done = 1; + array_splice($a, 1, 3); + } } echo "\n"; @@ -44,11 +44,11 @@ $replacement = ['x', 'y', 'z']; $done = 0; $a = [0,1,2,3,4]; foreach($a as &$v) { - echo "$v\n"; - if (!$done && $v == 3) { - $done = 1; - array_splice($a, 1, 2, $replacement); - } + echo "$v\n"; + if (!$done && $v == 3) { + $done = 1; + array_splice($a, 1, 2, $replacement); + } } echo "\n"; @@ -56,11 +56,11 @@ echo "\n"; $done = 0; $a = [0,1,2,3,4]; foreach($a as &$v) { - echo "$v\n"; - if (!$done && $v == 0) { - $done = 1; - array_splice($a, 2, 2, $replacement); - } + echo "$v\n"; + if (!$done && $v == 0) { + $done = 1; + array_splice($a, 2, 2, $replacement); + } } echo "\n"; @@ -68,11 +68,11 @@ echo "\n"; $done = 0; $a = [0,1,2,3,4]; foreach($a as &$v) { - echo "$v\n"; - if (!$done && $v == 2) { - $done = 1; - array_splice($a, 1, 3, $replacement); - } + echo "$v\n"; + if (!$done && $v == 2) { + $done = 1; + array_splice($a, 1, 3, $replacement); + } } echo "\n"; ?> diff --git a/Zend/tests/foreach_shadowed_dyn_property.phpt b/Zend/tests/foreach_shadowed_dyn_property.phpt index 8f71cdf240..acbd05bf6d 100644 --- a/Zend/tests/foreach_shadowed_dyn_property.phpt +++ b/Zend/tests/foreach_shadowed_dyn_property.phpt @@ -2,7 +2,7 @@ Dynamic property shadowed by private property --FILE-- <?php - + class Test { private $prop = "Test"; diff --git a/Zend/tests/foreach_unset_globals.phpt b/Zend/tests/foreach_unset_globals.phpt index 8c505cdb04..96ab1bf6a3 100644 --- a/Zend/tests/foreach_unset_globals.phpt +++ b/Zend/tests/foreach_unset_globals.phpt @@ -5,7 +5,7 @@ traverse an array and use its keys to unset GLOBALS $arr = array("a" => 1, "b" => 2); foreach ($arr as $key => $val) { - unset($GLOBALS[$key]); + unset($GLOBALS[$key]); } var_dump($arr); diff --git a/Zend/tests/fr47160.phpt b/Zend/tests/fr47160.phpt index 6567804902..9702537e37 100644 --- a/Zend/tests/fr47160.phpt +++ b/Zend/tests/fr47160.phpt @@ -4,36 +4,36 @@ Calling method from array <?php class Hello { - public function world($x) { - echo "Hello, $x\n";return $this; - } + public function world($x) { + echo "Hello, $x\n";return $this; + } } class Hello2 { - static public function world($x) { - echo "Hello, $x\n"; - } + static public function world($x) { + echo "Hello, $x\n"; + } } class Magic { - public function __call($f, $a) { - printf("%s called (%s)!\n", __METHOD__, $f); - } + public function __call($f, $a) { + printf("%s called (%s)!\n", __METHOD__, $f); + } } class Magic2 { - public static function __callStatic($f, $a) { - printf("%s called (%s)!\n", __METHOD__, $f); - } + public static function __callStatic($f, $a) { + printf("%s called (%s)!\n", __METHOD__, $f); + } } class Magic3 { - public static function __callStatic($f, $a) { - printf("%s called (%s)!\n", __METHOD__, $f); - } - public function __call($f, $a) { - printf("%s called (%s)!\n", __METHOD__, $f); - } + public static function __callStatic($f, $a) { + printf("%s called (%s)!\n", __METHOD__, $f); + } + public function __call($f, $a) { + printf("%s called (%s)!\n", __METHOD__, $f); + } } $h= new Hello; @@ -44,7 +44,7 @@ var_dump(call_user_func($f, 'again')); printf("-----\n"); function bar() { - return array(new Hello,'world'); + return array(new Hello,'world'); } $f = bar(); var_dump($f('there')); diff --git a/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt b/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt index 2134dfe0f6..33337bb908 100644 --- a/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt +++ b/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt @@ -4,16 +4,16 @@ Call internal function with incorrect number of arguments with strict types <?php declare(strict_types=1); try { - substr("foo"); + substr("foo"); } catch (ArgumentCountError $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; + echo get_class($e) . PHP_EOL; + echo $e->getMessage() . PHP_EOL; } try { array_diff([]); } catch (ArgumentCountError $e) { - echo get_class($e) . PHP_EOL; + echo get_class($e) . PHP_EOL; echo $e->getMessage(), "\n"; } --EXPECT-- diff --git a/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt b/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt index 94525c85b7..1e7969b44c 100644 --- a/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt +++ b/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt @@ -3,35 +3,35 @@ Call userland function with incorrect number of arguments --FILE-- <?php try { - function foo($bar) { } - foo(); + function foo($bar) { } + foo(); } catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; + echo get_class($e) . PHP_EOL; + echo $e->getMessage() . PHP_EOL; } try { - function bar($foo, $bar) { } - bar(1); + function bar($foo, $bar) { } + bar(1); } catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; + echo get_class($e) . PHP_EOL; + echo $e->getMessage() . PHP_EOL; } function bat(int $foo, string $bar) { } try { - bat(123); + bat(123); } catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; + echo get_class($e) . PHP_EOL; + echo $e->getMessage() . PHP_EOL; } try { - bat("123"); + bat("123"); } catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; + echo get_class($e) . PHP_EOL; + echo $e->getMessage() . PHP_EOL; } --EXPECTF-- ArgumentCountError diff --git a/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt b/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt index 1e535ea9f9..e47d03d5f6 100644 --- a/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt +++ b/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt @@ -4,42 +4,42 @@ Call userland function with incorrect number of arguments with strict types <?php declare(strict_types=1); try { - function foo($bar) { } - foo(); + function foo($bar) { } + foo(); } catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; + echo get_class($e) . PHP_EOL; + echo $e->getMessage() . PHP_EOL; } try { - function bar($foo, $bar) { } - bar(1); + function bar($foo, $bar) { } + bar(1); } catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; + echo get_class($e) . PHP_EOL; + echo $e->getMessage() . PHP_EOL; } function bat(int $foo, string $bar) { } try { - bat(123); + bat(123); } catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; + echo get_class($e) . PHP_EOL; + echo $e->getMessage() . PHP_EOL; } try { - bat("123"); + bat("123"); } catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; + echo get_class($e) . PHP_EOL; + echo $e->getMessage() . PHP_EOL; } try { - bat(123, 456); + bat(123, 456); } catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; + echo get_class($e) . PHP_EOL; + echo $e->getMessage() . PHP_EOL; } --EXPECTF-- ArgumentCountError diff --git a/Zend/tests/function_arguments_003.phpt b/Zend/tests/function_arguments_003.phpt index b882476d1d..aa7fd0a197 100644 --- a/Zend/tests/function_arguments_003.phpt +++ b/Zend/tests/function_arguments_003.phpt @@ -5,7 +5,7 @@ Function Argument Parsing #003 const a = 10; function t1($a = 1 + 1, $b = 1 << 2, $c = "foo" . "bar", $d = a * 10) { - var_dump($a, $b, $c, $d); + var_dump($a, $b, $c, $d); } t1(); diff --git a/Zend/tests/function_exists_basic.phpt b/Zend/tests/function_exists_basic.phpt index 5125350d8d..025a4a7d41 100644 --- a/Zend/tests/function_exists_basic.phpt +++ b/Zend/tests/function_exists_basic.phpt @@ -24,7 +24,7 @@ var_dump(function_exists('g')); echo "Method: "; Class C { - static function f() {} + static function f() {} } var_dump(function_exists('C::f')); ?> diff --git a/Zend/tests/gc_011.phpt b/Zend/tests/gc_011.phpt index d11d7b6b46..3c6731c547 100644 --- a/Zend/tests/gc_011.phpt +++ b/Zend/tests/gc_011.phpt @@ -5,10 +5,10 @@ zend.enable_gc=1 --FILE-- <?php class Foo { - public $a; - function __destruct() { - echo __FUNCTION__,"\n"; - } + public $a; + function __destruct() { + echo __FUNCTION__,"\n"; + } } $a = new Foo(); $a->a = $a; diff --git a/Zend/tests/gc_012.phpt b/Zend/tests/gc_012.phpt index f6c8538979..409d2d8f16 100644 --- a/Zend/tests/gc_012.phpt +++ b/Zend/tests/gc_012.phpt @@ -6,8 +6,8 @@ zend.enable_gc=1 <?php $a=array(); for ($i=0; $i < 1000; $i++) { - $a[$i] = array(array()); - $a[$i][0] = & $a[$i]; + $a[$i] = array(array()); + $a[$i][0] = & $a[$i]; } var_dump(gc_collect_cycles()); unset($a); diff --git a/Zend/tests/gc_013.phpt b/Zend/tests/gc_013.phpt index 0c5424086a..515d58b65e 100644 --- a/Zend/tests/gc_013.phpt +++ b/Zend/tests/gc_013.phpt @@ -6,7 +6,7 @@ zend.enable_gc=1 <?php $a = array(); for ($i = 0; $i < 10001; $i++) { - $a[$i] =& $a; + $a[$i] =& $a; } $a[] = "xxx"; unset($a); diff --git a/Zend/tests/gc_014.phpt b/Zend/tests/gc_014.phpt index 4fd8948af5..68fda48cc5 100644 --- a/Zend/tests/gc_014.phpt +++ b/Zend/tests/gc_014.phpt @@ -6,8 +6,8 @@ zend.enable_gc=1 <?php $a = new stdClass(); for ($i = 0; $i < 10001; $i++) { - $b =& $a; - $a->{"a".$i} = $a; + $b =& $a; + $a->{"a".$i} = $a; } unset($b); $a->b = "xxx"; diff --git a/Zend/tests/gc_016.phpt b/Zend/tests/gc_016.phpt index 211f03a605..f28005e1bc 100644 --- a/Zend/tests/gc_016.phpt +++ b/Zend/tests/gc_016.phpt @@ -5,14 +5,14 @@ zend.enable_gc=1 --FILE-- <?php class Foo { - public $a; - function __destruct() { - echo "-> "; - $a = array(); - $a[] =& $a; - unset($a); - var_dump(gc_collect_cycles()); - } + public $a; + function __destruct() { + echo "-> "; + $a = array(); + $a[] =& $a; + unset($a); + var_dump(gc_collect_cycles()); + } } $a = new Foo(); $a->a = $a; diff --git a/Zend/tests/gc_017.phpt b/Zend/tests/gc_017.phpt index 55f381992e..118da83413 100644 --- a/Zend/tests/gc_017.phpt +++ b/Zend/tests/gc_017.phpt @@ -5,23 +5,23 @@ zend.enable_gc=1 --FILE-- <?php class Node { - public $name; - public $children; - public $parent; - function __construct($name) { - $this->name = $name; - $this->parent = null; - } - function insert($node) { - $node->parent = $this; - $this->children[] = $node; - } - function __destruct() { - var_dump($this->name); - unset($this->name); - unset($this->children); - unset($this->parent); - } + public $name; + public $children; + public $parent; + function __construct($name) { + $this->name = $name; + $this->parent = null; + } + function insert($node) { + $node->parent = $this; + $this->children[] = $node; + } + function __destruct() { + var_dump($this->name); + unset($this->name); + unset($this->children); + unset($this->parent); + } } $a = new Node('A'); $b = new Node('B'); diff --git a/Zend/tests/gc_023.phpt b/Zend/tests/gc_023.phpt index 6d6e1e6376..3f1b0f0187 100644 --- a/Zend/tests/gc_023.phpt +++ b/Zend/tests/gc_023.phpt @@ -6,16 +6,16 @@ zend.enable_gc=1 <?php $a=array(); for ($i=0; $i < 9999; $i++) { - $a[$i] = array(array()); - $a[$i][0] = & $a[$i]; + $a[$i] = array(array()); + $a[$i][0] = & $a[$i]; } var_dump(gc_collect_cycles()); unset($a); var_dump(gc_collect_cycles()); $a=array(); for ($i=0; $i < 10001; $i++) { - $a[$i] = array(array()); - $a[$i][0] = & $a[$i]; + $a[$i] = array(array()); + $a[$i][0] = & $a[$i]; } var_dump(gc_collect_cycles()); unset($a); // 10000 zvals collected automatic diff --git a/Zend/tests/gc_027.phpt b/Zend/tests/gc_027.phpt index d499cc314a..7f94b82e81 100644 --- a/Zend/tests/gc_027.phpt +++ b/Zend/tests/gc_027.phpt @@ -5,9 +5,9 @@ zend.enable_gc=1 --FILE-- <?php try { - throw new Exception(); + throw new Exception(); } catch (Exception $e) { - gc_collect_cycles(); + gc_collect_cycles(); } echo "ok\n"; --EXPECT-- diff --git a/Zend/tests/gc_028.phpt b/Zend/tests/gc_028.phpt index fb2ea92c91..aabff91a3d 100644 --- a/Zend/tests/gc_028.phpt +++ b/Zend/tests/gc_028.phpt @@ -5,15 +5,15 @@ zend.enable_gc=1 --FILE-- <?php class Foo { - public $bar; - function __destruct() { - if ($this->bar !== null) { - unset($this->bar); - } - } + public $bar; + function __destruct() { + if ($this->bar !== null) { + unset($this->bar); + } + } } class Bar { - public $foo; + public $foo; function __destruct() { if ($this->foo !== null) { unset($this->foo); diff --git a/Zend/tests/gc_029.phpt b/Zend/tests/gc_029.phpt index 89c55e5ba7..b5ecc8fff2 100644 --- a/Zend/tests/gc_029.phpt +++ b/Zend/tests/gc_029.phpt @@ -5,17 +5,17 @@ zend.enable_gc=1 --FILE-- <?php class Foo { - public $bar; - public $x = array(1,2,3); - function __destruct() { - if ($this->bar !== null) { - $this->x = null; - unset($this->bar); - } - } + public $bar; + public $x = array(1,2,3); + function __destruct() { + if ($this->bar !== null) { + $this->x = null; + unset($this->bar); + } + } } class Bar { - public $foo; + public $foo; function __destruct() { if ($this->foo !== null) { unset($this->foo); diff --git a/Zend/tests/gc_033.phpt b/Zend/tests/gc_033.phpt index 1fd36976ad..cc28fd6a10 100644 --- a/Zend/tests/gc_033.phpt +++ b/Zend/tests/gc_033.phpt @@ -18,9 +18,9 @@ unset($a); /* let's full the gc roots */ for ($i=0; $i<9999; $i++) { - $b = range(0, 1); - $b[0] = &$b; - unset($b); + $b = range(0, 1); + $b[0] = &$b; + unset($b); } /* then $a will be freed, but $a->a[0] is not. reference to a freed $a */ diff --git a/Zend/tests/gc_035.phpt b/Zend/tests/gc_035.phpt index 187af9108b..56b4aae866 100644 --- a/Zend/tests/gc_035.phpt +++ b/Zend/tests/gc_035.phpt @@ -5,11 +5,11 @@ zend.enable_gc = 1 --FILE-- <?php class A { - public $a; - public $x; - function __destruct() { - unset($this->x); - } + public $a; + public $x; + function __destruct() { + unset($this->x); + } } $a = new A; $a->a = $a; diff --git a/Zend/tests/gc_036.phpt b/Zend/tests/gc_036.phpt index 67f9a45465..40b65987e2 100644 --- a/Zend/tests/gc_036.phpt +++ b/Zend/tests/gc_036.phpt @@ -5,12 +5,12 @@ zend.enable_gc = 1 --FILE-- <?php function &foo() { - $a = []; - $a[] =& $a; - return $a; + $a = []; + $a[] =& $a; + return $a; } function bar() { - gc_collect_cycles(); + gc_collect_cycles(); } bar(foo()); echo "ok\n"; diff --git a/Zend/tests/gc_038.phpt b/Zend/tests/gc_038.phpt index 737025ae2d..d3219531d6 100644 --- a/Zend/tests/gc_038.phpt +++ b/Zend/tests/gc_038.phpt @@ -5,115 +5,115 @@ zend.enable_gc = 1 --FILE-- <?php function test_add() { - $x = new stdClass; - $x->x= $x; - @$x += 5; - $n = gc_collect_cycles(); - echo "+=\t$n\n"; + $x = new stdClass; + $x->x= $x; + @$x += 5; + $n = gc_collect_cycles(); + echo "+=\t$n\n"; } test_add(); function test_sub() { - $x = new stdClass; - $x->x= $x; - @$x -= 5; - $n = gc_collect_cycles(); - echo "-=\t$n\n"; + $x = new stdClass; + $x->x= $x; + @$x -= 5; + $n = gc_collect_cycles(); + echo "-=\t$n\n"; } test_sub(); function test_mul() { - $x = new stdClass; - $x->x= $x; - @$x *= 5; - $n = gc_collect_cycles(); - echo "*=\t$n\n"; + $x = new stdClass; + $x->x= $x; + @$x *= 5; + $n = gc_collect_cycles(); + echo "*=\t$n\n"; } test_mul(); function test_div() { - $x = new stdClass; - $x->x= $x; - @$x /= 5; - $n = gc_collect_cycles(); - echo "/=\t$n\n"; + $x = new stdClass; + $x->x= $x; + @$x /= 5; + $n = gc_collect_cycles(); + echo "/=\t$n\n"; } test_div(); function test_mod() { - $x = new stdClass; - $x->x= $x; - @$x %= 5; - $n = gc_collect_cycles(); - echo "%=\t$n\n"; + $x = new stdClass; + $x->x= $x; + @$x %= 5; + $n = gc_collect_cycles(); + echo "%=\t$n\n"; } test_mod(); function test_sl() { - $x = new stdClass; - $x->x= $x; - @$x <<= 5; - $n = gc_collect_cycles(); - echo "<<=\t$n\n"; + $x = new stdClass; + $x->x= $x; + @$x <<= 5; + $n = gc_collect_cycles(); + echo "<<=\t$n\n"; } test_sl(); function test_sr() { - $x = new stdClass; - $x->x= $x; - @$x >>= 5; - $n = gc_collect_cycles(); - echo ">>=\t$n\n"; + $x = new stdClass; + $x->x= $x; + @$x >>= 5; + $n = gc_collect_cycles(); + echo ">>=\t$n\n"; } test_sr(); function test_or() { - $x = new stdClass; - $x->x= $x; - @$x |= 1; - $n = gc_collect_cycles(); - echo "|=\t$n\n"; + $x = new stdClass; + $x->x= $x; + @$x |= 1; + $n = gc_collect_cycles(); + echo "|=\t$n\n"; } test_or(); function test_and() { - $x = new stdClass; - $x->x= $x; - @$x &= 1; - $n = gc_collect_cycles(); - echo "&=\t$n\n"; + $x = new stdClass; + $x->x= $x; + @$x &= 1; + $n = gc_collect_cycles(); + echo "&=\t$n\n"; } test_and(); function test_xor() { - $x = new stdClass; - $x->x= $x; - @$x ^= 1; - $n = gc_collect_cycles(); - echo "^=\t$n\n"; + $x = new stdClass; + $x->x= $x; + @$x ^= 1; + $n = gc_collect_cycles(); + echo "^=\t$n\n"; } test_xor(); function test_pow() { - $x = new stdClass; - $x->x= $x; - @$x **= 1; - $n = gc_collect_cycles(); - echo "**=\t$n\n"; + $x = new stdClass; + $x->x= $x; + @$x **= 1; + $n = gc_collect_cycles(); + echo "**=\t$n\n"; } test_pow(); class Y { - function __toString() { - return "y"; - } + function __toString() { + return "y"; + } } function test_concat() { - $x = new Y; - $x->x= $x; - @$x .= "x"; - $n = gc_collect_cycles(); - echo ".=\t$n\n"; + $x = new Y; + $x->x= $x; + @$x .= "x"; + $n = gc_collect_cycles(); + echo ".=\t$n\n"; } test_concat(); ?> diff --git a/Zend/tests/gc_041.phpt b/Zend/tests/gc_041.phpt index fc849991e1..e5870286ba 100644 --- a/Zend/tests/gc_041.phpt +++ b/Zend/tests/gc_041.phpt @@ -5,11 +5,11 @@ zend.enable_gc = 1 --FILE-- <?php class ryat { - var $ryat; + var $ryat; var $chtg; var $nested; - function __destruct() { - $GLOBALS['x'] = $this; + function __destruct() { + $GLOBALS['x'] = $this; } } $o = new ryat; diff --git a/Zend/tests/generators/basic_yield_from_exception_handling.phpt b/Zend/tests/generators/basic_yield_from_exception_handling.phpt index 6b622847cd..2b6b04513a 100644 --- a/Zend/tests/generators/basic_yield_from_exception_handling.phpt +++ b/Zend/tests/generators/basic_yield_from_exception_handling.phpt @@ -3,27 +3,27 @@ Exceptions in linear yield from setup --FILE-- <?php function from($off) { - try { - yield $off + 1; - } catch (Exception $e) { print "catch in from()\n$e\n"; } - yield $off + 2; + try { + yield $off + 1; + } catch (Exception $e) { print "catch in from()\n$e\n"; } + yield $off + 2; } function gen() { - try { - yield "gen" => 0; - } catch (Exception $e) { print "catch in gen()\n$e\n"; } - try { - yield from from(0); - } catch (Exception $e) { print "catch in gen()\n$e\n"; } - yield from from(2); + try { + yield "gen" => 0; + } catch (Exception $e) { print "catch in gen()\n$e\n"; } + try { + yield from from(0); + } catch (Exception $e) { print "catch in gen()\n$e\n"; } + yield from from(2); } $i = 0; try { - for ($gen = gen(); $gen->valid(); $gen->throw(new Exception((string) $i++))) { - var_dump($gen->current()); - } + for ($gen = gen(); $gen->valid(); $gen->throw(new Exception((string) $i++))) { + var_dump($gen->current()); + } } catch (Exception $e) { print "catch in {main}\n$e\n"; } var_dump($gen->valid()); diff --git a/Zend/tests/generators/basic_yield_from_proxying.phpt b/Zend/tests/generators/basic_yield_from_proxying.phpt index 74ffc5da80..ce9a09cba3 100644 --- a/Zend/tests/generators/basic_yield_from_proxying.phpt +++ b/Zend/tests/generators/basic_yield_from_proxying.phpt @@ -3,24 +3,24 @@ Basic test if yield from works --FILE-- <?php function from() { - yield "from" => 1; - yield 2; + yield "from" => 1; + yield 2; } function gen() { - yield "gen" => 0; - yield from from(); - yield 3; + yield "gen" => 0; + yield from from(); + yield 3; } /* foreach API */ foreach (gen() as $k => $v) { - var_dump($k, $v); + var_dump($k, $v); } /* iterator API */ for ($gen = gen(); $gen->valid(); $gen->next()) { - var_dump($gen->key(), $gen->current()); + var_dump($gen->key(), $gen->current()); } ?> --EXPECT-- diff --git a/Zend/tests/generators/bug63066.phpt b/Zend/tests/generators/bug63066.phpt index 3237c8a7a3..df62fcebe2 100644 --- a/Zend/tests/generators/bug63066.phpt +++ b/Zend/tests/generators/bug63066.phpt @@ -4,12 +4,12 @@ Bug #63066 (Calling an undefined method in a generator results in a seg fault) <?php function gen($o) { - yield 'foo'; - $o->fatalError(); + yield 'foo'; + $o->fatalError(); } foreach(gen(new stdClass()) as $value) - echo $value, "\n"; + echo $value, "\n"; --EXPECTF-- foo diff --git a/Zend/tests/generators/bug67497.phpt b/Zend/tests/generators/bug67497.phpt index edbd578da5..727847320b 100644 --- a/Zend/tests/generators/bug67497.phpt +++ b/Zend/tests/generators/bug67497.phpt @@ -9,7 +9,7 @@ function gen() { } try { - eval('abc'); + eval('abc'); } catch (ParseError $ex) { } diff --git a/Zend/tests/generators/bug70904.phpt b/Zend/tests/generators/bug70904.phpt index cd00e0bb34..2fbbfe6918 100644 --- a/Zend/tests/generators/bug70904.phpt +++ b/Zend/tests/generators/bug70904.phpt @@ -4,13 +4,13 @@ Bug #70904 (yield from incorrectly marks valid generator as finished) <?php function g1() { - yield 1; + yield 1; } function g2($g1) { - yield from $g1; - echo "reached!\n"; - yield 2; + yield from $g1; + echo "reached!\n"; + yield 2; } $g1 = g1(); diff --git a/Zend/tests/generators/bug71297.phpt b/Zend/tests/generators/bug71297.phpt index eed7278601..5d63135928 100644 --- a/Zend/tests/generators/bug71297.phpt +++ b/Zend/tests/generators/bug71297.phpt @@ -4,20 +4,20 @@ Bug #71297 (Memory leak with consecutive yield from) <?php function foo() { - yield array_fill(0, 10000, 4); + yield array_fill(0, 10000, 4); } function genLeak() { - $i = 0; - while (1) { - yield from foo(); - print $i++; - } + $i = 0; + while (1) { + yield from foo(); + print $i++; + } } $x = 0; foreach (genLeak() as $i) { - if ($x++ == 3) break; + if ($x++ == 3) break; } ?> diff --git a/Zend/tests/generators/bug71441.phpt b/Zend/tests/generators/bug71441.phpt index 14395d2402..a0d270a05f 100644 --- a/Zend/tests/generators/bug71441.phpt +++ b/Zend/tests/generators/bug71441.phpt @@ -7,13 +7,13 @@ $num = 2000; /* to be sure to be in wild memory */ $add = str_repeat("1 +", $num); $gen = (eval(<<<PHP return function (): \Generator { - try { - \$a = 1; - \$foo = \$a + $add \$a; - return yield \$foo; - } finally { - print "Ok\n"; - } + try { + \$a = 1; + \$foo = \$a + $add \$a; + return yield \$foo; + } finally { + print "Ok\n"; + } }; PHP ))(); diff --git a/Zend/tests/generators/bug71601.phpt b/Zend/tests/generators/bug71601.phpt index 09da2a5077..c8e226329d 100644 --- a/Zend/tests/generators/bug71601.phpt +++ b/Zend/tests/generators/bug71601.phpt @@ -4,22 +4,22 @@ Bug #71601 (finally block not executed after yield from) <?php function gen1() { - try { - yield 1; - yield 2; - return true; - } finally { - echo "Inner finally\n"; - } + try { + yield 1; + yield 2; + return true; + } finally { + echo "Inner finally\n"; + } } function gen2() { - try { - echo "Entered try/catch\n"; - var_dump(yield from gen1()); - } finally { - echo "Finally\n"; - } + try { + echo "Entered try/catch\n"; + var_dump(yield from gen1()); + } finally { + echo "Finally\n"; + } } $generator = gen2(); diff --git a/Zend/tests/generators/bug72523.phpt b/Zend/tests/generators/bug72523.phpt index 74dc583974..efce6f6936 100644 --- a/Zend/tests/generators/bug72523.phpt +++ b/Zend/tests/generators/bug72523.phpt @@ -4,9 +4,9 @@ Bug #72523 (dtrace issue with reflection (failed test)) <?php $gen = (new class() { - function a() { - yield "okey"; - } + function a() { + yield "okey"; + } })->a(); var_dump($gen->current()); diff --git a/Zend/tests/generators/bug74157.phpt b/Zend/tests/generators/bug74157.phpt index e5b9111f78..7033d82282 100644 --- a/Zend/tests/generators/bug74157.phpt +++ b/Zend/tests/generators/bug74157.phpt @@ -4,15 +4,15 @@ Bug #74157 (Segfault with nested generators) <?php function a() { - $a = $b = $c = 2; - foreach(range(1, 5) as $v) { - yield $v; - } - return; + $a = $b = $c = 2; + foreach(range(1, 5) as $v) { + yield $v; + } + return; } foreach (a(range(1, 3)) as $a) { - var_dump($a); + var_dump($a); } ?> --EXPECT-- diff --git a/Zend/tests/generators/bug74606.phpt b/Zend/tests/generators/bug74606.phpt index cfb7f7f8cd..ec5ef26ee1 100644 --- a/Zend/tests/generators/bug74606.phpt +++ b/Zend/tests/generators/bug74606.phpt @@ -4,21 +4,21 @@ Bug #74606 (Segfault within try/catch/finally nesting in Generators) <?php function gen() { - $array = ["foo"]; - $array[] = "bar"; + $array = ["foo"]; + $array[] = "bar"; - foreach ($array as $item) { - try { - try { - yield; - } finally { - echo "fin $item\n"; - } - } catch (\Exception $e) { - echo "catch\n"; - continue; - } - } + foreach ($array as $item) { + try { + try { + yield; + } finally { + echo "fin $item\n"; + } + } catch (\Exception $e) { + echo "catch\n"; + continue; + } + } } gen()->throw(new Exception); diff --git a/Zend/tests/generators/bug76427.phpt b/Zend/tests/generators/bug76427.phpt index 53851b0f35..dbf466c2de 100644 --- a/Zend/tests/generators/bug76427.phpt +++ b/Zend/tests/generators/bug76427.phpt @@ -3,7 +3,7 @@ Bug #76427 (Segfault in zend_objects_store_put) --FILE-- <?php $func = function () { - yield 2; + yield 2; }; $a = new stdclass(); diff --git a/Zend/tests/generators/errors/resume_running_generator_error.phpt b/Zend/tests/generators/errors/resume_running_generator_error.phpt index 07dad42b01..53e8611cf3 100644 --- a/Zend/tests/generators/errors/resume_running_generator_error.phpt +++ b/Zend/tests/generators/errors/resume_running_generator_error.phpt @@ -6,11 +6,11 @@ It is not possible to resume an already running generator function gen() { $gen = yield; try { - $gen->next(); - } catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; - } - $gen->next(); + $gen->next(); + } catch (Error $e) { + echo "\nException: " . $e->getMessage() . "\n"; + } + $gen->next(); } $gen = gen(); diff --git a/Zend/tests/generators/gc_with_yield_from.phpt b/Zend/tests/generators/gc_with_yield_from.phpt index 952352c853..68ec7ebe92 100644 --- a/Zend/tests/generators/gc_with_yield_from.phpt +++ b/Zend/tests/generators/gc_with_yield_from.phpt @@ -6,17 +6,17 @@ zend.enable_gc = 1 <?php function root() { - global $gens; // create cyclic reference to root - try { - yield 1; - } finally { - var_dump($gens); - } + global $gens; // create cyclic reference to root + try { + yield 1; + } finally { + var_dump($gens); + } } function gen($x) { - global $gens; - yield from $gens[] = $x ? gen(--$x) : root(); + global $gens; + yield from $gens[] = $x ? gen(--$x) : root(); } $gen = $gens[] = gen(2); diff --git a/Zend/tests/generators/generator_return_return_type.phpt b/Zend/tests/generators/generator_return_return_type.phpt index 345e0065c2..2df8c7e110 100644 --- a/Zend/tests/generators/generator_return_return_type.phpt +++ b/Zend/tests/generators/generator_return_return_type.phpt @@ -4,9 +4,9 @@ Generators must return a valid variable with return type specified <?php $gen = (function (): Generator { - 1 + $a = 1; // force a temporary - return true; - yield; + 1 + $a = 1; // force a temporary + return true; + yield; })(); var_dump($gen->valid()); diff --git a/Zend/tests/generators/generator_return_without_value.phpt b/Zend/tests/generators/generator_return_without_value.phpt index c507ebeb9c..3aed7feea0 100644 --- a/Zend/tests/generators/generator_return_without_value.phpt +++ b/Zend/tests/generators/generator_return_without_value.phpt @@ -14,12 +14,12 @@ function gen2() { } function gen3() { - return; + return; yield; } function gen4() { - return; + return; yield; } diff --git a/Zend/tests/generators/generator_returns_generator.phpt b/Zend/tests/generators/generator_returns_generator.phpt index ad332a3be9..cdf9e06e69 100644 --- a/Zend/tests/generators/generator_returns_generator.phpt +++ b/Zend/tests/generators/generator_returns_generator.phpt @@ -6,7 +6,7 @@ A generator function returns a Generator object function gen() { // execution is suspended here, so the following never gets run: echo "Foo"; - // trigger a generator + // trigger a generator yield; } diff --git a/Zend/tests/generators/generator_symtable_leak.phpt b/Zend/tests/generators/generator_symtable_leak.phpt index 7c736222d0..778b72479a 100644 --- a/Zend/tests/generators/generator_symtable_leak.phpt +++ b/Zend/tests/generators/generator_symtable_leak.phpt @@ -4,10 +4,10 @@ Generators using symtables must not leak <?php function gen() { - $bar = ["some complex var"]; - ${"f"."oo"} = "force symtable usage"; - var_dump($bar); - yield; + $bar = ["some complex var"]; + ${"f"."oo"} = "force symtable usage"; + var_dump($bar); + yield; } gen()->valid(); diff --git a/Zend/tests/generators/generator_with_type_check_2.phpt b/Zend/tests/generators/generator_with_type_check_2.phpt index ba1216224c..d4ebbd2ad3 100644 --- a/Zend/tests/generators/generator_with_type_check_2.phpt +++ b/Zend/tests/generators/generator_with_type_check_2.phpt @@ -4,15 +4,15 @@ Generator wit type check <?php function gen(array $a) { yield; } try { - gen(42); + gen(42); } catch (TypeError $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } try { - foreach (gen(42) as $val) { - var_dump($val); - } + foreach (gen(42) as $val) { + var_dump($val); + } } catch (TypeError $e) { echo $e->getMessage()."\n"; } diff --git a/Zend/tests/generators/multiple_yield_from_on_same_generator.phpt b/Zend/tests/generators/multiple_yield_from_on_same_generator.phpt index 52dbea89b2..b0de7d32d1 100644 --- a/Zend/tests/generators/multiple_yield_from_on_same_generator.phpt +++ b/Zend/tests/generators/multiple_yield_from_on_same_generator.phpt @@ -4,16 +4,16 @@ Multiple yield from on a same Generator instance <?php function gen($a = 0) { - yield 1 + $a; - if ($a < 1) { - var_dump(yield from gen($a + 1)); - } - yield 3 + $a; - return 5 + $a; + yield 1 + $a; + if ($a < 1) { + var_dump(yield from gen($a + 1)); + } + yield 3 + $a; + return 5 + $a; } function bar($gen) { - var_dump(yield from $gen); + var_dump(yield from $gen); } /* Twice a Generator from bar() using yield from on $gen */ @@ -22,10 +22,10 @@ $gens[] = bar($gen); $gens[] = bar($gen); do { - foreach ($gens as $g) { - var_dump($g->current()); - $g->next(); - } + foreach ($gens as $g) { + var_dump($g->current()); + $g->next(); + } } while($gens[0]->valid()); var_dump($gens[1]->valid()); diff --git a/Zend/tests/generators/mutli_yield_from_with_exception.phpt b/Zend/tests/generators/mutli_yield_from_with_exception.phpt index 4be2449a46..30b188515d 100644 --- a/Zend/tests/generators/mutli_yield_from_with_exception.phpt +++ b/Zend/tests/generators/mutli_yield_from_with_exception.phpt @@ -3,14 +3,14 @@ Multiple yield from on a same Generator throwing an Exception --FILE-- <?php function from() { - yield 1; - throw new Exception(); + yield 1; + throw new Exception(); } function gen($gen) { - try { - var_dump(yield from $gen); - } catch (Exception $e) { print "Caught exception!\n$e\n"; } + try { + var_dump(yield from $gen); + } catch (Exception $e) { print "Caught exception!\n$e\n"; } } $gen = from(); @@ -18,15 +18,15 @@ $gens[] = gen($gen); $gens[] = gen($gen); foreach ($gens as $g) { - $g->current(); // init. + $g->current(); // init. } do { - foreach ($gens as $i => $g) { - print "Generator $i\n"; - var_dump($g->current()); - $g->next(); - } + foreach ($gens as $i => $g) { + print "Generator $i\n"; + var_dump($g->current()); + $g->next(); + } } while($gens[0]->valid()); ?> --EXPECTF-- diff --git a/Zend/tests/generators/no_foreach_var_leaks.phpt b/Zend/tests/generators/no_foreach_var_leaks.phpt index 62743895eb..c9d56b9fb7 100644 --- a/Zend/tests/generators/no_foreach_var_leaks.phpt +++ b/Zend/tests/generators/no_foreach_var_leaks.phpt @@ -4,9 +4,9 @@ foreach() (and other) variables aren't leaked on premature close <?php function gen(array $array) { - foreach ($array as $value) { - yield $value; - } + foreach ($array as $value) { + yield $value; + } } $gen = gen(['Foo', 'Bar']); diff --git a/Zend/tests/generators/recursive_yield_from.phpt b/Zend/tests/generators/recursive_yield_from.phpt index 2fc1e0a591..535c92cea7 100644 --- a/Zend/tests/generators/recursive_yield_from.phpt +++ b/Zend/tests/generators/recursive_yield_from.phpt @@ -4,20 +4,20 @@ Check if recursion with yield from works <?php function from($a = 0) { - yield 1 + $a; - if ($a <= 3) { - yield from from($a + 3); - yield from from($a + 6); - } - yield 2 + $a; + yield 1 + $a; + if ($a <= 3) { + yield from from($a + 3); + yield from from($a + 6); + } + yield 2 + $a; } function gen() { - yield from from(); + yield from from(); } foreach(gen() as $v) { - var_dump($v); + var_dump($v); } ?> --EXPECT-- diff --git a/Zend/tests/generators/throw_into_yield_from_array.phpt b/Zend/tests/generators/throw_into_yield_from_array.phpt index b1571f6639..aa9fa82206 100644 --- a/Zend/tests/generators/throw_into_yield_from_array.phpt +++ b/Zend/tests/generators/throw_into_yield_from_array.phpt @@ -6,23 +6,23 @@ Throwing into a generator yielding from an array/iterator $data = [1, 2, 3]; function yielditer($arr) { - foreach($arr as $val) { - yield $val; - } + foreach($arr as $val) { + yield $val; + } } function yf($in) { - yield from $in; + yield from $in; } function test($g) { - var_dump($g->current()); - try { - $g->throw(new Exception("Exception!")); - } catch (Exception $e) { - echo "{$e->getMessage()}\n"; - } - var_dump($g->current()); + var_dump($g->current()); + try { + $g->throw(new Exception("Exception!")); + } catch (Exception $e) { + echo "{$e->getMessage()}\n"; + } + var_dump($g->current()); } $yfiter = yf($data); diff --git a/Zend/tests/generators/xrange.phpt b/Zend/tests/generators/xrange.phpt index 4d8b60fa90..3b8283e150 100644 --- a/Zend/tests/generators/xrange.phpt +++ b/Zend/tests/generators/xrange.phpt @@ -4,13 +4,13 @@ Simple generator xrange() test <?php function xrange($start, $end, $step = 1) { - for ($i = $start; $i <= $end; $i += $step) { - yield $i; - } + for ($i = $start; $i <= $end; $i += $step) { + yield $i; + } } foreach (xrange(10, 20, 2) as $i) { - var_dump($i); + var_dump($i); } ?> diff --git a/Zend/tests/generators/yield_during_function_call.phpt b/Zend/tests/generators/yield_during_function_call.phpt index 21071f9fb4..9960e6d92b 100644 --- a/Zend/tests/generators/yield_during_function_call.phpt +++ b/Zend/tests/generators/yield_during_function_call.phpt @@ -4,7 +4,7 @@ <?php function gen() { - var_dump(str_repeat("x", yield)); + var_dump(str_repeat("x", yield)); } $gen = gen(); diff --git a/Zend/tests/generators/yield_from_already_running.phpt b/Zend/tests/generators/yield_from_already_running.phpt index 5f2654dd6b..43b9542c72 100644 --- a/Zend/tests/generators/yield_from_already_running.phpt +++ b/Zend/tests/generators/yield_from_already_running.phpt @@ -4,7 +4,7 @@ Yielding from the already running Generator should fail (bug #69458) <?php function gen() { - yield from yield; + yield from yield; } ($gen = gen())->send($gen); diff --git a/Zend/tests/generators/yield_from_array.phpt b/Zend/tests/generators/yield_from_array.phpt index 1652ab2236..b1560170b1 100644 --- a/Zend/tests/generators/yield_from_array.phpt +++ b/Zend/tests/generators/yield_from_array.phpt @@ -3,17 +3,17 @@ yielding values from an array --FILE-- <?php function from() { - yield 0; - yield from []; // must not yield anything - yield from [1,2]; + yield 0; + yield from []; // must not yield anything + yield from [1,2]; } function gen() { - yield from from(); + yield from from(); } foreach(gen() as $v) { - var_dump($v); + var_dump($v); } ?> --EXPECT-- diff --git a/Zend/tests/generators/yield_from_backtrace.phpt b/Zend/tests/generators/yield_from_backtrace.phpt index e5d79723e7..8fb1aeef8c 100644 --- a/Zend/tests/generators/yield_from_backtrace.phpt +++ b/Zend/tests/generators/yield_from_backtrace.phpt @@ -3,26 +3,26 @@ Exceptions in linear yield from setup --FILE-- <?php function from($off) { - debug_print_backtrace(); - yield $off + 1; + debug_print_backtrace(); + yield $off + 1; } function gen() { - yield 1; - debug_print_backtrace(); - yield 2; - yield from from(2); - debug_print_backtrace(); + yield 1; + debug_print_backtrace(); + yield 2; + yield from from(2); + debug_print_backtrace(); } print "\nImplicit foreach:\n"; foreach (gen() as $v) { - var_dump($v); + var_dump($v); } print "\nExplicit iterator:\n"; for ($gen = gen(); $gen->valid(); $gen->next()) { - var_dump($gen->current()); + var_dump($gen->current()); } ?> --EXPECTF-- diff --git a/Zend/tests/generators/yield_from_deep_recursion.phpt b/Zend/tests/generators/yield_from_deep_recursion.phpt index 8ef3b89129..f6d6c3e79f 100644 --- a/Zend/tests/generators/yield_from_deep_recursion.phpt +++ b/Zend/tests/generators/yield_from_deep_recursion.phpt @@ -5,20 +5,20 @@ Deep recursion with yield from ini_set("memory_limit", "512M"); function from($i) { - yield $i; + yield $i; } function gen($i = 0) { - if ($i < 50000) { - yield from gen(++$i); - } else { - yield $i; - yield from from(++$i); - } + if ($i < 50000) { + yield from gen(++$i); + } else { + yield $i; + yield from from(++$i); + } } foreach (gen() as $v) { - var_dump($v); + var_dump($v); } ?> --EXPECT-- diff --git a/Zend/tests/generators/yield_from_iterator.phpt b/Zend/tests/generators/yield_from_iterator.phpt index 959d6a2d33..162a4dd9e3 100644 --- a/Zend/tests/generators/yield_from_iterator.phpt +++ b/Zend/tests/generators/yield_from_iterator.phpt @@ -3,14 +3,14 @@ yield from with an (Array)Iterator --FILE-- <?php function g() { - yield 1; - yield from new ArrayIterator([2, 3, 4]); - yield 5; + yield 1; + yield from new ArrayIterator([2, 3, 4]); + yield 5; } $g = g(); foreach ($g as $yielded) { - var_dump($yielded); + var_dump($yielded); } ?> --EXPECT-- diff --git a/Zend/tests/generators/yield_from_multi_tree.phpt b/Zend/tests/generators/yield_from_multi_tree.phpt index 9bec138149..a8fd195bd6 100644 --- a/Zend/tests/generators/yield_from_multi_tree.phpt +++ b/Zend/tests/generators/yield_from_multi_tree.phpt @@ -4,41 +4,41 @@ yield from on multiple trees needing merge <?php function from($levels) { - foreach (range(0, 2 << $levels) as $v) { - yield $v; - } + foreach (range(0, 2 << $levels) as $v) { + yield $v; + } } function gen($gen, $level) { - if ($level % 2) { - yield $gen->current(); - } - yield from $gen; + if ($level % 2) { + yield $gen->current(); + } + yield from $gen; } foreach (range(0, 6) as $levels) { - print "$levels level".($levels == 1 ? "" : "s")."\n\n"; + print "$levels level".($levels == 1 ? "" : "s")."\n\n"; - $all = array(); - $all[] = $gens[0][0] = from($levels); + $all = array(); + $all[] = $gens[0][0] = from($levels); - for ($level = 1; $level < $levels; $level++) { - for ($i = 0; $i < (1 << $level); $i++) { - $all[] = $gens[$level][$i] = gen($gens[$level-1][$i >> 1], $level); - } - } + for ($level = 1; $level < $levels; $level++) { + for ($i = 0; $i < (1 << $level); $i++) { + $all[] = $gens[$level][$i] = gen($gens[$level-1][$i >> 1], $level); + } + } - while (1) { - foreach ($all as $gen) { - var_dump($gen->current()); - $gen->next(); - if (!$gen->valid()) { - break 2; - } - } - } + while (1) { + foreach ($all as $gen) { + var_dump($gen->current()); + $gen->next(); + if (!$gen->valid()) { + break 2; + } + } + } - print "\n\n"; + print "\n\n"; } ?> --EXPECT-- diff --git a/Zend/tests/generators/yield_from_multi_tree_exception.phpt b/Zend/tests/generators/yield_from_multi_tree_exception.phpt index 4ff2e4e41f..cb8aedfd32 100644 --- a/Zend/tests/generators/yield_from_multi_tree_exception.phpt +++ b/Zend/tests/generators/yield_from_multi_tree_exception.phpt @@ -4,16 +4,16 @@ yield from on multiple trees needing merge <?php function from($levels) { - foreach (range(0, 2 << $levels) as $v) { - yield $v; - if ($v == (1 << ($levels - 1)) - 2) { - throw new Exception(); - } - } + foreach (range(0, 2 << $levels) as $v) { + yield $v; + if ($v == (1 << ($levels - 1)) - 2) { + throw new Exception(); + } + } } function gen($gen, $level) { - yield from $gen; + yield from $gen; } $levels = 5; @@ -24,24 +24,24 @@ $all = array(); $all[] = $gens[0][0] = from($levels); for ($level = 1; $level < $levels; $level++) { - for ($i = 0; $i < (1 << $level); $i++) { - $all[] = $gens[$level][$i] = gen($gens[$level-1][$i >> 1], $level); - } + for ($i = 0; $i < (1 << $level); $i++) { + $all[] = $gens[$level][$i] = gen($gens[$level-1][$i >> 1], $level); + } } for ($i = 0; $i < 2; $i++) { - try { - foreach ($all as $gen) { - var_dump($gen->current()); - $gen->next(); - if (!$gen->valid()) { - break; - } - } - } catch(Exception $e) { - print "$e\n"; - unset($all[array_search($gen, $all)]); - } + try { + foreach ($all as $gen) { + var_dump($gen->current()); + $gen->next(); + if (!$gen->valid()) { + break; + } + } + } catch(Exception $e) { + print "$e\n"; + unset($all[array_search($gen, $all)]); + } } ?> --EXPECTF-- diff --git a/Zend/tests/generators/yield_unary_precedence.phpt b/Zend/tests/generators/yield_unary_precedence.phpt index 54eb0feb5f..3ebeed2d8c 100644 --- a/Zend/tests/generators/yield_unary_precedence.phpt +++ b/Zend/tests/generators/yield_unary_precedence.phpt @@ -3,14 +3,14 @@ When + or - are used on yield, they must be unary (and not binary) (Bug #69160) --FILE-- <?php function gen() { - var_dump(yield +1); - var_dump(yield -1); - var_dump(yield * -1); // other ops still should behave normally + var_dump(yield +1); + var_dump(yield -1); + var_dump(yield * -1); // other ops still should behave normally } for ($gen = gen(); $gen->valid(); $gen->send(1)) { - echo "\n"; - var_dump($gen->current()); + echo "\n"; + var_dump($gen->current()); } ?> --EXPECT-- diff --git a/Zend/tests/get_class_methods_001.phpt b/Zend/tests/get_class_methods_001.phpt index d0d51220aa..3ec51f1bcd 100644 --- a/Zend/tests/get_class_methods_001.phpt +++ b/Zend/tests/get_class_methods_001.phpt @@ -4,18 +4,18 @@ get_class_methods(): Testing scope <?php abstract class X { - public function a() { } - private function b() { } - protected function c() { } + public function a() { } + private function b() { } + protected function c() { } } class Y extends X { - private function bb() { } + private function bb() { } - static public function test() { - var_dump(get_class_methods('X')); - var_dump(get_class_methods('Y')); - } + static public function test() { + var_dump(get_class_methods('X')); + var_dump(get_class_methods('Y')); + } } diff --git a/Zend/tests/get_class_methods_002.phpt b/Zend/tests/get_class_methods_002.phpt index c049c1ced3..27bcd7be38 100644 --- a/Zend/tests/get_class_methods_002.phpt +++ b/Zend/tests/get_class_methods_002.phpt @@ -4,20 +4,20 @@ get_class_methods(): Testing with interface <?php interface A { - function a(); - function b(); + function a(); + function b(); } class B implements A { - public function a() { } - public function b() { } + public function a() { } + public function b() { } - public function __construct() { - var_dump(get_class_methods('A')); - var_dump(get_class_methods('B')); - } + public function __construct() { + var_dump(get_class_methods('A')); + var_dump(get_class_methods('B')); + } - public function __destruct() { } + public function __destruct() { } } new B; diff --git a/Zend/tests/get_class_methods_003.phpt b/Zend/tests/get_class_methods_003.phpt index 982b7cbc0f..966d6cee65 100644 --- a/Zend/tests/get_class_methods_003.phpt +++ b/Zend/tests/get_class_methods_003.phpt @@ -4,34 +4,34 @@ get_class_methods(): Testing scope <?php interface I { - function aa(); - function bb(); - static function cc(); + function aa(); + function bb(); + static function cc(); } class X { - public function a() { } - protected function b() { } - private function c() { } + public function a() { } + protected function b() { } + private function c() { } - static public function static_a() { } - static protected function static_b() { } - static private function static_c() { } + static public function static_a() { } + static protected function static_b() { } + static private function static_c() { } } class Y extends X implements I { - public function aa() { } - public function bb() { } + public function aa() { } + public function bb() { } - static function cc() { } + static function cc() { } - public function __construct() { - var_dump(get_class_methods('I')); - var_dump(get_class_methods('Y')); - var_dump(get_class_methods('X')); - } + public function __construct() { + var_dump(get_class_methods('I')); + var_dump(get_class_methods('Y')); + var_dump(get_class_methods('X')); + } - public function __destruct() { } + public function __destruct() { } } new Y; diff --git a/Zend/tests/get_class_vars_001.phpt b/Zend/tests/get_class_vars_001.phpt index ada0be6dad..a5939ccd5f 100644 --- a/Zend/tests/get_class_vars_001.phpt +++ b/Zend/tests/get_class_vars_001.phpt @@ -4,15 +4,15 @@ get_class_vars(): Simple test <?php class A { - public $a = 1; - private $b = 2; - private $c = 3; + public $a = 1; + private $b = 2; + private $c = 3; } class B extends A { - static public $aa = 4; - static private $bb = 5; - static protected $cc = 6; + static public $aa = 4; + static private $bb = 5; + static protected $cc = 6; } diff --git a/Zend/tests/get_class_vars_002.phpt b/Zend/tests/get_class_vars_002.phpt index 475545ffe7..5aa0c4092d 100644 --- a/Zend/tests/get_class_vars_002.phpt +++ b/Zend/tests/get_class_vars_002.phpt @@ -4,24 +4,24 @@ get_class_vars(): Testing the scope <?php class A { - public $a = 1; - private $b = 2; - private $c = 3; + public $a = 1; + private $b = 2; + private $c = 3; } class B extends A { - static public $aa = 4; - static private $bb = 5; - static protected $cc = 6; + static public $aa = 4; + static private $bb = 5; + static protected $cc = 6; } class C extends B { - public function __construct() { - var_dump(get_class_vars('A')); - var_dump(get_class_vars('B')); + public function __construct() { + var_dump(get_class_vars('A')); + var_dump(get_class_vars('B')); - var_dump($this->a, $this->b, $this->c); - } + var_dump($this->a, $this->b, $this->c); + } } new C; diff --git a/Zend/tests/get_class_vars_003.phpt b/Zend/tests/get_class_vars_003.phpt index 5fe9f9971b..5659a49704 100644 --- a/Zend/tests/get_class_vars_003.phpt +++ b/Zend/tests/get_class_vars_003.phpt @@ -4,29 +4,29 @@ get_class_vars(): Testing the scope <?php class A { - public $a = 1; - private $b = 2; - private $c = 3; + public $a = 1; + private $b = 2; + private $c = 3; } class B extends A { - static public $aa = 4; - static private $bb = 5; - static protected $cc = 6; + static public $aa = 4; + static private $bb = 5; + static protected $cc = 6; - protected function __construct() { - var_dump(get_class_vars('C')); - } + protected function __construct() { + var_dump(get_class_vars('C')); + } } class C extends B { - public $aaa = 7; - private $bbb = 8; - protected $ccc = 9; + public $aaa = 7; + private $bbb = 8; + protected $ccc = 9; - public function __construct() { - parent::__construct(); - } + public function __construct() { + parent::__construct(); + } } new C; diff --git a/Zend/tests/get_class_vars_004.phpt b/Zend/tests/get_class_vars_004.phpt index 9b21d165e1..d563ce65c1 100644 --- a/Zend/tests/get_class_vars_004.phpt +++ b/Zend/tests/get_class_vars_004.phpt @@ -4,22 +4,22 @@ get_class_vars(): Testing the scope <?php class A { - public $a = 1; - static public $A = 2; + public $a = 1; + static public $A = 2; - private $b = 3; - static private $B = 4; + private $b = 3; + static private $B = 4; - protected $c = 5; - static protected $C = 6; + protected $c = 5; + static protected $C = 6; - public function __construct() { - var_dump(get_class_vars('A')); - } + public function __construct() { + var_dump(get_class_vars('A')); + } - static public function test() { - var_dump(get_class_vars('A')); - } + static public function test() { + var_dump(get_class_vars('A')); + } } var_dump(get_class_vars('A')); diff --git a/Zend/tests/get_class_vars_005.phpt b/Zend/tests/get_class_vars_005.phpt index 47d28ca336..f2d98e76d4 100644 --- a/Zend/tests/get_class_vars_005.phpt +++ b/Zend/tests/get_class_vars_005.phpt @@ -4,16 +4,16 @@ get_class_vars(): Testing visibility <?php class A { - protected $a = 1; - private $b = 2; + protected $a = 1; + private $b = 2; } class B extends A { - private $c = 3; - public function __construct() { - var_dump(get_class_vars('A')); - var_dump(get_class_vars('B')); - } + private $c = 3; + public function __construct() { + var_dump(get_class_vars('A')); + var_dump(get_class_vars('B')); + } } var_dump(get_class_vars('A')); diff --git a/Zend/tests/get_class_vars_006.phpt b/Zend/tests/get_class_vars_006.phpt index 34da051fd5..3b037fe27f 100644 --- a/Zend/tests/get_class_vars_006.phpt +++ b/Zend/tests/get_class_vars_006.phpt @@ -4,7 +4,7 @@ get_class_vars(): Testing visibility <?php class A { - protected $a = 1; + protected $a = 1; } class B extends A { } @@ -18,11 +18,11 @@ var_dump(get_class_vars('C')); print "---\n"; class D extends B { - public function __construct() { - var_dump(get_class_vars('A')); - var_dump(get_class_vars('B')); - var_dump(get_class_vars('C')); - } + public function __construct() { + var_dump(get_class_vars('A')); + var_dump(get_class_vars('B')); + var_dump(get_class_vars('C')); + } } new D; diff --git a/Zend/tests/get_class_vars_007.phpt b/Zend/tests/get_class_vars_007.phpt index 6aea0e2483..c73ddec492 100644 --- a/Zend/tests/get_class_vars_007.phpt +++ b/Zend/tests/get_class_vars_007.phpt @@ -4,13 +4,13 @@ get_class_vars(): Testing with static properties <?php class A { - static public $a, $aa; - static private $b, $bb; - static protected $c, $cc; + static public $a, $aa; + static private $b, $bb; + static protected $c, $cc; - static public function test() { - var_dump(get_class_vars(__CLASS__)); - } + static public function test() { + var_dump(get_class_vars(__CLASS__)); + } } var_dump(get_class_vars('A')); diff --git a/Zend/tests/get_defined_functions_basic.phpt b/Zend/tests/get_defined_functions_basic.phpt index 1ea5df7ec7..3ba411bff5 100644 --- a/Zend/tests/get_defined_functions_basic.phpt +++ b/Zend/tests/get_defined_functions_basic.phpt @@ -16,39 +16,39 @@ function foo() {} function HelloWorld() {} Class C { - function f1() {} - static function f2() {} + function f1() {} + static function f2() {} } $func = get_defined_functions(); if (!is_array($func)) { - echo "TEST FAILED: return type not an array\n"; + echo "TEST FAILED: return type not an array\n"; } if (!is_array($func["internal"])) { - echo "TEST FAILED: no element in result array with key 'internal'\n"; + echo "TEST FAILED: no element in result array with key 'internal'\n"; } $internal = $func["internal"]; //check for a few core functions if (!in_array("cos", $internal) || !in_array("strlen", $internal)) { - echo "TEST FAILED: missing elements from 'internal' array\n"; - var_dump($internal); + echo "TEST FAILED: missing elements from 'internal' array\n"; + var_dump($internal); } if (!is_array($func["user"])) { - echo "TEST FAILED: no element in result array with key 'user'\n"; + echo "TEST FAILED: no element in result array with key 'user'\n"; } $user = $func["user"]; if (count($user) == 2 && in_array("foo", $user) && in_array("helloworld", $user)) { - echo "TEST PASSED\n"; + echo "TEST PASSED\n"; } else { - echo "TEST FAILED: missing elements from 'user' array\n"; - var_dump($user); + echo "TEST FAILED: missing elements from 'user' array\n"; + var_dump($user); } ?> diff --git a/Zend/tests/get_parent_class_001.phpt b/Zend/tests/get_parent_class_001.phpt index 95395f935b..fefcbeb683 100644 --- a/Zend/tests/get_parent_class_001.phpt +++ b/Zend/tests/get_parent_class_001.phpt @@ -4,19 +4,19 @@ Testing get_parent_class() <?php interface ITest { - function foo(); + function foo(); } abstract class bar implements ITest { - public function foo() { - var_dump(get_parent_class()); - } + public function foo() { + var_dump(get_parent_class()); + } } class foo extends bar { - public function __construct() { - var_dump(get_parent_class()); - } + public function __construct() { + var_dump(get_parent_class()); + } } $a = new foo; diff --git a/Zend/tests/globals_002.phpt b/Zend/tests/globals_002.phpt index f2f53a13f5..b8f2dadd4d 100644 --- a/Zend/tests/globals_002.phpt +++ b/Zend/tests/globals_002.phpt @@ -5,17 +5,17 @@ variables_order="egpcs" --FILE-- <?php function test() { - var_dump(isset($_SERVER)); - var_dump(empty($_SERVER)); - var_dump(gettype($_SERVER)); - var_dump(count($_SERVER)); + var_dump(isset($_SERVER)); + var_dump(empty($_SERVER)); + var_dump(gettype($_SERVER)); + var_dump(count($_SERVER)); - var_dump($_SERVER['PHP_SELF']); - unset($_SERVER['PHP_SELF']); - var_dump($_SERVER['PHP_SELF']); + var_dump($_SERVER['PHP_SELF']); + unset($_SERVER['PHP_SELF']); + var_dump($_SERVER['PHP_SELF']); - unset($_SERVER); - var_dump($_SERVER); + unset($_SERVER); + var_dump($_SERVER); } test(); diff --git a/Zend/tests/globals_003.phpt b/Zend/tests/globals_003.phpt index 24e8edd8aa..d7a175389e 100644 --- a/Zend/tests/globals_003.phpt +++ b/Zend/tests/globals_003.phpt @@ -7,21 +7,21 @@ variables_order="egpcs" class test { - static function bar() { + static function bar() { - var_dump(isset($_SERVER)); - var_dump(empty($_SERVER)); - var_dump(gettype($_SERVER)); - var_dump(count($_SERVER)); + var_dump(isset($_SERVER)); + var_dump(empty($_SERVER)); + var_dump(gettype($_SERVER)); + var_dump(count($_SERVER)); - var_dump($_SERVER['PHP_SELF']); - unset($_SERVER['PHP_SELF']); - var_dump($_SERVER['PHP_SELF']); + var_dump($_SERVER['PHP_SELF']); + unset($_SERVER['PHP_SELF']); + var_dump($_SERVER['PHP_SELF']); - unset($_SERVER); - var_dump($_SERVER); + unset($_SERVER); + var_dump($_SERVER); - } + } } test::bar(); diff --git a/Zend/tests/globals_004.phpt b/Zend/tests/globals_004.phpt index 9ba3866835..4aaf2438d7 100644 --- a/Zend/tests/globals_004.phpt +++ b/Zend/tests/globals_004.phpt @@ -6,7 +6,7 @@ variables_order="egpcs" <?php function test() { - include __DIR__."/globals.inc"; + include __DIR__."/globals.inc"; } test(); diff --git a/Zend/tests/grammar/regression_001.phpt b/Zend/tests/grammar/regression_001.phpt index 657b36b853..d559c555e8 100644 --- a/Zend/tests/grammar/regression_001.phpt +++ b/Zend/tests/grammar/regression_001.phpt @@ -4,7 +4,7 @@ Test to check static method calls syntax regression <?php class Foo { - public static function function(){ echo __METHOD__, PHP_EOL; } + public static function function(){ echo __METHOD__, PHP_EOL; } } Foo::function(); @@ -13,11 +13,11 @@ Foo:: function(); Foo:: - function(); + function(); Foo:: - function( + function( ); diff --git a/Zend/tests/halt03.phpt b/Zend/tests/halt03.phpt index 6e0931b02f..deacebe4ab 100644 --- a/Zend/tests/halt03.phpt +++ b/Zend/tests/halt03.phpt @@ -4,7 +4,7 @@ __HALT_COMPILER() basic test <?php if (true) { - __HALT_COMPILER(); + __HALT_COMPILER(); } --EXPECTF-- Fatal error: __HALT_COMPILER() can only be used from the outermost scope in %shalt03.php on line %d diff --git a/Zend/tests/hex_overflow_32bit.phpt b/Zend/tests/hex_overflow_32bit.phpt index 529757dd56..4d4e95818c 100644 --- a/Zend/tests/hex_overflow_32bit.phpt +++ b/Zend/tests/hex_overflow_32bit.phpt @@ -8,15 +8,15 @@ precision=14 <?php $doubles = array( - 0x1736123FFFAAA, - 0XFFFFFFFFFFFFFFFFFF, - 0xAAAAAAAAAAAAAAEEEEEEEEEBBB, - 0x66666666666666666777777, - ); + 0x1736123FFFAAA, + 0XFFFFFFFFFFFFFFFFFF, + 0xAAAAAAAAAAAAAAEEEEEEEEEBBB, + 0x66666666666666666777777, + ); foreach ($doubles as $d) { - $l = $d; - var_dump($l); + $l = $d; + var_dump($l); } echo "Done\n"; diff --git a/Zend/tests/increment_001.phpt b/Zend/tests/increment_001.phpt index 16323381b8..92f32bb657 100644 --- a/Zend/tests/increment_001.phpt +++ b/Zend/tests/increment_001.phpt @@ -8,26 +8,26 @@ precision=14 <?php $a = array( - array(1,2,3), - "", - 1, - 2.5, - 0, - "string", - "123", - "2.5", - NULL, - true, - false, - new stdclass, - array(), - PHP_INT_MAX, - (string)PHP_INT_MAX + array(1,2,3), + "", + 1, + 2.5, + 0, + "string", + "123", + "2.5", + NULL, + true, + false, + new stdclass, + array(), + PHP_INT_MAX, + (string)PHP_INT_MAX ); foreach ($a as $var) { - $var++; - var_dump($var); + $var++; + var_dump($var); } echo "Done\n"; diff --git a/Zend/tests/indirect_call_array_003.phpt b/Zend/tests/indirect_call_array_003.phpt index b4b713ff64..603b3bfc29 100644 --- a/Zend/tests/indirect_call_array_003.phpt +++ b/Zend/tests/indirect_call_array_003.phpt @@ -4,23 +4,23 @@ Indirect method call by array - Calling __call() and __callStatic() <?php class foo { - public function __call($a, $b) { - printf("From %s:\n", __METHOD__); - var_dump($a); - var_dump($this); - } - static public function __callStatic($a, $b) { - printf("From %s:\n", __METHOD__); - var_dump($a); - var_dump($this); - } + public function __call($a, $b) { + printf("From %s:\n", __METHOD__); + var_dump($a); + var_dump($this); + } + static public function __callStatic($a, $b) { + printf("From %s:\n", __METHOD__); + var_dump($a); + var_dump($this); + } } $arr = array('foo', 'abc'); try { - $arr(); + $arr(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } $foo = new foo; $arr = array($foo, 'abc'); diff --git a/Zend/tests/indirect_call_array_004.phpt b/Zend/tests/indirect_call_array_004.phpt index 07d8a09215..e8520efd12 100644 --- a/Zend/tests/indirect_call_array_004.phpt +++ b/Zend/tests/indirect_call_array_004.phpt @@ -4,36 +4,36 @@ Indirect method call by array - Testing exception and method magics <?php class foo { - static public function abc() { - throw new Exception('foo'); - } - public function __call($a, $b) { - printf("From %s:\n", __METHOD__); - throw new Exception($a); - } - static public function __callStatic($a, $b) { - printf("From %s:\n", __METHOD__); - throw new Exception($a); - } + static public function abc() { + throw new Exception('foo'); + } + public function __call($a, $b) { + printf("From %s:\n", __METHOD__); + throw new Exception($a); + } + static public function __callStatic($a, $b) { + printf("From %s:\n", __METHOD__); + throw new Exception($a); + } } $arr = array('foo', 'abc'); try { - $arr(); + $arr(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } $arr = array('foo', '123'); try { - $arr(); + $arr(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } @@ -43,10 +43,10 @@ $foo = new foo; $arr = array($foo, 'abc'); try { - $arr(); + $arr(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } @@ -54,10 +54,10 @@ $foo = new foo; $arr = array($foo, '123'); try { - $arr(); + $arr(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/indirect_method_call_001.phpt b/Zend/tests/indirect_method_call_001.phpt index 7018eaa740..39967fdb26 100644 --- a/Zend/tests/indirect_method_call_001.phpt +++ b/Zend/tests/indirect_method_call_001.phpt @@ -4,15 +4,15 @@ Testing indirect method call and exceptions <?php class foo { - public function __construct() { - throw new Exception('foobar'); - } + public function __construct() { + throw new Exception('foobar'); + } } try { - $X = (new foo)->Inexistent(3); + $X = (new foo)->Inexistent(3); } catch (Exception $e) { - var_dump($e->getMessage()); // foobar + var_dump($e->getMessage()); // foobar } ?> diff --git a/Zend/tests/indirect_method_call_002.phpt b/Zend/tests/indirect_method_call_002.phpt index 059061f211..e8ea14b165 100644 --- a/Zend/tests/indirect_method_call_002.phpt +++ b/Zend/tests/indirect_method_call_002.phpt @@ -4,16 +4,16 @@ Indirect method call with chaining <?php class foo { - public $x = 'testing'; + public $x = 'testing'; - public function bar() { - return "foo"; - } - public function baz() { - return new self; - } - static function xyz() { - } + public function bar() { + return "foo"; + } + public function baz() { + return new self; + } + static function xyz() { + } } var_dump((new foo())->bar()); // string(3) "foo" diff --git a/Zend/tests/indirect_method_call_003.phpt b/Zend/tests/indirect_method_call_003.phpt index 3df495422d..2ae694d821 100644 --- a/Zend/tests/indirect_method_call_003.phpt +++ b/Zend/tests/indirect_method_call_003.phpt @@ -4,15 +4,15 @@ Testing indirect method call <?php class foo { - public $x = 1; + public $x = 1; - public function getX() { - return $this->x; - } - public function setX($val) { - $this->x = $val; - return $this; - } + public function getX() { + return $this->x; + } + public function setX($val) { + $this->x = $val; + return $this; + } } $X = (new foo)->setX(10)->getX(); diff --git a/Zend/tests/indirect_method_call_004.phpt b/Zend/tests/indirect_method_call_004.phpt index 689600d1f4..6a4055595c 100644 --- a/Zend/tests/indirect_method_call_004.phpt +++ b/Zend/tests/indirect_method_call_004.phpt @@ -5,14 +5,14 @@ Indirect method call and cloning class bar { - public $z; + public $z; - public function __construct() { - $this->z = new stdclass; - } - public function getZ() { - return $this->z; - } + public function __construct() { + $this->z = new stdclass; + } + public function getZ() { + return $this->z; + } } var_dump(clone (new bar)->z); diff --git a/Zend/tests/indirect_method_call_005.phpt b/Zend/tests/indirect_method_call_005.phpt index 4f4b3631c0..d3e2de2c84 100644 --- a/Zend/tests/indirect_method_call_005.phpt +++ b/Zend/tests/indirect_method_call_005.phpt @@ -4,9 +4,9 @@ Testing array dereferencing from instance with ArrayObject <?php class foo extends ArrayObject { - public function __construct($arr) { - parent::__construct($arr); - } + public function __construct($arr) { + parent::__construct($arr); + } } var_dump( (new foo( array(1, array(4, 5), 3) ))[1][0] ); // int(4) diff --git a/Zend/tests/indirect_property_access.phpt b/Zend/tests/indirect_property_access.phpt index 3645687f41..eff8521e12 100644 --- a/Zend/tests/indirect_property_access.phpt +++ b/Zend/tests/indirect_property_access.phpt @@ -4,11 +4,11 @@ Testing indirect property access <?php class foo { - public $x = 1; + public $x = 1; } class bar { - public $y = 'foo'; + public $y = 'foo'; } $x = 'bar'; diff --git a/Zend/tests/instanceof.phpt b/Zend/tests/instanceof.phpt index 662185dcea..cfa1176c50 100644 --- a/Zend/tests/instanceof.phpt +++ b/Zend/tests/instanceof.phpt @@ -3,8 +3,8 @@ instanceof shouldn't call autoloader --FILE-- <?php spl_autoload_register(function ($name) { - echo("AUTOLOAD '$name'\n"); - eval("class $name {}"); + echo("AUTOLOAD '$name'\n"); + eval("class $name {}"); }); class A { diff --git a/Zend/tests/int_overflow_32bit.phpt b/Zend/tests/int_overflow_32bit.phpt index cfbf059630..15dce6eea7 100644 --- a/Zend/tests/int_overflow_32bit.phpt +++ b/Zend/tests/int_overflow_32bit.phpt @@ -6,16 +6,16 @@ testing integer overflow (32bit) <?php $doubles = array( - 2147483648, - 2147483649, - 2147483658, - 2147483748, - 2147484648, - ); + 2147483648, + 2147483649, + 2147483658, + 2147483748, + 2147484648, + ); foreach ($doubles as $d) { - $l = (int)$d; - var_dump($l); + $l = (int)$d; + var_dump($l); } echo "Done\n"; diff --git a/Zend/tests/int_underflow_32bit.phpt b/Zend/tests/int_underflow_32bit.phpt index 79a949aac5..71464a758a 100644 --- a/Zend/tests/int_underflow_32bit.phpt +++ b/Zend/tests/int_underflow_32bit.phpt @@ -6,16 +6,16 @@ testing integer underflow (32bit) <?php $doubles = array( - -2147483648, - -2147483649, - -2147483658, - -2147483748, - -2147484648, - ); + -2147483648, + -2147483649, + -2147483658, + -2147483748, + -2147484648, + ); foreach ($doubles as $d) { - $l = (int)$d; - var_dump($l); + $l = (int)$d; + var_dump($l); } echo "Done\n"; diff --git a/Zend/tests/inter_007.phpt b/Zend/tests/inter_007.phpt index fa7c368a5e..beda6c00d0 100644 --- a/Zend/tests/inter_007.phpt +++ b/Zend/tests/inter_007.phpt @@ -4,11 +4,11 @@ Trying inherit abstract function twice <?php interface d { - static function B(); + static function B(); } interface c { - function b(); + function b(); } class_alias('c', 'w'); diff --git a/Zend/tests/inter_03.phpt b/Zend/tests/inter_03.phpt index 48c1b5eec2..d57d3a5469 100644 --- a/Zend/tests/inter_03.phpt +++ b/Zend/tests/inter_03.phpt @@ -4,11 +4,11 @@ Testing interface constants with inheritance <?php interface a { - const b = 2; + const b = 2; } interface b extends a { - const c = self::b; + const c = self::b; } var_dump(b::c, a::b); diff --git a/Zend/tests/inter_04.phpt b/Zend/tests/inter_04.phpt index 97fddf73b2..b697f68b5d 100644 --- a/Zend/tests/inter_04.phpt +++ b/Zend/tests/inter_04.phpt @@ -4,11 +4,11 @@ Trying declare interface with repeated name of inherited method <?php interface a { - function b(); + function b(); } interface b { - function b(); + function b(); } interface c extends a, b { diff --git a/Zend/tests/is_a.phpt b/Zend/tests/is_a.phpt index f37c4638a8..aa272d4e67 100644 --- a/Zend/tests/is_a.phpt +++ b/Zend/tests/is_a.phpt @@ -5,8 +5,8 @@ error_reporting=14335 --FILE-- <?php spl_autoload_register(function ($name) { - echo("AUTOLOAD '$name'\n"); - eval("class $name {}"); + echo("AUTOLOAD '$name'\n"); + eval("class $name {}"); }); class BASE { diff --git a/Zend/tests/isset_001.phpt b/Zend/tests/isset_001.phpt index 340b23701e..1a0fc35de9 100644 --- a/Zend/tests/isset_001.phpt +++ b/Zend/tests/isset_001.phpt @@ -8,13 +8,13 @@ print "- isset ---\n"; $var_name = 'unexisting'; if (isset($$var_name)) { - print "error\n"; + print "error\n"; } $test = 'var_name'; if (isset($$$test)) { - print "error\n"; + print "error\n"; } print "- unset ---\n"; diff --git a/Zend/tests/jump03.phpt b/Zend/tests/jump03.phpt index 2399f30ade..c43bb15464 100644 --- a/Zend/tests/jump03.phpt +++ b/Zend/tests/jump03.phpt @@ -3,14 +3,14 @@ jump 03: goto inside control structures --FILE-- <?php do { - if (1) { - echo "1: ok\n"; - goto L1; - } else { - echo "bug\n"; + if (1) { + echo "1: ok\n"; + goto L1; + } else { + echo "bug\n"; L1: - echo "2: ok\n"; - } + echo "2: ok\n"; + } } while (0); ?> --EXPECT-- diff --git a/Zend/tests/jump04.phpt b/Zend/tests/jump04.phpt index 29ec25d8bd..ed6ccf6e67 100644 --- a/Zend/tests/jump04.phpt +++ b/Zend/tests/jump04.phpt @@ -5,16 +5,16 @@ jump 04: goto from loop (backward) $s = "X"; echo "1: ok\n"; L1: if ($s != "X") { - echo "4: ok\n"; + echo "4: ok\n"; } else { - echo "2: ok\n"; - while ($s != "XXX") { - echo "3: ok\n"; - $s .= "X"; - goto L1; - echo "bug\n"; - } - echo "bug\n"; + echo "2: ok\n"; + while ($s != "XXX") { + echo "3: ok\n"; + $s .= "X"; + goto L1; + echo "bug\n"; + } + echo "bug\n"; } ?> --EXPECT-- diff --git a/Zend/tests/jump05.phpt b/Zend/tests/jump05.phpt index 2e5e50c068..1dec75e4a7 100644 --- a/Zend/tests/jump05.phpt +++ b/Zend/tests/jump05.phpt @@ -4,17 +4,17 @@ jump 05: goto from loop (forward) <?php $ar = array("1","2","3"); foreach ($ar as $val) { - switch ($val) { - case "1": - echo "1: ok\n"; - break; - case "2": - echo "2: ok\n"; - goto L1; - case "3": - echo "bug\n"; - break; - } + switch ($val) { + case "1": + echo "1: ok\n"; + break; + case "2": + echo "2: ok\n"; + goto L1; + case "3": + echo "bug\n"; + break; + } } echo "bug\n"; L1: diff --git a/Zend/tests/jump07.phpt b/Zend/tests/jump07.phpt index c0cb112a7b..6015b91a53 100644 --- a/Zend/tests/jump07.phpt +++ b/Zend/tests/jump07.phpt @@ -3,7 +3,7 @@ jump 07: goto into loop (backward) --FILE-- <?php while (0) { - L1: echo "bug\n"; + L1: echo "bug\n"; } goto L1; ?> diff --git a/Zend/tests/jump08.phpt b/Zend/tests/jump08.phpt index 25a211c8c4..e2f7cd4bc6 100644 --- a/Zend/tests/jump08.phpt +++ b/Zend/tests/jump08.phpt @@ -4,7 +4,7 @@ jump 08: goto into loop (forward) <?php goto L1; while (0) { - L1: echo "bug\n"; + L1: echo "bug\n"; } ?> --EXPECTF-- diff --git a/Zend/tests/jump09.phpt b/Zend/tests/jump09.phpt index 52a14b7d54..1d3420fddb 100644 --- a/Zend/tests/jump09.phpt +++ b/Zend/tests/jump09.phpt @@ -3,9 +3,9 @@ jump 09: goto into switch (backward) --FILE-- <?php switch (0) { - case 1: - L1: echo "bug\n"; - break; + case 1: + L1: echo "bug\n"; + break; } goto L1; ?> diff --git a/Zend/tests/jump10.phpt b/Zend/tests/jump10.phpt index 67206a29ae..e69c508d6a 100644 --- a/Zend/tests/jump10.phpt +++ b/Zend/tests/jump10.phpt @@ -4,9 +4,9 @@ jump 10: goto into switch (forward) <?php goto L1; switch (0) { - case 1: - L1: echo "bug\n"; - break; + case 1: + L1: echo "bug\n"; + break; } ?> --EXPECTF-- diff --git a/Zend/tests/jump14.phpt b/Zend/tests/jump14.phpt index f55480acc7..4df251f766 100644 --- a/Zend/tests/jump14.phpt +++ b/Zend/tests/jump14.phpt @@ -6,21 +6,21 @@ Testing GOTO inside blocks goto A; { - B: - goto C; - return; + B: + goto C; + return; } A: - goto B; + goto B; { - C: - { - print "Done!\n"; - } + C: + { + print "Done!\n"; + } } ?> diff --git a/Zend/tests/jump15.phpt b/Zend/tests/jump15.phpt index 456d27785d..4f599a3bb0 100644 --- a/Zend/tests/jump15.phpt +++ b/Zend/tests/jump15.phpt @@ -4,22 +4,22 @@ jump 15: goto from loop (forward) <?php $ar = array("1","2","3"); foreach ($ar as $val) { - switch ($val) { - case "1": - echo "1: ok\n"; - break; - case "2": - echo "2: ok\n"; - goto L1; - case "3": - echo "bug\n"; - break; - } + switch ($val) { + case "1": + echo "1: ok\n"; + break; + case "2": + echo "2: ok\n"; + goto L1; + case "3": + echo "bug\n"; + break; + } } echo "bug\n"; L1: try { - echo "3: ok\n"; + echo "3: ok\n"; } finally { } ?> diff --git a/Zend/tests/jump16.phpt b/Zend/tests/jump16.phpt index cc820c4a6c..0a4acd1422 100644 --- a/Zend/tests/jump16.phpt +++ b/Zend/tests/jump16.phpt @@ -4,22 +4,22 @@ jump 16: goto into try/catch <?php goto a; try { - echo "1"; + echo "1"; a: - echo "2"; - throw new Exception(); + echo "2"; + throw new Exception(); } catch (Exception $e) { - echo "3"; + echo "3"; } echo "4"; goto b; try { - echo "5"; - throw new Exception(); + echo "5"; + throw new Exception(); } catch (Exception $e) { - echo "6"; + echo "6"; b: - echo "7"; + echo "7"; } echo "8\n"; ?> diff --git a/Zend/tests/jump17.phpt b/Zend/tests/jump17.phpt index 92d3be511b..62bcaef823 100644 --- a/Zend/tests/jump17.phpt +++ b/Zend/tests/jump17.phpt @@ -4,18 +4,18 @@ jump 17: goto into try/catch with finally <?php goto b; try { - echo "1"; + echo "1"; a: - echo "2"; - throw new Exception(); + echo "2"; + throw new Exception(); } catch (Exception $e) { - echo "3"; + echo "3"; b: - echo "4"; + echo "4"; } finally { - echo "5"; + echo "5"; c: - echo "6"; + echo "6"; } echo "7\n"; --EXPECT-- diff --git a/Zend/tests/lsb_001.phpt b/Zend/tests/lsb_001.phpt index ca2739d102..72b5c24d32 100644 --- a/Zend/tests/lsb_001.phpt +++ b/Zend/tests/lsb_001.phpt @@ -4,33 +4,33 @@ ZE2 Late Static Binding in a static function <?php class TestClass { - protected static $staticVar = 'TestClassStatic'; - const CLASS_CONST = 'TestClassConst'; + protected static $staticVar = 'TestClassStatic'; + const CLASS_CONST = 'TestClassConst'; - protected static function staticFunction() { - return 'TestClassFunction'; - } + protected static function staticFunction() { + return 'TestClassFunction'; + } - public static function testStaticVar() { - return static::$staticVar; - } + public static function testStaticVar() { + return static::$staticVar; + } - public static function testClassConst() { - return static::CLASS_CONST; - } + public static function testClassConst() { + return static::CLASS_CONST; + } - public static function testStaticFunction() { - return static::staticFunction(); - } + public static function testStaticFunction() { + return static::staticFunction(); + } } class ChildClass1 extends TestClass { - protected static $staticVar = 'ChildClassStatic'; - const CLASS_CONST = 'ChildClassConst'; + protected static $staticVar = 'ChildClassStatic'; + const CLASS_CONST = 'ChildClassConst'; - protected static function staticFunction() { - return 'ChildClassFunction'; - } + protected static function staticFunction() { + return 'ChildClassFunction'; + } } class ChildClass2 extends TestClass {} diff --git a/Zend/tests/lsb_002.phpt b/Zend/tests/lsb_002.phpt index 53eacc90ab..8d765bb116 100644 --- a/Zend/tests/lsb_002.phpt +++ b/Zend/tests/lsb_002.phpt @@ -4,33 +4,33 @@ ZE2 Late Static Binding in an instance function <?php class TestClass { - protected static $staticVar = 'TestClassStatic'; - const CLASS_CONST = 'TestClassConst'; + protected static $staticVar = 'TestClassStatic'; + const CLASS_CONST = 'TestClassConst'; - protected static function staticFunction() { - return 'TestClassFunction'; - } + protected static function staticFunction() { + return 'TestClassFunction'; + } - public function testStaticVar() { - return static::$staticVar; - } + public function testStaticVar() { + return static::$staticVar; + } - public function testClassConst() { - return static::CLASS_CONST; - } + public function testClassConst() { + return static::CLASS_CONST; + } - public function testStaticFunction() { - return static::staticFunction(); - } + public function testStaticFunction() { + return static::staticFunction(); + } } class ChildClass1 extends TestClass { - protected static $staticVar = 'ChildClassStatic'; - const CLASS_CONST = 'ChildClassConst'; + protected static $staticVar = 'ChildClassStatic'; + const CLASS_CONST = 'ChildClassConst'; - protected static function staticFunction() { - return 'ChildClassFunction'; - } + protected static function staticFunction() { + return 'ChildClassFunction'; + } } class ChildClass2 extends TestClass {} diff --git a/Zend/tests/lsb_003.phpt b/Zend/tests/lsb_003.phpt index aa10071b5f..0588b1bb60 100644 --- a/Zend/tests/lsb_003.phpt +++ b/Zend/tests/lsb_003.phpt @@ -4,9 +4,9 @@ ZE2 Late Static Binding creating a new class with 'static' <?php class TestClass { - public static function createInstance() { - return new static(); - } + public static function createInstance() { + return new static(); + } } class ChildClass extends TestClass {} diff --git a/Zend/tests/lsb_004.phpt b/Zend/tests/lsb_004.phpt index 3f26e339c3..84d6ad35f0 100644 --- a/Zend/tests/lsb_004.phpt +++ b/Zend/tests/lsb_004.phpt @@ -4,9 +4,9 @@ ZE2 Late Static Binding testing get_called_class() <?php class TestClass { - public static function getClassName() { - return get_called_class(); - } + public static function getClassName() { + return get_called_class(); + } } class ChildClass extends TestClass {} diff --git a/Zend/tests/lsb_005.phpt b/Zend/tests/lsb_005.phpt index b21d049549..e3ed92e215 100644 --- a/Zend/tests/lsb_005.phpt +++ b/Zend/tests/lsb_005.phpt @@ -4,29 +4,29 @@ ZE2 Late Static Binding stacking static calleds <?php class TestA { - public static function test() { - echo get_class(new static()) . "\n"; - TestB::test(); - echo get_class(new static()) . "\n"; - TestC::test(); - echo get_class(new static()) . "\n"; - TestBB::test(); - echo get_class(new static()) . "\n"; - } + public static function test() { + echo get_class(new static()) . "\n"; + TestB::test(); + echo get_class(new static()) . "\n"; + TestC::test(); + echo get_class(new static()) . "\n"; + TestBB::test(); + echo get_class(new static()) . "\n"; + } } class TestB { - public static function test() { - echo get_class(new static()) . "\n"; - TestC::test(); - echo get_class(new static()) . "\n"; - } + public static function test() { + echo get_class(new static()) . "\n"; + TestC::test(); + echo get_class(new static()) . "\n"; + } } class TestC { - public static function test() { - echo get_class(new static()) . "\n"; - } + public static function test() { + echo get_class(new static()) . "\n"; + } } class TestBB extends TestB { diff --git a/Zend/tests/lsb_010.phpt b/Zend/tests/lsb_010.phpt index c6ef2d8614..5bba029e51 100644 --- a/Zend/tests/lsb_010.phpt +++ b/Zend/tests/lsb_010.phpt @@ -4,20 +4,20 @@ ZE2 Late Static Binding using static:: in functions called by non execute() call <?php class Foo { - protected static $className = 'Foo'; - public static function bar() { - echo static::$className . "::bar\n"; - } - public function __construct() { - echo static::$className . "::__construct\n"; - } - public function __destruct() { - echo static::$className . "::__destruct\n"; - } + protected static $className = 'Foo'; + public static function bar() { + echo static::$className . "::bar\n"; + } + public function __construct() { + echo static::$className . "::__construct\n"; + } + public function __destruct() { + echo static::$className . "::__destruct\n"; + } } class FooChild extends Foo { - protected static $className = 'FooChild'; + protected static $className = 'FooChild'; } register_shutdown_function(array('Foo', 'bar')); diff --git a/Zend/tests/lsb_011.phpt b/Zend/tests/lsb_011.phpt index 3c5bbbeb6f..206f0cb9d0 100644 --- a/Zend/tests/lsb_011.phpt +++ b/Zend/tests/lsb_011.phpt @@ -4,18 +4,18 @@ ZE2 Late Static Binding call to static::method() from internal function (array) <?php class Test1 { - static function ok() { - echo "bug"; - } - static function test() { - call_user_func(array("static","ok")); - } + static function ok() { + echo "bug"; + } + static function test() { + call_user_func(array("static","ok")); + } } class Test2 extends Test1 { - static function ok() { - echo "ok"; - } + static function ok() { + echo "ok"; + } } Test2::test(); ?> diff --git a/Zend/tests/lsb_012.phpt b/Zend/tests/lsb_012.phpt index 3ac8d38840..21ddff3524 100644 --- a/Zend/tests/lsb_012.phpt +++ b/Zend/tests/lsb_012.phpt @@ -4,18 +4,18 @@ ZE2 Late Static Binding call to static::method() from internal function (string) <?php class Test1 { - static function ok() { - echo "bug"; - } - static function test() { - call_user_func("static::ok"); - } + static function ok() { + echo "bug"; + } + static function test() { + call_user_func("static::ok"); + } } class Test2 extends Test1 { - static function ok() { - echo "ok"; - } + static function ok() { + echo "ok"; + } } Test2::test(); ?> diff --git a/Zend/tests/lsb_013.phpt b/Zend/tests/lsb_013.phpt index 3f32dc3a66..3af7f1bea7 100644 --- a/Zend/tests/lsb_013.phpt +++ b/Zend/tests/lsb_013.phpt @@ -4,15 +4,15 @@ ZE2 Late Static Binding is_callable() and static::method() <?php class Test1 { - static function test() { - var_dump(is_callable("static::ok")); - var_dump(is_callable(array("static","ok"))); - } + static function test() { + var_dump(is_callable("static::ok")); + var_dump(is_callable(array("static","ok"))); + } } class Test2 extends Test1 { - static function ok() { - } + static function ok() { + } } Test1::test(); Test2::test(); diff --git a/Zend/tests/lsb_014.phpt b/Zend/tests/lsb_014.phpt index 19cf913710..2b7219a989 100644 --- a/Zend/tests/lsb_014.phpt +++ b/Zend/tests/lsb_014.phpt @@ -4,16 +4,16 @@ ZE2 Late Static Binding access to static::const through defined() and get_consta <?php class Test1 { - static function test() { - var_dump(defined("static::ok")); - if (defined("static::ok")) { - echo constant("static::ok"); - } - } + static function test() { + var_dump(defined("static::ok")); + if (defined("static::ok")) { + echo constant("static::ok"); + } + } } class Test2 extends Test1 { - const ok = "ok"; + const ok = "ok"; } Test1::test(); Test2::test(); diff --git a/Zend/tests/lsb_017.phpt b/Zend/tests/lsb_017.phpt index 7f9e77b5f3..5088eee7bb 100644 --- a/Zend/tests/lsb_017.phpt +++ b/Zend/tests/lsb_017.phpt @@ -3,12 +3,12 @@ ZE2 Late Static Binding nested calls --FILE-- <?php class A { - public static function test($x=null) { - if (!is_null($x)) { - echo "$x\n"; - } - return get_called_class(); - } + public static function test($x=null) { + if (!is_null($x)) { + echo "$x\n"; + } + return get_called_class(); + } } class B extends A { diff --git a/Zend/tests/lsb_018.phpt b/Zend/tests/lsb_018.phpt index 9511426d48..6f05b5f53c 100644 --- a/Zend/tests/lsb_018.phpt +++ b/Zend/tests/lsb_018.phpt @@ -4,26 +4,26 @@ ZE2 Late Static Binding and Singleton <?php abstract class Singleton { - static private $instances = array(); - static private $nextInstanceId = 0; - private $instanceId = NULL; - static final public function getInstance() - { - $caller = get_called_class(); - if (!isset(self::$instances[$caller])) { - self::$instances[$caller] = new $caller; - self::$instances[$caller]->instanceId = self::$nextInstanceId++; - } - return self::$instances[$caller]; - } - public final function getInstanceId() - { - return $this->instanceId; - } - public final function identify() - { - var_dump($this); - } + static private $instances = array(); + static private $nextInstanceId = 0; + private $instanceId = NULL; + static final public function getInstance() + { + $caller = get_called_class(); + if (!isset(self::$instances[$caller])) { + self::$instances[$caller] = new $caller; + self::$instances[$caller]->instanceId = self::$nextInstanceId++; + } + return self::$instances[$caller]; + } + public final function getInstanceId() + { + return $this->instanceId; + } + public final function identify() + { + var_dump($this); + } } class Foo extends Singleton { diff --git a/Zend/tests/lsb_019.phpt b/Zend/tests/lsb_019.phpt index 4073dac8d8..74d674dc73 100644 --- a/Zend/tests/lsb_019.phpt +++ b/Zend/tests/lsb_019.phpt @@ -3,29 +3,29 @@ ZE2 Late Static Binding properties and methods declared as protected and overrid --FILE-- <?php class TestClass { - protected static $staticVar; + protected static $staticVar; - protected static function staticFunction() { - return 'TestClassFunction'; - } + protected static function staticFunction() { + return 'TestClassFunction'; + } - public static function testStaticVar() { - TestClass::$staticVar = 'TestClassStatic'; - ChildClass1::$staticVar = 'ChildClassStatic'; - return static::$staticVar; - } + public static function testStaticVar() { + TestClass::$staticVar = 'TestClassStatic'; + ChildClass1::$staticVar = 'ChildClassStatic'; + return static::$staticVar; + } - public static function testStaticFunction() { - return static::staticFunction(); - } + public static function testStaticFunction() { + return static::staticFunction(); + } } class ChildClass1 extends TestClass { - public static $staticVar; + public static $staticVar; - public static function staticFunction() { - return 'ChildClassFunction'; - } + public static function staticFunction() { + return 'ChildClassFunction'; + } } class ChildClass2 extends TestClass {} diff --git a/Zend/tests/lsb_020.phpt b/Zend/tests/lsb_020.phpt index cc5b257c34..d38017ca05 100644 --- a/Zend/tests/lsb_020.phpt +++ b/Zend/tests/lsb_020.phpt @@ -3,29 +3,29 @@ ZE2 Late Static Binding properties and methods declared as public and overridden --FILE-- <?php class TestClass { - public static $staticVar; + public static $staticVar; - public static function staticFunction() { - return 'TestClassFunction'; - } + public static function staticFunction() { + return 'TestClassFunction'; + } - public static function testStaticVar() { - TestClass::$staticVar = 'TestClassStatic'; - ChildClass1::$staticVar = 'ChildClassStatic'; - return static::$staticVar; - } + public static function testStaticVar() { + TestClass::$staticVar = 'TestClassStatic'; + ChildClass1::$staticVar = 'ChildClassStatic'; + return static::$staticVar; + } - public static function testStaticFunction() { - return static::staticFunction(); - } + public static function testStaticFunction() { + return static::staticFunction(); + } } class ChildClass1 extends TestClass { - public static $staticVar; + public static $staticVar; - public static function staticFunction() { - return 'ChildClassFunction'; - } + public static function staticFunction() { + return 'ChildClassFunction'; + } } class ChildClass2 extends TestClass {} diff --git a/Zend/tests/lsb_022.phpt b/Zend/tests/lsb_022.phpt index 016fde83c9..da918f8b26 100644 --- a/Zend/tests/lsb_022.phpt +++ b/Zend/tests/lsb_022.phpt @@ -3,24 +3,24 @@ ZE2 Late Static Binding parent::/self:: forwarding and __callStatic --FILE-- <?php class A { - static function test() { - echo "A\n"; - } - static function __callstatic($name, $args) { - call_user_func("static::test"); - } + static function test() { + echo "A\n"; + } + static function __callstatic($name, $args) { + call_user_func("static::test"); + } } class B extends A { - static function test() { - echo "B\n"; - } - static function __callstatic($name, $args) { - parent::__callstatic($name, $args); - call_user_func_array("parent::__callstatic", array($name, $args)); - parent::foo(); - call_user_func_array("parent::foo", $args); - call_user_func_array(array("parent","foo"), $args); - } + static function test() { + echo "B\n"; + } + static function __callstatic($name, $args) { + parent::__callstatic($name, $args); + call_user_func_array("parent::__callstatic", array($name, $args)); + parent::foo(); + call_user_func_array("parent::foo", $args); + call_user_func_array(array("parent","foo"), $args); + } } B::foo(); --EXPECT-- diff --git a/Zend/tests/magic_methods_001.phpt b/Zend/tests/magic_methods_001.phpt index 412702ded5..a2f463f8c1 100644 --- a/Zend/tests/magic_methods_001.phpt +++ b/Zend/tests/magic_methods_001.phpt @@ -4,25 +4,25 @@ Testing several magic methods <?php class foo { - function __unset($a) { - print "unset\n"; - var_dump($a); - } - - public function __call($a, $b) { - print "call\n"; - var_dump($a); - } - function __clone() { - print "clone\n"; - } - static public function __callstatic($a, $b) { - print "callstatic\n"; - } - - public function __tostring() { - return 'foo'; - } + function __unset($a) { + print "unset\n"; + var_dump($a); + } + + public function __call($a, $b) { + print "call\n"; + var_dump($a); + } + function __clone() { + print "clone\n"; + } + static public function __callstatic($a, $b) { + print "callstatic\n"; + } + + public function __tostring() { + return 'foo'; + } } diff --git a/Zend/tests/magic_methods_002.phpt b/Zend/tests/magic_methods_002.phpt index 08b7f4497f..fdbb97be40 100644 --- a/Zend/tests/magic_methods_002.phpt +++ b/Zend/tests/magic_methods_002.phpt @@ -4,9 +4,9 @@ Testing __unset with private visibility <?php class foo { - private function __unset($a) { - print "unset\n"; - } + private function __unset($a) { + print "unset\n"; + } } ?> diff --git a/Zend/tests/magic_methods_003.phpt b/Zend/tests/magic_methods_003.phpt index 7e965ba3fd..cd96d15b2f 100644 --- a/Zend/tests/magic_methods_003.phpt +++ b/Zend/tests/magic_methods_003.phpt @@ -4,9 +4,9 @@ Testing __unset declaring as static <?php class foo { - static function __unset($a) { - print "unset\n"; - } + static function __unset($a) { + print "unset\n"; + } } ?> diff --git a/Zend/tests/magic_methods_004.phpt b/Zend/tests/magic_methods_004.phpt index 8caf5d4aa1..3c1df73d09 100644 --- a/Zend/tests/magic_methods_004.phpt +++ b/Zend/tests/magic_methods_004.phpt @@ -4,9 +4,9 @@ Testing __unset() with protected visibility <?php class foo { - protected function __unset($a) { - print "unset\n"; - } + protected function __unset($a) { + print "unset\n"; + } } ?> diff --git a/Zend/tests/magic_methods_005.phpt b/Zend/tests/magic_methods_005.phpt index 76ab30087e..8e7749381c 100644 --- a/Zend/tests/magic_methods_005.phpt +++ b/Zend/tests/magic_methods_005.phpt @@ -4,7 +4,7 @@ Testing __call() declaration in interface with wrong modifier <?php interface a { - static function __call($a, $b); + static function __call($a, $b); } ?> diff --git a/Zend/tests/magic_methods_006.phpt b/Zend/tests/magic_methods_006.phpt index 2e84a41c5c..68eac7439d 100644 --- a/Zend/tests/magic_methods_006.phpt +++ b/Zend/tests/magic_methods_006.phpt @@ -4,7 +4,7 @@ Testing __callstatic declaration in interface with missing the 'static' modifier <?php interface a { - function __callstatic($a, $b); + function __callstatic($a, $b); } ?> diff --git a/Zend/tests/magic_methods_007.phpt b/Zend/tests/magic_methods_007.phpt index 0630c63e9f..63f4cadff5 100644 --- a/Zend/tests/magic_methods_007.phpt +++ b/Zend/tests/magic_methods_007.phpt @@ -4,7 +4,7 @@ Testing __set() declaration in abstract class with wrong modifier <?php abstract class b { - abstract protected function __set($a); + abstract protected function __set($a); } ?> diff --git a/Zend/tests/magic_methods_008.phpt b/Zend/tests/magic_methods_008.phpt index 25731516e6..7d7a839afe 100644 --- a/Zend/tests/magic_methods_008.phpt +++ b/Zend/tests/magic_methods_008.phpt @@ -4,12 +4,12 @@ Testing __set implementation with wrong declaration <?php abstract class b { - abstract function __set($a, $b); + abstract function __set($a, $b); } class a extends b { - private function __set($a, $b) { - } + private function __set($a, $b) { + } } ?> diff --git a/Zend/tests/magic_methods_009.phpt b/Zend/tests/magic_methods_009.phpt index 2b514c3bff..ff609ce452 100644 --- a/Zend/tests/magic_methods_009.phpt +++ b/Zend/tests/magic_methods_009.phpt @@ -4,8 +4,8 @@ Testing __callstatic declaration with wrong modifier <?php class a { - static protected function __callstatic($a, $b) { - } + static protected function __callstatic($a, $b) { + } } ?> diff --git a/Zend/tests/magic_methods_010.phpt b/Zend/tests/magic_methods_010.phpt index 06d46dbd28..8ec3f23e61 100644 --- a/Zend/tests/magic_methods_010.phpt +++ b/Zend/tests/magic_methods_010.phpt @@ -4,8 +4,8 @@ Testing __toString() declaration with wrong modifier <?php class a { - static protected function __toString($a, $b) { - } + static protected function __toString($a, $b) { + } } ?> diff --git a/Zend/tests/method_exists_002.phpt b/Zend/tests/method_exists_002.phpt index 89d3f2824d..a777cd3c3b 100644 --- a/Zend/tests/method_exists_002.phpt +++ b/Zend/tests/method_exists_002.phpt @@ -4,37 +4,37 @@ Testing method_exists() <?php class bar { - static public function stat_a2() { - } - static private function stat_b2() { - } - static protected function stat_c2() { - } + static public function stat_a2() { + } + static private function stat_b2() { + } + static protected function stat_c2() { + } - private function method_a() { - } - protected function method_b() { - } - public function method_c() { - } + private function method_a() { + } + protected function method_b() { + } + public function method_c() { + } } class baz extends bar { - static public function stat_a() { - } - static private function stat_b() { - } - static protected function stat_c() { - } + static public function stat_a() { + } + static private function stat_b() { + } + static protected function stat_c() { + } - private function method_a() { - } - protected function method_b() { - } - public function method_c() { - } + private function method_a() { + } + protected function method_b() { + } + public function method_c() { + } } var_dump(method_exists('baz', 'stat_a')); diff --git a/Zend/tests/methods-on-non-objects-catch.phpt b/Zend/tests/methods-on-non-objects-catch.phpt index a52d3a722a..b090437084 100644 --- a/Zend/tests/methods-on-non-objects-catch.phpt +++ b/Zend/tests/methods-on-non-objects-catch.phpt @@ -8,7 +8,7 @@ set_error_handler(function($code, $message) { $x= null; try { - var_dump($x->method()); + var_dump($x->method()); } catch (Error $e) { var_dump($e->getCode(), $e->getMessage()); } diff --git a/Zend/tests/methods-on-non-objects-usort.phpt b/Zend/tests/methods-on-non-objects-usort.phpt index ff4ad7451c..8a89023b7e 100644 --- a/Zend/tests/methods-on-non-objects-usort.phpt +++ b/Zend/tests/methods-on-non-objects-usort.phpt @@ -10,10 +10,10 @@ $comparator= null; $list= [1, 4, 2, 3, -1]; usort($list, function($a, $b) use ($comparator) { try { - return $comparator->compare($a, $b); + return $comparator->compare($a, $b); } catch (Error $e) { - var_dump($e->getCode(), $e->getMessage()); - return 0; + var_dump($e->getCode(), $e->getMessage()); + return 0; } }); var_dump($list); diff --git a/Zend/tests/mod_001.phpt b/Zend/tests/mod_001.phpt index 2c1ebc7cc2..a393a43644 100644 --- a/Zend/tests/mod_001.phpt +++ b/Zend/tests/mod_001.phpt @@ -10,7 +10,7 @@ try { $c = $a % $b; var_dump($c); } catch (DivisionByZeroError $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "Done\n"; diff --git a/Zend/tests/mul_001.phpt b/Zend/tests/mul_001.phpt index ea587902d0..b57c61776c 100644 --- a/Zend/tests/mul_001.phpt +++ b/Zend/tests/mul_001.phpt @@ -7,9 +7,9 @@ $a = array(1,2,3); $b = array(1); try { - var_dump($a * $b); + var_dump($a * $b); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo "\nException: " . $e->getMessage() . "\n"; } $c = $a * $b; diff --git a/Zend/tests/multibyte/multibyte_encoding_004.phpt b/Zend/tests/multibyte/multibyte_encoding_004.phpt index 0f7ab0cb10..124cd036de 100644 --- a/Zend/tests/multibyte/multibyte_encoding_004.phpt +++ b/Zend/tests/multibyte/multibyte_encoding_004.phpt @@ -12,12 +12,12 @@ zend.script_encoding=Shift_JIS internal_encoding=Shift_JIS --FILE-- <?php - function —\Ž\”\($ˆø”) - { - echo $ˆø”; - } + function —\Ž\”\($ˆø”) + { + echo $ˆø”; + } - —\Ž\”\("ƒhƒŒƒ~ƒtƒ@ƒ\"); + —\Ž\”\("ƒhƒŒƒ~ƒtƒ@ƒ\"); ?> --EXPECT-- ƒhƒŒƒ~ƒtƒ@ƒ\ diff --git a/Zend/tests/multibyte/multibyte_encoding_005.phpt b/Zend/tests/multibyte/multibyte_encoding_005.phpt index 6cf0630d9f..993e078b21 100644 --- a/Zend/tests/multibyte/multibyte_encoding_005.phpt +++ b/Zend/tests/multibyte/multibyte_encoding_005.phpt @@ -13,12 +13,12 @@ zend.script_encoding=Shift_JIS internal_encoding=UTF-8 --FILE-- <?php - function —\Ž\”\($ˆø”) - { - echo $ˆø”; - } + function —\Ž\”\($ˆø”) + { + echo $ˆø”; + } - —\Ž\”\("ƒhƒŒƒ~ƒtƒ@ƒ\"); + —\Ž\”\("ƒhƒŒƒ~ƒtƒ@ƒ\"); ?> --EXPECT-- ドレミファソ diff --git a/Zend/tests/nested_method_and_function.phpt b/Zend/tests/nested_method_and_function.phpt index 3d19a06088..5965a9274c 100644 --- a/Zend/tests/nested_method_and_function.phpt +++ b/Zend/tests/nested_method_and_function.phpt @@ -6,21 +6,21 @@ active_class_entry must be always correct (__METHOD__ should not depend on decla namespace Baz; class Foo { - public static function bar() { - function foo() { - var_dump(__FUNCTION__); - var_dump(__METHOD__); - var_dump(__CLASS__); - } + public static function bar() { + function foo() { + var_dump(__FUNCTION__); + var_dump(__METHOD__); + var_dump(__CLASS__); + } - foo(); + foo(); - var_dump(__FUNCTION__); - var_dump(__METHOD__); - var_dump(__CLASS__); + var_dump(__FUNCTION__); + var_dump(__METHOD__); + var_dump(__CLASS__); - return function() {var_dump(__FUNCTION__); var_dump(__METHOD__); var_dump(__CLASS__); }; - } + return function() {var_dump(__FUNCTION__); var_dump(__METHOD__); var_dump(__CLASS__); }; + } } $c = Foo::bar(); diff --git a/Zend/tests/not_002.phpt b/Zend/tests/not_002.phpt index 11efcaa2ea..38691a1a51 100644 --- a/Zend/tests/not_002.phpt +++ b/Zend/tests/not_002.phpt @@ -7,9 +7,9 @@ $a = array(1,2,3); $b = array(1,2); try { - var_dump(~$b); + var_dump(~$b); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo "\nException: " . $e->getMessage() . "\n"; } $a = ~$b; diff --git a/Zend/tests/nowdoc_015.phpt b/Zend/tests/nowdoc_015.phpt index 56de362dd5..3b02273920 100644 --- a/Zend/tests/nowdoc_015.phpt +++ b/Zend/tests/nowdoc_015.phpt @@ -3,7 +3,7 @@ Test nowdoc and line numbering --FILE-- <?php function error_handler($num, $msg, $file, $line) { - echo $line,"\n"; + echo $line,"\n"; } set_error_handler('error_handler'); trigger_error("line", E_USER_ERROR); diff --git a/Zend/tests/ns_010.phpt b/Zend/tests/ns_010.phpt index e0ccd349ed..9364f89a12 100644 --- a/Zend/tests/ns_010.phpt +++ b/Zend/tests/ns_010.phpt @@ -5,14 +5,14 @@ namespace X; use X as Y; class Foo { - const C = "const ok\n"; - static $var = "var ok\n"; - function __construct() { - echo "class ok\n"; - } - static function bar() { - echo "method ok\n"; - } + const C = "const ok\n"; + static $var = "var ok\n"; + function __construct() { + echo "class ok\n"; + } + static function bar() { + echo "method ok\n"; + } } new Foo(); new Y\Foo(); diff --git a/Zend/tests/ns_013.phpt b/Zend/tests/ns_013.phpt index ef73b1395f..063e27930c 100644 --- a/Zend/tests/ns_013.phpt +++ b/Zend/tests/ns_013.phpt @@ -5,7 +5,7 @@ namespace test\ns1; function strlen($x) { - return __FUNCTION__; + return __FUNCTION__; } echo strlen("Hello"),"\n"; diff --git a/Zend/tests/ns_015.phpt b/Zend/tests/ns_015.phpt index 405d3e4518..7c954c2af3 100644 --- a/Zend/tests/ns_015.phpt +++ b/Zend/tests/ns_015.phpt @@ -5,7 +5,7 @@ namespace test\ns1; function strlen($x) { - return __FUNCTION__; + return __FUNCTION__; } echo \strlen("Hello"),"\n"; diff --git a/Zend/tests/ns_016.phpt b/Zend/tests/ns_016.phpt index bee8b5bee3..19942cfacf 100644 --- a/Zend/tests/ns_016.phpt +++ b/Zend/tests/ns_016.phpt @@ -5,7 +5,7 @@ namespace test\ns1; function strlen($x) { - return __FUNCTION__; + return __FUNCTION__; } $x = "test\\ns1\\strlen"; diff --git a/Zend/tests/ns_017.phpt b/Zend/tests/ns_017.phpt index d48afd5f01..1cb8ac2eb5 100644 --- a/Zend/tests/ns_017.phpt +++ b/Zend/tests/ns_017.phpt @@ -5,7 +5,7 @@ namespace test\ns1; function strlen($x) { - return __FUNCTION__; + return __FUNCTION__; } $x = "strlen"; diff --git a/Zend/tests/ns_018.phpt b/Zend/tests/ns_018.phpt index 9ad2fb89b5..2ef8d104f2 100644 --- a/Zend/tests/ns_018.phpt +++ b/Zend/tests/ns_018.phpt @@ -5,7 +5,7 @@ namespace test; function foo() { - return __FUNCTION__; + return __FUNCTION__; } $x = __NAMESPACE__ . "\\foo"; diff --git a/Zend/tests/ns_019.phpt b/Zend/tests/ns_019.phpt index 91aea33e10..1fa1e227ba 100644 --- a/Zend/tests/ns_019.phpt +++ b/Zend/tests/ns_019.phpt @@ -3,7 +3,7 @@ --FILE-- <?php function foo() { - return __FUNCTION__; + return __FUNCTION__; } $x = __NAMESPACE__ . "\\foo"; diff --git a/Zend/tests/ns_020.phpt b/Zend/tests/ns_020.phpt index 5a391771e9..7915683d6a 100644 --- a/Zend/tests/ns_020.phpt +++ b/Zend/tests/ns_020.phpt @@ -5,7 +5,7 @@ namespace X; use X as Y; function foo() { - echo __FUNCTION__,"\n"; + echo __FUNCTION__,"\n"; } foo(); \X\foo(); diff --git a/Zend/tests/ns_021.phpt b/Zend/tests/ns_021.phpt index 405468399f..5c160e7d07 100644 --- a/Zend/tests/ns_021.phpt +++ b/Zend/tests/ns_021.phpt @@ -5,13 +5,13 @@ namespace test; class Test { - static function foo() { - echo __CLASS__,"::",__FUNCTION__,"\n"; - } + static function foo() { + echo __CLASS__,"::",__FUNCTION__,"\n"; + } } function foo() { - echo __FUNCTION__,"\n"; + echo __FUNCTION__,"\n"; } foo(); diff --git a/Zend/tests/ns_022.inc b/Zend/tests/ns_022.inc index be571fc346..a6faae8c3b 100644 --- a/Zend/tests/ns_022.inc +++ b/Zend/tests/ns_022.inc @@ -1,6 +1,6 @@ <?php class Test { - static function foo() { - echo __CLASS__,"::",__FUNCTION__,"\n"; - } + static function foo() { + echo __CLASS__,"::",__FUNCTION__,"\n"; + } } diff --git a/Zend/tests/ns_022.phpt b/Zend/tests/ns_022.phpt index 7aebe1d5a2..bcddaa0a7c 100644 --- a/Zend/tests/ns_022.phpt +++ b/Zend/tests/ns_022.phpt @@ -9,7 +9,7 @@ use a\b\c as test; require "ns_022.inc"; function foo() { - echo __FUNCTION__,"\n"; + echo __FUNCTION__,"\n"; } test\foo(); diff --git a/Zend/tests/ns_025.phpt b/Zend/tests/ns_025.phpt index 917a710d95..44e90de5d1 100644 --- a/Zend/tests/ns_025.phpt +++ b/Zend/tests/ns_025.phpt @@ -6,10 +6,10 @@ namespace Foo\Bar; class Foo { function __construct() { - echo __CLASS__,"\n"; + echo __CLASS__,"\n"; } static function Bar() { - echo __CLASS__,"\n"; + echo __CLASS__,"\n"; } } diff --git a/Zend/tests/ns_026.phpt b/Zend/tests/ns_026.phpt index 530e135230..83bbf618f9 100644 --- a/Zend/tests/ns_026.phpt +++ b/Zend/tests/ns_026.phpt @@ -8,10 +8,10 @@ namespace Foo; class Foo { function __construct() { - echo "Method - ".__CLASS__."::".__FUNCTION__."\n"; + echo "Method - ".__CLASS__."::".__FUNCTION__."\n"; } static function Bar() { - echo "Method - ".__CLASS__."::".__FUNCTION__."\n"; + echo "Method - ".__CLASS__."::".__FUNCTION__."\n"; } } diff --git a/Zend/tests/ns_027.inc b/Zend/tests/ns_027.inc index 3823818290..96d4c0d7c7 100644 --- a/Zend/tests/ns_027.inc +++ b/Zend/tests/ns_027.inc @@ -3,9 +3,9 @@ namespace Foo\Bar; class Foo { function __construct() { - echo __CLASS__,"\n"; + echo __CLASS__,"\n"; } static function Bar() { - echo __CLASS__,"\n"; + echo __CLASS__,"\n"; } } diff --git a/Zend/tests/ns_027.phpt b/Zend/tests/ns_027.phpt index 88ef22f93b..9035b4ecd2 100644 --- a/Zend/tests/ns_027.phpt +++ b/Zend/tests/ns_027.phpt @@ -6,10 +6,10 @@ require "ns_027.inc"; class Foo { function __construct() { - echo __CLASS__,"\n"; + echo __CLASS__,"\n"; } static function Bar() { - echo __CLASS__,"\n"; + echo __CLASS__,"\n"; } } diff --git a/Zend/tests/ns_028.inc b/Zend/tests/ns_028.inc index 5bd3ae7765..caa1881850 100644 --- a/Zend/tests/ns_028.inc +++ b/Zend/tests/ns_028.inc @@ -3,10 +3,10 @@ namespace Foo; class Foo { function __construct() { - echo "Method - ".__CLASS__."::".__FUNCTION__."\n"; + echo "Method - ".__CLASS__."::".__FUNCTION__."\n"; } static function Bar() { - echo "Method - ".__CLASS__."::".__FUNCTION__."\n"; + echo "Method - ".__CLASS__."::".__FUNCTION__."\n"; } } diff --git a/Zend/tests/ns_028.phpt b/Zend/tests/ns_028.phpt index ec23dac818..37abf5064d 100644 --- a/Zend/tests/ns_028.phpt +++ b/Zend/tests/ns_028.phpt @@ -6,10 +6,10 @@ require "ns_028.inc"; class Foo { function __construct() { - echo "Method - ".__CLASS__."::".__FUNCTION__."\n"; + echo "Method - ".__CLASS__."::".__FUNCTION__."\n"; } static function Bar() { - echo "Method - ".__CLASS__."::".__FUNCTION__."\n"; + echo "Method - ".__CLASS__."::".__FUNCTION__."\n"; } } diff --git a/Zend/tests/ns_031.phpt b/Zend/tests/ns_031.phpt index 840c08621c..0459ee207e 100644 --- a/Zend/tests/ns_031.phpt +++ b/Zend/tests/ns_031.phpt @@ -5,13 +5,13 @@ namespace test; class Test { - static function foo() { - echo __CLASS__,"::",__FUNCTION__,"\n"; - } + static function foo() { + echo __CLASS__,"::",__FUNCTION__,"\n"; + } } function foo() { - echo __FUNCTION__,"\n"; + echo __FUNCTION__,"\n"; } call_user_func(__NAMESPACE__."\\foo"); diff --git a/Zend/tests/ns_032.phpt b/Zend/tests/ns_032.phpt index 5717a33685..290afe141e 100644 --- a/Zend/tests/ns_032.phpt +++ b/Zend/tests/ns_032.phpt @@ -3,13 +3,13 @@ --FILE-- <?php class Test { - static function foo() { - echo __CLASS__,"::",__FUNCTION__,"\n"; - } + static function foo() { + echo __CLASS__,"::",__FUNCTION__,"\n"; + } } function foo() { - echo __FUNCTION__,"\n"; + echo __FUNCTION__,"\n"; } call_user_func(__NAMESPACE__."\\foo"); diff --git a/Zend/tests/ns_034.phpt b/Zend/tests/ns_034.phpt index 76775f1180..bba26b3baa 100644 --- a/Zend/tests/ns_034.phpt +++ b/Zend/tests/ns_034.phpt @@ -5,16 +5,16 @@ namespace A; use A as B; class Foo { - const C = "ok\n"; + const C = "ok\n"; } function f1($x=Foo::C) { - echo $x; + echo $x; } function f2($x=B\Foo::C) { - echo $x; + echo $x; } function f3($x=\A\Foo::C) { - echo $x; + echo $x; } echo Foo::C; echo B\Foo::C; diff --git a/Zend/tests/ns_035.phpt b/Zend/tests/ns_035.phpt index 7fdf7d83f3..bf429114d6 100644 --- a/Zend/tests/ns_035.phpt +++ b/Zend/tests/ns_035.phpt @@ -6,10 +6,10 @@ namespace A; use \ArrayObject; function f1($x = ArrayObject::STD_PROP_LIST) { - var_dump($x); + var_dump($x); } function f2($x = \ArrayObject::STD_PROP_LIST) { - var_dump($x); + var_dump($x); } var_dump(ArrayObject::STD_PROP_LIST); var_dump(\ArrayObject::STD_PROP_LIST); diff --git a/Zend/tests/ns_036.phpt b/Zend/tests/ns_036.phpt index 0458a38df0..0255a4f439 100644 --- a/Zend/tests/ns_036.phpt +++ b/Zend/tests/ns_036.phpt @@ -5,19 +5,19 @@ namespace A; use A as B; class ArrayObject { - const STD_PROP_LIST = 2; + const STD_PROP_LIST = 2; } function f1($x = ArrayObject::STD_PROP_LIST) { - var_dump($x); + var_dump($x); } function f2($x = \ArrayObject::STD_PROP_LIST) { - var_dump($x); + var_dump($x); } function f3($x = \A\ArrayObject::STD_PROP_LIST) { - var_dump($x); + var_dump($x); } function f4($x = B\ArrayObject::STD_PROP_LIST) { - var_dump($x); + var_dump($x); } var_dump(ArrayObject::STD_PROP_LIST); var_dump(\ArrayObject::STD_PROP_LIST); diff --git a/Zend/tests/ns_037.phpt b/Zend/tests/ns_037.phpt index db0a76e940..db649d6739 100644 --- a/Zend/tests/ns_037.phpt +++ b/Zend/tests/ns_037.phpt @@ -5,14 +5,14 @@ namespace X; use X as Y; class X { - const C = "const ok\n"; - static $var = "var ok\n"; - function __construct() { - echo "class ok\n"; - } - static function bar() { - echo "method ok\n"; - } + const C = "const ok\n"; + static $var = "var ok\n"; + function __construct() { + echo "class ok\n"; + } + static function bar() { + echo "method ok\n"; + } } new X(); new Y\X(); diff --git a/Zend/tests/ns_039.phpt b/Zend/tests/ns_039.phpt index c5e79e48c5..fa40d9b016 100644 --- a/Zend/tests/ns_039.phpt +++ b/Zend/tests/ns_039.phpt @@ -3,13 +3,13 @@ --FILE-- <?php function foo($a = A) { - echo "$a\n"; + echo "$a\n"; } function bar($a = array(A => B)) { - foreach ($a as $key => $val) { - echo "$key\n"; - echo "$val\n"; - } + foreach ($a as $key => $val) { + echo "$key\n"; + echo "$val\n"; + } } const A = "ok"; const B = A; diff --git a/Zend/tests/ns_040.phpt b/Zend/tests/ns_040.phpt index 42a3ac07e9..f5b9942c12 100644 --- a/Zend/tests/ns_040.phpt +++ b/Zend/tests/ns_040.phpt @@ -7,28 +7,28 @@ use X as Y; const A = "ok\n"; const B = A; function f1($x=A) { - echo $x; + echo $x; } function f2($x=\X\A) { - echo $x; + echo $x; } function f3($x=Y\A) { - echo $x; + echo $x; } function f4($x=\X\A) { - echo $x; + echo $x; } function f5($x=B) { - echo $x; + echo $x; } function f6($x=array(A)) { - echo $x[0]; + echo $x[0]; } function f7($x=array("aaa"=>A)) { - echo $x["aaa"]; + echo $x["aaa"]; } function f8($x=array(A=>"aaa\n")) { - echo $x["ok\n"]; + echo $x["ok\n"]; } echo A; echo \X\A; diff --git a/Zend/tests/ns_050.phpt b/Zend/tests/ns_050.phpt index f827ec858d..e7cc750a2b 100644 --- a/Zend/tests/ns_050.phpt +++ b/Zend/tests/ns_050.phpt @@ -7,7 +7,7 @@ namespace test\ns1; const INI_ALL = 0; function foo($x = INI_ALL) { - var_dump($x); + var_dump($x); } foo(); --EXPECT-- diff --git a/Zend/tests/ns_051.phpt b/Zend/tests/ns_051.phpt index b95b53f78b..ee8c369a3c 100644 --- a/Zend/tests/ns_051.phpt +++ b/Zend/tests/ns_051.phpt @@ -5,7 +5,7 @@ namespace test\ns1; function foo($x = INI_ALL) { - var_dump($x); + var_dump($x); } foo(); --EXPECT-- diff --git a/Zend/tests/ns_052.phpt b/Zend/tests/ns_052.phpt index cb0a05ff9f..06700d948d 100644 --- a/Zend/tests/ns_052.phpt +++ b/Zend/tests/ns_052.phpt @@ -7,7 +7,7 @@ namespace test\ns1; const INI_ALL = 0; function foo($x = \INI_ALL) { - var_dump($x); + var_dump($x); } foo(); --EXPECT-- diff --git a/Zend/tests/ns_054.phpt b/Zend/tests/ns_054.phpt index c6dd2553f8..9b8defc9ac 100644 --- a/Zend/tests/ns_054.phpt +++ b/Zend/tests/ns_054.phpt @@ -5,19 +5,19 @@ namespace test\ns1; class Foo implements \SplObserver { - function update(\SplSubject $x) { - echo "ok\n"; - } + function update(\SplSubject $x) { + echo "ok\n"; + } } class Bar implements \SplSubject { - function attach(\SplObserver $x) { - echo "ok\n"; - } - function notify() { - } - function detach(\SplObserver $x) { - } + function attach(\SplObserver $x) { + echo "ok\n"; + } + function notify() { + } + function detach(\SplObserver $x) { + } } $foo = new Foo(); $bar = new Bar(); diff --git a/Zend/tests/ns_055.phpt b/Zend/tests/ns_055.phpt index 16e3e69777..9df9c2b007 100644 --- a/Zend/tests/ns_055.phpt +++ b/Zend/tests/ns_055.phpt @@ -5,15 +5,15 @@ namespace test\ns1; class Foo { - function test1(Foo $x) { - echo "ok\n"; - } - function test2(\test\ns1\Foo $x) { - echo "ok\n"; - } - function test3(\Exception $x) { - echo "ok\n"; - } + function test1(Foo $x) { + echo "ok\n"; + } + function test2(\test\ns1\Foo $x) { + echo "ok\n"; + } + function test3(\Exception $x) { + echo "ok\n"; + } } $foo = new Foo(); diff --git a/Zend/tests/ns_056.phpt b/Zend/tests/ns_056.phpt index b61609793d..cc61c7f8f1 100644 --- a/Zend/tests/ns_056.phpt +++ b/Zend/tests/ns_056.phpt @@ -6,19 +6,19 @@ namespace test\ns1; use \SplObserver; class Foo implements SplObserver { - function update(\SplSubject $x) { - echo "ok\n"; - } + function update(\SplSubject $x) { + echo "ok\n"; + } } class Bar implements \SplSubject { - function attach(SplObserver $x) { - echo "ok\n"; - } - function notify() { - } - function detach(SplObserver $x) { - } + function attach(SplObserver $x) { + echo "ok\n"; + } + function notify() { + } + function detach(SplObserver $x) { + } } $foo = new Foo(); $bar = new Bar(); diff --git a/Zend/tests/ns_057.phpt b/Zend/tests/ns_057.phpt index 6c7a72f86e..ad44d09d28 100644 --- a/Zend/tests/ns_057.phpt +++ b/Zend/tests/ns_057.phpt @@ -7,30 +7,30 @@ namespace Test\ns1; const C = "const ok\n"; function foo() { - return "func ok\n"; + return "func ok\n"; } class foo { - const C = "const ok\n"; - const C2 = namespace\C; - static $var = "var ok\n"; - function __construct() { - echo "class ok\n"; - } - static function bar() { - return "method ok\n"; - } + const C = "const ok\n"; + const C2 = namespace\C; + static $var = "var ok\n"; + function __construct() { + echo "class ok\n"; + } + static function bar() { + return "method ok\n"; + } } function f1($x=namespace\C) { - return $x; + return $x; } function f2($x=namespace\foo::C) { - return $x; + return $x; } function f3(namespace\foo $x) { - return "ok\n"; + return "ok\n"; } echo namespace\C; diff --git a/Zend/tests/ns_058.phpt b/Zend/tests/ns_058.phpt index 54e84aa030..6672d8a0b0 100644 --- a/Zend/tests/ns_058.phpt +++ b/Zend/tests/ns_058.phpt @@ -5,30 +5,30 @@ const C = "const ok\n"; function foo() { - return "func ok\n"; + return "func ok\n"; } class foo { - const C = "const ok\n"; - const C2 = namespace\C; - static $var = "var ok\n"; - function __construct() { - echo "class ok\n"; - } - static function bar() { - return "method ok\n"; - } + const C = "const ok\n"; + const C2 = namespace\C; + static $var = "var ok\n"; + function __construct() { + echo "class ok\n"; + } + static function bar() { + return "method ok\n"; + } } function f1($x=namespace\C) { - return $x; + return $x; } function f2($x=namespace\foo::C) { - return $x; + return $x; } function f3(namespace\foo $x) { - return "ok\n"; + return "ok\n"; } echo namespace\C; diff --git a/Zend/tests/ns_063.phpt b/Zend/tests/ns_063.phpt index dbe34b428e..625a499fa2 100644 --- a/Zend/tests/ns_063.phpt +++ b/Zend/tests/ns_063.phpt @@ -4,9 +4,9 @@ <?php namespace Foo; class Bar { - function Bar() { - echo "ok\n"; - } + function Bar() { + echo "ok\n"; + } } new Bar(); echo "ok\n"; diff --git a/Zend/tests/ns_064.phpt b/Zend/tests/ns_064.phpt index 546d3f6375..97e76ed612 100644 --- a/Zend/tests/ns_064.phpt +++ b/Zend/tests/ns_064.phpt @@ -6,19 +6,19 @@ Magic methods in overridden stdClass inside namespace namespace test; class foo { - public $e = array(); + public $e = array(); - public function __construct() { - $this->e[] = $this; - } + public function __construct() { + $this->e[] = $this; + } - public function __set($a, $b) { - var_dump($a, $b); - } - public function __get($a) { - var_dump($a); - return $this; - } + public function __set($a, $b) { + var_dump($a, $b); + } + public function __get($a) { + var_dump($a); + return $this; + } } use test\foo as stdClass; diff --git a/Zend/tests/ns_065.inc b/Zend/tests/ns_065.inc index 963a74e140..4bc1f6f819 100644 --- a/Zend/tests/ns_065.inc +++ b/Zend/tests/ns_065.inc @@ -1,9 +1,9 @@ <?php namespace X\Y; function foo() { - echo __FUNCTION__."\n"; + echo __FUNCTION__."\n"; } namespace X\Z; function foo() { - echo __FUNCTION__."\n"; + echo __FUNCTION__."\n"; } diff --git a/Zend/tests/ns_070.phpt b/Zend/tests/ns_070.phpt index 37cb6a0068..9c0e06abff 100644 --- a/Zend/tests/ns_070.phpt +++ b/Zend/tests/ns_070.phpt @@ -6,9 +6,9 @@ Testing parameter type-hinted with default value inside namespace namespace foo; class bar { - public function __construct(\stdclass $x = NULL) { - var_dump($x); - } + public function __construct(\stdclass $x = NULL) { + var_dump($x); + } } new bar(new \stdclass); diff --git a/Zend/tests/ns_071.phpt b/Zend/tests/ns_071.phpt index d7f1592b38..7acdffba82 100644 --- a/Zend/tests/ns_071.phpt +++ b/Zend/tests/ns_071.phpt @@ -6,9 +6,9 @@ Testing parameter type-hinted (array) with default value inside namespace namespace foo; class bar { - public function __construct(array $x = NULL) { - var_dump($x); - } + public function __construct(array $x = NULL) { + var_dump($x); + } } new bar(null); diff --git a/Zend/tests/ns_072.phpt b/Zend/tests/ns_072.phpt index 932a38b3ba..c422eedd4e 100644 --- a/Zend/tests/ns_072.phpt +++ b/Zend/tests/ns_072.phpt @@ -10,9 +10,9 @@ interface foo { } class bar { - public function __construct(foo $x = NULL) { - var_dump($x); - } + public function __construct(foo $x = NULL) { + var_dump($x); + } } class test implements foo { diff --git a/Zend/tests/ns_073.phpt b/Zend/tests/ns_073.phpt index 8f083195d5..a3a9137e76 100644 --- a/Zend/tests/ns_073.phpt +++ b/Zend/tests/ns_073.phpt @@ -6,7 +6,7 @@ Testing type-hinted lambda parameter inside namespace namespace foo; $x = function (\stdclass $x = NULL) { - var_dump($x); + var_dump($x); }; $x(NULL); diff --git a/Zend/tests/ns_074.phpt b/Zend/tests/ns_074.phpt index 9fd8699aec..37d4e7dc3a 100644 --- a/Zend/tests/ns_074.phpt +++ b/Zend/tests/ns_074.phpt @@ -6,7 +6,7 @@ Testing type-hinted lambda parameter inside namespace namespace foo; $x = function (\stdclass $x = NULL) { - var_dump($x); + var_dump($x); }; class stdclass extends \stdclass { } diff --git a/Zend/tests/ns_081.phpt b/Zend/tests/ns_081.phpt index e08a8088e0..071cc986c9 100644 --- a/Zend/tests/ns_081.phpt +++ b/Zend/tests/ns_081.phpt @@ -5,13 +5,13 @@ namespace foo { use \foo; class bar { - function __construct() {echo __METHOD__,"\n";} + function __construct() {echo __METHOD__,"\n";} } new foo; new bar; namespace oops; class foo { - function __construct() {echo __METHOD__,"\n";} + function __construct() {echo __METHOD__,"\n";} } use foo\bar as foo1; new foo1; diff --git a/Zend/tests/ns_084.phpt b/Zend/tests/ns_084.phpt index cb1ae55e28..4fda7819ae 100644 --- a/Zend/tests/ns_084.phpt +++ b/Zend/tests/ns_084.phpt @@ -5,13 +5,13 @@ namespace foo; use \foo; class bar { - function __construct() {echo __METHOD__,"\n";} + function __construct() {echo __METHOD__,"\n";} } new foo; new bar; namespace oops { class foo { - function __construct() {echo __METHOD__,"\n";} + function __construct() {echo __METHOD__,"\n";} } use foo\bar as foo1; new foo1; diff --git a/Zend/tests/ns_085.phpt b/Zend/tests/ns_085.phpt index 7755d809e3..dca09caad1 100644 --- a/Zend/tests/ns_085.phpt +++ b/Zend/tests/ns_085.phpt @@ -5,14 +5,14 @@ namespace foo { use \foo; class bar { - function __construct() {echo __METHOD__,"\n";} + function __construct() {echo __METHOD__,"\n";} } new foo; new bar; } namespace { class foo { - function __construct() {echo __METHOD__,"\n";} + function __construct() {echo __METHOD__,"\n";} } use foo\bar as foo1; new foo1; diff --git a/Zend/tests/ns_086.phpt b/Zend/tests/ns_086.phpt index ed4b8a238c..292a2fd3bd 100644 --- a/Zend/tests/ns_086.phpt +++ b/Zend/tests/ns_086.phpt @@ -14,14 +14,14 @@ declare(encoding='utf-8'); namespace foo { use \foo; class bar { - function __construct() {echo __METHOD__,"\n";} + function __construct() {echo __METHOD__,"\n";} } new foo; new bar; } namespace { class foo { - function __construct() {echo __METHOD__,"\n";} + function __construct() {echo __METHOD__,"\n";} } use foo\bar as foo1; new foo1; diff --git a/Zend/tests/ns_087.phpt b/Zend/tests/ns_087.phpt index b2f0a89b22..6ada416a23 100644 --- a/Zend/tests/ns_087.phpt +++ b/Zend/tests/ns_087.phpt @@ -5,7 +5,7 @@ namespace foo { use \foo; class bar { - function __construct() {echo __METHOD__,"\n";} + function __construct() {echo __METHOD__,"\n";} } new foo; new bar; @@ -13,7 +13,7 @@ new bar; $a = 'oops'; namespace { class foo { - function __construct() {echo __METHOD__,"\n";} + function __construct() {echo __METHOD__,"\n";} } use foo\bar as foo1; new foo1; diff --git a/Zend/tests/object_handlers.phpt b/Zend/tests/object_handlers.phpt index 3e8dfcc537..5b45ac6956 100644 --- a/Zend/tests/object_handlers.phpt +++ b/Zend/tests/object_handlers.phpt @@ -3,34 +3,34 @@ Magic object handlers segfaults and memory errors --FILE-- <?php function f($x) { - return $x; + return $x; } class foo implements ArrayAccess { - function __get($property) { - $GLOBALS["y"] = $property; - } - function __set($property, $value) { - $GLOBALS["y"] = $property; - } - function __call($func, $args) { - $GLOBALS["y"] = $func; - } - static function __callStatic($func, $args) { - $GLOBALS["y"] = $func; - } - function offsetGet($index) { - $GLOBALS["y"] = $index; - } - function offsetSet($index, $newval) { - $GLOBALS["y"] = $index; - } - function offsetExists($index) { - $GLOBALS["y"] = $index; - } - function offsetUnset($index) { - $GLOBALS["y"] = $index; - } + function __get($property) { + $GLOBALS["y"] = $property; + } + function __set($property, $value) { + $GLOBALS["y"] = $property; + } + function __call($func, $args) { + $GLOBALS["y"] = $func; + } + static function __callStatic($func, $args) { + $GLOBALS["y"] = $func; + } + function offsetGet($index) { + $GLOBALS["y"] = $index; + } + function offsetSet($index, $newval) { + $GLOBALS["y"] = $index; + } + function offsetExists($index) { + $GLOBALS["y"] = $index; + } + function offsetUnset($index) { + $GLOBALS["y"] = $index; + } } $x = new foo(); diff --git a/Zend/tests/object_types/return_type_in_function.phpt b/Zend/tests/object_types/return_type_in_function.phpt index dc7e0463fd..61f6845b47 100644 --- a/Zend/tests/object_types/return_type_in_function.phpt +++ b/Zend/tests/object_types/return_type_in_function.phpt @@ -4,7 +4,7 @@ Adding a function object return type <?php function a() : object { - return 12345; + return 12345; } a(); --EXPECTF-- diff --git a/Zend/tests/objects_002.phpt b/Zend/tests/objects_002.phpt index 66cc09129f..ba94c50ac7 100644 --- a/Zend/tests/objects_002.phpt +++ b/Zend/tests/objects_002.phpt @@ -6,15 +6,15 @@ error_reporting=8191 <?php class test { - function foo() {} + function foo() {} } class test2 extends test { - function foo() {} + function foo() {} } class test3 extends test { - function foo($arg) {} + function foo($arg) {} } ?> diff --git a/Zend/tests/objects_003.phpt b/Zend/tests/objects_003.phpt index 300cda0cd9..d4fc2e58fc 100644 --- a/Zend/tests/objects_003.phpt +++ b/Zend/tests/objects_003.phpt @@ -6,15 +6,15 @@ error_reporting=8191 <?php class test { - function foo($arg) {} + function foo($arg) {} } class test2 extends test { - function foo($arg) {} + function foo($arg) {} } class test3 extends test { - function foo($arg, $arg2) {} + function foo($arg, $arg2) {} } ?> diff --git a/Zend/tests/objects_004.phpt b/Zend/tests/objects_004.phpt index 7c9ca452c8..6af4e813de 100644 --- a/Zend/tests/objects_004.phpt +++ b/Zend/tests/objects_004.phpt @@ -6,15 +6,15 @@ error_reporting=8191 <?php class test { - function foo($arg) {} + function foo($arg) {} } class test2 extends test { - function foo($arg) {} + function foo($arg) {} } class test3 extends test { - function foo(&$arg) {} + function foo(&$arg) {} } ?> diff --git a/Zend/tests/objects_005.phpt b/Zend/tests/objects_005.phpt index 6007ccbbc9..9b9a41465f 100644 --- a/Zend/tests/objects_005.phpt +++ b/Zend/tests/objects_005.phpt @@ -6,15 +6,15 @@ error_reporting=8191 <?php class test { - function &foo() {} + function &foo() {} } class test2 extends test { - function &foo() {} + function &foo() {} } class test3 extends test { - function foo() {} + function foo() {} } ?> diff --git a/Zend/tests/objects_006.phpt b/Zend/tests/objects_006.phpt index e520342180..6ae7d57468 100644 --- a/Zend/tests/objects_006.phpt +++ b/Zend/tests/objects_006.phpt @@ -6,15 +6,15 @@ error_reporting=8191 <?php class test { - function foo($arg, $arg2 = NULL) {} + function foo($arg, $arg2 = NULL) {} } class test2 extends test { - function foo($arg, $arg2 = NULL) {} + function foo($arg, $arg2 = NULL) {} } class test3 extends test { - function foo($arg, $arg2) {} + function foo($arg, $arg2) {} } ?> diff --git a/Zend/tests/objects_007.phpt b/Zend/tests/objects_007.phpt index 2df30b9068..9a23522cb2 100644 --- a/Zend/tests/objects_007.phpt +++ b/Zend/tests/objects_007.phpt @@ -6,15 +6,15 @@ error_reporting=8191 <?php class test { - function foo($arg, &$arg2 = NULL) {} + function foo($arg, &$arg2 = NULL) {} } class test2 extends test { - function foo($arg, &$arg2 = NULL) {} + function foo($arg, &$arg2 = NULL) {} } class test3 extends test { - function foo($arg, &$arg2) {} + function foo($arg, &$arg2) {} } ?> diff --git a/Zend/tests/objects_008.phpt b/Zend/tests/objects_008.phpt index b563061051..fe5d2741e4 100644 --- a/Zend/tests/objects_008.phpt +++ b/Zend/tests/objects_008.phpt @@ -6,15 +6,15 @@ error_reporting=8191 <?php class test { - function foo(Test $arg) {} + function foo(Test $arg) {} } class test2 extends test { - function foo(Test $arg) {} + function foo(Test $arg) {} } class test3 extends test { - function foo(Test3 $arg) {} + function foo(Test3 $arg) {} } ?> diff --git a/Zend/tests/objects_009.phpt b/Zend/tests/objects_009.phpt index 3c91b22742..f0e9c15d45 100644 --- a/Zend/tests/objects_009.phpt +++ b/Zend/tests/objects_009.phpt @@ -6,15 +6,15 @@ error_reporting=8191 <?php class test { - function foo(Test $arg) {} + function foo(Test $arg) {} } class test2 extends test { - function foo(Test $arg) {} + function foo(Test $arg) {} } class test3 extends test { - function foo($arg) {} + function foo($arg) {} } echo "Done\n"; diff --git a/Zend/tests/objects_010.phpt b/Zend/tests/objects_010.phpt index 19fbd1b0f0..b146d6a236 100644 --- a/Zend/tests/objects_010.phpt +++ b/Zend/tests/objects_010.phpt @@ -4,10 +4,10 @@ redefining constructor (__construct second) <?php class test { - function test() { - } - function __construct() { - } + function test() { + } + function __construct() { + } } echo "Done\n"; diff --git a/Zend/tests/objects_011.phpt b/Zend/tests/objects_011.phpt index c7d1e876f5..cd33604f24 100644 --- a/Zend/tests/objects_011.phpt +++ b/Zend/tests/objects_011.phpt @@ -6,10 +6,10 @@ error_reporting=8191 <?php class test { - function __construct() { - } - function test() { - } + function __construct() { + } + function test() { + } } echo "Done\n"; diff --git a/Zend/tests/objects_017.phpt b/Zend/tests/objects_017.phpt index ab992b682e..389d195ed1 100644 --- a/Zend/tests/objects_017.phpt +++ b/Zend/tests/objects_017.phpt @@ -4,11 +4,11 @@ Testing visibility of object returned by function <?php class foo { - private $test = 1; + private $test = 1; } function test() { - return new foo; + return new foo; } test()->test = 2; diff --git a/Zend/tests/objects_018.phpt b/Zend/tests/objects_018.phpt index 98ea982940..35a6d9542c 100644 --- a/Zend/tests/objects_018.phpt +++ b/Zend/tests/objects_018.phpt @@ -4,11 +4,11 @@ Using the same function name on interface with inheritance <?php interface Itest { - function a(); + function a(); } interface Itest2 { - function a(); + function a(); } interface Itest3 extends Itest, Itest2 { diff --git a/Zend/tests/objects_021.phpt b/Zend/tests/objects_021.phpt index d1fc63a38b..a00ffaabe9 100644 --- a/Zend/tests/objects_021.phpt +++ b/Zend/tests/objects_021.phpt @@ -4,33 +4,33 @@ Testing magic methods __set, __get and __call in cascade <?php class test { - static public $i = 0; + static public $i = 0; - public function __construct() { - self::$i++; - } + public function __construct() { + self::$i++; + } - public function __set($a, $b) { - return x(); - } + public function __set($a, $b) { + return x(); + } - public function __get($a) { - return x(); - } + public function __get($a) { + return x(); + } - public function __call($a, $b) { - return x(); - } + public function __call($a, $b) { + return x(); + } } function x() { - return new test; + return new test; } x() - ->a - ->b() - ->c = 1; + ->a + ->b() + ->c = 1; var_dump(test::$i); diff --git a/Zend/tests/objects_024.phpt b/Zend/tests/objects_024.phpt index 50659f1604..3cf565984a 100644 --- a/Zend/tests/objects_024.phpt +++ b/Zend/tests/objects_024.phpt @@ -4,20 +4,20 @@ Testing direct assigning for property of object returned by function <?php class foo { - static $bar = array(); + static $bar = array(); - public function __set($a, $b) { - self::$bar[] = $b; - } + public function __set($a, $b) { + self::$bar[] = $b; + } - public function __get($a) { - /* last */ - return self::$bar[count(self::$bar)-1]; - } + public function __get($a) { + /* last */ + return self::$bar[count(self::$bar)-1]; + } } function test() { - return new foo; + return new foo; } $a = test()->bar = 1; diff --git a/Zend/tests/objects_025.phpt b/Zend/tests/objects_025.phpt index 53c1ae077a..4856e3bd3c 100644 --- a/Zend/tests/objects_025.phpt +++ b/Zend/tests/objects_025.phpt @@ -4,13 +4,13 @@ Testing invalid method names with __call and __callstatic <?php class foo { - public function __call($a, $b) { - print "non-static - ok\n"; - } + public function __call($a, $b) { + print "non-static - ok\n"; + } - public static function __callstatic($a, $b) { - print "static - ok\n"; - } + public static function __callstatic($a, $b) { + print "static - ok\n"; + } } $a = new foo; diff --git a/Zend/tests/objects_026.phpt b/Zend/tests/objects_026.phpt index b347cf721c..bd74119b59 100644 --- a/Zend/tests/objects_026.phpt +++ b/Zend/tests/objects_026.phpt @@ -4,7 +4,7 @@ Using $this when out of context <?php try { - $this->a = 1; + $this->a = 1; } catch (Exception $e) { } diff --git a/Zend/tests/objects_027.phpt b/Zend/tests/objects_027.phpt index b579278f2e..84dca0573a 100644 --- a/Zend/tests/objects_027.phpt +++ b/Zend/tests/objects_027.phpt @@ -4,15 +4,15 @@ Testing 'new static;' calling parent method <?php class bar { - public function show() { - var_dump(new static); - } + public function show() { + var_dump(new static); + } } class foo extends bar { - public function test() { - parent::show(); - } + public function test() { + parent::show(); + } } $foo = new foo; diff --git a/Zend/tests/objects_028.phpt b/Zend/tests/objects_028.phpt index 5c76612938..88f21aa846 100644 --- a/Zend/tests/objects_028.phpt +++ b/Zend/tests/objects_028.phpt @@ -4,16 +4,16 @@ Testing 'static::' and 'parent::' in calls <?php class bar { - public function __call($a, $b) { - print "hello\n"; - } + public function __call($a, $b) { + print "hello\n"; + } } class foo extends bar { - public function __construct() { - static::bar(); - parent::bar(); - } + public function __construct() { + static::bar(); + parent::bar(); + } } diff --git a/Zend/tests/objects_029.phpt b/Zend/tests/objects_029.phpt index afccfa3d61..b5f063625e 100644 --- a/Zend/tests/objects_029.phpt +++ b/Zend/tests/objects_029.phpt @@ -4,18 +4,18 @@ Trying to access undeclared static property <?php class bar { - public function __set($a, $b) { - print "hello\n"; - } + public function __set($a, $b) { + print "hello\n"; + } } class foo extends bar { - public function __construct() { - static::$f = 1; - } - public function __set($a, $b) { - print "foo\n"; - } + public function __construct() { + static::$f = 1; + } + public function __set($a, $b) { + print "foo\n"; + } } diff --git a/Zend/tests/objects_030.phpt b/Zend/tests/objects_030.phpt index c42babc183..55ac88f886 100644 --- a/Zend/tests/objects_030.phpt +++ b/Zend/tests/objects_030.phpt @@ -4,18 +4,18 @@ Trying to access undeclared parent property <?php class bar { - public function __set($a, $b) { - print "hello\n"; - } + public function __set($a, $b) { + print "hello\n"; + } } class foo extends bar { - public function __construct() { - parent::$f = 1; - } - public function __set($a, $b) { - print "foo\n"; - } + public function __construct() { + parent::$f = 1; + } + public function __set($a, $b) { + print "foo\n"; + } } diff --git a/Zend/tests/oct_overflow.phpt b/Zend/tests/oct_overflow.phpt index 13ac419511..512a6abf66 100644 --- a/Zend/tests/oct_overflow.phpt +++ b/Zend/tests/oct_overflow.phpt @@ -6,16 +6,16 @@ precision=14 <?php $doubles = array( - 076545676543223, - 032325463734, - 0777777, - 07777777777777, - 033333333333333, - ); + 076545676543223, + 032325463734, + 0777777, + 07777777777777, + 033333333333333, + ); foreach ($doubles as $d) { - $l = (double)$d; - var_dump($l); + $l = (double)$d; + var_dump($l); } echo "Done\n"; diff --git a/Zend/tests/property_exists.phpt b/Zend/tests/property_exists.phpt index 144b69c231..19823c45a6 100644 --- a/Zend/tests/property_exists.phpt +++ b/Zend/tests/property_exists.phpt @@ -4,33 +4,33 @@ Testing property_exists() <?php class aParent { - public static function staticTest() { - $a = new A; - var_dump(property_exists($a, "prot")); - var_dump(property_exists($a, "prot2")); - var_dump(property_exists($a, "prot3")); - print "------------------\n"; - var_dump(property_exists("A", "prot")); - var_dump(property_exists("A", "prot2")); - var_dump(property_exists("A", "prot3")); - print "------------------\n"; - } - public function nonstaticTest() { - $a = new A; - var_dump(property_exists($a, "prot")); - var_dump(property_exists($a, "prot2")); - var_dump(property_exists($a, "prot3")); - print "------------------\n"; - var_dump(property_exists("A", "prot")); - var_dump(property_exists("A", "prot2")); - var_dump(property_exists("A", "prot3")); - } + public static function staticTest() { + $a = new A; + var_dump(property_exists($a, "prot")); + var_dump(property_exists($a, "prot2")); + var_dump(property_exists($a, "prot3")); + print "------------------\n"; + var_dump(property_exists("A", "prot")); + var_dump(property_exists("A", "prot2")); + var_dump(property_exists("A", "prot3")); + print "------------------\n"; + } + public function nonstaticTest() { + $a = new A; + var_dump(property_exists($a, "prot")); + var_dump(property_exists($a, "prot2")); + var_dump(property_exists($a, "prot3")); + print "------------------\n"; + var_dump(property_exists("A", "prot")); + var_dump(property_exists("A", "prot2")); + var_dump(property_exists("A", "prot3")); + } } class A extends aParent { - static public $prot = "prot"; - static protected $prot2 = "prot"; - static private $prot3 = "prot"; + static public $prot = "prot"; + static protected $prot2 = "prot"; + static private $prot3 = "prot"; } A::staticTest(); diff --git a/Zend/tests/result_unused.phpt b/Zend/tests/result_unused.phpt index 263755beb0..95ae7a5a15 100644 --- a/Zend/tests/result_unused.phpt +++ b/Zend/tests/result_unused.phpt @@ -14,10 +14,10 @@ $x[0]; $x[3]; class Foo { - public $prop = array(3); - function __get($name) { - return array(4); - } + public $prop = array(3); + function __get($name) { + return array(4); + } } $x = new Foo(); $x->prop; diff --git a/Zend/tests/return_types/014.phpt b/Zend/tests/return_types/014.phpt index 655c5a9cc6..25bd79fb81 100644 --- a/Zend/tests/return_types/014.phpt +++ b/Zend/tests/return_types/014.phpt @@ -4,7 +4,7 @@ Constructors cannot declare a return type <?php class Foo { - function __construct() : Foo {} + function __construct() : Foo {} } --EXPECTF-- Fatal error: Constructor %s::%s() cannot declare a return type in %s on line %d diff --git a/Zend/tests/return_types/018.phpt b/Zend/tests/return_types/018.phpt index 2512c6cf49..8c745a1f65 100644 --- a/Zend/tests/return_types/018.phpt +++ b/Zend/tests/return_types/018.phpt @@ -4,7 +4,7 @@ Destructors cannot declare a return type <?php class Foo { - function __destruct() : Foo {} + function __destruct() : Foo {} } --EXPECTF-- Fatal error: Destructor %s::%s() cannot declare a return type in %s on line %d diff --git a/Zend/tests/return_types/019.phpt b/Zend/tests/return_types/019.phpt index 166b624563..4be32b2474 100644 --- a/Zend/tests/return_types/019.phpt +++ b/Zend/tests/return_types/019.phpt @@ -4,7 +4,7 @@ __clone cannot declare a return type <?php class Foo { - function __clone() : Foo {} + function __clone() : Foo {} } --EXPECTF-- Fatal error: %s::%s() cannot declare a return type in %s on line %d diff --git a/Zend/tests/return_types/028.phpt b/Zend/tests/return_types/028.phpt index 8ded158a82..5e69006af7 100644 --- a/Zend/tests/return_types/028.phpt +++ b/Zend/tests/return_types/028.phpt @@ -4,15 +4,15 @@ Memory leak when returning TMP/VAR with wrong return type <?php function foo(): stdClass { - $a = new stdClass; - $b = []; - return [$a, $b]; + $a = new stdClass; + $b = []; + return [$a, $b]; } try { - foo(); + foo(); } catch (Error $e) { - echo $e->getMessage(), " in ", $e->getFile(), " on line ", $e->getLine(); + echo $e->getMessage(), " in ", $e->getFile(), " on line ", $e->getLine(); } ?> diff --git a/Zend/tests/return_types/029.phpt b/Zend/tests/return_types/029.phpt index adc07cde7f..5741763abb 100644 --- a/Zend/tests/return_types/029.phpt +++ b/Zend/tests/return_types/029.phpt @@ -6,11 +6,11 @@ opcache.enable=0 <?php function foo() : array { - try { - throw new Exception("xxxx"); - } finally { - return null; - } + try { + throw new Exception("xxxx"); + } finally { + return null; + } } foo(); diff --git a/Zend/tests/return_types/030.phpt b/Zend/tests/return_types/030.phpt index fc41fa6ee6..8117a7d7ce 100644 --- a/Zend/tests/return_types/030.phpt +++ b/Zend/tests/return_types/030.phpt @@ -3,7 +3,7 @@ Nullable return value --FILE-- <?php function foo($x) : ?array { - return $x; + return $x; } foo([]); diff --git a/Zend/tests/return_types/031.phpt b/Zend/tests/return_types/031.phpt index c41490fd09..2c713853d6 100644 --- a/Zend/tests/return_types/031.phpt +++ b/Zend/tests/return_types/031.phpt @@ -3,10 +3,10 @@ Nullable return type inheritance rules (non-nullable and nullable) --FILE-- <?php class A { - function foo(): int {} + function foo(): int {} } class B extends A { - function foo(): ?int {} + function foo(): ?int {} } ?> DONE diff --git a/Zend/tests/return_types/032.phpt b/Zend/tests/return_types/032.phpt index 00790b5d60..9d011c0062 100644 --- a/Zend/tests/return_types/032.phpt +++ b/Zend/tests/return_types/032.phpt @@ -3,10 +3,10 @@ Nullable return type inheritance rules (nullable and non-nullable) --FILE-- <?php class A { - function foo(): ?int {} + function foo(): ?int {} } class B extends A { - function foo(): int {} + function foo(): int {} } ?> DONE diff --git a/Zend/tests/return_types/bug70557.phpt b/Zend/tests/return_types/bug70557.phpt index cb4eb498b9..5917197045 100644 --- a/Zend/tests/return_types/bug70557.phpt +++ b/Zend/tests/return_types/bug70557.phpt @@ -6,13 +6,13 @@ opcache.enable=0 <?php function getNumber() : int { - return "foo"; + return "foo"; } try { - getNumber(); + getNumber(); } catch (TypeError $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> --EXPECT-- diff --git a/Zend/tests/return_types/bug71092.phpt b/Zend/tests/return_types/bug71092.phpt index 1d4fe983b3..abc43356bc 100644 --- a/Zend/tests/return_types/bug71092.phpt +++ b/Zend/tests/return_types/bug71092.phpt @@ -6,11 +6,11 @@ opcache.enable=0 <?php function boom(): array { - $data = [['id']]; - switch ($data[0]) { - case ['id']: - return null; - } + $data = [['id']]; + switch ($data[0]) { + case ['id']: + return null; + } } boom(); diff --git a/Zend/tests/return_types/bug71978.phpt b/Zend/tests/return_types/bug71978.phpt index cfe8905dec..b5ba87eaff 100644 --- a/Zend/tests/return_types/bug71978.phpt +++ b/Zend/tests/return_types/bug71978.phpt @@ -3,10 +3,10 @@ Bug #71978 (Existence of return type hint affects other compatibility rules) --FILE-- <?php class A1 { - function foo(int $a): int {} + function foo(int $a): int {} } class B1 extends A1 { - function foo(string $a): int {} + function foo(string $a): int {} } ?> --EXPECTF-- diff --git a/Zend/tests/return_types/return_reference_separation.phpt b/Zend/tests/return_types/return_reference_separation.phpt index 0151e5ec31..86c206a0d5 100644 --- a/Zend/tests/return_types/return_reference_separation.phpt +++ b/Zend/tests/return_types/return_reference_separation.phpt @@ -3,15 +3,15 @@ Return value separation --FILE-- <?php function test1(&$abc) : string { - return $abc; + return $abc; } function &test2(int $abc) : string { - return $abc; + return $abc; } function &test3(int &$abc) : string { - return $abc; + return $abc; } $a = 123; diff --git a/Zend/tests/rope_with_exception.phpt b/Zend/tests/rope_with_exception.phpt index e73ea64518..1453f0c59c 100644 --- a/Zend/tests/rope_with_exception.phpt +++ b/Zend/tests/rope_with_exception.phpt @@ -4,36 +4,36 @@ Exceptions thrown into a rope must not leak <?php class Obj { - function __get($x) { - throw new Exception(); - } + function __get($x) { + throw new Exception(); + } } try { - $x = new Obj; - $y = 0; - $r = "$y|$x->x|"; - echo "should never be reached"; + $x = new Obj; + $y = 0; + $r = "$y|$x->x|"; + echo "should never be reached"; } catch (Exception $e) { - echo "$e\n"; + echo "$e\n"; } try { - $x = new Obj; - $y = 0; - $r = "$y$x->x|"; - echo "should never be reached"; + $x = new Obj; + $y = 0; + $r = "$y$x->x|"; + echo "should never be reached"; } catch (Exception $e) { - echo "$e\n"; + echo "$e\n"; } try { - $x = new Obj; - $y = 0; - $r = "$y|$y$x->x"; - echo "should never be reached"; + $x = new Obj; + $y = 0; + $r = "$y|$y$x->x"; + echo "should never be reached"; } catch (Exception $e) { - echo "$e\n"; + echo "$e\n"; } ?> diff --git a/Zend/tests/runtime_compile_time_binary_operands.phpt b/Zend/tests/runtime_compile_time_binary_operands.phpt index 2908bc3db1..8c15a9658f 100644 --- a/Zend/tests/runtime_compile_time_binary_operands.phpt +++ b/Zend/tests/runtime_compile_time_binary_operands.phpt @@ -6,120 +6,120 @@ memory_limit=256M <?php $operands = [ - "==", - "!=", - "===", - "!==", - "<", - "<=", - ">", - ">=", - "<=>", - "+", - "-", - "*", - "/", - "%", - "**", - ".", - "|", - "&", - "^", - "or", - "and", - "xor", - "||", - "&&", + "==", + "!=", + "===", + "!==", + "<", + "<=", + ">", + ">=", + "<=>", + "+", + "-", + "*", + "/", + "%", + "**", + ".", + "|", + "&", + "^", + "or", + "and", + "xor", + "||", + "&&", ]; $input = [ - 0, - 1, - 2, - -1, - 2.0, - 2.1, - -2.0, - -2.1, - PHP_INT_MAX, - PHP_INT_MIN, - PHP_INT_MAX * 2, - PHP_INT_MIN * 2, - INF, - NAN, - [], - [1, 2], - [1, 2, 3], - [1 => 2, 0 => 1], - [1, 'a' => 2], - [1, 4], - [1, 'a'], - [1, 2 => 2], - [1, [ 2 ]], - null, - false, - true, - "", - " ", - "banana", - "Banana", - "banan", - "0", - "200", - "20", - "20a", - " \t\n\r\v\f20", - "20 ", - "2e1", - "2e150", - "9179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368", - "-9179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368", - "0.1", - "-0.1", - "1e-1", - "-20", - "-20.0", - "0x14", - (string) PHP_INT_MAX * 2, - (string) PHP_INT_MIN * 2, + 0, + 1, + 2, + -1, + 2.0, + 2.1, + -2.0, + -2.1, + PHP_INT_MAX, + PHP_INT_MIN, + PHP_INT_MAX * 2, + PHP_INT_MIN * 2, + INF, + NAN, + [], + [1, 2], + [1, 2, 3], + [1 => 2, 0 => 1], + [1, 'a' => 2], + [1, 4], + [1, 'a'], + [1, 2 => 2], + [1, [ 2 ]], + null, + false, + true, + "", + " ", + "banana", + "Banana", + "banan", + "0", + "200", + "20", + "20a", + " \t\n\r\v\f20", + "20 ", + "2e1", + "2e150", + "9179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368", + "-9179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368", + "0.1", + "-0.1", + "1e-1", + "-20", + "-20.0", + "0x14", + (string) PHP_INT_MAX * 2, + (string) PHP_INT_MIN * 2, ]; function makeParam($param) { - if ($param === PHP_INT_MIN) { - return "PHP_INT_MIN"; - } - if ($param === PHP_INT_MAX) { - return "PHP_INT_MAX"; - } - if (is_string($param)) { - return '"' . strtr($param, ["\t" => '\t', "\n" => '\n', "\r" => '\r', "\v" => '\v', "\f" => '\f', '$' => '\$', '"' => '\"']) . '"'; - } - return "(" . str_replace("\n", "", var_export($param, true)) . ")"; + if ($param === PHP_INT_MIN) { + return "PHP_INT_MIN"; + } + if ($param === PHP_INT_MAX) { + return "PHP_INT_MAX"; + } + if (is_string($param)) { + return '"' . strtr($param, ["\t" => '\t', "\n" => '\n', "\r" => '\r', "\v" => '\v', "\f" => '\f', '$' => '\$', '"' => '\"']) . '"'; + } + return "(" . str_replace("\n", "", var_export($param, true)) . ")"; } $c = 0; $f = 0; function prepareLine($op1, $op2, $cmp, $operator) { - - $op1_p = makeParam($op1); - $op2_p = makeParam($op2); - $error = "echo '" . addcslashes("$op1_p $operator $op2_p", "\\'") . '\', "\n"; $f++;'; + $op1_p = makeParam($op1); + $op2_p = makeParam($op2); - $compare = "@($op1_p $operator $op2_p)"; - $line = "\$c++; "; - try { - $result = makeParam($cmp()); - $line .= "if (" . ($result === "(NAN)" ? "!is_nan($compare)" : "$compare !== $result") . ") { $error }"; - } catch (Error $e) { - if (get_class($e) == "Error") { - return "// exempt $op1_p $operator $op2_p from checking, it generates a compile time error"; - } - $msg = makeParam($e->getMessage()); - $line .= "try { $compare; $error } catch (Error \$e) { if (\$e->getMessage() !== $msg) { $error } }"; - } - return $line; + $error = "echo '" . addcslashes("$op1_p $operator $op2_p", "\\'") . '\', "\n"; $f++;'; + + $compare = "@($op1_p $operator $op2_p)"; + $line = "\$c++; "; + try { + $result = makeParam($cmp()); + $line .= "if (" . ($result === "(NAN)" ? "!is_nan($compare)" : "$compare !== $result") . ") { $error }"; + } catch (Error $e) { + if (get_class($e) == "Error") { + return "// exempt $op1_p $operator $op2_p from checking, it generates a compile time error"; + } + $msg = makeParam($e->getMessage()); + $line .= "try { $compare; $error } catch (Error \$e) { if (\$e->getMessage() !== $msg) { $error } }"; + } + return $line; } $filename = __DIR__ . DIRECTORY_SEPARATOR . 'compare_binary_operands_temp.php'; @@ -128,14 +128,14 @@ $file = fopen($filename, "w"); fwrite($file, "<?php\n"); foreach ($input as $left) { - foreach ($input as $right) { - foreach ($operands as $operand) { - $line = prepareLine($left, $right, function() use ($left, $right, $operand) { - return eval("return @(\$left $operand \$right);"); - }, $operand); - fwrite($file, $line . "\n"); - } - } + foreach ($input as $right) { + foreach ($operands as $operand) { + $line = prepareLine($left, $right, function() use ($left, $right, $operand) { + return eval("return @(\$left $operand \$right);"); + }, $operand); + fwrite($file, $line . "\n"); + } + } } fclose($file); @@ -143,9 +143,9 @@ fclose($file); include $filename; if($c === 0) { - echo "Completely failed\n"; + echo "Completely failed\n"; } else { - echo "Failed: $f\n"; + echo "Failed: $f\n"; } ?> --CLEAN-- diff --git a/Zend/tests/selfParent_001.phpt b/Zend/tests/selfParent_001.phpt index e7f1d2defa..e66185fc8f 100644 --- a/Zend/tests/selfParent_001.phpt +++ b/Zend/tests/selfParent_001.phpt @@ -3,20 +3,20 @@ Test when constants are initialised. See also selfParent_002.phpt. --FILE-- <?php class A { - const myConst = "const in A"; - const myDynConst = self::myConst; + const myConst = "const in A"; + const myDynConst = self::myConst; - public static function test() { - var_dump(self::myDynConst); - } + public static function test() { + var_dump(self::myDynConst); + } } class B extends A { - const myConst = "const in B"; + const myConst = "const in B"; - public static function test() { - var_dump(parent::myDynConst); - } + public static function test() { + var_dump(parent::myDynConst); + } } A::test(); diff --git a/Zend/tests/selfParent_002.phpt b/Zend/tests/selfParent_002.phpt index fda67f1e88..3b1b62c591 100644 --- a/Zend/tests/selfParent_002.phpt +++ b/Zend/tests/selfParent_002.phpt @@ -3,20 +3,20 @@ Test when constants are initialised. See also selfParent_001.phpt. --FILE-- <?php class A { - const myConst = "const in A"; - const myDynConst = self::myConst; + const myConst = "const in A"; + const myDynConst = self::myConst; - public static function test() { - var_dump(self::myDynConst); - } + public static function test() { + var_dump(self::myDynConst); + } } class B extends A { - const myConst = "const in B"; + const myConst = "const in B"; - public static function test() { - var_dump(parent::myDynConst); - } + public static function test() { + var_dump(parent::myDynConst); + } } B::test(); diff --git a/Zend/tests/settype_array.phpt b/Zend/tests/settype_array.phpt Binary files differindex 562d349099..57c8e5180c 100644 --- a/Zend/tests/settype_array.phpt +++ b/Zend/tests/settype_array.phpt diff --git a/Zend/tests/settype_bool.phpt b/Zend/tests/settype_bool.phpt index 06b003ac86..7eabcab5ed 100644 --- a/Zend/tests/settype_bool.phpt +++ b/Zend/tests/settype_bool.phpt @@ -6,32 +6,32 @@ casting different variables to boolean using settype() $r = fopen(__FILE__, "r"); class test { - function __toString() { - return "10"; - } + function __toString() { + return "10"; + } } $o = new test; $vars = array( - "string", - "8754456", - "", - "\0", - 9876545, - 0.10, - array(), - array(1,2,3), - false, - true, - NULL, - $r, - $o + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o ); foreach ($vars as $var) { - settype($var, "bool"); - var_dump($var); + settype($var, "bool"); + var_dump($var); } echo "Done\n"; diff --git a/Zend/tests/settype_double.phpt b/Zend/tests/settype_double.phpt index 11bdcfee72..8c74a95b14 100644 --- a/Zend/tests/settype_double.phpt +++ b/Zend/tests/settype_double.phpt @@ -8,32 +8,32 @@ precision=14 $r = fopen(__FILE__, "r"); class test { - function __toString() { - return "10"; - } + function __toString() { + return "10"; + } } $o = new test; $vars = array( - "string", - "8754456", - "", - "\0", - 9876545, - 0.10, - array(), - array(1,2,3), - false, - true, - NULL, - $r, - $o + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o ); foreach ($vars as $var) { - settype($var, "double"); - var_dump($var); + settype($var, "double"); + var_dump($var); } echo "Done\n"; diff --git a/Zend/tests/settype_int.phpt b/Zend/tests/settype_int.phpt index f278bf1bcd..9dac9c5b8f 100644 --- a/Zend/tests/settype_int.phpt +++ b/Zend/tests/settype_int.phpt @@ -6,32 +6,32 @@ casting different variables to integer using settype() $r = fopen(__FILE__, "r"); class test { - function __toString() { - return "10"; - } + function __toString() { + return "10"; + } } $o = new test; $vars = array( - "string", - "8754456", - "", - "\0", - 9876545, - 0.10, - array(), - array(1,2,3), - false, - true, - NULL, - $r, - $o + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o ); foreach ($vars as $var) { - settype($var, "int"); - var_dump($var); + settype($var, "int"); + var_dump($var); } echo "Done\n"; diff --git a/Zend/tests/settype_null.phpt b/Zend/tests/settype_null.phpt index e98b71ae8a..04b270ea59 100644 --- a/Zend/tests/settype_null.phpt +++ b/Zend/tests/settype_null.phpt @@ -6,32 +6,32 @@ casting different variables to null using settype() $r = fopen(__FILE__, "r"); class test { - function __toString() { - return "10"; - } + function __toString() { + return "10"; + } } $o = new test; $vars = array( - "string", - "8754456", - "", - "\0", - 9876545, - 0.10, - array(), - array(1,2,3), - false, - true, - NULL, - $r, - $o + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o ); foreach ($vars as $var) { - settype($var, "null"); - var_dump($var); + settype($var, "null"); + var_dump($var); } echo "Done\n"; diff --git a/Zend/tests/settype_object.phpt b/Zend/tests/settype_object.phpt Binary files differindex be2694c312..9369011127 100644 --- a/Zend/tests/settype_object.phpt +++ b/Zend/tests/settype_object.phpt diff --git a/Zend/tests/settype_resource.phpt b/Zend/tests/settype_resource.phpt Binary files differindex 1b038613f3..884ff3dae3 100644 --- a/Zend/tests/settype_resource.phpt +++ b/Zend/tests/settype_resource.phpt diff --git a/Zend/tests/settype_string.phpt b/Zend/tests/settype_string.phpt Binary files differindex 0c97450051..cc90fdfdf4 100644 --- a/Zend/tests/settype_string.phpt +++ b/Zend/tests/settype_string.phpt diff --git a/Zend/tests/static_variable.phpt b/Zend/tests/static_variable.phpt index 62ca565ffe..54468de054 100644 --- a/Zend/tests/static_variable.phpt +++ b/Zend/tests/static_variable.phpt @@ -5,10 +5,10 @@ Static Variable Expressions const bar = 2, baz = bar + 1; function foo() { - static $a = 1 + 1; - static $b = [bar => 1 + 1, baz * 2 => 1 << 2]; - static $c = [1 => bar, 3 => baz]; - var_dump($a, $b, $c); + static $a = 1 + 1; + static $b = [bar => 1 + 1, baz * 2 => 1 << 2]; + static $c = [1 => bar, 3 => baz]; + var_dump($a, $b, $c); } foo(); diff --git a/Zend/tests/str_offset_001.phpt b/Zend/tests/str_offset_001.phpt index 04fadd3023..02e7ccb666 100644 --- a/Zend/tests/str_offset_001.phpt +++ b/Zend/tests/str_offset_001.phpt @@ -5,7 +5,7 @@ string offset 001 // Test positive or null string offsets function foo($x) { - var_dump($x); + var_dump($x); } $str = "abc"; diff --git a/Zend/tests/str_offset_003.phpt b/Zend/tests/str_offset_003.phpt index 4101ce522a..db7644c321 100644 --- a/Zend/tests/str_offset_003.phpt +++ b/Zend/tests/str_offset_003.phpt @@ -5,7 +5,7 @@ string offset 003 // Test negative string offsets function foo($x) { - var_dump($x); + var_dump($x); } $str = "abcdef"; diff --git a/Zend/tests/strict_002.phpt b/Zend/tests/strict_002.phpt index 8f76c8cf01..7f9c613801 100644 --- a/Zend/tests/strict_002.phpt +++ b/Zend/tests/strict_002.phpt @@ -6,7 +6,7 @@ error_reporting=8191 <?php class test { - static $foo = 1; + static $foo = 1; } $t = new test; diff --git a/Zend/tests/sub_001.phpt b/Zend/tests/sub_001.phpt index ef02c38241..165c64153b 100644 --- a/Zend/tests/sub_001.phpt +++ b/Zend/tests/sub_001.phpt @@ -7,9 +7,9 @@ $a = array(1,2,3); $b = array(1); try { - var_dump($a - $b); + var_dump($a - $b); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo "\nException: " . $e->getMessage() . "\n"; } $c = $a - $b; diff --git a/Zend/tests/temporary_cleaning_001.phpt b/Zend/tests/temporary_cleaning_001.phpt index f2ccbb35b8..9622a4a542 100644 --- a/Zend/tests/temporary_cleaning_001.phpt +++ b/Zend/tests/temporary_cleaning_001.phpt @@ -8,12 +8,12 @@ function ops() { } try { - $x = 2; - $y = new stdClass; - while ($x-- && new stdClass) { - $r = [$x] + ($y ? ((array) $x) + [2] : ops()); - $y = (array) $y; - } + $x = 2; + $y = new stdClass; + while ($x-- && new stdClass) { + $r = [$x] + ($y ? ((array) $x) + [2] : ops()); + $y = (array) $y; + } } catch (Exception $e) { } diff --git a/Zend/tests/temporary_cleaning_002.phpt b/Zend/tests/temporary_cleaning_002.phpt index bea54e7f77..77be1dbd0a 100644 --- a/Zend/tests/temporary_cleaning_002.phpt +++ b/Zend/tests/temporary_cleaning_002.phpt @@ -3,26 +3,26 @@ Temporary leak on rope (encapsed string) --FILE-- <?php class Obj { - function __get($x) { - throw new Exception(); - } + function __get($x) { + throw new Exception(); + } } $x = new Obj; $y = 0; try { - $r = "$y|$x->x|"; + $r = "$y|$x->x|"; } catch (Exception $e) { } try { - $r = "$x->x|$y|"; + $r = "$x->x|$y|"; } catch (Exception $e) { } try { - $r = "$y|$y|$x->x"; + $r = "$y|$y|$x->x"; } catch (Exception $e) { } diff --git a/Zend/tests/temporary_cleaning_004.phpt b/Zend/tests/temporary_cleaning_004.phpt index b8a02516b0..8e94b25229 100644 --- a/Zend/tests/temporary_cleaning_004.phpt +++ b/Zend/tests/temporary_cleaning_004.phpt @@ -9,32 +9,32 @@ function ops() { $a = [new stdClass, new stdClass]; switch ($a[0]) { - case false: - break; - default: - try { - $x = 2; - $y = new stdClass; - while ($x-- && new stdClass) { - $r = [$x] + ($y ? ((array) $x) + [2] : ops()); - $y = (array) $y; - } - } catch (Exception $e) { - } + case false: + break; + default: + try { + $x = 2; + $y = new stdClass; + while ($x-- && new stdClass) { + $r = [$x] + ($y ? ((array) $x) + [2] : ops()); + $y = (array) $y; + } + } catch (Exception $e) { + } } try { - switch ($a[0]) { - case false: - break; - default: - $x = 2; - $y = new stdClass; - while ($x-- && new stdClass) { - $r = [$x] + ($y ? ((array) $x) + [2] : ops()); - $y = (array) $y; - } - } + switch ($a[0]) { + case false: + break; + default: + $x = 2; + $y = new stdClass; + while ($x-- && new stdClass) { + $r = [$x] + ($y ? ((array) $x) + [2] : ops()); + $y = (array) $y; + } + } } catch (Exception $e) { } diff --git a/Zend/tests/temporary_cleaning_005.phpt b/Zend/tests/temporary_cleaning_005.phpt index e8c7febe0b..61bb563a76 100644 --- a/Zend/tests/temporary_cleaning_005.phpt +++ b/Zend/tests/temporary_cleaning_005.phpt @@ -9,37 +9,37 @@ function ops() { $a = [new stdClass, new stdClass]; foreach ([$a, [new stdClass]] as $b) { - switch ($b[0]) { - case false: - break; - default: - try { - $x = 2; - $y = new stdClass; - while ($x-- && new stdClass) { - $r = [$x] + ($y ? ((array) $x) + [2] : ops()); - $y = (array) $y; - } - } catch (Exception $e) { - } - } + switch ($b[0]) { + case false: + break; + default: + try { + $x = 2; + $y = new stdClass; + while ($x-- && new stdClass) { + $r = [$x] + ($y ? ((array) $x) + [2] : ops()); + $y = (array) $y; + } + } catch (Exception $e) { + } + } } foreach ([$a, [new stdClass]] as $b) { - try { - switch ($b[0]) { - case false: - break; - default: - $x = 2; - $y = new stdClass; - while ($x-- && new stdClass) { - $r = [$x] + ($y ? ((array) $x) + [2] : ops()); - $y = (array) $y; - } - } - } catch (Exception $e) { - } + try { + switch ($b[0]) { + case false: + break; + default: + $x = 2; + $y = new stdClass; + while ($x-- && new stdClass) { + $r = [$x] + ($y ? ((array) $x) + [2] : ops()); + $y = (array) $y; + } + } + } catch (Exception $e) { + } } ?> diff --git a/Zend/tests/temporary_cleaning_008.phpt b/Zend/tests/temporary_cleaning_008.phpt index c876f3c2e8..81a54f351e 100644 --- a/Zend/tests/temporary_cleaning_008.phpt +++ b/Zend/tests/temporary_cleaning_008.phpt @@ -3,12 +3,12 @@ Optimization of constant switch expression --FILE-- <?php try { - switch ("1" . (int)2) { - case 12: - throw new Exception(); - } + switch ("1" . (int)2) { + case 12: + throw new Exception(); + } } catch (Exception $e) { - echo "exception\n"; + echo "exception\n"; } ?> --EXPECT-- diff --git a/Zend/tests/temporary_cleaning_010.phpt b/Zend/tests/temporary_cleaning_010.phpt index e4456041b2..122a0b28a7 100644 --- a/Zend/tests/temporary_cleaning_010.phpt +++ b/Zend/tests/temporary_cleaning_010.phpt @@ -14,7 +14,7 @@ function test() { try { test(); } catch (Exception $e) { - echo "exception\n"; + echo "exception\n"; } ?> --EXPECT-- diff --git a/Zend/tests/temporary_cleaning_011.phpt b/Zend/tests/temporary_cleaning_011.phpt index aa1be00e56..09e2148f72 100644 --- a/Zend/tests/temporary_cleaning_011.phpt +++ b/Zend/tests/temporary_cleaning_011.phpt @@ -3,17 +3,17 @@ Live range & lists --FILE-- <?php class A { - function __destruct() { - throw new Exception(); - } + function __destruct() { + throw new Exception(); + } } $b = new A(); $x = 0; $c = [[$x,$x]]; try { - list($a, $b) = $c[0]; + list($a, $b) = $c[0]; } catch (Exception $e) { - echo "exception\n"; + echo "exception\n"; } ?> --EXPECT-- diff --git a/Zend/tests/temporary_cleaning_013.phpt b/Zend/tests/temporary_cleaning_013.phpt index 34e4080f56..d9e7dd82f5 100644 --- a/Zend/tests/temporary_cleaning_013.phpt +++ b/Zend/tests/temporary_cleaning_013.phpt @@ -4,271 +4,271 @@ Exceptions thrown in operand cleaning must cause leak of return value <?php try { - var_dump(new class { - function __toString() { return "a"; } - function __destruct() { throw new Exception; } - } . "foo"); + var_dump(new class { + function __toString() { return "a"; } + function __destruct() { throw new Exception; } + } . "foo"); } catch (Exception $e) { print "caught Exception 1\n"; } try { - var_dump([0] + [new class { - function __destruct() { throw new Exception; } - }]); + var_dump([0] + [new class { + function __destruct() { throw new Exception; } + }]); } catch (Exception $e) { print "caught Exception 2\n"; } try { - $foo = [0]; - var_dump($foo += [new class { - function __destruct() { throw new Exception; } - }]); + $foo = [0]; + var_dump($foo += [new class { + function __destruct() { throw new Exception; } + }]); } catch (Exception $e) { print "caught Exception 3\n"; } try { - $foo = (object)["foo" => [0]]; - var_dump($foo->foo += [new class { - function __destruct() { throw new Exception; } - }]); + $foo = (object)["foo" => [0]]; + var_dump($foo->foo += [new class { + function __destruct() { throw new Exception; } + }]); } catch (Exception $e) { print "caught Exception 4\n"; } try { - $foo = new class { - function __get($x) { return [0]; } - function __set($x, $y) {} - }; - var_dump($foo->foo += [new class { - function __destruct() { throw new Exception; } - }]); + $foo = new class { + function __get($x) { return [0]; } + function __set($x, $y) {} + }; + var_dump($foo->foo += [new class { + function __destruct() { throw new Exception; } + }]); } catch (Exception $e) { print "caught Exception 5\n"; } try { - $foo = new class { - public $bar = [0]; - function &__get($x) { return $this->bar; } - }; - var_dump($foo->foo += [new class { - function __destruct() { throw new Exception; } - }]); + $foo = new class { + public $bar = [0]; + function &__get($x) { return $this->bar; } + }; + var_dump($foo->foo += [new class { + function __destruct() { throw new Exception; } + }]); } catch (Exception $e) { print "caught Exception 6\n"; } try { - $foo = new class implements ArrayAccess { - function offsetGet($x) { return [0]; } - function offsetSet($x, $y) {} - function offsetExists($x) { return true; } - function offsetUnset($x) {} - }; - var_dump($foo[0] += [new class { - function __destruct() { throw new Exception; } - }]); + $foo = new class implements ArrayAccess { + function offsetGet($x) { return [0]; } + function offsetSet($x, $y) {} + function offsetExists($x) { return true; } + function offsetUnset($x) {} + }; + var_dump($foo[0] += [new class { + function __destruct() { throw new Exception; } + }]); } catch (Exception $e) { print "caught Exception 7\n"; } try { - $foo = new class implements ArrayAccess { - public $foo = [0]; - function &offsetGet($x) { return $this->foo; } - function offsetSet($x, $y) {} - function offsetExists($x) { return true; } - function offsetUnset($x) {} - }; - var_dump($foo[0] += [new class { - function __destruct() { throw new Exception; } - }]); + $foo = new class implements ArrayAccess { + public $foo = [0]; + function &offsetGet($x) { return $this->foo; } + function offsetSet($x, $y) {} + function offsetExists($x) { return true; } + function offsetUnset($x) {} + }; + var_dump($foo[0] += [new class { + function __destruct() { throw new Exception; } + }]); } catch (Exception $e) { print "caught Exception 8\n"; } try { - var_dump((function() { return new class { - function __construct() { $this->foo = new stdClass; } - function __destruct() { throw new Exception; } - }; })()->foo++); + var_dump((function() { return new class { + function __construct() { $this->foo = new stdClass; } + function __destruct() { throw new Exception; } + }; })()->foo++); } catch (Exception $e) { print "caught Exception 9\n"; } try { - var_dump((function() { return new class { - function __get($x) { return new stdClass; } - function __set($x, $y) {} - function __destruct() { throw new Exception; } - }; })()->foo++); + var_dump((function() { return new class { + function __get($x) { return new stdClass; } + function __set($x, $y) {} + function __destruct() { throw new Exception; } + }; })()->foo++); } catch (Exception $e) { print "caught Exception 10\n"; } try { - var_dump((function() { return new class { - function __construct() { $this->bar = new stdClass; } - function &__get($x) { return $this->bar; } - function __destruct() { throw new Exception; } - }; })()->foo++); + var_dump((function() { return new class { + function __construct() { $this->bar = new stdClass; } + function &__get($x) { return $this->bar; } + function __destruct() { throw new Exception; } + }; })()->foo++); } catch (Exception $e) { print "caught Exception 11\n"; } try { - var_dump(++(function() { return new class { - function __construct() { $this->foo = new stdClass; } - function __destruct() { throw new Exception; } - }; })()->foo); + var_dump(++(function() { return new class { + function __construct() { $this->foo = new stdClass; } + function __destruct() { throw new Exception; } + }; })()->foo); } catch (Exception $e) { print "caught Exception 12\n"; } try { - var_dump(++(function() { return new class { - function __get($x) { return new stdClass; } - function __set($x, $y) {} - function __destruct() { throw new Exception; } - }; })()->foo); + var_dump(++(function() { return new class { + function __get($x) { return new stdClass; } + function __set($x, $y) {} + function __destruct() { throw new Exception; } + }; })()->foo); } catch (Exception $e) { print "caught Exception 13\n"; } try { - var_dump(++(function() { return new class { - function __construct() { $this->bar = new stdClass; } - function &__get($x) { return $this->bar; } - function __destruct() { throw new Exception; } - }; })()->foo); + var_dump(++(function() { return new class { + function __construct() { $this->bar = new stdClass; } + function &__get($x) { return $this->bar; } + function __destruct() { throw new Exception; } + }; })()->foo); } catch (Exception $e) { print "caught Exception 14\n"; } try { - var_dump((function() { return new class implements ArrayAccess { - function offsetGet($x) { return [new stdClass]; } - function offsetSet($x, $y) {} - function offsetExists($x) { return true; } - function offsetUnset($x) {} - function __destruct() { throw new Exception; } - }; })()[0]++); + var_dump((function() { return new class implements ArrayAccess { + function offsetGet($x) { return [new stdClass]; } + function offsetSet($x, $y) {} + function offsetExists($x) { return true; } + function offsetUnset($x) {} + function __destruct() { throw new Exception; } + }; })()[0]++); } catch (Exception $e) { print "caught Exception 15\n"; } try { - var_dump(++(function() { return new class implements ArrayAccess { - function offsetGet($x) { return [new stdClass]; } - function offsetSet($x, $y) {} - function offsetExists($x) { return true; } - function offsetUnset($x) {} - function __destruct() { throw new Exception; } - }; })()[0]); + var_dump(++(function() { return new class implements ArrayAccess { + function offsetGet($x) { return [new stdClass]; } + function offsetSet($x, $y) {} + function offsetExists($x) { return true; } + function offsetUnset($x) {} + function __destruct() { throw new Exception; } + }; })()[0]); } catch (Exception $e) { print "caught Exception 16\n"; } try { - var_dump((new class { - function __construct() { $this->foo = new stdClass; } - function __destruct() { throw new Exception; } - })->foo); + var_dump((new class { + function __construct() { $this->foo = new stdClass; } + function __destruct() { throw new Exception; } + })->foo); } catch (Exception $e) { print "caught Exception 17\n"; } try { - var_dump((new class { - function __get($x) { return new stdClass; } - function __set($x, $y) {} - function __destruct() { throw new Exception; } - })->foo); + var_dump((new class { + function __get($x) { return new stdClass; } + function __set($x, $y) {} + function __destruct() { throw new Exception; } + })->foo); } catch (Exception $e) { print "caught Exception 18\n"; } try { - var_dump((new class implements ArrayAccess { - function offsetGet($x) { return [new stdClass]; } - function offsetSet($x, $y) {} - function offsetExists($x) { return true; } - function offsetUnset($x) {} - function __destruct() { throw new Exception; } - })[0]); + var_dump((new class implements ArrayAccess { + function offsetGet($x) { return [new stdClass]; } + function offsetSet($x, $y) {} + function offsetExists($x) { return true; } + function offsetUnset($x) {} + function __destruct() { throw new Exception; } + })[0]); } catch (Exception $e) { print "caught Exception 19\n"; } try { - var_dump(isset((new class { - function __construct() { $this->foo = new stdClass; } - function __destruct() { throw new Exception; } - })->foo->bar)); + var_dump(isset((new class { + function __construct() { $this->foo = new stdClass; } + function __destruct() { throw new Exception; } + })->foo->bar)); } catch (Exception $e) { print "caught Exception 20\n"; } try { - var_dump(isset((new class { - function __get($x) { return new stdClass; } - function __set($x, $y) {} - function __destruct() { throw new Exception; } - })->foo->bar)); + var_dump(isset((new class { + function __get($x) { return new stdClass; } + function __set($x, $y) {} + function __destruct() { throw new Exception; } + })->foo->bar)); } catch (Exception $e) { print "caught Exception 21\n"; } try { - var_dump(isset((new class implements ArrayAccess { - function offsetGet($x) { return [new stdClass]; } - function offsetSet($x, $y) {} - function offsetExists($x) { return true; } - function offsetUnset($x) {} - function __destruct() { throw new Exception; } - })[0]->bar)); + var_dump(isset((new class implements ArrayAccess { + function offsetGet($x) { return [new stdClass]; } + function offsetSet($x, $y) {} + function offsetExists($x) { return true; } + function offsetUnset($x) {} + function __destruct() { throw new Exception; } + })[0]->bar)); } catch (Exception $e) { print "caught Exception 22\n"; } try { - $foo = new class { - function __destruct() { throw new Exception; } - }; - var_dump($foo = new stdClass); + $foo = new class { + function __destruct() { throw new Exception; } + }; + var_dump($foo = new stdClass); } catch (Exception $e) { print "caught Exception 23\n"; } try { - $foo = [new class { - function __destruct() { throw new Exception; } - }]; - var_dump($foo[0] = new stdClass); + $foo = [new class { + function __destruct() { throw new Exception; } + }]; + var_dump($foo[0] = new stdClass); } catch (Exception $e) { print "caught Exception 24\n"; } try { - $foo = (object) ["foo" => new class { - function __destruct() { throw new Exception; } - }]; - var_dump($foo->foo = new stdClass); + $foo = (object) ["foo" => new class { + function __destruct() { throw new Exception; } + }]; + var_dump($foo->foo = new stdClass); } catch (Exception $e) { print "caught Exception 25\n"; } try { - $foo = new class { - function __get($x) {} - function __set($x, $y) { throw new Exception; } - }; - var_dump($foo->foo = new stdClass); + $foo = new class { + function __get($x) {} + function __set($x, $y) { throw new Exception; } + }; + var_dump($foo->foo = new stdClass); } catch (Exception $e) { print "caught Exception 26\n"; } try { - $foo = new class implements ArrayAccess { - function offsetGet($x) {} - function offsetSet($x, $y) { throw new Exception; } - function offsetExists($x) { return true; } - function offsetUnset($x) {} - }; - var_dump($foo[0] = new stdClass); + $foo = new class implements ArrayAccess { + function offsetGet($x) {} + function offsetSet($x, $y) { throw new Exception; } + function offsetExists($x) { return true; } + function offsetUnset($x) {} + }; + var_dump($foo[0] = new stdClass); } catch (Exception $e) { print "caught Exception 27\n"; } try { - $foo = new class { - function __destruct() { throw new Exception; } - }; - $bar = new stdClass; - var_dump($foo = &$bar); + $foo = new class { + function __destruct() { throw new Exception; } + }; + $bar = new stdClass; + var_dump($foo = &$bar); } catch (Exception $e) { print "caught Exception 28\n"; } try { - $f = function() { - return new class { - function __toString() { return "a"; } - function __destruct() { throw new Exception; } - }; - }; - var_dump("{$f()}foo"); + $f = function() { + return new class { + function __toString() { return "a"; } + function __destruct() { throw new Exception; } + }; + }; + var_dump("{$f()}foo"); } catch (Exception $e) { print "caught Exception 29\n"; } try { - $f = function() { - return new class { - function __toString() { return "a"; } - function __destruct() { throw new Exception; } - }; - }; - var_dump("bar{$f()}foo"); + $f = function() { + return new class { + function __toString() { return "a"; } + function __destruct() { throw new Exception; } + }; + }; + var_dump("bar{$f()}foo"); } catch (Exception $e) { print "caught Exception 30\n"; } try { - var_dump((string) new class { - function __toString() { $x = "Z"; return ++$x; } - function __destruct() { throw new Exception; } - }); + var_dump((string) new class { + function __toString() { $x = "Z"; return ++$x; } + function __destruct() { throw new Exception; } + }); } catch (Exception $e) { print "caught Exception 31\n"; } try { - var_dump(clone (new class { - function __clone() { throw new Exception; } - })); + var_dump(clone (new class { + function __clone() { throw new Exception; } + })); } catch (Exception $e) { print "caught Exception 32\n"; } ?> diff --git a/Zend/tests/temporary_cleaning_014.phpt b/Zend/tests/temporary_cleaning_014.phpt index 39effae18a..4ced112094 100644 --- a/Zend/tests/temporary_cleaning_014.phpt +++ b/Zend/tests/temporary_cleaning_014.phpt @@ -6,7 +6,7 @@ Leak in JMP_SET <?php set_error_handler(function() { throw new Exception; }); try { - new GMP ?: null; + new GMP ?: null; } catch (Exception $e) { } ?> diff --git a/Zend/tests/temporary_cleaning_015.phpt b/Zend/tests/temporary_cleaning_015.phpt index 7690abba76..f5e115faa9 100644 --- a/Zend/tests/temporary_cleaning_015.phpt +++ b/Zend/tests/temporary_cleaning_015.phpt @@ -3,12 +3,12 @@ Attempt to free invalid structure (result of ROPE_INIT is not a zval) --FILE-- <?php set_error_handler(function () { - throw new Exception(); + throw new Exception(); }); $a = []; $b = ""; try { - echo "$a$b\n"; + echo "$a$b\n"; } catch (Exception $ex) { } ?> diff --git a/Zend/tests/this_as_global.phpt b/Zend/tests/this_as_global.phpt index 0ba9ade1b9..7901dad7d7 100644 --- a/Zend/tests/this_as_global.phpt +++ b/Zend/tests/this_as_global.phpt @@ -3,8 +3,8 @@ $this as global variable --FILE-- <?php function foo() { - global $this; - var_dump($this); + global $this; + var_dump($this); } foo(); ?> diff --git a/Zend/tests/this_as_parameter.phpt b/Zend/tests/this_as_parameter.phpt index 93101969a7..a2f13f07e8 100644 --- a/Zend/tests/this_as_parameter.phpt +++ b/Zend/tests/this_as_parameter.phpt @@ -3,7 +3,7 @@ $this as parameter --FILE-- <?php function foo($this) { - var_dump($this); + var_dump($this); } foo(5); ?> diff --git a/Zend/tests/this_as_static.phpt b/Zend/tests/this_as_static.phpt index f094449c12..d990ab5ba1 100644 --- a/Zend/tests/this_as_static.phpt +++ b/Zend/tests/this_as_static.phpt @@ -3,8 +3,8 @@ $this as static variable --FILE-- <?php function foo() { - static $this; - var_dump($this); + static $this; + var_dump($this); } foo(); ?> diff --git a/Zend/tests/this_in_catch.phpt b/Zend/tests/this_in_catch.phpt index d621bb18ea..d167e047a0 100644 --- a/Zend/tests/this_in_catch.phpt +++ b/Zend/tests/this_in_catch.phpt @@ -3,13 +3,13 @@ $this in catch --FILE-- <?php class C { - function foo() { - try { - throw new Exception(); - } catch (Exception $this) { - } - var_dump($this); - } + function foo() { + try { + throw new Exception(); + } catch (Exception $this) { + } + var_dump($this); + } } $obj = new C; $obj->foo(); diff --git a/Zend/tests/this_in_eval.phpt b/Zend/tests/this_in_eval.phpt index 8da70b76a3..a499d8ac76 100644 --- a/Zend/tests/this_in_eval.phpt +++ b/Zend/tests/this_in_eval.phpt @@ -3,10 +3,10 @@ $this in eval() block --FILE-- <?php class C { - function foo() { - eval('var_dump($this);'); - eval('var_dump($this);'); - } + function foo() { + eval('var_dump($this);'); + eval('var_dump($this);'); + } } $x = new C; $x->foo(); diff --git a/Zend/tests/this_in_foreach_001.phpt b/Zend/tests/this_in_foreach_001.phpt index a724338b90..b8a1c07004 100644 --- a/Zend/tests/this_in_foreach_001.phpt +++ b/Zend/tests/this_in_foreach_001.phpt @@ -4,7 +4,7 @@ $this in foreach <?php $a = [1]; foreach ($a as $this) { - var_dump($this); + var_dump($this); } ?> --EXPECTF-- diff --git a/Zend/tests/this_in_foreach_002.phpt b/Zend/tests/this_in_foreach_002.phpt index 511ea36a24..3b287d675f 100644 --- a/Zend/tests/this_in_foreach_002.phpt +++ b/Zend/tests/this_in_foreach_002.phpt @@ -4,7 +4,7 @@ $this in foreach <?php $a = [1]; foreach ($a as $this => $dummy) { - var_dump($this); + var_dump($this); } ?> --EXPECTF-- diff --git a/Zend/tests/this_in_foreach_003.phpt b/Zend/tests/this_in_foreach_003.phpt index 5f5b5ae0d8..f815ed6f88 100644 --- a/Zend/tests/this_in_foreach_003.phpt +++ b/Zend/tests/this_in_foreach_003.phpt @@ -4,7 +4,7 @@ $this in foreach <?php $a = [1]; foreach ($a as &$this) { - var_dump($this); + var_dump($this); } ?> --EXPECTF-- diff --git a/Zend/tests/this_in_foreach_004.phpt b/Zend/tests/this_in_foreach_004.phpt index 13bfbf18b4..33a8b87f1a 100644 --- a/Zend/tests/this_in_foreach_004.phpt +++ b/Zend/tests/this_in_foreach_004.phpt @@ -4,7 +4,7 @@ $this in foreach <?php $a = [[1]]; foreach ($a as list($this)) { - var_dump($this); + var_dump($this); } ?> --EXPECTF-- diff --git a/Zend/tests/this_in_isset.phpt b/Zend/tests/this_in_isset.phpt index 2ae335df93..6f3b8310e2 100644 --- a/Zend/tests/this_in_isset.phpt +++ b/Zend/tests/this_in_isset.phpt @@ -4,29 +4,29 @@ $this in isset <?php var_dump(isset($this)); try { - var_dump(isset($this->foo)); + var_dump(isset($this->foo)); } catch (Throwable $e) { - echo "exception\n"; + echo "exception\n"; } try { - var_dump(isset($this->foo->bar)); + var_dump(isset($this->foo->bar)); } catch (Throwable $e) { - echo "exception\n"; + echo "exception\n"; } try { - var_dump(isset($this[0])); + var_dump(isset($this[0])); } catch (Throwable $e) { - echo "exception\n"; + echo "exception\n"; } class A extends ArrayObject { - public $foo = 5; - function foo() { - $this[0] = 5; - var_dump(isset($this)); - var_dump(isset($this->foo)); - var_dump(isset($this[0])); - } + public $foo = 5; + function foo() { + $this[0] = 5; + var_dump(isset($this)); + var_dump(isset($this->foo)); + var_dump(isset($this[0])); + } } $a = new A(); $a->foo(); diff --git a/Zend/tests/this_reassign.phpt b/Zend/tests/this_reassign.phpt index d965ef4701..5a9109fd8c 100644 --- a/Zend/tests/this_reassign.phpt +++ b/Zend/tests/this_reassign.phpt @@ -3,9 +3,9 @@ $this re-assign --FILE-- <?php function foo() { - $a = "this"; - $$a = 0; - var_dump($$a); + $a = "this"; + $$a = 0; + var_dump($$a); } foo(); ?> diff --git a/Zend/tests/traits/bug55214.phpt b/Zend/tests/traits/bug55214.phpt index b27ae02428..35ef7a2087 100644 --- a/Zend/tests/traits/bug55214.phpt +++ b/Zend/tests/traits/bug55214.phpt @@ -25,7 +25,7 @@ trait ATrait { } trait Indirect { - use ATrait; + use ATrait; } class SomeClass { @@ -33,7 +33,7 @@ class SomeClass { } class UsingIndirect { - use Indirect; + use Indirect; } $r = SomeClass::get_class_name(); diff --git a/Zend/tests/traits/bug55355.phpt b/Zend/tests/traits/bug55355.phpt index 22350a281f..6aae316eff 100644 --- a/Zend/tests/traits/bug55355.phpt +++ b/Zend/tests/traits/bug55355.phpt @@ -5,16 +5,16 @@ Bug #55355 (Abstract functions required by a trait are not correctly found when // A trait that has a abstract function trait ATrait { - function bar() { - $this->foo(); - } - abstract function foo(); + function bar() { + $this->foo(); + } + abstract function foo(); } // A class on the second level in the // inheritance chain class Level2Impl { - function foo() {} + function foo() {} } class Level1Indirect extends Level2Impl {} diff --git a/Zend/tests/traits/bug55372.phpt b/Zend/tests/traits/bug55372.phpt index e215d968ab..509b672bf2 100644 --- a/Zend/tests/traits/bug55372.phpt +++ b/Zend/tests/traits/bug55372.phpt @@ -4,20 +4,20 @@ Bug #55372 (Literal handling in methods is inconsistent, causing memory corrupti <?php trait testTrait { - public function testMethod() { - if (1) { - $letters1 = range('a', 'z', 1); - $letters2 = range('A', 'Z', 1); - $letters1 = 'foo'; - $letters2 = 'baarr'; - var_dump($letters1); - var_dump($letters2); - } - } + public function testMethod() { + if (1) { + $letters1 = range('a', 'z', 1); + $letters2 = range('A', 'Z', 1); + $letters1 = 'foo'; + $letters2 = 'baarr'; + var_dump($letters1); + var_dump($letters2); + } + } } class foo { - use testTrait; + use testTrait; } $x = new foo; diff --git a/Zend/tests/traits/bug55424.phpt b/Zend/tests/traits/bug55424.phpt index b1fdc8c353..5788056096 100644 --- a/Zend/tests/traits/bug55424.phpt +++ b/Zend/tests/traits/bug55424.phpt @@ -3,33 +3,33 @@ Bug #55424 (Method got missing from class when a trait defined an abstract metho --FILE-- <?php - trait ATrait - { - function setRequired() - { - $this->setAttribute(); - } + trait ATrait + { + function setRequired() + { + $this->setAttribute(); + } - abstract function setAttribute(); - } + abstract function setAttribute(); + } - class Base - { - function setAttribute() { } - } + class Base + { + function setAttribute() { } + } - class MyClass extends Base - { - use ATrait; - } + class MyClass extends Base + { + use ATrait; + } - $i = new Base(); - $i->setAttribute(); + $i = new Base(); + $i->setAttribute(); - $t = new MyClass(); - /* setAttribute used to disappear for no good reason. */ - $t->setRequired(); - echo 'DONE'; + $t = new MyClass(); + /* setAttribute used to disappear for no good reason. */ + $t->setRequired(); + echo 'DONE'; ?> --EXPECT-- DONE diff --git a/Zend/tests/traits/bug60145.phpt b/Zend/tests/traits/bug60145.phpt index fcd0cfa5f2..fa1dc9bf95 100644 --- a/Zend/tests/traits/bug60145.phpt +++ b/Zend/tests/traits/bug60145.phpt @@ -8,9 +8,9 @@ trait foo { } interface MyInterface { - use foo; + use foo; - public function b(); + public function b(); } --EXPECTF-- diff --git a/Zend/tests/traits/bug60717.phpt b/Zend/tests/traits/bug60717.phpt index d38b1c0c24..0f5cadb066 100644 --- a/Zend/tests/traits/bug60717.phpt +++ b/Zend/tests/traits/bug60717.phpt @@ -5,62 +5,62 @@ Bug #60717 (Order of traits in use statement can cause unexpected unresolved abs namespace HTML { - interface Helper - { - function text($text); - function attributes(array $attributes = null); - function textArea(array $attributes = null, $value); - } + interface Helper + { + function text($text); + function attributes(array $attributes = null); + function textArea(array $attributes = null, $value); + } - trait TextUTF8 - { - function text($text) {} - } + trait TextUTF8 + { + function text($text) {} + } - trait TextArea - { - function textArea(array $attributes = null, $value) {} - abstract function attributes(array $attributes = null); - abstract function text($text); - } + trait TextArea + { + function textArea(array $attributes = null, $value) {} + abstract function attributes(array $attributes = null); + abstract function text($text); + } - trait HTMLAttributes - { - function attributes(array $attributes = null) { } - abstract function text($text); - } + trait HTMLAttributes + { + function attributes(array $attributes = null) { } + abstract function text($text); + } - class HTMLHelper implements Helper - { - use TextArea, HTMLAttributes, TextUTF8; - } + class HTMLHelper implements Helper + { + use TextArea, HTMLAttributes, TextUTF8; + } - class HTMLHelper2 implements Helper - { - use TextArea, TextUTF8, HTMLAttributes; - } + class HTMLHelper2 implements Helper + { + use TextArea, TextUTF8, HTMLAttributes; + } - class HTMLHelper3 implements Helper - { - use HTMLAttributes, TextArea, TextUTF8; - } + class HTMLHelper3 implements Helper + { + use HTMLAttributes, TextArea, TextUTF8; + } - class HTMLHelper4 implements Helper - { - use HTMLAttributes, TextUTF8, TextArea; - } + class HTMLHelper4 implements Helper + { + use HTMLAttributes, TextUTF8, TextArea; + } - class HTMLHelper5 implements Helper - { - use TextUTF8, TextArea, HTMLAttributes; - } + class HTMLHelper5 implements Helper + { + use TextUTF8, TextArea, HTMLAttributes; + } - class HTMLHelper6 implements Helper - { - use TextUTF8, HTMLAttributes, TextArea; - } + class HTMLHelper6 implements Helper + { + use TextUTF8, HTMLAttributes, TextArea; + } - $o = new HTMLHelper; + $o = new HTMLHelper; $o = new HTMLHelper2; $o = new HTMLHelper3; $o = new HTMLHelper4; diff --git a/Zend/tests/traits/bug60809.phpt b/Zend/tests/traits/bug60809.phpt index 78e7898461..f1a21b1238 100644 --- a/Zend/tests/traits/bug60809.phpt +++ b/Zend/tests/traits/bug60809.phpt @@ -3,28 +3,28 @@ Bug #60809 (TRAITS - PHPDoc Comment Style Bug) --FILE-- <?php class ExampleParent { - private $hello_world = "hello foo\n"; - public function foo() { - echo $this->hello_world; - } + private $hello_world = "hello foo\n"; + public function foo() { + echo $this->hello_world; + } } class Example extends ExampleParent { - use ExampleTrait; + use ExampleTrait; } trait ExampleTrait { - /** - * - */ - private $hello_world = "hello bar\n"; - /** - * - */ - public $prop = "ops"; - public function bar() { - echo $this->hello_world; - } + /** + * + */ + private $hello_world = "hello bar\n"; + /** + * + */ + public $prop = "ops"; + public function bar() { + echo $this->hello_world; + } } $x = new Example(); diff --git a/Zend/tests/traits/bug75607.phpt b/Zend/tests/traits/bug75607.phpt index e466e6333b..032b7c3d78 100644 --- a/Zend/tests/traits/bug75607.phpt +++ b/Zend/tests/traits/bug75607.phpt @@ -5,17 +5,17 @@ Bug #75607 (Comparison of initial static properties failing) trait T1 { - public static $prop1 = 1; + public static $prop1 = 1; } class Base { - public static $prop1 = 1; + public static $prop1 = 1; } class Child extends base { - use T1; + use T1; } echo "DONE"; diff --git a/Zend/tests/traits/bug75607a.phpt b/Zend/tests/traits/bug75607a.phpt index 12b555f728..fb2ecd410f 100644 --- a/Zend/tests/traits/bug75607a.phpt +++ b/Zend/tests/traits/bug75607a.phpt @@ -5,17 +5,17 @@ Bug #75607 (Comparison of initial static properties failing) trait T1 { - public static $prop1 = 1; + public static $prop1 = 1; } trait T2 { - public static $prop1 = 1; + public static $prop1 = 1; } class Base { - use T1; + use T1; } class Child extends base @@ -25,7 +25,7 @@ class Child extends base class Grand extends Child { - use T2; + use T2; } $c = new Grand(); diff --git a/Zend/tests/traits/bug76539.phpt b/Zend/tests/traits/bug76539.phpt index 51a75cdaf6..0a6d893032 100644 --- a/Zend/tests/traits/bug76539.phpt +++ b/Zend/tests/traits/bug76539.phpt @@ -3,19 +3,19 @@ Bug #76539 (Trait attribute is set incorrectly when using self::class with anoth --FILE-- <?php trait MyTrait { - protected $attr = self::class . 'Test'; + protected $attr = self::class . 'Test'; - public function test() { - echo $this->attr, PHP_EOL; - } + public function test() { + echo $this->attr, PHP_EOL; + } } class A { - use MyTrait; + use MyTrait; } class B { - use MyTrait; + use MyTrait; } (new A())->test(); diff --git a/Zend/tests/traits/bugs/abstract-methods01.phpt b/Zend/tests/traits/bugs/abstract-methods01.phpt index 23cdef3a89..721f965759 100644 --- a/Zend/tests/traits/bugs/abstract-methods01.phpt +++ b/Zend/tests/traits/bugs/abstract-methods01.phpt @@ -9,7 +9,7 @@ trait THello { } class TraitsTest { - use THello; + use THello; } $test = new TraitsTest(); diff --git a/Zend/tests/traits/bugs/abstract-methods02.phpt b/Zend/tests/traits/bugs/abstract-methods02.phpt index 73bb65d179..3bf263f5fa 100644 --- a/Zend/tests/traits/bugs/abstract-methods02.phpt +++ b/Zend/tests/traits/bugs/abstract-methods02.phpt @@ -15,8 +15,8 @@ trait THelloImpl { } class TraitsTest { - use THello; - use THelloImpl; + use THello; + use THelloImpl; } $test = new TraitsTest(); diff --git a/Zend/tests/traits/bugs/abstract-methods04.phpt b/Zend/tests/traits/bugs/abstract-methods04.phpt index d15bdd9473..0ae3137657 100644 --- a/Zend/tests/traits/bugs/abstract-methods04.phpt +++ b/Zend/tests/traits/bugs/abstract-methods04.phpt @@ -11,21 +11,21 @@ trait THello { trait THelloImpl { public function hello() { - echo 'Hello'; + echo 'Hello'; } } class TraitsTest1 { - use THello; - use THelloImpl; + use THello; + use THelloImpl; } $test = new TraitsTest1(); $test->hello(); class TraitsTest2 { - use THelloImpl; - use THello; + use THelloImpl; + use THello; } $test = new TraitsTest2(); diff --git a/Zend/tests/traits/bugs/abstract-methods05.phpt b/Zend/tests/traits/bugs/abstract-methods05.phpt index b40cbe30a6..96619eae91 100644 --- a/Zend/tests/traits/bugs/abstract-methods05.phpt +++ b/Zend/tests/traits/bugs/abstract-methods05.phpt @@ -6,7 +6,7 @@ error_reporting(E_ALL); trait THelloB { public function hello() { - echo 'Hello'; + echo 'Hello'; } } @@ -15,8 +15,8 @@ trait THelloA { } class TraitsTest1 { - use THelloB; - use THelloA; + use THelloB; + use THelloA; } diff --git a/Zend/tests/traits/bugs/abstract-methods06.phpt b/Zend/tests/traits/bugs/abstract-methods06.phpt index d8d4994f66..8e2f25b048 100644 --- a/Zend/tests/traits/bugs/abstract-methods06.phpt +++ b/Zend/tests/traits/bugs/abstract-methods06.phpt @@ -15,8 +15,8 @@ trait THelloA { } class TraitsTest1 { - use THelloA; - use THelloB; + use THelloA; + use THelloB; } diff --git a/Zend/tests/traits/bugs/alias-semantics.phpt b/Zend/tests/traits/bugs/alias-semantics.phpt index eec2de1aff..d856d166bd 100644 --- a/Zend/tests/traits/bugs/alias-semantics.phpt +++ b/Zend/tests/traits/bugs/alias-semantics.phpt @@ -11,7 +11,7 @@ trait THello { } class TraitsTest { - use THello { a as b; } + use THello { a as b; } } $test = new TraitsTest(); diff --git a/Zend/tests/traits/bugs/alias-semantics02.phpt b/Zend/tests/traits/bugs/alias-semantics02.phpt index 6449182880..4ff6f168f0 100644 --- a/Zend/tests/traits/bugs/alias-semantics02.phpt +++ b/Zend/tests/traits/bugs/alias-semantics02.phpt @@ -13,7 +13,7 @@ trait THello { } class TraitsTest { - use THello { THello::a as b; } + use THello { THello::a as b; } } $test = new TraitsTest(); diff --git a/Zend/tests/traits/bugs/case-sensitive.phpt b/Zend/tests/traits/bugs/case-sensitive.phpt index 6a65ccff03..080b6b7cce 100644 --- a/Zend/tests/traits/bugs/case-sensitive.phpt +++ b/Zend/tests/traits/bugs/case-sensitive.phpt @@ -5,18 +5,18 @@ Check for problems with case sensitivity in compositions error_reporting(E_ALL); trait A { - public function M1() {} - public function M2() {} + public function M1() {} + public function M2() {} } trait B { - public function M1() {} - public function M2() {} + public function M1() {} + public function M2() {} } class MyClass { - use A; - use B; + use A; + use B; } ?> --EXPECTF-- diff --git a/Zend/tests/traits/bugs/interfaces.phpt b/Zend/tests/traits/bugs/interfaces.phpt index 97ec174a7f..e68e54f3de 100644 --- a/Zend/tests/traits/bugs/interfaces.phpt +++ b/Zend/tests/traits/bugs/interfaces.phpt @@ -5,7 +5,7 @@ Make sure trait does not implement an interface. error_reporting(E_ALL); interface MyInterface { - public function a(); + public function a(); } trait THello implements MyInterface { diff --git a/Zend/tests/traits/conflict001.phpt b/Zend/tests/traits/conflict001.phpt index 11dababdb5..c288df7351 100644 --- a/Zend/tests/traits/conflict001.phpt +++ b/Zend/tests/traits/conflict001.phpt @@ -17,8 +17,8 @@ trait THello2 { } class TraitsTest { - use THello1; - use THello2; + use THello1; + use THello2; } ?> --EXPECTF-- diff --git a/Zend/tests/traits/error_001.phpt b/Zend/tests/traits/error_001.phpt index be4295a6d8..31f2ab15c0 100644 --- a/Zend/tests/traits/error_001.phpt +++ b/Zend/tests/traits/error_001.phpt @@ -4,23 +4,23 @@ Trying to use instanceof for a method twice <?php trait foo { - public function foo() { - return 1; - } + public function foo() { + return 1; + } } trait foo2 { - public function foo() { - return 2; - } + public function foo() { + return 2; + } } class A extends foo { - use foo { - foo2::foo insteadof foo; - foo2::foo insteadof foo; - } + use foo { + foo2::foo insteadof foo; + foo2::foo insteadof foo; + } } ?> diff --git a/Zend/tests/traits/error_002.phpt b/Zend/tests/traits/error_002.phpt index ac98769f47..0c2f19d2df 100644 --- a/Zend/tests/traits/error_002.phpt +++ b/Zend/tests/traits/error_002.phpt @@ -4,7 +4,7 @@ Trying to use an undefined trait <?php class A { - use abc; + use abc; } ?> diff --git a/Zend/tests/traits/error_003.phpt b/Zend/tests/traits/error_003.phpt index 23f62d2977..fdfa0ac1fe 100644 --- a/Zend/tests/traits/error_003.phpt +++ b/Zend/tests/traits/error_003.phpt @@ -7,7 +7,7 @@ interface abc { } class A { - use abc; + use abc; } ?> diff --git a/Zend/tests/traits/error_004.phpt b/Zend/tests/traits/error_004.phpt index 5bfcc263cc..d7ff695e04 100644 --- a/Zend/tests/traits/error_004.phpt +++ b/Zend/tests/traits/error_004.phpt @@ -7,7 +7,7 @@ class abc { } class A { - use abc; + use abc; } ?> diff --git a/Zend/tests/traits/error_005.phpt b/Zend/tests/traits/error_005.phpt index 99952f70e6..3b8cc32f97 100644 --- a/Zend/tests/traits/error_005.phpt +++ b/Zend/tests/traits/error_005.phpt @@ -7,7 +7,7 @@ final class abc { } class A { - use abc; + use abc; } ?> diff --git a/Zend/tests/traits/error_006.phpt b/Zend/tests/traits/error_006.phpt index 54083a310f..f3ed87123c 100644 --- a/Zend/tests/traits/error_006.phpt +++ b/Zend/tests/traits/error_006.phpt @@ -7,7 +7,7 @@ abstract class abc { } class A { - use abc; + use abc; } ?> diff --git a/Zend/tests/traits/error_010.phpt b/Zend/tests/traits/error_010.phpt index de3741ea57..f286cba572 100644 --- a/Zend/tests/traits/error_010.phpt +++ b/Zend/tests/traits/error_010.phpt @@ -4,15 +4,15 @@ Trying to exclude trait method multiple times <?php trait foo { - public function test() { return 3; } + public function test() { return 3; } } trait c { - public function test() { return 2; } + public function test() { return 2; } } class bar { - use foo, c { c::test insteadof foo; } - use foo, c { c::test insteadof foo; } + use foo, c { c::test insteadof foo; } + use foo, c { c::test insteadof foo; } } $x = new bar; diff --git a/Zend/tests/traits/error_011.phpt b/Zend/tests/traits/error_011.phpt index 2d266dd1ec..5042a4be1c 100644 --- a/Zend/tests/traits/error_011.phpt +++ b/Zend/tests/traits/error_011.phpt @@ -4,18 +4,18 @@ Testing trait collisions <?php trait foo { - public function test() { return 3; } + public function test() { return 3; } } trait c { - public function test() { return 2; } + public function test() { return 2; } } trait b { - public function test() { return 1; } + public function test() { return 1; } } class bar { - use foo, c, b; + use foo, c, b; } $x = new bar; diff --git a/Zend/tests/traits/error_012.phpt b/Zend/tests/traits/error_012.phpt index 50a454c324..999fed6c8e 100644 --- a/Zend/tests/traits/error_012.phpt +++ b/Zend/tests/traits/error_012.phpt @@ -4,11 +4,11 @@ Trying to access a protected trait method <?php trait foo { - public function test() { return 3; } + public function test() { return 3; } } class bar { - use foo { test as protected; } + use foo { test as protected; } } $x = new bar; diff --git a/Zend/tests/traits/error_013.phpt b/Zend/tests/traits/error_013.phpt index d9fda2d005..1fbf607bb7 100644 --- a/Zend/tests/traits/error_013.phpt +++ b/Zend/tests/traits/error_013.phpt @@ -4,11 +4,11 @@ Trying to use static as method modifier <?php trait foo { - public function test() { return 3; } + public function test() { return 3; } } class bar { - use foo { test as static; } + use foo { test as static; } } $x = new bar; diff --git a/Zend/tests/traits/error_014.phpt b/Zend/tests/traits/error_014.phpt index be1c91977c..3a00124836 100644 --- a/Zend/tests/traits/error_014.phpt +++ b/Zend/tests/traits/error_014.phpt @@ -4,15 +4,15 @@ Trying to override final method <?php trait foo { - public function test() { return 3; } + public function test() { return 3; } } class baz { - final public function test() { return 4; } + final public function test() { return 4; } } class bar extends baz { - use foo { test as public; } + use foo { test as public; } } $x = new bar; diff --git a/Zend/tests/traits/error_015.phpt b/Zend/tests/traits/error_015.phpt index efcffea5f3..e494eb680e 100644 --- a/Zend/tests/traits/error_015.phpt +++ b/Zend/tests/traits/error_015.phpt @@ -5,17 +5,17 @@ Should warn about the conflict. <?php trait foo { - public function test() { return 3; } + public function test() { return 3; } } trait baz { - public function test() { return 4; } + public function test() { return 4; } } class bar { - use foo, baz { - baz::test as zzz; - } + use foo, baz { + baz::test as zzz; + } } $x = new bar; diff --git a/Zend/tests/traits/error_016.phpt b/Zend/tests/traits/error_016.phpt index 65a3a83485..191225ddee 100644 --- a/Zend/tests/traits/error_016.phpt +++ b/Zend/tests/traits/error_016.phpt @@ -4,7 +4,7 @@ Trying to create a constant on Trait <?php trait foo { - const a = 1; + const a = 1; } ?> diff --git a/Zend/tests/traits/get_declared_traits_002.phpt b/Zend/tests/traits/get_declared_traits_002.phpt index 73dd73c927..76e5294536 100644 --- a/Zend/tests/traits/get_declared_traits_002.phpt +++ b/Zend/tests/traits/get_declared_traits_002.phpt @@ -4,12 +4,12 @@ Testing get_declared_traits() inside namespace <?php namespace test { - class a { } - interface b { } - trait c { } - abstract class d { } - final class e { } - var_dump(get_declared_traits()); + class a { } + interface b { } + trait c { } + abstract class d { } + final class e { } + var_dump(get_declared_traits()); } ?> diff --git a/Zend/tests/traits/interface_001.phpt b/Zend/tests/traits/interface_001.phpt index a14f78efc8..46ebf73b57 100644 --- a/Zend/tests/traits/interface_001.phpt +++ b/Zend/tests/traits/interface_001.phpt @@ -4,16 +4,16 @@ Using traits to implement interface <?php trait foo { - public function abc() { - } + public function abc() { + } } interface baz { - public function abc(); + public function abc(); } class bar implements baz { - use foo; + use foo; } diff --git a/Zend/tests/traits/interface_002.phpt b/Zend/tests/traits/interface_002.phpt index 462d73fbd6..bc56a6d68b 100644 --- a/Zend/tests/traits/interface_002.phpt +++ b/Zend/tests/traits/interface_002.phpt @@ -4,16 +4,16 @@ Checking error message when the trait doesn't implements the interface <?php trait foo { - public function a() { - } + public function a() { + } } interface baz { - public function abc(); + public function abc(); } class bar implements baz { - use foo; + use foo; } diff --git a/Zend/tests/traits/interface_003.phpt b/Zend/tests/traits/interface_003.phpt index aa13bd8b59..a1463113eb 100644 --- a/Zend/tests/traits/interface_003.phpt +++ b/Zend/tests/traits/interface_003.phpt @@ -4,16 +4,16 @@ Testing to implement Serializable interface by traits <?php trait foo { - public function serialize() { - return 'foobar'; - } - public function unserialize($x) { - var_dump($x); - } + public function serialize() { + return 'foobar'; + } + public function unserialize($x) { + var_dump($x); + } } class bar implements Serializable { - use foo; + use foo; } var_dump($o = serialize(new bar)); diff --git a/Zend/tests/traits/language001.phpt b/Zend/tests/traits/language001.phpt index fd9ec2ddc2..efba03458a 100644 --- a/Zend/tests/traits/language001.phpt +++ b/Zend/tests/traits/language001.phpt @@ -11,7 +11,7 @@ trait THello { } class TraitsTest { - use THello; + use THello; } $test = new TraitsTest(); diff --git a/Zend/tests/traits/language004.phpt b/Zend/tests/traits/language004.phpt index 76959d011d..167738b844 100644 --- a/Zend/tests/traits/language004.phpt +++ b/Zend/tests/traits/language004.phpt @@ -19,7 +19,7 @@ trait World { class MyHelloWorld { use Hello, World { Hello::saySomething insteadof World; - World::saySomething as sayWorld; + World::saySomething as sayWorld; } } diff --git a/Zend/tests/traits/language005.phpt b/Zend/tests/traits/language005.phpt index 762c1e4ac5..9b5aa2b551 100644 --- a/Zend/tests/traits/language005.phpt +++ b/Zend/tests/traits/language005.phpt @@ -24,10 +24,10 @@ trait B { class Talker { use A, B { - B::smallTalk insteadof A; - A::bigTalk insteadof B; - B::bigTalk as talk; - } + B::smallTalk insteadof A; + A::bigTalk insteadof B; + B::bigTalk as talk; + } } $t = new Talker; diff --git a/Zend/tests/traits/language007.phpt b/Zend/tests/traits/language007.phpt index 67cb7f86c2..59265c2d47 100644 --- a/Zend/tests/traits/language007.phpt +++ b/Zend/tests/traits/language007.phpt @@ -18,7 +18,7 @@ trait Hello { } class MyHelloWorld extends Base { - use Hello; + use Hello; } $o = new MyHelloWorld(); diff --git a/Zend/tests/traits/language009.phpt b/Zend/tests/traits/language009.phpt index 0672532195..60db67b8e0 100644 --- a/Zend/tests/traits/language009.phpt +++ b/Zend/tests/traits/language009.phpt @@ -24,8 +24,8 @@ trait C { class MyClass { use C, A, B { - B::foo insteadof A, C; - } + B::foo insteadof A, C; + } } $t = new MyClass; diff --git a/Zend/tests/traits/language015.phpt b/Zend/tests/traits/language015.phpt index 0c9fb4afb2..1d92529323 100644 --- a/Zend/tests/traits/language015.phpt +++ b/Zend/tests/traits/language015.phpt @@ -3,15 +3,15 @@ Invalid conflict resolution (unused trait as lhs of "insteadof") --FILE-- <?php trait T1 { - function foo() {echo "T1\n";} + function foo() {echo "T1\n";} } trait T2 { function foo() {echo "T2\n";} } class C { - use T1 { - T2::foo insteadof T1; - } + use T1 { + T2::foo insteadof T1; + } } --EXPECTF-- Fatal error: Required Trait T2 wasn't added to C in %slanguage015.php on line %d diff --git a/Zend/tests/traits/language016.phpt b/Zend/tests/traits/language016.phpt index 1c6bbeabac..2c07235fe9 100644 --- a/Zend/tests/traits/language016.phpt +++ b/Zend/tests/traits/language016.phpt @@ -3,15 +3,15 @@ Invalid conflict resolution (unused trait as rhs of "insteadof") --FILE-- <?php trait T1 { - function foo() {echo "T1\n";} + function foo() {echo "T1\n";} } trait T2 { function foo() {echo "T2\n";} } class C { - use T1 { - T1::foo insteadof T2; - } + use T1 { + T1::foo insteadof T2; + } } --EXPECTF-- Fatal error: Required Trait T2 wasn't added to C in %slanguage016.php on line %d diff --git a/Zend/tests/traits/language017.phpt b/Zend/tests/traits/language017.phpt index 539a05d02f..68169f9ba5 100644 --- a/Zend/tests/traits/language017.phpt +++ b/Zend/tests/traits/language017.phpt @@ -3,15 +3,15 @@ Invalid conflict resolution (unused trait as lhs of "as") --FILE-- <?php trait T1 { - function foo() {echo "T1\n";} + function foo() {echo "T1\n";} } trait T2 { function foo() {echo "T2\n";} } class C { - use T1 { - T2::foo as private; - } + use T1 { + T2::foo as private; + } } --EXPECTF-- Fatal error: Required Trait T2 wasn't added to C in %slanguage017.php on line %d diff --git a/Zend/tests/traits/language018.phpt b/Zend/tests/traits/language018.phpt index 169cb50c6b..714794a296 100644 --- a/Zend/tests/traits/language018.phpt +++ b/Zend/tests/traits/language018.phpt @@ -3,12 +3,12 @@ abstract alias --FILE-- <?php trait T1 { - function foo() {} + function foo() {} } class C1 { - use T1 { - T1::foo as abstract; - } + use T1 { + T1::foo as abstract; + } } ?> --EXPECTF-- diff --git a/Zend/tests/traits/language019.phpt b/Zend/tests/traits/language019.phpt index 83318c58a2..7764054ebd 100644 --- a/Zend/tests/traits/language019.phpt +++ b/Zend/tests/traits/language019.phpt @@ -3,12 +3,12 @@ final alias --FILE-- <?php trait T1 { - function foo() {} + function foo() {} } class C1 { - use T1 { - T1::foo as final; - } + use T1 { + T1::foo as final; + } } ?> --EXPECTF-- diff --git a/Zend/tests/traits/methods_001.phpt b/Zend/tests/traits/methods_001.phpt index 758234f2d5..8f44898cee 100644 --- a/Zend/tests/traits/methods_001.phpt +++ b/Zend/tests/traits/methods_001.phpt @@ -4,25 +4,25 @@ Testing magic method on trait <?php trait foo { - public function __toString() { - return '123'; - } + public function __toString() { + return '123'; + } - public function __get($x) { - var_dump($x); - } + public function __get($x) { + var_dump($x); + } - public function __set($attr, $val) { - var_dump($attr .'==='. $val); - } + public function __set($attr, $val) { + var_dump($attr .'==='. $val); + } - public function __clone() { - var_dump(__FUNCTION__); - } + public function __clone() { + var_dump(__FUNCTION__); + } } class bar { - use foo; + use foo; } $o = new bar; diff --git a/Zend/tests/traits/methods_002.phpt b/Zend/tests/traits/methods_002.phpt index 2a4215fb2c..b23f8df27a 100644 --- a/Zend/tests/traits/methods_002.phpt +++ b/Zend/tests/traits/methods_002.phpt @@ -4,20 +4,20 @@ Testing collision with magic methods <?php trait foo { - public function __clone() { - var_dump(__FUNCTION__); - } + public function __clone() { + var_dump(__FUNCTION__); + } } trait baz { - public function __clone() { - var_dump(__FUNCTION__); - } + public function __clone() { + var_dump(__FUNCTION__); + } } class bar { - use foo; - use baz; + use foo; + use baz; } $o = new bar; diff --git a/Zend/tests/traits/methods_003.phpt b/Zend/tests/traits/methods_003.phpt index d050b1135f..27df5fe5a6 100644 --- a/Zend/tests/traits/methods_003.phpt +++ b/Zend/tests/traits/methods_003.phpt @@ -4,16 +4,16 @@ Testing __construct and __destruct with Trait <?php trait foo { - public function __construct() { - var_dump(__FUNCTION__); - } - public function __destruct() { - var_dump(__FUNCTION__); - } + public function __construct() { + var_dump(__FUNCTION__); + } + public function __destruct() { + var_dump(__FUNCTION__); + } } class bar { - use foo; + use foo; } new bar; diff --git a/Zend/tests/traits/property001.phpt b/Zend/tests/traits/property001.phpt index 291037da07..a7c3fb51dd 100644 --- a/Zend/tests/traits/property001.phpt +++ b/Zend/tests/traits/property001.phpt @@ -15,15 +15,15 @@ trait THello2 { echo "PRE-CLASS-GUARD-TraitsTest\n"; class TraitsTest { - use THello1; - use THello2; + use THello1; + use THello2; } echo "PRE-CLASS-GUARD-TraitsTest2\n"; class TraitsTest2 { - use THello1; - use THello2; + use THello1; + use THello2; } var_dump(property_exists('TraitsTest', 'foo')); diff --git a/Zend/tests/traits/property002.phpt b/Zend/tests/traits/property002.phpt index ecd04fb332..4a9219219f 100644 --- a/Zend/tests/traits/property002.phpt +++ b/Zend/tests/traits/property002.phpt @@ -12,11 +12,11 @@ trait THello2 { } class TraitsTest { - use THello1; - use THello2; - function test() { - echo $this->hello . ' ' . $this->world; - } + use THello1; + use THello2; + function test() { + echo $this->hello . ' ' . $this->world; + } } var_dump(property_exists('TraitsTest', 'hello')); diff --git a/Zend/tests/traits/property003.phpt b/Zend/tests/traits/property003.phpt index 5a2863cfe1..881edb53f2 100644 --- a/Zend/tests/traits/property003.phpt +++ b/Zend/tests/traits/property003.phpt @@ -14,8 +14,8 @@ trait THello2 { echo "PRE-CLASS-GUARD\n"; class TraitsTest { - use THello1; - use THello2; + use THello1; + use THello2; } echo "POST-CLASS-GUARD\n"; diff --git a/Zend/tests/traits/property004.phpt b/Zend/tests/traits/property004.phpt index 53dca02e02..5734b83e2b 100644 --- a/Zend/tests/traits/property004.phpt +++ b/Zend/tests/traits/property004.phpt @@ -14,11 +14,11 @@ trait THello2 { echo "PRE-CLASS-GUARD\n"; class TraitsTest { - use THello1; - use THello2; - public function getHello() { - return $this->hello; - } + use THello1; + use THello2; + public function getHello() { + return $this->hello; + } } $t = new TraitsTest; diff --git a/Zend/tests/traits/property005.phpt b/Zend/tests/traits/property005.phpt index 5bdbfcdaba..d0a976cb37 100644 --- a/Zend/tests/traits/property005.phpt +++ b/Zend/tests/traits/property005.phpt @@ -21,7 +21,7 @@ echo "POST-CLASS-GUARD\n"; // now we do the test for a fatal error class TraitsTest { - use THello1; + use THello1; public $hello; } diff --git a/Zend/tests/traits/static_001.phpt b/Zend/tests/traits/static_001.phpt index 326481c779..b8e69d1091 100644 --- a/Zend/tests/traits/static_001.phpt +++ b/Zend/tests/traits/static_001.phpt @@ -5,17 +5,17 @@ Simas Toleikis simast@gmail.com --FILE-- <?php - trait TestTrait { - public static function test() { - return 'Test'; - } - } + trait TestTrait { + public static function test() { + return 'Test'; + } + } - class A { - use TestTrait; - } + class A { + use TestTrait; + } - echo A::test(); + echo A::test(); ?> --EXPECT-- diff --git a/Zend/tests/traits/static_002.phpt b/Zend/tests/traits/static_002.phpt index 5c1a92a806..4a75136c42 100644 --- a/Zend/tests/traits/static_002.phpt +++ b/Zend/tests/traits/static_002.phpt @@ -5,18 +5,18 @@ Simas Toleikis simast@gmail.com --FILE-- <?php - trait TestTrait { - public static function test() { - return 'Test'; - } - } + trait TestTrait { + public static function test() { + return 'Test'; + } + } - class A { - use TestTrait; - } + class A { + use TestTrait; + } - $class = "A"; - echo $class::test(); + $class = "A"; + echo $class::test(); ?> --EXPECT-- diff --git a/Zend/tests/traits/static_003.phpt b/Zend/tests/traits/static_003.phpt index 7417083f69..87f4b77aa8 100644 --- a/Zend/tests/traits/static_003.phpt +++ b/Zend/tests/traits/static_003.phpt @@ -5,22 +5,22 @@ Simas Toleikis simast@gmail.com --FILE-- <?php - trait TestTrait { - public static function test() { - return static::$test; - } - } + trait TestTrait { + public static function test() { + return static::$test; + } + } - class A { - use TestTrait; - protected static $test = "Test A"; - } + class A { + use TestTrait; + protected static $test = "Test A"; + } - class B extends A { - protected static $test = "Test B"; - } + class B extends A { + protected static $test = "Test B"; + } - echo B::test(); + echo B::test(); ?> --EXPECT-- diff --git a/Zend/tests/traits/static_004.phpt b/Zend/tests/traits/static_004.phpt index ca02a85e80..e7ceea881c 100644 --- a/Zend/tests/traits/static_004.phpt +++ b/Zend/tests/traits/static_004.phpt @@ -5,17 +5,17 @@ Simas Toleikis simast@gmail.com --FILE-- <?php - trait TestTrait { - public static function __callStatic($name, $arguments) { - return $name; - } - } + trait TestTrait { + public static function __callStatic($name, $arguments) { + return $name; + } + } - class A { - use TestTrait; - } + class A { + use TestTrait; + } - echo A::Test(); + echo A::Test(); ?> --EXPECT-- diff --git a/Zend/tests/traits/static_forward_static_call.phpt b/Zend/tests/traits/static_forward_static_call.phpt index 9ba53bf08a..2f66541729 100644 --- a/Zend/tests/traits/static_forward_static_call.phpt +++ b/Zend/tests/traits/static_forward_static_call.phpt @@ -5,23 +5,23 @@ Simas Toleikis simast@gmail.com --FILE-- <?php - trait TestTrait { - public static function test() { - return 'Forwarded '.forward_static_call(array('A', 'test')); - } - } + trait TestTrait { + public static function test() { + return 'Forwarded '.forward_static_call(array('A', 'test')); + } + } - class A { - public static function test() { - return "Test A"; - } - } + class A { + public static function test() { + return "Test A"; + } + } - class B extends A { - use TestTrait; - } + class B extends A { + use TestTrait; + } - echo B::test(); + echo B::test(); ?> --EXPECT-- diff --git a/Zend/tests/traits/static_get_called_class.phpt b/Zend/tests/traits/static_get_called_class.phpt index b1d8fa3d1e..5f61f8b81b 100644 --- a/Zend/tests/traits/static_get_called_class.phpt +++ b/Zend/tests/traits/static_get_called_class.phpt @@ -5,19 +5,19 @@ Simas Toleikis simast@gmail.com --FILE-- <?php - trait TestTrait { - public static function test() { - return get_called_class(); - } - } + trait TestTrait { + public static function test() { + return get_called_class(); + } + } - class A { - use TestTrait; - } + class A { + use TestTrait; + } - class B extends A { } + class B extends A { } - echo B::test(); + echo B::test(); ?> --EXPECT-- diff --git a/Zend/tests/traits/trait_constant_001.phpt b/Zend/tests/traits/trait_constant_001.phpt index 7a5268633e..9521c9267b 100644 --- a/Zend/tests/traits/trait_constant_001.phpt +++ b/Zend/tests/traits/trait_constant_001.phpt @@ -4,13 +4,13 @@ __TRAIT__: Basics, a constant denoiting the trait of definition. <?php trait TestTrait { - public static function test() { - return __TRAIT__; - } + public static function test() { + return __TRAIT__; + } } class Direct { - use TestTrait; + use TestTrait; } class IndirectInheritance extends Direct { diff --git a/Zend/tests/traits/trait_constant_002.phpt b/Zend/tests/traits/trait_constant_002.phpt index ebd75094e6..4588388671 100644 --- a/Zend/tests/traits/trait_constant_002.phpt +++ b/Zend/tests/traits/trait_constant_002.phpt @@ -3,23 +3,23 @@ __TRAIT__: Use outside of traits. --FILE-- <?php - class MyClass { - static function test() { - return __TRAIT__; - } - } + class MyClass { + static function test() { + return __TRAIT__; + } + } - function someFun() { - return __TRAIT__; - } + function someFun() { + return __TRAIT__; + } - $t = __TRAIT__; - var_dump($t); - $t = MyClass::test(); - var_dump($t); - $t = someFun(); - var_dump($t); + $t = __TRAIT__; + var_dump($t); + $t = MyClass::test(); + var_dump($t); + $t = someFun(); + var_dump($t); ?> --EXPECT-- string(0) "" diff --git a/Zend/tests/try/bug70228_8.phpt b/Zend/tests/try/bug70228_8.phpt index 93fc09f6a8..6e8533414f 100644 --- a/Zend/tests/try/bug70228_8.phpt +++ b/Zend/tests/try/bug70228_8.phpt @@ -9,9 +9,9 @@ function foo() { var_dump($value); try { try { - switch (str_repeat("b", 2)) { - case "bb": - return str_repeat("a", 2); + switch (str_repeat("b", 2)) { + case "bb": + return str_repeat("a", 2); } } finally { throw new Exception; diff --git a/Zend/tests/try/bug72213.phpt b/Zend/tests/try/bug72213.phpt index 624050295e..50555f53e4 100644 --- a/Zend/tests/try/bug72213.phpt +++ b/Zend/tests/try/bug72213.phpt @@ -3,21 +3,21 @@ Bug #72213 (Finally leaks on nested exceptions) --FILE-- <?php function test() { - try { - throw new Exception('a'); - } finally { - try { - throw new Exception('b'); - } finally { - } - } + try { + throw new Exception('a'); + } finally { + try { + throw new Exception('b'); + } finally { + } + } } try { - test(); + test(); } catch (Exception $e) { - var_dump($e->getMessage()); - var_dump($e->getPrevious()->getMessage()); + var_dump($e->getMessage()); + var_dump($e->getPrevious()->getMessage()); } ?> --EXPECT-- diff --git a/Zend/tests/try/bug72629.phpt b/Zend/tests/try/bug72629.phpt index 034a63b306..2e8e40d6b2 100644 --- a/Zend/tests/try/bug72629.phpt +++ b/Zend/tests/try/bug72629.phpt @@ -7,7 +7,7 @@ $var = null; $e = &$var; try { - throw new Exception; + throw new Exception; } catch (Exception $e) { } var_dump($var === $e); diff --git a/Zend/tests/try/bug74444.phpt b/Zend/tests/try/bug74444.phpt index 74e0c9d46f..949f83cb23 100644 --- a/Zend/tests/try/bug74444.phpt +++ b/Zend/tests/try/bug74444.phpt @@ -4,71 +4,71 @@ Bug #74444 (multiple catch freezes in some cases) <?php function foo() { - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - try { - throw new \RuntimeException(); - } catch (\FooEx | \RuntimeException $e) { - echo 1; - } - echo 2; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + try { + throw new \RuntimeException(); + } catch (\FooEx | \RuntimeException $e) { + echo 1; + } + echo 2; } foo(); diff --git a/Zend/tests/try/catch_002.phpt b/Zend/tests/try/catch_002.phpt index 11dbccf7df..73284492da 100644 --- a/Zend/tests/try/catch_002.phpt +++ b/Zend/tests/try/catch_002.phpt @@ -5,25 +5,25 @@ Catching an exception in a constructor class MyObject { - function __construct() - { - throw new Exception(); - echo __METHOD__ . "() Must not be reached\n"; - } + function __construct() + { + throw new Exception(); + echo __METHOD__ . "() Must not be reached\n"; + } - function __destruct() - { - echo __METHOD__ . "() Must not be called\n"; - } + function __destruct() + { + echo __METHOD__ . "() Must not be called\n"; + } } try { - new MyObject(); + new MyObject(); } catch(Exception $e) { - echo "Caught\n"; + echo "Caught\n"; } ?> diff --git a/Zend/tests/try/catch_003.phpt b/Zend/tests/try/catch_003.phpt index 579011f867..14ff850123 100644 --- a/Zend/tests/try/catch_003.phpt +++ b/Zend/tests/try/catch_003.phpt @@ -5,30 +5,30 @@ Catching an exception in a constructor fired form a static method class MyObject { - function fail() - { - throw new Exception(); - } + function fail() + { + throw new Exception(); + } - function __construct() - { - self::fail(); - echo __METHOD__ . "() Must not be reached\n"; - } + function __construct() + { + self::fail(); + echo __METHOD__ . "() Must not be reached\n"; + } - function __destruct() - { - echo __METHOD__ . "() Must not be called\n"; - } + function __destruct() + { + echo __METHOD__ . "() Must not be called\n"; + } } try { - new MyObject(); + new MyObject(); } catch(Exception $e) { - echo "Caught\n"; + echo "Caught\n"; } ?> diff --git a/Zend/tests/try/catch_004.phpt b/Zend/tests/try/catch_004.phpt index 5ec82998f7..d4f54ce776 100644 --- a/Zend/tests/try/catch_004.phpt +++ b/Zend/tests/try/catch_004.phpt @@ -5,33 +5,33 @@ Catching an exception in a constructor inside a static method class MyObject { - function fail() - { - throw new Exception(); - } + function fail() + { + throw new Exception(); + } - function __construct() - { - self::fail(); - echo __METHOD__ . "() Must not be reached\n"; - } + function __construct() + { + self::fail(); + echo __METHOD__ . "() Must not be reached\n"; + } - function __destruct() - { - echo __METHOD__ . "() Must not be called\n"; - } + function __destruct() + { + echo __METHOD__ . "() Must not be called\n"; + } - static function test() - { - try - { - new MyObject(); - } - catch(Exception $e) - { - echo "Caught\n"; - } - } + static function test() + { + try + { + new MyObject(); + } + catch(Exception $e) + { + echo "Caught\n"; + } + } } MyObject::test(); diff --git a/Zend/tests/try/finally_goto_001.phpt b/Zend/tests/try/finally_goto_001.phpt index 990f78d4c7..82bdd1ef9b 100644 --- a/Zend/tests/try/finally_goto_001.phpt +++ b/Zend/tests/try/finally_goto_001.phpt @@ -3,8 +3,8 @@ jmp into a finally block 01 --FILE-- <?php function foo() { - goto test; - try { + goto test; + try { } finally { test: } diff --git a/Zend/tests/try/finally_goto_002.phpt b/Zend/tests/try/finally_goto_002.phpt index a6bd9e307f..9e00c68fe0 100644 --- a/Zend/tests/try/finally_goto_002.phpt +++ b/Zend/tests/try/finally_goto_002.phpt @@ -3,8 +3,8 @@ jmp into a finally block 02 --FILE-- <?php function foo() { - try { - goto test; + try { + goto test; } finally { test: } diff --git a/Zend/tests/try/finally_goto_003.phpt b/Zend/tests/try/finally_goto_003.phpt index 9f4115fee6..b79b01435e 100644 --- a/Zend/tests/try/finally_goto_003.phpt +++ b/Zend/tests/try/finally_goto_003.phpt @@ -3,9 +3,9 @@ jmp into a finally block 03 --FILE-- <?php function foo() { - try { + try { } finally { - goto test; + goto test; test: } } diff --git a/Zend/tests/try/finally_goto_004.phpt b/Zend/tests/try/finally_goto_004.phpt index d88ceedf52..a3a505acba 100644 --- a/Zend/tests/try/finally_goto_004.phpt +++ b/Zend/tests/try/finally_goto_004.phpt @@ -3,11 +3,11 @@ jmp into a finally block 03 --FILE-- <?php function foo() { - try { + try { } finally { test: } - goto test; + goto test; } ?> --EXPECTF-- diff --git a/Zend/tests/try/finally_goto_005.phpt b/Zend/tests/try/finally_goto_005.phpt index 36b4155d81..ffb0e68be1 100644 --- a/Zend/tests/try/finally_goto_005.phpt +++ b/Zend/tests/try/finally_goto_005.phpt @@ -4,10 +4,10 @@ There must be a difference between label: try { ... } and try { label: ... } <?php label: try { - goto label; + goto label; } finally { - print "success"; - return; // don't loop + print "success"; + return; // don't loop } ?> diff --git a/Zend/tests/try/try_finally_010.phpt b/Zend/tests/try/try_finally_010.phpt index 91eb7821ee..8d5fa1e431 100644 --- a/Zend/tests/try/try_finally_010.phpt +++ b/Zend/tests/try/try_finally_010.phpt @@ -3,27 +3,27 @@ Try finally (function call in the finally block after exception) --FILE-- <?php function foo() { - echo "4"; + echo "4"; } function bar() { - try { - echo "2"; - throw new Exception(); - echo "x"; - } catch (MyEx $ex) { - echo "x"; - } finally { - echo "3"; - foo(); - echo "5"; - } + try { + echo "2"; + throw new Exception(); + echo "x"; + } catch (MyEx $ex) { + echo "x"; + } finally { + echo "3"; + foo(); + echo "5"; + } } try { - echo "1"; - bar(); - echo "x"; + echo "1"; + bar(); + echo "x"; } catch (Exception $ex) { - echo "6"; + echo "6"; } echo "\n"; --EXPECT-- diff --git a/Zend/tests/try/try_finally_011.phpt b/Zend/tests/try/try_finally_011.phpt index 8a9dc62ca4..1262edfef2 100644 --- a/Zend/tests/try/try_finally_011.phpt +++ b/Zend/tests/try/try_finally_011.phpt @@ -3,10 +3,10 @@ Try finally (segfault with empty break) --FILE-- <?php function foo () { - try { - break; - } finally { - } + try { + break; + } finally { + } } foo(); diff --git a/Zend/tests/try/try_finally_012.phpt b/Zend/tests/try/try_finally_012.phpt index a099ed3d6b..c83bcdacbd 100644 --- a/Zend/tests/try/try_finally_012.phpt +++ b/Zend/tests/try/try_finally_012.phpt @@ -3,27 +3,27 @@ Try finally (exception in "return" statement) --FILE-- <?php class A { - public $x = 1; - public $y = 2; - function __destruct() { - throw new Exception(); - } + public $x = 1; + public $y = 2; + function __destruct() { + throw new Exception(); + } } function foo() { - foreach(new A() as $a) { - try { - return $a; - } catch (Exception $e) { - echo "exception in foo\n"; - } finally { - echo "finally\n"; - } - } + foreach(new A() as $a) { + try { + return $a; + } catch (Exception $e) { + echo "exception in foo\n"; + } finally { + echo "finally\n"; + } + } } try { - foo(); + foo(); } catch (Exception $e) { - echo "exception in main\n"; + echo "exception in main\n"; } ?> --EXPECT-- diff --git a/Zend/tests/try/try_finally_019.phpt b/Zend/tests/try/try_finally_019.phpt index 2e2069d1be..2a3c614eba 100644 --- a/Zend/tests/try/try_finally_019.phpt +++ b/Zend/tests/try/try_finally_019.phpt @@ -3,13 +3,13 @@ Combination of foreach, finally and goto (call order) --FILE-- <?php class A { - public $n = 0; - function __construct($n) { - $this->n = $n; - } - function __destruct() { - echo "destruct" . $this->n . "\n"; - } + public $n = 0; + function __construct($n) { + $this->n = $n; + } + function __destruct() { + echo "destruct" . $this->n . "\n"; + } } foreach ([new A(1)] as $a) { diff --git a/Zend/tests/try/try_finally_020.phpt b/Zend/tests/try/try_finally_020.phpt index cfb72d0c55..5fda56bcad 100644 --- a/Zend/tests/try/try_finally_020.phpt +++ b/Zend/tests/try/try_finally_020.phpt @@ -3,13 +3,13 @@ Combination of foreach, finally and exception (call order) --FILE-- <?php class A { - public $n = 0; - function __construct($n) { - $this->n = $n; - } - function __destruct() { - echo "destruct" . $this->n . "\n"; - } + public $n = 0; + function __construct($n) { + $this->n = $n; + } + function __destruct() { + echo "destruct" . $this->n . "\n"; + } } foreach ([new A(1)] as $a) { diff --git a/Zend/tests/try/try_finally_021.phpt b/Zend/tests/try/try_finally_021.phpt index ed162f40d0..d25f393be1 100644 --- a/Zend/tests/try/try_finally_021.phpt +++ b/Zend/tests/try/try_finally_021.phpt @@ -6,10 +6,10 @@ $array = [1]; foreach ([0] as $_) { foreach ($array as $v) { try { - echo "ok\n"; + echo "ok\n"; return; } finally { - echo "ok\n"; + echo "ok\n"; return; } } diff --git a/Zend/tests/try/try_finally_022.phpt b/Zend/tests/try/try_finally_022.phpt index ff10dead42..7d03264be5 100644 --- a/Zend/tests/try/try_finally_022.phpt +++ b/Zend/tests/try/try_finally_022.phpt @@ -3,37 +3,37 @@ Try finally (exception in "return" statement) --FILE-- <?php class A { - public $x = 1; - public $y = 2; - function __destruct() { - throw new Exception(); - } + public $x = 1; + public $y = 2; + function __destruct() { + throw new Exception(); + } } try{ - $a = 0; - switch ($a) { - case 0: - } - switch ($a) { - case 0: - } - switch ($a) { - case 0: - } - foreach([new stdClass()] as $x) { - foreach(new A() as $a) { - foreach([new stdClass()] as $y) { - try { - if (0) { echo "0" . (int)5; } - return $a; - } catch (Exception $e) { - echo "exception1\n"; - } - } - } - } + $a = 0; + switch ($a) { + case 0: + } + switch ($a) { + case 0: + } + switch ($a) { + case 0: + } + foreach([new stdClass()] as $x) { + foreach(new A() as $a) { + foreach([new stdClass()] as $y) { + try { + if (0) { echo "0" . (int)5; } + return $a; + } catch (Exception $e) { + echo "exception1\n"; + } + } + } + } } catch (Exception $e) { - echo "exception2\n"; + echo "exception2\n"; } ?> --EXPECT-- diff --git a/Zend/tests/try/try_multicatch_001.phpt b/Zend/tests/try/try_multicatch_001.phpt index 0dffd32c72..ae86c743ea 100644 --- a/Zend/tests/try/try_multicatch_001.phpt +++ b/Zend/tests/try/try_multicatch_001.phpt @@ -6,11 +6,11 @@ Parsing test require_once __DIR__ . '/exceptions.inc'; try { - echo 'TRY' . PHP_EOL; + echo 'TRY' . PHP_EOL; } catch(Exception1 | Exception2 $e) { - echo 'Exception'; + echo 'Exception'; } finally { - echo 'FINALLY' . PHP_EOL; + echo 'FINALLY' . PHP_EOL; } ?> diff --git a/Zend/tests/try/try_multicatch_002.phpt b/Zend/tests/try/try_multicatch_002.phpt index 0e70fec7eb..559259bba3 100644 --- a/Zend/tests/try/try_multicatch_002.phpt +++ b/Zend/tests/try/try_multicatch_002.phpt @@ -6,12 +6,12 @@ Catch first exception in the multicatch require_once __DIR__ . '/exceptions.inc'; try { - echo 'TRY' . PHP_EOL; - throw new Exception1; + echo 'TRY' . PHP_EOL; + throw new Exception1; } catch(Exception1 | Exception2 | Exception3 $e) { - echo get_class($e) . PHP_EOL; + echo get_class($e) . PHP_EOL; } finally { - echo 'FINALLY' . PHP_EOL; + echo 'FINALLY' . PHP_EOL; } ?> diff --git a/Zend/tests/try/try_multicatch_003.phpt b/Zend/tests/try/try_multicatch_003.phpt index 6aed1a2b09..3bc4dead69 100644 --- a/Zend/tests/try/try_multicatch_003.phpt +++ b/Zend/tests/try/try_multicatch_003.phpt @@ -6,12 +6,12 @@ Catch second exception in the multicatch require_once __DIR__ . '/exceptions.inc'; try { - echo 'TRY' . PHP_EOL; - throw new Exception2; + echo 'TRY' . PHP_EOL; + throw new Exception2; } catch(Exception1 | Exception2 | Exception3 $e) { - echo get_class($e) . PHP_EOL; + echo get_class($e) . PHP_EOL; } finally { - echo 'FINALLY' . PHP_EOL; + echo 'FINALLY' . PHP_EOL; } ?> diff --git a/Zend/tests/try/try_multicatch_004.phpt b/Zend/tests/try/try_multicatch_004.phpt index d8b245a767..680c252142 100644 --- a/Zend/tests/try/try_multicatch_004.phpt +++ b/Zend/tests/try/try_multicatch_004.phpt @@ -6,12 +6,12 @@ Catch last exception in the multicatch require_once __DIR__ . '/exceptions.inc'; try { - echo 'TRY' . PHP_EOL; - throw new Exception3; + echo 'TRY' . PHP_EOL; + throw new Exception3; } catch(Exception1 | Exception2 | Exception3 $e) { - echo get_class($e) . PHP_EOL; + echo get_class($e) . PHP_EOL; } finally { - echo 'FINALLY' . PHP_EOL; + echo 'FINALLY' . PHP_EOL; } ?> diff --git a/Zend/tests/try/try_multicatch_005.phpt b/Zend/tests/try/try_multicatch_005.phpt index cc3fc890fa..e7bb61b74e 100644 --- a/Zend/tests/try/try_multicatch_005.phpt +++ b/Zend/tests/try/try_multicatch_005.phpt @@ -6,16 +6,16 @@ Catch exception in the nested multicatch require_once __DIR__ . '/exceptions.inc'; try { - try { - echo 'TRY' . PHP_EOL; - throw new Exception3; - } catch (Exception1 | Exception3 $e) { - echo get_class($e) . PHP_EOL; - } + try { + echo 'TRY' . PHP_EOL; + throw new Exception3; + } catch (Exception1 | Exception3 $e) { + echo get_class($e) . PHP_EOL; + } } catch(Exception2 | Exception3 $e) { - echo 'Should never be executed'; + echo 'Should never be executed'; } finally { - echo 'FINALLY' . PHP_EOL; + echo 'FINALLY' . PHP_EOL; } ?> diff --git a/Zend/tests/try/try_multicatch_006.phpt b/Zend/tests/try/try_multicatch_006.phpt index 440e06593c..f0eba8981c 100644 --- a/Zend/tests/try/try_multicatch_006.phpt +++ b/Zend/tests/try/try_multicatch_006.phpt @@ -5,14 +5,14 @@ Catch first exception in the second multicatch require_once __DIR__ . '/exceptions.inc'; try { - echo 'TRY' . PHP_EOL; - throw new Exception3; + echo 'TRY' . PHP_EOL; + throw new Exception3; } catch(Exception1 | Exception2 $e) { - echo get_class($e) . PHP_EOL; + echo get_class($e) . PHP_EOL; } catch(Exception3 | Exception4 $e) { - echo get_class($e) . PHP_EOL; + echo get_class($e) . PHP_EOL; } finally { - echo 'FINALLY' . PHP_EOL; + echo 'FINALLY' . PHP_EOL; } ?> --EXPECT-- diff --git a/Zend/tests/try/try_multicatch_007.phpt b/Zend/tests/try/try_multicatch_007.phpt index 40784108a0..3ec5c64f68 100644 --- a/Zend/tests/try/try_multicatch_007.phpt +++ b/Zend/tests/try/try_multicatch_007.phpt @@ -5,14 +5,14 @@ Catch second exception in the second multicatch require_once __DIR__ . '/exceptions.inc'; try { - echo 'TRY' . PHP_EOL; - throw new Exception4; + echo 'TRY' . PHP_EOL; + throw new Exception4; } catch(Exception1 | Exception2 $e) { - echo get_class($e) . PHP_EOL; + echo get_class($e) . PHP_EOL; } catch(Exception3 | Exception4 $e) { - echo get_class($e) . PHP_EOL; + echo get_class($e) . PHP_EOL; } finally { - echo 'FINALLY' . PHP_EOL; + echo 'FINALLY' . PHP_EOL; } ?> --EXPECT-- diff --git a/Zend/tests/type_declarations/array_001.phpt b/Zend/tests/type_declarations/array_001.phpt index c3315849a2..09af9a98f2 100644 --- a/Zend/tests/type_declarations/array_001.phpt +++ b/Zend/tests/type_declarations/array_001.phpt @@ -3,7 +3,7 @@ Array type declaration --FILE-- <?php function foo(array $a) { - echo count($a)."\n"; + echo count($a)."\n"; } foo(array(1,2,3)); diff --git a/Zend/tests/type_declarations/callable_003.phpt b/Zend/tests/type_declarations/callable_003.phpt index 3489c32d37..6e6095cd73 100644 --- a/Zend/tests/type_declarations/callable_003.phpt +++ b/Zend/tests/type_declarations/callable_003.phpt @@ -4,10 +4,10 @@ callable type#003 <?php function foo(callable $a, $b, callable $c) { - var_dump($a, $b, $c); + var_dump($a, $b, $c); } function bar(callable $a = null) { - var_dump($a); + var_dump($a); } foo("strpos", 123, "strpos"); diff --git a/Zend/tests/type_declarations/internal_function_strict_mode.phpt b/Zend/tests/type_declarations/internal_function_strict_mode.phpt index a9e7c9a56b..1019aa5024 100644 --- a/Zend/tests/type_declarations/internal_function_strict_mode.phpt +++ b/Zend/tests/type_declarations/internal_function_strict_mode.phpt @@ -6,23 +6,23 @@ declare(strict_types=1); echo "*** Trying Ord With Integer" . PHP_EOL; try { - var_dump(ord(1)); + var_dump(ord(1)); } catch (TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo "*** Caught " . $e->getMessage() . PHP_EOL; } echo "*** Trying Array Map With Invalid Callback" . PHP_EOL; try { - array_map([null, "bar"], []); + array_map([null, "bar"], []); } catch (TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo "*** Caught " . $e->getMessage() . PHP_EOL; } echo "*** Trying Strlen With Float" . PHP_EOL; try { - var_dump(strlen(1.5)); + var_dump(strlen(1.5)); } catch (TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo "*** Caught " . $e->getMessage() . PHP_EOL; } ?> diff --git a/Zend/tests/type_declarations/iterable_003.phpt b/Zend/tests/type_declarations/iterable_003.phpt index e5e6af9ae8..0b6c032b9f 100644 --- a/Zend/tests/type_declarations/iterable_003.phpt +++ b/Zend/tests/type_declarations/iterable_003.phpt @@ -4,10 +4,10 @@ iterable type#003 - Return types <?php function foo(): iterable { - return []; + return []; } function bar(): iterable { - return (function () { yield; })(); + return (function () { yield; })(); } function baz(): iterable { diff --git a/Zend/tests/type_declarations/nullable_null.phpt b/Zend/tests/type_declarations/nullable_null.phpt index 61b05e995b..8991db5e88 100644 --- a/Zend/tests/type_declarations/nullable_null.phpt +++ b/Zend/tests/type_declarations/nullable_null.phpt @@ -3,7 +3,7 @@ nullable class --FILE-- <?php function test(Foo $a = null) { - echo "ok\n"; + echo "ok\n"; } test(null); ?> diff --git a/Zend/tests/type_declarations/scalar_constant_defaults.phpt b/Zend/tests/type_declarations/scalar_constant_defaults.phpt index 88c6a4b39f..e42cb32bde 100644 --- a/Zend/tests/type_declarations/scalar_constant_defaults.phpt +++ b/Zend/tests/type_declarations/scalar_constant_defaults.phpt @@ -12,35 +12,35 @@ const STRING_ADD_VAL = "this" . " is a test"; const NULL_VAL = null; function int_val(int $a = INT_VAL): int { - return $a; + return $a; } function float_val(float $a = FLOAT_VAL): float { - return $a; + return $a; } function string_val(string $a = STRING_VAL): string { - return $a; + return $a; } function int_add_val(int $a = INT_ADD_VAL): int { - return $a; + return $a; } function float_add_val(float $a = FLOAT_ADD_VAL): float { - return $a; + return $a; } function string_add_val(string $a = STRING_ADD_VAL): string { - return $a; + return $a; } function int_val_default_null(int $a = NULL_VAL) { - return $a; + return $a; } function nullable_int_val_default_null(?int $a = NULL_VAL) { - return $a; + return $a; } echo "Testing int val" . PHP_EOL; diff --git a/Zend/tests/type_declarations/scalar_constant_defaults_error.phpt b/Zend/tests/type_declarations/scalar_constant_defaults_error.phpt index 750edb77fa..d897bb4822 100644 --- a/Zend/tests/type_declarations/scalar_constant_defaults_error.phpt +++ b/Zend/tests/type_declarations/scalar_constant_defaults_error.phpt @@ -6,7 +6,7 @@ Scalar type - default via constants - error condition const STRING_VAL = "test"; function int_val(int $a = STRING_VAL): int { - return $a; + return $a; } var_dump(int_val()); diff --git a/Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt b/Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt index b093983717..7f53b49b9c 100644 --- a/Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt +++ b/Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt @@ -4,7 +4,7 @@ Scalar type - disallow relative types <?php function foo(bar\int $a): int { - return $a; + return $a; } foo(10); diff --git a/Zend/tests/type_declarations/scalar_strict_declaration_placement_008.phpt b/Zend/tests/type_declarations/scalar_strict_declaration_placement_008.phpt index b5ddc9f0d3..d0b44c6b32 100644 --- a/Zend/tests/type_declarations/scalar_strict_declaration_placement_008.phpt +++ b/Zend/tests/type_declarations/scalar_strict_declaration_placement_008.phpt @@ -3,7 +3,7 @@ Test strict declaration block declaration 008 --FILE-- <?php declare(strict_types=1) { - var_dump(strlen("abc")); + var_dump(strlen("abc")); } ?> diff --git a/Zend/tests/type_declarations/typed_properties_001.phpt b/Zend/tests/type_declarations/typed_properties_001.phpt index 6e34cb478f..ce791cd4b5 100644 --- a/Zend/tests/type_declarations/typed_properties_001.phpt +++ b/Zend/tests/type_declarations/typed_properties_001.phpt @@ -3,21 +3,21 @@ Test typed properties basic operation --FILE-- <?php var_dump(new class(1, 2.2, true, ["four"], new stdClass) { - public int $int; - public float $float; - public bool $bool; - public array $array; - public stdClass $std; - public iterable $it; + public int $int; + public float $float; + public bool $bool; + public array $array; + public stdClass $std; + public iterable $it; - public function __construct(int $int, float $float, bool $bool, array $array, stdClass $std) { - $this->int = $int; - $this->float = $float; - $this->bool = $bool; - $this->array = $array; - $this->std = $std; - $this->it = $array; - } + public function __construct(int $int, float $float, bool $bool, array $array, stdClass $std) { + $this->int = $int; + $this->float = $float; + $this->bool = $bool; + $this->array = $array; + $this->std = $std; + $this->it = $array; + } }); ?> --EXPECTF-- diff --git a/Zend/tests/type_declarations/typed_properties_002.phpt b/Zend/tests/type_declarations/typed_properties_002.phpt index 3aec7a34ba..b0d1e1c0f2 100644 --- a/Zend/tests/type_declarations/typed_properties_002.phpt +++ b/Zend/tests/type_declarations/typed_properties_002.phpt @@ -3,7 +3,7 @@ Test typed properties error condition (read uninitialized) --FILE-- <?php $thing = new class() { - public int $int; + public int $int; }; var_dump($thing->int); diff --git a/Zend/tests/type_declarations/typed_properties_003.phpt b/Zend/tests/type_declarations/typed_properties_003.phpt index 59c289a566..6cde9cc604 100644 --- a/Zend/tests/type_declarations/typed_properties_003.phpt +++ b/Zend/tests/type_declarations/typed_properties_003.phpt @@ -3,7 +3,7 @@ Test typed properties error condition (fetch uninitialized by reference) --FILE-- <?php $thing = new class() { - public int $int; + public int $int; }; $var = &$thing->int; diff --git a/Zend/tests/type_declarations/typed_properties_004.phpt b/Zend/tests/type_declarations/typed_properties_004.phpt index 2df693aa99..eb8e1ef6b4 100644 --- a/Zend/tests/type_declarations/typed_properties_004.phpt +++ b/Zend/tests/type_declarations/typed_properties_004.phpt @@ -3,11 +3,11 @@ Test typed properties error condition (type mismatch) --FILE-- <?php new class("PHP 7 is better than you, and it knows it ...") { - public int $int; + public int $int; - public function __construct(string $string) { - $this->int = $string; - } + public function __construct(string $string) { + $this->int = $string; + } }; ?> --EXPECTF-- diff --git a/Zend/tests/type_declarations/typed_properties_005.phpt b/Zend/tests/type_declarations/typed_properties_005.phpt index 104f4bd57e..71f264a926 100644 --- a/Zend/tests/type_declarations/typed_properties_005.phpt +++ b/Zend/tests/type_declarations/typed_properties_005.phpt @@ -5,11 +5,11 @@ Test typed properties error condition (type mismatch object) class Dummy {} new class(new Dummy) { - public stdClass $std; + public stdClass $std; - public function __construct(Dummy $dummy) { - $this->std = $dummy; - } + public function __construct(Dummy $dummy) { + $this->std = $dummy; + } }; ?> --EXPECTF-- diff --git a/Zend/tests/type_declarations/typed_properties_006.phpt b/Zend/tests/type_declarations/typed_properties_006.phpt index c3a8faefd4..493b64fb86 100644 --- a/Zend/tests/type_declarations/typed_properties_006.phpt +++ b/Zend/tests/type_declarations/typed_properties_006.phpt @@ -3,11 +3,11 @@ Test typed properties inheritance (scalar) --FILE-- <?php class Foo { - public int $qux; + public int $qux; } class Bar extends Foo { - public string $qux; + public string $qux; } ?> --EXPECTF-- diff --git a/Zend/tests/type_declarations/typed_properties_007.phpt b/Zend/tests/type_declarations/typed_properties_007.phpt index 19e8022a24..90d53b46ad 100644 --- a/Zend/tests/type_declarations/typed_properties_007.phpt +++ b/Zend/tests/type_declarations/typed_properties_007.phpt @@ -6,11 +6,11 @@ class Whatever {} class Thing extends Whatever {} class Foo { - public Whatever $qux; + public Whatever $qux; } class Bar extends Foo { - public Thing $qux; + public Thing $qux; } ?> --EXPECTF-- diff --git a/Zend/tests/type_declarations/typed_properties_008.phpt b/Zend/tests/type_declarations/typed_properties_008.phpt index 70b4282626..3f82d6161d 100644 --- a/Zend/tests/type_declarations/typed_properties_008.phpt +++ b/Zend/tests/type_declarations/typed_properties_008.phpt @@ -3,11 +3,11 @@ Test typed properties inheritance (missing info) --FILE-- <?php class Foo { - public int $qux; + public int $qux; } class Bar extends Foo { - public $qux; + public $qux; } ?> --EXPECTF-- diff --git a/Zend/tests/type_declarations/typed_properties_009.phpt b/Zend/tests/type_declarations/typed_properties_009.phpt index 24013b4118..668dedbbf7 100644 --- a/Zend/tests/type_declarations/typed_properties_009.phpt +++ b/Zend/tests/type_declarations/typed_properties_009.phpt @@ -3,13 +3,13 @@ Test typed properties unset leaves properties in an uninitialized state --FILE-- <?php class Foo { - public int $bar; + public int $bar; - public function __get($name) { - var_dump($name); - /* return value has to be compatible with int */ - return 0; - } + public function __get($name) { + var_dump($name); + /* return value has to be compatible with int */ + return 0; + } } $foo = new Foo(); diff --git a/Zend/tests/type_declarations/typed_properties_010.phpt b/Zend/tests/type_declarations/typed_properties_010.phpt index fd7d367fea..9fcc6c96f5 100644 --- a/Zend/tests/type_declarations/typed_properties_010.phpt +++ b/Zend/tests/type_declarations/typed_properties_010.phpt @@ -3,11 +3,11 @@ Test typed properties allow fetch reference --FILE-- <?php class Foo { - public int $bar = 1; + public int $bar = 1; } $cb = function(int &$bar) { - var_dump($bar); + var_dump($bar); }; $foo = new Foo(); diff --git a/Zend/tests/type_declarations/typed_properties_011.phpt b/Zend/tests/type_declarations/typed_properties_011.phpt index 706a332750..f06333371f 100644 --- a/Zend/tests/type_declarations/typed_properties_011.phpt +++ b/Zend/tests/type_declarations/typed_properties_011.phpt @@ -3,7 +3,7 @@ Test typed properties allow fetch reference for init array --FILE-- <?php class Foo { - public int $bar = 1; + public int $bar = 1; } $foo = new Foo(); diff --git a/Zend/tests/type_declarations/typed_properties_012.phpt b/Zend/tests/type_declarations/typed_properties_012.phpt index 79a77cfa40..05fa166251 100644 --- a/Zend/tests/type_declarations/typed_properties_012.phpt +++ b/Zend/tests/type_declarations/typed_properties_012.phpt @@ -3,12 +3,12 @@ Test typed properties allow fetch reference for foreach --FILE-- <?php class Foo { - public int $bar = 1; + public int $bar = 1; } $foo = new Foo(); foreach ($foo as &$prop) { - $prop++; + $prop++; } var_dump($foo); ?> diff --git a/Zend/tests/type_declarations/typed_properties_013.phpt b/Zend/tests/type_declarations/typed_properties_013.phpt index 7236e21a2c..fb481d66cd 100644 --- a/Zend/tests/type_declarations/typed_properties_013.phpt +++ b/Zend/tests/type_declarations/typed_properties_013.phpt @@ -3,7 +3,7 @@ Test typed properties disallow incorrect type initial value (scalar) --FILE-- <?php class Foo { - public int $bar = "string"; + public int $bar = "string"; } ?> --EXPECTF-- diff --git a/Zend/tests/type_declarations/typed_properties_014.phpt b/Zend/tests/type_declarations/typed_properties_014.phpt index f7a4449abd..161f2e2a5a 100644 --- a/Zend/tests/type_declarations/typed_properties_014.phpt +++ b/Zend/tests/type_declarations/typed_properties_014.phpt @@ -3,7 +3,7 @@ Test typed properties disallow incorrect type initial value (array) --FILE-- <?php class Foo { - public array $bar = 32; + public array $bar = 32; } ?> --EXPECTF-- diff --git a/Zend/tests/type_declarations/typed_properties_015.phpt b/Zend/tests/type_declarations/typed_properties_015.phpt index ac11c0fe3e..a40b8764b5 100644 --- a/Zend/tests/type_declarations/typed_properties_015.phpt +++ b/Zend/tests/type_declarations/typed_properties_015.phpt @@ -3,7 +3,7 @@ Test typed properties disallow incorrect type initial value (object) --FILE-- <?php class Foo { - public stdClass $bar = null; + public stdClass $bar = null; } ?> --EXPECTF-- diff --git a/Zend/tests/type_declarations/typed_properties_016.phpt b/Zend/tests/type_declarations/typed_properties_016.phpt index 3be4d02b7f..297ce80d9f 100644 --- a/Zend/tests/type_declarations/typed_properties_016.phpt +++ b/Zend/tests/type_declarations/typed_properties_016.phpt @@ -3,11 +3,11 @@ Test typed properties initial values --FILE-- <?php class Foo { - public int $int = 1; - public float $flt = 2.2; + public int $int = 1; + public float $flt = 2.2; public float $flt2 = 2; - public array $arr = []; - public bool $bool = false; + public array $arr = []; + public bool $bool = false; public iterable $iter = []; } var_dump(new Foo); diff --git a/Zend/tests/type_declarations/typed_properties_017.phpt b/Zend/tests/type_declarations/typed_properties_017.phpt index 3e501d3688..306b40f72c 100644 --- a/Zend/tests/type_declarations/typed_properties_017.phpt +++ b/Zend/tests/type_declarations/typed_properties_017.phpt @@ -3,7 +3,7 @@ Test typed properties disallow void --FILE-- <?php class Foo { - public void $int; + public void $int; } $foo = new Foo(); diff --git a/Zend/tests/type_declarations/typed_properties_018.phpt b/Zend/tests/type_declarations/typed_properties_018.phpt index f3ac4504b1..817ac6a84d 100644 --- a/Zend/tests/type_declarations/typed_properties_018.phpt +++ b/Zend/tests/type_declarations/typed_properties_018.phpt @@ -3,8 +3,8 @@ Test typed properties type applies to all props in group --FILE-- <?php class Foo { - public int $bar, - $qux; + public int $bar, + $qux; } $reflector = new ReflectionClass(Foo::class); diff --git a/Zend/tests/type_declarations/typed_properties_021.phpt b/Zend/tests/type_declarations/typed_properties_021.phpt index 93a07771fb..eb4b61ac02 100644 --- a/Zend/tests/type_declarations/typed_properties_021.phpt +++ b/Zend/tests/type_declarations/typed_properties_021.phpt @@ -3,7 +3,7 @@ Test typed properties delay type check on constant --FILE-- <?php class Foo { - public int $bar = BAR::BAZ; + public int $bar = BAR::BAZ; } try { diff --git a/Zend/tests/type_declarations/typed_properties_022.phpt b/Zend/tests/type_declarations/typed_properties_022.phpt index 7e947825c9..8c72efd5b1 100644 --- a/Zend/tests/type_declarations/typed_properties_022.phpt +++ b/Zend/tests/type_declarations/typed_properties_022.phpt @@ -3,7 +3,7 @@ Test typed properties delay type check on ast --FILE-- <?php class Foo { - public int $bar = BAR::BAZ * 2; + public int $bar = BAR::BAZ * 2; } $foo = new Foo(); diff --git a/Zend/tests/type_declarations/typed_properties_023.phpt b/Zend/tests/type_declarations/typed_properties_023.phpt index 1531b23b95..3474b06732 100644 --- a/Zend/tests/type_declarations/typed_properties_023.phpt +++ b/Zend/tests/type_declarations/typed_properties_023.phpt @@ -3,13 +3,13 @@ Test typed static property --FILE-- <?php function &ref() { - static $a = 5; - return $a; + static $a = 5; + return $a; } class Foo { - public static int $i; - public static string $s = "x"; + public static int $i; + public static string $s = "x"; } var_dump(Foo::$i = 1); diff --git a/Zend/tests/type_declarations/typed_properties_024.phpt b/Zend/tests/type_declarations/typed_properties_024.phpt index 96f7216687..3f0e9fc95b 100644 --- a/Zend/tests/type_declarations/typed_properties_024.phpt +++ b/Zend/tests/type_declarations/typed_properties_024.phpt @@ -3,7 +3,7 @@ Test typed properties ignore private props during inheritance --FILE-- <?php class Foo { - private int $thing; + private int $thing; } class Bar extends Foo { diff --git a/Zend/tests/type_declarations/typed_properties_027.phpt b/Zend/tests/type_declarations/typed_properties_027.phpt index 861769932c..8aa291ac8e 100644 --- a/Zend/tests/type_declarations/typed_properties_027.phpt +++ b/Zend/tests/type_declarations/typed_properties_027.phpt @@ -4,7 +4,7 @@ Test typed properties float widen at runtime <?php class Foo { - public float $bar = 1.1; + public float $bar = 1.1; } $foo = new Foo; diff --git a/Zend/tests/type_declarations/typed_properties_028.phpt b/Zend/tests/type_declarations/typed_properties_028.phpt index de1b3f6602..dda75b2e85 100644 --- a/Zend/tests/type_declarations/typed_properties_028.phpt +++ b/Zend/tests/type_declarations/typed_properties_028.phpt @@ -3,7 +3,7 @@ Test typed properties respect strict types (off) --FILE-- <?php class Foo { - public int $bar; + public int $bar; } $foo = new Foo; diff --git a/Zend/tests/type_declarations/typed_properties_029.phpt b/Zend/tests/type_declarations/typed_properties_029.phpt index 9beca10627..4e89d3615f 100644 --- a/Zend/tests/type_declarations/typed_properties_029.phpt +++ b/Zend/tests/type_declarations/typed_properties_029.phpt @@ -5,7 +5,7 @@ Test typed properties respect strict types (on) declare(strict_types=1); class Foo { - public int $bar; + public int $bar; } $foo = new Foo; diff --git a/Zend/tests/type_declarations/typed_properties_030.phpt b/Zend/tests/type_declarations/typed_properties_030.phpt index 8feda02316..c7e641e1bf 100644 --- a/Zend/tests/type_declarations/typed_properties_030.phpt +++ b/Zend/tests/type_declarations/typed_properties_030.phpt @@ -3,11 +3,11 @@ Test typed properties unset __get magical magic --FILE-- <?php class Foo { - public int $bar; + public int $bar; - public function __get($name) { - return "violate"; - } + public function __get($name) { + return "violate"; + } } $foo = new Foo; diff --git a/Zend/tests/type_declarations/typed_properties_032.phpt b/Zend/tests/type_declarations/typed_properties_032.phpt index f3ceeb5cd9..2542b6e9ec 100644 --- a/Zend/tests/type_declarations/typed_properties_032.phpt +++ b/Zend/tests/type_declarations/typed_properties_032.phpt @@ -3,11 +3,11 @@ Test typed properties return by ref is allowed --FILE-- <?php $foo = new class { - public int $bar = 15; + public int $bar = 15; - public function &method() { - return $this->bar; - } + public function &method() { + return $this->bar; + } }; var_dump($foo->method()); diff --git a/Zend/tests/type_declarations/typed_properties_033.phpt b/Zend/tests/type_declarations/typed_properties_033.phpt index 87e6aef26b..665026f075 100644 --- a/Zend/tests/type_declarations/typed_properties_033.phpt +++ b/Zend/tests/type_declarations/typed_properties_033.phpt @@ -3,23 +3,23 @@ Test typed properties yield reference guard --FILE-- <?php $foo = new class { - public int $foo = 1; - public int $bar = 3; - public int $baz = 5; - public int $qux = PHP_INT_MAX; + public int $foo = 1; + public int $bar = 3; + public int $baz = 5; + public int $qux = PHP_INT_MAX; - public function &fetch() { - yield $this->foo; - yield $this->bar; - yield $this->baz; - yield $this->qux; - } + public function &fetch() { + yield $this->foo; + yield $this->bar; + yield $this->baz; + yield $this->qux; + } }; try { - foreach ($foo->fetch() as &$prop) { - $prop += 1; - } + foreach ($foo->fetch() as &$prop) { + $prop += 1; + } } catch (Error $e) { echo $e->getMessage(), "\n"; } var_dump($foo); diff --git a/Zend/tests/type_declarations/typed_properties_034.phpt b/Zend/tests/type_declarations/typed_properties_034.phpt index 79317553ab..4af6baa80a 100644 --- a/Zend/tests/type_declarations/typed_properties_034.phpt +++ b/Zend/tests/type_declarations/typed_properties_034.phpt @@ -3,35 +3,35 @@ Test typed properties passed to typed function --FILE-- <?php $foo = new class { - public ?int $bar = 42; - public int $baz; + public ?int $bar = 42; + public int $baz; - public function &getIterator() { - foreach (['1', &$this->bar] as &$item) { - yield $item; - } - } + public function &getIterator() { + foreach (['1', &$this->bar] as &$item) { + yield $item; + } + } }; function foo(?int &$a) { - var_dump($a); - $a = null; + var_dump($a); + $a = null; } foo($foo->bar); try { - $foo->baz = &$foo->bar; + $foo->baz = &$foo->bar; } catch (Error $e) { echo $e->getMessage(), "\n"; } $foo->bar = 10; foreach ($foo->getIterator() as &$item) { - $foo->baz = &$item; - var_dump($foo->baz); + $foo->baz = &$item; + var_dump($foo->baz); } try { - foo($foo->bar); + foo($foo->bar); } catch (Error $e) { echo $e->getMessage(), "\n"; } var_dump($foo); diff --git a/Zend/tests/type_declarations/typed_properties_036.phpt b/Zend/tests/type_declarations/typed_properties_036.phpt index 4deb5774f4..df4473dff0 100644 --- a/Zend/tests/type_declarations/typed_properties_036.phpt +++ b/Zend/tests/type_declarations/typed_properties_036.phpt @@ -3,11 +3,11 @@ Test uninitialized typed properties normal foreach must not be yielded --FILE-- <?php $foo = new class { - public int $bar = 10, $qux; + public int $bar = 10, $qux; }; foreach ($foo as $key => $bar) { - var_dump($key, $bar); + var_dump($key, $bar); } ?> --EXPECT-- diff --git a/Zend/tests/type_declarations/typed_properties_037.phpt b/Zend/tests/type_declarations/typed_properties_037.phpt index c5dde53572..9a76791bcd 100644 --- a/Zend/tests/type_declarations/typed_properties_037.phpt +++ b/Zend/tests/type_declarations/typed_properties_037.phpt @@ -3,7 +3,7 @@ Test typed properties var_dump uninitialized --FILE-- <?php $foo = new class { - public int $bar = 10, $qux; + public int $bar = 10, $qux; }; var_dump($foo); diff --git a/Zend/tests/type_declarations/typed_properties_038.phpt b/Zend/tests/type_declarations/typed_properties_038.phpt index 94a00d0d8c..0ac406f9a6 100644 --- a/Zend/tests/type_declarations/typed_properties_038.phpt +++ b/Zend/tests/type_declarations/typed_properties_038.phpt @@ -4,37 +4,37 @@ Test typed properties overflowing <?php $foo = new class { - public int $bar = PHP_INT_MAX; + public int $bar = PHP_INT_MAX; }; try { - $foo->bar++; + $foo->bar++; } catch(TypeError $t) { - var_dump($t->getMessage()); + var_dump($t->getMessage()); } var_dump($foo); try { - $foo->bar += 1; + $foo->bar += 1; } catch(TypeError $t) { - var_dump($t->getMessage()); + var_dump($t->getMessage()); } var_dump($foo); try { - ++$foo->bar; + ++$foo->bar; } catch(TypeError $t) { - var_dump($t->getMessage()); + var_dump($t->getMessage()); } var_dump($foo); try { - $foo->bar = $foo->bar + 1; + $foo->bar = $foo->bar + 1; } catch(TypeError $t) { - var_dump($t->getMessage()); + var_dump($t->getMessage()); } var_dump($foo); diff --git a/Zend/tests/type_declarations/typed_properties_040.phpt b/Zend/tests/type_declarations/typed_properties_040.phpt index d1931c5a11..7a77c4cc0f 100644 --- a/Zend/tests/type_declarations/typed_properties_040.phpt +++ b/Zend/tests/type_declarations/typed_properties_040.phpt @@ -5,11 +5,11 @@ Test __get on unset typed property must fail properly declare(strict_types=1); class Foo { - public int $bar; + public int $bar; - public function __get($name) { - var_dump($name); - } + public function __get($name) { + var_dump($name); + } } $foo = new Foo(); diff --git a/Zend/tests/type_declarations/typed_properties_041.phpt b/Zend/tests/type_declarations/typed_properties_041.phpt index 76dbfd8f5d..1c5ab0bad5 100644 --- a/Zend/tests/type_declarations/typed_properties_041.phpt +++ b/Zend/tests/type_declarations/typed_properties_041.phpt @@ -4,7 +4,7 @@ Test typed properties weak conversion of strings <?php class Foo { - public int $bar = 1; + public int $bar = 1; } $foo = new Foo; diff --git a/Zend/tests/type_declarations/typed_properties_042.phpt b/Zend/tests/type_declarations/typed_properties_042.phpt index ecb3df3c11..845395f8ba 100644 --- a/Zend/tests/type_declarations/typed_properties_042.phpt +++ b/Zend/tests/type_declarations/typed_properties_042.phpt @@ -3,14 +3,14 @@ Proper source duplication on assignment to typed property --FILE-- <?php class Foo { - public int $bar; + public int $bar; } $foo = new Foo(); for ($i = 0; $i < 5; $i++) { - $foo->bar = "5"; - var_dump($foo->bar); + $foo->bar = "5"; + var_dump($foo->bar); } ?> --EXPECT-- diff --git a/Zend/tests/type_declarations/typed_properties_044.phpt b/Zend/tests/type_declarations/typed_properties_044.phpt index 02a71a7b0b..f32cd92844 100644 --- a/Zend/tests/type_declarations/typed_properties_044.phpt +++ b/Zend/tests/type_declarations/typed_properties_044.phpt @@ -5,7 +5,7 @@ Test increment functions on typed property references --FILE-- <?php $foo = new class { - public ?int $bar; + public ?int $bar; }; $bar = &$foo->bar; @@ -20,30 +20,30 @@ var_dump($bar++); $bar = PHP_INT_MAX; try { - var_dump($bar++); + var_dump($bar++); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump(++$bar); + var_dump(++$bar); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } $bar = PHP_INT_MIN; try { - var_dump($bar--); + var_dump($bar--); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump(--$bar); + var_dump(--$bar); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/Zend/tests/type_declarations/typed_properties_046.phpt b/Zend/tests/type_declarations/typed_properties_046.phpt index d95fe8dc24..bb524fcf75 100644 --- a/Zend/tests/type_declarations/typed_properties_046.phpt +++ b/Zend/tests/type_declarations/typed_properties_046.phpt @@ -3,23 +3,23 @@ Memory leaks on wrong assignment to typed property --FILE-- <?php class Foo { - public int $bbb; + public int $bbb; } function foo() { - return new Foo(); + return new Foo(); } function bar() { - return str_repeat("b", 3); + return str_repeat("b", 3); } for ($i = 0; $i < 5; $i++) { - try { - foo()->{bar()} = str_repeat("a", 3); - } catch (Throwable $e) { - echo $e->getMessage() . "\n"; - } + try { + foo()->{bar()} = str_repeat("a", 3); + } catch (Throwable $e) { + echo $e->getMessage() . "\n"; + } } --EXPECT-- Cannot assign string to property Foo::$bbb of type int diff --git a/Zend/tests/type_declarations/typed_properties_047.phpt b/Zend/tests/type_declarations/typed_properties_047.phpt index db78143b02..5de7b254d9 100644 --- a/Zend/tests/type_declarations/typed_properties_047.phpt +++ b/Zend/tests/type_declarations/typed_properties_047.phpt @@ -3,7 +3,7 @@ Nullable typed property --FILE-- <?php class Foo { - public ?int $foo = null; + public ?int $foo = null; } $x = new Foo(); @@ -18,14 +18,14 @@ var_dump($x->foo); unset($x->foo); try { - var_dump($x->foo); + var_dump($x->foo); } catch (Throwable $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } try { - $x->foo = "ops"; + $x->foo = "ops"; } catch (Throwable $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } ?> --EXPECT-- diff --git a/Zend/tests/type_declarations/typed_properties_048.phpt b/Zend/tests/type_declarations/typed_properties_048.phpt index 8a06c55f23..e432c1afff 100644 --- a/Zend/tests/type_declarations/typed_properties_048.phpt +++ b/Zend/tests/type_declarations/typed_properties_048.phpt @@ -4,10 +4,10 @@ Parent private property types must be ignored <?php class A { - private $prop = "1"; + private $prop = "1"; } class B extends A { - private int $prop = 2; + private int $prop = 2; } var_dump((function () { return $this->prop; })->call(new B)); diff --git a/Zend/tests/type_declarations/typed_properties_049.phpt b/Zend/tests/type_declarations/typed_properties_049.phpt index e761590548..ed4f07e4b6 100644 --- a/Zend/tests/type_declarations/typed_properties_049.phpt +++ b/Zend/tests/type_declarations/typed_properties_049.phpt @@ -3,7 +3,7 @@ Nullable typed property --FILE-- <?php class Foo { - public int $foo = null; + public int $foo = null; } ?> --EXPECTF-- diff --git a/Zend/tests/type_declarations/typed_properties_051.phpt b/Zend/tests/type_declarations/typed_properties_051.phpt index 977570b238..37972c967b 100644 --- a/Zend/tests/type_declarations/typed_properties_051.phpt +++ b/Zend/tests/type_declarations/typed_properties_051.phpt @@ -4,12 +4,12 @@ Weak casts must not leak <?php class A { - public string $a; + public string $a; } class B { - function __toString() { - return str_repeat("ok", 2); - } + function __toString() { + return str_repeat("ok", 2); + } } class C { } @@ -17,9 +17,9 @@ $o = new A; $o->a = new B; var_dump($o->a); try { - $o->a = new C; + $o->a = new C; } catch (Throwable $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } ?> --EXPECT-- diff --git a/Zend/tests/type_declarations/typed_properties_052.phpt b/Zend/tests/type_declarations/typed_properties_052.phpt index 3a73d7359a..cf6a6b05a1 100644 --- a/Zend/tests/type_declarations/typed_properties_052.phpt +++ b/Zend/tests/type_declarations/typed_properties_052.phpt @@ -5,12 +5,12 @@ Class properties declared in eval() must not leak eval(<<<'EOF' class A { - public A $a1; - public \B $b1; - public Foo\C $c1; - public ?A $a2; - public ?\B $b2; - public ?Foo\C $c2; + public A $a1; + public \B $b1; + public Foo\C $c1; + public ?A $a2; + public ?\B $b2; + public ?Foo\C $c2; } EOF ); diff --git a/Zend/tests/type_declarations/typed_properties_053.phpt b/Zend/tests/type_declarations/typed_properties_053.phpt index 1da42bcbd9..3b347795b3 100644 --- a/Zend/tests/type_declarations/typed_properties_053.phpt +++ b/Zend/tests/type_declarations/typed_properties_053.phpt @@ -3,7 +3,7 @@ Typed properties disallow callable --FILE-- <?php class A { - public callable $a; + public callable $a; } $obj = new A; var_dump($obj); diff --git a/Zend/tests/type_declarations/typed_properties_054.phpt b/Zend/tests/type_declarations/typed_properties_054.phpt index cb771d6e64..281d59f26c 100644 --- a/Zend/tests/type_declarations/typed_properties_054.phpt +++ b/Zend/tests/type_declarations/typed_properties_054.phpt @@ -3,7 +3,7 @@ Typed properties disallow callable (nullable variant) --FILE-- <?php class A { - public ?callable $a; + public ?callable $a; } $obj = new A; var_dump($obj); diff --git a/Zend/tests/type_declarations/typed_properties_055.phpt b/Zend/tests/type_declarations/typed_properties_055.phpt index 31d687254c..36afb48a51 100644 --- a/Zend/tests/type_declarations/typed_properties_055.phpt +++ b/Zend/tests/type_declarations/typed_properties_055.phpt @@ -3,15 +3,15 @@ Test assign to typed property taken by reference --FILE-- <?php class A { - public $foo = 1; - public int $bar = 2; + public $foo = 1; + public int $bar = 2; } class B { - public A $a; + public A $a; } $f = function (&$n) { - var_dump($n); - $n = "ops"; + var_dump($n); + $n = "ops"; }; $o = new B; $o->a = new A; diff --git a/Zend/tests/type_declarations/typed_properties_056.phpt b/Zend/tests/type_declarations/typed_properties_056.phpt index 4d2930cc3b..868594b38a 100644 --- a/Zend/tests/type_declarations/typed_properties_056.phpt +++ b/Zend/tests/type_declarations/typed_properties_056.phpt @@ -5,15 +5,15 @@ Type change in assign_op (use-after-free) declare(strict_types=1); class A { - public string $foo; + public string $foo; } $o = new A; $o->foo = "1" . str_repeat("0", 2); try { - $o->foo += 5; + $o->foo += 5; } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } var_dump($o->foo); unset($o); diff --git a/Zend/tests/type_declarations/typed_properties_057.phpt b/Zend/tests/type_declarations/typed_properties_057.phpt index ebec0f48bf..eb565f0c36 100644 --- a/Zend/tests/type_declarations/typed_properties_057.phpt +++ b/Zend/tests/type_declarations/typed_properties_057.phpt @@ -5,15 +5,15 @@ Type change in pre/post-increment (use-after-free) declare(strict_types=1); class A { - public string $foo; + public string $foo; } $o = new A; $o->foo = "1" . str_repeat("0", 2); try { - $x = ++$o->foo; + $x = ++$o->foo; } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } var_dump($o->foo); try { diff --git a/Zend/tests/type_declarations/typed_properties_058.phpt b/Zend/tests/type_declarations/typed_properties_058.phpt index a6d65daa4c..47c75037d1 100644 --- a/Zend/tests/type_declarations/typed_properties_058.phpt +++ b/Zend/tests/type_declarations/typed_properties_058.phpt @@ -7,23 +7,23 @@ declare(strict_types=1); define("FOO", 5); class A { - public int $foo = FOO; + public int $foo = FOO; } class B { - public string $foo = FOO; + public string $foo = FOO; } $o = new A(); var_dump($o->foo); for ($i = 0; $i < 2; $i++) { - try { - $o = new B(); - var_dump($o->foo); - } catch (Throwable $e) { - echo $e->getMessage() . "\n"; - } + try { + $o = new B(); + var_dump($o->foo); + } catch (Throwable $e) { + echo $e->getMessage() . "\n"; + } } ?> --EXPECT-- diff --git a/Zend/tests/type_declarations/typed_properties_059.phpt b/Zend/tests/type_declarations/typed_properties_059.phpt index caee8501f7..59aaacce60 100644 --- a/Zend/tests/type_declarations/typed_properties_059.phpt +++ b/Zend/tests/type_declarations/typed_properties_059.phpt @@ -3,14 +3,14 @@ Nullable typed properties in traits --FILE-- <?php trait T { - public int $a1; - public ?int $b1; + public int $a1; + public ?int $b1; } class A { - use T; - public int $a2; - public ?int $b2; + use T; + public int $a2; + public ?int $b2; } $x = new A; diff --git a/Zend/tests/type_declarations/typed_properties_060.phpt b/Zend/tests/type_declarations/typed_properties_060.phpt index 5b3c9d0981..bf02c31251 100644 --- a/Zend/tests/type_declarations/typed_properties_060.phpt +++ b/Zend/tests/type_declarations/typed_properties_060.phpt @@ -4,7 +4,7 @@ Test typed properties work fine with simple inheritance <?php class A { - public int $a = 1; + public int $a = 1; } class B extends A {} diff --git a/Zend/tests/type_declarations/typed_properties_061.phpt b/Zend/tests/type_declarations/typed_properties_061.phpt index 647543c6d6..b946b2d259 100644 --- a/Zend/tests/type_declarations/typed_properties_061.phpt +++ b/Zend/tests/type_declarations/typed_properties_061.phpt @@ -6,15 +6,15 @@ Typed property on overloaded by-ref property <?php $a = new class { - public int $foo = 1; + public int $foo = 1; - function &__get($x) { - return $this->foo; - } + function &__get($x) { + return $this->foo; + } - function __set($x, $y) { - echo "set($y)\n"; - } + function __set($x, $y) { + echo "set($y)\n"; + } }; $a->_ += 1; diff --git a/Zend/tests/type_declarations/typed_properties_062.phpt b/Zend/tests/type_declarations/typed_properties_062.phpt index 45f4682806..6e1242e990 100644 --- a/Zend/tests/type_declarations/typed_properties_062.phpt +++ b/Zend/tests/type_declarations/typed_properties_062.phpt @@ -4,8 +4,8 @@ Typed property on by-ref property <?php $a = new class { - public int $foo = 1; - public $_; + public int $foo = 1; + public $_; }; $a->_ = &$a->foo; @@ -17,7 +17,7 @@ $a->_ .= "1"; var_dump($a->foo); try { - $a->_ .= "e50"; + $a->_ .= "e50"; } catch (Error $e) { echo $e->getMessage(), "\n"; } var_dump($a->foo); @@ -30,30 +30,30 @@ var_dump($a->foo); $a->foo = PHP_INT_MIN; try { - $a->_--; + $a->_--; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { - --$a->_; + --$a->_; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $a->foo = PHP_INT_MAX; try { - $a->_++; + $a->_++; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { - ++$a->_; + ++$a->_; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $a->_ = 0; try { - $a->_ = []; + $a->_ = []; } catch (Error $e) { echo $e->getMessage(), "\n"; } var_dump($a->foo); diff --git a/Zend/tests/type_declarations/typed_properties_063.phpt b/Zend/tests/type_declarations/typed_properties_063.phpt index bd4cccff22..b67e95c24b 100644 --- a/Zend/tests/type_declarations/typed_properties_063.phpt +++ b/Zend/tests/type_declarations/typed_properties_063.phpt @@ -4,7 +4,7 @@ Typed property on by-ref variable <?php $a = new class { - public int $foo = 1; + public int $foo = 1; }; $_ = &$a->foo; @@ -16,7 +16,7 @@ $_ .= "1"; var_dump($a->foo); try { - $_ .= "e50"; + $_ .= "e50"; } catch (Error $e) { echo $e->getMessage(), "\n"; } var_dump($a->foo); @@ -29,30 +29,30 @@ var_dump($a->foo); $a->foo = PHP_INT_MIN; try { - $_--; + $_--; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { - --$_; + --$_; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $a->foo = PHP_INT_MAX; try { - $_++; + $_++; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { - ++$_; + ++$_; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $_ = 0; try { - $_ = []; + $_ = []; } catch (Error $e) { echo $e->getMessage(), "\n"; } var_dump($a->foo); diff --git a/Zend/tests/type_declarations/typed_properties_064.phpt b/Zend/tests/type_declarations/typed_properties_064.phpt index 59e0552898..dd7b5517a7 100644 --- a/Zend/tests/type_declarations/typed_properties_064.phpt +++ b/Zend/tests/type_declarations/typed_properties_064.phpt @@ -4,7 +4,7 @@ Typed property on by-ref array value <?php $a = new class { - public int $foo = 1; + public int $foo = 1; }; $_ = [&$a->foo]; @@ -16,7 +16,7 @@ $_[0] .= "1"; var_dump($a->foo); try { - $_[0] .= "e50"; + $_[0] .= "e50"; } catch (Error $e) { echo $e->getMessage(), "\n"; } var_dump($a->foo); @@ -34,25 +34,25 @@ try { echo gettype($a->foo),"\n"; try { - --$_[0]; + --$_[0]; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $a->foo = PHP_INT_MAX; try { - $_[0]++; + $_[0]++; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { - ++$_[0]; + ++$_[0]; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $_[0] = 0; try { - $_[0] = []; + $_[0] = []; } catch (Error $e) { echo $e->getMessage(), "\n"; } var_dump($a->foo); diff --git a/Zend/tests/type_declarations/typed_properties_065.phpt b/Zend/tests/type_declarations/typed_properties_065.phpt index da88cbf2cb..d81b51d049 100644 --- a/Zend/tests/type_declarations/typed_properties_065.phpt +++ b/Zend/tests/type_declarations/typed_properties_065.phpt @@ -4,12 +4,12 @@ Typed property on by-ref array dimension <?php $a = new class implements ArrayAccess { - public int $foo = 1; + public int $foo = 1; - function offsetExists($o) { return 1; } - function &offsetGet($o) { return $this->foo; } - function offsetSet($o, $v) { print "offsetSet($v)\n"; } - function offsetUnset($o) { print "offsetUnset() ?!?"; } + function offsetExists($o) { return 1; } + function &offsetGet($o) { return $this->foo; } + function offsetSet($o, $v) { print "offsetSet($v)\n"; } + function offsetUnset($o) { print "offsetUnset() ?!?"; } }; $a[0] += 1; @@ -35,19 +35,19 @@ try { echo gettype($a->foo),"\n"; try { - --$a[0]; + --$a[0]; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $a->foo = PHP_INT_MAX; try { - $a[0]++; + $a[0]++; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { - ++$a[0]; + ++$a[0]; } catch (Error $e) { echo $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; diff --git a/Zend/tests/type_declarations/typed_properties_066.phpt b/Zend/tests/type_declarations/typed_properties_066.phpt index a91a00df65..7dc217d2e4 100644 --- a/Zend/tests/type_declarations/typed_properties_066.phpt +++ b/Zend/tests/type_declarations/typed_properties_066.phpt @@ -4,7 +4,7 @@ Typed property assignment must not overwrite constants <?php class Foo { - public float $x = 0.0; + public float $x = 0.0; }; $x = new Foo; diff --git a/Zend/tests/type_declarations/typed_properties_067.phpt b/Zend/tests/type_declarations/typed_properties_067.phpt index da6865e5d4..cfbc068db1 100644 --- a/Zend/tests/type_declarations/typed_properties_067.phpt +++ b/Zend/tests/type_declarations/typed_properties_067.phpt @@ -4,11 +4,11 @@ Iterable typed properties must be accepted to by-ref array arguments <?php $obj = new class { - public ?iterable $it = null; + public ?iterable $it = null; }; function arr(?array &$arr) { - $arr = [1]; + $arr = [1]; } arr($obj->it); diff --git a/Zend/tests/type_declarations/typed_properties_068.phpt b/Zend/tests/type_declarations/typed_properties_068.phpt index dc5cb1b5ff..38597559cf 100644 --- a/Zend/tests/type_declarations/typed_properties_068.phpt +++ b/Zend/tests/type_declarations/typed_properties_068.phpt @@ -3,14 +3,14 @@ Test typed static property by ref --FILE-- <?php function &ref($a = null) { - static $f; - if ($a !== null) $f = function &() use (&$a) { return $a; }; - return $f(); + static $f; + if ($a !== null) $f = function &() use (&$a) { return $a; }; + return $f(); } class Foo { - public static int $i; - public static string $s = "x"; + public static int $i; + public static string $s = "x"; } Foo::$i = &ref(5); @@ -27,12 +27,12 @@ Foo::$i = "4"; var_dump($i, Foo::$i); try { - $i = null; + $i = null; } catch (TypeError $e) { print $e->getMessage()."\n"; } var_dump($i, Foo::$i); try { - Foo::$i = null; + Foo::$i = null; } catch (TypeError $e) { print $e->getMessage()."\n"; } var_dump($i, Foo::$i); @@ -43,17 +43,17 @@ Foo::$i = &ref("0"); var_dump(Foo::$i, ref()); try { - Foo::$i = &ref("x"); + Foo::$i = &ref("x"); } catch (TypeError $e) { print $e->getMessage()."\n"; } var_dump(Foo::$i, ref()); try { - Foo::$i = &Foo::$s; + Foo::$i = &Foo::$s; } catch (TypeError $e) { print $e->getMessage()."\n"; } var_dump(Foo::$i, Foo::$s); try { - Foo::$s = &Foo::$i; + Foo::$s = &Foo::$i; } catch (TypeError $e) { print $e->getMessage()."\n"; } var_dump(Foo::$i, Foo::$s); diff --git a/Zend/tests/type_declarations/typed_properties_069.phpt b/Zend/tests/type_declarations/typed_properties_069.phpt index 0f804f8f06..7d84407102 100644 --- a/Zend/tests/type_declarations/typed_properties_069.phpt +++ b/Zend/tests/type_declarations/typed_properties_069.phpt @@ -4,19 +4,19 @@ Test assign of invalid string to typed static int property <?php function &nonNumericStringRef() { - static $a = "x"; - return $a; + static $a = "x"; + return $a; } class Foo { - public static int $i; + public static int $i; } try { - Foo::$i = &nonNumericStringRef(); + Foo::$i = &nonNumericStringRef(); } catch (TypeError $e) { print $e->getMessage()."\n"; } try { - var_dump(Foo::$i); + var_dump(Foo::$i); } catch (Error $e) { print $e->getMessage()."\n"; } var_dump(nonNumericStringRef()); diff --git a/Zend/tests/type_declarations/typed_properties_070.phpt b/Zend/tests/type_declarations/typed_properties_070.phpt index ec2d6bf8c6..d039fca3b1 100644 --- a/Zend/tests/type_declarations/typed_properties_070.phpt +++ b/Zend/tests/type_declarations/typed_properties_070.phpt @@ -3,15 +3,15 @@ Test typed static property with assign op operators --FILE-- <?php function &stringRef() { - static $a = "1"; - $b = $a; - $a = &$b; - return $a; + static $a = "1"; + $b = $a; + $a = &$b; + return $a; } class Foo { - public static int $i = 0; - public static string $s = "1"; + public static int $i = 0; + public static string $s = "1"; } Foo::$s .= "1"; @@ -28,12 +28,12 @@ Foo::$i += stringRef(); var_dump(Foo::$i); try { - Foo::$i += PHP_INT_MAX; + Foo::$i += PHP_INT_MAX; } catch (TypeError $e) { print $e->getMessage()."\n"; } var_dump(Foo::$i); try { - Foo::$i .= PHP_INT_MAX; + Foo::$i .= PHP_INT_MAX; } catch (TypeError $e) { print $e->getMessage()."\n"; } var_dump(Foo::$i); diff --git a/Zend/tests/type_declarations/typed_properties_071.phpt b/Zend/tests/type_declarations/typed_properties_071.phpt index 4d0451cf73..d45abcd4ca 100644 --- a/Zend/tests/type_declarations/typed_properties_071.phpt +++ b/Zend/tests/type_declarations/typed_properties_071.phpt @@ -2,7 +2,7 @@ Test assignment to typed reference with weak type conversion --FILE-- <?php - + class Test { public string $x = "x"; } diff --git a/Zend/tests/type_declarations/typed_properties_072.phpt b/Zend/tests/type_declarations/typed_properties_072.phpt index 13fab7177e..99a475767f 100644 --- a/Zend/tests/type_declarations/typed_properties_072.phpt +++ b/Zend/tests/type_declarations/typed_properties_072.phpt @@ -2,13 +2,13 @@ Typed property must cast when used with __get() --FILE-- <?php - + class Test { - public int $val; + public int $val; - public function __get($name) { - return "42"; - } + public function __get($name) { + return "42"; + } } $test = new Test; diff --git a/Zend/tests/type_declarations/typed_properties_073.phpt b/Zend/tests/type_declarations/typed_properties_073.phpt index 43cb0f507b..b0fa9e4e2b 100644 --- a/Zend/tests/type_declarations/typed_properties_073.phpt +++ b/Zend/tests/type_declarations/typed_properties_073.phpt @@ -2,14 +2,14 @@ Typed property must cast when used with &__get() --FILE-- <?php - + class Test { - public $prop = "42"; - public int $val; + public $prop = "42"; + public int $val; - public function &__get($name) { - return $this->prop; - } + public function &__get($name) { + return $this->prop; + } } $test = new Test; diff --git a/Zend/tests/type_declarations/typed_properties_074.phpt b/Zend/tests/type_declarations/typed_properties_074.phpt index 5759505707..f13398d9d7 100644 --- a/Zend/tests/type_declarations/typed_properties_074.phpt +++ b/Zend/tests/type_declarations/typed_properties_074.phpt @@ -2,14 +2,14 @@ Typed property must be compatible when returned via &__get() --FILE-- <?php - + class Test { - public $prop = "x"; - public int $val; + public $prop = "x"; + public int $val; - public function &__get($name) { - return $this->prop; - } + public function &__get($name) { + return $this->prop; + } } $test = new Test; @@ -17,7 +17,7 @@ $dummyRef = &$test->prop; unset($test->val); var_dump($test); try { - var_dump($test->val); + var_dump($test->val); } catch (TypeError $e) { print $e->getMessage()."\n"; } var_dump($test); diff --git a/Zend/tests/type_declarations/typed_properties_075.phpt b/Zend/tests/type_declarations/typed_properties_075.phpt index def86f3695..42e74ebce4 100644 --- a/Zend/tests/type_declarations/typed_properties_075.phpt +++ b/Zend/tests/type_declarations/typed_properties_075.phpt @@ -6,37 +6,37 @@ Test typed properties overflowing <?php class Foo { - public static int $bar = PHP_INT_MAX; + public static int $bar = PHP_INT_MAX; }; try { - Foo::$bar++; + Foo::$bar++; } catch(TypeError $t) { - var_dump($t->getMessage()); + var_dump($t->getMessage()); } var_dump(Foo::$bar); try { - Foo::$bar += 1; + Foo::$bar += 1; } catch(TypeError $t) { - var_dump($t->getMessage()); + var_dump($t->getMessage()); } var_dump(Foo::$bar); try { - ++Foo::$bar; + ++Foo::$bar; } catch(TypeError $t) { - var_dump($t->getMessage()); + var_dump($t->getMessage()); } var_dump(Foo::$bar); try { - Foo::$bar = Foo::$bar + 1; + Foo::$bar = Foo::$bar + 1; } catch(TypeError $t) { - var_dump($t->getMessage()); + var_dump($t->getMessage()); } var_dump(Foo::$bar); diff --git a/Zend/tests/type_declarations/typed_properties_078.phpt b/Zend/tests/type_declarations/typed_properties_078.phpt index d8fc67d466..c92ed5afc4 100644 --- a/Zend/tests/type_declarations/typed_properties_078.phpt +++ b/Zend/tests/type_declarations/typed_properties_078.phpt @@ -4,9 +4,9 @@ Typed references must be kept track of and always be only the intersection of th <?php $a = new class { - public ?iterable $it = []; - public ?array $a; - public ?Traversable $t; + public ?iterable $it = []; + public ?array $a; + public ?Traversable $t; }; $ref = &$a->it; @@ -15,7 +15,7 @@ $a->a = &$ref; var_dump($ref); try { - $a->t = &$ref; + $a->t = &$ref; } catch (TypeError $e) { var_dump($e->getMessage()); } var_dump($ref); @@ -23,7 +23,7 @@ $a->it = [1]; // type is still assignable var_dump($ref); try { - $ref = new ArrayIterator(); + $ref = new ArrayIterator(); } catch (TypeError $e) { var_dump($e->getMessage()); } var_dump($ref instanceof ArrayIterator); @@ -34,7 +34,7 @@ $ref = null; $a->t = &$ref; try { - $ref = []; + $ref = []; } catch (TypeError $e) { var_dump($e->getMessage()); } var_dump($ref instanceof ArrayIterator); diff --git a/Zend/tests/type_declarations/typed_properties_079.phpt b/Zend/tests/type_declarations/typed_properties_079.phpt index 85ed6fc75d..d189cec6d4 100644 --- a/Zend/tests/type_declarations/typed_properties_079.phpt +++ b/Zend/tests/type_declarations/typed_properties_079.phpt @@ -4,14 +4,14 @@ Test static typed properties with references <?php class A { - static iterable $it = []; - static ?array $a; + static iterable $it = []; + static ?array $a; } A::$a = &A::$it; try { - A::$it = new ArrayIterator(); + A::$it = new ArrayIterator(); } catch (TypeError $e) { var_dump($e->getMessage()); } var_dump(A::$it); @@ -20,7 +20,7 @@ A::$a = &$a; A::$it = new ArrayIterator(); try { - $a = 1; + $a = 1; } catch (TypeError $e) { var_dump($e->getMessage()); } var_dump($a); diff --git a/Zend/tests/type_declarations/typed_properties_081.phpt b/Zend/tests/type_declarations/typed_properties_081.phpt index 4f49eae4e7..f6d2114c6f 100644 --- a/Zend/tests/type_declarations/typed_properties_081.phpt +++ b/Zend/tests/type_declarations/typed_properties_081.phpt @@ -12,7 +12,7 @@ $x =& $test->x; $test2 = clone $test; unset($test); try { - $x = "foo"; + $x = "foo"; } catch (TypeError $e) { echo $e->getMessage(), "\n"; } var_dump($test2->x); diff --git a/Zend/tests/type_declarations/typed_properties_082.phpt b/Zend/tests/type_declarations/typed_properties_082.phpt index 1e4e62e89b..d212f1852c 100644 --- a/Zend/tests/type_declarations/typed_properties_082.phpt +++ b/Zend/tests/type_declarations/typed_properties_082.phpt @@ -4,16 +4,16 @@ Test typed references to static properties <?php class Test { - public static int $x = 0; + public static int $x = 0; } class Test2 extends Test { - public static $y = 1; + public static $y = 1; } $x =& Test::$x; try { - $x = "foo"; + $x = "foo"; } catch (TypeError $e) { echo $e->getMessage(), "\n"; } var_dump($x, Test::$x); diff --git a/Zend/tests/type_declarations/typed_properties_084.phpt b/Zend/tests/type_declarations/typed_properties_084.phpt index fb3c86115e..f83be01d53 100644 --- a/Zend/tests/type_declarations/typed_properties_084.phpt +++ b/Zend/tests/type_declarations/typed_properties_084.phpt @@ -6,7 +6,7 @@ eval(<<<'PHP' class Foo {} class_alias('Foo', 'Bar'); PHP); - + eval(<<<'PHP' class A { public Foo $prop; diff --git a/Zend/tests/type_declarations/typed_properties_086.phpt b/Zend/tests/type_declarations/typed_properties_086.phpt index c58eb7898e..7c160dd9d0 100644 --- a/Zend/tests/type_declarations/typed_properties_086.phpt +++ b/Zend/tests/type_declarations/typed_properties_086.phpt @@ -4,9 +4,9 @@ Test typed properties with integer keys <?php class T { - // Class must have at least one property. Property must have a type. - // Empty class or untyped property removes segfault - public int $i; + // Class must have at least one property. Property must have a type. + // Empty class or untyped property removes segfault + public int $i; } $t = new T; diff --git a/Zend/tests/type_declarations/typed_properties_089.phpt b/Zend/tests/type_declarations/typed_properties_089.phpt index 1d59b8d945..92de4b64aa 100644 --- a/Zend/tests/type_declarations/typed_properties_089.phpt +++ b/Zend/tests/type_declarations/typed_properties_089.phpt @@ -4,17 +4,17 @@ Modification of typed property during assignment must not leak <?php class A { - public string $prop = ""; + public string $prop = ""; } class B { - public function __toString() { - global $a; - $a->prop = "dont "; - $a->prop .= "leak "; - $a->prop .= "me!"; - return "test"; - } + public function __toString() { + global $a; + $a->prop = "dont "; + $a->prop .= "leak "; + $a->prop .= "me!"; + return "test"; + } } $a = new A; diff --git a/Zend/tests/type_declarations/typed_properties_090.phpt b/Zend/tests/type_declarations/typed_properties_090.phpt index 3b75aaa843..97bd2ed523 100644 --- a/Zend/tests/type_declarations/typed_properties_090.phpt +++ b/Zend/tests/type_declarations/typed_properties_090.phpt @@ -4,17 +4,17 @@ Unsetting typed properties containing a reference must respect shadowing <?php class A { - private int $prop = 42; + private int $prop = 42; - public function test() { - $x =& $this->prop; - unset($this->prop); - $x = "foo"; - var_dump($x); - } + public function test() { + $x =& $this->prop; + unset($this->prop); + $x = "foo"; + var_dump($x); + } } class B extends A { - private $prop; + private $prop; } $b = new B; diff --git a/Zend/tests/type_declarations/typed_properties_100.phpt b/Zend/tests/type_declarations/typed_properties_100.phpt index 8ee3deb0f7..675b79a7df 100644 --- a/Zend/tests/type_declarations/typed_properties_100.phpt +++ b/Zend/tests/type_declarations/typed_properties_100.phpt @@ -2,7 +2,7 @@ Property type not enforced for __get if the property is not visible --FILE-- <?php - + class Test { private int $prop; diff --git a/Zend/tests/type_declarations/typed_properties_104.phpt b/Zend/tests/type_declarations/typed_properties_104.phpt index e7d69e3d7d..b9fe405b97 100644 --- a/Zend/tests/type_declarations/typed_properties_104.phpt +++ b/Zend/tests/type_declarations/typed_properties_104.phpt @@ -4,11 +4,11 @@ Uninitialized result of PRE_INC/PRE_DEC in case of exception <?php declare(strict_types=1); $o = new class { - public string $a = "123"; + public string $a = "123"; }; $x = & $o->a; try { - $ret = ++$x + 5; + $ret = ++$x + 5; } catch (TypeError $e) { } ?> diff --git a/Zend/tests/type_declarations/types_in_ast.phpt b/Zend/tests/type_declarations/types_in_ast.phpt index 54619c23b7..2e2fd212c7 100644 --- a/Zend/tests/type_declarations/types_in_ast.phpt +++ b/Zend/tests/type_declarations/types_in_ast.phpt @@ -6,11 +6,11 @@ assert.exception=0 --FILE-- <?php assert(0 && ($a = function (int $a, ?int $b, int $c = null): ?int { - $x = new class { - public $a; - public int $b; - public ?int $c; - }; + $x = new class { + public $a; + public int $b; + public ?int $c; + }; })); ?> --EXPECTF-- diff --git a/Zend/tests/type_declarations/union_types/multiple_classes.phpt b/Zend/tests/type_declarations/union_types/multiple_classes.phpt index aac56c6603..72d2e6c291 100644 --- a/Zend/tests/type_declarations/union_types/multiple_classes.phpt +++ b/Zend/tests/type_declarations/union_types/multiple_classes.phpt @@ -17,7 +17,7 @@ spl_autoload_register(function($class) { $test = new Test; -$test->prop = 42; +$test->prop = 42; var_dump($test->prop); var_dump($test->method(42)); diff --git a/Zend/tests/type_declarations/union_types/variance/invalid_004.phpt b/Zend/tests/type_declarations/union_types/variance/invalid_004.phpt index db16fecbac..3bcb6f9f55 100644 --- a/Zend/tests/type_declarations/union_types/variance/invalid_004.phpt +++ b/Zend/tests/type_declarations/union_types/variance/invalid_004.phpt @@ -7,7 +7,7 @@ class A { } class B extends A { public B $prop; -} +} ?> --EXPECTF-- Fatal error: Type of B::$prop must be X|B (as in class A) in %s on line %d diff --git a/Zend/tests/typehints/bug76198.phpt b/Zend/tests/typehints/bug76198.phpt index fcaefbbec3..8d71d02461 100644 --- a/Zend/tests/typehints/bug76198.phpt +++ b/Zend/tests/typehints/bug76198.phpt @@ -4,7 +4,7 @@ <?php function foo(): \iterable { - return []; + return []; } var_dump(foo()); diff --git a/Zend/tests/typehints/fully_qualified_scalar.phpt b/Zend/tests/typehints/fully_qualified_scalar.phpt index 84c9dee636..9fdfcb901c 100644 --- a/Zend/tests/typehints/fully_qualified_scalar.phpt +++ b/Zend/tests/typehints/fully_qualified_scalar.phpt @@ -4,7 +4,7 @@ Fully qualified (leading backslash) type names must fail <?php function foo(\int $foo) { - var_dump($foo); + var_dump($foo); } foo(1); diff --git a/Zend/tests/use_function/no_global_fallback2.phpt b/Zend/tests/use_function/no_global_fallback2.phpt index cf6026f56a..515c2e97ac 100644 --- a/Zend/tests/use_function/no_global_fallback2.phpt +++ b/Zend/tests/use_function/no_global_fallback2.phpt @@ -4,13 +4,13 @@ non-existent imported functions should not be looked up in the global table <?php namespace { - function test() { - echo "NO!"; - } + function test() { + echo "NO!"; + } } namespace foo { - use function bar\test; - test(); + use function bar\test; + test(); } ?> diff --git a/Zend/tests/variadic/optional_params.phpt b/Zend/tests/variadic/optional_params.phpt index ba800032d7..2c93d67151 100644 --- a/Zend/tests/variadic/optional_params.phpt +++ b/Zend/tests/variadic/optional_params.phpt @@ -6,7 +6,7 @@ Optional parameter before variadic parameter function f($reqParam, $optParam = null, ...$params) { var_dump($reqParam, $optParam, $params); } - + f(1); f(1, 2); f(1, 2, 3); diff --git a/Zend/tests/variadic/typehint_suppressed_error.phpt b/Zend/tests/variadic/typehint_suppressed_error.phpt index ebc44c38b1..e7906ea2f2 100644 --- a/Zend/tests/variadic/typehint_suppressed_error.phpt +++ b/Zend/tests/variadic/typehint_suppressed_error.phpt @@ -8,9 +8,9 @@ function test(array... $args) { } try { - test([0], [1], 2); + test([0], [1], 2); } catch(Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> diff --git a/Zend/tests/vm_stack_with_arg_extend.phpt b/Zend/tests/vm_stack_with_arg_extend.phpt index 10f3639d21..49f1f5b5c1 100644 --- a/Zend/tests/vm_stack_with_arg_extend.phpt +++ b/Zend/tests/vm_stack_with_arg_extend.phpt @@ -4,12 +4,12 @@ Ensure valid vm_stack even when it needed to be copied to a new page <?php function f(...$args) { - var_dump(count($args)); + var_dump(count($args)); } (function(){ - $a = array_fill(0, 1024, true); - f(...$a); - yield; + $a = array_fill(0, 1024, true); + f(...$a); + yield; })()->valid(); ?> diff --git a/Zend/tests/weakrefs/weakrefs_002.phpt b/Zend/tests/weakrefs/weakrefs_002.phpt index a2e277f98d..f550302aec 100644 --- a/Zend/tests/weakrefs/weakrefs_002.phpt +++ b/Zend/tests/weakrefs/weakrefs_002.phpt @@ -5,9 +5,9 @@ WeakReference serials $wr = WeakReference::create(new stdClass); try { - serialize($wr); + serialize($wr); } catch (Exception $ex) { - var_dump($ex->getMessage()); + var_dump($ex->getMessage()); } $wrs = 'O:13:"WeakReference":0:{}'; diff --git a/Zend/tests/weakrefs/weakrefs_003.phpt b/Zend/tests/weakrefs/weakrefs_003.phpt index e7d8e281c5..66dc932372 100644 --- a/Zend/tests/weakrefs/weakrefs_003.phpt +++ b/Zend/tests/weakrefs/weakrefs_003.phpt @@ -5,33 +5,33 @@ WeakReference object handlers $wr = WeakReference::create(new stdClass); try { - $wr->disallow; + $wr->disallow; } catch (Error $ex) { - var_dump($ex->getMessage()); + var_dump($ex->getMessage()); } try { - $wr->disallow = "writes"; + $wr->disallow = "writes"; } catch (Error $ex) { - var_dump($ex->getMessage()); + var_dump($ex->getMessage()); } try { - isset($wr->disallow); + isset($wr->disallow); } catch (Error $ex) { - var_dump($ex->getMessage()); + var_dump($ex->getMessage()); } try { - unset($wr->disallow); + unset($wr->disallow); } catch (Error $ex) { - var_dump($ex->getMessage()); + var_dump($ex->getMessage()); } try { - $disallow = &$wr->disallowed; + $disallow = &$wr->disallowed; } catch (Error $ex) { - var_dump($ex->getMessage()); + var_dump($ex->getMessage()); } ?> --EXPECT-- diff --git a/Zend/tests/zend_signed_multiply-64bit-2.phpt b/Zend/tests/zend_signed_multiply-64bit-2.phpt index aa8ee47db6..ff0e88a78d 100644 --- a/Zend/tests/zend_signed_multiply-64bit-2.phpt +++ b/Zend/tests/zend_signed_multiply-64bit-2.phpt @@ -6,11 +6,11 @@ Zend signed multiply 64-bit, variation 2 <?php for($c = -16; $c < 0; $c++) { var_dump($c, intdiv(PHP_INT_MIN, 10), intdiv(PHP_INT_MIN, 10) * $c); - echo "-----------\n"; + echo "-----------\n"; } for($c = 0; $c <= 16; $c++) { var_dump($c, intdiv(PHP_INT_MAX, 10), intdiv(PHP_INT_MAX, 10) * $c); - echo "-----------\n"; + echo "-----------\n"; } ?> --EXPECT-- diff --git a/ext/bz2/tests/bug71263.phpt b/ext/bz2/tests/bug71263.phpt index d5c3ff91da..108469a293 100644 --- a/ext/bz2/tests/bug71263.phpt +++ b/ext/bz2/tests/bug71263.phpt @@ -8,11 +8,11 @@ Bug #71263: fread() does not detects decoding errors from filter bzip2.decompres // Should notices be generated? function test($case) { - $plain = "The quick brown fox jumps over the lazy dog."; - $fn = "bug71263.bz2"; - $compressed = (string) bzcompress($plain); - echo "Compressed len = ", strlen($compressed), "\n"; - + $plain = "The quick brown fox jumps over the lazy dog."; + $fn = "bug71263.bz2"; + $compressed = (string) bzcompress($plain); + echo "Compressed len = ", strlen($compressed), "\n"; + if ($case == 1) { // Set a random byte in the middle of the compressed data // --> php_bz2_decompress_filter() detects fatal error @@ -22,24 +22,24 @@ function test($case) { // Truncate the compressed data // --> php_bz2_decompress_filter() does not detect errors, // --> fread() displays the empty string: - $compressed = substr($compressed, 0, strlen($compressed) - 20); + $compressed = substr($compressed, 0, strlen($compressed) - 20); } else { // Corrupted final CRC // --> php_bz2_decompress_filter() detects fatal error // --> fread() displays an empty string, then the correct plain text, no error detected: - $compressed[strlen($compressed)-2] = 'X'; + $compressed[strlen($compressed)-2] = 'X'; } - file_put_contents($fn, $compressed); - - $r = fopen($fn, "r"); - stream_filter_append($r, 'bzip2.decompress', STREAM_FILTER_READ); + file_put_contents($fn, $compressed); + + $r = fopen($fn, "r"); + stream_filter_append($r, 'bzip2.decompress', STREAM_FILTER_READ); while (!feof($r)) { $s = fread($r, 100); echo "read: "; var_dump($s); } - fclose($r); - unlink($fn); + fclose($r); + unlink($fn); } test(1); diff --git a/ext/calendar/tests/jdtogregorian_overflow.phpt b/ext/calendar/tests/jdtogregorian_overflow.phpt index 28f5298e19..9d4a1d6b4d 100644 --- a/ext/calendar/tests/jdtogregorian_overflow.phpt +++ b/ext/calendar/tests/jdtogregorian_overflow.phpt @@ -10,7 +10,7 @@ if (PHP_INT_SIZE != 4) die('skip this test is for 32bit platforms only'); --FILE-- <?php for ($i=536838860; $i<536838870; $i++) { - echo $i, ':', jdtogregorian($i), PHP_EOL; + echo $i, ':', jdtogregorian($i), PHP_EOL; } echo 'DONE', PHP_EOL; ?> diff --git a/ext/calendar/tests/jdtojewish.phpt b/ext/calendar/tests/jdtojewish.phpt index 84f9565430..4fd104c50c 100644 --- a/ext/calendar/tests/jdtojewish.phpt +++ b/ext/calendar/tests/jdtojewish.phpt @@ -6,24 +6,24 @@ jdtojewish() function <?php var_dump(jdtojewish(gregoriantojd(10,28,2002))."\r\n". - jdtojewish(gregoriantojd(10,28,2002),true)."\r\n". - jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". - jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM)."\r\n". - jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM_GERESH+CAL_JEWISH_ADD_ALAFIM)."\r\n". - jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n". - jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n". - jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". - jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM)."\r\n". - jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". - jdtojewish(gregoriantojd(3,10,2007))."\r\n"); + jdtojewish(gregoriantojd(10,28,2002),true)."\r\n". + jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". + jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM)."\r\n". + jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM_GERESH+CAL_JEWISH_ADD_ALAFIM)."\r\n". + jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n". + jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n". + jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". + jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM)."\r\n". + jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". + jdtojewish(gregoriantojd(3,10,2007))."\r\n"); echo jdtojewish(gregoriantojd(11,5,2002)) . "\n"; echo jdtojewish(gregoriantojd(11,29,2004)) . "\n"; echo jdtojewish(gregoriantojd(1,1,9998)) . "\n"; try { - jdtojewish(gregoriantojd(1,1,9998),true); + jdtojewish(gregoriantojd(1,1,9998),true); } catch (ValueError $ex) { - echo "{$ex->getMessage()}\n"; + echo "{$ex->getMessage()}\n"; } ?> --EXPECTF-- diff --git a/ext/calendar/tests/jdtojewish_overflow.phpt b/ext/calendar/tests/jdtojewish_overflow.phpt index 1d1c2eefb9..17a47e06e1 100644 --- a/ext/calendar/tests/jdtojewish_overflow.phpt +++ b/ext/calendar/tests/jdtojewish_overflow.phpt @@ -9,7 +9,7 @@ if (!extension_loaded('calendar')) die('skip ext/calendar required'); --FILE-- <?php for ($i=324542840; $i<324542850; $i++) { - echo $i, ':', jdtojewish($i), PHP_EOL; + echo $i, ':', jdtojewish($i), PHP_EOL; } echo 'DONE', PHP_EOL; ?> diff --git a/ext/calendar/tests/jdtomonthname.phpt b/ext/calendar/tests/jdtomonthname.phpt index c7fa6cc774..004c219bf9 100644 --- a/ext/calendar/tests/jdtomonthname.phpt +++ b/ext/calendar/tests/jdtomonthname.phpt @@ -13,14 +13,14 @@ $jd_days = Array( ); foreach ($jd_days as $jd_day) { - echo "=== ", $jd_day, "\n"; + echo "=== ", $jd_day, "\n"; var_dump(jdmonthname($jd_day,0)); var_dump(jdmonthname($jd_day,1)); var_dump(jdmonthname($jd_day,2)); var_dump(jdmonthname($jd_day,3)); var_dump(jdmonthname($jd_day,4)); var_dump(jdmonthname($jd_day,5)); - echo "\n"; + echo "\n"; } echo "Done\n"; diff --git a/ext/calendar/tests/skipif.inc b/ext/calendar/tests/skipif.inc index 71cdc73630..e867fafd29 100644 --- a/ext/calendar/tests/skipif.inc +++ b/ext/calendar/tests/skipif.inc @@ -1,4 +1,4 @@ <?php if(!extension_loaded("calendar")) - print "skip - CALENDAR extension not available"; + print "skip - CALENDAR extension not available"; ?> diff --git a/ext/calendar/tests/unixtojd.phpt b/ext/calendar/tests/unixtojd.phpt index 01b3773007..28a05c0c6f 100644 --- a/ext/calendar/tests/unixtojd.phpt +++ b/ext/calendar/tests/unixtojd.phpt @@ -13,7 +13,7 @@ putenv('TZ=UTC'); // -adding a call direct to GetEnvironmentVariableA just before tzset() is called to check the value of 'TZ' returns 'UTC' // putting a call to date_default_timezone_set() here doesn't help // -// on Windows, the only thing that gets this test to pass is to put TZ=UTC in --ENV-- section +// on Windows, the only thing that gets this test to pass is to put TZ=UTC in--ENV-- section // -since putenv() is written to call tzset() when env var is TZ, I assume that putenv("TZ=UTC") is intended to work // and should work on all platforms(including Windows). // easter_date.phpt passes diff --git a/ext/com_dotnet/tests/27974.phpt b/ext/com_dotnet/tests/27974.phpt index 960a630304..c76dda9ed5 100644 --- a/ext/com_dotnet/tests/27974.phpt +++ b/ext/com_dotnet/tests/27974.phpt @@ -8,26 +8,26 @@ if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; error_reporting(E_ALL); try { - $v = new VARIANT(array("123", "456", "789")); - var_dump($v); - print $v[0] . "\n"; - print $v[1] . "\n"; - print $v[2] . "\n"; - $v[1] = "hello"; - foreach ($v as $item) { - var_dump($item); - } - try { - $v[3] = "shouldn't work"; - } catch (com_exception $e) { - if ($e->getCode() != DISP_E_BADINDEX) { - throw $e; - } - echo "Got BADINDEX exception OK!\n"; - } - echo "OK!"; + $v = new VARIANT(array("123", "456", "789")); + var_dump($v); + print $v[0] . "\n"; + print $v[1] . "\n"; + print $v[2] . "\n"; + $v[1] = "hello"; + foreach ($v as $item) { + var_dump($item); + } + try { + $v[3] = "shouldn't work"; + } catch (com_exception $e) { + if ($e->getCode() != DISP_E_BADINDEX) { + throw $e; + } + echo "Got BADINDEX exception OK!\n"; + } + echo "OK!"; } catch (Exception $e) { - print $e; + print $e; } ?> --EXPECT-- diff --git a/ext/com_dotnet/tests/bug33386.phpt b/ext/com_dotnet/tests/bug33386.phpt index 102e69749b..7f305d2eb5 100644 --- a/ext/com_dotnet/tests/bug33386.phpt +++ b/ext/com_dotnet/tests/bug33386.phpt @@ -15,22 +15,22 @@ class twoFuncs { } try { - $ciTF = new twoFuncs; + $ciTF = new twoFuncs; - $oScript = new COM("MSScriptControl.ScriptControl"); - $oScript->Language = "VBScript"; + $oScript = new COM("MSScriptControl.ScriptControl"); + $oScript->Language = "VBScript"; - $oScript->AddObject ("tfA", $ciTF, true); - foreach (array(1,2) as $i) { - $oScript->ExecuteStatement ("tfA.func$i"); - $oScript->ExecuteStatement ("func$i"); - } - $oScript->AddObject ("tfB", $ciTF); - foreach (array(1,2) as $i) { - $oScript->ExecuteStatement ("tfB.func$i"); - } + $oScript->AddObject ("tfA", $ciTF, true); + foreach (array(1,2) as $i) { + $oScript->ExecuteStatement ("tfA.func$i"); + $oScript->ExecuteStatement ("func$i"); + } + $oScript->AddObject ("tfB", $ciTF); + foreach (array(1,2) as $i) { + $oScript->ExecuteStatement ("tfB.func$i"); + } } catch (Exception $e) { - print $e; + print $e; } ?> --EXPECT-- diff --git a/ext/com_dotnet/tests/bug34272.phpt b/ext/com_dotnet/tests/bug34272.phpt index feb63c93c3..ce8a552dfd 100644 --- a/ext/com_dotnet/tests/bug34272.phpt +++ b/ext/com_dotnet/tests/bug34272.phpt @@ -8,13 +8,13 @@ if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; error_reporting(E_ALL); try { - $dict = new COM("Scripting.Dictionary"); - $dict->add('foo', array()); - print sizeof($dict['foo'])."\n"; - $dict->add('bar', array(23)); - print sizeof($dict['bar'])." \n"; + $dict = new COM("Scripting.Dictionary"); + $dict->add('foo', array()); + print sizeof($dict['foo'])."\n"; + $dict->add('bar', array(23)); + print sizeof($dict['bar'])." \n"; } catch (Exception $e) { - print $e; + print $e; } ?> --EXPECT-- diff --git a/ext/com_dotnet/tests/bug39596.phpt b/ext/com_dotnet/tests/bug39596.phpt index bd89326560..1510db49cf 100644 --- a/ext/com_dotnet/tests/bug39596.phpt +++ b/ext/com_dotnet/tests/bug39596.phpt @@ -8,13 +8,13 @@ if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; error_reporting(E_ALL); try { - $binding_string = array('aaa','bbb','ccc'); - $v = new VARIANT( $binding_string, VT_ARRAY ); - foreach ($v AS $element) { - print $element."\n"; - } + $binding_string = array('aaa','bbb','ccc'); + $v = new VARIANT( $binding_string, VT_ARRAY ); + foreach ($v AS $element) { + print $element."\n"; + } } catch (Exception $e) { - print $e; + print $e; } ?> --EXPECT-- diff --git a/ext/com_dotnet/tests/bug66431_0.phpt b/ext/com_dotnet/tests/bug66431_0.phpt index b9759f51c0..4a0062a7e1 100644 --- a/ext/com_dotnet/tests/bug66431_0.phpt +++ b/ext/com_dotnet/tests/bug66431_0.phpt @@ -22,8 +22,8 @@ $result = ($check_text == $text); var_dump($result); if (!$result) { - echo "Expected: '$check_text'\n"; - echo "Have: '$text'\n"; + echo "Expected: '$check_text'\n"; + echo "Have: '$text'\n"; } ?> diff --git a/ext/com_dotnet/tests/bug66431_1.phpt b/ext/com_dotnet/tests/bug66431_1.phpt index 1dc208f290..e99131d27b 100644 --- a/ext/com_dotnet/tests/bug66431_1.phpt +++ b/ext/com_dotnet/tests/bug66431_1.phpt @@ -40,8 +40,8 @@ $result = (trim($check_text) == $text); var_dump($result); if (!$result) { - echo "Expected: '$check_text'\n"; - echo "Have: '$text'\n"; + echo "Expected: '$check_text'\n"; + echo "Have: '$text'\n"; } ?> diff --git a/ext/com_dotnet/tests/variants.phpt b/ext/com_dotnet/tests/variants.phpt index a99e896680..0bcd473f61 100644 --- a/ext/com_dotnet/tests/variants.phpt +++ b/ext/com_dotnet/tests/variants.phpt @@ -10,34 +10,34 @@ error_reporting(E_ALL); $v = new VARIANT(); if (VT_EMPTY != variant_get_type($v)) { - echo "VT_EMPTY: bork\n"; + echo "VT_EMPTY: bork\n"; } $values = array(VT_I4 => 42, VT_R8 => 3.5, VT_BSTR => "hello", VT_BOOL => false); $binary_ops = array('add', 'cat', 'sub', 'mul', 'and', 'div', - 'eqv', 'idiv', 'imp', 'mod', 'or', 'pow', 'xor'); + 'eqv', 'idiv', 'imp', 'mod', 'or', 'pow', 'xor'); foreach ($values as $t => $val) { - $v = new VARIANT($val); - if ($t != variant_get_type($v)) { - printf("Bork: [%d] %d: %s\n", $t, variant_get_type($v), $val); - print $v . "\n"; - } - $results = array(); - - foreach ($values as $op2) { - echo "--\n"; - foreach ($binary_ops as $op) { - try { - echo "$op: " . call_user_func('variant_' . $op, $v, $op2) . "\n"; - } catch (com_exception $e) { - echo "$op:\n"; - echo "\tvariant_$op($v, $op2)\n"; - echo "\texception " . $e->getMessage(); - printf("\tcode %08x\n\n", $e->getCode()); - } - } - } + $v = new VARIANT($val); + if ($t != variant_get_type($v)) { + printf("Bork: [%d] %d: %s\n", $t, variant_get_type($v), $val); + print $v . "\n"; + } + $results = array(); + + foreach ($values as $op2) { + echo "--\n"; + foreach ($binary_ops as $op) { + try { + echo "$op: " . call_user_func('variant_' . $op, $v, $op2) . "\n"; + } catch (com_exception $e) { + echo "$op:\n"; + echo "\tvariant_$op($v, $op2)\n"; + echo "\texception " . $e->getMessage(); + printf("\tcode %08x\n\n", $e->getCode()); + } + } + } } echo "OK!"; diff --git a/ext/com_dotnet/tests/variants_x64.phpt b/ext/com_dotnet/tests/variants_x64.phpt index e9e7c23b97..88f9f3e126 100644 --- a/ext/com_dotnet/tests/variants_x64.phpt +++ b/ext/com_dotnet/tests/variants_x64.phpt @@ -13,34 +13,34 @@ error_reporting(E_ALL); $v = new VARIANT(); if (VT_EMPTY != variant_get_type($v)) { - echo "VT_EMPTY: bork\n"; + echo "VT_EMPTY: bork\n"; } $values = array(VT_I8 => 42, VT_R8 => 3.5, VT_BSTR => "hello", VT_BOOL => false); $binary_ops = array('add', 'cat', 'sub', 'mul', 'and', 'div', - 'eqv', 'idiv', 'imp', 'mod', 'or', 'pow', 'xor'); + 'eqv', 'idiv', 'imp', 'mod', 'or', 'pow', 'xor'); foreach ($values as $t => $val) { - $v = new VARIANT($val); - if ($t != variant_get_type($v)) { - printf("Bork: [%d] %d: %s\n", $t, variant_get_type($v), $val); - print $v . "\n"; - } - $results = array(); - - foreach ($values as $op2) { - echo "--\n"; - foreach ($binary_ops as $op) { - try { - echo "$op: " . call_user_func('variant_' . $op, $v, $op2) . "\n"; - } catch (com_exception $e) { - echo "$op:\n"; - echo "\tvariant_$op($v, $op2)\n"; - echo "\texception " . $e->getMessage(); - printf("\tcode %08x\n\n", $e->getCode()); - } - } - } + $v = new VARIANT($val); + if ($t != variant_get_type($v)) { + printf("Bork: [%d] %d: %s\n", $t, variant_get_type($v), $val); + print $v . "\n"; + } + $results = array(); + + foreach ($values as $op2) { + echo "--\n"; + foreach ($binary_ops as $op) { + try { + echo "$op: " . call_user_func('variant_' . $op, $v, $op2) . "\n"; + } catch (com_exception $e) { + echo "$op:\n"; + echo "\tvariant_$op($v, $op2)\n"; + echo "\texception " . $e->getMessage(); + printf("\tcode %08x\n\n", $e->getCode()); + } + } + } } echo "OK!"; diff --git a/ext/ctype/tests/001.phpt b/ext/ctype/tests/001.phpt index edb1f52ab0..1351faed94 100644 --- a/ext/ctype/tests/001.phpt +++ b/ext/ctype/tests/001.phpt @@ -9,9 +9,9 @@ ctype on integers function ctype_test_001($function) { $n=0; for($a=0;$a<256;$a++) { - if($function($a)) $n++; + if($function($a)) $n++; } - echo "$function $n\n"; + echo "$function $n\n"; } ctype_test_001("ctype_lower"); ctype_test_001("ctype_upper"); diff --git a/ext/ctype/tests/002.phpt b/ext/ctype/tests/002.phpt index e949db3992..b1dd87f306 100644 --- a/ext/ctype/tests/002.phpt +++ b/ext/ctype/tests/002.phpt @@ -9,15 +9,15 @@ setlocale(LC_ALL,"C"); print "LOCALE is '" . setlocale(LC_ALL,0) . "'\n"; function ctype_test_002($function) { - $n1 = $n2 = $n3 = 0; - // test portable POSIX characters 0..127 - for ($a=0;$a<128;$a++) { - $c = chr($a); - if($function($a)) $n1++; - if($function("$c$c$c")) $n2++; - if($function("1-$c$c$c-x")) $n3++; - } - print "$function $n1 $n2 $n3\n"; + $n1 = $n2 = $n3 = 0; + // test portable POSIX characters 0..127 + for ($a=0;$a<128;$a++) { + $c = chr($a); + if($function($a)) $n1++; + if($function("$c$c$c")) $n2++; + if($function("1-$c$c$c-x")) $n3++; + } + print "$function $n1 $n2 $n3\n"; } ctype_test_002("ctype_lower"); diff --git a/ext/ctype/tests/bug25745.phpt b/ext/ctype/tests/bug25745.phpt index ecacebbed6..3996dd8242 100644 --- a/ext/ctype/tests/bug25745.phpt +++ b/ext/ctype/tests/bug25745.phpt @@ -5,20 +5,20 @@ Bug #25745 (ctype functions fail with non-ascii characters) --FILE-- <?php $funcs = array( - "ctype_alnum", "ctype_alpha", "ctype_cntrl", "ctype_digit", - "ctype_graph", "ctype_lower", "ctype_print", "ctype_punct", - "ctype_space", "ctype_upper", "ctype_xdigit" + "ctype_alnum", "ctype_alpha", "ctype_cntrl", "ctype_digit", + "ctype_graph", "ctype_lower", "ctype_print", "ctype_punct", + "ctype_space", "ctype_upper", "ctype_xdigit" ); foreach ($funcs as $ctype_func) { - for ($i = 0; $i < 256; $i++) { - $a = $ctype_func($i); - $b = $ctype_func(chr($i)); - if ($a != $b) { - echo "broken... $ctype_func($i) = $a, $ctype_func(chr($i)) = $b\n"; - exit; - } - } + for ($i = 0; $i < 256; $i++) { + $a = $ctype_func($i); + $b = $ctype_func(chr($i)); + if ($a != $b) { + echo "broken... $ctype_func($i) = $a, $ctype_func(chr($i)) = $b\n"; + exit; + } + } } echo "ok\n"; ?> diff --git a/ext/ctype/tests/ctype_alnum_variation2.phpt b/ext/ctype/tests/ctype_alnum_variation2.phpt index 625c5a6d89..0898190d17 100644 --- a/ext/ctype/tests/ctype_alnum_variation2.phpt +++ b/ext/ctype/tests/ctype_alnum_variation2.phpt @@ -19,9 +19,9 @@ echo "*** Testing ctype_alnum() : usage variations ***\n"; $orig = setlocale(LC_CTYPE, "C"); for ($i = 0; $i < 256; $i++) { - if (ctype_alnum($i)) { - echo "character code $i is alpha numeric\n"; - } + if (ctype_alnum($i)) { + echo "character code $i is alpha numeric\n"; + } } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_alnum_variation4.phpt b/ext/ctype/tests/ctype_alnum_variation4.phpt index 1b5bcb93ce..64c6175806 100644 --- a/ext/ctype/tests/ctype_alnum_variation4.phpt +++ b/ext/ctype/tests/ctype_alnum_variation4.phpt @@ -23,17 +23,17 @@ $hex_values = array(0x30, 0x31, 0x32, 0x33); echo "\n-- Octal Values --\n"; $iterator = 1; foreach($octal_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_alnum($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_alnum($c)); + $iterator++; } echo "\n-- Hexadecimal Values --\n"; $iterator = 1; foreach($hex_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_alnum($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_alnum($c)); + $iterator++; } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_alpha_variation1.phpt b/ext/ctype/tests/ctype_alpha_variation1.phpt index d212497513..e96256df98 100644 --- a/ext/ctype/tests/ctype_alpha_variation1.phpt +++ b/ext/ctype/tests/ctype_alpha_variation1.phpt @@ -24,9 +24,9 @@ unset ($unset_var); // get a class class classA { - public function __toString() { - return "abcdef"; - } + public function __toString() { + return "abcdef"; + } } // heredoc string diff --git a/ext/ctype/tests/ctype_alpha_variation2.phpt b/ext/ctype/tests/ctype_alpha_variation2.phpt index d9c1fa361a..89777f9813 100644 --- a/ext/ctype/tests/ctype_alpha_variation2.phpt +++ b/ext/ctype/tests/ctype_alpha_variation2.phpt @@ -19,9 +19,9 @@ echo "*** Testing ctype_alpha() : usage variations ***\n"; $orig = setlocale(LC_CTYPE, "C"); for ($i = 0; $i < 256; $i++) { - if (ctype_alpha($i)) { - echo "character code $i is alphabetic\n"; - } + if (ctype_alpha($i)) { + echo "character code $i is alphabetic\n"; + } } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_alpha_variation4.phpt b/ext/ctype/tests/ctype_alpha_variation4.phpt index fc3cecd21b..ba801c6845 100644 --- a/ext/ctype/tests/ctype_alpha_variation4.phpt +++ b/ext/ctype/tests/ctype_alpha_variation4.phpt @@ -23,17 +23,17 @@ $hex_values = array (0x41, 0x42, 0x43, 0x44); echo "\n-- Octal Values --\n"; $iterator = 1; foreach($octal_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_alpha($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_alpha($c)); + $iterator++; } echo "\n-- Hexadecimal Values --\n"; $iterator = 1; foreach($hex_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_alpha($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_alpha($c)); + $iterator++; } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_cntrl_variation2.phpt b/ext/ctype/tests/ctype_cntrl_variation2.phpt index 2a5caecca9..411666608f 100644 --- a/ext/ctype/tests/ctype_cntrl_variation2.phpt +++ b/ext/ctype/tests/ctype_cntrl_variation2.phpt @@ -19,9 +19,9 @@ echo "*** Testing ctype_cntrl() : usage variations ***\n"; $orig = setlocale(LC_CTYPE, "C"); for ($i = 0; $i < 256; $i++) { - if (ctype_cntrl($i)) { - echo "character code $i is control character\n"; - } + if (ctype_cntrl($i)) { + echo "character code $i is control character\n"; + } } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_cntrl_variation4.phpt b/ext/ctype/tests/ctype_cntrl_variation4.phpt index 0ec3e8f4f6..0a2e1260df 100644 --- a/ext/ctype/tests/ctype_cntrl_variation4.phpt +++ b/ext/ctype/tests/ctype_cntrl_variation4.phpt @@ -23,17 +23,17 @@ $hex_values = array(0x1, 0x2, 0x3, 0x4); echo "\n-- Octal Values --\n"; $iterator = 1; foreach($octal_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_cntrl($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_cntrl($c)); + $iterator++; } echo "\n-- Hexadecimal Values --\n"; $iterator = 1; foreach($hex_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_cntrl($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_cntrl($c)); + $iterator++; } setlocale(LC_CTYPE, $orig); ?> diff --git a/ext/ctype/tests/ctype_digit_variation1.phpt b/ext/ctype/tests/ctype_digit_variation1.phpt index 8cb85ab560..77ddc21ce4 100644 --- a/ext/ctype/tests/ctype_digit_variation1.phpt +++ b/ext/ctype/tests/ctype_digit_variation1.phpt @@ -24,9 +24,9 @@ unset ($unset_var); // get a class class classA { - public function __toString() { - return "123456"; - } + public function __toString() { + return "123456"; + } } // heredoc string diff --git a/ext/ctype/tests/ctype_digit_variation2.phpt b/ext/ctype/tests/ctype_digit_variation2.phpt index cebdcd062f..9b5c1fb679 100644 --- a/ext/ctype/tests/ctype_digit_variation2.phpt +++ b/ext/ctype/tests/ctype_digit_variation2.phpt @@ -19,9 +19,9 @@ echo "*** Testing ctype_digit() : usage variations ***\n"; $orig = setlocale(LC_CTYPE, "C"); for ($i = 0; $i < 256; $i++) { - if (ctype_digit($i)) { - echo "character code $i is a numeric digit\n"; - } + if (ctype_digit($i)) { + echo "character code $i is a numeric digit\n"; + } } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_digit_variation4.phpt b/ext/ctype/tests/ctype_digit_variation4.phpt index ca89d1641f..2c87759ddd 100644 --- a/ext/ctype/tests/ctype_digit_variation4.phpt +++ b/ext/ctype/tests/ctype_digit_variation4.phpt @@ -23,17 +23,17 @@ $hex_values = array (0x31, 0x32, 0x33, 0x34); echo "\n-- Octal Values --\n"; $iterator = 1; foreach($octal_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_digit($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_digit($c)); + $iterator++; } echo "\n-- Hexadecimal Values --\n"; $iterator = 1; foreach($hex_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_digit($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_digit($c)); + $iterator++; } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_graph_variation1.phpt b/ext/ctype/tests/ctype_graph_variation1.phpt index 097c247a22..2fb529ee88 100644 --- a/ext/ctype/tests/ctype_graph_variation1.phpt +++ b/ext/ctype/tests/ctype_graph_variation1.phpt @@ -24,9 +24,9 @@ unset ($unset_var); // get a class class classA { - public function __toString() { - return "myClass"; - } + public function __toString() { + return "myClass"; + } } // heredoc string diff --git a/ext/ctype/tests/ctype_graph_variation2.phpt b/ext/ctype/tests/ctype_graph_variation2.phpt index 731e3ad9ac..3c21133279 100644 --- a/ext/ctype/tests/ctype_graph_variation2.phpt +++ b/ext/ctype/tests/ctype_graph_variation2.phpt @@ -19,9 +19,9 @@ echo "*** Testing ctype_graph() : usage variations ***\n"; $orig = setlocale(LC_CTYPE, "C"); for ($i = 0; $i < 256; $i++) { - if (ctype_graph($i)) { - echo "character code $i is a printable character\n"; - } + if (ctype_graph($i)) { + echo "character code $i is a printable character\n"; + } } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_graph_variation4.phpt b/ext/ctype/tests/ctype_graph_variation4.phpt index a60ee0c70d..3b3b028002 100644 --- a/ext/ctype/tests/ctype_graph_variation4.phpt +++ b/ext/ctype/tests/ctype_graph_variation4.phpt @@ -23,17 +23,17 @@ $hex_values = array (0x31, 0x32, 0x33, 0x34); echo "\n-- Octal Values --\n"; $iterator = 1; foreach($octal_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_graph($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_graph($c)); + $iterator++; } echo "\n-- Hexadecimal Values --\n"; $iterator = 1; foreach($hex_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_graph($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_graph($c)); + $iterator++; } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_lower_variation1.phpt b/ext/ctype/tests/ctype_lower_variation1.phpt index 919995dfe4..94ff0f1654 100644 --- a/ext/ctype/tests/ctype_lower_variation1.phpt +++ b/ext/ctype/tests/ctype_lower_variation1.phpt @@ -24,9 +24,9 @@ unset ($unset_var); // get a class class classA { - public function __toString() { - return "class"; - } + public function __toString() { + return "class"; + } } // heredoc string @@ -89,9 +89,9 @@ $inputs = array( // loop through each element of $inputs to check the behavior of ctype_lower() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( ctype_lower($input) ); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump( ctype_lower($input) ); + $iterator++; }; fclose($fp); diff --git a/ext/ctype/tests/ctype_lower_variation2.phpt b/ext/ctype/tests/ctype_lower_variation2.phpt index b225eafaff..ca96134b88 100644 --- a/ext/ctype/tests/ctype_lower_variation2.phpt +++ b/ext/ctype/tests/ctype_lower_variation2.phpt @@ -19,9 +19,9 @@ echo "*** Testing ctype_lower() : usage variations ***\n"; $orig = setlocale(LC_CTYPE, "C"); for ($i = 0; $i < 256; $i++) { - if (ctype_lower($i)) { - echo "character code $i is a lower case character\n"; - } + if (ctype_lower($i)) { + echo "character code $i is a lower case character\n"; + } } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_lower_variation4.phpt b/ext/ctype/tests/ctype_lower_variation4.phpt index 8571ff033c..a47074ed20 100644 --- a/ext/ctype/tests/ctype_lower_variation4.phpt +++ b/ext/ctype/tests/ctype_lower_variation4.phpt @@ -23,17 +23,17 @@ $hex_values = array (0x61, 0x62, 0x63, 0x64); echo "\n-- Octal Values --\n"; $iterator = 1; foreach($octal_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_lower($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_lower($c)); + $iterator++; } echo "\n-- Hexadecimal Values --\n"; $iterator = 1; foreach($hex_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_lower($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_lower($c)); + $iterator++; } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_print_variation1.phpt b/ext/ctype/tests/ctype_print_variation1.phpt index 2ce20bea87..3e4bef3e53 100644 --- a/ext/ctype/tests/ctype_print_variation1.phpt +++ b/ext/ctype/tests/ctype_print_variation1.phpt @@ -24,9 +24,9 @@ unset ($unset_var); // get a class class classA { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } // heredoc string diff --git a/ext/ctype/tests/ctype_print_variation2.phpt b/ext/ctype/tests/ctype_print_variation2.phpt index 8f2eb47b21..c2151fa34c 100644 --- a/ext/ctype/tests/ctype_print_variation2.phpt +++ b/ext/ctype/tests/ctype_print_variation2.phpt @@ -19,9 +19,9 @@ echo "*** Testing ctype_print() : usage variations ***\n"; $orig = setlocale(LC_CTYPE, "C"); for ($i = 0; $i < 256; $i++) { - if (ctype_print($i)) { - echo "character code $i is a printable character\n"; - } + if (ctype_print($i)) { + echo "character code $i is a printable character\n"; + } } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_print_variation4.phpt b/ext/ctype/tests/ctype_print_variation4.phpt index 9a0ae90323..05cfe8fbde 100644 --- a/ext/ctype/tests/ctype_print_variation4.phpt +++ b/ext/ctype/tests/ctype_print_variation4.phpt @@ -23,17 +23,17 @@ $hex_values = array (0x20, 0x21, 0x23, 0x24); echo "\n-- Octal Values --\n"; $iterator = 1; foreach($octal_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_print($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_print($c)); + $iterator++; } echo "\n-- Hexadecimal Values --\n"; $iterator = 1; foreach($hex_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_print($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_print($c)); + $iterator++; } setlocale(LC_CTYPE, $orig); ?> diff --git a/ext/ctype/tests/ctype_punct_variation2.phpt b/ext/ctype/tests/ctype_punct_variation2.phpt index ce7270c6bd..9fcfef0e21 100644 --- a/ext/ctype/tests/ctype_punct_variation2.phpt +++ b/ext/ctype/tests/ctype_punct_variation2.phpt @@ -20,9 +20,9 @@ echo "*** Testing ctype_punct() : usage variations ***\n"; $orig = setlocale(LC_CTYPE, "C"); for ($c = 1; $c < 256; $c++) { - if (ctype_punct($c)) { - echo "character code $c is punctuation\n"; - } + if (ctype_punct($c)) { + echo "character code $c is punctuation\n"; + } } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_punct_variation4.phpt b/ext/ctype/tests/ctype_punct_variation4.phpt index c99f82c849..e96c12568e 100644 --- a/ext/ctype/tests/ctype_punct_variation4.phpt +++ b/ext/ctype/tests/ctype_punct_variation4.phpt @@ -24,17 +24,17 @@ $hex_values = array(0x21, 0x22, 0x23, 0x24); echo "\n-- Octal Values --\n"; $iterator = 1; foreach($octal_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_punct($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_punct($c)); + $iterator++; } echo "\n-- Hexadecimal Values --\n"; $iterator = 1; foreach($hex_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_punct($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_punct($c)); + $iterator++; } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_space_variation1.phpt b/ext/ctype/tests/ctype_space_variation1.phpt index d3920b69c2..7d16cd445e 100644 --- a/ext/ctype/tests/ctype_space_variation1.phpt +++ b/ext/ctype/tests/ctype_space_variation1.phpt @@ -24,9 +24,9 @@ unset ($unset_var); // get a class class classA { - public function __toString() { - return "\n\t\r"; - } + public function __toString() { + return "\n\t\r"; + } } // heredoc string @@ -89,9 +89,9 @@ $inputs = array( // loop through each element of $inputs to check the behavior of ctype_space() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( ctype_space($input) ); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump( ctype_space($input) ); + $iterator++; } fclose($fp); diff --git a/ext/ctype/tests/ctype_space_variation2.phpt b/ext/ctype/tests/ctype_space_variation2.phpt index 901a575611..f11611d420 100644 --- a/ext/ctype/tests/ctype_space_variation2.phpt +++ b/ext/ctype/tests/ctype_space_variation2.phpt @@ -19,9 +19,9 @@ echo "*** Testing ctype_space() : usage variations ***\n"; $orig = setlocale(LC_CTYPE, "C"); for ($c = 1; $c < 256; $c++) { - if (ctype_space($c)) { - echo "character code $c is a space character\n"; - } + if (ctype_space($c)) { + echo "character code $c is a space character\n"; + } } setlocale(LC_CTYPE, $orig); ?> diff --git a/ext/ctype/tests/ctype_space_variation4.phpt b/ext/ctype/tests/ctype_space_variation4.phpt index 1024bf6233..0447d4ec1f 100644 --- a/ext/ctype/tests/ctype_space_variation4.phpt +++ b/ext/ctype/tests/ctype_space_variation4.phpt @@ -23,17 +23,17 @@ $hex_values = array (0x9, 0xA, 0xB, 0xC, 0xD, 0x20); echo "\n-- Octal Values --\n"; $iterator = 1; foreach($octal_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_space($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_space($c)); + $iterator++; } echo "\n-- Hexadecimal Values --\n"; $iterator = 1; foreach($hex_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_space($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_space($c)); + $iterator++; } setlocale(LC_CTYPE, $orig); ?> diff --git a/ext/ctype/tests/ctype_upper_variation1.phpt b/ext/ctype/tests/ctype_upper_variation1.phpt index d8ea5e2513..3cbbe33a33 100644 --- a/ext/ctype/tests/ctype_upper_variation1.phpt +++ b/ext/ctype/tests/ctype_upper_variation1.phpt @@ -24,9 +24,9 @@ unset ($unset_var); // get a class class classA { - public function __toString() { - return "HELLO"; - } + public function __toString() { + return "HELLO"; + } } // heredoc string @@ -89,9 +89,9 @@ $inputs = array( // loop through each element of $inputs to check the behavior of ctype_upper() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( ctype_upper($input) ); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump( ctype_upper($input) ); + $iterator++; }; fclose($fp); diff --git a/ext/ctype/tests/ctype_upper_variation2.phpt b/ext/ctype/tests/ctype_upper_variation2.phpt index ad581ce1a6..645ead4471 100644 --- a/ext/ctype/tests/ctype_upper_variation2.phpt +++ b/ext/ctype/tests/ctype_upper_variation2.phpt @@ -18,9 +18,9 @@ echo "*** Testing ctype_upper() : usage variations ***\n"; $orig = setlocale(LC_CTYPE, "C"); for ($i = 0; $i < 256; $i++) { - if (ctype_upper($i)) { - echo "character code $i is a uppercase character\n"; - } + if (ctype_upper($i)) { + echo "character code $i is a uppercase character\n"; + } } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_upper_variation4.phpt b/ext/ctype/tests/ctype_upper_variation4.phpt index 6ac42b8674..28e572a7c5 100644 --- a/ext/ctype/tests/ctype_upper_variation4.phpt +++ b/ext/ctype/tests/ctype_upper_variation4.phpt @@ -22,17 +22,17 @@ $hex_values = array(0x41, 0x42, 0x43, 0x44); echo "\n-- Octal Values --\n"; $iterator = 1; foreach($octal_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_upper($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_upper($c)); + $iterator++; } echo "\n-- Hexadecimal Values --\n"; $iterator = 1; foreach($hex_values as $c) { - echo "-- Iteration $iterator --\n"; - var_dump(ctype_upper($c)); - $iterator++; + echo "-- Iteration $iterator --\n"; + var_dump(ctype_upper($c)); + $iterator++; } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_xdigit_variation1.phpt b/ext/ctype/tests/ctype_xdigit_variation1.phpt index aa7281a0e5..4c183ef374 100644 --- a/ext/ctype/tests/ctype_xdigit_variation1.phpt +++ b/ext/ctype/tests/ctype_xdigit_variation1.phpt @@ -89,9 +89,9 @@ $inputs = array( // loop through each element of $inputs to check the behavior of ctype_xdigit() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( ctype_xdigit($input) ); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump( ctype_xdigit($input) ); + $iterator++; }; fclose($fp); diff --git a/ext/ctype/tests/ctype_xdigit_variation2.phpt b/ext/ctype/tests/ctype_xdigit_variation2.phpt index 7546329d9b..bb2795c189 100644 --- a/ext/ctype/tests/ctype_xdigit_variation2.phpt +++ b/ext/ctype/tests/ctype_xdigit_variation2.phpt @@ -19,9 +19,9 @@ echo "*** Testing ctype_xdigit() : usage variations ***\n"; $orig = setlocale(LC_CTYPE, "C"); for($c = 1; $c < 256; $c++) { - if (ctype_xdigit($c)) { - echo "character code $c is a hexadecimal 'digit'\n"; - } + if (ctype_xdigit($c)) { + echo "character code $c is a hexadecimal 'digit'\n"; + } } setlocale(LC_CTYPE, $orig); diff --git a/ext/ctype/tests/ctype_xdigit_variation4.phpt b/ext/ctype/tests/ctype_xdigit_variation4.phpt index e9f99e1f9a..9f7a88f3ab 100644 --- a/ext/ctype/tests/ctype_xdigit_variation4.phpt +++ b/ext/ctype/tests/ctype_xdigit_variation4.phpt @@ -35,21 +35,21 @@ $hex_values2 = array(0x61, 0x62, 0x63, 0x64); echo "\n-- Octal values --\n"; echo "'Incorrect' Integers: \n"; foreach($octal_values1 as $c) { - var_dump(ctype_xdigit($c)); + var_dump(ctype_xdigit($c)); } echo "'Correct' Integers: \n"; foreach($octal_values2 as $c) { - var_dump(ctype_xdigit($c)); + var_dump(ctype_xdigit($c)); } echo "\n-- Hexadecimal values --\n"; echo "'Incorrect' Integers: \n"; foreach($hex_values1 as $c) { - var_dump(ctype_xdigit($c)); + var_dump(ctype_xdigit($c)); } echo "'Correct' Integers: \n"; foreach($hex_values2 as $c) { - var_dump(ctype_xdigit($c)); + var_dump(ctype_xdigit($c)); } setlocale(LC_CTYPE, $orig); ?> diff --git a/ext/curl/tests/bug45161.phpt b/ext/curl/tests/bug45161.phpt index 2da0b7cde8..b93552e3ab 100644 --- a/ext/curl/tests/bug45161.phpt +++ b/ext/curl/tests/bug45161.phpt @@ -19,23 +19,23 @@ $fp = fopen('/dev/null', 'w'); /* $i = $start = $end = 100000.00; for ($i = 0; $i < 100; $i++) { - curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/'); - curl_setopt($ch, CURLOPT_FILE, $fp); - curl_exec($ch); + curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/'); + curl_setopt($ch, CURLOPT_FILE, $fp); + curl_exec($ch); } */ // Start actual test $start = memory_get_usage() + 1024; for($i = 0; $i < 1024; $i++) { - curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/'); - curl_setopt($ch, CURLOPT_FILE, $fp); - curl_exec($ch); + curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/'); + curl_setopt($ch, CURLOPT_FILE, $fp); + curl_exec($ch); } if ($start < memory_get_usage()) { - echo 'FAIL'; + echo 'FAIL'; } else { - echo 'PASS'; + echo 'PASS'; } echo "\n"; fclose($fp); diff --git a/ext/curl/tests/bug46711.phpt b/ext/curl/tests/bug46711.phpt index 8656513294..c46ea5331d 100644 --- a/ext/curl/tests/bug46711.phpt +++ b/ext/curl/tests/bug46711.phpt @@ -11,14 +11,14 @@ if (!extension_loaded("curl")) { $ch = curl_init(); $opt = array( - CURLOPT_AUTOREFERER => TRUE, - CURLOPT_BINARYTRANSFER => TRUE + CURLOPT_AUTOREFERER => TRUE, + CURLOPT_BINARYTRANSFER => TRUE ); curl_setopt( $ch, CURLOPT_AUTOREFERER , TRUE ); foreach( $opt as $option => $value ) { - curl_setopt( $ch, $option, $value ); + curl_setopt( $ch, $option, $value ); } var_dump($opt); // with this bug, $opt[58] becomes NULL diff --git a/ext/curl/tests/bug48203_multi.phpt b/ext/curl/tests/bug48203_multi.phpt index 55dd364203..7b3d05e713 100644 --- a/ext/curl/tests/bug48203_multi.phpt +++ b/ext/curl/tests/bug48203_multi.phpt @@ -8,59 +8,59 @@ include 'skipif.inc'; <?php include 'server.inc'; function checkForClosedFilePointer($target_url, $curl_option, $description) { - $fp = fopen(__DIR__ . '/bug48203.tmp', 'w'); + $fp = fopen(__DIR__ . '/bug48203.tmp', 'w'); - $ch1 = curl_init(); - $ch2 = curl_init(); + $ch1 = curl_init(); + $ch2 = curl_init(); - $options = array( - CURLOPT_RETURNTRANSFER => 1, - $curl_option => $fp, - CURLOPT_URL => $target_url, - ); + $options = array( + CURLOPT_RETURNTRANSFER => 1, + $curl_option => $fp, + CURLOPT_URL => $target_url, + ); - // we also need to set CURLOPT_VERBOSE to test CURLOPT_STDERR properly - if (CURLOPT_STDERR == $curl_option) { - $options[CURLOPT_VERBOSE] = 1; - } + // we also need to set CURLOPT_VERBOSE to test CURLOPT_STDERR properly + if (CURLOPT_STDERR == $curl_option) { + $options[CURLOPT_VERBOSE] = 1; + } - if (CURLOPT_INFILE == $curl_option) { - $options[CURLOPT_UPLOAD] = 1; - } + if (CURLOPT_INFILE == $curl_option) { + $options[CURLOPT_UPLOAD] = 1; + } - curl_setopt_array($ch1, $options); - curl_setopt_array($ch2, $options); + curl_setopt_array($ch1, $options); + curl_setopt_array($ch2, $options); - fclose($fp); // <-- premature close of $fp caused a crash! + fclose($fp); // <-- premature close of $fp caused a crash! - $mh = curl_multi_init(); + $mh = curl_multi_init(); - curl_multi_add_handle($mh, $ch1); - curl_multi_add_handle($mh, $ch2); + curl_multi_add_handle($mh, $ch1); + curl_multi_add_handle($mh, $ch2); - $active = 0; - do { - curl_multi_exec($mh, $active); - } while ($active > 0); + $active = 0; + do { + curl_multi_exec($mh, $active); + } while ($active > 0); - curl_multi_remove_handle($mh, $ch1); - curl_multi_remove_handle($mh, $ch2); - curl_multi_close($mh); + curl_multi_remove_handle($mh, $ch1); + curl_multi_remove_handle($mh, $ch2); + curl_multi_close($mh); - // Force curl to output results - fflush(STDERR); - fflush(STDOUT); + // Force curl to output results + fflush(STDERR); + fflush(STDOUT); - echo "Ok for $description\n"; + echo "Ok for $description\n"; } $options_to_check = array( - "CURLOPT_STDERR", "CURLOPT_WRITEHEADER", "CURLOPT_FILE", "CURLOPT_INFILE" + "CURLOPT_STDERR", "CURLOPT_WRITEHEADER", "CURLOPT_FILE", "CURLOPT_INFILE" ); $target_url = curl_cli_server_start(); foreach($options_to_check as $option) { - checkForClosedFilePointer($target_url, constant($option), $option); + checkForClosedFilePointer($target_url, constant($option), $option); } ?> diff --git a/ext/curl/tests/bug54798-unix.phpt b/ext/curl/tests/bug54798-unix.phpt index 774c1be5e0..5f07b64c6f 100644 --- a/ext/curl/tests/bug54798-unix.phpt +++ b/ext/curl/tests/bug54798-unix.phpt @@ -11,35 +11,35 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) { <?php function checkForClosedFilePointer($host, $curl_option, $description) { - $fp = fopen(__DIR__ . '/bug54798.tmp', 'w+'); + $fp = fopen(__DIR__ . '/bug54798.tmp', 'w+'); - $ch = curl_init(); + $ch = curl_init(); - // we also need CURLOPT_VERBOSE to be set to test CURLOPT_STDERR properly - if (CURLOPT_STDERR == $curl_option) { - curl_setopt($ch, CURLOPT_VERBOSE, 1); - } + // we also need CURLOPT_VERBOSE to be set to test CURLOPT_STDERR properly + if (CURLOPT_STDERR == $curl_option) { + curl_setopt($ch, CURLOPT_VERBOSE, 1); + } if (CURLOPT_INFILE == $curl_option) { curl_setopt($ch, CURLOPT_UPLOAD, 1); } - curl_setopt($ch, $curl_option, $fp); + curl_setopt($ch, $curl_option, $fp); - curl_setopt($ch, CURLOPT_URL, $host); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_URL, $host); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - fclose($fp); // <-- premature close of $fp caused a crash! + fclose($fp); // <-- premature close of $fp caused a crash! - curl_exec($ch); + curl_exec($ch); - curl_close($ch); + curl_close($ch); - echo "Ok for $description\n"; + echo "Ok for $description\n"; } $options_to_check = array( - "CURLOPT_STDERR", + "CURLOPT_STDERR", "CURLOPT_WRITEHEADER", "CURLOPT_FILE", "CURLOPT_INFILE" @@ -48,7 +48,7 @@ $options_to_check = array( include 'server.inc'; $host = curl_cli_server_start(); foreach($options_to_check as $option) { - checkForClosedFilePointer($host, constant($option), $option); + checkForClosedFilePointer($host, constant($option), $option); } ?> diff --git a/ext/curl/tests/bug54798.phpt b/ext/curl/tests/bug54798.phpt index 4a9b25cbdc..d2661fce8f 100644 --- a/ext/curl/tests/bug54798.phpt +++ b/ext/curl/tests/bug54798.phpt @@ -8,35 +8,35 @@ include 'skipif.inc'; <?php function checkForClosedFilePointer($host, $curl_option, $description) { - $fp = fopen(__DIR__ . '/bug54798.tmp', 'w+'); + $fp = fopen(__DIR__ . '/bug54798.tmp', 'w+'); - $ch = curl_init(); + $ch = curl_init(); - // we also need CURLOPT_VERBOSE to be set to test CURLOPT_STDERR properly - if (CURLOPT_STDERR == $curl_option) { - curl_setopt($ch, CURLOPT_VERBOSE, 1); - } + // we also need CURLOPT_VERBOSE to be set to test CURLOPT_STDERR properly + if (CURLOPT_STDERR == $curl_option) { + curl_setopt($ch, CURLOPT_VERBOSE, 1); + } if (CURLOPT_INFILE == $curl_option) { curl_setopt($ch, CURLOPT_UPLOAD, 1); } - curl_setopt($ch, $curl_option, $fp); + curl_setopt($ch, $curl_option, $fp); - curl_setopt($ch, CURLOPT_URL, $host); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_URL, $host); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - fclose($fp); // <-- premature close of $fp caused a crash! + fclose($fp); // <-- premature close of $fp caused a crash! - curl_exec($ch); + curl_exec($ch); - curl_close($ch); + curl_close($ch); - echo "Ok for $description\n"; + echo "Ok for $description\n"; } $options_to_check = array( - "CURLOPT_STDERR", + "CURLOPT_STDERR", "CURLOPT_WRITEHEADER", "CURLOPT_FILE", "CURLOPT_INFILE" @@ -45,7 +45,7 @@ $options_to_check = array( include 'server.inc'; $host = curl_cli_server_start(); foreach($options_to_check as $option) { - checkForClosedFilePointer($host, constant($option), $option); + checkForClosedFilePointer($host, constant($option), $option); } ?> diff --git a/ext/curl/tests/bug64267.phpt b/ext/curl/tests/bug64267.phpt index c3b04b3326..1b85c98e17 100644 --- a/ext/curl/tests/bug64267.phpt +++ b/ext/curl/tests/bug64267.phpt @@ -13,18 +13,18 @@ echo "TEST\n"; $c = curl_init("http://google.com"); $f = fopen(__FILE__,"r"); var_dump(curl_setopt_array($c, [ - CURLOPT_RETURNTRANSFER => true, - CURLOPT_UPLOAD => true, - CURLOPT_INFILE => $f, - CURLOPT_INFILESIZE => filesize(__FILE__), - CURLOPT_CONNECTTIMEOUT => 3, - CURLOPT_TIMEOUT => 3, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_UPLOAD => true, + CURLOPT_INFILE => $f, + CURLOPT_INFILESIZE => filesize(__FILE__), + CURLOPT_CONNECTTIMEOUT => 3, + CURLOPT_TIMEOUT => 3, ])); fclose($f); var_dump(curl_setopt_array($c, [ - CURLOPT_UPLOAD => false, - CURLOPT_INFILE => null, - CURLOPT_INFILESIZE => 0, + CURLOPT_UPLOAD => false, + CURLOPT_INFILE => null, + CURLOPT_INFILESIZE => 0, ])); curl_exec($c); var_dump(curl_getinfo($c, CURLINFO_RESPONSE_CODE)); diff --git a/ext/curl/tests/bug67643.phpt b/ext/curl/tests/bug67643.phpt index 24cdb86a28..e3d090da3a 100644 --- a/ext/curl/tests/bug67643.phpt +++ b/ext/curl/tests/bug67643.phpt @@ -6,24 +6,24 @@ if (!extension_loaded('curl')) print 'skip'; ?> --FILE-- <?php - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, 'file://'. __DIR__ . DIRECTORY_SEPARATOR .'curl_testdata1.txt'); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, 'file://'. __DIR__ . DIRECTORY_SEPARATOR .'curl_testdata1.txt'); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); - $mh = curl_multi_init(); - curl_multi_add_handle($mh, $ch); + $mh = curl_multi_init(); + curl_multi_add_handle($mh, $ch); - $running = 0; - do { - curl_multi_exec($mh, $running); - } while($running > 0); + $running = 0; + do { + curl_multi_exec($mh, $running); + } while($running > 0); - $results = curl_multi_getcontent($ch); + $results = curl_multi_getcontent($ch); - curl_multi_remove_handle($mh, $ch); - curl_multi_close($mh); + curl_multi_remove_handle($mh, $ch); + curl_multi_close($mh); - var_dump($results); + var_dump($results); ?> --EXPECT-- CURL1 diff --git a/ext/curl/tests/bug68937.phpt b/ext/curl/tests/bug68937.phpt index 4f2ed12e42..9f28117594 100644 --- a/ext/curl/tests/bug68937.phpt +++ b/ext/curl/tests/bug68937.phpt @@ -14,22 +14,22 @@ $url = "{$host}/get.inc"; $ch = curl_init($url); curl_setopt_array($ch, array( - CURLOPT_HEADER => false, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_POST => true, - CURLOPT_INFILESIZE => 1, - CURLOPT_HTTPHEADER => array( - 'Expect:', - 'Content-Length: 1', - ), - CURLOPT_READFUNCTION => 'curl_read', - CURLOPT_CONNECTTIMEOUT=> 1, - CURLOPT_TIMEOUT=>1 + CURLOPT_HEADER => false, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_POST => true, + CURLOPT_INFILESIZE => 1, + CURLOPT_HTTPHEADER => array( + 'Expect:', + 'Content-Length: 1', + ), + CURLOPT_READFUNCTION => 'curl_read', + CURLOPT_CONNECTTIMEOUT=> 1, + CURLOPT_TIMEOUT=>1 )); function curl_read($ch, $fp, $len) { - var_dump($fp); - exit; + var_dump($fp); + exit; } curl_exec($ch); diff --git a/ext/curl/tests/bug68937_2.phpt b/ext/curl/tests/bug68937_2.phpt index 8ebbc8eaa6..1ce5b52114 100644 --- a/ext/curl/tests/bug68937_2.phpt +++ b/ext/curl/tests/bug68937_2.phpt @@ -13,23 +13,23 @@ $url = "{$host}/get.inc"; $ch = curl_init($url); curl_setopt_array($ch, array( - CURLOPT_HEADER => false, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_POST => true, - CURLOPT_INFILESIZE => filesize(__FILE__), - CURLOPT_INFILE => fopen(__FILE__, 'r'), - CURLOPT_HTTPHEADER => array( - 'Expect:', - 'Content-Length: 1', - ), - CURLOPT_READFUNCTION => 'curl_read', - CURLOPT_CONNECTTIMEOUT => 1, - CURLOPT_TIMEOUT => 1 + CURLOPT_HEADER => false, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_POST => true, + CURLOPT_INFILESIZE => filesize(__FILE__), + CURLOPT_INFILE => fopen(__FILE__, 'r'), + CURLOPT_HTTPHEADER => array( + 'Expect:', + 'Content-Length: 1', + ), + CURLOPT_READFUNCTION => 'curl_read', + CURLOPT_CONNECTTIMEOUT => 1, + CURLOPT_TIMEOUT => 1 )); function curl_read($ch, $fp, $len) { - var_dump($fp); - exit; + var_dump($fp); + exit; } curl_exec($ch); diff --git a/ext/curl/tests/bug69485.phpt b/ext/curl/tests/bug69485.phpt index 7a62589e5e..274cdce582 100644 --- a/ext/curl/tests/bug69485.phpt +++ b/ext/curl/tests/bug69485.phpt @@ -6,9 +6,9 @@ Bug #69485 (Double free on zend_list_dtor) <?php class O { - public $ch; - public function dummy() { - } + public $ch; + public function dummy() { + } } $ch = curl_init(); diff --git a/ext/curl/tests/bug71523.phpt b/ext/curl/tests/bug71523.phpt index c7889eaca0..2d947febec 100644 --- a/ext/curl/tests/bug71523.phpt +++ b/ext/curl/tests/bug71523.phpt @@ -14,13 +14,13 @@ curl_setopt($base, CURLOPT_RETURNTRANSFER, true); $mh = curl_multi_init(); for ($i = 0; $i < 2; ++$i) { - $ch = curl_copy_handle($base); - curl_setopt($ch, CURLOPT_HTTPHEADER, ['Foo: Bar']); - curl_multi_add_handle($mh, $ch); + $ch = curl_copy_handle($base); + curl_setopt($ch, CURLOPT_HTTPHEADER, ['Foo: Bar']); + curl_multi_add_handle($mh, $ch); } do { - curl_multi_exec($mh, $active); + curl_multi_exec($mh, $active); } while ($active); ?> okey diff --git a/ext/curl/tests/bug76675.phpt b/ext/curl/tests/bug76675.phpt index 5e60c5c47f..e59aabc7c3 100644 --- a/ext/curl/tests/bug76675.phpt +++ b/ext/curl/tests/bug76675.phpt @@ -19,8 +19,8 @@ $callback = function($parent, $passed) use (&$transfers) { echo "Received ".strlen($data); return strlen($data); }); - $transfers++; - return CURL_PUSH_OK; + $transfers++; + return CURL_PUSH_OK; }; $mh = curl_multi_init(); curl_multi_setopt($mh, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX); diff --git a/ext/curl/tests/bug77535.phpt b/ext/curl/tests/bug77535.phpt index b79cdb9c02..4505352ca8 100644 --- a/ext/curl/tests/bug77535.phpt +++ b/ext/curl/tests/bug77535.phpt @@ -41,7 +41,7 @@ class MyHttpClient return \strlen($data); }); curl_multi_add_handle($this->mh, $this->curl); - + $stillRunning = null; while (true) { do { diff --git a/ext/curl/tests/bug79033.phpt b/ext/curl/tests/bug79033.phpt index 98a97ed7a4..454c3b2669 100644 --- a/ext/curl/tests/bug79033.phpt +++ b/ext/curl/tests/bug79033.phpt @@ -8,11 +8,11 @@ include 'server.inc'; $host = curl_cli_server_start(); $ch = curl_init(); curl_setopt_array($ch, [ - CURLOPT_URL => "{$host}/get.inc?test=post", - CURLOPT_POST => true, + CURLOPT_URL => "{$host}/get.inc?test=post", + CURLOPT_POST => true, CURLOPT_POSTFIELDS => [], CURLINFO_HEADER_OUT => true, - CURLOPT_RETURNTRANSFER => true, + CURLOPT_RETURNTRANSFER => true, ]); var_dump(curl_exec($ch)); var_dump(curl_getinfo($ch)["request_header"]); diff --git a/ext/curl/tests/check_win_config.phpt b/ext/curl/tests/check_win_config.phpt index a5f116748e..2764a82f38 100644 --- a/ext/curl/tests/check_win_config.phpt +++ b/ext/curl/tests/check_win_config.phpt @@ -10,13 +10,13 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) ?> --FILE-- <?php - ob_start(); - phpinfo(); - $s = ob_get_contents(); - ob_end_clean(); - preg_match('/curl\n\n(.+)\n\n/siU', $s, $m); + ob_start(); + phpinfo(); + $s = ob_get_contents(); + ob_end_clean(); + preg_match('/curl\n\n(.+)\n\n/siU', $s, $m); - echo $m[1], "\n"; + echo $m[1], "\n"; ?> DONE diff --git a/ext/curl/tests/curl_file_deleted_before_curl_close.phpt b/ext/curl/tests/curl_file_deleted_before_curl_close.phpt index 92eba5e8c3..3d78ce60af 100644 --- a/ext/curl/tests/curl_file_deleted_before_curl_close.phpt +++ b/ext/curl/tests/curl_file_deleted_before_curl_close.phpt @@ -13,7 +13,7 @@ $ch = curl_init($host); $temp_file = __DIR__ . '/curl_file_deleted_before_curl_close.tmp'; if (file_exists($temp_file)) { - unlink($temp_file); // file should not exist before test + unlink($temp_file); // file should not exist before test } $handle = fopen($temp_file, 'w'); diff --git a/ext/curl/tests/curl_file_upload.phpt b/ext/curl/tests/curl_file_upload.phpt index 73a2f363fb..2c6409a25b 100644 --- a/ext/curl/tests/curl_file_upload.phpt +++ b/ext/curl/tests/curl_file_upload.phpt @@ -7,15 +7,15 @@ CURL file uploading function testcurl($ch, $name, $mime = '', $postname = '') { - if(!empty($postname)) { - $file = new CurlFile($name, $mime, $postname); - } else if(!empty($mime)) { - $file = new CurlFile($name, $mime); - } else { - $file = new CurlFile($name); - } - curl_setopt($ch, CURLOPT_POSTFIELDS, array("file" => $file)); - var_dump(curl_exec($ch)); + if(!empty($postname)) { + $file = new CurlFile($name, $mime, $postname); + } else if(!empty($mime)) { + $file = new CurlFile($name, $mime); + } else { + $file = new CurlFile($name); + } + curl_setopt($ch, CURLOPT_POSTFIELDS, array("file" => $file)); + var_dump(curl_exec($ch)); } include 'server.inc'; diff --git a/ext/curl/tests/curl_ftp_pasv.phpt b/ext/curl/tests/curl_ftp_pasv.phpt index 39b351dd7b..866f1a2ca6 100644 --- a/ext/curl/tests/curl_ftp_pasv.phpt +++ b/ext/curl/tests/curl_ftp_pasv.phpt @@ -23,15 +23,15 @@ if (false === getenv('PHP_CURL_FTP_REMOTE_PASSWD')) exit("skip PHP_CURL_FTP_REM // curl_setopt ( $ch , CURLOPT_VERBOSE, 1 ); /* Without enabling SKIP_PASV_IP flag, the following output will be seen.. - < 227 Entering Passive Mode (10,5,80,146,100,199) - * Trying 10.5.80.146... * connected - * Connecting to 10.5.80.146 (10.5.80.146) port 25799 + < 227 Entering Passive Mode (10,5,80,146,100,199) + * Trying 10.5.80.146... * connected + * Connecting to 10.5.80.146 (10.5.80.146) port 25799 */ /* After enabling SKIP_PASV_IP flag, the following output will be seen.. - < 227 Entering Passive Mode (10,5,80,146,50,229) - * Skips 10.5.80.146 for data connection, uses 10.5.80.146 instead - * Trying 10.5.80.146... * connected + < 227 Entering Passive Mode (10,5,80,146,50,229) + * Skips 10.5.80.146 for data connection, uses 10.5.80.146 instead + * Trying 10.5.80.146... * connected */ curl_setopt ( $ch , CURLOPT_URL, $url ); diff --git a/ext/curl/tests/curl_multi_getcontent_basic3.phpt b/ext/curl/tests/curl_multi_getcontent_basic3.phpt index f67196d7e7..601aa17a2f 100644 --- a/ext/curl/tests/curl_multi_getcontent_basic3.phpt +++ b/ext/curl/tests/curl_multi_getcontent_basic3.phpt @@ -7,43 +7,43 @@ Rein Velt (rein@velt.org) <?php include 'skipif.inc'; ?> --FILE-- <?php - //CURL_MULTI_GETCONTENT TEST + //CURL_MULTI_GETCONTENT TEST - //CREATE RESOURCES - $ch1=curl_init(); - $ch2=curl_init(); + //CREATE RESOURCES + $ch1=curl_init(); + $ch2=curl_init(); - //SET URL AND OTHER OPTIONS + //SET URL AND OTHER OPTIONS include 'server.inc'; $host = curl_cli_server_start(); - curl_setopt($ch1, CURLOPT_URL, "{$host}/get.inc?test=getpost&get_param=Hello%20World"); - curl_setopt($ch2, CURLOPT_URL, "file://".__DIR__. DIRECTORY_SEPARATOR . "curl_testdata2.txt"); - curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch1, CURLOPT_URL, "{$host}/get.inc?test=getpost&get_param=Hello%20World"); + curl_setopt($ch2, CURLOPT_URL, "file://".__DIR__. DIRECTORY_SEPARATOR . "curl_testdata2.txt"); + curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true); - //CREATE MULTIPLE CURL HANDLE - $mh=curl_multi_init(); + //CREATE MULTIPLE CURL HANDLE + $mh=curl_multi_init(); - //ADD THE 2 HANDLES - curl_multi_add_handle($mh,$ch1); - curl_multi_add_handle($mh,$ch2); + //ADD THE 2 HANDLES + curl_multi_add_handle($mh,$ch1); + curl_multi_add_handle($mh,$ch2); - //EXECUTE - $running=0; - do { - curl_multi_exec($mh,$running); - } while ($running>0); + //EXECUTE + $running=0; + do { + curl_multi_exec($mh,$running); + } while ($running>0); - $results1=curl_multi_getcontent($ch1); + $results1=curl_multi_getcontent($ch1); $results2=curl_multi_getcontent($ch2); - //CLOSE - curl_multi_remove_handle($mh,$ch1); - curl_multi_remove_handle($mh,$ch2); - curl_multi_close($mh); + //CLOSE + curl_multi_remove_handle($mh,$ch1); + curl_multi_remove_handle($mh,$ch2); + curl_multi_close($mh); - echo $results1; - echo $results2; + echo $results1; + echo $results2; ?> --EXPECT-- diff --git a/ext/curl/tests/curl_multi_segfault.phpt b/ext/curl/tests/curl_multi_segfault.phpt index c1608bf346..c577b04516 100644 --- a/ext/curl/tests/curl_multi_segfault.phpt +++ b/ext/curl/tests/curl_multi_segfault.phpt @@ -32,16 +32,16 @@ if (false === getenv('PHP_CURL_FTP_REMOTE_PASSWD')) exit("skip PHP_CURL_FTP_REM $active = null; do { - $mrc = curl_multi_exec($cmh, $active); + $mrc = curl_multi_exec($cmh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); while ($active && $mrc == CURLM_OK) { - if (curl_multi_select($cmh) != -1) { - do { - $mrc = curl_multi_exec($cmh, $active); - } while ($mrc == CURLM_CALL_MULTI_PERFORM); - } + if (curl_multi_select($cmh) != -1) { + do { + $mrc = curl_multi_exec($cmh, $active); + } while ($mrc == CURLM_CALL_MULTI_PERFORM); + } } var_dump(is_string(curl_multi_getcontent($ch))); diff --git a/ext/curl/tests/curl_write_callback.phpt b/ext/curl/tests/curl_write_callback.phpt index c0b733ee44..36fcf285aa 100644 --- a/ext/curl/tests/curl_write_callback.phpt +++ b/ext/curl/tests/curl_write_callback.phpt @@ -12,8 +12,8 @@ Writes the value 'test' to a temporary file. Use curl to access this file, passi function curl_callback($curl_handle, $received_data) { - echo $received_data; - return strlen($received_data); + echo $received_data; + return strlen($received_data); } $log_file = tempnam(sys_get_temp_dir(), 'php-curl-test'); diff --git a/ext/curl/tests/curl_writeheader_callback.phpt b/ext/curl/tests/curl_writeheader_callback.phpt index 6336e14a6d..f56adb1dc5 100644 --- a/ext/curl/tests/curl_writeheader_callback.phpt +++ b/ext/curl/tests/curl_writeheader_callback.phpt @@ -12,8 +12,8 @@ Hit the host and determine that the headers are sent to the callback specified f function curl_header_callback($curl_handle, $data) { - if (strtolower(substr($data,0, 4)) == 'http') - echo $data; + if (strtolower(substr($data,0, 4)) == 'http') + echo $data; } include 'server.inc'; diff --git a/ext/date/tests/002.phpt b/ext/date/tests/002.phpt index adbea5e231..36dc43d760 100644 --- a/ext/date/tests/002.phpt +++ b/ext/date/tests/002.phpt @@ -8,45 +8,45 @@ if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') { ?> --FILE-- <?php - $dates = array ( - "1999-10-13", - "Oct 13 1999", - "2000-01-19", - "Jan 19 2000", - "2001-12-21", - "Dec 21 2001", - "2001-12-21 12:16", - "Dec 21 2001 12:16", - "Dec 21 12:16", - "2001-10-22 21:19:58", - "2001-10-22 21:19:58-02", - "2001-10-22 21:19:58-0213", - "2001-10-22 21:19:58+02", - "2001-10-22 21:19:58+0213", - "2001-10-22T21:20:58-03:40", - "2001-10-22T211958-2", - "20011022T211958+0213", - "20011022T21:20+0215", - "1997W011", - "2004W101T05:00+0", - ); + $dates = array ( + "1999-10-13", + "Oct 13 1999", + "2000-01-19", + "Jan 19 2000", + "2001-12-21", + "Dec 21 2001", + "2001-12-21 12:16", + "Dec 21 2001 12:16", + "Dec 21 12:16", + "2001-10-22 21:19:58", + "2001-10-22 21:19:58-02", + "2001-10-22 21:19:58-0213", + "2001-10-22 21:19:58+02", + "2001-10-22 21:19:58+0213", + "2001-10-22T21:20:58-03:40", + "2001-10-22T211958-2", + "20011022T211958+0213", + "20011022T21:20+0215", + "1997W011", + "2004W101T05:00+0", + ); - echo "*** GMT0\n"; - date_default_timezone_set("GMT0"); - foreach ($dates as $date) { - echo date ("Y-m-d H:i:s\n", strtotime ($date)); - } + echo "*** GMT0\n"; + date_default_timezone_set("GMT0"); + foreach ($dates as $date) { + echo date ("Y-m-d H:i:s\n", strtotime ($date)); + } - echo "*** US/Eastern\n"; - date_default_timezone_set("US/Eastern"); - if( date("T") == "GMT" ) { - // POSIX style - date_default_timezone_set("EST5EDT4,M4.1.0,M10.5.0"); - } + echo "*** US/Eastern\n"; + date_default_timezone_set("US/Eastern"); + if( date("T") == "GMT" ) { + // POSIX style + date_default_timezone_set("EST5EDT4,M4.1.0,M10.5.0"); + } - foreach ($dates as $date) { - echo date ("Y-m-d H:i:s\n", strtotime ($date)); - } + foreach ($dates as $date) { + echo date ("Y-m-d H:i:s\n", strtotime ($date)); + } ?> --EXPECTF-- *** GMT0 diff --git a/ext/date/tests/003.phpt b/ext/date/tests/003.phpt index 501899cc5f..ae7fcce23c 100644 --- a/ext/date/tests/003.phpt +++ b/ext/date/tests/003.phpt @@ -5,7 +5,7 @@ date suffixes test date_default_timezone_set('UTC'); for ($i = 0; $i < 32; $i++) { - var_dump(date("jS", mktime(0,0,0, 1, $i, 2006))); + var_dump(date("jS", mktime(0,0,0, 1, $i, 2006))); } echo "Done\n"; diff --git a/ext/date/tests/004.phpt b/ext/date/tests/004.phpt index 986c9c9179..23cb508458 100644 --- a/ext/date/tests/004.phpt +++ b/ext/date/tests/004.phpt @@ -8,19 +8,19 @@ $tz = array("UTC", "Asia/Jerusalem", "America/Chicago", "Europe/London"); $t = mktime(0, 0, 0, 6, 27, 2006); foreach ($tz as $zone) { - date_default_timezone_set($zone); + date_default_timezone_set($zone); - var_dump(date("w", $t)); - var_dump(date("z", $t)); - var_dump(date("n", $t)); - var_dump(date("t", $t)); - var_dump(date("L", $t)); - var_dump(date("a", $t)); - var_dump(date("B", $t)); - var_dump(date("g", $t)); - var_dump(date("G", $t)); - var_dump(date("Z", $t)); - var_dump(date("U", $t)); + var_dump(date("w", $t)); + var_dump(date("z", $t)); + var_dump(date("n", $t)); + var_dump(date("t", $t)); + var_dump(date("L", $t)); + var_dump(date("a", $t)); + var_dump(date("B", $t)); + var_dump(date("g", $t)); + var_dump(date("G", $t)); + var_dump(date("Z", $t)); + var_dump(date("U", $t)); } echo "Done\n"; diff --git a/ext/date/tests/DateTimeZone_clone_basic1.phpt b/ext/date/tests/DateTimeZone_clone_basic1.phpt index 3587ca74bf..3d154512f6 100644 --- a/ext/date/tests/DateTimeZone_clone_basic1.phpt +++ b/ext/date/tests/DateTimeZone_clone_basic1.phpt @@ -18,11 +18,11 @@ var_dump($orig); var_dump($clone); if ($clone != $orig) { - echo "TEST FAILED : objects not equal\n"; + echo "TEST FAILED : objects not equal\n"; }else if ($clone === $orig) { - echo "TEST FAILED : objects identical\n"; + echo "TEST FAILED : objects identical\n"; } else { - echo "TEST PASSED : Objects equal but not indetical\n"; + echo "TEST PASSED : Objects equal but not indetical\n"; } ?> diff --git a/ext/date/tests/DateTimeZone_clone_basic2.phpt b/ext/date/tests/DateTimeZone_clone_basic2.phpt index bbda5fb4a2..b41eeddfbd 100644 --- a/ext/date/tests/DateTimeZone_clone_basic2.phpt +++ b/ext/date/tests/DateTimeZone_clone_basic2.phpt @@ -6,13 +6,13 @@ Testing clone on objects whose class derived from DateTimeZone class date_default_timezone_set("Europe/London"); class DateTimeZoneExt1 extends DateTimeZone { - public $property1 = 99; - public $property2 = "Hello"; + public $property1 = 99; + public $property2 = "Hello"; } class DateTimeZoneExt2 extends DateTimeZoneExt1 { - public $property3 = true; - public $property4 = 10.5; + public $property3 = true; + public $property4 = 10.5; } echo "*** Testing clone on objects whose class derived from DateTimeZone class ***\n"; diff --git a/ext/date/tests/DateTimeZone_clone_basic4.phpt b/ext/date/tests/DateTimeZone_clone_basic4.phpt index 39cea00742..9f99bc5b3e 100644 --- a/ext/date/tests/DateTimeZone_clone_basic4.phpt +++ b/ext/date/tests/DateTimeZone_clone_basic4.phpt @@ -6,9 +6,9 @@ Test clone of DateTimeZone derived objects with __clone magic method date_default_timezone_set("Europe/London"); class DateTimeZoneExt1 extends DateTimeZone { - public function __clone() { - echo "-- DateTimeExt1 __clone magic method called --\n"; - } + public function __clone() { + echo "-- DateTimeExt1 __clone magic method called --\n"; + } } echo "*** Testing clone of objects derived from DateTimeZone class with __clone magic method***\n"; diff --git a/ext/date/tests/DateTimeZone_compare_basic1.phpt b/ext/date/tests/DateTimeZone_compare_basic1.phpt index 1df144840a..1e37178a34 100644 --- a/ext/date/tests/DateTimeZone_compare_basic1.phpt +++ b/ext/date/tests/DateTimeZone_compare_basic1.phpt @@ -14,8 +14,8 @@ class DateTimeZoneExt1 extends DateTimeZone { } class DateTimeZoneExt2 extends DateTimeZone{ - public $foo = "Hello"; - private $bar = 99; + public $foo = "Hello"; + private $bar = 99; } class DateTimeZoneExt3 extends DateTimeZoneExt2 { diff --git a/ext/date/tests/DateTimeZone_extends_basic1.phpt b/ext/date/tests/DateTimeZone_extends_basic1.phpt index 178970bdb9..ace71c3ffa 100644 --- a/ext/date/tests/DateTimeZone_extends_basic1.phpt +++ b/ext/date/tests/DateTimeZone_extends_basic1.phpt @@ -10,10 +10,10 @@ echo "*** Testing basic DateTimeZone inheritance() ***\n"; class DateTimeZoneExt extends DateTimeZone { - public function __toString() - { - return parent::getName(); - } + public function __toString() + { + return parent::getName(); + } } echo "\n-- Create an instance of DateTimeZoneExt --\n"; diff --git a/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt b/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt index c67cd41977..7559143466 100644 --- a/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt +++ b/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt @@ -19,7 +19,7 @@ $tz = new DateTimeZone("Europe/London"); $tran = $tz->getTransitions(-306972000, -37241999); if (!is_array($tran)) { - echo "TEST FAILED: Expected an array\n"; + echo "TEST FAILED: Expected an array\n"; } echo "\n-- Total number of transitions: " . count($tran). " --\n"; diff --git a/ext/date/tests/DateTime_clone_basic2.phpt b/ext/date/tests/DateTime_clone_basic2.phpt index 944b74abcb..261879283e 100644 --- a/ext/date/tests/DateTime_clone_basic2.phpt +++ b/ext/date/tests/DateTime_clone_basic2.phpt @@ -6,14 +6,14 @@ Test clone of objects whose class derived from DateTime class date_default_timezone_set("Europe/London"); class DateTimeExt1 extends DateTime { - public $property1 = 99; - public $property2 = "Hello"; + public $property1 = 99; + public $property2 = "Hello"; } class DateTimeExt2 extends DateTimeExt1 { - public $property3 = true; - public $property4 = 10.5; + public $property3 = true; + public $property4 = 10.5; } echo "*** Testing clone on objects whose class derived from DateTime class ***\n"; diff --git a/ext/date/tests/DateTime_clone_basic4.phpt b/ext/date/tests/DateTime_clone_basic4.phpt index e72f570711..3633cb56e0 100644 --- a/ext/date/tests/DateTime_clone_basic4.phpt +++ b/ext/date/tests/DateTime_clone_basic4.phpt @@ -9,9 +9,9 @@ date_default_timezone_set("Europe/London"); date_default_timezone_set("Europe/London"); class DateTimeExt1 extends DateTime { - public function __clone() { - echo "-- DateTimeExt1 __clone magic method called --\n"; - } + public function __clone() { + echo "-- DateTimeExt1 __clone magic method called --\n"; + } } echo "*** Testing clone of objects derived from DateTime class with __clone magic method***\n"; diff --git a/ext/date/tests/DateTime_compare_basic1.phpt b/ext/date/tests/DateTime_compare_basic1.phpt index 7786defb6a..93c7b1f34e 100644 --- a/ext/date/tests/DateTime_compare_basic1.phpt +++ b/ext/date/tests/DateTime_compare_basic1.phpt @@ -12,8 +12,8 @@ class DateTimeExt1 extends DateTime { } class DateTimeExt2 extends DateTime{ - public $foo = "Hello"; - private $bar = 99; + public $foo = "Hello"; + private $bar = 99; } class DateTimeExt3 extends DateTimeExt2 { diff --git a/ext/date/tests/DateTime_extends_basic1.phpt b/ext/date/tests/DateTime_extends_basic1.phpt index d7d236943d..1a4c004c89 100644 --- a/ext/date/tests/DateTime_extends_basic1.phpt +++ b/ext/date/tests/DateTime_extends_basic1.phpt @@ -11,12 +11,12 @@ echo "*** Testing basic DateTime inheritance() ***\n"; class DateTimeExt extends DateTime { - public static $format = "F j, Y, g:i:s a"; + public static $format = "F j, Y, g:i:s a"; - public function __toString() - { - return parent::format(self::$format); - } + public function __toString() + { + return parent::format(self::$format); + } } echo "\n-- Create an instance of DateTimeExt --\n"; diff --git a/ext/date/tests/DateTime_extends_basic2.phpt b/ext/date/tests/DateTime_extends_basic2.phpt index 1bfc2f1e4c..03d1e03283 100644 --- a/ext/date/tests/DateTime_extends_basic2.phpt +++ b/ext/date/tests/DateTime_extends_basic2.phpt @@ -10,7 +10,7 @@ echo "*** Testing new DateTime() : with user space __construct magic method ***\ class DateTimeExt extends DateTime { - public function __construct ($date = null, DateTimeZone $dtz = null) + public function __construct ($date = null, DateTimeZone $dtz = null) { if($dtz === null) { diff --git a/ext/date/tests/DateTime_extends_basic3.phpt b/ext/date/tests/DateTime_extends_basic3.phpt index 3f48cb2e21..27fc602e00 100644 --- a/ext/date/tests/DateTime_extends_basic3.phpt +++ b/ext/date/tests/DateTime_extends_basic3.phpt @@ -9,10 +9,10 @@ echo "*** Testing new DateTime() : with user format() method ***\n"; class DateTimeExt extends DateTime { - public function format($format = "F j, Y, g:i:s a") - { - return parent::format($format); - } + public function format($format = "F j, Y, g:i:s a") + { + return parent::format($format); + } } $d = new DateTimeExt("1967-05-01 22:30:41"); diff --git a/ext/date/tests/bug13142.phpt b/ext/date/tests/bug13142.phpt index 5550d5ce9c..80d4fa82fc 100644 --- a/ext/date/tests/bug13142.phpt +++ b/ext/date/tests/bug13142.phpt @@ -15,7 +15,7 @@ if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') { <?php if (date('T') == 'GMT') { - putenv("TZ=EST5EDT4,M4.1.0,M10.5.0"); + putenv("TZ=EST5EDT4,M4.1.0,M10.5.0"); } echo date("r\n", strtotime("Sep 04 16:39:45 2001")); echo date("r\n", strtotime("Sep 04 2001 16:39:45")); diff --git a/ext/date/tests/bug20382-1.phpt b/ext/date/tests/bug20382-1.phpt index 162852115b..8c0583767a 100644 --- a/ext/date/tests/bug20382-1.phpt +++ b/ext/date/tests/bug20382-1.phpt @@ -4,12 +4,12 @@ Bug #20382 [1] (strtotime ("Monday", $date) produces wrong result on DST changeo date.timezone=Europe/Amsterdam --FILE-- <?php - $tStamp = mktime (17, 17, 17, 10, 27, 2004); - echo "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n"; + $tStamp = mktime (17, 17, 17, 10, 27, 2004); + echo "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n"; - $strtotime_timestamp = strtotime ("Monday", $tStamp); - echo "result=". date("l Y-m-d H:i:s T", $strtotime_timestamp). "\n"; - echo "wanted=Monday 2004-11-01 00:00:00 CET\n"; + $strtotime_timestamp = strtotime ("Monday", $tStamp); + echo "result=". date("l Y-m-d H:i:s T", $strtotime_timestamp). "\n"; + echo "wanted=Monday 2004-11-01 00:00:00 CET\n"; ?> --EXPECT-- tStamp=Wednesday 2004-10-27 17:17:17 CEST diff --git a/ext/date/tests/bug20382-2.phpt b/ext/date/tests/bug20382-2.phpt index 2488c4729e..d963708ce3 100644 --- a/ext/date/tests/bug20382-2.phpt +++ b/ext/date/tests/bug20382-2.phpt @@ -4,43 +4,43 @@ Bug #20382 [2] (strtotime ("Monday", $date) produces wrong result on DST changeo <?php $tests = array( - array("Europe/Andorra", 17, 17, 17, 1, 24764, 1970), - array("Asia/Dubai", 17, 17, 17, 1, 1, 1970), - array("Asia/Kabul", 17, 17, 17, 1, 1, 1970), - array("America/Antigua", 17, 17, 17, 1, 1, 1970), - array("America/Anguilla", 17, 17, 17, 1, 1, 1970), - array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970), - array("Asia/Yerevan", 17, 17, 17, 1, 24764, 1970), - array("America/Curacao", 17, 17, 17, 1, 1, 1970), - array("Africa/Luanda", 17, 17, 17, 1, 1, 1970), - array("Antarctica/McMurdo", 17, 17, 17, 1, 24743, 1970), - array("Australia/Adelaide", 17, 17, 17, 1, 1, 1971), - array("Australia/Darwin", 17, 17, 17, 1, 88, 1971), - array("Australia/Perth", 17, 17, 17, 1, 1, 1971), - array("America/Aruba", 17, 17, 17, 1, 88, 1971), - array("Asia/Baku", 17, 17, 17, 1, 1, 1971), - array("Europe/Sarajevo", 17, 17, 17, 1, 1, 1971), - array("America/Barbados", 17, 17, 17, 1, 1, 1971), - array("Asia/Dacca", 17, 17, 17, 1, 1, 1971), - array("Europe/Brussels", 17, 17, 17, 1, 1, 1971), - array("Africa/Ouagadougou", 17, 17, 17, 1, 88, 1971), - array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970), - array("America/Buenos_Aires", 17, 17, 17, 1, 1734, 1970), - array("America/Rosario", 17, 17, 17, 1, 1734, 1970), - array("Europe/Vienna", 17, 17, 17, 1, 3743, 1970), - array("Asia/Baku", 17, 17, 17, 1, 9490, 1970), + array("Europe/Andorra", 17, 17, 17, 1, 24764, 1970), + array("Asia/Dubai", 17, 17, 17, 1, 1, 1970), + array("Asia/Kabul", 17, 17, 17, 1, 1, 1970), + array("America/Antigua", 17, 17, 17, 1, 1, 1970), + array("America/Anguilla", 17, 17, 17, 1, 1, 1970), + array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970), + array("Asia/Yerevan", 17, 17, 17, 1, 24764, 1970), + array("America/Curacao", 17, 17, 17, 1, 1, 1970), + array("Africa/Luanda", 17, 17, 17, 1, 1, 1970), + array("Antarctica/McMurdo", 17, 17, 17, 1, 24743, 1970), + array("Australia/Adelaide", 17, 17, 17, 1, 1, 1971), + array("Australia/Darwin", 17, 17, 17, 1, 88, 1971), + array("Australia/Perth", 17, 17, 17, 1, 1, 1971), + array("America/Aruba", 17, 17, 17, 1, 88, 1971), + array("Asia/Baku", 17, 17, 17, 1, 1, 1971), + array("Europe/Sarajevo", 17, 17, 17, 1, 1, 1971), + array("America/Barbados", 17, 17, 17, 1, 1, 1971), + array("Asia/Dacca", 17, 17, 17, 1, 1, 1971), + array("Europe/Brussels", 17, 17, 17, 1, 1, 1971), + array("Africa/Ouagadougou", 17, 17, 17, 1, 88, 1971), + array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970), + array("America/Buenos_Aires", 17, 17, 17, 1, 1734, 1970), + array("America/Rosario", 17, 17, 17, 1, 1734, 1970), + array("Europe/Vienna", 17, 17, 17, 1, 3743, 1970), + array("Asia/Baku", 17, 17, 17, 1, 9490, 1970), ); foreach ($tests as $test) { - date_default_timezone_set($test[0]); - print "{$test[0]}\n"; - array_shift($test); - $timestamp = call_user_func_array('mktime', $test); - - print "ts = ". date("l Y-m-d H:i:s T", $timestamp). "\n"; - $strtotime_tstamp = strtotime("first monday", $timestamp); - print "result = ".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n"; - print "wanted = Monday 00:00:00\n\n"; + date_default_timezone_set($test[0]); + print "{$test[0]}\n"; + array_shift($test); + $timestamp = call_user_func_array('mktime', $test); + + print "ts = ". date("l Y-m-d H:i:s T", $timestamp). "\n"; + $strtotime_tstamp = strtotime("first monday", $timestamp); + print "result = ".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n"; + print "wanted = Monday 00:00:00\n\n"; } ?> --EXPECTF-- diff --git a/ext/date/tests/bug21399.phpt b/ext/date/tests/bug21399.phpt index a295c8bd8b..c7ad8caf4a 100644 --- a/ext/date/tests/bug21399.phpt +++ b/ext/date/tests/bug21399.phpt @@ -4,7 +4,7 @@ Bug #21399 (strtotime() request for "YYYYMMDDhhmmss [ZZZ]") date.timezone=GMT --FILE-- <?php - echo gmdate("Y-m-d H:i:s", strtotime("20050620091407 GMT")); + echo gmdate("Y-m-d H:i:s", strtotime("20050620091407 GMT")); ?> --EXPECT-- 2005-06-20 09:14:07 diff --git a/ext/date/tests/bug26198.phpt b/ext/date/tests/bug26198.phpt index c957bfcf7a..f59a628b62 100644 --- a/ext/date/tests/bug26198.phpt +++ b/ext/date/tests/bug26198.phpt @@ -2,9 +2,9 @@ Bug #26198 (strtotime handling of "M Y" and "Y M" format) --FILE-- <?php - date_default_timezone_set("GMT"); - echo gmdate("F Y (Y-m-d H:i:s T)\n", strtotime("Oct 2001")); - echo gmdate("M Y (Y-m-d H:i:s T)\n", strtotime("2001 Oct")); + date_default_timezone_set("GMT"); + echo gmdate("F Y (Y-m-d H:i:s T)\n", strtotime("Oct 2001")); + echo gmdate("M Y (Y-m-d H:i:s T)\n", strtotime("2001 Oct")); ?> --EXPECT-- October 2001 (2001-10-01 00:00:00 GMT) diff --git a/ext/date/tests/bug26317.phpt b/ext/date/tests/bug26317.phpt index 652cc67879..38c724ed57 100644 --- a/ext/date/tests/bug26317.phpt +++ b/ext/date/tests/bug26317.phpt @@ -10,9 +10,9 @@ if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') { ?> --FILE-- <?php - echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 16:20:42 Z")); - echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 09:20:42 T")); - echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 19:20:42 C")); + echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 16:20:42 Z")); + echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 09:20:42 T")); + echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 19:20:42 C")); ?> --EXPECT-- 2003-11-19 16:20:42 diff --git a/ext/date/tests/bug26320.phpt b/ext/date/tests/bug26320.phpt index 48e901117c..563e39ab30 100644 --- a/ext/date/tests/bug26320.phpt +++ b/ext/date/tests/bug26320.phpt @@ -10,8 +10,8 @@ if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') { ?> --FILE-- <?php - echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42")); - echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42Z")); + echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42")); + echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42Z")); ?> --EXPECT-- 2003-11-19 12:30:42 diff --git a/ext/date/tests/bug26694.phpt b/ext/date/tests/bug26694.phpt index 939b04c136..a82496124f 100644 --- a/ext/date/tests/bug26694.phpt +++ b/ext/date/tests/bug26694.phpt @@ -4,7 +4,7 @@ Bug #26694 (strtotime() request for "Sun, 21 Dec 2003 20:38:33 +0000 GMT") date.timezone=GMT --FILE-- <?php - echo gmdate("Y-m-d H:i:s", strtotime("Sun, 21 Dec 2003 20:38:33 +0000 GMT")); + echo gmdate("Y-m-d H:i:s", strtotime("Sun, 21 Dec 2003 20:38:33 +0000 GMT")); ?> --EXPECT-- 2003-12-21 20:38:33 diff --git a/ext/date/tests/bug27780.phpt b/ext/date/tests/bug27780.phpt index b1cfa831a2..f6f21e4185 100644 --- a/ext/date/tests/bug27780.phpt +++ b/ext/date/tests/bug27780.phpt @@ -8,37 +8,37 @@ if (defined('PHP_WINDOWS_VERSION_MAJOR')) { --FILE-- <?php $timezones = array ( - "America/Chicago", "Europe/Amsterdam", "Asia/Jerusalem", - "Asia/Singapore", "America/Sao_Paulo" + "America/Chicago", "Europe/Amsterdam", "Asia/Jerusalem", + "Asia/Singapore", "America/Sao_Paulo" ); $timestrings = array ( - "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds", - "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds", - "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds", - "2004-04-07 00:00:00 -21 days", - "2004-04-07 00:00:00 11 days ago", - "2004-04-07 00:00:00 -10 day +2 hours", - "2004-04-07 00:00:00 -1 day", - "2004-04-07 00:00:00", - "2004-04-07 00:00:00 +1 hour", - "2004-04-07 00:00:00 +2 hour", - "2004-04-07 00:00:00 +1 day", - "2004-04-07 00:00:00 1 day", - "2004-04-07 00:00:00 +21 days", + "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds", + "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds", + "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds", + "2004-04-07 00:00:00 -21 days", + "2004-04-07 00:00:00 11 days ago", + "2004-04-07 00:00:00 -10 day +2 hours", + "2004-04-07 00:00:00 -1 day", + "2004-04-07 00:00:00", + "2004-04-07 00:00:00 +1 hour", + "2004-04-07 00:00:00 +2 hour", + "2004-04-07 00:00:00 +1 day", + "2004-04-07 00:00:00 1 day", + "2004-04-07 00:00:00 +21 days", ); foreach ($timezones as $timezone) { - date_default_timezone_set($timezone); - echo $timezone, "\n"; + date_default_timezone_set($timezone); + echo $timezone, "\n"; - foreach ($timestrings as $timestring) { - $time = strtotime($timestring); + foreach ($timestrings as $timestring) { + $time = strtotime($timestring); - echo $time, strftime(" [%Y-%m-%d %H:%M:%S %Z]", $time), " [$timestring]\n"; - } + echo $time, strftime(" [%Y-%m-%d %H:%M:%S %Z]", $time), " [$timestring]\n"; + } - echo "\n"; + echo "\n"; } ?> --EXPECTF-- diff --git a/ext/date/tests/bug28024.phpt b/ext/date/tests/bug28024.phpt index b5f97bd5c9..8229f1cd7b 100644 --- a/ext/date/tests/bug28024.phpt +++ b/ext/date/tests/bug28024.phpt @@ -4,8 +4,8 @@ Bug #28024 (Changed behavior of strtotime()) date.timezone=Europe/Berlin --FILE-- <?php - echo strtotime("17:00 2004-01-01"), "\n"; - echo date("Y-m-d H:i:s T", strtotime("17:00 2004-01-01")); + echo strtotime("17:00 2004-01-01"), "\n"; + echo date("Y-m-d H:i:s T", strtotime("17:00 2004-01-01")); ?> --EXPECT-- 1072972800 diff --git a/ext/date/tests/bug29150.phpt b/ext/date/tests/bug29150.phpt index d91d68d919..15edffa898 100644 --- a/ext/date/tests/bug29150.phpt +++ b/ext/date/tests/bug29150.phpt @@ -4,7 +4,7 @@ Bug #29150 (Roman number format for months) date.timezone=GMT --FILE-- <?php - echo gmdate("Y-m-d H:i:s", strtotime("20 VI. 2005")); + echo gmdate("Y-m-d H:i:s", strtotime("20 VI. 2005")); ?> --EXPECT-- 2005-06-20 00:00:00 diff --git a/ext/date/tests/bug30096.phpt b/ext/date/tests/bug30096.phpt index dbda97beff..5d40aa3d34 100644 --- a/ext/date/tests/bug30096.phpt +++ b/ext/date/tests/bug30096.phpt @@ -19,18 +19,18 @@ gm_date_check(03,00,00,10,30,2005); gm_date_check(04,00,00,10,30,2005); function gm_date_check($hour, $minute, $second, $month, $day, $year) { - global $ts, $tsold; + global $ts, $tsold; - echo "gmmktime($hour,$minute,$second,$month,$day,$year): "; + echo "gmmktime($hour,$minute,$second,$month,$day,$year): "; - $tsold = $ts; - $ts = gmmktime($hour, $minute, $second, $month, $day, $year); + $tsold = $ts; + $ts = gmmktime($hour, $minute, $second, $month, $day, $year); - echo $ts, " | gmdate('r', $ts):", gmdate('r', $ts); - if ($tsold > 0) { - echo " | Diff: " . ($ts - $tsold); - } - echo "\n"; + echo $ts, " | gmdate('r', $ts):", gmdate('r', $ts); + if ($tsold > 0) { + echo " | Diff: " . ($ts - $tsold); + } + echo "\n"; } ?> diff --git a/ext/date/tests/bug33578.phpt b/ext/date/tests/bug33578.phpt index 4ba6df8597..6c0d4d3bd7 100644 --- a/ext/date/tests/bug33578.phpt +++ b/ext/date/tests/bug33578.phpt @@ -2,14 +2,14 @@ Bug #33578 (strtotime() doesn't parse "11 Oct" format") --FILE-- <?php - date_default_timezone_set("UTC"); - echo date('m/d/Y', strtotime('Oct 11')), "\n"; - echo date('m/d/Y', strtotime('11 Oct')), "\n"; - echo date('m/d/Y', strtotime('11 Oct 2005')), "\n"; - echo date('m/d/Y', strtotime('Oct11')), "\n"; - echo date('m/d/Y', strtotime('11Oct')), "\n"; - echo date('m/d/Y', strtotime('11Oct 2005')), "\n"; - echo date('m/d/Y', strtotime('11Oct2005')), "\n"; + date_default_timezone_set("UTC"); + echo date('m/d/Y', strtotime('Oct 11')), "\n"; + echo date('m/d/Y', strtotime('11 Oct')), "\n"; + echo date('m/d/Y', strtotime('11 Oct 2005')), "\n"; + echo date('m/d/Y', strtotime('Oct11')), "\n"; + echo date('m/d/Y', strtotime('11Oct')), "\n"; + echo date('m/d/Y', strtotime('11Oct 2005')), "\n"; + echo date('m/d/Y', strtotime('11Oct2005')), "\n"; ?> --EXPECTF-- 10/11/%d diff --git a/ext/date/tests/bug33869.phpt b/ext/date/tests/bug33869.phpt index 6957a6b7e2..8f8e957c95 100644 --- a/ext/date/tests/bug33869.phpt +++ b/ext/date/tests/bug33869.phpt @@ -2,20 +2,20 @@ Bug #33869 (strtotime() doesn't parse "+1days" format) --FILE-- <?php - date_default_timezone_set("UTC"); - $tm = strtotime("2005-01-01 01:01:01"); - echo date(DATE_ISO8601, strtotime('+5days', $tm)); - echo "\n"; - echo date(DATE_ISO8601, strtotime('+1month', $tm)); - echo "\n"; - echo date(DATE_ISO8601, strtotime('+1year', $tm)); - echo "\n"; - echo date(DATE_ISO8601, strtotime('+5 days', $tm)); - echo "\n"; - echo date(DATE_ISO8601, strtotime('+1 month', $tm)); - echo "\n"; - echo date(DATE_ISO8601, strtotime('+1 year', $tm)); - echo "\n"; + date_default_timezone_set("UTC"); + $tm = strtotime("2005-01-01 01:01:01"); + echo date(DATE_ISO8601, strtotime('+5days', $tm)); + echo "\n"; + echo date(DATE_ISO8601, strtotime('+1month', $tm)); + echo "\n"; + echo date(DATE_ISO8601, strtotime('+1year', $tm)); + echo "\n"; + echo date(DATE_ISO8601, strtotime('+5 days', $tm)); + echo "\n"; + echo date(DATE_ISO8601, strtotime('+1 month', $tm)); + echo "\n"; + echo date(DATE_ISO8601, strtotime('+1 year', $tm)); + echo "\n"; ?> --EXPECT-- 2005-01-06T01:01:01+0000 diff --git a/ext/date/tests/bug33957.phpt b/ext/date/tests/bug33957.phpt index 43f14ee315..6ae97d7de8 100644 --- a/ext/date/tests/bug33957.phpt +++ b/ext/date/tests/bug33957.phpt @@ -5,33 +5,33 @@ Bug #33957 (gmdate('W')/date('W') sometimes returns wrong week number) date_default_timezone_set("UTC"); for ($i = 14; $i <= 31; $i++) { - echo "1992-12-$i ", date("W", strtotime("1992-12-$i")), "\n"; + echo "1992-12-$i ", date("W", strtotime("1992-12-$i")), "\n"; } for ($i = 1; $i <= 8; $i++) { - echo "1993-01-$i ", date("W", strtotime("1993-01-$i")), "\n"; + echo "1993-01-$i ", date("W", strtotime("1993-01-$i")), "\n"; } echo "----\n"; echo " "; foreach (range(1992, 2019) as $year) { - echo "$year "; + echo "$year "; } echo "\n"; for ($i = 14; $i <= 31; $i++) { - echo " (12-$i) "; - foreach (range(1992, 2019) as $year) { - echo sprintf(" %02d-", date("W", strtotime("$year-12-$i"))); - echo sprintf("%04d ", date("o", strtotime("$year-12-$i"))); - } - echo "\n"; + echo " (12-$i) "; + foreach (range(1992, 2019) as $year) { + echo sprintf(" %02d-", date("W", strtotime("$year-12-$i"))); + echo sprintf("%04d ", date("o", strtotime("$year-12-$i"))); + } + echo "\n"; } for ($i = 1; $i <= 18; $i++) { - printf("+1 (01-%02d) ", $i); - foreach (range(1993, 2020) as $year) { - echo sprintf(" %02d-", date("W", strtotime("$year-1-$i"))); - echo sprintf("%04d ", date("o", strtotime("$year-1-$i"))); - } - echo "\n"; + printf("+1 (01-%02d) ", $i); + foreach (range(1993, 2020) as $year) { + echo sprintf(" %02d-", date("W", strtotime("$year-1-$i"))); + echo sprintf("%04d ", date("o", strtotime("$year-1-$i"))); + } + echo "\n"; } echo "----\n"; ?> diff --git a/ext/date/tests/bug34676.phpt b/ext/date/tests/bug34676.phpt index 6f616feb40..ec2fcf9270 100644 --- a/ext/date/tests/bug34676.phpt +++ b/ext/date/tests/bug34676.phpt @@ -5,12 +5,12 @@ Bug #34676 (missing support for strtotime("midnight") and strtotime("noon")) date_default_timezone_set("UTC"); $tests = array( - 'noon', 'midnight' + 'noon', 'midnight' ); foreach ($tests as $test) { - $t = strtotime("2005-12-22 ". $test); - printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t)); + $t = strtotime("2005-12-22 ". $test); + printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t)); } ?> diff --git a/ext/date/tests/bug34771.phpt b/ext/date/tests/bug34771.phpt index a27d085a1d..d3134d1d6b 100644 --- a/ext/date/tests/bug34771.phpt +++ b/ext/date/tests/bug34771.phpt @@ -5,15 +5,15 @@ Bug #34771 (strtotime() fails with 1-12am/pm) date_default_timezone_set("UTC"); $tests = array( - '12am', '1am', '1pm', - '12a.m.', '1a.m.', '1p.m.', - '12:00am', '1:00am', '1:00pm', - '12:00a.m.', '1:00a.m.', '1:00p.m.' + '12am', '1am', '1pm', + '12a.m.', '1a.m.', '1p.m.', + '12:00am', '1:00am', '1:00pm', + '12:00a.m.', '1:00a.m.', '1:00p.m.' ); foreach ($tests as $test) { - $t = strtotime("2005-12-22 ". $test); - printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t)); + $t = strtotime("2005-12-22 ". $test); + printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t)); } ?> diff --git a/ext/date/tests/bug35425.phpt b/ext/date/tests/bug35425.phpt index e55a4f5219..ed9f87fd58 100644 --- a/ext/date/tests/bug35425.phpt +++ b/ext/date/tests/bug35425.phpt @@ -7,7 +7,7 @@ date.timezone=America/Montreal $time = mktime(1,1,1,1,1,2005); foreach (array('B','d','h','H','i','I','L','m','s','t','U','w','W','y','Y','z','Z') as $v) { - var_dump(idate($v, $time)); + var_dump(idate($v, $time)); } ?> diff --git a/ext/date/tests/bug35624.phpt b/ext/date/tests/bug35624.phpt index 722adba823..39fe555224 100644 --- a/ext/date/tests/bug35624.phpt +++ b/ext/date/tests/bug35624.phpt @@ -7,9 +7,9 @@ date_default_timezone_set("UTC"); $days = array("monday","mon","tuesday","tue","wednesday","wed","thursday","thu","friday","fri","saturday","sat","sunday","sun"); foreach ($days as $day) { - echo date("D", strtotime($day)); - echo date("D", strtotime(ucfirst($day))); - echo "\n"; + echo date("D", strtotime($day)); + echo date("D", strtotime(ucfirst($day))); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug35885.phpt b/ext/date/tests/bug35885.phpt index b3074f7f34..974c2c2c85 100644 --- a/ext/date/tests/bug35885.phpt +++ b/ext/date/tests/bug35885.phpt @@ -12,8 +12,8 @@ $res = ($ts == $ts2); var_dump($res); if (!$res) { - var_dump($ts); - var_dump($ts2); + var_dump($ts); + var_dump($ts2); } ?> diff --git a/ext/date/tests/bug37747.phpt b/ext/date/tests/bug37747.phpt index 465f791c41..8c3d000341 100644 --- a/ext/date/tests/bug37747.phpt +++ b/ext/date/tests/bug37747.phpt @@ -4,7 +4,7 @@ Bug #37747 (strtotime segfaults when given "nextyear") <?php date_default_timezone_set("Europe/Oslo"); var_dump(strtotime("nextyear")); - echo "ALIVE\n"; + echo "ALIVE\n"; ?> --EXPECT-- bool(false) diff --git a/ext/date/tests/bug42910.phpt b/ext/date/tests/bug42910.phpt index e741db2ebc..f93ccedeaf 100644 --- a/ext/date/tests/bug42910.phpt +++ b/ext/date/tests/bug42910.phpt @@ -2,18 +2,18 @@ Bug #42910 (Constructing DateTime with TimeZone Indicator invalidates DateTimeZone) --FILE-- <?php - date_default_timezone_set('America/Los_Angeles'); - $foo = new DateTime('2007-03-11'); - $bar = new DateTime('2007-03-11T00:00:00-0800'); + date_default_timezone_set('America/Los_Angeles'); + $foo = new DateTime('2007-03-11'); + $bar = new DateTime('2007-03-11T00:00:00-0800'); - print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n"; - print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n"; + print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n"; + print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n"; - $foo->setDate(2007, 03, 12); - $bar->setDate(2007, 03, 12); + $foo->setDate(2007, 03, 12); + $bar->setDate(2007, 03, 12); - print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n"; - print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n"; + print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n"; + print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n"; // -------------- diff --git a/ext/date/tests/bug43808.phpt b/ext/date/tests/bug43808.phpt index 74b2317a20..9a1c4fad1f 100644 --- a/ext/date/tests/bug43808.phpt +++ b/ext/date/tests/bug43808.phpt @@ -5,7 +5,7 @@ Bug #43808 (date_create never fails (even when it should)) $date = date_create('asdfasdf'); if ($date instanceof DateTime) { - echo "this is wrong, should be bool"; + echo "this is wrong, should be bool"; } var_dump( $date ); diff --git a/ext/date/tests/bug44562.phpt b/ext/date/tests/bug44562.phpt index 5610474108..b4b721168f 100644 --- a/ext/date/tests/bug44562.phpt +++ b/ext/date/tests/bug44562.phpt @@ -6,11 +6,11 @@ date_default_timezone_set('Europe/Oslo'); try { - $dp = new DatePeriod('2D'); + $dp = new DatePeriod('2D'); } catch ( Exception $e ) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } $begin = new DateTime( "2008-07-20T22:44:53+0200" ); @@ -19,7 +19,7 @@ $interval = DateInterval::createFromDateString( "1 day" ); $dp = new DatePeriod( $begin, $interval, 10 ); foreach ( $dp as $d ) { - var_dump ($d->format( DATE_ISO8601 ) ); + var_dump ($d->format( DATE_ISO8601 ) ); } ?> diff --git a/ext/date/tests/bug44742.phpt b/ext/date/tests/bug44742.phpt index 48952b4e6c..e87c1acb06 100644 --- a/ext/date/tests/bug44742.phpt +++ b/ext/date/tests/bug44742.phpt @@ -4,22 +4,22 @@ Bug #44742 (timezone_offset_get() causes segmentation faults) <?php date_default_timezone_set('Europe/London'); $dates = array( - "2008-04-11 00:00:00+0000", - "2008-04-11 00:00:00+0200", - "2008-04-11 00:00:00+0330", - "2008-04-11 00:00:00-0500", - "2008-04-11 00:00:00-1130", - "2008-04-11 00:00:00 CEST", - "2008-04-11 00:00:00 CET", - "2008-04-11 00:00:00 UTC", - "2008-04-11 00:00:00 America/New_York", - "2008-04-11 00:00:00 Europe/Oslo", - "2008-04-11 00:00:00 Asia/Singapore", + "2008-04-11 00:00:00+0000", + "2008-04-11 00:00:00+0200", + "2008-04-11 00:00:00+0330", + "2008-04-11 00:00:00-0500", + "2008-04-11 00:00:00-1130", + "2008-04-11 00:00:00 CEST", + "2008-04-11 00:00:00 CET", + "2008-04-11 00:00:00 UTC", + "2008-04-11 00:00:00 America/New_York", + "2008-04-11 00:00:00 Europe/Oslo", + "2008-04-11 00:00:00 Asia/Singapore", ); foreach ($dates as $date) { - $date = date_create($date); - var_dump(timezone_offset_get(date_timezone_get($date), $date)); + $date = date_create($date); + var_dump(timezone_offset_get(date_timezone_get($date), $date)); } ?> --EXPECT-- diff --git a/ext/date/tests/bug45543.phpt b/ext/date/tests/bug45543.phpt index 42a97ab20c..ed785a715a 100644 --- a/ext/date/tests/bug45543.phpt +++ b/ext/date/tests/bug45543.phpt @@ -5,21 +5,21 @@ date.timezone=UTC --FILE-- <?php $test_dates = array( - '2008-01-01 12:00:00 PDT', - '2008-01-01 12:00:00 +02:00', + '2008-01-01 12:00:00 PDT', + '2008-01-01 12:00:00 +02:00', ); foreach ($test_dates as $test_date) { - $d1 = new DateTime($test_date); - $d2 = new DateTime('2008-01-01 12:00:00 UTC'); - echo $d1->format(DATE_ISO8601), PHP_EOL; - echo $d2->format(DATE_ISO8601), PHP_EOL; - $tz = $d1->getTimeZone(); - $d2->setTimeZone($tz); - echo $d1->format(DATE_ISO8601), PHP_EOL; - echo $d2->format(DATE_ISO8601), PHP_EOL; - echo PHP_EOL; + $d1 = new DateTime($test_date); + $d2 = new DateTime('2008-01-01 12:00:00 UTC'); + echo $d1->format(DATE_ISO8601), PHP_EOL; + echo $d2->format(DATE_ISO8601), PHP_EOL; + $tz = $d1->getTimeZone(); + $d2->setTimeZone($tz); + echo $d1->format(DATE_ISO8601), PHP_EOL; + echo $d2->format(DATE_ISO8601), PHP_EOL; + echo PHP_EOL; } --EXPECT-- 2008-01-01T12:00:00-0700 diff --git a/ext/date/tests/bug48476.phpt b/ext/date/tests/bug48476.phpt index 02086e0e56..139c2e17e2 100644 --- a/ext/date/tests/bug48476.phpt +++ b/ext/date/tests/bug48476.phpt @@ -3,10 +3,10 @@ Bug #48476 (cloning extended DateTime class without calling parent::__constr cra --FILE-- <?php class MyDateTime extends DateTime { - public function __construct() { } + public function __construct() { } } class MyDateTimeZone extends DateTimeZone { - public function __construct() { } + public function __construct() { } } $o = new MyDateTime; diff --git a/ext/date/tests/bug50392.phpt b/ext/date/tests/bug50392.phpt index 9b1002317d..64def49f66 100644 --- a/ext/date/tests/bug50392.phpt +++ b/ext/date/tests/bug50392.phpt @@ -7,14 +7,14 @@ date_default_timezone_set('Europe/Bratislava'); $base = '2009-03-01 18:00:00'; for ($i = 0; $i < 8; $i++) { - $string = $base . '.' . str_repeat($i, $i); - echo $string, "\n- "; - $result = date_parse_from_format('Y-m-d H:i:s.u', $string); - echo $result['fraction'] ? $result['fraction'] : 'X', "\n"; - foreach( $result['errors'] as $error ) { - echo "- ", $error, "\n"; - } - echo "\n"; + $string = $base . '.' . str_repeat($i, $i); + echo $string, "\n- "; + $result = date_parse_from_format('Y-m-d H:i:s.u', $string); + echo $result['fraction'] ? $result['fraction'] : 'X', "\n"; + foreach( $result['errors'] as $error ) { + echo "- ", $error, "\n"; + } + echo "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug51096.phpt b/ext/date/tests/bug51096.phpt index 2b479a94a6..dafb60bcde 100644 --- a/ext/date/tests/bug51096.phpt +++ b/ext/date/tests/bug51096.phpt @@ -3,26 +3,26 @@ Bug #51096 (Test for "first day" vs "first day of") --FILE-- <?php $tests = array( - 'first day', - 'last day', - 'next month', - 'first day next month', - 'last day next month', - 'first day of next month', - 'last day of next month' + 'first day', + 'last day', + 'next month', + 'first day next month', + 'last day next month', + 'first day of next month', + 'last day of next month' ); foreach ( $tests as $test ) { - $result = date_parse( $test ); - $rel = $result['relative']; - echo $test, "\n- month: ", $rel['month'], '; day: ', $rel['day'], - '; first-day-of: ', isset( $rel['first_day_of_month'] ) ? 'true' : 'false', - '; last-day-of: ', isset( $rel['last_day_of_month'] ) ? 'true' : 'false', "\n"; - $date = new DateTime( '2010-03-06 15:21 UTC' ); - echo '- ', $date->format( DateTime::ISO8601 ); - $date->modify( $test ); - echo ' -> ', $date->format( DateTime::ISO8601 ), "\n\n"; + $result = date_parse( $test ); + $rel = $result['relative']; + echo $test, "\n- month: ", $rel['month'], '; day: ', $rel['day'], + '; first-day-of: ', isset( $rel['first_day_of_month'] ) ? 'true' : 'false', + '; last-day-of: ', isset( $rel['last_day_of_month'] ) ? 'true' : 'false', "\n"; + $date = new DateTime( '2010-03-06 15:21 UTC' ); + echo '- ', $date->format( DateTime::ISO8601 ); + $date->modify( $test ); + echo ' -> ', $date->format( DateTime::ISO8601 ), "\n\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug51866.phpt b/ext/date/tests/bug51866.phpt index 9481aebe9d..1874e32706 100644 --- a/ext/date/tests/bug51866.phpt +++ b/ext/date/tests/bug51866.phpt @@ -5,22 +5,22 @@ Bug #51866 (Lenient parsing with parseFromFormat) date_default_timezone_set('UTC'); $tests = array( - array( 'Y-m-d', '2001-11-29 13:20:01' ), - array( 'Y-m-d+', '2001-11-29 13:20:01' ), - array( 'Y-m-d +', '2001-11-29 13:20:01' ), - array( 'Y-m-d+', '2001-11-29' ), - array( 'Y-m-d +', '2001-11-29' ), - array( 'Y-m-d +', '2001-11-29 ' ), + array( 'Y-m-d', '2001-11-29 13:20:01' ), + array( 'Y-m-d+', '2001-11-29 13:20:01' ), + array( 'Y-m-d +', '2001-11-29 13:20:01' ), + array( 'Y-m-d+', '2001-11-29' ), + array( 'Y-m-d +', '2001-11-29' ), + array( 'Y-m-d +', '2001-11-29 ' ), ); foreach( $tests as $test ) { - list($format, $str) = $test; - var_dump($format, $str); - $d = DateTime::createFromFormat($format, $str); - var_dump($d); - var_dump(DateTime::getLastErrors()); + list($format, $str) = $test; + var_dump($format, $str); + $d = DateTime::createFromFormat($format, $str); + var_dump($d); + var_dump(DateTime::getLastErrors()); - echo "\n\n"; + echo "\n\n"; } --EXPECTF-- string(5) "Y-m-d" diff --git a/ext/date/tests/bug52808.phpt b/ext/date/tests/bug52808.phpt index 810874858f..10776923c0 100644 --- a/ext/date/tests/bug52808.phpt +++ b/ext/date/tests/bug52808.phpt @@ -4,22 +4,22 @@ Bug #52808 (Segfault when specifying interval as two dates) <?php date_default_timezone_set('Europe/Oslo'); $intervals = array( - "2008-05-11T15:30:00Z/2007-03-01T13:00:00Z", - "2007-05-11T15:30:00Z/2008-03-01T13:00:00Z", - "2007-05-11T15:30:00Z 2008-03-01T13:00:00Z", - "2007-05-11T15:30:00Z/", - "2007-05-11T15:30:00Z", - "2007-05-11T15:30:00Z/:00Z", + "2008-05-11T15:30:00Z/2007-03-01T13:00:00Z", + "2007-05-11T15:30:00Z/2008-03-01T13:00:00Z", + "2007-05-11T15:30:00Z 2008-03-01T13:00:00Z", + "2007-05-11T15:30:00Z/", + "2007-05-11T15:30:00Z", + "2007-05-11T15:30:00Z/:00Z", ); foreach($intervals as $iv) { try { - $di = new DateInterval($iv); - var_dump($di); + $di = new DateInterval($iv); + var_dump($di); } catch ( Exception $e ) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } } echo "==DONE==\n"; diff --git a/ext/date/tests/bug53437_var4.phpt b/ext/date/tests/bug53437_var4.phpt index 753401539a..b53483ab7f 100644 --- a/ext/date/tests/bug53437_var4.phpt +++ b/ext/date/tests/bug53437_var4.phpt @@ -9,15 +9,15 @@ $dt = new DateTime('2009-10-11'); $df = $dt->diff(new DateTime('2009-10-13')); var_dump($df, - $df->y, - $df->m, - $df->d, - $df->h, - $df->i, - $df->s, - $df->f, - $df->invert, - $df->days); + $df->y, + $df->m, + $df->d, + $df->h, + $df->i, + $df->s, + $df->f, + $df->invert, + $df->days); ?> --EXPECTF-- diff --git a/ext/date/tests/bug54283.phpt b/ext/date/tests/bug54283.phpt index 9a8a07ce5a..65669b6b39 100644 --- a/ext/date/tests/bug54283.phpt +++ b/ext/date/tests/bug54283.phpt @@ -4,9 +4,9 @@ Bug #54283 (new DatePeriod(NULL) causes crash) <?php try { - var_dump(new DatePeriod(NULL)); + var_dump(new DatePeriod(NULL)); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> diff --git a/ext/date/tests/bug61642.phpt b/ext/date/tests/bug61642.phpt index 872ceb4f3e..b8130f05aa 100644 --- a/ext/date/tests/bug61642.phpt +++ b/ext/date/tests/bug61642.phpt @@ -12,26 +12,26 @@ $dates = array('2012-03-29', '2012-03-30', '2012-03-31', '2012-04-01', '2012-04- $header = array(); foreach ($dates as $startdate) { - $date = new DateTime($startdate); + $date = new DateTime($startdate); - $header[] = $date->format('Y-m-d D'); + $header[] = $date->format('Y-m-d D'); } echo '### ', implode(' ', $header), "\n\n"; foreach ($weekdays as $days) { - $line = array(); + $line = array(); - printf('%+3d ', $days); + printf('%+3d ', $days); - foreach ($dates as $startdate) { - $date = new DateTime($startdate); - $date->modify("{$days} weekdays"); + foreach ($dates as $startdate) { + $date = new DateTime($startdate); + $date->modify("{$days} weekdays"); - $line[] = $date->format('Y-m-d D'); - } + $line[] = $date->format('Y-m-d D'); + } - echo implode(' ', $line), "\n"; + echo implode(' ', $line), "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug63391.phpt b/ext/date/tests/bug63391.phpt index a29d25e730..58da985e08 100644 --- a/ext/date/tests/bug63391.phpt +++ b/ext/date/tests/bug63391.phpt @@ -8,7 +8,7 @@ print "Date PHP\n"; print "---------- ---\n"; $dates = array('1599-12-30', '1599-12-31', '1600-01-01', '1600-01-02'); foreach ($dates as $date) { - echo date_create($date)->format('Y-m-d D'), "\n"; + echo date_create($date)->format('Y-m-d D'), "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug63435.phpt b/ext/date/tests/bug63435.phpt index dcec6e46e7..9dbc2fda12 100644 --- a/ext/date/tests/bug63435.phpt +++ b/ext/date/tests/bug63435.phpt @@ -5,11 +5,11 @@ date.timezone=UTC --FILE-- <?php for ($i=1 ; $i<999 ; $i++) { - $datetime = Datetime::createFromFormat("u", sprintf("%06ld", $i)); - $res = $datetime->format("u"); - if ($res != $i) { - echo "$i != $res\n"; - } + $datetime = Datetime::createFromFormat("u", sprintf("%06ld", $i)); + $res = $datetime->format("u"); + if ($res != $i) { + echo "$i != $res\n"; + } } echo "Done"; --EXPECT-- diff --git a/ext/date/tests/bug63740.phpt b/ext/date/tests/bug63740.phpt index 18c5a57d77..d0056987cd 100644 --- a/ext/date/tests/bug63740.phpt +++ b/ext/date/tests/bug63740.phpt @@ -3,28 +3,28 @@ Bug #63740 (strtotime seems to use both sunday and monday as start of week) --FILE-- <?php $dates = [ - '2015-07-04', - '2015-07-05', - '2015-07-06', - '2015-07-07', - '2015-07-08', - '2015-07-09', - '2015-07-10', - '2015-07-11', - '2015-07-12', - '2015-07-13', - '2015-07-14', + '2015-07-04', + '2015-07-05', + '2015-07-06', + '2015-07-07', + '2015-07-08', + '2015-07-09', + '2015-07-10', + '2015-07-11', + '2015-07-12', + '2015-07-13', + '2015-07-14', ]; foreach ( $dates as $date ) { - $dt = new DateTimeImmutable( "$date 00:00 UTC" ); + $dt = new DateTimeImmutable( "$date 00:00 UTC" ); - echo $dt->format( "D Y-m-d H:i" ), " → "; + echo $dt->format( "D Y-m-d H:i" ), " → "; - $dtn = $dt->modify( "this week" ); + $dtn = $dt->modify( "this week" ); - echo $dtn->format( "D Y-m-d H:i" ), "\n"; + echo $dtn->format( "D Y-m-d H:i" ), "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug64887.phpt b/ext/date/tests/bug64887.phpt index dba1921eac..52c5e0fa8d 100644 --- a/ext/date/tests/bug64887.phpt +++ b/ext/date/tests/bug64887.phpt @@ -5,28 +5,28 @@ date.timezone=UTC --FILE-- <?php $tests = [ - '+1 ms', - '-2 msec', - '+3 msecs', - '-4 millisecond', - '+5 milliseconds', + '+1 ms', + '-2 msec', + '+3 msecs', + '-4 millisecond', + '+5 milliseconds', - '-6 usec', - '+7 usecs', - '-8 microsecond', - '+9 microseconds', - '-10 µs', - '+11 µsec', - '-12 µsecs', + '-6 usec', + '+7 usecs', + '-8 microsecond', + '+9 microseconds', + '-10 µs', + '+11 µsec', + '-12 µsecs', - '+8 msec -2 µsec', + '+8 msec -2 µsec', ]; $datetime = new DateTimeImmutable( "2016-10-07 13:25:50" ); foreach ( $tests as $test ) { - echo $datetime->modify( $test )->format( 'Y-m-d H:i:s.u' ), "\n"; + echo $datetime->modify( $test )->format( 'Y-m-d H:i:s.u' ), "\n"; } ?> diff --git a/ext/date/tests/bug65184.phpt b/ext/date/tests/bug65184.phpt index 62c41652bb..30a24f2493 100644 --- a/ext/date/tests/bug65184.phpt +++ b/ext/date/tests/bug65184.phpt @@ -10,16 +10,16 @@ if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { date.timezone = UTC --FILE-- <?php - setlocale(LC_ALL, 'Japanese_Japan.932'); - /* timestamp has to be some wednesday */ - $s = strftime('%A', 1372884126); + setlocale(LC_ALL, 'Japanese_Japan.932'); + /* timestamp has to be some wednesday */ + $s = strftime('%A', 1372884126); - for ($i = 0; $i < strlen($s); $i++) { - printf("%x ", ord($s[$i])); - } - echo "\n"; + for ($i = 0; $i < strlen($s); $i++) { + printf("%x ", ord($s[$i])); + } + echo "\n"; - echo strlen(strftime('%A')), "\n"; + echo strlen(strftime('%A')), "\n"; ?> --EXPECT-- 90 85 97 6a 93 fa diff --git a/ext/date/tests/bug66985.phpt b/ext/date/tests/bug66985.phpt index 37dcd3e80d..2bcf97cb37 100644 --- a/ext/date/tests/bug66985.phpt +++ b/ext/date/tests/bug66985.phpt @@ -3,18 +3,18 @@ Bug #66985 (Some timezones are no longer valid in PHP 5.5.10) --FILE-- <?php $zones = array( - "CST6CDT", "Cuba", "Egypt", "Eire", "EST5EDT", "Factory", "GB-Eire", - "GMT0", "Greenwich", "Hongkong", "Iceland", "Iran", "Israel", "Jamaica", - "Japan", "Kwajalein", "Libya", "MST7MDT", "Navajo", "NZ-CHAT", "Poland", - "Portugal", "PST8PDT", "Singapore", "Turkey", "Universal", "W-SU", + "CST6CDT", "Cuba", "Egypt", "Eire", "EST5EDT", "Factory", "GB-Eire", + "GMT0", "Greenwich", "Hongkong", "Iceland", "Iran", "Israel", "Jamaica", + "Japan", "Kwajalein", "Libya", "MST7MDT", "Navajo", "NZ-CHAT", "Poland", + "Portugal", "PST8PDT", "Singapore", "Turkey", "Universal", "W-SU", - "UTC", "GMT", "GMT+0100", "-0230", + "UTC", "GMT", "GMT+0100", "-0230", ); foreach ( $zones as $zone ) { - $d = new DateTimeZone( $zone ); - print_r($d); + $d = new DateTimeZone( $zone ); + print_r($d); } ?> --EXPECT-- diff --git a/ext/date/tests/bug67118.phpt b/ext/date/tests/bug67118.phpt index 5a7d2d1d07..ee1d8efc0a 100644 --- a/ext/date/tests/bug67118.phpt +++ b/ext/date/tests/bug67118.phpt @@ -6,17 +6,17 @@ date.timezone=Europe/Berlin <?php class mydt extends datetime { - public function __construct($time = 'now', $tz = NULL, $format = NULL) - { - if (!empty($tz) && !is_object($tz)) { - $tz = new DateTimeZone($tz); - } - try { - @parent::__construct($time, $tz); - } catch (Exception $e) { - echo "Bad date" . $this->format("Y") . "\n"; - } - } + public function __construct($time = 'now', $tz = NULL, $format = NULL) + { + if (!empty($tz) && !is_object($tz)) { + $tz = new DateTimeZone($tz); + } + try { + @parent::__construct($time, $tz); + } catch (Exception $e) { + echo "Bad date" . $this->format("Y") . "\n"; + } + } }; diff --git a/ext/date/tests/bug72096.phpt b/ext/date/tests/bug72096.phpt index 1a4a219287..4256102944 100644 --- a/ext/date/tests/bug72096.phpt +++ b/ext/date/tests/bug72096.phpt @@ -5,8 +5,8 @@ date.timezone=UTC --FILE-- <?php for ($unix = 1461283200; $unix <= 1461369600; $unix += 8000) { - echo "Time:", gmdate('Y-m-d H:i:s = B', $unix), PHP_EOL; - echo "Time:", gmdate('Y-m-d H:i:s = B', $unix - 82 * 365 * 24 * 3600), PHP_EOL; + echo "Time:", gmdate('Y-m-d H:i:s = B', $unix), PHP_EOL; + echo "Time:", gmdate('Y-m-d H:i:s = B', $unix - 82 * 365 * 24 * 3600), PHP_EOL; } ?> --EXPECT-- diff --git a/ext/date/tests/bug73294.phpt b/ext/date/tests/bug73294.phpt index 493ba92dd6..af13cdaf40 100644 --- a/ext/date/tests/bug73294.phpt +++ b/ext/date/tests/bug73294.phpt @@ -4,17 +4,17 @@ Bug #73294: DateTime wrong when date string is negative <?php for ( $i = -1050; $i <= -1000; $i++ ) { - $M = "06"; - $D = "22"; + $M = "06"; + $D = "22"; - $dt = new DateTime("{$i}-{$M}-{$D} 00:00:00"); - $expected = "{$i}-{$M}-{$D} 00:00:00"; - $result = $dt->format('Y-m-d H:i:s'); + $dt = new DateTime("{$i}-{$M}-{$D} 00:00:00"); + $expected = "{$i}-{$M}-{$D} 00:00:00"; + $result = $dt->format('Y-m-d H:i:s'); - if ( $expected != $result ) - { - echo "Wrong: Should have been {$expected}, was {$result}\n"; - } + if ( $expected != $result ) + { + echo "Wrong: Should have been {$expected}, was {$result}\n"; + } } ?> ==DONE== diff --git a/ext/date/tests/bug73837.phpt b/ext/date/tests/bug73837.phpt index b14feecd93..c11aa2c56b 100644 --- a/ext/date/tests/bug73837.phpt +++ b/ext/date/tests/bug73837.phpt @@ -6,9 +6,9 @@ $collect = []; for ( $i = 0; $i < 1000; $i++ ) { - $a = new DateTime(); - $key = "s" . $a->format( "u" ); - $collect[$key] = true; + $a = new DateTime(); + $key = "s" . $a->format( "u" ); + $collect[$key] = true; } var_dump($n = count( $collect )); diff --git a/ext/date/tests/bug74652.phpt b/ext/date/tests/bug74652.phpt index 029464be4c..3cff8beab0 100644 --- a/ext/date/tests/bug74652.phpt +++ b/ext/date/tests/bug74652.phpt @@ -5,19 +5,19 @@ date.timezone=UTC --FILE-- <?php $formats = [ - '2017-03-25 10:52:09', - '2017-03-25 10:52', - '2017-03-25 10am', - '2017-03-25', - '2017-03', - '2017.042', - '2017043', + '2017-03-25 10:52:09', + '2017-03-25 10:52', + '2017-03-25 10am', + '2017-03-25', + '2017-03', + '2017.042', + '2017043', ]; foreach ( $formats as $format ) { - $dt = new DateTimeImmutable( $format ); - echo $dt->format( 'Y-m-d H:i:s' ), "\n"; + $dt = new DateTimeImmutable( $format ); + echo $dt->format( 'Y-m-d H:i:s' ), "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug75002.phpt b/ext/date/tests/bug75002.phpt index b10e0ebe00..5c3085f316 100644 --- a/ext/date/tests/bug75002.phpt +++ b/ext/date/tests/bug75002.phpt @@ -4,13 +4,13 @@ Bug #75002 Null Pointer Dereference in timelib_time_clone <?php class aaa extends DatePeriod { - public function __construct() { } + public function __construct() { } } $start=new DateTime( '2012-08-01' ); foreach (new aaa($start) as $y) { - $a=$key; + $a=$key; } ?> diff --git a/ext/date/tests/date-time-modify-times.phpt b/ext/date/tests/date-time-modify-times.phpt index 85e0b4fdc0..4f26275c88 100644 --- a/ext/date/tests/date-time-modify-times.phpt +++ b/ext/date/tests/date-time-modify-times.phpt @@ -5,31 +5,31 @@ date.timezone=Europe/London --FILE-- <?php $tests = array( - '2010-12-15 19:42:45 UTC' => array( - 'october 23:00', // October 23rd, with a broken time - 'back of 4pm', - 'next week monday', - 'next week monday 10am', - 'tuesday noon', - 'first monday of January 2011', - 'first monday of January 2011 09:00', - ), - '2010-12-15 19:42:45' => array( - 'october 23:00', // October 23rd, with a broken time - 'march 28, 00:15', - 'march 28, 01:15', // doesn't exist because of DST - 'march 28, 02:15', - ), + '2010-12-15 19:42:45 UTC' => array( + 'october 23:00', // October 23rd, with a broken time + 'back of 4pm', + 'next week monday', + 'next week monday 10am', + 'tuesday noon', + 'first monday of January 2011', + 'first monday of January 2011 09:00', + ), + '2010-12-15 19:42:45' => array( + 'october 23:00', // October 23rd, with a broken time + 'march 28, 00:15', + 'march 28, 01:15', // doesn't exist because of DST + 'march 28, 02:15', + ), ); foreach ( $tests as $start => $data ) { - foreach ( $data as $test ) - { - echo date_create( $start ) - ->modify( $test ) - ->format( DateTime::RFC2822 ), "\n"; - } + foreach ( $data as $test ) + { + echo date_create( $start ) + ->modify( $test ) + ->format( DateTime::RFC2822 ), "\n"; + } } echo "\n"; ?> diff --git a/ext/date/tests/date.phpt b/ext/date/tests/date.phpt index 12bc9f0fce..6a371ee001 100644 --- a/ext/date/tests/date.phpt +++ b/ext/date/tests/date.phpt @@ -6,13 +6,13 @@ $tmp = "cr"; date_default_timezone_set('UTC'); for($a = 0;$a < strlen($tmp); $a++){ - echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n"; + echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n"; } date_default_timezone_set("MET"); for($a = 0;$a < strlen($tmp); $a++){ - echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n"; + echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/date_add_basic.phpt b/ext/date/tests/date_add_basic.phpt index 6bfc55f8f4..fe5c7e9c19 100644 --- a/ext/date/tests/date_add_basic.phpt +++ b/ext/date/tests/date_add_basic.phpt @@ -17,18 +17,18 @@ echo "*** Testing date_add() : basic functionality ***\n"; $startDate = '2008-01-01 12:25'; $format = 'Y-m-d H:i:s'; $intervals = array( - 'P3Y6M4DT12H30M5S', - 'P0D', - 'P2DT1M', - 'P1Y2MT23H43M150S' + 'P3Y6M4DT12H30M5S', + 'P0D', + 'P2DT1M', + 'P1Y2MT23H43M150S' ); $d = new DateTime($startDate); var_dump( $d->format($format) ); foreach($intervals as $interval) { - date_add($d, new DateInterval($interval) ); - var_dump( $d->format($format) ); + date_add($d, new DateInterval($interval) ); + var_dump( $d->format($format) ); } ?> diff --git a/ext/date/tests/date_create-1.phpt b/ext/date/tests/date_create-1.phpt index 4b156de6e4..aad2f3f9e2 100644 --- a/ext/date/tests/date_create-1.phpt +++ b/ext/date/tests/date_create-1.phpt @@ -26,7 +26,7 @@ $d[] = date_create("2005-07-14 22:30:41 Europe/Oslo", $tz1); $d[] = date_create("2005-07-14 22:30:41 America/Los_Angeles", $tz2); foreach($d as $date) { - echo $date->format(DateTime::ISO8601), "\n"; + echo $date->format(DateTime::ISO8601), "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/date_create-relative.phpt b/ext/date/tests/date_create-relative.phpt index 5d2a4196e9..02861242ca 100644 --- a/ext/date/tests/date_create-relative.phpt +++ b/ext/date/tests/date_create-relative.phpt @@ -6,47 +6,47 @@ date_create() with large relative offsets date_default_timezone_set('UTC'); if (!defined('PHP_INT_MIN')) { - define('PHP_INT_MIN', intval(-PHP_INT_MAX - 1)); + define('PHP_INT_MIN', intval(-PHP_INT_MAX - 1)); } $base_time = '28 Feb 2008 12:00:00'; // Most offsets tested in strtotime-relative.phpt. These are tests for dates outside the 32-bit range. $offsets = array( - // around 10 leap year periods (4000 years) in days - '1460000 days', - '1460969 days', - '1460970 days', - '1460971 days', - '1462970 days', + // around 10 leap year periods (4000 years) in days + '1460000 days', + '1460969 days', + '1460970 days', + '1460971 days', + '1462970 days', - // around 1 leap year period in years - '398 years', - '399 years', - '400 years', - '401 years', + // around 1 leap year period in years + '398 years', + '399 years', + '400 years', + '401 years', - // around 40000 years - '39755 years', - '39999 years', - '40000 years', - '40001 years', - '41010 years', + // around 40000 years + '39755 years', + '39999 years', + '40000 years', + '40001 years', + '41010 years', - // bigger than int (32-bit) - '10000000000 seconds', - '10000000000 minutes', - '10000000000 hours', - '10000000000 days', - '10000000000 months', - '10000000000 years', + // bigger than int (32-bit) + '10000000000 seconds', + '10000000000 minutes', + '10000000000 hours', + '10000000000 days', + '10000000000 months', + '10000000000 years', ); foreach ($offsets AS $offset) { - foreach (array('+', '-') AS $direction) { - $dt = date_create("$base_time $direction$offset"); - echo "$direction$offset: " . date_format($dt, DATE_ISO8601) . "\n"; - } + foreach (array('+', '-') AS $direction) { + $dt = date_create("$base_time $direction$offset"); + echo "$direction$offset: " . date_format($dt, DATE_ISO8601) . "\n"; + } } ?> diff --git a/ext/date/tests/date_default_timezone_get-1.phpt b/ext/date/tests/date_default_timezone_get-1.phpt index ba0607643b..32c066c1ca 100644 --- a/ext/date/tests/date_default_timezone_get-1.phpt +++ b/ext/date/tests/date_default_timezone_get-1.phpt @@ -8,9 +8,9 @@ date_default_timezone_get() function [1] date.timezone= --FILE-- <?php - putenv('TZ='); - echo date_default_timezone_get(), "\n"; - echo date('e'), "\n"; + putenv('TZ='); + echo date_default_timezone_get(), "\n"; + echo date('e'), "\n"; ?> --EXPECT-- UTC diff --git a/ext/date/tests/date_default_timezone_get-2.phpt b/ext/date/tests/date_default_timezone_get-2.phpt index 5c835c35f3..cf7478c90b 100644 --- a/ext/date/tests/date_default_timezone_get-2.phpt +++ b/ext/date/tests/date_default_timezone_get-2.phpt @@ -8,8 +8,8 @@ date_default_timezone_get() function [2] date.timezone= --FILE-- <?php - putenv('TZ='); - echo date_default_timezone_get(), "\n"; + putenv('TZ='); + echo date_default_timezone_get(), "\n"; ?> --EXPECT-- UTC diff --git a/ext/date/tests/date_default_timezone_get-3.phpt b/ext/date/tests/date_default_timezone_get-3.phpt index ffc882e6f6..6e9818724e 100644 --- a/ext/date/tests/date_default_timezone_get-3.phpt +++ b/ext/date/tests/date_default_timezone_get-3.phpt @@ -4,10 +4,10 @@ date_default_timezone_get() function [3] date.timezone=Europe/Rome --FILE-- <?php - echo date_default_timezone_get(), "\n"; + echo date_default_timezone_get(), "\n"; - date_default_timezone_set("America/Chicago"); - echo date_default_timezone_get(), "\n"; + date_default_timezone_set("America/Chicago"); + echo date_default_timezone_get(), "\n"; ?> --EXPECT-- Europe/Rome diff --git a/ext/date/tests/date_default_timezone_get-4.phpt b/ext/date/tests/date_default_timezone_get-4.phpt index 6d1982bc13..f2319856d8 100644 --- a/ext/date/tests/date_default_timezone_get-4.phpt +++ b/ext/date/tests/date_default_timezone_get-4.phpt @@ -4,7 +4,7 @@ date_default_timezone_get() function [4] date.timezone=Incorrect/Zone --FILE-- <?php - echo date_default_timezone_get(), "\n"; + echo date_default_timezone_get(), "\n"; ?> --EXPECTF-- Warning: date_default_timezone_get(): Invalid date.timezone value 'Incorrect/Zone', we selected the timezone 'UTC' for now. in %sdate_default_timezone_get-4.php on line %d diff --git a/ext/date/tests/date_default_timezone_set-1.phpt b/ext/date/tests/date_default_timezone_set-1.phpt index 7e7ba7972f..54f1fa73f3 100644 --- a/ext/date/tests/date_default_timezone_set-1.phpt +++ b/ext/date/tests/date_default_timezone_set-1.phpt @@ -8,18 +8,18 @@ if (substr(PHP_OS, 0, 3) == 'WIN') die('skip diff TZ detection on windows.'); date.timezone= --FILE-- <?php - putenv("TZ="); - $date1 = strtotime("2005-01-12 08:00:00"); - $date2 = strtotime("2005-07-12 08:00:00"); - date_default_timezone_set("America/Indiana/Knox"); - $date3 = strtotime("2005-01-12 08:00:00"); - $date4 = strtotime("2005-07-12 08:00:00"); + putenv("TZ="); + $date1 = strtotime("2005-01-12 08:00:00"); + $date2 = strtotime("2005-07-12 08:00:00"); + date_default_timezone_set("America/Indiana/Knox"); + $date3 = strtotime("2005-01-12 08:00:00"); + $date4 = strtotime("2005-07-12 08:00:00"); - echo date_default_timezone_get(), "\n"; - echo date(DATE_ISO8601, $date1), "\n"; - echo date(DATE_ISO8601, $date2), "\n"; - echo date(DATE_ISO8601, $date3), "\n"; - echo date(DATE_ISO8601, $date4), "\n"; + echo date_default_timezone_get(), "\n"; + echo date(DATE_ISO8601, $date1), "\n"; + echo date(DATE_ISO8601, $date2), "\n"; + echo date(DATE_ISO8601, $date3), "\n"; + echo date(DATE_ISO8601, $date4), "\n"; ?> --EXPECT-- America/Indiana/Knox diff --git a/ext/date/tests/date_diff.phpt b/ext/date/tests/date_diff.phpt index e01a94e767..d5cc58271c 100644 --- a/ext/date/tests/date_diff.phpt +++ b/ext/date/tests/date_diff.phpt @@ -13,48 +13,48 @@ define( 'COUNT', 120 ); $d0 = new DateTime('2009-11-20'); for ( $i = 0; $i < COUNT * 12; $i++ ) { - $d = clone $d0; - $dates[$i] = $d->add( new DateInterval( "P{$i}D" ) ); + $d = clone $d0; + $dates[$i] = $d->add( new DateInterval( "P{$i}D" ) ); } for ( $i = 0; $i < COUNT; $i++) { // echo $dates[$i]->format( "Y-m-d\n" ); - for ( $j = 0; $j < COUNT * 12; $j++) - { - $diff = date_diff( $dates[$i], $dates[$j] ); - /* - printf( "\t%s %s %3d %s\n", - $dates[$i]->format( 'Y-m-d' ), - $dates[$j]->format( 'Y-m-d' ), - $diff->format( '%a' ), - $diff->format( '%y-%m-%d' ) - ); - */ + for ( $j = 0; $j < COUNT * 12; $j++) + { + $diff = date_diff( $dates[$i], $dates[$j] ); + /* + printf( "\t%s %s %3d %s\n", + $dates[$i]->format( 'Y-m-d' ), + $dates[$j]->format( 'Y-m-d' ), + $diff->format( '%a' ), + $diff->format( '%y-%m-%d' ) + ); + */ - $current = clone $dates[$i]; - $int = new DateInterval( $diff->format( 'P%yY%mM%dD' ) ); - if ( $current > $dates[$j] ) - { - $current->sub( $int ); - } - else - { - $current->add( $int ); - } - if ( $current != $dates[$j] ) - { - echo "FAIL: ", - $dates[$i]->format( 'Y-m-d' ), " + ", - $int->format( '%y-%m-%d' ), " = ", - $current->format( 'Y-m-d' ), " (", - $dates[$j]->format( 'Y-m-d' ), ")\n"; - } - else - { - $ok++; - } - } + $current = clone $dates[$i]; + $int = new DateInterval( $diff->format( 'P%yY%mM%dD' ) ); + if ( $current > $dates[$j] ) + { + $current->sub( $int ); + } + else + { + $current->add( $int ); + } + if ( $current != $dates[$j] ) + { + echo "FAIL: ", + $dates[$i]->format( 'Y-m-d' ), " + ", + $int->format( '%y-%m-%d' ), " = ", + $current->format( 'Y-m-d' ), " (", + $dates[$j]->format( 'Y-m-d' ), ")\n"; + } + else + { + $ok++; + } + } } echo $ok, "\n"; diff --git a/ext/date/tests/date_interval_prop_dim.phpt b/ext/date/tests/date_interval_prop_dim.phpt index 3f9af6f472..5d33badebe 100644 --- a/ext/date/tests/date_interval_prop_dim.phpt +++ b/ext/date/tests/date_interval_prop_dim.phpt @@ -7,8 +7,8 @@ $z = new Z('P2Y4DT6H8M'); $i = 0; $z->prop[1]=10; while ($i < 1026) { - $z->prop[$i] = $i; - $i++; + $z->prop[$i] = $i; + $i++; } ?> ==NOCRASH== diff --git a/ext/date/tests/date_period-immutable.phpt b/ext/date/tests/date_period-immutable.phpt index 0ec4b4a130..accc1dc0a3 100644 --- a/ext/date/tests/date_period-immutable.phpt +++ b/ext/date/tests/date_period-immutable.phpt @@ -10,18 +10,18 @@ $di = DateInterval::createFromDateString( 'first day of next month' ); foreach ( new DatePeriod( $db1, $di, $de ) as $dt ) { - echo get_class( $dt ), "\n"; - echo $dt->format( "l Y-m-d\n" ); + echo get_class( $dt ), "\n"; + echo $dt->format( "l Y-m-d\n" ); echo $dt->modify( "3 tuesday" )->format( "l Y-m-d\n" ); - echo $dt->format( "l Y-m-d\n\n" ); + echo $dt->format( "l Y-m-d\n\n" ); } foreach ( new DatePeriod( $db2, $di, $de ) as $dt ) { - echo get_class( $dt ), "\n"; - echo $dt->format( "l Y-m-d\n" ); + echo get_class( $dt ), "\n"; + echo $dt->format( "l Y-m-d\n" ); echo $dt->modify( "3 tuesday" )->format( "l Y-m-d\n" ); - echo $dt->format( "l Y-m-d\n\n" ); + echo $dt->format( "l Y-m-d\n\n" ); } ?> --EXPECT-- diff --git a/ext/date/tests/date_sub_basic.phpt b/ext/date/tests/date_sub_basic.phpt index eb8aeb5eb2..fc93919d52 100644 --- a/ext/date/tests/date_sub_basic.phpt +++ b/ext/date/tests/date_sub_basic.phpt @@ -17,18 +17,18 @@ echo "*** Testing date_sub() : basic functionality ***\n"; $startDate = '2008-01-01 12:25'; $format = 'Y-m-d H:i:s'; $intervals = array( - 'P3Y6M4DT12H30M5S', - 'P0D', - 'P2DT1M', - 'P1Y2MT23H43M150S' + 'P3Y6M4DT12H30M5S', + 'P0D', + 'P2DT1M', + 'P1Y2MT23H43M150S' ); $d = new DateTime($startDate); var_dump( $d->format($format) ); foreach($intervals as $interval) { - date_sub($d, new DateInterval($interval) ); - var_dump( $d->format($format) ); + date_sub($d, new DateInterval($interval) ); + var_dump( $d->format($format) ); } ?> diff --git a/ext/date/tests/date_sun_info_002.phpt b/ext/date/tests/date_sun_info_002.phpt index f74f1c88de..1ff58295e3 100644 --- a/ext/date/tests/date_sun_info_002.phpt +++ b/ext/date/tests/date_sun_info_002.phpt @@ -6,7 +6,7 @@ date_default_timezone_set('Europe/Oslo'); $sun_info = date_sun_info(strtotime("2007-04-13 08:31:15 UTC"), 59.21, 9.61); foreach ($sun_info as $key => $elem ) { - echo date( 'Y-m-d H:i:s T', $elem ), " ", $key, "\n"; + echo date( 'Y-m-d H:i:s T', $elem ), " ", $key, "\n"; } echo "Done\n"; ?> diff --git a/ext/date/tests/date_sunrise_variation7.phpt b/ext/date/tests/date_sunrise_variation7.phpt index 90d3e28333..9d92d1b58f 100644 --- a/ext/date/tests/date_sunrise_variation7.phpt +++ b/ext/date/tests/date_sunrise_variation7.phpt @@ -12,24 +12,24 @@ echo "*** Testing date_sunrise() : usage variation ***\n"; //Timezones with required data for date_sunrise $inputs = array ( - //Timezone with Latitude, Longitude and GMT offset - "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11), - "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9), - "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5), - "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3), - "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => -7.58, "GMT" => 0), - "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4), - "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8), - "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10), - "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12), + //Timezone with Latitude, Longitude and GMT offset + "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11), + "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9), + "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5), + "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3), + "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => -7.58, "GMT" => 0), + "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4), + "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8), + "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10), + "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12), ); foreach($inputs as $timezone => $value) { - date_default_timezone_set($timezone); - $time = mktime(8, 8, 8, 8, 11, 2008); - var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] )); - $time = mktime(8, 8, 8, 8, 12, 2008); - var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) ); + date_default_timezone_set($timezone); + $time = mktime(8, 8, 8, 8, 11, 2008); + var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] )); + $time = mktime(8, 8, 8, 8, 12, 2008); + var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) ); } ?> diff --git a/ext/date/tests/date_sunrise_variation8.phpt b/ext/date/tests/date_sunrise_variation8.phpt index 6b115c3218..d866e3ed7b 100644 --- a/ext/date/tests/date_sunrise_variation8.phpt +++ b/ext/date/tests/date_sunrise_variation8.phpt @@ -14,24 +14,24 @@ echo "*** Testing date_sunrise() : usage variation ***\n"; date_default_timezone_set("Africa/Casablanca"); $time_date = array ( - //Date at which Sun is up all day at North Pole - "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008), - "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008), + //Date at which Sun is up all day at North Pole + "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008), + "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008), - //Date at which Sun is up all day at South Pole - "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008), - "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008), + //Date at which Sun is up all day at South Pole + "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008), + "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008), ); //Iterate over different date and time foreach( $time_date as $date => $time ){ - echo "\n--$date--\n"; - var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, 90, 0 ) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, -90, 0 ) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) ); + echo "\n--$date--\n"; + var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, 90, 0 ) ); + var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) ); + var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) ); + var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, -90, 0 ) ); + var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) ); + var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) ); } ?> diff --git a/ext/date/tests/date_sunset_variation7.phpt b/ext/date/tests/date_sunset_variation7.phpt index 3d51a0ca26..380e466c0d 100644 --- a/ext/date/tests/date_sunset_variation7.phpt +++ b/ext/date/tests/date_sunset_variation7.phpt @@ -12,25 +12,25 @@ echo "*** Testing date_sunset() : usage variation ***\n"; //Timezones with required data for date_sunrise $inputs = array ( - //Timezone with Latitude, Longitude and GMT offset - "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11), - "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9), - "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5), - "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3), - "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => "-7.58", "GMT" => 0), - "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4), - "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8), - "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10), - "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12), + //Timezone with Latitude, Longitude and GMT offset + "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11), + "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9), + "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5), + "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3), + "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => "-7.58", "GMT" => 0), + "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4), + "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8), + "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10), + "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12), ); foreach($inputs as $timezone => $value) { - echo "\n--$timezone--\n"; - date_default_timezone_set($timezone); - $time = mktime(8, 8, 8, 8, 11, 2008); - var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] )); - $time = mktime(8, 8, 8, 8, 12, 2008); - var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) ); + echo "\n--$timezone--\n"; + date_default_timezone_set($timezone); + $time = mktime(8, 8, 8, 8, 11, 2008); + var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] )); + $time = mktime(8, 8, 8, 8, 12, 2008); + var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) ); } ?> --EXPECT-- diff --git a/ext/date/tests/date_sunset_variation8.phpt b/ext/date/tests/date_sunset_variation8.phpt index 7470a04c07..a5f6794f62 100644 --- a/ext/date/tests/date_sunset_variation8.phpt +++ b/ext/date/tests/date_sunset_variation8.phpt @@ -14,24 +14,24 @@ echo "*** Testing date_sunset() : usage variation ***\n"; date_default_timezone_set("Africa/Casablanca"); $time_date = array ( - //Date at which Sun is up all day at North Pole - "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008), - "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008), + //Date at which Sun is up all day at North Pole + "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008), + "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008), - //Date at which Sun is up all day at South Pole - "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008), - "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008), + //Date at which Sun is up all day at South Pole + "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008), + "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008), ); //Iterate over different date and time foreach( $time_date as $date => $time ){ - echo "\n--$date--\n"; - var_dump( date_sunset($time, SUNFUNCS_RET_STRING, 90, 0 ) ); - var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) ); - var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) ); - var_dump( date_sunset($time, SUNFUNCS_RET_STRING, -90, 0 ) ); - var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) ); - var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) ); + echo "\n--$date--\n"; + var_dump( date_sunset($time, SUNFUNCS_RET_STRING, 90, 0 ) ); + var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) ); + var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) ); + var_dump( date_sunset($time, SUNFUNCS_RET_STRING, -90, 0 ) ); + var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) ); + var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) ); } ?> diff --git a/ext/date/tests/date_time_immutable.phpt b/ext/date/tests/date_time_immutable.phpt index b4a576570e..a7e0348288 100644 --- a/ext/date/tests/date_time_immutable.phpt +++ b/ext/date/tests/date_time_immutable.phpt @@ -9,9 +9,9 @@ $current = "2012-12-27 16:24:08"; function dump($a, $b, $c) { - echo 'orig: ', $a->format('Y-m-d H:i:s e'), "\n"; - echo 'copy: ', $b->format('Y-m-d H:i:s e'), "\n"; - echo 'changed: ', $c->format('Y-m-d H:i:s e'), "\n"; + echo 'orig: ', $a->format('Y-m-d H:i:s e'), "\n"; + echo 'copy: ', $b->format('Y-m-d H:i:s e'), "\n"; + echo 'changed: ', $c->format('Y-m-d H:i:s e'), "\n"; } echo "modify():\n"; diff --git a/ext/date/tests/default-timezone-1.phpt b/ext/date/tests/default-timezone-1.phpt index a53d370afb..6435f85c42 100644 --- a/ext/date/tests/default-timezone-1.phpt +++ b/ext/date/tests/default-timezone-1.phpt @@ -3,8 +3,8 @@ date.timezone setting [1] --FILE-- <?php date_default_timezone_set('GMT'); - putenv('TZ='); // clean TZ so that it doesn't bypass the ini option - echo strtotime("2005-06-18 22:15:44"); + putenv('TZ='); // clean TZ so that it doesn't bypass the ini option + echo strtotime("2005-06-18 22:15:44"); ?> --EXPECT-- 1119132944 diff --git a/ext/date/tests/default-timezone-2.phpt b/ext/date/tests/default-timezone-2.phpt index b414eb2af3..7223340388 100644 --- a/ext/date/tests/default-timezone-2.phpt +++ b/ext/date/tests/default-timezone-2.phpt @@ -3,8 +3,8 @@ date.timezone setting [2] --FILE-- <?php date_default_timezone_set('Europe/Oslo'); - putenv('TZ='); // clean TZ so that it doesn't bypass the ini option - echo strtotime("2005-06-18 22:15:44"); + putenv('TZ='); // clean TZ so that it doesn't bypass the ini option + echo strtotime("2005-06-18 22:15:44"); ?> --EXPECT-- 1119125744 diff --git a/ext/date/tests/examine_diff.inc b/ext/date/tests/examine_diff.inc index c3dcba9388..8c305f1d36 100644 --- a/ext/date/tests/examine_diff.inc +++ b/ext/date/tests/examine_diff.inc @@ -33,47 +33,47 @@ define('PHPT_DATETIME_SHOW_SUB', 4); * @return void */ function examine_diff($end_date, $start_date, $expect_spec, $expect_days, $absolute = false) { - if (is_string($start_date)) { - $start = new DateTime($start_date); - } else { - $start = $start_date; - } - $start_date = $start->format('Y-m-d H:i:s T'); + if (is_string($start_date)) { + $start = new DateTime($start_date); + } else { + $start = $start_date; + } + $start_date = $start->format('Y-m-d H:i:s T'); - if (is_string($end_date)) { - $end = new DateTime($end_date); - } else { - $end = $end_date; - } - $end_date = $end->format('Y-m-d H:i:s T'); + if (is_string($end_date)) { + $end = new DateTime($end_date); + } else { + $end = $end_date; + } + $end_date = $end->format('Y-m-d H:i:s T'); - $expect_interval = new DateInterval('P' . substr($expect_spec, 2)); - if (substr($expect_spec, 1, 1) == '-') { - $expect_interval->invert = true; - } + $expect_interval = new DateInterval('P' . substr($expect_spec, 2)); + if (substr($expect_spec, 1, 1) == '-') { + $expect_interval->invert = true; + } - if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DIFF) { - $result_interval = $start->diff($end, $absolute); - $result_spec = $result_interval->format('P%R%yY%mM%dDT%hH%iM%sS'); - echo "DIFF: $end_date - $start_date = **$result_spec**\n"; - // echo "DIFF: $end_date - $start_date = **$expect_spec**\n"; - } - if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DAYS) { - $result_interval = $start->diff($end, $absolute); - $result_days = $result_interval->format('%a'); - echo "DAYS: **$result_days**\n"; - // echo "DAYS: **$expect_days**\n"; - } - if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_ADD) { - $start->add($expect_interval); - $result_end_date = $start->format('Y-m-d H:i:s T'); - echo "ADD: $start_date + $expect_spec = **$result_end_date**\n"; - // echo "ADD: $start_date + $expect_spec = **$end_date**\n"; - } - if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_SUB) { - $end->sub($expect_interval); - $result_start_date = $end->format('Y-m-d H:i:s T'); - echo "SUB: $end_date - $expect_spec = **$result_start_date**\n"; - // echo "SUB: $end_date - $expect_spec = **$start_date**\n"; - } + if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DIFF) { + $result_interval = $start->diff($end, $absolute); + $result_spec = $result_interval->format('P%R%yY%mM%dDT%hH%iM%sS'); + echo "DIFF: $end_date - $start_date = **$result_spec**\n"; + // echo "DIFF: $end_date - $start_date = **$expect_spec**\n"; + } + if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DAYS) { + $result_interval = $start->diff($end, $absolute); + $result_days = $result_interval->format('%a'); + echo "DAYS: **$result_days**\n"; + // echo "DAYS: **$expect_days**\n"; + } + if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_ADD) { + $start->add($expect_interval); + $result_end_date = $start->format('Y-m-d H:i:s T'); + echo "ADD: $start_date + $expect_spec = **$result_end_date**\n"; + // echo "ADD: $start_date + $expect_spec = **$end_date**\n"; + } + if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_SUB) { + $end->sub($expect_interval); + $result_start_date = $end->format('Y-m-d H:i:s T'); + echo "SUB: $end_date - $expect_spec = **$result_start_date**\n"; + // echo "SUB: $end_date - $expect_spec = **$start_date**\n"; + } } diff --git a/ext/date/tests/format-negative-timestamp.phpt b/ext/date/tests/format-negative-timestamp.phpt index 5fd6a65897..d8268ddc68 100644 --- a/ext/date/tests/format-negative-timestamp.phpt +++ b/ext/date/tests/format-negative-timestamp.phpt @@ -9,13 +9,13 @@ $max = getrandmax(); $max_2 = $max / 2; while($i--) { - $new_tm = rand(1, $max); - if ($new_tm > $max_2) - $new_tm *= -1; + $new_tm = rand(1, $max); + if ($new_tm > $max_2) + $new_tm *= -1; - if (strtotime("@$new_tm") != $new_tm) { - echo "Error when parsing: @$new_tm\n"; - } + if (strtotime("@$new_tm") != $new_tm) { + echo "Error when parsing: @$new_tm\n"; + } } echo "done!"; diff --git a/ext/date/tests/getdate_variation2.phpt b/ext/date/tests/getdate_variation2.phpt index 0d4cb114cd..2081e31762 100644 --- a/ext/date/tests/getdate_variation2.phpt +++ b/ext/date/tests/getdate_variation2.phpt @@ -16,10 +16,10 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - //octal values - 'octal 05' => 05, - 'octal 010' => 010, - 'octal -010' => -010, + //octal values + 'octal 05' => 05, + 'octal 010' => 010, + 'octal -010' => -010, ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/getdate_variation3.phpt b/ext/date/tests/getdate_variation3.phpt index 1c4891ee6b..ebcc3bf23f 100644 --- a/ext/date/tests/getdate_variation3.phpt +++ b/ext/date/tests/getdate_variation3.phpt @@ -16,10 +16,10 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - //octal values - 'hexadcimal 0x5' => 0x5, - 'hexadcimal 0xCAFE' => 0xCAFE, - 'octal -0xCAFE' => -0xCAFE, + //octal values + 'hexadcimal 0x5' => 0x5, + 'hexadcimal 0xCAFE' => 0xCAFE, + 'octal -0xCAFE' => -0xCAFE, ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/getdate_variation4.phpt b/ext/date/tests/getdate_variation4.phpt index b2b0019204..48bcc1fd8d 100644 --- a/ext/date/tests/getdate_variation4.phpt +++ b/ext/date/tests/getdate_variation4.phpt @@ -16,11 +16,11 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - //Year wise time stamps - '01 Jan 1970' => 0, - '01 Jan 1971' => 31536000, - '01 Jan 1972' => 63072000, - '01 Jan 1973' => 94694400, + //Year wise time stamps + '01 Jan 1970' => 0, + '01 Jan 1971' => 31536000, + '01 Jan 1972' => 63072000, + '01 Jan 1973' => 94694400, ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/getdate_variation5.phpt b/ext/date/tests/getdate_variation5.phpt index 2bd00ac3a7..8c61c5bb61 100644 --- a/ext/date/tests/getdate_variation5.phpt +++ b/ext/date/tests/getdate_variation5.phpt @@ -12,20 +12,20 @@ echo "*** Testing getdate() : usage variation ***\n"; //Timezones with required data for date_sunrise $inputs = array ( - //GMT-11 - "Pacific/Samoa", - //GMT-9 - "US/Alaska", - //GMT-0 - "Africa/Casablanca", - //GMT+4 - "Europe/Moscow", - //GMT+8 - "Asia/Hong_Kong", - //GMT+10 - "Australia/Brisbane", - //GMT+12 - "Pacific/Wallis", + //GMT-11 + "Pacific/Samoa", + //GMT-9 + "US/Alaska", + //GMT-0 + "Africa/Casablanca", + //GMT+4 + "Europe/Moscow", + //GMT+8 + "Asia/Hong_Kong", + //GMT+10 + "Australia/Brisbane", + //GMT+12 + "Pacific/Wallis", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/getdate_variation6.phpt b/ext/date/tests/getdate_variation6.phpt index cb7ca9a9a3..e5a98ac1a6 100644 --- a/ext/date/tests/getdate_variation6.phpt +++ b/ext/date/tests/getdate_variation6.phpt @@ -14,9 +14,9 @@ date_default_timezone_set("Asia/Calcutta"); //Timezones with required data for date_sunrise $inputs = array ( - 'String 0' => '0', - 'String 10.5' => "10.5", - 'String -10.5' => '-10.5', + 'String 0' => '0', + 'String 10.5' => "10.5", + 'String -10.5' => '-10.5', ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmdate_variation13.phpt b/ext/date/tests/gmdate_variation13.phpt index 17b4f43b05..877671b926 100644 --- a/ext/date/tests/gmdate_variation13.phpt +++ b/ext/date/tests/gmdate_variation13.phpt @@ -17,22 +17,22 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); $inputs = array( // Predefined Date constants 'DATE_ATOM Constant' => DATE_ATOM, - 'DATE_COOKIE Constant' => DATE_COOKIE, - 'DATE_RFC822 Constant' => DATE_RFC822, - 'DATE_RFC850 Constant' => DATE_RFC850, - 'DATE_RFC1036 Constant' => DATE_RFC1036, - 'DATE_RFC1123 Constant' => DATE_RFC1123, - 'DATE_RFC2822 Constant' => DATE_RFC2822, - 'DATE_RFC3339 Constant' => DATE_RFC3339, - 'DATE_RSS Constant' => DATE_RSS, - 'DATE_W3C Constant' => DATE_W3C, + 'DATE_COOKIE Constant' => DATE_COOKIE, + 'DATE_RFC822 Constant' => DATE_RFC822, + 'DATE_RFC850 Constant' => DATE_RFC850, + 'DATE_RFC1036 Constant' => DATE_RFC1036, + 'DATE_RFC1123 Constant' => DATE_RFC1123, + 'DATE_RFC2822 Constant' => DATE_RFC2822, + 'DATE_RFC3339 Constant' => DATE_RFC3339, + 'DATE_RSS Constant' => DATE_RSS, + 'DATE_W3C Constant' => DATE_W3C, ); // loop through each element of the array for format foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( gmdate($value, $timestamp) ); - var_dump( gmdate($value) ); + var_dump( gmdate($value, $timestamp) ); + var_dump( gmdate($value) ); }; ?> diff --git a/ext/date/tests/gmdate_variation3.phpt b/ext/date/tests/gmdate_variation3.phpt index bc3ce652be..c9ee765476 100644 --- a/ext/date/tests/gmdate_variation3.phpt +++ b/ext/date/tests/gmdate_variation3.phpt @@ -17,11 +17,11 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Day with leading zeros' => 'd', - 'Day without leading zeros' => 'j', - 'ISO representation' => 'N', - 'Numeric representation of day' => 'w', - 'Day of the year' => 'z' + 'Day with leading zeros' => 'd', + 'Day without leading zeros' => 'j', + 'ISO representation' => 'N', + 'Numeric representation of day' => 'w', + 'Day of the year' => 'z' ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmdate_variation9.phpt b/ext/date/tests/gmdate_variation9.phpt index 17eb1df806..cd43217d08 100644 --- a/ext/date/tests/gmdate_variation9.phpt +++ b/ext/date/tests/gmdate_variation9.phpt @@ -17,21 +17,21 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); $time_formats = array( 'Lowercase Ante meridiem and post meridiem' => 'a', - 'Uppercase Ante meridiem and post meridiem' => 'a', - 'Swatch Internet time' => 'B', - '12-hour format without leading zeros' => 'g', - '24-hour format without leading zeros' => 'G', - '12-hour format with leading zeros' => 'h', - '24-hour format with leading zeros' => 'H', - 'Minutes with leading zeros' => 'i', - 'Seconds with leading zeros' => 's', - 'Milliseconds' => 'u', + 'Uppercase Ante meridiem and post meridiem' => 'a', + 'Swatch Internet time' => 'B', + '12-hour format without leading zeros' => 'g', + '24-hour format without leading zeros' => 'G', + '12-hour format with leading zeros' => 'h', + '24-hour format with leading zeros' => 'H', + 'Minutes with leading zeros' => 'i', + 'Seconds with leading zeros' => 's', + 'Milliseconds' => 'u', ); foreach($time_formats as $key =>$value) { echo "\n--$key--\n"; - var_dump( gmdate($value) ); - var_dump( gmdate($value, $timestamp) ); + var_dump( gmdate($value) ); + var_dump( gmdate($value, $timestamp) ); } ?> diff --git a/ext/date/tests/gmmktime_variation9.phpt b/ext/date/tests/gmmktime_variation9.phpt index 549b9d88fa..40c4d3a39d 100644 --- a/ext/date/tests/gmmktime_variation9.phpt +++ b/ext/date/tests/gmmktime_variation9.phpt @@ -20,7 +20,7 @@ $year = 2008; $inputs = array( - 'float 123456' => 123456, + 'float 123456' => 123456, 'float -123456' => -123456, 'float -10.5' => -10.5, ); @@ -28,11 +28,11 @@ $inputs = array( // loop through each element of the array for min foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( gmmktime($value, $min, $sec, $mon, $day, $year) ); - var_dump( gmmktime($hour, $value, $sec, $mon, $day, $year) ); - var_dump( gmmktime($hour, $min, $value, $mon, $day, $year) ); - var_dump( gmmktime($hour, $min, $sec, $value, $day, $year) ); - var_dump( gmmktime($hour, $min, $sec, $mon, $value, $value) ); + var_dump( gmmktime($value, $min, $sec, $mon, $day, $year) ); + var_dump( gmmktime($hour, $value, $sec, $mon, $day, $year) ); + var_dump( gmmktime($hour, $min, $value, $mon, $day, $year) ); + var_dump( gmmktime($hour, $min, $sec, $value, $day, $year) ); + var_dump( gmmktime($hour, $min, $sec, $mon, $value, $value) ); } ?> --EXPECTREGEX-- diff --git a/ext/date/tests/gmstrftime_variation10.phpt b/ext/date/tests/gmstrftime_variation10.phpt index 842490ab4f..b20a3ecbe7 100644 --- a/ext/date/tests/gmstrftime_variation10.phpt +++ b/ext/date/tests/gmstrftime_variation10.phpt @@ -23,8 +23,8 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'The ISO 8601:1988 week number' => "%V", - 'Weekday as decimal' => "%u", + 'The ISO 8601:1988 week number' => "%V", + 'Weekday as decimal' => "%u", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation13.phpt b/ext/date/tests/gmstrftime_variation13.phpt index ef2026d562..a237e9dc8b 100644 --- a/ext/date/tests/gmstrftime_variation13.phpt +++ b/ext/date/tests/gmstrftime_variation13.phpt @@ -17,10 +17,10 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Century number' => "%C", - 'Month Date Year' => "%D", - 'Year with century' => "%G", - 'Year without century' => "%g", + 'Century number' => "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation14.phpt b/ext/date/tests/gmstrftime_variation14.phpt index eb774af09b..c53f5ea2f0 100644 --- a/ext/date/tests/gmstrftime_variation14.phpt +++ b/ext/date/tests/gmstrftime_variation14.phpt @@ -23,10 +23,10 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Century number' => "%C", - 'Month Date Year' => "%D", - 'Year with century' => "%G", - 'Year without century' => "%g", + 'Century number' => "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation15.phpt b/ext/date/tests/gmstrftime_variation15.phpt index cc956a9ba1..02907f846c 100644 --- a/ext/date/tests/gmstrftime_variation15.phpt +++ b/ext/date/tests/gmstrftime_variation15.phpt @@ -17,9 +17,9 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Time in a.m/p.m notation' => "%r", - 'Time in 24 hour notation' => "%R", - 'Current time %H:%M:%S format' => "%T", + 'Time in a.m/p.m notation' => "%r", + 'Time in 24 hour notation' => "%R", + 'Current time %H:%M:%S format' => "%T", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation16.phpt b/ext/date/tests/gmstrftime_variation16.phpt index 2f20185793..74be81747a 100644 --- a/ext/date/tests/gmstrftime_variation16.phpt +++ b/ext/date/tests/gmstrftime_variation16.phpt @@ -23,9 +23,9 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Time in a.m/p.m notation' => "%r", - 'Time in 24 hour notation' => "%R", - 'Current time %H:%M:%S format' => "%T", + 'Time in a.m/p.m notation' => "%r", + 'Time in 24 hour notation' => "%R", + 'Current time %H:%M:%S format' => "%T", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation19.phpt b/ext/date/tests/gmstrftime_variation19.phpt index 9c84901acf..8dc6923923 100644 --- a/ext/date/tests/gmstrftime_variation19.phpt +++ b/ext/date/tests/gmstrftime_variation19.phpt @@ -17,8 +17,8 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Newline character' => "%n", - 'Tab character' => "%t" + 'Newline character' => "%n", + 'Tab character' => "%t" ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation20.phpt b/ext/date/tests/gmstrftime_variation20.phpt index 12be1e8b1f..2c6ab02364 100644 --- a/ext/date/tests/gmstrftime_variation20.phpt +++ b/ext/date/tests/gmstrftime_variation20.phpt @@ -23,8 +23,8 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Newline character' => "%n", - 'Tab character' => "%t" + 'Newline character' => "%n", + 'Tab character' => "%t" ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation21.phpt b/ext/date/tests/gmstrftime_variation21.phpt index 840e467ea7..9ffbf82b24 100644 --- a/ext/date/tests/gmstrftime_variation21.phpt +++ b/ext/date/tests/gmstrftime_variation21.phpt @@ -18,8 +18,8 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( 'Preferred date and time representation' => "%c", - 'Preferred date representation' => "%x", - 'Preferred time representation' => "%X", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation22.phpt b/ext/date/tests/gmstrftime_variation22.phpt index 207a77db98..e907254227 100644 --- a/ext/date/tests/gmstrftime_variation22.phpt +++ b/ext/date/tests/gmstrftime_variation22.phpt @@ -28,8 +28,8 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( 'Preferred date and time representation' => "%c", - 'Preferred date representation' => "%x", - 'Preferred time representation' => "%X", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation3.phpt b/ext/date/tests/gmstrftime_variation3.phpt index fc4120c8ec..b33e543e12 100644 --- a/ext/date/tests/gmstrftime_variation3.phpt +++ b/ext/date/tests/gmstrftime_variation3.phpt @@ -17,8 +17,8 @@ $timestamp = gmmktime(8, 8, 8, 8, 8, 2008); $inputs = array( 'Abbreviated weekday name' => "%a", 'Full weekday name' => "%A", - 'Week number of the year' => "%U", - 'Week number of the year in decimal number' => "%W", + 'Week number of the year' => "%U", + 'Week number of the year in decimal number' => "%W", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation4.phpt b/ext/date/tests/gmstrftime_variation4.phpt index daf35af5ab..97ffb8f75f 100644 --- a/ext/date/tests/gmstrftime_variation4.phpt +++ b/ext/date/tests/gmstrftime_variation4.phpt @@ -17,7 +17,7 @@ $timestamp = gmmktime(8, 8, 8, 8, 8, 2008); $inputs = array( 'Abbreviated month name' => "%b", 'Full month name' => "%B", - 'Month as decimal' => "%m", + 'Month as decimal' => "%m", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation5.phpt b/ext/date/tests/gmstrftime_variation5.phpt index 7a8f58713f..ca4c9e5e64 100644 --- a/ext/date/tests/gmstrftime_variation5.phpt +++ b/ext/date/tests/gmstrftime_variation5.phpt @@ -18,10 +18,10 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Year as decimal number without a century' => "%y", - 'Year as decimal number including the century' => "%Y", - 'Time zone offset' => "%Z", - 'Time zone offset' => "%z", + 'Year as decimal number without a century' => "%y", + 'Year as decimal number including the century' => "%Y", + 'Time zone offset' => "%Z", + 'Time zone offset' => "%z", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation6.phpt b/ext/date/tests/gmstrftime_variation6.phpt index 055cf2362c..a00d27af5c 100644 --- a/ext/date/tests/gmstrftime_variation6.phpt +++ b/ext/date/tests/gmstrftime_variation6.phpt @@ -17,11 +17,11 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Hour as decimal by 24-hour format' => "%H", - 'Hour as decimal by 12-hour format' => "%I", - 'Minute as decimal number' => "%M", - 'AM/PM format for a time' => "%p", - 'Second as decimal number' => "%S", + 'Hour as decimal by 24-hour format' => "%H", + 'Hour as decimal by 12-hour format' => "%I", + 'Minute as decimal number' => "%M", + 'AM/PM format for a time' => "%p", + 'Second as decimal number' => "%S", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation7.phpt b/ext/date/tests/gmstrftime_variation7.phpt index 5a1a70024a..4f2c5876f2 100644 --- a/ext/date/tests/gmstrftime_variation7.phpt +++ b/ext/date/tests/gmstrftime_variation7.phpt @@ -17,9 +17,9 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Day of the month as a decimal number' => "%d", - 'Day of the year as a decimal number' => "%j", - 'Day of the week as a decimal number' => "%w" + 'Day of the month as a decimal number' => "%d", + 'Day of the year as a decimal number' => "%j", + 'Day of the week as a decimal number' => "%w" ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation8.phpt b/ext/date/tests/gmstrftime_variation8.phpt index c782183527..26ba201039 100644 --- a/ext/date/tests/gmstrftime_variation8.phpt +++ b/ext/date/tests/gmstrftime_variation8.phpt @@ -17,7 +17,7 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'A literal % character' => "%%", + 'A literal % character' => "%%", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/gmstrftime_variation9.phpt b/ext/date/tests/gmstrftime_variation9.phpt index dbc3f47f94..a6910675dc 100644 --- a/ext/date/tests/gmstrftime_variation9.phpt +++ b/ext/date/tests/gmstrftime_variation9.phpt @@ -17,8 +17,8 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'The ISO 8601:1988 week number' => "%V", - 'Weekday as decimal' => "%u", + 'The ISO 8601:1988 week number' => "%V", + 'Weekday as decimal' => "%u", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/idate_variation4.phpt b/ext/date/tests/idate_variation4.phpt index 4f95e7bd8b..8d928c9d56 100644 --- a/ext/date/tests/idate_variation4.phpt +++ b/ext/date/tests/idate_variation4.phpt @@ -16,15 +16,15 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Day of the month' => 'd', - 'Leap Year' =>'L', - 'Month number' => 'm', - 'Days in the month' => 't', - 'Day of the week' => 'w', - 'ISO-8601 week number' => 'W', - 'Year (1 or 2 digits)' => 'y', - 'Year 4 digits' => 'Y', - 'Day of the year' => 'z', + 'Day of the month' => 'd', + 'Leap Year' =>'L', + 'Month number' => 'm', + 'Days in the month' => 't', + 'Day of the week' => 'w', + 'ISO-8601 week number' => 'W', + 'Year (1 or 2 digits)' => 'y', + 'Year 4 digits' => 'Y', + 'Day of the year' => 'z', ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/idate_variation5.phpt b/ext/date/tests/idate_variation5.phpt index b72f7274d7..246e5f38a0 100644 --- a/ext/date/tests/idate_variation5.phpt +++ b/ext/date/tests/idate_variation5.phpt @@ -17,13 +17,13 @@ date_default_timezone_set("Asia/Calcutta"); $inputs = array( 'Internet Time' => 'B', - '12 hour format' => 'h', - '24 hour format' => 'H', - 'Minutes' => 'i', - 'DST Activated' => 'I', - 'Seconds' => 's', - 'Seconds since Unix Epoch' => 'U', - 'Time zone offset' => 'Z' + '12 hour format' => 'h', + '24 hour format' => 'H', + 'Minutes' => 'i', + 'DST Activated' => 'I', + 'Seconds' => 's', + 'Seconds since Unix Epoch' => 'U', + 'Time zone offset' => 'Z' ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/localtime_variation4.phpt b/ext/date/tests/localtime_variation4.phpt index d5062ee6a1..0898547302 100644 --- a/ext/date/tests/localtime_variation4.phpt +++ b/ext/date/tests/localtime_variation4.phpt @@ -19,14 +19,14 @@ $is_associative = true; $inputs = array( 'Octal 0' => 00, - 'Octal 10' => 012, - 'Octal -10' => -012 + 'Octal 10' => 012, + 'Octal -10' => -012 ); foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( localtime($value) ); - var_dump( localtime($value, $is_associative) ); + var_dump( localtime($value) ); + var_dump( localtime($value, $is_associative) ); } ?> diff --git a/ext/date/tests/localtime_variation5.phpt b/ext/date/tests/localtime_variation5.phpt index 3e974e2d88..b7d9e1ae63 100644 --- a/ext/date/tests/localtime_variation5.phpt +++ b/ext/date/tests/localtime_variation5.phpt @@ -19,14 +19,14 @@ $is_associative = true; $inputs = array( 'Hexa-decimal 0' => 0x0, - 'Hexa-decimal 10' => 0xA, - 'Hexa-decimal -10' => -0XA + 'Hexa-decimal 10' => 0xA, + 'Hexa-decimal -10' => -0XA ); foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( localtime($value) ); - var_dump( localtime($value, $is_associative) ); + var_dump( localtime($value) ); + var_dump( localtime($value, $is_associative) ); } ?> diff --git a/ext/date/tests/microtime_error.phpt b/ext/date/tests/microtime_error.phpt index 151bead6de..0736d3cf24 100644 --- a/ext/date/tests/microtime_error.phpt +++ b/ext/date/tests/microtime_error.phpt @@ -10,19 +10,19 @@ Test wrong number of arguments for microtime() echo "\n-- Bad Arg types --\n"; $bad_args = array(null, - 1.5, - "hello", - array('k'=>'v', array(0)), - new stdClass, - 1); + 1.5, + "hello", + array('k'=>'v', array(0)), + new stdClass, + 1); foreach ($bad_args as $bad_arg) { - echo "\n--> bad arg: "; - var_dump($bad_arg); - try { - var_dump(microtime($bad_arg)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } + echo "\n--> bad arg: "; + var_dump($bad_arg); + try { + var_dump(microtime($bad_arg)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } ?> diff --git a/ext/date/tests/mktime-3-64bit.phpt b/ext/date/tests/mktime-3-64bit.phpt index f415cbf2d6..5d06f9393f 100644 --- a/ext/date/tests/mktime-3-64bit.phpt +++ b/ext/date/tests/mktime-3-64bit.phpt @@ -10,18 +10,18 @@ $tzs = array("America/Toronto", "Europe/Oslo"); $years = array(0, 69, 70, 71, 99, 100, 101, 105, 110, 1900, 1901, 1902, 1999, 2000, 2001); foreach ($tzs as $tz) { - echo $tz, "\n"; - date_default_timezone_set($tz); - foreach ($years as $year) { - printf("Y: %4d - ", $year); - $ret = mktime(1, 1, 1, 1, 1, $year); - if ($ret == FALSE) { - echo "out of range\n"; - } else { - echo date("F ".DATE_ISO8601, $ret), "\n"; - } - } - echo "\n"; + echo $tz, "\n"; + date_default_timezone_set($tz); + foreach ($years as $year) { + printf("Y: %4d - ", $year); + $ret = mktime(1, 1, 1, 1, 1, $year); + if ($ret == FALSE) { + echo "out of range\n"; + } else { + echo date("F ".DATE_ISO8601, $ret), "\n"; + } + } + echo "\n"; } ?> --EXPECTF-- diff --git a/ext/date/tests/mktime-3.phpt b/ext/date/tests/mktime-3.phpt index de60a6eba0..b054efd076 100644 --- a/ext/date/tests/mktime-3.phpt +++ b/ext/date/tests/mktime-3.phpt @@ -10,18 +10,18 @@ $tzs = array("America/Toronto", "Europe/Oslo"); $years = array(0, 69, 70, 71, 99, 100, 105, 1900, 1901, 1902, 1999, 2000, 2001); foreach ($tzs as $tz) { - echo $tz, "\n"; - date_default_timezone_set($tz); - foreach ($years as $year) { - printf("Y: %4d - ", $year); - $ret = mktime(1, 1, 1, 1, 1, $year); - if ($ret == FALSE) { - echo "out of range\n"; - } else { - echo date("F ".DATE_ISO8601, $ret), "\n"; - } - } - echo "\n"; + echo $tz, "\n"; + date_default_timezone_set($tz); + foreach ($years as $year) { + printf("Y: %4d - ", $year); + $ret = mktime(1, 1, 1, 1, 1, $year); + if ($ret == FALSE) { + echo "out of range\n"; + } else { + echo date("F ".DATE_ISO8601, $ret), "\n"; + } + } + echo "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/oo_001.phpt b/ext/date/tests/oo_001.phpt index 111364ec83..1d8af7f933 100644 --- a/ext/date/tests/oo_001.phpt +++ b/ext/date/tests/oo_001.phpt @@ -4,12 +4,12 @@ date OO interface <?php date_default_timezone_set('UTC'); class _d extends DateTime { - function __construct() { - } + function __construct() { + } } class _t extends DateTimeZone { - function __construct() { - } + function __construct() { + } } $d = new DateTime; @@ -19,13 +19,13 @@ try { $d = new _d; var_dump($d->format("Y-m-d H:i:s")); } catch (Error $e) { - echo $e->getMessage(),"\n"; + echo $e->getMessage(),"\n"; } try { - new DateTime("1am todax"); + new DateTime("1am todax"); } catch (Exception $e) { - echo $e->getMessage(),"\n"; + echo $e->getMessage(),"\n"; } $t = new DateTimeZone("UTC"); @@ -35,13 +35,13 @@ try { $t = new _t; var_dump($t->getName()); } catch (Error $e) { - echo $e->getMessage(),"\n"; + echo $e->getMessage(),"\n"; } try { - new DateTimeZone("GottaFindThisOne"); + new DateTimeZone("GottaFindThisOne"); } catch (Exception $e) { - echo $e->getMessage(),"\n"; + echo $e->getMessage(),"\n"; } echo "DONE\n"; diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt index c297608913..4c92f4618d 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt @@ -16,37 +16,37 @@ $interval_format = 'P%dDT%hH'; $end = new DateTime('2010-03-14 03:00:00 -0400'); $start = new DateTime('2010-03-14 01:59:59 -0500'); echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; $end = new DateTime('2010-03-14 04:30:00 -0400'); $start = new DateTime('2010-03-13 04:30:00 -0500'); echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 -0400'); $start = new DateTime('2010-03-13 04:30:00 -0500'); echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 -0500'); $start = new DateTime('2010-03-13 04:30:00 -0500'); echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 -0500'); $start = new DateTime('2010-03-13 01:30:00 -0500'); echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 -0400'); $start = new DateTime('2010-03-13 03:30:00 -0500'); echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 -0400'); $start = new DateTime('2010-03-13 02:30:00 -0500'); echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; echo "\n"; @@ -58,37 +58,37 @@ $start = new DateTime('2010-03-14 01:59:59 -0500'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00 -0500'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00 -0500'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 01:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 02:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; echo "\n"; @@ -100,43 +100,43 @@ $end = new DateTime('2010-03-14 03:00:00 -0400'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 04:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 -0400'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 -0500'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-15 03:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-15 02:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; echo "\n"; @@ -147,42 +147,42 @@ echo "\n"; $end = new DateTime('2010-11-07 01:00:00 -0500'); $start = new DateTime('2010-11-07 01:59:59 -0400'); echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; $end = new DateTime('2010-11-07 04:30:00 -0500'); $start = new DateTime('2010-11-06 04:30:00 -0400'); echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00 -0500'); $start = new DateTime('2010-11-06 04:30:00 -0400'); echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00 -0500'); $start = new DateTime('2010-11-06 04:30:00 -0400'); echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0500'); $start = new DateTime('2010-11-06 04:30:00 -0400'); echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0400'); $start = new DateTime('2010-11-06 04:30:00 -0400'); echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0400'); $start = new DateTime('2010-11-06 01:30:00 -0400'); echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0500'); $start = new DateTime('2010-11-06 01:30:00 -0400'); echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; echo "\n"; @@ -194,67 +194,67 @@ $start = new DateTime('2010-11-07 01:59:59 -0400'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 -0400'); $interval_spec = 'PT24H'; $interval = new DateInterval($interval_spec); echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 -0400'); $interval_spec = 'PT23H'; $interval = new DateInterval($interval_spec); echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 -0400'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 -0400'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 01:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 01:30:00 -0400'); $interval_spec = 'P1DT1H'; $interval = new DateInterval($interval_spec); echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 -0400'); $interval_spec = 'PT25H'; $interval = new DateInterval($interval_spec); echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 03:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 02:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; echo "\n"; @@ -266,61 +266,61 @@ $end = new DateTime('2010-11-07 01:00:00 -0500'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 04:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00 -0500'); $interval_spec = 'PT24H'; $interval = new DateInterval($interval_spec); echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00 -0500'); $interval_spec = 'PT23H'; $interval = new DateInterval($interval_spec); echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0500'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0400'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0500'); $interval_spec = 'P1DT1H'; $interval = new DateInterval($interval_spec); echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; ?> --EXPECT-- diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt index 72585125ea..d969f72a00 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt @@ -16,37 +16,37 @@ $interval_format = 'P%dDT%hH'; $end = new DateTime('2010-03-14 03:00:00 EDT'); $start = new DateTime('2010-03-14 01:59:59 EST'); echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; $end = new DateTime('2010-03-14 04:30:00 EDT'); $start = new DateTime('2010-03-13 04:30:00 EST'); echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 EDT'); $start = new DateTime('2010-03-13 04:30:00 EST'); echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 EST'); $start = new DateTime('2010-03-13 04:30:00 EST'); echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 EST'); $start = new DateTime('2010-03-13 01:30:00 EST'); echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 EDT'); $start = new DateTime('2010-03-13 03:30:00 EST'); echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 EDT'); $start = new DateTime('2010-03-13 02:30:00 EST'); echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; echo "\n"; @@ -58,37 +58,37 @@ $start = new DateTime('2010-03-14 01:59:59 EST'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00 EST'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00 EST'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 01:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 02:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; echo "\n"; @@ -100,43 +100,43 @@ $end = new DateTime('2010-03-14 03:00:00 EDT'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 04:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 EDT'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 EST'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-15 03:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-15 02:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; echo "\n"; @@ -147,42 +147,42 @@ echo "\n"; $end = new DateTime('2010-11-07 01:00:00 EST'); $start = new DateTime('2010-11-07 01:59:59 EDT'); echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; $end = new DateTime('2010-11-07 04:30:00 EST'); $start = new DateTime('2010-11-06 04:30:00 EDT'); echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00 EST'); $start = new DateTime('2010-11-06 04:30:00 EDT'); echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00 EST'); $start = new DateTime('2010-11-06 04:30:00 EDT'); echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $start = new DateTime('2010-11-06 04:30:00 EDT'); echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EDT'); $start = new DateTime('2010-11-06 04:30:00 EDT'); echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EDT'); $start = new DateTime('2010-11-06 01:30:00 EDT'); echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $start = new DateTime('2010-11-06 01:30:00 EDT'); echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; echo "\n"; @@ -194,67 +194,67 @@ $start = new DateTime('2010-11-07 01:59:59 EDT'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 EDT'); $interval_spec = 'PT24H'; $interval = new DateInterval($interval_spec); echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 EDT'); $interval_spec = 'PT23H'; $interval = new DateInterval($interval_spec); echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 EDT'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 EDT'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 01:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 01:30:00 EDT'); $interval_spec = 'P1DT1H'; $interval = new DateInterval($interval_spec); echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 EDT'); $interval_spec = 'PT25H'; $interval = new DateInterval($interval_spec); echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 03:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 02:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; echo "\n"; @@ -266,61 +266,61 @@ $end = new DateTime('2010-11-07 01:00:00 EST'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 04:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00 EST'); $interval_spec = 'PT24H'; $interval = new DateInterval($interval_spec); echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00 EST'); $interval_spec = 'PT23H'; $interval = new DateInterval($interval_spec); echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EDT'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $interval_spec = 'P1DT1H'; $interval = new DateInterval($interval_spec); echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; ?> --EXPECT-- diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt index fdbe96d7d0..0326b43824 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt @@ -17,67 +17,67 @@ $start = new DateTime('2010-11-07 01:59:59'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00'); $interval_spec = 'PT24H'; $interval = new DateInterval($interval_spec); echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00'); $interval_spec = 'PT23H'; $interval = new DateInterval($interval_spec); echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 01:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 01:30:00'); $interval_spec = 'P1DT1H'; $interval = new DateInterval($interval_spec); echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00'); $interval_spec = 'PT25H'; $interval = new DateInterval($interval_spec); echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 03:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 02:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; echo "\n"; diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt index 8249599931..8222e75f15 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt @@ -16,27 +16,27 @@ $interval_format = 'P%dDT%hH'; $end = new DateTime('2010-11-07 05:30:00'); $start = new DateTime('2010-11-06 04:30:00'); echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 04:30:00'); $start = new DateTime('2010-11-06 04:30:00'); echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00'); $start = new DateTime('2010-11-06 04:30:00'); echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00'); $start = new DateTime('2010-11-06 04:30:00'); echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00'); $start = new DateTime('2010-11-06 01:30:00'); echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; echo "\n"; ?> diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt index fe2e79b3b9..80e3321ed6 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt @@ -27,25 +27,25 @@ $end = new DateTime('2010-11-07 05:30:00'); $end->setTimeZone($tz); $start = new DateTime('2010-11-06 04:30:59'); echo 'bd0 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format('P%dDT%hH%iM%sS') . "\n"; + . ' = ' . $start->diff($end)->format('P%dDT%hH%iM%sS') . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $end->setTimeZone($tz); $start = new DateTime('2010-11-06 04:30:00'); echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EDT'); $end->setTimeZone($tz); $start = new DateTime('2010-11-06 04:30:00'); echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $end->setTimeZone($tz); $start = new DateTime('2010-11-06 01:30:00'); echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; echo "\n"; ?> diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt index 138c68f3a9..d195cb2f75 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt @@ -19,64 +19,64 @@ $end->setTimeZone($tz); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 04:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00'); $interval_spec = 'PT24H'; $interval = new DateInterval($interval_spec); echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00'); $interval_spec = 'PT23H'; $interval = new DateInterval($interval_spec); echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $end->setTimeZone($tz); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EDT'); $end->setTimeZone($tz); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $end->setTimeZone($tz); $interval_spec = 'P1DT1H'; $interval = new DateInterval($interval_spec); echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; ?> --EXPECT-- diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt index 9fa493f578..df67b5a89d 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt @@ -17,37 +17,37 @@ $start = new DateTime('2010-03-14 01:59:59'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 01:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 02:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; ?> --EXPECT-- fa1 2010-03-14 01:59:59 EST America/New_York + PT1S = 2010-03-14 03:00:00 EDT America/New_York diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt index ae7060be0b..1a60f7b57b 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt @@ -16,37 +16,37 @@ $interval_format = 'P%dDT%hH'; $end = new DateTime('2010-03-14 03:00:00'); $start = new DateTime('2010-03-14 01:59:59'); echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; $end = new DateTime('2010-03-14 04:30:00'); $start = new DateTime('2010-03-13 04:30:00'); echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00'); $start = new DateTime('2010-03-13 04:30:00'); echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00'); $start = new DateTime('2010-03-13 04:30:00'); echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00'); $start = new DateTime('2010-03-13 01:30:00'); echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00'); $start = new DateTime('2010-03-13 03:30:00'); echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00'); $start = new DateTime('2010-03-13 02:30:00'); echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; ?> --EXPECT-- fd1 2010-03-14 03:00:00 EDT America/New_York - 2010-03-14 01:59:59 EST America/New_York = PT0H0M1S diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt index 72351d37e1..aa1c268704 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt @@ -19,43 +19,43 @@ $end = new DateTime('2010-03-14 03:00:00'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 04:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-15 03:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-15 02:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; ?> --EXPECT-- fs1 2010-03-14 03:00:00 EDT America/New_York - PT1S = 2010-03-14 01:59:59 EST America/New_York diff --git a/ext/date/tests/strftime_variation10.phpt b/ext/date/tests/strftime_variation10.phpt index 79f99370da..108dcffc54 100644 --- a/ext/date/tests/strftime_variation10.phpt +++ b/ext/date/tests/strftime_variation10.phpt @@ -23,16 +23,16 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'The ISO 8601:1988 week number' => "%V", - 'Weekday as decimal' => "%u", + 'The ISO 8601:1988 week number' => "%V", + 'Weekday as decimal' => "%u", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> diff --git a/ext/date/tests/strftime_variation13.phpt b/ext/date/tests/strftime_variation13.phpt index 59aef31c29..0ebfa5502d 100644 --- a/ext/date/tests/strftime_variation13.phpt +++ b/ext/date/tests/strftime_variation13.phpt @@ -17,18 +17,18 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Century number' => "%C", - 'Month Date Year' => "%D", - 'Year with century' => "%G", - 'Year without century' => "%g", + 'Century number' => "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> diff --git a/ext/date/tests/strftime_variation14.phpt b/ext/date/tests/strftime_variation14.phpt index eff0389174..b209d91adf 100644 --- a/ext/date/tests/strftime_variation14.phpt +++ b/ext/date/tests/strftime_variation14.phpt @@ -23,18 +23,18 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Century number' => "%C", - 'Month Date Year' => "%D", - 'Year with century' => "%G", - 'Year without century' => "%g", + 'Century number' => "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> diff --git a/ext/date/tests/strftime_variation15.phpt b/ext/date/tests/strftime_variation15.phpt index 301cafc018..38826b6528 100644 --- a/ext/date/tests/strftime_variation15.phpt +++ b/ext/date/tests/strftime_variation15.phpt @@ -17,17 +17,17 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Time in a.m/p.m notation' => "%r", - 'Time in 24 hour notation' => "%R", - 'Current time %H:%M:%S format' => "%T", + 'Time in a.m/p.m notation' => "%r", + 'Time in 24 hour notation' => "%R", + 'Current time %H:%M:%S format' => "%T", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> diff --git a/ext/date/tests/strftime_variation16.phpt b/ext/date/tests/strftime_variation16.phpt index 2d0b40a57e..5791c12838 100644 --- a/ext/date/tests/strftime_variation16.phpt +++ b/ext/date/tests/strftime_variation16.phpt @@ -23,17 +23,17 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Time in a.m/p.m notation' => "%r", - 'Time in 24 hour notation' => "%R", - 'Current time %H:%M:%S format' => "%T", + 'Time in a.m/p.m notation' => "%r", + 'Time in 24 hour notation' => "%R", + 'Current time %H:%M:%S format' => "%T", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> diff --git a/ext/date/tests/strftime_variation19.phpt b/ext/date/tests/strftime_variation19.phpt index 13575811d2..852b95fbe9 100644 --- a/ext/date/tests/strftime_variation19.phpt +++ b/ext/date/tests/strftime_variation19.phpt @@ -17,16 +17,16 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Newline character' => "%n", - 'Tab character' => "%t" + 'Newline character' => "%n", + 'Tab character' => "%t" ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> diff --git a/ext/date/tests/strftime_variation20.phpt b/ext/date/tests/strftime_variation20.phpt index d6bbab12ca..19875760d5 100644 --- a/ext/date/tests/strftime_variation20.phpt +++ b/ext/date/tests/strftime_variation20.phpt @@ -23,16 +23,16 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Newline character' => "%n", - 'Tab character' => "%t" + 'Newline character' => "%n", + 'Tab character' => "%t" ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> diff --git a/ext/date/tests/strftime_variation21.phpt b/ext/date/tests/strftime_variation21.phpt index 5e0cf423c5..164e5e304b 100644 --- a/ext/date/tests/strftime_variation21.phpt +++ b/ext/date/tests/strftime_variation21.phpt @@ -18,16 +18,16 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( 'Preferred date and time representation' => "%c", - 'Preferred date representation' => "%x", - 'Preferred time representation' => "%X", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> diff --git a/ext/date/tests/strftime_variation22.phpt b/ext/date/tests/strftime_variation22.phpt index 0148223802..900cde2fca 100644 --- a/ext/date/tests/strftime_variation22.phpt +++ b/ext/date/tests/strftime_variation22.phpt @@ -28,16 +28,16 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( 'Preferred date and time representation' => "%c", - 'Preferred date representation' => "%x", - 'Preferred time representation' => "%X", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( $value ); - var_dump( strftime($value, $timestamp) ); + var_dump( $value ); + var_dump( strftime($value, $timestamp) ); } ?> diff --git a/ext/date/tests/strftime_variation3.phpt b/ext/date/tests/strftime_variation3.phpt index a23402be96..90771973a9 100644 --- a/ext/date/tests/strftime_variation3.phpt +++ b/ext/date/tests/strftime_variation3.phpt @@ -18,8 +18,8 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); $inputs = array( 'Abbreviated weekday name' => "%a", 'Full weekday name' => "%A", - 'Week number of the year' => "%U", - 'Week number of the year in decimal number' => "%W", + 'Week number of the year' => "%U", + 'Week number of the year in decimal number' => "%W", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/strftime_variation4.phpt b/ext/date/tests/strftime_variation4.phpt index 2152ddda40..461da2669d 100644 --- a/ext/date/tests/strftime_variation4.phpt +++ b/ext/date/tests/strftime_variation4.phpt @@ -18,7 +18,7 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); $inputs = array( 'Abbreviated month name' => "%b", 'Full month name' => "%B", - 'Month as decimal' => "%m", + 'Month as decimal' => "%m", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/strftime_variation5.phpt b/ext/date/tests/strftime_variation5.phpt index 7af084b34c..31cc970564 100644 --- a/ext/date/tests/strftime_variation5.phpt +++ b/ext/date/tests/strftime_variation5.phpt @@ -17,10 +17,10 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Year as decimal number without a century' => "%y", - 'Year as decimal number including the century' => "%Y", - 'Time zone offset' => "%Z", - 'Time zone offset' => "%z", + 'Year as decimal number without a century' => "%y", + 'Year as decimal number including the century' => "%Y", + 'Time zone offset' => "%Z", + 'Time zone offset' => "%z", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/strftime_variation6.phpt b/ext/date/tests/strftime_variation6.phpt index eadf0d05de..1460f70b30 100644 --- a/ext/date/tests/strftime_variation6.phpt +++ b/ext/date/tests/strftime_variation6.phpt @@ -18,11 +18,11 @@ $timestamp = mktime(18, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Hour as decimal by 24-hour format' => "%H", - 'Hour as decimal by 12-hour format' => "%I", - 'Minute as decimal number' => "%M", - 'AM/PM format for a time' => "%p", - 'Second as decimal number' => "%S", + 'Hour as decimal by 24-hour format' => "%H", + 'Hour as decimal by 12-hour format' => "%I", + 'Minute as decimal number' => "%M", + 'AM/PM format for a time' => "%p", + 'Second as decimal number' => "%S", ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/strftime_variation7.phpt b/ext/date/tests/strftime_variation7.phpt index 63a3d10808..b8cc2de847 100644 --- a/ext/date/tests/strftime_variation7.phpt +++ b/ext/date/tests/strftime_variation7.phpt @@ -18,9 +18,9 @@ $timestamp = mktime(18, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Day of the month as a decimal number' => "%d", - 'Day of the year as a decimal number' => "%j", - 'Day of the week as a decimal number' => "%w" + 'Day of the month as a decimal number' => "%d", + 'Day of the year as a decimal number' => "%j", + 'Day of the week as a decimal number' => "%w" ); // loop through each element of the array for timestamp diff --git a/ext/date/tests/strftime_variation9.phpt b/ext/date/tests/strftime_variation9.phpt index 0d2502834c..82a060b66d 100644 --- a/ext/date/tests/strftime_variation9.phpt +++ b/ext/date/tests/strftime_variation9.phpt @@ -17,16 +17,16 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'The ISO 8601:1988 week number' => "%V", - 'Weekday as decimal' => "%u", + 'The ISO 8601:1988 week number' => "%V", + 'Weekday as decimal' => "%u", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> diff --git a/ext/date/tests/strtotime-mysql-64bit.phpt b/ext/date/tests/strtotime-mysql-64bit.phpt index 356e485949..ddf1dfff3f 100644 --- a/ext/date/tests/strtotime-mysql-64bit.phpt +++ b/ext/date/tests/strtotime-mysql-64bit.phpt @@ -12,13 +12,13 @@ $d[] = '20001231185859'; $d[] = '20800410101010'; // overflow.. foreach($d as $date) { - $time = strtotime($date); + $time = strtotime($date); - if (is_integer($time)) { - var_dump(date('r', $time)); - } else { - var_dump($time); - } + if (is_integer($time)) { + var_dump(date('r', $time)); + } else { + var_dump($time); + } } ?> --EXPECT-- diff --git a/ext/date/tests/strtotime-mysql.phpt b/ext/date/tests/strtotime-mysql.phpt index 5b0192880b..c9502e1d3e 100644 --- a/ext/date/tests/strtotime-mysql.phpt +++ b/ext/date/tests/strtotime-mysql.phpt @@ -12,13 +12,13 @@ $d[] = '20001231185859'; $d[] = '20800410101010'; // overflow.. foreach($d as $date) { - $time = strtotime($date); + $time = strtotime($date); - if (is_integer($time)) { - var_dump(date('r', $time)); - } else { - var_dump($time); - } + if (is_integer($time)) { + var_dump(date('r', $time)); + } else { + var_dump($time); + } } ?> --EXPECT-- diff --git a/ext/date/tests/strtotime-relative.phpt b/ext/date/tests/strtotime-relative.phpt index 293223bb2d..f5cd014a6d 100644 --- a/ext/date/tests/strtotime-relative.phpt +++ b/ext/date/tests/strtotime-relative.phpt @@ -8,44 +8,44 @@ date_default_timezone_set('UTC'); $base_time = 1204200000; // 28 Feb 2008 12:00:00 $offsets = array( - // offset around a day - '80412 seconds', - '86399 seconds', - '86400 seconds', - '86401 seconds', - '112913 seconds', + // offset around a day + '80412 seconds', + '86399 seconds', + '86400 seconds', + '86401 seconds', + '112913 seconds', - // offset around 7 days - '134 hours', - '167 hours', - '168 hours', - '169 hours', - '183 hours', + // offset around 7 days + '134 hours', + '167 hours', + '168 hours', + '169 hours', + '183 hours', - // offset around 6 months - '178 days', - '179 days', - '180 days', - '183 days', - '184 days', + // offset around 6 months + '178 days', + '179 days', + '180 days', + '183 days', + '184 days', - // offset around 10 years - '115 months', - '119 months', - '120 months', - '121 months', - '128 months', + // offset around 10 years + '115 months', + '119 months', + '120 months', + '121 months', + '128 months', - // offset around 25 years (can't do much more reliably with strtotime) - '24 years', - '25 years', - '26 years' + // offset around 25 years (can't do much more reliably with strtotime) + '24 years', + '25 years', + '26 years' ); foreach ($offsets AS $offset) { - foreach (array('+', '-') AS $direction) { - echo "$direction$offset: " . date(DATE_ISO8601, strtotime("$direction$offset", $base_time)) . "\n"; - } + foreach (array('+', '-') AS $direction) { + echo "$direction$offset: " . date(DATE_ISO8601, strtotime("$direction$offset", $base_time)) . "\n"; + } } ?> diff --git a/ext/date/tests/strtotime.phpt b/ext/date/tests/strtotime.phpt index aef7d68dcd..f55765fa80 100644 --- a/ext/date/tests/strtotime.phpt +++ b/ext/date/tests/strtotime.phpt @@ -10,7 +10,7 @@ $d[] = strtotime("@1121373041"); $d[] = strtotime("@1121373041 CEST"); foreach($d as $date) { - echo date(DATE_ISO8601, $date), "\n"; + echo date(DATE_ISO8601, $date), "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/strtotime2.phpt b/ext/date/tests/strtotime2.phpt index b8b605923d..c9b83838d1 100644 --- a/ext/date/tests/strtotime2.phpt +++ b/ext/date/tests/strtotime2.phpt @@ -7,23 +7,23 @@ date_default_timezone_set("Europe/Oslo"); $time = time(); $constants = array( - 'DATE_ATOM', - 'DATE_COOKIE', - 'DATE_ISO8601', - 'DATE_RFC822', - 'DATE_RFC850', - 'DATE_RFC1036', - 'DATE_RFC1123', - 'DATE_RFC2822', - 'DATE_RFC3339', - 'DATE_RSS', - 'DATE_W3C' + 'DATE_ATOM', + 'DATE_COOKIE', + 'DATE_ISO8601', + 'DATE_RFC822', + 'DATE_RFC850', + 'DATE_RFC1036', + 'DATE_RFC1123', + 'DATE_RFC2822', + 'DATE_RFC3339', + 'DATE_RSS', + 'DATE_W3C' ); foreach ($constants as $const) { - echo "$const:\t"; - echo ((strtotime(date(constant($const), $time)) === $time) ? "OK" : "FAIL") . "\n"; + echo "$const:\t"; + echo ((strtotime(date(constant($const), $time)) === $time) ? "OK" : "FAIL") . "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/strtotime3-64bit.phpt b/ext/date/tests/strtotime3-64bit.phpt index 52c4edd63b..c4f87c3b1a 100644 --- a/ext/date/tests/strtotime3-64bit.phpt +++ b/ext/date/tests/strtotime3-64bit.phpt @@ -8,39 +8,39 @@ date_default_timezone_set('Europe/Lisbon'); $time = 1150494719; // 16/June/2006 $strs = array( - '', - " \t\r\n000", - 'yesterday', - '22:49:12', - '22:49:12 bogusTZ', - '22.49.12.42GMT', - '22.49.12.42bogusTZ', - 't0222', - 't0222 t0222', - '022233', - '022233 bogusTZ', - '2-3-2004', - '2.3.2004', - '20060212T23:12:23UTC', - '20060212T23:12:23 bogusTZ', - '2006167', //pgydotd - 'Jan-15-2006', //pgtextshort - '2006-Jan-15', //pgtextreverse - '10/Oct/2000:13:55:36 +0100', //clf - '10/Oct/2000:13:55:36 +00100', //clf - '2006', - '1986', // year - 'JAN', - 'January', + '', + " \t\r\n000", + 'yesterday', + '22:49:12', + '22:49:12 bogusTZ', + '22.49.12.42GMT', + '22.49.12.42bogusTZ', + 't0222', + 't0222 t0222', + '022233', + '022233 bogusTZ', + '2-3-2004', + '2.3.2004', + '20060212T23:12:23UTC', + '20060212T23:12:23 bogusTZ', + '2006167', //pgydotd + 'Jan-15-2006', //pgtextshort + '2006-Jan-15', //pgtextreverse + '10/Oct/2000:13:55:36 +0100', //clf + '10/Oct/2000:13:55:36 +00100', //clf + '2006', + '1986', // year + 'JAN', + 'January', ); foreach ($strs as $str) { - $t = strtotime($str, $time); - if (is_integer($t)) { - var_dump(date(DATE_RFC2822, $t)); - } else { - var_dump($t); - } + $t = strtotime($str, $time); + if (is_integer($t)) { + var_dump(date(DATE_RFC2822, $t)); + } else { + var_dump($t); + } } ?> diff --git a/ext/date/tests/strtotime3.phpt b/ext/date/tests/strtotime3.phpt index 97161f9dfe..f01af27a43 100644 --- a/ext/date/tests/strtotime3.phpt +++ b/ext/date/tests/strtotime3.phpt @@ -8,39 +8,39 @@ date_default_timezone_set('Europe/Lisbon'); $time = 1150494719; // 16/June/2006 $strs = array( - '', - " \t\r\n000", - 'yesterday', - '22:49:12', - '22:49:12 bogusTZ', - '22.49.12.42GMT', - '22.49.12.42bogusTZ', - 't0222', - 't0222 t0222', - '022233', - '022233 bogusTZ', - '2-3-2004', - '2.3.2004', - '20060212T23:12:23UTC', - '20060212T23:12:23 bogusTZ', - '2006167', //pgydotd - 'Jan-15-2006', //pgtextshort - '2006-Jan-15', //pgtextreverse - '10/Oct/2000:13:55:36 +0100', //clf - '10/Oct/2000:13:55:36 +00100', //clf - '2006', - '1986', // year - 'JAN', - 'January', + '', + " \t\r\n000", + 'yesterday', + '22:49:12', + '22:49:12 bogusTZ', + '22.49.12.42GMT', + '22.49.12.42bogusTZ', + 't0222', + 't0222 t0222', + '022233', + '022233 bogusTZ', + '2-3-2004', + '2.3.2004', + '20060212T23:12:23UTC', + '20060212T23:12:23 bogusTZ', + '2006167', //pgydotd + 'Jan-15-2006', //pgtextshort + '2006-Jan-15', //pgtextreverse + '10/Oct/2000:13:55:36 +0100', //clf + '10/Oct/2000:13:55:36 +00100', //clf + '2006', + '1986', // year + 'JAN', + 'January', ); foreach ($strs as $str) { - $t = strtotime($str, $time); - if (is_integer($t)) { - var_dump(date(DATE_RFC2822, $t)); - } else { - var_dump($t); - } + $t = strtotime($str, $time); + if (is_integer($t)) { + var_dump(date(DATE_RFC2822, $t)); + } else { + var_dump($t); + } } ?> diff --git a/ext/date/tests/strtotime_variation_scottish.phpt b/ext/date/tests/strtotime_variation_scottish.phpt index 740583a78e..ee2ff5f098 100644 --- a/ext/date/tests/strtotime_variation_scottish.phpt +++ b/ext/date/tests/strtotime_variation_scottish.phpt @@ -2,11 +2,11 @@ Checking whisky time --FILE-- <?php - date_default_timezone_set('UTC'); - var_dump(date('H:i:s', strtotime('back of 7'))); - var_dump(date('H:i:s', strtotime('front of 7'))); - var_dump(date('H:i:s', strtotime('back of 19'))); - var_dump(date('H:i:s', strtotime('front of 19'))); + date_default_timezone_set('UTC'); + var_dump(date('H:i:s', strtotime('back of 7'))); + var_dump(date('H:i:s', strtotime('front of 7'))); + var_dump(date('H:i:s', strtotime('back of 19'))); + var_dump(date('H:i:s', strtotime('front of 19'))); ?> --EXPECT-- string(8) "07:15:00" diff --git a/ext/date/tests/sunfuncts.phpt b/ext/date/tests/sunfuncts.phpt index 672b3affe2..6859aadc44 100644 --- a/ext/date/tests/sunfuncts.phpt +++ b/ext/date/tests/sunfuncts.phpt @@ -6,13 +6,13 @@ precision=13 <?php date_default_timezone_set('Asia/Jerusalem'); for($a=1;$a<=12;$a++){ - echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." "; - echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." "; - echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n"; + echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." "; + echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." "; + echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n"; - echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." "; - echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." "; - echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n"; + echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." "; + echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." "; + echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n"; } ?> --EXPECTF-- diff --git a/ext/date/tests/test-parse-from-format.phpt b/ext/date/tests/test-parse-from-format.phpt index ee0bd68d6b..670a316859 100644 --- a/ext/date/tests/test-parse-from-format.phpt +++ b/ext/date/tests/test-parse-from-format.phpt @@ -4,20 +4,20 @@ date_create_from_format() and date_parse_from_format(). <?php date_default_timezone_set('Europe/Oslo'); $formats = array( DATE_ATOM, DATE_COOKIE, DATE_ISO8601, DATE_RFC822, - DATE_RFC850, DATE_RFC1036, DATE_RFC1123, DATE_RFC2822, DATE_RFC3339, - DATE_RSS, DATE_W3C ); + DATE_RFC850, DATE_RFC1036, DATE_RFC1123, DATE_RFC2822, DATE_RFC3339, + DATE_RSS, DATE_W3C ); foreach( $formats as $format ) { - $date = new DateTime( "2008-07-08T22:14:12+02:00" ); - $formatted = $date->format( $format ) ; - $date2 = date_create_from_format( $format, $formatted ); - var_dump( $format, $formatted, $date2 ); - echo "\n"; - if ( $date2 === false ) - { - var_dump(date_parse_from_format( $format, $formatted ) ); - } + $date = new DateTime( "2008-07-08T22:14:12+02:00" ); + $formatted = $date->format( $format ) ; + $date2 = date_create_from_format( $format, $formatted ); + var_dump( $format, $formatted, $date2 ); + echo "\n"; + if ( $date2 === false ) + { + var_dump(date_parse_from_format( $format, $formatted ) ); + } } ?> --EXPECT-- diff --git a/ext/date/tests/timezone-configuration.phpt b/ext/date/tests/timezone-configuration.phpt index b395853033..3e4340c38c 100644 --- a/ext/date/tests/timezone-configuration.phpt +++ b/ext/date/tests/timezone-configuration.phpt @@ -4,14 +4,14 @@ timezone configuration [1] date.timezone=GMT --FILE-- <?php - date_default_timezone_set('Europe/Oslo'); - echo strtotime("2005-06-18 22:15:44"), "\n"; + date_default_timezone_set('Europe/Oslo'); + echo strtotime("2005-06-18 22:15:44"), "\n"; - date_default_timezone_set('Europe/London'); - echo strtotime("2005-06-18 22:15:44"), "\n"; + date_default_timezone_set('Europe/London'); + echo strtotime("2005-06-18 22:15:44"), "\n"; - date_default_timezone_set('Europe/Oslo'); - echo strtotime("2005-06-18 22:15:44"), "\n"; + date_default_timezone_set('Europe/Oslo'); + echo strtotime("2005-06-18 22:15:44"), "\n"; ?> --EXPECT-- 1119125744 diff --git a/ext/date/tests/timezone_offset_get_error.phpt b/ext/date/tests/timezone_offset_get_error.phpt index 07bcf895dd..69e81cb846 100644 --- a/ext/date/tests/timezone_offset_get_error.phpt +++ b/ext/date/tests/timezone_offset_get_error.phpt @@ -18,47 +18,47 @@ echo "*** Testing timezone_offset_get() : error conditions ***\n"; echo "\n-- Testing timezone_offset_get() function with an invalid values for \$object argument --\n"; $invalid_obj = new stdClass(); try { - var_dump( timezone_offset_get($invalid_obj, $date) ); + var_dump( timezone_offset_get($invalid_obj, $date) ); } catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; + var_dump($ex->getMessage()); + echo "\n"; } $invalid_obj = 10; try { - var_dump( timezone_offset_get($invalid_obj, $date) ); + var_dump( timezone_offset_get($invalid_obj, $date) ); } catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; + var_dump($ex->getMessage()); + echo "\n"; } $invalid_obj = null; try { - var_dump( timezone_offset_get($invalid_obj, $date) ); + var_dump( timezone_offset_get($invalid_obj, $date) ); } catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; + var_dump($ex->getMessage()); + echo "\n"; } echo "\n-- Testing timezone_offset_get() function with an invalid values for \$datetime argument --\n"; $invalid_obj = new stdClass(); try { - var_dump( timezone_offset_get($tz, $invalid_obj) ); + var_dump( timezone_offset_get($tz, $invalid_obj) ); } catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; + var_dump($ex->getMessage()); + echo "\n"; } $invalid_obj = 10; try { - var_dump( timezone_offset_get($tz, $invalid_obj) ); + var_dump( timezone_offset_get($tz, $invalid_obj) ); } catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; + var_dump($ex->getMessage()); + echo "\n"; } $invalid_obj = null; try { - var_dump( timezone_offset_get($tz, $invalid_obj) ); + var_dump( timezone_offset_get($tz, $invalid_obj) ); } catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; + var_dump($ex->getMessage()); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/dba/tests/bug38698.phpt b/ext/dba/tests/bug38698.phpt index 9630af639d..fe4c68aa80 100644 --- a/ext/dba/tests/bug38698.phpt +++ b/ext/dba/tests/bug38698.phpt @@ -15,15 +15,15 @@ function isLittleEndian() { $db_file = __DIR__ .'/129php.cdb'; if (($db_make=dba_open($db_file, "n", 'cdb_make'))!==FALSE) { - if (isLittleEndian() === FALSE) { + if (isLittleEndian() === FALSE) { dba_insert(pack('V',129), "Booo!", $db_make); - } else{ - dba_insert(pack('i',129), "Booo!", $db_make); - } - dba_close($db_make); - // write md5 checksum of generated database file - var_dump(md5_file($db_file)); - @unlink($db_file); + } else{ + dba_insert(pack('i',129), "Booo!", $db_make); + } + dba_close($db_make); + // write md5 checksum of generated database file + var_dump(md5_file($db_file)); + @unlink($db_file); } else { echo "Error creating database\n"; } diff --git a/ext/dba/tests/bug62490.phpt b/ext/dba/tests/bug62490.phpt index a0fc64aafa..3e5c1e82ca 100644 --- a/ext/dba/tests/bug62490.phpt +++ b/ext/dba/tests/bug62490.phpt @@ -11,10 +11,10 @@ $handler = "inifile"; include "test.inc"; $dba = dba_open($db_filename, "n", $handler) - or die; + or die; for ($i = 0; $i < 3; ++$i) { - echo "insert $i:"; - var_dump(dba_insert("a", $i, $dba)); + echo "insert $i:"; + var_dump(dba_insert("a", $i, $dba)); } echo "exists:"; diff --git a/ext/dba/tests/clean.inc b/ext/dba/tests/clean.inc index 9f6d539a19..83c867de64 100644 --- a/ext/dba/tests/clean.inc +++ b/ext/dba/tests/clean.inc @@ -1,6 +1,6 @@ <?php $db_filename = dirname(__FILE__) .'/test0.dbm'; // see test.inc - @unlink($db_filename); - @unlink($db_filename.'.lck'); - @unlink($db_filename.'-lock'); + @unlink($db_filename); + @unlink($db_filename.'.lck'); + @unlink($db_filename.'-lock'); ?> diff --git a/ext/dba/tests/dba001.phpt b/ext/dba/tests/dba001.phpt index 836d03da74..79ebb2d237 100644 --- a/ext/dba/tests/dba001.phpt +++ b/ext/dba/tests/dba001.phpt @@ -7,13 +7,13 @@ DBA File Creation Test ?> --FILE-- <?php - require_once(__DIR__ .'/test.inc'); - echo "database handler: $handler\n"; - if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { - echo "database file created\n"; - dba_close($db_file); - } else { - echo "$db_file does not exist\n"; + require_once(__DIR__ .'/test.inc'); + echo "database handler: $handler\n"; + if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { + echo "database file created\n"; + dba_close($db_file); + } else { + echo "$db_file does not exist\n"; } ?> --CLEAN-- diff --git a/ext/dba/tests/dba002.phpt b/ext/dba/tests/dba002.phpt index 73b2d42df9..c0432c4599 100644 --- a/ext/dba/tests/dba002.phpt +++ b/ext/dba/tests/dba002.phpt @@ -7,15 +7,15 @@ DBA Insert/Fetch Test ?> --FILE-- <?php - require_once(__DIR__ .'/test.inc'); - echo "database handler: $handler\n"; - if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { - dba_insert("key1", "This is a test insert", $db_file); - echo dba_fetch("key1", $db_file); - dba_close($db_file); - } else { - echo "Error creating database\n"; - } + require_once(__DIR__ .'/test.inc'); + echo "database handler: $handler\n"; + if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { + dba_insert("key1", "This is a test insert", $db_file); + echo dba_fetch("key1", $db_file); + dba_close($db_file); + } else { + echo "Error creating database\n"; + } ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba003.phpt b/ext/dba/tests/dba003.phpt index af73282c9f..55d4ce9fe0 100644 --- a/ext/dba/tests/dba003.phpt +++ b/ext/dba/tests/dba003.phpt @@ -7,17 +7,17 @@ DBA Insert/Replace/Fetch Test ?> --FILE-- <?php - require_once(__DIR__ .'/test.inc'); - echo "database handler: $handler\n"; - if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { - dba_insert("key1", "This is a test insert", $db_file); - dba_replace("key1", "This is the replacement text", $db_file); - $a = dba_fetch("key1", $db_file); - dba_close($db_file); - echo $a; - } else { - echo "Error creating database\n"; - } + require_once(__DIR__ .'/test.inc'); + echo "database handler: $handler\n"; + if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { + dba_insert("key1", "This is a test insert", $db_file); + dba_replace("key1", "This is the replacement text", $db_file); + $a = dba_fetch("key1", $db_file); + dba_close($db_file); + echo $a; + } else { + echo "Error creating database\n"; + } ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba004.phpt b/ext/dba/tests/dba004.phpt index c197d761d4..3846ccfd29 100644 --- a/ext/dba/tests/dba004.phpt +++ b/ext/dba/tests/dba004.phpt @@ -7,21 +7,21 @@ DBA Multiple Insert/Fetch Test ?> --FILE-- <?php - require_once(__DIR__ .'/test.inc'); - echo "database handler: $handler\n"; - if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { - dba_insert("key1", "Content String 1", $db_file); - dba_insert("key2", "Content String 2", $db_file); - dba_insert("key3", "Third Content String", $db_file); - dba_insert("key4", "Another Content String", $db_file); - dba_insert("key5", "The last content string", $db_file); - $a = dba_fetch("key4", $db_file); - $b = dba_fetch("key2", $db_file); - dba_close($db_file); - echo "$a $b"; - } else { - echo "Error creating database\n"; - } + require_once(__DIR__ .'/test.inc'); + echo "database handler: $handler\n"; + if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { + dba_insert("key1", "Content String 1", $db_file); + dba_insert("key2", "Content String 2", $db_file); + dba_insert("key3", "Third Content String", $db_file); + dba_insert("key4", "Another Content String", $db_file); + dba_insert("key5", "The last content string", $db_file); + $a = dba_fetch("key4", $db_file); + $b = dba_fetch("key2", $db_file); + dba_close($db_file); + echo "$a $b"; + } else { + echo "Error creating database\n"; + } ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba005.phpt b/ext/dba/tests/dba005.phpt index 5173283755..0f5767988d 100644 --- a/ext/dba/tests/dba005.phpt +++ b/ext/dba/tests/dba005.phpt @@ -7,28 +7,28 @@ DBA FirstKey/NextKey Loop Test With 5 Items ?> --FILE-- <?php - require_once(__DIR__ .'/test.inc'); - echo "database handler: $handler\n"; - if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { - dba_insert("key1", "Content String 1", $db_file); - dba_insert("key2", "Content String 2", $db_file); - dba_insert("key3", "Third Content String", $db_file); - dba_insert("key4", "Another Content String", $db_file); - dba_insert("key5", "The last content string", $db_file); - $a = dba_firstkey($db_file); - $i=0; - while($a) { - $a = dba_nextkey($db_file); - $i++; - } - echo $i; - for ($i=1; $i<6; $i++) { - echo dba_exists("key$i", $db_file) ? "Y" : "N"; - } - dba_close($db_file); - } else { - echo "Error creating database\n"; - } + require_once(__DIR__ .'/test.inc'); + echo "database handler: $handler\n"; + if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { + dba_insert("key1", "Content String 1", $db_file); + dba_insert("key2", "Content String 2", $db_file); + dba_insert("key3", "Third Content String", $db_file); + dba_insert("key4", "Another Content String", $db_file); + dba_insert("key5", "The last content string", $db_file); + $a = dba_firstkey($db_file); + $i=0; + while($a) { + $a = dba_nextkey($db_file); + $i++; + } + echo $i; + for ($i=1; $i<6; $i++) { + echo dba_exists("key$i", $db_file) ? "Y" : "N"; + } + dba_close($db_file); + } else { + echo "Error creating database\n"; + } ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba006.phpt b/ext/dba/tests/dba006.phpt index 84814f2bcf..1264ccf899 100644 --- a/ext/dba/tests/dba006.phpt +++ b/ext/dba/tests/dba006.phpt @@ -7,30 +7,30 @@ DBA FirstKey/NextKey with 2 deletes ?> --FILE-- <?php - require_once(__DIR__ .'/test.inc'); - echo "database handler: $handler\n"; - if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { - dba_insert("key1", "Content String 1", $db_file); - dba_insert("key2", "Content String 2", $db_file); - dba_insert("key3", "Third Content String", $db_file); - dba_insert("key4", "Another Content String", $db_file); - dba_insert("key5", "The last content string", $db_file); - dba_delete("key3", $db_file); - dba_delete("key1", $db_file); - $a = dba_firstkey($db_file); - $i=0; - while($a) { - $a = dba_nextkey($db_file); - $i++; - } - echo $i; - for ($i=1; $i<6; $i++) { - echo dba_exists("key$i", $db_file) ? "Y" : "N"; - } - dba_close($db_file); - } else { - echo "Error creating database\n"; - } + require_once(__DIR__ .'/test.inc'); + echo "database handler: $handler\n"; + if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { + dba_insert("key1", "Content String 1", $db_file); + dba_insert("key2", "Content String 2", $db_file); + dba_insert("key3", "Third Content String", $db_file); + dba_insert("key4", "Another Content String", $db_file); + dba_insert("key5", "The last content string", $db_file); + dba_delete("key3", $db_file); + dba_delete("key1", $db_file); + $a = dba_firstkey($db_file); + $i=0; + while($a) { + $a = dba_nextkey($db_file); + $i++; + } + echo $i; + for ($i=1; $i<6; $i++) { + echo dba_exists("key$i", $db_file) ? "Y" : "N"; + } + dba_close($db_file); + } else { + echo "Error creating database\n"; + } ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba007.phpt b/ext/dba/tests/dba007.phpt index 7c8e2b0bd4..bb71ad273e 100644 --- a/ext/dba/tests/dba007.phpt +++ b/ext/dba/tests/dba007.phpt @@ -8,30 +8,30 @@ DBA Multiple File Creation Test ?> --FILE-- <?php - require_once(__DIR__ .'/test.inc'); - echo "database handler: $handler\n"; - $db_file1 = $db_filename1 = __DIR__.'/test1.dbm'; - $db_file2 = $db_filename2 = __DIR__.'/test2.dbm'; - if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { - echo "database file created\n"; - } else { - echo "$db_file does not exist\n"; + require_once(__DIR__ .'/test.inc'); + echo "database handler: $handler\n"; + $db_file1 = $db_filename1 = __DIR__.'/test1.dbm'; + $db_file2 = $db_filename2 = __DIR__.'/test2.dbm'; + if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) { + echo "database file created\n"; + } else { + echo "$db_file does not exist\n"; } - if (($db_file1=dba_open($db_file1, "n", $handler))!==FALSE) { - echo "database file created\n"; - } else { - echo "$db_file does not exist\n"; + if (($db_file1=dba_open($db_file1, "n", $handler))!==FALSE) { + echo "database file created\n"; + } else { + echo "$db_file does not exist\n"; } - if (($db_file2=dba_open($db_file2, "n", $handler))!==FALSE) { - echo "database file created\n"; - } else { - echo "$db_file does not exist\n"; + if (($db_file2=dba_open($db_file2, "n", $handler))!==FALSE) { + echo "database file created\n"; + } else { + echo "$db_file does not exist\n"; } - var_dump(dba_list()); - dba_close($db_file); + var_dump(dba_list()); + dba_close($db_file); - @unlink($db_filename1); - @unlink($db_filename2); + @unlink($db_filename1); + @unlink($db_filename2); ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba009.phpt b/ext/dba/tests/dba009.phpt index d1d612243b..4ca9b0ed96 100644 --- a/ext/dba/tests/dba009.phpt +++ b/ext/dba/tests/dba009.phpt @@ -7,22 +7,22 @@ DBA dba_popen Test ?> --FILE-- <?php - require_once(__DIR__ .'/test.inc'); - echo "database handler: $handler\n"; - if (($db=dba_popen($db_file, "n", $handler))!==FALSE) { - echo "Opened\n"; - dba_insert("a", "Inserted", $db); - echo dba_fetch("a", $db)."\n"; - dba_close($db); - echo "Closed\n"; - } else { - echo "Error creating database\n"; - } - if (($db=dba_popen($db_file, "n", $handler))!==FALSE) { - echo "Opened\n"; - dba_insert("a", "Inserted", $db); - echo dba_fetch("a", $db)."\n"; - } + require_once(__DIR__ .'/test.inc'); + echo "database handler: $handler\n"; + if (($db=dba_popen($db_file, "n", $handler))!==FALSE) { + echo "Opened\n"; + dba_insert("a", "Inserted", $db); + echo dba_fetch("a", $db)."\n"; + dba_close($db); + echo "Closed\n"; + } else { + echo "Error creating database\n"; + } + if (($db=dba_popen($db_file, "n", $handler))!==FALSE) { + echo "Opened\n"; + dba_insert("a", "Inserted", $db); + echo dba_fetch("a", $db)."\n"; + } ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba_cdb.phpt b/ext/dba/tests/dba_cdb.phpt index 6bd0fe42b9..956483f5f3 100644 --- a/ext/dba/tests/dba_cdb.phpt +++ b/ext/dba/tests/dba_cdb.phpt @@ -8,9 +8,9 @@ DBA CDB handler test ?> --FILE-- <?php - $handler = 'cdb'; - require_once(__DIR__ .'/test.inc'); - require_once(__DIR__ .'/dba_handler.inc'); + $handler = 'cdb'; + require_once(__DIR__ .'/test.inc'); + require_once(__DIR__ .'/dba_handler.inc'); ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba_cdb_make.phpt b/ext/dba/tests/dba_cdb_make.phpt index 33fcd6ea47..21969db074 100644 --- a/ext/dba/tests/dba_cdb_make.phpt +++ b/ext/dba/tests/dba_cdb_make.phpt @@ -8,27 +8,27 @@ DBA CDB_MAKE handler test ?> --FILE-- <?php - $handler = 'cdb_make'; - require_once(__DIR__ .'/test.inc'); - echo "database handler: $handler\n"; - // print md5 checksum of test.cdb which is generated by cdb_make program - var_dump(md5_file(__DIR__.'/test.cdb')); - if (($db_make=dba_open($db_file, "n", $handler))!==FALSE) { - dba_insert("1", "1", $db_make); - dba_insert("2", "2", $db_make); - dba_insert("1", "3", $db_make); - dba_insert("2", "1", $db_make); - dba_insert("3", "3", $db_make); - dba_insert("1", "2", $db_make); - dba_insert("4", "4", $db_make); + $handler = 'cdb_make'; + require_once(__DIR__ .'/test.inc'); + echo "database handler: $handler\n"; + // print md5 checksum of test.cdb which is generated by cdb_make program + var_dump(md5_file(__DIR__.'/test.cdb')); + if (($db_make=dba_open($db_file, "n", $handler))!==FALSE) { + dba_insert("1", "1", $db_make); + dba_insert("2", "2", $db_make); + dba_insert("1", "3", $db_make); + dba_insert("2", "1", $db_make); + dba_insert("3", "3", $db_make); + dba_insert("1", "2", $db_make); + dba_insert("4", "4", $db_make); // dba_replace cdb_make doesn't know replace - dba_close($db_make); - // write md5 checksum of generated database file - var_dump(md5_file($db_file)); - // no need to test created database: this is done by dba_cdb_read.phpt - } else { - echo "Error creating database\n"; - } + dba_close($db_make); + // write md5 checksum of generated database file + var_dump(md5_file($db_file)); + // no need to test created database: this is done by dba_cdb_read.phpt + } else { + echo "Error creating database\n"; + } ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba_cdb_read.phpt b/ext/dba/tests/dba_cdb_read.phpt index 91ca6e9853..39fc85e454 100644 --- a/ext/dba/tests/dba_cdb_read.phpt +++ b/ext/dba/tests/dba_cdb_read.phpt @@ -7,53 +7,53 @@ DBA CDB handler test (read only) ?> --FILE-- <?php - echo "database handler: cdb\n"; - $handler = 'cdb'; - $db_file = __DIR__.'/test.cdb'; - if (($db_file=dba_open($db_file, "r", $handler))!==FALSE) { - // read key sequence - $a = dba_firstkey($db_file); - $count= 0; - $keys = $a; - while($a) { - $a = dba_nextkey($db_file); - $keys .= $a; - $count++; - } - // display number of entries and key existence - echo $count; - for ($i=1; $i<8; $i++) { - echo dba_exists($i, $db_file) ? "Y" : "N"; - } - echo "\n="; - echo dba_fetch(1, $db_file); - echo dba_fetch(2, $db_file); - echo dba_fetch(3, $db_file); - echo dba_fetch(4, $db_file); - echo "\n#"; - echo dba_fetch(1, $db_file); - echo dba_fetch(1, $db_file); - echo dba_fetch(2, $db_file); - echo dba_fetch(2, $db_file); - echo "\n?".$keys; - // with skip = 0 dba_fetch must fetch the first result - echo "\n#"; - $skip = array(); - for ($i=0; $i < strlen($keys); $i++) { - $key = substr($keys, $i, 1); - $skip[$key] = 0; - echo dba_fetch($key, $db_file); - } - echo "\n="; - for ($i=0; $i < strlen($keys); $i++) { - $key = substr($keys, $i, 1); - echo dba_fetch($key, $skip[$key], $db_file); - $skip[$key]++; - } - dba_close($db_file); - } else { - echo "Error creating database\n"; - } + echo "database handler: cdb\n"; + $handler = 'cdb'; + $db_file = __DIR__.'/test.cdb'; + if (($db_file=dba_open($db_file, "r", $handler))!==FALSE) { + // read key sequence + $a = dba_firstkey($db_file); + $count= 0; + $keys = $a; + while($a) { + $a = dba_nextkey($db_file); + $keys .= $a; + $count++; + } + // display number of entries and key existence + echo $count; + for ($i=1; $i<8; $i++) { + echo dba_exists($i, $db_file) ? "Y" : "N"; + } + echo "\n="; + echo dba_fetch(1, $db_file); + echo dba_fetch(2, $db_file); + echo dba_fetch(3, $db_file); + echo dba_fetch(4, $db_file); + echo "\n#"; + echo dba_fetch(1, $db_file); + echo dba_fetch(1, $db_file); + echo dba_fetch(2, $db_file); + echo dba_fetch(2, $db_file); + echo "\n?".$keys; + // with skip = 0 dba_fetch must fetch the first result + echo "\n#"; + $skip = array(); + for ($i=0; $i < strlen($keys); $i++) { + $key = substr($keys, $i, 1); + $skip[$key] = 0; + echo dba_fetch($key, $db_file); + } + echo "\n="; + for ($i=0; $i < strlen($keys); $i++) { + $key = substr($keys, $i, 1); + echo dba_fetch($key, $skip[$key], $db_file); + $skip[$key]++; + } + dba_close($db_file); + } else { + echo "Error creating database\n"; + } ?> --EXPECT-- database handler: cdb diff --git a/ext/dba/tests/dba_db1.phpt b/ext/dba/tests/dba_db1.phpt index a08809c0e7..26711c9d5e 100644 --- a/ext/dba/tests/dba_db1.phpt +++ b/ext/dba/tests/dba_db1.phpt @@ -7,9 +7,9 @@ DBA DB1 handler test ?> --FILE-- <?php - $handler = 'db1'; - require_once __DIR__ .'/test.inc'; - require_once __DIR__ .'/dba_handler.inc'; + $handler = 'db1'; + require_once __DIR__ .'/test.inc'; + require_once __DIR__ .'/dba_handler.inc'; ?> --EXPECT-- database handler: db1 diff --git a/ext/dba/tests/dba_db2.phpt b/ext/dba/tests/dba_db2.phpt index ef48664762..013813062a 100644 --- a/ext/dba/tests/dba_db2.phpt +++ b/ext/dba/tests/dba_db2.phpt @@ -7,9 +7,9 @@ DBA DB2 handler test ?> --FILE-- <?php - $handler = 'db2'; - require_once __DIR__ .'/test.inc'; - require_once __DIR__ .'/dba_handler.inc'; + $handler = 'db2'; + require_once __DIR__ .'/test.inc'; + require_once __DIR__ .'/dba_handler.inc'; ?> --EXPECT-- database handler: db2 diff --git a/ext/dba/tests/dba_db3.phpt b/ext/dba/tests/dba_db3.phpt index a07780ea34..f3c2061414 100644 --- a/ext/dba/tests/dba_db3.phpt +++ b/ext/dba/tests/dba_db3.phpt @@ -7,9 +7,9 @@ DBA DB3 handler test ?> --FILE-- <?php - $handler = 'db3'; - require_once __DIR__ .'/test.inc'; - require_once __DIR__ .'/dba_handler.inc'; + $handler = 'db3'; + require_once __DIR__ .'/test.inc'; + require_once __DIR__ .'/dba_handler.inc'; ?> --EXPECT-- database handler: db3 diff --git a/ext/dba/tests/dba_dbm.phpt b/ext/dba/tests/dba_dbm.phpt index be9c988433..47bbae28c0 100644 --- a/ext/dba/tests/dba_dbm.phpt +++ b/ext/dba/tests/dba_dbm.phpt @@ -7,9 +7,9 @@ DBA DBM handler test ?> --FILE-- <?php - $handler = 'dbm'; - require_once __DIR__ .'/test.inc'; - require_once __DIR__ .'/dba_handler.inc'; + $handler = 'dbm'; + require_once __DIR__ .'/test.inc'; + require_once __DIR__ .'/dba_handler.inc'; ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba_flatfile.phpt b/ext/dba/tests/dba_flatfile.phpt index 1119339ca7..41bd0f891d 100644 --- a/ext/dba/tests/dba_flatfile.phpt +++ b/ext/dba/tests/dba_flatfile.phpt @@ -7,9 +7,9 @@ DBA FlatFile handler test ?> --FILE-- <?php - $handler = 'flatfile'; - require_once(__DIR__ .'/test.inc'); - require_once(__DIR__ .'/dba_handler.inc'); + $handler = 'flatfile'; + require_once(__DIR__ .'/test.inc'); + require_once(__DIR__ .'/dba_handler.inc'); ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba_gdbm.phpt b/ext/dba/tests/dba_gdbm.phpt index 3de1cdd682..ae4216d7fd 100644 --- a/ext/dba/tests/dba_gdbm.phpt +++ b/ext/dba/tests/dba_gdbm.phpt @@ -7,12 +7,12 @@ DBA GDBM handler test ?> --FILE-- <?php - $handler = 'gdbm'; - require_once __DIR__ .'/test.inc'; - $lock_flag = ''; // lock in library - require_once __DIR__ .'/dba_handler.inc'; + $handler = 'gdbm'; + require_once __DIR__ .'/test.inc'; + $lock_flag = ''; // lock in library + require_once __DIR__ .'/dba_handler.inc'; - // Read during write is system dependent. Important is that there is no deadlock + // Read during write is system dependent. Important is that there is no deadlock ?> --EXPECTF-- database handler: gdbm diff --git a/ext/dba/tests/dba_handler.inc b/ext/dba/tests/dba_handler.inc index 51f27050ca..9b9d030c39 100644 --- a/ext/dba/tests/dba_handler.inc +++ b/ext/dba/tests/dba_handler.inc @@ -3,96 +3,96 @@ echo "database handler: $handler\n"; do { - if (($db_file = dba_open($db_filename, 'n'.$lock_flag, $handler))!==FALSE) { - dba_insert("key1", "Content String 1", $db_file); - dba_insert("key2", "Content String 2", $db_file); - dba_insert("key3", "Third Content String", $db_file); - dba_insert("key4", "Another Content String", $db_file); - dba_insert("key5", "The last content string", $db_file); - if ($handler != 'cdb') { - dba_delete("key3", $db_file); - dba_delete("key1", $db_file); - } else { - dba_close($db_file); - if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))===FALSE) { - echo "Error reopening database\n"; - } - } - $a = dba_firstkey($db_file); - $i=0; - while($a) { - $a = dba_nextkey($db_file); - $i++; - } - echo $i; - for ($i=1; $i<6; $i++) { - echo dba_exists("key$i", $db_file) ? "Y" : "N"; - } - echo "\n"; - echo dba_fetch("key2", $db_file)."\n"; - if ($handler != 'cdb') { - dba_replace("key2", "Content 2 replaced", $db_file); - echo dba_fetch("key2", $db_file)."\n"; - } - dba_close($db_file); - } else { - echo "Error creating database\n"; - } - if ($handler != 'cdb') { - $db_writer = dba_open($db_filename, 'c'.$lock_flag, $handler); - if (($dba_reader = @dba_open($db_filename, 'r'.$lock_flag.'t', $handler))===false) { - echo "Read during write: not allowed\n"; - } else { - echo "Read during write: allowed\n"; - } - if ($db_writer!==FALSE) { - if (dba_insert("key number 6", "The 6th value", $db_writer)) { - echo '"key number 6" written' . "\n"; - } else { - echo 'Failed to write "key number 6"' . "\n"; - } - if (dba_insert("key number 6", "The 6th value inserted again would be an error", $db_writer)) { - echo '"key number 6" written 2nd time' . "\n"; - } else { - echo 'Failed to write "key number 6" 2nd time' . "\n"; - } - dba_replace("key2", "Content 2 replaced 2nd time", $db_writer); - dba_delete("key4", $db_writer); - echo dba_fetch("key2", $db_writer)."\n"; - echo dba_fetch("key number 6", $db_writer)."\n"; - dba_close($db_writer); // when the writer is open at least db3 would fail because of buffered io. - } else { - die("Error reopening database\n"); - } - } - if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))!==FALSE) { - $key = dba_firstkey($db_file); - $res = array(); - while($key) { - $res[$key] = dba_fetch($key, $db_file); - $key = dba_nextkey($db_file); - } - ksort($res); - var_dump($res); - dba_close($db_file); - } else { - echo "Error reading database\n"; - } - if (!empty($dba_reader)) { - dba_close($dba_reader); - } - if (($db_file = dba_popen($db_filename, 'r'.($lock_flag==''?'':'-'), $handler))!==FALSE) { - if ($handler == 'dbm' || $handler == "tcadb") { - dba_close($db_file); - } - } + if (($db_file = dba_open($db_filename, 'n'.$lock_flag, $handler))!==FALSE) { + dba_insert("key1", "Content String 1", $db_file); + dba_insert("key2", "Content String 2", $db_file); + dba_insert("key3", "Third Content String", $db_file); + dba_insert("key4", "Another Content String", $db_file); + dba_insert("key5", "The last content string", $db_file); + if ($handler != 'cdb') { + dba_delete("key3", $db_file); + dba_delete("key1", $db_file); + } else { + dba_close($db_file); + if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))===FALSE) { + echo "Error reopening database\n"; + } + } + $a = dba_firstkey($db_file); + $i=0; + while($a) { + $a = dba_nextkey($db_file); + $i++; + } + echo $i; + for ($i=1; $i<6; $i++) { + echo dba_exists("key$i", $db_file) ? "Y" : "N"; + } + echo "\n"; + echo dba_fetch("key2", $db_file)."\n"; + if ($handler != 'cdb') { + dba_replace("key2", "Content 2 replaced", $db_file); + echo dba_fetch("key2", $db_file)."\n"; + } + dba_close($db_file); + } else { + echo "Error creating database\n"; + } + if ($handler != 'cdb') { + $db_writer = dba_open($db_filename, 'c'.$lock_flag, $handler); + if (($dba_reader = @dba_open($db_filename, 'r'.$lock_flag.'t', $handler))===false) { + echo "Read during write: not allowed\n"; + } else { + echo "Read during write: allowed\n"; + } + if ($db_writer!==FALSE) { + if (dba_insert("key number 6", "The 6th value", $db_writer)) { + echo '"key number 6" written' . "\n"; + } else { + echo 'Failed to write "key number 6"' . "\n"; + } + if (dba_insert("key number 6", "The 6th value inserted again would be an error", $db_writer)) { + echo '"key number 6" written 2nd time' . "\n"; + } else { + echo 'Failed to write "key number 6" 2nd time' . "\n"; + } + dba_replace("key2", "Content 2 replaced 2nd time", $db_writer); + dba_delete("key4", $db_writer); + echo dba_fetch("key2", $db_writer)."\n"; + echo dba_fetch("key number 6", $db_writer)."\n"; + dba_close($db_writer); // when the writer is open at least db3 would fail because of buffered io. + } else { + die("Error reopening database\n"); + } + } + if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))!==FALSE) { + $key = dba_firstkey($db_file); + $res = array(); + while($key) { + $res[$key] = dba_fetch($key, $db_file); + $key = dba_nextkey($db_file); + } + ksort($res); + var_dump($res); + dba_close($db_file); + } else { + echo "Error reading database\n"; + } + if (!empty($dba_reader)) { + dba_close($dba_reader); + } + if (($db_file = dba_popen($db_filename, 'r'.($lock_flag==''?'':'-'), $handler))!==FALSE) { + if ($handler == 'dbm' || $handler == "tcadb") { + dba_close($db_file); + } + } - if ($lock_flag == '') { - break; - } else { - echo "--NO-LOCK--\n"; - $lock_flag = ''; - } + if ($lock_flag == '') { + break; + } else { + echo "--NO-LOCK--\n"; + $lock_flag = ''; + } } while(1); ?> diff --git a/ext/dba/tests/dba_inifile.phpt b/ext/dba/tests/dba_inifile.phpt index cbcd6c1e8d..e9bc185bf4 100644 --- a/ext/dba/tests/dba_inifile.phpt +++ b/ext/dba/tests/dba_inifile.phpt @@ -7,9 +7,9 @@ DBA INIFILE handler test ?> --FILE-- <?php - $handler = 'inifile'; - require_once __DIR__ .'/test.inc'; - require_once __DIR__ .'/dba_handler.inc'; + $handler = 'inifile'; + require_once __DIR__ .'/test.inc'; + require_once __DIR__ .'/dba_handler.inc'; ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba_lmdb.phpt b/ext/dba/tests/dba_lmdb.phpt index 7f6d484040..a97244bf36 100644 --- a/ext/dba/tests/dba_lmdb.phpt +++ b/ext/dba/tests/dba_lmdb.phpt @@ -7,10 +7,10 @@ DBA LMDB handler test ?> --FILE-- <?php - $handler = 'lmdb'; - require_once __DIR__ .'/test.inc'; - $lock_flag = ''; // lock in library - require_once __DIR__ .'/dba_handler.inc'; + $handler = 'lmdb'; + require_once __DIR__ .'/test.inc'; + $lock_flag = ''; // lock in library + require_once __DIR__ .'/dba_handler.inc'; ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba_ndbm.phpt b/ext/dba/tests/dba_ndbm.phpt index 6fc8a1ec3b..74f316e190 100644 --- a/ext/dba/tests/dba_ndbm.phpt +++ b/ext/dba/tests/dba_ndbm.phpt @@ -7,9 +7,9 @@ DBA NDBM handler test ?> --FILE-- <?php - $handler = 'ndbm'; - require_once __DIR__ .'/test.inc'; - require_once __DIR__ .'/dba_handler.inc'; + $handler = 'ndbm'; + require_once __DIR__ .'/test.inc'; + require_once __DIR__ .'/dba_handler.inc'; ?> --EXPECT-- database handler: ndbm diff --git a/ext/dba/tests/dba_qdbm.phpt b/ext/dba/tests/dba_qdbm.phpt index a864121a1d..efe34653b3 100644 --- a/ext/dba/tests/dba_qdbm.phpt +++ b/ext/dba/tests/dba_qdbm.phpt @@ -7,10 +7,10 @@ DBA QDBM handler test ?> --FILE-- <?php - $handler = 'qdbm'; - require_once __DIR__ .'/test.inc'; - $lock_flag = ''; // lock in library - require_once __DIR__ .'/dba_handler.inc'; + $handler = 'qdbm'; + require_once __DIR__ .'/test.inc'; + $lock_flag = ''; // lock in library + require_once __DIR__ .'/dba_handler.inc'; ?> --CLEAN-- <?php diff --git a/ext/dba/tests/dba_tcadb.phpt b/ext/dba/tests/dba_tcadb.phpt index 7464d2d659..0d7c32f06c 100644 --- a/ext/dba/tests/dba_tcadb.phpt +++ b/ext/dba/tests/dba_tcadb.phpt @@ -11,7 +11,7 @@ DBA TCADB handler test $db_filename = $db_file = __DIR__ .'/test0.tch'; @unlink($db_filename); @unlink($db_filename.'.lck'); - require_once __DIR__ .'/dba_handler.inc'; + require_once __DIR__ .'/dba_handler.inc'; ?> --CLEAN-- <?php diff --git a/ext/dba/tests/skipif.inc b/ext/dba/tests/skipif.inc index e75000fafd..b0530ca64f 100644 --- a/ext/dba/tests/skipif.inc +++ b/ext/dba/tests/skipif.inc @@ -1,23 +1,23 @@ <?php - if (!extension_loaded('dba')) die('skip dba extension not available'); - if (!function_exists('dba_handlers')) die ('skip dba_handlers() not available'); - if (!sizeof(dba_handlers())) die('skip no handlers installed'); - if (!isset($handler)) { - $handlers = dba_handlers(); - if (in_array('flatfile', $handlers)) { - $handler = 'flatfile'; - } else { - $handlers = array_diff($handlers, array('cdb', 'cdb_make')); /* these can only read OR write */ - if (count($handlers)==0) { - die('skip no handler available that can be used for the test'); - } - $handler = array_shift($handlers); - } - } else { - if (!in_array($handler, dba_handlers())) { - $HND = strtoupper($handler); - die("skip $HND handler not available"); - } - } - $HND = strtoupper($handler); + if (!extension_loaded('dba')) die('skip dba extension not available'); + if (!function_exists('dba_handlers')) die ('skip dba_handlers() not available'); + if (!sizeof(dba_handlers())) die('skip no handlers installed'); + if (!isset($handler)) { + $handlers = dba_handlers(); + if (in_array('flatfile', $handlers)) { + $handler = 'flatfile'; + } else { + $handlers = array_diff($handlers, array('cdb', 'cdb_make')); /* these can only read OR write */ + if (count($handlers)==0) { + die('skip no handler available that can be used for the test'); + } + $handler = array_shift($handlers); + } + } else { + if (!in_array($handler, dba_handlers())) { + $HND = strtoupper($handler); + die("skip $HND handler not available"); + } + } + $HND = strtoupper($handler); ?> diff --git a/ext/dba/tests/test.inc b/ext/dba/tests/test.inc index 7c4e207b82..458c4399e9 100644 --- a/ext/dba/tests/test.inc +++ b/ext/dba/tests/test.inc @@ -1,7 +1,7 @@ <?php - require_once dirname(__FILE__) .'/skipif.inc'; - $lock_flag = 'l'; - $db_filename = $db_file = dirname(__FILE__) .'/test0.dbm'; - @unlink($db_filename); - @unlink($db_filename.'.lck'); + require_once dirname(__FILE__) .'/skipif.inc'; + $lock_flag = 'l'; + $db_filename = $db_file = dirname(__FILE__) .'/test0.dbm'; + @unlink($db_filename); + @unlink($db_filename.'.lck'); ?> diff --git a/ext/dom/tests/DOMCDATASection_construct_error_001.phpt b/ext/dom/tests/DOMCDATASection_construct_error_001.phpt index 2154016142..ab7149cd87 100644 --- a/ext/dom/tests/DOMCDATASection_construct_error_001.phpt +++ b/ext/dom/tests/DOMCDATASection_construct_error_001.phpt @@ -7,11 +7,11 @@ Nic Rosental nicrosental@gmail.com <?php require_once('skipif.inc'); ?> --FILE-- <?php - try { - $section = new DOMCDataSection(); - } catch (TypeError $e) { - echo $e->getMessage(); - } + try { + $section = new DOMCDataSection(); + } catch (TypeError $e) { + echo $e->getMessage(); + } ?> --EXPECT-- DOMCdataSection::__construct() expects exactly 1 parameter, 0 given diff --git a/ext/dom/tests/DOMDocument_createAttribute_error.phpt b/ext/dom/tests/DOMDocument_createAttribute_error.phpt index a395ba9579..b9b310827d 100644 --- a/ext/dom/tests/DOMDocument_createAttribute_error.phpt +++ b/ext/dom/tests/DOMDocument_createAttribute_error.phpt @@ -7,19 +7,19 @@ Test DOMDocument::createAttribute() for expected exception thrown when wrong par $dom = new DOMDocument(); try { - $attr = $dom->createAttribute(0); + $attr = $dom->createAttribute(0); } catch(DOMException $e) { - $code = $e->getCode(); - if(DOM_INVALID_CHARACTER_ERR === $code) { - echo "PASS"; - } - else { - echo 'Wrong exception code'; - } + $code = $e->getCode(); + if(DOM_INVALID_CHARACTER_ERR === $code) { + echo "PASS"; + } + else { + echo 'Wrong exception code'; + } } catch(Exception $e) { - echo 'Wrong exception thrown'; + echo 'Wrong exception thrown'; } ?> diff --git a/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt b/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt index fa777f8ce5..93d0a13c77 100644 --- a/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt +++ b/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt @@ -10,22 +10,22 @@ require_once('skipif.inc'); <?php $rng = <<< RNG <?xml version="1.0" encoding="UTF-8"?> -<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0" - datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> - <start> - <element name="apple"> - <element name="pear"> - <data type="NCName"/> - </element> - </element> - </start> +<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <element name="apple"> + <element name="pear"> + <data type="NCName"/> + </element> + </element> + </start> </grammar> RNG; $good_xml = <<< GOOD_XML <?xml version="1.0"?> -<apple> - <pear>Pear</pear> +<apple> + <pear>Pear</pear> </apple> GOOD_XML; diff --git a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt index a277a30a2d..91b76344af 100644 --- a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt +++ b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt @@ -10,23 +10,23 @@ require_once('skipif.inc'); <?php $rng = <<< RNG <?xml version="1.0" encoding="UTF-8"?> -<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0" - datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> - <start> - <element name="apple"> - <element name="pear"> - <data type="NCName"/> - </element> - </element> - </start> +<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <element name="apple"> + <element name="pear"> + <data type="NCName"/> + </element> + </element> + </start> </grammar> RNG; $bad_xml = <<< BAD_XML <?xml version="1.0"?> -<apple> - <pear>Pear</pear> - <pear>Pear</pear> +<apple> + <pear>Pear</pear> + <pear>Pear</pear> </apple> BAD_XML; diff --git a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt index b11dc63f7e..658bc7ffca 100644 --- a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt +++ b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt @@ -10,10 +10,10 @@ require_once('skipif.inc'); <?php $rng = <<< RNG <?xml version="1.0" encoding="UTF-8"?> -<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0" +<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <start> - <element name="apple"> + <element name="apple"> </element> </start> </grammar> @@ -21,7 +21,7 @@ RNG; $xml = <<< XML <?xml version="1.0"?> -<apple> +<apple> <pear>Pear</pear> </apple> XML; diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt b/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt index e4b784e376..80645f5c74 100644 --- a/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt +++ b/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt @@ -11,8 +11,8 @@ require_once('skipif.inc'); $rng = __DIR__.'/DOMDocument_relaxNGValidate_basic.rng'; $xml = <<< XML <?xml version="1.0"?> -<apple> - <pear>Pear</pear> +<apple> + <pear>Pear</pear> </apple> XML; $doc = new DOMDocument(); diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt b/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt index ab6befa3b1..cbdab1cbd5 100644 --- a/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt +++ b/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt @@ -11,9 +11,9 @@ require_once('skipif.inc'); $rng = __DIR__.'/DOMDocument_relaxNGValidate_basic.rng'; $xml = <<< XML <?xml version="1.0"?> -<apple> - <pear>Pear</pear> - <pear>Pear</pear> +<apple> + <pear>Pear</pear> + <pear>Pear</pear> </apple> XML; $doc = new DOMDocument(); diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt b/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt index cdd6e64194..3aa6a3b318 100644 --- a/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt +++ b/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt @@ -11,9 +11,9 @@ require_once('skipif.inc'); $rng = __DIR__.'/foo.rng'; $xml = <<< XML <?xml version="1.0"?> -<apple> - <pear>Pear</pear> - <pear>Pear</pear> +<apple> + <pear>Pear</pear> + <pear>Pear</pear> </apple> XML; $doc = new DOMDocument(); diff --git a/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt b/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt index 3d99e0eb70..47f5579200 100644 --- a/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt +++ b/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt @@ -18,12 +18,12 @@ var_dump($doc->strictErrorChecking); echo "Should throw DOMException when strictErrorChecking is on\n"; try { - $attr = $doc->createAttribute(0); + $attr = $doc->createAttribute(0); } catch (DOMException $e) { - echo "GOOD. DOMException thrown\n"; - echo $e->getMessage() ."\n"; + echo "GOOD. DOMException thrown\n"; + echo $e->getMessage() ."\n"; } catch (Exception $e) { - echo "OOPS. Other exception thrown\n"; + echo "OOPS. Other exception thrown\n"; } @@ -35,12 +35,12 @@ var_dump($doc->strictErrorChecking); echo "Should raise PHP error because strictErrorChecking is off\n"; try { - $attr = $doc->createAttribute(0); + $attr = $doc->createAttribute(0); } catch (DOMException $e) { - echo "OOPS. DOMException thrown\n"; - echo $e->getMessage() ."\n"; + echo "OOPS. DOMException thrown\n"; + echo $e->getMessage() ."\n"; } catch (Exception $e) { - echo "OOPS. Other exception thrown\n"; + echo "OOPS. Other exception thrown\n"; } ?> diff --git a/ext/dom/tests/DOMImplementation_createDocumentType_basic.phpt b/ext/dom/tests/DOMImplementation_createDocumentType_basic.phpt index 06ae48e93d..ddce93052c 100644 --- a/ext/dom/tests/DOMImplementation_createDocumentType_basic.phpt +++ b/ext/dom/tests/DOMImplementation_createDocumentType_basic.phpt @@ -8,8 +8,8 @@ include('skipif.inc'); <?php $imp = new DOMImplementation(); $doctype = $imp->createDocumentType("html", - "-//W3C//DTD XHTML 1.0 Strict//EN", - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"); + "-//W3C//DTD XHTML 1.0 Strict//EN", + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"); $doc = $imp->createDocument(null, 'html', $doctype); echo $doc->saveHTML(); ?> diff --git a/ext/dom/tests/DOMNode_cloneNode_basic.phpt b/ext/dom/tests/DOMNode_cloneNode_basic.phpt index d0503630f3..9fec109a74 100644 --- a/ext/dom/tests/DOMNode_cloneNode_basic.phpt +++ b/ext/dom/tests/DOMNode_cloneNode_basic.phpt @@ -28,9 +28,9 @@ $xml = <<< EOXML EOXML; function dumpcourse($current) { - $title = ($current->nodeType != XML_TEXT_NODE && $current->hasAttribute('title')) ? $current->getAttribute('title'):"no title"; - echo "Course: $title:";echo(get_class($current)), "\n"; - echo "~";var_dump($current->textContent); + $title = ($current->nodeType != XML_TEXT_NODE && $current->hasAttribute('title')) ? $current->getAttribute('title'):"no title"; + echo "Course: $title:";echo(get_class($current)), "\n"; + echo "~";var_dump($current->textContent); } $dom = new DOMDocument(); @@ -41,10 +41,10 @@ $root = $dom->documentElement; $children = $root->childNodes; $len = $children->length; for ($index = $children->length - 1; $index >=0; $index--) { - $current = $children->item($index); - if ($current->nodeType == XML_TEXT_NODE) { - $noderemoved = $root->removeChild($current); - } + $current = $children->item($index); + if ($current->nodeType == XML_TEXT_NODE) { + $noderemoved = $root->removeChild($current); + } } echo "Start cloneNode test\n"; @@ -68,8 +68,8 @@ $root->appendChild($cloned_first_course_false); $children = $root->childNodes; for ($index = 0; $index < $children->length; $index++) { - echo "node $index\n"; - dumpcourse($children->item($index)); + echo "node $index\n"; + dumpcourse($children->item($index)); } --EXPECT-- Start cloneNode test diff --git a/ext/dom/tests/DOMNode_getLineNo_basic.phpt b/ext/dom/tests/DOMNode_getLineNo_basic.phpt index 655b751355..79d3c5a700 100644 --- a/ext/dom/tests/DOMNode_getLineNo_basic.phpt +++ b/ext/dom/tests/DOMNode_getLineNo_basic.phpt @@ -11,7 +11,7 @@ $doc = new DOMDocument(); $doc->load($file); $nodes = $doc->getElementsByTagName('title'); foreach($nodes as $node) { - var_dump($node->getLineNo()); + var_dump($node->getLineNo()); } ?> --EXPECT-- diff --git a/ext/dom/tests/DOMNode_getNodePath_basic.phpt b/ext/dom/tests/DOMNode_getNodePath_basic.phpt index c490e0941f..9e791939ae 100644 --- a/ext/dom/tests/DOMNode_getNodePath_basic.phpt +++ b/ext/dom/tests/DOMNode_getNodePath_basic.phpt @@ -11,7 +11,7 @@ $doc = new DOMDocument(); $doc->load($file); $nodes = $doc->getElementsByTagName('title'); foreach($nodes as $node) { - var_dump($node->getNodePath()); + var_dump($node->getNodePath()); } ?> --EXPECT-- diff --git a/ext/dom/tests/DOMNode_insertBefore_error1.phpt b/ext/dom/tests/DOMNode_insertBefore_error1.phpt index 72c1a5ba5c..4ce2ecb843 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error1.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error1.phpt @@ -14,9 +14,9 @@ $node_in_doc1 = $doc1->createElement("foo"); $node_in_doc2 = $doc2->createElement("bar"); try { - $node_in_doc2->insertBefore($node_in_doc1); + $node_in_doc2->insertBefore($node_in_doc1); } catch(DOMException $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/dom/tests/DOMNode_insertBefore_error2.phpt b/ext/dom/tests/DOMNode_insertBefore_error2.phpt index e951cd237a..39d461096f 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error2.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error2.phpt @@ -30,7 +30,7 @@ $ref_node = $dom->getElementsByTagName("book")->item(1); try { $parent_node->insertBefore($new_node, $ref_node); } catch(DOMException $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/dom/tests/DOMNode_insertBefore_error3.phpt b/ext/dom/tests/DOMNode_insertBefore_error3.phpt index 6e5137798c..bf323a2d48 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error3.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error3.phpt @@ -31,7 +31,7 @@ assert(!is_null($ref_node)); try { $parent_node->insertBefore($new_node, $ref_node); } catch(DOMException $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/dom/tests/DOMNode_insertBefore_error4.phpt b/ext/dom/tests/DOMNode_insertBefore_error4.phpt index 84fbcd82dd..4b20a6d804 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error4.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error4.phpt @@ -30,7 +30,7 @@ $ref_node = $dom->createElement('newnode2'); try { $parent_node->insertBefore($new_node, $ref_node); } catch(DOMException $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/dom/tests/DOMNode_insertBefore_error5.phpt b/ext/dom/tests/DOMNode_insertBefore_error5.phpt index e9dac3a459..e50dffcb44 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error5.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error5.phpt @@ -32,7 +32,7 @@ $dom->saveXML(); try { $parent_node->insertBefore($new_node, $ref_node); } catch(DOMException $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/dom/tests/DOMNode_insertBefore_error6.phpt b/ext/dom/tests/DOMNode_insertBefore_error6.phpt index 6027d44140..bc026f5ccb 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error6.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error6.phpt @@ -27,7 +27,7 @@ assert($new_node !== false); try { $parent_node->insertBefore($new_node, $ref_node); } catch(DOMException $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/dom/tests/DOMNode_issamenode_basic.phpt b/ext/dom/tests/DOMNode_issamenode_basic.phpt index f0bbff1c04..6dff0977b3 100644 --- a/ext/dom/tests/DOMNode_issamenode_basic.phpt +++ b/ext/dom/tests/DOMNode_issamenode_basic.phpt @@ -18,16 +18,16 @@ if(!$dom) { $node = $dom->documentElement; if($node->isSameNode($node)) - echo "EXPECTING SAME NODE, PASSED\n" ; + echo "EXPECTING SAME NODE, PASSED\n" ; else - echo "EXPECTING SAME NODE, FAILED\n" ; + echo "EXPECTING SAME NODE, FAILED\n" ; $nodelist=$dom->getElementsByTagName('tbody') ; if($nodelist->item(0)->isSameNode($node)) - echo "EXPECTING NOT SAME NODE, FAILED\n" ; + echo "EXPECTING NOT SAME NODE, FAILED\n" ; else - echo "EXPECTING NOT SAME NODE, PASSED\n" ; + echo "EXPECTING NOT SAME NODE, PASSED\n" ; ?> --EXPECT-- diff --git a/ext/dom/tests/DOMNode_removeChild_basic.phpt b/ext/dom/tests/DOMNode_removeChild_basic.phpt index 8dcecb52c8..e9c3e13a81 100644 --- a/ext/dom/tests/DOMNode_removeChild_basic.phpt +++ b/ext/dom/tests/DOMNode_removeChild_basic.phpt @@ -28,9 +28,9 @@ $xml = <<< EOXML EOXML; function dumpcourse($current) { - $title = ($current->nodeType != XML_TEXT_NODE && $current->hasAttribute('title')) ? $current->getAttribute('title'):"no title"; - echo "Course: $title:";echo get_class($current), "\n"; - echo "~";var_dump($current->textContent); + $title = ($current->nodeType != XML_TEXT_NODE && $current->hasAttribute('title')) ? $current->getAttribute('title'):"no title"; + echo "Course: $title:";echo get_class($current), "\n"; + echo "~";var_dump($current->textContent); } $dom = new DOMDocument(); @@ -41,20 +41,20 @@ $children = $root->childNodes; $len = $children->length; echo "original has $len nodes\n"; for ($index = $children->length - 1; $index >=0; $index--) { - echo "node $index\n"; - $current = $children->item($index); - dumpcourse($current); - if ($current->nodeType == XML_TEXT_NODE) { - $noderemoved = $root->removeChild($current); - } + echo "node $index\n"; + $current = $children->item($index); + dumpcourse($current); + if ($current->nodeType == XML_TEXT_NODE) { + $noderemoved = $root->removeChild($current); + } } $children = $root->childNodes; $len = $children->length; echo "after text removed it now has $len nodes\n"; for ($index = 0; $index < $children->length; $index++) { - echo "node $index\n"; - $current = $children->item($index); - dumpcourse($current); + echo "node $index\n"; + $current = $children->item($index); + dumpcourse($current); } --EXPECT-- original has 5 nodes diff --git a/ext/dom/tests/bug28817.phpt b/ext/dom/tests/bug28817.phpt index 50d81b1aa7..6d1d12a538 100644 --- a/ext/dom/tests/bug28817.phpt +++ b/ext/dom/tests/bug28817.phpt @@ -6,18 +6,18 @@ Bug #28817 (properties in extended class) <?php class z extends domDocument{ - /** variable can have name */ - public $p_array; - public $p_variable; + /** variable can have name */ + public $p_array; + public $p_variable; - function __construct(){ - $this->p_array[] = 'bonus'; - $this->p_array[] = 'vir'; - $this->p_array[] = 'semper'; - $this->p_array[] = 'tiro'; + function __construct(){ + $this->p_array[] = 'bonus'; + $this->p_array[] = 'vir'; + $this->p_array[] = 'semper'; + $this->p_array[] = 'tiro'; - $this->p_variable = 'Cessante causa cessat effectus'; - } + $this->p_variable = 'Cessante causa cessat effectus'; + } } $z=new z(); diff --git a/ext/dom/tests/bug34276.phpt b/ext/dom/tests/bug34276.phpt index 6959d90a92..54c832033d 100644 --- a/ext/dom/tests/bug34276.phpt +++ b/ext/dom/tests/bug34276.phpt @@ -11,10 +11,10 @@ $xml = <<<HERE HERE; function dump($elems) { - foreach ($elems as $elem) { - var_dump($elem->nodeName); - dump($elem->childNodes); - } + foreach ($elems as $elem) { + var_dump($elem->nodeName); + dump($elem->childNodes); + } } $dom = new DOMDocument(); diff --git a/ext/dom/tests/bug38474.phpt b/ext/dom/tests/bug38474.phpt index 9c694c432e..6e30d0988d 100644 --- a/ext/dom/tests/bug38474.phpt +++ b/ext/dom/tests/bug38474.phpt @@ -9,7 +9,7 @@ if (version_compare(LIBXML_DOTTED_VERSION, "2.6.20", "<")) { ?> --FILE-- <?php -$xml = '<node xmlns:pre="http://foo.com/tr/pre" +$xml = '<node xmlns:pre="http://foo.com/tr/pre" xmlns:post="http://foo.com/tr/post" pre:type="bar" type="foo" ><sub /></node>'; $dom = new DomDocument(); diff --git a/ext/dom/tests/bug67081.phpt b/ext/dom/tests/bug67081.phpt index e9156f770e..b541df1b41 100644 --- a/ext/dom/tests/bug67081.phpt +++ b/ext/dom/tests/bug67081.phpt @@ -6,25 +6,25 @@ require_once('skipif.inc'); ?> --FILE-- <?php - $domDocument = new DOMDocument(); - $domDocument->substituteEntities = true; - $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_0.xml"); - var_dump($domDocument->doctype->internalSubset); + $domDocument = new DOMDocument(); + $domDocument->substituteEntities = true; + $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_0.xml"); + var_dump($domDocument->doctype->internalSubset); - $domDocument = new DOMDocument(); - $domDocument->substituteEntities = true; - $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_1.xml"); - var_dump($domDocument->doctype->internalSubset); + $domDocument = new DOMDocument(); + $domDocument->substituteEntities = true; + $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_1.xml"); + var_dump($domDocument->doctype->internalSubset); - $domDocument = new DOMDocument(); - $domDocument->substituteEntities = true; - $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_2.xml"); - var_dump($domDocument->doctype->internalSubset); + $domDocument = new DOMDocument(); + $domDocument->substituteEntities = true; + $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_2.xml"); + var_dump($domDocument->doctype->internalSubset); - $domDocument = new DOMDocument(); - $domDocument->substituteEntities = true; - $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "dom.xml"); - var_dump($domDocument->doctype->internalSubset); + $domDocument = new DOMDocument(); + $domDocument->substituteEntities = true; + $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "dom.xml"); + var_dump($domDocument->doctype->internalSubset); ?> --EXPECT-- string(19) "<!ELEMENT a EMPTY> diff --git a/ext/dom/tests/bug69373.phpt b/ext/dom/tests/bug69373.phpt index ce4510082e..4cb929d1ca 100644 --- a/ext/dom/tests/bug69373.phpt +++ b/ext/dom/tests/bug69373.phpt @@ -6,10 +6,10 @@ Bug #69373 References to deleted XPath query results <?php $doc = new DOMDocument(); for( $i=0; $i<20; $i++ ) { - $doc->loadXML("<parent><child /><child /></parent>"); - $xpath = new DOMXpath($doc); - $all = $xpath->query('//*'); - $doc->firstChild->nodeValue = ''; + $doc->loadXML("<parent><child /><child /></parent>"); + $xpath = new DOMXpath($doc); + $all = $xpath->query('//*'); + $doc->firstChild->nodeValue = ''; } echo 'DONE', PHP_EOL; ?> diff --git a/ext/dom/tests/bug70558.phpt b/ext/dom/tests/bug70558.phpt index c2d53d893d..9ad8fa0596 100644 --- a/ext/dom/tests/bug70558.phpt +++ b/ext/dom/tests/bug70558.phpt @@ -7,9 +7,9 @@ Bug #70558 ("Couldn't fetch" error in DOMDocument::registerNodeClass()) class X extends \DOMDocument { - public function __clone() { - var_dump($this->registerNodeClass('DOMDocument', 'X')); - } + public function __clone() { + var_dump($this->registerNodeClass('DOMDocument', 'X')); + } } $dom = clone (new X()); diff --git a/ext/dom/tests/bug75451.phpt b/ext/dom/tests/bug75451.phpt index dae7cde98b..a34915bb17 100644 --- a/ext/dom/tests/bug75451.phpt +++ b/ext/dom/tests/bug75451.phpt @@ -10,7 +10,7 @@ $dom = new DOMDocument(); $dom->loadXML('<root><child/></root>'); $xpath = new DOMXpath($dom); foreach($xpath->query('/root/noexist') as $child) { - var_dump($child); + var_dump($child); } ?> okey diff --git a/ext/dom/tests/dom002.phpt b/ext/dom/tests/dom002.phpt index 3343a1774e..044e5eab1c 100644 --- a/ext/dom/tests/dom002.phpt +++ b/ext/dom/tests/dom002.phpt @@ -16,10 +16,10 @@ $xml = <<<HERE HERE; function dump($elems) { - foreach ($elems as $elem) { - var_dump($elem->nodeName); - dump($elem->childNodes); - } + foreach ($elems as $elem) { + var_dump($elem->nodeName); + dump($elem->childNodes); + } } $dom = new DOMDocument(); diff --git a/ext/dom/tests/dom003.phpt b/ext/dom/tests/dom003.phpt index 05d23cd792..20db09d40e 100644 --- a/ext/dom/tests/dom003.phpt +++ b/ext/dom/tests/dom003.phpt @@ -12,11 +12,11 @@ print "--- Catch exception with try/catch\n"; try { $rootNode->appendChild($rootNode); } catch (domexception $e) { - ob_start(); + ob_start(); var_dump($e); - $contents = ob_get_contents(); - ob_end_clean(); - echo preg_replace('/object\(DOMElement\).+\{.*?\}/s', 'DOMElement', $contents); + $contents = ob_get_contents(); + ob_end_clean(); + echo preg_replace('/object\(DOMElement\).+\{.*?\}/s', 'DOMElement', $contents); } print "--- Don't catch exception with try/catch\n"; $rootNode->appendChild($rootNode); diff --git a/ext/dom/tests/dom007.phpt b/ext/dom/tests/dom007.phpt index b0062e8e4a..2ed232a3c0 100644 --- a/ext/dom/tests/dom007.phpt +++ b/ext/dom/tests/dom007.phpt @@ -47,11 +47,11 @@ $length = $nots->length; echo "Length: ".$length."\n"; foreach ($nots AS $key=>$node) { - echo "Key $key: ".$node->nodeName." (".$node->systemId.") (".$node->publicId.")\n"; + echo "Key $key: ".$node->nodeName." (".$node->systemId.") (".$node->publicId.")\n"; } print "\n"; for($x=0; $x < $length; $x++) { - echo "Index $x: ".$nots->item($x)->nodeName." (".$nots->item($x)->systemId.") (".$nots->item($x)->publicId.")\n"; + echo "Index $x: ".$nots->item($x)->nodeName." (".$nots->item($x)->systemId.") (".$nots->item($x)->publicId.")\n"; } echo "\n"; @@ -66,21 +66,21 @@ echo "Length: ".$length."\n"; $xkeys = array(); foreach ($ents AS $key=>$node) { - $xkeys[] = "Key: $key Name: ".$node->nodeName."\n"; + $xkeys[] = "Key: $key Name: ".$node->nodeName."\n"; } sort($xkeys); // fix inconsistent output ordering (bug #61810) foreach ($xkeys as $key => $node) { - echo $node; + echo $node; } echo "\n"; $xkeys = array(); for($x=0; $x < $length; $x++) { - $xkeys[] = "Index: ".$ents->item($x)->nodeName."\n"; + $xkeys[] = "Index: ".$ents->item($x)->nodeName."\n"; } sort($xkeys); // fix inconsistent output ordering (bug #61810) foreach ($xkeys as $key => $node) { - echo $node; + echo $node; } echo "\n"; diff --git a/ext/dom/tests/dom_comment_basic.phpt b/ext/dom/tests/dom_comment_basic.phpt index 7c436a747a..4533fcc6e2 100644 --- a/ext/dom/tests/dom_comment_basic.phpt +++ b/ext/dom/tests/dom_comment_basic.phpt @@ -21,10 +21,10 @@ var_dump($root->hasChildNodes()); $children = $root->childNodes; for ($index = 0; $index < $children->length; $index++) { - echo "--- child $index ---\n"; - $current = $children->item($index); - echo get_class($current), "\n"; - var_dump($current->textContent); + echo "--- child $index ---\n"; + $current = $children->item($index); + echo get_class($current), "\n"; + var_dump($current->textContent); } --EXPECT-- bool(true) diff --git a/ext/dom/tests/dom_comment_variation.phpt b/ext/dom/tests/dom_comment_variation.phpt index 8982f34abe..713c6a73cb 100644 --- a/ext/dom/tests/dom_comment_variation.phpt +++ b/ext/dom/tests/dom_comment_variation.phpt @@ -18,10 +18,10 @@ var_dump($root->hasChildNodes()); $children = $root->childNodes; for ($index = 0; $index < $children->length; $index++) { - echo "--- child $index ---\n"; - $current = $children->item($index); - echo get_class($current), "\n"; - var_dump($current->textContent); + echo "--- child $index ---\n"; + $current = $children->item($index); + echo get_class($current), "\n"; + var_dump($current->textContent); } --EXPECT-- bool(true) diff --git a/ext/dom/tests/dom_set_attr_node.phpt b/ext/dom/tests/dom_set_attr_node.phpt index 677dfa5e70..6160cd48f2 100644 --- a/ext/dom/tests/dom_set_attr_node.phpt +++ b/ext/dom/tests/dom_set_attr_node.phpt @@ -24,13 +24,13 @@ $dom2 = new DOMDocument(); $dom2->loadXML($xml2); $root2 = $dom2->documentElement; try { - $root2->setAttributeNode($attr); + $root2->setAttributeNode($attr); } catch (domexception $e) { ob_start(); - var_dump($e); - $contents = ob_get_contents(); - ob_end_clean(); - echo preg_replace('/object\(DOMAttr\).+\{.*?\}/s', 'DOMAttr', $contents); + var_dump($e); + $contents = ob_get_contents(); + ob_end_clean(); + echo preg_replace('/object\(DOMAttr\).+\{.*?\}/s', 'DOMAttr', $contents); } ?> diff --git a/ext/dom/tests/dom_xinclude.phpt b/ext/dom/tests/dom_xinclude.phpt index a698895c60..2f4bbf3e1a 100644 --- a/ext/dom/tests/dom_xinclude.phpt +++ b/ext/dom/tests/dom_xinclude.phpt @@ -12,7 +12,7 @@ $dom = new domdocument; $data = file_get_contents(__DIR__."/xinclude.xml"); $reldir = str_replace(getcwd(),".",__DIR__); if (DIRECTORY_SEPARATOR == '\\') { - $reldir = str_replace('\\',"/", $reldir); + $reldir = str_replace('\\',"/", $reldir); } $data = str_replace('compress.zlib://ext/dom/tests/','compress.zlib://'.$reldir."/", $data); @@ -21,7 +21,7 @@ $dom->loadXML($data); $dom->xinclude(); print $dom->saveXML()."\n"; foreach ($dom->documentElement->childNodes as $node) { - print $node->nodeName."\n"; + print $node->nodeName."\n"; } ?> --EXPECTF-- diff --git a/ext/dom/tests/domdocument_createentityreference_001.phpt b/ext/dom/tests/domdocument_createentityreference_001.phpt index 63a352dad1..b168ad9093 100644 --- a/ext/dom/tests/domdocument_createentityreference_001.phpt +++ b/ext/dom/tests/domdocument_createentityreference_001.phpt @@ -6,10 +6,10 @@ Clint Priest @ PhpTek09 <?php require_once('skipif.inc'); ?> --FILE-- <?php - $objDoc = new DomDocument(); + $objDoc = new DomDocument(); - $objRef = $objDoc->createEntityReference('Test'); - echo $objRef->nodeName . "\n"; + $objRef = $objDoc->createEntityReference('Test'); + echo $objRef->nodeName . "\n"; ?> --EXPECT-- Test diff --git a/ext/dom/tests/domelement.phpt b/ext/dom/tests/domelement.phpt index 43a6e98603..2b669f29c8 100644 --- a/ext/dom/tests/domelement.phpt +++ b/ext/dom/tests/domelement.phpt @@ -67,9 +67,9 @@ $node->setAttribute('idatt', 'n1'); $node->setIdAttribute('idatt', TRUE); for ($x = 0; $x < $mylen; $x++) { - $current = $myelements->item($x); - $current->setAttributeNS('urn::dummyns', 'newns:idatt', 'n'.($x+2))."\n"; - $current->setIdAttributeNS('urn::dummyns', 'idatt', TRUE); + $current = $myelements->item($x); + $current->setAttributeNS('urn::dummyns', 'newns:idatt', 'n'.($x+2))."\n"; + $current->setIdAttributeNS('urn::dummyns', 'idatt', TRUE); } echo 'Element Name: '.(($elem = $dom->getElementByID('n1'))?$elem->localName:'Not Found')."\n"; @@ -79,8 +79,8 @@ echo 'Element Name: '.(($elem = $dom->getElementByID('n1'))?$elem->localName:'No echo 'Element Name: '.(($elem = $dom->getElementByID('n3'))?$elem->nodeName:'Not Found')."\n"; for ($x = 0; $x < $mylen; $x++) { - $node = $myelements->item($x); - $node->setIdAttributeNS('urn::dummyns', 'idatt', FALSE); + $node = $myelements->item($x); + $node->setIdAttributeNS('urn::dummyns', 'idatt', FALSE); } echo 'Element Name: '.(($elem = $dom->getElementByID('n3'))?$elem->nodeName:'Not Found')."\n"; ?> diff --git a/ext/dom/tests/domxpath.phpt b/ext/dom/tests/domxpath.phpt index da91142ef5..f67b2584aa 100644 --- a/ext/dom/tests/domxpath.phpt +++ b/ext/dom/tests/domxpath.phpt @@ -7,17 +7,17 @@ DOMXPath Tests require_once("dom_test.inc"); function MyAverage($nodelist) { - $count = 0; - $val = 0; - foreach ($nodelist AS $node) { - $count++; - $val += $node->textContent; - } - if ($val > 0) { - return $val/$count; - } else { - return 0; - } + $count = 0; + $val = 0; + foreach ($nodelist AS $node) { + $count++; + $val += $node->textContent; + } + if ($val > 0) { + return $val/$count; + } else { + return 0; + } } $dom = new DOMDocument; @@ -31,7 +31,7 @@ $xpath->registerNamespace("php", "http://php.net/xpath"); $xpath->registerNamespace("def", "urn::default"); $nodelist = $xpath->query("//def:child"); if ($node = $nodelist->item(0)) { - print $node->textContent."\n"; + print $node->textContent."\n"; } $count = $xpath->evaluate("count(//def:child)"); diff --git a/ext/enchant/tests/broker_describe.phpt b/ext/enchant/tests/broker_describe.phpt index a25a77bd8e..11adb1397d 100644 --- a/ext/enchant/tests/broker_describe.phpt +++ b/ext/enchant/tests/broker_describe.phpt @@ -36,13 +36,13 @@ if($broker) { if (is_array($provider)) { echo("OK\n"); - if ((isset($provider[$counter]['name']) && isset($provider[$counter]['desc']) && isset($provider[$counter]['file']))) { - echo("OK\n"); + if ((isset($provider[$counter]['name']) && isset($provider[$counter]['desc']) && isset($provider[$counter]['file']))) { + echo("OK\n"); - } else { - echo("failed, broker describe\n"); + } else { + echo("failed, broker describe\n"); - } + } } else { echo "failed, brocker describe array \n"; } diff --git a/ext/enchant/tests/bug13181.phpt b/ext/enchant/tests/bug13181.phpt index 742e0c79fe..881318cb33 100644 --- a/ext/enchant/tests/bug13181.phpt +++ b/ext/enchant/tests/bug13181.phpt @@ -26,8 +26,8 @@ enchant_broker_free($broker); <?php function get_dictionnary() { $rBroker = enchant_broker_init(); - $t = enchant_broker_request_dict($rBroker, 'en'); - var_dump($t); + $t = enchant_broker_request_dict($rBroker, 'en'); + var_dump($t); return $t; } $rDict = get_dictionnary(); @@ -36,7 +36,7 @@ enchant_dict_suggest($rDict, "soong"); function get_broker() { $t = enchant_broker_init(); - var_dump($t); + var_dump($t); return $t; } @@ -44,8 +44,8 @@ $rbroker = get_broker(); var_dump($rbroker); function get_dict($broker) { - $t = enchant_broker_request_dict($broker, 'en'); - var_dump($t); + $t = enchant_broker_request_dict($broker, 'en'); + var_dump($t); return $t; } $rDict = get_dict($rbroker); diff --git a/ext/enchant/tests/dict_add_to_personal.phpt b/ext/enchant/tests/dict_add_to_personal.phpt index 9afcab0cfa..522ae8a2d1 100644 --- a/ext/enchant/tests/dict_add_to_personal.phpt +++ b/ext/enchant/tests/dict_add_to_personal.phpt @@ -30,7 +30,7 @@ if (is_resource($broker)) { } } else { - echo("broker request dict failed\n"); + echo("broker request dict failed\n"); } diff --git a/ext/enchant/tests/dict_check.phpt b/ext/enchant/tests/dict_check.phpt index 283dfa4707..b48ed47584 100644 --- a/ext/enchant/tests/dict_check.phpt +++ b/ext/enchant/tests/dict_check.phpt @@ -30,7 +30,7 @@ if (is_resource($broker)) { } } else { - echo("broker request dict failed\n"); + echo("broker request dict failed\n"); } diff --git a/ext/enchant/tests/dict_suggest.phpt b/ext/enchant/tests/dict_suggest.phpt index 1ba7decbb5..6854eeb65b 100644 --- a/ext/enchant/tests/dict_suggest.phpt +++ b/ext/enchant/tests/dict_suggest.phpt @@ -19,7 +19,7 @@ if (is_resource($broker)) { $requestDict = enchant_broker_request_dict($broker, $dicts[0]['lang_tag']); if ($requestDict) { - echo("OK\n"); + echo("OK\n"); $dictSuggest = enchant_dict_suggest($requestDict,$sugs); if (is_array($dictSuggest)) { @@ -29,7 +29,7 @@ if (is_resource($broker)) { } } else { - echo("broker request dict failed\n"); + echo("broker request dict failed\n"); } diff --git a/ext/exif/tests/bug64739.phpt b/ext/exif/tests/bug64739.phpt index de97e0db3c..b423e6501e 100644 --- a/ext/exif/tests/bug64739.phpt +++ b/ext/exif/tests/bug64739.phpt @@ -12,8 +12,8 @@ echo "Test\n"; $headers1 = exif_read_data(__DIR__ . '/bug64739.jpg'); if ($headers1 === false) { - echo 'Error, failed to read exif data'; - exit; + echo 'Error, failed to read exif data'; + exit; } var_dump($headers1['Title'][0] === '?'); @@ -24,8 +24,8 @@ ini_set('exif.decode_unicode_motorola', 'UCS-2LE'); $headers2 = exif_read_data(__DIR__ . '/bug64739.jpg'); if ($headers2 === false) { - echo 'Error, failed to read exif data'; - exit; + echo 'Error, failed to read exif data'; + exit; } var_dump($headers2['Title']); diff --git a/ext/exif/tests/bug72627.phpt b/ext/exif/tests/bug72627.phpt index bb6a1fae99..ad363d8dd6 100644 --- a/ext/exif/tests/bug72627.phpt +++ b/ext/exif/tests/bug72627.phpt @@ -4,8 +4,8 @@ Bug #72627 (Memory Leakage In exif_process_IFD_in_TIFF) <?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> --FILE-- <?php - $exif = exif_read_data(__DIR__ . '/bug72627.tiff',0,0,true); - var_dump($exif); + $exif = exif_read_data(__DIR__ . '/bug72627.tiff',0,0,true); + var_dump($exif); ?> --EXPECTF-- Warning: exif_read_data(%s): Thumbnail goes IFD boundary or end of file reached in %sbug72627.php on line %d diff --git a/ext/exif/tests/bug72735/bug72682.phpt b/ext/exif/tests/bug72735/bug72682.phpt index 42a80b2eea..cc3faaa101 100644 --- a/ext/exif/tests/bug72735/bug72682.phpt +++ b/ext/exif/tests/bug72735/bug72682.phpt @@ -5,10 +5,10 @@ Bug #72735 MakerNote regression --FILE-- <?php foreach (['nokia.jpg', 'samsung.jpg', 'panasonic.jpg'] as $picture) { - echo $picture . ': '; + echo $picture . ': '; - $info = exif_read_data(__DIR__ . DIRECTORY_SEPARATOR . $picture); - var_dump($info['MakerNote']); + $info = exif_read_data(__DIR__ . DIRECTORY_SEPARATOR . $picture); + var_dump($info['MakerNote']); } ?> --EXPECT-- diff --git a/ext/exif/tests/bug72735/bug72735.phpt b/ext/exif/tests/bug72735/bug72735.phpt index 082f3e6153..1efd4ba457 100644 --- a/ext/exif/tests/bug72735/bug72735.phpt +++ b/ext/exif/tests/bug72735/bug72735.phpt @@ -5,17 +5,17 @@ Bug #72735 (Samsung picture thumb not read (zero size)) --FILE-- <?php foreach (['nokia.jpg', 'samsung.jpg', 'panasonic.jpg'] as $picture) { - echo $picture . ': '; + echo $picture . ': '; - $len = strlen(exif_thumbnail(__DIR__ . DIRECTORY_SEPARATOR . $picture)); + $len = strlen(exif_thumbnail(__DIR__ . DIRECTORY_SEPARATOR . $picture)); - if (!$len) { - echo 'Error, no length returned', PHP_EOL; + if (!$len) { + echo 'Error, no length returned', PHP_EOL; - continue; - } + continue; + } - echo 'int(' . $len . ')', PHP_EOL; + echo 'int(' . $len . ')', PHP_EOL; } ?> --EXPECT-- diff --git a/ext/exif/tests/bug73737.phpt b/ext/exif/tests/bug73737.phpt index a37b3c9583..a46020f468 100644 --- a/ext/exif/tests/bug73737.phpt +++ b/ext/exif/tests/bug73737.phpt @@ -4,8 +4,8 @@ Bug #73737 (Crash when parsing a tag format) <?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> --FILE-- <?php - $exif = exif_thumbnail(__DIR__ . '/bug73737.tiff'); - var_dump($exif); + $exif = exif_thumbnail(__DIR__ . '/bug73737.tiff'); + var_dump($exif); ?> --EXPECTF-- Warning: exif_thumbnail(bug73737.tiff): Process tag(x0100=ImageWidth): Cannot be empty in %s on line %d diff --git a/ext/exif/tests/sony.phpt b/ext/exif/tests/sony.phpt index 8c2bf7c58c..0111a82e1f 100644 --- a/ext/exif/tests/sony.phpt +++ b/ext/exif/tests/sony.phpt @@ -7,14 +7,14 @@ Sony test $data = exif_read_data(__DIR__ . DIRECTORY_SEPARATOR . 'sony.jpg'); if (!$data) { - exit('Error: Unable to parse EXIF data'); + exit('Error: Unable to parse EXIF data'); } // Perhaps we should just test for SonyModelID since it seems to be // the most specific tag name that should be found in any Sony generated // picture foreach (['SonyModelID', 'Panorama', 'AntiBlur'] as $sony_tag) { - printf('%s was %sfound' . PHP_EOL, $sony_tag, (!isset($data[$sony_tag]) ? 'NOT ' : '')); + printf('%s was %sfound' . PHP_EOL, $sony_tag, (!isset($data[$sony_tag]) ? 'NOT ' : '')); } ?> --EXPECT-- diff --git a/ext/ffi/tests/002.phpt b/ext/ffi/tests/002.phpt index 62cb9182c4..353f36139c 100644 --- a/ext/ffi/tests/002.phpt +++ b/ext/ffi/tests/002.phpt @@ -14,117 +14,117 @@ echo " ok\n"; echo "Various declarations\n"; $ffi = FFI::cdef(<<<EOF - /* allowed storage classes */ - typedef int type1; + /* allowed storage classes */ + typedef int type1; // extern int var2; - static int var3; - auto int var4; - register int var5; + static int var3; + auto int var4; + register int var5; - /* allowed types */ - typedef void type6; - typedef char type7; /* sint8_t or uint8_t */ - typedef signed char type8; /* sint8_t */ - typedef unsigned char type9; /* uint8_t */ - typedef short type10; /* sint16_t */ - typedef signed short type11; /* sint16_t */ - typedef short int type12; /* sint16_t */ - typedef signed short int type13; /* sint16_t */ - typedef unsigned short type14; /* uint16_t */ - typedef unsigned short int type15; /* uint16_t */ - typedef int type16; /* sint32_t */ - typedef signed type17; /* sint32_t */ - typedef signed int type18; /* sint32_t */ - typedef unsigned type19; /* uint32_t */ - typedef unsigned int type20; /* uint32_t */ - typedef long type21; /* sint32_t or sint64_t */ - typedef signed long type22; /* sint32_t or sint64_t */ - typedef long int type23; /* sint32_t or sint64_t */ - typedef signed long int type24; /* sint32_t or sint64_t */ - typedef unsigned long type25; /* uint32_t or uint64_t */ - typedef unsigned long int type25_2; /* uint32_t or uint64_t */ - typedef long long type26; /* sint64_t */ - typedef signed long long type27; /* sint64_t */ - typedef long long int type28; /* sint64_t */ - typedef signed long long int type29; /* sint64_t */ - typedef unsigned long long type30; /* uint64_t */ - typedef unsigned long long int type31; /* uint64_t */ - typedef float type32; - typedef double type33; - typedef long double type34; - typedef _Bool type35; + /* allowed types */ + typedef void type6; + typedef char type7; /* sint8_t or uint8_t */ + typedef signed char type8; /* sint8_t */ + typedef unsigned char type9; /* uint8_t */ + typedef short type10; /* sint16_t */ + typedef signed short type11; /* sint16_t */ + typedef short int type12; /* sint16_t */ + typedef signed short int type13; /* sint16_t */ + typedef unsigned short type14; /* uint16_t */ + typedef unsigned short int type15; /* uint16_t */ + typedef int type16; /* sint32_t */ + typedef signed type17; /* sint32_t */ + typedef signed int type18; /* sint32_t */ + typedef unsigned type19; /* uint32_t */ + typedef unsigned int type20; /* uint32_t */ + typedef long type21; /* sint32_t or sint64_t */ + typedef signed long type22; /* sint32_t or sint64_t */ + typedef long int type23; /* sint32_t or sint64_t */ + typedef signed long int type24; /* sint32_t or sint64_t */ + typedef unsigned long type25; /* uint32_t or uint64_t */ + typedef unsigned long int type25_2; /* uint32_t or uint64_t */ + typedef long long type26; /* sint64_t */ + typedef signed long long type27; /* sint64_t */ + typedef long long int type28; /* sint64_t */ + typedef signed long long int type29; /* sint64_t */ + typedef unsigned long long type30; /* uint64_t */ + typedef unsigned long long int type31; /* uint64_t */ + typedef float type32; + typedef double type33; + typedef long double type34; + typedef _Bool type35; // typedef float _Complex type36; // typedef double _Complex type36_2; // typedef long double _Complex type36_3; - /* struct and union */ - struct tag1; - union tag2; - typedef struct tag1 {int x; int y;} type37; - typedef union tag2 {int x; int y;} type38; - typedef struct {int x, y; int z;} type39; - typedef struct {unsigned int x:8, y:8;} type40; - typedef struct {unsigned int x:8, :8, y:8;} type41; + /* struct and union */ + struct tag1; + union tag2; + typedef struct tag1 {int x; int y;} type37; + typedef union tag2 {int x; int y;} type38; + typedef struct {int x, y; int z;} type39; + typedef struct {unsigned int x:8, y:8;} type40; + typedef struct {unsigned int x:8, :8, y:8;} type41; - /* enum */ - enum tag3; - typedef enum tag3 {A,B,C} type42; - typedef enum {D,E=10,F,} type43; + /* enum */ + enum tag3; + typedef enum tag3 {A,B,C} type42; + typedef enum {D,E=10,F,} type43; - /* type qualifiers */ - typedef void* type46; - typedef const void* type47; - typedef restrict void* type48; - typedef volatile void* type49; - typedef _Atomic void* type50; - typedef const volatile void* type51; + /* type qualifiers */ + typedef void* type46; + typedef const void* type47; + typedef restrict void* type48; + typedef volatile void* type49; + typedef _Atomic void* type50; + typedef const volatile void* type51; - /* function specifiers */ - static void f1(); - static inline void f2(); - static _Noreturn void f3(); + /* function specifiers */ + static void f1(); + static inline void f2(); + static _Noreturn void f3(); - /* align specifier */ - typedef double _Alignas(char) type52; - typedef double _Alignas(1) type53; + /* align specifier */ + typedef double _Alignas(char) type52; + typedef double _Alignas(1) type53; - /* pointers */ - typedef void * type54; - typedef void ** type55; - typedef const void * const volatile * const type56; + /* pointers */ + typedef void * type54; + typedef void ** type55; + typedef const void * const volatile * const type56; - /* arrays */ - typedef char type57[]; - typedef char type58[const]; - typedef char type59[const volatile]; - typedef char type60[10]; - typedef char type61[const 10]; - typedef char type62[static 10]; - typedef char type63[static const volatile 10]; - typedef char type64[const volatile static 10]; - typedef char type65[]; - typedef char type66[const volatile]; - typedef char type67[10][10]; + /* arrays */ + typedef char type57[]; + typedef char type58[const]; + typedef char type59[const volatile]; + typedef char type60[10]; + typedef char type61[const 10]; + typedef char type62[static 10]; + typedef char type63[static const volatile 10]; + typedef char type64[const volatile static 10]; + typedef char type65[]; + typedef char type66[const volatile]; + typedef char type67[10][10]; - /* functions */ - static void f4(); - static void f5(void); - static void f6(int x); - static void f7(int x, int y); - static void f8(int x, int y, ...); - static void f9(int, int); - static void f9(int, int, ...); - static void f10(...); - static void f11(const char *name); - static void f12(const char *); - static void f13(const int a[5]); - static void f14(const int[5]); + /* functions */ + static void f4(); + static void f5(void); + static void f6(int x); + static void f7(int x, int y); + static void f8(int x, int y, ...); + static void f9(int, int); + static void f9(int, int, ...); + static void f10(...); + static void f11(const char *name); + static void f12(const char *); + static void f13(const int a[5]); + static void f14(const int[5]); - /* nested */ - typedef int *type69[4]; - typedef int (*type70)[4]; - typedef int (*type71[3])(int *x, int *y); - typedef int (*type72(int (*)(long), int))(int, ...); + /* nested */ + typedef int *type69[4]; + typedef int (*type70)[4]; + typedef int (*type71[3])(int *x, int *y); + typedef int (*type72(int (*)(long), int))(int, ...); EOF ); echo " ok\n"; diff --git a/ext/ffi/tests/003.phpt b/ext/ffi/tests/003.phpt index f1041bf460..efe88b31f3 100644 --- a/ext/ffi/tests/003.phpt +++ b/ext/ffi/tests/003.phpt @@ -30,14 +30,14 @@ var_dump($ffi->new("struct _b")); var_dump($ffi->new("c")); var_dump($ffi->new("d")); try { - var_dump($ffi->new("struct _e")); + var_dump($ffi->new("struct _e")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - var_dump($ffi->new("f")); + var_dump($ffi->new("f")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } echo "ok\n"; ?> diff --git a/ext/ffi/tests/004.phpt b/ext/ffi/tests/004.phpt index 7d265bfa68..f5ad02098c 100644 --- a/ext/ffi/tests/004.phpt +++ b/ext/ffi/tests/004.phpt @@ -25,10 +25,10 @@ enum _f; typedef enum _f f; enum _g { - _c1, - _c2, - _c3 = 1, - _c4, + _c1, + _c2, + _c3 = 1, + _c4, }; EOF ); @@ -40,14 +40,14 @@ var_dump($ffi->new("int[_c2]")); var_dump($ffi->new("int[_c3]")); var_dump($ffi->new("int[_c4]")); try { - var_dump($ffi->new("enum _e")); + var_dump($ffi->new("enum _e")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - var_dump($ffi->new("f")); + var_dump($ffi->new("f")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } echo "ok\n"; ?> diff --git a/ext/ffi/tests/008.phpt b/ext/ffi/tests/008.phpt index fa3991abee..602468d1e5 100644 --- a/ext/ffi/tests/008.phpt +++ b/ext/ffi/tests/008.phpt @@ -11,22 +11,22 @@ $a[1] = 10; $a[2] = 20; var_dump(count($a)); foreach ($a as $key => $val) { - echo "$key => $val\n"; + echo "$key => $val\n"; } $a = FFI::new("struct {int x,y;}"); try { - var_dump(count($a)); + var_dump(count($a)); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - foreach ($a as $key => $val) { - echo "$key => $val\n"; - } + foreach ($a as $key => $val) { + echo "$key => $val\n"; + } } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } ?> --EXPECT-- diff --git a/ext/ffi/tests/012.phpt b/ext/ffi/tests/012.phpt index 35686191e1..6623bf7368 100644 --- a/ext/ffi/tests/012.phpt +++ b/ext/ffi/tests/012.phpt @@ -7,9 +7,9 @@ ffi.enable=1 --FILE-- <?php try { - var_dump(serialize(FFI::new("int[2]"))); + var_dump(serialize(FFI::new("int[2]"))); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } ?> --EXPECT-- diff --git a/ext/ffi/tests/013.phpt b/ext/ffi/tests/013.phpt index b95acfbe40..cfc1e85eb0 100644 --- a/ext/ffi/tests/013.phpt +++ b/ext/ffi/tests/013.phpt @@ -12,45 +12,45 @@ var_dump(count($a[0])); var_dump(count($a[0][0])); try { - var_dump(FFI::new("void")); + var_dump(FFI::new("void")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - var_dump(FFI::new("void[1]")); + var_dump(FFI::new("void[1]")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("static int foo(int)[5];"); - echo "ok\n"; + FFI::cdef("static int foo(int)[5];"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("static int foo[5](int);"); - echo "ok\n"; + FFI::cdef("static int foo[5](int);"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("static int foo(int)(int);"); - echo "ok\n"; + FFI::cdef("static int foo(int)(int);"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("typedef int foo[2][];"); - echo "ok\n"; + FFI::cdef("typedef int foo[2][];"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("typedef int foo[][2];"); - echo "ok\n"; + FFI::cdef("typedef int foo[][2];"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } ?> --EXPECT-- diff --git a/ext/ffi/tests/015.phpt b/ext/ffi/tests/015.phpt index 5143bea109..7b710c1dc0 100644 --- a/ext/ffi/tests/015.phpt +++ b/ext/ffi/tests/015.phpt @@ -7,52 +7,52 @@ ffi.enable=1 --FILE-- <?php try { - FFI::cdef("struct DIR; static struct DIR dir;"); - echo "ok\n"; + FFI::cdef("struct DIR; static struct DIR dir;"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct DIR; static struct DIR *ptr;"); - echo "ok\n"; + FFI::cdef("struct DIR; static struct DIR *ptr;"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct DIR; typedef struct DIR DIR; static DIR dir;"); - echo "ok\n"; + FFI::cdef("struct DIR; typedef struct DIR DIR; static DIR dir;"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct DIR; typedef struct DIR DIR; static DIR *ptr;"); - echo "ok\n"; + FFI::cdef("struct DIR; typedef struct DIR DIR; static DIR *ptr;"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct DIR; static struct DIR foo();"); - echo "ok\n"; + FFI::cdef("struct DIR; static struct DIR foo();"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct DIR; static struct DIR* foo();"); - echo "ok\n"; + FFI::cdef("struct DIR; static struct DIR* foo();"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct DIR; static void foo(struct DIR);"); - echo "ok\n"; + FFI::cdef("struct DIR; static void foo(struct DIR);"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct DIR; static void foo(struct DIR*);"); - echo "ok\n"; + FFI::cdef("struct DIR; static void foo(struct DIR*);"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } ?> ok diff --git a/ext/ffi/tests/016.phpt b/ext/ffi/tests/016.phpt index 89d765de03..2ca8363fbd 100644 --- a/ext/ffi/tests/016.phpt +++ b/ext/ffi/tests/016.phpt @@ -7,22 +7,22 @@ ffi.enable=1 --FILE-- <?php try { - FFI::cdef("struct X {void x();};"); - echo "ok\n"; + FFI::cdef("struct X {void x();};"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct X {struct X x;};"); - echo "ok\n"; + FFI::cdef("struct X {struct X x;};"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct X {struct X *ptr;};"); - echo "ok\n"; + FFI::cdef("struct X {struct X *ptr;};"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } ?> ok diff --git a/ext/ffi/tests/017.phpt b/ext/ffi/tests/017.phpt index cd64a85efc..02b917ff2b 100644 --- a/ext/ffi/tests/017.phpt +++ b/ext/ffi/tests/017.phpt @@ -7,19 +7,19 @@ ffi.enable=1 --FILE-- <?php try { - var_dump(FFI::new("struct X {void x();}")); + var_dump(FFI::new("struct X {void x();}")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - var_dump(FFI::new("struct X {struct X x;}")); + var_dump(FFI::new("struct X {struct X x;}")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - var_dump(FFI::new("struct X {struct X *ptr;}")); + var_dump(FFI::new("struct X {struct X *ptr;}")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } ?> ok diff --git a/ext/ffi/tests/018.phpt b/ext/ffi/tests/018.phpt index 14905e74f6..f48367bc71 100644 --- a/ext/ffi/tests/018.phpt +++ b/ext/ffi/tests/018.phpt @@ -7,16 +7,16 @@ ffi.enable=1 --FILE-- <?php try { - FFI::cdef("struct X {struct X x[2];};"); - echo "ok\n"; + FFI::cdef("struct X {struct X x[2];};"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct X {struct X *ptr[2];};"); - echo "ok\n"; + FFI::cdef("struct X {struct X *ptr[2];};"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } ?> ok diff --git a/ext/ffi/tests/019.phpt b/ext/ffi/tests/019.phpt index 792db2ef56..80dcfa0ff9 100644 --- a/ext/ffi/tests/019.phpt +++ b/ext/ffi/tests/019.phpt @@ -7,16 +7,16 @@ ffi.enable=1 --FILE-- <?php try { - FFI::cdef("static int foo(int[]);"); - echo "ok\n"; + FFI::cdef("static int foo(int[]);"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("static int foo(int bar(int));"); - echo "ok\n"; + FFI::cdef("static int foo(int bar(int));"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } ?> ok diff --git a/ext/ffi/tests/020.phpt b/ext/ffi/tests/020.phpt index 15660250cc..7aca9425a8 100644 --- a/ext/ffi/tests/020.phpt +++ b/ext/ffi/tests/020.phpt @@ -7,56 +7,56 @@ ffi.enable=1 --FILE-- <?php try { - $p = FFI::new("struct {int x; const int y;}"); - $p->x = 1; - $p->y = 1; - echo "ok\n"; + $p = FFI::new("struct {int x; const int y;}"); + $p->x = 1; + $p->y = 1; + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - $p = FFI::new("struct {const int x; int y;}"); - $p->y = 1; - $p->x = 1; - echo "ok\n"; + $p = FFI::new("struct {const int x; int y;}"); + $p->y = 1; + $p->x = 1; + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - $p = FFI::new("const struct {int x; int y;}"); - $p->x = 1; - echo "ok\n"; + $p = FFI::new("const struct {int x; int y;}"); + $p->x = 1; + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - $p = FFI::new("const int[10]"); - $p[1] = 1; - echo "ok\n"; + $p = FFI::new("const int[10]"); + $p[1] = 1; + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - $p = FFI::new("const int * [1]"); - $p[0] = null; - echo "ok\n"; + $p = FFI::new("const int * [1]"); + $p[0] = null; + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - $p = FFI::new("int * const [1]"); - $p[0] = null; - echo "ok\n"; + $p = FFI::new("int * const [1]"); + $p[0] = null; + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - $f = FFI::cdef("typedef int * const t[1];"); - $p = $f->new("t"); - $p[0] = null; - echo "ok\n"; + $f = FFI::cdef("typedef int * const t[1];"); + $p = $f->new("t"); + $p[0] = null; + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } ?> ok diff --git a/ext/ffi/tests/021.phpt b/ext/ffi/tests/021.phpt index c76a1daf75..d02836c5f4 100644 --- a/ext/ffi/tests/021.phpt +++ b/ext/ffi/tests/021.phpt @@ -7,9 +7,9 @@ ffi.enable=1 --FILE-- <?php function test($size, $type) { - if (FFI::sizeof(FFI::new($type)) !== $size) { - echo "FAIL: sizeof($type) != $size\n"; - } + if (FFI::sizeof(FFI::new($type)) !== $size) { + echo "FAIL: sizeof($type) != $size\n"; + } } test(4, "enum {a1, b1}"); diff --git a/ext/ffi/tests/022.phpt b/ext/ffi/tests/022.phpt index a1c009dce8..9e5bb915e1 100644 --- a/ext/ffi/tests/022.phpt +++ b/ext/ffi/tests/022.phpt @@ -7,15 +7,15 @@ ffi.enable=1 --FILE-- <?php function test_size($size, $type) { - if (FFI::sizeof(FFI::new($type)) !== $size) { - echo "FAIL: sizeof($type) != $size\n"; - } + if (FFI::sizeof(FFI::new($type)) !== $size) { + echo "FAIL: sizeof($type) != $size\n"; + } } function test_align($align, $type) { - if (FFI::alignof(FFI::new($type)) !== $align) { - echo "FAIL: alignof($type) != $align\n"; - } + if (FFI::alignof(FFI::new($type)) !== $align) { + echo "FAIL: alignof($type) != $align\n"; + } } test_size(8, "struct {uint32_t a; uint32_t b;}"); @@ -61,8 +61,8 @@ test_size(32, "struct {char a; uint32_t b __attribute__((aligned(16)));}"); test_align(16, "struct {char a; uint32_t b __attribute__((aligned(16)));}"); if (substr(PHP_OS, 0, 3) != 'WIN') { - test_size(32, "struct {char a; uint32_t b __attribute__((aligned));}"); - test_align(16, "struct {char a; uint32_t b __attribute__((aligned));}"); + test_size(32, "struct {char a; uint32_t b __attribute__((aligned));}"); + test_align(16, "struct {char a; uint32_t b __attribute__((aligned));}"); } test_size(16, "struct __declspec(align(16)) {char a; uint32_t b;}"); diff --git a/ext/ffi/tests/023.phpt b/ext/ffi/tests/023.phpt index 3703620390..4e895d9931 100644 --- a/ext/ffi/tests/023.phpt +++ b/ext/ffi/tests/023.phpt @@ -6,9 +6,9 @@ FFI 023: GCC struct extensions ffi.enable=1 --FILE-- <?php - var_dump(FFI::sizeof(FFI::new("struct {}"))); - var_dump(FFI::sizeof(FFI::new("struct {int a}"))); - var_dump(FFI::sizeof(FFI::new("struct {int a; int b}"))); + var_dump(FFI::sizeof(FFI::new("struct {}"))); + var_dump(FFI::sizeof(FFI::new("struct {int a}"))); + var_dump(FFI::sizeof(FFI::new("struct {int a; int b}"))); ?> ok --EXPECT-- diff --git a/ext/ffi/tests/024.phpt b/ext/ffi/tests/024.phpt index 95867b4e45..f1286e49ac 100644 --- a/ext/ffi/tests/024.phpt +++ b/ext/ffi/tests/024.phpt @@ -6,26 +6,26 @@ FFI 024: anonymous struct/union ffi.enable=1 --FILE-- <?php - $p = FFI::new(" - struct { - int a; - struct { - int b; - int c; - }; - union { - int d; - uint32_t e; - }; - int f; - }"); - var_dump(FFI::sizeof($p)); - $p->a = 1; - $p->b = 2; - $p->c = 3; - $p->d = 4; - $p->f = 5; - var_dump($p); + $p = FFI::new(" + struct { + int a; + struct { + int b; + int c; + }; + union { + int d; + uint32_t e; + }; + int f; + }"); + var_dump(FFI::sizeof($p)); + $p->a = 1; + $p->b = 2; + $p->c = 3; + $p->d = 4; + $p->f = 5; + var_dump($p); ?> --EXPECTF-- int(20) diff --git a/ext/ffi/tests/025.phpt b/ext/ffi/tests/025.phpt index d1182c4854..0abef88db8 100644 --- a/ext/ffi/tests/025.phpt +++ b/ext/ffi/tests/025.phpt @@ -6,21 +6,21 @@ FFI 025: direct work with primitive types ffi.enable=1 --FILE-- <?php - $x = FFI::new("int"); - $x->cdata = 5; - var_dump($x); - $x->cdata += 2; - var_dump($x); - echo "$x\n\n"; - unset($x); + $x = FFI::new("int"); + $x->cdata = 5; + var_dump($x); + $x->cdata += 2; + var_dump($x); + echo "$x\n\n"; + unset($x); - $x = FFI::new("char"); - $x->cdata = 'a'; - var_dump($x); - $x->cdata++; - var_dump($x); - echo "$x\n\n"; - unset($x); + $x = FFI::new("char"); + $x->cdata = 'a'; + var_dump($x); + $x->cdata++; + var_dump($x); + echo "$x\n\n"; + unset($x); ?> --EXPECTF-- object(FFI\CData:int32_t)#%d (1) { diff --git a/ext/ffi/tests/026.phpt b/ext/ffi/tests/026.phpt index 5e4356041f..1c5081c188 100644 --- a/ext/ffi/tests/026.phpt +++ b/ext/ffi/tests/026.phpt @@ -11,7 +11,7 @@ $a[1] = 10; $a[2] = 20; var_dump($a); foreach ($a as &$val) { - $val->cdata += 5; + $val->cdata += 5; } var_dump($a); ?> diff --git a/ext/ffi/tests/027.phpt b/ext/ffi/tests/027.phpt index 14c51f77e4..aa4afe970a 100644 --- a/ext/ffi/tests/027.phpt +++ b/ext/ffi/tests/027.phpt @@ -7,73 +7,73 @@ ffi.enable=1 --FILE-- <?php try { - $p = FFI::new("int[*]"); - echo "ok\n"; + $p = FFI::new("int[*]"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("static int (*foo)[*];"); - echo "ok\n"; + FFI::cdef("static int (*foo)[*];"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("typedef int foo[*];"); - echo "ok\n"; + FFI::cdef("typedef int foo[*];"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("static void foo(int[*][*]);"); - echo "ok\n"; + FFI::cdef("static void foo(int[*][*]);"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - var_dump(FFI::sizeof(FFI::new("int[0]"))); + var_dump(FFI::sizeof(FFI::new("int[0]"))); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - var_dump(FFI::sizeof(FFI::new("int[]"))); + var_dump(FFI::sizeof(FFI::new("int[]"))); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - var_dump(FFI::sizeof(FFI::cast("int[]", FFI::new("int[2]")))); + var_dump(FFI::sizeof(FFI::cast("int[]", FFI::new("int[2]")))); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct _x {int a; int b[];};"); - echo "ok\n"; + FFI::cdef("struct _x {int a; int b[];};"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - $f = FFI::cdef("typedef int(*foo)[];"); - echo "ok\n"; + $f = FFI::cdef("typedef int(*foo)[];"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - $f = FFI::cdef("typedef int foo[][2];"); - echo "ok\n"; + $f = FFI::cdef("typedef int foo[][2];"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - $f = FFI::cdef("typedef int foo[];"); - echo "ok\n"; + $f = FFI::cdef("typedef int foo[];"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - $f = FFI::cdef("static int foo(int[]);"); - echo "ok\n"; + $f = FFI::cdef("static int foo(int[]);"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } ?> --EXPECT-- diff --git a/ext/ffi/tests/028.phpt b/ext/ffi/tests/028.phpt index 3015f784c6..5d1be7c8dc 100644 --- a/ext/ffi/tests/028.phpt +++ b/ext/ffi/tests/028.phpt @@ -7,40 +7,40 @@ ffi.enable=1 --FILE-- <?php try { - FFI::cdef("struct _x {int a; int b[0];};"); - echo "ok\n"; + FFI::cdef("struct _x {int a; int b[0];};"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct _x {int a; int b[];};"); - echo "ok\n"; + FFI::cdef("struct _x {int a; int b[];};"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct _x {int a[0]; int b;};"); - echo "ok\n"; + FFI::cdef("struct _x {int a[0]; int b;};"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct _x {int a[]; int b;};"); - echo "ok\n"; + FFI::cdef("struct _x {int a[]; int b;};"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("struct _x { struct {int a; int b[];}; int c;};"); - echo "ok\n"; + FFI::cdef("struct _x { struct {int a; int b[];}; int c;};"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - FFI::cdef("union _x {int a; int b[];};"); - echo "ok\n"; + FFI::cdef("union _x {int a; int b[];};"); + echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } ?> --EXPECT-- diff --git a/ext/ffi/tests/029.phpt b/ext/ffi/tests/029.phpt index bda59788fb..0951809306 100644 --- a/ext/ffi/tests/029.phpt +++ b/ext/ffi/tests/029.phpt @@ -7,8 +7,8 @@ ffi.enable=1 --FILE-- <?php $ffi = FFI::cdef(" - typedef char t1; - typedef char _Alignas(int) t2; + typedef char t1; + typedef char _Alignas(int) t2; "); var_dump(FFI::sizeof($ffi->new("struct {char a; t1 b;}"))); var_dump(FFI::sizeof($ffi->new("struct {char a; t2 b;}"))); diff --git a/ext/ffi/tests/031.phpt b/ext/ffi/tests/031.phpt index 3298df4961..c97368a89a 100644 --- a/ext/ffi/tests/031.phpt +++ b/ext/ffi/tests/031.phpt @@ -7,14 +7,14 @@ ffi.enable=1 --FILE-- <?php function test_size($expected_size, $type) { - try { - $size = FFI::sizeof(FFI::new($type)); - if ($size !== $expected_size) { - echo "FAIL: sizeof($type) != $expected_size ($size)\n"; - } - } catch (Throwable $e) { - echo $type . "=>" . get_class($e) . ": " . $e->getMessage()."\n"; - } + try { + $size = FFI::sizeof(FFI::new($type)); + if ($size !== $expected_size) { + echo "FAIL: sizeof($type) != $expected_size ($size)\n"; + } + } catch (Throwable $e) { + echo $type . "=>" . get_class($e) . ": " . $e->getMessage()."\n"; + } } test_size( 4, "struct {int a:2; int b:2;}"); diff --git a/ext/ffi/tests/032.phpt b/ext/ffi/tests/032.phpt index d785d037de..ade848188c 100644 --- a/ext/ffi/tests/032.phpt +++ b/ext/ffi/tests/032.phpt @@ -7,20 +7,20 @@ ffi.enable=1 --FILE-- <?php $p = FFI::new(" - union { - struct __attribute__((packed)) { - int a:2; - unsigned long long b:64; - int c:3; - unsigned int d:3; - } s; - uint8_t i[9]; + union { + struct __attribute__((packed)) { + int a:2; + unsigned long long b:64; + int c:3; + unsigned int d:3; + } s; + uint8_t i[9]; }"); var_dump(FFI::sizeof($p)); for ($i = -5; $i < 9; $i++) { - $p->s->c = $i; - $p->s->d = $i; - echo "$i => 3-bit int {$p->s->c}, 3-bit uint {$p->s->d}\n"; + $p->s->c = $i; + $p->s->d = $i; + echo "$i => 3-bit int {$p->s->c}, 3-bit uint {$p->s->d}\n"; } $p->s->a = 0; $p->s->c = 0; @@ -28,7 +28,7 @@ $p->s->d = 0; $p->s->b = 0x7fffffff; echo "0x"; for ($i = 9; $i > 0;) { - printf("%02x", $p->i[--$i]); + printf("%02x", $p->i[--$i]); } echo "\n"; ?> diff --git a/ext/ffi/tests/035.phpt b/ext/ffi/tests/035.phpt index fc42f16e88..ed98839c6e 100644 --- a/ext/ffi/tests/035.phpt +++ b/ext/ffi/tests/035.phpt @@ -11,9 +11,9 @@ var_dump($p); FFI::free($p); try { - var_dump($p); + var_dump($p); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } ?> --EXPECTF-- diff --git a/ext/ffi/tests/036.phpt b/ext/ffi/tests/036.phpt index 5c4e0600b8..1e989285ff 100644 --- a/ext/ffi/tests/036.phpt +++ b/ext/ffi/tests/036.phpt @@ -9,12 +9,12 @@ ffi.enable=1 $type = FFI::type("int*"); function foo($ptr) { - global $type; - //$buf = FFI::new("int*[1]"); /* this loses type and crash */ - $buf = FFI::new(FFI::arrayType($type, [1])); - $buf[0] = $ptr; - //... - return $buf[0]; + global $type; + //$buf = FFI::new("int*[1]"); /* this loses type and crash */ + $buf = FFI::new(FFI::arrayType($type, [1])); + $buf[0] = $ptr; + //... + return $buf[0]; } $int = FFI::new("int"); diff --git a/ext/ffi/tests/037.phpt b/ext/ffi/tests/037.phpt index 0b67e4a4da..d8f0a88afa 100644 --- a/ext/ffi/tests/037.phpt +++ b/ext/ffi/tests/037.phpt @@ -7,10 +7,10 @@ ffi.enable=1 --FILE-- <?php function foo($ptr) { - $buf = FFI::new("int*[1]"); - $buf[0] = $ptr; - //... - return $buf[0]; + $buf = FFI::new("int*[1]"); + $buf[0] = $ptr; + //... + return $buf[0]; } $int = FFI::new("int"); diff --git a/ext/ffi/tests/038.phpt b/ext/ffi/tests/038.phpt index 89070f31c2..270746a03e 100644 --- a/ext/ffi/tests/038.phpt +++ b/ext/ffi/tests/038.phpt @@ -8,7 +8,7 @@ ffi.enable=1 <?php $a = FFI::new("int[10]"); for ($i = 0; $i < 10; $i++) { - $a[$i] = $i; + $a[$i] = $i; } $p = FFI::cast("int*", $a); var_dump($p[0]); diff --git a/ext/ffi/tests/039.phpt b/ext/ffi/tests/039.phpt index 92309d4928..d015a38b95 100644 --- a/ext/ffi/tests/039.phpt +++ b/ext/ffi/tests/039.phpt @@ -8,7 +8,7 @@ ffi.enable=1 <?php $a = FFI::new("int[10]"); for ($i = 0; $i < 10; $i++) { - $a[$i] = $i; + $a[$i] = $i; } $p = $a + 0; var_dump($p[0]); diff --git a/ext/ffi/tests/041.phpt b/ext/ffi/tests/041.phpt index 4cb2694dbb..d12a774b21 100644 --- a/ext/ffi/tests/041.phpt +++ b/ext/ffi/tests/041.phpt @@ -7,12 +7,12 @@ ffi.enable=1 --FILE-- <?php function test_new_ownership($str, $transfer) { - if ($transfer) { - return FFI::new(FFI::type($str)); - } else { - $type = FFI::type($str); - return FFI::new($type); - } + if ($transfer) { + return FFI::new(FFI::type($str)); + } else { + $type = FFI::type($str); + return FFI::new($type); + } } var_dump(test_new_ownership("int", 1)); var_dump(test_new_ownership("int[2]", 1)); @@ -20,12 +20,12 @@ var_dump(test_new_ownership("int", 0)); var_dump(test_new_ownership("int[2]", 0)); function test_type_ownership($str, $transfer) { - if ($transfer) { - return FFI::typeof(FFI::new($str)); - } else { - $data = FFI::new($str); - return FFI::typeof($data); - } + if ($transfer) { + return FFI::typeof(FFI::new($str)); + } else { + $data = FFI::new($str); + return FFI::typeof($data); + } } var_dump(test_type_ownership("int", 1)); var_dump(test_type_ownership("int[2]", 1)); @@ -33,12 +33,12 @@ var_dump(test_type_ownership("int", 0)); var_dump(test_type_ownership("int[2]", 0)); function test_cast_ownership($str, $transfer) { - if ($transfer) { - return FFI::cast(FFI::type($str), FFI::new($str)); - } else { - $type = FFI::type($str); - return FFI::cast($type, FFI::new($str)); - } + if ($transfer) { + return FFI::cast(FFI::type($str), FFI::new($str)); + } else { + $type = FFI::type($str); + return FFI::cast($type, FFI::new($str)); + } } var_dump(test_cast_ownership("int", 1)); var_dump(test_cast_ownership("int[2]", 1)); @@ -46,12 +46,12 @@ var_dump(test_cast_ownership("int", 0)); var_dump(test_cast_ownership("int[2]", 0)); function test_array_ownership($str, $transfer) { - if ($transfer) { - return FFI::arrayType(FFI::type($str), [2]); - } else { - $type = FFI::type($str); - return FFI::arrayType($type, [2]); - } + if ($transfer) { + return FFI::arrayType(FFI::type($str), [2]); + } else { + $type = FFI::type($str); + return FFI::arrayType($type, [2]); + } } var_dump(test_array_ownership("int", 1)); var_dump(test_array_ownership("int[2]", 1)); diff --git a/ext/ffi/tests/045.phpt b/ext/ffi/tests/045.phpt index 8d4558e0d3..eb7f3b95f6 100644 --- a/ext/ffi/tests/045.phpt +++ b/ext/ffi/tests/045.phpt @@ -10,14 +10,14 @@ var_dump(FFI::isNull(FFI::new("int*"))); $i = FFI::new("int"); var_dump(FFI::isNull(FFI::addr($i))); try { - var_dump(FFI::isNull(null)); + var_dump(FFI::isNull(null)); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } try { - var_dump(FFI::isNull(FFI::new("int[0]"))); + var_dump(FFI::isNull(FFI::new("int[0]"))); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo get_class($e) . ": " . $e->getMessage()."\n"; } ?> --EXPECTF-- diff --git a/ext/ffi/tests/100.phpt b/ext/ffi/tests/100.phpt index 63fae8c215..27b6d0be08 100644 --- a/ext/ffi/tests/100.phpt +++ b/ext/ffi/tests/100.phpt @@ -15,19 +15,19 @@ ffi.enable=1 <?php // Check if target supports "fastcall" calling convention try { - FFI::cdef("extern size_t __attribute__((fastcall)) (*zend_printf)(const char *format);"); - $fastcall = "__attribute__((fastcall)) "; + FFI::cdef("extern size_t __attribute__((fastcall)) (*zend_printf)(const char *format);"); + $fastcall = "__attribute__((fastcall)) "; } catch (Throwable $e) { - $fastcall = ""; + $fastcall = ""; } $zend = FFI::cdef(" - const char *get_zend_version(void); - //char *get_zend_version(void); - extern size_t (*zend_printf)(const char *format, ...); + const char *get_zend_version(void); + //char *get_zend_version(void); + extern size_t (*zend_printf)(const char *format, ...); - unsigned long $fastcall zend_hash_func(const char *str, size_t len); + unsigned long $fastcall zend_hash_func(const char *str, size_t len); - void $fastcall zend_str_tolower(char *str, size_t length); + void $fastcall zend_str_tolower(char *str, size_t length); "); var_dump(trim(explode("\n",$zend->get_zend_version())[0])); diff --git a/ext/ffi/tests/200.phpt b/ext/ffi/tests/200.phpt index fb041022ea..69d0aafd04 100644 --- a/ext/ffi/tests/200.phpt +++ b/ext/ffi/tests/200.phpt @@ -15,19 +15,19 @@ opcache.jit=0 --FILE-- <?php $zend = FFI::cdef(" - typedef int (*zend_write_func_t)(const char *str, size_t str_length); - extern zend_write_func_t zend_write; + typedef int (*zend_write_func_t)(const char *str, size_t str_length); + extern zend_write_func_t zend_write; "); echo "Hello World!\n"; $orig_zend_write = clone $zend->zend_write; $zend->zend_write = function($str, $len) { - global $orig_zend_write; - $orig_zend_write("{\n\t", 3); - $ret = $orig_zend_write($str, $len); - $orig_zend_write("}\n", 2); - return $ret; + global $orig_zend_write; + $orig_zend_write("{\n\t", 3); + $ret = $orig_zend_write($str, $len); + $orig_zend_write("}\n", 2); + return $ret; }; echo "Hello World!\n"; $zend->zend_write = $orig_zend_write; diff --git a/ext/ffi/tests/301-win32.phpt b/ext/ffi/tests/301-win32.phpt index 1d0d27ffa6..82737e2e0e 100644 --- a/ext/ffi/tests/301-win32.phpt +++ b/ext/ffi/tests/301-win32.phpt @@ -9,10 +9,10 @@ ffi.enable=1 <?php $fn = __DIR__ . "/300-win32.h"; $cont = str_replace( - "PHP_DLL_NAME", - "php" . PHP_MAJOR_VERSION . (PHP_ZTS ? "ts" : "") . (PHP_DEBUG ? "_debug" : "") . ".dll", - file_get_contents("$fn.in") - ); + "PHP_DLL_NAME", + "php" . PHP_MAJOR_VERSION . (PHP_ZTS ? "ts" : "") . (PHP_DEBUG ? "_debug" : "") . ".dll", + file_get_contents("$fn.in") + ); file_put_contents($fn, $cont); $ffi = FFI::load($fn); diff --git a/ext/ffi/tests/bug77706.phpt b/ext/ffi/tests/bug77706.phpt index fca6208fe9..87ef584d51 100644 --- a/ext/ffi/tests/bug77706.phpt +++ b/ext/ffi/tests/bug77706.phpt @@ -30,27 +30,27 @@ int fprintf(FILE *, const char *, ...); $ffi = FFI::cdef($header, 'libc.so.6'); try { - $ffi->time(); + $ffi->time(); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo get_class($e) . ": " . $e->getMessage() . "\n"; } try { - $ffi->time(null, null); + $ffi->time(null, null); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo get_class($e) . ": " . $e->getMessage() . "\n"; } try { - $ffi->fprintf($ffi->stdout); + $ffi->fprintf($ffi->stdout); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo get_class($e) . ": " . $e->getMessage() . "\n"; } try { - $ffi->fprintf($ffi->stdout, 123, "Hello %s\n", "World"); + $ffi->fprintf($ffi->stdout, 123, "Hello %s\n", "World"); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo get_class($e) . ": " . $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/ffi/tests/bug79096.phpt b/ext/ffi/tests/bug79096.phpt index c495efc92e..d8d89f05bc 100644 --- a/ext/ffi/tests/bug79096.phpt +++ b/ext/ffi/tests/bug79096.phpt @@ -9,8 +9,8 @@ if (!extension_loaded('zend-test')) die('skip zend-test extension not available' <?php $header = <<<HEADER struct bug79096 { - uint64_t a; - uint64_t b; + uint64_t a; + uint64_t b; }; struct bug79096 bug79096(void); diff --git a/ext/ffi/tests/list.phpt b/ext/ffi/tests/list.phpt index a7696fa091..0cfe4cb7b3 100644 --- a/ext/ffi/tests/list.phpt +++ b/ext/ffi/tests/list.phpt @@ -7,78 +7,78 @@ ffi.enable=1 --FILE-- <?php class DList { - private static $ffi = null; - private $root; + private static $ffi = null; + private $root; - function __construct() { - if (is_null(self::$ffi)) { - self::$ffi = - FFI::cdef(" - typedef struct _dlist dlist; - struct _dlist { - int data; - dlist *prev; - dlist *next; - }; - "); - } - $node = FFI::addr(self::$ffi->new("dlist", false)); - $node->data = 0; - $node->next = $node; - $node->prev = $node; - $this->root = $node; - } + function __construct() { + if (is_null(self::$ffi)) { + self::$ffi = + FFI::cdef(" + typedef struct _dlist dlist; + struct _dlist { + int data; + dlist *prev; + dlist *next; + }; + "); + } + $node = FFI::addr(self::$ffi->new("dlist", false)); + $node->data = 0; + $node->next = $node; + $node->prev = $node; + $this->root = $node; + } - function __destruct() { - $root = $this->root; - $node = $root->next; - while ($node != $root) { - $prev = $node; - $node = $node->next; - FFI::free($prev); - } - FFI::free($root); - } + function __destruct() { + $root = $this->root; + $node = $root->next; + while ($node != $root) { + $prev = $node; + $node = $node->next; + FFI::free($prev); + } + FFI::free($root); + } - function add(int $data) { - $node = FFI::addr(self::$ffi->new("dlist", false)); - $node->data = $data; - $node->next = $this->root; - $node->prev = $this->root->prev; - $this->root->prev->next = $node; - $this->root->prev = $node; - } + function add(int $data) { + $node = FFI::addr(self::$ffi->new("dlist", false)); + $node->data = $data; + $node->next = $this->root; + $node->prev = $this->root->prev; + $this->root->prev->next = $node; + $this->root->prev = $node; + } - function del(int $data) { - $root = $this->root; - $node = $root->next; - while ($node != $root) { - if ($node->data == $data) { - $node->prev->next = $node->next; - $node->next->prev = $node->prev; - FFI::free($node); - break; - } - $node = $node->next; - } - } + function del(int $data) { + $root = $this->root; + $node = $root->next; + while ($node != $root) { + if ($node->data == $data) { + $node->prev->next = $node->next; + $node->next->prev = $node->prev; + FFI::free($node); + break; + } + $node = $node->next; + } + } - function print() { - echo "["; - $first = true; - $root = $this->root; - $node = $root->next; - while ($node != $root) { - if (!$first) { - echo ", "; - } else { - $first = false; - } - echo $node->data; - $node = $node->next; - } - echo "]\n"; - } + function print() { + echo "["; + $first = true; + $root = $this->root; + $node = $root->next; + while ($node != $root) { + if (!$first) { + echo ", "; + } else { + $first = false; + } + echo $node->data; + $node = $node->next; + } + echo "]\n"; + } } $dlist = new Dlist; diff --git a/ext/ffi/tests/preload.inc b/ext/ffi/tests/preload.inc index b1358de697..529d27c83c 100644 --- a/ext/ffi/tests/preload.inc +++ b/ext/ffi/tests/preload.inc @@ -1,14 +1,14 @@ <?php if (substr(PHP_OS, 0, 3) == 'WIN') { - $fn = __DIR__ . "/300-win32.h"; - $cont = str_replace( - "PHP_DLL_NAME", - "php" . PHP_MAJOR_VERSION . (PHP_ZTS ? "ts" : "") . (PHP_DEBUG ? "_debug" : "") . ".dll", - file_get_contents("$fn.in") - ); - file_put_contents($fn, $cont); - $ffi = FFI::load($fn); - /* Test should cleanup this. */ + $fn = __DIR__ . "/300-win32.h"; + $cont = str_replace( + "PHP_DLL_NAME", + "php" . PHP_MAJOR_VERSION . (PHP_ZTS ? "ts" : "") . (PHP_DEBUG ? "_debug" : "") . ".dll", + file_get_contents("$fn.in") + ); + file_put_contents($fn, $cont); + $ffi = FFI::load($fn); + /* Test should cleanup this. */ } else { - FFI::load(__DIR__ . "/300.h"); + FFI::load(__DIR__ . "/300.h"); } diff --git a/ext/fileinfo/tests/bug57547.phpt b/ext/fileinfo/tests/bug57547.phpt index 48115479ec..184ea6e018 100644 --- a/ext/fileinfo/tests/bug57547.phpt +++ b/ext/fileinfo/tests/bug57547.phpt @@ -10,11 +10,11 @@ if (!class_exists('finfo')) $filenames = array("..", __FILE__); foreach ($filenames as $filename) { - $finfo = new finfo(FILEINFO_MIME); - var_dump($finfo->file($filename)); + $finfo = new finfo(FILEINFO_MIME); + var_dump($finfo->file($filename)); - $finfo2 = new finfo(); - var_dump($finfo2->file($filename, FILEINFO_MIME)); + $finfo2 = new finfo(); + var_dump($finfo2->file($filename, FILEINFO_MIME)); } ?> diff --git a/ext/fileinfo/tests/bug67647-mb.phpt b/ext/fileinfo/tests/bug67647-mb.phpt index 310b9f2fad..c5ce8f9dc1 100644 --- a/ext/fileinfo/tests/bug67647-mb.phpt +++ b/ext/fileinfo/tests/bug67647-mb.phpt @@ -17,9 +17,9 @@ $f_base = "67647ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.mov"; $f = __DIR__ . DIRECTORY_SEPARATOR . $f_base; /* Streams mb path support is tested a lot elsewhere. Copy the existing file - therefore, avoid duplication in the repo. */ + therefore, avoid duplication in the repo. */ if (!copy($src, $f) || empty(glob($f))) { - die("failed to copy '$src' to '$f'"); + die("failed to copy '$src' to '$f'"); } $fi = new finfo(FILEINFO_MIME_TYPE); diff --git a/ext/fileinfo/tests/bug68731.phpt b/ext/fileinfo/tests/bug68731.phpt index 43083c9eec..c15b83c951 100644 --- a/ext/fileinfo/tests/bug68731.phpt +++ b/ext/fileinfo/tests/bug68731.phpt @@ -6,9 +6,9 @@ if (!class_exists('finfo')) die('skip no fileinfo extension'); --FILE-- <?php - $buffer = file_get_contents(__DIR__ . '/68731.gif'); - $finfo = finfo_open(FILEINFO_MIME_TYPE); - echo finfo_buffer($finfo, $buffer); + $buffer = file_get_contents(__DIR__ . '/68731.gif'); + $finfo = finfo_open(FILEINFO_MIME_TYPE); + echo finfo_buffer($finfo, $buffer); ?> --EXPECT-- image/gif diff --git a/ext/fileinfo/tests/bug68735.phpt b/ext/fileinfo/tests/bug68735.phpt index 7a27b995ed..2197b2196e 100644 --- a/ext/fileinfo/tests/bug68735.phpt +++ b/ext/fileinfo/tests/bug68735.phpt @@ -4,10 +4,10 @@ Bug #68735 fileinfo out-of-bounds memory access <?php require_once(__DIR__ . '/skipif.inc'); ?> --FILE-- <?php - $test_file = __DIR__ . DIRECTORY_SEPARATOR . "bug68735.jpg"; - $f = new finfo; + $test_file = __DIR__ . DIRECTORY_SEPARATOR . "bug68735.jpg"; + $f = new finfo; - var_dump($f->file($test_file)); + var_dump($f->file($test_file)); ?> --EXPECTF-- diff --git a/ext/fileinfo/tests/bug71527-mb.phpt b/ext/fileinfo/tests/bug71527-mb.phpt index 91bc0510bd..272cdba702 100644 --- a/ext/fileinfo/tests/bug71527-mb.phpt +++ b/ext/fileinfo/tests/bug71527-mb.phpt @@ -8,7 +8,7 @@ if (!class_exists('finfo')) USE_ZEND_ALLOC=0 --FILE-- <?php - $finfo = finfo_open(FILEINFO_NONE, __DIR__ . DIRECTORY_SEPARATOR . "bug71527ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.magic"); + $finfo = finfo_open(FILEINFO_NONE, __DIR__ . DIRECTORY_SEPARATOR . "bug71527ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.magic"); var_dump($finfo); ?> --EXPECTF-- diff --git a/ext/fileinfo/tests/bug71527.phpt b/ext/fileinfo/tests/bug71527.phpt index 74bf9839d5..e6289b73fd 100644 --- a/ext/fileinfo/tests/bug71527.phpt +++ b/ext/fileinfo/tests/bug71527.phpt @@ -8,7 +8,7 @@ if (!class_exists('finfo')) USE_ZEND_ALLOC=0 --FILE-- <?php - $finfo = finfo_open(FILEINFO_NONE, __DIR__ . DIRECTORY_SEPARATOR . "bug71527.magic"); + $finfo = finfo_open(FILEINFO_NONE, __DIR__ . DIRECTORY_SEPARATOR . "bug71527.magic"); var_dump($finfo); ?> --EXPECTF-- diff --git a/ext/fileinfo/tests/cve-2014-3538-mb.phpt b/ext/fileinfo/tests/cve-2014-3538-mb.phpt index cc9084dc79..626c757144 100644 --- a/ext/fileinfo/tests/cve-2014-3538-mb.phpt +++ b/ext/fileinfo/tests/cve-2014-3538-mb.phpt @@ -21,9 +21,9 @@ var_dump(finfo_file($fi, $fd)); $t = microtime(true) - $t; finfo_close($fi); if ($t < 3) { - echo "Ok\n"; + echo "Ok\n"; } else { - printf("Failed, time=%.2f\n", $t); + printf("Failed, time=%.2f\n", $t); } ?> diff --git a/ext/fileinfo/tests/cve-2014-3538-nojit.phpt b/ext/fileinfo/tests/cve-2014-3538-nojit.phpt index 0072ab2047..02b314cbb1 100644 --- a/ext/fileinfo/tests/cve-2014-3538-nojit.phpt +++ b/ext/fileinfo/tests/cve-2014-3538-nojit.phpt @@ -25,9 +25,9 @@ var_dump(finfo_file($fi, $fd)); $t = microtime(true) - $t; finfo_close($fi); if ($t < 1) { - echo "Ok\n"; + echo "Ok\n"; } else { - printf("Failed, time=%.2f\n", $t); + printf("Failed, time=%.2f\n", $t); } ?> diff --git a/ext/fileinfo/tests/cve-2014-3538.phpt b/ext/fileinfo/tests/cve-2014-3538.phpt index 718457442a..a523861186 100644 --- a/ext/fileinfo/tests/cve-2014-3538.phpt +++ b/ext/fileinfo/tests/cve-2014-3538.phpt @@ -21,9 +21,9 @@ var_dump(finfo_file($fi, $fd)); $t = microtime(true) - $t; finfo_close($fi); if ($t < 1) { - echo "Ok\n"; + echo "Ok\n"; } else { - printf("Failed, time=%.2f\n", $t); + printf("Failed, time=%.2f\n", $t); } ?> diff --git a/ext/fileinfo/tests/finfo_buffer_basic-mb.phpt b/ext/fileinfo/tests/finfo_buffer_basic-mb.phpt index ab6f042a0b..1c9f0d1de2 100644 --- a/ext/fileinfo/tests/finfo_buffer_basic-mb.phpt +++ b/ext/fileinfo/tests/finfo_buffer_basic-mb.phpt @@ -13,27 +13,27 @@ Test finfo_buffer() function : basic functionality $magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magicç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™'; $options = array( - FILEINFO_NONE, - FILEINFO_MIME, + FILEINFO_NONE, + FILEINFO_MIME, ); $buffers = array( - "Regular string here", - "\177ELF", - "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003", - "\x55\x7A\x6E\x61", - "id=ImageMagick", - "RIFFüîò^BAVI LISTv", + "Regular string here", + "\177ELF", + "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003", + "\x55\x7A\x6E\x61", + "id=ImageMagick", + "RIFFüîò^BAVI LISTv", ); echo "*** Testing finfo_buffer() : basic functionality ***\n"; foreach( $options as $option ) { - $finfo = finfo_open( $option, $magicFile ); - foreach( $buffers as $string ) { - var_dump( finfo_buffer( $finfo, $string, $option ) ); - } - finfo_close( $finfo ); + $finfo = finfo_open( $option, $magicFile ); + foreach( $buffers as $string ) { + var_dump( finfo_buffer( $finfo, $string, $option ) ); + } + finfo_close( $finfo ); } ?> diff --git a/ext/fileinfo/tests/finfo_buffer_basic.phpt b/ext/fileinfo/tests/finfo_buffer_basic.phpt index 2aeb9eb36b..d69d153f0d 100644 --- a/ext/fileinfo/tests/finfo_buffer_basic.phpt +++ b/ext/fileinfo/tests/finfo_buffer_basic.phpt @@ -13,27 +13,27 @@ Test finfo_buffer() function : basic functionality $magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magic'; $options = array( - FILEINFO_NONE, - FILEINFO_MIME, + FILEINFO_NONE, + FILEINFO_MIME, ); $buffers = array( - "Regular string here", - "\177ELF", - "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003", - "\x55\x7A\x6E\x61", - "id=ImageMagick", - "RIFFüîò^BAVI LISTv", + "Regular string here", + "\177ELF", + "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003", + "\x55\x7A\x6E\x61", + "id=ImageMagick", + "RIFFüîò^BAVI LISTv", ); echo "*** Testing finfo_buffer() : basic functionality ***\n"; foreach( $options as $option ) { - $finfo = finfo_open( $option, $magicFile ); - foreach( $buffers as $string ) { - var_dump( finfo_buffer( $finfo, $string, $option ) ); - } - finfo_close( $finfo ); + $finfo = finfo_open( $option, $magicFile ); + foreach( $buffers as $string ) { + var_dump( finfo_buffer( $finfo, $string, $option ) ); + } + finfo_close( $finfo ); } ?> diff --git a/ext/fileinfo/tests/finfo_buffer_variation1-mb.phpt b/ext/fileinfo/tests/finfo_buffer_variation1-mb.phpt index 4560aeabe6..8f26d80b92 100644 --- a/ext/fileinfo/tests/finfo_buffer_variation1-mb.phpt +++ b/ext/fileinfo/tests/finfo_buffer_variation1-mb.phpt @@ -13,26 +13,26 @@ Test finfo_buffer() function : basic functionality $magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magicç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™'; $options = array( - FILEINFO_NONE, - FILEINFO_MIME, + FILEINFO_NONE, + FILEINFO_MIME, ); $buffers = array( - "Regular string here", - "\177ELF", - "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003", - "\x55\x7A\x6E\x61", - "id=ImageMagick", - "RIFFüîò^BAVI LISTv", + "Regular string here", + "\177ELF", + "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003", + "\x55\x7A\x6E\x61", + "id=ImageMagick", + "RIFFüîò^BAVI LISTv", ); echo "*** Testing finfo_buffer() : variation functionality with oo interface ***\n"; foreach( $options as $option ) { - $finfo = new finfo( $option, $magicFile ); - foreach( $buffers as $string ) { - var_dump( $finfo->buffer( $string, $option ) ); - } + $finfo = new finfo( $option, $magicFile ); + foreach( $buffers as $string ) { + var_dump( $finfo->buffer( $string, $option ) ); + } } ?> diff --git a/ext/fileinfo/tests/finfo_buffer_variation1.phpt b/ext/fileinfo/tests/finfo_buffer_variation1.phpt index 75c0099f20..fafaaa9376 100644 --- a/ext/fileinfo/tests/finfo_buffer_variation1.phpt +++ b/ext/fileinfo/tests/finfo_buffer_variation1.phpt @@ -13,26 +13,26 @@ Test finfo_buffer() function : basic functionality $magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magic'; $options = array( - FILEINFO_NONE, - FILEINFO_MIME, + FILEINFO_NONE, + FILEINFO_MIME, ); $buffers = array( - "Regular string here", - "\177ELF", - "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003", - "\x55\x7A\x6E\x61", - "id=ImageMagick", - "RIFFüîò^BAVI LISTv", + "Regular string here", + "\177ELF", + "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003", + "\x55\x7A\x6E\x61", + "id=ImageMagick", + "RIFFüîò^BAVI LISTv", ); echo "*** Testing finfo_buffer() : variation functionality with oo interface ***\n"; foreach( $options as $option ) { - $finfo = new finfo( $option, $magicFile ); - foreach( $buffers as $string ) { - var_dump( $finfo->buffer( $string, $option ) ); - } + $finfo = new finfo( $option, $magicFile ); + foreach( $buffers as $string ) { + var_dump( $finfo->buffer( $string, $option ) ); + } } ?> diff --git a/ext/fileinfo/tests/finfo_file_002.phpt b/ext/fileinfo/tests/finfo_file_002.phpt index aa870cdfab..4d5348e346 100644 --- a/ext/fileinfo/tests/finfo_file_002.phpt +++ b/ext/fileinfo/tests/finfo_file_002.phpt @@ -9,9 +9,9 @@ $fp = finfo_open(FILEINFO_MIME_TYPE); $results = array(); foreach (glob(__DIR__ . "/resources/*") as $filename) { - if (is_file($filename)) { - $results["$filename"] = finfo_file($fp, $filename); - } + if (is_file($filename)) { + $results["$filename"] = finfo_file($fp, $filename); + } } ksort($results); diff --git a/ext/fileinfo/tests/skipif.inc b/ext/fileinfo/tests/skipif.inc index 97b2546809..3a0642a7b3 100644 --- a/ext/fileinfo/tests/skipif.inc +++ b/ext/fileinfo/tests/skipif.inc @@ -1,7 +1,7 @@ <?php if (!extension_loaded('fileinfo')) { - die("skip fileinfo extension not loaded"); + die("skip fileinfo extension not loaded"); } ?> diff --git a/ext/filter/tests/014.phpt b/ext/filter/tests/014.phpt index 6b34a19b77..e79fcb0178 100644 --- a/ext/filter/tests/014.phpt +++ b/ext/filter/tests/014.phpt @@ -7,9 +7,9 @@ filter_var() and FILTER_VALIDATE_BOOLEAN class test { - function __toString() { - return "blah"; - } + function __toString() { + return "blah"; + } } $t = new test; diff --git a/ext/filter/tests/015.phpt b/ext/filter/tests/015.phpt index f9c190a0d0..07a1874560 100644 --- a/ext/filter/tests/015.phpt +++ b/ext/filter/tests/015.phpt @@ -50,7 +50,7 @@ array(), "http://example.com:65537", ); foreach ($values as $value) { - var_dump(filter_var($value, FILTER_VALIDATE_URL)); + var_dump(filter_var($value, FILTER_VALIDATE_URL)); } diff --git a/ext/filter/tests/016.phpt b/ext/filter/tests/016.phpt index c614903f63..a5a5816459 100644 --- a/ext/filter/tests/016.phpt +++ b/ext/filter/tests/016.phpt @@ -22,7 +22,7 @@ $values = Array( 'foo@bar.-' ); foreach ($values as $value) { - var_dump(filter_var($value, FILTER_VALIDATE_EMAIL)); + var_dump(filter_var($value, FILTER_VALIDATE_EMAIL)); } echo "Done\n"; diff --git a/ext/filter/tests/029.phpt b/ext/filter/tests/029.phpt index 14b516c35a..2c5d64cbb2 100644 --- a/ext/filter/tests/029.phpt +++ b/ext/filter/tests/029.phpt @@ -7,7 +7,7 @@ filter_var() and FILTER_CALLBACK /* Simple callback function */ function test($var) { - return strtoupper($var); + return strtoupper($var); } var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test"))); @@ -19,9 +19,9 @@ var_dump(filter_var("qwe", FILTER_CALLBACK)); /* Simple class method callback */ class test_class { - static function test ($var) { - return strtolower($var); - } + static function test ($var) { + return strtolower($var); + } } var_dump(filter_var("dAtA", FILTER_CALLBACK, array("options"=>array("test_class", "test")))); @@ -38,7 +38,7 @@ var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test1"))); /* attempting to change data by reference */ function test2(&$var) { - $var = 1; + $var = 1; } var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test2"))); @@ -47,7 +47,7 @@ var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test2"))); /* unsetting data */ function test3(&$var) { - unset($var); + unset($var); } var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test3"))); @@ -56,21 +56,21 @@ var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test3"))); /* unset data and return value */ function test4(&$var) { - unset($var); - return 1; + unset($var); + return 1; } var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test4"))); /* thrown exception in the callback */ function test5(&$var) { - throw new Exception("test"); + throw new Exception("test"); } try { - var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test5"))); + var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test5"))); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } echo "Done\n"; diff --git a/ext/filter/tests/030.phpt b/ext/filter/tests/030.phpt index c8e7d4b6ef..405a73335a 100644 --- a/ext/filter/tests/030.phpt +++ b/ext/filter/tests/030.phpt @@ -5,23 +5,23 @@ filter_var() and IPv6 --FILE-- <?php $ipv6_test = array( - "::127.0.0.1" => true, - "FF01::101:127.0.1" => false, - "FF01:0:0:0:101:127.0.1.1" => false, - "FF01:0:0:0:237:101:127.0.1.1" => true, - "FF01::101" => true, - "A1080::8:800:200C:417A" => false, - "1080::8:Z00:200C:417A" => false, - "FF01::101::1" => false, - "1080::8:800:200C:417A" => true, - "1080:0:0:0:8:800:200C:417A" => true, - "2001:ec8:1:1:1:1:1:1" => true, - "ffff::FFFF:129.144.52.38" => true, - "::ffff:1.2.3.4" => true, - "0:0:0:0:0:FFFF:129.144.52.38" => true, - "0:0:0:0:0:0:13.1.68.3" => true, + "::127.0.0.1" => true, + "FF01::101:127.0.1" => false, + "FF01:0:0:0:101:127.0.1.1" => false, + "FF01:0:0:0:237:101:127.0.1.1" => true, + "FF01::101" => true, + "A1080::8:800:200C:417A" => false, + "1080::8:Z00:200C:417A" => false, + "FF01::101::1" => false, + "1080::8:800:200C:417A" => true, + "1080:0:0:0:8:800:200C:417A" => true, + "2001:ec8:1:1:1:1:1:1" => true, + "ffff::FFFF:129.144.52.38" => true, + "::ffff:1.2.3.4" => true, + "0:0:0:0:0:FFFF:129.144.52.38" => true, + "0:0:0:0:0:0:13.1.68.3" => true, "0:0:0:0:0:0:0:13.1.68.3" => false, - "::13.1.68.3" => true, + "::13.1.68.3" => true, "::FFFF:129.144.52.38" => true, "1:2:3:4:5:6::129.144.52.38" => false, @@ -50,12 +50,12 @@ $ipv6_test = array( '0:0:0::255.255.255.255' => true, ); foreach ($ipv6_test as $ip => $exp) { - $out = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); - $out = $out !== false; - if ($exp != $out) { - echo "$ip failed (expected ", $exp?"true":"false", ", got ", + $out = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); + $out = $out !== false; + if ($exp != $out) { + echo "$ip failed (expected ", $exp?"true":"false", ", got ", $out?"true":"false", ")\n"; - } + } } echo "Ok\n"; diff --git a/ext/filter/tests/031.phpt b/ext/filter/tests/031.phpt index e45e484bd4..2968decafc 100644 --- a/ext/filter/tests/031.phpt +++ b/ext/filter/tests/031.phpt @@ -19,8 +19,8 @@ $floats = array( ); foreach ($floats as $float) { - $out = filter_var($float, FILTER_VALIDATE_FLOAT); - var_dump($out); + $out = filter_var($float, FILTER_VALIDATE_FLOAT); + var_dump($out); } $floats = array( @@ -33,8 +33,8 @@ $floats = array( echo "\ncustom decimal:\n"; foreach ($floats as $float => $dec) { - $out = filter_var($float, FILTER_VALIDATE_FLOAT, array("options"=>array('decimal' => $dec))); - var_dump($out); + $out = filter_var($float, FILTER_VALIDATE_FLOAT, array("options"=>array('decimal' => $dec))); + var_dump($out); } ?> diff --git a/ext/filter/tests/033_run.inc b/ext/filter/tests/033_run.inc index 30a7a82a01..75ce127868 100644 --- a/ext/filter/tests/033_run.inc +++ b/ext/filter/tests/033_run.inc @@ -6,35 +6,35 @@ function test($data) { } $data = array( - "PHP", - "1", - "foo@bar.com", - "http://a.b.c", - "1.2.3.4", - "123", - "123abc<>()", - "O'Henry", - "하í¼", - "aa:bb:cc:dd:ee:ff", + "PHP", + "1", + "foo@bar.com", + "http://a.b.c", + "1.2.3.4", + "123", + "123abc<>()", + "O'Henry", + "하í¼", + "aa:bb:cc:dd:ee:ff", ); foreach(filter_list() as $filter) { - if($filter=="validate_regexp") { - foreach($data as $k=>$d) $result[$k] = filter_var($d,filter_id($filter),array("options"=>array("regexp"=>'/^O.*/'))); - } else { - foreach($data as $k=>$d) $result[$k] = filter_var($d,filter_id($filter),array("options"=>"test")); - } - printf("%-20s",$filter); - printf("%-5s",$result[0]); - printf("%-3s",$result[1]); - printf("%-15s",$result[2]); - printf("%-20s",$result[3]); - printf("%-10s",$result[4]); - printf("%-5s",$result[5]); - printf("%-20s",$result[6]); - printf("%-15s",$result[7]); - printf("%-10s",$result[8]); - printf("%-10s\n",$result[9]); + if($filter=="validate_regexp") { + foreach($data as $k=>$d) $result[$k] = filter_var($d,filter_id($filter),array("options"=>array("regexp"=>'/^O.*/'))); + } else { + foreach($data as $k=>$d) $result[$k] = filter_var($d,filter_id($filter),array("options"=>"test")); + } + printf("%-20s",$filter); + printf("%-5s",$result[0]); + printf("%-3s",$result[1]); + printf("%-15s",$result[2]); + printf("%-20s",$result[3]); + printf("%-10s",$result[4]); + printf("%-5s",$result[5]); + printf("%-20s",$result[6]); + printf("%-15s",$result[7]); + printf("%-10s",$result[8]); + printf("%-10s\n",$result[9]); } ?> diff --git a/ext/filter/tests/034.phpt b/ext/filter/tests/034.phpt index 759420af41..ae0a18ee66 100644 --- a/ext/filter/tests/034.phpt +++ b/ext/filter/tests/034.phpt @@ -23,7 +23,7 @@ $booleans = array( foreach($booleans as $val=>$exp) { $res =filter_var($val, FILTER_VALIDATE_BOOLEAN); - if ($res !== $exp) { + if ($res !== $exp) { echo "$val failed,'$exp' expect, '$res' received.\n"; } } diff --git a/ext/filter/tests/037.phpt b/ext/filter/tests/037.phpt index e9f02afca4..431d3a7243 100644 --- a/ext/filter/tests/037.phpt +++ b/ext/filter/tests/037.phpt @@ -7,7 +7,7 @@ a=1&b=2 --FILE-- <?php function myfunc($val) { - return $val . '_callback'; + return $val . '_callback'; } echo filter_input(INPUT_GET, 'a', FILTER_CALLBACK, array("options"=>'myfunc')); echo "\n"; @@ -19,13 +19,13 @@ echo filter_var($data, FILTER_CALLBACK, array("options"=>'myfunc')); echo "\n"; $res = filter_input_array(INPUT_GET, array( - 'a' => array( - 'filter' => FILTER_CALLBACK, - 'options' => 'myfunc' - ), - 'b' => FILTER_VALIDATE_INT - ) - ); + 'a' => array( + 'filter' => FILTER_CALLBACK, + 'options' => 'myfunc' + ), + 'b' => FILTER_VALIDATE_INT + ) + ); var_dump($res); ?> diff --git a/ext/filter/tests/043.phpt b/ext/filter/tests/043.phpt index b889e35476..3d1e8ae140 100644 --- a/ext/filter/tests/043.phpt +++ b/ext/filter/tests/043.phpt @@ -7,7 +7,7 @@ Character encoding test $flags = FILTER_FLAG_ENCODE_AMP|FILTER_FLAG_ENCODE_LOW|FILTER_FLAG_ENCODE_HIGH; for ($i = 0; $i < 256; $i++) { - var_dump(filter_var(chr($i), FILTER_SANITIZE_STRING, array("flags" => $flags))); + var_dump(filter_var(chr($i), FILTER_SANITIZE_STRING, array("flags" => $flags))); } ?> --EXPECT-- diff --git a/ext/filter/tests/044.phpt b/ext/filter/tests/044.phpt index c456d473bb..95a2f3312b 100644 --- a/ext/filter/tests/044.phpt +++ b/ext/filter/tests/044.phpt @@ -7,7 +7,7 @@ precision=14 --FILE-- <?php $vals = array( -" +" ", " ", " 123", @@ -15,7 +15,7 @@ $vals = array( ); foreach ($vals as $var) { - var_dump(filter_var($var, FILTER_VALIDATE_FLOAT)); + var_dump(filter_var($var, FILTER_VALIDATE_FLOAT)); } ?> --EXPECT-- diff --git a/ext/filter/tests/046.phpt b/ext/filter/tests/046.phpt index bc454420ad..dc67255a7d 100644 --- a/ext/filter/tests/046.phpt +++ b/ext/filter/tests/046.phpt @@ -7,25 +7,25 @@ Integer overflow $max = sprintf("%d", PHP_INT_MAX); switch($max) { case "2147483647": /* 32-bit systems */ - $min = "-2147483648"; - $overflow = "2147483648"; - $underflow = "-2147483649"; - break; + $min = "-2147483648"; + $overflow = "2147483648"; + $underflow = "-2147483649"; + break; case "9223372036854775807": /* 64-bit systems */ - $min = "-9223372036854775808"; - $overflow = "9223372036854775808"; - $underflow = "-9223372036854775809"; - break; + $min = "-9223372036854775808"; + $overflow = "9223372036854775808"; + $underflow = "-9223372036854775809"; + break; default: - die("failed: unknown value for PHP_MAX_INT"); - break; + die("failed: unknown value for PHP_MAX_INT"); + break; } function test_validation($val, $msg) { - $f = filter_var($val, FILTER_VALIDATE_INT); - echo "$msg filtered: "; var_dump($f); // filtered value (or false) - echo "$msg is_long: "; var_dump(is_long($f)); // test validation - echo "$msg equal: "; var_dump($val == $f); // test equality of result + $f = filter_var($val, FILTER_VALIDATE_INT); + echo "$msg filtered: "; var_dump($f); // filtered value (or false) + echo "$msg is_long: "; var_dump(is_long($f)); // test validation + echo "$msg equal: "; var_dump($val == $f); // test equality of result } // PHP_INT_MAX diff --git a/ext/filter/tests/047.phpt b/ext/filter/tests/047.phpt index cc41eabd3d..d5566ce14d 100644 --- a/ext/filter/tests/047.phpt +++ b/ext/filter/tests/047.phpt @@ -5,16 +5,16 @@ Octal integer overflow --FILE-- <?php function octal_inc($s) { - $len = strlen($s); - while ($len > 0) { - $len--; - if ($s[$len] != '7') { - $s[$len] = $s[$len] + 1; - return $s; - } - $s[$len] = '0'; - } - return '1'.$s; + $len = strlen($s); + while ($len > 0) { + $len--; + if ($s[$len] != '7') { + $s[$len] = $s[$len] + 1; + return $s; + } + $s[$len] = '0'; + } + return '1'.$s; } diff --git a/ext/filter/tests/048.phpt b/ext/filter/tests/048.phpt index 92ab6908c7..6edea3fd9e 100644 --- a/ext/filter/tests/048.phpt +++ b/ext/filter/tests/048.phpt @@ -5,20 +5,20 @@ Hex integer overflow --FILE-- <?php function hex_inc($s) { - $len = strlen($s); - while ($len > 0) { - $len--; - if ($s[$len] != 'f') { - if ($s[$len] == '9') { - $s[$len] = 'a'; - } else { - $s[$len] = $s[$len] + 1; - } - return $s; - } - $s[$len] = '0'; - } - return '1'.$s; + $len = strlen($s); + while ($len > 0) { + $len--; + if ($s[$len] != 'f') { + if ($s[$len] == '9') { + $s[$len] = 'a'; + } else { + $s[$len] = $s[$len] + 1; + } + return $s; + } + $s[$len] = '0'; + } + return '1'.$s; } diff --git a/ext/filter/tests/049.phpt b/ext/filter/tests/049.phpt index 5a9977b8ff..0d8f0bc8c2 100644 --- a/ext/filter/tests/049.phpt +++ b/ext/filter/tests/049.phpt @@ -5,27 +5,27 @@ filter_var() and doubles with thousend separators --FILE-- <?php $test = array( - '0' => 0.0, - '12345678900.1234567165' => 12345678900.1234567165, - '1,234,567,890.1234567165' => 1234567890.1234567165, - '-1,234,567,890.1234567165' => -1234567890.1234567165, - '1234,567,890.1234567165' => false, - '1,234,567,89.1234567165' => false, - '1,234,567,8900.1234567165' => false, - '1.234.567.890.1234567165' => false, - '1,234,567,8900.123,456' => false, + '0' => 0.0, + '12345678900.1234567165' => 12345678900.1234567165, + '1,234,567,890.1234567165' => 1234567890.1234567165, + '-1,234,567,890.1234567165' => -1234567890.1234567165, + '1234,567,890.1234567165' => false, + '1,234,567,89.1234567165' => false, + '1,234,567,8900.1234567165' => false, + '1.234.567.890.1234567165' => false, + '1,234,567,8900.123,456' => false, ); foreach ($test as $src => $dst) { - $out = filter_var($src, FILTER_VALIDATE_FLOAT, array("flags"=>FILTER_FLAG_ALLOW_THOUSAND)); - if ($dst !== $out) { - if ($out === false) { - echo "$src -> false != $dst\n"; - } elseif ($dst === false) { - echo "$src -> $out != false\n"; - } else { - echo "$src -> $out != $dst\n"; - } - } + $out = filter_var($src, FILTER_VALIDATE_FLOAT, array("flags"=>FILTER_FLAG_ALLOW_THOUSAND)); + if ($dst !== $out) { + if ($out === false) { + echo "$src -> false != $dst\n"; + } elseif ($dst === false) { + echo "$src -> $out != false\n"; + } else { + echo "$src -> $out != $dst\n"; + } + } } echo "Ok\n"; diff --git a/ext/filter/tests/050.phpt b/ext/filter/tests/050.phpt index 69a269f11f..b23d0a466e 100644 --- a/ext/filter/tests/050.phpt +++ b/ext/filter/tests/050.phpt @@ -5,22 +5,22 @@ filter_var() and double overflow/underflow --FILE-- <?php $test = array( - '1e+308' => 1e+308, - '1e+309' => false, - '1e-323' => 1e-323, - '1e-324' => false, + '1e+308' => 1e+308, + '1e+309' => false, + '1e-323' => 1e-323, + '1e-324' => false, ); foreach ($test as $src => $dst) { - $out = filter_var($src, FILTER_VALIDATE_FLOAT); - if ($dst !== $out) { - if ($out === false) { - echo "$src -> false != $dst\n"; - } elseif ($dst === false) { - echo "$src -> $out != false\n"; - } else { - echo "$src -> $out != $dst\n"; - } - } + $out = filter_var($src, FILTER_VALIDATE_FLOAT); + if ($dst !== $out) { + if ($out === false) { + echo "$src -> false != $dst\n"; + } elseif ($dst === false) { + echo "$src -> $out != false\n"; + } else { + echo "$src -> $out != $dst\n"; + } + } } echo "Ok\n"; diff --git a/ext/filter/tests/054.phpt b/ext/filter/tests/054.phpt index c8a5dad755..2b6f3000da 100644 --- a/ext/filter/tests/054.phpt +++ b/ext/filter/tests/054.phpt @@ -8,8 +8,8 @@ filter_var_array() - using the add_empty option $data = array('foo' => 123); var_dump( - filter_var_array($data, array('foo' => array('filter' => FILTER_DEFAULT), 'bar' => array('filter' => FILTER_DEFAULT)), false), - filter_var_array($data, array('foo' => array('filter' => FILTER_DEFAULT), 'bar' => array('filter' => FILTER_DEFAULT))) + filter_var_array($data, array('foo' => array('filter' => FILTER_DEFAULT), 'bar' => array('filter' => FILTER_DEFAULT)), false), + filter_var_array($data, array('foo' => array('filter' => FILTER_DEFAULT), 'bar' => array('filter' => FILTER_DEFAULT))) ); ?> diff --git a/ext/filter/tests/055.phpt b/ext/filter/tests/055.phpt index 28f94fe408..896dda8338 100644 --- a/ext/filter/tests/055.phpt +++ b/ext/filter/tests/055.phpt @@ -5,23 +5,23 @@ filter_var() and FILTER_VALIDATE_MAC --FILE-- <?php $values = Array( - array("01-23-45-67-89-ab", null), - array("01-23-45-67-89-ab", array("options" => array("separator" => "-"))), - array("01-23-45-67-89-ab", array("options" => array("separator" => "."))), - array("01-23-45-67-89-ab", array("options" => array("separator" => ":"))), - array("01-23-45-67-89-AB", null), - array("01-23-45-67-89-aB", null), - array("01:23:45:67:89:ab", null), - array("01:23:45:67:89:AB", null), - array("01:23:45:67:89:aB", null), - array("01:23:45-67:89:aB", null), - array("xx:23:45:67:89:aB", null), - array("0123.4567.89ab", null), - array("01-23-45-67-89-ab", array("options" => array("separator" => "--"))), - array("01-23-45-67-89-ab", array("options" => array("separator" => ""))), + array("01-23-45-67-89-ab", null), + array("01-23-45-67-89-ab", array("options" => array("separator" => "-"))), + array("01-23-45-67-89-ab", array("options" => array("separator" => "."))), + array("01-23-45-67-89-ab", array("options" => array("separator" => ":"))), + array("01-23-45-67-89-AB", null), + array("01-23-45-67-89-aB", null), + array("01:23:45:67:89:ab", null), + array("01:23:45:67:89:AB", null), + array("01:23:45:67:89:aB", null), + array("01:23:45-67:89:aB", null), + array("xx:23:45:67:89:aB", null), + array("0123.4567.89ab", null), + array("01-23-45-67-89-ab", array("options" => array("separator" => "--"))), + array("01-23-45-67-89-ab", array("options" => array("separator" => ""))), ); foreach ($values as $value) { - var_dump(filter_var($value[0], FILTER_VALIDATE_MAC, $value[1])); + var_dump(filter_var($value[0], FILTER_VALIDATE_MAC, $value[1])); } echo "Done\n"; diff --git a/ext/filter/tests/056.phpt b/ext/filter/tests/056.phpt index e3a4570ea7..b3ba455a4d 100644 --- a/ext/filter/tests/056.phpt +++ b/ext/filter/tests/056.phpt @@ -25,7 +25,7 @@ array(), '\r\n', ); foreach ($values as $value) { - var_dump(filter_var($value, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)); + var_dump(filter_var($value, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)); } var_dump(filter_var('_example.com', FILTER_VALIDATE_DOMAIN)); diff --git a/ext/filter/tests/058.phpt b/ext/filter/tests/058.phpt index f3fa483ed9..ee7965c271 100644 --- a/ext/filter/tests/058.phpt +++ b/ext/filter/tests/058.phpt @@ -28,7 +28,7 @@ $values = Array( 'DžǼ੧ఘⅧ⒇৪@example.com', ); foreach ($values as $value) { - var_dump(filter_var($value, FILTER_VALIDATE_EMAIL, FILTER_FLAG_EMAIL_UNICODE)); + var_dump(filter_var($value, FILTER_VALIDATE_EMAIL, FILTER_FLAG_EMAIL_UNICODE)); } echo "Done\n"; ?> diff --git a/ext/filter/tests/061.phpt b/ext/filter/tests/061.phpt index b8b3a5186a..77e1f5fe17 100644 --- a/ext/filter/tests/061.phpt +++ b/ext/filter/tests/061.phpt @@ -7,9 +7,9 @@ filter_var() and FILTER_VALIDATE_BOOL class test { - function __toString() { - return "blah"; - } + function __toString() { + return "blah"; + } } $t = new test; diff --git a/ext/filter/tests/PMOPB45.phpt b/ext/filter/tests/PMOPB45.phpt index a403b3c6e7..477e653e48 100644 --- a/ext/filter/tests/PMOPB45.phpt +++ b/ext/filter/tests/PMOPB45.phpt @@ -4,8 +4,8 @@ PMOPB-45-2007:PHP ext/filter Email Validation Vulnerability <?php if (!extension_loaded("filter")) die("skip"); ?> --FILE-- <?php - $var = "test@example.com\n"; - var_dump(filter_var($var, FILTER_VALIDATE_EMAIL)); + $var = "test@example.com\n"; + var_dump(filter_var($var, FILTER_VALIDATE_EMAIL)); ?> --EXPECT-- bool(false) diff --git a/ext/filter/tests/bug52209.phpt b/ext/filter/tests/bug52209.phpt index 3035784147..255197c798 100644 --- a/ext/filter/tests/bug52209.phpt +++ b/ext/filter/tests/bug52209.phpt @@ -13,7 +13,7 @@ if (empty($_ENV['PWD'])) die('skip PWD is empty'); variables_order=GPCSE --FILE-- <?php - var_dump(filter_input(INPUT_ENV, 'PWD')); + var_dump(filter_input(INPUT_ENV, 'PWD')); ?> --EXPECTF-- string(%d) "%s" diff --git a/ext/filter/tests/bug53037.phpt b/ext/filter/tests/bug53037.phpt index 82ecc7a75e..053786f9cd 100644 --- a/ext/filter/tests/bug53037.phpt +++ b/ext/filter/tests/bug53037.phpt @@ -5,7 +5,7 @@ Bug #53037 (FILTER_FLAG_EMPTY_STRING_NULL is not implemented) --FILE-- <?php var_dump( - filter_var("", FILTER_DEFAULT), + filter_var("", FILTER_DEFAULT), filter_var("", FILTER_DEFAULT, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL)) ); ?> diff --git a/ext/filter/tests/bug7715.phpt b/ext/filter/tests/bug7715.phpt index 2f7766587d..0bb412c90a 100644 --- a/ext/filter/tests/bug7715.phpt +++ b/ext/filter/tests/bug7715.phpt @@ -7,18 +7,18 @@ precision=14 --FILE-- <?php $data = array( - '.23', - '-42', - '+42', - '.4', - '-.4', - '1000000000000', - '-1000000000000', - '02.324' + '.23', + '-42', + '+42', + '.4', + '-.4', + '1000000000000', + '-1000000000000', + '02.324' ); foreach ($data as $val) { - $res = filter_var($val, FILTER_VALIDATE_FLOAT); - var_dump($res); + $res = filter_var($val, FILTER_VALIDATE_FLOAT); + var_dump($res); } echo "\n"; ?> diff --git a/ext/filter/tests/bug7733.phpt b/ext/filter/tests/bug7733.phpt index 11fce11232..62421b3b90 100644 --- a/ext/filter/tests/bug7733.phpt +++ b/ext/filter/tests/bug7733.phpt @@ -5,12 +5,12 @@ filter_var() Float exponential weird result --FILE-- <?php $data = array( - 'E2', - '10E', - '2E-', - 'E-2', - '+E2' - ); + 'E2', + '10E', + '2E-', + 'E-2', + '+E2' + ); $out = filter_var($data, FILTER_VALIDATE_FLOAT, FILTER_REQUIRE_ARRAY); var_dump($out); ?> diff --git a/ext/filter/tests/callback_closure.phpt b/ext/filter/tests/callback_closure.phpt index 0ece4ab285..2c18abefde 100644 --- a/ext/filter/tests/callback_closure.phpt +++ b/ext/filter/tests/callback_closure.phpt @@ -5,7 +5,7 @@ callback function is a closure --FILE-- <?php $callback = function ($var) { - return $var; + return $var; }; $var = "test"; var_dump(filter_var($var, FILTER_CALLBACK, array('options'=> $callback))); diff --git a/ext/filter/tests/callback_non_modified_var.phpt b/ext/filter/tests/callback_non_modified_var.phpt index e546fcc89d..22dc8b36de 100644 --- a/ext/filter/tests/callback_non_modified_var.phpt +++ b/ext/filter/tests/callback_non_modified_var.phpt @@ -5,7 +5,7 @@ callback function returns non modified value --FILE-- <?php function callback($var) { - return $var; + return $var; } $var = "test"; var_dump(filter_var($var, FILTER_CALLBACK, array('options'=>'callback'))); diff --git a/ext/filter/tests/filter_ipv4_rfc6890.phpt b/ext/filter/tests/filter_ipv4_rfc6890.phpt index a55bb36c30..a8edb048f6 100644 --- a/ext/filter/tests/filter_ipv4_rfc6890.phpt +++ b/ext/filter/tests/filter_ipv4_rfc6890.phpt @@ -20,10 +20,10 @@ $privateRanges['172.16.0.0/12'] = array('172.16.0.0', '172.31.0.0'); $privateRanges['192.168.0.0/16'] = array('192.168.0.0', '192.168.255.255'); foreach ($privateRanges as $key => $range) { - list($min, $max) = $range; - var_dump($key); - var_dump(filter_var($min, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE)); - var_dump(filter_var($max, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE)); + list($min, $max) = $range; + var_dump($key); + var_dump(filter_var($min, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE)); + var_dump(filter_var($max, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE)); } $reservedRanges = array(); @@ -74,10 +74,10 @@ $reservedRanges['203.0.113.0/24'] = array('203.0.113.0', '203.0.113.255'); $reservedRanges['240.0.0.0/4'] = array('224.0.0.0', '255.255.255.255'); foreach ($reservedRanges as $key => $range) { - list($min, $max) = $range; - var_dump($key); - var_dump(filter_var($min, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE)); - var_dump(filter_var($max, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE)); + list($min, $max) = $range; + var_dump($key); + var_dump(filter_var($min, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE)); + var_dump(filter_var($max, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE)); } ?> diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc index ed21843f43..38599391d6 100644 --- a/ext/ftp/tests/server.inc +++ b/ext/ftp/tests/server.inc @@ -5,551 +5,551 @@ $errno = 0; $context = stream_context_create(array('ssl' => array('local_cert' => dirname(__FILE__).'/cert.pem'))); for ($i=0; $i<10 && !$socket; ++$i) { - $port = rand(50000, 65535); + $port = rand(50000, 65535); - $socket = @stream_socket_server("tcp://127.0.0.1:$port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context); + $socket = @stream_socket_server("tcp://127.0.0.1:$port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context); } //set anther random port that is not the same as $port do{ - $pasv_port = rand(50000, 65535); + $pasv_port = rand(50000, 65535); }while($pasv_port == $port); if (!$socket) { - echo "$errstr ($errno)\n"; - die("could not start/bind the ftp server\n"); + echo "$errstr ($errno)\n"; + die("could not start/bind the ftp server\n"); } $pid = pcntl_fork(); function pasv_listen($action){ - global $pasv_port, $tmp_file; - $tmp_file = 'nm2.php'; - $pid = pcntl_fork(); - if($pid === 0){ - $soc = stream_socket_server("tcp://127.0.0.1:$pasv_port"); - $fs = stream_socket_accept($soc, 3); - switch ($action) { - case 'fget': - case 'get': - //listen for 3 seconds 3 seconds - fputs($fs, "I am passive.\r\n"); - break; - case 'put': - file_put_contents($tmp_file, stream_get_contents($fs)); - break; - case 'list': - fputs($fs, "drwxr-x--- 3 owner group 4096 Jul 12 12:16 .\r\n"); - fputs($fs, "drwxr-x--- 3 owner group 4096 Jul 12 12:16 ..\r\n"); - fputs($fs, "drwxr-x--- 3 owner group 4096 Jul 12 12:16 public_ftp\r\n"); - break; - case 'list_null': - fputs($fs, "\r\n"); - break; - } - fclose($fs); - exit; - } + global $pasv_port, $tmp_file; + $tmp_file = 'nm2.php'; + $pid = pcntl_fork(); + if($pid === 0){ + $soc = stream_socket_server("tcp://127.0.0.1:$pasv_port"); + $fs = stream_socket_accept($soc, 3); + switch ($action) { + case 'fget': + case 'get': + //listen for 3 seconds 3 seconds + fputs($fs, "I am passive.\r\n"); + break; + case 'put': + file_put_contents($tmp_file, stream_get_contents($fs)); + break; + case 'list': + fputs($fs, "drwxr-x--- 3 owner group 4096 Jul 12 12:16 .\r\n"); + fputs($fs, "drwxr-x--- 3 owner group 4096 Jul 12 12:16 ..\r\n"); + fputs($fs, "drwxr-x--- 3 owner group 4096 Jul 12 12:16 public_ftp\r\n"); + break; + case 'list_null': + fputs($fs, "\r\n"); + break; + } + fclose($fs); + exit; + } } if ($pid) { - function dump_and_exit($buf) - { - var_dump($buf); - fclose($GLOBALS['s']); - exit; - } - - function anonymous() - { - return $GLOBALS['user'] === 'anonymous'; - } - - /* quick&dirty realpath() like function */ - function change_dir($dir) - { - global $cwd; - - if ($dir[0] == '/') { - $cwd = $dir; - return; - } - - $cwd = "$cwd/$dir"; - - do { - $old = $cwd; - $cwd = preg_replace('@/?[^/]+/\.\.@', '', $cwd); - } while ($old != $cwd); - - $cwd = strtr($cwd, array('//' => '/')); - if (!$cwd) $cwd = '/'; - } - - $s = stream_socket_accept($socket); - - if (!$s) die("Error accepting a new connection\n"); - - fputs($s, "220----- PHP FTP server 0.3 -----\r\n220 Service ready\r\n"); - $buf = fread($s, 2048); - - - function user_auth($buf) { - global $user, $s, $ssl, $bug37799; - - if (!empty($ssl)) { - if ($buf !== "AUTH TLS\r\n") { - fputs($s, "500 Syntax error, command unrecognized.\r\n"); - dump_and_exit($buf); - } - - if (empty($bug37799)) { - fputs($s, "234 auth type accepted\r\n"); - } else { - fputs($s, "666 dummy\r\n"); - fputs($s, "666 bogus msg\r\n"); - exit; - } - - if (!stream_socket_enable_crypto($s, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER)) { - die("SSLv23 handshake failed.\n"); - } - - if (!preg_match('/^PBSZ \d+\r\n$/', $buf = fread($s, 2048))) { - fputs($s, "501 bogus data\r\n"); - dump_and_exit($buf); - } - - fputs($s, "200 OK\r\n"); - $buf = fread($s, 2048); - - if ($buf !== "PROT P\r\n") { - fputs($s, "504 Wrong protection.\r\n"); - dump_and_exit($buf); - } - - fputs($s, "200 OK\r\n"); - - $buf = fread($s, 2048); - } - - if ($buf == "AUTH TLS\r\n") { - fputs($s, "500 not supported.\r\n"); - return ; - } else if (!preg_match('/^USER (\w+)\r\n$/', $buf, $m)) { - fputs($s, "500 Syntax error, command unrecognized.\r\n"); - dump_and_exit($buf); - } - $user = $m[1]; - if ($user !== 'user' && $user !== 'anonymous') { - fputs($s, "530 Not logged in.\r\n"); - fclose($s); - exit; - } - - if (anonymous()) { - fputs($s, "230 Anonymous user logged in\r\n"); - - } else { - fputs($s, "331 User name ok, need password\r\n"); - - if (!preg_match('/^PASS (\w+)\r\n$/', $buf = fread($s, 100), $m)) { - fputs($s, "500 Syntax error, command unrecognized.\r\n"); - dump_and_exit($buf); - } - - $pass = $m[1]; - if ($pass === 'pass') { - fputs($s, "230 User logged in\r\n"); - } else { - fputs($s, "530 Not logged in.\r\n"); - fclose($s); - exit; - } - } - } - - user_auth($buf); - - $cwd = '/'; - $num_bogus_cmds = 0; - - while($buf = fread($s, 4098)) { - if (!empty($bogus)) { - fputs($s, "502 Command not implemented (".$num_bogus_cmds++.").\r\n"); - - } else if ($buf === "HELP\r\n") { - fputs($s, "214-There is help available for the following commands:\r\n"); - fputs($s, " USER\r\n"); - fputs($s, " HELP\r\n"); - fputs($s, "214 end of list\r\n"); - - } elseif ($buf === "HELP HELP\r\n") { - fputs($s, "214 Syntax: HELP [<SP> <string>] <CRLF>\r\n"); - - } elseif ($buf === "PWD\r\n") { - fputs($s, "257 \"$cwd\" is current directory.\r\n"); - - } elseif ($buf === "CDUP\r\n") { - change_dir('..'); - fputs($s, "250 CDUP command successful.\r\n"); - - } elseif ($buf === "SYST\r\n") { - if (isset($bug27809)) { - fputs($s, "215 OS/400 is the remote operating system. The TCP/IP version is \"V5R2M0\"\r\n"); - } else { - fputs($s, "215 UNIX Type: L8.\r\n"); - } - - } elseif ($buf === "TYPE A\r\n") { - $ascii = true; - fputs($s, "200 OK\r\n"); - - } elseif ($buf === "AUTH SSL\r\n") { - $ascii = true; - fputs($s, "500 not supported\r\n"); - - } elseif ($buf === "TYPE I\r\n") { - $ascii = false; - fputs($s, "200 OK\r\n"); - - } elseif ($buf === "QUIT\r\n") { - break; - - } elseif (preg_match("~^PORT (\d+),(\d+),(\d+),(\d+),(\d+),(\d+)\r\n$~", $buf, $m)) { - $host = "$m[1].$m[2].$m[3].$m[4]"; - $port = ((int)$m[5] << 8) + (int)$m[6]; - fputs($s, "200 OK.\r\n"); - - } elseif (preg_match("~^STOR ([\w/.-]+)\r\n$~", $buf, $m)) { - fputs($s, "150 File status okay; about to open data connection\r\n"); - - if(empty($pasv)) - { - if (!$fs = stream_socket_client("tcp://$host:$port")) { - fputs($s, "425 Can't open data connection\r\n"); - continue; - } - - $data = stream_get_contents($fs); - $orig = file_get_contents(dirname(__FILE__).'/'.$m[1]); - - - if (isset($ascii) && !$ascii && $orig === $data) { - fputs($s, "226 Closing data Connection.\r\n"); - - } elseif ((!empty($ascii) || isset($bug39583)) && $data === strtr($orig, array("\r\n" => "\n", "\r" => "\n", "\n" => "\r\n"))) { - fputs($s, "226 Closing data Connection.\r\n"); - - } else { - var_dump($data); - var_dump($orig); - fputs($s, "552 Requested file action aborted.\r\n"); - } - fclose($fs); - }else{ - $data = file_get_contents('nm2.php'); - $orig = file_get_contents(dirname(__FILE__).'/'.$m[1]); - if ( $orig === $data) { - fputs($s, "226 Closing data Connection.\r\n"); - - } else { - var_dump($data); - var_dump($orig); - fputs($s, "552 Requested file action aborted.\r\n"); - } - } - - } elseif (preg_match("~^APPE ([\w/.-]+)\r\n$~", $buf, $m)) { - fputs($s, "150 File status okay; about to open data connection\r\n"); - - if(empty($pasv)) - { - if (!$fs = stream_socket_client("tcp://$host:$port")) { - fputs($s, "425 Can't open data connection\r\n"); - continue; - } - - $data = stream_get_contents($fs); - file_put_contents(__DIR__.'/'.$m[1], $data, FILE_APPEND); - fputs($s, "226 Closing data Connection.\r\n"); - fclose($fs); - }else{ - $data = stream_get_contents($fs); - file_put_contents(__DIR__.'/'.$m[1], $data, FILE_APPEND); - fputs($s, "226 Closing data Connection.\r\n"); - fclose($fs); - } - - }elseif (preg_match("~^CWD ([A-Za-z./]+)\r\n$~", $buf, $m)) { - if (isset($bug77680)) { - fputs($s, "550 Directory change to $m[1] failed: file does not exist\r\n"); - var_dump($buf); - } else { - change_dir($m[1]); - fputs($s, "250 CWD command successful.\r\n"); - } - - } elseif (preg_match("~^NLST(?: ([A-Za-z./]+))?\r\n$~", $buf, $m)) { - - if (isset($m[1]) && (($m[1] === 'bogusdir') || ($m[1] === '/bogusdir'))) { - fputs($s, "250 $m[1]: No such file or directory\r\n"); - continue; - } - - // there are some servers that don't open the ftp-data socket if there's nothing to send - if (isset($bug39458) && isset($m[1]) && $m[1] === 'emptydir') { - fputs($s, "226 Transfer complete.\r\n"); - continue; - } - - if (empty($pasv)) { - fputs($s, "150 File status okay; about to open data connection\r\n"); - if (!$fs = stream_socket_client("tcp://$host:$port")) { - fputs($s, "425 Can't open data connection\r\n"); - continue; - } - } else { - fputs($s, "125 Data connection already open; transfer starting.\r\n"); - $fs=$pasvs; - } - - - if ((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) { - die("SSLv23 handshake failed.\n"); - } - - if (empty($m[1]) || $m[1] !== 'emptydir') { - fputs($fs, "file1\r\nfile1\r\nfile\nb0rk\r\n"); - } - - fputs($s, "226 Closing data Connection.\r\n"); - fclose($fs); - - } elseif (preg_match("~^MKD ([A-Za-z./]+)\r\n$~", $buf, $m)) { - if (isset($bug7216)) { - fputs($s, "257 OK.\r\n"); - } else { - if (isset($bug77680)) { - var_dump($buf); - } - fputs($s, "257 \"/path/to/ftproot$cwd$m[1]\" created.\r\n"); - } - - } elseif (preg_match('/^USER /', $buf)) { - user_auth($buf); - - } elseif (preg_match('/^MDTM ([\w\h]+)/', $buf, $matches)) { - switch ($matches [1]){ - case "A": - fputs($s, "213 19980615100045.014\r\n"); - break; - case "B": - fputs($s, "213 19980615100045.014\r\n"); - break; - case "C": - fputs($s, "213 19980705132316\r\n"); - break; - case "19990929043300 File6": - fputs($s, "213 19991005213102\r\n"); - break; - default : - fputs($s, "550 No file named \"{$matches [1]}\"\r\n"); - break; - } - }elseif (preg_match('/^RETR ([\/]*[\w\h]+)/', $buf, $matches)) { - if(!empty($pasv)){ - ; - } - else if (!$fs = stream_socket_client("tcp://$host:$port")) { - fputs($s, "425 Can't open data connection\r\n"); - continue; - } - - switch($matches[1]){ - - case "pasv": - fputs($s, "150 File status okay; about to open data connection.\r\n"); - //the data connection is handled in another forked process - // called from outside this while loop - fputs($s, "226 Closing data Connection.\r\n"); - break; - case "a story": - fputs($s, "150 File status okay; about to open data connection.\r\n"); - fputs($fs, "For sale: baby shoes, never worn.\r\n"); - fputs($s, "226 Closing data Connection.\r\n"); - break; - case "binary data": - fputs($s, "150 File status okay; about to open data connection.\r\n"); - $transfer_type = $ascii? 'ASCII' : 'BINARY' ; - fputs($fs, $transfer_type."Foo\0Bar\r\n"); - fputs($s, "226 Closing data Connection.\r\n"); - break; - case "fget": - fputs($s, "150 File status okay; about to open data connection.\r\n"); - $transfer_type = $ascii? 'ASCII' : 'BINARY' ; - fputs($fs, $transfer_type."FooBar\r\n"); - fputs($s, "226 Closing data Connection.\r\n"); - break; - case "fgetresume": - fputs($s, "150 File status okay; about to open data connection.\r\n"); - $transfer_type = $ascii? 'ASCII' : 'BINARY' ; - fputs($fs, "Bar\r\n"); - fputs($s, "226 Closing data Connection.\r\n"); - break; - case "fget_large": - fputs($s, "150 File status okay; about to open data connection.\r\n"); - $transfer_type = $ascii? 'ASCII' : 'BINARY' ; - if ($GLOBALS['rest_pos'] == '5368709119') { - fputs($fs, "X"); - } else { - fputs($fs, "Y"); - } - fputs($s, "226 Closing data Connection.\r\n"); - break; - case "mediumfile": - fputs($s, "150 File status okay; about to open data connection.\r\n"); - for($i = 0; $i < 150; $i++){ - fputs($fs, "This is line $i of the test data.\n"); - } - fputs($s, "226 Closing data Connection.\r\n"); - break; - case "/bug73457": - fputs($s, "150 File status okay; about to open data connection.\r\n"); - break; - - default: - fputs($s, "550 {$matches[1]}: No such file or directory \r\n"); - break; - } - if(isset($fs)) - fclose($fs); - - - }elseif (preg_match('/^PASV/', $buf, $matches)) { - $pasv=true; - $host = "127.0.0.1"; - $i=0; - - if (empty($bug73457)) { - do { - if (!empty($ssl)) { - $soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context); - } else { - $soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port"); - } - /* Could bind port, Try another port */ - if (!$soc) { - $pasv_port = rand(50000, 65535); - } - $i++; - } while ($i<10 && !$soc); - - if (!$soc) { - echo "$errstr ($errno)\n"; - die("could not bind passive port\n"); - } - } else { - $pasv_port=1234; - } - - $p2 = $pasv_port % ((int) 1 << 8); - $p1 = ($pasv_port-$p2)/((int) 1 << 8); - fputs($s, "227 Entering Passive Mode. (127,0,0,1,{$p1},{$p2})\r\n"); + function dump_and_exit($buf) + { + var_dump($buf); + fclose($GLOBALS['s']); + exit; + } + + function anonymous() + { + return $GLOBALS['user'] === 'anonymous'; + } + + /* quick&dirty realpath() like function */ + function change_dir($dir) + { + global $cwd; + + if ($dir[0] == '/') { + $cwd = $dir; + return; + } + + $cwd = "$cwd/$dir"; + + do { + $old = $cwd; + $cwd = preg_replace('@/?[^/]+/\.\.@', '', $cwd); + } while ($old != $cwd); + + $cwd = strtr($cwd, array('//' => '/')); + if (!$cwd) $cwd = '/'; + } + + $s = stream_socket_accept($socket); + + if (!$s) die("Error accepting a new connection\n"); + + fputs($s, "220----- PHP FTP server 0.3 -----\r\n220 Service ready\r\n"); + $buf = fread($s, 2048); + + + function user_auth($buf) { + global $user, $s, $ssl, $bug37799; + + if (!empty($ssl)) { + if ($buf !== "AUTH TLS\r\n") { + fputs($s, "500 Syntax error, command unrecognized.\r\n"); + dump_and_exit($buf); + } + + if (empty($bug37799)) { + fputs($s, "234 auth type accepted\r\n"); + } else { + fputs($s, "666 dummy\r\n"); + fputs($s, "666 bogus msg\r\n"); + exit; + } + + if (!stream_socket_enable_crypto($s, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER)) { + die("SSLv23 handshake failed.\n"); + } + + if (!preg_match('/^PBSZ \d+\r\n$/', $buf = fread($s, 2048))) { + fputs($s, "501 bogus data\r\n"); + dump_and_exit($buf); + } + + fputs($s, "200 OK\r\n"); + $buf = fread($s, 2048); + + if ($buf !== "PROT P\r\n") { + fputs($s, "504 Wrong protection.\r\n"); + dump_and_exit($buf); + } + + fputs($s, "200 OK\r\n"); + + $buf = fread($s, 2048); + } + + if ($buf == "AUTH TLS\r\n") { + fputs($s, "500 not supported.\r\n"); + return ; + } else if (!preg_match('/^USER (\w+)\r\n$/', $buf, $m)) { + fputs($s, "500 Syntax error, command unrecognized.\r\n"); + dump_and_exit($buf); + } + $user = $m[1]; + if ($user !== 'user' && $user !== 'anonymous') { + fputs($s, "530 Not logged in.\r\n"); + fclose($s); + exit; + } + + if (anonymous()) { + fputs($s, "230 Anonymous user logged in\r\n"); + + } else { + fputs($s, "331 User name ok, need password\r\n"); + + if (!preg_match('/^PASS (\w+)\r\n$/', $buf = fread($s, 100), $m)) { + fputs($s, "500 Syntax error, command unrecognized.\r\n"); + dump_and_exit($buf); + } + + $pass = $m[1]; + if ($pass === 'pass') { + fputs($s, "230 User logged in\r\n"); + } else { + fputs($s, "530 Not logged in.\r\n"); + fclose($s); + exit; + } + } + } + + user_auth($buf); + + $cwd = '/'; + $num_bogus_cmds = 0; + + while($buf = fread($s, 4098)) { + if (!empty($bogus)) { + fputs($s, "502 Command not implemented (".$num_bogus_cmds++.").\r\n"); + + } else if ($buf === "HELP\r\n") { + fputs($s, "214-There is help available for the following commands:\r\n"); + fputs($s, " USER\r\n"); + fputs($s, " HELP\r\n"); + fputs($s, "214 end of list\r\n"); + + } elseif ($buf === "HELP HELP\r\n") { + fputs($s, "214 Syntax: HELP [<SP> <string>] <CRLF>\r\n"); + + } elseif ($buf === "PWD\r\n") { + fputs($s, "257 \"$cwd\" is current directory.\r\n"); + + } elseif ($buf === "CDUP\r\n") { + change_dir('..'); + fputs($s, "250 CDUP command successful.\r\n"); + + } elseif ($buf === "SYST\r\n") { + if (isset($bug27809)) { + fputs($s, "215 OS/400 is the remote operating system. The TCP/IP version is \"V5R2M0\"\r\n"); + } else { + fputs($s, "215 UNIX Type: L8.\r\n"); + } + + } elseif ($buf === "TYPE A\r\n") { + $ascii = true; + fputs($s, "200 OK\r\n"); + + } elseif ($buf === "AUTH SSL\r\n") { + $ascii = true; + fputs($s, "500 not supported\r\n"); + + } elseif ($buf === "TYPE I\r\n") { + $ascii = false; + fputs($s, "200 OK\r\n"); + + } elseif ($buf === "QUIT\r\n") { + break; + + } elseif (preg_match("~^PORT (\d+),(\d+),(\d+),(\d+),(\d+),(\d+)\r\n$~", $buf, $m)) { + $host = "$m[1].$m[2].$m[3].$m[4]"; + $port = ((int)$m[5] << 8) + (int)$m[6]; + fputs($s, "200 OK.\r\n"); + + } elseif (preg_match("~^STOR ([\w/.-]+)\r\n$~", $buf, $m)) { + fputs($s, "150 File status okay; about to open data connection\r\n"); + + if(empty($pasv)) + { + if (!$fs = stream_socket_client("tcp://$host:$port")) { + fputs($s, "425 Can't open data connection\r\n"); + continue; + } + + $data = stream_get_contents($fs); + $orig = file_get_contents(dirname(__FILE__).'/'.$m[1]); + + + if (isset($ascii) && !$ascii && $orig === $data) { + fputs($s, "226 Closing data Connection.\r\n"); + + } elseif ((!empty($ascii) || isset($bug39583)) && $data === strtr($orig, array("\r\n" => "\n", "\r" => "\n", "\n" => "\r\n"))) { + fputs($s, "226 Closing data Connection.\r\n"); + + } else { + var_dump($data); + var_dump($orig); + fputs($s, "552 Requested file action aborted.\r\n"); + } + fclose($fs); + }else{ + $data = file_get_contents('nm2.php'); + $orig = file_get_contents(dirname(__FILE__).'/'.$m[1]); + if ( $orig === $data) { + fputs($s, "226 Closing data Connection.\r\n"); + + } else { + var_dump($data); + var_dump($orig); + fputs($s, "552 Requested file action aborted.\r\n"); + } + } + + } elseif (preg_match("~^APPE ([\w/.-]+)\r\n$~", $buf, $m)) { + fputs($s, "150 File status okay; about to open data connection\r\n"); + + if(empty($pasv)) + { + if (!$fs = stream_socket_client("tcp://$host:$port")) { + fputs($s, "425 Can't open data connection\r\n"); + continue; + } + + $data = stream_get_contents($fs); + file_put_contents(__DIR__.'/'.$m[1], $data, FILE_APPEND); + fputs($s, "226 Closing data Connection.\r\n"); + fclose($fs); + }else{ + $data = stream_get_contents($fs); + file_put_contents(__DIR__.'/'.$m[1], $data, FILE_APPEND); + fputs($s, "226 Closing data Connection.\r\n"); + fclose($fs); + } + + }elseif (preg_match("~^CWD ([A-Za-z./]+)\r\n$~", $buf, $m)) { + if (isset($bug77680)) { + fputs($s, "550 Directory change to $m[1] failed: file does not exist\r\n"); + var_dump($buf); + } else { + change_dir($m[1]); + fputs($s, "250 CWD command successful.\r\n"); + } + + } elseif (preg_match("~^NLST(?: ([A-Za-z./]+))?\r\n$~", $buf, $m)) { + + if (isset($m[1]) && (($m[1] === 'bogusdir') || ($m[1] === '/bogusdir'))) { + fputs($s, "250 $m[1]: No such file or directory\r\n"); + continue; + } + + // there are some servers that don't open the ftp-data socket if there's nothing to send + if (isset($bug39458) && isset($m[1]) && $m[1] === 'emptydir') { + fputs($s, "226 Transfer complete.\r\n"); + continue; + } + + if (empty($pasv)) { + fputs($s, "150 File status okay; about to open data connection\r\n"); + if (!$fs = stream_socket_client("tcp://$host:$port")) { + fputs($s, "425 Can't open data connection\r\n"); + continue; + } + } else { + fputs($s, "125 Data connection already open; transfer starting.\r\n"); + $fs=$pasvs; + } + + + if ((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) { + die("SSLv23 handshake failed.\n"); + } + + if (empty($m[1]) || $m[1] !== 'emptydir') { + fputs($fs, "file1\r\nfile1\r\nfile\nb0rk\r\n"); + } + + fputs($s, "226 Closing data Connection.\r\n"); + fclose($fs); + + } elseif (preg_match("~^MKD ([A-Za-z./]+)\r\n$~", $buf, $m)) { + if (isset($bug7216)) { + fputs($s, "257 OK.\r\n"); + } else { + if (isset($bug77680)) { + var_dump($buf); + } + fputs($s, "257 \"/path/to/ftproot$cwd$m[1]\" created.\r\n"); + } + + } elseif (preg_match('/^USER /', $buf)) { + user_auth($buf); + + } elseif (preg_match('/^MDTM ([\w\h]+)/', $buf, $matches)) { + switch ($matches [1]){ + case "A": + fputs($s, "213 19980615100045.014\r\n"); + break; + case "B": + fputs($s, "213 19980615100045.014\r\n"); + break; + case "C": + fputs($s, "213 19980705132316\r\n"); + break; + case "19990929043300 File6": + fputs($s, "213 19991005213102\r\n"); + break; + default : + fputs($s, "550 No file named \"{$matches [1]}\"\r\n"); + break; + } + }elseif (preg_match('/^RETR ([\/]*[\w\h]+)/', $buf, $matches)) { + if(!empty($pasv)){ + ; + } + else if (!$fs = stream_socket_client("tcp://$host:$port")) { + fputs($s, "425 Can't open data connection\r\n"); + continue; + } + + switch($matches[1]){ + + case "pasv": + fputs($s, "150 File status okay; about to open data connection.\r\n"); + //the data connection is handled in another forked process + // called from outside this while loop + fputs($s, "226 Closing data Connection.\r\n"); + break; + case "a story": + fputs($s, "150 File status okay; about to open data connection.\r\n"); + fputs($fs, "For sale: baby shoes, never worn.\r\n"); + fputs($s, "226 Closing data Connection.\r\n"); + break; + case "binary data": + fputs($s, "150 File status okay; about to open data connection.\r\n"); + $transfer_type = $ascii? 'ASCII' : 'BINARY' ; + fputs($fs, $transfer_type."Foo\0Bar\r\n"); + fputs($s, "226 Closing data Connection.\r\n"); + break; + case "fget": + fputs($s, "150 File status okay; about to open data connection.\r\n"); + $transfer_type = $ascii? 'ASCII' : 'BINARY' ; + fputs($fs, $transfer_type."FooBar\r\n"); + fputs($s, "226 Closing data Connection.\r\n"); + break; + case "fgetresume": + fputs($s, "150 File status okay; about to open data connection.\r\n"); + $transfer_type = $ascii? 'ASCII' : 'BINARY' ; + fputs($fs, "Bar\r\n"); + fputs($s, "226 Closing data Connection.\r\n"); + break; + case "fget_large": + fputs($s, "150 File status okay; about to open data connection.\r\n"); + $transfer_type = $ascii? 'ASCII' : 'BINARY' ; + if ($GLOBALS['rest_pos'] == '5368709119') { + fputs($fs, "X"); + } else { + fputs($fs, "Y"); + } + fputs($s, "226 Closing data Connection.\r\n"); + break; + case "mediumfile": + fputs($s, "150 File status okay; about to open data connection.\r\n"); + for($i = 0; $i < 150; $i++){ + fputs($fs, "This is line $i of the test data.\n"); + } + fputs($s, "226 Closing data Connection.\r\n"); + break; + case "/bug73457": + fputs($s, "150 File status okay; about to open data connection.\r\n"); + break; + + default: + fputs($s, "550 {$matches[1]}: No such file or directory \r\n"); + break; + } + if(isset($fs)) + fclose($fs); + + + }elseif (preg_match('/^PASV/', $buf, $matches)) { + $pasv=true; + $host = "127.0.0.1"; + $i=0; + + if (empty($bug73457)) { + do { + if (!empty($ssl)) { + $soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context); + } else { + $soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port"); + } + /* Could bind port, Try another port */ + if (!$soc) { + $pasv_port = rand(50000, 65535); + } + $i++; + } while ($i<10 && !$soc); + + if (!$soc) { + echo "$errstr ($errno)\n"; + die("could not bind passive port\n"); + } + } else { + $pasv_port=1234; + } + + $p2 = $pasv_port % ((int) 1 << 8); + $p1 = ($pasv_port-$p2)/((int) 1 << 8); + fputs($s, "227 Entering Passive Mode. (127,0,0,1,{$p1},{$p2})\r\n"); if (empty($bug73457)) { $pasvs = stream_socket_accept($soc,10); } - } elseif (preg_match('/^EPSV/', $buf, $matches)) { - fputs($s, "550 Extended passsive mode not supported.\r\n"); - } elseif (preg_match('/^SITE EXEC/', $buf, $matches)) { - fputs($s, "200 OK\r\n"); - - } elseif (preg_match('/^RMD/', $buf, $matches)) { - fputs($s, "250 OK\r\n"); - - } elseif (preg_match('/^SITE CHMOD/', $buf, $matches)) { - fputs($s, "200 OK\r\n"); - - } elseif (preg_match('/^DELE ([\w\h]+)/', $buf, $matches)) { - if (isset($matches[1]) && in_array($matches[1], ['file1', "file\nb0rk"])){ - fputs($s, "250 Delete successful\r\n"); - } else { - fputs($s, "550 No such file or directory\r\n"); - } - } elseif (preg_match('/^ALLO (\d+)/', $buf, $matches)) { - fputs($s, "200 " . $matches[1] . " bytes allocated\r\n"); - - }elseif (preg_match('/^LIST www\//', $buf, $matches)) { - fputs($s, "226 Transfer complete\r\n"); - - }elseif (preg_match('/^LIST no_exists\//', $buf, $matches)) { - fputs($s, "425 Error establishing connection\r\n"); - - }elseif (preg_match('/^REST (\d+)/', $buf, $matches)) { - $GLOBALS['rest_pos'] = $matches[1]; - fputs($s, "350 OK\r\n"); - }elseif (preg_match('/^SIZE largefile/', $buf)) { - fputs($s, "213 5368709120\r\n"); - }elseif (preg_match('/^RNFR existing_file/', $buf, $matches)) { - fputs($s, "350 File or directory exists, ready for destination name\r\n"); - }elseif (preg_match('/^RNFR nonexisting_file/', $buf, $matches)) { - fputs($s, "550 No such file or directory\r\n"); - }elseif (preg_match('/^RNTO nonexisting_file/', $buf, $matches)) { - fputs($s, "250 Rename successful\r\n"); - }elseif (preg_match('/^MLSD no_exists\//', $buf, $matches)) { - fputs($s, "425 Error establishing connection\r\n"); - }elseif (preg_match("~^MLSD(?: ([A-Za-z./]+))?\r\n$~", $buf, $m)) { - - if(isset($m[1]) && (($m[1] === 'bogusdir') || ($m[1] === '/bogusdir'))) { - fputs($s, "250 $m[1]: No such file or directory\r\n"); - continue; - } - - // there are some servers that don't open the ftp-data socket if there's nothing to send - if(isset($bug39458) && isset($m[1]) && $m[1] === 'emptydir') { - fputs($s, "226 Transfer complete.\r\n"); - continue; - } - - if(empty($pasv)) { - fputs($s, "150 File status okay; about to open data connection\r\n"); - if(!$fs = stream_socket_client("tcp://$host:$port")) { - fputs($s, "425 Can't open data connection\r\n"); - continue; - } - } else { - fputs($s, "125 Data connection already open; transfer starting.\r\n"); - $fs = $pasvs; - } - - if((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, TRUE, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) { - die("SSLv23 handshake failed.\n"); - } - - if(empty($m[1]) || $m[1] !== 'emptydir') { - fputs($fs, "modify=20170127230002;perm=flcdmpe;type=cdir;unique=811U4340002;UNIX.group=33;UNIX.mode=0755;UNIX.owner=33; .\r\n"); - fputs($fs, "modify=20170127230002;perm=flcdmpe;type=pdir;unique=811U4340002;UNIX.group=33;UNIX.mode=0755;UNIX.owner=33; ..\r\n"); - fputs($fs, "modify=20170126121225;perm=adfrw;size=4729;type=file;unique=811U4340CB9;UNIX.group=33;UNIX.mode=0644;UNIX.owner=33; foobar\r\n"); - fputs($fs, "fact=val=ue;empty=; path;name\r\n"); - fputs($fs, "no_space\r\n"); - fputs($fs, "no_semi pathname\r\n"); - fputs($fs, "no_eq; pathname\r\n"); - } - - fputs($s, "226 Closing data Connection.\r\n"); - fclose($fs); - }elseif (preg_match('/^SIZE \/bug73457/', $buf)) { - fputs($s, "213 10\r\n"); - }elseif (preg_match("/^SITE/", $buf)) { - fputs($s, "500 Syntax error, command unrecognized.\r\n"); - }else { - dump_and_exit($buf); - } - } - fclose($s); - exit; + } elseif (preg_match('/^EPSV/', $buf, $matches)) { + fputs($s, "550 Extended passsive mode not supported.\r\n"); + } elseif (preg_match('/^SITE EXEC/', $buf, $matches)) { + fputs($s, "200 OK\r\n"); + + } elseif (preg_match('/^RMD/', $buf, $matches)) { + fputs($s, "250 OK\r\n"); + + } elseif (preg_match('/^SITE CHMOD/', $buf, $matches)) { + fputs($s, "200 OK\r\n"); + + } elseif (preg_match('/^DELE ([\w\h]+)/', $buf, $matches)) { + if (isset($matches[1]) && in_array($matches[1], ['file1', "file\nb0rk"])){ + fputs($s, "250 Delete successful\r\n"); + } else { + fputs($s, "550 No such file or directory\r\n"); + } + } elseif (preg_match('/^ALLO (\d+)/', $buf, $matches)) { + fputs($s, "200 " . $matches[1] . " bytes allocated\r\n"); + + }elseif (preg_match('/^LIST www\//', $buf, $matches)) { + fputs($s, "226 Transfer complete\r\n"); + + }elseif (preg_match('/^LIST no_exists\//', $buf, $matches)) { + fputs($s, "425 Error establishing connection\r\n"); + + }elseif (preg_match('/^REST (\d+)/', $buf, $matches)) { + $GLOBALS['rest_pos'] = $matches[1]; + fputs($s, "350 OK\r\n"); + }elseif (preg_match('/^SIZE largefile/', $buf)) { + fputs($s, "213 5368709120\r\n"); + }elseif (preg_match('/^RNFR existing_file/', $buf, $matches)) { + fputs($s, "350 File or directory exists, ready for destination name\r\n"); + }elseif (preg_match('/^RNFR nonexisting_file/', $buf, $matches)) { + fputs($s, "550 No such file or directory\r\n"); + }elseif (preg_match('/^RNTO nonexisting_file/', $buf, $matches)) { + fputs($s, "250 Rename successful\r\n"); + }elseif (preg_match('/^MLSD no_exists\//', $buf, $matches)) { + fputs($s, "425 Error establishing connection\r\n"); + }elseif (preg_match("~^MLSD(?: ([A-Za-z./]+))?\r\n$~", $buf, $m)) { + + if(isset($m[1]) && (($m[1] === 'bogusdir') || ($m[1] === '/bogusdir'))) { + fputs($s, "250 $m[1]: No such file or directory\r\n"); + continue; + } + + // there are some servers that don't open the ftp-data socket if there's nothing to send + if(isset($bug39458) && isset($m[1]) && $m[1] === 'emptydir') { + fputs($s, "226 Transfer complete.\r\n"); + continue; + } + + if(empty($pasv)) { + fputs($s, "150 File status okay; about to open data connection\r\n"); + if(!$fs = stream_socket_client("tcp://$host:$port")) { + fputs($s, "425 Can't open data connection\r\n"); + continue; + } + } else { + fputs($s, "125 Data connection already open; transfer starting.\r\n"); + $fs = $pasvs; + } + + if((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, TRUE, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) { + die("SSLv23 handshake failed.\n"); + } + + if(empty($m[1]) || $m[1] !== 'emptydir') { + fputs($fs, "modify=20170127230002;perm=flcdmpe;type=cdir;unique=811U4340002;UNIX.group=33;UNIX.mode=0755;UNIX.owner=33; .\r\n"); + fputs($fs, "modify=20170127230002;perm=flcdmpe;type=pdir;unique=811U4340002;UNIX.group=33;UNIX.mode=0755;UNIX.owner=33; ..\r\n"); + fputs($fs, "modify=20170126121225;perm=adfrw;size=4729;type=file;unique=811U4340CB9;UNIX.group=33;UNIX.mode=0644;UNIX.owner=33; foobar\r\n"); + fputs($fs, "fact=val=ue;empty=; path;name\r\n"); + fputs($fs, "no_space\r\n"); + fputs($fs, "no_semi pathname\r\n"); + fputs($fs, "no_eq; pathname\r\n"); + } + + fputs($s, "226 Closing data Connection.\r\n"); + fclose($fs); + }elseif (preg_match('/^SIZE \/bug73457/', $buf)) { + fputs($s, "213 10\r\n"); + }elseif (preg_match("/^SITE/", $buf)) { + fputs($s, "500 Syntax error, command unrecognized.\r\n"); + }else { + dump_and_exit($buf); + } + } + fclose($s); + exit; } fclose($socket); diff --git a/ext/gd/tests/bug22544-mb.phpt b/ext/gd/tests/bug22544-mb.phpt index 0847214dc3..ae347edd70 100644 --- a/ext/gd/tests/bug22544-mb.phpt +++ b/ext/gd/tests/bug22544-mb.phpt @@ -8,13 +8,13 @@ Bug #22544 (TrueColor transparency in PNG images). ?> --FILE-- <?php - $image = imageCreateTruecolor(640, 100); - $transparent = imageColorAllocate($image, 0, 0, 0); - $red = imageColorAllocate($image, 255, 50, 50); - imageColorTransparent($image, $transparent); - imageFilledRectangle($image, 0, 0, 640-1, 100-1, $transparent); - include_once __DIR__ . '/func.inc'; - test_image_equals_file(__DIR__ . '/bug22544ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.png', $image); + $image = imageCreateTruecolor(640, 100); + $transparent = imageColorAllocate($image, 0, 0, 0); + $red = imageColorAllocate($image, 255, 50, 50); + imageColorTransparent($image, $transparent); + imageFilledRectangle($image, 0, 0, 640-1, 100-1, $transparent); + include_once __DIR__ . '/func.inc'; + test_image_equals_file(__DIR__ . '/bug22544ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.png', $image); ?> --EXPECT-- The images are equal. diff --git a/ext/gd/tests/bug22544.phpt b/ext/gd/tests/bug22544.phpt index 3d4335d461..c7b1e91966 100644 --- a/ext/gd/tests/bug22544.phpt +++ b/ext/gd/tests/bug22544.phpt @@ -8,13 +8,13 @@ Bug #22544 (TrueColor transparency in PNG images). ?> --FILE-- <?php - $image = imageCreateTruecolor(640, 100); - $transparent = imageColorAllocate($image, 0, 0, 0); - $red = imageColorAllocate($image, 255, 50, 50); - imageColorTransparent($image, $transparent); - imageFilledRectangle($image, 0, 0, 640-1, 100-1, $transparent); - include_once __DIR__ . '/func.inc'; - test_image_equals_file(__DIR__ . '/bug22544.png', $image); + $image = imageCreateTruecolor(640, 100); + $transparent = imageColorAllocate($image, 0, 0, 0); + $red = imageColorAllocate($image, 255, 50, 50); + imageColorTransparent($image, $transparent); + imageFilledRectangle($image, 0, 0, 640-1, 100-1, $transparent); + include_once __DIR__ . '/func.inc'; + test_image_equals_file(__DIR__ . '/bug22544.png', $image); ?> --EXPECT-- The images are equal. diff --git a/ext/gd/tests/bug24155.phpt b/ext/gd/tests/bug24155.phpt index 43d34b7177..ff4f40fdec 100644 --- a/ext/gd/tests/bug24155.phpt +++ b/ext/gd/tests/bug24155.phpt @@ -9,22 +9,22 @@ Bug #24155 (gdImageRotate270 rotation problem). ?> --FILE-- <?php - $dest = dirname(realpath(__FILE__)) . '/bug24155.png'; - @unlink($dest); + $dest = dirname(realpath(__FILE__)) . '/bug24155.png'; + @unlink($dest); - $im = imagecreatetruecolor(30, 50); - imagefill($im, 0, 0, (16777215 - 255)); - $im = imagerotate($im, 270, 255); - imagepng($im, $dest); + $im = imagecreatetruecolor(30, 50); + imagefill($im, 0, 0, (16777215 - 255)); + $im = imagerotate($im, 270, 255); + imagepng($im, $dest); - $im2 = imagecreatefrompng($dest); + $im2 = imagecreatefrompng($dest); - // Uniform fill + n x 90degrees rotation , the color value does not change - $col = imagecolorat($im2, 20, 20); - // 16777215 - 255 = 16776960 - echo "$col\n"; + // Uniform fill + n x 90degrees rotation , the color value does not change + $col = imagecolorat($im2, 20, 20); + // 16777215 - 255 = 16776960 + echo "$col\n"; - @unlink($dest); + @unlink($dest); ?> --EXPECT-- 16776960 diff --git a/ext/gd/tests/bug24594.phpt b/ext/gd/tests/bug24594.phpt index f4006497c6..138258cbbc 100644 --- a/ext/gd/tests/bug24594.phpt +++ b/ext/gd/tests/bug24594.phpt @@ -8,74 +8,74 @@ Bug #24594 (Filling an area using tiles). ?> --FILE-- <?php - $tile = imagecreate(36,36); - $base = imagecreate(150,150); - $white = imagecolorallocate($tile,255,255,255); - $black = imagecolorallocate($tile,0,0,0); - $white = imagecolorallocate($base,255,255,255); - $black = imagecolorallocate($base,0,0,0); + $tile = imagecreate(36,36); + $base = imagecreate(150,150); + $white = imagecolorallocate($tile,255,255,255); + $black = imagecolorallocate($tile,0,0,0); + $white = imagecolorallocate($base,255,255,255); + $black = imagecolorallocate($base,0,0,0); - /* create the dots pattern */ - for ($x=0;$x<36;$x+=2) { - for ($y=0;$y<36;$y+=2) { - imagesetpixel($tile,$x,$y,$black); - } - } + /* create the dots pattern */ + for ($x=0;$x<36;$x+=2) { + for ($y=0;$y<36;$y+=2) { + imagesetpixel($tile,$x,$y,$black); + } + } - imagesettile($base,$tile); - imagerectangle($base, 9,9,139,139,$black); - imageline($base, 9,9,139,139,$black); - imagefill($base,11,12,IMG_COLOR_TILED); + imagesettile($base,$tile); + imagerectangle($base, 9,9,139,139,$black); + imageline($base, 9,9,139,139,$black); + imagefill($base,11,12,IMG_COLOR_TILED); - $res = imagecolorat($base,0,10)==$black?'1':'0'; - $res .= imagecolorat($base,0,20)==$black?'1':'0'; - $res .= imagecolorat($base,0,30)==$black?'1':'0'; - $res .= imagecolorat($base,0,40)==$black?'1':'0'; - $res .= imagecolorat($base,0,50)==$black?'1':'0'; - $res .= imagecolorat($base,0,60)==$black?'1':'0'; + $res = imagecolorat($base,0,10)==$black?'1':'0'; + $res .= imagecolorat($base,0,20)==$black?'1':'0'; + $res .= imagecolorat($base,0,30)==$black?'1':'0'; + $res .= imagecolorat($base,0,40)==$black?'1':'0'; + $res .= imagecolorat($base,0,50)==$black?'1':'0'; + $res .= imagecolorat($base,0,60)==$black?'1':'0'; - $res .= imagecolorat($base,11,12)==$white?'1':'0'; - $res .= imagecolorat($base,12,13)==$white?'1':'0'; - $res .= imagecolorat($base,13,14)==$white?'1':'0'; - $res .= imagecolorat($base,14,15)==$white?'1':'0'; - $res .= imagecolorat($base,15,16)==$white?'1':'0'; - $res .= imagecolorat($base,16,17)==$white?'1':'0'; + $res .= imagecolorat($base,11,12)==$white?'1':'0'; + $res .= imagecolorat($base,12,13)==$white?'1':'0'; + $res .= imagecolorat($base,13,14)==$white?'1':'0'; + $res .= imagecolorat($base,14,15)==$white?'1':'0'; + $res .= imagecolorat($base,15,16)==$white?'1':'0'; + $res .= imagecolorat($base,16,17)==$white?'1':'0'; - $res .= imagecolorat($base,10,12)==$black?'1':'0'; - $res .= imagecolorat($base,11,13)==$black?'1':'0'; - $res .= imagecolorat($base,12,14)==$black?'1':'0'; - $res .= imagecolorat($base,13,15)==$black?'1':'0'; - $res .= imagecolorat($base,14,16)==$black?'1':'0'; - $res .= imagecolorat($base,15,17)==$black?'1':'0'; - echo "$res\n"; + $res .= imagecolorat($base,10,12)==$black?'1':'0'; + $res .= imagecolorat($base,11,13)==$black?'1':'0'; + $res .= imagecolorat($base,12,14)==$black?'1':'0'; + $res .= imagecolorat($base,13,15)==$black?'1':'0'; + $res .= imagecolorat($base,14,16)==$black?'1':'0'; + $res .= imagecolorat($base,15,17)==$black?'1':'0'; + echo "$res\n"; - imagefilledrectangle($base,0,0,149,149,$white); - imagerectangle($base, 9,9,139,139,$black); - imageline($base, 9,9,139,139,$black); - imagefill($base,0,0,IMG_COLOR_TILED); + imagefilledrectangle($base,0,0,149,149,$white); + imagerectangle($base, 9,9,139,139,$black); + imageline($base, 9,9,139,139,$black); + imagefill($base,0,0,IMG_COLOR_TILED); - $res = imagecolorat($base,0,10)==$black?'1':'0'; - $res .= imagecolorat($base,0,20)==$black?'1':'0'; - $res .= imagecolorat($base,0,30)==$black?'1':'0'; - $res .= imagecolorat($base,0,40)==$black?'1':'0'; - $res .= imagecolorat($base,0,50)==$black?'1':'0'; - $res .= imagecolorat($base,0,60)==$black?'1':'0'; + $res = imagecolorat($base,0,10)==$black?'1':'0'; + $res .= imagecolorat($base,0,20)==$black?'1':'0'; + $res .= imagecolorat($base,0,30)==$black?'1':'0'; + $res .= imagecolorat($base,0,40)==$black?'1':'0'; + $res .= imagecolorat($base,0,50)==$black?'1':'0'; + $res .= imagecolorat($base,0,60)==$black?'1':'0'; - $res .= imagecolorat($base,11,12)==$white?'1':'0'; - $res .= imagecolorat($base,12,13)==$white?'1':'0'; - $res .= imagecolorat($base,13,14)==$white?'1':'0'; - $res .= imagecolorat($base,14,15)==$white?'1':'0'; - $res .= imagecolorat($base,15,16)==$white?'1':'0'; - $res .= imagecolorat($base,16,17)==$white?'1':'0'; + $res .= imagecolorat($base,11,12)==$white?'1':'0'; + $res .= imagecolorat($base,12,13)==$white?'1':'0'; + $res .= imagecolorat($base,13,14)==$white?'1':'0'; + $res .= imagecolorat($base,14,15)==$white?'1':'0'; + $res .= imagecolorat($base,15,16)==$white?'1':'0'; + $res .= imagecolorat($base,16,17)==$white?'1':'0'; - $res .= imagecolorat($base,0,16)==$black?'1':'0'; - $res .= imagecolorat($base,2,42)==$black?'1':'0'; - $res .= imagecolorat($base,4,44)==$black?'1':'0'; - $res .= imagecolorat($base,146,146)==$black?'1':'0'; - $res .= imagecolorat($base,148,146)==$black?'1':'0'; - $res .= imagecolorat($base,0,0)==$black?'1':'0'; + $res .= imagecolorat($base,0,16)==$black?'1':'0'; + $res .= imagecolorat($base,2,42)==$black?'1':'0'; + $res .= imagecolorat($base,4,44)==$black?'1':'0'; + $res .= imagecolorat($base,146,146)==$black?'1':'0'; + $res .= imagecolorat($base,148,146)==$black?'1':'0'; + $res .= imagecolorat($base,0,0)==$black?'1':'0'; - echo "$res\n"; + echo "$res\n"; ?> --EXPECT-- 000000111111101010 diff --git a/ext/gd/tests/bug42434.phpt b/ext/gd/tests/bug42434.phpt index 8f5205d936..3db42a228e 100644 --- a/ext/gd/tests/bug42434.phpt +++ b/ext/gd/tests/bug42434.phpt @@ -15,9 +15,9 @@ imageantialias($im, true); imageline($im, 0, 0, 10, 0, 0x000000); if (imagecolorat($im, 9, 0) == 0x000000) { - echo 'DONE'; + echo 'DONE'; } else { - echo 'Bugged'; + echo 'Bugged'; } imagedestroy($im); diff --git a/ext/gd/tests/bug43073.phpt b/ext/gd/tests/bug43073.phpt index c52bdad5be..74641496de 100644 --- a/ext/gd/tests/bug43073.phpt +++ b/ext/gd/tests/bug43073.phpt @@ -8,22 +8,22 @@ Bug #43073 (TrueType bounding box is wrong for angle<>0) --FILE-- <?php $exp = [ - [501,400, 611,400, 611,376, 501,376], - [492,361, 595,319, 586,296, 483,338], - [470,329, 549,251, 531,233, 453,312], - [439,307, 481,204, 458,195, 416,297], - [400,299, 400,189, 376,189, 376,299], - [361,307, 319,204, 296,213, 338,316], - [329,329, 251,250, 233,267, 311,346], - [307,360, 204,318, 195,341, 297,383], - [299,400, 189,400, 189,424, 299,424], - [307,438, 204,480, 213,503, 316,461], - [329,470, 250,548, 267,566, 346,488], - [360,492, 318,595, 341,604, 383,502], - [400,501, 400,611, 424,611, 424,501], - [438,492, 480,595, 503,586, 461,483], - [470,470, 548,549, 566,532, 488,453], - [492,439, 595,481, 604,458, 502,416] + [501,400, 611,400, 611,376, 501,376], + [492,361, 595,319, 586,296, 483,338], + [470,329, 549,251, 531,233, 453,312], + [439,307, 481,204, 458,195, 416,297], + [400,299, 400,189, 376,189, 376,299], + [361,307, 319,204, 296,213, 338,316], + [329,329, 251,250, 233,267, 311,346], + [307,360, 204,318, 195,341, 297,383], + [299,400, 189,400, 189,424, 299,424], + [307,438, 204,480, 213,503, 316,461], + [329,470, 250,548, 267,566, 346,488], + [360,492, 318,595, 341,604, 383,502], + [400,501, 400,611, 424,611, 424,501], + [438,492, 480,595, 503,586, 461,483], + [470,470, 548,549, 566,532, 488,453], + [492,439, 595,481, 604,458, 502,416] ]; $cwd = __DIR__; $font = "$cwd/Tuffy.ttf"; @@ -41,11 +41,11 @@ for ($angle = 0.0, $i = 0; $angle < 360.0; $angle += $delta_t, $i++) { imagepolygon($g, $bbox, $red); printf("%2d: ", $i); for ($j = 0; $j < 8; $j++) { - if ($bbox[$j] >= $exp[$i][$j] - 1 && $bbox[$j] <= $exp[$i][$j] + 1) { - echo '.'; - } else { - echo "(expected $exp[$i][$j], got $bbox[$j])"; - } + if ($bbox[$j] >= $exp[$i][$j] - 1 && $bbox[$j] <= $exp[$i][$j] + 1) { + echo '.'; + } else { + echo "(expected $exp[$i][$j], got $bbox[$j])"; + } } echo "\n"; $temp = $cos_t * $x + $sin_t * $y; diff --git a/ext/gd/tests/bug43475.phpt b/ext/gd/tests/bug43475.phpt index f0302d45ef..9264299181 100644 --- a/ext/gd/tests/bug43475.phpt +++ b/ext/gd/tests/bug43475.phpt @@ -13,22 +13,22 @@ require_once __DIR__ . '/similarity.inc'; function setStyleAndThickness($im, $color, $thickness) { - $style = array(); - $i = 0; - while ($i < 16 * $thickness) { - $style[$i++] = $color; - } - while ($i < 20 * $thickness) { - $style[$i++] = IMG_COLOR_TRANSPARENT; - } - while ($i < 28 * $thickness) { - $style[$i++] = $color; - } - while ($i < 32 * $thickness) { - $style[$i++] = IMG_COLOR_TRANSPARENT; - } - imagesetstyle($im, $style); - imagesetthickness($im, $thickness); + $style = array(); + $i = 0; + while ($i < 16 * $thickness) { + $style[$i++] = $color; + } + while ($i < 20 * $thickness) { + $style[$i++] = IMG_COLOR_TRANSPARENT; + } + while ($i < 28 * $thickness) { + $style[$i++] = $color; + } + while ($i < 32 * $thickness) { + $style[$i++] = IMG_COLOR_TRANSPARENT; + } + imagesetstyle($im, $style); + imagesetthickness($im, $thickness); } $im = imagecreate(800, 800); diff --git a/ext/gd/tests/bug44849.phpt b/ext/gd/tests/bug44849.phpt index 368a08a242..22e8a65ec4 100644 --- a/ext/gd/tests/bug44849.phpt +++ b/ext/gd/tests/bug44849.phpt @@ -6,7 +6,7 @@ Bug #44849 (imagecolorclosesthwb is not available on Windows) ?> --FILE-- <?php - var_dump(function_exists('imagecolorclosesthwb')); + var_dump(function_exists('imagecolorclosesthwb')); ?> --EXPECT-- bool(true) diff --git a/ext/gd/tests/bug49600.phpt b/ext/gd/tests/bug49600.phpt index 25fae3ca37..79830be71f 100644 --- a/ext/gd/tests/bug49600.phpt +++ b/ext/gd/tests/bug49600.phpt @@ -15,7 +15,7 @@ $color = imagecolorallocate($image, 255, 255, 255); foreach (array("E", "I", "P", "g", "i", "q") as $c) { $x = imagettftext($image, 32, 0, 0, 0, $color, $font, $c); - $y = imagettfbbox(32, 0, "$cwd/Tuffy.ttf", $c); + $y = imagettfbbox(32, 0, "$cwd/Tuffy.ttf", $c); if ( abs($x[0] - $y[0]) > 1 || abs($x[2] - $y[2]) > 1 || abs($x[4] - $y[4]) > 1 diff --git a/ext/gd/tests/bug53504.phpt b/ext/gd/tests/bug53504.phpt index c44e4ef0f8..11e7a8af57 100644 --- a/ext/gd/tests/bug53504.phpt +++ b/ext/gd/tests/bug53504.phpt @@ -51,16 +51,16 @@ $tests = [ foreach ($tests as $testnum => $test) { $bbox = imageftbbox($test['fontSize'], $test['angle'], $font, $test['text']); - printf('%2d: ', $testnum); - for ($i = 0; $i < 8; $i++) { - $exp = $test['exp'][$i]; - if ($bbox[$i] >= $exp - 2 && $bbox[$i] <= $exp + 2) { - echo '.'; - } else { - echo "(expected $exp, got $bbox[$i])"; - } - } - echo "\n"; + printf('%2d: ', $testnum); + for ($i = 0; $i < 8; $i++) { + $exp = $test['exp'][$i]; + if ($bbox[$i] >= $exp - 2 && $bbox[$i] <= $exp + 2) { + echo '.'; + } else { + echo "(expected $exp, got $bbox[$i])"; + } + } + echo "\n"; $bboxDrawn = imagefttext($g, $test['fontSize'], $test['angle'], $test['x'], $test['y'], $black, $font, $test['text']); diff --git a/ext/gd/tests/bug64641.phpt b/ext/gd/tests/bug64641.phpt index 2d5768eece..4eb2e28730 100644 --- a/ext/gd/tests/bug64641.phpt +++ b/ext/gd/tests/bug64641.phpt @@ -14,24 +14,24 @@ require_once __DIR__ . '/similarity.inc'; $im = imagecreatetruecolor(640, 480); $points = array( - 100, 100, - 100, 200, - 100, 300 + 100, 100, + 100, 200, + 100, 300 ); imagefilledpolygon($im, $points, 0xFFFF00); $points = array( - 300, 200, - 400, 200, - 500, 200 + 300, 200, + 400, 200, + 500, 200 ); imagefilledpolygon($im, $points, 0xFFFF00); $ex = imagecreatefrompng(__DIR__ . '/bug64641.png'); if (($diss = calc_image_dissimilarity($ex, $im)) < 1e-5) { - echo "IDENTICAL"; + echo "IDENTICAL"; } else { - echo "DISSIMILARITY: $diss"; + echo "DISSIMILARITY: $diss"; } imagedestroy($ex); diff --git a/ext/gd/tests/bug67248.phpt b/ext/gd/tests/bug67248.phpt index c9a9588343..c5b54354f1 100644 --- a/ext/gd/tests/bug67248.phpt +++ b/ext/gd/tests/bug67248.phpt @@ -10,7 +10,7 @@ Bug #67248 (imageaffinematrixget missing check of parameters) require __DIR__ . '/func.inc'; for($i=0;$i<7;$i++) { - trycatch_dump( + trycatch_dump( fn() => imageaffinematrixget($i) ); } diff --git a/ext/gd/tests/bug72339.phpt b/ext/gd/tests/bug72339.phpt index 5b5fdb6ee6..bd8054cced 100644 --- a/ext/gd/tests/bug72339.phpt +++ b/ext/gd/tests/bug72339.phpt @@ -26,7 +26,7 @@ fclose($fh); $im = imagecreatefromgd2($fname); if ($im) { - imagedestroy($im); + imagedestroy($im); } unlink($fname); diff --git a/ext/gd/tests/bug72709.phpt b/ext/gd/tests/bug72709.phpt index 2963f1c104..a5b0463f62 100644 --- a/ext/gd/tests/bug72709.phpt +++ b/ext/gd/tests/bug72709.phpt @@ -8,7 +8,7 @@ if (!extension_loaded('gd')) die('skip ext/gd not available'); <?php $im = imagecreatetruecolor(1, 1); -try { +try { var_dump(imagesetstyle($im, array())); } catch (\Error $ex) { diff --git a/ext/gd/tests/colorat.phpt b/ext/gd/tests/colorat.phpt index e8c1a5fb46..9be5d431da 100644 --- a/ext/gd/tests/colorat.phpt +++ b/ext/gd/tests/colorat.phpt @@ -30,9 +30,9 @@ echo 'test colorat palette: '; $c = imagecolorsforindex($im, imagecolorat($im, 3,3)); $failed = false; foreach ($c as $v) { - if ($v != 0) { - $failed = true; - } + if ($v != 0) { + $failed = true; + } } echo !$failed ? 'ok' : 'failed'; echo "\n"; diff --git a/ext/gd/tests/colorclosest.phpt b/ext/gd/tests/colorclosest.phpt index 7ade09478e..3f588fbd59 100644 --- a/ext/gd/tests/colorclosest.phpt +++ b/ext/gd/tests/colorclosest.phpt @@ -31,11 +31,11 @@ print_r(imagecolorsforindex($im, $c)); $im = imagecreate(5,5); for ($i=0; $i<256; $i++) { - if ($i == 246) { - imagecolorallocate($im, $i,10,10); - } else { - imagecolorallocate($im, $i,0,0); - } + if ($i == 246) { + imagecolorallocate($im, $i,10,10); + } else { + imagecolorallocate($im, $i,0,0); + } } $c = imagecolorclosest($im, 255,10,10); print_r(imagecolorsforindex($im, $c)); @@ -65,11 +65,11 @@ print_r(imagecolorsforindex($im, $c)); $im = imagecreate(5,5); for ($i=0; $i<256; $i++) { - if ($i == 246) { - imagecolorallocatealpha($im, $i,10,10,1); - } else { - imagecolorallocatealpha($im, $i,0,0,100); - } + if ($i == 246) { + imagecolorallocatealpha($im, $i,10,10,1); + } else { + imagecolorallocatealpha($im, $i,0,0,100); + } } $c = imagecolorclosestalpha($im, 255,10,10,1); print_r(imagecolorsforindex($im, $c)); diff --git a/ext/gd/tests/colorresolve.phpt b/ext/gd/tests/colorresolve.phpt index 0a939bd85f..6df57ef75d 100644 --- a/ext/gd/tests/colorresolve.phpt +++ b/ext/gd/tests/colorresolve.phpt @@ -25,11 +25,11 @@ print_r(imagecolorsforindex($im, $c)); $im = imagecreate(5,5); for ($i=0; $i<256; $i++) { - if ($i == 246) { - imagecolorresolve($im, $i,10,10); - } else { - imagecolorresolve($im, $i,0,0); - } + if ($i == 246) { + imagecolorresolve($im, $i,10,10); + } else { + imagecolorresolve($im, $i,0,0); + } } $c = imagecolorresolve($im, 255,10,10); print_r(imagecolorsforindex($im, $c)); @@ -55,11 +55,11 @@ print_r(imagecolorsforindex($im, $c)); $im = imagecreate(5,5); for ($i=0; $i<256; $i++) { - if ($i == 246) { - imagecolorresolvealpha($im, $i,10,10,1); - } else { - imagecolorresolvealpha($im, $i,0,0,100); - } + if ($i == 246) { + imagecolorresolvealpha($im, $i,10,10,1); + } else { + imagecolorresolvealpha($im, $i,0,0,100); + } } $c = imagecolorresolvealpha($im, 255,10,10,0); print_r(imagecolorsforindex($im, $c)); diff --git a/ext/gd/tests/copy.phpt b/ext/gd/tests/copy.phpt index 28bb3ed173..046567e3ef 100644 --- a/ext/gd/tests/copy.phpt +++ b/ext/gd/tests/copy.phpt @@ -21,7 +21,7 @@ $p2 = imagecolorat($dst_tc, 0,0) == 0x0000ff; $p3 = imagecolorat($dst_tc, 4,4) == 0x00ff00; if ($p1 && $p2 && $p3) { - echo "TC/TC: ok\n"; + echo "TC/TC: ok\n"; } imagedestroy($src_tc); imagedestroy($dst_tc); @@ -46,7 +46,7 @@ $p2 = $c2['red'] == 0x00 && $c2['blue']==0xff && $c2['green']==0x00; $p3 = $c3['red'] == 0x00 && $c3['blue']==0x00 && $c3['green']==0xff; if ($p1 && $p2 && $p3) { - echo "TC/P: ok\n"; + echo "TC/P: ok\n"; } imagedestroy($src_tc); imagedestroy($dst_tc); @@ -76,7 +76,7 @@ $p3 = $c3['red'] == 0x00 && $c3['blue']==0x00 && $c3['green']==0xff; if ($p1 && $p2 && $p3) { - echo "P/P: ok\n"; + echo "P/P: ok\n"; } @@ -99,7 +99,7 @@ $p2 = imagecolorat($dst_tc, 0,0) == 0x0000ff; $p3 = imagecolorat($dst_tc, 4,4) == 0x00ff00; if ($p1 && $p2 && $p3) { - echo "P/TC: ok\n"; + echo "P/TC: ok\n"; } ?> --EXPECT-- diff --git a/ext/gd/tests/copypalette.phpt b/ext/gd/tests/copypalette.phpt index 3e29b42a43..747011e69a 100644 --- a/ext/gd/tests/copypalette.phpt +++ b/ext/gd/tests/copypalette.phpt @@ -9,18 +9,18 @@ imagepalettecopy $failed = false; $im = imagecreate(1,1); for ($i=0; $i<256; $i++) { - imagecolorallocate($im, $i, $i, $i); + imagecolorallocate($im, $i, $i, $i); } $im2 = imagecreate(1,1); imagepalettecopy($im2, $im); for ($i=0; $i<256; $i++) { - $c = imagecolorsforindex($im2, $i); - if ($c['red']!=$i || $c['green']!=$i || $c['blue']!=$i) { - $failed = true; - break; - } + $c = imagecolorsforindex($im2, $i); + if ($c['red']!=$i || $c['green']!=$i || $c['blue']!=$i) { + $failed = true; + break; + } } echo "copy palette 255 colors: "; echo $failed ? 'failed' : 'ok'; @@ -33,7 +33,7 @@ imagecolorallocatealpha($im, 0,0,0,100); imagepalettecopy($im2, $im); $c = imagecolorsforindex($im2, 0); if ($c['red']!=0 || $c['green']!=0 || $c['blue']!=0 || $c['alpha']!=100) { - $failed = true; + $failed = true; } echo 'copy palette 1 color and alpha: '; echo $failed ? 'failed' : 'ok'; diff --git a/ext/gd/tests/copyresized.phpt b/ext/gd/tests/copyresized.phpt index df4996332d..2af9cc9682 100644 --- a/ext/gd/tests/copyresized.phpt +++ b/ext/gd/tests/copyresized.phpt @@ -8,32 +8,32 @@ imagecopyresized <?php function get_hexcolor($im, $c) { - if (imageistruecolor($im)) { - return $c; - } - $colors = imagecolorsforindex($im, $c); - return ($colors['red'] << 16) + ($colors['green'] << 8) + ($colors['blue']); + if (imageistruecolor($im)) { + return $c; + } + $colors = imagecolorsforindex($im, $c); + return ($colors['red'] << 16) + ($colors['green'] << 8) + ($colors['blue']); } function check_doublesize($dst) { - $im = imagecreatetruecolor(38,38); - imagefill($im,0,0, 0xffffff); - imagefilledrectangle($im, 0,0,9,9, 0xff0000); - imagefilledrectangle($im, 0,28,9,37, 0xff0000); - imagefilledrectangle($im, 28,0,37,9, 0xff0000); - imagefilledrectangle($im, 28,28,37,37, 0xff0000); - imagefilledrectangle($im, 14,14,23,23, 0xff0000); + $im = imagecreatetruecolor(38,38); + imagefill($im,0,0, 0xffffff); + imagefilledrectangle($im, 0,0,9,9, 0xff0000); + imagefilledrectangle($im, 0,28,9,37, 0xff0000); + imagefilledrectangle($im, 28,0,37,9, 0xff0000); + imagefilledrectangle($im, 28,28,37,37, 0xff0000); + imagefilledrectangle($im, 14,14,23,23, 0xff0000); - for ($x = 0; $x < 38; $x++) { - for ($y = 0; $y < 38; $y++) { - $p1 = imagecolorat($im, $x, $y); - $p2 = imagecolorat($dst, $x, $y); - if (get_hexcolor($im, $p1) != get_hexcolor($dst, $p2)) { - return false; - } - } - } - return true; + for ($x = 0; $x < 38; $x++) { + for ($y = 0; $y < 38; $y++) { + $p1 = imagecolorat($im, $x, $y); + $p2 = imagecolorat($dst, $x, $y); + if (get_hexcolor($im, $p1) != get_hexcolor($dst, $p2)) { + return false; + } + } + } + return true; } $src_tc = imagecreatetruecolor(19,19); diff --git a/ext/gd/tests/createfromstring.phpt b/ext/gd/tests/createfromstring.phpt index 6a4b1a7e11..5d14708a2e 100644 --- a/ext/gd/tests/createfromstring.phpt +++ b/ext/gd/tests/createfromstring.phpt @@ -18,9 +18,9 @@ $im_string = file_get_contents(__DIR__ . '/tc.png'); $im = imagecreatefromstring($im_string); echo 'createfromstring truecolor png: '; if (imagecolorat($im, 3,3) != 0x0) { - echo 'failed'; + echo 'failed'; } else { - echo 'ok'; + echo 'ok'; } echo "\n"; unlink($dir . '/tc.png'); @@ -42,9 +42,9 @@ echo'createfromstring palette png: '; $c = imagecolorsforindex($im, imagecolorat($im, 3,3)); $failed = false; if ($c['red'] != 255 || $c['green'] != 0 || $c['blue'] != 0) { - echo 'failed'; + echo 'failed'; } else { - echo 'ok'; + echo 'ok'; } echo "\n"; unlink($dir . '/p.png'); diff --git a/ext/gd/tests/createfromwbmp2.phpt b/ext/gd/tests/createfromwbmp2.phpt index 819795181a..f75d02613d 100644 --- a/ext/gd/tests/createfromwbmp2.phpt +++ b/ext/gd/tests/createfromwbmp2.phpt @@ -10,7 +10,7 @@ imagecreatefromwbmp with invalid wbmp $filename = __DIR__ . '/_tmp.wbmp'; $fp = fopen($filename,"wb"); if (!$fp) { - exit("Failed to create <$filename>"); + exit("Failed to create <$filename>"); } //write header @@ -34,7 +34,7 @@ fputs($fp, chr($c), 1); /*write some data to cause overflow*/ for ($i=0; $i<10000; $i++) { - fwrite($fp, chr($c), 1); + fwrite($fp, chr($c), 1); } fclose($fp); diff --git a/ext/gd/tests/createfromwbmp2_extern.phpt b/ext/gd/tests/createfromwbmp2_extern.phpt index 0aff8d8b93..ad7a130c18 100644 --- a/ext/gd/tests/createfromwbmp2_extern.phpt +++ b/ext/gd/tests/createfromwbmp2_extern.phpt @@ -10,7 +10,7 @@ imagecreatefromwbmp with invalid wbmp $filename = __DIR__ . '/_tmp.wbmp'; $fp = fopen($filename,"wb"); if (!$fp) { - exit("Failed to create <$filename>"); + exit("Failed to create <$filename>"); } //write header @@ -34,7 +34,7 @@ fputs($fp, chr($c), 1); /*write some data to cause overflow*/ for ($i=0; $i<10000; $i++) { - fwrite($fp, chr($c), 1); + fwrite($fp, chr($c), 1); } fclose($fp); diff --git a/ext/gd/tests/dashedlines.phpt b/ext/gd/tests/dashedlines.phpt index b6d4892c88..bcf17174cc 100644 --- a/ext/gd/tests/dashedlines.phpt +++ b/ext/gd/tests/dashedlines.phpt @@ -26,7 +26,7 @@ $p5 = imagecolorat($im, 5,5) == $b; if ($p1 && $p2 && $p3 && $p4 && $p5) { - echo "Horizontal: ok\n"; + echo "Horizontal: ok\n"; } imagedestroy($im); @@ -46,7 +46,7 @@ $p5 = imagecolorat($im, 2,4) == $r; $p6 = imagecolorat($im, 2,5) == $b; if ($p1 && $p2 && $p3 && $p4 && $p5 && $p6) { - echo "Vertical: ok\n"; + echo "Vertical: ok\n"; } imagedestroy($im); @@ -66,7 +66,7 @@ $p5 = imagecolorat($im, 4,4) == $r; $p6 = imagecolorat($im, 5,5) == $b; if ($p1 && $p2 && $p3 && $p4 && $p5 && $p6) { - echo "Diagonal: ok\n"; + echo "Diagonal: ok\n"; } imagedestroy($im); diff --git a/ext/gd/tests/func.inc b/ext/gd/tests/func.inc index faa0b06816..5273f99830 100644 --- a/ext/gd/tests/func.inc +++ b/ext/gd/tests/func.inc @@ -2,61 +2,61 @@ function get_gd_version() { - return GD_VERSION; + return GD_VERSION; } function get_php_info() { - ob_start(); - phpinfo(); - $info = ob_get_contents(); - ob_end_clean(); + ob_start(); + phpinfo(); + $info = ob_get_contents(); + ob_end_clean(); - return $info; + return $info; } function get_freetype_version() { - $version = 0; + $version = 0; - if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) { - $version = $match[1]; - } + if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) { + $version = $match[1]; + } - return $version; + return $version; } function get_libjpeg_version() { - $version = 0; + $version = 0; - if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) { - $version = $match[1]; - } + if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) { + $version = $match[1]; + } - return $version; + return $version; } function get_libpng_version() { - $version = 0; + $version = 0; - if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) { - $version = $match[1]; - } + if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) { + $version = $match[1]; + } - return $version; + return $version; } function get_libxpm_version() { - $version = 0; + $version = 0; - if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) { - $version = $match[1]; - } + if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) { + $version = $match[1]; + } - return $version; + return $version; } /** @@ -77,39 +77,39 @@ function get_libxpm_version() */ 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); - } + 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); + } } /** @@ -120,15 +120,15 @@ function test_image_equals_file($filename, $actual) */ 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; - } + 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; + } } /** @@ -142,9 +142,9 @@ function test_to_truecolor($image) */ function save_actual_image($image) { - $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']); - $filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png"; - imagepng($image, $filename); + $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']); + $filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png"; + imagepng($image, $filename); } /** diff --git a/ext/gd/tests/gd_info_basic.phpt b/ext/gd/tests/gd_info_basic.phpt index b027462a41..99102168f1 100644 --- a/ext/gd/tests/gd_info_basic.phpt +++ b/ext/gd/tests/gd_info_basic.phpt @@ -14,11 +14,11 @@ gd_info() * Source code: ext/standard/image.c * Alias to functions: */ - echo "basic test of gd_info() function\n"; + echo "basic test of gd_info() function\n"; - var_dump(gd_info()); + var_dump(gd_info()); - echo "\nDone\n"; + echo "\nDone\n"; ?> --EXPECTF-- basic test of gd_info() function diff --git a/ext/gd/tests/gdimage_prevent_serialization.phpt b/ext/gd/tests/gdimage_prevent_serialization.phpt index ef08444d37..e1e33127d1 100644 --- a/ext/gd/tests/gdimage_prevent_serialization.phpt +++ b/ext/gd/tests/gdimage_prevent_serialization.phpt @@ -11,7 +11,7 @@ if(!extension_loaded('gd')) { $img_src = imagecreatetruecolor(32, 32); var_dump(serialize($img_src)); - + ?> --EXPECTF-- Fatal error: Uncaught Exception: Serialization of 'GdImage' is not allowed in %s:%d diff --git a/ext/gd/tests/gif.phpt b/ext/gd/tests/gif.phpt index 39ade092c2..8315fb0dbc 100644 --- a/ext/gd/tests/gif.phpt +++ b/ext/gd/tests/gif.phpt @@ -13,34 +13,34 @@ gif in/out <?php function check_box($r,$g,$b, $error=0) { - $cwd = __DIR__; - $im2 = imagecreatefromgif($cwd . '/test_gif.gif'); - - $c = imagecolorsforindex($im2, imagecolorat($im2, 8,8)); - - if ($error>0) { - $r_min = $r - $error; $r_max = $r + $error; - $g_min = $g - $error; $g_max = $g + $error; - $b_min = $b - $error; $b_max = $b + $error; - - if ( - ($c['red'] >= $r_min || $c['red'] <= $r_max) - && - ($c['green'] >= $g_min || $c['green'] <= $g_max) - && - ($c['blue'] >= $b_min || $c['blue'] <= $b_max) - ) { - return true; - } else { - return false; - } - } else { - if ($c['red']==$r && $c['green']==$g && $c['blue']==$b) { - return true; - } else { - return false; - } - } + $cwd = __DIR__; + $im2 = imagecreatefromgif($cwd . '/test_gif.gif'); + + $c = imagecolorsforindex($im2, imagecolorat($im2, 8,8)); + + if ($error>0) { + $r_min = $r - $error; $r_max = $r + $error; + $g_min = $g - $error; $g_max = $g + $error; + $b_min = $b - $error; $b_max = $b + $error; + + if ( + ($c['red'] >= $r_min || $c['red'] <= $r_max) + && + ($c['green'] >= $g_min || $c['green'] <= $g_max) + && + ($c['blue'] >= $b_min || $c['blue'] <= $b_max) + ) { + return true; + } else { + return false; + } + } else { + if ($c['red']==$r && $c['green']==$g && $c['blue']==$b) { + return true; + } else { + return false; + } + } } $cwd = __DIR__; @@ -49,76 +49,76 @@ $c = imagecolorallocate($im, 255,255,255); imagefilledrectangle($im, 5,5, 10,10, $c); imagegif($im, $cwd . '/test_gif.gif'); if (check_box(255,255,255)) { - echo "<4 cols: ok\n"; + echo "<4 cols: ok\n"; } $im = imagecreate(10,10); for ($i=0; $i<7; $i++) { - $c = imagecolorallocate($im, $i,$i,$i); + $c = imagecolorallocate($im, $i,$i,$i); } imagefilledrectangle($im, 5,5, 10,10, $c); imagegif($im, $cwd . '/test_gif.gif'); $i--; if (check_box($i,$i,$i)) { - echo "<8 cols: ok\n"; + echo "<8 cols: ok\n"; } $im = imagecreate(10,10); for ($i=0; $i<15; $i++) { - $c = imagecolorallocate($im, $i,$i,$i); + $c = imagecolorallocate($im, $i,$i,$i); } imagefilledrectangle($im, 5,5, 10,10, $c); imagegif($im, $cwd . '/test_gif.gif'); $i--; if (check_box($i,$i,$i)) { - echo "<16 cols: ok\n"; + echo "<16 cols: ok\n"; } $im = imagecreate(10,10); for ($i=0; $i<31; $i++) { - $c = imagecolorallocate($im, $i,$i,$i); + $c = imagecolorallocate($im, $i,$i,$i); } imagefilledrectangle($im, 5,5, 10,10, $c); imagegif($im, $cwd . '/test_gif.gif'); $i--; if (check_box($i,$i,$i)) { - echo "<32 cols: ok\n"; + echo "<32 cols: ok\n"; } $im = imagecreate(10,10); for ($i=0; $i<63; $i++) { - $c = imagecolorallocate($im, $i,$i,$i); + $c = imagecolorallocate($im, $i,$i,$i); } imagefilledrectangle($im, 5,5, 10,10, $c); imagegif($im, $cwd . '/test_gif.gif'); $i--; if (check_box($i,$i,$i)) { - echo "<64 cols: ok\n"; + echo "<64 cols: ok\n"; } $im = imagecreate(10,10); for ($i=0; $i<127; $i++) { - $c = imagecolorallocate($im, $i,$i,$i); + $c = imagecolorallocate($im, $i,$i,$i); } imagefilledrectangle($im, 5,5, 10,10, $c); imagegif($im, $cwd . '/test_gif.gif'); $i--; if (check_box($i,$i,$i)) { - echo "<128 cols: ok\n"; + echo "<128 cols: ok\n"; } $im = imagecreate(10,10); for ($i=0; $i<255; $i++) { - $c = imagecolorallocate($im, $i,$i,$i); + $c = imagecolorallocate($im, $i,$i,$i); } imagefilledrectangle($im, 5,5, 10,10, $c); imagegif($im, $cwd . '/test_gif.gif'); $i--; if (check_box($i,$i,$i)) { - echo "<256 cols: ok\n"; + echo "<256 cols: ok\n"; } @@ -128,7 +128,7 @@ imagegif($im, $cwd . '/test_gif.gif'); imagegif($im, $cwd . '/test_gif_2.gif'); if (check_box(255,255,255, 10)) { - echo ">256 cols: ok\n"; + echo ">256 cols: ok\n"; } @unlink($cwd . "/test_gif.gif"); diff --git a/ext/gd/tests/gif2gd.phpt b/ext/gd/tests/gif2gd.phpt index 3fe9397fb6..a741cadb26 100644 --- a/ext/gd/tests/gif2gd.phpt +++ b/ext/gd/tests/gif2gd.phpt @@ -12,18 +12,18 @@ gif --> gd1/gd2 conversion test ?> --FILE-- <?php - $cwd = __DIR__; + $cwd = __DIR__; - echo "GIF to GD1 conversion: "; - echo imagegd(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.gd1") ? 'ok' : 'failed'; - echo "\n"; + echo "GIF to GD1 conversion: "; + echo imagegd(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.gd1") ? 'ok' : 'failed'; + echo "\n"; - echo "GIF to GD2 conversion: "; - echo imagegd2(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.gd2") ? 'ok' : 'failed'; - echo "\n"; + echo "GIF to GD2 conversion: "; + echo imagegd2(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.gd2") ? 'ok' : 'failed'; + echo "\n"; - @unlink($cwd . "/test_gif.gd1"); - @unlink($cwd . "/test_gif.gd2"); + @unlink($cwd . "/test_gif.gd1"); + @unlink($cwd . "/test_gif.gd2"); ?> --EXPECT-- GIF to GD1 conversion: ok diff --git a/ext/gd/tests/gif2jpg.phpt b/ext/gd/tests/gif2jpg.phpt index 38d8963271..b0ce474886 100644 --- a/ext/gd/tests/gif2jpg.phpt +++ b/ext/gd/tests/gif2jpg.phpt @@ -15,13 +15,13 @@ gif --> jpeg conversion test ?> --FILE-- <?php - $cwd = __DIR__; + $cwd = __DIR__; - echo "GIF to JPEG conversion: "; - echo imagejpeg(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.jpeg") ? 'ok' : 'failed'; - echo "\n"; + echo "GIF to JPEG conversion: "; + echo imagejpeg(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.jpeg") ? 'ok' : 'failed'; + echo "\n"; - @unlink($cwd . "/test_gif.jpeg"); + @unlink($cwd . "/test_gif.jpeg"); ?> --EXPECT-- GIF to JPEG conversion: ok diff --git a/ext/gd/tests/gif2png.phpt b/ext/gd/tests/gif2png.phpt index 27aac9cdd8..295a80944c 100644 --- a/ext/gd/tests/gif2png.phpt +++ b/ext/gd/tests/gif2png.phpt @@ -15,13 +15,13 @@ gif --> png conversion test ?> --FILE-- <?php - $cwd = __DIR__; + $cwd = __DIR__; - echo "GIF to PNG conversion: "; - echo imagepng(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.png") ? 'ok' : 'failed'; - echo "\n"; + echo "GIF to PNG conversion: "; + echo imagepng(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.png") ? 'ok' : 'failed'; + echo "\n"; - @unlink($cwd . "/test_gif.png"); + @unlink($cwd . "/test_gif.png"); ?> --EXPECT-- GIF to PNG conversion: ok diff --git a/ext/gd/tests/imagefilter.phpt b/ext/gd/tests/imagefilter.phpt index a46cc1476e..f040c5cac4 100644 --- a/ext/gd/tests/imagefilter.phpt +++ b/ext/gd/tests/imagefilter.phpt @@ -10,88 +10,88 @@ imagefilter() function test --FILE-- <?php $no_arg_filters = array( - "IMG_FILTER_NEGATE", - "IMG_FILTER_GRAYSCALE", - "IMG_FILTER_EDGEDETECT", - "IMG_FILTER_GAUSSIAN_BLUR", - "IMG_FILTER_SELECTIVE_BLUR", - "IMG_FILTER_EMBOSS", - "IMG_FILTER_MEAN_REMOVAL" + "IMG_FILTER_NEGATE", + "IMG_FILTER_GRAYSCALE", + "IMG_FILTER_EDGEDETECT", + "IMG_FILTER_GAUSSIAN_BLUR", + "IMG_FILTER_SELECTIVE_BLUR", + "IMG_FILTER_EMBOSS", + "IMG_FILTER_MEAN_REMOVAL" ); $SAVE_DIR = __DIR__; $SOURCE_IMG = $SAVE_DIR . "/test.png"; - foreach ($no_arg_filters as $filt) { - $im = imagecreatefrompng($SOURCE_IMG); - if (imagefilter($im, constant($filt))) { - imagepng($im, $SAVE_DIR."/".$filt. ".png"); - echo "$filt success\n"; - @unlink($SAVE_DIR."/".$filt. ".png"); - } else { - echo "$filt failed\n"; - } - } + foreach ($no_arg_filters as $filt) { + $im = imagecreatefrompng($SOURCE_IMG); + if (imagefilter($im, constant($filt))) { + imagepng($im, $SAVE_DIR."/".$filt. ".png"); + echo "$filt success\n"; + @unlink($SAVE_DIR."/".$filt. ".png"); + } else { + echo "$filt failed\n"; + } + } - $im = imagecreatefrompng($SOURCE_IMG); + $im = imagecreatefrompng($SOURCE_IMG); - if (imagefilter($im, IMG_FILTER_SMOOTH, -1924.124)) { - imagepng($im, $SAVE_DIR . "/IMG_FILTER_SMOOTH.png"); - echo "IMG_FILTER_SMOOTH success\n"; - @unlink($SAVE_DIR . "/IMG_FILTER_SMOOTH.png"); - } else { - echo "IMG_FILTER_SMOOTH failed\n"; - } + if (imagefilter($im, IMG_FILTER_SMOOTH, -1924.124)) { + imagepng($im, $SAVE_DIR . "/IMG_FILTER_SMOOTH.png"); + echo "IMG_FILTER_SMOOTH success\n"; + @unlink($SAVE_DIR . "/IMG_FILTER_SMOOTH.png"); + } else { + echo "IMG_FILTER_SMOOTH failed\n"; + } - $im = imagecreatefrompng($SOURCE_IMG); + $im = imagecreatefrompng($SOURCE_IMG); - if (imagefilter($im, IMG_FILTER_COLORIZE, -127.12, -127.98, 127)) { - imagepng($im, $SAVE_DIR . "/IMG_FILTER_COLORIZE.png"); - echo "IMG_FILTER_COLORIZE success\n"; - unlink($SAVE_DIR . "/IMG_FILTER_COLORIZE.png"); - } else { - echo "IMG_FILTER_COLORIZE failed\n"; - } + if (imagefilter($im, IMG_FILTER_COLORIZE, -127.12, -127.98, 127)) { + imagepng($im, $SAVE_DIR . "/IMG_FILTER_COLORIZE.png"); + echo "IMG_FILTER_COLORIZE success\n"; + unlink($SAVE_DIR . "/IMG_FILTER_COLORIZE.png"); + } else { + echo "IMG_FILTER_COLORIZE failed\n"; + } - $im = imagecreatefrompng($SOURCE_IMG); + $im = imagecreatefrompng($SOURCE_IMG); - if (imagefilter($im, IMG_FILTER_CONTRAST, -90)) { - imagepng($im, $SAVE_DIR . "/IMG_FILTER_CONTRAST.png"); - echo "IMG_FILTER_CONTRAST success\n"; - unlink($SAVE_DIR . "/IMG_FILTER_CONTRAST.png"); - } else { - echo "IMG_FILTER_CONTRAST failed\n"; - } + if (imagefilter($im, IMG_FILTER_CONTRAST, -90)) { + imagepng($im, $SAVE_DIR . "/IMG_FILTER_CONTRAST.png"); + echo "IMG_FILTER_CONTRAST success\n"; + unlink($SAVE_DIR . "/IMG_FILTER_CONTRAST.png"); + } else { + echo "IMG_FILTER_CONTRAST failed\n"; + } - $im = imagecreatefrompng($SOURCE_IMG); + $im = imagecreatefrompng($SOURCE_IMG); - if (imagefilter($im, IMG_FILTER_BRIGHTNESS, 98)) { - imagepng($im, $SAVE_DIR . "/IMG_FILTER_BRIGHTNESS.png"); - echo "IMG_FILTER_BRIGHTNESS success\n"; - unlink($SAVE_DIR . "/IMG_FILTER_BRIGHTNESS.png"); - } else { - echo "IMG_FILTER_BRIGHTNESS failed\n"; - } + if (imagefilter($im, IMG_FILTER_BRIGHTNESS, 98)) { + imagepng($im, $SAVE_DIR . "/IMG_FILTER_BRIGHTNESS.png"); + echo "IMG_FILTER_BRIGHTNESS success\n"; + unlink($SAVE_DIR . "/IMG_FILTER_BRIGHTNESS.png"); + } else { + echo "IMG_FILTER_BRIGHTNESS failed\n"; + } - $im = imagecreatefrompng($SOURCE_IMG); + $im = imagecreatefrompng($SOURCE_IMG); - if (imagefilter($im, IMG_FILTER_PIXELATE, 5, true)) { - imagepng($im, $SAVE_DIR . "/IMG_FILTER_PIXELATE.png"); - echo "IMG_FILTER_PIXELATE success\n"; - unlink($SAVE_DIR . "/IMG_FILTER_PIXELATE.png"); - } else { - echo "IMG_FILTER_PIXELATE failed\n"; - } + if (imagefilter($im, IMG_FILTER_PIXELATE, 5, true)) { + imagepng($im, $SAVE_DIR . "/IMG_FILTER_PIXELATE.png"); + echo "IMG_FILTER_PIXELATE success\n"; + unlink($SAVE_DIR . "/IMG_FILTER_PIXELATE.png"); + } else { + echo "IMG_FILTER_PIXELATE failed\n"; + } - $im = imagecreatefrompng($SOURCE_IMG); + $im = imagecreatefrompng($SOURCE_IMG); - if (imagefilter($im, IMG_FILTER_SCATTER, 3, 5)) { - imagepng($im, $SAVE_DIR . "/IMG_FILTER_SCATTER.png"); - echo "IMG_FILTER_SCATTER success\n"; - unlink($SAVE_DIR . "/IMG_FILTER_SCATTER.png"); - } else { - echo "IMG_FILTER_SCATTER failed\n"; - } + if (imagefilter($im, IMG_FILTER_SCATTER, 3, 5)) { + imagepng($im, $SAVE_DIR . "/IMG_FILTER_SCATTER.png"); + echo "IMG_FILTER_SCATTER success\n"; + unlink($SAVE_DIR . "/IMG_FILTER_SCATTER.png"); + } else { + echo "IMG_FILTER_SCATTER failed\n"; + } ?> --EXPECT-- IMG_FILTER_NEGATE success diff --git a/ext/gd/tests/imagefttext.phpt b/ext/gd/tests/imagefttext.phpt index 85bca4d545..d140af858e 100644 --- a/ext/gd/tests/imagefttext.phpt +++ b/ext/gd/tests/imagefttext.phpt @@ -11,41 +11,41 @@ imagefttext() function test ?> --FILE-- <?php - $cwd = __DIR__; - $fontfile_8859 = "$cwd/test8859.ttf"; + $cwd = __DIR__; + $fontfile_8859 = "$cwd/test8859.ttf"; - function testrun($im, $fontfile) { - $sx = imagesx($im); - $sy = imagesy($im); + function testrun($im, $fontfile) { + $sx = imagesx($im); + $sy = imagesy($im); - $colour_w = imagecolorallocate($im, 255, 255, 255); - $colour_b = imagecolorallocate($im, 0, 0, 0); + $colour_w = imagecolorallocate($im, 255, 255, 255); + $colour_b = imagecolorallocate($im, 0, 0, 0); - imagefilledrectangle($im, 0, 0, $sx - 1, $sy - 1, $colour_b); - imagefttext($im, $sy * 0.75, 0, 0, $sy - 1, $colour_w, $fontfile, "A", array()); + imagefilledrectangle($im, 0, 0, $sx - 1, $sy - 1, $colour_b); + imagefttext($im, $sy * 0.75, 0, 0, $sy - 1, $colour_w, $fontfile, "A", array()); - $cnt = 0; - for ($y = 0; $y < $sy; ++$y) { - for ($x = 0; $x < $sx; ++$x) { - if (imagecolorat($im, $x, $y) == $colour_b) { - ++$cnt; - } - } - } + $cnt = 0; + for ($y = 0; $y < $sy; ++$y) { + for ($x = 0; $x < $sx; ++$x) { + if (imagecolorat($im, $x, $y) == $colour_b) { + ++$cnt; + } + } + } - // imagecolordeallocate($im, $colour_w); - // imagecolordeallocate($im, $colour_b); + // imagecolordeallocate($im, $colour_w); + // imagecolordeallocate($im, $colour_b); - return ($cnt < ($sx * $sy)); - } + return ($cnt < ($sx * $sy)); + } - $im = imagecreate(256, 256); - var_dump(testrun($im, $fontfile_8859)); - imagedestroy($im); + $im = imagecreate(256, 256); + var_dump(testrun($im, $fontfile_8859)); + imagedestroy($im); - $im = imagecreatetruecolor(256, 256); - var_dump(testrun($im, $fontfile_8859)); - imagedestroy($im); + $im = imagecreatetruecolor(256, 256); + var_dump(testrun($im, $fontfile_8859)); + imagedestroy($im); ?> --EXPECT-- bool(true) diff --git a/ext/gd/tests/imageinterpolation_basic.phpt b/ext/gd/tests/imageinterpolation_basic.phpt index 80e88647d8..4f01f9b0f2 100644 --- a/ext/gd/tests/imageinterpolation_basic.phpt +++ b/ext/gd/tests/imageinterpolation_basic.phpt @@ -7,32 +7,32 @@ if (!extension_loaded('gd')) die('skip gd extension not available'); --FILE-- <?php $methods = array( - IMG_BELL, - IMG_BESSEL, - IMG_BILINEAR_FIXED, - IMG_BICUBIC, - IMG_BICUBIC_FIXED, - IMG_BLACKMAN, - IMG_BOX, - IMG_BSPLINE, - IMG_CATMULLROM, - IMG_GAUSSIAN, - IMG_GENERALIZED_CUBIC, - IMG_HERMITE, - IMG_HAMMING, - IMG_HANNING, - IMG_MITCHELL, - IMG_NEAREST_NEIGHBOUR, - IMG_POWER, - IMG_QUADRATIC, - IMG_SINC, - IMG_TRIANGLE, - IMG_WEIGHTED4, + IMG_BELL, + IMG_BESSEL, + IMG_BILINEAR_FIXED, + IMG_BICUBIC, + IMG_BICUBIC_FIXED, + IMG_BLACKMAN, + IMG_BOX, + IMG_BSPLINE, + IMG_CATMULLROM, + IMG_GAUSSIAN, + IMG_GENERALIZED_CUBIC, + IMG_HERMITE, + IMG_HAMMING, + IMG_HANNING, + IMG_MITCHELL, + IMG_NEAREST_NEIGHBOUR, + IMG_POWER, + IMG_QUADRATIC, + IMG_SINC, + IMG_TRIANGLE, + IMG_WEIGHTED4, ); $im = imagecreate(8, 8); foreach ($methods as $method) { - imagesetinterpolation($im, $method); - var_dump(imagegetinterpolation($im) === $method); + imagesetinterpolation($im, $method); + var_dump(imagegetinterpolation($im) === $method); } ?> --EXPECT-- diff --git a/ext/gd/tests/imagewbmp-mb.phpt b/ext/gd/tests/imagewbmp-mb.phpt index fefbb066c7..664f42c4e3 100644 --- a/ext/gd/tests/imagewbmp-mb.phpt +++ b/ext/gd/tests/imagewbmp-mb.phpt @@ -18,9 +18,9 @@ echo 'test create wbmp: '; $c = imagecolorsforindex($im2, imagecolorat($im2, 3,3)); $failed = false; foreach ($c as $v) { - if ($v != 0) { - $failed = true; - } + if ($v != 0) { + $failed = true; + } } echo !$failed ? 'ok' : 'failed'; echo "\n"; diff --git a/ext/gd/tests/imagewbmp.phpt b/ext/gd/tests/imagewbmp.phpt index 27491bb42e..ee5dd5c6e2 100644 --- a/ext/gd/tests/imagewbmp.phpt +++ b/ext/gd/tests/imagewbmp.phpt @@ -18,9 +18,9 @@ echo 'test create wbmp: '; $c = imagecolorsforindex($im2, imagecolorat($im2, 3,3)); $failed = false; foreach ($c as $v) { - if ($v != 0) { - $failed = true; - } + if ($v != 0) { + $failed = true; + } } echo !$failed ? 'ok' : 'failed'; echo "\n"; diff --git a/ext/gd/tests/jpeg2png.phpt b/ext/gd/tests/jpeg2png.phpt index 8d14b33e3a..dfcd1ef1a2 100644 --- a/ext/gd/tests/jpeg2png.phpt +++ b/ext/gd/tests/jpeg2png.phpt @@ -15,28 +15,28 @@ jpeg <--> png conversion test ?> --FILE-- <?php - $cwd = __DIR__; + $cwd = __DIR__; - echo "PNG to JPEG conversion: "; - echo imagejpeg(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_jpeg.jpeg") ? 'ok' : 'failed'; - echo "\n"; + echo "PNG to JPEG conversion: "; + echo imagejpeg(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_jpeg.jpeg") ? 'ok' : 'failed'; + echo "\n"; - echo "Generated JPEG to PNG conversion: "; - echo imagepng(imagecreatefromjpeg($cwd . "/test_jpeg.jpeg"), $cwd . "/test_jpng.png") ? 'ok' : 'failed'; - echo "\n"; + echo "Generated JPEG to PNG conversion: "; + echo imagepng(imagecreatefromjpeg($cwd . "/test_jpeg.jpeg"), $cwd . "/test_jpng.png") ? 'ok' : 'failed'; + echo "\n"; - echo "JPEG to PNG conversion: "; - echo imagepng(imagecreatefromjpeg($cwd . "/conv_test.jpg"), $cwd . "/test_png.png") ? 'ok' : 'failed'; - echo "\n"; + echo "JPEG to PNG conversion: "; + echo imagepng(imagecreatefromjpeg($cwd . "/conv_test.jpg"), $cwd . "/test_png.png") ? 'ok' : 'failed'; + echo "\n"; - echo "Generated PNG to JPEG conversion: "; - echo imagejpeg(imagecreatefrompng($cwd . "/test_png.png"), $cwd . "/test_pjpeg.jpeg") ? 'ok' : 'failed'; - echo "\n"; + echo "Generated PNG to JPEG conversion: "; + echo imagejpeg(imagecreatefrompng($cwd . "/test_png.png"), $cwd . "/test_pjpeg.jpeg") ? 'ok' : 'failed'; + echo "\n"; - @unlink($cwd . "/test_jpeg.jpeg"); - @unlink($cwd . "/test_jpng.png"); - @unlink($cwd . "/test_png.png"); - @unlink($cwd . "/test_pjpeg.jpeg"); + @unlink($cwd . "/test_jpeg.jpeg"); + @unlink($cwd . "/test_jpng.png"); + @unlink($cwd . "/test_png.png"); + @unlink($cwd . "/test_pjpeg.jpeg"); ?> --EXPECT-- PNG to JPEG conversion: ok diff --git a/ext/gd/tests/jpg2gd-mb.phpt b/ext/gd/tests/jpg2gd-mb.phpt index b7c0b98ab4..8cf4ffd283 100644 --- a/ext/gd/tests/jpg2gd-mb.phpt +++ b/ext/gd/tests/jpg2gd-mb.phpt @@ -12,28 +12,28 @@ jpeg <--> gd1/gd2 conversion test ?> --FILE-- <?php - $cwd = __DIR__; + $cwd = __DIR__; - echo "JPEG to GD1 conversion: "; - echo imagegd(imagecreatefromjpeg($cwd . "/conv_testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg"), $cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd1") ? 'ok' : 'failed'; - echo "\n"; + echo "JPEG to GD1 conversion: "; + echo imagegd(imagecreatefromjpeg($cwd . "/conv_testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg"), $cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd1") ? 'ok' : 'failed'; + echo "\n"; - echo "JPEG to GD2 conversion: "; - echo imagegd2(imagecreatefromjpeg($cwd . "/conv_testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg"), $cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2") ? 'ok' : 'failed'; - echo "\n"; + echo "JPEG to GD2 conversion: "; + echo imagegd2(imagecreatefromjpeg($cwd . "/conv_testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg"), $cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2") ? 'ok' : 'failed'; + echo "\n"; - echo "GD1 to JPEG conversion: "; - echo imagejpeg(imagecreatefromgd($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed'; - echo "\n"; + echo "GD1 to JPEG conversion: "; + echo imagejpeg(imagecreatefromgd($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed'; + echo "\n"; - echo "GD2 to JPEG conversion: "; - echo imagejpeg(imagecreatefromgd2($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed'; - echo "\n"; + echo "GD2 to JPEG conversion: "; + echo imagejpeg(imagecreatefromgd2($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed'; + echo "\n"; - @unlink($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd1"); - @unlink($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2"); - @unlink($cwd . "/test_gd1.jpeg"); - @unlink($cwd . "/test_gd2.jpeg"); + @unlink($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd1"); + @unlink($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2"); + @unlink($cwd . "/test_gd1.jpeg"); + @unlink($cwd . "/test_gd2.jpeg"); ?> --EXPECT-- JPEG to GD1 conversion: ok diff --git a/ext/gd/tests/jpg2gd.phpt b/ext/gd/tests/jpg2gd.phpt index 6ec714ef27..da671e01ac 100644 --- a/ext/gd/tests/jpg2gd.phpt +++ b/ext/gd/tests/jpg2gd.phpt @@ -12,28 +12,28 @@ jpeg <--> gd1/gd2 conversion test ?> --FILE-- <?php - $cwd = __DIR__; + $cwd = __DIR__; - echo "JPEG to GD1 conversion: "; - echo imagegd(imagecreatefromjpeg($cwd . "/conv_test.jpg"), $cwd . "/test_jpeg.gd1") ? 'ok' : 'failed'; - echo "\n"; + echo "JPEG to GD1 conversion: "; + echo imagegd(imagecreatefromjpeg($cwd . "/conv_test.jpg"), $cwd . "/test_jpeg.gd1") ? 'ok' : 'failed'; + echo "\n"; - echo "JPEG to GD2 conversion: "; - echo imagegd2(imagecreatefromjpeg($cwd . "/conv_test.jpg"), $cwd . "/test_jpeg.gd2") ? 'ok' : 'failed'; - echo "\n"; + echo "JPEG to GD2 conversion: "; + echo imagegd2(imagecreatefromjpeg($cwd . "/conv_test.jpg"), $cwd . "/test_jpeg.gd2") ? 'ok' : 'failed'; + echo "\n"; - echo "GD1 to JPEG conversion: "; - echo imagejpeg(imagecreatefromgd($cwd . "/test_jpeg.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed'; - echo "\n"; + echo "GD1 to JPEG conversion: "; + echo imagejpeg(imagecreatefromgd($cwd . "/test_jpeg.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed'; + echo "\n"; - echo "GD2 to JPEG conversion: "; - echo imagejpeg(imagecreatefromgd2($cwd . "/test_jpeg.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed'; - echo "\n"; + echo "GD2 to JPEG conversion: "; + echo imagejpeg(imagecreatefromgd2($cwd . "/test_jpeg.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed'; + echo "\n"; - @unlink($cwd . "/test_jpeg.gd1"); - @unlink($cwd . "/test_jpeg.gd2"); - @unlink($cwd . "/test_gd1.jpeg"); - @unlink($cwd . "/test_gd2.jpeg"); + @unlink($cwd . "/test_jpeg.gd1"); + @unlink($cwd . "/test_jpeg.gd2"); + @unlink($cwd . "/test_gd1.jpeg"); + @unlink($cwd . "/test_gd2.jpeg"); ?> --EXPECT-- JPEG to GD1 conversion: ok diff --git a/ext/gd/tests/libgd00106.phpt b/ext/gd/tests/libgd00106.phpt index 65e4692ea3..d651b0bb1f 100644 --- a/ext/gd/tests/libgd00106.phpt +++ b/ext/gd/tests/libgd00106.phpt @@ -13,9 +13,9 @@ $c2 = imagecolorat($im, 1,2); $c3 = imagecolorat($im, 2,1); $c4 = imagecolorat($im, 2,2); if ($c1 == 0xFFFFFF && $c2 == 0 && $c3 == 0 && $c4 == 0) { - echo "Ok"; + echo "Ok"; } else { - echo "failed"; + echo "failed"; } ?> --EXPECT-- diff --git a/ext/gd/tests/libgd00191.phpt b/ext/gd/tests/libgd00191.phpt index 6e3ffd51b1..983b93e180 100644 --- a/ext/gd/tests/libgd00191.phpt +++ b/ext/gd/tests/libgd00191.phpt @@ -14,9 +14,9 @@ imagefilledellipse($im, 30, 50, 20, 20, imagecolorallocate($im, 0, 0, 0)); $index = imagecolorat($im, 12, 28); $arr = imagecolorsforindex($im, $index); if ($arr['red'] == 255 && $arr['green'] == 255 && $arr['blue'] == 255) { - echo "Ok"; + echo "Ok"; } else { - echo "failed"; + echo "failed"; } ?> --EXPECT-- diff --git a/ext/gd/tests/lines.phpt b/ext/gd/tests/lines.phpt index 9401b6c82d..34e8304dcd 100644 --- a/ext/gd/tests/lines.phpt +++ b/ext/gd/tests/lines.phpt @@ -16,10 +16,10 @@ $p1 = imagecolorat($im, 0,5)==0x00ff00; $p2 = imagecolorat($im, 5,5)==0x00ff00; $p3 = true; for ($x=1; $x<5; $x++) { - $p3 = $p3 && (imagecolorat($im, $x,5)==0x00ff00); + $p3 = $p3 && (imagecolorat($im, $x,5)==0x00ff00); } if ($p1 && $p2 && $p3) { - echo "Horizontal: ok\n"; + echo "Horizontal: ok\n"; } $im = imagecreatetruecolor(6,6); @@ -30,11 +30,11 @@ $p1 = imagecolorat($im, 0,0)==0x00ff00; $p2 = imagecolorat($im, 0,5)==0x00ff00; $p3 = true; for ($y=1; $y<5; $y++) { - $p3 = $p3 && (imagecolorat($im, 0,$y)==0x00ff00); + $p3 = $p3 && (imagecolorat($im, 0,$y)==0x00ff00); } if ($p1 && $p2 && $p3) { - echo "Vertical: ok\n"; + echo "Vertical: ok\n"; } @@ -50,12 +50,12 @@ $x=1; $p3 = true; for ($y=1; $y<5; $y++) { - $p3 = $p3 && (imagecolorat($im, $x,$y)==0x00ff00); - $x++; + $p3 = $p3 && (imagecolorat($im, $x,$y)==0x00ff00); + $x++; } if ($p1 && $p2 && $p3) { - echo "Diagonal: ok\n"; + echo "Diagonal: ok\n"; } // Outside @@ -64,12 +64,12 @@ imagefill($im, 0,0, 0xffffff); imageline($im, 12, 12, 23,23, 0x00ff00); $p3 = true; for ($x=0; $x<6; $x++) { - for ($y=0; $y<6; $y++) { - $p3 = $p3 && (imagecolorat($im, $x,$y)!=0x00ff00); - } + for ($y=0; $y<6; $y++) { + $p3 = $p3 && (imagecolorat($im, $x,$y)!=0x00ff00); + } } if ($p3) { - echo "Outside 1: ok\n"; + echo "Outside 1: ok\n"; } $im = imagecreatetruecolor(6,6); @@ -77,12 +77,12 @@ imagefill($im, 0,0, 0xffffff); imageline($im, -12, -12, -23,-23, 0x00ff00); $p3 = true; for ($x=0; $x<6; $x++) { - for ($y=0; $y<6; $y++) { - $p3 = $p3 && (imagecolorat($im, $x,$y)!=0x00ff00); - } + for ($y=0; $y<6; $y++) { + $p3 = $p3 && (imagecolorat($im, $x,$y)!=0x00ff00); + } } if ($p3) { - echo "Outside 2: ok\n"; + echo "Outside 2: ok\n"; } $im = imagecreatetruecolor(6,6); @@ -90,12 +90,12 @@ imagefill($im, 0,0, 0xffffff); imageline($im, -1, -1, 4,4, 0x00ff00); $p3 = true; for ($x=0; $x<5; $x++) { - for ($y=0; $y<5; $y++) { - $p3 = $p3 && (imagecolorat($im, $x,$y)==0x00ff00); - } + for ($y=0; $y<5; $y++) { + $p3 = $p3 && (imagecolorat($im, $x,$y)==0x00ff00); + } } if ($p3) { - echo "Outside 2: ok\n"; + echo "Outside 2: ok\n"; } diff --git a/ext/gd/tests/png2gd.phpt b/ext/gd/tests/png2gd.phpt index ea70298292..850cdd0be2 100644 --- a/ext/gd/tests/png2gd.phpt +++ b/ext/gd/tests/png2gd.phpt @@ -12,28 +12,28 @@ png <--> gd1/gd2 conversion test ?> --FILE-- <?php - $cwd = __DIR__; + $cwd = __DIR__; - echo "PNG to GD1 conversion: "; - echo imagegd(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_png.gd1") ? 'ok' : 'failed'; - echo "\n"; + echo "PNG to GD1 conversion: "; + echo imagegd(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_png.gd1") ? 'ok' : 'failed'; + echo "\n"; - echo "PNG to GD2 conversion: "; - echo imagegd2(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_png.gd2") ? 'ok' : 'failed'; - echo "\n"; + echo "PNG to GD2 conversion: "; + echo imagegd2(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_png.gd2") ? 'ok' : 'failed'; + echo "\n"; - echo "GD1 to PNG conversion: "; - echo imagepng(imagecreatefromgd($cwd . "/test_png.gd1"), $cwd . "/test_gd1.png") ? 'ok' : 'failed'; - echo "\n"; + echo "GD1 to PNG conversion: "; + echo imagepng(imagecreatefromgd($cwd . "/test_png.gd1"), $cwd . "/test_gd1.png") ? 'ok' : 'failed'; + echo "\n"; - echo "GD2 to PNG conversion: "; - echo imagepng(imagecreatefromgd2($cwd . "/test_png.gd2"), $cwd . "/test_gd2.png") ? 'ok' : 'failed'; - echo "\n"; + echo "GD2 to PNG conversion: "; + echo imagepng(imagecreatefromgd2($cwd . "/test_png.gd2"), $cwd . "/test_gd2.png") ? 'ok' : 'failed'; + echo "\n"; - @unlink($cwd . "/test_png.gd1"); - @unlink($cwd . "/test_png.gd2"); - @unlink($cwd . "/test_gd1.png"); - @unlink($cwd . "/test_gd2.png"); + @unlink($cwd . "/test_png.gd1"); + @unlink($cwd . "/test_png.gd2"); + @unlink($cwd . "/test_gd1.png"); + @unlink($cwd . "/test_gd2.png"); ?> --EXPECT-- PNG to GD1 conversion: ok diff --git a/ext/gd/tests/pngcomp.phpt b/ext/gd/tests/pngcomp.phpt index aa663a6dd2..f9065ea82a 100644 --- a/ext/gd/tests/pngcomp.phpt +++ b/ext/gd/tests/pngcomp.phpt @@ -12,9 +12,9 @@ png compression test ?> --FILE-- <?php - $cwd = __DIR__; + $cwd = __DIR__; - echo "PNG compression test: "; + echo "PNG compression test: "; $im = imagecreatetruecolor(20,20); imagefilledrectangle($im, 5,5, 10,10, 0xffffff); @@ -26,7 +26,7 @@ png compression test echo "ok\n"; } - @unlink($cwd . "/test_pngcomp.png"); + @unlink($cwd . "/test_pngcomp.png"); ?> --EXPECT-- PNG compression test: ok diff --git a/ext/gd/tests/types.phpt b/ext/gd/tests/types.phpt index 246e3ba7d2..7510ba17c6 100644 --- a/ext/gd/tests/types.phpt +++ b/ext/gd/tests/types.phpt @@ -9,23 +9,23 @@ imagetypes $flags = imagetypes(); if ($flags&0x1 && !function_exists("imagegif")) { - echo "gif failed\n"; + echo "gif failed\n"; } if ($flags&0x2 && !function_exists("imagejpeg")) { - echo "jpeg failed\n"; + echo "jpeg failed\n"; } if ($flags&0x4 && !function_exists("imagepng")) { - echo "png failed\n"; + echo "png failed\n"; } if ($flags&0x8 && !function_exists("imagewbmp")) { - echo "wbmp failed\n"; + echo "wbmp failed\n"; } if ($flags&16 && !function_exists("imagecreatefromxpm")) { - echo "xom failed\n"; + echo "xom failed\n"; } echo "ok\n"; ?> diff --git a/ext/gd/tests/xbm2png.phpt b/ext/gd/tests/xbm2png.phpt index 8dcd07bc4a..9b1b4013c8 100644 --- a/ext/gd/tests/xbm2png.phpt +++ b/ext/gd/tests/xbm2png.phpt @@ -14,13 +14,13 @@ xbm --> png conversion test ?> --FILE-- <?php - $cwd = __DIR__; + $cwd = __DIR__; - echo "XBM to PNG conversion: "; - echo imagepng(imagecreatefromxbm($cwd . "/conv_test.xbm"), $cwd . "/test_xbm.png") ? 'ok' : 'failed'; - echo "\n"; + echo "XBM to PNG conversion: "; + echo imagepng(imagecreatefromxbm($cwd . "/conv_test.xbm"), $cwd . "/test_xbm.png") ? 'ok' : 'failed'; + echo "\n"; - @unlink($cwd . "/test_xbm.png"); + @unlink($cwd . "/test_xbm.png"); ?> --EXPECT-- XBM to PNG conversion: ok diff --git a/ext/gd/tests/xpm2gd.phpt b/ext/gd/tests/xpm2gd.phpt index f48dcb2b3b..dba9f03ec8 100644 --- a/ext/gd/tests/xpm2gd.phpt +++ b/ext/gd/tests/xpm2gd.phpt @@ -12,18 +12,18 @@ xpm --> gd1/gd2 conversion test ?> --FILE-- <?php - $cwd = __DIR__; + $cwd = __DIR__; - echo "XPM to GD1 conversion: "; - echo imagegd(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.gd1") ? 'ok' : 'failed'; - echo "\n"; + echo "XPM to GD1 conversion: "; + echo imagegd(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.gd1") ? 'ok' : 'failed'; + echo "\n"; - echo "XPM to GD2 conversion: "; - echo imagegd2(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.gd2") ? 'ok' : 'failed'; - echo "\n"; + echo "XPM to GD2 conversion: "; + echo imagegd2(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.gd2") ? 'ok' : 'failed'; + echo "\n"; - @unlink($cwd . "/test_xpm.gd1"); - @unlink($cwd . "/test_xpm.gd2"); + @unlink($cwd . "/test_xpm.gd1"); + @unlink($cwd . "/test_xpm.gd2"); ?> --EXPECT-- XPM to GD1 conversion: ok diff --git a/ext/gd/tests/xpm2jpg.phpt b/ext/gd/tests/xpm2jpg.phpt index 92cab3e5fa..6491b85646 100644 --- a/ext/gd/tests/xpm2jpg.phpt +++ b/ext/gd/tests/xpm2jpg.phpt @@ -15,13 +15,13 @@ xpm --> jpeg conversion test ?> --FILE-- <?php - $cwd = __DIR__; + $cwd = __DIR__; - echo "XPM to JPEG conversion: "; - echo imagejpeg(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.jpeg") ? 'ok' : 'failed'; - echo "\n"; + echo "XPM to JPEG conversion: "; + echo imagejpeg(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.jpeg") ? 'ok' : 'failed'; + echo "\n"; - @unlink($cwd . "/test_xpm.jpeg"); + @unlink($cwd . "/test_xpm.jpeg"); ?> --EXPECT-- XPM to JPEG conversion: ok diff --git a/ext/gd/tests/xpm2png.phpt b/ext/gd/tests/xpm2png.phpt index e473cfb31c..602fc72a7c 100644 --- a/ext/gd/tests/xpm2png.phpt +++ b/ext/gd/tests/xpm2png.phpt @@ -15,13 +15,13 @@ xpm --> png conversion test ?> --FILE-- <?php - $cwd = __DIR__; + $cwd = __DIR__; - echo "XPM to PNG conversion: "; - echo imagepng(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.png") ? 'ok' : 'failed'; - echo "\n"; + echo "XPM to PNG conversion: "; + echo imagepng(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.png") ? 'ok' : 'failed'; + echo "\n"; - @unlink($cwd . "/test_xpm.png"); + @unlink($cwd . "/test_xpm.png"); ?> --EXPECT-- XPM to PNG conversion: ok diff --git a/ext/gettext/tests/bug66267.phpt b/ext/gettext/tests/bug66267.phpt index 30a839390b..749f4cd1a2 100644 --- a/ext/gettext/tests/bug66267.phpt +++ b/ext/gettext/tests/bug66267.phpt @@ -27,17 +27,17 @@ $domain = 'domain'; $loc = ["de_DE", "fr_FR", "en_US"]; foreach ($loc as $l) { - putenv("LC_ALL=$l"); - setlocale(LC_ALL, $l); + putenv("LC_ALL=$l"); + setlocale(LC_ALL, $l); - $path = realpath(__DIR__ . DIRECTORY_SEPARATOR . "66265"); - bindtextdomain($domain, $path); - bind_textdomain_codeset($domain, "UTF-8"); - textdomain($domain); + $path = realpath(__DIR__ . DIRECTORY_SEPARATOR . "66265"); + bindtextdomain($domain, $path); + bind_textdomain_codeset($domain, "UTF-8"); + textdomain($domain); - echo 'LC_ALL=', getenv('LC_ALL'), "\n"; - echo 'hello=', _('hello'), "\n"; - echo "\n"; + echo 'LC_ALL=', getenv('LC_ALL'), "\n"; + echo 'hello=', _('hello'), "\n"; + echo "\n"; } ?> diff --git a/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt b/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt index 822e412d83..498568294a 100644 --- a/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt +++ b/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt @@ -8,10 +8,10 @@ test if bind_textdomain_codeset() returns correct value ?> --FILE-- <?php - var_dump(bind_textdomain_codeset(false,false)); - var_dump(bind_textdomain_codeset('messages', "UTF-8")); + var_dump(bind_textdomain_codeset(false,false)); + var_dump(bind_textdomain_codeset('messages', "UTF-8")); - echo "Done\n"; + echo "Done\n"; ?> --EXPECT-- bool(false) diff --git a/ext/gmp/tests/bug52906.phpt b/ext/gmp/tests/bug52906.phpt index e00080d7ab..7172ec3b4e 100644 --- a/ext/gmp/tests/bug52906.phpt +++ b/ext/gmp/tests/bug52906.phpt @@ -6,21 +6,21 @@ Bug #52906 gmp_mod returns negative result when non-negative is expected <?php $vals = array( - array(7, 3), - array(2, 7), - array(12, 7), - array(-2, 7), - array(-12, 7), - array(2, -7), - array(12, -7), - array(-2, -7), - array(-12, -7), + array(7, 3), + array(2, 7), + array(12, 7), + array(-2, 7), + array(-12, 7), + array(2, -7), + array(12, -7), + array(-2, -7), + array(-12, -7), ); foreach($vals as $data) { - echo "{$data[0]}%{$data[1]}=".gmp_strval(gmp_mod($data[0], $data[1])); - echo "\n"; - echo "{$data[0]}%{$data[1]}=".gmp_strval(gmp_mod(gmp_init($data[0]), gmp_init($data[1]))); - echo "\n"; + echo "{$data[0]}%{$data[1]}=".gmp_strval(gmp_mod($data[0], $data[1])); + echo "\n"; + echo "{$data[0]}%{$data[1]}=".gmp_strval(gmp_mod(gmp_init($data[0]), gmp_init($data[1]))); + echo "\n"; } echo "Done\n"; ?> diff --git a/ext/gmp/tests/bug70284.phpt b/ext/gmp/tests/bug70284.phpt index 49df5d0359..7dd2e37512 100644 --- a/ext/gmp/tests/bug70284.phpt +++ b/ext/gmp/tests/bug70284.phpt @@ -18,7 +18,7 @@ $fakezval .= "\x00"; $fakezval .= "\x00\x00"; for ($i = 0; $i < 5; $i++) { - $v[$i] = $fakezval.$i; + $v[$i] = $fakezval.$i; } var_dump($data); @@ -26,11 +26,11 @@ var_dump($data); function ptr2str($ptr) { $out = ''; - for ($i = 0; $i < 8; $i++) { - $out .= chr($ptr & 0xff); - $ptr >>= 8; - } - return $out; + for ($i = 0; $i < 8; $i++) { + $out .= chr($ptr & 0xff); + $ptr >>= 8; + } + return $out; } ?> --EXPECTF-- diff --git a/ext/gmp/tests/gmp_gcdext.phpt b/ext/gmp/tests/gmp_gcdext.phpt index d02f341129..9a923fcd4e 100644 --- a/ext/gmp/tests/gmp_gcdext.phpt +++ b/ext/gmp/tests/gmp_gcdext.phpt @@ -10,23 +10,23 @@ $n = gmp_init("34293864345"); $n1 = gmp_init("23434293864345"); $a = array( - array(123,45), - array(4341,9734), - array(23487,333), - array(-234234,-123123), - array(-100,-2234), - array(345,"34587345"), - array(345,"0"), - array("345556456",345873), - array("34545345556456","323432445873"), - array($n, $n1), - ); + array(123,45), + array(4341,9734), + array(23487,333), + array(-234234,-123123), + array(-100,-2234), + array(345,"34587345"), + array(345,"0"), + array("345556456",345873), + array("34545345556456","323432445873"), + array($n, $n1), + ); foreach ($a as $val) { - $r = gmp_gcdext($val[0],$val[1]); - $check = gmp_add(gmp_mul($val[0],$r['s']), gmp_mul($val[1],$r['t'])); - var_dump(gmp_strval($r['g'])); - var_dump(gmp_strval($check)); + $r = gmp_gcdext($val[0],$val[1]); + $check = gmp_add(gmp_mul($val[0],$r['s']), gmp_mul($val[1],$r['t'])); + var_dump(gmp_strval($r['g'])); + var_dump(gmp_strval($check)); } var_dump(gmp_gcdext($val[0],array())); diff --git a/ext/gmp/tests/gmp_jacobi.phpt b/ext/gmp/tests/gmp_jacobi.phpt index 2040b666f6..adf3f6a0b2 100644 --- a/ext/gmp/tests/gmp_jacobi.phpt +++ b/ext/gmp/tests/gmp_jacobi.phpt @@ -6,7 +6,7 @@ gmp_jacobi() basic tests <?php for ($i = -1; $i < 10; $i++) { - var_dump(gmp_strval(gmp_jacobi(($i*$i)-1, 3))); + var_dump(gmp_strval(gmp_jacobi(($i*$i)-1, 3))); } var_dump(gmp_strval(gmp_jacobi(7, 23))); diff --git a/ext/gmp/tests/gmp_legendre.phpt b/ext/gmp/tests/gmp_legendre.phpt index 6b6197f25a..ac51ad3da4 100644 --- a/ext/gmp/tests/gmp_legendre.phpt +++ b/ext/gmp/tests/gmp_legendre.phpt @@ -6,7 +6,7 @@ gmp_legendre() basic tests <?php for ($i = -1; $i < 10; $i++) { - var_dump(gmp_strval(gmp_legendre(($i*$i)-1, 3))); + var_dump(gmp_strval(gmp_legendre(($i*$i)-1, 3))); } var_dump(gmp_strval(gmp_legendre(7, 23))); diff --git a/ext/gmp/tests/gmp_prob_prime.phpt b/ext/gmp/tests/gmp_prob_prime.phpt index 2872e01d84..3b05a0215f 100644 --- a/ext/gmp/tests/gmp_prob_prime.phpt +++ b/ext/gmp/tests/gmp_prob_prime.phpt @@ -18,9 +18,9 @@ var_dump(gmp_prob_prime(-31)); var_dump(gmp_prob_prime("172368715471481723")); for ($i = -1; $i < 12; $i++) { - var_dump(gmp_prob_prime((773*$i)-($i*7)-1, $i)); - $n = gmp_init("23476812735411"); - var_dump(gmp_prob_prime(gmp_add($n, $i-1), $i)); + var_dump(gmp_prob_prime((773*$i)-($i*7)-1, $i)); + $n = gmp_init("23476812735411"); + var_dump(gmp_prob_prime(gmp_add($n, $i-1), $i)); } $n = gmp_init("19481923"); diff --git a/ext/gmp/tests/gmp_random_bits.phpt b/ext/gmp/tests/gmp_random_bits.phpt index 42b90d6fe3..1d6df72831 100644 --- a/ext/gmp/tests/gmp_random_bits.phpt +++ b/ext/gmp/tests/gmp_random_bits.phpt @@ -16,18 +16,18 @@ gmp_random_bits(1024); $start = microtime(true); $limit = (2 ** 30) - 1; while (1) { - for ($i = 0; $i < 5000; $i++) { - $result = gmp_random_bits(30); - if ($result < 0 || $result > $limit) { - print "RANGE VIOLATION\n"; - var_dump($result); - break 2; - } - } + for ($i = 0; $i < 5000; $i++) { + $result = gmp_random_bits(30); + if ($result < 0 || $result > $limit) { + print "RANGE VIOLATION\n"; + var_dump($result); + break 2; + } + } - if (microtime(true) - $start > 0.5) { - break; - } + if (microtime(true) - $start > 0.5) { + break; + } } echo "Done\n"; diff --git a/ext/gmp/tests/gmp_random_range.phpt b/ext/gmp/tests/gmp_random_range.phpt index fec8274167..7ff6c546b4 100644 --- a/ext/gmp/tests/gmp_random_range.phpt +++ b/ext/gmp/tests/gmp_random_range.phpt @@ -31,32 +31,32 @@ gmp_random_range($minusTen, $plusTen); // 0.5 seconds to make sure the numbers stay in range $start = microtime(true); while (1) { - for ($i = 0; $i < 5000; $i++) { - $result = gmp_random_range(0, 1000); - if ($result < 0 || $result > 1000) { - print "RANGE VIOLATION 1\n"; - var_dump($result); - break 2; - } + for ($i = 0; $i < 5000; $i++) { + $result = gmp_random_range(0, 1000); + if ($result < 0 || $result > 1000) { + print "RANGE VIOLATION 1\n"; + var_dump($result); + break 2; + } - $result = gmp_random_range(-1000, 0); - if ($result < -1000 || $result > 0) { - print "RANGE VIOLATION 2\n"; - var_dump($result); - break 2; - } + $result = gmp_random_range(-1000, 0); + if ($result < -1000 || $result > 0) { + print "RANGE VIOLATION 2\n"; + var_dump($result); + break 2; + } - $result = gmp_random_range(-500, 500); - if ($result < -500 || $result > 500) { - print "RANGE VIOLATION 3\n"; - var_dump($result); - break 2; - } - } + $result = gmp_random_range(-500, 500); + if ($result < -500 || $result > 500) { + print "RANGE VIOLATION 3\n"; + var_dump($result); + break 2; + } + } - if (microtime(true) - $start > 0.5) { - break; - } + if (microtime(true) - $start > 0.5) { + break; + } } echo "Done\n"; diff --git a/ext/gmp/tests/gmp_setbit_long.phpt b/ext/gmp/tests/gmp_setbit_long.phpt index ce4e427132..d7f56767d8 100644 --- a/ext/gmp/tests/gmp_setbit_long.phpt +++ b/ext/gmp/tests/gmp_setbit_long.phpt @@ -25,7 +25,7 @@ gmp_setbit() with large index $n = gmp_init("227200"); for($a = 1<<30; $a > 0 && $a < 0x8000000000; $a <<= 2) { - $i = $a - 1; + $i = $a - 1; printf("%X\n", $i); gmp_setbit($n, $i, 1); } diff --git a/ext/hash/tests/fnv132.phpt b/ext/hash/tests/fnv132.phpt index 914ce46f35..37618819bd 100644 --- a/ext/hash/tests/fnv132.phpt +++ b/ext/hash/tests/fnv132.phpt @@ -4,192 +4,192 @@ Hash: FNV132 algorithm <?php function R10($t) { - return str_repeat($t, 10); + return str_repeat($t, 10); } function R500($t) { - return str_repeat($t, 500); + return str_repeat($t, 500); } $tests = array( - array( "", "811c9dc5" ), - array( "a", "050c5d7e" ), - array( "b", "050c5d7d" ), - array( "c", "050c5d7c" ), - array( "d", "050c5d7b" ), - array( "e", "050c5d7a" ), - array( "f", "050c5d79" ), - array( "fo", "6b772514" ), - array( "foo", "408f5e13" ), - array( "foob", "b4b1178b" ), - array( "fooba", "fdc80fb0" ), - array( "foobar", "31f0b262" ), - array( "\0", "050c5d1f" ), - array( "a\0", "70772d5a" ), - array( "b\0", "6f772bc7" ), - array( "c\0", "6e772a34" ), - array( "d\0", "6d7728a1" ), - array( "e\0", "6c77270e" ), - array( "f\0", "6b77257b" ), - array( "fo\0", "408f5e7c" ), - array( "foo\0", "b4b117e9" ), - array( "foob\0", "fdc80fd1" ), - array( "fooba\0", "31f0b210" ), - array( "foobar\0", "ffe8d046" ), - array( "ch", "6e772a5c" ), - array( "cho", "4197aebb" ), - array( "chon", "fcc8100f" ), - array( "chong", "fdf147fa" ), - array( "chongo", "bcd44ee1" ), - array( "chongo ", "23382c13" ), - array( "chongo w", "846d619e" ), - array( "chongo wa", "1630abdb" ), - array( "chongo was", "c99e89b2" ), - array( "chongo was ", "1692c316" ), - array( "chongo was h", "9f091bca" ), - array( "chongo was he", "2556be9b" ), - array( "chongo was her", "628e0e73" ), - array( "chongo was here", "98a0bf6c" ), - array( "chongo was here!", "b10d5725" ), - array( "chongo was here!\n", "dd002f35" ), - array( "ch\0", "4197aed4" ), - array( "cho\0", "fcc81061" ), - array( "chon\0", "fdf1479d" ), - array( "chong\0", "bcd44e8e" ), - array( "chongo\0", "23382c33" ), - array( "chongo \0", "846d61e9" ), - array( "chongo w\0", "1630abba" ), - array( "chongo wa\0", "c99e89c1" ), - array( "chongo was\0", "1692c336" ), - array( "chongo was \0", "9f091ba2" ), - array( "chongo was h\0", "2556befe" ), - array( "chongo was he\0", "628e0e01" ), - array( "chongo was her\0", "98a0bf09" ), - array( "chongo was here\0", "b10d5704" ), - array( "chongo was here!\0", "dd002f3f" ), - array( "chongo was here!\n\0", "1c4a506f" ), - array( "cu", "6e772a41" ), - array( "cur", "26978421" ), - array( "curd", "e184ff97" ), - array( "curds", "9b5e5ac6" ), - array( "curds ", "5b88e592" ), - array( "curds a", "aa8164b7" ), - array( "curds an", "20b18c7b" ), - array( "curds and", "f28025c5" ), - array( "curds and ", "84bb753f" ), - array( "curds and w", "3219925a" ), - array( "curds and wh", "384163c6" ), - array( "curds and whe", "54f010d7" ), - array( "curds and whey", "8cea820c" ), - array( "curds and whey\n", "e12ab8ee" ), - array( "cu\0", "26978453" ), - array( "cur\0", "e184fff3" ), - array( "curd\0", "9b5e5ab5" ), - array( "curds\0", "5b88e5b2" ), - array( "curds \0", "aa8164d6" ), - array( "curds a\0", "20b18c15" ), - array( "curds an\0", "f28025a1" ), - array( "curds and\0", "84bb751f" ), - array( "curds and \0", "3219922d" ), - array( "curds and w\0", "384163ae" ), - array( "curds and wh\0", "54f010b2" ), - array( "curds and whe\0", "8cea8275" ), - array( "curds and whey\0", "e12ab8e4" ), - array( "curds and whey\n\0", "64411eaa" ), - array( "line 1\nline 2\nline 3", "31ae8f83" ), - array( "chongo <Landon Curt Noll> /\\../\\", "995fa9c4" ), - array( "chongo <Landon Curt Noll> /\\../\\\0", "35983f8c" ), - array( "chongo (Landon Curt Noll) /\\../\\", "5036a251" ), - array( "chongo (Landon Curt Noll) /\\../\\\0", "97018583" ), - array( "http://antwrp.gsfc.nasa.gov/apod/astropix.html", "b4448d60" ), - array( "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash", "025dfe59" ), - array( "http://epod.usra.edu/", "c5eab3af" ), - array( "http://exoplanet.eu/", "7d21ba1e" ), - array( "http://hvo.wr.usgs.gov/cam3/", "7704cddb" ), - array( "http://hvo.wr.usgs.gov/cams/HMcam/", "d0071bfe" ), - array( "http://hvo.wr.usgs.gov/kilauea/update/deformation.html", "0ff3774c" ), - array( "http://hvo.wr.usgs.gov/kilauea/update/images.html", "b0fea0ea" ), - array( "http://hvo.wr.usgs.gov/kilauea/update/maps.html", "58177303" ), - array( "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html", "4f599cda" ), - array( "http://neo.jpl.nasa.gov/risk/", "3e590a47" ), - array( "http://norvig.com/21-days.html", "965595f8" ), - array( "http://primes.utm.edu/curios/home.php", "c37f178d" ), - array( "http://slashdot.org/", "9711dd26" ), - array( "http://tux.wr.usgs.gov/Maps/155.25-19.5.html", "23c99b7f" ), - array( "http://volcano.wr.usgs.gov/kilaueastatus.php", "6e568b17" ), - array( "http://www.avo.alaska.edu/activity/Redoubt.php", "43f0245b" ), - array( "http://www.dilbert.com/fast/", "bcb7a001" ), - array( "http://www.fourmilab.ch/gravitation/orbits/", "12e6dffe" ), - array( "http://www.fpoa.net/", "0792f2d6" ), - array( "http://www.ioccc.org/index.html", "b966936b" ), - array( "http://www.isthe.com/cgi-bin/number.cgi", "46439ac5" ), - array( "http://www.isthe.com/chongo/bio.html", "728d49af" ), - array( "http://www.isthe.com/chongo/index.html", "d33745c9" ), - array( "http://www.isthe.com/chongo/src/calc/lucas-calc", "bc382a57" ), - array( "http://www.isthe.com/chongo/tech/astro/venus2004.html", "4bda1d31" ), - array( "http://www.isthe.com/chongo/tech/astro/vita.html", "ce35ccae" ), - array( "http://www.isthe.com/chongo/tech/comp/c/expert.html", "3b6eed94" ), - array( "http://www.isthe.com/chongo/tech/comp/calc/index.html", "445c9c58" ), - array( "http://www.isthe.com/chongo/tech/comp/fnv/index.html", "3db8bf9d" ), - array( "http://www.isthe.com/chongo/tech/math/number/howhigh.html", "2dee116d" ), - array( "http://www.isthe.com/chongo/tech/math/number/number.html", "c18738da" ), - array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html", "5b156176" ), - array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest", "2aa7d593" ), - array( "http://www.lavarnd.org/cgi-bin/corpspeak.cgi", "b2409658" ), - array( "http://www.lavarnd.org/cgi-bin/haiku.cgi", "e1489528" ), - array( "http://www.lavarnd.org/cgi-bin/rand-none.cgi", "fe1ee07e" ), - array( "http://www.lavarnd.org/cgi-bin/randdist.cgi", "e8842315" ), - array( "http://www.lavarnd.org/index.html", "3a6a63a2" ), - array( "http://www.lavarnd.org/what/nist-test.html", "06d2c18c" ), - array( "http://www.macosxhints.com/", "f8ef7225" ), - array( "http://www.mellis.com/", "843d3300" ), - array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm", "bb24f7ae" ), - array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm", "878c0ec9" ), - array( "http://www.paulnoll.com/", "b557810f" ), - array( "http://www.pepysdiary.com/", "57423246" ), - array( "http://www.sciencenews.org/index/home/activity/view", "87f7505e" ), - array( "http://www.skyandtelescope.com/", "bb809f20" ), - array( "http://www.sput.nl/~rob/sirius.html", "8932abb5" ), - array( "http://www.systemexperts.com/", "0a9b3aa0" ), - array( "http://www.tq-international.com/phpBB3/index.php", "b8682a24" ), - array( "http://www.travelquesttours.com/index.htm", "a7ac1c56" ), - array( "http://www.wunderground.com/global/stations/89606.html", "11409252" ), - array( R10("21701"), "a987f517" ), - array( R10("M21701"), "f309e7ed" ), - array( R10("2^21701-1"), "c9e8f417" ), - array( R10("\x54\xc5"), "7f447bdd" ), - array( R10("\xc5\x54"), "b929adc5" ), - array( R10("23209"), "57022879" ), - array( R10("M23209"), "dcfd2c49" ), - array( R10("2^23209-1"), "6edafff5" ), - array( R10("\x5a\xa9"), "f04fb1f1" ), - array( R10("\xa9\x5a"), "fb7de8b9" ), - array( R10("391581216093"), "c5f1d7e9" ), - array( R10("391581*2^216093-1"), "32c1f439" ), - array( R10("\x05\xf9\x9d\x03\x4c\x81"), "7fd3eb7d" ), - array( R10("FEDCBA9876543210"), "81597da5" ), - array( R10("\xfe\xdc\xba\x98\x76\x54\x32\x10"), "05eb7a25" ), - array( R10("EFCDAB8967452301"), "9c0fa1b5" ), - array( R10("\xef\xcd\xab\x89\x67\x45\x23\x01"), "53ccb1c5" ), - array( R10("0123456789ABCDEF"), "fabece15" ), - array( R10("\x01\x23\x45\x67\x89\xab\xcd\xef"), "4ad745a5" ), - array( R10("1032547698BADCFE"), "e5bdc495" ), - array( R10("\x10\x32\x54\x76\x98\xba\xdc\xfe"), "23b3c0a5" ), - array( R500("\x00"), "fa823dd5" ), - array( R500("\x07"), "0c6c58b9" ), - array( R500("~"), "e2dbccd5" ), - array( R500("\x7f"), "db7f50f9" ), + array( "", "811c9dc5" ), + array( "a", "050c5d7e" ), + array( "b", "050c5d7d" ), + array( "c", "050c5d7c" ), + array( "d", "050c5d7b" ), + array( "e", "050c5d7a" ), + array( "f", "050c5d79" ), + array( "fo", "6b772514" ), + array( "foo", "408f5e13" ), + array( "foob", "b4b1178b" ), + array( "fooba", "fdc80fb0" ), + array( "foobar", "31f0b262" ), + array( "\0", "050c5d1f" ), + array( "a\0", "70772d5a" ), + array( "b\0", "6f772bc7" ), + array( "c\0", "6e772a34" ), + array( "d\0", "6d7728a1" ), + array( "e\0", "6c77270e" ), + array( "f\0", "6b77257b" ), + array( "fo\0", "408f5e7c" ), + array( "foo\0", "b4b117e9" ), + array( "foob\0", "fdc80fd1" ), + array( "fooba\0", "31f0b210" ), + array( "foobar\0", "ffe8d046" ), + array( "ch", "6e772a5c" ), + array( "cho", "4197aebb" ), + array( "chon", "fcc8100f" ), + array( "chong", "fdf147fa" ), + array( "chongo", "bcd44ee1" ), + array( "chongo ", "23382c13" ), + array( "chongo w", "846d619e" ), + array( "chongo wa", "1630abdb" ), + array( "chongo was", "c99e89b2" ), + array( "chongo was ", "1692c316" ), + array( "chongo was h", "9f091bca" ), + array( "chongo was he", "2556be9b" ), + array( "chongo was her", "628e0e73" ), + array( "chongo was here", "98a0bf6c" ), + array( "chongo was here!", "b10d5725" ), + array( "chongo was here!\n", "dd002f35" ), + array( "ch\0", "4197aed4" ), + array( "cho\0", "fcc81061" ), + array( "chon\0", "fdf1479d" ), + array( "chong\0", "bcd44e8e" ), + array( "chongo\0", "23382c33" ), + array( "chongo \0", "846d61e9" ), + array( "chongo w\0", "1630abba" ), + array( "chongo wa\0", "c99e89c1" ), + array( "chongo was\0", "1692c336" ), + array( "chongo was \0", "9f091ba2" ), + array( "chongo was h\0", "2556befe" ), + array( "chongo was he\0", "628e0e01" ), + array( "chongo was her\0", "98a0bf09" ), + array( "chongo was here\0", "b10d5704" ), + array( "chongo was here!\0", "dd002f3f" ), + array( "chongo was here!\n\0", "1c4a506f" ), + array( "cu", "6e772a41" ), + array( "cur", "26978421" ), + array( "curd", "e184ff97" ), + array( "curds", "9b5e5ac6" ), + array( "curds ", "5b88e592" ), + array( "curds a", "aa8164b7" ), + array( "curds an", "20b18c7b" ), + array( "curds and", "f28025c5" ), + array( "curds and ", "84bb753f" ), + array( "curds and w", "3219925a" ), + array( "curds and wh", "384163c6" ), + array( "curds and whe", "54f010d7" ), + array( "curds and whey", "8cea820c" ), + array( "curds and whey\n", "e12ab8ee" ), + array( "cu\0", "26978453" ), + array( "cur\0", "e184fff3" ), + array( "curd\0", "9b5e5ab5" ), + array( "curds\0", "5b88e5b2" ), + array( "curds \0", "aa8164d6" ), + array( "curds a\0", "20b18c15" ), + array( "curds an\0", "f28025a1" ), + array( "curds and\0", "84bb751f" ), + array( "curds and \0", "3219922d" ), + array( "curds and w\0", "384163ae" ), + array( "curds and wh\0", "54f010b2" ), + array( "curds and whe\0", "8cea8275" ), + array( "curds and whey\0", "e12ab8e4" ), + array( "curds and whey\n\0", "64411eaa" ), + array( "line 1\nline 2\nline 3", "31ae8f83" ), + array( "chongo <Landon Curt Noll> /\\../\\", "995fa9c4" ), + array( "chongo <Landon Curt Noll> /\\../\\\0", "35983f8c" ), + array( "chongo (Landon Curt Noll) /\\../\\", "5036a251" ), + array( "chongo (Landon Curt Noll) /\\../\\\0", "97018583" ), + array( "http://antwrp.gsfc.nasa.gov/apod/astropix.html", "b4448d60" ), + array( "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash", "025dfe59" ), + array( "http://epod.usra.edu/", "c5eab3af" ), + array( "http://exoplanet.eu/", "7d21ba1e" ), + array( "http://hvo.wr.usgs.gov/cam3/", "7704cddb" ), + array( "http://hvo.wr.usgs.gov/cams/HMcam/", "d0071bfe" ), + array( "http://hvo.wr.usgs.gov/kilauea/update/deformation.html", "0ff3774c" ), + array( "http://hvo.wr.usgs.gov/kilauea/update/images.html", "b0fea0ea" ), + array( "http://hvo.wr.usgs.gov/kilauea/update/maps.html", "58177303" ), + array( "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html", "4f599cda" ), + array( "http://neo.jpl.nasa.gov/risk/", "3e590a47" ), + array( "http://norvig.com/21-days.html", "965595f8" ), + array( "http://primes.utm.edu/curios/home.php", "c37f178d" ), + array( "http://slashdot.org/", "9711dd26" ), + array( "http://tux.wr.usgs.gov/Maps/155.25-19.5.html", "23c99b7f" ), + array( "http://volcano.wr.usgs.gov/kilaueastatus.php", "6e568b17" ), + array( "http://www.avo.alaska.edu/activity/Redoubt.php", "43f0245b" ), + array( "http://www.dilbert.com/fast/", "bcb7a001" ), + array( "http://www.fourmilab.ch/gravitation/orbits/", "12e6dffe" ), + array( "http://www.fpoa.net/", "0792f2d6" ), + array( "http://www.ioccc.org/index.html", "b966936b" ), + array( "http://www.isthe.com/cgi-bin/number.cgi", "46439ac5" ), + array( "http://www.isthe.com/chongo/bio.html", "728d49af" ), + array( "http://www.isthe.com/chongo/index.html", "d33745c9" ), + array( "http://www.isthe.com/chongo/src/calc/lucas-calc", "bc382a57" ), + array( "http://www.isthe.com/chongo/tech/astro/venus2004.html", "4bda1d31" ), + array( "http://www.isthe.com/chongo/tech/astro/vita.html", "ce35ccae" ), + array( "http://www.isthe.com/chongo/tech/comp/c/expert.html", "3b6eed94" ), + array( "http://www.isthe.com/chongo/tech/comp/calc/index.html", "445c9c58" ), + array( "http://www.isthe.com/chongo/tech/comp/fnv/index.html", "3db8bf9d" ), + array( "http://www.isthe.com/chongo/tech/math/number/howhigh.html", "2dee116d" ), + array( "http://www.isthe.com/chongo/tech/math/number/number.html", "c18738da" ), + array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html", "5b156176" ), + array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest", "2aa7d593" ), + array( "http://www.lavarnd.org/cgi-bin/corpspeak.cgi", "b2409658" ), + array( "http://www.lavarnd.org/cgi-bin/haiku.cgi", "e1489528" ), + array( "http://www.lavarnd.org/cgi-bin/rand-none.cgi", "fe1ee07e" ), + array( "http://www.lavarnd.org/cgi-bin/randdist.cgi", "e8842315" ), + array( "http://www.lavarnd.org/index.html", "3a6a63a2" ), + array( "http://www.lavarnd.org/what/nist-test.html", "06d2c18c" ), + array( "http://www.macosxhints.com/", "f8ef7225" ), + array( "http://www.mellis.com/", "843d3300" ), + array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm", "bb24f7ae" ), + array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm", "878c0ec9" ), + array( "http://www.paulnoll.com/", "b557810f" ), + array( "http://www.pepysdiary.com/", "57423246" ), + array( "http://www.sciencenews.org/index/home/activity/view", "87f7505e" ), + array( "http://www.skyandtelescope.com/", "bb809f20" ), + array( "http://www.sput.nl/~rob/sirius.html", "8932abb5" ), + array( "http://www.systemexperts.com/", "0a9b3aa0" ), + array( "http://www.tq-international.com/phpBB3/index.php", "b8682a24" ), + array( "http://www.travelquesttours.com/index.htm", "a7ac1c56" ), + array( "http://www.wunderground.com/global/stations/89606.html", "11409252" ), + array( R10("21701"), "a987f517" ), + array( R10("M21701"), "f309e7ed" ), + array( R10("2^21701-1"), "c9e8f417" ), + array( R10("\x54\xc5"), "7f447bdd" ), + array( R10("\xc5\x54"), "b929adc5" ), + array( R10("23209"), "57022879" ), + array( R10("M23209"), "dcfd2c49" ), + array( R10("2^23209-1"), "6edafff5" ), + array( R10("\x5a\xa9"), "f04fb1f1" ), + array( R10("\xa9\x5a"), "fb7de8b9" ), + array( R10("391581216093"), "c5f1d7e9" ), + array( R10("391581*2^216093-1"), "32c1f439" ), + array( R10("\x05\xf9\x9d\x03\x4c\x81"), "7fd3eb7d" ), + array( R10("FEDCBA9876543210"), "81597da5" ), + array( R10("\xfe\xdc\xba\x98\x76\x54\x32\x10"), "05eb7a25" ), + array( R10("EFCDAB8967452301"), "9c0fa1b5" ), + array( R10("\xef\xcd\xab\x89\x67\x45\x23\x01"), "53ccb1c5" ), + array( R10("0123456789ABCDEF"), "fabece15" ), + array( R10("\x01\x23\x45\x67\x89\xab\xcd\xef"), "4ad745a5" ), + array( R10("1032547698BADCFE"), "e5bdc495" ), + array( R10("\x10\x32\x54\x76\x98\xba\xdc\xfe"), "23b3c0a5" ), + array( R500("\x00"), "fa823dd5" ), + array( R500("\x07"), "0c6c58b9" ), + array( R500("~"), "e2dbccd5" ), + array( R500("\x7f"), "db7f50f9" ), ); $i = 0; $pass = true; foreach($tests as $test) { - $result = hash('fnv132', $test[0]); - if ($result != $test[1]) { - echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n"; + $result = hash('fnv132', $test[0]); + if ($result != $test[1]) { + echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n"; $pass = false; - } - $i++; + } + $i++; } if($pass) { diff --git a/ext/hash/tests/fnv164.phpt b/ext/hash/tests/fnv164.phpt index 8ff7304a7b..9795524a69 100644 --- a/ext/hash/tests/fnv164.phpt +++ b/ext/hash/tests/fnv164.phpt @@ -4,192 +4,192 @@ Hash: FNV164 algorithm <?php function R10($t) { - return str_repeat($t, 10); + return str_repeat($t, 10); } function R500($t) { - return str_repeat($t, 500); + return str_repeat($t, 500); } $tests = array( - array( "", "cbf29ce484222325" ), - array( "a", "af63bd4c8601b7be" ), - array( "b", "af63bd4c8601b7bd" ), - array( "c", "af63bd4c8601b7bc" ), - array( "d", "af63bd4c8601b7bb" ), - array( "e", "af63bd4c8601b7ba" ), - array( "f", "af63bd4c8601b7b9" ), - array( "fo", "08326207b4eb2f34" ), - array( "foo", "d8cbc7186ba13533" ), - array( "foob", "0378817ee2ed65cb" ), - array( "fooba", "d329d59b9963f790" ), - array( "foobar", "340d8765a4dda9c2" ), - array( "\0", "af63bd4c8601b7df" ), - array( "a\0", "08326707b4eb37da" ), - array( "b\0", "08326607b4eb3627" ), - array( "c\0", "08326507b4eb3474" ), - array( "d\0", "08326407b4eb32c1" ), - array( "e\0", "08326307b4eb310e" ), - array( "f\0", "08326207b4eb2f5b" ), - array( "fo\0", "d8cbc7186ba1355c" ), - array( "foo\0", "0378817ee2ed65a9" ), - array( "foob\0", "d329d59b9963f7f1" ), - array( "fooba\0", "340d8765a4dda9b0" ), - array( "foobar\0", "50a6d3b724a774a6" ), - array( "ch", "08326507b4eb341c" ), - array( "cho", "d8d5c8186ba98bfb" ), - array( "chon", "1ccefc7ef118dbef" ), - array( "chong", "0c92fab3ad3db77a" ), - array( "chongo", "9b77794f5fdec421" ), - array( "chongo ", "0ac742dfe7874433" ), - array( "chongo w", "d7dad5766ad8e2de" ), - array( "chongo wa", "a1bb96378e897f5b" ), - array( "chongo was", "5b3f9b6733a367d2" ), - array( "chongo was ", "b07ce25cbea969f6" ), - array( "chongo was h", "8d9e9997f9df0d6a" ), - array( "chongo was he", "838c673d9603cb7b" ), - array( "chongo was her", "8b5ee8a5e872c273" ), - array( "chongo was here", "4507c4e9fb00690c" ), - array( "chongo was here!", "4c9ca59581b27f45" ), - array( "chongo was here!\n", "e0aca20b624e4235" ), - array( "ch\0", "d8d5c8186ba98b94" ), - array( "cho\0", "1ccefc7ef118db81" ), - array( "chon\0", "0c92fab3ad3db71d" ), - array( "chong\0", "9b77794f5fdec44e" ), - array( "chongo\0", "0ac742dfe7874413" ), - array( "chongo \0", "d7dad5766ad8e2a9" ), - array( "chongo w\0", "a1bb96378e897f3a" ), - array( "chongo wa\0", "5b3f9b6733a367a1" ), - array( "chongo was\0", "b07ce25cbea969d6" ), - array( "chongo was \0", "8d9e9997f9df0d02" ), - array( "chongo was h\0", "838c673d9603cb1e" ), - array( "chongo was he\0", "8b5ee8a5e872c201" ), - array( "chongo was her\0", "4507c4e9fb006969" ), - array( "chongo was here\0", "4c9ca59581b27f64" ), - array( "chongo was here!\0", "e0aca20b624e423f" ), - array( "chongo was here!\n\0", "13998e580afa800f" ), - array( "cu", "08326507b4eb3401" ), - array( "cur", "d8d5ad186ba95dc1" ), - array( "curd", "1c72e17ef0ca4e97" ), - array( "curds", "2183c1b327c38ae6" ), - array( "curds ", "b66d096c914504f2" ), - array( "curds a", "404bf57ad8476757" ), - array( "curds an", "887976bd815498bb" ), - array( "curds and", "3afd7f02c2bf85a5" ), - array( "curds and ", "fc4476b0eb70177f" ), - array( "curds and w", "186d2da00f77ecba" ), - array( "curds and wh", "f97140fa48c74066" ), - array( "curds and whe", "a2b1cf49aa926d37" ), - array( "curds and whey", "0690712cd6cf940c" ), - array( "curds and whey\n", "f7045b3102b8906e" ), - array( "cu\0", "d8d5ad186ba95db3" ), - array( "cur\0", "1c72e17ef0ca4ef3" ), - array( "curd\0", "2183c1b327c38a95" ), - array( "curds\0", "b66d096c914504d2" ), - array( "curds \0", "404bf57ad8476736" ), - array( "curds a\0", "887976bd815498d5" ), - array( "curds an\0", "3afd7f02c2bf85c1" ), - array( "curds and\0", "fc4476b0eb70175f" ), - array( "curds and \0", "186d2da00f77eccd" ), - array( "curds and w\0", "f97140fa48c7400e" ), - array( "curds and wh\0", "a2b1cf49aa926d52" ), - array( "curds and whe\0", "0690712cd6cf9475" ), - array( "curds and whey\0", "f7045b3102b89064" ), - array( "curds and whey\n\0", "74f762479f9d6aea" ), - array( "line 1\nline 2\nline 3", "a64e5f36c9e2b0e3" ), - array( "chongo <Landon Curt Noll> /\\../\\", "8fd0680da3088a04" ), - array( "chongo <Landon Curt Noll> /\\../\\\0", "67aad32c078284cc" ), - array( "chongo (Landon Curt Noll) /\\../\\", "b37d55d81c57b331" ), - array( "chongo (Landon Curt Noll) /\\../\\\0", "55ac0f3829057c43" ), - array( "http://antwrp.gsfc.nasa.gov/apod/astropix.html", "cb27f4b8e1b6cc20" ), - array( "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash", "26caf88bcbef2d19" ), - array( "http://epod.usra.edu/", "8e6e063b97e61b8f" ), - array( "http://exoplanet.eu/", "b42750f7f3b7c37e" ), - array( "http://hvo.wr.usgs.gov/cam3/", "f3c6ba64cf7ca99b" ), - array( "http://hvo.wr.usgs.gov/cams/HMcam/", "ebfb69b427ea80fe" ), - array( "http://hvo.wr.usgs.gov/kilauea/update/deformation.html", "39b50c3ed970f46c" ), - array( "http://hvo.wr.usgs.gov/kilauea/update/images.html", "5b9b177aa3eb3e8a" ), - array( "http://hvo.wr.usgs.gov/kilauea/update/maps.html", "6510063ecf4ec903" ), - array( "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html", "2b3bbd2c00797c7a" ), - array( "http://neo.jpl.nasa.gov/risk/", "f1d6204ff5cb4aa7" ), - array( "http://norvig.com/21-days.html", "4836e27ccf099f38" ), - array( "http://primes.utm.edu/curios/home.php", "82efbb0dd073b44d" ), - array( "http://slashdot.org/", "4a80c282ffd7d4c6" ), - array( "http://tux.wr.usgs.gov/Maps/155.25-19.5.html", "305d1a9c9ee43bdf" ), - array( "http://volcano.wr.usgs.gov/kilaueastatus.php", "15c366948ffc6997" ), - array( "http://www.avo.alaska.edu/activity/Redoubt.php", "80153ae218916e7b" ), - array( "http://www.dilbert.com/fast/", "fa23e2bdf9e2a9e1" ), - array( "http://www.fourmilab.ch/gravitation/orbits/", "d47e8d8a2333c6de" ), - array( "http://www.fpoa.net/", "7e128095f688b056" ), - array( "http://www.ioccc.org/index.html", "2f5356890efcedab" ), - array( "http://www.isthe.com/cgi-bin/number.cgi", "95c2b383014f55c5" ), - array( "http://www.isthe.com/chongo/bio.html", "4727a5339ce6070f" ), - array( "http://www.isthe.com/chongo/index.html", "b0555ecd575108e9" ), - array( "http://www.isthe.com/chongo/src/calc/lucas-calc", "48d785770bb4af37" ), - array( "http://www.isthe.com/chongo/tech/astro/venus2004.html", "09d4701c12af02b1" ), - array( "http://www.isthe.com/chongo/tech/astro/vita.html", "79f031e78f3cf62e" ), - array( "http://www.isthe.com/chongo/tech/comp/c/expert.html", "52a1ee85db1b5a94" ), - array( "http://www.isthe.com/chongo/tech/comp/calc/index.html", "6bd95b2eb37fa6b8" ), - array( "http://www.isthe.com/chongo/tech/comp/fnv/index.html", "74971b7077aef85d" ), - array( "http://www.isthe.com/chongo/tech/math/number/howhigh.html", "b4e4fae2ffcc1aad" ), - array( "http://www.isthe.com/chongo/tech/math/number/number.html", "2bd48bd898b8f63a" ), - array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html", "e9966ac1556257f6" ), - array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest", "92a3d1cd078ba293" ), - array( "http://www.lavarnd.org/cgi-bin/corpspeak.cgi", "f81175a482e20ab8" ), - array( "http://www.lavarnd.org/cgi-bin/haiku.cgi", "5bbb3de722e73048" ), - array( "http://www.lavarnd.org/cgi-bin/rand-none.cgi", "6b4f363492b9f2be" ), - array( "http://www.lavarnd.org/cgi-bin/randdist.cgi", "c2d559df73d59875" ), - array( "http://www.lavarnd.org/index.html", "f75f62284bc7a8c2" ), - array( "http://www.lavarnd.org/what/nist-test.html", "da8dd8e116a9f1cc" ), - array( "http://www.macosxhints.com/", "bdc1e6ab76057885" ), - array( "http://www.mellis.com/", "fec6a4238a1224a0" ), - array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm", "c03f40f3223e290e" ), - array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm", "1ed21673466ffda9" ), - array( "http://www.paulnoll.com/", "df70f906bb0dd2af" ), - array( "http://www.pepysdiary.com/", "f3dcda369f2af666" ), - array( "http://www.sciencenews.org/index/home/activity/view", "9ebb11573cdcebde" ), - array( "http://www.skyandtelescope.com/", "81c72d9077fedca0" ), - array( "http://www.sput.nl/~rob/sirius.html", "0ec074a31be5fb15" ), - array( "http://www.systemexperts.com/", "2a8b3280b6c48f20" ), - array( "http://www.tq-international.com/phpBB3/index.php", "fd31777513309344" ), - array( "http://www.travelquesttours.com/index.htm", "194534a86ad006b6" ), - array( "http://www.wunderground.com/global/stations/89606.html", "3be6fdf46e0cfe12" ), - array( R10("21701"), "017cc137a07eb057" ), - array( R10("M21701"), "9428fc6e7d26b54d" ), - array( R10("2^21701-1"), "9aaa2e3603ef8ad7" ), - array( R10("\x54\xc5"), "82c6d3f3a0ccdf7d" ), - array( R10("\xc5\x54"), "c86eeea00cf09b65" ), - array( R10("23209"), "705f8189dbb58299" ), - array( R10("M23209"), "415a7f554391ca69" ), - array( R10("2^23209-1"), "cfe3d49fa2bdc555" ), - array( R10("\x5a\xa9"), "f0f9c56039b25191" ), - array( R10("\xa9\x5a"), "7075cb6abd1d32d9" ), - array( R10("391581216093"), "43c94e2c8b277509" ), - array( R10("391581*2^216093-1"), "3cbfd4e4ea670359" ), - array( R10("\x05\xf9\x9d\x03\x4c\x81"), "c05887810f4d019d" ), - array( R10("FEDCBA9876543210"), "14468ff93ac22dc5" ), - array( R10("\xfe\xdc\xba\x98\x76\x54\x32\x10"), "ebed699589d99c05" ), - array( R10("EFCDAB8967452301"), "6d99f6df321ca5d5" ), - array( R10("\xef\xcd\xab\x89\x67\x45\x23\x01"), "0cd410d08c36d625" ), - array( R10("0123456789ABCDEF"), "ef1b2a2c86831d35" ), - array( R10("\x01\x23\x45\x67\x89\xab\xcd\xef"), "3b349c4d69ee5f05" ), - array( R10("1032547698BADCFE"), "55248ce88f45f035" ), - array( R10("\x10\x32\x54\x76\x98\xba\xdc\xfe"), "aa69ca6a18a4c885" ), - array( R500("\x00"), "1fe3fce62bd816b5" ), - array( R500("\x07"), "0289a488a8df69d9" ), - array( R500("~"), "15e96e1613df98b5" ), - array( R500("\x7f"), "e6be57375ad89b99" ), + array( "", "cbf29ce484222325" ), + array( "a", "af63bd4c8601b7be" ), + array( "b", "af63bd4c8601b7bd" ), + array( "c", "af63bd4c8601b7bc" ), + array( "d", "af63bd4c8601b7bb" ), + array( "e", "af63bd4c8601b7ba" ), + array( "f", "af63bd4c8601b7b9" ), + array( "fo", "08326207b4eb2f34" ), + array( "foo", "d8cbc7186ba13533" ), + array( "foob", "0378817ee2ed65cb" ), + array( "fooba", "d329d59b9963f790" ), + array( "foobar", "340d8765a4dda9c2" ), + array( "\0", "af63bd4c8601b7df" ), + array( "a\0", "08326707b4eb37da" ), + array( "b\0", "08326607b4eb3627" ), + array( "c\0", "08326507b4eb3474" ), + array( "d\0", "08326407b4eb32c1" ), + array( "e\0", "08326307b4eb310e" ), + array( "f\0", "08326207b4eb2f5b" ), + array( "fo\0", "d8cbc7186ba1355c" ), + array( "foo\0", "0378817ee2ed65a9" ), + array( "foob\0", "d329d59b9963f7f1" ), + array( "fooba\0", "340d8765a4dda9b0" ), + array( "foobar\0", "50a6d3b724a774a6" ), + array( "ch", "08326507b4eb341c" ), + array( "cho", "d8d5c8186ba98bfb" ), + array( "chon", "1ccefc7ef118dbef" ), + array( "chong", "0c92fab3ad3db77a" ), + array( "chongo", "9b77794f5fdec421" ), + array( "chongo ", "0ac742dfe7874433" ), + array( "chongo w", "d7dad5766ad8e2de" ), + array( "chongo wa", "a1bb96378e897f5b" ), + array( "chongo was", "5b3f9b6733a367d2" ), + array( "chongo was ", "b07ce25cbea969f6" ), + array( "chongo was h", "8d9e9997f9df0d6a" ), + array( "chongo was he", "838c673d9603cb7b" ), + array( "chongo was her", "8b5ee8a5e872c273" ), + array( "chongo was here", "4507c4e9fb00690c" ), + array( "chongo was here!", "4c9ca59581b27f45" ), + array( "chongo was here!\n", "e0aca20b624e4235" ), + array( "ch\0", "d8d5c8186ba98b94" ), + array( "cho\0", "1ccefc7ef118db81" ), + array( "chon\0", "0c92fab3ad3db71d" ), + array( "chong\0", "9b77794f5fdec44e" ), + array( "chongo\0", "0ac742dfe7874413" ), + array( "chongo \0", "d7dad5766ad8e2a9" ), + array( "chongo w\0", "a1bb96378e897f3a" ), + array( "chongo wa\0", "5b3f9b6733a367a1" ), + array( "chongo was\0", "b07ce25cbea969d6" ), + array( "chongo was \0", "8d9e9997f9df0d02" ), + array( "chongo was h\0", "838c673d9603cb1e" ), + array( "chongo was he\0", "8b5ee8a5e872c201" ), + array( "chongo was her\0", "4507c4e9fb006969" ), + array( "chongo was here\0", "4c9ca59581b27f64" ), + array( "chongo was here!\0", "e0aca20b624e423f" ), + array( "chongo was here!\n\0", "13998e580afa800f" ), + array( "cu", "08326507b4eb3401" ), + array( "cur", "d8d5ad186ba95dc1" ), + array( "curd", "1c72e17ef0ca4e97" ), + array( "curds", "2183c1b327c38ae6" ), + array( "curds ", "b66d096c914504f2" ), + array( "curds a", "404bf57ad8476757" ), + array( "curds an", "887976bd815498bb" ), + array( "curds and", "3afd7f02c2bf85a5" ), + array( "curds and ", "fc4476b0eb70177f" ), + array( "curds and w", "186d2da00f77ecba" ), + array( "curds and wh", "f97140fa48c74066" ), + array( "curds and whe", "a2b1cf49aa926d37" ), + array( "curds and whey", "0690712cd6cf940c" ), + array( "curds and whey\n", "f7045b3102b8906e" ), + array( "cu\0", "d8d5ad186ba95db3" ), + array( "cur\0", "1c72e17ef0ca4ef3" ), + array( "curd\0", "2183c1b327c38a95" ), + array( "curds\0", "b66d096c914504d2" ), + array( "curds \0", "404bf57ad8476736" ), + array( "curds a\0", "887976bd815498d5" ), + array( "curds an\0", "3afd7f02c2bf85c1" ), + array( "curds and\0", "fc4476b0eb70175f" ), + array( "curds and \0", "186d2da00f77eccd" ), + array( "curds and w\0", "f97140fa48c7400e" ), + array( "curds and wh\0", "a2b1cf49aa926d52" ), + array( "curds and whe\0", "0690712cd6cf9475" ), + array( "curds and whey\0", "f7045b3102b89064" ), + array( "curds and whey\n\0", "74f762479f9d6aea" ), + array( "line 1\nline 2\nline 3", "a64e5f36c9e2b0e3" ), + array( "chongo <Landon Curt Noll> /\\../\\", "8fd0680da3088a04" ), + array( "chongo <Landon Curt Noll> /\\../\\\0", "67aad32c078284cc" ), + array( "chongo (Landon Curt Noll) /\\../\\", "b37d55d81c57b331" ), + array( "chongo (Landon Curt Noll) /\\../\\\0", "55ac0f3829057c43" ), + array( "http://antwrp.gsfc.nasa.gov/apod/astropix.html", "cb27f4b8e1b6cc20" ), + array( "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash", "26caf88bcbef2d19" ), + array( "http://epod.usra.edu/", "8e6e063b97e61b8f" ), + array( "http://exoplanet.eu/", "b42750f7f3b7c37e" ), + array( "http://hvo.wr.usgs.gov/cam3/", "f3c6ba64cf7ca99b" ), + array( "http://hvo.wr.usgs.gov/cams/HMcam/", "ebfb69b427ea80fe" ), + array( "http://hvo.wr.usgs.gov/kilauea/update/deformation.html", "39b50c3ed970f46c" ), + array( "http://hvo.wr.usgs.gov/kilauea/update/images.html", "5b9b177aa3eb3e8a" ), + array( "http://hvo.wr.usgs.gov/kilauea/update/maps.html", "6510063ecf4ec903" ), + array( "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html", "2b3bbd2c00797c7a" ), + array( "http://neo.jpl.nasa.gov/risk/", "f1d6204ff5cb4aa7" ), + array( "http://norvig.com/21-days.html", "4836e27ccf099f38" ), + array( "http://primes.utm.edu/curios/home.php", "82efbb0dd073b44d" ), + array( "http://slashdot.org/", "4a80c282ffd7d4c6" ), + array( "http://tux.wr.usgs.gov/Maps/155.25-19.5.html", "305d1a9c9ee43bdf" ), + array( "http://volcano.wr.usgs.gov/kilaueastatus.php", "15c366948ffc6997" ), + array( "http://www.avo.alaska.edu/activity/Redoubt.php", "80153ae218916e7b" ), + array( "http://www.dilbert.com/fast/", "fa23e2bdf9e2a9e1" ), + array( "http://www.fourmilab.ch/gravitation/orbits/", "d47e8d8a2333c6de" ), + array( "http://www.fpoa.net/", "7e128095f688b056" ), + array( "http://www.ioccc.org/index.html", "2f5356890efcedab" ), + array( "http://www.isthe.com/cgi-bin/number.cgi", "95c2b383014f55c5" ), + array( "http://www.isthe.com/chongo/bio.html", "4727a5339ce6070f" ), + array( "http://www.isthe.com/chongo/index.html", "b0555ecd575108e9" ), + array( "http://www.isthe.com/chongo/src/calc/lucas-calc", "48d785770bb4af37" ), + array( "http://www.isthe.com/chongo/tech/astro/venus2004.html", "09d4701c12af02b1" ), + array( "http://www.isthe.com/chongo/tech/astro/vita.html", "79f031e78f3cf62e" ), + array( "http://www.isthe.com/chongo/tech/comp/c/expert.html", "52a1ee85db1b5a94" ), + array( "http://www.isthe.com/chongo/tech/comp/calc/index.html", "6bd95b2eb37fa6b8" ), + array( "http://www.isthe.com/chongo/tech/comp/fnv/index.html", "74971b7077aef85d" ), + array( "http://www.isthe.com/chongo/tech/math/number/howhigh.html", "b4e4fae2ffcc1aad" ), + array( "http://www.isthe.com/chongo/tech/math/number/number.html", "2bd48bd898b8f63a" ), + array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html", "e9966ac1556257f6" ), + array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest", "92a3d1cd078ba293" ), + array( "http://www.lavarnd.org/cgi-bin/corpspeak.cgi", "f81175a482e20ab8" ), + array( "http://www.lavarnd.org/cgi-bin/haiku.cgi", "5bbb3de722e73048" ), + array( "http://www.lavarnd.org/cgi-bin/rand-none.cgi", "6b4f363492b9f2be" ), + array( "http://www.lavarnd.org/cgi-bin/randdist.cgi", "c2d559df73d59875" ), + array( "http://www.lavarnd.org/index.html", "f75f62284bc7a8c2" ), + array( "http://www.lavarnd.org/what/nist-test.html", "da8dd8e116a9f1cc" ), + array( "http://www.macosxhints.com/", "bdc1e6ab76057885" ), + array( "http://www.mellis.com/", "fec6a4238a1224a0" ), + array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm", "c03f40f3223e290e" ), + array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm", "1ed21673466ffda9" ), + array( "http://www.paulnoll.com/", "df70f906bb0dd2af" ), + array( "http://www.pepysdiary.com/", "f3dcda369f2af666" ), + array( "http://www.sciencenews.org/index/home/activity/view", "9ebb11573cdcebde" ), + array( "http://www.skyandtelescope.com/", "81c72d9077fedca0" ), + array( "http://www.sput.nl/~rob/sirius.html", "0ec074a31be5fb15" ), + array( "http://www.systemexperts.com/", "2a8b3280b6c48f20" ), + array( "http://www.tq-international.com/phpBB3/index.php", "fd31777513309344" ), + array( "http://www.travelquesttours.com/index.htm", "194534a86ad006b6" ), + array( "http://www.wunderground.com/global/stations/89606.html", "3be6fdf46e0cfe12" ), + array( R10("21701"), "017cc137a07eb057" ), + array( R10("M21701"), "9428fc6e7d26b54d" ), + array( R10("2^21701-1"), "9aaa2e3603ef8ad7" ), + array( R10("\x54\xc5"), "82c6d3f3a0ccdf7d" ), + array( R10("\xc5\x54"), "c86eeea00cf09b65" ), + array( R10("23209"), "705f8189dbb58299" ), + array( R10("M23209"), "415a7f554391ca69" ), + array( R10("2^23209-1"), "cfe3d49fa2bdc555" ), + array( R10("\x5a\xa9"), "f0f9c56039b25191" ), + array( R10("\xa9\x5a"), "7075cb6abd1d32d9" ), + array( R10("391581216093"), "43c94e2c8b277509" ), + array( R10("391581*2^216093-1"), "3cbfd4e4ea670359" ), + array( R10("\x05\xf9\x9d\x03\x4c\x81"), "c05887810f4d019d" ), + array( R10("FEDCBA9876543210"), "14468ff93ac22dc5" ), + array( R10("\xfe\xdc\xba\x98\x76\x54\x32\x10"), "ebed699589d99c05" ), + array( R10("EFCDAB8967452301"), "6d99f6df321ca5d5" ), + array( R10("\xef\xcd\xab\x89\x67\x45\x23\x01"), "0cd410d08c36d625" ), + array( R10("0123456789ABCDEF"), "ef1b2a2c86831d35" ), + array( R10("\x01\x23\x45\x67\x89\xab\xcd\xef"), "3b349c4d69ee5f05" ), + array( R10("1032547698BADCFE"), "55248ce88f45f035" ), + array( R10("\x10\x32\x54\x76\x98\xba\xdc\xfe"), "aa69ca6a18a4c885" ), + array( R500("\x00"), "1fe3fce62bd816b5" ), + array( R500("\x07"), "0289a488a8df69d9" ), + array( R500("~"), "15e96e1613df98b5" ), + array( R500("\x7f"), "e6be57375ad89b99" ), ); $i = 0; $pass = true; foreach($tests as $test) { - $result = hash('fnv164', $test[0]); - if ($result != $test[1]) { - echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n"; + $result = hash('fnv164', $test[0]); + if ($result != $test[1]) { + echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n"; $pass = false; - } - $i++; + } + $i++; } if($pass) { diff --git a/ext/hash/tests/fnv1a32.phpt b/ext/hash/tests/fnv1a32.phpt index d2e01f7998..af12a2de37 100644 --- a/ext/hash/tests/fnv1a32.phpt +++ b/ext/hash/tests/fnv1a32.phpt @@ -4,321 +4,321 @@ Hash: FNV1a32 algorithm <?php $tests = array( - array( 'l', 'e90c310b' ), - array( 'b', 'e70c2de5' ), - array( 'a', 'e40c292c' ), - array( 'd', 'e10c2473' ), - array( 'Z', 'df0c214d' ), - array( '0K', '66eddeec' ), - array( 'cp', '47297986' ), - array( 'UY', '6bf399cb' ), - array( 'RS', '6e04e612' ), - array( '+`', '47dc64fe' ), - array( 'Q: ', '1c02a1d6' ), - array( ' Mu', 'c5c8a3f9' ), - array( 'jS0', '1819afae' ), - array( 'cRZ', 'd9f699ae' ), - array( ' "]', 'ee32d84e' ), - array( 'Bo@$', '1544a53a' ), - array( 'U{5"', '08f0b60a' ), - array( '`&W;', '300ba78d' ), - array( 'Y+F;', '12d960fe' ), - array( '\\a<]', '7596c231' ), - array( '/2HcC', '4ee26872' ), - array( '-7}-:', '5e0b1ab7' ), - array( '[O*|T', 'c259a137' ), - array( '_yib[', '6cc9d49b' ), - array( 'p:vKE', 'becd7e8f' ), - array( '>g# $a', 'ae428052' ), - array( '07*tZ8', 'ed8d23f4' ), - array( ',YEF5u', 'faf2b057' ), - array( 'Q3K2.6', '44f076e4' ), - array( 'ti(0aT', '29d6e513' ), - array( 'U <Y!A;', 'ebcefc16' ), - array( '2XF\'4^3', '11bad723' ), - array( 'm%Z${-8', '2ef77eeb' ), - array( 'G@F^60g', 'a0044fc5' ), - array( 'Fq<|rYV', '00fb2e21' ), - array( 't{r\'U9.i', '0d526094' ), - array( 'xBX}}]y,', '58e08903' ), - array( 'uBL<"bMi', '6b4adbd4' ), - array( '*@\'\'3a^)', 'e9588a44' ), - array( ']Q03k?|d', '5a837058' ), - array( 'aVb`4]l* ', '8e9bed4b' ), - array( '9G#|tl\'6s', '7301283c' ), - array( '/JUmS4@cG', 'd708df29' ), - array( '-$Eqf{UG1', '406526e0' ), - array( '44<5Nd8LZ', '56f2092a' ), - array( '&Tpyc;PRnd', 'e1b9c4be' ), - array( 'sS-!WRs>OJ', '9fee418c' ), - array( 'fa^z}tJc-v', '42d4d075' ), - array( '>3K/./J_b9', 'd9e15b05' ), - array( 'EVmRXE&LdV', '1ccbc7ba' ), - array( 'wK9WG7LqzYi', 'fc482f42' ), - array( '9m5I|Es\\(."', '43fc2be7' ), - array( '^{U8B\\d(4\\T', 'af371347' ), - array( 'M4{eana<X{*', '0073ed9f' ), - array( 'mE\'39d<Gg{D', '7755ffb9' ), - array( '=4fzyn/WC\\l@', '3085c332' ), - array( 'BN0$jh uWE}k', 'c95b95dc' ), - array( '_b((J$Lh94c3', 'c7f99999' ), - array( '$rjGPWhr&xwq', '0b9873cd' ), - array( 'bxg;?e(~H0\'s', 'cee0652d' ), - array( '5T\\OhAbl4M5e&', '21278985' ), - array( '~Y-xQ~[JfwiL ', '97dae25b' ), - array( 'iu1qiGFGv/hZ|', '045498c1' ), - array( '})2c/1=<*o;f;', 'ce6b0a18' ), - array( '"_&O_oEqa09(W', '31218352' ), - array( '18@k5>tG"$Y@@d', 'e67f32fc' ), - array( '1\\LL_,R/kCU]%e', '563251e6' ), - array( 'w.=)F]t\\|i% n^', '10a0ae81' ), - array( 'A0DRlp~L|Q\\it2', '2f5d78ca' ), - array( 'Gzw@)6IPt?-q*3', '228eab51' ), - array( 'rxq4*6fw(eE%8"n', '843e8340' ), - array( '.57).W3D"d9Ar,K', '9cc1aba3' ), - array( '&~Ex3O0yH8_m=xo', 'c1a72c91' ), - array( '-\'&D14{EX}*r@}~', 'f0b627fc' ), - array( 'k$}2}1b.,+Flyde', '2255bec4' ), - array( 'iqmp6~%3D]2OPRNO', '95cb7153' ), - array( '?RNRQ`5_lA\'Y;k@&', '98f1390e' ), - array( '^.vu.{)SZ<#+nQ[/', '2f89dc6c' ), - array( '%+aVkw7Y9>3U+T\\j', '15c1ec76' ), - array( 'bS`pPjD+\'H7vzs\'!', 'b732fff0' ), - array( '~hWkaoE{.YQ:..%qb', 'a53c7189' ), - array( 'eb3Q(?XQWPLKWMKA&', '3bf2f0e8' ), - array( '7#u]~%7Q?E_D7C+zW', 'f5038551' ), - array( '\\$w5UOf#{>PH_W`cN', 'c3b89ba6' ), - array( '>bSU4rzt839C.p 2h', '00cf8218' ), - array( '5h9|k6;=^{t?`C]Cv4', '855c27e9' ), - array( 'Xj0N#CgFRYFeC\\N]Z;', 'caae0fcf' ), - array( 'suXRrNrTrPwjeQUu!Y', 'e2ac5b6c' ), - array( ':i lDGSg%#E_>:VwlJ', '0648058a' ), - array( 'F_~91w$vIZmK4(55tY', '11c2fffb' ), - array( '\\HBbLhBj#ybpD*PCCb;', 'b32cc782' ), - array( 'HZe#H27PGLF"*oEl<.0', '86a137c7' ), - array( '\'1*j"NtSr87/aqtd;\'|', 'f40113e8' ), - array( 'kOI3RT#wB?&RF8]2;,\'', '0096ffab' ), - array( 'n @\'/"y$g5,d"\\/5/c9', '8b7ec669' ), - array( '\'&X.Y F72aD:QDZYS]SX', '26b51c68' ), - array( 'Eid*lB9#Q}<Y%tg_u/v(', '9ff0e9b3' ), - array( 'p<BC`}|5[Qm!;S,(uE,H', '50d88cac' ), - array( 'DH"J>i*4y"<j>_/ ],59', '9354bdac' ), - array( '^#:yWG#Mm/u2Xx\\vcg+]', '4debf08a' ), - array( 'iHI)(X)ee> DB;?zbCIPS', '312f5ce8' ), - array( '@c,9A$|)/[sX%|`]&GDEG', '8793f867' ), - array( 'ihc)cFL-w!M[-g|1d\'A@z', '57a03ef9' ), - array( 'yFw[%~#IDK3.0=qVj OkN', 'a435237b' ), - array( '+x6)+{0M=+Hc$$h#(3HTF', 'f7f3fb17' ), - array( 'VdcI<OIk;xv5/!A+1nI<7-', 'c0276bde' ), - array( '@<vDD*lxQC^6mze8g!1_6@', '2a8386fd' ), - array( '`WLqGu/^$Oz{s@&a:W&xms', 'c5454bef' ), - array( 'tS,\\U==l^}E+pl" L\'PG#E', '7163befc' ), - array( 'h)\'#a-|P"q%.OZLmG+kl7\\', '262417f4' ), - array( 'Z9]\'@.ODT8N[<0i9ak,fz\\B', '30233bfa' ), - array( 'GJjR6Xis3$R:Eaii6#9q?I\\', 'b1d4e934' ), - array( 'Y+IerDB5kl ?$X*xk/L\'T.q', '20d3742c' ), - array( '?DtX75#sn/=U"ax7Nf8nkpx', '61619334' ), - array( 'd])1d]?W}dLW{b[oRj.)lo"', '366d01d0' ), - array( '%?h=.T/(:m1LRol*nQWGM;#>', '6ec48f20' ), - array( 'mmLv[=ya\\b k8/tS|\' Pwl[f', '9fb5d98f' ), - array( '?4/lO2,>!X5]u/?Sr@@,O5_M', 'b476c549' ), - array( '=_~5M[|lo,Z?>f]@?s}6$>iw', '621bbc86' ), - array( '^+$/@c]^C\\sp9p^)|9I<!(\\A', '3ea36c5d' ), - array( '{[W!yBxXM|hm`FL$$Au=2UF0o', '0f54780f' ), - array( 'pMpx*2tfjv`-o:Zl#IMIuRN8I', 'c19ab462' ), - array( 'kK 3[o$)a|4trz_i\\lZvGGzpu', '1cd34af1' ), - array( 'DgHr r_Krr(cw2EuF:iByS~f.', '0d60d437' ), - array( 'v/Vq L7gu+hhj5\\^=@WPfMw"7', '9d0ca535' ), - array( ':{k:cz2sQ$s~<\\tGF^3[<ry]JJ', '92579a4a' ), - array( 'DwCF0^C|y(w,{J1pJMM?ut~)Q<', 'ed50fb22' ), - array( '|KyGv>@;eQy)Ns1F -q1}<_L\\U', 'c5960f99' ), - array( 'B\\_sx\\@r%71FRvwM!FA3lA@_S?', '51be9eb7' ), - array( '{4lXj05K$.)D".\\3T0+L]-r @`', 'e8525ded' ), - array( 'Aa@u"=+nvu -A$;JI>X&R.7^[uk', '0510b06f' ), - array( 'Nu,08nQ.pn9`e0`rQd/{.MU5 cL', '43c2c9c8' ), - array( '^?BKn8X~QGP_8@yx&*Zy[@)XOV.', '39874c53' ), - array( 'dWr273Ub"n;"@bS!{szuz&Ptbp~', 'c81fe453' ), - array( '<@VJ&.>8ERn)U]DW~(, $!{y|"K', 'dc0d68d2' ), - array( 'qe<p"]GMcVk||>k&sJKLITYIYZET', '90be4d50' ), - array( 'WH J.=;0zc]_;J\\8hI?]sk+=@dfy', '5e1e1340' ), - array( '?-OwUOBcm^tiCRI^}\'wfP7ED#PaC', 'f03345c0' ), - array( '5I>UWmM->pq,Pgus:?S9FK!wbF<e', '94060b65' ), - array( 'w~*-IHc!72/U$!bThYH$x|=@H>9+', '547a6b68' ), - array( 'eUq]U{k~EP!]b04f2v;{Qd!Ka?l+^', 'e777322d' ), - array( '&6D[)#2&n1L?2*#C?iU7&RhkS4Nr!', '4a78ebdf' ), - array( 'YR\'ovcyyu i\'L*:W-^vw5.}gvj<+9', 'f83d06fa' ), - array( '0-rb4cZw]Um^?u+J1bWpZO&hNn`:,', '7f314445' ), - array( 'lS<yG /+Z(i0vHPmTz~8Rpr#w\\Rf>', '831a8450' ), - array( 'lr+A0&h05sk=^{4\'M#\\H"t{sh kESS', '0c39d6ad' ), - array( 'cAFobWuKh,@TJ Q_(~bdHeYEYCEEhx', '12b2879c' ), - array( 'xM;@=}x4JaAk7kkhLsh/Y2t4WOW}uA', '81c3b55c' ), - array( 'von21-1*B[lcH$P4m|)V-bi#wARO?I', '0d5d6b27' ), - array( 'p79`JKn[V18Cu`GGu5D lQbVTZx(+8', '0fd3c926' ), - array( 'Q{Pk]z7LWn^o2UQZ|HpAH]s,5If/QrG', '0f36a996' ), - array( '$oxoMs(zLvY=*/nd,8UN`4ClJlTY>G"', '80b38386' ), - array( 'C7z4do<_<4:Y?JI$WaZ\'BoJ0;7dtV,w', '9874d3b3' ), - array( 'yDr.*cKj `%Z P$%(f`/*PY:kq~aH,Y', 'ab5089b4' ), - array( 'BQMQ[1|F1]Lk]|pc&WD5buo|ab|D+*}', '5d600f5e' ), - array( 'N[K 7\\|^n[+[9(L}.%BDg85ezwc?$m>R', '1966e89b' ), - array( 'JjRaGPA7,LrFU?EcEg).!?t{7X<;F[mp', '908106a1' ), - array( 'FASnrt& BxGw9l\\_TemV%bR=<oXbKGTr', '824f8688' ), - array( 'i)a\\~g]Aa%9{qu[G\\J}b.Q JBY.m"c`k', '195cad65' ), - array( 'lCIk,\'.m-Gj >GH{qF^!x_L;9Z*;?k(,', '36f68af8' ), - array( '/Qx;Y\'*gOtgn<0j/WI1Q)]lC9w_Xcges:', '885fad78' ), - array( '^0tf:\\60E%MVp].:n_DMMgfEH?*0%}Kd.', '7f86cff2' ), - array( '@LI}cZCi)yZg)tVi:%8#k^K,h\\2g(vvIC', '3dd2e16e' ), - array( '@G\'{jp&eLmoBEY\\Jq_6Q,B:hT#pLy:p;a', '03b92168' ), - array( 'x8Mj>47,$YQ^6{Qv2##U>l+A]W<xIW[Bo', '7b4dcec0' ), - array( '*-.>D:C~l"6hS-{W1Qu}]8\\6TU_,2#|<0+', 'b86f1510' ), - array( '[UF~U3"k|Vyx.+K$*)<f@p= }O#zl4\'HjM', '93a09a8c' ), - array( 'H@aJ,^!&W02$4<-Q#MCANApR=]fD\'RqPrT', '2d094101' ), - array( '{~3|&k.8oCU}tXL9y{[kNxJ6=Rh0#[e~[x', '72d5e000' ), - array( '|ae+zUNPTD*!]%|:pL3<bQnKbr(HqcBnF(', 'f4f08743' ), - array( 'zA]Jr3n|4M"2gs^{0AM m0ruYeZ{U!$PCbz', 'ef1f608e' ), - array( '6uj4+87=!,{|=>J=,[1#6v]2L^7}#yx:pdN', '800e955f' ), - array( '{}f:~r7{0UGNa$_e:WCM$#d"&_{AQ`pN^Wh', 'fa87c111' ), - array( '^K [\\U$+8)k~CCBqGEWJL7Fnh(_7g7!Fc!"', 'f0d49ddf' ), - array( '@W\'Kp08oT[3F$Y}N\'6uu ~U8fm9-Q;0qs8>', 'bbc8b16a' ), - array( 'eHVU|2iD7CCfJY]@Y\\vqCd,Q6Gb);zG!D}WB', 'b4c1dc4c' ), - array( '1BfIe+01dmR?JI2n.>@Ef#N#~u%Dt\\f\' NPe', '7c98ca04' ), - array( 'Y`w?NJ_ysqh#1)Hw-w{-m!Qc^9j^g;EB{=bK', '79ccb205' ), - array( 'gBF\\5/_F9)?G!;Un=\'S{A>[)Y!LV>/#\'QIcg', 'ba719e14' ), - array( 'YC.rLN;Mjp=(xp%:0`DjbpB! E(Rol:I0I=]', 'ce2a6b64' ), - array( 'xY,cJIlC;r]KT"77sY9t~BGo/b:@-X}&2*j\\T', '87e2ae2a' ), - array( 'X!pK_=!bT8V.RL.ts}$W8DdqCk$NVa$0ct\\C2', '380f7299' ), - array( ']\'gv^uI+%> #CW<h=.,)3[`t_pXTM|g,$O#cF', 'eeb01e49' ), - array( 'LnKkoO/Hkwez%o.`Q$@C\\upZ]}_.!CTM3!:#P', '9f74a4c3' ), - array( 'IK=B29G"G(SKIv)?hc}gC,hga7zbQ~4zKR>]k', '4b7036db' ), - array( 'e`4n5`9-iXvNV^rcGZE_V)1U>-!pL_]2@q"UR;', '2ef7953e' ), - array( 'b=sYlK9_/`;TAr^SH|aJm.+K@K>C"p^d/S?{~X', '58f87a0f' ), - array( '\\/:wc\\jC04@q_. jZA7xd9jD}zw>vwwS\'3Lko8', '924bf023' ), - array( '/ MOr.^rx9503yI~>Hy7gp/_E6rr#c,2cYbWhA', 'd2c773bf' ), - array( 'Ja[`ro[=nzeh2MZB.!Y"t\\e!oJ[R"DtM\'P.yAi', '59761485' ), - array( '70d}ywLU:ZVs]LQCMAn*sqOh@V:NQ[9il~hgw5=', '1616e5d5' ), - array( '2pt\'NAXroybznTJXt"rDTO^>=^(%V=Bi/8q^ZJR', '2b93c8c6' ), - array( 'JE5E5jpm_r`%G1cfNBnSy-vd=0V{j!N5Gc[\\NMJ', '22863e0e' ), - array( '/@,4h=xPl<@@7N8{kHRg3T7I{z&YJS%Zt2o^Oi/', 'ce54d2ce' ), - array( '<&O]=~v9j?lRSAi}>e%w1X}lN0\\-`G=}Mm[klS&', '925e90a6' ), - array( 'Wsr+G4tFS[KLm%JZTZ8a<_ :.mvyZJ!3>s>f)3-]', 'b47ebcb9' ), - array( 'oY*]^T830PuL1uf?d^9?);RG0q.9&<vuu"STVlhg', '76d4ed18' ), - array( '>_5OV|n;[)ZdE.-U <n\'Xf|NhQ$@?m)]M>.$;}?w', '2fb33679' ), - array( '(z]M*j#+\'r2_Z0/Da3e!"n_O.mTJltBto CzkF&r', '569492ba' ), - array( ':9SuIb:+v!-xplI~[}JHrm>cna^Z)eND~":IeUT]', 'b9cb09fa' ), - array( 'WbVHP!H- rVratWPW7+a}Y&|\\AFBw{!O_Ww0YA>Y5', '26b7c332' ), - array( 'tMvi&HB=S$;.+9jL`.D]/t=gmNB/l{EbI<MOdom9t', '7de5c876' ), - array( '*G C3L$BqbRf ;UO]d=Z+ %GMU-=CF2Mn3q#`vFRY', '627567d3' ), - array( 'y:Z6o*sUHO`HT)u*74N]G|MZnQ;exn@r*z*z&}QNN', 'b1579567' ), - array( '3v#<m.S#]2KZ`\'J3C1,2Q =M*8S)i"W|y[:hinlH"', '948a6c9e' ), - array( '9#b@Nvc`$v3$4`/L4977q42MO{8>i`@#d$C4z\'t~~(', 'fa5a6693' ), - array( '$3h4_}Mw6?-Im\\E&z/g<2M@Va<^W<]_@pITQH#J^BW', '5db013f4' ), - array( '(14N80^ LqNmH0+\'hGeIhWr>*<AT{d,$u@S.Q2/~$]', '57cd1795' ), - array( 'mMnxUWA;!*stH}2iR.O_3E!fTRycQ}B?K18"iZ=kd1', '08722fa3' ), - array( '`.0sxb"HC6nD}Cvw\'HvJgC[!EE[c1AtrO&fIiiq- `', 'c89edaa7' ), - array( 'Q~%Hv-qmWZ23\\WY9;kZ1^+8FT"1G/2)`1.*)<{vsW*(', '702aaaa4' ), - array( '4aaM}M(0-4HTiJe1Zw;<*JF3fC+Zz5c/wE]vsf("zQV', '197ef095' ), - array( 'd|=vW63s@];SD^_ Ztcjm*He~/m!+?Xp<vgs-{hMY$"', '1ed13f33' ), - array( '}cb~>Xb)FmR,laznl:H^V?FKLC4z|9}{|`z<:^F`Lxm', 'c04f1349' ), - array( ':[h*I#R(ZrO\'?r<;oU:lS{ho6G6vt0e/kN:6Rl>._m5', '48c23cac' ), - array( ' aQ<R(V?[R(LhPb`EsGU`vovJ]5X>$n?eA[9I3X&faRP', 'a53ac530' ), - array( '262W+Y.kP}b{[wTz|D:bev{0*U7p7iBJ!T#,.1w_/Z[k', '05d91499' ), - array( 'S1gPU"4<x1M$gdu N8JPlM]{^U[n18[eIC7 FL<@^iDF', '12db23fd' ), - array( 'N:G}SqO@@-< cxnt1K[[or[6@wV~b{F17m0j__,!mI!Q', '2b2e3dde' ), - array( 'BpGT<#0-vkC7dz6Gv\\Y.Kjx+K&-9O.jq 2G<6WJ-DmE*', 'f4c74b67' ), - array( 'h\\R_:-newhqCn~]>-I1.[XKr1u!UcF`M#3-=@|#9et]Tt', 'bd458351' ), - array( ';r#d$1A]\\4nR6E6\\&d_:q}Zn"tUwR*lm}oS#!u`^+P1Au', 'f8e9f1d5' ), - array( 'H}|-^7 ]ro_gEW;PD*N5]Q7S3u^c\' YP~W^^n^<bO{KuS', '8e947b43' ), - array( 'fFxpu.OGE$[;c?CdytcQSCA2_$b[PX08~)*t8Y=]^yyB9', 'a34f6609' ), - array( '>(33lef0\'yo,\\L]6\\u6e ,}ZI\\9CW\\]udq)QWpb_jRlH~', 'e9d8fa86' ), - array( 'J^[@tB@!A{K~5oVqNLW@V*xGlY3@F[@q;|21?S3aO_`eP8', '104537ea' ), - array( 'X~e0@<;:d)swI;Ti-pg@"(s6iDuK*GcbFIsgf/"K9vCb2x', '7c5f8020' ), - array( 'M?i5_l=T#(xyT$A9fhb[QJkSu%K:h]46}}L^kj3os-iH1,', 'ab2ee1ee' ), - array( 'axuETGoA{fFG"0&6G$4sb!_upS#[{5h^.^$c\'t%#[LK]\\Q', '8520630b' ), - array( 't$U)x8*X/{,3W)H@hW m;\'bA+?mV}K(rP^|Iw("\'$/;\\9d', '5ec32f02' ), - array( '|"<|oX%Sz0rifq5oeeNb0Fk2NpBiM[OK^lINFN#A^u+FhA7', 'b5b5f4e5' ), - array( 'N(e18-}K[nmF<Jvg)c1X*`[L@RWg;y~i"e{:rzeOiTv&~mn', '14562c12' ), - array( ')R!b\\a?)"qai.[ix]OuxCp^rZ4ja3XP=+R h4?r72T"@1k9', '01b11a54' ), - array( 'n</g_!GS[[>=own-#B.lVM_n`5p!F];5zJ}ZLF.("MFrE6!', '8f9e0173' ), - array( 'IX/60]v~>,p@RO[hJ\'f%S.4[1a#$\'9%Qr5g#r_#1ktQ>D.(', 'f4e44d2d' ), - array( 'n5oth}*E/kH4sb:FVO.ZBn]TZR\'yv5"fJq\\4ofZ S#4HfNn>', '51b1ae3d' ), - array( '}}xAlVvH*}B"4Eh_7Fs(.N(aR=+:lyXkxQ.f)%/3#R57w~v/', '0d3e9950' ), - array( 'Ek7S;@6m^A)L<a864G|=L,QP^fgVf_f,L~`g?vV~9_KVBdlW', '8c43dabf' ), - array( '-itYuG*U/r-uSs# rch3[?2t ^KBD8yQ#o,y86OG*\\=]QA^D', '4d86d9cd' ), - array( '%GXafjWgJ$*o=%B@uN:.ejUoGsMy5,>;Tv|<bT$.X.~u4A7*', '38b099cc' ), - array( 'pQ9V<oFdct^y"}5Vu3rYhvgB&g8;)PFy"_Q?Ow%3md.pbDHYW', '859042fe' ), - array( ';3A3{c:c|UmM{gP\\:o,3t@!ZNq=s:vKV+lj\'P&kM[Y{XBL6\\<', '88b478a3' ), - array( 'Bo2cql2d+& #RW/@B6qH#@%\\<^ ht]&8N9{@\'/%36%6h\\F* \\', '4b1d0513' ), - array( '{I`<N>Y.>C$|J<Kc8kkHq~^w6GT\\RU:N~{kN:E\\YiaV4}"x7n', 'f1ce1247' ), - array( 'e_`d>Y{f/Y9dsgdpT3+zpddR<yP?rh.XHo>fI;NXtg>iP#Z%6', '3e4eb24d' ), - array( 'e \'KeZg_,\'St6-=\'K%QfS+\\;IFkL!qcgrk3XF{9R$lG;yeBFjs', '69476a97' ), - array( '.? j[I2Hv4:Z{-F0fm, A0mhLhOn0:c>Zc*6.=^%Qy`M(\']nuj', '9097fe8e' ), - array( 'n7{]!HFP7Vk{uF`!]n>=to7U>?]{.Sg}kc\\l,#>DZ*@QQ"R/qq', 'cbee4ea9' ), - array( 'Mfbd<!$z}3Oe2;In(UrFyMQ; $=R40Eav(F4)K/(^^mpz8`#mS', 'f19251c8' ), - array( 'Jh!|%"!CT6SzwK#?_-jo5JO#<J<|N*PysRwyTy=*0q%(=)G}63', '8f27bdfb' ), - array( 'nK]?Oyikv9vH4k{,eQ&$[6va>5jf3"y#NWB~R-kJGcr[Oog6Am;', '9cb72621' ), - array( '}%3`DHK+\\N&_|^#|10h[WLO4|?{4ajP_pc@5-lAi<GJ:\'M78^!t', 'e0686fbc' ), - array( '7NEKLdHaG32($vI:$7[nS$9n+f&DF(9]V^*#DRdlfwtko>&tUbc', 'e4bd2dd7' ), - array( '*f|xrd 8,(Qi^1sbVGHC.@9y1W &.cj9Kh2>M2VZ:)Dy;9\\r`%6', '5efb3af6' ), - array( 'oFOiW(j^7NIPy2b9`uo;1y`+6zh)\\n@L5p6mx!L0OvaJ)Dci;T&', '05e74ead' ), - array( 'LNfXdaAn>0/jF "5y#b+SYl}b2bMM7Sze:SK|u:<&J(MJ*bD.EOb', '17cbb538' ), - array( ' <abND0|\\dwC Kn|A*:HTCv NZD] t@!1#c`Ht]%YVHY"8WDBrlw', '4eca862a' ), - array( '6dwd?=B@2cADf%&0zd5U;]/=ugb9[P2q5*WTHzt[_6!G<\'W8klm\'', '296c9ed7' ), - array( 'J}EAe)ZBYl4nwlDAh9|HP}om&H&q5sy`q@#XI]z$K0rD}7efQc0#', 'bc868018' ), - array( 'a!pgIwZ^lU@^uC8@"3DND8rCPY*#=:\' <xhepDE]ye=p*U1,iVZ/', '09251477' ), - array( 'oNRA(\\DFwKF4D/z6S@sN\'1?1gQ=R)xaxG4:Pq_vj+= PMzf";[QCm', 'e8f565aa' ), - array( 'pTUCr(LkiF4~`eq@\\\\Lz\\|IXdLt@}8.nld2_l_LW&aWfHI(&&U!cS', '40202a4d' ), - array( 'K<8w2YvJhe8Mxx;YFs_)KGQtPW{&Y`Z%}r}0Mt[6[scUm~/4rn=?7', '9d3dfab7' ), - array( 'o5gG1n!rI\'p=&!jz]!VRe-@d<TX,rwCb-,+?z-2D4$a;&M6cNm65z', '092e633d' ), - array( 'Vy8,SD LhcZtnyo|-421vM8Dc{sR3)Ni$fvX,w%t[_iKZYHhnZzf(', 'db49c4e2' ), - array( '3,l/ @B*n-/U%gb|lWYMA&){Orj+mQ4!]!1^BTi1bxgh`JfN"@|DG&', '0c69cbb2' ), - array( '@vx+"g]7i<9z{[Pel4^U|? cn#%kGLqgDksGSR^=ow9kSjQA~0v{Pv', '8aafa096' ), - array( '_?zd,B2~+Vj ~?S]]CVv/+aaL`qD]C<=c7#oZ5oelZflz:KX^"Pn.3', '2da2dfea' ), - array( 'PZtC Rf<oKSs</),uvf\\cbw/<W2lF@ v{u:{H"88Ml-i{6ur.]OqAH', '6aa6fe03' ), - array( '"] 4JFTK>PAXMi[e#*S0sPGjCUIsHk=JI=^td4A#eb\\3M8yQBMb7~+', '50438792' ), - array( '#CaM8*9UUbs5XXIy[/]8B+P=]sjA+jL./.\\G9u|oYp%2JO,&_i?"up?', '5a10e446' ), - array( 'Td+upvB~&Q\\NkRL[->`?h1Lop7/s- 4ad@XU7zU>M2l9e9trWV3Ag_1', 'b41de8a2' ), - array( 'Xw@L&@ah&"A\\9<3WjEE$,_y 8P3Y9sjrk,@rM"[S$|1>:Du%j<*v{$v', '3d1d96c3' ), - array( '4T+nn~Yake"^4$;g)8xGR>>X)Zb Wfwk<#Z+#5mo{oO0tjx}#rEV1c/', '021cf019' ), - array( ':?r;vZ3cv7?#:Tq+QaZaWE[UHN{ ``0{ #7v]KZUbyX}OJ)!-ccd*?;', 'a52533a0' ), - array( 'Sn8SOxcLxfcpE0KzsFTqu~{w-`[rj{/>jGr;@Vg:>L+c]W_Q}4Dt4@lA', 'eacea244' ), - array( '"I5lED,1k~M-V6GtcRYA*9s)N8}bYk%[6;I\\_UnLU<Z,R""7U\\X_vMiE', '8dc7eb87' ), - array( 'eg)?T/{kKEH+{7XRT3^(6a?k>xK6F6\\-~eLSuI@AnhMk!\'>V:}_P_~<~', '7481744d' ), - array( 'xh5@~qM}XzRODrq4\\? ^F>6a<u3|uO{n9209%]8^Yk.}_ 3=@3{gR2In', '4da520dc' ), - array( ')\\l~-hmG{}`"\\y`7eo6FpIc1\\_x/rC~{ k{.UjURi7TF16]w&s>w>"*z', 'c6ec7195' ), - array( 'b#+VG+SGvOUM:, $CTKUj*Nq~mi=os9SwD+?O_gG0>tJKtOnJ{E6&s(&a', '6976d3a8' ), - array( 'rCRg\\\'`"2!Qriy#(nNTd~C/ziE"]N(@AKr))zj+.k]!UW$^FR3,QW;MA`', '57543a3a' ), - array( 'O /X@Q%4[.0F:>2w?hPDGvwZ$J3?wT!HT0!ub&+>4;dOZwGy`w?)o7dsa', '5e4ad807' ), - array( 'w4ZM5##F%x)+%G@A-o{%8vf06p!NUu1N*k{?o~etxn }7A?D1;JI32ZI#', 'c01f194b' ), - array( '\\wXR)(]u$|e#cZ|SZzj{;/.WZXjl45op-ID7Q"-U rYcMV7)R#&n35Fmm', '4e92f8a5' ), - array( '2Z"GJsUt8lF;z|;mV <.8F`;MPNbw<Q*vTRBH)7au]|q[9_29|ARC#mpS<', 'cf4d6b34' ), - array( 'TKY&VQZ)t$2,e)jczF|[Y7Xzi|~WnRtC~OIU"%_v)r#n{nRw6PTph.lR+k', '7a8a94c5' ), - array( '+y?!>>PgsSmSJvFNfC=:<TjqES 3\',~2\'>4E\\e.Q9{&crL2YpPs.%_ K4 ', '11032641' ), - array( '_;-^N4}bZ[Hh-ae3EX`X3R)(`/h`[|a;9nzg$xK^UsHcV.w{gXUz,^$lnm', '9298d67e' ), - array( 'MKj/f%~bl#\\9b2-+vc:n`"H6}Tu#Aepo1\\ xa~[O#8hfKvrBZ-2</ZS.0I', '0654c0b0' ), - array( '1Q/"BA^B:ABvpE0Y-[Q ~--1I=l|L|G]OW`qy?44`V,R|<-*w^*wk8)5Vu3', '2f477f17' ), - array( '#r[aB4B5.bIBD Nv}j$(cb3[OLee$\\x\'PUhsi,)wnR;3Si*QU/Z:rmvB;\\(', 'cf7e00ca' ), - array( '?9"GiW1^B=g:,:U@n@J@vZ{1Mi(o&exE zljS~Iu<11ILgi;(5\\~oX1=C:.', '2b97bb55' ), - array( 'I \'n #\\jW[4NxF_BrH-.PBjP2CaPf|_1|f!}j^iC:}q4DRW7zdFL\'1|:U_k', '8923a6db' ), - array( '=\\KNZ2OY}/CAIA3^ff6~azF.#W,>.l*LIU{%gL^f["(&D<d,${,evRtz+"9', 'aa215ef1' ), - array( '9nCe9xb>a/}Ij QpEnUQrQ]YI0OE<Q^U@#<Y|~x^.v(xvZj=J@n=rMw<^Gaz', '87741385' ), - array( 'xAQ:DnsBnl"}c*w[ebx1#hNu7G3unuqh7D#\\3w~"d" I,w&rZ $^iSU!{hwj', 'cccba4fc' ), - array( '_jTw/XTBPTE5VF_c?eWzf\\YP1/Q-xJxY5MQD&\'gV\\-l4TMxs4Pnz.HL?X}LR', '5d4564df' ), - array( 'HF,^s]#zdjRBx@VMnOA# 0~/YKN3J{esBrR7QV36BeY;\'0iu_+y`<yovF>*q', '3bec6d86' ), - array( ':pe]c9t5o(L2n&Nv68lvDgW`bGX)fbz"Sa_8zTNk]z}L"LC8e10*ygk\\0Dfv', 'fef9aa77' ), + array( 'l', 'e90c310b' ), + array( 'b', 'e70c2de5' ), + array( 'a', 'e40c292c' ), + array( 'd', 'e10c2473' ), + array( 'Z', 'df0c214d' ), + array( '0K', '66eddeec' ), + array( 'cp', '47297986' ), + array( 'UY', '6bf399cb' ), + array( 'RS', '6e04e612' ), + array( '+`', '47dc64fe' ), + array( 'Q: ', '1c02a1d6' ), + array( ' Mu', 'c5c8a3f9' ), + array( 'jS0', '1819afae' ), + array( 'cRZ', 'd9f699ae' ), + array( ' "]', 'ee32d84e' ), + array( 'Bo@$', '1544a53a' ), + array( 'U{5"', '08f0b60a' ), + array( '`&W;', '300ba78d' ), + array( 'Y+F;', '12d960fe' ), + array( '\\a<]', '7596c231' ), + array( '/2HcC', '4ee26872' ), + array( '-7}-:', '5e0b1ab7' ), + array( '[O*|T', 'c259a137' ), + array( '_yib[', '6cc9d49b' ), + array( 'p:vKE', 'becd7e8f' ), + array( '>g# $a', 'ae428052' ), + array( '07*tZ8', 'ed8d23f4' ), + array( ',YEF5u', 'faf2b057' ), + array( 'Q3K2.6', '44f076e4' ), + array( 'ti(0aT', '29d6e513' ), + array( 'U <Y!A;', 'ebcefc16' ), + array( '2XF\'4^3', '11bad723' ), + array( 'm%Z${-8', '2ef77eeb' ), + array( 'G@F^60g', 'a0044fc5' ), + array( 'Fq<|rYV', '00fb2e21' ), + array( 't{r\'U9.i', '0d526094' ), + array( 'xBX}}]y,', '58e08903' ), + array( 'uBL<"bMi', '6b4adbd4' ), + array( '*@\'\'3a^)', 'e9588a44' ), + array( ']Q03k?|d', '5a837058' ), + array( 'aVb`4]l* ', '8e9bed4b' ), + array( '9G#|tl\'6s', '7301283c' ), + array( '/JUmS4@cG', 'd708df29' ), + array( '-$Eqf{UG1', '406526e0' ), + array( '44<5Nd8LZ', '56f2092a' ), + array( '&Tpyc;PRnd', 'e1b9c4be' ), + array( 'sS-!WRs>OJ', '9fee418c' ), + array( 'fa^z}tJc-v', '42d4d075' ), + array( '>3K/./J_b9', 'd9e15b05' ), + array( 'EVmRXE&LdV', '1ccbc7ba' ), + array( 'wK9WG7LqzYi', 'fc482f42' ), + array( '9m5I|Es\\(."', '43fc2be7' ), + array( '^{U8B\\d(4\\T', 'af371347' ), + array( 'M4{eana<X{*', '0073ed9f' ), + array( 'mE\'39d<Gg{D', '7755ffb9' ), + array( '=4fzyn/WC\\l@', '3085c332' ), + array( 'BN0$jh uWE}k', 'c95b95dc' ), + array( '_b((J$Lh94c3', 'c7f99999' ), + array( '$rjGPWhr&xwq', '0b9873cd' ), + array( 'bxg;?e(~H0\'s', 'cee0652d' ), + array( '5T\\OhAbl4M5e&', '21278985' ), + array( '~Y-xQ~[JfwiL ', '97dae25b' ), + array( 'iu1qiGFGv/hZ|', '045498c1' ), + array( '})2c/1=<*o;f;', 'ce6b0a18' ), + array( '"_&O_oEqa09(W', '31218352' ), + array( '18@k5>tG"$Y@@d', 'e67f32fc' ), + array( '1\\LL_,R/kCU]%e', '563251e6' ), + array( 'w.=)F]t\\|i% n^', '10a0ae81' ), + array( 'A0DRlp~L|Q\\it2', '2f5d78ca' ), + array( 'Gzw@)6IPt?-q*3', '228eab51' ), + array( 'rxq4*6fw(eE%8"n', '843e8340' ), + array( '.57).W3D"d9Ar,K', '9cc1aba3' ), + array( '&~Ex3O0yH8_m=xo', 'c1a72c91' ), + array( '-\'&D14{EX}*r@}~', 'f0b627fc' ), + array( 'k$}2}1b.,+Flyde', '2255bec4' ), + array( 'iqmp6~%3D]2OPRNO', '95cb7153' ), + array( '?RNRQ`5_lA\'Y;k@&', '98f1390e' ), + array( '^.vu.{)SZ<#+nQ[/', '2f89dc6c' ), + array( '%+aVkw7Y9>3U+T\\j', '15c1ec76' ), + array( 'bS`pPjD+\'H7vzs\'!', 'b732fff0' ), + array( '~hWkaoE{.YQ:..%qb', 'a53c7189' ), + array( 'eb3Q(?XQWPLKWMKA&', '3bf2f0e8' ), + array( '7#u]~%7Q?E_D7C+zW', 'f5038551' ), + array( '\\$w5UOf#{>PH_W`cN', 'c3b89ba6' ), + array( '>bSU4rzt839C.p 2h', '00cf8218' ), + array( '5h9|k6;=^{t?`C]Cv4', '855c27e9' ), + array( 'Xj0N#CgFRYFeC\\N]Z;', 'caae0fcf' ), + array( 'suXRrNrTrPwjeQUu!Y', 'e2ac5b6c' ), + array( ':i lDGSg%#E_>:VwlJ', '0648058a' ), + array( 'F_~91w$vIZmK4(55tY', '11c2fffb' ), + array( '\\HBbLhBj#ybpD*PCCb;', 'b32cc782' ), + array( 'HZe#H27PGLF"*oEl<.0', '86a137c7' ), + array( '\'1*j"NtSr87/aqtd;\'|', 'f40113e8' ), + array( 'kOI3RT#wB?&RF8]2;,\'', '0096ffab' ), + array( 'n @\'/"y$g5,d"\\/5/c9', '8b7ec669' ), + array( '\'&X.Y F72aD:QDZYS]SX', '26b51c68' ), + array( 'Eid*lB9#Q}<Y%tg_u/v(', '9ff0e9b3' ), + array( 'p<BC`}|5[Qm!;S,(uE,H', '50d88cac' ), + array( 'DH"J>i*4y"<j>_/ ],59', '9354bdac' ), + array( '^#:yWG#Mm/u2Xx\\vcg+]', '4debf08a' ), + array( 'iHI)(X)ee> DB;?zbCIPS', '312f5ce8' ), + array( '@c,9A$|)/[sX%|`]&GDEG', '8793f867' ), + array( 'ihc)cFL-w!M[-g|1d\'A@z', '57a03ef9' ), + array( 'yFw[%~#IDK3.0=qVj OkN', 'a435237b' ), + array( '+x6)+{0M=+Hc$$h#(3HTF', 'f7f3fb17' ), + array( 'VdcI<OIk;xv5/!A+1nI<7-', 'c0276bde' ), + array( '@<vDD*lxQC^6mze8g!1_6@', '2a8386fd' ), + array( '`WLqGu/^$Oz{s@&a:W&xms', 'c5454bef' ), + array( 'tS,\\U==l^}E+pl" L\'PG#E', '7163befc' ), + array( 'h)\'#a-|P"q%.OZLmG+kl7\\', '262417f4' ), + array( 'Z9]\'@.ODT8N[<0i9ak,fz\\B', '30233bfa' ), + array( 'GJjR6Xis3$R:Eaii6#9q?I\\', 'b1d4e934' ), + array( 'Y+IerDB5kl ?$X*xk/L\'T.q', '20d3742c' ), + array( '?DtX75#sn/=U"ax7Nf8nkpx', '61619334' ), + array( 'd])1d]?W}dLW{b[oRj.)lo"', '366d01d0' ), + array( '%?h=.T/(:m1LRol*nQWGM;#>', '6ec48f20' ), + array( 'mmLv[=ya\\b k8/tS|\' Pwl[f', '9fb5d98f' ), + array( '?4/lO2,>!X5]u/?Sr@@,O5_M', 'b476c549' ), + array( '=_~5M[|lo,Z?>f]@?s}6$>iw', '621bbc86' ), + array( '^+$/@c]^C\\sp9p^)|9I<!(\\A', '3ea36c5d' ), + array( '{[W!yBxXM|hm`FL$$Au=2UF0o', '0f54780f' ), + array( 'pMpx*2tfjv`-o:Zl#IMIuRN8I', 'c19ab462' ), + array( 'kK 3[o$)a|4trz_i\\lZvGGzpu', '1cd34af1' ), + array( 'DgHr r_Krr(cw2EuF:iByS~f.', '0d60d437' ), + array( 'v/Vq L7gu+hhj5\\^=@WPfMw"7', '9d0ca535' ), + array( ':{k:cz2sQ$s~<\\tGF^3[<ry]JJ', '92579a4a' ), + array( 'DwCF0^C|y(w,{J1pJMM?ut~)Q<', 'ed50fb22' ), + array( '|KyGv>@;eQy)Ns1F -q1}<_L\\U', 'c5960f99' ), + array( 'B\\_sx\\@r%71FRvwM!FA3lA@_S?', '51be9eb7' ), + array( '{4lXj05K$.)D".\\3T0+L]-r @`', 'e8525ded' ), + array( 'Aa@u"=+nvu -A$;JI>X&R.7^[uk', '0510b06f' ), + array( 'Nu,08nQ.pn9`e0`rQd/{.MU5 cL', '43c2c9c8' ), + array( '^?BKn8X~QGP_8@yx&*Zy[@)XOV.', '39874c53' ), + array( 'dWr273Ub"n;"@bS!{szuz&Ptbp~', 'c81fe453' ), + array( '<@VJ&.>8ERn)U]DW~(, $!{y|"K', 'dc0d68d2' ), + array( 'qe<p"]GMcVk||>k&sJKLITYIYZET', '90be4d50' ), + array( 'WH J.=;0zc]_;J\\8hI?]sk+=@dfy', '5e1e1340' ), + array( '?-OwUOBcm^tiCRI^}\'wfP7ED#PaC', 'f03345c0' ), + array( '5I>UWmM->pq,Pgus:?S9FK!wbF<e', '94060b65' ), + array( 'w~*-IHc!72/U$!bThYH$x|=@H>9+', '547a6b68' ), + array( 'eUq]U{k~EP!]b04f2v;{Qd!Ka?l+^', 'e777322d' ), + array( '&6D[)#2&n1L?2*#C?iU7&RhkS4Nr!', '4a78ebdf' ), + array( 'YR\'ovcyyu i\'L*:W-^vw5.}gvj<+9', 'f83d06fa' ), + array( '0-rb4cZw]Um^?u+J1bWpZO&hNn`:,', '7f314445' ), + array( 'lS<yG /+Z(i0vHPmTz~8Rpr#w\\Rf>', '831a8450' ), + array( 'lr+A0&h05sk=^{4\'M#\\H"t{sh kESS', '0c39d6ad' ), + array( 'cAFobWuKh,@TJ Q_(~bdHeYEYCEEhx', '12b2879c' ), + array( 'xM;@=}x4JaAk7kkhLsh/Y2t4WOW}uA', '81c3b55c' ), + array( 'von21-1*B[lcH$P4m|)V-bi#wARO?I', '0d5d6b27' ), + array( 'p79`JKn[V18Cu`GGu5D lQbVTZx(+8', '0fd3c926' ), + array( 'Q{Pk]z7LWn^o2UQZ|HpAH]s,5If/QrG', '0f36a996' ), + array( '$oxoMs(zLvY=*/nd,8UN`4ClJlTY>G"', '80b38386' ), + array( 'C7z4do<_<4:Y?JI$WaZ\'BoJ0;7dtV,w', '9874d3b3' ), + array( 'yDr.*cKj `%Z P$%(f`/*PY:kq~aH,Y', 'ab5089b4' ), + array( 'BQMQ[1|F1]Lk]|pc&WD5buo|ab|D+*}', '5d600f5e' ), + array( 'N[K 7\\|^n[+[9(L}.%BDg85ezwc?$m>R', '1966e89b' ), + array( 'JjRaGPA7,LrFU?EcEg).!?t{7X<;F[mp', '908106a1' ), + array( 'FASnrt& BxGw9l\\_TemV%bR=<oXbKGTr', '824f8688' ), + array( 'i)a\\~g]Aa%9{qu[G\\J}b.Q JBY.m"c`k', '195cad65' ), + array( 'lCIk,\'.m-Gj >GH{qF^!x_L;9Z*;?k(,', '36f68af8' ), + array( '/Qx;Y\'*gOtgn<0j/WI1Q)]lC9w_Xcges:', '885fad78' ), + array( '^0tf:\\60E%MVp].:n_DMMgfEH?*0%}Kd.', '7f86cff2' ), + array( '@LI}cZCi)yZg)tVi:%8#k^K,h\\2g(vvIC', '3dd2e16e' ), + array( '@G\'{jp&eLmoBEY\\Jq_6Q,B:hT#pLy:p;a', '03b92168' ), + array( 'x8Mj>47,$YQ^6{Qv2##U>l+A]W<xIW[Bo', '7b4dcec0' ), + array( '*-.>D:C~l"6hS-{W1Qu}]8\\6TU_,2#|<0+', 'b86f1510' ), + array( '[UF~U3"k|Vyx.+K$*)<f@p= }O#zl4\'HjM', '93a09a8c' ), + array( 'H@aJ,^!&W02$4<-Q#MCANApR=]fD\'RqPrT', '2d094101' ), + array( '{~3|&k.8oCU}tXL9y{[kNxJ6=Rh0#[e~[x', '72d5e000' ), + array( '|ae+zUNPTD*!]%|:pL3<bQnKbr(HqcBnF(', 'f4f08743' ), + array( 'zA]Jr3n|4M"2gs^{0AM m0ruYeZ{U!$PCbz', 'ef1f608e' ), + array( '6uj4+87=!,{|=>J=,[1#6v]2L^7}#yx:pdN', '800e955f' ), + array( '{}f:~r7{0UGNa$_e:WCM$#d"&_{AQ`pN^Wh', 'fa87c111' ), + array( '^K [\\U$+8)k~CCBqGEWJL7Fnh(_7g7!Fc!"', 'f0d49ddf' ), + array( '@W\'Kp08oT[3F$Y}N\'6uu ~U8fm9-Q;0qs8>', 'bbc8b16a' ), + array( 'eHVU|2iD7CCfJY]@Y\\vqCd,Q6Gb);zG!D}WB', 'b4c1dc4c' ), + array( '1BfIe+01dmR?JI2n.>@Ef#N#~u%Dt\\f\' NPe', '7c98ca04' ), + array( 'Y`w?NJ_ysqh#1)Hw-w{-m!Qc^9j^g;EB{=bK', '79ccb205' ), + array( 'gBF\\5/_F9)?G!;Un=\'S{A>[)Y!LV>/#\'QIcg', 'ba719e14' ), + array( 'YC.rLN;Mjp=(xp%:0`DjbpB! E(Rol:I0I=]', 'ce2a6b64' ), + array( 'xY,cJIlC;r]KT"77sY9t~BGo/b:@-X}&2*j\\T', '87e2ae2a' ), + array( 'X!pK_=!bT8V.RL.ts}$W8DdqCk$NVa$0ct\\C2', '380f7299' ), + array( ']\'gv^uI+%> #CW<h=.,)3[`t_pXTM|g,$O#cF', 'eeb01e49' ), + array( 'LnKkoO/Hkwez%o.`Q$@C\\upZ]}_.!CTM3!:#P', '9f74a4c3' ), + array( 'IK=B29G"G(SKIv)?hc}gC,hga7zbQ~4zKR>]k', '4b7036db' ), + array( 'e`4n5`9-iXvNV^rcGZE_V)1U>-!pL_]2@q"UR;', '2ef7953e' ), + array( 'b=sYlK9_/`;TAr^SH|aJm.+K@K>C"p^d/S?{~X', '58f87a0f' ), + array( '\\/:wc\\jC04@q_. jZA7xd9jD}zw>vwwS\'3Lko8', '924bf023' ), + array( '/ MOr.^rx9503yI~>Hy7gp/_E6rr#c,2cYbWhA', 'd2c773bf' ), + array( 'Ja[`ro[=nzeh2MZB.!Y"t\\e!oJ[R"DtM\'P.yAi', '59761485' ), + array( '70d}ywLU:ZVs]LQCMAn*sqOh@V:NQ[9il~hgw5=', '1616e5d5' ), + array( '2pt\'NAXroybznTJXt"rDTO^>=^(%V=Bi/8q^ZJR', '2b93c8c6' ), + array( 'JE5E5jpm_r`%G1cfNBnSy-vd=0V{j!N5Gc[\\NMJ', '22863e0e' ), + array( '/@,4h=xPl<@@7N8{kHRg3T7I{z&YJS%Zt2o^Oi/', 'ce54d2ce' ), + array( '<&O]=~v9j?lRSAi}>e%w1X}lN0\\-`G=}Mm[klS&', '925e90a6' ), + array( 'Wsr+G4tFS[KLm%JZTZ8a<_ :.mvyZJ!3>s>f)3-]', 'b47ebcb9' ), + array( 'oY*]^T830PuL1uf?d^9?);RG0q.9&<vuu"STVlhg', '76d4ed18' ), + array( '>_5OV|n;[)ZdE.-U <n\'Xf|NhQ$@?m)]M>.$;}?w', '2fb33679' ), + array( '(z]M*j#+\'r2_Z0/Da3e!"n_O.mTJltBto CzkF&r', '569492ba' ), + array( ':9SuIb:+v!-xplI~[}JHrm>cna^Z)eND~":IeUT]', 'b9cb09fa' ), + array( 'WbVHP!H- rVratWPW7+a}Y&|\\AFBw{!O_Ww0YA>Y5', '26b7c332' ), + array( 'tMvi&HB=S$;.+9jL`.D]/t=gmNB/l{EbI<MOdom9t', '7de5c876' ), + array( '*G C3L$BqbRf ;UO]d=Z+ %GMU-=CF2Mn3q#`vFRY', '627567d3' ), + array( 'y:Z6o*sUHO`HT)u*74N]G|MZnQ;exn@r*z*z&}QNN', 'b1579567' ), + array( '3v#<m.S#]2KZ`\'J3C1,2Q =M*8S)i"W|y[:hinlH"', '948a6c9e' ), + array( '9#b@Nvc`$v3$4`/L4977q42MO{8>i`@#d$C4z\'t~~(', 'fa5a6693' ), + array( '$3h4_}Mw6?-Im\\E&z/g<2M@Va<^W<]_@pITQH#J^BW', '5db013f4' ), + array( '(14N80^ LqNmH0+\'hGeIhWr>*<AT{d,$u@S.Q2/~$]', '57cd1795' ), + array( 'mMnxUWA;!*stH}2iR.O_3E!fTRycQ}B?K18"iZ=kd1', '08722fa3' ), + array( '`.0sxb"HC6nD}Cvw\'HvJgC[!EE[c1AtrO&fIiiq- `', 'c89edaa7' ), + array( 'Q~%Hv-qmWZ23\\WY9;kZ1^+8FT"1G/2)`1.*)<{vsW*(', '702aaaa4' ), + array( '4aaM}M(0-4HTiJe1Zw;<*JF3fC+Zz5c/wE]vsf("zQV', '197ef095' ), + array( 'd|=vW63s@];SD^_ Ztcjm*He~/m!+?Xp<vgs-{hMY$"', '1ed13f33' ), + array( '}cb~>Xb)FmR,laznl:H^V?FKLC4z|9}{|`z<:^F`Lxm', 'c04f1349' ), + array( ':[h*I#R(ZrO\'?r<;oU:lS{ho6G6vt0e/kN:6Rl>._m5', '48c23cac' ), + array( ' aQ<R(V?[R(LhPb`EsGU`vovJ]5X>$n?eA[9I3X&faRP', 'a53ac530' ), + array( '262W+Y.kP}b{[wTz|D:bev{0*U7p7iBJ!T#,.1w_/Z[k', '05d91499' ), + array( 'S1gPU"4<x1M$gdu N8JPlM]{^U[n18[eIC7 FL<@^iDF', '12db23fd' ), + array( 'N:G}SqO@@-< cxnt1K[[or[6@wV~b{F17m0j__,!mI!Q', '2b2e3dde' ), + array( 'BpGT<#0-vkC7dz6Gv\\Y.Kjx+K&-9O.jq 2G<6WJ-DmE*', 'f4c74b67' ), + array( 'h\\R_:-newhqCn~]>-I1.[XKr1u!UcF`M#3-=@|#9et]Tt', 'bd458351' ), + array( ';r#d$1A]\\4nR6E6\\&d_:q}Zn"tUwR*lm}oS#!u`^+P1Au', 'f8e9f1d5' ), + array( 'H}|-^7 ]ro_gEW;PD*N5]Q7S3u^c\' YP~W^^n^<bO{KuS', '8e947b43' ), + array( 'fFxpu.OGE$[;c?CdytcQSCA2_$b[PX08~)*t8Y=]^yyB9', 'a34f6609' ), + array( '>(33lef0\'yo,\\L]6\\u6e ,}ZI\\9CW\\]udq)QWpb_jRlH~', 'e9d8fa86' ), + array( 'J^[@tB@!A{K~5oVqNLW@V*xGlY3@F[@q;|21?S3aO_`eP8', '104537ea' ), + array( 'X~e0@<;:d)swI;Ti-pg@"(s6iDuK*GcbFIsgf/"K9vCb2x', '7c5f8020' ), + array( 'M?i5_l=T#(xyT$A9fhb[QJkSu%K:h]46}}L^kj3os-iH1,', 'ab2ee1ee' ), + array( 'axuETGoA{fFG"0&6G$4sb!_upS#[{5h^.^$c\'t%#[LK]\\Q', '8520630b' ), + array( 't$U)x8*X/{,3W)H@hW m;\'bA+?mV}K(rP^|Iw("\'$/;\\9d', '5ec32f02' ), + array( '|"<|oX%Sz0rifq5oeeNb0Fk2NpBiM[OK^lINFN#A^u+FhA7', 'b5b5f4e5' ), + array( 'N(e18-}K[nmF<Jvg)c1X*`[L@RWg;y~i"e{:rzeOiTv&~mn', '14562c12' ), + array( ')R!b\\a?)"qai.[ix]OuxCp^rZ4ja3XP=+R h4?r72T"@1k9', '01b11a54' ), + array( 'n</g_!GS[[>=own-#B.lVM_n`5p!F];5zJ}ZLF.("MFrE6!', '8f9e0173' ), + array( 'IX/60]v~>,p@RO[hJ\'f%S.4[1a#$\'9%Qr5g#r_#1ktQ>D.(', 'f4e44d2d' ), + array( 'n5oth}*E/kH4sb:FVO.ZBn]TZR\'yv5"fJq\\4ofZ S#4HfNn>', '51b1ae3d' ), + array( '}}xAlVvH*}B"4Eh_7Fs(.N(aR=+:lyXkxQ.f)%/3#R57w~v/', '0d3e9950' ), + array( 'Ek7S;@6m^A)L<a864G|=L,QP^fgVf_f,L~`g?vV~9_KVBdlW', '8c43dabf' ), + array( '-itYuG*U/r-uSs# rch3[?2t ^KBD8yQ#o,y86OG*\\=]QA^D', '4d86d9cd' ), + array( '%GXafjWgJ$*o=%B@uN:.ejUoGsMy5,>;Tv|<bT$.X.~u4A7*', '38b099cc' ), + array( 'pQ9V<oFdct^y"}5Vu3rYhvgB&g8;)PFy"_Q?Ow%3md.pbDHYW', '859042fe' ), + array( ';3A3{c:c|UmM{gP\\:o,3t@!ZNq=s:vKV+lj\'P&kM[Y{XBL6\\<', '88b478a3' ), + array( 'Bo2cql2d+& #RW/@B6qH#@%\\<^ ht]&8N9{@\'/%36%6h\\F* \\', '4b1d0513' ), + array( '{I`<N>Y.>C$|J<Kc8kkHq~^w6GT\\RU:N~{kN:E\\YiaV4}"x7n', 'f1ce1247' ), + array( 'e_`d>Y{f/Y9dsgdpT3+zpddR<yP?rh.XHo>fI;NXtg>iP#Z%6', '3e4eb24d' ), + array( 'e \'KeZg_,\'St6-=\'K%QfS+\\;IFkL!qcgrk3XF{9R$lG;yeBFjs', '69476a97' ), + array( '.? j[I2Hv4:Z{-F0fm, A0mhLhOn0:c>Zc*6.=^%Qy`M(\']nuj', '9097fe8e' ), + array( 'n7{]!HFP7Vk{uF`!]n>=to7U>?]{.Sg}kc\\l,#>DZ*@QQ"R/qq', 'cbee4ea9' ), + array( 'Mfbd<!$z}3Oe2;In(UrFyMQ; $=R40Eav(F4)K/(^^mpz8`#mS', 'f19251c8' ), + array( 'Jh!|%"!CT6SzwK#?_-jo5JO#<J<|N*PysRwyTy=*0q%(=)G}63', '8f27bdfb' ), + array( 'nK]?Oyikv9vH4k{,eQ&$[6va>5jf3"y#NWB~R-kJGcr[Oog6Am;', '9cb72621' ), + array( '}%3`DHK+\\N&_|^#|10h[WLO4|?{4ajP_pc@5-lAi<GJ:\'M78^!t', 'e0686fbc' ), + array( '7NEKLdHaG32($vI:$7[nS$9n+f&DF(9]V^*#DRdlfwtko>&tUbc', 'e4bd2dd7' ), + array( '*f|xrd 8,(Qi^1sbVGHC.@9y1W &.cj9Kh2>M2VZ:)Dy;9\\r`%6', '5efb3af6' ), + array( 'oFOiW(j^7NIPy2b9`uo;1y`+6zh)\\n@L5p6mx!L0OvaJ)Dci;T&', '05e74ead' ), + array( 'LNfXdaAn>0/jF "5y#b+SYl}b2bMM7Sze:SK|u:<&J(MJ*bD.EOb', '17cbb538' ), + array( ' <abND0|\\dwC Kn|A*:HTCv NZD] t@!1#c`Ht]%YVHY"8WDBrlw', '4eca862a' ), + array( '6dwd?=B@2cADf%&0zd5U;]/=ugb9[P2q5*WTHzt[_6!G<\'W8klm\'', '296c9ed7' ), + array( 'J}EAe)ZBYl4nwlDAh9|HP}om&H&q5sy`q@#XI]z$K0rD}7efQc0#', 'bc868018' ), + array( 'a!pgIwZ^lU@^uC8@"3DND8rCPY*#=:\' <xhepDE]ye=p*U1,iVZ/', '09251477' ), + array( 'oNRA(\\DFwKF4D/z6S@sN\'1?1gQ=R)xaxG4:Pq_vj+= PMzf";[QCm', 'e8f565aa' ), + array( 'pTUCr(LkiF4~`eq@\\\\Lz\\|IXdLt@}8.nld2_l_LW&aWfHI(&&U!cS', '40202a4d' ), + array( 'K<8w2YvJhe8Mxx;YFs_)KGQtPW{&Y`Z%}r}0Mt[6[scUm~/4rn=?7', '9d3dfab7' ), + array( 'o5gG1n!rI\'p=&!jz]!VRe-@d<TX,rwCb-,+?z-2D4$a;&M6cNm65z', '092e633d' ), + array( 'Vy8,SD LhcZtnyo|-421vM8Dc{sR3)Ni$fvX,w%t[_iKZYHhnZzf(', 'db49c4e2' ), + array( '3,l/ @B*n-/U%gb|lWYMA&){Orj+mQ4!]!1^BTi1bxgh`JfN"@|DG&', '0c69cbb2' ), + array( '@vx+"g]7i<9z{[Pel4^U|? cn#%kGLqgDksGSR^=ow9kSjQA~0v{Pv', '8aafa096' ), + array( '_?zd,B2~+Vj ~?S]]CVv/+aaL`qD]C<=c7#oZ5oelZflz:KX^"Pn.3', '2da2dfea' ), + array( 'PZtC Rf<oKSs</),uvf\\cbw/<W2lF@ v{u:{H"88Ml-i{6ur.]OqAH', '6aa6fe03' ), + array( '"] 4JFTK>PAXMi[e#*S0sPGjCUIsHk=JI=^td4A#eb\\3M8yQBMb7~+', '50438792' ), + array( '#CaM8*9UUbs5XXIy[/]8B+P=]sjA+jL./.\\G9u|oYp%2JO,&_i?"up?', '5a10e446' ), + array( 'Td+upvB~&Q\\NkRL[->`?h1Lop7/s- 4ad@XU7zU>M2l9e9trWV3Ag_1', 'b41de8a2' ), + array( 'Xw@L&@ah&"A\\9<3WjEE$,_y 8P3Y9sjrk,@rM"[S$|1>:Du%j<*v{$v', '3d1d96c3' ), + array( '4T+nn~Yake"^4$;g)8xGR>>X)Zb Wfwk<#Z+#5mo{oO0tjx}#rEV1c/', '021cf019' ), + array( ':?r;vZ3cv7?#:Tq+QaZaWE[UHN{ ``0{ #7v]KZUbyX}OJ)!-ccd*?;', 'a52533a0' ), + array( 'Sn8SOxcLxfcpE0KzsFTqu~{w-`[rj{/>jGr;@Vg:>L+c]W_Q}4Dt4@lA', 'eacea244' ), + array( '"I5lED,1k~M-V6GtcRYA*9s)N8}bYk%[6;I\\_UnLU<Z,R""7U\\X_vMiE', '8dc7eb87' ), + array( 'eg)?T/{kKEH+{7XRT3^(6a?k>xK6F6\\-~eLSuI@AnhMk!\'>V:}_P_~<~', '7481744d' ), + array( 'xh5@~qM}XzRODrq4\\? ^F>6a<u3|uO{n9209%]8^Yk.}_ 3=@3{gR2In', '4da520dc' ), + array( ')\\l~-hmG{}`"\\y`7eo6FpIc1\\_x/rC~{ k{.UjURi7TF16]w&s>w>"*z', 'c6ec7195' ), + array( 'b#+VG+SGvOUM:, $CTKUj*Nq~mi=os9SwD+?O_gG0>tJKtOnJ{E6&s(&a', '6976d3a8' ), + array( 'rCRg\\\'`"2!Qriy#(nNTd~C/ziE"]N(@AKr))zj+.k]!UW$^FR3,QW;MA`', '57543a3a' ), + array( 'O /X@Q%4[.0F:>2w?hPDGvwZ$J3?wT!HT0!ub&+>4;dOZwGy`w?)o7dsa', '5e4ad807' ), + array( 'w4ZM5##F%x)+%G@A-o{%8vf06p!NUu1N*k{?o~etxn }7A?D1;JI32ZI#', 'c01f194b' ), + array( '\\wXR)(]u$|e#cZ|SZzj{;/.WZXjl45op-ID7Q"-U rYcMV7)R#&n35Fmm', '4e92f8a5' ), + array( '2Z"GJsUt8lF;z|;mV <.8F`;MPNbw<Q*vTRBH)7au]|q[9_29|ARC#mpS<', 'cf4d6b34' ), + array( 'TKY&VQZ)t$2,e)jczF|[Y7Xzi|~WnRtC~OIU"%_v)r#n{nRw6PTph.lR+k', '7a8a94c5' ), + array( '+y?!>>PgsSmSJvFNfC=:<TjqES 3\',~2\'>4E\\e.Q9{&crL2YpPs.%_ K4 ', '11032641' ), + array( '_;-^N4}bZ[Hh-ae3EX`X3R)(`/h`[|a;9nzg$xK^UsHcV.w{gXUz,^$lnm', '9298d67e' ), + array( 'MKj/f%~bl#\\9b2-+vc:n`"H6}Tu#Aepo1\\ xa~[O#8hfKvrBZ-2</ZS.0I', '0654c0b0' ), + array( '1Q/"BA^B:ABvpE0Y-[Q ~--1I=l|L|G]OW`qy?44`V,R|<-*w^*wk8)5Vu3', '2f477f17' ), + array( '#r[aB4B5.bIBD Nv}j$(cb3[OLee$\\x\'PUhsi,)wnR;3Si*QU/Z:rmvB;\\(', 'cf7e00ca' ), + array( '?9"GiW1^B=g:,:U@n@J@vZ{1Mi(o&exE zljS~Iu<11ILgi;(5\\~oX1=C:.', '2b97bb55' ), + array( 'I \'n #\\jW[4NxF_BrH-.PBjP2CaPf|_1|f!}j^iC:}q4DRW7zdFL\'1|:U_k', '8923a6db' ), + array( '=\\KNZ2OY}/CAIA3^ff6~azF.#W,>.l*LIU{%gL^f["(&D<d,${,evRtz+"9', 'aa215ef1' ), + array( '9nCe9xb>a/}Ij QpEnUQrQ]YI0OE<Q^U@#<Y|~x^.v(xvZj=J@n=rMw<^Gaz', '87741385' ), + array( 'xAQ:DnsBnl"}c*w[ebx1#hNu7G3unuqh7D#\\3w~"d" I,w&rZ $^iSU!{hwj', 'cccba4fc' ), + array( '_jTw/XTBPTE5VF_c?eWzf\\YP1/Q-xJxY5MQD&\'gV\\-l4TMxs4Pnz.HL?X}LR', '5d4564df' ), + array( 'HF,^s]#zdjRBx@VMnOA# 0~/YKN3J{esBrR7QV36BeY;\'0iu_+y`<yovF>*q', '3bec6d86' ), + array( ':pe]c9t5o(L2n&Nv68lvDgW`bGX)fbz"Sa_8zTNk]z}L"LC8e10*ygk\\0Dfv', 'fef9aa77' ), ); $i = 0; $pass = true; foreach($tests as $test) { - $result = hash('fnv1a32', $test[0]); - if ($result != $test[1]) { - echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n"; - $pass = false; - } - $i++; + $result = hash('fnv1a32', $test[0]); + if ($result != $test[1]) { + echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n"; + $pass = false; + } + $i++; } if($pass) { - echo "PASS"; + echo "PASS"; } ?> --EXPECT-- diff --git a/ext/hash/tests/fnv1a64.phpt b/ext/hash/tests/fnv1a64.phpt index 870c6ced0c..1393fc1b80 100644 --- a/ext/hash/tests/fnv1a64.phpt +++ b/ext/hash/tests/fnv1a64.phpt @@ -4,321 +4,321 @@ Hash: FNV1a64 algorithm <?php $tests = array( - array( '9', 'af63b44c8601a894' ), - array( 'w', 'af63ea4c86020456' ), - array( 'v', 'af63eb4c86020609' ), - array( 'Q', 'af640c4c86023e1c' ), - array( 'd', 'af63d94c8601e773' ), - array( '"e', '07cc2f07b4942580' ), - array( 'pl', '08d53c07b5755019' ), - array( '@L', '090c3c07b5a49289' ), - array( '"N', '07cc5a07b4946e91' ), - array( '&O', '07bf3907b489ac22' ), - array( 'KE:', '50d8ad19d18c8505' ), - array( '",u', 'd511f317d88f429a' ), - array( 'RX7', 'a0549119ff001600' ), - array( '/<i', 'eea15a17e6ea5bbd' ), - array( 'Otx', '2ffdc919bf72be52' ), - array( 'w/qn', '9c6e50f771dcafd0' ), - array( 'aVqG', '4f1788838c1bcf9e' ), - array( 'G^hs', '33551d7dbbea0209' ), - array( 'a7z1', '4389ab82f4d6a7d0' ), - array( 'c@Lf', 'c14b5591800f1338' ), - array( 'MB:&Y', 'beb09d1ee59646d5' ), - array( 'ICDy9', '4f05ddd19c2c2285' ), - array( '>qH0a', '370b9a8e5a2329eb' ), - array( '*fSR/', 'f78a85007841cb19' ), - array( '3;$tS', '94b935103cc08938' ), - array( ' \'7AS}', 'd81e3aef0fde6ad8' ), - array( 'ou9vPc', '549f05284ed347f7' ), - array( ':u]S4O', '31b0206c95a52e7d' ), - array( '{D2\',e', '3a68240ea9539e62' ), - array( 'Y;yt@n', 'afdae733c98065a2' ), - array( 'IAu`bI_', 'c311eb3e8f9f51c4' ), - array( 'R@xIq]d', '3fa1984555c55e46' ), - array( 'g;8{k5@', '9e9c5e80cdc3d58e' ), - array( '}<Ldvh^', 'e5be53f31a393f34' ), - array( 'k*N6KDw', '558fdadc82fbb9d4' ), - array( '/nWb0Q-"', '84fcc8959c773b75' ), - array( '/qiK+e7@', 'd177962e1def962a' ), - array( '\'5]SzT=Z', 'befb197ea3aac960' ), - array( 'AH)WsNO$', '63dcf1c6c88d5426' ), - array( '=(fNZsPj', '806bfb067d62da41' ), - array( 'f:6q!M3(c', '5125f3e296d40b42' ), - array( 'p\\^Fz:gCC', 'b9ffcd384d90ba98' ), - array( '@7qp<0x#^', '1da17e378a5f0686' ), - array( 'Tw/?^JUQL', '85f6d1938d45b818' ), - array( '#dTfU2F|-', 'b66e4e092e385394' ), - array( '`dP%&hvv%(', '84523fb38ca2975d' ), - array( 'p)fE!vd`B;', '9c94c2a34d9f95c3' ), - array( '2n>vD&MVMJ', '1f4fd77c72b6004b' ), - array( 'd//546~,-$', '159ef268adc718d9' ), - array( '4~.{E/s*p6', '31a60e2db942bc67' ), - array( 'F#&dyJkG!:q', '33b8c68aed55c285' ), - array( 'eI"{^9zjG ', 'b42c013a2028584a' ), - array( 'F/|k>pv/(=3', '671c9537b41d76fe' ), - array( '.#-XoUZ*HAT', '84e0630a952577f4' ), - array( 'K>4d:~-: SI', '57deb72cc24c6bad' ), - array( '|@hn8xvV,%Y:', '157fda2502fe1297' ), - array( '^Jp:T9\\*ez>K', 'f784c17d1a2d1bd2' ), - array( '5>XP>-z<Mc,f', '6084bce050682a8b' ), - array( ']#=j)w&hBv#w', '7a2da4d0b1c01e1e' ), - array( '1_"vZ@Bp_{A}', 'e1e8fb095e4709fd' ), - array( ')<;W!G>^K\\JTT', 'dd737d6771e9cd69' ), - array( 'P>vGAoX"qP]3s', '0375e65060074988' ), - array( 'Nrooqy-.Q.Upm', '135d77993c647f43' ), - array( '"M8W"huy18ij:', 'aedeb2565e1c29f7' ), - array( '\\;wo0Gb!8UzEc', '59ae633a0b17a945' ), - array( 'LS:=B<kZtmDjhU', '2b2e674d9a46a36c' ), - array( '$S@>0\\7 l^cmw:', 'f21c8cb206540a2e' ), - array( 'h=}6q8T4U@nJ/3', 'b258eae8a4671c77' ), - array( '6wi:L*Y\\gp]UPB', 'bff5f2c9ed84bce5' ), - array( 'CH\\-fZDXsxlJ9\\', '298d4e05d5a47c45' ), - array( 'uIp,BZFne!KMr*#', '8641dfc04c9fb552' ), - array( 'CLGl)USdy-Yry$-', '3ab1497c481f22ab' ), - array( 'WyVH\'y#NhhO57B?', '8dea1d032c597f60' ), - array( ';fkbSt8(Z264&09', '4b875649e7cfa1a9' ), - array( '4g3k1:e4iN}9c6[', 'd33acc8fe01b77fd' ), - array( '$QBo4veM @`6UgGn', 'c4b17749dca1aa6a' ), - array( '{0#gA>MV(|TAaj}e', '067ae9cfff2cd6ea' ), - array( '=AVR8< 9]aO3Iw#E', '02bad50d48a8e564' ), - array( '(&-JD[!LYVm<Bl#_', 'ec868a84ae92c032' ), - array( '.Y2Gv3`Tt1h>)kd2', '9f7776edcdaf2937' ), - array( 'qq]6N_c)7REY?H:M"', '1899eee357e747b4' ), - array( 'Mtx`VNVg7uq#Z%uMc', '8eb7e5a4bb9fb739' ), - array( '-{Cp%ZCK5ctO2v}\'p', '58ebf399369565ce' ), - array( '^^@6GW,9[f?Q4#^1G', '76ab1ea61d68a738' ), - array( 'P7#tb9XWhjOgrAGQa', '29294a2d4b758119' ), - array( ']x9i3uPSGeW\'v~W.#L', '508d3356f8ec886b' ), - array( 'p<&I&pxmd:57{r06\\D', '4660b5543de2afdc' ), - array( ',.wTsO[jO4xSajog4u', '6d85fca5fba07683' ), - array( 'Y.c?HyVElg\\J,hY%>N', '01e82905c1f66c8f' ), - array( 'Uy:&/4Yq~IZ4@5B%Tk', 'a05cc808b297050e' ), - array( '~+1lrm8 Wr&uA[p[a!o', '22783c7a8fbe4826' ), - array( '<roeM$\'bG,73+CDx731', 'e00ac9dc3812b301' ), - array( '7j$>aFyS#\\TsxGc_uhf', 'a8cfc6804bc24e1d' ), - array( 'X0rpD~5iwL|*dh/#KU|', '17b538fc3a531c98' ), - array( '~YZSMS{14qzzK,n=PmR', '47a7dd2be021ae55' ), - array( ':f 8pd!!hMWeL1A!^u|p', '4c9d34c81b647804' ), - array( '*ol&<xtZIb-dJ.|<r~=[', '7d8483384e8a46c8' ), - array( 'LuBx\'dzfZwXehEk%>`_h', '25484f299d38dc95' ), - array( 'DmMn{K+oKILw?oqGTl/0', '8ecc9d0f58ead225' ), - array( 'eguN-bTLC55h$cX!0cq[', 'b3e4439d186da97b' ), - array( '.?TN/Fvd4&uznlJ{O~Is5', '983efebee9945885' ), - array( '_\\9C5;Sy-0)LdW[,NAAU7', 'c01a00203768a32c' ), - array( '<D%fATfjH{K&6n;QC6^T?', 'ef488311549372ed' ), - array( '+9wgEG*g}B$BGjd{QPEN{', '2c57de61c289de00' ), - array( 'Kdkg6/~uc>"}7jD^t,\\80', 'f83a6970b348b383' ), - array( ' _{e\\N6#|2Nb~7y/6orUrq', '26006911a7c5d137' ), - array( 'l]6LRC)jS*KPo)~&,{9Z^9', 'd848d0547a41bac1' ), - array( 'rXH)I;^<.KyExMh"9=-em|', 'ad7ca21d760bab1f' ), - array( 'nl$zh>UHWH" RL<1hJ]coV', '87be1c6aab3568a9' ), - array( '2XYKuf1cd Qhz;\'Qc^zf^M', 'fcb5e375b267b232' ), - array( '3z_|F>`6usoP?e8QJ|R{fM7', 'd6cd721ef468a686' ), - array( 'm {Mzc-Iv(*tOIVe@JVpj=*', '5ea4e77a701e1fd9' ), - array( '<g\'ndm=|\\=y*9]7cU@nJp9"', '256fbcae5dc6e749' ), - array( 'VYL.K7KUT4]DyLav*~p49OL', '55e66fa9c0b7f691' ), - array( '}%mlP^&R6` D,8pbl%A1~ms', '1d260b7fec06fa81' ), - array( 'vwsg--8Z,=Ixn) A?`BdlZVP', '1ac9ffbeaf2ceff1' ), - array( 'H[qZ[_NRXC;fQSA]qjV`sW#4', 'fcd1a44f1f9644d7' ), - array( '8Ey&!PVJ-H%i)T=bwXII-j( ', '20541ecba873cbbb' ), - array( 'V^`K6d`O+ZU,,,W:U\\$_2BB+', '817f942d64cdf041' ), - array( 'zlU)W])/=j[SP<$[wYh%f@@=', '8a852332f2c99373' ), - array( '}E|0g@<b-qleOuumaQA2nFnf ', 'f817c2a8dc3cac28' ), - array( 'Wlgw-%uR#\':DC}R5j8ea/SDau', 'be35effdcebfb5bc' ), - array( 'VP<E8=}%%u2+le/s S8}&Ni?4', '31a4b812c4ec4d45' ), - array( 'LOhp1_Ga|my;k~Ab2LOw\\Cx1[', '21bc5ceca29e51b8' ), - array( 'w7*aW?/() 9hHzf6u"#uCe(p5', 'de09593ecddfbfad' ), - array( '!MYz^5rv@UO`dWidpS-l:Db=GY', 'ba497ffae361581a' ), - array( 'a-bRCc!|_`3RWS)(5n`~TRSa?n', '7d6da8683f44e043' ), - array( '\'#,O]m\\@A!%B}d$18\\eAdz0Ezd', '964a554b2ea62312' ), - array( 'xOG9>O<K~y:\\;\\]@ [%$l=`S_E', 'a6d30ae05805da81' ), - array( 'OokJUez}~9M;eL6!)Q]fq]Bwa0', '52a0a33924a1e495' ), - array( '5Bdth4eU_;;Z9:tgVZ4m[=@:%3w', '4e3d8a502aad23d1' ), - array( 'H+YYA|>7fR|<39XmSsb;K>P9ymY', 'a30084c8ebfe7959' ), - array( '5sl-<xgv:d5RLhOh{iBi=6MYak*', 'e4a386d2c4782f99' ), - array( '{fxU{lC**=q!XW7+$ Zm|E0gcG5', '19e6ce2e2493a78b' ), - array( '=*"H&iA\\f/!p:>b<v;S"?T].Q#?', '226c52cdff2324cb' ), - array( ':ffP%pSMw=oT$ Uu:sYVkt+m5_KC', '08df2d276c9a057a' ), - array( '2OcL7J}<<Qj4nZisZ?iu4DL 9WmO', 'f02866cab6af3d35' ), - array( '8:sJjWw"#u>@H)T7d>,@^v6r;crU', 'ef8377919e2a1bad' ), - array( '<a&T|y gRxiUo)v83LPwk\\9JTO>o', '99a9a1a21c2ee2ec' ), - array( '31FOsL%pG%Yz}CQnMH\'`tWY`5r+i', '887cd200603d7a11' ), - array( 'BJZV["&PN+Bv1{q0@C~mk\'Oa_*Bt|', 'faad097477f65bd7' ), - array( 'N_@x:wU=}&l*Ic<EVLfyLUfS&H30k', '26a5acae427f26a8' ), - array( '(.:hN4$FiAEp.P:ql`I:GCf|+:$TM', 'bfe197dd01c4279a' ), - array( '4@VB[@qoD8Ze^Ks/ff|G07oT}m`9q', '60dffddf1fd785eb' ), - array( '5g&V>I2_;#$T]j3*^CqF@:WX*-Vxm', '05994a3217bb26d8' ), - array( 'oj#WqZv;lWVp[,OF?Y&cLM%f%]q24j', '151f45373d53bd27' ), - array( '!%U$]H_UcL-;>iGm0gH7KtdP\\i.N|C', '0b91af28a642cac4' ), - array( '9}Io#(8b]|0k8NU`=fIe}t[bF8MUfJ', 'fd58c24dc342b56c' ), - array( 'y ICoML(0+%Av>pM .4Is2?OufhC<O', '199280a86e05b101' ), - array( 'n6O8Z?f\'Hw2N9*m*Wn9k9.~Y^t@G9]', '732c4bf03e824fe5' ), - array( 'v(tFAPf(W0 j^:uMDM<^:Vl90K/PrH/', 'ad49c5c4b29581d8' ), - array( 'jQ$1rTx{-*{xi7n7\\=T;X+(r;T"lHK{', '74f8023eb53a4c87' ), - array( '3|!EpV?lcIi]3!LK]j xC,"6HW85 d2', '45f93db9ecbd61e2' ), - array( '4a4YSjy@NC+,V,Y#jE#dh/f~W?8m?}!', '628239fa1e9fbf4c' ), - array( 'T_5/3 )TOL_\\$l7\'W\\+<E;$ErC^ac\\b', 'c4d6aab371c199b4' ), - array( '8=xGQyP&I}f&"S>*+z6GAQLfDoF\'S#jk', '97ef2b6a27cfe08b' ), - array( '@c3q]dx(b_/e3Mp?H\'gjX4Q}$w%X{pE<', '8a65a0d9c497dca7' ), - array( 'TY/3>(;"hJg{wY<A`$,:8^8=W>vS/<pd', '7d99f135b9dd392a' ), - array( 'u w4)46r^~nWX,x:0%TIdmg<,^o<z`"p', 'a3296f83b9d4178e' ), - array( 'az%k/<^m<NEtZ?0kDd5*R|F_[6|Ww~HZ', '6971ed23982e966c' ), - array( 'yNG)j&w\'U>|1]-|#r3-E0S&lj$Db#m>}<', 'b3fb4982abc0e4c0' ), - array( 'e(\'l!/C?-T|:Q -d.SuaZcM^)1bvOa36i', '031098cfb4e50d1f' ), - array( ';$jKG+X{(sN)"48U+z1oHoxYSo*5$@ ?D', 'd2ee11dc187ad41e' ), - array( 'kjlvDi 89*:MBpY="IfrB@G3J\\7k\\W1HB', 'fee80db84822febc' ), - array( '}@gh@ "K:Pm,*,.Tr"w4I+_\'CKcz]->\\N', '849ddd5ac8830991' ), - array( '&En&G;Aw*M#6\\W*_O?)[~0~Kty)#9eQ?+A', '58f765bdd716e1c2' ), - array( 'FS\\hLf6O}s\')SWH]3Hn3sc.|gGc:go[/C9', '1ef7be10e1e94525' ), - array( 'wo!/@ #H)W R54z$GnhVlP}QkfAGueamVc', 'fb192bd95f5f88b2' ), - array( '|vc!?mX?@mT<r|+\\Sx.RJy9lB/R$})h{ L', '3f2604691e2ced49' ), - array( '|?;U_[D4x81%te}#8I}Q6@ahE_q.[r[Y3v', 'cb8807aabe087372' ), - array( '/rST(Ll:Qb Pf8yej0&LyL-lZi_6Cs.Sga(', '4c6bc9be092660cd' ), - array( 'o/u+aY,2@D-&0>-\\8Yj&5TeLxZZLB=T3MK>', '9207d0b883378aaa' ), - array( '/%JBFoOM n[]\'5H-K}swvORCqpx%>EDNKnp', '34c18ad3e2030b27' ), - array( 'q_A@_0{>82gF]e:V]j*!\\zza:@&hkuZ^U{ ', 'ff47e63839babc22' ), - array( '6,|UD/=jm$&DapOcNJ^0e 7Nl.*Ld&Lz3IP', '8fc04f6e48534104' ), - array( 'WYnCGrJlT<<8jgw{Mx4|eB\'2\'._#A)SybC>+', '444cf38629f9f5e6' ), - array( '6hxk&5$p}|lKu!I\\DQoK_ON!X#{<G:H]#AI*', '93be8d30fbf2a711' ), - array( 'WNzUKh"BjL~/}o[]?+_x.[6Vu^4y ^$X- .Y', '0457576f79c1af9f' ), - array( 'h1{T]{c[k?:+Ky%ZV;1MzEHz$MT1Mbk7sgkR', '60d5a7492fab7ad1' ), - array( 'dP.PpH\\<Cbvz}(HxNqtS?Iem-Q%":qT~CcP4', '0005d93c99685bc1' ), - array( '-.QPpIKoRth!f^U\');t7ly9\'ln\'0RWE_ew1VA', 'e13bf2cdf312dd7b' ), - array( ']FsR0u:oKAxg61U1J\\~9d0l<UL#N]Zo;"dn3[', '53d2c531034cdde3' ), - array( '*#\'K|ob.EsY#rsg$`%Y.((lcx(e]wx9"|ANy1', 'e16aa67d2eb4115b' ), - array( '1)V%bYxVB}8GWFP`34Z<z95tS7qtek\'wt^}X9', '5511e58643ea102a' ), - array( 'w/[uH$NnU0#jj?e$TZWlLMS9UK/4IgNAw+7@0', 'c03ee6776b09be84' ), - array( 'e0eu3PaS7f)r?v?lJYCvhXAP\'bI3ziCaz)X.Z:', '6e63e154ba982b2f' ), - array( 'bq!kd@c%.._R&H+Gy3+CG&.jh)tA8P[zC]g)~K', 'd191830ad78ef4b4' ), - array( '..Zn``7l(2 3VG:e3#o)D(Y!$|_k&^85lr$MT<', '7aa3d56eb663566f' ), - array( ':]O;p&c,lv0\\ UdZVhW6U^umtbax066KsefelK', 'ea574dd4514d7c68' ), - array( 'qYB#6CX{~0dVF;6=)+ j%1"<\\u"D[ooNI3Q`W+', '58f171ded41e0193' ), - array( '\\V;B.b^D gP SV1VrnLu4)f$W18*qo5OGPrU3Qz', '11baf93d39928abd' ), - array( '4:L4n#FEv5rmJ{TOTeg^XXt( EzVYLRmg #V$I{', '0ac0c936f7521a28' ), - array( 'z_nh*k>Y@$B~\\zte{:`St.\'cu\'fL+1I\'q9p{%/V', '1a0c38f41c1826e8' ), - array( 'E4yEpu:WqU8FJGM/=Uvja(4hyMYvSiNx}H>o?YH', '75024234e0476c05' ), - array( '2/`XZ(\'jF\\a1?iF(dtb\\HM+BLTa<t;d\'KF_\'Ogq', 'bdcaffa418ba3eda' ), - array( 'vES(d>Om#EP`n}l1JBsg70M>[t~bDfU;-)DqGt_K', 'bda836f33c0092dc' ), - array( ':1-)0y;Z</CS?pq{eq^+Y4Gf>lYfa:2|K?&\\:B7V', '16e6a228513a03c4' ), - array( 'QZ+qL}m3oM?Ibf1!Tjh6&z4R;;/V]F-0"8#O6pc\'', 'd272ca04df7d0554' ), - array( '?#P"jb$?MlVThj\'%&6[d]it`#w19itA)wr,bU1##', 'c1b2b80d012bdf50' ), - array( '}ZXgE_lLvI1T3\'67 GQi<rs5e!x;2|?1Wwx}WfJN', 'bdd12a4f05766cfe' ), - array( '1\\$Ed;\\dc.O !D6fE/#X,Bic:carJ-B\\jG"Ob^4Fl', '9667031dfb5a16c7' ), - array( 'dGm)^UOmX(zzq_6VB)"PK^;s`jV? },dFzn%Q>s*G', '166ff835024396df' ), - array( 'n&:O=pqGrBsQ^g2J>RJ=_0c[ i->]8eL?!|\\qo$e3', 'bd73d9e41ae5c6d8' ), - array( 'w7q_J<~|g=]w!9wjF7I^}v}~s[pc_VvXnh9:&87mV', '81bed0679537a583' ), - array( 'ueW/^CUul5tc4sXoe<P=4*,}CF$\\^q3TXjd8/;.|P', '823ceb765e67c7a8' ), - array( '#aew:U]W\'{k1(iTOm1/`Dd:0JR@ea>6e {]:R<qZ8^', '3d7194b6e03cc23b' ), - array( 'kAHAq7S"wxf3*1eJvGh.-h+j$^(v9@U&b~GT7zV0s>', '01e47424ff38f337' ), - array( 'C}P)IHP3V]|bI!BQx[rOaUO*+f&bvz!:yQDCzuVRTT', '55e116dfbdeaffb3' ), - array( '5}VWPO4D vzO!&7(h.#jI|=nA8dxj9M 8$XhTm.Td)', '5ccd76496410ea5e' ), - array( '%f0<nxKrcup!d2:J,%cZ&{^^e4Lsi2}nx.,h\'X[kOM', '99b5ca1d7ad80276' ), - array( 'm5`(_l.DG4@\'s\';A{%SytM("60[r|+@jA!s"n"F77g>', '42c09c31678d6f41' ), - array( '+nZLj`!dUNmXe}4Yz@zfb|[dk^+#urB!a|NM^P25 !m', '7c2bc1c66d9f0223' ), - array( 'e~#?zD:a\'8=l${w(qkKsNIC{(s/=t0,Z0/z+T6l\\N+I', '8b024f00082671f5' ), - array( 'S\'B\\y/(n]Q3ZY(jv|{$W,3S8hi&E91ol92I3BR# $6[', 'f90f149aea3b4fff' ), - array( ']?FU<BZtOmHgW3m}M m:9!dMC7QD<h y(GPDj+:;yc#', '216ea9a72de9aadc' ), - array( 'RwqPEr>`,@EZc],)yt*t|QFB<R\\WMA[ 9NQ^Ao?N1e)u', '9a53a5fdb4a3fea9' ), - array( 'C5~>*)4([ZJw-(P[I-[b\\-A}}aM/GV&kl%+w/? jyJc(', '7a9e26e4aeb98fc9' ), - array( 'R5c|B@_~N"}McK\\,#cxpi%hxDhd?3HHf^,c!MD!{F I+', '4f0136432df156d5' ), - array( 'L\'8Oj1@U6)N[r4z\'\\Cm;PR=}v?z>?EIkLa;8s\\m+f=fZ', 'c2587023e1d5b660' ), - array( 'Qaa/&PKV#iTz)P9Huc4CFP\\:-KEth,O;n1JtavKe`!ai', '50683e95eabc367d' ), - array( 'R{2H_Fl\'vIA%tgy^tJyd\\EY><&%}(fgZby#CApJ8:l>0U', 'f16422882c0082cc' ), - array( '9nJci0@/i_LoeJxL2S0-WTNH gbl&rC?bn$L~E[h%)YkS', 'b8c4873ffdaf0fac' ), - array( 'R8f\'Is^}C\'}+jk2^/QA}Vm|{If"SAm\'t\'m{PbZO&bN2M:', '948738b38e532172' ), - array( 'D,JvNIM<GJf.L:P:AEB0Ars|Cy_q-.-Q;XHi"v&IAmXn(', 'afd0b1e73ddced08' ), - array( ')*JNL[p@OmcJNVW]d*y=Sc?JjhlYB\\aKf-z4hkT9Z9d*p', '1dfd3ac789532668' ), - array( '=gUGarzF3F2|4k?qNjX[fmERC_.\\D8Nb!$*cw&*+M=(b*G', 'c7ce7d6de622765c' ), - array( 'TX3.5y{[M?<[|`sKDtPNXHUcT#"\\e,%;e9I{4FWaes>cU2', 'f0fa521206e1c67b' ), - array( '0y(aIa*~F_#H<iUB%;\\N7punS[cq@:%Q4-3]o=]7|`_:J5', 'a38fb64baf6368b4' ), - array( ']PQ: h,uX_R=QrWWDkdWJUu(lsiM/5cme5)e~5\\Wu/uH#M', '885465855ee39187' ), - array( ' G:e d;vm)kWWzm;hSPr:P)v)~\'~G*LHQf.RLJI:S5r,1`', 'de1bd4eebc876571' ), - array( 'Gz5xmPIvGRvNQ>Y~f+fu^4@)Ot>B!P$HK:B:jk13?(bqG<p', '5fce9e2beab28428' ), - array( '/HX%\'lF0<;O_< ceL~(fitx}4"`&I|wYFP_M=&^YA.:^/}E', 'babb5873a7b954a2' ), - array( '[}MCgC<eW>G^hEVCk\'#:E)y K):+89Pt7~8 BTfzs.Y\\T0 ', 'a4dcad2a3d27a8c5' ), - array( '@8#[^-U_Y^ydw45lL5%LXZ3SNB.,v?,8X0t7>Jvw*q\\"\'rn', '5fce337a1b15535d' ), - array( 'S)t aO46}VD*Nd7g=H\\Uf\'M^2?;4F/$y8xzzH/1GfVR5;j}', 'd650a004f4a4a934' ), - array( 'X3Z.yb[Xt{t*C$.>=\'98PHJx0!KF<6DuI~%Dba|X^rb"wp@5', '26f61f52e18a413f' ), - array( 'xYNI#xB4ynZ7& .P 3tbtr;Te}V^nwshRC2V<Uj7DFOKF]{F', '955141b7150fa2c1' ), - array( 'pp)fcE;JCr)3j}{=A/s^d^v*%FUL$QrtC|\\(BwRfk\\yVZvs|', '26761cf7ed795ba8' ), - array( '\'h\\kGSvMzLy~~ltBiQJ-J}s6Znl6ea4lJqYrFPAA};@})5@s', '7e915de5eb615078' ), - array( 'fk"2juHFd6\\Jxq8Ddr7+CYLBul@ #atjMv|8lF^Q]<|V/6zs', '7313e5cd61f71972' ), - array( ')3~MmKoc91c<rX\'AO%Z<K9n)Vl`f#\\Z,oZY^\'JB@[&]O_ep/j', 'b8b744c7e5836f88' ), - array( 'KL7e;A=)"$,^^9O9s.A>QazW@J7&<Gqgs*N0Kk:NoF.O_^iSl', '71567bade5dcc22e' ), - array( '+r?lnv.:/4VW\'?L1m]]Yw,I>;x~ycSgnG\'\\6~jP/ \'f\'G395q', 'b52ab992b89a25eb' ), - array( 'wni%9(@3(:v["e#*B:)-j8-r 5:4OO&G?oLXxll!(c]*Ja4l{', '05178f3f6d1bd723' ), - array( '>zgV)ZW?tknEq6dbb>[P+]Xo<c:}x(z7$bn-=FL33;Y&R>h6]', '2d02887219c5f7ba' ), - array( 'Efi$@Y@$s?||:4!}$/<J[O]w)cKHMa&rIpwiJ8n?Xk<s!>q%M.', '7402cada54c164fc' ), - array( 'P*^."grN1A085Z)-DSF3s~ 0r!Nd\'{sW&Rf);ZWL{hd2Cn?hBf', '7d506df1306b7bd3' ), - array( '|6e|GY~v?\'s3^zeE%"!\\N|F40j#OSE7Q\\|N%VN{vUo*5jpZor\\', '2f6a27e5596405bc' ), - array( 'MBYtVj_Y:4 Qe]O5b\'d_};O)P;y,,mhZ0COf.0AIEB{, KBcS\'', '584088c026129ecb' ), - array( 'CRCr[s/V ;EivU-F=;W_e|"a*".LeaT*5w|pk-HlImW@Ddga!?', '52d26109c3976242' ), - array( 'Bf=DIGGWt.:I8OA6@.ChzmWR.{8v^:7!!TEJ|m#q{=;5l]K.kow', '0664b26c38a5d953' ), - array( 'g]O;lKSc*mz+oPQ;N@>A<[]RI;}W\'mOnL *9K^}VLxb=J4XyTw;', '614bf3c3f15ec6d4' ), - array( 'qTxD}4CV;2\'+^\'5xStv*Apl_<"96W1QIeKnd`3;|EC(%J>~~3u)', '75c7984cbfee5c09' ), - array( 'Ugv5$xN;P`mzF9j,y}HvDk I7>H6Q??((6=-0lH`M7\\tPG!KFIC', '08249b54b4e80e4a' ), - array( 'j6C5Mb^d5~%=\'<[5LH].vtkkF3mrZ86FNZ[|=;bR:gpB$LWQu6`', 'd86b2b1dc38a51fe' ), - array( 'l,LYR_GF;_\\a/8=-VYo*sXz7\\Hn/>%o+1<ed|-+8mhy}!8+Wq{ae', 'de82683d6c863f8e' ), - array( 'T]}2&lADr2P$N6iKDud3^^1`w=9i:{PoYN"`;D%/VV4&m}R3s7FS', '1585883d76b8ad21' ), - array( 'vX4nvNX1J)"%X$etIk$!C8\'27YE+pl_hFtW=C0On:QtrV[g Hk!k', '0fcab3a55bc257eb' ), - array( '%)}<bDHT1(=W|uuA&F1@x&4Oa{P*hRvm[u*?;RtM[3&Y){z0C-Q<', 'f8b622573f260ed6' ), - array( '3ekub=!Kox9LnDl+waXSu^.~[*/~7`<JG(A*EBU6;ob+4O6-2oa(', '9cfe1752ba2120c5' ), - array( 'Oo(+y8+1yG\\AP}KvA"-\\qph\'A 5Tov]@geKa}Wsw Q:PPfHqhVO[H', 'bbfbf47f5e41f626' ), - array( '9ci9x?*o|JXbv:aN/ZO`u!2\\I$E T"Hme3(^R2OO\\(3TCu$SQS4GT', '0fd77de0e48a299e' ), - array( 'G$}LJ~!LHo2[wq/*A^gJr<niAB;tWbJ~fIK1HL]p<pM5b\\?%<(P0E', 'ff59a87c858ded0c' ), - array( '?yfa5[9w&8_Pdqx2OjOA8d$u%*2-ZBSy<:[RvuK}/+Ns|G&M3VnL;', 'c15664e583440709' ), - array( 'sB@}TNXw"R5=/g4%424?`)=)/j<fZh"N,CLar&YtXo3gXGmlY#,:,', 'ed2cece5fae7e40a' ), - array( 'JD;6`"pJ%@VIm9<sr2McE6<l$)G\'6b3`\'OvgRh3X)j"v$>kwP9[vOw', 'af6317fd2ec74937' ), - array( 'cS!+[7nnxu?o^qXqJb\\LZakFY=_54/.xc/%?Gs/@iN1H@j;kNw9)Z%', '176ecfc36ff0fb5e' ), - array( 'O4B0JW@XP$hUC1IRR4"d\\BOw/~pH(KMX`ph,H)ex-OOQ`x%4.\'xkJI', '2e7bda1a61ef9b56' ), - array( 'cYHU#Q"P*bBroj|Uc+%4]f-c{<jt(6?lphBs:DEE(g9wR6N7ASK ;Y', '3d2b93b2479f85fc' ), - array( 'c7vO-~eMkW7.LRSqw\\Z1U.H$EjXqjtLN,C}:Bcg/<~>hQq[JO6[%D$', '62a5e1665612c6c0' ), - array( '*jnc]YX*)eN\' qjh!(g?p:2LdacAf)Fqt6URp.]yt-!t~l] tF@faR4', '547b12c39bb0fdf3' ), - array( 'G4wh{"0mvFCI7R(1G53=4 {5tBV\\%)pL>h6:jF)blM,% 57HJJe_Jau', 'c22639e2811d6816' ), - array( '@%L|*VnWtWm0C49\'"f4\'fI>0tiuU4XKU]xShOB@Ez.U?CnFFUZM=%lM', '37b9a926337766d3' ), - array( 'yVDOk|{BZtuDE9dj4s@S80z^fV-%[zRUQw&>t"`PwWt=pZ)%NJYgZUF', 'cc6ba46fb041513c' ), - array( 'B,TGgOz>"rD@gG"9?Y/]JigP92+!m`H0m|XUMStOF9o/`qH!KX^vBFG', 'a4c997dd620f2ff9' ), - array( '\\YS^H4(Y"&2XSeM#,gs<HeeJ2>**aQR>+&|S;%-=,?v_&Db2-VNV=4!P', 'a07bd8ec425f5a4f' ), - array( 'S+[5\\.Sh4Q=PWKnckeCq+\'%8^Tn|hpM={)RY8\'CMX`}1,luxR:j^Aov!', '84b7e4acb0c0a79a' ), - array( 'Df}.WLKTV~/o&R=^3;p@)f9[!%;Cu2E:yCIRpu\'Ht68ziVZ|qL>z3WW5', 'e0f646c8b28fd049' ), - array( ']rYS&~n!C8S5/[]%rv!\\M[Z@)x<<QtR/h,bo+QpNjEcz!B s:!Qg],)f', '05032e744464292c' ), - array( '&E$W:Vf$cJsn{d>g+#b,Fb!`dSIB_R*ex/=4e%8JO,9LqX4|\\v*#Z+d?', 'd416e24b2f0208f8' ), - array( '^.b?`m&Z|DncI(.y4HG\'"[%^S/b/;GOzU3:7!Ar~eac0iq*~;Q\'=.,|b;', '3927892869e71809' ), - array( '_qW(AR^UmvV/iVtL:&7-06Hb>fqJdTfEG>Miq,?_#vomMe:hkQu|h?_\'\'', '6642fa162be3f787' ), - array( 'RQk\'91OW^9IkX*oOz]}`xfLJ]I3}*;%]mpd\'"5^aN)M(4>X/{Vpu>=@|g', 'bc2d4f3aa4d38015' ), - array( 'Tzro P]q6esKDVzN%#cC[r@3c6R"WOj,K]|K/[=EA2qfil5npy3LlT_Qj', 'f8e6d9128469532b' ), - array( '2SCb?P.|MZ-*xSK,E3u3He$BxQ0N1b9D6]\'U.6S[p`fi52uZElnnRs2LE', '7277ce5e05c03037' ), - array( 'CzW&5{=r$s!;H],*Dv?Wmz}Zim-] Z$DU[KjXh]\\\\_w&>%0b{O;iJ9E5\'S', 'f52c0085314b0fd8' ), - array( 'r(.wMcSxN,a-i?maF,gVnd&+NQDtfLHZUVR#:&|i3_v| e_FqG|`,$k[U1', '69e03fdc5e6ef8b3' ), - array( 'P=^xx4PK8jR6TeuLcu2C<%j9ew>RStd%2D}+YNWr:+)oq~=UtPx1UdK<\\i', 'ad82f3fd37f369cc' ), - array( 'o0^U5qy4|ScUF~`OnRN-)D]"V3g"PDl@ULuk>o <DdrjcS;S\'j`1/>3eR{', 'a0a8ea76841101cb' ), - array( 'h#@VDv#;bB,c_PHR<-\'W`/BA@R`T83P"7pX\\h\\wK~$/_TX2qe:IGIlhi?I', 'cc3c875a245445bb' ), - array( '>X]n[t`4QIqJuqN%Q$^cuD}@kH.U2M Q\']@bS"w&KiPA[~G.$&rzKq<8:Jn', '36b37774404085a2' ), - array( 'Mxn~ M?c!B[\'mFX0#XX1\\_%W,vtD2?4_8#^9P}|RAYZ0!3@$ky6HY<!f3u,', '6953f8802999c26d' ), - array( 'E6@%NDdhtceH%@#5A6VF"P]K+yMq.D}TZ?Z*c?rX#Y"(z%==;sc>EBjP=9C', 'a93c088a44fbfc35' ), - array( 'L]B!9a\\DE{8~ r!)m\'G+C;oaa3M3QfV}Ex _[\\%"Y>!Z1#c *+,MG|0)0^<', '4c23bc673f998d50' ), - array( 'bEs`kmaLI?RKxpMT"P8#[D/)k,:u=x2!?&a,tDX>c+j]|82~iK"Eo2O\\?iR', '68fc83d0d7fbfe26' ), - array( '\\ce]$k@0aei Iuk\'r$:qnet4V(d3GOf%3Lb79$Gzi2{4(g<zkWm[>cotkU)3', '1154a4047a591047' ), - array( '%o88={PV!xQk+M 35=/"t}]3aN(M$2a)"zB?vrvxkHdwvd,-#<0w:n+{=4JB', '4241c775b22008a8' ), - array( 'F-LI(oi b`xO*]H"CT0Fp@>,/J)M^Sp&a>Oi.:iq{bB\'@j)d@9+2ZJ>itG8T', 'd8a203d84a6e0ad0' ), - array( '{)[]G+GVF2HBtjI6USzvm\')HRG2HnK|kTXI|dqS,${Nygx0>M,5;4>cffv/V', '71228d8490cbb004' ), - array( 'B-BwfkuK]IXbF\'\\/!mMNybi/"NuhE&@g3b`yOVF.! pH(MW);&X6iCEkq<U7', 'f772a9177eddfcf8' ), + array( '9', 'af63b44c8601a894' ), + array( 'w', 'af63ea4c86020456' ), + array( 'v', 'af63eb4c86020609' ), + array( 'Q', 'af640c4c86023e1c' ), + array( 'd', 'af63d94c8601e773' ), + array( '"e', '07cc2f07b4942580' ), + array( 'pl', '08d53c07b5755019' ), + array( '@L', '090c3c07b5a49289' ), + array( '"N', '07cc5a07b4946e91' ), + array( '&O', '07bf3907b489ac22' ), + array( 'KE:', '50d8ad19d18c8505' ), + array( '",u', 'd511f317d88f429a' ), + array( 'RX7', 'a0549119ff001600' ), + array( '/<i', 'eea15a17e6ea5bbd' ), + array( 'Otx', '2ffdc919bf72be52' ), + array( 'w/qn', '9c6e50f771dcafd0' ), + array( 'aVqG', '4f1788838c1bcf9e' ), + array( 'G^hs', '33551d7dbbea0209' ), + array( 'a7z1', '4389ab82f4d6a7d0' ), + array( 'c@Lf', 'c14b5591800f1338' ), + array( 'MB:&Y', 'beb09d1ee59646d5' ), + array( 'ICDy9', '4f05ddd19c2c2285' ), + array( '>qH0a', '370b9a8e5a2329eb' ), + array( '*fSR/', 'f78a85007841cb19' ), + array( '3;$tS', '94b935103cc08938' ), + array( ' \'7AS}', 'd81e3aef0fde6ad8' ), + array( 'ou9vPc', '549f05284ed347f7' ), + array( ':u]S4O', '31b0206c95a52e7d' ), + array( '{D2\',e', '3a68240ea9539e62' ), + array( 'Y;yt@n', 'afdae733c98065a2' ), + array( 'IAu`bI_', 'c311eb3e8f9f51c4' ), + array( 'R@xIq]d', '3fa1984555c55e46' ), + array( 'g;8{k5@', '9e9c5e80cdc3d58e' ), + array( '}<Ldvh^', 'e5be53f31a393f34' ), + array( 'k*N6KDw', '558fdadc82fbb9d4' ), + array( '/nWb0Q-"', '84fcc8959c773b75' ), + array( '/qiK+e7@', 'd177962e1def962a' ), + array( '\'5]SzT=Z', 'befb197ea3aac960' ), + array( 'AH)WsNO$', '63dcf1c6c88d5426' ), + array( '=(fNZsPj', '806bfb067d62da41' ), + array( 'f:6q!M3(c', '5125f3e296d40b42' ), + array( 'p\\^Fz:gCC', 'b9ffcd384d90ba98' ), + array( '@7qp<0x#^', '1da17e378a5f0686' ), + array( 'Tw/?^JUQL', '85f6d1938d45b818' ), + array( '#dTfU2F|-', 'b66e4e092e385394' ), + array( '`dP%&hvv%(', '84523fb38ca2975d' ), + array( 'p)fE!vd`B;', '9c94c2a34d9f95c3' ), + array( '2n>vD&MVMJ', '1f4fd77c72b6004b' ), + array( 'd//546~,-$', '159ef268adc718d9' ), + array( '4~.{E/s*p6', '31a60e2db942bc67' ), + array( 'F#&dyJkG!:q', '33b8c68aed55c285' ), + array( 'eI"{^9zjG ', 'b42c013a2028584a' ), + array( 'F/|k>pv/(=3', '671c9537b41d76fe' ), + array( '.#-XoUZ*HAT', '84e0630a952577f4' ), + array( 'K>4d:~-: SI', '57deb72cc24c6bad' ), + array( '|@hn8xvV,%Y:', '157fda2502fe1297' ), + array( '^Jp:T9\\*ez>K', 'f784c17d1a2d1bd2' ), + array( '5>XP>-z<Mc,f', '6084bce050682a8b' ), + array( ']#=j)w&hBv#w', '7a2da4d0b1c01e1e' ), + array( '1_"vZ@Bp_{A}', 'e1e8fb095e4709fd' ), + array( ')<;W!G>^K\\JTT', 'dd737d6771e9cd69' ), + array( 'P>vGAoX"qP]3s', '0375e65060074988' ), + array( 'Nrooqy-.Q.Upm', '135d77993c647f43' ), + array( '"M8W"huy18ij:', 'aedeb2565e1c29f7' ), + array( '\\;wo0Gb!8UzEc', '59ae633a0b17a945' ), + array( 'LS:=B<kZtmDjhU', '2b2e674d9a46a36c' ), + array( '$S@>0\\7 l^cmw:', 'f21c8cb206540a2e' ), + array( 'h=}6q8T4U@nJ/3', 'b258eae8a4671c77' ), + array( '6wi:L*Y\\gp]UPB', 'bff5f2c9ed84bce5' ), + array( 'CH\\-fZDXsxlJ9\\', '298d4e05d5a47c45' ), + array( 'uIp,BZFne!KMr*#', '8641dfc04c9fb552' ), + array( 'CLGl)USdy-Yry$-', '3ab1497c481f22ab' ), + array( 'WyVH\'y#NhhO57B?', '8dea1d032c597f60' ), + array( ';fkbSt8(Z264&09', '4b875649e7cfa1a9' ), + array( '4g3k1:e4iN}9c6[', 'd33acc8fe01b77fd' ), + array( '$QBo4veM @`6UgGn', 'c4b17749dca1aa6a' ), + array( '{0#gA>MV(|TAaj}e', '067ae9cfff2cd6ea' ), + array( '=AVR8< 9]aO3Iw#E', '02bad50d48a8e564' ), + array( '(&-JD[!LYVm<Bl#_', 'ec868a84ae92c032' ), + array( '.Y2Gv3`Tt1h>)kd2', '9f7776edcdaf2937' ), + array( 'qq]6N_c)7REY?H:M"', '1899eee357e747b4' ), + array( 'Mtx`VNVg7uq#Z%uMc', '8eb7e5a4bb9fb739' ), + array( '-{Cp%ZCK5ctO2v}\'p', '58ebf399369565ce' ), + array( '^^@6GW,9[f?Q4#^1G', '76ab1ea61d68a738' ), + array( 'P7#tb9XWhjOgrAGQa', '29294a2d4b758119' ), + array( ']x9i3uPSGeW\'v~W.#L', '508d3356f8ec886b' ), + array( 'p<&I&pxmd:57{r06\\D', '4660b5543de2afdc' ), + array( ',.wTsO[jO4xSajog4u', '6d85fca5fba07683' ), + array( 'Y.c?HyVElg\\J,hY%>N', '01e82905c1f66c8f' ), + array( 'Uy:&/4Yq~IZ4@5B%Tk', 'a05cc808b297050e' ), + array( '~+1lrm8 Wr&uA[p[a!o', '22783c7a8fbe4826' ), + array( '<roeM$\'bG,73+CDx731', 'e00ac9dc3812b301' ), + array( '7j$>aFyS#\\TsxGc_uhf', 'a8cfc6804bc24e1d' ), + array( 'X0rpD~5iwL|*dh/#KU|', '17b538fc3a531c98' ), + array( '~YZSMS{14qzzK,n=PmR', '47a7dd2be021ae55' ), + array( ':f 8pd!!hMWeL1A!^u|p', '4c9d34c81b647804' ), + array( '*ol&<xtZIb-dJ.|<r~=[', '7d8483384e8a46c8' ), + array( 'LuBx\'dzfZwXehEk%>`_h', '25484f299d38dc95' ), + array( 'DmMn{K+oKILw?oqGTl/0', '8ecc9d0f58ead225' ), + array( 'eguN-bTLC55h$cX!0cq[', 'b3e4439d186da97b' ), + array( '.?TN/Fvd4&uznlJ{O~Is5', '983efebee9945885' ), + array( '_\\9C5;Sy-0)LdW[,NAAU7', 'c01a00203768a32c' ), + array( '<D%fATfjH{K&6n;QC6^T?', 'ef488311549372ed' ), + array( '+9wgEG*g}B$BGjd{QPEN{', '2c57de61c289de00' ), + array( 'Kdkg6/~uc>"}7jD^t,\\80', 'f83a6970b348b383' ), + array( ' _{e\\N6#|2Nb~7y/6orUrq', '26006911a7c5d137' ), + array( 'l]6LRC)jS*KPo)~&,{9Z^9', 'd848d0547a41bac1' ), + array( 'rXH)I;^<.KyExMh"9=-em|', 'ad7ca21d760bab1f' ), + array( 'nl$zh>UHWH" RL<1hJ]coV', '87be1c6aab3568a9' ), + array( '2XYKuf1cd Qhz;\'Qc^zf^M', 'fcb5e375b267b232' ), + array( '3z_|F>`6usoP?e8QJ|R{fM7', 'd6cd721ef468a686' ), + array( 'm {Mzc-Iv(*tOIVe@JVpj=*', '5ea4e77a701e1fd9' ), + array( '<g\'ndm=|\\=y*9]7cU@nJp9"', '256fbcae5dc6e749' ), + array( 'VYL.K7KUT4]DyLav*~p49OL', '55e66fa9c0b7f691' ), + array( '}%mlP^&R6` D,8pbl%A1~ms', '1d260b7fec06fa81' ), + array( 'vwsg--8Z,=Ixn) A?`BdlZVP', '1ac9ffbeaf2ceff1' ), + array( 'H[qZ[_NRXC;fQSA]qjV`sW#4', 'fcd1a44f1f9644d7' ), + array( '8Ey&!PVJ-H%i)T=bwXII-j( ', '20541ecba873cbbb' ), + array( 'V^`K6d`O+ZU,,,W:U\\$_2BB+', '817f942d64cdf041' ), + array( 'zlU)W])/=j[SP<$[wYh%f@@=', '8a852332f2c99373' ), + array( '}E|0g@<b-qleOuumaQA2nFnf ', 'f817c2a8dc3cac28' ), + array( 'Wlgw-%uR#\':DC}R5j8ea/SDau', 'be35effdcebfb5bc' ), + array( 'VP<E8=}%%u2+le/s S8}&Ni?4', '31a4b812c4ec4d45' ), + array( 'LOhp1_Ga|my;k~Ab2LOw\\Cx1[', '21bc5ceca29e51b8' ), + array( 'w7*aW?/() 9hHzf6u"#uCe(p5', 'de09593ecddfbfad' ), + array( '!MYz^5rv@UO`dWidpS-l:Db=GY', 'ba497ffae361581a' ), + array( 'a-bRCc!|_`3RWS)(5n`~TRSa?n', '7d6da8683f44e043' ), + array( '\'#,O]m\\@A!%B}d$18\\eAdz0Ezd', '964a554b2ea62312' ), + array( 'xOG9>O<K~y:\\;\\]@ [%$l=`S_E', 'a6d30ae05805da81' ), + array( 'OokJUez}~9M;eL6!)Q]fq]Bwa0', '52a0a33924a1e495' ), + array( '5Bdth4eU_;;Z9:tgVZ4m[=@:%3w', '4e3d8a502aad23d1' ), + array( 'H+YYA|>7fR|<39XmSsb;K>P9ymY', 'a30084c8ebfe7959' ), + array( '5sl-<xgv:d5RLhOh{iBi=6MYak*', 'e4a386d2c4782f99' ), + array( '{fxU{lC**=q!XW7+$ Zm|E0gcG5', '19e6ce2e2493a78b' ), + array( '=*"H&iA\\f/!p:>b<v;S"?T].Q#?', '226c52cdff2324cb' ), + array( ':ffP%pSMw=oT$ Uu:sYVkt+m5_KC', '08df2d276c9a057a' ), + array( '2OcL7J}<<Qj4nZisZ?iu4DL 9WmO', 'f02866cab6af3d35' ), + array( '8:sJjWw"#u>@H)T7d>,@^v6r;crU', 'ef8377919e2a1bad' ), + array( '<a&T|y gRxiUo)v83LPwk\\9JTO>o', '99a9a1a21c2ee2ec' ), + array( '31FOsL%pG%Yz}CQnMH\'`tWY`5r+i', '887cd200603d7a11' ), + array( 'BJZV["&PN+Bv1{q0@C~mk\'Oa_*Bt|', 'faad097477f65bd7' ), + array( 'N_@x:wU=}&l*Ic<EVLfyLUfS&H30k', '26a5acae427f26a8' ), + array( '(.:hN4$FiAEp.P:ql`I:GCf|+:$TM', 'bfe197dd01c4279a' ), + array( '4@VB[@qoD8Ze^Ks/ff|G07oT}m`9q', '60dffddf1fd785eb' ), + array( '5g&V>I2_;#$T]j3*^CqF@:WX*-Vxm', '05994a3217bb26d8' ), + array( 'oj#WqZv;lWVp[,OF?Y&cLM%f%]q24j', '151f45373d53bd27' ), + array( '!%U$]H_UcL-;>iGm0gH7KtdP\\i.N|C', '0b91af28a642cac4' ), + array( '9}Io#(8b]|0k8NU`=fIe}t[bF8MUfJ', 'fd58c24dc342b56c' ), + array( 'y ICoML(0+%Av>pM .4Is2?OufhC<O', '199280a86e05b101' ), + array( 'n6O8Z?f\'Hw2N9*m*Wn9k9.~Y^t@G9]', '732c4bf03e824fe5' ), + array( 'v(tFAPf(W0 j^:uMDM<^:Vl90K/PrH/', 'ad49c5c4b29581d8' ), + array( 'jQ$1rTx{-*{xi7n7\\=T;X+(r;T"lHK{', '74f8023eb53a4c87' ), + array( '3|!EpV?lcIi]3!LK]j xC,"6HW85 d2', '45f93db9ecbd61e2' ), + array( '4a4YSjy@NC+,V,Y#jE#dh/f~W?8m?}!', '628239fa1e9fbf4c' ), + array( 'T_5/3 )TOL_\\$l7\'W\\+<E;$ErC^ac\\b', 'c4d6aab371c199b4' ), + array( '8=xGQyP&I}f&"S>*+z6GAQLfDoF\'S#jk', '97ef2b6a27cfe08b' ), + array( '@c3q]dx(b_/e3Mp?H\'gjX4Q}$w%X{pE<', '8a65a0d9c497dca7' ), + array( 'TY/3>(;"hJg{wY<A`$,:8^8=W>vS/<pd', '7d99f135b9dd392a' ), + array( 'u w4)46r^~nWX,x:0%TIdmg<,^o<z`"p', 'a3296f83b9d4178e' ), + array( 'az%k/<^m<NEtZ?0kDd5*R|F_[6|Ww~HZ', '6971ed23982e966c' ), + array( 'yNG)j&w\'U>|1]-|#r3-E0S&lj$Db#m>}<', 'b3fb4982abc0e4c0' ), + array( 'e(\'l!/C?-T|:Q -d.SuaZcM^)1bvOa36i', '031098cfb4e50d1f' ), + array( ';$jKG+X{(sN)"48U+z1oHoxYSo*5$@ ?D', 'd2ee11dc187ad41e' ), + array( 'kjlvDi 89*:MBpY="IfrB@G3J\\7k\\W1HB', 'fee80db84822febc' ), + array( '}@gh@ "K:Pm,*,.Tr"w4I+_\'CKcz]->\\N', '849ddd5ac8830991' ), + array( '&En&G;Aw*M#6\\W*_O?)[~0~Kty)#9eQ?+A', '58f765bdd716e1c2' ), + array( 'FS\\hLf6O}s\')SWH]3Hn3sc.|gGc:go[/C9', '1ef7be10e1e94525' ), + array( 'wo!/@ #H)W R54z$GnhVlP}QkfAGueamVc', 'fb192bd95f5f88b2' ), + array( '|vc!?mX?@mT<r|+\\Sx.RJy9lB/R$})h{ L', '3f2604691e2ced49' ), + array( '|?;U_[D4x81%te}#8I}Q6@ahE_q.[r[Y3v', 'cb8807aabe087372' ), + array( '/rST(Ll:Qb Pf8yej0&LyL-lZi_6Cs.Sga(', '4c6bc9be092660cd' ), + array( 'o/u+aY,2@D-&0>-\\8Yj&5TeLxZZLB=T3MK>', '9207d0b883378aaa' ), + array( '/%JBFoOM n[]\'5H-K}swvORCqpx%>EDNKnp', '34c18ad3e2030b27' ), + array( 'q_A@_0{>82gF]e:V]j*!\\zza:@&hkuZ^U{ ', 'ff47e63839babc22' ), + array( '6,|UD/=jm$&DapOcNJ^0e 7Nl.*Ld&Lz3IP', '8fc04f6e48534104' ), + array( 'WYnCGrJlT<<8jgw{Mx4|eB\'2\'._#A)SybC>+', '444cf38629f9f5e6' ), + array( '6hxk&5$p}|lKu!I\\DQoK_ON!X#{<G:H]#AI*', '93be8d30fbf2a711' ), + array( 'WNzUKh"BjL~/}o[]?+_x.[6Vu^4y ^$X- .Y', '0457576f79c1af9f' ), + array( 'h1{T]{c[k?:+Ky%ZV;1MzEHz$MT1Mbk7sgkR', '60d5a7492fab7ad1' ), + array( 'dP.PpH\\<Cbvz}(HxNqtS?Iem-Q%":qT~CcP4', '0005d93c99685bc1' ), + array( '-.QPpIKoRth!f^U\');t7ly9\'ln\'0RWE_ew1VA', 'e13bf2cdf312dd7b' ), + array( ']FsR0u:oKAxg61U1J\\~9d0l<UL#N]Zo;"dn3[', '53d2c531034cdde3' ), + array( '*#\'K|ob.EsY#rsg$`%Y.((lcx(e]wx9"|ANy1', 'e16aa67d2eb4115b' ), + array( '1)V%bYxVB}8GWFP`34Z<z95tS7qtek\'wt^}X9', '5511e58643ea102a' ), + array( 'w/[uH$NnU0#jj?e$TZWlLMS9UK/4IgNAw+7@0', 'c03ee6776b09be84' ), + array( 'e0eu3PaS7f)r?v?lJYCvhXAP\'bI3ziCaz)X.Z:', '6e63e154ba982b2f' ), + array( 'bq!kd@c%.._R&H+Gy3+CG&.jh)tA8P[zC]g)~K', 'd191830ad78ef4b4' ), + array( '..Zn``7l(2 3VG:e3#o)D(Y!$|_k&^85lr$MT<', '7aa3d56eb663566f' ), + array( ':]O;p&c,lv0\\ UdZVhW6U^umtbax066KsefelK', 'ea574dd4514d7c68' ), + array( 'qYB#6CX{~0dVF;6=)+ j%1"<\\u"D[ooNI3Q`W+', '58f171ded41e0193' ), + array( '\\V;B.b^D gP SV1VrnLu4)f$W18*qo5OGPrU3Qz', '11baf93d39928abd' ), + array( '4:L4n#FEv5rmJ{TOTeg^XXt( EzVYLRmg #V$I{', '0ac0c936f7521a28' ), + array( 'z_nh*k>Y@$B~\\zte{:`St.\'cu\'fL+1I\'q9p{%/V', '1a0c38f41c1826e8' ), + array( 'E4yEpu:WqU8FJGM/=Uvja(4hyMYvSiNx}H>o?YH', '75024234e0476c05' ), + array( '2/`XZ(\'jF\\a1?iF(dtb\\HM+BLTa<t;d\'KF_\'Ogq', 'bdcaffa418ba3eda' ), + array( 'vES(d>Om#EP`n}l1JBsg70M>[t~bDfU;-)DqGt_K', 'bda836f33c0092dc' ), + array( ':1-)0y;Z</CS?pq{eq^+Y4Gf>lYfa:2|K?&\\:B7V', '16e6a228513a03c4' ), + array( 'QZ+qL}m3oM?Ibf1!Tjh6&z4R;;/V]F-0"8#O6pc\'', 'd272ca04df7d0554' ), + array( '?#P"jb$?MlVThj\'%&6[d]it`#w19itA)wr,bU1##', 'c1b2b80d012bdf50' ), + array( '}ZXgE_lLvI1T3\'67 GQi<rs5e!x;2|?1Wwx}WfJN', 'bdd12a4f05766cfe' ), + array( '1\\$Ed;\\dc.O !D6fE/#X,Bic:carJ-B\\jG"Ob^4Fl', '9667031dfb5a16c7' ), + array( 'dGm)^UOmX(zzq_6VB)"PK^;s`jV? },dFzn%Q>s*G', '166ff835024396df' ), + array( 'n&:O=pqGrBsQ^g2J>RJ=_0c[ i->]8eL?!|\\qo$e3', 'bd73d9e41ae5c6d8' ), + array( 'w7q_J<~|g=]w!9wjF7I^}v}~s[pc_VvXnh9:&87mV', '81bed0679537a583' ), + array( 'ueW/^CUul5tc4sXoe<P=4*,}CF$\\^q3TXjd8/;.|P', '823ceb765e67c7a8' ), + array( '#aew:U]W\'{k1(iTOm1/`Dd:0JR@ea>6e {]:R<qZ8^', '3d7194b6e03cc23b' ), + array( 'kAHAq7S"wxf3*1eJvGh.-h+j$^(v9@U&b~GT7zV0s>', '01e47424ff38f337' ), + array( 'C}P)IHP3V]|bI!BQx[rOaUO*+f&bvz!:yQDCzuVRTT', '55e116dfbdeaffb3' ), + array( '5}VWPO4D vzO!&7(h.#jI|=nA8dxj9M 8$XhTm.Td)', '5ccd76496410ea5e' ), + array( '%f0<nxKrcup!d2:J,%cZ&{^^e4Lsi2}nx.,h\'X[kOM', '99b5ca1d7ad80276' ), + array( 'm5`(_l.DG4@\'s\';A{%SytM("60[r|+@jA!s"n"F77g>', '42c09c31678d6f41' ), + array( '+nZLj`!dUNmXe}4Yz@zfb|[dk^+#urB!a|NM^P25 !m', '7c2bc1c66d9f0223' ), + array( 'e~#?zD:a\'8=l${w(qkKsNIC{(s/=t0,Z0/z+T6l\\N+I', '8b024f00082671f5' ), + array( 'S\'B\\y/(n]Q3ZY(jv|{$W,3S8hi&E91ol92I3BR# $6[', 'f90f149aea3b4fff' ), + array( ']?FU<BZtOmHgW3m}M m:9!dMC7QD<h y(GPDj+:;yc#', '216ea9a72de9aadc' ), + array( 'RwqPEr>`,@EZc],)yt*t|QFB<R\\WMA[ 9NQ^Ao?N1e)u', '9a53a5fdb4a3fea9' ), + array( 'C5~>*)4([ZJw-(P[I-[b\\-A}}aM/GV&kl%+w/? jyJc(', '7a9e26e4aeb98fc9' ), + array( 'R5c|B@_~N"}McK\\,#cxpi%hxDhd?3HHf^,c!MD!{F I+', '4f0136432df156d5' ), + array( 'L\'8Oj1@U6)N[r4z\'\\Cm;PR=}v?z>?EIkLa;8s\\m+f=fZ', 'c2587023e1d5b660' ), + array( 'Qaa/&PKV#iTz)P9Huc4CFP\\:-KEth,O;n1JtavKe`!ai', '50683e95eabc367d' ), + array( 'R{2H_Fl\'vIA%tgy^tJyd\\EY><&%}(fgZby#CApJ8:l>0U', 'f16422882c0082cc' ), + array( '9nJci0@/i_LoeJxL2S0-WTNH gbl&rC?bn$L~E[h%)YkS', 'b8c4873ffdaf0fac' ), + array( 'R8f\'Is^}C\'}+jk2^/QA}Vm|{If"SAm\'t\'m{PbZO&bN2M:', '948738b38e532172' ), + array( 'D,JvNIM<GJf.L:P:AEB0Ars|Cy_q-.-Q;XHi"v&IAmXn(', 'afd0b1e73ddced08' ), + array( ')*JNL[p@OmcJNVW]d*y=Sc?JjhlYB\\aKf-z4hkT9Z9d*p', '1dfd3ac789532668' ), + array( '=gUGarzF3F2|4k?qNjX[fmERC_.\\D8Nb!$*cw&*+M=(b*G', 'c7ce7d6de622765c' ), + array( 'TX3.5y{[M?<[|`sKDtPNXHUcT#"\\e,%;e9I{4FWaes>cU2', 'f0fa521206e1c67b' ), + array( '0y(aIa*~F_#H<iUB%;\\N7punS[cq@:%Q4-3]o=]7|`_:J5', 'a38fb64baf6368b4' ), + array( ']PQ: h,uX_R=QrWWDkdWJUu(lsiM/5cme5)e~5\\Wu/uH#M', '885465855ee39187' ), + array( ' G:e d;vm)kWWzm;hSPr:P)v)~\'~G*LHQf.RLJI:S5r,1`', 'de1bd4eebc876571' ), + array( 'Gz5xmPIvGRvNQ>Y~f+fu^4@)Ot>B!P$HK:B:jk13?(bqG<p', '5fce9e2beab28428' ), + array( '/HX%\'lF0<;O_< ceL~(fitx}4"`&I|wYFP_M=&^YA.:^/}E', 'babb5873a7b954a2' ), + array( '[}MCgC<eW>G^hEVCk\'#:E)y K):+89Pt7~8 BTfzs.Y\\T0 ', 'a4dcad2a3d27a8c5' ), + array( '@8#[^-U_Y^ydw45lL5%LXZ3SNB.,v?,8X0t7>Jvw*q\\"\'rn', '5fce337a1b15535d' ), + array( 'S)t aO46}VD*Nd7g=H\\Uf\'M^2?;4F/$y8xzzH/1GfVR5;j}', 'd650a004f4a4a934' ), + array( 'X3Z.yb[Xt{t*C$.>=\'98PHJx0!KF<6DuI~%Dba|X^rb"wp@5', '26f61f52e18a413f' ), + array( 'xYNI#xB4ynZ7& .P 3tbtr;Te}V^nwshRC2V<Uj7DFOKF]{F', '955141b7150fa2c1' ), + array( 'pp)fcE;JCr)3j}{=A/s^d^v*%FUL$QrtC|\\(BwRfk\\yVZvs|', '26761cf7ed795ba8' ), + array( '\'h\\kGSvMzLy~~ltBiQJ-J}s6Znl6ea4lJqYrFPAA};@})5@s', '7e915de5eb615078' ), + array( 'fk"2juHFd6\\Jxq8Ddr7+CYLBul@ #atjMv|8lF^Q]<|V/6zs', '7313e5cd61f71972' ), + array( ')3~MmKoc91c<rX\'AO%Z<K9n)Vl`f#\\Z,oZY^\'JB@[&]O_ep/j', 'b8b744c7e5836f88' ), + array( 'KL7e;A=)"$,^^9O9s.A>QazW@J7&<Gqgs*N0Kk:NoF.O_^iSl', '71567bade5dcc22e' ), + array( '+r?lnv.:/4VW\'?L1m]]Yw,I>;x~ycSgnG\'\\6~jP/ \'f\'G395q', 'b52ab992b89a25eb' ), + array( 'wni%9(@3(:v["e#*B:)-j8-r 5:4OO&G?oLXxll!(c]*Ja4l{', '05178f3f6d1bd723' ), + array( '>zgV)ZW?tknEq6dbb>[P+]Xo<c:}x(z7$bn-=FL33;Y&R>h6]', '2d02887219c5f7ba' ), + array( 'Efi$@Y@$s?||:4!}$/<J[O]w)cKHMa&rIpwiJ8n?Xk<s!>q%M.', '7402cada54c164fc' ), + array( 'P*^."grN1A085Z)-DSF3s~ 0r!Nd\'{sW&Rf);ZWL{hd2Cn?hBf', '7d506df1306b7bd3' ), + array( '|6e|GY~v?\'s3^zeE%"!\\N|F40j#OSE7Q\\|N%VN{vUo*5jpZor\\', '2f6a27e5596405bc' ), + array( 'MBYtVj_Y:4 Qe]O5b\'d_};O)P;y,,mhZ0COf.0AIEB{, KBcS\'', '584088c026129ecb' ), + array( 'CRCr[s/V ;EivU-F=;W_e|"a*".LeaT*5w|pk-HlImW@Ddga!?', '52d26109c3976242' ), + array( 'Bf=DIGGWt.:I8OA6@.ChzmWR.{8v^:7!!TEJ|m#q{=;5l]K.kow', '0664b26c38a5d953' ), + array( 'g]O;lKSc*mz+oPQ;N@>A<[]RI;}W\'mOnL *9K^}VLxb=J4XyTw;', '614bf3c3f15ec6d4' ), + array( 'qTxD}4CV;2\'+^\'5xStv*Apl_<"96W1QIeKnd`3;|EC(%J>~~3u)', '75c7984cbfee5c09' ), + array( 'Ugv5$xN;P`mzF9j,y}HvDk I7>H6Q??((6=-0lH`M7\\tPG!KFIC', '08249b54b4e80e4a' ), + array( 'j6C5Mb^d5~%=\'<[5LH].vtkkF3mrZ86FNZ[|=;bR:gpB$LWQu6`', 'd86b2b1dc38a51fe' ), + array( 'l,LYR_GF;_\\a/8=-VYo*sXz7\\Hn/>%o+1<ed|-+8mhy}!8+Wq{ae', 'de82683d6c863f8e' ), + array( 'T]}2&lADr2P$N6iKDud3^^1`w=9i:{PoYN"`;D%/VV4&m}R3s7FS', '1585883d76b8ad21' ), + array( 'vX4nvNX1J)"%X$etIk$!C8\'27YE+pl_hFtW=C0On:QtrV[g Hk!k', '0fcab3a55bc257eb' ), + array( '%)}<bDHT1(=W|uuA&F1@x&4Oa{P*hRvm[u*?;RtM[3&Y){z0C-Q<', 'f8b622573f260ed6' ), + array( '3ekub=!Kox9LnDl+waXSu^.~[*/~7`<JG(A*EBU6;ob+4O6-2oa(', '9cfe1752ba2120c5' ), + array( 'Oo(+y8+1yG\\AP}KvA"-\\qph\'A 5Tov]@geKa}Wsw Q:PPfHqhVO[H', 'bbfbf47f5e41f626' ), + array( '9ci9x?*o|JXbv:aN/ZO`u!2\\I$E T"Hme3(^R2OO\\(3TCu$SQS4GT', '0fd77de0e48a299e' ), + array( 'G$}LJ~!LHo2[wq/*A^gJr<niAB;tWbJ~fIK1HL]p<pM5b\\?%<(P0E', 'ff59a87c858ded0c' ), + array( '?yfa5[9w&8_Pdqx2OjOA8d$u%*2-ZBSy<:[RvuK}/+Ns|G&M3VnL;', 'c15664e583440709' ), + array( 'sB@}TNXw"R5=/g4%424?`)=)/j<fZh"N,CLar&YtXo3gXGmlY#,:,', 'ed2cece5fae7e40a' ), + array( 'JD;6`"pJ%@VIm9<sr2McE6<l$)G\'6b3`\'OvgRh3X)j"v$>kwP9[vOw', 'af6317fd2ec74937' ), + array( 'cS!+[7nnxu?o^qXqJb\\LZakFY=_54/.xc/%?Gs/@iN1H@j;kNw9)Z%', '176ecfc36ff0fb5e' ), + array( 'O4B0JW@XP$hUC1IRR4"d\\BOw/~pH(KMX`ph,H)ex-OOQ`x%4.\'xkJI', '2e7bda1a61ef9b56' ), + array( 'cYHU#Q"P*bBroj|Uc+%4]f-c{<jt(6?lphBs:DEE(g9wR6N7ASK ;Y', '3d2b93b2479f85fc' ), + array( 'c7vO-~eMkW7.LRSqw\\Z1U.H$EjXqjtLN,C}:Bcg/<~>hQq[JO6[%D$', '62a5e1665612c6c0' ), + array( '*jnc]YX*)eN\' qjh!(g?p:2LdacAf)Fqt6URp.]yt-!t~l] tF@faR4', '547b12c39bb0fdf3' ), + array( 'G4wh{"0mvFCI7R(1G53=4 {5tBV\\%)pL>h6:jF)blM,% 57HJJe_Jau', 'c22639e2811d6816' ), + array( '@%L|*VnWtWm0C49\'"f4\'fI>0tiuU4XKU]xShOB@Ez.U?CnFFUZM=%lM', '37b9a926337766d3' ), + array( 'yVDOk|{BZtuDE9dj4s@S80z^fV-%[zRUQw&>t"`PwWt=pZ)%NJYgZUF', 'cc6ba46fb041513c' ), + array( 'B,TGgOz>"rD@gG"9?Y/]JigP92+!m`H0m|XUMStOF9o/`qH!KX^vBFG', 'a4c997dd620f2ff9' ), + array( '\\YS^H4(Y"&2XSeM#,gs<HeeJ2>**aQR>+&|S;%-=,?v_&Db2-VNV=4!P', 'a07bd8ec425f5a4f' ), + array( 'S+[5\\.Sh4Q=PWKnckeCq+\'%8^Tn|hpM={)RY8\'CMX`}1,luxR:j^Aov!', '84b7e4acb0c0a79a' ), + array( 'Df}.WLKTV~/o&R=^3;p@)f9[!%;Cu2E:yCIRpu\'Ht68ziVZ|qL>z3WW5', 'e0f646c8b28fd049' ), + array( ']rYS&~n!C8S5/[]%rv!\\M[Z@)x<<QtR/h,bo+QpNjEcz!B s:!Qg],)f', '05032e744464292c' ), + array( '&E$W:Vf$cJsn{d>g+#b,Fb!`dSIB_R*ex/=4e%8JO,9LqX4|\\v*#Z+d?', 'd416e24b2f0208f8' ), + array( '^.b?`m&Z|DncI(.y4HG\'"[%^S/b/;GOzU3:7!Ar~eac0iq*~;Q\'=.,|b;', '3927892869e71809' ), + array( '_qW(AR^UmvV/iVtL:&7-06Hb>fqJdTfEG>Miq,?_#vomMe:hkQu|h?_\'\'', '6642fa162be3f787' ), + array( 'RQk\'91OW^9IkX*oOz]}`xfLJ]I3}*;%]mpd\'"5^aN)M(4>X/{Vpu>=@|g', 'bc2d4f3aa4d38015' ), + array( 'Tzro P]q6esKDVzN%#cC[r@3c6R"WOj,K]|K/[=EA2qfil5npy3LlT_Qj', 'f8e6d9128469532b' ), + array( '2SCb?P.|MZ-*xSK,E3u3He$BxQ0N1b9D6]\'U.6S[p`fi52uZElnnRs2LE', '7277ce5e05c03037' ), + array( 'CzW&5{=r$s!;H],*Dv?Wmz}Zim-] Z$DU[KjXh]\\\\_w&>%0b{O;iJ9E5\'S', 'f52c0085314b0fd8' ), + array( 'r(.wMcSxN,a-i?maF,gVnd&+NQDtfLHZUVR#:&|i3_v| e_FqG|`,$k[U1', '69e03fdc5e6ef8b3' ), + array( 'P=^xx4PK8jR6TeuLcu2C<%j9ew>RStd%2D}+YNWr:+)oq~=UtPx1UdK<\\i', 'ad82f3fd37f369cc' ), + array( 'o0^U5qy4|ScUF~`OnRN-)D]"V3g"PDl@ULuk>o <DdrjcS;S\'j`1/>3eR{', 'a0a8ea76841101cb' ), + array( 'h#@VDv#;bB,c_PHR<-\'W`/BA@R`T83P"7pX\\h\\wK~$/_TX2qe:IGIlhi?I', 'cc3c875a245445bb' ), + array( '>X]n[t`4QIqJuqN%Q$^cuD}@kH.U2M Q\']@bS"w&KiPA[~G.$&rzKq<8:Jn', '36b37774404085a2' ), + array( 'Mxn~ M?c!B[\'mFX0#XX1\\_%W,vtD2?4_8#^9P}|RAYZ0!3@$ky6HY<!f3u,', '6953f8802999c26d' ), + array( 'E6@%NDdhtceH%@#5A6VF"P]K+yMq.D}TZ?Z*c?rX#Y"(z%==;sc>EBjP=9C', 'a93c088a44fbfc35' ), + array( 'L]B!9a\\DE{8~ r!)m\'G+C;oaa3M3QfV}Ex _[\\%"Y>!Z1#c *+,MG|0)0^<', '4c23bc673f998d50' ), + array( 'bEs`kmaLI?RKxpMT"P8#[D/)k,:u=x2!?&a,tDX>c+j]|82~iK"Eo2O\\?iR', '68fc83d0d7fbfe26' ), + array( '\\ce]$k@0aei Iuk\'r$:qnet4V(d3GOf%3Lb79$Gzi2{4(g<zkWm[>cotkU)3', '1154a4047a591047' ), + array( '%o88={PV!xQk+M 35=/"t}]3aN(M$2a)"zB?vrvxkHdwvd,-#<0w:n+{=4JB', '4241c775b22008a8' ), + array( 'F-LI(oi b`xO*]H"CT0Fp@>,/J)M^Sp&a>Oi.:iq{bB\'@j)d@9+2ZJ>itG8T', 'd8a203d84a6e0ad0' ), + array( '{)[]G+GVF2HBtjI6USzvm\')HRG2HnK|kTXI|dqS,${Nygx0>M,5;4>cffv/V', '71228d8490cbb004' ), + array( 'B-BwfkuK]IXbF\'\\/!mMNybi/"NuhE&@g3b`yOVF.! pH(MW);&X6iCEkq<U7', 'f772a9177eddfcf8' ), ); $i = 0; $pass = true; foreach($tests as $test) { - $result = hash('fnv1a64', $test[0]); - if ($result != $test[1]) { - echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n"; - $pass = false; - } - $i++; + $result = hash('fnv1a64', $test[0]); + if ($result != $test[1]) { + echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n"; + $pass = false; + } + $i++; } if($pass) { - echo "PASS"; + echo "PASS"; } ?> --EXPECT-- diff --git a/ext/hash/tests/hash-clone.phpt b/ext/hash/tests/hash-clone.phpt index d5d4205354..0ef0df4449 100644 --- a/ext/hash/tests/hash-clone.phpt +++ b/ext/hash/tests/hash-clone.phpt @@ -6,24 +6,24 @@ Hash: hash_copy() via clone $algos = hash_algos(); foreach ($algos as $algo) { - var_dump($algo); - $orig = hash_init($algo); - hash_update($orig, "I can't remember anything"); - $copy = clone $orig; - var_dump(hash_final($orig)); + var_dump($algo); + $orig = hash_init($algo); + hash_update($orig, "I can't remember anything"); + $copy = clone $orig; + var_dump(hash_final($orig)); - var_dump(hash_final($copy)); + var_dump(hash_final($copy)); } foreach ($algos as $algo) { - var_dump($algo); - $orig = hash_init($algo); - hash_update($orig, "I can't remember anything"); - $copy = clone $orig; - var_dump(hash_final($orig)); + var_dump($algo); + $orig = hash_init($algo); + hash_update($orig, "I can't remember anything"); + $copy = clone $orig; + var_dump(hash_final($orig)); - hash_update($copy, "Can’t tell if this is true or dream"); - var_dump(hash_final($copy)); + hash_update($copy, "Can’t tell if this is true or dream"); + var_dump(hash_final($copy)); } echo "Done\n"; diff --git a/ext/hash/tests/hash_copy_001.phpt b/ext/hash/tests/hash_copy_001.phpt index 8cd620e26d..27993b61b0 100644 --- a/ext/hash/tests/hash_copy_001.phpt +++ b/ext/hash/tests/hash_copy_001.phpt @@ -6,24 +6,24 @@ Hash: hash_copy() basic tests $algos = hash_algos(); foreach ($algos as $algo) { - var_dump($algo); - $orig = hash_init($algo); - hash_update($orig, "I can't remember anything"); - $copy = hash_copy($orig); - var_dump(hash_final($orig)); + var_dump($algo); + $orig = hash_init($algo); + hash_update($orig, "I can't remember anything"); + $copy = hash_copy($orig); + var_dump(hash_final($orig)); - var_dump(hash_final($copy)); + var_dump(hash_final($copy)); } foreach ($algos as $algo) { - var_dump($algo); - $orig = hash_init($algo); - hash_update($orig, "I can't remember anything"); - $copy = hash_copy($orig); - var_dump(hash_final($orig)); + var_dump($algo); + $orig = hash_init($algo); + hash_update($orig, "I can't remember anything"); + $copy = hash_copy($orig); + var_dump(hash_final($orig)); - hash_update($copy, "Can’t tell if this is true or dream"); - var_dump(hash_final($copy)); + hash_update($copy, "Can’t tell if this is true or dream"); + var_dump(hash_final($copy)); } echo "Done\n"; diff --git a/ext/hash/tests/hash_file_basic1.phpt b/ext/hash/tests/hash_file_basic1.phpt index 59db696112..df55cd4837 100644 --- a/ext/hash/tests/hash_file_basic1.phpt +++ b/ext/hash/tests/hash_file_basic1.phpt @@ -14,7 +14,7 @@ echo "*** Testing hash_file() : basic functionality ***\n"; $file = __DIR__ . "hash_file.txt"; /* Creating a temporary file file */ if (($fp = fopen( $file, "w+")) == FALSE) { - echo "Cannot create file ($file)"; + echo "Cannot create file ($file)"; exit; } diff --git a/ext/hash/tests/hash_hkdf_edges.phpt b/ext/hash/tests/hash_hkdf_edges.phpt index debd166cfd..4a69c7c134 100644 --- a/ext/hash/tests/hash_hkdf_edges.phpt +++ b/ext/hash/tests/hash_hkdf_edges.phpt @@ -17,7 +17,7 @@ echo 'Length % digestSize != 0: ', bin2hex(hash_hkdf('md5', $ikm, 17)), "\n"; echo 'Algo name case-sensitivity: ', (bin2hex(hash_hkdf('Md5', $ikm, 7)) === '98b16391063ece' ? 'true' : 'false'), "\n"; echo "Non-crypto algo name case-sensitivity:\n"; -try { +try { var_dump(hash_hkdf('jOaAt', $ikm)); } catch (\Error $e) { diff --git a/ext/hash/tests/hash_hkdf_rfc5869.phpt b/ext/hash/tests/hash_hkdf_rfc5869.phpt index 26a0139f89..63c65f0a7d 100644 --- a/ext/hash/tests/hash_hkdf_rfc5869.phpt +++ b/ext/hash/tests/hash_hkdf_rfc5869.phpt @@ -10,60 +10,60 @@ Hash: hash_hkdf() function: RFC 5869 test vectors echo "*** Testing hash_hkdf(): RFC 5869 test vectors ***\n"; echo "Test case 1 (SHA-256): ", - bin2hex(hash_hkdf( - 'sha256', - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - 42, - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9", - "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c" - )), "\n"; + bin2hex(hash_hkdf( + 'sha256', + "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", + 42, + "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9", + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c" + )), "\n"; echo "Test case 2 (SHA-256 with longer inputs/outputs): ", - bin2hex(hash_hkdf( - 'sha256', - "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f", - 82, - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", - "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" - )), "\n"; + bin2hex(hash_hkdf( + 'sha256', + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f", + 82, + "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", + "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" + )), "\n"; echo "Test case 3 (SHA-256 with zero-length salt, info): ", - bin2hex(hash_hkdf( - 'sha256', - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - 42, - '', - '' - )), "\n"; + bin2hex(hash_hkdf( + 'sha256', + "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", + 42, + '', + '' + )), "\n"; echo "Test case 4 (SHA-1): ", - bin2hex(hash_hkdf( - 'sha1', - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - 42, - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9", - "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c" - )), "\n"; + bin2hex(hash_hkdf( + 'sha1', + "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", + 42, + "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9", + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c" + )), "\n"; echo "Test case 5 (SHA-1 with longer inputs/outputs): ", - bin2hex(hash_hkdf( - 'sha1', - "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f", - 82, - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", - "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" - )), "\n"; + bin2hex(hash_hkdf( + 'sha1', + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f", + 82, + "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", + "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" + )), "\n"; echo "Test case 6 (SHA-1 with zero-length salt, info): ", - bin2hex(hash_hkdf( - 'sha1', - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - 42, - '', - '' - )), "\n"; + bin2hex(hash_hkdf( + 'sha1', + "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", + 42, + '', + '' + )), "\n"; echo "Test case 7 (SHA-1 with zero-length info, salt not provided): ", - bin2hex(hash_hkdf( - 'sha1', - "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c", - 42, - '' - )), "\n"; + bin2hex(hash_hkdf( + 'sha1', + "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c", + 42, + '' + )), "\n"; ?> --EXPECT-- *** Testing hash_hkdf(): RFC 5869 test vectors *** diff --git a/ext/hash/tests/hash_hmac_error.phpt b/ext/hash/tests/hash_hmac_error.phpt index cadbf23d1a..3b14243fb2 100644 --- a/ext/hash/tests/hash_hmac_error.phpt +++ b/ext/hash/tests/hash_hmac_error.phpt @@ -21,7 +21,7 @@ catch (\Error $e) { } echo "\n-- Testing hash_hmac() function with non-cryptographic hash algorithm --\n"; -try { +try { var_dump(hash_hmac('crc32', $data, $key)); } catch (\Error $e) { diff --git a/ext/hash/tests/hash_hmac_file_basic.phpt b/ext/hash/tests/hash_hmac_file_basic.phpt index 32bc95fdbc..4569c46c35 100644 --- a/ext/hash/tests/hash_hmac_file_basic.phpt +++ b/ext/hash/tests/hash_hmac_file_basic.phpt @@ -15,7 +15,7 @@ echo "*** Testing hash_hmac_file() : basic functionality ***\n"; $file = __DIR__ . "hash_hmac_file.txt"; /* Creating a temporary file file */ if (($fp = fopen( $file, "w+")) == FALSE) { - echo "Cannot create file ($file)"; + echo "Cannot create file ($file)"; exit; } diff --git a/ext/hash/tests/hash_hmac_file_error.phpt b/ext/hash/tests/hash_hmac_file_error.phpt index 5207b74d9d..f23d335699 100644 --- a/ext/hash/tests/hash_hmac_file_error.phpt +++ b/ext/hash/tests/hash_hmac_file_error.phpt @@ -15,7 +15,7 @@ $file = __DIR__ . "hash_file.txt"; $key = 'secret'; echo "\n-- Testing hash_hmac_file() function with invalid hash algorithm --\n"; -try { +try { var_dump(hash_hmac_file('foo', $file, $key, TRUE)); } catch (\Error $e) { diff --git a/ext/hash/tests/hash_init_error.phpt b/ext/hash/tests/hash_init_error.phpt index a68a8fc088..f9d0362dd2 100644 --- a/ext/hash/tests/hash_init_error.phpt +++ b/ext/hash/tests/hash_init_error.phpt @@ -21,14 +21,14 @@ catch (\Error $e) { } echo "\n-- Testing hash_init() function with HASH_HMAC and no key --\n"; -try { +try { var_dump(hash_init('md5', HASH_HMAC)); } catch (\Error $e) { echo $e->getMessage() . "\n"; } -try { +try { var_dump(hash_init('md5', HASH_HMAC, null)); } catch (\Error $e) { diff --git a/ext/hash/tests/hash_pbkdf2_error.phpt b/ext/hash/tests/hash_pbkdf2_error.phpt index 02d48f1ac6..795dea1ce3 100644 --- a/ext/hash/tests/hash_pbkdf2_error.phpt +++ b/ext/hash/tests/hash_pbkdf2_error.phpt @@ -13,7 +13,7 @@ $password = 'password'; $salt = 'salt'; echo "\n-- Testing hash_pbkdf2() function with invalid hash algorithm --\n"; -try { +try { var_dump(hash_pbkdf2('foo', $password, $salt, 1)); } catch (\Error $e) { @@ -22,7 +22,7 @@ catch (\Error $e) { echo "\n-- Testing hash_pbkdf2() function with non-cryptographic hash algorithm --\n"; -try { +try { var_dump(hash_pbkdf2('crc32', $password, $salt, 1)); } catch (\Error $e) { @@ -30,14 +30,14 @@ catch (\Error $e) { } echo "\n-- Testing hash_pbkdf2() function with invalid iterations --\n"; -try { +try { var_dump(hash_pbkdf2('md5', $password, $salt, 0)); } catch (\Error $e) { echo $e->getMessage() . "\n"; } -try { +try { var_dump(hash_pbkdf2('md5', $password, $salt, -1)); } catch (\Error $e) { @@ -45,7 +45,7 @@ catch (\Error $e) { } echo "\n-- Testing hash_pbkdf2() function with invalid length --\n"; -try { +try { var_dump(hash_pbkdf2('md5', $password, $salt, 1, -1)); } catch (\Error $e) { diff --git a/ext/hash/tests/haval.phpt b/ext/hash/tests/haval.phpt index b01abdb8ef..514fc7c97b 100644 --- a/ext/hash/tests/haval.phpt +++ b/ext/hash/tests/haval.phpt @@ -4,24 +4,24 @@ Hash: haval algorithm (multi-vector, multi-pass, multi-width) <?php echo "Empty String\n"; for($pass=3; $pass<=5; $pass++) - for($bits=128; $bits <= 256; $bits += 32) { - $algo = sprintf('haval%d,%d',$bits,$pass); - echo $algo . ': ' . hash($algo,'') . "\n"; - } + for($bits=128; $bits <= 256; $bits += 32) { + $algo = sprintf('haval%d,%d',$bits,$pass); + echo $algo . ': ' . hash($algo,'') . "\n"; + } echo "\"abc\"\n"; for($pass=3; $pass<=5; $pass++) - for($bits=128; $bits <= 256; $bits += 32) { - $algo = sprintf('haval%d,%d',$bits,$pass); - echo $algo . ': ' . hash($algo,'abc') . "\n"; - } + for($bits=128; $bits <= 256; $bits += 32) { + $algo = sprintf('haval%d,%d',$bits,$pass); + echo $algo . ': ' . hash($algo,'abc') . "\n"; + } echo "\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789\"\n"; for($pass=3; $pass<=5; $pass++) - for($bits=128; $bits <= 256; $bits += 32) { - $algo = sprintf('haval%d,%d',$bits,$pass); - echo $algo . ': ' . hash($algo,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789') . "\n"; - } + for($bits=128; $bits <= 256; $bits += 32) { + $algo = sprintf('haval%d,%d',$bits,$pass); + echo $algo . ': ' . hash($algo,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789') . "\n"; + } --EXPECT-- Empty String haval128,3: c68f39913f901f3ddf44c707357a7d70 diff --git a/ext/hash/tests/joaat.phpt b/ext/hash/tests/joaat.phpt index 819b598851..b066b37bb1 100644 --- a/ext/hash/tests/joaat.phpt +++ b/ext/hash/tests/joaat.phpt @@ -3,25 +3,25 @@ Hash: Jenkins's one-at-a-time --FILE-- <?php $tests = array( - array("hello world", "3e4a5a57"), - array("", 0), - array("", "000000"), - array("a", "ca2e9442"), - array("aa", "7081738e"), + array("hello world", "3e4a5a57"), + array("", 0), + array("", "000000"), + array("a", "ca2e9442"), + array("aa", "7081738e"), ); $i = 0; $pass = true; foreach ($tests as $test) { - ++$i; + ++$i; - $result = hash("joaat", $test[0]); - if ($result != $test[1]) { - echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n"; + $result = hash("joaat", $test[0]); + if ($result != $test[1]) { + echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n"; - $pass = false; - } + $pass = false; + } } if($pass) { diff --git a/ext/hash/tests/mhash_001.phpt b/ext/hash/tests/mhash_001.phpt index 71d6d20df6..b61bab6494 100644 --- a/ext/hash/tests/mhash_001.phpt +++ b/ext/hash/tests/mhash_001.phpt @@ -22,16 +22,16 @@ $supported_hash_al = array( $data = "This is the test of the mhash extension..."; foreach ($supported_hash_al as $hash=>$wanted) { - $result = mhash(constant($hash), $data); - if (bin2hex($result)==$wanted) { - echo "$hash\nok\n"; - } else { - echo "$hash: "; - var_dump($wanted); - echo "$hash: "; - var_dump(bin2hex($result)); - } - echo "\n"; + $result = mhash(constant($hash), $data); + if (bin2hex($result)==$wanted) { + echo "$hash\nok\n"; + } else { + echo "$hash: "; + var_dump($wanted); + echo "$hash: "; + var_dump(bin2hex($result)); + } + echo "\n"; } ?> --EXPECT-- diff --git a/ext/hash/tests/mhash_002.phpt b/ext/hash/tests/mhash_002.phpt index 2318470919..fdf886a71e 100644 --- a/ext/hash/tests/mhash_002.phpt +++ b/ext/hash/tests/mhash_002.phpt @@ -29,16 +29,16 @@ $hc = mhash_count() + 1; $known_hash_al = array(); for ($i=0; $i < $hc; $i++) { - $known_hash_al[mhash_get_hash_name($i)] = $i; + $known_hash_al[mhash_get_hash_name($i)] = $i; } foreach ($supported_hash_al as $name => $len) { - if (array_key_exists($name, $known_hash_al)) { - $len = mhash_get_block_size($known_hash_al[$name]); - echo "$name = $len\n"; - } else { - echo "$name ? $len\n"; - } + if (array_key_exists($name, $known_hash_al)) { + $len = mhash_get_block_size($known_hash_al[$name]); + echo "$name = $len\n"; + } else { + echo "$name ? $len\n"; + } } ?> --EXPECTREGEX-- diff --git a/ext/hash/tests/mhash_003.phpt b/ext/hash/tests/mhash_003.phpt index a4d43eb8d5..99436b9ece 100644 --- a/ext/hash/tests/mhash_003.phpt +++ b/ext/hash/tests/mhash_003.phpt @@ -20,18 +20,18 @@ $supported_hash_al = array( ); foreach ($supported_hash_al as $hash=>$wanted) { - $passwd = str_repeat($hash, 10); - $salt = str_repeat($hash, 2); - $result = mhash_keygen_s2k(constant($hash), $passwd, $salt, 100); - if (!strcmp(bin2hex($result), $wanted)) { - echo "$hash\nok\n"; - } else { - echo "$hash: "; - var_dump($wanted); - echo "$hash: "; - var_dump(bin2hex($result)); - } - echo "\n"; + $passwd = str_repeat($hash, 10); + $salt = str_repeat($hash, 2); + $result = mhash_keygen_s2k(constant($hash), $passwd, $salt, 100); + if (!strcmp(bin2hex($result), $wanted)) { + echo "$hash\nok\n"; + } else { + echo "$hash: "; + var_dump($wanted); + echo "$hash: "; + var_dump(bin2hex($result)); + } + echo "\n"; } ?> --EXPECT-- diff --git a/ext/hash/tests/reuse.phpt b/ext/hash/tests/reuse.phpt index 54ef56f08f..78df4b41af 100644 --- a/ext/hash/tests/reuse.phpt +++ b/ext/hash/tests/reuse.phpt @@ -5,7 +5,7 @@ Hash: Attempt to reuse a closed hash context $h = hash_init('md5'); hash_final($h); -try { +try { hash_update($h, 'foo'); } catch (\Error $e) { diff --git a/ext/iconv/tests/bug37773.phpt b/ext/iconv/tests/bug37773.phpt index f9a1d3470e..e2fb6a55e6 100644 --- a/ext/iconv/tests/bug37773.phpt +++ b/ext/iconv/tests/bug37773.phpt @@ -12,7 +12,7 @@ if ($test === false) { ?> --FILE-- <?php - var_dump(iconv_substr('x', 0, 1, 'UTF-8')); + var_dump(iconv_substr('x', 0, 1, 'UTF-8')); ?> --EXPECT-- string(1) "x" diff --git a/ext/iconv/tests/bug63839.phpt b/ext/iconv/tests/bug63839.phpt index 99d1a20cc6..e137a0cb4b 100644 --- a/ext/iconv/tests/bug63839.phpt +++ b/ext/iconv/tests/bug63839.phpt @@ -13,7 +13,7 @@ Date: Sat, 22 Dec 2012 Message-ID: <006f01cde00e$d9f79da0$8de6d8e0> MIME-Version: 1.0 Content-Type: multipart/alternative; - boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0" + boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac3gDtcH2huHjzYcQVmFJPPoWjJogA== Content-Language: en-us diff --git a/ext/iconv/tests/bug76249.phpt b/ext/iconv/tests/bug76249.phpt index 25bbf2a41f..9d8a0f3e9f 100644 --- a/ext/iconv/tests/bug76249.phpt +++ b/ext/iconv/tests/bug76249.phpt @@ -8,7 +8,7 @@ $fh = fopen('php://memory', 'rw'); fwrite($fh, "abc"); rewind($fh); if (false === @stream_filter_append($fh, 'convert.iconv.ucs-2/utf8//IGNORE', STREAM_FILTER_READ, [])) { - stream_filter_append($fh, 'convert.iconv.ucs-2/utf-8//IGNORE', STREAM_FILTER_READ, []); + stream_filter_append($fh, 'convert.iconv.ucs-2/utf-8//IGNORE', STREAM_FILTER_READ, []); } var_dump(stream_get_contents($fh)); ?> diff --git a/ext/iconv/tests/eucjp2iso2022jp.phpt b/ext/iconv/tests/eucjp2iso2022jp.phpt index 6700ac9197..aacdc238c6 100644 --- a/ext/iconv/tests/eucjp2iso2022jp.phpt +++ b/ext/iconv/tests/eucjp2iso2022jp.phpt @@ -9,11 +9,11 @@ error_reporting=2039 /* charset=EUC-JP */ function hexdump($str) { - $len = strlen($str); - for ($i = 0; $i < $len; ++$i) { - printf("%02x", ord($str{$i})); - } - print "\n"; + $len = strlen($str); + for ($i = 0; $i < $len; ++$i) { + printf("%02x", ord($str{$i})); + } + print "\n"; } $str = str_repeat("ÆüËÜ¸ì¥Æ¥¥¹¥È¤È English text", 30); diff --git a/ext/iconv/tests/iconv003.phpt b/ext/iconv/tests/iconv003.phpt index 690c1569f9..94ed39f3f6 100644 --- a/ext/iconv/tests/iconv003.phpt +++ b/ext/iconv/tests/iconv003.phpt @@ -5,9 +5,9 @@ iconv() test 3 --FILE-- <?php for ($i = 0; $i < 3; ++$i) { - if (@iconv('blah', 'blah', 'blah') != '') { - die("failed\n"); - } + if (@iconv('blah', 'blah', 'blah') != '') { + die("failed\n"); + } } echo "success\n"; ?> diff --git a/ext/iconv/tests/iconv_default_charset.phpt b/ext/iconv/tests/iconv_default_charset.phpt index 4b44c1266e..e0874820b2 100644 --- a/ext/iconv/tests/iconv_default_charset.phpt +++ b/ext/iconv/tests/iconv_default_charset.phpt @@ -20,34 +20,34 @@ echo "*** Testing default_charset handling ***\n"; echo "--- Get php.ini values ---\n"; var_dump(ini_get('default_charset'), - ini_get('internal_encoding'), - ini_get('input_encoding'), - ini_get('output_encoding'), - ini_get('iconv.internal_encoding'), - ini_get('iconv.input_encoding'), - ini_get('iconv.output_encoding')); + ini_get('internal_encoding'), + ini_get('input_encoding'), + ini_get('output_encoding'), + ini_get('iconv.internal_encoding'), + ini_get('iconv.input_encoding'), + ini_get('iconv.output_encoding')); echo "\n--- Altering encodings ---\n"; var_dump(ini_set('default_charset', 'ISO-8859-1')); echo "\n--- results of alterations ---\n"; var_dump(ini_get('default_charset'), - ini_get('internal_encoding'), - ini_get('input_encoding'), - ini_get('output_encoding'), - ini_get('iconv.internal_encoding'), - ini_get('iconv.input_encoding'), - ini_get('iconv.output_encoding')); + ini_get('internal_encoding'), + ini_get('input_encoding'), + ini_get('output_encoding'), + ini_get('iconv.internal_encoding'), + ini_get('iconv.input_encoding'), + ini_get('iconv.output_encoding')); /* echo "\n--- Altering encodings ---\n"; var_dump(ini_set('default_charset', 'ISO-8859-1'), - ini_set('internal_encoding'), - ini_set('input_encoding'), - ini_set('output_encoding'), - ini_set('iconv.internal_encoding'), - ini_set('iconv.input_encoding'), - ini_set('iconv.output_encoding')); + ini_set('internal_encoding'), + ini_set('input_encoding'), + ini_set('output_encoding'), + ini_set('iconv.internal_encoding'), + ini_set('iconv.input_encoding'), + ini_set('iconv.output_encoding')); */ echo "Done"; diff --git a/ext/iconv/tests/iconv_mime_decode.phpt b/ext/iconv/tests/iconv_mime_decode.phpt index b5dee827df..35144b5707 100644 --- a/ext/iconv/tests/iconv_mime_decode.phpt +++ b/ext/iconv/tests/iconv_mime_decode.phpt @@ -8,39 +8,39 @@ iconv.internal_charset=iso-8859-1 <?php function my_error_handler($errno, $errmsg, $filename, $linenum) { - echo "$errno: $errmsg\n"; + echo "$errno: $errmsg\n"; } set_error_handler('my_error_handler'); function do_single_test($header) { - global $mode; + global $mode; - $result = iconv_mime_decode($header, $mode, "UTF-8"); - printf("(%d) \"%s\"\n", iconv_strlen($result, "UTF-8"), $result); + $result = iconv_mime_decode($header, $mode, "UTF-8"); + printf("(%d) \"%s\"\n", iconv_strlen($result, "UTF-8"), $result); } function do_regression_test() { - do_single_test(<<< HERE + do_single_test(<<< HERE Subject: =?ISO-8859-1?Q?Pr=FCfung?= - =?ISO-8859-1*de_DE?Q?Pr=FCfung?=\t - =?ISO-8859-2?Q?k=F9=D4=F1=D3let?= + =?ISO-8859-1*de_DE?Q?Pr=FCfung?=\t + =?ISO-8859-2?Q?k=F9=D4=F1=D3let?= HERE ); - do_single_test(<<< HERE + do_single_test(<<< HERE Subject: =?ISO-8859-1?Q?Pr=FCfung?= =?ISO-8859-1*de_DE?Q?=20Pr=FCfung?= \t =?ISO-8859-2?Q?k=F9=D4=F1=D3let?= HERE ); - do_single_test(<<< HERE + do_single_test(<<< HERE Subject: =?ISO-8859-1?Q?Pr=FCfung?==?ISO-8859-1*de_DE?Q?Pr=FCfung?==?ISO-8859-2?Q?k=F9=D4=F1=D3let?= HERE ); - do_single_test(<<< HERE + do_single_test(<<< HERE Subject: =?ISO-8859-1?Q?Pr=FCfung?= =?ISO-8859-1*de_DE?Q?Pr=FCfung?? =?ISO-8859-2?X?k=F9=D4=F1=D3let?= HERE ); - do_single_test(<<< HERE + do_single_test(<<< HERE From: =?ISO-2022-JP?B?GyRCJTUbKEI=?= =?ISO-2022-JP?B?GyRCJXMlVxsoQg==?= =?ISO-2022-JP?B?GyRCJWtKOBsoQg==?= diff --git a/ext/iconv/tests/iconv_mime_decode_headers.phpt b/ext/iconv/tests/iconv_mime_decode_headers.phpt index 6a16009ca3..0c418e559d 100644 --- a/ext/iconv/tests/iconv_mime_decode_headers.phpt +++ b/ext/iconv/tests/iconv_mime_decode_headers.phpt @@ -8,7 +8,7 @@ iconv.internal_charset=iso-8859-1 <?php $headers = <<<HERE Return-Path: <internals-return-5651-***=***.example.com@lists.php.net> -Received: from pb1.pair.com (pb1.pair.com [16.92.131.4]) by ***.example.com +Received: from pb1.pair.com (pb1.pair.com [16.92.131.4]) by ***.example.com (8.12.10/8.12.10/1970-09-30) with SMTP id hALLmpea023899 for <***@***.example.com>; Sat, 22 Jan 1970 06:48:51 +0900 (JST) (envelope-from @@ -25,7 +25,7 @@ Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Date: Thu, 1 Jan 1970 00:00:00 -0000 (GMT) From: *** *** *** <***@***.example.com> -X-X-Sender: ***@***.example.com +X-X-Sender: ***@***.example.com To: internals@lists.php.net Message-Id: <Pine.LNX.4.58.************@***.example.com> MIME-Version: 1.0 diff --git a/ext/iconv/tests/iconv_mime_encode.phpt b/ext/iconv/tests/iconv_mime_encode.phpt index e4be799915..6f4ba1c7a9 100644 --- a/ext/iconv/tests/iconv_mime_encode.phpt +++ b/ext/iconv/tests/iconv_mime_encode.phpt @@ -8,27 +8,27 @@ iconv.internal_charset=iso-8859-1 <?php function my_error_handler($errno, $errmsg, $filename, $linenum) { - echo "$errno: $errmsg\n"; + echo "$errno: $errmsg\n"; } set_error_handler('my_error_handler'); $preference = array( - "scheme" => "B", - "output-charset" => "ISO-2022-JP", - "input-charset" => "EUC-JP", - "line-break-chars" => "\n" + "scheme" => "B", + "output-charset" => "ISO-2022-JP", + "input-charset" => "EUC-JP", + "line-break-chars" => "\n" ); for ($line_len= 0; $line_len < 80; ++$line_len) { - print "-------- line length=$line_len\n"; - $preference["line-length"] = $line_len; - $result = iconv_mime_encode("From", "¥µ¥ó¥×¥ëʸ»úÎó¥µ¥ó¥×¥ëʸ»úÎóÆüËÜ¸ì¥Æ¥¥¹¥È", $preference); - var_dump($result); - if ($result !== false) { + print "-------- line length=$line_len\n"; + $preference["line-length"] = $line_len; + $result = iconv_mime_encode("From", "¥µ¥ó¥×¥ëʸ»úÎó¥µ¥ó¥×¥ëʸ»úÎóÆüËÜ¸ì¥Æ¥¥¹¥È", $preference); + var_dump($result); + if ($result !== false) { $max = max(array_map("strlen", explode("\n", $result))); - print "-------- "; - var_dump(($max <= $line_len)); - } else { - print "-------- \n"; - } + print "-------- "; + var_dump(($max <= $line_len)); + } else { + print "-------- \n"; + } } ?> --EXPECTF-- diff --git a/ext/iconv/tests/iconv_strlen.phpt b/ext/iconv/tests/iconv_strlen.phpt index 2c815f4f31..7984798f57 100644 --- a/ext/iconv/tests/iconv_strlen.phpt +++ b/ext/iconv/tests/iconv_strlen.phpt @@ -5,8 +5,8 @@ iconv_strlen() --FILE-- <?php function foo($str, $charset) { - var_dump(strlen($str)); - var_dump(iconv_strlen($str, $charset)); + var_dump(strlen($str)); + var_dump(iconv_strlen($str, $charset)); } foo("abc", "ASCII"); diff --git a/ext/iconv/tests/iconv_strpos.phpt b/ext/iconv/tests/iconv_strpos.phpt index 9a1e5a77b6..860ecfc471 100644 --- a/ext/iconv/tests/iconv_strpos.phpt +++ b/ext/iconv/tests/iconv_strpos.phpt @@ -8,19 +8,19 @@ iconv.internal_charset=ISO-8859-1 <?php function foo($haystk, $needle, $offset, $to_charset = false, $from_charset = false) { - if ($from_charset !== false) { - $haystk = iconv($from_charset, $to_charset, $haystk); - } - try { - var_dump(strpos($haystk, $needle, $offset)); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; - } - if ($to_charset !== false) { - var_dump(iconv_strpos($haystk, $needle, $offset, $to_charset)); - } else { - var_dump(iconv_strpos($haystk, $needle, $offset)); - } + if ($from_charset !== false) { + $haystk = iconv($from_charset, $to_charset, $haystk); + } + try { + var_dump(strpos($haystk, $needle, $offset)); + } catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; + } + if ($to_charset !== false) { + var_dump(iconv_strpos($haystk, $needle, $offset, $to_charset)); + } else { + var_dump(iconv_strpos($haystk, $needle, $offset)); + } } foo("abecdbcdabef", "bcd", -1); foo("abecdbcdabef", "bcd", -7); diff --git a/ext/iconv/tests/iconv_strpos_variation5.phpt b/ext/iconv/tests/iconv_strpos_variation5.phpt index 1daedd146d..f89307b03a 100644 --- a/ext/iconv/tests/iconv_strpos_variation5.phpt +++ b/ext/iconv/tests/iconv_strpos_variation5.phpt @@ -35,11 +35,11 @@ $needle_mb = base64_decode('44CC'); * 60 is larger than *BYTE* count for $string_mb */ for ($i = -30; $i <= 60; $i += 10) { - echo "\n**-- Offset is: $i --**\n"; - echo "-- ASCII String --\n"; - var_dump(iconv_strpos($string_ascii, $needle_ascii, $i)); - echo "--Multibyte String --\n"; - var_dump(iconv_strpos($string_mb, $needle_mb, $i, 'UTF-8')); + echo "\n**-- Offset is: $i --**\n"; + echo "-- ASCII String --\n"; + var_dump(iconv_strpos($string_ascii, $needle_ascii, $i)); + echo "--Multibyte String --\n"; + var_dump(iconv_strpos($string_mb, $needle_mb, $i, 'UTF-8')); } echo "Done"; diff --git a/ext/iconv/tests/iconv_strrpos.phpt b/ext/iconv/tests/iconv_strrpos.phpt index 76b8323d89..1e5b5fb960 100644 --- a/ext/iconv/tests/iconv_strrpos.phpt +++ b/ext/iconv/tests/iconv_strrpos.phpt @@ -8,29 +8,29 @@ iconv.internal_charset=ISO-8859-1 <?php function my_error_handler($errno, $errmsg, $filename, $linenum) { - echo "$errno: $errmsg\n"; + echo "$errno: $errmsg\n"; } set_error_handler('my_error_handler'); function foo($haystk, $needle, $to_charset = false, $from_charset = false) { - if ($from_charset !== false) { - $haystk = iconv($from_charset, $to_charset, $haystk); - } - if ($to_charset !== false) { - var_dump(iconv_strlen($haystk, $to_charset)); - var_dump(iconv_strrpos($haystk, $needle, $to_charset)); - } else { - var_dump(iconv_strlen($haystk)); - var_dump(iconv_strrpos($haystk, $needle)); - } + if ($from_charset !== false) { + $haystk = iconv($from_charset, $to_charset, $haystk); + } + if ($to_charset !== false) { + var_dump(iconv_strlen($haystk, $to_charset)); + var_dump(iconv_strrpos($haystk, $needle, $to_charset)); + } else { + var_dump(iconv_strlen($haystk)); + var_dump(iconv_strrpos($haystk, $needle)); + } } foo("abecdbcdabcdef", "bcd"); foo(str_repeat("abcab", 60)."abcdb".str_repeat("adabc", 60), "abcd"); foo(str_repeat("¤¢¤¤¤¦¤¨¤ª", 30)."¤¤¤¦¤ª¤¨¤¢".str_repeat("¤¢¤¤¤¨¤ª¤¦", 30), "¤¦¤ª", "EUC-JP"); for ($i = 0; $i <=6; ++$i) { - $str = str_repeat("¤¢¤¤¤¦¤¨¤ª", 60).str_repeat('$', $i).str_repeat("¤¢¤¤¤¨¤ª¤¦", 60); - foo($str, '$', "ISO-2022-JP", "EUC-JP"); + $str = str_repeat("¤¢¤¤¤¦¤¨¤ª", 60).str_repeat('$', $i).str_repeat("¤¢¤¤¤¨¤ª¤¦", 60); + foo($str, '$', "ISO-2022-JP", "EUC-JP"); } var_dump(iconv_strrpos("string", "")); diff --git a/ext/iconv/tests/iconv_substr.phpt b/ext/iconv/tests/iconv_substr.phpt index 2a514e6f61..1d029520a4 100644 --- a/ext/iconv/tests/iconv_substr.phpt +++ b/ext/iconv/tests/iconv_substr.phpt @@ -7,26 +7,26 @@ iconv.internal_charset=ISO-8859-1 --FILE-- <?php function hexdump($str) { - $len = strlen($str); - for ($i = 0; $i < $len; ++$i) { - printf("%02x", ord($str[$i])); - } - print "\n"; + $len = strlen($str); + for ($i = 0; $i < $len; ++$i) { + printf("%02x", ord($str[$i])); + } + print "\n"; } function foo($str, $offset, $len, $charset) { - hexdump(substr($str, $offset, $len)); - hexdump(iconv_substr($str, $offset, $len, $charset)); + hexdump(substr($str, $offset, $len)); + hexdump(iconv_substr($str, $offset, $len, $charset)); } function bar($str, $offset, $len = false) { - if (is_bool($len)) { - var_dump(substr($str, $offset)); - var_dump(iconv_substr($str, $offset)); - } else { - var_dump(substr($str, $offset, $len)); - var_dump(iconv_substr($str, $offset, $len)); - } + if (is_bool($len)) { + var_dump(substr($str, $offset)); + var_dump(iconv_substr($str, $offset)); + } else { + var_dump(substr($str, $offset, $len)); + var_dump(iconv_substr($str, $offset, $len)); + } } foo("abcdefghijklmnopqrstuvwxyz", 5, 7, "ASCII"); diff --git a/ext/imap/tests/bug35669.phpt b/ext/imap/tests/bug35669.phpt index 1f8ca5d7c3..fc7a135bce 100644 --- a/ext/imap/tests/bug35669.phpt +++ b/ext/imap/tests/bug35669.phpt @@ -8,7 +8,7 @@ Bug #35669 (imap_mail_compose() crashes with multipart-multiboundary-email) ?> --FILE-- <?php - $envelope["from"] = 'Santa <somewhere@northpole.gov>'; + $envelope["from"] = 'Santa <somewhere@northpole.gov>'; $envelope["to"] = 'The bad smurf <bad@smurf.com>'; $envelope['date'] = 'Wed, 04 Jan 2006 19:24:43 -0500'; diff --git a/ext/imap/tests/bug44098.phpt b/ext/imap/tests/bug44098.phpt index c424f05f54..2a0f5cef44 100644 --- a/ext/imap/tests/bug44098.phpt +++ b/ext/imap/tests/bug44098.phpt @@ -11,9 +11,9 @@ Bug #44098 (imap_utf8() returns only capital letters) $exp = 'Luzon®14 dot CoM'; $res = imap_utf8('=?iso-8859-1?b?THV6b26uMTQ=?= dot CoM'); if ($res != $exp) { - echo "failed: got <$res>, expected <exp>\n"; + echo "failed: got <$res>, expected <exp>\n"; } else { - echo "ok"; + echo "ok"; } ?> --EXPECT-- diff --git a/ext/imap/tests/bug75774.phpt b/ext/imap/tests/bug75774.phpt index 686ffe75b8..42f5a842c3 100644 --- a/ext/imap/tests/bug75774.phpt +++ b/ext/imap/tests/bug75774.phpt @@ -11,9 +11,9 @@ $fn = __DIR__ . DIRECTORY_SEPARATOR . "foo75774"; $var1=fopen($fn, "w"); try { - imap_append($var1, "", "", "", ""); + imap_append($var1, "", "", "", ""); } catch (Throwable $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo "\nException: " . $e->getMessage() . "\n"; } fclose($var1); diff --git a/ext/imap/tests/clean.inc b/ext/imap/tests/clean.inc index 4f381bf893..8bc566ba32 100644 --- a/ext/imap/tests/clean.inc +++ b/ext/imap/tests/clean.inc @@ -6,19 +6,19 @@ $imap_stream = imap_open($default_mailbox, $username, $password); // delete all msgs in default mailbox, i.e INBOX $check = imap_check($imap_stream); for ($i = 1; $i <= $check->Nmsgs; $i++) { - imap_delete($imap_stream, $i); + imap_delete($imap_stream, $i); } $mailboxes = imap_getmailboxes($imap_stream, $server, '*'); foreach($mailboxes as $value) { - // Only delete mailboxes with our prefix - if (preg_match('/\{.*?\}INBOX\.(.+)/', $value->name, $match) == 1) { - if (strlen($match[1]) >= strlen($mailbox_prefix) - && substr_compare($match[1], $mailbox_prefix, 0, strlen($mailbox_prefix)) == 0) { - imap_deletemailbox($imap_stream, $value->name); - } - } + // Only delete mailboxes with our prefix + if (preg_match('/\{.*?\}INBOX\.(.+)/', $value->name, $match) == 1) { + if (strlen($match[1]) >= strlen($mailbox_prefix) + && substr_compare($match[1], $mailbox_prefix, 0, strlen($mailbox_prefix)) == 0) { + imap_deletemailbox($imap_stream, $value->name); + } + } } imap_close($imap_stream, CL_EXPUNGE); diff --git a/ext/imap/tests/imap_append_basic.phpt b/ext/imap/tests/imap_append_basic.phpt index 499a05cc4d..807c30c869 100644 --- a/ext/imap/tests/imap_append_basic.phpt +++ b/ext/imap/tests/imap_append_basic.phpt @@ -18,7 +18,7 @@ require_once(__DIR__.'/imap_include.inc'); echo "Create a new mailbox for test\n"; $imap_stream = setup_test_mailbox("", 0); if (!is_resource($imap_stream)) { - exit("TEST FAILED: Unable to create test mailbox\n"); + exit("TEST FAILED: Unable to create test mailbox\n"); } $mb_details = imap_mailboxmsginfo($imap_stream); diff --git a/ext/imap/tests/imap_base64_basic.phpt b/ext/imap/tests/imap_base64_basic.phpt index a01545ceba..e5063f2c1c 100644 --- a/ext/imap/tests/imap_base64_basic.phpt +++ b/ext/imap/tests/imap_base64_basic.phpt @@ -16,25 +16,25 @@ echo "*** Testing imap_base64() : basic functionality ***\n"; $str = 'This is an example string to be base 64 encoded'; $base64 = base64_encode($str); if (imap_base64($base64) == $str) { - echo "TEST PASSED\n"; + echo "TEST PASSED\n"; } else { - echo "TEST FAILED"; + echo "TEST FAILED"; } $str = '!£$%^&*()_+-={][];;@~#?/>.<,'; $base64 = base64_encode($str); if (imap_base64($base64) == $str) { - echo "TEST PASSED\n"; + echo "TEST PASSED\n"; } else { - echo "TEST FAILED"; + echo "TEST FAILED"; } $hex = 'x00\x01\x02\x03\x04\x05\x06\xFA\xFB\xFC\xFD\xFE\xFF'; $base64 = base64_encode($hex); if (imap_base64($base64) == $hex) { - echo "TEST PASSED\n"; + echo "TEST PASSED\n"; } else { - echo "TEST FAILED"; + echo "TEST FAILED"; } ?> diff --git a/ext/imap/tests/imap_body.phpt b/ext/imap/tests/imap_body.phpt index de5f7f286c..a4e8069d04 100644 --- a/ext/imap/tests/imap_body.phpt +++ b/ext/imap/tests/imap_body.phpt @@ -17,7 +17,7 @@ imap_body(''); imap_body(false); require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or - die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); imap_body($stream_id); imap_body($stream_id,-1); imap_body($stream_id,1,-1); diff --git a/ext/imap/tests/imap_body_basic.phpt b/ext/imap/tests/imap_body_basic.phpt index b3dcfa105e..ecc1da3ec6 100644 --- a/ext/imap/tests/imap_body_basic.phpt +++ b/ext/imap/tests/imap_body_basic.phpt @@ -18,7 +18,7 @@ require_once(__DIR__.'/imap_include.inc'); echo "Create a new mailbox for test\n"; $imap_stream = setup_test_mailbox("", 1); if (!is_resource($imap_stream)) { - exit("TEST FAILED: Unable to create test mailbox\n"); + exit("TEST FAILED: Unable to create test mailbox\n"); } $check = imap_check($imap_stream); diff --git a/ext/imap/tests/imap_bodystruct_basic.phpt b/ext/imap/tests/imap_bodystruct_basic.phpt index c278c4c2af..9504f9acab 100644 --- a/ext/imap/tests/imap_bodystruct_basic.phpt +++ b/ext/imap/tests/imap_bodystruct_basic.phpt @@ -17,7 +17,7 @@ require_once(__DIR__.'/imap_include.inc'); echo "Create a new mailbox for test and add a multipart msgs\n"; $imap_stream = setup_test_mailbox("", 1, $mailbox, "multipart"); if (!is_resource($imap_stream)) { - exit("TEST FAILED: Unable to create test mailbox\n"); + exit("TEST FAILED: Unable to create test mailbox\n"); } echo "\nGet and validate structure of body part 1\n"; diff --git a/ext/imap/tests/imap_clearflag_full_basic.phpt b/ext/imap/tests/imap_clearflag_full_basic.phpt index 08416281ec..3afc105d5a 100644 --- a/ext/imap/tests/imap_clearflag_full_basic.phpt +++ b/ext/imap/tests/imap_clearflag_full_basic.phpt @@ -18,7 +18,7 @@ require_once(__DIR__.'/imap_include.inc'); echo "Create a new mailbox for test\n"; $imap_stream = setup_test_mailbox("", 10); if (!is_resource($imap_stream)) { - exit("TEST FAILED: Unable to create test mailbox\n"); + exit("TEST FAILED: Unable to create test mailbox\n"); } $check = imap_check($imap_stream); diff --git a/ext/imap/tests/imap_close_basic.phpt b/ext/imap/tests/imap_close_basic.phpt index 0eb6d74f06..9e275aa4d0 100644 --- a/ext/imap/tests/imap_close_basic.phpt +++ b/ext/imap/tests/imap_close_basic.phpt @@ -22,7 +22,7 @@ $options = CL_EXPUNGE; // mark messages in inbox for deletion for ($i = 1; $i < 4; $i++) { - imap_delete($stream_id, $i); + imap_delete($stream_id, $i); } // Calling imap_close() with all possible arguments diff --git a/ext/imap/tests/imap_close_variation4.phpt b/ext/imap/tests/imap_close_variation4.phpt index f45d34845c..28a37ebb11 100644 --- a/ext/imap/tests/imap_close_variation4.phpt +++ b/ext/imap/tests/imap_close_variation4.phpt @@ -28,33 +28,33 @@ $stream_id = setup_test_mailbox('', 3, $mailbox); // set up temp mailbox with 3 $iterator = 1; foreach($inputs as $input) { - // mark added messages for deletion - for ($i = 1; $i < 4; $i++) { - imap_delete($stream_id, $i); - } - echo "\n-- Iteration $iterator --\n"; - var_dump( $check = imap_close($stream_id, $input) ); - - // check that imap_close was successful, if not call imap_close and explicitly set CL_EXPUNGE - if(false === $check) { - imap_close($stream_id, CL_EXPUNGE); - } else { - // if imap_close was successful test whether CL_EXPUNGE was set by doing a message count - $imap_stream = imap_open($mailbox, $username, $password); - $num_msg = imap_num_msg($imap_stream); - if ($num_msg != 0) { - echo "CL_EXPUNGE was not set, $num_msg msgs in mailbox\n"; - } else { - echo "CL_EXPUNGE was set\n"; - } - // call imap_close with CL_EXPUNGE explicitly set in case mailbox not empty - imap_close($imap_stream, CL_EXPUNGE); - } - $iterator++; - - // get $stream_id for next iteration - $stream_id = imap_open($mailbox, $username, $password); - populate_mailbox($stream_id, $mailbox, 3); + // mark added messages for deletion + for ($i = 1; $i < 4; $i++) { + imap_delete($stream_id, $i); + } + echo "\n-- Iteration $iterator --\n"; + var_dump( $check = imap_close($stream_id, $input) ); + + // check that imap_close was successful, if not call imap_close and explicitly set CL_EXPUNGE + if(false === $check) { + imap_close($stream_id, CL_EXPUNGE); + } else { + // if imap_close was successful test whether CL_EXPUNGE was set by doing a message count + $imap_stream = imap_open($mailbox, $username, $password); + $num_msg = imap_num_msg($imap_stream); + if ($num_msg != 0) { + echo "CL_EXPUNGE was not set, $num_msg msgs in mailbox\n"; + } else { + echo "CL_EXPUNGE was set\n"; + } + // call imap_close with CL_EXPUNGE explicitly set in case mailbox not empty + imap_close($imap_stream, CL_EXPUNGE); + } + $iterator++; + + // get $stream_id for next iteration + $stream_id = imap_open($mailbox, $username, $password); + populate_mailbox($stream_id, $mailbox, 3); }; ?> diff --git a/ext/imap/tests/imap_createmailbox_basic.phpt b/ext/imap/tests/imap_createmailbox_basic.phpt index 89e262ed84..b522e80dfb 100644 --- a/ext/imap/tests/imap_createmailbox_basic.phpt +++ b/ext/imap/tests/imap_createmailbox_basic.phpt @@ -16,7 +16,7 @@ echo "*** Testing imap_createmailbox() : basic functionality ***\n"; require_once(__DIR__.'/imap_include.inc'); $imap_stream = imap_open($default_mailbox, $username, $password) or - die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); $newname = "phpnewbox"; @@ -25,8 +25,8 @@ echo "Newname will be '$newname'\n"; $newbox = imap_utf7_encode($server.$newname); if (imap_createmailbox($imap_stream, $newbox)) { - echo "Add a couple of msgs to '$newname' mailbox\n"; - populate_mailbox($imap_stream, $newbox, 2); + echo "Add a couple of msgs to '$newname' mailbox\n"; + populate_mailbox($imap_stream, $newbox, 2); $status = imap_status($imap_stream, $newbox, SA_ALL); if ($status) { diff --git a/ext/imap/tests/imap_fetch_overview_variation3.phpt b/ext/imap/tests/imap_fetch_overview_variation3.phpt index 3bfb627d40..9e99dc2a0f 100644 --- a/ext/imap/tests/imap_fetch_overview_variation3.phpt +++ b/ext/imap/tests/imap_fetch_overview_variation3.phpt @@ -38,13 +38,13 @@ $options = array ('1', $iterator = 1; imap_check($stream_id); foreach($options as $option) { - echo "\nTesting with option value:"; - var_dump($option); - $overview = imap_fetch_overview($stream_id, $msg_uid, $option); - if ($overview) { + echo "\nTesting with option value:"; + var_dump($option); + $overview = imap_fetch_overview($stream_id, $msg_uid, $option); + if ($overview) { echo "imap_fetch_overview() returns an object\n"; } - $iterator++; + $iterator++; } ?> diff --git a/ext/imap/tests/imap_fetch_overview_variation5.phpt b/ext/imap/tests/imap_fetch_overview_variation5.phpt index eecb6f0b77..e06d3f5ef2 100644 --- a/ext/imap/tests/imap_fetch_overview_variation5.phpt +++ b/ext/imap/tests/imap_fetch_overview_variation5.phpt @@ -27,15 +27,15 @@ $sequences = array (0, 4, '4', // out of range '1:3'); // pass uid without setting FT_UID option foreach($sequences as $msg_no) { - echo "\n-- \$msg_no is $msg_no --\n"; + echo "\n-- \$msg_no is $msg_no --\n"; $overview = imap_fetch_overview($stream_id, $msg_no); - if (!$overview) { - echo imap_last_error() . "\n"; + if (!$overview) { + echo imap_last_error() . "\n"; } else { - foreach($overview as $ov) { - echo "\n"; - displayOverviewFields($ov); - } + foreach($overview as $ov) { + echo "\n"; + displayOverviewFields($ov); + } } } diff --git a/ext/imap/tests/imap_fetch_overview_variation6.phpt b/ext/imap/tests/imap_fetch_overview_variation6.phpt index 1ca9fd51da..90bff01cea 100644 --- a/ext/imap/tests/imap_fetch_overview_variation6.phpt +++ b/ext/imap/tests/imap_fetch_overview_variation6.phpt @@ -40,48 +40,48 @@ displayOverviewFields($a[0]); * @param string $mailbox */ function create_multipart_message($imap_stream, $mailbox) { - global $users, $domain; - $envelope["from"]= "foo@anywhere.com"; - $envelope["to"] = "$users[0]@$domain"; - $envelope["subject"] = "Test msg 1"; - - $part1["type"] = TYPEMULTIPART; - $part1["subtype"] = "mixed"; - - $part2["type"] = TYPETEXT; - $part2["subtype"] = "plain"; - $part2["description"] = "imap_mail_compose() function"; - $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx"; - - $part3["type"] = TYPETEXT; - $part3["subtype"] = "plain"; - $part3["description"] = "Example"; - $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"; - - $file_handle = fopen(__FILE__, 'r+'); - $file_size = 1; - - $part4["type"] = TYPEAPPLICATION; - $part4["encoding"] = ENCBASE64; - $part4["subtype"] = "octet-stream"; - $part4["description"] = 'Test'; - $part4['disposition.type'] = 'attachment'; - $part4['disposition'] = array ('filename' => 'Test'); - $part4['type.parameters'] = array('name' => 'Test'); - $part4["contents.data"] = base64_encode(fread($file_handle, 1)); - - $body[1] = $part1; - $body[2] = $part2; - $body[3] = $part3; - $body[4] = $part4; - - $msg = imap_mail_compose($envelope, $body); - - if (imap_append($imap_stream, $mailbox, $msg) === false) { - echo imap_last_error() . "\n"; - echo "TEST FAILED : could not append new message to mailbox '$mailbox'\n"; - exit; - } + global $users, $domain; + $envelope["from"]= "foo@anywhere.com"; + $envelope["to"] = "$users[0]@$domain"; + $envelope["subject"] = "Test msg 1"; + + $part1["type"] = TYPEMULTIPART; + $part1["subtype"] = "mixed"; + + $part2["type"] = TYPETEXT; + $part2["subtype"] = "plain"; + $part2["description"] = "imap_mail_compose() function"; + $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx"; + + $part3["type"] = TYPETEXT; + $part3["subtype"] = "plain"; + $part3["description"] = "Example"; + $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"; + + $file_handle = fopen(__FILE__, 'r+'); + $file_size = 1; + + $part4["type"] = TYPEAPPLICATION; + $part4["encoding"] = ENCBASE64; + $part4["subtype"] = "octet-stream"; + $part4["description"] = 'Test'; + $part4['disposition.type'] = 'attachment'; + $part4['disposition'] = array ('filename' => 'Test'); + $part4['type.parameters'] = array('name' => 'Test'); + $part4["contents.data"] = base64_encode(fread($file_handle, 1)); + + $body[1] = $part1; + $body[2] = $part2; + $body[3] = $part3; + $body[4] = $part4; + + $msg = imap_mail_compose($envelope, $body); + + if (imap_append($imap_stream, $mailbox, $msg) === false) { + echo imap_last_error() . "\n"; + echo "TEST FAILED : could not append new message to mailbox '$mailbox'\n"; + exit; + } } ?> diff --git a/ext/imap/tests/imap_fetchbody_basic.phpt b/ext/imap/tests/imap_fetchbody_basic.phpt index 797ec08bf5..597b3b71b6 100644 --- a/ext/imap/tests/imap_fetchbody_basic.phpt +++ b/ext/imap/tests/imap_fetchbody_basic.phpt @@ -27,26 +27,26 @@ $options = array ('FT_UID' => FT_UID, 'FT_PEEK' => FT_PEEK, 'FT_INTERNAL' => FT_ // Calling imap_fetchbody() with all possible arguments echo "\n-- All possible arguments --\n"; foreach ($options as $key => $option) { - echo "-- Option is $key --\n"; - switch ($key) { + echo "-- Option is $key --\n"; + switch ($key) { - case 'FT_UID'; - $msg_uid = imap_uid($stream_id, $msg_no); - var_dump( imap_fetchbody($stream_id, $msg_uid, $section, $option) ); - break; + case 'FT_UID'; + $msg_uid = imap_uid($stream_id, $msg_no); + var_dump( imap_fetchbody($stream_id, $msg_uid, $section, $option) ); + break; - case 'FT_PEEK'; - var_dump( imap_fetchbody($stream_id, $msg_no, $section, $option) ); - $overview = imap_fetch_overview($stream_id, 1); - echo "Seen Flag: "; - var_dump( $overview[0]->seen ); - break; + case 'FT_PEEK'; + var_dump( imap_fetchbody($stream_id, $msg_no, $section, $option) ); + $overview = imap_fetch_overview($stream_id, 1); + echo "Seen Flag: "; + var_dump( $overview[0]->seen ); + break; - case 'FT_INTERNAL'; - var_dump( imap_fetchbody($stream_id, $msg_no, $section, $option) ); - break; + case 'FT_INTERNAL'; + var_dump( imap_fetchbody($stream_id, $msg_no, $section, $option) ); + break; - } + } } // Calling imap_fetchbody() with mandatory arguments diff --git a/ext/imap/tests/imap_fetchbody_variation4.phpt b/ext/imap/tests/imap_fetchbody_variation4.phpt index 8648115896..b4b8afa92d 100644 --- a/ext/imap/tests/imap_fetchbody_variation4.phpt +++ b/ext/imap/tests/imap_fetchbody_variation4.phpt @@ -35,13 +35,13 @@ $options = array ('1', true, $iterator = 1; imap_check($stream_id); foreach($options as $option) { - echo "\n-- Iteration $iterator --\n"; - if(is_string(imap_fetchbody($stream_id, $msg_uid, $section, $option))) { - echo "FT_UID valid\n"; - } else { + echo "\n-- Iteration $iterator --\n"; + if(is_string(imap_fetchbody($stream_id, $msg_uid, $section, $option))) { + echo "FT_UID valid\n"; + } else { echo "FT_UID not valid\n"; } - $iterator++; + $iterator++; } ?> diff --git a/ext/imap/tests/imap_fetchbody_variation6.phpt b/ext/imap/tests/imap_fetchbody_variation6.phpt index 1f179633ef..2090bf3792 100644 --- a/ext/imap/tests/imap_fetchbody_variation6.phpt +++ b/ext/imap/tests/imap_fetchbody_variation6.phpt @@ -29,11 +29,11 @@ $sequences = array (0, 4, // out of range ); foreach($sequences as $msg_no) { - echo "\n-- \$msg_no is $msg_no --\n"; - var_dump($overview = imap_fetchbody($stream_id, $msg_no, $section)); - if (!$overview) { - echo imap_last_error() . "\n"; - } + echo "\n-- \$msg_no is $msg_no --\n"; + var_dump($overview = imap_fetchbody($stream_id, $msg_no, $section)); + if (!$overview) { + echo imap_last_error() . "\n"; + } } ?> --CLEAN-- diff --git a/ext/imap/tests/imap_fetchheader_basic.phpt b/ext/imap/tests/imap_fetchheader_basic.phpt index fd43ceec94..7da2a1b78c 100644 --- a/ext/imap/tests/imap_fetchheader_basic.phpt +++ b/ext/imap/tests/imap_fetchheader_basic.phpt @@ -23,13 +23,13 @@ $options = array('FT_UID' => FT_UID, 'FT_INTERNAL' => FT_INTERNAL, // Calling imap_fetchheader() with all possible arguments echo "\n-- All possible arguments --\n"; foreach ($options as $key => $option) { - echo "-- Option is $key --\n"; - if ($key == 'FT_UID') { - $msg_uid = imap_uid($stream_id, $msg_no); - var_dump(imap_fetchheader($stream_id, $msg_uid, $option)); - } else { - var_dump(imap_fetchheader($stream_id, $msg_no, $option)); - } + echo "-- Option is $key --\n"; + if ($key == 'FT_UID') { + $msg_uid = imap_uid($stream_id, $msg_no); + var_dump(imap_fetchheader($stream_id, $msg_uid, $option)); + } else { + var_dump(imap_fetchheader($stream_id, $msg_no, $option)); + } } // Calling imap_fetchheader() with mandatory arguments diff --git a/ext/imap/tests/imap_fetchheader_variation3.phpt b/ext/imap/tests/imap_fetchheader_variation3.phpt index 073e9e7eca..3430409fcb 100644 --- a/ext/imap/tests/imap_fetchheader_variation3.phpt +++ b/ext/imap/tests/imap_fetchheader_variation3.phpt @@ -34,13 +34,13 @@ $options = array ('1', true, $iterator = 1; imap_check($stream_id); foreach($options as $option) { - echo "\n-- Iteration $iterator --\n"; - if(is_string(imap_fetchheader($stream_id, $msg_uid, $option))) { - echo "FT_UID valid\n"; - } else { + echo "\n-- Iteration $iterator --\n"; + if(is_string(imap_fetchheader($stream_id, $msg_uid, $option))) { + echo "FT_UID valid\n"; + } else { echo "FT_UID not valid\n"; } - $iterator++; + $iterator++; } ?> --CLEAN-- diff --git a/ext/imap/tests/imap_fetchheader_variation5.phpt b/ext/imap/tests/imap_fetchheader_variation5.phpt index 77e334b6a1..548aac8935 100644 --- a/ext/imap/tests/imap_fetchheader_variation5.phpt +++ b/ext/imap/tests/imap_fetchheader_variation5.phpt @@ -27,11 +27,11 @@ $sequences = array (0, 4, // out of range ); foreach($sequences as $msg_no) { - echo "\n-- \$msg_no is $msg_no --\n"; - var_dump($overview = imap_fetchheader($stream_id, $msg_no)); - if (!$overview) { - echo imap_last_error() . "\n"; - } + echo "\n-- \$msg_no is $msg_no --\n"; + var_dump($overview = imap_fetchheader($stream_id, $msg_no)); + if (!$overview) { + echo imap_last_error() . "\n"; + } } // clear error stack diff --git a/ext/imap/tests/imap_fetchstructure_basic.phpt b/ext/imap/tests/imap_fetchstructure_basic.phpt index 5d83a27427..0ff266a390 100644 --- a/ext/imap/tests/imap_fetchstructure_basic.phpt +++ b/ext/imap/tests/imap_fetchstructure_basic.phpt @@ -28,7 +28,7 @@ $fields = array('type','encoding','ifsubtype','subtype', 'ifdescription','lines','bytes','parameters'); foreach ($fields as $key) { - var_dump(isset($z->$key)); + var_dump(isset($z->$key)); } var_dump($z->type); var_dump($z->encoding); diff --git a/ext/imap/tests/imap_gc_error.phpt b/ext/imap/tests/imap_gc_error.phpt index ee13f45ce7..9606c1ae2d 100644 --- a/ext/imap/tests/imap_gc_error.phpt +++ b/ext/imap/tests/imap_gc_error.phpt @@ -18,7 +18,7 @@ imap_gc(false, false); require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or - die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); imap_gc($stream_id, -1); ?> diff --git a/ext/imap/tests/imap_getsubscribed_basic.phpt b/ext/imap/tests/imap_getsubscribed_basic.phpt index 666203a8c2..8995eadd05 100644 --- a/ext/imap/tests/imap_getsubscribed_basic.phpt +++ b/ext/imap/tests/imap_getsubscribed_basic.phpt @@ -17,7 +17,7 @@ imap_getsubscribed(false); require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or - die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); imap_getsubscribed($stream_id); imap_getsubscribed($stream_id,$default_mailbox); diff --git a/ext/imap/tests/imap_headerinfo_basic.phpt b/ext/imap/tests/imap_headerinfo_basic.phpt index c13e62f8bf..056a46523c 100644 --- a/ext/imap/tests/imap_headerinfo_basic.phpt +++ b/ext/imap/tests/imap_headerinfo_basic.phpt @@ -16,14 +16,14 @@ $z = imap_headerinfo($stream_id, 1); $fields = array ('toaddress','to','fromaddress','from', 'reply_toaddress','reply_to', - 'senderaddress', 'sender', + 'senderaddress', 'sender', 'subject','Subject', - 'Recent','Unseen','Flagged','Answered','Deleted','Draft', - 'Msgno','MailDate','Size','udate'); + 'Recent','Unseen','Flagged','Answered','Deleted','Draft', + 'Msgno','MailDate','Size','udate'); echo "Check general fields\n"; foreach ($fields as $key) { - var_dump(isset($z->$key)); + var_dump(isset($z->$key)); } echo "Check type\n"; @@ -35,44 +35,44 @@ var_dump($z->subject); var_dump($z->Subject); if ($z->Recent == 'R' || $z->Recent == 'N' || $z->Recent == ' ') { - echo "Recent: OK"; + echo "Recent: OK"; } else { - echo "Recent: error: ".$z->Recent; + echo "Recent: error: ".$z->Recent; } echo "\n"; if ($z->Unseen == 'U' || $z->Unseen == ' ') { - echo "Unseen: OK"; + echo "Unseen: OK"; } else { - echo "Unseen: error: ".$z->Unseen; + echo "Unseen: error: ".$z->Unseen; } echo "\n"; if ($z->Flagged == 'F' || $z->Flagged == ' ') { - echo "Flagged: OK"; + echo "Flagged: OK"; } else { - echo "Flagged: error: ".$z->Flagged; + echo "Flagged: error: ".$z->Flagged; } echo "\n"; if ($z->Answered == 'A' || $z->Answered == ' ') { - echo "Answered: OK"; + echo "Answered: OK"; } else { - echo "Answered: error"; + echo "Answered: error"; } echo "\n"; if ($z->Deleted == 'D' || $z->Deleted == ' ') { - echo "Deleted: OK"; + echo "Deleted: OK"; } else { - echo "Deleted: error"; + echo "Deleted: error"; } echo "\n"; if ($z->Draft == 'X' || $z->Draft == ' ') { - echo "Draft: OK"; + echo "Draft: OK"; } else { - echo "Draft: error"; + echo "Draft: error"; } echo "\n"; diff --git a/ext/imap/tests/imap_headerinfo_error.phpt b/ext/imap/tests/imap_headerinfo_error.phpt index 8d67b70130..3f3c593d06 100644 --- a/ext/imap/tests/imap_headerinfo_error.phpt +++ b/ext/imap/tests/imap_headerinfo_error.phpt @@ -17,7 +17,7 @@ imap_headerinfo(false); require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or - die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); imap_headerinfo($stream_id); diff --git a/ext/imap/tests/imap_include.inc b/ext/imap/tests/imap_include.inc index 47ac081c9f..7de634075a 100644 --- a/ext/imap/tests/imap_include.inc +++ b/ext/imap/tests/imap_include.inc @@ -64,32 +64,32 @@ function displayOverviewFields($resp, $fields=null) { * @return IMAP stream to new mailbox on success; FALSE on failure */ function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = null, $msg_type = "simple"){ - global $server, $default_mailbox, $username, $password; + global $server, $default_mailbox, $username, $password; - // open a stream to default mailbox - $imap_stream = imap_open($default_mailbox, $username, $password); + // open a stream to default mailbox + $imap_stream = imap_open($default_mailbox, $username, $password); - if ($imap_stream === false) { - echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; - return false; - } + if ($imap_stream === false) { + echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; + return false; + } - echo "Create a temporary mailbox and add " . $message_count . " msgs\n"; - $new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type); - if ($new_mailbox === false) { - echo "Can't create a temporary mailbox: " . imap_last_error(). "\n"; - return false; - } + echo "Create a temporary mailbox and add " . $message_count . " msgs\n"; + $new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type); + if ($new_mailbox === false) { + echo "Can't create a temporary mailbox: " . imap_last_error(). "\n"; + return false; + } - echo ".. mailbox '$new_mailbox' created\n"; + echo ".. mailbox '$new_mailbox' created\n"; - // reopen stream to new mailbox - if (imap_reopen($imap_stream, $new_mailbox) === false) { - echo "can't re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n"; - return false; - } + // reopen stream to new mailbox + if (imap_reopen($imap_stream, $new_mailbox) === false) { + echo "can't re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n"; + return false; + } - return $imap_stream; + return $imap_stream; } /** @@ -99,30 +99,30 @@ function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = nul * @param string $mailbox */ function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type= "simple"){ - global $default_mailbox, $mailbox_prefix; - $mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix; - - $mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*'); - - // check mailbox does not already exist - if ($mailboxes) { - foreach($mailboxes as $value) { - if ($value->name == $mailbox) { - exit ("TEST FAILED : Mailbox '$mailbox' already exists\n"); - } - } - } - - if (imap_createmailbox($imap_stream, $mailbox) === false) { - return false; - } - - // Add number of test msgs requested - if ($message_count > 0) { - populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type); - } - - return $mailbox; + global $default_mailbox, $mailbox_prefix; + $mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix; + + $mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*'); + + // check mailbox does not already exist + if ($mailboxes) { + foreach($mailboxes as $value) { + if ($value->name == $mailbox) { + exit ("TEST FAILED : Mailbox '$mailbox' already exists\n"); + } + } + } + + if (imap_createmailbox($imap_stream, $mailbox) === false) { + return false; + } + + // Add number of test msgs requested + if ($message_count > 0) { + populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type); + } + + return $mailbox; } /** @@ -133,48 +133,48 @@ function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type */ function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "simple"){ - global $users, $domain; - - for($i = 1; $i <= $message_count; $i++) { - if ($msg_type == "simple") { - $msg = "From: foo@anywhere.com\r\n" - . "To: $users[0]@$domain\r\n" - . "Subject: test$i\r\n" - . "\r\n" - . "$i: this is a test message, please ignore\r\n"; - } else { - $envelope["from"]= "foo@anywhere.com"; - $envelope["to"] = "$users[0]@$domain"; - $envelope["subject"] = "Test msg $i"; - - $part1["type"] = TYPEMULTIPART; - $part1["subtype"] = "mixed"; - - $part2["type"] = TYPETEXT; - $part2["subtype"] = "plain"; - $part2["description"] = "imap_mail_compose() function"; - $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx"; - - $part3["type"] = TYPETEXT; - $part3["subtype"] = "plain"; - $part3["description"] = "Example"; - $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"; - - $part4["type"] = TYPETEXT; - $part4["subtype"] = "plain"; - $part4["description"] = "Return Values"; - $part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz"; - - $body[1] = $part1; - $body[2] = $part2; - $body[3] = $part3; - $body[4] = $part4; - - $msg = imap_mail_compose($envelope, $body); - } - - imap_append($imap_stream, $mailbox, $msg); - } + global $users, $domain; + + for($i = 1; $i <= $message_count; $i++) { + if ($msg_type == "simple") { + $msg = "From: foo@anywhere.com\r\n" + . "To: $users[0]@$domain\r\n" + . "Subject: test$i\r\n" + . "\r\n" + . "$i: this is a test message, please ignore\r\n"; + } else { + $envelope["from"]= "foo@anywhere.com"; + $envelope["to"] = "$users[0]@$domain"; + $envelope["subject"] = "Test msg $i"; + + $part1["type"] = TYPEMULTIPART; + $part1["subtype"] = "mixed"; + + $part2["type"] = TYPETEXT; + $part2["subtype"] = "plain"; + $part2["description"] = "imap_mail_compose() function"; + $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx"; + + $part3["type"] = TYPETEXT; + $part3["subtype"] = "plain"; + $part3["description"] = "Example"; + $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"; + + $part4["type"] = TYPETEXT; + $part4["subtype"] = "plain"; + $part4["description"] = "Return Values"; + $part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz"; + + $body[1] = $part1; + $body[2] = $part2; + $body[3] = $part3; + $body[4] = $part4; + + $msg = imap_mail_compose($envelope, $body); + } + + imap_append($imap_stream, $mailbox, $msg); + } } /** @@ -185,12 +185,12 @@ function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "s */ function get_mailbox_name($mailbox){ - if (preg_match('/\{.*?\}(.*)/', $mailbox, $match) != 1) { - echo "Unrecpognized mailbox name\n"; - return false; - } + if (preg_match('/\{.*?\}(.*)/', $mailbox, $match) != 1) { + echo "Unrecpognized mailbox name\n"; + return false; + } - return $match[1]; + return $match[1]; } ?> diff --git a/ext/imap/tests/imap_list_basic.phpt b/ext/imap/tests/imap_list_basic.phpt index 21f8a63894..77df74af2b 100644 --- a/ext/imap/tests/imap_list_basic.phpt +++ b/ext/imap/tests/imap_list_basic.phpt @@ -17,7 +17,7 @@ imap_list(false); require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or - die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); imap_list($stream_id); imap_list($stream_id,$default_mailbox); diff --git a/ext/imap/tests/imap_lsub_basic.phpt b/ext/imap/tests/imap_lsub_basic.phpt index 638479ca80..591a023ed8 100644 --- a/ext/imap/tests/imap_lsub_basic.phpt +++ b/ext/imap/tests/imap_lsub_basic.phpt @@ -17,7 +17,7 @@ imap_lsub(false); require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or - die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); imap_lsub($stream_id); imap_lsub($stream_id,$default_mailbox); diff --git a/ext/imap/tests/imap_mail_copy.phpt b/ext/imap/tests/imap_mail_copy.phpt index 9202556169..c82a003a59 100644 --- a/ext/imap/tests/imap_mail_copy.phpt +++ b/ext/imap/tests/imap_mail_copy.phpt @@ -23,7 +23,7 @@ require_once(__DIR__.'/imap_include.inc'); echo "Test with IMAP server\n"; $stream_id = imap_open($default_mailbox, $username, $password) or - die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); var_dump(imap_mail_copy($stream_id)); var_dump(imap_mail_copy($stream_id,-1)); diff --git a/ext/imap/tests/imap_mail_copy_basic.phpt b/ext/imap/tests/imap_mail_copy_basic.phpt index 7b8c69f104..335b4218e6 100644 --- a/ext/imap/tests/imap_mail_copy_basic.phpt +++ b/ext/imap/tests/imap_mail_copy_basic.phpt @@ -21,7 +21,7 @@ require_once(__DIR__.'/imap_include.inc'); echo "Create a new mailbox for test\n"; $imap_stream = setup_test_mailbox("", 1); if (!is_resource($imap_stream)) { - exit("TEST FAILED: Unable to create test mailbox\n"); + exit("TEST FAILED: Unable to create test mailbox\n"); } $check = imap_check($imap_stream); diff --git a/ext/imap/tests/imap_mail_move.phpt b/ext/imap/tests/imap_mail_move.phpt index 3406288b27..d6d874b80d 100644 --- a/ext/imap/tests/imap_mail_move.phpt +++ b/ext/imap/tests/imap_mail_move.phpt @@ -23,7 +23,7 @@ require_once(__DIR__.'/imap_include.inc'); echo "Test with IMAP server\n"; $stream_id = imap_open($default_mailbox, $username, $password) or - die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); var_dump(imap_mail_move($stream_id)); var_dump(imap_mail_move($stream_id,-1)); diff --git a/ext/imap/tests/imap_mail_move_basic.phpt b/ext/imap/tests/imap_mail_move_basic.phpt index 390ec710c5..555d6e7a18 100644 --- a/ext/imap/tests/imap_mail_move_basic.phpt +++ b/ext/imap/tests/imap_mail_move_basic.phpt @@ -21,7 +21,7 @@ require_once(__DIR__.'/imap_include.inc'); echo "Create a new mailbox for test\n"; $imap_stream = setup_test_mailbox("", 1); if (!is_resource($imap_stream)) { - exit("TEST FAILED: Unable to create test mailbox\n"); + exit("TEST FAILED: Unable to create test mailbox\n"); } $check = imap_check($imap_stream); diff --git a/ext/imap/tests/imap_renamemailbox_basic.phpt b/ext/imap/tests/imap_renamemailbox_basic.phpt index 91f99d13e3..ee5ccb2be7 100644 --- a/ext/imap/tests/imap_renamemailbox_basic.phpt +++ b/ext/imap/tests/imap_renamemailbox_basic.phpt @@ -21,7 +21,7 @@ require_once(__DIR__.'/imap_include.inc'); $stream_id = setup_test_mailbox('', 1); if (!is_resource($stream_id)) { - exit("TEST FAILED: Unable to create test mailbox\n"); + exit("TEST FAILED: Unable to create test mailbox\n"); } $newbox = $default_mailbox . "." . $mailbox_prefix; diff --git a/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt b/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt index 36fcc7f077..87dc4aaf05 100644 --- a/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt +++ b/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt @@ -16,14 +16,14 @@ $z = imap_headerinfo($stream_id, 1); $fields = array ('toaddress','to','fromaddress','from', 'reply_toaddress','reply_to', - 'senderaddress', 'sender', + 'senderaddress', 'sender', 'subject','Subject', - 'MailDate','Size','udate'); + 'MailDate','Size','udate'); echo "Check general fields\n"; foreach ($fields as $key) { - var_dump(isset($z->$key)); + var_dump(isset($z->$key)); } echo "Check type\n"; @@ -35,44 +35,44 @@ var_dump($z->subject); var_dump($z->Subject); if ($z->Recent == 'R' || $z->Recent == 'N' || $z->Recent == ' ') { - echo "Recent: OK"; + echo "Recent: OK"; } else { - echo "Recent: error"; + echo "Recent: error"; } echo "\n"; if ($z->Unseen == 'U' || $z->Unseen == ' ') { - echo "Unseen: OK"; + echo "Unseen: OK"; } else { - echo "Unseen: error"; + echo "Unseen: error"; } echo "\n"; if ($z->Flagged == 'F' || $z->Flagged == ' ') { - echo "Flagged: OK"; + echo "Flagged: OK"; } else { - echo "Flagged: error"; + echo "Flagged: error"; } echo "\n"; if ($z->Answered == 'A' || $z->Answered == ' ') { - echo "Answered: OK"; + echo "Answered: OK"; } else { - echo "Answered: error"; + echo "Answered: error"; } echo "\n"; if ($z->Deleted == 'D' || $z->Deleted == ' ') { - echo "Deleted: OK"; + echo "Deleted: OK"; } else { - echo "Deleted: error"; + echo "Deleted: error"; } echo "\n"; if ($z->Draft == 'X' || $z->Draft == ' ') { - echo "Draft: OK"; + echo "Draft: OK"; } else { - echo "Draft: error"; + echo "Draft: error"; } echo "\n"; diff --git a/ext/imap/tests/imap_undelete_error.phpt b/ext/imap/tests/imap_undelete_error.phpt index 0eae8033eb..972c8140c6 100644 --- a/ext/imap/tests/imap_undelete_error.phpt +++ b/ext/imap/tests/imap_undelete_error.phpt @@ -17,7 +17,7 @@ imap_undelete(false); require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or - die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); imap_undelete($stream_id); diff --git a/ext/imap/tests/skipif.inc b/ext/imap/tests/skipif.inc index 12b1408634..2820bff5c6 100644 --- a/ext/imap/tests/skipif.inc +++ b/ext/imap/tests/skipif.inc @@ -10,7 +10,7 @@ $retries = 0; // don't retry connect on failure $mbox = @imap_open($mailbox, $username, $password, $options, $retries); if (!$mbox) { - die("skip could not connect to mailbox $mailbox"); + die("skip could not connect to mailbox $mailbox"); } imap_close($mbox); ?> diff --git a/ext/intl/tests/badargs.phpt b/ext/intl/tests/badargs.phpt index c3d7a331c2..3cc04dbf64 100644 --- a/ext/intl/tests/badargs.phpt +++ b/ext/intl/tests/badargs.phpt @@ -14,13 +14,13 @@ foreach($funcs as $func) { continue; } - try { - $res = $func($arg); - } catch (Exception $e) { - continue; - } catch (Error $e) { - continue; - } + try { + $res = $func($arg); + } catch (Exception $e) { + continue; + } catch (Error $e) { + continue; + } if($res != false) { echo "$func: "; var_dump($res); diff --git a/ext/intl/tests/breakiter___construct_error.phpt b/ext/intl/tests/breakiter___construct_error.phpt index 595c6b283a..8b36b4a7cf 100644 --- a/ext/intl/tests/breakiter___construct_error.phpt +++ b/ext/intl/tests/breakiter___construct_error.phpt @@ -7,34 +7,34 @@ IntlRuleBasedBreakIterator::__construct(): arg errors ini_set("intl.error_level", E_WARNING); function print_exception($e) { - echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; } //missing ; at the end: try { - var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+')); + var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+')); } catch (IntlException $e) { - print_exception($e); + print_exception($e); } try { - var_dump(new IntlRuleBasedBreakIterator()); + var_dump(new IntlRuleBasedBreakIterator()); } catch (TypeError $e) { - print_exception($e); + print_exception($e); } try { - var_dump(new IntlRuleBasedBreakIterator(1,2,3)); + var_dump(new IntlRuleBasedBreakIterator(1,2,3)); } catch (TypeError $e) { - print_exception($e); + print_exception($e); } try { - var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', array())); + var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', array())); } catch (TypeError $e) { - print_exception($e); + print_exception($e); } try { - var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', true)); + var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', true)); } catch (IntlException $e) { - print_exception($e); + print_exception($e); } --EXPECTF-- Exception: IntlRuleBasedBreakIterator::__construct(): rbbi_create_instance: unable to create RuleBasedBreakIterator from rules (parse error on line 1, offset 31) in %s on line %d diff --git a/ext/intl/tests/breakiter_factories_basic.phpt b/ext/intl/tests/breakiter_factories_basic.phpt index 4d05792c0e..ac7b17505d 100644 --- a/ext/intl/tests/breakiter_factories_basic.phpt +++ b/ext/intl/tests/breakiter_factories_basic.phpt @@ -10,17 +10,17 @@ ini_set("intl.error_level", E_WARNING); ini_set("intl.default_locale", "ja"); $m = array('createWordInstance', 'createLineInstance', 'createCharacterInstance', - 'createSentenceInstance', 'createTitleInstance'); + 'createSentenceInstance', 'createTitleInstance'); $t = 'Frase 1... Frase 2'; foreach ($m as $method) { - echo "===== $method =====\n"; - $o1 = IntlBreakIterator::$method('ja'); - $o2 = IntlBreakIterator::$method(NULL); - $o3 = IntlBreakIterator::$method(); - var_dump($o1 == $o2 && $o2 == $o3); - echo "\n"; + echo "===== $method =====\n"; + $o1 = IntlBreakIterator::$method('ja'); + $o2 = IntlBreakIterator::$method(NULL); + $o3 = IntlBreakIterator::$method(); + var_dump($o1 == $o2 && $o2 == $o3); + echo "\n"; } --EXPECT-- ===== createWordInstance ===== diff --git a/ext/intl/tests/bug12887.phpt b/ext/intl/tests/bug12887.phpt index e2fc194944..36d8e2f320 100644 --- a/ext/intl/tests/bug12887.phpt +++ b/ext/intl/tests/bug12887.phpt @@ -7,13 +7,13 @@ locale_get_keywords() bug #12887 function ut_main() { - $res_str = ''; - $keywords_arr = ut_loc_get_keywords( 'de_DE@currency=EUR;collation=PHONEBOOK;sort=PHONEBOOK' ); - if ($keywords_arr) { - foreach( $keywords_arr as $key => $value){ - $res_str .= "$key = $value\n"; - } - } + $res_str = ''; + $keywords_arr = ut_loc_get_keywords( 'de_DE@currency=EUR;collation=PHONEBOOK;sort=PHONEBOOK' ); + if ($keywords_arr) { + foreach( $keywords_arr as $key => $value){ + $res_str .= "$key = $value\n"; + } + } $res_str .= "\n"; return $res_str; diff --git a/ext/intl/tests/bug14562.phpt b/ext/intl/tests/bug14562.phpt index 7cf927f7e7..ec9a046b75 100644 --- a/ext/intl/tests/bug14562.phpt +++ b/ext/intl/tests/bug14562.phpt @@ -7,17 +7,17 @@ Bug #14562 NumberFormatter breaks when locale changes function ut_main() { - $res_str = ""; - $de_locale="de_DE.UTF-8"; - $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL ); - $numeric = $fmt->parse("1234,56"); - $res_str .= "$numeric\n"; - setlocale(LC_ALL, $de_locale); - $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL ); - $numeric = $fmt->parse("1234,56"); - setlocale(LC_ALL, "C"); // reset for printing - $res_str .= "$numeric\n"; - return $res_str; + $res_str = ""; + $de_locale="de_DE.UTF-8"; + $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL ); + $numeric = $fmt->parse("1234,56"); + $res_str .= "$numeric\n"; + setlocale(LC_ALL, $de_locale); + $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL ); + $numeric = $fmt->parse("1234,56"); + setlocale(LC_ALL, "C"); // reset for printing + $res_str .= "$numeric\n"; + return $res_str; } include_once( 'ut_common.inc' ); diff --git a/ext/intl/tests/bug53512.phpt b/ext/intl/tests/bug53512.phpt index 872e5987be..af2dda8f69 100644 --- a/ext/intl/tests/bug53512.phpt +++ b/ext/intl/tests/bug53512.phpt @@ -10,9 +10,9 @@ if (PHP_INT_SIZE != 8) die('skip 64-bit only'); $badvals = array(4294901761, 2147483648, -2147483648, -1); foreach ($badvals as $val) { - $x = numfmt_create("en", NumberFormatter::PATTERN_DECIMAL); - var_dump(numfmt_set_symbol($x, $val, "")); - var_dump(intl_get_error_message()); + $x = numfmt_create("en", NumberFormatter::PATTERN_DECIMAL); + var_dump(numfmt_set_symbol($x, $val, "")); + var_dump(intl_get_error_message()); } ?> diff --git a/ext/intl/tests/bug58756_MessageFormatter.phpt b/ext/intl/tests/bug58756_MessageFormatter.phpt index 13b51ec6ce..01673b8c48 100644 --- a/ext/intl/tests/bug58756_MessageFormatter.phpt +++ b/ext/intl/tests/bug58756_MessageFormatter.phpt @@ -26,7 +26,7 @@ echo "msgf: " . $msgf->format(array($time)) . "\n"; '{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); echo "msgf2: ", $msgf->format(array($time, 'date')), " ", - $msgf->format(array($time, 'time')), "\n"; + $msgf->format(array($time, 'time')), "\n"; */ ?> diff --git a/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt b/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt index a6a58906cc..790033c95b 100644 --- a/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt +++ b/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt @@ -26,7 +26,7 @@ echo "msgf: " . $msgf->format(array($time)) . "\n"; '{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); echo "msgf2: ", $msgf->format(array($time, 'date')), " ", - $msgf->format(array($time, 'time')), "\n"; + $msgf->format(array($time, 'time')), "\n"; */ ?> diff --git a/ext/intl/tests/bug60192-compare.phpt b/ext/intl/tests/bug60192-compare.phpt index 096b57558f..bd5faa11ed 100644 --- a/ext/intl/tests/bug60192-compare.phpt +++ b/ext/intl/tests/bug60192-compare.phpt @@ -7,9 +7,9 @@ Bug #60192 (SegFault when Collator not constructed properly) --FILE-- <?php class Collator2 extends Collator{ - public function __construct() { - // omitting parent::__construct($someLocale); - } + public function __construct() { + // omitting parent::__construct($someLocale); + } } $c = new Collator2(); diff --git a/ext/intl/tests/bug60192-getlocale.phpt b/ext/intl/tests/bug60192-getlocale.phpt index ef5ce3fc04..526632192e 100644 --- a/ext/intl/tests/bug60192-getlocale.phpt +++ b/ext/intl/tests/bug60192-getlocale.phpt @@ -8,9 +8,9 @@ Bug #60192 (SegFault when Collator not constructed properly) <?php class Collator2 extends Collator{ - public function __construct() { - // omitting parent::__construct($someLocale); - } + public function __construct() { + // omitting parent::__construct($someLocale); + } } $c = new Collator2(); diff --git a/ext/intl/tests/bug60192-getsortkey.phpt b/ext/intl/tests/bug60192-getsortkey.phpt index 21cc279eee..96df981cf5 100644 --- a/ext/intl/tests/bug60192-getsortkey.phpt +++ b/ext/intl/tests/bug60192-getsortkey.phpt @@ -8,9 +8,9 @@ Bug #60192 (SegFault when Collator not constructed properly) <?php class Collator2 extends Collator{ - public function __construct() { - // omitting parent::__construct($someLocale); - } + public function __construct() { + // omitting parent::__construct($someLocale); + } } $c = new Collator2(); diff --git a/ext/intl/tests/bug60192-sort.phpt b/ext/intl/tests/bug60192-sort.phpt index 530d5eecba..27899fdd4f 100644 --- a/ext/intl/tests/bug60192-sort.phpt +++ b/ext/intl/tests/bug60192-sort.phpt @@ -8,9 +8,9 @@ Bug #60192 (SegFault when Collator not constructed properly) <?php class Collator2 extends Collator{ - public function __construct() { - // omitting parent::__construct($someLocale); - } + public function __construct() { + // omitting parent::__construct($someLocale); + } } $c = new Collator2(); diff --git a/ext/intl/tests/bug60192-sortwithsortkeys.phpt b/ext/intl/tests/bug60192-sortwithsortkeys.phpt index 9ee58123c8..7f22c003c3 100644 --- a/ext/intl/tests/bug60192-sortwithsortkeys.phpt +++ b/ext/intl/tests/bug60192-sortwithsortkeys.phpt @@ -8,9 +8,9 @@ Bug #60192 (SegFault when Collator not constructed properly) <?php class Collator2 extends Collator{ - public function __construct() { - // omitting parent::__construct($someLocale); - } + public function __construct() { + // omitting parent::__construct($someLocale); + } } $c = new Collator2(); diff --git a/ext/intl/tests/bug62017.phpt b/ext/intl/tests/bug62017.phpt index 2f3c816f99..f2fa15a81d 100644 --- a/ext/intl/tests/bug62017.phpt +++ b/ext/intl/tests/bug62017.phpt @@ -8,14 +8,14 @@ if (!extension_loaded('intl')) <?php ini_set('intl.error_level', E_WARNING); var_dump( - datefmt_create('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "\xFF", - IntlDateFormatter::GREGORIAN, 'a')); + datefmt_create('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "\xFF", + IntlDateFormatter::GREGORIAN, 'a')); try { - var_dump( - new IntlDateFormatter('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "Europe/Lisbon", - IntlDateFormatter::GREGORIAN, "\x80")); + var_dump( + new IntlDateFormatter('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "Europe/Lisbon", + IntlDateFormatter::GREGORIAN, "\x80")); } catch (IntlException $e) { - echo PHP_EOL."Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . PHP_EOL; + echo PHP_EOL."Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . PHP_EOL; } --EXPECTF-- Warning: datefmt_create(): datefmt_create: Time zone identifier given is not a valid UTF-8 string in %s on line %d diff --git a/ext/intl/tests/bug62915-2.phpt b/ext/intl/tests/bug62915-2.phpt index 8dc3bd1512..a10b476ab4 100644 --- a/ext/intl/tests/bug62915-2.phpt +++ b/ext/intl/tests/bug62915-2.phpt @@ -9,24 +9,24 @@ if (!class_exists('Spoofchecker')) --FILE-- <?php class A extends IntlDateFormatter { - static $ARGS = array("en_US" ,IntlDateFormatter::FULL, IntlDateFormatter::FULL, - 'America/Los_Angeles', IntlDateFormatter::GREGORIAN); + static $ARGS = array("en_US" ,IntlDateFormatter::FULL, IntlDateFormatter::FULL, + 'America/Los_Angeles', IntlDateFormatter::GREGORIAN); } class B extends NumberFormatter { - static $ARGS = array('de_DE', NumberFormatter::DECIMAL); + static $ARGS = array('de_DE', NumberFormatter::DECIMAL); } class C extends MessageFormatter { - static $ARGS = array("en_US", "foo"); + static $ARGS = array("en_US", "foo"); } class D extends Spoofchecker { - static $ARGS = array(); + static $ARGS = array(); } foreach (range('A', 'D') as $subclass) { - $rc = new ReflectionClass($subclass); - $obj = $rc->newInstanceArgs($subclass::$ARGS); - $clone = clone $obj; - var_dump(get_class($clone)); + $rc = new ReflectionClass($subclass); + $obj = $rc->newInstanceArgs($subclass::$ARGS); + $clone = clone $obj; + var_dump(get_class($clone)); } --EXPECT-- string(1) "A" diff --git a/ext/intl/tests/bug62915.phpt b/ext/intl/tests/bug62915.phpt index 2277cde9d5..45d2dea5e9 100644 --- a/ext/intl/tests/bug62915.phpt +++ b/ext/intl/tests/bug62915.phpt @@ -8,17 +8,17 @@ if (!extension_loaded('intl')) <?php class foo extends IntlTimeZone { - public $foo = 'test'; + public $foo = 'test'; - public function __construct() { } + public function __construct() { } } $x = new foo; try { - $z = clone $x; + $z = clone $x; } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } --EXPECT-- string(39) "Cannot clone unconstructed IntlTimeZone" diff --git a/ext/intl/tests/bug71020.phpt b/ext/intl/tests/bug71020.phpt index 9f9b8eede3..582275967f 100644 --- a/ext/intl/tests/bug71020.phpt +++ b/ext/intl/tests/bug71020.phpt @@ -7,7 +7,7 @@ Bug #71020 (Use after free in Collator::sortWithSortKeys) $var_3=new Collator("Whatever"); for($x=0;$x<0xbb;$x++) - $myarray[substr(md5(microtime()),rand(0,26),9) . strval($x)]= substr(md5(microtime()),rand(0,26),9) . strval($x); + $myarray[substr(md5(microtime()),rand(0,26),9) . strval($x)]= substr(md5(microtime()),rand(0,26),9) . strval($x); $var_3->sortWithSortKeys($myarray); ?> okey diff --git a/ext/intl/tests/bug72533.phpt b/ext/intl/tests/bug72533.phpt index 1faf08c287..bf48c83c70 100644 --- a/ext/intl/tests/bug72533.phpt +++ b/ext/intl/tests/bug72533.phpt @@ -9,15 +9,15 @@ function ut_main() { $ret = var_export(ut_loc_accept_http(str_repeat('x', 256)), true); $ret .= "\n"; - if(intl_is_failure(intl_get_error_code())) { - $ret .= var_export(intl_get_error_message(), true); - } + if(intl_is_failure(intl_get_error_code())) { + $ret .= var_export(intl_get_error_message(), true); + } $ret .= "\n"; $ret .= var_export(ut_loc_accept_http(str_repeat('en,', 256)), true); $ret .= "\n"; - if(intl_is_failure(intl_get_error_code())) { - $ret .= var_export(intl_get_error_message(), true); - } + if(intl_is_failure(intl_get_error_code())) { + $ret .= var_export(intl_get_error_message(), true); + } return $ret; } diff --git a/ext/intl/tests/bug72639.phpt b/ext/intl/tests/bug72639.phpt index 2c94dcc06f..ca9b219715 100644 --- a/ext/intl/tests/bug72639.phpt +++ b/ext/intl/tests/bug72639.phpt @@ -6,7 +6,7 @@ Bug #72639 (Segfault when instantiating class that extends IntlCalendar and adds <?php class A extends IntlCalendar { public function __construct() {} - private $a; + private $a; } var_dump(new A()); ?> diff --git a/ext/intl/tests/calendar_add_basic.phpt b/ext/intl/tests/calendar_add_basic.phpt index 4d333594a1..3e8ed55579 100644 --- a/ext/intl/tests/calendar_add_basic.phpt +++ b/ext/intl/tests/calendar_add_basic.phpt @@ -22,8 +22,8 @@ $intlcal->add(IntlCalendar::FIELD_MINUTE, 6); intlcal_add($intlcal, IntlCalendar::FIELD_SECOND, 7); var_dump( - (float)$time2*1000, - $intlcal->getTime()); + (float)$time2*1000, + $intlcal->getTime()); ?> --EXPECT-- diff --git a/ext/intl/tests/calendar_before_after_error.phpt b/ext/intl/tests/calendar_before_after_error.phpt index 4d34ae77f5..66fb62f224 100644 --- a/ext/intl/tests/calendar_before_after_error.phpt +++ b/ext/intl/tests/calendar_before_after_error.phpt @@ -18,47 +18,47 @@ echo "error: $errno, $errstr\n"; set_error_handler('eh'); try { - var_dump($c->after()); + var_dump($c->after()); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->before()); + var_dump($c->before()); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->after(1)); + var_dump($c->after(1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->before(1)); + var_dump($c->before(1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try{ - var_dump($c->after($c, 1)); + var_dump($c->after($c, 1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->before($c, 1)); + var_dump($c->before($c, 1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_after($c)); + var_dump(intlcal_after($c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_before($c)); + var_dump(intlcal_before($c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- error: 0, IntlCalendar::after() expects exactly 1 parameter, 0 given diff --git a/ext/intl/tests/calendar_clear_basic.phpt b/ext/intl/tests/calendar_clear_basic.phpt index 221eec9ff0..1c4b40f424 100644 --- a/ext/intl/tests/calendar_clear_basic.phpt +++ b/ext/intl/tests/calendar_clear_basic.phpt @@ -12,13 +12,13 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); var_dump($intlcal->clear()); var_dump( - $intlcal->get(IntlCalendar::FIELD_YEAR), - $intlcal->get(IntlCalendar::FIELD_MONTH), - $intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH), - $intlcal->get(IntlCalendar::FIELD_HOUR), - $intlcal->get(IntlCalendar::FIELD_MINUTE), - $intlcal->get(IntlCalendar::FIELD_SECOND), - $intlcal->get(IntlCalendar::FIELD_MILLISECOND) + $intlcal->get(IntlCalendar::FIELD_YEAR), + $intlcal->get(IntlCalendar::FIELD_MONTH), + $intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH), + $intlcal->get(IntlCalendar::FIELD_HOUR), + $intlcal->get(IntlCalendar::FIELD_MINUTE), + $intlcal->get(IntlCalendar::FIELD_SECOND), + $intlcal->get(IntlCalendar::FIELD_MILLISECOND) ); $intlcal2 = IntlCalendar::createInstance('Europe/Amsterdam'); diff --git a/ext/intl/tests/calendar_clear_variation1.phpt b/ext/intl/tests/calendar_clear_variation1.phpt index 7b5033167f..6bc97b6c71 100644 --- a/ext/intl/tests/calendar_clear_variation1.phpt +++ b/ext/intl/tests/calendar_clear_variation1.phpt @@ -19,8 +19,8 @@ var_dump($intlcal->clear(IntlCalendar::FIELD_MONTH)); var_dump($intlcal->isSet(IntlCalendar::FIELD_MONTH)); //print_R($intlcal); var_dump( - $intlcal->getTime(), - strtotime('2012-01-29 05:06:07 +0000') * 1000. + $intlcal->getTime(), + strtotime('2012-01-29 05:06:07 +0000') * 1000. ); ?> --EXPECT-- diff --git a/ext/intl/tests/calendar_equals_error.phpt b/ext/intl/tests/calendar_equals_error.phpt index 4e6f40b43d..04896458b2 100644 --- a/ext/intl/tests/calendar_equals_error.phpt +++ b/ext/intl/tests/calendar_equals_error.phpt @@ -18,31 +18,31 @@ echo "error: $errno, $errstr\n"; set_error_handler('eh'); try { - var_dump($c->equals()); + var_dump($c->equals()); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->equals(new stdclass)); + var_dump($c->equals(new stdclass)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->equals(1, 2)); + var_dump($c->equals(1, 2)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_equals($c, array())); + var_dump(intlcal_equals($c, array())); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_equals(1, $c)); + var_dump(intlcal_equals(1, $c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- error: 0, IntlCalendar::equals() expects exactly 1 parameter, 0 given diff --git a/ext/intl/tests/calendar_fieldDifference_basic.phpt b/ext/intl/tests/calendar_fieldDifference_basic.phpt index a7202e9bee..918f279fb1 100644 --- a/ext/intl/tests/calendar_fieldDifference_basic.phpt +++ b/ext/intl/tests/calendar_fieldDifference_basic.phpt @@ -14,18 +14,18 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000); var_dump( - $intlcal->fieldDifference( - strtotime('2012-02-29 06:06:08 +0000') * 1000, - IntlCalendar::FIELD_SECOND), - $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY)); + $intlcal->fieldDifference( + strtotime('2012-02-29 06:06:08 +0000') * 1000, + IntlCalendar::FIELD_SECOND), + $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY)); $intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000); var_dump( - intlcal_field_difference( - $intlcal, - strtotime('2012-02-29 06:07:08 +0000') * 1000, - IntlCalendar::FIELD_MINUTE)); + intlcal_field_difference( + $intlcal, + strtotime('2012-02-29 06:07:08 +0000') * 1000, + IntlCalendar::FIELD_MINUTE)); ?> --EXPECT-- int(3601) diff --git a/ext/intl/tests/calendar_fromDateTime_basic.phpt b/ext/intl/tests/calendar_fromDateTime_basic.phpt index 0c7e471454..dcbd4e1c61 100644 --- a/ext/intl/tests/calendar_fromDateTime_basic.phpt +++ b/ext/intl/tests/calendar_fromDateTime_basic.phpt @@ -12,28 +12,28 @@ date_default_timezone_set('Europe/Lisbon'); $cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00 Europe/Rome'); var_dump( - $cal->getTime(), - strtotime('2012-01-01 00:00:00 Europe/Rome') * 1000., - $cal->getTimeZone()->getID(), - $cal->getLocale(1) + $cal->getTime(), + strtotime('2012-01-01 00:00:00 Europe/Rome') * 1000., + $cal->getTimeZone()->getID(), + $cal->getLocale(1) ); echo "\n"; $cal = IntlCalendar::fromDateTime(new DateTime('2012-01-01 00:00:00 PST'), "pt_PT"); var_dump( - $cal->getTime(), - strtotime('2012-01-01 00:00:00 PST') * 1000., - $cal->getTimeZone()->getID(), - $cal->getLocale(1) + $cal->getTime(), + strtotime('2012-01-01 00:00:00 PST') * 1000., + $cal->getTimeZone()->getID(), + $cal->getLocale(1) ); echo "\n"; $cal = intlcal_from_date_time(new DateTime('2012-01-01 00:00:00 +03:40')); var_dump( - $cal->getTime(), - strtotime('2012-01-01 00:00:00 +03:40') * 1000., - $cal->getTimeZone()->getID() + $cal->getTime(), + strtotime('2012-01-01 00:00:00 +03:40') * 1000., + $cal->getTimeZone()->getID() ); --EXPECTF-- float(1325372400000) diff --git a/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt b/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt index 7a9c8afa94..c525dca988 100644 --- a/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt +++ b/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt @@ -16,11 +16,11 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->setTime(strtotime('2012-02-29 00:00:00 +0000') * 1000); var_dump( - intlcal_get_day_of_week_type($intlcal, IntlCalendar::DOW_SUNDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_MONDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_TUESDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_FRIDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_SATURDAY) + intlcal_get_day_of_week_type($intlcal, IntlCalendar::DOW_SUNDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_MONDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_TUESDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_FRIDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_SATURDAY) ); ?> diff --git a/ext/intl/tests/calendar_getDayOfWeekType_basic2.phpt b/ext/intl/tests/calendar_getDayOfWeekType_basic2.phpt index 1dc4bb90a6..982eaf4251 100644 --- a/ext/intl/tests/calendar_getDayOfWeekType_basic2.phpt +++ b/ext/intl/tests/calendar_getDayOfWeekType_basic2.phpt @@ -16,11 +16,11 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->setTime(strtotime('2012-02-29 00:00:00 +0000') * 1000); var_dump( - intlcal_get_day_of_week_type($intlcal, IntlCalendar::DOW_SUNDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_MONDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_TUESDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_FRIDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_SATURDAY) + intlcal_get_day_of_week_type($intlcal, IntlCalendar::DOW_SUNDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_MONDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_TUESDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_FRIDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_SATURDAY) ); ?> diff --git a/ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt b/ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt index 233ca30b26..2bd97330ed 100644 --- a/ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt +++ b/ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt @@ -13,19 +13,19 @@ ini_set("intl.default_locale", "nl"); $intlcal = new IntlGregorianCalendar(2012, 1, 29); var_dump( - $intlcal->getErrorCode(), - intlcal_get_error_code($intlcal), - $intlcal->getErrorMessage(), - intlcal_get_error_message($intlcal) + $intlcal->getErrorCode(), + intlcal_get_error_code($intlcal), + $intlcal->getErrorMessage(), + intlcal_get_error_message($intlcal) ); $intlcal->add(IntlCalendar::FIELD_SECOND, 2147483647); $intlcal->fieldDifference(-PHP_INT_MAX, IntlCalendar::FIELD_SECOND); var_dump( - $intlcal->getErrorCode(), - intlcal_get_error_code($intlcal), - $intlcal->getErrorMessage(), - intlcal_get_error_message($intlcal) + $intlcal->getErrorCode(), + intlcal_get_error_code($intlcal), + $intlcal->getErrorMessage(), + intlcal_get_error_message($intlcal) ); ?> --EXPECTF-- diff --git a/ext/intl/tests/calendar_getXMaximum_basic.phpt b/ext/intl/tests/calendar_getXMaximum_basic.phpt index d9591c632a..82e77b8c8e 100644 --- a/ext/intl/tests/calendar_getXMaximum_basic.phpt +++ b/ext/intl/tests/calendar_getXMaximum_basic.phpt @@ -14,12 +14,12 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000); var_dump( - $intlcal->getLeastMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), - intlcal_get_least_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), - $intlcal->getActualMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), - intlcal_get_actual_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), - $intlcal->getMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), - intlcal_get_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH) + $intlcal->getLeastMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), + intlcal_get_least_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), + $intlcal->getActualMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), + intlcal_get_actual_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), + $intlcal->getMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), + intlcal_get_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH) ); ?> diff --git a/ext/intl/tests/calendar_getXMinimum_basic.phpt b/ext/intl/tests/calendar_getXMinimum_basic.phpt index f8f951ed9d..a1f52b361d 100644 --- a/ext/intl/tests/calendar_getXMinimum_basic.phpt +++ b/ext/intl/tests/calendar_getXMinimum_basic.phpt @@ -14,12 +14,12 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000); var_dump( - $intlcal->getGreatestMinimum(IntlCalendar::FIELD_DAY_OF_MONTH), - intlcal_get_greatest_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), - $intlcal->getActualMinimum(IntlCalendar::FIELD_DAY_OF_MONTH), - intlcal_get_actual_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), - $intlcal->getMinimum(IntlCalendar::FIELD_DAY_OF_MONTH), - intlcal_get_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH) + $intlcal->getGreatestMinimum(IntlCalendar::FIELD_DAY_OF_MONTH), + intlcal_get_greatest_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), + $intlcal->getActualMinimum(IntlCalendar::FIELD_DAY_OF_MONTH), + intlcal_get_actual_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), + $intlcal->getMinimum(IntlCalendar::FIELD_DAY_OF_MONTH), + intlcal_get_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH) ); ?> diff --git a/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt b/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt index 828f6a71d0..211636cd63 100644 --- a/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt +++ b/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt @@ -28,24 +28,24 @@ echo "error: $errno, $errstr\n"; set_error_handler('eh'); try { - var_dump(intlcal_get_least_maximum(1, 1)); + var_dump(intlcal_get_least_maximum(1, 1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_maximum(1, 1)); + var_dump(intlcal_get_maximum(1, 1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_greatest_minimum(1, -1)); + var_dump(intlcal_get_greatest_minimum(1, -1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_minimum(1, -1)); + var_dump(intlcal_get_minimum(1, -1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECTF-- Warning: IntlCalendar::getLeastMaximum(): intlcal_get_least_maximum: invalid field in %s on line %d diff --git a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt index 22a4b859ab..5921d0c0d3 100644 --- a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt +++ b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt @@ -18,67 +18,67 @@ echo "error: $errno, $errstr\n"; set_error_handler('eh'); try { - var_dump(intlcal_get($c)); + var_dump(intlcal_get($c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_maximum($c)); + var_dump(intlcal_get_actual_maximum($c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_minimum($c)); + var_dump(intlcal_get_actual_minimum($c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get($c, -1)); + var_dump(intlcal_get($c, -1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_maximum($c, -1)); + var_dump(intlcal_get_actual_maximum($c, -1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_minimum($c, -1)); + var_dump(intlcal_get_actual_minimum($c, -1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get($c, "s")); + var_dump(intlcal_get($c, "s")); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_maximum($c, "s")); + var_dump(intlcal_get_actual_maximum($c, "s")); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_minimum($c, "s")); + var_dump(intlcal_get_actual_minimum($c, "s")); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get(1)); + var_dump(intlcal_get(1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_maximum(1)); + var_dump(intlcal_get_actual_maximum(1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_minimum(1)); + var_dump(intlcal_get_actual_minimum(1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- error: 0, intlcal_get() expects exactly 2 parameters, 1 given diff --git a/ext/intl/tests/calendar_get_setRepeatedWallTimeOption_basic.phpt b/ext/intl/tests/calendar_get_setRepeatedWallTimeOption_basic.phpt index e789840e00..83e6b84645 100644 --- a/ext/intl/tests/calendar_get_setRepeatedWallTimeOption_basic.phpt +++ b/ext/intl/tests/calendar_get_setRepeatedWallTimeOption_basic.phpt @@ -18,8 +18,8 @@ var_dump($intlcal->getRepeatedWallTimeOption()); $intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2); $intlcal->set(IntlCalendar::FIELD_MINUTE, 30); var_dump( - strtotime('2012-10-28 02:30:00 +0100'), - (int)($intlcal->getTime() /1000) + strtotime('2012-10-28 02:30:00 +0100'), + (int)($intlcal->getTime() /1000) ); var_dump(intlcal_set_repeated_wall_time_option($intlcal, IntlCalendar::WALLTIME_FIRST)); @@ -27,8 +27,8 @@ var_dump(intlcal_get_repeated_wall_time_option($intlcal)); $intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2); $intlcal->set(IntlCalendar::FIELD_MINUTE, 30); var_dump( - strtotime('2012-10-28 02:30:00 +0200'), - (int)($intlcal->getTime() /1000) + strtotime('2012-10-28 02:30:00 +0200'), + (int)($intlcal->getTime() /1000) ); ?> diff --git a/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt b/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt index 4cefc4126c..2f96aaf96d 100644 --- a/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt +++ b/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt @@ -18,8 +18,8 @@ $intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2); $intlcal->set(IntlCalendar::FIELD_MINUTE, 30); echo "Should be 3h30\n"; var_dump( - $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY), - $intlcal->get(IntlCalendar::FIELD_MINUTE) + $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY), + $intlcal->get(IntlCalendar::FIELD_MINUTE) ); var_dump($intlcal->setSkippedWallTimeOption(IntlCalendar::WALLTIME_FIRST)); @@ -28,8 +28,8 @@ $intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2); $intlcal->set(IntlCalendar::FIELD_MINUTE, 30); echo "Should be 1h30\n"; var_dump( - $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY), - $intlcal->get(IntlCalendar::FIELD_MINUTE) + $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY), + $intlcal->get(IntlCalendar::FIELD_MINUTE) ); var_dump(intlcal_set_skipped_wall_time_option($intlcal, IntlCalendar::WALLTIME_NEXT_VALID)); @@ -38,8 +38,8 @@ $intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2); $intlcal->set(IntlCalendar::FIELD_MINUTE, 30); echo "Should be 3h00\n"; var_dump( - $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY), - $intlcal->get(IntlCalendar::FIELD_MINUTE) + $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY), + $intlcal->get(IntlCalendar::FIELD_MINUTE) ); diff --git a/ext/intl/tests/calendar_isEquivalentTo_basic.phpt b/ext/intl/tests/calendar_isEquivalentTo_basic.phpt index f856f6a2ad..5e78c0b92c 100644 --- a/ext/intl/tests/calendar_isEquivalentTo_basic.phpt +++ b/ext/intl/tests/calendar_isEquivalentTo_basic.phpt @@ -16,14 +16,14 @@ $intlcal4 = IntlCalendar::createInstance('Europe/Amsterdam'); $intlcal4->roll(IntlCalendar::FIELD_MONTH, true); var_dump( - "1 - 1", - $intlcal1->isEquivalentTo($intlcal1), - "1 - 2", - $intlcal1->isEquivalentTo($intlcal2), - "1 - 3", - $intlcal1->isEquivalentTo($intlcal3), - "1 - 4", - $intlcal1->isEquivalentTo($intlcal4) + "1 - 1", + $intlcal1->isEquivalentTo($intlcal1), + "1 - 2", + $intlcal1->isEquivalentTo($intlcal2), + "1 - 3", + $intlcal1->isEquivalentTo($intlcal3), + "1 - 4", + $intlcal1->isEquivalentTo($intlcal4) ); ?> diff --git a/ext/intl/tests/calendar_isEquivalentTo_error.phpt b/ext/intl/tests/calendar_isEquivalentTo_error.phpt index 9faecdd7e1..ce1536f920 100644 --- a/ext/intl/tests/calendar_isEquivalentTo_error.phpt +++ b/ext/intl/tests/calendar_isEquivalentTo_error.phpt @@ -18,35 +18,35 @@ echo "error: $errno, $errstr\n"; set_error_handler('eh'); try { - var_dump($c->isEquivalentTo(0)); + var_dump($c->isEquivalentTo(0)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->isEquivalentTo($c, 1)); + var_dump($c->isEquivalentTo($c, 1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->isEquivalentTo(1)); + var_dump($c->isEquivalentTo(1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_is_equivalent_to($c)); + var_dump(intlcal_is_equivalent_to($c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_is_equivalent_to($c, 1)); + var_dump(intlcal_is_equivalent_to($c, 1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_is_equivalent_to(1, $c)); + var_dump(intlcal_is_equivalent_to(1, $c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- error: 0, IntlCalendar::isEquivalentTo() expects parameter 1 to be IntlCalendar, int given diff --git a/ext/intl/tests/calendar_setFirstDayOfWeek_basic.phpt b/ext/intl/tests/calendar_setFirstDayOfWeek_basic.phpt index d2e0867c29..5ca4afc918 100644 --- a/ext/intl/tests/calendar_setFirstDayOfWeek_basic.phpt +++ b/ext/intl/tests/calendar_setFirstDayOfWeek_basic.phpt @@ -11,11 +11,11 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); var_dump( - IntlCalendar::DOW_TUESDAY, - $intlcal->setFirstDayOfWeek(IntlCalendar::DOW_TUESDAY), - $intlcal->getFirstDayOfWeek(), - intlcal_set_first_day_of_week($intlcal, IntlCalendar::DOW_WEDNESDAY), - $intlcal->getFirstDayOfWeek() + IntlCalendar::DOW_TUESDAY, + $intlcal->setFirstDayOfWeek(IntlCalendar::DOW_TUESDAY), + $intlcal->getFirstDayOfWeek(), + intlcal_set_first_day_of_week($intlcal, IntlCalendar::DOW_WEDNESDAY), + $intlcal->getFirstDayOfWeek() ); ?> --EXPECT-- diff --git a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt index 455bd84368..e256608531 100644 --- a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt +++ b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt @@ -11,10 +11,10 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); var_dump( - $intlcal->setMinimalDaysInFirstWeek(6), - $intlcal->getMinimalDaysInFirstWeek(), - intlcal_set_minimal_days_in_first_week($intlcal, 5), - $intlcal->getMinimalDaysInFirstWeek() + $intlcal->setMinimalDaysInFirstWeek(6), + $intlcal->getMinimalDaysInFirstWeek(), + intlcal_set_minimal_days_in_first_week($intlcal, 5), + $intlcal->getMinimalDaysInFirstWeek() ); ?> --EXPECT-- diff --git a/ext/intl/tests/calendar_setTimeZone_basic.phpt b/ext/intl/tests/calendar_setTimeZone_basic.phpt index bfd4f43a42..7e52589b81 100644 --- a/ext/intl/tests/calendar_setTimeZone_basic.phpt +++ b/ext/intl/tests/calendar_setTimeZone_basic.phpt @@ -20,7 +20,7 @@ echo "\n"; var_dump($intlcal->get(IntlCalendar::FIELD_ZONE_OFFSET)); intlcal_set_time_zone($intlcal, - IntlTimeZone::createTimeZone('GMT+05:30')); + IntlTimeZone::createTimeZone('GMT+05:30')); print_r($intlcal->getTimeZone()->getID()); echo "\n"; var_dump($intlcal->get(IntlCalendar::FIELD_ZONE_OFFSET)); diff --git a/ext/intl/tests/calendar_setTimeZone_error.phpt b/ext/intl/tests/calendar_setTimeZone_error.phpt index 3f5e479e79..c44208d1ce 100644 --- a/ext/intl/tests/calendar_setTimeZone_error.phpt +++ b/ext/intl/tests/calendar_setTimeZone_error.phpt @@ -20,25 +20,25 @@ echo "error: $errno, $errstr\n"; set_error_handler('eh'); try { - var_dump($c->setTimeZone($gmt, 2)); + var_dump($c->setTimeZone($gmt, 2)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->setTimeZone()); + var_dump($c->setTimeZone()); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try{ - var_dump(intlcal_set_time_zone($c, 1, 2)); + var_dump(intlcal_set_time_zone($c, 1, 2)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try{ - var_dump(intlcal_set_time_zone(1, $gmt)); + var_dump(intlcal_set_time_zone(1, $gmt)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- error: 0, IntlCalendar::setTimeZone() expects exactly 1 parameter, 2 given diff --git a/ext/intl/tests/calendar_setTime_basic.phpt b/ext/intl/tests/calendar_setTime_basic.phpt index 91ccc10fad..075ecaabb5 100644 --- a/ext/intl/tests/calendar_setTime_basic.phpt +++ b/ext/intl/tests/calendar_setTime_basic.phpt @@ -17,8 +17,8 @@ $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->setTime($time * 1000); var_dump( - (float)$time*1000, - $intlcal->getTime()); + (float)$time*1000, + $intlcal->getTime()); $intlcal = IntlCalendar::createInstance('UTC'); intlcal_set_time($intlcal,$time * 1000); diff --git a/ext/intl/tests/calendar_set_variation1.phpt b/ext/intl/tests/calendar_set_variation1.phpt index 8738d30711..6a78cf213c 100644 --- a/ext/intl/tests/calendar_set_variation1.phpt +++ b/ext/intl/tests/calendar_set_variation1.phpt @@ -15,16 +15,16 @@ $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->clear(); var_dump($intlcal->set(2012, 1, 29)); var_dump($intlcal->getTime(), - strtotime('2012-02-29 00:00:00 +0000') * 1000.); + strtotime('2012-02-29 00:00:00 +0000') * 1000.); //two minutes to midnight! var_dump($intlcal->set(2012, 1, 29, 23, 58)); var_dump($intlcal->getTime(), - strtotime('2012-02-29 23:58:00 +0000') * 1000.); + strtotime('2012-02-29 23:58:00 +0000') * 1000.); var_dump($intlcal->set(2012, 1, 29, 23, 58, 31)); var_dump($intlcal->getTime(), - strtotime('2012-02-29 23:58:31 +0000') * 1000.); + strtotime('2012-02-29 23:58:31 +0000') * 1000.); ?> --EXPECT-- diff --git a/ext/intl/tests/collator_asort.phpt b/ext/intl/tests/collator_asort.phpt index 0b3d0ee795..7f0af95079 100644 --- a/ext/intl/tests/collator_asort.phpt +++ b/ext/intl/tests/collator_asort.phpt @@ -31,7 +31,7 @@ function sort_arrays( $locale, $test_arrays, $sort_flag = Collator::SORT_REGULAR $res_dump = "\n" . dump( $test_array ) . "\n Result: " . dump( $res_val ); - // Preppend test signature to output string + // Preppend test signature to output string $md5 = md5( $res_dump ); global $test_num; diff --git a/ext/intl/tests/collator_asort_variant2.phpt b/ext/intl/tests/collator_asort_variant2.phpt index 08725095b5..a5a16e5aeb 100644 --- a/ext/intl/tests/collator_asort_variant2.phpt +++ b/ext/intl/tests/collator_asort_variant2.phpt @@ -31,7 +31,7 @@ function sort_arrays( $locale, $test_arrays, $sort_flag = Collator::SORT_REGULAR $res_dump = "\n" . dump( $test_array ) . "\n Result: " . dump( $res_val ); - // Preppend test signature to output string + // Preppend test signature to output string $md5 = md5( $res_dump ); global $test_num; diff --git a/ext/intl/tests/collator_create2.phpt b/ext/intl/tests/collator_create2.phpt index 292e3cebb5..27f0381992 100644 --- a/ext/intl/tests/collator_create2.phpt +++ b/ext/intl/tests/collator_create2.phpt @@ -22,7 +22,7 @@ function ut_main() '', 'root', 'uk@currency=EURO', - '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' + '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' ); foreach( $locales as $locale ) diff --git a/ext/intl/tests/collator_create3.phpt b/ext/intl/tests/collator_create3.phpt index 8d9308aca1..1060c72326 100644 --- a/ext/intl/tests/collator_create3.phpt +++ b/ext/intl/tests/collator_create3.phpt @@ -23,7 +23,7 @@ function ut_main() '', 'root', 'uk@currency=EURO', - '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' + '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' ); foreach( $locales as $locale ) diff --git a/ext/intl/tests/collator_create4.phpt b/ext/intl/tests/collator_create4.phpt index 509a89913b..dafeaf4e87 100644 --- a/ext/intl/tests/collator_create4.phpt +++ b/ext/intl/tests/collator_create4.phpt @@ -22,7 +22,7 @@ function ut_main() '', 'root', 'uk@currency=EURO', - '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' + '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' ); foreach( $locales as $locale ) diff --git a/ext/intl/tests/collator_get_sort_key.phpt b/ext/intl/tests/collator_get_sort_key.phpt index 62cc3a7b11..b7cd8bb5ec 100644 --- a/ext/intl/tests/collator_get_sort_key.phpt +++ b/ext/intl/tests/collator_get_sort_key.phpt @@ -16,11 +16,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -32,9 +32,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -42,7 +42,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'ÑÑŽÑ' + 'абг', 'абв', 'жжж', 'ÑÑŽÑ' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_get_sort_key_variant2.phpt b/ext/intl/tests/collator_get_sort_key_variant2.phpt index 3c526fbc3c..ab3fc64e32 100644 --- a/ext/intl/tests/collator_get_sort_key_variant2.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant2.phpt @@ -16,11 +16,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -32,9 +32,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -42,7 +42,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'ÑÑŽÑ' + 'абг', 'абв', 'жжж', 'ÑÑŽÑ' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_get_sort_key_variant3.phpt b/ext/intl/tests/collator_get_sort_key_variant3.phpt index f4cb88e3e7..9e84ad4168 100644 --- a/ext/intl/tests/collator_get_sort_key_variant3.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant3.phpt @@ -16,11 +16,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -32,9 +32,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -42,7 +42,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'ÑÑŽÑ' + 'абг', 'абв', 'жжж', 'ÑÑŽÑ' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_get_sort_key_variant4.phpt b/ext/intl/tests/collator_get_sort_key_variant4.phpt index bd7af6a284..078a385d5c 100644 --- a/ext/intl/tests/collator_get_sort_key_variant4.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant4.phpt @@ -16,11 +16,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -32,9 +32,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -42,7 +42,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'ÑÑŽÑ' + 'абг', 'абв', 'жжж', 'ÑÑŽÑ' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_get_sort_key_variant5.phpt b/ext/intl/tests/collator_get_sort_key_variant5.phpt index c7717389b7..38d96cf2d8 100644 --- a/ext/intl/tests/collator_get_sort_key_variant5.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant5.phpt @@ -16,11 +16,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -32,9 +32,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -42,7 +42,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'ÑÑŽÑ' + 'абг', 'абв', 'жжж', 'ÑÑŽÑ' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_get_sort_key_variant6.phpt b/ext/intl/tests/collator_get_sort_key_variant6.phpt index 78c74f546a..54e7486816 100644 --- a/ext/intl/tests/collator_get_sort_key_variant6.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant6.phpt @@ -16,11 +16,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -32,9 +32,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -42,7 +42,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'ÑÑŽÑ' + 'абг', 'абв', 'жжж', 'ÑÑŽÑ' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_get_sort_key_variant7.phpt b/ext/intl/tests/collator_get_sort_key_variant7.phpt index e009d0e663..8ac0154d4f 100644 --- a/ext/intl/tests/collator_get_sort_key_variant7.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant7.phpt @@ -15,11 +15,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -31,9 +31,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -41,7 +41,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'ÑÑŽÑ' + 'абг', 'абв', 'жжж', 'ÑÑŽÑ' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_sort.phpt b/ext/intl/tests/collator_sort.phpt index 4f7a12352a..1c4cb78cc8 100644 --- a/ext/intl/tests/collator_sort.phpt +++ b/ext/intl/tests/collator_sort.phpt @@ -32,7 +32,7 @@ function sort_arrays( $locale, $arrays, $sort_flag = Collator::SORT_REGULAR ) $res_dump = "\n" . dump( $array ) . "\n Result: " . dump( $res_val ); - // Preppend test signature to output string + // Preppend test signature to output string $md5 = md5( $res_dump ); global $test_num; diff --git a/ext/intl/tests/collator_sort_variant2.phpt b/ext/intl/tests/collator_sort_variant2.phpt index abb302eda6..3838c881ad 100644 --- a/ext/intl/tests/collator_sort_variant2.phpt +++ b/ext/intl/tests/collator_sort_variant2.phpt @@ -32,7 +32,7 @@ function sort_arrays( $locale, $arrays, $sort_flag = Collator::SORT_REGULAR ) $res_dump = "\n" . dump( $array ) . "\n Result: " . dump( $res_val ); - // Preppend test signature to output string + // Preppend test signature to output string $md5 = md5( $res_dump ); global $test_num; diff --git a/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt b/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt index 08aa01e90b..a1c33cf230 100644 --- a/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt +++ b/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt @@ -20,25 +20,25 @@ var_dump($codepoint_it->getLastCodePoint()); //before the last read codepoint is moving backwards $p = $codepoint_it->first(); while ($p != IntlBreakIterator::DONE) { - $c = $codepoint_it->getLastCodePoint(); - if ($c > 0) - var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint())); - else - var_dump($c); - //it's a post-increment operation as to the codepoint, i.e., it gives the codepoint - //starting at the initial position and only then moves the pointer forward - $p = $codepoint_it->next(); + $c = $codepoint_it->getLastCodePoint(); + if ($c > 0) + var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint())); + else + var_dump($c); + //it's a post-increment operation as to the codepoint, i.e., it gives the codepoint + //starting at the initial position and only then moves the pointer forward + $p = $codepoint_it->next(); } echo "Now backwards\n"; $p = $codepoint_it->last(); while ($p != IntlBreakIterator::DONE) { - $c = $codepoint_it->getLastCodePoint(); - if ($c > 0) - var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint())); - else - var_dump($c); - $p = $codepoint_it->previous(); + $c = $codepoint_it->getLastCodePoint(); + if ($c > 0) + var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint())); + else + var_dump($c); + $p = $codepoint_it->previous(); } diff --git a/ext/intl/tests/cpbi_parts_iterator.phpt b/ext/intl/tests/cpbi_parts_iterator.phpt index 82fea6f6e1..329c88c8b9 100644 --- a/ext/intl/tests/cpbi_parts_iterator.phpt +++ b/ext/intl/tests/cpbi_parts_iterator.phpt @@ -15,8 +15,8 @@ $it = IntlBreakIterator::createCodePointInstance()->getPartsIterator(); $it->getBreakIterator()->setText($text); foreach ($it as $k => $v) { - echo "$k. $v (" . sprintf("U+%04X", $it->getBreakIterator()->getLastCodePoint()) . - ") at {$it->getBreakIterator()->current()}\r\n"; + echo "$k. $v (" . sprintf("U+%04X", $it->getBreakIterator()->getLastCodePoint()) . + ") at {$it->getBreakIterator()->current()}\r\n"; } ?> diff --git a/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt index 1b346abf67..086bc01340 100644 --- a/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt +++ b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt @@ -11,23 +11,23 @@ ini_set("intl.default_locale", "pt_PT"); ini_set("date.timezone", 'Atlantic/Azores'); function print_exception($e) { - echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; } try { - var_dump(new IntlDateFormatter(NULL, 0, 0, 'bad timezone')); + var_dump(new IntlDateFormatter(NULL, 0, 0, 'bad timezone')); } catch (IntlException $e) { - print_exception($e); + print_exception($e); } try { - var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, 3)); + var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, 3)); } catch (IntlException $e) { - print_exception($e); + print_exception($e); } try { - var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, new stdclass)); + var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, new stdclass)); } catch (IntlException $e) { - print_exception($e); + print_exception($e); } ?> --EXPECTF-- diff --git a/ext/intl/tests/dateformat_calendars.phpt b/ext/intl/tests/dateformat_calendars.phpt index 83c256b713..1483f61058 100644 --- a/ext/intl/tests/dateformat_calendars.phpt +++ b/ext/intl/tests/dateformat_calendars.phpt @@ -11,29 +11,29 @@ if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> ini_set("intl.error_level", E_WARNING); $fmt1 = new IntlDateFormatter('en_US', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::TRADITIONAL); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); $fmt2 = new IntlDateFormatter('en_US', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::GREGORIAN); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::GREGORIAN); $fmt3 = new IntlDateFormatter('en_US@calendar=hebrew', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::TRADITIONAL); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000'))); var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000'))); var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000'))); new IntlDateFormatter('en_US@calendar=hebrew', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - -1); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + -1); ?> ==DONE== --EXPECTF-- diff --git a/ext/intl/tests/dateformat_calendars_variant2.phpt b/ext/intl/tests/dateformat_calendars_variant2.phpt index 8d051abe59..895d39094a 100644 --- a/ext/intl/tests/dateformat_calendars_variant2.phpt +++ b/ext/intl/tests/dateformat_calendars_variant2.phpt @@ -12,29 +12,29 @@ if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> ini_set("intl.error_level", E_WARNING); $fmt1 = new IntlDateFormatter('en_US', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::TRADITIONAL); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); $fmt2 = new IntlDateFormatter('en_US', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::GREGORIAN); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::GREGORIAN); $fmt3 = new IntlDateFormatter('en_US@calendar=hebrew', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::TRADITIONAL); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000'))); var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000'))); var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000'))); new IntlDateFormatter('en_US@calendar=hebrew', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - -1); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + -1); ?> ==DONE== --EXPECTF-- diff --git a/ext/intl/tests/dateformat_calendars_variant3.phpt b/ext/intl/tests/dateformat_calendars_variant3.phpt index 65597d6b45..99e153e290 100644 --- a/ext/intl/tests/dateformat_calendars_variant3.phpt +++ b/ext/intl/tests/dateformat_calendars_variant3.phpt @@ -11,29 +11,29 @@ if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> ini_set("intl.error_level", E_WARNING); $fmt1 = new IntlDateFormatter('en_US', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::TRADITIONAL); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); $fmt2 = new IntlDateFormatter('en_US', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::GREGORIAN); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::GREGORIAN); $fmt3 = new IntlDateFormatter('en_US@calendar=hebrew', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::TRADITIONAL); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000'))); var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000'))); var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000'))); new IntlDateFormatter('en_US@calendar=hebrew', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - -1); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + -1); ?> ==DONE== --EXPECTF-- diff --git a/ext/intl/tests/dateformat_clone_bad_obj.phpt b/ext/intl/tests/dateformat_clone_bad_obj.phpt index f9791004f3..3425a1b0f8 100644 --- a/ext/intl/tests/dateformat_clone_bad_obj.phpt +++ b/ext/intl/tests/dateformat_clone_bad_obj.phpt @@ -6,14 +6,14 @@ Cloning unconstructed IntlDateFormatter <?php class A extends IntlDateFormatter { - function __construct() {} + function __construct() {} } $a = new A; try { - $b = clone $a; + $b = clone $a; } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } --EXPECTF-- string(%s) "Cannot clone unconstructed IntlDateFormatter" diff --git a/ext/intl/tests/dateformat_format.phpt b/ext/intl/tests/dateformat_format.phpt index 5b121558a0..9cdb69b848 100644 --- a/ext/intl/tests/dateformat_format.phpt +++ b/ext/intl/tests/dateformat_format.phpt @@ -15,13 +15,13 @@ datefmt_format_code() function ut_main() { - $timezone = 'GMT-10:00'; + $timezone = 'GMT-10:00'; - $locale_arr = array ( - 'en_US' - ); + $locale_arr = array ( + 'en_US' + ); - $datetype_arr = array ( + $datetype_arr = array ( IntlDateFormatter::FULL, IntlDateFormatter::LONG, IntlDateFormatter::MEDIUM, @@ -32,34 +32,34 @@ function ut_main() $res_str = ''; - $time_arr = array ( - 0, - -1200000, - 1200000, - 2200000000.0, - -2200000000.0, - 90099999, - 3600, - -3600 - ); - - $localtime_arr1 = array ( - 'tm_sec' => 24 , - 'tm_min' => 3, - 'tm_hour' => 19, - 'tm_mday' => 3, - 'tm_mon' => 3, - 'tm_year' => 105, - ); - $localtime_arr2 = array ( - 'tm_sec' => 21, - 'tm_min' => 5, - 'tm_hour' => 7, - 'tm_mday' => 13, - 'tm_mon' => 4, - 'tm_year' => 205, - ); - $localtime_arr3 = array ( + $time_arr = array ( + 0, + -1200000, + 1200000, + 2200000000.0, + -2200000000.0, + 90099999, + 3600, + -3600 + ); + + $localtime_arr1 = array ( + 'tm_sec' => 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 4, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( 'tm_sec' => 11, 'tm_min' => 13, 'tm_hour' => 0, @@ -68,80 +68,80 @@ function ut_main() 'tm_year' => -5 ); - $localtime_arr = array ( - $localtime_arr1, - $localtime_arr2, - $localtime_arr3 - ); - - $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); - $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); - $d2->setTimezone(new DateTimeZone("PDT")); - $dates = array( - $d1, - $d2, - new StdClass(), - ); - - //Test format with input as a timestamp : integer - foreach( $time_arr as $timestamp_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput timestamp is : $timestamp_entry"; - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); - $formatted = ut_datefmt_format( $fmt , $timestamp_entry); - $res_str .= "\nFormatted timestamp is : $formatted"; - } - } - } - - //Test format with input as a localtime :array - foreach( $localtime_arr as $localtime_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput localtime is : "; - foreach( $localtime_entry as $key => $value){ + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); + $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); + $d2->setTimezone(new DateTimeZone("PDT")); + $dates = array( + $d1, + $d2, + new StdClass(), + ); + + //Test format with input as a timestamp : integer + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + } + } + } + + //Test format with input as a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ $res_str .= "$key : '$value' , "; - } - - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); - $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted localtime_array is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - } - } - } - - foreach($dates as $date_entry) { - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\n------------"; - $res_str .= "\nDate is: ".var_export($date_entry, true); - $res_str .= "\n------------"; - - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); - $formatted1 = ut_datefmt_format( $fmt , $date_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted DateTime is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - } - } - } - - return $res_str; + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + foreach($dates as $date_entry) { + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\n------------"; + $res_str .= "\nDate is: ".var_export($date_entry, true); + $res_str .= "\n------------"; + + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $date_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted DateTime is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_format_parse.phpt b/ext/intl/tests/dateformat_format_parse.phpt index 68f54eb7e7..ac7c5f8df9 100644 --- a/ext/intl/tests/dateformat_format_parse.phpt +++ b/ext/intl/tests/dateformat_format_parse.phpt @@ -13,13 +13,13 @@ datefmt_format_code() and datefmt_parse_code() function ut_main() { - $timezone = 'GMT+05:00'; + $timezone = 'GMT+05:00'; - $locale_arr = array ( - 'en_US' - ); + $locale_arr = array ( + 'en_US' + ); - $datetype_arr = array ( + $datetype_arr = array ( IntlDateFormatter::FULL, IntlDateFormatter::LONG, IntlDateFormatter::MEDIUM @@ -28,34 +28,34 @@ function ut_main() $res_str = ''; - $time_arr = array ( - 0, - -1200000, - 1200000, - 2200000000, - -2200000000, - 90099999, - 3600, - -3600 - ); - - $localtime_arr1 = array ( - 'tm_sec' => 24 , - 'tm_min' => 3, - 'tm_hour' => 19, - 'tm_mday' => 3, - 'tm_mon' => 3, - 'tm_year' => 105, - ); - $localtime_arr2 = array ( - 'tm_sec' => 21, - 'tm_min' => 5, - 'tm_hour' => 7, - 'tm_mday' => 13, - 'tm_mon' => 7, - 'tm_year' => 205, - ); - $localtime_arr3 = array ( + $time_arr = array ( + 0, + -1200000, + 1200000, + 2200000000, + -2200000000, + 90099999, + 3600, + -3600 + ); + + $localtime_arr1 = array ( + 'tm_sec' => 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 7, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( 'tm_sec' => 11, 'tm_min' => 13, 'tm_hour' => 0, @@ -64,72 +64,72 @@ function ut_main() 'tm_year' => -5 ); - $localtime_arr = array ( - $localtime_arr1, - $localtime_arr2, - $localtime_arr3 - ); - - //Test format and parse with a timestamp : long - foreach( $time_arr as $timestamp_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput timestamp is : $timestamp_entry"; - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); - $formatted = ut_datefmt_format( $fmt , $timestamp_entry); - $res_str .= "\nFormatted timestamp is : $formatted"; - $parsed = ut_datefmt_parse( $fmt , $formatted); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nParsed timestamp is : $parsed"; - }else{ - $res_str .= "\nError while parsing as: '".intl_get_error_message()."'"; - } - } - } - } - - //Test format and parse with a localtime :array - foreach( $localtime_arr as $localtime_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput localtime is : "; - foreach( $localtime_entry as $key => $value){ + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + //Test format and parse with a timestamp : long + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + $parsed = ut_datefmt_parse( $fmt , $formatted); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nParsed timestamp is : $parsed"; + }else{ + $res_str .= "\nError while parsing as: '".intl_get_error_message()."'"; + } + } + } + } + + //Test format and parse with a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ $res_str .= "$key : '$value' , "; - } - - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); - $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted localtime_array is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - //Parsing - $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 ); - - if( $parsed_arr){ - $res_str .= "\nParsed array is: "; - foreach( $parsed_arr as $key => $value){ - $res_str .= "$key : '$value' , "; - } - } + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + //Parsing + $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 ); + + if( $parsed_arr){ + $res_str .= "\nParsed array is: "; + foreach( $parsed_arr as $key => $value){ + $res_str .= "$key : '$value' , "; + } + } /* - else{ - //$res_str .= "No values found from LocaleTime parsing."; - $res_str .= "\tError : '".intl_get_error_message()."'"; - } + else{ + //$res_str .= "No values found from LocaleTime parsing."; + $res_str .= "\tError : '".intl_get_error_message()."'"; + } */ - } - } - } + } + } + } - return $res_str; + return $res_str; } diff --git a/ext/intl/tests/dateformat_format_parse_version2.phpt b/ext/intl/tests/dateformat_format_parse_version2.phpt index f672cd6d22..1820e52e91 100644 --- a/ext/intl/tests/dateformat_format_parse_version2.phpt +++ b/ext/intl/tests/dateformat_format_parse_version2.phpt @@ -13,13 +13,13 @@ datefmt_format_code() and datefmt_parse_code() function ut_main() { - $timezone = 'GMT+05:00'; + $timezone = 'GMT+05:00'; - $locale_arr = array ( - 'en_US' - ); + $locale_arr = array ( + 'en_US' + ); - $datetype_arr = array ( + $datetype_arr = array ( IntlDateFormatter::FULL, IntlDateFormatter::LONG, IntlDateFormatter::MEDIUM @@ -28,34 +28,34 @@ function ut_main() $res_str = ''; - $time_arr = array ( - 0, - -1200000, - 1200000, - 2200000000, - -2200000000, - 90099999, - 3600, - -3600 - ); - - $localtime_arr1 = array ( - 'tm_sec' => 24 , - 'tm_min' => 3, - 'tm_hour' => 19, - 'tm_mday' => 3, - 'tm_mon' => 3, - 'tm_year' => 105, - ); - $localtime_arr2 = array ( - 'tm_sec' => 21, - 'tm_min' => 5, - 'tm_hour' => 7, - 'tm_mday' => 13, - 'tm_mon' => 7, - 'tm_year' => 205, - ); - $localtime_arr3 = array ( + $time_arr = array ( + 0, + -1200000, + 1200000, + 2200000000, + -2200000000, + 90099999, + 3600, + -3600 + ); + + $localtime_arr1 = array ( + 'tm_sec' => 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 7, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( 'tm_sec' => 11, 'tm_min' => 13, 'tm_hour' => 0, @@ -64,72 +64,72 @@ function ut_main() 'tm_year' => -5 ); - $localtime_arr = array ( - $localtime_arr1, - $localtime_arr2, - $localtime_arr3 - ); - - //Test format and parse with a timestamp : long - foreach( $time_arr as $timestamp_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput timestamp is : $timestamp_entry"; - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); - $formatted = ut_datefmt_format( $fmt , $timestamp_entry); - $res_str .= "\nFormatted timestamp is : $formatted"; - $parsed = ut_datefmt_parse( $fmt , $formatted); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nParsed timestamp is : $parsed"; - }else{ - $res_str .= "\nError while parsing as: '".intl_get_error_message()."'"; - } - } - } - } - - //Test format and parse with a localtime :array - foreach( $localtime_arr as $localtime_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput localtime is : "; - foreach( $localtime_entry as $key => $value){ + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + //Test format and parse with a timestamp : long + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + $parsed = ut_datefmt_parse( $fmt , $formatted); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nParsed timestamp is : $parsed"; + }else{ + $res_str .= "\nError while parsing as: '".intl_get_error_message()."'"; + } + } + } + } + + //Test format and parse with a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ $res_str .= "$key : '$value' , "; - } - - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); - $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted localtime_array is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - //Parsing - $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 ); - - if( $parsed_arr){ - $res_str .= "\nParsed array is: "; - foreach( $parsed_arr as $key => $value){ - $res_str .= "$key : '$value' , "; - } - } + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + //Parsing + $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 ); + + if( $parsed_arr){ + $res_str .= "\nParsed array is: "; + foreach( $parsed_arr as $key => $value){ + $res_str .= "$key : '$value' , "; + } + } /* - else{ - //$res_str .= "No values found from LocaleTime parsing."; - $res_str .= "\tError : '".intl_get_error_message()."'"; - } + else{ + //$res_str .= "No values found from LocaleTime parsing."; + $res_str .= "\tError : '".intl_get_error_message()."'"; + } */ - } - } - } + } + } + } - return $res_str; + return $res_str; } diff --git a/ext/intl/tests/dateformat_format_variant2.phpt b/ext/intl/tests/dateformat_format_variant2.phpt index d61b20b03a..b02cfcd9e6 100644 --- a/ext/intl/tests/dateformat_format_variant2.phpt +++ b/ext/intl/tests/dateformat_format_variant2.phpt @@ -15,13 +15,13 @@ datefmt_format_code() function ut_main() { - $timezone = 'GMT-10:00'; + $timezone = 'GMT-10:00'; - $locale_arr = array ( - 'en_US' - ); + $locale_arr = array ( + 'en_US' + ); - $datetype_arr = array ( + $datetype_arr = array ( IntlDateFormatter::FULL, IntlDateFormatter::LONG, IntlDateFormatter::MEDIUM, @@ -32,34 +32,34 @@ function ut_main() $res_str = ''; - $time_arr = array ( - 0, - -1200000, - 1200000, - 2200000000.0, - -2200000000.0, - 90099999, - 3600, - -3600 - ); - - $localtime_arr1 = array ( - 'tm_sec' => 24 , - 'tm_min' => 3, - 'tm_hour' => 19, - 'tm_mday' => 3, - 'tm_mon' => 3, - 'tm_year' => 105, - ); - $localtime_arr2 = array ( - 'tm_sec' => 21, - 'tm_min' => 5, - 'tm_hour' => 7, - 'tm_mday' => 13, - 'tm_mon' => 4, - 'tm_year' => 205, - ); - $localtime_arr3 = array ( + $time_arr = array ( + 0, + -1200000, + 1200000, + 2200000000.0, + -2200000000.0, + 90099999, + 3600, + -3600 + ); + + $localtime_arr1 = array ( + 'tm_sec' => 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 4, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( 'tm_sec' => 11, 'tm_min' => 13, 'tm_hour' => 0, @@ -68,80 +68,80 @@ function ut_main() 'tm_year' => -5 ); - $localtime_arr = array ( - $localtime_arr1, - $localtime_arr2, - $localtime_arr3 - ); - - $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); - $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); - $d2->setTimezone(new DateTimeZone("PDT")); - $dates = array( - $d1, - $d2, - new StdClass(), - ); - - //Test format with input as a timestamp : integer - foreach( $time_arr as $timestamp_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput timestamp is : $timestamp_entry"; - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); - $formatted = ut_datefmt_format( $fmt , $timestamp_entry); - $res_str .= "\nFormatted timestamp is : $formatted"; - } - } - } - - //Test format with input as a localtime :array - foreach( $localtime_arr as $localtime_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput localtime is : "; - foreach( $localtime_entry as $key => $value){ + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); + $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); + $d2->setTimezone(new DateTimeZone("PDT")); + $dates = array( + $d1, + $d2, + new StdClass(), + ); + + //Test format with input as a timestamp : integer + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + } + } + } + + //Test format with input as a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ $res_str .= "$key : '$value' , "; - } - - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); - $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted localtime_array is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - } - } - } - - foreach($dates as $date_entry) { - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\n------------"; - $res_str .= "\nDate is: ".var_export($date_entry, true); - $res_str .= "\n------------"; - - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); - $formatted1 = ut_datefmt_format( $fmt , $date_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted DateTime is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - } - } - } - - return $res_str; + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + foreach($dates as $date_entry) { + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\n------------"; + $res_str .= "\nDate is: ".var_export($date_entry, true); + $res_str .= "\n------------"; + + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $date_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted DateTime is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_format_variant3.phpt b/ext/intl/tests/dateformat_format_variant3.phpt index e2f9ec81b0..52705a3f03 100644 --- a/ext/intl/tests/dateformat_format_variant3.phpt +++ b/ext/intl/tests/dateformat_format_variant3.phpt @@ -15,13 +15,13 @@ datefmt_format_code() function ut_main() { - $timezone = 'GMT-10:00'; + $timezone = 'GMT-10:00'; - $locale_arr = array ( - 'en_US' - ); + $locale_arr = array ( + 'en_US' + ); - $datetype_arr = array ( + $datetype_arr = array ( IntlDateFormatter::FULL, IntlDateFormatter::LONG, IntlDateFormatter::MEDIUM, @@ -32,34 +32,34 @@ function ut_main() $res_str = ''; - $time_arr = array ( - 0, - -1200000, - 1200000, - 2200000000.0, - -2200000000.0, - 90099999, - 3600, - -3600 - ); - - $localtime_arr1 = array ( - 'tm_sec' => 24 , - 'tm_min' => 3, - 'tm_hour' => 19, - 'tm_mday' => 3, - 'tm_mon' => 3, - 'tm_year' => 105, - ); - $localtime_arr2 = array ( - 'tm_sec' => 21, - 'tm_min' => 5, - 'tm_hour' => 7, - 'tm_mday' => 13, - 'tm_mon' => 4, - 'tm_year' => 205, - ); - $localtime_arr3 = array ( + $time_arr = array ( + 0, + -1200000, + 1200000, + 2200000000.0, + -2200000000.0, + 90099999, + 3600, + -3600 + ); + + $localtime_arr1 = array ( + 'tm_sec' => 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 4, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( 'tm_sec' => 11, 'tm_min' => 13, 'tm_hour' => 0, @@ -68,80 +68,80 @@ function ut_main() 'tm_year' => -5 ); - $localtime_arr = array ( - $localtime_arr1, - $localtime_arr2, - $localtime_arr3 - ); - - $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); - $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); - $d2->setTimezone(new DateTimeZone("PDT")); - $dates = array( - $d1, - $d2, - new StdClass(), - ); - - //Test format with input as a timestamp : integer - foreach( $time_arr as $timestamp_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput timestamp is : $timestamp_entry"; - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); - $formatted = ut_datefmt_format( $fmt , $timestamp_entry); - $res_str .= "\nFormatted timestamp is : $formatted"; - } - } - } - - //Test format with input as a localtime :array - foreach( $localtime_arr as $localtime_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput localtime is : "; - foreach( $localtime_entry as $key => $value){ + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); + $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); + $d2->setTimezone(new DateTimeZone("PDT")); + $dates = array( + $d1, + $d2, + new StdClass(), + ); + + //Test format with input as a timestamp : integer + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + } + } + } + + //Test format with input as a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ $res_str .= "$key : '$value' , "; - } - - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); - $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted localtime_array is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - } - } - } - - foreach($dates as $date_entry) { - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\n------------"; - $res_str .= "\nDate is: ".var_export($date_entry, true); - $res_str .= "\n------------"; - - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); - $formatted1 = ut_datefmt_format( $fmt , $date_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted DateTime is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - } - } - } - - return $res_str; + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + foreach($dates as $date_entry) { + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\n------------"; + $res_str .= "\nDate is: ".var_export($date_entry, true); + $res_str .= "\n------------"; + + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $date_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted DateTime is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_get_datetype.phpt b/ext/intl/tests/dateformat_get_datetype.phpt index ec03bb68f4..27c9188d10 100644 --- a/ext/intl/tests/dateformat_get_datetype.phpt +++ b/ext/intl/tests/dateformat_get_datetype.phpt @@ -12,26 +12,26 @@ datefmt_get_datetype_code() function ut_main() { - $datetype_arr = array ( - IntlDateFormatter::FULL, - IntlDateFormatter::LONG, - IntlDateFormatter::MEDIUM, - IntlDateFormatter::SHORT, - IntlDateFormatter::NONE - ); - - $res_str = ''; - - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nCreating IntlDateFormatter with date_type = $datetype_entry"; - $fmt = ut_datefmt_create( "de-DE", $datetype_entry , IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); - $date_type = ut_datefmt_get_datetype( $fmt); - $res_str .= "\nAfter call to get_datetype : datetype= $date_type"; - $res_str .= "\n"; - } - - return $res_str; + $datetype_arr = array ( + IntlDateFormatter::FULL, + IntlDateFormatter::LONG, + IntlDateFormatter::MEDIUM, + IntlDateFormatter::SHORT, + IntlDateFormatter::NONE + ); + + $res_str = ''; + + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nCreating IntlDateFormatter with date_type = $datetype_entry"; + $fmt = ut_datefmt_create( "de-DE", $datetype_entry , IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); + $date_type = ut_datefmt_get_datetype( $fmt); + $res_str .= "\nAfter call to get_datetype : datetype= $date_type"; + $res_str .= "\n"; + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_get_locale.phpt b/ext/intl/tests/dateformat_get_locale.phpt index aa7a0a46c3..2078c7b6db 100644 --- a/ext/intl/tests/dateformat_get_locale.phpt +++ b/ext/intl/tests/dateformat_get_locale.phpt @@ -14,31 +14,31 @@ if (PHP_INT_SIZE != 8) die('skip 64-bit only'); function ut_main() { - $locale_arr = array ( - 'de-DE', - 'sl-IT-nedis', - 'en_UK', - 'hi' - ); - - $res_str = ''; - - foreach( $locale_arr as $locale_entry ) - { - $res_str .= "\nCreating IntlDateFormatter with locale = $locale_entry"; - $fmt = ut_datefmt_create( $locale_entry , IntlDateFormatter::SHORT,IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); - $locale = ut_datefmt_get_locale( $fmt , 1); - $res_str .= "\nAfter call to get_locale : locale= $locale"; - $res_str .= "\n"; - } - $badvals = array(100, -1, 4294901761); - foreach($badvals as $badval) { - if(ut_datefmt_get_locale($fmt, $badval)) { - $res_str .= "datefmt_get_locale should return false for bad argument $badval\n"; - } - } - - return $res_str; + $locale_arr = array ( + 'de-DE', + 'sl-IT-nedis', + 'en_UK', + 'hi' + ); + + $res_str = ''; + + foreach( $locale_arr as $locale_entry ) + { + $res_str .= "\nCreating IntlDateFormatter with locale = $locale_entry"; + $fmt = ut_datefmt_create( $locale_entry , IntlDateFormatter::SHORT,IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); + $locale = ut_datefmt_get_locale( $fmt , 1); + $res_str .= "\nAfter call to get_locale : locale= $locale"; + $res_str .= "\n"; + } + $badvals = array(100, -1, 4294901761); + foreach($badvals as $badval) { + if(ut_datefmt_get_locale($fmt, $badval)) { + $res_str .= "datefmt_get_locale should return false for bad argument $badval\n"; + } + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_get_set_pattern2.phpt b/ext/intl/tests/dateformat_get_set_pattern2.phpt index b741906ad6..11a5899883 100644 --- a/ext/intl/tests/dateformat_get_set_pattern2.phpt +++ b/ext/intl/tests/dateformat_get_set_pattern2.phpt @@ -14,7 +14,7 @@ function ut_main() { $pattern_arr = array ( 'DD-MM-YYYY hh:mm:ss', - 'yyyy-DDD.hh:mm:ss z', + 'yyyy-DDD.hh:mm:ss z', "yyyy/MM/dd", "yyyyMMdd" ); @@ -27,8 +27,8 @@ function ut_main() $fmt = ut_datefmt_create( "en-US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/New_York', IntlDateFormatter::GREGORIAN , $start_pattern ); $pattern = ut_datefmt_get_pattern( $fmt); $res_str .= "\nAfter call to get_pattern : pattern= $pattern"; - $formatted = ut_datefmt_format($fmt,0); - $res_str .= "\nResult of formatting timestamp=0 is : \n$formatted"; + $formatted = ut_datefmt_format($fmt,0); + $res_str .= "\nResult of formatting timestamp=0 is : \n$formatted"; foreach( $pattern_arr as $pattern_entry ) @@ -38,7 +38,7 @@ function ut_main() ut_datefmt_set_pattern( $fmt , $pattern_entry ); $pattern = ut_datefmt_get_pattern( $fmt); $res_str .= "\nAfter call to get_pattern : pattern= $pattern"; - $formatted = ut_datefmt_format($fmt,0); + $formatted = ut_datefmt_format($fmt,0); $res_str .= "\nResult of formatting timestamp=0 with the new pattern is : \n$formatted"; $res_str .= "\n"; diff --git a/ext/intl/tests/dateformat_get_timetype.phpt b/ext/intl/tests/dateformat_get_timetype.phpt index cca3c6f96a..59a8f5e112 100644 --- a/ext/intl/tests/dateformat_get_timetype.phpt +++ b/ext/intl/tests/dateformat_get_timetype.phpt @@ -12,26 +12,26 @@ datefmt_get_timetype_code() function ut_main() { - $timetype_arr = array ( - IntlDateFormatter::FULL, - IntlDateFormatter::LONG, - IntlDateFormatter::MEDIUM, - IntlDateFormatter::SHORT, - IntlDateFormatter::NONE - ); - - $res_str = ''; - - foreach( $timetype_arr as $timetype_entry ) - { - $res_str .= "\nCreating IntlDateFormatter with time_type = $timetype_entry"; - $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, $timetype_entry ,'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); - $time_type = ut_datefmt_get_timetype( $fmt); - $res_str .= "\nAfter call to get_timetype : timetype= $time_type"; - $res_str .= "\n"; - } - - return $res_str; + $timetype_arr = array ( + IntlDateFormatter::FULL, + IntlDateFormatter::LONG, + IntlDateFormatter::MEDIUM, + IntlDateFormatter::SHORT, + IntlDateFormatter::NONE + ); + + $res_str = ''; + + foreach( $timetype_arr as $timetype_entry ) + { + $res_str .= "\nCreating IntlDateFormatter with time_type = $timetype_entry"; + $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, $timetype_entry ,'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); + $time_type = ut_datefmt_get_timetype( $fmt); + $res_str .= "\nAfter call to get_timetype : timetype= $time_type"; + $res_str .= "\n"; + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_get_timezone_id.phpt b/ext/intl/tests/dateformat_get_timezone_id.phpt index f529614f21..2df0ba40b1 100644 --- a/ext/intl/tests/dateformat_get_timezone_id.phpt +++ b/ext/intl/tests/dateformat_get_timezone_id.phpt @@ -15,24 +15,24 @@ intl.error_level=E_WARNING function ut_main() { - $timezone_id_arr = array ( - 'America/New_York', - 'US/Pacific', - 'US/Central' - ); - - $res_str = ''; - - foreach( $timezone_id_arr as $timezone_id_entry ) - { - $res_str .= "\nCreating IntlDateFormatter with timezone_id = $timezone_id_entry"; - $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, $timezone_id_entry , IntlDateFormatter::GREGORIAN ); - $timezone_id = ut_datefmt_get_timezone_id( $fmt); - $res_str .= "\nAfter call to get_timezone_id : timezone_id= $timezone_id"; - $res_str .= "\n"; - } - - return $res_str; + $timezone_id_arr = array ( + 'America/New_York', + 'US/Pacific', + 'US/Central' + ); + + $res_str = ''; + + foreach( $timezone_id_arr as $timezone_id_entry ) + { + $res_str .= "\nCreating IntlDateFormatter with timezone_id = $timezone_id_entry"; + $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, $timezone_id_entry , IntlDateFormatter::GREGORIAN ); + $timezone_id = ut_datefmt_get_timezone_id( $fmt); + $res_str .= "\nAfter call to get_timezone_id : timezone_id= $timezone_id"; + $res_str .= "\n"; + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_is_set_lenient.phpt b/ext/intl/tests/dateformat_is_set_lenient.phpt index b78396b77f..4725ff8cb6 100644 --- a/ext/intl/tests/dateformat_is_set_lenient.phpt +++ b/ext/intl/tests/dateformat_is_set_lenient.phpt @@ -15,54 +15,54 @@ function ut_main() $res_str = ''; - //Create + //Create $fmt = ut_datefmt_create( "en-US", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT , 'America/New_York', IntlDateFormatter::GREGORIAN ); $res_str .= "\nIntlDateFormatter Created.\n"; $resLenient1 = ut_datefmt_is_lenient( $fmt); $res_str .= "After call to get_lenient : lenient= "; - if( $resLenient1){ - $res_str .= "TRUE\n"; - }else{ - $res_str .= "FALSE\n"; - } + if( $resLenient1){ + $res_str .= "TRUE\n"; + }else{ + $res_str .= "FALSE\n"; + } - //Set and test + //Set and test $res_str .= "--------------------\n"; $isLenient = TRUE; - $res_str .= "Setting IntlDateFormatter with lenient = "; - if( $isLenient){ - $res_str .= "TRUE\n"; - }else{ - $res_str .= "FALSE\n"; - } - ut_datefmt_set_lenient( $fmt , $isLenient ); - $resLenient = ut_datefmt_is_lenient( $fmt); - $res_str .= "After call to is_lenient : lenient= "; - if( $resLenient){ - $res_str .= "TRUE\n"; - }else{ - $res_str .= "FALSE\n"; - } + $res_str .= "Setting IntlDateFormatter with lenient = "; + if( $isLenient){ + $res_str .= "TRUE\n"; + }else{ + $res_str .= "FALSE\n"; + } + ut_datefmt_set_lenient( $fmt , $isLenient ); + $resLenient = ut_datefmt_is_lenient( $fmt); + $res_str .= "After call to is_lenient : lenient= "; + if( $resLenient){ + $res_str .= "TRUE\n"; + }else{ + $res_str .= "FALSE\n"; + } - //Set and test + //Set and test $res_str .= "--------------------\n"; $isLenient = FALSE; - $res_str .= "Setting IntlDateFormatter with lenient ="; - if( $isLenient){ - $res_str .= "TRUE\n"; - }else{ - $res_str .= "FALSE\n"; - } - ut_datefmt_set_lenient( $fmt , $isLenient); - $resLenient = ut_datefmt_is_lenient( $fmt); - $res_str .= "After call to is_lenient : lenient= "; - if( $resLenient){ - $res_str .= "TRUE\n"; - }else{ - $res_str .= "FALSE\n"; - } + $res_str .= "Setting IntlDateFormatter with lenient ="; + if( $isLenient){ + $res_str .= "TRUE\n"; + }else{ + $res_str .= "FALSE\n"; + } + ut_datefmt_set_lenient( $fmt , $isLenient); + $resLenient = ut_datefmt_is_lenient( $fmt); + $res_str .= "After call to is_lenient : lenient= "; + if( $resLenient){ + $res_str .= "TRUE\n"; + }else{ + $res_str .= "FALSE\n"; + } $res_str .= "--------------------\n"; diff --git a/ext/intl/tests/dateformat_set_timezone_id2.phpt b/ext/intl/tests/dateformat_set_timezone_id2.phpt index 4f1724520c..b1fc00b875 100644 --- a/ext/intl/tests/dateformat_set_timezone_id2.phpt +++ b/ext/intl/tests/dateformat_set_timezone_id2.phpt @@ -17,37 +17,37 @@ ini_set("intl.error_level", E_WARNING); function ut_main() { - $timezone_id_arr = array ( - 'America/New_York', - 'America/Los_Angeles', - 'America/Chicago', - 'CN' - ); - $timestamp_entry = 0; + $timezone_id_arr = array ( + 'America/New_York', + 'America/Los_Angeles', + 'America/Chicago', + 'CN' + ); + $timestamp_entry = 0; - $res_str = ''; + $res_str = ''; - $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN ); - $timezone_id = ut_datefmt_get_timezone_id( $fmt ); - $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n"; + $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN ); + $timezone_id = ut_datefmt_get_timezone_id( $fmt ); + $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n"; - foreach( $timezone_id_arr as $timezone_id_entry ) - { + foreach( $timezone_id_arr as $timezone_id_entry ) + { - $res_str .= "-----------"; - $res_str .= "\nTrying to set timezone_id= $timezone_id_entry"; - ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ); - $timezone_id = ut_datefmt_get_timezone_id( $fmt ); - $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id"; - $formatted = ut_datefmt_format( $fmt, 0); - $res_str .= "\nFormatting timestamp=0 resulted in $formatted"; - $formatted = ut_datefmt_format( $fmt, 3600); - $res_str .= "\nFormatting timestamp=3600 resulted in $formatted"; - $res_str .= "\n"; + $res_str .= "-----------"; + $res_str .= "\nTrying to set timezone_id= $timezone_id_entry"; + ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ); + $timezone_id = ut_datefmt_get_timezone_id( $fmt ); + $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id"; + $formatted = ut_datefmt_format( $fmt, 0); + $res_str .= "\nFormatting timestamp=0 resulted in $formatted"; + $formatted = ut_datefmt_format( $fmt, 3600); + $res_str .= "\nFormatting timestamp=3600 resulted in $formatted"; + $res_str .= "\n"; - } + } - return $res_str; + return $res_str; } diff --git a/ext/intl/tests/dateformat_set_timezone_id3.phpt b/ext/intl/tests/dateformat_set_timezone_id3.phpt index 0970089bed..4eb963e186 100644 --- a/ext/intl/tests/dateformat_set_timezone_id3.phpt +++ b/ext/intl/tests/dateformat_set_timezone_id3.phpt @@ -17,37 +17,37 @@ ini_set("intl.error_level", E_WARNING); function ut_main() { - $timezone_id_arr = array ( - 'America/New_York', - 'America/Los_Angeles', - 'America/Chicago', - 'CN' - ); - $timestamp_entry = 0; + $timezone_id_arr = array ( + 'America/New_York', + 'America/Los_Angeles', + 'America/Chicago', + 'CN' + ); + $timestamp_entry = 0; - $res_str = ''; + $res_str = ''; - $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN ); - $timezone_id = ut_datefmt_get_timezone_id( $fmt ); - $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n"; + $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN ); + $timezone_id = ut_datefmt_get_timezone_id( $fmt ); + $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n"; - foreach( $timezone_id_arr as $timezone_id_entry ) - { + foreach( $timezone_id_arr as $timezone_id_entry ) + { - $res_str .= "-----------"; - $res_str .= "\nTrying to set timezone_id= $timezone_id_entry"; - ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ); - $timezone_id = ut_datefmt_get_timezone_id( $fmt ); - $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id"; - $formatted = ut_datefmt_format( $fmt, 0); - $res_str .= "\nFormatting timestamp=0 resulted in $formatted"; - $formatted = ut_datefmt_format( $fmt, 3600); - $res_str .= "\nFormatting timestamp=3600 resulted in $formatted"; - $res_str .= "\n"; + $res_str .= "-----------"; + $res_str .= "\nTrying to set timezone_id= $timezone_id_entry"; + ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ); + $timezone_id = ut_datefmt_get_timezone_id( $fmt ); + $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id"; + $formatted = ut_datefmt_format( $fmt, 0); + $res_str .= "\nFormatting timestamp=0 resulted in $formatted"; + $formatted = ut_datefmt_format( $fmt, 3600); + $res_str .= "\nFormatting timestamp=3600 resulted in $formatted"; + $res_str .= "\n"; - } + } - return $res_str; + return $res_str; } diff --git a/ext/intl/tests/formatter_clone.phpt b/ext/intl/tests/formatter_clone.phpt index d474eb2b70..4ca2d44dc9 100644 --- a/ext/intl/tests/formatter_clone.phpt +++ b/ext/intl/tests/formatter_clone.phpt @@ -17,7 +17,7 @@ $fmt_clone = clone $fmt; $res = $fmt->setPattern("0.0" ); if( $res === false ) - $res_str .= ut_nfmt_get_error_message( $fmt ) . " (" . ut_nfmt_get_error_code( $fmt ) . ")\n"; + $res_str .= ut_nfmt_get_error_message( $fmt ) . " (" . ut_nfmt_get_error_code( $fmt ) . ")\n"; $res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n"; $res_str .= "Formatted(clone) number: " . ut_nfmt_format( $fmt_clone, $test_value ) . "\n"; diff --git a/ext/intl/tests/formatter_clone_bad_obj.phpt b/ext/intl/tests/formatter_clone_bad_obj.phpt index 53a715e6a7..d27024cb39 100644 --- a/ext/intl/tests/formatter_clone_bad_obj.phpt +++ b/ext/intl/tests/formatter_clone_bad_obj.phpt @@ -6,14 +6,14 @@ Cloning unconstructed numfmt <?php class A extends NumberFormatter { - function __construct() {} + function __construct() {} } $a = new A; try { - $b = clone $a; + $b = clone $a; } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } --EXPECT-- string(42) "Cannot clone unconstructed NumberFormatter" diff --git a/ext/intl/tests/formatter_fail.phpt b/ext/intl/tests/formatter_fail.phpt index 0a8d7f398b..4bce9184cc 100644 --- a/ext/intl/tests/formatter_fail.phpt +++ b/ext/intl/tests/formatter_fail.phpt @@ -6,82 +6,82 @@ numfmt creation failures <?php function err($fmt) { - if(!$fmt) { - echo var_export(intl_get_error_message(), true)."\n"; - } + if(!$fmt) { + echo var_export(intl_get_error_message(), true)."\n"; + } } function print_exception($e) { - echo "\n" . get_class($e) . ": " . $e->getMessage() + echo "\n" . get_class($e) . ": " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; } function crt($t, $l, $s) { - switch(true) { - case $t == "O": - try { - return new NumberFormatter($l, $s); - } catch (Throwable $e) { - print_exception($e); - return null; - } - break; - case $t == "C": - try { - return NumberFormatter::create($l, $s); - } catch (Throwable $e) { - print_exception($e); - return null; - } - break; - case $t == "P": - try { - return numfmt_create($l, $s); - } catch (Throwable $e) { - print_exception($e); - return null; - } - break; - } + switch(true) { + case $t == "O": + try { + return new NumberFormatter($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } + break; + case $t == "C": + try { + return NumberFormatter::create($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } + break; + case $t == "P": + try { + return numfmt_create($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } + break; + } } $args = array( - array(null, null), - array("whatever", 1234567), - array(array(), array()), - array("en", -1), - array("en_US", NumberFormatter::PATTERN_RULEBASED), + array(null, null), + array("whatever", 1234567), + array(array(), array()), + array("en", -1), + array("en_US", NumberFormatter::PATTERN_RULEBASED), ); try { - $fmt = new NumberFormatter(); + $fmt = new NumberFormatter(); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = numfmt_create(); + $fmt = numfmt_create(); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = NumberFormatter::create(); + $fmt = NumberFormatter::create(); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); foreach($args as $arg) { - $fmt = crt("O", $arg[0], $arg[1]); - err($fmt); - $fmt = crt("C", $arg[0], $arg[1]); - err($fmt); - $fmt = crt("P", $arg[0], $arg[1]); - err($fmt); + $fmt = crt("O", $arg[0], $arg[1]); + err($fmt); + $fmt = crt("C", $arg[0], $arg[1]); + err($fmt); + $fmt = crt("P", $arg[0], $arg[1]); + err($fmt); } ?> diff --git a/ext/intl/tests/formatter_format2.phpt b/ext/intl/tests/formatter_format2.phpt index 26ef060ea0..d6e06cb57c 100644 --- a/ext/intl/tests/formatter_format2.phpt +++ b/ext/intl/tests/formatter_format2.phpt @@ -52,10 +52,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_format3.phpt b/ext/intl/tests/formatter_format3.phpt index b9d6eb5c3d..19512acc41 100644 --- a/ext/intl/tests/formatter_format3.phpt +++ b/ext/intl/tests/formatter_format3.phpt @@ -53,10 +53,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_format4.phpt b/ext/intl/tests/formatter_format4.phpt index 96dd7be53e..0cc086b31e 100644 --- a/ext/intl/tests/formatter_format4.phpt +++ b/ext/intl/tests/formatter_format4.phpt @@ -53,10 +53,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_format5.phpt b/ext/intl/tests/formatter_format5.phpt index 0bc4a6679b..8399af1129 100644 --- a/ext/intl/tests/formatter_format5.phpt +++ b/ext/intl/tests/formatter_format5.phpt @@ -53,10 +53,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_format6.phpt b/ext/intl/tests/formatter_format6.phpt index 70703785c1..6244a7f290 100644 --- a/ext/intl/tests/formatter_format6.phpt +++ b/ext/intl/tests/formatter_format6.phpt @@ -53,10 +53,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_format7.phpt b/ext/intl/tests/formatter_format7.phpt index 13d58bdd51..453a16e2b5 100644 --- a/ext/intl/tests/formatter_format7.phpt +++ b/ext/intl/tests/formatter_format7.phpt @@ -53,10 +53,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_format8.phpt b/ext/intl/tests/formatter_format8.phpt index 3aad6bced1..dcf8d8bca9 100644 --- a/ext/intl/tests/formatter_format8.phpt +++ b/ext/intl/tests/formatter_format8.phpt @@ -52,10 +52,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_get_set_pattern.phpt b/ext/intl/tests/formatter_get_set_pattern.phpt index 66d6837d75..441a8ecb15 100644 --- a/ext/intl/tests/formatter_get_set_pattern.phpt +++ b/ext/intl/tests/formatter_get_set_pattern.phpt @@ -33,8 +33,8 @@ function ut_main() $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n"; $res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n"; - ut_nfmt_set_pattern($fmt, str_repeat('@', 200)); - $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n"; + ut_nfmt_set_pattern($fmt, str_repeat('@', 200)); + $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n"; $res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n"; return $res_str; diff --git a/ext/intl/tests/formatter_get_set_pattern2.phpt b/ext/intl/tests/formatter_get_set_pattern2.phpt index b1d1ad0c48..f15c3bf75c 100644 --- a/ext/intl/tests/formatter_get_set_pattern2.phpt +++ b/ext/intl/tests/formatter_get_set_pattern2.phpt @@ -33,8 +33,8 @@ function ut_main() $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n"; $res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n"; - ut_nfmt_set_pattern($fmt, str_repeat('@', 200)); - $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n"; + ut_nfmt_set_pattern($fmt, str_repeat('@', 200)); + $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n"; $res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n"; return $res_str; diff --git a/ext/intl/tests/formatter_get_set_symbol2.phpt b/ext/intl/tests/formatter_get_set_symbol2.phpt index 201a4f6872..f4435c278a 100644 --- a/ext/intl/tests/formatter_get_set_symbol2.phpt +++ b/ext/intl/tests/formatter_get_set_symbol2.phpt @@ -13,7 +13,7 @@ numfmt_get/set_symbol() icu >= 4.8 function ut_main() { - $longstr = str_repeat("blah", 10); + $longstr = str_repeat("blah", 10); $symbols = array( 'DECIMAL_SEPARATOR_SYMBOL' => array( NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, '_._', 12345.123456, NumberFormatter::DECIMAL ), 'GROUPING_SEPARATOR_SYMBOL' => array( NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '_,_', 12345.123456, NumberFormatter::DECIMAL ), @@ -33,8 +33,8 @@ function ut_main() 'NAN_SYMBOL' => array( NumberFormatter::NAN_SYMBOL, '_N_', 12345.123456, NumberFormatter::DECIMAL ), 'SIGNIFICANT_DIGIT_SYMBOL' => array( NumberFormatter::SIGNIFICANT_DIGIT_SYMBOL, '_SD_', 12345.123456, NumberFormatter::DECIMAL ), 'MONETARY_GROUPING_SEPARATOR_SYMBOL' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, '_MG_', 12345.123456, NumberFormatter::CURRENCY ), - 'MONETARY_GROUPING_SEPARATOR_SYMBOL-2' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, " ", 12345.123456, NumberFormatter::CURRENCY ), - 'MONETARY_GROUPING_SEPARATOR_SYMBOL-3' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, $longstr, 12345.123456, NumberFormatter::CURRENCY ), + 'MONETARY_GROUPING_SEPARATOR_SYMBOL-2' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, " ", 12345.123456, NumberFormatter::CURRENCY ), + 'MONETARY_GROUPING_SEPARATOR_SYMBOL-3' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, $longstr, 12345.123456, NumberFormatter::CURRENCY ), ); $res_str = ''; @@ -76,9 +76,9 @@ function ut_main() } $badvals = array(2147483648, -2147483648, -1, 4294901761); foreach($badvals as $badval) { - if(ut_nfmt_get_symbol( $fmt, 2147483648 )) { - $res_str .= "Bad value $badval should return false!\n"; - } + if(ut_nfmt_get_symbol( $fmt, 2147483648 )) { + $res_str .= "Bad value $badval should return false!\n"; + } } return $res_str; } diff --git a/ext/intl/tests/formatter_get_set_text_attribute.phpt b/ext/intl/tests/formatter_get_set_text_attribute.phpt index dea3c2d36f..b3ae867b24 100644 --- a/ext/intl/tests/formatter_get_set_text_attribute.phpt +++ b/ext/intl/tests/formatter_get_set_text_attribute.phpt @@ -14,14 +14,14 @@ numfmt_get/set_text_attribute() ICU < 56.1 function ut_main() { // Array with data for testing - $long_str = str_repeat('blah', 100); + $long_str = str_repeat('blah', 100); $attributes = array( 'POSITIVE_PREFIX' => array( NumberFormatter::POSITIVE_PREFIX, '_+_', 12345.1234 ), 'POSITIVE_SUFFIX' => array( NumberFormatter::POSITIVE_SUFFIX, '_+_', 12345.1234 ), 'NEGATIVE_PREFIX' => array( NumberFormatter::NEGATIVE_PREFIX, '_-_', -12345.1234 ), 'NEGATIVE_SUFFIX' => array( NumberFormatter::NEGATIVE_SUFFIX, '_-_', -12345.1234 ), 'PADDING_CHARACTER' => array( NumberFormatter::PADDING_CHARACTER, '^', 12345.1234 ), - 'POSITIVE_PREFIX-2' => array( NumberFormatter::POSITIVE_PREFIX, $long_str, 12345.1234 ), + 'POSITIVE_PREFIX-2' => array( NumberFormatter::POSITIVE_PREFIX, $long_str, 12345.1234 ), // 'CURRENCY_CODE' => array( NumberFormatter::CURRENCY_CODE, '_C_', 12345.1234 ) // 'DEFAULT_RULESET' => array( NumberFormatter::DEFAULT_RULESET, '_DR_', 12345.1234 ), // 'PUBLIC_RULESETS' => array( NumberFormatter::PUBLIC_RULESETS, '_PR_', 12345.1234 ) diff --git a/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt b/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt index 260e33a350..3819de6dde 100644 --- a/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt +++ b/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt @@ -14,14 +14,14 @@ numfmt_get/set_text_attribute() ICU >= 56.1 function ut_main() { // Array with data for testing - $long_str = str_repeat('blah', 100); + $long_str = str_repeat('blah', 100); $attributes = array( 'POSITIVE_PREFIX' => array( NumberFormatter::POSITIVE_PREFIX, '_+_', 12345.1234 ), 'POSITIVE_SUFFIX' => array( NumberFormatter::POSITIVE_SUFFIX, '_+_', 12345.1234 ), 'NEGATIVE_PREFIX' => array( NumberFormatter::NEGATIVE_PREFIX, '_-_', -12345.1234 ), 'NEGATIVE_SUFFIX' => array( NumberFormatter::NEGATIVE_SUFFIX, '_-_', -12345.1234 ), 'PADDING_CHARACTER' => array( NumberFormatter::PADDING_CHARACTER, '^', 12345.1234 ), - 'POSITIVE_PREFIX-2' => array( NumberFormatter::POSITIVE_PREFIX, $long_str, 12345.1234 ), + 'POSITIVE_PREFIX-2' => array( NumberFormatter::POSITIVE_PREFIX, $long_str, 12345.1234 ), // 'CURRENCY_CODE' => array( NumberFormatter::CURRENCY_CODE, '_C_', 12345.1234 ) // 'DEFAULT_RULESET' => array( NumberFormatter::DEFAULT_RULESET, '_DR_', 12345.1234 ), // 'PUBLIC_RULESETS' => array( NumberFormatter::PUBLIC_RULESETS, '_PR_', 12345.1234 ) diff --git a/ext/intl/tests/grapheme.phpt b/ext/intl/tests/grapheme.phpt index 9e14d9cc14..be82abf718 100644 --- a/ext/intl/tests/grapheme.phpt +++ b/ext/intl/tests/grapheme.phpt @@ -12,772 +12,772 @@ grapheme() function ut_main() { - $res_str = ''; - - $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) - $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) - $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) - $char_O_diaeresis = "\xC3\x96"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6) - - $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) - $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) - - $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) - $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) - - $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) - - $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) - - $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) - - // the word 'hindi' using Devanagari characters: - $hindi = "\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80"; - - $char_a_ring_nfd = "a\xCC\x8A"; - $char_A_ring_nfd = "A\xCC\x8A"; - $char_o_diaeresis_nfd = "o\xCC\x88"; - $char_O_diaeresis_nfd = "O\xCC\x88"; - $char_diaeresis = "\xCC\x88"; - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strlen($string) {}' . "\n\n"; - - - $res_str .= "\"hindi\" in devanagari strlen " . grapheme_strlen($hindi) . "\n"; - $res_str .= "\"ab\" + \"hindi\" + \"cde\" strlen " . grapheme_strlen('ab' . $hindi . 'cde') . "\n"; - $res_str .= "\"\" strlen " . grapheme_strlen("") . "\n"; - $res_str .= "char_a_ring_nfd strlen " . grapheme_strlen($char_a_ring_nfd) . "\n"; - $res_str .= "char_a_ring_nfd + \"bc\" strlen " . grapheme_strlen($char_a_ring_nfd . 'bc') . "\n"; - $res_str .= "\"abc\" strlen " . grapheme_strlen('abc') . "\n"; - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strpos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( "abc", "d", "false" ), - array( "abc", "c", 2 ), - array( "abc", "b", 1 ), - array( "abc", "a", 0 ), - array( "abc", "a", 0, 0 ), - array( "abc", "a", 1, "false" ), - array( "abc", "a", -1, "false" ), - array( "ababc", "a", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -1, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -5, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, -4, 3 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "bc", "false" ), - array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), - array( "abc", "defghijklmnopq", "false" ), - array( "abc", "ab", 0 ), - array( "abc", "bc", 1 ), - array( "abc", "abc", 0 ), - array( "abc", "abcd", "false" ), - array( "abc", "ab", 0, 0 ), - array( "abc", "abc", 0, 0 ), - array( "abc", "abc", 1, "false" ), - array( "ababc", "ab", 1, 2 ), - array( "ababc", "abc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", -8, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strpos"; - if ( 3 == count( $test ) ) { - $result = grapheme_strpos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_strpos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_stripos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - $tests = array( - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Oo", "o", -6, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, -1, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), - array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "Abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "A", "false" ), - array( "abc", "D", "false" ), - array( "abC", "c", 2 ), - array( "abc", "B", 1 ), - array( "Abc", "a", 0 ), - array( "abc", "A", 0, 0 ), - array( "Abc", "a", 1, "false" ), - array( "ababc", "A", 1, 2 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "BC", "false" ), - array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), - array( "aBC", "Defghijklmnopq", "false" ), - array( "abC", "Ab", 0 ), - array( "aBC", "bc", 1 ), - array( "abC", "Abc", 0 ), - array( "abC", "aBcd", "false" ), - array( "ABc", "ab", 0, 0 ), - array( "aBc", "abC", 0, 0 ), - array( "abc", "aBc", 1, "false" ), - array( "ABabc", "AB", 1, 2 ), - array( "ABabc", "AB", -4, 2 ), - array( "abaBc", "aBc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stripos"; - if ( 3 == count( $test ) ) { - $result = grapheme_stripos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_stripos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strrpos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( "abc", "d", "false" ), - array( "abc", "c", 2 ), - array( "abc", "b", 1 ), - array( "abc", "a", 0 ), - array( "abc", "a", 0, 0 ), - array( "abc", "a", 1, "false" ), - array( "ababc", "a", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "bc", "false" ), - array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), - array( "abc", "defghijklmnopq", "false" ), - array( "abc", "ab", 0 ), - array( "abc", "bc", 1 ), - array( "abc", "abc", 0 ), - array( "abc", "abcd", "false" ), - array( "abc", "ab", 0, 0 ), - array( "abc", "abc", 0, 0 ), - array( "abc", "abc", 1, "false" ), - array( "ababc", "ab", 1, 2 ), - array( "ababc", "abc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strrpos"; - if ( 3 == count( $test ) ) { - $result = grapheme_strrpos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_strrpos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strripos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - $tests = array( - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), - array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "Abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "A", "false" ), - array( "abc", "D", "false" ), - array( "abC", "c", 2 ), - array( "abc", "B", 1 ), - array( "Abc", "a", 0 ), - array( "abc", "A", 0, 0 ), - array( "Abc", "a", 1, "false" ), - array( "ababc", "A", 1, 2 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "BC", "false" ), - array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), - array( "aBC", "Defghijklmnopq", "false" ), - array( "abC", "Ab", 0 ), - array( "aBC", "bc", 1 ), - array( "abC", "Abc", 0 ), - array( "abC", "aBcd", "false" ), - array( "ABc", "ab", 0, 0 ), - array( "aBc", "abC", 0, 0 ), - array( "abc", "aBc", 1, "false" ), - array( "ABabc", "AB", 1, 2 ), - array( "abaBc", "aBc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strripos"; - if ( 3 == count( $test ) ) { - $result = grapheme_strripos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_strripos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_substr($string, $start, $length = -1) {}' . "\n\n"; - - $tests = array( - - array( "abc", 3, "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", 2, "a" . $char_A_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 5, "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, 4, $char_O_diaeresis_nfd ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "bc" ), - array( "a" . $char_A_ring_nfd . "bc", 1, $char_A_ring_nfd . "bc" ), - array( "Abc", -5, "false" ), - array( $char_a_ring_nfd . "bc", 3, "false" ), - array( "abc", 4, "false" ), - array( "abC", 2, "C" ), - array( "abc", 1, "bc" ), - array( "Abc", 1, 1, "b" ), - array( "abc", 0, 2, "ab" ), - array( "Abc", -4, 1, "false" ), - array( "ababc", 1, 2, "ba" ), - array( "ababc", 0, 10, "ababc" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -1, "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -2, "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -3, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -4, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -4, "a" . $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -5, "a" . $char_a_ring_nfd . "b" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -6, "a" . $char_a_ring_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -7, "a" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -8, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -9, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -7, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -6, "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -5, "c" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -4, $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -3, "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -2, "pq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -1, "q" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -999, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 7, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 6, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 5, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 4, "a" . $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 3, "a" . $char_a_ring_nfd . "b" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 2, "a" . $char_a_ring_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 1, "a" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 0, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -999, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -4, "a" . $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -5, "a" . $char_a_ring_nfd . "b" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -6, "a" . $char_a_ring_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -7, "a" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -8, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -9, "false" ), - - ); - - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr"; - if ( 3 == count( $test ) ) { - $result = grapheme_substr($test[0], $test[1]); - } - else { - $res_str .= " with length $test[2]"; - $result = grapheme_substr($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( "abc", "d", "false" ), - array( "abc", "c", "c" ), - array( "abc", "b", "bc" ), - array( "abc", "a", "abc" ), - array( "abc", "ab", "abc" ), - array( "abc", "abc", "abc" ), - array( "abc", "bc", "bc" ), - array( "abc", "a", FALSE, "abc" ), - array( "abc", "a", TRUE, "" ), - array( "abc", "b", TRUE, "a" ), - array( "abc", "c", TRUE, "ab" ), - array( "ababc", "bab", TRUE, "a" ), - array( "ababc", "abc", TRUE, "ab" ), - array( "ababc", "abc", FALSE, "abc" ), - - array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), - array( "bc" . $char_a_ring_nfd . "a", "a", "a" ), - array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( $char_a_ring_nfd . "abc", "ab", "abc" ), - array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"), - array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ), - array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ), - array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ), - array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), - array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ), - array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ), - - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr"; - if ( 3 == count( $test ) ) { - $result = grapheme_strstr($test[0], $test[1]); - } - else { - $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); - $result = grapheme_strstr($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), - array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "A", "false" ), - array( "abc", "d", "false" ), - array( "abc", "C", "c" ), - array( "aBc", "b", "Bc" ), - array( "abc", "A", "abc" ), - array( "abC", "ab", "abC" ), - array( "abc", "aBc", "abc" ), - array( "abC", "bc", "bC" ), - array( "abc", "A", FALSE, "abc" ), - array( "abc", "a", TRUE, "" ), - array( "aBc", "b", TRUE, "a" ), - array( "abc", "C", TRUE, "ab" ), - array( "aBabc", "bab", TRUE, "a" ), - array( "ababc", "aBc", TRUE, "ab" ), - array( "ababc", "abC", FALSE, "abc" ), - - array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), - array( "bc" . $char_a_ring_nfd . "A", "a", "A" ), - array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ), - array( $char_A_ring_nfd . "bc", "a", "false" ), - array( $char_a_ring_nfd . "abc", "Ab", "abc" ), - array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd), - array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), - array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ), - array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ), - array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ), - array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), - array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ), - array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ), - - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr"; - if ( 3 == count( $test ) ) { - $result = grapheme_stristr($test[0], $test[1]); - } - else { - $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); - $result = grapheme_stristr($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n"; - - $tests = array( - // haystack, count, [[offset], [next]], result - array( "abc", 3, "abc" ), - array( "abc", 2, "ab" ), - array( "abc", 1, "a" ), - array( "abc", 0, "" ), - array( "abc", 1, 0, "a" ), - array( "abc", 1, 1, "b" ), - array( "abc", 1, 2, "c" ), - array( "abc", 0, 2, "" ), - - array( "abc", 3, 0, 3, "abc" ), - array( "abc", 2, 0, 2, "ab" ), - array( "abc", 1, 0, 1, "a" ), - array( "abc", 0, 0, 0, "" ), - array( "abc", 1, 0, 1, "a" ), - array( "abc", 1, 1, 2, "b" ), - array( "abc", 1, 2, 3, "c" ), - array( "abc", 1, -2, 2, "b" ), - array( "abc", 0, 2, 2, "" ), + $res_str = ''; + + $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) + $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) + $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) + $char_O_diaeresis = "\xC3\x96"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6) + + $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) + $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) + + $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) + $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) + + $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) + + $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) + + $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) + + // the word 'hindi' using Devanagari characters: + $hindi = "\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80"; + + $char_a_ring_nfd = "a\xCC\x8A"; + $char_A_ring_nfd = "A\xCC\x8A"; + $char_o_diaeresis_nfd = "o\xCC\x88"; + $char_O_diaeresis_nfd = "O\xCC\x88"; + $char_diaeresis = "\xCC\x88"; + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strlen($string) {}' . "\n\n"; + + + $res_str .= "\"hindi\" in devanagari strlen " . grapheme_strlen($hindi) . "\n"; + $res_str .= "\"ab\" + \"hindi\" + \"cde\" strlen " . grapheme_strlen('ab' . $hindi . 'cde') . "\n"; + $res_str .= "\"\" strlen " . grapheme_strlen("") . "\n"; + $res_str .= "char_a_ring_nfd strlen " . grapheme_strlen($char_a_ring_nfd) . "\n"; + $res_str .= "char_a_ring_nfd + \"bc\" strlen " . grapheme_strlen($char_a_ring_nfd . 'bc') . "\n"; + $res_str .= "\"abc\" strlen " . grapheme_strlen('abc') . "\n"; + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strpos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( "abc", "d", "false" ), + array( "abc", "c", 2 ), + array( "abc", "b", 1 ), + array( "abc", "a", 0 ), + array( "abc", "a", 0, 0 ), + array( "abc", "a", 1, "false" ), + array( "abc", "a", -1, "false" ), + array( "ababc", "a", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -1, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -5, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, -4, 3 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "bc", "false" ), + array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), + array( "abc", "defghijklmnopq", "false" ), + array( "abc", "ab", 0 ), + array( "abc", "bc", 1 ), + array( "abc", "abc", 0 ), + array( "abc", "abcd", "false" ), + array( "abc", "ab", 0, 0 ), + array( "abc", "abc", 0, 0 ), + array( "abc", "abc", 1, "false" ), + array( "ababc", "ab", 1, 2 ), + array( "ababc", "abc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", -8, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strpos"; + if ( 3 == count( $test ) ) { + $result = grapheme_strpos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_strpos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_stripos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + $tests = array( + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Oo", "o", -6, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, -1, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), + array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "Abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "A", "false" ), + array( "abc", "D", "false" ), + array( "abC", "c", 2 ), + array( "abc", "B", 1 ), + array( "Abc", "a", 0 ), + array( "abc", "A", 0, 0 ), + array( "Abc", "a", 1, "false" ), + array( "ababc", "A", 1, 2 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "BC", "false" ), + array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), + array( "aBC", "Defghijklmnopq", "false" ), + array( "abC", "Ab", 0 ), + array( "aBC", "bc", 1 ), + array( "abC", "Abc", 0 ), + array( "abC", "aBcd", "false" ), + array( "ABc", "ab", 0, 0 ), + array( "aBc", "abC", 0, 0 ), + array( "abc", "aBc", 1, "false" ), + array( "ABabc", "AB", 1, 2 ), + array( "ABabc", "AB", -4, 2 ), + array( "abaBc", "aBc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stripos"; + if ( 3 == count( $test ) ) { + $result = grapheme_stripos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_stripos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strrpos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( "abc", "d", "false" ), + array( "abc", "c", 2 ), + array( "abc", "b", 1 ), + array( "abc", "a", 0 ), + array( "abc", "a", 0, 0 ), + array( "abc", "a", 1, "false" ), + array( "ababc", "a", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "bc", "false" ), + array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), + array( "abc", "defghijklmnopq", "false" ), + array( "abc", "ab", 0 ), + array( "abc", "bc", 1 ), + array( "abc", "abc", 0 ), + array( "abc", "abcd", "false" ), + array( "abc", "ab", 0, 0 ), + array( "abc", "abc", 0, 0 ), + array( "abc", "abc", 1, "false" ), + array( "ababc", "ab", 1, 2 ), + array( "ababc", "abc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strrpos"; + if ( 3 == count( $test ) ) { + $result = grapheme_strrpos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_strrpos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strripos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + $tests = array( + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), + array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "Abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "A", "false" ), + array( "abc", "D", "false" ), + array( "abC", "c", 2 ), + array( "abc", "B", 1 ), + array( "Abc", "a", 0 ), + array( "abc", "A", 0, 0 ), + array( "Abc", "a", 1, "false" ), + array( "ababc", "A", 1, 2 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "BC", "false" ), + array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), + array( "aBC", "Defghijklmnopq", "false" ), + array( "abC", "Ab", 0 ), + array( "aBC", "bc", 1 ), + array( "abC", "Abc", 0 ), + array( "abC", "aBcd", "false" ), + array( "ABc", "ab", 0, 0 ), + array( "aBc", "abC", 0, 0 ), + array( "abc", "aBc", 1, "false" ), + array( "ABabc", "AB", 1, 2 ), + array( "abaBc", "aBc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strripos"; + if ( 3 == count( $test ) ) { + $result = grapheme_strripos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_strripos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_substr($string, $start, $length = -1) {}' . "\n\n"; + + $tests = array( + + array( "abc", 3, "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", 2, "a" . $char_A_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 5, "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, 4, $char_O_diaeresis_nfd ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "bc" ), + array( "a" . $char_A_ring_nfd . "bc", 1, $char_A_ring_nfd . "bc" ), + array( "Abc", -5, "false" ), + array( $char_a_ring_nfd . "bc", 3, "false" ), + array( "abc", 4, "false" ), + array( "abC", 2, "C" ), + array( "abc", 1, "bc" ), + array( "Abc", 1, 1, "b" ), + array( "abc", 0, 2, "ab" ), + array( "Abc", -4, 1, "false" ), + array( "ababc", 1, 2, "ba" ), + array( "ababc", 0, 10, "ababc" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -1, "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -2, "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -3, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -4, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -4, "a" . $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -5, "a" . $char_a_ring_nfd . "b" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -6, "a" . $char_a_ring_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -7, "a" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -8, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -9, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -7, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -6, "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -5, "c" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -4, $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -3, "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -2, "pq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -1, "q" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -999, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 7, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 6, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 5, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 4, "a" . $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 3, "a" . $char_a_ring_nfd . "b" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 2, "a" . $char_a_ring_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 1, "a" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 0, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -999, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -4, "a" . $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -5, "a" . $char_a_ring_nfd . "b" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -6, "a" . $char_a_ring_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -7, "a" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -8, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -9, "false" ), + + ); + + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr"; + if ( 3 == count( $test ) ) { + $result = grapheme_substr($test[0], $test[1]); + } + else { + $res_str .= " with length $test[2]"; + $result = grapheme_substr($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( "abc", "d", "false" ), + array( "abc", "c", "c" ), + array( "abc", "b", "bc" ), + array( "abc", "a", "abc" ), + array( "abc", "ab", "abc" ), + array( "abc", "abc", "abc" ), + array( "abc", "bc", "bc" ), + array( "abc", "a", FALSE, "abc" ), + array( "abc", "a", TRUE, "" ), + array( "abc", "b", TRUE, "a" ), + array( "abc", "c", TRUE, "ab" ), + array( "ababc", "bab", TRUE, "a" ), + array( "ababc", "abc", TRUE, "ab" ), + array( "ababc", "abc", FALSE, "abc" ), + + array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), + array( "bc" . $char_a_ring_nfd . "a", "a", "a" ), + array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( $char_a_ring_nfd . "abc", "ab", "abc" ), + array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"), + array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ), + array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ), + array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ), + array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), + array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ), + array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ), + + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr"; + if ( 3 == count( $test ) ) { + $result = grapheme_strstr($test[0], $test[1]); + } + else { + $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); + $result = grapheme_strstr($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), + array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "A", "false" ), + array( "abc", "d", "false" ), + array( "abc", "C", "c" ), + array( "aBc", "b", "Bc" ), + array( "abc", "A", "abc" ), + array( "abC", "ab", "abC" ), + array( "abc", "aBc", "abc" ), + array( "abC", "bc", "bC" ), + array( "abc", "A", FALSE, "abc" ), + array( "abc", "a", TRUE, "" ), + array( "aBc", "b", TRUE, "a" ), + array( "abc", "C", TRUE, "ab" ), + array( "aBabc", "bab", TRUE, "a" ), + array( "ababc", "aBc", TRUE, "ab" ), + array( "ababc", "abC", FALSE, "abc" ), + + array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), + array( "bc" . $char_a_ring_nfd . "A", "a", "A" ), + array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ), + array( $char_A_ring_nfd . "bc", "a", "false" ), + array( $char_a_ring_nfd . "abc", "Ab", "abc" ), + array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd), + array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), + array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ), + array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ), + array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ), + array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), + array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ), + array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ), + + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr"; + if ( 3 == count( $test ) ) { + $result = grapheme_stristr($test[0], $test[1]); + } + else { + $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); + $result = grapheme_stristr($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n"; + + $tests = array( + // haystack, count, [[offset], [next]], result + array( "abc", 3, "abc" ), + array( "abc", 2, "ab" ), + array( "abc", 1, "a" ), + array( "abc", 0, "" ), + array( "abc", 1, 0, "a" ), + array( "abc", 1, 1, "b" ), + array( "abc", 1, 2, "c" ), + array( "abc", 0, 2, "" ), + + array( "abc", 3, 0, 3, "abc" ), + array( "abc", 2, 0, 2, "ab" ), + array( "abc", 1, 0, 1, "a" ), + array( "abc", 0, 0, 0, "" ), + array( "abc", 1, 0, 1, "a" ), + array( "abc", 1, 1, 2, "b" ), + array( "abc", 1, 2, 3, "c" ), + array( "abc", 1, -2, 2, "b" ), + array( "abc", 0, 2, 2, "" ), array( "http://news.bbc.co.uk/2/hi/middle_east/7831588.stm", 48, 48 , 50 , "tm" ), - array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ), - array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ), - array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ), - array( $char_a_ring_nfd . "bcde", 2, -4, 5, "bc" ), - array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ), - array( $char_a_ring_nfd . "bcde", 2, -7, 4, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ), - array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, -6, 11, "de" . $char_a_ring_nfd . "f" ), - - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 4, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 7, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), - - ); - - $next = -1; - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract"; - if ( 3 == count( $test ) ) { - $result = grapheme_extract($test[0], $test[1]); - } - elseif ( 4 == count ( $test ) ) { - $res_str .= " starting at byte position $test[2]"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]); - } - else { - $res_str .= " starting at byte position $test[2] with \$next"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]); - if ( 5 == count ( $test ) ) { - $res_str .= " \$next=$next == $test[3] "; - if ( $next != $test[3] ) { - $res_str .= "***FAILED***"; - } - } - $res_str .= "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n"; - - $tests = array( - array( "abc", 3, "abc" ), - array( "abc", 2, "ab" ), - array( "abc", 1, "a" ), - array( "abc", 0, "" ), - array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ), - array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bc", 1, "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 9, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 10, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 11, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 4, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 7, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), - - ); - - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES"; - if ( 3 == count( $test ) ) { - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES); - } - else { - $res_str .= " starting at byte position $test[2]"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n"; - - $tests = array( - array( "abc", 3, "abc" ), - array( "abc", 2, "ab" ), - array( "abc", 1, "a" ), - array( "abc", 0, "" ), - array( "abc" . $char_o_diaeresis_nfd, 0, "" ), - array( "abc" . $char_o_diaeresis_nfd, 1, "a" ), - array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ), - array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ), - array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ), - array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd), - array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . "abc", 0, "" ), - array( $char_o_diaeresis_nfd . "abc", 1, "" ), - array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ), - array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ), - array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), - - array( "abc", 3, 0, "abc" ), - array( "abc", 2, 1, "bc" ), - array( "abc", 1, 2, "c" ), - array( "abc", 0, 3, "false" ), - array( "abc", 1, 3, "false" ), - array( "abc", 1, 999, "false" ), - array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ), - array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ), - - ); - - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS"; - if ( 3 == count( $test ) ) { - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS); - } - else { - $res_str .= " starting at byte position $test[2]"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - - return $res_str; + array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ), + array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ), + array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ), + array( $char_a_ring_nfd . "bcde", 2, -4, 5, "bc" ), + array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ), + array( $char_a_ring_nfd . "bcde", 2, -7, 4, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ), + array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, -6, 11, "de" . $char_a_ring_nfd . "f" ), + + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 4, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 7, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), + + ); + + $next = -1; + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract"; + if ( 3 == count( $test ) ) { + $result = grapheme_extract($test[0], $test[1]); + } + elseif ( 4 == count ( $test ) ) { + $res_str .= " starting at byte position $test[2]"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]); + } + else { + $res_str .= " starting at byte position $test[2] with \$next"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]); + if ( 5 == count ( $test ) ) { + $res_str .= " \$next=$next == $test[3] "; + if ( $next != $test[3] ) { + $res_str .= "***FAILED***"; + } + } + $res_str .= "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n"; + + $tests = array( + array( "abc", 3, "abc" ), + array( "abc", 2, "ab" ), + array( "abc", 1, "a" ), + array( "abc", 0, "" ), + array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ), + array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bc", 1, "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 9, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 10, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 11, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 4, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 7, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), + + ); + + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES"; + if ( 3 == count( $test ) ) { + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES); + } + else { + $res_str .= " starting at byte position $test[2]"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n"; + + $tests = array( + array( "abc", 3, "abc" ), + array( "abc", 2, "ab" ), + array( "abc", 1, "a" ), + array( "abc", 0, "" ), + array( "abc" . $char_o_diaeresis_nfd, 0, "" ), + array( "abc" . $char_o_diaeresis_nfd, 1, "a" ), + array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ), + array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ), + array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ), + array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd), + array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . "abc", 0, "" ), + array( $char_o_diaeresis_nfd . "abc", 1, "" ), + array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ), + array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ), + array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), + + array( "abc", 3, 0, "abc" ), + array( "abc", 2, 1, "bc" ), + array( "abc", 1, 2, "c" ), + array( "abc", 0, 3, "false" ), + array( "abc", 1, 3, "false" ), + array( "abc", 1, 999, "false" ), + array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ), + array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ), + + ); + + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS"; + if ( 3 == count( $test ) ) { + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS); + } + else { + $res_str .= " starting at byte position $test[2]"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + + return $res_str; } echo ut_main(); function check_result($result, $expected) { - if ( $result === false ) { - $result = 'false'; - } + if ( $result === false ) { + $result = 'false'; + } - if ( strcmp($result, $expected) != 0 ) { - return " **FAILED** "; - } + if ( strcmp($result, $expected) != 0 ) { + return " **FAILED** "; + } - return ""; + return ""; } ?> diff --git a/ext/intl/tests/grapheme2.phpt b/ext/intl/tests/grapheme2.phpt index e17b53b094..4595b78128 100644 --- a/ext/intl/tests/grapheme2.phpt +++ b/ext/intl/tests/grapheme2.phpt @@ -12,772 +12,772 @@ grapheme() function ut_main() { - $res_str = ''; - - $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) - $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) - $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) - $char_O_diaeresis = "\xC3\x96"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6) - - $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) - $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) - - $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) - $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) - - $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) - - $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) - - $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) - - // the word 'hindi' using Devanagari characters: - $hindi = "\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80"; - - $char_a_ring_nfd = "a\xCC\x8A"; - $char_A_ring_nfd = "A\xCC\x8A"; - $char_o_diaeresis_nfd = "o\xCC\x88"; - $char_O_diaeresis_nfd = "O\xCC\x88"; - $char_diaeresis = "\xCC\x88"; - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strlen($string) {}' . "\n\n"; - - - $res_str .= "\"hindi\" in devanagari strlen " . grapheme_strlen($hindi) . "\n"; - $res_str .= "\"ab\" + \"hindi\" + \"cde\" strlen " . grapheme_strlen('ab' . $hindi . 'cde') . "\n"; - $res_str .= "\"\" strlen " . grapheme_strlen("") . "\n"; - $res_str .= "char_a_ring_nfd strlen " . grapheme_strlen($char_a_ring_nfd) . "\n"; - $res_str .= "char_a_ring_nfd + \"bc\" strlen " . grapheme_strlen($char_a_ring_nfd . 'bc') . "\n"; - $res_str .= "\"abc\" strlen " . grapheme_strlen('abc') . "\n"; - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strpos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( "abc", "d", "false" ), - array( "abc", "c", 2 ), - array( "abc", "b", 1 ), - array( "abc", "a", 0 ), - array( "abc", "a", 0, 0 ), - array( "abc", "a", 1, "false" ), - array( "abc", "a", -1, "false" ), - array( "ababc", "a", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -1, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -5, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, -4, 3 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "bc", "false" ), - array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), - array( "abc", "defghijklmnopq", "false" ), - array( "abc", "ab", 0 ), - array( "abc", "bc", 1 ), - array( "abc", "abc", 0 ), - array( "abc", "abcd", "false" ), - array( "abc", "ab", 0, 0 ), - array( "abc", "abc", 0, 0 ), - array( "abc", "abc", 1, "false" ), - array( "ababc", "ab", 1, 2 ), - array( "ababc", "abc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", -8, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strpos"; - if ( 3 == count( $test ) ) { - $result = grapheme_strpos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_strpos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_stripos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - $tests = array( - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Oo", "o", -6, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, -1, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), - array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "Abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "A", "false" ), - array( "abc", "D", "false" ), - array( "abC", "c", 2 ), - array( "abc", "B", 1 ), - array( "Abc", "a", 0 ), - array( "abc", "A", 0, 0 ), - array( "Abc", "a", 1, "false" ), - array( "ababc", "A", 1, 2 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "BC", "false" ), - array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), - array( "aBC", "Defghijklmnopq", "false" ), - array( "abC", "Ab", 0 ), - array( "aBC", "bc", 1 ), - array( "abC", "Abc", 0 ), - array( "abC", "aBcd", "false" ), - array( "ABc", "ab", 0, 0 ), - array( "aBc", "abC", 0, 0 ), - array( "abc", "aBc", 1, "false" ), - array( "ABabc", "AB", 1, 2 ), - array( "ABabc", "AB", -4, 2 ), - array( "abaBc", "aBc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stripos"; - if ( 3 == count( $test ) ) { - $result = grapheme_stripos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_stripos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strrpos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( "abc", "d", "false" ), - array( "abc", "c", 2 ), - array( "abc", "b", 1 ), - array( "abc", "a", 0 ), - array( "abc", "a", 0, 0 ), - array( "abc", "a", 1, "false" ), - array( "ababc", "a", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "bc", "false" ), - array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), - array( "abc", "defghijklmnopq", "false" ), - array( "abc", "ab", 0 ), - array( "abc", "bc", 1 ), - array( "abc", "abc", 0 ), - array( "abc", "abcd", "false" ), - array( "abc", "ab", 0, 0 ), - array( "abc", "abc", 0, 0 ), - array( "abc", "abc", 1, "false" ), - array( "ababc", "ab", 1, 2 ), - array( "ababc", "abc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strrpos"; - if ( 3 == count( $test ) ) { - $result = grapheme_strrpos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_strrpos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strripos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - $tests = array( - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), - array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "Abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "A", "false" ), - array( "abc", "D", "false" ), - array( "abC", "c", 2 ), - array( "abc", "B", 1 ), - array( "Abc", "a", 0 ), - array( "abc", "A", 0, 0 ), - array( "Abc", "a", 1, "false" ), - array( "ababc", "A", 1, 2 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "BC", "false" ), - array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), - array( "aBC", "Defghijklmnopq", "false" ), - array( "abC", "Ab", 0 ), - array( "aBC", "bc", 1 ), - array( "abC", "Abc", 0 ), - array( "abC", "aBcd", "false" ), - array( "ABc", "ab", 0, 0 ), - array( "aBc", "abC", 0, 0 ), - array( "abc", "aBc", 1, "false" ), - array( "ABabc", "AB", 1, 2 ), - array( "abaBc", "aBc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strripos"; - if ( 3 == count( $test ) ) { - $result = grapheme_strripos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_strripos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_substr($string, $start, $length = -1) {}' . "\n\n"; - - $tests = array( - - array( "abc", 3, "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", 2, "a" . $char_A_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 5, "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, 4, $char_O_diaeresis_nfd ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "bc" ), - array( "a" . $char_A_ring_nfd . "bc", 1, $char_A_ring_nfd . "bc" ), - array( "Abc", -5, "false" ), - array( $char_a_ring_nfd . "bc", 3, "false" ), - array( "abc", 4, "false" ), - array( "abC", 2, "C" ), - array( "abc", 1, "bc" ), - array( "Abc", 1, 1, "b" ), - array( "abc", 0, 2, "ab" ), - array( "Abc", -4, 1, "false" ), - array( "ababc", 1, 2, "ba" ), - array( "ababc", 0, 10, "ababc" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -1, "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -2, "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -3, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -4, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -4, "a" . $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -5, "a" . $char_a_ring_nfd . "b" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -6, "a" . $char_a_ring_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -7, "a" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -8, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -9, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -7, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -6, "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -5, "c" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -4, $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -3, "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -2, "pq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -1, "q" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -999, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 7, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 6, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 5, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 4, "a" . $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 3, "a" . $char_a_ring_nfd . "b" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 2, "a" . $char_a_ring_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 1, "a" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 0, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -999, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -4, "a" . $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -5, "a" . $char_a_ring_nfd . "b" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -6, "a" . $char_a_ring_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -7, "a" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -8, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -9, "false" ), - - ); - - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr"; - if ( 3 == count( $test ) ) { - $result = grapheme_substr($test[0], $test[1]); - } - else { - $res_str .= " with length $test[2]"; - $result = grapheme_substr($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( "abc", "d", "false" ), - array( "abc", "c", "c" ), - array( "abc", "b", "bc" ), - array( "abc", "a", "abc" ), - array( "abc", "ab", "abc" ), - array( "abc", "abc", "abc" ), - array( "abc", "bc", "bc" ), - array( "abc", "a", FALSE, "abc" ), - array( "abc", "a", TRUE, "" ), - array( "abc", "b", TRUE, "a" ), - array( "abc", "c", TRUE, "ab" ), - array( "ababc", "bab", TRUE, "a" ), - array( "ababc", "abc", TRUE, "ab" ), - array( "ababc", "abc", FALSE, "abc" ), - - array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), - array( "bc" . $char_a_ring_nfd . "a", "a", "a" ), - array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( $char_a_ring_nfd . "abc", "ab", "abc" ), - array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"), - array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ), - array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ), - array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ), - array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), - array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ), - array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ), - - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr"; - if ( 3 == count( $test ) ) { - $result = grapheme_strstr($test[0], $test[1]); - } - else { - $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); - $result = grapheme_strstr($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), - array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "A", "false" ), - array( "abc", "d", "false" ), - array( "abc", "C", "c" ), - array( "aBc", "b", "Bc" ), - array( "abc", "A", "abc" ), - array( "abC", "ab", "abC" ), - array( "abc", "aBc", "abc" ), - array( "abC", "bc", "bC" ), - array( "abc", "A", FALSE, "abc" ), - array( "abc", "a", TRUE, "" ), - array( "aBc", "b", TRUE, "a" ), - array( "abc", "C", TRUE, "ab" ), - array( "aBabc", "bab", TRUE, "a" ), - array( "ababc", "aBc", TRUE, "ab" ), - array( "ababc", "abC", FALSE, "abc" ), - - array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), - array( "bc" . $char_a_ring_nfd . "A", "a", "A" ), - array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ), - array( $char_A_ring_nfd . "bc", "a", "false" ), - array( $char_a_ring_nfd . "abc", "Ab", "abc" ), - array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd), - array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), - array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ), - array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ), - array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ), - array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), - array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ), - array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ), - - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr"; - if ( 3 == count( $test ) ) { - $result = grapheme_stristr($test[0], $test[1]); - } - else { - $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); - $result = grapheme_stristr($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n"; - - $tests = array( - // haystack, count, [[offset], [next]], result - array( "abc", 3, "abc" ), - array( "abc", 2, "ab" ), - array( "abc", 1, "a" ), - array( "abc", 0, "" ), - array( "abc", 1, 0, "a" ), - array( "abc", 1, 1, "b" ), - array( "abc", 1, 2, "c" ), - array( "abc", 0, 2, "" ), - - array( "abc", 3, 0, 3, "abc" ), - array( "abc", 2, 0, 2, "ab" ), - array( "abc", 1, 0, 1, "a" ), - array( "abc", 0, 0, 0, "" ), - array( "abc", 1, 0, 1, "a" ), - array( "abc", 1, 1, 2, "b" ), - array( "abc", 1, 2, 3, "c" ), - array( "abc", 1, -2, 2, "b" ), - array( "abc", 0, 2, 2, "" ), + $res_str = ''; + + $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) + $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) + $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) + $char_O_diaeresis = "\xC3\x96"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6) + + $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) + $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) + + $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) + $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) + + $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) + + $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) + + $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) + + // the word 'hindi' using Devanagari characters: + $hindi = "\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80"; + + $char_a_ring_nfd = "a\xCC\x8A"; + $char_A_ring_nfd = "A\xCC\x8A"; + $char_o_diaeresis_nfd = "o\xCC\x88"; + $char_O_diaeresis_nfd = "O\xCC\x88"; + $char_diaeresis = "\xCC\x88"; + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strlen($string) {}' . "\n\n"; + + + $res_str .= "\"hindi\" in devanagari strlen " . grapheme_strlen($hindi) . "\n"; + $res_str .= "\"ab\" + \"hindi\" + \"cde\" strlen " . grapheme_strlen('ab' . $hindi . 'cde') . "\n"; + $res_str .= "\"\" strlen " . grapheme_strlen("") . "\n"; + $res_str .= "char_a_ring_nfd strlen " . grapheme_strlen($char_a_ring_nfd) . "\n"; + $res_str .= "char_a_ring_nfd + \"bc\" strlen " . grapheme_strlen($char_a_ring_nfd . 'bc') . "\n"; + $res_str .= "\"abc\" strlen " . grapheme_strlen('abc') . "\n"; + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strpos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( "abc", "d", "false" ), + array( "abc", "c", 2 ), + array( "abc", "b", 1 ), + array( "abc", "a", 0 ), + array( "abc", "a", 0, 0 ), + array( "abc", "a", 1, "false" ), + array( "abc", "a", -1, "false" ), + array( "ababc", "a", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -1, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -5, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, -4, 3 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "bc", "false" ), + array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), + array( "abc", "defghijklmnopq", "false" ), + array( "abc", "ab", 0 ), + array( "abc", "bc", 1 ), + array( "abc", "abc", 0 ), + array( "abc", "abcd", "false" ), + array( "abc", "ab", 0, 0 ), + array( "abc", "abc", 0, 0 ), + array( "abc", "abc", 1, "false" ), + array( "ababc", "ab", 1, 2 ), + array( "ababc", "abc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", -8, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strpos"; + if ( 3 == count( $test ) ) { + $result = grapheme_strpos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_strpos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_stripos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + $tests = array( + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Oo", "o", -6, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, -1, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), + array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "Abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "A", "false" ), + array( "abc", "D", "false" ), + array( "abC", "c", 2 ), + array( "abc", "B", 1 ), + array( "Abc", "a", 0 ), + array( "abc", "A", 0, 0 ), + array( "Abc", "a", 1, "false" ), + array( "ababc", "A", 1, 2 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "BC", "false" ), + array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), + array( "aBC", "Defghijklmnopq", "false" ), + array( "abC", "Ab", 0 ), + array( "aBC", "bc", 1 ), + array( "abC", "Abc", 0 ), + array( "abC", "aBcd", "false" ), + array( "ABc", "ab", 0, 0 ), + array( "aBc", "abC", 0, 0 ), + array( "abc", "aBc", 1, "false" ), + array( "ABabc", "AB", 1, 2 ), + array( "ABabc", "AB", -4, 2 ), + array( "abaBc", "aBc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stripos"; + if ( 3 == count( $test ) ) { + $result = grapheme_stripos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_stripos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strrpos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( "abc", "d", "false" ), + array( "abc", "c", 2 ), + array( "abc", "b", 1 ), + array( "abc", "a", 0 ), + array( "abc", "a", 0, 0 ), + array( "abc", "a", 1, "false" ), + array( "ababc", "a", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "bc", "false" ), + array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), + array( "abc", "defghijklmnopq", "false" ), + array( "abc", "ab", 0 ), + array( "abc", "bc", 1 ), + array( "abc", "abc", 0 ), + array( "abc", "abcd", "false" ), + array( "abc", "ab", 0, 0 ), + array( "abc", "abc", 0, 0 ), + array( "abc", "abc", 1, "false" ), + array( "ababc", "ab", 1, 2 ), + array( "ababc", "abc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strrpos"; + if ( 3 == count( $test ) ) { + $result = grapheme_strrpos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_strrpos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strripos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + $tests = array( + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), + array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "Abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "A", "false" ), + array( "abc", "D", "false" ), + array( "abC", "c", 2 ), + array( "abc", "B", 1 ), + array( "Abc", "a", 0 ), + array( "abc", "A", 0, 0 ), + array( "Abc", "a", 1, "false" ), + array( "ababc", "A", 1, 2 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "BC", "false" ), + array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), + array( "aBC", "Defghijklmnopq", "false" ), + array( "abC", "Ab", 0 ), + array( "aBC", "bc", 1 ), + array( "abC", "Abc", 0 ), + array( "abC", "aBcd", "false" ), + array( "ABc", "ab", 0, 0 ), + array( "aBc", "abC", 0, 0 ), + array( "abc", "aBc", 1, "false" ), + array( "ABabc", "AB", 1, 2 ), + array( "abaBc", "aBc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strripos"; + if ( 3 == count( $test ) ) { + $result = grapheme_strripos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_strripos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_substr($string, $start, $length = -1) {}' . "\n\n"; + + $tests = array( + + array( "abc", 3, "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", 2, "a" . $char_A_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 5, "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, 4, $char_O_diaeresis_nfd ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "bc" ), + array( "a" . $char_A_ring_nfd . "bc", 1, $char_A_ring_nfd . "bc" ), + array( "Abc", -5, "false" ), + array( $char_a_ring_nfd . "bc", 3, "false" ), + array( "abc", 4, "false" ), + array( "abC", 2, "C" ), + array( "abc", 1, "bc" ), + array( "Abc", 1, 1, "b" ), + array( "abc", 0, 2, "ab" ), + array( "Abc", -4, 1, "false" ), + array( "ababc", 1, 2, "ba" ), + array( "ababc", 0, 10, "ababc" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -1, "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -2, "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -3, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -4, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -4, "a" . $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -5, "a" . $char_a_ring_nfd . "b" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -6, "a" . $char_a_ring_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -7, "a" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -8, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -9, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -7, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -6, "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -5, "c" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -4, $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -3, "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -2, "pq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -1, "q" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -999, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 7, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 6, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 5, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 4, "a" . $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 3, "a" . $char_a_ring_nfd . "b" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 2, "a" . $char_a_ring_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 1, "a" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 0, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -999, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -4, "a" . $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -5, "a" . $char_a_ring_nfd . "b" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -6, "a" . $char_a_ring_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -7, "a" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -8, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -9, "false" ), + + ); + + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr"; + if ( 3 == count( $test ) ) { + $result = grapheme_substr($test[0], $test[1]); + } + else { + $res_str .= " with length $test[2]"; + $result = grapheme_substr($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( "abc", "d", "false" ), + array( "abc", "c", "c" ), + array( "abc", "b", "bc" ), + array( "abc", "a", "abc" ), + array( "abc", "ab", "abc" ), + array( "abc", "abc", "abc" ), + array( "abc", "bc", "bc" ), + array( "abc", "a", FALSE, "abc" ), + array( "abc", "a", TRUE, "" ), + array( "abc", "b", TRUE, "a" ), + array( "abc", "c", TRUE, "ab" ), + array( "ababc", "bab", TRUE, "a" ), + array( "ababc", "abc", TRUE, "ab" ), + array( "ababc", "abc", FALSE, "abc" ), + + array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), + array( "bc" . $char_a_ring_nfd . "a", "a", "a" ), + array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( $char_a_ring_nfd . "abc", "ab", "abc" ), + array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"), + array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ), + array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ), + array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ), + array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), + array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ), + array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ), + + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr"; + if ( 3 == count( $test ) ) { + $result = grapheme_strstr($test[0], $test[1]); + } + else { + $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); + $result = grapheme_strstr($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), + array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "A", "false" ), + array( "abc", "d", "false" ), + array( "abc", "C", "c" ), + array( "aBc", "b", "Bc" ), + array( "abc", "A", "abc" ), + array( "abC", "ab", "abC" ), + array( "abc", "aBc", "abc" ), + array( "abC", "bc", "bC" ), + array( "abc", "A", FALSE, "abc" ), + array( "abc", "a", TRUE, "" ), + array( "aBc", "b", TRUE, "a" ), + array( "abc", "C", TRUE, "ab" ), + array( "aBabc", "bab", TRUE, "a" ), + array( "ababc", "aBc", TRUE, "ab" ), + array( "ababc", "abC", FALSE, "abc" ), + + array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), + array( "bc" . $char_a_ring_nfd . "A", "a", "A" ), + array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ), + array( $char_A_ring_nfd . "bc", "a", "false" ), + array( $char_a_ring_nfd . "abc", "Ab", "abc" ), + array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd), + array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), + array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ), + array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ), + array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ), + array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), + array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ), + array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ), + + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr"; + if ( 3 == count( $test ) ) { + $result = grapheme_stristr($test[0], $test[1]); + } + else { + $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); + $result = grapheme_stristr($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n"; + + $tests = array( + // haystack, count, [[offset], [next]], result + array( "abc", 3, "abc" ), + array( "abc", 2, "ab" ), + array( "abc", 1, "a" ), + array( "abc", 0, "" ), + array( "abc", 1, 0, "a" ), + array( "abc", 1, 1, "b" ), + array( "abc", 1, 2, "c" ), + array( "abc", 0, 2, "" ), + + array( "abc", 3, 0, 3, "abc" ), + array( "abc", 2, 0, 2, "ab" ), + array( "abc", 1, 0, 1, "a" ), + array( "abc", 0, 0, 0, "" ), + array( "abc", 1, 0, 1, "a" ), + array( "abc", 1, 1, 2, "b" ), + array( "abc", 1, 2, 3, "c" ), + array( "abc", 1, -2, 2, "b" ), + array( "abc", 0, 2, 2, "" ), array( "http://news.bbc.co.uk/2/hi/middle_east/7831588.stm", 48, 48 , 50 , "tm" ), - array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ), - array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ), - array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ), - array( $char_a_ring_nfd . "bcde", 2, -4, 5, "bc" ), - array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ), - array( $char_a_ring_nfd . "bcde", 2, -7, 4, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ), - array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, -6, 11, "de" . $char_a_ring_nfd . "f" ), - - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 4, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 7, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), - - ); - - $next = -1; - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract"; - if ( 3 == count( $test ) ) { - $result = grapheme_extract($test[0], $test[1]); - } - elseif ( 4 == count ( $test ) ) { - $res_str .= " starting at byte position $test[2]"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]); - } - else { - $res_str .= " starting at byte position $test[2] with \$next"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]); - if ( 5 == count ( $test ) ) { - $res_str .= " \$next=$next == $test[3] "; - if ( $next != $test[3] ) { - $res_str .= "***FAILED***"; - } - } - $res_str .= "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n"; - - $tests = array( - array( "abc", 3, "abc" ), - array( "abc", 2, "ab" ), - array( "abc", 1, "a" ), - array( "abc", 0, "" ), - array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ), - array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bc", 1, "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 9, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 10, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 11, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 4, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 7, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), - - ); - - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES"; - if ( 3 == count( $test ) ) { - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES); - } - else { - $res_str .= " starting at byte position $test[2]"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n"; - - $tests = array( - array( "abc", 3, "abc" ), - array( "abc", 2, "ab" ), - array( "abc", 1, "a" ), - array( "abc", 0, "" ), - array( "abc" . $char_o_diaeresis_nfd, 0, "" ), - array( "abc" . $char_o_diaeresis_nfd, 1, "a" ), - array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ), - array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ), - array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ), - array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd), - array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . "abc", 0, "" ), - array( $char_o_diaeresis_nfd . "abc", 1, "" ), - array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ), - array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ), - array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), - - array( "abc", 3, 0, "abc" ), - array( "abc", 2, 1, "bc" ), - array( "abc", 1, 2, "c" ), - array( "abc", 0, 3, "false" ), - array( "abc", 1, 3, "false" ), - array( "abc", 1, 999, "false" ), - array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ), - array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ), - - ); - - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS"; - if ( 3 == count( $test ) ) { - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS); - } - else { - $res_str .= " starting at byte position $test[2]"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - - return $res_str; + array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ), + array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ), + array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ), + array( $char_a_ring_nfd . "bcde", 2, -4, 5, "bc" ), + array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ), + array( $char_a_ring_nfd . "bcde", 2, -7, 4, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ), + array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, -6, 11, "de" . $char_a_ring_nfd . "f" ), + + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 4, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 7, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), + + ); + + $next = -1; + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract"; + if ( 3 == count( $test ) ) { + $result = grapheme_extract($test[0], $test[1]); + } + elseif ( 4 == count ( $test ) ) { + $res_str .= " starting at byte position $test[2]"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]); + } + else { + $res_str .= " starting at byte position $test[2] with \$next"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]); + if ( 5 == count ( $test ) ) { + $res_str .= " \$next=$next == $test[3] "; + if ( $next != $test[3] ) { + $res_str .= "***FAILED***"; + } + } + $res_str .= "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n"; + + $tests = array( + array( "abc", 3, "abc" ), + array( "abc", 2, "ab" ), + array( "abc", 1, "a" ), + array( "abc", 0, "" ), + array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ), + array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bc", 1, "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 9, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 10, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 11, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 4, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 7, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), + + ); + + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES"; + if ( 3 == count( $test ) ) { + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES); + } + else { + $res_str .= " starting at byte position $test[2]"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n"; + + $tests = array( + array( "abc", 3, "abc" ), + array( "abc", 2, "ab" ), + array( "abc", 1, "a" ), + array( "abc", 0, "" ), + array( "abc" . $char_o_diaeresis_nfd, 0, "" ), + array( "abc" . $char_o_diaeresis_nfd, 1, "a" ), + array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ), + array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ), + array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ), + array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd), + array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . "abc", 0, "" ), + array( $char_o_diaeresis_nfd . "abc", 1, "" ), + array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ), + array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ), + array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), + + array( "abc", 3, 0, "abc" ), + array( "abc", 2, 1, "bc" ), + array( "abc", 1, 2, "c" ), + array( "abc", 0, 3, "false" ), + array( "abc", 1, 3, "false" ), + array( "abc", 1, 999, "false" ), + array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ), + array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ), + + ); + + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS"; + if ( 3 == count( $test ) ) { + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS); + } + else { + $res_str .= " starting at byte position $test[2]"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + + return $res_str; } echo ut_main(); function check_result($result, $expected) { - if ( $result === false ) { - $result = 'false'; - } + if ( $result === false ) { + $result = 'false'; + } - if ( strcmp($result, $expected) != 0 ) { - return " **FAILED** "; - } + if ( strcmp($result, $expected) != 0 ) { + return " **FAILED** "; + } - return ""; + return ""; } ?> diff --git a/ext/intl/tests/gregoriancalendar___construct_error.phpt b/ext/intl/tests/gregoriancalendar___construct_error.phpt index 2f468a12c5..41bfc49398 100644 --- a/ext/intl/tests/gregoriancalendar___construct_error.phpt +++ b/ext/intl/tests/gregoriancalendar___construct_error.phpt @@ -24,14 +24,14 @@ try { echo $e->getMessage(), "\n"; } try { - var_dump(new IntlGregorianCalendar(1,2,NULL,4)); + var_dump(new IntlGregorianCalendar(1,2,NULL,4)); } catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } try { - var_dump(new IntlGregorianCalendar(1,2,3,4,NULL,array())); + var_dump(new IntlGregorianCalendar(1,2,3,4,NULL,array())); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } --EXPECT-- Too many arguments diff --git a/ext/intl/tests/idn_uts46_basic.phpt b/ext/intl/tests/idn_uts46_basic.phpt index 881e8311c9..5178c08d6c 100644 --- a/ext/intl/tests/idn_uts46_basic.phpt +++ b/ext/intl/tests/idn_uts46_basic.phpt @@ -13,14 +13,14 @@ $asciiNonTrans = "www.xn--fuball-cta.com"; echo "all ok, no details:", "\n"; var_dump(idn_to_ascii($utf8dn, - IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46)); + IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46)); echo "all ok, no details, transitional:", "\n"; var_dump(idn_to_ascii($utf8dn, 0, INTL_IDNA_VARIANT_UTS46)); echo "all ok, with details:", "\n"; var_dump(idn_to_ascii($utf8dn, IDNA_NONTRANSITIONAL_TO_ASCII, - INTL_IDNA_VARIANT_UTS46, $info)); + INTL_IDNA_VARIANT_UTS46, $info)); var_dump($info); echo "reverse, ok, with details:", "\n"; diff --git a/ext/intl/tests/idn_uts46_errors.phpt b/ext/intl/tests/idn_uts46_errors.phpt index e468e8caf8..35aa1cb073 100644 --- a/ext/intl/tests/idn_uts46_errors.phpt +++ b/ext/intl/tests/idn_uts46_errors.phpt @@ -22,14 +22,14 @@ var_dump(idn_to_ascii("www.fußball.com-", 0, INTL_IDNA_VARIANT_UTS46)); echo "with error, with details arg:", "\n"; var_dump(idn_to_ascii("www.fußball.com-", IDNA_NONTRANSITIONAL_TO_ASCII, - INTL_IDNA_VARIANT_UTS46, $foo)); + INTL_IDNA_VARIANT_UTS46, $foo)); var_dump($foo); echo "with error, with details arg, contextj:", "\n"; var_dump(idn_to_ascii( - html_entity_decode("www.a‍b.com", 0, "UTF-8"), - IDNA_NONTRANSITIONAL_TO_ASCII | IDNA_CHECK_CONTEXTJ, - INTL_IDNA_VARIANT_UTS46, $foo)); + html_entity_decode("www.a‍b.com", 0, "UTF-8"), + IDNA_NONTRANSITIONAL_TO_ASCII | IDNA_CHECK_CONTEXTJ, + INTL_IDNA_VARIANT_UTS46, $foo)); var_dump($foo); var_dump($foo["errors"]==IDNA_ERROR_CONTEXTJ); diff --git a/ext/intl/tests/ini_use_exceptions_basic.phpt b/ext/intl/tests/ini_use_exceptions_basic.phpt index 36ccbcb8a0..8945c130eb 100644 --- a/ext/intl/tests/ini_use_exceptions_basic.phpt +++ b/ext/intl/tests/ini_use_exceptions_basic.phpt @@ -7,9 +7,9 @@ intl.use_exceptions INI setting ini_set("intl.use_exceptions", true); $t = transliterator_create('any-hex'); try { - var_dump($t->transliterate('a', 3)); + var_dump($t->transliterate('a', 3)); } catch (IntlException $intlE) { - var_dump($intlE->getMessage()); + var_dump($intlE->getMessage()); } ini_set("intl.use_exceptions", false); ini_set("intl.error_level", E_NOTICE); diff --git a/ext/intl/tests/locale_accept.phpt b/ext/intl/tests/locale_accept.phpt index 6a29cd6723..ad1f64e708 100644 --- a/ext/intl/tests/locale_accept.phpt +++ b/ext/intl/tests/locale_accept.phpt @@ -12,19 +12,19 @@ locale_accept_from_http function ut_main() { - $res_str = ""; - $http_acc = array( - 'en-us,en;q=0.5', - 'da, en-gb;q=0.8, en;q=0.7', - 'zh, en-us;q=0.8, en;q=0.7', - 'xx, fr-FR;q=0.3, de-DE;q=0.5', - 'none', - ); + $res_str = ""; + $http_acc = array( + 'en-us,en;q=0.5', + 'da, en-gb;q=0.8, en;q=0.7', + 'zh, en-us;q=0.8, en;q=0.7', + 'xx, fr-FR;q=0.3, de-DE;q=0.5', + 'none', + ); foreach($http_acc as $http) { - $res = ut_loc_accept_http($http); - $res_str .= @"Accepting $http: $res\n"; - } + $res = ut_loc_accept_http($http); + $res_str .= @"Accepting $http: $res\n"; + } return $res_str; } diff --git a/ext/intl/tests/locale_bug72658.phpt b/ext/intl/tests/locale_bug72658.phpt index 4a68e2681b..6ac8048406 100644 --- a/ext/intl/tests/locale_bug72658.phpt +++ b/ext/intl/tests/locale_bug72658.phpt @@ -6,8 +6,8 @@ Bug #72658 Locale::lookup() / locale_lookup() hangs if no match found <?php var_dump( - Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', true, 'de-DE'), - Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', false, 'de-DE') + Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', true, 'de-DE'), + Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', false, 'de-DE') ); ?> diff --git a/ext/intl/tests/locale_compose_locale.phpt b/ext/intl/tests/locale_compose_locale.phpt index 5eef05b3e6..e09e104c85 100644 --- a/ext/intl/tests/locale_compose_locale.phpt +++ b/ext/intl/tests/locale_compose_locale.phpt @@ -12,120 +12,120 @@ locale_compose_locale() function ut_main() { - $loc_parts_arr1 = array( - Locale::LANG_TAG =>'sl' , - Locale::SCRIPT_TAG =>'Latn' , - Locale::REGION_TAG =>'IT' - ); - $loc_parts_arr2 = array( - Locale::LANG_TAG =>'de' , - Locale::REGION_TAG =>'DE' - ); - $loc_parts_arr3 = array( - Locale::LANG_TAG =>'hi' - ); - $loc_parts_arr4 = array( - Locale::LANG_TAG =>'zh' , - Locale::SCRIPT_TAG =>'Hans' , - Locale::REGION_TAG =>'CN' - ); - $loc_parts_arr5 = array( - Locale::LANG_TAG =>'es' , - Locale::SCRIPT_TAG =>'Hans' , - Locale::REGION_TAG =>'CN' - ); - $loc_parts_arr6 = array( - Locale::LANG_TAG =>'en' , - Locale::SCRIPT_TAG =>'Hans' , - Locale::REGION_TAG =>'CN', - Locale::VARIANT_TAG.'14' =>'rozaj' , - 'variant1'=>'nedis' - ); - $loc_parts_arr7 = array( - Locale::LANG_TAG =>'en' , - Locale::SCRIPT_TAG =>'Hans' , - Locale::REGION_TAG =>'CN', - 'variant14'=>'rozaj' , - 'variant1'=>'nedis' , - 'extlang0'=>'lng' , - 'extlang1'=>'ing' - ); - $loc_parts_arr8 = array( - Locale::LANG_TAG =>'en' , - Locale::SCRIPT_TAG =>'Hans' , - Locale::REGION_TAG =>'CN', - 'variant14'=>'rozaj' , - 'variant1'=>'nedis' , - 'extlang0'=>'lng' , - 'extlang1'=>'ing', - 'private7'=>'prv1' , - 'private9'=>'prv2' - ); - $loc_parts_arr9 = array( - Locale::REGION_TAG =>'DE' - ); - $loc_parts_arr10 = array( - Locale::LANG_TAG => 45, - Locale::REGION_TAG => false, - Locale::SCRIPT_TAG => 15 - ); - $loc_parts_arr11 = array( - Locale::LANG_TAG =>'de' , - Locale::REGION_TAG =>'DE', - 'private0' => 13, - 'variant1' => array(), - 'extlang2' => false - ); + $loc_parts_arr1 = array( + Locale::LANG_TAG =>'sl' , + Locale::SCRIPT_TAG =>'Latn' , + Locale::REGION_TAG =>'IT' + ); + $loc_parts_arr2 = array( + Locale::LANG_TAG =>'de' , + Locale::REGION_TAG =>'DE' + ); + $loc_parts_arr3 = array( + Locale::LANG_TAG =>'hi' + ); + $loc_parts_arr4 = array( + Locale::LANG_TAG =>'zh' , + Locale::SCRIPT_TAG =>'Hans' , + Locale::REGION_TAG =>'CN' + ); + $loc_parts_arr5 = array( + Locale::LANG_TAG =>'es' , + Locale::SCRIPT_TAG =>'Hans' , + Locale::REGION_TAG =>'CN' + ); + $loc_parts_arr6 = array( + Locale::LANG_TAG =>'en' , + Locale::SCRIPT_TAG =>'Hans' , + Locale::REGION_TAG =>'CN', + Locale::VARIANT_TAG.'14' =>'rozaj' , + 'variant1'=>'nedis' + ); + $loc_parts_arr7 = array( + Locale::LANG_TAG =>'en' , + Locale::SCRIPT_TAG =>'Hans' , + Locale::REGION_TAG =>'CN', + 'variant14'=>'rozaj' , + 'variant1'=>'nedis' , + 'extlang0'=>'lng' , + 'extlang1'=>'ing' + ); + $loc_parts_arr8 = array( + Locale::LANG_TAG =>'en' , + Locale::SCRIPT_TAG =>'Hans' , + Locale::REGION_TAG =>'CN', + 'variant14'=>'rozaj' , + 'variant1'=>'nedis' , + 'extlang0'=>'lng' , + 'extlang1'=>'ing', + 'private7'=>'prv1' , + 'private9'=>'prv2' + ); + $loc_parts_arr9 = array( + Locale::REGION_TAG =>'DE' + ); + $loc_parts_arr10 = array( + Locale::LANG_TAG => 45, + Locale::REGION_TAG => false, + Locale::SCRIPT_TAG => 15 + ); + $loc_parts_arr11 = array( + Locale::LANG_TAG =>'de' , + Locale::REGION_TAG =>'DE', + 'private0' => 13, + 'variant1' => array(), + 'extlang2' => false + ); $loc_parts_arr12 = array( Locale::LANG_TAG =>'en' , Locale::SCRIPT_TAG =>'Hans' , Locale::REGION_TAG =>'CN', Locale::VARIANT_TAG => array('nedis', 'rozaj'), - Locale::PRIVATE_TAG => array('prv1', 'prv2'), - Locale::EXTLANG_TAG => array('lng', 'ing') + Locale::PRIVATE_TAG => array('prv1', 'prv2'), + Locale::EXTLANG_TAG => array('lng', 'ing') ); - $loc_parts_arr = array( - 'loc1' => $loc_parts_arr1 , - 'loc2' => $loc_parts_arr2 , - 'loc3' => $loc_parts_arr3 , - 'loc4' => $loc_parts_arr4 , - 'loc5' => $loc_parts_arr5 , - 'loc6' => $loc_parts_arr6 , - 'loc7' => $loc_parts_arr7 , - 'loc8' => $loc_parts_arr8 , - 'loc9' => $loc_parts_arr9 , - 'loc10' => $loc_parts_arr10 , - 'loc11' => $loc_parts_arr11 , - 'loc12' => $loc_parts_arr12 - ); + $loc_parts_arr = array( + 'loc1' => $loc_parts_arr1 , + 'loc2' => $loc_parts_arr2 , + 'loc3' => $loc_parts_arr3 , + 'loc4' => $loc_parts_arr4 , + 'loc5' => $loc_parts_arr5 , + 'loc6' => $loc_parts_arr6 , + 'loc7' => $loc_parts_arr7 , + 'loc8' => $loc_parts_arr8 , + 'loc9' => $loc_parts_arr9 , + 'loc10' => $loc_parts_arr10 , + 'loc11' => $loc_parts_arr11 , + 'loc12' => $loc_parts_arr12 + ); error_reporting( E_ERROR ); $cnt = 0; $res_str = ''; - foreach($loc_parts_arr as $key => $value ){ - $res_str .= "\n------------"; - $res_str .= "\nInput Array name is : loc".(++$cnt) ; + foreach($loc_parts_arr as $key => $value ){ + $res_str .= "\n------------"; + $res_str .= "\nInput Array name is : loc".(++$cnt) ; /* - foreach($value as $valKey => $valValue ){ - $res_str .= $valKey ."->".$valValue." " ; - } + foreach($value as $valKey => $valValue ){ + $res_str .= $valKey ."->".$valValue." " ; + } */ - $locale = ut_loc_locale_compose( $value); - $res_str .= "\n\nComposed Locale: "; - if( $locale){ - $res_str .= "$locale"; - }else{ - $res_str .= "No values found from Locale compose due to the following error:\n"; - $res_str .= intl_get_error_message() ; - } - } - - $res_str .= "\n------------"; - $res_str .= "\n"; + $locale = ut_loc_locale_compose( $value); + $res_str .= "\n\nComposed Locale: "; + if( $locale){ + $res_str .= "$locale"; + }else{ + $res_str .= "No values found from Locale compose due to the following error:\n"; + $res_str .= intl_get_error_message() ; + } + } + + $res_str .= "\n------------"; + $res_str .= "\n"; return $res_str; } diff --git a/ext/intl/tests/locale_filter_matches2.phpt b/ext/intl/tests/locale_filter_matches2.phpt index e75079deb3..82e16dafce 100644 --- a/ext/intl/tests/locale_filter_matches2.phpt +++ b/ext/intl/tests/locale_filter_matches2.phpt @@ -13,60 +13,60 @@ locale_filter_matches.phpt() icu >= 4.8 && icu < 50.1.2 function ut_main() { - $loc_ranges = array( - 'de-de', - 'sl_IT', - 'sl_IT_Nedis', - 'jbo', - 'art-lojban', - 'sl_IT' - ); + $loc_ranges = array( + 'de-de', + 'sl_IT', + 'sl_IT_Nedis', + 'jbo', + 'art-lojban', + 'sl_IT' + ); - $lang_tags = array( - 'de-DEVA', - 'de-DE-1996', - 'de-DE', - 'zh_Hans', - 'de-CH-1996', - 'sl_IT', - 'sl_IT_nedis-a-kirti-x-xyz', - 'sl_IT_rozaj', - 'sl_IT_NEDIS_ROJAZ_1901', - 'i-enochian', - 'sgn-CH-de', - 'art-lojban', - 'i-lux', - 'art-lojban', - 'jbo', - 'en_sl_IT' - ); + $lang_tags = array( + 'de-DEVA', + 'de-DE-1996', + 'de-DE', + 'zh_Hans', + 'de-CH-1996', + 'sl_IT', + 'sl_IT_nedis-a-kirti-x-xyz', + 'sl_IT_rozaj', + 'sl_IT_NEDIS_ROJAZ_1901', + 'i-enochian', + 'sgn-CH-de', + 'art-lojban', + 'i-lux', + 'art-lojban', + 'jbo', + 'en_sl_IT' + ); $res_str = ''; $isCanonical = false; - foreach($loc_ranges as $loc_range){ - foreach($lang_tags as $lang_tag){ - $res_str .="--------------\n"; - $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical); - $res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? "; - if( $result){ - $res_str .= "YES\n"; - }else{ - $res_str .= "NO\n"; - } + foreach($loc_ranges as $loc_range){ + foreach($lang_tags as $lang_tag){ + $res_str .="--------------\n"; + $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical); + $res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? "; + if( $result){ + $res_str .= "YES\n"; + }else{ + $res_str .= "NO\n"; + } //canonicalized version - $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical)); - $can_loc_range = ut_loc_canonicalize($loc_range); - $can_lang_tag = ut_loc_canonicalize($lang_tag); - $res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? "; - if( $result){ - $res_str .= "YES\n"; - }else{ - $res_str .= "NO\n"; - } - } - } + $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical)); + $can_loc_range = ut_loc_canonicalize($loc_range); + $can_lang_tag = ut_loc_canonicalize($lang_tag); + $res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? "; + if( $result){ + $res_str .= "YES\n"; + }else{ + $res_str .= "NO\n"; + } + } + } - $res_str .= "\n"; + $res_str .= "\n"; return $res_str; } diff --git a/ext/intl/tests/locale_filter_matches3.phpt b/ext/intl/tests/locale_filter_matches3.phpt index 2816ba5e12..703ba78154 100644 --- a/ext/intl/tests/locale_filter_matches3.phpt +++ b/ext/intl/tests/locale_filter_matches3.phpt @@ -13,60 +13,60 @@ locale_filter_matches.phpt() ICU >= 51.2 function ut_main() { - $loc_ranges = array( - 'de-de', - 'sl_IT', - 'sl_IT_Nedis', - 'jbo', - 'art-lojban', - 'sl_IT' - ); + $loc_ranges = array( + 'de-de', + 'sl_IT', + 'sl_IT_Nedis', + 'jbo', + 'art-lojban', + 'sl_IT' + ); - $lang_tags = array( - 'de-DEVA', - 'de-DE-1996', - 'de-DE', - 'zh_Hans', - 'de-CH-1996', - 'sl_IT', - 'sl_IT_nedis-a-kirti-x-xyz', - 'sl_IT_rozaj', - 'sl_IT_NEDIS_ROJAZ_1901', - 'i-enochian', - 'sgn-CH-de', - 'art-lojban', - 'i-lux', - 'art-lojban', - 'jbo', - 'en_sl_IT' - ); + $lang_tags = array( + 'de-DEVA', + 'de-DE-1996', + 'de-DE', + 'zh_Hans', + 'de-CH-1996', + 'sl_IT', + 'sl_IT_nedis-a-kirti-x-xyz', + 'sl_IT_rozaj', + 'sl_IT_NEDIS_ROJAZ_1901', + 'i-enochian', + 'sgn-CH-de', + 'art-lojban', + 'i-lux', + 'art-lojban', + 'jbo', + 'en_sl_IT' + ); $res_str = ''; $isCanonical = false; - foreach($loc_ranges as $loc_range){ - foreach($lang_tags as $lang_tag){ - $res_str .="--------------\n"; - $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical); - $res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? "; - if( $result){ - $res_str .= "YES\n"; - }else{ - $res_str .= "NO\n"; - } + foreach($loc_ranges as $loc_range){ + foreach($lang_tags as $lang_tag){ + $res_str .="--------------\n"; + $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical); + $res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? "; + if( $result){ + $res_str .= "YES\n"; + }else{ + $res_str .= "NO\n"; + } //canonicalized version - $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical)); - $can_loc_range = ut_loc_canonicalize($loc_range); - $can_lang_tag = ut_loc_canonicalize($lang_tag); - $res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? "; - if( $result){ - $res_str .= "YES\n"; - }else{ - $res_str .= "NO\n"; - } - } - } + $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical)); + $can_loc_range = ut_loc_canonicalize($loc_range); + $can_lang_tag = ut_loc_canonicalize($lang_tag); + $res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? "; + if( $result){ + $res_str .= "YES\n"; + }else{ + $res_str .= "NO\n"; + } + } + } - $res_str .= "\n"; + $res_str .= "\n"; return $res_str; } diff --git a/ext/intl/tests/locale_get_all_variants.phpt b/ext/intl/tests/locale_get_all_variants.phpt index 8f2bcbfa39..7807e2b09a 100644 --- a/ext/intl/tests/locale_get_all_variants.phpt +++ b/ext/intl/tests/locale_get_all_variants.phpt @@ -12,34 +12,34 @@ locale_get_all_variants.phpt() function ut_main() { - $locales = array( - 'sl_IT_nedis_KIRTI', - 'sl_IT_nedis-a-kirti-x-xyz', - 'sl_IT_rozaj', - 'sl_IT_NEDIS_ROJAZ_1901', - 'i-enochian', - 'zh-hakka', - 'zh-wuu', - 'i-tay', - 'sgn-BE-nl', - 'sgn-CH-de', - 'sl_IT_rozaj@currency=EUR' - ); + $locales = array( + 'sl_IT_nedis_KIRTI', + 'sl_IT_nedis-a-kirti-x-xyz', + 'sl_IT_rozaj', + 'sl_IT_NEDIS_ROJAZ_1901', + 'i-enochian', + 'zh-hakka', + 'zh-wuu', + 'i-tay', + 'sgn-BE-nl', + 'sgn-CH-de', + 'sl_IT_rozaj@currency=EUR' + ); $res_str = ''; - foreach($locales as $locale){ - $variants_arr = ut_loc_locale_get_all_variants( $locale); - $res_str .= "$locale : variants "; - if( $variants_arr){ - foreach($variants_arr as $variant){ - $res_str .= "'$variant',"; - } - }else{ - $res_str .= "--none"; - } - $res_str .= "\n"; - } + foreach($locales as $locale){ + $variants_arr = ut_loc_locale_get_all_variants( $locale); + $res_str .= "$locale : variants "; + if( $variants_arr){ + foreach($variants_arr as $variant){ + $res_str .= "'$variant',"; + } + }else{ + $res_str .= "--none"; + } + $res_str .= "\n"; + } - $res_str .= "\n"; + $res_str .= "\n"; return $res_str; } diff --git a/ext/intl/tests/locale_get_display_language.phpt b/ext/intl/tests/locale_get_display_language.phpt index 2df91ba71d..e441b2efc6 100644 --- a/ext/intl/tests/locale_get_display_language.phpt +++ b/ext/intl/tests/locale_get_display_language.phpt @@ -14,7 +14,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'uk-ua_CALIFORNIA@currency=;currency=GRN', @@ -72,15 +72,15 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_language( $locale ,$disp_locale ); - $res_str .= "disp_locale=$disp_locale : display_language=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_language( $locale ,$disp_locale ); + $res_str .= "disp_locale=$disp_locale : display_language=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_display_name2.phpt b/ext/intl/tests/locale_get_display_name2.phpt index 313e89b3c0..1d16dd023b 100644 --- a/ext/intl/tests/locale_get_display_name2.phpt +++ b/ext/intl/tests/locale_get_display_name2.phpt @@ -15,7 +15,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'sl_IT_nedis_KIRTI', @@ -83,16 +83,16 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); - $res_str .= "disp_locale=$disp_locale : display_name=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_name( $locale ,$disp_locale ); + $scr = str_replace(array('(', ')'), '#', $scr); + $res_str .= "disp_locale=$disp_locale : display_name=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_display_name3.phpt b/ext/intl/tests/locale_get_display_name3.phpt index 2052a6d456..d0c2307288 100644 --- a/ext/intl/tests/locale_get_display_name3.phpt +++ b/ext/intl/tests/locale_get_display_name3.phpt @@ -15,7 +15,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'sl_IT_nedis_KIRTI', @@ -83,16 +83,16 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); - $res_str .= "disp_locale=$disp_locale : display_name=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_name( $locale ,$disp_locale ); + $scr = str_replace(array('(', ')'), '#', $scr); + $res_str .= "disp_locale=$disp_locale : display_name=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_display_name4.phpt b/ext/intl/tests/locale_get_display_name4.phpt index a0b40a4114..e431b25151 100644 --- a/ext/intl/tests/locale_get_display_name4.phpt +++ b/ext/intl/tests/locale_get_display_name4.phpt @@ -16,7 +16,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'sl_IT_nedis_KIRTI', @@ -84,16 +84,16 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); - $res_str .= "disp_locale=$disp_locale : display_name=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_name( $locale ,$disp_locale ); + $scr = str_replace(array('(', ')'), '#', $scr); + $res_str .= "disp_locale=$disp_locale : display_name=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_display_name5.phpt b/ext/intl/tests/locale_get_display_name5.phpt index ac64fee021..9f4e1b645c 100644 --- a/ext/intl/tests/locale_get_display_name5.phpt +++ b/ext/intl/tests/locale_get_display_name5.phpt @@ -16,7 +16,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'sl_IT_nedis_KIRTI', @@ -84,16 +84,16 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); - $res_str .= "disp_locale=$disp_locale : display_name=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_name( $locale ,$disp_locale ); + $scr = str_replace(array('(', ')'), '#', $scr); + $res_str .= "disp_locale=$disp_locale : display_name=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_display_name6.phpt b/ext/intl/tests/locale_get_display_name6.phpt index 9d0542c3d4..a00464e73e 100644 --- a/ext/intl/tests/locale_get_display_name6.phpt +++ b/ext/intl/tests/locale_get_display_name6.phpt @@ -16,7 +16,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'sl_IT_nedis_KIRTI', @@ -84,16 +84,16 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); - $res_str .= "disp_locale=$disp_locale : display_name=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_name( $locale ,$disp_locale ); + $scr = str_replace(array('(', ')'), '#', $scr); + $res_str .= "disp_locale=$disp_locale : display_name=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_display_name7.phpt b/ext/intl/tests/locale_get_display_name7.phpt index 91e2c92e87..8ef0c09241 100644 --- a/ext/intl/tests/locale_get_display_name7.phpt +++ b/ext/intl/tests/locale_get_display_name7.phpt @@ -15,7 +15,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'sl_IT_nedis_KIRTI', @@ -83,16 +83,16 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); - $res_str .= "disp_locale=$disp_locale : display_name=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_name( $locale ,$disp_locale ); + $scr = str_replace(array('(', ')'), '#', $scr); + $res_str .= "disp_locale=$disp_locale : display_name=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_keywords2.phpt b/ext/intl/tests/locale_get_keywords2.phpt index 23a099b4ed..8d6f3d113b 100644 --- a/ext/intl/tests/locale_get_keywords2.phpt +++ b/ext/intl/tests/locale_get_keywords2.phpt @@ -15,12 +15,12 @@ function ut_main() $res_str = ''; $locales = array( - "de_DE@currency=EUR;collation=PHONEBOOK", + "de_DE@currency=EUR;collation=PHONEBOOK", 'uk-ua_CALIFORNIA@currency=GRN' - ); + ); $locales = array( - 'de_DE@currency=EUR;collation=PHONEBOOK', + 'de_DE@currency=EUR;collation=PHONEBOOK', 'root', 'uk@currency=EURO', 'Hindi', @@ -77,14 +77,14 @@ function ut_main() { $keywords_arr = ut_loc_get_keywords( $locale); $res_str .= "$locale: "; - if( $keywords_arr){ - foreach( $keywords_arr as $key => $value){ - $res_str .= "Key is $key and Value is $value \n"; - } - } - else{ - $res_str .= "No keywords found."; - } + if( $keywords_arr){ + foreach( $keywords_arr as $key => $value){ + $res_str .= "Key is $key and Value is $value \n"; + } + } + else{ + $res_str .= "No keywords found."; + } $res_str .= "\n"; } diff --git a/ext/intl/tests/locale_get_primary_language.phpt b/ext/intl/tests/locale_get_primary_language.phpt index 65ec3d89bc..69201e8de2 100644 --- a/ext/intl/tests/locale_get_primary_language.phpt +++ b/ext/intl/tests/locale_get_primary_language.phpt @@ -16,14 +16,14 @@ function ut_main() $locales = array( 'uk-ua_CALIFORNIA@currency=;currency=GRN', - 'root', + 'root', 'uk@currency=EURO', 'Hindi', //Simple language subtag 'de', 'fr', 'ja', - 'i-enochian', //(example of a grandfathered tag) + 'i-enochian', //(example of a grandfathered tag) //Language subtag plus Script subtag: 'zh-Hant', 'zh-Hans', diff --git a/ext/intl/tests/locale_lookup.phpt b/ext/intl/tests/locale_lookup.phpt index 9d4843038d..da67b390fa 100644 --- a/ext/intl/tests/locale_lookup.phpt +++ b/ext/intl/tests/locale_lookup.phpt @@ -13,39 +13,39 @@ locale_lookup.phpt() icu >= 4.8 && icu < 50.1.2 function ut_main() { - $loc_ranges = array( - 'de-de', - 'sl_IT', - 'sl_IT_Nedis', - 'jbo', - 'art-lojban' - ); - - $lang_tags = array( - 'de-DEVA', - 'de-DE-1996', - 'de-DE', - 'zh_Hans', - 'de-CH-1996', - 'sl_IT', - 'sl_IT_nedis-a-kirti-x-xyz', - 'sl_IT_rozaj', - 'sl_IT_NEDIS_ROJAZ_1901', - 'i-enochian', - 'sgn-CH-de', - 'art-lojban', - 'i-lux', - 'art-lojban', - 'jbo', - 'en_sl_IT', - 'zh-Hant-CN-x-prv1-prv2' - ); + $loc_ranges = array( + 'de-de', + 'sl_IT', + 'sl_IT_Nedis', + 'jbo', + 'art-lojban' + ); + + $lang_tags = array( + 'de-DEVA', + 'de-DE-1996', + 'de-DE', + 'zh_Hans', + 'de-CH-1996', + 'sl_IT', + 'sl_IT_nedis-a-kirti-x-xyz', + 'sl_IT_rozaj', + 'sl_IT_NEDIS_ROJAZ_1901', + 'i-enochian', + 'sgn-CH-de', + 'art-lojban', + 'i-lux', + 'art-lojban', + 'jbo', + 'en_sl_IT', + 'zh-Hant-CN-x-prv1-prv2' + ); $res_str = ''; $isCanonical = false; - foreach($loc_ranges as $loc_range){ + foreach($loc_ranges as $loc_range){ $res_str .="--------------\n"; $result= ut_loc_locale_lookup( $lang_tags , $loc_range,$isCanonical,"en_US"); $comma_arr =implode(",",$lang_tags); @@ -56,9 +56,9 @@ function ut_main() $can_loc_range = ut_loc_canonicalize($loc_range); $res_str .= "Canonical lookup result:$result\n"; - } + } - $res_str .= "\n"; + $res_str .= "\n"; return $res_str; } diff --git a/ext/intl/tests/locale_lookup_variant2.phpt b/ext/intl/tests/locale_lookup_variant2.phpt index 75a5350abf..7375284a0b 100644 --- a/ext/intl/tests/locale_lookup_variant2.phpt +++ b/ext/intl/tests/locale_lookup_variant2.phpt @@ -13,39 +13,39 @@ locale_lookup.phpt() function ut_main() { - $loc_ranges = array( - 'de-de', - 'sl_IT', - 'sl_IT_Nedis', - 'jbo', - 'art-lojban' - ); - - $lang_tags = array( - 'de-DEVA', - 'de-DE-1996', - 'de-DE', - 'zh_Hans', - 'de-CH-1996', - 'sl_IT', - 'sl_IT_nedis-a-kirti-x-xyz', - 'sl_IT_rozaj', - 'sl_IT_NEDIS_ROJAZ_1901', - 'i-enochian', - 'sgn-CH-de', - 'art-lojban', - 'i-lux', - 'art-lojban', - 'jbo', - 'en_sl_IT', - 'zh-Hant-CN-x-prv1-prv2' - ); + $loc_ranges = array( + 'de-de', + 'sl_IT', + 'sl_IT_Nedis', + 'jbo', + 'art-lojban' + ); + + $lang_tags = array( + 'de-DEVA', + 'de-DE-1996', + 'de-DE', + 'zh_Hans', + 'de-CH-1996', + 'sl_IT', + 'sl_IT_nedis-a-kirti-x-xyz', + 'sl_IT_rozaj', + 'sl_IT_NEDIS_ROJAZ_1901', + 'i-enochian', + 'sgn-CH-de', + 'art-lojban', + 'i-lux', + 'art-lojban', + 'jbo', + 'en_sl_IT', + 'zh-Hant-CN-x-prv1-prv2' + ); $res_str = ''; $isCanonical = false; - foreach($loc_ranges as $loc_range){ + foreach($loc_ranges as $loc_range){ $res_str .="--------------\n"; $result= ut_loc_locale_lookup( $lang_tags , $loc_range,$isCanonical,"en_US"); $comma_arr =implode(",",$lang_tags); @@ -56,9 +56,9 @@ function ut_main() $can_loc_range = ut_loc_canonicalize($loc_range); $res_str .= "Canonical lookup result:$result\n"; - } + } - $res_str .= "\n"; + $res_str .= "\n"; return $res_str; } diff --git a/ext/intl/tests/locale_parse_locale2.phpt b/ext/intl/tests/locale_parse_locale2.phpt index c823f8c504..59e0c1f678 100644 --- a/ext/intl/tests/locale_parse_locale2.phpt +++ b/ext/intl/tests/locale_parse_locale2.phpt @@ -63,7 +63,7 @@ function ut_main() 'de-419-DE', 'a-DE', 'ar-a-aaa-b-bbb-a-ccc', - 'x-AAAAAA', + 'x-AAAAAA', ); diff --git a/ext/intl/tests/locale_set_default.phpt b/ext/intl/tests/locale_set_default.phpt index d56c9177cd..9f7438b98b 100644 --- a/ext/intl/tests/locale_set_default.phpt +++ b/ext/intl/tests/locale_set_default.phpt @@ -67,22 +67,22 @@ function ut_main() ); /* - $locales = array( - 'es' - ); + $locales = array( + 'es' + ); */ $res_str = ''; foreach( $locales as $locale ) { $isSuccessful = ut_loc_set_default( $locale); - if ($isSuccessful ){ - $lang = ut_loc_get_default( ); - $res_str .= "$locale: set locale '$lang'"; - } - else{ - $res_str .= "$locale: Error in set locale"; - } + if ($isSuccessful ){ + $lang = ut_loc_get_default( ); + $res_str .= "$locale: set locale '$lang'"; + } + else{ + $res_str .= "$locale: Error in set locale"; + } $res_str .= "\n"; } diff --git a/ext/intl/tests/msgfmt_bug70484.phpt b/ext/intl/tests/msgfmt_bug70484.phpt index f317be30db..660fc92f3b 100644 --- a/ext/intl/tests/msgfmt_bug70484.phpt +++ b/ext/intl/tests/msgfmt_bug70484.phpt @@ -12,25 +12,25 @@ $locale = array("de", "fr", "en", "ru",); $data = array(42, 42.42, 2147483643, 2147483643.12345, 5); foreach ($locale as $lc) { - echo "$lc string key\n"; - $m = new MessageFormatter($lc, "{n, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}"); - foreach ($data as $i) { - var_dump($m->format(array("n" => $i))); - if ($m->getErrorCode()) { - echo "$lc $i ", $m->getErrorMessage(); - } - } - echo "\n"; + echo "$lc string key\n"; + $m = new MessageFormatter($lc, "{n, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}"); + foreach ($data as $i) { + var_dump($m->format(array("n" => $i))); + if ($m->getErrorCode()) { + echo "$lc $i ", $m->getErrorMessage(); + } + } + echo "\n"; - echo "$lc numeric key\n"; - $m = new MessageFormatter($lc, "{0, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}"); - foreach ($data as $i) { - var_dump($m->format(array($i))); - if ($m->getErrorCode()) { - echo "$lc $i ", $m->getErrorMessage(); - } - } - echo "\n"; + echo "$lc numeric key\n"; + $m = new MessageFormatter($lc, "{0, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}"); + foreach ($data as $i) { + var_dump($m->format(array($i))); + if ($m->getErrorCode()) { + echo "$lc $i ", $m->getErrorMessage(); + } + } + echo "\n"; } ?> diff --git a/ext/intl/tests/msgfmt_clone_bad_obj.phpt b/ext/intl/tests/msgfmt_clone_bad_obj.phpt index 69105a6b04..829cd6f1e2 100644 --- a/ext/intl/tests/msgfmt_clone_bad_obj.phpt +++ b/ext/intl/tests/msgfmt_clone_bad_obj.phpt @@ -6,14 +6,14 @@ Cloning unconstructed MessageFormatter <?php class A extends MessageFormatter { - function __construct() {} + function __construct() {} } $a = new A; try { - $b = clone $a; + $b = clone $a; } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } --EXPECTF-- string(%d) "Cannot clone unconstructed MessageFormatter" diff --git a/ext/intl/tests/msgfmt_fail2.phpt b/ext/intl/tests/msgfmt_fail2.phpt index 688e65a861..060976d19e 100644 --- a/ext/intl/tests/msgfmt_fail2.phpt +++ b/ext/intl/tests/msgfmt_fail2.phpt @@ -6,104 +6,104 @@ msgfmt creation failures icu >= 4.8 <?php function err($fmt) { - if(!$fmt) { - echo var_export(intl_get_error_message(), true)."\n"; - } + if(!$fmt) { + echo var_export(intl_get_error_message(), true)."\n"; + } } function print_exception($e) { - echo "\n" . get_class($e) . ": " . $e->getMessage() + echo "\n" . get_class($e) . ": " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; } function crt($t, $l, $s) { - switch(true) { - case $t == "O": - try { - return new MessageFormatter($l, $s); - } catch (Throwable $e) { - print_exception($e); - return null; - } - break; - case $t == "C": - try { - return MessageFormatter::create($l, $s); - } catch (Throwable $e) { - print_exception($e); - return null; - } - break; - case $t == "P": - try { - return msgfmt_create($l, $s); - } catch (Throwable $e) { - print_exception($e); - return null; - } - break; - } + switch(true) { + case $t == "O": + try { + return new MessageFormatter($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } + break; + case $t == "C": + try { + return MessageFormatter::create($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } + break; + case $t == "P": + try { + return msgfmt_create($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } + break; + } } $args = array( - array(null, null), - array("whatever", "{0,whatever}"), - array(array(), array()), - array("en", "{0,choice}"), - array("fr", "{0,"), - array("en_US", "\xD0"), + array(null, null), + array("whatever", "{0,whatever}"), + array(array(), array()), + array("en", "{0,choice}"), + array("fr", "{0,"), + array("en_US", "\xD0"), ); try { - $fmt = new MessageFormatter(); + $fmt = new MessageFormatter(); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = msgfmt_create(); + $fmt = msgfmt_create(); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = MessageFormatter::create(); + $fmt = MessageFormatter::create(); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = new MessageFormatter('en'); + $fmt = new MessageFormatter('en'); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = msgfmt_create('en'); + $fmt = msgfmt_create('en'); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = MessageFormatter::create('en'); + $fmt = MessageFormatter::create('en'); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); foreach($args as $arg) { - $fmt = crt("O", $arg[0], $arg[1]); - err($fmt); - $fmt = crt("C", $arg[0], $arg[1]); - err($fmt); - $fmt = crt("P", $arg[0], $arg[1]); - err($fmt); + $fmt = crt("O", $arg[0], $arg[1]); + err($fmt); + $fmt = crt("C", $arg[0], $arg[1]); + err($fmt); + $fmt = crt("P", $arg[0], $arg[1]); + err($fmt); } ?> diff --git a/ext/intl/tests/msgfmt_format.phpt b/ext/intl/tests/msgfmt_format.phpt index 19581e9698..55f7d65906 100644 --- a/ext/intl/tests/msgfmt_format.phpt +++ b/ext/intl/tests/msgfmt_format.phpt @@ -17,24 +17,24 @@ function ut_main() 'ru_UA' => "{0,number,integer} мавп на {1,number,integer} деревах це {2,number} мавпи на кожному деревi", 'de' => "{0,number,integer} Affen über {1,number,integer} Bäume um {2,number} Affen pro Baum", 'en_UK' => "{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree", - 'root' => '{0,whatever} would not work!', - 'fr' => "C'est la vie!", + 'root' => '{0,whatever} would not work!', + 'fr' => "C'est la vie!", ); $str_res = ''; - $m = 4560; - $t = 123; + $m = 4560; + $t = 123; foreach( $locales as $locale => $pattern ) { $str_res .= "\nLocale is: $locale\n"; $fmt = ut_msgfmt_create( $locale, $pattern ); - if(!$fmt) { - $str_res .= dump(intl_get_error_message())."\n"; - continue; - } + if(!$fmt) { + $str_res .= dump(intl_get_error_message())."\n"; + continue; + } $str_res .= dump( ut_msgfmt_format( $fmt, array($m, $t, $m/$t) ) ) . "\n"; - $str_res .= dump( ut_msgfmt_format_message($locale, $pattern, array($m, $t, $m/$t))) . "\n"; + $str_res .= dump( ut_msgfmt_format_message($locale, $pattern, array($m, $t, $m/$t))) . "\n"; } return $str_res; } diff --git a/ext/intl/tests/msgfmt_format_intlcalendar.phpt b/ext/intl/tests/msgfmt_format_intlcalendar.phpt index 69f32e95f3..4867d767ed 100644 --- a/ext/intl/tests/msgfmt_format_intlcalendar.phpt +++ b/ext/intl/tests/msgfmt_format_intlcalendar.phpt @@ -20,7 +20,7 @@ echo $msgf->format(array($cal)), "\n"; '{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); echo "msgf2: ", $msgf->format(array($time, 'date')), " ", - $msgf->format(array($time, 'time')), "\n"; + $msgf->format(array($time, 'time')), "\n"; */ ?> diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt index 105792bff5..d60ce8c566 100644 --- a/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt +++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt @@ -20,7 +20,7 @@ echo $msgf->format(array($cal)), "\n"; '{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); echo "msgf2: ", $msgf->format(array($time, 'date')), " ", - $msgf->format(array($time, 'time')), "\n"; + $msgf->format(array($time, 'time')), "\n"; */ ?> diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt index 505a2fdafd..9235a559f8 100644 --- a/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt +++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt @@ -21,7 +21,7 @@ echo $msgf->format(array($cal)), "\n"; '{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); echo "msgf2: ", $msgf->format(array($time, 'date')), " ", - $msgf->format(array($time, 'time')), "\n"; + $msgf->format(array($time, 'time')), "\n"; */ ?> diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt index e10a51c7b8..c03254096a 100644 --- a/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt +++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt @@ -20,7 +20,7 @@ echo $msgf->format(array($cal)), "\n"; '{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); echo "msgf2: ", $msgf->format(array($time, 'date')), " ", - $msgf->format(array($time, 'time')), "\n"; + $msgf->format(array($time, 'time')), "\n"; */ ?> diff --git a/ext/intl/tests/msgfmt_format_mixed_params.phpt b/ext/intl/tests/msgfmt_format_mixed_params.phpt index a9e403a799..f891e973c0 100644 --- a/ext/intl/tests/msgfmt_format_mixed_params.phpt +++ b/ext/intl/tests/msgfmt_format_mixed_params.phpt @@ -10,7 +10,7 @@ ini_set("intl.error_level", E_WARNING); //ini_set("intl.default_locale", "nl"); $mf = new MessageFormatter('en_US', - "{0,number} -- {foo,ordinal}"); + "{0,number} -- {foo,ordinal}"); var_dump($mf->format(array(2.3, "foo" => 1.3))); var_dump($mf->format(array("foo" => 1.3, 0 => 2.3))); diff --git a/ext/intl/tests/msgfmt_format_subpatterns.phpt b/ext/intl/tests/msgfmt_format_subpatterns.phpt index c18bb4be88..50970f0b9e 100644 --- a/ext/intl/tests/msgfmt_format_subpatterns.phpt +++ b/ext/intl/tests/msgfmt_format_subpatterns.phpt @@ -45,10 +45,10 @@ $args = array( $str_res = ''; $fmt = ut_msgfmt_create( 'en_US', $pattern ); - if(!$fmt) { - $str_res .= dump(intl_get_error_message())."\n"; - return $str_res; - } + if(!$fmt) { + $str_res .= dump(intl_get_error_message())."\n"; + return $str_res; + } foreach ($args as $arg) { $str_res .= dump( ut_msgfmt_format($fmt, $arg) ). "\n"; $str_res .= dump( ut_msgfmt_format_message('en_US', $pattern, $arg) ) . "\n"; diff --git a/ext/intl/tests/msgfmt_format_subpatterns_named.phpt b/ext/intl/tests/msgfmt_format_subpatterns_named.phpt index 249f73ce2c..7b56ccb4cc 100644 --- a/ext/intl/tests/msgfmt_format_subpatterns_named.phpt +++ b/ext/intl/tests/msgfmt_format_subpatterns_named.phpt @@ -45,10 +45,10 @@ $args = array( $str_res = ''; $fmt = ut_msgfmt_create( 'en_US', $pattern ); - if(!$fmt) { - $str_res .= dump(intl_get_error_message())."\n"; - return $str_res; - } + if(!$fmt) { + $str_res .= dump(intl_get_error_message())."\n"; + return $str_res; + } foreach ($args as $arg) { $str_res .= dump( ut_msgfmt_format($fmt, $arg) ). "\n"; $str_res .= dump( ut_msgfmt_format_message('en_US', $pattern, $arg) ) . "\n"; diff --git a/ext/intl/tests/msgfmt_millisecond_dates.phpt b/ext/intl/tests/msgfmt_millisecond_dates.phpt index 8fc2f04e84..2a5723f2e0 100644 --- a/ext/intl/tests/msgfmt_millisecond_dates.phpt +++ b/ext/intl/tests/msgfmt_millisecond_dates.phpt @@ -11,7 +11,7 @@ date_default_timezone_set('Europe/Lisbon'); //ignored for now, see bug #58756 $d = 1336308097.123; $mf = new MessageFormatter('en_US', - "On {0,time,yyyy-MM-dd G 'at' HH:mm:ss.SSS zzz} something odd happened"); + "On {0,time,yyyy-MM-dd G 'at' HH:mm:ss.SSS zzz} something odd happened"); var_dump($mf->format(array(1336310569.123))); diff --git a/ext/intl/tests/msgfmt_parse.phpt b/ext/intl/tests/msgfmt_parse.phpt index 95645a63a0..962aa083fd 100644 --- a/ext/intl/tests/msgfmt_parse.phpt +++ b/ext/intl/tests/msgfmt_parse.phpt @@ -17,32 +17,32 @@ function ut_main() 'ru_UA' => "{0,number,integer} мавп на {1,number,integer} деревах це {2,number} мавпи на кожному деревi", 'de' => "{0,number,integer} Affen über {1,number,integer} Bäume um {2,number} Affen pro Baum", 'en_UK' => "{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree", - 'root' => '{0,whatever} would not work!', - 'fr' => 'C\'est {0,number,integer}', + 'root' => '{0,whatever} would not work!', + 'fr' => 'C\'est {0,number,integer}', ); - $results = array( - 'en_US' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree", - 'ru_UA' => "4 560 мавп на 123 деревах це 37,073 мавпи на кожному деревi", - 'de' => "4.560 Affen über 123 Bäume um 37,073 Affen pro Baum", - 'en_UK' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree", - 'root' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree", - 'fr' => "C'est 42", + $results = array( + 'en_US' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree", + 'ru_UA' => "4 560 мавп на 123 деревах це 37,073 мавпи на кожному деревi", + 'de' => "4.560 Affen über 123 Bäume um 37,073 Affen pro Baum", + 'en_UK' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree", + 'root' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree", + 'fr' => "C'est 42", - ); + ); - $str_res = ''; + $str_res = ''; foreach( $locales as $locale => $pattern ) { $str_res .= "\nLocale is: $locale\n"; $fmt = ut_msgfmt_create( $locale, $pattern ); - if(!$fmt) { - $str_res .= dump(intl_get_error_message())."\n"; - continue; - } + if(!$fmt) { + $str_res .= dump(intl_get_error_message())."\n"; + continue; + } $str_res .= dump( ut_msgfmt_parse( $fmt, $results[$locale] ) ) . "\n"; - $str_res .= dump( ut_msgfmt_parse_message($locale, $pattern, $results[$locale])) . "\n"; + $str_res .= dump( ut_msgfmt_parse_message($locale, $pattern, $results[$locale])) . "\n"; } return $str_res; } diff --git a/ext/intl/tests/msgfmt_setPattern_cache.phpt b/ext/intl/tests/msgfmt_setPattern_cache.phpt index 7afbcbd93b..86fda51d41 100644 --- a/ext/intl/tests/msgfmt_setPattern_cache.phpt +++ b/ext/intl/tests/msgfmt_setPattern_cache.phpt @@ -10,7 +10,7 @@ ini_set("intl.error_level", E_WARNING); //ini_set("intl.default_locale", "nl"); $mf = new MessageFormatter('en_US', - "{0,number} -- {1,ordinal}"); + "{0,number} -- {1,ordinal}"); var_dump($mf->format(array(1.3, 1.3))); var_dump($mf->format(array(1.3, 1.3))); diff --git a/ext/intl/tests/normalizer_get_raw_decomposition.phpt b/ext/intl/tests/normalizer_get_raw_decomposition.phpt index 63caa7d472..590707280f 100644 --- a/ext/intl/tests/normalizer_get_raw_decomposition.phpt +++ b/ext/intl/tests/normalizer_get_raw_decomposition.phpt @@ -13,15 +13,15 @@ normalizer_get_raw_decomposition() function ut_main() { - $result = ''; - $strings = [ - "a", + $result = ''; + $strings = [ + "a", "\u{FFDA}", "\u{FDFA}", "", "aa", "\xF5", - ]; + ]; foreach ($strings as $string) { $decomposition = ut_norm_get_raw_decomposition($string, Normalizer::FORM_KC); @@ -39,7 +39,7 @@ function ut_main() $result .= "error info: '$error_message' ($error_code)\n"; } - return $result; + return $result; } include_once( 'ut_common.inc' ); diff --git a/ext/intl/tests/normalizer_normalize.phpt b/ext/intl/tests/normalizer_normalize.phpt index 8f15ffb1d8..1a5050526e 100644 --- a/ext/intl/tests/normalizer_normalize.phpt +++ b/ext/intl/tests/normalizer_normalize.phpt @@ -12,81 +12,81 @@ normalize() function ut_main() { - $res_str = ''; - - $forms = array( - Normalizer::FORM_C, - Normalizer::FORM_D, - Normalizer::FORM_KC, - Normalizer::FORM_KD, - ); - - $forms_str = array ( - Normalizer::FORM_C => 'UNORM_FORM_C', - Normalizer::FORM_D => 'UNORM_FORM_D', - Normalizer::FORM_KC => 'UNORM_FORM_KC', - Normalizer::FORM_KD => 'UNORM_FORM_KD', - ); - - /* just make sure all the form constants are defined as in the api spec */ - if ( Normalizer::FORM_C != Normalizer::NFC || - Normalizer::FORM_D != Normalizer::NFD || - Normalizer::FORM_KC != Normalizer::NFKC || - Normalizer::FORM_KD != Normalizer::NFKD) { - - $res_str .= "Invalid normalization form declarations!\n"; - } - - $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) - $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) - $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) - - $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) - $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) - - $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) - $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) - - $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) - - $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) - - $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) - - $strs = array( - 'ABC', - $char_a_diaeresis . '||' . $char_a_ring . '||' . $char_o_diaeresis, - $char_angstrom_sign . '||' . $char_A_ring . '||' . 'A' . $char_combining_ring_above, - $char_ohm_sign . '||' . $char_omega, - $char_fi_ligature, - $char_long_s_dot, - ); - - foreach( $forms as $form ) - { - foreach( $strs as $str ) - { - $str_norm = ut_norm_normalize( $str, $form ); - $error_code = intl_get_error_code(); - $error_message = intl_get_error_message(); - - $str_hex = urlencode($str); - $str_norm_hex = urlencode($str_norm); - $res_str .= "'$str_hex' normalized to form '{$forms_str[$form]}' is '$str_norm_hex'" - . "\terror info: '$error_message' ($error_code)\n" - . ""; - - $is_norm = ut_norm_is_normalized( $str, $form ); - $error_code = intl_get_error_code(); - $error_message = intl_get_error_message(); - - $res_str .= " is in form '{$forms_str[$form]}'? = " . ($is_norm ? "yes" : "no") - . "\terror info: '$error_message' ($error_code)\n" - . ""; - } - } - - return $res_str; + $res_str = ''; + + $forms = array( + Normalizer::FORM_C, + Normalizer::FORM_D, + Normalizer::FORM_KC, + Normalizer::FORM_KD, + ); + + $forms_str = array ( + Normalizer::FORM_C => 'UNORM_FORM_C', + Normalizer::FORM_D => 'UNORM_FORM_D', + Normalizer::FORM_KC => 'UNORM_FORM_KC', + Normalizer::FORM_KD => 'UNORM_FORM_KD', + ); + + /* just make sure all the form constants are defined as in the api spec */ + if ( Normalizer::FORM_C != Normalizer::NFC || + Normalizer::FORM_D != Normalizer::NFD || + Normalizer::FORM_KC != Normalizer::NFKC || + Normalizer::FORM_KD != Normalizer::NFKD) { + + $res_str .= "Invalid normalization form declarations!\n"; + } + + $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) + $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) + $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) + + $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) + $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) + + $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) + $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) + + $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) + + $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) + + $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) + + $strs = array( + 'ABC', + $char_a_diaeresis . '||' . $char_a_ring . '||' . $char_o_diaeresis, + $char_angstrom_sign . '||' . $char_A_ring . '||' . 'A' . $char_combining_ring_above, + $char_ohm_sign . '||' . $char_omega, + $char_fi_ligature, + $char_long_s_dot, + ); + + foreach( $forms as $form ) + { + foreach( $strs as $str ) + { + $str_norm = ut_norm_normalize( $str, $form ); + $error_code = intl_get_error_code(); + $error_message = intl_get_error_message(); + + $str_hex = urlencode($str); + $str_norm_hex = urlencode($str_norm); + $res_str .= "'$str_hex' normalized to form '{$forms_str[$form]}' is '$str_norm_hex'" + . "\terror info: '$error_message' ($error_code)\n" + . ""; + + $is_norm = ut_norm_is_normalized( $str, $form ); + $error_code = intl_get_error_code(); + $error_message = intl_get_error_message(); + + $res_str .= " is in form '{$forms_str[$form]}'? = " . ($is_norm ? "yes" : "no") + . "\terror info: '$error_message' ($error_code)\n" + . ""; + } + } + + return $res_str; } include_once( 'ut_common.inc' ); diff --git a/ext/intl/tests/normalizer_normalize_kc_cf.phpt b/ext/intl/tests/normalizer_normalize_kc_cf.phpt index c7a46e617d..77e8a95eaa 100644 --- a/ext/intl/tests/normalizer_normalize_kc_cf.phpt +++ b/ext/intl/tests/normalizer_normalize_kc_cf.phpt @@ -13,72 +13,72 @@ normalize() NFKC_Casefold function ut_main() { - $res_str = ''; - - $forms = array( - Normalizer::FORM_KC_CF, - ); - - $forms_str = array ( - Normalizer::FORM_KC_CF => 'UNORM_FORM_KC_CF', - ); - - /* just make sure all the form constants are defined as in the api spec */ - if (Normalizer::FORM_C != Normalizer::NFC) { - $res_str .= "Invalid normalization form declarations!\n"; - } - - $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) - $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) - $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) - - $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) - $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) - - $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) - $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) - - $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) - - $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) - - $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) - - $strs = array( - 'ABC', - 'abc', - $char_a_diaeresis . '||' . $char_a_ring . '||' . $char_o_diaeresis, - $char_angstrom_sign . '||' . $char_A_ring . '||' . 'A' . $char_combining_ring_above, - $char_ohm_sign . '||' . $char_omega, - $char_fi_ligature, - $char_long_s_dot, - ); - - foreach( $forms as $form ) - { - foreach( $strs as $str ) - { - $str_norm = ut_norm_normalize( $str, $form ); - $error_code = intl_get_error_code(); - $error_message = intl_get_error_message(); - - $str_hex = urlencode($str); - $str_norm_hex = urlencode($str_norm); - $res_str .= "'$str_hex' normalized to form '{$forms_str[$form]}' is '$str_norm_hex'" - . "\terror info: '$error_message' ($error_code)\n" - . ""; - - $is_norm = ut_norm_is_normalized( $str, $form ); - $error_code = intl_get_error_code(); - $error_message = intl_get_error_message(); - - $res_str .= " is in form '{$forms_str[$form]}'? = " . ($is_norm ? "yes" : "no") - . "\terror info: '$error_message' ($error_code)\n" - . ""; - } - } - - return $res_str; + $res_str = ''; + + $forms = array( + Normalizer::FORM_KC_CF, + ); + + $forms_str = array ( + Normalizer::FORM_KC_CF => 'UNORM_FORM_KC_CF', + ); + + /* just make sure all the form constants are defined as in the api spec */ + if (Normalizer::FORM_C != Normalizer::NFC) { + $res_str .= "Invalid normalization form declarations!\n"; + } + + $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) + $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) + $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) + + $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) + $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) + + $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) + $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) + + $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) + + $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) + + $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) + + $strs = array( + 'ABC', + 'abc', + $char_a_diaeresis . '||' . $char_a_ring . '||' . $char_o_diaeresis, + $char_angstrom_sign . '||' . $char_A_ring . '||' . 'A' . $char_combining_ring_above, + $char_ohm_sign . '||' . $char_omega, + $char_fi_ligature, + $char_long_s_dot, + ); + + foreach( $forms as $form ) + { + foreach( $strs as $str ) + { + $str_norm = ut_norm_normalize( $str, $form ); + $error_code = intl_get_error_code(); + $error_message = intl_get_error_message(); + + $str_hex = urlencode($str); + $str_norm_hex = urlencode($str_norm); + $res_str .= "'$str_hex' normalized to form '{$forms_str[$form]}' is '$str_norm_hex'" + . "\terror info: '$error_message' ($error_code)\n" + . ""; + + $is_norm = ut_norm_is_normalized( $str, $form ); + $error_code = intl_get_error_code(); + $error_message = intl_get_error_message(); + + $res_str .= " is in form '{$forms_str[$form]}'? = " . ($is_norm ? "yes" : "no") + . "\terror info: '$error_message' ($error_code)\n" + . ""; + } + } + + return $res_str; } include_once( 'ut_common.inc' ); diff --git a/ext/intl/tests/rbbiter___construct_basic.phpt b/ext/intl/tests/rbbiter___construct_basic.phpt index 2281bb26e0..9f20806fa5 100644 --- a/ext/intl/tests/rbbiter___construct_basic.phpt +++ b/ext/intl/tests/rbbiter___construct_basic.phpt @@ -26,9 +26,9 @@ $rbbi = new IntlRuleBasedBreakIterator($rules); var_dump(get_class($rbbi)); try { - $obj = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+', 'aoeu'); + $obj = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+', 'aoeu'); } catch (IntlException $e) { - var_dump(intl_get_error_code(), intl_get_error_message()); + var_dump(intl_get_error_code(), intl_get_error_message()); } ?> diff --git a/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt index 8d689d5003..4592a62eb9 100644 --- a/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt +++ b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt @@ -28,7 +28,7 @@ $rbbi = new IntlRuleBasedBreakIterator($rules); $rbbi->setText('sdfkjsdf88á.... ,;'); do { - var_dump($rbbi->current(), $rbbi->getRuleStatusVec()); + var_dump($rbbi->current(), $rbbi->getRuleStatusVec()); } while ($rbbi->next() != IntlBreakIterator::DONE); ?> diff --git a/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt index 2cc71f4555..44da765292 100644 --- a/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt +++ b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt @@ -26,8 +26,8 @@ $rbbi = new IntlRuleBasedBreakIterator($rules); $rbbi->setText('sdfkjsdf88á.... ,;'); do { - echo "pos : {$rbbi->current()}\n", - "rule status: {$rbbi->getRuleStatus()}\n"; + echo "pos : {$rbbi->current()}\n", + "rule status: {$rbbi->getRuleStatus()}\n"; } while ($rbbi->next() != IntlBreakIterator::DONE); ?> diff --git a/ext/intl/tests/resourcebundle.inc b/ext/intl/tests/resourcebundle.inc index a7727a3ec8..9eea8aaffb 100644 --- a/ext/intl/tests/resourcebundle.inc +++ b/ext/intl/tests/resourcebundle.inc @@ -2,11 +2,11 @@ define('BUNDLE', dirname(__FILE__)."/_files/resourcebundle"); function debug( $res ) { - if (is_null( $res )) { - $ret = "NULL\n"; - } - else { - $ret = print_r( $res, true ). "\n"; - } - return $ret . sprintf( "%5d: %s\n", intl_get_error_code(), intl_get_error_message() ); + if (is_null( $res )) { + $ret = "NULL\n"; + } + else { + $ret = print_r( $res, true ). "\n"; + } + return $ret . sprintf( "%5d: %s\n", intl_get_error_code(), intl_get_error_message() ); } diff --git a/ext/intl/tests/resourcebundle_arrayaccess.phpt b/ext/intl/tests/resourcebundle_arrayaccess.phpt index d035a8d304..8eaaff3af3 100644 --- a/ext/intl/tests/resourcebundle_arrayaccess.phpt +++ b/ext/intl/tests/resourcebundle_arrayaccess.phpt @@ -4,27 +4,27 @@ Test ResourceBundle array access and count - existing/missing keys <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> --FILE-- <?php - include "resourcebundle.inc"; + include "resourcebundle.inc"; - // fall back - $r = new ResourceBundle( 'en_US', BUNDLE ); + // fall back + $r = new ResourceBundle( 'en_US', BUNDLE ); - printf( "length: %d\n", count($r) ); - printf( "teststring: %s\n", $r['teststring'] ); - printf( "testint: %d\n", $r['testint'] ); + printf( "length: %d\n", count($r) ); + printf( "teststring: %s\n", $r['teststring'] ); + printf( "testint: %d\n", $r['testint'] ); - print_r( $r['testvector'] ); + print_r( $r['testvector'] ); - printf( "testbin: %s\n", bin2hex($r['testbin']) ); + printf( "testbin: %s\n", bin2hex($r['testbin']) ); - $r2 = $r['testtable']; - printf( "testtable: %d\n", $r2['major'] ); + $r2 = $r['testtable']; + printf( "testtable: %d\n", $r2['major'] ); - $r2 = $r['testarray']; - printf( "testarray: %s\n", $r2[2] ); + $r2 = $r['testarray']; + printf( "testarray: %s\n", $r2[2] ); - $t = $r['nonexisting']; - echo debug( $t ); + $t = $r['nonexisting']; + echo debug( $t ); ?> --EXPECT-- length: 6 diff --git a/ext/intl/tests/resourcebundle_countable.phpt b/ext/intl/tests/resourcebundle_countable.phpt index bacc18f10c..fb703160c9 100644 --- a/ext/intl/tests/resourcebundle_countable.phpt +++ b/ext/intl/tests/resourcebundle_countable.phpt @@ -4,11 +4,11 @@ Test ResourceBundle implements Countable <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> --FILE-- <?php - include "resourcebundle.inc"; + include "resourcebundle.inc"; - $r = new ResourceBundle( 'es', BUNDLE ); + $r = new ResourceBundle( 'es', BUNDLE ); - var_dump($r instanceof Countable); + var_dump($r instanceof Countable); ?> --EXPECT-- bool(true) diff --git a/ext/intl/tests/resourcebundle_create.phpt b/ext/intl/tests/resourcebundle_create.phpt index 09bad4fddf..d7ba99d523 100644 --- a/ext/intl/tests/resourcebundle_create.phpt +++ b/ext/intl/tests/resourcebundle_create.phpt @@ -8,35 +8,35 @@ Test ResourceBundle::__construct() - existing/missing bundles/locales include "resourcebundle.inc"; function ut_main() { - $str_res = ''; - // all fine - $r1 = ut_resourcebundle_create( 'root', BUNDLE ); - $str_res .= debug( $r1 ); - $str_res .= print_r( $r1['teststring'], true)."\n"; - - // non-root one - $r1 = ut_resourcebundle_create( 'es', BUNDLE ); - $str_res .= debug( $r1 ); - $str_res .= print_r( $r1['teststring'], true)."\n"; - - // fall back - $r1 = ut_resourcebundle_create( 'en_US', BUNDLE ); + $str_res = ''; + // all fine + $r1 = ut_resourcebundle_create( 'root', BUNDLE ); + $str_res .= debug( $r1 ); + $str_res .= print_r( $r1['teststring'], true)."\n"; + + // non-root one + $r1 = ut_resourcebundle_create( 'es', BUNDLE ); + $str_res .= debug( $r1 ); + $str_res .= print_r( $r1['teststring'], true)."\n"; + + // fall back + $r1 = ut_resourcebundle_create( 'en_US', BUNDLE ); $str_res .= debug( $r1 ); - $str_res .= print_r( $r1['testsring'], true); + $str_res .= print_r( $r1['testsring'], true); - // fall out - $r2 = ut_resourcebundle_create( 'en_US', BUNDLE, false ); + // fall out + $r2 = ut_resourcebundle_create( 'en_US', BUNDLE, false ); $str_res .= debug( $r2 ); - // missing - $r3 = ut_resourcebundle_create( 'en_US', 'nonexisting' ); + // missing + $r3 = ut_resourcebundle_create( 'en_US', 'nonexisting' ); $str_res .= debug( $r3 ); - return $str_res; + return $str_res; } - include_once( 'ut_common.inc' ); - ut_run(); + include_once( 'ut_common.inc' ); + ut_run(); ?> --EXPECT-- ResourceBundle Object diff --git a/ext/intl/tests/resourcebundle_individual.phpt b/ext/intl/tests/resourcebundle_individual.phpt index 0fb512f8e5..46ce239e4d 100644 --- a/ext/intl/tests/resourcebundle_individual.phpt +++ b/ext/intl/tests/resourcebundle_individual.phpt @@ -4,34 +4,34 @@ Test ResourceBundle::get() and length() - existing/missing keys <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> --FILE-- <?php - include "resourcebundle.inc"; + include "resourcebundle.inc"; function ut_main() { - $str_res = ''; - // fall back - $r = ut_resourcebundle_create( 'en_US', BUNDLE ); + $str_res = ''; + // fall back + $r = ut_resourcebundle_create( 'en_US', BUNDLE ); - $str_res .= sprintf( "length: %d\n", ut_resourcebundle_count($r) ); - $str_res .= sprintf( "teststring: %s\n", ut_resourcebundle_get($r, 'teststring' ) ); - $str_res .= sprintf( "testint: %d\n", ut_resourcebundle_get($r, 'testint' ) ); + $str_res .= sprintf( "length: %d\n", ut_resourcebundle_count($r) ); + $str_res .= sprintf( "teststring: %s\n", ut_resourcebundle_get($r, 'teststring' ) ); + $str_res .= sprintf( "testint: %d\n", ut_resourcebundle_get($r, 'testint' ) ); - $str_res .= print_r( ut_resourcebundle_get($r, 'testvector' ), true ); + $str_res .= print_r( ut_resourcebundle_get($r, 'testvector' ), true ); - $str_res .= sprintf( "testbin: %s\n", bin2hex(ut_resourcebundle_get( $r,'testbin' )) ); + $str_res .= sprintf( "testbin: %s\n", bin2hex(ut_resourcebundle_get( $r,'testbin' )) ); - $r2 = ut_resourcebundle_get($r, 'testtable' ); - $str_res .= sprintf( "testtable: %d\n", ut_resourcebundle_get($r2, 'major' ) ); + $r2 = ut_resourcebundle_get($r, 'testtable' ); + $str_res .= sprintf( "testtable: %d\n", ut_resourcebundle_get($r2, 'major' ) ); - $r2 = ut_resourcebundle_get($r,'testarray' ); - $str_res .= sprintf( "testarray: %s\n", ut_resourcebundle_get($r2, 2 ) ); + $r2 = ut_resourcebundle_get($r,'testarray' ); + $str_res .= sprintf( "testarray: %s\n", ut_resourcebundle_get($r2, 2 ) ); - $t = ut_resourcebundle_get( $r, 'nonexisting' ); - $str_res .= debug( $t ); + $t = ut_resourcebundle_get( $r, 'nonexisting' ); + $str_res .= debug( $t ); - return $str_res; + return $str_res; } - include_once( 'ut_common.inc' ); - ut_run(); + include_once( 'ut_common.inc' ); + ut_run(); ?> --EXPECT-- length: 6 diff --git a/ext/intl/tests/resourcebundle_iterator.phpt b/ext/intl/tests/resourcebundle_iterator.phpt index e0b83d8190..93833fdf35 100644 --- a/ext/intl/tests/resourcebundle_iterator.phpt +++ b/ext/intl/tests/resourcebundle_iterator.phpt @@ -4,33 +4,33 @@ Test ResourceBundle iterator <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> --FILE-- <?php - include "resourcebundle.inc"; + include "resourcebundle.inc"; - // fall back - $r = new ResourceBundle( 'en_US', BUNDLE ); + // fall back + $r = new ResourceBundle( 'en_US', BUNDLE ); - foreach ($r as $onekey => $oneval) { - echo "Here comes $onekey:\n"; - switch (gettype($oneval)) { - case 'string': - echo bin2hex( $oneval ) . "\n"; - break; + foreach ($r as $onekey => $oneval) { + echo "Here comes $onekey:\n"; + switch (gettype($oneval)) { + case 'string': + echo bin2hex( $oneval ) . "\n"; + break; - case 'integer': - echo "$oneval\n"; - break; + case 'integer': + echo "$oneval\n"; + break; - default: - print_r( $oneval ); - } - echo "\n"; - } + default: + print_r( $oneval ); + } + echo "\n"; + } - echo "Testarray Contents:\n"; - $r = $r->get( 'testarray' ); - foreach ($r as $onekey => $oneval) { - echo "$onekey => $oneval\n"; - } + echo "Testarray Contents:\n"; + $r = $r->get( 'testarray' ); + foreach ($r as $onekey => $oneval) { + echo "$onekey => $oneval\n"; + } ?> --EXPECT-- Here comes testarray: diff --git a/ext/intl/tests/resourcebundle_locales.phpt b/ext/intl/tests/resourcebundle_locales.phpt index c744e63193..16b863d4e8 100644 --- a/ext/intl/tests/resourcebundle_locales.phpt +++ b/ext/intl/tests/resourcebundle_locales.phpt @@ -8,15 +8,15 @@ Test ResourceBundle::getLocales include "resourcebundle.inc"; function ut_main() { - $str_res = ''; + $str_res = ''; - $str_res .= join("\n", ut_resourcebundle_locales(BUNDLE)); + $str_res .= join("\n", ut_resourcebundle_locales(BUNDLE)); - return $str_res; + return $str_res; } - include_once( 'ut_common.inc' ); - ut_run(); + include_once( 'ut_common.inc' ); + ut_run(); ?> --EXPECT-- es diff --git a/ext/intl/tests/resourcebundle_traversable.phpt b/ext/intl/tests/resourcebundle_traversable.phpt index 4aeec2330d..93d4c2a41e 100644 --- a/ext/intl/tests/resourcebundle_traversable.phpt +++ b/ext/intl/tests/resourcebundle_traversable.phpt @@ -4,12 +4,12 @@ Bug #55610: ResourceBundle does not implement Traversable <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> --FILE-- <?php - include "resourcebundle.inc"; + include "resourcebundle.inc"; - $r = new ResourceBundle( 'es', BUNDLE ); + $r = new ResourceBundle( 'es', BUNDLE ); - var_dump($r instanceof Traversable); - var_dump(iterator_to_array($r->get('testarray'))); + var_dump($r instanceof Traversable); + var_dump(iterator_to_array($r->get('testarray'))); ?> --EXPECT-- bool(true) diff --git a/ext/intl/tests/timezone_clone_error.phpt b/ext/intl/tests/timezone_clone_error.phpt index 4052776775..8df6a8ffe3 100644 --- a/ext/intl/tests/timezone_clone_error.phpt +++ b/ext/intl/tests/timezone_clone_error.phpt @@ -17,7 +17,7 @@ var_dump($tz); try { var_dump(clone $tz); } catch (Exception $e) { - var_dump(get_class($e), $e->getMessage()); + var_dump(get_class($e), $e->getMessage()); } ?> diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt index 348478e396..985957d3ca 100644 --- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt +++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt @@ -8,15 +8,15 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_ANY, - 'PT', - -3600000); + IntlTimeZone::TYPE_ANY, + 'PT', + -3600000); print_r(iterator_to_array($enum)); $enum = intltz_create_time_zone_id_enumeration( - IntlTimeZone::TYPE_ANY, - 'PT', - -3600000); + IntlTimeZone::TYPE_ANY, + 'PT', + -3600000); print_r(iterator_to_array($enum)); ?> --EXPECT-- diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt index 37edd7e9c7..84711ff57f 100644 --- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt +++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt @@ -8,16 +8,16 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_ANY, - 'PT'); + IntlTimeZone::TYPE_ANY, + 'PT'); $values = iterator_to_array($enum); var_dump(in_array('Europe/Lisbon', $values)); var_dump(in_array('Atlantic/Azores', $values)); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_ANY, - 'PT', - null); + IntlTimeZone::TYPE_ANY, + 'PT', + null); $values2 = iterator_to_array($enum); var_dump($values2 == $values); diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt index e7ae961a4a..4d37fe3e64 100644 --- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt +++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt @@ -8,25 +8,25 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_ANY); + IntlTimeZone::TYPE_ANY); $countAny = count(iterator_to_array($enum)); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_CANONICAL); + IntlTimeZone::TYPE_CANONICAL); $countCanonical = count(iterator_to_array($enum)); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_CANONICAL_LOCATION); + IntlTimeZone::TYPE_CANONICAL_LOCATION); $countCanonicalLocation = count(iterator_to_array($enum)); var_dump($countAny > $countCanonical); var_dump($countCanonical > $countCanonicalLocation); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_ANY, null, null); + IntlTimeZone::TYPE_ANY, null, null); $countAny2 = count(iterator_to_array($enum)); var_dump($countAny == $countAny2); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_ANY, null, -3600000); + IntlTimeZone::TYPE_ANY, null, -3600000); $values = iterator_to_array($enum); print_r( diff --git a/ext/intl/tests/timezone_equals_error.phpt b/ext/intl/tests/timezone_equals_error.phpt index d5eeedb2d9..3d489d14a6 100644 --- a/ext/intl/tests/timezone_equals_error.phpt +++ b/ext/intl/tests/timezone_equals_error.phpt @@ -18,7 +18,7 @@ var_dump($tz, $tz2); try { var_dump($tz == $tz2); } catch (Exception $e) { - var_dump(get_class($e), $e->getMessage()); + var_dump(get_class($e), $e->getMessage()); } ?> diff --git a/ext/intl/tests/timezone_getOffset_basic.phpt b/ext/intl/tests/timezone_getOffset_basic.phpt index 7efb1967ca..3dbf5b1ce4 100644 --- a/ext/intl/tests/timezone_getOffset_basic.phpt +++ b/ext/intl/tests/timezone_getOffset_basic.phpt @@ -14,12 +14,12 @@ $ams = IntlTimeZone::createTimeZone('Europe/Amsterdam'); $date = strtotime("1 July 2012 +0000"); var_dump($ams->getOffset($date *1000., true, $rawOffset, $dstOffset), - $rawOffset, $dstOffset); + $rawOffset, $dstOffset); $lsb = IntlTimeZone::createTimeZone('Europe/Lisbon'); var_dump(intltz_get_offset($lsb, $date *1000., true, $rawOffset, $dstOffset), - $rawOffset, $dstOffset); + $rawOffset, $dstOffset); ?> --EXPECT-- diff --git a/ext/intl/tests/timezone_hasSameRules_error.phpt b/ext/intl/tests/timezone_hasSameRules_error.phpt index 07aa15039c..e1cfb754ba 100644 --- a/ext/intl/tests/timezone_hasSameRules_error.phpt +++ b/ext/intl/tests/timezone_hasSameRules_error.phpt @@ -10,24 +10,24 @@ ini_set("intl.error_level", E_WARNING); function error_handler($errno, $errstr, $errfile, $errline) { - var_dump($errno, $errstr); - return true; + var_dump($errno, $errstr); + return true; } set_error_handler("error_handler"); $tz = IntlTimeZone::createTimeZone('Europe/Lisbon'); try { - var_dump($tz->hasSameRules('foo')); + var_dump($tz->hasSameRules('foo')); } catch (Error $ex) { - var_dump($ex->getCode(), $ex->getMessage()); - echo "\n"; + var_dump($ex->getCode(), $ex->getMessage()); + echo "\n"; } try { - var_dump(intltz_has_same_rules(null, $tz)); + var_dump(intltz_has_same_rules(null, $tz)); } catch (Error $ex) { - var_dump($ex->getCode(), $ex->getMessage()); - echo "\n"; + var_dump($ex->getCode(), $ex->getMessage()); + echo "\n"; } --EXPECT-- int(0) diff --git a/ext/intl/tests/timezone_toDateTimeZone_basic.phpt b/ext/intl/tests/timezone_toDateTimeZone_basic.phpt index 831bc3df1a..3679fe9717 100644 --- a/ext/intl/tests/timezone_toDateTimeZone_basic.phpt +++ b/ext/intl/tests/timezone_toDateTimeZone_basic.phpt @@ -11,12 +11,12 @@ ini_set("intl.default_locale", "nl"); date_default_timezone_set('Europe/Lisbon'); function do_test(IntlTimeZone $tz, $proc = false) { - var_dump($tz->getID(), $tz->getRawOffset()); - if (!$proc) - $dtz = $tz->toDateTimeZone(); - else - $dtz = intltz_to_date_time_zone($tz); - var_dump($dtz->getName(), $dtz->getOffset(new DateTime('2012-01-01 00:00:00'))); + var_dump($tz->getID(), $tz->getRawOffset()); + if (!$proc) + $dtz = $tz->toDateTimeZone(); + else + $dtz = intltz_to_date_time_zone($tz); + var_dump($dtz->getName(), $dtz->getOffset(new DateTime('2012-01-01 00:00:00'))); } do_test(IntlTimeZone::createTimeZone('CET')); diff --git a/ext/intl/tests/timezone_toDateTimeZone_error.phpt b/ext/intl/tests/timezone_toDateTimeZone_error.phpt index 9df2bbf70d..119977b124 100644 --- a/ext/intl/tests/timezone_toDateTimeZone_error.phpt +++ b/ext/intl/tests/timezone_toDateTimeZone_error.phpt @@ -11,9 +11,9 @@ ini_set("intl.error_level", E_WARNING); $tz = IntlTimeZone::createTimeZone('Etc/Unknown'); try { - var_dump($tz->toDateTimeZone()); + var_dump($tz->toDateTimeZone()); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } var_dump(intltz_to_date_time_zone(1)); diff --git a/ext/intl/tests/ut_common.inc b/ext/intl/tests/ut_common.inc index 6398b2876f..4a2675b01f 100644 --- a/ext/intl/tests/ut_common.inc +++ b/ext/intl/tests/ut_common.inc @@ -234,7 +234,7 @@ function ut_loc_get_default( ) } function ut_loc_set_default( $locale ) { - return $GLOBALS['oo-mode'] ? Locale::setDefault( $locale ) : locale_set_default( $locale ); + return $GLOBALS['oo-mode'] ? Locale::setDefault( $locale ) : locale_set_default( $locale ); } function ut_loc_get_primary_language( $locale ) { @@ -297,7 +297,7 @@ function ut_loc_locale_lookup( $lang_tag_arr,$loc_range,$isCanonical,$default_lo return $GLOBALS['oo-mode'] ? Locale::lookup( $lang_tag_arr,$loc_range,$isCanonical,$default_loc ) : locale_lookup( $lang_tag_arr,$loc_range,$isCanonical,$default_loc ); } function ut_loc_accept_http($http) { - return $GLOBALS['oo-mode'] ? Locale::acceptFromHttp($http):locale_accept_from_http($http); + return $GLOBALS['oo-mode'] ? Locale::acceptFromHttp($http):locale_accept_from_http($http); } /* MessageFormatter functions */ function ut_msgfmt_create( $locale, $pattern) diff --git a/ext/json/tests/bug40503.phpt b/ext/json/tests/bug40503.phpt index 10896a428e..17c8fbd92a 100644 --- a/ext/json/tests/bug40503.phpt +++ b/ext/json/tests/bug40503.phpt @@ -7,7 +7,7 @@ serialize_precision=-1 --FILE-- <?php function json_test_show_eq($x, $y) { - echo "$x ". ( $x == $y ? "==" : "!=") ." $y\n"; + echo "$x ". ( $x == $y ? "==" : "!=") ." $y\n"; } $value = 0x7FFFFFFF; #2147483647; diff --git a/ext/json/tests/bug42090.phpt b/ext/json/tests/bug42090.phpt index 9e5b3317e5..b0c9efc102 100644 --- a/ext/json/tests/bug42090.phpt +++ b/ext/json/tests/bug42090.phpt @@ -5,13 +5,13 @@ Bug #42090 (json_decode causes segmentation fault) --FILE-- <?php var_dump( - json_decode('""'), - json_decode('"..".'), - json_decode('"'), - json_decode('""""'), - json_encode('"'), - json_decode(json_encode('"')), - json_decode(json_encode('""')) + json_decode('""'), + json_decode('"..".'), + json_decode('"'), + json_decode('""""'), + json_encode('"'), + json_decode(json_encode('"')), + json_decode(json_encode('""')) ); ?> --EXPECT-- diff --git a/ext/json/tests/bug46215.phpt b/ext/json/tests/bug46215.phpt index be3a80f860..eaf980d49a 100644 --- a/ext/json/tests/bug46215.phpt +++ b/ext/json/tests/bug46215.phpt @@ -6,7 +6,7 @@ Bug #46215 (json_encode mutates its parameter and has some class-specific state) <?php class foo { - protected $a = array(); + protected $a = array(); } $a = new foo; diff --git a/ext/json/tests/bug46944.phpt b/ext/json/tests/bug46944.phpt index 3d70f3ee11..b5b0d97c34 100644 --- a/ext/json/tests/bug46944.phpt +++ b/ext/json/tests/bug46944.phpt @@ -6,10 +6,10 @@ Bug #46944 (json_encode() doesn't handle 3 byte utf8 correctly) <?php for ($i = 1; $i <= 16; $i++) { - $first = 0xf0 | ($i >> 2); - $second = 0x8f | ($i & 3) << 4; - $string = sprintf("aa%c%c\xbf\xbdzz", $first, $second); - echo json_encode($string) . "\n"; + $first = 0xf0 | ($i >> 2); + $second = 0x8f | ($i & 3) << 4; + $string = sprintf("aa%c%c\xbf\xbdzz", $first, $second); + echo json_encode($string) . "\n"; } diff --git a/ext/json/tests/bug47644.phpt b/ext/json/tests/bug47644.phpt index c8650958e8..b5f4880cf9 100644 --- a/ext/json/tests/bug47644.phpt +++ b/ext/json/tests/bug47644.phpt @@ -9,7 +9,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); <?php for ($i = 10000000000000000; $i < 10000000000000006; $i++) { - var_dump(json_decode("[$i]")); + var_dump(json_decode("[$i]")); } diff --git a/ext/json/tests/bug54058.phpt b/ext/json/tests/bug54058.phpt index ccb6389110..3f413b65f6 100644 --- a/ext/json/tests/bug54058.phpt +++ b/ext/json/tests/bug54058.phpt @@ -22,8 +22,8 @@ json_encode($b); var_dump(json_last_error(), json_last_error_msg()); $c = array( - 'foo' => $bad_utf8, - 'bar' => 1 + 'foo' => $bad_utf8, + 'bar' => 1 ); json_encode($c); var_dump(json_last_error(), json_last_error_msg()); diff --git a/ext/json/tests/bug61978.phpt b/ext/json/tests/bug61978.phpt index 68df624de1..a26341e4cc 100644 --- a/ext/json/tests/bug61978.phpt +++ b/ext/json/tests/bug61978.phpt @@ -6,25 +6,25 @@ Bug #61978 (Object recursion not detected for classes that implement JsonSeriali <?php class JsonTest1 { - public $test; - public $me; - public function __construct() { - $this->test = '123'; - $this->me = $this; - } + public $test; + public $me; + public function __construct() { + $this->test = '123'; + $this->me = $this; + } } class JsonTest2 implements JsonSerializable { - public $test; - public function __construct() { - $this->test = '123'; - } - public function jsonSerialize() { - return array( - 'test' => $this->test, - 'me' => $this - ); - } + public $test; + public function __construct() { + $this->test = '123'; + } + public function jsonSerialize() { + return array( + 'test' => $this->test, + 'me' => $this + ); + } } diff --git a/ext/json/tests/bug62369.phpt b/ext/json/tests/bug62369.phpt index 6d9f58b967..9c0be481e4 100644 --- a/ext/json/tests/bug62369.phpt +++ b/ext/json/tests/bug62369.phpt @@ -7,27 +7,27 @@ FR #62369 (Segfault on json_encode(deeply_nested_array) $array = array(); for ($i=0; $i < 550; $i++) { - $array = array($array); + $array = array($array); } json_encode($array, 0, 551); switch (json_last_error()) { - case JSON_ERROR_NONE: - echo 'OK' . PHP_EOL; - break; - case JSON_ERROR_DEPTH: - echo 'ERROR' . PHP_EOL; - break; + case JSON_ERROR_NONE: + echo 'OK' . PHP_EOL; + break; + case JSON_ERROR_DEPTH: + echo 'ERROR' . PHP_EOL; + break; } json_encode($array, 0, 540); switch (json_last_error()) { - case JSON_ERROR_NONE: - echo 'OK' . PHP_EOL; - break; - case JSON_ERROR_DEPTH: - echo 'ERROR' . PHP_EOL; - break; + case JSON_ERROR_NONE: + echo 'OK' . PHP_EOL; + break; + case JSON_ERROR_DEPTH: + echo 'ERROR' . PHP_EOL; + break; } --EXPECT-- OK diff --git a/ext/json/tests/bug63737.phpt b/ext/json/tests/bug63737.phpt index 35361d850a..1fb06d485e 100644 --- a/ext/json/tests/bug63737.phpt +++ b/ext/json/tests/bug63737.phpt @@ -5,10 +5,10 @@ Bug #63737 (json_decode does not properly decode with options parameter) --FILE-- <?php function decode($json) { - $x = json_decode($json); - var_dump($x); - $x = json_decode($json, false, 512, JSON_BIGINT_AS_STRING); - var_dump($x); + $x = json_decode($json); + var_dump($x); + $x = json_decode($json, false, 512, JSON_BIGINT_AS_STRING); + var_dump($x); } decode('123456789012345678901234567890'); diff --git a/ext/json/tests/bug64874_part1.phpt b/ext/json/tests/bug64874_part1.phpt index 9e0cb7e1cf..6b79b8dc04 100644 --- a/ext/json/tests/bug64874_part1.phpt +++ b/ext/json/tests/bug64874_part1.phpt @@ -5,9 +5,9 @@ Whitespace part of bug #64874 ("json_decode handles whitespace and case-sensitiv --FILE-- <?php function decode($json) { - var_dump(json_decode($json)); - var_dump(json_last_error() !== 0); - echo "\n"; + var_dump(json_decode($json)); + var_dump(json_last_error() !== 0); + echo "\n"; } // Leading whitespace should be ignored diff --git a/ext/json/tests/bug64874_part2.phpt b/ext/json/tests/bug64874_part2.phpt index db784bd8e0..338fc1141a 100644 --- a/ext/json/tests/bug64874_part2.phpt +++ b/ext/json/tests/bug64874_part2.phpt @@ -5,8 +5,8 @@ Case-sensitivity part of bug #64874 ("json_decode handles whitespace and case-se --FILE-- <?php function decode($json) { - var_dump(json_decode($json)); - echo ((json_last_error() !== 0) ? 'ERROR' : 'SUCCESS') . PHP_EOL; + var_dump(json_decode($json)); + echo ((json_last_error() !== 0) ? 'ERROR' : 'SUCCESS') . PHP_EOL; } // Only lowercase should work diff --git a/ext/json/tests/bug66021.phpt b/ext/json/tests/bug66021.phpt index 504d17fc78..19d28eb66b 100644 --- a/ext/json/tests/bug66021.phpt +++ b/ext/json/tests/bug66021.phpt @@ -6,7 +6,7 @@ Bug #66021 (Blank line inside empty array/object when JSON_PRETTY_PRINT is set) <?php class Foo { - private $bar = 'baz'; + private $bar = 'baz'; } echo json_encode(array(array(), (object) array(), new Foo), JSON_PRETTY_PRINT); diff --git a/ext/json/tests/bug66025.phpt b/ext/json/tests/bug66025.phpt index 9322d39b66..13bd6ea90b 100644 --- a/ext/json/tests/bug66025.phpt +++ b/ext/json/tests/bug66025.phpt @@ -9,8 +9,8 @@ if (!extension_loaded('json')) die('skip'); class Foo implements JsonSerializable { public function jsonSerialize() { - return json_encode([1], JSON_PRETTY_PRINT); - } + return json_encode([1], JSON_PRETTY_PRINT); + } } echo json_encode([new Foo]), "\n"; diff --git a/ext/json/tests/bug68992.phpt b/ext/json/tests/bug68992.phpt index 06448bbb38..8e209e0709 100644 --- a/ext/json/tests/bug68992.phpt +++ b/ext/json/tests/bug68992.phpt @@ -9,8 +9,8 @@ if (!extension_loaded('json')) die('skip'); class MyClass implements JsonSerializable { public function jsonSerialize() { - throw new Exception('Not implemented!'); - } + throw new Exception('Not implemented!'); + } } $classes = []; for($i = 0; $i < 5; $i++) { @@ -21,8 +21,8 @@ try { json_encode($classes); } catch(Exception $e) { do { - printf("%s (%d) [%s]\n", $e->getMessage(), $e->getCode(), get_class($e)); - } while ($e = $e->getPrevious()); + printf("%s (%d) [%s]\n", $e->getMessage(), $e->getCode(), get_class($e)); + } while ($e = $e->getPrevious()); } ?> --EXPECT-- diff --git a/ext/json/tests/bug71835.phpt b/ext/json/tests/bug71835.phpt index dbe313b70c..334c84c595 100644 --- a/ext/json/tests/bug71835.phpt +++ b/ext/json/tests/bug71835.phpt @@ -5,18 +5,18 @@ Bug #71835 (json_encode sometimes incorrectly detects recursion with JsonSeriali --FILE-- <?php class SomeClass implements JsonSerializable { - public function jsonSerialize() { - return [get_object_vars($this)]; - } + public function jsonSerialize() { + return [get_object_vars($this)]; + } } $class = new SomeClass; $arr = [$class]; var_dump(json_encode($arr)); class SomeClass2 implements JsonSerializable { - public function jsonSerialize() { - return [(array)$this]; - } + public function jsonSerialize() { + return [(array)$this]; + } } $class = new SomeClass2; $arr = [$class]; diff --git a/ext/json/tests/bug72069.phpt b/ext/json/tests/bug72069.phpt index 0ff8c98621..d7c7729013 100644 --- a/ext/json/tests/bug72069.phpt +++ b/ext/json/tests/bug72069.phpt @@ -10,10 +10,10 @@ var_dump($result); class A implements \JsonSerializable { - function jsonSerialize() - { - return ['end' => json_decode(null, true)]; - } + function jsonSerialize() + { + return ['end' => json_decode(null, true)]; + } } $a = new A(); $toJsonData = $a->jsonSerialize(); diff --git a/ext/json/tests/bug73113.phpt b/ext/json/tests/bug73113.phpt index d45e51f683..1bb1706331 100644 --- a/ext/json/tests/bug73113.phpt +++ b/ext/json/tests/bug73113.phpt @@ -16,9 +16,9 @@ class JsonSerializableObject implements \JsonSerializable $obj = new JsonSerializableObject(); try { - echo json_encode($obj); + echo json_encode($obj); } catch (\Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } --EXPECT-- This error is expected diff --git a/ext/json/tests/fail001.phpt b/ext/json/tests/fail001.phpt index 21dd42f8c3..b03b77f44d 100644 --- a/ext/json/tests/fail001.phpt +++ b/ext/json/tests/fail001.phpt @@ -8,38 +8,38 @@ JSON (http://www.crockford.com/JSON/JSON_checker/test/fail*.json) <?php $tests = array( - '"A JSON payload should be an object or array, not a string."', - '["Unclosed array"', - '{unquoted_key: "keys must be quoted}', - '["extra comma",]', - '["double extra comma",,]', - '[ , "<-- missing value"]', - '["Comma after the close"],', - '["Extra close"]]', - '{"Extra comma": true,}', - '{"Extra value after close": true} "misplaced quoted value"', - '{"Illegal expression": 1 + 2}', - '{"Illegal invocation": alert()}', - '{"Numbers cannot have leading zeroes": 013}', - '{"Numbers cannot be hex": 0x14}', - '["Illegal backslash escape: \\x15"]', - '["Illegal backslash escape: \\\'"]', - '["Illegal backslash escape: \\017"]', - '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]', - '{"Missing colon" null}', - '{"Double colon":: null}', - '{"Comma instead of colon", null}', - '["Colon instead of comma": false]', - '["Bad value", truth]', - "['single quote']" + '"A JSON payload should be an object or array, not a string."', + '["Unclosed array"', + '{unquoted_key: "keys must be quoted}', + '["extra comma",]', + '["double extra comma",,]', + '[ , "<-- missing value"]', + '["Comma after the close"],', + '["Extra close"]]', + '{"Extra comma": true,}', + '{"Extra value after close": true} "misplaced quoted value"', + '{"Illegal expression": 1 + 2}', + '{"Illegal invocation": alert()}', + '{"Numbers cannot have leading zeroes": 013}', + '{"Numbers cannot be hex": 0x14}', + '["Illegal backslash escape: \\x15"]', + '["Illegal backslash escape: \\\'"]', + '["Illegal backslash escape: \\017"]', + '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]', + '{"Missing colon" null}', + '{"Double colon":: null}', + '{"Comma instead of colon", null}', + '["Colon instead of comma": false]', + '["Bad value", truth]', + "['single quote']" ); foreach ($tests as $test) { - echo 'Testing: ' . $test . "\n"; - echo "AS OBJECT\n"; - var_dump(json_decode($test)); - echo "AS ARRAY\n"; - var_dump(json_decode($test, true)); + echo 'Testing: ' . $test . "\n"; + echo "AS OBJECT\n"; + var_dump(json_decode($test)); + echo "AS ARRAY\n"; + var_dump(json_decode($test, true)); } ?> diff --git a/ext/json/tests/json_decode_basic.phpt b/ext/json/tests/json_decode_basic.phpt index d9125ed7ad..81501c1857 100644 --- a/ext/json/tests/json_decode_basic.phpt +++ b/ext/json/tests/json_decode_basic.phpt @@ -8,34 +8,34 @@ echo "*** Testing json_decode() : basic functionality ***\n"; // array with different values for $string $inputs = array ( - '0', - '123', - '-123', - '2147483647', - '-2147483648', - '123.456', - '1230', - '-1230', - 'true', - 'false', - 'null', - '"abc"', - '"Hello World\r\n"', - '[]', - '[1,2,3,4,5]', - '{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}', - '{"Jan":31,"Feb":29,"Mar":31,"April":30,"May":31,"June":30}', - '""', - '{}' + '0', + '123', + '-123', + '2147483647', + '-2147483648', + '123.456', + '1230', + '-1230', + 'true', + 'false', + 'null', + '"abc"', + '"Hello World\r\n"', + '[]', + '[1,2,3,4,5]', + '{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}', + '{"Jan":31,"Feb":29,"Mar":31,"April":30,"May":31,"June":30}', + '""', + '{}' ); // loop through with each element of the $inputs array to test json_decode() function $count = 1; foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump(json_decode($input)); - var_dump(json_decode($input, true)); - $count++; + echo "-- Iteration $count --\n"; + var_dump(json_decode($input)); + var_dump(json_decode($input, true)); + $count++; } ?> diff --git a/ext/json/tests/json_decode_exceptions.phpt b/ext/json/tests/json_decode_exceptions.phpt index 14cf59fd02..ba1b57f5be 100644 --- a/ext/json/tests/json_decode_exceptions.phpt +++ b/ext/json/tests/json_decode_exceptions.phpt @@ -6,9 +6,9 @@ Test json_decode() function : JSON_THROW_ON_ERROR flag <?php try { - var_dump(json_decode("{", false, 512, JSON_THROW_ON_ERROR)); + var_dump(json_decode("{", false, 512, JSON_THROW_ON_ERROR)); } catch (JsonException $e) { - var_dump($e); + var_dump($e); } ?> diff --git a/ext/json/tests/json_decode_invalid_utf8.phpt b/ext/json/tests/json_decode_invalid_utf8.phpt index d92f785424..b69400f360 100644 --- a/ext/json/tests/json_decode_invalid_utf8.phpt +++ b/ext/json/tests/json_decode_invalid_utf8.phpt @@ -7,14 +7,14 @@ if (!extension_loaded("json")) print "skip"; --FILE-- <?php function json_decode_invalid_utf8($str) { - var_dump(json_decode($str)); - var_dump(json_decode($str, true, 512, JSON_INVALID_UTF8_IGNORE)); - $json = json_decode($str, true, 512, JSON_INVALID_UTF8_SUBSTITUTE); - if (is_array($json)) { - var_dump(array_map(function($item) { return bin2hex($item); }, $json)); - } else { - var_dump(bin2hex($json)); - } + var_dump(json_decode($str)); + var_dump(json_decode($str, true, 512, JSON_INVALID_UTF8_IGNORE)); + $json = json_decode($str, true, 512, JSON_INVALID_UTF8_SUBSTITUTE); + if (is_array($json)) { + var_dump(array_map(function($item) { return bin2hex($item); }, $json)); + } else { + var_dump(bin2hex($json)); + } } json_decode_invalid_utf8("\"a\xb0b\""); json_decode_invalid_utf8("\"a\xd0\xf2b\""); diff --git a/ext/json/tests/json_encode_basic.phpt b/ext/json/tests/json_encode_basic.phpt index de65600f38..d351765c0a 100644 --- a/ext/json/tests/json_encode_basic.phpt +++ b/ext/json/tests/json_encode_basic.phpt @@ -26,63 +26,63 @@ $obj->MyString = "Hello World"; // array with different values for $string $inputs = array ( - // integers - 0, - 123, - -123, - 2147483647, - -2147483648, - - // floats - 123.456, - 1.23E3, - -1.23E3, - - // boolean - TRUE, - true, - FALSE, - false, - - // NULL - NULL, - null, - - // strings - "abc", - 'abc', - "Hello\t\tWorld\n", - - // arrays - array(), - array(1,2,3,4,5), - array(1 => "Sun", 2 => "Mon", 3 => "Tue", 4 => "Wed", 5 => "Thur", 6 => "Fri", 7 => "Sat"), - array("Jan" => 31, "Feb" => 29, "Mar" => 31, "April" => 30, "May" => 31, "June" => 30), - - // empty data - "", - '', - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - // resource variable - $fp, - - // object variable - $obj + // integers + 0, + 123, + -123, + 2147483647, + -2147483648, + + // floats + 123.456, + 1.23E3, + -1.23E3, + + // boolean + TRUE, + true, + FALSE, + false, + + // NULL + NULL, + null, + + // strings + "abc", + 'abc', + "Hello\t\tWorld\n", + + // arrays + array(), + array(1,2,3,4,5), + array(1 => "Sun", 2 => "Mon", 3 => "Tue", 4 => "Wed", 5 => "Thur", 6 => "Fri", 7 => "Sat"), + array("Jan" => 31, "Feb" => 29, "Mar" => 31, "April" => 30, "May" => 31, "June" => 30), + + // empty data + "", + '', + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource variable + $fp, + + // object variable + $obj ); // loop through with each element of the $inputs array to test json_encode() function $count = 1; foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump(json_encode($input)); - $count ++; + echo "-- Iteration $count --\n"; + var_dump(json_encode($input)); + $count ++; } ?> diff --git a/ext/json/tests/json_encode_exceptions.phpt b/ext/json/tests/json_encode_exceptions.phpt index 507f16ede9..a3d1f7ae25 100644 --- a/ext/json/tests/json_encode_exceptions.phpt +++ b/ext/json/tests/json_encode_exceptions.phpt @@ -6,9 +6,9 @@ Test json_encode() function : JSON_THROW_ON_ERROR flag <?php try { - var_dump(json_encode("\x80", JSON_THROW_ON_ERROR)); + var_dump(json_encode("\x80", JSON_THROW_ON_ERROR)); } catch (JsonException $e) { - var_dump($e); + var_dump($e); } // JSON_PARTIAL_OUTPUT_ON_ERROR is incompatible with exceptions diff --git a/ext/json/tests/json_encode_invalid_utf8.phpt b/ext/json/tests/json_encode_invalid_utf8.phpt index d7ec58a973..7b032b81e6 100644 --- a/ext/json/tests/json_encode_invalid_utf8.phpt +++ b/ext/json/tests/json_encode_invalid_utf8.phpt @@ -7,11 +7,11 @@ if (!extension_loaded("json")) print "skip"; --FILE-- <?php function json_encode_invalid_utf8($str) { - var_dump(json_encode($str)); - var_dump(json_encode($str, JSON_INVALID_UTF8_IGNORE)); - var_dump(json_encode($str, JSON_INVALID_UTF8_SUBSTITUTE)); - var_dump(json_encode($str, JSON_UNESCAPED_UNICODE)); - var_dump(bin2hex(json_encode($str, JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_SUBSTITUTE))); + var_dump(json_encode($str)); + var_dump(json_encode($str, JSON_INVALID_UTF8_IGNORE)); + var_dump(json_encode($str, JSON_INVALID_UTF8_SUBSTITUTE)); + var_dump(json_encode($str, JSON_UNESCAPED_UNICODE)); + var_dump(bin2hex(json_encode($str, JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_SUBSTITUTE))); } json_encode_invalid_utf8("\x61\xb0\x62"); json_encode_invalid_utf8("\x61\xf0\x80\x80\x41"); diff --git a/ext/json/tests/json_encode_numeric.phpt b/ext/json/tests/json_encode_numeric.phpt index 9202cd00ed..c3c7edd444 100644 --- a/ext/json/tests/json_encode_numeric.phpt +++ b/ext/json/tests/json_encode_numeric.phpt @@ -7,12 +7,12 @@ serialize_precision=-1 --FILE-- <?php var_dump( - json_encode("1", JSON_NUMERIC_CHECK), - json_encode("9.4324", JSON_NUMERIC_CHECK), - json_encode(array("122321", "3232595.33423"), JSON_NUMERIC_CHECK), - json_encode("1"), - json_encode("9.4324"), - json_encode(array("122321", "3232595.33423")) + json_encode("1", JSON_NUMERIC_CHECK), + json_encode("9.4324", JSON_NUMERIC_CHECK), + json_encode(array("122321", "3232595.33423"), JSON_NUMERIC_CHECK), + json_encode("1"), + json_encode("9.4324"), + json_encode(array("122321", "3232595.33423")) ); ?> --EXPECT-- diff --git a/ext/json/tests/json_encode_pretty_print.phpt b/ext/json/tests/json_encode_pretty_print.phpt index 43b93aafe6..0ac4a6d3fb 100644 --- a/ext/json/tests/json_encode_pretty_print.phpt +++ b/ext/json/tests/json_encode_pretty_print.phpt @@ -5,11 +5,11 @@ json_encode() with JSON_PRETTY_PRINT --FILE-- <?php function encode_decode($json) { - $struct = json_decode($json); - $pretty = json_encode($struct, JSON_PRETTY_PRINT); - echo "$pretty\n"; - $pretty = json_decode($pretty); - printf("Match: %d\n", $pretty == $struct); + $struct = json_decode($json); + $pretty = json_encode($struct, JSON_PRETTY_PRINT); + echo "$pretty\n"; + $pretty = json_decode($pretty); + printf("Match: %d\n", $pretty == $struct); } encode_decode('[1,2,3,[1,2,3]]'); diff --git a/ext/json/tests/json_exceptions_error_clearing.phpt b/ext/json/tests/json_exceptions_error_clearing.phpt index 6d01dd7c33..70dfca2171 100644 --- a/ext/json/tests/json_exceptions_error_clearing.phpt +++ b/ext/json/tests/json_exceptions_error_clearing.phpt @@ -14,26 +14,26 @@ json_decode("\xFF"); var_dump(json_last_error()); try { - json_decode("", false, 512, JSON_THROW_ON_ERROR); + json_decode("", false, 512, JSON_THROW_ON_ERROR); } catch (JsonException $e) { - echo "Caught JSON exception: ", $e->getCode(), PHP_EOL; + echo "Caught JSON exception: ", $e->getCode(), PHP_EOL; } var_dump(json_last_error()); try { - json_decode("{", false, 512, JSON_THROW_ON_ERROR); + json_decode("{", false, 512, JSON_THROW_ON_ERROR); } catch (JsonException $e) { - echo "Caught JSON exception: ", $e->getCode(), PHP_EOL; + echo "Caught JSON exception: ", $e->getCode(), PHP_EOL; } var_dump(json_last_error()); try { - json_encode(NAN, JSON_THROW_ON_ERROR); + json_encode(NAN, JSON_THROW_ON_ERROR); } catch (JsonException $e) { - echo "Caught JSON exception: ", $e->getCode(), PHP_EOL; + echo "Caught JSON exception: ", $e->getCode(), PHP_EOL; } var_dump(json_last_error()); diff --git a/ext/json/tests/serialize.phpt b/ext/json/tests/serialize.phpt index 1aa90750da..ab2f9c926d 100644 --- a/ext/json/tests/serialize.phpt +++ b/ext/json/tests/serialize.phpt @@ -9,46 +9,46 @@ serialize_precision=-1 class NonSerializingTest { - public $data; + public $data; - public function __construct($data) - { - $this->data = $data; - } + public function __construct($data) + { + $this->data = $data; + } } class SerializingTest extends NonSerializingTest implements JsonSerializable { - public function jsonSerialize() - { - return $this->data; - } + public function jsonSerialize() + { + return $this->data; + } } class ValueSerializingTest extends SerializingTest { - public function jsonSerialize() - { - return array_values(is_array($this->data) ? $this->data : get_object_vars($this->data)); - } + public function jsonSerialize() + { + return array_values(is_array($this->data) ? $this->data : get_object_vars($this->data)); + } } class SelfSerializingTest extends SerializingTest { - public function jsonSerialize() - { - return $this; - } + public function jsonSerialize() + { + return $this; + } } $adata = array( - 'str' => 'foo', - 'int' => 1, - 'float' => 2.3, - 'bool' => false, - 'nil' => null, - 'arr' => array(1,2,3), - 'obj' => new StdClass, + 'str' => 'foo', + 'int' => 1, + 'float' => 2.3, + 'bool' => false, + 'nil' => null, + 'arr' => array(1,2,3), + 'obj' => new StdClass, ); $ndata = array_values($adata); @@ -56,10 +56,10 @@ $ndata = array_values($adata); $odata = (object)$adata; foreach(array('NonSerializingTest','SerializingTest','ValueSerializingTest','SelfSerializingTest') as $class) { - echo "==$class==\n"; - echo json_encode(new $class($adata)), "\n"; - echo json_encode(new $class($ndata)), "\n"; - echo json_encode(new $class($odata)), "\n"; + echo "==$class==\n"; + echo json_encode(new $class($adata)), "\n"; + echo json_encode(new $class($ndata)), "\n"; + echo json_encode(new $class($odata)), "\n"; } --EXPECT-- ==NonSerializingTest== diff --git a/ext/ldap/tests/bug48441.phpt b/ext/ldap/tests/bug48441.phpt index fa2f2ee023..c4b224c7a7 100644 --- a/ext/ldap/tests/bug48441.phpt +++ b/ext/ldap/tests/bug48441.phpt @@ -18,16 +18,16 @@ $dn = "$base"; $filter = "(objectclass=person)"; var_dump( - $result = ldap_search($link, $dn, $filter, array('sn')), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn')), + ldap_get_entries($link, $result) ); var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 1, LDAP_DEREF_ALWAYS), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 1, LDAP_DEREF_ALWAYS), + ldap_get_entries($link, $result) ); var_dump( - $result = ldap_search($link, $dn, $filter, array('sn')), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn')), + ldap_get_entries($link, $result) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/bug73933.phpt b/ext/ldap/tests/bug73933.phpt index ac934a8dd8..8e50a750e2 100644 --- a/ext/ldap/tests/bug73933.phpt +++ b/ext/ldap/tests/bug73933.phpt @@ -10,15 +10,15 @@ require_once('skipif.inc'); $ldap = ldap_connect('127.0.0.1', 3333); ldap_mod_replace($ldap, null, array( - 'lockoutTime' => array(0), + 'lockoutTime' => array(0), )); ldap_modify_batch($ldap, null, array( [ - "attrib" => "mail", - "modtype" => LDAP_MODIFY_BATCH_ADD, - "values" => [ - "test@example.com", - "test-2@example.com", ]])); + "attrib" => "mail", + "modtype" => LDAP_MODIFY_BATCH_ADD, + "values" => [ + "test@example.com", + "test-2@example.com", ]])); ldap_close($ldap); diff --git a/ext/ldap/tests/bug77958.phpt b/ext/ldap/tests/bug77958.phpt index a19561740b..b370b40eda 100644 --- a/ext/ldap/tests/bug77958.phpt +++ b/ext/ldap/tests/bug77958.phpt @@ -13,23 +13,23 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $mods = array( - array( - "attrib" => "telephoneNumber", - "modtype" => LDAP_MODIFY_BATCH_ADD, - "values" => array( - 123456 - ) - ), - array( - "attrib" => "description", - "modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL - ) + array( + "attrib" => "telephoneNumber", + "modtype" => LDAP_MODIFY_BATCH_ADD, + "values" => array( + 123456 + ) + ), + array( + "attrib" => "description", + "modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL + ) ); var_dump( - ldap_modify_batch($link, "cn=userA,$base", $mods), - $entry = ldap_first_entry($link, ldap_read($link, "cn=userA,$base", "(telephoneNumber=*)")), - ldap_get_values($link, $entry, "telephoneNumber") + ldap_modify_batch($link, "cn=userA,$base", $mods), + $entry = ldap_first_entry($link, ldap_read($link, "cn=userA,$base", "(telephoneNumber=*)")), + ldap_get_values($link, $entry, "telephoneNumber") ); ?> --CLEAN-- diff --git a/ext/ldap/tests/connect.inc b/ext/ldap/tests/connect.inc index de41cca63c..bd6a144d2e 100644 --- a/ext/ldap/tests/connect.inc +++ b/ext/ldap/tests/connect.inc @@ -15,74 +15,74 @@ $protocol_version = getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") ?: 3; $skip_on_bind_failure = getenv("LDAP_TEST_SKIP_BIND_FAILURE") ?: true; function ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version) { - $link = ldap_connect($host, $port); - ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); - ldap_bind($link, $user, $passwd); - return $link; + $link = ldap_connect($host, $port); + ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); + ldap_bind($link, $user, $passwd); + return $link; } function test_bind($host, $port, $user, $passwd, $protocol_version) { - $link = ldap_connect($host, $port); - ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); - return ldap_bind($link, $user, $passwd); + $link = ldap_connect($host, $port); + ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); + return ldap_bind($link, $user, $passwd); } function insert_dummy_data($link, $base) { - // Create root if not there - $testBase = ldap_read($link, $base, '(objectClass=*)', array('objectClass')); - if (ldap_count_entries($link, $testBase) < 1) { - ldap_add( - $link, "$base", array( - "objectClass" => array( - "top", - "organization", - "dcObject" - ), - "o" => "php ldap tests" - ) - ); - } - ldap_add($link, "o=test,$base", array( - "objectClass" => array( + // Create root if not there + $testBase = ldap_read($link, $base, '(objectClass=*)', array('objectClass')); + if (ldap_count_entries($link, $testBase) < 1) { + ldap_add( + $link, "$base", array( + "objectClass" => array( + "top", + "organization", + "dcObject" + ), + "o" => "php ldap tests" + ) + ); + } + ldap_add($link, "o=test,$base", array( + "objectClass" => array( "top", "organization"), - "o" => "test", - )); - ldap_add($link, "cn=userA,$base", array( - "objectclass" => "person", - "cn" => "userA", - "sn" => "testSN1", - "userPassword" => "oops", - "telephoneNumber" => "xx-xx-xx-xx-xx", - "description" => "user A", - )); - ldap_add($link, "cn=userB,$base", array( - "objectclass" => "person", - "cn" => "userB", - "sn" => "testSN2", - "userPassword" => "oopsIDitItAgain", - "description" => "user B", - )); - ldap_add($link, "cn=userC,cn=userB,$base", array( - "objectclass" => "person", - "cn" => "userC", - "sn" => "testSN3", - "userPassword" => "0r1g1na1 passw0rd", - )); - ldap_add($link, "o=test2,$base", array( - "objectClass" => array( + "o" => "test", + )); + ldap_add($link, "cn=userA,$base", array( + "objectclass" => "person", + "cn" => "userA", + "sn" => "testSN1", + "userPassword" => "oops", + "telephoneNumber" => "xx-xx-xx-xx-xx", + "description" => "user A", + )); + ldap_add($link, "cn=userB,$base", array( + "objectclass" => "person", + "cn" => "userB", + "sn" => "testSN2", + "userPassword" => "oopsIDitItAgain", + "description" => "user B", + )); + ldap_add($link, "cn=userC,cn=userB,$base", array( + "objectclass" => "person", + "cn" => "userC", + "sn" => "testSN3", + "userPassword" => "0r1g1na1 passw0rd", + )); + ldap_add($link, "o=test2,$base", array( + "objectClass" => array( "top", "organization"), - "o" => "test2", - "l" => array("here", "there", "Antarctica"), - )); + "o" => "test2", + "l" => array("here", "there", "Antarctica"), + )); } function remove_dummy_data($link, $base) { - ldap_delete($link, "cn=userC,cn=userB,$base"); - ldap_delete($link, "cn=userA,$base"); - ldap_delete($link, "cn=userB,$base"); - ldap_delete($link, "o=test,$base"); - ldap_delete($link, "o=test2,$base"); + ldap_delete($link, "cn=userC,cn=userB,$base"); + ldap_delete($link, "cn=userA,$base"); + ldap_delete($link, "cn=userB,$base"); + ldap_delete($link, "o=test,$base"); + ldap_delete($link, "o=test2,$base"); } ?> diff --git a/ext/ldap/tests/ldap_add_basic.phpt b/ext/ldap/tests/ldap_add_basic.phpt index 7e7a255c91..b247901d73 100644 --- a/ext/ldap/tests/ldap_add_basic.phpt +++ b/ext/ldap/tests/ldap_add_basic.phpt @@ -13,18 +13,18 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); var_dump( - ldap_add($link, "dc=my-domain,$base", array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", - )), - ldap_get_entries( - $link, - ldap_search($link, "$base", "(o=my-domain)") - ) + ldap_add($link, "dc=my-domain,$base", array( + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", + )), + ldap_get_entries( + $link, + ldap_search($link, "$base", "(o=my-domain)") + ) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_add_error.phpt b/ext/ldap/tests/ldap_add_error.phpt index d7271461ce..61b4d2808d 100644 --- a/ext/ldap/tests/ldap_add_error.phpt +++ b/ext/ldap/tests/ldap_add_error.phpt @@ -16,16 +16,16 @@ var_dump(ldap_add($link, "$base", array())); // Invalid DN var_dump( - ldap_add($link, "weirdAttribute=val", array( - "weirdAttribute" => "val", - )), - ldap_error($link), - ldap_errno($link) + ldap_add($link, "weirdAttribute=val", array( + "weirdAttribute" => "val", + )), + ldap_error($link), + ldap_errno($link) ); // Duplicate entry for ($i = 0; $i < 2; $i++) - var_dump( + var_dump( ldap_add($link, "dc=my-domain,$base", array( "objectClass" => array( "top", @@ -34,49 +34,49 @@ for ($i = 0; $i < 2; $i++) "dc" => "my-domain", "o" => "my-domain", )) - ); + ); var_dump(ldap_error($link), ldap_errno($link)); // Wrong array indexes var_dump( - ldap_add($link, "dc=my-domain2,dc=com", array( - "objectClass" => array( - 0 => "top", - 2 => "dcObject", - 5 => "organization"), - "dc" => "my-domain", - "o" => "my-domain", - )) - /* Is this correct behaviour to still have "Already exists" as error/errno? - , - ldap_error($link), - ldap_errno($link) - */ + ldap_add($link, "dc=my-domain2,dc=com", array( + "objectClass" => array( + 0 => "top", + 2 => "dcObject", + 5 => "organization"), + "dc" => "my-domain", + "o" => "my-domain", + )) + /* Is this correct behaviour to still have "Already exists" as error/errno? + , + ldap_error($link), + ldap_errno($link) + */ ); // Invalid attribute var_dump( - ldap_add($link, "$base", array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", - "weirdAttr" => "weirdVal", - )), - ldap_error($link), - ldap_errno($link) + ldap_add($link, "$base", array( + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", + "weirdAttr" => "weirdVal", + )), + ldap_error($link), + ldap_errno($link) ); var_dump( - ldap_add($link, "$base", array(array( "Oops" - ))) - /* Is this correct behaviour to still have "Undefined attribute type" as error/errno? - , - ldap_error($link), - ldap_errno($link) - */ + ldap_add($link, "$base", array(array( "Oops" + ))) + /* Is this correct behaviour to still have "Undefined attribute type" as error/errno? + , + ldap_error($link), + ldap_errno($link) + */ ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_add_ext.phpt b/ext/ldap/tests/ldap_add_ext.phpt index 7363614585..fbcaff523b 100644 --- a/ext/ldap/tests/ldap_add_ext.phpt +++ b/ext/ldap/tests/ldap_add_ext.phpt @@ -16,20 +16,20 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); var_dump( - $result = ldap_add_ext($link, "o=test_ldap_add_ext,$base", array( - "objectClass" => array( - "top", - "organization"), - "o" => "test_ldap_add_ext", - ), [['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['o']]]]), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls[LDAP_CONTROL_POST_READ], - ldap_get_entries( - $link, - ldap_search($link, "$base", "(o=test_ldap_add_ext)") - ) + $result = ldap_add_ext($link, "o=test_ldap_add_ext,$base", array( + "objectClass" => array( + "top", + "organization"), + "o" => "test_ldap_add_ext", + ), [['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['o']]]]), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls[LDAP_CONTROL_POST_READ], + ldap_get_entries( + $link, + ldap_search($link, "$base", "(o=test_ldap_add_ext)") + ) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_bind_ext.phpt b/ext/ldap/tests/ldap_bind_ext.phpt index 0e8fb52d02..685b0588ce 100644 --- a/ext/ldap/tests/ldap_bind_ext.phpt +++ b/ext/ldap/tests/ldap_bind_ext.phpt @@ -17,30 +17,30 @@ $link = ldap_connect($host, $port); ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); var_dump( - $result = ldap_bind_ext($link, $user, $passwd), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls, - $result = ldap_bind_ext($link, $user, $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls + $result = ldap_bind_ext($link, $user, $passwd), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls, + $result = ldap_bind_ext($link, $user, $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls ); /* Failures */ var_dump( - $result = ldap_bind_ext($link, $user, "wrongPassword", [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls, - $result = ldap_bind_ext($link, "unexistingProperty=weirdValue,$user", $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls + $result = ldap_bind_ext($link, $user, "wrongPassword", [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls, + $result = ldap_bind_ext($link, "unexistingProperty=weirdValue,$user", $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls ); ?> --EXPECTF-- diff --git a/ext/ldap/tests/ldap_compare_basic.phpt b/ext/ldap/tests/ldap_compare_basic.phpt index a8b8c2b7b1..32f6ccf78f 100644 --- a/ext/ldap/tests/ldap_compare_basic.phpt +++ b/ext/ldap/tests/ldap_compare_basic.phpt @@ -13,8 +13,8 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - ldap_compare($link, "cn=userA,$base", "sn", "testSN1"), - ldap_compare($link, "cn=userA,$base", "telephoneNumber", "yy-yy-yy-yy-yy") + ldap_compare($link, "cn=userA,$base", "sn", "testSN1"), + ldap_compare($link, "cn=userA,$base", "telephoneNumber", "yy-yy-yy-yy-yy") ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_compare_error.phpt b/ext/ldap/tests/ldap_compare_error.phpt index b6b85c43c2..1b1231b6f9 100644 --- a/ext/ldap/tests/ldap_compare_error.phpt +++ b/ext/ldap/tests/ldap_compare_error.phpt @@ -14,9 +14,9 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - ldap_compare($link, "cn=userNotAvailable,$base", "sn", "testSN1"), - ldap_error($link), - ldap_errno($link) + ldap_compare($link, "cn=userNotAvailable,$base", "sn", "testSN1"), + ldap_error($link), + ldap_errno($link) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_control_paged_results_variation1.phpt b/ext/ldap/tests/ldap_control_paged_results_variation1.phpt index fa5af01bd6..75d147e0be 100644 --- a/ext/ldap/tests/ldap_control_paged_results_variation1.phpt +++ b/ext/ldap/tests/ldap_control_paged_results_variation1.phpt @@ -17,9 +17,9 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(cn=user*)"; var_dump( - ldap_control_paged_result($link, 1), - $result = ldap_search($link, $dn, $filter, array('cn')), - ldap_get_entries($link, $result) + ldap_control_paged_result($link, 1), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_get_entries($link, $result) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_control_paged_results_variation2.phpt b/ext/ldap/tests/ldap_control_paged_results_variation2.phpt index 02f5b9028c..b0b6e62aff 100644 --- a/ext/ldap/tests/ldap_control_paged_results_variation2.phpt +++ b/ext/ldap/tests/ldap_control_paged_results_variation2.phpt @@ -17,9 +17,9 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(cn=user*)"; var_dump( - ldap_control_paged_result($link, 2), - $result = ldap_search($link, $dn, $filter, array('cn')), - ldap_get_entries($link, $result) + ldap_control_paged_result($link, 2), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_get_entries($link, $result) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_control_paged_results_variation3.phpt b/ext/ldap/tests/ldap_control_paged_results_variation3.phpt index e7cc896585..de904f051f 100644 --- a/ext/ldap/tests/ldap_control_paged_results_variation3.phpt +++ b/ext/ldap/tests/ldap_control_paged_results_variation3.phpt @@ -18,13 +18,13 @@ $dn = "$base"; $filter = "(cn=user*)"; $cookie = ''; var_dump( - ldap_control_paged_result($link, 2, true, $cookie), - $result = ldap_search($link, $dn, $filter, array('cn')), - ldap_get_entries($link, $result), - ldap_control_paged_result_response($link, $result, $cookie), - ldap_control_paged_result($link, 20, true, $cookie), - $result = ldap_search($link, $dn, $filter, array('cn')), - ldap_get_entries($link, $result) + ldap_control_paged_result($link, 2, true, $cookie), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_get_entries($link, $result), + ldap_control_paged_result_response($link, $result, $cookie), + ldap_control_paged_result($link, 20, true, $cookie), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_get_entries($link, $result) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_controls.phpt b/ext/ldap/tests/ldap_controls.phpt index 8b2e3e8174..e6e0ab6164 100644 --- a/ext/ldap/tests/ldap_controls.phpt +++ b/ext/ldap/tests/ldap_controls.phpt @@ -19,35 +19,35 @@ insert_dummy_data($link, $base); /* Test assertion control */ var_dump( - $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER, - [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organization)']]]), - ldap_get_entries($link, $result), - $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER, - [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organizationalUnit)']]]), - ldap_modify($link, "o=test,$base", ['description' => 'desc'], - [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]), - $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')), - ldap_get_entries($link, $result), - ldap_modify($link, "o=test,$base", ['description' => 'desc2'], - [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]), - $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')), - ldap_get_entries($link, $result), - ldap_delete($link, "o=test,$base", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), - ldap_errno($link), - ldap_error($link), - ldap_rename($link, "o=test,$base", "o=test2", "", TRUE, [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), - ldap_compare($link, "o=test,$base", "o", "test"), - ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), - ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc)']]]) + $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organization)']]]), + ldap_get_entries($link, $result), + $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organizationalUnit)']]]), + ldap_modify($link, "o=test,$base", ['description' => 'desc'], + [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]), + $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')), + ldap_get_entries($link, $result), + ldap_modify($link, "o=test,$base", ['description' => 'desc2'], + [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]), + $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')), + ldap_get_entries($link, $result), + ldap_delete($link, "o=test,$base", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), + ldap_errno($link), + ldap_error($link), + ldap_rename($link, "o=test,$base", "o=test2", "", TRUE, [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), + ldap_compare($link, "o=test,$base", "o", "test"), + ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), + ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc)']]]) ); /* Test valuesreturnfilter control */ var_dump( - $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"]), - ldap_get_entries($link, $result)[0]['l'], - $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"], 0, 0, 0, LDAP_DEREF_NEVER, - [['oid' => LDAP_CONTROL_VALUESRETURNFILTER, 'iscritical' => TRUE, 'value' => ['filter' => '(l=*here)']]]), - ldap_get_entries($link, $result)[0]['l'] + $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"]), + ldap_get_entries($link, $result)[0]['l'], + $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"], 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_VALUESRETURNFILTER, 'iscritical' => TRUE, 'value' => ['filter' => '(l=*here)']]]), + ldap_get_entries($link, $result)[0]['l'] ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_delete_basic.phpt b/ext/ldap/tests/ldap_delete_basic.phpt index 65331771fb..046b141407 100644 --- a/ext/ldap/tests/ldap_delete_basic.phpt +++ b/ext/ldap/tests/ldap_delete_basic.phpt @@ -12,17 +12,17 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_add($link, "dc=my-domain,$base", array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", )); var_dump( - ldap_delete($link, "dc=my-domain,$base"), - @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)") + ldap_delete($link, "dc=my-domain,$base"), + @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)") ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_delete_error.phpt b/ext/ldap/tests/ldap_delete_error.phpt index 3faabcc60f..e924c3b59a 100644 --- a/ext/ldap/tests/ldap_delete_error.phpt +++ b/ext/ldap/tests/ldap_delete_error.phpt @@ -14,16 +14,16 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); // Invalid DN var_dump( - ldap_delete($link, "weirdAttribute=val"), - ldap_error($link), - ldap_errno($link) + ldap_delete($link, "weirdAttribute=val"), + ldap_error($link), + ldap_errno($link) ); // Deleting unexisting data var_dump( - ldap_delete($link, "dc=my-domain,$base"), - ldap_error($link), - ldap_errno($link) + ldap_delete($link, "dc=my-domain,$base"), + ldap_error($link), + ldap_errno($link) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_delete_ext.phpt b/ext/ldap/tests/ldap_delete_ext.phpt index ab0c1baffd..bcdc15ba51 100644 --- a/ext/ldap/tests/ldap_delete_ext.phpt +++ b/ext/ldap/tests/ldap_delete_ext.phpt @@ -15,23 +15,23 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_add($link, "dc=my-domain,$base", array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", )); var_dump( - $result = ldap_delete_ext($link, "dc=my-domain,$base", - [['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['dc', 'o']]]] - ), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls[LDAP_CONTROL_PRE_READ], - @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)") + $result = ldap_delete_ext($link, "dc=my-domain,$base", + [['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['dc', 'o']]]] + ), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls[LDAP_CONTROL_PRE_READ], + @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)") ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_errno_basic.phpt b/ext/ldap/tests/ldap_errno_basic.phpt index 9d2099c6e3..535bb290ac 100644 --- a/ext/ldap/tests/ldap_errno_basic.phpt +++ b/ext/ldap/tests/ldap_errno_basic.phpt @@ -12,16 +12,16 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); @ldap_add($link, "badDN $base", array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", )); var_dump( - ldap_errno($link) + ldap_errno($link) ); ?> --EXPECT-- diff --git a/ext/ldap/tests/ldap_error_basic.phpt b/ext/ldap/tests/ldap_error_basic.phpt index 4d866d5a44..442936c3ae 100644 --- a/ext/ldap/tests/ldap_error_basic.phpt +++ b/ext/ldap/tests/ldap_error_basic.phpt @@ -12,16 +12,16 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); @ldap_add($link, "badDN $base", array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", )); var_dump( - ldap_error($link) + ldap_error($link) ); ?> --EXPECT-- diff --git a/ext/ldap/tests/ldap_exop.phpt b/ext/ldap/tests/ldap_exop.phpt index 7d47a9812c..abb63e877f 100644 --- a/ext/ldap/tests/ldap_exop.phpt +++ b/ext/ldap/tests/ldap_exop.phpt @@ -14,24 +14,24 @@ insert_dummy_data($link, $base); function build_reqdata_passwd($user, $oldpw, $newpw) { - // This is basic and will only work for small strings - $hex = ''; - if (!empty($user)) { - $hex .= '80'.sprintf("%'.02x", strlen($user)).bin2hex($user); - } - if (!empty($oldpw)) { - $hex .= '81'.sprintf("%'.02x", strlen($oldpw)).bin2hex($oldpw); - } - if (!empty($newpw)) { - $hex .= '82'.sprintf("%'.02x", strlen($newpw)).bin2hex($newpw); - } - return hex2bin('30'.sprintf("%'.02x", strlen($hex)/2).$hex); + // This is basic and will only work for small strings + $hex = ''; + if (!empty($user)) { + $hex .= '80'.sprintf("%'.02x", strlen($user)).bin2hex($user); + } + if (!empty($oldpw)) { + $hex .= '81'.sprintf("%'.02x", strlen($oldpw)).bin2hex($oldpw); + } + if (!empty($newpw)) { + $hex .= '82'.sprintf("%'.02x", strlen($newpw)).bin2hex($newpw); + } + return hex2bin('30'.sprintf("%'.02x", strlen($hex)/2).$hex); } function extract_genpw($retdata) { - // Only works for small strings as well - return hex2bin(substr(bin2hex($retdata), 4*2)); + // Only works for small strings as well + return hex2bin(substr(bin2hex($retdata), 4*2)); } $userAPassword = "oops"; @@ -39,20 +39,20 @@ $userAPassword = "oops"; // ldap_exop(resource link, string reqoid [, string reqdata [, array servercontrols [, string &retdata [, string &retoid]]]]) // bool ldap_parse_exop(resource link, resource result [, string &retdata [, string &retoid]]) var_dump( - ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, NULL, $retdata, $retoid), - $retdata, - $retoid, - ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, [['oid' => LDAP_CONTROL_PROXY_AUTHZ, 'value' => "dn:cn=userA,$base"]], $retdata), - $retdata, - $r = ldap_exop($link, LDAP_EXOP_WHO_AM_I), - ldap_parse_exop($link, $r, $retdata2), - $retdata2, - test_bind($host, $port, "cn=userA,$base", $userAPassword, $protocol_version), - $r = ldap_exop($link, LDAP_EXOP_MODIFY_PASSWD, build_reqdata_passwd("cn=userA,$base", $userAPassword, "")), - ldap_parse_exop($link, $r, $retpwdata, $retpwoid), - $genpw = extract_genpw($retpwdata), - $retpwoid, - test_bind($host, $port, "cn=userA,$base", $genpw, $protocol_version) + ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, NULL, $retdata, $retoid), + $retdata, + $retoid, + ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, [['oid' => LDAP_CONTROL_PROXY_AUTHZ, 'value' => "dn:cn=userA,$base"]], $retdata), + $retdata, + $r = ldap_exop($link, LDAP_EXOP_WHO_AM_I), + ldap_parse_exop($link, $r, $retdata2), + $retdata2, + test_bind($host, $port, "cn=userA,$base", $userAPassword, $protocol_version), + $r = ldap_exop($link, LDAP_EXOP_MODIFY_PASSWD, build_reqdata_passwd("cn=userA,$base", $userAPassword, "")), + ldap_parse_exop($link, $r, $retpwdata, $retpwoid), + $genpw = extract_genpw($retpwdata), + $retpwoid, + test_bind($host, $port, "cn=userA,$base", $genpw, $protocol_version) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_exop_refresh.phpt b/ext/ldap/tests/ldap_exop_refresh.phpt index 80660499af..b90a92bc00 100644 --- a/ext/ldap/tests/ldap_exop_refresh.phpt +++ b/ext/ldap/tests/ldap_exop_refresh.phpt @@ -21,12 +21,12 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); ldap_add($link, "cn=tmp,$base", array( - "objectclass" => array("person", "dynamicObject"), - "cn" => "tmp", - "sn" => "tmp" + "objectclass" => array("person", "dynamicObject"), + "cn" => "tmp", + "sn" => "tmp" )); var_dump( - ldap_exop_refresh($link, "cn=tmp,$base", 1234) + ldap_exop_refresh($link, "cn=tmp,$base", 1234) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_first_attribute_basic.phpt b/ext/ldap/tests/ldap_first_attribute_basic.phpt index e87b70c474..81bc538aea 100644 --- a/ext/ldap/tests/ldap_first_attribute_basic.phpt +++ b/ext/ldap/tests/ldap_first_attribute_basic.phpt @@ -15,7 +15,7 @@ insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(objectclass=organization)", array("objectClass")); $entry = ldap_first_entry($link, $result); var_dump( - ldap_first_attribute($link, $entry) + ldap_first_attribute($link, $entry) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_first_entry_basic.phpt b/ext/ldap/tests/ldap_first_entry_basic.phpt index 99b79e4d29..94d46d6d87 100644 --- a/ext/ldap/tests/ldap_first_entry_basic.phpt +++ b/ext/ldap/tests/ldap_first_entry_basic.phpt @@ -14,8 +14,8 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(objectclass=person)"); var_dump( - $entry = ldap_first_entry($link, $result), - ldap_get_values($link, $entry, 'sn') + $entry = ldap_first_entry($link, $result), + ldap_get_values($link, $entry, 'sn') ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_get_attributes_basic.phpt b/ext/ldap/tests/ldap_get_attributes_basic.phpt index 8cb374b27f..0d11bce706 100644 --- a/ext/ldap/tests/ldap_get_attributes_basic.phpt +++ b/ext/ldap/tests/ldap_get_attributes_basic.phpt @@ -15,7 +15,7 @@ insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(o=test)"); $entry = ldap_first_entry($link, $result); var_dump( - ldap_get_attributes($link, $entry) + ldap_get_attributes($link, $entry) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_get_dn_basic.phpt b/ext/ldap/tests/ldap_get_dn_basic.phpt index 0cb6c833a6..14865ffe3c 100644 --- a/ext/ldap/tests/ldap_get_dn_basic.phpt +++ b/ext/ldap/tests/ldap_get_dn_basic.phpt @@ -15,7 +15,7 @@ insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(objectclass=organization)"); $entry = ldap_first_entry($link, $result); var_dump( - ldap_get_dn($link, $entry) + ldap_get_dn($link, $entry) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_get_entries_basic.phpt b/ext/ldap/tests/ldap_get_entries_basic.phpt index e1806fca69..bba2f08c69 100644 --- a/ext/ldap/tests/ldap_get_entries_basic.phpt +++ b/ext/ldap/tests/ldap_get_entries_basic.phpt @@ -14,10 +14,10 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - ldap_get_entries( - $link, - ldap_search($link, "$base", "(o=test)") - ) + ldap_get_entries( + $link, + ldap_search($link, "$base", "(o=test)") + ) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_get_entries_variation.phpt b/ext/ldap/tests/ldap_get_entries_variation.phpt index 767f9dcd08..9dd45b6282 100644 --- a/ext/ldap/tests/ldap_get_entries_variation.phpt +++ b/ext/ldap/tests/ldap_get_entries_variation.phpt @@ -14,10 +14,10 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - ldap_get_entries( - $link, - ldap_search($link, "$base", "(o=my-unexisting-domain)") - ) + ldap_get_entries( + $link, + ldap_search($link, "$base", "(o=my-unexisting-domain)") + ) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_get_option_basic.phpt b/ext/ldap/tests/ldap_get_option_basic.phpt index 9bbaf3e41d..e9aa7cfc4f 100644 --- a/ext/ldap/tests/ldap_get_option_basic.phpt +++ b/ext/ldap/tests/ldap_get_option_basic.phpt @@ -14,8 +14,8 @@ $option = null; ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); var_dump( - ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION, $option), - $option + ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION, $option), + $option ); ?> --EXPECT-- diff --git a/ext/ldap/tests/ldap_get_option_controls.phpt b/ext/ldap/tests/ldap_get_option_controls.phpt index 1a6e18c4c4..813f33e069 100644 --- a/ext/ldap/tests/ldap_get_option_controls.phpt +++ b/ext/ldap/tests/ldap_get_option_controls.phpt @@ -16,46 +16,46 @@ insert_dummy_data($link, $base); function build_ctrl_paged_value($int, $cookie) { - // This is basic and will only work for small values - $hex = ''; - if (!empty($int)) { - $str = sprintf("%'.02x", $int); - $hex .= '02'.sprintf("%'.02x%s", strlen($str)/2, $str); - } - $hex .= '04'.sprintf("%'.02x", strlen($cookie)).bin2hex($cookie); - return hex2bin('30'.sprintf("%'.02x", strlen($hex)/2).$hex); + // This is basic and will only work for small values + $hex = ''; + if (!empty($int)) { + $str = sprintf("%'.02x", $int); + $hex .= '02'.sprintf("%'.02x%s", strlen($str)/2, $str); + } + $hex .= '04'.sprintf("%'.02x", strlen($cookie)).bin2hex($cookie); + return hex2bin('30'.sprintf("%'.02x", strlen($hex)/2).$hex); } $controls_set = array( - array( - 'oid' => LDAP_CONTROL_PAGEDRESULTS, - 'iscritical' => TRUE, - 'value' => build_ctrl_paged_value(1, 'opaque') - ) + array( + 'oid' => LDAP_CONTROL_PAGEDRESULTS, + 'iscritical' => TRUE, + 'value' => build_ctrl_paged_value(1, 'opaque') + ) ); $controls_set2 = array( - array( - 'oid' => LDAP_CONTROL_PAGEDRESULTS, - 'iscritical' => TRUE, - 'value' => array( - 'size' => 1, - 'cookie' => '', - ) - ) + array( + 'oid' => LDAP_CONTROL_PAGEDRESULTS, + 'iscritical' => TRUE, + 'value' => array( + 'size' => 1, + 'cookie' => '', + ) + ) ); var_dump( - bin2hex($controls_set[0]['value']), - ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), - ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set), - ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), - $controls_get, - ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set2), - ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), - $controls_get, - $result = ldap_search($link, $base, "(objectClass=person)", array('cn')), - ldap_get_entries($link, $result)['count'], - ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array()), - ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get) + bin2hex($controls_set[0]['value']), + ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), + ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set), + ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), + $controls_get, + ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set2), + ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), + $controls_get, + $result = ldap_search($link, $base, "(objectClass=person)", array('cn')), + ldap_get_entries($link, $result)['count'], + ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array()), + ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_get_option_variation.phpt b/ext/ldap/tests/ldap_get_option_variation.phpt index 6852af3b3d..80384475b4 100644 --- a/ext/ldap/tests/ldap_get_option_variation.phpt +++ b/ext/ldap/tests/ldap_get_option_variation.phpt @@ -13,8 +13,8 @@ $link = ldap_connect($host, $port); $option = null; $controls = array( - array("oid" => "1.2.752.58.10.1", "iscritical" => true), - array("oid" => "1.2.752.58.1.10", "value" => "magic"), + array("oid" => "1.2.752.58.10.1", "iscritical" => true), + array("oid" => "1.2.752.58.1.10", "value" => "magic"), ); ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER); @@ -28,24 +28,24 @@ ldap_set_option($link, LDAP_OPT_CLIENT_CONTROLS, $controls); ldap_set_option($link, LDAP_OPT_RESTART, false); var_dump( - ldap_get_option($link, LDAP_OPT_DEREF, $option), - $option, - ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option), - $option, - ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option), - $option, - ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option), - $option, - ldap_get_option($link, LDAP_OPT_TIMEOUT, $option), - $option, - ldap_get_option($link, LDAP_OPT_REFERRALS, $option), - $option, - ldap_get_option($link, LDAP_OPT_RESTART, $option), - $option, - ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $option), - $option, - ldap_get_option($link, LDAP_OPT_CLIENT_CONTROLS, $option), - $option + ldap_get_option($link, LDAP_OPT_DEREF, $option), + $option, + ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option), + $option, + ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option), + $option, + ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option), + $option, + ldap_get_option($link, LDAP_OPT_TIMEOUT, $option), + $option, + ldap_get_option($link, LDAP_OPT_REFERRALS, $option), + $option, + ldap_get_option($link, LDAP_OPT_RESTART, $option), + $option, + ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $option), + $option, + ldap_get_option($link, LDAP_OPT_CLIENT_CONTROLS, $option), + $option ); ?> --EXPECT-- diff --git a/ext/ldap/tests/ldap_get_values_len_basic.phpt b/ext/ldap/tests/ldap_get_values_len_basic.phpt index af3fcd60ce..eaf66c0fbc 100644 --- a/ext/ldap/tests/ldap_get_values_len_basic.phpt +++ b/ext/ldap/tests/ldap_get_values_len_basic.phpt @@ -15,7 +15,7 @@ insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(o=test)"); $entry = ldap_first_entry($link, $result); var_dump( - ldap_get_values_len($link, $entry, "o") + ldap_get_values_len($link, $entry, "o") ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_list_basic.phpt b/ext/ldap/tests/ldap_list_basic.phpt index 840183623a..f4d8bda31b 100644 --- a/ext/ldap/tests/ldap_list_basic.phpt +++ b/ext/ldap/tests/ldap_list_basic.phpt @@ -16,8 +16,8 @@ include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - $result = ldap_list($link, "$base", "(objectClass=person)"), - ldap_get_entries($link, $result) + $result = ldap_list($link, "$base", "(objectClass=person)"), + ldap_get_entries($link, $result) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_mod_add_basic.phpt b/ext/ldap/tests/ldap_mod_add_basic.phpt index 631e57ecdd..9096f3eb63 100644 --- a/ext/ldap/tests/ldap_mod_add_basic.phpt +++ b/ext/ldap/tests/ldap_mod_add_basic.phpt @@ -14,15 +14,15 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $entry = array( - "description" => "Domain description", + "description" => "Domain description", ); var_dump( - ldap_mod_add($link, "o=test,$base", $entry), - ldap_get_entries( - $link, - ldap_search($link, "o=test,$base", "(Description=Domain description)") - ) + ldap_mod_add($link, "o=test,$base", $entry), + ldap_get_entries( + $link, + ldap_search($link, "o=test,$base", "(Description=Domain description)") + ) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_mod_add_error.phpt b/ext/ldap/tests/ldap_mod_add_error.phpt index 561f1633f3..7dd26616dc 100644 --- a/ext/ldap/tests/ldap_mod_add_error.phpt +++ b/ext/ldap/tests/ldap_mod_add_error.phpt @@ -19,12 +19,12 @@ var_dump(ldap_mod_add($link, "dc=my-domain,$base", array())); var_dump(ldap_mod_add($link, "weirdAttribute=val", array())); $entry = array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", ); ldap_add($link, "dc=my-domain,$base", $entry); diff --git a/ext/ldap/tests/ldap_mod_del_basic.phpt b/ext/ldap/tests/ldap_mod_del_basic.phpt index fee0c8d4aa..bafc190968 100644 --- a/ext/ldap/tests/ldap_mod_del_basic.phpt +++ b/ext/ldap/tests/ldap_mod_del_basic.phpt @@ -14,15 +14,15 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $entry = array( - "description" => "user A" + "description" => "user A" ); var_dump( - ldap_mod_del($link, "cn=userA,$base", $entry), - ldap_get_entries( - $link, - ldap_search($link, "$base", "(description=user A)") - ) + ldap_mod_del($link, "cn=userA,$base", $entry), + ldap_get_entries( + $link, + ldap_search($link, "$base", "(description=user A)") + ) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_mod_ext.phpt b/ext/ldap/tests/ldap_mod_ext.phpt index f27e05100d..0ca091fed8 100644 --- a/ext/ldap/tests/ldap_mod_ext.phpt +++ b/ext/ldap/tests/ldap_mod_ext.phpt @@ -19,38 +19,38 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $entry = array( - "description" => "Domain description", + "description" => "Domain description", ); var_dump( - $result = ldap_mod_add_ext($link, "o=test,$base", $entry, - [ - ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], - ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], - ] - ), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls, - ldap_get_entries( - $link, - ldap_search($link, "o=test,$base", "(Description=Domain description)") - ), - $result = ldap_mod_del_ext($link, "o=test,$base", $entry, - [ - ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], - ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], - ] - ), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls, - ldap_get_entries( - $link, - ldap_search($link, "o=test,$base", "(Description=Domain description)") - ) + $result = ldap_mod_add_ext($link, "o=test,$base", $entry, + [ + ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], + ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], + ] + ), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls, + ldap_get_entries( + $link, + ldap_search($link, "o=test,$base", "(Description=Domain description)") + ), + $result = ldap_mod_del_ext($link, "o=test,$base", $entry, + [ + ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], + ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], + ] + ), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls, + ldap_get_entries( + $link, + ldap_search($link, "o=test,$base", "(Description=Domain description)") + ) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_mod_replace_basic.phpt b/ext/ldap/tests/ldap_mod_replace_basic.phpt index 6e47158db1..0dd9f2b1ea 100644 --- a/ext/ldap/tests/ldap_mod_replace_basic.phpt +++ b/ext/ldap/tests/ldap_mod_replace_basic.phpt @@ -14,15 +14,15 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $entry = array( - "description" => "user X" + "description" => "user X" ); var_dump( - ldap_mod_replace($link, "cn=userA,$base", $entry), - ldap_get_entries( - $link, - ldap_search($link, "$base", "(description=user X)", array("description")) - ) + ldap_mod_replace($link, "cn=userA,$base", $entry), + ldap_get_entries( + $link, + ldap_search($link, "$base", "(description=user X)", array("description")) + ) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_modify_basic.phpt b/ext/ldap/tests/ldap_modify_basic.phpt index 487ec753a0..2589953147 100644 --- a/ext/ldap/tests/ldap_modify_basic.phpt +++ b/ext/ldap/tests/ldap_modify_basic.phpt @@ -14,19 +14,19 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $entry = array( - "objectClass" => array( - "top", - "organization"), - "o" => "test", - "description" => "Domain description", + "objectClass" => array( + "top", + "organization"), + "o" => "test", + "description" => "Domain description", ); var_dump( - ldap_modify($link, "o=test,$base", $entry), - ldap_get_entries( - $link, - ldap_search($link, "$base", "(Description=Domain description)") - ) + ldap_modify($link, "o=test,$base", $entry), + ldap_get_entries( + $link, + ldap_search($link, "$base", "(Description=Domain description)") + ) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_modify_batch_basic.phpt b/ext/ldap/tests/ldap_modify_batch_basic.phpt index 96fadb44c3..41d7c0f15f 100644 --- a/ext/ldap/tests/ldap_modify_batch_basic.phpt +++ b/ext/ldap/tests/ldap_modify_batch_basic.phpt @@ -14,27 +14,27 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $mods = array( - array( - "attrib" => "telephoneNumber", - "modtype" => LDAP_MODIFY_BATCH_ADD, - "values" => array( - "+1 555 5551717" - ) - ), - array( - "attrib" => "sn", - "modtype" => LDAP_MODIFY_BATCH_REPLACE, - "values" => array("Brown-Smith") - ), - array( - "attrib" => "description", - "modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL - ) + array( + "attrib" => "telephoneNumber", + "modtype" => LDAP_MODIFY_BATCH_ADD, + "values" => array( + "+1 555 5551717" + ) + ), + array( + "attrib" => "sn", + "modtype" => LDAP_MODIFY_BATCH_REPLACE, + "values" => array("Brown-Smith") + ), + array( + "attrib" => "description", + "modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL + ) ); var_dump( - ldap_modify_batch($link, "cn=userA,$base", $mods), - ldap_get_entries($link, ldap_search($link, "$base", "(sn=Brown-Smith)")) + ldap_modify_batch($link, "cn=userA,$base", $mods), + ldap_get_entries($link, ldap_search($link, "$base", "(sn=Brown-Smith)")) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_modify_batch_error.phpt b/ext/ldap/tests/ldap_modify_batch_error.phpt index d18bd6729d..627d116d97 100644 --- a/ext/ldap/tests/ldap_modify_batch_error.phpt +++ b/ext/ldap/tests/ldap_modify_batch_error.phpt @@ -13,11 +13,11 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); $addGivenName = array( - array( - "attrib" => "givenName", - "modtype" => LDAP_MODIFY_BATCH_ADD, - "values" => array("Jack") - ) + array( + "attrib" => "givenName", + "modtype" => LDAP_MODIFY_BATCH_ADD, + "values" => array("Jack") + ) ); // DN not found @@ -28,34 +28,34 @@ var_dump(ldap_modify_batch($link, "weirdAttribute=val", $addGivenName)); // prepare $entry = array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", ); ldap_add($link, "dc=my-domain,$base", $entry); // invalid domain $mods = array( - array( - "attrib" => "dc", - "modtype" => LDAP_MODIFY_BATCH_REPLACE, - "values" => array("Wrong Domain") - ) + array( + "attrib" => "dc", + "modtype" => LDAP_MODIFY_BATCH_REPLACE, + "values" => array("Wrong Domain") + ) ); var_dump(ldap_modify_batch($link, "dc=my-domain,$base", $mods)); // invalid attribute $mods = array( - array( - "attrib" => "weirdAttribute", - "modtype" => LDAP_MODIFY_BATCH_ADD, - "values" => array("weirdVal", "anotherWeirdval") - ) + array( + "attrib" => "weirdAttribute", + "modtype" => LDAP_MODIFY_BATCH_ADD, + "values" => array("weirdVal", "anotherWeirdval") + ) ); var_dump(ldap_modify_batch($link, "dc=my-domain,$base", $mods)); diff --git a/ext/ldap/tests/ldap_modify_error.phpt b/ext/ldap/tests/ldap_modify_error.phpt index b4e29a58c6..682abf7504 100644 --- a/ext/ldap/tests/ldap_modify_error.phpt +++ b/ext/ldap/tests/ldap_modify_error.phpt @@ -19,12 +19,12 @@ var_dump(ldap_modify($link, "cn=not-found,$base", array())); var_dump(ldap_modify($link, "weirdAttribute=val", array())); $entry = array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", ); ldap_add($link, "dc=my-domain,$base", $entry); diff --git a/ext/ldap/tests/ldap_next_attribute_basic.phpt b/ext/ldap/tests/ldap_next_attribute_basic.phpt index d6c753c4a4..4c9584ee0b 100644 --- a/ext/ldap/tests/ldap_next_attribute_basic.phpt +++ b/ext/ldap/tests/ldap_next_attribute_basic.phpt @@ -16,10 +16,10 @@ $result = ldap_search($link, "$base", "(cn=userC)"); $entry = ldap_first_entry($link, $result); $attribute = ldap_first_attribute($link, $entry); var_dump( - ldap_next_attribute($link, $entry), - ldap_next_attribute($link, $entry), - ldap_next_attribute($link, $entry), - ldap_next_attribute($link, $entry) + ldap_next_attribute($link, $entry), + ldap_next_attribute($link, $entry), + ldap_next_attribute($link, $entry), + ldap_next_attribute($link, $entry) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_next_attribute_error.phpt b/ext/ldap/tests/ldap_next_attribute_error.phpt index 94f7cfd475..ffe1222626 100644 --- a/ext/ldap/tests/ldap_next_attribute_error.phpt +++ b/ext/ldap/tests/ldap_next_attribute_error.phpt @@ -15,7 +15,7 @@ insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(objectclass=organization)"); $entry = ldap_first_entry($link, $result); var_dump( - ldap_next_attribute($link, $entry) + ldap_next_attribute($link, $entry) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_next_entry_basic.phpt b/ext/ldap/tests/ldap_next_entry_basic.phpt index 9a7cc456b1..d8f03ce291 100644 --- a/ext/ldap/tests/ldap_next_entry_basic.phpt +++ b/ext/ldap/tests/ldap_next_entry_basic.phpt @@ -15,9 +15,9 @@ insert_dummy_data($link, $base); $result = ldap_list($link, "$base", "(objectClass=person)"); $entry = ldap_first_entry($link, $result); var_dump( - $entry = ldap_next_entry($link, $entry), - ldap_get_values($link, $entry, 'sn'), - $entry = ldap_next_entry($link, $entry) + $entry = ldap_next_entry($link, $entry), + ldap_get_values($link, $entry, 'sn'), + $entry = ldap_next_entry($link, $entry) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_parse_reference_basic.phpt b/ext/ldap/tests/ldap_parse_reference_basic.phpt index 27b43cc084..d5aeef8a59 100644 --- a/ext/ldap/tests/ldap_parse_reference_basic.phpt +++ b/ext/ldap/tests/ldap_parse_reference_basic.phpt @@ -21,8 +21,8 @@ $result = ldap_search($link, "$base", "(cn=*)"); $ref = ldap_first_reference($link, $result); $refs = null; var_dump( - ldap_parse_reference($link, $ref, $refs), - $refs + ldap_parse_reference($link, $ref, $refs), + $refs ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_parse_result_basic.phpt b/ext/ldap/tests/ldap_parse_result_basic.phpt index c9bdc6cbca..ed7047164b 100644 --- a/ext/ldap/tests/ldap_parse_result_basic.phpt +++ b/ext/ldap/tests/ldap_parse_result_basic.phpt @@ -20,8 +20,8 @@ ldap_add($link, "cn=userref,$base", array( $result = ldap_search($link, "cn=userref,$base", "(cn=user*)"); $errcode = $dn = $errmsg = $refs = null; var_dump( - ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs), - $errcode, $dn, $errmsg, $refs + ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs), + $errcode, $dn, $errmsg, $refs ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_parse_result_controls.phpt b/ext/ldap/tests/ldap_parse_result_controls.phpt index 76dc2fcb15..63ef9e69d7 100644 --- a/ext/ldap/tests/ldap_parse_result_controls.phpt +++ b/ext/ldap/tests/ldap_parse_result_controls.phpt @@ -19,13 +19,13 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(cn=user*)"; var_dump( - ldap_control_paged_result($link, 1), - $result = ldap_search($link, $dn, $filter, array('cn')), - ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs, $ctrls), - $ctrls[LDAP_CONTROL_PAGEDRESULTS]['oid'], - $ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['size'], - bin2hex($ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']), - ldap_get_entries($link, $result)['count'] + ldap_control_paged_result($link, 1), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs, $ctrls), + $ctrls[LDAP_CONTROL_PAGEDRESULTS]['oid'], + $ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['size'], + bin2hex($ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']), + ldap_get_entries($link, $result)['count'] ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_read_basic.phpt b/ext/ldap/tests/ldap_read_basic.phpt index 75d3693bce..596c02a71e 100644 --- a/ext/ldap/tests/ldap_read_basic.phpt +++ b/ext/ldap/tests/ldap_read_basic.phpt @@ -16,8 +16,8 @@ include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - $result = ldap_read($link, "o=test,$base", "(o=*)"), - ldap_get_entries($link, $result) + $result = ldap_read($link, "o=test,$base", "(o=*)"), + ldap_get_entries($link, $result) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_rename_basic.phpt b/ext/ldap/tests/ldap_rename_basic.phpt index c083b7a03f..f985630ac6 100644 --- a/ext/ldap/tests/ldap_rename_basic.phpt +++ b/ext/ldap/tests/ldap_rename_basic.phpt @@ -13,7 +13,7 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - ldap_rename($link, "cn=userA,$base", "cn=userZ", "$base", true) + ldap_rename($link, "cn=userA,$base", "cn=userZ", "$base", true) ); $result = ldap_search($link, "$base", "(cn=userA)", array("cn", "sn")); $result = ldap_search($link, "$base", "(cn=userZ)", array("cn", "sn")); diff --git a/ext/ldap/tests/ldap_rename_ext.phpt b/ext/ldap/tests/ldap_rename_ext.phpt index 009a7f32c5..e4f7d8364e 100644 --- a/ext/ldap/tests/ldap_rename_ext.phpt +++ b/ext/ldap/tests/ldap_rename_ext.phpt @@ -18,19 +18,19 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - $result = ldap_rename_ext($link, "cn=userA,$base", "cn=userZ", "$base", TRUE, - [ - ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]], - ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]] - ] - ), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls[LDAP_CONTROL_PRE_READ], - $ctrls[LDAP_CONTROL_POST_READ], - ldap_count_entries($link, ldap_search($link, "$base", "(cn=userA)", array("cn"))), - ldap_count_entries($link, ldap_search($link, "$base", "(cn=userZ)", array("cn"))) + $result = ldap_rename_ext($link, "cn=userA,$base", "cn=userZ", "$base", TRUE, + [ + ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]], + ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]] + ] + ), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls[LDAP_CONTROL_PRE_READ], + $ctrls[LDAP_CONTROL_POST_READ], + ldap_count_entries($link, ldap_search($link, "$base", "(cn=userA)", array("cn"))), + ldap_count_entries($link, ldap_search($link, "$base", "(cn=userZ)", array("cn"))) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_search_basic.phpt b/ext/ldap/tests/ldap_search_basic.phpt index 8c77a63e8a..f7ed449c16 100644 --- a/ext/ldap/tests/ldap_search_basic.phpt +++ b/ext/ldap/tests/ldap_search_basic.phpt @@ -17,8 +17,8 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - $result = ldap_search($link, "$base", "(objectClass=person)"), - ldap_get_entries($link, $result) + $result = ldap_search($link, "$base", "(objectClass=person)"), + ldap_get_entries($link, $result) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_search_overrides.phpt b/ext/ldap/tests/ldap_search_overrides.phpt index e2d51079f4..5bd351a741 100644 --- a/ext/ldap/tests/ldap_search_overrides.phpt +++ b/ext/ldap/tests/ldap_search_overrides.phpt @@ -20,18 +20,18 @@ ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44); insert_dummy_data($link, $base); var_dump( - $result = ldap_search($link, "$base", "(objectClass=person)", array(), null, 111, 22, LDAP_DEREF_NEVER), - ldap_get_entries($link, $result) + $result = ldap_search($link, "$base", "(objectClass=person)", array(), null, 111, 22, LDAP_DEREF_NEVER), + ldap_get_entries($link, $result) ); var_dump( - ldap_get_option($link, LDAP_OPT_DEREF, $option), - $option, - ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option), - $option, - ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option), - $option, - ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option), - $option + ldap_get_option($link, LDAP_OPT_DEREF, $option), + $option, + ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option), + $option, + ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option), + $option, + ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option), + $option ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_search_paged_result_controls.phpt b/ext/ldap/tests/ldap_search_paged_result_controls.phpt index 04825a9ecd..f60acd3e0c 100644 --- a/ext/ldap/tests/ldap_search_paged_result_controls.phpt +++ b/ext/ldap/tests/ldap_search_paged_result_controls.phpt @@ -19,13 +19,13 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(cn=user*)"; var_dump( - $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, - [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 2]]]), - ldap_get_entries($link, $result), - ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), - $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, - [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 20, 'cookie' => $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']]]]), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 2]]]), + ldap_get_entries($link, $result), + ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), + $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 20, 'cookie' => $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']]]]), + ldap_get_entries($link, $result) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_search_sort_controls.phpt b/ext/ldap/tests/ldap_search_sort_controls.phpt index b7533e54f7..f55faf4930 100644 --- a/ext/ldap/tests/ldap_search_sort_controls.phpt +++ b/ext/ldap/tests/ldap_search_sort_controls.phpt @@ -19,55 +19,55 @@ insert_dummy_data($link, $base); /* First test with only SORT control */ var_dump( - $result = ldap_search($link, $base, '(cn=*)', array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, - [ - [ - 'oid' => LDAP_CONTROL_SORTREQUEST, - 'iscritical' => TRUE, - 'value' => [ - ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE] - ] - ] - ] - ), - ldap_get_entries($link, $result), - ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), - $errcode, - $errmsg, - $controls + $result = ldap_search($link, $base, '(cn=*)', array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, + [ + [ + 'oid' => LDAP_CONTROL_SORTREQUEST, + 'iscritical' => TRUE, + 'value' => [ + ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE] + ] + ] + ] + ), + ldap_get_entries($link, $result), + ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), + $errcode, + $errmsg, + $controls ); /* Then with VLV control */ var_dump( - $result = ldap_search($link, $base, '(cn=*)', array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, - [ - [ - 'oid' => LDAP_CONTROL_SORTREQUEST, - 'iscritical' => TRUE, - 'value' => [ - ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE] - ] - ], - [ - 'oid' => LDAP_CONTROL_VLVREQUEST, - 'iscritical' => TRUE, - 'value' => [ - 'before' => 0, // Return 0 entry before target - 'after' => 1, // Return 1 entry after target - 'offset' => 2, // Target entry is the second one - 'count' => 0, // We have no idea how many entries there are - ] - ] - ] - ), - ldap_get_entries($link, $result), - ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), - array_keys($controls), - $controls[LDAP_CONTROL_SORTRESPONSE], - $controls[LDAP_CONTROL_VLVRESPONSE]['value']['target'], - $controls[LDAP_CONTROL_VLVRESPONSE]['value']['count'], - $controls[LDAP_CONTROL_VLVRESPONSE]['value']['errcode'], - bin2hex($controls[LDAP_CONTROL_VLVRESPONSE]['value']['context']) + $result = ldap_search($link, $base, '(cn=*)', array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, + [ + [ + 'oid' => LDAP_CONTROL_SORTREQUEST, + 'iscritical' => TRUE, + 'value' => [ + ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE] + ] + ], + [ + 'oid' => LDAP_CONTROL_VLVREQUEST, + 'iscritical' => TRUE, + 'value' => [ + 'before' => 0, // Return 0 entry before target + 'after' => 1, // Return 1 entry after target + 'offset' => 2, // Target entry is the second one + 'count' => 0, // We have no idea how many entries there are + ] + ] + ] + ), + ldap_get_entries($link, $result), + ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), + array_keys($controls), + $controls[LDAP_CONTROL_SORTRESPONSE], + $controls[LDAP_CONTROL_VLVRESPONSE]['value']['target'], + $controls[LDAP_CONTROL_VLVRESPONSE]['value']['count'], + $controls[LDAP_CONTROL_VLVRESPONSE]['value']['errcode'], + bin2hex($controls[LDAP_CONTROL_VLVRESPONSE]['value']['context']) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_search_variation1.phpt b/ext/ldap/tests/ldap_search_variation1.phpt index 5fa30b4c7a..88eb79aa77 100644 --- a/ext/ldap/tests/ldap_search_variation1.phpt +++ b/ext/ldap/tests/ldap_search_variation1.phpt @@ -19,8 +19,8 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(dc=*)"; var_dump( - $result = ldap_search($link, "o=test,$base", "(o=*)", array('o')), - ldap_get_entries($link, $result) + $result = ldap_search($link, "o=test,$base", "(o=*)", array('o')), + ldap_get_entries($link, $result) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_search_variation2.phpt b/ext/ldap/tests/ldap_search_variation2.phpt index c06afbaac0..8b130aaa08 100644 --- a/ext/ldap/tests/ldap_search_variation2.phpt +++ b/ext/ldap/tests/ldap_search_variation2.phpt @@ -17,8 +17,8 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - $result = ldap_search($link, "$base", "(objectclass=person)", array('sn'), 1), - ldap_get_entries($link, $result) + $result = ldap_search($link, "$base", "(objectclass=person)", array('sn'), 1), + ldap_get_entries($link, $result) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_search_variation3.phpt b/ext/ldap/tests/ldap_search_variation3.phpt index 2a07654e4f..d0b6ec5cad 100644 --- a/ext/ldap/tests/ldap_search_variation3.phpt +++ b/ext/ldap/tests/ldap_search_variation3.phpt @@ -19,13 +19,13 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(objectclass=person)"; var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 3), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 3), + ldap_get_entries($link, $result) ); var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1), + ldap_get_entries($link, $result) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_search_variation4.phpt b/ext/ldap/tests/ldap_search_variation4.phpt index 298777263e..694840b397 100644 --- a/ext/ldap/tests/ldap_search_variation4.phpt +++ b/ext/ldap/tests/ldap_search_variation4.phpt @@ -19,8 +19,8 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(objectclass=person)"; var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3), + ldap_get_entries($link, $result) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_search_variation5.phpt b/ext/ldap/tests/ldap_search_variation5.phpt index e6ac54e21d..211df9a128 100644 --- a/ext/ldap/tests/ldap_search_variation5.phpt +++ b/ext/ldap/tests/ldap_search_variation5.phpt @@ -19,16 +19,16 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(objectclass=person)"; var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_SEARCHING), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_SEARCHING), + ldap_get_entries($link, $result) ); var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_FINDING), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_FINDING), + ldap_get_entries($link, $result) ); var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_ALWAYS), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_ALWAYS), + ldap_get_entries($link, $result) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_search_variation6.phpt b/ext/ldap/tests/ldap_search_variation6.phpt index 5938041367..6451c2930b 100644 --- a/ext/ldap/tests/ldap_search_variation6.phpt +++ b/ext/ldap/tests/ldap_search_variation6.phpt @@ -20,19 +20,19 @@ $dn = "$base"; $filter = "(objectclass=person)"; var_dump( - $result = ldap_search(array($link, $link), $dn, $filter), - $result0 = ldap_get_entries($link, $result[0]), - ldap_get_entries($link, $result[1]) === $result0 + $result = ldap_search(array($link, $link), $dn, $filter), + $result0 = ldap_get_entries($link, $result[0]), + ldap_get_entries($link, $result[1]) === $result0 ); var_dump( - $result = ldap_search(array($link, $link), "", $filter), - ldap_get_entries($link, $result[0]), - ldap_get_entries($link, $result[1]) + $result = ldap_search(array($link, $link), "", $filter), + ldap_get_entries($link, $result[0]), + ldap_get_entries($link, $result[1]) ); var_dump( - $result = ldap_search(array($link, $link), "", array($filter, $filter)), - ldap_get_entries($link, $result[0]), - ldap_get_entries($link, $result[1]) + $result = ldap_search(array($link, $link), "", array($filter, $filter)), + ldap_get_entries($link, $result[0]), + ldap_get_entries($link, $result[1]) ); ?> --CLEAN-- diff --git a/ext/ldap/tests/ldap_set_option_cafiles_basic.phpt b/ext/ldap/tests/ldap_set_option_cafiles_basic.phpt index 492df3bc8b..945216d1c0 100644 --- a/ext/ldap/tests/ldap_set_option_cafiles_basic.phpt +++ b/ext/ldap/tests/ldap_set_option_cafiles_basic.phpt @@ -10,18 +10,18 @@ require "connect.inc"; $link = ldap_connect($host, $port); foreach([ - LDAP_OPT_X_TLS_CACERTDIR, - LDAP_OPT_X_TLS_CACERTFILE, - LDAP_OPT_X_TLS_CERTFILE, - LDAP_OPT_X_TLS_KEYFILE, - LDAP_OPT_X_TLS_CRLFILE, - LDAP_OPT_X_TLS_DHFILE, + LDAP_OPT_X_TLS_CACERTDIR, + LDAP_OPT_X_TLS_CACERTFILE, + LDAP_OPT_X_TLS_CERTFILE, + LDAP_OPT_X_TLS_KEYFILE, + LDAP_OPT_X_TLS_CRLFILE, + LDAP_OPT_X_TLS_DHFILE, ] as $option) { - $result = ldap_set_option($link, $option, '/foo/bar'); - var_dump($result); + $result = ldap_set_option($link, $option, '/foo/bar'); + var_dump($result); - ldap_get_option($link, $option, $optionval); - var_dump($optionval); + ldap_get_option($link, $option, $optionval); + var_dump($optionval); } ?> --EXPECT-- diff --git a/ext/ldap/tests/ldap_set_option_crlcheck_basic.phpt b/ext/ldap/tests/ldap_set_option_crlcheck_basic.phpt index f8e3c8cf40..eff51c785e 100644 --- a/ext/ldap/tests/ldap_set_option_crlcheck_basic.phpt +++ b/ext/ldap/tests/ldap_set_option_crlcheck_basic.phpt @@ -18,15 +18,15 @@ require "connect.inc"; $link = ldap_connect($host, $port); foreach([ - LDAP_OPT_X_TLS_CRL_NONE, - LDAP_OPT_X_TLS_CRL_PEER, - LDAP_OPT_X_TLS_CRL_ALL, + LDAP_OPT_X_TLS_CRL_NONE, + LDAP_OPT_X_TLS_CRL_PEER, + LDAP_OPT_X_TLS_CRL_ALL, ] as $option) { - $result = ldap_set_option($link, LDAP_OPT_X_TLS_CRLCHECK, $option); - var_dump($result); + $result = ldap_set_option($link, LDAP_OPT_X_TLS_CRLCHECK, $option); + var_dump($result); - ldap_get_option($link, LDAP_OPT_X_TLS_CRLCHECK, $optionval); - var_dump($optionval); + ldap_get_option($link, LDAP_OPT_X_TLS_CRLCHECK, $optionval); + var_dump($optionval); } ?> --EXPECT-- diff --git a/ext/ldap/tests/ldap_set_option_error.phpt b/ext/ldap/tests/ldap_set_option_error.phpt index e7ef6bac6b..079c63577d 100644 --- a/ext/ldap/tests/ldap_set_option_error.phpt +++ b/ext/ldap/tests/ldap_set_option_error.phpt @@ -11,22 +11,22 @@ require "connect.inc"; $link = ldap_connect($host, $port); $controls = array( - array( - array("xid" => "1.2.752.58.10.1", "iscritical" => true), - array("xid" => "1.2.752.58.1.10", "value" => "magic"), - ), - array( - array("oid" => "1.2.752.58.10.1", "iscritical" => true), - array("oid" => "1.2.752.58.1.10", "value" => "magic"), - "weird" - ), - "notanarray" + array( + array("xid" => "1.2.752.58.10.1", "iscritical" => true), + array("xid" => "1.2.752.58.1.10", "value" => "magic"), + ), + array( + array("oid" => "1.2.752.58.10.1", "iscritical" => true), + array("oid" => "1.2.752.58.1.10", "value" => "magic"), + "weird" + ), + "notanarray" ); var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 10)); foreach ($controls as $control) - var_dump(ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $control)); + var_dump(ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $control)); var_dump(ldap_set_option($link, 999999, 999999)); ?> diff --git a/ext/ldap/tests/ldap_set_option_keepalive_basic.phpt b/ext/ldap/tests/ldap_set_option_keepalive_basic.phpt index 865345dc4d..f00e885ebe 100644 --- a/ext/ldap/tests/ldap_set_option_keepalive_basic.phpt +++ b/ext/ldap/tests/ldap_set_option_keepalive_basic.phpt @@ -10,15 +10,15 @@ require "connect.inc"; $link = ldap_connect($host, $port); foreach([ - LDAP_OPT_X_KEEPALIVE_IDLE, - LDAP_OPT_X_KEEPALIVE_PROBES, - LDAP_OPT_X_KEEPALIVE_INTERVAL, + LDAP_OPT_X_KEEPALIVE_IDLE, + LDAP_OPT_X_KEEPALIVE_PROBES, + LDAP_OPT_X_KEEPALIVE_INTERVAL, ] as $option) { - $result = ldap_set_option($link, $option, 5); - var_dump($result); + $result = ldap_set_option($link, $option, 5); + var_dump($result); - ldap_get_option($link, $option, $optionval); - var_dump($optionval); + ldap_get_option($link, $option, $optionval); + var_dump($optionval); } ?> --EXPECT-- diff --git a/ext/ldap/tests/ldap_set_option_reqcert_basic.phpt b/ext/ldap/tests/ldap_set_option_reqcert_basic.phpt index 220bb2ff31..d087dbf88c 100644 --- a/ext/ldap/tests/ldap_set_option_reqcert_basic.phpt +++ b/ext/ldap/tests/ldap_set_option_reqcert_basic.phpt @@ -10,17 +10,17 @@ require "connect.inc"; $link = ldap_connect($host, $port); foreach([ - LDAP_OPT_X_TLS_NEVER, - LDAP_OPT_X_TLS_HARD, - LDAP_OPT_X_TLS_DEMAND, - LDAP_OPT_X_TLS_ALLOW, - LDAP_OPT_X_TLS_TRY, + LDAP_OPT_X_TLS_NEVER, + LDAP_OPT_X_TLS_HARD, + LDAP_OPT_X_TLS_DEMAND, + LDAP_OPT_X_TLS_ALLOW, + LDAP_OPT_X_TLS_TRY, ] as $option) { - $result = ldap_set_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $option); - var_dump($result); + $result = ldap_set_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $option); + var_dump($result); - ldap_get_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $optionval); - var_dump($optionval); + ldap_get_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $optionval); + var_dump($optionval); } ?> --EXPECT-- diff --git a/ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt b/ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt index 796cb8c7e1..782ea24992 100644 --- a/ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt +++ b/ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt @@ -10,17 +10,17 @@ require "connect.inc"; $link = ldap_connect($host, $port); foreach([ - LDAP_OPT_X_TLS_PROTOCOL_SSL2, - LDAP_OPT_X_TLS_PROTOCOL_SSL3, - LDAP_OPT_X_TLS_PROTOCOL_TLS1_0, - LDAP_OPT_X_TLS_PROTOCOL_TLS1_1, - LDAP_OPT_X_TLS_PROTOCOL_TLS1_2, + LDAP_OPT_X_TLS_PROTOCOL_SSL2, + LDAP_OPT_X_TLS_PROTOCOL_SSL3, + LDAP_OPT_X_TLS_PROTOCOL_TLS1_0, + LDAP_OPT_X_TLS_PROTOCOL_TLS1_1, + LDAP_OPT_X_TLS_PROTOCOL_TLS1_2, ] as $option) { - $result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $option); - var_dump($result); + $result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $option); + var_dump($result); - ldap_get_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $optionval); - var_dump($optionval); + ldap_get_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $optionval); + var_dump($optionval); } ?> --EXPECT-- diff --git a/ext/ldap/tests/ldap_set_option_variation.phpt b/ext/ldap/tests/ldap_set_option_variation.phpt index f31473ef7a..4f1e8626d7 100644 --- a/ext/ldap/tests/ldap_set_option_variation.phpt +++ b/ext/ldap/tests/ldap_set_option_variation.phpt @@ -13,50 +13,50 @@ $link = ldap_connect($host, $port); $option = null; $controls = array( - array("oid" => "1.2.752.58.10.1", "iscritical" => true), - array("oid" => "1.2.752.58.1.10", "value" => "magic"), + array("oid" => "1.2.752.58.10.1", "iscritical" => true), + array("oid" => "1.2.752.58.1.10", "value" => "magic"), ); var_dump(ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS)); ldap_get_option($link, LDAP_OPT_DEREF, $option); var_dump( - $option === LDAP_DEREF_ALWAYS, - ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123) + $option === LDAP_DEREF_ALWAYS, + ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123) ); ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option); var_dump( - $option, - ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33) + $option, + ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33) ); ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option); var_dump( - $option, - ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44) + $option, + ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44) ); ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option); var_dump( - $option, - ldap_set_option($link, LDAP_OPT_REFERRALS, true) + $option, + ldap_set_option($link, LDAP_OPT_REFERRALS, true) ); ldap_get_option($link, LDAP_OPT_REFERRALS, $option); var_dump( - (bool) $option, - ldap_set_option($link, LDAP_OPT_RESTART, false) + (bool) $option, + ldap_set_option($link, LDAP_OPT_RESTART, false) ); ldap_get_option($link, LDAP_OPT_RESTART, $option); var_dump( - (bool) $option, - ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls) + (bool) $option, + ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls) ); ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $option); var_dump( - $option, - ldap_set_option($link, LDAP_OPT_CLIENT_CONTROLS, $controls) + $option, + ldap_set_option($link, LDAP_OPT_CLIENT_CONTROLS, $controls) ); ldap_get_option($link, LDAP_OPT_CLIENT_CONTROLS, $option); var_dump( - $option, - ldap_set_option($link, LDAP_OPT_MATCHED_DN, "dc=test,dc=com") + $option, + ldap_set_option($link, LDAP_OPT_MATCHED_DN, "dc=test,dc=com") ); ldap_get_option($link, LDAP_OPT_MATCHED_DN, $option); var_dump($option); diff --git a/ext/ldap/tests/ldap_unbind_variation.phpt b/ext/ldap/tests/ldap_unbind_variation.phpt index 3233e90b6f..0c933543eb 100644 --- a/ext/ldap/tests/ldap_unbind_variation.phpt +++ b/ext/ldap/tests/ldap_unbind_variation.phpt @@ -11,16 +11,16 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; function rebind_proc ($ds, $ldap_url) { - global $user; - global $passwd; - global $protocol_version; + global $user; + global $passwd; + global $protocol_version; - // required by most modern LDAP servers, use LDAPv3 - ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); + // required by most modern LDAP servers, use LDAPv3 + ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); - if (!ldap_bind($a, $user, $passwd)) { - print "Cannot bind"; - } + if (!ldap_bind($a, $user, $passwd)) { + print "Cannot bind"; + } } $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); diff --git a/ext/ldap/tests/skipif.inc b/ext/ldap/tests/skipif.inc index d3494284b0..dc016787da 100644 --- a/ext/ldap/tests/skipif.inc +++ b/ext/ldap/tests/skipif.inc @@ -1,5 +1,5 @@ <?php if (!extension_loaded('ldap')){ - die('skip ldap extension not available'); + die('skip ldap extension not available'); } ?> diff --git a/ext/ldap/tests/skipifbindfailure.inc b/ext/ldap/tests/skipifbindfailure.inc index f79bb9d690..8f66c6cb96 100644 --- a/ext/ldap/tests/skipifbindfailure.inc +++ b/ext/ldap/tests/skipifbindfailure.inc @@ -3,11 +3,11 @@ require_once 'connect.inc'; if ($skip_on_bind_failure) { - $link = ldap_connect($host, $port); - ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); - if (!@ldap_bind($link, $user, $passwd)) - die(sprintf("skip Can't bind to LDAP Server - [%d] %s", ldap_errno($link), ldap_error($link))); + $link = ldap_connect($host, $port); + ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); + if (!@ldap_bind($link, $user, $passwd)) + die(sprintf("skip Can't bind to LDAP Server - [%d] %s", ldap_errno($link), ldap_error($link))); - ldap_unbind($link); + ldap_unbind($link); } ?> diff --git a/ext/ldap/tests/skipifcontrol.inc b/ext/ldap/tests/skipifcontrol.inc index ae551d6add..ff690068ae 100644 --- a/ext/ldap/tests/skipifcontrol.inc +++ b/ext/ldap/tests/skipifcontrol.inc @@ -3,11 +3,11 @@ require_once 'connect.inc'; function skipifunsupportedcontrol($oid) { - global $host, $port, $user, $passwd, $protocol_version, $base; - $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); - $result = ldap_read($link, '', '(objectClass=*)', ['supportedControl']); - if (!in_array($oid, ldap_get_entries($link, $result)[0]['supportedcontrol'])) { - die(sprintf("skip Unsupported control %s", $oid)); - } + global $host, $port, $user, $passwd, $protocol_version, $base; + $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); + $result = ldap_read($link, '', '(objectClass=*)', ['supportedControl']); + if (!in_array($oid, ldap_get_entries($link, $result)[0]['supportedcontrol'])) { + die(sprintf("skip Unsupported control %s", $oid)); + } } ?> diff --git a/ext/libxml/tests/002.phpt b/ext/libxml/tests/002.phpt index 75011462f3..f88753d977 100644 --- a/ext/libxml/tests/002.phpt +++ b/ext/libxml/tests/002.phpt @@ -20,40 +20,40 @@ $doc = simplexml_load_string($xmlstr); $xml = explode("\n", $xmlstr); if (!$doc) { - $errors = libxml_get_errors(); + $errors = libxml_get_errors(); - foreach ($errors as $error) { - echo display_xml_error($error, $xml); - } + foreach ($errors as $error) { + echo display_xml_error($error, $xml); + } - var_dump(libxml_get_last_error()); + var_dump(libxml_get_last_error()); } function display_xml_error($error, $xml) { - $return = $xml[$error->line - 1] . "\n"; - $return .= str_repeat('-', $error->column) . "^\n"; - - switch ($error->level) { - case LIBXML_ERR_WARNING: - $return .= "Warning $error->code: "; - break; - case LIBXML_ERR_ERROR: - $return .= "Error $error->code: "; - break; - case LIBXML_ERR_FATAL: - $return .= "Fatal Error $error->code: "; - break; - } - - $return .= trim($error->message) . "\n Line: $error->line" . "\n Column: $error->column"; - - if ($error->file) { - $return .= "\n File: $error->file"; - } - - return "$return\n\n--------------------------------------------\n\n"; + $return = $xml[$error->line - 1] . "\n"; + $return .= str_repeat('-', $error->column) . "^\n"; + + switch ($error->level) { + case LIBXML_ERR_WARNING: + $return .= "Warning $error->code: "; + break; + case LIBXML_ERR_ERROR: + $return .= "Error $error->code: "; + break; + case LIBXML_ERR_FATAL: + $return .= "Fatal Error $error->code: "; + break; + } + + $return .= trim($error->message) . "\n Line: $error->line" . "\n Column: $error->column"; + + if ($error->file) { + $return .= "\n File: $error->file"; + } + + return "$return\n\n--------------------------------------------\n\n"; } diff --git a/ext/libxml/tests/004.phpt b/ext/libxml/tests/004.phpt index da96faad57..e3daa41d24 100644 --- a/ext/libxml/tests/004.phpt +++ b/ext/libxml/tests/004.phpt @@ -6,22 +6,22 @@ libxml_set_streams_context() <?php $ctxs = array( - NULL, - 'bogus', - 123, - new stdclass, - array('a'), - stream_context_create(), + NULL, + 'bogus', + 123, + new stdclass, + array('a'), + stream_context_create(), ); foreach ($ctxs as $ctx) { - try { + try { var_dump(libxml_set_streams_context($ctx)); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } - $dom = new DOMDocument(); - var_dump($dom->load(__DIR__.'/test.xml')); + $dom = new DOMDocument(); + var_dump($dom->load(__DIR__.'/test.xml')); } echo "Done\n"; diff --git a/ext/libxml/tests/bug42112.phpt b/ext/libxml/tests/bug42112.phpt index a1b8871342..6ca95f6e06 100644 --- a/ext/libxml/tests/bug42112.phpt +++ b/ext/libxml/tests/bug42112.phpt @@ -21,7 +21,7 @@ remove_node($doc); $node = $doc->getElementById( 'id1' ); if ($node) { - print 'Found Node: '.$node->nodeName."\n"; + print 'Found Node: '.$node->nodeName."\n"; } $root = $doc->documentElement; print 'Root Node: '.$root->nodeName."\n"; diff --git a/ext/libxml/tests/bug54440.phpt b/ext/libxml/tests/bug54440.phpt index 4074ff9fe8..a4d5ed4880 100644 --- a/ext/libxml/tests/bug54440.phpt +++ b/ext/libxml/tests/bug54440.phpt @@ -9,9 +9,9 @@ class TestWrapper { function stream_open($path, $mode, $options, &$opened_path) { - if ($this->context) - print_r(stream_context_get_options($this->context)); - return false; + if ($this->context) + print_r(stream_context_get_options($this->context)); + return false; } function url_stat($path, $flags) diff --git a/ext/libxml/tests/bug61367-read.phpt b/ext/libxml/tests/bug61367-read.phpt index f82ecf138a..97b6513094 100644 --- a/ext/libxml/tests/bug61367-read.phpt +++ b/ext/libxml/tests/bug61367-read.phpt @@ -10,25 +10,25 @@ open_basedir=. * Note: Using error_reporting=E_ALL & ~E_NOTICE to suppress "Trying to get property of non-object" notices. */ class StreamExploiter { - public function stream_close ( ) { - $doc = new DOMDocument; - $doc->resolveExternals = true; - $doc->substituteEntities = true; - $dir = htmlspecialchars(dirname(getcwd())); - $dir = str_replace('\\', '/', $dir); // fix for windows - $doc->loadXML( <<<XML + public function stream_close ( ) { + $doc = new DOMDocument; + $doc->resolveExternals = true; + $doc->substituteEntities = true; + $dir = htmlspecialchars(dirname(getcwd())); + $dir = str_replace('\\', '/', $dir); // fix for windows + $doc->loadXML( <<<XML <!DOCTYPE doc [ - <!ENTITY file SYSTEM "file:///$dir/bad"> + <!ENTITY file SYSTEM "file:///$dir/bad"> ]> <doc>&file;</doc> XML - ); - print $doc->documentElement->firstChild->nodeValue; - } + ); + print $doc->documentElement->firstChild->nodeValue; + } - public function stream_open ( $path , $mode , $options , &$opened_path ) { - return true; - } + public function stream_open ( $path , $mode , $options , &$opened_path ) { + return true; + } } var_dump(mkdir('test_bug_61367-read')); diff --git a/ext/libxml/tests/bug61367-write.phpt b/ext/libxml/tests/bug61367-write.phpt index 16951ec825..f84de1076b 100644 --- a/ext/libxml/tests/bug61367-write.phpt +++ b/ext/libxml/tests/bug61367-write.phpt @@ -8,15 +8,15 @@ open_basedir=. <?php class StreamExploiter { - public function stream_close ( ) { - $doc = new DOMDocument; - $doc->appendChild($doc->createTextNode('hello')); - var_dump($doc->save(dirname(getcwd()) . '/bad')); - } + public function stream_close ( ) { + $doc = new DOMDocument; + $doc->appendChild($doc->createTextNode('hello')); + var_dump($doc->save(dirname(getcwd()) . '/bad')); + } - public function stream_open ( $path , $mode , $options , &$opened_path ) { - return true; - } + public function stream_open ( $path , $mode , $options , &$opened_path ) { + return true; + } } var_dump(mkdir('test_bug_61367-write')); diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt index b530276016..b8b7b7f796 100644 --- a/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt +++ b/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt @@ -14,15 +14,15 @@ $dtd = <<<DTD DTD; libxml_set_external_entity_loader( - function ($public, $system, $context) use($dtd){ - var_dump($public); - var_dump($system); - var_dump($context); - $f = fopen("php://temp", "r+"); - fwrite($f, $dtd); - rewind($f); - return $f; - } + function ($public, $system, $context) use($dtd){ + var_dump($public); + var_dump($system); + var_dump($context); + $f = fopen("php://temp", "r+"); + fwrite($f, $dtd); + rewind($f); + return $f; + } ); $dd = new DOMDocument; diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt index f47d7e948f..ea0764f980 100644 --- a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt +++ b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt @@ -14,9 +14,9 @@ $r = $dd->loadXML($xml); var_dump(libxml_set_external_entity_loader(function($a, $b, $c, $d) {})); try { - var_dump($dd->validate()); + var_dump($dd->validate()); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "Done.\n"; diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt index 02f984f9bc..61c82d3275 100644 --- a/ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt +++ b/ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt @@ -23,17 +23,17 @@ $entity = <<<ENT ENT; libxml_set_external_entity_loader( - function ($public, $system, $context) use($dtd,$entity){ - static $first = true; - var_dump($public); - var_dump($system); - var_dump($context); - $f = fopen("php://temp", "r+"); - fwrite($f, $first ? $dtd : $entity); - $first = false; - rewind($f); - return $f; - } + function ($public, $system, $context) use($dtd,$entity){ + static $first = true; + var_dump($public); + var_dump($system); + var_dump($context); + $f = fopen("php://temp", "r+"); + fwrite($f, $first ? $dtd : $entity); + $first = false; + rewind($f); + return $f; + } ); $dd = new DOMDocument; diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt index 8b909c1567..122ec5c09d 100644 --- a/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt +++ b/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt @@ -19,10 +19,10 @@ DTD; libxml_set_external_entity_loader( - function ($public, $system, $context) { - var_dump($public,$system); - return null; - } + function ($public, $system, $context) { + var_dump($public,$system); + return null; + } ); $dd = new DOMDocument; diff --git a/ext/mbstring/tests/bug28220.phpt b/ext/mbstring/tests/bug28220.phpt index 527fdc6fe3..6845dc3ed9 100644 --- a/ext/mbstring/tests/bug28220.phpt +++ b/ext/mbstring/tests/bug28220.phpt @@ -5,19 +5,19 @@ Bug #28220 (mb_strwidth() returns wrong width values for some Hangul characters) --FILE-- <?php $coderange = array( - range(0x0000, 0x1fff), - range(0xff60, 0xff9f) + range(0x0000, 0x1fff), + range(0xff60, 0xff9f) ); foreach ($coderange as $r) { - $ng = 0; - foreach ($r as $c) { - if (mb_strwidth(pack('N1', $c), 'UCS-4BE') != 2) { - $ng++; - } - } - echo "$ng\n"; + $ng = 0; + foreach ($r as $c) { + if (mb_strwidth(pack('N1', $c), 'UCS-4BE') != 2) { + $ng++; + } + } + echo "$ng\n"; } ?> --EXPECT-- diff --git a/ext/mbstring/tests/bug30549.phpt b/ext/mbstring/tests/bug30549.phpt index a6007e0b38..2feadf1d5a 100644 --- a/ext/mbstring/tests/bug30549.phpt +++ b/ext/mbstring/tests/bug30549.phpt @@ -9,13 +9,13 @@ test('ISO-8859-8', array(0xaf => 0x00af, 0xfd => 0x200e, 0xfe => 0x200f)); test('ISO-8859-10', array(0xa4 => 0x012a )); function test($enc, $map) { - print "$enc\n"; + print "$enc\n"; - foreach($map as $fromc => $toc) { - $ustr = mb_convert_encoding(pack('C', $fromc), 'UCS-4BE', $enc); - foreach (unpack('Nc', $ustr) as $unic); - printf("0x%04x, 0x%04x\n", $toc, $unic); - } + foreach($map as $fromc => $toc) { + $ustr = mb_convert_encoding(pack('C', $fromc), 'UCS-4BE', $enc); + foreach (unpack('Nc', $ustr) as $unic); + printf("0x%04x, 0x%04x\n", $toc, $unic); + } } ?> --EXPECT-- diff --git a/ext/mbstring/tests/bug43840.phpt b/ext/mbstring/tests/bug43840.phpt index 457356823e..7a3fd03094 100644 --- a/ext/mbstring/tests/bug43840.phpt +++ b/ext/mbstring/tests/bug43840.phpt @@ -24,19 +24,19 @@ $string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXv $needle = base64_decode('44CC'); foreach($offsets as $i) { - echo "\n-- Offset is $i --\n"; - echo "--Multibyte String:--\n"; - try { - var_dump( mb_strpos($string_mb, $needle, $i, 'UTF-8') ); - } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; - } - echo"--ASCII String:--\n"; - try { - var_dump(mb_strpos('This is na English ta', 'a', $i)); - } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; - } + echo "\n-- Offset is $i --\n"; + echo "--Multibyte String:--\n"; + try { + var_dump( mb_strpos($string_mb, $needle, $i, 'UTF-8') ); + } catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; + } + echo"--ASCII String:--\n"; + try { + var_dump(mb_strpos('This is na English ta', 'a', $i)); + } catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; + } } ?> --EXPECT-- diff --git a/ext/mbstring/tests/bug43841.phpt b/ext/mbstring/tests/bug43841.phpt index cb24ece04a..4a1da505d4 100644 --- a/ext/mbstring/tests/bug43841.phpt +++ b/ext/mbstring/tests/bug43841.phpt @@ -22,26 +22,26 @@ $string_mb = "日本語テã‚ストã§ã™ã€‚0123456789。"; $needle = "。"; foreach ($offsets as $i) { - echo "\n-- Offset is $i --\n"; - echo "Multibyte String:\n"; - try { - var_dump( mb_strrpos($string_mb, $needle, $i, 'UTF-8') ); - } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; - } - echo "ASCII String:\n"; - echo "mb_strrpos:\n"; - try { - var_dump(mb_strrpos('This is na English ta', 'a', $i)); - } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; - } - echo "strrpos:\n"; - try { - var_dump(strrpos('This is na English ta', 'a', $i)); - } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; - } + echo "\n-- Offset is $i --\n"; + echo "Multibyte String:\n"; + try { + var_dump( mb_strrpos($string_mb, $needle, $i, 'UTF-8') ); + } catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; + } + echo "ASCII String:\n"; + echo "mb_strrpos:\n"; + try { + var_dump(mb_strrpos('This is na English ta', 'a', $i)); + } catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; + } + echo "strrpos:\n"; + try { + var_dump(strrpos('This is na English ta', 'a', $i)); + } catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; + } } ?> --EXPECT-- diff --git a/ext/mbstring/tests/bug43994.phpt b/ext/mbstring/tests/bug43994.phpt index 6bc03326ad..387a907c29 100644 --- a/ext/mbstring/tests/bug43994.phpt +++ b/ext/mbstring/tests/bug43994.phpt @@ -25,16 +25,16 @@ $inputs = array(NULL, null, false, FALSE, "", '', @$undefined_var, $iterator = 1; foreach($inputs as $input) { - if(@is_array($mb_regs)){ - $mb_regs = ''; - } - echo "\n-- Iteration $iterator --\n"; - echo "Without \$regs arg:\n"; - var_dump( mb_ereg($input, 'hello, world') ); - echo "With \$regs arg:\n"; - var_dump(mb_ereg($input, 'hello, world', $mb_regs)); - var_dump($mb_regs); - $iterator++; + if(@is_array($mb_regs)){ + $mb_regs = ''; + } + echo "\n-- Iteration $iterator --\n"; + echo "Without \$regs arg:\n"; + var_dump( mb_ereg($input, 'hello, world') ); + echo "With \$regs arg:\n"; + var_dump(mb_ereg($input, 'hello, world', $mb_regs)); + var_dump($mb_regs); + $iterator++; }; ?> --EXPECTF-- diff --git a/ext/mbstring/tests/bug45923.phpt b/ext/mbstring/tests/bug45923.phpt index 522f4ddddd..37d2b13f8b 100644 --- a/ext/mbstring/tests/bug45923.phpt +++ b/ext/mbstring/tests/bug45923.phpt @@ -7,15 +7,15 @@ Bug #45923 (mb_st[r]ripos() offset not handled correctly) function section($func, $haystack, $needle) { - echo "\n------- $func -----------\n\n"; - foreach([0, 3, 6, 9, 11, 12, -1, -3, -6, -20] as $offset) { - echo "> Offset: $offset\n"; + echo "\n------- $func -----------\n\n"; + foreach([0, 3, 6, 9, 11, 12, -1, -3, -6, -20] as $offset) { + echo "> Offset: $offset\n"; try { - var_dump($func($haystack, $needle, $offset)); + var_dump($func($haystack, $needle, $offset)); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } - } + } } section('strpos' , "abc abc abc" , "abc"); diff --git a/ext/mbstring/tests/bug52981.phpt b/ext/mbstring/tests/bug52981.phpt index f6be08bf33..3d909635e3 100644 --- a/ext/mbstring/tests/bug52981.phpt +++ b/ext/mbstring/tests/bug52981.phpt @@ -6,10 +6,10 @@ Bug #52981 (Unicode properties are outdated (from Unicode 3.2)) <?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"; + $upper = mb_strtoupper($str, 'UTF-8'); + $len = strlen($upper); + for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' '; + echo "\n"; } // OK diff --git a/ext/mbstring/tests/bug72402.phpt b/ext/mbstring/tests/bug72402.phpt index b3fd8464b8..1237207ab1 100644 --- a/ext/mbstring/tests/bug72402.phpt +++ b/ext/mbstring/tests/bug72402.phpt @@ -8,11 +8,11 @@ if (!function_exists('mb_ereg')) die('skip mbregex support not available'); --FILE-- <?php function throwit() { - throw new Exception('it'); + throw new Exception('it'); } $var10 = "throwit"; try { - $var14 = mb_ereg_replace_callback("", $var10, ""); + $var14 = mb_ereg_replace_callback("", $var10, ""); } catch(Exception $e) {} ?> DONE diff --git a/ext/mbstring/tests/casefold.phpt b/ext/mbstring/tests/casefold.phpt index 2138aff255..2f872da1b5 100644 --- a/ext/mbstring/tests/casefold.phpt +++ b/ext/mbstring/tests/casefold.phpt @@ -10,11 +10,11 @@ function_exists('mb_convert_case' ) or die("skip mb_convert_case() is not availa output_handler= --FILE-- <?php - mb_internal_encoding( 'ISO-8859-1' ); - print mb_strtolower( "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" ); - print mb_strtoupper( mb_strtolower( "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" ) ); - print mb_strtoupper( "äëï\n" ); - print mb_convert_case( "äëï\n", MB_CASE_TITLE ); + mb_internal_encoding( 'ISO-8859-1' ); + print mb_strtolower( "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" ); + print mb_strtoupper( mb_strtolower( "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" ) ); + print mb_strtoupper( "äëï\n" ); + print mb_convert_case( "äëï\n", MB_CASE_TITLE ); ?> --EXPECT-- abcdefghijklmnopqrstuvwxyz diff --git a/ext/mbstring/tests/common.inc b/ext/mbstring/tests/common.inc index c8467a29f5..2ee26bbfd5 100644 --- a/ext/mbstring/tests/common.inc +++ b/ext/mbstring/tests/common.inc @@ -5,18 +5,18 @@ // Var def for testing $t_ary = array( - 's1' => 'ÆüËܸìEUC-JP¤Îʸ»úÎó', - 's2' => 'English Text' - ); + 's1' => 'ÆüËܸìEUC-JP¤Îʸ»úÎó', + 's2' => 'English Text' + ); class tc { - public $s1 = 'ÆüËܸìEUC-JP¤Îʸ»úÎó'; - public $s2 = 'English Text'; + public $s1 = 'ÆüËܸìEUC-JP¤Îʸ»úÎó'; + public $s2 = 'English Text'; - function __construct() - { - } + function __construct() + { + } } $t_obj = new tc; diff --git a/ext/mbstring/tests/illformed_utf_sequences.phpt b/ext/mbstring/tests/illformed_utf_sequences.phpt index 11ab1799e9..3b7d431a0e 100644 --- a/ext/mbstring/tests/illformed_utf_sequences.phpt +++ b/ext/mbstring/tests/illformed_utf_sequences.phpt @@ -5,16 +5,16 @@ Unicode standard conformance test (ill-formed UTF sequences.) --FILE-- <?php function chk_enc($str, $n, $enc = "UTF-8", $with_bom = false) { - $src = bin2hex(mb_convert_encoding($str, "UCS-4BE", $enc)); - $dst = str_repeat("0000fffd", $n); - if ($with_bom) { - $dst = "0000feff" . $dst; - } - if ($dst == $src) { - return false; - } else { - return $src; - } + $src = bin2hex(mb_convert_encoding($str, "UCS-4BE", $enc)); + $dst = str_repeat("0000fffd", $n); + if ($with_bom) { + $dst = "0000feff" . $dst; + } + if ($dst == $src) { + return false; + } else { + return $src; + } } mb_substitute_character(0xfffd); @@ -61,12 +61,12 @@ echo "UTF-8 and surrogates area\n"; $out = ''; $cnt = 0; for ($i = 0xd7ff; $i <= 0xe000; ++$i) { - $s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 3); - if ($s === false) { - $cnt++; - } else { - $out .= $s; - } + $s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 3); + if ($s === false) { + $cnt++; + } else { + $out .= $s; + } } var_dump($cnt); var_dump($out); @@ -88,11 +88,11 @@ $out = ''; $cnt = 0; for ($i = 0xd7ff; $i <= 0xe000; ++$i) { $s = chk_enc(pack('C4', $i >> 24, ($i >> 16) & 0xff, ($i >> 8) & 0xff, $i & 0xff), 1, "UTF-32BE"); - if ($s === false) { - $cnt++; - } else { - $out .= $s; - } + if ($s === false) { + $cnt++; + } else { + $out .= $s; + } } var_dump($cnt); var_dump($out); @@ -101,11 +101,11 @@ $out = ''; $cnt = 0; for ($i = 0xd7ff; $i <= 0xe000; ++$i) { $s = chk_enc(pack('C4', $i & 0xff, ($i >> 8) & 0xff, ($i >> 16) & 0xff, ($i >> 24) & 0xff), 1, "UTF-32LE"); - if ($s === false) { - $cnt++; - } else { - $out .= $s; - } + if ($s === false) { + $cnt++; + } else { + $out .= $s; + } } var_dump($cnt); var_dump($out); @@ -114,11 +114,11 @@ $out = ''; $cnt = 0; for ($i = 0xd7ff; $i <= 0xe000; ++$i) { $s = chk_enc(pack('C4', $i >> 24, ($i >> 16) & 0xff, ($i >> 8) & 0xff, $i & 0xff), 1, "UTF-32"); - if ($s === false) { - $cnt++; - } else { - $out .= $s; - } + if ($s === false) { + $cnt++; + } else { + $out .= $s; + } } var_dump($cnt); var_dump($out); @@ -129,12 +129,12 @@ $out = ''; $cnt = 0; for ($i = 0xd7ff; $i <= 0xe000; ++$i) { $s = chk_enc("\x00\x00\xfe\xff". pack('C4', $i >> 24, ($i >> 16) & 0xff, ($i >> 8) & 0xff, $i & 0xff), - 1, "UTF-32", true); - if ($s === false) { - $cnt++; - } else { - $out .= $s; - } + 1, "UTF-32", true); + if ($s === false) { + $cnt++; + } else { + $out .= $s; + } } var_dump($cnt); var_dump(str_replace("0000feff","",$out)); @@ -143,12 +143,12 @@ $out = ''; $cnt = 0; for ($i = 0xd7ff; $i <= 0xe000; ++$i) { $s = chk_enc("\xff\xfe\x00\x00". pack('C4', $i & 0xff, ($i >> 8) & 0xff, ($i >> 16) & 0xff, ($i >> 24) & 0xff), - 1, "UTF-32", true); - if ($s === false) { - $cnt++; - } else { - $out .= $s; - } + 1, "UTF-32", true); + if ($s === false) { + $cnt++; + } else { + $out .= $s; + } } var_dump($cnt); var_dump(str_replace("0000feff","",$out)); diff --git a/ext/mbstring/tests/mb_chr.phpt b/ext/mbstring/tests/mb_chr.phpt index d61178af4d..e4d74e0d67 100644 --- a/ext/mbstring/tests/mb_chr.phpt +++ b/ext/mbstring/tests/mb_chr.phpt @@ -13,11 +13,11 @@ var_dump( // Invalid var_dump( - mb_chr(0xd800, "typo"), - mb_chr(0xd800, "pass"), - mb_chr(0xd800, "jis"), - mb_chr(0xd800, "cp50222"), - mb_chr(0xd800, "utf-7") + mb_chr(0xd800, "typo"), + mb_chr(0xd800, "pass"), + mb_chr(0xd800, "jis"), + mb_chr(0xd800, "cp50222"), + mb_chr(0xd800, "utf-7") ); ?> --EXPECTF-- diff --git a/ext/mbstring/tests/mb_chr_ord.phpt b/ext/mbstring/tests/mb_chr_ord.phpt index 72a4220e8b..77f13dadfa 100644 --- a/ext/mbstring/tests/mb_chr_ord.phpt +++ b/ext/mbstring/tests/mb_chr_ord.phpt @@ -6,14 +6,14 @@ mb_chr() and mb_ord() <?php ini_set('internal_encoding', 'utf-8'); for($ch = 1; $ch < 80000; $ch++) { - $str = mb_chr($ch); - if (false === $str) { - echo "ERROR($ch)\n"; - continue; - } - if ($ch != mb_ord($str)) { - echo "REAL ERROR($ch)\n"; - } + $str = mb_chr($ch); + if (false === $str) { + echo "ERROR($ch)\n"; + continue; + } + if ($ch != mb_ord($str)) { + echo "REAL ERROR($ch)\n"; + } } echo 'OK'; --EXPECT-- diff --git a/ext/mbstring/tests/mb_convert_encoding_array.phpt b/ext/mbstring/tests/mb_convert_encoding_array.phpt index bd413c4686..bfce6115a8 100644 --- a/ext/mbstring/tests/mb_convert_encoding_array.phpt +++ b/ext/mbstring/tests/mb_convert_encoding_array.phpt @@ -30,10 +30,10 @@ $utf8_string[] = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTv function base64_encode_array($input) { - foreach ($input as $var) { - $ret[] = base64_encode($var); - } - return $ret; + foreach ($input as $var) { + $ret[] = base64_encode($var); + } + return $ret; } echo "\n-- Convert to JIS --\n"; diff --git a/ext/mbstring/tests/mb_convert_encoding_array2.phpt b/ext/mbstring/tests/mb_convert_encoding_array2.phpt index 29991f2165..ac9be2dd12 100644 --- a/ext/mbstring/tests/mb_convert_encoding_array2.phpt +++ b/ext/mbstring/tests/mb_convert_encoding_array2.phpt @@ -41,11 +41,11 @@ $utf8_string[] = $tmp; function base64_encode_array($input) { - foreach ($input as $var) { - if (is_scalar($var)) - $ret[] = base64_encode($var); - } - return $ret; + foreach ($input as $var) { + if (is_scalar($var)) + $ret[] = base64_encode($var); + } + return $ret; } echo "\n-- Convert to JIS --\n"; diff --git a/ext/mbstring/tests/mb_convert_variables.phpt b/ext/mbstring/tests/mb_convert_variables.phpt index b04e2bf185..830c6a7cd0 100644 --- a/ext/mbstring/tests/mb_convert_variables.phpt +++ b/ext/mbstring/tests/mb_convert_variables.phpt @@ -72,34 +72,34 @@ print("{$aa[0]}{$aa[1]}{$aa[2]}\n"); // Converted to EUC-JP echo "== OBJECT TEST ==\n"; class foo { - public $s1; - public $s2; - public $s3; - - function __construct() - { - global $sjis, $jis, $euc_jp; - - $this->s1 = $euc_jp; - $this->s2 = $euc_jp; - $this->s3 = $euc_jp; - } + public $s1; + public $s2; + public $s3; + + function __construct() + { + global $sjis, $jis, $euc_jp; + + $this->s1 = $euc_jp; + $this->s2 = $euc_jp; + $this->s3 = $euc_jp; + } } class bar { - public $s1; - public $s2; - public $s3; - - function __construct() - { - global $sjis, $jis, $euc_jp; - - $this->s1 = $euc_jp; - $this->s2 = $euc_jp; - $this->s3 = $euc_jp; - } + public $s1; + public $s2; + public $s3; + + function __construct() + { + global $sjis, $jis, $euc_jp; + + $this->s1 = $euc_jp; + $this->s2 = $euc_jp; + $this->s3 = $euc_jp; + } } diff --git a/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt b/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt index 1352088ccd..205aeafcbe 100644 --- a/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt +++ b/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt @@ -26,21 +26,21 @@ $nonEnglish = array('Japanese' => base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44G 'Greek' => base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==')); foreach ($english as $lang => $input) { - echo "\nLanguage: $lang\n"; - echo "-- Base 64: --\n"; - var_dump(mb_encode_mimeheader($input, 'UTF-8', 'B')); - echo "-- Quoted-Printable --\n"; - var_dump(mb_encode_mimeheader($input, 'UTF-8', 'Q')); + echo "\nLanguage: $lang\n"; + echo "-- Base 64: --\n"; + var_dump(mb_encode_mimeheader($input, 'UTF-8', 'B')); + echo "-- Quoted-Printable --\n"; + var_dump(mb_encode_mimeheader($input, 'UTF-8', 'Q')); } mb_internal_encoding('utf-8'); foreach ($nonEnglish as $lang => $input) { - echo "\nLanguage: $lang\n"; - echo "-- Base 64: --\n"; - var_dump(mb_encode_mimeheader($input, 'UTF-8', 'B')); - echo "-- Quoted-Printable --\n"; - var_dump(mb_encode_mimeheader($input, 'UTF-8', 'Q')); + echo "\nLanguage: $lang\n"; + echo "-- Base 64: --\n"; + var_dump(mb_encode_mimeheader($input, 'UTF-8', 'B')); + echo "-- Quoted-Printable --\n"; + var_dump(mb_encode_mimeheader($input, 'UTF-8', 'Q')); } echo "Done"; diff --git a/ext/mbstring/tests/mb_encode_mimeheader_basic2.phpt b/ext/mbstring/tests/mb_encode_mimeheader_basic2.phpt index 151d4a610f..f108938e8b 100644 --- a/ext/mbstring/tests/mb_encode_mimeheader_basic2.phpt +++ b/ext/mbstring/tests/mb_encode_mimeheader_basic2.phpt @@ -29,13 +29,13 @@ $inputs = array('SJIS' => $sjis_string, 'EUC_JP' => $euc_jp_string); foreach ($inputs as $lang => $input) { - echo "\nLanguage: $lang\n"; - echo "-- Base 64: --\n"; - mb_internal_encoding($lang); - $outEncoding = "UTF-8"; - var_dump(mb_encode_mimeheader($input, $outEncoding, 'B')); - echo "-- Quoted-Printable --\n"; - var_dump(mb_encode_mimeheader($input, $outEncoding, 'Q')); + echo "\nLanguage: $lang\n"; + echo "-- Base 64: --\n"; + mb_internal_encoding($lang); + $outEncoding = "UTF-8"; + var_dump(mb_encode_mimeheader($input, $outEncoding, 'B')); + echo "-- Quoted-Printable --\n"; + var_dump(mb_encode_mimeheader($input, $outEncoding, 'Q')); } echo "Done"; diff --git a/ext/mbstring/tests/mb_encode_mimeheader_basic3.phpt b/ext/mbstring/tests/mb_encode_mimeheader_basic3.phpt index d56a996892..7235255754 100644 --- a/ext/mbstring/tests/mb_encode_mimeheader_basic3.phpt +++ b/ext/mbstring/tests/mb_encode_mimeheader_basic3.phpt @@ -29,13 +29,13 @@ $inputs = array('SJIS' => $sjis_string, 'EUC_JP' => $euc_jp_string); foreach ($inputs as $lang => $input) { - echo "\nLanguage: $lang\n"; - echo "-- Base 64: --\n"; - mb_internal_encoding($lang); - $outEncoding = $lang; - var_dump(mb_encode_mimeheader($input, $outEncoding, 'B')); - echo "-- Quoted-Printable --\n"; - var_dump(mb_encode_mimeheader($input, $outEncoding, 'Q')); + echo "\nLanguage: $lang\n"; + echo "-- Base 64: --\n"; + mb_internal_encoding($lang); + $outEncoding = $lang; + var_dump(mb_encode_mimeheader($input, $outEncoding, 'B')); + echo "-- Quoted-Printable --\n"; + var_dump(mb_encode_mimeheader($input, $outEncoding, 'Q')); } echo "Done"; diff --git a/ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt b/ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt index edf602d550..51dd85956c 100644 --- a/ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt +++ b/ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt @@ -28,9 +28,9 @@ $str = base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr8 $iterator = 1; foreach ($linefeeds as $linefeed) { - echo "\n-- Iteration $iterator --\n"; - var_dump(mb_encode_mimeheader($str, 'utf-8', 'B', $linefeed)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(mb_encode_mimeheader($str, 'utf-8', 'B', $linefeed)); + $iterator++; } diff --git a/ext/mbstring/tests/mb_ereg.phpt b/ext/mbstring/tests/mb_ereg.phpt index ff507adc07..bc95a5fbaa 100644 --- a/ext/mbstring/tests/mb_ereg.phpt +++ b/ext/mbstring/tests/mb_ereg.phpt @@ -9,26 +9,26 @@ function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build output_handler= --FILE-- <?php - mb_regex_set_options( '' ); + mb_regex_set_options( '' ); - $encs = array( 'EUC-JP', 'Shift_JIS', 'SJIS', 'UTF-8' ); + $encs = array( 'EUC-JP', 'Shift_JIS', 'SJIS', 'UTF-8' ); - function test_ereg( $test_enc, $pat, $str, $in_enc = 'EUC-JP' ) { - mb_regex_encoding( $test_enc ); - $pat = mb_convert_encoding( $pat, $test_enc, $in_enc ); - $str = mb_convert_encoding( $str, $test_enc, $in_enc ); - printf( "(%d)%s\n", mb_ereg( $pat, $str, $reg ), ( is_array( $reg )? bin2hex(mb_convert_encoding( implode( ' ', $reg ), $in_enc, $test_enc )) : '' ) ); - } - function do_tests( $enc ) { - test_ereg( $enc, 'abc ([a-z]+) ([a-z]+) ([a-z]+)$', "abc def ghi jkl" ); - $pat = '([£á-£ú]+) ([ ¤¢-¤«]+)([¤«-¤Ê]+) ([¤ï-¤ó]+)$'; - test_ereg( $enc, $pat, '£á£â£ã ¤¢¤ª¤¤ ¤«¤³¤Ê ¤ï¤ñ¤ó' ); - test_ereg( $enc, $pat, '£í£ú£ø£æ£ð ¤¦¤ª¤« ¤¤« ¤ò¤ð' ); - } + function test_ereg( $test_enc, $pat, $str, $in_enc = 'EUC-JP' ) { + mb_regex_encoding( $test_enc ); + $pat = mb_convert_encoding( $pat, $test_enc, $in_enc ); + $str = mb_convert_encoding( $str, $test_enc, $in_enc ); + printf( "(%d)%s\n", mb_ereg( $pat, $str, $reg ), ( is_array( $reg )? bin2hex(mb_convert_encoding( implode( ' ', $reg ), $in_enc, $test_enc )) : '' ) ); + } + function do_tests( $enc ) { + test_ereg( $enc, 'abc ([a-z]+) ([a-z]+) ([a-z]+)$', "abc def ghi jkl" ); + $pat = '([£á-£ú]+) ([ ¤¢-¤«]+)([¤«-¤Ê]+) ([¤ï-¤ó]+)$'; + test_ereg( $enc, $pat, '£á£â£ã ¤¢¤ª¤¤ ¤«¤³¤Ê ¤ï¤ñ¤ó' ); + test_ereg( $enc, $pat, '£í£ú£ø£æ£ð ¤¦¤ª¤« ¤¤« ¤ò¤ð' ); + } - foreach( $encs as $enc ) { - do_tests( $enc ); - } + foreach( $encs as $enc ) { + do_tests( $enc ); + } ?> --EXPECT-- (15)6162632064656620676869206a6b6c2064656620676869206a6b6c diff --git a/ext/mbstring/tests/mb_ereg1.phpt b/ext/mbstring/tests/mb_ereg1.phpt index fcc7e72e9f..875426a6c7 100644 --- a/ext/mbstring/tests/mb_ereg1.phpt +++ b/ext/mbstring/tests/mb_ereg1.phpt @@ -6,20 +6,20 @@ mb_ereg() and invalid arguments <?php $a = array( - array(1,2,3), - array("", "", ""), - array(array(), 1, ""), - array(1, array(), ""), - array(1, "", array()), - ); + array(1,2,3), + array("", "", ""), + array(array(), 1, ""), + array(1, array(), ""), + array(1, "", array()), + ); foreach ($a as $args) { - try { - var_dump(mb_ereg($args[0], $args[1], $args[2])); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - var_dump($args); + try { + var_dump(mb_ereg($args[0], $args[1], $args[2])); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + var_dump($args); } ?> --EXPECTF-- diff --git a/ext/mbstring/tests/mb_ereg_basic.phpt b/ext/mbstring/tests/mb_ereg_basic.phpt index b13f012b7b..ef5bc11120 100644 --- a/ext/mbstring/tests/mb_ereg_basic.phpt +++ b/ext/mbstring/tests/mb_ereg_basic.phpt @@ -19,9 +19,9 @@ function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build echo "*** Testing mb_ereg() : basic functionality ***\n"; if(mb_regex_encoding('utf-8') == true) { - echo "Regex encoding set to utf-8\n"; + echo "Regex encoding set to utf-8\n"; } else { - echo "Could not set regex encoding to utf-8\n"; + echo "Could not set regex encoding to utf-8\n"; } $string_ascii = 'This is an English string. 0123456789.'; $regex_ascii1 = '(.*is)+.*\.[[:blank:]][0-9]{9}'; @@ -59,20 +59,20 @@ echo "Done"; * @param array $regs */ function base64_encode_var_dump($regs) { - if ($regs) { - echo "array(" . count($regs) . ") {\n"; - foreach ($regs as $key => $value) { - echo " [$key]=>\n "; - if (is_string($value)) { - var_dump(base64_encode($value)); - } else { - var_dump($value); - } - } - echo "}\n"; - } else { - echo "NULL\n"; - } + if ($regs) { + echo "array(" . count($regs) . ") {\n"; + foreach ($regs as $key => $value) { + echo " [$key]=>\n "; + if (is_string($value)) { + var_dump(base64_encode($value)); + } else { + var_dump($value); + } + } + echo "}\n"; + } else { + echo "NULL\n"; + } } ?> --EXPECT-- diff --git a/ext/mbstring/tests/mb_ereg_replace.phpt b/ext/mbstring/tests/mb_ereg_replace.phpt index 26838341fe..7afb8fdad6 100644 --- a/ext/mbstring/tests/mb_ereg_replace.phpt +++ b/ext/mbstring/tests/mb_ereg_replace.phpt @@ -7,9 +7,9 @@ function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not availab ?> --FILE-- <?php - mb_regex_set_options( '' ); - print mb_ereg_replace( ' ', '-', 'a b c d e' )."\n"; - print mb_ereg_replace( '([a-z]+)','[\\1]', 'abc def ghi' ); + mb_regex_set_options( '' ); + print mb_ereg_replace( ' ', '-', 'a b c d e' )."\n"; + print mb_ereg_replace( '([a-z]+)','[\\1]', 'abc def ghi' ); ?> --EXPECT-- a-b-c-d-e diff --git a/ext/mbstring/tests/mb_ereg_search_pos.phpt b/ext/mbstring/tests/mb_ereg_search_pos.phpt index e9c8aaafc7..1eb425d4aa 100644 --- a/ext/mbstring/tests/mb_ereg_search_pos.phpt +++ b/ext/mbstring/tests/mb_ereg_search_pos.phpt @@ -12,13 +12,13 @@ $test_str = 'Iñtërnâtiônàlizætiøn'; if(mb_ereg_search_init($test_str)) { - $val=mb_ereg_search_pos("nâtiôn"); + $val=mb_ereg_search_pos("nâtiôn"); - var_dump($val); + var_dump($val); } else{ - var_dump("false"); + var_dump("false"); } ?> --EXPECT-- diff --git a/ext/mbstring/tests/mb_ereg_search_setpos.phpt b/ext/mbstring/tests/mb_ereg_search_setpos.phpt index bd7d3ea060..0a90d005dd 100644 --- a/ext/mbstring/tests/mb_ereg_search_setpos.phpt +++ b/ext/mbstring/tests/mb_ereg_search_setpos.phpt @@ -17,9 +17,9 @@ mb_ereg_search_init($test_str); $positions = array( 5, 20, 21, 25, 0, -5, -20, -30); foreach($positions as $pos) { - echo("\n* Position: $pos :\n"); - var_dump(mb_ereg_search_setpos($pos)); - var_dump(mb_ereg_search_getpos()); + echo("\n* Position: $pos :\n"); + var_dump(mb_ereg_search_setpos($pos)); + var_dump(mb_ereg_search_getpos()); } ?> --EXPECTF-- diff --git a/ext/mbstring/tests/mb_ereg_search_xxx.phpt b/ext/mbstring/tests/mb_ereg_search_xxx.phpt index a2049df144..7c2ef2605a 100644 --- a/ext/mbstring/tests/mb_ereg_search_xxx.phpt +++ b/ext/mbstring/tests/mb_ereg_search_xxx.phpt @@ -9,30 +9,30 @@ function_exists('mb_ereg_search') or die("skip\n"); output_handler= --FILE-- <?php - mb_regex_set_options( '' ); + mb_regex_set_options( '' ); - $encs = array( 'EUC-JP', 'Shift_JIS', 'SJIS', 'UTF-8' ); + $encs = array( 'EUC-JP', 'Shift_JIS', 'SJIS', 'UTF-8' ); - function test_search( $test_enc, $str, $look_for, $opt, $in_enc = 'EUC-JP' ) { - mb_regex_encoding( $test_enc ); - $str = mb_convert_encoding( $str, $test_enc, $in_enc ); - $look_for = mb_convert_encoding( $look_for, $test_enc, $in_enc ); - mb_ereg_search_init( $str, $look_for, $opt ); - while ( mb_ereg_search_pos() ) { - $regs = mb_ereg_search_getregs(); - array_shift( $regs ); - printf( "(%s) (%d) %s\n", $test_enc, mb_ereg_search_getpos(), mb_convert_encoding( ( is_array( $regs ) ? implode( '-', $regs ): '' ), $in_enc, $test_enc ) ); - } - } - function do_tests( $enc, $opt ) { - test_search( $enc, "¢Ï¡¦ ¡¦¢Ï\n", ' (¡¦?¢Ï¡¦?)[[:space:]]', $opt ); - test_search( $enc, 'abcde abdeabcf anvfabc odu abcd ', '(ab[a-z]+)', $opt ); - } + function test_search( $test_enc, $str, $look_for, $opt, $in_enc = 'EUC-JP' ) { + mb_regex_encoding( $test_enc ); + $str = mb_convert_encoding( $str, $test_enc, $in_enc ); + $look_for = mb_convert_encoding( $look_for, $test_enc, $in_enc ); + mb_ereg_search_init( $str, $look_for, $opt ); + while ( mb_ereg_search_pos() ) { + $regs = mb_ereg_search_getregs(); + array_shift( $regs ); + printf( "(%s) (%d) %s\n", $test_enc, mb_ereg_search_getpos(), mb_convert_encoding( ( is_array( $regs ) ? implode( '-', $regs ): '' ), $in_enc, $test_enc ) ); + } + } + function do_tests( $enc, $opt ) { + test_search( $enc, "¢Ï¡¦ ¡¦¢Ï\n", ' (¡¦?¢Ï¡¦?)[[:space:]]', $opt ); + test_search( $enc, 'abcde abdeabcf anvfabc odu abcd ', '(ab[a-z]+)', $opt ); + } - foreach( $encs as $enc ) { - do_tests( $enc, '' ); - do_tests( $enc, 'x' ); - } + foreach( $encs as $enc ) { + do_tests( $enc, '' ); + do_tests( $enc, 'x' ); + } ?> --EXPECT-- (EUC-JP) (10) ¡¦¢Ï diff --git a/ext/mbstring/tests/mb_ereg_variation3.phpt b/ext/mbstring/tests/mb_ereg_variation3.phpt index 17fa9444a4..9f484ee83d 100644 --- a/ext/mbstring/tests/mb_ereg_variation3.phpt +++ b/ext/mbstring/tests/mb_ereg_variation3.phpt @@ -37,14 +37,14 @@ $character_classes = array ('aB1' => '[[:alnum:]]+', /*1*/ $iterator = 1; foreach($character_classes as $string => $pattern) { - if (is_array(@$regs)) { - $regs = null; - } - // make sure any multibyte output is in base 64 - echo "\n-- Iteration $iterator --\n"; - var_dump(mb_ereg($pattern, $string, $regs)); - base64_encode_var_dump($regs); - $iterator++; + if (is_array(@$regs)) { + $regs = null; + } + // make sure any multibyte output is in base 64 + echo "\n-- Iteration $iterator --\n"; + var_dump(mb_ereg($pattern, $string, $regs)); + base64_encode_var_dump($regs); + $iterator++; } /** * replicate a var dump of an array but outputted string values are base64 encoded @@ -52,20 +52,20 @@ foreach($character_classes as $string => $pattern) { * @param array $regs */ function base64_encode_var_dump($regs) { - if ($regs) { - echo "array(" . count($regs) . ") {\n"; - foreach ($regs as $key => $value) { - echo " [$key]=>\n "; - if (is_string($value)) { - var_dump(base64_encode($value)); - } else { - var_dump($value); - } - } - echo "}\n"; - } else { - echo "NULL\n"; - } + if ($regs) { + echo "array(" . count($regs) . ") {\n"; + foreach ($regs as $key => $value) { + echo " [$key]=>\n "; + if (is_string($value)) { + var_dump(base64_encode($value)); + } else { + var_dump($value); + } + } + echo "}\n"; + } else { + echo "NULL\n"; + } } echo "Done"; diff --git a/ext/mbstring/tests/mb_ereg_variation4.phpt b/ext/mbstring/tests/mb_ereg_variation4.phpt index 54efbfb3f8..e487c5463c 100644 --- a/ext/mbstring/tests/mb_ereg_variation4.phpt +++ b/ext/mbstring/tests/mb_ereg_variation4.phpt @@ -39,15 +39,15 @@ $character_classes = array ('[[:alnum:]]+', /*1*/ $iterator = 1; foreach ($character_classes as $pattern) { - if (is_array(@$regs)) { - $regs = null; - } - echo "\n-- Iteration $iterator --\n"; - var_dump(mb_ereg($pattern, $string_mb, $regs)); - if ($regs) { - base64_encode_var_dump($regs); - } - $iterator++; + if (is_array(@$regs)) { + $regs = null; + } + echo "\n-- Iteration $iterator --\n"; + var_dump(mb_ereg($pattern, $string_mb, $regs)); + if ($regs) { + base64_encode_var_dump($regs); + } + $iterator++; } /** * replicate a var dump of an array but outputted string values are base64 encoded @@ -55,20 +55,20 @@ foreach ($character_classes as $pattern) { * @param array $regs */ function base64_encode_var_dump($regs) { - if ($regs) { - echo "array(" . count($regs) . ") {\n"; - foreach ($regs as $key => $value) { - echo " [$key]=>\n "; - if (is_string($value)) { - var_dump(base64_encode($value)); - } else { - var_dump($value); - } - } - echo "}\n"; - } else { - echo "NULL\n"; - } + if ($regs) { + echo "array(" . count($regs) . ") {\n"; + foreach ($regs as $key => $value) { + echo " [$key]=>\n "; + if (is_string($value)) { + var_dump(base64_encode($value)); + } else { + var_dump($value); + } + } + echo "}\n"; + } else { + echo "NULL\n"; + } } echo "Done"; diff --git a/ext/mbstring/tests/mb_ereg_variation5.phpt b/ext/mbstring/tests/mb_ereg_variation5.phpt index 24b12f25a7..5467f24d1f 100644 --- a/ext/mbstring/tests/mb_ereg_variation5.phpt +++ b/ext/mbstring/tests/mb_ereg_variation5.phpt @@ -45,20 +45,20 @@ echo "Done"; * @param array $regs */ function base64_encode_var_dump($regs) { - if ($regs) { - echo "array(" . count($regs) . ") {\n"; - foreach ($regs as $key => $value) { - echo " [$key]=>\n "; - if (is_string($value)) { - var_dump(base64_encode($value)); - } else { - var_dump($value); - } - } - echo "}\n"; - } else { - echo "NULL\n"; - } + if ($regs) { + echo "array(" . count($regs) . ") {\n"; + foreach ($regs as $key => $value) { + echo " [$key]=>\n "; + if (is_string($value)) { + var_dump(base64_encode($value)); + } else { + var_dump($value); + } + } + echo "}\n"; + } else { + echo "NULL\n"; + } } ?> --EXPECT-- diff --git a/ext/mbstring/tests/mb_ereg_variation6.phpt b/ext/mbstring/tests/mb_ereg_variation6.phpt index 97e5e58906..e9c506ac77 100644 --- a/ext/mbstring/tests/mb_ereg_variation6.phpt +++ b/ext/mbstring/tests/mb_ereg_variation6.phpt @@ -19,9 +19,9 @@ function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build echo "*** Testing mb_ereg() : usage variations ***\n"; if(mb_regex_encoding('utf-8') == true) { - echo "Regex encoding set to utf-8\n"; + echo "Regex encoding set to utf-8\n"; } else { - echo "Could not set regex encoding to utf-8\n"; + echo "Could not set regex encoding to utf-8\n"; } $regex_char = array ('\w+' => '\w+', @@ -37,18 +37,18 @@ $string_ascii = 'This is an English string. 0123456789.'; $string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII='); foreach ($regex_char as $displayChar => $char) { - echo "\n--** Pattern is: $displayChar **--\n"; - if (@$regs_ascii || @$regs_mb) { - $regs_ascii = null; - $regs_mb = null; - } - echo "-- ASCII String: --\n"; - var_dump(mb_ereg($char, $string_ascii, $regs_ascii)); - base64_encode_var_dump($regs_ascii); + echo "\n--** Pattern is: $displayChar **--\n"; + if (@$regs_ascii || @$regs_mb) { + $regs_ascii = null; + $regs_mb = null; + } + echo "-- ASCII String: --\n"; + var_dump(mb_ereg($char, $string_ascii, $regs_ascii)); + base64_encode_var_dump($regs_ascii); - echo "-- Multibyte String: --\n"; - var_dump(mb_ereg($char, $string_mb, $regs_mb)); - base64_encode_var_dump($regs_mb); + echo "-- Multibyte String: --\n"; + var_dump(mb_ereg($char, $string_mb, $regs_mb)); + base64_encode_var_dump($regs_mb); } @@ -58,20 +58,20 @@ foreach ($regex_char as $displayChar => $char) { * @param array $regs */ function base64_encode_var_dump($regs) { - if ($regs) { - echo "array(" . count($regs) . ") {\n"; - foreach ($regs as $key => $value) { - echo " [$key]=>\n "; - if (is_string($value)) { - var_dump(base64_encode($value)); - } else { - var_dump($value); - } - } - echo "}\n"; - } else { - echo "NULL\n"; - } + if ($regs) { + echo "array(" . count($regs) . ") {\n"; + foreach ($regs as $key => $value) { + echo " [$key]=>\n "; + if (is_string($value)) { + var_dump(base64_encode($value)); + } else { + var_dump($value); + } + } + echo "}\n"; + } else { + echo "NULL\n"; + } } echo "Done"; diff --git a/ext/mbstring/tests/mb_ereg_variation7.phpt b/ext/mbstring/tests/mb_ereg_variation7.phpt index e43d051d2a..63b726ffd8 100644 --- a/ext/mbstring/tests/mb_ereg_variation7.phpt +++ b/ext/mbstring/tests/mb_ereg_variation7.phpt @@ -22,9 +22,9 @@ function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build echo "*** Testing mb_ereg() : usage variations ***\n"; if(mb_regex_encoding('utf-8') == true) { - echo "Regex encoding set to utf-8\n"; + echo "Regex encoding set to utf-8\n"; } else { - echo "Could not set regex encoding to utf-8\n"; + echo "Could not set regex encoding to utf-8\n"; } $string_ascii = 'This is an English string. 0123456789.'; @@ -43,20 +43,20 @@ base64_encode_var_dump($regs_mb); * @param array $regs */ function base64_encode_var_dump($regs) { - if ($regs) { - echo "array(" . count($regs) . ") {\n"; - foreach ($regs as $key => $value) { - echo " [$key]=>\n "; - if (is_string($value)) { - var_dump(base64_encode($value)); - } else { - var_dump($value); - } - } - echo "}\n"; - } else { - echo "NULL\n"; - } + if ($regs) { + echo "array(" . count($regs) . ") {\n"; + foreach ($regs as $key => $value) { + echo " [$key]=>\n "; + if (is_string($value)) { + var_dump(base64_encode($value)); + } else { + var_dump($value); + } + } + echo "}\n"; + } else { + echo "NULL\n"; + } } echo "Done"; diff --git a/ext/mbstring/tests/mb_http_input.phpt b/ext/mbstring/tests/mb_http_input.phpt index ea78b397b1..586a7d094d 100644 --- a/ext/mbstring/tests/mb_http_input.phpt +++ b/ext/mbstring/tests/mb_http_input.phpt @@ -29,17 +29,17 @@ $enc = mb_http_input('P'); // check if (empty($ini)) { - // Must be pass - if ($enc === 'pass') { - echo "OK\n"; - } - else { - echo "NG\n"; - } + // Must be pass + if ($enc === 'pass') { + echo "OK\n"; + } + else { + echo "NG\n"; + } } else { - // Some encoding - echo "This heppens when php.ini-dist is not used\n"; + // Some encoding + echo "This heppens when php.ini-dist is not used\n"; } ?> diff --git a/ext/mbstring/tests/mb_internal_encoding_variation2.phpt b/ext/mbstring/tests/mb_internal_encoding_variation2.phpt index ba53c48401..b191f79203 100644 --- a/ext/mbstring/tests/mb_internal_encoding_variation2.phpt +++ b/ext/mbstring/tests/mb_internal_encoding_variation2.phpt @@ -80,11 +80,11 @@ $encoding = array('UCS-4', /*1*/ $iterator = 1; foreach($encoding as $enc) { - echo "\n-- Iteration $iterator --\n"; - var_dump(mb_internal_encoding()); - var_dump(mb_internal_encoding($enc)); - var_dump(mb_internal_encoding()); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(mb_internal_encoding()); + var_dump(mb_internal_encoding($enc)); + var_dump(mb_internal_encoding()); + $iterator++; } echo "Done"; ?> diff --git a/ext/mbstring/tests/mb_ord.phpt b/ext/mbstring/tests/mb_ord.phpt index e0c5610c0b..30fddb846c 100644 --- a/ext/mbstring/tests/mb_ord.phpt +++ b/ext/mbstring/tests/mb_ord.phpt @@ -12,12 +12,12 @@ var_dump( // Invalid var_dump( - mb_ord("\u{d800}", "typo"), - mb_ord("\u{d800}", "pass"), - mb_ord("\u{d800}", "jis"), - mb_ord("\u{d800}", "cp50222"), - mb_ord("\u{d800}", "utf-7"), - mb_ord("") + mb_ord("\u{d800}", "typo"), + mb_ord("\u{d800}", "pass"), + mb_ord("\u{d800}", "jis"), + mb_ord("\u{d800}", "cp50222"), + mb_ord("\u{d800}", "utf-7"), + mb_ord("") ); mb_internal_encoding("utf-7"); diff --git a/ext/mbstring/tests/mb_parse_str.phpt b/ext/mbstring/tests/mb_parse_str.phpt index ab504f918f..d1bf0066d3 100644 --- a/ext/mbstring/tests/mb_parse_str.phpt +++ b/ext/mbstring/tests/mb_parse_str.phpt @@ -7,20 +7,20 @@ arg_separator.input=& --FILE-- <?php $queries = array( - "foo=abc&bar=def", - "%2bfoo=def&-bar=jkl", - "foo[]=abc&foo[]=def&foo[]=ghi&bar[]=jkl" + "foo=abc&bar=def", + "%2bfoo=def&-bar=jkl", + "foo[]=abc&foo[]=def&foo[]=ghi&bar[]=jkl" ); function test($query) { - $foo = ''; - $bar = ''; - mb_parse_str($query, $array); - var_dump($array); - var_dump($foo); - var_dump($bar); + $foo = ''; + $bar = ''; + mb_parse_str($query, $array); + var_dump($array); + var_dump($foo); + var_dump($bar); } foreach ($queries as $query) { - test($query); + test($query); } ?> --EXPECTF-- diff --git a/ext/mbstring/tests/mb_parse_str02.phpt b/ext/mbstring/tests/mb_parse_str02.phpt index bad388ee90..f6456ab661 100644 --- a/ext/mbstring/tests/mb_parse_str02.phpt +++ b/ext/mbstring/tests/mb_parse_str02.phpt @@ -7,22 +7,22 @@ arg_separator.input=&# --FILE-- <?php $queries = array( - "foo=abc#bar=def&fubar=ghi", - "%2bfoo=def&-bar=jkl#+fubar", - " foo[]=abc&foo[]=def#foo[]=ghi#bar[]=#foo[]&fubar[]==" + "foo=abc#bar=def&fubar=ghi", + "%2bfoo=def&-bar=jkl#+fubar", + " foo[]=abc&foo[]=def#foo[]=ghi#bar[]=#foo[]&fubar[]==" ); function test($query) { - $foo = ''; - $bar = ''; - $fubar = ''; - mb_parse_str($query, $array); - var_dump($array); - var_dump($foo); - var_dump($bar); - var_dump($fubar); + $foo = ''; + $bar = ''; + $fubar = ''; + mb_parse_str($query, $array); + var_dump($array); + var_dump($foo); + var_dump($bar); + var_dump($fubar); } foreach ($queries as $query) { - test($query); + test($query); } ?> --EXPECTF-- diff --git a/ext/mbstring/tests/mb_regex_encoding_variation2.phpt b/ext/mbstring/tests/mb_regex_encoding_variation2.phpt index 0ef9eb4384..614c309c23 100644 --- a/ext/mbstring/tests/mb_regex_encoding_variation2.phpt +++ b/ext/mbstring/tests/mb_regex_encoding_variation2.phpt @@ -79,11 +79,11 @@ $encoding = array('UCS-4', /*1*/ $iterator = 1; foreach($encoding as $enc) { - echo "\n-- Iteration $iterator --\n"; - var_dump(mb_regex_encoding()); - var_dump(mb_regex_encoding($enc)); - var_dump(mb_regex_encoding()); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(mb_regex_encoding()); + var_dump(mb_regex_encoding($enc)); + var_dump(mb_regex_encoding()); + $iterator++; } echo "Done"; ?> diff --git a/ext/mbstring/tests/mb_regex_set_options.phpt b/ext/mbstring/tests/mb_regex_set_options.phpt index 301df8f118..ae10ba211c 100644 --- a/ext/mbstring/tests/mb_regex_set_options.phpt +++ b/ext/mbstring/tests/mb_regex_set_options.phpt @@ -7,11 +7,11 @@ function_exists('mb_regex_set_options') or die("skip\n"); ?> --FILE-- <?php - mb_regex_set_options( 'x' ); - print mb_ereg_replace(' -', '+', '- - - - -' ); + mb_regex_set_options( 'x' ); + print mb_ereg_replace(' -', '+', '- - - - -' ); - mb_regex_set_options( '' ); - print mb_ereg_replace(' -', '+', '- - - - -' ); + mb_regex_set_options( '' ); + print mb_ereg_replace(' -', '+', '- - - - -' ); ?> --EXPECT-- + + + + +-++++ diff --git a/ext/mbstring/tests/mb_send_mail01.phpt b/ext/mbstring/tests/mb_send_mail01.phpt index 8ed9ea9721..349fab852c 100644 --- a/ext/mbstring/tests/mb_send_mail01.phpt +++ b/ext/mbstring/tests/mb_send_mail01.phpt @@ -21,8 +21,8 @@ mb_send_mail($to, mb_language(), "test"); /* neutral (UTF-8) */ if (mb_language("neutral")) { - mb_internal_encoding("none"); - mb_send_mail($to, "test ".mb_language(), "test"); + mb_internal_encoding("none"); + mb_send_mail($to, "test ".mb_language(), "test"); } ?> --EXPECTF-- diff --git a/ext/mbstring/tests/mb_send_mail02.phpt b/ext/mbstring/tests/mb_send_mail02.phpt index 923f571486..06b85c691f 100644 --- a/ext/mbstring/tests/mb_send_mail02.phpt +++ b/ext/mbstring/tests/mb_send_mail02.phpt @@ -21,8 +21,8 @@ mb_send_mail($to, mb_language(), "test"); /* Japanese (EUC-JP) */ if (mb_language("japanese")) { - mb_internal_encoding('EUC-JP'); - mb_send_mail($to, "¥Æ¥¹¥È ".mb_language(), "¥Æ¥¹¥È"); + mb_internal_encoding('EUC-JP'); + mb_send_mail($to, "¥Æ¥¹¥È ".mb_language(), "¥Æ¥¹¥È"); } ?> --EXPECTF-- diff --git a/ext/mbstring/tests/mb_send_mail03.phpt b/ext/mbstring/tests/mb_send_mail03.phpt index 1b16529450..3d5ffd5659 100644 --- a/ext/mbstring/tests/mb_send_mail03.phpt +++ b/ext/mbstring/tests/mb_send_mail03.phpt @@ -21,8 +21,8 @@ mb_send_mail($to, mb_language(), "test"); /* English (iso-8859-1) */ if (mb_language("english")) { - mb_internal_encoding("ISO-8859-1"); - mb_send_mail($to, "test ".mb_language(), "test"); + mb_internal_encoding("ISO-8859-1"); + mb_send_mail($to, "test ".mb_language(), "test"); } ?> --EXPECTF-- diff --git a/ext/mbstring/tests/mb_send_mail04.phpt b/ext/mbstring/tests/mb_send_mail04.phpt index fbff4cd616..2eccb87189 100644 --- a/ext/mbstring/tests/mb_send_mail04.phpt +++ b/ext/mbstring/tests/mb_send_mail04.phpt @@ -21,8 +21,8 @@ mb_send_mail($to, mb_language(), "test"); /* German (iso-8859-15) */ if (mb_language("german")) { - mb_internal_encoding("ISO-8859-15"); - mb_send_mail($to, "Pr"."\xfc"."fung ".mb_language(), "Pr"."\xfc"."fung"); + mb_internal_encoding("ISO-8859-15"); + mb_send_mail($to, "Pr"."\xfc"."fung ".mb_language(), "Pr"."\xfc"."fung"); } ?> --EXPECTF-- diff --git a/ext/mbstring/tests/mb_send_mail05.phpt b/ext/mbstring/tests/mb_send_mail05.phpt index aa68ab8c82..53d97ef3d1 100644 --- a/ext/mbstring/tests/mb_send_mail05.phpt +++ b/ext/mbstring/tests/mb_send_mail05.phpt @@ -24,8 +24,8 @@ mb_send_mail($to, mb_language(), "test"); /* Simplified Chinese (HK-GB-2312) */ if (mb_language("simplified chinese")) { - mb_internal_encoding('GB2312'); - mb_send_mail($to, "²âÑé ".mb_language(), "²âÑé"); + mb_internal_encoding('GB2312'); + mb_send_mail($to, "²âÑé ".mb_language(), "²âÑé"); } ?> --EXPECTF-- diff --git a/ext/mbstring/tests/mb_send_mail06.phpt b/ext/mbstring/tests/mb_send_mail06.phpt index df3f065136..44a877aaee 100644 --- a/ext/mbstring/tests/mb_send_mail06.phpt +++ b/ext/mbstring/tests/mb_send_mail06.phpt @@ -24,8 +24,8 @@ mb_send_mail($to, mb_language(), "test"); /* Traditional Chinese () */ if (mb_language("traditional chinese")) { - mb_internal_encoding('BIG5'); - mb_send_mail($to, "´úÅç ".mb_language(), "´úÅç"); + mb_internal_encoding('BIG5'); + mb_send_mail($to, "´úÅç ".mb_language(), "´úÅç"); } ?> --EXPECTF-- diff --git a/ext/mbstring/tests/mb_send_mail07.phpt b/ext/mbstring/tests/mb_send_mail07.phpt index f62eccb8b2..9640abc1e8 100644 --- a/ext/mbstring/tests/mb_send_mail07.phpt +++ b/ext/mbstring/tests/mb_send_mail07.phpt @@ -24,8 +24,8 @@ mb_send_mail($to, mb_language(), "test"); /* Korean */ if (mb_language("korean")) { - mb_internal_encoding('EUC-KR'); - mb_send_mail($to, "Å×½ºÆ® ".mb_language(), "Å×½ºÆ®"); + mb_internal_encoding('EUC-KR'); + mb_send_mail($to, "Å×½ºÆ® ".mb_language(), "Å×½ºÆ®"); } ?> --EXPECTF-- diff --git a/ext/mbstring/tests/mb_split-compat-01.phpt b/ext/mbstring/tests/mb_split-compat-01.phpt index 8dbc82c130..38adc2a7dd 100644 --- a/ext/mbstring/tests/mb_split-compat-01.phpt +++ b/ext/mbstring/tests/mb_split-compat-01.phpt @@ -8,10 +8,10 @@ function_exists('mb_split') or die("skip mb_split() is not available in this bui --FILE-- <?php /* (counterpart: ext/standard/tests/reg/009.phpt) */ - $a=mb_split("[[:space:]]","this is a + $a=mb_split("[[:space:]]","this is a test"); - echo count($a) . "\n"; - for ($i = 0; $i < count($a); $i++) { + echo count($a) . "\n"; + for ($i = 0; $i < count($a); $i++) { echo $a[$i] . "\n"; } ?> diff --git a/ext/mbstring/tests/mb_split.phpt b/ext/mbstring/tests/mb_split.phpt index 9e9cd4080b..a2260ca059 100644 --- a/ext/mbstring/tests/mb_split.phpt +++ b/ext/mbstring/tests/mb_split.phpt @@ -7,30 +7,30 @@ function_exists('mb_split') or die("skip mb_split() is not available in this bui ?> --FILE-- <?php - mb_regex_set_options( '' ); - mb_regex_encoding( 'EUC-JP' ); + mb_regex_set_options( '' ); + mb_regex_encoding( 'EUC-JP' ); - function verify_split( $spliton, $str, $count = 0 ) - { - $result1 = mb_split( $spliton, $str, $count ); - $result2 = preg_split( "/$spliton/", $str, $count ); - if ( $result1 == $result2 ) { - print "ok\n"; - } else { - print count($result1).'-'.count($result2)."\n"; - } - } + function verify_split( $spliton, $str, $count = 0 ) + { + $result1 = mb_split( $spliton, $str, $count ); + $result2 = preg_split( "/$spliton/", $str, $count ); + if ( $result1 == $result2 ) { + print "ok\n"; + } else { + print count($result1).'-'.count($result2)."\n"; + } + } - var_dump( mb_split( " ", "a b c d e f g" ) - == mb_split( "[[:space:]]", "a\nb\tc\nd e f g" ) ); + var_dump( mb_split( " ", "a b c d e f g" ) + == mb_split( "[[:space:]]", "a\nb\tc\nd e f g" ) ); - for ( $i = 1; $i < 5; ++$i ) { - verify_split( " ", "a\tb\tc\td e\tf g", $i ); - } + for ( $i = 1; $i < 5; ++$i ) { + verify_split( " ", "a\tb\tc\td e\tf g", $i ); + } - for ( $i = 1; $i < 5; ++$i ) { - verify_split( "\xa1\xa1+", "\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1", $i ); - } + for ( $i = 1; $i < 5; ++$i ) { + verify_split( "\xa1\xa1+", "\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1", $i ); + } ?> --EXPECT-- bool(true) diff --git a/ext/mbstring/tests/mb_str_split_utf8_utf16.phpt b/ext/mbstring/tests/mb_str_split_utf8_utf16.phpt index d53dd088de..39bfb0175f 100644 --- a/ext/mbstring/tests/mb_str_split_utf8_utf16.phpt +++ b/ext/mbstring/tests/mb_str_split_utf8_utf16.phpt @@ -11,14 +11,14 @@ ini_set('include_path','.'); include_once('common.inc'); /* 123 string and 4-bytes length character 0xf09280a9 */ -$utf8 = pack("H*", "313233f09280a9"); +$utf8 = pack("H*", "313233f09280a9"); /* 123 string and 4-bytes length character 0xf09280a9 head without tail */ -$utf8_bad = pack("H*", "313233f092"); +$utf8_bad = pack("H*", "313233f092"); /* very first and very last utf-16 4-bytes characters */ -$utf16_first_be = pack("H*", "d800dc00"); -$utf16_first_le = pack("H*", "00d800dc"); +$utf16_first_be = pack("H*", "d800dc00"); +$utf16_first_le = pack("H*", "00d800dc"); $utf16_last_be = pack("H*", "dbffdfff"); $utf16_last_le = pack("H*", "ffdbffdf"); @@ -35,37 +35,37 @@ $utf16le_bad = $utf16_first_le . $utf16le_char_bad; /* print each chunk as HEX string */ echo "UTF-8:"; foreach(mb_str_split($utf8, 2) as $chunk){ - printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]); + printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]); } echo PHP_EOL; echo "BAD UTF-8:"; foreach(mb_str_split($utf8_bad, 2) as $chunk){ - printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]); + printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]); } echo PHP_EOL; echo "UTF-16BE:"; foreach(mb_str_split($utf16be, 1, "UTF-16BE") as $chunk){ - printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]); + printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]); } echo PHP_EOL; echo "UTF-16LE:"; foreach(mb_str_split($utf16le, 1, "UTF-16LE") as $chunk){ - printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]); + printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]); } echo PHP_EOL; echo "BAD UTF-16BE:"; foreach(mb_str_split($utf16be_bad, 1, "UTF-16BE") as $chunk){ - printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]); + printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]); } echo PHP_EOL; echo "BAD UTF-16LE:"; foreach(mb_str_split($utf16le_bad, 1, "UTF-16LE") as $chunk){ - printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]); + printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]); } echo PHP_EOL; diff --git a/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt b/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt index ba2875e767..b071fdbff3 100644 --- a/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt +++ b/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt @@ -34,16 +34,16 @@ $needle_mb = base64_decode('44CC'); * 60 is larger than *BYTE* count for $string_mb */ for ($i = -30; $i <= 60; $i += 10) { - echo "\n**-- Offset is: $i --**\n"; - echo "-- ASCII String --\n"; - try { - var_dump(mb_stripos($string_ascii, $needle_ascii, $i)); + echo "\n**-- Offset is: $i --**\n"; + echo "-- ASCII String --\n"; + try { + var_dump(mb_stripos($string_ascii, $needle_ascii, $i)); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } - echo "--Multibyte String --\n"; - try { - var_dump(mb_stripos($string_mb, $needle_mb, $i, 'UTF-8')); + echo "--Multibyte String --\n"; + try { + var_dump(mb_stripos($string_mb, $needle_mb, $i, 'UTF-8')); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } diff --git a/ext/mbstring/tests/mb_strlen_variation3.phpt b/ext/mbstring/tests/mb_strlen_variation3.phpt index b5f36dedc1..5a67fdd63b 100644 --- a/ext/mbstring/tests/mb_strlen_variation3.phpt +++ b/ext/mbstring/tests/mb_strlen_variation3.phpt @@ -84,22 +84,22 @@ $string_ascii = 'abc def'; $string_mb = base64_decode('44K/44OT44Ol44Os44O844OG44Kj44Oz44Kw44O744Oe44K344O844Oz44O744Kr44Oz44OR44OL44O8'); foreach($encoding as $enc) { - echo "\n-- Iteration $iterator: $enc --\n"; - - echo "-- ASCII String --\n"; - if(mb_strlen($string_ascii, $enc)) { - echo "Encoding $enc recognised\n"; - } else { - echo "Encoding $enc not recognised\n"; - } - - echo "-- Multibyte String --\n"; - if(mb_strlen($string_mb, $enc)){ - echo "Encoding $enc recognised\n"; - } else { - echo "Encoding $enc not recognised\n"; - } - $iterator++; + echo "\n-- Iteration $iterator: $enc --\n"; + + echo "-- ASCII String --\n"; + if(mb_strlen($string_ascii, $enc)) { + echo "Encoding $enc recognised\n"; + } else { + echo "Encoding $enc not recognised\n"; + } + + echo "-- Multibyte String --\n"; + if(mb_strlen($string_mb, $enc)){ + echo "Encoding $enc recognised\n"; + } else { + echo "Encoding $enc not recognised\n"; + } + $iterator++; } echo "Done"; diff --git a/ext/mbstring/tests/mb_strpos_variation5.phpt b/ext/mbstring/tests/mb_strpos_variation5.phpt index 7c2d4cd4a5..fe7542099a 100644 --- a/ext/mbstring/tests/mb_strpos_variation5.phpt +++ b/ext/mbstring/tests/mb_strpos_variation5.phpt @@ -33,17 +33,17 @@ $needle_mb = base64_decode('44CC'); * 60 is larger than *BYTE* count for $string_mb */ for ($i = -30; $i <= 60; $i += 10) { - echo "\n**-- Offset is: $i --**\n"; - echo "-- ASCII String --\n"; + echo "\n**-- Offset is: $i --**\n"; + echo "-- ASCII String --\n"; try { - var_dump(mb_strpos($string_ascii, $needle_ascii, $i)); + var_dump(mb_strpos($string_ascii, $needle_ascii, $i)); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } - - echo "--Multibyte String --\n"; + + echo "--Multibyte String --\n"; try { - var_dump(mb_strpos($string_mb, $needle_mb, $i, 'UTF-8')); + var_dump(mb_strpos($string_mb, $needle_mb, $i, 'UTF-8')); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } diff --git a/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt b/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt index 90235d6064..ad20bfe3d9 100644 --- a/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt +++ b/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt @@ -35,17 +35,17 @@ $needle_mb = base64_decode('44CC'); * 60 is larger than *BYTE* count for $string_mb */ for ($i = -10; $i <= 60; $i += 10) { - echo "\n**-- Offset is: $i --**\n"; - echo "-- ASCII String --\n"; + echo "\n**-- Offset is: $i --**\n"; + echo "-- ASCII String --\n"; try { - var_dump(mb_strripos($string_ascii, $needle_ascii, $i)); + var_dump(mb_strripos($string_ascii, $needle_ascii, $i)); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } - echo "--Multibyte String --\n"; + echo "--Multibyte String --\n"; try { - var_dump(mb_strripos($string_mb, $needle_mb, $i, 'UTF-8')); + var_dump(mb_strripos($string_mb, $needle_mb, $i, 'UTF-8')); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } diff --git a/ext/mbstring/tests/mb_strstr.phpt b/ext/mbstring/tests/mb_strstr.phpt index 61b2fcb1c3..87448467a1 100644 --- a/ext/mbstring/tests/mb_strstr.phpt +++ b/ext/mbstring/tests/mb_strstr.phpt @@ -5,11 +5,11 @@ mb_strstr() --FILE-- <?php function EUC_JP($utf8str) { - return mb_convert_encoding($utf8str, "EUC-JP", "UTF-8"); + return mb_convert_encoding($utf8str, "EUC-JP", "UTF-8"); } function FROM_EUC_JP($eucjpstr) { - return mb_convert_encoding($eucjpstr, "UTF-8", "EUC-JP"); + return mb_convert_encoding($eucjpstr, "UTF-8", "EUC-JP"); } var_dump(mb_strstr("ã‚ã„ã†ãˆãŠã‹ããã‘ã“", "ãŠã‹ã")); diff --git a/ext/mbstring/tests/mb_strtolower_basic.phpt b/ext/mbstring/tests/mb_strtolower_basic.phpt index c1ed26d6a8..a96709db84 100644 --- a/ext/mbstring/tests/mb_strtolower_basic.phpt +++ b/ext/mbstring/tests/mb_strtolower_basic.phpt @@ -28,9 +28,9 @@ $ascii = mb_strtolower($ascii_upper); var_dump($ascii); if($ascii == $ascii_lower) { - echo "Correctly converted\n"; + echo "Correctly converted\n"; } else { - echo "Incorrectly converted\n"; + echo "Incorrectly converted\n"; } echo "\n-- Multibyte String --\n"; @@ -38,9 +38,9 @@ $mb = mb_strtolower($greek_upper, 'UTF-8'); var_dump(base64_encode($mb)); if ($mb == $greek_lower) { - echo "Correctly converted\n"; + echo "Correctly converted\n"; } else { - echo "Incorrectly converted\n"; + echo "Incorrectly converted\n"; } echo "Done"; diff --git a/ext/mbstring/tests/mb_strtolower_variation3.phpt b/ext/mbstring/tests/mb_strtolower_variation3.phpt index bd0bd58c44..2578ef462c 100644 --- a/ext/mbstring/tests/mb_strtolower_variation3.phpt +++ b/ext/mbstring/tests/mb_strtolower_variation3.phpt @@ -27,18 +27,18 @@ echo "\n-- Mixed string (mulitbyte and ASCII characters) --\n"; $a = mb_strtolower($string_mixed, 'UTF-8'); var_dump(base64_encode($a)); if ($a == $string_mixed_lower) { - echo "Correctly Converted\n"; + echo "Correctly Converted\n"; } else { - echo "Incorrectly Converted\n"; + echo "Incorrectly Converted\n"; } echo "\n-- Multibyte Only String--\n"; $b = mb_strtolower($string_all_mb, 'UTF-8'); var_dump(base64_encode($b)); if ($b == $string_all_mb) { // Japanese characters only - should not be any conversion - echo "Correctly Converted\n"; + echo "Correctly Converted\n"; } else { - echo "Incorrectly Converted\n"; + echo "Incorrectly Converted\n"; } echo "Done"; diff --git a/ext/mbstring/tests/mb_strtolower_variation4.phpt b/ext/mbstring/tests/mb_strtolower_variation4.phpt index 17bd8c7fe2..590ead4e2d 100644 --- a/ext/mbstring/tests/mb_strtolower_variation4.phpt +++ b/ext/mbstring/tests/mb_strtolower_variation4.phpt @@ -26,14 +26,14 @@ $lowers = array('Basic Latin' => 'abcdefghijklmnopqrstuvwxyz', 'Russian' => base64_decode('0LDQsdCy0LPQtNC10LbQtw==')); foreach ($uppers as $lang => $sourcestring) { - echo "\n-- $lang --\n"; - $a = mb_strtolower($sourcestring, 'utf-8'); - var_dump(base64_encode($a)); - if ($a == $lowers[$lang]) { - echo "Correctly Converted\n"; - } else { - echo "Incorrectly Converted\n"; - } + echo "\n-- $lang --\n"; + $a = mb_strtolower($sourcestring, 'utf-8'); + var_dump(base64_encode($a)); + if ($a == $lowers[$lang]) { + echo "Correctly Converted\n"; + } else { + echo "Incorrectly Converted\n"; + } } echo "Done"; diff --git a/ext/mbstring/tests/mb_strtoupper_basic.phpt b/ext/mbstring/tests/mb_strtoupper_basic.phpt index ddaea2040b..1c0357dc34 100644 --- a/ext/mbstring/tests/mb_strtoupper_basic.phpt +++ b/ext/mbstring/tests/mb_strtoupper_basic.phpt @@ -29,9 +29,9 @@ $ascii = mb_strtoupper($ascii_lower); var_dump(base64_encode($ascii)); if($ascii == $ascii_upper) { - echo "Correctly converted\n"; + echo "Correctly converted\n"; } else { - echo "Incorrectly converted\n"; + echo "Incorrectly converted\n"; } echo "\n-- Multibyte String --\n"; @@ -39,9 +39,9 @@ $mb = mb_strtoupper($greek_lower, 'UTF-8'); var_dump(base64_encode($mb)); if ($mb == $greek_upper) { - echo "Correctly converted\n"; + echo "Correctly converted\n"; } else { - echo "Incorrectly converted\n"; + echo "Incorrectly converted\n"; } echo "Done"; diff --git a/ext/mbstring/tests/mb_strtoupper_variation3.phpt b/ext/mbstring/tests/mb_strtoupper_variation3.phpt index 3a40cb9bf3..d1f0244ae1 100644 --- a/ext/mbstring/tests/mb_strtoupper_variation3.phpt +++ b/ext/mbstring/tests/mb_strtoupper_variation3.phpt @@ -28,18 +28,18 @@ echo "\n-- Mixed string (mulitbyte and ASCII characters) --\n"; $a = mb_strtoupper($string_mixed_lower, 'UTF-8'); var_dump(base64_encode($a)); if ($a == $string_mixed_upper) { - echo "Correctly Converted\n"; + echo "Correctly Converted\n"; } else { - echo "Incorrectly Converted\n"; + echo "Incorrectly Converted\n"; } echo "\n-- Multibyte Only String--\n"; $b = mb_strtoupper($string_all_mb, 'UTF-8'); var_dump(base64_encode($b)); if ($b == $string_all_mb) { // Japanese characters only - should not be any conversion - echo "Correctly Converted\n"; + echo "Correctly Converted\n"; } else { - echo "Incorrectly Converted\n"; + echo "Incorrectly Converted\n"; } echo "Done"; diff --git a/ext/mbstring/tests/mb_strtoupper_variation4.phpt b/ext/mbstring/tests/mb_strtoupper_variation4.phpt index 7b126e671b..81a8bdd1da 100644 --- a/ext/mbstring/tests/mb_strtoupper_variation4.phpt +++ b/ext/mbstring/tests/mb_strtoupper_variation4.phpt @@ -27,14 +27,14 @@ $lowers = array('Basic Latin' => 'abcdefghijklmnopqrstuvwxyz', 'Russian' => base64_decode('0LDQsdCy0LPQtNC10LbQtw==')); foreach ($lowers as $lang => $sourcestring) { - echo "\n-- $lang --\n"; - $a = mb_strtoupper($sourcestring, 'UTF-8'); - var_dump(base64_encode($a)); - if ($a == $uppers[$lang]) { - echo "Correctly Converted\n"; - } else { - echo "Incorrectly Converted\n"; - } + echo "\n-- $lang --\n"; + $a = mb_strtoupper($sourcestring, 'UTF-8'); + var_dump(base64_encode($a)); + if ($a == $uppers[$lang]) { + echo "Correctly Converted\n"; + } else { + echo "Incorrectly Converted\n"; + } } echo "Done"; diff --git a/ext/mbstring/tests/mb_substitute_character_variation1.phpt b/ext/mbstring/tests/mb_substitute_character_variation1.phpt index 094b9b5818..53a21c8787 100644 --- a/ext/mbstring/tests/mb_substitute_character_variation1.phpt +++ b/ext/mbstring/tests/mb_substitute_character_variation1.phpt @@ -17,10 +17,10 @@ echo "*** Testing mb_substitute_character() : usage variation ***\n"; // Define error handler function test_error_handler($err_no, $err_msg, $filename, $linenum) { - if (error_reporting() & $err_no) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } + if (error_reporting() & $err_no) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } } set_error_handler('test_error_handler'); @@ -33,9 +33,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/mbstring/tests/mb_substr_count.phpt b/ext/mbstring/tests/mb_substr_count.phpt index 5be5109375..84571515de 100644 --- a/ext/mbstring/tests/mb_substr_count.phpt +++ b/ext/mbstring/tests/mb_substr_count.phpt @@ -6,30 +6,30 @@ mb_substr_count() output_handler= --FILE-- <?php - mb_internal_encoding("EUC-JP"); - var_dump(@mb_substr_count("", "")); - var_dump(@mb_substr_count("¤¢", "")); - var_dump(@mb_substr_count("", "¤¢")); - var_dump(@mb_substr_count("", "¤¢")); - var_dump(@mb_substr_count("", chr(0))); + mb_internal_encoding("EUC-JP"); + var_dump(@mb_substr_count("", "")); + var_dump(@mb_substr_count("¤¢", "")); + var_dump(@mb_substr_count("", "¤¢")); + var_dump(@mb_substr_count("", "¤¢")); + var_dump(@mb_substr_count("", chr(0))); - $a = str_repeat("abcacba", 100); - var_dump(@mb_substr_count($a, "bca")); + $a = str_repeat("abcacba", 100); + var_dump(@mb_substr_count($a, "bca")); - $a = str_repeat("¤¢¤¤¤¦¤¢¤¦¤¤¤¢", 100); - $b = "¤¤¤¦¤¢"; - var_dump(@mb_substr_count($a, $b)); + $a = str_repeat("¤¢¤¤¤¦¤¢¤¦¤¤¤¢", 100); + $b = "¤¤¤¦¤¢"; + var_dump(@mb_substr_count($a, $b)); - $to_enc = "UTF-8"; - var_dump(@mb_substr_count(mb_convert_encoding($a, $to_enc), - mb_convert_encoding($b, $to_enc), $to_enc)); + $to_enc = "UTF-8"; + var_dump(@mb_substr_count(mb_convert_encoding($a, $to_enc), + mb_convert_encoding($b, $to_enc), $to_enc)); - $to_enc = "Shift_JIS"; - var_dump(@mb_substr_count(mb_convert_encoding($a, $to_enc), - mb_convert_encoding($b, $to_enc), $to_enc)); + $to_enc = "Shift_JIS"; + var_dump(@mb_substr_count(mb_convert_encoding($a, $to_enc), + mb_convert_encoding($b, $to_enc), $to_enc)); - $a = str_repeat("abcacbabca", 100); - var_dump(@mb_substr_count($a, "bca")); + $a = str_repeat("abcacbabca", 100); + var_dump(@mb_substr_count($a, "bca")); ?> --EXPECT-- bool(false) diff --git a/ext/mbstring/tests/mb_substr_variation4.phpt b/ext/mbstring/tests/mb_substr_variation4.phpt index c31af9b9ef..aac0a20c0d 100644 --- a/ext/mbstring/tests/mb_substr_variation4.phpt +++ b/ext/mbstring/tests/mb_substr_variation4.phpt @@ -29,21 +29,21 @@ $string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXv * 60 is larger than *BYTE* count for $string_mb */ for ($i = -60; $i <= 60; $i += 10) { - if (@$a || @$b) { - $a = null; - $b = null; - } - echo "\n**-- Offset is: $i --**\n"; - echo "-- ASCII String --\n"; - $a = mb_substr($string_ascii, $i, 4); - var_dump(base64_encode($a)); - echo "--Multibyte String --\n"; - $b = mb_substr($string_mb, $i, 4, 'UTF-8'); - if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length - var_dump(base64_encode($b)); - } else { - echo "Difference in length of ASCII string and multibyte string\n"; - } + if (@$a || @$b) { + $a = null; + $b = null; + } + echo "\n**-- Offset is: $i --**\n"; + echo "-- ASCII String --\n"; + $a = mb_substr($string_ascii, $i, 4); + var_dump(base64_encode($a)); + echo "--Multibyte String --\n"; + $b = mb_substr($string_mb, $i, 4, 'UTF-8'); + if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length + var_dump(base64_encode($b)); + } else { + echo "Difference in length of ASCII string and multibyte string\n"; + } } diff --git a/ext/mbstring/tests/mb_substr_variation5.phpt b/ext/mbstring/tests/mb_substr_variation5.phpt index 94231a4624..5ede679251 100644 --- a/ext/mbstring/tests/mb_substr_variation5.phpt +++ b/ext/mbstring/tests/mb_substr_variation5.phpt @@ -30,21 +30,21 @@ $string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXv * 60 is larger than *BYTE* count for $string_mb */ for ($i = -60; $i <= 60; $i += 10) { - if (@$a || @$b) { - $a = null; - $b = null; - } - echo "\n**-- Offset is: $i --**\n"; - echo "-- ASCII String --\n"; - $a = mb_substr($string_ascii, 1, $i); - var_dump(base64_encode($a)); - echo "--Multibyte String --\n"; - $b = mb_substr($string_mb, 1, $i, 'UTF-8'); - if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length - var_dump(base64_encode($b)); - } else { - echo "Difference in length of ASCII string and multibyte string\n"; - } + if (@$a || @$b) { + $a = null; + $b = null; + } + echo "\n**-- Offset is: $i --**\n"; + echo "-- ASCII String --\n"; + $a = mb_substr($string_ascii, 1, $i); + var_dump(base64_encode($a)); + echo "--Multibyte String --\n"; + $b = mb_substr($string_mb, 1, $i, 'UTF-8'); + if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length + var_dump(base64_encode($b)); + } else { + echo "Difference in length of ASCII string and multibyte string\n"; + } } diff --git a/ext/mbstring/tests/mb_substr_variation6.phpt b/ext/mbstring/tests/mb_substr_variation6.phpt index 172ab962b0..8b186fa00a 100644 --- a/ext/mbstring/tests/mb_substr_variation6.phpt +++ b/ext/mbstring/tests/mb_substr_variation6.phpt @@ -29,26 +29,26 @@ $string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXv * 60 is larger than *BYTE* count for $string_mb */ for ($i = -60; $i <= 60; $i += 10) { - if (@$a || @$b) { - $a = null; - $b = null; - } - echo "\n**-- Offset is: $i --**\n"; - echo "-- ASCII String --\n"; - $a = mb_substr($string_ascii, $i, 4); - if ($a !== false) { - var_dump(bin2hex($a)); - } - else { - var_dump($a); - } - echo "--Multibyte String --\n"; - $b = mb_substr($string_mb, $i, 4, 'UTF-8'); - if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length - var_dump(bin2hex($b)); - } else { - echo "Difference in length of ASCII string and multibyte string\n"; - } + if (@$a || @$b) { + $a = null; + $b = null; + } + echo "\n**-- Offset is: $i --**\n"; + echo "-- ASCII String --\n"; + $a = mb_substr($string_ascii, $i, 4); + if ($a !== false) { + var_dump(bin2hex($a)); + } + else { + var_dump($a); + } + echo "--Multibyte String --\n"; + $b = mb_substr($string_mb, $i, 4, 'UTF-8'); + if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length + var_dump(bin2hex($b)); + } else { + echo "Difference in length of ASCII string and multibyte string\n"; + } } diff --git a/ext/mbstring/tests/mb_substr_variation7.phpt b/ext/mbstring/tests/mb_substr_variation7.phpt index 909393177e..243d7065d5 100644 --- a/ext/mbstring/tests/mb_substr_variation7.phpt +++ b/ext/mbstring/tests/mb_substr_variation7.phpt @@ -30,26 +30,26 @@ $string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXv * 60 is larger than *BYTE* count for $string_mb */ for ($i = -60; $i <= 60; $i += 10) { - if (@$a || @$b) { - $a = null; - $b = null; - } - echo "\n**-- Offset is: $i --**\n"; - echo "-- ASCII String --\n"; - $a = mb_substr($string_ascii, 1, $i); - if ($a !== false) { - var_dump(bin2hex($a)); - } - else { - var_dump($a); - } - echo "--Multibyte String --\n"; - $b = mb_substr($string_mb, 1, $i, 'UTF-8'); - if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length - var_dump(bin2hex($b)); - } else { - echo "Difference in length of ASCII string and multibyte string\n"; - } + if (@$a || @$b) { + $a = null; + $b = null; + } + echo "\n**-- Offset is: $i --**\n"; + echo "-- ASCII String --\n"; + $a = mb_substr($string_ascii, 1, $i); + if ($a !== false) { + var_dump(bin2hex($a)); + } + else { + var_dump($a); + } + echo "--Multibyte String --\n"; + $b = mb_substr($string_mb, 1, $i, 'UTF-8'); + if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length + var_dump(bin2hex($b)); + } else { + echo "Difference in length of ASCII string and multibyte string\n"; + } } diff --git a/ext/mbstring/tests/zend_multibyte-01.phpt b/ext/mbstring/tests/zend_multibyte-01.phpt index aae944de35..6f8aab373d 100644 --- a/ext/mbstring/tests/zend_multibyte-01.phpt +++ b/ext/mbstring/tests/zend_multibyte-01.phpt @@ -8,12 +8,12 @@ zend.script_encoding=Shift_JIS internal_encoding=Shift_JIS --FILE-- <?php - function —\Ž\”\($ˆø”) - { - echo $ˆø”; - } + function —\Ž\”\($ˆø”) + { + echo $ˆø”; + } - —\Ž\”\("ƒhƒŒƒ~ƒtƒ@ƒ\"); + —\Ž\”\("ƒhƒŒƒ~ƒtƒ@ƒ\"); ?> --EXPECT-- ƒhƒŒƒ~ƒtƒ@ƒ\ diff --git a/ext/mbstring/tests/zend_multibyte-11.phpt b/ext/mbstring/tests/zend_multibyte-11.phpt index c5e02eeae3..a1a589433c 100644 --- a/ext/mbstring/tests/zend_multibyte-11.phpt +++ b/ext/mbstring/tests/zend_multibyte-11.phpt @@ -7,8 +7,8 @@ zend.multibyte=1 --FILE-- <?php declare(encoding="ISO-8859-15") { - declare(encoding="ISO-8859-1"); - echo "ok\n"; + declare(encoding="ISO-8859-1"); + echo "ok\n"; } ?> --EXPECTF-- diff --git a/ext/mbstring/tests/zend_multibyte-15.phpt b/ext/mbstring/tests/zend_multibyte-15.phpt index b24ed25fb2..7f552041a6 100644 --- a/ext/mbstring/tests/zend_multibyte-15.phpt +++ b/ext/mbstring/tests/zend_multibyte-15.phpt @@ -7,10 +7,10 @@ zend.multibyte=1 --FILE-- <?php declare(encoding="ISO-8859-15") { - echo "ok\n"; + echo "ok\n"; } declare(encoding="UTF-8") { - echo "ok\n"; + echo "ok\n"; } ?> --EXPECT-- diff --git a/ext/mbstring/tests/zend_multibyte-16.phpt b/ext/mbstring/tests/zend_multibyte-16.phpt index a9b0920184..0fa0a8e9b2 100644 --- a/ext/mbstring/tests/zend_multibyte-16.phpt +++ b/ext/mbstring/tests/zend_multibyte-16.phpt @@ -7,7 +7,7 @@ zend.multibyte=1 --FILE-- <?php declare(encoding="ISO-8859-15") { - echo "ok\n"; + echo "ok\n"; } echo "ok\n"; ?> diff --git a/ext/mysqli/tests/001.phpt b/ext/mysqli/tests/001.phpt index f7a72aea05..f8ddc8a38d 100644 --- a/ext/mysqli/tests/001.phpt +++ b/ext/mysqli/tests/001.phpt @@ -8,55 +8,55 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - $test = ""; - - /*** test mysqli_connect localhost:port ***/ - $link = my_mysqli_connect($host, $user, $passwd, "", $port, $socket); - $test .= ($link) ? "1" : "0"; - mysqli_close($link); - - /*** test mysqli_real_connect ***/ - $link = mysqli_init(); - $test.= (my_mysqli_real_connect($link, $host, $user, $passwd, "", $port, $socket) ) - ? "1" : "0"; - mysqli_close($link); - - /*** test mysqli_real_connect with db ***/ - $link = mysqli_init(); - $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) - ? "1" : "0"; - mysqli_close($link); - - /*** test mysqli_real_connect with port ***/ - $link = mysqli_init(); - $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) - ? "1":"0"; - mysqli_close($link); - - /* temporary addition for Kent's setup, Win32 box */ - for ($i = 0; $i < 10; $i++) { - if (!$link = mysqli_init()) - printf("[001 + %d] mysqli_init() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error()); - - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) - printf("[002 + %d] mysqli_real_connect() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error()); - - mysqli_close($link); - } - - /*** test mysqli_real_connect compressed ***/ - /* - $link = mysqli_init(); - $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS)) - ? "1" : "0"; - mysqli_close($link); + require_once("connect.inc"); + + $test = ""; + + /*** test mysqli_connect localhost:port ***/ + $link = my_mysqli_connect($host, $user, $passwd, "", $port, $socket); + $test .= ($link) ? "1" : "0"; + mysqli_close($link); + + /*** test mysqli_real_connect ***/ + $link = mysqli_init(); + $test.= (my_mysqli_real_connect($link, $host, $user, $passwd, "", $port, $socket) ) + ? "1" : "0"; + mysqli_close($link); + + /*** test mysqli_real_connect with db ***/ + $link = mysqli_init(); + $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) + ? "1" : "0"; + mysqli_close($link); + + /*** test mysqli_real_connect with port ***/ + $link = mysqli_init(); + $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) + ? "1":"0"; + mysqli_close($link); + + /* temporary addition for Kent's setup, Win32 box */ + for ($i = 0; $i < 10; $i++) { + if (!$link = mysqli_init()) + printf("[001 + %d] mysqli_init() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error()); + + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) + printf("[002 + %d] mysqli_real_connect() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error()); + + mysqli_close($link); + } + + /*** test mysqli_real_connect compressed ***/ + /* + $link = mysqli_init(); + $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS)) + ? "1" : "0"; + mysqli_close($link); */ - /* todo ssl connections */ + /* todo ssl connections */ - var_dump($test); - print "done!"; + var_dump($test); + print "done!"; ?> --EXPECTF-- %s(4) "1111" diff --git a/ext/mysqli/tests/002.phpt b/ext/mysqli/tests/002.phpt index 1c98577454..0960da7a98 100644 --- a/ext/mysqli/tests/002.phpt +++ b/ext/mysqli/tests/002.phpt @@ -7,44 +7,44 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + /*** test mysqli_connect 127.0.0.1 ***/ + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null")) - printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null")) + printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link,"CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint, - col3 int, col4 bigint, - col5 float, col6 double, - col7 date, col8 time, - col9 varbinary(10), - col10 varchar(50), - col11 char(20)) ENGINE=" . $engine); + $rc = mysqli_query($link,"CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint, + col3 int, col4 bigint, + col5 float, col6 double, + col7 date, col8 time, + col9 varbinary(10), + col10 varchar(50), + col11 char(20)) ENGINE=" . $engine); - if (!$rc) - printf("[003] Cannot create table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$rc) + printf("[003] Cannot create table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link, "INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)"); - if (!$rc) - printf("[004] Cannot insert records, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $rc = mysqli_query($link, "INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)"); + if (!$rc) + printf("[004] Cannot insert records, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null ORDER BY col1"); - mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11); - mysqli_stmt_execute($stmt); + $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null ORDER BY col1"); + mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11); + mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - @mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + @mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/003.phpt b/ext/mysqli/tests/003.phpt index c526dfbdff..faf3407bd7 100644 --- a/ext/mysqli/tests/003.phpt +++ b/ext/mysqli/tests/003.phpt @@ -7,70 +7,70 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_query($link, "SET sql_mode=''"); + mysqli_query($link, "SET sql_mode=''"); - if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = @mysqli_query($link,"CREATE TABLE test_bind_result( - c1 date, - c2 time, - c3 timestamp(14), - c4 year, - c5 datetime, - c6 timestamp(4), - c7 timestamp(6)) ENGINE=" . $engine); + $rc = @mysqli_query($link,"CREATE TABLE test_bind_result( + c1 date, + c2 time, + c3 timestamp(14), + c4 year, + c5 datetime, + c6 timestamp(4), + c7 timestamp(6)) ENGINE=" . $engine); - /* - Seems that not all MySQL 6.0 installations use defaults that ignore the display widths. - From the manual: - From MySQL 4.1.0 on, TIMESTAMP display format differs from that of earlier MySQL releases: - [...] - Display widths (used as described in the preceding section) are no longer supported. - In other words, for declarations such as TIMESTAMP(2), TIMESTAMP(4), and so on, - the display width is ignored. - [...] - */ - if (!$rc) - $rc = @mysqli_query($link,"CREATE TABLE test_bind_result( - c1 date, - c2 time, - c3 timestamp, - c4 year, - c5 datetime, - c6 timestamp, - c7 timestamp) ENGINE=" . $engine); + /* + Seems that not all MySQL 6.0 installations use defaults that ignore the display widths. + From the manual: + From MySQL 4.1.0 on, TIMESTAMP display format differs from that of earlier MySQL releases: + [...] + Display widths (used as described in the preceding section) are no longer supported. + In other words, for declarations such as TIMESTAMP(2), TIMESTAMP(4), and so on, + the display width is ignored. + [...] + */ + if (!$rc) + $rc = @mysqli_query($link,"CREATE TABLE test_bind_result( + c1 date, + c2 time, + c3 timestamp, + c4 year, + c5 datetime, + c6 timestamp, + c7 timestamp) ENGINE=" . $engine); - if (!$rc) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$rc) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link, "INSERT INTO test_bind_result VALUES( - '2002-01-02', - '12:49:00', - '2002-01-02 17:46:59', - 2010, - '2010-07-10', - '2020','1999-12-29')"); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $rc = mysqli_query($link, "INSERT INTO test_bind_result VALUES( + '2002-01-02', + '12:49:00', + '2002-01-02 17:46:59', + 2010, + '2010-07-10', + '2020','1999-12-29')"); + if (!$rc) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result"); - mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result"); + mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/004.phpt b/ext/mysqli/tests/004.phpt index e19d4c3119..0c246e0b2b 100644 --- a/ext/mysqli/tests/004.phpt +++ b/ext/mysqli/tests/004.phpt @@ -7,48 +7,48 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - include ("connect.inc"); + include ("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine)) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine)) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test0')")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test0')")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567891', 'this is a test1')")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567891', 'this is a test1')")) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567892', 'this is a test2')")) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567892', 'this is a test2')")) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567893', 'this is a test3')")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567893', 'this is a test3')")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch ORDER BY c1")) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch ORDER BY c1")) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $c1 = $c2 = NULL; - mysqli_stmt_bind_result($stmt, $c1, $c2); - mysqli_stmt_execute($stmt); - $i = 4; - while ($i--) { - mysqli_stmt_fetch($stmt); - $test = array($c1, $c2); - var_dump($test); - } + $c1 = $c2 = NULL; + mysqli_stmt_bind_result($stmt, $c1, $c2); + mysqli_stmt_execute($stmt); + $i = 4; + while ($i--) { + mysqli_stmt_fetch($stmt); + $test = array($c1, $c2); + var_dump($test); + } - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/005.phpt b/ext/mysqli/tests/005.phpt index e1f5be989f..2dffee80c2 100644 --- a/ext/mysqli/tests/005.phpt +++ b/ext/mysqli/tests/005.phpt @@ -7,38 +7,38 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine)) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine)) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $a = str_repeat("A1", 32000); + $a = str_repeat("A1", 32000); - mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', '$a')"); + mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', '$a')"); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_stmt_bind_result($stmt, $c1, $c2); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); + mysqli_stmt_bind_result($stmt, $c1, $c2); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test[] = $c1; - $test[] = ($a == $c2) ? "32K String ok" : "32K String failed"; + $test[] = $c1; + $test[] = ($a == $c2) ? "32K String ok" : "32K String failed"; - var_dump($test); + var_dump($test); - /* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */ - mysqli_stmt_fetch($stmt); + /* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */ + mysqli_stmt_fetch($stmt); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/006.phpt b/ext/mysqli/tests/006.phpt index d60c52fbde..5e0443a9fb 100644 --- a/ext/mysqli/tests/006.phpt +++ b/ext/mysqli/tests/006.phpt @@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!mysqli_query($link, "SET sql_mode=''")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "SET sql_mode=''")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned, - c2 int unsigned, - c3 int, - c4 int, - c5 int, - c6 int unsigned, - c7 int) ENGINE=" . $engine); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned, + c2 int unsigned, + c3 int, + c4 int, + c5 int, + c6 int unsigned, + c7 int) ENGINE=" . $engine); + if (!$rc) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,-0,0)")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,-0,0)")) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); + mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/007.phpt b/ext/mysqli/tests/007.phpt index 86c7fc2e57..b510d8d8a3 100644 --- a/ext/mysqli/tests/007.phpt +++ b/ext/mysqli/tests/007.phpt @@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!mysqli_query($link, "SET sql_mode=''")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "SET sql_mode=''")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 smallint unsigned, - c2 smallint unsigned, - c3 smallint, - c4 smallint, - c5 smallint, - c6 smallint unsigned, - c7 smallint) ENGINE=" . $engine); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 smallint unsigned, + c2 smallint unsigned, + c3 smallint, + c4 smallint, + c5 smallint, + c6 smallint unsigned, + c7 smallint) ENGINE=" . $engine); + if (!$rc) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,+30,0)")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,+30,0)")) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); + mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/008.phpt b/ext/mysqli/tests/008.phpt index f36e524d11..412c3641e5 100644 --- a/ext/mysqli/tests/008.phpt +++ b/ext/mysqli/tests/008.phpt @@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!mysqli_query($link, "SET sql_mode=''")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "SET sql_mode=''")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 tinyint, - c2 tinyint unsigned, - c3 tinyint not NULL, - c4 tinyint, - c5 tinyint, - c6 tinyint unsigned, - c7 tinyint) ENGINE=" . $engine); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 tinyint, + c2 tinyint unsigned, + c3 tinyint not NULL, + c4 tinyint, + c5 tinyint, + c6 tinyint unsigned, + c7 tinyint) ENGINE=" . $engine); + if (!$rc) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)")) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); + mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/009.phpt b/ext/mysqli/tests/009.phpt index 906c0f027b..187ac3f9a3 100644 --- a/ext/mysqli/tests/009.phpt +++ b/ext/mysqli/tests/009.phpt @@ -11,72 +11,72 @@ mysqli fetch bigint values (ok to fail with 4.1.x) ?> --FILE-- <?php - require_once("connect.inc"); - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - - if (!mysqli_query($link, "SET sql_mode=''")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 bigint default 5, - c2 bigint, - c3 bigint not NULL, - c4 bigint unsigned, - c5 bigint unsigned, - c6 bigint unsigned, - c7 bigint unsigned, - c8 bigint unsigned) ENGINE=" . $engine); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $rc = mysqli_query($link, "INSERT INTO test_bind_fetch (c2,c3,c4,c5,c6,c7,c8) ". - "VALUES (-23,4.0,33333333333333,0,-333333333333,99.9,1234)"); - if (!$rc) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8); - mysqli_stmt_execute($stmt); - $rc = mysqli_stmt_fetch($stmt); - - if (mysqli_get_server_version($link) < 50000) { - // 4.1 is faulty and will return big number for $c6 - if ($c6 == "18446743740376218283") { - $c6 = 0; - } - } - $c8 = 4567;// change this to test how mysqli/mysqlnd handles is_ref changing - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8); - - var_dump($test); - - mysqli_stmt_close($stmt); - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint")) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_uint(c1 integer unsigned, c2 integer unsigned) ENGINE=" . $engine); - if (!$rc) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, "INSERT INTO test_bind_fetch_uint (c1,c2) VALUES (20123456, 3123456789)")) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_uint"); - mysqli_stmt_bind_result($stmt, $c1, $c2); - mysqli_stmt_execute($stmt); - $rc = mysqli_stmt_fetch($stmt); - - echo $c1, "\n", $c2, "\n"; - - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint"); - mysqli_close($link); - print "done!"; + require_once("connect.inc"); + + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + + if (!mysqli_query($link, "SET sql_mode=''")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 bigint default 5, + c2 bigint, + c3 bigint not NULL, + c4 bigint unsigned, + c5 bigint unsigned, + c6 bigint unsigned, + c7 bigint unsigned, + c8 bigint unsigned) ENGINE=" . $engine); + if (!$rc) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $rc = mysqli_query($link, "INSERT INTO test_bind_fetch (c2,c3,c4,c5,c6,c7,c8) ". + "VALUES (-23,4.0,33333333333333,0,-333333333333,99.9,1234)"); + if (!$rc) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); + mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8); + mysqli_stmt_execute($stmt); + $rc = mysqli_stmt_fetch($stmt); + + if (mysqli_get_server_version($link) < 50000) { + // 4.1 is faulty and will return big number for $c6 + if ($c6 == "18446743740376218283") { + $c6 = 0; + } + } + $c8 = 4567;// change this to test how mysqli/mysqlnd handles is_ref changing + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8); + + var_dump($test); + + mysqli_stmt_close($stmt); + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint")) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_uint(c1 integer unsigned, c2 integer unsigned) ENGINE=" . $engine); + if (!$rc) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, "INSERT INTO test_bind_fetch_uint (c1,c2) VALUES (20123456, 3123456789)")) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_uint"); + mysqli_stmt_bind_result($stmt, $c1, $c2); + mysqli_stmt_execute($stmt); + $rc = mysqli_stmt_fetch($stmt); + + echo $c1, "\n", $c2, "\n"; + + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/010.phpt b/ext/mysqli/tests/010.phpt index b1712ca2a6..3b55d0801c 100644 --- a/ext/mysqli/tests/010.phpt +++ b/ext/mysqli/tests/010.phpt @@ -9,44 +9,44 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!mysqli_query($link, "SET sql_mode=''")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "SET sql_mode=''")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 float(3), - c2 float, - c3 float unsigned, - c4 float, - c5 float, - c6 float, - c7 float(10) unsigned) ENGINE=" . $engine); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 float(3), + c2 float, + c3 float unsigned, + c4 float, + c5 float, + c6 float, + c7 float(10) unsigned) ENGINE=" . $engine); + if (!$rc) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999, - sin(0.6), 1.00000000000001, 888888888888888)"); + mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999, + sin(0.6), 1.00000000000001, 888888888888888)"); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); + mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/011.phpt b/ext/mysqli/tests/011.phpt index 1792fec6a2..4be6fe62c5 100644 --- a/ext/mysqli/tests/011.phpt +++ b/ext/mysqli/tests/011.phpt @@ -9,41 +9,41 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, - c3 int, c4 bigint, - c5 float, c6 double, - c7 varbinary(10), - c8 varchar(50)) ENGINE=" . $engine); - if (!$rc) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, + c3 int, c4 bigint, + c5 float, c6 double, + c7 varbinary(10), + c8 varchar(50)) ENGINE=" . $engine); + if (!$rc) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999, - 2345.6,5678.89563, - 'foobar','mysql rulez')"); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $rc = mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999, + 2345.6,5678.89563, + 'foobar','mysql rulez')"); + if (!$rc) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); - mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); + mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/012.phpt b/ext/mysqli/tests/012.phpt index 2d8c6500ec..c2981a206c 100644 --- a/ext/mysqli/tests/012.phpt +++ b/ext/mysqli/tests/012.phpt @@ -9,40 +9,40 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, - c3 int, c4 bigint, - c5 float, c6 double, - c7 varbinary(10), - c8 varchar(10)) ENGINE=" . $engine); - if (!$rc) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, + c3 int, c4 bigint, + c5 float, c6 double, + c7 varbinary(10), + c8 varchar(10)) ENGINE=" . $engine); + if (!$rc) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54, - 2.6,58.89, - '206','6.7')")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54, + 2.6,58.89, + '206','6.7')")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); - mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); + mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/013.phpt b/ext/mysqli/tests/013.phpt index 21fd278489..2361622c46 100644 --- a/ext/mysqli/tests/013.phpt +++ b/ext/mysqli/tests/013.phpt @@ -7,54 +7,54 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, - c3 int, c4 bigint, - c5 decimal(4,2), c6 double, - c7 varbinary(10), - c8 varchar(10)) ENGINE=" . $engine); - if (!$rc) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, + c3 int, c4 bigint, + c5 decimal(4,2), c6 double, + c7 varbinary(10), + c8 varchar(10)) ENGINE=" . $engine); + if (!$rc) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54, - 2.6,58.89, - '206','6.7')")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54, + 2.6,58.89, + '206','6.7')")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); - $c = array(0,0,0,0,0,0,0,0); - $b_res= mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); - mysqli_stmt_fetch($stmt); - mysqli_stmt_close($stmt); + $c = array(0,0,0,0,0,0,0,0); + $b_res= mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); + mysqli_stmt_fetch($stmt); + mysqli_stmt_close($stmt); - $result = mysqli_query($link, "select * from test_bind_result"); - $d = mysqli_fetch_row($result); - mysqli_free_result($result); + $result = mysqli_query($link, "select * from test_bind_result"); + $d = mysqli_fetch_row($result); + mysqli_free_result($result); - $test = ""; - for ($i=0; $i < count($c); $i++) - $test .= ($c[$i] == $d[$i]) ? "1" : "0"; - if ($test == "11111111") - echo "ok\n"; - else if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 && - mysqli_get_server_version($link) > 50000) - echo "error (4.1 library with 5.x server)"; - else - echo "error"; + $test = ""; + for ($i=0; $i < count($c); $i++) + $test .= ($c[$i] == $d[$i]) ? "1" : "0"; + if ($test == "11111111") + echo "ok\n"; + else if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 && + mysqli_get_server_version($link) > 50000) + echo "error (4.1 library with 5.x server)"; + else + echo "error"; - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"); - mysqli_close($link); - print "done!"; + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/014.phpt b/ext/mysqli/tests/014.phpt index 576b337b57..cb100001c5 100644 --- a/ext/mysqli/tests/014.phpt +++ b/ext/mysqli/tests/014.phpt @@ -15,66 +15,66 @@ mysqli autocommit/commit/rollback ?> --FILE-- <?php - require_once("connect.inc"); - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + require_once("connect.inc"); + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!mysqli_autocommit($link, TRUE)) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_autocommit($link, TRUE)) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "CREATE TABLE test(a int, b varchar(10)) engine=InnoDB")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "CREATE TABLE test(a int, b varchar(10)) engine=InnoDB")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')")) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_autocommit($link, FALSE)) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_autocommit($link, FALSE)) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "DELETE FROM test")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DELETE FROM test")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')")) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')")) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_rollback($link)) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_rollback($link)) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$result = mysqli_query($link, "SELECT * FROM test")) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$result = mysqli_query($link, "SELECT * FROM test")) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - printf("Num_of_rows=%d\n", mysqli_num_rows($result)); - if (!$row = mysqli_fetch_row($result)) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + printf("Num_of_rows=%d\n", mysqli_num_rows($result)); + if (!$row = mysqli_fetch_row($result)) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($result); + mysqli_free_result($result); - var_dump($row); + var_dump($row); - if (!mysqli_query($link, "DELETE FROM test")) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DELETE FROM test")) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')")) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')")) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_commit($link)) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_commit($link)) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$result = mysqli_query($link, "SELECT * FROM test")) - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$result = mysqli_query($link, "SELECT * FROM test")) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_row($result)) - printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_row($result)) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($result); + mysqli_free_result($result); - var_dump($row); + var_dump($row); - mysqli_query($link, "DROP TABLE IF EXISTS test"); - mysqli_close($link); - print "done!"; + mysqli_query($link, "DROP TABLE IF EXISTS test"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/015.phpt b/ext/mysqli/tests/015.phpt index 0d2b44d7d3..099fcff24e 100644 --- a/ext/mysqli/tests/015.phpt +++ b/ext/mysqli/tests/015.phpt @@ -14,65 +14,65 @@ mysqli autocommit/commit/rollback with innodb ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!$link) - printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + if (!$link) + printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (!mysqli_select_db($link, $db)) - printf("[002] Cannot select DB '%s', [%d] %s\n", $db, - mysqli_errno($link), mysqli_error($link)); + if (!mysqli_select_db($link, $db)) + printf("[002] Cannot select DB '%s', [%d] %s\n", $db, + mysqli_errno($link), mysqli_error($link)); - if (!mysqli_autocommit($link, TRUE)) - printf("[003] Cannot turn on autocommit mode, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); + if (!mysqli_autocommit($link, TRUE)) + printf("[003] Cannot turn on autocommit mode, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link,"DROP TABLE IF EXISTS test") || - !mysqli_query($link,"CREATE TABLE test(a int, b varchar(10)) Engine=InnoDB") || - !mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')")) - printf("[004] Cannot create test data, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link,"DROP TABLE IF EXISTS test") || + !mysqli_query($link,"CREATE TABLE test(a int, b varchar(10)) Engine=InnoDB") || + !mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')")) + printf("[004] Cannot create test data, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); - if (!mysqli_autocommit($link, FALSE)) - printf("[005] Cannot turn off autocommit mode, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); + if (!mysqli_autocommit($link, FALSE)) + printf("[005] Cannot turn off autocommit mode, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "DELETE FROM test") || - !mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')")) - printf("[006] Cannot modify test data, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DELETE FROM test") || + !mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')")) + printf("[006] Cannot modify test data, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); - if (!mysqli_rollback($link)) - printf("[007] Cannot call rollback, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); + if (!mysqli_rollback($link)) + printf("[007] Cannot call rollback, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); - $result = mysqli_query($link, "SELECT SQL_NO_CACHE * FROM test"); - if (!$result) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $row = mysqli_fetch_row($result); - mysqli_free_result($result); + $result = mysqli_query($link, "SELECT SQL_NO_CACHE * FROM test"); + if (!$result) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $row = mysqli_fetch_row($result); + mysqli_free_result($result); - var_dump($row); + var_dump($row); - if (!mysqli_query($link, "DELETE FROM test") || - !mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')")) - printf("[009] Cannot modify test data, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DELETE FROM test") || + !mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')")) + printf("[009] Cannot modify test data, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); - mysqli_commit($link); + mysqli_commit($link); - $result = mysqli_query($link, "SELECT * FROM test"); - if (!$result) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $row = mysqli_fetch_row($result); - mysqli_free_result($result); + $result = mysqli_query($link, "SELECT * FROM test"); + if (!$result) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $row = mysqli_fetch_row($result); + mysqli_free_result($result); - var_dump($row); + var_dump($row); - mysqli_query($link, "DROP TABLE IF EXISTS test"); - mysqli_close($link); - print "done!"; + mysqli_query($link, "DROP TABLE IF EXISTS test"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/016.phpt b/ext/mysqli/tests/016.phpt index b534f7d455..14fa02df73 100644 --- a/ext/mysqli/tests/016.phpt +++ b/ext/mysqli/tests/016.phpt @@ -7,26 +7,26 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!mysqli_query($link, "SET @dummy='foobar'")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "SET @dummy='foobar'")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$stmt = mysqli_prepare($link, "SELECT @dummy")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_prepare($link, "SELECT @dummy")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_bind_result($stmt, $dummy); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + mysqli_stmt_bind_result($stmt, $dummy); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - var_dump($dummy); + var_dump($dummy); - mysqli_stmt_close($stmt); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_close($link); + print "done!"; ?> --EXPECT-- string(6) "foobar" diff --git a/ext/mysqli/tests/017.phpt b/ext/mysqli/tests/017.phpt index 7196ad48c6..0a1903abf8 100644 --- a/ext/mysqli/tests/017.phpt +++ b/ext/mysqli/tests/017.phpt @@ -8,28 +8,28 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!$stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_bind_result($stmt, $c0, $c1, $c2); - mysqli_stmt_execute($stmt); + mysqli_stmt_bind_result($stmt, $c0, $c1, $c2); + mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_fetch($stmt); + mysqli_stmt_close($stmt); - $test = array($c0, $c1, $c2); - if ($c1 !== $db) { - echo "Different data\n"; - } + $test = array($c0, $c1, $c2); + if ($c1 !== $db) { + echo "Different data\n"; + } - var_dump($test); - mysqli_close($link); - print "done!"; + var_dump($test); + mysqli_close($link); + print "done!"; ?> --EXPECTF-- array(3) { diff --git a/ext/mysqli/tests/018.phpt b/ext/mysqli/tests/018.phpt index 8b3c960924..87a9746949 100644 --- a/ext/mysqli/tests/018.phpt +++ b/ext/mysqli/tests/018.phpt @@ -7,26 +7,26 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!mysqli_query($link, "SET AUTOCOMMIT=0")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "SET AUTOCOMMIT=0")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$stmt = mysqli_prepare($link, "SELECT @@autocommit")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_prepare($link, "SELECT @@autocommit")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_bind_result($stmt, $c0); - mysqli_stmt_execute($stmt); + mysqli_stmt_bind_result($stmt, $c0); + mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + mysqli_stmt_fetch($stmt); - var_dump($c0); + var_dump($c0); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECT-- int(0) diff --git a/ext/mysqli/tests/019.phpt b/ext/mysqli/tests/019.phpt index 4688ff9f8a..d35b162cd7 100644 --- a/ext/mysqli/tests/019.phpt +++ b/ext/mysqli/tests/019.phpt @@ -7,53 +7,53 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link,"CREATE TABLE insert_read(col1 tinyint, col2 smallint, - col3 int, col4 bigint, - col5 float, col6 double, - col7 date, col8 time, - col9 varbinary(10), - col10 varchar(50), - col11 char(20)) ENGINE=" . $engine); - if (!$rc) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $rc = mysqli_query($link,"CREATE TABLE insert_read(col1 tinyint, col2 smallint, + col3 int, col4 bigint, + col5 float, col6 double, + col7 date, col8 time, + col9 varbinary(10), + col10 varchar(50), + col11 char(20)) ENGINE=" . $engine); + if (!$rc) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$stmt = mysqli_prepare($link, "INSERT INTO insert_read(col1,col10, col11, col6) VALUES (?,?,?,?)")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_prepare($link, "INSERT INTO insert_read(col1,col10, col11, col6) VALUES (?,?,?,?)")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_bind_param($stmt, "issd", $c1, $c2, $c3, $c4); + mysqli_stmt_bind_param($stmt, "issd", $c1, $c2, $c3, $c4); - $c1 = 1; - $c2 = "foo"; - $c3 = "foobar"; - $c4 = 3.14; + $c1 = 1; + $c2 = "foo"; + $c3 = "foobar"; + $c4 = 3.14; - mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); - if (!$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 FROM insert_read")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 FROM insert_read")) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11); - mysqli_stmt_execute($stmt); + mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11); + mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS insert_read"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS insert_read"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/020.phpt b/ext/mysqli/tests/020.phpt index 57016de4b8..f1409248c2 100644 --- a/ext/mysqli/tests/020.phpt +++ b/ext/mysqli/tests/020.phpt @@ -7,65 +7,65 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); - mysqli_query($link, "SET sql_mode=''"); + mysqli_select_db($link, $db); + mysqli_query($link, "SET sql_mode=''"); - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"); + mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"); - $rc = @mysqli_query($link,"CREATE TABLE test_bind_result( - c1 date, - c2 time, - c3 timestamp(14), - c4 year, - c5 datetime, - c6 timestamp(4), - c7 timestamp(6))"); + $rc = @mysqli_query($link,"CREATE TABLE test_bind_result( + c1 date, + c2 time, + c3 timestamp(14), + c4 year, + c5 datetime, + c6 timestamp(4), + c7 timestamp(6))"); - if (!$rc) - $rc = mysqli_query($link,"CREATE TABLE test_bind_result( - c1 date, - c2 time, - c3 timestamp, - c4 year, - c5 datetime, - c6 timestamp, - c7 timestamp)"); + if (!$rc) + $rc = mysqli_query($link,"CREATE TABLE test_bind_result( + c1 date, + c2 time, + c3 timestamp, + c4 year, + c5 datetime, + c6 timestamp, + c7 timestamp)"); - $stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)"); - mysqli_stmt_bind_param($stmt, "sssssss", $d1, $d2, $d3, $d4, $d5, $d6, $d7); + $stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)"); + mysqli_stmt_bind_param($stmt, "sssssss", $d1, $d2, $d3, $d4, $d5, $d6, $d7); - $d1 = "2002-01-02"; - $d2 = "12:49:00"; - $d3 = "2002-01-02 17:46:59"; - $d4 = "2010"; - $d5 = "2010-07-10"; - $d6 = "2020"; - $d7 = "1999-12-29"; + $d1 = "2002-01-02"; + $d2 = "12:49:00"; + $d3 = "2002-01-02 17:46:59"; + $d4 = "2010"; + $d5 = "2010-07-10"; + $d6 = "2020"; + $d7 = "1999-12-29"; - mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); - $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result"); + $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result"); - mysqli_stmt_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7); + mysqli_stmt_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"); - mysqli_close($link); + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/021.phpt b/ext/mysqli/tests/021.phpt index d9cf52eddc..3fa3b9a5cc 100644 --- a/ext/mysqli/tests/021.phpt +++ b/ext/mysqli/tests/021.phpt @@ -7,36 +7,36 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)"); + mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)"); - $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)"); - mysqli_stmt_bind_param($stmt, "ss", $q1, $q2); - $q1 = "1234567890"; - $q2 = "this is a test"; - mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); + $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)"); + mysqli_stmt_bind_param($stmt, "ss", $q1, $q2); + $q1 = "1234567890"; + $q2 = "this is a test"; + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_stmt_bind_result($stmt, $c1, $c2); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); + mysqli_stmt_bind_result($stmt, $c1, $c2); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2); + $test = array($c1,$c2); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/022.phpt b/ext/mysqli/tests/022.phpt index fd8036fd1a..d12ba4aff9 100644 --- a/ext/mysqli/tests/022.phpt +++ b/ext/mysqli/tests/022.phpt @@ -7,41 +7,41 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)"); + mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)"); - $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)"); - mysqli_stmt_bind_param($stmt, "ss", $a1, $a2); + $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)"); + mysqli_stmt_bind_param($stmt, "ss", $a1, $a2); - $a1 = "1234567890"; - $a2 = str_repeat("A1", 32000); + $a1 = "1234567890"; + $a2 = str_repeat("A1", 32000); - mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_stmt_bind_result($stmt, $c1, $c2); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); + mysqli_stmt_bind_result($stmt, $c1, $c2); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test[] = $c1; - $test[] = ($a2 == $c2) ? "32K String ok" : "32K String failed"; + $test[] = $c1; + $test[] = ($a2 == $c2) ? "32K String ok" : "32K String failed"; - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_close($link); + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/023.phpt b/ext/mysqli/tests/023.phpt index 17a8abce77..7c22704d44 100644 --- a/ext/mysqli/tests/023.phpt +++ b/ext/mysqli/tests/023.phpt @@ -7,50 +7,50 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); - mysqli_query($link, "SET sql_mode=''"); + mysqli_select_db($link, $db); + mysqli_query($link, "SET sql_mode=''"); - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned, - c2 int unsigned, - c3 int, - c4 int, - c5 int, - c6 int unsigned, - c7 int)"); + mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned, + c2 int unsigned, + c3 int, + c4 int, + c5 int, + c6 int unsigned, + c7 int)"); - $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)"); - mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); - $c1 = -23; - $c2 = 35999; - $c3 = NULL; - $c4 = -500; - $c5 = -9999999; - $c6 = -0; - $c7 = 0; + $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)"); + mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); + $c1 = -23; + $c2 = 35999; + $c3 = NULL; + $c4 = -500; + $c5 = -9999999; + $c6 = -0; + $c7 = 0; - mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); + mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_close($link); + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/024.phpt b/ext/mysqli/tests/024.phpt index 5294a24883..5be231c27d 100644 --- a/ext/mysqli/tests/024.phpt +++ b/ext/mysqli/tests/024.phpt @@ -7,50 +7,50 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); - mysqli_query($link, "SET sql_mode=''"); + mysqli_select_db($link, $db); + mysqli_query($link, "SET sql_mode=''"); - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned, - c2 smallint unsigned, - c3 smallint, - c4 smallint, - c5 smallint, - c6 smallint unsigned, - c7 smallint)"); + mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned, + c2 smallint unsigned, + c3 smallint, + c4 smallint, + c5 smallint, + c6 smallint unsigned, + c7 smallint)"); - $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)"); - mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); + $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)"); + mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); - $c1 = -23; - $c2 = 35999; - $c3 = NULL; - $c4 = -500; - $c5 = -9999999; - $c6 = -0; - $c7 = 0; + $c1 = -23; + $c2 = 35999; + $c3 = NULL; + $c4 = -500; + $c5 = -9999999; + $c6 = -0; + $c7 = 0; - mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); + mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/025.phpt b/ext/mysqli/tests/025.phpt index 3b472f9513..6e300890d7 100644 --- a/ext/mysqli/tests/025.phpt +++ b/ext/mysqli/tests/025.phpt @@ -7,55 +7,55 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); - mysqli_query($link, "SET sql_mode=''"); + mysqli_select_db($link, $db); + mysqli_query($link, "SET sql_mode=''"); - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint, - c2 tinyint unsigned, - c3 tinyint not NULL, - c4 tinyint, - c5 tinyint, - c6 tinyint unsigned, - c7 tinyint)"); + mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint, + c2 tinyint unsigned, + c3 tinyint not NULL, + c4 tinyint, + c5 tinyint, + c6 tinyint unsigned, + c7 tinyint)"); - $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)"); - mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); + $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)"); + mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); - $c1 = -23; - $c2 = 300; - $c3 = 0; - $c4 = -100; - $c5 = -127; - $c6 = 30; - $c7 = 0; + $c1 = -23; + $c2 = 300; + $c3 = 0; + $c4 = -100; + $c5 = -127; + $c6 = 30; + $c7 = 0; - mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); - mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)"); + mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)"); - $c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL; + $c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL; - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); + mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_close($link); + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/026.phpt b/ext/mysqli/tests/026.phpt index 51b2b774bb..1db5f5af84 100644 --- a/ext/mysqli/tests/026.phpt +++ b/ext/mysqli/tests/026.phpt @@ -7,42 +7,42 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); - mysqli_query($link, "SET sql_mode=''"); + mysqli_select_db($link, $db); + mysqli_query($link, "SET sql_mode=''"); - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2 text)"); + mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2 text)"); - $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES (?,?)"); - mysqli_stmt_bind_param($stmt, "sb", $c1, $c2); + $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES (?,?)"); + mysqli_stmt_bind_param($stmt, "sb", $c1, $c2); - $c1 = "Hello World"; + $c1 = "Hello World"; - mysqli_stmt_send_long_data($stmt, 1, "This is the first sentence."); - mysqli_stmt_send_long_data($stmt, 1, " And this is the second sentence."); - mysqli_stmt_send_long_data($stmt, 1, " And finally this is the last sentence."); + mysqli_stmt_send_long_data($stmt, 1, "This is the first sentence."); + mysqli_stmt_send_long_data($stmt, 1, " And this is the second sentence."); + mysqli_stmt_send_long_data($stmt, 1, " And finally this is the last sentence."); - mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_stmt_bind_result($stmt, $d1, $d2); - mysqli_stmt_execute($stmt); - mysqli_stmt_fetch($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); + mysqli_stmt_bind_result($stmt, $d1, $d2); + mysqli_stmt_execute($stmt); + mysqli_stmt_fetch($stmt); - $test = array($d1,$d2); + $test = array($d1,$d2); - var_dump($test); + var_dump($test); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/027.phpt b/ext/mysqli/tests/027.phpt index f4d985a744..918a6c4483 100644 --- a/ext/mysqli/tests/027.phpt +++ b/ext/mysqli/tests/027.phpt @@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $status = mysqli_stat($link); + $status = mysqli_stat($link); - var_dump(strlen($status) > 0); + var_dump(strlen($status) > 0); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECT-- bool(true) diff --git a/ext/mysqli/tests/028.phpt b/ext/mysqli/tests/028.phpt index e8d3835374..9b71d4d3da 100644 --- a/ext/mysqli/tests/028.phpt +++ b/ext/mysqli/tests/028.phpt @@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $cset = substr(mysqli_character_set_name($link),0,6); + $cset = substr(mysqli_character_set_name($link),0,6); - var_dump($cset); + var_dump($cset); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECTF-- string(%d) "%s" diff --git a/ext/mysqli/tests/029.phpt b/ext/mysqli/tests/029.phpt index cf59999eaf..0ed2517227 100644 --- a/ext/mysqli/tests/029.phpt +++ b/ext/mysqli/tests/029.phpt @@ -7,24 +7,24 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link, "DROP TABLE IF EXISTS general_test"); - mysqli_query($link, "CREATE TABLE general_test (a INT)"); - mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)"); + mysqli_query($link, "DROP TABLE IF EXISTS general_test"); + mysqli_query($link, "CREATE TABLE general_test (a INT)"); + mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)"); - $afc = mysqli_affected_rows($link); + $afc = mysqli_affected_rows($link); - var_dump($afc); + var_dump($afc); - mysqli_query($link, "DROP TABLE IF EXISTS general_test"); - mysqli_close($link); - print "done!"; + mysqli_query($link, "DROP TABLE IF EXISTS general_test"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/030.phpt b/ext/mysqli/tests/030.phpt index e51aec3734..5705a90f91 100644 --- a/ext/mysqli/tests/030.phpt +++ b/ext/mysqli/tests/030.phpt @@ -7,22 +7,22 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $errno = mysqli_errno($link); - var_dump($errno); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + $errno = mysqli_errno($link); + var_dump($errno); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link, "SELECT * FROM non_exisiting_table"); - $errno = mysqli_errno($link); + mysqli_query($link, "SELECT * FROM non_exisiting_table"); + $errno = mysqli_errno($link); - var_dump($errno); + var_dump($errno); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECT-- int(0) diff --git a/ext/mysqli/tests/031.phpt b/ext/mysqli/tests/031.phpt index 8518b45a3e..e230e7974c 100644 --- a/ext/mysqli/tests/031.phpt +++ b/ext/mysqli/tests/031.phpt @@ -7,22 +7,22 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $error = mysqli_error($link); - var_dump($error); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + $error = mysqli_error($link); + var_dump($error); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link, "SELECT * FROM non_exisiting_table"); - $error = mysqli_error($link); + mysqli_query($link, "SELECT * FROM non_exisiting_table"); + $error = mysqli_error($link); - var_dump($error); + var_dump($error); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECTF-- string(0) "" diff --git a/ext/mysqli/tests/032.phpt b/ext/mysqli/tests/032.phpt index 27d8fb3fa5..660950d6f1 100644 --- a/ext/mysqli/tests/032.phpt +++ b/ext/mysqli/tests/032.phpt @@ -7,24 +7,24 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link, "DROP TABLE IF EXISTS general_test"); - mysqli_query($link, "CREATE TABLE general_test (a INT)"); - mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)"); + mysqli_query($link, "DROP TABLE IF EXISTS general_test"); + mysqli_query($link, "CREATE TABLE general_test (a INT)"); + mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)"); - $afc = mysqli_info($link); + $afc = mysqli_info($link); - var_dump($afc); + var_dump($afc); - mysqli_query($link, "DROP TABLE IF EXISTS general_test"); - mysqli_close($link); - print "done!"; + mysqli_query($link, "DROP TABLE IF EXISTS general_test"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/033.phpt b/ext/mysqli/tests/033.phpt index 2ac4896432..b5c4e3046b 100644 --- a/ext/mysqli/tests/033.phpt +++ b/ext/mysqli/tests/033.phpt @@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $hinfo = mysqli_get_host_info($link); + $hinfo = mysqli_get_host_info($link); - var_dump(str_replace('/','', $hinfo)); + var_dump(str_replace('/','', $hinfo)); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECTF-- string(%d) "%s via %s" diff --git a/ext/mysqli/tests/034.phpt b/ext/mysqli/tests/034.phpt index 1eae37e1a5..f6e19ce551 100644 --- a/ext/mysqli/tests/034.phpt +++ b/ext/mysqli/tests/034.phpt @@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $pinfo = mysqli_get_proto_info($link); + $pinfo = mysqli_get_proto_info($link); - var_dump($pinfo); + var_dump($pinfo); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECT-- int(10) diff --git a/ext/mysqli/tests/035.phpt b/ext/mysqli/tests/035.phpt index 8e755b9846..0f2421f629 100644 --- a/ext/mysqli/tests/035.phpt +++ b/ext/mysqli/tests/035.phpt @@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $sinfo = substr(mysqli_get_server_info($link),0,1); + $sinfo = substr(mysqli_get_server_info($link),0,1); - var_dump(strlen($sinfo)); + var_dump(strlen($sinfo)); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECT-- int(1) diff --git a/ext/mysqli/tests/036.phpt b/ext/mysqli/tests/036.phpt index 919625c8cd..af6d81d64e 100644 --- a/ext/mysqli/tests/036.phpt +++ b/ext/mysqli/tests/036.phpt @@ -11,36 +11,36 @@ function test: mysqli_insert_id() ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link, "DROP TABLE IF EXISTS t036"); - mysqli_query($link, "CREATE TABLE t036 (a bigint not null auto_increment primary key, b varchar(10)) ENGINE = " . $engine); + mysqli_query($link, "DROP TABLE IF EXISTS t036"); + mysqli_query($link, "CREATE TABLE t036 (a bigint not null auto_increment primary key, b varchar(10)) ENGINE = " . $engine); - mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo1')"); - $test[] = mysqli_insert_id($link); + mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo1')"); + $test[] = mysqli_insert_id($link); - /* we have to insert more values, cause lexer sets auto_increment to max_int - see mysql bug #54. So we don't check for the value, only for type (which must - be type string) - */ + /* we have to insert more values, cause lexer sets auto_increment to max_int + see mysql bug #54. So we don't check for the value, only for type (which must + be type string) + */ - mysqli_query($link, "ALTER TABLE t036 AUTO_INCREMENT=9999999999999998"); - mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo2')"); - mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo3')"); - mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo4')"); - $x = mysqli_insert_id($link); - $test[] = is_string($x); + mysqli_query($link, "ALTER TABLE t036 AUTO_INCREMENT=9999999999999998"); + mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo2')"); + mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo3')"); + mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo4')"); + $x = mysqli_insert_id($link); + $test[] = is_string($x); - var_dump($test); + var_dump($test); - mysqli_query($link, "DROP TABLE IF EXISTS t036"); - mysqli_close($link); - print "done!"; + mysqli_query($link, "DROP TABLE IF EXISTS t036"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/037.phpt b/ext/mysqli/tests/037.phpt index 5826a9834e..7c6f72cb69 100644 --- a/ext/mysqli/tests/037.phpt +++ b/ext/mysqli/tests/037.phpt @@ -8,29 +8,29 @@ require_once('skipifconnectfailure.inc'); --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link, "DROP TABLE IF EXISTS test_result"); + mysqli_query($link, "DROP TABLE IF EXISTS test_result"); - mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine); + mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine); - mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')"); - $ir[] = mysqli_field_count($link); + mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')"); + $ir[] = mysqli_field_count($link); - mysqli_real_query($link, "SELECT * FROM test_result"); - $ir[] = mysqli_field_count($link); + mysqli_real_query($link, "SELECT * FROM test_result"); + $ir[] = mysqli_field_count($link); - var_dump($ir); + var_dump($ir); - mysqli_query($link, "DROP TABLE IF EXISTS test_result"); - mysqli_close($link); - print "done!"; + mysqli_query($link, "DROP TABLE IF EXISTS test_result"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/038.phpt b/ext/mysqli/tests/038.phpt index 45b724ca3c..63d7e3ee32 100644 --- a/ext/mysqli/tests/038.phpt +++ b/ext/mysqli/tests/038.phpt @@ -7,30 +7,30 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link, "DROP TABLE IF EXISTS test_result"); + mysqli_query($link, "DROP TABLE IF EXISTS test_result"); - mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine); + mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine); - mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')"); + mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')"); - mysqli_real_query($link, "SELECT * FROM test_result"); - if (mysqli_field_count($link)) { - $result = mysqli_store_result($link); - $num = mysqli_num_fields($result); - mysqli_free_result($result); - } + mysqli_real_query($link, "SELECT * FROM test_result"); + if (mysqli_field_count($link)) { + $result = mysqli_store_result($link); + $num = mysqli_num_fields($result); + mysqli_free_result($result); + } - var_dump($num); + var_dump($num); - mysqli_query($link, "DROP TABLE IF EXISTS test_result"); - mysqli_close($link); + mysqli_query($link, "DROP TABLE IF EXISTS test_result"); + mysqli_close($link); ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/039.phpt b/ext/mysqli/tests/039.phpt index bde6460d97..186811660d 100644 --- a/ext/mysqli/tests/039.phpt +++ b/ext/mysqli/tests/039.phpt @@ -7,23 +7,23 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_real_query($link, "SHOW VARIABLES"); + mysqli_real_query($link, "SHOW VARIABLES"); - if (mysqli_field_count($link)) { - $result = mysqli_store_result($link); - $num = mysqli_num_fields($result); - mysqli_free_result($result); - } + if (mysqli_field_count($link)) { + $result = mysqli_store_result($link); + $num = mysqli_num_fields($result); + mysqli_free_result($result); + } - var_dump($num); + var_dump($num); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECT-- int(2) diff --git a/ext/mysqli/tests/040.phpt b/ext/mysqli/tests/040.phpt index a860f30d81..782cbe57ad 100644 --- a/ext/mysqli/tests/040.phpt +++ b/ext/mysqli/tests/040.phpt @@ -7,29 +7,29 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link, "DROP TABLE IF EXISTS test_result"); - mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE=" . $engine); - mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')"); + mysqli_query($link, "DROP TABLE IF EXISTS test_result"); + mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE=" . $engine); + mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')"); - mysqli_real_query($link, "SELECT * FROM test_result"); - if (mysqli_field_count($link)) { - $result = mysqli_store_result($link); - $num = mysqli_num_rows($result); - mysqli_free_result($result); - } + mysqli_real_query($link, "SELECT * FROM test_result"); + if (mysqli_field_count($link)) { + $result = mysqli_store_result($link); + $num = mysqli_num_rows($result); + mysqli_free_result($result); + } - var_dump($num); + var_dump($num); - mysqli_query($link, "DROP TABLE IF EXISTS test_result"); - mysqli_close($link); - print "done!"; + mysqli_query($link, "DROP TABLE IF EXISTS test_result"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/041.phpt b/ext/mysqli/tests/041.phpt index 86ddd67069..645a82e419 100644 --- a/ext/mysqli/tests/041.phpt +++ b/ext/mysqli/tests/041.phpt @@ -8,19 +8,19 @@ require_once('skipifconnectfailure.inc'); --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + mysqli_select_db($link, $db); - mysqli_query($link, "DROP TABLE IF EXISTS test_warnings"); - mysqli_query($link, "DROP TABLE IF EXISTS test_warnings"); + mysqli_query($link, "DROP TABLE IF EXISTS test_warnings"); + mysqli_query($link, "DROP TABLE IF EXISTS test_warnings"); - var_dump(mysqli_warning_count($link)); + var_dump(mysqli_warning_count($link)); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/042.phpt b/ext/mysqli/tests/042.phpt index e84dfc2a10..8b46049cb8 100644 --- a/ext/mysqli/tests/042.phpt +++ b/ext/mysqli/tests/042.phpt @@ -7,46 +7,46 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); - mysqli_query($link, "SET sql_mode=''"); + mysqli_select_db($link, $db); + mysqli_query($link, "SET sql_mode=''"); - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned, - c2 smallint unsigned, - c3 smallint, - c4 smallint, - c5 smallint, - c6 smallint unsigned, - c7 smallint) ENGINE=" . $engine); + mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned, + c2 smallint unsigned, + c3 smallint, + c4 smallint, + c5 smallint, + c6 smallint unsigned, + c7 smallint) ENGINE=" . $engine); - $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)"); - mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); + $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)"); + mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); - $c1 = -23; - $c2 = 35999; - $c3 = NULL; - $c4 = -500; - $c5 = -9999999; - $c6 = -0; - $c7 = 0; + $c1 = -23; + $c2 = 35999; + $c3 = NULL; + $c4 = -500; + $c5 = -9999999; + $c6 = -0; + $c7 = 0; - mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); - $result = mysqli_query($link, "SELECT * FROM test_bind_fetch"); - $test = mysqli_fetch_object($result); - mysqli_free_result($result); + $result = mysqli_query($link, "SELECT * FROM test_bind_fetch"); + $test = mysqli_fetch_object($result); + mysqli_free_result($result); - var_dump($test); + var_dump($test); - mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_close($link); - print "done!" + mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); + mysqli_close($link); + print "done!" ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/043.phpt b/ext/mysqli/tests/043.phpt index daf79ebbe4..2e265d7c51 100644 --- a/ext/mysqli/tests/043.phpt +++ b/ext/mysqli/tests/043.phpt @@ -7,38 +7,38 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link,"DROP TABLE IF EXISTS test_update"); - mysqli_query($link,"CREATE TABLE test_update(a varchar(10), - b int) ENGINE=" . $engine); + mysqli_query($link,"DROP TABLE IF EXISTS test_update"); + mysqli_query($link,"CREATE TABLE test_update(a varchar(10), + b int) ENGINE=" . $engine); - mysqli_query($link, "INSERT INTO test_update VALUES ('foo', 2)"); + mysqli_query($link, "INSERT INTO test_update VALUES ('foo', 2)"); - $stmt = mysqli_prepare($link, "UPDATE test_update SET a=?,b=? WHERE b=?"); - mysqli_stmt_bind_param($stmt, "sii", $c1, $c2, $c3); + $stmt = mysqli_prepare($link, "UPDATE test_update SET a=?,b=? WHERE b=?"); + mysqli_stmt_bind_param($stmt, "sii", $c1, $c2, $c3); - $c1 = "Rasmus"; - $c2 = 1; - $c3 = 2; + $c1 = "Rasmus"; + $c2 = 1; + $c3 = 2; - mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); - $result = mysqli_query($link, "SELECT concat(a, ' is No. ', b) FROM test_update"); - $test = mysqli_fetch_row($result); - mysqli_free_result($result); + $result = mysqli_query($link, "SELECT concat(a, ' is No. ', b) FROM test_update"); + $test = mysqli_fetch_row($result); + mysqli_free_result($result); - var_dump($test); + var_dump($test); - mysqli_query($link, "DROP TABLE IF EXISTS test_update"); - mysqli_close($link); - print "done!"; + mysqli_query($link, "DROP TABLE IF EXISTS test_update"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/044.phpt b/ext/mysqli/tests/044.phpt index 7dbbbb20a2..91d93d7482 100644 --- a/ext/mysqli/tests/044.phpt +++ b/ext/mysqli/tests/044.phpt @@ -7,19 +7,19 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $i = mysqli_get_server_version($link); + $i = mysqli_get_server_version($link); - $test = $i / $i; + $test = $i / $i; - var_dump($test); + var_dump($test); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECT-- int(1) diff --git a/ext/mysqli/tests/045.phpt b/ext/mysqli/tests/045.phpt index 0b7b68239c..10773ace1b 100644 --- a/ext/mysqli/tests/045.phpt +++ b/ext/mysqli/tests/045.phpt @@ -20,23 +20,23 @@ mysqli_stmt_bind_result (SHOW) ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'"); - mysqli_stmt_execute($stmt); + $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'"); + mysqli_stmt_execute($stmt); - mysqli_stmt_bind_result($stmt, $c1, $c2); - mysqli_stmt_fetch($stmt); - mysqli_stmt_close($stmt); - $test = array ($c1,$c2); + mysqli_stmt_bind_result($stmt, $c1, $c2); + mysqli_stmt_fetch($stmt); + mysqli_stmt_close($stmt); + $test = array ($c1,$c2); - var_dump($test); + var_dump($test); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECTF-- array(2) { diff --git a/ext/mysqli/tests/046.phpt b/ext/mysqli/tests/046.phpt index 8e4b8c3b2c..0a64386db2 100644 --- a/ext/mysqli/tests/046.phpt +++ b/ext/mysqli/tests/046.phpt @@ -7,32 +7,32 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link, "DROP TABLE IF EXISTS test_affected"); - mysqli_query($link, "CREATE TABLE test_affected (foo int) ENGINE=" . $engine); + mysqli_query($link, "DROP TABLE IF EXISTS test_affected"); + mysqli_query($link, "CREATE TABLE test_affected (foo int) ENGINE=" . $engine); - mysqli_query($link, "INSERT INTO test_affected VALUES (1),(2),(3),(4),(5)"); + mysqli_query($link, "INSERT INTO test_affected VALUES (1),(2),(3),(4),(5)"); - $stmt = mysqli_prepare($link, "DELETE FROM test_affected WHERE foo=?"); - mysqli_stmt_bind_param($stmt, "i", $c1); + $stmt = mysqli_prepare($link, "DELETE FROM test_affected WHERE foo=?"); + mysqli_stmt_bind_param($stmt, "i", $c1); - $c1 = 2; + $c1 = 2; - mysqli_stmt_execute($stmt); - $x = mysqli_stmt_affected_rows($stmt); + mysqli_stmt_execute($stmt); + $x = mysqli_stmt_affected_rows($stmt); - mysqli_stmt_close($stmt); - var_dump($x==1); + mysqli_stmt_close($stmt); + var_dump($x==1); - mysqli_query($link, "DROP TABLE IF EXISTS test_affected"); - mysqli_close($link); - print "done!"; + mysqli_query($link, "DROP TABLE IF EXISTS test_affected"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/047.phpt b/ext/mysqli/tests/047.phpt index a89488fa58..4a2c9590cf 100644 --- a/ext/mysqli/tests/047.phpt +++ b/ext/mysqli/tests/047.phpt @@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link, "DROP TABLE IF EXISTS test_affected"); - mysqli_query($link, "CREATE TABLE test_affected (foo int, bar varchar(10) character set latin1) ENGINE=" . $engine); + mysqli_query($link, "DROP TABLE IF EXISTS test_affected"); + mysqli_query($link, "CREATE TABLE test_affected (foo int, bar varchar(10) character set latin1) ENGINE=" . $engine); - mysqli_query($link, "INSERT INTO test_affected VALUES (1, 'Zak'),(2, 'Greant')"); + mysqli_query($link, "INSERT INTO test_affected VALUES (1, 'Zak'),(2, 'Greant')"); - $stmt = mysqli_prepare($link, "SELECT * FROM test_affected"); - mysqli_stmt_execute($stmt); - $result = mysqli_stmt_result_metadata($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_affected"); + mysqli_stmt_execute($stmt); + $result = mysqli_stmt_result_metadata($stmt); - echo "\n=== fetch_fields ===\n"; - var_dump(mysqli_fetch_fields($result)); + echo "\n=== fetch_fields ===\n"; + var_dump(mysqli_fetch_fields($result)); - echo "\n=== fetch_field_direct ===\n"; - var_dump(mysqli_fetch_field_direct($result, 0)); - var_dump(mysqli_fetch_field_direct($result, 1)); + echo "\n=== fetch_field_direct ===\n"; + var_dump(mysqli_fetch_field_direct($result, 0)); + var_dump(mysqli_fetch_field_direct($result, 1)); - echo "\n=== fetch_field ===\n"; - while ($field = mysqli_fetch_field($result)) { - var_dump($field); - } + echo "\n=== fetch_field ===\n"; + while ($field = mysqli_fetch_field($result)) { + var_dump($field); + } - print_r(mysqli_fetch_lengths($result)); + print_r(mysqli_fetch_lengths($result)); - mysqli_free_result($result); + mysqli_free_result($result); - mysqli_stmt_close($stmt); - mysqli_query($link, "DROP TABLE IF EXISTS test_affected"); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_query($link, "DROP TABLE IF EXISTS test_affected"); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/048.phpt b/ext/mysqli/tests/048.phpt index 9328e0e282..20271e43fb 100644 --- a/ext/mysqli/tests/048.phpt +++ b/ext/mysqli/tests/048.phpt @@ -7,38 +7,38 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $mysql->select_db($db); - $mysql->query("DROP TABLE IF EXISTS test_fetch_null"); + $mysql->select_db($db); + $mysql->query("DROP TABLE IF EXISTS test_fetch_null"); - $mysql->query("CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint, - col3 int, col4 bigint, - col5 float, col6 double, - col7 date, col8 time, - col9 varbinary(10), - col10 varchar(50), - col11 char(20)) ENGINE=" . $engine); + $mysql->query("CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint, + col3 int, col4 bigint, + col5 float, col6 double, + col7 date, col8 time, + col9 varbinary(10), + col10 varchar(50), + col11 char(20)) ENGINE=" . $engine); - $mysql->query("INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)"); + $mysql->query("INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)"); - $stmt = $mysql->prepare("SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null"); - $stmt->bind_result($c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11); - $stmt->execute(); + $stmt = $mysql->prepare("SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null"); + $stmt->bind_result($c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11); + $stmt->execute(); - $stmt->fetch(); + $stmt->fetch(); - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11); + $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11); - var_dump($test); + var_dump($test); - $stmt->close(); - $mysql->query("DROP TABLE IF EXISTS test_fetch_null"); - $mysql->close(); - print "done!"; + $stmt->close(); + $mysql->query("DROP TABLE IF EXISTS test_fetch_null"); + $mysql->close(); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/049.phpt b/ext/mysqli/tests/049.phpt index 7128de8d38..733518609f 100644 --- a/ext/mysqli/tests/049.phpt +++ b/ext/mysqli/tests/049.phpt @@ -8,22 +8,22 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $mysql->select_db($db); - $result = $mysql->query("SELECT DATABASE()"); - $row = $result->fetch_row(); - $result->close(); + $mysql->select_db($db); + $result = $mysql->query("SELECT DATABASE()"); + $row = $result->fetch_row(); + $result->close(); - var_dump($row); - if ($row[0] != $db) - printf("[001] Expecting '%s' got '%s'\n", $db, $row[0]); + var_dump($row); + if ($row[0] != $db) + printf("[001] Expecting '%s' got '%s'\n", $db, $row[0]); - $mysql->close(); - print "done!"; + $mysql->close(); + print "done!"; ?> --EXPECTF-- array(1) { diff --git a/ext/mysqli/tests/050.phpt b/ext/mysqli/tests/050.phpt index 448f164be1..c51c7bc1d2 100644 --- a/ext/mysqli/tests/050.phpt +++ b/ext/mysqli/tests/050.phpt @@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /************************ - * non freed stamement - ************************/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /************************ + * non freed stamement + ************************/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $stmt = mysqli_prepare($link, "SELECT CURRENT_USER()"); - mysqli_stmt_execute($stmt); + $stmt = mysqli_prepare($link, "SELECT CURRENT_USER()"); + mysqli_stmt_execute($stmt); - mysqli_close($link); - printf("Ok\n"); + mysqli_close($link); + printf("Ok\n"); ?> --EXPECT-- Ok diff --git a/ext/mysqli/tests/051.phpt b/ext/mysqli/tests/051.phpt index 4a766fb34d..239f8cbcf0 100644 --- a/ext/mysqli/tests/051.phpt +++ b/ext/mysqli/tests/051.phpt @@ -7,19 +7,19 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /************************ - * free statement after close - ************************/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /************************ + * free statement after close + ************************/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $stmt1 = mysqli_prepare($link, "SELECT CURRENT_USER()"); - mysqli_stmt_execute($stmt1); + $stmt1 = mysqli_prepare($link, "SELECT CURRENT_USER()"); + mysqli_stmt_execute($stmt1); - mysqli_close($link); - @mysqli_stmt_close($stmt1); - printf("Ok\n"); + mysqli_close($link); + @mysqli_stmt_close($stmt1); + printf("Ok\n"); ?> --EXPECT-- Ok diff --git a/ext/mysqli/tests/052.phpt b/ext/mysqli/tests/052.phpt index 1d131f1428..e079bc508b 100644 --- a/ext/mysqli/tests/052.phpt +++ b/ext/mysqli/tests/052.phpt @@ -7,19 +7,19 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /************************ - * statement call after close - ************************/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /************************ + * statement call after close + ************************/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()"); + $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()"); - mysqli_close($link); - @mysqli_stmt_execute($stmt2); - @mysqli_stmt_close($stmt2); - printf("Ok\n"); + mysqli_close($link); + @mysqli_stmt_execute($stmt2); + @mysqli_stmt_close($stmt2); + printf("Ok\n"); ?> --EXPECT-- Ok diff --git a/ext/mysqli/tests/053.phpt b/ext/mysqli/tests/053.phpt index a1840c9726..4aac61514a 100644 --- a/ext/mysqli/tests/053.phpt +++ b/ext/mysqli/tests/053.phpt @@ -7,16 +7,16 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /************************ - * non freed resultset - ************************/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /************************ + * non freed resultset + ************************/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $result = mysqli_query($link, "SELECT CURRENT_USER()"); - mysqli_close($link); - printf("Ok\n"); + $result = mysqli_query($link, "SELECT CURRENT_USER()"); + mysqli_close($link); + printf("Ok\n"); ?> --EXPECT-- diff --git a/ext/mysqli/tests/054.phpt b/ext/mysqli/tests/054.phpt index 6bd45a7c4b..b06d5edc3a 100644 --- a/ext/mysqli/tests/054.phpt +++ b/ext/mysqli/tests/054.phpt @@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /************************ - * free resultset after close - ************************/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /************************ + * free resultset after close + ************************/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $result1 = mysqli_query($link, "SELECT CURRENT_USER()"); - mysqli_close($link); - mysqli_free_result($result1); - printf("Ok\n"); + $result1 = mysqli_query($link, "SELECT CURRENT_USER()"); + mysqli_close($link); + mysqli_free_result($result1); + printf("Ok\n"); ?> --EXPECT-- Ok diff --git a/ext/mysqli/tests/055.phpt b/ext/mysqli/tests/055.phpt index c73266e748..7b6339afaf 100644 --- a/ext/mysqli/tests/055.phpt +++ b/ext/mysqli/tests/055.phpt @@ -7,16 +7,16 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /************************ - * don't free anything - ************************/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /************************ + * don't free anything + ************************/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $result2 = mysqli_query($link, "SELECT CURRENT_USER()"); - $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()"); - printf("Ok\n"); + $result2 = mysqli_query($link, "SELECT CURRENT_USER()"); + $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()"); + printf("Ok\n"); ?> --EXPECT-- Ok diff --git a/ext/mysqli/tests/056.phpt b/ext/mysqli/tests/056.phpt index 413e678987..9bb3a0eba9 100644 --- a/ext/mysqli/tests/056.phpt +++ b/ext/mysqli/tests/056.phpt @@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - class foobar extends mysqli { - function test () { - return ("I do not like MySQL 4.1"); - } - } + class foobar extends mysqli { + function test () { + return ("I do not like MySQL 4.1"); + } + } - $foo = new foobar(); - $foo->connect($host, $user, $passwd, $db, $port, $socket); - $foo->close(); - printf("%s\n", $foo->test()); + $foo = new foobar(); + $foo->connect($host, $user, $passwd, $db, $port, $socket); + $foo->close(); + printf("%s\n", $foo->test()); ?> --EXPECT-- I do not like MySQL 4.1 diff --git a/ext/mysqli/tests/057.phpt b/ext/mysqli/tests/057.phpt index a8977be02f..7c4f149c48 100644 --- a/ext/mysqli/tests/057.phpt +++ b/ext/mysqli/tests/057.phpt @@ -7,59 +7,59 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link,"DROP TABLE IF EXISTS test_store_result"); - mysqli_query($link,"CREATE TABLE test_store_result (a int)"); + mysqli_query($link,"DROP TABLE IF EXISTS test_store_result"); + mysqli_query($link,"CREATE TABLE test_store_result (a int)"); - mysqli_query($link, "INSERT INTO test_store_result VALUES (1),(2),(3)"); + mysqli_query($link, "INSERT INTO test_store_result VALUES (1),(2),(3)"); - $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"); - mysqli_stmt_execute($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"); + mysqli_stmt_execute($stmt); - /* this should produce an out of sync error */ - if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) { - mysqli_free_result($result); - printf ("Query ok\n"); - } - mysqli_stmt_close($stmt); + /* this should produce an out of sync error */ + if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) { + mysqli_free_result($result); + printf ("Query ok\n"); + } + mysqli_stmt_close($stmt); - /* now we should try mysqli_stmt_reset() */ - $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"); - var_dump(mysqli_stmt_execute($stmt)); - var_dump(mysqli_stmt_reset($stmt)); + /* now we should try mysqli_stmt_reset() */ + $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"); + var_dump(mysqli_stmt_execute($stmt)); + var_dump(mysqli_stmt_reset($stmt)); - var_dump($stmt = mysqli_prepare($link, "SELECT * FROM test_store_result")); - if ($stmt->affected_rows !== 0) - printf("[001] Expecting 0, got %d\n", $stmt->affected_rows); + var_dump($stmt = mysqli_prepare($link, "SELECT * FROM test_store_result")); + if ($stmt->affected_rows !== 0) + printf("[001] Expecting 0, got %d\n", $stmt->affected_rows); - var_dump(mysqli_stmt_execute($stmt)); - var_dump($stmt = @mysqli_prepare($link, "SELECT * FROM test_store_result"), mysqli_error($link)); + var_dump(mysqli_stmt_execute($stmt)); + var_dump($stmt = @mysqli_prepare($link, "SELECT * FROM test_store_result"), mysqli_error($link)); - $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"); - mysqli_stmt_execute($stmt); - $result1 = mysqli_stmt_result_metadata($stmt); - mysqli_stmt_store_result($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"); + mysqli_stmt_execute($stmt); + $result1 = mysqli_stmt_result_metadata($stmt); + mysqli_stmt_store_result($stmt); - printf ("Rows: %d\n", mysqli_stmt_affected_rows($stmt)); + printf ("Rows: %d\n", mysqli_stmt_affected_rows($stmt)); - /* this should show an error, cause results are not buffered */ - if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) { - $row = mysqli_fetch_row($result); - mysqli_free_result($result); - } + /* this should show an error, cause results are not buffered */ + if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) { + $row = mysqli_fetch_row($result); + mysqli_free_result($result); + } - var_dump($row); + var_dump($row); - mysqli_free_result($result1); - mysqli_stmt_close($stmt); - mysqli_close($link); - echo "done!"; + mysqli_free_result($result1); + mysqli_stmt_close($stmt); + mysqli_close($link); + echo "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/058.phpt b/ext/mysqli/tests/058.phpt index e839e7e64e..596b28569e 100644 --- a/ext/mysqli/tests/058.phpt +++ b/ext/mysqli/tests/058.phpt @@ -7,46 +7,46 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link,"DROP TABLE IF EXISTS mbind"); - mysqli_query($link,"CREATE TABLE mbind (a int, b varchar(10))"); + mysqli_query($link,"DROP TABLE IF EXISTS mbind"); + mysqli_query($link,"CREATE TABLE mbind (a int, b varchar(10))"); - $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?,?)"); + $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?,?)"); - mysqli_stmt_bind_param($stmt, "is", $a, $b); + mysqli_stmt_bind_param($stmt, "is", $a, $b); - $a = 1; - $b = "foo"; + $a = 1; + $b = "foo"; - mysqli_stmt_execute($stmt); + mysqli_stmt_execute($stmt); - mysqli_stmt_bind_param($stmt, "is", $c, $d); + mysqli_stmt_bind_param($stmt, "is", $c, $d); - $c = 2; - $d = "bar"; + $c = 2; + $d = "bar"; - mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); - $stmt = mysqli_prepare($link, "SELECT * FROM mbind"); - mysqli_stmt_execute($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM mbind"); + mysqli_stmt_execute($stmt); - mysqli_stmt_bind_result($stmt, $e, $f); - mysqli_stmt_fetch($stmt); + mysqli_stmt_bind_result($stmt, $e, $f); + mysqli_stmt_fetch($stmt); - mysqli_stmt_bind_result($stmt, $g, $h); - mysqli_stmt_fetch($stmt); + mysqli_stmt_bind_result($stmt, $g, $h); + mysqli_stmt_fetch($stmt); - var_dump((array($e,$f,$g,$h))); + var_dump((array($e,$f,$g,$h))); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/059.phpt b/ext/mysqli/tests/059.phpt index 0632553143..c7f3877201 100644 --- a/ext/mysqli/tests/059.phpt +++ b/ext/mysqli/tests/059.phpt @@ -7,39 +7,39 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); + mysqli_select_db($link, $db); - mysqli_query($link, "SET SQL_MODE='PIPES_AS_CONCAT'"); + mysqli_query($link, "SET SQL_MODE='PIPES_AS_CONCAT'"); - mysqli_query($link,"DROP TABLE IF EXISTS mbind"); - mysqli_query($link,"CREATE TABLE mbind (b varchar(25))"); + mysqli_query($link,"DROP TABLE IF EXISTS mbind"); + mysqli_query($link,"CREATE TABLE mbind (b varchar(25))"); - $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?||?)"); + $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?||?)"); - mysqli_stmt_bind_param($stmt, "ss", $a, $b); + mysqli_stmt_bind_param($stmt, "ss", $a, $b); - $a = "foo"; - $b = "bar"; + $a = "foo"; + $b = "bar"; - mysqli_stmt_execute($stmt); + mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); - $stmt = mysqli_prepare($link, "SELECT * FROM mbind"); - mysqli_stmt_execute($stmt); + $stmt = mysqli_prepare($link, "SELECT * FROM mbind"); + mysqli_stmt_execute($stmt); - mysqli_stmt_bind_result($stmt, $e); - mysqli_stmt_fetch($stmt); + mysqli_stmt_bind_result($stmt, $e); + mysqli_stmt_fetch($stmt); - var_dump($e); + var_dump($e); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/060.phpt b/ext/mysqli/tests/060.phpt index 9043dd7def..22732f4ef1 100644 --- a/ext/mysqli/tests/060.phpt +++ b/ext/mysqli/tests/060.phpt @@ -7,40 +7,40 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - class test_class { - function __construct($arg1, $arg2) { - echo __METHOD__ . "($arg1,$arg2)\n"; - } - } + class test_class { + function __construct($arg1, $arg2) { + echo __METHOD__ . "($arg1,$arg2)\n"; + } + } - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, $db); - mysqli_query($link, "SET sql_mode=''"); + mysqli_select_db($link, $db); + mysqli_query($link, "SET sql_mode=''"); - mysqli_query($link,"DROP TABLE IF EXISTS test_fetch"); - mysqli_query($link,"CREATE TABLE test_fetch(c1 smallint unsigned, - c2 smallint unsigned, - c3 smallint, - c4 smallint, - c5 smallint, - c6 smallint unsigned, - c7 smallint)"); + mysqli_query($link,"DROP TABLE IF EXISTS test_fetch"); + mysqli_query($link,"CREATE TABLE test_fetch(c1 smallint unsigned, + c2 smallint unsigned, + c3 smallint, + c4 smallint, + c5 smallint, + c6 smallint unsigned, + c7 smallint)"); - mysqli_query($link, "INSERT INTO test_fetch VALUES ( -23, 35999, NULL, -500, -9999999, -0, 0)"); + mysqli_query($link, "INSERT INTO test_fetch VALUES ( -23, 35999, NULL, -500, -9999999, -0, 0)"); - $result = mysqli_query($link, "SELECT * FROM test_fetch"); - $test = mysqli_fetch_object($result, 'test_class', array(1, 2)); - mysqli_free_result($result); + $result = mysqli_query($link, "SELECT * FROM test_fetch"); + $test = mysqli_fetch_object($result, 'test_class', array(1, 2)); + mysqli_free_result($result); - var_dump($test); + var_dump($test); - mysqli_close($link); + mysqli_close($link); - echo "Done\n"; + echo "Done\n"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/061.phpt b/ext/mysqli/tests/061.phpt index 0da9c1c09d..0b15b2ea85 100644 --- a/ext/mysqli/tests/061.phpt +++ b/ext/mysqli/tests/061.phpt @@ -21,45 +21,45 @@ mysqli_close($link); mysqli.allow_local_infile=1 --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - function my_read($fp, &$buffer, $buflen, &$error) { - $buffer = strrev(fread($fp, $buflen)); - return(strlen($buffer)); - } + function my_read($fp, &$buffer, $buflen, &$error) { + $buffer = strrev(fread($fp, $buflen)); + return(strlen($buffer)); + } - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - /* create temporary file */ - $filename = __DIR__ . "061.csv"; - $fp = fopen($filename, "w"); - fwrite($fp, "foo;bar"); - fclose($fp); + /* create temporary file */ + $filename = __DIR__ . "061.csv"; + $fp = fopen($filename, "w"); + fwrite($fp, "foo;bar"); + fclose($fp); - if (!mysqli_query($link,"DROP TABLE IF EXISTS t_061")) - printf("Cannot drop table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link,"CREATE TABLE t_061 (c1 varchar(10), c2 varchar(10))")) - printf("Cannot create table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link,"DROP TABLE IF EXISTS t_061")) + printf("Cannot drop table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link,"CREATE TABLE t_061 (c1 varchar(10), c2 varchar(10))")) + printf("Cannot create table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE t_061 FIELDS TERMINATED BY ';'", mysqli_real_escape_string($link, $filename)))) - printf("Cannot load data: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE t_061 FIELDS TERMINATED BY ';'", mysqli_real_escape_string($link, $filename)))) + printf("Cannot load data: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_set_local_infile_handler($link, "my_read"); - if (!mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE t_061 FIELDS TERMINATED BY ';'", mysqli_real_escape_string($link, $filename)))) - printf("Cannot load data using infile handler: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_set_local_infile_handler($link, "my_read"); + if (!mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE t_061 FIELDS TERMINATED BY ';'", mysqli_real_escape_string($link, $filename)))) + printf("Cannot load data using infile handler: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ($result = mysqli_query($link, "SELECT c1,c2 FROM t_061")) { - while (($row = mysqli_fetch_row($result))) { - printf("%s-%s\n", $row[0], $row[1]); - printf("%s-%s\n", gettype($row[0]), gettype($row[1])); - } - mysqli_free_result($result); - } + if ($result = mysqli_query($link, "SELECT c1,c2 FROM t_061")) { + while (($row = mysqli_fetch_row($result))) { + printf("%s-%s\n", $row[0], $row[1]); + printf("%s-%s\n", gettype($row[0]), gettype($row[1])); + } + mysqli_free_result($result); + } - mysqli_close($link); - unlink($filename); - print "done!"; + mysqli_close($link); + unlink($filename); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/062.phpt b/ext/mysqli/tests/062.phpt index b10485d5a2..60472eb16e 100644 --- a/ext/mysqli/tests/062.phpt +++ b/ext/mysqli/tests/062.phpt @@ -7,20 +7,20 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $mysql->real_query("SELECT 'foo' FROM DUAL"); + $mysql->real_query("SELECT 'foo' FROM DUAL"); - $myresult = new mysqli_result($mysql); + $myresult = new mysqli_result($mysql); - $row = $myresult->fetch_row(); - $myresult->close(); - $mysql->close(); + $row = $myresult->fetch_row(); + $myresult->close(); + $mysql->close(); - var_dump($row); - print "done!"; + var_dump($row); + print "done!"; ?> --EXPECT-- array(1) { diff --git a/ext/mysqli/tests/063.phpt b/ext/mysqli/tests/063.phpt index b1d5314278..26bfe48ee5 100644 --- a/ext/mysqli/tests/063.phpt +++ b/ext/mysqli/tests/063.phpt @@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $stmt = new mysqli_stmt($mysql, "SELECT 'foo' FROM DUAL"); - $stmt->execute(); - $stmt->bind_result($foo); - $stmt->fetch(); - $stmt->close(); - $mysql->close(); + $stmt = new mysqli_stmt($mysql, "SELECT 'foo' FROM DUAL"); + $stmt->execute(); + $stmt->bind_result($foo); + $stmt->fetch(); + $stmt->close(); + $mysql->close(); - var_dump($foo); + var_dump($foo); ?> --EXPECT-- string(3) "foo" diff --git a/ext/mysqli/tests/064.phpt b/ext/mysqli/tests/064.phpt index 46af7a6628..b2280ff426 100644 --- a/ext/mysqli/tests/064.phpt +++ b/ext/mysqli/tests/064.phpt @@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $stmt = new mysqli_stmt($mysql, "SELECT NULL FROM DUAL"); - $stmt->execute(); - $stmt->bind_result($foo); - $stmt->fetch(); - $stmt->close(); - $mysql->close(); + $stmt = new mysqli_stmt($mysql, "SELECT NULL FROM DUAL"); + $stmt->execute(); + $stmt->bind_result($foo); + $stmt->fetch(); + $stmt->close(); + $mysql->close(); - var_dump($foo); + var_dump($foo); ?> --EXPECT-- NULL diff --git a/ext/mysqli/tests/065.phpt b/ext/mysqli/tests/065.phpt index 75c4b02a29..2733cdafb0 100644 --- a/ext/mysqli/tests/065.phpt +++ b/ext/mysqli/tests/065.phpt @@ -11,42 +11,42 @@ if (!function_exists('mysqli_set_charset')) { ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + if (!$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (!mysqli_query($mysql, "SET sql_mode=''")) - printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql)); + if (!mysqli_query($mysql, "SET sql_mode=''")) + printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql)); - $esc_str = chr(0xbf) . chr(0x5c); - $len = $charset = array(); - $tmp = null; + $esc_str = chr(0xbf) . chr(0x5c); + $len = $charset = array(); + $tmp = null; - if ($mysql->set_charset("latin1")) { - /* 5C should be escaped */ - if (3 !== ($tmp = strlen($mysql->real_escape_string($esc_str)))) - printf("[003] Expecting 3/int got %s/%s\n", gettype($tmp), $tmp); + if ($mysql->set_charset("latin1")) { + /* 5C should be escaped */ + if (3 !== ($tmp = strlen($mysql->real_escape_string($esc_str)))) + printf("[003] Expecting 3/int got %s/%s\n", gettype($tmp), $tmp); - if ('latin1' !== ($tmp = $mysql->character_set_name())) - printf("[004] Expecting latin1/string got %s/%s\n", gettype($tmp), $tmp); - } + if ('latin1' !== ($tmp = $mysql->character_set_name())) + printf("[004] Expecting latin1/string got %s/%s\n", gettype($tmp), $tmp); + } - if ($res = $mysql->query("SHOW CHARACTER SET LIKE 'gbk'")) { - $res->free_result(); - if ($mysql->set_charset("gbk")) { - /* nothing should be escaped, it's a valid gbk character */ + if ($res = $mysql->query("SHOW CHARACTER SET LIKE 'gbk'")) { + $res->free_result(); + if ($mysql->set_charset("gbk")) { + /* nothing should be escaped, it's a valid gbk character */ - if (2 !== ($tmp = strlen($mysql->real_escape_string($esc_str)))) - printf("[005] Expecting 2/int got %s/%s\n", gettype($tmp), $tmp); + if (2 !== ($tmp = strlen($mysql->real_escape_string($esc_str)))) + printf("[005] Expecting 2/int got %s/%s\n", gettype($tmp), $tmp); - if ('gbk' !== ($tmp = $mysql->character_set_name())) - printf("[005] Expecting gbk/string got %s/%s\n", gettype($tmp), $tmp); - } - } - $mysql->close(); + if ('gbk' !== ($tmp = $mysql->character_set_name())) + printf("[005] Expecting gbk/string got %s/%s\n", gettype($tmp), $tmp); + } + } + $mysql->close(); - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/066.phpt b/ext/mysqli/tests/066.phpt index a337e038c1..678457e934 100644 --- a/ext/mysqli/tests/066.phpt +++ b/ext/mysqli/tests/066.phpt @@ -7,28 +7,28 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - if (!mysqli_query($mysql, "SET sql_mode=''")) - printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql)); + if (!mysqli_query($mysql, "SET sql_mode=''")) + printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql)); - $mysql->query("DROP TABLE IF EXISTS test_warnings"); + $mysql->query("DROP TABLE IF EXISTS test_warnings"); - $mysql->query("CREATE TABLE test_warnings (a int not null) ENGINE=myisam"); + $mysql->query("CREATE TABLE test_warnings (a int not null) ENGINE=myisam"); - $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)"); + $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)"); - if (($warning = $mysql->get_warnings())) { - do { - printf("Warning\n"); - } while ($warning->next()); - } + if (($warning = $mysql->get_warnings())) { + do { + printf("Warning\n"); + } while ($warning->next()); + } - $mysql->close(); - print "done!"; + $mysql->close(); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/067.phpt b/ext/mysqli/tests/067.phpt index e36993bb6b..8698b94c94 100644 --- a/ext/mysqli/tests/067.phpt +++ b/ext/mysqli/tests/067.phpt @@ -19,50 +19,50 @@ function test: nested selects (cursors) ?> --FILE-- <?php - function open_cursor($mysql, $query) { - if (!is_object($stmt = $mysql->prepare($query))) { - printf("[001] Cannot create statement object for '%s', [%d] %s\n", - $query, $mysql->errno, $mysql->error); - } + function open_cursor($mysql, $query) { + if (!is_object($stmt = $mysql->prepare($query))) { + printf("[001] Cannot create statement object for '%s', [%d] %s\n", + $query, $mysql->errno, $mysql->error); + } - $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY); - return $stmt; - } + $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY); + return $stmt; + } - require_once("connect.inc"); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + require_once("connect.inc"); + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - if ((!$IS_MYSQLND && mysqli_get_client_version() < 50009) || - (mysqli_get_server_version($mysql) < 50009)) { - /* we really want to skip it... */ - die(var_dump(63)); - } + if ((!$IS_MYSQLND && mysqli_get_client_version() < 50009) || + (mysqli_get_server_version($mysql) < 50009)) { + /* we really want to skip it... */ + die(var_dump(63)); + } - $a = array(); + $a = array(); - for ($i=0;$i < 3; $i++) { - $mysql->query("DROP TABLE IF EXISTS cursor$i"); - $mysql->query("CREATE TABLE cursor$i (a int not null) ENGINE=" . $engine); - $mysql->query("INSERT INTO cursor$i VALUES (1),(2),(3),(4),(5),(6)"); - $stmt[$i] = open_cursor($mysql, "SELECT a FROM cursor$i"); - $stmt[$i]->execute(); - $stmt[$i]->bind_result($a[$i]); - } + for ($i=0;$i < 3; $i++) { + $mysql->query("DROP TABLE IF EXISTS cursor$i"); + $mysql->query("CREATE TABLE cursor$i (a int not null) ENGINE=" . $engine); + $mysql->query("INSERT INTO cursor$i VALUES (1),(2),(3),(4),(5),(6)"); + $stmt[$i] = open_cursor($mysql, "SELECT a FROM cursor$i"); + $stmt[$i]->execute(); + $stmt[$i]->bind_result($a[$i]); + } - $cnt = 0; - while ($stmt[0]->fetch()) { - $stmt[1]->fetch(); - $stmt[2]->fetch(); - $cnt += $a[0] + $a[1] + $a[2]; - } + $cnt = 0; + while ($stmt[0]->fetch()) { + $stmt[1]->fetch(); + $stmt[2]->fetch(); + $cnt += $a[0] + $a[1] + $a[2]; + } - for ($i=0; $i < 3; $i++) { - $stmt[$i]->close(); - } + for ($i=0; $i < 3; $i++) { + $stmt[$i]->close(); + } - $mysql->close(); - var_dump($cnt); + $mysql->close(); + var_dump($cnt); ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/068.phpt b/ext/mysqli/tests/068.phpt index 17160f78f1..24a4255483 100644 --- a/ext/mysqli/tests/068.phpt +++ b/ext/mysqli/tests/068.phpt @@ -4,8 +4,8 @@ mysqli get_client_info <?php require_once('skipif.inc'); ?> --FILE-- <?php - $s = mysqli_get_client_info(); - echo gettype($s); + $s = mysqli_get_client_info(); + echo gettype($s); ?> --EXPECT-- string diff --git a/ext/mysqli/tests/069.phpt b/ext/mysqli/tests/069.phpt index 29ed2fd94a..9f1d0b447e 100644 --- a/ext/mysqli/tests/069.phpt +++ b/ext/mysqli/tests/069.phpt @@ -7,24 +7,24 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $mysql->multi_query('SELECT 1;SELECT 2'); - do { - $res = $mysql->store_result(); - if ($mysql->errno == 0) { - while ($arr = $res->fetch_assoc()) { - var_dump($arr); - } - $res->free(); - } - if (!$mysql->more_results()) { - break; - } - } while (@$mysql->next_result()); - $mysql->close(); - print "done!"; + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysql->multi_query('SELECT 1;SELECT 2'); + do { + $res = $mysql->store_result(); + if ($mysql->errno == 0) { + while ($arr = $res->fetch_assoc()) { + var_dump($arr); + } + $res->free(); + } + if (!$mysql->more_results()) { + break; + } + } while (@$mysql->next_result()); + $mysql->close(); + print "done!"; ?> --EXPECT-- array(1) { diff --git a/ext/mysqli/tests/070.phpt b/ext/mysqli/tests/070.phpt index 6452d6ab78..a9832815da 100644 --- a/ext/mysqli/tests/070.phpt +++ b/ext/mysqli/tests/070.phpt @@ -7,12 +7,12 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - var_dump($mysql->ping()); - $mysql->close(); - print "done!"; + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + var_dump($mysql->ping()); + $mysql->close(); + print "done!"; ?> --EXPECT-- bool(true) diff --git a/ext/mysqli/tests/071.phpt b/ext/mysqli/tests/071.phpt index 48b719c629..0a1e4ce62e 100644 --- a/ext/mysqli/tests/071.phpt +++ b/ext/mysqli/tests/071.phpt @@ -8,63 +8,63 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $version = $mysql->server_version; + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $version = $mysql->server_version; - var_dump($mysql->ping()); + var_dump($mysql->ping()); - $ret = $mysql->kill($mysql->thread_id); - if ($IS_MYSQLND) { - if ($ret !== true){ - printf("[001] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true)); - } - } else { - /* libmysql return value seems to depend on server version */ - if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) { - /* TODO: find exact version */ - if ($ret !== true){ - printf("[001] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version); - } - } else { - if ($ret !== false){ - printf("[001] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version); - } - } - } + $ret = $mysql->kill($mysql->thread_id); + if ($IS_MYSQLND) { + if ($ret !== true){ + printf("[001] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true)); + } + } else { + /* libmysql return value seems to depend on server version */ + if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) { + /* TODO: find exact version */ + if ($ret !== true){ + printf("[001] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version); + } + } else { + if ($ret !== false){ + printf("[001] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version); + } + } + } - var_dump($mysql->ping()); + var_dump($mysql->ping()); - $mysql->close(); + $mysql->close(); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - var_dump(mysqli_ping($mysql)); + var_dump(mysqli_ping($mysql)); - $ret = $mysql->kill($mysql->thread_id); - if ($IS_MYSQLND) { - if ($ret !== true){ - printf("[002] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true)); - } - } else { - /* libmysql return value seems to depend on server version */ - if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) { - /* TODO: find exact version */ - if ($ret !== true){ - printf("[002] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version); - } - } else { - if ($ret !== false){ - printf("[002] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version); - } - } - } + $ret = $mysql->kill($mysql->thread_id); + if ($IS_MYSQLND) { + if ($ret !== true){ + printf("[002] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true)); + } + } else { + /* libmysql return value seems to depend on server version */ + if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) { + /* TODO: find exact version */ + if ($ret !== true){ + printf("[002] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version); + } + } else { + if ($ret !== false){ + printf("[002] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version); + } + } + } - var_dump(mysqli_ping($mysql)); + var_dump(mysqli_ping($mysql)); - $mysql->close(); - print "done!"; + $mysql->close(); + print "done!"; ?> --EXPECT-- bool(true) diff --git a/ext/mysqli/tests/072.phpt b/ext/mysqli/tests/072.phpt index 997469d39c..cb4ff60a86 100644 --- a/ext/mysqli/tests/072.phpt +++ b/ext/mysqli/tests/072.phpt @@ -7,22 +7,22 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $mysql->query("DROP TABLE IF EXISTS not_exists"); + $mysql->query("DROP TABLE IF EXISTS not_exists"); - var_dump($mysql->warning_count); + var_dump($mysql->warning_count); - $w = $mysql->get_warnings(); + $w = $mysql->get_warnings(); - var_dump($w->errno); - var_dump($w->message); - var_dump($w->sqlstate); + var_dump($w->errno); + var_dump($w->message); + var_dump($w->sqlstate); - $mysql->close(); - echo "done!" + $mysql->close(); + echo "done!" ?> --EXPECTF-- int(1) diff --git a/ext/mysqli/tests/073.phpt b/ext/mysqli/tests/073.phpt index 86e54ffc93..09156532d8 100644 --- a/ext/mysqli/tests/073.phpt +++ b/ext/mysqli/tests/073.phpt @@ -4,15 +4,15 @@ mysqli_driver properties <?php require_once('skipif.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - var_dump($driver->embedded); - var_dump($driver->client_version); - var_dump($driver->client_info); - var_dump($driver->driver_version); - var_dump($driver->reconnect); - var_dump($driver->report_mode); - print "done!"; + var_dump($driver->embedded); + var_dump($driver->client_version); + var_dump($driver->client_info); + var_dump($driver->driver_version); + var_dump($driver->reconnect); + var_dump($driver->report_mode); + print "done!"; ?> --EXPECTF-- bool(%s) diff --git a/ext/mysqli/tests/074.phpt b/ext/mysqli/tests/074.phpt index a10f11136b..3f1271130f 100644 --- a/ext/mysqli/tests/074.phpt +++ b/ext/mysqli/tests/074.phpt @@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc'); --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - var_dump($mysqli->autocommit(false)); - $result = $mysqli->query("SELECT @@autocommit"); - var_dump($result->fetch_row()); + var_dump($mysqli->autocommit(false)); + $result = $mysqli->query("SELECT @@autocommit"); + var_dump($result->fetch_row()); - var_dump($mysqli->autocommit(true)); - $result = $mysqli->query("SELECT @@autocommit"); - var_dump($result->fetch_row()); + var_dump($mysqli->autocommit(true)); + $result = $mysqli->query("SELECT @@autocommit"); + var_dump($result->fetch_row()); ?> --EXPECT-- diff --git a/ext/mysqli/tests/bug28817.phpt b/ext/mysqli/tests/bug28817.phpt index 011d35e011..41c201c589 100644 --- a/ext/mysqli/tests/bug28817.phpt +++ b/ext/mysqli/tests/bug28817.phpt @@ -7,33 +7,33 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - class my_mysql extends mysqli { - public $p_test; + class my_mysql extends mysqli { + public $p_test; - function __construct() { - $this->p_test[] = "foo"; - $this->p_test[] = "bar"; - } - } + function __construct() { + $this->p_test[] = "foo"; + $this->p_test[] = "bar"; + } + } - $mysql = new my_mysql(); + $mysql = new my_mysql(); - var_dump($mysql->p_test); - try { - $mysql->errno; - } catch (Error $exception) { + var_dump($mysql->p_test); + try { + $mysql->errno; + } catch (Error $exception) { echo $exception->getMessage() . "\n"; - } + } - $mysql->connect($host, $user, $passwd, $db, $port, $socket); - $mysql->select_db("nonexistingdb"); + $mysql->connect($host, $user, $passwd, $db, $port, $socket); + $mysql->select_db("nonexistingdb"); - var_dump($mysql->errno > 0); + var_dump($mysql->errno > 0); - $mysql->close(); + $mysql->close(); ?> --EXPECTF-- array(2) { diff --git a/ext/mysqli/tests/bug29311.phpt b/ext/mysqli/tests/bug29311.phpt index cfd5235e2b..a5808418bf 100644 --- a/ext/mysqli/tests/bug29311.phpt +++ b/ext/mysqli/tests/bug29311.phpt @@ -7,45 +7,45 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - /* class 1 calls parent constructor */ - class mysql1 extends mysqli { - function __construct() { - global $host, $user, $passwd, $db, $port, $socket; - parent::__construct($host, $user, $passwd, $db, $port, $socket); - } - } - - /* class 2 has an own constructor */ - class mysql2 extends mysqli { - - function __construct() { - global $host, $user, $passwd, $db, $port, $socket; - $this->connect($host, $user, $passwd, $db, $port, $socket); - } - } - - /* class 3 has no constructor */ - class mysql3 extends mysqli { - - } - - $foo[0] = new mysql1(); - $foo[1] = new mysql2(); - $foo[2] = new mysql3($host, $user, $passwd, $db, $port, $socket); - - - for ($i=0; $i < 3; $i++) { - if (($result = $foo[$i]->query("SELECT DATABASE()"))) { - $row = $result->fetch_row(); - if ($row[0] != $db) - printf("%d: %s\n", $i, $row[0]); - $result->close(); - } - $foo[$i]->close(); - } - print "done!"; + require_once("connect.inc"); + + /* class 1 calls parent constructor */ + class mysql1 extends mysqli { + function __construct() { + global $host, $user, $passwd, $db, $port, $socket; + parent::__construct($host, $user, $passwd, $db, $port, $socket); + } + } + + /* class 2 has an own constructor */ + class mysql2 extends mysqli { + + function __construct() { + global $host, $user, $passwd, $db, $port, $socket; + $this->connect($host, $user, $passwd, $db, $port, $socket); + } + } + + /* class 3 has no constructor */ + class mysql3 extends mysqli { + + } + + $foo[0] = new mysql1(); + $foo[1] = new mysql2(); + $foo[2] = new mysql3($host, $user, $passwd, $db, $port, $socket); + + + for ($i=0; $i < 3; $i++) { + if (($result = $foo[$i]->query("SELECT DATABASE()"))) { + $row = $result->fetch_row(); + if ($row[0] != $db) + printf("%d: %s\n", $i, $row[0]); + $result->close(); + } + $foo[$i]->close(); + } + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/bug30967.phpt b/ext/mysqli/tests/bug30967.phpt index 9af81ea12a..9e68a0caec 100644 --- a/ext/mysqli/tests/bug30967.phpt +++ b/ext/mysqli/tests/bug30967.phpt @@ -7,20 +7,20 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - class mysql1 extends mysqli { - } + class mysql1 extends mysqli { + } - class mysql2 extends mysql1 { - } + class mysql2 extends mysql1 { + } - $mysql = new mysql2($host, $user, $passwd, $db, $port, $socket); + $mysql = new mysql2($host, $user, $passwd, $db, $port, $socket); - $mysql->query("THIS DOES NOT WORK"); - printf("%d\n", $mysql->errno); + $mysql->query("THIS DOES NOT WORK"); + printf("%d\n", $mysql->errno); - $mysql->close(); + $mysql->close(); ?> --EXPECT-- 1064 diff --git a/ext/mysqli/tests/bug31141.phpt b/ext/mysqli/tests/bug31141.phpt index 71834742a9..9894896dd5 100644 --- a/ext/mysqli/tests/bug31141.phpt +++ b/ext/mysqli/tests/bug31141.phpt @@ -6,13 +6,13 @@ Bug #31141 (properties declared in the class extending MySQLi are not available) <?php class Test extends mysqli { - public $test = array(); + public $test = array(); - function foo() - { - $ar_test = array("foo", "bar"); - $this->test = &$ar_test; - } + function foo() + { + $ar_test = array("foo", "bar"); + $this->test = &$ar_test; + } } $my_test = new Test; diff --git a/ext/mysqli/tests/bug31668.phpt b/ext/mysqli/tests/bug31668.phpt index 40bf357b6a..1dad169cc8 100644 --- a/ext/mysqli/tests/bug31668.phpt +++ b/ext/mysqli/tests/bug31668.phpt @@ -7,34 +7,34 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $mysql->multi_query('SELECT 1;SELECT 2'); - do { - $res = $mysql->store_result(); - if ($mysql->errno == 0) { - while ($arr = $res->fetch_assoc()) { - var_dump($arr); - } - $res->free(); - } - } while ($mysql->next_result()); - var_dump($mysql->error, __LINE__); - $mysql->close(); + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysql->multi_query('SELECT 1;SELECT 2'); + do { + $res = $mysql->store_result(); + if ($mysql->errno == 0) { + while ($arr = $res->fetch_assoc()) { + var_dump($arr); + } + $res->free(); + } + } while ($mysql->next_result()); + var_dump($mysql->error, __LINE__); + $mysql->close(); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $mysql->multi_query('SELECT 1;SELECT 2'); - do { - $res = $mysql->store_result(); - if ($mysql->errno == 0) { - while ($arr = $res->fetch_assoc()) { - var_dump($arr); - } - $res->free(); - } - } while ($mysql->next_result()); - var_dump($mysql->error, __LINE__); + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysql->multi_query('SELECT 1;SELECT 2'); + do { + $res = $mysql->store_result(); + if ($mysql->errno == 0) { + while ($arr = $res->fetch_assoc()) { + var_dump($arr); + } + $res->free(); + } + } while ($mysql->next_result()); + var_dump($mysql->error, __LINE__); ?> --EXPECTF-- array(1) { diff --git a/ext/mysqli/tests/bug32405.phpt b/ext/mysqli/tests/bug32405.phpt index 0b3cad50ff..974ad87b78 100644 --- a/ext/mysqli/tests/bug32405.phpt +++ b/ext/mysqli/tests/bug32405.phpt @@ -7,29 +7,29 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, "test"); - mysqli_query($link, "SET sql_mode=''"); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + mysqli_select_db($link, "test"); + mysqli_query($link, "SET sql_mode=''"); - /* two fields are needed. the problem does not occur with 1 field only selected. */ - $link->query("CREATE TABLE test_users(user_id int(10) unsigned NOT NULL auto_increment, login varchar(50) default '', PRIMARY KEY (user_id))"); - $link->query('INSERT INTO test_users VALUES (NULL, "user1"), (NULL, "user2"), (NULL, "user3"), (NULL, "user4")'); + /* two fields are needed. the problem does not occur with 1 field only selected. */ + $link->query("CREATE TABLE test_users(user_id int(10) unsigned NOT NULL auto_increment, login varchar(50) default '', PRIMARY KEY (user_id))"); + $link->query('INSERT INTO test_users VALUES (NULL, "user1"), (NULL, "user2"), (NULL, "user3"), (NULL, "user4")'); - if ($stmt = $link->prepare("SELECT SQL_NO_CACHE user_id, login FROM test_users")) { - $stmt->execute(); - $stmt->bind_result($col1, $col2); - while ($stmt->fetch()) { - var_dump($col1, $col2); - } - $stmt->close(); - } + if ($stmt = $link->prepare("SELECT SQL_NO_CACHE user_id, login FROM test_users")) { + $stmt->execute(); + $stmt->bind_result($col1, $col2); + while ($stmt->fetch()) { + var_dump($col1, $col2); + } + $stmt->close(); + } - mysqli_query($link,"DROP TABLE test_users"); - mysqli_close($link); + mysqli_query($link,"DROP TABLE test_users"); + mysqli_close($link); ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug33090.phpt b/ext/mysqli/tests/bug33090.phpt index c95043c551..6bddfa4290 100644 --- a/ext/mysqli/tests/bug33090.phpt +++ b/ext/mysqli/tests/bug33090.phpt @@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - include ("connect.inc"); + include ("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, null, $port, $socket); - mysqli_select_db($link, $db); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, null, $port, $socket); + mysqli_select_db($link, $db); - if (!($link->prepare("this makes no sense"))) { - printf("%d\n", $link->errno); - printf("%s\n", $link->sqlstate); - } - $link->close(); + if (!($link->prepare("this makes no sense"))) { + printf("%d\n", $link->errno); + printf("%s\n", $link->sqlstate); + } + $link->close(); ?> --EXPECT-- 1064 diff --git a/ext/mysqli/tests/bug33263.phpt b/ext/mysqli/tests/bug33263.phpt index e9ca36fe49..5df4065d25 100644 --- a/ext/mysqli/tests/bug33263.phpt +++ b/ext/mysqli/tests/bug33263.phpt @@ -8,30 +8,30 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - class test extends mysqli - { - public function __construct($host, $user, $passwd, $db, $port, $socket) { - parent::init(); - parent::real_connect($host, $user, $passwd, $db, $port, $socket); - } - } + class test extends mysqli + { + public function __construct($host, $user, $passwd, $db, $port, $socket) { + parent::init(); + parent::real_connect($host, $user, $passwd, $db, $port, $socket); + } + } - $mysql = new test($host, $user, $passwd, $db, $port, $socket); + $mysql = new test($host, $user, $passwd, $db, $port, $socket); - $stmt = $mysql->prepare("SELECT DATABASE()"); - $stmt->execute(); - $stmt->bind_result($database); - $stmt->fetch(); - $stmt->close(); + $stmt = $mysql->prepare("SELECT DATABASE()"); + $stmt->execute(); + $stmt->bind_result($database); + $stmt->fetch(); + $stmt->close(); - if ($database != $db) - printf("[001] Expecting '%s' got %s/'%s'.\n", - gettype($database), $database); + if ($database != $db) + printf("[001] Expecting '%s' got %s/'%s'.\n", + gettype($database), $database); - $mysql->close(); - print "done!"; + $mysql->close(); + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/bug34785.phpt b/ext/mysqli/tests/bug34785.phpt index 18dd4c3566..17a18f4ca9 100644 --- a/ext/mysqli/tests/bug34785.phpt +++ b/ext/mysqli/tests/bug34785.phpt @@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - include ("connect.inc"); + include ("connect.inc"); - class my_stmt extends mysqli_stmt - { - public function __construct($link, $query) { - parent::__construct($link, $query); - } - } + class my_stmt extends mysqli_stmt + { + public function __construct($link, $query) { + parent::__construct($link, $query); + } + } - class my_result extends mysqli_result - { - public function __construct($link, $query) { - parent::__construct($link, $query); - } - } + class my_result extends mysqli_result + { + public function __construct($link, $query) { + parent::__construct($link, $query); + } + } - /*** test mysqli_connect 127.0.0.1 ***/ - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_query($link, "SET sql_mode=''"); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + mysqli_query($link, "SET sql_mode=''"); - $stmt = new my_stmt($link, "SELECT 'foo' FROM DUAL"); + $stmt = new my_stmt($link, "SELECT 'foo' FROM DUAL"); - $stmt->execute(); - $stmt->bind_result($var); - $stmt->fetch(); + $stmt->execute(); + $stmt->bind_result($var); + $stmt->fetch(); - $stmt->close(); - var_dump($var); + $stmt->close(); + var_dump($var); - mysqli_real_query($link, "SELECT 'bar' FROM DUAL"); - $result = new my_result($link, MYSQLI_STORE_RESULT); - $row = $result->fetch_row(); - $result->close(); + mysqli_real_query($link, "SELECT 'bar' FROM DUAL"); + $result = new my_result($link, MYSQLI_STORE_RESULT); + $row = $result->fetch_row(); + $result->close(); - var_dump($row[0]); + var_dump($row[0]); - mysqli_close($link); + mysqli_close($link); ?> --EXPECTF-- %s(3) "foo" diff --git a/ext/mysqli/tests/bug34810.phpt b/ext/mysqli/tests/bug34810.phpt index b56d1a5ac7..60ed3f8d1a 100644 --- a/ext/mysqli/tests/bug34810.phpt +++ b/ext/mysqli/tests/bug34810.phpt @@ -9,37 +9,37 @@ require_once('skipifconnectfailure.inc'); <?php class DbConnection { - public function connect() { - require_once("connect.inc"); + public function connect() { + require_once("connect.inc"); - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - var_dump($link); + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + var_dump($link); - $link = mysqli_init(); + $link = mysqli_init(); var_dump($link); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $mysql->query("DROP TABLE IF EXISTS test_warnings"); - $mysql->query("CREATE TABLE test_warnings (a int not null)"); - $mysql->query("SET sql_mode=''"); - $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)"); + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysql->query("DROP TABLE IF EXISTS test_warnings"); + $mysql->query("CREATE TABLE test_warnings (a int not null)"); + $mysql->query("SET sql_mode=''"); + $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)"); - $warning = $mysql->get_warnings(); - if (!$warning) - printf("[001] No warning!\n"); + $warning = $mysql->get_warnings(); + if (!$warning) + printf("[001] No warning!\n"); - if ($warning->errno == 1048 || $warning->errno == 1253) { - /* 1048 - Column 'a' cannot be null, 1263 - Data truncated; NULL supplied to NOT NULL column 'a' at row */ - if ("HY000" != $warning->sqlstate) - printf("[003] Wrong sql state code: %s\n", $warning->sqlstate); + if ($warning->errno == 1048 || $warning->errno == 1253) { + /* 1048 - Column 'a' cannot be null, 1263 - Data truncated; NULL supplied to NOT NULL column 'a' at row */ + if ("HY000" != $warning->sqlstate) + printf("[003] Wrong sql state code: %s\n", $warning->sqlstate); - if ("" == $warning->message) - printf("[004] Message string must not be empty\n"); - } else { - printf("[002] Empty error message!\n"); - var_dump($warning); - } - } + if ("" == $warning->message) + printf("[004] Message string must not be empty\n"); + } else { + printf("[002] Empty error message!\n"); + var_dump($warning); + } + } } $db = new DbConnection(); diff --git a/ext/mysqli/tests/bug35103.phpt b/ext/mysqli/tests/bug35103.phpt index fc3cad04c2..7a990eacbf 100644 --- a/ext/mysqli/tests/bug35103.phpt +++ b/ext/mysqli/tests/bug35103.phpt @@ -12,44 +12,44 @@ $drop = <<<EOSQL DROP TABLE test_bint; DROP TABLE test_buint; EOSQL; - require_once("connect.inc"); + require_once("connect.inc"); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $mysql->query("DROP TABLE IF EXISTS test_bint"); - $mysql->query("CREATE TABLE test_bint (a bigint(20) default NULL) ENGINE=MYISAM"); - $mysql->query("INSERT INTO test_bint VALUES (9223372036854775807),(-9223372036854775808),(-2147483648),(-2147483649),(-2147483647),(2147483647),(2147483648),(2147483649)"); + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysql->query("DROP TABLE IF EXISTS test_bint"); + $mysql->query("CREATE TABLE test_bint (a bigint(20) default NULL) ENGINE=MYISAM"); + $mysql->query("INSERT INTO test_bint VALUES (9223372036854775807),(-9223372036854775808),(-2147483648),(-2147483649),(-2147483647),(2147483647),(2147483648),(2147483649)"); - $mysql->query("DROP TABLE IF EXISTS test_buint"); - $mysql->query("CREATE TABLE test_buint (a bigint(20) unsigned default NULL)"); - $mysql->query("INSERT INTO test_buint VALUES (18446744073709551615),(9223372036854775807),(9223372036854775808),(2147483647),(2147483649),(4294967295)"); + $mysql->query("DROP TABLE IF EXISTS test_buint"); + $mysql->query("CREATE TABLE test_buint (a bigint(20) unsigned default NULL)"); + $mysql->query("INSERT INTO test_buint VALUES (18446744073709551615),(9223372036854775807),(9223372036854775808),(2147483647),(2147483649),(4294967295)"); - $stmt = $mysql->prepare("SELECT a FROM test_bint ORDER BY a"); - $stmt->bind_result($v); - $stmt->execute(); - $i=0; - echo "BIG INT SIGNED, TEST\n"; - while ($i++ < 8) { - $stmt->fetch(); - echo $v, "\n"; - } - $stmt->close(); + $stmt = $mysql->prepare("SELECT a FROM test_bint ORDER BY a"); + $stmt->bind_result($v); + $stmt->execute(); + $i=0; + echo "BIG INT SIGNED, TEST\n"; + while ($i++ < 8) { + $stmt->fetch(); + echo $v, "\n"; + } + $stmt->close(); - echo str_repeat("-", 20), "\n"; + echo str_repeat("-", 20), "\n"; - $stmt = $mysql->prepare("SELECT a FROM test_buint ORDER BY a"); - $stmt->bind_result($v2); - $stmt->execute(); - $j=0; - echo "BIG INT UNSIGNED TEST\n"; - while ($j++ < 6) { - $stmt->fetch(); - echo $v2, "\n"; - } - $stmt->close(); + $stmt = $mysql->prepare("SELECT a FROM test_buint ORDER BY a"); + $stmt->bind_result($v2); + $stmt->execute(); + $j=0; + echo "BIG INT UNSIGNED TEST\n"; + while ($j++ < 6) { + $stmt->fetch(); + echo $v2, "\n"; + } + $stmt->close(); - $mysql->multi_query($drop); + $mysql->multi_query($drop); - $mysql->close(); + $mysql->close(); ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug35517.phpt b/ext/mysqli/tests/bug35517.phpt index 78b3206af4..a722179896 100644 --- a/ext/mysqli/tests/bug35517.phpt +++ b/ext/mysqli/tests/bug35517.phpt @@ -7,32 +7,32 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $mysql->query("CREATE TABLE temp (id INT UNSIGNED NOT NULL)"); - $mysql->query("INSERT INTO temp (id) VALUES (3000000897),(3800001532),(3900002281),(3100059612)"); - $stmt = $mysql->prepare("SELECT id FROM temp"); - $stmt->execute(); - $stmt->bind_result($id); - while ($stmt->fetch()) { - if (PHP_INT_SIZE == 8) { - if ((gettype($id) !== 'int') && (gettype($id) != 'integer')) - printf("[001] Expecting integer on 64bit got %s/%s\n", gettype($id), var_export($id, true)); - } else { - if (gettype($id) !== 'string') { - printf("[002] Expecting string on 32bit got %s/%s\n", gettype($id), var_export($id, true)); - } - } - print $id; - print "\n"; - } - $stmt->close(); + $mysql->query("CREATE TABLE temp (id INT UNSIGNED NOT NULL)"); + $mysql->query("INSERT INTO temp (id) VALUES (3000000897),(3800001532),(3900002281),(3100059612)"); + $stmt = $mysql->prepare("SELECT id FROM temp"); + $stmt->execute(); + $stmt->bind_result($id); + while ($stmt->fetch()) { + if (PHP_INT_SIZE == 8) { + if ((gettype($id) !== 'int') && (gettype($id) != 'integer')) + printf("[001] Expecting integer on 64bit got %s/%s\n", gettype($id), var_export($id, true)); + } else { + if (gettype($id) !== 'string') { + printf("[002] Expecting string on 32bit got %s/%s\n", gettype($id), var_export($id, true)); + } + } + print $id; + print "\n"; + } + $stmt->close(); - $mysql->query("DROP TABLE temp"); - $mysql->close(); - print "done!"; + $mysql->query("DROP TABLE temp"); + $mysql->close(); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug35759.phpt b/ext/mysqli/tests/bug35759.phpt index d6d7a7582b..5ae032eb83 100644 --- a/ext/mysqli/tests/bug35759.phpt +++ b/ext/mysqli/tests/bug35759.phpt @@ -8,49 +8,49 @@ require_once('skipifconnectfailure.inc'); --FILE-- <?php - require_once("connect.inc"); - $col_num= 1000; - - $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket); - $mysql->query("DROP TABLE IF EXISTS test"); - $create = "CREATE TABLE test (a0 MEDIUMBLOB NOT NULL DEFAULT ''"; - $i= 0; - while (++$i < $col_num) { - $create .= ", a$i MEDIUMBLOB NOT NULL DEFAULT ''"; - } - $create .= ") ENGINE=MyISAM"; // doesn't work with InnoDB, which is default in 5.5 - - if (!$mysql->query($create)) { - if (1101 == $mysql->errno) { - /* SQL strict mode - [1101] BLOB/TEXT column 'a0' can't have a default value */ - print "done!"; - exit(0); - } - printf("[001] [%d] %s\n", $mysql->errno, $mysql->error); - } - - if (!$mysql->query("INSERT INTO test (a0) VALUES ('')")) - printf("[002] [%d] %s\n", $mysql->errno, $mysql->error); - - $stmt = $mysql->prepare("SELECT * FROM test"); - if ($stmt) { - - $stmt->execute(); - $stmt->store_result(); - for ($i = 0; $i < $col_num; $i++) { - $params[] = &$col_num; - } - call_user_func_array(array($stmt, "bind_result"), $params); - $stmt->fetch(); - - $stmt->close(); - } else { - printf("[003] [%d] %s\n", $mysql->errno, $mysql->error); - } - - $mysql->close(); - - echo "done!"; + require_once("connect.inc"); + $col_num= 1000; + + $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket); + $mysql->query("DROP TABLE IF EXISTS test"); + $create = "CREATE TABLE test (a0 MEDIUMBLOB NOT NULL DEFAULT ''"; + $i= 0; + while (++$i < $col_num) { + $create .= ", a$i MEDIUMBLOB NOT NULL DEFAULT ''"; + } + $create .= ") ENGINE=MyISAM"; // doesn't work with InnoDB, which is default in 5.5 + + if (!$mysql->query($create)) { + if (1101 == $mysql->errno) { + /* SQL strict mode - [1101] BLOB/TEXT column 'a0' can't have a default value */ + print "done!"; + exit(0); + } + printf("[001] [%d] %s\n", $mysql->errno, $mysql->error); + } + + if (!$mysql->query("INSERT INTO test (a0) VALUES ('')")) + printf("[002] [%d] %s\n", $mysql->errno, $mysql->error); + + $stmt = $mysql->prepare("SELECT * FROM test"); + if ($stmt) { + + $stmt->execute(); + $stmt->store_result(); + for ($i = 0; $i < $col_num; $i++) { + $params[] = &$col_num; + } + call_user_func_array(array($stmt, "bind_result"), $params); + $stmt->fetch(); + + $stmt->close(); + } else { + printf("[003] [%d] %s\n", $mysql->errno, $mysql->error); + } + + $mysql->close(); + + echo "done!"; ?> --CLEAN-- <?php require("clean_table.inc"); ?> diff --git a/ext/mysqli/tests/bug36745.phpt b/ext/mysqli/tests/bug36745.phpt index 7a630afdc5..744985ab41 100644 --- a/ext/mysqli/tests/bug36745.phpt +++ b/ext/mysqli/tests/bug36745.phpt @@ -9,19 +9,19 @@ require_once('skipifconnectfailure.inc'); mysqli.allow_local_infile=1 --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /*** test mysqli_connect 127.0.0.1 ***/ - $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + /*** test mysqli_connect 127.0.0.1 ***/ + $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $mysql->query("DROP TABLE IF EXISTS litest"); - $mysql->query("CREATE TABLE litest (a VARCHAR(20))"); + $mysql->query("DROP TABLE IF EXISTS litest"); + $mysql->query("CREATE TABLE litest (a VARCHAR(20))"); - $mysql->query("LOAD DATA LOCAL INFILE 'filenotfound' INTO TABLE litest"); - var_dump($mysql->error); + $mysql->query("LOAD DATA LOCAL INFILE 'filenotfound' INTO TABLE litest"); + var_dump($mysql->error); - $mysql->close(); - printf("Done"); + $mysql->close(); + printf("Done"); ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug36802.phpt b/ext/mysqli/tests/bug36802.phpt index 387d73338e..1189115837 100644 --- a/ext/mysqli/tests/bug36802.phpt +++ b/ext/mysqli/tests/bug36802.phpt @@ -4,39 +4,39 @@ Bug #36802 (crashes with with mysqli_set_charset()) <?php require_once('skipif.inc'); ?> --FILE-- <?php - class really_my_mysqli extends mysqli { - function __construct() - { - } - } + class really_my_mysqli extends mysqli { + function __construct() + { + } + } - require_once("connect.inc"); - $mysql = mysqli_init(); + require_once("connect.inc"); + $mysql = mysqli_init(); - /* following operations should not work */ - if (method_exists($mysql, 'set_charset')) { - try { - $mysql->set_charset('utf8'); + /* following operations should not work */ + if (method_exists($mysql, 'set_charset')) { + try { + $mysql->set_charset('utf8'); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - } else { - $x[0] = false; - } + } else { + $x[0] = false; + } - try { + try { $mysql->query("SELECT 'foo' FROM DUAL"); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - /* following operations should work */ - $x[1] = ($mysql->client_version > 0); - $x[2] = $mysql->errno; + /* following operations should work */ + $x[1] = ($mysql->client_version > 0); + $x[2] = $mysql->errno; - $mysql->close(); + $mysql->close(); - var_dump($x); + var_dump($x); ?> --EXPECT-- mysqli object is not fully initialized diff --git a/ext/mysqli/tests/bug36949.phpt b/ext/mysqli/tests/bug36949.phpt index 2b3cc4955b..5805a65100 100644 --- a/ext/mysqli/tests/bug36949.phpt +++ b/ext/mysqli/tests/bug36949.phpt @@ -10,38 +10,38 @@ require_once('skipifconnectfailure.inc'); require_once("connect.inc"); class A { - private $mysqli; - - public function __construct() { - global $user, $host, $passwd, $db, $port, $socket; - $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket); - $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL"); - $row = $result->fetch_object(); - echo $row->my_time."<br>\n"; - $result->close(); - } - - public function __destruct() { - $this->mysqli->close(); - } + private $mysqli; + + public function __construct() { + global $user, $host, $passwd, $db, $port, $socket; + $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket); + $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL"); + $row = $result->fetch_object(); + echo $row->my_time."<br>\n"; + $result->close(); + } + + public function __destruct() { + $this->mysqli->close(); + } } class B { - private $mysqli; + private $mysqli; - public function __construct() { - global $user, $host, $passwd, $db, $port, $socket; - $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket); - $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL"); - $row = $result->fetch_object(); - echo $row->my_time."<br>\n"; - $result->close(); - } + public function __construct() { + global $user, $host, $passwd, $db, $port, $socket; + $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket); + $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL"); + $row = $result->fetch_object(); + echo $row->my_time."<br>\n"; + $result->close(); + } - public function __destruct() { - $this->mysqli->close(); - } + public function __destruct() { + $this->mysqli->close(); + } } $A = new A(); diff --git a/ext/mysqli/tests/bug37090.phpt b/ext/mysqli/tests/bug37090.phpt index d24e0d4a7f..13d939608d 100644 --- a/ext/mysqli/tests/bug37090.phpt +++ b/ext/mysqli/tests/bug37090.phpt @@ -10,22 +10,22 @@ if (!function_exists('mysqli_set_charset')) { ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $cs = array(); - $cs[] = $mysql->set_charset("latin1"); - $cs[] = $mysql->character_set_name(); + $cs = array(); + $cs[] = $mysql->set_charset("latin1"); + $cs[] = $mysql->character_set_name(); - $cs[] = $mysql->set_charset("utf8"); - $cs[] = $mysql->character_set_name(); + $cs[] = $mysql->set_charset("utf8"); + $cs[] = $mysql->character_set_name(); - $cs[] = $mysql->set_charset("notdefined"); - $cs[] = $mysql->character_set_name(); + $cs[] = $mysql->set_charset("notdefined"); + $cs[] = $mysql->character_set_name(); - var_dump($cs); - print "done!"; + var_dump($cs); + print "done!"; ?> --EXPECT-- array(6) { diff --git a/ext/mysqli/tests/bug38710.phpt b/ext/mysqli/tests/bug38710.phpt index 7a47003632..dc6496971a 100644 --- a/ext/mysqli/tests/bug38710.phpt +++ b/ext/mysqli/tests/bug38710.phpt @@ -16,7 +16,7 @@ $qry->execute(); $qry->bind_result($text); $qry->fetch(); if ($text !== str_repeat('a', ($IS_MYSQLND || mysqli_get_server_version($db) > 50110)? 100000:(mysqli_get_server_version($db)>=50000? 8193:8191))) { - var_dump(strlen($text)); + var_dump(strlen($text)); } echo "Done"; ?> diff --git a/ext/mysqli/tests/bug39457.phpt b/ext/mysqli/tests/bug39457.phpt index ec9239bb15..f518b14331 100644 --- a/ext/mysqli/tests/bug39457.phpt +++ b/ext/mysqli/tests/bug39457.phpt @@ -7,15 +7,15 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysql = mysqli_init(); - $mysql->connect($host, $user, $passwd, $db, $port, $socket); + $mysql = mysqli_init(); + $mysql->connect($host, $user, $passwd, $db, $port, $socket); - $mysql->connect($host, $user, $passwd, $db, $port, $socket); + $mysql->connect($host, $user, $passwd, $db, $port, $socket); - $mysql->close(); - echo "OK\n"; + $mysql->close(); + echo "OK\n"; ?> --EXPECT-- OK diff --git a/ext/mysqli/tests/bug42378.phpt b/ext/mysqli/tests/bug42378.phpt index 1c75141306..3b0638c840 100644 --- a/ext/mysqli/tests/bug42378.phpt +++ b/ext/mysqli/tests/bug42378.phpt @@ -10,175 +10,175 @@ require_once('skipifconnectfailure.inc'); memory_limit=83886080 --FILE-- <?php - require_once("connect.inc"); - - function create_table($link, $column, $min, $max, $engine, $offset) { - - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("[%03d] Cannot drop table test, [%d] %s\n", - $offset, - mysqli_errno($link), mysqli_error($link)); - return array(); - } - print "$column\n"; - - $sql = sprintf("CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col1 %s) ENGINE=%s", - $column, $engine); - if (!mysqli_query($link, $sql)) { - printf("[%03d] Cannot create table test, [%d] %s\n", - $offset + 1, - mysqli_errno($link), mysqli_error($link)); - return array(); - } - - $values = array(); - for ($i = 1; $i <= 100; $i++) { - $col1 = mt_rand($min, $max); - $values[$i] = $col1; - $sql = sprintf("INSERT INTO test(id, col1) VALUES (%d, %f)", - $i, $col1); - if (!mysqli_query($link, $sql)) { - printf("[%03d] Cannot insert data, [%d] %s\n", - $offset + 2, - mysqli_errno($link), mysqli_error($link)); - return array(); - } - } - - return $values; - } - - function test_format($link, $format, $from, $order_by, $expected, $offset) { - - if (!$stmt = mysqli_stmt_init($link)) { - printf("[%03d] Cannot create PS, [%d] %s\n", - $offset, - mysqli_errno($link), mysqli_error($link)); - return false; - } - print "$format\n"; - - if ($order_by) - $sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by); - else - $sql = sprintf('SELECT %s AS _format FROM %s', $format, $from); - - if (!mysqli_stmt_prepare($stmt, $sql)) { - printf("[%03d] Cannot prepare PS, [%d] %s\n", - $offset + 1, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!mysqli_stmt_execute($stmt)) { - printf("[%03d] Cannot execute PS, [%d] %s\n", - $offset + 2, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!mysqli_stmt_store_result($stmt)) { - printf("[%03d] Cannot store result set, [%d] %s\n", - $offset + 3, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!is_array($expected)) { - - $result = null; - if (!mysqli_stmt_bind_result($stmt, $result)) { - printf("[%03d] Cannot bind result, [%d] %s\n", - $offset + 4, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!mysqli_stmt_fetch($stmt)) { - printf("[%03d] Cannot fetch result,, [%d] %s\n", - $offset + 5, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if ($result !== $expected) { - printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n", - $offset + 6, - gettype($expected), $expected, - gettype($result), $result, - $format, $sql); - } - - } else { - - $order_by_col = $result = null; - if (!is_null($order_by)) { - if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) { - printf("[%03d] Cannot bind result, [%d] %s\n", - $offset + 7, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - } else { - if (!mysqli_stmt_bind_result($stmt, $result)) { - printf("[%03d] Cannot bind result, [%d] %s\n", - $offset + 7, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - } - - foreach ($expected as $k => $v) { - if (!mysqli_stmt_fetch($stmt)) { - break; - } - if ($result !== $v) { - printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n", - $offset + 8, - $k, - gettype($v), $v, - gettype($result), $result, - $order_by_col, - $format, $sql); - } - } - - } - - mysqli_stmt_free_result($stmt); - mysqli_stmt_close($stmt); - - return true; - } - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect - [%d] %s\n", - mysqli_connect_errno(), - mysqli_connect_error()); - - /* create new table and select from it */ - $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 90); - foreach ($expected as $k => $v) - $expected[$k] = number_format(round($v), 0, '.', ','); - test_format($link, 'FORMAT(col1, 0)', 'test', NULL, array(), 100); - - $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 110); - foreach ($expected as $k => $v) - $expected[$k] = number_format(round($v), 0, '.', ','); - test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 120); - - $expected = create_table($link, 'FLOAT UNSIGNED', 0, 10000, $engine, 130); - foreach ($expected as $k => $v) - $expected[$k] = number_format(round($v), 0, '.', ','); - test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 140); - - $expected = create_table($link, 'DECIMAL(5,0)', -1000, 1000, $engine, 150); - foreach ($expected as $k => $v) - $expected[$k] = number_format(round($v), 0, '.', ','); - test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 160); - - mysqli_close($link); - print "done!"; + require_once("connect.inc"); + + function create_table($link, $column, $min, $max, $engine, $offset) { + + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { + printf("[%03d] Cannot drop table test, [%d] %s\n", + $offset, + mysqli_errno($link), mysqli_error($link)); + return array(); + } + print "$column\n"; + + $sql = sprintf("CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col1 %s) ENGINE=%s", + $column, $engine); + if (!mysqli_query($link, $sql)) { + printf("[%03d] Cannot create table test, [%d] %s\n", + $offset + 1, + mysqli_errno($link), mysqli_error($link)); + return array(); + } + + $values = array(); + for ($i = 1; $i <= 100; $i++) { + $col1 = mt_rand($min, $max); + $values[$i] = $col1; + $sql = sprintf("INSERT INTO test(id, col1) VALUES (%d, %f)", + $i, $col1); + if (!mysqli_query($link, $sql)) { + printf("[%03d] Cannot insert data, [%d] %s\n", + $offset + 2, + mysqli_errno($link), mysqli_error($link)); + return array(); + } + } + + return $values; + } + + function test_format($link, $format, $from, $order_by, $expected, $offset) { + + if (!$stmt = mysqli_stmt_init($link)) { + printf("[%03d] Cannot create PS, [%d] %s\n", + $offset, + mysqli_errno($link), mysqli_error($link)); + return false; + } + print "$format\n"; + + if ($order_by) + $sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by); + else + $sql = sprintf('SELECT %s AS _format FROM %s', $format, $from); + + if (!mysqli_stmt_prepare($stmt, $sql)) { + printf("[%03d] Cannot prepare PS, [%d] %s\n", + $offset + 1, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!mysqli_stmt_execute($stmt)) { + printf("[%03d] Cannot execute PS, [%d] %s\n", + $offset + 2, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!mysqli_stmt_store_result($stmt)) { + printf("[%03d] Cannot store result set, [%d] %s\n", + $offset + 3, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!is_array($expected)) { + + $result = null; + if (!mysqli_stmt_bind_result($stmt, $result)) { + printf("[%03d] Cannot bind result, [%d] %s\n", + $offset + 4, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!mysqli_stmt_fetch($stmt)) { + printf("[%03d] Cannot fetch result,, [%d] %s\n", + $offset + 5, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if ($result !== $expected) { + printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n", + $offset + 6, + gettype($expected), $expected, + gettype($result), $result, + $format, $sql); + } + + } else { + + $order_by_col = $result = null; + if (!is_null($order_by)) { + if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) { + printf("[%03d] Cannot bind result, [%d] %s\n", + $offset + 7, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + } else { + if (!mysqli_stmt_bind_result($stmt, $result)) { + printf("[%03d] Cannot bind result, [%d] %s\n", + $offset + 7, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + } + + foreach ($expected as $k => $v) { + if (!mysqli_stmt_fetch($stmt)) { + break; + } + if ($result !== $v) { + printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n", + $offset + 8, + $k, + gettype($v), $v, + gettype($result), $result, + $order_by_col, + $format, $sql); + } + } + + } + + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + + return true; + } + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect - [%d] %s\n", + mysqli_connect_errno(), + mysqli_connect_error()); + + /* create new table and select from it */ + $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 90); + foreach ($expected as $k => $v) + $expected[$k] = number_format(round($v), 0, '.', ','); + test_format($link, 'FORMAT(col1, 0)', 'test', NULL, array(), 100); + + $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 110); + foreach ($expected as $k => $v) + $expected[$k] = number_format(round($v), 0, '.', ','); + test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 120); + + $expected = create_table($link, 'FLOAT UNSIGNED', 0, 10000, $engine, 130); + foreach ($expected as $k => $v) + $expected[$k] = number_format(round($v), 0, '.', ','); + test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 140); + + $expected = create_table($link, 'DECIMAL(5,0)', -1000, 1000, $engine, 150); + foreach ($expected as $k => $v) + $expected[$k] = number_format(round($v), 0, '.', ','); + test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 160); + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug42548.phpt b/ext/mysqli/tests/bug42548.phpt index 8624250eb1..6f4de58a66 100644 --- a/ext/mysqli/tests/bug42548.phpt +++ b/ext/mysqli/tests/bug42548.phpt @@ -19,8 +19,8 @@ require_once('connect.inc'); $mysqli = mysqli_init(); $mysqli->real_connect($host, $user, $passwd, $db, $port, $socket); if (mysqli_connect_errno()) { - printf("Connect failed: %s\n", mysqli_connect_error()); - exit(); + printf("Connect failed: %s\n", mysqli_connect_error()); + exit(); } $mysqli->query("DROP PROCEDURE IF EXISTS p1") or die($mysqli->error); @@ -28,22 +28,22 @@ $mysqli->query("CREATE PROCEDURE p1() BEGIN SELECT 23; SELECT 42; END") or die($ if ($mysqli->multi_query("CALL p1();")) { - do - { - if ($objResult = $mysqli->store_result()) { - while ($row = $objResult->fetch_assoc()) { - print_r($row); - } - $objResult->close(); - if ($mysqli->more_results()) { - print "----- next result -----------\n"; - } - } else { - print "no results found\n"; - } - } while ($mysqli->more_results() && $mysqli->next_result()); + do + { + if ($objResult = $mysqli->store_result()) { + while ($row = $objResult->fetch_assoc()) { + print_r($row); + } + $objResult->close(); + if ($mysqli->more_results()) { + print "----- next result -----------\n"; + } + } else { + print "no results found\n"; + } + } while ($mysqli->more_results() && $mysqli->next_result()); } else { - print $mysqli->error; + print $mysqli->error; } $mysqli->query("DROP PROCEDURE p1") or die($mysqli->error); diff --git a/ext/mysqli/tests/bug44897.phpt b/ext/mysqli/tests/bug44897.phpt index 948e4aaee7..ba7d0ca49d 100644 --- a/ext/mysqli/tests/bug44897.phpt +++ b/ext/mysqli/tests/bug44897.phpt @@ -19,57 +19,57 @@ if (mysqli_get_server_version($link) <= 50000) { ?> --FILE-- <?php - require_once("table.inc"); + require_once("table.inc"); - if (!$link->query('DROP PROCEDURE IF EXISTS p')) - printf("[001] [%d] %s\n", $link->errno, $link->error); + if (!$link->query('DROP PROCEDURE IF EXISTS p')) + printf("[001] [%d] %s\n", $link->errno, $link->error); - if (!$link->query('CREATE PROCEDURE p(IN new_id INT, IN new_label CHAR(1)) BEGIN INSERT INTO test(id, label) VALUES (new_id, new_label); SELECT new_label; END;')) - printf("[002] [%d] %s\n", $link->errno, $link->error); + if (!$link->query('CREATE PROCEDURE p(IN new_id INT, IN new_label CHAR(1)) BEGIN INSERT INTO test(id, label) VALUES (new_id, new_label); SELECT new_label; END;')) + printf("[002] [%d] %s\n", $link->errno, $link->error); - $new_id = 100; - $new_label = 'z'; + $new_id = 100; + $new_label = 'z'; - if (!$stmt = $link->prepare('CALL p(?, ?)')) - printf("[003] [%d] %s\n", $link->errno, $link->error); + if (!$stmt = $link->prepare('CALL p(?, ?)')) + printf("[003] [%d] %s\n", $link->errno, $link->error); - if (!$stmt->bind_param('is', $new_id, $new_label) || !$stmt->execute()) - printf("[004] [%d] %s\n", $stmt->errno, $stmt->error); + if (!$stmt->bind_param('is', $new_id, $new_label) || !$stmt->execute()) + printf("[004] [%d] %s\n", $stmt->errno, $stmt->error); - $out_new_label = null; - if (!$stmt->bind_result($out_new_label) || !$stmt->fetch()) - printf("[005] [%d] %s\n", $stmt->errno, $stmt->error); + $out_new_label = null; + if (!$stmt->bind_result($out_new_label) || !$stmt->fetch()) + printf("[005] [%d] %s\n", $stmt->errno, $stmt->error); - if ($out_new_label != $new_label) - printf("[006] IN value and returned value differ. Expecting %s/%s got %s/%s\n", - $new_label, gettype($new_label), $out_new_label, gettype($out_new_label)); + if ($out_new_label != $new_label) + printf("[006] IN value and returned value differ. Expecting %s/%s got %s/%s\n", + $new_label, gettype($new_label), $out_new_label, gettype($out_new_label)); - $stmt->close(); + $stmt->close(); - $stmt2 = $link->prepare('SELECT label FROM test WHERE id = ?'); - if (!is_object($stmt2)) { + $stmt2 = $link->prepare('SELECT label FROM test WHERE id = ?'); + if (!is_object($stmt2)) { - printf("[007] Failed to create new statement object, [%d] %s\n", - $link->errno, $link->error); + printf("[007] Failed to create new statement object, [%d] %s\n", + $link->errno, $link->error); - } else { + } else { - if (!$stmt2->bind_param("i", $new_id) || !$stmt2->execute()) - printf("[008] [%d] %s\n", $stmt2->errno, $stmt2->error); + if (!$stmt2->bind_param("i", $new_id) || !$stmt2->execute()) + printf("[008] [%d] %s\n", $stmt2->errno, $stmt2->error); - $out_new_label = null; - if (!$stmt2->bind_result($out_new_label) || !$stmt2->fetch()) - printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error); + $out_new_label = null; + if (!$stmt2->bind_result($out_new_label) || !$stmt2->fetch()) + printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error); - if ($out_new_label != $new_label) - printf("[010] IN value and returned value differ. Expecting %s/%s got %s/%s\n", - $new_label, gettype($new_label), $out_new_label, gettype($out_new_label)); + if ($out_new_label != $new_label) + printf("[010] IN value and returned value differ. Expecting %s/%s got %s/%s\n", + $new_label, gettype($new_label), $out_new_label, gettype($out_new_label)); - } + } - $link->close(); + $link->close(); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug45019.phpt b/ext/mysqli/tests/bug45019.phpt index f7ace737d8..faad5b9b90 100644 --- a/ext/mysqli/tests/bug45019.phpt +++ b/ext/mysqli/tests/bug45019.phpt @@ -8,48 +8,48 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - require_once("table.inc"); + require_once("connect.inc"); + require_once("table.inc"); - // Regular (non-prepared) queries - print "Using CAST('somestring' AS CHAR)...\n"; - if (!($res = $link->query("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)"))) - printf("[001] [%d] %s\n", $link->errno, $link->error); + // Regular (non-prepared) queries + print "Using CAST('somestring' AS CHAR)...\n"; + if (!($res = $link->query("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)"))) + printf("[001] [%d] %s\n", $link->errno, $link->error); - $data = array(); - while ($row = $res->fetch_assoc()) { - $data[] = $row['column1']; - var_dump($row['column1']); - } - $res->free(); + $data = array(); + while ($row = $res->fetch_assoc()) { + $data[] = $row['column1']; + var_dump($row['column1']); + } + $res->free(); - // Prepared Statements - if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)"))) - printf("[002] [%d] %s\n", $link->errno, $link->error); + // Prepared Statements + if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)"))) + printf("[002] [%d] %s\n", $link->errno, $link->error); - $column1 = null; - if (!$stmt->bind_result($column1) || !$stmt->execute()) - printf("[003] [%d] %s\n", $stmt->errno, $stmt->error); + $column1 = null; + if (!$stmt->bind_result($column1) || !$stmt->execute()) + printf("[003] [%d] %s\n", $stmt->errno, $stmt->error); - $index = 0; - while ($stmt->fetch()) { - /* NOTE: libmysql - http://bugs.mysql.com/bug.php?id=47483 */ - if ($data[$index] != $column1) { - if ($IS_MYSQLND || $index != 1) { - printf("[004] Row %d, expecting %s/%s got %s/%s\n", - $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); - } else { - if ($column1 != "thre") - printf("[005] Got '%s'. Please check if http://bugs.mysql.com/bug.php?id=47483 has been fixed and adapt tests bug45019.phpt/mysqli_ps_select_union.phpt", $column1); - } - } - $index++; - } - $stmt->close(); + $index = 0; + while ($stmt->fetch()) { + /* NOTE: libmysql - http://bugs.mysql.com/bug.php?id=47483 */ + if ($data[$index] != $column1) { + if ($IS_MYSQLND || $index != 1) { + printf("[004] Row %d, expecting %s/%s got %s/%s\n", + $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); + } else { + if ($column1 != "thre") + printf("[005] Got '%s'. Please check if http://bugs.mysql.com/bug.php?id=47483 has been fixed and adapt tests bug45019.phpt/mysqli_ps_select_union.phpt", $column1); + } + } + $index++; + } + $stmt->close(); - $link->close(); + $link->close(); - print "done!"; + print "done!"; ?> --EXPECT-- Using CAST('somestring' AS CHAR)... diff --git a/ext/mysqli/tests/bug45289.phpt b/ext/mysqli/tests/bug45289.phpt index 2ddacf4fdd..65b7ebd707 100644 --- a/ext/mysqli/tests/bug45289.phpt +++ b/ext/mysqli/tests/bug45289.phpt @@ -7,30 +7,30 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('table.inc'); + require('table.inc'); - $link->close(); + $link->close(); - $link = mysqli_init(); - if (!($link->real_connect($host, $user, $passwd, $db, $port, $socket))) - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + $link = mysqli_init(); + if (!($link->real_connect($host, $user, $passwd, $db, $port, $socket))) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - $id = 1; - if (!($stmt = $link->prepare('SELECT id, label FROM test WHERE id=? LIMIT 1'))) - printf("[002] [%d] %s\n", $link->errno, $link->error); + $id = 1; + if (!($stmt = $link->prepare('SELECT id, label FROM test WHERE id=? LIMIT 1'))) + printf("[002] [%d] %s\n", $link->errno, $link->error); - if (!$stmt->bind_param('i', $id) || !$stmt->execute()) - printf("[003] [%d] %s\n", $stmt->errno, $stmt->error); + if (!$stmt->bind_param('i', $id) || !$stmt->execute()) + printf("[003] [%d] %s\n", $stmt->errno, $stmt->error); - if ($res = $link->store_result()) { - if ($IS_MYSQLND) - printf("[004] Can store result!\n"); - else - printf("[004] [007] http://bugs.mysql.com/bug.php?id=47485\n"); - } else { - printf("[004] [%d] %s\n", $link->errno, $link->error); - } + if ($res = $link->store_result()) { + if ($IS_MYSQLND) + printf("[004] Can store result!\n"); + else + printf("[004] [007] http://bugs.mysql.com/bug.php?id=47485\n"); + } else { + printf("[004] [%d] %s\n", $link->errno, $link->error); + } ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug46109.phpt b/ext/mysqli/tests/bug46109.phpt index a1c77ac2d8..6b44275ed4 100644 --- a/ext/mysqli/tests/bug46109.phpt +++ b/ext/mysqli/tests/bug46109.phpt @@ -7,12 +7,12 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysqli = new mysqli(); - $mysqli->init(); - $mysqli->init(); - echo "done"; + $mysqli = new mysqli(); + $mysqli->init(); + $mysqli->init(); + echo "done"; ?> --EXPECT-- done diff --git a/ext/mysqli/tests/bug46614.phpt b/ext/mysqli/tests/bug46614.phpt index 9e78222713..2cdefbf4a3 100644 --- a/ext/mysqli/tests/bug46614.phpt +++ b/ext/mysqli/tests/bug46614.phpt @@ -11,13 +11,13 @@ if (!defined("MYSQLI_ASYNC")) { --FILE-- <?php class MySQL_Ext extends mysqli{ - protected $fooData = array(); + protected $fooData = array(); - public function isEmpty() - { - $this->extData[] = 'Bar'; - return empty($this->extData); - } + public function isEmpty() + { + $this->extData[] = 'Bar'; + return empty($this->extData); + } } include ("connect.inc"); diff --git a/ext/mysqli/tests/bug47050.phpt b/ext/mysqli/tests/bug47050.phpt index 0358802bac..ac305b07d2 100644 --- a/ext/mysqli/tests/bug47050.phpt +++ b/ext/mysqli/tests/bug47050.phpt @@ -10,22 +10,22 @@ if (!defined("MYSQLI_ASYNC")) { ?> --FILE-- <?php - include ("connect.inc"); + include ("connect.inc"); - $link1 = my_mysqli_connect($host, $user, $passwd, null, $port, $socket); - mysqli_select_db($link1, $db); + $link1 = my_mysqli_connect($host, $user, $passwd, null, $port, $socket); + mysqli_select_db($link1, $db); - $link1->query("SELECT 'test'", MYSQLI_ASYNC); - $all_links = array($link1); - $links = $errors = $reject = $all_links; - mysqli_poll($links, $errors, $reject, 1); + $link1->query("SELECT 'test'", MYSQLI_ASYNC); + $all_links = array($link1); + $links = $errors = $reject = $all_links; + mysqli_poll($links, $errors, $reject, 1); - echo "links: ", sizeof($links), "\n"; - echo "errors: ", sizeof($errors), "\n"; - echo "reject: ", sizeof($reject), "\n"; - echo "all_links: ", sizeof($all_links), "\n"; + echo "links: ", sizeof($links), "\n"; + echo "errors: ", sizeof($errors), "\n"; + echo "reject: ", sizeof($reject), "\n"; + echo "all_links: ", sizeof($all_links), "\n"; - $link1->close(); + $link1->close(); ?> --EXPECT-- links: 1 diff --git a/ext/mysqli/tests/bug48909.phpt b/ext/mysqli/tests/bug48909.phpt index ef46c97c6a..3c7e09f17e 100644 --- a/ext/mysqli/tests/bug48909.phpt +++ b/ext/mysqli/tests/bug48909.phpt @@ -7,36 +7,36 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) + printf("[001] 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("DROP TABLE IF EXISTS test") || - !$link->query(sprintf("CREATE TABLE test(id INT, label varchar(255)) ENGINE = %s", $engine))) - printf("[002] [%d] %s\n", $link->errno, $link->error); + if (!$link->query("DROP TABLE IF EXISTS test") || + !$link->query(sprintf("CREATE TABLE test(id INT, label varchar(255)) ENGINE = %s", $engine))) + printf("[002] [%d] %s\n", $link->errno, $link->error); - if (!$stmt = $link->prepare("INSERT INTO test(id, label) VALUES (?, ?)")) - printf("[003] [%d] %s\n", $link->errno, $link->error); + if (!$stmt = $link->prepare("INSERT INTO test(id, label) VALUES (?, ?)")) + printf("[003] [%d] %s\n", $link->errno, $link->error); - if (!$stmt->bind_param("bb",$bvar, $bvar)) - printf("[004] [%d] %s\n", $stmt->errno, $stmt->error); + if (!$stmt->bind_param("bb",$bvar, $bvar)) + printf("[004] [%d] %s\n", $stmt->errno, $stmt->error); - if (!$stmt->execute()) { - if ($stmt->errno != 1366) { - /* - $bvar is null, b is for BLOB - any error like this should be OK: - 1366 - Incorrect integer value: '' for column 'id' at row 1 - */ - printf("[005] [%d] %s\n", $stmt->errno, $stmt->error); - } - } + if (!$stmt->execute()) { + if ($stmt->errno != 1366) { + /* + $bvar is null, b is for BLOB - any error like this should be OK: + 1366 - Incorrect integer value: '' for column 'id' at row 1 + */ + printf("[005] [%d] %s\n", $stmt->errno, $stmt->error); + } + } - $stmt->close(); - $link->close(); + $stmt->close(); + $link->close(); - echo "done"; + echo "done"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug49027.phpt b/ext/mysqli/tests/bug49027.phpt index 059d986584..4aa546cd26 100644 --- a/ext/mysqli/tests/bug49027.phpt +++ b/ext/mysqli/tests/bug49027.phpt @@ -7,44 +7,44 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - include ("connect.inc"); + include ("connect.inc"); - $link = mysqli_init(); - if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "SELECT 1")) { - printf("[001] Cannot set INIT_COMMAND\n"); - } + $link = mysqli_init(); + if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "SELECT 1")) { + printf("[001] Cannot set INIT_COMMAND\n"); + } - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { - printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } - var_dump($link->query("SELECT 42")->fetch_row()); + var_dump($link->query("SELECT 42")->fetch_row()); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || - !mysqli_query($link, sprintf("CREATE TABLE test(id INT) ENGINE=%s", $engine))) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || + !mysqli_query($link, sprintf("CREATE TABLE test(id INT) ENGINE=%s", $engine))) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - mysqli_close($link); + mysqli_close($link); - $link = mysqli_init(); - if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(id) VALUES(1)")) { - printf("[004] Cannot set INIT_COMMAND\n"); - } + $link = mysqli_init(); + if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(id) VALUES(1)")) { + printf("[004] Cannot set INIT_COMMAND\n"); + } - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { - printf("[005] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[005] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } - if (!$res = mysqli_query($link, "SELECT id FROM test")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT id FROM test")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump(mysqli_fetch_assoc($res)); + var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - mysqli_close($link); + mysqli_free_result($res); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug49442.phpt b/ext/mysqli/tests/bug49442.phpt index 4c57a5c48b..22ff7552b7 100644 --- a/ext/mysqli/tests/bug49442.phpt +++ b/ext/mysqli/tests/bug49442.phpt @@ -22,87 +22,87 @@ mysqli.allow_persistent=1 mysqli.max_persistent=1 --FILE-- <?php - include ("connect.inc"); - - $link = mysqli_init(); - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } - - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("[002] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) { - printf("[003] Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - include("local_infile_tools.inc"); - $file = create_standard_csv(4); - - if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' - INTO TABLE test - FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' - LINES TERMINATED BY '\n'", - mysqli_real_escape_string($link, $file)))) { - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $rows = array(); - while ($row = mysqli_fetch_assoc($res)) { - var_dump($row); - $rows[] = $row; - } - - mysqli_free_result($res); - - mysqli_query($link, "DELETE FROM test"); - mysqli_close($link); - - if ($IS_MYSQLND) { - /* - mysqlnd makes a connection created through mysql_init()/mysqli_real_connect() always a 'persistent' one. - At this point 'persistent' is not to be confused with what a user calls a 'persistent' - in this case - 'persistent' means that mysqlnd uses malloc() instead of emalloc(). nothing else. ext/mysqli will - not consider it as a 'persistent' connection in a user sense, ext/mysqli will not apply max_persistent etc. - Its only about malloc() vs. emalloc(). - - However, the bug is about malloc() and efree(). You can make make mysqlnd use malloc() by either using - pconnect or mysql_init() - so we should test pconnect as well.. - */ - $host = 'p:' . $host; - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[007] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } - - /* bug happened during query processing */ - if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' - INTO TABLE test - FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' - LINES TERMINATED BY '\n'", - mysqli_real_escape_string($link, $file)))) { - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - /* we survived? that's good enough... */ - - if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id")) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $i = 0; - while ($row = mysqli_fetch_assoc($res)) { - if (($row['id'] != $rows[$i]['id']) || ($row['label'] != $rows[$i]['label'])) { - printf("[010] Wrong values, check manually!\n"); - } - $i++; - } - mysqli_close($link); - } - - print "done!"; + include ("connect.inc"); + + $link = mysqli_init(); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { + printf("[002] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) { + printf("[003] Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + include("local_infile_tools.inc"); + $file = create_standard_csv(4); + + if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' + INTO TABLE test + FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' + LINES TERMINATED BY '\n'", + mysqli_real_escape_string($link, $file)))) { + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $rows = array(); + while ($row = mysqli_fetch_assoc($res)) { + var_dump($row); + $rows[] = $row; + } + + mysqli_free_result($res); + + mysqli_query($link, "DELETE FROM test"); + mysqli_close($link); + + if ($IS_MYSQLND) { + /* + mysqlnd makes a connection created through mysql_init()/mysqli_real_connect() always a 'persistent' one. + At this point 'persistent' is not to be confused with what a user calls a 'persistent' - in this case + 'persistent' means that mysqlnd uses malloc() instead of emalloc(). nothing else. ext/mysqli will + not consider it as a 'persistent' connection in a user sense, ext/mysqli will not apply max_persistent etc. + Its only about malloc() vs. emalloc(). + + However, the bug is about malloc() and efree(). You can make make mysqlnd use malloc() by either using + pconnect or mysql_init() - so we should test pconnect as well.. + */ + $host = 'p:' . $host; + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[007] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + + /* bug happened during query processing */ + if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' + INTO TABLE test + FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' + LINES TERMINATED BY '\n'", + mysqli_real_escape_string($link, $file)))) { + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + /* we survived? that's good enough... */ + + if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id")) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $i = 0; + while ($row = mysqli_fetch_assoc($res)) { + if (($row['id'] != $rows[$i]['id']) || ($row['label'] != $rows[$i]['label'])) { + printf("[010] Wrong values, check manually!\n"); + } + $i++; + } + mysqli_close($link); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug50772.phpt b/ext/mysqli/tests/bug50772.phpt index 9f26135c60..8987d0ac48 100644 --- a/ext/mysqli/tests/bug50772.phpt +++ b/ext/mysqli/tests/bug50772.phpt @@ -7,28 +7,28 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - include "connect.inc"; - $db1 = new mysqli(); + include "connect.inc"; + $db1 = new mysqli(); - // These calls fail - $db1->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3); - my_mysqli_real_connect($db1, $host, $user, $passwd, $db, $port, $socket); - if(mysqli_connect_error()) { - echo "error 1\n"; - } else { - echo "ok 1\n"; - } + // These calls fail + $db1->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3); + my_mysqli_real_connect($db1, $host, $user, $passwd, $db, $port, $socket); + if(mysqli_connect_error()) { + echo "error 1\n"; + } else { + echo "ok 1\n"; + } - $db2 = mysqli_init(); + $db2 = mysqli_init(); - $db2->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3); - my_mysqli_real_connect($db2, $host, $user, $passwd, $db, $port, $socket); - if(mysqli_connect_error()) { - echo "error 2\n"; - } else { - echo "ok 2\n"; - } - echo "done\n"; + $db2->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3); + my_mysqli_real_connect($db2, $host, $user, $passwd, $db, $port, $socket); + if(mysqli_connect_error()) { + echo "error 2\n"; + } else { + echo "ok 2\n"; + } + echo "done\n"; ?> --EXPECT-- ok 1 diff --git a/ext/mysqli/tests/bug51605.phpt b/ext/mysqli/tests/bug51605.phpt index c57a7b36d3..c3238da289 100644 --- a/ext/mysqli/tests/bug51605.phpt +++ b/ext/mysqli/tests/bug51605.phpt @@ -12,30 +12,30 @@ mysqli.max_persistent = 0 mysqli.reconnect = Off --FILE-- <?php - include ("connect.inc"); + include ("connect.inc"); - $link = mysqli_init(); - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { - printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } - mysqli_close($link); - echo "closed once\n"; + $link = mysqli_init(); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + mysqli_close($link); + echo "closed once\n"; - $link = mysqli_init(); - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { - printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } - mysqli_close($link); - echo "closed twice\n"; + $link = mysqli_init(); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + mysqli_close($link); + echo "closed twice\n"; - $link = mysqli_init(); - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { - printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } - mysqli_close($link); - echo "closed for third time\n"; + $link = mysqli_init(); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + mysqli_close($link); + echo "closed for third time\n"; - print "done!"; + print "done!"; ?> --EXPECT-- closed once diff --git a/ext/mysqli/tests/bug51647.phpt b/ext/mysqli/tests/bug51647.phpt index 816a612d5a..8fd107a95d 100644 --- a/ext/mysqli/tests/bug51647.phpt +++ b/ext/mysqli/tests/bug51647.phpt @@ -39,69 +39,69 @@ $link->close(); ?> --FILE-- <?php - include ("connect.inc"); - - if (!is_object($link = mysqli_init())) - printf("[001] Cannot create link\n"); - - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT)) { - printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } - - if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) { - if (1064 == $link->errno) { - /* ERROR 1064 (42000): You have an error in your SQL syntax; = sql strict mode */ - if ($res = $link->query("SHOW STATUS")) { - while ($row = $res->fetch_assoc()) - if ($row['Variable_name'] == 'Ssl_cipher') - break; - } else { - printf("[005] [%d] %s\n", $link->errno, $link->error); - } - } else { - printf("[004] [%d] %s\n", $link->errno, $link->error); - } - } else { - if (!$row = $res->fetch_assoc()) - printf("[006] [%d] %s\n", $link->errno, $link->error); - if (!strlen($row["Value"])) - printf("[007] Empty cipher. No encryption!"); - var_dump($row); - } - - $link->close(); - - if (!is_object($link = mysqli_init())) - printf("[008] Cannot create link\n"); - - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL)) { - printf("[009] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } - - if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) { - if (1064 == $link->errno) { - /* ERROR 1064 (42000): You have an error in your SQL syntax; = sql strict mode */ - if ($res = $link->query("SHOW STATUS")) { - while ($row = $res->fetch_assoc()) - if ($row['Variable_name'] == 'Ssl_cipher') - break; - } else { - printf("[010] [%d] %s\n", $link->errno, $link->error); - } - } else { - printf("[011] [%d] %s\n", $link->errno, $link->error); - } - } else { - if (!$row = $res->fetch_assoc()) - printf("[012] [%d] %s\n", $link->errno, $link->error); - if (!strlen($row["Value"])) - printf("[013] Empty cipher. No encryption!"); - var_dump($row); - } - - $link->close(); - - print "done!"; + include ("connect.inc"); + + if (!is_object($link = mysqli_init())) + printf("[001] Cannot create link\n"); + + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT)) { + printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + + if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) { + if (1064 == $link->errno) { + /* ERROR 1064 (42000): You have an error in your SQL syntax; = sql strict mode */ + if ($res = $link->query("SHOW STATUS")) { + while ($row = $res->fetch_assoc()) + if ($row['Variable_name'] == 'Ssl_cipher') + break; + } else { + printf("[005] [%d] %s\n", $link->errno, $link->error); + } + } else { + printf("[004] [%d] %s\n", $link->errno, $link->error); + } + } else { + if (!$row = $res->fetch_assoc()) + printf("[006] [%d] %s\n", $link->errno, $link->error); + if (!strlen($row["Value"])) + printf("[007] Empty cipher. No encryption!"); + var_dump($row); + } + + $link->close(); + + if (!is_object($link = mysqli_init())) + printf("[008] Cannot create link\n"); + + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL)) { + printf("[009] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + + if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) { + if (1064 == $link->errno) { + /* ERROR 1064 (42000): You have an error in your SQL syntax; = sql strict mode */ + if ($res = $link->query("SHOW STATUS")) { + while ($row = $res->fetch_assoc()) + if ($row['Variable_name'] == 'Ssl_cipher') + break; + } else { + printf("[010] [%d] %s\n", $link->errno, $link->error); + } + } else { + printf("[011] [%d] %s\n", $link->errno, $link->error); + } + } else { + if (!$row = $res->fetch_assoc()) + printf("[012] [%d] %s\n", $link->errno, $link->error); + if (!strlen($row["Value"])) + printf("[013] Empty cipher. No encryption!"); + var_dump($row); + } + + $link->close(); + + print "done!"; ?> --EXPECTF-- array(2) { diff --git a/ext/mysqli/tests/bug52082.phpt b/ext/mysqli/tests/bug52082.phpt index 11157195ab..f601406e8f 100644 --- a/ext/mysqli/tests/bug52082.phpt +++ b/ext/mysqli/tests/bug52082.phpt @@ -8,19 +8,19 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - $link = mysqli_init(); - $link->options(MYSQLI_SET_CHARSET_NAME, "latin2"); - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { - die("can't connect"); - } - var_dump($link->query("show variables like 'character_set_client'")->fetch_row()); - var_dump($link->query("show variables like 'character_set_connection'")->fetch_row()); - $link->change_user($user, $passwd, $db); - var_dump($link->query("show variables like 'character_set_client'")->fetch_row()); - var_dump($link->query("show variables like 'character_set_connection'")->fetch_row()); + require_once("connect.inc"); + $link = mysqli_init(); + $link->options(MYSQLI_SET_CHARSET_NAME, "latin2"); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + die("can't connect"); + } + var_dump($link->query("show variables like 'character_set_client'")->fetch_row()); + var_dump($link->query("show variables like 'character_set_connection'")->fetch_row()); + $link->change_user($user, $passwd, $db); + var_dump($link->query("show variables like 'character_set_client'")->fetch_row()); + var_dump($link->query("show variables like 'character_set_connection'")->fetch_row()); - print "done!"; + print "done!"; ?> --EXPECT-- array(2) { diff --git a/ext/mysqli/tests/bug52891.phpt b/ext/mysqli/tests/bug52891.phpt index 22fcb735e3..f069255639 100644 --- a/ext/mysqli/tests/bug52891.phpt +++ b/ext/mysqli/tests/bug52891.phpt @@ -10,90 +10,90 @@ if (!$IS_MYSQLND) { ?> --FILE-- <?php - require_once("connect.inc"); + 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 = 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 tuint") || - !$link->query("DROP TABLE IF EXISTS tsint")) { - printf("[002] [%d] %s\n", $link->errno, $link->error); - } + if (!$link->query("DROP TABLE IF EXISTS tuint") || + !$link->query("DROP TABLE IF EXISTS tsint")) { + printf("[002] [%d] %s\n", $link->errno, $link->error); + } - if (!$link->query("CREATE TABLE tuint(a BIGINT UNSIGNED) ENGINE=" . $engine) || - !$link->query("CREATE TABLE tsint(a BIGINT) ENGINE=" . $engine)) { - printf("[003] [%d] %s\n", $link->errno, $link->error); - } + if (!$link->query("CREATE TABLE tuint(a BIGINT UNSIGNED) ENGINE=" . $engine) || + !$link->query("CREATE TABLE tsint(a BIGINT) ENGINE=" . $engine)) { + printf("[003] [%d] %s\n", $link->errno, $link->error); + } - if (!$stmt1 = $link->prepare("INSERT INTO tuint VALUES(?)")) - printf("[004] [%d] %s\n", $link->errno, $link->error); + if (!$stmt1 = $link->prepare("INSERT INTO tuint VALUES(?)")) + printf("[004] [%d] %s\n", $link->errno, $link->error); - if (!$stmt2 = $link->prepare("INSERT INTO tsint VALUES(?)")) - printf("[005] [%d] %s\n", $link->errno, $link->error); + if (!$stmt2 = $link->prepare("INSERT INTO tsint VALUES(?)")) + printf("[005] [%d] %s\n", $link->errno, $link->error); - $param = 42; + $param = 42; - if (!$stmt1->bind_param("i", $param)) - printf("[006] [%d] %s\n", $stmt1->errno, $stmt1->error); + if (!$stmt1->bind_param("i", $param)) + printf("[006] [%d] %s\n", $stmt1->errno, $stmt1->error); - if (!$stmt2->bind_param("i", $param)) - printf("[007] [%d] %s\n", $stmt2->errno, $stmt2->error); + if (!$stmt2->bind_param("i", $param)) + printf("[007] [%d] %s\n", $stmt2->errno, $stmt2->error); - /* first insert normal value to force initial send of types */ - if (!$stmt1->execute()) - printf("[008] [%d] %s\n", $stmt1->errno, $stmt1->error); + /* first insert normal value to force initial send of types */ + if (!$stmt1->execute()) + printf("[008] [%d] %s\n", $stmt1->errno, $stmt1->error); - if (!$stmt2->execute()) - printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error); + if (!$stmt2->execute()) + printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error); - /* now try values that don't fit in long, on 32bit, new types should be sent or 0 will be inserted */ - $param = -4294967297; - if (!$stmt2->execute()) - printf("[010] [%d] %s\n", $stmt2->errno, $stmt2->error); + /* now try values that don't fit in long, on 32bit, new types should be sent or 0 will be inserted */ + $param = -4294967297; + if (!$stmt2->execute()) + printf("[010] [%d] %s\n", $stmt2->errno, $stmt2->error); - /* again normal value */ - $param = 43; + /* again normal value */ + $param = 43; - if (!$stmt1->execute()) - printf("[011] [%d] %s\n", $stmt1->errno, $stmt1->error); + if (!$stmt1->execute()) + printf("[011] [%d] %s\n", $stmt1->errno, $stmt1->error); - if (!$stmt2->execute()) - printf("[012] [%d] %s\n", $stmt2->errno, $stmt2->error); + if (!$stmt2->execute()) + printf("[012] [%d] %s\n", $stmt2->errno, $stmt2->error); - /* again conversion */ - $param = -4294967295; - if (!$stmt2->execute()) - printf("[013] [%d] %s\n", $stmt2->errno, $stmt2->error); + /* again conversion */ + $param = -4294967295; + if (!$stmt2->execute()) + printf("[013] [%d] %s\n", $stmt2->errno, $stmt2->error); - $param = 4294967295; - if (!$stmt1->execute()) - printf("[014] [%d] %s\n", $stmt1->errno, $stmt1->error); + $param = 4294967295; + if (!$stmt1->execute()) + printf("[014] [%d] %s\n", $stmt1->errno, $stmt1->error); - if (!$stmt2->execute()) - printf("[015] [%d] %s\n", $stmt2->errno, $stmt2->error); + if (!$stmt2->execute()) + printf("[015] [%d] %s\n", $stmt2->errno, $stmt2->error); - $param = 4294967297; - if (!$stmt1->execute()) - printf("[016] [%d] %s\n", $stmt1->errno, $stmt1->error); + $param = 4294967297; + if (!$stmt1->execute()) + printf("[016] [%d] %s\n", $stmt1->errno, $stmt1->error); - if (!$stmt2->execute()) - printf("[017] [%d] %s\n", $stmt2->errno, $stmt2->error); + if (!$stmt2->execute()) + printf("[017] [%d] %s\n", $stmt2->errno, $stmt2->error); - $result = $link->query("SELECT * FROM tsint ORDER BY a ASC"); - $result2 = $link->query("SELECT * FROM tuint ORDER BY a ASC"); + $result = $link->query("SELECT * FROM tsint ORDER BY a ASC"); + $result2 = $link->query("SELECT * FROM tuint ORDER BY a ASC"); - echo "tsint:\n"; - while ($row = $result->fetch_assoc()) { - var_dump($row); - } - echo "tuint:\n"; - while ($row = $result2->fetch_assoc()) { - var_dump($row); - } + echo "tsint:\n"; + while ($row = $result->fetch_assoc()) { + var_dump($row); + } + echo "tuint:\n"; + while ($row = $result2->fetch_assoc()) { + var_dump($row); + } - echo "done"; + echo "done"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug53503.phpt b/ext/mysqli/tests/bug53503.phpt index fea62fde79..b71afe28c7 100644 --- a/ext/mysqli/tests/bug53503.phpt +++ b/ext/mysqli/tests/bug53503.phpt @@ -19,33 +19,33 @@ mysqli_close($link); mysqli.allow_local_infile=1 --FILE-- <?php - require_once("connect.inc"); + 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 = 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("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 (!$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 (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("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(); + 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 diff --git a/ext/mysqli/tests/bug54221.phpt b/ext/mysqli/tests/bug54221.phpt index eef4695327..602ea68583 100644 --- a/ext/mysqli/tests/bug54221.phpt +++ b/ext/mysqli/tests/bug54221.phpt @@ -12,34 +12,34 @@ mysqli.max_persistent = 0 mysqli.reconnect = Off --FILE-- <?php - include ("connect.inc"); + include ("connect.inc"); - $link = mysqli_init(); - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { - printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } + $link = mysqli_init(); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } - $create = "CREATE TEMPORARY TABLE IF NOT EXISTS t54221(a int)"; + $create = "CREATE TEMPORARY TABLE IF NOT EXISTS t54221(a int)"; - $query = "$create;$create;$create;"; - if ($link->multi_query($query)) { - do { - $sth = $link->store_result(); + $query = "$create;$create;$create;"; + if ($link->multi_query($query)) { + do { + $sth = $link->store_result(); - if ($link->warning_count) { - $warnings = $link->get_warnings(); - if ($warnings) { - do { - echo "Warning: ".$warnings->errno.": ".$warnings->message."\n"; - } while ($warnings->next()); - } - } - } while ($link->more_results() && $link->next_result()); - } + if ($link->warning_count) { + $warnings = $link->get_warnings(); + if ($warnings) { + do { + echo "Warning: ".$warnings->errno.": ".$warnings->message."\n"; + } while ($warnings->next()); + } + } + } while ($link->more_results() && $link->next_result()); + } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --EXPECT-- Warning: 1050: Table 't54221' already exists diff --git a/ext/mysqli/tests/bug54674.phpt b/ext/mysqli/tests/bug54674.phpt index e18eed7f99..b3c44be290 100644 --- a/ext/mysqli/tests/bug54674.phpt +++ b/ext/mysqli/tests/bug54674.phpt @@ -12,19 +12,19 @@ mysqli.max_persistent = 0 mysqli.reconnect = Off --FILE-- <?php - include ("connect.inc"); + include ("connect.inc"); - $link = mysqli_init(); - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { - printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } + $link = mysqli_init(); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } - $japanese_so = pack('H4', '835c'); - $link->set_charset('sjis'); - var_dump($link->real_escape_string($japanese_so) === $japanese_so); - mysqli_close($link); + $japanese_so = pack('H4', '835c'); + $link->set_charset('sjis'); + var_dump($link->real_escape_string($japanese_so) === $japanese_so); + mysqli_close($link); - print "done!"; + print "done!"; ?> --EXPECT-- bool(true) diff --git a/ext/mysqli/tests/bug55283.phpt b/ext/mysqli/tests/bug55283.phpt index 843400ff98..306a4af156 100644 --- a/ext/mysqli/tests/bug55283.phpt +++ b/ext/mysqli/tests/bug55283.phpt @@ -39,28 +39,28 @@ $link->close(); ?> --FILE-- <?php - require_once "connect.inc"; - $db1 = new mysqli(); + require_once "connect.inc"; + $db1 = new mysqli(); - $flags = MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT; + $flags = MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT; - $link = mysqli_init(); - mysqli_ssl_set($link, null, null, null, null, "AES256-SHA"); - if (my_mysqli_real_connect($link, 'p:' . $host, $user, $passwd, $db, $port, null, $flags)) { - $r = $link->query("SHOW STATUS LIKE 'Ssl_cipher'"); - var_dump($r->fetch_row()); - } + $link = mysqli_init(); + mysqli_ssl_set($link, null, null, null, null, "AES256-SHA"); + if (my_mysqli_real_connect($link, 'p:' . $host, $user, $passwd, $db, $port, null, $flags)) { + $r = $link->query("SHOW STATUS LIKE 'Ssl_cipher'"); + var_dump($r->fetch_row()); + } - /* non-persistent connection */ - $link2 = mysqli_init(); - mysqli_ssl_set($link2, null, null, null, null, "AES256-SHA"); - if (my_mysqli_real_connect($link2, $host, $user, $passwd, $db, $port, null, $flags)) { - $r2 = $link2->query("SHOW STATUS LIKE 'Ssl_cipher'"); - var_dump($r2->fetch_row()); - } + /* non-persistent connection */ + $link2 = mysqli_init(); + mysqli_ssl_set($link2, null, null, null, null, "AES256-SHA"); + if (my_mysqli_real_connect($link2, $host, $user, $passwd, $db, $port, null, $flags)) { + $r2 = $link2->query("SHOW STATUS LIKE 'Ssl_cipher'"); + var_dump($r2->fetch_row()); + } - echo "done\n"; + echo "done\n"; ?> --EXPECTF-- array(2) { diff --git a/ext/mysqli/tests/bug55582.phpt b/ext/mysqli/tests/bug55582.phpt index 132a731d0c..86626c0279 100644 --- a/ext/mysqli/tests/bug55582.phpt +++ b/ext/mysqli/tests/bug55582.phpt @@ -8,21 +8,21 @@ require_once("connect.inc"); ?> --FILE-- <?php - include "connect.inc"; - if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) { - printf("[001] Cannot connect to the server"); - } + include "connect.inc"; + if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) { + printf("[001] Cannot connect to the server"); + } - var_dump($link->real_query("SELECT 1")); - $res = $link->use_result(); - var_dump(mysqli_num_rows($res)); - var_dump($res->fetch_assoc()); - var_dump(mysqli_num_rows($res)); - var_dump($res->fetch_assoc()); - var_dump(mysqli_num_rows($res)); + var_dump($link->real_query("SELECT 1")); + $res = $link->use_result(); + var_dump(mysqli_num_rows($res)); + var_dump($res->fetch_assoc()); + var_dump(mysqli_num_rows($res)); + var_dump($res->fetch_assoc()); + var_dump(mysqli_num_rows($res)); - $link->close(); - echo "done\n"; + $link->close(); + echo "done\n"; ?> --EXPECTF-- bool(true) diff --git a/ext/mysqli/tests/bug55653.phpt b/ext/mysqli/tests/bug55653.phpt index 80e654771c..a51a7ddd22 100644 --- a/ext/mysqli/tests/bug55653.phpt +++ b/ext/mysqli/tests/bug55653.phpt @@ -7,30 +7,30 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + 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 = 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"; + $in_and_out = "a"; - if (!($stmt = $link->stmt_init())) - printf("[002] [%d] %s\n", $link->errno, $link->error); + 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->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 (!$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); + if ("a" !== $in_and_out) + printf("[005] Wrong result: '%s'\n", $in_and_out); - echo "done!"; + echo "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/bug62046.phpt b/ext/mysqli/tests/bug62046.phpt index e996de361d..5913ef399e 100644 --- a/ext/mysqli/tests/bug62046.phpt +++ b/ext/mysqli/tests/bug62046.phpt @@ -7,33 +7,33 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + 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!"; + 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) diff --git a/ext/mysqli/tests/bug66043.phpt b/ext/mysqli/tests/bug66043.phpt index 54ddf6943c..07714f217a 100644 --- a/ext/mysqli/tests/bug66043.phpt +++ b/ext/mysqli/tests/bug66043.phpt @@ -13,7 +13,7 @@ require_once('skipifconnectfailure.inc'); <?php require 'connect.inc'; if (!$db = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); } $stmt = $db->stmt_init(); diff --git a/ext/mysqli/tests/bug66124.phpt b/ext/mysqli/tests/bug66124.phpt index d5dec314cf..cede635e14 100644 --- a/ext/mysqli/tests/bug66124.phpt +++ b/ext/mysqli/tests/bug66124.phpt @@ -23,9 +23,9 @@ $id = '1311200011005001566'; require_once('connect.inc'); if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - exit(1); + printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + exit(1); } $link->query($table_drop); @@ -33,8 +33,8 @@ $link->query($table_create); $stmt = $link->prepare($table_insert); if (!$stmt) { - printf("Can't prepare\n"); - exit(1); + printf("Can't prepare\n"); + exit(1); } echo "Using 'i':\n"; @@ -43,8 +43,8 @@ $stmt->bind_param('i', $id); if ($stmt->execute()){ echo "insert id:{$id}=>{$stmt->insert_id}\n"; } else { - printf("Can't execute\n"); - exit(1); + printf("Can't execute\n"); + exit(1); } @@ -55,8 +55,8 @@ if ($result){ echo "fetch id:{$row['id']}\n"; } } else { - printf("Can't select\n"); - exit(1); + printf("Can't select\n"); + exit(1); } $stmt->close(); @@ -73,8 +73,8 @@ echo "Using 's':\n"; if ($stmt->execute()){ echo "insert id:{$id}\n"; } else{ - printf("Can't execute\n"); - exit(1); + printf("Can't execute\n"); + exit(1); } $result = $link->query($table_select); @@ -84,8 +84,8 @@ if ($result){ echo "fetch id:{$row['id']}\n"; } } else { - printf("Can't select\n"); - exit(1); + printf("Can't select\n"); + exit(1); } $link->close(); diff --git a/ext/mysqli/tests/bug66762.phpt b/ext/mysqli/tests/bug66762.phpt index f5240bc926..c1f749d8c4 100644 --- a/ext/mysqli/tests/bug66762.phpt +++ b/ext/mysqli/tests/bug66762.phpt @@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } + if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } - $read_stmt = $mysqli->prepare("SELECT 1"); + $read_stmt = $mysqli->prepare("SELECT 1"); - var_dump($read_stmt->bind_result($data)); + var_dump($read_stmt->bind_result($data)); - unset($mysqli); - var_dump($read_stmt->bind_result($data)); + unset($mysqli); + var_dump($read_stmt->bind_result($data)); ?> done! --EXPECT-- diff --git a/ext/mysqli/tests/bug67839.phpt b/ext/mysqli/tests/bug67839.phpt index f36c2bf6e7..4e8fd68ffd 100644 --- a/ext/mysqli/tests/bug67839.phpt +++ b/ext/mysqli/tests/bug67839.phpt @@ -10,55 +10,55 @@ mysqli_float_handling - ensure 4 byte float is handled correctly precision=5 --FILE-- <?php - require('connect.inc'); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - die(); - } + require('connect.inc'); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + die(); + } - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - die(); - } + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + die(); + } - if (!mysqli_query($link, "CREATE TABLE test(id INT PRIMARY KEY, fp4 FLOAT, fp8 DOUBLE) ENGINE = InnoDB")) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - die(); - } + if (!mysqli_query($link, "CREATE TABLE test(id INT PRIMARY KEY, fp4 FLOAT, fp8 DOUBLE) ENGINE = InnoDB")) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + die(); + } - // Insert via string to make sure the real floating number gets to the DB - if (!mysqli_query($link, "INSERT INTO test(id, fp4, fp8) VALUES (1, 9.9999, 9.9999)")) { - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - die(); - } + // Insert via string to make sure the real floating number gets to the DB + if (!mysqli_query($link, "INSERT INTO test(id, fp4, fp8) VALUES (1, 9.9999, 9.9999)")) { + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + die(); + } - if (!($stmt = mysqli_prepare($link, "SELECT id, fp4, fp8 FROM test"))) { - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - die(); - } + if (!($stmt = mysqli_prepare($link, "SELECT id, fp4, fp8 FROM test"))) { + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + die(); + } - $id = null; - $fp4 = null; - $fp8 = null; + $id = null; + $fp4 = null; + $fp8 = null; - if (!mysqli_stmt_bind_result($stmt, $id, $fp4, $fp8)) { - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - die(); - } + if (!mysqli_stmt_bind_result($stmt, $id, $fp4, $fp8)) { + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + die(); + } - if (!mysqli_stmt_execute($stmt)) { - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - die(); - } + if (!mysqli_stmt_execute($stmt)) { + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + die(); + } - if (!(mysqli_stmt_fetch($stmt))) { - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - die(); - } + if (!(mysqli_stmt_fetch($stmt))) { + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + die(); + } - print $id . ": " . $fp4 . ": " . $fp8 . "\n"; + print $id . ": " . $fp4 . ": " . $fp8 . "\n"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug68077.phpt b/ext/mysqli/tests/bug68077.phpt index 639603aa50..8e5ccfb410 100644 --- a/ext/mysqli/tests/bug68077.phpt +++ b/ext/mysqli/tests/bug68077.phpt @@ -23,42 +23,42 @@ mysqli.max_persistent=1 open_basedir= --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - ini_set("open_basedir", __DIR__); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } + ini_set("open_basedir", __DIR__); + 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("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 (!$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(__DIR__ . '/bug53503.data', "1\n2\n3\n")) - printf("[004] Failed to create CVS file\n"); + if (FALSE == file_put_contents(__DIR__ . '/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("SELECT 1 FROM DUAL")) + printf("[005] [%d] %s\n", $link->errno, $link->error); - if (!$link->query("LOAD DATA LOCAL INFILE '" . str_replace("\\", "/", __DIR__) . "/bug53503.data' INTO TABLE test")) { - printf("[006] [%d] %s\n", $link->errno, $link->error); - echo "bug\n"; - } else { - echo "done\n"; - } + if (!$link->query("LOAD DATA LOCAL INFILE '" . str_replace("\\", "/", __DIR__) . "/bug53503.data' INTO TABLE test")) { + printf("[006] [%d] %s\n", $link->errno, $link->error); + echo "bug\n"; + } else { + echo "done\n"; + } - ini_set("open_basedir", __DIR__ . "/dummy"); - if (!$link->query("LOAD DATA LOCAL INFILE '" . __DIR__ . "/bug53503.data' INTO TABLE test")) { - printf("[006] [%d] %s\n", $link->errno, $link->error); - echo "done\n"; - } else { - echo "bug\n"; - } - $link->close(); + ini_set("open_basedir", __DIR__ . "/dummy"); + if (!$link->query("LOAD DATA LOCAL INFILE '" . __DIR__ . "/bug53503.data' INTO TABLE test")) { + printf("[006] [%d] %s\n", $link->errno, $link->error); + echo "done\n"; + } else { + echo "bug\n"; + } + $link->close(); ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug69899.phpt b/ext/mysqli/tests/bug69899.phpt index 6859b91c13..da69e3c629 100644 --- a/ext/mysqli/tests/bug69899.phpt +++ b/ext/mysqli/tests/bug69899.phpt @@ -26,9 +26,9 @@ $mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket); $stmt = $mysqli->prepare('SELECT 1'); var_dump( - $mysqli->close(), - $stmt->free_result(), - $stmt->close() + $mysqli->close(), + $stmt->free_result(), + $stmt->close() ); ?> diff --git a/ext/mysqli/tests/bug70384.phpt b/ext/mysqli/tests/bug70384.phpt index 0f062f0035..27b9d16f25 100644 --- a/ext/mysqli/tests/bug70384.phpt +++ b/ext/mysqli/tests/bug70384.phpt @@ -19,40 +19,40 @@ mysqli_float_handling - ensure 4 byte float is handled correctly ?> --FILE-- <?php - require('connect.inc'); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - die(); - } + require('connect.inc'); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + die(); + } - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - die(); - } + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + die(); + } - if (!mysqli_query($link, "CREATE TABLE test(jsfield JSON) ENGINE = InnoDB")) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - die(); - } - $jsfield_data = '{"aaa": 123}'; - // Insert via string to make sure the real floating number gets to the DB - if (!mysqli_query($link, "INSERT INTO test VALUES ('".$jsfield_data."')")) { - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - die(); - } + if (!mysqli_query($link, "CREATE TABLE test(jsfield JSON) ENGINE = InnoDB")) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + die(); + } + $jsfield_data = '{"aaa": 123}'; + // Insert via string to make sure the real floating number gets to the DB + if (!mysqli_query($link, "INSERT INTO test VALUES ('".$jsfield_data."')")) { + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + die(); + } - if (!($res = mysqli_query($link, "SELECT * FROM test"))) { - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - die(); - } - $rows = $res->fetch_all(); - if (json_encode($rows[0][0]) != json_encode($jsfield_data)) { - printf("[006] Data differs"); - var_dump(json_encode($rows[0][0]) != json_encode($jsfield_data)); - die(); - } - mysqli_close($link); - echo "OK"; + if (!($res = mysqli_query($link, "SELECT * FROM test"))) { + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + die(); + } + $rows = $res->fetch_all(); + if (json_encode($rows[0][0]) != json_encode($jsfield_data)) { + printf("[006] Data differs"); + var_dump(json_encode($rows[0][0]) != json_encode($jsfield_data)); + die(); + } + mysqli_close($link); + echo "OK"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug70949.phpt b/ext/mysqli/tests/bug70949.phpt index dc7b202152..b9ad29b6b8 100644 --- a/ext/mysqli/tests/bug70949.phpt +++ b/ext/mysqli/tests/bug70949.phpt @@ -22,25 +22,25 @@ $sql = "select * from bug70949"; if ($stmt = $mysql->prepare($sql)) { - $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY); + $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY); - if ($stmt->bind_result($name)) { - { - if ($stmt->execute()) - { - while ($stmt->fetch()) - { - var_dump($name); - } - } - } + if ($stmt->bind_result($name)) { + { + if ($stmt->execute()) + { + while ($stmt->fetch()) + { + var_dump($name); + } + } + } - $stmt->free_result(); - $stmt->close(); - } + $stmt->free_result(); + $stmt->close(); + } - $mysql->close(); + $mysql->close(); } ?> diff --git a/ext/mysqli/tests/bug72701.phpt b/ext/mysqli/tests/bug72701.phpt index 8e6873aa33..2145de9b48 100644 --- a/ext/mysqli/tests/bug72701.phpt +++ b/ext/mysqli/tests/bug72701.phpt @@ -19,7 +19,7 @@ require_once("connect.inc"); $con = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); if (mysqli_connect_errno()) { - echo "Failed to connect to MySQL: " . mysqli_connect_error(); + echo "Failed to connect to MySQL: " . mysqli_connect_error(); } var_dump(preg_match(",(127.0.0.1|localhost) via .*,i", mysqli_get_host_info($con))); diff --git a/ext/mysqli/tests/bug73462.phpt b/ext/mysqli/tests/bug73462.phpt index f82115cf6c..1aa18d7fb6 100644 --- a/ext/mysqli/tests/bug73462.phpt +++ b/ext/mysqli/tests/bug73462.phpt @@ -8,38 +8,38 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /* Initial persistent connection */ - $mysql_1 = new mysqli('p:'.$host, $user, $passwd, $db); - $result = $mysql_1->query("SHOW STATUS LIKE 'Connections'"); - $c1 = $result->fetch_row(); - $result->free(); - $mysql_1->close(); + /* Initial persistent connection */ + $mysql_1 = new mysqli('p:'.$host, $user, $passwd, $db); + $result = $mysql_1->query("SHOW STATUS LIKE 'Connections'"); + $c1 = $result->fetch_row(); + $result->free(); + $mysql_1->close(); - /* Failed connection to invalid host */ - $mysql_2 = @new mysqli(' !!! invalid !!! ', $user, $passwd, $db); - try { - $mysql_2->close(); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + /* Failed connection to invalid host */ + $mysql_2 = @new mysqli(' !!! invalid !!! ', $user, $passwd, $db); + try { + $mysql_2->close(); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - /* Re-use persistent connection */ - $mysql_3 = new mysqli('p:'.$host, $user, $passwd, $db); - $error = mysqli_connect_errno(); - $result = $mysql_3->query("SHOW STATUS LIKE 'Connections'"); - $c3 = $result->fetch_row(); - $result->free(); - $mysql_3->close(); + /* Re-use persistent connection */ + $mysql_3 = new mysqli('p:'.$host, $user, $passwd, $db); + $error = mysqli_connect_errno(); + $result = $mysql_3->query("SHOW STATUS LIKE 'Connections'"); + $c3 = $result->fetch_row(); + $result->free(); + $mysql_3->close(); - if (end($c1) !== end($c3)) - printf("[001] Expected '%d' got '%d'.\n", end($c1), end($c3)); + if (end($c1) !== end($c3)) + printf("[001] Expected '%d' got '%d'.\n", end($c1), end($c3)); - if ($error !== 0) - printf("[002] Expected '0' got '%d'.\n", $error); + if ($error !== 0) + printf("[002] Expected '0' got '%d'.\n", $error); - print "done!"; + print "done!"; ?> --EXPECT-- mysqli object is already closed diff --git a/ext/mysqli/tests/bug74547.phpt b/ext/mysqli/tests/bug74547.phpt index c7075f07aa..90d790dc9e 100644 --- a/ext/mysqli/tests/bug74547.phpt +++ b/ext/mysqli/tests/bug74547.phpt @@ -7,17 +7,17 @@ Bug #74547 mysqli::change_user() doesn't accept null as $database argument w/str ?> --FILE-- <?php - declare(strict_types=1); + declare(strict_types=1); - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - var_dump(mysqli_change_user($link, $user, $passwd, NULL)); + var_dump(mysqli_change_user($link, $user, $passwd, NULL)); - mysqli_close($link); + mysqli_close($link); ?> --EXPECT-- bool(true) diff --git a/ext/mysqli/tests/bug74968.phpt b/ext/mysqli/tests/bug74968.phpt index f78fa92d83..e3e971eb1f 100644 --- a/ext/mysqli/tests/bug74968.phpt +++ b/ext/mysqli/tests/bug74968.phpt @@ -7,13 +7,13 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysqli = new mysqli("$host:$port", $user, $passwd, $db); - abstract class test { - public $a; - } - $mysqli->query("SELECT 1 as a")->fetch_object("test"); + $mysqli = new mysqli("$host:$port", $user, $passwd, $db); + abstract class test { + public $a; + } + $mysqli->query("SELECT 1 as a")->fetch_object("test"); ?> ==DONE== --EXPECTF-- diff --git a/ext/mysqli/tests/bug75018.phpt b/ext/mysqli/tests/bug75018.phpt index 3f719acd86..28af0bb77c 100644 --- a/ext/mysqli/tests/bug75018.phpt +++ b/ext/mysqli/tests/bug75018.phpt @@ -27,7 +27,7 @@ $sql = "SELECT bit_column_1 FROM $tbl"; $result = $mysqli->query($sql); while ($row = $result->fetch_assoc()) { - var_dump($row['bit_column_1']); + var_dump($row['bit_column_1']); } ?> diff --git a/ext/mysqli/tests/bug77956.phpt b/ext/mysqli/tests/bug77956.phpt index d2f74d7c01..d4bc06f93b 100644 --- a/ext/mysqli/tests/bug77956.phpt +++ b/ext/mysqli/tests/bug77956.phpt @@ -19,27 +19,27 @@ if ($msg = check_local_infile_support($link, $engine)) mysqli.allow_local_infile=0 --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('bug77956.data', "waa? meukee!")) - 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 'bug77956.data' INTO TABLE test")) { - printf("[006] [%d] %s\n", $link->errno, $link->error); - echo "done"; - } else { - echo "bug"; - } - $link->close(); + 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('bug77956.data', "waa? meukee!")) + 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 'bug77956.data' INTO TABLE test")) { + printf("[006] [%d] %s\n", $link->errno, $link->error); + echo "done"; + } else { + echo "bug"; + } + $link->close(); ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/bug_bits.phpt b/ext/mysqli/tests/bug_bits.phpt index 59752e4159..a4afa3e544 100644 --- a/ext/mysqli/tests/bug_bits.phpt +++ b/ext/mysqli/tests/bug_bits.phpt @@ -22,12 +22,12 @@ if (!$link->query("CREATE TABLE `bug_bits` (`inty` bigint(20) unsigned NOT NULL } $insertQuery = "INSERT INTO `bug_bits` VALUES (18446744073709551615, 18446744073709551615)". - ",(18446744073709551614, 18446744073709551614)". - ",(4294967296, 4294967296)". - ",(4294967295, 4294967295)". - ",(2147483648, 2147483648)". - ",(2147483647, 2147483647)". - ",(1, 1)"; + ",(18446744073709551614, 18446744073709551614)". + ",(4294967296, 4294967296)". + ",(4294967295, 4294967295)". + ",(2147483648, 2147483648)". + ",(2147483647, 2147483647)". + ",(1, 1)"; if (!$link->query($insertQuery)) { printf("[004] [%d] %s\n", $link->errno, $link->error); } @@ -37,7 +37,7 @@ if (!($res = $link->query("SELECT * FROM `bug_bits`"))) { } while ($row = $res->fetch_assoc()) { - var_dump($row); + var_dump($row); } $link->close(); diff --git a/ext/mysqli/tests/bug_mysql_49406.phpt b/ext/mysqli/tests/bug_mysql_49406.phpt index 74ea471702..73ca0ad882 100644 --- a/ext/mysqli/tests/bug_mysql_49406.phpt +++ b/ext/mysqli/tests/bug_mysql_49406.phpt @@ -7,90 +7,90 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - $query = "SELECT CASE WHEN 0 THEN CAST('2009-12-03' AS DATE) ELSE CAST('2009-12-03' AS DATE) END"; + $query = "SELECT CASE WHEN 0 THEN CAST('2009-12-03' AS DATE) ELSE CAST('2009-12-03' AS DATE) END"; - if (!$res = $link->query($query)) - printf("[002] [%d] %s\n", $link->errno, $link->error); + if (!$res = $link->query($query)) + printf("[002] [%d] %s\n", $link->errno, $link->error); - if (!$row = $res->fetch_row()) - printf("[003] No result, [%d] %s\n", $link->errno, $link->error); + if (!$row = $res->fetch_row()) + printf("[003] No result, [%d] %s\n", $link->errno, $link->error); - $res->free(); + $res->free(); - if ($row[0] != '2009-12-03') { - printf("[004] Expecting '2009-12-03' got '%s'\n", $row[0]); - } + if ($row[0] != '2009-12-03') { + printf("[004] Expecting '2009-12-03' got '%s'\n", $row[0]); + } - if (!$stmt = $link->prepare($query)) - printf("[005] [%d] %s\n", $link->errno, $link->error); + if (!$stmt = $link->prepare($query)) + printf("[005] [%d] %s\n", $link->errno, $link->error); - if (!$stmt->execute() || !$stmt->store_result()) - printf("[006] [%d] %s\n", $stmt->errno, $stmt->error); + if (!$stmt->execute() || !$stmt->store_result()) + printf("[006] [%d] %s\n", $stmt->errno, $stmt->error); - $datatypes = array( - MYSQLI_TYPE_TINY => "TINY", - MYSQLI_TYPE_SHORT => "SHORT", - MYSQLI_TYPE_LONG => "LONG", - MYSQLI_TYPE_FLOAT => "FLOAT", - MYSQLI_TYPE_DOUBLE => "DOUBLE", - MYSQLI_TYPE_TIMESTAMP => "TIMESTAMP", - MYSQLI_TYPE_LONGLONG => "LONGLONG", - MYSQLI_TYPE_INT24 => "INT24", - MYSQLI_TYPE_DATE => "DATE", - MYSQLI_TYPE_TIME => "TIME", - MYSQLI_TYPE_DATETIME => "DATETIME", - MYSQLI_TYPE_YEAR => "YEAR", - MYSQLI_TYPE_ENUM => "ENUM", - MYSQLI_TYPE_SET => "SET", - MYSQLI_TYPE_TINY_BLOB => "TINYBLOB", - MYSQLI_TYPE_MEDIUM_BLOB => "MEDIUMBLOB", - MYSQLI_TYPE_LONG_BLOB => "LONGBLOB", - MYSQLI_TYPE_BLOB => "BLOB", - MYSQLI_TYPE_VAR_STRING => "VAR_STRING", - MYSQLI_TYPE_STRING => "STRING", - MYSQLI_TYPE_NULL => "NULL", - MYSQLI_TYPE_NEWDATE => "NEWDATE", - MYSQLI_TYPE_INTERVAL => "INTERVAL", - MYSQLI_TYPE_GEOMETRY => "GEOMETRY", - ); + $datatypes = array( + MYSQLI_TYPE_TINY => "TINY", + MYSQLI_TYPE_SHORT => "SHORT", + MYSQLI_TYPE_LONG => "LONG", + MYSQLI_TYPE_FLOAT => "FLOAT", + MYSQLI_TYPE_DOUBLE => "DOUBLE", + MYSQLI_TYPE_TIMESTAMP => "TIMESTAMP", + MYSQLI_TYPE_LONGLONG => "LONGLONG", + MYSQLI_TYPE_INT24 => "INT24", + MYSQLI_TYPE_DATE => "DATE", + MYSQLI_TYPE_TIME => "TIME", + MYSQLI_TYPE_DATETIME => "DATETIME", + MYSQLI_TYPE_YEAR => "YEAR", + MYSQLI_TYPE_ENUM => "ENUM", + MYSQLI_TYPE_SET => "SET", + MYSQLI_TYPE_TINY_BLOB => "TINYBLOB", + MYSQLI_TYPE_MEDIUM_BLOB => "MEDIUMBLOB", + MYSQLI_TYPE_LONG_BLOB => "LONGBLOB", + MYSQLI_TYPE_BLOB => "BLOB", + MYSQLI_TYPE_VAR_STRING => "VAR_STRING", + MYSQLI_TYPE_STRING => "STRING", + MYSQLI_TYPE_NULL => "NULL", + MYSQLI_TYPE_NEWDATE => "NEWDATE", + MYSQLI_TYPE_INTERVAL => "INTERVAL", + MYSQLI_TYPE_GEOMETRY => "GEOMETRY", + ); - $meta_res = $stmt->result_metadata(); - for ($field_idx = 0; $field_idx < $meta_res->field_count; $field_idx++) { - $field = $meta_res->fetch_field(); - printf("Field : %d\n", $field_idx); - printf("Name : %s\n", $field->name); - printf("Orgname : %s\n", $field->orgname); - printf("Table : %s\n", $field->table); - printf("Orgtable : %s\n", $field->orgtable); - printf("Maxlength : %d\n", $field->max_length); - printf("Length : %d\n", $field->length); - printf("Charsetnr : %d\n", $field->charsetnr); - printf("Flags : %d\n", $field->flags); - printf("Type : %d (%s)\n", $field->type, (isset($datatypes[$field->type])) ? $datatypes[$field->type] : 'unknown'); - printf("Decimals : %d\n", $field->decimals); - } + $meta_res = $stmt->result_metadata(); + for ($field_idx = 0; $field_idx < $meta_res->field_count; $field_idx++) { + $field = $meta_res->fetch_field(); + printf("Field : %d\n", $field_idx); + printf("Name : %s\n", $field->name); + printf("Orgname : %s\n", $field->orgname); + printf("Table : %s\n", $field->table); + printf("Orgtable : %s\n", $field->orgtable); + printf("Maxlength : %d\n", $field->max_length); + printf("Length : %d\n", $field->length); + printf("Charsetnr : %d\n", $field->charsetnr); + printf("Flags : %d\n", $field->flags); + printf("Type : %d (%s)\n", $field->type, (isset($datatypes[$field->type])) ? $datatypes[$field->type] : 'unknown'); + printf("Decimals : %d\n", $field->decimals); + } - $row_stmt = null; - if (!$stmt->bind_result($row_stmt) || !$stmt->fetch()) - printf("[007] [%d] %s\n", $stmt->errno, $stmt->error); + $row_stmt = null; + if (!$stmt->bind_result($row_stmt) || !$stmt->fetch()) + printf("[007] [%d] %s\n", $stmt->errno, $stmt->error); - if ($row[0] != $row_stmt) { - printf("[008] PS and non-PS results differ, dumping data\n"); - var_dump($row[0]); - var_dump($row_stmt); - } + if ($row[0] != $row_stmt) { + printf("[008] PS and non-PS results differ, dumping data\n"); + var_dump($row[0]); + var_dump($row_stmt); + } - $stmt->close(); - $link->close(); + $stmt->close(); + $link->close(); - echo "done"; + echo "done"; ?> --EXPECTF-- Field : %s diff --git a/ext/mysqli/tests/clean_table.inc b/ext/mysqli/tests/clean_table.inc index 86e5fcb379..a3dc8b66de 100644 --- a/ext/mysqli/tests/clean_table.inc +++ b/ext/mysqli/tests/clean_table.inc @@ -2,12 +2,12 @@ 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); + 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 (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } mysqli_close($link); diff --git a/ext/mysqli/tests/connect.inc b/ext/mysqli/tests/connect.inc index c190e6f61f..439a7ab8f1 100644 --- a/ext/mysqli/tests/connect.inc +++ b/ext/mysqli/tests/connect.inc @@ -1,150 +1,150 @@ <?php - /* - Default values are "localhost", "root", - database "test" and empty password. - Change the MYSQL_TEST environment values - if you want to use another configuration - */ - - $driver = new mysqli_driver; - - $host = getenv("MYSQL_TEST_HOST") ?: "localhost"; - $port = getenv("MYSQL_TEST_PORT") ?: 3306; - $user = getenv("MYSQL_TEST_USER") ?: "root"; - $passwd = getenv("MYSQL_TEST_PASSWD") ?: ""; - $db = getenv("MYSQL_TEST_DB") ?: "test"; - $engine = getenv("MYSQL_TEST_ENGINE") ?: "MyISAM"; - $socket = getenv("MYSQL_TEST_SOCKET") ?: null; - $skip_on_connect_failure = getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") ?: true; - $connect_flags = (int)getenv("MYSQL_TEST_CONNECT_FLAGS") ?: 0; - if ($socket) { - ini_set('mysqli.default_socket', $socket); - } - - /* Development setting: test experimal features and/or feature requests that never worked before? */ - $TEST_EXPERIMENTAL = (in_array(getenv("MYSQL_TEST_EXPERIMENTAL"), array(0, 1))) ? - ((1 == getenv("MYSQL_TEST_EXPERIMENTAL")) ? true : false) : - false; - - $IS_MYSQLND = stristr(mysqli_get_client_info(), "mysqlnd"); - - if (!function_exists('sys_get_temp_dir')) { - function sys_get_temp_dir() { - - if (!empty($_ENV['TMP'])) - return realpath( $_ENV['TMP'] ); - if (!empty($_ENV['TMPDIR'])) - return realpath( $_ENV['TMPDIR'] ); - if (!empty($_ENV['TEMP'])) - return realpath( $_ENV['TEMP'] ); - - $temp_file = tempnam(md5(uniqid(rand(), TRUE)), ''); - if ($temp_file) { - $temp_dir = realpath(dirname($temp_file)); - unlink($temp_file); - return $temp_dir; - } - return FALSE; - } - } - - if (!function_exists('my_mysqli_connect')) { - - /** - * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible - * - * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)? - */ - function my_mysqli_connect($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) { - global $connect_flags; - - $flags = $enable_env_flags? $connect_flags:0; - if ($flags !== 0) { - $link = mysqli_init(); - if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags)) - $link = false; - } else { - $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); - } - - return $link; - } - - /** - * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible - * - * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS) - */ - function my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags = 0, $enable_env_flags = true) { - global $connect_flags; - - if ($enable_env_flags) - $flags = $flags | $connect_flags; - - return mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags); - } - - class my_mysqli extends mysqli { - public function __construct($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) { - global $connect_flags; - - $flags = ($enable_env_flags) ? $connect_flags : 0; - - if ($flags !== false) { - parent::init(); - $this->real_connect($host, $user, $passwd, $db, $port, $socket, $flags); - } else { - parent::__construct($host, $user, $passwd, $db, $port, $socket); - } - } - } - - function have_innodb($link) { - if (($res = $link->query("SHOW VARIABLES LIKE 'have_innodb'")) && - ($row = $res->fetch_row()) && - !empty($row)) { - if ($row[1] == "DISABLED" || $row[1] == "NO") { - return false; - } - return true; - } else { - /* MySQL 5.6.1+ */ - if ($res = $link->query("SHOW ENGINES")) { - while ($row = $res->fetch_assoc()) { - if (!isset($row['Engine']) || !isset($row['Support'])) - return false; - - if (('InnoDB' == $row['Engine']) && - (('YES' == $row['Support']) || ('DEFAULT' == $row['Support'])) - ) { - return true; - } - } - return false; - } else { - return false; - } - } - return false; - } - - } else { - printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n"); - } - - function handle_catchable_fatal($errno, $error, $file, $line) { - static $errcodes = array(); - if (empty($errcodes)) { - $constants = get_defined_constants(); - foreach ($constants as $name => $value) { - if (substr($name, 0, 2) == "E_") - $errcodes[$value] = $name; - } - } - printf("[%s] %s in %s on line %s\n", - (isset($errcodes[$errno])) ? $errcodes[$errno] : $errno, - $error, $file, $line); - - return true; - } + /* + Default values are "localhost", "root", + database "test" and empty password. + Change the MYSQL_TEST environment values + if you want to use another configuration + */ + + $driver = new mysqli_driver; + + $host = getenv("MYSQL_TEST_HOST") ?: "localhost"; + $port = getenv("MYSQL_TEST_PORT") ?: 3306; + $user = getenv("MYSQL_TEST_USER") ?: "root"; + $passwd = getenv("MYSQL_TEST_PASSWD") ?: ""; + $db = getenv("MYSQL_TEST_DB") ?: "test"; + $engine = getenv("MYSQL_TEST_ENGINE") ?: "MyISAM"; + $socket = getenv("MYSQL_TEST_SOCKET") ?: null; + $skip_on_connect_failure = getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") ?: true; + $connect_flags = (int)getenv("MYSQL_TEST_CONNECT_FLAGS") ?: 0; + if ($socket) { + ini_set('mysqli.default_socket', $socket); + } + + /* Development setting: test experimal features and/or feature requests that never worked before? */ + $TEST_EXPERIMENTAL = (in_array(getenv("MYSQL_TEST_EXPERIMENTAL"), array(0, 1))) ? + ((1 == getenv("MYSQL_TEST_EXPERIMENTAL")) ? true : false) : + false; + + $IS_MYSQLND = stristr(mysqli_get_client_info(), "mysqlnd"); + + if (!function_exists('sys_get_temp_dir')) { + function sys_get_temp_dir() { + + if (!empty($_ENV['TMP'])) + return realpath( $_ENV['TMP'] ); + if (!empty($_ENV['TMPDIR'])) + return realpath( $_ENV['TMPDIR'] ); + if (!empty($_ENV['TEMP'])) + return realpath( $_ENV['TEMP'] ); + + $temp_file = tempnam(md5(uniqid(rand(), TRUE)), ''); + if ($temp_file) { + $temp_dir = realpath(dirname($temp_file)); + unlink($temp_file); + return $temp_dir; + } + return FALSE; + } + } + + if (!function_exists('my_mysqli_connect')) { + + /** + * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible + * + * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)? + */ + function my_mysqli_connect($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) { + global $connect_flags; + + $flags = $enable_env_flags? $connect_flags:0; + if ($flags !== 0) { + $link = mysqli_init(); + if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags)) + $link = false; + } else { + $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); + } + + return $link; + } + + /** + * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible + * + * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS) + */ + function my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags = 0, $enable_env_flags = true) { + global $connect_flags; + + if ($enable_env_flags) + $flags = $flags | $connect_flags; + + return mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags); + } + + class my_mysqli extends mysqli { + public function __construct($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) { + global $connect_flags; + + $flags = ($enable_env_flags) ? $connect_flags : 0; + + if ($flags !== false) { + parent::init(); + $this->real_connect($host, $user, $passwd, $db, $port, $socket, $flags); + } else { + parent::__construct($host, $user, $passwd, $db, $port, $socket); + } + } + } + + function have_innodb($link) { + if (($res = $link->query("SHOW VARIABLES LIKE 'have_innodb'")) && + ($row = $res->fetch_row()) && + !empty($row)) { + if ($row[1] == "DISABLED" || $row[1] == "NO") { + return false; + } + return true; + } else { + /* MySQL 5.6.1+ */ + if ($res = $link->query("SHOW ENGINES")) { + while ($row = $res->fetch_assoc()) { + if (!isset($row['Engine']) || !isset($row['Support'])) + return false; + + if (('InnoDB' == $row['Engine']) && + (('YES' == $row['Support']) || ('DEFAULT' == $row['Support'])) + ) { + return true; + } + } + return false; + } else { + return false; + } + } + return false; + } + + } else { + printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n"); + } + + function handle_catchable_fatal($errno, $error, $file, $line) { + static $errcodes = array(); + if (empty($errcodes)) { + $constants = get_defined_constants(); + foreach ($constants as $name => $value) { + if (substr($name, 0, 2) == "E_") + $errcodes[$value] = $name; + } + } + printf("[%s] %s in %s on line %s\n", + (isset($errcodes[$errno])) ? $errcodes[$errno] : $errno, + $error, $file, $line); + + return true; + } ?> diff --git a/ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt b/ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt index b075df94d3..9c94aa6dfb 100644 --- a/ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt +++ b/ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt @@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc'); ?>
--FILE--
<?php
- require_once("connect.inc");
- require('table.inc');
+ require_once("connect.inc");
+ require('table.inc');
- // Returns only one result set
- $link->multi_query("SELECT 1");
+ // Returns only one result set
+ $link->multi_query("SELECT 1");
var_dump($link->next_result()); // should return false
var_dump($link->store_result()); // now what happens here!?
- // Returns only one result set
- $link->multi_query("SELECT 1");
+ // Returns only one result set
+ $link->multi_query("SELECT 1");
var_dump($link->next_result());
var_dump($link->use_result());
diff --git a/ext/mysqli/tests/local_infile_tools.inc b/ext/mysqli/tests/local_infile_tools.inc index af66d4c20c..fef400d0a9 100644 --- a/ext/mysqli/tests/local_infile_tools.inc +++ b/ext/mysqli/tests/local_infile_tools.inc @@ -1,146 +1,146 @@ <?php - /* Utility function for mysqli_set_local_infile*.phpt tests */ - function shutdown_clean($file) { - if ($file) { - unlink($file); - } - } - - function check_local_infile_support($link, $engine, $table_name = 'test') { - - if (!$res = mysqli_query($link, 'SHOW VARIABLES LIKE "local_infile"')) - return "Cannot check if Server variable 'local_infile' is set to 'ON'"; - - $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if ('ON' != $row['Value']) - return sprintf("Server variable 'local_infile' seems not set to 'ON', found '%s'", $row['Value']); - - if (!mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name))) { - return "Failed to drop old test table"; - } - - if (!mysqli_query($link, $sql = sprintf('CREATE TABLE %s(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=%s', - $table_name, $engine))) - return "Failed to create test table: $sql"; - - $file = create_standard_csv(1, false); - if (!$file) { - mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name)); - return "Cannot create CSV file"; - } - - if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' - INTO TABLE %s - FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' - LINES TERMINATED BY '\n'", - mysqli_real_escape_string($link, $file), - $table_name))) { - if (1148 == mysqli_errno($link)) { - mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name)); - return "Cannot test LOAD DATA LOCAL INFILE, [1148] The used command is not allowed with this MySQL version"; - } else if ($link->errno) { - return $link->error; - } - } - mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name)); - return ""; - } - - function create_standard_csv($offset, $verbose = true) { - // create a CVS file - $file = tempnam(sys_get_temp_dir(), 'mysqli_test'); - if (!$fp = fopen($file, 'w')) { - if ($verbose) - printf("[%03d + 1] Cannot create CVS file '%s'\n", $offset, $file); - return NULL; - } else { - /* Looks ugly? No, handy if you have crashes... */ - register_shutdown_function("shutdown_clean", $file); - } - - if (!fwrite($fp, "97;'x';\n") || - !fwrite($fp, "98;'y';\n") || - !fwrite($fp, "99;'z';\n")) { - if ($verbose) - printf("[%03d + 3] Cannot write CVS file '%s'\n", $offset, $file); - return NULL; - } - - fclose($fp); - - if (!chmod($file, 0644)) { - if ($verbose) - printf("[%03d + 4] Cannot change the file perms of '%s' from 0600 to 0644, MySQL might not be able to read it\n", - $offset, $file); - return NULL; - } - return $file; - } - - function try_handler($offset, $link, $file, $handler, $expected = null) { - - if ('default' == $handler) { - mysqli_set_local_infile_default($link); - } else if (!mysqli_set_local_infile_handler($link, $handler)) { - printf("[%03d] Cannot set infile handler to '%s'\n", $offset, $handler); - return false; - } - printf("Callback set to '%s'\n", $handler); - - if (!mysqli_query($link, sprintf("DELETE FROM test"))) { - printf("[%03d] Cannot remove records, [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' - INTO TABLE test - FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' - LINES TERMINATED BY '\n'", - mysqli_real_escape_string($link, $file)))) { - printf("[%03d] LOAD DATA failed, [%d] %s\n", - $offset + 2, - mysqli_errno($link), mysqli_error($link)); - } - - if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) { - printf("[%03d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!is_array($expected)) - return true; - - foreach ($expected as $k => $values) { - if (!$tmp = mysqli_fetch_assoc($res)) { - printf("[%03d/%d] [%d] '%s'\n", $offset + 4, $k, mysqli_errno($link), mysqli_error($link)); - return false; - } - if ($values['id'] != $tmp['id']) { - printf("[%03d/%d] Expecting %s got %s\n", - $offset + 5, $k, - $values['id'], $tmp['id']); - return false; - } - if ($values['label'] != $tmp['label']) { - printf("[%03d/%d] Expecting %s got %s\n", - $offset + 6, $k, - $values['label'], $tmp['label']); - return false; - } - } - - if ($res && $tmp = mysqli_fetch_assoc($res)) { - printf("[%03d] More results than expected!\n", $offset + 7); - do { - var_dump($tmp); - } while ($tmp = mysqli_fetch_assoc($res)); - return false; - } - - if ($res) - mysqli_free_result($res); - - return true; - } + /* Utility function for mysqli_set_local_infile*.phpt tests */ + function shutdown_clean($file) { + if ($file) { + unlink($file); + } + } + + function check_local_infile_support($link, $engine, $table_name = 'test') { + + if (!$res = mysqli_query($link, 'SHOW VARIABLES LIKE "local_infile"')) + return "Cannot check if Server variable 'local_infile' is set to 'ON'"; + + $row = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if ('ON' != $row['Value']) + return sprintf("Server variable 'local_infile' seems not set to 'ON', found '%s'", $row['Value']); + + if (!mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name))) { + return "Failed to drop old test table"; + } + + if (!mysqli_query($link, $sql = sprintf('CREATE TABLE %s(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=%s', + $table_name, $engine))) + return "Failed to create test table: $sql"; + + $file = create_standard_csv(1, false); + if (!$file) { + mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name)); + return "Cannot create CSV file"; + } + + if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' + INTO TABLE %s + FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' + LINES TERMINATED BY '\n'", + mysqli_real_escape_string($link, $file), + $table_name))) { + if (1148 == mysqli_errno($link)) { + mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name)); + return "Cannot test LOAD DATA LOCAL INFILE, [1148] The used command is not allowed with this MySQL version"; + } else if ($link->errno) { + return $link->error; + } + } + mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name)); + return ""; + } + + function create_standard_csv($offset, $verbose = true) { + // create a CVS file + $file = tempnam(sys_get_temp_dir(), 'mysqli_test'); + if (!$fp = fopen($file, 'w')) { + if ($verbose) + printf("[%03d + 1] Cannot create CVS file '%s'\n", $offset, $file); + return NULL; + } else { + /* Looks ugly? No, handy if you have crashes... */ + register_shutdown_function("shutdown_clean", $file); + } + + if (!fwrite($fp, "97;'x';\n") || + !fwrite($fp, "98;'y';\n") || + !fwrite($fp, "99;'z';\n")) { + if ($verbose) + printf("[%03d + 3] Cannot write CVS file '%s'\n", $offset, $file); + return NULL; + } + + fclose($fp); + + if (!chmod($file, 0644)) { + if ($verbose) + printf("[%03d + 4] Cannot change the file perms of '%s' from 0600 to 0644, MySQL might not be able to read it\n", + $offset, $file); + return NULL; + } + return $file; + } + + function try_handler($offset, $link, $file, $handler, $expected = null) { + + if ('default' == $handler) { + mysqli_set_local_infile_default($link); + } else if (!mysqli_set_local_infile_handler($link, $handler)) { + printf("[%03d] Cannot set infile handler to '%s'\n", $offset, $handler); + return false; + } + printf("Callback set to '%s'\n", $handler); + + if (!mysqli_query($link, sprintf("DELETE FROM test"))) { + printf("[%03d] Cannot remove records, [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' + INTO TABLE test + FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' + LINES TERMINATED BY '\n'", + mysqli_real_escape_string($link, $file)))) { + printf("[%03d] LOAD DATA failed, [%d] %s\n", + $offset + 2, + mysqli_errno($link), mysqli_error($link)); + } + + if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) { + printf("[%03d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!is_array($expected)) + return true; + + foreach ($expected as $k => $values) { + if (!$tmp = mysqli_fetch_assoc($res)) { + printf("[%03d/%d] [%d] '%s'\n", $offset + 4, $k, mysqli_errno($link), mysqli_error($link)); + return false; + } + if ($values['id'] != $tmp['id']) { + printf("[%03d/%d] Expecting %s got %s\n", + $offset + 5, $k, + $values['id'], $tmp['id']); + return false; + } + if ($values['label'] != $tmp['label']) { + printf("[%03d/%d] Expecting %s got %s\n", + $offset + 6, $k, + $values['label'], $tmp['label']); + return false; + } + } + + if ($res && $tmp = mysqli_fetch_assoc($res)) { + printf("[%03d] More results than expected!\n", $offset + 7); + do { + var_dump($tmp); + } while ($tmp = mysqli_fetch_assoc($res)); + return false; + } + + if ($res) + mysqli_free_result($res); + + return true; + } ?> diff --git a/ext/mysqli/tests/mysqli_affected_rows.phpt b/ext/mysqli/tests/mysqli_affected_rows.phpt index c74d0bc0ca..f89c56ef0f 100644 --- a/ext/mysqli/tests/mysqli_affected_rows.phpt +++ b/ext/mysqli/tests/mysqli_affected_rows.phpt @@ -8,115 +8,115 @@ mysqli_affected_rows() ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[004] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (0 !== ($tmp = mysqli_affected_rows($link))) - printf("[005] Expecting int/0, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + if (0 !== ($tmp = mysqli_affected_rows($link))) + printf("[005] Expecting int/0, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine)) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine)) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a')")) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a')")) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (1 !== ($tmp = mysqli_affected_rows($link))) - printf("[010] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = mysqli_affected_rows($link))) + printf("[010] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - // ignore INSERT error, NOTE: command line returns 0, affected_rows returns -1 as documented - mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a')"); - if (-1 !== ($tmp = mysqli_affected_rows($link))) - printf("[011] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp); + // ignore INSERT error, NOTE: command line returns 0, affected_rows returns -1 as documented + mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a')"); + if (-1 !== ($tmp = mysqli_affected_rows($link))) + printf("[011] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4")) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4")) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (2 !== ($tmp = mysqli_affected_rows($link))) - printf("[013] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); + if (2 !== ($tmp = mysqli_affected_rows($link))) + printf("[013] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')")) - printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')")) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (2 !== ($tmp = mysqli_affected_rows($link))) - printf("[015] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); + if (2 !== ($tmp = mysqli_affected_rows($link))) + printf("[015] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, "INSERT IGNORE INTO test(id, label) VALUES (1, 'a')")) { - printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!mysqli_query($link, "INSERT IGNORE INTO test(id, label) VALUES (1, 'a')")) { + printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - if (1 !== ($tmp = mysqli_affected_rows($link))) - printf("[017] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = mysqli_affected_rows($link))) + printf("[017] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, "INSERT INTO test(id, label) SELECT id + 10, label FROM test")) - printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test(id, label) SELECT id + 10, label FROM test")) + printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (4 !== ($tmp = mysqli_affected_rows($link))) - printf("[019] Expecting int/4, got %s/%s\n", gettype($tmp), $tmp); + if (4 !== ($tmp = mysqli_affected_rows($link))) + printf("[019] Expecting int/4, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, "REPLACE INTO test(id, label) values (4, 'd')")) - printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "REPLACE INTO test(id, label) values (4, 'd')")) + printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (2 !== ($tmp = mysqli_affected_rows($link))) - printf("[021] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); + if (2 !== ($tmp = mysqli_affected_rows($link))) + printf("[021] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, "REPLACE INTO test(id, label) values (5, 'e')")) - printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "REPLACE INTO test(id, label) values (5, 'e')")) + printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (1 !== ($tmp = mysqli_affected_rows($link))) - printf("[023] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = mysqli_affected_rows($link))) + printf("[023] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2")) - printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2")) + printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (1 !== ($tmp = mysqli_affected_rows($link))) - printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = mysqli_affected_rows($link))) + printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - $charsets = array('utf8'); - foreach ($charsets as $k => $charset) { - if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $charset)))) - continue; - mysqli_free_result($res); - if (true !== ($tmp = mysqli_set_charset($link, $charset))) - printf("[026] Expecting boolean/true got %s/%s\n", - gettype($tmp), $tmp); - if (0 !== ($tmp = mysqli_affected_rows($link))) - printf("[027] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp); - } + $charsets = array('utf8'); + foreach ($charsets as $k => $charset) { + if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $charset)))) + continue; + mysqli_free_result($res); + if (true !== ($tmp = mysqli_set_charset($link, $charset))) + printf("[026] Expecting boolean/true got %s/%s\n", + gettype($tmp), $tmp); + if (0 !== ($tmp = mysqli_affected_rows($link))) + printf("[027] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp); + } - if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2")) { - printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2")) { + printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - if (0 !== ($tmp = mysqli_affected_rows($link))) - printf("[029] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = mysqli_affected_rows($link))) + printf("[029] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 100")) { - printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 100")) { + printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - if (0 !== ($tmp = mysqli_affected_rows($link))) - printf("[031] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = mysqli_affected_rows($link))) + printf("[031] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) - printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) + printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_close($link); + mysqli_close($link); - try { - mysqli_affected_rows($link); + try { + mysqli_affected_rows($link); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_affected_rows_oo.phpt b/ext/mysqli/tests/mysqli_affected_rows_oo.phpt index 054971f6ee..5a83d1cfb4 100644 --- a/ext/mysqli/tests/mysqli_affected_rows_oo.phpt +++ b/ext/mysqli/tests/mysqli_affected_rows_oo.phpt @@ -8,109 +8,109 @@ mysqli->affected_rows ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysqli = new mysqli(); - try { - $mysqli->affected_rows; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + $mysqli = new mysqli(); + try { + $mysqli->affected_rows; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - } + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - if (0 !== ($tmp = $mysqli->affected_rows)) - printf("[002] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = $mysqli->affected_rows)) + printf("[002] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli->query('DROP TABLE IF EXISTS test')) - printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('DROP TABLE IF EXISTS test')) + printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (!$mysqli->query('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine)) - printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine)) + printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (!$mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a')")) - printf("[005] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a')")) + printf("[005] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (1 !== ($tmp = $mysqli->affected_rows)) - printf("[006] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = $mysqli->affected_rows)) + printf("[006] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - // ignore INSERT error, NOTE: command line returns 0, affected_rows returns -1 as documented - $mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a')"); - if (-1 !== ($tmp = $mysqli->affected_rows)) - printf("[007] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp); + // ignore INSERT error, NOTE: command line returns 0, affected_rows returns -1 as documented + $mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a')"); + if (-1 !== ($tmp = $mysqli->affected_rows)) + printf("[007] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4")) - printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4")) + printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (2 !== ($tmp = $mysqli->affected_rows)) - printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); + if (2 !== ($tmp = $mysqli->affected_rows)) + printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli->query("INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')")) - printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query("INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')")) + printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (2 !== ($tmp = $mysqli->affected_rows)) - printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); + if (2 !== ($tmp = $mysqli->affected_rows)) + printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli->query("INSERT IGNORE INTO test(id, label) VALUES (1, 'a')")) { - printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error); - } + if (!$mysqli->query("INSERT IGNORE INTO test(id, label) VALUES (1, 'a')")) { + printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error); + } - if (1 !== ($tmp = $mysqli->affected_rows)) - printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = $mysqli->affected_rows)) + printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli->query("INSERT INTO test(id, label) SELECT id + 10, label FROM test")) - printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query("INSERT INTO test(id, label) SELECT id + 10, label FROM test")) + printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (4 !== ($tmp = $mysqli->affected_rows)) - printf("[015] Expecting int/4, got %s/%s\n", gettype($tmp), $tmp); + if (4 !== ($tmp = $mysqli->affected_rows)) + printf("[015] Expecting int/4, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli->query("REPLACE INTO test(id, label) values (4, 'd')")) - printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query("REPLACE INTO test(id, label) values (4, 'd')")) + printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (2 !== ($tmp = $mysqli->affected_rows)) - printf("[016] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); + if (2 !== ($tmp = $mysqli->affected_rows)) + printf("[016] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli->query("REPLACE INTO test(id, label) values (5, 'e')")) - printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query("REPLACE INTO test(id, label) values (5, 'e')")) + printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (1 !== ($tmp = $mysqli->affected_rows)) - printf("[018] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = $mysqli->affected_rows)) + printf("[018] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2")) - printf("[019] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2")) + printf("[019] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (1 !== ($tmp = $mysqli->affected_rows)) - printf("[020] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = $mysqli->affected_rows)) + printf("[020] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2")) { - printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error); - } + if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2")) { + printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error); + } - if (0 !== ($tmp = $mysqli->affected_rows)) - printf("[022] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = $mysqli->affected_rows)) + printf("[022] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 100")) { - printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error); - } + if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 100")) { + printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error); + } - if (0 !== ($tmp = $mysqli->affected_rows)) - printf("[024] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = $mysqli->affected_rows)) + printf("[024] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli->query('DROP TABLE IF EXISTS test')) - printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('DROP TABLE IF EXISTS test')) + printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error); - $mysqli->close(); + $mysqli->close(); - try { + try { $mysqli->affected_rows; } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_auth_pam.phpt b/ext/mysqli/tests/mysqli_auth_pam.phpt index 30d2da5675..cdbcf2947e 100644 --- a/ext/mysqli/tests/mysqli_auth_pam.phpt +++ b/ext/mysqli/tests/mysqli_auth_pam.phpt @@ -56,30 +56,30 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pamtest@'%%'" max_execution_time=240 --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - if (!$link = my_mysqli_connect($host, 'pamtest', 'pamtest', $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - } else { + if (!$link = my_mysqli_connect($host, 'pamtest', 'pamtest', $db, $port, $socket)) { + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } else { - if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) - printf("[002] [%d] %s\n", $link->errno, $link->error); + if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) + printf("[002] [%d] %s\n", $link->errno, $link->error); - if (!$row = mysqli_fetch_assoc($res)) { - printf("[003] [%d] %s\n", $link->errno, $link->error); - } + if (!$row = mysqli_fetch_assoc($res)) { + printf("[003] [%d] %s\n", $link->errno, $link->error); + } - if ($row['id'] != 1) { - printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']); - } + if ($row['id'] != 1) { + printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']); + } - $res->close(); - $link->close(); - } + $res->close(); + $link->close(); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_autocommit.phpt b/ext/mysqli/tests/mysqli_autocommit.phpt index 908cb315c3..21435e7a08 100644 --- a/ext/mysqli/tests/mysqli_autocommit.phpt +++ b/ext/mysqli/tests/mysqli_autocommit.phpt @@ -17,118 +17,118 @@ mysqli_autocommit() ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[004] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - if (!is_bool($tmp = mysqli_autocommit($link, true))) - printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp); + if (!is_bool($tmp = mysqli_autocommit($link, true))) + printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, 'SET AUTOCOMMIT = 0')) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'SET AUTOCOMMIT = 0')) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit')) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit')) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if ($tmp['auto_commit']) - printf("[008] Cannot turn off autocommit\n"); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if ($tmp['auto_commit']) + printf("[008] Cannot turn off autocommit\n"); - if (true !== ($tmp = mysqli_autocommit($link, true))) - printf("[009] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_autocommit($link, true))) + printf("[009] Expecting true, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit')) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (!$tmp['auto_commit']) - printf("[011] Cannot turn on autocommit\n"); + if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit')) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if (!$tmp['auto_commit']) + printf("[011] Cannot turn on autocommit\n"); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) { - printf("[013] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) { + printf("[013] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) - printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'ROLLBACK')) - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'ROLLBACK')) + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test')) - printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test')) + printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num'])) - printf("[17] Expecting 1 row in table test, found %d rows. [%d] %s\n", - $tmp['num'], mysqli_errno($link), mysqli_error($link)); + if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num'])) + printf("[17] Expecting 1 row in table test, found %d rows. [%d] %s\n", + $tmp['num'], mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) - printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) + printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'SET AUTOCOMMIT = 1')) - printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'SET AUTOCOMMIT = 1')) + printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit')) - printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (!$tmp['auto_commit']) - printf("[021] Cannot turn on autocommit\n"); + if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit')) + printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if (!$tmp['auto_commit']) + printf("[021] Cannot turn on autocommit\n"); - if (true !== ($tmp = mysqli_autocommit($link, false))) - printf("[022] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_autocommit($link, false))) + printf("[022] Expecting true, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) { - printf("[023] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) { + printf("[023] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) - printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) + printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'ROLLBACK')) - printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'ROLLBACK')) + printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test')) - printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - if (0 != $tmp['num']) - printf("[27] Expecting 0 rows in table test, found %d rows\n", $tmp['num']); - mysqli_free_result($res); + if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test')) + printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + if (0 != $tmp['num']) + printf("[27] Expecting 0 rows in table test, found %d rows\n", $tmp['num']); + mysqli_free_result($res); - if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) - printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) + printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'COMMIT')) - printf("[029] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'COMMIT')) + printf("[029] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test')) - printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test')) + printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num'])) - printf("[31] Expecting 1 row in table test, found %d rows. [%d] %s\n", - $tmp['num'], mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num'])) + printf("[31] Expecting 1 row in table test, found %d rows. [%d] %s\n", + $tmp['num'], mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) - printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) + printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_close($link); + mysqli_close($link); - try { + try { mysqli_autocommit($link, false); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; --CLEAN-- <?php require_once("clean_table.inc"); diff --git a/ext/mysqli/tests/mysqli_autocommit_oo.phpt b/ext/mysqli/tests/mysqli_autocommit_oo.phpt index cca7dab0b5..2720047e37 100644 --- a/ext/mysqli/tests/mysqli_autocommit_oo.phpt +++ b/ext/mysqli/tests/mysqli_autocommit_oo.phpt @@ -18,119 +18,119 @@ mysqli->autocommit() ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - } + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - if (!is_bool($tmp = $mysqli->autocommit(true))) - printf("[002] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp); + if (!is_bool($tmp = $mysqli->autocommit(true))) + printf("[002] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli->query('SET AUTOCOMMIT = 0')) - printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('SET AUTOCOMMIT = 0')) + printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit')) - printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit')) + printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); - $tmp = $res->fetch_assoc(); - $res->free_result(); - if ($tmp['auto_commit']) - printf("[005] Cannot turn off autocommit\n"); + $tmp = $res->fetch_assoc(); + $res->free_result(); + if ($tmp['auto_commit']) + printf("[005] Cannot turn off autocommit\n"); - if (true !== ($tmp = $mysqli->autocommit( true))) - printf("[006] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = $mysqli->autocommit( true))) + printf("[006] Expecting true, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit')) - printf("[007] [%d] %s\n", $mysqli->errno, $mysqli->error); - $tmp = $res->fetch_assoc(); - $res->free_result(); - if (!$tmp['auto_commit']) - printf("[008] Cannot turn on autocommit\n"); + if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit')) + printf("[007] [%d] %s\n", $mysqli->errno, $mysqli->error); + $tmp = $res->fetch_assoc(); + $res->free_result(); + if (!$tmp['auto_commit']) + printf("[008] Cannot turn on autocommit\n"); - if (!$mysqli->query('DROP TABLE IF EXISTS test')) - printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('DROP TABLE IF EXISTS test')) + printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) { - printf("[010] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error); - } + if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) { + printf("[010] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error); + } - if (!$mysqli->query('INSERT INTO test(id) VALUES (1)')) - printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('INSERT INTO test(id) VALUES (1)')) + printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (!$mysqli->query('ROLLBACK')) - printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('ROLLBACK')) + printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test')) - printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test')) + printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error); - if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num'])) - printf("[014] Expecting 1 row in table test, found %d rows. [%d] %s\n", - $tmp['num'], $mysqli->errno, $mysqli->error); + if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num'])) + printf("[014] Expecting 1 row in table test, found %d rows. [%d] %s\n", + $tmp['num'], $mysqli->errno, $mysqli->error); - $res->free_result(); + $res->free_result(); - if (!$mysqli->query('DROP TABLE IF EXISTS test')) - printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('DROP TABLE IF EXISTS test')) + printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (!$mysqli->query('SET AUTOCOMMIT = 1')) - printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('SET AUTOCOMMIT = 1')) + printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit')) - printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit')) + printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error); - $tmp = $res->fetch_assoc(); - $res->free_result(); - if (!$tmp['auto_commit']) - printf("[018] Cannot turn on autocommit\n"); + $tmp = $res->fetch_assoc(); + $res->free_result(); + if (!$tmp['auto_commit']) + printf("[018] Cannot turn on autocommit\n"); - if (true !== ($tmp = $mysqli->autocommit( false))) - printf("[019] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = $mysqli->autocommit( false))) + printf("[019] Expecting true, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) { - printf("[020] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error); - } + if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) { + printf("[020] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error); + } - if (!$mysqli->query('INSERT INTO test(id) VALUES (1)')) - printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('INSERT INTO test(id) VALUES (1)')) + printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (!$mysqli->query('ROLLBACK')) - printf("[022] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('ROLLBACK')) + printf("[022] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test')) - printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error); - $tmp = $res->fetch_assoc(); - if (0 != $tmp['num']) - printf("[24] Expecting 0 rows in table test, found %d rows\n", $tmp['num']); - $res->free_result(); + if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test')) + printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error); + $tmp = $res->fetch_assoc(); + if (0 != $tmp['num']) + printf("[24] Expecting 0 rows in table test, found %d rows\n", $tmp['num']); + $res->free_result(); - if (!$mysqli->query('INSERT INTO test(id) VALUES (1)')) - printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('INSERT INTO test(id) VALUES (1)')) + printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (!$mysqli->query('COMMIT')) - printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('COMMIT')) + printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error); - if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test')) - printf("[027] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test')) + printf("[027] [%d] %s\n", $mysqli->errno, $mysqli->error); - if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num'])) - printf("[028] Expecting 1 row in table test, found %d rows. [%d] %s\n", - $tmp['num'], $mysqli->errno, $mysqli->error); - $res->free_result(); + if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num'])) + printf("[028] Expecting 1 row in table test, found %d rows. [%d] %s\n", + $tmp['num'], $mysqli->errno, $mysqli->error); + $res->free_result(); - if (!$mysqli->query('DROP TABLE IF EXISTS test')) - printf("[029] [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('DROP TABLE IF EXISTS test')) + printf("[029] [%d] %s\n", $mysqli->errno, $mysqli->error); - $mysqli->close(); + $mysqli->close(); - try { + try { $mysqli->autocommit(false); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_begin_transaction.phpt b/ext/mysqli/tests/mysqli_begin_transaction.phpt index ab945e4cb1..64fd7e3043 100644 --- a/ext/mysqli/tests/mysqli_begin_transaction.phpt +++ b/ext/mysqli/tests/mysqli_begin_transaction.phpt @@ -15,83 +15,83 @@ if (!have_innodb($link)) ?> --FILE-- <?php - require_once("connect.inc"); - /* {{{ proto bool mysqli_begin_transaction(object link, [int flags [, string name]]) */ - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) - printf("[009] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (true !== ($tmp = mysqli_autocommit($link, true))) - printf("[010] Cannot turn on autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); - - /* overrule autocommit */ - if (true !== ($tmp = mysqli_begin_transaction($link))) - printf("[011] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $tmp = mysqli_rollback($link); - if ($tmp !== true) - printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - /* empty */ - $res = mysqli_query($link, "SELECT * FROM test"); - var_dump($res->fetch_assoc()); - - /* valid flags */ - $flags = array(MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT); - - if (mysqli_get_server_version($link) >= 50605) { - $flags[] = MYSQLI_TRANS_START_READ_WRITE; - $flags[] = MYSQLI_TRANS_START_READ_ONLY; - } - - /* just coverage */ - foreach ($flags as $flag) { - if (!mysqli_begin_transaction($link, $flag, sprintf("flag %d", $flag))) { - printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (!mysqli_query($link, 'SELECT * FROM test') || !mysqli_rollback($link)) { - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - } - - /* does it really set a flag? */ - if (mysqli_get_server_version($link) >= 50605) { - if (!mysqli_begin_transaction($link, MYSQLI_TRANS_START_READ_ONLY, sprintf("flag %d", $flag))) { - printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (mysqli_query($link, "INSERT INTO test(id) VALUES (2)")) { - printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } else if (!mysqli_commit($link)) { - printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } else { - $res = mysqli_query($link, "SELECT id FROM test WHERE id = 2"); - } - } - - if (!mysqli_begin_transaction($link, -1)) { - printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - if (mysqli_get_server_version($link) >= 50605) { - /* does it like stupid names? */ - if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "*/trick me?\n\0")) - printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - /* does it like stupid names? */ - if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "az09")) - printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - print "done!"; + require_once("connect.inc"); + /* {{{ proto bool mysqli_begin_transaction(object link, [int flags [, string name]]) */ + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) + printf("[009] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (true !== ($tmp = mysqli_autocommit($link, true))) + printf("[010] Cannot turn on autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); + + /* overrule autocommit */ + if (true !== ($tmp = mysqli_begin_transaction($link))) + printf("[011] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $tmp = mysqli_rollback($link); + if ($tmp !== true) + printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + /* empty */ + $res = mysqli_query($link, "SELECT * FROM test"); + var_dump($res->fetch_assoc()); + + /* valid flags */ + $flags = array(MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT); + + if (mysqli_get_server_version($link) >= 50605) { + $flags[] = MYSQLI_TRANS_START_READ_WRITE; + $flags[] = MYSQLI_TRANS_START_READ_ONLY; + } + + /* just coverage */ + foreach ($flags as $flag) { + if (!mysqli_begin_transaction($link, $flag, sprintf("flag %d", $flag))) { + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (!mysqli_query($link, 'SELECT * FROM test') || !mysqli_rollback($link)) { + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + } + + /* does it really set a flag? */ + if (mysqli_get_server_version($link) >= 50605) { + if (!mysqli_begin_transaction($link, MYSQLI_TRANS_START_READ_ONLY, sprintf("flag %d", $flag))) { + printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (mysqli_query($link, "INSERT INTO test(id) VALUES (2)")) { + printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } else if (!mysqli_commit($link)) { + printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } else { + $res = mysqli_query($link, "SELECT id FROM test WHERE id = 2"); + } + } + + if (!mysqli_begin_transaction($link, -1)) { + printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + if (mysqli_get_server_version($link) >= 50605) { + /* does it like stupid names? */ + if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "*/trick me?\n\0")) + printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + /* does it like stupid names? */ + if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "az09")) + printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_change_user.phpt b/ext/mysqli/tests/mysqli_change_user.phpt index 4ad928bb0f..347126a7d4 100644 --- a/ext/mysqli/tests/mysqli_change_user.phpt +++ b/ext/mysqli/tests/mysqli_change_user.phpt @@ -8,126 +8,126 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[006] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db))) - printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db))) + printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[008] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd . '_unknown_really', $db))) - printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd . '_unknown_really', $db))) + printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - // Reconnect because after 3 failed change_user attempts, the server blocks you off. - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[009a] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + // Reconnect because after 3 failed change_user attempts, the server blocks you off. + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[009a] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1')) - printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1')) + printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var')) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (1 != $tmp['test_var']) - printf("[012] Cannot set test variable\n"); + if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var')) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if (1 != $tmp['test_var']) + printf("[012] Cannot set test variable\n"); - if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db))) - printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db))) + printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user')) - printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); + if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user')) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); - if (substr($tmp['user'], 0, strlen($user)) !== $user) - printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']); - if ($tmp['dbname'] != $db) - printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']); + if (substr($tmp['user'], 0, strlen($user)) !== $user) + printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']); + if ($tmp['dbname'] != $db) + printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']); - if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db . '_unknown_really'))) - printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db . '_unknown_really'))) + printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[012] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[012] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - if (false !== ($tmp = @mysqli_change_user($link, str_repeat('user', 16384), str_repeat('pass', 16384), str_repeat('dbase', 16384)))) - printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = @mysqli_change_user($link, str_repeat('user', 16384), str_repeat('pass', 16384), str_repeat('dbase', 16384)))) + printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[014] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - /* silent protocol change if no db which requires workaround in mysqlnd/libmysql + /* silent protocol change if no db which requires workaround in mysqlnd/libmysql (empty db = no db send with COM_CHANGE_USER) */ - if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, ""))) - printf("[015] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, ""))) + printf("[015] Expecting true, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user')) - printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); + if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user')) + printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); - if ($tmp['dbname'] != "") - printf("[017] Expecting database '', got database() '%s'\n", $tmp['dbname']); + if ($tmp['dbname'] != "") + printf("[017] Expecting database '', got database() '%s'\n", $tmp['dbname']); - mysqli_close($link); + mysqli_close($link); - try { + try { mysqli_change_user($link, $user, $passwd, $db); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[019] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1')) - printf("[020] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var')) - printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (1 != $tmp['test_var']) - printf("[022] Cannot set test variable\n"); - - if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db))) - printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp); - - if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user')) - printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - - if (substr($tmp['user'], 0, strlen($user)) !== $user) - printf("[025] Expecting user %s, got user() %s\n", $user, $tmp['user']); - if ($tmp['dbname'] != $db) - printf("[026] Expecting database %s, got database() %s\n", $db, $tmp['dbname']); - - if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var')) - printf("[027] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (NULL !== $tmp['test_var']) - printf("[028] Test variable is still set!\n"); - - print "done!"; + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[019] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1')) + printf("[020] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var')) + printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if (1 != $tmp['test_var']) + printf("[022] Cannot set test variable\n"); + + if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db))) + printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + + if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user')) + printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + + if (substr($tmp['user'], 0, strlen($user)) !== $user) + printf("[025] Expecting user %s, got user() %s\n", $user, $tmp['user']); + if ($tmp['dbname'] != $db) + printf("[026] Expecting database %s, got database() %s\n", $db, $tmp['dbname']); + + if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var')) + printf("[027] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if (NULL !== $tmp['test_var']) + printf("[028] Test variable is still set!\n"); + + print "done!"; ?> --EXPECT-- mysqli object is already closed diff --git a/ext/mysqli/tests/mysqli_change_user_get_lock.phpt b/ext/mysqli/tests/mysqli_change_user_get_lock.phpt index 4cc071d7ab..75d0930a83 100644 --- a/ext/mysqli/tests/mysqli_change_user_get_lock.phpt +++ b/ext/mysqli/tests/mysqli_change_user_get_lock.phpt @@ -11,87 +11,87 @@ die("skip - is the server still buggy?"); max_execution_time=240 --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - // We need this little hack to be able to re-run the test - $lock = 'phptest_' . mt_rand(0, 100000); - $thread_id = mysqli_thread_id($link); + // We need this little hack to be able to re-run the test + $lock = 'phptest_' . mt_rand(0, 100000); + $thread_id = mysqli_thread_id($link); - printf("Testing GET_LOCK()...\n"); + printf("Testing GET_LOCK()...\n"); - if (!$res = mysqli_query($link, sprintf('SELECT GET_LOCK("%s", 2) AS _ok', $lock))) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, sprintf('SELECT GET_LOCK("%s", 2) AS _ok', $lock))) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ($row['_ok'] != 1) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - else - printf("... lock '%s' acquired by thread %d\n", $lock, $thread_id); + if ($row['_ok'] != 1) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + else + printf("... lock '%s' acquired by thread %d\n", $lock, $thread_id); - mysqli_free_result($res); + mysqli_free_result($res); - // GET_LOCK("phptest") should be released - /* From the mysql_change_user documentation: + // GET_LOCK("phptest") should be released + /* From the mysql_change_user documentation: This command resets the state as if one had done a new connect. (See Section 25.2.13, “Controlling Automatic Reconnect Behaviorâ€.) It always performs a ROLLBACK of any active transactions, closes and drops all temporary tables, and unlocks all locked tables. Session system variables are reset to the values of the corresponding global system variables. Prepared statements are released and HANDLER variables are closed. Locks acquired with GET_LOCK() are released. These effects occur even if the user didn't change. - */ - mysqli_change_user($link, $user, $passwd, $db); + */ + mysqli_change_user($link, $user, $passwd, $db); sleep(5); - $new_thread_id = mysqli_thread_id($link); + $new_thread_id = mysqli_thread_id($link); - printf("... calling IS_USED_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id); - if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok')) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + printf("... calling IS_USED_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id); + if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok')) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ($row['_ok'] != NULL) - printf("[006] Lock '%s' should have been released, [%d] %s\n", - $lock, - mysqli_errno($link), mysqli_error($link)); + if ($row['_ok'] != NULL) + printf("[006] Lock '%s' should have been released, [%d] %s\n", + $lock, + mysqli_errno($link), mysqli_error($link)); - printf("... calling IS_FREE_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id); - if (!$res = mysqli_query($link, 'SELECT IS_FREE_LOCK("phptest") AS _ok')) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + printf("... calling IS_FREE_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id); + if (!$res = mysqli_query($link, 'SELECT IS_FREE_LOCK("phptest") AS _ok')) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ($row['_ok'] != 1) - printf("[009] Lock '%s' should have been released, [%d] %s\n", - $lock, - mysqli_errno($link), mysqli_error($link)); + if ($row['_ok'] != 1) + printf("[009] Lock '%s' should have been released, [%d] %s\n", + $lock, + mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - /* Ok, let's try a NEW connection and a NEW lock! */ - mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[010] Cannot open new connection, [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); + /* Ok, let's try a NEW connection and a NEW lock! */ + mysqli_close($link); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[010] Cannot open new connection, [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); - do { - $newlock = 'phptest_' . mt_rand(0, 100000); - } while ($lock == $newlock); + do { + $newlock = 'phptest_' . mt_rand(0, 100000); + } while ($lock == $newlock); - $new_thread_id = mysqli_thread_id($link); - printf("... calling IS_USED_LOCK() on '%s' using new connection with thread '%d'\n", $newlock, $new_thread_id); - if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok')) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $new_thread_id = mysqli_thread_id($link); + printf("... calling IS_USED_LOCK() on '%s' using new connection with thread '%d'\n", $newlock, $new_thread_id); + if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok')) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ($row['_ok'] != NULL) - printf("[013] Lock '%s' should have been released, [%d] %s\n", - $lock, - mysqli_errno($link), mysqli_error($link)); + if ($row['_ok'] != NULL) + printf("[013] Lock '%s' should have been released, [%d] %s\n", + $lock, + mysqli_errno($link), mysqli_error($link)); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_change_user_insert_id.phpt b/ext/mysqli/tests/mysqli_change_user_insert_id.phpt index d25e09b2f5..52e1c1c491 100644 --- a/ext/mysqli/tests/mysqli_change_user_insert_id.phpt +++ b/ext/mysqli/tests/mysqli_change_user_insert_id.phpt @@ -13,49 +13,49 @@ if (!$IS_MYSQLND) { ?> --FILE-- <?php - require_once('connect.inc'); + require_once('connect.inc'); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, label CHAR(10))')) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, label CHAR(10))')) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')")) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (($insert_id = mysqli_insert_id($link)) !== 100) - printf("[005] Expecting 100, got %d, [%d] %s\n", - $insert_id, - mysqli_errno($link), mysqli_error($link)); + if (($insert_id = mysqli_insert_id($link)) !== 100) + printf("[005] Expecting 100, got %d, [%d] %s\n", + $insert_id, + mysqli_errno($link), mysqli_error($link)); - // LAST_INSERT_ID should be reset - mysqli_change_user($link, $user, $passwd, $db); + // LAST_INSERT_ID should be reset + mysqli_change_user($link, $user, $passwd, $db); - if (($insert_id = mysqli_insert_id($link)) !== 0) - printf("[006] Expecting 0, got %d, [%d] %s\n", - $insert_id, - mysqli_errno($link), mysqli_error($link)); + if (($insert_id = mysqli_insert_id($link)) !== 0) + printf("[006] Expecting 0, got %d, [%d] %s\n", + $insert_id, + mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, 'SELECT LAST_INSERT_ID() as _insert_id')) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT LAST_INSERT_ID() as _insert_id')) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + if (!$row = mysqli_fetch_assoc($res)) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); - if ($row['_insert_id'] != $insert_id) - printf("LAST_INSERT_ID() [%d] and mysqli_insert_id [%d] differ!\n", - $row['_insert_id'], $insert_id); + if ($row['_insert_id'] != $insert_id) + printf("LAST_INSERT_ID() [%d] and mysqli_insert_id [%d] differ!\n", + $row['_insert_id'], $insert_id); - if ($row['_insert_id'] != 0) - printf("Expecting 0 got %d\n", $row['_insert_id']); + if ($row['_insert_id'] != 0) + printf("Expecting 0 got %d\n", $row['_insert_id']); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt b/ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt index fa8c66f56b..f9e0e30644 100644 --- a/ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt +++ b/ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt @@ -9,95 +9,95 @@ die("skip - is the server still buggy?"); ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot create second connection handle, [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); + if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot create second connection handle, [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); - if (!mysqli_query($link, 'LOCK TABLE test WRITE')) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'LOCK TABLE test WRITE')) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - /* - if ($res = mysqli_query($link2, 'SELECT COUNT(*) AS _num FROM test')) { - printf("[003] Reading from test should not be possible due to a lock, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link2)); - mysqli_free_result($res); - } - */ + /* + if ($res = mysqli_query($link2, 'SELECT COUNT(*) AS _num FROM test')) { + printf("[003] Reading from test should not be possible due to a lock, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link2)); + mysqli_free_result($res); + } + */ - // LOCKS should be removed - mysqli_change_user($link, $user, $passwd, $db); + // LOCKS should be removed + mysqli_change_user($link, $user, $passwd, $db); - if (!$res = mysqli_query($link2, 'SELECT COUNT(*) AS _num FROM test')) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link2, 'SELECT COUNT(*) AS _num FROM test')) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ($row['_num'] < 1) - printf("[005] There should be some rows in the table test\n"); + if ($row['_num'] < 1) + printf("[005] There should be some rows in the table test\n"); - mysqli_free_result($res); - mysqli_close($link2); + mysqli_free_result($res); + mysqli_close($link2); - if (!mysqli_query($link, 'DROP TABLE test')) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP TABLE test')) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'CREATE TEMPORARY TABLE test(id INT)')) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'CREATE TEMPORARY TABLE test(id INT)')) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1), (2), (3)')) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1), (2), (3)')) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ($row['_num'] != 3) - printf("[011] There should be three rows in the table test\n"); + if ($row['_num'] != 3) + printf("[011] There should be three rows in the table test\n"); - mysqli_free_result($res); + mysqli_free_result($res); - // Temporary tables should be dropped - mysqli_change_user($link, $user, $passwd, $db); + // Temporary tables should be dropped + mysqli_change_user($link, $user, $passwd, $db); - if ($res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) { - printf("[012] There should be no table test any more, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - } + if ($res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) { + printf("[012] There should be no table test any more, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); + } - if (!$res = mysqli_query($link, 'SELECT GET_LOCK("phptest", 2) AS _ok')) - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT GET_LOCK("phptest", 2) AS _ok')) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ($row['_ok'] != 1) - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if ($row['_ok'] != 1) + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - // GET_LOCK("phptest") should be released - mysqli_change_user($link, $user, $passwd, $db); + // GET_LOCK("phptest") should be released + mysqli_change_user($link, $user, $passwd, $db); - if (!$res = mysqli_query($link, 'SELECT IS_FREE_LOCK("phptest") AS _ok')) - printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT IS_FREE_LOCK("phptest") AS _ok')) + printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ($row['_ok'] != 1) - printf("[018] Lock 'phptest' should have been released, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); + if ($row['_ok'] != 1) + printf("[018] Lock 'phptest' should have been released, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - mysqli_close($link); - print "done!"; + mysqli_free_result($res); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_change_user_new.phpt b/ext/mysqli/tests/mysqli_change_user_new.phpt index e9ef937406..1d6d2f5945 100644 --- a/ext/mysqli/tests/mysqli_change_user_new.phpt +++ b/ext/mysqli/tests/mysqli_change_user_new.phpt @@ -15,25 +15,25 @@ if (mysqli_get_server_version($link) < 50600) ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - /* Pre 5.6: link remains useable */ - if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db))) - printf("[002] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + /* Pre 5.6: link remains useable */ + if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db))) + printf("[002] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, 'SELECT 1 AS _one')) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - else - var_dump($res->fetch_assoc()); + if (!$res = mysqli_query($link, 'SELECT 1 AS _one')) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + else + var_dump($res->fetch_assoc()); - print "done!"; + print "done!"; ?> --EXPECT-- [003] [2006] MySQL server has gone away diff --git a/ext/mysqli/tests/mysqli_change_user_old.phpt b/ext/mysqli/tests/mysqli_change_user_old.phpt index a077d9c4b6..314ff2e6df 100644 --- a/ext/mysqli/tests/mysqli_change_user_old.phpt +++ b/ext/mysqli/tests/mysqli_change_user_old.phpt @@ -15,98 +15,98 @@ if (mysqli_get_server_version($link) >= 50600) ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[006] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (false !== ($tmp = mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db))) - printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db))) + printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_change_user($link, $user, $passwd . '_unknown_really', $db))) - printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_change_user($link, $user, $passwd . '_unknown_really', $db))) + printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really'))) - printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really'))) + printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - // Reconnect because Percona and MariaDB block any commands after 3 failed - // change_user commands - mysqli_close($link); + // Reconnect because Percona and MariaDB block any commands after 3 failed + // change_user commands + mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - } - if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1')) - printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } + if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1')) + printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var')) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (1 != $tmp['test_var']) - printf("[012] Cannot set test variable\n"); + if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var')) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if (1 != $tmp['test_var']) + printf("[012] Cannot set test variable\n"); - if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db))) - printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db))) + printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user')) - printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); + if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user')) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); - if (substr($tmp['user'], 0, strlen($user)) !== $user) - printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']); - if ($tmp['dbname'] != $db) - printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']); + if (substr($tmp['user'], 0, strlen($user)) !== $user) + printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']); + if ($tmp['dbname'] != $db) + printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']); - if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var')) - printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (NULL !== $tmp['test_var']) - printf("[019] Test variable is still set!\n"); + if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var')) + printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if (NULL !== $tmp['test_var']) + printf("[019] Test variable is still set!\n"); - mysqli_close($link); + mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[020] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - if (false !== ($tmp = mysqli_change_user($link, str_repeat('user', 16384), str_repeat('pass', 16384), str_repeat('dbase', 16384)))) - printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_change_user($link, str_repeat('user', 16384), str_repeat('pass', 16384), str_repeat('dbase', 16384)))) + printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[022] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - /* silent protocol change if no db which requires workaround in mysqlnd/libmysql + /* silent protocol change if no db which requires workaround in mysqlnd/libmysql (empty db = no db send with COM_CHANGE_USER) */ - if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, ""))) - printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, ""))) + printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user')) - printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); + if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user')) + printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); - if ($tmp['dbname'] != "") - printf("[025] Expecting database '', got database() '%s'\n", $tmp['dbname']); + if ($tmp['dbname'] != "") + printf("[025] Expecting database '', got database() '%s'\n", $tmp['dbname']); - mysqli_close($link); + mysqli_close($link); - if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db))) - printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db))) + printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_change_user_oo.phpt b/ext/mysqli/tests/mysqli_change_user_oo.phpt index 7707cca095..5ef86a1443 100644 --- a/ext/mysqli/tests/mysqli_change_user_oo.phpt +++ b/ext/mysqli/tests/mysqli_change_user_oo.phpt @@ -16,65 +16,65 @@ if (mysqli_get_server_version($link) >= 50600) ?> --FILE-- <?php - include_once("connect.inc"); + include_once("connect.inc"); - $link = NULL; - $tmp = NULL; + $link = NULL; + $tmp = NULL; - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (false !== ($tmp = $mysqli->change_user($user . '_unknown_really', $passwd . 'non_empty', $db))) - printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = $mysqli->change_user($user . '_unknown_really', $passwd . 'non_empty', $db))) + printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = $mysqli->change_user($user, $passwd . '_unknown_really', $db))) - printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = $mysqli->change_user($user, $passwd . '_unknown_really', $db))) + printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = $mysqli->change_user($user, $passwd, $db . '_unknown_really'))) - printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = $mysqli->change_user($user, $passwd, $db . '_unknown_really'))) + printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - // Reconnect because after 3 failed change_user attempts, the server blocks you off. - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + // Reconnect because after 3 failed change_user attempts, the server blocks you off. + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!$mysqli->query('SET @mysqli_change_user_test_var=1')) - printf("[009] Failed to set test variable: [%d] %s\n", $mysqli->errno, $mysqli->error); + if (!$mysqli->query('SET @mysqli_change_user_test_var=1')) + printf("[009] Failed to set test variable: [%d] %s\n", $mysqli->errno, $mysqli->error); - if (!$res = $mysqli->query('SELECT @mysqli_change_user_test_var AS test_var')) - printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error); - $tmp = $res->fetch_assoc(); - $res->free_result(); - if (1 != $tmp['test_var']) - printf("[011] Cannot set test variable\n"); + if (!$res = $mysqli->query('SELECT @mysqli_change_user_test_var AS test_var')) + printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error); + $tmp = $res->fetch_assoc(); + $res->free_result(); + if (1 != $tmp['test_var']) + printf("[011] Cannot set test variable\n"); - if (true !== ($tmp = $mysqli->change_user($user, $passwd, $db))) - printf("[012] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = $mysqli->change_user($user, $passwd, $db))) + printf("[012] Expecting true, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = $mysqli->query('SELECT database() AS dbname, user() AS user')) - printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error); - $tmp = $res->fetch_assoc(); - $res->free_result(); + if (!$res = $mysqli->query('SELECT database() AS dbname, user() AS user')) + printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error); + $tmp = $res->fetch_assoc(); + $res->free_result(); - if (substr($tmp['user'], 0, strlen($user)) !== $user) - printf("[014] Expecting user %s, got user() %s\n", $user, $tmp['user']); - if ($tmp['dbname'] != $db) - printf("[015] Expecting database %s, got database() %s\n", $db, $tmp['dbname']); + if (substr($tmp['user'], 0, strlen($user)) !== $user) + printf("[014] Expecting user %s, got user() %s\n", $user, $tmp['user']); + if ($tmp['dbname'] != $db) + printf("[015] Expecting database %s, got database() %s\n", $db, $tmp['dbname']); - if (!$res = $mysqli->query('SELECT @mysqli_change_user_test_var AS test_var')) - printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error); - $tmp = $res->fetch_assoc(); - $res->free_result(); - if (NULL !== $tmp['test_var']) - printf("[017] Test variable is still set!\n"); + if (!$res = $mysqli->query('SELECT @mysqli_change_user_test_var AS test_var')) + printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error); + $tmp = $res->fetch_assoc(); + $res->free_result(); + if (NULL !== $tmp['test_var']) + printf("[017] Test variable is still set!\n"); - $mysqli->close(); + $mysqli->close(); - if (false !== ($tmp = @$mysqli->change_user($user, $passwd, $db))) - printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = @$mysqli->change_user($user, $passwd, $db))) + printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt b/ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt index 1f3eaceceb..4409d453ab 100644 --- a/ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt +++ b/ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt @@ -8,26 +8,26 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once('connect.inc'); + require_once('connect.inc'); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (!$stmt = mysqli_prepare($link, "SELECT 'prepared statements should be released'")) - printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + if (!$stmt = mysqli_prepare($link, "SELECT 'prepared statements should be released'")) + printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - mysqli_change_user($link, $user, $passwd, $db); + mysqli_change_user($link, $user, $passwd, $db); - $wrong = null; - if ($stmt->execute() && $stmt->bind_result($wrong) && $stmt->fetch()) { - printf("This is wrong, because after a mysqli_change_user() %s\n", $wrong); - } else { - if ($stmt->errno == 0) - printf("Error code 2013, 1243 or similar should have been set\n"); - } + $wrong = null; + if ($stmt->execute() && $stmt->bind_result($wrong) && $stmt->fetch()) { + printf("This is wrong, because after a mysqli_change_user() %s\n", $wrong); + } else { + if ($stmt->errno == 0) + printf("Error code 2013, 1243 or similar should have been set\n"); + } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_change_user_rollback.phpt b/ext/mysqli/tests/mysqli_change_user_rollback.phpt index 1731abafef..19c4e36375 100644 --- a/ext/mysqli/tests/mysqli_change_user_rollback.phpt +++ b/ext/mysqli/tests/mysqli_change_user_rollback.phpt @@ -14,53 +14,53 @@ if (!have_innodb($link)) ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - if (!mysqli_query($link, 'ALTER TABLE test ENGINE=InnoDB')) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'ALTER TABLE test ENGINE=InnoDB')) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_autocommit($link, false); + mysqli_autocommit($link, false); - if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + if (!$row = mysqli_fetch_assoc($res)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); - $num = $row['_num']; - assert($num > 0); + $num = $row['_num']; + assert($num > 0); - if (!$res = mysqli_query($link, 'DELETE FROM test')) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'DELETE FROM test')) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + if (!$row = mysqli_fetch_assoc($res)) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); - if (0 != $row['_num']) - printf("[007] Rows should have been deleted in this transaction\n"); + if (0 != $row['_num']) + printf("[007] Rows should have been deleted in this transaction\n"); - // DELETE should be rolled back - mysqli_change_user($link, $user, $passwd, $db); + // DELETE should be rolled back + mysqli_change_user($link, $user, $passwd, $db); - if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ($row['_num'] != $num) - printf("[010] Expecting %d rows in the table test, found %d rows\n", - $num, $row['_num']); + if ($row['_num'] != $num) + printf("[010] Expecting %d rows in the table test, found %d rows\n", + $num, $row['_num']); - mysqli_free_result($res); - mysqli_close($link); - print "done!"; + mysqli_free_result($res); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_change_user_set_names.phpt b/ext/mysqli/tests/mysqli_change_user_set_names.phpt index 614aa7a023..bb2558b882 100644 --- a/ext/mysqli/tests/mysqli_change_user_set_names.phpt +++ b/ext/mysqli/tests/mysqli_change_user_set_names.phpt @@ -23,135 +23,135 @@ if ($version[0] <= 4 && $version[1] < 1) ?> --FILE-- <?php - require_once('connect.inc'); - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - - if (!$res = mysqli_query($link, "SHOW CHARACTER SET LIKE 'latin%'")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $charsets = array(); - while ($row = mysqli_fetch_assoc($res)) - $charsets[$row['Charset']] = $row['Default collation']; - - mysqli_free_result($res); - if (!mysqli_query($link, 'SET NAMES DEFAULT')) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$res = mysqli_query($link, 'SELECT - @@character_set_client AS charset_client, - @@character_set_connection AS charset_connection, - @@character_set_results AS charset_results, - @@collation_connection AS collation_connection, - @@collation_database AS collation_database, - @@collation_server AS collation_server')) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$defaults = mysqli_fetch_assoc($res)) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - - $not_changed = $defaults; - foreach ($charsets as $charset => $collation) { - - if (isset($not_changed['charset_client']) && - $charset != $not_changed['charset_client'] && - mysqli_query($link, sprintf("SET @@character_set_client = '%s'", $charset))) - unset($not_changed['charset_client']); - - if (isset($not_changed['charset_connection']) && - $charset != $not_changed['charset_connection'] && - mysqli_query($link, sprintf("SET @@character_connection = '%s'", $charset))) - unset($not_changed['charset_connection']); - - if (isset($not_changed['charset_results']) && - $charset != $not_changed['charset_results'] && - mysqli_query($link, sprintf("SET @@character_set_results = '%s'", $charset))) - unset($not_changed['charset_results']); - - if (isset($not_changed['collation_connection']) && - $collation != $not_changed['collation_connection'] && - mysqli_query($link, sprintf("SET @@collation_connection = '%s'", $collation))) - unset($not_changed['collation_connection']); - - if (isset($not_changed['collation_database']) && - $collation != $not_changed['collation_database'] && - mysqli_query($link, sprintf("SET @@collation_database = '%s'", $collation))) - unset($not_changed['collation_database']); - - if (isset($not_changed['collation_server']) && - $collation != $not_changed['collation_server'] && - mysqli_query($link, sprintf("SET @@collation_server = '%s'", $collation))) - unset($not_changed['collation_server']); - - if (empty($not_changed)) - break; - } - - if (!$res = mysqli_query($link, 'SELECT - @@character_set_client AS charset_client, - @@character_set_connection AS charset_connection, - @@character_set_results AS charset_results, - @@collation_connection AS collation_connection, - @@collation_database AS collation_database, - @@collation_server AS collation_server')) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$modified = mysqli_fetch_assoc($res)) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - - if ($modified == $defaults) - printf("[008] Not all settings have been changed\n"); - - // LAST_INSERT_ID should be reset - mysqli_change_user($link, $user, $passwd, $db); - - if (!$res = mysqli_query($link, 'SELECT - @@character_set_client AS charset_client, - @@character_set_connection AS charset_connection, - @@character_set_results AS charset_results, - @@collation_connection AS collation_connection, - @@collation_database AS collation_database, - @@collation_server AS collation_server')) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$new = mysqli_fetch_assoc($res)) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - - if ($new == $modified) { - printf("[011] Charsets/collations have not been reset.\n"); - printf("Got:\n"); - var_dump($new); - printf("Expected:\n"); - var_dump($defaults); - } - - if ($new != $defaults) { - printf("[012] Charsets/collations have not been reset to their defaults.\n"); - printf("Got:\n"); - var_dump($new); - printf("Expected:\n"); - var_dump($defaults); - } - - if (!is_object($charset = mysqli_get_charset($link))) - printf("[013] Expecting object/std_class, got %s/%s\n", gettype($charset), $charset); - - if ($charset->charset != $defaults['charset_connection']) - printf("[014] Expecting connection charset to be %s got %s\n", - $defaults['charset_connection'], - $charset->charset); - - if ($charset->collation != $defaults['collation_connection']) - printf("[015] Expecting collation to be %s got %s\n", - $defaults['collation_connection'], - $charset->collation); - - mysqli_close($link); - print "done!"; + require_once('connect.inc'); + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + + if (!$res = mysqli_query($link, "SHOW CHARACTER SET LIKE 'latin%'")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $charsets = array(); + while ($row = mysqli_fetch_assoc($res)) + $charsets[$row['Charset']] = $row['Default collation']; + + mysqli_free_result($res); + if (!mysqli_query($link, 'SET NAMES DEFAULT')) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$res = mysqli_query($link, 'SELECT + @@character_set_client AS charset_client, + @@character_set_connection AS charset_connection, + @@character_set_results AS charset_results, + @@collation_connection AS collation_connection, + @@collation_database AS collation_database, + @@collation_server AS collation_server')) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$defaults = mysqli_fetch_assoc($res)) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); + + $not_changed = $defaults; + foreach ($charsets as $charset => $collation) { + + if (isset($not_changed['charset_client']) && + $charset != $not_changed['charset_client'] && + mysqli_query($link, sprintf("SET @@character_set_client = '%s'", $charset))) + unset($not_changed['charset_client']); + + if (isset($not_changed['charset_connection']) && + $charset != $not_changed['charset_connection'] && + mysqli_query($link, sprintf("SET @@character_connection = '%s'", $charset))) + unset($not_changed['charset_connection']); + + if (isset($not_changed['charset_results']) && + $charset != $not_changed['charset_results'] && + mysqli_query($link, sprintf("SET @@character_set_results = '%s'", $charset))) + unset($not_changed['charset_results']); + + if (isset($not_changed['collation_connection']) && + $collation != $not_changed['collation_connection'] && + mysqli_query($link, sprintf("SET @@collation_connection = '%s'", $collation))) + unset($not_changed['collation_connection']); + + if (isset($not_changed['collation_database']) && + $collation != $not_changed['collation_database'] && + mysqli_query($link, sprintf("SET @@collation_database = '%s'", $collation))) + unset($not_changed['collation_database']); + + if (isset($not_changed['collation_server']) && + $collation != $not_changed['collation_server'] && + mysqli_query($link, sprintf("SET @@collation_server = '%s'", $collation))) + unset($not_changed['collation_server']); + + if (empty($not_changed)) + break; + } + + if (!$res = mysqli_query($link, 'SELECT + @@character_set_client AS charset_client, + @@character_set_connection AS charset_connection, + @@character_set_results AS charset_results, + @@collation_connection AS collation_connection, + @@collation_database AS collation_database, + @@collation_server AS collation_server')) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$modified = mysqli_fetch_assoc($res)) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); + + if ($modified == $defaults) + printf("[008] Not all settings have been changed\n"); + + // LAST_INSERT_ID should be reset + mysqli_change_user($link, $user, $passwd, $db); + + if (!$res = mysqli_query($link, 'SELECT + @@character_set_client AS charset_client, + @@character_set_connection AS charset_connection, + @@character_set_results AS charset_results, + @@collation_connection AS collation_connection, + @@collation_database AS collation_database, + @@collation_server AS collation_server')) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$new = mysqli_fetch_assoc($res)) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); + + if ($new == $modified) { + printf("[011] Charsets/collations have not been reset.\n"); + printf("Got:\n"); + var_dump($new); + printf("Expected:\n"); + var_dump($defaults); + } + + if ($new != $defaults) { + printf("[012] Charsets/collations have not been reset to their defaults.\n"); + printf("Got:\n"); + var_dump($new); + printf("Expected:\n"); + var_dump($defaults); + } + + if (!is_object($charset = mysqli_get_charset($link))) + printf("[013] Expecting object/std_class, got %s/%s\n", gettype($charset), $charset); + + if ($charset->charset != $defaults['charset_connection']) + printf("[014] Expecting connection charset to be %s got %s\n", + $defaults['charset_connection'], + $charset->charset); + + if ($charset->collation != $defaults['collation_connection']) + printf("[015] Expecting collation to be %s got %s\n", + $defaults['collation_connection'], + $charset->collation); + + mysqli_close($link); + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_character_set.phpt b/ext/mysqli/tests/mysqli_character_set.phpt index 855141e40d..ee09719b64 100644 --- a/ext/mysqli/tests/mysqli_character_set.phpt +++ b/ext/mysqli/tests/mysqli_character_set.phpt @@ -12,92 +12,92 @@ if (!function_exists('mysqli_set_charset')) { ?> --FILE-- <?php - require_once("connect.inc"); - - $tmp = NULL; - $link = NULL; - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - if (!$res = mysqli_query($link, 'SELECT version() AS server_version')) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - $version = explode('.', $tmp['server_version']); - if (empty($version)) - printf("[003] Cannot determine server version, need MySQL Server 4.1+ for the test!\n"); - - if ($version[0] <= 4 && $version[1] < 1) - printf("[004] Need MySQL Server 4.1+ for the test!\n"); - - if (!$res = mysqli_query($link, "SHOW CHARACTER SET")) - printf("[005] Cannot get list of available character sets, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - - $charsets = array(); - while ($row = mysqli_fetch_assoc($res)) - $charsets[] = $row; - mysqli_free_result($res); - - foreach ($charsets as $charset) { - $k = $charset['Charset']; - /* The server currently 17.07.2007 can't handle data sent in ucs2 */ - /* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */ - /* The server currently 02.09.2011 can't handle data sent in utf16le */ - if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32' || 'utf16le' == $charset['Charset']) { - continue; - } - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) - printf("[006 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link)); - - $sql = sprintf("CREATE TABLE test(id INT, label CHAR(1)) CHARACTER SET '%s' ", $charset['Charset']); - if (!mysqli_query($link, $sql)) { - printf("[007 + %s] %s [%d] %s\n", $k, $sql, mysqli_errno($link), mysqli_error($link)); - continue; - } - - if (!mysqli_set_charset($link, $charset['Charset'])) { - printf("[008 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link)); - continue; - } - - for ($i = 1; $i <= 3; $i++) { - if (!mysqli_query($link, sprintf("INSERT INTO test (id, label) VALUES (%d, '%s')", - $i, mysqli_real_escape_string($link, chr(ord("a") + $i))))) - { - var_dump($charset['Charset']); - printf("[009 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link)); - continue; - } - } - - if (!$res = mysqli_query($link, "SELECT id, label FROM test")) - printf("[010 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link)); - - for ($i = 1; $i <= 3; $i++) { - - if (!$tmp = mysqli_fetch_assoc($res)) - printf("[011 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link)); - - if ($tmp['id'] != $i) - printf("[012 + %s] Expecting %d, got %s, [%d] %s\n", $k, - $i, $tmp['id'], - mysqli_errno($link), mysqli_error($link)); - - if ($tmp['label'] != chr(ord("a") + $i)) - printf("[013 + %s] Expecting %d, got %s, [%d] %s\n", $k, - chr(ord("a") + $i), $tmp['label'], - mysqli_errno($link), mysqli_error($link)); - - } - mysqli_free_result($res); - } - - mysqli_close($link); - - print "done!"; + require_once("connect.inc"); + + $tmp = NULL; + $link = NULL; + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + if (!$res = mysqli_query($link, 'SELECT version() AS server_version')) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + $version = explode('.', $tmp['server_version']); + if (empty($version)) + printf("[003] Cannot determine server version, need MySQL Server 4.1+ for the test!\n"); + + if ($version[0] <= 4 && $version[1] < 1) + printf("[004] Need MySQL Server 4.1+ for the test!\n"); + + if (!$res = mysqli_query($link, "SHOW CHARACTER SET")) + printf("[005] Cannot get list of available character sets, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + + $charsets = array(); + while ($row = mysqli_fetch_assoc($res)) + $charsets[] = $row; + mysqli_free_result($res); + + foreach ($charsets as $charset) { + $k = $charset['Charset']; + /* The server currently 17.07.2007 can't handle data sent in ucs2 */ + /* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */ + /* The server currently 02.09.2011 can't handle data sent in utf16le */ + if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32' || 'utf16le' == $charset['Charset']) { + continue; + } + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) + printf("[006 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link)); + + $sql = sprintf("CREATE TABLE test(id INT, label CHAR(1)) CHARACTER SET '%s' ", $charset['Charset']); + if (!mysqli_query($link, $sql)) { + printf("[007 + %s] %s [%d] %s\n", $k, $sql, mysqli_errno($link), mysqli_error($link)); + continue; + } + + if (!mysqli_set_charset($link, $charset['Charset'])) { + printf("[008 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link)); + continue; + } + + for ($i = 1; $i <= 3; $i++) { + if (!mysqli_query($link, sprintf("INSERT INTO test (id, label) VALUES (%d, '%s')", + $i, mysqli_real_escape_string($link, chr(ord("a") + $i))))) + { + var_dump($charset['Charset']); + printf("[009 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link)); + continue; + } + } + + if (!$res = mysqli_query($link, "SELECT id, label FROM test")) + printf("[010 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link)); + + for ($i = 1; $i <= 3; $i++) { + + if (!$tmp = mysqli_fetch_assoc($res)) + printf("[011 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link)); + + if ($tmp['id'] != $i) + printf("[012 + %s] Expecting %d, got %s, [%d] %s\n", $k, + $i, $tmp['id'], + mysqli_errno($link), mysqli_error($link)); + + if ($tmp['label'] != chr(ord("a") + $i)) + printf("[013 + %s] Expecting %d, got %s, [%d] %s\n", $k, + chr(ord("a") + $i), $tmp['label'], + mysqli_errno($link), mysqli_error($link)); + + } + mysqli_free_result($res); + } + + mysqli_close($link); + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_character_set_name.phpt b/ext/mysqli/tests/mysqli_character_set_name.phpt index b50c8414b3..b2e9a4e4f5 100644 --- a/ext/mysqli/tests/mysqli_character_set_name.phpt +++ b/ext/mysqli/tests/mysqli_character_set_name.phpt @@ -8,55 +8,55 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - /* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */ - require_once("connect.inc"); - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - if (!$res = mysqli_query($link, 'SELECT version() AS server_version')) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - $version = explode('.', $tmp['server_version']); - if (empty($version)) - printf("[006] Cannot determine server version, need MySQL Server 4.1+ for the test!\n"); - - if ($version[0] <= 4 && $version[1] < 1) - printf("[007] Need MySQL Server 4.1+ for the test!\n"); - - if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation')) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (!$tmp['charset']) - printf("[009] Cannot determine current character set and collation\n"); - - $charset = mysqli_character_set_name($link); - if ($tmp['charset'] !== $charset) { - if ($tmp['collation'] === $charset) { - printf("[010] Could be known server bug http://bugs.mysql.com/bug.php?id=7923, collation %s instead of character set returned, expected string/%s, got %s/%s\n", - $tmp['collation'], $tmp['charset'], gettype($charset), $charset); - } else { - printf("[011] Expecting character set %s/%s, got %s/%s\n", gettype($tmp['charset']), $tmp['charset'], gettype($charset), $charset); - } - } - - $charset2 = mysqli_character_set_name($link); - if ($charset2 !== $charset) { - printf("[012] Alias mysqli_character_set_name returned %s/%s, expected %s/%s\n", gettype($charset2), $charset2, gettype($charset), $charset); - } - - mysqli_close($link); - - try { + /* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */ + require_once("connect.inc"); + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + if (!$res = mysqli_query($link, 'SELECT version() AS server_version')) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + $version = explode('.', $tmp['server_version']); + if (empty($version)) + printf("[006] Cannot determine server version, need MySQL Server 4.1+ for the test!\n"); + + if ($version[0] <= 4 && $version[1] < 1) + printf("[007] Need MySQL Server 4.1+ for the test!\n"); + + if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation')) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if (!$tmp['charset']) + printf("[009] Cannot determine current character set and collation\n"); + + $charset = mysqli_character_set_name($link); + if ($tmp['charset'] !== $charset) { + if ($tmp['collation'] === $charset) { + printf("[010] Could be known server bug http://bugs.mysql.com/bug.php?id=7923, collation %s instead of character set returned, expected string/%s, got %s/%s\n", + $tmp['collation'], $tmp['charset'], gettype($charset), $charset); + } else { + printf("[011] Expecting character set %s/%s, got %s/%s\n", gettype($tmp['charset']), $tmp['charset'], gettype($charset), $charset); + } + } + + $charset2 = mysqli_character_set_name($link); + if ($charset2 !== $charset) { + printf("[012] Alias mysqli_character_set_name returned %s/%s, expected %s/%s\n", gettype($charset2), $charset2, gettype($charset), $charset); + } + + mysqli_close($link); + + try { mysqli_character_set_name($link); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; --EXPECT-- mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt b/ext/mysqli/tests/mysqli_character_set_name_oo.phpt index b29fb7fc2d..cedc138e68 100644 --- a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt +++ b/ext/mysqli/tests/mysqli_character_set_name_oo.phpt @@ -8,53 +8,53 @@ mysqli_chararcter_set_name(), mysql_client_encoding() [alias] ?> --FILE-- <?php - /* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */ - require_once("connect.inc"); + /* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */ + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!$res = $mysqli->query('SELECT version() AS server_version')) - printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error); - $tmp = $res->fetch_assoc(); - $res->free_result(); - $version = explode('.', $tmp['server_version']); - if (empty($version)) - printf("[006] Cannot determine server version, need MySQL Server 4.1+ for the test!\n"); + if (!$res = $mysqli->query('SELECT version() AS server_version')) + printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error); + $tmp = $res->fetch_assoc(); + $res->free_result(); + $version = explode('.', $tmp['server_version']); + if (empty($version)) + printf("[006] Cannot determine server version, need MySQL Server 4.1+ for the test!\n"); - if ($version[0] <= 4 && $version[1] < 1) - printf("[007] Need MySQL Server 4.1+ for the test!\n"); + if ($version[0] <= 4 && $version[1] < 1) + printf("[007] Need MySQL Server 4.1+ for the test!\n"); - if (!$res = $mysqli->query('SELECT @@character_set_connection AS charset, @@collation_connection AS collation')) - printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error); - $tmp = $res->fetch_assoc(); - $res->free_result(); - if (!$tmp['charset']) - printf("[009] Cannot determine current character set and collation\n"); + if (!$res = $mysqli->query('SELECT @@character_set_connection AS charset, @@collation_connection AS collation')) + printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error); + $tmp = $res->fetch_assoc(); + $res->free_result(); + if (!$tmp['charset']) + printf("[009] Cannot determine current character set and collation\n"); - $charset = $mysqli->character_set_name(); - if ($tmp['charset'] !== $charset) { - if ($tmp['collation'] === $charset) { - printf("[010] Could be known server bug http://bugs.mysql.com/bug.php?id=7923, collation %s instead of character set returned, expected string/%s, got %s/%s\n", - $tmp['collation'], $tmp['charset'], gettype($charset), $charset); - } else { - printf("[011] Expecting character set %s/%s, got %s/%s\n", gettype($tmp['charset']), $tmp['charset'], gettype($charset), $charset); - } - } + $charset = $mysqli->character_set_name(); + if ($tmp['charset'] !== $charset) { + if ($tmp['collation'] === $charset) { + printf("[010] Could be known server bug http://bugs.mysql.com/bug.php?id=7923, collation %s instead of character set returned, expected string/%s, got %s/%s\n", + $tmp['collation'], $tmp['charset'], gettype($charset), $charset); + } else { + printf("[011] Expecting character set %s/%s, got %s/%s\n", gettype($tmp['charset']), $tmp['charset'], gettype($charset), $charset); + } + } - $charset2 = $mysqli->character_set_name(); - if ($charset2 !== $charset) { - printf("[012] Alias mysqli_character_set_name returned %s/%s, expected %s/%s\n", - gettype($charset2), $charset2, gettype($charset), $charset); - } + $charset2 = $mysqli->character_set_name(); + if ($charset2 !== $charset) { + printf("[012] Alias mysqli_character_set_name returned %s/%s, expected %s/%s\n", + gettype($charset2), $charset2, gettype($charset), $charset); + } - $mysqli->close(); + $mysqli->close(); - try { + try { $mysqli->character_set_name(); } catch (Error $exception) { echo $exception->getMessage() . "\n"; @@ -66,7 +66,7 @@ mysqli_chararcter_set_name(), mysql_client_encoding() [alias] echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; --EXPECT-- my_mysqli object is already closed my_mysqli object is already closed diff --git a/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt index 78784210bb..27cf9f0fc6 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt @@ -8,80 +8,80 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('connect.inc'); - require('table.inc'); - - $driver = new mysqli_driver(); - - printf("Parent class:\n"); - var_dump(get_parent_class($driver)); - - printf("\nMethods:\n"); - $methods = get_class_methods($driver); - $expected_methods = array(); - - foreach ($methods as $k => $method) { - if (isset($expected_methods[$method])) { - unset($expected_methods[$method]); - unset($methods[$k]); - } - } - if (!empty($expected_methods)) { - printf("Dumping list of missing methods.\n"); - var_dump($expected_methods); - } - if (!empty($methods)) { - printf("Dumping list of unexpected methods.\n"); - var_dump($methods); - } - if (empty($expected_methods) && empty($methods)) - printf("ok\n"); - - printf("\nClass variables:\n"); - $variables = array_keys(get_class_vars(get_class($driver))); - sort($variables); - foreach ($variables as $k => $var) - printf("%s\n", $var); - - printf("\nObject variables:\n"); - $variables = array_keys(get_object_vars($driver)); - foreach ($variables as $k => $var) - printf("%s\n", $var); - - printf("\nMagic, magic properties:\n"); - - assert(mysqli_get_client_info() === $driver->client_info); - printf("driver->client_info = '%s'\n", $driver->client_info); - - assert(mysqli_get_client_version() === $driver->client_version); - printf("driver->client_version = '%s'\n", $driver->client_version); - - assert($driver->driver_version > 0); - printf("driver->driver_version = '%s'\n", $driver->driver_version); - - assert(in_array($driver->report_mode, - array( - MYSQLI_REPORT_ALL, - MYSQLI_REPORT_STRICT, - MYSQLI_REPORT_ERROR, - MYSQLI_REPORT_INDEX, - MYSQLI_REPORT_OFF - ) - )); - - printf("driver->report_mode = '%s'\n", $driver->report_mode); - $driver->report_mode = MYSQLI_REPORT_STRICT; - assert($driver->report_mode === MYSQLI_REPORT_STRICT); - - assert(is_bool($driver->embedded)); - printf("driver->embedded = '%s'\n", $driver->embedded); - - printf("driver->reconnect = '%s'\n", $driver->reconnect); - - printf("\nAccess to undefined properties:\n"); - printf("driver->unknown = '%s'\n", @$driver->unknown); - - print "done!"; + require('connect.inc'); + require('table.inc'); + + $driver = new mysqli_driver(); + + printf("Parent class:\n"); + var_dump(get_parent_class($driver)); + + printf("\nMethods:\n"); + $methods = get_class_methods($driver); + $expected_methods = array(); + + foreach ($methods as $k => $method) { + if (isset($expected_methods[$method])) { + unset($expected_methods[$method]); + unset($methods[$k]); + } + } + if (!empty($expected_methods)) { + printf("Dumping list of missing methods.\n"); + var_dump($expected_methods); + } + if (!empty($methods)) { + printf("Dumping list of unexpected methods.\n"); + var_dump($methods); + } + if (empty($expected_methods) && empty($methods)) + printf("ok\n"); + + printf("\nClass variables:\n"); + $variables = array_keys(get_class_vars(get_class($driver))); + sort($variables); + foreach ($variables as $k => $var) + printf("%s\n", $var); + + printf("\nObject variables:\n"); + $variables = array_keys(get_object_vars($driver)); + foreach ($variables as $k => $var) + printf("%s\n", $var); + + printf("\nMagic, magic properties:\n"); + + assert(mysqli_get_client_info() === $driver->client_info); + printf("driver->client_info = '%s'\n", $driver->client_info); + + assert(mysqli_get_client_version() === $driver->client_version); + printf("driver->client_version = '%s'\n", $driver->client_version); + + assert($driver->driver_version > 0); + printf("driver->driver_version = '%s'\n", $driver->driver_version); + + assert(in_array($driver->report_mode, + array( + MYSQLI_REPORT_ALL, + MYSQLI_REPORT_STRICT, + MYSQLI_REPORT_ERROR, + MYSQLI_REPORT_INDEX, + MYSQLI_REPORT_OFF + ) + )); + + printf("driver->report_mode = '%s'\n", $driver->report_mode); + $driver->report_mode = MYSQLI_REPORT_STRICT; + assert($driver->report_mode === MYSQLI_REPORT_STRICT); + + assert(is_bool($driver->embedded)); + printf("driver->embedded = '%s'\n", $driver->embedded); + + printf("driver->reconnect = '%s'\n", $driver->reconnect); + + printf("\nAccess to undefined properties:\n"); + printf("driver->unknown = '%s'\n", @$driver->unknown); + + print "done!"; ?> --EXPECTF-- Parent class: diff --git a/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt index 7b6c0a65d9..5d125dda84 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt @@ -16,10 +16,10 @@ if (!$IS_MYSQLND) ?> --FILE-- <?php - require_once('reflection_tools.inc'); - $class = new ReflectionClass('mysqli_driver'); - inspectClass($class); - print "done!"; + require_once('reflection_tools.inc'); + $class = new ReflectionClass('mysqli_driver'); + inspectClass($class); + print "done!"; ?> --EXPECTF-- Inspecting class 'mysqli_driver' diff --git a/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt index dfefb9098c..794f8eb241 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt @@ -8,257 +8,257 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('connect.inc'); - - $mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket); - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - - printf("Parent class:\n"); - var_dump(get_parent_class($mysqli)); - - printf("\nMethods:\n"); - $methods = get_class_methods($mysqli); - $expected_methods = array( - '__construct' => true, - 'autocommit' => true, - 'begin_transaction' => true, - 'change_user' => true, - 'character_set_name' => true, - 'close' => true, - 'commit' => true, - 'connect' => true, - 'dump_debug_info' => true, - 'escape_string' => true, - 'get_charset' => true, - 'get_client_info' => true, - 'get_server_info' => true, - 'get_warnings' => true, - 'init' => true, - 'kill' => true, - 'more_results' => true, - 'multi_query' => true, - 'next_result' => true, - 'options' => true, - 'ping' => true, - 'prepare' => true, - 'query' => true, - 'real_connect' => true, - 'real_escape_string' => true, - 'real_query' => true, - 'refresh' => true, - 'rollback' => true, - 'release_savepoint' => true, - 'savepoint' => true, - 'select_db' => true, - 'set_charset' => true, - 'set_opt' => true, - 'ssl_set' => true, - 'stat' => true, - 'stmt_init' => true, - 'store_result' => true, - 'thread_safe' => true, - 'use_result' => true, - ); - - if ($IS_MYSQLND) { - // mysqlnd only - /* $expected_methods['get_client_stats'] = true; */ - $expected_methods['get_connection_stats'] = true; - $expected_methods['reap_async_query'] = true; - $expected_methods['poll'] = true; - } - - /* we should add ruled when to expect them */ - if (function_exists('mysqli_debug')) - $expected_methods['debug'] = true; - if (function_exists('ssl_set')) - $expected_methods['ssl_set'] = true; - - foreach ($methods as $k => $method) { - if (isset($expected_methods[$method])) { - unset($methods[$k]); - unset($expected_methods[$method]); - } - } - if (!empty($methods)) { - printf("Dumping list of unexpected methods.\n"); - var_dump($methods); - } - if (!empty($expected_methods)) { - printf("Dumping list of missing methods.\n"); - var_dump($expected_methods); - } - if (empty($methods) && empty($expected_methods)) - printf("ok\n"); - - printf("\nClass variables:\n"); - - $expected_class_variables = $expected_object_variables = array( - "affected_rows" => true, - "client_info" => true, - "client_version" => true, - "connect_errno" => true, - "connect_error" => true, - "errno" => true, - "error" => true, - "field_count" => true, - "host_info" => true, - "info" => true, - "insert_id" => true, - "protocol_version" => true, - "server_info" => true, - "server_version" => true, - "sqlstate" => true, - "thread_id" => true, - "warning_count" => true, - ); - - $expected_class_variables["error_list"] = true; - $expected_object_variables["error_list"] = true; - - $variables = get_class_vars(get_class($mysqli)); - foreach ($variables as $var => $v) { - if (isset($expected_class_variables[$var])) { - unset($expected_class_variables[$var]); - unset($variables[$var]); - } - } - - if (!empty($expected_class_variables)) { - printf("Dumping list of missing class variables\n"); - var_dump($expected_class_variables); - } - if (!empty($variables)) { - printf("Dumping list of unexpected class variables\n"); - var_dump($variables); - } - echo "ok\n"; - - printf("\nObject variables:\n"); - $variables = get_object_vars($mysqli); - foreach ($variables as $var => $v) { - if (isset($expected_object_variables[$var])) { - unset($expected_object_variables[$var]); - unset($variables[$var]); - } - } - - if (!empty($expected_object_variables)) { - printf("Dumping list of missing object variables\n"); - var_dump($expected_object_variables); - } - if (!empty($variables)) { - printf("Dumping list of unexpected object variables\n"); - var_dump($variables); - } - echo "ok\n"; - - - printf("\nMagic, magic properties:\n"); - - assert(mysqli_affected_rows($link) === $mysqli->affected_rows); - printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n", - $mysqli->affected_rows, gettype($mysqli->affected_rows), - mysqli_affected_rows($link), gettype(mysqli_affected_rows($link))); - - assert(mysqli_get_client_info() === $mysqli->client_info); - printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n", - $mysqli->client_info, gettype($mysqli->client_info), - mysqli_get_client_info(), gettype(mysqli_get_client_info())); - - assert(mysqli_get_client_version() === $mysqli->client_version); - printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n", - $mysqli->client_version, gettype($mysqli->client_version), - mysqli_get_client_version(), gettype(mysqli_get_client_version())); - - assert(mysqli_errno($link) === $mysqli->errno); - printf("mysqli->errno = '%s'/%s ('%s'/%s)\n", - $mysqli->errno, gettype($mysqli->errno), - mysqli_errno($link), gettype(mysqli_errno($link))); - - assert(mysqli_error($link) === $mysqli->error); - printf("mysqli->error = '%s'/%s ('%s'/%s)\n", - $mysqli->error, gettype($mysqli->error), - mysqli_error($link), gettype(mysqli_error($link))); - - assert(mysqli_error_list($link) === $mysqli->error_list); - assert(is_array($mysqli->error_list)); - - assert(mysqli_field_count($link) === $mysqli->field_count); - printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n", - $mysqli->field_count, gettype($mysqli->field_count), - mysqli_field_count($link), gettype(mysqli_field_count($link))); - - assert(mysqli_insert_id($link) === $mysqli->insert_id); - printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n", - $mysqli->insert_id, gettype($mysqli->insert_id), - mysqli_insert_id($link), gettype(mysqli_insert_id($link))); - - assert(mysqli_sqlstate($link) === $mysqli->sqlstate); - printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n", - $mysqli->sqlstate, gettype($mysqli->sqlstate), - mysqli_sqlstate($link), gettype(mysqli_sqlstate($link))); - - assert(mysqli_get_host_info($link) === $mysqli->host_info); - printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n", - $mysqli->host_info, gettype($mysqli->host_info), - mysqli_get_host_info($link), gettype(mysqli_get_host_info($link))); - - /* note that the data types are different */ - assert(mysqli_info($link) == $mysqli->info); - printf("mysqli->info = '%s'/%s ('%s'/%s)\n", - $mysqli->info, gettype($mysqli->info), - mysqli_info($link), gettype(mysqli_info($link))); - - assert(mysqli_thread_id($link) > $mysqli->thread_id); - assert(gettype($mysqli->thread_id) == gettype(mysqli_thread_id($link))); - printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n", - $mysqli->thread_id, gettype($mysqli->thread_id), - mysqli_thread_id($link), gettype(mysqli_thread_id($link))); - - assert(mysqli_get_proto_info($link) === $mysqli->protocol_version); - printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n", - $mysqli->protocol_version, gettype($mysqli->protocol_version), - mysqli_get_proto_info($link), gettype(mysqli_get_proto_info($link))); - - assert(mysqli_get_server_info($link) === $mysqli->server_info); - printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n", - $mysqli->server_info, gettype($mysqli->server_info), - mysqli_get_server_info($link), gettype(mysqli_get_server_info($link))); - - assert(mysqli_get_server_version($link) === $mysqli->server_version); - printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n", - $mysqli->server_version, gettype($mysqli->server_version), - mysqli_get_server_version($link), gettype(mysqli_get_server_version($link))); - - assert(mysqli_warning_count($link) === $mysqli->warning_count); - printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n", - $mysqli->warning_count, gettype($mysqli->warning_count), - mysqli_warning_count($link), gettype(mysqli_warning_count($link))); - - printf("\nAccess to undefined properties:\n"); - printf("mysqli->unknown = '%s'\n", @$mysqli->unknown); - - @$mysqli->unknown = 13; - printf("setting mysqli->unknown, mysqli_unknown = '%s'\n", @$mysqli->unknown); - - $unknown = 'friday'; - @$mysqli->unknown = $unknown; - printf("setting mysqli->unknown, mysqli_unknown = '%s'\n", @$mysqli->unknown); - - $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n"); - assert(mysqli_connect_error() === $mysqli->connect_error); - printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n", - $mysqli->connect_error, gettype($mysqli->connect_error), - mysqli_connect_error(), gettype(mysqli_connect_error())); - - assert(mysqli_connect_errno() === $mysqli->connect_errno); - printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n", - $mysqli->connect_errno, gettype($mysqli->connect_errno), - mysqli_connect_errno(), gettype(mysqli_connect_errno())); - - print "done!"; + require('connect.inc'); + + $mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket); + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + + printf("Parent class:\n"); + var_dump(get_parent_class($mysqli)); + + printf("\nMethods:\n"); + $methods = get_class_methods($mysqli); + $expected_methods = array( + '__construct' => true, + 'autocommit' => true, + 'begin_transaction' => true, + 'change_user' => true, + 'character_set_name' => true, + 'close' => true, + 'commit' => true, + 'connect' => true, + 'dump_debug_info' => true, + 'escape_string' => true, + 'get_charset' => true, + 'get_client_info' => true, + 'get_server_info' => true, + 'get_warnings' => true, + 'init' => true, + 'kill' => true, + 'more_results' => true, + 'multi_query' => true, + 'next_result' => true, + 'options' => true, + 'ping' => true, + 'prepare' => true, + 'query' => true, + 'real_connect' => true, + 'real_escape_string' => true, + 'real_query' => true, + 'refresh' => true, + 'rollback' => true, + 'release_savepoint' => true, + 'savepoint' => true, + 'select_db' => true, + 'set_charset' => true, + 'set_opt' => true, + 'ssl_set' => true, + 'stat' => true, + 'stmt_init' => true, + 'store_result' => true, + 'thread_safe' => true, + 'use_result' => true, + ); + + if ($IS_MYSQLND) { + // mysqlnd only + /* $expected_methods['get_client_stats'] = true; */ + $expected_methods['get_connection_stats'] = true; + $expected_methods['reap_async_query'] = true; + $expected_methods['poll'] = true; + } + + /* we should add ruled when to expect them */ + if (function_exists('mysqli_debug')) + $expected_methods['debug'] = true; + if (function_exists('ssl_set')) + $expected_methods['ssl_set'] = true; + + foreach ($methods as $k => $method) { + if (isset($expected_methods[$method])) { + unset($methods[$k]); + unset($expected_methods[$method]); + } + } + if (!empty($methods)) { + printf("Dumping list of unexpected methods.\n"); + var_dump($methods); + } + if (!empty($expected_methods)) { + printf("Dumping list of missing methods.\n"); + var_dump($expected_methods); + } + if (empty($methods) && empty($expected_methods)) + printf("ok\n"); + + printf("\nClass variables:\n"); + + $expected_class_variables = $expected_object_variables = array( + "affected_rows" => true, + "client_info" => true, + "client_version" => true, + "connect_errno" => true, + "connect_error" => true, + "errno" => true, + "error" => true, + "field_count" => true, + "host_info" => true, + "info" => true, + "insert_id" => true, + "protocol_version" => true, + "server_info" => true, + "server_version" => true, + "sqlstate" => true, + "thread_id" => true, + "warning_count" => true, + ); + + $expected_class_variables["error_list"] = true; + $expected_object_variables["error_list"] = true; + + $variables = get_class_vars(get_class($mysqli)); + foreach ($variables as $var => $v) { + if (isset($expected_class_variables[$var])) { + unset($expected_class_variables[$var]); + unset($variables[$var]); + } + } + + if (!empty($expected_class_variables)) { + printf("Dumping list of missing class variables\n"); + var_dump($expected_class_variables); + } + if (!empty($variables)) { + printf("Dumping list of unexpected class variables\n"); + var_dump($variables); + } + echo "ok\n"; + + printf("\nObject variables:\n"); + $variables = get_object_vars($mysqli); + foreach ($variables as $var => $v) { + if (isset($expected_object_variables[$var])) { + unset($expected_object_variables[$var]); + unset($variables[$var]); + } + } + + if (!empty($expected_object_variables)) { + printf("Dumping list of missing object variables\n"); + var_dump($expected_object_variables); + } + if (!empty($variables)) { + printf("Dumping list of unexpected object variables\n"); + var_dump($variables); + } + echo "ok\n"; + + + printf("\nMagic, magic properties:\n"); + + assert(mysqli_affected_rows($link) === $mysqli->affected_rows); + printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n", + $mysqli->affected_rows, gettype($mysqli->affected_rows), + mysqli_affected_rows($link), gettype(mysqli_affected_rows($link))); + + assert(mysqli_get_client_info() === $mysqli->client_info); + printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n", + $mysqli->client_info, gettype($mysqli->client_info), + mysqli_get_client_info(), gettype(mysqli_get_client_info())); + + assert(mysqli_get_client_version() === $mysqli->client_version); + printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n", + $mysqli->client_version, gettype($mysqli->client_version), + mysqli_get_client_version(), gettype(mysqli_get_client_version())); + + assert(mysqli_errno($link) === $mysqli->errno); + printf("mysqli->errno = '%s'/%s ('%s'/%s)\n", + $mysqli->errno, gettype($mysqli->errno), + mysqli_errno($link), gettype(mysqli_errno($link))); + + assert(mysqli_error($link) === $mysqli->error); + printf("mysqli->error = '%s'/%s ('%s'/%s)\n", + $mysqli->error, gettype($mysqli->error), + mysqli_error($link), gettype(mysqli_error($link))); + + assert(mysqli_error_list($link) === $mysqli->error_list); + assert(is_array($mysqli->error_list)); + + assert(mysqli_field_count($link) === $mysqli->field_count); + printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n", + $mysqli->field_count, gettype($mysqli->field_count), + mysqli_field_count($link), gettype(mysqli_field_count($link))); + + assert(mysqli_insert_id($link) === $mysqli->insert_id); + printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n", + $mysqli->insert_id, gettype($mysqli->insert_id), + mysqli_insert_id($link), gettype(mysqli_insert_id($link))); + + assert(mysqli_sqlstate($link) === $mysqli->sqlstate); + printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n", + $mysqli->sqlstate, gettype($mysqli->sqlstate), + mysqli_sqlstate($link), gettype(mysqli_sqlstate($link))); + + assert(mysqli_get_host_info($link) === $mysqli->host_info); + printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n", + $mysqli->host_info, gettype($mysqli->host_info), + mysqli_get_host_info($link), gettype(mysqli_get_host_info($link))); + + /* note that the data types are different */ + assert(mysqli_info($link) == $mysqli->info); + printf("mysqli->info = '%s'/%s ('%s'/%s)\n", + $mysqli->info, gettype($mysqli->info), + mysqli_info($link), gettype(mysqli_info($link))); + + assert(mysqli_thread_id($link) > $mysqli->thread_id); + assert(gettype($mysqli->thread_id) == gettype(mysqli_thread_id($link))); + printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n", + $mysqli->thread_id, gettype($mysqli->thread_id), + mysqli_thread_id($link), gettype(mysqli_thread_id($link))); + + assert(mysqli_get_proto_info($link) === $mysqli->protocol_version); + printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n", + $mysqli->protocol_version, gettype($mysqli->protocol_version), + mysqli_get_proto_info($link), gettype(mysqli_get_proto_info($link))); + + assert(mysqli_get_server_info($link) === $mysqli->server_info); + printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n", + $mysqli->server_info, gettype($mysqli->server_info), + mysqli_get_server_info($link), gettype(mysqli_get_server_info($link))); + + assert(mysqli_get_server_version($link) === $mysqli->server_version); + printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n", + $mysqli->server_version, gettype($mysqli->server_version), + mysqli_get_server_version($link), gettype(mysqli_get_server_version($link))); + + assert(mysqli_warning_count($link) === $mysqli->warning_count); + printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n", + $mysqli->warning_count, gettype($mysqli->warning_count), + mysqli_warning_count($link), gettype(mysqli_warning_count($link))); + + printf("\nAccess to undefined properties:\n"); + printf("mysqli->unknown = '%s'\n", @$mysqli->unknown); + + @$mysqli->unknown = 13; + printf("setting mysqli->unknown, mysqli_unknown = '%s'\n", @$mysqli->unknown); + + $unknown = 'friday'; + @$mysqli->unknown = $unknown; + printf("setting mysqli->unknown, mysqli_unknown = '%s'\n", @$mysqli->unknown); + + $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n"); + assert(mysqli_connect_error() === $mysqli->connect_error); + printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n", + $mysqli->connect_error, gettype($mysqli->connect_error), + mysqli_connect_error(), gettype(mysqli_connect_error())); + + assert(mysqli_connect_errno() === $mysqli->connect_errno); + printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n", + $mysqli->connect_errno, gettype($mysqli->connect_errno), + mysqli_connect_errno(), gettype(mysqli_connect_errno())); + + print "done!"; ?> --EXPECTF-- Parent class: diff --git a/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt b/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt index 2d07ef155c..fa7c7cd53d 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt @@ -8,233 +8,233 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('table.inc'); + require('table.inc'); - function dump_properties($mysqli) { + function dump_properties($mysqli) { - printf("\nClass variables:\n"); - $variables = array_keys(get_class_vars(get_class($mysqli))); - sort($variables); - foreach ($variables as $k => $var) { - try { + printf("\nClass variables:\n"); + $variables = array_keys(get_class_vars(get_class($mysqli))); + sort($variables); + foreach ($variables as $k => $var) { + try { printf("%s = '%s'\n", $var, var_export($mysqli->$var, true)); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - } + } - printf("\nObject variables:\n"); - $variables = array_keys(get_object_vars($mysqli)); + printf("\nObject variables:\n"); + $variables = array_keys(get_object_vars($mysqli)); foreach ($variables as $k => $var) { - try { + try { printf("%s = '%s'\n", $var, var_export($mysqli->$var, true)); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - } + } - printf("\nMagic, magic properties:\n"); - try { + printf("\nMagic, magic properties:\n"); + try { mysqli_affected_rows($mysqli); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->affected_rows; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->client_info; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - printf("mysqli->client_version = '%s'/%s\n", $mysqli->client_version, gettype($mysqli->client_version)); + printf("mysqli->client_version = '%s'/%s\n", $mysqli->client_version, gettype($mysqli->client_version)); - try { + try { mysqli_errno($mysqli); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->errno; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { mysqli_error($mysqli); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->error; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { mysqli_field_count($mysqli); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->field_count; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { mysqli_insert_id($mysqli); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->insert_id; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { mysqli_sqlstate($mysqli); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->sqlstate; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { mysqli_get_host_info($mysqli); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->host_info; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { mysqli_info($mysqli); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->info; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { mysqli_thread_id($mysqli); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->thread_id; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { mysqli_get_proto_info($mysqli); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->protocol_version; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { mysqli_get_server_info($mysqli); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->server_info; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { mysqli_get_server_version($mysqli); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->server_version; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { mysqli_warning_count($mysqli); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - try { + try { $mysqli->warning_count; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } - - - printf("\nAccess to undefined properties:\n"); - printf("mysqli->unknown = '%s'\n", @$mysqli->unknown); - - @$mysqli->unknown = 13; - printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown); - - $unknown = 'friday'; - @$mysqli->unknown = $unknown; - printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown); - - printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n"); - assert(@mysqli_connect_error() === @$mysqli->connect_error); - printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n", - @$mysqli->connect_error, gettype(@$mysqli->connect_error), - @mysqli_connect_error(), gettype(@mysqli_connect_error())); - - assert(@mysqli_connect_errno() === @$mysqli->connect_errno); - printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n", - @$mysqli->connect_errno, gettype(@$mysqli->connect_errno), - @mysqli_connect_errno(), gettype(@mysqli_connect_errno())); - } - - printf("Without RS\n"); - $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket); - dump_properties($mysqli); - - printf("\nWith RS\n"); - $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket); - try { - $mysqli->query("SELECT * FROM test"); - } catch (Error $exception) { + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + + printf("\nAccess to undefined properties:\n"); + printf("mysqli->unknown = '%s'\n", @$mysqli->unknown); + + @$mysqli->unknown = 13; + printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown); + + $unknown = 'friday'; + @$mysqli->unknown = $unknown; + printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown); + + printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n"); + assert(@mysqli_connect_error() === @$mysqli->connect_error); + printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n", + @$mysqli->connect_error, gettype(@$mysqli->connect_error), + @mysqli_connect_error(), gettype(@mysqli_connect_error())); + + assert(@mysqli_connect_errno() === @$mysqli->connect_errno); + printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n", + @$mysqli->connect_errno, gettype(@$mysqli->connect_errno), + @mysqli_connect_errno(), gettype(@mysqli_connect_errno())); + } + + printf("Without RS\n"); + $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket); + dump_properties($mysqli); + + printf("\nWith RS\n"); + $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket); + try { + $mysqli->query("SELECT * FROM test"); + } catch (Error $exception) { echo $exception->getMessage() . "\n"; - } - dump_properties($mysqli); + } + dump_properties($mysqli); - print "done!"; + print "done!"; ?> --CLEAN-- <?php require_once("clean_table.inc"); ?> diff --git a/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt index c341acf2b3..9b181d3838 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt @@ -17,10 +17,10 @@ if (!$IS_MYSQLND) ?> --FILE-- <?php - require_once('reflection_tools.inc'); - $class = new ReflectionClass('mysqli'); - inspectClass($class); - print "done!\n"; + require_once('reflection_tools.inc'); + $class = new ReflectionClass('mysqli'); + inspectClass($class); + print "done!\n"; ?> --EXPECT-- Inspecting class 'mysqli' diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt index d16e35fb22..3dc73a0819 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt @@ -8,145 +8,145 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('connect.inc'); - require('table.inc'); - - $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $mysqli_result = $mysqli->query('SELECT * FROM test'); - $row = $mysqli_result->fetch_row(); - - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $res = mysqli_query($link, 'SELECT * FROM test'); - assert(mysqli_fetch_row($res) === $row); - - printf("Parent class:\n"); - var_dump(get_parent_class($mysqli_result)); - - printf("\nMethods:\n"); - $methods = get_class_methods($mysqli_result); - $expected_methods = array( - '__construct' => true, - 'close' => true, - 'data_seek' => true, - 'fetch_array' => true, - 'fetch_assoc' => true, - 'fetch_field' => true, - 'fetch_field_direct' => true, - 'fetch_fields' => true, - 'fetch_object' => true, - 'fetch_row' => true, - 'field_seek' => true, - 'free' => true, - 'free_result' => true, - ); - if ($IS_MYSQLND) - $expected_methods['fetch_all'] = true; - - foreach ($methods as $k => $method) { - if (isset($expected_methods[$method])) { - unset($expected_methods[$method]); - unset($methods[$k]); - } - if ($method == 'mysqli_result') { - // get_class_method reports different constructor names - unset($expected_methods['__construct']); - unset($methods[$k]); - } - } - - if (!empty($expected_methods)) { - printf("Dumping list of missing methods.\n"); - var_dump($expected_methods); - } - if (!empty($methods)) { - printf("Dumping list of unexpected methods.\n"); - var_dump($methods); - } - if (empty($expected_methods) && empty($methods)) - printf("ok\n"); - - - printf("\nClass variables:\n"); - $variables = array_keys(get_class_vars(get_class($mysqli_result))); - sort($variables); - foreach ($variables as $k => $var) - printf("%s\n", $var); - - printf("\nObject variables:\n"); - $variables = array_keys(get_object_vars($mysqli_result)); - foreach ($variables as $k => $var) - printf("%s\n", $var); - - printf("\nMagic, magic properties:\n"); - - assert(($tmp = mysqli_field_tell($res)) === $mysqli_result->current_field); - printf("mysqli_result->current_field = '%s'/%s ('%s'/%s)\n", - $mysqli_result->current_field, gettype($mysqli_result->current_field), - $tmp, gettype($tmp)); - - assert(($tmp = mysqli_field_count($link)) === $mysqli_result->field_count); - printf("mysqli_result->field_count = '%s'/%s ('%s'/%s)\n", - $mysqli_result->field_count, gettype($mysqli_result->field_count), - $tmp, gettype($tmp)); - - assert(($tmp = mysqli_fetch_lengths($res)) === $mysqli_result->lengths); - printf("mysqli_result->lengths -> '%s'/%s ('%s'/%s)\n", - ((is_array($mysqli_result->lengths)) ? implode(' ', $mysqli_result->lengths) : 'n/a'), - gettype($mysqli_result->lengths), - ((is_array($tmp)) ? implode(' ', $tmp) : 'n/a'), - gettype($tmp)); - - assert(($tmp = mysqli_num_rows($res)) === $mysqli_result->num_rows); - printf("mysqli_result->num_rows = '%s'/%s ('%s'/%s)\n", - $mysqli_result->num_rows, gettype($mysqli_result->num_rows), - $tmp, gettype($tmp)); - - assert(in_array($mysqli_result->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT))); - printf("mysqli_result->type = '%s'/%s\n", - ((MYSQLI_STORE_RESULT == $mysqli_result->type) ? 'store' : 'use'), - gettype($mysqli_result->type)); - - printf("\nAccess to undefined properties:\n"); - printf("mysqli_result->unknown = '%s'\n", @$mysqli_result->unknown); - - printf("\nConstructor:\n"); - if (!is_object($res = new mysqli_result($link))) - printf("[001] Expecting object/mysqli_result got %s/%s\n", gettye($res), $res); - - try { + require('connect.inc'); + require('table.inc'); + + $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $mysqli_result = $mysqli->query('SELECT * FROM test'); + $row = $mysqli_result->fetch_row(); + + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + $res = mysqli_query($link, 'SELECT * FROM test'); + assert(mysqli_fetch_row($res) === $row); + + printf("Parent class:\n"); + var_dump(get_parent_class($mysqli_result)); + + printf("\nMethods:\n"); + $methods = get_class_methods($mysqli_result); + $expected_methods = array( + '__construct' => true, + 'close' => true, + 'data_seek' => true, + 'fetch_array' => true, + 'fetch_assoc' => true, + 'fetch_field' => true, + 'fetch_field_direct' => true, + 'fetch_fields' => true, + 'fetch_object' => true, + 'fetch_row' => true, + 'field_seek' => true, + 'free' => true, + 'free_result' => true, + ); + if ($IS_MYSQLND) + $expected_methods['fetch_all'] = true; + + foreach ($methods as $k => $method) { + if (isset($expected_methods[$method])) { + unset($expected_methods[$method]); + unset($methods[$k]); + } + if ($method == 'mysqli_result') { + // get_class_method reports different constructor names + unset($expected_methods['__construct']); + unset($methods[$k]); + } + } + + if (!empty($expected_methods)) { + printf("Dumping list of missing methods.\n"); + var_dump($expected_methods); + } + if (!empty($methods)) { + printf("Dumping list of unexpected methods.\n"); + var_dump($methods); + } + if (empty($expected_methods) && empty($methods)) + printf("ok\n"); + + + printf("\nClass variables:\n"); + $variables = array_keys(get_class_vars(get_class($mysqli_result))); + sort($variables); + foreach ($variables as $k => $var) + printf("%s\n", $var); + + printf("\nObject variables:\n"); + $variables = array_keys(get_object_vars($mysqli_result)); + foreach ($variables as $k => $var) + printf("%s\n", $var); + + printf("\nMagic, magic properties:\n"); + + assert(($tmp = mysqli_field_tell($res)) === $mysqli_result->current_field); + printf("mysqli_result->current_field = '%s'/%s ('%s'/%s)\n", + $mysqli_result->current_field, gettype($mysqli_result->current_field), + $tmp, gettype($tmp)); + + assert(($tmp = mysqli_field_count($link)) === $mysqli_result->field_count); + printf("mysqli_result->field_count = '%s'/%s ('%s'/%s)\n", + $mysqli_result->field_count, gettype($mysqli_result->field_count), + $tmp, gettype($tmp)); + + assert(($tmp = mysqli_fetch_lengths($res)) === $mysqli_result->lengths); + printf("mysqli_result->lengths -> '%s'/%s ('%s'/%s)\n", + ((is_array($mysqli_result->lengths)) ? implode(' ', $mysqli_result->lengths) : 'n/a'), + gettype($mysqli_result->lengths), + ((is_array($tmp)) ? implode(' ', $tmp) : 'n/a'), + gettype($tmp)); + + assert(($tmp = mysqli_num_rows($res)) === $mysqli_result->num_rows); + printf("mysqli_result->num_rows = '%s'/%s ('%s'/%s)\n", + $mysqli_result->num_rows, gettype($mysqli_result->num_rows), + $tmp, gettype($tmp)); + + assert(in_array($mysqli_result->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT))); + printf("mysqli_result->type = '%s'/%s\n", + ((MYSQLI_STORE_RESULT == $mysqli_result->type) ? 'store' : 'use'), + gettype($mysqli_result->type)); + + printf("\nAccess to undefined properties:\n"); + printf("mysqli_result->unknown = '%s'\n", @$mysqli_result->unknown); + + printf("\nConstructor:\n"); + if (!is_object($res = new mysqli_result($link))) + printf("[001] Expecting object/mysqli_result got %s/%s\n", gettye($res), $res); + + try { $res->num_rows; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } - - if (!mysqli_query($link, "SELECT id FROM test ORDER BY id")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!is_object($res = new mysqli_result($link))) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!is_object($res = new mysqli_result($link, MYSQLI_STORE_RESULT))) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!is_object($res = new mysqli_result($link, MYSQLI_USE_RESULT))) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT); - do { - $mode = mt_rand(-1000, 1000); - } while (in_array($mode, $valid)); - - if ($TEST_EXPERIMENTAL) { - ob_start(); - if (!is_object($res = new mysqli_result($link, $mode))) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $content = ob_get_contents(); - ob_end_clean(); - if (!stristr($content, 'Invalid value for resultmode')) - printf("[009] Expecting warning because of invalid resultmode\n"); - } - - print "done!"; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + if (!mysqli_query($link, "SELECT id FROM test ORDER BY id")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!is_object($res = new mysqli_result($link))) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!is_object($res = new mysqli_result($link, MYSQLI_STORE_RESULT))) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!is_object($res = new mysqli_result($link, MYSQLI_USE_RESULT))) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT); + do { + $mode = mt_rand(-1000, 1000); + } while (in_array($mode, $valid)); + + if ($TEST_EXPERIMENTAL) { + ob_start(); + if (!is_object($res = new mysqli_result($link, $mode))) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $content = ob_get_contents(); + ob_end_clean(); + if (!stristr($content, 'Invalid value for resultmode')) + printf("[009] Expecting warning because of invalid resultmode\n"); + } + + print "done!"; ?> --EXPECTF-- Parent class: diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt index c130e27a6b..83b4fbbd95 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt @@ -17,10 +17,10 @@ if (!$IS_MYSQLND) ?> --FILE-- <?php - require_once('reflection_tools.inc'); - $class = new ReflectionClass('mysqli_result'); - inspectClass($class); - print "done!"; + require_once('reflection_tools.inc'); + $class = new ReflectionClass('mysqli_result'); + inspectClass($class); + print "done!"; ?> --EXPECT-- Inspecting class 'mysqli_result' diff --git a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt index 134529d35c..8c79d35297 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt @@ -8,76 +8,76 @@ Interface of the class mysqli_stmt ?> --FILE-- <?php - require('connect.inc'); - require('table.inc'); - - $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - $stmt = new mysqli_stmt($link); - - printf("Parent class:\n"); - var_dump(get_parent_class($stmt)); - - printf("\nMethods:\n"); - - $methods = get_class_methods($stmt); - $expected_methods = array( - '__construct' => true, - 'attr_get' => true, - 'attr_set' => true, - 'bind_param' => true, - 'bind_result' => true, - 'close' => true, - 'data_seek' => true, - 'execute' => true, - 'fetch' => true, - 'free_result' => true, - 'get_warnings' => true, - 'num_rows' => true, - 'prepare' => true, - 'reset' => true, - 'result_metadata' => true, - 'send_long_data' => true, - 'store_result' => true, - ); - - if ($IS_MYSQLND) { - $expected_methods['get_result'] = true; - $expected_methods['more_results'] = true; - $expected_methods['next_result'] = true; - } - - foreach ($methods as $k => $method) { - if (isset($expected_methods[$method])) { - unset($methods[$k]); - unset($expected_methods[$method]); - } - if ($method == 'mysqli_stmt') { - // get_class_method reports different constructor names - unset($expected_methods['__construct']); - unset($methods[$k]); - } - } - if (!empty($methods)) { - printf("More methods found than indicated. Dumping list of unexpected methods.\n"); - var_dump($methods); - } - if (!empty($expected_methods)) { - printf("Some methods are missing. Dumping list of missing methods.\n"); - var_dump($expected_methods); - } - if (empty($methods) && empty($expected_methods)) - printf("ok\n"); - - printf("\nClass variables:\n"); - $variables = array_keys(get_class_vars(get_class($stmt))); - sort($variables); - foreach ($variables as $k => $var) - printf("%s\n", $var); - - printf("\nObject variables:\n"); - $variables = array_keys(get_object_vars($stmt)); - foreach ($variables as $k => $var) - printf("%s\n", $var); + require('connect.inc'); + require('table.inc'); + + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + $stmt = new mysqli_stmt($link); + + printf("Parent class:\n"); + var_dump(get_parent_class($stmt)); + + printf("\nMethods:\n"); + + $methods = get_class_methods($stmt); + $expected_methods = array( + '__construct' => true, + 'attr_get' => true, + 'attr_set' => true, + 'bind_param' => true, + 'bind_result' => true, + 'close' => true, + 'data_seek' => true, + 'execute' => true, + 'fetch' => true, + 'free_result' => true, + 'get_warnings' => true, + 'num_rows' => true, + 'prepare' => true, + 'reset' => true, + 'result_metadata' => true, + 'send_long_data' => true, + 'store_result' => true, + ); + + if ($IS_MYSQLND) { + $expected_methods['get_result'] = true; + $expected_methods['more_results'] = true; + $expected_methods['next_result'] = true; + } + + foreach ($methods as $k => $method) { + if (isset($expected_methods[$method])) { + unset($methods[$k]); + unset($expected_methods[$method]); + } + if ($method == 'mysqli_stmt') { + // get_class_method reports different constructor names + unset($expected_methods['__construct']); + unset($methods[$k]); + } + } + if (!empty($methods)) { + printf("More methods found than indicated. Dumping list of unexpected methods.\n"); + var_dump($methods); + } + if (!empty($expected_methods)) { + printf("Some methods are missing. Dumping list of missing methods.\n"); + var_dump($expected_methods); + } + if (empty($methods) && empty($expected_methods)) + printf("ok\n"); + + printf("\nClass variables:\n"); + $variables = array_keys(get_class_vars(get_class($stmt))); + sort($variables); + foreach ($variables as $k => $var) + printf("%s\n", $var); + + printf("\nObject variables:\n"); + $variables = array_keys(get_object_vars($stmt)); + foreach ($variables as $k => $var) + printf("%s\n", $var); printf("\nMagic, magic properties:\n"); diff --git a/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt b/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt index a73ef8ad68..127777fc6a 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt @@ -12,82 +12,82 @@ if (!$TEST_EXPERIMENTAL) ?> --FILE-- <?php - require('connect.inc'); - - $warning = new mysqli_warning(); - $warning = new mysqli_warning(null); - $warning = new mysqli_warning(null, null); - - $mysqli = new mysqli(); - $warning = new mysqli_warning($mysqli); - - $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $stmt = new mysqli_stmt($mysqli); - $warning = new mysqli_warning($stmt); - - $stmt = $mysqli->stmt_init(); - $warning = new mysqli_warning($stmt); - - $obj = new stdClass(); - $warning = new mysqli_warning($obj); - - include("table.inc"); - $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $res = $mysqli->query('INSERT INTO test(id, label) VALUES (1, "zz")'); - $warning = mysqli_get_warnings($mysqli); - - printf("Parent class:\n"); - var_dump(get_parent_class($warning)); - - printf("\nMethods:\n"); - $methods = get_class_methods($warning); - $expected_methods = array( - 'next' => true, - ); - - foreach ($methods as $k => $method) { - if (isset($expected_methods[$method])) { - unset($methods[$k]); - unset($expected_methods[$method]); - } - } - if (!empty($methods)) { - printf("Dumping list of unexpected methods.\n"); - var_dump($methods); - } - if (!empty($expected_methods)) { - printf("Dumping list of missing methods.\n"); - var_dump($expected_methods); - } - if (empty($methods) && empty($expected_methods)) - printf("ok\n"); - - printf("\nClass variables:\n"); - $variables = get_class_vars(get_class($mysqli)); - sort($variables); - foreach ($variables as $k => $var) - printf("%s\n", $var); - - printf("\nObject variables:\n"); - $variables = get_object_vars($mysqli); - foreach ($variables as $k => $var) - printf("%s\n", $var); - - printf("\nMagic, magic properties:\n"); - - assert('' === $warning->message); - printf("warning->message = '%s'\n", $warning->message); - - assert('' === $warning->sqlstate); - printf("warning->sqlstate= '%s'\n", $warning->sqlstate); - - assert(0 === $warning->errno); - printf("warning->errno = '%s'\n", $warning->errno); - - printf("\nAccess to undefined properties:\n"); - printf("warning->unknown = '%s'\n", @$warning->unknown); - - print "done!"; + require('connect.inc'); + + $warning = new mysqli_warning(); + $warning = new mysqli_warning(null); + $warning = new mysqli_warning(null, null); + + $mysqli = new mysqli(); + $warning = new mysqli_warning($mysqli); + + $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $stmt = new mysqli_stmt($mysqli); + $warning = new mysqli_warning($stmt); + + $stmt = $mysqli->stmt_init(); + $warning = new mysqli_warning($stmt); + + $obj = new stdClass(); + $warning = new mysqli_warning($obj); + + include("table.inc"); + $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + $res = $mysqli->query('INSERT INTO test(id, label) VALUES (1, "zz")'); + $warning = mysqli_get_warnings($mysqli); + + printf("Parent class:\n"); + var_dump(get_parent_class($warning)); + + printf("\nMethods:\n"); + $methods = get_class_methods($warning); + $expected_methods = array( + 'next' => true, + ); + + foreach ($methods as $k => $method) { + if (isset($expected_methods[$method])) { + unset($methods[$k]); + unset($expected_methods[$method]); + } + } + if (!empty($methods)) { + printf("Dumping list of unexpected methods.\n"); + var_dump($methods); + } + if (!empty($expected_methods)) { + printf("Dumping list of missing methods.\n"); + var_dump($expected_methods); + } + if (empty($methods) && empty($expected_methods)) + printf("ok\n"); + + printf("\nClass variables:\n"); + $variables = get_class_vars(get_class($mysqli)); + sort($variables); + foreach ($variables as $k => $var) + printf("%s\n", $var); + + printf("\nObject variables:\n"); + $variables = get_object_vars($mysqli); + foreach ($variables as $k => $var) + printf("%s\n", $var); + + printf("\nMagic, magic properties:\n"); + + assert('' === $warning->message); + printf("warning->message = '%s'\n", $warning->message); + + assert('' === $warning->sqlstate); + printf("warning->sqlstate= '%s'\n", $warning->sqlstate); + + assert(0 === $warning->errno); + printf("warning->errno = '%s'\n", $warning->errno); + + printf("\nAccess to undefined properties:\n"); + printf("warning->unknown = '%s'\n", @$warning->unknown); + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt index f57945e589..e8aef44b10 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt @@ -16,10 +16,10 @@ if (!$IS_MYSQLND) ?> --FILE-- <?php - require_once('reflection_tools.inc'); - $class = new ReflectionClass('mysqli_warning'); - inspectClass($class); - print "done!\n"; + require_once('reflection_tools.inc'); + $class = new ReflectionClass('mysqli_warning'); + inspectClass($class); + print "done!\n"; ?> --EXPECTF-- Inspecting class 'mysqli_warning' diff --git a/ext/mysqli/tests/mysqli_close.phpt b/ext/mysqli/tests/mysqli_close.phpt index 4532749624..a0d7fa2eab 100644 --- a/ext/mysqli/tests/mysqli_close.phpt +++ b/ext/mysqli/tests/mysqli_close.phpt @@ -8,23 +8,23 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[003] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - $tmp = mysqli_close($link); - if (true !== $tmp) - printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + $tmp = mysqli_close($link); + if (true !== $tmp) + printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - try { + try { mysqli_query($link, "SELECT 1"); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; --EXPECT-- mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_close_oo.phpt b/ext/mysqli/tests/mysqli_close_oo.phpt index dc912925d9..351df66d94 100644 --- a/ext/mysqli/tests/mysqli_close_oo.phpt +++ b/ext/mysqli/tests/mysqli_close_oo.phpt @@ -8,18 +8,18 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - $tmp = $mysqli->close(); - if (true !== $tmp) - printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + $tmp = $mysqli->close(); + if (true !== $tmp) + printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); try { $mysqli->close(); @@ -33,7 +33,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --EXPECT-- my_mysqli object is already closed diff --git a/ext/mysqli/tests/mysqli_commit.phpt b/ext/mysqli/tests/mysqli_commit.phpt index 9f1f969f4d..33bb2011cd 100644 --- a/ext/mysqli/tests/mysqli_commit.phpt +++ b/ext/mysqli/tests/mysqli_commit.phpt @@ -15,42 +15,42 @@ if (!have_innodb($link)) ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[004] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (true !== ($tmp = mysqli_autocommit($link, false))) - printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_autocommit($link, false))) + printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) - printf("[007] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) + printf("[007] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_commit($link); - if ($tmp !== true) - printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + $tmp = mysqli_commit($link); + if ($tmp !== true) + printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, 'ROLLBACK')) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'ROLLBACK')) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test')) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - if (1 != $tmp['num']) - printf("[12] Expecting 1 row in table test, found %d rows\n", $tmp['num']); - mysqli_free_result($res); + if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test')) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + if (1 != $tmp['num']) + printf("[12] Expecting 1 row in table test, found %d rows\n", $tmp['num']); + mysqli_free_result($res); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_close($link); + mysqli_close($link); try { mysqli_commit($link); @@ -58,7 +58,7 @@ if (!have_innodb($link)) echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_commit_oo.phpt b/ext/mysqli/tests/mysqli_commit_oo.phpt index 205fbc48ab..9ae81f9700 100644 --- a/ext/mysqli/tests/mysqli_commit_oo.phpt +++ b/ext/mysqli/tests/mysqli_commit_oo.phpt @@ -15,82 +15,82 @@ if (!have_innodb($link)) ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - $mysqli = new mysqli(); + $mysqli = new mysqli(); try { $mysqli->commit(); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - } - - if (true !== ($tmp = $mysqli->commit())) { - printf("[002] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); - } - - if (true !== ($tmp = $mysqli->autocommit(false))) { - printf("[003] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); - } - - if (!$mysqli->query('DROP TABLE IF EXISTS test')) { - printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) { - printf("[005] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - if (!$mysqli->query('INSERT INTO test(id) VALUES (1)')) { - printf("[006] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - $tmp = $mysqli->commit(); - if ($tmp !== true) { - printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - } - - if (!$mysqli->query('ROLLBACK')) - printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error); - - if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test')) { - printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - $tmp = $res->fetch_assoc(); - if (1 != $tmp['num']) { - printf("[010] Expecting 1 row in table test, found %d rows\n", $tmp['num']); - } - $res->free(); - - if (!$mysqli->query('DROP TABLE IF EXISTS test')) { - printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - if (!$mysqli->commit(0 , "tx_name0123")) { - printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - if (!$mysqli->commit(0 , "*/ nonsense")) { - printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - if (!$mysqli->commit(0 , "tx_name ulf вендел")) { - printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - if (!$mysqli->commit(0 , "tx_name \t\n\r\b")) { - printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - if (!$mysqli->commit(MYSQLI_TRANS_COR_AND_CHAIN | MYSQLI_TRANS_COR_NO_RELEASE , "tx_name")) { - printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - $mysqli->close(); + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } + + if (true !== ($tmp = $mysqli->commit())) { + printf("[002] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); + } + + if (true !== ($tmp = $mysqli->autocommit(false))) { + printf("[003] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); + } + + if (!$mysqli->query('DROP TABLE IF EXISTS test')) { + printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) { + printf("[005] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + if (!$mysqli->query('INSERT INTO test(id) VALUES (1)')) { + printf("[006] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + $tmp = $mysqli->commit(); + if ($tmp !== true) { + printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + } + + if (!$mysqli->query('ROLLBACK')) + printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error); + + if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test')) { + printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + $tmp = $res->fetch_assoc(); + if (1 != $tmp['num']) { + printf("[010] Expecting 1 row in table test, found %d rows\n", $tmp['num']); + } + $res->free(); + + if (!$mysqli->query('DROP TABLE IF EXISTS test')) { + printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + if (!$mysqli->commit(0 , "tx_name0123")) { + printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + if (!$mysqli->commit(0 , "*/ nonsense")) { + printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + if (!$mysqli->commit(0 , "tx_name ulf вендел")) { + printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + if (!$mysqli->commit(0 , "tx_name \t\n\r\b")) { + printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + if (!$mysqli->commit(MYSQLI_TRANS_COR_AND_CHAIN | MYSQLI_TRANS_COR_NO_RELEASE , "tx_name")) { + printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + $mysqli->close(); try { $mysqli->commit(); @@ -98,7 +98,7 @@ if (!have_innodb($link)) echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; --CLEAN-- <?php require_once("clean_table.inc"); diff --git a/ext/mysqli/tests/mysqli_connect.phpt b/ext/mysqli/tests/mysqli_connect.phpt index d5e4febbef..a1372f3511 100644 --- a/ext/mysqli/tests/mysqli_connect.phpt +++ b/ext/mysqli/tests/mysqli_connect.phpt @@ -8,141 +8,141 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - $tmp = NULL; - $link = NULL; - - /* we need to check, if the server allows anonymous login (empty user) */ - $tmp = @mysqli_connect('localhost'); - $anon_allow = (gettype($tmp) == "object"); - - $exptype = ($anon_allow) ? "mysqli_object" : "false"; - - $tmp = @mysqli_connect($link); - if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) { - printf("[002] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp); - } - - $tmp = @mysqli_connect($link, $link); - if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) { - printf("[003] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp); - } - - $tmp = @mysqli_connect($link, $link, $link); - if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) { - printf("[004] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp); - } - - $tmp = @mysqli_connect($link, $link, $link, $link); - if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) { - printf("[005] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp); - } - - $tmp = @mysqli_connect($link, $link, $link, $link, $link); - if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) { - printf("[006] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp); - } - - $tmp = @mysqli_connect($link, $link, $link, $link, $link, $link); - if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) { - printf("[007] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp); - } - - if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - mysqli_close($link); - - if ($link = mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) - printf("[009] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", - $host, $user . 'unknown_really', $db, $port, $socket); - - if (false !== $link) - printf("[010] Expecting boolean/false, got %s/%s\n", gettype($link), $link); - - // Run the following tests without an anoynmous MySQL user and use a password for the test user! - ini_set('mysqli.default_socket', $socket); - if (!is_object($link = mysqli_connect($host, $user, $passwd, $db, $port))) { - printf("[011] Usage of mysqli.default_socket failed\n") ; - } else { - if (!$res = mysqli_query($link, "SELECT 'mysqli.default_socket' AS 'testing'")) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - mysqli_close($link); - } - - ini_set('mysqli.default_port', $port); - if (!is_object($link = mysqli_connect($host, $user, $passwd, $db))) { - printf("[013] Usage of mysqli.default_port failed\n") ; - } else { - if (!$res = mysqli_query($link, "SELECT 'mysqli.default_port' AS 'testing'")) - printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - mysqli_close($link); - } - - ini_set('mysqli.default_pw', $passwd); - if (!is_object($link = mysqli_connect($host, $user))) { - printf("[015] Usage of mysqli.default_pw failed\n") ; - } else { - if (!$res = mysqli_query($link, "SELECT 'mysqli.default_pw' AS 'testing'")) - printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - mysqli_close($link); - } - - ini_set('mysqli.default_user', $user); - if (!is_object($link = mysqli_connect($host))) { - printf("[017] Usage of mysqli.default_user failed\n") ; - } else { - if (!$res = mysqli_query($link, "SELECT 'mysqli.default_user' AS 'testing'")) - printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump(mysqli_fetch_array($res, MYSQLI_BOTH)); - mysqli_free_result($res); - mysqli_close($link); - } - - ini_set('mysqli.default_host', $host); - if (!is_object($link = mysqli_connect())) { - printf("[019] Usage of mysqli.default_host failed\n") ; - } else { - if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host' AS 'testing'")) - printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump(mysqli_fetch_array($res, MYSQLI_NUM)); - mysqli_free_result($res); - mysqli_close($link); - } - - if ($IS_MYSQLND) { - ini_set('mysqli.default_host', 'p:' . $host); - if (!is_object($link = mysqli_connect())) { - printf("[021] Usage of mysqli.default_host (persistent) failed\n") ; - } else { - if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'")) - printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - if ($tmp['testing'] !== 'mysqli.default_host (persistent)') { - printf("[023] Result looks strange - check manually, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - var_dump($tmp); - } - mysqli_free_result($res); - mysqli_close($link); - } - - ini_set('mysqli.default_host', 'p:'); - if (is_object($link = @mysqli_connect())) { - printf("[024] Usage of mysqli.default_host=p: did not fail\n") ; - mysqli_close($link); - } - } - - print "done!"; + require_once("connect.inc"); + + $tmp = NULL; + $link = NULL; + + /* we need to check, if the server allows anonymous login (empty user) */ + $tmp = @mysqli_connect('localhost'); + $anon_allow = (gettype($tmp) == "object"); + + $exptype = ($anon_allow) ? "mysqli_object" : "false"; + + $tmp = @mysqli_connect($link); + if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) { + printf("[002] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp); + } + + $tmp = @mysqli_connect($link, $link); + if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) { + printf("[003] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp); + } + + $tmp = @mysqli_connect($link, $link, $link); + if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) { + printf("[004] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp); + } + + $tmp = @mysqli_connect($link, $link, $link, $link); + if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) { + printf("[005] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp); + } + + $tmp = @mysqli_connect($link, $link, $link, $link, $link); + if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) { + printf("[006] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp); + } + + $tmp = @mysqli_connect($link, $link, $link, $link, $link, $link); + if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) { + printf("[007] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp); + } + + if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + mysqli_close($link); + + if ($link = mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) + printf("[009] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", + $host, $user . 'unknown_really', $db, $port, $socket); + + if (false !== $link) + printf("[010] Expecting boolean/false, got %s/%s\n", gettype($link), $link); + + // Run the following tests without an anoynmous MySQL user and use a password for the test user! + ini_set('mysqli.default_socket', $socket); + if (!is_object($link = mysqli_connect($host, $user, $passwd, $db, $port))) { + printf("[011] Usage of mysqli.default_socket failed\n") ; + } else { + if (!$res = mysqli_query($link, "SELECT 'mysqli.default_socket' AS 'testing'")) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + mysqli_close($link); + } + + ini_set('mysqli.default_port', $port); + if (!is_object($link = mysqli_connect($host, $user, $passwd, $db))) { + printf("[013] Usage of mysqli.default_port failed\n") ; + } else { + if (!$res = mysqli_query($link, "SELECT 'mysqli.default_port' AS 'testing'")) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + mysqli_close($link); + } + + ini_set('mysqli.default_pw', $passwd); + if (!is_object($link = mysqli_connect($host, $user))) { + printf("[015] Usage of mysqli.default_pw failed\n") ; + } else { + if (!$res = mysqli_query($link, "SELECT 'mysqli.default_pw' AS 'testing'")) + printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + mysqli_close($link); + } + + ini_set('mysqli.default_user', $user); + if (!is_object($link = mysqli_connect($host))) { + printf("[017] Usage of mysqli.default_user failed\n") ; + } else { + if (!$res = mysqli_query($link, "SELECT 'mysqli.default_user' AS 'testing'")) + printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump(mysqli_fetch_array($res, MYSQLI_BOTH)); + mysqli_free_result($res); + mysqli_close($link); + } + + ini_set('mysqli.default_host', $host); + if (!is_object($link = mysqli_connect())) { + printf("[019] Usage of mysqli.default_host failed\n") ; + } else { + if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host' AS 'testing'")) + printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump(mysqli_fetch_array($res, MYSQLI_NUM)); + mysqli_free_result($res); + mysqli_close($link); + } + + if ($IS_MYSQLND) { + ini_set('mysqli.default_host', 'p:' . $host); + if (!is_object($link = mysqli_connect())) { + printf("[021] Usage of mysqli.default_host (persistent) failed\n") ; + } else { + if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'")) + printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + if ($tmp['testing'] !== 'mysqli.default_host (persistent)') { + printf("[023] Result looks strange - check manually, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + var_dump($tmp); + } + mysqli_free_result($res); + mysqli_close($link); + } + + ini_set('mysqli.default_host', 'p:'); + if (is_object($link = @mysqli_connect())) { + printf("[024] Usage of mysqli.default_host=p: did not fail\n") ; + mysqli_close($link); + } + } + + print "done!"; ?> --EXPECTF-- Warning: mysqli_connect(): (%s/%d): Access denied for user '%s'@'%s' (using password: YES) in %s on line %d diff --git a/ext/mysqli/tests/mysqli_connect_attr.phpt b/ext/mysqli/tests/mysqli_connect_attr.phpt index 96c79b1a6b..86f3e08a5c 100644 --- a/ext/mysqli/tests/mysqli_connect_attr.phpt +++ b/ext/mysqli/tests/mysqli_connect_attr.phpt @@ -37,13 +37,13 @@ mysqli_close($link); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; $res = NULL; - if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] 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 = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",$host, $user, $db, $port, $socket); //in case $host is empty, do not test for _server_host field if (isset($host) && trim($host) != '') { diff --git a/ext/mysqli/tests/mysqli_connect_errno.phpt b/ext/mysqli/tests/mysqli_connect_errno.phpt index 995eeaeb27..f542ba88e8 100644 --- a/ext/mysqli/tests/mysqli_connect_errno.phpt +++ b/ext/mysqli/tests/mysqli_connect_errno.phpt @@ -8,36 +8,36 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - // too many parameter - try { - mysqli_connect_errno($link); - } catch (ArgumentCountError $exception) { - print($exception->getMessage() . "\n"); - } + // too many parameter + try { + mysqli_connect_errno($link); + } catch (ArgumentCountError $exception) { + print($exception->getMessage() . "\n"); + } - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[002] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (0 !== ($tmp = mysqli_connect_errno())) - printf("[003] Expecting integer/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = mysqli_connect_errno())) + printf("[003] Expecting integer/0, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); - $link = @my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket); - if (false !== $link) - printf("[004] Connect to the server should fail using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s, expecting boolean/false, got %s/%s\n", - $host, $user . 'unknown_really', $db, $port, $socket, gettype($link), var_export($link, true)); + $link = @my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket); + if (false !== $link) + printf("[004] Connect to the server should fail using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s, expecting boolean/false, got %s/%s\n", + $host, $user . 'unknown_really', $db, $port, $socket, gettype($link), var_export($link, true)); - if (0 === ($tmp = mysqli_connect_errno())) - printf("[005] Expecting integer/any non-zero, got %s/%s\n", gettype($tmp), $tmp); + if (0 === ($tmp = mysqli_connect_errno())) + printf("[005] Expecting integer/any non-zero, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; + print "done!"; ?> --EXPECT-- mysqli_connect_errno() expects exactly 0 parameters, 1 given diff --git a/ext/mysqli/tests/mysqli_connect_error.phpt b/ext/mysqli/tests/mysqli_connect_error.phpt index 40b2c7e4b4..0f51d15dfd 100644 --- a/ext/mysqli/tests/mysqli_connect_error.phpt +++ b/ext/mysqli/tests/mysqli_connect_error.phpt @@ -8,35 +8,35 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - // too many parameter - try { - mysqli_connect_error($link); - } catch (ArgumentCountError $exception) { - print($exception->getMessage() . "\n"); - } + // too many parameter + try { + mysqli_connect_error($link); + } catch (ArgumentCountError $exception) { + print($exception->getMessage() . "\n"); + } - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[002] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (NULL !== ($tmp = mysqli_connect_error())) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = mysqli_connect_error())) + printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); - if ($link = @my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) - printf("[003] Connect to the server should fail using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", - $host, $user . 'unknown_really', $db, $port, $socket); + if ($link = @my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) + printf("[003] Connect to the server should fail using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", + $host, $user . 'unknown_really', $db, $port, $socket); - if ('' === ($tmp = mysqli_connect_error())) - printf("[004] Expecting string/'', got %s/%s\n", gettype($tmp), $tmp); + if ('' === ($tmp = mysqli_connect_error())) + printf("[004] Expecting string/'', got %s/%s\n", gettype($tmp), $tmp); - print "done!"; + print "done!"; ?> --EXPECT-- mysqli_connect_error() expects exactly 0 parameters, 1 given diff --git a/ext/mysqli/tests/mysqli_connect_oo.phpt b/ext/mysqli/tests/mysqli_connect_oo.phpt index 4a675b587c..e39b4ac2da 100644 --- a/ext/mysqli/tests/mysqli_connect_oo.phpt +++ b/ext/mysqli/tests/mysqli_connect_oo.phpt @@ -8,145 +8,145 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - $tmp = NULL; - $link = NULL; - - $obj = new stdClass(); - - if ($mysqli = new mysqli($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket) && !mysqli_connect_errno()) - printf("[003] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", - $host, $user . 'unknown_really', $db, $port, $socket); - - if (false !== $mysqli) - printf("[004] Expecting boolean/false, got %s/%s\n", gettype($mysqli), $mysqli); - - // Run the following tests without an anoynmous MySQL user and use a password for the test user! - ini_set('mysqli.default_socket', $socket); - if (!is_object($mysqli = new mysqli($host, $user, $passwd, $db, $port)) || (0 !== mysqli_connect_errno())) { - printf("[005] Usage of mysqli.default_socket failed\n") ; - } else { - $mysqli->close(); - } - - ini_set('mysqli.default_port', $port); - if (!is_object($mysqli = new mysqli($host, $user, $passwd, $db)) || (0 !== mysqli_connect_errno())) { - printf("[006] Usage of mysqli.default_port failed\n") ; - } else { - $mysqli->close(); - } - - ini_set('mysqli.default_pw', $passwd); - if (!is_object($mysqli = new mysqli($host, $user)) || (0 !== mysqli_connect_errno())) { - printf("[007] Usage of mysqli.default_pw failed\n") ; - } else { - $mysqli->close(); - } - - ini_set('mysqli.default_user', $user); - if (!is_object($mysqli = new mysqli($host)) || (0 !== mysqli_connect_errno())) { - printf("[008] Usage of mysqli.default_user failed\n") ; - } else { - $mysqli->close(); - } - - ini_set('mysqli.default_host', $host); - if (!is_object($mysqli = new mysqli()) || (0 !== mysqli_connect_errno())) { - printf("[012] Failed to create mysqli object\n"); - } else { - // There shall be NO connection! Using new mysqli(void) shall not use defaults for a connection! - // We had long discussions on this and found that the ext/mysqli API as - // such is broken. As we can't fix it, we document how it has behaved from - // the first day on. And that's: no connection. + require_once("connect.inc"); + + $tmp = NULL; + $link = NULL; + + $obj = new stdClass(); + + if ($mysqli = new mysqli($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket) && !mysqli_connect_errno()) + printf("[003] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", + $host, $user . 'unknown_really', $db, $port, $socket); + + if (false !== $mysqli) + printf("[004] Expecting boolean/false, got %s/%s\n", gettype($mysqli), $mysqli); + + // Run the following tests without an anoynmous MySQL user and use a password for the test user! + ini_set('mysqli.default_socket', $socket); + if (!is_object($mysqli = new mysqli($host, $user, $passwd, $db, $port)) || (0 !== mysqli_connect_errno())) { + printf("[005] Usage of mysqli.default_socket failed\n") ; + } else { + $mysqli->close(); + } + + ini_set('mysqli.default_port', $port); + if (!is_object($mysqli = new mysqli($host, $user, $passwd, $db)) || (0 !== mysqli_connect_errno())) { + printf("[006] Usage of mysqli.default_port failed\n") ; + } else { + $mysqli->close(); + } + + ini_set('mysqli.default_pw', $passwd); + if (!is_object($mysqli = new mysqli($host, $user)) || (0 !== mysqli_connect_errno())) { + printf("[007] Usage of mysqli.default_pw failed\n") ; + } else { + $mysqli->close(); + } + + ini_set('mysqli.default_user', $user); + if (!is_object($mysqli = new mysqli($host)) || (0 !== mysqli_connect_errno())) { + printf("[008] Usage of mysqli.default_user failed\n") ; + } else { + $mysqli->close(); + } + + ini_set('mysqli.default_host', $host); + if (!is_object($mysqli = new mysqli()) || (0 !== mysqli_connect_errno())) { + printf("[012] Failed to create mysqli object\n"); + } else { + // There shall be NO connection! Using new mysqli(void) shall not use defaults for a connection! + // We had long discussions on this and found that the ext/mysqli API as + // such is broken. As we can't fix it, we document how it has behaved from + // the first day on. And that's: no connection. try { $mysqli->query('SELECT 1'); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - } - - if ($IS_MYSQLND) { - ini_set('mysqli.default_host', 'p:' . $host); - if (!is_object($mysqli = new mysqli())) { - // Due to an API flaw this shall not connect - printf("[010] Failed to create mysqli object\n"); - } else { - // There shall be NO connection! Using new mysqli(void) shall not use defaults for a connection! - // We had long discussions on this and found that the ext/mysqli API as - // such is broken. As we can't fix it, we document how it has behaved from - // the first day on. And that's: no connection. - try { - $mysqli->query('SELECT 1'); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } - } - } - - print "... and now Exceptions\n"; - mysqli_report(MYSQLI_REPORT_OFF); - mysqli_report(MYSQLI_REPORT_STRICT); - - try { - $mysqli = new mysqli($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket); - printf("[016] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", - $host, $user . 'unknown_really', $db, $port, $socket); - $mysqli->close(); - } catch (mysqli_sql_exception $e) { - printf("%s\n", $e->getMessage()); - } - - ini_set('mysqli.default_socket', $socket); - try { - $mysqli = new mysqli($host, $user, $passwd, $db, $port); - $mysqli->close(); - } catch (mysqli_sql_exception $e) { - printf("%s\n", $e->getMessage()); - printf("[017] Usage of mysqli.default_socket failed\n") ; - } - - ini_set('mysqli.default_port', $port); - try { - $mysqli = new mysqli($host, $user, $passwd, $db); - $mysqli->close(); - } catch (mysqli_sql_exception $e) { - printf("%s\n", $e->getMessage()); - printf("[018] Usage of mysqli.default_port failed\n") ; - } - - ini_set('mysqli.default_pw', $passwd); - try { - $mysqli = new mysqli($host, $user); - $mysqli->close(); - } catch (mysqli_sql_exception $e) { - printf("%s\n", $e->getMessage()); - printf("[019] Usage of mysqli.default_pw failed\n"); - } - - ini_set('mysqli.default_user', $user); - try { - $mysqli = new mysqli($host); - $mysqli->close(); - } catch (mysqli_sql_exception $e) { - printf("%s\n", $e->getMessage()); - printf("[020] Usage of mysqli.default_user failed\n") ; - } - - ini_set('mysqli.default_host', $host); - try { - /* NOTE that at this point one must use a different syntax! */ - $mysqli = mysqli_init(); - $mysqli->real_connect(); - assert(0 === mysqli_connect_errno()); - $mysqli->close(); - assert(0 === mysqli_connect_errno()); - } catch (mysqli_sql_exception $e) { - printf("%s\n", $e->getMessage()); - printf("[021] Usage of mysqli.default_host failed\n"); - } - - print "done!"; + } + + if ($IS_MYSQLND) { + ini_set('mysqli.default_host', 'p:' . $host); + if (!is_object($mysqli = new mysqli())) { + // Due to an API flaw this shall not connect + printf("[010] Failed to create mysqli object\n"); + } else { + // There shall be NO connection! Using new mysqli(void) shall not use defaults for a connection! + // We had long discussions on this and found that the ext/mysqli API as + // such is broken. As we can't fix it, we document how it has behaved from + // the first day on. And that's: no connection. + try { + $mysqli->query('SELECT 1'); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + } + } + + print "... and now Exceptions\n"; + mysqli_report(MYSQLI_REPORT_OFF); + mysqli_report(MYSQLI_REPORT_STRICT); + + try { + $mysqli = new mysqli($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket); + printf("[016] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", + $host, $user . 'unknown_really', $db, $port, $socket); + $mysqli->close(); + } catch (mysqli_sql_exception $e) { + printf("%s\n", $e->getMessage()); + } + + ini_set('mysqli.default_socket', $socket); + try { + $mysqli = new mysqli($host, $user, $passwd, $db, $port); + $mysqli->close(); + } catch (mysqli_sql_exception $e) { + printf("%s\n", $e->getMessage()); + printf("[017] Usage of mysqli.default_socket failed\n") ; + } + + ini_set('mysqli.default_port', $port); + try { + $mysqli = new mysqli($host, $user, $passwd, $db); + $mysqli->close(); + } catch (mysqli_sql_exception $e) { + printf("%s\n", $e->getMessage()); + printf("[018] Usage of mysqli.default_port failed\n") ; + } + + ini_set('mysqli.default_pw', $passwd); + try { + $mysqli = new mysqli($host, $user); + $mysqli->close(); + } catch (mysqli_sql_exception $e) { + printf("%s\n", $e->getMessage()); + printf("[019] Usage of mysqli.default_pw failed\n"); + } + + ini_set('mysqli.default_user', $user); + try { + $mysqli = new mysqli($host); + $mysqli->close(); + } catch (mysqli_sql_exception $e) { + printf("%s\n", $e->getMessage()); + printf("[020] Usage of mysqli.default_user failed\n") ; + } + + ini_set('mysqli.default_host', $host); + try { + /* NOTE that at this point one must use a different syntax! */ + $mysqli = mysqli_init(); + $mysqli->real_connect(); + assert(0 === mysqli_connect_errno()); + $mysqli->close(); + assert(0 === mysqli_connect_errno()); + } catch (mysqli_sql_exception $e) { + printf("%s\n", $e->getMessage()); + printf("[021] Usage of mysqli.default_host failed\n"); + } + + print "done!"; ?> --EXPECTF-- Warning: mysqli::__construct(): (%s/%d): Access denied for user '%sunknown%s'@'%s' (using password: %s) in %s on line %d diff --git a/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt b/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt index cdc8049719..c5e65f7616 100644 --- a/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt +++ b/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt @@ -8,153 +8,153 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - $tmp = NULL; - $link = NULL; - - if ($socket != "") - /* mysqli.default_socket requires non-empty string */ - ini_set('mysqli.default_socket', 'socket'); - - ini_set('mysqli.default_port', 9999); - ini_set('mysqli.default_pw', 'password'); - ini_set('mysqli.default_user', 'user'); - ini_set('mysqli.default_host', 'host'); - - mysqli_report(MYSQLI_REPORT_OFF); - mysqli_report(MYSQLI_REPORT_STRICT); - - if ($socket != "") { - ini_set('mysqli.default_socket', $socket); - try { - $mysqli = mysqli_init(); - $mysqli->real_connect($host, $user, $passwd, $db, $port); - - if (!$res = $mysqli->query("SELECT 'mysqli.default_socket' AS testing")) - printf("[001] [%d] %s\n", $mysqli->errno, $mysqli->error); - $tmp = $res->fetch_assoc(); - $res->free_result(); - - if (!isset($tmp['testing']) || $tmp['testing'] != 'mysqli.default_socket') { - printf("[002] mysqli.default_socket not properly set?\n"); - var_dump($tmp); - } - - $mysqli->close(); - - } catch (mysqli_sql_exception $e) { - printf("%s\n", $e->getMessage()); - printf("[002] Usage of mysqli.default_socket failed\n"); - } - } - - ini_set('mysqli.default_port', $port); - try { - $mysqli = mysqli_init(); - $mysqli->real_connect($host, $user, $passwd, $db); - - if (!$res = $mysqli->query("SELECT 'mysqli.default_port' AS testing")) - printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error); - var_dump($res->fetch_assoc()); - $res->free_result(); - - $mysqli->close(); - - } catch (mysqli_sql_exception $e) { - printf("%s\n", $e->getMessage()); - printf("[004] Usage of mysqli.default_port failed\n"); - } - - ini_set('mysqli.default_pw', $passwd); - try { - $mysqli = mysqli_init(); - $mysqli->real_connect($host, $user); - $mysqli->select_db($db); - - if (!$res = $mysqli->query("SELECT 'mysqli.default_pw' AS testing")) - printf("[005] [%d] %s\n", $mysqli->errno, $mysqli->error); - var_dump($res->fetch_assoc()); - $res->free_result(); - - $mysqli->close(); - - } catch (mysqli_sql_exception $e) { - printf("%s\n", $e->getMessage()); - printf("[006] Usage of mysqli.default_pw failed\n"); - } - - ini_set('mysqli.default_user', $user); - try { - $mysqli = mysqli_init(); - $mysqli->real_connect($host); - $mysqli->select_db($db); - - if (!$res = $mysqli->query("SELECT 'mysqli.default_user' AS testing")) - printf("[007] [%d] %s\n", $mysqli->errno, $mysqli->error); - var_dump($res->fetch_assoc()); - $res->free_result(); - - $mysqli->close(); - - } catch (mysqli_sql_exception $e) { - printf("%s\n", $e->getMessage()); - printf("[008] Usage of mysqli.default_user failed\n"); - } - - ini_set('mysqli.default_host', $host); - try { - $mysqli = mysqli_init(); - $mysqli->real_connect(); - $mysqli->select_db($db); - - if (!$res = $mysqli->query("SELECT 1")) - printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error); - $res->free_result(); - - if (!$res = $mysqli->query("SELECT SUBSTRING_INDEX(USER(),'@',1) AS username")) - printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error); - - $tmp = $res->fetch_assoc(); - $res->free_result(); - if ($tmp['username'] !== $user) - printf("[011] Expecting string/%s, got %s/%s\n", $user, gettype($tmp['username']), $tmp['username']); - - $mysqli->close(); - - } catch (mysqli_sql_exception $e) { - printf("%s\n", $e->getMessage()); - printf("[012] Usage of mysqli.default_host failed\n"); - } - - try { - $link = mysqli_connect($host, $user, $passwd, null, ini_get('mysqli.default_port')); - mysqli_select_db($link, $db); - if (!$res = mysqli_query($link, "SELECT 'have been set' AS all_defaults")) - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - mysqli_close($link); - } catch (mysqli_sql_exception $e) { - printf("%s\n", $e->getMessage()); - printf("[014] Usage of mysqli_connect() has failed\n"); - } - - try { - $link = mysqli_connect($host, $user, $passwd, null); - mysqli_select_db($link, $db); - if (!$res = mysqli_query($link, "SELECT 'have been set' AS all_defaults")) - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - mysqli_close($link); - } catch (mysqli_sql_exception $e) { - printf("%s\n", $e->getMessage()); - printf("[016] Usage of mysqli_connect() has failed\n"); - } - - - print "done!"; + require_once("connect.inc"); + + $tmp = NULL; + $link = NULL; + + if ($socket != "") + /* mysqli.default_socket requires non-empty string */ + ini_set('mysqli.default_socket', 'socket'); + + ini_set('mysqli.default_port', 9999); + ini_set('mysqli.default_pw', 'password'); + ini_set('mysqli.default_user', 'user'); + ini_set('mysqli.default_host', 'host'); + + mysqli_report(MYSQLI_REPORT_OFF); + mysqli_report(MYSQLI_REPORT_STRICT); + + if ($socket != "") { + ini_set('mysqli.default_socket', $socket); + try { + $mysqli = mysqli_init(); + $mysqli->real_connect($host, $user, $passwd, $db, $port); + + if (!$res = $mysqli->query("SELECT 'mysqli.default_socket' AS testing")) + printf("[001] [%d] %s\n", $mysqli->errno, $mysqli->error); + $tmp = $res->fetch_assoc(); + $res->free_result(); + + if (!isset($tmp['testing']) || $tmp['testing'] != 'mysqli.default_socket') { + printf("[002] mysqli.default_socket not properly set?\n"); + var_dump($tmp); + } + + $mysqli->close(); + + } catch (mysqli_sql_exception $e) { + printf("%s\n", $e->getMessage()); + printf("[002] Usage of mysqli.default_socket failed\n"); + } + } + + ini_set('mysqli.default_port', $port); + try { + $mysqli = mysqli_init(); + $mysqli->real_connect($host, $user, $passwd, $db); + + if (!$res = $mysqli->query("SELECT 'mysqli.default_port' AS testing")) + printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error); + var_dump($res->fetch_assoc()); + $res->free_result(); + + $mysqli->close(); + + } catch (mysqli_sql_exception $e) { + printf("%s\n", $e->getMessage()); + printf("[004] Usage of mysqli.default_port failed\n"); + } + + ini_set('mysqli.default_pw', $passwd); + try { + $mysqli = mysqli_init(); + $mysqli->real_connect($host, $user); + $mysqli->select_db($db); + + if (!$res = $mysqli->query("SELECT 'mysqli.default_pw' AS testing")) + printf("[005] [%d] %s\n", $mysqli->errno, $mysqli->error); + var_dump($res->fetch_assoc()); + $res->free_result(); + + $mysqli->close(); + + } catch (mysqli_sql_exception $e) { + printf("%s\n", $e->getMessage()); + printf("[006] Usage of mysqli.default_pw failed\n"); + } + + ini_set('mysqli.default_user', $user); + try { + $mysqli = mysqli_init(); + $mysqli->real_connect($host); + $mysqli->select_db($db); + + if (!$res = $mysqli->query("SELECT 'mysqli.default_user' AS testing")) + printf("[007] [%d] %s\n", $mysqli->errno, $mysqli->error); + var_dump($res->fetch_assoc()); + $res->free_result(); + + $mysqli->close(); + + } catch (mysqli_sql_exception $e) { + printf("%s\n", $e->getMessage()); + printf("[008] Usage of mysqli.default_user failed\n"); + } + + ini_set('mysqli.default_host', $host); + try { + $mysqli = mysqli_init(); + $mysqli->real_connect(); + $mysqli->select_db($db); + + if (!$res = $mysqli->query("SELECT 1")) + printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error); + $res->free_result(); + + if (!$res = $mysqli->query("SELECT SUBSTRING_INDEX(USER(),'@',1) AS username")) + printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error); + + $tmp = $res->fetch_assoc(); + $res->free_result(); + if ($tmp['username'] !== $user) + printf("[011] Expecting string/%s, got %s/%s\n", $user, gettype($tmp['username']), $tmp['username']); + + $mysqli->close(); + + } catch (mysqli_sql_exception $e) { + printf("%s\n", $e->getMessage()); + printf("[012] Usage of mysqli.default_host failed\n"); + } + + try { + $link = mysqli_connect($host, $user, $passwd, null, ini_get('mysqli.default_port')); + mysqli_select_db($link, $db); + if (!$res = mysqli_query($link, "SELECT 'have been set' AS all_defaults")) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + mysqli_close($link); + } catch (mysqli_sql_exception $e) { + printf("%s\n", $e->getMessage()); + printf("[014] Usage of mysqli_connect() has failed\n"); + } + + try { + $link = mysqli_connect($host, $user, $passwd, null); + mysqli_select_db($link, $db); + if (!$res = mysqli_query($link, "SELECT 'have been set' AS all_defaults")) + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + mysqli_close($link); + } catch (mysqli_sql_exception $e) { + printf("%s\n", $e->getMessage()); + printf("[016] Usage of mysqli_connect() has failed\n"); + } + + + print "done!"; ?> --EXPECT-- array(1) { diff --git a/ext/mysqli/tests/mysqli_connect_oo_warnings.phpt b/ext/mysqli/tests/mysqli_connect_oo_warnings.phpt index 8204d0f1da..5b410b746b 100644 --- a/ext/mysqli/tests/mysqli_connect_oo_warnings.phpt +++ b/ext/mysqli/tests/mysqli_connect_oo_warnings.phpt @@ -12,34 +12,34 @@ new mysqli() ?> --FILE-- <?php - require_once("connect.inc"); - - $myhost = 'invalidhost'; - $link = NULL; - - print "1) bail\n"; - if (!is_object($mysqli = new mysqli($myhost)) || ('mysqli' !== get_class($mysqli))) - printf("[001] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli); - - print "2) be quiet\n"; - if (!is_object($mysqli = @new mysqli($myhost)) || ('mysqli' !== get_class($mysqli))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli); - var_dump(mysqli_connect_error()); - var_dump(mysqli_connect_errno()); - - print "3) bail\n"; - if (false !== ($link = mysqli_connect($myhost))) { - printf("[003] Expecting boolean/false, got %s/%s\n", gettype($link), $link); - } - - print "4) be quiet\n"; - if (false !== ($link = @mysqli_connect($myhost))) { - printf("[004] Expecting boolean/false, got %s/%s\n", gettype($link), $link); - } - var_dump(mysqli_connect_error()); - var_dump(mysqli_connect_errno()); - - print "done!"; + require_once("connect.inc"); + + $myhost = 'invalidhost'; + $link = NULL; + + print "1) bail\n"; + if (!is_object($mysqli = new mysqli($myhost)) || ('mysqli' !== get_class($mysqli))) + printf("[001] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli); + + print "2) be quiet\n"; + if (!is_object($mysqli = @new mysqli($myhost)) || ('mysqli' !== get_class($mysqli))) + printf("[002] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli); + var_dump(mysqli_connect_error()); + var_dump(mysqli_connect_errno()); + + print "3) bail\n"; + if (false !== ($link = mysqli_connect($myhost))) { + printf("[003] Expecting boolean/false, got %s/%s\n", gettype($link), $link); + } + + print "4) be quiet\n"; + if (false !== ($link = @mysqli_connect($myhost))) { + printf("[004] Expecting boolean/false, got %s/%s\n", gettype($link), $link); + } + var_dump(mysqli_connect_error()); + var_dump(mysqli_connect_errno()); + + print "done!"; ?> --EXPECTF-- 1) bail diff --git a/ext/mysqli/tests/mysqli_connect_twice.phpt b/ext/mysqli/tests/mysqli_connect_twice.phpt index c5ba7493c1..6fa6746537 100644 --- a/ext/mysqli/tests/mysqli_connect_twice.phpt +++ b/ext/mysqli/tests/mysqli_connect_twice.phpt @@ -8,69 +8,69 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!$thread_id = mysqli_thread_id($link)) - printf("[002] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$thread_id = mysqli_thread_id($link)) + printf("[002] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))) - printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))) + printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); - if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0)) - printf("[004] Expecting int/any got %s/%s\n", gettype($tmp), $tmp); + if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0)) + printf("[004] Expecting int/any got %s/%s\n", gettype($tmp), $tmp); - if ($thread_id == $new_thread_id) - printf("[005] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id); + if ($thread_id == $new_thread_id) + printf("[005] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id); - if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) || - !($row = mysqli_fetch_assoc($res))) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) || + !($row = mysqli_fetch_assoc($res))) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($row); - mysqli_free_result($res); + var_dump($row); + mysqli_free_result($res); - mysqli_close($link); + mysqli_close($link); - if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[007] 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 = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!$thread_id = $link->thread_id) - printf("[008] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$thread_id = $link->thread_id) + printf("[008] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket))) - printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket))) + printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); - if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0)) - printf("[010] Expecting int/any got %s/%s\n", gettype($tmp), $tmp); + if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0)) + printf("[010] Expecting int/any got %s/%s\n", gettype($tmp), $tmp); - if ($thread_id == $new_thread_id) - printf("[011] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id); + if ($thread_id == $new_thread_id) + printf("[011] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id); - if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) || - !($row = $res->fetch_assoc())) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) || + !($row = $res->fetch_assoc())) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($row); - mysqli_free_result($res); + var_dump($row); + mysqli_free_result($res); - mysqli_close($link); + mysqli_close($link); - if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket))) - printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket))) + printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); - if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[014] 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 = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket))) - printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket))) + printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); - print "done!"; + print "done!"; ?> --EXPECT-- array(1) { diff --git a/ext/mysqli/tests/mysqli_constants.phpt b/ext/mysqli/tests/mysqli_constants.phpt index 1994a5ec96..b281a9c9c5 100644 --- a/ext/mysqli/tests/mysqli_constants.phpt +++ b/ext/mysqli/tests/mysqli_constants.phpt @@ -10,234 +10,234 @@ require_once('skipifconnectfailure.inc'); mysqli.allow_local_infile=1 --FILE-- <?php - require("connect.inc"); - require("table.inc"); - - $php_version = (int)str_replace('.', '', PHP_VERSION); - $constants = get_defined_constants(true); - sort($constants); - - $expected_constants = array( - 'MYSQLI_READ_DEFAULT_GROUP' => true, - 'MYSQLI_READ_DEFAULT_FILE' => true, - 'MYSQLI_OPT_CONNECT_TIMEOUT' => true, - 'MYSQLI_OPT_LOCAL_INFILE' => true, - 'MYSQLI_OPT_READ_TIMEOUT' => true, - 'MYSQLI_INIT_COMMAND' => true, - 'MYSQLI_CLIENT_SSL' => true, - "MYSQLI_CLIENT_COMPRESS" => true, - "MYSQLI_CLIENT_INTERACTIVE" => true, - "MYSQLI_CLIENT_IGNORE_SPACE" => true, - "MYSQLI_CLIENT_NO_SCHEMA" => true, - "MYSQLI_CLIENT_FOUND_ROWS" => true, - "MYSQLI_STORE_RESULT" => true, - "MYSQLI_USE_RESULT" => true, - "MYSQLI_ASSOC" => true, - "MYSQLI_NUM" => true, - "MYSQLI_BOTH" => true, - "MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH"=> true, - "MYSQLI_NOT_NULL_FLAG" => true, - "MYSQLI_PRI_KEY_FLAG" => true, - "MYSQLI_UNIQUE_KEY_FLAG" => true, - "MYSQLI_MULTIPLE_KEY_FLAG" => true, - "MYSQLI_BLOB_FLAG" => true, - "MYSQLI_UNSIGNED_FLAG" => true, - "MYSQLI_ZEROFILL_FLAG" => true, - "MYSQLI_AUTO_INCREMENT_FLAG" => true, - "MYSQLI_TIMESTAMP_FLAG" => true, - "MYSQLI_SET_FLAG" => true, - "MYSQLI_NUM_FLAG" => true, - "MYSQLI_ENUM_FLAG" => true, - "MYSQLI_BINARY_FLAG" => true, - "MYSQLI_PART_KEY_FLAG" => true, - "MYSQLI_GROUP_FLAG" => true, - "MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED"=> true, - "MYSQLI_SERVER_QUERY_NO_INDEX_USED" => true, - - "MYSQLI_TYPE_DECIMAL" => true, - "MYSQLI_TYPE_TINY" => true, - "MYSQLI_TYPE_SHORT" => true, - "MYSQLI_TYPE_LONG" => true, - "MYSQLI_TYPE_FLOAT" => true, - "MYSQLI_TYPE_DOUBLE" => true, - "MYSQLI_TYPE_NULL" => true, - "MYSQLI_TYPE_TIMESTAMP" => true, - "MYSQLI_TYPE_LONGLONG" => true, - "MYSQLI_TYPE_INT24" => true, - "MYSQLI_TYPE_DATE" => true, - "MYSQLI_TYPE_TIME" => true, - "MYSQLI_TYPE_DATETIME" => true, - "MYSQLI_TYPE_YEAR" => true, - "MYSQLI_TYPE_NEWDATE" => true, - "MYSQLI_TYPE_ENUM" => true, - "MYSQLI_TYPE_SET" => true, - "MYSQLI_TYPE_TINY_BLOB" => true, - "MYSQLI_TYPE_MEDIUM_BLOB" => true, - "MYSQLI_TYPE_LONG_BLOB" => true, - "MYSQLI_TYPE_BLOB" => true, - "MYSQLI_TYPE_VAR_STRING" => true, - "MYSQLI_TYPE_STRING" => true, - "MYSQLI_TYPE_CHAR" => true, - "MYSQLI_TYPE_INTERVAL" => true, - "MYSQLI_TYPE_GEOMETRY" => true, - "MYSQLI_NO_DATA" => true, - "MYSQLI_REPORT_INDEX" => true, - "MYSQLI_REPORT_STRICT" => true, - "MYSQLI_REPORT_ALL" => true, - "MYSQLI_REPORT_ERROR" => true, - "MYSQLI_REPORT_OFF" => true, - "MYSQLI_SET_CHARSET_NAME" => true, - "MYSQLI_SET_CHARSET_DIR" => true, - "MYSQLI_REFRESH_GRANT" => true, - "MYSQLI_REFRESH_LOG" => true, - "MYSQLI_REFRESH_TABLES" => true, - "MYSQLI_REFRESH_HOSTS" => true, - "MYSQLI_REFRESH_STATUS" => true, - "MYSQLI_REFRESH_THREADS" => true, - "MYSQLI_REFRESH_SLAVE" => true, - "MYSQLI_REFRESH_MASTER" => true, - "MYSQLI_DEBUG_TRACE_ENABLED" => true, - "MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT" => true, - "MYSQLI_TRANS_START_READ_WRITE" => true, - "MYSQLI_TRANS_START_READ_ONLY" => true, - "MYSQLI_TRANS_COR_AND_CHAIN" => true, - "MYSQLI_TRANS_COR_AND_NO_CHAIN" => true, - "MYSQLI_TRANS_COR_RELEASE" => true, - "MYSQLI_TRANS_COR_NO_RELEASE" => true, - ); - - /* depends on the build - experimental */ - if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) { - $expected_constants['MYSQLI_OPT_INT_AND_FLOAT_NATIVE'] = true; - } - - if ($IS_MYSQLND && defined('MYSQLI_STORE_RESULT_COPY_DATA')) { - $expected_constants['MYSQLI_STORE_RESULT_COPY_DATA'] = true; - } - - if ($IS_MYSQLND || defined('MYSQLI_REFRESH_BACKUP_LOG')) { - $expected_constants['MYSQLI_REFRESH_BACKUP_LOG'] = true; - } - - if ($IS_MYSQLND) { - $version = 50007 + 1; - $expected_constants['MYSQLI_OPT_NET_CMD_BUFFER_SIZE'] = true; - $expected_constants['MYSQLI_OPT_NET_READ_BUFFER_SIZE'] = true; - $expected_constants['MYSQLI_ASYNC'] = true; - - $expected_constants['MYSQLI_SERVER_PS_OUT_PARAMS'] = true; - } else { - $version = mysqli_get_client_version(); - } - - if (($version > 51122 && $version < 60000) || ($version > 60003) || $IS_MYSQLND) { - $expected_constants['MYSQLI_ON_UPDATE_NOW_FLAG'] = true; - } - - /* First introduced in MySQL 6.0, backported to MySQL 5.5 */ - if ($version >= 50500 || $IS_MYSQLND) { - $expected_constants['MYSQLI_SERVER_QUERY_WAS_SLOW'] = true; - } - - if ($version >= 50033 || $IS_MYSQLND) { - $expected_constants['MYSQLI_CLIENT_SSL_VERIFY_SERVER_CERT'] = true; - } - if ($IS_MYSQLND) { - $expected_constants['MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'] = true; - } - - /* First introduced in MySQL 6.0, backported to MySQL 5.5 */ - if ($version >= 50606 || $IS_MYSQLND) { - $expected_constants['MYSQLI_SERVER_PUBLIC_KEY'] = true; - } - - if ($version > 50002) { - $expected_constants = array_merge($expected_constants, array( - "MYSQLI_TYPE_NEWDECIMAL" => true, - "MYSQLI_TYPE_BIT" => true, - )); - } - - if ($version > 50002 || $IS_MYSQLND) { - $expected_constants['MYSQLI_NO_DEFAULT_VALUE_FLAG'] = true; - } - - if ($version > 50003) { - $expected_constants = array_merge($expected_constants, array( - "MYSQLI_STMT_ATTR_CURSOR_TYPE" => true, - "MYSQLI_CURSOR_TYPE_NO_CURSOR" => true, - "MYSQLI_CURSOR_TYPE_READ_ONLY" => true, - "MYSQLI_CURSOR_TYPE_FOR_UPDATE" => true, - "MYSQLI_CURSOR_TYPE_SCROLLABLE" => true, - )); - } - - if ($version > 50007) { - $expected_constants = array_merge($expected_constants, array( - "MYSQLI_STMT_ATTR_PREFETCH_ROWS" => true, - )); - } - - if ($version > 50110 || $IS_MYSQLND) { - $expected_constants['MYSQLI_OPT_SSL_VERIFY_SERVER_CERT'] = true; - } - - /* pretty dump test, but that is the best way to mimic mysql.c */ - if (defined('MYSQLI_DATA_TRUNCATED')) - $expected_constants["MYSQLI_DATA_TRUNCATED"] = true; - - if (defined('MYSQLI_SERVER_PS_OUT_PARAMS')) - $expected_constants["MYSQLI_SERVER_PS_OUT_PARAMS"] = true; - - if (!$IS_MYSQLND) { - /* libmysql only */ - - /* are they available in all versions of ext/mysqli ? - ... no we must have removed them at some point - for BC, weakening the test - */ - if (defined("MYSQLI_RPL_MASTER")) { - $expected_constants["MYSQLI_RPL_MASTER"] = true; - $expected_constants["MYSQLI_RPL_SLAVE"] = true; - $expected_constants["MYSQLI_RPL_ADMIN"] = true; - } - } - - if ($IS_MYSQLND || (!$IS_MYSQLND && ($version > 50610))) { - /* could be that MySQL/libmysql 5.6.9 had the flag already but it was no stable release */ - $expected_constants["MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true; - $expected_constants["MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true; - } - - if ($IS_MYSQLND) { - $expected_constants["MYSQLI_TYPE_JSON"] = true; - } - - $unexpected_constants = array(); - - foreach ($constants as $group => $consts) { - foreach ($consts as $name => $value) { - if (stristr($name, 'mysqli')) { - $name = strtoupper($name); - if (isset($expected_constants[$name])) { - unset($expected_constants[$name]); - } else { - $unexpected_constants[$name] = $name; - } - } - } - } - - if (!empty($unexpected_constants)) { - printf("Dumping list of unexpected constants\n"); - var_dump($unexpected_constants); - } - - if (!empty($expected_constants)) { - printf("Dumping list of missing constants\n"); - var_dump($expected_constants); - } - - print "done!"; + require("connect.inc"); + require("table.inc"); + + $php_version = (int)str_replace('.', '', PHP_VERSION); + $constants = get_defined_constants(true); + sort($constants); + + $expected_constants = array( + 'MYSQLI_READ_DEFAULT_GROUP' => true, + 'MYSQLI_READ_DEFAULT_FILE' => true, + 'MYSQLI_OPT_CONNECT_TIMEOUT' => true, + 'MYSQLI_OPT_LOCAL_INFILE' => true, + 'MYSQLI_OPT_READ_TIMEOUT' => true, + 'MYSQLI_INIT_COMMAND' => true, + 'MYSQLI_CLIENT_SSL' => true, + "MYSQLI_CLIENT_COMPRESS" => true, + "MYSQLI_CLIENT_INTERACTIVE" => true, + "MYSQLI_CLIENT_IGNORE_SPACE" => true, + "MYSQLI_CLIENT_NO_SCHEMA" => true, + "MYSQLI_CLIENT_FOUND_ROWS" => true, + "MYSQLI_STORE_RESULT" => true, + "MYSQLI_USE_RESULT" => true, + "MYSQLI_ASSOC" => true, + "MYSQLI_NUM" => true, + "MYSQLI_BOTH" => true, + "MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH"=> true, + "MYSQLI_NOT_NULL_FLAG" => true, + "MYSQLI_PRI_KEY_FLAG" => true, + "MYSQLI_UNIQUE_KEY_FLAG" => true, + "MYSQLI_MULTIPLE_KEY_FLAG" => true, + "MYSQLI_BLOB_FLAG" => true, + "MYSQLI_UNSIGNED_FLAG" => true, + "MYSQLI_ZEROFILL_FLAG" => true, + "MYSQLI_AUTO_INCREMENT_FLAG" => true, + "MYSQLI_TIMESTAMP_FLAG" => true, + "MYSQLI_SET_FLAG" => true, + "MYSQLI_NUM_FLAG" => true, + "MYSQLI_ENUM_FLAG" => true, + "MYSQLI_BINARY_FLAG" => true, + "MYSQLI_PART_KEY_FLAG" => true, + "MYSQLI_GROUP_FLAG" => true, + "MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED"=> true, + "MYSQLI_SERVER_QUERY_NO_INDEX_USED" => true, + + "MYSQLI_TYPE_DECIMAL" => true, + "MYSQLI_TYPE_TINY" => true, + "MYSQLI_TYPE_SHORT" => true, + "MYSQLI_TYPE_LONG" => true, + "MYSQLI_TYPE_FLOAT" => true, + "MYSQLI_TYPE_DOUBLE" => true, + "MYSQLI_TYPE_NULL" => true, + "MYSQLI_TYPE_TIMESTAMP" => true, + "MYSQLI_TYPE_LONGLONG" => true, + "MYSQLI_TYPE_INT24" => true, + "MYSQLI_TYPE_DATE" => true, + "MYSQLI_TYPE_TIME" => true, + "MYSQLI_TYPE_DATETIME" => true, + "MYSQLI_TYPE_YEAR" => true, + "MYSQLI_TYPE_NEWDATE" => true, + "MYSQLI_TYPE_ENUM" => true, + "MYSQLI_TYPE_SET" => true, + "MYSQLI_TYPE_TINY_BLOB" => true, + "MYSQLI_TYPE_MEDIUM_BLOB" => true, + "MYSQLI_TYPE_LONG_BLOB" => true, + "MYSQLI_TYPE_BLOB" => true, + "MYSQLI_TYPE_VAR_STRING" => true, + "MYSQLI_TYPE_STRING" => true, + "MYSQLI_TYPE_CHAR" => true, + "MYSQLI_TYPE_INTERVAL" => true, + "MYSQLI_TYPE_GEOMETRY" => true, + "MYSQLI_NO_DATA" => true, + "MYSQLI_REPORT_INDEX" => true, + "MYSQLI_REPORT_STRICT" => true, + "MYSQLI_REPORT_ALL" => true, + "MYSQLI_REPORT_ERROR" => true, + "MYSQLI_REPORT_OFF" => true, + "MYSQLI_SET_CHARSET_NAME" => true, + "MYSQLI_SET_CHARSET_DIR" => true, + "MYSQLI_REFRESH_GRANT" => true, + "MYSQLI_REFRESH_LOG" => true, + "MYSQLI_REFRESH_TABLES" => true, + "MYSQLI_REFRESH_HOSTS" => true, + "MYSQLI_REFRESH_STATUS" => true, + "MYSQLI_REFRESH_THREADS" => true, + "MYSQLI_REFRESH_SLAVE" => true, + "MYSQLI_REFRESH_MASTER" => true, + "MYSQLI_DEBUG_TRACE_ENABLED" => true, + "MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT" => true, + "MYSQLI_TRANS_START_READ_WRITE" => true, + "MYSQLI_TRANS_START_READ_ONLY" => true, + "MYSQLI_TRANS_COR_AND_CHAIN" => true, + "MYSQLI_TRANS_COR_AND_NO_CHAIN" => true, + "MYSQLI_TRANS_COR_RELEASE" => true, + "MYSQLI_TRANS_COR_NO_RELEASE" => true, + ); + + /* depends on the build - experimental */ + if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) { + $expected_constants['MYSQLI_OPT_INT_AND_FLOAT_NATIVE'] = true; + } + + if ($IS_MYSQLND && defined('MYSQLI_STORE_RESULT_COPY_DATA')) { + $expected_constants['MYSQLI_STORE_RESULT_COPY_DATA'] = true; + } + + if ($IS_MYSQLND || defined('MYSQLI_REFRESH_BACKUP_LOG')) { + $expected_constants['MYSQLI_REFRESH_BACKUP_LOG'] = true; + } + + if ($IS_MYSQLND) { + $version = 50007 + 1; + $expected_constants['MYSQLI_OPT_NET_CMD_BUFFER_SIZE'] = true; + $expected_constants['MYSQLI_OPT_NET_READ_BUFFER_SIZE'] = true; + $expected_constants['MYSQLI_ASYNC'] = true; + + $expected_constants['MYSQLI_SERVER_PS_OUT_PARAMS'] = true; + } else { + $version = mysqli_get_client_version(); + } + + if (($version > 51122 && $version < 60000) || ($version > 60003) || $IS_MYSQLND) { + $expected_constants['MYSQLI_ON_UPDATE_NOW_FLAG'] = true; + } + + /* First introduced in MySQL 6.0, backported to MySQL 5.5 */ + if ($version >= 50500 || $IS_MYSQLND) { + $expected_constants['MYSQLI_SERVER_QUERY_WAS_SLOW'] = true; + } + + if ($version >= 50033 || $IS_MYSQLND) { + $expected_constants['MYSQLI_CLIENT_SSL_VERIFY_SERVER_CERT'] = true; + } + if ($IS_MYSQLND) { + $expected_constants['MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'] = true; + } + + /* First introduced in MySQL 6.0, backported to MySQL 5.5 */ + if ($version >= 50606 || $IS_MYSQLND) { + $expected_constants['MYSQLI_SERVER_PUBLIC_KEY'] = true; + } + + if ($version > 50002) { + $expected_constants = array_merge($expected_constants, array( + "MYSQLI_TYPE_NEWDECIMAL" => true, + "MYSQLI_TYPE_BIT" => true, + )); + } + + if ($version > 50002 || $IS_MYSQLND) { + $expected_constants['MYSQLI_NO_DEFAULT_VALUE_FLAG'] = true; + } + + if ($version > 50003) { + $expected_constants = array_merge($expected_constants, array( + "MYSQLI_STMT_ATTR_CURSOR_TYPE" => true, + "MYSQLI_CURSOR_TYPE_NO_CURSOR" => true, + "MYSQLI_CURSOR_TYPE_READ_ONLY" => true, + "MYSQLI_CURSOR_TYPE_FOR_UPDATE" => true, + "MYSQLI_CURSOR_TYPE_SCROLLABLE" => true, + )); + } + + if ($version > 50007) { + $expected_constants = array_merge($expected_constants, array( + "MYSQLI_STMT_ATTR_PREFETCH_ROWS" => true, + )); + } + + if ($version > 50110 || $IS_MYSQLND) { + $expected_constants['MYSQLI_OPT_SSL_VERIFY_SERVER_CERT'] = true; + } + + /* pretty dump test, but that is the best way to mimic mysql.c */ + if (defined('MYSQLI_DATA_TRUNCATED')) + $expected_constants["MYSQLI_DATA_TRUNCATED"] = true; + + if (defined('MYSQLI_SERVER_PS_OUT_PARAMS')) + $expected_constants["MYSQLI_SERVER_PS_OUT_PARAMS"] = true; + + if (!$IS_MYSQLND) { + /* libmysql only */ + + /* are they available in all versions of ext/mysqli ? + ... no we must have removed them at some point - for BC, weakening the test + */ + if (defined("MYSQLI_RPL_MASTER")) { + $expected_constants["MYSQLI_RPL_MASTER"] = true; + $expected_constants["MYSQLI_RPL_SLAVE"] = true; + $expected_constants["MYSQLI_RPL_ADMIN"] = true; + } + } + + if ($IS_MYSQLND || (!$IS_MYSQLND && ($version > 50610))) { + /* could be that MySQL/libmysql 5.6.9 had the flag already but it was no stable release */ + $expected_constants["MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true; + $expected_constants["MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true; + } + + if ($IS_MYSQLND) { + $expected_constants["MYSQLI_TYPE_JSON"] = true; + } + + $unexpected_constants = array(); + + foreach ($constants as $group => $consts) { + foreach ($consts as $name => $value) { + if (stristr($name, 'mysqli')) { + $name = strtoupper($name); + if (isset($expected_constants[$name])) { + unset($expected_constants[$name]); + } else { + $unexpected_constants[$name] = $name; + } + } + } + } + + if (!empty($unexpected_constants)) { + printf("Dumping list of unexpected constants\n"); + var_dump($unexpected_constants); + } + + if (!empty($expected_constants)) { + printf("Dumping list of missing constants\n"); + var_dump($expected_constants); + } + + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_constants_categories.phpt b/ext/mysqli/tests/mysqli_constants_categories.phpt index 6a90e3d3f0..d02463e20a 100644 --- a/ext/mysqli/tests/mysqli_constants_categories.phpt +++ b/ext/mysqli/tests/mysqli_constants_categories.phpt @@ -7,18 +7,18 @@ require_once('skipifemb.inc'); ?> --FILE-- <?php - $constants = get_defined_constants(true); + $constants = get_defined_constants(true); - foreach ($constants as $group => $consts) { - foreach ($consts as $name => $value) { - if (stristr($name, 'mysqli')) { - if ('mysqli' != $group) - printf("found constant '%s' in group '%s'. expecting group 'mysqli'\n", $name, $group); - } - } - } + foreach ($constants as $group => $consts) { + foreach ($consts as $name => $value) { + if (stristr($name, 'mysqli')) { + if ('mysqli' != $group) + printf("found constant '%s' in group '%s'. expecting group 'mysqli'\n", $name, $group); + } + } + } - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_data_seek.phpt b/ext/mysqli/tests/mysqli_data_seek.phpt index b97cf717fa..53c8b8354d 100644 --- a/ext/mysqli/tests/mysqli_data_seek.phpt +++ b/ext/mysqli/tests/mysqli_data_seek.phpt @@ -8,41 +8,41 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); - if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT)) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + require('table.inc'); + if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT)) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (true !== ($tmp = mysqli_data_seek($res, 3))) - printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_data_seek($res, 3))) + printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - $row = mysqli_fetch_assoc($res); - if (4 != $row['id']) - printf("[006] Expecting record 4/d, got record %s/%s\n", $row['id'], $row['label']); + $row = mysqli_fetch_assoc($res); + if (4 != $row['id']) + printf("[006] Expecting record 4/d, got record %s/%s\n", $row['id'], $row['label']); - if (true !== ($tmp = mysqli_data_seek($res, 0))) - printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_data_seek($res, 0))) + printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - $row = mysqli_fetch_assoc($res); - if (1 != $row['id']) - printf("[008] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']); + $row = mysqli_fetch_assoc($res); + if (1 != $row['id']) + printf("[008] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']); - if (false !== ($tmp = mysqli_data_seek($res, 4))) - printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_data_seek($res, 4))) + printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_data_seek($res, -1))) - printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_data_seek($res, -1))) + printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - mysqli_free_result($res); + mysqli_free_result($res); - if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id', MYSQLI_USE_RESULT)) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id', MYSQLI_USE_RESULT)) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_data_seek($res, 3))) - printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_data_seek($res, 3))) + printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - mysqli_free_result($res); + mysqli_free_result($res); try { mysqli_data_seek($res, 1); @@ -50,9 +50,9 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_data_seek_oo.phpt b/ext/mysqli/tests/mysqli_data_seek_oo.phpt index 0a2717b160..0d1ee8b79f 100644 --- a/ext/mysqli/tests/mysqli_data_seek_oo.phpt +++ b/ext/mysqli/tests/mysqli_data_seek_oo.phpt @@ -8,14 +8,14 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - require('table.inc'); + require_once("connect.inc"); + require('table.inc'); - if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - $res = new mysqli_result($mysqli); + $res = new mysqli_result($mysqli); try { $res->data_seek(0); @@ -23,38 +23,38 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (true !== ($tmp = $res->data_seek(3))) - printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = $res->data_seek(3))) + printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - $row = $res->fetch_assoc(); - if (4 != $row['id']) - printf("[008] Expecting record 4/d, got record %s/%s\n", $row['id'], $row['label']); + $row = $res->fetch_assoc(); + if (4 != $row['id']) + printf("[008] Expecting record 4/d, got record %s/%s\n", $row['id'], $row['label']); - if (true !== ($tmp = $res->data_seek(0))) - printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = $res->data_seek(0))) + printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - $row = $res->fetch_assoc(); - if (1 != $row['id']) - printf("[010] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']); + $row = $res->fetch_assoc(); + if (1 != $row['id']) + printf("[010] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']); - if (false !== ($tmp = $res->data_seek(4))) - printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = $res->data_seek(4))) + printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = $res->data_seek(-1))) - printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = $res->data_seek(-1))) + printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - $res->free_result(); + $res->free_result(); - if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id', MYSQLI_USE_RESULT)) - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id', MYSQLI_USE_RESULT)) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = $res->data_seek(3))) - printf("[014] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = $res->data_seek(3))) + printf("[014] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - $res->free_result(); + $res->free_result(); try { $res->data_seek(1); @@ -62,9 +62,9 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - $mysqli->close(); + $mysqli->close(); - print "done!"; + print "done!"; --CLEAN-- <?php require_once("clean_table.inc"); diff --git a/ext/mysqli/tests/mysqli_debug.phpt b/ext/mysqli/tests/mysqli_debug.phpt index 478dcf7d08..c701d765c2 100644 --- a/ext/mysqli/tests/mysqli_debug.phpt +++ b/ext/mysqli/tests/mysqli_debug.phpt @@ -17,46 +17,46 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) ?> --FILE-- <?php - require_once('connect.inc'); + require_once('connect.inc'); - // NOTE: documentation is not clear on this: function always return NULL or TRUE - if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir())))) - printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + // NOTE: documentation is not clear on this: function always return NULL or TRUE + if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir())))) + printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if ($IS_MYSQLND) { - // let's make this mysqlnd only - for libmysql we need debug installation + if ($IS_MYSQLND) { + // let's make this mysqlnd only - for libmysql we need debug installation - // table.inc will create a database connection and run some SQL queries, therefore - // the debug file should have entries - require_once('table.inc'); + // table.inc will create a database connection and run some SQL queries, therefore + // the debug file should have entries + require_once('table.inc'); - clearstatcache(); - $trace_file = sprintf('%s/mysqli_debug_phpt.trace', sys_get_temp_dir()); - if (!file_exists($trace_file)) - printf("[003] Trace file '%s' has not been created\n", $trace_file); - if (filesize($trace_file) < 50) - printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n", - $trace_file, - filesize($trace_file)); + clearstatcache(); + $trace_file = sprintf('%s/mysqli_debug_phpt.trace', sys_get_temp_dir()); + if (!file_exists($trace_file)) + printf("[003] Trace file '%s' has not been created\n", $trace_file); + if (filesize($trace_file) < 50) + printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n", + $trace_file, + filesize($trace_file)); - // will mysqli_debug() mind if the trace file gets removed? - unlink($trace_file); - clearstatcache(); + // will mysqli_debug() mind if the trace file gets removed? + unlink($trace_file); + clearstatcache(); - if (!$res = mysqli_query($link, 'SELECT * FROM test')) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - else - mysqli_free_result($res); + if (!$res = mysqli_query($link, 'SELECT * FROM test')) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + else + mysqli_free_result($res); - mysqli_close($link); + mysqli_close($link); - clearstatcache(); - if (!file_exists($trace_file)) - printf("[006] Trace file '%s' does not exist\n", $trace_file); - unlink($trace_file); - } + clearstatcache(); + if (!file_exists($trace_file)) + printf("[006] Trace file '%s' does not exist\n", $trace_file); + unlink($trace_file); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_debug_append.phpt b/ext/mysqli/tests/mysqli_debug_append.phpt index 8c934eabac..e75639e89d 100644 --- a/ext/mysqli/tests/mysqli_debug_append.phpt +++ b/ext/mysqli/tests/mysqli_debug_append.phpt @@ -22,70 +22,70 @@ if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test is not for Windows platfo ?> --FILE-- <?php - require_once('connect.inc'); - - if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir())))) - printf("[001] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - // table.inc will create a database connection and run some SQL queries, therefore - // the debug file should have entries - require_once('table.inc'); - - clearstatcache(); - $trace_file = sprintf('%s/mysqli_debug_phpt.trace', sys_get_temp_dir()); - if (!file_exists($trace_file)) - printf("[002] Trace file '%s' has not been created\n", $trace_file); - if (filesize($trace_file) < 50) - printf("[003] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n", - $trace_file, - filesize($trace_file)); - - // will mysqli_debug() mind if the trace file gets removed? - unlink($trace_file); - clearstatcache(); - - if (!$fp = fopen($trace_file, 'w')) { - printf("[004] Cannot create trace file to test append mode\n"); - } else { - - if (!fwrite($fp, 'mysqli_debug.phpt test line')) - printf("[005] Cannot write to trace file.\n"); - fclose($fp); - - if (true !== ($tmp = mysqli_debug(sprintf('d:a,%s', $trace_file)))) - printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (!$res = mysqli_query($link, 'SELECT * FROM test')) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - else - mysqli_free_result($res); - - $trace = file_get_contents($trace_file); - if (!strstr($trace, 'mysqli_debug.phpt test line')) - printf("[008] Cannot find original file content any more. Seems that the trace file got overwritten and not appended. Please check."); - - if (true !== ($tmp = mysqli_debug(sprintf('d:A,%s', $trace_file)))) - printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (!$res = mysqli_query($link, 'SELECT * FROM test')) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - else - mysqli_free_result($res); - - if (!strstr(file_get_contents($trace_file), $trace)) - printf("[011] Cannot find original file content any more. Seems that the trace file got overwritten and not appended. Please check."); - } - - // what will happen if we create new trace entries...? - unlink($trace_file); - clearstatcache(); - if (file_exists($trace_file)) - printf("[012] Could not remove trace file '%s'.\n", $trace_file); - - mysqli_close($link); - print "done"; - if ($IS_MYSQLND) - print "libmysql/DBUG package prints some debug info here." + require_once('connect.inc'); + + if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir())))) + printf("[001] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + // table.inc will create a database connection and run some SQL queries, therefore + // the debug file should have entries + require_once('table.inc'); + + clearstatcache(); + $trace_file = sprintf('%s/mysqli_debug_phpt.trace', sys_get_temp_dir()); + if (!file_exists($trace_file)) + printf("[002] Trace file '%s' has not been created\n", $trace_file); + if (filesize($trace_file) < 50) + printf("[003] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n", + $trace_file, + filesize($trace_file)); + + // will mysqli_debug() mind if the trace file gets removed? + unlink($trace_file); + clearstatcache(); + + if (!$fp = fopen($trace_file, 'w')) { + printf("[004] Cannot create trace file to test append mode\n"); + } else { + + if (!fwrite($fp, 'mysqli_debug.phpt test line')) + printf("[005] Cannot write to trace file.\n"); + fclose($fp); + + if (true !== ($tmp = mysqli_debug(sprintf('d:a,%s', $trace_file)))) + printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (!$res = mysqli_query($link, 'SELECT * FROM test')) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + else + mysqli_free_result($res); + + $trace = file_get_contents($trace_file); + if (!strstr($trace, 'mysqli_debug.phpt test line')) + printf("[008] Cannot find original file content any more. Seems that the trace file got overwritten and not appended. Please check."); + + if (true !== ($tmp = mysqli_debug(sprintf('d:A,%s', $trace_file)))) + printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (!$res = mysqli_query($link, 'SELECT * FROM test')) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + else + mysqli_free_result($res); + + if (!strstr(file_get_contents($trace_file), $trace)) + printf("[011] Cannot find original file content any more. Seems that the trace file got overwritten and not appended. Please check."); + } + + // what will happen if we create new trace entries...? + unlink($trace_file); + clearstatcache(); + if (file_exists($trace_file)) + printf("[012] Could not remove trace file '%s'.\n", $trace_file); + + mysqli_close($link); + print "done"; + if ($IS_MYSQLND) + print "libmysql/DBUG package prints some debug info here." ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_debug_control_string.phpt b/ext/mysqli/tests/mysqli_debug_control_string.phpt index 42a802d81a..00994abd03 100644 --- a/ext/mysqli/tests/mysqli_debug_control_string.phpt +++ b/ext/mysqli/tests/mysqli_debug_control_string.phpt @@ -20,57 +20,57 @@ if (!$IS_MYSQLND) ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - function try_control_string($link, $control_string, $trace_file, $offset) { + function try_control_string($link, $control_string, $trace_file, $offset) { - if (true !== ($tmp = mysqli_debug($control_string))) { - printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n", - $offset + 1, - $control_string, - gettype($tmp), - $tmp); - return false; - } + if (true !== ($tmp = mysqli_debug($control_string))) { + printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n", + $offset + 1, + $control_string, + gettype($tmp), + $tmp); + return false; + } - if (!$res = mysqli_query($link, 'SELECT * FROM test')) { - printf("[%03d][control string '%s'] [%d] %s.\n", - $offset + 2, - $control_string, - mysqli_errno($link), - mysqli_error($link)); - return false; - } + if (!$res = mysqli_query($link, 'SELECT * FROM test')) { + printf("[%03d][control string '%s'] [%d] %s.\n", + $offset + 2, + $control_string, + mysqli_errno($link), + mysqli_error($link)); + return false; + } - clearstatcache(); - if (!file_exists($trace_file)) { - printf("[%03d][control string '%s'] Trace file has not been written.\n", - $offset + 3, - $control_string, - gettype($tmp), - $tmp); - return false; - } + clearstatcache(); + if (!file_exists($trace_file)) { + printf("[%03d][control string '%s'] Trace file has not been written.\n", + $offset + 3, + $control_string, + gettype($tmp), + $tmp); + return false; + } - unlink($trace_file); - } + unlink($trace_file); + } - $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace'); - try_control_string($link, 't:,,:o,' . $trace_file, $trace_file, 10); - try_control_string($link, ':' . chr(0) . 'A,' . $trace_file, $trace_file, 20); - try_control_string($link, 't:o,' . $trace_file . ':abc', $trace_file, 30); - try_control_string($link, 't:o,' . $trace_file . ':ABC,123:b', $trace_file, 40); - try_control_string($link, 't:ABC,123:b;:o,' . $trace_file, $trace_file, 50); - try_control_string($link, 't:A;BC,123:b;:o,' . $trace_file, $trace_file, 60); - try_control_string($link, 't:p:o,' . $trace_file, $trace_file, 70); - try_control_string($link, 't:p,1,,2:o,' . $trace_file, $trace_file, 80); - try_control_string($link, 't:z,1,,2:o,' . $trace_file, $trace_file, 90);# + $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace'); + try_control_string($link, 't:,,:o,' . $trace_file, $trace_file, 10); + try_control_string($link, ':' . chr(0) . 'A,' . $trace_file, $trace_file, 20); + try_control_string($link, 't:o,' . $trace_file . ':abc', $trace_file, 30); + try_control_string($link, 't:o,' . $trace_file . ':ABC,123:b', $trace_file, 40); + try_control_string($link, 't:ABC,123:b;:o,' . $trace_file, $trace_file, 50); + try_control_string($link, 't:A;BC,123:b;:o,' . $trace_file, $trace_file, 60); + try_control_string($link, 't:p:o,' . $trace_file, $trace_file, 70); + try_control_string($link, 't:p,1,,2:o,' . $trace_file, $trace_file, 80); + try_control_string($link, 't:z,1,,2:o,' . $trace_file, $trace_file, 90);# - mysqli_close($link); - print "done"; - if ($IS_MYSQLND) - print "libmysql/DBUG package prints some debug info here." + mysqli_close($link); + print "done"; + if ($IS_MYSQLND) + print "libmysql/DBUG package prints some debug info here." ?> --EXPECTF-- [023][control string '%s'] Trace file has not been written. diff --git a/ext/mysqli/tests/mysqli_debug_ini.phpt b/ext/mysqli/tests/mysqli_debug_ini.phpt index f1a37bf882..3416e9a9e2 100644 --- a/ext/mysqli/tests/mysqli_debug_ini.phpt +++ b/ext/mysqli/tests/mysqli_debug_ini.phpt @@ -29,24 +29,24 @@ else mysqlnd.debug="t:O,/tmp/mysqli_debug_phpt.trace" --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - var_dump(ini_get('mysqlnd.debug')); + var_dump(ini_get('mysqlnd.debug')); - $trace_file = '/tmp/mysqli_debug_phpt.trace'; - clearstatcache(); - if (!file_exists($trace_file)) - printf("[003] Trace file '%s' has not been created\n", $trace_file); - if (filesize($trace_file) < 50) - printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n", - $trace_file, - filesize($trace_file)); + $trace_file = '/tmp/mysqli_debug_phpt.trace'; + clearstatcache(); + if (!file_exists($trace_file)) + printf("[003] Trace file '%s' has not been created\n", $trace_file); + if (filesize($trace_file) < 50) + printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n", + $trace_file, + filesize($trace_file)); - mysqli_close($link); - unlink($trace_file); + mysqli_close($link); + unlink($trace_file); - print "done!"; + print "done!"; ?> --EXPECT-- string(32) "t:O,/tmp/mysqli_debug_phpt.trace" diff --git a/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt b/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt index 9999d84395..a18ee5e7d3 100644 --- a/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt +++ b/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt @@ -20,206 +20,206 @@ if (!$IS_MYSQLND) ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); - - function try_control_string($link, $control_string, $trace_file, $offset) { - - @unlink($trace_file); - if (true !== ($tmp = @mysqli_debug($control_string))) { - printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n", - $offset + 1, - $control_string, - gettype($tmp), - $tmp); - return false; - } - - if (!$res = mysqli_query($link, 'SELECT * FROM test')) { - printf("[%03d][control string '%s'] [%d] %s.\n", - $offset + 2, - $control_string, - mysqli_errno($link), - mysqli_error($link)); - return false; - } - while ($row = mysqli_fetch_assoc($res)) - ; - mysqli_free_result($res); - - clearstatcache(); - if (!file_exists($trace_file)) { - printf("[%03d][control string '%s'] Trace file has not been written.\n", - $offset + 3, - $control_string, - gettype($tmp), - $tmp); - return false; - } - - return trim(substr(file_get_contents($trace_file), 0, 100024)); - } - - $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace'); - - $trace = try_control_string($link, 't:O,' . $trace_file, $trace_file, 10); - if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query')) - printf("[015] SELECT query cannot be found in trace. Trace contents seems wrong.\n"); - - // T - gettimeofday() system call, system dependent format - // 16:57:03.350734 >mysql_real_query - $trace = try_control_string($link, 't:O,' . $trace_file . ':T', $trace_file, 20); - if (!preg_match('@^[012]{0,1}[0-9]{1}:[0-5]{0,1}[0-9]{1}:[0-5]{0,1}[0-9]{1}@ismU', $trace)) - printf("[025] Timestamp not found. One reason could be that the test is borked and does not recognize the format of the gettimeofday() system call. Check manually (and fix the test, if needed :-)). First characters from trace are '%s'\n", substr($trace, 0, 80)); - - // i - add PID of the current process - // currently PHP is not multi-threaded, so it should be save to test for the PID of this PHP process - if (false === ($pid = getmypid())) - $pid = "[\d]+"; - - $trace = try_control_string($link, 't:O,' . $trace_file . ':i', $trace_file, 30); - if (!preg_match("@^" . $pid . "*@ismU", $trace)) - printf("[035] Process ID has not been found, first characters from trace are '%s'\n", substr($trace, 0, 80)); - - // L - line numbers - $trace = try_control_string($link, 't:O,' . $trace_file . ':L', $trace_file, 40); - if (!preg_match("@^[\d]+@ismU", $trace)) - printf("[045] Line numbers have not been found, first characters from trace are '%s'\n", substr($trace, 0, 80)); - - // F - file name - $trace = try_control_string($link, 't:O,' . $trace_file . ':F', $trace_file, 50); - // hopefully we'll never see a file name that's not covered by this regular expression... - if (!preg_match("@^\s*[/\w\\\\d\.\-]+\.[ch]@ismU", $trace)) - printf("[055] File names seem to be missing, first characters from trace are '%s'\n", substr($trace, 0, 80)); - - // -n - print function nesting depth - $trace = try_control_string($link, 't:O,' . $trace_file . ':n', $trace_file, 60); - if (!preg_match("@^\d+:@ismU", $trace)) - printf("[065] Nesting level seem to be missing, first characters from trace are '%s'\n", substr($trace, 0, 80)); - - // -t,[N] - maximum nesting level - $trace = try_control_string($link, 't,1:n:O,' . $trace_file, $trace_file, 70); - $lines = explode("\n", $trace); - foreach ($lines as $k => $line) { - $line = trim($line); - if (!preg_match("@^(\d+):+@ismU", $line, $matches)) { - printf("[075] Nesting level seem to be missing, first characters from trace are '%s'\n", substr($line, 0, 80)); - } else { - if (!isset($matches[1]) || ((int)$matches[1] > 1)) { - printf("[076] Nesting level seem to be %d, should not be higher than 1, first characters from trace are '%s'\n", - $matches[1], - substr($line, 0, 80)); - } - } - } - - // omitting t - $trace = try_control_string($link, 'n:O,' . $trace_file, $trace_file, 80); - $lines = explode("\n", $trace); - foreach ($lines as $k => $line) { - $line = trim($line); - if (preg_match("@^[|\s]*>[\w]+@ism", $line, $matches)) { - printf("[085] Looks like a function call, but there should be none in the trace file, first characters from trace are '%s'\n", - substr($line, 0, 80)); - } - } - - // -f[,functions] - Limit debugger list to specified functions. Empty list -> all functions - $lines_all_funcs = explode("\n", try_control_string($link, 't:O,' . $trace_file, $trace_file, 90)); - $functions_all_funcs = array(); - foreach ($lines_all_funcs as $k => $line) { - $line = trim($line); - if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { - $functions_all_funcs[$matches[1]] = $matches[1]; - } - } - - $lines_trace = explode("\n", try_control_string($link, 't:f:O,' . $trace_file, $trace_file, 100)); - $functions_trace = array(); - foreach ($lines_trace as $k => $line) { - $line = trim($line); - if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { - $functions_trace[$matches[1]] = $matches[1]; - } - } - - $tmp = array_diff($functions_all_funcs, $functions_trace); - if (!empty($tmp)) { - printf("[105] Looks like not all functions are listed in the trace. Check manually, dumping diff."); - var_dump($tmp); - } - - // get two or three function names to play with... - $test_functions = array('simple' => array(), 'doubledot' => array()); - - foreach ($functions_all_funcs as $func) { - if (count($test_functions['simple']) < 2 && !strstr($func, '::')) - $test_functions['simple'][$func] = $func; - else if (count($test_functions['doubledot']) < 2 && strstr($func, '::')) - $test_functions['doubledot'][$func] = $func; - } - - $control_string = ''; - if ($func = reset($test_functions['simple'])) - $control_string .= sprintf('%s,', $func); - if ($func = reset($test_functions['doubledot'])) - $control_string .= sprintf('%s,', $func); - if ($func = next($test_functions['simple'])) - $control_string .= sprintf('%s,', $func); - if ($func = next($test_functions['doubledot'])) - $control_string .= sprintf('%s,', $func); - $control_string = sprintf('t:f,%s:O,%s', $control_string, $trace_file); - - $lines_trace = explode("\n", try_control_string($link, $control_string, $trace_file, 110)); - $functions_trace = array(); - foreach ($lines_trace as $k => $line) { - $line = trim($line); - if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { - $functions_trace[$matches[1]] = $matches[1]; - } - } - - foreach ($test_functions['simple'] as $func) - if (isset($functions_trace[$func])) { - unset($functions_trace[$func]); - unset($test_functions['simple'][$func]); - } - - foreach ($test_functions['doubledot'] as $func) - if (isset($functions_trace[$func])) { - unset($functions_trace[$func]); - unset($test_functions['doubledot'][$func]); - } - - if (!empty($functions_trace)) { - printf("[115] Dumping list of unexpected functions which should have not been shown when using control string '%s'.\n", - $control_string); - var_dump($functions_trace); - } - $tmp = array_merge($test_functions['doubledot'], $test_functions['simple']); - if (!empty($tmp)) { - printf("[116] Dumping list of functions which should have been shown when using control string '%s'.\n", - $control_string); - var_dump($tmp); - } - - if ($IS_MYSQLND) { - // mysqlnd only option - // m - trace memory allocations - $trace = try_control_string($link, 't:O,' . $trace_file . ':m', $trace_file, 120); - if (!preg_match("@^[|\s]*>\_mysqlnd_p?efree@ismU", $trace, $matches) && - !preg_match("@^[|\s]*>\_mysqlnd_p?emalloc@ismU", $trace, $matches)) { - printf("[125] Memory dump does neither contain _mysqlnd_pefree nor _mysqlnd_pemalloc calls - check manually.\n"); - var_dump($trace); - } - - } - - mysqli_close($link); - print "done"; - if ($IS_MYSQLND) - print "libmysql/DBUG package prints some debug info here."; - @unlink($trace_file); + require_once('connect.inc'); + require_once('table.inc'); + + function try_control_string($link, $control_string, $trace_file, $offset) { + + @unlink($trace_file); + if (true !== ($tmp = @mysqli_debug($control_string))) { + printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n", + $offset + 1, + $control_string, + gettype($tmp), + $tmp); + return false; + } + + if (!$res = mysqli_query($link, 'SELECT * FROM test')) { + printf("[%03d][control string '%s'] [%d] %s.\n", + $offset + 2, + $control_string, + mysqli_errno($link), + mysqli_error($link)); + return false; + } + while ($row = mysqli_fetch_assoc($res)) + ; + mysqli_free_result($res); + + clearstatcache(); + if (!file_exists($trace_file)) { + printf("[%03d][control string '%s'] Trace file has not been written.\n", + $offset + 3, + $control_string, + gettype($tmp), + $tmp); + return false; + } + + return trim(substr(file_get_contents($trace_file), 0, 100024)); + } + + $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace'); + + $trace = try_control_string($link, 't:O,' . $trace_file, $trace_file, 10); + if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query')) + printf("[015] SELECT query cannot be found in trace. Trace contents seems wrong.\n"); + + // T - gettimeofday() system call, system dependent format + // 16:57:03.350734 >mysql_real_query + $trace = try_control_string($link, 't:O,' . $trace_file . ':T', $trace_file, 20); + if (!preg_match('@^[012]{0,1}[0-9]{1}:[0-5]{0,1}[0-9]{1}:[0-5]{0,1}[0-9]{1}@ismU', $trace)) + printf("[025] Timestamp not found. One reason could be that the test is borked and does not recognize the format of the gettimeofday() system call. Check manually (and fix the test, if needed :-)). First characters from trace are '%s'\n", substr($trace, 0, 80)); + + // i - add PID of the current process + // currently PHP is not multi-threaded, so it should be save to test for the PID of this PHP process + if (false === ($pid = getmypid())) + $pid = "[\d]+"; + + $trace = try_control_string($link, 't:O,' . $trace_file . ':i', $trace_file, 30); + if (!preg_match("@^" . $pid . "*@ismU", $trace)) + printf("[035] Process ID has not been found, first characters from trace are '%s'\n", substr($trace, 0, 80)); + + // L - line numbers + $trace = try_control_string($link, 't:O,' . $trace_file . ':L', $trace_file, 40); + if (!preg_match("@^[\d]+@ismU", $trace)) + printf("[045] Line numbers have not been found, first characters from trace are '%s'\n", substr($trace, 0, 80)); + + // F - file name + $trace = try_control_string($link, 't:O,' . $trace_file . ':F', $trace_file, 50); + // hopefully we'll never see a file name that's not covered by this regular expression... + if (!preg_match("@^\s*[/\w\\\\d\.\-]+\.[ch]@ismU", $trace)) + printf("[055] File names seem to be missing, first characters from trace are '%s'\n", substr($trace, 0, 80)); + + // -n - print function nesting depth + $trace = try_control_string($link, 't:O,' . $trace_file . ':n', $trace_file, 60); + if (!preg_match("@^\d+:@ismU", $trace)) + printf("[065] Nesting level seem to be missing, first characters from trace are '%s'\n", substr($trace, 0, 80)); + + // -t,[N] - maximum nesting level + $trace = try_control_string($link, 't,1:n:O,' . $trace_file, $trace_file, 70); + $lines = explode("\n", $trace); + foreach ($lines as $k => $line) { + $line = trim($line); + if (!preg_match("@^(\d+):+@ismU", $line, $matches)) { + printf("[075] Nesting level seem to be missing, first characters from trace are '%s'\n", substr($line, 0, 80)); + } else { + if (!isset($matches[1]) || ((int)$matches[1] > 1)) { + printf("[076] Nesting level seem to be %d, should not be higher than 1, first characters from trace are '%s'\n", + $matches[1], + substr($line, 0, 80)); + } + } + } + + // omitting t + $trace = try_control_string($link, 'n:O,' . $trace_file, $trace_file, 80); + $lines = explode("\n", $trace); + foreach ($lines as $k => $line) { + $line = trim($line); + if (preg_match("@^[|\s]*>[\w]+@ism", $line, $matches)) { + printf("[085] Looks like a function call, but there should be none in the trace file, first characters from trace are '%s'\n", + substr($line, 0, 80)); + } + } + + // -f[,functions] - Limit debugger list to specified functions. Empty list -> all functions + $lines_all_funcs = explode("\n", try_control_string($link, 't:O,' . $trace_file, $trace_file, 90)); + $functions_all_funcs = array(); + foreach ($lines_all_funcs as $k => $line) { + $line = trim($line); + if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { + $functions_all_funcs[$matches[1]] = $matches[1]; + } + } + + $lines_trace = explode("\n", try_control_string($link, 't:f:O,' . $trace_file, $trace_file, 100)); + $functions_trace = array(); + foreach ($lines_trace as $k => $line) { + $line = trim($line); + if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { + $functions_trace[$matches[1]] = $matches[1]; + } + } + + $tmp = array_diff($functions_all_funcs, $functions_trace); + if (!empty($tmp)) { + printf("[105] Looks like not all functions are listed in the trace. Check manually, dumping diff."); + var_dump($tmp); + } + + // get two or three function names to play with... + $test_functions = array('simple' => array(), 'doubledot' => array()); + + foreach ($functions_all_funcs as $func) { + if (count($test_functions['simple']) < 2 && !strstr($func, '::')) + $test_functions['simple'][$func] = $func; + else if (count($test_functions['doubledot']) < 2 && strstr($func, '::')) + $test_functions['doubledot'][$func] = $func; + } + + $control_string = ''; + if ($func = reset($test_functions['simple'])) + $control_string .= sprintf('%s,', $func); + if ($func = reset($test_functions['doubledot'])) + $control_string .= sprintf('%s,', $func); + if ($func = next($test_functions['simple'])) + $control_string .= sprintf('%s,', $func); + if ($func = next($test_functions['doubledot'])) + $control_string .= sprintf('%s,', $func); + $control_string = sprintf('t:f,%s:O,%s', $control_string, $trace_file); + + $lines_trace = explode("\n", try_control_string($link, $control_string, $trace_file, 110)); + $functions_trace = array(); + foreach ($lines_trace as $k => $line) { + $line = trim($line); + if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { + $functions_trace[$matches[1]] = $matches[1]; + } + } + + foreach ($test_functions['simple'] as $func) + if (isset($functions_trace[$func])) { + unset($functions_trace[$func]); + unset($test_functions['simple'][$func]); + } + + foreach ($test_functions['doubledot'] as $func) + if (isset($functions_trace[$func])) { + unset($functions_trace[$func]); + unset($test_functions['doubledot'][$func]); + } + + if (!empty($functions_trace)) { + printf("[115] Dumping list of unexpected functions which should have not been shown when using control string '%s'.\n", + $control_string); + var_dump($functions_trace); + } + $tmp = array_merge($test_functions['doubledot'], $test_functions['simple']); + if (!empty($tmp)) { + printf("[116] Dumping list of functions which should have been shown when using control string '%s'.\n", + $control_string); + var_dump($tmp); + } + + if ($IS_MYSQLND) { + // mysqlnd only option + // m - trace memory allocations + $trace = try_control_string($link, 't:O,' . $trace_file . ':m', $trace_file, 120); + if (!preg_match("@^[|\s]*>\_mysqlnd_p?efree@ismU", $trace, $matches) && + !preg_match("@^[|\s]*>\_mysqlnd_p?emalloc@ismU", $trace, $matches)) { + printf("[125] Memory dump does neither contain _mysqlnd_pefree nor _mysqlnd_pemalloc calls - check manually.\n"); + var_dump($trace); + } + + } + + mysqli_close($link); + print "done"; + if ($IS_MYSQLND) + print "libmysql/DBUG package prints some debug info here."; + @unlink($trace_file); ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt b/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt index 333aaa10c0..a6d5d08146 100644 --- a/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt +++ b/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt @@ -21,108 +21,108 @@ if (!$IS_MYSQLND) ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); - - function try_control_string($link, $control_string, $trace_file, $offset) { - - @unlink($trace_file); - if (true !== ($tmp = @mysqli_debug($control_string))) { - printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n", - $offset + 1, - $control_string, - gettype($tmp), - $tmp); - return false; - } - - if (!$res = mysqli_query($link, 'SELECT * FROM test')) { - printf("[%03d][control string '%s'] [%d] %s.\n", - $offset + 2, - $control_string, - mysqli_errno($link), - mysqli_error($link)); - return false; - } - while ($row = mysqli_fetch_assoc($res)) - ; - mysqli_free_result($res); - - clearstatcache(); - if (!file_exists($trace_file)) { - printf("[%03d][control string '%s'] Trace file has not been written.\n", - $offset + 3, - $control_string, - gettype($tmp), - $tmp); - return false; - } - - return trim(substr(file_get_contents($trace_file), 0, 100024)); - } - - $memory_funcs = array( - '_mysqlnd_ecalloc', - '_mysqlnd_emalloc', - '_mysqlnd_palloc_free_thd_cache_reference', - '_mysqlnd_pecalloc', - '_mysqlnd_pefree', - '_mysqlnd_pemalloc', - '_mysqlnd_perealloc', - ); - $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace'); - - $trace = try_control_string($link, 't:m:O,' . $trace_file, $trace_file, 10); - if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query')) - printf("[015] SELECT query cannot be found in trace. Trace contents seems wrong.\n"); - - $lines_trace = explode("\n", $trace); - $functions_trace = array(); - foreach ($lines_trace as $k => $line) { - $line = trim($line); - if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { - $functions_trace[$matches[1]] = $matches[1]; - } - } - - $found = 0; - foreach ($memory_funcs as $k => $name) - if (isset($functions_trace[$name])) - $found++; - - if ($found < 1) { - printf("[016] Only %d memory functions have been found, expecting at least %d.\n", - $found, 1); - var_dump($trace); - } - - $trace = try_control_string($link, 't:O,' . $trace_file, $trace_file, 20); - if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query')) - printf("[025] SELECT query cannot be found in trace. Trace contents seems wrong.\n"); - - $lines_trace = explode("\n", $trace); - $functions_trace = array(); - foreach ($lines_trace as $k => $line) { - $line = trim($line); - if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { - $functions_trace[$matches[1]] = $matches[1]; - } - } - - $found = 0; - foreach ($memory_funcs as $k => $name) - if (isset($functions_trace[$name])) - $found++; - - if ($found > 2) { - printf("[026] More than %d memory functions have been recorded, that's strange.\n", - $found); - var_dump($trace); - } - - mysqli_close($link); - @unlink($trace_file); - print "done!"; + require_once('connect.inc'); + require_once('table.inc'); + + function try_control_string($link, $control_string, $trace_file, $offset) { + + @unlink($trace_file); + if (true !== ($tmp = @mysqli_debug($control_string))) { + printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n", + $offset + 1, + $control_string, + gettype($tmp), + $tmp); + return false; + } + + if (!$res = mysqli_query($link, 'SELECT * FROM test')) { + printf("[%03d][control string '%s'] [%d] %s.\n", + $offset + 2, + $control_string, + mysqli_errno($link), + mysqli_error($link)); + return false; + } + while ($row = mysqli_fetch_assoc($res)) + ; + mysqli_free_result($res); + + clearstatcache(); + if (!file_exists($trace_file)) { + printf("[%03d][control string '%s'] Trace file has not been written.\n", + $offset + 3, + $control_string, + gettype($tmp), + $tmp); + return false; + } + + return trim(substr(file_get_contents($trace_file), 0, 100024)); + } + + $memory_funcs = array( + '_mysqlnd_ecalloc', + '_mysqlnd_emalloc', + '_mysqlnd_palloc_free_thd_cache_reference', + '_mysqlnd_pecalloc', + '_mysqlnd_pefree', + '_mysqlnd_pemalloc', + '_mysqlnd_perealloc', + ); + $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace'); + + $trace = try_control_string($link, 't:m:O,' . $trace_file, $trace_file, 10); + if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query')) + printf("[015] SELECT query cannot be found in trace. Trace contents seems wrong.\n"); + + $lines_trace = explode("\n", $trace); + $functions_trace = array(); + foreach ($lines_trace as $k => $line) { + $line = trim($line); + if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { + $functions_trace[$matches[1]] = $matches[1]; + } + } + + $found = 0; + foreach ($memory_funcs as $k => $name) + if (isset($functions_trace[$name])) + $found++; + + if ($found < 1) { + printf("[016] Only %d memory functions have been found, expecting at least %d.\n", + $found, 1); + var_dump($trace); + } + + $trace = try_control_string($link, 't:O,' . $trace_file, $trace_file, 20); + if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query')) + printf("[025] SELECT query cannot be found in trace. Trace contents seems wrong.\n"); + + $lines_trace = explode("\n", $trace); + $functions_trace = array(); + foreach ($lines_trace as $k => $line) { + $line = trim($line); + if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { + $functions_trace[$matches[1]] = $matches[1]; + } + } + + $found = 0; + foreach ($memory_funcs as $k => $name) + if (isset($functions_trace[$name])) + $found++; + + if ($found > 2) { + printf("[026] More than %d memory functions have been recorded, that's strange.\n", + $found); + var_dump($trace); + } + + mysqli_close($link); + @unlink($trace_file); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt b/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt index 391940b12e..92b4e8fc27 100644 --- a/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt +++ b/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt @@ -12,31 +12,31 @@ if (!function_exists('mysqli_disable_reads_from_master')) { ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - if (NULL !== ($tmp = @mysqli_disable_reads_from_master())) - printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = @mysqli_disable_reads_from_master())) + printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - if (NULL !== ($tmp = @mysqli_disable_reads_from_master($link))) - printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = @mysqli_disable_reads_from_master($link))) + printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[003] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - if (!is_bool($tmp = mysqli_disable_reads_from_master($link))) - printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp); + if (!is_bool($tmp = mysqli_disable_reads_from_master($link))) + printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); - if (NULL !== ($tmp = mysqli_disable_reads_from_master($link))) - printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = mysqli_disable_reads_from_master($link))) + printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_driver.phpt b/ext/mysqli/tests/mysqli_driver.phpt index 9f70cb4899..d4fa124a59 100644 --- a/ext/mysqli/tests/mysqli_driver.phpt +++ b/ext/mysqli/tests/mysqli_driver.phpt @@ -8,106 +8,106 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require("table.inc"); - - if (!is_object($driver = new mysqli_driver())) - printf("[001] Failed to create mysqli_driver object\n"); - - $client_info = mysqli_get_client_info(); - if (($tmp = $driver->client_info) !== $client_info) - printf("[002] Expecting %s/%s, got %s/%s\n", - gettype($client_info), $client_info, - gettype($tmp), $tmp); - - $client_version = mysqli_get_client_version(); - if (($tmp = $driver->client_version) !== $client_version) - printf("[003] Expecting %s/%s, got %s/%s\n", - gettype($client_version), $client_version, - gettype($tmp), $tmp); - - if (!is_int($tmp = $driver->driver_version) || (0 == $tmp)) - printf("[004] Expecting int/any, got %s/%s\n", - gettype($tmp), $tmp); - - - $all_modes = array(MYSQLI_REPORT_INDEX, MYSQLI_REPORT_ERROR, MYSQLI_REPORT_STRICT, - MYSQLI_REPORT_ALL, MYSQLI_REPORT_OFF); - $report_mode = $driver->report_mode; - if (!is_int($report_mode)) - printf("[005] Expecting int/any, got %s/%s\n", - gettype($report_mode), $report_mode); - - if (!in_array($report_mode, $all_modes)) - printf("[006] Illegal report mode returned? Got %s, expected %s\n", - $report_mode, implode(', ', $all_modes)); - - $driver->report_mode = MYSQLI_REPORT_STRICT; - $ok = false; - try { - - if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) - printf("[007] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", - $host, $user . 'unknown_really', $db, $port, $socket); - mysqli_close($link); - - } catch (mysqli_sql_exception $e) { - $ok = true; - if ('' == $e->getMessage()) - printf("[008] getMessage() has returned an empty string.\n"); - if ('' == $e->getCode()) - printf("[009] getCode() has returned an empty string.\n"); - if ('' == $e->getFile()) - printf("[010] getFile() has returned an empty string.\n"); - if ('' == $e->getLine()) - printf("[011] getLine() has returned an empty string.\n"); - $tmp = $e->getTrace(); - if (empty($tmp)) - printf("[012] getTrace() has returned an empty array.\n"); - if ('' == $e->getTraceAsString()) - printf("[013] getTraceAsString() has returned an empty string.\n"); - if ('' == $e->__toString()) - printf("[014] __toString() has returned an empty string.\n"); - - } - if (!$ok) - printf("[015] Error reporting mode has not been switched to exceptions and or no exception thrown\n"); - - - $driver->report_mode = MYSQLI_REPORT_OFF; - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[016] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - mysqli_query($link, "NO_SQL"); - mysqli_close($link); - - $driver->report_mode = MYSQLI_REPORT_ERROR; - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - mysqli_query($link, "NO_SQL"); - mysqli_close($link); - - if (MYSQLI_REPORT_ERROR !== $driver->report_mode) - printf("[018] Error mode should be different\n"); - - /* TODO - more report testing should go in here, but it's not really documented what behaviour is expected */ - - $driver->report_mode = $report_mode; - - $reconnect = $driver->reconnect; - if (!is_bool($reconnect)) - printf("[019] Expecting boolean/any, got %s/%s\n", - gettype($reconnect), $reconnect); - - /* pointless, but I need more documentation */ - $driver->reconnect = true; - $driver->reconnect = false; - $driver->reconnect = $reconnect; - - if (!is_bool($embedded = $driver->embedded)) - printf("[020] Expecting boolean/any, got %s/%s\n", - gettype($embedded), $embedded); - - print "done!"; + require("table.inc"); + + if (!is_object($driver = new mysqli_driver())) + printf("[001] Failed to create mysqli_driver object\n"); + + $client_info = mysqli_get_client_info(); + if (($tmp = $driver->client_info) !== $client_info) + printf("[002] Expecting %s/%s, got %s/%s\n", + gettype($client_info), $client_info, + gettype($tmp), $tmp); + + $client_version = mysqli_get_client_version(); + if (($tmp = $driver->client_version) !== $client_version) + printf("[003] Expecting %s/%s, got %s/%s\n", + gettype($client_version), $client_version, + gettype($tmp), $tmp); + + if (!is_int($tmp = $driver->driver_version) || (0 == $tmp)) + printf("[004] Expecting int/any, got %s/%s\n", + gettype($tmp), $tmp); + + + $all_modes = array(MYSQLI_REPORT_INDEX, MYSQLI_REPORT_ERROR, MYSQLI_REPORT_STRICT, + MYSQLI_REPORT_ALL, MYSQLI_REPORT_OFF); + $report_mode = $driver->report_mode; + if (!is_int($report_mode)) + printf("[005] Expecting int/any, got %s/%s\n", + gettype($report_mode), $report_mode); + + if (!in_array($report_mode, $all_modes)) + printf("[006] Illegal report mode returned? Got %s, expected %s\n", + $report_mode, implode(', ', $all_modes)); + + $driver->report_mode = MYSQLI_REPORT_STRICT; + $ok = false; + try { + + if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) + printf("[007] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", + $host, $user . 'unknown_really', $db, $port, $socket); + mysqli_close($link); + + } catch (mysqli_sql_exception $e) { + $ok = true; + if ('' == $e->getMessage()) + printf("[008] getMessage() has returned an empty string.\n"); + if ('' == $e->getCode()) + printf("[009] getCode() has returned an empty string.\n"); + if ('' == $e->getFile()) + printf("[010] getFile() has returned an empty string.\n"); + if ('' == $e->getLine()) + printf("[011] getLine() has returned an empty string.\n"); + $tmp = $e->getTrace(); + if (empty($tmp)) + printf("[012] getTrace() has returned an empty array.\n"); + if ('' == $e->getTraceAsString()) + printf("[013] getTraceAsString() has returned an empty string.\n"); + if ('' == $e->__toString()) + printf("[014] __toString() has returned an empty string.\n"); + + } + if (!$ok) + printf("[015] Error reporting mode has not been switched to exceptions and or no exception thrown\n"); + + + $driver->report_mode = MYSQLI_REPORT_OFF; + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[016] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + mysqli_query($link, "NO_SQL"); + mysqli_close($link); + + $driver->report_mode = MYSQLI_REPORT_ERROR; + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + mysqli_query($link, "NO_SQL"); + mysqli_close($link); + + if (MYSQLI_REPORT_ERROR !== $driver->report_mode) + printf("[018] Error mode should be different\n"); + + /* TODO - more report testing should go in here, but it's not really documented what behaviour is expected */ + + $driver->report_mode = $report_mode; + + $reconnect = $driver->reconnect; + if (!is_bool($reconnect)) + printf("[019] Expecting boolean/any, got %s/%s\n", + gettype($reconnect), $reconnect); + + /* pointless, but I need more documentation */ + $driver->reconnect = true; + $driver->reconnect = false; + $driver->reconnect = $reconnect; + + if (!is_bool($embedded = $driver->embedded)) + printf("[020] Expecting boolean/any, got %s/%s\n", + gettype($embedded), $embedded); + + print "done!"; ?> --EXPECTF-- Warning: mysqli_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'NO_SQL' at line 1 in %s on line %d diff --git a/ext/mysqli/tests/mysqli_driver_unclonable.phpt b/ext/mysqli/tests/mysqli_driver_unclonable.phpt index 2b82f91d65..98559f46fc 100644 --- a/ext/mysqli/tests/mysqli_driver_unclonable.phpt +++ b/ext/mysqli/tests/mysqli_driver_unclonable.phpt @@ -5,9 +5,9 @@ Trying to clone mysqli_driver object <?php require_once('skipifemb.inc'); ?> --FILE-- <?php - $driver = new mysqli_driver; - $driver_clone = clone $driver; - print "done!"; + $driver = new mysqli_driver; + $driver_clone = clone $driver; + print "done!"; ?> --EXPECTF-- Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli_driver in %s:%d diff --git a/ext/mysqli/tests/mysqli_dump_debug_info.phpt b/ext/mysqli/tests/mysqli_dump_debug_info.phpt index d7ef81b822..95366417cf 100644 --- a/ext/mysqli/tests/mysqli_dump_debug_info.phpt +++ b/ext/mysqli/tests/mysqli_dump_debug_info.phpt @@ -8,20 +8,20 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - exit(1); - } + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + exit(1); + } - if (!is_bool($tmp = mysqli_dump_debug_info($link))) - printf("[004] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, - mysqli_errno($link), mysqli_error($link)); + if (!is_bool($tmp = mysqli_dump_debug_info($link))) + printf("[004] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n", + gettype($tmp), $tmp, + mysqli_errno($link), mysqli_error($link)); - mysqli_close($link); + mysqli_close($link); try { mysqli_dump_debug_info($link); @@ -29,7 +29,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; --EXPECT-- mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt index 8fb07617b7..ae153a320a 100644 --- a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt +++ b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt @@ -8,20 +8,20 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); + if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - if (!is_bool($tmp = $mysqli->dump_debug_info())) - printf("[003] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, - $mysqli->errno, $mysqli->error); + if (!is_bool($tmp = $mysqli->dump_debug_info())) + printf("[003] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n", + gettype($tmp), $tmp, + $mysqli->errno, $mysqli->error); - $mysqli->close(); + $mysqli->close(); try { $mysqli->dump_debug_info(); @@ -29,7 +29,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --EXPECT-- mysqli object is already closed diff --git a/ext/mysqli/tests/mysqli_embedded_connect.phpt b/ext/mysqli/tests/mysqli_embedded_connect.phpt index d1a8730a06..7c6ca78ad4 100644 --- a/ext/mysqli/tests/mysqli_embedded_connect.phpt +++ b/ext/mysqli/tests/mysqli_embedded_connect.phpt @@ -8,24 +8,24 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + require_once("connect.inc"); + $tmp = NULL; + $link = NULL; - if (NULL !== ($tmp = @mysqli_embedded_connect())) - printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = @mysqli_embedded_connect())) + printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = mysqli_embedded_connect($db)) { - printf("[002] 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 = mysqli_embedded_connect($db)) { + printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - if (!is_bool($tmp = mysqli_embedded_connect($db . '_unknown'))) - printf("[003] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp); + if (!is_bool($tmp = mysqli_embedded_connect($db . '_unknown'))) + printf("[003] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --EXPECTF-- Warning: mysqli_embedded_connect() expects parameter 1 to be mysqli, null given in %s on line %d diff --git a/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt b/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt index 3399f843b1..203f58fd28 100644 --- a/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt +++ b/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt @@ -12,35 +12,35 @@ if (!function_exists('mysqli_enable_reads_from_master')) { ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - if (NULL !== ($tmp = @mysqli_enable_reads_from_master())) - printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = @mysqli_enable_reads_from_master())) + printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - if (NULL !== ($tmp = @mysqli_enable_reads_from_master($link))) - printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = @mysqli_enable_reads_from_master($link))) + printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[003] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - if (!is_bool($tmp = mysqli_enable_reads_from_master($link))) - printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp); + if (!is_bool($tmp = mysqli_enable_reads_from_master($link))) + printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp); - try { - mysqli_close($link); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + try { + mysqli_close($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - if (NULL !== ($tmp = mysqli_enable_reads_from_master($link))) - printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = mysqli_enable_reads_from_master($link))) + printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; + print "done!"; ?> --EXPECTF-- mysqli object is already closed diff --git a/ext/mysqli/tests/mysqli_errno.phpt b/ext/mysqli/tests/mysqli_errno.phpt index 04ab8a4a41..2cfb17fde3 100644 --- a/ext/mysqli/tests/mysqli_errno.phpt +++ b/ext/mysqli/tests/mysqli_errno.phpt @@ -8,27 +8,27 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[003] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); } - var_dump(mysqli_errno($link)); + var_dump(mysqli_errno($link)); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("[004] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { + printf("[004] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - mysqli_query($link, 'SELECT * FROM test'); - var_dump(mysqli_errno($link)); + mysqli_query($link, 'SELECT * FROM test'); + var_dump(mysqli_errno($link)); - @mysqli_query($link, 'No SQL'); - if (($tmp = mysqli_errno($link)) == 0) - printf("[005] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp); + @mysqli_query($link, 'No SQL'); + if (($tmp = mysqli_errno($link)) == 0) + printf("[005] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); try { mysqli_errno($link); @@ -36,7 +36,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --EXPECTF-- int(0) diff --git a/ext/mysqli/tests/mysqli_errno_oo.phpt b/ext/mysqli/tests/mysqli_errno_oo.phpt index b548575d6d..d35477b2c4 100644 --- a/ext/mysqli/tests/mysqli_errno_oo.phpt +++ b/ext/mysqli/tests/mysqli_errno_oo.phpt @@ -8,33 +8,33 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - $mysqli = new mysqli(); - if (0 !== ($tmp = @$mysqli->errno)) - printf("[001] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + $mysqli = new mysqli(); + if (0 !== ($tmp = @$mysqli->errno)) + printf("[001] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - var_dump($mysqli->errno); + var_dump($mysqli->errno); - if (!$mysqli->query('DROP TABLE IF EXISTS test')) { - printf("[003] Failed to drop old test table: [%d] %s\n", $mysqli->errno, $mysqli->error); - } + if (!$mysqli->query('DROP TABLE IF EXISTS test')) { + printf("[003] Failed to drop old test table: [%d] %s\n", $mysqli->errno, $mysqli->error); + } - $mysqli->query('SELECT * FROM test'); - var_dump($mysqli->errno); + $mysqli->query('SELECT * FROM test'); + var_dump($mysqli->errno); - @$mysqli->query('No SQL'); - if (($tmp = $mysqli->errno) === 0) - printf("[004] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp); + @$mysqli->query('No SQL'); + if (($tmp = $mysqli->errno) === 0) + printf("[004] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp); - $mysqli->close(); + $mysqli->close(); try { $mysqli->errno; @@ -42,7 +42,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --EXPECTF-- int(0) diff --git a/ext/mysqli/tests/mysqli_error.phpt b/ext/mysqli/tests/mysqli_error.phpt index b7f034f267..7a35cd0dd1 100644 --- a/ext/mysqli/tests/mysqli_error.phpt +++ b/ext/mysqli/tests/mysqli_error.phpt @@ -8,27 +8,27 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[003] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - $tmp = mysqli_error($link); - if (!is_string($tmp) || ('' !== $tmp)) - printf("[004] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_error($link); + if (!is_string($tmp) || ('' !== $tmp)) + printf("[004] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("[005] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { + printf("[005] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - mysqli_query($link, 'SELECT * FROM test'); - $tmp = mysqli_error($link); - if (!is_string($tmp) || !preg_match("/Table '\w*\.test' doesn't exist/su", $tmp)) - printf("[006] Expecting string/[Table... doesn't exit], got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + mysqli_query($link, 'SELECT * FROM test'); + $tmp = mysqli_error($link); + if (!is_string($tmp) || !preg_match("/Table '\w*\.test' doesn't exist/su", $tmp)) + printf("[006] Expecting string/[Table... doesn't exit], got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - mysqli_close($link); + mysqli_close($link); try { mysqli_error($link); @@ -36,7 +36,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --EXPECT-- mysqli object is already closed diff --git a/ext/mysqli/tests/mysqli_error_oo.phpt b/ext/mysqli/tests/mysqli_error_oo.phpt index 3f3c673415..177e3a9f5a 100644 --- a/ext/mysqli/tests/mysqli_error_oo.phpt +++ b/ext/mysqli/tests/mysqli_error_oo.phpt @@ -8,41 +8,41 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - $mysqli = new mysqli(); - if ('' !== ($tmp = @$mysqli->error)) - printf("[001] Expecting empty string, got %s/'%s'\n", gettype($tmp), $tmp); + $mysqli = new mysqli(); + if ('' !== ($tmp = @$mysqli->error)) + printf("[001] Expecting empty string, got %s/'%s'\n", gettype($tmp), $tmp); - if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - $tmp = $mysqli->error; - if (!is_string($tmp) || ('' !== $tmp)) - printf("[003] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, $mysqli->errno, $mysqli->error); + $tmp = $mysqli->error; + if (!is_string($tmp) || ('' !== $tmp)) + printf("[003] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, $mysqli->errno, $mysqli->error); - if (!$mysqli->query('DROP TABLE IF EXISTS test')) { - printf("[004] Failed to drop old test table: [%d] %s\n", $mysqli->errno, $mysqli->error); - } + if (!$mysqli->query('DROP TABLE IF EXISTS test')) { + printf("[004] Failed to drop old test table: [%d] %s\n", $mysqli->errno, $mysqli->error); + } - $mysqli->query('SELECT * FROM test'); - $tmp = $mysqli->error; - if (!is_string($tmp) || !preg_match("/Table '\w*\.test' doesn't exist/su", $tmp)) - printf("[006] Expecting string/[Table... doesn't exit], got %s/%s. [%d] %s\n", gettype($tmp), $tmp, $mysqli->errno, $mysqli->error); + $mysqli->query('SELECT * FROM test'); + $tmp = $mysqli->error; + if (!is_string($tmp) || !preg_match("/Table '\w*\.test' doesn't exist/su", $tmp)) + printf("[006] Expecting string/[Table... doesn't exit], got %s/%s. [%d] %s\n", gettype($tmp), $tmp, $mysqli->errno, $mysqli->error); - $mysqli->close(); + $mysqli->close(); - try { + try { $mysqli->error; } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --EXPECT-- mysqli object is already closed diff --git a/ext/mysqli/tests/mysqli_error_unicode.phpt b/ext/mysqli/tests/mysqli_error_unicode.phpt index ce70c901e1..1025f1cda2 100644 --- a/ext/mysqli/tests/mysqli_error_unicode.phpt +++ b/ext/mysqli/tests/mysqli_error_unicode.phpt @@ -8,25 +8,25 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[003] 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 = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - mysqli_query($link, "set names utf8"); + mysqli_query($link, "set names utf8"); - $tmp = mysqli_error($link); - if (!is_string($tmp) || ('' !== $tmp)) - printf("[004] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_error($link); + if (!is_string($tmp) || ('' !== $tmp)) + printf("[004] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - mysqli_query($link, 'SELECT * FROM нÑма_такава_таблица'); - $tmp = mysqli_error($link); - var_dump(str_replace($db.".", "", $tmp)); + mysqli_query($link, 'SELECT * FROM нÑма_такава_таблица'); + $tmp = mysqli_error($link); + var_dump(str_replace($db.".", "", $tmp)); - mysqli_close($link); + mysqli_close($link); try { mysqli_error($link); @@ -34,7 +34,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; --EXPECTF-- string(%d) "Table 'нÑма_такава_таблица' doesn't exist" mysqli object is already closed diff --git a/ext/mysqli/tests/mysqli_expire_password.phpt b/ext/mysqli/tests/mysqli_expire_password.phpt index 679e210f92..18517e521a 100644 --- a/ext/mysqli/tests/mysqli_expire_password.phpt +++ b/ext/mysqli/tests/mysqli_expire_password.phpt @@ -50,71 +50,71 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'% ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); - - /* default */ - if (!$link = my_mysqli_connect($host, 'expiretest', "", $db, $port, $socket)) { - printf("[001] Cannot connect [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); - } else { - $link->query("SELECT id FROM test WHERE id = 1"); - printf("[002] Connect should fail, [%d] %s\n", $link->errno, $link->error); - } - /* explicitly requesting default */ - $link = mysqli_init(); - $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 0); - if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) { - printf("[003] Cannot connect [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); - } else { - $link->query("SELECT id FROM test WHERE id = 1"); - printf("[004] Connect should fail, [%d] %s\n", $link->errno, $link->error); - } - - /* allow connect */ - $link = mysqli_init(); - $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1); - if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) { - printf("[005] Cannot connect [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); - } else { - $link->query("SELECT id FROM test WHERE id = 1"); - printf("[006] Connect allowed, query fail, [%d] %s\n", $link->errno, $link->error); - $link->close(); - } - - /* allow connect, fix pw */ - $link = mysqli_init(); - $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1); - if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) { - printf("[007] Cannot connect [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); - } else { - if (!$link->query("SET PASSWORD='expiretest'")) { - $link->query("SET PASSWORD=PASSWORD('expiretest')"); - } - printf("[008] Connect allowed, pw set, [%d] %s\n", $link->errno, $link->error); - if ($res = $link->query("SELECT id FROM test WHERE id = 1")) - var_dump($res->fetch_assoc()); - $link->close(); - } - - - /* check login */ - if (!$link = my_mysqli_connect($host, 'expiretest', "expiretest", $db, $port, $socket)) { - printf("[001] Cannot connect [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); - } else { - $link->query("SELECT id FROM test WHERE id = 1"); - if ($res = $link->query("SELECT id FROM test WHERE id = 1")) - var_dump($res->fetch_assoc()); - $link->close(); - } - - - - print "done!"; + require_once('connect.inc'); + require_once('table.inc'); + + /* default */ + if (!$link = my_mysqli_connect($host, 'expiretest', "", $db, $port, $socket)) { + printf("[001] Cannot connect [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); + } else { + $link->query("SELECT id FROM test WHERE id = 1"); + printf("[002] Connect should fail, [%d] %s\n", $link->errno, $link->error); + } + /* explicitly requesting default */ + $link = mysqli_init(); + $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 0); + if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) { + printf("[003] Cannot connect [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); + } else { + $link->query("SELECT id FROM test WHERE id = 1"); + printf("[004] Connect should fail, [%d] %s\n", $link->errno, $link->error); + } + + /* allow connect */ + $link = mysqli_init(); + $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1); + if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) { + printf("[005] Cannot connect [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); + } else { + $link->query("SELECT id FROM test WHERE id = 1"); + printf("[006] Connect allowed, query fail, [%d] %s\n", $link->errno, $link->error); + $link->close(); + } + + /* allow connect, fix pw */ + $link = mysqli_init(); + $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1); + if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) { + printf("[007] Cannot connect [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); + } else { + if (!$link->query("SET PASSWORD='expiretest'")) { + $link->query("SET PASSWORD=PASSWORD('expiretest')"); + } + printf("[008] Connect allowed, pw set, [%d] %s\n", $link->errno, $link->error); + if ($res = $link->query("SELECT id FROM test WHERE id = 1")) + var_dump($res->fetch_assoc()); + $link->close(); + } + + + /* check login */ + if (!$link = my_mysqli_connect($host, 'expiretest', "expiretest", $db, $port, $socket)) { + printf("[001] Cannot connect [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); + } else { + $link->query("SELECT id FROM test WHERE id = 1"); + if ($res = $link->query("SELECT id FROM test WHERE id = 1")) + var_dump($res->fetch_assoc()); + $link->close(); + } + + + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_explain_metadata.phpt b/ext/mysqli/tests/mysqli_explain_metadata.phpt index 157559b340..91ef498c62 100644 --- a/ext/mysqli/tests/mysqli_explain_metadata.phpt +++ b/ext/mysqli/tests/mysqli_explain_metadata.phpt @@ -11,149 +11,149 @@ if (!$IS_MYSQLND) ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - if (!$res = mysqli_query($link, 'EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2')) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2')) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $num_rows = 0; - $num_fields = 0; - $field_names = array(); - if (!$row = mysqli_fetch_assoc($res)) { - printf("[002] Expecting result but got no data [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - } else { - $num_rows++; - $num_fields = count($row); - foreach ($row as $name => $value) - $field_names[$name] = gettype($value); - } + $num_rows = 0; + $num_fields = 0; + $field_names = array(); + if (!$row = mysqli_fetch_assoc($res)) { + printf("[002] Expecting result but got no data [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + } else { + $num_rows++; + $num_fields = count($row); + foreach ($row as $name => $value) + $field_names[$name] = gettype($value); + } - while ($row = mysqli_fetch_assoc($res)) - $num_rows++; + while ($row = mysqli_fetch_assoc($res)) + $num_rows++; - if (($tmp = mysqli_num_rows($res)) !== $num_rows) { - printf("[003] Expecting int/%d got %s/%s\n", - $num_rows, gettype($tmp), $tmp); - } - if (($tmp = mysqli_field_count($link)) !== $num_fields) { - printf("[004] Expecting int/%d got %s/%s\n", - $num_fields, gettype($tmp), $tmp); - } - $fields = mysqli_fetch_fields($res); - if (($tmp = count($fields)) !== $num_fields) { - printf("[005] Expecting int/%d got %s/%s\n", - $num_fields, gettype($tmp), $tmp); - } + if (($tmp = mysqli_num_rows($res)) !== $num_rows) { + printf("[003] Expecting int/%d got %s/%s\n", + $num_rows, gettype($tmp), $tmp); + } + if (($tmp = mysqli_field_count($link)) !== $num_fields) { + printf("[004] Expecting int/%d got %s/%s\n", + $num_fields, gettype($tmp), $tmp); + } + $fields = mysqli_fetch_fields($res); + if (($tmp = count($fields)) !== $num_fields) { + printf("[005] Expecting int/%d got %s/%s\n", + $num_fields, gettype($tmp), $tmp); + } - foreach ($fields as $k => $field) { - $field->max_length = 0;// change it or we will get diff error - if (isset($field_names[$field->name])) { - unset($field_names[$field->name]); - } else { - printf("[006] Unexpected field '%s', dumping info\n"); - var_dump($field); - } - } - if (!empty($field_names)) { - printf("[007] Field descriptions missing for the following columns\n"); - var_dump($field_names); - } + foreach ($fields as $k => $field) { + $field->max_length = 0;// change it or we will get diff error + if (isset($field_names[$field->name])) { + unset($field_names[$field->name]); + } else { + printf("[006] Unexpected field '%s', dumping info\n"); + var_dump($field); + } + } + if (!empty($field_names)) { + printf("[007] Field descriptions missing for the following columns\n"); + var_dump($field_names); + } - mysqli_free_result($res); + mysqli_free_result($res); - $stmt = mysqli_stmt_init($link); - /* Depending on your version, the MySQL server migit not support this */ - if ($stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') && $stmt->execute()) { - if (!mysqli_stmt_store_result($stmt)) - printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $stmt = mysqli_stmt_init($link); + /* Depending on your version, the MySQL server migit not support this */ + if ($stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') && $stmt->execute()) { + if (!mysqli_stmt_store_result($stmt)) + printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$res_meta = mysqli_stmt_result_metadata($stmt)) - printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!$res_meta = mysqli_stmt_result_metadata($stmt)) + printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (($tmp = mysqli_stmt_num_rows($stmt)) !== $num_rows) { - printf("[010] Expecting int/%d got %s/%s\n", - $num_rows, gettype($tmp), $tmp); - } - if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) { - printf("[011] Expecting int/%d got %s/%s\n", - $num_fields, gettype($tmp), $tmp); - } - if (($tmp = mysqli_field_count($link)) !== $num_fields) { - printf("[013] Expecting int/%d got %s/%s\n", - $num_fields, gettype($tmp), $tmp); - } - if (($tmp = $res_meta->field_count) !== $num_fields) { - printf("[014] Expecting int/%d got %s/%s\n", - $num_fields, gettype($tmp), $tmp); - } - $fields_res_meta = mysqli_fetch_fields($res_meta); - if (($tmp = count($fields_res_meta)) !== $num_fields) - printf("[015] Expecting int/%d got %s/%s\n", - $num_fields, gettype($tmp), $tmp); + if (($tmp = mysqli_stmt_num_rows($stmt)) !== $num_rows) { + printf("[010] Expecting int/%d got %s/%s\n", + $num_rows, gettype($tmp), $tmp); + } + if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) { + printf("[011] Expecting int/%d got %s/%s\n", + $num_fields, gettype($tmp), $tmp); + } + if (($tmp = mysqli_field_count($link)) !== $num_fields) { + printf("[013] Expecting int/%d got %s/%s\n", + $num_fields, gettype($tmp), $tmp); + } + if (($tmp = $res_meta->field_count) !== $num_fields) { + printf("[014] Expecting int/%d got %s/%s\n", + $num_fields, gettype($tmp), $tmp); + } + $fields_res_meta = mysqli_fetch_fields($res_meta); + if (($tmp = count($fields_res_meta)) !== $num_fields) + printf("[015] Expecting int/%d got %s/%s\n", + $num_fields, gettype($tmp), $tmp); - if ($fields_res_meta != $fields) { - printf("[016] Prepared Statement metadata differs from normal metadata, dumping\n"); - var_dump($fields_res_meta); - var_dump($fields); - } + if ($fields_res_meta != $fields) { + printf("[016] Prepared Statement metadata differs from normal metadata, dumping\n"); + var_dump($fields_res_meta); + var_dump($fields); + } - if (function_exists('mysqli_stmt_get_result') && - $stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') && - $stmt->execute()) { - if (!$res_stmt = mysqli_stmt_get_result($stmt)) { - printf("[017] Cannot fetch result from PS [%d] %s\n", - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - if (($tmp = mysqli_num_rows($res_stmt)) !== $num_rows) { - printf("[018] Expecting int/%d got %s/%s\n", - $num_rows, gettype($tmp), $tmp); - } - if ((mysqli_stmt_num_rows($stmt)) !== 0) { - printf("[019] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp); - } - if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) { - printf("[020] Expecting int/%d got %s/%s\n", - $num_fields, gettype($tmp), $tmp); + if (function_exists('mysqli_stmt_get_result') && + $stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') && + $stmt->execute()) { + if (!$res_stmt = mysqli_stmt_get_result($stmt)) { + printf("[017] Cannot fetch result from PS [%d] %s\n", + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + if (($tmp = mysqli_num_rows($res_stmt)) !== $num_rows) { + printf("[018] Expecting int/%d got %s/%s\n", + $num_rows, gettype($tmp), $tmp); + } + if ((mysqli_stmt_num_rows($stmt)) !== 0) { + printf("[019] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp); + } + if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) { + printf("[020] Expecting int/%d got %s/%s\n", + $num_fields, gettype($tmp), $tmp); - } - if (($tmp = $res_stmt->field_count) !== $num_fields) { - printf("[021] Expecting int/%d got %s/%s\n", - $num_fields, gettype($tmp), $tmp); - } + } + if (($tmp = $res_stmt->field_count) !== $num_fields) { + printf("[021] Expecting int/%d got %s/%s\n", + $num_fields, gettype($tmp), $tmp); + } - $fields_stmt = mysqli_fetch_fields($res_stmt); - if (($tmp = count($fields_stmt)) !== $num_fields) { - printf("[022] Expecting int/%d got %s/%s\n", - $num_fields, gettype($tmp), $tmp); - } - reset($fields); - foreach ($fields_stmt as $fields_stmt_val) { - $fields_val = current($fields); - next($fields); - unset($fields_stmt_val->max_length); - unset($fields_val->max_length); - if ($fields_stmt_val != $fields_val) { - printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n"); - var_dump($fields_stmt_val); - var_dump($fields_val); - } - } + $fields_stmt = mysqli_fetch_fields($res_stmt); + if (($tmp = count($fields_stmt)) !== $num_fields) { + printf("[022] Expecting int/%d got %s/%s\n", + $num_fields, gettype($tmp), $tmp); + } + reset($fields); + foreach ($fields_stmt as $fields_stmt_val) { + $fields_val = current($fields); + next($fields); + unset($fields_stmt_val->max_length); + unset($fields_val->max_length); + if ($fields_stmt_val != $fields_val) { + printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n"); + var_dump($fields_stmt_val); + var_dump($fields_val); + } + } /* - if ($fields_stmt != $fields) { - printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n"); - var_dump($fields_stmt); - var_dump($fields); - } + if ($fields_stmt != $fields) { + printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n"); + var_dump($fields_stmt); + var_dump($fields); + } */ - mysqli_free_result($res_stmt); - } - } - mysqli_stmt_close($stmt); + mysqli_free_result($res_stmt); + } + } + mysqli_stmt_close($stmt); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_all.phpt b/ext/mysqli/tests/mysqli_fetch_all.phpt index 7b8f50a57e..76c6b971f4 100644 --- a/ext/mysqli/tests/mysqli_fetch_all.phpt +++ b/ext/mysqli/tests/mysqli_fetch_all.phpt @@ -10,279 +10,279 @@ if (!function_exists('mysqli_fetch_all')) ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); - if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) { - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - print "[005]\n"; - var_dump(mysqli_fetch_all($res)); - mysqli_free_result($res); + require('table.inc'); + if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) { + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) { - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + print "[005]\n"; + var_dump(mysqli_fetch_all($res)); + mysqli_free_result($res); - print "[007]\n"; - var_dump(mysqli_fetch_all($res, MYSQLI_NUM)); - mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) { + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) { - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + print "[007]\n"; + var_dump(mysqli_fetch_all($res, MYSQLI_NUM)); + mysqli_free_result($res); - print "[008]\n"; - var_dump(mysqli_fetch_all($res, MYSQLI_BOTH)); - mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) { + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) { - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + print "[008]\n"; + var_dump(mysqli_fetch_all($res, MYSQLI_BOTH)); + mysqli_free_result($res); - print "[010]\n"; - var_dump(mysqli_fetch_all($res, MYSQLI_ASSOC)); + if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) { + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - print "[011]\n"; - var_dump(mysqli_fetch_all($res)); - mysqli_free_result($res); + print "[010]\n"; + var_dump(mysqli_fetch_all($res, MYSQLI_ASSOC)); - if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) { - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + print "[011]\n"; + var_dump(mysqli_fetch_all($res)); + mysqli_free_result($res); - print "[013]\n"; - var_dump(mysqli_fetch_all($res, MYSQLI_ASSOC)); + if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) { + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - print "[016]\n"; - var_dump(mysqli_fetch_all($res)); + print "[013]\n"; + var_dump(mysqli_fetch_all($res, MYSQLI_ASSOC)); - if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) { - printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), $mysqli_error($link)); - } - print "[017]\n"; - var_dump(mysqli_fetch_all($res, MYSQLI_BOTH)); + print "[016]\n"; + var_dump(mysqli_fetch_all($res)); - mysqli_free_result($res); - if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) { - printf("[018] Cannot run query, [%d] %s\n", - mysqli_errno($link), $mysqli_error($link)); - exit(1); - } + if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) { + printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), $mysqli_error($link)); + } + print "[017]\n"; + var_dump(mysqli_fetch_all($res, MYSQLI_BOTH)); + + mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) { + printf("[018] Cannot run query, [%d] %s\n", + mysqli_errno($link), $mysqli_error($link)); + exit(1); + } - do { - $illegal_mode = mt_rand(-10000, 10000); - } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH))); - // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes. + do { + $illegal_mode = mt_rand(-10000, 10000); + } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH))); + // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes. mysqli_fetch_all($res, $illegal_mode); - mysqli_free_result($res); - - function func_mysqli_fetch_all($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) { - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_query($link, $sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { - // don't bail, engine might not support the datatype - return false; - } - - if (is_null($php_value)) { - if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) { - printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); - return false; - } - } else { - if (is_string($sql_value)) { - if (!mysqli_query($link, $sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) { - printf("[%04ds] [%d] %s - %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link), $sql); - return false; - } - } else { - if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) { - printf("[%04di] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); - return false; - } - } - } - - if (!$res = mysqli_query($link, "SELECT id, label FROM test")) { - printf("[%04d] [%d] %s\n", $offset + 2, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!$tmp = mysqli_fetch_all($res, MYSQLI_BOTH)) { - printf("[%04d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link)); - return false; - } - $row = $tmp[0]; - - $fields = mysqli_fetch_fields($res); - - if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) { - - if ($regexp_comparison) { - if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { - printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, - gettype($php_value), $php_value, $regexp_comparison, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); - return false; - } - } else { - if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { - printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, - gettype($php_value), $php_value, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); - return false; - } - } - } - - return true; - } - - function func_mysqli_fetch_array_make_string($len) { - - $ret = ''; - for ($i = 0; $i < $len; $i++) - $ret .= chr(mt_rand(65, 90)); - - return $ret; - } - - func_mysqli_fetch_all($link, $engine, "TINYINT", -11, "-11", 20); - func_mysqli_fetch_all($link, $engine, "TINYINT", NULL, NULL, 30); - func_mysqli_fetch_all($link, $engine, "TINYINT UNSIGNED", 1, "1", 40); - func_mysqli_fetch_all($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50); - - func_mysqli_fetch_all($link, $engine, "BOOL", 1, "1", 60); - func_mysqli_fetch_all($link, $engine, "BOOL", NULL, NULL, 70); - func_mysqli_fetch_all($link, $engine, "BOOLEAN", 0, "0", 80); - func_mysqli_fetch_all($link, $engine, "BOOLEAN", NULL, NULL, 90); - - func_mysqli_fetch_all($link, $engine, "SMALLINT", -32768, "-32768", 100); - func_mysqli_fetch_all($link, $engine, "SMALLINT", 32767, "32767", 110); - func_mysqli_fetch_all($link, $engine, "SMALLINT", NULL, NULL, 120); - func_mysqli_fetch_all($link, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130); - func_mysqli_fetch_all($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140); - - func_mysqli_fetch_all($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150); - func_mysqli_fetch_all($link, $engine, "MEDIUMINT", 8388607, "8388607", 160); - func_mysqli_fetch_all($link, $engine, "MEDIUMINT", NULL, NULL, 170); - func_mysqli_fetch_all($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180); - func_mysqli_fetch_all($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190); - - func_mysqli_fetch_all($link, $engine, "INTEGER", -2147483648, "-2147483648", 200); - func_mysqli_fetch_all($link, $engine, "INTEGER", 2147483647, "2147483647", 210); - func_mysqli_fetch_all($link, $engine, "INTEGER", NULL, NULL, 220); - func_mysqli_fetch_all($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230); - func_mysqli_fetch_all($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240); - - func_mysqli_fetch_all($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250); - - func_mysqli_fetch_all($link, $engine, "BIGINT", NULL, NULL, 260); - func_mysqli_fetch_all($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270); - func_mysqli_fetch_all($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280); - - func_mysqli_fetch_all($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu"); - func_mysqli_fetch_all($link, $engine, "FLOAT", NULL, NULL, 300); - func_mysqli_fetch_all($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+19", 310, "/1\.84467e\+?[0]?19/iu"); - func_mysqli_fetch_all($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320); - - func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330); - func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340); - func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350); - func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360); - - func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370); - func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380); - func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390); - func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400); - - // don't care about date() strict TZ warnings... - func_mysqli_fetch_all($link, $engine, "DATE", @date('Y-m-d'), @date('Y-m-d'), 410); - func_mysqli_fetch_all($link, $engine, "DATE NOT NULL", @date('Y-m-d'), @date('Y-m-d'), 420); - func_mysqli_fetch_all($link, $engine, "DATE", NULL, NULL, 430); - - func_mysqli_fetch_all($link, $engine, "DATETIME", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 440); - func_mysqli_fetch_all($link, $engine, "DATETIME NOT NULL", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 450); - func_mysqli_fetch_all($link, $engine, "DATETIME", NULL, NULL, 460); - - func_mysqli_fetch_all($link, $engine, "TIMESTAMP", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 470); - - func_mysqli_fetch_all($link, $engine, "TIME", @date('H:i:s'), @date('H:i:s'), 480); - func_mysqli_fetch_all($link, $engine, "TIME NOT NULL", @date('H:i:s'), @date('H:i:s'), 490); - func_mysqli_fetch_all($link, $engine, "TIME", NULL, NULL, 500); - - func_mysqli_fetch_all($link, $engine, "YEAR", @date('Y'), @date('Y'), 510); - func_mysqli_fetch_all($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520); - func_mysqli_fetch_all($link, $engine, "YEAR", NULL, NULL, 530); - - $string255 = func_mysqli_fetch_array_make_string(255); - func_mysqli_fetch_all($link, $engine, "CHAR(1)", "a", "a", 540); - func_mysqli_fetch_all($link, $engine, "CHAR(255)", $string255, $string255, 550); - func_mysqli_fetch_all($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560); - func_mysqli_fetch_all($link, $engine, "CHAR(1)", NULL, NULL, 570); - - $string65k = func_mysqli_fetch_array_make_string(65400); - func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", "a", "a", 580); - func_mysqli_fetch_all($link, $engine, "VARCHAR(255)", $string255, $string255, 590); - func_mysqli_fetch_all($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600); - func_mysqli_fetch_all($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610); - func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", NULL, NULL, 620); - - func_mysqli_fetch_all($link, $engine, "BINARY(1)", "a", "a", 630); - func_mysqli_fetch_all($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640); - func_mysqli_fetch_all($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650); - func_mysqli_fetch_all($link, $engine, "BINARY(1)", NULL, NULL, 660); - - func_mysqli_fetch_all($link, $engine, "VARBINARY(1)", "a", "a", 670); - func_mysqli_fetch_all($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680); - func_mysqli_fetch_all($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690); - func_mysqli_fetch_all($link, $engine, "VARBINARY(1)", NULL, NULL, 700); - - func_mysqli_fetch_all($link, $engine, "TINYBLOB", "a", "a", 710); - func_mysqli_fetch_all($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720); - func_mysqli_fetch_all($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730); - func_mysqli_fetch_all($link, $engine, "TINYBLOB", NULL, NULL, 740); - - func_mysqli_fetch_all($link, $engine, "TINYTEXT", "a", "a", 750); - func_mysqli_fetch_all($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760); - func_mysqli_fetch_all($link, $engine, "TINYTEXT", NULL, NULL, 770); - - func_mysqli_fetch_all($link, $engine, "BLOB", "a", "a", 780); - func_mysqli_fetch_all($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780); - func_mysqli_fetch_all($link, $engine, "BLOB", NULL, NULL, 790); - - func_mysqli_fetch_all($link, $engine, "TEXT", "a", "a", 800); - func_mysqli_fetch_all($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810); - func_mysqli_fetch_all($link, $engine, "TEXT", NULL, NULL, 820); - - func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", "a", "a", 830); - func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840); - func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", NULL, NULL, 850); - - func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", "a", "a", 860); - func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870); - func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", NULL, NULL, 880); - - func_mysqli_fetch_all($link, $engine, "LONGBLOB", "a", "a", 890); - func_mysqli_fetch_all($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900); - func_mysqli_fetch_all($link, $engine, "LONGBLOB", NULL, NULL, 910); - - func_mysqli_fetch_all($link, $engine, "ENUM('a', 'b')", "a", "a", 920); - func_mysqli_fetch_all($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930); - - func_mysqli_fetch_all($link, $engine, "SET('a', 'b')", "a", "a", 940); - func_mysqli_fetch_all($link, $engine, "SET('a', 'b')", NULL, NULL, 950); + mysqli_free_result($res); + + function func_mysqli_fetch_all($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) { + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { + printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_query($link, $sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { + // don't bail, engine might not support the datatype + return false; + } + + if (is_null($php_value)) { + if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) { + printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); + return false; + } + } else { + if (is_string($sql_value)) { + if (!mysqli_query($link, $sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) { + printf("[%04ds] [%d] %s - %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link), $sql); + return false; + } + } else { + if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) { + printf("[%04di] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); + return false; + } + } + } + + if (!$res = mysqli_query($link, "SELECT id, label FROM test")) { + printf("[%04d] [%d] %s\n", $offset + 2, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!$tmp = mysqli_fetch_all($res, MYSQLI_BOTH)) { + printf("[%04d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link)); + return false; + } + $row = $tmp[0]; + + $fields = mysqli_fetch_fields($res); + + if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) { + + if ($regexp_comparison) { + if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { + printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, + gettype($php_value), $php_value, $regexp_comparison, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); + return false; + } + } else { + if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { + printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, + gettype($php_value), $php_value, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); + return false; + } + } + } + + return true; + } + + function func_mysqli_fetch_array_make_string($len) { + + $ret = ''; + for ($i = 0; $i < $len; $i++) + $ret .= chr(mt_rand(65, 90)); + + return $ret; + } + + func_mysqli_fetch_all($link, $engine, "TINYINT", -11, "-11", 20); + func_mysqli_fetch_all($link, $engine, "TINYINT", NULL, NULL, 30); + func_mysqli_fetch_all($link, $engine, "TINYINT UNSIGNED", 1, "1", 40); + func_mysqli_fetch_all($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50); + + func_mysqli_fetch_all($link, $engine, "BOOL", 1, "1", 60); + func_mysqli_fetch_all($link, $engine, "BOOL", NULL, NULL, 70); + func_mysqli_fetch_all($link, $engine, "BOOLEAN", 0, "0", 80); + func_mysqli_fetch_all($link, $engine, "BOOLEAN", NULL, NULL, 90); + + func_mysqli_fetch_all($link, $engine, "SMALLINT", -32768, "-32768", 100); + func_mysqli_fetch_all($link, $engine, "SMALLINT", 32767, "32767", 110); + func_mysqli_fetch_all($link, $engine, "SMALLINT", NULL, NULL, 120); + func_mysqli_fetch_all($link, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130); + func_mysqli_fetch_all($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140); + + func_mysqli_fetch_all($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150); + func_mysqli_fetch_all($link, $engine, "MEDIUMINT", 8388607, "8388607", 160); + func_mysqli_fetch_all($link, $engine, "MEDIUMINT", NULL, NULL, 170); + func_mysqli_fetch_all($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180); + func_mysqli_fetch_all($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190); + + func_mysqli_fetch_all($link, $engine, "INTEGER", -2147483648, "-2147483648", 200); + func_mysqli_fetch_all($link, $engine, "INTEGER", 2147483647, "2147483647", 210); + func_mysqli_fetch_all($link, $engine, "INTEGER", NULL, NULL, 220); + func_mysqli_fetch_all($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230); + func_mysqli_fetch_all($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240); + + func_mysqli_fetch_all($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250); + + func_mysqli_fetch_all($link, $engine, "BIGINT", NULL, NULL, 260); + func_mysqli_fetch_all($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270); + func_mysqli_fetch_all($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280); + + func_mysqli_fetch_all($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu"); + func_mysqli_fetch_all($link, $engine, "FLOAT", NULL, NULL, 300); + func_mysqli_fetch_all($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+19", 310, "/1\.84467e\+?[0]?19/iu"); + func_mysqli_fetch_all($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320); + + func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330); + func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340); + func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350); + func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360); + + func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370); + func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380); + func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390); + func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400); + + // don't care about date() strict TZ warnings... + func_mysqli_fetch_all($link, $engine, "DATE", @date('Y-m-d'), @date('Y-m-d'), 410); + func_mysqli_fetch_all($link, $engine, "DATE NOT NULL", @date('Y-m-d'), @date('Y-m-d'), 420); + func_mysqli_fetch_all($link, $engine, "DATE", NULL, NULL, 430); + + func_mysqli_fetch_all($link, $engine, "DATETIME", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 440); + func_mysqli_fetch_all($link, $engine, "DATETIME NOT NULL", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 450); + func_mysqli_fetch_all($link, $engine, "DATETIME", NULL, NULL, 460); + + func_mysqli_fetch_all($link, $engine, "TIMESTAMP", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 470); + + func_mysqli_fetch_all($link, $engine, "TIME", @date('H:i:s'), @date('H:i:s'), 480); + func_mysqli_fetch_all($link, $engine, "TIME NOT NULL", @date('H:i:s'), @date('H:i:s'), 490); + func_mysqli_fetch_all($link, $engine, "TIME", NULL, NULL, 500); + + func_mysqli_fetch_all($link, $engine, "YEAR", @date('Y'), @date('Y'), 510); + func_mysqli_fetch_all($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520); + func_mysqli_fetch_all($link, $engine, "YEAR", NULL, NULL, 530); + + $string255 = func_mysqli_fetch_array_make_string(255); + func_mysqli_fetch_all($link, $engine, "CHAR(1)", "a", "a", 540); + func_mysqli_fetch_all($link, $engine, "CHAR(255)", $string255, $string255, 550); + func_mysqli_fetch_all($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560); + func_mysqli_fetch_all($link, $engine, "CHAR(1)", NULL, NULL, 570); + + $string65k = func_mysqli_fetch_array_make_string(65400); + func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", "a", "a", 580); + func_mysqli_fetch_all($link, $engine, "VARCHAR(255)", $string255, $string255, 590); + func_mysqli_fetch_all($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600); + func_mysqli_fetch_all($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610); + func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", NULL, NULL, 620); + + func_mysqli_fetch_all($link, $engine, "BINARY(1)", "a", "a", 630); + func_mysqli_fetch_all($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640); + func_mysqli_fetch_all($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650); + func_mysqli_fetch_all($link, $engine, "BINARY(1)", NULL, NULL, 660); + + func_mysqli_fetch_all($link, $engine, "VARBINARY(1)", "a", "a", 670); + func_mysqli_fetch_all($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680); + func_mysqli_fetch_all($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690); + func_mysqli_fetch_all($link, $engine, "VARBINARY(1)", NULL, NULL, 700); + + func_mysqli_fetch_all($link, $engine, "TINYBLOB", "a", "a", 710); + func_mysqli_fetch_all($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720); + func_mysqli_fetch_all($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730); + func_mysqli_fetch_all($link, $engine, "TINYBLOB", NULL, NULL, 740); + + func_mysqli_fetch_all($link, $engine, "TINYTEXT", "a", "a", 750); + func_mysqli_fetch_all($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760); + func_mysqli_fetch_all($link, $engine, "TINYTEXT", NULL, NULL, 770); + + func_mysqli_fetch_all($link, $engine, "BLOB", "a", "a", 780); + func_mysqli_fetch_all($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780); + func_mysqli_fetch_all($link, $engine, "BLOB", NULL, NULL, 790); + + func_mysqli_fetch_all($link, $engine, "TEXT", "a", "a", 800); + func_mysqli_fetch_all($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810); + func_mysqli_fetch_all($link, $engine, "TEXT", NULL, NULL, 820); + + func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", "a", "a", 830); + func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840); + func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", NULL, NULL, 850); + + func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", "a", "a", 860); + func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870); + func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", NULL, NULL, 880); + + func_mysqli_fetch_all($link, $engine, "LONGBLOB", "a", "a", 890); + func_mysqli_fetch_all($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900); + func_mysqli_fetch_all($link, $engine, "LONGBLOB", NULL, NULL, 910); + + func_mysqli_fetch_all($link, $engine, "ENUM('a', 'b')", "a", "a", 920); + func_mysqli_fetch_all($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930); + + func_mysqli_fetch_all($link, $engine, "SET('a', 'b')", "a", "a", 940); + func_mysqli_fetch_all($link, $engine, "SET('a', 'b')", NULL, NULL, 950); - mysqli_close($link); + mysqli_close($link); try { mysqli_fetch_array($res, MYSQLI_ASSOC); @@ -290,26 +290,26 @@ if (!function_exists('mysqli_fetch_all')) echo $exception->getMessage() . "\n"; } - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[016] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[016] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - if (!$res = mysqli_real_query($link, "SELECT 1 AS _one")) - printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_real_query($link, "SELECT 1 AS _one")) + printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - /* on mysqlnd level this would not be allowed */ - if (!is_object($res = mysqli_use_result($link))) - printf("[018] Expecting object, got %s/%s. [%d] %s\n", - gettype($res), $res, mysqli_errno($link), mysqli_error($link)); + /* on mysqlnd level this would not be allowed */ + if (!is_object($res = mysqli_use_result($link))) + printf("[018] Expecting object, got %s/%s. [%d] %s\n", + gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - $rows = mysqli_fetch_all($res, MYSQLI_ASSOC); - if (!is_array($rows) || (count($rows) > 1) || !isset($rows[0]['_one']) || ($rows[0]['_one'] != 1)) { - printf("[019] Results seem wrong, dumping\n"); - var_dump($rows); - } + $rows = mysqli_fetch_all($res, MYSQLI_ASSOC); + if (!is_array($rows) || (count($rows) > 1) || !isset($rows[0]['_one']) || ($rows[0]['_one'] != 1)) { + printf("[019] Results seem wrong, dumping\n"); + var_dump($rows); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt index 63c32e32d4..992a61a348 100644 --- a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt @@ -11,292 +11,292 @@ if (!function_exists('mysqli_fetch_all')) ?> --FILE-- <?php - require_once("connect.inc"); - - $tmp = NULL; - $link = NULL; - - $mysqli = new mysqli(); - - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - require('table.inc'); - if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) { - printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - print "[005]\n"; - var_dump($res->fetch_all()); - $res->free_result(); - - if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) { - printf("[006] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - print "[007]\n"; - var_dump($res->fetch_all(MYSQLI_NUM)); - $res->free_result(); - - if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) { - printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - print "[008]\n"; - var_dump($res->fetch_all(MYSQLI_BOTH)); - $res->free_result(); - - if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) { - printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - print "[010]\n"; - var_dump($res->fetch_all(MYSQLI_ASSOC)); - - print "[011]\n"; - var_dump($res->fetch_array()); - $res->free_result(); - - if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) { - printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - print "[013]\n"; - var_dump($res->fetch_all(MYSQLI_ASSOC)); - - print "[016]\n"; - var_dump($res->fetch_array()); - - if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) { - printf("[010] Cannot run query, [%d] %s\n", $mysqli->errno, $$mysqli->error); - } - print "[017]\n"; - var_dump($res->fetch_all(MYSQLI_BOTH)); - - $res->free_result(); - if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) { - printf("[018] Cannot run query, [%d] %s\n", - $mysqli->errno, $$mysqli->error); - exit(1); - } - - do { - $illegal_mode = mt_rand(-10000, 10000); - } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH))); - // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes. - $tmp = $res->fetch_all($illegal_mode); - if (false !== $tmp) - printf("[019] Expecting boolean/false although, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, $mysqli->errno, $mysqli->error); - - $res->free_result(); - - function func_mysqli_fetch_all_oo($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) { - - if (!$link->query("DROP TABLE IF EXISTS test")) { - printf("[%04d] [%d] %s\n", $offset, $link->errno, $link->error); - return false; - } - - if (!$link->query($sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { - // don't bail, engine might not support the datatype - return false; - } - - if (is_null($php_value)) { - if (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) { - printf("[%04d] [%d] %s\n", $offset + 1, $link->errno, $link->error); - return false; - } - } else { - if (is_string($sql_value)) { - if (!$link->query($sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) { - printf("[%04ds] [%d] %s - %s\n", $offset + 1, $link->errno, $link->error, $sql); - return false; - } - } else { - if (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) { - printf("[%04di] [%d] %s\n", $offset + 1, $link->errno, $link->error); - return false; - } - } - } - - if (!$res = $link->query("SELECT id, label FROM test")) { - printf("[%04d] [%d] %s\n", $offset + 2, $link->errno, $link->error); - return false; - } - - if (!$tmp = $res->fetch_all(MYSQLI_BOTH)) { - printf("[%04d] [%d] %s\n", $offset + 3, $link->errno, $link->error); - return false; - } - $row = $tmp[0]; - - $fields = mysqli_fetch_fields($res); - - if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) { - if ($regexp_comparison) { - if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { - printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, - gettype($php_value), $php_value, $regexp_comparison, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], $link->errno, $link->error); - return false; - } - } else { - if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { - printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, - gettype($php_value), $php_value, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], $link->errno, $link->error); - return false; - } - } - } - - return true; - } - - function func_mysqli_fetch_array_oo_make_string($len) { - - $ret = ''; - for ($i = 0; $i < $len; $i++) - $ret .= chr(mt_rand(65, 90)); - - return $ret; - } - - func_mysqli_fetch_all_oo($link, $engine, "TINYINT", -11, "-11", 20); - func_mysqli_fetch_all_oo($link, $engine, "TINYINT", NULL, NULL, 30); - func_mysqli_fetch_all_oo($link, $engine, "TINYINT UNSIGNED", 1, "1", 40); - func_mysqli_fetch_all_oo($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50); - - func_mysqli_fetch_all_oo($link, $engine, "BOOL", 1, "1", 60); - func_mysqli_fetch_all_oo($link, $engine, "BOOL", NULL, NULL, 70); - func_mysqli_fetch_all_oo($link, $engine, "BOOLEAN", 0, "0", 80); - func_mysqli_fetch_all_oo($link, $engine, "BOOLEAN", NULL, NULL, 90); - - func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", -32768, "-32768", 100); - func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", 32767, "32767", 110); - func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", NULL, NULL, 120); - func_mysqli_fetch_all_oo($link, $engine, "SMALLINT UNSIGNED", 65400, "65400", 130); - func_mysqli_fetch_all_oo($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140); - - func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150); - func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", 8388607, "8388607", 160); - func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", NULL, NULL, 170); - func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180); - func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190); - - func_mysqli_fetch_all_oo($link, $engine, "INTEGER", -2147483648, "-2147483648", 200); - func_mysqli_fetch_all_oo($link, $engine, "INTEGER", 2147483647, "2147483647", 210); - func_mysqli_fetch_all_oo($link, $engine, "INTEGER", NULL, NULL, 220); - func_mysqli_fetch_all_oo($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230); - func_mysqli_fetch_all_oo($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240); - - func_mysqli_fetch_all_oo($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250); - func_mysqli_fetch_all_oo($link, $engine, "BIGINT", NULL, NULL, 260); - func_mysqli_fetch_all_oo($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270); - func_mysqli_fetch_all_oo($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280); - - func_mysqli_fetch_all_oo($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu"); - func_mysqli_fetch_all_oo($link, $engine, "FLOAT", NULL, NULL, 300); - func_mysqli_fetch_all_oo($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu"); - func_mysqli_fetch_all_oo($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320); - - func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330); - func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340); - func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350); - func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360); - - func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370); - func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380); - func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390); - func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400); - - // don't care about date() strict TZ warnings... - $date = @date('Y-m-d'); - func_mysqli_fetch_all_oo($link, $engine, "DATE", $date, $date, 410); - func_mysqli_fetch_all_oo($link, $engine, "DATE NOT NULL", $date, $date, 420); - func_mysqli_fetch_all_oo($link, $engine, "DATE", NULL, NULL, 430); - - $datetime = @date('Y-m-d H:i:s'); - func_mysqli_fetch_all_oo($link, $engine, "DATETIME", $datetime, $datetime, 440); - func_mysqli_fetch_all_oo($link, $engine, "DATETIME NOT NULL", $datetime, $datetime, 450); - func_mysqli_fetch_all_oo($link, $engine, "DATETIME", NULL, NULL, 460); - - func_mysqli_fetch_all_oo($link, $engine, "TIMESTAMP", $datetime, $datetime, 470); - - $time = @date('H:i:s'); - func_mysqli_fetch_all_oo($link, $engine, "TIME", $time, $time, 480); - func_mysqli_fetch_all_oo($link, $engine, "TIME NOT NULL", $time, $time, 490); - func_mysqli_fetch_all_oo($link, $engine, "TIME", NULL, NULL, 500); - - func_mysqli_fetch_all_oo($link, $engine, "YEAR", @date('Y'), @date('Y'), 510); - func_mysqli_fetch_all_oo($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520); - func_mysqli_fetch_all_oo($link, $engine, "YEAR", NULL, NULL, 530); - - $string255 = func_mysqli_fetch_array_oo_make_string(255); - func_mysqli_fetch_all_oo($link, $engine, "CHAR(1)", "a", "a", 540); - func_mysqli_fetch_all_oo($link, $engine, "CHAR(255)", $string255, $string255, 550); - func_mysqli_fetch_all_oo($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560); - func_mysqli_fetch_all_oo($link, $engine, "CHAR(1)", NULL, NULL, 570); - - $string65k = func_mysqli_fetch_array_oo_make_string(65400); - func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1)", "a", "a", 580); - func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(255)", $string255, $string255, 590); - func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600); - func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610); - func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1)", NULL, NULL, 620); - - func_mysqli_fetch_all_oo($link, $engine, "BINARY(1)", "a", "a", 630); - func_mysqli_fetch_all_oo($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640); - func_mysqli_fetch_all_oo($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650); - func_mysqli_fetch_all_oo($link, $engine, "BINARY(1)", NULL, NULL, 660); - - func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1)", "a", "a", 670); - func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680); - func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690); - func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1)", NULL, NULL, 700); - - func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", "a", "a", 710); - func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720); - func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730); - func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", NULL, NULL, 740); - - func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT", "a", "a", 750); - func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760); - func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT", NULL, NULL, 770); - - func_mysqli_fetch_all_oo($link, $engine, "BLOB", "a", "a", 780); - func_mysqli_fetch_all_oo($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780); - func_mysqli_fetch_all_oo($link, $engine, "BLOB", NULL, NULL, 790); - - func_mysqli_fetch_all_oo($link, $engine, "TEXT", "a", "a", 800); - func_mysqli_fetch_all_oo($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810); - func_mysqli_fetch_all_oo($link, $engine, "TEXT", NULL, NULL, 820); - - func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", "a", "a", 830); - func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840); - func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", NULL, NULL, 850); - - func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", "a", "a", 860); - func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870); - func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", NULL, NULL, 880); - - func_mysqli_fetch_all_oo($link, $engine, "LONGBLOB", "a", "a", 890); - func_mysqli_fetch_all_oo($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900); - func_mysqli_fetch_all_oo($link, $engine, "LONGBLOB", NULL, NULL, 910); - - func_mysqli_fetch_all_oo($link, $engine, "ENUM('a', 'b')", "a", "a", 920); - func_mysqli_fetch_all_oo($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930); - - func_mysqli_fetch_all_oo($link, $engine, "SET('a', 'b')", "a", "a", 940); - func_mysqli_fetch_all_oo($link, $engine, "SET('a', 'b')", NULL, NULL, 950); - - mysqli_close($link); + require_once("connect.inc"); + + $tmp = NULL; + $link = NULL; + + $mysqli = new mysqli(); + + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + require('table.inc'); + if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) { + printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + print "[005]\n"; + var_dump($res->fetch_all()); + $res->free_result(); + + if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) { + printf("[006] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + print "[007]\n"; + var_dump($res->fetch_all(MYSQLI_NUM)); + $res->free_result(); + + if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) { + printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + print "[008]\n"; + var_dump($res->fetch_all(MYSQLI_BOTH)); + $res->free_result(); + + if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) { + printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + print "[010]\n"; + var_dump($res->fetch_all(MYSQLI_ASSOC)); + + print "[011]\n"; + var_dump($res->fetch_array()); + $res->free_result(); + + if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) { + printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + print "[013]\n"; + var_dump($res->fetch_all(MYSQLI_ASSOC)); + + print "[016]\n"; + var_dump($res->fetch_array()); + + if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) { + printf("[010] Cannot run query, [%d] %s\n", $mysqli->errno, $$mysqli->error); + } + print "[017]\n"; + var_dump($res->fetch_all(MYSQLI_BOTH)); + + $res->free_result(); + if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) { + printf("[018] Cannot run query, [%d] %s\n", + $mysqli->errno, $$mysqli->error); + exit(1); + } + + do { + $illegal_mode = mt_rand(-10000, 10000); + } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH))); + // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes. + $tmp = $res->fetch_all($illegal_mode); + if (false !== $tmp) + printf("[019] Expecting boolean/false although, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, $mysqli->errno, $mysqli->error); + + $res->free_result(); + + function func_mysqli_fetch_all_oo($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) { + + if (!$link->query("DROP TABLE IF EXISTS test")) { + printf("[%04d] [%d] %s\n", $offset, $link->errno, $link->error); + return false; + } + + if (!$link->query($sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { + // don't bail, engine might not support the datatype + return false; + } + + if (is_null($php_value)) { + if (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) { + printf("[%04d] [%d] %s\n", $offset + 1, $link->errno, $link->error); + return false; + } + } else { + if (is_string($sql_value)) { + if (!$link->query($sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) { + printf("[%04ds] [%d] %s - %s\n", $offset + 1, $link->errno, $link->error, $sql); + return false; + } + } else { + if (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) { + printf("[%04di] [%d] %s\n", $offset + 1, $link->errno, $link->error); + return false; + } + } + } + + if (!$res = $link->query("SELECT id, label FROM test")) { + printf("[%04d] [%d] %s\n", $offset + 2, $link->errno, $link->error); + return false; + } + + if (!$tmp = $res->fetch_all(MYSQLI_BOTH)) { + printf("[%04d] [%d] %s\n", $offset + 3, $link->errno, $link->error); + return false; + } + $row = $tmp[0]; + + $fields = mysqli_fetch_fields($res); + + if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) { + if ($regexp_comparison) { + if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { + printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, + gettype($php_value), $php_value, $regexp_comparison, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], $link->errno, $link->error); + return false; + } + } else { + if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { + printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, + gettype($php_value), $php_value, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], $link->errno, $link->error); + return false; + } + } + } + + return true; + } + + function func_mysqli_fetch_array_oo_make_string($len) { + + $ret = ''; + for ($i = 0; $i < $len; $i++) + $ret .= chr(mt_rand(65, 90)); + + return $ret; + } + + func_mysqli_fetch_all_oo($link, $engine, "TINYINT", -11, "-11", 20); + func_mysqli_fetch_all_oo($link, $engine, "TINYINT", NULL, NULL, 30); + func_mysqli_fetch_all_oo($link, $engine, "TINYINT UNSIGNED", 1, "1", 40); + func_mysqli_fetch_all_oo($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50); + + func_mysqli_fetch_all_oo($link, $engine, "BOOL", 1, "1", 60); + func_mysqli_fetch_all_oo($link, $engine, "BOOL", NULL, NULL, 70); + func_mysqli_fetch_all_oo($link, $engine, "BOOLEAN", 0, "0", 80); + func_mysqli_fetch_all_oo($link, $engine, "BOOLEAN", NULL, NULL, 90); + + func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", -32768, "-32768", 100); + func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", 32767, "32767", 110); + func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", NULL, NULL, 120); + func_mysqli_fetch_all_oo($link, $engine, "SMALLINT UNSIGNED", 65400, "65400", 130); + func_mysqli_fetch_all_oo($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140); + + func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150); + func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", 8388607, "8388607", 160); + func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", NULL, NULL, 170); + func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180); + func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190); + + func_mysqli_fetch_all_oo($link, $engine, "INTEGER", -2147483648, "-2147483648", 200); + func_mysqli_fetch_all_oo($link, $engine, "INTEGER", 2147483647, "2147483647", 210); + func_mysqli_fetch_all_oo($link, $engine, "INTEGER", NULL, NULL, 220); + func_mysqli_fetch_all_oo($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230); + func_mysqli_fetch_all_oo($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240); + + func_mysqli_fetch_all_oo($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250); + func_mysqli_fetch_all_oo($link, $engine, "BIGINT", NULL, NULL, 260); + func_mysqli_fetch_all_oo($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270); + func_mysqli_fetch_all_oo($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280); + + func_mysqli_fetch_all_oo($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu"); + func_mysqli_fetch_all_oo($link, $engine, "FLOAT", NULL, NULL, 300); + func_mysqli_fetch_all_oo($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu"); + func_mysqli_fetch_all_oo($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320); + + func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330); + func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340); + func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350); + func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360); + + func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370); + func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380); + func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390); + func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400); + + // don't care about date() strict TZ warnings... + $date = @date('Y-m-d'); + func_mysqli_fetch_all_oo($link, $engine, "DATE", $date, $date, 410); + func_mysqli_fetch_all_oo($link, $engine, "DATE NOT NULL", $date, $date, 420); + func_mysqli_fetch_all_oo($link, $engine, "DATE", NULL, NULL, 430); + + $datetime = @date('Y-m-d H:i:s'); + func_mysqli_fetch_all_oo($link, $engine, "DATETIME", $datetime, $datetime, 440); + func_mysqli_fetch_all_oo($link, $engine, "DATETIME NOT NULL", $datetime, $datetime, 450); + func_mysqli_fetch_all_oo($link, $engine, "DATETIME", NULL, NULL, 460); + + func_mysqli_fetch_all_oo($link, $engine, "TIMESTAMP", $datetime, $datetime, 470); + + $time = @date('H:i:s'); + func_mysqli_fetch_all_oo($link, $engine, "TIME", $time, $time, 480); + func_mysqli_fetch_all_oo($link, $engine, "TIME NOT NULL", $time, $time, 490); + func_mysqli_fetch_all_oo($link, $engine, "TIME", NULL, NULL, 500); + + func_mysqli_fetch_all_oo($link, $engine, "YEAR", @date('Y'), @date('Y'), 510); + func_mysqli_fetch_all_oo($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520); + func_mysqli_fetch_all_oo($link, $engine, "YEAR", NULL, NULL, 530); + + $string255 = func_mysqli_fetch_array_oo_make_string(255); + func_mysqli_fetch_all_oo($link, $engine, "CHAR(1)", "a", "a", 540); + func_mysqli_fetch_all_oo($link, $engine, "CHAR(255)", $string255, $string255, 550); + func_mysqli_fetch_all_oo($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560); + func_mysqli_fetch_all_oo($link, $engine, "CHAR(1)", NULL, NULL, 570); + + $string65k = func_mysqli_fetch_array_oo_make_string(65400); + func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1)", "a", "a", 580); + func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(255)", $string255, $string255, 590); + func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600); + func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610); + func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1)", NULL, NULL, 620); + + func_mysqli_fetch_all_oo($link, $engine, "BINARY(1)", "a", "a", 630); + func_mysqli_fetch_all_oo($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640); + func_mysqli_fetch_all_oo($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650); + func_mysqli_fetch_all_oo($link, $engine, "BINARY(1)", NULL, NULL, 660); + + func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1)", "a", "a", 670); + func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680); + func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690); + func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1)", NULL, NULL, 700); + + func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", "a", "a", 710); + func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720); + func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730); + func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", NULL, NULL, 740); + + func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT", "a", "a", 750); + func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760); + func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT", NULL, NULL, 770); + + func_mysqli_fetch_all_oo($link, $engine, "BLOB", "a", "a", 780); + func_mysqli_fetch_all_oo($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780); + func_mysqli_fetch_all_oo($link, $engine, "BLOB", NULL, NULL, 790); + + func_mysqli_fetch_all_oo($link, $engine, "TEXT", "a", "a", 800); + func_mysqli_fetch_all_oo($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810); + func_mysqli_fetch_all_oo($link, $engine, "TEXT", NULL, NULL, 820); + + func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", "a", "a", 830); + func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840); + func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", NULL, NULL, 850); + + func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", "a", "a", 860); + func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870); + func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", NULL, NULL, 880); + + func_mysqli_fetch_all_oo($link, $engine, "LONGBLOB", "a", "a", 890); + func_mysqli_fetch_all_oo($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900); + func_mysqli_fetch_all_oo($link, $engine, "LONGBLOB", NULL, NULL, 910); + + func_mysqli_fetch_all_oo($link, $engine, "ENUM('a', 'b')", "a", "a", 920); + func_mysqli_fetch_all_oo($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930); + + func_mysqli_fetch_all_oo($link, $engine, "SET('a', 'b')", "a", "a", 940); + func_mysqli_fetch_all_oo($link, $engine, "SET('a', 'b')", NULL, NULL, 950); + + mysqli_close($link); try { $res->fetch_array(MYSQLI_ASSOC); @@ -304,7 +304,7 @@ if (!function_exists('mysqli_fetch_all')) echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_array.phpt b/ext/mysqli/tests/mysqli_fetch_array.phpt index 5e423aa2b9..fe1c6b94ca 100644 --- a/ext/mysqli/tests/mysqli_fetch_array.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array.phpt @@ -8,276 +8,276 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - require('table.inc'); - if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) { - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - print "[005]\n"; - var_dump(mysqli_fetch_array($res)); - - print "[006]\n"; - var_dump(mysqli_fetch_array($res, MYSQLI_NUM)); - - print "[007]\n"; - var_dump(mysqli_fetch_array($res, MYSQLI_BOTH)); - - print "[008]\n"; - var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC)); - - print "[009]\n"; - var_dump(mysqli_fetch_array($res)); - - mysqli_free_result($res); - - if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) { - printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), $mysqli_error($link)); - } - print "[011]\n"; - var_dump(mysqli_fetch_array($res, MYSQLI_BOTH)); - - mysqli_free_result($res); - if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) { - printf("[012] Cannot run query, [%d] %s\n", - mysqli_errno($link), $mysqli_error($link)); - exit(1); - } - - do { - $illegal_mode = mt_rand(-10000, 10000); - } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH))); - // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes. - $tmp = mysqli_fetch_array($res, $illegal_mode); - if (false !== $tmp) - printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - - $tmp = mysqli_fetch_array($res, $illegal_mode); - if (false !== $tmp) - printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - - mysqli_free_result($res); - - function func_mysqli_fetch_array($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL, $binary_type = false) { - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_query($link, $sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { - // don't bail, engine might not support the datatype - return false; - } - - if (is_null($php_value)) { - if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) { - printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); - return false; - } - } else { - if (is_string($sql_value)) { - if (!mysqli_query($link, $sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) { - printf("[%04ds] [%d] %s - %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link), $sql); - return false; - } - } else { - if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) { - printf("[%04di] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); - return false; - } - } - } - if (!$res = mysqli_query($link, "SELECT id, label FROM test")) { - printf("[%04d] [%d] %s\n", $offset + 2, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!$row = mysqli_fetch_array($res, MYSQLI_BOTH)) { - printf("[%04d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if ($regexp_comparison) { - if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { - printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, - gettype($php_value), $php_value, $regexp_comparison, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); - return false; - } - } else if ((gettype($php_value) == 'unicode') && $binary_type) { - // Unicode is on and we are told that the MySQL column type is a binary type. - // Don't expect a unicode value from the database, you'll get binary string - if (($row['label'] != $php_value) || ($row[1] != $php_value)) { - printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 5, - gettype($php_value), $php_value, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); - return false; - } - if (gettype($row['label']) == 'unicode') { - var_dump(mysqli_fetch_field_direct($res, 1), $row['label']); - printf("[%04d] SQL Type: '%s', binary columns are supposed to return binary string and not unicode\n", - $offset + 6, $sql_type); - return false; - } - } else { - if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { - printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 7, - gettype($php_value), $php_value, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); - return false; - } - } - return true; - } - - function func_mysqli_fetch_array_make_string($len) { - - $ret = ''; - for ($i = 0; $i < $len; $i++) - $ret .= chr(mt_rand(65, 90)); - - return $ret; - } - - func_mysqli_fetch_array($link, $engine, "TINYINT", -11, "-11", 20); - func_mysqli_fetch_array($link, $engine, "TINYINT", NULL, NULL, 30); - func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", 1, "1", 40); - func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50); - - func_mysqli_fetch_array($link, $engine, "BOOL", 1, "1", 60); - func_mysqli_fetch_array($link, $engine, "BOOL", NULL, NULL, 70); - func_mysqli_fetch_array($link, $engine, "BOOLEAN", 0, "0", 80); - func_mysqli_fetch_array($link, $engine, "BOOLEAN", NULL, NULL, 90); - - func_mysqli_fetch_array($link, $engine, "SMALLINT", -32768, "-32768", 100); - func_mysqli_fetch_array($link, $engine, "SMALLINT", 32767, "32767", 110); - func_mysqli_fetch_array($link, $engine, "SMALLINT", NULL, NULL, 120); - func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130); - func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140); - - func_mysqli_fetch_array($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150); - func_mysqli_fetch_array($link, $engine, "MEDIUMINT", 8388607, "8388607", 160); - func_mysqli_fetch_array($link, $engine, "MEDIUMINT", NULL, NULL, 170); - func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180); - func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190); - - func_mysqli_fetch_array($link, $engine, "INTEGER", -2147483648, "-2147483648", 200); - func_mysqli_fetch_array($link, $engine, "INTEGER", 2147483647, "2147483647", 210); - func_mysqli_fetch_array($link, $engine, "INTEGER", NULL, NULL, 220); - func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230); - func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240); - - if ($IS_MYSQLND || - ((mysqli_get_server_version($link) >= 51000) && - (mysqli_get_client_version($link) >= 51000))) { - func_mysqli_fetch_array($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250); - func_mysqli_fetch_array($link, $engine, "BIGINT", NULL, NULL, 260); - func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 260); - func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280); - } - - func_mysqli_fetch_array($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu"); - func_mysqli_fetch_array($link, $engine, "FLOAT", NULL, NULL, 300); - func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu"); - func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320); - - func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330); - func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340); - func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350); - func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360); - - func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370); - func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380); - func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390); - func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400); - - // don't care about date() strict TZ warnings... - $date = @date('Y-m-d'); - func_mysqli_fetch_array($link, $engine, "DATE",$date, $date, 410); - func_mysqli_fetch_array($link, $engine, "DATE NOT NULL",$date, $date, 420); - func_mysqli_fetch_array($link, $engine, "DATE", NULL, NULL, 430); - - $date = @date('Y-m-d H:i:s'); - func_mysqli_fetch_array($link, $engine, "DATETIME", $date, $date, 440); - func_mysqli_fetch_array($link, $engine, "DATETIME NOT NULL", $date, $date, 450); - func_mysqli_fetch_array($link, $engine, "DATETIME", NULL, NULL, 460); - func_mysqli_fetch_array($link, $engine, "TIMESTAMP", $date, $date, 470); - - $date = @date('H:i:s'); - func_mysqli_fetch_array($link, $engine, "TIME", $date, $date, 480); - func_mysqli_fetch_array($link, $engine, "TIME NOT NULL", $date, $date, 490); - func_mysqli_fetch_array($link, $engine, "TIME", NULL, NULL, 500); - - func_mysqli_fetch_array($link, $engine, "YEAR", @date('Y'), @date('Y'), 510); - func_mysqli_fetch_array($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520); - func_mysqli_fetch_array($link, $engine, "YEAR", NULL, NULL, 530); - - $string255 = func_mysqli_fetch_array_make_string(255); - func_mysqli_fetch_array($link, $engine, "CHAR(1)", "a", "a", 540); - func_mysqli_fetch_array($link, $engine, "CHAR(255)", $string255, $string255, 550); - func_mysqli_fetch_array($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560); - func_mysqli_fetch_array($link, $engine, "CHAR(1)", NULL, NULL, 570); - - $string65k = func_mysqli_fetch_array_make_string(65400); - func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", "a", "a", 580); - func_mysqli_fetch_array($link, $engine, "VARCHAR(255)", $string255, $string255, 590); - func_mysqli_fetch_array($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600); - func_mysqli_fetch_array($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610); - func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", NULL, NULL, 620); - - func_mysqli_fetch_array($link, $engine, "BINARY(1)", "a", "a", 630, null, true); - func_mysqli_fetch_array($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640, null, true); - func_mysqli_fetch_array($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650, null, true); - func_mysqli_fetch_array($link, $engine, "BINARY(1)", NULL, NULL, 660, null, true); - - func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", "a", "a", 670, null, true); - func_mysqli_fetch_array($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680, null, true); - func_mysqli_fetch_array($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690, null, true); - func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", NULL, NULL, 700, null, true); - - func_mysqli_fetch_array($link, $engine, "TINYBLOB", "a", "a", 710, null, true); - func_mysqli_fetch_array($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720, null, true); - func_mysqli_fetch_array($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730, null, true); - func_mysqli_fetch_array($link, $engine, "TINYBLOB", NULL, NULL, 740, null, true); - - func_mysqli_fetch_array($link, $engine, "TINYTEXT", "a", "a", 750); - func_mysqli_fetch_array($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760); - func_mysqli_fetch_array($link, $engine, "TINYTEXT", NULL, NULL, 770); - - func_mysqli_fetch_array($link, $engine, "BLOB", "a", "a", 780, null, true); - func_mysqli_fetch_array($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780, null, true); - func_mysqli_fetch_array($link, $engine, "BLOB", NULL, NULL, 790, null, true); - - func_mysqli_fetch_array($link, $engine, "TEXT", "a", "a", 800); - func_mysqli_fetch_array($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810); - func_mysqli_fetch_array($link, $engine, "TEXT", NULL, NULL, 820); - - func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", "a", "a", 830, null, true); - func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840, null, true); - func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", NULL, NULL, 850, null, true); - - func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", "a", "a", 860); - func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870); - func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", NULL, NULL, 880); - - func_mysqli_fetch_array($link, $engine, "LONGBLOB", "a", "a", 890, null, true); - func_mysqli_fetch_array($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900); - func_mysqli_fetch_array($link, $engine, "LONGBLOB", NULL, NULL, 910, null, true); - - func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", "a", "a", 920); - func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930); - - func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", "a", "a", 940); - func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", NULL, NULL, 950); - - mysqli_close($link); + require_once("connect.inc"); + + require('table.inc'); + if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) { + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + print "[005]\n"; + var_dump(mysqli_fetch_array($res)); + + print "[006]\n"; + var_dump(mysqli_fetch_array($res, MYSQLI_NUM)); + + print "[007]\n"; + var_dump(mysqli_fetch_array($res, MYSQLI_BOTH)); + + print "[008]\n"; + var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC)); + + print "[009]\n"; + var_dump(mysqli_fetch_array($res)); + + mysqli_free_result($res); + + if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) { + printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), $mysqli_error($link)); + } + print "[011]\n"; + var_dump(mysqli_fetch_array($res, MYSQLI_BOTH)); + + mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) { + printf("[012] Cannot run query, [%d] %s\n", + mysqli_errno($link), $mysqli_error($link)); + exit(1); + } + + do { + $illegal_mode = mt_rand(-10000, 10000); + } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH))); + // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes. + $tmp = mysqli_fetch_array($res, $illegal_mode); + if (false !== $tmp) + printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + + $tmp = mysqli_fetch_array($res, $illegal_mode); + if (false !== $tmp) + printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + + mysqli_free_result($res); + + function func_mysqli_fetch_array($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL, $binary_type = false) { + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { + printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_query($link, $sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { + // don't bail, engine might not support the datatype + return false; + } + + if (is_null($php_value)) { + if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) { + printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); + return false; + } + } else { + if (is_string($sql_value)) { + if (!mysqli_query($link, $sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) { + printf("[%04ds] [%d] %s - %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link), $sql); + return false; + } + } else { + if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) { + printf("[%04di] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); + return false; + } + } + } + if (!$res = mysqli_query($link, "SELECT id, label FROM test")) { + printf("[%04d] [%d] %s\n", $offset + 2, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!$row = mysqli_fetch_array($res, MYSQLI_BOTH)) { + printf("[%04d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if ($regexp_comparison) { + if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { + printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, + gettype($php_value), $php_value, $regexp_comparison, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); + return false; + } + } else if ((gettype($php_value) == 'unicode') && $binary_type) { + // Unicode is on and we are told that the MySQL column type is a binary type. + // Don't expect a unicode value from the database, you'll get binary string + if (($row['label'] != $php_value) || ($row[1] != $php_value)) { + printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 5, + gettype($php_value), $php_value, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); + return false; + } + if (gettype($row['label']) == 'unicode') { + var_dump(mysqli_fetch_field_direct($res, 1), $row['label']); + printf("[%04d] SQL Type: '%s', binary columns are supposed to return binary string and not unicode\n", + $offset + 6, $sql_type); + return false; + } + } else { + if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { + printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 7, + gettype($php_value), $php_value, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); + return false; + } + } + return true; + } + + function func_mysqli_fetch_array_make_string($len) { + + $ret = ''; + for ($i = 0; $i < $len; $i++) + $ret .= chr(mt_rand(65, 90)); + + return $ret; + } + + func_mysqli_fetch_array($link, $engine, "TINYINT", -11, "-11", 20); + func_mysqli_fetch_array($link, $engine, "TINYINT", NULL, NULL, 30); + func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", 1, "1", 40); + func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50); + + func_mysqli_fetch_array($link, $engine, "BOOL", 1, "1", 60); + func_mysqli_fetch_array($link, $engine, "BOOL", NULL, NULL, 70); + func_mysqli_fetch_array($link, $engine, "BOOLEAN", 0, "0", 80); + func_mysqli_fetch_array($link, $engine, "BOOLEAN", NULL, NULL, 90); + + func_mysqli_fetch_array($link, $engine, "SMALLINT", -32768, "-32768", 100); + func_mysqli_fetch_array($link, $engine, "SMALLINT", 32767, "32767", 110); + func_mysqli_fetch_array($link, $engine, "SMALLINT", NULL, NULL, 120); + func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130); + func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140); + + func_mysqli_fetch_array($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150); + func_mysqli_fetch_array($link, $engine, "MEDIUMINT", 8388607, "8388607", 160); + func_mysqli_fetch_array($link, $engine, "MEDIUMINT", NULL, NULL, 170); + func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180); + func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190); + + func_mysqli_fetch_array($link, $engine, "INTEGER", -2147483648, "-2147483648", 200); + func_mysqli_fetch_array($link, $engine, "INTEGER", 2147483647, "2147483647", 210); + func_mysqli_fetch_array($link, $engine, "INTEGER", NULL, NULL, 220); + func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230); + func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240); + + if ($IS_MYSQLND || + ((mysqli_get_server_version($link) >= 51000) && + (mysqli_get_client_version($link) >= 51000))) { + func_mysqli_fetch_array($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250); + func_mysqli_fetch_array($link, $engine, "BIGINT", NULL, NULL, 260); + func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 260); + func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280); + } + + func_mysqli_fetch_array($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu"); + func_mysqli_fetch_array($link, $engine, "FLOAT", NULL, NULL, 300); + func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu"); + func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320); + + func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330); + func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340); + func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350); + func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360); + + func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370); + func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380); + func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390); + func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400); + + // don't care about date() strict TZ warnings... + $date = @date('Y-m-d'); + func_mysqli_fetch_array($link, $engine, "DATE",$date, $date, 410); + func_mysqli_fetch_array($link, $engine, "DATE NOT NULL",$date, $date, 420); + func_mysqli_fetch_array($link, $engine, "DATE", NULL, NULL, 430); + + $date = @date('Y-m-d H:i:s'); + func_mysqli_fetch_array($link, $engine, "DATETIME", $date, $date, 440); + func_mysqli_fetch_array($link, $engine, "DATETIME NOT NULL", $date, $date, 450); + func_mysqli_fetch_array($link, $engine, "DATETIME", NULL, NULL, 460); + func_mysqli_fetch_array($link, $engine, "TIMESTAMP", $date, $date, 470); + + $date = @date('H:i:s'); + func_mysqli_fetch_array($link, $engine, "TIME", $date, $date, 480); + func_mysqli_fetch_array($link, $engine, "TIME NOT NULL", $date, $date, 490); + func_mysqli_fetch_array($link, $engine, "TIME", NULL, NULL, 500); + + func_mysqli_fetch_array($link, $engine, "YEAR", @date('Y'), @date('Y'), 510); + func_mysqli_fetch_array($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520); + func_mysqli_fetch_array($link, $engine, "YEAR", NULL, NULL, 530); + + $string255 = func_mysqli_fetch_array_make_string(255); + func_mysqli_fetch_array($link, $engine, "CHAR(1)", "a", "a", 540); + func_mysqli_fetch_array($link, $engine, "CHAR(255)", $string255, $string255, 550); + func_mysqli_fetch_array($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560); + func_mysqli_fetch_array($link, $engine, "CHAR(1)", NULL, NULL, 570); + + $string65k = func_mysqli_fetch_array_make_string(65400); + func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", "a", "a", 580); + func_mysqli_fetch_array($link, $engine, "VARCHAR(255)", $string255, $string255, 590); + func_mysqli_fetch_array($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600); + func_mysqli_fetch_array($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610); + func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", NULL, NULL, 620); + + func_mysqli_fetch_array($link, $engine, "BINARY(1)", "a", "a", 630, null, true); + func_mysqli_fetch_array($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640, null, true); + func_mysqli_fetch_array($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650, null, true); + func_mysqli_fetch_array($link, $engine, "BINARY(1)", NULL, NULL, 660, null, true); + + func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", "a", "a", 670, null, true); + func_mysqli_fetch_array($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680, null, true); + func_mysqli_fetch_array($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690, null, true); + func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", NULL, NULL, 700, null, true); + + func_mysqli_fetch_array($link, $engine, "TINYBLOB", "a", "a", 710, null, true); + func_mysqli_fetch_array($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720, null, true); + func_mysqli_fetch_array($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730, null, true); + func_mysqli_fetch_array($link, $engine, "TINYBLOB", NULL, NULL, 740, null, true); + + func_mysqli_fetch_array($link, $engine, "TINYTEXT", "a", "a", 750); + func_mysqli_fetch_array($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760); + func_mysqli_fetch_array($link, $engine, "TINYTEXT", NULL, NULL, 770); + + func_mysqli_fetch_array($link, $engine, "BLOB", "a", "a", 780, null, true); + func_mysqli_fetch_array($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780, null, true); + func_mysqli_fetch_array($link, $engine, "BLOB", NULL, NULL, 790, null, true); + + func_mysqli_fetch_array($link, $engine, "TEXT", "a", "a", 800); + func_mysqli_fetch_array($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810); + func_mysqli_fetch_array($link, $engine, "TEXT", NULL, NULL, 820); + + func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", "a", "a", 830, null, true); + func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840, null, true); + func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", NULL, NULL, 850, null, true); + + func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", "a", "a", 860); + func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870); + func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", NULL, NULL, 880); + + func_mysqli_fetch_array($link, $engine, "LONGBLOB", "a", "a", 890, null, true); + func_mysqli_fetch_array($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900); + func_mysqli_fetch_array($link, $engine, "LONGBLOB", NULL, NULL, 910, null, true); + + func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", "a", "a", 920); + func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930); + + func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", "a", "a", 940); + func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", NULL, NULL, 950); + + mysqli_close($link); try { mysqli_fetch_array($res, MYSQLI_ASSOC); @@ -285,7 +285,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --EXPECTF-- [005] diff --git a/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt b/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt index 4701926d6c..6899c0bfba 100644 --- a/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt @@ -8,24 +8,24 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('table.inc'); + require('table.inc'); - if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) { - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "[002]\n"; - var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC)); - mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) { + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[002]\n"; + var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC)); + mysqli_free_result($res); - if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 5")) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "[004]\n"; - var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC)); - mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 5")) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[004]\n"; + var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC)); + mysqli_free_result($res); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_array_large.phpt b/ext/mysqli/tests/mysqli_fetch_array_large.phpt index 3c6a0f03f3..59d5669126 100644 --- a/ext/mysqli/tests/mysqli_fetch_array_large.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array_large.phpt @@ -9,155 +9,155 @@ require_once('skipifconnectfailure.inc'); memory_limit=-1 --FILE-- <?php - require_once("connect.inc"); - - function mysqli_fetch_array_large($offset, $link, $package_size) { - - /* we are aiming for maximum compression to test MYSQLI_CLIENT_COMPRESS */ - $random_char = str_repeat('a', 255); - $sql = "INSERT INTO test(label) VALUES "; - - while (strlen($sql) < ($package_size - 259)) - $sql .= sprintf("('%s'), ", $random_char); - - $sql = substr($sql, 0, -2); - $len = strlen($sql); - assert($len < $package_size); - - if (!@mysqli_query($link, $sql)) { - if (1153 == mysqli_errno($link) || 2006 == mysqli_errno($link) || stristr(mysqli_error($link), 'max_allowed_packet')) - /* - myslqnd - [1153] Got a packet bigger than 'max_allowed_packet' bytes - libmysql -[2006] MySQL server has gone away - */ - return false; - - printf("[%03d + 1] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link)); - return false; - } - - /* buffered result set - let's hope we do not run into PHP memory limit... */ - if (!$res = mysqli_query($link, "SELECT id, label FROM test")) { - printf("[%03d + 2] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link)); - return false; - } - - while ($row = mysqli_fetch_assoc($res)) { - if ($row['label'] != $random_char) { - printf("[%03d + 3] Wrong results - expecting '%s' got '%s', len = %d, [%d] %s\n", - $offset, $random_char, $row['label'], $len, mysqli_errno($link), mysqli_error($link)); - return false; - } - } - mysqli_free_result($res); - - if (!$stmt = mysqli_prepare($link, "SELECT id, label FROM test")) { - printf("[%03d + 4] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link)); - return false; - } - - /* unbuffered result set */ - if (!mysqli_stmt_execute($stmt)) { - printf("[%03d + 5] len = %d, [%d] %s, [%d] %s\n", $offset, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), mysqli_errno($link), mysqli_error($link)); - return false; - } - - $id = $label = NULL; - if (!mysqli_stmt_bind_result($stmt, $id, $label)) { - printf("[%03d + 6] len = %d, [%d] %s, [%d] %s\n", $offset, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), mysqli_errno($link), mysqli_error($link)); - return false; - } - - while (mysqli_stmt_fetch($stmt)) { - if ($label != $random_char) { - printf("[%03d + 7] Wrong results - expecting '%s' got '%s', len = %d, [%d] %s\n", - $offset, $random_char, $label, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - } - - mysqli_stmt_free_result($stmt); - mysqli_stmt_close($stmt); - - return true; - } - - function parse_memory_limit($limit) { - - $val = trim($limit); - $last = strtolower($val[strlen($val)-1]); - - switch($last) { - // The 'G' modifier is available since PHP 5.1.0 - case 'g': - $val *= 1024; - case 'm': - $val *= 1024; - case 'k': - $val *= 1024; - default: - break; - } - return $val; - } - - - function test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, $flags = null) { - - $link = mysqli_init(); - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - return false; - } - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || - !mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, label VARCHAR(255)) ENGINE = %s", $engine))) { - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - return false; - } - - $package_size = 524288; - $offset = 3; - $limit = (ini_get('memory_limit') > 0) ? parse_memory_limit(ini_get('memory_limit')) : pow(2, 32); - - /* try to respect php.ini but make run time a soft limit */ - $max_runtime = (ini_get('max_execution_time') > 0) ? ini_get('max_execution_time') : 30; - set_time_limit(0); - - do { - if ($package_size > $limit) { - printf("stop: memory limit - %s vs. %s\n", $package_size, $limit); - break; - } - - $start = microtime(true); - if (!mysqli_fetch_array_large($offset++, $link, $package_size)) { - printf("stop: packet size - %d\n", $package_size); - break; - } - - $duration = microtime(true) - $start; - $max_runtime -= $duration; - if ($max_runtime < ($duration * 3)) { - /* likely the next iteration will not be within max_execution_time */ - printf("stop: time limit - %2.2fs\n", $max_runtime); - break; - } - - $package_size += $package_size; - - } while (true); - - - mysqli_close($link); - return true; - } - - - test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, null); - test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, MYSQLI_CLIENT_COMPRESS); - print "done!"; + require_once("connect.inc"); + + function mysqli_fetch_array_large($offset, $link, $package_size) { + + /* we are aiming for maximum compression to test MYSQLI_CLIENT_COMPRESS */ + $random_char = str_repeat('a', 255); + $sql = "INSERT INTO test(label) VALUES "; + + while (strlen($sql) < ($package_size - 259)) + $sql .= sprintf("('%s'), ", $random_char); + + $sql = substr($sql, 0, -2); + $len = strlen($sql); + assert($len < $package_size); + + if (!@mysqli_query($link, $sql)) { + if (1153 == mysqli_errno($link) || 2006 == mysqli_errno($link) || stristr(mysqli_error($link), 'max_allowed_packet')) + /* + myslqnd - [1153] Got a packet bigger than 'max_allowed_packet' bytes + libmysql -[2006] MySQL server has gone away + */ + return false; + + printf("[%03d + 1] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link)); + return false; + } + + /* buffered result set - let's hope we do not run into PHP memory limit... */ + if (!$res = mysqli_query($link, "SELECT id, label FROM test")) { + printf("[%03d + 2] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link)); + return false; + } + + while ($row = mysqli_fetch_assoc($res)) { + if ($row['label'] != $random_char) { + printf("[%03d + 3] Wrong results - expecting '%s' got '%s', len = %d, [%d] %s\n", + $offset, $random_char, $row['label'], $len, mysqli_errno($link), mysqli_error($link)); + return false; + } + } + mysqli_free_result($res); + + if (!$stmt = mysqli_prepare($link, "SELECT id, label FROM test")) { + printf("[%03d + 4] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link)); + return false; + } + + /* unbuffered result set */ + if (!mysqli_stmt_execute($stmt)) { + printf("[%03d + 5] len = %d, [%d] %s, [%d] %s\n", $offset, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), mysqli_errno($link), mysqli_error($link)); + return false; + } + + $id = $label = NULL; + if (!mysqli_stmt_bind_result($stmt, $id, $label)) { + printf("[%03d + 6] len = %d, [%d] %s, [%d] %s\n", $offset, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), mysqli_errno($link), mysqli_error($link)); + return false; + } + + while (mysqli_stmt_fetch($stmt)) { + if ($label != $random_char) { + printf("[%03d + 7] Wrong results - expecting '%s' got '%s', len = %d, [%d] %s\n", + $offset, $random_char, $label, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + } + + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + + return true; + } + + function parse_memory_limit($limit) { + + $val = trim($limit); + $last = strtolower($val[strlen($val)-1]); + + switch($last) { + // The 'G' modifier is available since PHP 5.1.0 + case 'g': + $val *= 1024; + case 'm': + $val *= 1024; + case 'k': + $val *= 1024; + default: + break; + } + return $val; + } + + + function test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, $flags = null) { + + $link = mysqli_init(); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags)) { + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + return false; + } + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || + !mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, label VARCHAR(255)) ENGINE = %s", $engine))) { + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + return false; + } + + $package_size = 524288; + $offset = 3; + $limit = (ini_get('memory_limit') > 0) ? parse_memory_limit(ini_get('memory_limit')) : pow(2, 32); + + /* try to respect php.ini but make run time a soft limit */ + $max_runtime = (ini_get('max_execution_time') > 0) ? ini_get('max_execution_time') : 30; + set_time_limit(0); + + do { + if ($package_size > $limit) { + printf("stop: memory limit - %s vs. %s\n", $package_size, $limit); + break; + } + + $start = microtime(true); + if (!mysqli_fetch_array_large($offset++, $link, $package_size)) { + printf("stop: packet size - %d\n", $package_size); + break; + } + + $duration = microtime(true) - $start; + $max_runtime -= $duration; + if ($max_runtime < ($duration * 3)) { + /* likely the next iteration will not be within max_execution_time */ + printf("stop: time limit - %2.2fs\n", $max_runtime); + break; + } + + $package_size += $package_size; + + } while (true); + + + mysqli_close($link); + return true; + } + + + test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, null); + test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, MYSQLI_CLIENT_COMPRESS); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt b/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt index d372ef5574..5f86e3739a 100644 --- a/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt @@ -8,104 +8,104 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require("table.inc"); - - // do as much as we can do in 5 seconds - $start = microtime(true); - for ($id = 100, $start = microtime(true); (microtime(true) - $start) < 5; $id++) { - if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, '%s')", - $id, mysqli_real_escape_string($link, chr(65 + ($id % 26)))))) { - printf("[001] %s failed: [%d] %s\n", $sql, mysqli_errno($link), mysqli_error($link)); - break; - } - } - - if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) { - printf("[002] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link)); - } - - while ($row = mysqli_fetch_array($res)) { - // overwrite results and check if the cache magic works - $row['label'] = NULL; - } - mysqli_free_result($res); - - if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) { - printf("[003] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link)); - } - - $i = 0; - $results = array(); - while ($row = mysqli_fetch_array($res, MYSQLI_BOTH)) { - - // create copies and destroy later - $results[$i++] = &$row; - if ($i % 999) { - $results = array(); - } - - if ($row[0] < 0 || $row[0] > $id) { - printf("[004] Unexpected result row[0] = '%s' (range 0...%d), [%d] %s\n", - $row[0], $id, mysqli_errno($link), mysqli_error($link)); - break; - } - if ($row[0] !== $row['id']) { - printf("[005] Unexpected result row[0] = '%s', row[id] = '%s', [%d] %s\n", - $row[0], $row[id], mysqli_errno($link), mysqli_error($link)); - break; - } - - $len = strlen($row[1]); - if (!is_string($row[1]) || $len == 0 || $len > 1) { - printf("[006] Unexpected result row[1] = '%s', [%d] %s\n", - $row[1], mysqli_errno($link), mysqli_error($link)); - break; - } - if ($row[1] !== $row['label']) { - printf("[007] Unexpected result row[1] = '%s', row[label] = '%s', [%d] %s\n", - $row[1], $row['label'], mysqli_errno($link), mysqli_error($link)); - break; - } - - } - mysqli_free_result($res); - - if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) { - printf("[008] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link)); - } - - while ($row = mysqli_fetch_array($res, MYSQLI_ASSOC)) { - // overwrite results and check if the cache magic works - $row['label'] = NULL; - } - mysqli_free_result($res); - - if (!$res = mysqli_query($link, 'SELECT count(*) AS num FROM test')) { - printf("[009] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link)); - } - $row = mysqli_fetch_assoc($res); - $num = $row['num']; - mysqli_free_result($res); - - if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) { - printf("[010] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link)); - } - - $i = 0; - while ($row = mysqli_fetch_array($res, MYSQLI_NUM)) { - // overwrite results and check if the cache magic works - $row[0] = NULL; - $i++; - } - mysqli_free_result($res); - - if ($i != $num) - printf("[011] Expecting %d results, got %d results, [%d] %s\n", - $num, $i, mysqli_errno($link), mysqli_error($link)); - - mysqli_close($link); - - print "done!"; + require("table.inc"); + + // do as much as we can do in 5 seconds + $start = microtime(true); + for ($id = 100, $start = microtime(true); (microtime(true) - $start) < 5; $id++) { + if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, '%s')", + $id, mysqli_real_escape_string($link, chr(65 + ($id % 26)))))) { + printf("[001] %s failed: [%d] %s\n", $sql, mysqli_errno($link), mysqli_error($link)); + break; + } + } + + if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) { + printf("[002] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link)); + } + + while ($row = mysqli_fetch_array($res)) { + // overwrite results and check if the cache magic works + $row['label'] = NULL; + } + mysqli_free_result($res); + + if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) { + printf("[003] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link)); + } + + $i = 0; + $results = array(); + while ($row = mysqli_fetch_array($res, MYSQLI_BOTH)) { + + // create copies and destroy later + $results[$i++] = &$row; + if ($i % 999) { + $results = array(); + } + + if ($row[0] < 0 || $row[0] > $id) { + printf("[004] Unexpected result row[0] = '%s' (range 0...%d), [%d] %s\n", + $row[0], $id, mysqli_errno($link), mysqli_error($link)); + break; + } + if ($row[0] !== $row['id']) { + printf("[005] Unexpected result row[0] = '%s', row[id] = '%s', [%d] %s\n", + $row[0], $row[id], mysqli_errno($link), mysqli_error($link)); + break; + } + + $len = strlen($row[1]); + if (!is_string($row[1]) || $len == 0 || $len > 1) { + printf("[006] Unexpected result row[1] = '%s', [%d] %s\n", + $row[1], mysqli_errno($link), mysqli_error($link)); + break; + } + if ($row[1] !== $row['label']) { + printf("[007] Unexpected result row[1] = '%s', row[label] = '%s', [%d] %s\n", + $row[1], $row['label'], mysqli_errno($link), mysqli_error($link)); + break; + } + + } + mysqli_free_result($res); + + if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) { + printf("[008] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link)); + } + + while ($row = mysqli_fetch_array($res, MYSQLI_ASSOC)) { + // overwrite results and check if the cache magic works + $row['label'] = NULL; + } + mysqli_free_result($res); + + if (!$res = mysqli_query($link, 'SELECT count(*) AS num FROM test')) { + printf("[009] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link)); + } + $row = mysqli_fetch_assoc($res); + $num = $row['num']; + mysqli_free_result($res); + + if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) { + printf("[010] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link)); + } + + $i = 0; + while ($row = mysqli_fetch_array($res, MYSQLI_NUM)) { + // overwrite results and check if the cache magic works + $row[0] = NULL; + $i++; + } + mysqli_free_result($res); + + if ($i != $num) + printf("[011] Expecting %d results, got %d results, [%d] %s\n", + $num, $i, mysqli_errno($link), mysqli_error($link)); + + mysqli_close($link); + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt index b3e8dda9c4..616be43e8b 100644 --- a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt @@ -8,268 +8,268 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - $tmp = NULL; - $link = NULL; - - require('table.inc'); - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 5")) { - printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - print "[005]\n"; - var_dump($res->fetch_array()); - - print "[006]\n"; - var_dump($res->fetch_array(MYSQLI_NUM)); - - print "[007]\n"; - var_dump($res->fetch_array(MYSQLI_BOTH)); - - print "[008]\n"; - var_dump($res->fetch_array(MYSQLI_ASSOC)); - - print "[009]\n"; - var_dump($res->fetch_array()); - - $res->free_result(); - - if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) { - printf("[010] Cannot run query, [%d] %s\n", $mysqli->errno, $$mysqli->error); - } - print "[011]\n"; - var_dump($res->fetch_array(MYSQLI_BOTH)); - - $res->free_result(); - if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) { - printf("[012] Cannot run query, [%d] %s\n", - $mysqli->errno, $$mysqli->error); - exit(1); - } - - do { - $illegal_mode = mt_rand(-10000, 10000); - } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH))); - // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes. - $tmp = $res->fetch_array($illegal_mode); - if (false !== $tmp) - printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, $mysqli->errno, $mysqli->error); - - $tmp = $res->fetch_array($illegal_mode); - if (false !== $tmp) - printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, $mysqli->errno, $mysqli->error); - - $res->free_result(); - - function func_mysqli_fetch_array($mysqli, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) { - - if (!$mysqli->query("DROP TABLE IF EXISTS test")) { - printf("[%04d] [%d] %s\n", $offset, $mysqli->errno, $mysqli->error); - return false; - } - - if (!$mysqli->query($sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { - // don't bail, engine might not support the datatype - return false; - } - - if (is_null($php_value)) { - if (!$mysqli->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) { - printf("[%04d] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error); - return false; - } - } else { - if (is_string($sql_value)) { - if (!$mysqli->query($sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) { - printf("[%04ds] [%d] %s - %s\n", $offset + 1, $mysqli->errno, $mysqli->error, $sql); - return false; - } - } else { - if (!$mysqli->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) { - printf("[%04di] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error); - return false; - } - } - } - - if (!$res = $mysqli->query("SELECT id, label FROM test")) { - printf("[%04d] [%d] %s\n", $offset + 2, $mysqli->errno, $mysqli->error); - return false; - } - - if (!$row = $res->fetch_array(MYSQLI_BOTH)) { - printf("[%04d] [%d] %s\n", $offset + 3, $mysqli->errno, $mysqli->error); - return false; - } - $fields = mysqli_fetch_fields($res); - - if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) { - if ($regexp_comparison) { - if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { - printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, - gettype($php_value), $php_value, $regexp_comparison, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], $mysqli->errno, $mysqli->error); - return false; - } - } else { - if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { - printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, - gettype($php_value), $php_value, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], $mysqli->errno, $mysqli->error); - return false; - } - } - } - return true; - } - - function func_mysqli_fetch_array_make_string($len) { - - $ret = ''; - for ($i = 0; $i < $len; $i++) - $ret .= chr(mt_rand(65, 90)); - - return $ret; - } - - func_mysqli_fetch_array($mysqli, $engine, "TINYINT", -11, "-11", 20); - func_mysqli_fetch_array($mysqli, $engine, "TINYINT", NULL, NULL, 30); - func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", 1, "1", 40); - func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", NULL, NULL, 50); - - func_mysqli_fetch_array($mysqli, $engine, "BOOL", 1, "1", 60); - func_mysqli_fetch_array($mysqli, $engine, "BOOL", NULL, NULL, 70); - func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", 0, "0", 80); - func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", NULL, NULL, 90); - - func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", -32768, "-32768", 100); - func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", 32767, "32767", 110); - func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", NULL, NULL, 120); - func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130); - func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140); - - func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", -8388608, "-8388608", 150); - func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", 8388607, "8388607", 160); - func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", NULL, NULL, 170); - func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180); - func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190); - - func_mysqli_fetch_array($mysqli, $engine, "INTEGER", -2147483648, "-2147483648", 200); - func_mysqli_fetch_array($mysqli, $engine, "INTEGER", 2147483647, "2147483647", 210); - func_mysqli_fetch_array($mysqli, $engine, "INTEGER", NULL, NULL, 220); - func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230); - func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", NULL, NULL, 240); - - if ($IS_MYSQLND || - ((mysqli_get_server_version($link) >= 51000) && - (mysqli_get_client_version($link) >= 51000))) { - func_mysqli_fetch_array($mysqli, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250); - func_mysqli_fetch_array($mysqli, $engine, "BIGINT", NULL, NULL, 260); - func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270); - func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", NULL, NULL, 280); - } - - func_mysqli_fetch_array($mysqli, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu"); - func_mysqli_fetch_array($mysqli, $engine, "FLOAT", NULL, NULL, 300); - func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu"); - func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320); - - func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330); - func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", NULL, NULL, 340); - func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350); - func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360); - func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370); - func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL, 380); - func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390); - func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL, 400); - - // don't care about date() strict TZ warnings... - $date = @date('Y-m-d'); - func_mysqli_fetch_array($mysqli, $engine, "DATE",$date, $date, 410); - func_mysqli_fetch_array($mysqli, $engine, "DATE NOT NULL",$date, $date, 420); - func_mysqli_fetch_array($mysqli, $engine, "DATE", NULL, NULL, 430); - - $date = @date('Y-m-d H:i:s'); - func_mysqli_fetch_array($mysqli, $engine, "DATETIME", $date, $date, 440); - func_mysqli_fetch_array($mysqli, $engine, "DATETIME NOT NULL", $date, $date, 450); - func_mysqli_fetch_array($mysqli, $engine, "DATETIME", NULL, NULL, 460); - func_mysqli_fetch_array($mysqli, $engine, "TIMESTAMP", $date, $date, 470); - $date = @date('H:i:s'); - func_mysqli_fetch_array($mysqli, $engine, "TIME", $date, $date, 480); - func_mysqli_fetch_array($mysqli, $engine, "TIME NOT NULL", $date, $date, 490); - func_mysqli_fetch_array($mysqli, $engine, "TIME", NULL, NULL, 500); - func_mysqli_fetch_array($mysqli, $engine, "YEAR", @date('Y'), @date('Y'), 510); - func_mysqli_fetch_array($mysqli, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520); - func_mysqli_fetch_array($mysqli, $engine, "YEAR", NULL, NULL, 530); - - $string255 = func_mysqli_fetch_array_make_string(255); - func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", "a", "a", 540); - func_mysqli_fetch_array($mysqli, $engine, "CHAR(255)", $string255, $string255, 550); - func_mysqli_fetch_array($mysqli, $engine, "CHAR(1) NOT NULL", "a", "a", 560); - func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", NULL, NULL, 570); - - $string65k = func_mysqli_fetch_array_make_string(65400); - func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", "a", "a", 580); - func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(255)", $string255, $string255, 590); - func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(65400)", $string65k, $string65k, 600); - func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610); - func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", NULL, NULL, 620); - - func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", "a", "a", 630); - func_mysqli_fetch_array($mysqli, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640); - func_mysqli_fetch_array($mysqli, $engine, "BINARY(1) NOT NULL", "b", "b", 650); - func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", NULL, NULL, 660); - - func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", "a", "a", 670); - func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680); - func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690); - func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", NULL, NULL, 700); - - func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", "a", "a", 710); - func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720); - func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB NOT NULL", "b", "b", 730); - func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", NULL, NULL, 740); - - func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", "a", "a", 750); - func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT NOT NULL", "a", "a", 760); - func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", NULL, NULL, 770); - - func_mysqli_fetch_array($mysqli, $engine, "BLOB", "a", "a", 780); - func_mysqli_fetch_array($mysqli, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780); - func_mysqli_fetch_array($mysqli, $engine, "BLOB", NULL, NULL, 790); - - func_mysqli_fetch_array($mysqli, $engine, "TEXT", "a", "a", 800); - func_mysqli_fetch_array($mysqli, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810); - func_mysqli_fetch_array($mysqli, $engine, "TEXT", NULL, NULL, 820); - - func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", "a", "a", 830); - func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840); - func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", NULL, NULL, 850); - - func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", "a", "a", 860); - func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870); - func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", NULL, NULL, 880); - - func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", "a", "a", 890); - func_mysqli_fetch_array($mysqli, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900); - func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", NULL, NULL, 910); - - func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", "a", "a", 920); - func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", NULL, NULL, 930); - - func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", "a", "a", 940); - func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", NULL, NULL, 950); - - $mysqli->close(); + require_once("connect.inc"); + + $tmp = NULL; + $link = NULL; + + require('table.inc'); + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 5")) { + printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + print "[005]\n"; + var_dump($res->fetch_array()); + + print "[006]\n"; + var_dump($res->fetch_array(MYSQLI_NUM)); + + print "[007]\n"; + var_dump($res->fetch_array(MYSQLI_BOTH)); + + print "[008]\n"; + var_dump($res->fetch_array(MYSQLI_ASSOC)); + + print "[009]\n"; + var_dump($res->fetch_array()); + + $res->free_result(); + + if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) { + printf("[010] Cannot run query, [%d] %s\n", $mysqli->errno, $$mysqli->error); + } + print "[011]\n"; + var_dump($res->fetch_array(MYSQLI_BOTH)); + + $res->free_result(); + if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) { + printf("[012] Cannot run query, [%d] %s\n", + $mysqli->errno, $$mysqli->error); + exit(1); + } + + do { + $illegal_mode = mt_rand(-10000, 10000); + } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH))); + // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes. + $tmp = $res->fetch_array($illegal_mode); + if (false !== $tmp) + printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, $mysqli->errno, $mysqli->error); + + $tmp = $res->fetch_array($illegal_mode); + if (false !== $tmp) + printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, $mysqli->errno, $mysqli->error); + + $res->free_result(); + + function func_mysqli_fetch_array($mysqli, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) { + + if (!$mysqli->query("DROP TABLE IF EXISTS test")) { + printf("[%04d] [%d] %s\n", $offset, $mysqli->errno, $mysqli->error); + return false; + } + + if (!$mysqli->query($sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { + // don't bail, engine might not support the datatype + return false; + } + + if (is_null($php_value)) { + if (!$mysqli->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) { + printf("[%04d] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error); + return false; + } + } else { + if (is_string($sql_value)) { + if (!$mysqli->query($sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) { + printf("[%04ds] [%d] %s - %s\n", $offset + 1, $mysqli->errno, $mysqli->error, $sql); + return false; + } + } else { + if (!$mysqli->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) { + printf("[%04di] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error); + return false; + } + } + } + + if (!$res = $mysqli->query("SELECT id, label FROM test")) { + printf("[%04d] [%d] %s\n", $offset + 2, $mysqli->errno, $mysqli->error); + return false; + } + + if (!$row = $res->fetch_array(MYSQLI_BOTH)) { + printf("[%04d] [%d] %s\n", $offset + 3, $mysqli->errno, $mysqli->error); + return false; + } + $fields = mysqli_fetch_fields($res); + + if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) { + if ($regexp_comparison) { + if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { + printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, + gettype($php_value), $php_value, $regexp_comparison, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], $mysqli->errno, $mysqli->error); + return false; + } + } else { + if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { + printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, + gettype($php_value), $php_value, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], $mysqli->errno, $mysqli->error); + return false; + } + } + } + return true; + } + + function func_mysqli_fetch_array_make_string($len) { + + $ret = ''; + for ($i = 0; $i < $len; $i++) + $ret .= chr(mt_rand(65, 90)); + + return $ret; + } + + func_mysqli_fetch_array($mysqli, $engine, "TINYINT", -11, "-11", 20); + func_mysqli_fetch_array($mysqli, $engine, "TINYINT", NULL, NULL, 30); + func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", 1, "1", 40); + func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", NULL, NULL, 50); + + func_mysqli_fetch_array($mysqli, $engine, "BOOL", 1, "1", 60); + func_mysqli_fetch_array($mysqli, $engine, "BOOL", NULL, NULL, 70); + func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", 0, "0", 80); + func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", NULL, NULL, 90); + + func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", -32768, "-32768", 100); + func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", 32767, "32767", 110); + func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", NULL, NULL, 120); + func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130); + func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140); + + func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", -8388608, "-8388608", 150); + func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", 8388607, "8388607", 160); + func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", NULL, NULL, 170); + func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180); + func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190); + + func_mysqli_fetch_array($mysqli, $engine, "INTEGER", -2147483648, "-2147483648", 200); + func_mysqli_fetch_array($mysqli, $engine, "INTEGER", 2147483647, "2147483647", 210); + func_mysqli_fetch_array($mysqli, $engine, "INTEGER", NULL, NULL, 220); + func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230); + func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", NULL, NULL, 240); + + if ($IS_MYSQLND || + ((mysqli_get_server_version($link) >= 51000) && + (mysqli_get_client_version($link) >= 51000))) { + func_mysqli_fetch_array($mysqli, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250); + func_mysqli_fetch_array($mysqli, $engine, "BIGINT", NULL, NULL, 260); + func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270); + func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", NULL, NULL, 280); + } + + func_mysqli_fetch_array($mysqli, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu"); + func_mysqli_fetch_array($mysqli, $engine, "FLOAT", NULL, NULL, 300); + func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu"); + func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320); + + func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330); + func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", NULL, NULL, 340); + func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350); + func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360); + func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370); + func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL, 380); + func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390); + func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL, 400); + + // don't care about date() strict TZ warnings... + $date = @date('Y-m-d'); + func_mysqli_fetch_array($mysqli, $engine, "DATE",$date, $date, 410); + func_mysqli_fetch_array($mysqli, $engine, "DATE NOT NULL",$date, $date, 420); + func_mysqli_fetch_array($mysqli, $engine, "DATE", NULL, NULL, 430); + + $date = @date('Y-m-d H:i:s'); + func_mysqli_fetch_array($mysqli, $engine, "DATETIME", $date, $date, 440); + func_mysqli_fetch_array($mysqli, $engine, "DATETIME NOT NULL", $date, $date, 450); + func_mysqli_fetch_array($mysqli, $engine, "DATETIME", NULL, NULL, 460); + func_mysqli_fetch_array($mysqli, $engine, "TIMESTAMP", $date, $date, 470); + $date = @date('H:i:s'); + func_mysqli_fetch_array($mysqli, $engine, "TIME", $date, $date, 480); + func_mysqli_fetch_array($mysqli, $engine, "TIME NOT NULL", $date, $date, 490); + func_mysqli_fetch_array($mysqli, $engine, "TIME", NULL, NULL, 500); + func_mysqli_fetch_array($mysqli, $engine, "YEAR", @date('Y'), @date('Y'), 510); + func_mysqli_fetch_array($mysqli, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520); + func_mysqli_fetch_array($mysqli, $engine, "YEAR", NULL, NULL, 530); + + $string255 = func_mysqli_fetch_array_make_string(255); + func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", "a", "a", 540); + func_mysqli_fetch_array($mysqli, $engine, "CHAR(255)", $string255, $string255, 550); + func_mysqli_fetch_array($mysqli, $engine, "CHAR(1) NOT NULL", "a", "a", 560); + func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", NULL, NULL, 570); + + $string65k = func_mysqli_fetch_array_make_string(65400); + func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", "a", "a", 580); + func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(255)", $string255, $string255, 590); + func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(65400)", $string65k, $string65k, 600); + func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610); + func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", NULL, NULL, 620); + + func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", "a", "a", 630); + func_mysqli_fetch_array($mysqli, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640); + func_mysqli_fetch_array($mysqli, $engine, "BINARY(1) NOT NULL", "b", "b", 650); + func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", NULL, NULL, 660); + + func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", "a", "a", 670); + func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680); + func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690); + func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", NULL, NULL, 700); + + func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", "a", "a", 710); + func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720); + func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB NOT NULL", "b", "b", 730); + func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", NULL, NULL, 740); + + func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", "a", "a", 750); + func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT NOT NULL", "a", "a", 760); + func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", NULL, NULL, 770); + + func_mysqli_fetch_array($mysqli, $engine, "BLOB", "a", "a", 780); + func_mysqli_fetch_array($mysqli, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780); + func_mysqli_fetch_array($mysqli, $engine, "BLOB", NULL, NULL, 790); + + func_mysqli_fetch_array($mysqli, $engine, "TEXT", "a", "a", 800); + func_mysqli_fetch_array($mysqli, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810); + func_mysqli_fetch_array($mysqli, $engine, "TEXT", NULL, NULL, 820); + + func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", "a", "a", 830); + func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840); + func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", NULL, NULL, 850); + + func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", "a", "a", 860); + func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870); + func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", NULL, NULL, 880); + + func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", "a", "a", 890); + func_mysqli_fetch_array($mysqli, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900); + func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", NULL, NULL, 910); + + func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", "a", "a", 920); + func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", NULL, NULL, 930); + + func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", "a", "a", 940); + func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", NULL, NULL, 950); + + $mysqli->close(); try { $res->fetch_array(MYSQLI_ASSOC); @@ -277,7 +277,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_assoc.phpt b/ext/mysqli/tests/mysqli_fetch_assoc.phpt index 8bc26fcdbd..5372d6f1de 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc.phpt @@ -8,48 +8,48 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test + // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test - require('table.inc'); - if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) { - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + require('table.inc'); + if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) { + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - print "[005]\n"; - var_dump(mysqli_fetch_assoc($res)); + print "[005]\n"; + var_dump(mysqli_fetch_assoc($res)); - print "[006]\n"; - var_dump(mysqli_fetch_assoc($res)); + print "[006]\n"; + var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); + mysqli_free_result($res); - if (!$res = mysqli_query($link, "SELECT - 1 AS a, - 2 AS a, - 3 AS c, - 4 AS C, - NULL AS d, - true AS e, - 5 AS '-1', - 6 AS '-10', - 7 AS '-100', - 8 AS '-1000', - 9 AS '10000', - 'a' AS '100000', - 'b' AS '1000000', - 'c' AS '9', - 'd' AS '9', - 'e' AS '01', - 'f' AS '-02' - ")) { - printf("[007] Cannot run query, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "[008]\n"; - var_dump(mysqli_fetch_assoc($res)); + if (!$res = mysqli_query($link, "SELECT + 1 AS a, + 2 AS a, + 3 AS c, + 4 AS C, + NULL AS d, + true AS e, + 5 AS '-1', + 6 AS '-10', + 7 AS '-100', + 8 AS '-1000', + 9 AS '10000', + 'a' AS '100000', + 'b' AS '1000000', + 'c' AS '9', + 'd' AS '9', + 'e' AS '01', + 'f' AS '-02' + ")) { + printf("[007] Cannot run query, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[008]\n"; + var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); + mysqli_free_result($res); try { mysqli_fetch_assoc($res); @@ -57,9 +57,9 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt index 586bfb03b3..60c635995a 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt @@ -17,97 +17,97 @@ mysqli_fetch_assoc() - BIT ?> --FILE-- <?php - require('connect.inc'); + require('connect.inc'); - function dec32bin($dec, $bits) { + function dec32bin($dec, $bits) { - $maxval = pow(2, $bits); - $bin = ''; - for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) { - if (($dec / $bitval) >= 1) { - $bin .= '1'; - $dec -= $bitval; - } else { - $bin .= '0'; - } - } - return $bin; - } + $maxval = pow(2, $bits); + $bin = ''; + for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) { + if (($dec / $bitval) >= 1) { + $bin .= '1'; + $dec -= $bitval; + } else { + $bin .= '0'; + } + } + return $bin; + } - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - for ($bits = 1; $bits <= 46; $bits++) { - if (1 == $bits) - $max_value = 1; - else - $max_value = pow(2, $bits) - 1; - $tests = 0; - if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || - !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE="%s"', $bits, $bits, $engine))) - printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link)); + for ($bits = 1; $bits <= 46; $bits++) { + if (1 == $bits) + $max_value = 1; + else + $max_value = pow(2, $bits) - 1; + $tests = 0; + if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || + !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE="%s"', $bits, $bits, $engine))) + printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link)); - $tests = 0; - $rand_max = mt_getrandmax(); - while ($tests < 10) { + $tests = 0; + $rand_max = mt_getrandmax(); + while ($tests < 10) { - $tests++; - if (1 == $tests) - $value = 0; - else if (2 == $tests) - $value = $max_value; - else { - if ($max_value > $rand_max) { - $max_loops = floor($max_value/$rand_max); - $num_loops = mt_rand(1, $max_loops); - $value = 0; - for ($i = 0; $i < $num_loops; $i++) - $value += mt_rand(0, $rand_max); - } else { - $value = mt_rand(0, $max_value); - } - } + $tests++; + if (1 == $tests) + $value = 0; + else if (2 == $tests) + $value = $max_value; + else { + if ($max_value > $rand_max) { + $max_loops = floor($max_value/$rand_max); + $num_loops = mt_rand(1, $max_loops); + $value = 0; + for ($i = 0; $i < $num_loops; $i++) + $value += mt_rand(0, $rand_max); + } else { + $value = mt_rand(0, $max_value); + } + } - $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits); - $sql = sprintf("INSERT INTO test(id, bit_value) VALUES (%s, b'%s')", $value, $bin); - for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++) - ; - $bin2 = substr($bin, $i, strlen($bin)); + $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits); + $sql = sprintf("INSERT INTO test(id, bit_value) VALUES (%s, b'%s')", $value, $bin); + for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++) + ; + $bin2 = substr($bin, $i, strlen($bin)); - if (!mysqli_query($link, $sql)) - printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, $sql)) + printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link)); - $sql = sprintf("SELECT id, BIN(bit_value) AS _bin, bit_value + 0 AS _bit_value0, bit_value, bit_null FROM test WHERE id = %s", $value); - if (!$res = mysqli_query($link, $sql)) - printf("[004 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link)); + $sql = sprintf("SELECT id, BIN(bit_value) AS _bin, bit_value + 0 AS _bit_value0, bit_value, bit_null FROM test WHERE id = %s", $value); + if (!$res = mysqli_query($link, $sql)) + printf("[004 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[005 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[005 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link)); - if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) { - debug_zval_dump($row); - printf("[006 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n", - $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2); - break; - } - if ($value != $row['bit_value']) { - debug_zval_dump($row); - printf("%10s %64s\n%10s %64s\n", '_bin', $row['_bin'], 'insert', $bin); - printf("[007 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']); - break; - } + if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) { + debug_zval_dump($row); + printf("[006 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n", + $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2); + break; + } + if ($value != $row['bit_value']) { + debug_zval_dump($row); + printf("%10s %64s\n%10s %64s\n", '_bin', $row['_bin'], 'insert', $bin); + printf("[007 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']); + break; + } - if (null !== $row['bit_null']) { - debug_zval_dump($row); - printf("[008 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']); - break; - } - } - } + if (null !== $row['bit_null']) { + debug_zval_dump($row); + printf("[008 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']); + break; + } + } + } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt index f86502704a..a581499daa 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt @@ -8,79 +8,79 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('table.inc'); + require('table.inc'); - if (!$res = mysqli_query($link, "SELECT 1, 2")) { - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "[002]\n"; - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT 1, 2")) { + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[002]\n"; + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); - if (!$res = mysqli_query($link, "SELECT 1 AS a, 2")) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "[004]\n"; - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT 1 AS a, 2")) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[004]\n"; + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); - if (!$res = mysqli_query($link, "SELECT 1 AS a, 2, 2 as '2'")) { - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "[006]\n"; - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT 1 AS a, 2, 2 as '2'")) { + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[006]\n"; + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); - if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 as '2', 2")) { - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "[008]\n"; - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 as '2', 2")) { + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[008]\n"; + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); - /* Now do it with unbuffered queries */ - if (!$res = mysqli_real_query($link, "SELECT 1, 2")) { - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (!$res = mysqli_use_result($link)) { - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "[011]\n"; - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); + /* Now do it with unbuffered queries */ + if (!$res = mysqli_real_query($link, "SELECT 1, 2")) { + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (!$res = mysqli_use_result($link)) { + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[011]\n"; + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); - if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2")) { - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (!$res = mysqli_use_result($link)) { - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "[014]\n"; - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); + if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2")) { + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (!$res = mysqli_use_result($link)) { + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[014]\n"; + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); - if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2, 2 as '2'")) { - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (!$res = mysqli_use_result($link)) { - printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "[017]\n"; - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); + if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2, 2 as '2'")) { + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (!$res = mysqli_use_result($link)) { + printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[017]\n"; + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); - if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2 as '2', 2")) { - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (!$res = mysqli_use_result($link)) { - printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "[017]\n"; - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - mysqli_close($link); + if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2 as '2', 2")) { + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (!$res = mysqli_use_result($link)) { + printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[017]\n"; + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + mysqli_close($link); - print "done!"; + print "done!"; ?> --EXPECTF-- [002] diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt index fdbf222df8..e1ed5c5c87 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt @@ -35,48 +35,48 @@ mysqli_fetch_assoc() - utf8 ?> --FILE-- <?php - require('table.inc'); + require('table.inc'); - /* some cyrillic (utf8) comes here */ - if (!$res = mysqli_query($link, "SET NAMES UTF8")) { - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + /* some cyrillic (utf8) comes here */ + if (!$res = mysqli_query($link, "SET NAMES UTF8")) { + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - if (!$res = mysqli_query($link, "SELECT 1 AS 'Ðндрей ХриÑтов', 2 AS 'Улф Вендел', 3 AS 'Георг Рихтер'")) { - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "[003]\n"; - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT 1 AS 'Ðндрей ХриÑтов', 2 AS 'Улф Вендел', 3 AS 'Георг Рихтер'")) { + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[003]\n"; + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); - if (!$res = mysqli_query($link, "CREATE TABLE автори_на_mysqlnd (id integer not null auto_increment primary key, име varchar(20) character set ucs2, Ñ„Ð°Ð¼Ð¸Ð»Ð¸Ñ varchar(20) character set utf8)")) { - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('Ðндрей', 'ХриÑтов'), ('Георг', 'Рихтер'), ('Улф','Вендел')")) { - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('Andrey', 'Hristov'), ('Georg', 'Richter'), ('Ulf','Wendel')")) { - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('安德烈', 'Hristov'), ('æ ¼å¥¥å°”', 'Richter'), ('乌尔夫','Wendel')")) { - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!$res = mysqli_query($link, "CREATE TABLE автори_на_mysqlnd (id integer not null auto_increment primary key, име varchar(20) character set ucs2, Ñ„Ð°Ð¼Ð¸Ð»Ð¸Ñ varchar(20) character set utf8)")) { + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('Ðндрей', 'ХриÑтов'), ('Георг', 'Рихтер'), ('Улф','Вендел')")) { + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('Andrey', 'Hristov'), ('Georg', 'Richter'), ('Ulf','Wendel')")) { + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('安德烈', 'Hristov'), ('æ ¼å¥¥å°”', 'Richter'), ('乌尔夫','Wendel')")) { + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - if (!$res = mysqli_query($link, "SELECT id, име, Ñ„Ð°Ð¼Ð¸Ð»Ð¸Ñ FROM автори_на_mysqlnd ORDER BY фамилиÑ, име")) { - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "[009]\n"; - while ($row = mysqli_fetch_assoc($res)) { - var_dump($row); - } - mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT id, име, Ñ„Ð°Ð¼Ð¸Ð»Ð¸Ñ FROM автори_на_mysqlnd ORDER BY фамилиÑ, име")) { + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[009]\n"; + while ($row = mysqli_fetch_assoc($res)) { + var_dump($row); + } + mysqli_free_result($res); - if (!$res = mysqli_query($link, "DROP TABLE автори_на_mysqlnd")) { - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!$res = mysqli_query($link, "DROP TABLE автори_на_mysqlnd")) { + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECTF-- [003] diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt index c1eef6eaf5..db07a2ef4b 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt @@ -8,43 +8,43 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test - $mysqli = new mysqli(); - try { + // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test + $mysqli = new mysqli(); + try { new mysqli_result($mysqli); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - require('table.inc'); - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + require('table.inc'); + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) { - printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); - } + if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) { + printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); + } - print "[005]\n"; - var_dump($res->fetch_assoc()); + print "[005]\n"; + var_dump($res->fetch_assoc()); - print "[006]\n"; - var_dump($res->fetch_assoc()); + print "[006]\n"; + var_dump($res->fetch_assoc()); - $res->free_result(); + $res->free_result(); - if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) { - printf("[007] Cannot run query, [%d] %s\n", $mysqli->errno, $mysqli->error); - } - print "[008]\n"; - var_dump($res->fetch_assoc()); + if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) { + printf("[007] Cannot run query, [%d] %s\n", $mysqli->errno, $mysqli->error); + } + print "[008]\n"; + var_dump($res->fetch_assoc()); - $res->free_result(); + $res->free_result(); try { $res->fetch_assoc(); @@ -52,9 +52,9 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt index 551877e800..b06124a89c 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt @@ -8,67 +8,67 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - function zerofill($offset, $link, $datatype, $insert = 1) { + function zerofill($offset, $link, $datatype, $insert = 1) { - mysqli_query($link, 'ALTER TABLE test DROP zero'); - $sql = sprintf('ALTER TABLE test ADD zero %s UNSIGNED ZEROFILL', $datatype); - if (!mysqli_query($link, $sql)) { - // no worries - server might not support it - return true; - } + mysqli_query($link, 'ALTER TABLE test DROP zero'); + $sql = sprintf('ALTER TABLE test ADD zero %s UNSIGNED ZEROFILL', $datatype); + if (!mysqli_query($link, $sql)) { + // no worries - server might not support it + return true; + } - if (!mysqli_query($link, sprintf('UPDATE test SET zero = %s', $insert))) { - printf("[%03d] UPDATE failed, [%d] %s\n", - $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } + if (!mysqli_query($link, sprintf('UPDATE test SET zero = %s', $insert))) { + printf("[%03d] UPDATE failed, [%d] %s\n", + $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } - if (!($res = mysqli_query($link, 'SELECT zero FROM test LIMIT 1'))) { - printf("[%03d] SELECT failed, [%d] %s\n", - $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } + if (!($res = mysqli_query($link, 'SELECT zero FROM test LIMIT 1'))) { + printf("[%03d] SELECT failed, [%d] %s\n", + $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } - $row = mysqli_fetch_assoc($res); - $meta = mysqli_fetch_fields($res); - mysqli_free_result($res); - $meta = $meta[0]; - $length = $meta->length; - if ($length > strlen($insert)) { + $row = mysqli_fetch_assoc($res); + $meta = mysqli_fetch_fields($res); + mysqli_free_result($res); + $meta = $meta[0]; + $length = $meta->length; + if ($length > strlen($insert)) { - $expected = str_repeat('0', $length - strlen($insert)); - $expected .= $insert; - if ($expected !== $row['zero']) { - printf("[%03d] Expecting '%s' got '%s'\n", $offset, $expected, $row['zero']); - return false; - } + $expected = str_repeat('0', $length - strlen($insert)); + $expected .= $insert; + if ($expected !== $row['zero']) { + printf("[%03d] Expecting '%s' got '%s'\n", $offset, $expected, $row['zero']); + return false; + } - } else if ($length <= 1) { - printf("[%03d] Length reported is too small to run test\n", $offset); - return false; - } + } else if ($length <= 1) { + printf("[%03d] Length reported is too small to run test\n", $offset); + return false; + } - return true; - } + return true; + } - zerofill(2, $link, 'TINYINT'); - zerofill(3, $link, 'SMALLINT'); - zerofill(4, $link, 'MEDIUMINT'); - zerofill(5, $link, 'INT'); - zerofill(6, $link, 'INTEGER'); - zerofill(7, $link, 'BIGINT'); - zerofill(8, $link, 'FLOAT'); - zerofill(9, $link, 'DOUBLE'); - zerofill(10, $link, 'DOUBLE PRECISION'); - zerofill(11, $link, 'DECIMAL'); - zerofill(12, $link, 'DEC'); + zerofill(2, $link, 'TINYINT'); + zerofill(3, $link, 'SMALLINT'); + zerofill(4, $link, 'MEDIUMINT'); + zerofill(5, $link, 'INT'); + zerofill(6, $link, 'INTEGER'); + zerofill(7, $link, 'BIGINT'); + zerofill(8, $link, 'FLOAT'); + zerofill(9, $link, 'DOUBLE'); + zerofill(10, $link, 'DOUBLE PRECISION'); + zerofill(11, $link, 'DECIMAL'); + zerofill(12, $link, 'DEC'); - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_field.phpt b/ext/mysqli/tests/mysqli_fetch_field.phpt index 7cd3208bc5..33a35c7005 100644 --- a/ext/mysqli/tests/mysqli_fetch_field.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field.phpt @@ -8,74 +8,74 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test + // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test - require('table.inc'); + require('table.inc'); - // Make sure that client, connection and result charsets are all the - // same. Not sure whether this is strictly necessary. - if (!mysqli_set_charset($link, 'utf8')) - printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link)); + // Make sure that client, connection and result charsets are all the + // same. Not sure whether this is strictly necessary. + if (!mysqli_set_charset($link, 'utf8')) + printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link)); - $charsetInfo = mysqli_get_charset($link); + $charsetInfo = mysqli_get_charset($link); - if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - /* ID column, binary charset */ - $tmp = mysqli_fetch_field($res); - var_dump($tmp); + /* ID column, binary charset */ + $tmp = mysqli_fetch_field($res); + var_dump($tmp); - /* label column, result set charset */ - $tmp = mysqli_fetch_field($res); - var_dump($tmp); - if ($tmp->charsetnr != $charsetInfo->number) { - printf("[004] Expecting charset %s/%d got %d\n", - $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr); - } - if ($tmp->length != $charsetInfo->max_length) { - printf("[005] Expecting length %d got %d\n", - $charsetInfo->max_length, $tmp->max_length); - } - if ($tmp->db != $db) { - printf("011] Expecting database '%s' got '%s'\n", - $db, $tmp->db); - } + /* label column, result set charset */ + $tmp = mysqli_fetch_field($res); + var_dump($tmp); + if ($tmp->charsetnr != $charsetInfo->number) { + printf("[004] Expecting charset %s/%d got %d\n", + $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr); + } + if ($tmp->length != $charsetInfo->max_length) { + printf("[005] Expecting length %d got %d\n", + $charsetInfo->max_length, $tmp->max_length); + } + if ($tmp->db != $db) { + printf("011] Expecting database '%s' got '%s'\n", + $db, $tmp->db); + } - var_dump(mysqli_fetch_field($res)); + var_dump(mysqli_fetch_field($res)); - mysqli_free_result($res); + mysqli_free_result($res); - // Read http://bugs.php.net/bug.php?id=42344 on defaults! + // Read http://bugs.php.net/bug.php?id=42344 on defaults! try { mysqli_fetch_field($res); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "CREATE TABLE test(id INT NOT NULL DEFAULT 1)")) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "CREATE TABLE test(id INT NOT NULL DEFAULT 1)")) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test(id) VALUES (2)")) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test(id) VALUES (2)")) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, "SELECT id as _default_test FROM test")) { - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - var_dump(mysqli_fetch_assoc($res)); - /* binary */ - var_dump(mysqli_fetch_field($res)); - mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT id as _default_test FROM test")) { + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + var_dump(mysqli_fetch_assoc($res)); + /* binary */ + var_dump(mysqli_fetch_field($res)); + mysqli_free_result($res); - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt index 5bf15a951e..0afe6e4626 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt @@ -8,19 +8,19 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - var_dump(mysqli_fetch_field_direct($res, -1)); - var_dump(mysqli_fetch_field_direct($res, 0)); - var_dump(mysqli_fetch_field_direct($res, 2)); + var_dump(mysqli_fetch_field_direct($res, -1)); + var_dump(mysqli_fetch_field_direct($res, 0)); + var_dump(mysqli_fetch_field_direct($res, 2)); - mysqli_free_result($res); + mysqli_free_result($res); try { mysqli_fetch_field_direct($res, 0); @@ -28,8 +28,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt index ea4ef9587a..33806f1c55 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt @@ -8,30 +8,30 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $mysqli = new mysqli(); + $mysqli = new mysqli(); try { new mysqli_result($mysqli); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - require('table.inc'); + require('table.inc'); - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - var_dump($res->fetch_field_direct(-1)); - var_dump($res->fetch_field_direct(0)); - var_dump($res->fetch_field_direct(2)); + var_dump($res->fetch_field_direct(-1)); + var_dump($res->fetch_field_direct(0)); + var_dump($res->fetch_field_direct(2)); - $res->free_result(); + $res->free_result(); try { $res->fetch_field_direct(0); @@ -39,8 +39,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - $mysqli->close(); - print "done!"; + $mysqli->close(); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_field_flags.phpt b/ext/mysqli/tests/mysqli_fetch_field_flags.phpt index 169c5d653f..5983075942 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_flags.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_flags.phpt @@ -17,206 +17,206 @@ mysqli_close($link); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); /* TODO: mysqli.c needs to export a few more constants - see all the defined() calls! */ - $flags = array( - MYSQLI_NOT_NULL_FLAG => 'NOT_NULL', - MYSQLI_PRI_KEY_FLAG => 'PRI_KEY', - MYSQLI_UNIQUE_KEY_FLAG => 'UNIQUE_KEY', - MYSQLI_MULTIPLE_KEY_FLAG => 'MULTIPLE_KEY', - MYSQLI_BLOB_FLAG => 'BLOB', - MYSQLI_UNSIGNED_FLAG => 'UNSIGNED', - MYSQLI_ZEROFILL_FLAG => 'ZEROFILL', - MYSQLI_AUTO_INCREMENT_FLAG => 'AUTO_INCREMENT', - MYSQLI_TIMESTAMP_FLAG => 'TIMESTAMP', - MYSQLI_SET_FLAG => 'SET', - MYSQLI_NUM_FLAG => 'NUM', - MYSQLI_PART_KEY_FLAG => 'PART_KEY', - // MYSQLI_GROUP_FLAG => 'MYSQLI_GROUP_FLAG' - internal usage only - (defined('MYSQLI_NO_DEFAULT_VALUE_FLAG') ? MYSQLI_NO_DEFAULT_VALUE_FLAG : 4096) => 'NO_DEFAULT_VALUE', - (defined('MYSQLI_BINARY_FLAG') ? MYSQLI_BINARY_FLAG : 128) => 'BINARY', - (defined('MYSQLI_ENUM_FLAG') ? MYSQLI_ENUM_FLAG : 256) => 'ENUM', - // MYSQLI_BINCMP_FLAG - ); - - // 5.1.24 / 6.0.4+ - if (defined('MYSQLI_ON_UPDATE_NOW')) - $flags[MYSQLI_ON_UPDATE_NOW] = 'ON_UPDATE_NOW'; - else - $flags[8192] = 'ON_UPDATE_NOW'; - - krsort($flags); - - $columns = array( - 'INT DEFAULT NULL' => 'NUM', - 'INT NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE NUM', - 'INT NOT NULL DEFAULT 1' => 'NOT_NULL NUM', - 'INT UNSIGNED DEFAULT NULL' => 'UNSIGNED NUM', - 'INT UNSIGNED NOT NULL' => 'NOT_NULL UNSIGNED NO_DEFAULT_VALUE NUM', - 'INT UNSIGNED NOT NULL DEFAULT 1' => 'NOT_NULL UNSIGNED NUM', - 'INT UNSIGNED ZEROFILL DEFAULT NULL' => 'UNSIGNED ZEROFILL NUM', - 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' => 'NOT_NULL PRI_KEY UNSIGNED AUTO_INCREMENT NUM PART_KEY', - 'CHAR(1) DEFAULT NULL' => '', - 'CHAR(1) NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE', - 'VARBINARY(127) DEFAULT NULL' => 'BINARY', - 'BLOB' => 'BLOB BINARY', - 'TINYBLOB' => 'BLOB BINARY', - 'MEDIUMBLOB' => 'BLOB BINARY', - 'LONGBLOB' => 'BLOB BINARY', - 'TEXT' => 'BLOB', - 'TINYTEXT' => 'BLOB', - 'MEDIUMTEXT' => 'BLOB', - 'LONGTEXT' => 'BLOB', - 'SET("one", "two")' => 'SET', - 'SET("one", "two") NOT NULL' => 'NOT_NULL SET NO_DEFAULT_VALUE', - 'SET("one", "two") NOT NULL DEFAULT "one"' => 'NOT_NULL SET', - 'ENUM("one", "two")' => 'ENUM', - 'ENUM("one", "two") NOT NULL' => 'NOT_NULL ENUM NO_DEFAULT_VALUE', - 'ENUM("one", "two") NOT NULL DEFAULT "one"' => 'NOT_NULL ENUM', - 'TINYINT UNIQUE' => 'UNIQUE_KEY NUM PART_KEY', - 'SMALLINT UNIQUE' => 'UNIQUE_KEY NUM PART_KEY', - 'MEDIUMINT UNIQUE DEFAULT 1' => 'UNIQUE_KEY NUM PART_KEY', - 'BIGINT UNSIGNED UNIQUE DEFAULT 100' => 'UNIQUE_KEY UNSIGNED NUM PART_KEY', - 'BIT' => 'UNSIGNED', - 'VARCHAR(2) NOT NULL PRIMARY KEY' => 'NOT_NULL PRI_KEY NO_DEFAULT_VALUE PART_KEY' - ); - - - - function checkFlags($reported_flags, $expected_flags, $flags) { - $found_flags = $unexpected_flags = ''; - foreach ($flags as $code => $name) { - if ($reported_flags >= $code) { - $reported_flags -= $code; - $found_flags .= $name . ' '; - if (stristr($expected_flags, $name)) { - $expected_flags = trim(str_ireplace($name, '', $expected_flags)); - } else { - $unexpected_flags .= $name . ' '; - } - } - } - - return array($expected_flags, $unexpected_flags, $found_flags); - } - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - - foreach ($columns as $column_def => $expected_flags) { - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("[002] %s [%d] %s\n", $column_def, - mysqli_errno($link), mysqli_error($link)); - continue; - } - - $create = sprintf('CREATE TABLE test(id INT, col1 %s)', $column_def); - if (!mysqli_query($link, $create)) { - // Server might not support it - skip - continue; - } - - if (!$res = mysqli_query($link, 'SELECT * FROM test')) { - printf("[003] Can't select from table, %s [%d] %s\n", $column_def, - mysqli_errno($link), mysqli_error($link)); - continue; - } - - $field = mysqli_fetch_field_direct($res, 1); - if (!is_object($field)) { - printf("[004] Fetching the meta data failed, %s [%d] %s\n", $column_def, - mysqli_errno($link), mysqli_error($link)); - continue; - } - if ($field->name != 'col1') { - printf("[005] Field information seems wrong, %s [%d] %s\n", $column_def, - mysqli_errno($link), mysqli_error($link)); - continue; - } - - /* - TODO - Unfortunately different server versions give you slightly different - results.The test does not yet fully reflect all server changes/bugs etc. - */ - switch ($column_def) { - case 'INT UNSIGNED NOT NULL': - case 'INT NOT NULL': - case 'CHAR(1) NOT NULL': - case 'SET("one", "two") NOT NULL': - case 'ENUM("one", "two") NOT NULL': - $version = mysqli_get_server_version($link); - if ($version < 50000) { - // TODO - check exact version! - $expected_flags = trim(str_replace('NO_DEFAULT_VALUE', '', $expected_flags)); - } - break; - - case 'BIT': - $version = mysqli_get_server_version($link); - if (($version <= 50114 && $version > 50100) || ($version == 50200)) { - // TODO - check exact version! - $expected_flags = trim(str_replace('UNSIGNED', '', $expected_flags)); - } - - default: - break; - } - - list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags, $flags); - if ($unexpected_flags) { - printf("[006] Found unexpected flags '%s' for %s, found '%s' with MySQL %s'\n", - $unexpected_flags, $column_def, $flags_found, mysqli_get_server_version($link)); - } - if ($missing_flags) { - printf("[007] The flags '%s' have not been reported for %s, found '%s'\n", - $missing_flags, $column_def, $flags_found); - var_dump($create); - var_dump(mysqli_get_server_version($link)); - die($missing_flags); - } - - mysqli_free_result($res); - } - - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("[008] %s [%d] %s\n", $column_def, - mysqli_errno($link), mysqli_error($link)); - } - - $column_def = array('col1 CHAR(1)', 'col2 CHAR(2)','INDEX idx_col1_col2(col1, col2)'); - $expected_flags = array('col1' => 'MULTIPLE_KEY PART_KEY', 'col2' => 'PART_KEY'); - $create = 'CREATE TABLE test(id INT, '; - foreach ($column_def as $k => $v) { - $create .= sprintf('%s, ', $v); - } - $create = sprintf('%s)', substr($create, 0, -2)); - - if (mysqli_query($link, $create)) { - if (!$res = mysqli_query($link, 'SELECT * FROM test')) { - printf("[009] Cannot run SELECT, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - } - // id column - skip it - $field = mysqli_fetch_field($res); - while ($field = mysqli_fetch_field($res)) { - if (!isset($expected_flags[$field->name])) { - printf("[010] Found unexpected field '%s'\n", $field->name); - } - list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags[$field->name], $flags); - if ($unexpected_flags) - printf("[011] Found unexpected flags '%s' for %s, found '%s'\n", - $unexpected_flags, $field->name, $flags_found); - if ($missing_flags) - printf("[012] The flags '%s' have not been reported for %s, found '%s'\n", - $missing_flags, $field->name, $flags_found); - } - } - - mysqli_close($link); - print "done!"; + $flags = array( + MYSQLI_NOT_NULL_FLAG => 'NOT_NULL', + MYSQLI_PRI_KEY_FLAG => 'PRI_KEY', + MYSQLI_UNIQUE_KEY_FLAG => 'UNIQUE_KEY', + MYSQLI_MULTIPLE_KEY_FLAG => 'MULTIPLE_KEY', + MYSQLI_BLOB_FLAG => 'BLOB', + MYSQLI_UNSIGNED_FLAG => 'UNSIGNED', + MYSQLI_ZEROFILL_FLAG => 'ZEROFILL', + MYSQLI_AUTO_INCREMENT_FLAG => 'AUTO_INCREMENT', + MYSQLI_TIMESTAMP_FLAG => 'TIMESTAMP', + MYSQLI_SET_FLAG => 'SET', + MYSQLI_NUM_FLAG => 'NUM', + MYSQLI_PART_KEY_FLAG => 'PART_KEY', + // MYSQLI_GROUP_FLAG => 'MYSQLI_GROUP_FLAG' - internal usage only + (defined('MYSQLI_NO_DEFAULT_VALUE_FLAG') ? MYSQLI_NO_DEFAULT_VALUE_FLAG : 4096) => 'NO_DEFAULT_VALUE', + (defined('MYSQLI_BINARY_FLAG') ? MYSQLI_BINARY_FLAG : 128) => 'BINARY', + (defined('MYSQLI_ENUM_FLAG') ? MYSQLI_ENUM_FLAG : 256) => 'ENUM', + // MYSQLI_BINCMP_FLAG + ); + + // 5.1.24 / 6.0.4+ + if (defined('MYSQLI_ON_UPDATE_NOW')) + $flags[MYSQLI_ON_UPDATE_NOW] = 'ON_UPDATE_NOW'; + else + $flags[8192] = 'ON_UPDATE_NOW'; + + krsort($flags); + + $columns = array( + 'INT DEFAULT NULL' => 'NUM', + 'INT NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE NUM', + 'INT NOT NULL DEFAULT 1' => 'NOT_NULL NUM', + 'INT UNSIGNED DEFAULT NULL' => 'UNSIGNED NUM', + 'INT UNSIGNED NOT NULL' => 'NOT_NULL UNSIGNED NO_DEFAULT_VALUE NUM', + 'INT UNSIGNED NOT NULL DEFAULT 1' => 'NOT_NULL UNSIGNED NUM', + 'INT UNSIGNED ZEROFILL DEFAULT NULL' => 'UNSIGNED ZEROFILL NUM', + 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' => 'NOT_NULL PRI_KEY UNSIGNED AUTO_INCREMENT NUM PART_KEY', + 'CHAR(1) DEFAULT NULL' => '', + 'CHAR(1) NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE', + 'VARBINARY(127) DEFAULT NULL' => 'BINARY', + 'BLOB' => 'BLOB BINARY', + 'TINYBLOB' => 'BLOB BINARY', + 'MEDIUMBLOB' => 'BLOB BINARY', + 'LONGBLOB' => 'BLOB BINARY', + 'TEXT' => 'BLOB', + 'TINYTEXT' => 'BLOB', + 'MEDIUMTEXT' => 'BLOB', + 'LONGTEXT' => 'BLOB', + 'SET("one", "two")' => 'SET', + 'SET("one", "two") NOT NULL' => 'NOT_NULL SET NO_DEFAULT_VALUE', + 'SET("one", "two") NOT NULL DEFAULT "one"' => 'NOT_NULL SET', + 'ENUM("one", "two")' => 'ENUM', + 'ENUM("one", "two") NOT NULL' => 'NOT_NULL ENUM NO_DEFAULT_VALUE', + 'ENUM("one", "two") NOT NULL DEFAULT "one"' => 'NOT_NULL ENUM', + 'TINYINT UNIQUE' => 'UNIQUE_KEY NUM PART_KEY', + 'SMALLINT UNIQUE' => 'UNIQUE_KEY NUM PART_KEY', + 'MEDIUMINT UNIQUE DEFAULT 1' => 'UNIQUE_KEY NUM PART_KEY', + 'BIGINT UNSIGNED UNIQUE DEFAULT 100' => 'UNIQUE_KEY UNSIGNED NUM PART_KEY', + 'BIT' => 'UNSIGNED', + 'VARCHAR(2) NOT NULL PRIMARY KEY' => 'NOT_NULL PRI_KEY NO_DEFAULT_VALUE PART_KEY' + ); + + + + function checkFlags($reported_flags, $expected_flags, $flags) { + $found_flags = $unexpected_flags = ''; + foreach ($flags as $code => $name) { + if ($reported_flags >= $code) { + $reported_flags -= $code; + $found_flags .= $name . ' '; + if (stristr($expected_flags, $name)) { + $expected_flags = trim(str_ireplace($name, '', $expected_flags)); + } else { + $unexpected_flags .= $name . ' '; + } + } + } + + return array($expected_flags, $unexpected_flags, $found_flags); + } + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + + foreach ($columns as $column_def => $expected_flags) { + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { + printf("[002] %s [%d] %s\n", $column_def, + mysqli_errno($link), mysqli_error($link)); + continue; + } + + $create = sprintf('CREATE TABLE test(id INT, col1 %s)', $column_def); + if (!mysqli_query($link, $create)) { + // Server might not support it - skip + continue; + } + + if (!$res = mysqli_query($link, 'SELECT * FROM test')) { + printf("[003] Can't select from table, %s [%d] %s\n", $column_def, + mysqli_errno($link), mysqli_error($link)); + continue; + } + + $field = mysqli_fetch_field_direct($res, 1); + if (!is_object($field)) { + printf("[004] Fetching the meta data failed, %s [%d] %s\n", $column_def, + mysqli_errno($link), mysqli_error($link)); + continue; + } + if ($field->name != 'col1') { + printf("[005] Field information seems wrong, %s [%d] %s\n", $column_def, + mysqli_errno($link), mysqli_error($link)); + continue; + } + + /* + TODO + Unfortunately different server versions give you slightly different + results.The test does not yet fully reflect all server changes/bugs etc. + */ + switch ($column_def) { + case 'INT UNSIGNED NOT NULL': + case 'INT NOT NULL': + case 'CHAR(1) NOT NULL': + case 'SET("one", "two") NOT NULL': + case 'ENUM("one", "two") NOT NULL': + $version = mysqli_get_server_version($link); + if ($version < 50000) { + // TODO - check exact version! + $expected_flags = trim(str_replace('NO_DEFAULT_VALUE', '', $expected_flags)); + } + break; + + case 'BIT': + $version = mysqli_get_server_version($link); + if (($version <= 50114 && $version > 50100) || ($version == 50200)) { + // TODO - check exact version! + $expected_flags = trim(str_replace('UNSIGNED', '', $expected_flags)); + } + + default: + break; + } + + list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags, $flags); + if ($unexpected_flags) { + printf("[006] Found unexpected flags '%s' for %s, found '%s' with MySQL %s'\n", + $unexpected_flags, $column_def, $flags_found, mysqli_get_server_version($link)); + } + if ($missing_flags) { + printf("[007] The flags '%s' have not been reported for %s, found '%s'\n", + $missing_flags, $column_def, $flags_found); + var_dump($create); + var_dump(mysqli_get_server_version($link)); + die($missing_flags); + } + + mysqli_free_result($res); + } + + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { + printf("[008] %s [%d] %s\n", $column_def, + mysqli_errno($link), mysqli_error($link)); + } + + $column_def = array('col1 CHAR(1)', 'col2 CHAR(2)','INDEX idx_col1_col2(col1, col2)'); + $expected_flags = array('col1' => 'MULTIPLE_KEY PART_KEY', 'col2' => 'PART_KEY'); + $create = 'CREATE TABLE test(id INT, '; + foreach ($column_def as $k => $v) { + $create .= sprintf('%s, ', $v); + } + $create = sprintf('%s)', substr($create, 0, -2)); + + if (mysqli_query($link, $create)) { + if (!$res = mysqli_query($link, 'SELECT * FROM test')) { + printf("[009] Cannot run SELECT, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + } + // id column - skip it + $field = mysqli_fetch_field($res); + while ($field = mysqli_fetch_field($res)) { + if (!isset($expected_flags[$field->name])) { + printf("[010] Found unexpected field '%s'\n", $field->name); + } + list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags[$field->name], $flags); + if ($unexpected_flags) + printf("[011] Found unexpected flags '%s' for %s, found '%s'\n", + $unexpected_flags, $field->name, $flags_found); + if ($missing_flags) + printf("[012] The flags '%s' have not been reported for %s, found '%s'\n", + $missing_flags, $field->name, $flags_found); + } + } + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt index 12400a730d..4a10ced2c2 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt @@ -8,53 +8,53 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test - $mysqli = new mysqli(); - $res = false; + // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test + $mysqli = new mysqli(); + $res = false; try { new mysqli_result($mysqli); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - require('table.inc'); - if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + require('table.inc'); + if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - // Make sure that client, connection and result charsets are all the - // same. Not sure whether this is strictly necessary. - if (!$mysqli->set_charset('utf8')) - printf("[%d] %s\n", $mysqli->errno, $mysqli->errno); + // Make sure that client, connection and result charsets are all the + // same. Not sure whether this is strictly necessary. + if (!$mysqli->set_charset('utf8')) + printf("[%d] %s\n", $mysqli->errno, $mysqli->errno); - $charsetInfo = $mysqli->get_charset(); + $charsetInfo = $mysqli->get_charset(); - if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { - printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); - } + if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { + printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); + } - var_dump($res->fetch_field()); + var_dump($res->fetch_field()); - $tmp = $res->fetch_field(); - var_dump($tmp); - if ($tmp->charsetnr != $charsetInfo->number) { - printf("[005] Expecting charset %s/%d got %d\n", - $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr); - } - if ($tmp->length != $charsetInfo->max_length) { - printf("[006] Expecting length %d got %d\n", - $charsetInfo->max_length, $tmp->max_length); - } - if ($tmp->db != $db) { - printf("[007] Expecting database '%s' got '%s'\n", - $db, $tmp->db); - } + $tmp = $res->fetch_field(); + var_dump($tmp); + if ($tmp->charsetnr != $charsetInfo->number) { + printf("[005] Expecting charset %s/%d got %d\n", + $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr); + } + if ($tmp->length != $charsetInfo->max_length) { + printf("[006] Expecting length %d got %d\n", + $charsetInfo->max_length, $tmp->max_length); + } + if ($tmp->db != $db) { + printf("[007] Expecting database '%s' got '%s'\n", + $db, $tmp->db); + } - var_dump($res->fetch_field()); + var_dump($res->fetch_field()); - $res->free_result(); + $res->free_result(); try { $res->fetch_field(); @@ -62,8 +62,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - $mysqli->close(); - print "done!"; + $mysqli->close(); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_field_types.phpt b/ext/mysqli/tests/mysqli_fetch_field_types.phpt index 31661bdda2..ae21349ab0 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_types.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_types.phpt @@ -8,115 +8,115 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('table.inc'); + require('table.inc'); - function mysqli_field_datatypes($link, $sql_type, $php_value, $php_type, $datatypes, $default_charset="latin1") { - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[001] %s, [%d] %s\n", $sql_type, - mysqli_errno($link), mysqli_error($link)); - return false; - } + function mysqli_field_datatypes($link, $sql_type, $php_value, $php_type, $datatypes, $default_charset="latin1") { + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { + printf("[001] %s, [%d] %s\n", $sql_type, + mysqli_errno($link), mysqli_error($link)); + return false; + } - $create = sprintf("CREATE TABLE test(id %s) DEFAULT CHARSET %s", $sql_type, $default_charset); - if (!mysqli_query($link, $create)) { - printf("[002] '%s' - '%s', [%d] %s\n", $sql_type, $create, - mysqli_errno($link), mysqli_error($link)); - return false; - } + $create = sprintf("CREATE TABLE test(id %s) DEFAULT CHARSET %s", $sql_type, $default_charset); + if (!mysqli_query($link, $create)) { + printf("[002] '%s' - '%s', [%d] %s\n", $sql_type, $create, + mysqli_errno($link), mysqli_error($link)); + return false; + } - if (is_string($php_value)) - $sql = sprintf("INSERT INTO test(id) VALUES ('%s')", $php_value); - else - $sql = sprintf("INSERT INTO test(id) VALUES (%s)", $php_value); + if (is_string($php_value)) + $sql = sprintf("INSERT INTO test(id) VALUES ('%s')", $php_value); + else + $sql = sprintf("INSERT INTO test(id) VALUES (%s)", $php_value); - if (!mysqli_query($link, $sql)) { - printf("[003] '%s' - '%s' - '%s', [%d] %s\n", $sql_type, $create, $sql, - mysqli_errno($link), mysqli_error($link)); - return false; - } + if (!mysqli_query($link, $sql)) { + printf("[003] '%s' - '%s' - '%s', [%d] %s\n", $sql_type, $create, $sql, + mysqli_errno($link), mysqli_error($link)); + return false; + } - if (!$res = mysqli_query($link, 'SELECT id FROM test')) { - printf("[004] %s, [%d] %s\n", $sql_type, - mysqli_errno($link), mysqli_error($link)); - return false; - } + if (!$res = mysqli_query($link, 'SELECT id FROM test')) { + printf("[004] %s, [%d] %s\n", $sql_type, + mysqli_errno($link), mysqli_error($link)); + return false; + } - if (!is_object($field = mysqli_fetch_field($res))) { - printf("[004] %s, expecting object got %s, [%d] %s\n", $sql_type, - gettype($field), - mysqli_errno($link), mysqli_error($link)); - return false; - } + if (!is_object($field = mysqli_fetch_field($res))) { + printf("[004] %s, expecting object got %s, [%d] %s\n", $sql_type, + gettype($field), + mysqli_errno($link), mysqli_error($link)); + return false; + } - if ($field->type != $php_type) { - $code_name = 'unknown'; - foreach ($datatypes as $k => $v) { - if ($k == $field->type) { - $code_name = (is_array($v)) ? $v[0] : $v; - break; - } - } - printf("[006] Expecting %d for %s got code %d for %s\n", - $php_type, $sql_type, $field->type, $code_name); - return false; - } + if ($field->type != $php_type) { + $code_name = 'unknown'; + foreach ($datatypes as $k => $v) { + if ($k == $field->type) { + $code_name = (is_array($v)) ? $v[0] : $v; + break; + } + } + printf("[006] Expecting %d for %s got code %d for %s\n", + $php_type, $sql_type, $field->type, $code_name); + return false; + } - return true; - } + return true; + } - $datatypes = array( - MYSQLI_TYPE_TINY => array('TINYINT', 5), - MYSQLI_TYPE_SHORT => array('SMALLINT', 10), - MYSQLI_TYPE_LONG => 'MYSQLI_TYPE_LONG - TODO add testing', - MYSQLI_TYPE_FLOAT => array('FLOAT', '1.3'), - MYSQLI_TYPE_DOUBLE => array('DOUBLE', '1.4'), - MYSQLI_TYPE_TIMESTAMP => array('TIMESTAMP', '2007-08-20 18:34:00'), - MYSQLI_TYPE_LONGLONG => array('BIGINT', 100), - MYSQLI_TYPE_INT24 => array('MEDIUMINT', 10), - MYSQLI_TYPE_DATE => array('DATE', '2007-08-20'), - MYSQLI_TYPE_TIME => array('TIME', '18:41:38'), - MYSQLI_TYPE_DATETIME => array('DATETIME', '2007-08-20 18:42:01'), - MYSQLI_TYPE_YEAR => array('YEAR', '2007'), - MYSQLI_TYPE_ENUM => array('ENUM("everything", "is", "just", "wonderful")', 'is'), - // MYSQLI_TYPE_SET => array('SET("I", "smash", "the")', 'I,smash,the'), - string - // MYSQLI_TYPE_TINY_BLOB => array("TINYBLOB", "I got a tiny blog"), - blob - // MYSQLI_TYPE_MEDIUM_BLOB => array("MEDIUMBLOB", "No blob for masses"), - blob - // MYSQLI_TYPE_LONG_BLOB => array("LONGBLOB", "Small is beautiful?"), - blob - MYSQLI_TYPE_BLOB => array("LONGBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'), - MYSQLI_TYPE_BLOB => array("MEDIUMBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'), - MYSQLI_TYPE_BLOB => array("TINYBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'), - MYSQLI_TYPE_BLOB => array("BLOB", 'silly'), - MYSQLI_TYPE_VAR_STRING => array("VARCHAR(32768)", 'varchar'), - MYSQLI_TYPE_STRING => 'MYSQLI_TYPE_STRING - TODO add testing', - MYSQLI_TYPE_STRING => array('CHAR(1)', 'a'), - MYSQLI_TYPE_STRING => array("SET('I', 'smash', 'the')", 'smash'), - MYSQLI_TYPE_NULL => 'MYSQLI_TYPE_NULL - TODO add testing', - MYSQLI_TYPE_NEWDATE => 'MYSQLI_TYPE_NEWDATE - TODO add testing', - MYSQLI_TYPE_INTERVAL => 'MYSQLI_TYPE_INTERVAL - TODO add testing', - MYSQLI_TYPE_GEOMETRY => 'MYSQLI_TYPE_GEOMETRY - TODO add testing', - ); + $datatypes = array( + MYSQLI_TYPE_TINY => array('TINYINT', 5), + MYSQLI_TYPE_SHORT => array('SMALLINT', 10), + MYSQLI_TYPE_LONG => 'MYSQLI_TYPE_LONG - TODO add testing', + MYSQLI_TYPE_FLOAT => array('FLOAT', '1.3'), + MYSQLI_TYPE_DOUBLE => array('DOUBLE', '1.4'), + MYSQLI_TYPE_TIMESTAMP => array('TIMESTAMP', '2007-08-20 18:34:00'), + MYSQLI_TYPE_LONGLONG => array('BIGINT', 100), + MYSQLI_TYPE_INT24 => array('MEDIUMINT', 10), + MYSQLI_TYPE_DATE => array('DATE', '2007-08-20'), + MYSQLI_TYPE_TIME => array('TIME', '18:41:38'), + MYSQLI_TYPE_DATETIME => array('DATETIME', '2007-08-20 18:42:01'), + MYSQLI_TYPE_YEAR => array('YEAR', '2007'), + MYSQLI_TYPE_ENUM => array('ENUM("everything", "is", "just", "wonderful")', 'is'), + // MYSQLI_TYPE_SET => array('SET("I", "smash", "the")', 'I,smash,the'), - string + // MYSQLI_TYPE_TINY_BLOB => array("TINYBLOB", "I got a tiny blog"), - blob + // MYSQLI_TYPE_MEDIUM_BLOB => array("MEDIUMBLOB", "No blob for masses"), - blob + // MYSQLI_TYPE_LONG_BLOB => array("LONGBLOB", "Small is beautiful?"), - blob + MYSQLI_TYPE_BLOB => array("LONGBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'), + MYSQLI_TYPE_BLOB => array("MEDIUMBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'), + MYSQLI_TYPE_BLOB => array("TINYBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'), + MYSQLI_TYPE_BLOB => array("BLOB", 'silly'), + MYSQLI_TYPE_VAR_STRING => array("VARCHAR(32768)", 'varchar'), + MYSQLI_TYPE_STRING => 'MYSQLI_TYPE_STRING - TODO add testing', + MYSQLI_TYPE_STRING => array('CHAR(1)', 'a'), + MYSQLI_TYPE_STRING => array("SET('I', 'smash', 'the')", 'smash'), + MYSQLI_TYPE_NULL => 'MYSQLI_TYPE_NULL - TODO add testing', + MYSQLI_TYPE_NEWDATE => 'MYSQLI_TYPE_NEWDATE - TODO add testing', + MYSQLI_TYPE_INTERVAL => 'MYSQLI_TYPE_INTERVAL - TODO add testing', + MYSQLI_TYPE_GEOMETRY => 'MYSQLI_TYPE_GEOMETRY - TODO add testing', + ); - if ($IS_MYSQLND) { - $version = 50007 + 1; - } else { - $version = mysqli_get_client_version(); - } + if ($IS_MYSQLND) { + $version = 50007 + 1; + } else { + $version = mysqli_get_client_version(); + } - if ($version > 50002) { - $datatypes[MYSQLI_TYPE_NEWDECIMAL] = array('DECIMAL', '1.1'); - $datatypes[MYSQLI_TYPE_BIT] = array('BIT', 0); - } else { - $datatypes[MYSQLI_TYPE_DECIMAL] = array('DECIMAL', '1.1'); - } + if ($version > 50002) { + $datatypes[MYSQLI_TYPE_NEWDECIMAL] = array('DECIMAL', '1.1'); + $datatypes[MYSQLI_TYPE_BIT] = array('BIT', 0); + } else { + $datatypes[MYSQLI_TYPE_DECIMAL] = array('DECIMAL', '1.1'); + } - foreach ($datatypes as $php_type => $datatype) { - if (is_array($datatype)) - mysqli_field_datatypes($link, $datatype[0], $datatype[1], $php_type, $datatypes); - } + foreach ($datatypes as $php_type => $datatype) { + if (is_array($datatype)) + mysqli_field_datatypes($link, $datatype[0], $datatype[1], $php_type, $datatypes); + } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_fields.phpt b/ext/mysqli/tests/mysqli_fetch_fields.phpt index 3c4eb086b2..5a16f73633 100644 --- a/ext/mysqli/tests/mysqli_fetch_fields.phpt +++ b/ext/mysqli/tests/mysqli_fetch_fields.phpt @@ -8,44 +8,44 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test + // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test - require('table.inc'); + require('table.inc'); - // Make sure that client, connection and result charsets are all the - // same. Not sure whether this is strictly necessary. - if (!mysqli_set_charset($link, 'utf8')) - printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link)); + // Make sure that client, connection and result charsets are all the + // same. Not sure whether this is strictly necessary. + if (!mysqli_set_charset($link, 'utf8')) + printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link)); - $charsetInfo = mysqli_get_charset($link); + $charsetInfo = mysqli_get_charset($link); - if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - $fields = mysqli_fetch_fields($res); - foreach ($fields as $k => $field) { - var_dump($field); - switch ($k) { - case 1: - /* label column, result set charset */ - if ($field->charsetnr != $charsetInfo->number) { - printf("[004] Expecting charset %s/%d got %d\n", - $charsetInfo->charset, - $charsetInfo->number, $field->charsetnr); - } - if ($field->length != $charsetInfo->max_length) { - printf("[005] Expecting length %d got %d\n", - $charsetInfo->max_length, - $field->max_length); - } - break; - } - } + $fields = mysqli_fetch_fields($res); + foreach ($fields as $k => $field) { + var_dump($field); + switch ($k) { + case 1: + /* label column, result set charset */ + if ($field->charsetnr != $charsetInfo->number) { + printf("[004] Expecting charset %s/%d got %d\n", + $charsetInfo->charset, + $charsetInfo->number, $field->charsetnr); + } + if ($field->length != $charsetInfo->max_length) { + printf("[005] Expecting length %d got %d\n", + $charsetInfo->max_length, + $field->max_length); + } + break; + } + } - mysqli_free_result($res); + mysqli_free_result($res); try { mysqli_fetch_fields($res); @@ -53,8 +53,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_lengths.phpt b/ext/mysqli/tests/mysqli_fetch_lengths.phpt index 1e4bf453e6..707c3691d0 100644 --- a/ext/mysqli/tests/mysqli_fetch_lengths.phpt +++ b/ext/mysqli/tests/mysqli_fetch_lengths.phpt @@ -8,24 +8,24 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - } + if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - require('table.inc'); - if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + require('table.inc'); + if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - var_dump(mysqli_fetch_lengths($res)); - while ($row = mysqli_fetch_assoc($res)) - var_dump(mysqli_fetch_lengths($res)); - var_dump(mysqli_fetch_lengths($res)); + var_dump(mysqli_fetch_lengths($res)); + while ($row = mysqli_fetch_assoc($res)) + var_dump(mysqli_fetch_lengths($res)); + var_dump(mysqli_fetch_lengths($res)); - mysqli_free_result($res); + mysqli_free_result($res); try { mysqli_fetch_lengths($res); @@ -33,8 +33,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt b/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt index 2e8e2722ee..18cc383939 100644 --- a/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt @@ -8,29 +8,29 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect\n"); + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect\n"); - require('table.inc'); - if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) { - printf("[002] [%d] %s\n", $mysqli->errno, $mysqli->error); - } + require('table.inc'); + if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) { + printf("[002] [%d] %s\n", $mysqli->errno, $mysqli->error); + } - var_dump($res->lengths); - while ($row = $res->fetch_assoc()) - var_dump($res->lengths); - var_dump($res->lengths); + var_dump($res->lengths); + while ($row = $res->fetch_assoc()) + var_dump($res->lengths); + var_dump($res->lengths); - $res->free_result(); - try { - $res->lengths; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } - $mysqli->close(); - print "done!"; + $res->free_result(); + try { + $res->lengths; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + $mysqli->close(); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_object.phpt b/ext/mysqli/tests/mysqli_fetch_object.phpt index 9042815dfd..cc6d4c8d14 100644 --- a/ext/mysqli/tests/mysqli_fetch_object.phpt +++ b/ext/mysqli/tests/mysqli_fetch_object.phpt @@ -8,132 +8,132 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - include_once("connect.inc"); + include_once("connect.inc"); - set_error_handler('handle_catchable_fatal'); + set_error_handler('handle_catchable_fatal'); - require('table.inc'); - if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + require('table.inc'); + if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - $obj = mysqli_fetch_object($res); - if (($obj->ID !== "1") || ($obj->label !== "a") || (get_class($obj) != 'stdClass')) { - printf("[004] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($obj); - } + $obj = mysqli_fetch_object($res); + if (($obj->ID !== "1") || ($obj->label !== "a") || (get_class($obj) != 'stdClass')) { + printf("[004] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($obj); + } - class mysqli_fetch_object_test { + class mysqli_fetch_object_test { - public $a = null; - public $b = null; + public $a = null; + public $b = null; - public function toString() { - var_dump($this); - } - } + public function toString() { + var_dump($this); + } + } - $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_test'); - if (($obj->ID !== "2") || ($obj->label !== "b") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_test')) { - printf("[005] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($obj); - } + $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_test'); + if (($obj->ID !== "2") || ($obj->label !== "b") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_test')) { + printf("[005] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($obj); + } - class mysqli_fetch_object_construct extends mysqli_fetch_object_test { + class mysqli_fetch_object_construct extends mysqli_fetch_object_test { - public function __construct($a, $b) { - $this->a = $a; - $this->b = $b; - } + public function __construct($a, $b) { + $this->a = $a; + $this->b = $b; + } - } + } - try { - $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array()); - if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { - printf("[006] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($obj); - } - } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; - } + try { + $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array()); + if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { + printf("[006] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($obj); + } + } catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; + } - try { - $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a')); - if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { - printf("[007] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($obj); - } - } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; - } + try { + $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a')); + if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { + printf("[007] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($obj); + } + } catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; + } - $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b')); - if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) { - printf("[008] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($obj); - } + $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b')); + if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) { + printf("[008] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($obj); + } - var_dump(mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b', 'c'))); - var_dump(mysqli_fetch_object($res)); + var_dump(mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b', 'c'))); + var_dump(mysqli_fetch_object($res)); - mysqli_free_result($res); + mysqli_free_result($res); - if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST")) { - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST")) { + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - mysqli_free_result($res); - try { + mysqli_free_result($res); + try { mysqli_fetch_object($res); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - /* - TODO - I'm using the procedural interface, this should not throw an exception. - Also, I did not ask to get exceptions using the mysqli_options() - */ - try { - if (false !== ($obj = @mysqli_fetch_object($res, 'mysqli_fetch_object_construct', 'a'))) - printf("[011] Should have failed\n"); - } catch (Error $e) { - handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); - } - - mysqli_free_result($res); - - if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - class mysqli_fetch_object_private_constructor extends mysqli_fetch_object_test { - - private function __construct($a, $b) { - $this->a = $a; - $this->b = $b; - } - } - /* - TODO - I think we should bail out here. The following line will give a Fatal error: Call to private ... from invalid context - var_dump($obj = new mysqli_fetch_object_private_constructor(1, 2)); - This does not fail. - */ - $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_private_constructor', array('a', 'b')); - mysqli_free_result($res); - - // Fatal error, script execution will end - var_dump(mysqli_fetch_object($res, 'this_class_does_not_exist')); - - - mysqli_close($link); - print "done!"; + if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + /* + TODO + I'm using the procedural interface, this should not throw an exception. + Also, I did not ask to get exceptions using the mysqli_options() + */ + try { + if (false !== ($obj = @mysqli_fetch_object($res, 'mysqli_fetch_object_construct', 'a'))) + printf("[011] Should have failed\n"); + } catch (Error $e) { + handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); + } + + mysqli_free_result($res); + + if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + class mysqli_fetch_object_private_constructor extends mysqli_fetch_object_test { + + private function __construct($a, $b) { + $this->a = $a; + $this->b = $b; + } + } + /* + TODO + I think we should bail out here. The following line will give a Fatal error: Call to private ... from invalid context + var_dump($obj = new mysqli_fetch_object_private_constructor(1, 2)); + This does not fail. + */ + $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_private_constructor', array('a', 'b')); + mysqli_free_result($res); + + // Fatal error, script execution will end + var_dump(mysqli_fetch_object($res, 'this_class_does_not_exist')); + + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt b/ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt index cb9f98cfa6..f773b76528 100644 --- a/ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt +++ b/ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt @@ -8,41 +8,41 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - require('table.inc'); - if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) { - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + require('table.inc'); + if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) { + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - class mysqli_fetch_object_test { + class mysqli_fetch_object_test { - public $a = null; - public $b = null; + public $a = null; + public $b = null; - public function toString() { - var_dump($this); - } - } + public function toString() { + var_dump($this); + } + } - printf("No exception with PHP:\n"); - var_dump($obj = new mysqli_fetch_object_test(1, 2)); + printf("No exception with PHP:\n"); + var_dump($obj = new mysqli_fetch_object_test(1, 2)); - printf("\nException with mysqli. Note that at all other places we throws errors but no exceptions unless the error mode has been changed:\n"); - try { - var_dump($obj = mysqli_fetch_object($res, 'mysqli_fetch_object_test', array(1, 2))); - } catch (Exception $e) { - printf("Exception: %s\n", $e->getMessage()); - } + printf("\nException with mysqli. Note that at all other places we throws errors but no exceptions unless the error mode has been changed:\n"); + try { + var_dump($obj = mysqli_fetch_object($res, 'mysqli_fetch_object_test', array(1, 2))); + } catch (Exception $e) { + printf("Exception: %s\n", $e->getMessage()); + } - printf("\nFatal error with PHP (but no exception!):\n"); - var_dump($obj->mysqli_fetch_object_test(1, 2)); + printf("\nFatal error with PHP (but no exception!):\n"); + var_dump($obj->mysqli_fetch_object_test(1, 2)); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_object_no_object.phpt b/ext/mysqli/tests/mysqli_fetch_object_no_object.phpt index c8e2b8508e..c12b91e68e 100644 --- a/ext/mysqli/tests/mysqli_fetch_object_no_object.phpt +++ b/ext/mysqli/tests/mysqli_fetch_object_no_object.phpt @@ -8,15 +8,15 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('table.inc'); - if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + require('table.inc'); + if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - $obj = mysqli_fetch_object($res); - var_dump(gettype($obj)); - mysqli_close($link); - print "done!"; + $obj = mysqli_fetch_object($res); + var_dump(gettype($obj)); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt index 54845843cf..0e90b29e71 100644 --- a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt @@ -8,121 +8,121 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - set_error_handler('handle_catchable_fatal'); + require_once("connect.inc"); + set_error_handler('handle_catchable_fatal'); - $mysqli = new mysqli(); + $mysqli = new mysqli(); try { new mysqli_result($mysqli); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - require('table.inc'); - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) { - printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - try { - if (!is_null($tmp = @$res->fetch_object($link, $link))) - printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - } catch (Error $e) { - handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); - } - - - try { - if (!is_null($tmp = @$res->fetch_object($link, $link, $link))) - printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - } catch (Error $e) { - handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); - } - - $obj = mysqli_fetch_object($res); - if (($obj->ID !== "1") || ($obj->label !== "a") || (get_class($obj) != 'stdClass')) { - printf("[007] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error); - var_dump($obj); - } - - class mysqli_fetch_object_test { - - public $a = null; - public $b = null; - - public function toString() { - var_dump($this); - } - } - - $obj = $res->fetch_object('mysqli_fetch_object_test'); - if (($obj->ID !== "2") || ($obj->label !== "b") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_test')) { - printf("[008] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error); - var_dump($obj); - } - - class mysqli_fetch_object_construct extends mysqli_fetch_object_test { - - public function __construct($a, $b) { - $this->a = $a; - $this->b = $b; - } - - } - - try { - $obj = $res->fetch_object('mysqli_fetch_object_construct', null); - - if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { - printf("[009] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error); - var_dump($obj); - } - } catch (Error $e) { - handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); - mysqli_fetch_object($res); - } - - try { - $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a')); - if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { - printf("[010] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error); - var_dump($obj); - } - } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; - } - - $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a', 'b')); - if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) { - printf("[011] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error); - var_dump($obj); - } - - var_dump($res->fetch_object('mysqli_fetch_object_construct', array('a', 'b', 'c'))); - var_dump(mysqli_fetch_object($res)); - - mysqli_free_result($res); - - if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST")) { - printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - - mysqli_free_result($res); - - try { + require('table.inc'); + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) { + printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + try { + if (!is_null($tmp = @$res->fetch_object($link, $link))) + printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + } catch (Error $e) { + handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); + } + + + try { + if (!is_null($tmp = @$res->fetch_object($link, $link, $link))) + printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + } catch (Error $e) { + handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); + } + + $obj = mysqli_fetch_object($res); + if (($obj->ID !== "1") || ($obj->label !== "a") || (get_class($obj) != 'stdClass')) { + printf("[007] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error); + var_dump($obj); + } + + class mysqli_fetch_object_test { + + public $a = null; + public $b = null; + + public function toString() { + var_dump($this); + } + } + + $obj = $res->fetch_object('mysqli_fetch_object_test'); + if (($obj->ID !== "2") || ($obj->label !== "b") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_test')) { + printf("[008] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error); + var_dump($obj); + } + + class mysqli_fetch_object_construct extends mysqli_fetch_object_test { + + public function __construct($a, $b) { + $this->a = $a; + $this->b = $b; + } + + } + + try { + $obj = $res->fetch_object('mysqli_fetch_object_construct', null); + + if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { + printf("[009] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error); + var_dump($obj); + } + } catch (Error $e) { + handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); + mysqli_fetch_object($res); + } + + try { + $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a')); + if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { + printf("[010] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error); + var_dump($obj); + } + } catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; + } + + $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a', 'b')); + if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) { + printf("[011] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error); + var_dump($obj); + } + + var_dump($res->fetch_object('mysqli_fetch_object_construct', array('a', 'b', 'c'))); + var_dump(mysqli_fetch_object($res)); + + mysqli_free_result($res); + + if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST")) { + printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error); + } + + mysqli_free_result($res); + + try { mysqli_fetch_object($res); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - // Fatal error, script execution will end - var_dump($res->fetch_object('this_class_does_not_exist')); + // Fatal error, script execution will end + var_dump($res->fetch_object('this_class_does_not_exist')); - $mysqli->close(); - print "done!"; + $mysqli->close(); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fetch_row.phpt b/ext/mysqli/tests/mysqli_fetch_row.phpt index d2ddea6c1a..ef52b5a48c 100644 --- a/ext/mysqli/tests/mysqli_fetch_row.phpt +++ b/ext/mysqli/tests/mysqli_fetch_row.phpt @@ -8,20 +8,20 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); - if (!$res = mysqli_query($link, "SELECT id, label, id AS _id FROM test ORDER BY id LIMIT 1")) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + require('table.inc'); + if (!$res = mysqli_query($link, "SELECT id, label, id AS _id FROM test ORDER BY id LIMIT 1")) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - print "[004]\n"; - var_dump(mysqli_fetch_row($res)); + print "[004]\n"; + var_dump(mysqli_fetch_row($res)); - print "[005]\n"; - var_dump(mysqli_fetch_row($res)); + print "[005]\n"; + var_dump(mysqli_fetch_row($res)); - mysqli_free_result($res); + mysqli_free_result($res); try { mysqli_fetch_row($res); @@ -29,8 +29,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_field_count.phpt b/ext/mysqli/tests/mysqli_field_count.phpt index d6a7be5fcc..fd2549ecb2 100644 --- a/ext/mysqli/tests/mysqli_field_count.phpt +++ b/ext/mysqli/tests/mysqli_field_count.phpt @@ -8,31 +8,31 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - var_dump(mysqli_field_count($link)); + var_dump(mysqli_field_count($link)); - if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 1")) { - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 1")) { + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - var_dump(mysqli_field_count($link)); + var_dump(mysqli_field_count($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'x')")) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($link->field_count); - var_dump(mysqli_field_count($link)); + if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'x')")) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($link->field_count); + var_dump(mysqli_field_count($link)); - if (!$res = mysqli_query($link, "SELECT NULL as _null, '' AS '', 'three' AS 'drei'")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump(mysqli_field_count($link)); - mysqli_free_result($res); + if (!$res = mysqli_query($link, "SELECT NULL as _null, '' AS '', 'three' AS 'drei'")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump(mysqli_field_count($link)); + mysqli_free_result($res); - mysqli_close($link); + mysqli_close($link); try { mysqli_field_count($link); @@ -40,7 +40,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; --CLEAN-- <?php require_once("clean_table.inc"); diff --git a/ext/mysqli/tests/mysqli_field_seek.phpt b/ext/mysqli/tests/mysqli_field_seek.phpt index 91c4360483..9eb9f0315b 100644 --- a/ext/mysqli/tests/mysqli_field_seek.phpt +++ b/ext/mysqli/tests/mysqli_field_seek.phpt @@ -8,98 +8,98 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - function mysqli_field_seek_flags($flags) { + function mysqli_field_seek_flags($flags) { - $ret = ''; + $ret = ''; - if ($flags & MYSQLI_NOT_NULL_FLAG) - $ret .= 'MYSQLI_NOT_NULL_FLAG '; + if ($flags & MYSQLI_NOT_NULL_FLAG) + $ret .= 'MYSQLI_NOT_NULL_FLAG '; - if ($flags & MYSQLI_PRI_KEY_FLAG) - $ret .= 'MYSQLI_PRI_KEY_FLAG '; + if ($flags & MYSQLI_PRI_KEY_FLAG) + $ret .= 'MYSQLI_PRI_KEY_FLAG '; - if ($flags & MYSQLI_UNIQUE_KEY_FLAG) - $ret .= 'MYSQLI_UNIQUE_KEY_FLAG '; + if ($flags & MYSQLI_UNIQUE_KEY_FLAG) + $ret .= 'MYSQLI_UNIQUE_KEY_FLAG '; - if ($flags & MYSQLI_MULTIPLE_KEY_FLAG) - $ret .= 'MYSQLI_MULTIPLE_KEY_FLAG '; + if ($flags & MYSQLI_MULTIPLE_KEY_FLAG) + $ret .= 'MYSQLI_MULTIPLE_KEY_FLAG '; - if ($flags & MYSQLI_BLOB_FLAG) - $ret .= 'MYSQLI_BLOB_FLAG '; + if ($flags & MYSQLI_BLOB_FLAG) + $ret .= 'MYSQLI_BLOB_FLAG '; - if ($flags & MYSQLI_UNSIGNED_FLAG) - $ret .= 'MYSQLI_UNSIGNED_FLAG '; + if ($flags & MYSQLI_UNSIGNED_FLAG) + $ret .= 'MYSQLI_UNSIGNED_FLAG '; - if ($flags & MYSQLI_ZEROFILL_FLAG) - $ret .= 'MYSQLI_ZEROFILL_FLAG '; + if ($flags & MYSQLI_ZEROFILL_FLAG) + $ret .= 'MYSQLI_ZEROFILL_FLAG '; - if ($flags & MYSQLI_AUTO_INCREMENT_FLAG) - $ret .= 'MYSQLI_AUTO_INCREMENT_FLAG '; + if ($flags & MYSQLI_AUTO_INCREMENT_FLAG) + $ret .= 'MYSQLI_AUTO_INCREMENT_FLAG '; - if ($flags & MYSQLI_TIMESTAMP_FLAG) - $ret .= 'MYSQLI_TIMESTAMP_FLAG '; + if ($flags & MYSQLI_TIMESTAMP_FLAG) + $ret .= 'MYSQLI_TIMESTAMP_FLAG '; - if ($flags & MYSQLI_SET_FLAG) - $ret .= 'MYSQLI_SET_FLAG '; + if ($flags & MYSQLI_SET_FLAG) + $ret .= 'MYSQLI_SET_FLAG '; - if ($flags & MYSQLI_NUM_FLAG) - $ret .= 'MYSQLI_NUM_FLAG '; + if ($flags & MYSQLI_NUM_FLAG) + $ret .= 'MYSQLI_NUM_FLAG '; - if ($flags & MYSQLI_PART_KEY_FLAG) - $ret .= 'MYSQLI_PART_KEY_FLAG '; + if ($flags & MYSQLI_PART_KEY_FLAG) + $ret .= 'MYSQLI_PART_KEY_FLAG '; - if ($flags & MYSQLI_GROUP_FLAG) - $ret .= 'MYSQLI_GROUP_FLAG '; + if ($flags & MYSQLI_GROUP_FLAG) + $ret .= 'MYSQLI_GROUP_FLAG '; - return $ret; - } - - require_once("connect.inc"); + return $ret; + } - require('table.inc'); + require_once("connect.inc"); - // Make sure that client, connection and result charsets are all the - // same. Not sure whether this is strictly necessary. - if (!mysqli_set_charset($link, 'utf8')) - printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link)); + require('table.inc'); - $charsetInfo = mysqli_get_charset($link); + // Make sure that client, connection and result charsets are all the + // same. Not sure whether this is strictly necessary. + if (!mysqli_set_charset($link, 'utf8')) + printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link)); - if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + $charsetInfo = mysqli_get_charset($link); - var_dump(mysqli_field_seek($res, -1)); - var_dump(mysqli_fetch_field($res)); - var_dump(mysqli_field_seek($res, 0)); - var_dump(mysqli_fetch_field($res)); - var_dump(mysqli_field_seek($res, 1)); + if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - $field = mysqli_fetch_field($res); - var_dump($field); - /* label column, result set charset */ - if ($field->charsetnr != $charsetInfo->number) { - printf("[004] Expecting charset %s/%d got %d\n", - $charsetInfo->charset, $charsetInfo->number, $field->charsetnr); - } - if ($field->length != $charsetInfo->max_length) { - printf("[005] Expecting length %d got %d\n", - $charsetInfo->max_length, $field->max_length); - } + var_dump(mysqli_field_seek($res, -1)); + var_dump(mysqli_fetch_field($res)); + var_dump(mysqli_field_seek($res, 0)); + var_dump(mysqli_fetch_field($res)); + var_dump(mysqli_field_seek($res, 1)); + + $field = mysqli_fetch_field($res); + var_dump($field); + /* label column, result set charset */ + if ($field->charsetnr != $charsetInfo->number) { + printf("[004] Expecting charset %s/%d got %d\n", + $charsetInfo->charset, $charsetInfo->number, $field->charsetnr); + } + if ($field->length != $charsetInfo->max_length) { + printf("[005] Expecting length %d got %d\n", + $charsetInfo->max_length, $field->max_length); + } - var_dump(mysqli_field_tell($res)); - var_dump(mysqli_field_seek($res, 2)); - var_dump(mysqli_fetch_field($res)); + var_dump(mysqli_field_tell($res)); + var_dump(mysqli_field_seek($res, 2)); + var_dump(mysqli_fetch_field($res)); - mysqli_free_result($res); + mysqli_free_result($res); - if (!$res = mysqli_query($link, "SELECT NULL as _null", MYSQLI_STORE_RESULT)) { - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - var_dump(mysqli_field_seek($res, 0)); - var_dump(mysqli_fetch_field($res)); + if (!$res = mysqli_query($link, "SELECT NULL as _null", MYSQLI_STORE_RESULT)) { + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + var_dump(mysqli_field_seek($res, 0)); + var_dump(mysqli_fetch_field($res)); - mysqli_free_result($res); + mysqli_free_result($res); try { mysqli_field_seek($res, 0); @@ -107,8 +107,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_field_tell.phpt b/ext/mysqli/tests/mysqli_field_tell.phpt index a39e1ff814..bf169003aa 100644 --- a/ext/mysqli/tests/mysqli_field_tell.phpt +++ b/ext/mysqli/tests/mysqli_field_tell.phpt @@ -8,31 +8,31 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); - if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + require('table.inc'); + if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - var_dump(mysqli_field_tell($res)); - var_dump(mysqli_field_tell($res)); - var_dump(mysqli_fetch_field($res)); - var_dump(mysqli_fetch_field($res)); - var_dump(mysqli_field_tell($res)); + var_dump(mysqli_field_tell($res)); + var_dump(mysqli_field_tell($res)); + var_dump(mysqli_fetch_field($res)); + var_dump(mysqli_fetch_field($res)); + var_dump(mysqli_field_tell($res)); - var_dump(mysqli_field_seek($res, 2)); - var_dump(mysqli_field_tell($res)); + var_dump(mysqli_field_seek($res, 2)); + var_dump(mysqli_field_tell($res)); - var_dump(mysqli_field_seek($res, -1)); - var_dump(mysqli_field_tell($res)); + var_dump(mysqli_field_seek($res, -1)); + var_dump(mysqli_field_tell($res)); - var_dump(mysqli_field_seek($res, 0)); - var_dump(mysqli_field_tell($res)); + var_dump(mysqli_field_seek($res, 0)); + var_dump(mysqli_field_tell($res)); - mysqli_free_result($res); + mysqli_free_result($res); try { mysqli_field_tell($res); @@ -40,9 +40,9 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_fork.phpt b/ext/mysqli/tests/mysqli_fork.phpt index cc4c72f561..af9f8a1f24 100644 --- a/ext/mysqli/tests/mysqli_fork.phpt +++ b/ext/mysqli/tests/mysqli_fork.phpt @@ -21,206 +21,206 @@ if (!have_innodb($link)) ?> --FILE-- <?php - require_once("table.inc"); - - $res = mysqli_query($link, "SELECT 'dumped by the parent' AS message"); - $pid = pcntl_fork(); - switch ($pid) { - case -1: - printf("[001] Cannot fork child"); - break; - - case 0: - /* child */ - exit(0); - break; - - default: - /* parent */ - $status = null; - $wait_id = pcntl_waitpid($pid, $status); - if (pcntl_wifexited($status) && (0 != ($tmp = pcntl_wexitstatus($status)))) { - printf("Exit code: %s\n", (pcntl_wifexited($status)) ? pcntl_wexitstatus($status) : 'n/a'); - printf("Signal: %s\n", (pcntl_wifsignaled($status)) ? pcntl_wtermsig($status) : 'n/a'); - printf("Stopped: %d\n", (pcntl_wifstopped($status)) ? pcntl_wstopsig($status) : 'n/a'); - } - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - break; - } - - if (@mysqli_query($link, "SELECT id FROM test WHERE id = 1")) - printf("[003] Expecting error and closed connection, child exit should have closed connection\n"); - else if ((($errno = mysqli_errno($link)) == 0) || ('' == ($error = mysqli_error($link)))) - printf("[004] Expecting error string and error code from MySQL, got errno = %s/%s, error = %s/%s\n", - gettype($errno), $errno, gettype($error), $error); - - mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - /* non trivial tests require a message list for parent-child communication */ - if (!mysqli_query($link, "DROP TABLE IF EXISTS messages")) - printf("[006] [%d] %s\n", mysqli_error($link), mysqli_errno($link)); - - if (!mysqli_query($link, "CREATE TABLE messages( - msg_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - msg_time TIMESTAMP, - pid INT NOT NULL, - sender ENUM('child', 'parent') NOT NULL, - msg TEXT) ENGINE = InnoDB")) - printf("[007] [%d] %s\n", mysqli_error($link), mysqli_errno($link)); - - mysqli_autocommit($link, false); - if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3", MYSQLI_USE_RESULT)) - printf("[008] [%d] %s\n", mysqli_error($link), mysqli_errno($link)); - - $pid = pcntl_fork(); - - switch ($pid) { - case -1: - printf("[009] Cannot fork child"); - break; - - case 0: - /* child */ - if (!($plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) || !mysqli_autocommit($plink, true)) - exit(mysqli_errno($plink)); - - $sql = sprintf("INSERT INTO messages(pid, sender, msg) VALUES (%d, 'child', '%%s')", posix_getpid()); - if (!mysqli_query($plink, sprintf($sql, 'start'))) - exit(mysqli_errno($plink)); - - $parent_sql = sprintf("SELECT msg_id, msg_time, msg FROM messages WHERE pid = %d AND sender = 'parent' ORDER BY msg_id DESC LIMIT 1", posix_getppid()); - $msg_id = 0; - while ($row = mysqli_fetch_assoc($res)) { - /* send row to parent */ - ob_start(); - var_dump($row); - $tmp = ob_get_contents(); - ob_end_clean(); - if (!mysqli_query($plink, sprintf($sql, $tmp))) - exit(mysqli_errno($plink)); - - /* let the parent reply... */ - $start = time(); - do { - usleep(100); - if (!$pres = mysqli_query($plink, $parent_sql)) - continue; - $tmp = mysqli_fetch_assoc($pres); - mysqli_free_result($pres); - if (!$tmp || $tmp['msg_id'] == $msg_id) - /* no new message */ - continue; - if ($tmp['msg'] == 'stop') - break 2; - $msg_id = $tmp['msg_id']; - break; - } while ((time() - $start) < 5); - - } - - if (!mysqli_query($plink, sprintf($sql, 'stop')) || !mysqli_commit($link)) - exit(mysqli_errno($plink)); - exit(0); - break; - - default: - /* parent */ - if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - $status = null; - $start = time(); - $sql = sprintf("SELECT msg_id, msg_time, msg FROM messages WHERE pid = %d AND sender = 'child' ORDER BY msg_id DESC LIMIT 1", $pid); - $parent_sql = sprintf("INSERT INTO messages (pid, sender, msg) VALUES (%d, 'parent', '%%s')", posix_getpid()); - $last_msg_id = 0; - $num_rows = 0; - do { - $wait_id = pcntl_waitpid($pid, $status, WNOHANG); - if ($pres = mysqli_query($plink, $sql)) { - $row = mysqli_fetch_assoc($pres); - if ($row && $row['msg_id'] != $last_msg_id) { - $last_msg_id = $row['msg_id']; - switch ($row['msg']) { - case 'start': - break; - case 'stop': - break 2; - default: - /* client has started fetching rows */ - $client_row = $row['msg']; - - $num_rows++; - if ($num_rows > 3) { - printf("[011] Child has fetched more than three rows!\n"); - var_dump($client_row); - if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) { - printf("[012] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink)); - } - break 2; - } - - if (!$parent_row = mysqli_fetch_assoc($res)) { - printf("[013] Parent cannot fetch row %d\n", $num_rows, mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) { - printf("[014] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink)); - } - break 2; - } - - ob_start(); - var_dump($parent_row); - $parent_row = ob_get_contents(); - ob_end_clean(); - - if ($parent_row != $client_row) { - printf("[015] Child indicates different results than parent.\n"); - var_dump($client_row); - var_dump($parent_row); - if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) { - printf("[016] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink)); - } - break 2; - } - - if (!mysqli_query($plink, sprintf($parent_sql, 'continue'))) { - printf("[017] Parent cannot inform child to continue.\n", mysqli_errno($plink), mysqli_error($plink)); - } - break; - } - } - mysqli_free_result($pres); - } - usleep(100); - } while (((time() - $start) < 5) && ($num_rows < 3)); - mysqli_close($plink); - $wait_id = pcntl_waitpid($pid, $status); - if (pcntl_wifexited($status) && (0 != ($tmp = pcntl_wexitstatus($status)))) { - printf("Exit code: %s\n", (pcntl_wifexited($status)) ? pcntl_wexitstatus($status) : 'n/a'); - printf("Signal: %s\n", (pcntl_wifsignaled($status)) ? pcntl_wtermsig($status) : 'n/a'); - printf("Stopped: %d\n", (pcntl_wifstopped($status)) ? pcntl_wstopsig($status) : 'n/a'); - } - break; - } - mysqli_free_result($res); - mysqli_close($link); - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[018] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - if (!$res = mysqli_query($link, "SELECT sender, msg FROM messages ORDER BY msg_id ASC")) - printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - while ($row = mysqli_fetch_assoc($res)) - printf("%10s %s\n", $row['sender'], substr($row['msg'], 0, 5)); - mysqli_free_result($res); - - print "done!"; + require_once("table.inc"); + + $res = mysqli_query($link, "SELECT 'dumped by the parent' AS message"); + $pid = pcntl_fork(); + switch ($pid) { + case -1: + printf("[001] Cannot fork child"); + break; + + case 0: + /* child */ + exit(0); + break; + + default: + /* parent */ + $status = null; + $wait_id = pcntl_waitpid($pid, $status); + if (pcntl_wifexited($status) && (0 != ($tmp = pcntl_wexitstatus($status)))) { + printf("Exit code: %s\n", (pcntl_wifexited($status)) ? pcntl_wexitstatus($status) : 'n/a'); + printf("Signal: %s\n", (pcntl_wifsignaled($status)) ? pcntl_wtermsig($status) : 'n/a'); + printf("Stopped: %d\n", (pcntl_wifstopped($status)) ? pcntl_wstopsig($status) : 'n/a'); + } + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + break; + } + + if (@mysqli_query($link, "SELECT id FROM test WHERE id = 1")) + printf("[003] Expecting error and closed connection, child exit should have closed connection\n"); + else if ((($errno = mysqli_errno($link)) == 0) || ('' == ($error = mysqli_error($link)))) + printf("[004] Expecting error string and error code from MySQL, got errno = %s/%s, error = %s/%s\n", + gettype($errno), $errno, gettype($error), $error); + + mysqli_close($link); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + /* non trivial tests require a message list for parent-child communication */ + if (!mysqli_query($link, "DROP TABLE IF EXISTS messages")) + printf("[006] [%d] %s\n", mysqli_error($link), mysqli_errno($link)); + + if (!mysqli_query($link, "CREATE TABLE messages( + msg_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + msg_time TIMESTAMP, + pid INT NOT NULL, + sender ENUM('child', 'parent') NOT NULL, + msg TEXT) ENGINE = InnoDB")) + printf("[007] [%d] %s\n", mysqli_error($link), mysqli_errno($link)); + + mysqli_autocommit($link, false); + if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3", MYSQLI_USE_RESULT)) + printf("[008] [%d] %s\n", mysqli_error($link), mysqli_errno($link)); + + $pid = pcntl_fork(); + + switch ($pid) { + case -1: + printf("[009] Cannot fork child"); + break; + + case 0: + /* child */ + if (!($plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) || !mysqli_autocommit($plink, true)) + exit(mysqli_errno($plink)); + + $sql = sprintf("INSERT INTO messages(pid, sender, msg) VALUES (%d, 'child', '%%s')", posix_getpid()); + if (!mysqli_query($plink, sprintf($sql, 'start'))) + exit(mysqli_errno($plink)); + + $parent_sql = sprintf("SELECT msg_id, msg_time, msg FROM messages WHERE pid = %d AND sender = 'parent' ORDER BY msg_id DESC LIMIT 1", posix_getppid()); + $msg_id = 0; + while ($row = mysqli_fetch_assoc($res)) { + /* send row to parent */ + ob_start(); + var_dump($row); + $tmp = ob_get_contents(); + ob_end_clean(); + if (!mysqli_query($plink, sprintf($sql, $tmp))) + exit(mysqli_errno($plink)); + + /* let the parent reply... */ + $start = time(); + do { + usleep(100); + if (!$pres = mysqli_query($plink, $parent_sql)) + continue; + $tmp = mysqli_fetch_assoc($pres); + mysqli_free_result($pres); + if (!$tmp || $tmp['msg_id'] == $msg_id) + /* no new message */ + continue; + if ($tmp['msg'] == 'stop') + break 2; + $msg_id = $tmp['msg_id']; + break; + } while ((time() - $start) < 5); + + } + + if (!mysqli_query($plink, sprintf($sql, 'stop')) || !mysqli_commit($link)) + exit(mysqli_errno($plink)); + exit(0); + break; + + default: + /* parent */ + if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + $status = null; + $start = time(); + $sql = sprintf("SELECT msg_id, msg_time, msg FROM messages WHERE pid = %d AND sender = 'child' ORDER BY msg_id DESC LIMIT 1", $pid); + $parent_sql = sprintf("INSERT INTO messages (pid, sender, msg) VALUES (%d, 'parent', '%%s')", posix_getpid()); + $last_msg_id = 0; + $num_rows = 0; + do { + $wait_id = pcntl_waitpid($pid, $status, WNOHANG); + if ($pres = mysqli_query($plink, $sql)) { + $row = mysqli_fetch_assoc($pres); + if ($row && $row['msg_id'] != $last_msg_id) { + $last_msg_id = $row['msg_id']; + switch ($row['msg']) { + case 'start': + break; + case 'stop': + break 2; + default: + /* client has started fetching rows */ + $client_row = $row['msg']; + + $num_rows++; + if ($num_rows > 3) { + printf("[011] Child has fetched more than three rows!\n"); + var_dump($client_row); + if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) { + printf("[012] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink)); + } + break 2; + } + + if (!$parent_row = mysqli_fetch_assoc($res)) { + printf("[013] Parent cannot fetch row %d\n", $num_rows, mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) { + printf("[014] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink)); + } + break 2; + } + + ob_start(); + var_dump($parent_row); + $parent_row = ob_get_contents(); + ob_end_clean(); + + if ($parent_row != $client_row) { + printf("[015] Child indicates different results than parent.\n"); + var_dump($client_row); + var_dump($parent_row); + if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) { + printf("[016] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink)); + } + break 2; + } + + if (!mysqli_query($plink, sprintf($parent_sql, 'continue'))) { + printf("[017] Parent cannot inform child to continue.\n", mysqli_errno($plink), mysqli_error($plink)); + } + break; + } + } + mysqli_free_result($pres); + } + usleep(100); + } while (((time() - $start) < 5) && ($num_rows < 3)); + mysqli_close($plink); + $wait_id = pcntl_waitpid($pid, $status); + if (pcntl_wifexited($status) && (0 != ($tmp = pcntl_wexitstatus($status)))) { + printf("Exit code: %s\n", (pcntl_wifexited($status)) ? pcntl_wexitstatus($status) : 'n/a'); + printf("Signal: %s\n", (pcntl_wifsignaled($status)) ? pcntl_wtermsig($status) : 'n/a'); + printf("Stopped: %d\n", (pcntl_wifstopped($status)) ? pcntl_wstopsig($status) : 'n/a'); + } + break; + } + mysqli_free_result($res); + mysqli_close($link); + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[018] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + if (!$res = mysqli_query($link, "SELECT sender, msg FROM messages ORDER BY msg_id ASC")) + printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + while ($row = mysqli_fetch_assoc($res)) + printf("%10s %s\n", $row['sender'], substr($row['msg'], 0, 5)); + mysqli_free_result($res); + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_free_result.phpt b/ext/mysqli/tests/mysqli_free_result.phpt index c64ec918cc..f562573733 100644 --- a/ext/mysqli/tests/mysqli_free_result.phpt +++ b/ext/mysqli/tests/mysqli_free_result.phpt @@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); - if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + require('table.inc'); + if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - print "a\n"; + print "a\n"; var_dump(mysqli_free_result($res)); - print "b\n"; + print "b\n"; try { mysqli_free_result($res); } catch (Error $exception) { @@ -29,24 +29,24 @@ require_once('skipifconnectfailure.inc'); printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } - print "c\n"; - var_dump(mysqli_store_result($link)); - var_dump(mysqli_error($link)); - print "[005]\n"; + print "c\n"; + var_dump(mysqli_store_result($link)); + var_dump(mysqli_error($link)); + print "[005]\n"; mysqli_free_result($res); - if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - print "d\n"; - var_dump(mysqli_use_result($link)); - var_dump(mysqli_error($link)); - print "[007]\n"; - var_dump(mysqli_free_result($res)); + if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "d\n"; + var_dump(mysqli_use_result($link)); + var_dump(mysqli_error($link)); + print "[007]\n"; + var_dump(mysqli_free_result($res)); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_get_charset.phpt b/ext/mysqli/tests/mysqli_get_charset.phpt index 80d0300c2b..4c253ec551 100644 --- a/ext/mysqli/tests/mysqli_get_charset.phpt +++ b/ext/mysqli/tests/mysqli_get_charset.phpt @@ -10,92 +10,92 @@ if (!function_exists('mysqli_get_charset')) ?> --FILE-- <?php - require_once("connect.inc"); - - require('table.inc'); - - if (!$res = mysqli_query($link, 'SELECT version() AS server_version')) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - $version = explode('.', $tmp['server_version']); - if (empty($version)) - printf("[005] Cannot determine server version, need MySQL Server 4.1+ for the test!\n"); - - if ($version[0] <= 4 && $version[1] < 1) - printf("[006] Need MySQL Server 4.1+ for the test!\n"); - - if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation')) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (!($character_set_connection = $tmp['charset']) || !($collation_connection = $tmp['collation'])) - printf("[008] Cannot determine current character set and collation\n"); - - if (!$res = mysqli_query($link, $sql = sprintf("SHOW CHARACTER SET LIKE '%s'", $character_set_connection))) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - if (empty($tmp)) - printf("[010] Cannot fetch Maxlen and/or Comment, test will fail: $sql\n"); - - $maxlen = (isset($tmp['Maxlen'])) ? $tmp['Maxlen'] : ''; - $comment = (isset($tmp['Description'])) ? $tmp['Description'] : ''; - - if (!$res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $collation_connection))) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (!($id = $tmp['Id'])) - printf("[012] Cannot fetch Id/Number, test will fail\n"); - - if (!$res = mysqli_query($link, sprintf("SHOW VARIABLES LIKE 'character_sets_dir'"))) - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (!($character_sets_dir = $tmp['Value'])) - printf("[014] Cannot fetch character_sets_dir, test will fail\n"); - - if (!is_object($charset = mysqli_get_charset($link))) - printf("[015] Expecting object/std_class, got %s/%s\n", gettype($charset), $charset); - - if (!isset($charset->charset) || - !in_array(gettype($charset->charset), array("string", "unicode")) || - ($character_set_connection !== $charset->charset)) - printf("[016] Expecting string/%s, got %s/%s\n", $character_set_connection, gettype($charset->charset), $charset->charset); - if (!isset($charset->collation) || - !in_array(gettype($charset->collation), array("string", "unicode")) || - ($collation_connection !== $charset->collation)) - printf("[017] Expecting string/%s, got %s/%s\n", $collation_connection, gettype($charset->collation), $charset->collation); - - if (!isset($charset->dir) || - !is_string($charset->dir)) - printf("[019] Expecting string - ideally %s*, got %s/%s\n", $character_sets_dir, gettype($charset->dir), $charset->dir); - - if (!isset($charset->min_length) || - !(is_int($charset->min_length)) || - ($charset->min_length < 0) || - ($charset->min_length > $charset->max_length)) - printf("[020] Expecting int between 0 ... %d, got %s/%s\n", $charset->max_length, - gettype($charset->min_length), $charset->min_length); - - if (!isset($charset->number) || - !is_int($charset->number) || - ($charset->number !== (int)$id)) - printf("[021] Expecting int/%d, got %s/%s\n", $id, gettype($charset->number), $charset->number); - - if (!isset($charset->state) || - !is_int($charset->state)) - printf("[022] Expecting int/any, got %s/%s\n", gettype($charset->state), $charset->state); - - mysqli_close($link); - - try { + require_once("connect.inc"); + + require('table.inc'); + + if (!$res = mysqli_query($link, 'SELECT version() AS server_version')) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + $version = explode('.', $tmp['server_version']); + if (empty($version)) + printf("[005] Cannot determine server version, need MySQL Server 4.1+ for the test!\n"); + + if ($version[0] <= 4 && $version[1] < 1) + printf("[006] Need MySQL Server 4.1+ for the test!\n"); + + if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation')) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if (!($character_set_connection = $tmp['charset']) || !($collation_connection = $tmp['collation'])) + printf("[008] Cannot determine current character set and collation\n"); + + if (!$res = mysqli_query($link, $sql = sprintf("SHOW CHARACTER SET LIKE '%s'", $character_set_connection))) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + if (empty($tmp)) + printf("[010] Cannot fetch Maxlen and/or Comment, test will fail: $sql\n"); + + $maxlen = (isset($tmp['Maxlen'])) ? $tmp['Maxlen'] : ''; + $comment = (isset($tmp['Description'])) ? $tmp['Description'] : ''; + + if (!$res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $collation_connection))) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if (!($id = $tmp['Id'])) + printf("[012] Cannot fetch Id/Number, test will fail\n"); + + if (!$res = mysqli_query($link, sprintf("SHOW VARIABLES LIKE 'character_sets_dir'"))) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if (!($character_sets_dir = $tmp['Value'])) + printf("[014] Cannot fetch character_sets_dir, test will fail\n"); + + if (!is_object($charset = mysqli_get_charset($link))) + printf("[015] Expecting object/std_class, got %s/%s\n", gettype($charset), $charset); + + if (!isset($charset->charset) || + !in_array(gettype($charset->charset), array("string", "unicode")) || + ($character_set_connection !== $charset->charset)) + printf("[016] Expecting string/%s, got %s/%s\n", $character_set_connection, gettype($charset->charset), $charset->charset); + if (!isset($charset->collation) || + !in_array(gettype($charset->collation), array("string", "unicode")) || + ($collation_connection !== $charset->collation)) + printf("[017] Expecting string/%s, got %s/%s\n", $collation_connection, gettype($charset->collation), $charset->collation); + + if (!isset($charset->dir) || + !is_string($charset->dir)) + printf("[019] Expecting string - ideally %s*, got %s/%s\n", $character_sets_dir, gettype($charset->dir), $charset->dir); + + if (!isset($charset->min_length) || + !(is_int($charset->min_length)) || + ($charset->min_length < 0) || + ($charset->min_length > $charset->max_length)) + printf("[020] Expecting int between 0 ... %d, got %s/%s\n", $charset->max_length, + gettype($charset->min_length), $charset->min_length); + + if (!isset($charset->number) || + !is_int($charset->number) || + ($charset->number !== (int)$id)) + printf("[021] Expecting int/%d, got %s/%s\n", $id, gettype($charset->number), $charset->number); + + if (!isset($charset->state) || + !is_int($charset->state)) + printf("[022] Expecting int/any, got %s/%s\n", gettype($charset->state), $charset->state); + + mysqli_close($link); + + try { mysqli_get_charset($link); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_get_client_info.phpt b/ext/mysqli/tests/mysqli_get_client_info.phpt index 0e8642d35d..41b0870b37 100644 --- a/ext/mysqli/tests/mysqli_get_client_info.phpt +++ b/ext/mysqli/tests/mysqli_get_client_info.phpt @@ -8,11 +8,11 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - if (!is_string($info = mysqli_get_client_info()) || ('' === $info)) - printf("[001] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info); + require_once("connect.inc"); + if (!is_string($info = mysqli_get_client_info()) || ('' === $info)) + printf("[001] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info); - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_get_client_stats.phpt b/ext/mysqli/tests/mysqli_get_client_stats.phpt index 5894789e37..49fd7470d6 100644 --- a/ext/mysqli/tests/mysqli_get_client_stats.phpt +++ b/ext/mysqli/tests/mysqli_get_client_stats.phpt @@ -15,905 +15,905 @@ mysqlnd.collect_memory_statistics=1 mysqli.allow_local_infile=1 --FILE-- <?php - /* - TODO - no_index_used - difficult to simulate because server/engine dependent - bad_index_used - difficult to simulate because server/engine dependent - flushed_normal_sets - flushed_ps_sets - explicit_close - implicit_close - disconnect_close - in_middle_of_command_close - explicit_free_result - implicit_free_result - explicit_stmt_close - implicit_stmt_close - */ - - function mysqli_get_client_stats_assert_eq($field, $current, $expected, &$test_counter, $desc = "") { - - $test_counter++; - if (is_array($current) && is_array($expected)) { - if ($current[$field] !== $expected[$field]) { - printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n", - $test_counter, $desc, - $field, $expected[$field], gettype($expected[$field]), - $current[$field], gettype($current[$field])); - } - } else if (is_array($current)) { - if ($current[$field] !== $expected) { - printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n", - $test_counter, $desc, - $field, $expected, gettype($expected), - $current[$field], gettype($current[$field])); - } - } else { - if ($current !== $expected) { - printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n", - $test_counter, $desc, - $field, $expected, gettype($expected), - $current, gettype($current)); - } - } - - } - - function mysqli_get_client_stats_assert_gt($field, $current, $expected, &$test_counter, $desc = "") { - - $test_counter++; - if (is_array($current) && is_array($expected)) { - if ($current[$field] <= $expected[$field]) { - printf("[%03d] %s Expecting %s > %s/%s, got %s/%s\n", - $test_counter, $desc, - $field, $expected[$field], gettype($expected[$field]), - $current[$field], gettype($current[$field])); - } - } else { - if ($current <= $expected) { - printf("[%03d] %s Expecting %s > %s/%s, got %s/%s\n", - $test_counter, $desc, $field, - $expected, gettype($expected), - $current, gettype($current)); - } - } - - } - - - require_once("connect.inc"); - - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[002] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info); - - var_dump($info); - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - exit(1); - } - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[004] Expecting array/any_non_empty, got %s/%s\n", gettype($new_info), $new_info); - - if (count($info) != count($new_info)) { - printf("[005] Expecting the same number of entries in the arrays\n"); - var_dump($info); - var_dump($new_info); - } - - $test_counter = 6; - - mysqli_get_client_stats_assert_gt('bytes_sent', $new_info, $info, $test_counter); - mysqli_get_client_stats_assert_gt('bytes_received', $new_info, $info, $test_counter); - mysqli_get_client_stats_assert_gt('packets_sent', $new_info, $info, $test_counter); - mysqli_get_client_stats_assert_gt('packets_received', $new_info, $info, $test_counter); - mysqli_get_client_stats_assert_gt('protocol_overhead_in', $new_info, $info, $test_counter); - mysqli_get_client_stats_assert_gt('protocol_overhead_out', $new_info, $info, $test_counter); - - // we assume the above as tested and in the following we check only those - mysqli_get_client_stats_assert_eq('result_set_queries', $new_info, $info, $test_counter); - - /* we need to skip this test in unicode - we send set names utf8 during mysql_connect */ - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, $info, $test_counter); - mysqli_get_client_stats_assert_eq('buffered_sets', $new_info, $info, $test_counter); - mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, $info, $test_counter); - mysqli_get_client_stats_assert_eq('ps_buffered_sets', $new_info, $info, $test_counter); - mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $new_info, $info, $test_counter); - - mysqli_get_client_stats_assert_eq('rows_skipped_ps', $new_info, $info, $test_counter); - mysqli_get_client_stats_assert_eq('copy_on_write_saved', $new_info, $info, $test_counter); - mysqli_get_client_stats_assert_eq('copy_on_write_performed', $new_info, $info, $test_counter); - mysqli_get_client_stats_assert_eq('command_buffer_too_small', $new_info, $info, $test_counter); - // This is not a mistake that I use string(1) "1" here! Andrey did not go for int to avoid any - // issues for very large numbers and 32 vs. 64bit systems - mysqli_get_client_stats_assert_eq('connect_success', $new_info, "1", $test_counter); - mysqli_get_client_stats_assert_eq('connect_failure', $new_info, $info, $test_counter); - mysqli_get_client_stats_assert_eq('connection_reused', $new_info, $info, $test_counter); - - // No data fetched so far - mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $new_info, "0", $test_counter); - mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $new_info, "0", $test_counter); - - require('table.inc'); - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); - - // fetch stats - $expected = $info; - - // buffered normal - print "Testing buffered normal...\n"; - if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test', MYSQLI_STORE_RESULT)) - printf("[%03d] SELECT COUNT() FROM test failed, [%d] %s\n", - ++$test_counter, mysqli_errno($link), mysqli_error($link)); - - $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + 1); - $expected['buffered_sets'] = (string)($expected['buffered_sets'] + 1); - $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); - $expected['rows_buffered_from_client_normal'] = (string)($expected['rows_buffered_from_client_normal'] + 1); - - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); - - mysqli_get_client_stats_assert_gt('bytes_sent', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_gt('bytes_received', $info, $expected, $test_counter); - - // real_data_* get incremented after mysqli_*fetch*() + /* + TODO + no_index_used - difficult to simulate because server/engine dependent + bad_index_used - difficult to simulate because server/engine dependent + flushed_normal_sets + flushed_ps_sets + explicit_close + implicit_close + disconnect_close + in_middle_of_command_close + explicit_free_result + implicit_free_result + explicit_stmt_close + implicit_stmt_close + */ + + function mysqli_get_client_stats_assert_eq($field, $current, $expected, &$test_counter, $desc = "") { + + $test_counter++; + if (is_array($current) && is_array($expected)) { + if ($current[$field] !== $expected[$field]) { + printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n", + $test_counter, $desc, + $field, $expected[$field], gettype($expected[$field]), + $current[$field], gettype($current[$field])); + } + } else if (is_array($current)) { + if ($current[$field] !== $expected) { + printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n", + $test_counter, $desc, + $field, $expected, gettype($expected), + $current[$field], gettype($current[$field])); + } + } else { + if ($current !== $expected) { + printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n", + $test_counter, $desc, + $field, $expected, gettype($expected), + $current, gettype($current)); + } + } + + } + + function mysqli_get_client_stats_assert_gt($field, $current, $expected, &$test_counter, $desc = "") { + + $test_counter++; + if (is_array($current) && is_array($expected)) { + if ($current[$field] <= $expected[$field]) { + printf("[%03d] %s Expecting %s > %s/%s, got %s/%s\n", + $test_counter, $desc, + $field, $expected[$field], gettype($expected[$field]), + $current[$field], gettype($current[$field])); + } + } else { + if ($current <= $expected) { + printf("[%03d] %s Expecting %s > %s/%s, got %s/%s\n", + $test_counter, $desc, $field, + $expected, gettype($expected), + $current, gettype($current)); + } + } + + } + + + require_once("connect.inc"); + + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[002] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info); + + var_dump($info); + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + exit(1); + } + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[004] Expecting array/any_non_empty, got %s/%s\n", gettype($new_info), $new_info); + + if (count($info) != count($new_info)) { + printf("[005] Expecting the same number of entries in the arrays\n"); + var_dump($info); + var_dump($new_info); + } + + $test_counter = 6; + + mysqli_get_client_stats_assert_gt('bytes_sent', $new_info, $info, $test_counter); + mysqli_get_client_stats_assert_gt('bytes_received', $new_info, $info, $test_counter); + mysqli_get_client_stats_assert_gt('packets_sent', $new_info, $info, $test_counter); + mysqli_get_client_stats_assert_gt('packets_received', $new_info, $info, $test_counter); + mysqli_get_client_stats_assert_gt('protocol_overhead_in', $new_info, $info, $test_counter); + mysqli_get_client_stats_assert_gt('protocol_overhead_out', $new_info, $info, $test_counter); + + // we assume the above as tested and in the following we check only those + mysqli_get_client_stats_assert_eq('result_set_queries', $new_info, $info, $test_counter); + + /* we need to skip this test in unicode - we send set names utf8 during mysql_connect */ + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, $info, $test_counter); + mysqli_get_client_stats_assert_eq('buffered_sets', $new_info, $info, $test_counter); + mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, $info, $test_counter); + mysqli_get_client_stats_assert_eq('ps_buffered_sets', $new_info, $info, $test_counter); + mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $new_info, $info, $test_counter); + + mysqli_get_client_stats_assert_eq('rows_skipped_ps', $new_info, $info, $test_counter); + mysqli_get_client_stats_assert_eq('copy_on_write_saved', $new_info, $info, $test_counter); + mysqli_get_client_stats_assert_eq('copy_on_write_performed', $new_info, $info, $test_counter); + mysqli_get_client_stats_assert_eq('command_buffer_too_small', $new_info, $info, $test_counter); + // This is not a mistake that I use string(1) "1" here! Andrey did not go for int to avoid any + // issues for very large numbers and 32 vs. 64bit systems + mysqli_get_client_stats_assert_eq('connect_success', $new_info, "1", $test_counter); + mysqli_get_client_stats_assert_eq('connect_failure', $new_info, $info, $test_counter); + mysqli_get_client_stats_assert_eq('connection_reused', $new_info, $info, $test_counter); + + // No data fetched so far + mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $new_info, "0", $test_counter); + mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $new_info, "0", $test_counter); + + require('table.inc'); + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); + + // fetch stats + $expected = $info; + + // buffered normal + print "Testing buffered normal...\n"; + if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test', MYSQLI_STORE_RESULT)) + printf("[%03d] SELECT COUNT() FROM test failed, [%d] %s\n", + ++$test_counter, mysqli_errno($link), mysqli_error($link)); + + $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + 1); + $expected['buffered_sets'] = (string)($expected['buffered_sets'] + 1); + $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); + $expected['rows_buffered_from_client_normal'] = (string)($expected['rows_buffered_from_client_normal'] + 1); + + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); + + mysqli_get_client_stats_assert_gt('bytes_sent', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_gt('bytes_received', $info, $expected, $test_counter); + + // real_data_* get incremented after mysqli_*fetch*() mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, "0", $test_counter); - mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter); + mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('buffered_sets', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('buffered_sets', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter); - /* no change to rows_fetched_from_client_normal_buffered! */ - if (!$row = mysqli_fetch_assoc($res)) - printf("[%03d] fetch_assoc - SELECT COUNT() FROM test failed, [%d] %s\n", - ++$test_counter, mysqli_errno($link), mysqli_error($link)); + /* no change to rows_fetched_from_client_normal_buffered! */ + if (!$row = mysqli_fetch_assoc($res)) + printf("[%03d] fetch_assoc - SELECT COUNT() FROM test failed, [%d] %s\n", + ++$test_counter, mysqli_errno($link), mysqli_error($link)); - $expected['rows_fetched_from_client_normal_buffered'] = (string)($expected['rows_fetched_from_client_normal_buffered'] + 1); + $expected['rows_fetched_from_client_normal_buffered'] = (string)($expected['rows_fetched_from_client_normal_buffered'] + 1); - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); - // fetch will increment - mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter); - $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal']; - mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter); + // fetch will increment + mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter); + $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal']; + mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter); - $num_rows = $row['_num']; - mysqli_free_result($res); + $num_rows = $row['_num']; + mysqli_free_result($res); - print "Testing buffered normal... - SELECT id, label FROM test\n"; - if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_STORE_RESULT)) - printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n", - ++$test_counter, mysqli_errno($link), mysqli_error($link)); + print "Testing buffered normal... - SELECT id, label FROM test\n"; + if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_STORE_RESULT)) + printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n", + ++$test_counter, mysqli_errno($link), mysqli_error($link)); - assert(mysqli_num_rows($res) == $num_rows); + assert(mysqli_num_rows($res) == $num_rows); - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); - $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows); - $expected['rows_buffered_from_client_normal'] = (string)($expected['rows_buffered_from_client_normal'] + $num_rows); - $expected['buffered_sets'] = (string)($expected['buffered_sets'] + 1); - $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); + $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows); + $expected['rows_buffered_from_client_normal'] = (string)($expected['rows_buffered_from_client_normal'] + $num_rows); + $expected['buffered_sets'] = (string)($expected['buffered_sets'] + 1); + $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); - mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('buffered_sets', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('buffered_sets', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter); - /* fetching none, but stats should not be affected - current implementation */ - mysqli_free_result($res); + /* fetching none, but stats should not be affected - current implementation */ + mysqli_free_result($res); - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); - mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter); - print "Testing unbuffered normal...\n"; - if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_USE_RESULT)) - printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n", - ++$test_counter, mysqli_errno($link), mysqli_error($link)); + print "Testing unbuffered normal...\n"; + if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_USE_RESULT)) + printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n", + ++$test_counter, mysqli_errno($link), mysqli_error($link)); - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); - while ($row = mysqli_fetch_assoc($res)) - ; - mysqli_free_result($res); + while ($row = mysqli_fetch_assoc($res)) + ; + mysqli_free_result($res); - $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows); - $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + $num_rows); - $expected['unbuffered_sets'] = (string)($expected['unbuffered_sets'] + 1); - $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); + $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows); + $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + $num_rows); + $expected['unbuffered_sets'] = (string)($expected['unbuffered_sets'] + 1); + $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); - mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter); - $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal']; + mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter); + $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal']; - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('unbuffered_sets', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('unbuffered_sets', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); - print "Testing unbuffered normal... - SELECT id, label FROM test, not all fetched\n"; - if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_USE_RESULT)) - printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n", - ++$test_counter, mysqli_errno($link), mysqli_error($link)); + print "Testing unbuffered normal... - SELECT id, label FROM test, not all fetched\n"; + if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_USE_RESULT)) + printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n", + ++$test_counter, mysqli_errno($link), mysqli_error($link)); - for ($i = 0; $i < $num_rows - 1; $i++) - $row = mysqli_fetch_assoc($res); + for ($i = 0; $i < $num_rows - 1; $i++) + $row = mysqli_fetch_assoc($res); - $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows - 1); - $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + $num_rows - 1); - $expected['unbuffered_sets'] = (string)($expected['unbuffered_sets'] + 1); - $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); + $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows - 1); + $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + $num_rows - 1); + $expected['unbuffered_sets'] = (string)($expected['unbuffered_sets'] + 1); + $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); - mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter); - $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal']; + mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter); + $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal']; - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('unbuffered_sets', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('unbuffered_sets', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); - print "Testing if implicit fetching and cleaning happens...\n"; - mysqli_free_result($res); + print "Testing if implicit fetching and cleaning happens...\n"; + mysqli_free_result($res); - /* last row has been implicitly cleaned from the wire by freeing the result set */ - $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + 1); - $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + 1); - $expected['rows_skipped_normal'] = (string)($info['rows_skipped_normal'] + 1); - $expected['flushed_normal_sets'] = (string)($expected['flushed_normal_sets'] + 1); + /* last row has been implicitly cleaned from the wire by freeing the result set */ + $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + 1); + $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + 1); + $expected['rows_skipped_normal'] = (string)($info['rows_skipped_normal'] + 1); + $expected['flushed_normal_sets'] = (string)($expected['flushed_normal_sets'] + 1); - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); - mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_skipped_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('flushed_normal_sets', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_skipped_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('flushed_normal_sets', $info, $expected, $test_counter); - print "Testing buffered Prepared Statements...\n"; - if (!$stmt = mysqli_stmt_init($link)) - printf("[%03d] stmt_init() failed, [%d] %s\n", - ++$test_counter, mysqli_errno($link), mysqli_error($link)); + print "Testing buffered Prepared Statements...\n"; + if (!$stmt = mysqli_stmt_init($link)) + printf("[%03d] stmt_init() failed, [%d] %s\n", + ++$test_counter, mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') || - !mysqli_stmt_execute($stmt)) - printf("[%03d] prepare/execute failed, [%d] %s\n", - ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') || + !mysqli_stmt_execute($stmt)) + printf("[%03d] prepare/execute failed, [%d] %s\n", + ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - /* by default PS is unbuffered - no change */ - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter); + /* by default PS is unbuffered - no change */ + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter); - if (!mysqli_stmt_store_result($stmt)) - printf("[%03d] store_result failed, [%d] %s\n", - ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_free_result($stmt); + if (!mysqli_stmt_store_result($stmt)) + printf("[%03d] store_result failed, [%d] %s\n", + ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_free_result($stmt); - mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter); - mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter); + mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); - $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows); - $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); - $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1); - $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows); + $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows); + $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); + $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1); + $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows); - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter); + mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter); - print "Testing buffered Prepared Statements... - fetching all\n"; + print "Testing buffered Prepared Statements... - fetching all\n"; - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') || - !mysqli_stmt_execute($stmt)) - printf("[%03d] prepare/execute failed, [%d] %s\n", - ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') || + !mysqli_stmt_execute($stmt)) + printf("[%03d] prepare/execute failed, [%d] %s\n", + ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label)) - printf("[%03d] bind_result failed, [%d] %s\n", - ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label)) + printf("[%03d] bind_result failed, [%d] %s\n", + ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_store_result($stmt)) - printf("[%03d] store_result failed, [%d] %s\n", - ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_store_result($stmt)) + printf("[%03d] store_result failed, [%d] %s\n", + ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - while (mysqli_stmt_fetch($stmt)) - ; + while (mysqli_stmt_fetch($stmt)) + ; - $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows); - $expected['rows_fetched_from_client_ps_buffered'] = (string)($expected['rows_fetched_from_client_ps_buffered'] + $num_rows); - $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); - $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1); - $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows); + $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows); + $expected['rows_fetched_from_client_ps_buffered'] = (string)($expected['rows_fetched_from_client_ps_buffered'] + $num_rows); + $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); + $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1); + $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows); - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); - mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter); - $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps']; + mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter); + $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps']; - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter); - mysqli_stmt_free_result($stmt); + mysqli_stmt_free_result($stmt); - print "Testing buffered Prepared Statements... - fetching all but one\n"; + print "Testing buffered Prepared Statements... - fetching all but one\n"; - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') || - !mysqli_stmt_execute($stmt)) - printf("[%03d] prepare/execute failed, [%d] %s\n", - ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') || + !mysqli_stmt_execute($stmt)) + printf("[%03d] prepare/execute failed, [%d] %s\n", + ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label)) - printf("[%03d] bind_result failed, [%d] %s\n", - ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label)) + printf("[%03d] bind_result failed, [%d] %s\n", + ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_store_result($stmt)) - printf("[%03d] store_result failed, [%d] %s\n", - ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_store_result($stmt)) + printf("[%03d] store_result failed, [%d] %s\n", + ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - for ($i = 0; $i < $num_rows - 1; $i++) - mysqli_stmt_fetch($stmt); + for ($i = 0; $i < $num_rows - 1; $i++) + mysqli_stmt_fetch($stmt); - $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows); - $expected['rows_fetched_from_client_ps_buffered'] = (string)($expected['rows_fetched_from_client_ps_buffered'] + $num_rows - 1); - $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); - $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1); - $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows); + $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows); + $expected['rows_fetched_from_client_ps_buffered'] = (string)($expected['rows_fetched_from_client_ps_buffered'] + $num_rows - 1); + $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); + $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1); + $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows); - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); - mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter); - $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps']; + mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter); + $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps']; - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter); - $expected['rows_skipped_ps'] = $info['rows_skipped_ps']; - mysqli_stmt_free_result($stmt); + $expected['rows_skipped_ps'] = $info['rows_skipped_ps']; + mysqli_stmt_free_result($stmt); - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); - /* buffered result set - no skipping possible! */ - mysqli_get_client_stats_assert_eq('rows_skipped_ps', $info, $expected, $test_counter); + /* buffered result set - no skipping possible! */ + mysqli_get_client_stats_assert_eq('rows_skipped_ps', $info, $expected, $test_counter); - print "Testing unbuffered Prepared Statements... - fetching all\n"; + print "Testing unbuffered Prepared Statements... - fetching all\n"; - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') || - !mysqli_stmt_execute($stmt)) - printf("[%03d] prepare/execute failed, [%d] %s\n", - ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') || + !mysqli_stmt_execute($stmt)) + printf("[%03d] prepare/execute failed, [%d] %s\n", + ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label)) - printf("[%03d] bind_result failed, [%d] %s\n", - ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label)) + printf("[%03d] bind_result failed, [%d] %s\n", + ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $i = 0; - while (mysqli_stmt_fetch($stmt)) - $i++; - assert($num_rows = $i); + $i = 0; + while (mysqli_stmt_fetch($stmt)) + $i++; + assert($num_rows = $i); - $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows); - $expected['rows_fetched_from_client_ps_unbuffered'] = (string)($expected['rows_fetched_from_client_ps_unbuffered'] + $num_rows); - $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); - $expected['ps_unbuffered_sets'] = (string)($expected['ps_unbuffered_sets'] + 1); + $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows); + $expected['rows_fetched_from_client_ps_unbuffered'] = (string)($expected['rows_fetched_from_client_ps_unbuffered'] + $num_rows); + $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); + $expected['ps_unbuffered_sets'] = (string)($expected['ps_unbuffered_sets'] + 1); - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); - mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter); - $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps']; + mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter); + $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps']; - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_unbuffered', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_unbuffered', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter); - mysqli_stmt_free_result($stmt); + mysqli_stmt_free_result($stmt); - print "Testing unbuffered Prepared Statements... - fetching all but one\n"; + print "Testing unbuffered Prepared Statements... - fetching all but one\n"; - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') || - !mysqli_stmt_execute($stmt)) - printf("[%03d] prepare/execute failed, [%d] %s\n", - ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') || + !mysqli_stmt_execute($stmt)) + printf("[%03d] prepare/execute failed, [%d] %s\n", + ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label)) - printf("[%03d] bind_result failed, [%d] %s\n", - ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - for ($i = 0; $i < $num_rows - 1; $i++) - mysqli_stmt_fetch($stmt); - - $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows - 1); - $expected['rows_fetched_from_client_ps_unbuffered'] = (string)($expected['rows_fetched_from_client_ps_unbuffered'] + $num_rows - 1); - $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); - $expected['ps_unbuffered_sets'] = (string)($expected['ps_unbuffered_sets'] + 1); - - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); - - mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter); - $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps']; - - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_unbuffered', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter); - - mysqli_stmt_free_result($stmt); - $expected['rows_skipped_ps'] = (string)($expected['rows_skipped_ps'] + 1); - $expected['flushed_ps_sets'] = (string)($expected['flushed_ps_sets'] + 1); - $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + 1); - - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); - - mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter); - - mysqli_get_client_stats_assert_eq('rows_skipped_ps', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('flushed_ps_sets', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); - - /* - print "Checking for normal buffered side effects...\n"; - foreach ($info as $k => $v) - if ($info[$k] != $expected[$k]) - printf("$k - $v != %s\n", $expected[$k]); - */ - print "... done with fetch statistics\n"; - - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); - - mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter); - - // - // result_set_queries statistics - // - - if (!is_array($info = mysqli_get_client_stats()) || empty($info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($info), $info); - - if (!$res = mysqli_query($link, "SELECT id, label FROM test")) - printf("[%03d] SELECT failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - $rows = 0; - while ($row = mysqli_fetch_assoc($res)) - $rows++; - - if (0 == $rows) - printf("[%03d] Expecting at least one result, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - mysqli_free_result($res); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - - mysqli_get_client_stats_assert_eq('result_set_queries', $new_info, (string)($info['result_set_queries'] + 1), $test_counter); - $info = $new_info; - - mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter); - $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal']; - - // - // non_result_set_queries - DDL - // - - // CREATE TABLE, DROP TABLE - if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test")) - printf("[%03d] DROP TABLE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, "CREATE TABLE non_result_set_queries_test(id INT) ENGINE = " . $engine)) { - printf("[%03d] CREATE TABLE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - } else { - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 2), $test_counter, 'CREATE/DROP TABLE'); - } - $info = $new_info; - - // ALERT TABLE - if (!mysqli_query($link, "ALTER TABLE non_result_set_queries_test ADD label CHAR(1)")) { - printf("[%03d] ALTER TABLE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - } else { - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'ALTER TABLE'); - } - $info = $new_info; - - // CREATE INDEX, DROP INDEX - if (!mysqli_query($link, "CREATE INDEX idx_1 ON non_result_set_queries_test(id)")) { - printf("[%03d] CREATE INDEX failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - } else { - - if (!mysqli_query($link, "DROP INDEX idx_1 ON non_result_set_queries_test")) - printf("[%03d] DROP INDEX failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 2), $test_counter, 'DROP INDEX'); - } - $info = $new_info; - - // RENAME TABLE - if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test")) - printf("[%03d] Cleanup, DROP TABLE client_stats_test failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - $info = $new_info; - - if (!mysqli_query($link, "RENAME TABLE non_result_set_queries_test TO client_stats_test")) { - printf("[%03d] RENAME TABLE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - } else { - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'RENAME TABLE'); - - } - $info = $new_info; - - if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test")) - printf("[%03d] Cleanup, DROP TABLE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test")) - printf("[%03d] Cleanup, DROP TABLE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - // Let's see if we have privileges for CREATE DATABASE - mysqli_query($link, "DROP DATABASE IF EXISTS mysqli_get_client_stats"); - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - $info = $new_info; - - - // CREATE, ALTER, DROP DATABASE - if (mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats")) { - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE'); - $info = $new_info; - - if (!mysqli_query($link, "ALTER DATABASE DEFAULT CHARACTER SET latin1")) - printf("[%03d] ALTER DATABASE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE'); - $info = $new_info; - - if (!mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats_")) - printf("[%03d] CREATE DATABASE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - $info = $new_info; - - if (!mysqli_query($link, "DROP DATABASE mysqli_get_client_stats_")) - printf("[%03d] DROP DATABASE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DROP DATABASE'); - $info = $new_info; - } - - // CREATE SERVER, ALTER SERVER, DROP SERVER - // We don't really try to use federated, we just want to see if the syntax works - mysqli_query($link, "DROP SERVER IF EXISTS myself"); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - $info = $new_info; - - $sql = sprintf("CREATE SERVER myself FOREIGN DATA WRAPPER mysql OPTIONS (user '%s', password '%s', database '%s')", - $user, $passwd, $db); - if (mysqli_query($link, $sql)) { - // server knows about it - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE SERVER'); - $info = $new_info; - - if (!mysqli_query($link, sprintf("ALTER SERVER myself OPTIONS(user '%s_')", $user))) - printf("[%03d] ALTER SERVER failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'ALTER SERVER'); - $info = $new_info; - - if (!mysqli_query($link, "DROP SERVER myself")) - printf("[%03d] DROP SERVER failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DROP SERVER'); - $info = $new_info; - } - - mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter); - - /* - We don't test the NDB ones. - 13.1. Data Definition Statements - 13.1.3. ALTER LOGFILE GROUP Syntax - 13.1.4. ALTER TABLESPACE Syntax - 13.1.9. CREATE LOGFILE GROUP Syntax - 13.1.10. CREATE TABLESPACE Syntax - 13.1.15. DROP LOGFILE GROUP Syntax - 13.1.16. DROP TABLESPACE Syntax - */ - - // - // DML - // - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - $info = $new_info; - - if (!mysqli_query($link, "INSERT INTO test(id) VALUES (100)")) - printf("[%03d] INSERT failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'INSERT'); - $info = $new_info; - - if (!mysqli_query($link, "UPDATE test SET label ='z' WHERE id = 100")) - printf("[%03d] UPDATE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'UPDATE'); - $info = $new_info; - - if (!mysqli_query($link, "REPLACE INTO test(id, label) VALUES (100, 'b')")) - printf("[%03d] INSERT failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'REPLACE'); - $info = $new_info; - - // NOTE: this will NOT update dbl_ddls counter - if (!$res = mysqli_query($link, "SELECT id, label FROM test WHERE id = 100")) - printf("[%03d] SELECT@dml failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, $info, $test_counter, 'SELECT@dml'); - $info = $new_info; - - if (!mysqli_query($link, "DELETE FROM test WHERE id = 100")) - printf("[%03d] DELETE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DELETE'); - $info = $new_info; - - if (!$res = mysqli_query($link, "TRUNCATE TABLE test")) - printf("[%03d] TRUNCATE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'TRUNCATE'); - $info = $new_info; - - - $file = tempnam(sys_get_temp_dir(), 'mysqli_test'); - if ($fp = fopen($file, 'w')) { - @fwrite($fp, '1;"a"'); - fclose($fp); - chmod($file, 0644); - $sql = sprintf('LOAD DATA LOCAL INFILE "%s" INTO TABLE test', mysqli_real_escape_string($link, $file)); - if (mysqli_query($link, $sql)) { - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'LOAD DATA LOCAL'); - $info = $new_info; - } - unlink($file); - } - - mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); - mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter); - - /* - We skip those: - 13.2. Data Manipulation Statements - 13.2.2. DO Syntax - 13.2.3. HANDLER Syntax - 13.2.5. LOAD DATA INFILE Syntax - */ - mysqli_query($link, "DELETE FROM test"); - if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b')")) - printf("[%03d] Cannot insert new records, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) - printf("[%03d] Cannot SELECT with mysqli_real_query(), [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_object($res = mysqli_use_result($link))) - printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - while ($row = mysqli_fetch_assoc($res)) - ; - mysqli_free_result($res); - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, (string)($info['unbuffered_sets'] + 1), $test_counter, 'mysqli_use_result()'); - $info = $new_info; - - if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) - printf("[%03d] Cannot SELECT with mysqli_real_query() II, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_object($res = mysqli_store_result($link))) - printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - while ($row = mysqli_fetch_assoc($res)) - ; - mysqli_free_result($res); - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('buffered_sets', $new_info, (string)($info['buffered_sets'] + 1), $test_counter, 'mysqli_use_result()'); - $info = $new_info; - - mysqli_close($link); - - mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter); - $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal']; - mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter); - - /* - no_index_used - bad_index_used - flushed_normal_sets - flushed_ps_sets - explicit_close - implicit_close - disconnect_close - in_middle_of_command_close - explicit_free_result - implicit_free_result - explicit_stmt_close - implicit_stmt_close - */ - - print "done!"; + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label)) + printf("[%03d] bind_result failed, [%d] %s\n", + ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + for ($i = 0; $i < $num_rows - 1; $i++) + mysqli_stmt_fetch($stmt); + + $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows - 1); + $expected['rows_fetched_from_client_ps_unbuffered'] = (string)($expected['rows_fetched_from_client_ps_unbuffered'] + $num_rows - 1); + $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1); + $expected['ps_unbuffered_sets'] = (string)($expected['ps_unbuffered_sets'] + 1); + + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); + + mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter); + $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps']; + + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_unbuffered', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter); + + mysqli_stmt_free_result($stmt); + $expected['rows_skipped_ps'] = (string)($expected['rows_skipped_ps'] + 1); + $expected['flushed_ps_sets'] = (string)($expected['flushed_ps_sets'] + 1); + $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + 1); + + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); + + mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter); + + mysqli_get_client_stats_assert_eq('rows_skipped_ps', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('flushed_ps_sets', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter); + + /* + print "Checking for normal buffered side effects...\n"; + foreach ($info as $k => $v) + if ($info[$k] != $expected[$k]) + printf("$k - $v != %s\n", $expected[$k]); + */ + print "... done with fetch statistics\n"; + + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); + + mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter); + + // + // result_set_queries statistics + // + + if (!is_array($info = mysqli_get_client_stats()) || empty($info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($info), $info); + + if (!$res = mysqli_query($link, "SELECT id, label FROM test")) + printf("[%03d] SELECT failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + $rows = 0; + while ($row = mysqli_fetch_assoc($res)) + $rows++; + + if (0 == $rows) + printf("[%03d] Expecting at least one result, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + mysqli_free_result($res); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + + mysqli_get_client_stats_assert_eq('result_set_queries', $new_info, (string)($info['result_set_queries'] + 1), $test_counter); + $info = $new_info; + + mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter); + $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal']; + + // + // non_result_set_queries - DDL + // + + // CREATE TABLE, DROP TABLE + if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test")) + printf("[%03d] DROP TABLE failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, "CREATE TABLE non_result_set_queries_test(id INT) ENGINE = " . $engine)) { + printf("[%03d] CREATE TABLE failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + } else { + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 2), $test_counter, 'CREATE/DROP TABLE'); + } + $info = $new_info; + + // ALERT TABLE + if (!mysqli_query($link, "ALTER TABLE non_result_set_queries_test ADD label CHAR(1)")) { + printf("[%03d] ALTER TABLE failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + } else { + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'ALTER TABLE'); + } + $info = $new_info; + + // CREATE INDEX, DROP INDEX + if (!mysqli_query($link, "CREATE INDEX idx_1 ON non_result_set_queries_test(id)")) { + printf("[%03d] CREATE INDEX failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + } else { + + if (!mysqli_query($link, "DROP INDEX idx_1 ON non_result_set_queries_test")) + printf("[%03d] DROP INDEX failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 2), $test_counter, 'DROP INDEX'); + } + $info = $new_info; + + // RENAME TABLE + if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test")) + printf("[%03d] Cleanup, DROP TABLE client_stats_test failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + $info = $new_info; + + if (!mysqli_query($link, "RENAME TABLE non_result_set_queries_test TO client_stats_test")) { + printf("[%03d] RENAME TABLE failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + } else { + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'RENAME TABLE'); + + } + $info = $new_info; + + if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test")) + printf("[%03d] Cleanup, DROP TABLE failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test")) + printf("[%03d] Cleanup, DROP TABLE failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + // Let's see if we have privileges for CREATE DATABASE + mysqli_query($link, "DROP DATABASE IF EXISTS mysqli_get_client_stats"); + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + $info = $new_info; + + + // CREATE, ALTER, DROP DATABASE + if (mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats")) { + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE'); + $info = $new_info; + + if (!mysqli_query($link, "ALTER DATABASE DEFAULT CHARACTER SET latin1")) + printf("[%03d] ALTER DATABASE failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE'); + $info = $new_info; + + if (!mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats_")) + printf("[%03d] CREATE DATABASE failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + $info = $new_info; + + if (!mysqli_query($link, "DROP DATABASE mysqli_get_client_stats_")) + printf("[%03d] DROP DATABASE failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DROP DATABASE'); + $info = $new_info; + } + + // CREATE SERVER, ALTER SERVER, DROP SERVER + // We don't really try to use federated, we just want to see if the syntax works + mysqli_query($link, "DROP SERVER IF EXISTS myself"); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + $info = $new_info; + + $sql = sprintf("CREATE SERVER myself FOREIGN DATA WRAPPER mysql OPTIONS (user '%s', password '%s', database '%s')", + $user, $passwd, $db); + if (mysqli_query($link, $sql)) { + // server knows about it + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE SERVER'); + $info = $new_info; + + if (!mysqli_query($link, sprintf("ALTER SERVER myself OPTIONS(user '%s_')", $user))) + printf("[%03d] ALTER SERVER failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'ALTER SERVER'); + $info = $new_info; + + if (!mysqli_query($link, "DROP SERVER myself")) + printf("[%03d] DROP SERVER failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DROP SERVER'); + $info = $new_info; + } + + mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter); + + /* + We don't test the NDB ones. + 13.1. Data Definition Statements + 13.1.3. ALTER LOGFILE GROUP Syntax + 13.1.4. ALTER TABLESPACE Syntax + 13.1.9. CREATE LOGFILE GROUP Syntax + 13.1.10. CREATE TABLESPACE Syntax + 13.1.15. DROP LOGFILE GROUP Syntax + 13.1.16. DROP TABLESPACE Syntax + */ + + // + // DML + // + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + $info = $new_info; + + if (!mysqli_query($link, "INSERT INTO test(id) VALUES (100)")) + printf("[%03d] INSERT failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'INSERT'); + $info = $new_info; + + if (!mysqli_query($link, "UPDATE test SET label ='z' WHERE id = 100")) + printf("[%03d] UPDATE failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'UPDATE'); + $info = $new_info; + + if (!mysqli_query($link, "REPLACE INTO test(id, label) VALUES (100, 'b')")) + printf("[%03d] INSERT failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'REPLACE'); + $info = $new_info; + + // NOTE: this will NOT update dbl_ddls counter + if (!$res = mysqli_query($link, "SELECT id, label FROM test WHERE id = 100")) + printf("[%03d] SELECT@dml failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, $info, $test_counter, 'SELECT@dml'); + $info = $new_info; + + if (!mysqli_query($link, "DELETE FROM test WHERE id = 100")) + printf("[%03d] DELETE failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DELETE'); + $info = $new_info; + + if (!$res = mysqli_query($link, "TRUNCATE TABLE test")) + printf("[%03d] TRUNCATE failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'TRUNCATE'); + $info = $new_info; + + + $file = tempnam(sys_get_temp_dir(), 'mysqli_test'); + if ($fp = fopen($file, 'w')) { + @fwrite($fp, '1;"a"'); + fclose($fp); + chmod($file, 0644); + $sql = sprintf('LOAD DATA LOCAL INFILE "%s" INTO TABLE test', mysqli_real_escape_string($link, $file)); + if (mysqli_query($link, $sql)) { + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'LOAD DATA LOCAL'); + $info = $new_info; + } + unlink($file); + } + + mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); + mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter); + + /* + We skip those: + 13.2. Data Manipulation Statements + 13.2.2. DO Syntax + 13.2.3. HANDLER Syntax + 13.2.5. LOAD DATA INFILE Syntax + */ + mysqli_query($link, "DELETE FROM test"); + if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b')")) + printf("[%03d] Cannot insert new records, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) + printf("[%03d] Cannot SELECT with mysqli_real_query(), [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!is_object($res = mysqli_use_result($link))) + printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + while ($row = mysqli_fetch_assoc($res)) + ; + mysqli_free_result($res); + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, (string)($info['unbuffered_sets'] + 1), $test_counter, 'mysqli_use_result()'); + $info = $new_info; + + if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) + printf("[%03d] Cannot SELECT with mysqli_real_query() II, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + if (!is_object($res = mysqli_store_result($link))) + printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + + while ($row = mysqli_fetch_assoc($res)) + ; + mysqli_free_result($res); + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + mysqli_get_client_stats_assert_eq('buffered_sets', $new_info, (string)($info['buffered_sets'] + 1), $test_counter, 'mysqli_use_result()'); + $info = $new_info; + + mysqli_close($link); + + mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter); + $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal']; + mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter); + + /* + no_index_used + bad_index_used + flushed_normal_sets + flushed_ps_sets + explicit_close + implicit_close + disconnect_close + in_middle_of_command_close + explicit_free_result + implicit_free_result + explicit_stmt_close + implicit_stmt_close + */ + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt b/ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt index 9c889caf8f..bbf3d702c9 100644 --- a/ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt +++ b/ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt @@ -14,27 +14,27 @@ mysqlnd.collect_statistics=1 mysqlnd.collect_memory_statistics=1 --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - $stats = mysqli_get_client_stats(); - printf("BEGINNING: implicit_free_result = %d\n", $stats['implicit_free_result']); + $stats = mysqli_get_client_stats(); + printf("BEGINNING: implicit_free_result = %d\n", $stats['implicit_free_result']); - if (!$res = mysqli_query($link, 'SELECT id FROM test')) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT id FROM test')) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - mysqli_close($link); + mysqli_free_result($res); + mysqli_close($link); - $after = mysqli_get_client_stats(); - if ($after['implicit_free_result'] != $stats['implicit_free_result']) - printf("[002] Where is the missing mysqli_free_result() call? implicit_free_result has changed by %d.\n", - $after['implicit_free_result'] - $stats['implicit_free_result']); + $after = mysqli_get_client_stats(); + if ($after['implicit_free_result'] != $stats['implicit_free_result']) + printf("[002] Where is the missing mysqli_free_result() call? implicit_free_result has changed by %d.\n", + $after['implicit_free_result'] - $stats['implicit_free_result']); - $stats = $after; - printf("END: implicit_free_result = %d\n", $stats['implicit_free_result']); + $stats = $after; + printf("END: implicit_free_result = %d\n", $stats['implicit_free_result']); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_get_client_stats_off.phpt b/ext/mysqli/tests/mysqli_get_client_stats_off.phpt index 5d9b2aad94..cd713fbc9b 100644 --- a/ext/mysqli/tests/mysqli_get_client_stats_off.phpt +++ b/ext/mysqli/tests/mysqli_get_client_stats_off.phpt @@ -14,31 +14,31 @@ mysqlnd.collect_statistics=0 mysqlnd.collect_memory_statistics=0 --FILE-- <?php - $before = mysqli_get_client_stats(); - if (!is_array($before) || empty($before)) { - printf("[001] Expecting non-empty array, got %s.\n", gettype($before)); - var_dump($before); - } + $before = mysqli_get_client_stats(); + if (!is_array($before) || empty($before)) { + printf("[001] Expecting non-empty array, got %s.\n", gettype($before)); + var_dump($before); + } - // connect and table inc connect to mysql and create tables - require_once('connect.inc'); - require_once('table.inc'); - $after = mysqli_get_client_stats(); + // connect and table inc connect to mysql and create tables + require_once('connect.inc'); + require_once('table.inc'); + $after = mysqli_get_client_stats(); - if ($before !== $after) { - printf("[002] Statistics have changed\n"); - var_dump($before); - var_dump($after); - } + if ($before !== $after) { + printf("[002] Statistics have changed\n"); + var_dump($before); + var_dump($after); + } - foreach ($after as $k => $v) - if ($v != 0) { - printf("[003] Field %s should not have any other value but 0, got %s.\n", - $k, $v); - } + foreach ($after as $k => $v) + if ($v != 0) { + printf("[003] Field %s should not have any other value but 0, got %s.\n", + $k, $v); + } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_get_client_stats_ps.phpt b/ext/mysqli/tests/mysqli_get_client_stats_ps.phpt index ea1055f806..ef9042b5a3 100644 --- a/ext/mysqli/tests/mysqli_get_client_stats_ps.phpt +++ b/ext/mysqli/tests/mysqli_get_client_stats_ps.phpt @@ -14,80 +14,80 @@ mysqlnd.collect_statistics=1 mysqlnd.collect_memory_statistics=1 --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); - - $stats = mysqli_get_client_stats(); - printf("BEGINNING: rows_fetched_from_client_ps_unbuffered = %d\n", $stats['rows_fetched_from_client_ps_unbuffered']); - printf("BEGINNING: rows_fetched_from_client_ps_buffered = %d\n", $stats['rows_fetched_from_client_ps_buffered']); - printf("BEGINNING: rows_fetched_from_client_ps_cursor = %d\n", $stats['rows_fetched_from_client_ps_cursor']); - - if (!$stmt = mysqli_stmt_init($link)) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $id = null; - if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test') || - !mysqli_stmt_execute($stmt) || - !mysqli_stmt_store_result($stmt) || - !mysqli_stmt_bind_result($stmt, $id)) - printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $num_rows = 0; - while (mysqli_stmt_fetch($stmt)) - $num_rows++; - - mysqli_stmt_free_result($stmt); - - $after = mysqli_get_client_stats(); - - if ($after['rows_fetched_from_client_ps_unbuffered'] != $stats['rows_fetched_from_client_ps_unbuffered']) - printf("[003] Unbuffered rows got increased after buffered PS, expecting %d got %d.\n", - $stats['rows_fetched_from_client_ps_unbuffered'], - $after['rows_fetched_from_client_ps_unbuffered']); - - $stats['rows_fetched_from_client_ps_buffered'] += $num_rows; - if ($after['rows_fetched_from_client_ps_buffered'] != $stats['rows_fetched_from_client_ps_buffered'] ) - printf("[005] Buffered rows should be %d got %d.\n", - $stats['rows_fetched_from_client_ps_buffered'], - $after['rows_fetched_from_client_ps_buffered']); - - $stats = $after; - printf("BUFFERED: rows_fetched_from_client_ps_unbuffered = %d\n", $stats['rows_fetched_from_client_ps_unbuffered']); - printf("BUFFERED: rows_fetched_from_client_ps_buffered = %d\n", $stats['rows_fetched_from_client_ps_buffered']); - printf("BUFFERED: rows_fetched_from_client_ps_cursor = %d\n", $stats['rows_fetched_from_client_ps_cursor']); - - $id = null; - if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test') || - !mysqli_stmt_execute($stmt) || - !mysqli_stmt_bind_result($stmt, $id)) - printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $num_rows = 0; - while (mysqli_stmt_fetch($stmt)) - $num_rows++; - - $after = mysqli_get_client_stats(); - $stats['rows_fetched_from_client_ps_unbuffered'] += $num_rows; - if ($after['rows_fetched_from_client_ps_unbuffered'] != $stats['rows_fetched_from_client_ps_unbuffered']) - printf("[007] Unbuffered rows should be %d got %d.\n", - $stats['rows_fetched_from_client_ps_unbuffered'], - $after['rows_fetched_from_client_ps_unbuffered']); - - if ($after['rows_fetched_from_client_ps_buffered'] != $stats['rows_fetched_from_client_ps_buffered'] ) - printf("[005] Buffered rows should be unchanged, expecting %d got %d.\n", - $stats['rows_fetched_from_client_ps_buffered'], - $after['rows_fetched_from_client_ps_buffered']); - - mysqli_stmt_free_result($stmt); - mysqli_stmt_close($stmt); - - $stats = $after; - printf("UNBUFFERED: rows_fetched_from_client_ps_unbuffered = %d\n", $stats['rows_fetched_from_client_ps_unbuffered']); - printf("UNBUFFERED: rows_fetched_from_client_ps_buffered = %d\n", $stats['rows_fetched_from_client_ps_buffered']); - printf("UNBUFFERED: rows_fetched_from_client_ps_cursor = %d\n", $stats['rows_fetched_from_client_ps_cursor']); - - mysqli_close($link); - print "done!"; + require_once('connect.inc'); + require_once('table.inc'); + + $stats = mysqli_get_client_stats(); + printf("BEGINNING: rows_fetched_from_client_ps_unbuffered = %d\n", $stats['rows_fetched_from_client_ps_unbuffered']); + printf("BEGINNING: rows_fetched_from_client_ps_buffered = %d\n", $stats['rows_fetched_from_client_ps_buffered']); + printf("BEGINNING: rows_fetched_from_client_ps_cursor = %d\n", $stats['rows_fetched_from_client_ps_cursor']); + + if (!$stmt = mysqli_stmt_init($link)) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $id = null; + if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test') || + !mysqli_stmt_execute($stmt) || + !mysqli_stmt_store_result($stmt) || + !mysqli_stmt_bind_result($stmt, $id)) + printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $num_rows = 0; + while (mysqli_stmt_fetch($stmt)) + $num_rows++; + + mysqli_stmt_free_result($stmt); + + $after = mysqli_get_client_stats(); + + if ($after['rows_fetched_from_client_ps_unbuffered'] != $stats['rows_fetched_from_client_ps_unbuffered']) + printf("[003] Unbuffered rows got increased after buffered PS, expecting %d got %d.\n", + $stats['rows_fetched_from_client_ps_unbuffered'], + $after['rows_fetched_from_client_ps_unbuffered']); + + $stats['rows_fetched_from_client_ps_buffered'] += $num_rows; + if ($after['rows_fetched_from_client_ps_buffered'] != $stats['rows_fetched_from_client_ps_buffered'] ) + printf("[005] Buffered rows should be %d got %d.\n", + $stats['rows_fetched_from_client_ps_buffered'], + $after['rows_fetched_from_client_ps_buffered']); + + $stats = $after; + printf("BUFFERED: rows_fetched_from_client_ps_unbuffered = %d\n", $stats['rows_fetched_from_client_ps_unbuffered']); + printf("BUFFERED: rows_fetched_from_client_ps_buffered = %d\n", $stats['rows_fetched_from_client_ps_buffered']); + printf("BUFFERED: rows_fetched_from_client_ps_cursor = %d\n", $stats['rows_fetched_from_client_ps_cursor']); + + $id = null; + if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test') || + !mysqli_stmt_execute($stmt) || + !mysqli_stmt_bind_result($stmt, $id)) + printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $num_rows = 0; + while (mysqli_stmt_fetch($stmt)) + $num_rows++; + + $after = mysqli_get_client_stats(); + $stats['rows_fetched_from_client_ps_unbuffered'] += $num_rows; + if ($after['rows_fetched_from_client_ps_unbuffered'] != $stats['rows_fetched_from_client_ps_unbuffered']) + printf("[007] Unbuffered rows should be %d got %d.\n", + $stats['rows_fetched_from_client_ps_unbuffered'], + $after['rows_fetched_from_client_ps_unbuffered']); + + if ($after['rows_fetched_from_client_ps_buffered'] != $stats['rows_fetched_from_client_ps_buffered'] ) + printf("[005] Buffered rows should be unchanged, expecting %d got %d.\n", + $stats['rows_fetched_from_client_ps_buffered'], + $after['rows_fetched_from_client_ps_buffered']); + + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + + $stats = $after; + printf("UNBUFFERED: rows_fetched_from_client_ps_unbuffered = %d\n", $stats['rows_fetched_from_client_ps_unbuffered']); + printf("UNBUFFERED: rows_fetched_from_client_ps_buffered = %d\n", $stats['rows_fetched_from_client_ps_buffered']); + printf("UNBUFFERED: rows_fetched_from_client_ps_cursor = %d\n", $stats['rows_fetched_from_client_ps_cursor']); + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt b/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt index 0358656ab5..f5b03996b8 100644 --- a/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt +++ b/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt @@ -14,37 +14,37 @@ if (!function_exists('mysqli_get_client_stats')) { ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - if (!$res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_STORE_RESULT)) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_STORE_RESULT)) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $num_rows = mysqli_num_rows($res); - assert($num_rows > 2); - mysqli_free_result($res); + $num_rows = mysqli_num_rows($res); + assert($num_rows > 2); + mysqli_free_result($res); - $before = mysqli_get_client_stats(); - printf("BEFORE: rows_skipped_normal = %d\n", $before['rows_skipped_normal']); + $before = mysqli_get_client_stats(); + printf("BEFORE: rows_skipped_normal = %d\n", $before['rows_skipped_normal']); - if (!$res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT)) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT)) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - /* fetch all rows but the last one */ - for ($i = 0; $i < $num_rows - 1; $i++) - $row = mysqli_fetch_assoc($res); + /* fetch all rows but the last one */ + for ($i = 0; $i < $num_rows - 1; $i++) + $row = mysqli_fetch_assoc($res); - /* enforce implicit cleaning of the wire and skipping the last row */ - mysqli_free_result($res); - $after = mysqli_get_client_stats(); - printf("AFTER: rows_skipped_normal = %d\n", $after['rows_skipped_normal']); + /* enforce implicit cleaning of the wire and skipping the last row */ + mysqli_free_result($res); + $after = mysqli_get_client_stats(); + printf("AFTER: rows_skipped_normal = %d\n", $after['rows_skipped_normal']); - if ($after['rows_skipped_normal'] != $before['rows_skipped_normal'] + 1) - printf("Statistics should show an increase of 1 for rows_skipped_normal, ". - "but before=%d after=%d\n", $before['rows_skipped_normal'], $after['rows_skipped_normal']); + if ($after['rows_skipped_normal'] != $before['rows_skipped_normal'] + 1) + printf("Statistics should show an increase of 1 for rows_skipped_normal, ". + "but before=%d after=%d\n", $before['rows_skipped_normal'], $after['rows_skipped_normal']); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECTF-- BEFORE: rows_skipped_normal = %d diff --git a/ext/mysqli/tests/mysqli_get_client_version.phpt b/ext/mysqli/tests/mysqli_get_client_version.phpt index dbf5e3004a..88e1e85e15 100644 --- a/ext/mysqli/tests/mysqli_get_client_version.phpt +++ b/ext/mysqli/tests/mysqli_get_client_version.phpt @@ -5,10 +5,10 @@ mysqli_get_client_version() <?php require_once('skipifemb.inc'); ?> --FILE-- <?php - if (!is_int($info = mysqli_get_client_version()) || ($info < 100)) - printf("[001] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info); + if (!is_int($info = mysqli_get_client_version()) || ($info < 100)) + printf("[001] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info); - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_get_connection_stats.phpt b/ext/mysqli/tests/mysqli_get_connection_stats.phpt index 45d09b1baf..8f1ffb52c9 100644 --- a/ext/mysqli/tests/mysqli_get_connection_stats.phpt +++ b/ext/mysqli/tests/mysqli_get_connection_stats.phpt @@ -14,63 +14,63 @@ if (!function_exists('mysqli_get_connection_stats')) { ?> --FILE-- <?php - require("table.inc"); + require("table.inc"); - if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info)) - printf("[003] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info); + if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info)) + printf("[003] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info); - if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2)) - printf("[004] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2); + if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2)) + printf("[004] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2); - foreach ($info as $k => &$v) { - if (strpos($k, "mem_") === 0) { - $v = 0; - } - } - foreach ($info2 as $k => &$v) { - if (strpos($k, "mem_") === 0) { - $v = 0; - } - } + foreach ($info as $k => &$v) { + if (strpos($k, "mem_") === 0) { + $v = 0; + } + } + foreach ($info2 as $k => &$v) { + if (strpos($k, "mem_") === 0) { + $v = 0; + } + } - if ($info !== $info2) { - printf("[005] The hashes should be identical except of the memory related fields\n"); - var_dump($info); - var_dump($info2); - } + if ($info !== $info2) { + printf("[005] The hashes should be identical except of the memory related fields\n"); + var_dump($info); + var_dump($info2); + } - if (!is_array($info = $link->get_connection_stats()) || empty($info)) - printf("[006] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info); + if (!is_array($info = $link->get_connection_stats()) || empty($info)) + printf("[006] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info); - foreach ($info as $k => &$v) { - if (strpos($k, "mem_") === 0) { - $v = 0; - } - } + foreach ($info as $k => &$v) { + if (strpos($k, "mem_") === 0) { + $v = 0; + } + } - if ($info !== $info2) { - printf("[007] The hashes should be identical except of the memory related fields\n"); - var_dump($info); - var_dump($info2); - } + if ($info !== $info2) { + printf("[007] The hashes should be identical except of the memory related fields\n"); + var_dump($info); + var_dump($info2); + } - mysqli_close($link); - require("table.inc"); + mysqli_close($link); + require("table.inc"); - if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info)) - printf("[008] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info); + if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info)) + printf("[008] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info); - if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2)) - printf("[009] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2); + if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2)) + printf("[009] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2); - // assuming the test is run in a plain-vanilla CLI environment - if ($info === $info2) { - printf("[010] The hashes should not be identical\n"); - var_dump($info); - var_dump($info2); - } + // assuming the test is run in a plain-vanilla CLI environment + if ($info === $info2) { + printf("[010] The hashes should not be identical\n"); + var_dump($info); + var_dump($info2); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt b/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt index a91d84413c..9dcfbe795c 100644 --- a/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt +++ b/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt @@ -14,40 +14,40 @@ if (!function_exists('mysqli_get_connection_stats')) { ?> --FILE-- <?php - // connect and table inc connect to mysql and create tables - require_once('connect.inc'); + // connect and table inc connect to mysql and create tables + require_once('connect.inc'); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - } - $before = mysqli_get_connection_stats($link); - if (!is_array($before) || empty($before)) { - printf("[002] Expecting non-empty array, got %s.\n", gettype($before)); - var_dump($before); - } + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } + $before = mysqli_get_connection_stats($link); + if (!is_array($before) || empty($before)) { + printf("[002] Expecting non-empty array, got %s.\n", gettype($before)); + var_dump($before); + } - mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - } - $after = mysqli_get_connection_stats($link); + mysqli_close($link); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } + $after = mysqli_get_connection_stats($link); - if ($before !== $after) { - printf("[004] Statistics differ!"); - var_dump($before); - var_dump($after); - } + if ($before !== $after) { + printf("[004] Statistics differ!"); + var_dump($before); + var_dump($after); + } - foreach ($after as $k => $v) - if ($v != 0) { - printf("[004] Field %s should not have any other value but 0, got %s.\n", - $k, $v); - } + foreach ($after as $k => $v) + if ($v != 0) { + printf("[004] Field %s should not have any other value but 0, got %s.\n", + $k, $v); + } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_get_host_info.phpt b/ext/mysqli/tests/mysqli_get_host_info.phpt index 534765808b..072ebc87ad 100644 --- a/ext/mysqli/tests/mysqli_get_host_info.phpt +++ b/ext/mysqli/tests/mysqli_get_host_info.phpt @@ -8,18 +8,18 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require "table.inc"; - if (!is_string($info = mysqli_get_host_info($link)) || ('' === $info)) - printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info); + require "table.inc"; + if (!is_string($info = mysqli_get_host_info($link)) || ('' === $info)) + printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info); - if ($IS_MYSQLND && $host != 'localhost' && $host != '127.0.0.1' && $port != '' && $host != "" && strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - /* this should be a TCP/IP connection and not a Unix Socket (or SHM or Named Pipe) */ - if (!stristr($info, "TCP/IP")) - printf("[004] Should be a TCP/IP connection but mysqlnd says '%s'\n", $info); - } - print "done!"; + if ($IS_MYSQLND && $host != 'localhost' && $host != '127.0.0.1' && $port != '' && $host != "" && strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { + /* this should be a TCP/IP connection and not a Unix Socket (or SHM or Named Pipe) */ + if (!stristr($info, "TCP/IP")) + printf("[004] Should be a TCP/IP connection but mysqlnd says '%s'\n", $info); + } + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_get_proto_info.phpt b/ext/mysqli/tests/mysqli_get_proto_info.phpt index c46fe30379..2eeae3d03a 100644 --- a/ext/mysqli/tests/mysqli_get_proto_info.phpt +++ b/ext/mysqli/tests/mysqli_get_proto_info.phpt @@ -8,13 +8,13 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require "table.inc"; - if (!is_int($info = mysqli_get_proto_info($link)) || ($info < 1)) - printf("[003] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info); + require "table.inc"; + if (!is_int($info = mysqli_get_proto_info($link)) || ($info < 1)) + printf("[003] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info); - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_get_server_info.phpt b/ext/mysqli/tests/mysqli_get_server_info.phpt index 25278528a6..3a1e08e029 100644 --- a/ext/mysqli/tests/mysqli_get_server_info.phpt +++ b/ext/mysqli/tests/mysqli_get_server_info.phpt @@ -8,13 +8,13 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require "table.inc"; - if (!is_string($info = mysqli_get_server_info($link)) || ('' === $info)) - printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info); + require "table.inc"; + if (!is_string($info = mysqli_get_server_info($link)) || ('' === $info)) + printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_get_server_version.phpt b/ext/mysqli/tests/mysqli_get_server_version.phpt index 6589e335b4..c249d70885 100644 --- a/ext/mysqli/tests/mysqli_get_server_version.phpt +++ b/ext/mysqli/tests/mysqli_get_server_version.phpt @@ -8,15 +8,15 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require "table.inc"; - /* 5.1.5 -> 50105 -- major_version*10000 + minor_version *100 + sub_version */ - /* < 30000 = pre 3.2.3, very unlikely! */ - if (!is_int($info = mysqli_get_server_version($link)) || ($info < (3 * 10000))) - printf("[003] Expecting int/any >= 30000, got %s/%s\n", gettype($info), $info); + require "table.inc"; + /* 5.1.5 -> 50105 -- major_version*10000 + minor_version *100 + sub_version */ + /* < 30000 = pre 3.2.3, very unlikely! */ + if (!is_int($info = mysqli_get_server_version($link)) || ($info < (3 * 10000))) + printf("[003] Expecting int/any >= 30000, got %s/%s\n", gettype($info), $info); - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_get_warnings.phpt b/ext/mysqli/tests/mysqli_get_warnings.phpt index b0076c1859..20b2607f39 100644 --- a/ext/mysqli/tests/mysqli_get_warnings.phpt +++ b/ext/mysqli/tests/mysqli_get_warnings.phpt @@ -11,135 +11,135 @@ if (!$TEST_EXPERIMENTAL) ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - if (!is_null($tmp = @mysqli_get_warnings())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + if (!is_null($tmp = @mysqli_get_warnings())) + printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!is_null($tmp = @mysqli_get_warnings($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + if (!is_null($tmp = @mysqli_get_warnings($link))) + printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!is_null($tmp = @mysqli_get_warnings(''))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + if (!is_null($tmp = @mysqli_get_warnings(''))) + printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[003] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[003] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } - if (false !== ($tmp = mysqli_get_warnings($link))) { - printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); - } + if (false !== ($tmp = mysqli_get_warnings($link))) { + printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); + } - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)")) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)")) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) { - printf("[008] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); - } + if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) { + printf("[008] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); + } - if (!method_exists($warning, 'next')) - printf("[009] Borked object, method next is missing\n"); + if (!method_exists($warning, 'next')) + printf("[009] Borked object, method next is missing\n"); - $properties = array_merge(get_object_vars($warning), get_class_vars(get_class($warning))); - if (!empty($properties)) - printf("[010] Properties have always been magic, hidden things - why are they visible now, a BC break...\n"); + $properties = array_merge(get_object_vars($warning), get_class_vars(get_class($warning))); + if (!empty($properties)) + printf("[010] Properties have always been magic, hidden things - why are they visible now, a BC break...\n"); - if ((!is_string($warning->message)) || ('' == $warning->message)) /* NULL or not there at all */ - printf("[011] Expecting string/not empty, got %s/%s\n", gettype($warning->message), $warning->message); + if ((!is_string($warning->message)) || ('' == $warning->message)) /* NULL or not there at all */ + printf("[011] Expecting string/not empty, got %s/%s\n", gettype($warning->message), $warning->message); - if ((!is_string($warning->sqlstate)) || ('' == $warning->sqlstate)) /* NULL or not there at all */ - printf("[012] Expecting string/not empty, got %s/%s\n", gettype($warning->sqlstate), $warning->sqlstate); + if ((!is_string($warning->sqlstate)) || ('' == $warning->sqlstate)) /* NULL or not there at all */ + printf("[012] Expecting string/not empty, got %s/%s\n", gettype($warning->sqlstate), $warning->sqlstate); - if ((!is_int($warning->errno)) || (0 == $warning->errno)) /* NULL or not there at all */ - printf("[013] Expecting int/not 0, got %s/%s\n", gettype($warning->errno), $warning->errno); + if ((!is_int($warning->errno)) || (0 == $warning->errno)) /* NULL or not there at all */ + printf("[013] Expecting int/not 0, got %s/%s\n", gettype($warning->errno), $warning->errno); - if (false !== ($tmp = $warning->next())) - printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = $warning->next())) + printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000), (1000001)")) - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000), (1000001)")) + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (($tmp = mysqli_warning_count($link)) !== 2) - printf("[016] Expecting 2 warnings, got %d warnings", $tmp); + if (($tmp = mysqli_warning_count($link)) !== 2) + printf("[016] Expecting 2 warnings, got %d warnings", $tmp); - if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) { - printf("[017] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); - } + if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) { + printf("[017] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); + } - if (true !== ($tmp = $warning->next())) - printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = $warning->next())) + printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = $warning->next())) - printf("[020] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = $warning->next())) + printf("[020] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[021] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[021] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (!$mysqli->query("DROP TABLE IF EXISTS t1")) - printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$mysqli->query("DROP TABLE IF EXISTS t1")) + printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$mysqli->query("CREATE TABLE t1 (a smallint)")) - printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$mysqli->query("CREATE TABLE t1 (a smallint)")) + printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_object($warning = new mysqli_warning($mysqli))) - printf("[024] Expecting object/mysqli_warning, got %s/%s", gettype($warning), $warning); + if (!is_object($warning = new mysqli_warning($mysqli))) + printf("[024] Expecting object/mysqli_warning, got %s/%s", gettype($warning), $warning); - if (!is_string($warning->message) || ('' == $warning->message)) - printf("[025] Expecting string, got %s/%s", gettype($warning->message), $warning->message); + if (!is_string($warning->message) || ('' == $warning->message)) + printf("[025] Expecting string, got %s/%s", gettype($warning->message), $warning->message); - if (!$mysqli->query("DROP TABLE t1")) - printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$mysqli->query("DROP TABLE t1")) + printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - /* Yes, I really want to check if the object property is empty */ - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[027] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + /* Yes, I really want to check if the object property is empty */ + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[027] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - $warning = new mysqli_warning($mysqli); - if (false !== ($tmp = $warning->next())) - printf("[028] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + $warning = new mysqli_warning($mysqli); + if (false !== ($tmp = $warning->next())) + printf("[028] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if ('' != ($tmp = $warning->message)) - printf("[029] Expecting string/empty, got %s/%s\n", gettype($tmp), $tmp); + if ('' != ($tmp = $warning->message)) + printf("[029] Expecting string/empty, got %s/%s\n", gettype($tmp), $tmp); - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[030] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[030] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (!$mysqli->query("DROP TABLE IF EXISTS t1")) - printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$mysqli->query("DROP TABLE IF EXISTS t1")) + printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$mysqli->query("CREATE TABLE t1 (a smallint)")) - printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$mysqli->query("CREATE TABLE t1 (a smallint)")) + printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - /* out of range, three warnings */ - if (!$mysqli->query("INSERT IGNORE INTO t1(a) VALUES (65536), (65536), (65536)")) - printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + /* out of range, three warnings */ + if (!$mysqli->query("INSERT IGNORE INTO t1(a) VALUES (65536), (65536), (65536)")) + printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $warning = new mysqli_warning($mysqli); - $i = 1; - while ($warning->next() && ('' != ($tmp = $warning->message))) { - $i++; - } - if (3 != $i) - printf("[034] Expecting three warnings, got %d warnings\n", $i); + $warning = new mysqli_warning($mysqli); + $i = 1; + while ($warning->next() && ('' != ($tmp = $warning->message))) { + $i++; + } + if (3 != $i) + printf("[034] Expecting three warnings, got %d warnings\n", $i); - $stmt = mysqli_stmt_init(); - $warning = new mysqli_warning($stmt); - if (false !== ($tmp = $warning->next())) - printf("[035] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + $stmt = mysqli_stmt_init(); + $warning = new mysqli_warning($stmt); + if (false !== ($tmp = $warning->next())) + printf("[035] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; + print "done!"; ?> <?php require_once("connect.inc"); @@ -147,10 +147,10 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) - printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); if (!mysqli_query($link, "DROP TABLE IF EXISTS t1")) - printf("[c003] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + printf("[c003] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); mysqli_close($link); ?> diff --git a/ext/mysqli/tests/mysqli_info.phpt b/ext/mysqli/tests/mysqli_info.phpt index b3a090b6e8..e0736701ac 100644 --- a/ext/mysqli/tests/mysqli_info.phpt +++ b/ext/mysqli/tests/mysqli_info.phpt @@ -10,81 +10,81 @@ require_once('skipifconnectfailure.inc'); mysqli.allow_local_infile=1 --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require "table.inc"; - if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + require "table.inc"; + if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // NOTE: empty string, no multiple insert syntax - if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp)) - printf("[004] Expecting null, got %s/%s\n", gettype($tmp), $tmp); + // NOTE: empty string, no multiple insert syntax + if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp)) + printf("[004] Expecting null, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (101, 'a'), (102, 'b')")) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (101, 'a'), (102, 'b')")) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) - printf("[006] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); + if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) + printf("[006] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, 'INSERT INTO test(id, label) SELECT id + 200, label FROM test')) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'INSERT INTO test(id, label) SELECT id + 200, label FROM test')) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) - printf("[008] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); + if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) + printf("[008] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, 'ALTER TABLE test MODIFY label CHAR(2)')) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'ALTER TABLE test MODIFY label CHAR(2)')) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) - printf("[010] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); + if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) + printf("[010] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, "UPDATE test SET label = 'b' WHERE id >= 100")) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "UPDATE test SET label = 'b' WHERE id >= 100")) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) - printf("[012] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); + if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) + printf("[012] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, "SELECT 1")) - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT 1")) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp)) - printf("[014] Expecting null, got %s/%s\n", gettype($tmp), $tmp); - mysqli_free_result($res); + if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp)) + printf("[014] Expecting null, got %s/%s\n", gettype($tmp), $tmp); + mysqli_free_result($res); - // NOTE: no LOAD DATA INFILE test - if ($dir = sys_get_temp_dir()) { - do { - $file = $dir . '/' . 'mysqli_info_phpt.cvs'; - if (!$fp = fopen($file, 'w')) - /* ignore this error */ - break; + // NOTE: no LOAD DATA INFILE test + if ($dir = sys_get_temp_dir()) { + do { + $file = $dir . '/' . 'mysqli_info_phpt.cvs'; + if (!$fp = fopen($file, 'w')) + /* ignore this error */ + break; - if (!fwrite($fp, "100;'a';\n") || - !fwrite($fp, "101;'b';\n") || - !fwrite($fp, "102;'c';\n")) { - @unlink($file); - break; - } - fclose($fp); - if (!mysqli_query($link, "DELETE FROM test")) { - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - break; - } + if (!fwrite($fp, "100;'a';\n") || + !fwrite($fp, "101;'b';\n") || + !fwrite($fp, "102;'c';\n")) { + @unlink($file); + break; + } + fclose($fp); + if (!mysqli_query($link, "DELETE FROM test")) { + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + break; + } - if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE test FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' LINES TERMINATED BY '\n'", $file))) { - /* ok, because we might not be allowed to do this */ - @unlink($file); - break; - } + if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE test FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' LINES TERMINATED BY '\n'", $file))) { + /* ok, because we might not be allowed to do this */ + @unlink($file); + break; + } - if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) - printf("[016] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); + if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) + printf("[016] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); - unlink($file); - } while (false); - } + unlink($file); + } while (false); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_init.phpt b/ext/mysqli/tests/mysqli_init.phpt index 01e53d5fe8..c8f3ac8ec5 100644 --- a/ext/mysqli/tests/mysqli_init.phpt +++ b/ext/mysqli/tests/mysqli_init.phpt @@ -8,18 +8,18 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - $link = mysqli_init(); + $link = mysqli_init(); - if (!is_object($link) && false !== $link) - printf("[001] Expecting object/mysqli_link or boolean/false, got %s/%s\n", gettype($link), $link); + if (!is_object($link) && false !== $link) + printf("[001] Expecting object/mysqli_link or boolean/false, got %s/%s\n", gettype($link), $link); - if (is_object($link) && 'mysqli' != get_class($link)) - printf("[002] Expecting object of type mysqli got object of type %s\n", get_class($link)); + if (is_object($link) && 'mysqli' != get_class($link)) + printf("[002] Expecting object of type mysqli got object of type %s\n", get_class($link)); - if ($link) - mysqli_close($link); + if ($link) + mysqli_close($link); - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_insert_id.phpt b/ext/mysqli/tests/mysqli_insert_id.phpt index ba93ba41ca..a9fc31998d 100644 --- a/ext/mysqli/tests/mysqli_insert_id.phpt +++ b/ext/mysqli/tests/mysqli_insert_id.phpt @@ -8,114 +8,114 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - require('table.inc'); - - if (0 !== ($tmp = mysqli_insert_id($link))) - printf("[003] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - - if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) { - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (0 !== ($tmp = mysqli_insert_id($link))) - printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - mysqli_free_result($res); - - // no auto_increment column - if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')")) { - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (0 !== ($tmp = mysqli_insert_id($link))) - printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - - if (!$res = mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT")) { - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('a')")) { - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (($last_id = mysqli_insert_id($link)) <= 0) - printf("[010] Expecting int/any >0, got %s/%s\n", gettype($last_id), $last_id); - - if (mysqli_query($link, "LOCK TABLE test WRITE")) { - /* we need exclusive access for a moment */ - /* let's hope nobody changes auto_increment_increment while this code executes */ - do { - if (mysqli_get_server_version($link) >= 50000) { - if (!$res = mysqli_query($link, 'SELECT @@auto_increment_increment AS inc')) { - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - break; - } - if (!$row = mysqli_fetch_assoc($res)) { - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - break; - } - mysqli_free_result($res); - $inc = $row['inc']; - } else { - $inc = 1; - } - - if (!mysqli_query($link, "INSERT INTO test(label) VALUES ('b')")) { - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - break; - } - if (($next_id = mysqli_insert_id($link)) <= $last_id) - /* - very likely a bug, but someone could have done something on the server - between the second last insert and the lock, therefore don't stop just bail - */ - printf("[014] Expecting int/any > %d, got %s/%s\n", $last_id, gettype($next_id), $next_id); - - $last_id = $next_id; - if (!mysqli_query($link, "INSERT INTO test(label) VALUES ('c'), ('d'), ('e')")) { - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - break; - } - /* - Note: For a multiple-row insert, LAST_INSERT_ID() and mysql_insert_id() actually - return the AUTO_INCREMENT key from the first of the inserted rows. This allows - multiple-row inserts to be reproduced correctly on other servers in a replication setup. - */ - if (($next_id = mysqli_insert_id($link)) != $last_id + $inc) { - printf("[016] Expecting int/%d, got %s/%s\n", $last_id + 1, gettype($next_id), $next_id); - break; - } - - if (!$res = mysqli_query($link, "SELECT LAST_INSERT_ID() AS last_id")) { - printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - break; - } - if (!$row = mysqli_fetch_assoc($res)) { - printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - break; - } - mysqli_free_result($res); - - if ($next_id != $row['last_id']) { - printf("[019] Something is wrong, check manually. Expecting %s got %s.\n", - $next_id, $row['last_id']); - break; - } - } while (false); - mysqli_query($link, "UNLOCK TABLE test"); - } - - if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (1000, 'a')")) { - printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (1000 !== ($tmp = mysqli_insert_id($link))) - printf("[021] Expecting int/1000, got %s/%s\n", gettype($tmp), $tmp); - - if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('b'), ('c')")) { - printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - if (1000 >= ($tmp = mysqli_insert_id($link))) - printf("[023] Expecting int/>1000, got %s/%s\n", gettype($tmp), $tmp); - - mysqli_close($link); + require_once("connect.inc"); + + require('table.inc'); + + if (0 !== ($tmp = mysqli_insert_id($link))) + printf("[003] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + + if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) { + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (0 !== ($tmp = mysqli_insert_id($link))) + printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + mysqli_free_result($res); + + // no auto_increment column + if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')")) { + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (0 !== ($tmp = mysqli_insert_id($link))) + printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + + if (!$res = mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT")) { + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('a')")) { + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (($last_id = mysqli_insert_id($link)) <= 0) + printf("[010] Expecting int/any >0, got %s/%s\n", gettype($last_id), $last_id); + + if (mysqli_query($link, "LOCK TABLE test WRITE")) { + /* we need exclusive access for a moment */ + /* let's hope nobody changes auto_increment_increment while this code executes */ + do { + if (mysqli_get_server_version($link) >= 50000) { + if (!$res = mysqli_query($link, 'SELECT @@auto_increment_increment AS inc')) { + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + break; + } + if (!$row = mysqli_fetch_assoc($res)) { + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + break; + } + mysqli_free_result($res); + $inc = $row['inc']; + } else { + $inc = 1; + } + + if (!mysqli_query($link, "INSERT INTO test(label) VALUES ('b')")) { + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + break; + } + if (($next_id = mysqli_insert_id($link)) <= $last_id) + /* + very likely a bug, but someone could have done something on the server + between the second last insert and the lock, therefore don't stop just bail + */ + printf("[014] Expecting int/any > %d, got %s/%s\n", $last_id, gettype($next_id), $next_id); + + $last_id = $next_id; + if (!mysqli_query($link, "INSERT INTO test(label) VALUES ('c'), ('d'), ('e')")) { + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + break; + } + /* + Note: For a multiple-row insert, LAST_INSERT_ID() and mysql_insert_id() actually + return the AUTO_INCREMENT key from the first of the inserted rows. This allows + multiple-row inserts to be reproduced correctly on other servers in a replication setup. + */ + if (($next_id = mysqli_insert_id($link)) != $last_id + $inc) { + printf("[016] Expecting int/%d, got %s/%s\n", $last_id + 1, gettype($next_id), $next_id); + break; + } + + if (!$res = mysqli_query($link, "SELECT LAST_INSERT_ID() AS last_id")) { + printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + break; + } + if (!$row = mysqli_fetch_assoc($res)) { + printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + break; + } + mysqli_free_result($res); + + if ($next_id != $row['last_id']) { + printf("[019] Something is wrong, check manually. Expecting %s got %s.\n", + $next_id, $row['last_id']); + break; + } + } while (false); + mysqli_query($link, "UNLOCK TABLE test"); + } + + if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (1000, 'a')")) { + printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (1000 !== ($tmp = mysqli_insert_id($link))) + printf("[021] Expecting int/1000, got %s/%s\n", gettype($tmp), $tmp); + + if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('b'), ('c')")) { + printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (1000 >= ($tmp = mysqli_insert_id($link))) + printf("[023] Expecting int/>1000, got %s/%s\n", gettype($tmp), $tmp); + + mysqli_close($link); try { mysqli_insert_id($link); @@ -123,7 +123,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt b/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt index 496e5e48fe..fc6b6a3ad7 100644 --- a/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt +++ b/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt @@ -21,92 +21,92 @@ mysqli_close($link); memory_limit=256M --FILE-- <?php - require('connect.inc'); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + require('connect.inc'); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (!$res = mysqli_query($link, "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if (0 === ($org_max_allowed_packet = (int)$row['Value'])) - printf("[004] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n"); + if (0 === ($org_max_allowed_packet = (int)$row['Value'])) + printf("[004] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n"); - $max_len = pow(2, 24); - if ($org_max_allowed_packet < $max_len) { - if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . ($max_len + 100))) { - if (1227 == mysqli_errno($link)) { - /* [1227] Access denied; you need the SUPER privilege for this operation */ - print "done!"; - exit(0); - } else { - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - } - } - mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[006] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + $max_len = pow(2, 24); + if ($org_max_allowed_packet < $max_len) { + if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . ($max_len + 100))) { + if (1227 == mysqli_errno($link)) { + /* [1227] Access denied; you need the SUPER privilege for this operation */ + print "done!"; + exit(0); + } else { + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + } + } + mysqli_close($link); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[006] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (!mysqli_query($link, "SET NAMES 'latin1'")) - printf("[007] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + if (!mysqli_query($link, "SET NAMES 'latin1'")) + printf("[007] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (!$res = mysqli_query($link, "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'")) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'")) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if (0 === ($max_allowed_packet = (int)$row['Value'])) - printf("[010] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n"); + if (0 === ($max_allowed_packet = (int)$row['Value'])) + printf("[010] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n"); - $max_len = pow(2, 24); - if ($max_allowed_packet < $max_len) { - printf("[011] Failed to change max_allowed_packet"); - } + $max_len = pow(2, 24); + if ($max_allowed_packet < $max_len) { + printf("[011] Failed to change max_allowed_packet"); + } - if (!mysqli_query($link, "CREATE TABLE test(col_blob LONGBLOB) ENGINE=" . $engine)) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "CREATE TABLE test(col_blob LONGBLOB) ENGINE=" . $engine)) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $query_prefix = "INSERT INTO test(col_blob) VALUES ('"; - $query_postfix = "')"; - $query_len = strlen($query_prefix) + strlen($query_postfix); - $com_query_len = 2; + $query_prefix = "INSERT INTO test(col_blob) VALUES ('"; + $query_postfix = "')"; + $query_len = strlen($query_prefix) + strlen($query_postfix); + $com_query_len = 2; - $blob = str_repeat('a', $max_len - $com_query_len - $query_len); - $query = sprintf("%s%s%s", $query_prefix, $blob, $query_postfix); + $blob = str_repeat('a', $max_len - $com_query_len - $query_len); + $query = sprintf("%s%s%s", $query_prefix, $blob, $query_postfix); - if (!mysqli_query($link, $query)) - printf("[013] max_allowed_packet = %d, strlen(query) = %d, [%d] %s\n", $max_allowed_packet, strlen($query), mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, $query)) + printf("[013] max_allowed_packet = %d, strlen(query) = %d, [%d] %s\n", $max_allowed_packet, strlen($query), mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, "SELECT col_blob FROM test")) - printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT col_blob FROM test")) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) { - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } else { - if ($row['col_blob'] != $blob) { - printf("[016] Blob seems wrong, dumping data\n"); - var_dump(strlen($row['col_blob'])); - var_dump(strlen($blob)); - } - mysqli_free_result($res); - } + if (!$row = mysqli_fetch_assoc($res)) { + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } else { + if ($row['col_blob'] != $blob) { + printf("[016] Blob seems wrong, dumping data\n"); + var_dump(strlen($row['col_blob'])); + var_dump(strlen($blob)); + } + mysqli_free_result($res); + } - if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . $org_max_allowed_packet)) - if (1227 != mysqli_errno($link)) - printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . $org_max_allowed_packet)) + if (1227 != mysqli_errno($link)) + printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_kill.phpt b/ext/mysqli/tests/mysqli_kill.phpt index f4af490a5b..943e213a81 100644 --- a/ext/mysqli/tests/mysqli_kill.phpt +++ b/ext/mysqli/tests/mysqli_kill.phpt @@ -8,61 +8,61 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - // Zend will cast the NULL to 0 - if (!is_bool($tmp = mysqli_kill($link, null))) - printf("[003] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp); + // Zend will cast the NULL to 0 + if (!is_bool($tmp = mysqli_kill($link, null))) + printf("[003] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp); - if (!$thread_id = mysqli_thread_id($link)) - printf("[004] Cannot determine thread id, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$thread_id = mysqli_thread_id($link)) + printf("[004] Cannot determine thread id, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_kill($link, $thread_id); - if (!is_bool($tmp)) - printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp); + $tmp = mysqli_kill($link, $thread_id); + if (!is_bool($tmp)) + printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp); - if ($res = mysqli_query($link, "SELECT id FROM test LIMIT 1")) - pintf("[006] Expecting boolean/false, got %s/%s\n", gettype($res), $res); + if ($res = mysqli_query($link, "SELECT id FROM test LIMIT 1")) + pintf("[006] Expecting boolean/false, got %s/%s\n", gettype($res), $res); - var_dump($error = mysqli_error($link)); - if (!is_string($error) || ('' === $error)) - printf("[007] Expecting string/any non empty, got %s/%s\n", gettype($error), $error); - var_dump($res); - var_dump($link); - if ($IS_MYSQLND) { - if ($link->info != 'Records: 6 Duplicates: 0 Warnings: 0') { - printf("[008] mysqlnd used to be more verbose and used to support SELECT\n"); - } - } else { - if ($link->info != NULL) { - printf("[008] Time for wonders - libmysql has started to support SELECT, change test\n"); - } - } + var_dump($error = mysqli_error($link)); + if (!is_string($error) || ('' === $error)) + printf("[007] Expecting string/any non empty, got %s/%s\n", gettype($error), $error); + var_dump($res); + var_dump($link); + if ($IS_MYSQLND) { + if ($link->info != 'Records: 6 Duplicates: 0 Warnings: 0') { + printf("[008] mysqlnd used to be more verbose and used to support SELECT\n"); + } + } else { + if ($link->info != NULL) { + printf("[008] Time for wonders - libmysql has started to support SELECT, change test\n"); + } + } - mysqli_close($link); + mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[010] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[010] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - mysqli_kill($link, -1); - if ((!$res = mysqli_query($link, "SELECT id FROM test LIMIT 1")) || - (!$tmp = mysqli_fetch_assoc($res))) { - printf("[011] Connection should not be gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - var_dump($tmp); - mysqli_free_result($res); - mysqli_close($link); + mysqli_kill($link, -1); + if ((!$res = mysqli_query($link, "SELECT id FROM test LIMIT 1")) || + (!$tmp = mysqli_fetch_assoc($res))) { + printf("[011] Connection should not be gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + var_dump($tmp); + mysqli_free_result($res); + mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[012] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[012] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db); mysqli_kill($link, -1); + mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db); mysqli_kill($link, -1); - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_last_insert_id.phpt b/ext/mysqli/tests/mysqli_last_insert_id.phpt index d966eca05e..b0c453d08e 100644 --- a/ext/mysqli/tests/mysqli_last_insert_id.phpt +++ b/ext/mysqli/tests/mysqli_last_insert_id.phpt @@ -7,172 +7,172 @@ API vs. SQL LAST_INSERT_ID() ?> --FILE-- <?php - /* - CAUTION: the insert_id() API call is not supposed to return - the same value as a call to the LAST_INSERT_ID() SQL function. - It is not necessarily a bug if API and SQL function return different - values. Check the MySQL C API reference manual for details. - */ - require_once("connect.inc"); - - function get_sql_id($link) { - if (!($res = $link->query("SELECT LAST_INSERT_ID() AS _id"))) { - printf("[003] [%d] %s\n", $link->errno, $link->error); - return NULL; - } - $row = $res->fetch_assoc(); - $res->close(); - - return $row['_id']; - } - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] 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("DROP TABLE IF EXISTS test") || - !$link->query("CREATE TABLE test (id INT auto_increment, label varchar(10) not null, PRIMARY KEY (id)) ENGINE=MyISAM") || - !$link->query("INSERT INTO test (id, label) VALUES (null, 'a')")) { - printf("[002] [%d] %s\n", $link->errno, $link->error); - } - - $api_id = $link->insert_id; - $sql_id = get_sql_id($link); - printf("API: %d, SQL: %d\n", $api_id, $sql_id); - - if ($api_id < 1) - printf("[004] Expecting id > 0 got %d, [%d] %s\n", $api_id, $link->errno, $link->error) ; - if ($api_id != $sql_id) - printf("[005] SQL id %d should be equal to API id %d\n", $sql_id, $api_id); - - // Not an INSERT, API value must become 0 - if (!($res = $link->query("SELECT 1 FROM DUAL"))) - printf("[006] [%d] %s\n", $link->errno, $link->error); - else - $res->close(); - - $api_id = $link->insert_id; - $new_sql_id = get_sql_id($link); - if (0 !== $api_id) { - printf("[007] API id should have been reset to 0 because previous query was SELECT, got API %d, SQL %d\n", - $api_id, $new_sql_id); - } - if ($new_sql_id != $sql_id) { - printf("[008] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id); - } - - // Insert fails, LAST_INSERT_ID shall not change, API shall return 0 - if ($link->query("INSERT INTO test (id, label) VALUES (null, null)")) { - printf("[009] The INSERT did not fail as planned, [%d] %s\n", $link->errno, $link->error); - } - $api_id = $link->insert_id; - $new_sql_id = get_sql_id($link); - - if (0 !== $api_id) { - printf("[010] API id should have been reset to 0 because previous query was SELECT, got API %d, SQL %d\n", - $api_id, $new_sql_id); - } - if ($new_sql_id != $sql_id) { - printf("[011] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id); - } - - // Sequence counter pattern... - if (!$link->query("UPDATE test SET id=LAST_INSERT_ID(id+1)")) - printf("[012] [%d] %s\n", $link->errno, $link->error); - - $api_id = $link->insert_id; - $new_sql_id = get_sql_id($link); - if ($api_id < 1) - printf("[013] Expecting id > 0 got %d, [%d] %s\n", $api_id, $link->errno, $link->error) ; - if ($api_id != $new_sql_id) - printf("[014] SQL id %d should be equal to API id %d\n", $new_sql_id, $api_id); - if ($sql_id == $new_sql_id) - printf("[015] SQL id %d should have had changed, got %d\n", $sql_id, $new_sql_id); - - $sql_id = $new_sql_id; - - // Not an INSERT (after UPDATE), API value must become 0 - if (!$link->query("SET @myvar=1")) - printf("[016] [%d] %s\n", $link->errno, $link->error); - - $api_id = $link->insert_id; - $new_sql_id = get_sql_id($link); - if (0 !== $api_id) { - printf("[017] API id should have been reset to 0 because previous query was SET, got API %d, SQL %d\n", - $api_id, $new_sql_id); - } - if ($new_sql_id != $sql_id) { - printf("[018] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id); - } - - if (!$link->query("INSERT INTO test(id, label) VALUES (LAST_INSERT_ID(id + 1), 'b')")) - printf("[019] [%d] %s\n", $link->errno, $link->error); - - $api_id = $link->insert_id; - $sql_id = get_sql_id($link); - if ($api_id != $sql_id) - printf("[020] SQL id %d should be equal to API id %d\n", $sql_id, $api_id); - - if (!$link->query("INSERT INTO test(label) VALUES ('c')")) - printf("[021] [%d] %s\n", $link->errno, $link->error); - - $api_id = $link->insert_id; - $sql_id = get_sql_id($link); - if ($api_id != $sql_id) - printf("[022] SQL id %d should be equal to API id %d\n", $sql_id, $api_id); - - if (!($res = $link->query("SELECT id, label FROM test ORDER BY id ASC"))) - printf("[023] [%d] %s\n", $link->errno, $link->error); - - printf("Dumping table contents before INSERT...SELECT experiments...\n"); - while ($row = $res->fetch_assoc()) { - printf("id = %d, label = '%s'\n", $row['id'], $row['label']); - } - $res->close(); - - if (!$link->query("INSERT INTO test(label) SELECT CONCAT(label, id) FROM test ORDER BY id ASC")) - printf("[024] [%d] %s\n", $link->errno, $link->error); - - $api_id = $link->insert_id; - $sql_id = get_sql_id($link); - if ($api_id != $sql_id) - printf("[025] SQL id %d should be equal to API id %d\n", $sql_id, $api_id); - - if ($link->query("INSERT INTO test(id, label) SELECT id, CONCAT(label, id) FROM test ORDER BY id ASC")) - printf("[026] INSERT should have failed because of duplicate PK value, [%d] %s\n", $link->errno, $link->error); - - $api_id = $link->insert_id; - $new_sql_id = get_sql_id($link); - if (0 !== $api_id) { - printf("[027] API id should have been reset to 0 because previous query failed, got API %d, SQL %d\n", - $api_id, $new_sql_id); - } - if ($new_sql_id != $sql_id) { - printf("[028] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id); - } - - /* API insert id will be 101 because of UPDATE, SQL unchanged */ - if (!$link->query(sprintf("INSERT INTO test(id, label) VALUES (%d, 'z') ON DUPLICATE KEY UPDATE id = 101", $sql_id) )) - printf("[029] [%d] %s\n", $link->errno, $link->error); - - $api_id = $link->insert_id; - $new_sql_id = get_sql_id($link); - if ($api_id != 101) - printf("[030] API id should be %d got %d\n", $sql_id, $api_id); - if ($new_sql_id != $sql_id) { - printf("[031] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id); - } - - if (!($res = $link->query("SELECT id, label FROM test ORDER BY id ASC"))) - printf("[032] [%d] %s\n", $link->errno, $link->error); - - printf("Dumping table contents after INSERT...SELECT...\n"); - while ($row = $res->fetch_assoc()) { - printf("id = %d, label = '%s'\n", $row['id'], $row['label']); - } - $res->close(); - - print "done!"; + /* + CAUTION: the insert_id() API call is not supposed to return + the same value as a call to the LAST_INSERT_ID() SQL function. + It is not necessarily a bug if API and SQL function return different + values. Check the MySQL C API reference manual for details. + */ + require_once("connect.inc"); + + function get_sql_id($link) { + if (!($res = $link->query("SELECT LAST_INSERT_ID() AS _id"))) { + printf("[003] [%d] %s\n", $link->errno, $link->error); + return NULL; + } + $row = $res->fetch_assoc(); + $res->close(); + + return $row['_id']; + } + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] 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("DROP TABLE IF EXISTS test") || + !$link->query("CREATE TABLE test (id INT auto_increment, label varchar(10) not null, PRIMARY KEY (id)) ENGINE=MyISAM") || + !$link->query("INSERT INTO test (id, label) VALUES (null, 'a')")) { + printf("[002] [%d] %s\n", $link->errno, $link->error); + } + + $api_id = $link->insert_id; + $sql_id = get_sql_id($link); + printf("API: %d, SQL: %d\n", $api_id, $sql_id); + + if ($api_id < 1) + printf("[004] Expecting id > 0 got %d, [%d] %s\n", $api_id, $link->errno, $link->error) ; + if ($api_id != $sql_id) + printf("[005] SQL id %d should be equal to API id %d\n", $sql_id, $api_id); + + // Not an INSERT, API value must become 0 + if (!($res = $link->query("SELECT 1 FROM DUAL"))) + printf("[006] [%d] %s\n", $link->errno, $link->error); + else + $res->close(); + + $api_id = $link->insert_id; + $new_sql_id = get_sql_id($link); + if (0 !== $api_id) { + printf("[007] API id should have been reset to 0 because previous query was SELECT, got API %d, SQL %d\n", + $api_id, $new_sql_id); + } + if ($new_sql_id != $sql_id) { + printf("[008] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id); + } + + // Insert fails, LAST_INSERT_ID shall not change, API shall return 0 + if ($link->query("INSERT INTO test (id, label) VALUES (null, null)")) { + printf("[009] The INSERT did not fail as planned, [%d] %s\n", $link->errno, $link->error); + } + $api_id = $link->insert_id; + $new_sql_id = get_sql_id($link); + + if (0 !== $api_id) { + printf("[010] API id should have been reset to 0 because previous query was SELECT, got API %d, SQL %d\n", + $api_id, $new_sql_id); + } + if ($new_sql_id != $sql_id) { + printf("[011] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id); + } + + // Sequence counter pattern... + if (!$link->query("UPDATE test SET id=LAST_INSERT_ID(id+1)")) + printf("[012] [%d] %s\n", $link->errno, $link->error); + + $api_id = $link->insert_id; + $new_sql_id = get_sql_id($link); + if ($api_id < 1) + printf("[013] Expecting id > 0 got %d, [%d] %s\n", $api_id, $link->errno, $link->error) ; + if ($api_id != $new_sql_id) + printf("[014] SQL id %d should be equal to API id %d\n", $new_sql_id, $api_id); + if ($sql_id == $new_sql_id) + printf("[015] SQL id %d should have had changed, got %d\n", $sql_id, $new_sql_id); + + $sql_id = $new_sql_id; + + // Not an INSERT (after UPDATE), API value must become 0 + if (!$link->query("SET @myvar=1")) + printf("[016] [%d] %s\n", $link->errno, $link->error); + + $api_id = $link->insert_id; + $new_sql_id = get_sql_id($link); + if (0 !== $api_id) { + printf("[017] API id should have been reset to 0 because previous query was SET, got API %d, SQL %d\n", + $api_id, $new_sql_id); + } + if ($new_sql_id != $sql_id) { + printf("[018] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id); + } + + if (!$link->query("INSERT INTO test(id, label) VALUES (LAST_INSERT_ID(id + 1), 'b')")) + printf("[019] [%d] %s\n", $link->errno, $link->error); + + $api_id = $link->insert_id; + $sql_id = get_sql_id($link); + if ($api_id != $sql_id) + printf("[020] SQL id %d should be equal to API id %d\n", $sql_id, $api_id); + + if (!$link->query("INSERT INTO test(label) VALUES ('c')")) + printf("[021] [%d] %s\n", $link->errno, $link->error); + + $api_id = $link->insert_id; + $sql_id = get_sql_id($link); + if ($api_id != $sql_id) + printf("[022] SQL id %d should be equal to API id %d\n", $sql_id, $api_id); + + if (!($res = $link->query("SELECT id, label FROM test ORDER BY id ASC"))) + printf("[023] [%d] %s\n", $link->errno, $link->error); + + printf("Dumping table contents before INSERT...SELECT experiments...\n"); + while ($row = $res->fetch_assoc()) { + printf("id = %d, label = '%s'\n", $row['id'], $row['label']); + } + $res->close(); + + if (!$link->query("INSERT INTO test(label) SELECT CONCAT(label, id) FROM test ORDER BY id ASC")) + printf("[024] [%d] %s\n", $link->errno, $link->error); + + $api_id = $link->insert_id; + $sql_id = get_sql_id($link); + if ($api_id != $sql_id) + printf("[025] SQL id %d should be equal to API id %d\n", $sql_id, $api_id); + + if ($link->query("INSERT INTO test(id, label) SELECT id, CONCAT(label, id) FROM test ORDER BY id ASC")) + printf("[026] INSERT should have failed because of duplicate PK value, [%d] %s\n", $link->errno, $link->error); + + $api_id = $link->insert_id; + $new_sql_id = get_sql_id($link); + if (0 !== $api_id) { + printf("[027] API id should have been reset to 0 because previous query failed, got API %d, SQL %d\n", + $api_id, $new_sql_id); + } + if ($new_sql_id != $sql_id) { + printf("[028] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id); + } + + /* API insert id will be 101 because of UPDATE, SQL unchanged */ + if (!$link->query(sprintf("INSERT INTO test(id, label) VALUES (%d, 'z') ON DUPLICATE KEY UPDATE id = 101", $sql_id) )) + printf("[029] [%d] %s\n", $link->errno, $link->error); + + $api_id = $link->insert_id; + $new_sql_id = get_sql_id($link); + if ($api_id != 101) + printf("[030] API id should be %d got %d\n", $sql_id, $api_id); + if ($new_sql_id != $sql_id) { + printf("[031] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id); + } + + if (!($res = $link->query("SELECT id, label FROM test ORDER BY id ASC"))) + printf("[032] [%d] %s\n", $link->errno, $link->error); + + printf("Dumping table contents after INSERT...SELECT...\n"); + while ($row = $res->fetch_assoc()) { + printf("id = %d, label = '%s'\n", $row['id'], $row['label']); + } + $res->close(); + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_max_links.phpt b/ext/mysqli/tests/mysqli_max_links.phpt index 8586cb9276..5dd7be9dcc 100644 --- a/ext/mysqli/tests/mysqli_max_links.phpt +++ b/ext/mysqli/tests/mysqli_max_links.phpt @@ -10,23 +10,23 @@ require_once('skipifconnectfailure.inc'); mysqli.max_links=1 --FILE-- <?php - require_once("connect.inc"); - require_once("table.inc"); - - // to make sure we have at least one working connection... - var_dump(mysqli_ping($link)); - // to make sure that max_links is really set to one - var_dump((int)ini_get('mysqli.max_links')); - - $links = array(); - for ($i = 1; $i <= 5; $i++) - if ($links[$i] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[%03d] One link is already open, it should not be possible to open more, [%d] %s, [%d] %s\n", - $i, mysqli_connect_errno(), mysqli_connect_error(), - mysqli_errno($links[$i]), mysqli_error($links[$i])); - - mysqli_close($link); - print "done!"; + require_once("connect.inc"); + require_once("table.inc"); + + // to make sure we have at least one working connection... + var_dump(mysqli_ping($link)); + // to make sure that max_links is really set to one + var_dump((int)ini_get('mysqli.max_links')); + + $links = array(); + for ($i = 1; $i <= 5; $i++) + if ($links[$i] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[%03d] One link is already open, it should not be possible to open more, [%d] %s, [%d] %s\n", + $i, mysqli_connect_errno(), mysqli_connect_error(), + mysqli_errno($links[$i]), mysqli_error($links[$i])); + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_more_results.phpt b/ext/mysqli/tests/mysqli_more_results.phpt index 5a967c0776..b6a9cb3c6a 100644 --- a/ext/mysqli/tests/mysqli_more_results.phpt +++ b/ext/mysqli/tests/mysqli_more_results.phpt @@ -8,47 +8,47 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - print "[004]\n"; - var_dump(mysqli_more_results($link)); + print "[004]\n"; + var_dump(mysqli_more_results($link)); - if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3")) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - print "[006]\n"; - $i = 1; + if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3")) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + print "[006]\n"; + $i = 1; - if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link))) - printf("[007] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret); - do { - $res = mysqli_store_result($link); - mysqli_free_result($res); - if (mysqli_more_results($link)) - printf("%d\n", $i++); - } while (mysqli_next_result($link)); + if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link))) + printf("[007] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret); + do { + $res = mysqli_store_result($link); + mysqli_free_result($res); + if (mysqli_more_results($link)) + printf("%d\n", $i++); + } while (mysqli_next_result($link)); - if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3")) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - print "[010]\n"; - $i = 1; - if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link))) - printf("[011] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret); + if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3")) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + print "[010]\n"; + $i = 1; + if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link))) + printf("[011] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret); - do { - $res = mysqli_use_result($link); - // NOTE: if you use mysqli_use_result() with mysqli_more_results() or any other info function, - // you must fetch all rows before you can loop to the next result set! - // See also the MySQL Reference Manual: mysql_use_result() - while ($row = mysqli_fetch_array($res)) - ; - mysqli_free_result($res); - if (mysqli_more_results($link)) - printf("%d\n", $i++); - } while (mysqli_next_result($link)); + do { + $res = mysqli_use_result($link); + // NOTE: if you use mysqli_use_result() with mysqli_more_results() or any other info function, + // you must fetch all rows before you can loop to the next result set! + // See also the MySQL Reference Manual: mysql_use_result() + while ($row = mysqli_fetch_array($res)) + ; + mysqli_free_result($res); + if (mysqli_more_results($link)) + printf("%d\n", $i++); + } while (mysqli_next_result($link)); - mysqli_close($link); + mysqli_close($link); try { mysqli_more_results($link); @@ -56,7 +56,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_multi_query.phpt b/ext/mysqli/tests/mysqli_multi_query.phpt index 10f1a62202..571b2d7f2a 100644 --- a/ext/mysqli/tests/mysqli_multi_query.phpt +++ b/ext/mysqli/tests/mysqli_multi_query.phpt @@ -8,99 +8,99 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (false !== ($tmp = mysqli_multi_query($link, ""))) - printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_multi_query($link, ""))) + printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3")) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3")) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $i = 0; - do { - $res = mysqli_store_result($link); - while ($row = mysqli_fetch_array($res)) - ; - mysqli_free_result($res); - $i++; - } while (mysqli_next_result($link)); + $i = 0; + do { + $res = mysqli_store_result($link); + while ($row = mysqli_fetch_array($res)) + ; + mysqli_free_result($res); + $i++; + } while (mysqli_next_result($link)); - printf("[006] %d\n", $i); + printf("[006] %d\n", $i); - if (!mysqli_multi_query($link, "ALTER TABLE test MODIFY id INT AUTO_INCREMENT; INSERT INTO test(label) VALUES ('a'); SELECT id, label FROM test ORDER BY id")) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_multi_query($link, "ALTER TABLE test MODIFY id INT AUTO_INCREMENT; INSERT INTO test(label) VALUES ('a'); SELECT id, label FROM test ORDER BY id")) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $i = 0; - while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) { + $i = 0; + while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) { - while ($row = mysqli_fetch_array($res)) - ; - mysqli_free_result($res); - printf("%d/%d\n", $i, mysqli_insert_id($link)); - $i++; - } - printf("[008] %d\n", $i); + while ($row = mysqli_fetch_array($res)) + ; + mysqli_free_result($res); + printf("%d/%d\n", $i, mysqli_insert_id($link)); + $i++; + } + printf("[008] %d\n", $i); - if (!mysqli_multi_query($link, "SELECT id, label FROM test")) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_multi_query($link, "SELECT id, label FROM test")) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $i = 0; - while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) { - while ($row = mysqli_fetch_array($res)) - $i++; - mysqli_free_result($res); - } - printf("[010] %d\n", $i); + $i = 0; + while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) { + while ($row = mysqli_fetch_array($res)) + $i++; + mysqli_free_result($res); + } + printf("[010] %d\n", $i); - if (!mysqli_multi_query($link, "SELECT 1 AS num, 'a' AS somechar; SELECT 2 AS num, 'a' AS somechar; SELECT 3 AS num, 'a' AS somechar")) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_multi_query($link, "SELECT 1 AS num, 'a' AS somechar; SELECT 2 AS num, 'a' AS somechar; SELECT 3 AS num, 'a' AS somechar")) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $res_num = 1; - do { - if (!$res = mysqli_store_result($link)) { - printf("[012 - %d] [%d] %s\n", $res_num, mysqli_errno($link), mysqli_error($link)); - continue; - } + $res_num = 1; + do { + if (!$res = mysqli_store_result($link)) { + printf("[012 - %d] [%d] %s\n", $res_num, mysqli_errno($link), mysqli_error($link)); + continue; + } - $num_rows = 0; - while ($row = mysqli_fetch_array($res)) { + $num_rows = 0; + while ($row = mysqli_fetch_array($res)) { - $num_rows++; - if ($row['num'] != $res_num) - printf("[013 - %d] Expecting %s got %s\n", $res_num, $res_num, $row['num']); - if ($row['somechar'] != "a") - printf("[014 - %d] Expecting a got %s\n", $res_num, $row['somechar']); + $num_rows++; + if ($row['num'] != $res_num) + printf("[013 - %d] Expecting %s got %s\n", $res_num, $res_num, $row['num']); + if ($row['somechar'] != "a") + printf("[014 - %d] Expecting a got %s\n", $res_num, $row['somechar']); - if (1 == $num_rows) { - /* simple metadata check */ - if (!($lengths = mysqli_fetch_lengths($res))) - printf("[015 - %d] [%d] %s\n", $res_num, mysqli_errno($link), mysqli_error($link)); + if (1 == $num_rows) { + /* simple metadata check */ + if (!($lengths = mysqli_fetch_lengths($res))) + printf("[015 - %d] [%d] %s\n", $res_num, mysqli_errno($link), mysqli_error($link)); - if (count($lengths) != 2) - printf("[016 - %d] Expecting 2 column lengths got %d [%d] %s\n", $res_num, count($lengths)); + if (count($lengths) != 2) + printf("[016 - %d] Expecting 2 column lengths got %d [%d] %s\n", $res_num, count($lengths)); - foreach ($lengths as $k => $length) - if ($length <= 0) - printf("[017 - %d] Strange column lengths for column %d, got %d expecting any > 0\n", - $res_num, $k, $length); - } - } + foreach ($lengths as $k => $length) + if ($length <= 0) + printf("[017 - %d] Strange column lengths for column %d, got %d expecting any > 0\n", + $res_num, $k, $length); + } + } - if ($num_rows != 1) - printf("[018 - %d] Expecting 1 row, got %d rows\n", $num_rows); + if ($num_rows != 1) + printf("[018 - %d] Expecting 1 row, got %d rows\n", $num_rows); - $res_num++; + $res_num++; - mysqli_free_result($res); + mysqli_free_result($res); - } while (mysqli_next_result($link)); + } while (mysqli_next_result($link)); - if ($res_num != 4) - printf("[015] Expecting 3 result sets got %d result set[s]\n", $res_num); + if ($res_num != 4) + printf("[015] Expecting 3 result sets got %d result set[s]\n", $res_num); - mysqli_close($link); + mysqli_close($link); try { mysqli_multi_query($link, "SELECT id, label FROM test"); @@ -108,7 +108,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt index 4f65f77480..159d7d9853 100644 --- a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt +++ b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt @@ -15,18 +15,18 @@ max_execution_time=60 mysqlnd.net_read_timeout=1 --FILE-- <?php - include ("connect.inc"); + include ("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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } - if (!$res = mysqli_query($link, "SELECT SLEEP(5)")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT SLEEP(5)")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --EXPECT-- [002] [2006] MySQL server has gone away diff --git a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_long.phpt b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_long.phpt index 7b69aff617..3825cd6bd8 100644 --- a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_long.phpt +++ b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_long.phpt @@ -23,22 +23,22 @@ mysqlnd.net_read_timeout=12 max_execution_time=12 --FILE-- <?php - set_time_limit(12); - include ("connect.inc"); + set_time_limit(12); + include ("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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } - if (!$res = mysqli_query($link, "SELECT SLEEP(6)")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT SLEEP(6)")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($res->fetch_assoc()); + var_dump($res->fetch_assoc()); - mysqli_free_result($res); - mysqli_close($link); + mysqli_free_result($res); + mysqli_close($link); - print "done!"; + print "done!"; ?> --EXPECT-- array(1) { diff --git a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_zero.phpt b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_zero.phpt index df273c4f14..9d1e316573 100644 --- a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_zero.phpt +++ b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_zero.phpt @@ -23,21 +23,21 @@ max_execution_time=10 mysqlnd.net_read_timeout=0 --FILE-- <?php - include ("connect.inc"); + include ("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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } - if (!$res = mysqli_query($link, "SELECT SLEEP(2)")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT SLEEP(2)")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($res->fetch_assoc()); + var_dump($res->fetch_assoc()); - mysqli_free_result($res); - mysqli_close($link); + mysqli_free_result($res); + mysqli_close($link); - print "done!"; + print "done!"; ?> --EXPECT-- array(1) { diff --git a/ext/mysqli/tests/mysqli_next_result.phpt b/ext/mysqli/tests/mysqli_next_result.phpt index 36ab5959dc..22e13f4e3f 100644 --- a/ext/mysqli/tests/mysqli_next_result.phpt +++ b/ext/mysqli/tests/mysqli_next_result.phpt @@ -8,52 +8,52 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (false !== ($tmp = mysqli_next_result($link))) - printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_next_result($link))) + printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - $res = mysqli_query($link, "SELECT 1 AS res"); - if (false !== ($tmp = mysqli_next_result($link))) - printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + $res = mysqli_query($link, "SELECT 1 AS res"); + if (false !== ($tmp = mysqli_next_result($link))) + printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - mysqli_free_result($res); + mysqli_free_result($res); - function func_test_mysqli_next_result($link, $query, $offset, $num_results) { + function func_test_mysqli_next_result($link, $query, $offset, $num_results) { - if (!mysqli_multi_query($link, $query)) - printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + if (!mysqli_multi_query($link, $query)) + printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - $i = 0; - do { - if ($res = mysqli_store_result($link)) { - mysqli_free_result($res); - $i++; - } - } while (true === mysqli_next_result($link)); + $i = 0; + do { + if ($res = mysqli_store_result($link)) { + mysqli_free_result($res); + $i++; + } + } while (true === mysqli_next_result($link)); - if ($i !== $num_results) { - printf("[%03d] Expecting %d result(s), got %d result(s)\n", $offset + 2, $num_results, $i); - } + if ($i !== $num_results) { + printf("[%03d] Expecting %d result(s), got %d result(s)\n", $offset + 2, $num_results, $i); + } - if (mysqli_more_results($link)) - printf("[%03d] mysqli_more_results() indicates more results than expected\n", $offset + 3); + if (mysqli_more_results($link)) + printf("[%03d] mysqli_more_results() indicates more results than expected\n", $offset + 3); - if (!($res = mysqli_query($link, "SELECT 1 AS b"))) { - printf("[%03d] [%d] %s\n", $offset + 4, mysqli_errno($link), mysqli_error($link)); - } else { - mysqli_free_result($res); - } + if (!($res = mysqli_query($link, "SELECT 1 AS b"))) { + printf("[%03d] [%d] %s\n", $offset + 4, mysqli_errno($link), mysqli_error($link)); + } else { + mysqli_free_result($res); + } - } + } - func_test_mysqli_next_result($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3", 5, 3); - func_test_mysqli_next_result($link, "SELECT 1 AS a; INSERT INTO test(id, label) VALUES (100, 'y'); SELECT 1 AS a, 2 AS b", 8, 2); - func_test_mysqli_next_result($link, "DELETE FROM test WHERE id >= 100; SELECT 1 AS a; ", 11, 1); + func_test_mysqli_next_result($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3", 5, 3); + func_test_mysqli_next_result($link, "SELECT 1 AS a; INSERT INTO test(id, label) VALUES (100, 'y'); SELECT 1 AS a, 2 AS b", 8, 2); + func_test_mysqli_next_result($link, "DELETE FROM test WHERE id >= 100; SELECT 1 AS a; ", 11, 1); - mysqli_close($link); + mysqli_close($link); try { mysqli_next_result($link); @@ -61,7 +61,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_no_reconnect.phpt b/ext/mysqli/tests/mysqli_no_reconnect.phpt index 481f49eedf..1f7ca8d834 100644 --- a/ext/mysqli/tests/mysqli_no_reconnect.phpt +++ b/ext/mysqli/tests/mysqli_no_reconnect.phpt @@ -10,118 +10,118 @@ require_once('skipifconnectfailure.inc'); mysqli.reconnect=0 --FILE-- <?php - require_once("connect.inc"); - require_once("table.inc"); - - if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot create second database connection, [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); - - $thread_id_timeout = mysqli_thread_id($link); - $thread_id_control = mysqli_thread_id($link2); - - if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST")) - printf("[002] Cannot get full processlist, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link)); - - $running_threads = array(); - while ($row = mysqli_fetch_assoc($res)) - $running_threads[$row['Id']] = $row; - mysqli_free_result($res); - - if (!isset($running_threads[$thread_id_timeout]) || - !isset($running_threads[$thread_id_control])) - printf("[003] Processlist is borked, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link)); - - if (!mysqli_query($link, "SET SESSION wait_timeout = 2")) - printf("[004] Cannot set wait_timeout, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'wait_timeout'")) - printf("[005] Cannot check if wait_timeout has been set, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - - if (!$row = mysqli_fetch_assoc($res)) - printf("[006] Cannot get wait_timeout, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - - if ($row['Value'] != 2) - printf("[007] Failed setting the wait_timeout, test will not work, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - - // after 2+ seconds the server should kill the connection - sleep(3); - - if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST")) - printf("[008] Cannot get full processlist, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link)); - - $running_threads = array(); - while ($row = mysqli_fetch_assoc($res)) - $running_threads[$row['Id']] = $row; - mysqli_free_result($res); - - if (isset($running_threads[$thread_id_timeout])) - printf("[009] Server should have killed the timeout connection, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link)); - - if (false !== @mysqli_ping($link)) - printf("[010] Reconnect should not have happened"); - - if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname")) - printf("[011] Executing a query should not be possible, connection should be closed, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - - if (!$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[012] Cannot create database connection, [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); - - $thread_id_timeout = mysqli_thread_id($link); - /* - Don't test for the mysqli_query() return value here. - It is undefined if the server replies to the query and how. - For example, it seems that on Linux when connecting to MySQL 5.1, - the server always manages to send a full a reply. Whereas MySQl 5.5 - may not. The behaviour is undefined. Any return value is fine. - */ - if ($IS_MYSQLND) { - /* - mysqlnd is a bit more verbose than libmysql. mysqlnd should print: - Warning: mysqli_query(): MySQL server has gone away in %s on line %d - - Warning: mysqli_query(): Error reading result set's header in %d on line %d - */ - @mysqli_query($link, sprintf('KILL %d', $thread_id_timeout)); - } else { - mysqli_query($link, sprintf('KILL %d', $thread_id_timeout)); - } - // Give the server a second to really kill the other thread... - sleep(1); - - if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST")) - printf("[014] Cannot get full processlist, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link)); - - $running_threads = array(); - while ($row = mysqli_fetch_assoc($res)) - $running_threads[$row['Id']] = $row; - mysqli_free_result($res); - - if (isset($running_threads[$thread_id_timeout]) || - !isset($running_threads[$thread_id_control])) - printf("[015] Processlist is borked, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link)); - - if (false !== ($tmp = @mysqli_ping($link))) - printf("[016] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); - - if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname")) - printf("[017] Running a query should not be possible, connection should be gone, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - - mysqli_close($link2); - print "done!"; + require_once("connect.inc"); + require_once("table.inc"); + + if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot create second database connection, [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); + + $thread_id_timeout = mysqli_thread_id($link); + $thread_id_control = mysqli_thread_id($link2); + + if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST")) + printf("[002] Cannot get full processlist, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link)); + + $running_threads = array(); + while ($row = mysqli_fetch_assoc($res)) + $running_threads[$row['Id']] = $row; + mysqli_free_result($res); + + if (!isset($running_threads[$thread_id_timeout]) || + !isset($running_threads[$thread_id_control])) + printf("[003] Processlist is borked, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link)); + + if (!mysqli_query($link, "SET SESSION wait_timeout = 2")) + printf("[004] Cannot set wait_timeout, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'wait_timeout'")) + printf("[005] Cannot check if wait_timeout has been set, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + + if (!$row = mysqli_fetch_assoc($res)) + printf("[006] Cannot get wait_timeout, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); + + if ($row['Value'] != 2) + printf("[007] Failed setting the wait_timeout, test will not work, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + + // after 2+ seconds the server should kill the connection + sleep(3); + + if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST")) + printf("[008] Cannot get full processlist, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link)); + + $running_threads = array(); + while ($row = mysqli_fetch_assoc($res)) + $running_threads[$row['Id']] = $row; + mysqli_free_result($res); + + if (isset($running_threads[$thread_id_timeout])) + printf("[009] Server should have killed the timeout connection, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link)); + + if (false !== @mysqli_ping($link)) + printf("[010] Reconnect should not have happened"); + + if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname")) + printf("[011] Executing a query should not be possible, connection should be closed, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + + if (!$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[012] Cannot create database connection, [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); + + $thread_id_timeout = mysqli_thread_id($link); + /* + Don't test for the mysqli_query() return value here. + It is undefined if the server replies to the query and how. + For example, it seems that on Linux when connecting to MySQL 5.1, + the server always manages to send a full a reply. Whereas MySQl 5.5 + may not. The behaviour is undefined. Any return value is fine. + */ + if ($IS_MYSQLND) { + /* + mysqlnd is a bit more verbose than libmysql. mysqlnd should print: + Warning: mysqli_query(): MySQL server has gone away in %s on line %d + + Warning: mysqli_query(): Error reading result set's header in %d on line %d + */ + @mysqli_query($link, sprintf('KILL %d', $thread_id_timeout)); + } else { + mysqli_query($link, sprintf('KILL %d', $thread_id_timeout)); + } + // Give the server a second to really kill the other thread... + sleep(1); + + if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST")) + printf("[014] Cannot get full processlist, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link)); + + $running_threads = array(); + while ($row = mysqli_fetch_assoc($res)) + $running_threads[$row['Id']] = $row; + mysqli_free_result($res); + + if (isset($running_threads[$thread_id_timeout]) || + !isset($running_threads[$thread_id_control])) + printf("[015] Processlist is borked, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link)); + + if (false !== ($tmp = @mysqli_ping($link))) + printf("[016] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); + + if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname")) + printf("[017] Running a query should not be possible, connection should be gone, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + + mysqli_close($link2); + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_num_fields.phpt b/ext/mysqli/tests/mysqli_num_fields.phpt index 610d311db6..df2161f685 100644 --- a/ext/mysqli/tests/mysqli_num_fields.phpt +++ b/ext/mysqli/tests/mysqli_num_fields.phpt @@ -8,39 +8,39 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - function func_test_mysqli_num_fields($link, $query, $expected, $offset, $test_free = false) { + function func_test_mysqli_num_fields($link, $query, $expected, $offset, $test_free = false) { - if (!($res = mysqli_query($link, $query))) { - printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return; - } + if (!($res = mysqli_query($link, $query))) { + printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + return; + } - if ($expected !== ($tmp = mysqli_num_fields($res))) - printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1, - gettype($expected), $expected, - gettype($tmp), $tmp); + if ($expected !== ($tmp = mysqli_num_fields($res))) + printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1, + gettype($expected), $expected, + gettype($tmp), $tmp); - mysqli_free_result($res); + mysqli_free_result($res); try { mysqli_num_fields($res); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - } + } - func_test_mysqli_num_fields($link, "SELECT 1 AS a", 1, 5); - func_test_mysqli_num_fields($link, "SELECT id, label FROM test", 2, 10); - func_test_mysqli_num_fields($link, "SELECT 1 AS a, NULL AS b, 'foo' AS c", 3, 15); - func_test_mysqli_num_fields($link, "SELECT id FROM test", 1, 20, true); + func_test_mysqli_num_fields($link, "SELECT 1 AS a", 1, 5); + func_test_mysqli_num_fields($link, "SELECT id, label FROM test", 2, 10); + func_test_mysqli_num_fields($link, "SELECT 1 AS a, NULL AS b, 'foo' AS c", 3, 15); + func_test_mysqli_num_fields($link, "SELECT id FROM test", 1, 20, true); - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_num_rows.phpt b/ext/mysqli/tests/mysqli_num_rows.phpt index f378bdd57e..3266f37dce 100644 --- a/ext/mysqli/tests/mysqli_num_rows.phpt +++ b/ext/mysqli/tests/mysqli_num_rows.phpt @@ -8,64 +8,64 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - function func_test_mysqli_num_rows($link, $query, $expected, $offset, $test_free = false) { + function func_test_mysqli_num_rows($link, $query, $expected, $offset, $test_free = false) { - if (!$res = mysqli_query($link, $query, MYSQLI_STORE_RESULT)) { - printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return; - } + if (!$res = mysqli_query($link, $query, MYSQLI_STORE_RESULT)) { + printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + return; + } - if (!is_bool($res)) { - if ($expected !== ($tmp = mysqli_num_rows($res))) - printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1, - gettype($expected), $expected, - gettype($tmp), $tmp); + if (!is_bool($res)) { + if ($expected !== ($tmp = mysqli_num_rows($res))) + printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1, + gettype($expected), $expected, + gettype($tmp), $tmp); - mysqli_free_result($res); + mysqli_free_result($res); - try { + try { mysqli_num_rows($res); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - } - } + } + } - func_test_mysqli_num_rows($link, "SELECT 1 AS a", 1, 5); - func_test_mysqli_num_rows($link, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 10); - func_test_mysqli_num_rows($link, "INSERT INTO test(id, label) VALUES (100, 'z')", NULL, 15); - func_test_mysqli_num_rows($link, "SELECT id FROM test LIMIT 2", 2, 20, true); + func_test_mysqli_num_rows($link, "SELECT 1 AS a", 1, 5); + func_test_mysqli_num_rows($link, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 10); + func_test_mysqli_num_rows($link, "INSERT INTO test(id, label) VALUES (100, 'z')", NULL, 15); + func_test_mysqli_num_rows($link, "SELECT id FROM test LIMIT 2", 2, 20, true); - if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) { + if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) { - $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); + $row = mysqli_fetch_assoc($res); + mysqli_free_result($res); - func_test_mysqli_num_rows($link, "SELECT id, label FROM test", (int)$row['num'], 25); + func_test_mysqli_num_rows($link, "SELECT id, label FROM test", (int)$row['num'], 25); - } else { - printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + } else { + printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n"; + print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n"; - if ($res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT)) { + if ($res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT)) { - $row = mysqli_fetch_row($res); - if (0 !== ($tmp = mysqli_num_rows($res))) - printf("[031] Expecting int/0, got %s/%d\n", gettype($tmp), $tmp); + $row = mysqli_fetch_row($res); + if (0 !== ($tmp = mysqli_num_rows($res))) + printf("[031] Expecting int/0, got %s/%d\n", gettype($tmp), $tmp); - mysqli_free_result($res); - } else { - printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + mysqli_free_result($res); + } else { + printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_open_bug74432.phpt b/ext/mysqli/tests/mysqli_open_bug74432.phpt index 08139081c4..9d529925e9 100644 --- a/ext/mysqli/tests/mysqli_open_bug74432.phpt +++ b/ext/mysqli/tests/mysqli_open_bug74432.phpt @@ -8,19 +8,19 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - /* This behavior is undocumented, but might be in use. Until there's no officially - supported alternative, ensure changes doesn't cause BC breach. Otherwise, - the test should be removed once the undocumented behavior changes. */ + /* This behavior is undocumented, but might be in use. Until there's no officially + supported alternative, ensure changes doesn't cause BC breach. Otherwise, + the test should be removed once the undocumented behavior changes. */ - require_once("connect.inc"); + require_once("connect.inc"); - $handle = mysqli_connect("$host:$port", $user, $passwd); + $handle = mysqli_connect("$host:$port", $user, $passwd); - var_dump($handle); + var_dump($handle); - if ($handle) { - mysqli_close($handle); - } + if ($handle) { + mysqli_close($handle); + } ?> --EXPECTF-- object(mysqli)#%d (%d) { diff --git a/ext/mysqli/tests/mysqli_options.phpt b/ext/mysqli/tests/mysqli_options.phpt index 9894cf5a29..bec663a64a 100644 --- a/ext/mysqli/tests/mysqli_options.phpt +++ b/ext/mysqli/tests/mysqli_options.phpt @@ -8,94 +8,94 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - $valid_options = array( - MYSQLI_READ_DEFAULT_GROUP => "MYSQLI_READ_DEFAULT_GROUP", - MYSQLI_READ_DEFAULT_FILE => "MYSQLI_READ_DEFAULT_FILE", - MYSQLI_OPT_CONNECT_TIMEOUT => "MYSQLI_OPT_CONNECT_TIMEOUT", - MYSQLI_OPT_LOCAL_INFILE => "MYSQLI_OPT_LOCAL_INFILE", - MYSQLI_INIT_COMMAND => "MYSQLI_INIT_COMMAND", - MYSQLI_SET_CHARSET_NAME => "MYSQLI_SET_CHARSET_NAME", - MYSQLI_OPT_SSL_VERIFY_SERVER_CERT => "MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", - ); - - if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_CMD_BUFFER_SIZE')) - $valid_options[] = constant('MYSQLI_OPT_NET_CMD_BUFFER_SIZE'); - if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_READ_BUFFER_SIZE')) - $valid_options[] = constant('MYSQLI_OPT_NET_READ_BUFFER_SIZE'); - if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) - $valid_options[] = constant('MYSQLI_OPT_INT_AND_FLOAT_NATIVE'); - - $link = mysqli_init(); - - /* set it twice, checking if memory for the previous one is correctly freed */ - mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "utf8"); - mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "latin1"); - - // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n"; - var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf')); - var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf')); - var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10)); - var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1)); - var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, array('SET AUTOCOMMIT=0', 'SET AUTOCOMMIT=1'))); - - if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - if (!$res = mysqli_query($link2, 'SELECT version() AS server_version')) - printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - $version = explode('.', $tmp['server_version']); - if (empty($version)) - printf("[008] Cannot determine server version, need MySQL Server 4.1+ for the test!\n"); - - if ($version[0] <= 4 && $version[1] < 1) - printf("[009] Need MySQL Server 4.1+ for the test!\n"); - - if (!$res = mysqli_query($link2, "SHOW CHARACTER SET")) - printf("[010] Cannot get list of available character sets, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link2)); - - $charsets = array(); - while ($row = mysqli_fetch_assoc($res)) - $charsets[] = $row; - mysqli_free_result($res); - mysqli_close($link2); - - foreach ($charsets as $charset) { - $k = $charset['Charset']; - /* The server currently 17.07.2007 can't handle data sent in ucs2 */ - /* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */ - if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32') { - continue; - } - if (true !== mysqli_options($link, MYSQLI_SET_CHARSET_NAME, $charset['Charset'])) { - printf("[009] Setting charset name '%s' has failed\n", $charset['Charset']); - } - } - - var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf')); - var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf')); - var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10)); - var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1)); - var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0')); - - /* mysqli_real_connect() */ - var_dump("MYSQLI_CLIENT_SSL", mysqli_options($link, MYSQLI_CLIENT_SSL, 'not a mysqli_option')); - - mysqli_close($link); - - echo "Link closed\n"; - try { + require_once("connect.inc"); + + $valid_options = array( + MYSQLI_READ_DEFAULT_GROUP => "MYSQLI_READ_DEFAULT_GROUP", + MYSQLI_READ_DEFAULT_FILE => "MYSQLI_READ_DEFAULT_FILE", + MYSQLI_OPT_CONNECT_TIMEOUT => "MYSQLI_OPT_CONNECT_TIMEOUT", + MYSQLI_OPT_LOCAL_INFILE => "MYSQLI_OPT_LOCAL_INFILE", + MYSQLI_INIT_COMMAND => "MYSQLI_INIT_COMMAND", + MYSQLI_SET_CHARSET_NAME => "MYSQLI_SET_CHARSET_NAME", + MYSQLI_OPT_SSL_VERIFY_SERVER_CERT => "MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", + ); + + if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_CMD_BUFFER_SIZE')) + $valid_options[] = constant('MYSQLI_OPT_NET_CMD_BUFFER_SIZE'); + if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_READ_BUFFER_SIZE')) + $valid_options[] = constant('MYSQLI_OPT_NET_READ_BUFFER_SIZE'); + if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) + $valid_options[] = constant('MYSQLI_OPT_INT_AND_FLOAT_NATIVE'); + + $link = mysqli_init(); + + /* set it twice, checking if memory for the previous one is correctly freed */ + mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "utf8"); + mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "latin1"); + + // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n"; + var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf')); + var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf')); + var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10)); + var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1)); + var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, array('SET AUTOCOMMIT=0', 'SET AUTOCOMMIT=1'))); + + if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + if (!$res = mysqli_query($link2, 'SELECT version() AS server_version')) + printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + $version = explode('.', $tmp['server_version']); + if (empty($version)) + printf("[008] Cannot determine server version, need MySQL Server 4.1+ for the test!\n"); + + if ($version[0] <= 4 && $version[1] < 1) + printf("[009] Need MySQL Server 4.1+ for the test!\n"); + + if (!$res = mysqli_query($link2, "SHOW CHARACTER SET")) + printf("[010] Cannot get list of available character sets, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link2)); + + $charsets = array(); + while ($row = mysqli_fetch_assoc($res)) + $charsets[] = $row; + mysqli_free_result($res); + mysqli_close($link2); + + foreach ($charsets as $charset) { + $k = $charset['Charset']; + /* The server currently 17.07.2007 can't handle data sent in ucs2 */ + /* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */ + if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32') { + continue; + } + if (true !== mysqli_options($link, MYSQLI_SET_CHARSET_NAME, $charset['Charset'])) { + printf("[009] Setting charset name '%s' has failed\n", $charset['Charset']); + } + } + + var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf')); + var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf')); + var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10)); + var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1)); + var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0')); + + /* mysqli_real_connect() */ + var_dump("MYSQLI_CLIENT_SSL", mysqli_options($link, MYSQLI_CLIENT_SSL, 'not a mysqli_option')); + + mysqli_close($link); + + echo "Link closed\n"; + try { mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1'); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --EXPECTF-- %s(25) "MYSQLI_READ_DEFAULT_GROUP" diff --git a/ext/mysqli/tests/mysqli_options_init_command.phpt b/ext/mysqli/tests/mysqli_options_init_command.phpt index 734adcf5c8..35e98e7e47 100644 --- a/ext/mysqli/tests/mysqli_options_init_command.phpt +++ b/ext/mysqli/tests/mysqli_options_init_command.phpt @@ -9,64 +9,64 @@ require_once('skipifconnectfailure.inc'); <?php require_once('skipifemb.inc'); ?> --FILE-- <?php - /* see mysqli.c for details */ - require_once("connect.inc"); + /* see mysqli.c for details */ + require_once("connect.inc"); - if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - /* TODO: test more options */ - if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || - !mysqli_query($link, sprintf("CREATE TABLE test(id INT) ENGINE = %s\n", $engine)) || - !mysqli_query($link, "INSERT INTO test(id) VALUES (1)")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + /* TODO: test more options */ + if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || + !mysqli_query($link, sprintf("CREATE TABLE test(id INT) ENGINE = %s\n", $engine)) || + !mysqli_query($link, "INSERT INTO test(id) VALUES (1)")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, "SELECT COUNT(id) AS _num_rows FROM test")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT COUNT(id) AS _num_rows FROM test")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); + $row = mysqli_fetch_assoc($res); + mysqli_free_result($res); - if ($row['_num_rows'] != 1) - printf("[003] Expecting 1 got %s\n", $row['_num_rows']); + if ($row['_num_rows'] != 1) + printf("[003] Expecting 1 got %s\n", $row['_num_rows']); - mysqli_close($link); + mysqli_close($link); - $link = mysqli_init(); - if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(id) VALUES (2)")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $link = mysqli_init(); + if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(id) VALUES (2)")) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) - printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) + printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!$res = mysqli_query($link, "SELECT COUNT(id) AS _num_rows FROM test")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT COUNT(id) AS _num_rows FROM test")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); + $row = mysqli_fetch_assoc($res); + mysqli_free_result($res); - if ($row['_num_rows'] != 2) - printf("[007] Expecting 1 got %s\n", $row['_num_rows']); + if ($row['_num_rows'] != 2) + printf("[007] Expecting 1 got %s\n", $row['_num_rows']); - mysqli_close($link); + mysqli_close($link); - $link = mysqli_init(); - if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(i_do_no_exist) VALUES (2)")) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $link = mysqli_init(); + if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(i_do_no_exist) VALUES (2)")) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_close($link); + mysqli_close($link); - $link = mysqli_init(); - if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(i_do_no_exist) VALUES (2)")) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $link = mysqli_init(); + if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(i_do_no_exist) VALUES (2)")) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) - printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) + printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt b/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt index 94acab84bb..8f81d4a3e4 100644 --- a/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt +++ b/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt @@ -12,94 +12,94 @@ if (!$IS_MYSQLND) ?> --FILE-- <?php - require_once("connect.inc"); - - - $types = array( - 'BIT' => array('BIT(8)', 0), - 'TINYINT' => array('TINYINT', 120), - 'BOOL' => array('BOOL', 0), - 'BOOLEAN' => array('BOOLEAN', 1), - 'SMALLINT' => array('SMALLINT', 32000), - 'MEDIUMINT' => array('MEDIUMINT', 999), - 'INT' => array('INT', 999), - 'BIGINT' => array('BIGINT', 999), - 'FLOAT' => array('FLOAT', 1.3), - 'DOUBLE' => array('DOUBLE', -1.3), - ); - - foreach ($types as $name => $data) { - $link = mysqli_init(); - if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1)) { - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - continue; - } - - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { - printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - continue; - } - - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - continue; - } - - if (!mysqli_query($link, sprintf("CREATE TABLE test (id %s)", $data[0]))) { - printf("[004] TODO [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - continue; - } - - if (!mysqli_query($link, sprintf("INSERT INTO test(id) VALUES (%f)", $data[1]))) { - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - continue; - } - - if (!$res = mysqli_query($link, "SELECT id FROM test")) { - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - continue; - } - - $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); - - if ($row['id'] !== $data[1]) { - printf("[007] Expecting %s - %s/%s got %s/%s\n", - $name, - $data[1], gettype($data[1]), $row['id'], gettype($row['id'])); - } - mysqli_close($link); - - $link = mysqli_init(); - if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 0)) { - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - continue; - } - - if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { - printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - continue; - } - - if (!$res = mysqli_query($link, "SELECT id FROM test")) { - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - continue; - } - - $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); - - if (!is_string($row['id']) || ($row['id'] != $data[1])) { - printf("[011] Expecting %s - %s/string got %s/%s\n", - $name, - $data[1], $row['id'], gettype($row['id'])); - } - mysqli_close($link); - - } - - print "done!"; + require_once("connect.inc"); + + + $types = array( + 'BIT' => array('BIT(8)', 0), + 'TINYINT' => array('TINYINT', 120), + 'BOOL' => array('BOOL', 0), + 'BOOLEAN' => array('BOOLEAN', 1), + 'SMALLINT' => array('SMALLINT', 32000), + 'MEDIUMINT' => array('MEDIUMINT', 999), + 'INT' => array('INT', 999), + 'BIGINT' => array('BIGINT', 999), + 'FLOAT' => array('FLOAT', 1.3), + 'DOUBLE' => array('DOUBLE', -1.3), + ); + + foreach ($types as $name => $data) { + $link = mysqli_init(); + if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1)) { + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + continue; + } + + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + continue; + } + + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + continue; + } + + if (!mysqli_query($link, sprintf("CREATE TABLE test (id %s)", $data[0]))) { + printf("[004] TODO [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + continue; + } + + if (!mysqli_query($link, sprintf("INSERT INTO test(id) VALUES (%f)", $data[1]))) { + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + continue; + } + + if (!$res = mysqli_query($link, "SELECT id FROM test")) { + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + continue; + } + + $row = mysqli_fetch_assoc($res); + mysqli_free_result($res); + + if ($row['id'] !== $data[1]) { + printf("[007] Expecting %s - %s/%s got %s/%s\n", + $name, + $data[1], gettype($data[1]), $row['id'], gettype($row['id'])); + } + mysqli_close($link); + + $link = mysqli_init(); + if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 0)) { + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + continue; + } + + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + continue; + } + + if (!$res = mysqli_query($link, "SELECT id FROM test")) { + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + continue; + } + + $row = mysqli_fetch_assoc($res); + mysqli_free_result($res); + + if (!is_string($row['id']) || ($row['id'] != $data[1])) { + printf("[011] Expecting %s - %s/string got %s/%s\n", + $name, + $data[1], $row['id'], gettype($row['id'])); + } + mysqli_close($link); + + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_options_openbasedir.phpt b/ext/mysqli/tests/mysqli_options_openbasedir.phpt index d7b4b6b13e..52dc03296d 100644 --- a/ext/mysqli/tests/mysqli_options_openbasedir.phpt +++ b/ext/mysqli/tests/mysqli_options_openbasedir.phpt @@ -11,15 +11,15 @@ require_once('skipifconnectfailure.inc'); require_once('connect.inc'); ini_set("open_basedir", __DIR__); if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); if ($IS_MYSQLND) { - if (true !== mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1)) - printf("[002] Can not set MYSQLI_OPT_LOCAL_INFILE although open_basedir is set!\n"); + if (true !== mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1)) + printf("[002] Can not set MYSQLI_OPT_LOCAL_INFILE although open_basedir is set!\n"); } else { - if (false !== mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1)) - printf("[002] Can set MYSQLI_OPT_LOCAL_INFILE although open_basedir is set!\n"); + if (false !== mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1)) + printf("[002] Can set MYSQLI_OPT_LOCAL_INFILE although open_basedir is set!\n"); } mysqli_close($link); diff --git a/ext/mysqli/tests/mysqli_pam_sha256.phpt b/ext/mysqli/tests/mysqli_pam_sha256.phpt index b263939837..2085ab135a 100644 --- a/ext/mysqli/tests/mysqli_pam_sha256.phpt +++ b/ext/mysqli/tests/mysqli_pam_sha256.phpt @@ -79,29 +79,29 @@ $link->close(); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, 'shatest', 'shatest', $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, "shatest", $db, $port, $socket); - } else { + if (!$link = my_mysqli_connect($host, 'shatest', 'shatest', $db, $port, $socket)) { + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, "shatest", $db, $port, $socket); + } else { - if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) - printf("[002] [%d] %s\n", $link->errno, $link->error); + if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) + printf("[002] [%d] %s\n", $link->errno, $link->error); - if (!$row = mysqli_fetch_assoc($res)) { - printf("[003] [%d] %s\n", $link->errno, $link->error); - } + if (!$row = mysqli_fetch_assoc($res)) { + printf("[003] [%d] %s\n", $link->errno, $link->error); + } - if ($row['id'] != 1) { - printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']); - } + if ($row['id'] != 1) { + printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']); + } - $res->close(); - $link->close(); - } + $res->close(); + $link->close(); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt b/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt index cd96c55ad5..5620d4f4e7 100644 --- a/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt +++ b/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt @@ -94,25 +94,25 @@ $link->close(); mysqlnd.sha256_server_public_key="test_sha256_ini" --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $link = new mysqli($host, 'shatest', 'shatest', $db, $port, $socket); - if ($link->connect_errno) { - printf("[001] [%d] %s\n", $link->connect_errno, $link->connect_error); - } else { - if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) - printf("[002] [%d] %s\n", $link->errno, $link->error); + $link = new mysqli($host, 'shatest', 'shatest', $db, $port, $socket); + if ($link->connect_errno) { + printf("[001] [%d] %s\n", $link->connect_errno, $link->connect_error); + } else { + if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) + printf("[002] [%d] %s\n", $link->errno, $link->error); - if (!$row = mysqli_fetch_assoc($res)) { - printf("[003] [%d] %s\n", $link->errno, $link->error); - } + if (!$row = mysqli_fetch_assoc($res)) { + printf("[003] [%d] %s\n", $link->errno, $link->error); + } - if ($row['id'] != 1) { - printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']); - } - } - print "done!"; + if ($row['id'] != 1) { + printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']); + } + } + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt index 190158316b..e0c25d607f 100644 --- a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt +++ b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt @@ -89,36 +89,36 @@ $link->close(); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd")); - if (file_exists($file) && is_readable($file)) { + $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd")); + if (file_exists($file) && is_readable($file)) { - $link = mysqli_init(); - if (!($link->options(MYSQLI_SERVER_PUBLIC_KEY, $file))) { - printf("[001] mysqli_options failed, [%d] %s\n", $link->errno, $link->error); - } + $link = mysqli_init(); + if (!($link->options(MYSQLI_SERVER_PUBLIC_KEY, $file))) { + printf("[001] mysqli_options failed, [%d] %s\n", $link->errno, $link->error); + } - if (!$link->real_connect($host, 'shatest', 'shatest', $db, $port, $socket)) { - printf("[002] [%d] %s\n", $link->connect_errno, $link->connect_error); - } + if (!$link->real_connect($host, 'shatest', 'shatest', $db, $port, $socket)) { + printf("[002] [%d] %s\n", $link->connect_errno, $link->connect_error); + } - if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) - printf("[003] [%d] %s\n", $link->errno, $link->error); + if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) + printf("[003] [%d] %s\n", $link->errno, $link->error); - if (!$row = mysqli_fetch_assoc($res)) { - printf("[004] [%d] %s\n", $link->errno, $link->error); - } + if (!$row = mysqli_fetch_assoc($res)) { + printf("[004] [%d] %s\n", $link->errno, $link->error); + } - if ($row['id'] != 1) { - printf("[005] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']); - } + if ($row['id'] != 1) { + printf("[005] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']); + } - $res->close(); - $link->close(); - } + $res->close(); + $link->close(); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt index 8cbe1e7b4e..8e8121f6e7 100644 --- a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt +++ b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt @@ -89,80 +89,80 @@ $link->close(); ?> --FILE-- <?php - require_once("connect.inc"); - - function sha_connect($offset, $host, $db, $port, $socket, $file) { - - $link = mysqli_init(); - if (!($link->options(MYSQLI_SERVER_PUBLIC_KEY, $file))) { - printf("[%03d + 001] mysqli_options failed, [%d] %s\n", $offset, $link->errno, $link->error); - return false; - } - - if (!$link->real_connect($host, 'shatest', 'shatest', $db, $port, $socket)) { - printf("[%03d + 002] [%d] %s\n", $offset, $link->connect_errno, $link->connect_error); - return false; - } - - if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) - printf("[%03d + 003] [%d] %s\n", $offset, $link->errno, $link->error); - return false; - - if (!$row = mysqli_fetch_assoc($res)) { - printf("[%03d + 004] [%d] %s\n", $offset, $link->errno, $link->error); - return false; - } - - if ($row['id'] != 1) { - printf("[%03d + 005] Expecting 1 got %s/'%s'", $offset, gettype($row['id']), $row['id']); - return false; - } - - $res->close(); - $link->close(); - return true; - } - - $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd")); - if (file_exists($file) && is_readable($file)) { - - /* valid key */ - sha_connect(100, $host, $db, $port, $socket, $file); - - /* invalid key */ - $file_wrong = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_wrong" , @date("Ymd")); - - $key = file_get_contents($file); - $key = str_replace("A", "a", $key); - $key = str_replace("M", "m", $key); - @unlink($file_wrong); - if (!($fp = fopen($file_wrong, "w"))) { - printf("[002] Can't write public key file."); - } else { - fwrite($fp, $key); - fclose($fp); - sha_connect(200, $host, $db, $port, $socket, $file_wrong); - } - - /* empty file */ - @unlink($file_wrong); - if (!($fp = fopen($file_wrong, "w"))) { - printf("[003] Can't write public key file."); - } else { - fwrite($fp, ""); - fclose($fp); - sha_connect(300, $host, $db, $port, $socket, $file_wrong); - } - - /* file does not exist */ - @unlink($file_wrong); - sha_connect(400, $host, $db, $port, $socket, $file_wrong); - - } else { - printf("[001] Cannot read public key file."); - } - - print "done!"; + require_once("connect.inc"); + + function sha_connect($offset, $host, $db, $port, $socket, $file) { + + $link = mysqli_init(); + if (!($link->options(MYSQLI_SERVER_PUBLIC_KEY, $file))) { + printf("[%03d + 001] mysqli_options failed, [%d] %s\n", $offset, $link->errno, $link->error); + return false; + } + + if (!$link->real_connect($host, 'shatest', 'shatest', $db, $port, $socket)) { + printf("[%03d + 002] [%d] %s\n", $offset, $link->connect_errno, $link->connect_error); + return false; + } + + if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) + printf("[%03d + 003] [%d] %s\n", $offset, $link->errno, $link->error); + return false; + + if (!$row = mysqli_fetch_assoc($res)) { + printf("[%03d + 004] [%d] %s\n", $offset, $link->errno, $link->error); + return false; + } + + if ($row['id'] != 1) { + printf("[%03d + 005] Expecting 1 got %s/'%s'", $offset, gettype($row['id']), $row['id']); + return false; + } + + $res->close(); + $link->close(); + return true; + } + + $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd")); + if (file_exists($file) && is_readable($file)) { + + /* valid key */ + sha_connect(100, $host, $db, $port, $socket, $file); + + /* invalid key */ + $file_wrong = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_wrong" , @date("Ymd")); + + $key = file_get_contents($file); + $key = str_replace("A", "a", $key); + $key = str_replace("M", "m", $key); + @unlink($file_wrong); + if (!($fp = fopen($file_wrong, "w"))) { + printf("[002] Can't write public key file."); + } else { + fwrite($fp, $key); + fclose($fp); + sha_connect(200, $host, $db, $port, $socket, $file_wrong); + } + + /* empty file */ + @unlink($file_wrong); + if (!($fp = fopen($file_wrong, "w"))) { + printf("[003] Can't write public key file."); + } else { + fwrite($fp, ""); + fclose($fp); + sha_connect(300, $host, $db, $port, $socket, $file_wrong); + } + + /* file does not exist */ + @unlink($file_wrong); + sha_connect(400, $host, $db, $port, $socket, $file_wrong); + + } else { + printf("[001] Cannot read public key file."); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_pconn_conn_multiple.phpt b/ext/mysqli/tests/mysqli_pconn_conn_multiple.phpt index f1adcf49f5..a68a6bb339 100644 --- a/ext/mysqli/tests/mysqli_pconn_conn_multiple.phpt +++ b/ext/mysqli/tests/mysqli_pconn_conn_multiple.phpt @@ -12,133 +12,133 @@ mysqli.max_persistent=-1 mysqli.max_links=-1 --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $phost = 'p:' . $host; + $phost = 'p:' . $host; - if (!$link = my_mysqli_connect($phost, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $phost, $user, $db, $port, $socket); + if (!$link = my_mysqli_connect($phost, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $phost, $user, $db, $port, $socket); - if (!$thread_id = $link->thread_id) - printf("[002] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$thread_id = $link->thread_id) + printf("[002] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))) - printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))) + printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); - if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0)) - printf("[004] Expecting int/any got %s/%s\n", gettype($tmp), $tmp); + if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0)) + printf("[004] Expecting int/any got %s/%s\n", gettype($tmp), $tmp); - if ($thread_id == $new_thread_id) - printf("[005] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id); + if ($thread_id == $new_thread_id) + printf("[005] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id); - if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) || - !($row = mysqli_fetch_assoc($res))) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) || + !($row = mysqli_fetch_assoc($res))) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($row); - mysqli_free_result($res); + var_dump($row); + mysqli_free_result($res); - mysqli_close($link); + mysqli_close($link); - if (!$link = new my_mysqli($phost, $user, $passwd, $db, $port, $socket)) - printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $phost, $user, $db, $port, $socket); + if (!$link = new my_mysqli($phost, $user, $passwd, $db, $port, $socket)) + printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $phost, $user, $db, $port, $socket); - if (!$thread_id = $link->thread_id) - printf("[008] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$thread_id = $link->thread_id) + printf("[008] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket))) - printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket))) + printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); - if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0)) - printf("[010] Expecting int/any got %s/%s\n", gettype($tmp), $tmp); + if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0)) + printf("[010] Expecting int/any got %s/%s\n", gettype($tmp), $tmp); - if ($thread_id == $new_thread_id) - printf("[011] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id); + if ($thread_id == $new_thread_id) + printf("[011] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id); - if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) || - !($row = $res->fetch_assoc())) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) || + !($row = $res->fetch_assoc())) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($row); - mysqli_free_result($res); + var_dump($row); + mysqli_free_result($res); - mysqli_close($link); + mysqli_close($link); - if (NULL !== ($tmp = $link->connect($phost, $user, $passwd, $db, $port, $socket))) - printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = $link->connect($phost, $user, $passwd, $db, $port, $socket))) + printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); - if (!$link = mysqli_connect($phost, $user, $passwd, $db, $port, $socket)) - printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $phost, $user, $db, $port, $socket); + if (!$link = mysqli_connect($phost, $user, $passwd, $db, $port, $socket)) + printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $phost, $user, $db, $port, $socket); - if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket))) - printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket))) + printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); - printf("Flipping phost/host order\n"); + printf("Flipping phost/host order\n"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[016] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[016] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!$thread_id = mysqli_thread_id($link)) - printf("[017] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$thread_id = mysqli_thread_id($link)) + printf("[017] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (true !== ($tmp = my_mysqli_real_connect($link, $phost, $user, $passwd, $db, $port, $socket))) - printf("[018] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = my_mysqli_real_connect($link, $phost, $user, $passwd, $db, $port, $socket))) + printf("[018] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); - if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0)) - printf("[019] Expecting int/any got %s/%s\n", gettype($tmp), $tmp); + if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0)) + printf("[019] Expecting int/any got %s/%s\n", gettype($tmp), $tmp); - if ($thread_id == $new_thread_id) - printf("[020] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id); + if ($thread_id == $new_thread_id) + printf("[020] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id); - if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) || - !($row = mysqli_fetch_assoc($res))) - printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) || + !($row = mysqli_fetch_assoc($res))) + printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($row); - mysqli_free_result($res); + var_dump($row); + mysqli_free_result($res); - mysqli_close($link); + mysqli_close($link); - if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[022] 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 = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!$thread_id = $link->thread_id) - printf("[023] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$thread_id = $link->thread_id) + printf("[023] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (true !== ($tmp = $link->real_connect($phost, $user, $passwd, $db, $port, $socket))) - printf("[024] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = $link->real_connect($phost, $user, $passwd, $db, $port, $socket))) + printf("[024] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); - if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0)) - printf("[025] Expecting int/any got %s/%s\n", gettype($tmp), $tmp); + if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0)) + printf("[025] Expecting int/any got %s/%s\n", gettype($tmp), $tmp); - if ($thread_id == $new_thread_id) - printf("[026] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id); + if ($thread_id == $new_thread_id) + printf("[026] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id); - if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) || - !($row = $res->fetch_assoc())) - printf("[027] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) || + !($row = $res->fetch_assoc())) + printf("[027] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($row); - mysqli_free_result($res); + var_dump($row); + mysqli_free_result($res); - mysqli_close($link); + mysqli_close($link); - if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket))) - printf("[028] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket))) + printf("[028] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); - if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[029] 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 = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[029] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (NULL !== ($tmp = $link->connect($phost, $user, $passwd, $db, $port, $socket))) - printf("[030] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = $link->connect($phost, $user, $passwd, $db, $port, $socket))) + printf("[030] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); - print "done!"; + print "done!"; ?> --EXPECT-- array(1) { diff --git a/ext/mysqli/tests/mysqli_pconn_disabled.phpt b/ext/mysqli/tests/mysqli_pconn_disabled.phpt index e8c592f9ff..a59a43cbd5 100644 --- a/ext/mysqli/tests/mysqli_pconn_disabled.phpt +++ b/ext/mysqli/tests/mysqli_pconn_disabled.phpt @@ -14,44 +14,44 @@ mysqli.max_persistent=2 mysqli.max_links=2 --FILE-- <?php - require_once("connect.inc"); - - $host = 'p:' . $host; - if (!$link1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - // automatic downgrade to normal connections has failed - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", - $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); - } - if (!mysqli_query($link1, "SET @pcondisabled = 'Connection 1'")) - printf("[002] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n", - mysqli_errno($link1), mysqli_error($link1)); - - if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - // automatic downgrade to normal connections has failed - printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", - $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); - } - - if (!$res = mysqli_query($link1, 'SELECT @pcondisabled AS _test')) - printf("[004] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); - - $row = mysqli_fetch_assoc($res); - printf("Connecction 1 - SELECT @pcondisabled -> '%s'\n", $row['_test']); - mysqli_free_result($res); - - if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test')) - printf("[005] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); - - $row = mysqli_fetch_assoc($res); - printf("Connecction 2 - SELECT @pcondisabled -> '%s'\n", $row['_test']); - mysqli_free_result($res); - - if ($link1 === $link2) - printf("[006] Links should not be identical\n"); - - mysqli_close($link1); - mysqli_close($link2); - print "done!"; + require_once("connect.inc"); + + $host = 'p:' . $host; + if (!$link1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + // automatic downgrade to normal connections has failed + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", + $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); + } + if (!mysqli_query($link1, "SET @pcondisabled = 'Connection 1'")) + printf("[002] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n", + mysqli_errno($link1), mysqli_error($link1)); + + if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + // automatic downgrade to normal connections has failed + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", + $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); + } + + if (!$res = mysqli_query($link1, 'SELECT @pcondisabled AS _test')) + printf("[004] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); + + $row = mysqli_fetch_assoc($res); + printf("Connecction 1 - SELECT @pcondisabled -> '%s'\n", $row['_test']); + mysqli_free_result($res); + + if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test')) + printf("[005] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); + + $row = mysqli_fetch_assoc($res); + printf("Connecction 2 - SELECT @pcondisabled -> '%s'\n", $row['_test']); + mysqli_free_result($res); + + if ($link1 === $link2) + printf("[006] Links should not be identical\n"); + + mysqli_close($link1); + mysqli_close($link2); + print "done!"; ?> --EXPECTF-- Warning: my_mysqli_connect(): Persistent connections are disabled. Downgrading to normal in %s on line %d diff --git a/ext/mysqli/tests/mysqli_pconn_kill.phpt b/ext/mysqli/tests/mysqli_pconn_kill.phpt index d6fba4d8e3..abf2c838f8 100644 --- a/ext/mysqli/tests/mysqli_pconn_kill.phpt +++ b/ext/mysqli/tests/mysqli_pconn_kill.phpt @@ -12,84 +12,84 @@ mysqli.allow_persistent=1 mysqli.max_persistent=2 --FILE-- <?php - require_once("connect.inc"); - require_once("table.inc"); + require_once("connect.inc"); + require_once("table.inc"); - $host = 'p:' . $host; - if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + $host = 'p:' . $host; + if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - // get the thread ids of the two connections... - $thread_id = mysqli_thread_id($link); - $pthread_id = mysqli_thread_id($plink); + // get the thread ids of the two connections... + $thread_id = mysqli_thread_id($link); + $pthread_id = mysqli_thread_id($plink); - if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST')) - printf("[002] Cannot get processlist, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST')) + printf("[002] Cannot get processlist, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $running_threads = array(); - while ($row = mysqli_fetch_assoc($res)) - $running_threads[$row['Id']] = $row; - mysqli_free_result($res); + $running_threads = array(); + while ($row = mysqli_fetch_assoc($res)) + $running_threads[$row['Id']] = $row; + mysqli_free_result($res); - if (count($running_threads) < 2) - printf("[003] Processlist is too short, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (count($running_threads) < 2) + printf("[003] Processlist is too short, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!isset($running_threads[$thread_id])) - printf("[004] Cannot find thread id of the regular link, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!isset($running_threads[$thread_id])) + printf("[004] Cannot find thread id of the regular link, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!isset($running_threads[$pthread_id])) - printf("[005] Cannot find thread id of the persistent link, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!isset($running_threads[$pthread_id])) + printf("[005] Cannot find thread id of the persistent link, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // Kill the persistent connection - don't use mysqli_kill, mysqlnd will catch that... - if (!mysqli_query($link, sprintf('KILL %d', $pthread_id))) - printf("[006] Cannot kill persistent connection, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_close($plink); - // Give the server think-time to kill the pthread - sleep(1); + // Kill the persistent connection - don't use mysqli_kill, mysqlnd will catch that... + if (!mysqli_query($link, sprintf('KILL %d', $pthread_id))) + printf("[006] Cannot kill persistent connection, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_close($plink); + // Give the server think-time to kill the pthread + sleep(1); - if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST')) - printf("[007] Cannot get processlist, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST')) + printf("[007] Cannot get processlist, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $running_threads2 = array(); - while ($row = mysqli_fetch_assoc($res)) - $running_threads2[$row['Id']] = $row; - mysqli_free_result($res); + $running_threads2 = array(); + while ($row = mysqli_fetch_assoc($res)) + $running_threads2[$row['Id']] = $row; + mysqli_free_result($res); - if (isset($running_threads2[$pthread_id])) - printf("[008] Thread of the persistent connection should have been gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!isset($running_threads2[$thread_id])) - printf("[009] Thread of the regular connection should be still there, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (isset($running_threads2[$pthread_id])) + printf("[008] Thread of the persistent connection should have been gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!isset($running_threads2[$thread_id])) + printf("[009] Thread of the regular connection should be still there, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // On PHP side this should do nothing. PHP should not try to close the connection or something. + // On PHP side this should do nothing. PHP should not try to close the connection or something. try { mysqli_close($plink); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!$plink = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[011] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - if (!$res3 = @mysqli_query($plink, 'SELECT id FROM test ORDER BY id LIMIT 1')) { - printf("[012] New persistent connection cannot execute queries, [%d] %s\n", @mysqli_errno($plink), @mysqli_error($plink)); - } - - @mysqli_free_result($res3); - @mysqli_close($plink); - mysqli_close($link); - - // remove the "p:<host>" from the host variable - $host = substr($host, 2); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[013] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - if (!$res4 = mysqli_query($link, 'SELECT id FROM test ORDER BY id LIMIT 1')) - printf("[014] New regular connection cannot execute queries, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - mysqli_free_result($res4); - mysqli_close($link); - print "done!"; + if (!$plink = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[011] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + if (!$res3 = @mysqli_query($plink, 'SELECT id FROM test ORDER BY id LIMIT 1')) { + printf("[012] New persistent connection cannot execute queries, [%d] %s\n", @mysqli_errno($plink), @mysqli_error($plink)); + } + + @mysqli_free_result($res3); + @mysqli_close($plink); + mysqli_close($link); + + // remove the "p:<host>" from the host variable + $host = substr($host, 2); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[013] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + if (!$res4 = mysqli_query($link, 'SELECT id FROM test ORDER BY id LIMIT 1')) + printf("[014] New regular connection cannot execute queries, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + mysqli_free_result($res4); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_pconn_limits.phpt b/ext/mysqli/tests/mysqli_pconn_limits.phpt index 311d8ed21e..b00b99883a 100644 --- a/ext/mysqli/tests/mysqli_pconn_limits.phpt +++ b/ext/mysqli/tests/mysqli_pconn_limits.phpt @@ -13,77 +13,77 @@ mysqli.max_persistent=-1 mysqli.max_links=-1 --FILE-- <?php - require_once("connect.inc"); - // opens a regular connection - require_once("table.inc"); + require_once("connect.inc"); + // opens a regular connection + require_once("table.inc"); - if (!$res = mysqli_query($link, "SELECT 'works..' as _desc")) - printf("[001] Cannot run query, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT 'works..' as _desc")) + printf("[001] Cannot run query, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); - $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); - printf("Regular connection 1 - '%s'\n", $row['_desc']); + $row = mysqli_fetch_assoc($res); + mysqli_free_result($res); + printf("Regular connection 1 - '%s'\n", $row['_desc']); - if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[002] Cannot open second regular connection, [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); + if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[002] Cannot open second regular connection, [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); - if (!$res = mysqli_query($link2, "SELECT 'works...' as _desc")) - printf("[003] Cannot run query, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link2)); + if (!$res = mysqli_query($link2, "SELECT 'works...' as _desc")) + printf("[003] Cannot run query, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link2)); - $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); - printf("Regular connection 2 - '%s'\n", $row['_desc']); + $row = mysqli_fetch_assoc($res); + mysqli_free_result($res); + printf("Regular connection 2 - '%s'\n", $row['_desc']); - $host = 'p:' . $host; - if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[004] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", - $host, $user, $db, $port, $socket, - mysqli_connect_errno(), mysqli_connect_error()); + $host = 'p:' . $host; + if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[004] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", + $host, $user, $db, $port, $socket, + mysqli_connect_errno(), mysqli_connect_error()); - if (!$res = mysqli_query($plink, "SELECT 'works...' as _desc")) - printf("[005] Cannot run query, [%d] %s\n", - mysqli_errno($plink), mysqli_error($plink)); + if (!$res = mysqli_query($plink, "SELECT 'works...' as _desc")) + printf("[005] Cannot run query, [%d] %s\n", + mysqli_errno($plink), mysqli_error($plink)); - $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); - printf("Persistent connection 1 - '%s'\n", $row['_desc']); + $row = mysqli_fetch_assoc($res); + mysqli_free_result($res); + printf("Persistent connection 1 - '%s'\n", $row['_desc']); - if (!$plink2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[006] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", - $host, $user, $db, $port, $socket, - mysqli_connect_errno(), mysqli_connect_error()); + if (!$plink2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[006] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", + $host, $user, $db, $port, $socket, + mysqli_connect_errno(), mysqli_connect_error()); - if (!$res = mysqli_query($plink2, "SELECT 'works...' as _desc")) - printf("[007] Cannot run query, [%d] %s\n", - mysqli_errno($plink2), mysqli_error($plink2)); + if (!$res = mysqli_query($plink2, "SELECT 'works...' as _desc")) + printf("[007] Cannot run query, [%d] %s\n", + mysqli_errno($plink2), mysqli_error($plink2)); - $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); - printf("Persistent connection 2 - '%s'\n", $row['_desc']); + $row = mysqli_fetch_assoc($res); + mysqli_free_result($res); + printf("Persistent connection 2 - '%s'\n", $row['_desc']); - $plink3 = mysqli_init(); - if (!my_mysqli_real_connect($plink3, $host, $user, $passwd, $db, $port, $socket)) - printf("[008] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", - $host, $user, $db, $port, $socket, - mysqli_connect_errno(), mysqli_connect_error()); + $plink3 = mysqli_init(); + if (!my_mysqli_real_connect($plink3, $host, $user, $passwd, $db, $port, $socket)) + printf("[008] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", + $host, $user, $db, $port, $socket, + mysqli_connect_errno(), mysqli_connect_error()); - if (!$res = mysqli_query($plink3, "SELECT 'works...' as _desc")) - printf("[009] Cannot run query, [%d] %s\n", - mysqli_errno($plink2), mysqli_error($plink2)); + if (!$res = mysqli_query($plink3, "SELECT 'works...' as _desc")) + printf("[009] Cannot run query, [%d] %s\n", + mysqli_errno($plink2), mysqli_error($plink2)); - $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); - printf("Persistent connection 3 - '%s'\n", $row['_desc']); + $row = mysqli_fetch_assoc($res); + mysqli_free_result($res); + printf("Persistent connection 3 - '%s'\n", $row['_desc']); - mysqli_close($link); - mysqli_close($link2); - mysqli_close($plink); - mysqli_close($plink2); - mysqli_close($plink3); - print "done!"; + mysqli_close($link); + mysqli_close($link2); + mysqli_close($plink); + mysqli_close($plink2); + mysqli_close($plink3); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_pconn_max_links.phpt b/ext/mysqli/tests/mysqli_pconn_max_links.phpt index 00d75430ed..b8be6f121c 100644 --- a/ext/mysqli/tests/mysqli_pconn_max_links.phpt +++ b/ext/mysqli/tests/mysqli_pconn_max_links.phpt @@ -45,151 +45,151 @@ mysqli.max_persistent=2 mysqli.rollback_on_cached_plink=1 --FILE-- <?php - require_once("connect.inc"); - require_once('table.inc'); - - - if (!mysqli_query($link, 'DROP USER pcontest') || - !mysqli_query($link, 'DROP USER pcontest@localhost') || - !mysqli_query($link, 'CREATE USER pcontest@"%" IDENTIFIED BY "pcontest"') || - !mysqli_query($link, 'CREATE USER pcontest@localhost IDENTIFIED BY "pcontest"') || - !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'%%'", $db)) || - !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'localhost'", $db))) { - printf("[000] Init failed, [%d] %s\n", - mysqli_errno($plink), mysqli_error($plink)); - } + require_once("connect.inc"); + require_once('table.inc'); + + + if (!mysqli_query($link, 'DROP USER pcontest') || + !mysqli_query($link, 'DROP USER pcontest@localhost') || + !mysqli_query($link, 'CREATE USER pcontest@"%" IDENTIFIED BY "pcontest"') || + !mysqli_query($link, 'CREATE USER pcontest@localhost IDENTIFIED BY "pcontest"') || + !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'%%'", $db)) || + !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'localhost'", $db))) { + printf("[000] Init failed, [%d] %s\n", + mysqli_errno($plink), mysqli_error($plink)); + } - try { - mysqli_get_links_stats(1); - } catch (ArgumentCountError $exception) { - echo $exception->getMessage() . "\n"; - } + try { + mysqli_get_links_stats(1); + } catch (ArgumentCountError $exception) { + echo $exception->getMessage() . "\n"; + } - echo "Before pconnect:"; - var_dump(mysqli_get_links_stats()); + echo "Before pconnect:"; + var_dump(mysqli_get_links_stats()); - if (!$plink = my_mysqli_connect('p:' . $host, 'pcontest', 'pcontest', $db, $port, $socket)) - printf("[001] Cannot connect using the second DB user created during SKIPIF, [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); + if (!$plink = my_mysqli_connect('p:' . $host, 'pcontest', 'pcontest', $db, $port, $socket)) + printf("[001] Cannot connect using the second DB user created during SKIPIF, [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); - echo "After pconnect:"; - var_dump(mysqli_get_links_stats()); + echo "After pconnect:"; + var_dump(mysqli_get_links_stats()); - ob_start(); - phpinfo(); - $phpinfo = strip_tags(ob_get_contents()); - ob_end_clean(); + ob_start(); + phpinfo(); + $phpinfo = strip_tags(ob_get_contents()); + ob_end_clean(); - $phpinfo = substr($phpinfo, strpos($phpinfo, 'MysqlI Support => enabled'), 500); - if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches)) - printf("[002] Cannot get # active persistent links from phpinfo()\n"); - $num_plinks = $matches[1]; + $phpinfo = substr($phpinfo, strpos($phpinfo, 'MysqlI Support => enabled'), 500); + if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches)) + printf("[002] Cannot get # active persistent links from phpinfo()\n"); + $num_plinks = $matches[1]; - if (!$res = mysqli_query($plink, 'SELECT id, label FROM test WHERE id = 1')) - printf("[003] Cannot run query on persistent connection of second DB user, [%d] %s\n", - mysqli_errno($plink), mysqli_error($plink)); + if (!$res = mysqli_query($plink, 'SELECT id, label FROM test WHERE id = 1')) + printf("[003] Cannot run query on persistent connection of second DB user, [%d] %s\n", + mysqli_errno($plink), mysqli_error($plink)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[004] Cannot run fetch result, [%d] %s\n", - mysqli_errno($plink), mysqli_error($plink)); - mysqli_free_result($res); - var_dump($row); + if (!$row = mysqli_fetch_assoc($res)) + printf("[004] Cannot run fetch result, [%d] %s\n", + mysqli_errno($plink), mysqli_error($plink)); + mysqli_free_result($res); + var_dump($row); - // change the password for the second DB user and kill the persistent connection - if ((!mysqli_query($link, 'SET PASSWORD FOR pcontest = "newpass"') && - !mysqli_query($link, 'SET PASSWORD FOR pcontest = PASSWORD("newpass")'))|| - !mysqli_query($link, 'FLUSH PRIVILEGES')) - printf("[005] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + // change the password for the second DB user and kill the persistent connection + if ((!mysqli_query($link, 'SET PASSWORD FOR pcontest = "newpass"') && + !mysqli_query($link, 'SET PASSWORD FOR pcontest = PASSWORD("newpass")'))|| + !mysqli_query($link, 'FLUSH PRIVILEGES')) + printf("[005] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); // change the password for the second DB user and kill the persistent connection - if ((!mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = "newpass"') && - !mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = PASSWORD("newpass")')) || - !mysqli_query($link, 'FLUSH PRIVILEGES')) - printf("[006] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - // persistent connections cannot be closed but only be killed - $pthread_id = mysqli_thread_id($plink); - if (!mysqli_query($link, sprintf('KILL %d', $pthread_id))) - printf("[007] Cannot KILL persistent connection of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // give the server a second to really kill the thread - sleep(1); - - if (!$res = mysqli_query($link, "SHOW FULL PROCESSLIST")) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $running_threads = array(); - while ($row = mysqli_fetch_assoc($res)) - $running_threads[$row['Id']] = $row; - mysqli_free_result($res); - - if (isset($running_threads[$pthread_id])) - printf("[009] Persistent connection has not been killed\n"); - - echo "Before second pconnect:"; - var_dump(mysqli_get_links_stats()); - - // this fails and we have 0 (<= $num_plinks) connections - if ($plink = @my_mysqli_connect('p:' . $host, 'pcontest', 'pcontest', $db, $port, $socket)) - printf("[010] Can connect using the old password, [%d] %s\n", - mysqli_connect_errno($link), mysqli_connect_error($link)); - - echo "After second pconnect:"; - var_dump(mysqli_get_links_stats()); - - ob_start(); - phpinfo(); - $phpinfo = strip_tags(ob_get_contents()); - ob_end_clean(); - $phpinfo = substr($phpinfo, stripos($phpinfo, 'MysqlI Support => enabled'), 500); - if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches)) - printf("[010] Cannot get # of active persistent links from phpinfo()\n"); - - var_dump(mysqli_get_links_stats()); - - $num_plinks_kill = $matches[1]; - $sstats = mysqli_get_links_stats(); - if ($sstats['active_plinks'] != $num_plinks_kill) { - printf("[010.2] Num of active plinks differ %s %s\n", $sstats['active_plinks'], $num_plinks_kill); - } - if ($num_plinks_kill > $num_plinks) - printf("[011] Expecting Active Persistent Links < %d, got %d\n", $num_plinks, $num_plinks_kill); - - if (!$plink = my_mysqli_connect('p:' . $host, 'pcontest', 'newpass', $db, $port, $socket)) - printf("[012] Cannot connect using the new password, [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); - - if (!$res = mysqli_query($plink, 'SELECT id, label FROM test WHERE id = 1')) - printf("[013] Cannot run query on persistent connection of second DB user, [%d] %s\n", - mysqli_errno($plink), mysqli_error($plink)); - - if (!$row = mysqli_fetch_assoc($res)) - printf("[014] Cannot run fetch result, [%d] %s\n", - mysqli_errno($plink), mysqli_error($plink)); - mysqli_free_result($res); - var_dump($row); - - if ($plink2 = my_mysqli_connect('p:' . $host, 'pcontest', 'newpass', $db, $port, $socket)) { - printf("[015] Can open more persistent connections than allowed, [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); - var_dump(mysqli_get_links_stats()); - } - - ob_start(); - phpinfo(); - $phpinfo = strip_tags(ob_get_contents()); - ob_end_clean(); - $phpinfo = substr($phpinfo, stripos($phpinfo, 'MysqlI Support => enabled'), 500); - if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches)) - printf("[016] Cannot get # of active persistent links from phpinfo()\n"); - - $num_plinks = $matches[1]; - if ($num_plinks > (int)ini_get('mysqli.max_persistent')) - printf("[017] mysqli.max_persistent=%d allows %d open connections!\n", ini_get('mysqli.max_persistent'),$num_plinks); + if ((!mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = "newpass"') && + !mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = PASSWORD("newpass")')) || + !mysqli_query($link, 'FLUSH PRIVILEGES')) + printf("[006] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + // persistent connections cannot be closed but only be killed + $pthread_id = mysqli_thread_id($plink); + if (!mysqli_query($link, sprintf('KILL %d', $pthread_id))) + printf("[007] Cannot KILL persistent connection of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + // give the server a second to really kill the thread + sleep(1); + + if (!$res = mysqli_query($link, "SHOW FULL PROCESSLIST")) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $running_threads = array(); + while ($row = mysqli_fetch_assoc($res)) + $running_threads[$row['Id']] = $row; + mysqli_free_result($res); + + if (isset($running_threads[$pthread_id])) + printf("[009] Persistent connection has not been killed\n"); + + echo "Before second pconnect:"; + var_dump(mysqli_get_links_stats()); + + // this fails and we have 0 (<= $num_plinks) connections + if ($plink = @my_mysqli_connect('p:' . $host, 'pcontest', 'pcontest', $db, $port, $socket)) + printf("[010] Can connect using the old password, [%d] %s\n", + mysqli_connect_errno($link), mysqli_connect_error($link)); + + echo "After second pconnect:"; + var_dump(mysqli_get_links_stats()); + + ob_start(); + phpinfo(); + $phpinfo = strip_tags(ob_get_contents()); + ob_end_clean(); + $phpinfo = substr($phpinfo, stripos($phpinfo, 'MysqlI Support => enabled'), 500); + if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches)) + printf("[010] Cannot get # of active persistent links from phpinfo()\n"); + + var_dump(mysqli_get_links_stats()); + + $num_plinks_kill = $matches[1]; + $sstats = mysqli_get_links_stats(); + if ($sstats['active_plinks'] != $num_plinks_kill) { + printf("[010.2] Num of active plinks differ %s %s\n", $sstats['active_plinks'], $num_plinks_kill); + } + if ($num_plinks_kill > $num_plinks) + printf("[011] Expecting Active Persistent Links < %d, got %d\n", $num_plinks, $num_plinks_kill); + + if (!$plink = my_mysqli_connect('p:' . $host, 'pcontest', 'newpass', $db, $port, $socket)) + printf("[012] Cannot connect using the new password, [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); + + if (!$res = mysqli_query($plink, 'SELECT id, label FROM test WHERE id = 1')) + printf("[013] Cannot run query on persistent connection of second DB user, [%d] %s\n", + mysqli_errno($plink), mysqli_error($plink)); + + if (!$row = mysqli_fetch_assoc($res)) + printf("[014] Cannot run fetch result, [%d] %s\n", + mysqli_errno($plink), mysqli_error($plink)); + mysqli_free_result($res); + var_dump($row); + + if ($plink2 = my_mysqli_connect('p:' . $host, 'pcontest', 'newpass', $db, $port, $socket)) { + printf("[015] Can open more persistent connections than allowed, [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); + var_dump(mysqli_get_links_stats()); + } - mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest'); - mysqli_query($link, 'DROP USER pcontest'); - mysqli_close($link); - print "done!"; + ob_start(); + phpinfo(); + $phpinfo = strip_tags(ob_get_contents()); + ob_end_clean(); + $phpinfo = substr($phpinfo, stripos($phpinfo, 'MysqlI Support => enabled'), 500); + if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches)) + printf("[016] Cannot get # of active persistent links from phpinfo()\n"); + + $num_plinks = $matches[1]; + if ($num_plinks > (int)ini_get('mysqli.max_persistent')) + printf("[017] mysqli.max_persistent=%d allows %d open connections!\n", ini_get('mysqli.max_persistent'),$num_plinks); + + mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest'); + mysqli_query($link, 'DROP USER pcontest'); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_pconn_reuse.phpt b/ext/mysqli/tests/mysqli_pconn_reuse.phpt index 926f6b797c..89600c48d9 100644 --- a/ext/mysqli/tests/mysqli_pconn_reuse.phpt +++ b/ext/mysqli/tests/mysqli_pconn_reuse.phpt @@ -14,72 +14,72 @@ mysqli.max_persistent=2 mysqli.max_links=2 --FILE-- <?php - require_once("connect.inc"); - - $host = 'p:' . $host; - if (!$link1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", - $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); - } - if (!mysqli_query($link1, 'SET @pcondisabled = "Connection 1"')) - printf("[002] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n", - mysqli_errno($link1), mysqli_error($link1)); - - if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", - $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); - } - - if (!$res = mysqli_query($link1, 'SELECT @pcondisabled AS _test')) - printf("[004] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); - - $row = mysqli_fetch_assoc($res); - printf("Connection 1 - SELECT @pcondisabled -> '%s'\n", $row['_test']); - mysqli_free_result($res); - - if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test')) - printf("[005] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); - - $row = mysqli_fetch_assoc($res); - printf("Connection 2 (no reuse) - SELECT @pcondisabled -> '%s'\n", $row['_test']); - $thread_id = mysqli_thread_id($link2); - printf("Connection 2 (no reuse) - Thread ID -> '%s'\n", $thread_id); - mysqli_free_result($res); - - if (!mysqli_query($link2, 'SET @pcondisabled = "Connection 2"')) - printf("[006] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link2)); - - if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test')) - printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); - - $row = mysqli_fetch_assoc($res); - printf("Connection 2 - SELECT @pcondisabled -> '%s'\n", $row['_test']); - mysqli_free_result($res); - - mysqli_close($link2); - - /* reuse of existing persistent connection expected! */ - if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", - $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); - } - - if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test')) - printf("[009] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); - - $row = mysqli_fetch_assoc($res); - printf("Connection 2 (reuse) - SELECT @pcondisabled -> '%s'\n", $row['_test']); - $thread_id_reuse = mysqli_thread_id($link2); - printf("Connection 2 (reuse) - Thread ID -> '%s'\n", $thread_id_reuse); - mysqli_free_result($res); - - if ($thread_id != $thread_id_reuse) - printf("[010] Seems as if we have got a new connection, connections should have been cached and reused!\n"); - - mysqli_close($link1); - mysqli_close($link2); - print "done!"; + require_once("connect.inc"); + + $host = 'p:' . $host; + if (!$link1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", + $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); + } + if (!mysqli_query($link1, 'SET @pcondisabled = "Connection 1"')) + printf("[002] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n", + mysqli_errno($link1), mysqli_error($link1)); + + if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", + $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); + } + + if (!$res = mysqli_query($link1, 'SELECT @pcondisabled AS _test')) + printf("[004] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); + + $row = mysqli_fetch_assoc($res); + printf("Connection 1 - SELECT @pcondisabled -> '%s'\n", $row['_test']); + mysqli_free_result($res); + + if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test')) + printf("[005] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); + + $row = mysqli_fetch_assoc($res); + printf("Connection 2 (no reuse) - SELECT @pcondisabled -> '%s'\n", $row['_test']); + $thread_id = mysqli_thread_id($link2); + printf("Connection 2 (no reuse) - Thread ID -> '%s'\n", $thread_id); + mysqli_free_result($res); + + if (!mysqli_query($link2, 'SET @pcondisabled = "Connection 2"')) + printf("[006] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link2)); + + if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test')) + printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); + + $row = mysqli_fetch_assoc($res); + printf("Connection 2 - SELECT @pcondisabled -> '%s'\n", $row['_test']); + mysqli_free_result($res); + + mysqli_close($link2); + + /* reuse of existing persistent connection expected! */ + if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n", + $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); + } + + if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test')) + printf("[009] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); + + $row = mysqli_fetch_assoc($res); + printf("Connection 2 (reuse) - SELECT @pcondisabled -> '%s'\n", $row['_test']); + $thread_id_reuse = mysqli_thread_id($link2); + printf("Connection 2 (reuse) - Thread ID -> '%s'\n", $thread_id_reuse); + mysqli_free_result($res); + + if ($thread_id != $thread_id_reuse) + printf("[010] Seems as if we have got a new connection, connections should have been cached and reused!\n"); + + mysqli_close($link1); + mysqli_close($link2); + print "done!"; ?> --EXPECTF-- Connection 1 - SELECT @pcondisabled -> 'Connection 1' diff --git a/ext/mysqli/tests/mysqli_pconn_twice.phpt b/ext/mysqli/tests/mysqli_pconn_twice.phpt index ca2acd1369..e388847507 100644 --- a/ext/mysqli/tests/mysqli_pconn_twice.phpt +++ b/ext/mysqli/tests/mysqli_pconn_twice.phpt @@ -13,57 +13,57 @@ mysqli.max_persistent=-1 mysqli.max_links=-1 --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $host = 'p:' . $host; - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + $host = 'p:' . $host; + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))) - printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))) + printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); - /* it is undefined which pooled connection we get - thread ids may differ */ + /* it is undefined which pooled connection we get - thread ids may differ */ - if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) || - !($row = mysqli_fetch_assoc($res))) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) || + !($row = mysqli_fetch_assoc($res))) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($row); - mysqli_free_result($res); + var_dump($row); + mysqli_free_result($res); - mysqli_close($link); + mysqli_close($link); - if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[007] 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 = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket))) - printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket))) + printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); - /* it is undefined which pooled connection we get - thread ids may differ */ + /* it is undefined which pooled connection we get - thread ids may differ */ - if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) || - !($row = $res->fetch_assoc())) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) || + !($row = $res->fetch_assoc())) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($row); - mysqli_free_result($res); + var_dump($row); + mysqli_free_result($res); - mysqli_close($link); + mysqli_close($link); - if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket))) - printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket))) + printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); - if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[014] 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 = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket))) - printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket))) + printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); - print "done!"; + print "done!"; ?> --EXPECT-- array(1) { diff --git a/ext/mysqli/tests/mysqli_pconnect.phpt b/ext/mysqli/tests/mysqli_pconnect.phpt index 3fb14d25d9..16fbb27e31 100644 --- a/ext/mysqli/tests/mysqli_pconnect.phpt +++ b/ext/mysqli/tests/mysqli_pconnect.phpt @@ -8,65 +8,65 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $host = 'p:' . $host; - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + $host = 'p:' . $host; + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - mysqli_close($link); + mysqli_close($link); - $num = 20; - $connections = array(); - for ($i = 0; $i < $num; $i++) { - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - $connections[] = $link; - } - while (count($connections)) { - do { - $index = mt_rand(0, $num); - } while (!isset($connections[$index])); - mysqli_close($connections[$index]); - unset($connections[$index]); - } + $num = 20; + $connections = array(); + for ($i = 0; $i < $num; $i++) { + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + $connections[] = $link; + } + while (count($connections)) { + do { + $index = mt_rand(0, $num); + } while (!isset($connections[$index])); + mysqli_close($connections[$index]); + unset($connections[$index]); + } - $connections = array(); - $num = 20; - for ($i = 0; $i < $num; $i++) { - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - $connections[] = $link; - } - $left = $num; + $connections = array(); + $num = 20; + for ($i = 0; $i < $num; $i++) { + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + $connections[] = $link; + } + $left = $num; - while (count($connections) && $left > 0) { - do { - $index = mt_rand(0, $num); - } while (!isset($connections[$index]) && $left > 0); - if (mt_rand(0, 1) > 0) { - $left--; - mysqli_close($connections[$index]); - unset($connections[$index]); - } else { - $left--; - if (!$connections[$index] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - } - flush(); - } + while (count($connections) && $left > 0) { + do { + $index = mt_rand(0, $num); + } while (!isset($connections[$index]) && $left > 0); + if (mt_rand(0, 1) > 0) { + $left--; + mysqli_close($connections[$index]); + unset($connections[$index]); + } else { + $left--; + if (!$connections[$index] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + flush(); + } - while (count($connections)) { - do { - $index = mt_rand(0, $num); - } while (!isset($connections[$index])); - mysqli_close($connections[$index]); - unset($connections[$index]); - } + while (count($connections)) { + do { + $index = mt_rand(0, $num); + } while (!isset($connections[$index])); + mysqli_close($connections[$index]); + unset($connections[$index]); + } - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_phpinfo.phpt b/ext/mysqli/tests/mysqli_phpinfo.phpt index 4f856f2b65..d1ecdea796 100644 --- a/ext/mysqli/tests/mysqli_phpinfo.phpt +++ b/ext/mysqli/tests/mysqli_phpinfo.phpt @@ -8,54 +8,54 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - include("connect.inc"); + include("connect.inc"); - @ob_clean(); - ob_start(); - phpinfo(); - $phpinfo = ob_get_contents(); - ob_end_clean(); + @ob_clean(); + ob_start(); + phpinfo(); + $phpinfo = ob_get_contents(); + ob_end_clean(); - /* all versions should at least dump this minimum information */ - if (!stristr($phpinfo, "mysqli support")) - printf("[001] ext/mysqli should have exposed itself.\n"); + /* all versions should at least dump this minimum information */ + if (!stristr($phpinfo, "mysqli support")) + printf("[001] ext/mysqli should have exposed itself.\n"); - if (!stristr($phpinfo, "client api library version")) - printf("[002] ext/mysqli should have exposed the library version.\n"); + if (!stristr($phpinfo, "client api library version")) + printf("[002] ext/mysqli should have exposed the library version.\n"); - if (!stristr($phpinfo, "mysqli.default_host")) - printf("[003] php.ini setting mysqli.default_host not shown.\n"); + if (!stristr($phpinfo, "mysqli.default_host")) + printf("[003] php.ini setting mysqli.default_host not shown.\n"); - if (!stristr($phpinfo, "mysqli.default_port")) - printf("[004] php.ini setting mysqli.default_port not shown.\n"); + if (!stristr($phpinfo, "mysqli.default_port")) + printf("[004] php.ini setting mysqli.default_port not shown.\n"); - if (!stristr($phpinfo, "mysqli.default_pw")) - printf("[005] php.ini setting mysqli.default_pw not shown.\n"); + if (!stristr($phpinfo, "mysqli.default_pw")) + printf("[005] php.ini setting mysqli.default_pw not shown.\n"); - if (!stristr($phpinfo, "mysqli.default_socket")) - printf("[006] php.ini setting mysqli.default_socket not shown.\n"); + if (!stristr($phpinfo, "mysqli.default_socket")) + printf("[006] php.ini setting mysqli.default_socket not shown.\n"); - if (!stristr($phpinfo, "mysqli.default_user")) - printf("[007] php.ini setting mysqli.default_user not shown.\n"); + if (!stristr($phpinfo, "mysqli.default_user")) + printf("[007] php.ini setting mysqli.default_user not shown.\n"); - if (!stristr($phpinfo, "mysqli.max_links")) - printf("[008] php.ini setting mysqli.max_links not shown.\n"); + if (!stristr($phpinfo, "mysqli.max_links")) + printf("[008] php.ini setting mysqli.max_links not shown.\n"); - if (!stristr($phpinfo, "mysqli.reconnect")) - printf("[009] php.ini setting mysqli.reconnect not shown.\n"); + if (!stristr($phpinfo, "mysqli.reconnect")) + printf("[009] php.ini setting mysqli.reconnect not shown.\n"); - if ($IS_MYSQLND) { - $expected = array( - 'size', - 'mysqli.allow_local_infile', - 'mysqli.allow_persistent', 'mysqli.max_persistent' - ); - foreach ($expected as $k => $entry) - if (!stristr($phpinfo, $entry)) - printf("[010] Could not find entry for '%s'\n", $entry); - } + if ($IS_MYSQLND) { + $expected = array( + 'size', + 'mysqli.allow_local_infile', + 'mysqli.allow_persistent', 'mysqli.max_persistent' + ); + foreach ($expected as $k => $entry) + if (!stristr($phpinfo, $entry)) + printf("[010] Could not find entry for '%s'\n", $entry); + } - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_ping.phpt b/ext/mysqli/tests/mysqli_ping.phpt index aec065c3de..40a3115f3d 100644 --- a/ext/mysqli/tests/mysqli_ping.phpt +++ b/ext/mysqli/tests/mysqli_ping.phpt @@ -8,30 +8,30 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - var_dump(mysqli_ping($link)); + var_dump(mysqli_ping($link)); - // provoke an error to check if mysqli_ping resets it - $res = mysqli_query($link, 'SELECT * FROM unknown_table'); - if (!($errno = mysqli_errno($link))) - printf("[003] Statement should have caused an error\n"); + // provoke an error to check if mysqli_ping resets it + $res = mysqli_query($link, 'SELECT * FROM unknown_table'); + if (!($errno = mysqli_errno($link))) + printf("[003] Statement should have caused an error\n"); - var_dump(mysqli_ping($link)); - if ($errno === mysqli_errno($link)) - printf("[004] Error codes should have been reset\n"); + var_dump(mysqli_ping($link)); + if ($errno === mysqli_errno($link)) + printf("[004] Error codes should have been reset\n"); - mysqli_close($link); + mysqli_close($link); - try { + try { mysqli_ping($link); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --EXPECT-- bool(true) diff --git a/ext/mysqli/tests/mysqli_poll.phpt b/ext/mysqli/tests/mysqli_poll.phpt index f6d99c8e13..97b1a7e61a 100644 --- a/ext/mysqli/tests/mysqli_poll.phpt +++ b/ext/mysqli/tests/mysqli_poll.phpt @@ -12,103 +12,103 @@ if (!$IS_MYSQLND) ?> --FILE-- <?php - require_once('connect.inc'); - - function get_connection() { - global $host, $user, $passwd, $db, $port, $socket; - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - return $link; - } - - if (!$link = get_connection()) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - - $read = $error = $reject = array($link); - if (0 !== ($tmp = (mysqli_poll($read, $error, $reject, 0, 1)))) - printf("[009] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true)); - - $read = $error = $reject = array($link); - if (false !== ($tmp = (mysqli_poll($read, $error, $reject, -1, 1)))) - printf("[010] Expecting false got %s/%s\n", gettype($tmp), var_export($tmp, true)); - - $read = $error = $reject = array($link); - if (false !== ($tmp = (mysqli_poll($read, $error, $reject, 0, -1)))) - printf("[011] Expecting false got %s/%s\n", gettype($tmp), var_export($tmp, true)); - - function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) { - - if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 1000))) - printf("[%03d + 1] There should be %d links ready to read from, %d ready\n", - $exp_ready, $tmp); - - foreach ($links as $mysqli) { - if ($use_oo_syntax) { - $res = $mysqli->reap_async_query(); - } else { - $res = mysqli_reap_async_query($mysqli); - } - if (is_object($res)) { - printf("[%03d + 2] Can fetch resultset although no query has been run!\n", $offset); - } else if (mysqli_errno($mysqli) > 0) { - printf("[%03d + 3] Error indicated through links array: %d/%s", - $offset, mysqli_errno($mysqli), mysqli_error($mysqli)); - } else { - printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset); - } - } - - foreach ($errors as $mysqli) - printf("[%03d + 5] Error on %d: %d/%s\n", - $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli)); - - foreach ($reject as $mysqli) - printf("[%03d + 6] Rejecting thread %d: %d/%s\n", - $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli)); - - } - - // Connections on which no query has been send - 1 - $link = get_connection(); - $links = array($link); - $errors = array($link); - $reject = array($link); - poll_async(12, $link, $links, $errors, $reject, 0, false); - mysqli_close($link); - - $link = get_connection(); - $links = array($link); - $errors = array($link); - $reject = array($link); - poll_async(13, $link, $links, $errors, $reject, 0, true); - mysqli_close($link); - - // Connections on which no query has been send - 2 - // Difference: pass $links twice - $link = get_connection(); - $links = array($link, $link); - $errors = array($link, $link); - $reject = array(); - poll_async(14, $link, $links, $errors, $reject, 0, false); - - // Connections on which no query has been send - 3 - // Difference: pass two connections - $link = get_connection(); - $links = array($link, get_connection()); - $errors = array($link, $link); - $reject = array(); - poll_async(15, $link, $links, $errors, $reject, 0, false); - - // Reference mess... - $link = get_connection(); - $links = array($link); - $errors = array($link); - $ref_errors =& $errors; - $reject = array(); - poll_async(16, $link, $links, $ref_errors, $reject, 0, false); - - print "done!"; + require_once('connect.inc'); + + function get_connection() { + global $host, $user, $passwd, $db, $port, $socket; + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + return $link; + } + + if (!$link = get_connection()) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + + $read = $error = $reject = array($link); + if (0 !== ($tmp = (mysqli_poll($read, $error, $reject, 0, 1)))) + printf("[009] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true)); + + $read = $error = $reject = array($link); + if (false !== ($tmp = (mysqli_poll($read, $error, $reject, -1, 1)))) + printf("[010] Expecting false got %s/%s\n", gettype($tmp), var_export($tmp, true)); + + $read = $error = $reject = array($link); + if (false !== ($tmp = (mysqli_poll($read, $error, $reject, 0, -1)))) + printf("[011] Expecting false got %s/%s\n", gettype($tmp), var_export($tmp, true)); + + function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) { + + if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 1000))) + printf("[%03d + 1] There should be %d links ready to read from, %d ready\n", + $exp_ready, $tmp); + + foreach ($links as $mysqli) { + if ($use_oo_syntax) { + $res = $mysqli->reap_async_query(); + } else { + $res = mysqli_reap_async_query($mysqli); + } + if (is_object($res)) { + printf("[%03d + 2] Can fetch resultset although no query has been run!\n", $offset); + } else if (mysqli_errno($mysqli) > 0) { + printf("[%03d + 3] Error indicated through links array: %d/%s", + $offset, mysqli_errno($mysqli), mysqli_error($mysqli)); + } else { + printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset); + } + } + + foreach ($errors as $mysqli) + printf("[%03d + 5] Error on %d: %d/%s\n", + $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli)); + + foreach ($reject as $mysqli) + printf("[%03d + 6] Rejecting thread %d: %d/%s\n", + $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli)); + + } + + // Connections on which no query has been send - 1 + $link = get_connection(); + $links = array($link); + $errors = array($link); + $reject = array($link); + poll_async(12, $link, $links, $errors, $reject, 0, false); + mysqli_close($link); + + $link = get_connection(); + $links = array($link); + $errors = array($link); + $reject = array($link); + poll_async(13, $link, $links, $errors, $reject, 0, true); + mysqli_close($link); + + // Connections on which no query has been send - 2 + // Difference: pass $links twice + $link = get_connection(); + $links = array($link, $link); + $errors = array($link, $link); + $reject = array(); + poll_async(14, $link, $links, $errors, $reject, 0, false); + + // Connections on which no query has been send - 3 + // Difference: pass two connections + $link = get_connection(); + $links = array($link, get_connection()); + $errors = array($link, $link); + $reject = array(); + poll_async(15, $link, $links, $errors, $reject, 0, false); + + // Reference mess... + $link = get_connection(); + $links = array($link); + $errors = array($link); + $ref_errors =& $errors; + $reject = array(); + poll_async(16, $link, $links, $ref_errors, $reject, 0, false); + + print "done!"; ?> --EXPECTF-- Warning: mysqli_poll(): Negative values passed for sec and/or usec in %s on line %d diff --git a/ext/mysqli/tests/mysqli_poll_kill.phpt b/ext/mysqli/tests/mysqli_poll_kill.phpt index 7c10d13df1..c796c06c70 100644 --- a/ext/mysqli/tests/mysqli_poll_kill.phpt +++ b/ext/mysqli/tests/mysqli_poll_kill.phpt @@ -12,175 +12,175 @@ if (!$IS_MYSQLND) ?> --FILE-- <?php - require_once('connect.inc'); - - function get_connection() { - global $host, $user, $passwd, $db, $port, $socket; - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - return $link; - } - - // Killing connection - 1 - - $link = get_connection(); - if (true !== ($tmp = mysqli_query($link, "SELECT 1 AS 'processed before killed'", MYSQLI_ASYNC | MYSQLI_USE_RESULT))) - printf("[002] Expecting boolean/true got %s/%s\n", gettype($tmp), var_export($tmp, true)); - - // Sleep 0.1s - the asynchronous query should have been processed after the wait period - usleep(100000); - $thread_id = mysqli_thread_id($link); - mysqli_kill(get_connection(), $thread_id); - - $links = array($link); - $errors = array($link); - $reject = array($link); - - // Yes, 1 - the asynchronous query should have been processed - if (1 !== ($tmp = (mysqli_poll($links, $errors, $reject, 0, 10000)))) - printf("[003] Expecting int/1 got %s/%s\n", gettype($tmp), var_export($tmp, true)); - - if (!is_array($links) || empty($links)) - printf("[004] Expecting non-empty array got %s/%s\n", gettype($links), var_export($links, true)); - else - foreach ($links as $link) { - if (is_object($res = mysqli_reap_async_query($link))) { - // Yes, you can fetch a result - the query has been processed - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - } else if ($link->errno > 0) { - printf("[005] Error: %d\n", $link->errno); - } - } - - // No error! - if (!is_array($errors) || !empty($errors)) - printf("[006] Expecting non-empty array got %s/%s\n", gettype($errors), var_export($errors, true)); - - if (!is_array($reject) || !empty($reject)) - printf("[007] Expecting empty array got %s/%s\n", gettype($reject), var_export($reject, true)); - - // Lets pass a dead connection - $links = array($link); - $errors = array($link); - $reject = array($link); - if (0 !== ($tmp = mysqli_poll($links, $errors, $reject, 1))) - printf("[008] There should be no connection ready! Returned %s/%s, expecting int/0.\n", - gettype($tmp), var_export($tmp, true)); - - if (!empty($errors)) - printf("[009] There should be no errors but one rejected connection\n"); - - foreach ($reject as $mysqli) - if (mysqli_thread_id($mysqli) != $thread_id) { - printf("[010] Rejected thread %d should have rejected thread %d\n", - mysqli_thread_id($mysqli), $thread_id); - } - - // Killing connection - 2 - - $link = get_connection(); - if (true !== ($tmp = mysqli_query($link, "SELECT 1", MYSQLI_ASYNC | MYSQLI_USE_RESULT))) - printf("[011] Expecting boolean/true got %s/%s\n", gettype($tmp), var_export($tmp, true)); - - usleep(100000); - $thread_id = mysqli_thread_id($link); - mysqli_kill(get_connection(), $thread_id); - - // Yes, 1 - fetch OK packet of kill! - $processed = 0; - $begin = microtime(true); - do { - $links = array($link, $link); - $errors = array($link, $link); - $reject = array($link, $link); - $ready = mysqli_poll($links, $errors, $reject, 1); - - if (!empty($errors)) { - foreach ($errors as $mysqli) { - printf("[012] Error on thread %d: %s/%s\n", - mysqli_thread_id($mysqli), - mysqli_errno($mysqli), - mysqli_error($mysqli)); - } - break; - } - - if (FALSE === $ready) { - printf("[013] MySQLi indicates some error\n"); - break; - } - - if (!empty($reject)) { - foreach ($reject as $mysqli) { - printf("[014] Rejecting thread %d: %s/%s\n", - mysqli_thread_id($mysqli), - mysqli_errno($mysqli), - mysqli_error($mysqli)); - } - $processed += count($reject); - } - - foreach ($links as $mysqli) { - if (is_object($res = mysqli_reap_async_query($mysqli))) { - printf("Fetching from thread %d...\n", mysqli_thread_id($mysqli)); - var_dump(mysqli_fetch_assoc($res)); - } else if (mysqli_errno($mysqli) > 0) { - printf("[015] %d/%s\n", mysqli_errno($mysqli), mysqli_error($mysqli)); - } - $processed++; - } - - if ((microtime(true) - $begin) > 5) { - printf("[016] Pulling the emergency break after 5s, something is wrong...\n"); - break; - } - - } while ($processed < 2); - - - // Killing connection - 3 - - $link = get_connection(); - $thread_id = mysqli_thread_id($link); - mysqli_kill(get_connection(), $thread_id); - // Sleep 0.1s to ensure the KILL gets recognized - usleep(100000); - if (false !== ($tmp = mysqli_query($link, "SELECT 1 AS 'processed before killed'", MYSQLI_ASYNC | MYSQLI_USE_RESULT))) - printf("[017] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true)); - - $links = array($link); - $errors = array($link); - $reject = array($link); - - if (0 !== ($tmp = (mysqli_poll($links, $errors, $reject, 0, 10000)))) - printf("[018] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true)); - - if (!is_array($links) || empty($links)) - printf("[019] Expecting non-empty array got %s/%s\n", gettype($links), var_export($links, true)); - else - foreach ($links as $link) { - if (is_object($res = mysqli_reap_async_query($link))) { - // No, you cannot fetch the result - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - } else if ($link->errno > 0) { - // But you are supposed to handle the error the way its shown here! - printf("[020] Error: %d/%s\n", $link->errno, $link->error); - } - } - - // None of these will indicate an error, check errno on the list of returned connections! - if (!is_array($errors) || !empty($errors)) - printf("[021] Expecting non-empty array got %s/%s\n", gettype($errors), var_export($errors, true)); - - if (!is_array($reject) || !empty($reject)) - printf("[021] Expecting empty array got %s/%s\n", gettype($reject), var_export($reject, true)); - - - mysqli_close($link); - print "done!"; + require_once('connect.inc'); + + function get_connection() { + global $host, $user, $passwd, $db, $port, $socket; + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + return $link; + } + + // Killing connection - 1 + + $link = get_connection(); + if (true !== ($tmp = mysqli_query($link, "SELECT 1 AS 'processed before killed'", MYSQLI_ASYNC | MYSQLI_USE_RESULT))) + printf("[002] Expecting boolean/true got %s/%s\n", gettype($tmp), var_export($tmp, true)); + + // Sleep 0.1s - the asynchronous query should have been processed after the wait period + usleep(100000); + $thread_id = mysqli_thread_id($link); + mysqli_kill(get_connection(), $thread_id); + + $links = array($link); + $errors = array($link); + $reject = array($link); + + // Yes, 1 - the asynchronous query should have been processed + if (1 !== ($tmp = (mysqli_poll($links, $errors, $reject, 0, 10000)))) + printf("[003] Expecting int/1 got %s/%s\n", gettype($tmp), var_export($tmp, true)); + + if (!is_array($links) || empty($links)) + printf("[004] Expecting non-empty array got %s/%s\n", gettype($links), var_export($links, true)); + else + foreach ($links as $link) { + if (is_object($res = mysqli_reap_async_query($link))) { + // Yes, you can fetch a result - the query has been processed + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + } else if ($link->errno > 0) { + printf("[005] Error: %d\n", $link->errno); + } + } + + // No error! + if (!is_array($errors) || !empty($errors)) + printf("[006] Expecting non-empty array got %s/%s\n", gettype($errors), var_export($errors, true)); + + if (!is_array($reject) || !empty($reject)) + printf("[007] Expecting empty array got %s/%s\n", gettype($reject), var_export($reject, true)); + + // Lets pass a dead connection + $links = array($link); + $errors = array($link); + $reject = array($link); + if (0 !== ($tmp = mysqli_poll($links, $errors, $reject, 1))) + printf("[008] There should be no connection ready! Returned %s/%s, expecting int/0.\n", + gettype($tmp), var_export($tmp, true)); + + if (!empty($errors)) + printf("[009] There should be no errors but one rejected connection\n"); + + foreach ($reject as $mysqli) + if (mysqli_thread_id($mysqli) != $thread_id) { + printf("[010] Rejected thread %d should have rejected thread %d\n", + mysqli_thread_id($mysqli), $thread_id); + } + + // Killing connection - 2 + + $link = get_connection(); + if (true !== ($tmp = mysqli_query($link, "SELECT 1", MYSQLI_ASYNC | MYSQLI_USE_RESULT))) + printf("[011] Expecting boolean/true got %s/%s\n", gettype($tmp), var_export($tmp, true)); + + usleep(100000); + $thread_id = mysqli_thread_id($link); + mysqli_kill(get_connection(), $thread_id); + + // Yes, 1 - fetch OK packet of kill! + $processed = 0; + $begin = microtime(true); + do { + $links = array($link, $link); + $errors = array($link, $link); + $reject = array($link, $link); + $ready = mysqli_poll($links, $errors, $reject, 1); + + if (!empty($errors)) { + foreach ($errors as $mysqli) { + printf("[012] Error on thread %d: %s/%s\n", + mysqli_thread_id($mysqli), + mysqli_errno($mysqli), + mysqli_error($mysqli)); + } + break; + } + + if (FALSE === $ready) { + printf("[013] MySQLi indicates some error\n"); + break; + } + + if (!empty($reject)) { + foreach ($reject as $mysqli) { + printf("[014] Rejecting thread %d: %s/%s\n", + mysqli_thread_id($mysqli), + mysqli_errno($mysqli), + mysqli_error($mysqli)); + } + $processed += count($reject); + } + + foreach ($links as $mysqli) { + if (is_object($res = mysqli_reap_async_query($mysqli))) { + printf("Fetching from thread %d...\n", mysqli_thread_id($mysqli)); + var_dump(mysqli_fetch_assoc($res)); + } else if (mysqli_errno($mysqli) > 0) { + printf("[015] %d/%s\n", mysqli_errno($mysqli), mysqli_error($mysqli)); + } + $processed++; + } + + if ((microtime(true) - $begin) > 5) { + printf("[016] Pulling the emergency break after 5s, something is wrong...\n"); + break; + } + + } while ($processed < 2); + + + // Killing connection - 3 + + $link = get_connection(); + $thread_id = mysqli_thread_id($link); + mysqli_kill(get_connection(), $thread_id); + // Sleep 0.1s to ensure the KILL gets recognized + usleep(100000); + if (false !== ($tmp = mysqli_query($link, "SELECT 1 AS 'processed before killed'", MYSQLI_ASYNC | MYSQLI_USE_RESULT))) + printf("[017] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true)); + + $links = array($link); + $errors = array($link); + $reject = array($link); + + if (0 !== ($tmp = (mysqli_poll($links, $errors, $reject, 0, 10000)))) + printf("[018] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true)); + + if (!is_array($links) || empty($links)) + printf("[019] Expecting non-empty array got %s/%s\n", gettype($links), var_export($links, true)); + else + foreach ($links as $link) { + if (is_object($res = mysqli_reap_async_query($link))) { + // No, you cannot fetch the result + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + } else if ($link->errno > 0) { + // But you are supposed to handle the error the way its shown here! + printf("[020] Error: %d/%s\n", $link->errno, $link->error); + } + } + + // None of these will indicate an error, check errno on the list of returned connections! + if (!is_array($errors) || !empty($errors)) + printf("[021] Expecting non-empty array got %s/%s\n", gettype($errors), var_export($errors, true)); + + if (!is_array($reject) || !empty($reject)) + printf("[021] Expecting empty array got %s/%s\n", gettype($reject), var_export($reject, true)); + + + mysqli_close($link); + print "done!"; ?> --XFAIL-- To be fixed later. Minor issue about fetching error message from killed line diff --git a/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt b/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt index bfe780a9cd..13dcb12093 100644 --- a/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt +++ b/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt @@ -12,150 +12,150 @@ if (!$IS_MYSQLND) ?> --FILE-- <?php - require_once('table.inc'); - - function get_connection() { - global $host, $user, $passwd, $db, $port, $socket; - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - return $link; - } - - - // Note: some queries will fail! They are supposed to fail. - $queries = array( - 'CREATE TABLE IF NOT EXISTS bogus(id INT)', - 'SET @a = 1', - 'SELECT * FROM test ORDER BY id ASC LIMIT 2', - "INSERT INTO test(id, label) VALUES (100, 'z')", - 'SELECT * FROM test ORDER BY id ASC LIMIT 2', - 'SELECT', - 'UPDATE test SET id = 101 WHERE id > 3', - 'UPDATE_FIX test SET id = 101 WHERE id > 3', - 'DROP TABLE IF EXISTS bogus', - 'DELETE FROM test WHERE id = @a', - 'DELETE FROM test WHERE id = 1', - ); - - $link = get_connection(); - $have_proc = false; - mysqli_real_query($link, "DROP PROCEDURE IF EXISTS p"); - if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) { - $have_proc = true; - $queries[] = "CALL p('myversion', @version)"; - } - mysqli_close($link); - - $links = array(); - for ($i = 0; $i < count($queries); $i++) { - - $link = get_connection(); - - if (true !== ($tmp = mysqli_query($link, $queries[$i], MYSQLI_ASYNC | MYSQLI_USE_RESULT))) - printf("[002] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true)); - - // WARNING KLUDGE NOTE - // Add a tiny delay to ensure that queries get executed in a certain order - // If your MySQL server is very slow the test may randomly fail! - usleep(20000); - - $links[mysqli_thread_id($link)] = array( - 'query' => $queries[$i], - 'link' => $link, - 'processed' => false, - ); - } - - $saved_errors = array(); - do { - $poll_links = $poll_errors = $poll_reject = array(); - foreach ($links as $thread_id => $link) { - if (!$link['processed']) { - $poll_links[] = $link['link']; - $poll_errors[] = $link['link']; - $poll_reject[] = $link['link']; - } - } - if (0 == count($poll_links)) - break; - - if (0 === ($num_ready = mysqli_poll($poll_links, $poll_errors, $poll_reject, 0, 200000))) - continue; - - if (!empty($poll_errors)) { - die(var_dump($poll_errors)); - } - - if (FALSE === $num_ready) { - die("Some mysqli indicated error"); - } - - foreach ($poll_links as $link) { - $thread_id = mysqli_thread_id($link); - $links[$thread_id]['processed'] = true; - - if (is_object($res = mysqli_reap_async_query($link))) { - // result set object - while ($row = mysqli_fetch_assoc($res)) { - // eat up all results - ; - } - mysqli_free_result($res); - } else { - // either there is no result (no SELECT) or there is an error - if (mysqli_errno($link) > 0) { - $saved_errors[$thread_id] = mysqli_errno($link); - printf("[003] '%s' caused %d\n", $links[$thread_id]['query'], mysqli_errno($link)); - } - } - } - - } while (true); - - // Checking if all lines are still usable - foreach ($links as $thread_id => $link) { - if (isset($saved_errors[$thread_id]) && - $saved_errors[$thread_id] != mysqli_errno($link['link'])) { - printf("[004] Error state not saved for query '%s', %d != %d\n", $link['query'], - $saved_errors[$thread_id], mysqli_errno($link['link'])); - } - - if (!$res = mysqli_query($link['link'], 'SELECT * FROM test WHERE id = 100')) - printf("[005] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true)); - if (!$row = mysqli_fetch_row($res)) - printf("[006] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true)); - - mysqli_free_result($res); - } - - if ($res = mysqli_query($link['link'], "SELECT * FROM test WHERE id = 100")) { - $row = mysqli_fetch_assoc($res); - var_dump($row); - mysqli_free_result($res); - } - - if ($have_proc && ($res = mysqli_query($link['link'], "SELECT @version as _version"))) { - $row = mysqli_fetch_assoc($res); - if ($row['_version'] != 'myversion') { - printf("[007] Check procedures\n"); - } - mysqli_free_result($res); - } - - foreach ($links as $link) - mysqli_close($link['link']); - - $link = get_connection(); - if (!mysqli_query($link, 'SELECT 1', MYSQLI_ASYNC)) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, 'SELECT 1', MYSQLI_ASYNC)) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - mysqli_close($link); - - print "done!"; + require_once('table.inc'); + + function get_connection() { + global $host, $user, $passwd, $db, $port, $socket; + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + return $link; + } + + + // Note: some queries will fail! They are supposed to fail. + $queries = array( + 'CREATE TABLE IF NOT EXISTS bogus(id INT)', + 'SET @a = 1', + 'SELECT * FROM test ORDER BY id ASC LIMIT 2', + "INSERT INTO test(id, label) VALUES (100, 'z')", + 'SELECT * FROM test ORDER BY id ASC LIMIT 2', + 'SELECT', + 'UPDATE test SET id = 101 WHERE id > 3', + 'UPDATE_FIX test SET id = 101 WHERE id > 3', + 'DROP TABLE IF EXISTS bogus', + 'DELETE FROM test WHERE id = @a', + 'DELETE FROM test WHERE id = 1', + ); + + $link = get_connection(); + $have_proc = false; + mysqli_real_query($link, "DROP PROCEDURE IF EXISTS p"); + if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) { + $have_proc = true; + $queries[] = "CALL p('myversion', @version)"; + } + mysqli_close($link); + + $links = array(); + for ($i = 0; $i < count($queries); $i++) { + + $link = get_connection(); + + if (true !== ($tmp = mysqli_query($link, $queries[$i], MYSQLI_ASYNC | MYSQLI_USE_RESULT))) + printf("[002] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true)); + + // WARNING KLUDGE NOTE + // Add a tiny delay to ensure that queries get executed in a certain order + // If your MySQL server is very slow the test may randomly fail! + usleep(20000); + + $links[mysqli_thread_id($link)] = array( + 'query' => $queries[$i], + 'link' => $link, + 'processed' => false, + ); + } + + $saved_errors = array(); + do { + $poll_links = $poll_errors = $poll_reject = array(); + foreach ($links as $thread_id => $link) { + if (!$link['processed']) { + $poll_links[] = $link['link']; + $poll_errors[] = $link['link']; + $poll_reject[] = $link['link']; + } + } + if (0 == count($poll_links)) + break; + + if (0 === ($num_ready = mysqli_poll($poll_links, $poll_errors, $poll_reject, 0, 200000))) + continue; + + if (!empty($poll_errors)) { + die(var_dump($poll_errors)); + } + + if (FALSE === $num_ready) { + die("Some mysqli indicated error"); + } + + foreach ($poll_links as $link) { + $thread_id = mysqli_thread_id($link); + $links[$thread_id]['processed'] = true; + + if (is_object($res = mysqli_reap_async_query($link))) { + // result set object + while ($row = mysqli_fetch_assoc($res)) { + // eat up all results + ; + } + mysqli_free_result($res); + } else { + // either there is no result (no SELECT) or there is an error + if (mysqli_errno($link) > 0) { + $saved_errors[$thread_id] = mysqli_errno($link); + printf("[003] '%s' caused %d\n", $links[$thread_id]['query'], mysqli_errno($link)); + } + } + } + + } while (true); + + // Checking if all lines are still usable + foreach ($links as $thread_id => $link) { + if (isset($saved_errors[$thread_id]) && + $saved_errors[$thread_id] != mysqli_errno($link['link'])) { + printf("[004] Error state not saved for query '%s', %d != %d\n", $link['query'], + $saved_errors[$thread_id], mysqli_errno($link['link'])); + } + + if (!$res = mysqli_query($link['link'], 'SELECT * FROM test WHERE id = 100')) + printf("[005] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true)); + if (!$row = mysqli_fetch_row($res)) + printf("[006] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true)); + + mysqli_free_result($res); + } + + if ($res = mysqli_query($link['link'], "SELECT * FROM test WHERE id = 100")) { + $row = mysqli_fetch_assoc($res); + var_dump($row); + mysqli_free_result($res); + } + + if ($have_proc && ($res = mysqli_query($link['link'], "SELECT @version as _version"))) { + $row = mysqli_fetch_assoc($res); + if ($row['_version'] != 'myversion') { + printf("[007] Check procedures\n"); + } + mysqli_free_result($res); + } + + foreach ($links as $link) + mysqli_close($link['link']); + + $link = get_connection(); + if (!mysqli_query($link, 'SELECT 1', MYSQLI_ASYNC)) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, 'SELECT 1', MYSQLI_ASYNC)) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + mysqli_close($link); + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_poll_reference.phpt b/ext/mysqli/tests/mysqli_poll_reference.phpt index ab2ed2aee8..6aaa180dbe 100644 --- a/ext/mysqli/tests/mysqli_poll_reference.phpt +++ b/ext/mysqli/tests/mysqli_poll_reference.phpt @@ -19,189 +19,189 @@ if (mysqli_get_server_version($link) < 50012) ?> --FILE-- <?php - require_once('connect.inc'); - - function get_connection() { - global $host, $user, $passwd, $db, $port, $socket; - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - return $link; - } - - - $mysqli1 = get_connection(); - $mysqli2 = get_connection(); - - var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); - var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); - - $processed = $loops = 0; - do { - $loops++; - if ($loops > 10) { - printf("[002] The queries should have finished already\n"); - break; - } - // WARNING: All arrays point to the same object - this will give bogus results! - // The behaviour is in line with stream_select(). Be warned, be careful. - $links = $errors = $reject = array($mysqli1, $mysqli2); - if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { - continue; - } - - foreach ($links as $link) { - if ($res = mysqli_reap_async_query($link)) { - mysqli_free_result($res); - } - $processed++; - } - } while ($processed < 2); - - mysqli_close($mysqli1); - mysqli_close($mysqli2); - - $mysqli1 = get_connection(); - $mysqli2 = get_connection(); - - var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); - var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); - - $processed = $loops = 0; - do { - $loops++; - if ($loops > 10) { - printf("[003] The queries should have finished already\n"); - break; - } - // WARNING: All arrays point to the same object - this will give bogus results! - $links = $errors = array($mysqli1, $mysqli2); - $reject = array($mysqli1, $mysqli2); - if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { - continue; - } - foreach ($links as $link) { - if ($res = mysqli_reap_async_query($link)) { - mysqli_free_result($res); - } - $processed++; - } - } while ($processed < 2); - - mysqli_close($mysqli1); - mysqli_close($mysqli2); - - $mysqli1 = get_connection(); - $mysqli2 = get_connection(); - - var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); - var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); - - $processed = $loops = 0; - do { - $loops++; - if ($loops > 10) { - printf("[004] The queries should have finished already\n"); - break; - } - // WARNING: All arrays point to the same object - this will give bogus results! - $links = array($mysqli1, $mysqli2); - $errors = $reject = array($mysqli1, $mysqli2); - if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { - continue; - } - foreach ($links as $link) { - if ($res = mysqli_reap_async_query($link)) { - mysqli_free_result($res); - } - $processed++; - } - } while ($processed < 2); - - mysqli_close($mysqli1); - mysqli_close($mysqli2); - - // This is bogus code and bogus usage - OK to throw no errors! - $mysqli1 = get_connection(); - $mysqli2 = get_connection(); - - var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); - $thread_id = mysqli_thread_id($mysqli2); - printf("Connection %d should be rejected...\n", $thread_id); - - $processed = $loops = 0; - do { - $loops++; - if ($loops > 10) { - printf("[005] The queries should have finished already\n"); - break; - } - $links = $errors = $reject = array($mysqli1, $mysqli2); - if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { - continue; - } - // WARNING: Due to the reference issue none of these should ever fire! - foreach ($reject as $link) { - printf("Connection %d was rejected...\n", mysqli_thread_id($link)); + require_once('connect.inc'); + + function get_connection() { + global $host, $user, $passwd, $db, $port, $socket; + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + return $link; + } + + + $mysqli1 = get_connection(); + $mysqli2 = get_connection(); + + var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); + var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); + + $processed = $loops = 0; + do { + $loops++; + if ($loops > 10) { + printf("[002] The queries should have finished already\n"); + break; + } + // WARNING: All arrays point to the same object - this will give bogus results! + // The behaviour is in line with stream_select(). Be warned, be careful. + $links = $errors = $reject = array($mysqli1, $mysqli2); + if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { + continue; + } + + foreach ($links as $link) { + if ($res = mysqli_reap_async_query($link)) { + mysqli_free_result($res); + } + $processed++; + } + } while ($processed < 2); + + mysqli_close($mysqli1); + mysqli_close($mysqli2); + + $mysqli1 = get_connection(); + $mysqli2 = get_connection(); + + var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); + var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); + + $processed = $loops = 0; + do { + $loops++; + if ($loops > 10) { + printf("[003] The queries should have finished already\n"); + break; + } + // WARNING: All arrays point to the same object - this will give bogus results! + $links = $errors = array($mysqli1, $mysqli2); + $reject = array($mysqli1, $mysqli2); + if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { + continue; + } + foreach ($links as $link) { + if ($res = mysqli_reap_async_query($link)) { + mysqli_free_result($res); + } + $processed++; + } + } while ($processed < 2); + + mysqli_close($mysqli1); + mysqli_close($mysqli2); + + $mysqli1 = get_connection(); + $mysqli2 = get_connection(); + + var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); + var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); + + $processed = $loops = 0; + do { + $loops++; + if ($loops > 10) { + printf("[004] The queries should have finished already\n"); + break; + } + // WARNING: All arrays point to the same object - this will give bogus results! + $links = array($mysqli1, $mysqli2); + $errors = $reject = array($mysqli1, $mysqli2); + if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { + continue; + } + foreach ($links as $link) { + if ($res = mysqli_reap_async_query($link)) { + mysqli_free_result($res); + } + $processed++; + } + } while ($processed < 2); + + mysqli_close($mysqli1); + mysqli_close($mysqli2); + + // This is bogus code and bogus usage - OK to throw no errors! + $mysqli1 = get_connection(); + $mysqli2 = get_connection(); + + var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); + $thread_id = mysqli_thread_id($mysqli2); + printf("Connection %d should be rejected...\n", $thread_id); + + $processed = $loops = 0; + do { + $loops++; + if ($loops > 10) { + printf("[005] The queries should have finished already\n"); + break; + } + $links = $errors = $reject = array($mysqli1, $mysqli2); + if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { + continue; + } + // WARNING: Due to the reference issue none of these should ever fire! + foreach ($reject as $link) { + printf("Connection %d was rejected...\n", mysqli_thread_id($link)); if (mysqli_thread_id($link) != $thread_id) { printf("[006] Connector %d should have been rejected. But also %d has been rejected.", $thread_id, mysqli_thread_id($link)); } - $processed++; - } - foreach ($errors as $link) { - printf("Connection %d has an error...\n", mysqli_thread_id($link)); - $processed++; - } - foreach ($links as $link) { - if ($res = mysqli_reap_async_query($link)) { - mysqli_free_result($res); - $processed++; - } - } - } while ($processed < 2); - - mysqli_close($mysqli1); - mysqli_close($mysqli2); - - $mysqli1 = get_connection(); - $mysqli2 = get_connection(); - - var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); - var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); - - $processed = $loops = 0; - $all = array($mysqli1, $mysqli2); - do { - $loops++; - if ($loops > 10) { - printf("[006] The queries should have finished already\n"); - break; - } - $links = $errors = $reject = $all; - ob_start(); - if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { - $tmp = ob_get_contents(); - ob_end_clean(); - if ($tmp != '') { - printf("Expected error:\n%s\n", $tmp); - break; - } - continue; - } - foreach ($links as $link) { - if ($res = mysqli_reap_async_query($link)) { - mysqli_free_result($res); - } - $processed++; - } - } while ($processed < 2); - - $ready = mysqli_poll($links, $errors, $reject, 0, 50000); - mysqli_close($mysqli1); - mysqli_close($mysqli2); - - print "done!"; + $processed++; + } + foreach ($errors as $link) { + printf("Connection %d has an error...\n", mysqli_thread_id($link)); + $processed++; + } + foreach ($links as $link) { + if ($res = mysqli_reap_async_query($link)) { + mysqli_free_result($res); + $processed++; + } + } + } while ($processed < 2); + + mysqli_close($mysqli1); + mysqli_close($mysqli2); + + $mysqli1 = get_connection(); + $mysqli2 = get_connection(); + + var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); + var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); + + $processed = $loops = 0; + $all = array($mysqli1, $mysqli2); + do { + $loops++; + if ($loops > 10) { + printf("[006] The queries should have finished already\n"); + break; + } + $links = $errors = $reject = $all; + ob_start(); + if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { + $tmp = ob_get_contents(); + ob_end_clean(); + if ($tmp != '') { + printf("Expected error:\n%s\n", $tmp); + break; + } + continue; + } + foreach ($links as $link) { + if ($res = mysqli_reap_async_query($link)) { + mysqli_free_result($res); + } + $processed++; + } + } while ($processed < 2); + + $ready = mysqli_poll($links, $errors, $reject, 0, 50000); + mysqli_close($mysqli1); + mysqli_close($mysqli2); + + print "done!"; ?> --EXPECTF-- bool(true) diff --git a/ext/mysqli/tests/mysqli_prepare.phpt b/ext/mysqli/tests/mysqli_prepare.phpt index c6400e0b17..7c2ab21d6b 100644 --- a/ext/mysqli/tests/mysqli_prepare.phpt +++ b/ext/mysqli/tests/mysqli_prepare.phpt @@ -8,97 +8,97 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (false !== ($tmp = @mysqli_prepare($link, false))) - printf("[003] Expecting boolean/false, got %s\n", gettype($tmp)); + if (false !== ($tmp = @mysqli_prepare($link, false))) + printf("[003] Expecting boolean/false, got %s\n", gettype($tmp)); - if (!$res = mysqli_query($link, "SELECT id, label FROM test", MYSQLI_USE_RESULT)) - printf("[004] [%d] %s, next test will fail\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT id, label FROM test", MYSQLI_USE_RESULT)) + printf("[004] [%d] %s, next test will fail\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_prepare($link, 'SELECT id FROM test WHERE id > ?'))) - printf("[005] Expecting boolean/false, got %s, [%d] %s\n", gettype($tmp), mysqli_errno($link), mysqli_error($link)); + if (false !== ($tmp = mysqli_prepare($link, 'SELECT id FROM test WHERE id > ?'))) + printf("[005] Expecting boolean/false, got %s, [%d] %s\n", gettype($tmp), mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id FROM test'))) || !mysqli_stmt_execute($stmt)) - printf("[006][%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_close($stmt); + if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id FROM test'))) || !mysqli_stmt_execute($stmt)) + printf("[006][%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_stmt_close($stmt); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test2")) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test2")) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_object(($stmt = mysqli_prepare($link, 'CREATE TABLE test2(id INT) ENGINE =' . $engine))) || !mysqli_stmt_execute($stmt)) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_close($stmt); + if (!is_object(($stmt = mysqli_prepare($link, 'CREATE TABLE test2(id INT) ENGINE =' . $engine))) || !mysqli_stmt_execute($stmt)) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_stmt_close($stmt); - if (!is_object(($stmt = mysqli_prepare($link, 'INSERT INTO test2(id) VALUES(?)')))) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!is_object(($stmt = mysqli_prepare($link, 'INSERT INTO test2(id) VALUES(?)')))) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $id = 1; - if (!mysqli_stmt_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt)) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_close($stmt); + $id = 1; + if (!mysqli_stmt_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt)) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_stmt_close($stmt); - if (!is_object(($stmt = mysqli_prepare($link, 'REPLACE INTO test2(id) VALUES (?)')))) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!is_object(($stmt = mysqli_prepare($link, 'REPLACE INTO test2(id) VALUES (?)')))) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $id = 2; - if (!mysqli_stmt_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt)) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_close($stmt); + $id = 2; + if (!mysqli_stmt_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt)) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_stmt_close($stmt); - if (!is_object(($stmt = mysqli_prepare($link, 'UPDATE test2 SET id = ? WHERE id = ?')))) - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!is_object(($stmt = mysqli_prepare($link, 'UPDATE test2 SET id = ? WHERE id = ?')))) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $id = 3; - $where = 2; - if (!mysqli_stmt_bind_param($stmt, 'ii', $id, $where) || !mysqli_stmt_execute($stmt)) - printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_close($stmt); + $id = 3; + $where = 2; + if (!mysqli_stmt_bind_param($stmt, 'ii', $id, $where) || !mysqli_stmt_execute($stmt)) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_stmt_close($stmt); - if (!is_object(($stmt = mysqli_prepare($link, 'DELETE FROM test2 WHERE id = ?')))) - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!is_object(($stmt = mysqli_prepare($link, 'DELETE FROM test2 WHERE id = ?')))) + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $where = 3; - if (!mysqli_stmt_bind_param($stmt, 'i', $where) || !mysqli_stmt_execute($stmt)) - printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_close($stmt); + $where = 3; + if (!mysqli_stmt_bind_param($stmt, 'i', $where) || !mysqli_stmt_execute($stmt)) + printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_stmt_close($stmt); - if (!is_object(($stmt = mysqli_prepare($link, 'SET @testvar = ?')))) - printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!is_object(($stmt = mysqli_prepare($link, 'SET @testvar = ?')))) + printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $testvar = 'testvar'; - if (!mysqli_stmt_bind_param($stmt, 's', $testvar) || !mysqli_stmt_execute($stmt)) - printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_close($stmt); + $testvar = 'testvar'; + if (!mysqli_stmt_bind_param($stmt, 's', $testvar) || !mysqli_stmt_execute($stmt)) + printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_stmt_close($stmt); - if (!is_object(($stmt = mysqli_prepare($link, "DO GET_LOCK('testlock', 1)")))) - printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_close($stmt); + if (!is_object(($stmt = mysqli_prepare($link, "DO GET_LOCK('testlock', 1)")))) + printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_stmt_close($stmt); - if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id, @testvar FROM test2')))) - printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id, @testvar FROM test2')))) + printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $id = $testvar = null; - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_bind_result($stmt, $id, $testvar)) - printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - while (mysqli_stmt_fetch($stmt)) { - if (('testvar' !== $testvar) || (1 !== $id)) - printf("[022] Expecting 'testvar'/1, got %s/%s. [%d] %s\n", - $testvar, $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } + $id = $testvar = null; + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_bind_result($stmt, $id, $testvar)) + printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + while (mysqli_stmt_fetch($stmt)) { + if (('testvar' !== $testvar) || (1 !== $id)) + printf("[022] Expecting 'testvar'/1, got %s/%s. [%d] %s\n", + $testvar, $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } - var_dump(mysqli_stmt_prepare($stmt, 'SELECT 1; SELECT 2')); + var_dump(mysqli_stmt_prepare($stmt, 'SELECT 1; SELECT 2')); - mysqli_stmt_close($stmt); - mysqli_close($link); + mysqli_stmt_close($stmt); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_prepare_no_object.phpt b/ext/mysqli/tests/mysqli_prepare_no_object.phpt index 0a1d22d756..2b6a07d2ac 100644 --- a/ext/mysqli/tests/mysqli_prepare_no_object.phpt +++ b/ext/mysqli/tests/mysqli_prepare_no_object.phpt @@ -8,31 +8,31 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('table.inc'); + require('table.inc'); - if (false !== ($tmp = mysqli_prepare($link, false))) - printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); - printf("a) [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (false !== ($tmp = mysqli_prepare($link, false))) + printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); + printf("a) [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_prepare($link, ''))) - printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); - printf("b) [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (false !== ($tmp = mysqli_prepare($link, ''))) + printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); + printf("b) [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_close($link); + mysqli_close($link); - if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) - printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); + if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (false !== ($tmp = $mysqli->prepare(false))) - printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); - printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error); + if (false !== ($tmp = $mysqli->prepare(false))) + printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); + printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error); - if (false !== ($tmp = $mysqli->prepare(''))) - printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); - printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error); + if (false !== ($tmp = $mysqli->prepare(''))) + printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); + printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_ps_select_union.phpt b/ext/mysqli/tests/mysqli_ps_select_union.phpt index cb5699fc1e..8467690776 100644 --- a/ext/mysqli/tests/mysqli_ps_select_union.phpt +++ b/ext/mysqli/tests/mysqli_ps_select_union.phpt @@ -8,248 +8,248 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - require_once("table.inc"); - - // Regular (non-prepared) queries - print "Using CAST('somestring' AS CHAR)...\n"; - if (!($res = $link->query("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)"))) - printf("[001] [%d] %s\n", $link->errno, $link->error); - - $data = array(); - while ($row = $res->fetch_assoc()) { - $data[] = $row['column1']; - var_dump($row['column1']); - } - $res->free(); - - // Prepared Statements - if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)"))) - printf("[002] [%d] %s\n", $link->errno, $link->error); - - $column1 = null; - if (!$stmt->execute() || !$stmt->bind_result($column1)) - printf("[003] [%d] %s\n", $stmt->errno, $stmt->error); - - $index = 0; - while ($stmt->fetch()) { - if ($data[$index] != $column1) { - printf("[004] Row %d, expecting %s/%s got %s/%s\n", - $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); - } - $index++; - } - $stmt->close(); - - if ($IS_MYSQLND) { - /* - Advantage mysqlnd - - The metadata mysqlnd has available after prepare is better than - the one made available by the MySQL Client Library (libmysql). - "libmysql" will give wrong results and that is OK - - http://bugs.mysql.com/bug.php?id=47483 - */ - if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)"))) - printf("[005] [%d] %s\n", $link->errno, $link->error); - - $column1 = null; - /* Note: bind_result before execute */ - if (!$stmt->bind_result($column1) || !$stmt->execute()) - printf("[006] [%d] %s\n", $stmt->errno, $stmt->error); - - $index = 0; - while ($stmt->fetch()) { - if ($data[$index] != $column1) { - printf("[007] Row %d, expecting %s/%s got %s/%s\n", - $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); - } - $index++; - } - $stmt->close(); - } - - // Regular (non-prepared) queries - print "Mixing CAST('somestring'AS CHAR), integer and CAST(integer AS CHAR)...\n"; - if (!($res = $link->query("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)"))) - printf("[008] [%d] %s\n", $link->errno, $link->error); - - $data = array(); - while ($row = $res->fetch_assoc()) { - $data[] = $row['column1']; - } - $res->free(); - - // Prepared Statements - if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)"))) - printf("[009] [%d] %s\n", $link->errno, $link->error); - - $column1 = null; - if (!$stmt->execute() || !$stmt->bind_result($column1)) - printf("[010] [%d] %s\n", $stmt->errno, $stmt->error); - - $index = 0; - while ($stmt->fetch()) { - if ($data[$index] != $column1) { - printf("[011] Row %d, expecting %s/%s got %s/%s\n", - $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); - } - var_dump($column1); - $index++; - } - $stmt->close(); - - if ($IS_MYSQLND) { - /* Advantage mysqlnd - see above... */ - if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)"))) - printf("[012] [%d] %s\n", $link->errno, $link->error); - - $column1 = null; - if (!$stmt->bind_result($column1) || !$stmt->execute()) - printf("[013] [%d] %s\n", $stmt->errno, $stmt->error); - - $index = 0; - while ($stmt->fetch()) { - if ($data[$index] != $column1) { - printf("[014] Row %d, expecting %s/%s got %s/%s\n", - $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); - } - $index++; - } - $stmt->close(); - } - - print "Using integer only...\n"; - if (!($res = $link->query("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2"))) - printf("[015] [%d] %s\n", $link->errno, $link->error); - - $data = array(); - while ($row = $res->fetch_assoc()) { - $data[] = $row['column1']; - } - $res->free(); - - // Prepared Statements - if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2"))) - printf("[016] [%d] %s\n", $link->errno, $link->error); - - $column1 = null; - if (!$stmt->execute() || !$stmt->bind_result($column1)) - printf("[017] [%d] %s\n", $stmt->errno, $stmt->error); - - $index = 0; - while ($stmt->fetch()) { - if ($data[$index] != $column1) { - printf("[018] Row %d, expecting %s/%s got %s/%s\n", - $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); - } - var_dump($column1); - $index++; - } - $stmt->close(); - - if ($IS_MYSQLND) { - /* Advantage mysqlnd - see above */ - if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2"))) - printf("[019] [%d] %s\n", $link->errno, $link->error); - - $column1 = null; - if (!$stmt->bind_result($column1) || !$stmt->execute()) - printf("[020] [%d] %s\n", $stmt->errno, $stmt->error); - - $index = 0; - while ($stmt->fetch()) { - if ($data[$index] != $column1) { - printf("[021] Row %d, expecting %s/%s got %s/%s\n", - $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); - } - $index++; - } - $stmt->close(); - } - - print "Testing bind_param(), strings only...\n"; - $two = 'two'; - $three = 'three'; - if (!($stmt = $link->prepare("SELECT 'one' AS column1 UNION SELECT ? UNION SELECT ?"))) - printf("[022] [%d] %s\n", $stmt->errno, $stmt->error); - - $column1 = null; - if (!$stmt->bind_param('ss', $three, $two) || !$stmt->execute() || !$stmt->bind_result($column1)) - printf("[023] [%d] %s\n", $stmt->errno, $stmt->error); - - $index = 0; - $data = array(); - while ($stmt->fetch()) { - $data[$index++] = $column1; - var_dump($column1); - } - $stmt->close(); - - if ($IS_MYSQLND) { - /* Advantage mysqlnd - see above */ - $two = 'two'; - $three = 'three'; - if (!($stmt = $link->prepare("SELECT 'one' AS column1 UNION SELECT ? UNION SELECT ?"))) - printf("[024] [%d] %s\n", $stmt->errno, $stmt->error); - - $column1 = null; - if (!$stmt->bind_param('ss', $three, $two) || !$stmt->bind_result($column1) || !$stmt->execute()) - printf("[025] [%d] %s\n", $stmt->errno, $stmt->error); - - $index = 0; - while ($stmt->fetch()) { - if ($data[$index] != $column1) { - printf("[26] Row %d, expecting %s/%s, got %s/%s\n", - $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); - } - $index++; - } - $stmt->close(); - } - - print "Testing bind_param(), strings only, with CAST AS CHAR...\n"; - $two = 'two'; - $three = 'three beers are more than enough'; - if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST(? AS CHAR) UNION SELECT CAST(? AS CHAR)"))) - printf("[027] [%d] %s\n", $stmt->errno, $stmt->error); - - $column1 = null; - if (!$stmt->bind_param('ss', $three, $two) || !$stmt->execute() || !$stmt->bind_result($column1)) - printf("[028] [%d] %s\n", $stmt->errno, $stmt->error); - - $index = 0; - $data = array(); - while ($stmt->fetch()) { - $data[$index++] = $column1; - var_dump($column1); - } - $stmt->close(); - - if ($IS_MYSQLND) { - /* Advantage mysqlnd - see above */ - $two = 'two'; - $three = 'three beers are more than enough'; - if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST(? AS CHAR) UNION SELECT CAST(? AS CHAR)"))) - printf("[029] [%d] %s\n", $stmt->errno, $stmt->error); - - $column1 = null; - if (!$stmt->bind_param('ss', $three, $two) || !$stmt->bind_result($column1) || !$stmt->execute()) - printf("[030] [%d] %s\n", $stmt->errno, $stmt->error); - - $index = 0; - while ($stmt->fetch()) { - if ($data[$index] != $column1) { - printf("[31] Row %d, expecting %s/%s, got %s/%s\n", - $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); - } - $index++; - } - $stmt->close(); - } - - $link->close(); - - print "done!"; + require_once("connect.inc"); + require_once("table.inc"); + + // Regular (non-prepared) queries + print "Using CAST('somestring' AS CHAR)...\n"; + if (!($res = $link->query("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)"))) + printf("[001] [%d] %s\n", $link->errno, $link->error); + + $data = array(); + while ($row = $res->fetch_assoc()) { + $data[] = $row['column1']; + var_dump($row['column1']); + } + $res->free(); + + // Prepared Statements + if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)"))) + printf("[002] [%d] %s\n", $link->errno, $link->error); + + $column1 = null; + if (!$stmt->execute() || !$stmt->bind_result($column1)) + printf("[003] [%d] %s\n", $stmt->errno, $stmt->error); + + $index = 0; + while ($stmt->fetch()) { + if ($data[$index] != $column1) { + printf("[004] Row %d, expecting %s/%s got %s/%s\n", + $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); + } + $index++; + } + $stmt->close(); + + if ($IS_MYSQLND) { + /* + Advantage mysqlnd - + The metadata mysqlnd has available after prepare is better than + the one made available by the MySQL Client Library (libmysql). + "libmysql" will give wrong results and that is OK - + http://bugs.mysql.com/bug.php?id=47483 + */ + if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)"))) + printf("[005] [%d] %s\n", $link->errno, $link->error); + + $column1 = null; + /* Note: bind_result before execute */ + if (!$stmt->bind_result($column1) || !$stmt->execute()) + printf("[006] [%d] %s\n", $stmt->errno, $stmt->error); + + $index = 0; + while ($stmt->fetch()) { + if ($data[$index] != $column1) { + printf("[007] Row %d, expecting %s/%s got %s/%s\n", + $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); + } + $index++; + } + $stmt->close(); + } + + // Regular (non-prepared) queries + print "Mixing CAST('somestring'AS CHAR), integer and CAST(integer AS CHAR)...\n"; + if (!($res = $link->query("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)"))) + printf("[008] [%d] %s\n", $link->errno, $link->error); + + $data = array(); + while ($row = $res->fetch_assoc()) { + $data[] = $row['column1']; + } + $res->free(); + + // Prepared Statements + if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)"))) + printf("[009] [%d] %s\n", $link->errno, $link->error); + + $column1 = null; + if (!$stmt->execute() || !$stmt->bind_result($column1)) + printf("[010] [%d] %s\n", $stmt->errno, $stmt->error); + + $index = 0; + while ($stmt->fetch()) { + if ($data[$index] != $column1) { + printf("[011] Row %d, expecting %s/%s got %s/%s\n", + $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); + } + var_dump($column1); + $index++; + } + $stmt->close(); + + if ($IS_MYSQLND) { + /* Advantage mysqlnd - see above... */ + if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)"))) + printf("[012] [%d] %s\n", $link->errno, $link->error); + + $column1 = null; + if (!$stmt->bind_result($column1) || !$stmt->execute()) + printf("[013] [%d] %s\n", $stmt->errno, $stmt->error); + + $index = 0; + while ($stmt->fetch()) { + if ($data[$index] != $column1) { + printf("[014] Row %d, expecting %s/%s got %s/%s\n", + $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); + } + $index++; + } + $stmt->close(); + } + + print "Using integer only...\n"; + if (!($res = $link->query("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2"))) + printf("[015] [%d] %s\n", $link->errno, $link->error); + + $data = array(); + while ($row = $res->fetch_assoc()) { + $data[] = $row['column1']; + } + $res->free(); + + // Prepared Statements + if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2"))) + printf("[016] [%d] %s\n", $link->errno, $link->error); + + $column1 = null; + if (!$stmt->execute() || !$stmt->bind_result($column1)) + printf("[017] [%d] %s\n", $stmt->errno, $stmt->error); + + $index = 0; + while ($stmt->fetch()) { + if ($data[$index] != $column1) { + printf("[018] Row %d, expecting %s/%s got %s/%s\n", + $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); + } + var_dump($column1); + $index++; + } + $stmt->close(); + + if ($IS_MYSQLND) { + /* Advantage mysqlnd - see above */ + if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2"))) + printf("[019] [%d] %s\n", $link->errno, $link->error); + + $column1 = null; + if (!$stmt->bind_result($column1) || !$stmt->execute()) + printf("[020] [%d] %s\n", $stmt->errno, $stmt->error); + + $index = 0; + while ($stmt->fetch()) { + if ($data[$index] != $column1) { + printf("[021] Row %d, expecting %s/%s got %s/%s\n", + $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); + } + $index++; + } + $stmt->close(); + } + + print "Testing bind_param(), strings only...\n"; + $two = 'two'; + $three = 'three'; + if (!($stmt = $link->prepare("SELECT 'one' AS column1 UNION SELECT ? UNION SELECT ?"))) + printf("[022] [%d] %s\n", $stmt->errno, $stmt->error); + + $column1 = null; + if (!$stmt->bind_param('ss', $three, $two) || !$stmt->execute() || !$stmt->bind_result($column1)) + printf("[023] [%d] %s\n", $stmt->errno, $stmt->error); + + $index = 0; + $data = array(); + while ($stmt->fetch()) { + $data[$index++] = $column1; + var_dump($column1); + } + $stmt->close(); + + if ($IS_MYSQLND) { + /* Advantage mysqlnd - see above */ + $two = 'two'; + $three = 'three'; + if (!($stmt = $link->prepare("SELECT 'one' AS column1 UNION SELECT ? UNION SELECT ?"))) + printf("[024] [%d] %s\n", $stmt->errno, $stmt->error); + + $column1 = null; + if (!$stmt->bind_param('ss', $three, $two) || !$stmt->bind_result($column1) || !$stmt->execute()) + printf("[025] [%d] %s\n", $stmt->errno, $stmt->error); + + $index = 0; + while ($stmt->fetch()) { + if ($data[$index] != $column1) { + printf("[26] Row %d, expecting %s/%s, got %s/%s\n", + $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); + } + $index++; + } + $stmt->close(); + } + + print "Testing bind_param(), strings only, with CAST AS CHAR...\n"; + $two = 'two'; + $three = 'three beers are more than enough'; + if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST(? AS CHAR) UNION SELECT CAST(? AS CHAR)"))) + printf("[027] [%d] %s\n", $stmt->errno, $stmt->error); + + $column1 = null; + if (!$stmt->bind_param('ss', $three, $two) || !$stmt->execute() || !$stmt->bind_result($column1)) + printf("[028] [%d] %s\n", $stmt->errno, $stmt->error); + + $index = 0; + $data = array(); + while ($stmt->fetch()) { + $data[$index++] = $column1; + var_dump($column1); + } + $stmt->close(); + + if ($IS_MYSQLND) { + /* Advantage mysqlnd - see above */ + $two = 'two'; + $three = 'three beers are more than enough'; + if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST(? AS CHAR) UNION SELECT CAST(? AS CHAR)"))) + printf("[029] [%d] %s\n", $stmt->errno, $stmt->error); + + $column1 = null; + if (!$stmt->bind_param('ss', $three, $two) || !$stmt->bind_result($column1) || !$stmt->execute()) + printf("[030] [%d] %s\n", $stmt->errno, $stmt->error); + + $index = 0; + while ($stmt->fetch()) { + if ($data[$index] != $column1) { + printf("[31] Row %d, expecting %s/%s, got %s/%s\n", + $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1); + } + $index++; + } + $stmt->close(); + } + + $link->close(); + + print "done!"; ?> --EXPECT-- Using CAST('somestring' AS CHAR)... diff --git a/ext/mysqli/tests/mysqli_query.phpt b/ext/mysqli/tests/mysqli_query.phpt index be2f6f75a3..ba159cf985 100644 --- a/ext/mysqli/tests/mysqli_query.phpt +++ b/ext/mysqli/tests/mysqli_query.phpt @@ -8,87 +8,87 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (false !== ($tmp = @mysqli_query($link, ''))) - printf("[002a] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = @mysqli_query($link, ''))) + printf("[002a] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_query($link, 'THIS IS NOT SQL'))) - printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_query($link, 'THIS IS NOT SQL'))) + printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_query($link, "SELECT 'this is sql but with backslash g'\g"))) - printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_query($link, "SELECT 'this is sql but with backslash g'\g"))) + printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link))) - printf("[006] mysqli_errno()/mysqli_error should return some error\n"); + if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link))) + printf("[006] mysqli_errno()/mysqli_error should return some error\n"); - if (!$res = mysqli_query($link, "SELECT 'this is sql but with semicolon' AS valid ; ")) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT 'this is sql but with semicolon' AS valid ; ")) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); - if (!$res = mysqli_query($link, "SELECT 'a' AS ''")) - printf("[007a] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT 'a' AS ''")) + printf("[007a] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($tmp = mysqli_fetch_assoc($res)); - var_dump($tmp[""]); - mysqli_free_result($res); + var_dump($tmp = mysqli_fetch_assoc($res)); + var_dump($tmp[""]); + mysqli_free_result($res); - if (false !== ($res = mysqli_query($link, 'SELECT "this is sql but with semicolon" AS valid ; SHOW VARIABLES'))) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (false !== ($res = mysqli_query($link, 'SELECT "this is sql but with semicolon" AS valid ; SHOW VARIABLES'))) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (mysqli_get_server_version($link) > 50000) { - // let's try to play with stored procedures - mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'); - if (mysqli_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) { - $res = mysqli_query($link, 'CALL p(@version)'); - $res = mysqli_query($link, 'SELECT @version AS p_version'); + if (mysqli_get_server_version($link) > 50000) { + // let's try to play with stored procedures + mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'); + if (mysqli_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) { + $res = mysqli_query($link, 'CALL p(@version)'); + $res = mysqli_query($link, 'SELECT @version AS p_version'); - $tmp = mysqli_fetch_assoc($res); - if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) { - printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($tmp); - } + $tmp = mysqli_fetch_assoc($res); + if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) { + printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($tmp); + } - mysqli_free_result($res); - } else { - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + mysqli_free_result($res); + } else { + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - mysqli_query($link, 'DROP FUNCTION IF EXISTS f'); - if (mysqli_query($link, 'CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN ver_param;')) { - $res = mysqli_query($link, 'SELECT f(VERSION()) AS f_version'); + mysqli_query($link, 'DROP FUNCTION IF EXISTS f'); + if (mysqli_query($link, 'CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN ver_param;')) { + $res = mysqli_query($link, 'SELECT f(VERSION()) AS f_version'); - $tmp = mysqli_fetch_assoc($res); - if (!is_array($tmp) || empty($tmp) || !isset($tmp['f_version']) || ('' == $tmp['f_version'])) { - printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($tmp); - } + $tmp = mysqli_fetch_assoc($res); + if (!is_array($tmp) || empty($tmp) || !isset($tmp['f_version']) || ('' == $tmp['f_version'])) { + printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($tmp); + } - mysqli_free_result($res); - } else { - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - } + mysqli_free_result($res); + } else { + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + } - if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_USE_RESULT))) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_USE_RESULT))) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); - if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_STORE_RESULT))) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_STORE_RESULT))) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); - if (false !== ($res = @mysqli_query($link, "SELECT id FROM test ORDER BY id", 1234))) - printf("[013] Invalid mode should return false got %s/%s, [%d] %s\n", - gettype($res), (is_object($res)) ? 'object' : $res, - mysqli_errno($link), mysqli_error($link)); + if (false !== ($res = @mysqli_query($link, "SELECT id FROM test ORDER BY id", 1234))) + printf("[013] Invalid mode should return false got %s/%s, [%d] %s\n", + gettype($res), (is_object($res)) ? 'object' : $res, + mysqli_errno($link), mysqli_error($link)); - mysqli_close($link); + mysqli_close($link); try { mysqli_query($link, "SELECT id FROM test"); @@ -96,7 +96,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_query_iterators.phpt b/ext/mysqli/tests/mysqli_query_iterators.phpt index e653291a1b..199cddbcc5 100644 --- a/ext/mysqli/tests/mysqli_query_iterators.phpt +++ b/ext/mysqli/tests/mysqli_query_iterators.phpt @@ -8,26 +8,26 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - require('table.inc'); + require('table.inc'); - echo "--- Testing default ---\n"; - if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id"))) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - else { - foreach ($res as $row) { - var_dump($row); - } - echo "======\n"; + echo "--- Testing default ---\n"; + if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id"))) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + else { + foreach ($res as $row) { + var_dump($row); + } + echo "======\n"; - foreach ($res as $row) { - var_dump($row); - } - mysqli_free_result($res); + foreach ($res as $row) { + var_dump($row); + } + mysqli_free_result($res); try { foreach ($res as $row) { $row; @@ -35,38 +35,38 @@ require_once('skipifconnectfailure.inc'); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - } - echo "--- Testing USE_RESULT ---\n"; - if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_USE_RESULT))) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - else { - foreach ($res as $row) { - var_dump($row); - } - echo "======\n"; - foreach ($res as $row) { - var_dump($row); - } - mysqli_free_result($res); - } + } + echo "--- Testing USE_RESULT ---\n"; + if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_USE_RESULT))) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + else { + foreach ($res as $row) { + var_dump($row); + } + echo "======\n"; + foreach ($res as $row) { + var_dump($row); + } + mysqli_free_result($res); + } - echo "--- Testing STORE_RESULT ---\n"; - if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_STORE_RESULT))) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - else { - foreach ($res as $row) { - var_dump($row); - } - echo "======\n"; - foreach ($res as $row) { - var_dump($row); - } - mysqli_free_result($res); - } + echo "--- Testing STORE_RESULT ---\n"; + if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_STORE_RESULT))) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + else { + foreach ($res as $row) { + var_dump($row); + } + echo "======\n"; + foreach ($res as $row) { + var_dump($row); + } + mysqli_free_result($res); + } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_query_stored_proc.phpt b/ext/mysqli/tests/mysqli_query_stored_proc.phpt index aad39cd94d..4a77ac91c8 100644 --- a/ext/mysqli/tests/mysqli_query_stored_proc.phpt +++ b/ext/mysqli/tests/mysqli_query_stored_proc.phpt @@ -14,141 +14,141 @@ if (mysqli_get_server_version($link) <= 50000) { ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) - printf("[001] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) + printf("[001] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - if (mysqli_query($link, 'CREATE PROCEDURE p() READS SQL DATA BEGIN SELECT id, label FROM test ORDER BY id ASC; + if (mysqli_query($link, 'CREATE PROCEDURE p() READS SQL DATA BEGIN SELECT id, label FROM test ORDER BY id ASC; END;')) { - /* stored proc which returns one result set */ - if (mysqli_multi_query($link, 'CALL p()')) { - do { - if ($res = mysqli_use_result($link)) { - // skip results, don't fetch all from server - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - } - } while (mysqli_more_results($link) && mysqli_next_result($link)); - - } else { - printf("[003] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - if (mysqli_multi_query($link, 'CALL p()')) { - do { - if ($res = mysqli_store_result($link)) { - // fetch all results from server, but skip on client side - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - } - } while (mysqli_more_results($link) && mysqli_next_result($link)); - - } else { - printf("[004] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - if (mysqli_multi_query($link, 'CALL p()')) { - do { - if ($res = mysqli_store_result($link)) { - // fetch all results from server, but skip on client side - var_dump(mysqli_fetch_assoc($res)); - while (mysqli_fetch_assoc($res)) - ; - mysqli_free_result($res); - } - } while (mysqli_more_results($link) && mysqli_next_result($link)); - - } else { - printf("[005] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - } else { - printf("[002] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - } - - if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) - printf("[006] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - - if (mysqli_query($link, 'CREATE PROCEDURE p() READS SQL DATA BEGIN SELECT id, label FROM test ORDER BY id ASC; SELECT id FROM test ORDER BY id ASC; END;')) { - /* stored proc which returns two result sets */ - - if (mysqli_multi_query($link, 'CALL p()')) { - do { - if ($res = mysqli_store_result($link)) { - // fetch all results from server, but skip on client side - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - } - } while (mysqli_more_results($link) && mysqli_next_result($link)); - - } else { - printf("[008] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - } else { - printf("[007] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - } - - if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) - printf("[009] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - - if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) { - /* no result set, just output parameter */ - if (!mysqli_query($link, 'CALL p(@version)')) - printf("[011] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, "SET @version = 'unknown'")) - printf("[012] Cannot reset user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, 'CALL p(@version)')) - printf("[013] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$res = mysqli_query($link, 'SELECT @version as _vers')) - printf("[014] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$row = mysqli_fetch_assoc($res) || - $row['_vers'] == 'unknown') - printf("[015] Results seem wrong, got %s, [%d] %s\n", - $row['_vers'], - mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - - } else { - printf("[010] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - } - - if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) - printf("[016] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - - if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) { - /* no result set, one input, one output parameter */ - if (!mysqli_query($link, "CALL p('myversion', @version)")) - printf("[018] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, "SET @version = 'unknown'")) - printf("[019] Cannot reset user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, "CALL p('myversion', @version)")) - printf("[020] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$res = mysqli_query($link, 'SELECT @version as _vers')) - printf("[021] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$row = mysqli_fetch_assoc($res) || - $row['_vers'] == 'myversion') - printf("[022] Results seem wrong, got %s, [%d] %s\n", - $row['_vers'], - mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - - } else { - printf("[017] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - } - - mysqli_close($link); - print "done!"; + /* stored proc which returns one result set */ + if (mysqli_multi_query($link, 'CALL p()')) { + do { + if ($res = mysqli_use_result($link)) { + // skip results, don't fetch all from server + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + } + } while (mysqli_more_results($link) && mysqli_next_result($link)); + + } else { + printf("[003] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + if (mysqli_multi_query($link, 'CALL p()')) { + do { + if ($res = mysqli_store_result($link)) { + // fetch all results from server, but skip on client side + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + } + } while (mysqli_more_results($link) && mysqli_next_result($link)); + + } else { + printf("[004] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + if (mysqli_multi_query($link, 'CALL p()')) { + do { + if ($res = mysqli_store_result($link)) { + // fetch all results from server, but skip on client side + var_dump(mysqli_fetch_assoc($res)); + while (mysqli_fetch_assoc($res)) + ; + mysqli_free_result($res); + } + } while (mysqli_more_results($link) && mysqli_next_result($link)); + + } else { + printf("[005] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + } else { + printf("[002] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + } + + if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) + printf("[006] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + + if (mysqli_query($link, 'CREATE PROCEDURE p() READS SQL DATA BEGIN SELECT id, label FROM test ORDER BY id ASC; SELECT id FROM test ORDER BY id ASC; END;')) { + /* stored proc which returns two result sets */ + + if (mysqli_multi_query($link, 'CALL p()')) { + do { + if ($res = mysqli_store_result($link)) { + // fetch all results from server, but skip on client side + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + } + } while (mysqli_more_results($link) && mysqli_next_result($link)); + + } else { + printf("[008] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + } else { + printf("[007] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + } + + if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) + printf("[009] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + + if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) { + /* no result set, just output parameter */ + if (!mysqli_query($link, 'CALL p(@version)')) + printf("[011] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, "SET @version = 'unknown'")) + printf("[012] Cannot reset user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, 'CALL p(@version)')) + printf("[013] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$res = mysqli_query($link, 'SELECT @version as _vers')) + printf("[014] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$row = mysqli_fetch_assoc($res) || + $row['_vers'] == 'unknown') + printf("[015] Results seem wrong, got %s, [%d] %s\n", + $row['_vers'], + mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); + + } else { + printf("[010] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + } + + if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) + printf("[016] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + + if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) { + /* no result set, one input, one output parameter */ + if (!mysqli_query($link, "CALL p('myversion', @version)")) + printf("[018] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, "SET @version = 'unknown'")) + printf("[019] Cannot reset user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, "CALL p('myversion', @version)")) + printf("[020] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$res = mysqli_query($link, 'SELECT @version as _vers')) + printf("[021] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$row = mysqli_fetch_assoc($res) || + $row['_vers'] == 'myversion') + printf("[022] Results seem wrong, got %s, [%d] %s\n", + $row['_vers'], + mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); + + } else { + printf("[017] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + } + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_query_unicode.phpt b/ext/mysqli/tests/mysqli_query_unicode.phpt index 53fba7e5a9..0cec3b398a 100644 --- a/ext/mysqli/tests/mysqli_query_unicode.phpt +++ b/ext/mysqli/tests/mysqli_query_unicode.phpt @@ -14,74 +14,74 @@ mysqli_close($link); ?> --FILE-- <?php - include_once("connect.inc"); + include_once("connect.inc"); - require_once('table.inc'); + require_once('table.inc'); - if (TRUE !== ($tmp = @mysqli_query($link, "set names utf8"))) - printf("[002.5] Expecting TRUE, got %s/%s\n", gettype($tmp), $tmp); + if (TRUE !== ($tmp = @mysqli_query($link, "set names utf8"))) + printf("[002.5] Expecting TRUE, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_query($link, 'това не е еÑкюел'))) - printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_query($link, 'това не е еÑкюел'))) + printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_query($link, "SELECT 'това е еÑкюел, но ÑÑŠÑ Ð¾Ð±Ñ€Ð°Ñ‚Ð½Ð° наклонена и g'\g"))) - printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_query($link, "SELECT 'това е еÑкюел, но ÑÑŠÑ Ð¾Ð±Ñ€Ð°Ñ‚Ð½Ð° наклонена и g'\g"))) + printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link))) - printf("[006] mysqli_errno()/mysqli_error should return some error\n"); + if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link))) + printf("[006] mysqli_errno()/mysqli_error should return some error\n"); - if (!$res = mysqli_query($link, "SELECT 'това еÑкюел, но Ñ Ñ‚Ð¾Ñ‡ÐºÐ° и запетаÑ' AS правилен ; ")) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT 'това еÑкюел, но Ñ Ñ‚Ð¾Ñ‡ÐºÐ° и запетаÑ' AS правилен ; ")) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); - if (false !== ($res = mysqli_query($link, "SELECT 'това еÑкюел, но Ñ Ñ‚Ð¾Ñ‡ÐºÐ° и запетаÑ' AS правилен ; SHOW VARIABLES"))) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (false !== ($res = mysqli_query($link, "SELECT 'това еÑкюел, но Ñ Ñ‚Ð¾Ñ‡ÐºÐ° и запетаÑ' AS правилен ; SHOW VARIABLES"))) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (mysqli_get_server_version($link) > 50000) { - // let's try to play with stored procedures - mysqli_query($link, 'DROP PROCEDURE IF EXISTS процедурка'); - if (mysqli_query($link, 'CREATE PROCEDURE процедурка(OUT верÑÐ¸Ñ VARCHAR(25)) BEGIN SELECT VERSION() INTO верÑиÑ; END;')) { - $res = mysqli_query($link, 'CALL процедурка(@version)'); - $res = mysqli_query($link, 'SELECT @version AS п_верÑиÑ'); + if (mysqli_get_server_version($link) > 50000) { + // let's try to play with stored procedures + mysqli_query($link, 'DROP PROCEDURE IF EXISTS процедурка'); + if (mysqli_query($link, 'CREATE PROCEDURE процедурка(OUT верÑÐ¸Ñ VARCHAR(25)) BEGIN SELECT VERSION() INTO верÑиÑ; END;')) { + $res = mysqli_query($link, 'CALL процедурка(@version)'); + $res = mysqli_query($link, 'SELECT @version AS п_верÑиÑ'); - $tmp = mysqli_fetch_assoc($res); - if (!is_array($tmp) || empty($tmp) || !isset($tmp['п_верÑиÑ']) || ('' == $tmp['п_верÑиÑ'])) { - printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($tmp); - } + $tmp = mysqli_fetch_assoc($res); + if (!is_array($tmp) || empty($tmp) || !isset($tmp['п_верÑиÑ']) || ('' == $tmp['п_верÑиÑ'])) { + printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($tmp); + } - mysqli_free_result($res); - } else { - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + mysqli_free_result($res); + } else { + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - mysqli_query($link, 'DROP FUNCTION IF EXISTS функцийка'); - if (mysqli_query($link, 'CREATE FUNCTION функцийка( параметър_верÑÐ¸Ñ VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN параметър_верÑиÑ;')) { - $res = mysqli_query($link, 'SELECT функцийка(VERSION()) AS Ñ„_верÑиÑ'); + mysqli_query($link, 'DROP FUNCTION IF EXISTS функцийка'); + if (mysqli_query($link, 'CREATE FUNCTION функцийка( параметър_верÑÐ¸Ñ VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN параметър_верÑиÑ;')) { + $res = mysqli_query($link, 'SELECT функцийка(VERSION()) AS Ñ„_верÑиÑ'); - $tmp = mysqli_fetch_assoc($res); - if (!is_array($tmp) || empty($tmp) || !isset($tmp['Ñ„_верÑиÑ']) || ('' == $tmp['Ñ„_верÑиÑ'])) { - printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($tmp); - } + $tmp = mysqli_fetch_assoc($res); + if (!is_array($tmp) || empty($tmp) || !isset($tmp['Ñ„_верÑиÑ']) || ('' == $tmp['Ñ„_верÑиÑ'])) { + printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($tmp); + } - mysqli_free_result($res); - } else { - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - } + mysqli_free_result($res); + } else { + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + } - mysqli_close($link); + mysqli_close($link); - try { + try { mysqli_query($link, "SELECT id FROM test"); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --EXPECTF-- array(1) { diff --git a/ext/mysqli/tests/mysqli_real_connect.phpt b/ext/mysqli/tests/mysqli_real_connect.phpt index 6844db4f1f..05aeca1f6f 100644 --- a/ext/mysqli/tests/mysqli_real_connect.phpt +++ b/ext/mysqli/tests/mysqli_real_connect.phpt @@ -10,143 +10,143 @@ require_once('skipifconnectfailure.inc'); mysqli.allow_local_infile=1 --FILE-- <?php - include("connect.inc"); - - // ( mysqli link [, string hostname [, string username [, string passwd [, string dbname [, int port [, string socket [, int flags]]]]]]] - if (!$link = mysqli_init()) - printf("[002] mysqli_init() failed\n"); - - if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) - printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[004] mysqli_init() failed\n"); - - if (false !== ($tmp = mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))) - printf("[005] Expecting boolean/false got %s/%s. Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", gettype($tmp), $tmp, $host, $user . 'unknown_really', $db, $port, $socket); - - // Run the following tests without an anoynmous MySQL user and use a password for the test user! - ini_set('mysqli.default_socket', $socket); - if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port)) { - printf("[006] Usage of mysqli.default_socket failed\n"); - } else { - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[007] mysqli_init() failed\n"); - } - - ini_set('mysqli.default_port', $port); - if (!mysqli_real_connect($link, $host, $user, $passwd, $db)) { - printf("[008] Usage of mysqli.default_port failed\n"); - } else { - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[009] mysqli_init() failed\n"); - } - - ini_set('mysqli.default_pw', $passwd); - if (!mysqli_real_connect($link, $host, $user)) { - printf("[010] Usage of mysqli.default_pw failed\n") ; - } else { - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[011] mysqli_init() failed\n"); - } - - ini_set('mysqli.default_user', $user); - if (!mysqli_real_connect($link, $host)) { - printf("[012] Usage of mysqli.default_user failed\n") ; - } else { - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[011] mysqli_init() failed\n"); - } - - ini_set('mysqli.default_host', $host); - if (!mysqli_real_connect($link)) { - printf("[014] Usage of mysqli.default_host failed\n") ; - } else { - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[015] mysqli_init() failed\n"); - } - - // CLIENT_MULTI_STATEMENTS - should be disabled silently - if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 65536)) - printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if ($res = mysqli_query($link, "SELECT 1 AS a; SELECT 2 AS b")) { - printf("[017] Should have failed. CLIENT_MULTI_STATEMENT should have been disabled.\n"); - var_dump($res->num_rows); - mysqli_next_result($link); - $res = mysqli_store_result($link); - var_dump($res->num_rows); - } - - - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[018] mysqli_init() failed\n"); - - if (ini_get('open_basedir')) { - // CLIENT_LOCAL_FILES should be blocked - but how to test it ?! - - if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 128)) - printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mysqli_real_connect_phpt'; - if (!$fp = fopen($filename, 'w')) - printf("[020] Cannot open temporary file %s\n", $filename); - - fwrite($fp, '100;z'); - fclose($fp); - - // how do we test if gets forbidden because of a missing right or the flag, this test is partly bogus ? - if (mysqli_query($link, "LOAD DATA LOCAL INFILE '$filename' INTO TABLE test FIELDS TERMINATED BY ';'")) - printf("[021] LOAD DATA INFILE should have been forbidden!\n"); - - unlink($filename); - } - - mysqli_close($link); - var_dump($link); - - if ($IS_MYSQLND) { - ini_set('mysqli.default_host', 'p:' . $host); - $link = mysqli_init(); - if (!@mysqli_real_connect($link)) { - printf("[022] Usage of mysqli.default_host=p:%s (persistent) failed\n", $host) ; - } else { - if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'")) - printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - if ($tmp['testing'] !== 'mysqli.default_host (persistent)') { - printf("[024] Result looks strange - check manually, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - var_dump($tmp); - } - mysqli_free_result($res); - mysqli_close($link); - } - - ini_set('mysqli.default_host', 'p:'); - $link = mysqli_init(); - if (@mysqli_real_connect($link)) { - printf("[025] Usage of mysqli.default_host=p: did not fail\n") ; - mysqli_close($link); - } - @mysqli_close($link); - } - - try { + include("connect.inc"); + + // ( mysqli link [, string hostname [, string username [, string passwd [, string dbname [, int port [, string socket [, int flags]]]]]]] + if (!$link = mysqli_init()) + printf("[002] mysqli_init() failed\n"); + + if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[004] mysqli_init() failed\n"); + + if (false !== ($tmp = mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))) + printf("[005] Expecting boolean/false got %s/%s. Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", gettype($tmp), $tmp, $host, $user . 'unknown_really', $db, $port, $socket); + + // Run the following tests without an anoynmous MySQL user and use a password for the test user! + ini_set('mysqli.default_socket', $socket); + if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port)) { + printf("[006] Usage of mysqli.default_socket failed\n"); + } else { + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[007] mysqli_init() failed\n"); + } + + ini_set('mysqli.default_port', $port); + if (!mysqli_real_connect($link, $host, $user, $passwd, $db)) { + printf("[008] Usage of mysqli.default_port failed\n"); + } else { + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[009] mysqli_init() failed\n"); + } + + ini_set('mysqli.default_pw', $passwd); + if (!mysqli_real_connect($link, $host, $user)) { + printf("[010] Usage of mysqli.default_pw failed\n") ; + } else { + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[011] mysqli_init() failed\n"); + } + + ini_set('mysqli.default_user', $user); + if (!mysqli_real_connect($link, $host)) { + printf("[012] Usage of mysqli.default_user failed\n") ; + } else { + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[011] mysqli_init() failed\n"); + } + + ini_set('mysqli.default_host', $host); + if (!mysqli_real_connect($link)) { + printf("[014] Usage of mysqli.default_host failed\n") ; + } else { + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[015] mysqli_init() failed\n"); + } + + // CLIENT_MULTI_STATEMENTS - should be disabled silently + if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 65536)) + printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if ($res = mysqli_query($link, "SELECT 1 AS a; SELECT 2 AS b")) { + printf("[017] Should have failed. CLIENT_MULTI_STATEMENT should have been disabled.\n"); + var_dump($res->num_rows); + mysqli_next_result($link); + $res = mysqli_store_result($link); + var_dump($res->num_rows); + } + + + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[018] mysqli_init() failed\n"); + + if (ini_get('open_basedir')) { + // CLIENT_LOCAL_FILES should be blocked - but how to test it ?! + + if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 128)) + printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mysqli_real_connect_phpt'; + if (!$fp = fopen($filename, 'w')) + printf("[020] Cannot open temporary file %s\n", $filename); + + fwrite($fp, '100;z'); + fclose($fp); + + // how do we test if gets forbidden because of a missing right or the flag, this test is partly bogus ? + if (mysqli_query($link, "LOAD DATA LOCAL INFILE '$filename' INTO TABLE test FIELDS TERMINATED BY ';'")) + printf("[021] LOAD DATA INFILE should have been forbidden!\n"); + + unlink($filename); + } + + mysqli_close($link); + var_dump($link); + + if ($IS_MYSQLND) { + ini_set('mysqli.default_host', 'p:' . $host); + $link = mysqli_init(); + if (!@mysqli_real_connect($link)) { + printf("[022] Usage of mysqli.default_host=p:%s (persistent) failed\n", $host) ; + } else { + if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'")) + printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + if ($tmp['testing'] !== 'mysqli.default_host (persistent)') { + printf("[024] Result looks strange - check manually, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + var_dump($tmp); + } + mysqli_free_result($res); + mysqli_close($link); + } + + ini_set('mysqli.default_host', 'p:'); + $link = mysqli_init(); + if (@mysqli_real_connect($link)) { + printf("[025] Usage of mysqli.default_host=p: did not fail\n") ; + mysqli_close($link); + } + @mysqli_close($link); + } + + try { mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_real_connect_pconn.phpt b/ext/mysqli/tests/mysqli_real_connect_pconn.phpt index 0d1c4985f2..121504a8fd 100644 --- a/ext/mysqli/tests/mysqli_real_connect_pconn.phpt +++ b/ext/mysqli/tests/mysqli_real_connect_pconn.phpt @@ -15,137 +15,137 @@ mysqli.allow_persistent=1 mysqli.max_persistent=10 --FILE-- <?php - require_once("connect.inc"); - $host = 'p:' . $host; - - if (!$link = mysqli_init()) - printf("[002] mysqli_init() failed\n"); - - if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) - printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[004] mysqli_init() failed\n"); - - if (false !== ($tmp = mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))) - printf("[005] Expecting boolean/false got %s/%s. Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", gettype($tmp), $tmp, $host, $user . 'unknown_really', $db, $port, $socket); - - // Run the following tests without an anoynmous MySQL user and use a password for the test user! - ini_set('mysqli.default_socket', $socket); - if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port)) { - printf("[006] Usage of mysqli.default_socket failed\n"); - } else { - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[007] mysqli_init() failed\n"); - } - - ini_set('mysqli.default_port', $port); - if (!mysqli_real_connect($link, $host, $user, $passwd, $db)) { - printf("[008] Usage of mysqli.default_port failed\n"); - } else { - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[009] mysqli_init() failed\n"); - } - - ini_set('mysqli.default_pw', $passwd); - if (!mysqli_real_connect($link, $host, $user)) { - printf("[010] Usage of mysqli.default_pw failed\n") ; - } else { - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[011] mysqli_init() failed\n"); - } - - ini_set('mysqli.default_user', $user); - if (!mysqli_real_connect($link, $host)) { - printf("[012] Usage of mysqli.default_user failed\n") ; - } else { - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[011] mysqli_init() failed\n"); - } - - ini_set('mysqli.default_host', $host); - if (!mysqli_real_connect($link)) { - printf("[014] Usage of mysqli.default_host failed\n") ; - } else { - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[015] mysqli_init() failed\n"); - } - - // CLIENT_MULTI_STATEMENTS - should be disabled silently - if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 65536)) - printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if ($res = mysqli_query($link, "SELECT 1 AS a; SELECT 2 AS b")) { - printf("[017] Should have failed. CLIENT_MULTI_STATEMENT should have been disabled.\n"); - var_dump($res->num_rows); - mysqli_next_result($link); - $res = mysqli_store_result($link); - var_dump($res->num_rows); - } - - - mysqli_close($link); - if (!$link = mysqli_init()) - printf("[018] mysqli_init() failed\n"); - - if (ini_get('open_basedir')) { - // CLIENT_LOCAL_FILES should be blocked - but how to test it ?! - - if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 128)) - printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mysqli_real_connect_phpt'; - if (!$fp = fopen($filename, 'w')) - printf("[020] Cannot open temporary file %s\n", $filename); - - fwrite($fp, '100;z'); - fclose($fp); - - // how do we test if gets forbidden because of a missing right or the flag, this test is partly bogus ? - if (mysqli_query($link, "LOAD DATA LOCAL INFILE '$filename' INTO TABLE test FIELDS TERMINATED BY ';'")) - printf("[021] LOAD DATA INFILE should have been forbidden!\n"); - - unlink($filename); - } - - mysqli_close($link); - - if ($IS_MYSQLND) { - $link = mysqli_init(); - if (!@mysqli_real_connect($link)) { - printf("[022] Usage of mysqli.default_host=p:%s (persistent) failed\n", $host) ; - } else { - if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'")) - printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - if ($tmp['testing'] !== 'mysqli.default_host (persistent)') { - printf("[024] Result looks strange - check manually, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - var_dump($tmp); - } - mysqli_free_result($res); - mysqli_close($link); - } - - ini_set('mysqli.default_host', 'p:'); - $link = mysqli_init(); - if (@mysqli_real_connect($link)) { - printf("[025] Usage of mysqli.default_host=p: did not fail\n") ; - mysqli_close($link); - } - } - - if (NULL === ($tmp = mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))) - printf("[026] Expecting not NULL, got %s/%s\n", gettype($tmp), $tmp); - - print "done!"; + require_once("connect.inc"); + $host = 'p:' . $host; + + if (!$link = mysqli_init()) + printf("[002] mysqli_init() failed\n"); + + if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[004] mysqli_init() failed\n"); + + if (false !== ($tmp = mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))) + printf("[005] Expecting boolean/false got %s/%s. Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", gettype($tmp), $tmp, $host, $user . 'unknown_really', $db, $port, $socket); + + // Run the following tests without an anoynmous MySQL user and use a password for the test user! + ini_set('mysqli.default_socket', $socket); + if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port)) { + printf("[006] Usage of mysqli.default_socket failed\n"); + } else { + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[007] mysqli_init() failed\n"); + } + + ini_set('mysqli.default_port', $port); + if (!mysqli_real_connect($link, $host, $user, $passwd, $db)) { + printf("[008] Usage of mysqli.default_port failed\n"); + } else { + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[009] mysqli_init() failed\n"); + } + + ini_set('mysqli.default_pw', $passwd); + if (!mysqli_real_connect($link, $host, $user)) { + printf("[010] Usage of mysqli.default_pw failed\n") ; + } else { + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[011] mysqli_init() failed\n"); + } + + ini_set('mysqli.default_user', $user); + if (!mysqli_real_connect($link, $host)) { + printf("[012] Usage of mysqli.default_user failed\n") ; + } else { + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[011] mysqli_init() failed\n"); + } + + ini_set('mysqli.default_host', $host); + if (!mysqli_real_connect($link)) { + printf("[014] Usage of mysqli.default_host failed\n") ; + } else { + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[015] mysqli_init() failed\n"); + } + + // CLIENT_MULTI_STATEMENTS - should be disabled silently + if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 65536)) + printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if ($res = mysqli_query($link, "SELECT 1 AS a; SELECT 2 AS b")) { + printf("[017] Should have failed. CLIENT_MULTI_STATEMENT should have been disabled.\n"); + var_dump($res->num_rows); + mysqli_next_result($link); + $res = mysqli_store_result($link); + var_dump($res->num_rows); + } + + + mysqli_close($link); + if (!$link = mysqli_init()) + printf("[018] mysqli_init() failed\n"); + + if (ini_get('open_basedir')) { + // CLIENT_LOCAL_FILES should be blocked - but how to test it ?! + + if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 128)) + printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mysqli_real_connect_phpt'; + if (!$fp = fopen($filename, 'w')) + printf("[020] Cannot open temporary file %s\n", $filename); + + fwrite($fp, '100;z'); + fclose($fp); + + // how do we test if gets forbidden because of a missing right or the flag, this test is partly bogus ? + if (mysqli_query($link, "LOAD DATA LOCAL INFILE '$filename' INTO TABLE test FIELDS TERMINATED BY ';'")) + printf("[021] LOAD DATA INFILE should have been forbidden!\n"); + + unlink($filename); + } + + mysqli_close($link); + + if ($IS_MYSQLND) { + $link = mysqli_init(); + if (!@mysqli_real_connect($link)) { + printf("[022] Usage of mysqli.default_host=p:%s (persistent) failed\n", $host) ; + } else { + if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'")) + printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + if ($tmp['testing'] !== 'mysqli.default_host (persistent)') { + printf("[024] Result looks strange - check manually, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + var_dump($tmp); + } + mysqli_free_result($res); + mysqli_close($link); + } + + ini_set('mysqli.default_host', 'p:'); + $link = mysqli_init(); + if (@mysqli_real_connect($link)) { + printf("[025] Usage of mysqli.default_host=p: did not fail\n") ; + mysqli_close($link); + } + } + + if (NULL === ($tmp = mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))) + printf("[026] Expecting not NULL, got %s/%s\n", gettype($tmp), $tmp); + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_real_escape_string.phpt b/ext/mysqli/tests/mysqli_real_escape_string.phpt index 9658bfc52d..185d245dcc 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string.phpt @@ -8,29 +8,29 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\'))) - printf("[004] Expecting \\\\, got %s\n", $tmp); + if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\'))) + printf("[004] Expecting \\\\, got %s\n", $tmp); - if ('\"' !== ($tmp = mysqli_real_escape_string($link, '"'))) - printf("[005] Expecting \", got %s\n", $tmp); + if ('\"' !== ($tmp = mysqli_real_escape_string($link, '"'))) + printf("[005] Expecting \", got %s\n", $tmp); - if ("\'" !== ($tmp = mysqli_real_escape_string($link, "'"))) - printf("[006] Expecting ', got %s\n", $tmp); + if ("\'" !== ($tmp = mysqli_real_escape_string($link, "'"))) + printf("[006] Expecting ', got %s\n", $tmp); - if ("\\n" !== ($tmp = mysqli_real_escape_string($link, "\n"))) - printf("[007] Expecting \\n, got %s\n", $tmp); + if ("\\n" !== ($tmp = mysqli_real_escape_string($link, "\n"))) + printf("[007] Expecting \\n, got %s\n", $tmp); - if ("\\r" !== ($tmp = mysqli_real_escape_string($link, "\r"))) - printf("[008] Expecting \\r, got %s\n", $tmp); + if ("\\r" !== ($tmp = mysqli_real_escape_string($link, "\r"))) + printf("[008] Expecting \\r, got %s\n", $tmp); - if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar"))) - printf("[009] Expecting %s, got %s\n", "foo\\0bar", $tmp); + if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar"))) + printf("[009] Expecting %s, got %s\n", "foo\\0bar", $tmp); - mysqli_close($link); + mysqli_close($link); try { mysqli_real_escape_string($link, 'foo'); @@ -38,7 +38,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --EXPECT-- mysqli object is already closed diff --git a/ext/mysqli/tests/mysqli_real_escape_string_big5.phpt b/ext/mysqli/tests/mysqli_real_escape_string_big5.phpt index 20384d9a0f..97113b858e 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string_big5.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string_big5.phpt @@ -18,57 +18,57 @@ mysqli_close($link); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); - } + } - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { + printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + } - if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY + if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=big5")) { - printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), + printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + } - var_dump(mysqli_set_charset($link, "big5")); + var_dump(mysqli_set_charset($link, "big5")); - if ('§ä¨ì¥H¤U¤º®e\\\\§ä¨ì¥H¤U¤º®e' !== ($tmp = mysqli_real_escape_string($link, + if ('§ä¨ì¥H¤U¤º®e\\\\§ä¨ì¥H¤U¤º®e' !== ($tmp = mysqli_real_escape_string($link, '§ä¨ì¥H¤U¤º®e\\§ä¨ì¥H¤U¤º®e'))) - printf("[004] Expecting \\\\, got %s\n", $tmp); + printf("[004] Expecting \\\\, got %s\n", $tmp); - if ('§ä¨ì¥H¤U¤º®e\"§ä¨ì¥H¤U¤º®e' !== ($tmp = mysqli_real_escape_string($link, + if ('§ä¨ì¥H¤U¤º®e\"§ä¨ì¥H¤U¤º®e' !== ($tmp = mysqli_real_escape_string($link, '§ä¨ì¥H¤U¤º®e"§ä¨ì¥H¤U¤º®e'))) - printf("[005] Expecting \", got %s\n", $tmp); + printf("[005] Expecting \", got %s\n", $tmp); - if ("§ä¨ì¥H¤U¤º®e\'§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link, + if ("§ä¨ì¥H¤U¤º®e\'§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link, "§ä¨ì¥H¤U¤º®e'§ä¨ì¥H¤U¤º®e"))) - printf("[006] Expecting ', got %s\n", $tmp); + printf("[006] Expecting ', got %s\n", $tmp); - if ("§ä¨ì¥H¤U¤º®e\\n§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link, + if ("§ä¨ì¥H¤U¤º®e\\n§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link, "§ä¨ì¥H¤U¤º®e\n§ä¨ì¥H¤U¤º®e"))) - printf("[007] Expecting \\n, got %s\n", $tmp); + printf("[007] Expecting \\n, got %s\n", $tmp); - if ("§ä¨ì¥H¤U¤º®e\\r§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link, + if ("§ä¨ì¥H¤U¤º®e\\r§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link, "§ä¨ì¥H¤U¤º®e\r§ä¨ì¥H¤U¤º®e"))) - printf("[008] Expecting \\r, got %s\n", $tmp); + printf("[008] Expecting \\r, got %s\n", $tmp); - if ("§ä¨ì¥H¤U¤º®e\\0§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link, "§ä¨ì¥H¤U¤º®e" + if ("§ä¨ì¥H¤U¤º®e\\0§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link, "§ä¨ì¥H¤U¤º®e" . chr(0) . "§ä¨ì¥H¤U¤º®e"))) - printf("[009] Expecting %s, got %s\n", "§ä¨ì¥H¤U¤º®e\\0§ä¨ì¥H¤U¤º®e", $tmp); + printf("[009] Expecting %s, got %s\n", "§ä¨ì¥H¤U¤º®e\\0§ä¨ì¥H¤U¤º®e", $tmp); - var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, + var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '§ä')")); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt b/ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt index 14bf97c635..7d51309346 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt @@ -20,48 +20,48 @@ mysqli_close($link); <?php require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); - } + } - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { + printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + } - if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY + if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=eucjpms")) { - printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), + printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + } - var_dump(mysqli_set_charset($link, "eucjpms")); + var_dump(mysqli_set_charset($link, "eucjpms")); - if ('¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\\\¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï' !== ($tmp = mysqli_real_escape_string($link, '¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï'))) - printf("[004] Expecting \\\\, got %s\n", $tmp); + if ('¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\\\¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï' !== ($tmp = mysqli_real_escape_string($link, '¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï'))) + printf("[004] Expecting \\\\, got %s\n", $tmp); - if ('¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\"¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï' !== ($tmp = mysqli_real_escape_string($link, '¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï'))) - printf("[005] Expecting \", got %s\n", $tmp); + if ('¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\"¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï' !== ($tmp = mysqli_real_escape_string($link, '¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï'))) + printf("[005] Expecting \", got %s\n", $tmp); - if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\'¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï'¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"))) - printf("[006] Expecting ', got %s\n", $tmp); + if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\'¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï'¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"))) + printf("[006] Expecting ', got %s\n", $tmp); - if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\n¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\n¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"))) - printf("[007] Expecting \\n, got %s\n", $tmp); + if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\n¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\n¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"))) + printf("[007] Expecting \\n, got %s\n", $tmp); - if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\r¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\r¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"))) - printf("[008] Expecting \\r, got %s\n", $tmp); + if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\r¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\r¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"))) + printf("[008] Expecting \\r, got %s\n", $tmp); - if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\0¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" . chr(0) . "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"))) - printf("[009] Expecting %s, got %s\n", "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\0¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï", $tmp); + if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\0¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" . chr(0) . "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"))) + printf("[009] Expecting %s, got %s\n", "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\0¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï", $tmp); - var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '¤³')")); + var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '¤³')")); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt b/ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt index cff45e06d4..21c3f99736 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt @@ -18,49 +18,49 @@ mysqli_close($link); ?> --FILE-- <?php - require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + require_once("connect.inc"); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); - } + } - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { + printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + } - if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY + if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=euckr")) { - printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), + printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + } - var_dump(mysqli_set_charset($link, "euckr")); + var_dump(mysqli_set_charset($link, "euckr")); - if ('±Ç´ë¼º\\\\±Ç´ë¼º' !== ($tmp = mysqli_real_escape_string($link, '±Ç´ë¼º\\±Ç´ë¼º'))) - printf("[004] Expecting \\\\, got %s\n", $tmp); + if ('±Ç´ë¼º\\\\±Ç´ë¼º' !== ($tmp = mysqli_real_escape_string($link, '±Ç´ë¼º\\±Ç´ë¼º'))) + printf("[004] Expecting \\\\, got %s\n", $tmp); - if ('±Ç´ë¼º\"±Ç´ë¼º' !== ($tmp = mysqli_real_escape_string($link, '±Ç´ë¼º"±Ç´ë¼º'))) - printf("[005] Expecting \", got %s\n", $tmp); + if ('±Ç´ë¼º\"±Ç´ë¼º' !== ($tmp = mysqli_real_escape_string($link, '±Ç´ë¼º"±Ç´ë¼º'))) + printf("[005] Expecting \", got %s\n", $tmp); - if ("±Ç´ë¼º\'±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º'±Ç´ë¼º"))) - printf("[006] Expecting ', got %s\n", $tmp); + if ("±Ç´ë¼º\'±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º'±Ç´ë¼º"))) + printf("[006] Expecting ', got %s\n", $tmp); - if ("±Ç´ë¼º\\n±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º\n±Ç´ë¼º"))) - printf("[007] Expecting \\n, got %s\n", $tmp); + if ("±Ç´ë¼º\\n±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º\n±Ç´ë¼º"))) + printf("[007] Expecting \\n, got %s\n", $tmp); - if ("±Ç´ë¼º\\r±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º\r±Ç´ë¼º"))) - printf("[008] Expecting \\r, got %s\n", $tmp); + if ("±Ç´ë¼º\\r±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º\r±Ç´ë¼º"))) + printf("[008] Expecting \\r, got %s\n", $tmp); - if ("±Ç´ë¼º\\0±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º" . chr(0) . "±Ç´ë¼º"))) - printf("[009] Expecting %s, got %s\n", "±Ç´ë¼º\\0±Ç´ë¼º", $tmp); + if ("±Ç´ë¼º\\0±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º" . chr(0) . "±Ç´ë¼º"))) + printf("[009] Expecting %s, got %s\n", "±Ç´ë¼º\\0±Ç´ë¼º", $tmp); - var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '±Ç')")); + var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '±Ç')")); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt b/ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt index 537ac7292f..505c0bfa6c 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt @@ -19,49 +19,49 @@ mysqli_close($link); --FILE-- <?php - require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + require_once("connect.inc"); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); - } + } - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { + printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + } - if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY + if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=gb2312")) { - printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), + printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + } - var_dump(mysqli_set_charset($link, "gb2312")); + var_dump(mysqli_set_charset($link, "gb2312")); - if ('Ê×ÏÈ\\\\Ê×ÏÈ' !== ($tmp = mysqli_real_escape_string($link, 'Ê×ÏÈ\\Ê×ÏÈ'))) - printf("[004] Expecting \\\\, got %s\n", $tmp); + if ('Ê×ÏÈ\\\\Ê×ÏÈ' !== ($tmp = mysqli_real_escape_string($link, 'Ê×ÏÈ\\Ê×ÏÈ'))) + printf("[004] Expecting \\\\, got %s\n", $tmp); - if ('Ê×ÏÈ\"Ê×ÏÈ' !== ($tmp = mysqli_real_escape_string($link, 'Ê×ÏÈ"Ê×ÏÈ'))) - printf("[005] Expecting \", got %s\n", $tmp); + if ('Ê×ÏÈ\"Ê×ÏÈ' !== ($tmp = mysqli_real_escape_string($link, 'Ê×ÏÈ"Ê×ÏÈ'))) + printf("[005] Expecting \", got %s\n", $tmp); - if ("Ê×ÏÈ\'Ê×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ'Ê×ÏÈ"))) - printf("[006] Expecting ', got %s\n", $tmp); + if ("Ê×ÏÈ\'Ê×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ'Ê×ÏÈ"))) + printf("[006] Expecting ', got %s\n", $tmp); - if ("Ê×ÏÈ\\nÊ×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ\nÊ×ÏÈ"))) - printf("[007] Expecting \\n, got %s\n", $tmp); + if ("Ê×ÏÈ\\nÊ×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ\nÊ×ÏÈ"))) + printf("[007] Expecting \\n, got %s\n", $tmp); - if ("Ê×ÏÈ\\rÊ×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ\rÊ×ÏÈ"))) - printf("[008] Expecting \\r, got %s\n", $tmp); + if ("Ê×ÏÈ\\rÊ×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ\rÊ×ÏÈ"))) + printf("[008] Expecting \\r, got %s\n", $tmp); - if ("Ê×ÏÈ\\0Ê×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ" . chr(0) . "Ê×ÏÈ"))) - printf("[009] Expecting %s, got %s\n", "Ê×ÏÈ\\0Ê×ÏÈ", $tmp); + if ("Ê×ÏÈ\\0Ê×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ" . chr(0) . "Ê×ÏÈ"))) + printf("[009] Expecting %s, got %s\n", "Ê×ÏÈ\\0Ê×ÏÈ", $tmp); - var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'Ê×')")); + var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'Ê×')")); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt b/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt index 85ac847666..3dd8c84a58 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt @@ -19,49 +19,49 @@ mysqli_close($link); --FILE-- <?php - require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + require_once("connect.inc"); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); - } + } - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { + printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + } - if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(3), PRIMARY + if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(3), PRIMARY KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=gbk")) { - printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), + printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + } - var_dump(mysqli_set_charset($link, "gbk")); + var_dump(mysqli_set_charset($link, "gbk")); - if ('�İ汾\\\\�İ汾' !== ($tmp = mysqli_real_escape_string($link, '�İ汾\\�İ汾'))) - printf("[004] Expecting \\\\, got %s\n", $tmp); + if ('�İ汾\\\\�İ汾' !== ($tmp = mysqli_real_escape_string($link, '�İ汾\\�İ汾'))) + printf("[004] Expecting \\\\, got %s\n", $tmp); - if ('�İ汾\"�İ汾' !== ($tmp = mysqli_real_escape_string($link, '�İ汾"�İ汾'))) - printf("[005] Expecting \", got %s\n", $tmp); + if ('�İ汾\"�İ汾' !== ($tmp = mysqli_real_escape_string($link, '�İ汾"�İ汾'))) + printf("[005] Expecting \", got %s\n", $tmp); - if ("�İ汾\'�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾'�İ汾"))) - printf("[006] Expecting ', got %s\n", $tmp); + if ("�İ汾\'�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾'�İ汾"))) + printf("[006] Expecting ', got %s\n", $tmp); - if ("�İ汾\\n�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾\n�İ汾"))) - printf("[007] Expecting \\n, got %s\n", $tmp); + if ("�İ汾\\n�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾\n�İ汾"))) + printf("[007] Expecting \\n, got %s\n", $tmp); - if ("�İ汾\\r�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾\r�İ汾"))) - printf("[008] Expecting \\r, got %s\n", $tmp); + if ("�İ汾\\r�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾\r�İ汾"))) + printf("[008] Expecting \\r, got %s\n", $tmp); - if ("�İ汾\\0�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾" . chr(0) . "�İ汾"))) - printf("[009] Expecting %s, got %s\n", "�İ汾\\0�İ汾", $tmp); + if ("�İ汾\\0�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾" . chr(0) . "�İ汾"))) + printf("[009] Expecting %s, got %s\n", "�İ汾\\0�İ汾", $tmp); - var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '��')")); + var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '��')")); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt b/ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt index d4e43243fa..b8e48ccf8f 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt @@ -8,54 +8,54 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - require_once('table.inc'); + require_once("connect.inc"); + require_once('table.inc'); - if (!mysqli_query($link, 'SET @@sql_mode="NO_BACKSLASH_ESCAPES"')) - printf("[001] Cannot set NO_BACKSLASH_ESCAPES, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'SET @@sql_mode="NO_BACKSLASH_ESCAPES"')) + printf("[001] Cannot set NO_BACKSLASH_ESCAPES, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ('\\' !== ($tmp = mysqli_real_escape_string($link, '\\'))) - printf("[002] Expecting \\, got %s\n", $tmp); + if ('\\' !== ($tmp = mysqli_real_escape_string($link, '\\'))) + printf("[002] Expecting \\, got %s\n", $tmp); - if ('"' !== ($tmp = mysqli_real_escape_string($link, '"'))) - printf("[003] Expecting \", got %s\n", $tmp); + if ('"' !== ($tmp = mysqli_real_escape_string($link, '"'))) + printf("[003] Expecting \", got %s\n", $tmp); - if ("''" !== ($tmp = mysqli_real_escape_string($link, "'"))) - printf("[004] Expecting '', got %s\n", $tmp); + if ("''" !== ($tmp = mysqli_real_escape_string($link, "'"))) + printf("[004] Expecting '', got %s\n", $tmp); - if ("\n" !== ($tmp = mysqli_real_escape_string($link, "\n"))) - printf("[005] Expecting \\n, got %s\n", $tmp); + if ("\n" !== ($tmp = mysqli_real_escape_string($link, "\n"))) + printf("[005] Expecting \\n, got %s\n", $tmp); - if ("\r" !== ($tmp = mysqli_real_escape_string($link, "\r"))) - printf("[006] Expecting \\r, got %s\n", $tmp); + if ("\r" !== ($tmp = mysqli_real_escape_string($link, "\r"))) + printf("[006] Expecting \\r, got %s\n", $tmp); - assert("foo" . chr(0) . "bar" === "foo" . chr(0) . "bar"); - if ("foo" . chr(0) . "bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar"))) - printf("[007] Expecting %s, got %s\n", "foo" . chr(0) . "bar", $tmp); + assert("foo" . chr(0) . "bar" === "foo" . chr(0) . "bar"); + if ("foo" . chr(0) . "bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar"))) + printf("[007] Expecting %s, got %s\n", "foo" . chr(0) . "bar", $tmp); - if (!mysqli_query($link, sprintf('INSERT INTO test(id, label) VALUES (100, "%s")', - mysqli_real_escape_string($link, "\\")))) - printf("[009] Cannot INSERT, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, sprintf('INSERT INTO test(id, label) VALUES (100, "%s")', + mysqli_real_escape_string($link, "\\")))) + printf("[009] Cannot INSERT, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!($res = mysqli_query($link, 'SELECT label FROM test WHERE id = 100')) || - !($row = mysqli_fetch_assoc($res))) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!($res = mysqli_query($link, 'SELECT label FROM test WHERE id = 100')) || + !($row = mysqli_fetch_assoc($res))) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($row); - mysqli_free_result($res); + var_dump($row); + mysqli_free_result($res); - if (!mysqli_query($link, 'SET @@sql_mode=""')) - printf("[011] Cannot disable NO_BACKSLASH_ESCAPES, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'SET @@sql_mode=""')) + printf("[011] Cannot disable NO_BACKSLASH_ESCAPES, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\'))) - printf("[012] Expecting \\, got %s\n", $tmp); + if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\'))) + printf("[012] Expecting \\, got %s\n", $tmp); - if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar"))) - printf("[013] Expecting %s, got %s\n", "foo" . chr(0) . "bar", $tmp); + if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar"))) + printf("[013] Expecting %s, got %s\n", "foo" . chr(0) . "bar", $tmp); - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --EXPECT-- array(1) { diff --git a/ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt b/ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt index 9e1562dba0..611590af27 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt @@ -18,33 +18,33 @@ mysqli_close($link); --FILE-- <?php - require_once("connect.inc"); - require_once('table.inc'); + require_once("connect.inc"); + require_once('table.inc'); - var_dump(mysqli_set_charset($link, "sjis")); + var_dump(mysqli_set_charset($link, "sjis")); - if ('?p??\\\\?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??\\?p??'))) - printf("[004] Expecting \\\\, got %s\n", $tmp); + if ('?p??\\\\?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??\\?p??'))) + printf("[004] Expecting \\\\, got %s\n", $tmp); - if ('?p??\"?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??"?p??'))) - printf("[005] Expecting \", got %s\n", $tmp); + if ('?p??\"?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??"?p??'))) + printf("[005] Expecting \", got %s\n", $tmp); - if ("?p??\'?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??'?p??"))) - printf("[006] Expecting ', got %s\n", $tmp); + if ("?p??\'?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??'?p??"))) + printf("[006] Expecting ', got %s\n", $tmp); - if ("?p??\\n?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\n?p??"))) - printf("[007] Expecting \\n, got %s\n", $tmp); + if ("?p??\\n?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\n?p??"))) + printf("[007] Expecting \\n, got %s\n", $tmp); - if ("?p??\\r?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\r?p??"))) - printf("[008] Expecting \\r, got %s\n", $tmp); + if ("?p??\\r?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\r?p??"))) + printf("[008] Expecting \\r, got %s\n", $tmp); - if ("?p??\\0?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??" . chr(0) . "?p??"))) - printf("[009] Expecting %s, got %s\n", "?p??\\0?p??", $tmp); + if ("?p??\\0?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??" . chr(0) . "?p??"))) + printf("[009] Expecting %s, got %s\n", "?p??\\0?p??", $tmp); - var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '?p')")); + var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '?p')")); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --EXPECT-- bool(true) diff --git a/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt b/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt index d27c09359c..acbbc4ed85 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt @@ -8,59 +8,59 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if ('фу\\\\бар' !== ($tmp = mysqli_real_escape_string($link, 'фу\\бар'))) - printf("[004] Expecting фу\\\\бар, got %s\n", $tmp); + if ('фу\\\\бар' !== ($tmp = mysqli_real_escape_string($link, 'фу\\бар'))) + printf("[004] Expecting фу\\\\бар, got %s\n", $tmp); - if ('бар\"фуÑ' !== ($tmp = mysqli_real_escape_string($link, 'бар"фуÑ'))) - printf("[005] Expecting бар\"фуÑ, got %s\n", $tmp); + if ('бар\"фуÑ' !== ($tmp = mysqli_real_escape_string($link, 'бар"фуÑ'))) + printf("[005] Expecting бар\"фуÑ, got %s\n", $tmp); - if ("лала\'лали" !== ($tmp = mysqli_real_escape_string($link, "лала'лали"))) - printf("[006] Expecting лала'лали, got %s\n", $tmp); + if ("лала\'лали" !== ($tmp = mysqli_real_escape_string($link, "лала'лали"))) + printf("[006] Expecting лала'лали, got %s\n", $tmp); - if ("абра\\nкадабра" !== ($tmp = mysqli_real_escape_string($link, "абра\nкадабра"))) - printf("[007] Expecting абра\\nкадабра, got %s\n", $tmp); + if ("абра\\nкадабра" !== ($tmp = mysqli_real_escape_string($link, "абра\nкадабра"))) + printf("[007] Expecting абра\\nкадабра, got %s\n", $tmp); - if ("манда\\rин" !== ($tmp = mysqli_real_escape_string($link, "манда\rин"))) - printf("[008] Expecting \\r, got %s\n", $tmp); + if ("манда\\rин" !== ($tmp = mysqli_real_escape_string($link, "манда\rин"))) + printf("[008] Expecting \\r, got %s\n", $tmp); - if ("иху\\0аху" !== ($tmp = mysqli_real_escape_string($link, "иху" . chr(0) . "аху"))) - printf("[009] Expecting %s, got %s\n", "иху\\0аху", $tmp); + if ("иху\\0аху" !== ($tmp = mysqli_real_escape_string($link, "иху" . chr(0) . "аху"))) + printf("[009] Expecting %s, got %s\n", "иху\\0аху", $tmp); - if (($exp='абра\\\\ка\"да\\'."'".'бра\ZÑим\\nÑала\\rби\\0м') !== - ($tmp = mysqli_real_escape_string($link, "абра\\ка\"да'бра\032Ñим\nÑала\rби" . chr(0) . "м"))) - { - printf("[010] Expecting %s, got %s\n", $exp, $tmp, var_dump($exp, $tmp)); - } + if (($exp='абра\\\\ка\"да\\'."'".'бра\ZÑим\\nÑала\\rби\\0м') !== + ($tmp = mysqli_real_escape_string($link, "абра\\ка\"да'бра\032Ñим\nÑала\rби" . chr(0) . "м"))) + { + printf("[010] Expecting %s, got %s\n", $exp, $tmp, var_dump($exp, $tmp)); + } - if ('富\\\\é…’å§' !== ($tmp = mysqli_real_escape_string($link, '富\\é…’å§'))) - printf("[011] Expecting 富\\\\é…’å§, got %s\n", $tmp); + if ('富\\\\é…’å§' !== ($tmp = mysqli_real_escape_string($link, '富\\é…’å§'))) + printf("[011] Expecting 富\\\\é…’å§, got %s\n", $tmp); - if ('é…’å§\"å°é¢˜å¤§åš' !== ($tmp = mysqli_real_escape_string($link, 'é…’å§"å°é¢˜å¤§åš'))) - printf("[012] Expecting é…’å§\"å°é¢˜å¤§åš, got %s\n", $tmp); + if ('é…’å§\"å°é¢˜å¤§åš' !== ($tmp = mysqli_real_escape_string($link, 'é…’å§"å°é¢˜å¤§åš'))) + printf("[012] Expecting é…’å§\"å°é¢˜å¤§åš, got %s\n", $tmp); - if ("拉拉\'西雅图" !== ($tmp = mysqli_real_escape_string($link, "拉拉'西雅图"))) - printf("[013] Expecting 拉拉'西雅图, got %s\n", $tmp); + if ("拉拉\'西雅图" !== ($tmp = mysqli_real_escape_string($link, "拉拉'西雅图"))) + printf("[013] Expecting 拉拉'西雅图, got %s\n", $tmp); - if ("é˜¿åœæ‹‰\\nè½»" !== ($tmp = mysqli_real_escape_string($link, "é˜¿åœæ‹‰\nè½»"))) - printf("[014] Expecting é˜¿åœæ‹‰\\nè½», got %s\n", $tmp); + if ("é˜¿åœæ‹‰\\nè½»" !== ($tmp = mysqli_real_escape_string($link, "é˜¿åœæ‹‰\nè½»"))) + printf("[014] Expecting é˜¿åœæ‹‰\\nè½», got %s\n", $tmp); - if ("å¼ æ˜Žå®‰\\r在" !== ($tmp = mysqli_real_escape_string($link, "å¼ æ˜Žå®‰\r在"))) - printf("[015] Expecting å¼ æ˜Žå®‰\\r在, got %s\n", $tmp); + if ("å¼ æ˜Žå®‰\\r在" !== ($tmp = mysqli_real_escape_string($link, "å¼ æ˜Žå®‰\r在"))) + printf("[015] Expecting å¼ æ˜Žå®‰\\r在, got %s\n", $tmp); - if ("ç«ºå¯æ¡¢\\0空调器" !== ($tmp = mysqli_real_escape_string($link, "ç«ºå¯æ¡¢" . chr(0) . "空调器"))) - printf("[016] Expecting %s, got %s\n", "ç«ºå¯æ¡¢\\0空调器", $tmp); + if ("ç«ºå¯æ¡¢\\0空调器" !== ($tmp = mysqli_real_escape_string($link, "ç«ºå¯æ¡¢" . chr(0) . "空调器"))) + printf("[016] Expecting %s, got %s\n", "ç«ºå¯æ¡¢\\0空调器", $tmp); - if (($exp='é˜¿åœæ‹‰\\\\嘉\"达丰\\'."'".'乳罩\Zè¾›\\nè¨æ‹‰\\r毕\\0ç±³') !== - ($tmp = mysqli_real_escape_string($link, "é˜¿åœæ‹‰\\嘉\"达丰'乳罩\032è¾›\nè¨æ‹‰\r毕" . chr(0) . "ç±³"))) - { - printf("[017] Expecting %s, got %s\n", $exp, $tmp, var_dump($exp, $tmp)); - } + if (($exp='é˜¿åœæ‹‰\\\\嘉\"达丰\\'."'".'乳罩\Zè¾›\\nè¨æ‹‰\\r毕\\0ç±³') !== + ($tmp = mysqli_real_escape_string($link, "é˜¿åœæ‹‰\\嘉\"达丰'乳罩\032è¾›\nè¨æ‹‰\r毕" . chr(0) . "ç±³"))) + { + printf("[017] Expecting %s, got %s\n", $exp, $tmp, var_dump($exp, $tmp)); + } - mysqli_close($link); + mysqli_close($link); try { mysqli_real_escape_string($link, 'foo'); @@ -68,7 +68,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_real_query.phpt b/ext/mysqli/tests/mysqli_real_query.phpt index 5528ca63aa..45df8a9edc 100644 --- a/ext/mysqli/tests/mysqli_real_query.phpt +++ b/ext/mysqli/tests/mysqli_real_query.phpt @@ -7,70 +7,70 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (false !== ($tmp = mysqli_real_query($link, 'THIS IS NOT SQL'))) - printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_real_query($link, 'THIS IS NOT SQL'))) + printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_real_query($link, "SELECT 'this is sql but with backslash g'\g"))) - printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_real_query($link, "SELECT 'this is sql but with backslash g'\g"))) + printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link))) - printf("[006] mysqli_errno()/mysqli_error should return some error\n"); + if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link))) + printf("[006] mysqli_errno()/mysqli_error should return some error\n"); - if (!mysqli_real_query($link, "SELECT 'this is sql but with semicolon' AS valid ; ")) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_real_query($link, "SELECT 'this is sql but with semicolon' AS valid ; ")) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_object($res = mysqli_use_result($link))) - printf("[008] Expecting reseult object, got %s/%s [%d] %s\n", gettype($res), $res, mysqli_errno($link), mysqli_error($link)); + if (!is_object($res = mysqli_use_result($link))) + printf("[008] Expecting reseult object, got %s/%s [%d] %s\n", gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); - if (false !== ($res = mysqli_real_query($link, "SELECT 'this is sql but with semicolon' AS valid ; SHOW VARIABLES"))) - printf("[008] Expecting boolean/false, got %s/%s, [%d] %s\n", gettype($res), $res, - mysqli_errno($link), mysqli_error($link)); + if (false !== ($res = mysqli_real_query($link, "SELECT 'this is sql but with semicolon' AS valid ; SHOW VARIABLES"))) + printf("[008] Expecting boolean/false, got %s/%s, [%d] %s\n", gettype($res), $res, + mysqli_errno($link), mysqli_error($link)); - if (mysqli_get_server_version($link) > 50000) { - // let's try to play with stored procedures - mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p'); - if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; + if (mysqli_get_server_version($link) > 50000) { + // let's try to play with stored procedures + mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p'); + if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) { - mysqli_real_query($link, 'CALL p(@version)'); - mysqli_real_query($link, 'SELECT @version AS p_version'); - $res = mysqli_store_result($link); - - $tmp = mysqli_fetch_assoc($res); - if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) { - printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($tmp); - } - - mysqli_free_result($res); - } else { - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - mysqli_real_query($link, 'DROP FUNCTION IF EXISTS f'); - if (mysqli_real_query($link, 'CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN + mysqli_real_query($link, 'CALL p(@version)'); + mysqli_real_query($link, 'SELECT @version AS p_version'); + $res = mysqli_store_result($link); + + $tmp = mysqli_fetch_assoc($res); + if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) { + printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($tmp); + } + + mysqli_free_result($res); + } else { + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + mysqli_real_query($link, 'DROP FUNCTION IF EXISTS f'); + if (mysqli_real_query($link, 'CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN ver_param;')) { - mysqli_real_query($link, 'SELECT f(VERSION()) AS f_version'); - $res = mysqli_store_result($link); - - $tmp = mysqli_fetch_assoc($res); - if (!is_array($tmp) || empty($tmp) || !isset($tmp['f_version']) || ('' == $tmp['f_version'])) { - printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($tmp); - } - - mysqli_free_result($res); - } else { - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - } + mysqli_real_query($link, 'SELECT f(VERSION()) AS f_version'); + $res = mysqli_store_result($link); + + $tmp = mysqli_fetch_assoc($res); + if (!is_array($tmp) || empty($tmp) || !isset($tmp['f_version']) || ('' == $tmp['f_version'])) { + printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($tmp); + } + + mysqli_free_result($res); + } else { + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + } - mysqli_close($link); + mysqli_close($link); try { mysqli_real_query($link, "SELECT id FROM test"); @@ -78,7 +78,7 @@ ver_param;')) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_reap_async_query.phpt b/ext/mysqli/tests/mysqli_reap_async_query.phpt index 5f08039b99..8f9fd5cb1c 100644 --- a/ext/mysqli/tests/mysqli_reap_async_query.phpt +++ b/ext/mysqli/tests/mysqli_reap_async_query.phpt @@ -12,70 +12,70 @@ if (!$IS_MYSQLND) ?> --FILE-- <?php - require_once('connect.inc'); + require_once('connect.inc'); - function get_connection() { - global $host, $user, $passwd, $db, $port, $socket; + function get_connection() { + global $host, $user, $passwd, $db, $port, $socket; - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - return $link; - } + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + return $link; + } - if (!$link = get_connection()) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + if (!$link = get_connection()) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) { + function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) { - if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 50 * 1000))) - printf("[%03d + 1] There should be %d links ready to read from, %d ready\n", - $offset, $exp_ready, $tmp); + if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 50 * 1000))) + printf("[%03d + 1] There should be %d links ready to read from, %d ready\n", + $offset, $exp_ready, $tmp); - foreach ($links as $mysqli) { - if ($use_oo_syntax) { - $res = $mysqli->reap_async_query(); - } else { - $res = mysqli_reap_async_query($mysqli); - } - if (is_object($res)) { - printf("[%03d + 2] %s\n", $offset, var_export($res->fetch_assoc(), true)); - } else if (mysqli_errno($mysqli) > 0) { - printf("[%03d + 3] Error indicated through links array: %d/%s", - $offset, mysqli_errno($mysqli), mysqli_error($mysqli)); - } else { - printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset); - } - } + foreach ($links as $mysqli) { + if ($use_oo_syntax) { + $res = $mysqli->reap_async_query(); + } else { + $res = mysqli_reap_async_query($mysqli); + } + if (is_object($res)) { + printf("[%03d + 2] %s\n", $offset, var_export($res->fetch_assoc(), true)); + } else if (mysqli_errno($mysqli) > 0) { + printf("[%03d + 3] Error indicated through links array: %d/%s", + $offset, mysqli_errno($mysqli), mysqli_error($mysqli)); + } else { + printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset); + } + } - foreach ($errors as $mysqli) - printf("[%03d + 5] Error on %d: %d/%s\n", - $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli)); + foreach ($errors as $mysqli) + printf("[%03d + 5] Error on %d: %d/%s\n", + $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli)); - foreach ($reject as $mysqli) - printf("[%03d + 6] Rejecting thread %d: %d/%s\n", - $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli)); + foreach ($reject as $mysqli) + printf("[%03d + 6] Rejecting thread %d: %d/%s\n", + $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli)); - } + } - // Connections on which no query has been send - 1 - $link = get_connection(); - $link->query("SELECT 1 AS _one", MYSQLI_ASYNC | MYSQLI_STORE_RESULT); - $links = array($link); - $errors = array($link); - $reject = array($link); - poll_async(12, $link, $links, $errors, $reject, 1, false); - mysqli_close($link); + // Connections on which no query has been send - 1 + $link = get_connection(); + $link->query("SELECT 1 AS _one", MYSQLI_ASYNC | MYSQLI_STORE_RESULT); + $links = array($link); + $errors = array($link); + $reject = array($link); + poll_async(12, $link, $links, $errors, $reject, 1, false); + mysqli_close($link); - $link = get_connection(); - $link->query("SELECT 2 AS _two", MYSQLI_ASYNC | MYSQLI_USE_RESULT); - $links = array($link); - $errors = array($link); - $reject = array($link); - poll_async(13, $link, $links, $errors, $reject, 1, true); - mysqli_close($link); + $link = get_connection(); + $link->query("SELECT 2 AS _two", MYSQLI_ASYNC | MYSQLI_USE_RESULT); + $links = array($link); + $errors = array($link); + $reject = array($link); + poll_async(13, $link, $links, $errors, $reject, 1, true); + mysqli_close($link); - print "done!"; + print "done!"; ?> --EXPECT-- [012 + 2] array ( diff --git a/ext/mysqli/tests/mysqli_reconnect.phpt b/ext/mysqli/tests/mysqli_reconnect.phpt index 606d380285..0ad110f0df 100644 --- a/ext/mysqli/tests/mysqli_reconnect.phpt +++ b/ext/mysqli/tests/mysqli_reconnect.phpt @@ -12,119 +12,119 @@ if (stristr(mysqli_get_client_info(), 'mysqlnd')) mysqli.reconnect=1 --FILE-- <?php - require_once("connect.inc"); - require_once("table.inc"); + require_once("connect.inc"); + require_once("table.inc"); - if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot create second database connection, [%d] %s\n", - mysqli_connect_errno(), mysqli_connect_error()); + if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot create second database connection, [%d] %s\n", + mysqli_connect_errno(), mysqli_connect_error()); - $thread_id_timeout = mysqli_thread_id($link); - $thread_id_control = mysqli_thread_id($link2); + $thread_id_timeout = mysqli_thread_id($link); + $thread_id_control = mysqli_thread_id($link2); - if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST")) - printf("[002] Cannot get full processlist, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link)); - - $running_threads = array(); - while ($row = mysqli_fetch_assoc($res)) - $running_threads[$row['Id']] = $row; - mysqli_free_result($res); - - if (!isset($running_threads[$thread_id_timeout]) || - !isset($running_threads[$thread_id_control])) - printf("[003] Processlist is borked, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link)); - - if (!mysqli_query($link, "SET SESSION wait_timeout = 2")) - printf("[004] Cannot set wait_timeout, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'wait_timeout'")) - printf("[005] Cannot check if wait_timeout has been set, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - - if (!$row = mysqli_fetch_assoc($res)) - printf("[006] Cannot get wait_timeout, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - - if ($row['Value'] != 2) - printf("[007] Failed setting the wait_timeout, test will not work, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - - // after 2+ seconds the server should kill the connection - sleep(3); - - if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST")) - printf("[008] Cannot get full processlist, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link)); - - $running_threads = array(); - while ($row = mysqli_fetch_assoc($res)) - $running_threads[$row['Id']] = $row; - mysqli_free_result($res); - - if (isset($running_threads[$thread_id_timeout])) - printf("[009] Server should have killed the timeout connection, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link)); - - if (true !== mysqli_ping($link)) - printf("[010] Reconnect should have happened"); - - if (!$res = mysqli_query($link, "SELECT DATABASE() as _dbname")) - printf("[011] Cannot get database name, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - - if (!$row = mysqli_fetch_assoc($res)) - printf("[012] Cannot get database name, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - - mysqli_free_result($res); - if ($row['_dbname'] != $db) - printf("[013] Connection should has been made to DB/Schema '%s', expecting '%s', [%d] %s\n", - $row['_dbname'], $db, mysqli_errno($link), mysqli_error($link)); - - // ... and now we try KILL - $thread_id_timeout = mysqli_thread_id($link); - - if (!mysqli_query($link2, sprintf('KILL %d', $thread_id_timeout))) - printf("[014] Cannot KILL timeout connection, [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); - // Give the server a second to really kill the other thread... - sleep(1); - - if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST")) - printf("[015] Cannot get full processlist, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link)); - - $running_threads = array(); - while ($row = mysqli_fetch_assoc($res)) - $running_threads[$row['Id']] = $row; - mysqli_free_result($res); - - if (isset($running_threads[$thread_id_timeout]) || - !isset($running_threads[$thread_id_control])) - printf("[016] Processlist is borked, [%d] %s\n", - mysqli_errno($link2), mysqli_error($link)); - - if (true !== ($tmp = mysqli_ping($link))) - printf("[017] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); - - if (!$res = mysqli_query($link, "SELECT DATABASE() as _dbname")) - printf("[018] Cannot get database name, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - - if (!$row = mysqli_fetch_assoc($res)) - printf("[019] Cannot get database name, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - - mysqli_free_result($res); - if ($row['_dbname'] != $db) - printf("[020] Connection should has been made to DB/Schema '%s', expecting '%s', [%d] %s\n", - $row['_dbname'], $db, mysqli_errno($link), mysqli_error($link)); - - mysqli_close($link); - mysqli_close($link2); - print "done!"; + if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST")) + printf("[002] Cannot get full processlist, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link)); + + $running_threads = array(); + while ($row = mysqli_fetch_assoc($res)) + $running_threads[$row['Id']] = $row; + mysqli_free_result($res); + + if (!isset($running_threads[$thread_id_timeout]) || + !isset($running_threads[$thread_id_control])) + printf("[003] Processlist is borked, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link)); + + if (!mysqli_query($link, "SET SESSION wait_timeout = 2")) + printf("[004] Cannot set wait_timeout, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'wait_timeout'")) + printf("[005] Cannot check if wait_timeout has been set, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + + if (!$row = mysqli_fetch_assoc($res)) + printf("[006] Cannot get wait_timeout, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); + + if ($row['Value'] != 2) + printf("[007] Failed setting the wait_timeout, test will not work, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + + // after 2+ seconds the server should kill the connection + sleep(3); + + if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST")) + printf("[008] Cannot get full processlist, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link)); + + $running_threads = array(); + while ($row = mysqli_fetch_assoc($res)) + $running_threads[$row['Id']] = $row; + mysqli_free_result($res); + + if (isset($running_threads[$thread_id_timeout])) + printf("[009] Server should have killed the timeout connection, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link)); + + if (true !== mysqli_ping($link)) + printf("[010] Reconnect should have happened"); + + if (!$res = mysqli_query($link, "SELECT DATABASE() as _dbname")) + printf("[011] Cannot get database name, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + + if (!$row = mysqli_fetch_assoc($res)) + printf("[012] Cannot get database name, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + + mysqli_free_result($res); + if ($row['_dbname'] != $db) + printf("[013] Connection should has been made to DB/Schema '%s', expecting '%s', [%d] %s\n", + $row['_dbname'], $db, mysqli_errno($link), mysqli_error($link)); + + // ... and now we try KILL + $thread_id_timeout = mysqli_thread_id($link); + + if (!mysqli_query($link2, sprintf('KILL %d', $thread_id_timeout))) + printf("[014] Cannot KILL timeout connection, [%d] %s\n", mysqli_errno($link2), mysqli_error($link2)); + // Give the server a second to really kill the other thread... + sleep(1); + + if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST")) + printf("[015] Cannot get full processlist, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link)); + + $running_threads = array(); + while ($row = mysqli_fetch_assoc($res)) + $running_threads[$row['Id']] = $row; + mysqli_free_result($res); + + if (isset($running_threads[$thread_id_timeout]) || + !isset($running_threads[$thread_id_control])) + printf("[016] Processlist is borked, [%d] %s\n", + mysqli_errno($link2), mysqli_error($link)); + + if (true !== ($tmp = mysqli_ping($link))) + printf("[017] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp); + + if (!$res = mysqli_query($link, "SELECT DATABASE() as _dbname")) + printf("[018] Cannot get database name, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + + if (!$row = mysqli_fetch_assoc($res)) + printf("[019] Cannot get database name, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + + mysqli_free_result($res); + if ($row['_dbname'] != $db) + printf("[020] Connection should has been made to DB/Schema '%s', expecting '%s', [%d] %s\n", + $row['_dbname'], $db, mysqli_errno($link), mysqli_error($link)); + + mysqli_close($link); + mysqli_close($link2); + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_release_savepoint.phpt b/ext/mysqli/tests/mysqli_release_savepoint.phpt index 44a2bebb35..a8b2cb1cf2 100644 --- a/ext/mysqli/tests/mysqli_release_savepoint.phpt +++ b/ext/mysqli/tests/mysqli_release_savepoint.phpt @@ -15,48 +15,48 @@ if (!have_innodb($link)) ?> --FILE-- <?php - require_once("connect.inc"); - /* {{{ proto bool mysqli_release_savepoint(object link, string name) */ - $tmp = NULL; - $link = NULL; + require_once("connect.inc"); + /* {{{ proto bool mysqli_release_savepoint(object link, string name) */ + $tmp = NULL; + $link = NULL; - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[003] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (false !== ($tmp = mysqli_release_savepoint($link, ''))) - printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_release_savepoint($link, ''))) + printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) - printf("[008] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) + printf("[008] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (true !== ($tmp = mysqli_autocommit($link, false))) - printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_autocommit($link, false))) + printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); - /* note that there is no savepoint my... */ - if (true !== ($tmp = mysqli_release_savepoint($link, 'my'))) - printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); + /* note that there is no savepoint my... */ + if (true !== ($tmp = mysqli_release_savepoint($link, 'my'))) + printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_commit($link); - if ($tmp !== true) - printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + $tmp = mysqli_commit($link); + if ($tmp !== true) + printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (true !== ($tmp = mysqli_savepoint($link, 'my'))) - printf("[013] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); + if (true !== ($tmp = mysqli_savepoint($link, 'my'))) + printf("[013] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); - $res = mysqli_query($link, "SELECT * FROM test"); - var_dump($res->fetch_assoc()); + $res = mysqli_query($link, "SELECT * FROM test"); + var_dump($res->fetch_assoc()); - if (true !== ($tmp = mysqli_release_savepoint($link, 'my'))) - printf("[014] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); + if (true !== ($tmp = mysqli_release_savepoint($link, 'my'))) + printf("[014] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_report.phpt b/ext/mysqli/tests/mysqli_report.phpt index e86c6ed6de..17baea0f66 100644 --- a/ext/mysqli/tests/mysqli_report.phpt +++ b/ext/mysqli/tests/mysqli_report.phpt @@ -8,269 +8,269 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - if (true !== ($tmp = mysqli_report(-1))) - printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ERROR))) - printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_STRICT))) - printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_INDEX))) - printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ALL))) - printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_OFF))) - printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - require('table.inc'); - - /* - Internal macro MYSQL_REPORT_ERROR - */ - mysqli_report(MYSQLI_REPORT_ERROR); - - mysqli_multi_query($link, "BAR; FOO;"); - mysqli_query($link, "FOO"); - mysqli_kill($link, -1); - - // mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it - mysqli_prepare($link, "FOO"); - mysqli_real_query($link, "FOO"); - if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name")) - printf("[009] select_db should have failed\n"); - // mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it - - - // Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would - // not have been set. If that would be the case, the test would be broken. - mysqli_report(MYSQLI_REPORT_OFF); - - mysqli_multi_query($link, "BAR; FOO;"); - mysqli_query($link, "FOO"); - mysqli_kill($link, -1); - mysqli_prepare($link, "FOO"); - mysqli_real_query($link, "FOO"); - mysqli_select_db($link, "Oh lord, let this be an unknown database name"); - - /* - Internal macro MYSQL_REPORT_STMT_ERROR - */ - - mysqli_report(MYSQLI_REPORT_ERROR); - - $stmt = mysqli_stmt_init($link); - mysqli_stmt_prepare($stmt, "FOO"); - - $stmt = mysqli_stmt_init($link); - mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?"); - $id = 1; - mysqli_kill($link, mysqli_thread_id($link)); - mysqli_stmt_bind_param($stmt, "i", $id); - mysqli_stmt_close($stmt); - mysqli_close($link); - - /* mysqli_stmt_execute() = mysql_stmt_execute cannot be tested from PHP */ - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[008] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - $stmt = mysqli_stmt_init($link); - mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?"); - $id = 1; - mysqli_stmt_bind_param($stmt, "i", $id); - // mysqli_kill($link, mysqli_thread_id($link)); - mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); - mysqli_close($link); - - /* mysqli_kill() "trick" does not work for any of the following because of an E_COMMANDS_OUT_OF_SYNC */ - /* mysqli_stmt_bind_result() = mysql_stmt_bind_result() cannot be tested from PHP */ - /* mysqli_stmt_fetch() = mysql_stmt_fetch() cannot be tested from PHP */ - /* mysqli_stmt_result_metadata() = mysql_stmt_result_metadata() cannot be tested from PHP */ - /* mysqli_stmt_store_result() = mysql_stmt_store_result() cannot be tested from PHP */ - - // Check - mysqli_report(MYSQLI_REPORT_OFF); - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[010] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - $stmt = mysqli_stmt_init($link); - mysqli_stmt_prepare($stmt, "FOO"); - - $stmt = mysqli_stmt_init($link); - mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?"); - $id = 1; - mysqli_kill($link, mysqli_thread_id($link)); - mysqli_stmt_bind_param($stmt, "i", $id); - mysqli_stmt_close($stmt); - mysqli_close($link); - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[011] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - $stmt = mysqli_stmt_init($link); - mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?"); - $id = 1; - mysqli_stmt_bind_param($stmt, "i", $id); - mysqli_kill($link, mysqli_thread_id($link)); - mysqli_stmt_execute($stmt); - mysqli_stmt_close($stmt); - mysqli_close($link); - - /* - MYSQLI_REPORT_STRICT - - MYSQLI_REPORT_STRICT ---> - php_mysqli_report_error() -> - MYSQLI_REPORT_MYSQL_ERROR, - MYSQLI_REPORT_STMT_ERROR -> - already tested - - php_mysqli_throw_sql_exception() -> - my_mysqli_real_connect() - my_mysqli_connect() - - can't be tested: mysqli_query() via mysql_use_result()/mysql_store_result() - */ - mysqli_report(MYSQLI_REPORT_OFF); - mysqli_report(MYSQLI_REPORT_STRICT); - - try { - - if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) - printf("[012] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", - $host, $user . 'unknown_really', $db, $port, $socket); - mysqli_close($link); - - } catch (mysqli_sql_exception $e) { - printf("[013] %s\n", $e->getMessage()); - } - - try { - if (!$link = mysqli_init()) - printf("[014] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - - if ($link = my_mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) - printf("[015] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", - $host, $user . 'unknown_really', $db, $port, $socket); - mysqli_close($link); - } catch (mysqli_sql_exception $e) { - printf("[016] %s\n", $e->getMessage()); - } - - /* - MYSQLI_REPORT_INDEX ---> - mysqli_query() - mysqli_stmt_execute() - mysqli_prepare() - mysqli_real_query() - mysqli_store_result() - mysqli_use_result() - - No test, because of to many prerequisites: - - Server needs to be started with and - --log-slow-queries --log-queries-not-using-indexes - - query must cause the warning on all MySQL versions - - TODO: - */ - $log_slow_queries = false; - $log_queries_not_using_indexes = false; - mysqli_report(MYSQLI_REPORT_OFF); - mysqli_report(MYSQLI_REPORT_INDEX); - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - - if (mysqli_get_server_version($link) <= 50600) { - // this might cause a warning - no index used - if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_slow_queries'")) - printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$row = mysqli_fetch_assoc($res)) - printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $log_slow_query = ('ON' == $row['Value']); - - if (mysqli_get_server_version($link) >= 50111) { - // this might cause a warning - no index used - if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_queries_not_using_indexes'")) - printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$row = mysqli_fetch_assoc($res)) - printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $log_queries_not_using_indexes = ('ON' == $row['Value']); - - if ($log_slow_queries && $log_queries_not_using_indexes) { - - for ($i = 100; $i < 20000; $i++) { - if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ($i, 'z')")) - printf("[022 - %d] [%d] %s\n", $i - 99, mysqli_errno($link), mysqli_error($link)); - } - - // this might cause a warning - no index used - if (!$res = @mysqli_query($link, "SELECT id, label FROM test WHERE id = 1323")) - printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - mysqli_free_result($res); - } - } - } + require_once("connect.inc"); + + if (true !== ($tmp = mysqli_report(-1))) + printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ERROR))) + printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_STRICT))) + printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_INDEX))) + printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ALL))) + printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_OFF))) + printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + require('table.inc'); + + /* + Internal macro MYSQL_REPORT_ERROR + */ + mysqli_report(MYSQLI_REPORT_ERROR); + + mysqli_multi_query($link, "BAR; FOO;"); + mysqli_query($link, "FOO"); + mysqli_kill($link, -1); + + // mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it + mysqli_prepare($link, "FOO"); + mysqli_real_query($link, "FOO"); + if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name")) + printf("[009] select_db should have failed\n"); + // mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it + + + // Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would + // not have been set. If that would be the case, the test would be broken. + mysqli_report(MYSQLI_REPORT_OFF); + + mysqli_multi_query($link, "BAR; FOO;"); + mysqli_query($link, "FOO"); + mysqli_kill($link, -1); + mysqli_prepare($link, "FOO"); + mysqli_real_query($link, "FOO"); + mysqli_select_db($link, "Oh lord, let this be an unknown database name"); + + /* + Internal macro MYSQL_REPORT_STMT_ERROR + */ + + mysqli_report(MYSQLI_REPORT_ERROR); + + $stmt = mysqli_stmt_init($link); + mysqli_stmt_prepare($stmt, "FOO"); + + $stmt = mysqli_stmt_init($link); + mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?"); + $id = 1; + mysqli_kill($link, mysqli_thread_id($link)); + mysqli_stmt_bind_param($stmt, "i", $id); + mysqli_stmt_close($stmt); + mysqli_close($link); + + /* mysqli_stmt_execute() = mysql_stmt_execute cannot be tested from PHP */ + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[008] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + $stmt = mysqli_stmt_init($link); + mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?"); + $id = 1; + mysqli_stmt_bind_param($stmt, "i", $id); + // mysqli_kill($link, mysqli_thread_id($link)); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + mysqli_close($link); + + /* mysqli_kill() "trick" does not work for any of the following because of an E_COMMANDS_OUT_OF_SYNC */ + /* mysqli_stmt_bind_result() = mysql_stmt_bind_result() cannot be tested from PHP */ + /* mysqli_stmt_fetch() = mysql_stmt_fetch() cannot be tested from PHP */ + /* mysqli_stmt_result_metadata() = mysql_stmt_result_metadata() cannot be tested from PHP */ + /* mysqli_stmt_store_result() = mysql_stmt_store_result() cannot be tested from PHP */ + + // Check + mysqli_report(MYSQLI_REPORT_OFF); + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[010] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + $stmt = mysqli_stmt_init($link); + mysqli_stmt_prepare($stmt, "FOO"); + + $stmt = mysqli_stmt_init($link); + mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?"); + $id = 1; + mysqli_kill($link, mysqli_thread_id($link)); + mysqli_stmt_bind_param($stmt, "i", $id); + mysqli_stmt_close($stmt); + mysqli_close($link); + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[011] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + $stmt = mysqli_stmt_init($link); + mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?"); + $id = 1; + mysqli_stmt_bind_param($stmt, "i", $id); + mysqli_kill($link, mysqli_thread_id($link)); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + mysqli_close($link); + + /* + MYSQLI_REPORT_STRICT + + MYSQLI_REPORT_STRICT ---> + php_mysqli_report_error() -> + MYSQLI_REPORT_MYSQL_ERROR, + MYSQLI_REPORT_STMT_ERROR -> + already tested + + php_mysqli_throw_sql_exception() -> + my_mysqli_real_connect() + my_mysqli_connect() + + can't be tested: mysqli_query() via mysql_use_result()/mysql_store_result() + */ + mysqli_report(MYSQLI_REPORT_OFF); + mysqli_report(MYSQLI_REPORT_STRICT); + + try { + + if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) + printf("[012] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", + $host, $user . 'unknown_really', $db, $port, $socket); + mysqli_close($link); + + } catch (mysqli_sql_exception $e) { + printf("[013] %s\n", $e->getMessage()); + } + + try { + if (!$link = mysqli_init()) + printf("[014] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + + if ($link = my_mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) + printf("[015] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", + $host, $user . 'unknown_really', $db, $port, $socket); + mysqli_close($link); + } catch (mysqli_sql_exception $e) { + printf("[016] %s\n", $e->getMessage()); + } + + /* + MYSQLI_REPORT_INDEX ---> + mysqli_query() + mysqli_stmt_execute() + mysqli_prepare() + mysqli_real_query() + mysqli_store_result() + mysqli_use_result() + + No test, because of to many prerequisites: + - Server needs to be started with and + --log-slow-queries --log-queries-not-using-indexes + - query must cause the warning on all MySQL versions + + TODO: + */ + $log_slow_queries = false; + $log_queries_not_using_indexes = false; + mysqli_report(MYSQLI_REPORT_OFF); + mysqli_report(MYSQLI_REPORT_INDEX); + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + + if (mysqli_get_server_version($link) <= 50600) { + // this might cause a warning - no index used + if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_slow_queries'")) + printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$row = mysqli_fetch_assoc($res)) + printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $log_slow_query = ('ON' == $row['Value']); + + if (mysqli_get_server_version($link) >= 50111) { + // this might cause a warning - no index used + if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_queries_not_using_indexes'")) + printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$row = mysqli_fetch_assoc($res)) + printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $log_queries_not_using_indexes = ('ON' == $row['Value']); + + if ($log_slow_queries && $log_queries_not_using_indexes) { + + for ($i = 100; $i < 20000; $i++) { + if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ($i, 'z')")) + printf("[022 - %d] [%d] %s\n", $i - 99, mysqli_errno($link), mysqli_error($link)); + } + + // this might cause a warning - no index used + if (!$res = @mysqli_query($link, "SELECT id, label FROM test WHERE id = 1323")) + printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + mysqli_free_result($res); + } + } + } - // Maybe we've provoked an index message, maybe not. - // All we can do is make a few dummy calls to ensure that all codes gets executed which - // checks the flag. Functions to check: mysqli_query() - done above, - // mysqli_stmt_execute(), mysqli_prepare(), mysqli_real_query(), mysqli_store_result() - // mysqli_use_result(), mysqli_thread_safe(), mysqli_thread_id() - mysqli_report(MYSQLI_REPORT_OFF); - mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[024] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + // Maybe we've provoked an index message, maybe not. + // All we can do is make a few dummy calls to ensure that all codes gets executed which + // checks the flag. Functions to check: mysqli_query() - done above, + // mysqli_stmt_execute(), mysqli_prepare(), mysqli_real_query(), mysqli_store_result() + // mysqli_use_result(), mysqli_thread_safe(), mysqli_thread_id() + mysqli_report(MYSQLI_REPORT_OFF); + mysqli_close($link); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[024] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (!$stmt = mysqli_stmt_init($link)) - printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test')) - printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test')) + printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_execute($stmt)) - printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); - if (!mysqli_real_query($link, 'SELECT label, id FROM test')) - printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_real_query($link, 'SELECT label, id FROM test')) + printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_use_result($link)) - printf("[029] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_use_result($link)) + printf("[029] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if (!mysqli_real_query($link, 'SELECT label, id FROM test')) - printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_real_query($link, 'SELECT label, id FROM test')) + printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_store_result($link)) - printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_store_result($link)) + printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if (!$stmt = mysqli_prepare($link, 'SELECT id * 3 FROM test')) - printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - else - mysqli_stmt_close($stmt); + if (!$stmt = mysqli_prepare($link, 'SELECT id * 3 FROM test')) + printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + else + mysqli_stmt_close($stmt); - if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')", MYSQLI_USE_RESULT) || - !mysqli_query($link, 'DELETE FROM test WHERE id > 50', MYSQLI_USE_RESULT)) - printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')", MYSQLI_USE_RESULT) || + !mysqli_query($link, 'DELETE FROM test WHERE id > 50', MYSQLI_USE_RESULT)) + printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_thread_id($link); + $tmp = mysqli_thread_id($link); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_report_new.phpt b/ext/mysqli/tests/mysqli_report_new.phpt index 0717aaf73b..5bfa260c9e 100644 --- a/ext/mysqli/tests/mysqli_report_new.phpt +++ b/ext/mysqli/tests/mysqli_report_new.phpt @@ -16,29 +16,29 @@ if (mysqli_get_server_version($link) < 50600) ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - require('table.inc'); + require('table.inc'); - /* - Internal macro MYSQL_REPORT_ERROR - */ - mysqli_report(MYSQLI_REPORT_ERROR); + /* + Internal macro MYSQL_REPORT_ERROR + */ + mysqli_report(MYSQLI_REPORT_ERROR); - mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db); + mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db); - mysqli_report(MYSQLI_REPORT_OFF); + mysqli_report(MYSQLI_REPORT_OFF); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db); + mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_report_wo_ps.phpt b/ext/mysqli/tests/mysqli_report_wo_ps.phpt index 535efb1fac..bf7d4500e5 100644 --- a/ext/mysqli/tests/mysqli_report_wo_ps.phpt +++ b/ext/mysqli/tests/mysqli_report_wo_ps.phpt @@ -15,86 +15,86 @@ if (mysqli_get_server_version($link) >= 50600) ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - if (true !== ($tmp = mysqli_report(-1))) - printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_report(-1))) + printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp); - if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ERROR))) - printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ERROR))) + printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_STRICT))) - printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_STRICT))) + printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_INDEX))) - printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_INDEX))) + printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ALL))) - printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ALL))) + printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_OFF))) - printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_OFF))) + printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); + require('table.inc'); - /* - Internal macro MYSQL_REPORT_ERROR - */ - mysqli_report(MYSQLI_REPORT_ERROR); + /* + Internal macro MYSQL_REPORT_ERROR + */ + mysqli_report(MYSQLI_REPORT_ERROR); - mysqli_multi_query($link, "BAR; FOO;"); - mysqli_query($link, "FOO"); - mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db); - mysqli_kill($link, -1); + mysqli_multi_query($link, "BAR; FOO;"); + mysqli_query($link, "FOO"); + mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db); + mysqli_kill($link, -1); - // mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it - mysqli_real_query($link, "FOO"); - if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name")) - printf("[009] select_db should have failed\n"); - // mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it + // mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it + mysqli_real_query($link, "FOO"); + if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name")) + printf("[009] select_db should have failed\n"); + // mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it - // Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would - // not have been set. If that would be the case, the test would be broken. - mysqli_report(MYSQLI_REPORT_OFF); + // Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would + // not have been set. If that would be the case, the test would be broken. + mysqli_report(MYSQLI_REPORT_OFF); - mysqli_multi_query($link, "BAR; FOO;"); - mysqli_query($link, "FOO"); - mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db); - mysqli_kill($link, -1); - mysqli_real_query($link, "FOO"); - mysqli_select_db($link, "Oh lord, let this be an unknown database name"); + mysqli_multi_query($link, "BAR; FOO;"); + mysqli_query($link, "FOO"); + mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db); + mysqli_kill($link, -1); + mysqli_real_query($link, "FOO"); + mysqli_select_db($link, "Oh lord, let this be an unknown database name"); - mysqli_report(MYSQLI_REPORT_OFF); - mysqli_report(MYSQLI_REPORT_STRICT); + mysqli_report(MYSQLI_REPORT_OFF); + mysqli_report(MYSQLI_REPORT_STRICT); - try { + try { - if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) - printf("[010] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", - $host, $user . 'unknown_really', $db, $port, $socket); - mysqli_close($link); + if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) + printf("[010] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", + $host, $user . 'unknown_really', $db, $port, $socket); + mysqli_close($link); - } catch (mysqli_sql_exception $e) { - printf("[011] %s\n", $e->getMessage()); - } + } catch (mysqli_sql_exception $e) { + printf("[011] %s\n", $e->getMessage()); + } - try { - if (!$link = mysqli_init()) - printf("[012] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + try { + if (!$link = mysqli_init()) + printf("[012] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if ($link = my_mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) - printf("[013] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", - $host, $user . 'unknown_really', $db, $port, $socket); - mysqli_close($link); - } catch (mysqli_sql_exception $e) { - printf("[014] %s\n", $e->getMessage()); - } + if ($link = my_mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) + printf("[013] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", + $host, $user . 'unknown_really', $db, $port, $socket); + mysqli_close($link); + } catch (mysqli_sql_exception $e) { + printf("[014] %s\n", $e->getMessage()); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_result_invalid_mode.phpt b/ext/mysqli/tests/mysqli_result_invalid_mode.phpt index 29ff65780c..9f902920db 100644 --- a/ext/mysqli/tests/mysqli_result_invalid_mode.phpt +++ b/ext/mysqli/tests/mysqli_result_invalid_mode.phpt @@ -8,18 +8,18 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('connect.inc'); - require('table.inc'); + require('connect.inc'); + require('table.inc'); - $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT); - do { - $mode = mt_rand(-1000, 1000); - } while (in_array($mode, $valid)); + $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT); + do { + $mode = mt_rand(-1000, 1000); + } while (in_array($mode, $valid)); - if (!is_object($res = new mysqli_result($link, $mode))) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!is_object($res = new mysqli_result($link, $mode))) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_result_references.phpt b/ext/mysqli/tests/mysqli_result_references.phpt index 738c2b2735..7084955380 100644 --- a/ext/mysqli/tests/mysqli_result_references.phpt +++ b/ext/mysqli/tests/mysqli_result_references.phpt @@ -8,74 +8,74 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - $references = array(); + $references = array(); - if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) || - !($res = mysqli_store_result($link))) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) || + !($res = mysqli_store_result($link))) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $idx = 0; - while ($row = mysqli_fetch_assoc($res)) { - /* mysqlnd: force separation - create copies */ - $references[$idx] = array( - 'id' => &$row['id'], - 'label' => $row['label'] . ''); - $references[$idx++]['id'] += 0; - } + $idx = 0; + while ($row = mysqli_fetch_assoc($res)) { + /* mysqlnd: force separation - create copies */ + $references[$idx] = array( + 'id' => &$row['id'], + 'label' => $row['label'] . ''); + $references[$idx++]['id'] += 0; + } - mysqli_close($link); + mysqli_close($link); - mysqli_data_seek($res, 0); - while ($row = mysqli_fetch_assoc($res)) { - /* mysqlnd: force separation - create copies */ - $references[$idx] = array( - 'id' => &$row['id'], - 'label' => $row['label'] . ''); - $references[$idx++]['id'] += 0; - } + mysqli_data_seek($res, 0); + while ($row = mysqli_fetch_assoc($res)) { + /* mysqlnd: force separation - create copies */ + $references[$idx] = array( + 'id' => &$row['id'], + 'label' => $row['label'] . ''); + $references[$idx++]['id'] += 0; + } - mysqli_free_result($res); + mysqli_free_result($res); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[002] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) || - !($res = mysqli_use_result($link))) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) || + !($res = mysqli_use_result($link))) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - while ($row = mysqli_fetch_assoc($res)) { - /* mysqlnd: force separation - create copies*/ - $references[$idx] = array( - 'id' => &$row['id'], - 'label' => $row['label'] . ''); - $references[$idx]['id2'] = &$references[$idx]['id']; - $references[$idx]['id'] += 1; - $references[$idx++]['id2'] += 1; - } + while ($row = mysqli_fetch_assoc($res)) { + /* mysqlnd: force separation - create copies*/ + $references[$idx] = array( + 'id' => &$row['id'], + 'label' => $row['label'] . ''); + $references[$idx]['id2'] = &$references[$idx]['id']; + $references[$idx]['id'] += 1; + $references[$idx++]['id2'] += 1; + } - $references[$idx++] = &$res; - mysqli_free_result($res); + $references[$idx++] = &$res; + mysqli_free_result($res); - debug_zval_dump($references); + debug_zval_dump($references); - if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) || - !($res = mysqli_use_result($link))) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) || + !($res = mysqli_use_result($link))) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = array(); - while ($row = mysqli_fetch_assoc($res)) { - $tmp[] = $row; - } - $tmp = unserialize(serialize($tmp)); - debug_zval_dump($tmp); - mysqli_free_result($res); + $tmp = array(); + while ($row = mysqli_fetch_assoc($res)) { + $tmp[] = $row; + } + $tmp = unserialize(serialize($tmp)); + debug_zval_dump($tmp); + mysqli_free_result($res); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt b/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt index 1a8f44b3f3..d33c89b4dc 100644 --- a/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt +++ b/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt @@ -12,45 +12,45 @@ if (!$IS_MYSQLND) require_once('skipifemb.inc'); ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - $references = array(); + $references = array(); - if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) || - !($res = mysqli_store_result($link))) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) || + !($res = mysqli_store_result($link))) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $idx = 0; - while ($row = mysqli_fetch_assoc($res)) { - /* will overwrite itself */ - $references[$idx]['row_ref'] = &$row; - $references[$idx]['row_copy'] = $row; - $references[$idx]['id_ref'] = &$row['id']; - $references[$idx++]['id_copy'] = $row['id']; - } + $idx = 0; + while ($row = mysqli_fetch_assoc($res)) { + /* will overwrite itself */ + $references[$idx]['row_ref'] = &$row; + $references[$idx]['row_copy'] = $row; + $references[$idx]['id_ref'] = &$row['id']; + $references[$idx++]['id_copy'] = $row['id']; + } - debug_zval_dump($references); - mysqli_free_result($res); + debug_zval_dump($references); + mysqli_free_result($res); - if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) || - !($res = mysqli_use_result($link))) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) || + !($res = mysqli_use_result($link))) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rows = array(); - for ($i = 0; $i < 2; $i++) { - $rows[$i] = mysqli_fetch_assoc($res); - $references[$idx]['row_ref'] = &$rows[$i]; - $references[$idx]['row_copy'] = $rows[$i]; - $references[$idx]['id_ref'] = &$rows[$i]['id']; - $references[$idx]['id_copy'] = $rows[$i]['id']; - /* enforce separation */ - $references[$idx]['id_copy_mod']= $rows[$i]['id'] + 0; - } - mysqli_free_result($res); + $rows = array(); + for ($i = 0; $i < 2; $i++) { + $rows[$i] = mysqli_fetch_assoc($res); + $references[$idx]['row_ref'] = &$rows[$i]; + $references[$idx]['row_copy'] = $rows[$i]; + $references[$idx]['id_ref'] = &$rows[$i]['id']; + $references[$idx]['id_copy'] = $rows[$i]['id']; + /* enforce separation */ + $references[$idx]['id_copy_mod']= $rows[$i]['id'] + 0; + } + mysqli_free_result($res); - debug_zval_dump($references); - print "done!"; + debug_zval_dump($references); + print "done!"; ?> --EXPECTF-- array(1) refcount(%d){ diff --git a/ext/mysqli/tests/mysqli_result_unclonable.phpt b/ext/mysqli/tests/mysqli_result_unclonable.phpt index 6eff412a1d..06f7d5899d 100644 --- a/ext/mysqli/tests/mysqli_result_unclonable.phpt +++ b/ext/mysqli/tests/mysqli_result_unclonable.phpt @@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!($res = mysqli_query($link, "SELECT 'good' AS morning"))) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!($res = mysqli_query($link, "SELECT 'good' AS morning"))) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $res_clone = clone $res; - print "done!"; + $res_clone = clone $res; + print "done!"; ?> --EXPECTF-- Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli_result in %s:%d diff --git a/ext/mysqli/tests/mysqli_rollback.phpt b/ext/mysqli/tests/mysqli_rollback.phpt index be5ac7870a..92ab3e28b5 100644 --- a/ext/mysqli/tests/mysqli_rollback.phpt +++ b/ext/mysqli/tests/mysqli_rollback.phpt @@ -15,39 +15,39 @@ mysqli_rollback() ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[003] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (true !== ($tmp = mysqli_autocommit($link, false))) - printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_autocommit($link, false))) + printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) - printf("[007] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) + printf("[007] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_rollback($link); - if ($tmp !== true) - printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + $tmp = mysqli_rollback($link); + if ($tmp !== true) + printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test')) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - if (0 != $tmp['num']) - printf("[12] Expecting 0 rows in table test, found %d rows\n", $tmp['num']); - mysqli_free_result($res); + if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test')) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + if (0 != $tmp['num']) + printf("[12] Expecting 0 rows in table test, found %d rows\n", $tmp['num']); + mysqli_free_result($res); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_close($link); + mysqli_close($link); try { mysqli_rollback($link); @@ -55,7 +55,7 @@ mysqli_rollback() echo $exception->getMessage() . "\n"; } - print "done!\n"; + print "done!\n"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_savepoint.phpt b/ext/mysqli/tests/mysqli_savepoint.phpt index 038d9c73c0..0da27b8caf 100644 --- a/ext/mysqli/tests/mysqli_savepoint.phpt +++ b/ext/mysqli/tests/mysqli_savepoint.phpt @@ -15,37 +15,37 @@ if (!have_innodb($link)) ?> --FILE-- <?php - require_once("connect.inc"); - /* {{{ proto bool mysqli_savepoint(object link, string name) */ + require_once("connect.inc"); + /* {{{ proto bool mysqli_savepoint(object link, string name) */ - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[003] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (false !== ($tmp = mysqli_savepoint($link, ''))) - printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_savepoint($link, ''))) + printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) - printf("[008] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) + printf("[008] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (true !== ($tmp = mysqli_autocommit($link, false))) - printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_autocommit($link, false))) + printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); - /* overrule autocommit */ - if (true !== ($tmp = mysqli_savepoint($link, 'my'))) - printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); + /* overrule autocommit */ + if (true !== ($tmp = mysqli_savepoint($link, 'my'))) + printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_rollback($link); - if ($tmp !== true) - printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + $tmp = mysqli_rollback($link); + if ($tmp !== true) + printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_select_db.phpt b/ext/mysqli/tests/mysqli_select_db.phpt index a3d165bd02..67716d0664 100644 --- a/ext/mysqli/tests/mysqli_select_db.phpt +++ b/ext/mysqli/tests/mysqli_select_db.phpt @@ -8,85 +8,85 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - require_once("table.inc"); + require_once("connect.inc"); + require_once("table.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[003] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - /* does not make too much sense, unless we have access to at least one more database than $db */ - if (!mysqli_select_db($link, $db)) - printf("[005] Cannot select DB %s, [%d] %s\n", $db, mysqli_errno($link), mysqli_error($link)); + /* does not make too much sense, unless we have access to at least one more database than $db */ + if (!mysqli_select_db($link, $db)) + printf("[005] Cannot select DB %s, [%d] %s\n", $db, mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if ($row['dbname'] !== (string)$db) - printf("[008] Expecting database '%s', found '%s'\n", $db, $row['dbname']); - mysqli_free_result($res); + if ($row['dbname'] !== (string)$db) + printf("[008] Expecting database '%s', found '%s'\n", $db, $row['dbname']); + mysqli_free_result($res); - if (mysqli_select_db($link, 'mysql')) { - // Yippie, a second database to play with - that's great because mysqli_select_db - // ($db) was done by mysqli__connect() already and the previous test - // was quite useless - if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname")) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (mysqli_select_db($link, 'mysql')) { + // Yippie, a second database to play with - that's great because mysqli_select_db + // ($db) was done by mysqli__connect() already and the previous test + // was quite useless + if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname")) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (strtolower($row['dbname']) !== 'mysql') - printf("[011] Expecting database 'mysql', found '%s'\n", $row['dbname']); - mysqli_free_result($res); - } + if (strtolower($row['dbname']) !== 'mysql') + printf("[011] Expecting database 'mysql', found '%s'\n", $row['dbname']); + mysqli_free_result($res); + } - if (!$link->select_db($db)) - printf("[012] Failed to set '%s' as current DB; [%d] %s\n", $link->errno, $link->error); + if (!$link->select_db($db)) + printf("[012] Failed to set '%s' as current DB; [%d] %s\n", $link->errno, $link->error); - if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname")) - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname")) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $current_db = $row['dbname']; + $current_db = $row['dbname']; - mysqli_report(MYSQLI_REPORT_OFF); - mysqli_select_db($link, 'I can not imagine that this database exists'); - mysqli_report(MYSQLI_REPORT_ERROR); + mysqli_report(MYSQLI_REPORT_OFF); + mysqli_select_db($link, 'I can not imagine that this database exists'); + mysqli_report(MYSQLI_REPORT_ERROR); - ob_start(); - mysqli_select_db($link, 'I can not imagine that this database exists'); - $output = ob_get_contents(); - ob_end_clean(); - if (!stristr($output, "1049") && !stristr($output, "1044") && !stristr($output, "1045")) { - /* Error: 1049 SQLSTATE: 42000 (ER_BAD_DB_ERROR) Message: Unknown database '%s' */ - /* Error: 1044 SQLSTATE: 42000 (ER_DBACCESS_DENIED_ERROR) Message: Access denied for user '%s'@'%s' to database '%s' */ - /* Error: 1045 SQLSTATE: 28000 (ER_ACCESS_DENIED_ERROR) Message: Access denied for user '%s'@'%s' (using password: %s) */ - echo $output; - } + ob_start(); + mysqli_select_db($link, 'I can not imagine that this database exists'); + $output = ob_get_contents(); + ob_end_clean(); + if (!stristr($output, "1049") && !stristr($output, "1044") && !stristr($output, "1045")) { + /* Error: 1049 SQLSTATE: 42000 (ER_BAD_DB_ERROR) Message: Unknown database '%s' */ + /* Error: 1044 SQLSTATE: 42000 (ER_DBACCESS_DENIED_ERROR) Message: Access denied for user '%s'@'%s' to database '%s' */ + /* Error: 1045 SQLSTATE: 28000 (ER_ACCESS_DENIED_ERROR) Message: Access denied for user '%s'@'%s' (using password: %s) */ + echo $output; + } - if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname")) - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname")) + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (strtolower($row['dbname']) != strtolower($current_db)) - printf("[017] Current DB should not change if set fails\n"); + if (strtolower($row['dbname']) != strtolower($current_db)) + printf("[017] Current DB should not change if set fails\n"); - if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) - printf("[018] [%d] %s\n"); + if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) + printf("[018] [%d] %s\n"); - $row = $res->fetch_assoc(); - $res->free(); + $row = $res->fetch_assoc(); + $res->free(); - mysqli_close($link); + mysqli_close($link); try { mysqli_select_db($link, $db); @@ -94,7 +94,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!\n"; + print "done!\n"; ?> --CLEAN-- <?php require_once("clean_table.inc"); ?> diff --git a/ext/mysqli/tests/mysqli_send_query.phpt b/ext/mysqli/tests/mysqli_send_query.phpt index 5cdb0a6b77..b8d5a1b801 100644 --- a/ext/mysqli/tests/mysqli_send_query.phpt +++ b/ext/mysqli/tests/mysqli_send_query.phpt @@ -14,38 +14,38 @@ if (!$TEST_EXPERIMENTAL) ?> --FILE-- <?php - /* NOTE: tests is a stub, but function is deprecated, as long as it does not crash when invoking it... */ - require_once("connect.inc"); + /* NOTE: tests is a stub, but function is deprecated, as long as it does not crash when invoking it... */ + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - if (NULL !== ($tmp = @mysqli_send_query())) - printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = @mysqli_send_query())) + printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - if (NULL !== ($tmp = @mysqli_send_query($link))) - printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = @mysqli_send_query($link))) + printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[003] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - $query = array(); - if (NULL !== ($tmp = @mysqli_send_query($link, $query))) - printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); + $query = array(); + if (NULL !== ($tmp = @mysqli_send_query($link, $query))) + printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!is_int($tmp = mysqli_send_query($link, 'SELECT 1'))) - printf("[005] Expecting integer/any value, got %s/%s\n", gettype($tmp), $tmp); + if (!is_int($tmp = mysqli_send_query($link, 'SELECT 1'))) + printf("[005] Expecting integer/any value, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); - try { - mysqli_send_query($link, 'SELECT 1'); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } - print "done!"; + try { + mysqli_send_query($link, 'SELECT 1'); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + print "done!"; ?> --EXPECTF-- mysqli object is already closed diff --git a/ext/mysqli/tests/mysqli_set_charset.phpt b/ext/mysqli/tests/mysqli_set_charset.phpt index 092e17b36c..43b8be3f00 100644 --- a/ext/mysqli/tests/mysqli_set_charset.phpt +++ b/ext/mysqli/tests/mysqli_set_charset.phpt @@ -46,63 +46,63 @@ if ((($res = mysqli_query($link, 'SHOW CHARACTER SET LIKE "latin1"', MYSQLI_STOR ?> --FILE-- <?php - require_once("connect.inc"); - - require('table.inc'); - - if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation')) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (!$character_set_connection = $tmp['charset']) - printf("[008] Cannot determine current character set and collation\n"); - - $new_charset = ('latin1' == $character_set_connection) ? 'latin2' : 'latin1'; - if (!$res = mysqli_query($link, sprintf('SHOW CHARACTER SET LIKE "%s"', $new_charset), MYSQLI_STORE_RESULT)) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (mysqli_num_rows($res) == 0) - printf("[010] Test will fail, because alternative test character set '%s' seems not supported\n", $new_charset); - - if (false !== ($ret = mysqli_set_charset($link, "this is not a valid character set"))) - printf("[011] Expecting boolean/false because of invalid character set, got %s/%s\n", gettype($ret), $ret); - - mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[012] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - if (true !== ($ret = mysqli_set_charset($link, $new_charset))) - printf("[013] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret); - - if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation')) - printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if ($new_charset !== $tmp['charset']) - printf("[015] Character set not changed? Expecting %s, got %s\n", $new_charset, $tmp['charset']); - - if (!$res = mysqli_query($link, "SHOW CHARACTER SET")) - printf("[016] Cannot get list of character sets\n"); - - while ($tmp = mysqli_fetch_assoc($res)) { - if ('ucs2' == $tmp['Charset'] || 'utf16' == $tmp['Charset'] || 'utf32' == $tmp['Charset'] || 'utf16le' == $tmp['Charset']) - continue; - - /* Uncomment to see where it hangs - var_dump($tmp); flush(); */ - if (!@mysqli_set_charset($link, $tmp['Charset'])) { - printf("[017] Cannot set character set to '%s', [%d] %s\n", $tmp['Charset'], - mysqli_errno($link), mysqli_error($link)); - continue; - } - - /* Uncomment to see where it hangs - var_dump($tmp); flush(); */ - if (!mysqli_query($link, sprintf("SET NAMES %s", mysqli_real_escape_string($link, $tmp['Charset'])))) - printf("[018] Cannot run SET NAMES %s, [%d] %s\n", $tmp['Charset'], mysqli_errno($link), mysqli_error($link)); - } - mysqli_free_result($res); + require_once("connect.inc"); + + require('table.inc'); + + if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation')) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if (!$character_set_connection = $tmp['charset']) + printf("[008] Cannot determine current character set and collation\n"); + + $new_charset = ('latin1' == $character_set_connection) ? 'latin2' : 'latin1'; + if (!$res = mysqli_query($link, sprintf('SHOW CHARACTER SET LIKE "%s"', $new_charset), MYSQLI_STORE_RESULT)) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (mysqli_num_rows($res) == 0) + printf("[010] Test will fail, because alternative test character set '%s' seems not supported\n", $new_charset); + + if (false !== ($ret = mysqli_set_charset($link, "this is not a valid character set"))) + printf("[011] Expecting boolean/false because of invalid character set, got %s/%s\n", gettype($ret), $ret); + + mysqli_close($link); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[012] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + if (true !== ($ret = mysqli_set_charset($link, $new_charset))) + printf("[013] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret); + + if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation')) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if ($new_charset !== $tmp['charset']) + printf("[015] Character set not changed? Expecting %s, got %s\n", $new_charset, $tmp['charset']); + + if (!$res = mysqli_query($link, "SHOW CHARACTER SET")) + printf("[016] Cannot get list of character sets\n"); + + while ($tmp = mysqli_fetch_assoc($res)) { + if ('ucs2' == $tmp['Charset'] || 'utf16' == $tmp['Charset'] || 'utf32' == $tmp['Charset'] || 'utf16le' == $tmp['Charset']) + continue; + + /* Uncomment to see where it hangs - var_dump($tmp); flush(); */ + if (!@mysqli_set_charset($link, $tmp['Charset'])) { + printf("[017] Cannot set character set to '%s', [%d] %s\n", $tmp['Charset'], + mysqli_errno($link), mysqli_error($link)); + continue; + } + + /* Uncomment to see where it hangs - var_dump($tmp); flush(); */ + if (!mysqli_query($link, sprintf("SET NAMES %s", mysqli_real_escape_string($link, $tmp['Charset'])))) + printf("[018] Cannot run SET NAMES %s, [%d] %s\n", $tmp['Charset'], mysqli_errno($link), mysqli_error($link)); + } + mysqli_free_result($res); - mysqli_close($link); + mysqli_close($link); try { mysqli_set_charset($link, $new_charset); @@ -110,7 +110,7 @@ if ((($res = mysqli_query($link, 'SHOW CHARACTER SET LIKE "latin1"', MYSQLI_STOR echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_set_opt.phpt b/ext/mysqli/tests/mysqli_set_opt.phpt index b368654e59..c0e55dd5d6 100644 --- a/ext/mysqli/tests/mysqli_set_opt.phpt +++ b/ext/mysqli/tests/mysqli_set_opt.phpt @@ -8,33 +8,33 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $link = mysqli_init(); + $link = mysqli_init(); - // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n"; - var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf')); - var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf')); - var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10)); - var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1)); - var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0')); - var_dump(my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)); - var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf')); - var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf')); - var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10)); - var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1)); - var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0')); - var_dump(mysqli_set_opt($link, MYSQLI_CLIENT_SSL, 'not an mysqli_option')); + // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n"; + var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf')); + var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf')); + var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10)); + var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1)); + var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0')); + var_dump(my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)); + var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf')); + var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf')); + var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10)); + var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1)); + var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0')); + var_dump(mysqli_set_opt($link, MYSQLI_CLIENT_SSL, 'not an mysqli_option')); - mysqli_close($link); + mysqli_close($link); - try { + try { mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1'); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --EXPECT-- bool(true) diff --git a/ext/mysqli/tests/mysqli_sqlstate.phpt b/ext/mysqli/tests/mysqli_sqlstate.phpt index 1d63e71da2..cf60977763 100644 --- a/ext/mysqli/tests/mysqli_sqlstate.phpt +++ b/ext/mysqli/tests/mysqli_sqlstate.phpt @@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - var_dump(mysqli_sqlstate($link)); - mysqli_query($link, "SELECT unknown_column FROM test"); - var_dump(mysqli_sqlstate($link)); - mysqli_free_result(mysqli_query($link, "SELECT id FROM test")); - var_dump(mysqli_sqlstate($link)); + var_dump(mysqli_sqlstate($link)); + mysqli_query($link, "SELECT unknown_column FROM test"); + var_dump(mysqli_sqlstate($link)); + mysqli_free_result(mysqli_query($link, "SELECT id FROM test")); + var_dump(mysqli_sqlstate($link)); - mysqli_close($link); + mysqli_close($link); try { mysqli_sqlstate($link); @@ -26,7 +26,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_ssl_set.phpt b/ext/mysqli/tests/mysqli_ssl_set.phpt index 4f28350ef5..7f079f21ea 100644 --- a/ext/mysqli/tests/mysqli_ssl_set.phpt +++ b/ext/mysqli/tests/mysqli_ssl_set.phpt @@ -10,31 +10,31 @@ if (!function_exists('mysqli_ssl_set')) ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - /* - This function always returns TRUE value. + /* + This function always returns TRUE value. - $link = mysqli_init(); - if (NULL !== ($tmp = @mysqli_ssl_set( - $link, - 'The path name to the key file.', - 'The path name to the certificate file.', - 'The path name to the certificate authority file.', - 'The pathname to a directory that contains trusted SSL CA certificates in PEM format.', - 'A list of allowable ciphers to use for SSL encryption.'))) - printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + $link = mysqli_init(); + if (NULL !== ($tmp = @mysqli_ssl_set( + $link, + 'The path name to the key file.', + 'The path name to the certificate file.', + 'The path name to the certificate authority file.', + 'The pathname to a directory that contains trusted SSL CA certificates in PEM format.', + 'A list of allowable ciphers to use for SSL encryption.'))) + printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - If SSL setup is incorrect my_mysqli_real_connect() - will return an error when you attempt to connect. + If SSL setup is incorrect my_mysqli_real_connect() + will return an error when you attempt to connect. - ... and the above SSL setup should be always incorrect. + ... and the above SSL setup should be always incorrect. - if (false !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))) - printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - */ - print "done!\n"; + if (false !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))) + printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + */ + print "done!\n"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_stat.phpt b/ext/mysqli/tests/mysqli_stat.phpt index 6369a366b3..dd0b3d24c9 100644 --- a/ext/mysqli/tests/mysqli_stat.phpt +++ b/ext/mysqli/tests/mysqli_stat.phpt @@ -8,15 +8,15 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if ((!is_string($tmp = mysqli_stat($link))) || ('' === $tmp)) - printf("[004] Expecting non empty string, got %s/'%s', [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysql_error($link)); + if ((!is_string($tmp = mysqli_stat($link))) || ('' === $tmp)) + printf("[004] Expecting non empty string, got %s/'%s', [%d] %s\n", + gettype($tmp), $tmp, mysqli_errno($link), mysql_error($link)); - mysqli_close($link); + mysqli_close($link); try { mysqli_stat($link); @@ -24,7 +24,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --EXPECT-- mysqli object is already closed diff --git a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt index 2ba36389fd..505acc68f1 100644 --- a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt +++ b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt @@ -8,222 +8,222 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - } - $stmt = mysqli_stmt_init($link); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, 'DROP TABLE IF EXISTS test') || - !mysqli_stmt_execute($stmt)) { - printf("[003] Failed to drop old test table: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } + if (!mysqli_stmt_prepare($stmt, 'DROP TABLE IF EXISTS test') || + !mysqli_stmt_execute($stmt)) { + printf("[003] Failed to drop old test table: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } - if (!mysqli_stmt_prepare($stmt, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine) || - !mysqli_stmt_execute($stmt)) { - printf("[004] Failed to create test table: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } + if (!mysqli_stmt_prepare($stmt, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine) || + !mysqli_stmt_execute($stmt)) { + printf("[004] Failed to create test table: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } - if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[005] Expecting int/0, got %s/'%s'\n", gettype($tmp), $tmp); + if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[005] Expecting int/0, got %s/'%s'\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1, 'a')") || - !mysqli_stmt_execute($stmt)) - printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1, 'a')") || + !mysqli_stmt_execute($stmt)) + printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") || - !mysqli_stmt_execute($stmt)) - printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") || + !mysqli_stmt_execute($stmt)) + printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[008] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[008] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") || - !mysqli_stmt_execute($stmt)) - // NOTE: the error message varies with the MySQL Server version, dump only the error code! - printf("[009] [%d] (error message varies with the MySQL Server version, check the error code)\n", mysqli_stmt_errno($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") || + !mysqli_stmt_execute($stmt)) + // NOTE: the error message varies with the MySQL Server version, dump only the error code! + printf("[009] [%d] (error message varies with the MySQL Server version, check the error code)\n", mysqli_stmt_errno($stmt)); - /* an error occurred: affected rows should return -1 */ - if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[010] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + /* an error occurred: affected rows should return -1 */ + if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[010] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4") || - !mysqli_stmt_execute($stmt)) - printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4") || + !mysqli_stmt_execute($stmt)) + printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[012] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); + if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[012] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')") || - !mysqli_stmt_execute($stmt)) - printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')") || + !mysqli_stmt_execute($stmt)) + printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[014] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); + if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[014] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "INSERT IGNORE INTO test(id, label) VALUES (1, 'a')") || - !mysqli_stmt_execute($stmt)) - printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT IGNORE INTO test(id, label) VALUES (1, 'a')") || + !mysqli_stmt_execute($stmt)) + printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[016] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[016] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - if (!($res = mysqli_query($link, "SELECT count(id) AS num FROM test")) || - !($tmp = mysqli_fetch_assoc($res))) - printf("[017] [%d] %s\n", mysqli_error($link), mysqli_error($link)); - $num = (int)$tmp['num']; - mysqli_free_result($res); + if (!($res = mysqli_query($link, "SELECT count(id) AS num FROM test")) || + !($tmp = mysqli_fetch_assoc($res))) + printf("[017] [%d] %s\n", mysqli_error($link), mysqli_error($link)); + $num = (int)$tmp['num']; + mysqli_free_result($res); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) SELECT id + 10, label FROM test") || - !mysqli_stmt_execute($stmt)) - printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) SELECT id + 10, label FROM test") || + !mysqli_stmt_execute($stmt)) + printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if ($num !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[019] Expecting int/%d, got %s/%s\n", $num, gettype($tmp), $tmp); + if ($num !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[019] Expecting int/%d, got %s/%s\n", $num, gettype($tmp), $tmp); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "REPLACE INTO test(id, label) values (4, 'd')") || - !mysqli_stmt_execute($stmt)) - printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "REPLACE INTO test(id, label) values (4, 'd')") || + !mysqli_stmt_execute($stmt)) + printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[021] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); + if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[021] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "REPLACE INTO test(id, label) values (5, 'e')") || - !mysqli_stmt_execute($stmt)) - printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "REPLACE INTO test(id, label) values (5, 'e')") || + !mysqli_stmt_execute($stmt)) + printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[023] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[023] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 2") || - !mysqli_stmt_execute($stmt)) - printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 2") || + !mysqli_stmt_execute($stmt)) + printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 2") || - !mysqli_stmt_execute($stmt)) - printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 2") || + !mysqli_stmt_execute($stmt)) + printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[027] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[027] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 100") || - !mysqli_stmt_execute($stmt)) - printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 100") || + !mysqli_stmt_execute($stmt)) + printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[029] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[029] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test WHERE id = 100') || - !mysqli_stmt_execute($stmt)) - printf("[030] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test WHERE id = 100') || + !mysqli_stmt_execute($stmt)) + printf("[030] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - /* use it like num_rows */ - /* PS are unbuffered, num_rows cannot determine the row count before all rows have been fetched and/or buffered */ - if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[031] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp); + /* use it like num_rows */ + /* PS are unbuffered, num_rows cannot determine the row count before all rows have been fetched and/or buffered */ + if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[031] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp); - if (0 !== ($tmp = mysqli_stmt_num_rows($stmt))) - printf("[032] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = mysqli_stmt_num_rows($stmt))) + printf("[032] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_store_result($stmt)) - printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_store_result($stmt)) + printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[034] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[034] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (1 !== ($tmp = mysqli_stmt_num_rows($stmt))) - printf("[035] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = mysqli_stmt_num_rows($stmt))) + printf("[035] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_free_result($stmt); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test WHERE 1 = 2') || - !mysqli_stmt_execute($stmt)) - printf("[036] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test WHERE 1 = 2') || + !mysqli_stmt_execute($stmt)) + printf("[036] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - /* use it like num_rows */ - if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[037] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp); + /* use it like num_rows */ + if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[037] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp); - if (true !== ($tmp = mysqli_stmt_store_result($stmt))) - printf("[038] Expecting boolean/true, got %s\%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_stmt_store_result($stmt))) + printf("[038] Expecting boolean/true, got %s\%s\n", gettype($tmp), $tmp); - if (0 !== ($tmp = mysqli_stmt_num_rows($stmt))) - printf("[039] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = mysqli_stmt_num_rows($stmt))) + printf("[039] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[040] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[040] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - /* try to use stmt_affected_rows like stmt_num_rows */ - /* stmt_affected_rows is not really meant for SELECT! */ - if (mysqli_stmt_prepare($stmt, 'SELECT unknown_column FROM this_table_does_not_exist') || - mysqli_stmt_execute($stmt)) - printf("[041] The invalid SELECT statement is issued on purpose\n"); + /* try to use stmt_affected_rows like stmt_num_rows */ + /* stmt_affected_rows is not really meant for SELECT! */ + if (mysqli_stmt_prepare($stmt, 'SELECT unknown_column FROM this_table_does_not_exist') || + mysqli_stmt_execute($stmt)) + printf("[041] The invalid SELECT statement is issued on purpose\n"); - if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[042] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp); + if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[042] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp); - if ($IS_MYSQLND) { - if (false !== ($tmp = mysqli_stmt_store_result($stmt))) - printf("[043] Expecting boolean/false, got %s\%s\n", gettype($tmp), $tmp); - } else { - if (true !== ($tmp = mysqli_stmt_store_result($stmt))) - printf("[043] Libmysql does not care if the previous statement was bogus, expecting boolean/true, got %s\%s\n", gettype($tmp), $tmp); - } + if ($IS_MYSQLND) { + if (false !== ($tmp = mysqli_stmt_store_result($stmt))) + printf("[043] Expecting boolean/false, got %s\%s\n", gettype($tmp), $tmp); + } else { + if (true !== ($tmp = mysqli_stmt_store_result($stmt))) + printf("[043] Libmysql does not care if the previous statement was bogus, expecting boolean/true, got %s\%s\n", gettype($tmp), $tmp); + } - if (0 !== ($tmp = mysqli_stmt_num_rows($stmt))) - printf("[044] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = mysqli_stmt_num_rows($stmt))) + printf("[044] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[045] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp); + if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) + printf("[045] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test") || - !mysqli_stmt_execute($stmt)) - printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test") || + !mysqli_stmt_execute($stmt)) + printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); try { mysqli_stmt_affected_rows($stmt); @@ -231,9 +231,9 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt index 60920c2460..0844a6c8ac 100644 --- a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt +++ b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt @@ -8,23 +8,23 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - $valid_attr = array("max_length" => MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH); - if (mysqli_get_client_version() > 50003) - $valid_attr["cursor_type"] = MYSQLI_STMT_ATTR_CURSOR_TYPE; + $valid_attr = array("max_length" => MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH); + if (mysqli_get_client_version() > 50003) + $valid_attr["cursor_type"] = MYSQLI_STMT_ATTR_CURSOR_TYPE; - if ($IS_MYSQLND && mysqli_get_client_version() > 50007) - $valid_attr["prefetch_rows"] = MYSQLI_STMT_ATTR_PREFETCH_ROWS; + if ($IS_MYSQLND && mysqli_get_client_version() > 50007) + $valid_attr["prefetch_rows"] = MYSQLI_STMT_ATTR_PREFETCH_ROWS; - do { - $invalid_attr = mt_rand(0, 10000); - } while (in_array($invalid_attr, $valid_attr)); + do { + $invalid_attr = mt_rand(0, 10000); + } while (in_array($invalid_attr, $valid_attr)); - $stmt = mysqli_stmt_init($link); - mysqli_stmt_prepare($stmt, 'SELECT * FROM test'); + $stmt = mysqli_stmt_init($link); + mysqli_stmt_prepare($stmt, 'SELECT * FROM test'); try { mysqli_stmt_attr_get($stmt, $invalid_attr); @@ -32,25 +32,25 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - foreach ($valid_attr as $k => $attr) { - if (false === ($tmp = mysqli_stmt_attr_get($stmt, $attr))) { - printf("[006] Expecting any type, but not boolean/false, got %s/%s for attribute %s/%s\n", - gettype($tmp), $tmp, $k, $attr); - } - } + foreach ($valid_attr as $k => $attr) { + if (false === ($tmp = mysqli_stmt_attr_get($stmt, $attr))) { + printf("[006] Expecting any type, but not boolean/false, got %s/%s for attribute %s/%s\n", + gettype($tmp), $tmp, $k, $attr); + } + } - $stmt->close(); + $stmt->close(); - foreach ($valid_attr as $k => $attr) { + foreach ($valid_attr as $k => $attr) { try { mysqli_stmt_attr_get($stmt, $attr); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - } + } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt b/ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt index b48df9d410..2781810d9b 100644 --- a/ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt +++ b/ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt @@ -9,17 +9,17 @@ die("SKIP: prefetch isn't supported at the moment"); ?> --FILE-- <?php - require('table.inc'); + require('table.inc'); - $stmt = mysqli_stmt_init($link); - mysqli_stmt_prepare($stmt, 'SELECT * FROM test'); - if (1 !== ($tmp = mysqli_stmt_attr_get($stmt, MYSQLI_STMT_ATTR_PREFETCH_ROWS))) { - printf("[001] Expecting int/1, got %s/%s for attribute %s/%s\n", - gettype($tmp), $tmp, $k, $attr); - } - $stmt->close(); - mysqli_close($link); - print "done!"; + $stmt = mysqli_stmt_init($link); + mysqli_stmt_prepare($stmt, 'SELECT * FROM test'); + if (1 !== ($tmp = mysqli_stmt_attr_get($stmt, MYSQLI_STMT_ATTR_PREFETCH_ROWS))) { + printf("[001] Expecting int/1, got %s/%s for attribute %s/%s\n", + gettype($tmp), $tmp, $k, $attr); + } + $stmt->close(); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt index d87b28e460..4fad53cba2 100644 --- a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt +++ b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt @@ -10,252 +10,252 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - require('table.inc'); - - $valid_attr = array(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH); - if ((mysqli_get_client_version() > 50003) || $IS_MYSQLND) { - $valid_attr[] = MYSQLI_STMT_ATTR_CURSOR_TYPE; - $valid_attr[] = MYSQLI_CURSOR_TYPE_NO_CURSOR; - $valid_attr[] = MYSQLI_CURSOR_TYPE_READ_ONLY; - $valid_attr[] = MYSQLI_CURSOR_TYPE_FOR_UPDATE; - $valid_attr[] = MYSQLI_CURSOR_TYPE_SCROLLABLE; - } + require('table.inc'); + + $valid_attr = array(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH); + if ((mysqli_get_client_version() > 50003) || $IS_MYSQLND) { + $valid_attr[] = MYSQLI_STMT_ATTR_CURSOR_TYPE; + $valid_attr[] = MYSQLI_CURSOR_TYPE_NO_CURSOR; + $valid_attr[] = MYSQLI_CURSOR_TYPE_READ_ONLY; + $valid_attr[] = MYSQLI_CURSOR_TYPE_FOR_UPDATE; + $valid_attr[] = MYSQLI_CURSOR_TYPE_SCROLLABLE; + } - if ((mysqli_get_client_version() > 50007) || $IS_MYSQLND) - $valid_attr[] = MYSQLI_STMT_ATTR_PREFETCH_ROWS; + if ((mysqli_get_client_version() > 50007) || $IS_MYSQLND) + $valid_attr[] = MYSQLI_STMT_ATTR_PREFETCH_ROWS; - $stmt = mysqli_stmt_init($link); + $stmt = mysqli_stmt_init($link); try { mysqli_stmt_attr_set($stmt, 0, 0); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - $stmt->prepare("SELECT * FROM test"); - - mt_srand(microtime(true)); - - for ($i = -100; $i < 1000; $i++) { - if (in_array($i, $valid_attr)) - continue; - $invalid_attr = $i; - if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { - printf("[006a] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp); - } - } - - for ($i = 0; $i < 2; $i++) { - do { - $invalid_attr = mt_rand(-1 * (min(4294967296, PHP_INT_MAX) + 1), min(4294967296, PHP_INT_MAX)); - } while (in_array($invalid_attr, $valid_attr)); - if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { - printf("[006b] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp); - } - } - $stmt->close(); - - // - // MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH - // - - - // expecting max_length not to be set and be 0 in all cases - $stmt = mysqli_stmt_init($link); - $stmt->prepare("SELECT label FROM test"); - $stmt->execute(); - $stmt->store_result(); - $res = $stmt->result_metadata(); - $fields = $res->fetch_fields(); - $max_lengths = array(); - foreach ($fields as $k => $meta) { - $max_lengths[$meta->name] = $meta->max_length; - if ($meta->max_length !== 0) - printf("[007] max_length should be not set (= 0), got %s for field %s\n", $meta->max_length, $meta->name); - } - $res->close(); - $stmt->close(); - - // expecting max_length to _be_ set - $stmt = mysqli_stmt_init($link); - $stmt->prepare("SELECT label FROM test"); - $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 1); - $res = $stmt->attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH); - if ($res !== 1) - printf("[007.1] max_length should be 1, got %s\n", $res); - $stmt->execute(); - $stmt->store_result(); - $res = $stmt->result_metadata(); - $fields = $res->fetch_fields(); - $max_lengths = array(); - foreach ($fields as $k => $meta) { - $max_lengths[$meta->name] = $meta->max_length; - if ($meta->max_length === 0) - printf("[008] max_length should be set (!= 0), got %s for field %s\n", $meta->max_length, $meta->name); - } - $res->close(); - $stmt->close(); - - // expecting max_length not to be set - $stmt = mysqli_stmt_init($link); - $stmt->prepare("SELECT label FROM test"); - $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 0); - $res = $stmt->attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH); - if ($res !== 0) - printf("[008.1] max_length should be 0, got %s\n", $res); - $stmt->execute(); - $stmt->store_result(); - $res = $stmt->result_metadata(); - $fields = $res->fetch_fields(); - $max_lengths = array(); - foreach ($fields as $k => $meta) { - $max_lengths[$meta->name] = $meta->max_length; - if ($meta->max_length !== 0) - printf("[009] max_length should not be set (= 0), got %s for field %s\n", $meta->max_length, $meta->name); - } - $res->close(); - $stmt->close(); - - // - // Cursors - // - - if (mysqli_get_client_version() > 50003) { - - $cursor_types = array( - MYSQLI_CURSOR_TYPE_NO_CURSOR, - MYSQLI_CURSOR_TYPE_READ_ONLY, - MYSQLI_CURSOR_TYPE_FOR_UPDATE, - MYSQLI_CURSOR_TYPE_SCROLLABLE - ); - do { - $invalid_cursor_type = mt_rand(-1000, 1000); - } while (in_array($invalid_cursor_type, $cursor_types)); - - $stmt = mysqli_stmt_init($link); - $stmt->prepare("SELECT id, label FROM test"); - - if (false !== ($tmp = @$stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, $invalid_cursor_type))) - printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_FOR_UPDATE))) - printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_SCROLLABLE))) - printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_NO_CURSOR))) - printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY))) - printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - $stmt->close(); - - $stmt = mysqli_stmt_init($link); - $stmt->prepare("SELECT id, label FROM test"); - $stmt->execute(); - $id = $label = NULL; - $stmt->bind_result($id, $label); - $results = array(); - while ($stmt->fetch()) - $results[$id] = $label; - $stmt->close(); - if (empty($results)) - printf("[015] Results should not be empty, subsequent tests will probably fail!\n"); - - $stmt = mysqli_stmt_init($link); - $stmt->prepare("SELECT id, label FROM test"); - if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_NO_CURSOR))) - printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - $stmt->execute(); - $id = $label = NULL; - $stmt->bind_result($id, $label); - $results2 = array(); - while ($stmt->fetch()) - $results2[$id] = $label; - $stmt->close(); - if ($results != $results2) { - printf("[017] Results should not differ. Dumping both result sets.\n"); - var_dump($results); - var_dump($results2); - } - - $stmt = mysqli_stmt_init($link); - $stmt->prepare("SELECT id, label FROM test"); - if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY))) - printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - $stmt->execute(); - $id = $label = NULL; - $stmt->bind_result($id, $label); - $results2 = array(); - while ($stmt->fetch()) - $results2[$id] = $label; - $stmt->close(); - if ($results != $results2) { - printf("[019] Results should not differ. Dumping both result sets.\n"); - var_dump($results); - var_dump($results2); - } - - } - - - // - // MYSQLI_STMT_ATTR_PREFETCH_ROWS - // - - if (mysqli_get_client_version() > 50007) { - - $stmt = mysqli_stmt_init($link); - $stmt->prepare("SELECT id, label FROM test"); - if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 1))) - printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - $stmt->execute(); - $id = $label = NULL; - $stmt->bind_result($id, $label); - $results = array(); - while ($stmt->fetch()) - $results[$id] = $label; - $stmt->close(); - if (empty($results)) - printf("[021] Results should not be empty, subsequent tests will probably fail!\n"); - - /* prefetch is not supported - $stmt = mysqli_stmt_init($link); - $stmt->prepare("SELECT label FROM test"); - if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, -1))) - printf("[022] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - $stmt->close(); - - $stmt = mysqli_stmt_init($link); - $stmt->prepare("SELECT label FROM test"); - if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, PHP_INT_MAX))) - printf("[023] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - $stmt->close(); - - $stmt = mysqli_stmt_init($link); - $stmt->prepare("SELECT id, label FROM test"); - if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 2))) - printf("[024] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - $stmt->execute(); - $id = $label = NULL; - $stmt->bind_result($id, $label); - $results2 = array(); - while ($stmt->fetch()) - $results2[$id] = $label; - $stmt->close(); - if ($results != $results2) { - printf("[025] Results should not differ. Dumping both result sets.\n"); - var_dump($results); - var_dump($results2); - } - */ - - } - - mysqli_close($link); - print "done!"; + $stmt->prepare("SELECT * FROM test"); + + mt_srand(microtime(true)); + + for ($i = -100; $i < 1000; $i++) { + if (in_array($i, $valid_attr)) + continue; + $invalid_attr = $i; + if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { + printf("[006a] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp); + } + } + + for ($i = 0; $i < 2; $i++) { + do { + $invalid_attr = mt_rand(-1 * (min(4294967296, PHP_INT_MAX) + 1), min(4294967296, PHP_INT_MAX)); + } while (in_array($invalid_attr, $valid_attr)); + if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { + printf("[006b] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp); + } + } + $stmt->close(); + + // + // MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH + // + + + // expecting max_length not to be set and be 0 in all cases + $stmt = mysqli_stmt_init($link); + $stmt->prepare("SELECT label FROM test"); + $stmt->execute(); + $stmt->store_result(); + $res = $stmt->result_metadata(); + $fields = $res->fetch_fields(); + $max_lengths = array(); + foreach ($fields as $k => $meta) { + $max_lengths[$meta->name] = $meta->max_length; + if ($meta->max_length !== 0) + printf("[007] max_length should be not set (= 0), got %s for field %s\n", $meta->max_length, $meta->name); + } + $res->close(); + $stmt->close(); + + // expecting max_length to _be_ set + $stmt = mysqli_stmt_init($link); + $stmt->prepare("SELECT label FROM test"); + $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 1); + $res = $stmt->attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH); + if ($res !== 1) + printf("[007.1] max_length should be 1, got %s\n", $res); + $stmt->execute(); + $stmt->store_result(); + $res = $stmt->result_metadata(); + $fields = $res->fetch_fields(); + $max_lengths = array(); + foreach ($fields as $k => $meta) { + $max_lengths[$meta->name] = $meta->max_length; + if ($meta->max_length === 0) + printf("[008] max_length should be set (!= 0), got %s for field %s\n", $meta->max_length, $meta->name); + } + $res->close(); + $stmt->close(); + + // expecting max_length not to be set + $stmt = mysqli_stmt_init($link); + $stmt->prepare("SELECT label FROM test"); + $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 0); + $res = $stmt->attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH); + if ($res !== 0) + printf("[008.1] max_length should be 0, got %s\n", $res); + $stmt->execute(); + $stmt->store_result(); + $res = $stmt->result_metadata(); + $fields = $res->fetch_fields(); + $max_lengths = array(); + foreach ($fields as $k => $meta) { + $max_lengths[$meta->name] = $meta->max_length; + if ($meta->max_length !== 0) + printf("[009] max_length should not be set (= 0), got %s for field %s\n", $meta->max_length, $meta->name); + } + $res->close(); + $stmt->close(); + + // + // Cursors + // + + if (mysqli_get_client_version() > 50003) { + + $cursor_types = array( + MYSQLI_CURSOR_TYPE_NO_CURSOR, + MYSQLI_CURSOR_TYPE_READ_ONLY, + MYSQLI_CURSOR_TYPE_FOR_UPDATE, + MYSQLI_CURSOR_TYPE_SCROLLABLE + ); + do { + $invalid_cursor_type = mt_rand(-1000, 1000); + } while (in_array($invalid_cursor_type, $cursor_types)); + + $stmt = mysqli_stmt_init($link); + $stmt->prepare("SELECT id, label FROM test"); + + if (false !== ($tmp = @$stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, $invalid_cursor_type))) + printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_FOR_UPDATE))) + printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_SCROLLABLE))) + printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_NO_CURSOR))) + printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY))) + printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + $stmt->close(); + + $stmt = mysqli_stmt_init($link); + $stmt->prepare("SELECT id, label FROM test"); + $stmt->execute(); + $id = $label = NULL; + $stmt->bind_result($id, $label); + $results = array(); + while ($stmt->fetch()) + $results[$id] = $label; + $stmt->close(); + if (empty($results)) + printf("[015] Results should not be empty, subsequent tests will probably fail!\n"); + + $stmt = mysqli_stmt_init($link); + $stmt->prepare("SELECT id, label FROM test"); + if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_NO_CURSOR))) + printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + $stmt->execute(); + $id = $label = NULL; + $stmt->bind_result($id, $label); + $results2 = array(); + while ($stmt->fetch()) + $results2[$id] = $label; + $stmt->close(); + if ($results != $results2) { + printf("[017] Results should not differ. Dumping both result sets.\n"); + var_dump($results); + var_dump($results2); + } + + $stmt = mysqli_stmt_init($link); + $stmt->prepare("SELECT id, label FROM test"); + if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY))) + printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + $stmt->execute(); + $id = $label = NULL; + $stmt->bind_result($id, $label); + $results2 = array(); + while ($stmt->fetch()) + $results2[$id] = $label; + $stmt->close(); + if ($results != $results2) { + printf("[019] Results should not differ. Dumping both result sets.\n"); + var_dump($results); + var_dump($results2); + } + + } + + + // + // MYSQLI_STMT_ATTR_PREFETCH_ROWS + // + + if (mysqli_get_client_version() > 50007) { + + $stmt = mysqli_stmt_init($link); + $stmt->prepare("SELECT id, label FROM test"); + if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 1))) + printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + $stmt->execute(); + $id = $label = NULL; + $stmt->bind_result($id, $label); + $results = array(); + while ($stmt->fetch()) + $results[$id] = $label; + $stmt->close(); + if (empty($results)) + printf("[021] Results should not be empty, subsequent tests will probably fail!\n"); + + /* prefetch is not supported + $stmt = mysqli_stmt_init($link); + $stmt->prepare("SELECT label FROM test"); + if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, -1))) + printf("[022] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + $stmt->close(); + + $stmt = mysqli_stmt_init($link); + $stmt->prepare("SELECT label FROM test"); + if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, PHP_INT_MAX))) + printf("[023] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + $stmt->close(); + + $stmt = mysqli_stmt_init($link); + $stmt->prepare("SELECT id, label FROM test"); + if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 2))) + printf("[024] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + $stmt->execute(); + $id = $label = NULL; + $stmt->bind_result($id, $label); + $results2 = array(); + while ($stmt->fetch()) + $results2[$id] = $label; + $stmt->close(); + if ($results != $results2) { + printf("[025] Results should not differ. Dumping both result sets.\n"); + var_dump($results); + var_dump($results2); + } + */ + + } + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt b/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt index 5ad6f583e7..afc34c27b4 100644 --- a/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt +++ b/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt @@ -8,39 +8,39 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - // Note: No SQL tests here! We can expand one of the *fetch() - // tests to a generic SQL test, if we ever need that. - // We would duplicate the SQL test cases if we have it here and in one of the - // fetch tests, because the fetch tests would have to call prepare/execute etc. - // anyway. + // Note: No SQL tests here! We can expand one of the *fetch() + // tests to a generic SQL test, if we ever need that. + // We would duplicate the SQL test cases if we have it here and in one of the + // fetch tests, because the fetch tests would have to call prepare/execute etc. + // anyway. - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - require('table.inc'); + require('table.inc'); - $cleanupIds = range(1000, 3007); - $model = 50; + $cleanupIds = range(1000, 3007); + $model = 50; - $params = '(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'; + $params = '(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'; - /* create a prepared statement */ - if ($stmt = $link->prepare("SHOW STATUS WHERE 1 = ? AND 1 IN {$params}")) { + /* create a prepared statement */ + if ($stmt = $link->prepare("SHOW STATUS WHERE 1 = ? AND 1 IN {$params}")) { - $stmt->bind_param('iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii', $model, $cleanupIds[0], $cleanupIds[1], $cleanupIds[2], $cleanupIds[3], $cleanupIds[4], $cleanupIds[5], $cleanupIds[6], $cleanupIds[7], $cleanupIds[8], $cleanupIds[9], $cleanupIds[10], $cleanupIds[11], $cleanupIds[12], $cleanupIds[13], $cleanupIds[14], $cleanupIds[15], $cleanupIds[16], $cleanupIds[17], $cleanupIds[18], $cleanupIds[19], $cleanupIds[20], $cleanupIds[21], $cleanupIds[22], $cleanupIds[23], $cleanupIds[24], $cleanupIds[25], $cleanupIds[26], $cleanupIds[27], $cleanupIds[28], $cleanupIds[29], $cleanupIds[30], $cleanupIds[31], $cleanupIds[32], $cleanupIds[33], $cleanupIds[34], $cleanupIds[35], $cleanupIds[36], $cleanupIds[37], $cleanupIds[38], $cleanupIds[39], $cleanupIds[40], $cleanupIds[41], $cleanupIds[42], $cleanupIds[43], $cleanupIds[44], $cleanupIds[45], $cleanupIds[46], $cleanupIds[47], $cleanupIds[48], $cleanupIds[49], $cleanupIds[50], $cleanupIds[51], $cleanupIds[52], $cleanupIds[53], $cleanupIds[54], $cleanupIds[55], $cleanupIds[56], $cleanupIds[57], $cleanupIds[58], $cleanupIds[59], $cleanupIds[60], $cleanupIds[61], $cleanupIds[62], $cleanupIds[63], $cleanupIds[64], $cleanupIds[65], $cleanupIds[66], $cleanupIds[67], $cleanupIds[68], $cleanupIds[69], $cleanupIds[70], $cleanupIds[71], $cleanupIds[72], $cleanupIds[73], $cleanupIds[74], $cleanupIds[75], $cleanupIds[76], $cleanupIds[77], $cleanupIds[78], $cleanupIds[79], $cleanupIds[80], $cleanupIds[81], $cleanupIds[82], $cleanupIds[83], $cleanupIds[84], $cleanupIds[85], $cleanupIds[86], $cleanupIds[87], $cleanupIds[88], $cleanupIds[89], $cleanupIds[90], $cleanupIds[91], $cleanupIds[92], $cleanupIds[93], $cleanupIds[94], $cleanupIds[95], $cleanupIds[96], $cleanupIds[97], $cleanupIds[98], $cleanupIds[99], $cleanupIds[100], $cleanupIds[101], $cleanupIds[102], $cleanupIds[103], $cleanupIds[104], $cleanupIds[105], $cleanupIds[106], $cleanupIds[107], $cleanupIds[108], $cleanupIds[109], $cleanupIds[110], $cleanupIds[111], $cleanupIds[112], $cleanupIds[113], $cleanupIds[114], $cleanupIds[115], $cleanupIds[116], $cleanupIds[117], $cleanupIds[118], $cleanupIds[119], $cleanupIds[120], $cleanupIds[121], $cleanupIds[122], $cleanupIds[123], $cleanupIds[124], $cleanupIds[125], $cleanupIds[126], $cleanupIds[127], $cleanupIds[128], $cleanupIds[129], $cleanupIds[130], $cleanupIds[131], $cleanupIds[132], $cleanupIds[133], $cleanupIds[134], $cleanupIds[135], $cleanupIds[136], $cleanupIds[137], $cleanupIds[138], $cleanupIds[139], $cleanupIds[140], $cleanupIds[141], $cleanupIds[142], $cleanupIds[143], $cleanupIds[144], $cleanupIds[145], $cleanupIds[146], $cleanupIds[147], $cleanupIds[148], $cleanupIds[149], $cleanupIds[150], $cleanupIds[151], $cleanupIds[152], $cleanupIds[153], $cleanupIds[154], $cleanupIds[155], $cleanupIds[156], $cleanupIds[157], $cleanupIds[158], $cleanupIds[159], $cleanupIds[160], $cleanupIds[161], $cleanupIds[162], $cleanupIds[163], $cleanupIds[164], $cleanupIds[165], $cleanupIds[166], $cleanupIds[167], $cleanupIds[168], $cleanupIds[169], $cleanupIds[170], $cleanupIds[171], $cleanupIds[172], $cleanupIds[173], $cleanupIds[174], $cleanupIds[175], $cleanupIds[176], $cleanupIds[177], $cleanupIds[178], $cleanupIds[179], $cleanupIds[180], $cleanupIds[181], $cleanupIds[182], $cleanupIds[183], $cleanupIds[184], $cleanupIds[185], $cleanupIds[186], $cleanupIds[187], $cleanupIds[188], $cleanupIds[189], $cleanupIds[190], $cleanupIds[191], $cleanupIds[192], $cleanupIds[193], $cleanupIds[194], $cleanupIds[195], $cleanupIds[196], $cleanupIds[197], $cleanupIds[198], $cleanupIds[199], $cleanupIds[200], $cleanupIds[201], $cleanupIds[202], $cleanupIds[203], $cleanupIds[204], $cleanupIds[205], $cleanupIds[206], $cleanupIds[207], $cleanupIds[208], $cleanupIds[209], $cleanupIds[210], $cleanupIds[211], $cleanupIds[212], $cleanupIds[213], $cleanupIds[214], $cleanupIds[215], $cleanupIds[216], $cleanupIds[217], $cleanupIds[218], $cleanupIds[219], $cleanupIds[220], $cleanupIds[221], $cleanupIds[222], $cleanupIds[223], $cleanupIds[224], $cleanupIds[225], $cleanupIds[226], $cleanupIds[227], $cleanupIds[228], $cleanupIds[229], $cleanupIds[230], $cleanupIds[231], $cleanupIds[232], $cleanupIds[233], $cleanupIds[234], $cleanupIds[235], $cleanupIds[236], $cleanupIds[237], $cleanupIds[238], $cleanupIds[239], $cleanupIds[240], $cleanupIds[241], $cleanupIds[242], $cleanupIds[243], $cleanupIds[244], $cleanupIds[245], $cleanupIds[246], $cleanupIds[247], $cleanupIds[248], $cleanupIds[249], $cleanupIds[250], $cleanupIds[251], $cleanupIds[252], $cleanupIds[253], $cleanupIds[254], $cleanupIds[255], $cleanupIds[256], $cleanupIds[257], $cleanupIds[258], $cleanupIds[259], $cleanupIds[260], $cleanupIds[261], $cleanupIds[262], $cleanupIds[263], $cleanupIds[264], $cleanupIds[265], $cleanupIds[266], $cleanupIds[267], $cleanupIds[268], $cleanupIds[269], $cleanupIds[270], $cleanupIds[271], $cleanupIds[272], $cleanupIds[273], $cleanupIds[274], $cleanupIds[275], $cleanupIds[276], $cleanupIds[277], $cleanupIds[278], $cleanupIds[279], $cleanupIds[280], $cleanupIds[281], $cleanupIds[282], $cleanupIds[283], $cleanupIds[284], $cleanupIds[285], $cleanupIds[286], $cleanupIds[287], $cleanupIds[288], $cleanupIds[289], $cleanupIds[290], $cleanupIds[291], $cleanupIds[292], $cleanupIds[293], $cleanupIds[294], $cleanupIds[295], $cleanupIds[296], $cleanupIds[297], $cleanupIds[298], $cleanupIds[299], $cleanupIds[300], $cleanupIds[301], $cleanupIds[302], $cleanupIds[303], $cleanupIds[304], $cleanupIds[305], $cleanupIds[306], $cleanupIds[307], $cleanupIds[308], $cleanupIds[309], $cleanupIds[310], $cleanupIds[311], $cleanupIds[312], $cleanupIds[313], $cleanupIds[314], $cleanupIds[315], $cleanupIds[316], $cleanupIds[317], $cleanupIds[318], $cleanupIds[319], $cleanupIds[320], $cleanupIds[321], $cleanupIds[322], $cleanupIds[323], $cleanupIds[324], $cleanupIds[325], $cleanupIds[326], $cleanupIds[327], $cleanupIds[328], $cleanupIds[329], $cleanupIds[330], $cleanupIds[331], $cleanupIds[332], $cleanupIds[333], $cleanupIds[334], $cleanupIds[335], $cleanupIds[336], $cleanupIds[337], $cleanupIds[338], $cleanupIds[339], $cleanupIds[340], $cleanupIds[341], $cleanupIds[342], $cleanupIds[343], $cleanupIds[344], $cleanupIds[345], $cleanupIds[346], $cleanupIds[347], $cleanupIds[348], $cleanupIds[349], $cleanupIds[350], $cleanupIds[351], $cleanupIds[352], $cleanupIds[353], $cleanupIds[354], $cleanupIds[355], $cleanupIds[356], $cleanupIds[357], $cleanupIds[358], $cleanupIds[359], $cleanupIds[360], $cleanupIds[361], $cleanupIds[362], $cleanupIds[363], $cleanupIds[364], $cleanupIds[365], $cleanupIds[366], $cleanupIds[367], $cleanupIds[368], $cleanupIds[369], $cleanupIds[370], $cleanupIds[371], $cleanupIds[372], $cleanupIds[373], $cleanupIds[374], $cleanupIds[375], $cleanupIds[376], $cleanupIds[377], $cleanupIds[378], $cleanupIds[379], $cleanupIds[380], $cleanupIds[381], $cleanupIds[382], $cleanupIds[383], $cleanupIds[384], $cleanupIds[385], $cleanupIds[386], $cleanupIds[387], $cleanupIds[388], $cleanupIds[389], $cleanupIds[390], $cleanupIds[391], $cleanupIds[392], $cleanupIds[393], $cleanupIds[394], $cleanupIds[395], $cleanupIds[396], $cleanupIds[397], $cleanupIds[398], $cleanupIds[399], $cleanupIds[400], $cleanupIds[401], $cleanupIds[402], $cleanupIds[403], $cleanupIds[404], $cleanupIds[405], $cleanupIds[406], $cleanupIds[407], $cleanupIds[408], $cleanupIds[409], $cleanupIds[410], $cleanupIds[411], $cleanupIds[412], $cleanupIds[413], $cleanupIds[414], $cleanupIds[415], $cleanupIds[416], $cleanupIds[417], $cleanupIds[418], $cleanupIds[419], $cleanupIds[420], $cleanupIds[421], $cleanupIds[422], $cleanupIds[423], $cleanupIds[424], $cleanupIds[425], $cleanupIds[426], $cleanupIds[427], $cleanupIds[428], $cleanupIds[429], $cleanupIds[430], $cleanupIds[431], $cleanupIds[432], $cleanupIds[433], $cleanupIds[434], $cleanupIds[435], $cleanupIds[436], $cleanupIds[437], $cleanupIds[438], $cleanupIds[439], $cleanupIds[440], $cleanupIds[441], $cleanupIds[442], $cleanupIds[443], $cleanupIds[444], $cleanupIds[445], $cleanupIds[446], $cleanupIds[447], $cleanupIds[448], $cleanupIds[449], $cleanupIds[450], $cleanupIds[451], $cleanupIds[452], $cleanupIds[453], $cleanupIds[454], $cleanupIds[455], $cleanupIds[456], $cleanupIds[457], $cleanupIds[458], $cleanupIds[459], $cleanupIds[460], $cleanupIds[461], $cleanupIds[462], $cleanupIds[463], $cleanupIds[464], $cleanupIds[465], $cleanupIds[466], $cleanupIds[467], $cleanupIds[468], $cleanupIds[469], $cleanupIds[470], $cleanupIds[471], $cleanupIds[472], $cleanupIds[473], $cleanupIds[474], $cleanupIds[475], $cleanupIds[476], $cleanupIds[477], $cleanupIds[478], $cleanupIds[479], $cleanupIds[480], $cleanupIds[481], $cleanupIds[482], $cleanupIds[483], $cleanupIds[484], $cleanupIds[485], $cleanupIds[486], $cleanupIds[487], $cleanupIds[488], $cleanupIds[489], $cleanupIds[490], $cleanupIds[491], $cleanupIds[492], $cleanupIds[493], $cleanupIds[494], $cleanupIds[495], $cleanupIds[496], $cleanupIds[497], $cleanupIds[498], $cleanupIds[499], $cleanupIds[500], $cleanupIds[501], $cleanupIds[502], $cleanupIds[503], $cleanupIds[504], $cleanupIds[505], $cleanupIds[506], $cleanupIds[507], $cleanupIds[508], $cleanupIds[509], $cleanupIds[510], $cleanupIds[511], $cleanupIds[512], $cleanupIds[513], $cleanupIds[514], $cleanupIds[515], $cleanupIds[516], $cleanupIds[517], $cleanupIds[518], $cleanupIds[519], $cleanupIds[520], $cleanupIds[521], $cleanupIds[522], $cleanupIds[523], $cleanupIds[524], $cleanupIds[525], $cleanupIds[526], $cleanupIds[527], $cleanupIds[528], $cleanupIds[529], $cleanupIds[530], $cleanupIds[531], $cleanupIds[532], $cleanupIds[533], $cleanupIds[534], $cleanupIds[535], $cleanupIds[536], $cleanupIds[537], $cleanupIds[538], $cleanupIds[539], $cleanupIds[540], $cleanupIds[541], $cleanupIds[542], $cleanupIds[543], $cleanupIds[544], $cleanupIds[545], $cleanupIds[546], $cleanupIds[547], $cleanupIds[548], $cleanupIds[549], $cleanupIds[550], $cleanupIds[551], $cleanupIds[552], $cleanupIds[553], $cleanupIds[554], $cleanupIds[555], $cleanupIds[556], $cleanupIds[557], $cleanupIds[558], $cleanupIds[559], $cleanupIds[560], $cleanupIds[561], $cleanupIds[562], $cleanupIds[563], $cleanupIds[564], $cleanupIds[565], $cleanupIds[566], $cleanupIds[567], $cleanupIds[568], $cleanupIds[569], $cleanupIds[570], $cleanupIds[571], $cleanupIds[572], $cleanupIds[573], $cleanupIds[574], $cleanupIds[575], $cleanupIds[576], $cleanupIds[577], $cleanupIds[578], $cleanupIds[579], $cleanupIds[580], $cleanupIds[581], $cleanupIds[582], $cleanupIds[583], $cleanupIds[584], $cleanupIds[585], $cleanupIds[586], $cleanupIds[587], $cleanupIds[588], $cleanupIds[589], $cleanupIds[590], $cleanupIds[591], $cleanupIds[592], $cleanupIds[593], $cleanupIds[594], $cleanupIds[595], $cleanupIds[596], $cleanupIds[597], $cleanupIds[598], $cleanupIds[599], $cleanupIds[600], $cleanupIds[601], $cleanupIds[602], $cleanupIds[603], $cleanupIds[604], $cleanupIds[605], $cleanupIds[606], $cleanupIds[607], $cleanupIds[608], $cleanupIds[609], $cleanupIds[610], $cleanupIds[611], $cleanupIds[612], $cleanupIds[613], $cleanupIds[614], $cleanupIds[615], $cleanupIds[616], $cleanupIds[617], $cleanupIds[618], $cleanupIds[619], $cleanupIds[620], $cleanupIds[621], $cleanupIds[622], $cleanupIds[623], $cleanupIds[624], $cleanupIds[625], $cleanupIds[626], $cleanupIds[627], $cleanupIds[628], $cleanupIds[629], $cleanupIds[630], $cleanupIds[631], $cleanupIds[632], $cleanupIds[633], $cleanupIds[634], $cleanupIds[635], $cleanupIds[636], $cleanupIds[637], $cleanupIds[638], $cleanupIds[639], $cleanupIds[640], $cleanupIds[641], $cleanupIds[642], $cleanupIds[643], $cleanupIds[644], $cleanupIds[645], $cleanupIds[646], $cleanupIds[647], $cleanupIds[648], $cleanupIds[649], $cleanupIds[650], $cleanupIds[651], $cleanupIds[652], $cleanupIds[653], $cleanupIds[654], $cleanupIds[655], $cleanupIds[656], $cleanupIds[657], $cleanupIds[658], $cleanupIds[659], $cleanupIds[660], $cleanupIds[661], $cleanupIds[662], $cleanupIds[663], $cleanupIds[664], $cleanupIds[665], $cleanupIds[666], $cleanupIds[667], $cleanupIds[668], $cleanupIds[669], $cleanupIds[670], $cleanupIds[671], $cleanupIds[672], $cleanupIds[673], $cleanupIds[674], $cleanupIds[675], $cleanupIds[676], $cleanupIds[677], $cleanupIds[678], $cleanupIds[679], $cleanupIds[680], $cleanupIds[681], $cleanupIds[682], $cleanupIds[683], $cleanupIds[684], $cleanupIds[685], $cleanupIds[686], $cleanupIds[687], $cleanupIds[688], $cleanupIds[689], $cleanupIds[690], $cleanupIds[691], $cleanupIds[692], $cleanupIds[693], $cleanupIds[694], $cleanupIds[695], $cleanupIds[696], $cleanupIds[697], $cleanupIds[698], $cleanupIds[699], $cleanupIds[700], $cleanupIds[701], $cleanupIds[702], $cleanupIds[703], $cleanupIds[704], $cleanupIds[705], $cleanupIds[706], $cleanupIds[707], $cleanupIds[708], $cleanupIds[709], $cleanupIds[710], $cleanupIds[711], $cleanupIds[712], $cleanupIds[713], $cleanupIds[714], $cleanupIds[715], $cleanupIds[716], $cleanupIds[717], $cleanupIds[718], $cleanupIds[719], $cleanupIds[720], $cleanupIds[721], $cleanupIds[722], $cleanupIds[723], $cleanupIds[724], $cleanupIds[725], $cleanupIds[726], $cleanupIds[727], $cleanupIds[728], $cleanupIds[729], $cleanupIds[730], $cleanupIds[731], $cleanupIds[732], $cleanupIds[733], $cleanupIds[734], $cleanupIds[735], $cleanupIds[736], $cleanupIds[737], $cleanupIds[738], $cleanupIds[739], $cleanupIds[740], $cleanupIds[741], $cleanupIds[742], $cleanupIds[743], $cleanupIds[744], $cleanupIds[745], $cleanupIds[746], $cleanupIds[747], $cleanupIds[748], $cleanupIds[749], $cleanupIds[750], $cleanupIds[751], $cleanupIds[752], $cleanupIds[753], $cleanupIds[754], $cleanupIds[755], $cleanupIds[756], $cleanupIds[757], $cleanupIds[758], $cleanupIds[759], $cleanupIds[760], $cleanupIds[761], $cleanupIds[762], $cleanupIds[763], $cleanupIds[764], $cleanupIds[765], $cleanupIds[766], $cleanupIds[767], $cleanupIds[768], $cleanupIds[769], $cleanupIds[770], $cleanupIds[771], $cleanupIds[772], $cleanupIds[773], $cleanupIds[774], $cleanupIds[775], $cleanupIds[776], $cleanupIds[777], $cleanupIds[778], $cleanupIds[779], $cleanupIds[780], $cleanupIds[781], $cleanupIds[782], $cleanupIds[783], $cleanupIds[784], $cleanupIds[785], $cleanupIds[786], $cleanupIds[787], $cleanupIds[788], $cleanupIds[789], $cleanupIds[790], $cleanupIds[791], $cleanupIds[792], $cleanupIds[793], $cleanupIds[794], $cleanupIds[795], $cleanupIds[796], $cleanupIds[797], $cleanupIds[798], $cleanupIds[799], $cleanupIds[800], $cleanupIds[801], $cleanupIds[802], $cleanupIds[803], $cleanupIds[804], $cleanupIds[805], $cleanupIds[806], $cleanupIds[807], $cleanupIds[808], $cleanupIds[809], $cleanupIds[810], $cleanupIds[811], $cleanupIds[812], $cleanupIds[813], $cleanupIds[814], $cleanupIds[815], $cleanupIds[816], $cleanupIds[817], $cleanupIds[818], $cleanupIds[819], $cleanupIds[820], $cleanupIds[821], $cleanupIds[822], $cleanupIds[823], $cleanupIds[824], $cleanupIds[825], $cleanupIds[826], $cleanupIds[827], $cleanupIds[828], $cleanupIds[829], $cleanupIds[830], $cleanupIds[831], $cleanupIds[832], $cleanupIds[833], $cleanupIds[834], $cleanupIds[835], $cleanupIds[836], $cleanupIds[837], $cleanupIds[838], $cleanupIds[839], $cleanupIds[840], $cleanupIds[841], $cleanupIds[842], $cleanupIds[843], $cleanupIds[844], $cleanupIds[845], $cleanupIds[846], $cleanupIds[847], $cleanupIds[848], $cleanupIds[849], $cleanupIds[850], $cleanupIds[851], $cleanupIds[852], $cleanupIds[853], $cleanupIds[854], $cleanupIds[855], $cleanupIds[856], $cleanupIds[857], $cleanupIds[858], $cleanupIds[859], $cleanupIds[860], $cleanupIds[861], $cleanupIds[862], $cleanupIds[863], $cleanupIds[864], $cleanupIds[865], $cleanupIds[866], $cleanupIds[867], $cleanupIds[868], $cleanupIds[869], $cleanupIds[870], $cleanupIds[871], $cleanupIds[872], $cleanupIds[873], $cleanupIds[874], $cleanupIds[875], $cleanupIds[876], $cleanupIds[877], $cleanupIds[878], $cleanupIds[879], $cleanupIds[880], $cleanupIds[881], $cleanupIds[882], $cleanupIds[883], $cleanupIds[884], $cleanupIds[885], $cleanupIds[886], $cleanupIds[887], $cleanupIds[888], $cleanupIds[889], $cleanupIds[890], $cleanupIds[891], $cleanupIds[892], $cleanupIds[893], $cleanupIds[894], $cleanupIds[895], $cleanupIds[896], $cleanupIds[897], $cleanupIds[898], $cleanupIds[899], $cleanupIds[900], $cleanupIds[901], $cleanupIds[902], $cleanupIds[903], $cleanupIds[904], $cleanupIds[905], $cleanupIds[906], $cleanupIds[907], $cleanupIds[908], $cleanupIds[909], $cleanupIds[910], $cleanupIds[911], $cleanupIds[912], $cleanupIds[913], $cleanupIds[914], $cleanupIds[915], $cleanupIds[916], $cleanupIds[917], $cleanupIds[918], $cleanupIds[919], $cleanupIds[920], $cleanupIds[921], $cleanupIds[922], $cleanupIds[923], $cleanupIds[924], $cleanupIds[925], $cleanupIds[926], $cleanupIds[927], $cleanupIds[928], $cleanupIds[929], $cleanupIds[930], $cleanupIds[931], $cleanupIds[932], $cleanupIds[933], $cleanupIds[934], $cleanupIds[935], $cleanupIds[936], $cleanupIds[937], $cleanupIds[938], $cleanupIds[939], $cleanupIds[940], $cleanupIds[941], $cleanupIds[942], $cleanupIds[943], $cleanupIds[944], $cleanupIds[945], $cleanupIds[946], $cleanupIds[947], $cleanupIds[948], $cleanupIds[949], $cleanupIds[950], $cleanupIds[951], $cleanupIds[952], $cleanupIds[953], $cleanupIds[954], $cleanupIds[955], $cleanupIds[956], $cleanupIds[957], $cleanupIds[958], $cleanupIds[959], $cleanupIds[960], $cleanupIds[961], $cleanupIds[962], $cleanupIds[963], $cleanupIds[964], $cleanupIds[965], $cleanupIds[966], $cleanupIds[967], $cleanupIds[968], $cleanupIds[969], $cleanupIds[970], $cleanupIds[971], $cleanupIds[972], $cleanupIds[973], $cleanupIds[974], $cleanupIds[975], $cleanupIds[976], $cleanupIds[977], $cleanupIds[978], $cleanupIds[979], $cleanupIds[980], $cleanupIds[981], $cleanupIds[982], $cleanupIds[983], $cleanupIds[984], $cleanupIds[985], $cleanupIds[986], $cleanupIds[987], $cleanupIds[988], $cleanupIds[989], $cleanupIds[990], $cleanupIds[991], $cleanupIds[992], $cleanupIds[993], $cleanupIds[994], $cleanupIds[995], $cleanupIds[996], $cleanupIds[997], $cleanupIds[998], $cleanupIds[999], $cleanupIds[1000], $cleanupIds[1001], $cleanupIds[1002], $cleanupIds[1003], $cleanupIds[1004], $cleanupIds[1005], $cleanupIds[1006], $cleanupIds[1007], $cleanupIds[1008], $cleanupIds[1009], $cleanupIds[1010], $cleanupIds[1011], $cleanupIds[1012], $cleanupIds[1013], $cleanupIds[1014], $cleanupIds[1015], $cleanupIds[1016], $cleanupIds[1017], $cleanupIds[1018], $cleanupIds[1019], $cleanupIds[1020], $cleanupIds[1021], $cleanupIds[1022], $cleanupIds[1023], $cleanupIds[1024], $cleanupIds[1025], $cleanupIds[1026], $cleanupIds[1027], $cleanupIds[1028], $cleanupIds[1029], $cleanupIds[1030], $cleanupIds[1031], $cleanupIds[1032], $cleanupIds[1033], $cleanupIds[1034], $cleanupIds[1035], $cleanupIds[1036], $cleanupIds[1037], $cleanupIds[1038], $cleanupIds[1039], $cleanupIds[1040], $cleanupIds[1041], $cleanupIds[1042], $cleanupIds[1043], $cleanupIds[1044], $cleanupIds[1045], $cleanupIds[1046], $cleanupIds[1047], $cleanupIds[1048], $cleanupIds[1049], $cleanupIds[1050], $cleanupIds[1051], $cleanupIds[1052], $cleanupIds[1053], $cleanupIds[1054], $cleanupIds[1055], $cleanupIds[1056], $cleanupIds[1057], $cleanupIds[1058], $cleanupIds[1059], $cleanupIds[1060], $cleanupIds[1061], $cleanupIds[1062], $cleanupIds[1063], $cleanupIds[1064], $cleanupIds[1065], $cleanupIds[1066], $cleanupIds[1067], $cleanupIds[1068], $cleanupIds[1069], $cleanupIds[1070], $cleanupIds[1071], $cleanupIds[1072], $cleanupIds[1073], $cleanupIds[1074], $cleanupIds[1075], $cleanupIds[1076], $cleanupIds[1077], $cleanupIds[1078], $cleanupIds[1079], $cleanupIds[1080], $cleanupIds[1081], $cleanupIds[1082], $cleanupIds[1083], $cleanupIds[1084], $cleanupIds[1085], $cleanupIds[1086], $cleanupIds[1087], $cleanupIds[1088], $cleanupIds[1089], $cleanupIds[1090], $cleanupIds[1091], $cleanupIds[1092], $cleanupIds[1093], $cleanupIds[1094], $cleanupIds[1095], $cleanupIds[1096], $cleanupIds[1097], $cleanupIds[1098], $cleanupIds[1099], $cleanupIds[1100], $cleanupIds[1101], $cleanupIds[1102], $cleanupIds[1103], $cleanupIds[1104], $cleanupIds[1105], $cleanupIds[1106], $cleanupIds[1107], $cleanupIds[1108], $cleanupIds[1109], $cleanupIds[1110], $cleanupIds[1111], $cleanupIds[1112], $cleanupIds[1113], $cleanupIds[1114], $cleanupIds[1115], $cleanupIds[1116], $cleanupIds[1117], $cleanupIds[1118], $cleanupIds[1119], $cleanupIds[1120], $cleanupIds[1121], $cleanupIds[1122], $cleanupIds[1123], $cleanupIds[1124], $cleanupIds[1125], $cleanupIds[1126], $cleanupIds[1127], $cleanupIds[1128], $cleanupIds[1129], $cleanupIds[1130], $cleanupIds[1131], $cleanupIds[1132], $cleanupIds[1133], $cleanupIds[1134], $cleanupIds[1135], $cleanupIds[1136], $cleanupIds[1137], $cleanupIds[1138], $cleanupIds[1139], $cleanupIds[1140], $cleanupIds[1141], $cleanupIds[1142], $cleanupIds[1143], $cleanupIds[1144], $cleanupIds[1145], $cleanupIds[1146], $cleanupIds[1147], $cleanupIds[1148], $cleanupIds[1149], $cleanupIds[1150], $cleanupIds[1151], $cleanupIds[1152], $cleanupIds[1153], $cleanupIds[1154], $cleanupIds[1155], $cleanupIds[1156], $cleanupIds[1157], $cleanupIds[1158], $cleanupIds[1159], $cleanupIds[1160], $cleanupIds[1161], $cleanupIds[1162], $cleanupIds[1163], $cleanupIds[1164], $cleanupIds[1165], $cleanupIds[1166], $cleanupIds[1167], $cleanupIds[1168], $cleanupIds[1169], $cleanupIds[1170], $cleanupIds[1171], $cleanupIds[1172], $cleanupIds[1173], $cleanupIds[1174], $cleanupIds[1175], $cleanupIds[1176], $cleanupIds[1177], $cleanupIds[1178], $cleanupIds[1179], $cleanupIds[1180], $cleanupIds[1181], $cleanupIds[1182], $cleanupIds[1183], $cleanupIds[1184], $cleanupIds[1185], $cleanupIds[1186], $cleanupIds[1187], $cleanupIds[1188], $cleanupIds[1189], $cleanupIds[1190], $cleanupIds[1191], $cleanupIds[1192], $cleanupIds[1193], $cleanupIds[1194], $cleanupIds[1195], $cleanupIds[1196], $cleanupIds[1197], $cleanupIds[1198], $cleanupIds[1199], $cleanupIds[1200], $cleanupIds[1201], $cleanupIds[1202], $cleanupIds[1203], $cleanupIds[1204], $cleanupIds[1205], $cleanupIds[1206], $cleanupIds[1207], $cleanupIds[1208], $cleanupIds[1209], $cleanupIds[1210], $cleanupIds[1211], $cleanupIds[1212], $cleanupIds[1213], $cleanupIds[1214], $cleanupIds[1215], $cleanupIds[1216], $cleanupIds[1217], $cleanupIds[1218], $cleanupIds[1219], $cleanupIds[1220], $cleanupIds[1221], $cleanupIds[1222], $cleanupIds[1223], $cleanupIds[1224], $cleanupIds[1225], $cleanupIds[1226], $cleanupIds[1227], $cleanupIds[1228], $cleanupIds[1229], $cleanupIds[1230], $cleanupIds[1231], $cleanupIds[1232], $cleanupIds[1233], $cleanupIds[1234], $cleanupIds[1235], $cleanupIds[1236], $cleanupIds[1237], $cleanupIds[1238], $cleanupIds[1239], $cleanupIds[1240], $cleanupIds[1241], $cleanupIds[1242], $cleanupIds[1243], $cleanupIds[1244], $cleanupIds[1245], $cleanupIds[1246], $cleanupIds[1247], $cleanupIds[1248], $cleanupIds[1249], $cleanupIds[1250], $cleanupIds[1251], $cleanupIds[1252], $cleanupIds[1253], $cleanupIds[1254], $cleanupIds[1255], $cleanupIds[1256], $cleanupIds[1257], $cleanupIds[1258], $cleanupIds[1259], $cleanupIds[1260], $cleanupIds[1261], $cleanupIds[1262], $cleanupIds[1263], $cleanupIds[1264], $cleanupIds[1265], $cleanupIds[1266], $cleanupIds[1267], $cleanupIds[1268], $cleanupIds[1269], $cleanupIds[1270], $cleanupIds[1271], $cleanupIds[1272], $cleanupIds[1273], $cleanupIds[1274], $cleanupIds[1275], $cleanupIds[1276], $cleanupIds[1277], $cleanupIds[1278], $cleanupIds[1279], $cleanupIds[1280], $cleanupIds[1281], $cleanupIds[1282], $cleanupIds[1283], $cleanupIds[1284], $cleanupIds[1285], $cleanupIds[1286], $cleanupIds[1287], $cleanupIds[1288], $cleanupIds[1289], $cleanupIds[1290], $cleanupIds[1291], $cleanupIds[1292], $cleanupIds[1293], $cleanupIds[1294], $cleanupIds[1295], $cleanupIds[1296], $cleanupIds[1297], $cleanupIds[1298], $cleanupIds[1299], $cleanupIds[1300], $cleanupIds[1301], $cleanupIds[1302], $cleanupIds[1303], $cleanupIds[1304], $cleanupIds[1305], $cleanupIds[1306], $cleanupIds[1307], $cleanupIds[1308], $cleanupIds[1309], $cleanupIds[1310], $cleanupIds[1311], $cleanupIds[1312], $cleanupIds[1313], $cleanupIds[1314], $cleanupIds[1315], $cleanupIds[1316], $cleanupIds[1317], $cleanupIds[1318], $cleanupIds[1319], $cleanupIds[1320], $cleanupIds[1321], $cleanupIds[1322], $cleanupIds[1323], $cleanupIds[1324], $cleanupIds[1325], $cleanupIds[1326], $cleanupIds[1327], $cleanupIds[1328], $cleanupIds[1329], $cleanupIds[1330], $cleanupIds[1331], $cleanupIds[1332], $cleanupIds[1333], $cleanupIds[1334], $cleanupIds[1335], $cleanupIds[1336], $cleanupIds[1337], $cleanupIds[1338], $cleanupIds[1339], $cleanupIds[1340], $cleanupIds[1341], $cleanupIds[1342], $cleanupIds[1343], $cleanupIds[1344], $cleanupIds[1345], $cleanupIds[1346], $cleanupIds[1347], $cleanupIds[1348], $cleanupIds[1349], $cleanupIds[1350], $cleanupIds[1351], $cleanupIds[1352], $cleanupIds[1353], $cleanupIds[1354], $cleanupIds[1355], $cleanupIds[1356], $cleanupIds[1357], $cleanupIds[1358], $cleanupIds[1359], $cleanupIds[1360], $cleanupIds[1361], $cleanupIds[1362], $cleanupIds[1363], $cleanupIds[1364], $cleanupIds[1365], $cleanupIds[1366], $cleanupIds[1367], $cleanupIds[1368], $cleanupIds[1369], $cleanupIds[1370], $cleanupIds[1371], $cleanupIds[1372], $cleanupIds[1373], $cleanupIds[1374], $cleanupIds[1375], $cleanupIds[1376], $cleanupIds[1377], $cleanupIds[1378], $cleanupIds[1379], $cleanupIds[1380], $cleanupIds[1381], $cleanupIds[1382], $cleanupIds[1383], $cleanupIds[1384], $cleanupIds[1385], $cleanupIds[1386], $cleanupIds[1387], $cleanupIds[1388], $cleanupIds[1389], $cleanupIds[1390], $cleanupIds[1391], $cleanupIds[1392], $cleanupIds[1393], $cleanupIds[1394], $cleanupIds[1395], $cleanupIds[1396], $cleanupIds[1397], $cleanupIds[1398], $cleanupIds[1399], $cleanupIds[1400], $cleanupIds[1401], $cleanupIds[1402], $cleanupIds[1403], $cleanupIds[1404], $cleanupIds[1405], $cleanupIds[1406], $cleanupIds[1407], $cleanupIds[1408], $cleanupIds[1409], $cleanupIds[1410], $cleanupIds[1411], $cleanupIds[1412], $cleanupIds[1413], $cleanupIds[1414], $cleanupIds[1415], $cleanupIds[1416], $cleanupIds[1417], $cleanupIds[1418], $cleanupIds[1419], $cleanupIds[1420], $cleanupIds[1421], $cleanupIds[1422], $cleanupIds[1423], $cleanupIds[1424], $cleanupIds[1425], $cleanupIds[1426], $cleanupIds[1427], $cleanupIds[1428], $cleanupIds[1429], $cleanupIds[1430], $cleanupIds[1431], $cleanupIds[1432], $cleanupIds[1433], $cleanupIds[1434], $cleanupIds[1435], $cleanupIds[1436], $cleanupIds[1437], $cleanupIds[1438], $cleanupIds[1439], $cleanupIds[1440], $cleanupIds[1441], $cleanupIds[1442], $cleanupIds[1443], $cleanupIds[1444], $cleanupIds[1445], $cleanupIds[1446], $cleanupIds[1447], $cleanupIds[1448], $cleanupIds[1449], $cleanupIds[1450], $cleanupIds[1451], $cleanupIds[1452], $cleanupIds[1453], $cleanupIds[1454], $cleanupIds[1455], $cleanupIds[1456], $cleanupIds[1457], $cleanupIds[1458], $cleanupIds[1459], $cleanupIds[1460], $cleanupIds[1461], $cleanupIds[1462], $cleanupIds[1463], $cleanupIds[1464], $cleanupIds[1465], $cleanupIds[1466], $cleanupIds[1467], $cleanupIds[1468], $cleanupIds[1469], $cleanupIds[1470], $cleanupIds[1471], $cleanupIds[1472], $cleanupIds[1473], $cleanupIds[1474], $cleanupIds[1475], $cleanupIds[1476], $cleanupIds[1477], $cleanupIds[1478], $cleanupIds[1479], $cleanupIds[1480], $cleanupIds[1481], $cleanupIds[1482], $cleanupIds[1483], $cleanupIds[1484], $cleanupIds[1485], $cleanupIds[1486], $cleanupIds[1487], $cleanupIds[1488], $cleanupIds[1489], $cleanupIds[1490], $cleanupIds[1491], $cleanupIds[1492], $cleanupIds[1493], $cleanupIds[1494], $cleanupIds[1495], $cleanupIds[1496], $cleanupIds[1497], $cleanupIds[1498], $cleanupIds[1499], $cleanupIds[1500], $cleanupIds[1501], $cleanupIds[1502], $cleanupIds[1503], $cleanupIds[1504], $cleanupIds[1505], $cleanupIds[1506], $cleanupIds[1507], $cleanupIds[1508], $cleanupIds[1509], $cleanupIds[1510], $cleanupIds[1511], $cleanupIds[1512], $cleanupIds[1513], $cleanupIds[1514], $cleanupIds[1515], $cleanupIds[1516], $cleanupIds[1517], $cleanupIds[1518], $cleanupIds[1519], $cleanupIds[1520], $cleanupIds[1521], $cleanupIds[1522], $cleanupIds[1523], $cleanupIds[1524], $cleanupIds[1525], $cleanupIds[1526], $cleanupIds[1527], $cleanupIds[1528], $cleanupIds[1529], $cleanupIds[1530], $cleanupIds[1531], $cleanupIds[1532], $cleanupIds[1533], $cleanupIds[1534], $cleanupIds[1535], $cleanupIds[1536], $cleanupIds[1537], $cleanupIds[1538], $cleanupIds[1539], $cleanupIds[1540], $cleanupIds[1541], $cleanupIds[1542], $cleanupIds[1543], $cleanupIds[1544], $cleanupIds[1545], $cleanupIds[1546], $cleanupIds[1547], $cleanupIds[1548], $cleanupIds[1549], $cleanupIds[1550], $cleanupIds[1551], $cleanupIds[1552], $cleanupIds[1553], $cleanupIds[1554], $cleanupIds[1555], $cleanupIds[1556], $cleanupIds[1557], $cleanupIds[1558], $cleanupIds[1559], $cleanupIds[1560], $cleanupIds[1561], $cleanupIds[1562], $cleanupIds[1563], $cleanupIds[1564], $cleanupIds[1565], $cleanupIds[1566], $cleanupIds[1567], $cleanupIds[1568], $cleanupIds[1569], $cleanupIds[1570], $cleanupIds[1571], $cleanupIds[1572], $cleanupIds[1573], $cleanupIds[1574], $cleanupIds[1575], $cleanupIds[1576], $cleanupIds[1577], $cleanupIds[1578], $cleanupIds[1579], $cleanupIds[1580], $cleanupIds[1581], $cleanupIds[1582], $cleanupIds[1583], $cleanupIds[1584], $cleanupIds[1585], $cleanupIds[1586], $cleanupIds[1587], $cleanupIds[1588], $cleanupIds[1589], $cleanupIds[1590], $cleanupIds[1591], $cleanupIds[1592], $cleanupIds[1593], $cleanupIds[1594], $cleanupIds[1595], $cleanupIds[1596], $cleanupIds[1597], $cleanupIds[1598], $cleanupIds[1599], $cleanupIds[1600], $cleanupIds[1601], $cleanupIds[1602], $cleanupIds[1603], $cleanupIds[1604], $cleanupIds[1605], $cleanupIds[1606], $cleanupIds[1607], $cleanupIds[1608], $cleanupIds[1609], $cleanupIds[1610], $cleanupIds[1611], $cleanupIds[1612], $cleanupIds[1613], $cleanupIds[1614], $cleanupIds[1615], $cleanupIds[1616], $cleanupIds[1617], $cleanupIds[1618], $cleanupIds[1619], $cleanupIds[1620], $cleanupIds[1621], $cleanupIds[1622], $cleanupIds[1623], $cleanupIds[1624], $cleanupIds[1625], $cleanupIds[1626], $cleanupIds[1627], $cleanupIds[1628], $cleanupIds[1629], $cleanupIds[1630], $cleanupIds[1631], $cleanupIds[1632], $cleanupIds[1633], $cleanupIds[1634], $cleanupIds[1635], $cleanupIds[1636], $cleanupIds[1637], $cleanupIds[1638], $cleanupIds[1639], $cleanupIds[1640], $cleanupIds[1641], $cleanupIds[1642], $cleanupIds[1643], $cleanupIds[1644], $cleanupIds[1645], $cleanupIds[1646], $cleanupIds[1647], $cleanupIds[1648], $cleanupIds[1649], $cleanupIds[1650], $cleanupIds[1651], $cleanupIds[1652], $cleanupIds[1653], $cleanupIds[1654], $cleanupIds[1655], $cleanupIds[1656], $cleanupIds[1657], $cleanupIds[1658], $cleanupIds[1659], $cleanupIds[1660], $cleanupIds[1661], $cleanupIds[1662], $cleanupIds[1663], $cleanupIds[1664], $cleanupIds[1665], $cleanupIds[1666], $cleanupIds[1667], $cleanupIds[1668], $cleanupIds[1669], $cleanupIds[1670], $cleanupIds[1671], $cleanupIds[1672], $cleanupIds[1673], $cleanupIds[1674], $cleanupIds[1675], $cleanupIds[1676], $cleanupIds[1677], $cleanupIds[1678], $cleanupIds[1679], $cleanupIds[1680], $cleanupIds[1681], $cleanupIds[1682], $cleanupIds[1683], $cleanupIds[1684], $cleanupIds[1685], $cleanupIds[1686], $cleanupIds[1687], $cleanupIds[1688], $cleanupIds[1689], $cleanupIds[1690], $cleanupIds[1691], $cleanupIds[1692], $cleanupIds[1693], $cleanupIds[1694], $cleanupIds[1695], $cleanupIds[1696], $cleanupIds[1697], $cleanupIds[1698], $cleanupIds[1699], $cleanupIds[1700], $cleanupIds[1701], $cleanupIds[1702], $cleanupIds[1703], $cleanupIds[1704], $cleanupIds[1705], $cleanupIds[1706], $cleanupIds[1707], $cleanupIds[1708], $cleanupIds[1709], $cleanupIds[1710], $cleanupIds[1711], $cleanupIds[1712], $cleanupIds[1713], $cleanupIds[1714], $cleanupIds[1715], $cleanupIds[1716], $cleanupIds[1717], $cleanupIds[1718], $cleanupIds[1719], $cleanupIds[1720], $cleanupIds[1721], $cleanupIds[1722], $cleanupIds[1723], $cleanupIds[1724], $cleanupIds[1725], $cleanupIds[1726], $cleanupIds[1727], $cleanupIds[1728], $cleanupIds[1729], $cleanupIds[1730], $cleanupIds[1731], $cleanupIds[1732], $cleanupIds[1733], $cleanupIds[1734], $cleanupIds[1735], $cleanupIds[1736], $cleanupIds[1737], $cleanupIds[1738], $cleanupIds[1739], $cleanupIds[1740], $cleanupIds[1741], $cleanupIds[1742], $cleanupIds[1743], $cleanupIds[1744], $cleanupIds[1745], $cleanupIds[1746], $cleanupIds[1747], $cleanupIds[1748], $cleanupIds[1749], $cleanupIds[1750], $cleanupIds[1751], $cleanupIds[1752], $cleanupIds[1753], $cleanupIds[1754], $cleanupIds[1755], $cleanupIds[1756], $cleanupIds[1757], $cleanupIds[1758], $cleanupIds[1759], $cleanupIds[1760], $cleanupIds[1761], $cleanupIds[1762], $cleanupIds[1763], $cleanupIds[1764], $cleanupIds[1765], $cleanupIds[1766], $cleanupIds[1767], $cleanupIds[1768], $cleanupIds[1769], $cleanupIds[1770], $cleanupIds[1771], $cleanupIds[1772], $cleanupIds[1773], $cleanupIds[1774], $cleanupIds[1775], $cleanupIds[1776], $cleanupIds[1777], $cleanupIds[1778], $cleanupIds[1779], $cleanupIds[1780], $cleanupIds[1781], $cleanupIds[1782], $cleanupIds[1783], $cleanupIds[1784], $cleanupIds[1785], $cleanupIds[1786], $cleanupIds[1787], $cleanupIds[1788], $cleanupIds[1789], $cleanupIds[1790], $cleanupIds[1791], $cleanupIds[1792], $cleanupIds[1793], $cleanupIds[1794], $cleanupIds[1795], $cleanupIds[1796], $cleanupIds[1797], $cleanupIds[1798], $cleanupIds[1799], $cleanupIds[1800], $cleanupIds[1801], $cleanupIds[1802], $cleanupIds[1803], $cleanupIds[1804], $cleanupIds[1805], $cleanupIds[1806], $cleanupIds[1807], $cleanupIds[1808], $cleanupIds[1809], $cleanupIds[1810], $cleanupIds[1811], $cleanupIds[1812], $cleanupIds[1813], $cleanupIds[1814], $cleanupIds[1815], $cleanupIds[1816], $cleanupIds[1817], $cleanupIds[1818], $cleanupIds[1819], $cleanupIds[1820], $cleanupIds[1821], $cleanupIds[1822], $cleanupIds[1823], $cleanupIds[1824], $cleanupIds[1825], $cleanupIds[1826], $cleanupIds[1827], $cleanupIds[1828], $cleanupIds[1829], $cleanupIds[1830], $cleanupIds[1831], $cleanupIds[1832], $cleanupIds[1833], $cleanupIds[1834], $cleanupIds[1835], $cleanupIds[1836], $cleanupIds[1837], $cleanupIds[1838], $cleanupIds[1839], $cleanupIds[1840], $cleanupIds[1841], $cleanupIds[1842], $cleanupIds[1843], $cleanupIds[1844], $cleanupIds[1845], $cleanupIds[1846], $cleanupIds[1847], $cleanupIds[1848], $cleanupIds[1849], $cleanupIds[1850], $cleanupIds[1851], $cleanupIds[1852], $cleanupIds[1853], $cleanupIds[1854], $cleanupIds[1855], $cleanupIds[1856], $cleanupIds[1857], $cleanupIds[1858], $cleanupIds[1859], $cleanupIds[1860], $cleanupIds[1861], $cleanupIds[1862], $cleanupIds[1863], $cleanupIds[1864], $cleanupIds[1865], $cleanupIds[1866], $cleanupIds[1867], $cleanupIds[1868], $cleanupIds[1869], $cleanupIds[1870], $cleanupIds[1871], $cleanupIds[1872], $cleanupIds[1873], $cleanupIds[1874], $cleanupIds[1875], $cleanupIds[1876], $cleanupIds[1877], $cleanupIds[1878], $cleanupIds[1879], $cleanupIds[1880], $cleanupIds[1881], $cleanupIds[1882], $cleanupIds[1883], $cleanupIds[1884], $cleanupIds[1885], $cleanupIds[1886], $cleanupIds[1887], $cleanupIds[1888], $cleanupIds[1889], $cleanupIds[1890], $cleanupIds[1891], $cleanupIds[1892], $cleanupIds[1893], $cleanupIds[1894], $cleanupIds[1895], $cleanupIds[1896], $cleanupIds[1897], $cleanupIds[1898], $cleanupIds[1899], $cleanupIds[1900], $cleanupIds[1901], $cleanupIds[1902], $cleanupIds[1903], $cleanupIds[1904], $cleanupIds[1905], $cleanupIds[1906], $cleanupIds[1907], $cleanupIds[1908], $cleanupIds[1909], $cleanupIds[1910], $cleanupIds[1911], $cleanupIds[1912], $cleanupIds[1913], $cleanupIds[1914], $cleanupIds[1915], $cleanupIds[1916], $cleanupIds[1917], $cleanupIds[1918], $cleanupIds[1919], $cleanupIds[1920], $cleanupIds[1921], $cleanupIds[1922], $cleanupIds[1923], $cleanupIds[1924], $cleanupIds[1925], $cleanupIds[1926], $cleanupIds[1927], $cleanupIds[1928], $cleanupIds[1929], $cleanupIds[1930], $cleanupIds[1931], $cleanupIds[1932], $cleanupIds[1933], $cleanupIds[1934], $cleanupIds[1935], $cleanupIds[1936], $cleanupIds[1937], $cleanupIds[1938], $cleanupIds[1939], $cleanupIds[1940], $cleanupIds[1941], $cleanupIds[1942], $cleanupIds[1943], $cleanupIds[1944], $cleanupIds[1945], $cleanupIds[1946], $cleanupIds[1947], $cleanupIds[1948], $cleanupIds[1949], $cleanupIds[1950], $cleanupIds[1951], $cleanupIds[1952], $cleanupIds[1953], $cleanupIds[1954], $cleanupIds[1955], $cleanupIds[1956], $cleanupIds[1957], $cleanupIds[1958], $cleanupIds[1959], $cleanupIds[1960], $cleanupIds[1961], $cleanupIds[1962], $cleanupIds[1963], $cleanupIds[1964], $cleanupIds[1965], $cleanupIds[1966], $cleanupIds[1967], $cleanupIds[1968], $cleanupIds[1969], $cleanupIds[1970], $cleanupIds[1971], $cleanupIds[1972], $cleanupIds[1973], $cleanupIds[1974], $cleanupIds[1975], $cleanupIds[1976], $cleanupIds[1977], $cleanupIds[1978], $cleanupIds[1979], $cleanupIds[1980], $cleanupIds[1981], $cleanupIds[1982], $cleanupIds[1983], $cleanupIds[1984], $cleanupIds[1985], $cleanupIds[1986], $cleanupIds[1987], $cleanupIds[1988], $cleanupIds[1989], $cleanupIds[1990], $cleanupIds[1991], $cleanupIds[1992], $cleanupIds[1993], $cleanupIds[1994], $cleanupIds[1995], $cleanupIds[1996], $cleanupIds[1997], $cleanupIds[1998], $cleanupIds[1999], $cleanupIds[2000], $cleanupIds[2001], $cleanupIds[2002], $cleanupIds[2003], $cleanupIds[2004], $cleanupIds[2005], $cleanupIds[2006]); + $stmt->bind_param('iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii', $model, $cleanupIds[0], $cleanupIds[1], $cleanupIds[2], $cleanupIds[3], $cleanupIds[4], $cleanupIds[5], $cleanupIds[6], $cleanupIds[7], $cleanupIds[8], $cleanupIds[9], $cleanupIds[10], $cleanupIds[11], $cleanupIds[12], $cleanupIds[13], $cleanupIds[14], $cleanupIds[15], $cleanupIds[16], $cleanupIds[17], $cleanupIds[18], $cleanupIds[19], $cleanupIds[20], $cleanupIds[21], $cleanupIds[22], $cleanupIds[23], $cleanupIds[24], $cleanupIds[25], $cleanupIds[26], $cleanupIds[27], $cleanupIds[28], $cleanupIds[29], $cleanupIds[30], $cleanupIds[31], $cleanupIds[32], $cleanupIds[33], $cleanupIds[34], $cleanupIds[35], $cleanupIds[36], $cleanupIds[37], $cleanupIds[38], $cleanupIds[39], $cleanupIds[40], $cleanupIds[41], $cleanupIds[42], $cleanupIds[43], $cleanupIds[44], $cleanupIds[45], $cleanupIds[46], $cleanupIds[47], $cleanupIds[48], $cleanupIds[49], $cleanupIds[50], $cleanupIds[51], $cleanupIds[52], $cleanupIds[53], $cleanupIds[54], $cleanupIds[55], $cleanupIds[56], $cleanupIds[57], $cleanupIds[58], $cleanupIds[59], $cleanupIds[60], $cleanupIds[61], $cleanupIds[62], $cleanupIds[63], $cleanupIds[64], $cleanupIds[65], $cleanupIds[66], $cleanupIds[67], $cleanupIds[68], $cleanupIds[69], $cleanupIds[70], $cleanupIds[71], $cleanupIds[72], $cleanupIds[73], $cleanupIds[74], $cleanupIds[75], $cleanupIds[76], $cleanupIds[77], $cleanupIds[78], $cleanupIds[79], $cleanupIds[80], $cleanupIds[81], $cleanupIds[82], $cleanupIds[83], $cleanupIds[84], $cleanupIds[85], $cleanupIds[86], $cleanupIds[87], $cleanupIds[88], $cleanupIds[89], $cleanupIds[90], $cleanupIds[91], $cleanupIds[92], $cleanupIds[93], $cleanupIds[94], $cleanupIds[95], $cleanupIds[96], $cleanupIds[97], $cleanupIds[98], $cleanupIds[99], $cleanupIds[100], $cleanupIds[101], $cleanupIds[102], $cleanupIds[103], $cleanupIds[104], $cleanupIds[105], $cleanupIds[106], $cleanupIds[107], $cleanupIds[108], $cleanupIds[109], $cleanupIds[110], $cleanupIds[111], $cleanupIds[112], $cleanupIds[113], $cleanupIds[114], $cleanupIds[115], $cleanupIds[116], $cleanupIds[117], $cleanupIds[118], $cleanupIds[119], $cleanupIds[120], $cleanupIds[121], $cleanupIds[122], $cleanupIds[123], $cleanupIds[124], $cleanupIds[125], $cleanupIds[126], $cleanupIds[127], $cleanupIds[128], $cleanupIds[129], $cleanupIds[130], $cleanupIds[131], $cleanupIds[132], $cleanupIds[133], $cleanupIds[134], $cleanupIds[135], $cleanupIds[136], $cleanupIds[137], $cleanupIds[138], $cleanupIds[139], $cleanupIds[140], $cleanupIds[141], $cleanupIds[142], $cleanupIds[143], $cleanupIds[144], $cleanupIds[145], $cleanupIds[146], $cleanupIds[147], $cleanupIds[148], $cleanupIds[149], $cleanupIds[150], $cleanupIds[151], $cleanupIds[152], $cleanupIds[153], $cleanupIds[154], $cleanupIds[155], $cleanupIds[156], $cleanupIds[157], $cleanupIds[158], $cleanupIds[159], $cleanupIds[160], $cleanupIds[161], $cleanupIds[162], $cleanupIds[163], $cleanupIds[164], $cleanupIds[165], $cleanupIds[166], $cleanupIds[167], $cleanupIds[168], $cleanupIds[169], $cleanupIds[170], $cleanupIds[171], $cleanupIds[172], $cleanupIds[173], $cleanupIds[174], $cleanupIds[175], $cleanupIds[176], $cleanupIds[177], $cleanupIds[178], $cleanupIds[179], $cleanupIds[180], $cleanupIds[181], $cleanupIds[182], $cleanupIds[183], $cleanupIds[184], $cleanupIds[185], $cleanupIds[186], $cleanupIds[187], $cleanupIds[188], $cleanupIds[189], $cleanupIds[190], $cleanupIds[191], $cleanupIds[192], $cleanupIds[193], $cleanupIds[194], $cleanupIds[195], $cleanupIds[196], $cleanupIds[197], $cleanupIds[198], $cleanupIds[199], $cleanupIds[200], $cleanupIds[201], $cleanupIds[202], $cleanupIds[203], $cleanupIds[204], $cleanupIds[205], $cleanupIds[206], $cleanupIds[207], $cleanupIds[208], $cleanupIds[209], $cleanupIds[210], $cleanupIds[211], $cleanupIds[212], $cleanupIds[213], $cleanupIds[214], $cleanupIds[215], $cleanupIds[216], $cleanupIds[217], $cleanupIds[218], $cleanupIds[219], $cleanupIds[220], $cleanupIds[221], $cleanupIds[222], $cleanupIds[223], $cleanupIds[224], $cleanupIds[225], $cleanupIds[226], $cleanupIds[227], $cleanupIds[228], $cleanupIds[229], $cleanupIds[230], $cleanupIds[231], $cleanupIds[232], $cleanupIds[233], $cleanupIds[234], $cleanupIds[235], $cleanupIds[236], $cleanupIds[237], $cleanupIds[238], $cleanupIds[239], $cleanupIds[240], $cleanupIds[241], $cleanupIds[242], $cleanupIds[243], $cleanupIds[244], $cleanupIds[245], $cleanupIds[246], $cleanupIds[247], $cleanupIds[248], $cleanupIds[249], $cleanupIds[250], $cleanupIds[251], $cleanupIds[252], $cleanupIds[253], $cleanupIds[254], $cleanupIds[255], $cleanupIds[256], $cleanupIds[257], $cleanupIds[258], $cleanupIds[259], $cleanupIds[260], $cleanupIds[261], $cleanupIds[262], $cleanupIds[263], $cleanupIds[264], $cleanupIds[265], $cleanupIds[266], $cleanupIds[267], $cleanupIds[268], $cleanupIds[269], $cleanupIds[270], $cleanupIds[271], $cleanupIds[272], $cleanupIds[273], $cleanupIds[274], $cleanupIds[275], $cleanupIds[276], $cleanupIds[277], $cleanupIds[278], $cleanupIds[279], $cleanupIds[280], $cleanupIds[281], $cleanupIds[282], $cleanupIds[283], $cleanupIds[284], $cleanupIds[285], $cleanupIds[286], $cleanupIds[287], $cleanupIds[288], $cleanupIds[289], $cleanupIds[290], $cleanupIds[291], $cleanupIds[292], $cleanupIds[293], $cleanupIds[294], $cleanupIds[295], $cleanupIds[296], $cleanupIds[297], $cleanupIds[298], $cleanupIds[299], $cleanupIds[300], $cleanupIds[301], $cleanupIds[302], $cleanupIds[303], $cleanupIds[304], $cleanupIds[305], $cleanupIds[306], $cleanupIds[307], $cleanupIds[308], $cleanupIds[309], $cleanupIds[310], $cleanupIds[311], $cleanupIds[312], $cleanupIds[313], $cleanupIds[314], $cleanupIds[315], $cleanupIds[316], $cleanupIds[317], $cleanupIds[318], $cleanupIds[319], $cleanupIds[320], $cleanupIds[321], $cleanupIds[322], $cleanupIds[323], $cleanupIds[324], $cleanupIds[325], $cleanupIds[326], $cleanupIds[327], $cleanupIds[328], $cleanupIds[329], $cleanupIds[330], $cleanupIds[331], $cleanupIds[332], $cleanupIds[333], $cleanupIds[334], $cleanupIds[335], $cleanupIds[336], $cleanupIds[337], $cleanupIds[338], $cleanupIds[339], $cleanupIds[340], $cleanupIds[341], $cleanupIds[342], $cleanupIds[343], $cleanupIds[344], $cleanupIds[345], $cleanupIds[346], $cleanupIds[347], $cleanupIds[348], $cleanupIds[349], $cleanupIds[350], $cleanupIds[351], $cleanupIds[352], $cleanupIds[353], $cleanupIds[354], $cleanupIds[355], $cleanupIds[356], $cleanupIds[357], $cleanupIds[358], $cleanupIds[359], $cleanupIds[360], $cleanupIds[361], $cleanupIds[362], $cleanupIds[363], $cleanupIds[364], $cleanupIds[365], $cleanupIds[366], $cleanupIds[367], $cleanupIds[368], $cleanupIds[369], $cleanupIds[370], $cleanupIds[371], $cleanupIds[372], $cleanupIds[373], $cleanupIds[374], $cleanupIds[375], $cleanupIds[376], $cleanupIds[377], $cleanupIds[378], $cleanupIds[379], $cleanupIds[380], $cleanupIds[381], $cleanupIds[382], $cleanupIds[383], $cleanupIds[384], $cleanupIds[385], $cleanupIds[386], $cleanupIds[387], $cleanupIds[388], $cleanupIds[389], $cleanupIds[390], $cleanupIds[391], $cleanupIds[392], $cleanupIds[393], $cleanupIds[394], $cleanupIds[395], $cleanupIds[396], $cleanupIds[397], $cleanupIds[398], $cleanupIds[399], $cleanupIds[400], $cleanupIds[401], $cleanupIds[402], $cleanupIds[403], $cleanupIds[404], $cleanupIds[405], $cleanupIds[406], $cleanupIds[407], $cleanupIds[408], $cleanupIds[409], $cleanupIds[410], $cleanupIds[411], $cleanupIds[412], $cleanupIds[413], $cleanupIds[414], $cleanupIds[415], $cleanupIds[416], $cleanupIds[417], $cleanupIds[418], $cleanupIds[419], $cleanupIds[420], $cleanupIds[421], $cleanupIds[422], $cleanupIds[423], $cleanupIds[424], $cleanupIds[425], $cleanupIds[426], $cleanupIds[427], $cleanupIds[428], $cleanupIds[429], $cleanupIds[430], $cleanupIds[431], $cleanupIds[432], $cleanupIds[433], $cleanupIds[434], $cleanupIds[435], $cleanupIds[436], $cleanupIds[437], $cleanupIds[438], $cleanupIds[439], $cleanupIds[440], $cleanupIds[441], $cleanupIds[442], $cleanupIds[443], $cleanupIds[444], $cleanupIds[445], $cleanupIds[446], $cleanupIds[447], $cleanupIds[448], $cleanupIds[449], $cleanupIds[450], $cleanupIds[451], $cleanupIds[452], $cleanupIds[453], $cleanupIds[454], $cleanupIds[455], $cleanupIds[456], $cleanupIds[457], $cleanupIds[458], $cleanupIds[459], $cleanupIds[460], $cleanupIds[461], $cleanupIds[462], $cleanupIds[463], $cleanupIds[464], $cleanupIds[465], $cleanupIds[466], $cleanupIds[467], $cleanupIds[468], $cleanupIds[469], $cleanupIds[470], $cleanupIds[471], $cleanupIds[472], $cleanupIds[473], $cleanupIds[474], $cleanupIds[475], $cleanupIds[476], $cleanupIds[477], $cleanupIds[478], $cleanupIds[479], $cleanupIds[480], $cleanupIds[481], $cleanupIds[482], $cleanupIds[483], $cleanupIds[484], $cleanupIds[485], $cleanupIds[486], $cleanupIds[487], $cleanupIds[488], $cleanupIds[489], $cleanupIds[490], $cleanupIds[491], $cleanupIds[492], $cleanupIds[493], $cleanupIds[494], $cleanupIds[495], $cleanupIds[496], $cleanupIds[497], $cleanupIds[498], $cleanupIds[499], $cleanupIds[500], $cleanupIds[501], $cleanupIds[502], $cleanupIds[503], $cleanupIds[504], $cleanupIds[505], $cleanupIds[506], $cleanupIds[507], $cleanupIds[508], $cleanupIds[509], $cleanupIds[510], $cleanupIds[511], $cleanupIds[512], $cleanupIds[513], $cleanupIds[514], $cleanupIds[515], $cleanupIds[516], $cleanupIds[517], $cleanupIds[518], $cleanupIds[519], $cleanupIds[520], $cleanupIds[521], $cleanupIds[522], $cleanupIds[523], $cleanupIds[524], $cleanupIds[525], $cleanupIds[526], $cleanupIds[527], $cleanupIds[528], $cleanupIds[529], $cleanupIds[530], $cleanupIds[531], $cleanupIds[532], $cleanupIds[533], $cleanupIds[534], $cleanupIds[535], $cleanupIds[536], $cleanupIds[537], $cleanupIds[538], $cleanupIds[539], $cleanupIds[540], $cleanupIds[541], $cleanupIds[542], $cleanupIds[543], $cleanupIds[544], $cleanupIds[545], $cleanupIds[546], $cleanupIds[547], $cleanupIds[548], $cleanupIds[549], $cleanupIds[550], $cleanupIds[551], $cleanupIds[552], $cleanupIds[553], $cleanupIds[554], $cleanupIds[555], $cleanupIds[556], $cleanupIds[557], $cleanupIds[558], $cleanupIds[559], $cleanupIds[560], $cleanupIds[561], $cleanupIds[562], $cleanupIds[563], $cleanupIds[564], $cleanupIds[565], $cleanupIds[566], $cleanupIds[567], $cleanupIds[568], $cleanupIds[569], $cleanupIds[570], $cleanupIds[571], $cleanupIds[572], $cleanupIds[573], $cleanupIds[574], $cleanupIds[575], $cleanupIds[576], $cleanupIds[577], $cleanupIds[578], $cleanupIds[579], $cleanupIds[580], $cleanupIds[581], $cleanupIds[582], $cleanupIds[583], $cleanupIds[584], $cleanupIds[585], $cleanupIds[586], $cleanupIds[587], $cleanupIds[588], $cleanupIds[589], $cleanupIds[590], $cleanupIds[591], $cleanupIds[592], $cleanupIds[593], $cleanupIds[594], $cleanupIds[595], $cleanupIds[596], $cleanupIds[597], $cleanupIds[598], $cleanupIds[599], $cleanupIds[600], $cleanupIds[601], $cleanupIds[602], $cleanupIds[603], $cleanupIds[604], $cleanupIds[605], $cleanupIds[606], $cleanupIds[607], $cleanupIds[608], $cleanupIds[609], $cleanupIds[610], $cleanupIds[611], $cleanupIds[612], $cleanupIds[613], $cleanupIds[614], $cleanupIds[615], $cleanupIds[616], $cleanupIds[617], $cleanupIds[618], $cleanupIds[619], $cleanupIds[620], $cleanupIds[621], $cleanupIds[622], $cleanupIds[623], $cleanupIds[624], $cleanupIds[625], $cleanupIds[626], $cleanupIds[627], $cleanupIds[628], $cleanupIds[629], $cleanupIds[630], $cleanupIds[631], $cleanupIds[632], $cleanupIds[633], $cleanupIds[634], $cleanupIds[635], $cleanupIds[636], $cleanupIds[637], $cleanupIds[638], $cleanupIds[639], $cleanupIds[640], $cleanupIds[641], $cleanupIds[642], $cleanupIds[643], $cleanupIds[644], $cleanupIds[645], $cleanupIds[646], $cleanupIds[647], $cleanupIds[648], $cleanupIds[649], $cleanupIds[650], $cleanupIds[651], $cleanupIds[652], $cleanupIds[653], $cleanupIds[654], $cleanupIds[655], $cleanupIds[656], $cleanupIds[657], $cleanupIds[658], $cleanupIds[659], $cleanupIds[660], $cleanupIds[661], $cleanupIds[662], $cleanupIds[663], $cleanupIds[664], $cleanupIds[665], $cleanupIds[666], $cleanupIds[667], $cleanupIds[668], $cleanupIds[669], $cleanupIds[670], $cleanupIds[671], $cleanupIds[672], $cleanupIds[673], $cleanupIds[674], $cleanupIds[675], $cleanupIds[676], $cleanupIds[677], $cleanupIds[678], $cleanupIds[679], $cleanupIds[680], $cleanupIds[681], $cleanupIds[682], $cleanupIds[683], $cleanupIds[684], $cleanupIds[685], $cleanupIds[686], $cleanupIds[687], $cleanupIds[688], $cleanupIds[689], $cleanupIds[690], $cleanupIds[691], $cleanupIds[692], $cleanupIds[693], $cleanupIds[694], $cleanupIds[695], $cleanupIds[696], $cleanupIds[697], $cleanupIds[698], $cleanupIds[699], $cleanupIds[700], $cleanupIds[701], $cleanupIds[702], $cleanupIds[703], $cleanupIds[704], $cleanupIds[705], $cleanupIds[706], $cleanupIds[707], $cleanupIds[708], $cleanupIds[709], $cleanupIds[710], $cleanupIds[711], $cleanupIds[712], $cleanupIds[713], $cleanupIds[714], $cleanupIds[715], $cleanupIds[716], $cleanupIds[717], $cleanupIds[718], $cleanupIds[719], $cleanupIds[720], $cleanupIds[721], $cleanupIds[722], $cleanupIds[723], $cleanupIds[724], $cleanupIds[725], $cleanupIds[726], $cleanupIds[727], $cleanupIds[728], $cleanupIds[729], $cleanupIds[730], $cleanupIds[731], $cleanupIds[732], $cleanupIds[733], $cleanupIds[734], $cleanupIds[735], $cleanupIds[736], $cleanupIds[737], $cleanupIds[738], $cleanupIds[739], $cleanupIds[740], $cleanupIds[741], $cleanupIds[742], $cleanupIds[743], $cleanupIds[744], $cleanupIds[745], $cleanupIds[746], $cleanupIds[747], $cleanupIds[748], $cleanupIds[749], $cleanupIds[750], $cleanupIds[751], $cleanupIds[752], $cleanupIds[753], $cleanupIds[754], $cleanupIds[755], $cleanupIds[756], $cleanupIds[757], $cleanupIds[758], $cleanupIds[759], $cleanupIds[760], $cleanupIds[761], $cleanupIds[762], $cleanupIds[763], $cleanupIds[764], $cleanupIds[765], $cleanupIds[766], $cleanupIds[767], $cleanupIds[768], $cleanupIds[769], $cleanupIds[770], $cleanupIds[771], $cleanupIds[772], $cleanupIds[773], $cleanupIds[774], $cleanupIds[775], $cleanupIds[776], $cleanupIds[777], $cleanupIds[778], $cleanupIds[779], $cleanupIds[780], $cleanupIds[781], $cleanupIds[782], $cleanupIds[783], $cleanupIds[784], $cleanupIds[785], $cleanupIds[786], $cleanupIds[787], $cleanupIds[788], $cleanupIds[789], $cleanupIds[790], $cleanupIds[791], $cleanupIds[792], $cleanupIds[793], $cleanupIds[794], $cleanupIds[795], $cleanupIds[796], $cleanupIds[797], $cleanupIds[798], $cleanupIds[799], $cleanupIds[800], $cleanupIds[801], $cleanupIds[802], $cleanupIds[803], $cleanupIds[804], $cleanupIds[805], $cleanupIds[806], $cleanupIds[807], $cleanupIds[808], $cleanupIds[809], $cleanupIds[810], $cleanupIds[811], $cleanupIds[812], $cleanupIds[813], $cleanupIds[814], $cleanupIds[815], $cleanupIds[816], $cleanupIds[817], $cleanupIds[818], $cleanupIds[819], $cleanupIds[820], $cleanupIds[821], $cleanupIds[822], $cleanupIds[823], $cleanupIds[824], $cleanupIds[825], $cleanupIds[826], $cleanupIds[827], $cleanupIds[828], $cleanupIds[829], $cleanupIds[830], $cleanupIds[831], $cleanupIds[832], $cleanupIds[833], $cleanupIds[834], $cleanupIds[835], $cleanupIds[836], $cleanupIds[837], $cleanupIds[838], $cleanupIds[839], $cleanupIds[840], $cleanupIds[841], $cleanupIds[842], $cleanupIds[843], $cleanupIds[844], $cleanupIds[845], $cleanupIds[846], $cleanupIds[847], $cleanupIds[848], $cleanupIds[849], $cleanupIds[850], $cleanupIds[851], $cleanupIds[852], $cleanupIds[853], $cleanupIds[854], $cleanupIds[855], $cleanupIds[856], $cleanupIds[857], $cleanupIds[858], $cleanupIds[859], $cleanupIds[860], $cleanupIds[861], $cleanupIds[862], $cleanupIds[863], $cleanupIds[864], $cleanupIds[865], $cleanupIds[866], $cleanupIds[867], $cleanupIds[868], $cleanupIds[869], $cleanupIds[870], $cleanupIds[871], $cleanupIds[872], $cleanupIds[873], $cleanupIds[874], $cleanupIds[875], $cleanupIds[876], $cleanupIds[877], $cleanupIds[878], $cleanupIds[879], $cleanupIds[880], $cleanupIds[881], $cleanupIds[882], $cleanupIds[883], $cleanupIds[884], $cleanupIds[885], $cleanupIds[886], $cleanupIds[887], $cleanupIds[888], $cleanupIds[889], $cleanupIds[890], $cleanupIds[891], $cleanupIds[892], $cleanupIds[893], $cleanupIds[894], $cleanupIds[895], $cleanupIds[896], $cleanupIds[897], $cleanupIds[898], $cleanupIds[899], $cleanupIds[900], $cleanupIds[901], $cleanupIds[902], $cleanupIds[903], $cleanupIds[904], $cleanupIds[905], $cleanupIds[906], $cleanupIds[907], $cleanupIds[908], $cleanupIds[909], $cleanupIds[910], $cleanupIds[911], $cleanupIds[912], $cleanupIds[913], $cleanupIds[914], $cleanupIds[915], $cleanupIds[916], $cleanupIds[917], $cleanupIds[918], $cleanupIds[919], $cleanupIds[920], $cleanupIds[921], $cleanupIds[922], $cleanupIds[923], $cleanupIds[924], $cleanupIds[925], $cleanupIds[926], $cleanupIds[927], $cleanupIds[928], $cleanupIds[929], $cleanupIds[930], $cleanupIds[931], $cleanupIds[932], $cleanupIds[933], $cleanupIds[934], $cleanupIds[935], $cleanupIds[936], $cleanupIds[937], $cleanupIds[938], $cleanupIds[939], $cleanupIds[940], $cleanupIds[941], $cleanupIds[942], $cleanupIds[943], $cleanupIds[944], $cleanupIds[945], $cleanupIds[946], $cleanupIds[947], $cleanupIds[948], $cleanupIds[949], $cleanupIds[950], $cleanupIds[951], $cleanupIds[952], $cleanupIds[953], $cleanupIds[954], $cleanupIds[955], $cleanupIds[956], $cleanupIds[957], $cleanupIds[958], $cleanupIds[959], $cleanupIds[960], $cleanupIds[961], $cleanupIds[962], $cleanupIds[963], $cleanupIds[964], $cleanupIds[965], $cleanupIds[966], $cleanupIds[967], $cleanupIds[968], $cleanupIds[969], $cleanupIds[970], $cleanupIds[971], $cleanupIds[972], $cleanupIds[973], $cleanupIds[974], $cleanupIds[975], $cleanupIds[976], $cleanupIds[977], $cleanupIds[978], $cleanupIds[979], $cleanupIds[980], $cleanupIds[981], $cleanupIds[982], $cleanupIds[983], $cleanupIds[984], $cleanupIds[985], $cleanupIds[986], $cleanupIds[987], $cleanupIds[988], $cleanupIds[989], $cleanupIds[990], $cleanupIds[991], $cleanupIds[992], $cleanupIds[993], $cleanupIds[994], $cleanupIds[995], $cleanupIds[996], $cleanupIds[997], $cleanupIds[998], $cleanupIds[999], $cleanupIds[1000], $cleanupIds[1001], $cleanupIds[1002], $cleanupIds[1003], $cleanupIds[1004], $cleanupIds[1005], $cleanupIds[1006], $cleanupIds[1007], $cleanupIds[1008], $cleanupIds[1009], $cleanupIds[1010], $cleanupIds[1011], $cleanupIds[1012], $cleanupIds[1013], $cleanupIds[1014], $cleanupIds[1015], $cleanupIds[1016], $cleanupIds[1017], $cleanupIds[1018], $cleanupIds[1019], $cleanupIds[1020], $cleanupIds[1021], $cleanupIds[1022], $cleanupIds[1023], $cleanupIds[1024], $cleanupIds[1025], $cleanupIds[1026], $cleanupIds[1027], $cleanupIds[1028], $cleanupIds[1029], $cleanupIds[1030], $cleanupIds[1031], $cleanupIds[1032], $cleanupIds[1033], $cleanupIds[1034], $cleanupIds[1035], $cleanupIds[1036], $cleanupIds[1037], $cleanupIds[1038], $cleanupIds[1039], $cleanupIds[1040], $cleanupIds[1041], $cleanupIds[1042], $cleanupIds[1043], $cleanupIds[1044], $cleanupIds[1045], $cleanupIds[1046], $cleanupIds[1047], $cleanupIds[1048], $cleanupIds[1049], $cleanupIds[1050], $cleanupIds[1051], $cleanupIds[1052], $cleanupIds[1053], $cleanupIds[1054], $cleanupIds[1055], $cleanupIds[1056], $cleanupIds[1057], $cleanupIds[1058], $cleanupIds[1059], $cleanupIds[1060], $cleanupIds[1061], $cleanupIds[1062], $cleanupIds[1063], $cleanupIds[1064], $cleanupIds[1065], $cleanupIds[1066], $cleanupIds[1067], $cleanupIds[1068], $cleanupIds[1069], $cleanupIds[1070], $cleanupIds[1071], $cleanupIds[1072], $cleanupIds[1073], $cleanupIds[1074], $cleanupIds[1075], $cleanupIds[1076], $cleanupIds[1077], $cleanupIds[1078], $cleanupIds[1079], $cleanupIds[1080], $cleanupIds[1081], $cleanupIds[1082], $cleanupIds[1083], $cleanupIds[1084], $cleanupIds[1085], $cleanupIds[1086], $cleanupIds[1087], $cleanupIds[1088], $cleanupIds[1089], $cleanupIds[1090], $cleanupIds[1091], $cleanupIds[1092], $cleanupIds[1093], $cleanupIds[1094], $cleanupIds[1095], $cleanupIds[1096], $cleanupIds[1097], $cleanupIds[1098], $cleanupIds[1099], $cleanupIds[1100], $cleanupIds[1101], $cleanupIds[1102], $cleanupIds[1103], $cleanupIds[1104], $cleanupIds[1105], $cleanupIds[1106], $cleanupIds[1107], $cleanupIds[1108], $cleanupIds[1109], $cleanupIds[1110], $cleanupIds[1111], $cleanupIds[1112], $cleanupIds[1113], $cleanupIds[1114], $cleanupIds[1115], $cleanupIds[1116], $cleanupIds[1117], $cleanupIds[1118], $cleanupIds[1119], $cleanupIds[1120], $cleanupIds[1121], $cleanupIds[1122], $cleanupIds[1123], $cleanupIds[1124], $cleanupIds[1125], $cleanupIds[1126], $cleanupIds[1127], $cleanupIds[1128], $cleanupIds[1129], $cleanupIds[1130], $cleanupIds[1131], $cleanupIds[1132], $cleanupIds[1133], $cleanupIds[1134], $cleanupIds[1135], $cleanupIds[1136], $cleanupIds[1137], $cleanupIds[1138], $cleanupIds[1139], $cleanupIds[1140], $cleanupIds[1141], $cleanupIds[1142], $cleanupIds[1143], $cleanupIds[1144], $cleanupIds[1145], $cleanupIds[1146], $cleanupIds[1147], $cleanupIds[1148], $cleanupIds[1149], $cleanupIds[1150], $cleanupIds[1151], $cleanupIds[1152], $cleanupIds[1153], $cleanupIds[1154], $cleanupIds[1155], $cleanupIds[1156], $cleanupIds[1157], $cleanupIds[1158], $cleanupIds[1159], $cleanupIds[1160], $cleanupIds[1161], $cleanupIds[1162], $cleanupIds[1163], $cleanupIds[1164], $cleanupIds[1165], $cleanupIds[1166], $cleanupIds[1167], $cleanupIds[1168], $cleanupIds[1169], $cleanupIds[1170], $cleanupIds[1171], $cleanupIds[1172], $cleanupIds[1173], $cleanupIds[1174], $cleanupIds[1175], $cleanupIds[1176], $cleanupIds[1177], $cleanupIds[1178], $cleanupIds[1179], $cleanupIds[1180], $cleanupIds[1181], $cleanupIds[1182], $cleanupIds[1183], $cleanupIds[1184], $cleanupIds[1185], $cleanupIds[1186], $cleanupIds[1187], $cleanupIds[1188], $cleanupIds[1189], $cleanupIds[1190], $cleanupIds[1191], $cleanupIds[1192], $cleanupIds[1193], $cleanupIds[1194], $cleanupIds[1195], $cleanupIds[1196], $cleanupIds[1197], $cleanupIds[1198], $cleanupIds[1199], $cleanupIds[1200], $cleanupIds[1201], $cleanupIds[1202], $cleanupIds[1203], $cleanupIds[1204], $cleanupIds[1205], $cleanupIds[1206], $cleanupIds[1207], $cleanupIds[1208], $cleanupIds[1209], $cleanupIds[1210], $cleanupIds[1211], $cleanupIds[1212], $cleanupIds[1213], $cleanupIds[1214], $cleanupIds[1215], $cleanupIds[1216], $cleanupIds[1217], $cleanupIds[1218], $cleanupIds[1219], $cleanupIds[1220], $cleanupIds[1221], $cleanupIds[1222], $cleanupIds[1223], $cleanupIds[1224], $cleanupIds[1225], $cleanupIds[1226], $cleanupIds[1227], $cleanupIds[1228], $cleanupIds[1229], $cleanupIds[1230], $cleanupIds[1231], $cleanupIds[1232], $cleanupIds[1233], $cleanupIds[1234], $cleanupIds[1235], $cleanupIds[1236], $cleanupIds[1237], $cleanupIds[1238], $cleanupIds[1239], $cleanupIds[1240], $cleanupIds[1241], $cleanupIds[1242], $cleanupIds[1243], $cleanupIds[1244], $cleanupIds[1245], $cleanupIds[1246], $cleanupIds[1247], $cleanupIds[1248], $cleanupIds[1249], $cleanupIds[1250], $cleanupIds[1251], $cleanupIds[1252], $cleanupIds[1253], $cleanupIds[1254], $cleanupIds[1255], $cleanupIds[1256], $cleanupIds[1257], $cleanupIds[1258], $cleanupIds[1259], $cleanupIds[1260], $cleanupIds[1261], $cleanupIds[1262], $cleanupIds[1263], $cleanupIds[1264], $cleanupIds[1265], $cleanupIds[1266], $cleanupIds[1267], $cleanupIds[1268], $cleanupIds[1269], $cleanupIds[1270], $cleanupIds[1271], $cleanupIds[1272], $cleanupIds[1273], $cleanupIds[1274], $cleanupIds[1275], $cleanupIds[1276], $cleanupIds[1277], $cleanupIds[1278], $cleanupIds[1279], $cleanupIds[1280], $cleanupIds[1281], $cleanupIds[1282], $cleanupIds[1283], $cleanupIds[1284], $cleanupIds[1285], $cleanupIds[1286], $cleanupIds[1287], $cleanupIds[1288], $cleanupIds[1289], $cleanupIds[1290], $cleanupIds[1291], $cleanupIds[1292], $cleanupIds[1293], $cleanupIds[1294], $cleanupIds[1295], $cleanupIds[1296], $cleanupIds[1297], $cleanupIds[1298], $cleanupIds[1299], $cleanupIds[1300], $cleanupIds[1301], $cleanupIds[1302], $cleanupIds[1303], $cleanupIds[1304], $cleanupIds[1305], $cleanupIds[1306], $cleanupIds[1307], $cleanupIds[1308], $cleanupIds[1309], $cleanupIds[1310], $cleanupIds[1311], $cleanupIds[1312], $cleanupIds[1313], $cleanupIds[1314], $cleanupIds[1315], $cleanupIds[1316], $cleanupIds[1317], $cleanupIds[1318], $cleanupIds[1319], $cleanupIds[1320], $cleanupIds[1321], $cleanupIds[1322], $cleanupIds[1323], $cleanupIds[1324], $cleanupIds[1325], $cleanupIds[1326], $cleanupIds[1327], $cleanupIds[1328], $cleanupIds[1329], $cleanupIds[1330], $cleanupIds[1331], $cleanupIds[1332], $cleanupIds[1333], $cleanupIds[1334], $cleanupIds[1335], $cleanupIds[1336], $cleanupIds[1337], $cleanupIds[1338], $cleanupIds[1339], $cleanupIds[1340], $cleanupIds[1341], $cleanupIds[1342], $cleanupIds[1343], $cleanupIds[1344], $cleanupIds[1345], $cleanupIds[1346], $cleanupIds[1347], $cleanupIds[1348], $cleanupIds[1349], $cleanupIds[1350], $cleanupIds[1351], $cleanupIds[1352], $cleanupIds[1353], $cleanupIds[1354], $cleanupIds[1355], $cleanupIds[1356], $cleanupIds[1357], $cleanupIds[1358], $cleanupIds[1359], $cleanupIds[1360], $cleanupIds[1361], $cleanupIds[1362], $cleanupIds[1363], $cleanupIds[1364], $cleanupIds[1365], $cleanupIds[1366], $cleanupIds[1367], $cleanupIds[1368], $cleanupIds[1369], $cleanupIds[1370], $cleanupIds[1371], $cleanupIds[1372], $cleanupIds[1373], $cleanupIds[1374], $cleanupIds[1375], $cleanupIds[1376], $cleanupIds[1377], $cleanupIds[1378], $cleanupIds[1379], $cleanupIds[1380], $cleanupIds[1381], $cleanupIds[1382], $cleanupIds[1383], $cleanupIds[1384], $cleanupIds[1385], $cleanupIds[1386], $cleanupIds[1387], $cleanupIds[1388], $cleanupIds[1389], $cleanupIds[1390], $cleanupIds[1391], $cleanupIds[1392], $cleanupIds[1393], $cleanupIds[1394], $cleanupIds[1395], $cleanupIds[1396], $cleanupIds[1397], $cleanupIds[1398], $cleanupIds[1399], $cleanupIds[1400], $cleanupIds[1401], $cleanupIds[1402], $cleanupIds[1403], $cleanupIds[1404], $cleanupIds[1405], $cleanupIds[1406], $cleanupIds[1407], $cleanupIds[1408], $cleanupIds[1409], $cleanupIds[1410], $cleanupIds[1411], $cleanupIds[1412], $cleanupIds[1413], $cleanupIds[1414], $cleanupIds[1415], $cleanupIds[1416], $cleanupIds[1417], $cleanupIds[1418], $cleanupIds[1419], $cleanupIds[1420], $cleanupIds[1421], $cleanupIds[1422], $cleanupIds[1423], $cleanupIds[1424], $cleanupIds[1425], $cleanupIds[1426], $cleanupIds[1427], $cleanupIds[1428], $cleanupIds[1429], $cleanupIds[1430], $cleanupIds[1431], $cleanupIds[1432], $cleanupIds[1433], $cleanupIds[1434], $cleanupIds[1435], $cleanupIds[1436], $cleanupIds[1437], $cleanupIds[1438], $cleanupIds[1439], $cleanupIds[1440], $cleanupIds[1441], $cleanupIds[1442], $cleanupIds[1443], $cleanupIds[1444], $cleanupIds[1445], $cleanupIds[1446], $cleanupIds[1447], $cleanupIds[1448], $cleanupIds[1449], $cleanupIds[1450], $cleanupIds[1451], $cleanupIds[1452], $cleanupIds[1453], $cleanupIds[1454], $cleanupIds[1455], $cleanupIds[1456], $cleanupIds[1457], $cleanupIds[1458], $cleanupIds[1459], $cleanupIds[1460], $cleanupIds[1461], $cleanupIds[1462], $cleanupIds[1463], $cleanupIds[1464], $cleanupIds[1465], $cleanupIds[1466], $cleanupIds[1467], $cleanupIds[1468], $cleanupIds[1469], $cleanupIds[1470], $cleanupIds[1471], $cleanupIds[1472], $cleanupIds[1473], $cleanupIds[1474], $cleanupIds[1475], $cleanupIds[1476], $cleanupIds[1477], $cleanupIds[1478], $cleanupIds[1479], $cleanupIds[1480], $cleanupIds[1481], $cleanupIds[1482], $cleanupIds[1483], $cleanupIds[1484], $cleanupIds[1485], $cleanupIds[1486], $cleanupIds[1487], $cleanupIds[1488], $cleanupIds[1489], $cleanupIds[1490], $cleanupIds[1491], $cleanupIds[1492], $cleanupIds[1493], $cleanupIds[1494], $cleanupIds[1495], $cleanupIds[1496], $cleanupIds[1497], $cleanupIds[1498], $cleanupIds[1499], $cleanupIds[1500], $cleanupIds[1501], $cleanupIds[1502], $cleanupIds[1503], $cleanupIds[1504], $cleanupIds[1505], $cleanupIds[1506], $cleanupIds[1507], $cleanupIds[1508], $cleanupIds[1509], $cleanupIds[1510], $cleanupIds[1511], $cleanupIds[1512], $cleanupIds[1513], $cleanupIds[1514], $cleanupIds[1515], $cleanupIds[1516], $cleanupIds[1517], $cleanupIds[1518], $cleanupIds[1519], $cleanupIds[1520], $cleanupIds[1521], $cleanupIds[1522], $cleanupIds[1523], $cleanupIds[1524], $cleanupIds[1525], $cleanupIds[1526], $cleanupIds[1527], $cleanupIds[1528], $cleanupIds[1529], $cleanupIds[1530], $cleanupIds[1531], $cleanupIds[1532], $cleanupIds[1533], $cleanupIds[1534], $cleanupIds[1535], $cleanupIds[1536], $cleanupIds[1537], $cleanupIds[1538], $cleanupIds[1539], $cleanupIds[1540], $cleanupIds[1541], $cleanupIds[1542], $cleanupIds[1543], $cleanupIds[1544], $cleanupIds[1545], $cleanupIds[1546], $cleanupIds[1547], $cleanupIds[1548], $cleanupIds[1549], $cleanupIds[1550], $cleanupIds[1551], $cleanupIds[1552], $cleanupIds[1553], $cleanupIds[1554], $cleanupIds[1555], $cleanupIds[1556], $cleanupIds[1557], $cleanupIds[1558], $cleanupIds[1559], $cleanupIds[1560], $cleanupIds[1561], $cleanupIds[1562], $cleanupIds[1563], $cleanupIds[1564], $cleanupIds[1565], $cleanupIds[1566], $cleanupIds[1567], $cleanupIds[1568], $cleanupIds[1569], $cleanupIds[1570], $cleanupIds[1571], $cleanupIds[1572], $cleanupIds[1573], $cleanupIds[1574], $cleanupIds[1575], $cleanupIds[1576], $cleanupIds[1577], $cleanupIds[1578], $cleanupIds[1579], $cleanupIds[1580], $cleanupIds[1581], $cleanupIds[1582], $cleanupIds[1583], $cleanupIds[1584], $cleanupIds[1585], $cleanupIds[1586], $cleanupIds[1587], $cleanupIds[1588], $cleanupIds[1589], $cleanupIds[1590], $cleanupIds[1591], $cleanupIds[1592], $cleanupIds[1593], $cleanupIds[1594], $cleanupIds[1595], $cleanupIds[1596], $cleanupIds[1597], $cleanupIds[1598], $cleanupIds[1599], $cleanupIds[1600], $cleanupIds[1601], $cleanupIds[1602], $cleanupIds[1603], $cleanupIds[1604], $cleanupIds[1605], $cleanupIds[1606], $cleanupIds[1607], $cleanupIds[1608], $cleanupIds[1609], $cleanupIds[1610], $cleanupIds[1611], $cleanupIds[1612], $cleanupIds[1613], $cleanupIds[1614], $cleanupIds[1615], $cleanupIds[1616], $cleanupIds[1617], $cleanupIds[1618], $cleanupIds[1619], $cleanupIds[1620], $cleanupIds[1621], $cleanupIds[1622], $cleanupIds[1623], $cleanupIds[1624], $cleanupIds[1625], $cleanupIds[1626], $cleanupIds[1627], $cleanupIds[1628], $cleanupIds[1629], $cleanupIds[1630], $cleanupIds[1631], $cleanupIds[1632], $cleanupIds[1633], $cleanupIds[1634], $cleanupIds[1635], $cleanupIds[1636], $cleanupIds[1637], $cleanupIds[1638], $cleanupIds[1639], $cleanupIds[1640], $cleanupIds[1641], $cleanupIds[1642], $cleanupIds[1643], $cleanupIds[1644], $cleanupIds[1645], $cleanupIds[1646], $cleanupIds[1647], $cleanupIds[1648], $cleanupIds[1649], $cleanupIds[1650], $cleanupIds[1651], $cleanupIds[1652], $cleanupIds[1653], $cleanupIds[1654], $cleanupIds[1655], $cleanupIds[1656], $cleanupIds[1657], $cleanupIds[1658], $cleanupIds[1659], $cleanupIds[1660], $cleanupIds[1661], $cleanupIds[1662], $cleanupIds[1663], $cleanupIds[1664], $cleanupIds[1665], $cleanupIds[1666], $cleanupIds[1667], $cleanupIds[1668], $cleanupIds[1669], $cleanupIds[1670], $cleanupIds[1671], $cleanupIds[1672], $cleanupIds[1673], $cleanupIds[1674], $cleanupIds[1675], $cleanupIds[1676], $cleanupIds[1677], $cleanupIds[1678], $cleanupIds[1679], $cleanupIds[1680], $cleanupIds[1681], $cleanupIds[1682], $cleanupIds[1683], $cleanupIds[1684], $cleanupIds[1685], $cleanupIds[1686], $cleanupIds[1687], $cleanupIds[1688], $cleanupIds[1689], $cleanupIds[1690], $cleanupIds[1691], $cleanupIds[1692], $cleanupIds[1693], $cleanupIds[1694], $cleanupIds[1695], $cleanupIds[1696], $cleanupIds[1697], $cleanupIds[1698], $cleanupIds[1699], $cleanupIds[1700], $cleanupIds[1701], $cleanupIds[1702], $cleanupIds[1703], $cleanupIds[1704], $cleanupIds[1705], $cleanupIds[1706], $cleanupIds[1707], $cleanupIds[1708], $cleanupIds[1709], $cleanupIds[1710], $cleanupIds[1711], $cleanupIds[1712], $cleanupIds[1713], $cleanupIds[1714], $cleanupIds[1715], $cleanupIds[1716], $cleanupIds[1717], $cleanupIds[1718], $cleanupIds[1719], $cleanupIds[1720], $cleanupIds[1721], $cleanupIds[1722], $cleanupIds[1723], $cleanupIds[1724], $cleanupIds[1725], $cleanupIds[1726], $cleanupIds[1727], $cleanupIds[1728], $cleanupIds[1729], $cleanupIds[1730], $cleanupIds[1731], $cleanupIds[1732], $cleanupIds[1733], $cleanupIds[1734], $cleanupIds[1735], $cleanupIds[1736], $cleanupIds[1737], $cleanupIds[1738], $cleanupIds[1739], $cleanupIds[1740], $cleanupIds[1741], $cleanupIds[1742], $cleanupIds[1743], $cleanupIds[1744], $cleanupIds[1745], $cleanupIds[1746], $cleanupIds[1747], $cleanupIds[1748], $cleanupIds[1749], $cleanupIds[1750], $cleanupIds[1751], $cleanupIds[1752], $cleanupIds[1753], $cleanupIds[1754], $cleanupIds[1755], $cleanupIds[1756], $cleanupIds[1757], $cleanupIds[1758], $cleanupIds[1759], $cleanupIds[1760], $cleanupIds[1761], $cleanupIds[1762], $cleanupIds[1763], $cleanupIds[1764], $cleanupIds[1765], $cleanupIds[1766], $cleanupIds[1767], $cleanupIds[1768], $cleanupIds[1769], $cleanupIds[1770], $cleanupIds[1771], $cleanupIds[1772], $cleanupIds[1773], $cleanupIds[1774], $cleanupIds[1775], $cleanupIds[1776], $cleanupIds[1777], $cleanupIds[1778], $cleanupIds[1779], $cleanupIds[1780], $cleanupIds[1781], $cleanupIds[1782], $cleanupIds[1783], $cleanupIds[1784], $cleanupIds[1785], $cleanupIds[1786], $cleanupIds[1787], $cleanupIds[1788], $cleanupIds[1789], $cleanupIds[1790], $cleanupIds[1791], $cleanupIds[1792], $cleanupIds[1793], $cleanupIds[1794], $cleanupIds[1795], $cleanupIds[1796], $cleanupIds[1797], $cleanupIds[1798], $cleanupIds[1799], $cleanupIds[1800], $cleanupIds[1801], $cleanupIds[1802], $cleanupIds[1803], $cleanupIds[1804], $cleanupIds[1805], $cleanupIds[1806], $cleanupIds[1807], $cleanupIds[1808], $cleanupIds[1809], $cleanupIds[1810], $cleanupIds[1811], $cleanupIds[1812], $cleanupIds[1813], $cleanupIds[1814], $cleanupIds[1815], $cleanupIds[1816], $cleanupIds[1817], $cleanupIds[1818], $cleanupIds[1819], $cleanupIds[1820], $cleanupIds[1821], $cleanupIds[1822], $cleanupIds[1823], $cleanupIds[1824], $cleanupIds[1825], $cleanupIds[1826], $cleanupIds[1827], $cleanupIds[1828], $cleanupIds[1829], $cleanupIds[1830], $cleanupIds[1831], $cleanupIds[1832], $cleanupIds[1833], $cleanupIds[1834], $cleanupIds[1835], $cleanupIds[1836], $cleanupIds[1837], $cleanupIds[1838], $cleanupIds[1839], $cleanupIds[1840], $cleanupIds[1841], $cleanupIds[1842], $cleanupIds[1843], $cleanupIds[1844], $cleanupIds[1845], $cleanupIds[1846], $cleanupIds[1847], $cleanupIds[1848], $cleanupIds[1849], $cleanupIds[1850], $cleanupIds[1851], $cleanupIds[1852], $cleanupIds[1853], $cleanupIds[1854], $cleanupIds[1855], $cleanupIds[1856], $cleanupIds[1857], $cleanupIds[1858], $cleanupIds[1859], $cleanupIds[1860], $cleanupIds[1861], $cleanupIds[1862], $cleanupIds[1863], $cleanupIds[1864], $cleanupIds[1865], $cleanupIds[1866], $cleanupIds[1867], $cleanupIds[1868], $cleanupIds[1869], $cleanupIds[1870], $cleanupIds[1871], $cleanupIds[1872], $cleanupIds[1873], $cleanupIds[1874], $cleanupIds[1875], $cleanupIds[1876], $cleanupIds[1877], $cleanupIds[1878], $cleanupIds[1879], $cleanupIds[1880], $cleanupIds[1881], $cleanupIds[1882], $cleanupIds[1883], $cleanupIds[1884], $cleanupIds[1885], $cleanupIds[1886], $cleanupIds[1887], $cleanupIds[1888], $cleanupIds[1889], $cleanupIds[1890], $cleanupIds[1891], $cleanupIds[1892], $cleanupIds[1893], $cleanupIds[1894], $cleanupIds[1895], $cleanupIds[1896], $cleanupIds[1897], $cleanupIds[1898], $cleanupIds[1899], $cleanupIds[1900], $cleanupIds[1901], $cleanupIds[1902], $cleanupIds[1903], $cleanupIds[1904], $cleanupIds[1905], $cleanupIds[1906], $cleanupIds[1907], $cleanupIds[1908], $cleanupIds[1909], $cleanupIds[1910], $cleanupIds[1911], $cleanupIds[1912], $cleanupIds[1913], $cleanupIds[1914], $cleanupIds[1915], $cleanupIds[1916], $cleanupIds[1917], $cleanupIds[1918], $cleanupIds[1919], $cleanupIds[1920], $cleanupIds[1921], $cleanupIds[1922], $cleanupIds[1923], $cleanupIds[1924], $cleanupIds[1925], $cleanupIds[1926], $cleanupIds[1927], $cleanupIds[1928], $cleanupIds[1929], $cleanupIds[1930], $cleanupIds[1931], $cleanupIds[1932], $cleanupIds[1933], $cleanupIds[1934], $cleanupIds[1935], $cleanupIds[1936], $cleanupIds[1937], $cleanupIds[1938], $cleanupIds[1939], $cleanupIds[1940], $cleanupIds[1941], $cleanupIds[1942], $cleanupIds[1943], $cleanupIds[1944], $cleanupIds[1945], $cleanupIds[1946], $cleanupIds[1947], $cleanupIds[1948], $cleanupIds[1949], $cleanupIds[1950], $cleanupIds[1951], $cleanupIds[1952], $cleanupIds[1953], $cleanupIds[1954], $cleanupIds[1955], $cleanupIds[1956], $cleanupIds[1957], $cleanupIds[1958], $cleanupIds[1959], $cleanupIds[1960], $cleanupIds[1961], $cleanupIds[1962], $cleanupIds[1963], $cleanupIds[1964], $cleanupIds[1965], $cleanupIds[1966], $cleanupIds[1967], $cleanupIds[1968], $cleanupIds[1969], $cleanupIds[1970], $cleanupIds[1971], $cleanupIds[1972], $cleanupIds[1973], $cleanupIds[1974], $cleanupIds[1975], $cleanupIds[1976], $cleanupIds[1977], $cleanupIds[1978], $cleanupIds[1979], $cleanupIds[1980], $cleanupIds[1981], $cleanupIds[1982], $cleanupIds[1983], $cleanupIds[1984], $cleanupIds[1985], $cleanupIds[1986], $cleanupIds[1987], $cleanupIds[1988], $cleanupIds[1989], $cleanupIds[1990], $cleanupIds[1991], $cleanupIds[1992], $cleanupIds[1993], $cleanupIds[1994], $cleanupIds[1995], $cleanupIds[1996], $cleanupIds[1997], $cleanupIds[1998], $cleanupIds[1999], $cleanupIds[2000], $cleanupIds[2001], $cleanupIds[2002], $cleanupIds[2003], $cleanupIds[2004], $cleanupIds[2005], $cleanupIds[2006]); - /* execute query */ - $stmt->execute(); + /* execute query */ + $stmt->execute(); - /* close statement */ - $stmt->close(); - } + /* close statement */ + $stmt->close(); + } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_bind_limits.phpt b/ext/mysqli/tests/mysqli_stmt_bind_limits.phpt index 0b1d41a176..44ab45c257 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_limits.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_limits.phpt @@ -8,108 +8,108 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - function bind_many($offset, $link, $num_params, $rows, $eval = true) { - - $drop = "DROP TABLE IF EXISTS test"; - $create = "CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, "; - $insert = "INSERT INTO test"; - $columns = ""; - $values = ""; - $stmt_params = ""; - $params = array(); - for ($i = 0; $i < $num_params; $i++) { - $create .= "col" . $i . " INT, "; - $columns .= "col" . $i . ", "; - $values .= "?, "; - $stmt_params .= '$params[' . $i . '], '; - for ($j = 0; $j < $rows; $j++) - $params[($j * $rows) + $i] = $i; - } - $create = substr($create, 0, -2) . ")"; - - $stmt_types = str_repeat("i", $num_params * $rows); - $stmt_params = substr(str_repeat($stmt_params, $rows), 0, -2); - $values = substr($values, 0, -2); - $insert .= "(" . substr($columns, 0, -2) . ") VALUES "; - $insert .= substr(str_repeat("(" . $values . "), ", $rows), 0, -2); - - $stmt_bind_param = 'return mysqli_stmt_bind_param($stmt, "' . $stmt_types . '", ' . $stmt_params . ');'; - - printf("Testing %d columns with %d rows...\n", $num_params, $rows); - - if (!$link->query($drop) || !$link->query($create)) { - printf("[%03d + 01] [%d] %s\n", $offset, $link->errno, $link->error); - return false; - } - printf("... table created\n"); - - if (!$stmt = $link->prepare($insert)) { - printf("[%03d + 02] [%d] %s\n", $offset, $link->errno, $link->error); - return false; - } - if ($stmt->param_count != $num_params * $rows) { - printf("[%03d + 03] Parameter count should be %d but got %d\n", $offset, $num_params * $rows, $stmt->param_count); - return false; - } - printf("... statement with %d parameters prepared\n", $stmt->param_count); - - if ($eval) { - if (!eval($stmt_bind_param)) { - printf("[%03d + 03] [%d] %s\n", $offset, $stmt->errno, $stmt->error); - return false; - } - } else { - $param_ref = array($stmt_types); - for ($i = 0; $i < $rows; $i++) - for ($j = 0; $j < $num_params; $j++) - $param_ref[] = &$params[($i * $rows) + $j]; - - if (!call_user_func_array(array($stmt, 'bind_param'), $param_ref)) { - printf("[%03d + 03] [%d] %s\n", $offset, $stmt->errno, $stmt->error); - return false; - } - } - if ($stmt->param_count != $num_params * $rows) { - printf("[%03d + 03] Parameter count should be %d but got %d\n", $offset, $num_params * $rows, $stmt->param_count); - return false; - } - - if (!$stmt->execute()) { - printf("[%03d + 04] [%d] %s\n", $offset, $stmt->errno, $stmt->error); - return false; - } - printf("Statement done\n"); - - $stmt->close(); - - if (!($res = $link->query("SELECT * FROM test"))) { - printf("[%03d + 05] [%d] %s\n", $offset, $link->errno, $link->error); - return false; - } - - $row = $res->fetch_row(); - $res->close(); - - for ($i = 0; $i < $num_params; $i++) { - if ($row[$i + 1] != $i) { - printf("[%03d + 06] [%d] %s\n", $offset, $link->errno, $link->error); - } - } - - return true; - } - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - } - - var_dump(bind_many(10, $link, 273, 240, true)); - var_dump(bind_many(20, $link, 273, 240, false)); - mysqli_close($link); - print "done!"; + require_once("connect.inc"); + + function bind_many($offset, $link, $num_params, $rows, $eval = true) { + + $drop = "DROP TABLE IF EXISTS test"; + $create = "CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, "; + $insert = "INSERT INTO test"; + $columns = ""; + $values = ""; + $stmt_params = ""; + $params = array(); + for ($i = 0; $i < $num_params; $i++) { + $create .= "col" . $i . " INT, "; + $columns .= "col" . $i . ", "; + $values .= "?, "; + $stmt_params .= '$params[' . $i . '], '; + for ($j = 0; $j < $rows; $j++) + $params[($j * $rows) + $i] = $i; + } + $create = substr($create, 0, -2) . ")"; + + $stmt_types = str_repeat("i", $num_params * $rows); + $stmt_params = substr(str_repeat($stmt_params, $rows), 0, -2); + $values = substr($values, 0, -2); + $insert .= "(" . substr($columns, 0, -2) . ") VALUES "; + $insert .= substr(str_repeat("(" . $values . "), ", $rows), 0, -2); + + $stmt_bind_param = 'return mysqli_stmt_bind_param($stmt, "' . $stmt_types . '", ' . $stmt_params . ');'; + + printf("Testing %d columns with %d rows...\n", $num_params, $rows); + + if (!$link->query($drop) || !$link->query($create)) { + printf("[%03d + 01] [%d] %s\n", $offset, $link->errno, $link->error); + return false; + } + printf("... table created\n"); + + if (!$stmt = $link->prepare($insert)) { + printf("[%03d + 02] [%d] %s\n", $offset, $link->errno, $link->error); + return false; + } + if ($stmt->param_count != $num_params * $rows) { + printf("[%03d + 03] Parameter count should be %d but got %d\n", $offset, $num_params * $rows, $stmt->param_count); + return false; + } + printf("... statement with %d parameters prepared\n", $stmt->param_count); + + if ($eval) { + if (!eval($stmt_bind_param)) { + printf("[%03d + 03] [%d] %s\n", $offset, $stmt->errno, $stmt->error); + return false; + } + } else { + $param_ref = array($stmt_types); + for ($i = 0; $i < $rows; $i++) + for ($j = 0; $j < $num_params; $j++) + $param_ref[] = &$params[($i * $rows) + $j]; + + if (!call_user_func_array(array($stmt, 'bind_param'), $param_ref)) { + printf("[%03d + 03] [%d] %s\n", $offset, $stmt->errno, $stmt->error); + return false; + } + } + if ($stmt->param_count != $num_params * $rows) { + printf("[%03d + 03] Parameter count should be %d but got %d\n", $offset, $num_params * $rows, $stmt->param_count); + return false; + } + + if (!$stmt->execute()) { + printf("[%03d + 04] [%d] %s\n", $offset, $stmt->errno, $stmt->error); + return false; + } + printf("Statement done\n"); + + $stmt->close(); + + if (!($res = $link->query("SELECT * FROM test"))) { + printf("[%03d + 05] [%d] %s\n", $offset, $link->errno, $link->error); + return false; + } + + $row = $res->fetch_row(); + $res->close(); + + for ($i = 0; $i < $num_params; $i++) { + if ($row[$i + 1] != $i) { + printf("[%03d + 06] [%d] %s\n", $offset, $link->errno, $link->error); + } + } + + return true; + } + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } + + var_dump(bind_many(10, $link, 273, 240, true)); + var_dump(bind_many(20, $link, 273, 240, false)); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt index 027460fc5f..aba40decf4 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt @@ -8,366 +8,366 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - /* - The way we test the INSERT and data types overlaps with - the mysqli_stmt_bind_result test in large parts. There is only - one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to - fetch the inserted values. This way we test - mysqli_query()/mysqli_fetch_assoc() for all possible data types - in this file and we test mysqli_stmt_bind_result() in the other - test -- therefore the "duplicate" makes some sense to me. - */ - require_once("connect.inc"); - - require('table.inc'); - - $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) - printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = null; - $label = null; - - /* - libmysql gives a less descriptive error message but mysqlnd, - we did not unify the error messages but ignore this slight difference silently - */ - if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, " ", $tmp))) - printf("[003d] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, "", $id, $label))) - printf("[003a] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - /* TODO: somehwhat undocumented syntax! */ - $param = array($id); - if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param))) - printf("[003b] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - $param = array($id, $label, $id); - if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param))) - printf("[003c] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id))) - printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id, $label))) - printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "aa", $id, $label))) - printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "ia", $id, $label))) - printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) - printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (function_exists("memory_get_usage")) { - $mem = memory_get_usage(); - for ($i = 0; $i < 20000; $i++) { - if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) - printf("[008][$i] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - } - if (($tmp = (memory_get_usage() - $mem)) > 600) - printf("[009] Function seems to be leaking, because it used %d bytes. During tests it used only 92 bytes.", $tmp); - } - - $id = 100; - $label = "z"; - if (!mysqli_stmt_execute($stmt)) - printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - mysqli_stmt_close($stmt); - - if (!($res = mysqli_query($link, "SELECT id, label FROM test WHERE id = " . $id))) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $row = mysqli_fetch_assoc($res); - if (($row['id'] != $id) || ($row['label'] != $label)) - printf("[012] Expecting '%s'/%s', got '%s'/%s'!\n", $id, $label, $row['id'], $row['label']); - mysqli_free_result($res); - - function func_mysqli_stmt_bind_datatype($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $alternative = null) { - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { - // don't bail - it might be that the server does not support the data type - return false; - } - - if (!$stmt = mysqli_stmt_init($link)) { - printf("[%03d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUE (?, ?)")) { - printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - $id = 1; - if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) { - printf("[%03d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!mysqli_stmt_execute($stmt)) { - printf("[%03d] [%d] %s\n", $offset + 4, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - mysqli_stmt_close($stmt); - - if (!$res = mysqli_query($link, "SELECT id, label FROM test")) { - printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!$row = mysqli_fetch_assoc($res)) { - printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if ($alternative) { - if (($row['id'] != $id) || (($row['label'] != $bind_value) && ($row['label'] != $alternative))) { - printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s' (%s), got '%s'/'%s'\n", - $offset + 6, $bind_type, $sql_type, - $id, $bind_value, gettype($bind_value), $row['id'], $row['label']); - return false; - } - } else { - if (($row['id'] != $id) || ($row['label'] != $bind_value)) { - printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s', got '%s'/'%s'\n", - $offset + 6, $bind_type, $sql_type, - $id, $bind_value, $row['id'], $row['label']); - return false; - } - } - - mysqli_free_result($res); - return true; - } - - function func_mysqli_stmt_bind_make_string($len) { - - $ret = ''; - for ($i = 0; $i < $len; $i++) - $ret .= chr(mt_rand(65, 90)); - - return $ret; - } - - func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", -11, 20); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", NULL, 30); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", 1, 40); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", NULL, 50); - - func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", 1, 60); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", NULL, 70); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", 0, 80); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", NULL, 90); - - func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", -32768, 100); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", 32767, 110); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", NULL, 120); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 130); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 140); - - func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", -8388608, 150); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", 8388607, 160); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", NULL, 170); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", 16777215, 180); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", NULL, 190); - - func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", -2147483648, 200); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", 2147483647, 210); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", NULL, 220); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, PHP_INT_MAX) : 1, 230); - func_mysqli_stmt_bind_datatype($link, $engine, "d", "INTEGER UNSIGNED", 4294967295, 240); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", NULL, 250); - - func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 260); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", NULL, 270); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", PHP_INT_MAX, 280); - func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT UNSIGNED", NULL, 290); - - func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT", "-9223372036854775808", 900); - // ?? func_mysqli_stmt_bind_datatype($link, $engine, "d", "BIGINT", -9223372036854775808, 910); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 920); + /* + The way we test the INSERT and data types overlaps with + the mysqli_stmt_bind_result test in large parts. There is only + one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to + fetch the inserted values. This way we test + mysqli_query()/mysqli_fetch_assoc() for all possible data types + in this file and we test mysqli_stmt_bind_result() in the other + test -- therefore the "duplicate" makes some sense to me. + */ + require_once("connect.inc"); + + require('table.inc'); + + $stmt = mysqli_stmt_init($link); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) + printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = null; + $label = null; + + /* + libmysql gives a less descriptive error message but mysqlnd, + we did not unify the error messages but ignore this slight difference silently + */ + if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, " ", $tmp))) + printf("[003d] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, "", $id, $label))) + printf("[003a] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + /* TODO: somehwhat undocumented syntax! */ + $param = array($id); + if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param))) + printf("[003b] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + $param = array($id, $label, $id); + if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param))) + printf("[003c] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id))) + printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id, $label))) + printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "aa", $id, $label))) + printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "ia", $id, $label))) + printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) + printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (function_exists("memory_get_usage")) { + $mem = memory_get_usage(); + for ($i = 0; $i < 20000; $i++) { + if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) + printf("[008][$i] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + } + if (($tmp = (memory_get_usage() - $mem)) > 600) + printf("[009] Function seems to be leaking, because it used %d bytes. During tests it used only 92 bytes.", $tmp); + } + + $id = 100; + $label = "z"; + if (!mysqli_stmt_execute($stmt)) + printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + mysqli_stmt_close($stmt); + + if (!($res = mysqli_query($link, "SELECT id, label FROM test WHERE id = " . $id))) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $row = mysqli_fetch_assoc($res); + if (($row['id'] != $id) || ($row['label'] != $label)) + printf("[012] Expecting '%s'/%s', got '%s'/%s'!\n", $id, $label, $row['id'], $row['label']); + mysqli_free_result($res); + + function func_mysqli_stmt_bind_datatype($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $alternative = null) { + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { + printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { + // don't bail - it might be that the server does not support the data type + return false; + } + + if (!$stmt = mysqli_stmt_init($link)) { + printf("[%03d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUE (?, ?)")) { + printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + $id = 1; + if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) { + printf("[%03d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!mysqli_stmt_execute($stmt)) { + printf("[%03d] [%d] %s\n", $offset + 4, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + mysqli_stmt_close($stmt); + + if (!$res = mysqli_query($link, "SELECT id, label FROM test")) { + printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!$row = mysqli_fetch_assoc($res)) { + printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if ($alternative) { + if (($row['id'] != $id) || (($row['label'] != $bind_value) && ($row['label'] != $alternative))) { + printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s' (%s), got '%s'/'%s'\n", + $offset + 6, $bind_type, $sql_type, + $id, $bind_value, gettype($bind_value), $row['id'], $row['label']); + return false; + } + } else { + if (($row['id'] != $id) || ($row['label'] != $bind_value)) { + printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s', got '%s'/'%s'\n", + $offset + 6, $bind_type, $sql_type, + $id, $bind_value, $row['id'], $row['label']); + return false; + } + } + + mysqli_free_result($res); + return true; + } + + function func_mysqli_stmt_bind_make_string($len) { + + $ret = ''; + for ($i = 0; $i < $len; $i++) + $ret .= chr(mt_rand(65, 90)); + + return $ret; + } + + func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", -11, 20); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", NULL, 30); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", 1, 40); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", NULL, 50); + + func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", 1, 60); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", NULL, 70); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", 0, 80); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", NULL, 90); + + func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", -32768, 100); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", 32767, 110); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", NULL, 120); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 130); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 140); + + func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", -8388608, 150); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", 8388607, 160); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", NULL, 170); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", 16777215, 180); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", NULL, 190); + + func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", -2147483648, 200); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", 2147483647, 210); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", NULL, 220); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, PHP_INT_MAX) : 1, 230); + func_mysqli_stmt_bind_datatype($link, $engine, "d", "INTEGER UNSIGNED", 4294967295, 240); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", NULL, 250); + + func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 260); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", NULL, 270); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", PHP_INT_MAX, 280); + func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT UNSIGNED", NULL, 290); + + func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT", "-9223372036854775808", 900); + // ?? func_mysqli_stmt_bind_datatype($link, $engine, "d", "BIGINT", -9223372036854775808, 910); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 920); /* - ?? - func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 300); - func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 320); - */ - func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", NULL, 310); - func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 330); - if (2147483647 == PHP_INT_MAX) { - func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", PHP_INT_MAX, 930, '2.14748e+09'); - func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -1 * PHP_INT_MAX + 1, 940, '-2.14748e+09'); - } - func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT", "-9223372036854775808", 300, '-9.22337e+18'); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT UNSIGNED", "18446744073709551615", 320, '1.84467e+19'); - func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -10.01, 950); - func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 10.01, 960); - - func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", NULL, 350); - func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 370); - func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340); - func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360); - - /* - func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340); - func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360); - */ - func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", -99999999.99, 380); - func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 390); - func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", 99999999.99, 400); - func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 410); - - // don't care about date() strict TZ warnings... - func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", @date('Y-m-d'), 420); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 430); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", NULL, 440); - - func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 450); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 460); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", NULL, 470); - - func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 480); - - func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", @date('H:i:s'), 490); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 500); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", NULL, 510); - - func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", @date('Y'), 520); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR NOT NULL", @date('Y'), 530); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", NULL, 540); - - $string255 = func_mysqli_stmt_bind_make_string(255); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", "a", 550); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(255)", $string255, 560); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1) NOT NULL", "a", 570); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", NULL, 580); - - $string65k = func_mysqli_stmt_bind_make_string(65535); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", "a", 590); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(255)", $string255, 600); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(65635)", $string65k, 610); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 620); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", NULL, 630); - - func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", "a", 640); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", chr(0), 650); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1) NOT NULL", "b", 660); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", NULL, 670); - - func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", "a", 680); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", chr(0), 690); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 700); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", NULL, 710); - - func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", "a", 720); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", chr(0), 730); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB NOT NULL", "b", 740); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", NULL, 750); - - func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", "a", 760); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT NOT NULL", "a", 770); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", NULL, 780); - - // Note: you cannot insert any blob values this way. But you can check the API at least partly this way - // Extra BLOB tests are in mysqli_stmt_send_long() - func_mysqli_stmt_bind_datatype($link, $engine, "b", "BLOB", "", 790); - func_mysqli_stmt_bind_datatype($link, $engine, "b", "TEXT", "", 800); - func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMBLOB", "", 810); - func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMTEXT", "", 820); - func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGBLOB", "", 830); - func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGTEXT", "", 840); - - func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", "a", 850); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", NULL, 860); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", "a", 870); - func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", NULL, 880); - - if (mysqli_get_server_version($link) >= 50600) - func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", "13:27:34.123456", 890, "13:27:34"); - - $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) - printf("[2000] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = null; - $label = null; - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) - printf("[2001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - mysqli_stmt_execute($stmt); - - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) - printf("[2002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - mysqli_stmt_close($stmt); - include("table.inc"); - - if (!$stmt = mysqli_stmt_init($link)) - printf("[2003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) - printf("[2004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = $label = null; - if (true !== ($tmp = $stmt->bind_param('is', $id, $label))) - printf("[2005] Expecting boolean/true got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, - $stmt->errno, $stmt->error); - - $id = 100; $label = 'z'; - if (!$stmt->execute()) - printf("[2006] [%d] %s\n", $stmt->errno, $stmt->error); - - if (!$res = mysqli_query($link, "SELECT id, label FROM test WHERE id = 100")) - printf("[2007] Expecting record 100/z, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$row = mysqli_fetch_assoc($res)) - printf("[2008] Expecting row, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if ($row['id'] != 100 || $row['label'] != 'z') { - printf("[2009] Row seems wrong, dumping record\n"); - var_dump($row); - } - mysqli_free_result($res); - - $value_list = array(array('id' => 101, 'label' => 'a'), array('id' => 102, 'label' => 'b')); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) - printf("[2010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + ?? + func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 300); + func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 320); + */ + func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", NULL, 310); + func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 330); + if (2147483647 == PHP_INT_MAX) { + func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", PHP_INT_MAX, 930, '2.14748e+09'); + func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -1 * PHP_INT_MAX + 1, 940, '-2.14748e+09'); + } + func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT", "-9223372036854775808", 300, '-9.22337e+18'); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT UNSIGNED", "18446744073709551615", 320, '1.84467e+19'); + func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -10.01, 950); + func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 10.01, 960); + + func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", NULL, 350); + func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 370); + func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340); + func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360); + + /* + func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340); + func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360); + */ + func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", -99999999.99, 380); + func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 390); + func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", 99999999.99, 400); + func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 410); + + // don't care about date() strict TZ warnings... + func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", @date('Y-m-d'), 420); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 430); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", NULL, 440); + + func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 450); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 460); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", NULL, 470); + + func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 480); + + func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", @date('H:i:s'), 490); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 500); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", NULL, 510); + + func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", @date('Y'), 520); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR NOT NULL", @date('Y'), 530); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", NULL, 540); + + $string255 = func_mysqli_stmt_bind_make_string(255); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", "a", 550); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(255)", $string255, 560); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1) NOT NULL", "a", 570); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", NULL, 580); + + $string65k = func_mysqli_stmt_bind_make_string(65535); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", "a", 590); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(255)", $string255, 600); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(65635)", $string65k, 610); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 620); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", NULL, 630); + + func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", "a", 640); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", chr(0), 650); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1) NOT NULL", "b", 660); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", NULL, 670); + + func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", "a", 680); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", chr(0), 690); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 700); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", NULL, 710); + + func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", "a", 720); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", chr(0), 730); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB NOT NULL", "b", 740); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", NULL, 750); + + func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", "a", 760); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT NOT NULL", "a", 770); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", NULL, 780); + + // Note: you cannot insert any blob values this way. But you can check the API at least partly this way + // Extra BLOB tests are in mysqli_stmt_send_long() + func_mysqli_stmt_bind_datatype($link, $engine, "b", "BLOB", "", 790); + func_mysqli_stmt_bind_datatype($link, $engine, "b", "TEXT", "", 800); + func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMBLOB", "", 810); + func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMTEXT", "", 820); + func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGBLOB", "", 830); + func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGTEXT", "", 840); + + func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", "a", 850); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", NULL, 860); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", "a", 870); + func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", NULL, 880); + + if (mysqli_get_server_version($link) >= 50600) + func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", "13:27:34.123456", 890, "13:27:34"); + + $stmt = mysqli_stmt_init($link); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) + printf("[2000] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = null; + $label = null; + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) + printf("[2001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + mysqli_stmt_execute($stmt); + + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) + printf("[2002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + mysqli_stmt_close($stmt); + include("table.inc"); + + if (!$stmt = mysqli_stmt_init($link)) + printf("[2003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) + printf("[2004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = $label = null; + if (true !== ($tmp = $stmt->bind_param('is', $id, $label))) + printf("[2005] Expecting boolean/true got %s/%s, [%d] %s\n", + gettype($tmp), $tmp, + $stmt->errno, $stmt->error); + + $id = 100; $label = 'z'; + if (!$stmt->execute()) + printf("[2006] [%d] %s\n", $stmt->errno, $stmt->error); + + if (!$res = mysqli_query($link, "SELECT id, label FROM test WHERE id = 100")) + printf("[2007] Expecting record 100/z, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$row = mysqli_fetch_assoc($res)) + printf("[2008] Expecting row, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if ($row['id'] != 100 || $row['label'] != 'z') { + printf("[2009] Row seems wrong, dumping record\n"); + var_dump($row); + } + mysqli_free_result($res); + + $value_list = array(array('id' => 101, 'label' => 'a'), array('id' => 102, 'label' => 'b')); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) + printf("[2010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); foreach ($value_list as $k => $values) { - if (!mysqli_stmt_bind_param($stmt, 'is', $values['id'], $values['label'])) { - printf("[2011] bind_param() failed for id = %d, [%d] %s\n", - $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - continue; - } - if (!$stmt->execute()) - printf("[2012] [%d] execute() failed for id = %d, [%d] %s\n", - $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!$res = mysqli_query($link, sprintf("SELECT label FROM test WHERE id = %d", $values['id']))) - printf("[2013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[2014] Cannot find row id = %d\n", $values['id']); - else if (isset($row['label']) && ($values['label'] != $row['label'])) - printf("[2015] Expecting label = %s, got label = %s\n", $values['label'], $row['label']); - - mysqli_free_result($res); - } - - mysqli_stmt_close($stmt); - mysqli_close($link); - - print "done!"; + if (!mysqli_stmt_bind_param($stmt, 'is', $values['id'], $values['label'])) { + printf("[2011] bind_param() failed for id = %d, [%d] %s\n", + $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + continue; + } + if (!$stmt->execute()) + printf("[2012] [%d] execute() failed for id = %d, [%d] %s\n", + $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!$res = mysqli_query($link, sprintf("SELECT label FROM test WHERE id = %d", $values['id']))) + printf("[2013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[2014] Cannot find row id = %d\n", $values['id']); + else if (isset($row['label']) && ($values['label'] != $row['label'])) + printf("[2015] Expecting label = %s, got label = %s\n", $values['label'], $row['label']); + + mysqli_free_result($res); + } + + mysqli_stmt_close($stmt); + mysqli_close($link); + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt index a8a18ace85..3de2910fd4 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt @@ -8,321 +8,321 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('connect.inc'); - require('table.inc'); - - if (!$stmt = mysqli_stmt_init($link)) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) - printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = 1; - if (!mysqli_stmt_bind_param($stmt, 'i', $id) || - !mysqli_stmt_execute($stmt)) - printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label) || - (true !== mysqli_stmt_fetch($stmt))) - printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - print "Regular, procedural, using variables\n"; - var_dump($id); - var_dump($label); - - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) - printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $types = 'i'; - $id = 1; - $params = array( - 0 => &$stmt, - 1 => &$types, - 2 => &$id - ); - if (!call_user_func_array('mysqli_stmt_bind_param', $params)) - printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label) || - (true !== mysqli_stmt_fetch($stmt))) - printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - print "Call user func, procedural, using references for everything\n"; - var_dump($id); - var_dump($label); - - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) - printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $types = 'i'; - $id = 1; - $params = array( - 0 => &$types, - 1 => &$id - ); - if (!call_user_func_array(array($stmt, 'bind_param'), $params)) - printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label) || - (true !== mysqli_stmt_fetch($stmt))) - printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - print "Call user func, object oriented, using references for everything\n"; - var_dump($id); - var_dump($label); - - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) - printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $types = 'i'; - $id = 1; - $params = array( - 0 => $types, - 1 => &$id - ); - if (!call_user_func_array(array($stmt, 'bind_param'), $params)) - printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label) || - (true !== mysqli_stmt_fetch($stmt))) - printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - print "Call user func, object oriented, using variable for types. using references for bound parameter\n"; - var_dump($id); - var_dump($label); - - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) - printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = 1; - $params = array( - 0 => 'i', - 1 => &$id - ); - if (!call_user_func_array(array($stmt, 'bind_param'), $params)) - printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[023] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label) || - (true !== mysqli_stmt_fetch($stmt))) - printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - print "Call user func, object oriented, using constant for types. using references for bound parameter\n"; - var_dump($id); - var_dump($label); - - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) - printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $types = 'i'; - $id = 1; - $params = array( - 0 => &$stmt, - 1 => $types, - 2 => &$id - ); - if (!call_user_func_array('mysqli_stmt_bind_param', $params)) - printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label) || - (true !== mysqli_stmt_fetch($stmt))) - printf("[029] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - print "Call user func, procedural, using references for everything but using variable for types\n"; - var_dump($id); - var_dump($label); - - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) - printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $types = 'i'; - $id = 1; - $params = array( - 0 => $stmt, - 1 => $types, - 2 => &$id - ); - if (!call_user_func_array('mysqli_stmt_bind_param', $params)) - printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label) || - (true !== mysqli_stmt_fetch($stmt))) - printf("[029] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - print "Call user func, procedural, using references for bound parameter, using variables for resource and types\n"; - var_dump($id); - var_dump($label); - - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) - printf("[031] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $types = 'i'; - $id = 1; - $params = array( - 0 => $stmt, - 1 => $types, - 2 => &$id - ); - if (!call_user_func_array('mysqli_stmt_bind_param', $params)) - printf("[032] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label) || - (true !== mysqli_stmt_fetch($stmt))) - printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - print "Call user func, procedural, using references for bound parameter, using variables for resource and types\n"; - var_dump($id); - var_dump($label); - - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[035] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) - printf("[036] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = 1; - $params = array( - 0 => $stmt, - 1 => 'i', - 2 => &$id - ); - if (!call_user_func_array('mysqli_stmt_bind_param', $params)) - printf("[037] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[038] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label) || - (true !== mysqli_stmt_fetch($stmt))) - printf("[039] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - print "Call user func, procedural, using references for bound parameter, using variable for resource, using constant for types\n"; - var_dump($id); - var_dump($label); - - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[040] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) - printf("[041] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = 1; - if (!call_user_func_array('mysqli_stmt_bind_param', array($stmt, 'i', &$id))) - printf("[042] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[043] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label) || - (true !== mysqli_stmt_fetch($stmt))) - printf("[044] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - print "Call user func, procedural, using references for bound parameter, using variable for resource, using constant for types, array\n"; - var_dump($id); - var_dump($label); - - // - // Any of those shall fail - see also bugs.php.net/43568 - // - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[045] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) - printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = 1; - $params = array( - 0 => 'i', - 1 => &$id - ); - if (!call_user_func_array(array($stmt, 'bind_param'), $params)) - printf("[047] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[048] [%d] (Message might vary with MySQL Server version, e.g. No data supplied for parameters in prepared statement)\n", mysqli_stmt_errno($stmt)); - - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[049] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) - printf("[050] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $types = 'i'; - $id = 1; - $params = array( - 0 => $stmt, - 1 => 'i', - 2 => &$id - ); - if (!call_user_func_array('mysqli_stmt_bind_param', $params)) - printf("[051] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[052] [%d] (Message might vary with MySQL Server version, e.g. No data supplied for parameters in prepared statement)\n", mysqli_stmt_errno($stmt)); - - print "done!"; + require('connect.inc'); + require('table.inc'); + + if (!$stmt = mysqli_stmt_init($link)) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) + printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = 1; + if (!mysqli_stmt_bind_param($stmt, 'i', $id) || + !mysqli_stmt_execute($stmt)) + printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label) || + (true !== mysqli_stmt_fetch($stmt))) + printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + print "Regular, procedural, using variables\n"; + var_dump($id); + var_dump($label); + + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) + printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $types = 'i'; + $id = 1; + $params = array( + 0 => &$stmt, + 1 => &$types, + 2 => &$id + ); + if (!call_user_func_array('mysqli_stmt_bind_param', $params)) + printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label) || + (true !== mysqli_stmt_fetch($stmt))) + printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + print "Call user func, procedural, using references for everything\n"; + var_dump($id); + var_dump($label); + + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) + printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $types = 'i'; + $id = 1; + $params = array( + 0 => &$types, + 1 => &$id + ); + if (!call_user_func_array(array($stmt, 'bind_param'), $params)) + printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label) || + (true !== mysqli_stmt_fetch($stmt))) + printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + print "Call user func, object oriented, using references for everything\n"; + var_dump($id); + var_dump($label); + + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) + printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $types = 'i'; + $id = 1; + $params = array( + 0 => $types, + 1 => &$id + ); + if (!call_user_func_array(array($stmt, 'bind_param'), $params)) + printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label) || + (true !== mysqli_stmt_fetch($stmt))) + printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + print "Call user func, object oriented, using variable for types. using references for bound parameter\n"; + var_dump($id); + var_dump($label); + + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) + printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = 1; + $params = array( + 0 => 'i', + 1 => &$id + ); + if (!call_user_func_array(array($stmt, 'bind_param'), $params)) + printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[023] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label) || + (true !== mysqli_stmt_fetch($stmt))) + printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + print "Call user func, object oriented, using constant for types. using references for bound parameter\n"; + var_dump($id); + var_dump($label); + + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) + printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $types = 'i'; + $id = 1; + $params = array( + 0 => &$stmt, + 1 => $types, + 2 => &$id + ); + if (!call_user_func_array('mysqli_stmt_bind_param', $params)) + printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label) || + (true !== mysqli_stmt_fetch($stmt))) + printf("[029] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + print "Call user func, procedural, using references for everything but using variable for types\n"; + var_dump($id); + var_dump($label); + + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) + printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $types = 'i'; + $id = 1; + $params = array( + 0 => $stmt, + 1 => $types, + 2 => &$id + ); + if (!call_user_func_array('mysqli_stmt_bind_param', $params)) + printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label) || + (true !== mysqli_stmt_fetch($stmt))) + printf("[029] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + print "Call user func, procedural, using references for bound parameter, using variables for resource and types\n"; + var_dump($id); + var_dump($label); + + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) + printf("[031] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $types = 'i'; + $id = 1; + $params = array( + 0 => $stmt, + 1 => $types, + 2 => &$id + ); + if (!call_user_func_array('mysqli_stmt_bind_param', $params)) + printf("[032] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label) || + (true !== mysqli_stmt_fetch($stmt))) + printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + print "Call user func, procedural, using references for bound parameter, using variables for resource and types\n"; + var_dump($id); + var_dump($label); + + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[035] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) + printf("[036] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = 1; + $params = array( + 0 => $stmt, + 1 => 'i', + 2 => &$id + ); + if (!call_user_func_array('mysqli_stmt_bind_param', $params)) + printf("[037] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[038] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label) || + (true !== mysqli_stmt_fetch($stmt))) + printf("[039] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + print "Call user func, procedural, using references for bound parameter, using variable for resource, using constant for types\n"; + var_dump($id); + var_dump($label); + + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[040] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) + printf("[041] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = 1; + if (!call_user_func_array('mysqli_stmt_bind_param', array($stmt, 'i', &$id))) + printf("[042] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[043] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label) || + (true !== mysqli_stmt_fetch($stmt))) + printf("[044] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + print "Call user func, procedural, using references for bound parameter, using variable for resource, using constant for types, array\n"; + var_dump($id); + var_dump($label); + + // + // Any of those shall fail - see also bugs.php.net/43568 + // + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[045] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) + printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = 1; + $params = array( + 0 => 'i', + 1 => &$id + ); + if (!call_user_func_array(array($stmt, 'bind_param'), $params)) + printf("[047] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[048] [%d] (Message might vary with MySQL Server version, e.g. No data supplied for parameters in prepared statement)\n", mysqli_stmt_errno($stmt)); + + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[049] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) + printf("[050] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $types = 'i'; + $id = 1; + $params = array( + 0 => $stmt, + 1 => 'i', + 2 => &$id + ); + if (!call_user_func_array('mysqli_stmt_bind_param', $params)) + printf("[051] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[052] [%d] (Message might vary with MySQL Server version, e.g. No data supplied for parameters in prepared statement)\n", mysqli_stmt_errno($stmt)); + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt index b8f209ef79..4b243ef3d6 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt @@ -8,59 +8,59 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('table.inc'); - $link->set_charset('latin1'); + require('table.inc'); + $link->set_charset('latin1'); - class foo { - // @var $bar string - public $bar; - } + class foo { + // @var $bar string + public $bar; + } - $foo = new foo; - $foo->bar = "фубар"; + $foo = new foo; + $foo->bar = "фубар"; - echo "Test 1:\n"; - $stmt = $link->prepare("SELECT ? FOO"); - var_dump($foo); // here you can see the bar member var being a string - $stmt->bind_param("s", $foo->bar); - var_dump($foo); // this will show $foo->bar being a reference string - $stmt->bind_result($one); - $stmt->execute(); - $stmt->fetch(); - $stmt->free_result(); - echo("$one\n\n"); + echo "Test 1:\n"; + $stmt = $link->prepare("SELECT ? FOO"); + var_dump($foo); // here you can see the bar member var being a string + $stmt->bind_param("s", $foo->bar); + var_dump($foo); // this will show $foo->bar being a reference string + $stmt->bind_result($one); + $stmt->execute(); + $stmt->fetch(); + $stmt->free_result(); + echo("$one\n\n"); - // it is getting worse. Binding the same var twice with different - // types you can get unexpected results (e.g. binary trash for the - // string and misc data for the integer. See next 2 tests. + // it is getting worse. Binding the same var twice with different + // types you can get unexpected results (e.g. binary trash for the + // string and misc data for the integer. See next 2 tests. - echo "Test 2:\n"; - $stmt = $link->prepare("SELECT ? FOO, ? BAR"); - var_dump($foo); - $stmt->bind_param("si", $foo->bar, $foo->bar); - echo "---\n"; - var_dump($foo); - echo "---\n"; - $stmt->execute(); - var_dump($foo); - echo "---\n"; - $stmt->bind_result($one, $two); - $stmt->fetch(); - $stmt->free_result(); - echo("$one - $two\n\n"); + echo "Test 2:\n"; + $stmt = $link->prepare("SELECT ? FOO, ? BAR"); + var_dump($foo); + $stmt->bind_param("si", $foo->bar, $foo->bar); + echo "---\n"; + var_dump($foo); + echo "---\n"; + $stmt->execute(); + var_dump($foo); + echo "---\n"; + $stmt->bind_result($one, $two); + $stmt->fetch(); + $stmt->free_result(); + echo("$one - $two\n\n"); - echo "Test 3:\n"; - $stmt = $link->prepare("SELECT ? FOO, ? BAR"); - var_dump($foo); - $stmt->bind_param("is", $foo->bar, $foo->bar); - var_dump($foo); - $stmt->bind_result($one, $two); - $stmt->execute(); - $stmt->fetch(); - $stmt->free_result(); - echo("$one - $two\n\n"); - echo "done!"; + echo "Test 3:\n"; + $stmt = $link->prepare("SELECT ? FOO, ? BAR"); + var_dump($foo); + $stmt->bind_param("is", $foo->bar, $foo->bar); + var_dump($foo); + $stmt->bind_result($one, $two); + $stmt->execute(); + $stmt->fetch(); + $stmt->free_result(); + echo("$one - $two\n\n"); + echo "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt index 0b054c4827..efe86972d9 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt @@ -10,87 +10,87 @@ require_once('skipifconnectfailure.inc'); memory_limit=256M --FILE-- <?php - /* - The way we test the INSERT and data types overlaps with - the mysqli_stmt_bind_result test in large parts. There is only - one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to - fetch the inserted values. This way we test - mysqli_query()/mysqli_fetch_assoc() for all possible data types - in this file and we test mysqli_stmt_bind_result() in the other - test -- therefore the "duplicate" makes some sense to me. - */ - require_once("connect.inc"); + /* + The way we test the INSERT and data types overlaps with + the mysqli_stmt_bind_result test in large parts. There is only + one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to + fetch the inserted values. This way we test + mysqli_query()/mysqli_fetch_assoc() for all possible data types + in this file and we test mysqli_stmt_bind_result() in the other + test -- therefore the "duplicate" makes some sense to me. + */ + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - exit(1); - } + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + exit(1); + } - $cols = 2500; + $cols = 2500; - list($old_max_allowed_packet) = $link->query("SELECT @@max_allowed_packet")->fetch_row(); - if (!$link->query("SET GLOBAL max_allowed_packet=(2<<29)")) { - if (1227 == mysqli_errno($link)) { - /* [1227] Access denied; you need the SUPER privilege for this operation */ - $cols = 10; - } else { - $cols = 10; - printf("[002] Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - } - mysqli_close($link); + list($old_max_allowed_packet) = $link->query("SELECT @@max_allowed_packet")->fetch_row(); + if (!$link->query("SET GLOBAL max_allowed_packet=(2<<29)")) { + if (1227 == mysqli_errno($link)) { + /* [1227] Access denied; you need the SUPER privilege for this operation */ + $cols = 10; + } else { + $cols = 10; + printf("[002] Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + } + mysqli_close($link); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - exit(1); - } + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + exit(1); + } - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - exit(1); - } + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { + printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + exit(1); + } - $str = array(); - for ($i = 1; $i <= $cols; $i++) { - $str[] ="a$i BLOB"; - } - $link->query("CREATE TABLE test(" . implode(" , ", $str) . ") ENGINE=MyISAM"); - if (mysqli_errno($link)) { - printf("Failed to create the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - die(""); - } - $stmt = $link->prepare("INSERT INTO test VALUES(".str_repeat("?, ", $cols-1) . "?)"); - var_dump($stmt->id); - $s = str_repeat("a", 2 << 12); - $eval_str="\$stmt->bind_param(\"".str_repeat("s",$cols)."\", "; - for ($i = 1; $i < $cols; $i++) { - $eval_str.="\$s,"; - } - $eval_str.="\$s"; - $eval_str.=");"; - eval($eval_str); - printf("executing\n"); - if (!$stmt->execute()) { - printf("failed"); - printf("Failed to execute: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } else { - var_dump(true); - } + $str = array(); + for ($i = 1; $i <= $cols; $i++) { + $str[] ="a$i BLOB"; + } + $link->query("CREATE TABLE test(" . implode(" , ", $str) . ") ENGINE=MyISAM"); + if (mysqli_errno($link)) { + printf("Failed to create the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + die(""); + } + $stmt = $link->prepare("INSERT INTO test VALUES(".str_repeat("?, ", $cols-1) . "?)"); + var_dump($stmt->id); + $s = str_repeat("a", 2 << 12); + $eval_str="\$stmt->bind_param(\"".str_repeat("s",$cols)."\", "; + for ($i = 1; $i < $cols; $i++) { + $eval_str.="\$s,"; + } + $eval_str.="\$s"; + $eval_str.=");"; + eval($eval_str); + printf("executing\n"); + if (!$stmt->execute()) { + printf("failed"); + printf("Failed to execute: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } else { + var_dump(true); + } - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); - if (!$link->query("SET GLOBAL max_allowed_packet=$old_max_allowed_packet")) { - if (1227 != mysqli_errno($link)) - printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + if (!$link->query("SET GLOBAL max_allowed_packet=$old_max_allowed_packet")) { + if (1227 != mysqli_errno($link)) + printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt index e7b581f815..f05e46fe9d 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt @@ -8,196 +8,196 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('table.inc'); - - function findRow($offset, $link, $id, $label) { - - $sql = sprintf("SELECT id, label FROM test WHERE id = '%d' AND label = '%s'", - $id, $label); - if (!$res = mysqli_query($link, $sql)) { - printf("[%03d + 1] %s failed, [%d] %s\n", - $offset, $sql, mysqli_errno($link), mysqli_error($link)); - return false; - } - if (!$row = mysqli_fetch_assoc($res)) { - printf("[%03d + 2] fetch for %s failed, [%d] %s\n", - $offset, $sql, mysqli_errno($link), mysqli_error($link)); - return false; - } - - mysqli_free_result($res); - if ($row['id'] != $id) { - printf("[%03d + 3] Expecting %s/%s got %s/%s\n", - $offset, gettype($id), $id, - gettype($row['id']), $row['id'] - ); - return false; - } - - if ($row['label'] != $label) { - printf("[%03d + 4] Expecting %s/%s got %s/%s\n", - $offset, gettype($label), $label, - gettype($row['label']), $row['label'] - ); - return false; - } - - $sql = sprintf("DELETE FROM test WHERE id = '%d' AND label = '%s'", - $id, $label); - if (!mysqli_query($link, $sql)) { - printf("[%03d + 5] %s failed, [%d] %s\n", - $offset, $sql, mysqli_errno($link), mysqli_error($link)); - return false; - } - - return true; - } - // or we will get dups around [28] - mysqli_query($link, "ALTER TABLE test DROP PRIMARY KEY"); - - $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) - printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = 100; - $label = 'v'; - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) - printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== mysqli_stmt_execute($stmt)) - printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - // no need to check the return value, will bail and make EXPECTF fail if need be - findRow(4, $link, $id, $label); - - $id++; - $label_ref = &$label; - $label = 'w'; - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_ref))) - printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== mysqli_stmt_execute($stmt)) - printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - findRow(7, $link, $id, $label_ref); - - $id++; - $label_ref_ref = &$label_ref; - $label = 'x'; - - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_ref_ref))) - printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== mysqli_stmt_execute($stmt)) - printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - findRow(9, $link, $id, $label_ref_ref); - - $id = 9; - $label = $id; - $label_num = &$label; - - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_num))) - printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== mysqli_stmt_execute($stmt)) - printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - findRow(12, $link, $id, $label_num); - - $label_num = &$id; - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_num))) - printf("[013] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== mysqli_stmt_execute($stmt)) - printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - findRow(15, $link, $id, $label_num); - - $label = 9; - $id = &$label; - - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) - printf("[015] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== mysqli_stmt_execute($stmt)) - printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - findRow(17, $link, $id, $label); - - $base = 9; - $id = &$base; - $label = &$id; - - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) - printf("[018] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== mysqli_stmt_execute($stmt)) - printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - findRow(20, $link, $id, $label); - - $id_ref = &$id; - $label_ref = &$label; - - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref, $label_ref))) - printf("[021] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== mysqli_stmt_execute($stmt)) - printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - findRow(23, $link, $id_ref, $label_ref); - - $id_ref_ref = &$GLOBALS['id_ref']; - $label_ref_ref = &$GLOBALS['label_ref_ref']; - - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref_ref, $label_ref_ref))) - printf("[024] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== mysqli_stmt_execute($stmt)) - printf("[025] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - findRow(26, $link, $id_ref_ref, $label_ref_ref); - - unset($id); - unset($label); - $id = 102; - $label = new stdClass(); - $label->label = 'y'; - $id_ref = &$GLOBALS['id']; - $label_ref = &$label->label; - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref, $label_ref))) - printf("[027] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if (true !== @mysqli_stmt_execute($stmt)) - printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - findRow(29, $link, $id_ref, $label_ref); - - $id = 103; - $label_a = &$label_b; - $label_b = &$label_a; - $label_a = 'z'; - - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_b))) - printf("[030] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== mysqli_stmt_execute($stmt)) - printf("[031] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - findRow(32, $link, $id, $label_b); - - class foo { - public $foo; - function __construct() { - $this->foo = &$this->bar; - } - } - class bar extends foo { - public $bar = 'v'; - } - $bar = new bar(); - $id++; - $label = &$GLOBALS['bar']->foo; - - if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) - printf("[033] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== mysqli_stmt_execute($stmt)) - printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - findRow(35, $link, $id, $label); - - mysqli_stmt_close($stmt); - mysqli_close($link); - print "done!"; + require('table.inc'); + + function findRow($offset, $link, $id, $label) { + + $sql = sprintf("SELECT id, label FROM test WHERE id = '%d' AND label = '%s'", + $id, $label); + if (!$res = mysqli_query($link, $sql)) { + printf("[%03d + 1] %s failed, [%d] %s\n", + $offset, $sql, mysqli_errno($link), mysqli_error($link)); + return false; + } + if (!$row = mysqli_fetch_assoc($res)) { + printf("[%03d + 2] fetch for %s failed, [%d] %s\n", + $offset, $sql, mysqli_errno($link), mysqli_error($link)); + return false; + } + + mysqli_free_result($res); + if ($row['id'] != $id) { + printf("[%03d + 3] Expecting %s/%s got %s/%s\n", + $offset, gettype($id), $id, + gettype($row['id']), $row['id'] + ); + return false; + } + + if ($row['label'] != $label) { + printf("[%03d + 4] Expecting %s/%s got %s/%s\n", + $offset, gettype($label), $label, + gettype($row['label']), $row['label'] + ); + return false; + } + + $sql = sprintf("DELETE FROM test WHERE id = '%d' AND label = '%s'", + $id, $label); + if (!mysqli_query($link, $sql)) { + printf("[%03d + 5] %s failed, [%d] %s\n", + $offset, $sql, mysqli_errno($link), mysqli_error($link)); + return false; + } + + return true; + } + // or we will get dups around [28] + mysqli_query($link, "ALTER TABLE test DROP PRIMARY KEY"); + + $stmt = mysqli_stmt_init($link); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) + printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = 100; + $label = 'v'; + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) + printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== mysqli_stmt_execute($stmt)) + printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + // no need to check the return value, will bail and make EXPECTF fail if need be + findRow(4, $link, $id, $label); + + $id++; + $label_ref = &$label; + $label = 'w'; + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_ref))) + printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== mysqli_stmt_execute($stmt)) + printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + findRow(7, $link, $id, $label_ref); + + $id++; + $label_ref_ref = &$label_ref; + $label = 'x'; + + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_ref_ref))) + printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== mysqli_stmt_execute($stmt)) + printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + findRow(9, $link, $id, $label_ref_ref); + + $id = 9; + $label = $id; + $label_num = &$label; + + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_num))) + printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== mysqli_stmt_execute($stmt)) + printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + findRow(12, $link, $id, $label_num); + + $label_num = &$id; + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_num))) + printf("[013] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== mysqli_stmt_execute($stmt)) + printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + findRow(15, $link, $id, $label_num); + + $label = 9; + $id = &$label; + + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) + printf("[015] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== mysqli_stmt_execute($stmt)) + printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + findRow(17, $link, $id, $label); + + $base = 9; + $id = &$base; + $label = &$id; + + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) + printf("[018] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== mysqli_stmt_execute($stmt)) + printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + findRow(20, $link, $id, $label); + + $id_ref = &$id; + $label_ref = &$label; + + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref, $label_ref))) + printf("[021] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== mysqli_stmt_execute($stmt)) + printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + findRow(23, $link, $id_ref, $label_ref); + + $id_ref_ref = &$GLOBALS['id_ref']; + $label_ref_ref = &$GLOBALS['label_ref_ref']; + + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref_ref, $label_ref_ref))) + printf("[024] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== mysqli_stmt_execute($stmt)) + printf("[025] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + findRow(26, $link, $id_ref_ref, $label_ref_ref); + + unset($id); + unset($label); + $id = 102; + $label = new stdClass(); + $label->label = 'y'; + $id_ref = &$GLOBALS['id']; + $label_ref = &$label->label; + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref, $label_ref))) + printf("[027] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (true !== @mysqli_stmt_execute($stmt)) + printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + findRow(29, $link, $id_ref, $label_ref); + + $id = 103; + $label_a = &$label_b; + $label_b = &$label_a; + $label_a = 'z'; + + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_b))) + printf("[030] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== mysqli_stmt_execute($stmt)) + printf("[031] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + findRow(32, $link, $id, $label_b); + + class foo { + public $foo; + function __construct() { + $this->foo = &$this->bar; + } + } + class bar extends foo { + public $bar = 'v'; + } + $bar = new bar(); + $id++; + $label = &$GLOBALS['bar']->foo; + + if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label))) + printf("[033] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== mysqli_stmt_execute($stmt)) + printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + findRow(35, $link, $id, $label); + + mysqli_stmt_close($stmt); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt index 72adfb04e7..5a8dd90577 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt @@ -8,116 +8,116 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('table.inc'); - - function bind_twice($link, $engine, $sql_type1, $sql_type2, $bind_type1, $bind_type2, $bind_value1, $bind_value2, $offset) { - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[%03d + 1] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } - mysqli_autocommit($link, true); - - $sql = sprintf("CREATE TABLE test(col1 %s, col2 %s) ENGINE=%s", $sql_type1, $sql_type2, $engine); - if (!mysqli_query($link, $sql)) { - printf("[%03d + 2] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!$stmt = mysqli_stmt_init($link)) { - printf("[%03d + 3] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(col1, col2) VALUES (?, ?)")) { - printf("[%03d + 4] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value1)) { - printf("[%03d + 5] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!mysqli_stmt_execute($stmt)) { - printf("[%03d + 6] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value2)) { - printf("[%03d + 7] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - if (!mysqli_stmt_execute($stmt)) { - printf("[%03d + 8] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - mysqli_stmt_close($stmt); - if (!$res = mysqli_query($link, "SELECT col1, col2 FROM test")) { - printf("[%03d + 9] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (2 !== ($tmp = mysqli_num_rows($res))) { - printf("[%03d + 10] Expecting 2 rows, got %d rows [%d] %s\n", $offset, $tmp, mysqli_errno($link), mysqli_error($link)); - } - - $row = mysqli_fetch_assoc($res); - if (($row['col1'] != $bind_value1) || ($row['col2'] != $bind_value1)) { - printf("[%03d + 11] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n", - $offset, $bind_value1, $bind_value1, - $row['col1'], $row['col2'], - mysqli_errno($link), mysqli_error($link)); - return false; - } - - $row = mysqli_fetch_assoc($res); - if (($row['col1'] != $bind_value1) || ($row['col2'] != $bind_value2)) { - printf("[%03d + 12] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n", - $offset, $bind_value1, $bind_value2, - $row['col1'], $row['col2'], - mysqli_errno($link), mysqli_error($link)); - return false; - } - mysqli_free_result($res); - return true; - } - - bind_twice($link, $engine, 'CHAR(1)', 'CHAR(1)', 's', 's', 'a', 'b', 10); - bind_twice($link, $engine, 'INT', 'INT', 'i', 'i', 1, 2, 20); - bind_twice($link, $engine, 'FLOAT', 'FLOAT', 'd', 'd', 1.01, 1.02, 30); - - /* type juggling - note that int->char works */ - bind_twice($link, $engine, 'CHAR(1)', 'CHAR(1)', 's', 's', 1, 2, 40); - /* type juggling - note that string->integer works */ - bind_twice($link, $engine, 'INT', 'INT', 'i', 'i', '1', '2', 50); - /* type juggling - note that string->float works*/ - bind_twice($link, $engine, 'FLOAT', 'FLOAT', 'd', 'd', '1.01', '1.02', 60); - - /* now, let's have two columns of different type and do type juggling */ - /* - what the test will do is: - 1) col1 INT, col2 CHAR(1) + require('table.inc'); + + function bind_twice($link, $engine, $sql_type1, $sql_type2, $bind_type1, $bind_type2, $bind_value1, $bind_value2, $offset) { + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { + printf("[%03d + 1] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } + mysqli_autocommit($link, true); + + $sql = sprintf("CREATE TABLE test(col1 %s, col2 %s) ENGINE=%s", $sql_type1, $sql_type2, $engine); + if (!mysqli_query($link, $sql)) { + printf("[%03d + 2] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!$stmt = mysqli_stmt_init($link)) { + printf("[%03d + 3] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(col1, col2) VALUES (?, ?)")) { + printf("[%03d + 4] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value1)) { + printf("[%03d + 5] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!mysqli_stmt_execute($stmt)) { + printf("[%03d + 6] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value2)) { + printf("[%03d + 7] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + if (!mysqli_stmt_execute($stmt)) { + printf("[%03d + 8] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + mysqli_stmt_close($stmt); + if (!$res = mysqli_query($link, "SELECT col1, col2 FROM test")) { + printf("[%03d + 9] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (2 !== ($tmp = mysqli_num_rows($res))) { + printf("[%03d + 10] Expecting 2 rows, got %d rows [%d] %s\n", $offset, $tmp, mysqli_errno($link), mysqli_error($link)); + } + + $row = mysqli_fetch_assoc($res); + if (($row['col1'] != $bind_value1) || ($row['col2'] != $bind_value1)) { + printf("[%03d + 11] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n", + $offset, $bind_value1, $bind_value1, + $row['col1'], $row['col2'], + mysqli_errno($link), mysqli_error($link)); + return false; + } + + $row = mysqli_fetch_assoc($res); + if (($row['col1'] != $bind_value1) || ($row['col2'] != $bind_value2)) { + printf("[%03d + 12] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n", + $offset, $bind_value1, $bind_value2, + $row['col1'], $row['col2'], + mysqli_errno($link), mysqli_error($link)); + return false; + } + mysqli_free_result($res); + return true; + } + + bind_twice($link, $engine, 'CHAR(1)', 'CHAR(1)', 's', 's', 'a', 'b', 10); + bind_twice($link, $engine, 'INT', 'INT', 'i', 'i', 1, 2, 20); + bind_twice($link, $engine, 'FLOAT', 'FLOAT', 'd', 'd', 1.01, 1.02, 30); + + /* type juggling - note that int->char works */ + bind_twice($link, $engine, 'CHAR(1)', 'CHAR(1)', 's', 's', 1, 2, 40); + /* type juggling - note that string->integer works */ + bind_twice($link, $engine, 'INT', 'INT', 'i', 'i', '1', '2', 50); + /* type juggling - note that string->float works*/ + bind_twice($link, $engine, 'FLOAT', 'FLOAT', 'd', 'd', '1.01', '1.02', 60); + + /* now, let's have two columns of different type and do type juggling */ + /* + what the test will do is: + 1) col1 INT, col2 CHAR(1) 2) bind_param('is', 1, 1) 3) execute() - 4) bind_param('is', 1, 'a') - 5) execute() + 4) bind_param('is', 1, 'a') + 5) execute() - col1 INT, col2 INT + col1 INT, col2 INT bind_param('ii', '1', '2') --> OK (int column, string value) - bind_param('ii', 1, 2) --> OK (int column, int value) + bind_param('ii', 1, 2) --> OK (int column, int value) col1 CHAR(1), col2 CHAR(2) bind_param('ss', 1, 2) --> OK (string column, int value) - So, what about: - col1 INT, COL2 CHAR(1) - bind_param('is', 1, 1) ---> ?? - */ - bind_twice($link, $engine, 'INT', 'CHAR(1)', 'i', 's', 1, 'a', 70); + So, what about: + col1 INT, COL2 CHAR(1) + bind_param('is', 1, 1) ---> ?? + */ + bind_twice($link, $engine, 'INT', 'CHAR(1)', 'i', 's', 1, 'a', 70); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt index 40b5baf4ef..c1dddca4f2 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt @@ -8,19 +8,19 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - require('table.inc'); + require_once("connect.inc"); + require('table.inc'); - $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1")) - printf("[002a] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $stmt = mysqli_stmt_init($link); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1")) + printf("[002a] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - $stmt = mysqli_stmt_init($link); + mysqli_stmt_close($stmt); + $stmt = mysqli_stmt_init($link); - $id = null; - $label = null; - $foo = null; + $id = null; + $label = null; + $foo = null; try { mysqli_stmt_bind_result($stmt, $id); @@ -28,275 +28,275 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1")) - printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id))) - printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) - printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label, $foo))) - printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - - if (!mysqli_stmt_execute($stmt)) - printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - while (mysqli_stmt_fetch($stmt)) { - var_dump($id); - var_dump($label); - } - mysqli_stmt_close($stmt); - - - function func_mysqli_stmt_bind_result($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $type_hint = null) { - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { - // don't bail - column type might not be supported by the server, ignore this - return false; - } - - if (!$stmt = mysqli_stmt_init($link)) { - printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) { - printf("[%04d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - $id = null; - if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) { - printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - - for ($id = 1; $id < 4; $id++) { - if (!mysqli_stmt_execute($stmt)) { - printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - } - mysqli_stmt_close($stmt); - - $stmt = mysqli_stmt_init($link); - - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) { - printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - - if (!mysqli_stmt_execute($stmt)) { - printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - - $result = mysqli_stmt_result_metadata($stmt); - - $bind_res = null; - if (!mysqli_stmt_bind_result($stmt, $id, $bind_res)) { - printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - $num = 0; - $fields = mysqli_fetch_fields($result); - - while (mysqli_stmt_fetch($stmt)) { - if (!gettype($bind_res)=="unicode") { - if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) { - printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n", - $offset + 10, $num, - gettype($bind_value), $bind_value, $type_hint, - gettype($bind_res), $bind_res); - mysqli_stmt_close($stmt); - return false; - } - } - $num++; - } - - if ($num != 3) { - printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n", - $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num); - mysqli_stmt_close($stmt); - return false; - } - - mysqli_stmt_close($stmt); - return true; - } - - - function func_mysqli_stmt_bind_make_string($len) { - - $ret = ''; - for ($i = 0; $i < $len; $i++) - $ret .= chr(mt_rand(65, 90)); - - return $ret; - } - - func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT", -11, 20); - func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT", NULL, 40); - func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT UNSIGNED", 1, 60); - func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT UNSIGNED", NULL, 80); - - func_mysqli_stmt_bind_result($link, $engine, "i", "BOOL", 1, 100); - func_mysqli_stmt_bind_result($link, $engine, "i", "BOOL", NULL, 120); - func_mysqli_stmt_bind_result($link, $engine, "i", "BOOLEAN", 0, 140); - func_mysqli_stmt_bind_result($link, $engine, "i", "BOOLEAN", NULL, 160); - - func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", -32768, 180); - func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", 32767, 200); - func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", NULL, 220); - func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 240); - func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 260); - - func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", -8388608, 280, "integer"); - func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", 8388607, 300, "integer"); - func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", NULL, 320); - func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT UNSIGNED", 16777215, 340, "integer"); - func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT UNSIGNED", NULL, 360); - - func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? max(-1 * PHP_INT_MAX + 1, -2147483648) : 1, 380); - func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", -2147483647, 400, "integer"); - func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? min(2147483647, PHP_INT_MAX) : 1, 420); - func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", NULL, 440); - func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, 2147483647) : 1, 460); - func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", 4294967295, 480, (defined("PHP_INT_MAX") && (4294967295 > PHP_INT_MAX)) ? "string" : null); - func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", NULL, 500); - - /* test is broken too: we bind "integer" but value is a float - func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -9223372036854775808, 520); - func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", 18446744073709551615, 560); - */ - func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", NULL, 540); - func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", NULL, 580); - func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -1, 1780); - func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", 1, 1800); - func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820); - func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840); - func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860); - func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880); - - func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600); - func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", NULL, 620); - func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640); - func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660); - - // Yes, we need the temporary variable. The PHP casting will fouls us otherwise. - $tmp = strval('-99999999.99'); - func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string"); - func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700); - $tmp = strval('99999999.99'); - func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string"); - func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740); - $tmp = strval('-99999999.99'); - func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string"); - func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780); - $tmp = strval('99999999.99'); - func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string"); - func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820); - - // don't care about date() strict TZ warnings... - func_mysqli_stmt_bind_result($link, $engine, "s", "DATE", @date('Y-m-d'), 840); - func_mysqli_stmt_bind_result($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 860); - func_mysqli_stmt_bind_result($link, $engine, "s", "DATE", NULL, 880); - - func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 900); - func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 920); - func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME", NULL, 940); - - func_mysqli_stmt_bind_result($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 960); - - func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", @date('H:i:s'), 980); - func_mysqli_stmt_bind_result($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 1000); - func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", NULL, 1020); - - $tmp = intval(@date('Y')); - func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer"); - func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer"); - func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", NULL, 1080); - - $string255 = func_mysqli_stmt_bind_make_string(255); - func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1)", "a", 1110, 'string'); - func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(255)", $string255, 1120, 'string'); - func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1) NOT NULL", "a", 1140, 'string'); - func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1)", NULL, 1160); - - $string65k = func_mysqli_stmt_bind_make_string(65535); - func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1)", "a", 1180, 'string'); - func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(255)", $string255, 1200, 'string'); - func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(65635)", $string65k, 1220, 'string'); - func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 1240, 'string'); - func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1)", NULL, 1260); - - func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", "a", 1280); - func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", chr(0), 1300); - func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1) NOT NULL", "b", 1320); - func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", NULL, 1340); - - func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", "a", 1360); - func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", chr(0), 1380); - func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 1400); - func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", NULL, 1420); - - func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", "a", 1440); - func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", chr(0), 1460); - func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB NOT NULL", "b", 1480); - func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", NULL, 1500); - - func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT", "a", 1520, 'string'); - func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT NOT NULL", "a", 1540, 'string'); - func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT", NULL, 1560, 'string'); - - // Note: you cannot insert any blob values this way. But you can check the API at least partly this way - // Extra BLOB tests are in mysqli_stmt_send_long() - func_mysqli_stmt_bind_result($link, $engine, "b", "BLOB", "", 1580); - func_mysqli_stmt_bind_result($link, $engine, "b", "TEXT", "", 1600, 'string'); - func_mysqli_stmt_bind_result($link, $engine, "b", "MEDIUMBLOB", "", 1620); - func_mysqli_stmt_bind_result($link, $engine, "b", "MEDIUMTEXT", "", 1640, 'string'); - - /* Is this one related? http://bugs.php.net/bug.php?id=35759 */ - if (($IS_MYSQLND) || (!$IS_MYSQLND && (ini_get('memory_limit') > 4294967296))) { - /* NOTE: the MySQL Client Library - not mysqlnd - will allocate - a hugge max_length(type) = 4GB bind buffer */ - func_mysqli_stmt_bind_result($link, $engine, "b", "LONGBLOB", "", 1660); - func_mysqli_stmt_bind_result($link, $engine, "b", "LONGTEXT", "", 1680, 'string'); - } - - func_mysqli_stmt_bind_result($link, $engine, "s", "ENUM('a', 'b')", "a", 1700, 'string'); - func_mysqli_stmt_bind_result($link, $engine, "s", "ENUM('a', 'b')", NULL, 1720, 'string'); - func_mysqli_stmt_bind_result($link, $engine, "s", "SET('a', 'b')", "a", 1740, 'string'); - func_mysqli_stmt_bind_result($link, $engine, "s", "SET('a', 'b')", NULL, 1760, 'string'); - - if (mysqli_get_server_version($link) >= 50600) - func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", "13:31:34.123456", 1770, "13:31:34"); - - $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1000, 'z')")) - printf("[3001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = null; - if (false !== @mysqli_stmt_bind_result($stmt, $id)) - printf("[3002] Bind result should not be allowed"); - - mysqli_stmt_close($stmt); - - mysqli_close($link); - print "done!"; + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1")) + printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id))) + printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) + printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label, $foo))) + printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + if (!mysqli_stmt_execute($stmt)) + printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + while (mysqli_stmt_fetch($stmt)) { + var_dump($id); + var_dump($label); + } + mysqli_stmt_close($stmt); + + + function func_mysqli_stmt_bind_result($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $type_hint = null) { + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { + printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { + // don't bail - column type might not be supported by the server, ignore this + return false; + } + + if (!$stmt = mysqli_stmt_init($link)) { + printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) { + printf("[%04d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + $id = null; + if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) { + printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + + for ($id = 1; $id < 4; $id++) { + if (!mysqli_stmt_execute($stmt)) { + printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + } + mysqli_stmt_close($stmt); + + $stmt = mysqli_stmt_init($link); + + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) { + printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + + if (!mysqli_stmt_execute($stmt)) { + printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + + $result = mysqli_stmt_result_metadata($stmt); + + $bind_res = null; + if (!mysqli_stmt_bind_result($stmt, $id, $bind_res)) { + printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + $num = 0; + $fields = mysqli_fetch_fields($result); + + while (mysqli_stmt_fetch($stmt)) { + if (!gettype($bind_res)=="unicode") { + if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) { + printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n", + $offset + 10, $num, + gettype($bind_value), $bind_value, $type_hint, + gettype($bind_res), $bind_res); + mysqli_stmt_close($stmt); + return false; + } + } + $num++; + } + + if ($num != 3) { + printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n", + $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num); + mysqli_stmt_close($stmt); + return false; + } + + mysqli_stmt_close($stmt); + return true; + } + + + function func_mysqli_stmt_bind_make_string($len) { + + $ret = ''; + for ($i = 0; $i < $len; $i++) + $ret .= chr(mt_rand(65, 90)); + + return $ret; + } + + func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT", -11, 20); + func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT", NULL, 40); + func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT UNSIGNED", 1, 60); + func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT UNSIGNED", NULL, 80); + + func_mysqli_stmt_bind_result($link, $engine, "i", "BOOL", 1, 100); + func_mysqli_stmt_bind_result($link, $engine, "i", "BOOL", NULL, 120); + func_mysqli_stmt_bind_result($link, $engine, "i", "BOOLEAN", 0, 140); + func_mysqli_stmt_bind_result($link, $engine, "i", "BOOLEAN", NULL, 160); + + func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", -32768, 180); + func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", 32767, 200); + func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", NULL, 220); + func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 240); + func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 260); + + func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", -8388608, 280, "integer"); + func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", 8388607, 300, "integer"); + func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", NULL, 320); + func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT UNSIGNED", 16777215, 340, "integer"); + func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT UNSIGNED", NULL, 360); + + func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? max(-1 * PHP_INT_MAX + 1, -2147483648) : 1, 380); + func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", -2147483647, 400, "integer"); + func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? min(2147483647, PHP_INT_MAX) : 1, 420); + func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", NULL, 440); + func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, 2147483647) : 1, 460); + func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", 4294967295, 480, (defined("PHP_INT_MAX") && (4294967295 > PHP_INT_MAX)) ? "string" : null); + func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", NULL, 500); + + /* test is broken too: we bind "integer" but value is a float + func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -9223372036854775808, 520); + func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", 18446744073709551615, 560); + */ + func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", NULL, 540); + func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", NULL, 580); + func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -1, 1780); + func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", 1, 1800); + func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820); + func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840); + func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860); + func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880); + + func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600); + func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", NULL, 620); + func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640); + func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660); + + // Yes, we need the temporary variable. The PHP casting will fouls us otherwise. + $tmp = strval('-99999999.99'); + func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string"); + func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700); + $tmp = strval('99999999.99'); + func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string"); + func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740); + $tmp = strval('-99999999.99'); + func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string"); + func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780); + $tmp = strval('99999999.99'); + func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string"); + func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820); + + // don't care about date() strict TZ warnings... + func_mysqli_stmt_bind_result($link, $engine, "s", "DATE", @date('Y-m-d'), 840); + func_mysqli_stmt_bind_result($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 860); + func_mysqli_stmt_bind_result($link, $engine, "s", "DATE", NULL, 880); + + func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 900); + func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 920); + func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME", NULL, 940); + + func_mysqli_stmt_bind_result($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 960); + + func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", @date('H:i:s'), 980); + func_mysqli_stmt_bind_result($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 1000); + func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", NULL, 1020); + + $tmp = intval(@date('Y')); + func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer"); + func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer"); + func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", NULL, 1080); + + $string255 = func_mysqli_stmt_bind_make_string(255); + func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1)", "a", 1110, 'string'); + func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(255)", $string255, 1120, 'string'); + func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1) NOT NULL", "a", 1140, 'string'); + func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1)", NULL, 1160); + + $string65k = func_mysqli_stmt_bind_make_string(65535); + func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1)", "a", 1180, 'string'); + func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(255)", $string255, 1200, 'string'); + func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(65635)", $string65k, 1220, 'string'); + func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 1240, 'string'); + func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1)", NULL, 1260); + + func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", "a", 1280); + func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", chr(0), 1300); + func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1) NOT NULL", "b", 1320); + func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", NULL, 1340); + + func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", "a", 1360); + func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", chr(0), 1380); + func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 1400); + func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", NULL, 1420); + + func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", "a", 1440); + func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", chr(0), 1460); + func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB NOT NULL", "b", 1480); + func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", NULL, 1500); + + func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT", "a", 1520, 'string'); + func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT NOT NULL", "a", 1540, 'string'); + func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT", NULL, 1560, 'string'); + + // Note: you cannot insert any blob values this way. But you can check the API at least partly this way + // Extra BLOB tests are in mysqli_stmt_send_long() + func_mysqli_stmt_bind_result($link, $engine, "b", "BLOB", "", 1580); + func_mysqli_stmt_bind_result($link, $engine, "b", "TEXT", "", 1600, 'string'); + func_mysqli_stmt_bind_result($link, $engine, "b", "MEDIUMBLOB", "", 1620); + func_mysqli_stmt_bind_result($link, $engine, "b", "MEDIUMTEXT", "", 1640, 'string'); + + /* Is this one related? http://bugs.php.net/bug.php?id=35759 */ + if (($IS_MYSQLND) || (!$IS_MYSQLND && (ini_get('memory_limit') > 4294967296))) { + /* NOTE: the MySQL Client Library - not mysqlnd - will allocate + a hugge max_length(type) = 4GB bind buffer */ + func_mysqli_stmt_bind_result($link, $engine, "b", "LONGBLOB", "", 1660); + func_mysqli_stmt_bind_result($link, $engine, "b", "LONGTEXT", "", 1680, 'string'); + } + + func_mysqli_stmt_bind_result($link, $engine, "s", "ENUM('a', 'b')", "a", 1700, 'string'); + func_mysqli_stmt_bind_result($link, $engine, "s", "ENUM('a', 'b')", NULL, 1720, 'string'); + func_mysqli_stmt_bind_result($link, $engine, "s", "SET('a', 'b')", "a", 1740, 'string'); + func_mysqli_stmt_bind_result($link, $engine, "s", "SET('a', 'b')", NULL, 1760, 'string'); + + if (mysqli_get_server_version($link) >= 50600) + func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", "13:31:34.123456", 1770, "13:31:34"); + + $stmt = mysqli_stmt_init($link); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1000, 'z')")) + printf("[3001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = null; + if (false !== @mysqli_stmt_bind_result($stmt, $id)) + printf("[3002] Bind result should not be allowed"); + + mysqli_stmt_close($stmt); + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt index 734d691c28..39a2f503f8 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt @@ -8,148 +8,148 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - function dec32bin($dec, $bits) { - - $maxval = pow(2, $bits); - $bin = ''; - for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) { - if (($dec / $bitval) >= 1) { - $bin .= '1'; - $dec -= $bitval; - } else { - $bin .= '0'; - } - } - return $bin; - } - - if (!$link_ins = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] 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_sel = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - for ($bits = 1; $bits <= 46; $bits++) { - - if (1 == $bits) - $max_value = 1; - else - $max_value = pow(2, $bits) - 1; - - if (!mysqli_query($link_ins, "DROP TABLE IF EXISTS test")) { - printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link_ins), mysqli_error($link_ins)); - } - - if (!mysqli_query($link_ins, sprintf("CREATE TABLE test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE = %s", $bits, $bits, $engine))) { - // don't bail - column type might not be supported by the server, ignore this - continue; - } - if (!$stmt_ins = mysqli_stmt_init($link_ins)) { - printf("[004 - %d] [%d] %s\n", $bits, mysqli_errno($link_ins), mysqli_error($link_ins)); - continue; - } - - if (!mysqli_stmt_prepare($stmt_ins, "INSERT INTO test(id, bit_value) VALUES (?, ?)")) { - printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins)); - mysqli_stmt_close($stmt_ins); - continue; - } - - if (!($stmt_sel = mysqli_stmt_init($link_sel))) { - printf("[006 - %d] [%d] %s\n", $bits, mysqli_errno($link_sel), mysqli_error($link_sel)); - mysqli_stmt_close($stmt_ins); - continue; - } - - $tests = 0; - $rand_max = mt_getrandmax(); - while ($tests < 10) { - - $tests++; - if (1 == $tests) - $value = 0; - else if (2 == $tests) - $value = $max_value; - else { - if ($max_value > $rand_max) { - $max_loops = floor($max_value/$rand_max); - $num_loops = mt_rand(1, $max_loops); - $value = 0; - for ($i = 0; $i < $num_loops; $i++) - $value += mt_rand(0, $rand_max); - } else { - $value = mt_rand(0, $max_value); - } - } - - $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits); - for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++) - ; - $bin2 = substr($bin, $i, strlen($bin)); - - if (!mysqli_stmt_bind_param($stmt_ins, "dd", $value, $value)) { - printf("[007 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins)); - mysqli_stmt_close($stmt_ins); - continue; - } - if (!mysqli_stmt_execute($stmt_ins)) { - printf("[008 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins)); - break; - } - $sql = sprintf("SELECT id, BIN(bit_value) AS _bin, bit_value, bit_value + 0 AS _bit_value0, bit_null FROM test WHERE id = %s", $value); - if ((!mysqli_stmt_prepare($stmt_sel, $sql)) || - (!mysqli_stmt_execute($stmt_sel))) { - printf("[009 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel)); - break; - } - - $row = array('id' => -1, '_bin' => - 1, 'bit_value' => -1, '_bit_value0' => -1, 'bit_null' => -1); - if (!mysqli_stmt_bind_result($stmt_sel, $row['id'], $row['_bin'], $row['bit_value'], $row['_bit_value0'], $row['bit_null'])) { - printf("[010 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel)); - break; - } - - if (!($ret = mysqli_stmt_fetch($stmt_sel))) { - printf("[011 - %d] mysqli_stmt_fetch() has failed for %d bits - ret = %s/%s, [%d] %s, [%d] %s\n", - $bits, $bits, - gettype($ret), $ret, - mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel), - mysqli_errno($link_sel), mysqli_errno($link_sel) - ); - break; - } - - if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) { - debug_zval_dump($row); - printf("[012 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n", - $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2); - break; - } - if ($value != $row['bit_value']) { - debug_zval_dump($row); - printf("[013 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']); - break; - } - - if (null !== $row['bit_null']) { - debug_zval_dump($row); - printf("[014 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']); - break; - } - - } - - mysqli_stmt_close($stmt_ins); - mysqli_stmt_close($stmt_sel); - } - - mysqli_close($link_ins); - mysqli_close($link_sel); - print "done!"; + require_once("connect.inc"); + + function dec32bin($dec, $bits) { + + $maxval = pow(2, $bits); + $bin = ''; + for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) { + if (($dec / $bitval) >= 1) { + $bin .= '1'; + $dec -= $bitval; + } else { + $bin .= '0'; + } + } + return $bin; + } + + if (!$link_ins = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] 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_sel = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + for ($bits = 1; $bits <= 46; $bits++) { + + if (1 == $bits) + $max_value = 1; + else + $max_value = pow(2, $bits) - 1; + + if (!mysqli_query($link_ins, "DROP TABLE IF EXISTS test")) { + printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link_ins), mysqli_error($link_ins)); + } + + if (!mysqli_query($link_ins, sprintf("CREATE TABLE test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE = %s", $bits, $bits, $engine))) { + // don't bail - column type might not be supported by the server, ignore this + continue; + } + if (!$stmt_ins = mysqli_stmt_init($link_ins)) { + printf("[004 - %d] [%d] %s\n", $bits, mysqli_errno($link_ins), mysqli_error($link_ins)); + continue; + } + + if (!mysqli_stmt_prepare($stmt_ins, "INSERT INTO test(id, bit_value) VALUES (?, ?)")) { + printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins)); + mysqli_stmt_close($stmt_ins); + continue; + } + + if (!($stmt_sel = mysqli_stmt_init($link_sel))) { + printf("[006 - %d] [%d] %s\n", $bits, mysqli_errno($link_sel), mysqli_error($link_sel)); + mysqli_stmt_close($stmt_ins); + continue; + } + + $tests = 0; + $rand_max = mt_getrandmax(); + while ($tests < 10) { + + $tests++; + if (1 == $tests) + $value = 0; + else if (2 == $tests) + $value = $max_value; + else { + if ($max_value > $rand_max) { + $max_loops = floor($max_value/$rand_max); + $num_loops = mt_rand(1, $max_loops); + $value = 0; + for ($i = 0; $i < $num_loops; $i++) + $value += mt_rand(0, $rand_max); + } else { + $value = mt_rand(0, $max_value); + } + } + + $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits); + for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++) + ; + $bin2 = substr($bin, $i, strlen($bin)); + + if (!mysqli_stmt_bind_param($stmt_ins, "dd", $value, $value)) { + printf("[007 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins)); + mysqli_stmt_close($stmt_ins); + continue; + } + if (!mysqli_stmt_execute($stmt_ins)) { + printf("[008 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins)); + break; + } + $sql = sprintf("SELECT id, BIN(bit_value) AS _bin, bit_value, bit_value + 0 AS _bit_value0, bit_null FROM test WHERE id = %s", $value); + if ((!mysqli_stmt_prepare($stmt_sel, $sql)) || + (!mysqli_stmt_execute($stmt_sel))) { + printf("[009 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel)); + break; + } + + $row = array('id' => -1, '_bin' => - 1, 'bit_value' => -1, '_bit_value0' => -1, 'bit_null' => -1); + if (!mysqli_stmt_bind_result($stmt_sel, $row['id'], $row['_bin'], $row['bit_value'], $row['_bit_value0'], $row['bit_null'])) { + printf("[010 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel)); + break; + } + + if (!($ret = mysqli_stmt_fetch($stmt_sel))) { + printf("[011 - %d] mysqli_stmt_fetch() has failed for %d bits - ret = %s/%s, [%d] %s, [%d] %s\n", + $bits, $bits, + gettype($ret), $ret, + mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel), + mysqli_errno($link_sel), mysqli_errno($link_sel) + ); + break; + } + + if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) { + debug_zval_dump($row); + printf("[012 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n", + $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2); + break; + } + if ($value != $row['bit_value']) { + debug_zval_dump($row); + printf("[013 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']); + break; + } + + if (null !== $row['bit_null']) { + debug_zval_dump($row); + printf("[014 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']); + break; + } + + } + + mysqli_stmt_close($stmt_ins); + mysqli_stmt_close($stmt_sel); + } + + mysqli_close($link_ins); + mysqli_close($link_sel); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt index 8cff6b1496..62a3e499ae 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt @@ -10,204 +10,204 @@ require_once('skipifconnectfailure.inc'); memory_limit=83886080 --FILE-- <?php - require_once("connect.inc"); - - function create_table($link, $column, $min, $max, $engine, $offset) { - - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("[%03d] Cannot drop table test, [%d] %s\n", - $offset, - mysqli_errno($link), mysqli_error($link)); - return array(); - } - - $sql = sprintf("CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col1 %s) ENGINE=%s", - $column, $engine); - if (!mysqli_query($link, $sql)) { - printf("[%03d] Cannot create table test, [%d] %s\n", - $offset + 1, - mysqli_errno($link), mysqli_error($link)); - return array(); - } - - $values = array(); - for ($i = 1; $i <= 100; $i++) { - $col1 = mt_rand($min, $max); - $values[$i] = $col1; - $sql = sprintf("INSERT INTO test(id, col1) VALUES (%d, %f)", - $i, $col1); - if (!mysqli_query($link, $sql)) { - printf("[%03d] Cannot insert data, [%d] %s\n", - $offset + 2, - mysqli_errno($link), mysqli_error($link)); - return array(); - } - } - - return $values; - } - - function test_format($link, $format, $from, $order_by, $expected, $offset) { - - if (!$stmt = mysqli_stmt_init($link)) { - printf("[%03d] Cannot create PS, [%d] %s\n", - $offset, - mysqli_errno($link), mysqli_error($link)); - return false; - } - - if ($order_by) - $sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by); - else - $sql = sprintf('SELECT %s AS _format FROM %s', $format, $from); - - if (!mysqli_stmt_prepare($stmt, $sql)) { - printf("[%03d] Cannot prepare PS, [%d] %s\n", - $offset + 1, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!mysqli_stmt_execute($stmt)) { - printf("[%03d] Cannot execute PS, [%d] %s\n", - $offset + 2, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!mysqli_stmt_store_result($stmt)) { - printf("[%03d] Cannot store result set, [%d] %s\n", - $offset + 3, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!is_array($expected)) { - - $result = null; - if (!mysqli_stmt_bind_result($stmt, $result)) { - printf("[%03d] Cannot bind result, [%d] %s\n", - $offset + 4, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!mysqli_stmt_fetch($stmt)) { - printf("[%03d] Cannot fetch result,, [%d] %s\n", - $offset + 5, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if ($result !== $expected) { - printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n", - $offset + 6, - gettype($expected), $expected, - gettype($result), $result, - $format, $sql); - } - - } else { - - $order_by_col = $result = null; - if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) { - printf("[%03d] Cannot bind result, [%d] %s\n", - $offset + 7, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - foreach ($expected as $k => $v) { - if (!mysqli_stmt_fetch($stmt)) { - break; - } - if ($result !== $v) { - printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n", - $offset + 8, - $k, - gettype($v), $v, - gettype($result), $result, - $order_by_col, - $format, $sql); - } - } - - } - - mysqli_stmt_free_result($stmt); - mysqli_stmt_close($stmt); - - return true; - } - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect - [%d] %s\n", - mysqli_connect_errno(), - mysqli_connect_error()); - - /* select from dual - pseudo table */ - test_format($link, 'FORMAT(1.01, 0)', 'DUAL', null, '1', 10); - test_format($link, 'FORMAT(1.23, 1)', 'DUAL', null, '1.2', 20); - test_format($link, 'FORMAT(1.23, 2)', 'DUAL', null, '1.23', 30); - test_format($link, 'FORMAT(1234.567, 3)', 'DUAL', null, '1,234.567', 40); - /* no typo! */ - test_format($link, 'FORMAT(1234.567, 4)', 'DUAL', null, '1,234.5670', 50); - - mysqli_close($link); - require_once('table.inc'); - - /* select from existing table */ - test_format($link, 'FORMAT(id, 0)', 'test', null, '1', 60); - test_format($link, 'FORMAT(id + 0.1, 1)', 'test', null, '1.1', 70); - test_format($link, 'FORMAT(id + 0.01, 2)', 'test', null, '1.01', 80); - - /* create new table and select from it */ - $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 90); - foreach ($expected as $k => $v) - $expected[$k] = number_format(round($v), 0, '.', ','); - test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 100); - - $expected = create_table($link, 'FLOAT UNSIGNED', 0, 10000, $engine, 110); - foreach ($expected as $k => $v) - $expected[$k] = number_format(round($v), 0, '.', ','); - test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 120); - - $expected = create_table($link, 'TINYINT', -128, 127, $engine, 130); - foreach ($expected as $k => $v) - $expected[$k] = number_format(round($v), 0, '.', ','); - test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 140); - - $expected = create_table($link, 'SMALLINT UNSIGNED', 0, 65535, $engine, 150); - foreach ($expected as $k => $v) - $expected[$k] = number_format(round($v), 0, '.', ','); - test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 160); - - $expected = create_table($link, 'MEDIUMINT', 0, 8388607, $engine, 170); - foreach ($expected as $k => $v) - $expected[$k] = number_format(round($v), 0, '.', ','); - test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 180); - - $expected = create_table($link, 'INT UNSIGNED', 0, 1000, $engine, 190); - foreach ($expected as $k => $v) - $expected[$k] = number_format(round($v), 0, '.', ','); - test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 200); - - $expected = create_table($link, 'BIGINT', -1000, 1000, $engine, 210); - foreach ($expected as $k => $v) - $expected[$k] = number_format(round($v), 0, '.', ','); - test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 220); - - $expected = create_table($link, 'DECIMAL(5,0)', -1000, 1000, $engine, 230); - foreach ($expected as $k => $v) - $expected[$k] = number_format(round($v), 0, '.', ','); - test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 240); - - // http://bugs.php.net/bug.php?id=42378 - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[300] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - if (mysqli_query($link, "CREATE TABLE `test` ( + require_once("connect.inc"); + + function create_table($link, $column, $min, $max, $engine, $offset) { + + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { + printf("[%03d] Cannot drop table test, [%d] %s\n", + $offset, + mysqli_errno($link), mysqli_error($link)); + return array(); + } + + $sql = sprintf("CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col1 %s) ENGINE=%s", + $column, $engine); + if (!mysqli_query($link, $sql)) { + printf("[%03d] Cannot create table test, [%d] %s\n", + $offset + 1, + mysqli_errno($link), mysqli_error($link)); + return array(); + } + + $values = array(); + for ($i = 1; $i <= 100; $i++) { + $col1 = mt_rand($min, $max); + $values[$i] = $col1; + $sql = sprintf("INSERT INTO test(id, col1) VALUES (%d, %f)", + $i, $col1); + if (!mysqli_query($link, $sql)) { + printf("[%03d] Cannot insert data, [%d] %s\n", + $offset + 2, + mysqli_errno($link), mysqli_error($link)); + return array(); + } + } + + return $values; + } + + function test_format($link, $format, $from, $order_by, $expected, $offset) { + + if (!$stmt = mysqli_stmt_init($link)) { + printf("[%03d] Cannot create PS, [%d] %s\n", + $offset, + mysqli_errno($link), mysqli_error($link)); + return false; + } + + if ($order_by) + $sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by); + else + $sql = sprintf('SELECT %s AS _format FROM %s', $format, $from); + + if (!mysqli_stmt_prepare($stmt, $sql)) { + printf("[%03d] Cannot prepare PS, [%d] %s\n", + $offset + 1, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!mysqli_stmt_execute($stmt)) { + printf("[%03d] Cannot execute PS, [%d] %s\n", + $offset + 2, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!mysqli_stmt_store_result($stmt)) { + printf("[%03d] Cannot store result set, [%d] %s\n", + $offset + 3, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!is_array($expected)) { + + $result = null; + if (!mysqli_stmt_bind_result($stmt, $result)) { + printf("[%03d] Cannot bind result, [%d] %s\n", + $offset + 4, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!mysqli_stmt_fetch($stmt)) { + printf("[%03d] Cannot fetch result,, [%d] %s\n", + $offset + 5, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if ($result !== $expected) { + printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n", + $offset + 6, + gettype($expected), $expected, + gettype($result), $result, + $format, $sql); + } + + } else { + + $order_by_col = $result = null; + if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) { + printf("[%03d] Cannot bind result, [%d] %s\n", + $offset + 7, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + foreach ($expected as $k => $v) { + if (!mysqli_stmt_fetch($stmt)) { + break; + } + if ($result !== $v) { + printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n", + $offset + 8, + $k, + gettype($v), $v, + gettype($result), $result, + $order_by_col, + $format, $sql); + } + } + + } + + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + + return true; + } + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect - [%d] %s\n", + mysqli_connect_errno(), + mysqli_connect_error()); + + /* select from dual - pseudo table */ + test_format($link, 'FORMAT(1.01, 0)', 'DUAL', null, '1', 10); + test_format($link, 'FORMAT(1.23, 1)', 'DUAL', null, '1.2', 20); + test_format($link, 'FORMAT(1.23, 2)', 'DUAL', null, '1.23', 30); + test_format($link, 'FORMAT(1234.567, 3)', 'DUAL', null, '1,234.567', 40); + /* no typo! */ + test_format($link, 'FORMAT(1234.567, 4)', 'DUAL', null, '1,234.5670', 50); + + mysqli_close($link); + require_once('table.inc'); + + /* select from existing table */ + test_format($link, 'FORMAT(id, 0)', 'test', null, '1', 60); + test_format($link, 'FORMAT(id + 0.1, 1)', 'test', null, '1.1', 70); + test_format($link, 'FORMAT(id + 0.01, 2)', 'test', null, '1.01', 80); + + /* create new table and select from it */ + $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 90); + foreach ($expected as $k => $v) + $expected[$k] = number_format(round($v), 0, '.', ','); + test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 100); + + $expected = create_table($link, 'FLOAT UNSIGNED', 0, 10000, $engine, 110); + foreach ($expected as $k => $v) + $expected[$k] = number_format(round($v), 0, '.', ','); + test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 120); + + $expected = create_table($link, 'TINYINT', -128, 127, $engine, 130); + foreach ($expected as $k => $v) + $expected[$k] = number_format(round($v), 0, '.', ','); + test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 140); + + $expected = create_table($link, 'SMALLINT UNSIGNED', 0, 65535, $engine, 150); + foreach ($expected as $k => $v) + $expected[$k] = number_format(round($v), 0, '.', ','); + test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 160); + + $expected = create_table($link, 'MEDIUMINT', 0, 8388607, $engine, 170); + foreach ($expected as $k => $v) + $expected[$k] = number_format(round($v), 0, '.', ','); + test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 180); + + $expected = create_table($link, 'INT UNSIGNED', 0, 1000, $engine, 190); + foreach ($expected as $k => $v) + $expected[$k] = number_format(round($v), 0, '.', ','); + test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 200); + + $expected = create_table($link, 'BIGINT', -1000, 1000, $engine, 210); + foreach ($expected as $k => $v) + $expected[$k] = number_format(round($v), 0, '.', ','); + test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 220); + + $expected = create_table($link, 'DECIMAL(5,0)', -1000, 1000, $engine, 230); + foreach ($expected as $k => $v) + $expected[$k] = number_format(round($v), 0, '.', ','); + test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 240); + + // http://bugs.php.net/bug.php?id=42378 + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { + printf("[300] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + if (mysqli_query($link, "CREATE TABLE `test` ( `targetport` int(11) NOT NULL default '0', `sources` double(17,4) default NULL, `current_sources` double(17,4) default NULL, @@ -222,116 +222,116 @@ memory_limit=83886080 PRIMARY KEY (`targetport`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1")) { - do { - $values = array(); - for ($i = 0; $i < 200; $i++) { - $current_targets = mt_rand(-100000, 100000) / 10; - do { - $trend = (mt_rand(0, 3) > 1) ? (mt_rand(-10000, 10000) / 100) : 'NULL'; - } while (isset($values[$trend])); - - $sql = sprintf('INSERT INTO test(targetport, current_targets, maxreports, trend) VALUES (%d, %f, %s, %s)', - $i, - $current_targets, - (mt_rand(0, 1) > 0) ? mt_rand(0, 1000) : 'NULL', - $trend); - if (!mysqli_query($link, $sql)) { - printf("[301] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - break 2; - } - if ($current_targets > 0 && $trend !== 'NULL') - $values[$trend] = $i; - } - krsort($values); - - if (!$stmt = mysqli_stmt_init($link)) { - printf("[302] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - break; - } - - if (!mysqli_stmt_prepare($stmt, 'SELECT trend, targetport, FORMAT(trend, 2) FROM test WHERE current_targets > 0 AND trend IS NOT NULL ORDER BY trend DESC LIMIT 100')) { - printf("[303] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); - break; - } - - if (!mysqli_stmt_execute($stmt)) { - printf("[304] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); - break; - } - - if (!mysqli_stmt_store_result($stmt)) { - printf("[305] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); - break; - } - - $trend = $targetport = $format = null; - if (!mysqli_stmt_bind_result($stmt, $trend, $targetport, $format)) { - - printf("[305] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); - break; - } - - foreach ($values as $exp_trend => $exp_targetport) { - if (!mysqli_stmt_fetch($stmt)) { - break; - } - if ($targetport != $exp_targetport) { - printf("[306] Values fetched from MySQL seem to be wrong, check manually\n"); - printf("%s/%s - %s/%s - '%s'\n", $trend, $exp_trend, $targetport, $exp_targetport, $format); - } - } - mysqli_stmt_free_result($stmt); - mysqli_stmt_close($stmt); - - // same but OO interface - if (!$stmt = mysqli_stmt_init($link)) { - printf("[307] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - break; - } - - if (!$stmt->prepare('SELECT trend, targetport, FORMAT(trend, 2) FROM test WHERE current_targets > 0 AND trend IS NOT NULL ORDER BY trend DESC LIMIT 100')) { - printf("[308] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); - break; - } - - if (!$stmt->execute()) { - printf("[309] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); - break; - } - - if (!$stmt->store_result()) { - printf("[310] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); - break; - } - - $trend = $targetport = $format = null; - if (!$stmt->bind_result($trend, $targetport, $format)) { - - printf("[311] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); - break; - } - - foreach ($values as $exp_trend => $exp_targetport) { - if (!$stmt->fetch()) { - break; - } - if ($targetport != $exp_targetport) { - printf("[312] Values fetched from MySQL seem to be wrong, check manually\n"); - printf("%s/%s - %s/%s - '%s'\n", $trend, $exp_trend, $targetport, $exp_targetport, $format); - } - } - $stmt->free_result(); - $stmt->close(); - - } while (false); - - } else { - var_dump(mysqli_error($link)); - } - - - mysqli_close($link); - print "done!"; + do { + $values = array(); + for ($i = 0; $i < 200; $i++) { + $current_targets = mt_rand(-100000, 100000) / 10; + do { + $trend = (mt_rand(0, 3) > 1) ? (mt_rand(-10000, 10000) / 100) : 'NULL'; + } while (isset($values[$trend])); + + $sql = sprintf('INSERT INTO test(targetport, current_targets, maxreports, trend) VALUES (%d, %f, %s, %s)', + $i, + $current_targets, + (mt_rand(0, 1) > 0) ? mt_rand(0, 1000) : 'NULL', + $trend); + if (!mysqli_query($link, $sql)) { + printf("[301] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + break 2; + } + if ($current_targets > 0 && $trend !== 'NULL') + $values[$trend] = $i; + } + krsort($values); + + if (!$stmt = mysqli_stmt_init($link)) { + printf("[302] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + break; + } + + if (!mysqli_stmt_prepare($stmt, 'SELECT trend, targetport, FORMAT(trend, 2) FROM test WHERE current_targets > 0 AND trend IS NOT NULL ORDER BY trend DESC LIMIT 100')) { + printf("[303] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); + break; + } + + if (!mysqli_stmt_execute($stmt)) { + printf("[304] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); + break; + } + + if (!mysqli_stmt_store_result($stmt)) { + printf("[305] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); + break; + } + + $trend = $targetport = $format = null; + if (!mysqli_stmt_bind_result($stmt, $trend, $targetport, $format)) { + + printf("[305] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); + break; + } + + foreach ($values as $exp_trend => $exp_targetport) { + if (!mysqli_stmt_fetch($stmt)) { + break; + } + if ($targetport != $exp_targetport) { + printf("[306] Values fetched from MySQL seem to be wrong, check manually\n"); + printf("%s/%s - %s/%s - '%s'\n", $trend, $exp_trend, $targetport, $exp_targetport, $format); + } + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + + // same but OO interface + if (!$stmt = mysqli_stmt_init($link)) { + printf("[307] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + break; + } + + if (!$stmt->prepare('SELECT trend, targetport, FORMAT(trend, 2) FROM test WHERE current_targets > 0 AND trend IS NOT NULL ORDER BY trend DESC LIMIT 100')) { + printf("[308] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); + break; + } + + if (!$stmt->execute()) { + printf("[309] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); + break; + } + + if (!$stmt->store_result()) { + printf("[310] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); + break; + } + + $trend = $targetport = $format = null; + if (!$stmt->bind_result($trend, $targetport, $format)) { + + printf("[311] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link)); + break; + } + + foreach ($values as $exp_trend => $exp_targetport) { + if (!$stmt->fetch()) { + break; + } + if ($targetport != $exp_targetport) { + printf("[312] Values fetched from MySQL seem to be wrong, check manually\n"); + printf("%s/%s - %s/%s - '%s'\n", $trend, $exp_trend, $targetport, $exp_targetport, $format); + } + } + $stmt->free_result(); + $stmt->close(); + + } while (false); + + } else { + var_dump(mysqli_error($link)); + } + + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt index fec6a3f8df..8040f35bca 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt @@ -8,238 +8,238 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('table.inc'); - - $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1")) - printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1")) - printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + require('table.inc'); + + $stmt = mysqli_stmt_init($link); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1")) + printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1")) + printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - print "plain vanilla...\n"; - unset($id); unset($label); - $id = $label = null; - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) - printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) - printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + print "plain vanilla...\n"; + unset($id); unset($label); + $id = $label = null; + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) + printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) + printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - var_dump($id); - var_dump($label); + var_dump($id); + var_dump($label); - print "reference, one level...\n"; - unset($id); unset($id_ref); unset($label); unset($label_ref); - $id = null; - $id_ref = &$id; - $label = null; - $label_ref = &$label; - - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref))) - printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) - printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - var_dump($id_ref); - var_dump($id); - var_dump($label_ref); - var_dump($label); - - - print "reference, two levels...\n"; - unset($id); unset($id_ref); unset($id_ref_ref); unset($label); unset($label_ref); unset($label_ref_ref); - $id = null; - $id_ref = &$id; - $id_ref_ref = &$id_ref; - $label = null; - $label_ref = &$label; - $label_ref_ref = &$label_ref; - - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref_ref, $label_ref_ref))) - printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) - printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - var_dump($id_ref_ref); - var_dump($id_ref); - var_dump($id); - var_dump($label_ref_ref); - var_dump($label_ref); - var_dump($label); - - print "reference, \$GLOBALS...\n"; - unset($id); unset($id_ref); unset($label); unset($label_ref); - $id = 100; - $id_ref = &$GLOBALS['id']; - $label = null; - $label_ref = &$GLOBALS['label']; - - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref))) - printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) - printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - var_dump($id_ref); - var_dump($id); - var_dump($label_ref); - var_dump($label); - - print "reference, same target...\n"; - $id = null; - $label = &$id; - - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) - printf("[010] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) - printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - var_dump($id); - var_dump($label); - - print "reference, simple object...\n"; - unset($obj); - $obj = new stdClass(); - $obj->id = null; - $obj->label = null; - - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $obj->id, $obj->label))) - printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) - printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - var_dump($obj->id); - var_dump($obj->label); - - - print "reference, simple object w reference...\n"; - unset($id); unset($label); unset($obj); - $obj = new stdClass(); - $obj->id = null; - $obj->label = null; - $id = &$obj->id; - $label = &$obj->label; - - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) - printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) - printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - var_dump($obj->id); - var_dump($obj->label); - - print "reference, simple object w reference, change after bind...\n"; - unset($id); unset($label); unset($obj); - $obj = new stdClass(); - $obj->id = null; - $obj->label = null; - $id = &$obj->id; - $label = &$obj->label; - - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) - printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - $label = &$obj->id; - $id = null; - - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) - printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - var_dump($obj->id); - var_dump($id); - var_dump($obj->label); - var_dump($label); - - print "reference, one level, change after bind...\n"; - unset($id); unset($label); unset($id_ref); unset($label_ref); - $id = null; - $id_ref = &$id; - $label = null; - $label_ref = &$label; - - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref))) - printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - - $id_ref = 1; - $label_ref = 1; - - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) - printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - var_dump($id_ref); - var_dump($id); - var_dump($label_ref); - var_dump($label); - - print "reference, circle...\n"; - unset($id); unset($label_a); unset($label_b); - $id = null; - $label_a = &$label_b; - $label_b = &$label_a; - - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label_a))) - printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) - printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - var_dump($id); - var_dump($label_a); - var_dump($label_b); - - print "reference, object, forward declaration...\n"; - unset($bar); unset($id); unset($label_ref); - class foo { - public $foo; - public function __construct() { - $this->foo = &$this->bar; - } - } - class bar extends foo { - public $bar = null; - } - $bar = new bar(); - $id = null; - $label_ref = &$bar->bar; - - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label_ref))) - printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) - printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - var_dump($id); - var_dump($bar); - var_dump($label_ref); - - print "references, object, private...\n"; - unset($bar); unset($id); unset($label); - class mega_bar extends bar { - private $id; - public $id_ref; - public function __construct() { - parent::__construct(); - $this->id_ref = &$this->id; - } - } - $bar = new mega_bar(); - $id = &$bar->id_ref; - $label = &$bar->foo; - - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) - printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) - printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - var_dump($id); - var_dump($label); - var_dump($bar); - - mysqli_stmt_close($stmt); - mysqli_close($link); - - print "done!"; + print "reference, one level...\n"; + unset($id); unset($id_ref); unset($label); unset($label_ref); + $id = null; + $id_ref = &$id; + $label = null; + $label_ref = &$label; + + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref))) + printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) + printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + var_dump($id_ref); + var_dump($id); + var_dump($label_ref); + var_dump($label); + + + print "reference, two levels...\n"; + unset($id); unset($id_ref); unset($id_ref_ref); unset($label); unset($label_ref); unset($label_ref_ref); + $id = null; + $id_ref = &$id; + $id_ref_ref = &$id_ref; + $label = null; + $label_ref = &$label; + $label_ref_ref = &$label_ref; + + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref_ref, $label_ref_ref))) + printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) + printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + var_dump($id_ref_ref); + var_dump($id_ref); + var_dump($id); + var_dump($label_ref_ref); + var_dump($label_ref); + var_dump($label); + + print "reference, \$GLOBALS...\n"; + unset($id); unset($id_ref); unset($label); unset($label_ref); + $id = 100; + $id_ref = &$GLOBALS['id']; + $label = null; + $label_ref = &$GLOBALS['label']; + + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref))) + printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) + printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + var_dump($id_ref); + var_dump($id); + var_dump($label_ref); + var_dump($label); + + print "reference, same target...\n"; + $id = null; + $label = &$id; + + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) + printf("[010] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) + printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + var_dump($id); + var_dump($label); + + print "reference, simple object...\n"; + unset($obj); + $obj = new stdClass(); + $obj->id = null; + $obj->label = null; + + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $obj->id, $obj->label))) + printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) + printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + var_dump($obj->id); + var_dump($obj->label); + + + print "reference, simple object w reference...\n"; + unset($id); unset($label); unset($obj); + $obj = new stdClass(); + $obj->id = null; + $obj->label = null; + $id = &$obj->id; + $label = &$obj->label; + + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) + printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) + printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + var_dump($obj->id); + var_dump($obj->label); + + print "reference, simple object w reference, change after bind...\n"; + unset($id); unset($label); unset($obj); + $obj = new stdClass(); + $obj->id = null; + $obj->label = null; + $id = &$obj->id; + $label = &$obj->label; + + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) + printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + $label = &$obj->id; + $id = null; + + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) + printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + var_dump($obj->id); + var_dump($id); + var_dump($obj->label); + var_dump($label); + + print "reference, one level, change after bind...\n"; + unset($id); unset($label); unset($id_ref); unset($label_ref); + $id = null; + $id_ref = &$id; + $label = null; + $label_ref = &$label; + + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref))) + printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + + $id_ref = 1; + $label_ref = 1; + + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) + printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + var_dump($id_ref); + var_dump($id); + var_dump($label_ref); + var_dump($label); + + print "reference, circle...\n"; + unset($id); unset($label_a); unset($label_b); + $id = null; + $label_a = &$label_b; + $label_b = &$label_a; + + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label_a))) + printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) + printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + var_dump($id); + var_dump($label_a); + var_dump($label_b); + + print "reference, object, forward declaration...\n"; + unset($bar); unset($id); unset($label_ref); + class foo { + public $foo; + public function __construct() { + $this->foo = &$this->bar; + } + } + class bar extends foo { + public $bar = null; + } + $bar = new bar(); + $id = null; + $label_ref = &$bar->bar; + + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label_ref))) + printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) + printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + var_dump($id); + var_dump($bar); + var_dump($label_ref); + + print "references, object, private...\n"; + unset($bar); unset($id); unset($label); + class mega_bar extends bar { + private $id; + public $id_ref; + public function __construct() { + parent::__construct(); + $this->id_ref = &$this->id; + } + } + $bar = new mega_bar(); + $id = &$bar->id_ref; + $label = &$bar->foo; + + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) + printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt)) + printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + var_dump($id); + var_dump($label); + var_dump($bar); + + mysqli_stmt_close($stmt); + mysqli_close($link); + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt index 11755b4aef..f1a68e3c0e 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt @@ -8,86 +8,86 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - function zerofill($offset, $link, $datatype, $insert = 1) { + function zerofill($offset, $link, $datatype, $insert = 1) { - mysqli_query($link, 'ALTER TABLE test DROP zero'); - $sql = sprintf('ALTER TABLE test ADD zero %s UNSIGNED ZEROFILL', $datatype); - if (!mysqli_query($link, $sql)) { - // no worries - server might not support it - return true; - } + mysqli_query($link, 'ALTER TABLE test DROP zero'); + $sql = sprintf('ALTER TABLE test ADD zero %s UNSIGNED ZEROFILL', $datatype); + if (!mysqli_query($link, $sql)) { + // no worries - server might not support it + return true; + } - if (!mysqli_query($link, sprintf('UPDATE test SET zero = %s', $insert))) { - printf("[%03d] UPDATE failed, [%d] %s\n", - $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } + if (!mysqli_query($link, sprintf('UPDATE test SET zero = %s', $insert))) { + printf("[%03d] UPDATE failed, [%d] %s\n", + $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } - if (!($stmt = mysqli_prepare($link, 'SELECT zero FROM test LIMIT 1'))) { - printf("[%03d] SELECT failed, [%d] %s\n", - $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } + if (!($stmt = mysqli_prepare($link, 'SELECT zero FROM test LIMIT 1'))) { + printf("[%03d] SELECT failed, [%d] %s\n", + $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } - $result = null; - if (!mysqli_stmt_bind_result($stmt, $result)) { - printf("[%03d] Bind failed, [%d] %s\n", - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } + $result = null; + if (!mysqli_stmt_bind_result($stmt, $result)) { + printf("[%03d] Bind failed, [%d] %s\n", + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt)) { - printf("[%03d] Execute or fetch failed, [%d] %s\n", - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt)) { + printf("[%03d] Execute or fetch failed, [%d] %s\n", + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } - $res = mysqli_stmt_result_metadata($stmt); - $meta = mysqli_fetch_fields($res); - mysqli_stmt_free_result($stmt); + $res = mysqli_stmt_result_metadata($stmt); + $meta = mysqli_fetch_fields($res); + mysqli_stmt_free_result($stmt); - $meta = $meta[0]; - $length = $meta->length; - if ($length > strlen($insert)) { + $meta = $meta[0]; + $length = $meta->length; + if ($length > strlen($insert)) { - $expected = str_repeat('0', $length - strlen($insert)); - $expected .= $insert; - if ($expected !== $result) { - printf("[%03d] Expecting '%s' got '%s'\n", $offset, $expected, $result); - return false; - } + $expected = str_repeat('0', $length - strlen($insert)); + $expected .= $insert; + if ($expected !== $result) { + printf("[%03d] Expecting '%s' got '%s'\n", $offset, $expected, $result); + return false; + } - } else if ($length <= 1) { - printf("[%03d] Length reported is too small to run test\n", $offset); - return false; - } + } else if ($length <= 1) { + printf("[%03d] Length reported is too small to run test\n", $offset); + return false; + } - return true; - } + return true; + } - /* - We map those to PHP numeric types - - no padding/filling done. Neither with libmysql nor with mysqlnd. - zerofill(2, $link, 'TINYINT'); - zerofill(3, $link, 'SMALLINT'); - zerofill(4, $link, 'MEDIUMINT'); - zerofill(5, $link, 'INT'); - zerofill(6, $link, 'INTEGER'); - zerofill(7, $link, 'BIGINT'); - zerofill(8, $link, 'FLOAT'); - zerofill(9, $link, 'DOUBLE'); - zerofill(10, $link, 'DOUBLE PRECISION'); - */ - zerofill(11, $link, 'DECIMAL'); - zerofill(12, $link, 'DEC'); + /* + We map those to PHP numeric types - + no padding/filling done. Neither with libmysql nor with mysqlnd. + zerofill(2, $link, 'TINYINT'); + zerofill(3, $link, 'SMALLINT'); + zerofill(4, $link, 'MEDIUMINT'); + zerofill(5, $link, 'INT'); + zerofill(6, $link, 'INTEGER'); + zerofill(7, $link, 'BIGINT'); + zerofill(8, $link, 'FLOAT'); + zerofill(9, $link, 'DOUBLE'); + zerofill(10, $link, 'DOUBLE PRECISION'); + */ + zerofill(11, $link, 'DECIMAL'); + zerofill(12, $link, 'DEC'); - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_close.phpt b/ext/mysqli/tests/mysqli_stmt_close.phpt index 978e4388bb..fd91eaecd1 100644 --- a/ext/mysqli/tests/mysqli_stmt_close.phpt +++ b/ext/mysqli/tests/mysqli_stmt_close.phpt @@ -8,25 +8,25 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // Yes, amazing, eh? AFAIK a work around of a constructor bug... + // Yes, amazing, eh? AFAIK a work around of a constructor bug... try { mysqli_stmt_close($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) - printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) + printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = mysqli_stmt_close($stmt))) - printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_stmt_close($stmt))) + printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); try { mysqli_stmt_close($stmt); @@ -34,47 +34,47 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - if (!$stmt = mysqli_stmt_init($link)) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) - printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) + printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = $label = null; - if (!mysqli_stmt_bind_param($stmt, "is", $id, $label)) - printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = $label = null; + if (!mysqli_stmt_bind_param($stmt, "is", $id, $label)) + printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = 100; $label = 'z'; - if (!mysqli_stmt_execute($stmt)) - printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = 100; $label = 'z'; + if (!mysqli_stmt_execute($stmt)) + printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_kill($link, mysqli_thread_id($link)); + mysqli_kill($link, mysqli_thread_id($link)); - if (true !== ($tmp = mysqli_stmt_close($stmt))) - printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_stmt_close($stmt))) + printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); - require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + require('table.inc'); + if (!$stmt = mysqli_stmt_init($link)) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) - printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) + printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label)) - printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label)) + printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt)) - printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt)) + printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_kill($link, mysqli_thread_id($link)); + mysqli_kill($link, mysqli_thread_id($link)); - if (true !== ($tmp = mysqli_stmt_close($stmt))) - printf("[017] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_stmt_close($stmt))) + printf("[017] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt index 6658f6e855..72d807512f 100644 --- a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt +++ b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt @@ -8,12 +8,12 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); try { mysqli_stmt_data_seek($stmt, 1); @@ -21,53 +21,53 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id")) - printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id")) + printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_stmt_execute($stmt))) + printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - $id = null; - if (!mysqli_stmt_bind_result($stmt, $id)) - printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = null; + if (!mysqli_stmt_bind_result($stmt, $id)) + printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_store_result($stmt)) - printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_store_result($stmt)) + printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 2))) - printf("[009] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 2))) + printf("[009] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_fetch($stmt)) - printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_fetch($stmt)) + printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - var_dump($id); + var_dump($id); - if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 0))) - printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 0))) + printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_fetch($stmt)) - printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_fetch($stmt)) + printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - var_dump($id); + var_dump($id); - if (!is_null($tmp = mysqli_stmt_data_seek($stmt, mysqli_stmt_num_rows($stmt) + 100))) - printf("[013] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + if (!is_null($tmp = mysqli_stmt_data_seek($stmt, mysqli_stmt_num_rows($stmt) + 100))) + printf("[013] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (mysqli_stmt_fetch($stmt)) - printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (mysqli_stmt_fetch($stmt)) + printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - var_dump($id); + var_dump($id); - if (false !== ($tmp = mysqli_stmt_data_seek($stmt, -1))) - printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_stmt_data_seek($stmt, -1))) + printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (mysqli_stmt_fetch($stmt)) - printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (mysqli_stmt_fetch($stmt)) + printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - var_dump($id); + var_dump($id); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); try { mysqli_stmt_data_seek($stmt, 0); @@ -75,8 +75,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt b/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt index 3a1c004c2e..4bffb7cab7 100644 --- a/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt +++ b/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt @@ -8,51 +8,51 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - if (!$c1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - exit(1); - } - if (!$c2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - exit(1); - } + require_once("connect.inc"); + if (!$c1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + exit(1); + } + if (!$c2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + exit(1); + } - $c1->query("use $db"); - $c2->query("use $db"); - $c1->query("drop table if exists type_change"); - $c1->query("create table type_change(a int, b char(10)) ENGINE = " . $engine); - $c1->query("insert into type_change values (1, 'one'), (2, 'two')"); - $s1 = $c1->prepare("select a from type_change order by a"); - var_dump($s1->execute(), $s1->bind_result($col1)); - echo "---- Row 1\n"; - var_dump($s1->fetch()); - var_dump($col1); - echo "---- Row 2\n"; - var_dump($s1->fetch()); - var_dump($col1); - echo "---- Row 3\n"; - var_dump($s1->fetch()); - echo "----\n"; + $c1->query("use $db"); + $c2->query("use $db"); + $c1->query("drop table if exists type_change"); + $c1->query("create table type_change(a int, b char(10)) ENGINE = " . $engine); + $c1->query("insert into type_change values (1, 'one'), (2, 'two')"); + $s1 = $c1->prepare("select a from type_change order by a"); + var_dump($s1->execute(), $s1->bind_result($col1)); + echo "---- Row 1\n"; + var_dump($s1->fetch()); + var_dump($col1); + echo "---- Row 2\n"; + var_dump($s1->fetch()); + var_dump($col1); + echo "---- Row 3\n"; + var_dump($s1->fetch()); + echo "----\n"; - echo "ALTER\n"; - var_dump($c2->query("alter table type_change drop a")); - var_dump($s1->execute()); - var_dump($c1->error); + echo "ALTER\n"; + var_dump($c2->query("alter table type_change drop a")); + var_dump($s1->execute()); + var_dump($c1->error); - echo "---- Row 1\n"; - var_dump($s1->fetch()); - var_dump($col1); - echo "---- Row 2\n"; - var_dump($s1->fetch()); - var_dump($col1); - echo "---- Row 3\n"; - var_dump($s1->fetch()); - echo "----\n"; + echo "---- Row 1\n"; + var_dump($s1->fetch()); + var_dump($col1); + echo "---- Row 2\n"; + var_dump($s1->fetch()); + var_dump($col1); + echo "---- Row 3\n"; + var_dump($s1->fetch()); + echo "----\n"; - echo "done!"; + echo "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_errno.phpt b/ext/mysqli/tests/mysqli_stmt_errno.phpt index 79b3ae171d..9928d0c1f3 100644 --- a/ext/mysqli/tests/mysqli_stmt_errno.phpt +++ b/ext/mysqli/tests/mysqli_stmt_errno.phpt @@ -8,41 +8,41 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // properly initialized? - if (0 !== ($tmp = mysqli_stmt_errno($stmt))) - printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + // properly initialized? + if (0 !== ($tmp = mysqli_stmt_errno($stmt))) + printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id")) - printf("[005] Statement should have failed!\n"); + if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id")) + printf("[005] Statement should have failed!\n"); - // set after error server? - if (0 === ($tmp = mysqli_stmt_errno($stmt))) - printf("[006] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp); + // set after error server? + if (0 === ($tmp = mysqli_stmt_errno($stmt))) + printf("[006] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id")) - printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id")) + printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - // reset after error & success - if (0 != ($tmp = mysqli_stmt_errno($stmt))) - printf("[008] Expecting zero, got %s/%s\n", gettype($tmp), $tmp); + // reset after error & success + if (0 != ($tmp = mysqli_stmt_errno($stmt))) + printf("[008] Expecting zero, got %s/%s\n", gettype($tmp), $tmp); - mysqli_kill($link, mysqli_thread_id($link)); + mysqli_kill($link, mysqli_thread_id($link)); - if (true === ($tmp = mysqli_stmt_execute($stmt))) - printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (true === ($tmp = mysqli_stmt_execute($stmt))) + printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - // set after client error - if (0 === ($tmp = mysqli_stmt_errno($stmt))) - printf("[010] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp); + // set after client error + if (0 === ($tmp = mysqli_stmt_errno($stmt))) + printf("[010] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); try { mysqli_stmt_errno($stmt); @@ -50,8 +50,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_error.phpt b/ext/mysqli/tests/mysqli_stmt_error.phpt index a0c1497247..98e6102655 100644 --- a/ext/mysqli/tests/mysqli_stmt_error.phpt +++ b/ext/mysqli/tests/mysqli_stmt_error.phpt @@ -8,41 +8,41 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // properly initialized? - if ('' !== ($tmp = mysqli_stmt_error($stmt))) - printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + // properly initialized? + if ('' !== ($tmp = mysqli_stmt_error($stmt))) + printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id")) - printf("[005] Statement should have failed!\n"); + if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id")) + printf("[005] Statement should have failed!\n"); - // set after error server? - if ('' === ($tmp = mysqli_stmt_error($stmt))) - printf("[006] Expecting string/any non empty, got %s/%s\n", gettype($tmp), $tmp); + // set after error server? + if ('' === ($tmp = mysqli_stmt_error($stmt))) + printf("[006] Expecting string/any non empty, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id")) - printf("[007] [%d] %s\n", mysqli_stmt_error($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id")) + printf("[007] [%d] %s\n", mysqli_stmt_error($stmt), mysqli_stmt_error($stmt)); - // reset after error & success - if ('' !== ($tmp = mysqli_stmt_error($stmt))) - printf("[008] Expecting empty string, got %s/%s\n", gettype($tmp), $tmp); + // reset after error & success + if ('' !== ($tmp = mysqli_stmt_error($stmt))) + printf("[008] Expecting empty string, got %s/%s\n", gettype($tmp), $tmp); - mysqli_kill($link, mysqli_thread_id($link)); + mysqli_kill($link, mysqli_thread_id($link)); - if (true === ($tmp = mysqli_stmt_execute($stmt))) - printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (true === ($tmp = mysqli_stmt_execute($stmt))) + printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - // set after client error - if ('' === ($tmp = mysqli_stmt_error($stmt))) - printf("[010] Expecting string/any non empty, got %s/%s\n", gettype($tmp), $tmp); + // set after client error + if ('' === ($tmp = mysqli_stmt_error($stmt))) + printf("[010] Expecting string/any non empty, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); try { mysqli_stmt_error($stmt); @@ -50,8 +50,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_execute.phpt b/ext/mysqli/tests/mysqli_stmt_execute.phpt index 7a3be215c5..d3f404aa3d 100644 --- a/ext/mysqli/tests/mysqli_stmt_execute.phpt +++ b/ext/mysqli/tests/mysqli_stmt_execute.phpt @@ -14,114 +14,114 @@ if (mysqli_get_server_version($link) <= 40100) { ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // stmt object status test + // stmt object status test try { mysqli_stmt_execute($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id")) - printf("[005] Statement should have failed!\n"); + if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id")) + printf("[005] Statement should have failed!\n"); - // stmt object status test + // stmt object status test try { mysqli_stmt_execute($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1")) - printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1")) + printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[008] Expecting boolean/true, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (true !== ($tmp = mysqli_stmt_execute($stmt))) + printf("[008] Expecting boolean/true, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) - printf("[009] [%d] %s\n", mysqli_stmt_execute($stmt), mysqli_stmt_execute($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) + printf("[009] [%d] %s\n", mysqli_stmt_execute($stmt), mysqli_stmt_execute($stmt)); - // no input variables bound - if (false !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + // no input variables bound + if (false !== ($tmp = mysqli_stmt_execute($stmt))) + printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - $id = 100; - $label = "z"; - if (!mysqli_stmt_bind_param($stmt, "is", $id, $label)) - printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = 100; + $label = "z"; + if (!mysqli_stmt_bind_param($stmt, "is", $id, $label)) + printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (true !== ($tmp = mysqli_stmt_execute($stmt))) + printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - // calling reset between executions - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + // calling reset between executions + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT ?")) - printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT ?")) + printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $limit = 1; - if (!mysqli_stmt_bind_param($stmt, "i", $limit)) - printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $limit = 1; + if (!mysqli_stmt_bind_param($stmt, "i", $limit)) + printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[016] Expecting boolean/true, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (true !== ($tmp = mysqli_stmt_execute($stmt))) + printf("[016] Expecting boolean/true, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = null; - if (!mysqli_stmt_bind_result($stmt, $id) || !mysqli_stmt_fetch($stmt)) - printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = null; + if (!mysqli_stmt_bind_result($stmt, $id) || !mysqli_stmt_fetch($stmt)) + printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if ($id !== 1) - printf("[018] Expecting int/1 got %s/%s\n", gettype($id), $id); + if ($id !== 1) + printf("[018] Expecting int/1 got %s/%s\n", gettype($id), $id); - if (true !== ($tmp = mysqli_stmt_reset($stmt))) - printf("[019] Expecting boolean/true, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (true !== ($tmp = mysqli_stmt_reset($stmt))) + printf("[019] Expecting boolean/true, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[020] Expecting boolean/true after reset to prepare status, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (true !== ($tmp = mysqli_stmt_execute($stmt))) + printf("[020] Expecting boolean/true after reset to prepare status, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = null; - if (!mysqli_stmt_fetch($stmt)) - printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = null; + if (!mysqli_stmt_fetch($stmt)) + printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if ($id !== 1) - printf("[022] Expecting int/1 got %s/%s\n", gettype($id), $id); + if ($id !== 1) + printf("[022] Expecting int/1 got %s/%s\n", gettype($id), $id); - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1")) - printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1")) + printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[025] Expecting boolean/true, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (true !== ($tmp = mysqli_stmt_execute($stmt))) + printf("[025] Expecting boolean/true, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = mysqli_stmt_reset($stmt))) - printf("[026] Expecting boolean/true, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (true !== ($tmp = mysqli_stmt_reset($stmt))) + printf("[026] Expecting boolean/true, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - var_dump(mysqli_stmt_execute($stmt)); - var_dump(mysqli_stmt_fetch($stmt)); + var_dump(mysqli_stmt_execute($stmt)); + var_dump(mysqli_stmt_fetch($stmt)); - mysqli_kill($link, mysqli_thread_id($link)); + mysqli_kill($link, mysqli_thread_id($link)); - if (false !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[027] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_stmt_execute($stmt))) + printf("[027] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); try { mysqli_stmt_execute($stmt); @@ -129,8 +129,8 @@ if (mysqli_get_server_version($link) <= 40100) { echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt index 6537b8d88b..33e6cd1c8b 100644 --- a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt +++ b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt @@ -14,172 +14,172 @@ if (mysqli_get_server_version($link) <= 50000) { ?> --FILE-- <?php - require_once('connect.inc'); - require_once('table.inc'); + require_once('connect.inc'); + require_once('table.inc'); - if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) - printf("[009] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) + printf("[009] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) { - /* no result set, one output parameter */ - if (!$stmt = mysqli_prepare($link, 'CALL p(@version)')) - printf("[011] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) { + /* no result set, one output parameter */ + if (!$stmt = mysqli_prepare($link, 'CALL p(@version)')) + printf("[011] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_execute($stmt)) - printf("[012] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[012] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - /* yes, I really want to call it twice! */ - if (!mysqli_stmt_execute($stmt)) - printf("[013] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + /* yes, I really want to call it twice! */ + if (!mysqli_stmt_execute($stmt)) + printf("[013] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_close($stmt)) - printf("[014] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_close($stmt)) + printf("[014] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version')) - printf("[015] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version')) + printf("[015] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_execute($stmt)) - printf("[016] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[016] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $version = 'unknown'; - if (!mysqli_stmt_bind_result($stmt, $version) || - !mysqli_stmt_fetch($stmt)) - printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $version = 'unknown'; + if (!mysqli_stmt_bind_result($stmt, $version) || + !mysqli_stmt_fetch($stmt)) + printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (($version == "unknown") || ($version == "")) - printf("[018] Results seem wrong, got %s, [%d] %s\n", - $version, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (($version == "unknown") || ($version == "")) + printf("[018] Results seem wrong, got %s, [%d] %s\n", + $version, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_free_result($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); - } else { - printf("[010] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - } + } else { + printf("[010] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + } - if (function_exists('mysqli_stmt_get_result')) { + if (function_exists('mysqli_stmt_get_result')) { - if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) - printf("[019] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) + printf("[019] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) { - // no result set, one output parameter - if (!$stmt = mysqli_prepare($link, 'CALL p(@version)')) - printf("[020] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) { + // no result set, one output parameter + if (!$stmt = mysqli_prepare($link, 'CALL p(@version)')) + printf("[020] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_execute($stmt)) - printf("[021] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[021] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_close($stmt)) - printf("[022] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_close($stmt)) + printf("[022] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version')) - printf("[023] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version')) + printf("[023] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_execute($stmt)) - printf("[024] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[024] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$res = mysqli_stmt_get_result($stmt)) - printf("[025] Cannot get result set, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!$res = mysqli_stmt_get_result($stmt)) + printf("[025] Cannot get result set, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if ((!($row = mysqli_fetch_assoc($res))) || ($row['_version'] == "")) - printf("[026] Results seem wrong, got %s, [%d] %s\n", - $row['_version'], - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if ((!($row = mysqli_fetch_assoc($res))) || ($row['_version'] == "")) + printf("[026] Results seem wrong, got %s, [%d] %s\n", + $row['_version'], + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_free_result($res); - mysqli_stmt_close($stmt); + mysqli_free_result($res); + mysqli_stmt_close($stmt); - } else { - printf("[027] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - } + } else { + printf("[027] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + } - } + } - if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) - printf("[028] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) + printf("[028] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) { - // no result set, one input parameter, output parameter - // yes, I really do not want to bind input values... - if (!$stmt = mysqli_prepare($link, "CALL p('myversion', @version)")) - printf("[029] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) { + // no result set, one input parameter, output parameter + // yes, I really do not want to bind input values... + if (!$stmt = mysqli_prepare($link, "CALL p('myversion', @version)")) + printf("[029] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_execute($stmt)) - printf("[030] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[030] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_close($stmt)) - printf("[031] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_close($stmt)) + printf("[031] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version')) - printf("[032] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version')) + printf("[032] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_execute($stmt)) - printf("[033] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[033] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $version = 'unknown'; - if (!mysqli_stmt_bind_result($stmt, $version) || - !mysqli_stmt_fetch($stmt)) - printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $version = 'unknown'; + if (!mysqli_stmt_bind_result($stmt, $version) || + !mysqli_stmt_fetch($stmt)) + printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if ($version != "myversion") - printf("[035] Results seem wrong, got %s, [%d] %s\n", - $version, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if ($version != "myversion") + printf("[035] Results seem wrong, got %s, [%d] %s\n", + $version, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_free_result($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); - } else { - printf("[036] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - } + } else { + printf("[036] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + } - if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) - printf("[037] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) + printf("[037] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) { - // no result set, one input parameter, output parameter - // yes, I really do not want to bind input values... - if (!$stmt = mysqli_prepare($link, 'CALL p(?, @version)')) - printf("[038] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) { + // no result set, one input parameter, output parameter + // yes, I really do not want to bind input values... + if (!$stmt = mysqli_prepare($link, 'CALL p(?, @version)')) + printf("[038] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $version = 'myversion'; - if (!mysqli_stmt_bind_param($stmt, 's', $version)) - printf("[039] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $version = 'myversion'; + if (!mysqli_stmt_bind_param($stmt, 's', $version)) + printf("[039] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_execute($stmt)) - printf("[040] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[040] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_close($stmt)) - printf("[041] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_close($stmt)) + printf("[041] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version')) - printf("[042] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version')) + printf("[042] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_execute($stmt)) - printf("[043] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[043] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $version = 'unknown'; - if (!mysqli_stmt_bind_result($stmt, $version) || - !mysqli_stmt_fetch($stmt)) - printf("[044] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $version = 'unknown'; + if (!mysqli_stmt_bind_result($stmt, $version) || + !mysqli_stmt_fetch($stmt)) + printf("[044] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if ($version !== "myversion") - printf("[045] Results seem wrong, got %s, [%d] %s\n", - $version, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if ($version !== "myversion") + printf("[045] Results seem wrong, got %s, [%d] %s\n", + $version, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_free_result($stmt); - mysqli_stmt_close($stmt); + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); - } else { - printf("[046] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - } + } else { + printf("[046] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt index aed04962f2..f322a1a76c 100644 --- a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt @@ -14,104 +14,104 @@ if (mysqli_get_server_version($link) < 50503) { ?> --FILE-- <?php - require_once('connect.inc'); + require_once('connect.inc'); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) - printf("[003] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) + printf("[003] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25)) BEGIN SELECT ver_in AS _ver_out; END;')) { - // one result set - if (!$stmt = mysqli_prepare($link, 'CALL p(?)')) - printf("[005] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25)) BEGIN SELECT ver_in AS _ver_out; END;')) { + // one result set + if (!$stmt = mysqli_prepare($link, 'CALL p(?)')) + printf("[005] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $version = 'myversion'; - if (!mysqli_stmt_bind_param($stmt, 's', $version)) - printf("[006] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $version = 'myversion'; + if (!mysqli_stmt_bind_param($stmt, 's', $version)) + printf("[006] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_execute($stmt)) - printf("[007] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[007] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $version = 'unknown'; - if (!mysqli_stmt_bind_result($stmt, $version) || - !mysqli_stmt_fetch($stmt)) - printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $version = 'unknown'; + if (!mysqli_stmt_bind_result($stmt, $version) || + !mysqli_stmt_fetch($stmt)) + printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if ($version !== "myversion") - printf("[009] Results seem wrong, got %s, [%d] %s\n", - $version, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if ($version !== "myversion") + printf("[009] Results seem wrong, got %s, [%d] %s\n", + $version, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_free_result($stmt); + mysqli_stmt_free_result($stmt); - printf("[010] More results: %s\n", (mysqli_more_results($link)) ? "yes" : "no"); - printf("[011] Next result: %s\n", (mysqli_next_result($link)) ? "yes" : "no"); + printf("[010] More results: %s\n", (mysqli_more_results($link)) ? "yes" : "no"); + printf("[011] Next result: %s\n", (mysqli_next_result($link)) ? "yes" : "no"); - if (!mysqli_stmt_close($stmt)) - printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_close($stmt)) + printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$link->query("SELECT 1")) - printf("[013] [%d] %s\n", $link->errno, $link->error); + if (!$link->query("SELECT 1")) + printf("[013] [%d] %s\n", $link->errno, $link->error); - } else { - printf("[004] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - } + } else { + printf("[004] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + } - if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) - printf("[014] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) + printf("[014] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25)) BEGIN SELECT ver_in AS _ver_out; SELECT 1 AS _more; END;')) { - // two result sets - if (!$stmt = mysqli_prepare($link, 'CALL p(?)')) - printf("[015] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25)) BEGIN SELECT ver_in AS _ver_out; SELECT 1 AS _more; END;')) { + // two result sets + if (!$stmt = mysqli_prepare($link, 'CALL p(?)')) + printf("[015] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $version = 'myversion'; - if (!mysqli_stmt_bind_param($stmt, 's', $version)) - printf("[016] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $version = 'myversion'; + if (!mysqli_stmt_bind_param($stmt, 's', $version)) + printf("[016] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_execute($stmt)) - printf("[017] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[017] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $version = NULL; - if (!mysqli_stmt_bind_result($stmt, $version) || - !mysqli_stmt_fetch($stmt)) - printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $version = NULL; + if (!mysqli_stmt_bind_result($stmt, $version) || + !mysqli_stmt_fetch($stmt)) + printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if ($version !== "myversion") - printf("[019] Results seem wrong, got %s, [%d] %s\n", - $version, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if ($version !== "myversion") + printf("[019] Results seem wrong, got %s, [%d] %s\n", + $version, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_more_results($link) || !mysqli_next_result($link)) - printf("[020] [%d] %s\n", $link->errno, $link->error); + if (!mysqli_more_results($link) || !mysqli_next_result($link)) + printf("[020] [%d] %s\n", $link->errno, $link->error); - $more = NULL; - if (!mysqli_stmt_bind_result($stmt, $more) || - !mysqli_stmt_fetch($stmt)) - printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $more = NULL; + if (!mysqli_stmt_bind_result($stmt, $more) || + !mysqli_stmt_fetch($stmt)) + printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if ($more !== 1) - printf("[022] Results seem wrong, got %s, [%d] %s\n", - $more, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if ($more !== 1) + printf("[022] Results seem wrong, got %s, [%d] %s\n", + $more, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_close($stmt)) - printf("[023] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_close($stmt)) + printf("[023] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$link->query("SELECT 1")) - printf("[024] [%d] %s\n", $link->errno, $link->error); + if (!$link->query("SELECT 1")) + printf("[024] [%d] %s\n", $link->errno, $link->error); - } else { - printf("[025] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - } + } else { + printf("[025] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt index 6ab270b8f4..c65330ebc9 100644 --- a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt +++ b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt @@ -19,49 +19,49 @@ if ($IS_MYSQLND) { ?> --FILE-- <?php - require_once('connect.inc'); + require_once('connect.inc'); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } - if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) - printf("[003] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) + printf("[003] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) { - if (!$stmt = mysqli_prepare($link, 'CALL p(?, ?)')) - printf("[005] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) { + if (!$stmt = mysqli_prepare($link, 'CALL p(?, ?)')) + printf("[005] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $ver_in = 'myversion'; - $ver_out = ''; - if (!mysqli_stmt_bind_param($stmt, 'ss', $ver_in, $ver_out)) - printf("[006] Cannot bind parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $ver_in = 'myversion'; + $ver_out = ''; + if (!mysqli_stmt_bind_param($stmt, 'ss', $ver_in, $ver_out)) + printf("[006] Cannot bind parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_execute($stmt)) - printf("[007] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[007] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - printf("[008] More results: %s\n", (mysqli_more_results($link) ? "yes" : "no")); - printf("[009] Next results: %s\n", (mysqli_next_result($link) ? "yes" : "no")); + printf("[008] More results: %s\n", (mysqli_more_results($link) ? "yes" : "no")); + printf("[009] Next results: %s\n", (mysqli_next_result($link) ? "yes" : "no")); - if (!mysqli_stmt_bind_result($stmt, $ver_out) || !mysqli_stmt_fetch($stmt)) - printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_bind_result($stmt, $ver_out) || !mysqli_stmt_fetch($stmt)) + printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if ("myversion" !== $ver_out) - printf("[011] Results seem wrong got '%s'\n", $ver_out); + if ("myversion" !== $ver_out) + printf("[011] Results seem wrong got '%s'\n", $ver_out); - if (!mysqli_stmt_close($stmt)) - printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_close($stmt)) + printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$res = $link->query("SELECT 1")) - printf("[013] [%d] %s\n", $link->errno, $link->error); + if (!$res = $link->query("SELECT 1")) + printf("[013] [%d] %s\n", $link->errno, $link->error); - } else { - printf("[004] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); - } + } else { + printf("[004] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_fetch.phpt b/ext/mysqli/tests/mysqli_stmt_fetch.phpt index 6f8a3ad725..4dce9dfefa 100644 --- a/ext/mysqli/tests/mysqli_stmt_fetch.phpt +++ b/ext/mysqli/tests/mysqli_stmt_fetch.phpt @@ -8,64 +8,64 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - /* - NOTE: no datatype tests here! This is done by - mysqli_stmt_bind_result.phpt already. Restrict - this test case to the basics. - */ - require_once("connect.inc"); + /* + NOTE: no datatype tests here! This is done by + mysqli_stmt_bind_result.phpt already. Restrict + this test case to the basics. + */ + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // stmt object status test + // stmt object status test try { mysqli_stmt_fetch($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) - printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) + printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - // FIXME - different versions return different values ?! - if ((NULL !== ($tmp = mysqli_stmt_fetch($stmt))) && (false !== $tmp)) - printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), $tmp); + // FIXME - different versions return different values ?! + if ((NULL !== ($tmp = mysqli_stmt_fetch($stmt))) && (false !== $tmp)) + printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_execute($stmt)) - printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = mysqli_stmt_fetch($stmt))) - printf("[008] NULL, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_stmt_fetch($stmt))) + printf("[008] NULL, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) - printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) + printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_execute($stmt)) - printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = NULL; - $label = NULL; - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) - printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + $id = NULL; + $label = NULL; + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) + printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (true !== ($tmp = mysqli_stmt_fetch($stmt))) - printf("[013] Expecting boolean/true, got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (true !== ($tmp = mysqli_stmt_fetch($stmt))) + printf("[013] Expecting boolean/true, got %s/%s, [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_kill($link, mysqli_thread_id($link))) - printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_kill($link, mysqli_thread_id($link))) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (true !== ($tmp = mysqli_stmt_fetch($stmt))) - printf("[015] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_stmt_fetch($stmt))) + printf("[015] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); try { mysqli_stmt_fetch($stmt); @@ -73,9 +73,9 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt b/ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt index 495fcdce7d..b3c74e4af2 100644 --- a/ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt +++ b/ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt @@ -16,57 +16,57 @@ Fetching BIT column values using the PS API ?> --FILE-- <?php - require('connect.inc'); + require('connect.inc'); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - /* NOTE: works only for up to 31 bits! This limitation should be documented. */ - for ($bits = 1; $bits < 32; $bits++) { - $max_value = pow(2, $bits) - 1; - $tests = 0; - if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || - !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id INT, label BIT(%d)) ENGINE="%s"', $bits, $engine))) - printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link)); + /* NOTE: works only for up to 31 bits! This limitation should be documented. */ + for ($bits = 1; $bits < 32; $bits++) { + $max_value = pow(2, $bits) - 1; + $tests = 0; + if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || + !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id INT, label BIT(%d)) ENGINE="%s"', $bits, $engine))) + printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link)); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link)); - while ($tests < min($max_value, 20)) { - $tests++; - $value = mt_rand(0, $max_value); - $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, b'%s')", $value, decbin($value)); + while ($tests < min($max_value, 20)) { + $tests++; + $value = mt_rand(0, $max_value); + $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, b'%s')", $value, decbin($value)); - if (!mysqli_stmt_prepare($stmt, $sql) || - !mysqli_stmt_execute($stmt)) - printf("[004 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, $sql) || + !mysqli_stmt_execute($stmt)) + printf("[004 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = $_label0 = $label = null; - $sql = sprintf("SELECT id, label + 0 AS _label0, label FROM test WHERE id = %d", $value); - if (!mysqli_stmt_prepare($stmt, $sql) || - !mysqli_stmt_execute($stmt) || - !mysqli_stmt_bind_result($stmt, $id, $_label0, $label)) - printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = $_label0 = $label = null; + $sql = sprintf("SELECT id, label + 0 AS _label0, label FROM test WHERE id = %d", $value); + if (!mysqli_stmt_prepare($stmt, $sql) || + !mysqli_stmt_execute($stmt) || + !mysqli_stmt_bind_result($stmt, $id, $_label0, $label)) + printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_fetch($stmt)) - printf("[006 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_fetch($stmt)) + printf("[006 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (($id !== $_label0) || ($value !== $_label0)) { - printf("[007 - %d] Insert of %d in BIT(%d) column might have failed. MySQL reports odd values, id = %s, _label0 = %s, label = %s.\n", $bits, $value, $bits, $id, $_label0, $label); - } - if ($value != $label) { - printf("[008 - %d] Wrong values, (original) value = %s, id = %s, label + 0 AS label0 = %s, label = %s\n", - $bits, $value, $id, $_label0, $label); - } - } + if (($id !== $_label0) || ($value !== $_label0)) { + printf("[007 - %d] Insert of %d in BIT(%d) column might have failed. MySQL reports odd values, id = %s, _label0 = %s, label = %s.\n", $bits, $value, $bits, $id, $_label0, $label); + } + if ($value != $label) { + printf("[008 - %d] Wrong values, (original) value = %s, id = %s, label + 0 AS label0 = %s, label = %s\n", + $bits, $value, $id, $_label0, $label); + } + } - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); - } + } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt b/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt index 14333e7665..fe5d2f3799 100644 --- a/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt +++ b/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt @@ -8,43 +8,43 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - require_once('table.inc'); + require_once("connect.inc"); + require_once('table.inc'); - $bind_res = $id = null; - if (!($stmt = mysqli_stmt_init($link)) || - !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") || - !mysqli_stmt_execute($stmt) || - !($result = mysqli_stmt_result_metadata($stmt)) || - !mysqli_stmt_bind_result($stmt, $id, $bind_res) || - !($fields = mysqli_fetch_fields($result))) { - printf("FAIL 1\n"); - } - while (mysqli_stmt_fetch($stmt)) { - ; - } - mysqli_free_result($result); - mysqli_stmt_close($stmt); + $bind_res = $id = null; + if (!($stmt = mysqli_stmt_init($link)) || + !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") || + !mysqli_stmt_execute($stmt) || + !($result = mysqli_stmt_result_metadata($stmt)) || + !mysqli_stmt_bind_result($stmt, $id, $bind_res) || + !($fields = mysqli_fetch_fields($result))) { + printf("FAIL 1\n"); + } + while (mysqli_stmt_fetch($stmt)) { + ; + } + mysqli_free_result($result); + mysqli_stmt_close($stmt); - if (!($stmt = mysqli_stmt_init($link)) || - !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") || - !mysqli_stmt_execute($stmt) || - !($result = mysqli_stmt_result_metadata($stmt)) || - !mysqli_stmt_bind_result($stmt, $id, $bind_res)) { - printf("FAIL 2\n"); - } - print "OK: 1\n"; - if (!($fields = mysqli_fetch_fields($result))) - printf("Aua 3\n"); - print "OK: 2\n"; - while (mysqli_stmt_fetch($stmt)) { - ; - } - mysqli_free_result($result); - mysqli_stmt_close($stmt); + if (!($stmt = mysqli_stmt_init($link)) || + !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") || + !mysqli_stmt_execute($stmt) || + !($result = mysqli_stmt_result_metadata($stmt)) || + !mysqli_stmt_bind_result($stmt, $id, $bind_res)) { + printf("FAIL 2\n"); + } + print "OK: 1\n"; + if (!($fields = mysqli_fetch_fields($result))) + printf("Aua 3\n"); + print "OK: 2\n"; + while (mysqli_stmt_fetch($stmt)) { + ; + } + mysqli_free_result($result); + mysqli_stmt_close($stmt); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt b/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt index f76d407ad0..8c87199602 100644 --- a/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt +++ b/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt @@ -11,128 +11,128 @@ mysqli_stmt_fetch - geometry / spatial types ?> --FILE-- <?php - require('connect.inc'); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - - function func_mysqli_stmt_fetch_geom($link, $engine, $sql_type, $bind_value, $offset) { - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { - // don't bail - column type might not be supported by the server, ignore this - return false; - } - - for ($id = 1; $id < 4; $id++) { - $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, %s)", $id, $bind_value); - if (!mysqli_query($link, $sql)) { - printf("[%04d] [%d] %s\n", $offset + 2 + $id, mysqli_errno($link), mysqli_error($link)); - } - } - - if (!$stmt = mysqli_stmt_init($link)) { - printf("[%04d] [%d] %s\n", $offset + 6, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) { - printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - - if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_store_result($stmt)) { - printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - - if (!mysqli_stmt_bind_result($stmt, $id, $bind_res)) { - printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - - $result = mysqli_stmt_result_metadata($stmt); - $fields = mysqli_fetch_fields($result); - if ($fields[1]->type != MYSQLI_TYPE_GEOMETRY) { - printf("[%04d] [%d] %s wrong type %d\n", $offset + 10, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $fields[1]->type); - } - - $num = 0; - $rows = array(); - while (true === @mysqli_stmt_fetch($stmt)) { - $rows[] = array('id' => $id, 'label' => $bind_res); - $num++; - } - - if ($num != 3) { - printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n", - $offset + 17, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num); - return false; - } - mysqli_stmt_close($stmt); - - foreach ($rows as $row) { - if (!$stmt = mysqli_stmt_init($link)) { - printf("[%04d] [%d] %s\n", $offset + 10, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) { - printf("[%04d] [%d] %s\n", $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - $new_id = $row['id'] + 10; - if (!mysqli_stmt_bind_param($stmt, "is", $new_id, $row['label'])) { - printf("[%04d] [%d] %s\n", $offset + 12, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!mysqli_stmt_execute($stmt)) { - printf("[%04d] [%d] %s\n", $offset + 13, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - mysqli_stmt_close($stmt); - - if (!$res_normal = mysqli_query($link, sprintf("SELECT id, label FROM test WHERE id = %d", - $new_id))) { - printf("[%04d] [%d] %s\n", $offset + 14, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!$row_normal = mysqli_fetch_assoc($res_normal)) { - printf("[%04d] [%d] %s\n", $offset + 15, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if ($row_normal['label'] != $row['label']) { - printf("[%04d] PS and non-PS return different data.\n", $offset + 16); - return false; - } - mysqli_free_result($res_normal); - } - - return true; - } - - $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText"; - func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20); - func_mysqli_stmt_fetch_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40); - func_mysqli_stmt_fetch_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60); - func_mysqli_stmt_fetch_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80); - func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100); - func_mysqli_stmt_fetch_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120); - func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140); - func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160); - - mysqli_close($link); - print "done!"; + require('connect.inc'); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + + function func_mysqli_stmt_fetch_geom($link, $engine, $sql_type, $bind_value, $offset) { + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { + printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { + // don't bail - column type might not be supported by the server, ignore this + return false; + } + + for ($id = 1; $id < 4; $id++) { + $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, %s)", $id, $bind_value); + if (!mysqli_query($link, $sql)) { + printf("[%04d] [%d] %s\n", $offset + 2 + $id, mysqli_errno($link), mysqli_error($link)); + } + } + + if (!$stmt = mysqli_stmt_init($link)) { + printf("[%04d] [%d] %s\n", $offset + 6, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) { + printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_store_result($stmt)) { + printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + + if (!mysqli_stmt_bind_result($stmt, $id, $bind_res)) { + printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + + $result = mysqli_stmt_result_metadata($stmt); + $fields = mysqli_fetch_fields($result); + if ($fields[1]->type != MYSQLI_TYPE_GEOMETRY) { + printf("[%04d] [%d] %s wrong type %d\n", $offset + 10, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $fields[1]->type); + } + + $num = 0; + $rows = array(); + while (true === @mysqli_stmt_fetch($stmt)) { + $rows[] = array('id' => $id, 'label' => $bind_res); + $num++; + } + + if ($num != 3) { + printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n", + $offset + 17, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num); + return false; + } + mysqli_stmt_close($stmt); + + foreach ($rows as $row) { + if (!$stmt = mysqli_stmt_init($link)) { + printf("[%04d] [%d] %s\n", $offset + 10, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) { + printf("[%04d] [%d] %s\n", $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + $new_id = $row['id'] + 10; + if (!mysqli_stmt_bind_param($stmt, "is", $new_id, $row['label'])) { + printf("[%04d] [%d] %s\n", $offset + 12, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!mysqli_stmt_execute($stmt)) { + printf("[%04d] [%d] %s\n", $offset + 13, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + mysqli_stmt_close($stmt); + + if (!$res_normal = mysqli_query($link, sprintf("SELECT id, label FROM test WHERE id = %d", + $new_id))) { + printf("[%04d] [%d] %s\n", $offset + 14, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!$row_normal = mysqli_fetch_assoc($res_normal)) { + printf("[%04d] [%d] %s\n", $offset + 15, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if ($row_normal['label'] != $row['label']) { + printf("[%04d] PS and non-PS return different data.\n", $offset + 16); + return false; + } + mysqli_free_result($res_normal); + } + + return true; + } + + $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText"; + func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20); + func_mysqli_stmt_fetch_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40); + func_mysqli_stmt_fetch_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60); + func_mysqli_stmt_fetch_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80); + func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100); + func_mysqli_stmt_fetch_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120); + func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140); + func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160); + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_field_count.phpt b/ext/mysqli/tests/mysqli_stmt_field_count.phpt index 72cb2ecb03..51afb04e1b 100644 --- a/ext/mysqli/tests/mysqli_stmt_field_count.phpt +++ b/ext/mysqli/tests/mysqli_stmt_field_count.phpt @@ -8,68 +8,68 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - $stmt = mysqli_stmt_init($link); + $stmt = mysqli_stmt_init($link); - try { + try { mysqli_stmt_field_count($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (mysqli_stmt_prepare($stmt, '')) - printf("[004] Prepare should fail for an empty statement\n"); + if (mysqli_stmt_prepare($stmt, '')) + printf("[004] Prepare should fail for an empty statement\n"); - try { + try { mysqli_stmt_field_count($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, 'SELECT 1')) - printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (1 !== ($tmp = mysqli_stmt_field_count($stmt))) - printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (!mysqli_stmt_prepare($stmt, 'SELECT 1')) + printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (1 !== ($tmp = mysqli_stmt_field_count($stmt))) + printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_prepare($stmt, 'SELECT 1, 2')) - printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (2 !== ($tmp = mysqli_stmt_field_count($stmt))) - printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); + if (!mysqli_stmt_prepare($stmt, 'SELECT 1, 2')) + printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (2 !== ($tmp = mysqli_stmt_field_count($stmt))) + printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test')) - printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (2 !== ($tmp = mysqli_stmt_field_count($stmt))) - printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test')) + printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (2 !== ($tmp = mysqli_stmt_field_count($stmt))) + printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test') || - !mysqli_stmt_execute($stmt)) - printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (1 !== ($tmp = mysqli_stmt_field_count($stmt))) - printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test') || + !mysqli_stmt_execute($stmt)) + printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (1 !== ($tmp = mysqli_stmt_field_count($stmt))) + printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - $label = null; - if (mysqli_stmt_bind_param($stmt, "s", $label)) - printf("[014] expected error - got ok\n"); - while (mysqli_stmt_fetch($stmt)) - if (1 !== ($tmp = mysqli_stmt_field_count($stmt))) - printf("[015] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + $label = null; + if (mysqli_stmt_bind_param($stmt, "s", $label)) + printf("[014] expected error - got ok\n"); + while (mysqli_stmt_fetch($stmt)) + if (1 !== ($tmp = mysqli_stmt_field_count($stmt))) + printf("[015] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_prepare($stmt, 'INSERT INTO test(id) VALUES (100)')) - printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (0 !== ($tmp = mysqli_stmt_field_count($stmt))) - printf("[017] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (!mysqli_stmt_prepare($stmt, 'INSERT INTO test(id) VALUES (100)')) + printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (0 !== ($tmp = mysqli_stmt_field_count($stmt))) + printf("[017] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'z' WHERE id = 1") || - !mysqli_stmt_execute($stmt)) - printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'z' WHERE id = 1") || + !mysqli_stmt_execute($stmt)) + printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (0 !== ($tmp = mysqli_stmt_field_count($stmt))) - printf("[019] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = mysqli_stmt_field_count($stmt))) + printf("[019] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); try { mysqli_stmt_prepare($stmt, 'SELECT id FROM test'); @@ -77,15 +77,15 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - try { + try { mysqli_stmt_field_count($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_free_result.phpt b/ext/mysqli/tests/mysqli_stmt_free_result.phpt index 02e7352b28..b43afce5c9 100644 --- a/ext/mysqli/tests/mysqli_stmt_free_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_free_result.phpt @@ -8,58 +8,58 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - /* - NOTE: no datatype tests here! This is done by - mysqli_stmt_bind_result.phpt already. Restrict - this test case to the basics. - */ - require_once("connect.inc"); + /* + NOTE: no datatype tests here! This is done by + mysqli_stmt_bind_result.phpt already. Restrict + this test case to the basics. + */ + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // stmt object status test + // stmt object status test try { mysqli_stmt_free_result($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id")) - printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id")) + printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (NULL !== ($tmp = mysqli_stmt_free_result($stmt))) - printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = mysqli_stmt_free_result($stmt))) + printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_execute($stmt)) - printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (NULL !== ($tmp = mysqli_stmt_free_result($stmt))) - printf("[008] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = mysqli_stmt_free_result($stmt))) + printf("[008] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_stmt_store_result($stmt))) - printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_stmt_store_result($stmt))) + printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id")) - printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id")) + printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_execute($stmt)) - printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = mysqli_stmt_store_result($stmt))) - printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_stmt_store_result($stmt))) + printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (NULL !== ($tmp = mysqli_stmt_free_result($stmt))) - printf("[014] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = mysqli_stmt_free_result($stmt))) + printf("[014] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); try { mysqli_stmt_free_result($stmt); @@ -67,9 +67,9 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_get_result.phpt b/ext/mysqli/tests/mysqli_stmt_get_result.phpt index 998fa8e0b5..09c63ab7f8 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result.phpt @@ -11,152 +11,152 @@ if (!function_exists('mysqli_stmt_get_result')) ?> --FILE-- <?php - /* - NOTE: no datatype tests here! This is done by - mysqli_stmt_bind_result.phpt already. Restrict - this test case to the basics. - */ - require_once("connect.inc"); + /* + NOTE: no datatype tests here! This is done by + mysqli_stmt_bind_result.phpt already. Restrict + this test case to the basics. + */ + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // stmt object status test + // stmt object status test try { mysqli_stmt_fetch($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) - printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) + printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - // FIXME - different versions return different values ?! - if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp)) - printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + // FIXME - different versions return different values ?! + if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp)) + printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); - if (!mysqli_stmt_execute($stmt)) - printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_store_result($stmt)) - printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_store_result($stmt)) + printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (is_object($tmp = mysqli_stmt_store_result($stmt))) - printf("[009] non-object, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + if (is_object($tmp = mysqli_stmt_store_result($stmt))) + printf("[009] non-object, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // stmt object status test + // stmt object status test try { mysqli_stmt_fetch($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) - printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) + printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - // FIXME - different versions return different values ?! - if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp)) - printf("[013] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + // FIXME - different versions return different values ?! + if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp)) + printf("[013] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); - if (!mysqli_stmt_execute($stmt)) - printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!is_object($tmp = mysqli_stmt_get_result($stmt))) - printf("[016] NULL, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + if (!is_object($tmp = mysqli_stmt_get_result($stmt))) + printf("[016] NULL, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); - mysqli_free_result($tmp); - mysqli_stmt_close($stmt); + mysqli_free_result($tmp); + mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // stmt object status test + // stmt object status test try { mysqli_stmt_get_result($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) - printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) + printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (false !== ($tmp = mysqli_stmt_get_result($stmt))) - printf("[020] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + if (false !== ($tmp = mysqli_stmt_get_result($stmt))) + printf("[020] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); - if (!mysqli_stmt_execute($stmt)) - printf("[023] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[023] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!is_object($tmp = mysqli_stmt_get_result($stmt))) - printf("[024] Expecting object, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + if (!is_object($tmp = mysqli_stmt_get_result($stmt))) + printf("[024] Expecting object, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); - if (false !== ($tmp = mysqli_stmt_fetch($stmt))) - printf("[025] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + if (false !== ($tmp = mysqli_stmt_fetch($stmt))) + printf("[025] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) { - printf("[026] [%d] [%s]\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - printf("[027] [%d] [%s]\n", mysqli_errno($link), mysqli_error($link)); - printf("[028] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); - } + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) { + printf("[026] [%d] [%s]\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + printf("[027] [%d] [%s]\n", mysqli_errno($link), mysqli_error($link)); + printf("[028] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + } - if (false !== ($tmp = mysqli_stmt_fetch($stmt))) - printf("[029] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + if (false !== ($tmp = mysqli_stmt_fetch($stmt))) + printf("[029] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) - printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) + printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_execute($stmt)) - printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = NULL; - $label = NULL; - if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) - printf("[035] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + $id = NULL; + $label = NULL; + if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) + printf("[035] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); - if (!is_object($tmp = $result = mysqli_stmt_get_result($stmt))) - printf("[036] Expecting array, got %s/%s, [%d] %s\n", - gettype($tmp), var_export($tmp, 1), - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!is_object($tmp = $result = mysqli_stmt_get_result($stmt))) + printf("[036] Expecting array, got %s/%s, [%d] %s\n", + gettype($tmp), var_export($tmp, 1), + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (false !== ($tmp = mysqli_stmt_fetch($stmt))) - printf("[037] Expecting boolean/false, got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (false !== ($tmp = mysqli_stmt_fetch($stmt))) + printf("[037] Expecting boolean/false, got %s/%s, [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - printf("[038] [%d] [%s]\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - printf("[039] [%d] [%s]\n", mysqli_errno($link), mysqli_error($link)); - while ($row = mysqli_fetch_assoc($result)) { - var_dump($row); - } - mysqli_free_result($result); + printf("[038] [%d] [%s]\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + printf("[039] [%d] [%s]\n", mysqli_errno($link), mysqli_error($link)); + while ($row = mysqli_fetch_assoc($result)) { + var_dump($row); + } + mysqli_free_result($result); - if (!mysqli_kill($link, mysqli_thread_id($link))) - printf("[040] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_kill($link, mysqli_thread_id($link))) + printf("[040] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_stmt_get_result($stmt))) - printf("[041] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + if (false !== ($tmp = mysqli_stmt_get_result($stmt))) + printf("[041] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); - try { + try { mysqli_stmt_fetch($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt index f487868996..bbcb926c01 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt @@ -10,127 +10,127 @@ if (!function_exists('mysqli_stmt_get_result')) ?> --FILE-- <?php - /* - NOTE: no datatype tests here! This is done by - mysqli_stmt_bind_result.phpt already. Restrict - this test case to the basics. - */ - require_once("connect.inc"); - - require('table.inc'); - - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) - printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { - printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - while ($row = mysqli_fetch_assoc($res)) - var_dump($row); - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - - if (false !== ($res = mysqli_stmt_get_result($stmt))) { - printf("[008] boolean/false got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - - mysqli_stmt_execute($stmt); - if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { - printf("[009] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - while ($row = mysqli_fetch_assoc($res)) - var_dump($row); - var_dump(mysqli_fetch_assoc($res)); - mysqli_free_result($res); - - mysqli_stmt_close($stmt); - - if (!($stmt = mysqli_stmt_init($link)) || - !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") || - !mysqli_stmt_execute($stmt)) - printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label)) - printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_fetch($stmt)) - printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (false !== ($res = mysqli_stmt_get_result($stmt))) { - printf("[013] boolean/false got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - - mysqli_stmt_close($stmt); - - if (!($stmt = mysqli_stmt_init($link)) || - !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") || - !mysqli_stmt_execute($stmt)) - printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { - printf("[015] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label)) - printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_fetch($stmt)) - printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - mysqli_stmt_close($stmt); - - if (!($stmt = mysqli_stmt_init($link)) || - !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") || - !mysqli_stmt_execute($stmt)) - printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { - printf("[019] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - - $id = $label = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label)) - printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $row = mysqli_fetch_assoc($res); - if (NULL !== $id || NULL !== $label) - printf("[021] Bound variables should not have been set\n"); - mysqli_free_result($res); - - mysqli_stmt_close($stmt); - - if (!($stmt = mysqli_stmt_init($link)) || - !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") || - !mysqli_stmt_execute($stmt)) - printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { - printf("[023] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - if (!in_array($res->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT))) { - printf("[024] Unknown result set type %s\n", $res->type); - } - if ($res->type !== MYSQLI_STORE_RESULT) - printf("[025] Expecting int/%d got %s/%s", MYSQLI_STORE_RESULT, gettype($res->type), $res->type); - - mysqli_free_result($res); - mysqli_stmt_close($stmt); - mysqli_close($link); + /* + NOTE: no datatype tests here! This is done by + mysqli_stmt_bind_result.phpt already. Restrict + this test case to the basics. + */ + require_once("connect.inc"); + + require('table.inc'); + + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) + printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { + printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + while ($row = mysqli_fetch_assoc($res)) + var_dump($row); + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + + if (false !== ($res = mysqli_stmt_get_result($stmt))) { + printf("[008] boolean/false got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + + mysqli_stmt_execute($stmt); + if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { + printf("[009] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + while ($row = mysqli_fetch_assoc($res)) + var_dump($row); + var_dump(mysqli_fetch_assoc($res)); + mysqli_free_result($res); + + mysqli_stmt_close($stmt); + + if (!($stmt = mysqli_stmt_init($link)) || + !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") || + !mysqli_stmt_execute($stmt)) + printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label)) + printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_fetch($stmt)) + printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (false !== ($res = mysqli_stmt_get_result($stmt))) { + printf("[013] boolean/false got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + + mysqli_stmt_close($stmt); + + if (!($stmt = mysqli_stmt_init($link)) || + !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") || + !mysqli_stmt_execute($stmt)) + printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { + printf("[015] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label)) + printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_fetch($stmt)) + printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + mysqli_stmt_close($stmt); + + if (!($stmt = mysqli_stmt_init($link)) || + !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") || + !mysqli_stmt_execute($stmt)) + printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { + printf("[019] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + + $id = $label = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label)) + printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $row = mysqli_fetch_assoc($res); + if (NULL !== $id || NULL !== $label) + printf("[021] Bound variables should not have been set\n"); + mysqli_free_result($res); + + mysqli_stmt_close($stmt); + + if (!($stmt = mysqli_stmt_init($link)) || + !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") || + !mysqli_stmt_execute($stmt)) + printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { + printf("[023] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + if (!in_array($res->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT))) { + printf("[024] Unknown result set type %s\n", $res->type); + } + if ($res->type !== MYSQLI_STORE_RESULT) + printf("[025] Expecting int/%d got %s/%s", MYSQLI_STORE_RESULT, gettype($res->type), $res->type); + + mysqli_free_result($res); + mysqli_stmt_close($stmt); + mysqli_close($link); try { mysqli_stmt_get_result($stmt); @@ -138,7 +138,7 @@ if (!function_exists('mysqli_stmt_get_result')) echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt index c7109063e7..7c4292de00 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt @@ -20,110 +20,110 @@ Fetching BIT column values using the PS API ?> --FILE-- <?php - require('connect.inc'); - - function dec32bin($dec, $bits) { - - $maxval = pow(2, $bits); - $bin = ''; - for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) { - if (($dec / $bitval) >= 1) { - $bin .= '1'; - $dec -= $bitval; - } else { - $bin .= '0'; - } - } - return $bin; - } - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - - for ($bits = 1; $bits <= 46; $bits++) { - if (1 == $bits) - $max_value = 1; - else - $max_value = pow(2, $bits) - 1; - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || - !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id BIGINT UNSIGNED, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE="%s"', $bits, $bits, $engine))) - printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link)); - - if (!$stmt = mysqli_stmt_init($link)) - printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link)); - - $tests = 0; - $rand_max = mt_getrandmax(); - while ($tests < 10) { - - $tests++; - if (1 == $tests) - $value = 0; - else if (2 == $tests) - $value = $max_value; - else { - if ($max_value > $rand_max) { - $max_loops = floor($max_value/$rand_max); - $num_loops = mt_rand(1, $max_loops); - $value = 0; - for ($i = 0; $i < $num_loops; $i++) - $value += mt_rand(0, $rand_max); - } else { - $value = mt_rand(0, $max_value); - } - } - - $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits); - $sql = sprintf("INSERT INTO test(id, bit_value) VALUES (%s, b'%s')", $value, $bin); - for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++) - ; - $bin2 = substr($bin, $i, strlen($bin)); - - if (!mysqli_stmt_prepare($stmt, $sql) || - !mysqli_stmt_execute($stmt)) - printf("[004 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - $sql = sprintf("SELECT bin(bit_value) AS _bin, id, bit_value, bit_null FROM test WHERE id = %s", $value); - if (!mysqli_stmt_prepare($stmt, $sql) || - !mysqli_stmt_execute($stmt)) - printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!$res = mysqli_stmt_get_result($stmt)) - printf("[006 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!$row = mysqli_fetch_assoc($res)) - printf("[007 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - - if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) { - debug_zval_dump($row); - printf("[008 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n", - $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2); - break; - } - if ($value != $row['bit_value']) { - debug_zval_dump($row); - printf("%10s %64s\n%10s %64s\n", '_bin', $row['_bin'], 'insert', $bin); - printf("[009 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']); - break; - } - - if (null !== $row['bit_null']) { - debug_zval_dump($row); - printf("[010 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']); - break; - } - - } - - mysqli_stmt_close($stmt); - - } - - mysqli_close($link); - print "done!"; + require('connect.inc'); + + function dec32bin($dec, $bits) { + + $maxval = pow(2, $bits); + $bin = ''; + for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) { + if (($dec / $bitval) >= 1) { + $bin .= '1'; + $dec -= $bitval; + } else { + $bin .= '0'; + } + } + return $bin; + } + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + + for ($bits = 1; $bits <= 46; $bits++) { + if (1 == $bits) + $max_value = 1; + else + $max_value = pow(2, $bits) - 1; + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || + !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id BIGINT UNSIGNED, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE="%s"', $bits, $bits, $engine))) + printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link)); + + if (!$stmt = mysqli_stmt_init($link)) + printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link)); + + $tests = 0; + $rand_max = mt_getrandmax(); + while ($tests < 10) { + + $tests++; + if (1 == $tests) + $value = 0; + else if (2 == $tests) + $value = $max_value; + else { + if ($max_value > $rand_max) { + $max_loops = floor($max_value/$rand_max); + $num_loops = mt_rand(1, $max_loops); + $value = 0; + for ($i = 0; $i < $num_loops; $i++) + $value += mt_rand(0, $rand_max); + } else { + $value = mt_rand(0, $max_value); + } + } + + $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits); + $sql = sprintf("INSERT INTO test(id, bit_value) VALUES (%s, b'%s')", $value, $bin); + for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++) + ; + $bin2 = substr($bin, $i, strlen($bin)); + + if (!mysqli_stmt_prepare($stmt, $sql) || + !mysqli_stmt_execute($stmt)) + printf("[004 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $sql = sprintf("SELECT bin(bit_value) AS _bin, id, bit_value, bit_null FROM test WHERE id = %s", $value); + if (!mysqli_stmt_prepare($stmt, $sql) || + !mysqli_stmt_execute($stmt)) + printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!$res = mysqli_stmt_get_result($stmt)) + printf("[006 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!$row = mysqli_fetch_assoc($res)) + printf("[007 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); + + if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) { + debug_zval_dump($row); + printf("[008 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n", + $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2); + break; + } + if ($value != $row['bit_value']) { + debug_zval_dump($row); + printf("%10s %64s\n%10s %64s\n", '_bin', $row['_bin'], 'insert', $bin); + printf("[009 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']); + break; + } + + if (null !== $row['bit_null']) { + debug_zval_dump($row); + printf("[010 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']); + break; + } + + } + + mysqli_stmt_close($stmt); + + } + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt index 8508150f98..2d58ca20d3 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt @@ -11,35 +11,35 @@ mysqli_stmt_get_result() - meta data, field_count() ?> --FILE-- <?php - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3")) - printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3")) + printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_execute($stmt)) - printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { - printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } + if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { + printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } - if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) || - 'mysqli_result' != get_class($res_meta)) { - printf("[005] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } + if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) || + 'mysqli_result' != get_class($res_meta)) { + printf("[005] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } - printf("%s %s\n", - $res_meta->field_count, - $res->field_count); + printf("%s %s\n", + $res_meta->field_count, + $res->field_count); - mysqli_stmt_close($stmt); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt index aeadc3b1d7..9b8369a7ca 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt @@ -14,127 +14,127 @@ mysqli_stmt_get_result - geometry / spatial types ?> --FILE-- <?php - require('connect.inc'); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - - function func_mysqli_stmt_get_result_geom($link, $engine, $sql_type, $bind_value, $offset) { - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { - // don't bail - column type might not be supported by the server, ignore this - return false; - } - - for ($id = 1; $id < 4; $id++) { - $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, %s)", $id, $bind_value); - if (!mysqli_query($link, $sql)) { - printf("[%04d] [%d] %s\n", $offset + 2 + $id, mysqli_errno($link), mysqli_error($link)); - } - } - - if (!$stmt = mysqli_stmt_init($link)) { - printf("[%04d] [%d] %s\n", $offset + 6, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) { - printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - - if (!mysqli_stmt_execute($stmt)) { - printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - if (!$res = mysqli_stmt_get_result($stmt)) { - printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - - $result = mysqli_stmt_result_metadata($stmt); - $fields = mysqli_fetch_fields($result); - if ($fields[1]->type != MYSQLI_TYPE_GEOMETRY) { - printf("[%04d] [%d] %s wrong type %d\n", $offset + 10, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $fields[1]->type); - } - - $num = 0; - while ($row = mysqli_fetch_assoc($res)) { - $bind_res = &$row['label']; - - if (!$stmt2 = mysqli_stmt_init($link)) { - printf("[%04d] [%d] %s\n", $offset + 11, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_stmt_prepare($stmt2, "INSERT INTO test(id, label) VALUES (?, ?)")) { - printf("[%04d] [%d] %s\n", $offset + 12, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2)); - return false; - } - - $id = $row['id'] + 10; - if (!mysqli_stmt_bind_param($stmt2, "is", $id, $bind_res)) { - printf("[%04d] [%d] %s\n", $offset + 13, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2)); - return false; - } - - if (!mysqli_stmt_execute($stmt2)) { - printf("[%04d] [%d] %s\n", $offset + 14, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2)); - return false; - } - mysqli_stmt_close($stmt2); - - if (!$res_normal = mysqli_query($link, sprintf("SELECT id, label FROM test WHERE id = %d", - $row['id'] + 10))) { - printf("[%04d] [%d] %s\n", $offset + 15, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!$row_normal = mysqli_fetch_assoc($res_normal)) { - printf("[%04d] [%d] %s\n", $offset + 16, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if ($row_normal['label'] != $bind_res) { - printf("[%04d] PS and non-PS return different data.\n", $offset + 17); - return false; - } - mysqli_free_result($res_normal); - $num++; - } - - if ($num != 3) { - printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n", - $offset + 18, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num); - mysqli_free_result($res); - mysqli_stmt_close($stmt); - return false; - } - mysqli_free_result($res); - mysqli_stmt_close($stmt); - - return true; - } - - $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText"; - func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20); - func_mysqli_stmt_get_result_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40); - func_mysqli_stmt_get_result_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60); - func_mysqli_stmt_get_result_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80); - func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100); - func_mysqli_stmt_get_result_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120); - func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140); - func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160); - - mysqli_close($link); - print "done!"; + require('connect.inc'); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + + function func_mysqli_stmt_get_result_geom($link, $engine, $sql_type, $bind_value, $offset) { + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { + printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { + // don't bail - column type might not be supported by the server, ignore this + return false; + } + + for ($id = 1; $id < 4; $id++) { + $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, %s)", $id, $bind_value); + if (!mysqli_query($link, $sql)) { + printf("[%04d] [%d] %s\n", $offset + 2 + $id, mysqli_errno($link), mysqli_error($link)); + } + } + + if (!$stmt = mysqli_stmt_init($link)) { + printf("[%04d] [%d] %s\n", $offset + 6, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) { + printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + + if (!mysqli_stmt_execute($stmt)) { + printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + if (!$res = mysqli_stmt_get_result($stmt)) { + printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + + $result = mysqli_stmt_result_metadata($stmt); + $fields = mysqli_fetch_fields($result); + if ($fields[1]->type != MYSQLI_TYPE_GEOMETRY) { + printf("[%04d] [%d] %s wrong type %d\n", $offset + 10, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $fields[1]->type); + } + + $num = 0; + while ($row = mysqli_fetch_assoc($res)) { + $bind_res = &$row['label']; + + if (!$stmt2 = mysqli_stmt_init($link)) { + printf("[%04d] [%d] %s\n", $offset + 11, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_stmt_prepare($stmt2, "INSERT INTO test(id, label) VALUES (?, ?)")) { + printf("[%04d] [%d] %s\n", $offset + 12, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2)); + return false; + } + + $id = $row['id'] + 10; + if (!mysqli_stmt_bind_param($stmt2, "is", $id, $bind_res)) { + printf("[%04d] [%d] %s\n", $offset + 13, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2)); + return false; + } + + if (!mysqli_stmt_execute($stmt2)) { + printf("[%04d] [%d] %s\n", $offset + 14, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2)); + return false; + } + mysqli_stmt_close($stmt2); + + if (!$res_normal = mysqli_query($link, sprintf("SELECT id, label FROM test WHERE id = %d", + $row['id'] + 10))) { + printf("[%04d] [%d] %s\n", $offset + 15, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!$row_normal = mysqli_fetch_assoc($res_normal)) { + printf("[%04d] [%d] %s\n", $offset + 16, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if ($row_normal['label'] != $bind_res) { + printf("[%04d] PS and non-PS return different data.\n", $offset + 17); + return false; + } + mysqli_free_result($res_normal); + $num++; + } + + if ($num != 3) { + printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n", + $offset + 18, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num); + mysqli_free_result($res); + mysqli_stmt_close($stmt); + return false; + } + mysqli_free_result($res); + mysqli_stmt_close($stmt); + + return true; + } + + $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText"; + func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20); + func_mysqli_stmt_get_result_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40); + func_mysqli_stmt_get_result_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60); + func_mysqli_stmt_get_result_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80); + func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100); + func_mysqli_stmt_get_result_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120); + func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140); + func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160); + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt index fd0724ce79..eb902188e0 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt @@ -11,211 +11,211 @@ if (!function_exists('mysqli_stmt_get_result')) ?> --FILE-- <?php - require('table.inc'); - - if (!$stmt = mysqli_stmt_init($link)) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3")) - printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { - printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - - if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) || - 'mysqli_result' != get_class($res_meta)) { - printf("[005] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - - var_dump(mysqli_fetch_assoc($res)); - var_dump(mysqli_fetch_assoc($res_meta)); - - mysqli_free_result($res); - mysqli_free_result($res_meta); - mysqli_stmt_close($stmt); - - // !mysqli_stmt_prepare($stmt, "SELECT id, label, id + 1 as _id, concat(label, '_') _label FROM test as _test ORDER BY id ASC LIMIT 3") || - if (!($stmt = mysqli_stmt_init($link)) || - !mysqli_stmt_prepare($stmt, "SELECT id , label, id + 1 AS _id, label AS _label, null AS _null, CONCAT(label, '_') _label_concat FROM test _test ORDER BY id ASC LIMIT 3") || - !mysqli_stmt_execute($stmt)) - printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { - printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - - if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) || - 'mysqli_result' != get_class($res_meta)) { - printf("[008] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - - if (($tmp1 = mysqli_num_fields($res)) !== ($tmp2 = mysqli_num_fields($res_meta))) { - printf("[009] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2); - } - - /* - if (($tmp1 = mysqli_field_count($link)) !== ($tmp2 = $res->field_count())) - printf("[010] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2); - - if (($tmp1 = $res_meta->field_count()) !== $tmp2) - printf("[011] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2); - */ - - if (($tmp1 = mysqli_field_tell($res)) !== ($tmp2 = $res_meta->current_field)) - printf("[012] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2); - - if (0 !== $tmp1) - printf("[013] Expecting int/0 got %s/%s\n", gettype($tmp1), $tmp1); - - $fields = array(); - while ($info = $res->fetch_field()) - $fields['res'][] = $info; - var_dump($info); - while ($info = $res_meta->fetch_field()) - $fields['meta'][] = $info; - var_dump($info); - $fields['all_res'] = $res->fetch_fields(); - $fields['all_meta'] = $res_meta->fetch_fields(); - - if (count($fields['res']) != count($fields['meta'])) { - printf("[014] stmt_get_result indicates %d fields, stmt_result_metadata indicates %d fields\n", - count($fields['res']), - count($fields['meta'])); - } - - foreach ($fields['res'] as $k => $info) { - printf("%s\n", $info->name); - if ($info->name !== $fields['meta'][$k]->name) - printf("[015 - %d] Expecting name %s/%s got %s/%s\n", - $k, gettype($info->name), $info->name, gettype($fields['meta'][$k]->name), $fields['meta'][$k]->name); - - if ($info->orgname !== $fields['meta'][$k]->orgname) - printf("[016 - %d] Expecting orgname %s/%s got %s/%s\n", - $k, gettype($info->orgname), $info->orgname, gettype($fields['meta'][$k]->orgname), $fields['meta'][$k]->orgname); - - if ($info->table !== $fields['meta'][$k]->table) - printf("[017 - %d] Expecting table %s/%s got %s/%s\n", - $k, gettype($info->table), $info->table, gettype($fields['meta'][$k]->table), $fields['meta'][$k]->table); - - if ($info->orgtable !== $fields['meta'][$k]->orgtable) - printf("[018 - %d] Expecting orgtable %s/%s got %s/%s\n", - $k, gettype($info->orgtable), $info->orgtable, gettype($fields['meta'][$k]->orgtable), $fields['meta'][$k]->orgtable); - - if ($info->def !== $fields['meta'][$k]->def) - printf("[019 - %d] Expecting def %s/%s got %s/%s\n", - $k, gettype($info->def), $info->def, gettype($fields['meta'][$k]->def), $fields['meta'][$k]->def); + require('table.inc'); + + if (!$stmt = mysqli_stmt_init($link)) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3")) + printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { + printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + + if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) || + 'mysqli_result' != get_class($res_meta)) { + printf("[005] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + + var_dump(mysqli_fetch_assoc($res)); + var_dump(mysqli_fetch_assoc($res_meta)); + + mysqli_free_result($res); + mysqli_free_result($res_meta); + mysqli_stmt_close($stmt); + + // !mysqli_stmt_prepare($stmt, "SELECT id, label, id + 1 as _id, concat(label, '_') _label FROM test as _test ORDER BY id ASC LIMIT 3") || + if (!($stmt = mysqli_stmt_init($link)) || + !mysqli_stmt_prepare($stmt, "SELECT id , label, id + 1 AS _id, label AS _label, null AS _null, CONCAT(label, '_') _label_concat FROM test _test ORDER BY id ASC LIMIT 3") || + !mysqli_stmt_execute($stmt)) + printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { + printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + + if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) || + 'mysqli_result' != get_class($res_meta)) { + printf("[008] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + + if (($tmp1 = mysqli_num_fields($res)) !== ($tmp2 = mysqli_num_fields($res_meta))) { + printf("[009] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2); + } + + /* + if (($tmp1 = mysqli_field_count($link)) !== ($tmp2 = $res->field_count())) + printf("[010] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2); + + if (($tmp1 = $res_meta->field_count()) !== $tmp2) + printf("[011] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2); + */ + + if (($tmp1 = mysqli_field_tell($res)) !== ($tmp2 = $res_meta->current_field)) + printf("[012] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2); + + if (0 !== $tmp1) + printf("[013] Expecting int/0 got %s/%s\n", gettype($tmp1), $tmp1); + + $fields = array(); + while ($info = $res->fetch_field()) + $fields['res'][] = $info; + var_dump($info); + while ($info = $res_meta->fetch_field()) + $fields['meta'][] = $info; + var_dump($info); + $fields['all_res'] = $res->fetch_fields(); + $fields['all_meta'] = $res_meta->fetch_fields(); + + if (count($fields['res']) != count($fields['meta'])) { + printf("[014] stmt_get_result indicates %d fields, stmt_result_metadata indicates %d fields\n", + count($fields['res']), + count($fields['meta'])); + } + + foreach ($fields['res'] as $k => $info) { + printf("%s\n", $info->name); + if ($info->name !== $fields['meta'][$k]->name) + printf("[015 - %d] Expecting name %s/%s got %s/%s\n", + $k, gettype($info->name), $info->name, gettype($fields['meta'][$k]->name), $fields['meta'][$k]->name); + + if ($info->orgname !== $fields['meta'][$k]->orgname) + printf("[016 - %d] Expecting orgname %s/%s got %s/%s\n", + $k, gettype($info->orgname), $info->orgname, gettype($fields['meta'][$k]->orgname), $fields['meta'][$k]->orgname); + + if ($info->table !== $fields['meta'][$k]->table) + printf("[017 - %d] Expecting table %s/%s got %s/%s\n", + $k, gettype($info->table), $info->table, gettype($fields['meta'][$k]->table), $fields['meta'][$k]->table); + + if ($info->orgtable !== $fields['meta'][$k]->orgtable) + printf("[018 - %d] Expecting orgtable %s/%s got %s/%s\n", + $k, gettype($info->orgtable), $info->orgtable, gettype($fields['meta'][$k]->orgtable), $fields['meta'][$k]->orgtable); + + if ($info->def !== $fields['meta'][$k]->def) + printf("[019 - %d] Expecting def %s/%s got %s/%s\n", + $k, gettype($info->def), $info->def, gettype($fields['meta'][$k]->def), $fields['meta'][$k]->def); /* - if ($info->max_length !== $fields['meta'][$k]->max_length) - printf("[020 - %d] Expecting max_length %s/%s got %s/%s\n", - $k, gettype($info->max_length), $info->max_length, gettype($fields['meta'][$k]->max_length), $fields['meta'][$k]->max_length); + if ($info->max_length !== $fields['meta'][$k]->max_length) + printf("[020 - %d] Expecting max_length %s/%s got %s/%s\n", + $k, gettype($info->max_length), $info->max_length, gettype($fields['meta'][$k]->max_length), $fields['meta'][$k]->max_length); */ - if ($info->length !== $fields['meta'][$k]->length) - printf("[021 - %d] Expecting length %s/%s got %s/%s\n", - $k, gettype($info->length), $info->length, gettype($fields['meta'][$k]->length), $fields['meta'][$k]->length); - - if ($info->charsetnr !== $fields['meta'][$k]->charsetnr) - printf("[022 - %d] Expecting charsetnr %s/%s got %s/%s\n", - $k, gettype($info->charsetnr), $info->charsetnr, gettype($fields['meta'][$k]->charsetnr), $fields['meta'][$k]->charsetnr); - - if ($info->flags !== $fields['meta'][$k]->flags) - printf("[023 - %d] Expecting flags %s/%s got %s/%s\n", - $k, gettype($info->flags), $info->flags, gettype($fields['meta'][$k]->flags), $fields['meta'][$k]->flags); - - if ($info->type !== $fields['meta'][$k]->type) - printf("[024 - %d] Expecting type %s/%s got %s/%s\n", - $k, gettype($info->type), $info->type, gettype($fields['meta'][$k]->type), $fields['meta'][$k]->type); - - if ($info->decimals !== $fields['meta'][$k]->decimals) - printf("[025 - %d] Expecting decimals %s/%s got %s/%s\n", - $k, getdecimals($info->decimals), $info->decimals, getdecimals($fields['meta'][$k]->decimals), $fields['meta'][$k]->decimals); - - /* Make them equal for the check */ - $tmp = $fields['all_res'][$k]->max_length; - $fields['all_res'][$k]->max_length = $fields['all_meta'][$k]->max_length; - - if ($fields['all_res'][$k] != $fields['all_meta'][$k]) { - printf("[026 - %d] fetch_fields() seems to have returned different data, dumping\n", $k); - var_dump($fields['all_res'][$k]); - var_dump($fields['all_meta'][$k]); - } - $fields['all_res'][$k]->max_length = $tmp; - } - - $num = count($fields['res']); - for ($i = 0; $i < 100; $i++) { - $pos = mt_rand(-1, $num + 1); - if ($pos >= 0 && $pos < $num) { - if (true !== mysqli_field_seek($res, $pos)) - printf("[027] field_seek(res) failed\n"); - if (true !== $res_meta->field_seek($pos)) - printf("[028] field_seek(res__meta) failed\n"); - - $tmp1 = $res->fetch_field(); - $tmp2 = mysqli_fetch_field($res_meta); - $tmp2->max_length = $tmp1->max_length; - if ($tmp1 != $tmp2) { - printf("[029] Field info differs, dumping data\n"); - var_dump($tmp1); - var_dump($tmp2); - } - - if ($tmp1 != $fields['res'][$pos]) { - printf("[030] Field info differs, dumping data\n"); - var_dump($tmp1); - var_dump($fields['res'][$pos]); - } - - $pos++; - if ($pos !== ($tmp = mysqli_field_tell($res))) - printf("[031] Expecting %s/%s got %s/%s\n", - gettype($pos), $pos, gettype($tmp), $tmp); - - if ($pos !== ($tmp = mysqli_field_tell($res_meta))) - printf("[032] Expecting %s/%s got %s/%s\n", - gettype($pos), $pos, gettype($tmp), $tmp); - } else { - - if (false !== @mysqli_field_seek($res, $pos)) - printf("[033] field_seek(%d) did not fail\n", $pos); - if (false !== @mysqli_field_seek($res_meta, $pos)) - printf("[034] field_seek(%d) did not fail\n", $pos); - } - } - - $res->free_result(); - mysqli_free_result($res_meta); - - try { + if ($info->length !== $fields['meta'][$k]->length) + printf("[021 - %d] Expecting length %s/%s got %s/%s\n", + $k, gettype($info->length), $info->length, gettype($fields['meta'][$k]->length), $fields['meta'][$k]->length); + + if ($info->charsetnr !== $fields['meta'][$k]->charsetnr) + printf("[022 - %d] Expecting charsetnr %s/%s got %s/%s\n", + $k, gettype($info->charsetnr), $info->charsetnr, gettype($fields['meta'][$k]->charsetnr), $fields['meta'][$k]->charsetnr); + + if ($info->flags !== $fields['meta'][$k]->flags) + printf("[023 - %d] Expecting flags %s/%s got %s/%s\n", + $k, gettype($info->flags), $info->flags, gettype($fields['meta'][$k]->flags), $fields['meta'][$k]->flags); + + if ($info->type !== $fields['meta'][$k]->type) + printf("[024 - %d] Expecting type %s/%s got %s/%s\n", + $k, gettype($info->type), $info->type, gettype($fields['meta'][$k]->type), $fields['meta'][$k]->type); + + if ($info->decimals !== $fields['meta'][$k]->decimals) + printf("[025 - %d] Expecting decimals %s/%s got %s/%s\n", + $k, getdecimals($info->decimals), $info->decimals, getdecimals($fields['meta'][$k]->decimals), $fields['meta'][$k]->decimals); + + /* Make them equal for the check */ + $tmp = $fields['all_res'][$k]->max_length; + $fields['all_res'][$k]->max_length = $fields['all_meta'][$k]->max_length; + + if ($fields['all_res'][$k] != $fields['all_meta'][$k]) { + printf("[026 - %d] fetch_fields() seems to have returned different data, dumping\n", $k); + var_dump($fields['all_res'][$k]); + var_dump($fields['all_meta'][$k]); + } + $fields['all_res'][$k]->max_length = $tmp; + } + + $num = count($fields['res']); + for ($i = 0; $i < 100; $i++) { + $pos = mt_rand(-1, $num + 1); + if ($pos >= 0 && $pos < $num) { + if (true !== mysqli_field_seek($res, $pos)) + printf("[027] field_seek(res) failed\n"); + if (true !== $res_meta->field_seek($pos)) + printf("[028] field_seek(res__meta) failed\n"); + + $tmp1 = $res->fetch_field(); + $tmp2 = mysqli_fetch_field($res_meta); + $tmp2->max_length = $tmp1->max_length; + if ($tmp1 != $tmp2) { + printf("[029] Field info differs, dumping data\n"); + var_dump($tmp1); + var_dump($tmp2); + } + + if ($tmp1 != $fields['res'][$pos]) { + printf("[030] Field info differs, dumping data\n"); + var_dump($tmp1); + var_dump($fields['res'][$pos]); + } + + $pos++; + if ($pos !== ($tmp = mysqli_field_tell($res))) + printf("[031] Expecting %s/%s got %s/%s\n", + gettype($pos), $pos, gettype($tmp), $tmp); + + if ($pos !== ($tmp = mysqli_field_tell($res_meta))) + printf("[032] Expecting %s/%s got %s/%s\n", + gettype($pos), $pos, gettype($tmp), $tmp); + } else { + + if (false !== @mysqli_field_seek($res, $pos)) + printf("[033] field_seek(%d) did not fail\n", $pos); + if (false !== @mysqli_field_seek($res_meta, $pos)) + printf("[034] field_seek(%d) did not fail\n", $pos); + } + } + + $res->free_result(); + mysqli_free_result($res_meta); + + try { mysqli_fetch_field($res); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); - try { + try { mysqli_fetch_field($res); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - mysqli_close($link); + mysqli_close($link); - try { + try { mysqli_fetch_field($res); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt index 5481db04f4..1c5d3ecbc7 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt @@ -11,55 +11,55 @@ if (!function_exists('mysqli_stmt_get_result')) ?> --FILE-- <?php - require('table.inc'); + require('table.inc'); - // Make sure that client, connection and result charsets are all the - // same. Not sure whether this is strictly necessary. - if (!mysqli_set_charset($link, 'utf8')) - printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link)); + // Make sure that client, connection and result charsets are all the + // same. Not sure whether this is strictly necessary. + if (!mysqli_set_charset($link, 'utf8')) + printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link)); - $charsetInfo = mysqli_get_charset($link); + $charsetInfo = mysqli_get_charset($link); - if (!($stmt = mysqli_stmt_init($link)) || - !mysqli_stmt_prepare($stmt, "SELECT id, label, id + 1 as _id, concat(label, '_') ___label FROM test ORDER BY id ASC LIMIT 3") || - !mysqli_stmt_execute($stmt)) - printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!($stmt = mysqli_stmt_init($link)) || + !mysqli_stmt_prepare($stmt, "SELECT id, label, id + 1 as _id, concat(label, '_') ___label FROM test ORDER BY id ASC LIMIT 3") || + !mysqli_stmt_execute($stmt)) + printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { - printf("[002] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } + if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { + printf("[002] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } - if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) || - 'mysqli_result' != get_class($res_meta)) { - printf("[003] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } + if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) || + 'mysqli_result' != get_class($res_meta)) { + printf("[003] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } - $i = 0; - while ($field = $res->fetch_field()) { - var_dump($field); - $i++; - if (2 == $i) { - /* - Label column, result set charset. - All of the following columns are "too hot" - too server dependent - */ - if ($field->charsetnr != $charsetInfo->number) { - printf("[004] Expecting charset %s/%d got %d\n", - $charsetInfo->charset, - $charsetInfo->number, $field->charsetnr); - } - if ($field->length != $charsetInfo->max_length) { - printf("[005] Expecting length %d got %d\n", - $charsetInfo->max_length, $field->max_length); - } - } - } + $i = 0; + while ($field = $res->fetch_field()) { + var_dump($field); + $i++; + if (2 == $i) { + /* + Label column, result set charset. + All of the following columns are "too hot" - too server dependent + */ + if ($field->charsetnr != $charsetInfo->number) { + printf("[004] Expecting charset %s/%d got %d\n", + $charsetInfo->charset, + $charsetInfo->number, $field->charsetnr); + } + if ($field->length != $charsetInfo->max_length) { + printf("[005] Expecting length %d got %d\n", + $charsetInfo->max_length, $field->max_length); + } + } + } - mysqli_stmt_close($stmt); - mysqli_close($link); - print "done!"; + mysqli_stmt_close($stmt); + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt index 1cd2981ed2..23254e1755 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt @@ -11,81 +11,81 @@ if (!function_exists('mysqli_stmt_get_result')) ?> --FILE-- <?php - /* - NOTE: no datatype tests here! This is done by - mysqli_stmt_bind_result.phpt already. Restrict - this test case to the basics. - */ - require('table.inc'); + /* + NOTE: no datatype tests here! This is done by + mysqli_stmt_bind_result.phpt already. Restrict + this test case to the basics. + */ + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (mysqli_query($link, 'PREPARE mystmt FROM "SHOW ENGINES"')) { - mysqli_query($link, 'DEALLOCATE PREPARE mystmt'); + if (mysqli_query($link, 'PREPARE mystmt FROM "SHOW ENGINES"')) { + mysqli_query($link, 'DEALLOCATE PREPARE mystmt'); - if (!$stmt->prepare('SHOW ENGINES') || - !$stmt->execute()) - printf("[002] [%d] %s\n", $stmt->errno, $stmt->error); + if (!$stmt->prepare('SHOW ENGINES') || + !$stmt->execute()) + printf("[002] [%d] %s\n", $stmt->errno, $stmt->error); - if (!$res = $stmt->get_result()) - printf("[003] [%d] %s\n", $stmt->errno, $stmt->error); + if (!$res = $stmt->get_result()) + printf("[003] [%d] %s\n", $stmt->errno, $stmt->error); - $engines = mysqli_fetch_all($res, MYSQLI_NUM); - if (empty($engines)) { - printf("[004] It is very unlikely that SHOW ENGINES returns no data, check manually\n"); - } else { - $found = false; - foreach ($engines as $k => $engine) - foreach ($engine as $k => $v) - if (stristr($v, 'MyISAM')) { - $found = true; - break; - } - if (!$found) - printf("[005] It is very unlikely that SHOW ENGINES does not show MyISAM, check manually\n"); - } - mysqli_free_result($res); - } + $engines = mysqli_fetch_all($res, MYSQLI_NUM); + if (empty($engines)) { + printf("[004] It is very unlikely that SHOW ENGINES returns no data, check manually\n"); + } else { + $found = false; + foreach ($engines as $k => $engine) + foreach ($engine as $k => $v) + if (stristr($v, 'MyISAM')) { + $found = true; + break; + } + if (!$found) + printf("[005] It is very unlikely that SHOW ENGINES does not show MyISAM, check manually\n"); + } + mysqli_free_result($res); + } - if (mysqli_query($link, 'PREPARE mystmt FROM "DESCRIBE test id"')) { - mysqli_query($link, 'DEALLOCATE PREPARE mystmt'); + if (mysqli_query($link, 'PREPARE mystmt FROM "DESCRIBE test id"')) { + mysqli_query($link, 'DEALLOCATE PREPARE mystmt'); - if (!$stmt->prepare('DESCRIBE test id') || - !$stmt->execute()) - printf("[006] [%d] %s\n", $stmt->errno, $stmt->error); + if (!$stmt->prepare('DESCRIBE test id') || + !$stmt->execute()) + printf("[006] [%d] %s\n", $stmt->errno, $stmt->error); - if (!$res = $stmt->get_result()) - printf("[007] [%d] %s\n", $stmt->errno, $stmt->error); + if (!$res = $stmt->get_result()) + printf("[007] [%d] %s\n", $stmt->errno, $stmt->error); - $description = mysqli_fetch_assoc($res); - if ($description['Field'] != 'id') { - printf("[008] Returned data seems wrong, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - var_dump($description); - } - mysqli_free_result($res); - } + $description = mysqli_fetch_assoc($res); + if ($description['Field'] != 'id') { + printf("[008] Returned data seems wrong, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + var_dump($description); + } + mysqli_free_result($res); + } - if (mysqli_query($link, 'PREPARE mystmt FROM "EXPLAIN SELECT id FROM test"')) { - mysqli_query($link, 'DEALLOCATE PREPARE mystmt'); + if (mysqli_query($link, 'PREPARE mystmt FROM "EXPLAIN SELECT id FROM test"')) { + mysqli_query($link, 'DEALLOCATE PREPARE mystmt'); - if (!$stmt->prepare('EXPLAIN SELECT id FROM test') || - !$stmt->execute()) - printf("[009] [%d] %s\n", $stmt->errno, $stmt->error); + if (!$stmt->prepare('EXPLAIN SELECT id FROM test') || + !$stmt->execute()) + printf("[009] [%d] %s\n", $stmt->errno, $stmt->error); - if (!$res = $stmt->get_result()) - printf("[010] [%d] %s\n", $stmt->errno, $stmt->error); + if (!$res = $stmt->get_result()) + printf("[010] [%d] %s\n", $stmt->errno, $stmt->error); - $tmp = mysqli_fetch_assoc($res); - if (empty($tmp)) - printf("[011] Empty EXPLAIN result set seems wrong, check manually, [%d] %s\n", - mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - } - mysqli_close($link); + $tmp = mysqli_fetch_assoc($res); + if (empty($tmp)) + printf("[011] Empty EXPLAIN result set seems wrong, check manually, [%d] %s\n", + mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($res); + } + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt index a7db91034b..68dad8b281 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt @@ -11,88 +11,88 @@ if (!function_exists('mysqli_stmt_get_result')) ?> --FILE-- <?php - require('table.inc'); - - if (!$stmt = mysqli_stmt_init($link)) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3")) - printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!mysqli_stmt_execute($stmt)) - printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { - printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n", - gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - - if (3 !== $res->num_rows) - printf("[005] Expecting 3 rows, got %s/%s rows\n", gettype($res->num_rows), $res->num_rows); - - if (2 !== $res->field_count) - printf("[006] Expecting 2 fields, got %s/%s rows\n", gettype($res->field_count), $res->field_count); - - if (0 !== $res->current_field) - printf("[006] Expecting offset 0, got %s/%s rows\n", gettype($res->current_field), $res->current_field); - - for ($i = 2; $i > 0; $i--) { - if (!$res->data_seek($i)) - printf("[007] Cannot seek to position %d, [%d] %s\n", - $i, mysqli_stmt_errno($stmt), $stmt->error); - $row = $res->fetch_array(MYSQLI_BOTH); - if (($row[0] !== $row['id']) || ($row[0] !== $i + 1)) { - printf("[008] Record looks wrong, dumping data\n"); - var_dump($row); - } else { - unset($row[0]); - unset($row['id']); - } - if ($row[1] !== $row['label']) { - printf("[009] Record looks wrong, dumping data\n"); - var_dump($row); - } else { - unset($row[1]); - unset($row['label']); - } - if (!empty($row)) { - printf("[010] Not empty, dumping unexpected data\n"); - var_dump($row); - } - } - - if (false !== ($tmp = $res->data_seek(-1))) - printf("[011] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); - - if (false !== ($tmp = $res->data_seek($res->num_rows + 1))) - printf("[012] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); - - for ($i = 0; $i < 100; $i++) { - /* intentionally out of range! */ - $pos = mt_rand(-1, 4); - $tmp = mysqli_data_seek($res, $pos); - if (($pos >= 0 && $pos < 3)) { - if (true !== $tmp) - printf("[015] Expecting boolan/true got %s/%s\n", gettype($tmp), $tmp); - $row = $res->fetch_array(MYSQLI_NUM); - if ($row[0] !== $pos + 1) - printf("[016] Expecting id = %d for pos %d got %s/%s\n", - $pos + 1, $pos, gettype($row[0]), $row[0]); - } else { - if (false !== $tmp) - printf("[014] Expecting boolan/false got %s/%s\n", gettype($tmp), $tmp); - } - } - - mysqli_stmt_close($stmt); - - if (true !== ($tmp = mysqli_data_seek($res, 0))) - printf("[015] Expecting boolan/true got %s/%s\n", gettype($tmp), $tmp); - - if (!is_array($row = $res->fetch_array(MYSQLI_NUM))) - printf("[016] Expecting array got %s/%s\n", gettype($tmp), $tmp); - - mysqli_free_result($res); + require('table.inc'); + + if (!$stmt = mysqli_stmt_init($link)) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3")) + printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) { + printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n", + gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + + if (3 !== $res->num_rows) + printf("[005] Expecting 3 rows, got %s/%s rows\n", gettype($res->num_rows), $res->num_rows); + + if (2 !== $res->field_count) + printf("[006] Expecting 2 fields, got %s/%s rows\n", gettype($res->field_count), $res->field_count); + + if (0 !== $res->current_field) + printf("[006] Expecting offset 0, got %s/%s rows\n", gettype($res->current_field), $res->current_field); + + for ($i = 2; $i > 0; $i--) { + if (!$res->data_seek($i)) + printf("[007] Cannot seek to position %d, [%d] %s\n", + $i, mysqli_stmt_errno($stmt), $stmt->error); + $row = $res->fetch_array(MYSQLI_BOTH); + if (($row[0] !== $row['id']) || ($row[0] !== $i + 1)) { + printf("[008] Record looks wrong, dumping data\n"); + var_dump($row); + } else { + unset($row[0]); + unset($row['id']); + } + if ($row[1] !== $row['label']) { + printf("[009] Record looks wrong, dumping data\n"); + var_dump($row); + } else { + unset($row[1]); + unset($row['label']); + } + if (!empty($row)) { + printf("[010] Not empty, dumping unexpected data\n"); + var_dump($row); + } + } + + if (false !== ($tmp = $res->data_seek(-1))) + printf("[011] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); + + if (false !== ($tmp = $res->data_seek($res->num_rows + 1))) + printf("[012] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); + + for ($i = 0; $i < 100; $i++) { + /* intentionally out of range! */ + $pos = mt_rand(-1, 4); + $tmp = mysqli_data_seek($res, $pos); + if (($pos >= 0 && $pos < 3)) { + if (true !== $tmp) + printf("[015] Expecting boolan/true got %s/%s\n", gettype($tmp), $tmp); + $row = $res->fetch_array(MYSQLI_NUM); + if ($row[0] !== $pos + 1) + printf("[016] Expecting id = %d for pos %d got %s/%s\n", + $pos + 1, $pos, gettype($row[0]), $row[0]); + } else { + if (false !== $tmp) + printf("[014] Expecting boolan/false got %s/%s\n", gettype($tmp), $tmp); + } + } + + mysqli_stmt_close($stmt); + + if (true !== ($tmp = mysqli_data_seek($res, 0))) + printf("[015] Expecting boolan/true got %s/%s\n", gettype($tmp), $tmp); + + if (!is_array($row = $res->fetch_array(MYSQLI_NUM))) + printf("[016] Expecting array got %s/%s\n", gettype($tmp), $tmp); + + mysqli_free_result($res); try { mysqli_data_seek($res, 0); @@ -106,7 +106,7 @@ if (!function_exists('mysqli_stmt_get_result')) echo $exception->getMessage() . "\n"; } - mysqli_close($link); + mysqli_close($link); try { mysqli_data_seek($res, 0); @@ -120,7 +120,7 @@ if (!function_exists('mysqli_stmt_get_result')) echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt index 7d21558593..30b49df4e5 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt @@ -11,243 +11,243 @@ mysqli_stmt_get_result - data types ?> --FILE-- <?php - require('connect.inc'); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - - function func_mysqli_stmt_get_result($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $type_hint = null) { - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { - // don't bail - column type might not be supported by the server, ignore this - return false; - } - - if (!$stmt = mysqli_stmt_init($link)) { - printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) { - printf("[%04d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - $id = null; - if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) { - printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - - for ($id = 1; $id < 4; $id++) { - if (!mysqli_stmt_execute($stmt)) { - printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - } - mysqli_stmt_close($stmt); - - $stmt = mysqli_stmt_init($link); - - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) { - printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - - if (!mysqli_stmt_execute($stmt)) { - printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - - $result = mysqli_stmt_result_metadata($stmt); - - if (!$res = mysqli_stmt_get_result($stmt)) { - printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); - return false; - } - $num = 0; - $fields = mysqli_fetch_fields($result); - - while ($row = mysqli_fetch_assoc($res)) { - $bind_res = &$row['label']; - if (!gettype($bind_res) == 'unicode') { - if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) { - printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n", - $offset + 10, $num, - gettype($bind_value), $bind_value, $type_hint, - gettype($bind_res), $bind_res); - mysqli_free_result($res); - mysqli_stmt_close($stmt); - return false; - } - } - $num++; - } - - if ($num != 3) { - printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n", - $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num); - mysqli_free_result($res); - mysqli_stmt_close($stmt); - return false; - } - - mysqli_free_result($res); - mysqli_stmt_close($stmt); - return true; - } - - - function func_mysqli_stmt_bind_make_string($len) { - - $ret = ''; - for ($i = 0; $i < $len; $i++) - $ret .= chr(mt_rand(65, 90)); - - return $ret; - } - - func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT", -11, 20); - func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT", NULL, 40); - func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT UNSIGNED", 1, 60); - func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT UNSIGNED", NULL, 80); - - func_mysqli_stmt_get_result($link, $engine, "i", "BOOL", 1, 100); - func_mysqli_stmt_get_result($link, $engine, "i", "BOOL", NULL, 120); - func_mysqli_stmt_get_result($link, $engine, "i", "BOOLEAN", 0, 140); - func_mysqli_stmt_get_result($link, $engine, "i", "BOOLEAN", NULL, 160); - - func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", -32768, 180); - func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", 32767, 200); - func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", NULL, 220); - func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 240); - func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 260); - - func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", -8388608, 280, "integer"); - func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", 8388607, 300, "integer"); - func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", NULL, 320); - func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT UNSIGNED", 16777215, 340, "integer"); - func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT UNSIGNED", NULL, 360); - - func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? max(-1 * PHP_INT_MAX + 1, -2147483648) : 1, 380); - func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", -2147483647, 400, "integer"); - func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? min(2147483647, PHP_INT_MAX) : 1, 420); - func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", NULL, 440); - func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, 2147483647) : 1, 460); - func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", 4294967295, 480, (defined("PHP_INT_MAX") && (4294967295 > PHP_INT_MAX)) ? "string" : null); - func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", NULL, 500); - - /* test is broken too: we bind "integer" but value is a float - func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -9223372036854775808, 520); - func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", 18446744073709551615, 560); - */ - func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", NULL, 540); - func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", NULL, 580); - func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -1, 1780); - func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", 1, 1800); - func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820); - func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840); - func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860); - func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880); - - func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600); - func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", NULL, 620); - func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640); - func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660); - - // Yes, we need the temporary variable. The PHP casting will fouls us otherwise. - $tmp = strval('-99999999.99'); - func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string"); - func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700); - $tmp = strval('99999999.99'); - func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string"); - func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740); - $tmp = strval('-99999999.99'); - func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string"); - func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780); - $tmp = strval('99999999.99'); - func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string"); - func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820); - - // don't care about date() strict TZ warnings... - func_mysqli_stmt_get_result($link, $engine, "s", "DATE", @date('Y-m-d'), 840); - func_mysqli_stmt_get_result($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 860); - func_mysqli_stmt_get_result($link, $engine, "s", "DATE", NULL, 880); - - func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 900); - func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 920); - func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME", NULL, 940); - - func_mysqli_stmt_get_result($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 960); - - func_mysqli_stmt_get_result($link, $engine, "s", "TIME", @date('H:i:s'), 980); - func_mysqli_stmt_get_result($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 1000); - func_mysqli_stmt_get_result($link, $engine, "s", "TIME", NULL, 1020); - - $tmp = intval(@date('Y')); - func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer"); - func_mysqli_stmt_get_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer"); - func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", NULL, 1080); - - $string255 = func_mysqli_stmt_bind_make_string(255); - func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1)", "a", 1110, 'string'); - func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(255)", $string255, 1120, 'string'); - func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1) NOT NULL", "a", 1140, 'string'); - func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1)", NULL, 1160); - - $string65k = func_mysqli_stmt_bind_make_string(65535); - func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1)", "a", 1180, 'string'); - func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(255)", $string255, 1200, 'string'); - func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(65635)", $string65k, 1220, 'string'); - func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 1240, 'string'); - func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1)", NULL, 1260); - - func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", "a", 1280); - func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", chr(0), 1300); - func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1) NOT NULL", "b", 1320); - func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", NULL, 1340); - - func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", "a", 1360); - func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", chr(0), 1380); - func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 1400); - func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", NULL, 1420); - - func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", "a", 1440); - func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", chr(0), 1460); - func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB NOT NULL", "b", 1480); - func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", NULL, 1500); - - func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT", "a", 1520, 'string'); - func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT NOT NULL", "a", 1540, 'string'); - func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT", NULL, 1560, 'string'); - - // Note: you cannot insert any blob values this way. But you can check the API at least partly this way - // Extra BLOB tests are in mysqli_stmt_send_long() - func_mysqli_stmt_get_result($link, $engine, "b", "BLOB", "", 1580); - func_mysqli_stmt_get_result($link, $engine, "b", "TEXT", "", 1600, 'string'); - func_mysqli_stmt_get_result($link, $engine, "b", "MEDIUMBLOB", "", 1620); - func_mysqli_stmt_get_result($link, $engine, "b", "MEDIUMTEXT", "", 1640, 'string'); - - /* Is this one related? http://bugs.php.net/bug.php?id=35759 */ - func_mysqli_stmt_get_result($link, $engine, "b", "LONGBLOB", "", 1660); - func_mysqli_stmt_get_result($link, $engine, "b", "LONGTEXT", "", 1680, 'string'); - - func_mysqli_stmt_get_result($link, $engine, "s", "ENUM('a', 'b')", "a", 1700, 'string'); - func_mysqli_stmt_get_result($link, $engine, "s", "ENUM('a', 'b')", NULL, 1720, 'string'); - func_mysqli_stmt_get_result($link, $engine, "s", "SET('a', 'b')", "a", 1740, 'string'); - func_mysqli_stmt_get_result($link, $engine, "s", "SET('a', 'b')", NULL, 1760, 'string'); - - mysqli_close($link); - print "done!"; + require('connect.inc'); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + + function func_mysqli_stmt_get_result($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $type_hint = null) { + + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { + printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { + // don't bail - column type might not be supported by the server, ignore this + return false; + } + + if (!$stmt = mysqli_stmt_init($link)) { + printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) { + printf("[%04d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + $id = null; + if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) { + printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + + for ($id = 1; $id < 4; $id++) { + if (!mysqli_stmt_execute($stmt)) { + printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + } + mysqli_stmt_close($stmt); + + $stmt = mysqli_stmt_init($link); + + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) { + printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + + if (!mysqli_stmt_execute($stmt)) { + printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + + $result = mysqli_stmt_result_metadata($stmt); + + if (!$res = mysqli_stmt_get_result($stmt)) { + printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); + return false; + } + $num = 0; + $fields = mysqli_fetch_fields($result); + + while ($row = mysqli_fetch_assoc($res)) { + $bind_res = &$row['label']; + if (!gettype($bind_res) == 'unicode') { + if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) { + printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n", + $offset + 10, $num, + gettype($bind_value), $bind_value, $type_hint, + gettype($bind_res), $bind_res); + mysqli_free_result($res); + mysqli_stmt_close($stmt); + return false; + } + } + $num++; + } + + if ($num != 3) { + printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n", + $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num); + mysqli_free_result($res); + mysqli_stmt_close($stmt); + return false; + } + + mysqli_free_result($res); + mysqli_stmt_close($stmt); + return true; + } + + + function func_mysqli_stmt_bind_make_string($len) { + + $ret = ''; + for ($i = 0; $i < $len; $i++) + $ret .= chr(mt_rand(65, 90)); + + return $ret; + } + + func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT", -11, 20); + func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT", NULL, 40); + func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT UNSIGNED", 1, 60); + func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT UNSIGNED", NULL, 80); + + func_mysqli_stmt_get_result($link, $engine, "i", "BOOL", 1, 100); + func_mysqli_stmt_get_result($link, $engine, "i", "BOOL", NULL, 120); + func_mysqli_stmt_get_result($link, $engine, "i", "BOOLEAN", 0, 140); + func_mysqli_stmt_get_result($link, $engine, "i", "BOOLEAN", NULL, 160); + + func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", -32768, 180); + func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", 32767, 200); + func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", NULL, 220); + func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 240); + func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 260); + + func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", -8388608, 280, "integer"); + func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", 8388607, 300, "integer"); + func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", NULL, 320); + func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT UNSIGNED", 16777215, 340, "integer"); + func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT UNSIGNED", NULL, 360); + + func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? max(-1 * PHP_INT_MAX + 1, -2147483648) : 1, 380); + func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", -2147483647, 400, "integer"); + func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? min(2147483647, PHP_INT_MAX) : 1, 420); + func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", NULL, 440); + func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, 2147483647) : 1, 460); + func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", 4294967295, 480, (defined("PHP_INT_MAX") && (4294967295 > PHP_INT_MAX)) ? "string" : null); + func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", NULL, 500); + + /* test is broken too: we bind "integer" but value is a float + func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -9223372036854775808, 520); + func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", 18446744073709551615, 560); + */ + func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", NULL, 540); + func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", NULL, 580); + func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -1, 1780); + func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", 1, 1800); + func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820); + func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840); + func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860); + func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880); + + func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600); + func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", NULL, 620); + func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640); + func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660); + + // Yes, we need the temporary variable. The PHP casting will fouls us otherwise. + $tmp = strval('-99999999.99'); + func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string"); + func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700); + $tmp = strval('99999999.99'); + func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string"); + func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740); + $tmp = strval('-99999999.99'); + func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string"); + func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780); + $tmp = strval('99999999.99'); + func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string"); + func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820); + + // don't care about date() strict TZ warnings... + func_mysqli_stmt_get_result($link, $engine, "s", "DATE", @date('Y-m-d'), 840); + func_mysqli_stmt_get_result($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 860); + func_mysqli_stmt_get_result($link, $engine, "s", "DATE", NULL, 880); + + func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 900); + func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 920); + func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME", NULL, 940); + + func_mysqli_stmt_get_result($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 960); + + func_mysqli_stmt_get_result($link, $engine, "s", "TIME", @date('H:i:s'), 980); + func_mysqli_stmt_get_result($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 1000); + func_mysqli_stmt_get_result($link, $engine, "s", "TIME", NULL, 1020); + + $tmp = intval(@date('Y')); + func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer"); + func_mysqli_stmt_get_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer"); + func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", NULL, 1080); + + $string255 = func_mysqli_stmt_bind_make_string(255); + func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1)", "a", 1110, 'string'); + func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(255)", $string255, 1120, 'string'); + func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1) NOT NULL", "a", 1140, 'string'); + func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1)", NULL, 1160); + + $string65k = func_mysqli_stmt_bind_make_string(65535); + func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1)", "a", 1180, 'string'); + func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(255)", $string255, 1200, 'string'); + func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(65635)", $string65k, 1220, 'string'); + func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 1240, 'string'); + func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1)", NULL, 1260); + + func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", "a", 1280); + func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", chr(0), 1300); + func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1) NOT NULL", "b", 1320); + func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", NULL, 1340); + + func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", "a", 1360); + func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", chr(0), 1380); + func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 1400); + func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", NULL, 1420); + + func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", "a", 1440); + func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", chr(0), 1460); + func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB NOT NULL", "b", 1480); + func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", NULL, 1500); + + func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT", "a", 1520, 'string'); + func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT NOT NULL", "a", 1540, 'string'); + func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT", NULL, 1560, 'string'); + + // Note: you cannot insert any blob values this way. But you can check the API at least partly this way + // Extra BLOB tests are in mysqli_stmt_send_long() + func_mysqli_stmt_get_result($link, $engine, "b", "BLOB", "", 1580); + func_mysqli_stmt_get_result($link, $engine, "b", "TEXT", "", 1600, 'string'); + func_mysqli_stmt_get_result($link, $engine, "b", "MEDIUMBLOB", "", 1620); + func_mysqli_stmt_get_result($link, $engine, "b", "MEDIUMTEXT", "", 1640, 'string'); + + /* Is this one related? http://bugs.php.net/bug.php?id=35759 */ + func_mysqli_stmt_get_result($link, $engine, "b", "LONGBLOB", "", 1660); + func_mysqli_stmt_get_result($link, $engine, "b", "LONGTEXT", "", 1680, 'string'); + + func_mysqli_stmt_get_result($link, $engine, "s", "ENUM('a', 'b')", "a", 1700, 'string'); + func_mysqli_stmt_get_result($link, $engine, "s", "ENUM('a', 'b')", NULL, 1720, 'string'); + func_mysqli_stmt_get_result($link, $engine, "s", "SET('a', 'b')", "a", 1740, 'string'); + func_mysqli_stmt_get_result($link, $engine, "s", "SET('a', 'b')", NULL, 1760, 'string'); + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt b/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt index 83f6159540..c37c45af7d 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt @@ -24,67 +24,67 @@ mysqli_query($link, "DROP TABLE IF EXISTS test"); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - try { + try { mysqli_stmt_get_warnings($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "SET sql_mode=''") || !mysqli_stmt_execute($stmt)) - printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SET sql_mode=''") || !mysqli_stmt_execute($stmt)) + printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test") || !mysqli_stmt_execute($stmt)) - printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test") || !mysqli_stmt_execute($stmt)) + printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (false !== ($tmp = mysqli_stmt_get_warnings($stmt))) - printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_stmt_get_warnings($stmt))) + printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_prepare($stmt, "CREATE TABLE test(id SMALLINT, label CHAR(1))") || !mysqli_stmt_execute($stmt)) - printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "CREATE TABLE test(id SMALLINT, label CHAR(1))") || !mysqli_stmt_execute($stmt)) + printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (false !== ($tmp = mysqli_stmt_get_warnings($stmt))) - printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_stmt_get_warnings($stmt))) + printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100000, 'a'), (100001, 'b')") || - !mysqli_stmt_execute($stmt)) - printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100000, 'a'), (100001, 'b')") || + !mysqli_stmt_execute($stmt)) + printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!is_object($warning = mysqli_stmt_get_warnings($stmt))) - printf("[011] Expecting mysqli_warning object, got %s/%s\n", gettype($warning), $warning); + if (!is_object($warning = mysqli_stmt_get_warnings($stmt))) + printf("[011] Expecting mysqli_warning object, got %s/%s\n", gettype($warning), $warning); - if ('mysqli_warning' !== get_class($warning)) - printf("[012] Expecting object of type mysqli_warning got type '%s'", get_class($warning)); + if ('mysqli_warning' !== get_class($warning)) + printf("[012] Expecting object of type mysqli_warning got type '%s'", get_class($warning)); - if (!method_exists($warning, 'next')) - printf("[013] Object mysqli_warning seems to lack method next()\n"); + if (!method_exists($warning, 'next')) + printf("[013] Object mysqli_warning seems to lack method next()\n"); - $i = 0; - do { + $i = 0; + do { - if ('' == $warning->message) - printf("[014 - %d] Message should not be empty\n", $i); + if ('' == $warning->message) + printf("[014 - %d] Message should not be empty\n", $i); - if ('' == $warning->sqlstate) - printf("[015 - %d] SQL State should not be empty\n", $i); + if ('' == $warning->sqlstate) + printf("[015 - %d] SQL State should not be empty\n", $i); - if (0 == $warning->errno) - printf("[016 - %d] Error number should not be zero\n", $i); + if (0 == $warning->errno) + printf("[016 - %d] Error number should not be zero\n", $i); - $i++; + $i++; - } while ($warning->next()); + } while ($warning->next()); - if (2 != $i) - printf("[017] Expected 2 warnings, got %d warnings\n", $i); + if (2 != $i) + printf("[017] Expected 2 warnings, got %d warnings\n", $i); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); try { mysqli_stmt_get_warnings($stmt); @@ -92,8 +92,8 @@ mysqli_query($link, "DROP TABLE IF EXISTS test"); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_init.phpt b/ext/mysqli/tests/mysqli_stmt_init.phpt index 2a692c4000..e68b405acc 100644 --- a/ext/mysqli/tests/mysqli_stmt_init.phpt +++ b/ext/mysqli/tests/mysqli_stmt_init.phpt @@ -8,28 +8,28 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - /* - NOTE: no datatype tests here! This is done by - mysqli_stmt_bind_result.phpt already. Restrict - this test case to the basics. - */ - require_once("connect.inc"); + /* + NOTE: no datatype tests here! This is done by + mysqli_stmt_bind_result.phpt already. Restrict + this test case to the basics. + */ + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!is_object($stmt = mysqli_stmt_init($link))) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!is_object($stmt = mysqli_stmt_init($link))) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_object($stmt2 = @mysqli_stmt_init($link))) - printf("[003a] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!is_object($stmt2 = @mysqli_stmt_init($link))) + printf("[003a] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - try { + try { mysqli_stmt_close($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - mysqli_close($link); + mysqli_close($link); try { mysqli_stmt_init($link); @@ -37,7 +37,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_insert_id.phpt b/ext/mysqli/tests/mysqli_stmt_insert_id.phpt index e2f8ad1cb2..fe5e794e57 100644 --- a/ext/mysqli/tests/mysqli_stmt_insert_id.phpt +++ b/ext/mysqli/tests/mysqli_stmt_insert_id.phpt @@ -8,11 +8,11 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - $stmt = mysqli_stmt_init($link); + $stmt = mysqli_stmt_init($link); try { mysqli_stmt_insert_id($stmt); @@ -20,50 +20,50 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1") || - !mysqli_stmt_execute($stmt)) { - printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1") || + !mysqli_stmt_execute($stmt)) { + printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } - if (0 !== ($tmp = mysqli_stmt_insert_id($stmt))) - printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); + if (0 !== ($tmp = mysqli_stmt_insert_id($stmt))) + printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + mysqli_stmt_close($stmt); - // no auto_increment column - $stmt = mysqli_stmt_init($link); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'a')") || - !mysqli_stmt_execute($stmt)) { - printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } + // no auto_increment column + $stmt = mysqli_stmt_init($link); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'a')") || + !mysqli_stmt_execute($stmt)) { + printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } - if (0 !== ($tmp = mysqli_stmt_insert_id($stmt))) - printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = mysqli_stmt_insert_id($stmt))) + printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (mysqli_get_server_version($link) > 50000 && - (!mysqli_stmt_prepare($stmt, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT") || - !mysqli_stmt_execute($stmt))) { - printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } else if (mysqli_get_server_version($link) < 50000){ - mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT"); - } + if (mysqli_get_server_version($link) > 50000 && + (!mysqli_stmt_prepare($stmt, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT") || + !mysqli_stmt_execute($stmt))) { + printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } else if (mysqli_get_server_version($link) < 50000){ + mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT"); + } - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(label) VALUES ('a')") || - !mysqli_stmt_execute($stmt)) { - printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - if (0 === ($tmp = mysqli_stmt_insert_id($stmt))) - printf("[010] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(label) VALUES ('a')") || + !mysqli_stmt_execute($stmt)) { + printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + if (0 === ($tmp = mysqli_stmt_insert_id($stmt))) + printf("[010] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp); + mysqli_stmt_close($stmt); - mysqli_close($link); + mysqli_close($link); - try { + try { mysqli_stmt_insert_id($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_multires.phpt b/ext/mysqli/tests/mysqli_stmt_multires.phpt index 23a8ad27a8..abb9ecbfb2 100644 --- a/ext/mysqli/tests/mysqli_stmt_multires.phpt +++ b/ext/mysqli/tests/mysqli_stmt_multires.phpt @@ -11,86 +11,86 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - require('table.inc'); - - $stmt = mysqli_stmt_init($link); - if (!$link->query('DROP PROCEDURE IF EXISTS p123')) { - printf("[001] [%d] %s\n", $link->error, $link->errno); - } - - if (!$link->query("CREATE PROCEDURE p123() BEGIN SELECT id+12, CONCAT_WS('-',label,'ahoi') FROM test ORDER BY id LIMIT 1; SELECT id + 42, CONCAT_WS('---',label, label) FROM test ORDER BY id LIMIT 1; END")) { - printf("[002] [%d] %s\n", $link->error, $link->errno); - } - - if (!($stmt = $link->prepare("CALL p123"))) { - printf("[003] [%d] %s\n", $stmt->error, $stmt->errno); - } - - if (!$stmt->execute()) { - printf("[005] [%d] %s\n", $stmt->error, $stmt->errno); - } - - $c_id = NULL; - $c_label = NULL; - if (!$stmt->bind_result($c_id, $c_label)) { - printf("[004] [%d] %s\n", $stmt->error, $stmt->errno); - } - var_dump("pre:",$c_id, $c_label); - - if (!$stmt->fetch()) { - printf("[006] [%d] %s\n", $stmt->error, $stmt->errno); - } - - var_dump("post:",$c_id, $c_label); - - if ($stmt->fetch()) { - printf("[007] Shouldn't have fetched anything\n"); - var_dump($c_id, $c_label); - } - - if ($stmt->fetch()) { - printf("[008] No more rows expected\n"); - } - - if (!$stmt->more_results()) { - printf("[009] Expected more results\n"); - } else { - var_dump("[009] next_result:", $stmt->next_result()); - } - - if (!$stmt->bind_result($c_id, $c_label)) { - printf("[010] [%d] %s\n", $stmt->error, $stmt->errno); - } - var_dump("pre:",$c_id, $c_label); - - if (!$stmt->fetch()) { - printf("[011] [%d] %s\n", $stmt->error, $stmt->errno); - } - - var_dump("post:",$c_id, $c_label); - - if ($stmt->fetch()) { - printf("[012] No more rows expected\n"); - } - - if (!$stmt->more_results()) { - printf("[013] Expected more results\n"); - } else { - var_dump("[013] next_result:", $stmt->next_result()); - } - - if ($stmt->more_results()) { - printf("[014] No more results expected\n"); - } else { - printf("[014] No result, as expected\n"); - } - - $stmt->close(); - $link->close(); - - - echo "done"; + require_once("connect.inc"); + require('table.inc'); + + $stmt = mysqli_stmt_init($link); + if (!$link->query('DROP PROCEDURE IF EXISTS p123')) { + printf("[001] [%d] %s\n", $link->error, $link->errno); + } + + if (!$link->query("CREATE PROCEDURE p123() BEGIN SELECT id+12, CONCAT_WS('-',label,'ahoi') FROM test ORDER BY id LIMIT 1; SELECT id + 42, CONCAT_WS('---',label, label) FROM test ORDER BY id LIMIT 1; END")) { + printf("[002] [%d] %s\n", $link->error, $link->errno); + } + + if (!($stmt = $link->prepare("CALL p123"))) { + printf("[003] [%d] %s\n", $stmt->error, $stmt->errno); + } + + if (!$stmt->execute()) { + printf("[005] [%d] %s\n", $stmt->error, $stmt->errno); + } + + $c_id = NULL; + $c_label = NULL; + if (!$stmt->bind_result($c_id, $c_label)) { + printf("[004] [%d] %s\n", $stmt->error, $stmt->errno); + } + var_dump("pre:",$c_id, $c_label); + + if (!$stmt->fetch()) { + printf("[006] [%d] %s\n", $stmt->error, $stmt->errno); + } + + var_dump("post:",$c_id, $c_label); + + if ($stmt->fetch()) { + printf("[007] Shouldn't have fetched anything\n"); + var_dump($c_id, $c_label); + } + + if ($stmt->fetch()) { + printf("[008] No more rows expected\n"); + } + + if (!$stmt->more_results()) { + printf("[009] Expected more results\n"); + } else { + var_dump("[009] next_result:", $stmt->next_result()); + } + + if (!$stmt->bind_result($c_id, $c_label)) { + printf("[010] [%d] %s\n", $stmt->error, $stmt->errno); + } + var_dump("pre:",$c_id, $c_label); + + if (!$stmt->fetch()) { + printf("[011] [%d] %s\n", $stmt->error, $stmt->errno); + } + + var_dump("post:",$c_id, $c_label); + + if ($stmt->fetch()) { + printf("[012] No more rows expected\n"); + } + + if (!$stmt->more_results()) { + printf("[013] Expected more results\n"); + } else { + var_dump("[013] next_result:", $stmt->next_result()); + } + + if ($stmt->more_results()) { + printf("[014] No more results expected\n"); + } else { + printf("[014] No result, as expected\n"); + } + + $stmt->close(); + $link->close(); + + + echo "done"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt index 22f707a105..33d9dfe552 100644 --- a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt +++ b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt @@ -8,89 +8,89 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - require('table.inc'); - - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - function func_test_mysqli_stmt_num_rows($stmt, $query, $expected, $offset) { - - if (!mysqli_stmt_prepare($stmt, $query)) { - printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!mysqli_stmt_execute($stmt)) { - printf("[%03d] [%d] %s\n", $offset + 1, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!mysqli_stmt_store_result($stmt)) { - printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if ($expected !== ($tmp = mysqli_stmt_num_rows($stmt))) - printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3, - gettype($expected), $expected, - gettype($tmp), $tmp); - - mysqli_stmt_free_result($stmt); - - return true; - } - - func_test_mysqli_stmt_num_rows($stmt, "SELECT 1 AS a", 1, 10); - func_test_mysqli_stmt_num_rows($stmt, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 20); - // Note: for statements that return no result set mysqli_num_rows() differs from mysqli_stmt_num_rows() slightly - // mysqli_num_rows() failed to fetch the result set and the PHP parameter check makes it return NULL - // mysqli_stmt_numrows() has a valid resource to work on and it will return int/0 instead. No bug, but - // slightly different behaviour... - if you really check the data types and don't rely on casting like 98% of all PHP - // users do. - func_test_mysqli_stmt_num_rows($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')", 0, 30); - - if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) { - $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); - func_test_mysqli_stmt_num_rows($stmt, "SELECT id, label FROM test", (int)$row['num'], 40); - } else { - printf("[050] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - - print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n"; - - if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test')) - printf("[051] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - - if (mysqli_stmt_execute($stmt)) { - - $i = 0; - do { - if (0 !== ($tmp = mysqli_stmt_num_rows($stmt))) - printf("[53 - %03d] Expecting int/0, got %s/%s\n", $i, gettype($tmp), $tmp); - $i++; - } while (mysqli_stmt_fetch($stmt)); - - /* NOTE to users - Behaviour with libmysql is UNDEFINED, see http://news.php.net/php.internals/55210 - Because it is undefined it is allowed to the mysqlnd DEVELOPER to implement - any behaviour they like, including the one checked for in this test. - What the test does is cover an implementation detail of the mysqlnd library. - This implementation detail may, at any time, change without prior notice. - On the contrary, the mysqlnd way is a reasonable one and, maybe, one fine - day, after Klingons visited earh, becomes the official one. Meanwhile do - not rely on it. - */ - if ($IS_MYSQLND && (7 !== ($tmp = mysqli_stmt_num_rows($stmt)))) - printf("[54] Expecting int/7, got %s/%s\n", gettype($tmp), $tmp); - - } else { - printf("[055] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - - mysqli_stmt_close($stmt); + require_once("connect.inc"); + + require('table.inc'); + + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + function func_test_mysqli_stmt_num_rows($stmt, $query, $expected, $offset) { + + if (!mysqli_stmt_prepare($stmt, $query)) { + printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!mysqli_stmt_execute($stmt)) { + printf("[%03d] [%d] %s\n", $offset + 1, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!mysqli_stmt_store_result($stmt)) { + printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if ($expected !== ($tmp = mysqli_stmt_num_rows($stmt))) + printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3, + gettype($expected), $expected, + gettype($tmp), $tmp); + + mysqli_stmt_free_result($stmt); + + return true; + } + + func_test_mysqli_stmt_num_rows($stmt, "SELECT 1 AS a", 1, 10); + func_test_mysqli_stmt_num_rows($stmt, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 20); + // Note: for statements that return no result set mysqli_num_rows() differs from mysqli_stmt_num_rows() slightly + // mysqli_num_rows() failed to fetch the result set and the PHP parameter check makes it return NULL + // mysqli_stmt_numrows() has a valid resource to work on and it will return int/0 instead. No bug, but + // slightly different behaviour... - if you really check the data types and don't rely on casting like 98% of all PHP + // users do. + func_test_mysqli_stmt_num_rows($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')", 0, 30); + + if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) { + $row = mysqli_fetch_assoc($res); + mysqli_free_result($res); + func_test_mysqli_stmt_num_rows($stmt, "SELECT id, label FROM test", (int)$row['num'], 40); + } else { + printf("[050] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + + print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n"; + + if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test')) + printf("[051] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (mysqli_stmt_execute($stmt)) { + + $i = 0; + do { + if (0 !== ($tmp = mysqli_stmt_num_rows($stmt))) + printf("[53 - %03d] Expecting int/0, got %s/%s\n", $i, gettype($tmp), $tmp); + $i++; + } while (mysqli_stmt_fetch($stmt)); + + /* NOTE to users + Behaviour with libmysql is UNDEFINED, see http://news.php.net/php.internals/55210 + Because it is undefined it is allowed to the mysqlnd DEVELOPER to implement + any behaviour they like, including the one checked for in this test. + What the test does is cover an implementation detail of the mysqlnd library. + This implementation detail may, at any time, change without prior notice. + On the contrary, the mysqlnd way is a reasonable one and, maybe, one fine + day, after Klingons visited earh, becomes the official one. Meanwhile do + not rely on it. + */ + if ($IS_MYSQLND && (7 !== ($tmp = mysqli_stmt_num_rows($stmt)))) + printf("[54] Expecting int/7, got %s/%s\n", gettype($tmp), $tmp); + + } else { + printf("[055] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + + mysqli_stmt_close($stmt); try { mysqli_stmt_num_rows($stmt); @@ -98,8 +98,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_param_count.phpt b/ext/mysqli/tests/mysqli_stmt_param_count.phpt index 5fa1b7c350..49e5517177 100644 --- a/ext/mysqli/tests/mysqli_stmt_param_count.phpt +++ b/ext/mysqli/tests/mysqli_stmt_param_count.phpt @@ -8,12 +8,12 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); try { mysqli_stmt_param_count($stmt); @@ -21,26 +21,26 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - function func_test_mysqli_stmt_param_count($stmt, $query, $expected, $offset) { + function func_test_mysqli_stmt_param_count($stmt, $query, $expected, $offset) { - if (!mysqli_stmt_prepare($stmt, $query)) { - printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_error($stmt)); - return false; - } + if (!mysqli_stmt_prepare($stmt, $query)) { + printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_error($stmt)); + return false; + } - if ($expected !== ($tmp = mysqli_stmt_param_count($stmt))) - printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3, - gettype($expected), $expected, - gettype($tmp), $tmp); - return true; - } + if ($expected !== ($tmp = mysqli_stmt_param_count($stmt))) + printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3, + gettype($expected), $expected, + gettype($tmp), $tmp); + return true; + } - func_test_mysqli_stmt_param_count($stmt, "SELECT 1 AS a", 0, 10); - func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id) VALUES (?)", 1, 20); - func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, ?)", 2, 30); - func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, '?')", 1, 40); + func_test_mysqli_stmt_param_count($stmt, "SELECT 1 AS a", 0, 10); + func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id) VALUES (?)", 1, 20); + func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, ?)", 2, 30); + func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, '?')", 1, 40); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); try { mysqli_stmt_param_count($stmt); @@ -48,9 +48,9 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_prepare.phpt b/ext/mysqli/tests/mysqli_stmt_prepare.phpt index be08d95749..0f89a705c9 100644 --- a/ext/mysqli/tests/mysqli_stmt_prepare.phpt +++ b/ext/mysqli/tests/mysqli_stmt_prepare.phpt @@ -8,26 +8,26 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - // Note: No SQL tests here! We can expand one of the *fetch() - // tests to a generic SQL test, if we ever need that. - // We would duplicate the SQL test cases if we have it here and in one of the - // fetch tests, because the fetch tests would have to call prepare/execute etc. - // anyway. + // Note: No SQL tests here! We can expand one of the *fetch() + // tests to a generic SQL test, if we ever need that. + // We would duplicate the SQL test cases if we have it here and in one of the + // fetch tests, because the fetch tests would have to call prepare/execute etc. + // anyway. - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_stmt_prepare($stmt, ''))) - printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_stmt_prepare($stmt, ''))) + printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))) - printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))) + printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); try { mysqli_stmt_prepare($stmt, "SELECT id FROM test"); @@ -35,8 +35,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_reset.phpt b/ext/mysqli/tests/mysqli_stmt_reset.phpt index 654f09c337..ac557b0c20 100644 --- a/ext/mysqli/tests/mysqli_stmt_reset.phpt +++ b/ext/mysqli/tests/mysqli_stmt_reset.phpt @@ -8,18 +8,18 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - // Note: No SQL tests here! We can expand one of the *fetch() - // tests to a generic SQL test, if we ever need that. - // We would duplicate the SQL test cases if we have it here and in one of the - // fetch tests, because the fetch tests would have to call prepare/execute etc. - // anyway. + // Note: No SQL tests here! We can expand one of the *fetch() + // tests to a generic SQL test, if we ever need that. + // We would duplicate the SQL test cases if we have it here and in one of the + // fetch tests, because the fetch tests would have to call prepare/execute etc. + // anyway. - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); try { mysqli_stmt_reset($stmt); @@ -27,65 +27,65 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))) - printf("[005] Expecting boolean/true, got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))) + printf("[005] Expecting boolean/true, got %s/%s, [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = mysqli_stmt_reset($stmt))) - printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_stmt_reset($stmt))) + printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (true !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = mysqli_stmt_execute($stmt))) + printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - $id = null; - if (!mysqli_stmt_bind_result($stmt, $id)) - printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = null; + if (!mysqli_stmt_bind_result($stmt, $id)) + printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_fetch($stmt)) - printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_fetch($stmt)) + printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - var_dump($id); - mysqli_stmt_close($stmt); - if (!$stmt = mysqli_stmt_init($link)) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($id); + mysqli_stmt_close($stmt); + if (!$stmt = mysqli_stmt_init($link)) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label BLOB, PRIMARY KEY(id))")) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label BLOB, PRIMARY KEY(id))")) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(label) VALUES (?)")) - printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(label) VALUES (?)")) + printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $label = null; - if (!mysqli_stmt_bind_param($stmt, "b", $label)) - printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $label = null; + if (!mysqli_stmt_bind_param($stmt, "b", $label)) + printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $label = 'abc'; - for ($i = 0; $i < 10; $i++) { - if (!mysqli_stmt_send_long_data($stmt, 0, $label)) - printf("[015 - %d] [%d] %s\n", $i, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } + $label = 'abc'; + for ($i = 0; $i < 10; $i++) { + if (!mysqli_stmt_send_long_data($stmt, 0, $label)) + printf("[015 - %d] [%d] %s\n", $i, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } - if (!mysqli_stmt_reset($stmt)) - printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_reset($stmt)) + printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_execute($stmt)) - printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_execute($stmt)) + printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$res = mysqli_query($link, "SELECT label FROM test")) - printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT label FROM test")) + printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if ($row['label'] != '') - printf("[020] Expecting empty string, got string/%s\n", $row['label']); + if ($row['label'] != '') + printf("[020] Expecting empty string, got string/%s\n", $row['label']); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); try { mysqli_stmt_reset($stmt); @@ -93,8 +93,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt index 12d240d8b9..aedcc5d9aa 100644 --- a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt +++ b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt @@ -8,12 +8,12 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); try { mysqli_stmt_result_metadata($stmt); @@ -21,69 +21,69 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) - printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) + printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!is_object(($res = mysqli_stmt_result_metadata($stmt)))) - printf("[006] Expecting object, got %s/%s\n", gettype($tmp), $tmp); + if (!is_object(($res = mysqli_stmt_result_metadata($stmt)))) + printf("[006] Expecting object, got %s/%s\n", gettype($tmp), $tmp); - if (2 !== ($tmp = mysqli_num_fields($res))) - printf("[007] Expecting int/2, got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + if (2 !== ($tmp = mysqli_num_fields($res))) + printf("[007] Expecting int/2, got %s/%s, [%d] %s\n", + gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - if (!is_object($field0_fetch = mysqli_fetch_field($res))) - printf("[008] Expecting object, got %s/%s, [%d] %s\n", - gettype($field0_fetch), $field0_fetch, mysqli_errno($link), mysqli_error($link)); + if (!is_object($field0_fetch = mysqli_fetch_field($res))) + printf("[008] Expecting object, got %s/%s, [%d] %s\n", + gettype($field0_fetch), $field0_fetch, mysqli_errno($link), mysqli_error($link)); - if (!is_object($field0_direct = mysqli_fetch_field_direct($res, 0))) - printf("[009] Expecting object, got %s/%s, [%d] %s\n", - gettype($field0_direct), $field0_direct, mysqli_errno($link), mysqli_error($link)); + if (!is_object($field0_direct = mysqli_fetch_field_direct($res, 0))) + printf("[009] Expecting object, got %s/%s, [%d] %s\n", + gettype($field0_direct), $field0_direct, mysqli_errno($link), mysqli_error($link)); - if ($field0_fetch != $field0_direct) { - printf("[010] mysqli_fetch_field() differs from mysqli_fetch_field_direct()\n"); - var_dump($field0_fetch); - var_dump($field0_direct); - } + if ($field0_fetch != $field0_direct) { + printf("[010] mysqli_fetch_field() differs from mysqli_fetch_field_direct()\n"); + var_dump($field0_fetch); + var_dump($field0_direct); + } - var_dump($field0_fetch); + var_dump($field0_fetch); - if (!is_array($tmp = mysqli_fetch_fields($res))) - printf("[011] Expecting array, got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + if (!is_array($tmp = mysqli_fetch_fields($res))) + printf("[011] Expecting array, got %s/%s, [%d] %s\n", + gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - if (empty($tmp[0]) || empty($tmp[1]) || $tmp[0] != $field0_direct) { - printf("[012] mysqli_fetch_fields() return value is suspicious\n"); - var_dump($tmp); - } + if (empty($tmp[0]) || empty($tmp[1]) || $tmp[0] != $field0_direct) { + printf("[012] mysqli_fetch_fields() return value is suspicious\n"); + var_dump($tmp); + } - if (!mysqli_field_seek($res, 1)) - printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_field_seek($res, 1)) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_object($field1_direct = mysqli_fetch_field_direct($res, 1))) - printf("[014] Expecting object, got %s/%s, [%d] %s\n", - gettype($field1_direct), $field1_direct, mysqli_errno($link), mysqli_error($link)); + if (!is_object($field1_direct = mysqli_fetch_field_direct($res, 1))) + printf("[014] Expecting object, got %s/%s, [%d] %s\n", + gettype($field1_direct), $field1_direct, mysqli_errno($link), mysqli_error($link)); - if ($tmp[1] != $field1_direct) { - printf("[015] mysqli_fetch_field_direct() differs from mysqli_fetch_fields()\n"); - var_dump($field1_direct); - var_dump($tmp); - } + if ($tmp[1] != $field1_direct) { + printf("[015] mysqli_fetch_field_direct() differs from mysqli_fetch_fields()\n"); + var_dump($field1_direct); + var_dump($tmp); + } - if (1 !== ($tmp = mysqli_field_tell($res))) - printf("[016] Expecting int/1, got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + if (1 !== ($tmp = mysqli_field_tell($res))) + printf("[016] Expecting int/1, got %s/%s, [%d] %s\n", + gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); - mysqli_stmt_close($stmt); + mysqli_free_result($res); + mysqli_stmt_close($stmt); - try { + try { mysqli_stmt_result_metadata($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt b/ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt index 5e5df14e4d..a07719b906 100644 --- a/ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt +++ b/ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt @@ -10,219 +10,219 @@ die("skip Check again when the Klingons visit earth - http://bugs.mysql.com/bug. ?> --FILE-- <?php - require('table.inc'); - - function testStatement($offset, $link, $sql, $expected_lib, $expected_mysqlnd, $check_mysqlnd, $compare) { - - if (!$stmt = mysqli_stmt_init($link)) { - printf("[%04d - %s] [%d] %s\n", - $offset, $sql, - mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!@mysqli_stmt_prepare($stmt, $sql)) { - /* Not all server versions will support all statements */ - /* Failing to prepare is OK */ - return true; - } - - if (empty($expected_lib) && (false !== $res)) { - printf("[%04d - %s] No metadata expected\n", - $offset + 1, $sql); - return false; - } else if (!empty($expected_lib) && (false == $res)) { - printf("[%04d - %s] Metadata expected\n", - $offset + 2, $sql); - return false; - } - if (!empty($expected_lib)) { - if (!is_object($res)) { - printf("[%04d - %s] [%d] %s\n", - $offset + 3, $sql, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - if (get_class($res) != 'mysqli_result') { - printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n", - $offset + 4, $sql, get_class($res)); - return false; - } - - $meta = array( - 'num_fields' => mysqli_num_fields($res), - 'fetch_field' => mysqli_fetch_field($res), - 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0), - 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1), - 'fetch_fields' => count(mysqli_fetch_fields($res)), - 'field_count' => $res->field_count, - 'field_seek-1' => @mysqli_field_seek($res, -1), - 'field_seek0' => mysqli_field_seek($res, 0), - 'field_tell' => mysqli_field_tell($res), - ); - if (is_object($meta['fetch_field'])) { - $meta['fetch_field']->charsetnr = 'ignore'; - $meta['fetch_field']->flags = 'ignore'; - } - if (is_object($meta['fetch_field_direct0'])) { - $meta['fetch_field_direct0']->charsetnr = 'ignore'; - $meta['fetch_field_direct0']->flags = 'ignore'; - } - if (is_object($meta['fetch_field_direct1'])) { - $meta['fetch_field_direct1']->charsetnr = 'ignore'; - $meta['fetch_field_direct1']->flags = 'ignore'; - } - mysqli_free_result($res); - - if ($meta != $expected_lib) { - printf("[%04d - %s] Metadata differs from expected values\n", - $offset + 5, $sql); - var_dump($meta); - var_dump($expected_lib); - return false; - } - } - - if (function_exists('mysqli_stmt_get_result')) { - /* mysqlnd only */ - if (!mysqli_stmt_execute($stmt)) { - printf("[%04d - %s] [%d] %s\n", - $offset + 6, $sql, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - $res = mysqli_stmt_get_result($stmt); - if (false === $res && !empty($expected_mysqlnd)) { - printf("[%04d - %s] Expecting resultset [%d] %s\n", - $offset + 7, $sql, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } else if (empty($expected_mysqlnd) && false !== $res) { - printf("[%04d - %s] Unexpected resultset [%d] %s\n", - $offset + 8, $sql, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - - if (!is_object($res)) { - printf("[%04d - %s] [%d] %s\n", - $offset + 9, $sql, - mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - return false; - } - if ('mysqli_result' != get_class($res)) { - printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n", - $offset + 10, $sql, - get_class($res)); - return false; - } - - $meta_res = array( - 'num_fields' => mysqli_num_fields($res), - 'fetch_field' => mysqli_fetch_field($res), - 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0), - 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1), - 'fetch_fields' => count(mysqli_fetch_fields($res)), - 'field_count' => mysqli_field_count($link), - 'field_seek-1' => @mysqli_field_seek($res, -1), - 'field_seek0' => mysqli_field_seek($res, 0), - 'field_tell' => mysqli_field_tell($res), - ); - if (is_object($meta_res['fetch_field'])) { - $meta_res['fetch_field']->charsetnr = 'ignore'; - $meta_res['fetch_field']->flags = 'ignore'; - } - if (is_object($meta_res['fetch_field_direct0'])) { - $meta_res['fetch_field_direct0']->charsetnr = 'ignore'; - $meta_res['fetch_field_direct0']->flags = 'ignore'; - } - if (is_object($meta_res['fetch_field_direct1'])) { - $meta_res['fetch_field_direct1']->charsetnr = 'ignore'; - $meta_res['fetch_field_direct1']->flags = 'ignore'; - } - mysqli_free_result($res); - if ($check_mysqlnd && $meta_res != $expected_mysqlnd) { - printf("[%04d - %s] Metadata differs from expected\n", - $offset + 11, $sql); - var_dump($meta_res); - var_dump($expected_mysqlnd); - } else { - if ($meta_res['field_count'] < 1) { - printf("[%04d - %s] Metadata seems wrong, no fields?\n", - $offset + 12, $sql); - var_dump($meta_res); - var_dump(mysqli_fetch_assoc($res)); - } - } - - if ($compare && $meta_res != $meta) { - printf("[%04d - %s] Metadata returned by mysqli_stmt_result_metadata() and mysqli_stmt_get_result() differ\n", - $offset + 13, $sql); - var_dump($meta_res); - var_dump($meta); - } - - } - - mysqli_stmt_close($stmt); - return true; - } - - /* Note: very weak testing, we accept almost any result */ - - testStatement(100, $link, 'ANALYZE TABLE test', array(), array(1), false, false); - testStatement(120, $link, 'OPTIMIZE TABLE test', array(), array(1), false, false); - testStatement(140, $link, 'REPAIR TABLE test', array(), array(1), false, false); - - testStatement(160, $link, 'SHOW AUTHORS', array(), array(1), false, false); - testStatement(180, $link, 'SHOW CHARACTER SET', array(), array(1), false, false); - testStatement(200, $link, 'SHOW COLLATION', array(), array(1), false, false); - testStatement(220, $link, 'SHOW CONTRIBUTORS', array(), array(1), false, false); - testStatement(240, $link, 'SHOW CREATE DATABASE ' . $db, array(), array(1), false, false); - testStatement(260, $link, 'SHOW DATABASES', array(), array(1), false, false); - testStatement(280, $link, 'SHOW ENGINE InnoDB STATUS', array(), array(1), false, false); - testStatement(300, $link, 'SHOW ENGINES', array(), array(1), false, false); - testStatement(320, $link, 'SHOW PLUGINS', array(), array(1), false, false); - testStatement(340, $link, 'SHOW PROCESSLIST', array(), array(1), false, false); - testStatement(360, $link, 'SHOW FULL PROCESSLIST', array(), array(1), false, false); - testStatement(380, $link, 'SHOW STATUS', array(), array(1), false, false); - testStatement(400, $link, 'SHOW TABLE STATUS', array(), array(1), false, false); - testStatement(420, $link, 'SHOW TABLE STATUS', array(), array(1), false, false); - testStatement(440, $link, 'SHOW TABLES', array(), array(1), false, false); - testStatement(460, $link, 'SHOW OPEN TABLES', array(), array(1), false, false); - testStatement(460, $link, 'SHOW VARIABLES', array(), array(1), false, false); - - $field0 = new stdClass(); - $field0->name = 'id'; - $field0->orgname = 'id'; - $field0->table = 'test'; - $field0->orgtable = 'test'; - $field0->def = ''; - $field0->max_length = 0; - $field0->length = 11; - $field0->charsetnr = 'ignore'; - $field0->flags = 'ignore'; - $field0->type = MYSQLI_TYPE_LONG; - $field0->decimals = 0; - $meta_lib = array( - 'num_fields' => 1, - 'fetch_field' => $field0, - 'fetch_field_direct0' => $field0, - 'fetch_field_direct1' => false, - 'fetch_fields' => 1, - 'field_count' => 1, - 'field_seek-1' => false, - 'field_seek0' => true, - 'field_tell' => 0, - ); - $meta_mysqlnd = $meta_lib; - testStatement(480, $link, 'SELECT id FROM test', $meta_lib, $meta_mysqlnd, true, true); - - testStatement(500, $link, 'CHECKSUM TABLE test', array(), array(1), false, false); - - mysqli_close($link); - print "done!"; + require('table.inc'); + + function testStatement($offset, $link, $sql, $expected_lib, $expected_mysqlnd, $check_mysqlnd, $compare) { + + if (!$stmt = mysqli_stmt_init($link)) { + printf("[%04d - %s] [%d] %s\n", + $offset, $sql, + mysqli_errno($link), mysqli_error($link)); + return false; + } + + if (!@mysqli_stmt_prepare($stmt, $sql)) { + /* Not all server versions will support all statements */ + /* Failing to prepare is OK */ + return true; + } + + if (empty($expected_lib) && (false !== $res)) { + printf("[%04d - %s] No metadata expected\n", + $offset + 1, $sql); + return false; + } else if (!empty($expected_lib) && (false == $res)) { + printf("[%04d - %s] Metadata expected\n", + $offset + 2, $sql); + return false; + } + if (!empty($expected_lib)) { + if (!is_object($res)) { + printf("[%04d - %s] [%d] %s\n", + $offset + 3, $sql, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + if (get_class($res) != 'mysqli_result') { + printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n", + $offset + 4, $sql, get_class($res)); + return false; + } + + $meta = array( + 'num_fields' => mysqli_num_fields($res), + 'fetch_field' => mysqli_fetch_field($res), + 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0), + 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1), + 'fetch_fields' => count(mysqli_fetch_fields($res)), + 'field_count' => $res->field_count, + 'field_seek-1' => @mysqli_field_seek($res, -1), + 'field_seek0' => mysqli_field_seek($res, 0), + 'field_tell' => mysqli_field_tell($res), + ); + if (is_object($meta['fetch_field'])) { + $meta['fetch_field']->charsetnr = 'ignore'; + $meta['fetch_field']->flags = 'ignore'; + } + if (is_object($meta['fetch_field_direct0'])) { + $meta['fetch_field_direct0']->charsetnr = 'ignore'; + $meta['fetch_field_direct0']->flags = 'ignore'; + } + if (is_object($meta['fetch_field_direct1'])) { + $meta['fetch_field_direct1']->charsetnr = 'ignore'; + $meta['fetch_field_direct1']->flags = 'ignore'; + } + mysqli_free_result($res); + + if ($meta != $expected_lib) { + printf("[%04d - %s] Metadata differs from expected values\n", + $offset + 5, $sql); + var_dump($meta); + var_dump($expected_lib); + return false; + } + } + + if (function_exists('mysqli_stmt_get_result')) { + /* mysqlnd only */ + if (!mysqli_stmt_execute($stmt)) { + printf("[%04d - %s] [%d] %s\n", + $offset + 6, $sql, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + $res = mysqli_stmt_get_result($stmt); + if (false === $res && !empty($expected_mysqlnd)) { + printf("[%04d - %s] Expecting resultset [%d] %s\n", + $offset + 7, $sql, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } else if (empty($expected_mysqlnd) && false !== $res) { + printf("[%04d - %s] Unexpected resultset [%d] %s\n", + $offset + 8, $sql, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + + if (!is_object($res)) { + printf("[%04d - %s] [%d] %s\n", + $offset + 9, $sql, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + return false; + } + if ('mysqli_result' != get_class($res)) { + printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n", + $offset + 10, $sql, + get_class($res)); + return false; + } + + $meta_res = array( + 'num_fields' => mysqli_num_fields($res), + 'fetch_field' => mysqli_fetch_field($res), + 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0), + 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1), + 'fetch_fields' => count(mysqli_fetch_fields($res)), + 'field_count' => mysqli_field_count($link), + 'field_seek-1' => @mysqli_field_seek($res, -1), + 'field_seek0' => mysqli_field_seek($res, 0), + 'field_tell' => mysqli_field_tell($res), + ); + if (is_object($meta_res['fetch_field'])) { + $meta_res['fetch_field']->charsetnr = 'ignore'; + $meta_res['fetch_field']->flags = 'ignore'; + } + if (is_object($meta_res['fetch_field_direct0'])) { + $meta_res['fetch_field_direct0']->charsetnr = 'ignore'; + $meta_res['fetch_field_direct0']->flags = 'ignore'; + } + if (is_object($meta_res['fetch_field_direct1'])) { + $meta_res['fetch_field_direct1']->charsetnr = 'ignore'; + $meta_res['fetch_field_direct1']->flags = 'ignore'; + } + mysqli_free_result($res); + if ($check_mysqlnd && $meta_res != $expected_mysqlnd) { + printf("[%04d - %s] Metadata differs from expected\n", + $offset + 11, $sql); + var_dump($meta_res); + var_dump($expected_mysqlnd); + } else { + if ($meta_res['field_count'] < 1) { + printf("[%04d - %s] Metadata seems wrong, no fields?\n", + $offset + 12, $sql); + var_dump($meta_res); + var_dump(mysqli_fetch_assoc($res)); + } + } + + if ($compare && $meta_res != $meta) { + printf("[%04d - %s] Metadata returned by mysqli_stmt_result_metadata() and mysqli_stmt_get_result() differ\n", + $offset + 13, $sql); + var_dump($meta_res); + var_dump($meta); + } + + } + + mysqli_stmt_close($stmt); + return true; + } + + /* Note: very weak testing, we accept almost any result */ + + testStatement(100, $link, 'ANALYZE TABLE test', array(), array(1), false, false); + testStatement(120, $link, 'OPTIMIZE TABLE test', array(), array(1), false, false); + testStatement(140, $link, 'REPAIR TABLE test', array(), array(1), false, false); + + testStatement(160, $link, 'SHOW AUTHORS', array(), array(1), false, false); + testStatement(180, $link, 'SHOW CHARACTER SET', array(), array(1), false, false); + testStatement(200, $link, 'SHOW COLLATION', array(), array(1), false, false); + testStatement(220, $link, 'SHOW CONTRIBUTORS', array(), array(1), false, false); + testStatement(240, $link, 'SHOW CREATE DATABASE ' . $db, array(), array(1), false, false); + testStatement(260, $link, 'SHOW DATABASES', array(), array(1), false, false); + testStatement(280, $link, 'SHOW ENGINE InnoDB STATUS', array(), array(1), false, false); + testStatement(300, $link, 'SHOW ENGINES', array(), array(1), false, false); + testStatement(320, $link, 'SHOW PLUGINS', array(), array(1), false, false); + testStatement(340, $link, 'SHOW PROCESSLIST', array(), array(1), false, false); + testStatement(360, $link, 'SHOW FULL PROCESSLIST', array(), array(1), false, false); + testStatement(380, $link, 'SHOW STATUS', array(), array(1), false, false); + testStatement(400, $link, 'SHOW TABLE STATUS', array(), array(1), false, false); + testStatement(420, $link, 'SHOW TABLE STATUS', array(), array(1), false, false); + testStatement(440, $link, 'SHOW TABLES', array(), array(1), false, false); + testStatement(460, $link, 'SHOW OPEN TABLES', array(), array(1), false, false); + testStatement(460, $link, 'SHOW VARIABLES', array(), array(1), false, false); + + $field0 = new stdClass(); + $field0->name = 'id'; + $field0->orgname = 'id'; + $field0->table = 'test'; + $field0->orgtable = 'test'; + $field0->def = ''; + $field0->max_length = 0; + $field0->length = 11; + $field0->charsetnr = 'ignore'; + $field0->flags = 'ignore'; + $field0->type = MYSQLI_TYPE_LONG; + $field0->decimals = 0; + $meta_lib = array( + 'num_fields' => 1, + 'fetch_field' => $field0, + 'fetch_field_direct0' => $field0, + 'fetch_field_direct1' => false, + 'fetch_fields' => 1, + 'field_count' => 1, + 'field_seek-1' => false, + 'field_seek0' => true, + 'field_tell' => 0, + ); + $meta_mysqlnd = $meta_lib; + testStatement(480, $link, 'SELECT id FROM test', $meta_lib, $meta_mysqlnd, true, true); + + testStatement(500, $link, 'CHECKSUM TABLE test', array(), array(1), false, false); + + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt index b42e393503..00afa5513d 100644 --- a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt +++ b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt @@ -8,99 +8,99 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine))) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine))) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) - printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) + printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = null; - $label = null; - if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label)) - printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = null; + $label = null; + if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label)) + printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'")) - printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'")) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if (isset($row['VARIABLE_VALUE']) && !isset($row['Value'])) - // MySQL 6.0 - $row['Value'] = $row['VARIABLE_VALUE']; + if (isset($row['VARIABLE_VALUE']) && !isset($row['Value'])) + // MySQL 6.0 + $row['Value'] = $row['VARIABLE_VALUE']; - if (0 === ($max_allowed_packet = (int)$row['Value'])) - printf("[011] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n"); + if (0 === ($max_allowed_packet = (int)$row['Value'])) + printf("[011] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n"); - // let's ignore upper limits for LONGBLOB (2^32) ... - // maximum packet size up to which we test is 10M - $tmp = ''; - $blob = ''; - for ($i = 0; $i < 1024; $i++) { - $tmp .= 'a'; - } + // let's ignore upper limits for LONGBLOB (2^32) ... + // maximum packet size up to which we test is 10M + $tmp = ''; + $blob = ''; + for ($i = 0; $i < 1024; $i++) { + $tmp .= 'a'; + } - $limit = min(floor($max_allowed_packet / 1024 / 2), 10240); - for ($i = 0; $i < $limit; $i++) - $blob .= $tmp; - /* - if (floor($max_allowed_packet / 1024) <= 10240) { - $limit = strlen($blob) - $max_allowed_packet - 1; - for ($i = 0; $i < $limit; $i++) - $blob .= 'a'; - } - */ - assert(strlen($blob) <= $max_allowed_packet); + $limit = min(floor($max_allowed_packet / 1024 / 2), 10240); + for ($i = 0; $i < $limit; $i++) + $blob .= $tmp; + /* + if (floor($max_allowed_packet / 1024) <= 10240) { + $limit = strlen($blob) - $max_allowed_packet - 1; + for ($i = 0; $i < $limit; $i++) + $blob .= 'a'; + } + */ + assert(strlen($blob) <= $max_allowed_packet); - if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, -1, $blob))) - printf("[012] Expecting boolean/false, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, -1, $blob))) + printf("[012] Expecting boolean/false, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 999, $blob))) - printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 999, $blob))) + printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob))) - printf("[015] Expecting boolean/true, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (true !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob))) + printf("[015] Expecting boolean/true, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = 1; - if (true !== mysqli_stmt_execute($stmt)) - printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); + $id = 1; + if (true !== mysqli_stmt_execute($stmt)) + printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + mysqli_stmt_close($stmt); - if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) - printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) + printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (1 != ($tmp = mysqli_num_rows($res))) - printf("[018] Expecting 1 rows, mysqli_num_rows() reports %d rows. [%d] %s\n", - $tmp, mysqli_errno($link), mysqli_error($link)); + if (1 != ($tmp = mysqli_num_rows($res))) + printf("[018] Expecting 1 rows, mysqli_num_rows() reports %d rows. [%d] %s\n", + $tmp, mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if (empty($row['id']) || empty($row['label']) || ($row['id'] != 1)) - printf("[020] Record seems to be incomplete\n"); + if (empty($row['id']) || empty($row['label']) || ($row['id'] != 1)) + printf("[020] Record seems to be incomplete\n"); - if ($blob != $row['label']) - printf("[021] Blob value has not been stored properly!\n"); + if ($blob != $row['label']) + printf("[021] Blob value has not been stored properly!\n"); - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt index 38048894af..63c1f59bfe 100644 --- a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt +++ b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt @@ -11,84 +11,84 @@ if (stristr(mysqli_get_client_info(), 'mysqlnd')) ?> --FILE-- <?php - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine))) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine))) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) - printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) + printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = null; - $label = null; - if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label)) - printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = null; + $label = null; + if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label)) + printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if (0 === ($max_allowed_packet = (int)$row['Value'])) - printf("[008] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n"); + if (0 === ($max_allowed_packet = (int)$row['Value'])) + printf("[008] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n"); - // let's ignore upper limits for LONGBLOB (2^32) ... - // maximum packet size up to which we test is 10M - $tmp = ''; - $blob = ''; - for ($i = 0; $i < 1024; $i++) { - $tmp .= 'a'; - } + // let's ignore upper limits for LONGBLOB (2^32) ... + // maximum packet size up to which we test is 10M + $tmp = ''; + $blob = ''; + for ($i = 0; $i < 1024; $i++) { + $tmp .= 'a'; + } - $limit = min(floor($max_allowed_packet / 1024 / 2), 10240); - for ($i = 0; $i < $limit; $i++) - $blob .= $tmp; + $limit = min(floor($max_allowed_packet / 1024 / 2), 10240); + for ($i = 0; $i < $limit; $i++) + $blob .= $tmp; - assert(strlen($blob) <= $max_allowed_packet); + assert(strlen($blob) <= $max_allowed_packet); - if (true != ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob))) - printf("[009] Expecting boolean/true, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (true != ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob))) + printf("[009] Expecting boolean/true, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = 1; - if (true !== mysqli_stmt_execute($stmt)) - printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = 1; + if (true !== mysqli_stmt_execute($stmt)) + printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - /* - TODO - we skip this part of the test for now, because of bugs.mysql.com/26824 - if (floor($max_allowed_packet / 1024 / 2) <= 10240) { - // test with a blob smaller than 10M allows us to test - // for too long packages without wasting too much memory - $limit = $max_allowed_packet - strlen($blob) + 1; - $blob2 = $blob; - for ($i = 0; $i < $limit; $i++) - $blob2 .= 'b'; + /* + TODO - we skip this part of the test for now, because of bugs.mysql.com/26824 + if (floor($max_allowed_packet / 1024 / 2) <= 10240) { + // test with a blob smaller than 10M allows us to test + // for too long packages without wasting too much memory + $limit = $max_allowed_packet - strlen($blob) + 1; + $blob2 = $blob; + for ($i = 0; $i < $limit; $i++) + $blob2 .= 'b'; - assert(strlen($blob2) > $max_allowed_packet); + assert(strlen($blob2) > $max_allowed_packet); - if (true != ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob2))) - printf("[011] Expecting boolean/false, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (true != ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob2))) + printf("[011] Expecting boolean/false, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = 2; - if (false !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[012] Expecting boolean/false, got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - */ - mysqli_stmt_close($stmt); - mysqli_close($link); + $id = 2; + if (false !== ($tmp = mysqli_stmt_execute($stmt))) + printf("[012] Expecting boolean/false, got %s/%s, [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + */ + mysqli_stmt_close($stmt); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt index fa26a3a45e..927d07c5cf 100644 --- a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt +++ b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt @@ -11,89 +11,89 @@ if (!stristr(mysqli_get_client_info(), 'mysqlnd')) ?> --FILE-- <?php - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine))) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine))) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) - printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) + printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = null; - $label = null; - if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label)) - printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = null; + $label = null; + if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label)) + printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res)) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$row = mysqli_fetch_assoc($res)) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if (0 === ($max_allowed_packet = (int)$row['Value'])) - printf("[008] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n"); + if (0 === ($max_allowed_packet = (int)$row['Value'])) + printf("[008] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n"); - // let's ignore upper limits for LONGBLOB (2^32) ... - // maximum packet size up to which we test is 10M - $tmp = ''; - $blob = ''; - $tmp = str_repeat('a', 1024); + // let's ignore upper limits for LONGBLOB (2^32) ... + // maximum packet size up to which we test is 10M + $tmp = ''; + $blob = ''; + $tmp = str_repeat('a', 1024); - $limit = min(floor($max_allowed_packet / 1024 / 2), 10240); - $blob = str_repeat($tmp, $limit); + $limit = min(floor($max_allowed_packet / 1024 / 2), 10240); + $blob = str_repeat($tmp, $limit); - assert(strlen($blob) <= $max_allowed_packet); + assert(strlen($blob) <= $max_allowed_packet); - if (true !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob))) - printf("[009] Expecting boolean/true, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (true !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob))) + printf("[009] Expecting boolean/true, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = 1; - if (true !== mysqli_stmt_execute($stmt)) - printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = 1; + if (true !== mysqli_stmt_execute($stmt)) + printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - /* - TODO - we skip this because of the open bug http://bugs.mysql.com/bug.php?id=26824 - It would always fail. + /* + TODO - we skip this because of the open bug http://bugs.mysql.com/bug.php?id=26824 + It would always fail. - This should be added to the EXPECTF, if you reactivate the test + This should be added to the EXPECTF, if you reactivate the test Warning: mysqli_stmt_send_long_data(): Skipped %d bytes. Last command STMT_SEND_LONG_DATA hasn't consumed all the output from the server in %s on line %d Warning: mysqli_stmt_send_long_data(): There was an error while sending long data. Probably max_allowed_packet_size is smaller than the data. You have to increase it or send smaller chunks of data. Answer was %d bytes long. in %s on line %d - if (floor($max_allowed_packet / 1024 / 2) <= 10240) { - // test with a blob smaller than 10M allows us to test - // for too long packages without wasting too much memory - $limit = $max_allowed_packet - strlen($blob) + 1; - $blob2 = $blob; - $blob2 .= str_repeat('b', $limit); + if (floor($max_allowed_packet / 1024 / 2) <= 10240) { + // test with a blob smaller than 10M allows us to test + // for too long packages without wasting too much memory + $limit = $max_allowed_packet - strlen($blob) + 1; + $blob2 = $blob; + $blob2 .= str_repeat('b', $limit); - assert(strlen($blob2) > $max_allowed_packet); + assert(strlen($blob2) > $max_allowed_packet); - if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob2))) - printf("[011] Expecting boolean/false, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob2))) + printf("[011] Expecting boolean/false, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $id = 2; - if (false !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[012] Expecting boolean/false, got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - } - */ - mysqli_stmt_close($stmt); - mysqli_close($link); + $id = 2; + if (false !== ($tmp = mysqli_stmt_execute($stmt))) + printf("[012] Expecting boolean/false, got %s/%s, [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + } + */ + mysqli_stmt_close($stmt); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt b/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt index d9d3bb1dc0..a365d4eb9e 100644 --- a/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt +++ b/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt @@ -8,12 +8,12 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); try { mysqli_stmt_sqlstate($stmt); @@ -21,20 +21,20 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test")) - printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test")) + printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if ('00000' !== ($tmp = mysqli_stmt_sqlstate($stmt))) - printf("[007] Expecting string/00000, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if ('00000' !== ($tmp = mysqli_stmt_sqlstate($stmt))) + printf("[007] Expecting string/00000, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (mysqli_stmt_prepare($stmt, "SELECT believe_me FROM i_dont_belive_that_this_table_exists")) - printf("[008] Should fail! [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (mysqli_stmt_prepare($stmt, "SELECT believe_me FROM i_dont_belive_that_this_table_exists")) + printf("[008] Should fail! [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if ('' === ($tmp = mysqli_stmt_sqlstate($stmt))) - printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if ('' === ($tmp = mysqli_stmt_sqlstate($stmt))) + printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); try { mysqli_stmt_sqlstate($stmt); @@ -42,8 +42,8 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - print "done!"; + mysqli_close($link); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_store_result.phpt b/ext/mysqli/tests/mysqli_stmt_store_result.phpt index dba069223c..3c6ebe66b4 100644 --- a/ext/mysqli/tests/mysqli_stmt_store_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_store_result.phpt @@ -8,63 +8,63 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$stmt = mysqli_stmt_init($link)) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - // stmt object status test + // stmt object status test try { mysqli_stmt_store_result($stmt); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } - if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") || - !mysqli_stmt_execute($stmt)) - printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") || + !mysqli_stmt_execute($stmt)) + printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = @mysqli_stmt_store_result($stmt))) - printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = @mysqli_stmt_store_result($stmt))) + printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test ORDER BY id') || - !mysqli_stmt_execute($stmt)) - printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test ORDER BY id') || + !mysqli_stmt_execute($stmt)) + printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$link_buf = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + if (!$link_buf = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (!$stmt_buf = mysqli_stmt_init($link_buf)) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt_buf = mysqli_stmt_init($link_buf)) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_stmt_prepare($stmt_buf, "SELECT id, label FROM test ORDER BY id") || - !mysqli_stmt_execute($stmt_buf)) - printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf)); + if (!mysqli_stmt_prepare($stmt_buf, "SELECT id, label FROM test ORDER BY id") || + !mysqli_stmt_execute($stmt_buf)) + printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf)); - $id = $label = $id_buf = $label_buf = null; - if (!mysqli_stmt_bind_result($stmt, $id, $label)) - printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + $id = $label = $id_buf = $label_buf = null; + if (!mysqli_stmt_bind_result($stmt, $id, $label)) + printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!mysqli_stmt_bind_result($stmt_buf, $id_buf, $label_buf)) - printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf)); + if (!mysqli_stmt_bind_result($stmt_buf, $id_buf, $label_buf)) + printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf)); - while (mysqli_stmt_fetch($stmt)) { - if (!mysqli_stmt_fetch($stmt_buf)) { - printf("[014] Unbuffered statement indicates more rows than buffered, [%d] %s\n", - mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf)); - } - if ($id !== $id_buf) - printf("[015] unbuffered '%s'/%s, buffered '%s'/%s\n", - $id, gettype($id), $id_buf, gettype($id_buf)); - if ($label !== $label_buf) - printf("[016] unbuffered '%s'/%s, buffered '%s'/%s\n", - $label, gettype($label), $label_buf, gettype($label_buf)); - } + while (mysqli_stmt_fetch($stmt)) { + if (!mysqli_stmt_fetch($stmt_buf)) { + printf("[014] Unbuffered statement indicates more rows than buffered, [%d] %s\n", + mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf)); + } + if ($id !== $id_buf) + printf("[015] unbuffered '%s'/%s, buffered '%s'/%s\n", + $id, gettype($id), $id_buf, gettype($id_buf)); + if ($label !== $label_buf) + printf("[016] unbuffered '%s'/%s, buffered '%s'/%s\n", + $label, gettype($label), $label_buf, gettype($label_buf)); + } - mysqli_stmt_close($stmt); - mysqli_stmt_close($stmt_buf); + mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt_buf); try { mysqli_stmt_store_result($stmt); @@ -72,9 +72,9 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - mysqli_close($link); - mysqli_close($link_buf); - print "done!"; + mysqli_close($link); + mysqli_close($link_buf); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_stmt_unclonable.phpt b/ext/mysqli/tests/mysqli_stmt_unclonable.phpt index 18dddc90c7..722295b177 100644 --- a/ext/mysqli/tests/mysqli_stmt_unclonable.phpt +++ b/ext/mysqli/tests/mysqli_stmt_unclonable.phpt @@ -8,18 +8,18 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!$stmt = mysqli_stmt_init($link)) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$stmt = mysqli_stmt_init($link)) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - /* no, still bails out */ - $stmt_clone = clone $stmt; - print "done!"; + /* no, still bails out */ + $stmt_clone = clone $stmt; + print "done!"; ?> --EXPECTF-- Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli_stmt in %s:%d diff --git a/ext/mysqli/tests/mysqli_store_result.phpt b/ext/mysqli/tests/mysqli_store_result.phpt index 2d9f504eef..6fa2d140f5 100644 --- a/ext/mysqli/tests/mysqli_store_result.phpt +++ b/ext/mysqli/tests/mysqli_store_result.phpt @@ -8,38 +8,38 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_object($res = mysqli_store_result($link))) - printf("[004] Expecting object, got %s/%s. [%d] %s\n", - gettype($res), $res, mysqli_errno($link), mysqli_error($link)); + if (!is_object($res = mysqli_store_result($link))) + printf("[004] Expecting object, got %s/%s. [%d] %s\n", + gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - if (true !== ($tmp = mysqli_data_seek($res, 2))) - printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + if (true !== ($tmp = mysqli_data_seek($res, 2))) + printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if (!mysqli_query($link, "DELETE FROM test")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DELETE FROM test")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($res = mysqli_store_result($link))) - printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n", - gettype($res), $res, mysqli_errno($link), mysqli_error($link)); + if (false !== ($res = mysqli_store_result($link))) + printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n", + gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_data_seek($res, 1))) - printf("[009] Expecting boolean/false, got %s/%s\n", - gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_data_seek($res, 1))) + printf("[009] Expecting boolean/false, got %s/%s\n", + gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); try { mysqli_store_result($link); @@ -47,7 +47,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt b/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt index cc776f01e2..f685617915 100644 --- a/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt +++ b/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt @@ -10,28 +10,28 @@ require_once('skipifconnectfailure.inc'); mysqlnd.debug=d:t:O,{TMP}/mysqlnd.trace --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - $tmp = NULL; - $link = NULL; + $tmp = NULL; + $link = NULL; - require('table.inc'); + require('table.inc'); - if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) - printf("[004] Expecting object, got %s/%s. [%d] %s\n", - gettype($res), $res, mysqli_errno($link), mysqli_error($link)); + if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) + printf("[004] Expecting object, got %s/%s. [%d] %s\n", + gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - if (true !== ($tmp = mysqli_data_seek($res, 2))) - printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + if (true !== ($tmp = mysqli_data_seek($res, 2))) + printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_store_result_copy.phpt b/ext/mysqli/tests/mysqli_store_result_copy.phpt index dbe5d2f905..c82bb9e01a 100644 --- a/ext/mysqli/tests/mysqli_store_result_copy.phpt +++ b/ext/mysqli/tests/mysqli_store_result_copy.phpt @@ -16,183 +16,183 @@ mysqlnd.mempool_default_size=1 mysqlnd.fetch_data_copy=0 --FILE-- <?php - require_once("connect.inc"); - - $tmp = NULL; - $link = NULL; - - require('table.inc'); - - if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) - printf("[004] Expecting object, got %s/%s. [%d] %s\n", - gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - - if (true !== ($tmp = mysqli_data_seek($res, 2))) - printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - - var_dump($res->fetch_assoc()); - - if (true !== ($tmp = mysqli_data_seek($res, 0))) - printf("[006] Expecting boolean/true, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - - while ($row = $res->fetch_assoc()) { - printf("id = %d, label = %s\n", $row['id'], $row['label']); - } - - mysqli_free_result($res); - mysqli_close($link); - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - } - - - if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) - printf("[009] Expecting object, got %s/%s. [%d] %s\n", - gettype($res), $res, mysqli_errno($link), mysqli_error($link)); + require_once("connect.inc"); + + $tmp = NULL; + $link = NULL; + + require('table.inc'); + + if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) + printf("[004] Expecting object, got %s/%s. [%d] %s\n", + gettype($res), $res, mysqli_errno($link), mysqli_error($link)); + + if (true !== ($tmp = mysqli_data_seek($res, 2))) + printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + + var_dump($res->fetch_assoc()); + + if (true !== ($tmp = mysqli_data_seek($res, 0))) + printf("[006] Expecting boolean/true, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + + while ($row = $res->fetch_assoc()) { + printf("id = %d, label = %s\n", $row['id'], $row['label']); + } + + mysqli_free_result($res); + mysqli_close($link); + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } + + + if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) + printf("[009] Expecting object, got %s/%s. [%d] %s\n", + gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - $no_result = 0; - for ($i = 0; $i < 1000; $i++) { - $idx = mt_rand(-100, 100); - if (true === @mysqli_data_seek($res, $idx)) { - $row = $res->fetch_assoc(); - if (!isset($row['id']) || !isset($row['label'])) { - printf("[010] Brute force seek %d returned %d\n", $idx, var_export($row, true)); - } - } else { - $no_result++; - } - } - printf("No result: %d\n", $no_result); - - /* implicit free, implicit store */ - /* meta and fetch lengths code */ - if (!$res = mysqli_query($link, "SELECT CONCAT(id, id) AS _c, label FROM test ORDER BY id DESC LIMIT 2")) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - printf("Default\n"); - var_dump(mysqli_fetch_lengths($res)); - $fields = $res->fetch_fields(); - while ($row = $res->fetch_assoc()) { - var_dump(mysqli_fetch_lengths($res)); - } - var_dump(mysqli_fetch_lengths($res)); - - if (!$res = mysqli_real_query($link, "SELECT CONCAT(id, id) AS _c, label FROM test ORDER BY id DESC LIMIT 2")) - printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) - printf("[013] Expecting object, got %s/%s. [%d] %s\n", - gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - - printf("Copy\n"); - var_dump(mysqli_fetch_lengths($res)); - $fields_copy = $res->fetch_fields(); - while ($row = $res->fetch_assoc()) { - var_dump(mysqli_fetch_lengths($res)); - } - var_dump(mysqli_fetch_lengths($res)); - - /* There's no need for in-depth testing here. If you want in-depth switch mysqlnd - globally to copy mode and run all the tests */ - foreach ($fields as $k => $field_info) { - if ($fields_copy[$k] != $field_info) { - printf("[014] Metadata seems to differ, dumping\n"); - var_dump($field_info); - var_dump($fields_copy[$k]); - } - } - - /* fetch all */ - - if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2")) - printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) - printf("[016] Expecting object, got %s/%s. [%d] %s\n", - gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - - foreach (mysqli_fetch_all($res, MYSQLI_ASSOC) as $row) { - printf("id = %d label = %s\n", $row['id'], $row['label']); - } - - if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2")) - printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) - printf("[018] Expecting object, got %s/%s. [%d] %s\n", - gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - - /* provoke out of sync */ - if (!mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2")) - printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - var_dump($res->fetch_assoc()); - - if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) - printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) - printf("[021] Expecting object, got %s/%s. [%d] %s\n", - gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - - /* user conn killed, res associated with conn, fetch from res */ - unset($link); - var_dump($res->fetch_assoc()); - - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - } - - if (!$res = mysqli_real_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')")) - printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA); - - if (mysqli_get_server_version($link) > 50000) { - // let's try to play with stored procedures - mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p'); - if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) READS SQL DATA BEGIN SELECT id FROM test WHERE id >= 100 ORDER BY id; SELECT id + 1, label FROM test WHERE id > 0 AND id < 3 ORDER BY id; SELECT VERSION() INTO ver_param; + $no_result = 0; + for ($i = 0; $i < 1000; $i++) { + $idx = mt_rand(-100, 100); + if (true === @mysqli_data_seek($res, $idx)) { + $row = $res->fetch_assoc(); + if (!isset($row['id']) || !isset($row['label'])) { + printf("[010] Brute force seek %d returned %d\n", $idx, var_export($row, true)); + } + } else { + $no_result++; + } + } + printf("No result: %d\n", $no_result); + + /* implicit free, implicit store */ + /* meta and fetch lengths code */ + if (!$res = mysqli_query($link, "SELECT CONCAT(id, id) AS _c, label FROM test ORDER BY id DESC LIMIT 2")) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + printf("Default\n"); + var_dump(mysqli_fetch_lengths($res)); + $fields = $res->fetch_fields(); + while ($row = $res->fetch_assoc()) { + var_dump(mysqli_fetch_lengths($res)); + } + var_dump(mysqli_fetch_lengths($res)); + + if (!$res = mysqli_real_query($link, "SELECT CONCAT(id, id) AS _c, label FROM test ORDER BY id DESC LIMIT 2")) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) + printf("[013] Expecting object, got %s/%s. [%d] %s\n", + gettype($res), $res, mysqli_errno($link), mysqli_error($link)); + + printf("Copy\n"); + var_dump(mysqli_fetch_lengths($res)); + $fields_copy = $res->fetch_fields(); + while ($row = $res->fetch_assoc()) { + var_dump(mysqli_fetch_lengths($res)); + } + var_dump(mysqli_fetch_lengths($res)); + + /* There's no need for in-depth testing here. If you want in-depth switch mysqlnd + globally to copy mode and run all the tests */ + foreach ($fields as $k => $field_info) { + if ($fields_copy[$k] != $field_info) { + printf("[014] Metadata seems to differ, dumping\n"); + var_dump($field_info); + var_dump($fields_copy[$k]); + } + } + + /* fetch all */ + + if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2")) + printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) + printf("[016] Expecting object, got %s/%s. [%d] %s\n", + gettype($res), $res, mysqli_errno($link), mysqli_error($link)); + + foreach (mysqli_fetch_all($res, MYSQLI_ASSOC) as $row) { + printf("id = %d label = %s\n", $row['id'], $row['label']); + } + + if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2")) + printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) + printf("[018] Expecting object, got %s/%s. [%d] %s\n", + gettype($res), $res, mysqli_errno($link), mysqli_error($link)); + + /* provoke out of sync */ + if (!mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2")) + printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + var_dump($res->fetch_assoc()); + + if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) + printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) + printf("[021] Expecting object, got %s/%s. [%d] %s\n", + gettype($res), $res, mysqli_errno($link), mysqli_error($link)); + + /* user conn killed, res associated with conn, fetch from res */ + unset($link); + var_dump($res->fetch_assoc()); + + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } + + if (!$res = mysqli_real_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')")) + printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA); + + if (mysqli_get_server_version($link) > 50000) { + // let's try to play with stored procedures + mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p'); + if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) READS SQL DATA BEGIN SELECT id FROM test WHERE id >= 100 ORDER BY id; SELECT id + 1, label FROM test WHERE id > 0 AND id < 3 ORDER BY id; SELECT VERSION() INTO ver_param; END;')) { - mysqli_multi_query($link, "CALL p(@version)"); - do { - if ($res = $link->store_result(MYSQLI_STORE_RESULT_COPY_DATA)) { - printf("---\n"); - var_dump($res->fetch_all()); - $res->free(); - } else { - if ($link->errno) { - echo "Store failed: (" . $link->errno . ") " . $link->error; - } - } - } while ($link->more_results() && $link->next_result()); - mysqli_real_query($link, 'SELECT @version AS p_version'); - $res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA); - - $tmp = mysqli_fetch_assoc($res); - if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) { - printf("[024] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($tmp); - } - - mysqli_free_result($res); - } else { - printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } - } - - print "done!"; + mysqli_multi_query($link, "CALL p(@version)"); + do { + if ($res = $link->store_result(MYSQLI_STORE_RESULT_COPY_DATA)) { + printf("---\n"); + var_dump($res->fetch_all()); + $res->free(); + } else { + if ($link->errno) { + echo "Store failed: (" . $link->errno . ") " . $link->error; + } + } + } while ($link->more_results() && $link->next_result()); + mysqli_real_query($link, 'SELECT @version AS p_version'); + $res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA); + + $tmp = mysqli_fetch_assoc($res); + if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) { + printf("[024] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($tmp); + } + + mysqli_free_result($res); + } else { + printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_thread_id.phpt b/ext/mysqli/tests/mysqli_thread_id.phpt index 1349410b09..ce64b9a072 100644 --- a/ext/mysqli/tests/mysqli_thread_id.phpt +++ b/ext/mysqli/tests/mysqli_thread_id.phpt @@ -8,18 +8,18 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!is_int($tmp = mysqli_thread_id($link)) || (0 === $tmp)) - printf("[003] Expecting int/any but zero, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + if (!is_int($tmp = mysqli_thread_id($link)) || (0 === $tmp)) + printf("[003] Expecting int/any but zero, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - // should work if the thread id is correct - mysqli_kill($link, mysqli_thread_id($link)); + // should work if the thread id is correct + mysqli_kill($link, mysqli_thread_id($link)); - mysqli_close($link); + mysqli_close($link); try { mysqli_thread_id($link); @@ -27,7 +27,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_thread_safe.phpt b/ext/mysqli/tests/mysqli_thread_safe.phpt index 15b93dd209..3f45127095 100644 --- a/ext/mysqli/tests/mysqli_thread_safe.phpt +++ b/ext/mysqli/tests/mysqli_thread_safe.phpt @@ -7,10 +7,10 @@ require_once('skipifemb.inc'); ?> --FILE-- <?php - if (!is_bool($tmp = mysqli_thread_safe())) - printf("[001] Expecting boolean/any, got %s/%s.\n", gettype($tmp), $tmp); + if (!is_bool($tmp = mysqli_thread_safe())) + printf("[001] Expecting boolean/any, got %s/%s.\n", gettype($tmp), $tmp); - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/mysqli/tests/mysqli_unclonable.phpt b/ext/mysqli/tests/mysqli_unclonable.phpt index a6bb1946c7..d7f42c2f6e 100644 --- a/ext/mysqli/tests/mysqli_unclonable.phpt +++ b/ext/mysqli/tests/mysqli_unclonable.phpt @@ -8,16 +8,16 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - $link_clone = clone $link; - mysqli_close($link); + $link_clone = clone $link; + mysqli_close($link); - print "done!"; + print "done!"; ?> --EXPECTF-- Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli in %s:%d diff --git a/ext/mysqli/tests/mysqli_use_result.phpt b/ext/mysqli/tests/mysqli_use_result.phpt index 26ad3aabb4..1b679d142d 100644 --- a/ext/mysqli/tests/mysqli_use_result.phpt +++ b/ext/mysqli/tests/mysqli_use_result.phpt @@ -8,38 +8,38 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_object($res = mysqli_use_result($link))) - printf("[004] Expecting object, got %s/%s. [%d] %s\n", - gettype($res), $res, mysqli_errno($link), mysqli_error($link)); + if (!is_object($res = mysqli_use_result($link))) + printf("[004] Expecting object, got %s/%s. [%d] %s\n", + gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_data_seek($res, 2))) - printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + if (false !== ($tmp = mysqli_data_seek($res, 2))) + printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); - mysqli_free_result($res); + mysqli_free_result($res); - if (!mysqli_query($link, "DELETE FROM test")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DELETE FROM test")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($res = mysqli_use_result($link))) - printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n", - gettype($res), $res, mysqli_errno($link), mysqli_error($link)); + if (false !== ($res = mysqli_use_result($link))) + printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n", + gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) - printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_data_seek($res, 1))) - printf("[009] Expecting boolean/false, got %s/%s\n", - gettype($tmp), $tmp); + if (false !== ($tmp = mysqli_data_seek($res, 1))) + printf("[009] Expecting boolean/false, got %s/%s\n", + gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); try { mysqli_use_result($link); @@ -47,7 +47,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_warning_count.phpt b/ext/mysqli/tests/mysqli_warning_count.phpt index 6877843aa3..c59084732b 100644 --- a/ext/mysqli/tests/mysqli_warning_count.phpt +++ b/ext/mysqli/tests/mysqli_warning_count.phpt @@ -8,23 +8,23 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - require('table.inc'); + require('table.inc'); - if (!$res = mysqli_query($link, "SELECT id, label FROM test")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!$res = mysqli_query($link, "SELECT id, label FROM test")) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (0 !== ($tmp = mysqli_warning_count($link))) - printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); + if (0 !== ($tmp = mysqli_warning_count($link))) + printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, "DROP TABLE IF EXISTS this_table_does_not_exist")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS this_table_does_not_exist")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (1 !== ($tmp = mysqli_warning_count($link))) - printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); + if (1 !== ($tmp = mysqli_warning_count($link))) + printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); + mysqli_close($link); try { mysqli_warning_count($link); @@ -32,7 +32,7 @@ require_once('skipifconnectfailure.inc'); echo $exception->getMessage() . "\n"; } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/mysqli_warning_unclonable.phpt b/ext/mysqli/tests/mysqli_warning_unclonable.phpt index 1079ac374b..e68cd96212 100644 --- a/ext/mysqli/tests/mysqli_warning_unclonable.phpt +++ b/ext/mysqli/tests/mysqli_warning_unclonable.phpt @@ -11,27 +11,27 @@ if (!$TEST_EXPERIMENTAL) ?> --FILE-- <?php - require_once("connect.inc"); + require_once("connect.inc"); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[001] 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 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)")) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) { - printf("[005] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); - } + if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) { + printf("[005] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); + } - $warning_clone = clone $warning; - print "done!"; + $warning_clone = clone $warning; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/mysqli/tests/reflection_tools.inc b/ext/mysqli/tests/reflection_tools.inc index 6648526ed0..0e46c2afa9 100644 --- a/ext/mysqli/tests/reflection_tools.inc +++ b/ext/mysqli/tests/reflection_tools.inc @@ -1,121 +1,121 @@ <?php - function inspectClass($class) { - - /* not used: public ReflectionClass[] getInterfaces() */ - - printf("\nInspecting class '%s'\n", $class->getName()); - printf("isInternal: %s\n", ($class->isInternal()) ? 'yes' : 'no'); - printf("isUserDefined: %s\n", ($class->isUserDefined()) ? 'yes' : 'no'); - printf("isInstantiable: %s\n", ($class->isInstantiable()) ? 'yes' : 'no'); - printf("isInterface: %s\n", ($class->isInterface()) ? 'yes' : 'no'); - printf("isAbstract: %s\n", ($class->isAbstract()) ? 'yes' : 'no'); - printf("isFinal: %s\n", ($class->isFinal()) ? 'yes' : 'no'); - printf("isIteratable: %s\n", ($class->isIterateable()) ? 'yes' : 'no'); - printf("Modifiers: '%d'\n", $class->getModifiers()); - printf("Parent Class: '%s'\n", $class->getParentClass()); - printf("Extension: '%s'\n", $class->getExtensionName()); - - if ($method = $class->getConstructor()) - inspectMethod($method); - - if ($methods = $class->getMethods()) { - $tmp = array(); - foreach ($methods as $method) - $tmp[$method->getName()] = $method; - - ksort($tmp, SORT_STRING); - foreach ($tmp as $method) - inspectMethod($method); - } - - if ($properties = $class->getProperties()) { - $tmp = array(); - foreach ($properties as $prop) - $tmp[$prop->getName()] = $prop; - ksort($tmp, SORT_STRING); - foreach ($tmp as $prop) - inspectProperty($prop); - } - - - if ($properties = $class->getDefaultProperties()) { - ksort($properties, SORT_STRING); - foreach ($properties as $name => $v) - printf("Default property '%s'\n", $name); - } - - if ($properties = $class->getStaticProperties()) { - ksort($properties, SORT_STRING); - foreach ($properties as $name => $v) - printf("Static property '%s'\n", $name); - } - - if ($constants = $class->getConstants()) { - ksort($constants, SORT_STRING); - foreach ($constant as $name => $value) - printf("Constant '%s' = '%s'\n", $name, $value); - } - - } - - function inspectProperty(&$prop) { - - printf("\nInspecting property '%s'\n", $prop->getName()); - printf("isPublic: %s\n", ($prop->isPublic()) ? 'yes' : 'no'); - printf("isPrivate: %s\n", ($prop->isPrivate()) ? 'yes' : 'no'); - printf("isProtected: %s\n", ($prop->isProtected()) ? 'yes' : 'no'); - printf("isStatic: %s\n", ($prop->isStatic()) ? 'yes' : 'no'); - printf("isDefault: %s\n", ($prop->isDefault()) ? 'yes' : 'no'); - printf("Modifiers: %d\n", $prop->getModifiers()); - // printf("Value\n"); var_export($prop->getValue()); - - } - - function inspectMethod(&$method) { - - printf("\nInspecting method '%s'\n", $method->getName()); - printf("isFinal: %s\n", ($method->isFinal()) ? 'yes' : 'no'); - printf("isAbstract: %s\n", ($method->isAbstract()) ? 'yes' : 'no'); - printf("isPublic: %s\n", ($method->isPublic()) ? 'yes' : 'no'); - printf("isPrivate: %s\n", ($method->isPrivate()) ? 'yes' : 'no'); - printf("isProtected: %s\n", ($method->isProtected()) ? 'yes' : 'no'); - printf("isStatic: %s\n", ($method->isStatic()) ? 'yes' : 'no'); - printf("isConstructor: %s\n", ($method->isConstructor()) ? 'yes' : 'no'); - printf("isDestructor: %s\n", ($method->isDestructor()) ? 'yes' : 'no'); - printf("isInternal: %s\n", ($method->isInternal()) ? 'yes' : 'no'); - printf("isUserDefined: %s\n", ($method->isUserDefined()) ? 'yes' : 'no'); - printf("returnsReference: %s\n", ($method->returnsReference()) ? 'yes' : 'no'); - printf("Modifiers: %d\n", $method->getModifiers()); - printf("Number of Parameters: %d\n", $method->getNumberOfParameters()); - printf("Number of Required Parameters: %d\n", $method->getNumberOfRequiredParameters()); - - if ($params = $method->getParameters()) { - $tmp = array(); - foreach ($params as $k => $param) - $tmp[$param->getName()] = $param; + function inspectClass($class) { + + /* not used: public ReflectionClass[] getInterfaces() */ + + printf("\nInspecting class '%s'\n", $class->getName()); + printf("isInternal: %s\n", ($class->isInternal()) ? 'yes' : 'no'); + printf("isUserDefined: %s\n", ($class->isUserDefined()) ? 'yes' : 'no'); + printf("isInstantiable: %s\n", ($class->isInstantiable()) ? 'yes' : 'no'); + printf("isInterface: %s\n", ($class->isInterface()) ? 'yes' : 'no'); + printf("isAbstract: %s\n", ($class->isAbstract()) ? 'yes' : 'no'); + printf("isFinal: %s\n", ($class->isFinal()) ? 'yes' : 'no'); + printf("isIteratable: %s\n", ($class->isIterateable()) ? 'yes' : 'no'); + printf("Modifiers: '%d'\n", $class->getModifiers()); + printf("Parent Class: '%s'\n", $class->getParentClass()); + printf("Extension: '%s'\n", $class->getExtensionName()); + + if ($method = $class->getConstructor()) + inspectMethod($method); + + if ($methods = $class->getMethods()) { + $tmp = array(); + foreach ($methods as $method) + $tmp[$method->getName()] = $method; + + ksort($tmp, SORT_STRING); + foreach ($tmp as $method) + inspectMethod($method); + } + + if ($properties = $class->getProperties()) { + $tmp = array(); + foreach ($properties as $prop) + $tmp[$prop->getName()] = $prop; + ksort($tmp, SORT_STRING); + foreach ($tmp as $prop) + inspectProperty($prop); + } + + + if ($properties = $class->getDefaultProperties()) { + ksort($properties, SORT_STRING); + foreach ($properties as $name => $v) + printf("Default property '%s'\n", $name); + } + + if ($properties = $class->getStaticProperties()) { + ksort($properties, SORT_STRING); + foreach ($properties as $name => $v) + printf("Static property '%s'\n", $name); + } + + if ($constants = $class->getConstants()) { + ksort($constants, SORT_STRING); + foreach ($constant as $name => $value) + printf("Constant '%s' = '%s'\n", $name, $value); + } + + } + + function inspectProperty(&$prop) { + + printf("\nInspecting property '%s'\n", $prop->getName()); + printf("isPublic: %s\n", ($prop->isPublic()) ? 'yes' : 'no'); + printf("isPrivate: %s\n", ($prop->isPrivate()) ? 'yes' : 'no'); + printf("isProtected: %s\n", ($prop->isProtected()) ? 'yes' : 'no'); + printf("isStatic: %s\n", ($prop->isStatic()) ? 'yes' : 'no'); + printf("isDefault: %s\n", ($prop->isDefault()) ? 'yes' : 'no'); + printf("Modifiers: %d\n", $prop->getModifiers()); + // printf("Value\n"); var_export($prop->getValue()); + + } + + function inspectMethod(&$method) { + + printf("\nInspecting method '%s'\n", $method->getName()); + printf("isFinal: %s\n", ($method->isFinal()) ? 'yes' : 'no'); + printf("isAbstract: %s\n", ($method->isAbstract()) ? 'yes' : 'no'); + printf("isPublic: %s\n", ($method->isPublic()) ? 'yes' : 'no'); + printf("isPrivate: %s\n", ($method->isPrivate()) ? 'yes' : 'no'); + printf("isProtected: %s\n", ($method->isProtected()) ? 'yes' : 'no'); + printf("isStatic: %s\n", ($method->isStatic()) ? 'yes' : 'no'); + printf("isConstructor: %s\n", ($method->isConstructor()) ? 'yes' : 'no'); + printf("isDestructor: %s\n", ($method->isDestructor()) ? 'yes' : 'no'); + printf("isInternal: %s\n", ($method->isInternal()) ? 'yes' : 'no'); + printf("isUserDefined: %s\n", ($method->isUserDefined()) ? 'yes' : 'no'); + printf("returnsReference: %s\n", ($method->returnsReference()) ? 'yes' : 'no'); + printf("Modifiers: %d\n", $method->getModifiers()); + printf("Number of Parameters: %d\n", $method->getNumberOfParameters()); + printf("Number of Required Parameters: %d\n", $method->getNumberOfRequiredParameters()); + + if ($params = $method->getParameters()) { + $tmp = array(); + foreach ($params as $k => $param) + $tmp[$param->getName()] = $param; // ksort($tmp, SORT_STRING); - foreach ($tmp as $param) - inspectParameter($method, $param); - } + foreach ($tmp as $param) + inspectParameter($method, $param); + } - if ($static = $method->getStaticVariables()) { - sort($static, SORT_STRING); - printf("Static variables: %s\n", implode('/', $static)); - } + if ($static = $method->getStaticVariables()) { + sort($static, SORT_STRING); + printf("Static variables: %s\n", implode('/', $static)); + } - } + } - function inspectParameter(&$method, &$param) { + function inspectParameter(&$method, &$param) { - printf("\nInspecting parameter '%s' of method '%s'\n", - $param->getName(), $method->getName()); - printf("isArray: %s\n", ($param->isArray()) ? 'yes': 'no'); - printf("allowsNull: %s\n", ($param->allowsNull()) ? 'yes' : 'no'); - printf("isPassedByReference: %s\n", ($param->isPassedByReference()) ? 'yes' : 'no'); - printf("isOptional: %s\n", ($param->isOptional()) ? 'yes' : 'no'); - printf("isDefaultValueAvailable: %s\n", ($param->isDefaultValueAvailable()) ? 'yes' : 'no'); - // printf("getDefaultValue: %s\n", ($param->getDefaultValue()) ? 'yes' : 'no'); + printf("\nInspecting parameter '%s' of method '%s'\n", + $param->getName(), $method->getName()); + printf("isArray: %s\n", ($param->isArray()) ? 'yes': 'no'); + printf("allowsNull: %s\n", ($param->allowsNull()) ? 'yes' : 'no'); + printf("isPassedByReference: %s\n", ($param->isPassedByReference()) ? 'yes' : 'no'); + printf("isOptional: %s\n", ($param->isOptional()) ? 'yes' : 'no'); + printf("isDefaultValueAvailable: %s\n", ($param->isDefaultValueAvailable()) ? 'yes' : 'no'); + // printf("getDefaultValue: %s\n", ($param->getDefaultValue()) ? 'yes' : 'no'); - } + } ?> diff --git a/ext/mysqli/tests/skipif.inc b/ext/mysqli/tests/skipif.inc index 5562aab84b..a5a5df14c2 100644 --- a/ext/mysqli/tests/skipif.inc +++ b/ext/mysqli/tests/skipif.inc @@ -1,5 +1,5 @@ <?php if (!extension_loaded('mysqli')){ - die('skip mysqli extension not available'); + die('skip mysqli extension not available'); } ?> diff --git a/ext/mysqli/tests/skipifconnectfailure.inc b/ext/mysqli/tests/skipifconnectfailure.inc index 32a976357c..ccde567baa 100644 --- a/ext/mysqli/tests/skipifconnectfailure.inc +++ b/ext/mysqli/tests/skipifconnectfailure.inc @@ -1,10 +1,10 @@ <?php require_once('connect.inc'); if ($skip_on_connect_failure) { - include_once('connect.inc'); - $link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!is_object($link)) - die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error())); - mysqli_close($link); + include_once('connect.inc'); + $link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + if (!is_object($link)) + die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error())); + mysqli_close($link); } ?> diff --git a/ext/mysqli/tests/skipifemb.inc b/ext/mysqli/tests/skipifemb.inc index ad143a42a4..2b7941d825 100644 --- a/ext/mysqli/tests/skipifemb.inc +++ b/ext/mysqli/tests/skipifemb.inc @@ -1,5 +1,5 @@ <?php - $driver = new mysqli_driver(); - if ($driver->embedded) - die("skip test doesn't run with embedded server"); + $driver = new mysqli_driver(); + if ($driver->embedded) + die("skip test doesn't run with embedded server"); ?> diff --git a/ext/mysqli/tests/skipifnotemb.inc b/ext/mysqli/tests/skipifnotemb.inc index fa5fb9f0a3..e88e423836 100644 --- a/ext/mysqli/tests/skipifnotemb.inc +++ b/ext/mysqli/tests/skipifnotemb.inc @@ -1,5 +1,5 @@ <?php - $driver = new mysqli_driver(); - if (!$driver->embedded) - die("skip test for with embedded server only"); + $driver = new mysqli_driver(); + if (!$driver->embedded) + die("skip test for with embedded server only"); ?> diff --git a/ext/mysqli/tests/table.inc b/ext/mysqli/tests/table.inc index e0d7a06c57..16b688f74b 100644 --- a/ext/mysqli/tests/table.inc +++ b/ext/mysqli/tests/table.inc @@ -2,27 +2,27 @@ require_once('connect.inc'); if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - exit(1); + printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + exit(1); } if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - exit(1); + printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + exit(1); } if (!mysqli_query($link, 'SET SESSION sql_mode=\'\'')) { - printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - exit(1); + printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + exit(1); } if (!mysqli_query($link, 'CREATE TABLE test(id INT DEFAULT 0, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) { - printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - exit(1); + printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + exit(1); } if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')")) { - printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); + printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); } ?> diff --git a/ext/oci8/tests/array_bind_014.phpt b/ext/oci8/tests/array_bind_014.phpt index ca5823bc0f..abf7907739 100644 --- a/ext/oci8/tests/array_bind_014.phpt +++ b/ext/oci8/tests/array_bind_014.phpt @@ -47,8 +47,8 @@ $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); for ($i = 1; $i < 6; $i++) { - $statement = oci_parse($c, "INSERT INTO bind_test VALUES (".$i.")"); - oci_execute($statement); + $statement = oci_parse($c, "INSERT INTO bind_test VALUES (".$i.")"); + oci_execute($statement); } $statement = oci_parse($c, "BEGIN array_bind_014_pkg.iobind(:c1); END;"); diff --git a/ext/oci8/tests/bind_char_1.phpt b/ext/oci8/tests/bind_char_1.phpt index fbd1d65bd2..f405155980 100644 --- a/ext/oci8/tests/bind_char_1.phpt +++ b/ext/oci8/tests/bind_char_1.phpt @@ -20,11 +20,11 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table bind_char_tab", - "create table bind_char_tab (id number, c1 char(10), c2 varchar2(10))", - "insert into bind_char_tab values (1, 'abc', NULL)", - "insert into bind_char_tab values (2, NULL, 'abc')", - "insert into bind_char_tab values (3, NULL, 'abc ')" + "drop table bind_char_tab", + "create table bind_char_tab (id number, c1 char(10), c2 varchar2(10))", + "insert into bind_char_tab values (1, 'abc', NULL)", + "insert into bind_char_tab values (2, NULL, 'abc')", + "insert into bind_char_tab values (3, NULL, 'abc ')" ); oci8_test_sql_execute($c, $stmtarray); @@ -39,32 +39,32 @@ echo "Test 1.1: Type: default. Length: default\n"; $s = oci_parse($c, "select * from bind_char_tab where c1 = :bv"); $r = oci_bind_by_name($s, ":bv", $bv1); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.2: Type: AFC. Length: default\n"; $r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.3: Type: AFC: Length: 0\n"; $r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.4: Type: AFC: Length: strlen\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.5: Type: AFC. Length: strlen-1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.6: Type: AFC. Length: strlen+1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "\n\n*** NULL data tests against CHAR ***\n"; @@ -74,32 +74,32 @@ echo "Test 2.1: Type: default. Length: default\n"; $s = oci_parse($c, "select * from bind_char_tab where c1 = :bv"); $r = oci_bind_by_name($s, ":bv", $bv1); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 2.2: Type: AFC. Length: default\n"; $r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 2.3: Type: AFC: Length: 0\n"; $r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 2.4: Type: AFC: Length: strlen\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 2.5: Type: AFC. Length: strlen-1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 2.6: Type: AFC. Length: strlen+1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "\n\n*** Non-null Data Tests against VARCHAR2***\n"; @@ -110,32 +110,32 @@ echo "Test 3.1: Type: default. Length: default\n"; $s = oci_parse($c, "select * from bind_char_tab where c2 = :bv"); $r = oci_bind_by_name($s, ":bv", $bv1); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 3.2: Type: AFC. Length: default\n"; $r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 3.3: Type: AFC: Length: 0\n"; $r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 3.4: Type: AFC: Length: strlen\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 3.5: Type: AFC. Length: strlen-1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 3.6: Type: AFC. Length: strlen+1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "\n\n*** NULL data tests against VARCHAR2 ***\n"; @@ -146,55 +146,55 @@ echo "Test 4.1: Type: default. Length: default\n"; $s = oci_parse($c, "select * from bind_char_tab where c2 = :bv"); $r = oci_bind_by_name($s, ":bv", $bv1); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 4.2: Type: AFC. Length: default\n"; $r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 4.3: Type: AFC: Length: 0\n"; $r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 4.4: Type: AFC: Length: strlen\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 4.5: Type: AFC. Length: strlen-1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 4.6: Type: AFC. Length: strlen+1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); function do_e_q($s) { - echo " Querying:\n"; - - $r = @oci_execute($s); - if (!$r) { - $m = oci_error($s); - echo " Oci_execute error ORA-".$m['code']." Exiting Query\n"; - return; - } - while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { - foreach ($row as $item) { - echo " :" . $item . ":\n"; - } - } + echo " Querying:\n"; + + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + echo " Oci_execute error ORA-".$m['code']." Exiting Query\n"; + return; + } + while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { + foreach ($row as $item) { + echo " :" . $item . ":\n"; + } + } } // Cleanup $stmtarray = array( - "drop table bind_char_tab" + "drop table bind_char_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_char_1_11gR1.phpt b/ext/oci8/tests/bind_char_1_11gR1.phpt index ea49c96b75..d281833a77 100644 --- a/ext/oci8/tests/bind_char_1_11gR1.phpt +++ b/ext/oci8/tests/bind_char_1_11gR1.phpt @@ -22,11 +22,11 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table bind_char_tab", - "create table bind_char_tab (id number, c1 char(10), c2 varchar2(10))", - "insert into bind_char_tab values (1, 'abc', NULL)", - "insert into bind_char_tab values (2, NULL, 'abc')", - "insert into bind_char_tab values (3, NULL, 'abc ')" + "drop table bind_char_tab", + "create table bind_char_tab (id number, c1 char(10), c2 varchar2(10))", + "insert into bind_char_tab values (1, 'abc', NULL)", + "insert into bind_char_tab values (2, NULL, 'abc')", + "insert into bind_char_tab values (3, NULL, 'abc ')" ); oci8_test_sql_execute($c, $stmtarray); @@ -41,32 +41,32 @@ echo "Test 1.1: Type: default. Length: default\n"; $s = oci_parse($c, "select * from bind_char_tab where c1 = :bv"); $r = oci_bind_by_name($s, ":bv", $bv1); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.2: Type: AFC. Length: default\n"; $r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.3: Type: AFC: Length: 0\n"; $r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.4: Type: AFC: Length: strlen\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.5: Type: AFC. Length: strlen-1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.6: Type: AFC. Length: strlen+1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "\n\n*** NULL data tests against CHAR ***\n"; @@ -76,32 +76,32 @@ echo "Test 2.1: Type: default. Length: default\n"; $s = oci_parse($c, "select * from bind_char_tab where c1 = :bv"); $r = oci_bind_by_name($s, ":bv", $bv1); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 2.2: Type: AFC. Length: default\n"; $r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 2.3: Type: AFC: Length: 0\n"; $r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 2.4: Type: AFC: Length: strlen\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 2.5: Type: AFC. Length: strlen-1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 2.6: Type: AFC. Length: strlen+1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "\n\n*** Non-null Data Tests against VARCHAR2***\n"; @@ -112,32 +112,32 @@ echo "Test 3.1: Type: default. Length: default\n"; $s = oci_parse($c, "select * from bind_char_tab where c2 = :bv"); $r = oci_bind_by_name($s, ":bv", $bv1); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 3.2: Type: AFC. Length: default\n"; $r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 3.3: Type: AFC: Length: 0\n"; $r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 3.4: Type: AFC: Length: strlen\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 3.5: Type: AFC. Length: strlen-1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 3.6: Type: AFC. Length: strlen+1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "\n\n*** NULL data tests against VARCHAR2 ***\n"; @@ -148,55 +148,55 @@ echo "Test 4.1: Type: default. Length: default\n"; $s = oci_parse($c, "select * from bind_char_tab where c2 = :bv"); $r = oci_bind_by_name($s, ":bv", $bv1); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 4.2: Type: AFC. Length: default\n"; $r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 4.3: Type: AFC: Length: 0\n"; $r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 4.4: Type: AFC: Length: strlen\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 4.5: Type: AFC. Length: strlen-1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 4.6: Type: AFC. Length: strlen+1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); function do_e_q($s) { - echo " Querying:\n"; - - $r = @oci_execute($s); - if (!$r) { - $m = oci_error($s); - echo " Oci_execute error ORA-".$m['code']." Exiting Query\n"; - return; - } - while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { - foreach ($row as $item) { - echo " :" . $item . ":\n"; - } - } + echo " Querying:\n"; + + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + echo " Oci_execute error ORA-".$m['code']." Exiting Query\n"; + return; + } + while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { + foreach ($row as $item) { + echo " :" . $item . ":\n"; + } + } } // Cleanup $stmtarray = array( - "drop table bind_char_tab" + "drop table bind_char_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_char_2.phpt b/ext/oci8/tests/bind_char_2.phpt index 8200dcf368..1e5fb08a94 100644 --- a/ext/oci8/tests/bind_char_2.phpt +++ b/ext/oci8/tests/bind_char_2.phpt @@ -20,10 +20,10 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "alter session set nls_date_format='YYYY-MM-DD'", - "drop table bind_char_tab", - "create table bind_char_tab (id number, c1 date)", - "insert into bind_char_tab values (1, '2008-04-20')", + "alter session set nls_date_format='YYYY-MM-DD'", + "drop table bind_char_tab", + "create table bind_char_tab (id number, c1 date)", + "insert into bind_char_tab values (1, '2008-04-20')", ); oci8_test_sql_execute($c, $stmtarray); @@ -41,49 +41,49 @@ if ($r) echo "Test 1.2: Type: AFC. Length: default\n"; $r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.3: Type: AFC: Length: 0\n"; $r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.4: Type: AFC: Length: strlen\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.5: Type: AFC. Length: strlen-1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.6: Type: AFC. Length: strlen+1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); function do_e_q($s) { - echo " Querying:\n"; - - $r = @oci_execute($s); - if (!$r) { - $m = oci_error($s); - echo " Oci_execute error ORA-".$m['code']." Exiting Query\n"; - return; - } - while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { - foreach ($row as $item) { - echo " :" . $item . ":\n"; - } - } + echo " Querying:\n"; + + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + echo " Oci_execute error ORA-".$m['code']." Exiting Query\n"; + return; + } + while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { + foreach ($row as $item) { + echo " :" . $item . ":\n"; + } + } } // Cleanup $stmtarray = array( - "drop table bind_char_tab" + "drop table bind_char_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_char_2_11gR1.phpt b/ext/oci8/tests/bind_char_2_11gR1.phpt index 3ee9648221..11ed50fb83 100644 --- a/ext/oci8/tests/bind_char_2_11gR1.phpt +++ b/ext/oci8/tests/bind_char_2_11gR1.phpt @@ -20,10 +20,10 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "alter session set nls_date_format='YYYY-MM-DD'", - "drop table bind_char_tab", - "create table bind_char_tab (id number, c1 date)", - "insert into bind_char_tab values (1, '2008-04-20')", + "alter session set nls_date_format='YYYY-MM-DD'", + "drop table bind_char_tab", + "create table bind_char_tab (id number, c1 date)", + "insert into bind_char_tab values (1, '2008-04-20')", ); oci8_test_sql_execute($c, $stmtarray); @@ -41,49 +41,49 @@ if ($r) echo "Test 1.2: Type: AFC. Length: default\n"; $r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.3: Type: AFC: Length: 0\n"; $r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.4: Type: AFC: Length: strlen\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.5: Type: AFC. Length: strlen-1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); echo "Test 1.6: Type: AFC. Length: strlen+1\n"; $r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e_q($s); + do_e_q($s); function do_e_q($s) { - echo " Querying:\n"; - - $r = @oci_execute($s); - if (!$r) { - $m = oci_error($s); - echo " Oci_execute error ORA-".$m['code']." Exiting Query\n"; - return; - } - while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { - foreach ($row as $item) { - echo " :" . $item . ":\n"; - } - } + echo " Querying:\n"; + + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + echo " Oci_execute error ORA-".$m['code']." Exiting Query\n"; + return; + } + while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { + foreach ($row as $item) { + echo " :" . $item . ":\n"; + } + } } // Cleanup $stmtarray = array( - "drop table bind_char_tab" + "drop table bind_char_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_char_3.phpt b/ext/oci8/tests/bind_char_3.phpt index f4d8c1f242..62f767367e 100644 --- a/ext/oci8/tests/bind_char_3.phpt +++ b/ext/oci8/tests/bind_char_3.phpt @@ -20,7 +20,7 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;", + "create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;", ); oci8_test_sql_execute($c, $stmtarray); @@ -33,7 +33,7 @@ $s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;"); $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n"; @@ -41,7 +41,7 @@ echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -50,7 +50,7 @@ echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -60,7 +60,7 @@ echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -69,7 +69,7 @@ echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input) $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -78,7 +78,7 @@ echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input) $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -87,7 +87,7 @@ echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input) $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -98,7 +98,7 @@ echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -106,7 +106,7 @@ echo "Test 2.2 In Length: default. In Type: default. Out Length: 10. $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -116,7 +116,7 @@ echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -126,7 +126,7 @@ echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -136,7 +136,7 @@ echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -146,7 +146,7 @@ echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -156,7 +156,7 @@ echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -168,7 +168,7 @@ echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -177,7 +177,7 @@ echo "Test 3.2 In Length: default. In Type: default. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -187,7 +187,7 @@ echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -197,7 +197,7 @@ echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -206,7 +206,7 @@ echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -216,26 +216,26 @@ echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); function do_e($s) { - echo " Executing:\n"; - - $r = @oci_execute($s); - if (!$r) { - $m = oci_error($s); - echo " Oci_execute error ORA-".$m['code']."\n"; - return; - } + echo " Executing:\n"; + + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + echo " Oci_execute error ORA-".$m['code']."\n"; + return; + } } // Cleanup $stmtarray = array( - "drop function bind_char_3_fn" + "drop function bind_char_3_fn" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt index 1adcae2a74..c809101199 100644 --- a/ext/oci8/tests/bind_char_3_11gR1.phpt +++ b/ext/oci8/tests/bind_char_3_11gR1.phpt @@ -20,7 +20,7 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;", + "create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;", ); oci8_test_sql_execute($c, $stmtarray); @@ -33,7 +33,7 @@ $s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;"); $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n"; @@ -41,7 +41,7 @@ echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -50,7 +50,7 @@ echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -60,7 +60,7 @@ echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -69,7 +69,7 @@ echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input) $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -78,7 +78,7 @@ echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input) $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -87,7 +87,7 @@ echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input) $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -98,7 +98,7 @@ echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -106,7 +106,7 @@ echo "Test 2.2 In Length: default. In Type: default. Out Length: 10. $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -116,7 +116,7 @@ echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -126,7 +126,7 @@ echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -136,7 +136,7 @@ echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -146,7 +146,7 @@ echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -156,7 +156,7 @@ echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -168,7 +168,7 @@ echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -177,7 +177,7 @@ echo "Test 3.2 In Length: default. In Type: default. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -187,7 +187,7 @@ echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -197,7 +197,7 @@ echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -206,7 +206,7 @@ echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -216,26 +216,26 @@ echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); function do_e($s) { - echo " Executing:\n"; - - $r = @oci_execute($s); - if (!$r) { - $m = oci_error($s); - echo " Oci_execute error ORA-".$m['code']."\n"; - return; - } + echo " Executing:\n"; + + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + echo " Oci_execute error ORA-".$m['code']."\n"; + return; + } } // Cleanup $stmtarray = array( - "drop function bind_char_3_fn" + "drop function bind_char_3_fn" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_char_4.phpt b/ext/oci8/tests/bind_char_4.phpt index 218f0b03cf..627ba45e86 100644 --- a/ext/oci8/tests/bind_char_4.phpt +++ b/ext/oci8/tests/bind_char_4.phpt @@ -22,7 +22,7 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;", + "create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;", ); oci8_test_sql_execute($c, $stmtarray); @@ -35,7 +35,7 @@ $s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;"); $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n"; @@ -43,7 +43,7 @@ echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -52,7 +52,7 @@ echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -62,7 +62,7 @@ echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -71,7 +71,7 @@ echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input) $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -80,7 +80,7 @@ echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input) $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -89,7 +89,7 @@ echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input) $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -100,7 +100,7 @@ echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -108,7 +108,7 @@ echo "Test 2.2 In Length: default. In Type: default. Out Length: 10. $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -118,7 +118,7 @@ echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -128,7 +128,7 @@ echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -138,7 +138,7 @@ echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -148,7 +148,7 @@ echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -158,7 +158,7 @@ echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -170,7 +170,7 @@ echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -179,7 +179,7 @@ echo "Test 3.2 In Length: default. In Type: default. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -189,7 +189,7 @@ echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -199,7 +199,7 @@ echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -208,7 +208,7 @@ echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -218,26 +218,26 @@ echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); function do_e($s) { - echo " Executing:\n"; - - $r = @oci_execute($s); - if (!$r) { - $m = oci_error($s); - echo " Oci_execute error ORA-".$m['code']."\n"; - return; - } + echo " Executing:\n"; + + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + echo " Oci_execute error ORA-".$m['code']."\n"; + return; + } } // Cleanup $stmtarray = array( - "drop function bind_char_3_fn" + "drop function bind_char_3_fn" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt index 51350e533e..e40887c450 100644 --- a/ext/oci8/tests/bind_char_4_11gR1.phpt +++ b/ext/oci8/tests/bind_char_4_11gR1.phpt @@ -22,7 +22,7 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;", + "create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;", ); oci8_test_sql_execute($c, $stmtarray); @@ -35,7 +35,7 @@ $s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;"); $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n"; @@ -43,7 +43,7 @@ echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -52,7 +52,7 @@ echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -62,7 +62,7 @@ echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -71,7 +71,7 @@ echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input) $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -80,7 +80,7 @@ echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input) $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -89,7 +89,7 @@ echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input) $bv1 = 'abc'; $r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -100,7 +100,7 @@ echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -108,7 +108,7 @@ echo "Test 2.2 In Length: default. In Type: default. Out Length: 10. $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -118,7 +118,7 @@ echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -128,7 +128,7 @@ echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -138,7 +138,7 @@ echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -148,7 +148,7 @@ echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -158,7 +158,7 @@ echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. $bv1 = ''; $r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -170,7 +170,7 @@ echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -179,7 +179,7 @@ echo "Test 3.2 In Length: default. In Type: default. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -189,7 +189,7 @@ echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -199,7 +199,7 @@ echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -208,7 +208,7 @@ echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); @@ -218,26 +218,26 @@ echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. $bv1 = null; $r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC); if ($r) - do_e($s); + do_e($s); var_dump($bv1, $bv2); function do_e($s) { - echo " Executing:\n"; - - $r = @oci_execute($s); - if (!$r) { - $m = oci_error($s); - echo " Oci_execute error ORA-".$m['code']."\n"; - return; - } + echo " Executing:\n"; + + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + echo " Oci_execute error ORA-".$m['code']."\n"; + return; + } } // Cleanup $stmtarray = array( - "drop function bind_char_3_fn" + "drop function bind_char_3_fn" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_misccoltypes.phpt b/ext/oci8/tests/bind_misccoltypes.phpt index 6985497685..928256ad6b 100644 --- a/ext/oci8/tests/bind_misccoltypes.phpt +++ b/ext/oci8/tests/bind_misccoltypes.phpt @@ -16,9 +16,9 @@ $stmtarray = array( "alter session set nls_date_format = 'DD-MON-YY'", - "drop table bind_misccoltypes_tab", + "drop table bind_misccoltypes_tab", - "create table bind_misccoltypes_tab ( + "create table bind_misccoltypes_tab ( id number, char_t char(1), char_t10 char(10), @@ -260,7 +260,7 @@ check_col($c, 'date_t', 60); // Clean up $stmtarray = array( - "drop table bind_misccoltypes_tab" + "drop table bind_misccoltypes_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_misccoltypes_errs.phpt b/ext/oci8/tests/bind_misccoltypes_errs.phpt index 84bdba3d8d..4f5de46e80 100644 --- a/ext/oci8/tests/bind_misccoltypes_errs.phpt +++ b/ext/oci8/tests/bind_misccoltypes_errs.phpt @@ -10,9 +10,9 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table bind_misccoltypes_errs_tab", + "drop table bind_misccoltypes_errs_tab", - "create table bind_misccoltypes_errs_tab ( + "create table bind_misccoltypes_errs_tab ( id number, char_t char(1), char_t10 char(10), @@ -108,7 +108,7 @@ check_col($c, 'varchar2_t10', 7); // Clean up $stmtarray = array( - "drop table bind_misccoltypes_errs_tab" + "drop table bind_misccoltypes_errs_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_number.phpt b/ext/oci8/tests/bind_number.phpt index 298f487f85..851f2da605 100644 --- a/ext/oci8/tests/bind_number.phpt +++ b/ext/oci8/tests/bind_number.phpt @@ -14,26 +14,26 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table bind_number_tab", - "create table bind_number_tab ( - id number, - number_t6 number(6), - float_t float, - binary_float_t binary_float, - binary_double_t binary_double, - decimal_t decimal, - integer_t integer)" + "drop table bind_number_tab", + "create table bind_number_tab ( + id number, + number_t6 number(6), + float_t float, + binary_float_t binary_float, + binary_double_t binary_double, + decimal_t decimal, + integer_t integer)" ); oci8_test_sql_execute($c, $stmtarray); function check_col($c, $colname, $id) { - $s = oci_parse($c, "select $colname from bind_number_tab where id = :id"); - oci_bind_by_name($s, ":id", $id); - oci_execute($s); - oci_fetch_all($s, $r); - var_dump($r); + $s = oci_parse($c, "select $colname from bind_number_tab where id = :id"); + oci_bind_by_name($s, ":id", $id); + oci_execute($s); + oci_fetch_all($s, $r); + var_dump($r); } // Run Test @@ -123,7 +123,7 @@ check_col($c, 'integer_t', 76); // Clean up $stmtarray = array( - "drop table bind_number_tab" + "drop table bind_number_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_query.phpt b/ext/oci8/tests/bind_query.phpt index f9566627c5..9c1fa3d8d1 100644 --- a/ext/oci8/tests/bind_query.phpt +++ b/ext/oci8/tests/bind_query.phpt @@ -10,10 +10,10 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table bind_query_tab", - "create table bind_query_tab (empno number(4), ename varchar2(10), sal number(7,2))", - "insert into bind_query_tab values (7934, 'MILLER', 1300)", - "insert into bind_query_tab values (7902, 'FORD', 3000)" + "drop table bind_query_tab", + "create table bind_query_tab (empno number(4), ename varchar2(10), sal number(7,2))", + "insert into bind_query_tab values (7934, 'MILLER', 1300)", + "insert into bind_query_tab values (7902, 'FORD', 3000)" ); oci8_test_sql_execute($c, $stmtarray); @@ -56,7 +56,7 @@ while (oci_fetch($s)) { // Clean up $stmtarray = array( - "drop table bind_query_tab" + "drop table bind_query_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_rowid.phpt b/ext/oci8/tests/bind_rowid.phpt index 40e5b5e90e..1652326356 100644 --- a/ext/oci8/tests/bind_rowid.phpt +++ b/ext/oci8/tests/bind_rowid.phpt @@ -9,19 +9,19 @@ require(__DIR__."/connect.inc"); function do_query($c) { - $s = oci_parse($c, 'select address from rid_tab order by id'); - $id = 1; - oci_execute($s, OCI_DEFAULT); - while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { - var_dump($row); - } + $s = oci_parse($c, 'select address from rid_tab order by id'); + $id = 1; + oci_execute($s, OCI_DEFAULT); + while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { + var_dump($row); + } } $stmtarray = array( - "drop table rid_tab", - "create table rid_tab (id number, address varchar2(40))", - "insert into rid_tab (id, address) values (1, 'original text #1')", - "insert into rid_tab (id, address) values (2, 'original text #2')" + "drop table rid_tab", + "create table rid_tab (id number, address varchar2(40))", + "insert into rid_tab (id, address) values (1, 'original text #1')", + "insert into rid_tab (id, address) values (2, 'original text #2')" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_sqltafc.phpt b/ext/oci8/tests/bind_sqltafc.phpt index a858ed5398..8b4fea93bf 100644 --- a/ext/oci8/tests/bind_sqltafc.phpt +++ b/ext/oci8/tests/bind_sqltafc.phpt @@ -10,9 +10,9 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table bind_sqltafc_tab", - "create table bind_sqltafc_tab (id number, char_t char(1), char_t10 char(10), varchar2_t10 varchar2(10), number_t number)", - "insert into bind_sqltafc_tab values (0, 'a', 'abcd', 'efghij', 1.1)" + "drop table bind_sqltafc_tab", + "create table bind_sqltafc_tab (id number, char_t char(1), char_t10 char(10), varchar2_t10 varchar2(10), number_t number)", + "insert into bind_sqltafc_tab values (0, 'a', 'abcd', 'efghij', 1.1)" ); oci8_test_sql_execute($c, $stmtarray); @@ -79,7 +79,7 @@ q($c, 6); // Clean up $stmtarray = array( - "drop table bind_sqltafc_tab" + "drop table bind_sqltafc_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_sqltint.phpt b/ext/oci8/tests/bind_sqltint.phpt index a9d7d954fb..a25265f90a 100644 --- a/ext/oci8/tests/bind_sqltint.phpt +++ b/ext/oci8/tests/bind_sqltint.phpt @@ -10,7 +10,7 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table bind_sqltint_tab", + "drop table bind_sqltint_tab", "create table bind_sqltint_tab ( id number, @@ -208,7 +208,7 @@ var_dump($p2); // Clean up $stmtarray = array( - "drop table bind_sqltint_tab" + "drop table bind_sqltint_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_sqltnum.phpt b/ext/oci8/tests/bind_sqltnum.phpt index 7a13cd45ce..3f8e371ea3 100644 --- a/ext/oci8/tests/bind_sqltnum.phpt +++ b/ext/oci8/tests/bind_sqltnum.phpt @@ -16,7 +16,7 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table bind_sqltnum_tab", + "drop table bind_sqltnum_tab", "create table bind_sqltnum_tab ( id number, @@ -165,7 +165,7 @@ check_col($c, 'number_t92', 50); // Clean up $stmtarray = array( - "drop table bind_sqltnum_tab" + "drop table bind_sqltnum_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bind_sqltnum_11g.phpt b/ext/oci8/tests/bind_sqltnum_11g.phpt index 76b2a553f4..3686127fbc 100644 --- a/ext/oci8/tests/bind_sqltnum_11g.phpt +++ b/ext/oci8/tests/bind_sqltnum_11g.phpt @@ -16,7 +16,7 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table bind_sqltnum_tab", + "drop table bind_sqltnum_tab", "create table bind_sqltnum_tab ( id number, @@ -165,7 +165,7 @@ check_col($c, 'number_t92', 50); // Clean up $stmtarray = array( - "drop table bind_sqltnum_tab" + "drop table bind_sqltnum_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bug27303_1.phpt b/ext/oci8/tests/bug27303_1.phpt index 6310185b7f..a0e254a753 100644 --- a/ext/oci8/tests/bug27303_1.phpt +++ b/ext/oci8/tests/bug27303_1.phpt @@ -37,9 +37,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv); if (!$r) { echo "Bind error"; die; } for ($i = 1; $i < MYLIMIT; $i++) { - $r = OCIExecute($stid, OCI_DEFAULT); - if (!$r) { echo "Execute error"; die; } - var_dump($mybv); + $r = OCIExecute($stid, OCI_DEFAULT); + if (!$r) { echo "Execute error"; die; } + var_dump($mybv); } OCICommit($c); diff --git a/ext/oci8/tests/bug27303_1_11gR1.phpt b/ext/oci8/tests/bug27303_1_11gR1.phpt index 1c9296bef8..35495a81da 100644 --- a/ext/oci8/tests/bug27303_1_11gR1.phpt +++ b/ext/oci8/tests/bug27303_1_11gR1.phpt @@ -35,9 +35,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv); if (!$r) { echo "Bind error"; die; } for ($i = 1; $i < MYLIMIT; $i++) { - $r = OCIExecute($stid, OCI_DEFAULT); - if (!$r) { echo "Execute error"; die; } - var_dump($mybv); + $r = OCIExecute($stid, OCI_DEFAULT); + if (!$r) { echo "Execute error"; die; } + var_dump($mybv); } OCICommit($c); diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt index 039f0e4acc..3674b72486 100644 --- a/ext/oci8/tests/bug27303_2.phpt +++ b/ext/oci8/tests/bug27303_2.phpt @@ -39,9 +39,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv); if (!$r) { echo "Bind error"; die; } for ($i = 1; $i < MYLIMIT; $i++) { - $r = OCIExecute($stid, OCI_DEFAULT); - if (!$r) { echo "Execute error"; die; } - var_dump($mybv); + $r = OCIExecute($stid, OCI_DEFAULT); + if (!$r) { echo "Execute error"; die; } + var_dump($mybv); } OCICommit($c); diff --git a/ext/oci8/tests/bug27303_2_11gR1.phpt b/ext/oci8/tests/bug27303_2_11gR1.phpt index 4c9a175edd..1abb66538a 100644 --- a/ext/oci8/tests/bug27303_2_11gR1.phpt +++ b/ext/oci8/tests/bug27303_2_11gR1.phpt @@ -39,9 +39,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv); if (!$r) { echo "Bind error"; die; } for ($i = 1; $i < MYLIMIT; $i++) { - $r = OCIExecute($stid, OCI_DEFAULT); - if (!$r) { echo "Execute error"; die; } - var_dump($mybv); + $r = OCIExecute($stid, OCI_DEFAULT); + if (!$r) { echo "Execute error"; die; } + var_dump($mybv); } OCICommit($c); diff --git a/ext/oci8/tests/bug27303_3.phpt b/ext/oci8/tests/bug27303_3.phpt index dfc85e08b7..347a1a93d9 100644 --- a/ext/oci8/tests/bug27303_3.phpt +++ b/ext/oci8/tests/bug27303_3.phpt @@ -14,8 +14,8 @@ $create_st[] = "create sequence myseq"; $create_st[] = "create table mytab (mydata varchar2(20), seqcol number)"; foreach ($create_st as $statement) { - $stmt = oci_parse($c, $statement); - @oci_execute($stmt); + $stmt = oci_parse($c, $statement); + @oci_execute($stmt); } define('MYLIMIT', 200); @@ -31,9 +31,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv, 5, SQLT_INT); if (!$r) { echo "Bind error"; die; } for ($i = 1; $i < MYLIMIT; $i++) { - $r = OCIExecute($stid, OCI_DEFAULT); - if (!$r) { echo "Execute error"; die; } - var_dump($mybv); + $r = OCIExecute($stid, OCI_DEFAULT); + if (!$r) { echo "Execute error"; die; } + var_dump($mybv); } OCICommit($c); @@ -43,8 +43,8 @@ $drop_st[] = "drop sequence myseq"; $drop_st[] = "drop table mytab"; foreach ($create_st as $statement) { - $stmt = oci_parse($c, $statement); - oci_execute($stmt); + $stmt = oci_parse($c, $statement); + oci_execute($stmt); } echo "Done\n"; diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt index 5ee7090428..e51f3cdc75 100644 --- a/ext/oci8/tests/bug27303_4.phpt +++ b/ext/oci8/tests/bug27303_4.phpt @@ -36,9 +36,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv, 0 ); if (!$r) { echo "Bind error"; die; } for ($i = 1; $i < MYLIMIT; $i++) { - $r = OCIExecute($stid, OCI_DEFAULT); - if (!$r) { echo "Execute error"; die; } - var_dump($mybv); + $r = OCIExecute($stid, OCI_DEFAULT); + if (!$r) { echo "Execute error"; die; } + var_dump($mybv); } OCICommit($c); diff --git a/ext/oci8/tests/bug27303_4_11gR1.phpt b/ext/oci8/tests/bug27303_4_11gR1.phpt index 290f26d764..bd5e2571fc 100644 --- a/ext/oci8/tests/bug27303_4_11gR1.phpt +++ b/ext/oci8/tests/bug27303_4_11gR1.phpt @@ -34,9 +34,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv, 0 ); if (!$r) { echo "Bind error"; die; } for ($i = 1; $i < MYLIMIT; $i++) { - $r = OCIExecute($stid, OCI_DEFAULT); - if (!$r) { echo "Execute error"; die; } - var_dump($mybv); + $r = OCIExecute($stid, OCI_DEFAULT); + if (!$r) { echo "Execute error"; die; } + var_dump($mybv); } OCICommit($c); diff --git a/ext/oci8/tests/bug32325.phpt b/ext/oci8/tests/bug32325.phpt index 1dbe8cc6ce..3665f01edc 100644 --- a/ext/oci8/tests/bug32325.phpt +++ b/ext/oci8/tests/bug32325.phpt @@ -23,8 +23,8 @@ oci8_test_sql_execute($c, $stmtarray); $collection = oci_new_collection($c, "BUG32325_T"); $sql = "begin - select bug32325_t(1,2,3,4) into :list from dual; - end;"; + select bug32325_t(1,2,3,4) into :list from dual; + end;"; $stmt = oci_parse($c, $sql); diff --git a/ext/oci8/tests/bug36010.phpt b/ext/oci8/tests/bug36010.phpt index 83288dd355..0947d3f6fb 100644 --- a/ext/oci8/tests/bug36010.phpt +++ b/ext/oci8/tests/bug36010.phpt @@ -12,11 +12,11 @@ require __DIR__.'/connect.inc'; function f($conn) { - $sql = "begin :p_clob := 'lob string'; end;"; - $stid = oci_parse($conn, $sql); - $clob = oci_new_descriptor($conn, OCI_D_LOB); - oci_bind_by_name($stid, ":p_clob", $clob, -1, OCI_B_CLOB); - $r = oci_execute($stid, OCI_DEFAULT); + $sql = "begin :p_clob := 'lob string'; end;"; + $stid = oci_parse($conn, $sql); + $clob = oci_new_descriptor($conn, OCI_D_LOB); + oci_bind_by_name($stid, ":p_clob", $clob, -1, OCI_B_CLOB); + $r = oci_execute($stid, OCI_DEFAULT); } f($c); diff --git a/ext/oci8/tests/bug36096.phpt b/ext/oci8/tests/bug36096.phpt index 1cf5e9106c..eba558e08c 100644 --- a/ext/oci8/tests/bug36096.phpt +++ b/ext/oci8/tests/bug36096.phpt @@ -11,10 +11,10 @@ $sql = "SELECT 'ABC' FROM DUAL WHERE 1<>1"; $stmt = oci_parse($c, $sql); if(oci_execute($stmt, OCI_COMMIT_ON_SUCCESS)){ - var_dump(oci_fetch($stmt)); - var_dump(oci_result($stmt, 1)); - var_dump(oci_field_name($stmt, 1)); - var_dump(oci_field_type($stmt, 1)); + var_dump(oci_fetch($stmt)); + var_dump(oci_result($stmt, 1)); + var_dump(oci_field_name($stmt, 1)); + var_dump(oci_field_type($stmt, 1)); } echo "Done\n"; diff --git a/ext/oci8/tests/bug36403.phpt b/ext/oci8/tests/bug36403.phpt index ed7fad889a..60819aa423 100644 --- a/ext/oci8/tests/bug36403.phpt +++ b/ext/oci8/tests/bug36403.phpt @@ -12,8 +12,8 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table bug36403_tab", - "create table bug36403_tab (c1 number, col2 number, column3 number, col4 number)" + "drop table bug36403_tab", + "create table bug36403_tab (c1 number, col2 number, column3 number, col4 number)" ); oci8_test_sql_execute($c, $stmtarray); @@ -25,7 +25,7 @@ echo "Test 1\n"; $s = oci_parse($c, "select * from bug36403_tab"); oci_execute($s, OCI_DESCRIBE_ONLY); for ($i = oci_num_fields($s); $i > 0; $i--) { - echo oci_field_name($s, $i) . "\n"; + echo oci_field_name($s, $i) . "\n"; } echo "Test 2\n"; @@ -37,7 +37,7 @@ $row = oci_fetch_array($s); // Clean up $stmtarray = array( - "drop table bug36403_tab" + "drop table bug36403_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bug37220.phpt b/ext/oci8/tests/bug37220.phpt index 11ee2b23b6..ce0ac0a503 100644 --- a/ext/oci8/tests/bug37220.phpt +++ b/ext/oci8/tests/bug37220.phpt @@ -13,8 +13,8 @@ require __DIR__.'/connect.inc'; // Initialization $stmtarray = array( - "create table bug37220_tab( mycolumn xmltype not null)", - "insert into bug37220_tab values(xmltype('<THETAG myID=\"1234\"></THETAG>'))" + "create table bug37220_tab( mycolumn xmltype not null)", + "insert into bug37220_tab values(xmltype('<THETAG myID=\"1234\"></THETAG>'))" ); oci8_test_sql_execute($c, $stmtarray); @@ -24,8 +24,8 @@ oci8_test_sql_execute($c, $stmtarray); // bug37220_tab a normal Oracle table) $query = "UPDATE bug37220_tab - SET bug37220_tab.mycolumn = updateXML(bug37220_tab.mycolumn,'/THETAG',xmltype.createXML(:data)) - WHERE existsNode(bug37220_tab.mycolumn,'/THETAG[@myID=\"1234\"]') = 1"; + SET bug37220_tab.mycolumn = updateXML(bug37220_tab.mycolumn,'/THETAG',xmltype.createXML(:data)) + WHERE existsNode(bug37220_tab.mycolumn,'/THETAG[@myID=\"1234\"]') = 1"; $stmt = oci_parse ($c, $query); $clob = oci_new_descriptor($c, OCI_D_LOB); oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB); @@ -42,16 +42,16 @@ $stmt = oci_parse ($c, $query); oci_execute($stmt); while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) { - foreach ($row as $item) { - echo trim($item)."\n"; - } - echo "\n"; + foreach ($row as $item) { + echo trim($item)."\n"; + } + echo "\n"; } // Cleanup $stmtarray = array( - "drop table bug37220_tab" + "drop table bug37220_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bug38173.phpt b/ext/oci8/tests/bug38173.phpt index 2d4cb7c33b..087e6a7485 100644 --- a/ext/oci8/tests/bug38173.phpt +++ b/ext/oci8/tests/bug38173.phpt @@ -26,15 +26,15 @@ oci_execute($s1); oci_execute($s2); for($i=0; $i < 5; $i++) { - $insert = "INSERT INTO t1 VALUES(".$i.")"; - $s = oci_parse($c, $insert); - oci_execute($s); + $insert = "INSERT INTO t1 VALUES(".$i.")"; + $s = oci_parse($c, $insert); + oci_execute($s); } for($i=0; $i < 5; $i++) { - $insert = "INSERT INTO t2 VALUES(".$i.")"; - $s = oci_parse($c, $insert); - oci_execute($s); + $insert = "INSERT INTO t2 VALUES(".$i.")"; + $s = oci_parse($c, $insert); + oci_execute($s); } $query =" diff --git a/ext/oci8/tests/bug41069.phpt b/ext/oci8/tests/bug41069.phpt index af322ba7d1..49d2905a4d 100644 --- a/ext/oci8/tests/bug41069.phpt +++ b/ext/oci8/tests/bug41069.phpt @@ -10,46 +10,46 @@ if ($test_drcp) die("skip DRCP does not support shared database links"); --INI-- oci8.default_prefetch=5 --FILE-- - <?php + <?php - require(__DIR__.'/connect.inc'); + require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "alter session set nls_date_format = 'MM/DD/YYYY'", + "alter session set nls_date_format = 'MM/DD/YYYY'", - "drop database link bug41069_dblink", + "drop database link bug41069_dblink", - "drop table bug41069_tab", + "drop table bug41069_tab", - "create shared database link bug41069_dblink authenticated by $user identified by $password using '$dbase'", + "create shared database link bug41069_dblink authenticated by $user identified by $password using '$dbase'", - "create table bug41069_tab - ( - c1 number(20), - c2 varchar2(60 byte), - c3 varchar2(1000 byte), - c4 varchar2(255 byte), - c5 varchar2(2 byte), - c6 varchar2(1 byte), - c7 varchar2(255 byte), - c8 varchar2(50 byte), - c9 date, - c10 date, - c12 number(20), - c13 varchar2(20 byte), - c15 varchar2(50 byte) - )", + "create table bug41069_tab + ( + c1 number(20), + c2 varchar2(60 byte), + c3 varchar2(1000 byte), + c4 varchar2(255 byte), + c5 varchar2(2 byte), + c6 varchar2(1 byte), + c7 varchar2(255 byte), + c8 varchar2(50 byte), + c9 date, + c10 date, + c12 number(20), + c13 varchar2(20 byte), + c15 varchar2(50 byte) + )", - "insert into bug41069_tab (c1, c2, c5, c6, c9, c10, c12, c15) values - (111, 'aaaaaaa', 'b', 'c', '01/17/2008', '01/07/2017', 2222, 'zzzzzzzzzz')", + "insert into bug41069_tab (c1, c2, c5, c6, c9, c10, c12, c15) values + (111, 'aaaaaaa', 'b', 'c', '01/17/2008', '01/07/2017', 2222, 'zzzzzzzzzz')", - "insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c13, c15) values - (112, 'aaaaaaa', 'bbbbbbbb', 'ccccccc', 'd', 'e', 'rrrrrrr', '04/16/2007', '04/16/2007', 2223, 'xxxxxxxx', 'zzzzzzzz')", + "insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c13, c15) values + (112, 'aaaaaaa', 'bbbbbbbb', 'ccccccc', 'd', 'e', 'rrrrrrr', '04/16/2007', '04/16/2007', 2223, 'xxxxxxxx', 'zzzzzzzz')", - "insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c15) values - (113, 'aaaaaaa', 'bbbbbbbbbb', 'cccccc', 'e', 'f', 'dddd', '12/04/2006', '12/04/2006', 2224, 'zzzzzzz')" + "insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c15) values + (113, 'aaaaaaa', 'bbbbbbbbbb', 'cccccc', 'e', 'f', 'dddd', '12/04/2006', '12/04/2006', 2224, 'zzzzzzz')" ); oci8_test_sql_execute($c, $stmtarray); @@ -74,8 +74,8 @@ var_dump($results); $c = oci_new_connect($user, $password, $dbase); $stmtarray = array( - "drop database link bug41069_dblink", - "drop table bug41069_tab" + "drop database link bug41069_dblink", + "drop table bug41069_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bug42134.phpt b/ext/oci8/tests/bug42134.phpt index d1e0b97c84..13273cff8f 100644 --- a/ext/oci8/tests/bug42134.phpt +++ b/ext/oci8/tests/bug42134.phpt @@ -13,49 +13,49 @@ require(__DIR__.'/details.inc'); // Test collection creation error for normal connection if (!empty($dbase)) { - $c = oci_connect($user,$password,$dbase); + $c = oci_connect($user,$password,$dbase); } else { - $c = oci_connect($user,$password); + $c = oci_connect($user,$password); } $collection = oci_new_collection($c, "ABC"); if (!$collection) { - echo "Normal connection: New Collection error\n"; - $m = oci_error($c); - var_dump($m); + echo "Normal connection: New Collection error\n"; + $m = oci_error($c); + var_dump($m); } // Test collection creation error for new connection if (!empty($dbase)) { - $c = oci_new_connect($user,$password,$dbase); + $c = oci_new_connect($user,$password,$dbase); } else { - $c = oci_new_connect($user,$password); + $c = oci_new_connect($user,$password); } $collection = oci_new_collection($c, "DEF"); if (!$collection) { - echo "New connection: New Collection error\n"; - $m = oci_error($c); - var_dump($m); + echo "New connection: New Collection error\n"; + $m = oci_error($c); + var_dump($m); } // Test collection creation error for persistent connection if (!empty($dbase)) { - $c = oci_pconnect($user,$password,$dbase); + $c = oci_pconnect($user,$password,$dbase); } else { - $c = oci_pconnect($user,$password); + $c = oci_pconnect($user,$password); } $collection = oci_new_collection($c, "GHI"); if (!$collection) { - echo "Persistent connection: New Collection error\n"; - $m = oci_error($c); - var_dump($m); + echo "Persistent connection: New Collection error\n"; + $m = oci_error($c); + var_dump($m); } echo "Done\n"; diff --git a/ext/oci8/tests/bug42173.phpt b/ext/oci8/tests/bug42173.phpt index 33e1adaae4..9c6b4996e2 100644 --- a/ext/oci8/tests/bug42173.phpt +++ b/ext/oci8/tests/bug42173.phpt @@ -38,8 +38,8 @@ interval'1 2:20:20.123' day to second, interval'1 2:20:20.12345' day to second)"); foreach ($stmts as $sql) { - $s = oci_parse($c, $sql); - $r = @oci_execute($s); + $s = oci_parse($c, $sql); + $r = @oci_execute($s); } $s = oci_parse($c, "select * from ts_test"); @@ -48,14 +48,14 @@ $row = oci_fetch_array($s, OCI_ASSOC); var_dump($row); foreach ($row as $name => $field) { - echo "\nColumn $name\n"; - var_dump(oci_field_is_null($s, $name)); - var_dump(oci_field_name($s, $name)); - var_dump(oci_field_type($s, $name)); - var_dump(oci_field_type_raw($s, $name)); - var_dump(oci_field_scale($s, $name)); - var_dump(oci_field_precision($s, $name)); - var_dump(oci_field_size($s, $name)); + echo "\nColumn $name\n"; + var_dump(oci_field_is_null($s, $name)); + var_dump(oci_field_name($s, $name)); + var_dump(oci_field_type($s, $name)); + var_dump(oci_field_type_raw($s, $name)); + var_dump(oci_field_scale($s, $name)); + var_dump(oci_field_precision($s, $name)); + var_dump(oci_field_size($s, $name)); } // Cleanup diff --git a/ext/oci8/tests/bug42496_1.phpt b/ext/oci8/tests/bug42496_1.phpt index b3d6cf0203..9db7d720e9 100644 --- a/ext/oci8/tests/bug42496_1.phpt +++ b/ext/oci8/tests/bug42496_1.phpt @@ -14,11 +14,11 @@ require __DIR__.'/connect.inc'; // Initialization $stmtarray = array( - "DROP table bug42496_1_tab", - "CREATE table bug42496_1_tab(c1 CLOB, c2 CLOB)", - "INSERT INTO bug42496_1_tab VALUES('test1', 'test1')", - "INSERT INTO bug42496_1_tab VALUES('test2', 'test2')", - "INSERT INTO bug42496_1_tab VALUES('test3', 'test3')" + "DROP table bug42496_1_tab", + "CREATE table bug42496_1_tab(c1 CLOB, c2 CLOB)", + "INSERT INTO bug42496_1_tab VALUES('test1', 'test1')", + "INSERT INTO bug42496_1_tab VALUES('test2', 'test2')", + "INSERT INTO bug42496_1_tab VALUES('test3', 'test3')" ); oci8_test_sql_execute($c, $stmtarray); @@ -28,17 +28,17 @@ oci8_test_sql_execute($c, $stmtarray); echo "Test 1\n"; for ($i = 0; $i < 15000; $i++) { - $s = oci_parse($c, "SELECT * from bug42496_1_tab"); - oci_define_by_name($s, "C1", $col1); - oci_define_by_name($s, "C2", $col2); - if (oci_execute($s)) { - $arr = array(); - while ($arr = oci_fetch_assoc($s)) { - $arr['C1']->free(); - $arr['C2']->free(); - } - } - oci_free_statement($s); + $s = oci_parse($c, "SELECT * from bug42496_1_tab"); + oci_define_by_name($s, "C1", $col1); + oci_define_by_name($s, "C2", $col2); + if (oci_execute($s)) { + $arr = array(); + while ($arr = oci_fetch_assoc($s)) { + $arr['C1']->free(); + $arr['C2']->free(); + } + } + oci_free_statement($s); } echo "Done\n"; @@ -46,7 +46,7 @@ echo "Done\n"; // Cleanup $stmtarray = array( - "DROP table bug42496_1_tab" + "DROP table bug42496_1_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bug42496_2.phpt b/ext/oci8/tests/bug42496_2.phpt index bcb4076601..52c42f8bcf 100644 --- a/ext/oci8/tests/bug42496_2.phpt +++ b/ext/oci8/tests/bug42496_2.phpt @@ -14,11 +14,11 @@ require __DIR__.'/connect.inc'; // Initialization $stmtarray = array( - "DROP table bug42496_2_tab", - "CREATE table bug42496_2_tab(c1 CLOB, c2 CLOB)", - "INSERT INTO bug42496_2_tab VALUES('test1', 'test1')", - "INSERT INTO bug42496_2_tab VALUES('test2', 'test2')", - "INSERT INTO bug42496_2_tab VALUES('test3', 'test3')" + "DROP table bug42496_2_tab", + "CREATE table bug42496_2_tab(c1 CLOB, c2 CLOB)", + "INSERT INTO bug42496_2_tab VALUES('test1', 'test1')", + "INSERT INTO bug42496_2_tab VALUES('test2', 'test2')", + "INSERT INTO bug42496_2_tab VALUES('test3', 'test3')" ); oci8_test_sql_execute($c, $stmtarray); @@ -28,15 +28,15 @@ oci8_test_sql_execute($c, $stmtarray); echo "Test 2\n"; for ($i = 0; $i < 15000; $i++) { - $s = oci_parse($c, "SELECT * from bug42496_2_tab"); - if (oci_execute($s)) { - $arr = array(); - while ($arr = oci_fetch_assoc($s)) { - $arr['C1']->free(); - $arr['C2']->free(); - } - } - oci_free_statement($s); + $s = oci_parse($c, "SELECT * from bug42496_2_tab"); + if (oci_execute($s)) { + $arr = array(); + while ($arr = oci_fetch_assoc($s)) { + $arr['C1']->free(); + $arr['C2']->free(); + } + } + oci_free_statement($s); } echo "Done\n"; @@ -44,7 +44,7 @@ echo "Done\n"; // Cleanup $stmtarray = array( - "DROP table bug42496_2_tab" + "DROP table bug42496_2_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bug43497.phpt b/ext/oci8/tests/bug43497.phpt index 29ff9e6a5c..45325f6b44 100644 --- a/ext/oci8/tests/bug43497.phpt +++ b/ext/oci8/tests/bug43497.phpt @@ -18,8 +18,8 @@ function sessionid($c) // determines and returns current session ID $stmt = oci_parse($c, $query); if (oci_execute($stmt, OCI_DEFAULT)) { - $row = oci_fetch($stmt); - return oci_result($stmt, 1); + $row = oci_fetch($stmt); + return oci_result($stmt, 1); } return null; @@ -33,10 +33,10 @@ function templobs($c, $sid) // returns number of temporary LOBs $stmt = oci_parse($c, $query); if (oci_execute($stmt, OCI_DEFAULT)) { - $row = oci_fetch($stmt); - $val = oci_result($stmt, 1); - oci_free_statement($stmt); - return $val; + $row = oci_fetch($stmt); + $val = oci_result($stmt, 1); + oci_free_statement($stmt); + return $val; } return null; } @@ -47,14 +47,14 @@ function readxmltab_ex($c) { $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab"); - $cntchk = 0; - if (oci_execute($stmt)) { - while ($result = oci_fetch_array($stmt, OCI_NUM)) { - $result[0]->free(); // cleanup properly - ++$cntchk; - } - } - echo "Loop count check = $cntchk\n"; + $cntchk = 0; + if (oci_execute($stmt)) { + while ($result = oci_fetch_array($stmt, OCI_NUM)) { + $result[0]->free(); // cleanup properly + ++$cntchk; + } + } + echo "Loop count check = $cntchk\n"; } // Read all XML data using explicit LOB locator but without freeing the temp lobs @@ -62,13 +62,13 @@ function readxmltab_ex_nofree($c) { $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab"); - $cntchk = 0; - if (oci_execute($stmt)) { - while ($result = oci_fetch_array($stmt, OCI_NUM)) { - ++$cntchk; - } - } - echo "Loop count check = $cntchk\n"; + $cntchk = 0; + if (oci_execute($stmt)) { + while ($result = oci_fetch_array($stmt, OCI_NUM)) { + ++$cntchk; + } + } + echo "Loop count check = $cntchk\n"; } // Read all XML data using implicit LOB locator @@ -76,18 +76,18 @@ function readxmltab_im($c) { $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab"); - $cntchk = 0; - if (oci_execute($stmt)) { - while ($result = oci_fetch_array($stmt, OCI_NUM+OCI_RETURN_LOBS)) { - ++$cntchk; - } - } - echo "Loop count check = $cntchk\n"; + $cntchk = 0; + if (oci_execute($stmt)) { + while ($result = oci_fetch_array($stmt, OCI_NUM+OCI_RETURN_LOBS)) { + ++$cntchk; + } + } + echo "Loop count check = $cntchk\n"; } function createxmltab($c) // create table w/ field of XML type { - @dropxmltab($c); + @dropxmltab($c); $stmt = oci_parse($c, "create table bug43497_tab (id number primary key, xml xmltype)"); oci_execute($stmt); } @@ -101,31 +101,31 @@ function dropxmltab($c) // delete table function fillxmltab($c) { - for ($id = 1; $id <= 100; $id++) { - - // create an XML element string with random data - $s = "<data>"; - for ($j = 0; $j < 128; $j++) { - $s .= rand(); - } - $s .= "</data>\n"; - for ($j = 0; $j < 4; $j++) { - $s .= $s; - } - $data = "<?xml version=\"1.0\"?><records>" . $s . "</records>"; - - // insert XML data into database - - $stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))"); - oci_bind_by_name($stmt, ":id", $id); - $clob = oci_new_descriptor($c, OCI_D_LOB); - oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB); - $clob->writetemporary($data); - oci_execute($stmt); - - $clob->close(); - $clob->free(); - } + for ($id = 1; $id <= 100; $id++) { + + // create an XML element string with random data + $s = "<data>"; + for ($j = 0; $j < 128; $j++) { + $s .= rand(); + } + $s .= "</data>\n"; + for ($j = 0; $j < 4; $j++) { + $s .= $s; + } + $data = "<?xml version=\"1.0\"?><records>" . $s . "</records>"; + + // insert XML data into database + + $stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))"); + oci_bind_by_name($stmt, ":id", $id); + $clob = oci_new_descriptor($c, OCI_D_LOB); + oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB); + $clob->writetemporary($data); + oci_execute($stmt); + + $clob->close(); + $clob->free(); + } } diff --git a/ext/oci8/tests/bug44008.phpt b/ext/oci8/tests/bug44008.phpt index 0b031aef90..faf26f472e 100644 --- a/ext/oci8/tests/bug44008.phpt +++ b/ext/oci8/tests/bug44008.phpt @@ -13,9 +13,9 @@ require __DIR__.'/connect.inc'; // Initialization $stmtarray = array( - "create or replace procedure bug44008_proc (p in out clob) - as begin p := 'A'; - end;" + "create or replace procedure bug44008_proc (p in out clob) + as begin p := 'A'; + end;" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bug44113.phpt b/ext/oci8/tests/bug44113.phpt index ec6668db3d..ca2a03e914 100644 --- a/ext/oci8/tests/bug44113.phpt +++ b/ext/oci8/tests/bug44113.phpt @@ -14,7 +14,7 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "create or replace type bug44113_list_t as table of number" + "create or replace type bug44113_list_t as table of number" ); oci8_test_sql_execute($c, $stmtarray); @@ -24,10 +24,10 @@ oci8_test_sql_execute($c, $stmtarray); // timeout limit on slow networks. for ($x = 0; $x < 70000; $x++) { - if (!($var = oci_new_collection($c, 'BUG44113_LIST_T'))) { - print "Failed new collection creation on $x\n"; - break; - } + if (!($var = oci_new_collection($c, 'BUG44113_LIST_T'))) { + print "Failed new collection creation on $x\n"; + break; + } } print "Completed $x\n"; @@ -35,7 +35,7 @@ print "Completed $x\n"; // Cleanup $stmtarray = array( - "drop type bug44113_list_t" + "drop type bug44113_list_t" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bug44206.phpt b/ext/oci8/tests/bug44206.phpt index 069a840423..2b051771e2 100644 --- a/ext/oci8/tests/bug44206.phpt +++ b/ext/oci8/tests/bug44206.phpt @@ -14,24 +14,24 @@ require __DIR__.'/connect.inc'; for ($x = 0; $x < 400; $x++) { - $stmt = "select cursor (select $x from dual) a, - cursor (select $x from dual) b - from dual"; - $s = oci_parse($c, $stmt); - $r = oci_execute($s); + $stmt = "select cursor (select $x from dual) a, + cursor (select $x from dual) b + from dual"; + $s = oci_parse($c, $stmt); + $r = oci_execute($s); if (!$r) { echo "Exiting $x\n"; exit; } - $mode = OCI_ASSOC | OCI_RETURN_NULLS; - $result = oci_fetch_array($s, $mode); - oci_execute($result['A']); - oci_execute($result['B']); - oci_fetch_array($result['A'], $mode); - oci_fetch_array($result['B'], $mode); - oci_free_statement($result['A']); - oci_free_statement($result['B']); - oci_free_statement($s); + $mode = OCI_ASSOC | OCI_RETURN_NULLS; + $result = oci_fetch_array($s, $mode); + oci_execute($result['A']); + oci_execute($result['B']); + oci_fetch_array($result['A'], $mode); + oci_fetch_array($result['B'], $mode); + oci_free_statement($result['A']); + oci_free_statement($result['B']); + oci_free_statement($s); } echo "Completed $x\n"; diff --git a/ext/oci8/tests/bug46994.phpt b/ext/oci8/tests/bug46994.phpt index e7208904f8..ace65b8bd2 100644 --- a/ext/oci8/tests/bug46994.phpt +++ b/ext/oci8/tests/bug46994.phpt @@ -13,15 +13,15 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "create or replace procedure bug46994_proc1(p1 in out nocopy clob) is - begin - dbms_lob.trim(p1, 0); - dbms_lob.writeappend(p1, 26, 'This should be the output.'); + "create or replace procedure bug46994_proc1(p1 in out nocopy clob) is + begin + dbms_lob.trim(p1, 0); + dbms_lob.writeappend(p1, 26, 'This should be the output.'); end bug46994_proc1;", - "create or replace procedure bug46994_proc2(p1 in out nocopy clob) is - begin - dbms_lob.trim(p1, 0); - dbms_lob.writeappend(p1, 37, 'The output should be even longer now.'); + "create or replace procedure bug46994_proc2(p1 in out nocopy clob) is + begin + dbms_lob.trim(p1, 0); + dbms_lob.writeappend(p1, 37, 'The output should be even longer now.'); end bug46994_proc2;" ); @@ -60,8 +60,8 @@ var_dump($myclob->load()); // Use cached size code path // Cleanup $stmtarray = array( - "drop procedure bug46994_proc1", - "drop procedure bug46994_proc2" + "drop procedure bug46994_proc1", + "drop procedure bug46994_proc2" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bug68298.phpt b/ext/oci8/tests/bug68298.phpt index fae4a4f2fe..f0fc201bb5 100644 --- a/ext/oci8/tests/bug68298.phpt +++ b/ext/oci8/tests/bug68298.phpt @@ -11,8 +11,8 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); require(__DIR__.'/connect.inc'); $stmtarray = array( - "DROP TABLE BUG68298", - "CREATE TABLE BUG68298 (COL1 NUMBER(20))" + "DROP TABLE BUG68298", + "CREATE TABLE BUG68298 (COL1 NUMBER(20))" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/bug71422.phpt b/ext/oci8/tests/bug71422.phpt index 48341a4ccb..798981ed0b 100644 --- a/ext/oci8/tests/bug71422.phpt +++ b/ext/oci8/tests/bug71422.phpt @@ -10,9 +10,9 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(__DIR__.'/connect.inc'); $stmtarray = array( - "DROP TABLE BUG71422_TEST", - "CREATE TABLE BUG71422_TEST (TEST_ID NUMBER(*,0) NOT NULL, LABEL VARCHAR2(50 CHAR), CONSTRAINT BUG71422_TEST_PK PRIMARY KEY (TEST_ID))", - "INSERT INTO BUG71422_TEST (TEST_ID, LABEL) VALUES (1, 'Foo')" + "DROP TABLE BUG71422_TEST", + "CREATE TABLE BUG71422_TEST (TEST_ID NUMBER(*,0) NOT NULL, LABEL VARCHAR2(50 CHAR), CONSTRAINT BUG71422_TEST_PK PRIMARY KEY (TEST_ID))", + "INSERT INTO BUG71422_TEST (TEST_ID, LABEL) VALUES (1, 'Foo')" ); oci8_test_sql_execute($c, $stmtarray); @@ -20,7 +20,7 @@ oci8_test_sql_execute($c, $stmtarray); $stmt = oci_parse($c, 'SELECT LABEL AS RAW_QUERY FROM BUG71422_TEST WHERE TEST_ID=1'); oci_execute($stmt); while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) { - var_dump($row); + var_dump($row); } $stmt = oci_parse($c, 'SELECT LABEL AS NUMERIC_BIND_PARAMETER FROM BUG71422_TEST WHERE TEST_ID=:test_id'); @@ -28,7 +28,7 @@ $value = 1; oci_bind_by_name($stmt, ':test_id', $value, -1, SQLT_INT); oci_execute($stmt); while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) { - var_dump($row); + var_dump($row); } $stmt = oci_parse($c, 'SELECT LABEL AS STRING_BIND_PARAMETER FROM BUG71422_TEST WHERE TEST_ID=:test_id'); @@ -36,13 +36,13 @@ $value = 1; oci_bind_by_name($stmt, ':test_id', $value, -1, SQLT_CHR); oci_execute($stmt); while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) { - var_dump($row); + var_dump($row); } // Cleanup $stmtarray = array( - "DROP TABLE BUG71422_TEST" + "DROP TABLE BUG71422_TEST" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/coll_009.phpt b/ext/oci8/tests/coll_009.phpt index e55a4a210c..2707fbccf7 100644 --- a/ext/oci8/tests/coll_009.phpt +++ b/ext/oci8/tests/coll_009.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_009_func.phpt b/ext/oci8/tests/coll_009_func.phpt index fca04599e2..5b3e08579a 100644 --- a/ext/oci8/tests/coll_009_func.phpt +++ b/ext/oci8/tests/coll_009_func.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_010.phpt b/ext/oci8/tests/coll_010.phpt index 33e1b6fd18..42bd788a81 100644 --- a/ext/oci8/tests/coll_010.phpt +++ b/ext/oci8/tests/coll_010.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_010_func.phpt b/ext/oci8/tests/coll_010_func.phpt index 2f67283538..9ef6c22250 100644 --- a/ext/oci8/tests/coll_010_func.phpt +++ b/ext/oci8/tests/coll_010_func.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_011.phpt b/ext/oci8/tests/coll_011.phpt index 13c4613b00..562de0889f 100644 --- a/ext/oci8/tests/coll_011.phpt +++ b/ext/oci8/tests/coll_011.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_011_func.phpt b/ext/oci8/tests/coll_011_func.phpt index bc6bd6ea73..ca43336ffc 100644 --- a/ext/oci8/tests/coll_011_func.phpt +++ b/ext/oci8/tests/coll_011_func.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_012.phpt b/ext/oci8/tests/coll_012.phpt index 615a3aad7a..be0439e8ba 100644 --- a/ext/oci8/tests/coll_012.phpt +++ b/ext/oci8/tests/coll_012.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_012_func.phpt b/ext/oci8/tests/coll_012_func.phpt index 41a7084109..fa6a026d16 100644 --- a/ext/oci8/tests/coll_012_func.phpt +++ b/ext/oci8/tests/coll_012_func.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_013.phpt b/ext/oci8/tests/coll_013.phpt index ef3af0a8e7..1e943bf57e 100644 --- a/ext/oci8/tests/coll_013.phpt +++ b/ext/oci8/tests/coll_013.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_013_func.phpt b/ext/oci8/tests/coll_013_func.phpt index bb6d7083e3..417bfdb18f 100644 --- a/ext/oci8/tests/coll_013_func.phpt +++ b/ext/oci8/tests/coll_013_func.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_014.phpt b/ext/oci8/tests/coll_014.phpt index 0af0ead329..697d306818 100644 --- a/ext/oci8/tests/coll_014.phpt +++ b/ext/oci8/tests/coll_014.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_014_func.phpt b/ext/oci8/tests/coll_014_func.phpt index 24b0bbf8ba..fc9df35a7c 100644 --- a/ext/oci8/tests/coll_014_func.phpt +++ b/ext/oci8/tests/coll_014_func.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_015.phpt b/ext/oci8/tests/coll_015.phpt index 2ed2375ecc..d3bffd2fe5 100644 --- a/ext/oci8/tests/coll_015.phpt +++ b/ext/oci8/tests/coll_015.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_015_func.phpt b/ext/oci8/tests/coll_015_func.phpt index a9c16aec01..3685a28b96 100644 --- a/ext/oci8/tests/coll_015_func.phpt +++ b/ext/oci8/tests/coll_015_func.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_016.phpt b/ext/oci8/tests/coll_016.phpt index 80059688b3..d4b19efb43 100644 --- a/ext/oci8/tests/coll_016.phpt +++ b/ext/oci8/tests/coll_016.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_016_func.phpt b/ext/oci8/tests/coll_016_func.phpt index da26428d8d..95ed0588dc 100644 --- a/ext/oci8/tests/coll_016_func.phpt +++ b/ext/oci8/tests/coll_016_func.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_017.phpt b/ext/oci8/tests/coll_017.phpt index 81fdfb2553..0bd730934f 100644 --- a/ext/oci8/tests/coll_017.phpt +++ b/ext/oci8/tests/coll_017.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/coll_017_func.phpt b/ext/oci8/tests/coll_017_func.phpt index c582eb0f8d..e3d9be2a43 100644 --- a/ext/oci8/tests/coll_017_func.phpt +++ b/ext/oci8/tests/coll_017_func.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require __DIR__."/connect.inc"; $ora_sql = "DROP TYPE - ".$type_name." - "; + ".$type_name." + "; $statement = OCIParse($c,$ora_sql); @OCIExecute($statement); diff --git a/ext/oci8/tests/commit_001.phpt b/ext/oci8/tests/commit_001.phpt index de4682eefc..d99a6b3cbf 100644 --- a/ext/oci8/tests/commit_001.phpt +++ b/ext/oci8/tests/commit_001.phpt @@ -14,20 +14,20 @@ require(__DIR__.'/create_table.inc'); $insert_sql = "insert into ".$schema.$table_name." (id, value) values (1,1)"; if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); + die("oci_parse(insert) failed!\n"); } /* check with OCI_NO_AUTO_COMMIT mode */ for ($i = 0; $i<3; $i++) { - if (!oci_execute($s, OCI_NO_AUTO_COMMIT)) { - die("oci_execute(insert) failed!\n"); - } + if (!oci_execute($s, OCI_NO_AUTO_COMMIT)) { + die("oci_execute(insert) failed!\n"); + } } for ($i = 0; $i<3; $i++) { - if (!oci_execute($s, OCI_DEFAULT)) { - die("oci_execute(insert) failed!\n"); - } + if (!oci_execute($s, OCI_DEFAULT)) { + die("oci_execute(insert) failed!\n"); + } } @@ -36,19 +36,19 @@ var_dump(oci_rollback($c)); $select_sql = "select * from ".$schema.$table_name.""; if (!($select = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } /* oci_fetch_all */ if (!oci_execute($select)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } var_dump(oci_fetch_all($select, $all)); var_dump($all); /* ocifetchstatement */ if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } $insert_sql = "insert into ".$schema.$table_name." (id, value) values (1,1)"; @@ -67,7 +67,7 @@ var_dump(oci_commit($c)); /* oci_fetch_all */ if (!oci_execute($select)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } var_dump(oci_fetch_all($select, $all)); var_dump($all); diff --git a/ext/oci8/tests/commit_002.phpt b/ext/oci8/tests/commit_002.phpt index 143b0077fe..4696f3b556 100644 --- a/ext/oci8/tests/commit_002.phpt +++ b/ext/oci8/tests/commit_002.phpt @@ -13,8 +13,8 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table commit_002_tab", - "create table commit_002_tab + "drop table commit_002_tab", + "create table commit_002_tab ( x int constraint commit_002_tab_check_x check ( x > 0 ) deferrable initially immediate, y int constraint commit_002_tab_check_y check ( y > 0 ) deferrable initially deferred)" ); @@ -54,7 +54,7 @@ if (!$r) { // Clean up $stmtarray = array( - "drop table commit_002_tab" + "drop table commit_002_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/commit_old.phpt b/ext/oci8/tests/commit_old.phpt index 658cfd24b3..bfbae9b597 100644 --- a/ext/oci8/tests/commit_old.phpt +++ b/ext/oci8/tests/commit_old.phpt @@ -14,13 +14,13 @@ require __DIR__.'/create_table.inc'; $insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; if (!($s = ociparse($c, $insert_sql))) { - die("ociparse(insert) failed!\n"); + die("ociparse(insert) failed!\n"); } for ($i = 0; $i<3; $i++) { - if (!ociexecute($s, OCI_DEFAULT)) { - die("ociexecute(insert) failed!\n"); - } + if (!ociexecute($s, OCI_DEFAULT)) { + die("ociexecute(insert) failed!\n"); + } } var_dump(ocirollback($c)); @@ -28,18 +28,18 @@ var_dump(ocirollback($c)); $select_sql = "SELECT * FROM ".$schema.$table_name.""; if (!($select = ociparse($c, $select_sql))) { - die("ociparse(select) failed!\n"); + die("ociparse(select) failed!\n"); } if (!oci_execute($select)) { - die("ociexecute(select) failed!\n"); + die("ociexecute(select) failed!\n"); } var_dump(ocifetchstatement($select, $all)); var_dump($all); /* ocifetchstatement */ if (!ociexecute($s)) { - die("ociexecute(select) failed!\n"); + die("ociexecute(select) failed!\n"); } $insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; @@ -57,7 +57,7 @@ for ($i = 0; $i<3; $i++) { var_dump(ocicommit($c)); if (!ociexecute($select)) { - die("ociexecute(select) failed!\n"); + die("ociexecute(select) failed!\n"); } var_dump(ocifetchstatement($select, $all)); var_dump($all); diff --git a/ext/oci8/tests/conn_attr.inc b/ext/oci8/tests/conn_attr.inc index f05f3bc064..c2e3c36442 100644 --- a/ext/oci8/tests/conn_attr.inc +++ b/ext/oci8/tests/conn_attr.inc @@ -30,29 +30,29 @@ if ((isset($matches[1]) && $matches[1] >= 11)) { foreach ($stmtarray as $stmt) { $s = oci_parse($c, $stmt); $r = @oci_execute($s); - if (!$r) { - $m = oci_error($s); - if (!in_array($m['code'], array( // ignore expected errors + if (!$r) { + $m = oci_error($s); + if (!in_array($m['code'], array( // ignore expected errors 942 // table or view does not exist , 1918 // user does not exist , 2289 // sequence does not exist , 4080 // trigger does not exist , 38802 // edition does not exist ))) { - echo "Error:" . $stmt . PHP_EOL . $m['message'] . PHP_EOL; + echo "Error:" . $stmt . PHP_EOL . $m['message'] . PHP_EOL; if ($m['code'] == 38807) { echo "You appear to already have an edition in use that prevents this PHP test from running. Query DBA_EDITIONS to see existing editions.". PHP_EOL; } die; - } - } + } + } } function get_attr($conn,$attr) { $sel_stmt="select " .$attr. " from v\$session where sid = - (select sid from v\$session where audsid = - sys_context('userenv','sessionid')) order by 1"; + (select sid from v\$session where audsid = + sys_context('userenv','sessionid')) order by 1"; $s2 = oci_parse($conn,$sel_stmt); oci_execute($s2,OCI_DEFAULT); while (oci_fetch($s2)) { @@ -66,10 +66,10 @@ function get_attr($conn,$attr) function get_conn($conn_type) { - $user = $GLOBALS['testuser']; - $password = $GLOBALS['testpassword']; - $dbase = $GLOBALS['dbase']; - switch($conn_type) { + $user = $GLOBALS['testuser']; + $password = $GLOBALS['testpassword']; + $dbase = $GLOBALS['dbase']; + switch($conn_type) { case 1: echo "Testing with oci_connect()\n"; return(oci_connect($user,$password,$dbase)); @@ -82,41 +82,41 @@ function get_conn($conn_type) echo "Testing with oci_new_connect()\n"; return(oci_new_connect($user,$password,$dbase)); break; - } + } } function set_attr($conn,$attr,$sufix) { - if (!strcmp($attr,'MODULE')) - $r = oci_set_module_name($conn,'PHP TEST'.$sufix); - else if (!strcmp($attr,'ACTION')) + if (!strcmp($attr,'MODULE')) + $r = oci_set_module_name($conn,'PHP TEST'.$sufix); + else if (!strcmp($attr,'ACTION')) $r = oci_set_action($conn,'TASK'.$sufix); - else if (!strcmp($attr,'CLIENT_INFO')) + else if (!strcmp($attr,'CLIENT_INFO')) $r = oci_set_client_info($conn,'INFO1'.$sufix); - else if (!strcmp($attr,'CLIENT_IDENTIFIER')) + else if (!strcmp($attr,'CLIENT_IDENTIFIER')) $r = oci_set_client_identifier($conn,'ID00'.$sufix); - else - echo "Pass one of the above four attributes!!!\n"; - if ($r) { - echo "Value of $attr has been set successfully\n"; + else + echo "Pass one of the above four attributes!!!\n"; + if ($r) { + echo "Value of $attr has been set successfully\n"; } - //Do a round-trip here - oci_server_version($conn); - return $r; + //Do a round-trip here + oci_server_version($conn); + return $r; } function set_edit_attr($value) { - $r = oci_set_edition($value); + $r = oci_set_edition($value); if ($r) { - echo " The value of edition has been successfully set\n"; + echo " The value of edition has been successfully set\n"; } - return $r; + return $r; } function get_edit_attr ($conn) { - $sel_stmt = "select sys_context('USERENV', 'CURRENT_EDITION_NAME') from dual"; + $sel_stmt = "select sys_context('USERENV', 'CURRENT_EDITION_NAME') from dual"; $s2 = oci_parse($conn,$sel_stmt); oci_execute($s2,OCI_DEFAULT); while (oci_fetch($s2)) { @@ -126,8 +126,8 @@ function get_edit_attr ($conn) { function get_sys_attr($conn,$attr) { - $sel_stmt="select " .$attr. " from v\$session where sid = - (select sid from v\$session where audsid = sys_context('userenv','sessionid')) order by 1"; + $sel_stmt="select " .$attr. " from v\$session where sid = + (select sid from v\$session where audsid = sys_context('userenv','sessionid')) order by 1"; $s2 = oci_parse($conn,$sel_stmt); oci_execute($s2,OCI_DEFAULT); while (oci_fetch($s2)) { @@ -136,14 +136,14 @@ function get_sys_attr($conn,$attr) } function clean_up($c) { - $stmtarray = array( + $stmtarray = array( "drop edition myedition1 cascade", "drop edition myedition cascade", "drop user " . $GLOBALS['testuser'] . " cascade", - ); + ); - foreach ($stmtarray as $stmt) { + foreach ($stmtarray as $stmt) { $s = oci_parse($c, $stmt); @oci_execute($s); - } + } } diff --git a/ext/oci8/tests/conn_attr_1.phpt b/ext/oci8/tests/conn_attr_1.phpt index 1c1f767398..ce23b2b5aa 100644 --- a/ext/oci8/tests/conn_attr_1.phpt +++ b/ext/oci8/tests/conn_attr_1.phpt @@ -36,19 +36,19 @@ echo"**Test 1.2 - Set and get values for the attributes **************\n"; $conn1 = get_conn(1); //oci_connect() foreach($attr_array as $attr) { - set_attr($conn1,$attr,1); + set_attr($conn1,$attr,1); get_attr($conn1,$attr); } $conn2 = get_conn(2); //oci_pconnect() foreach($attr_array as $attr) { - set_attr($conn2,$attr,2); + set_attr($conn2,$attr,2); get_attr($conn2,$attr); } $conn3 = get_conn(3); //oci_new_connect() foreach($attr_array as $attr) { - set_attr($conn3,$attr,3); + set_attr($conn3,$attr,3); get_attr($conn3,$attr); } diff --git a/ext/oci8/tests/conn_attr_2.phpt b/ext/oci8/tests/conn_attr_2.phpt index 898bd52bcd..61d59093b1 100644 --- a/ext/oci8/tests/conn_attr_2.phpt +++ b/ext/oci8/tests/conn_attr_2.phpt @@ -29,21 +29,21 @@ echo"**Set values using pconnect-1**\n"; var_dump($pc1 = oci_pconnect($testuser,$testpassword,$dbase)); foreach($attr_array as $attr) { - set_attr($pc1,$attr,100); + set_attr($pc1,$attr,100); } // using pc1 again echo"\n**Get values using pconnect-2**\n"; var_dump($pc3 = oci_pconnect($testuser,$testpassword,$dbase)); foreach($attr_array as $attr) { - get_attr($pc3,$attr); + get_attr($pc3,$attr); } // Get with different pconnect echo"\n**Get values using pconnect-3**\n"; var_dump($pc2 = oci_pconnect($testuser,$testpassword,$dbase,'UTF8')); foreach($attr_array as $attr) { - get_attr($pc2,$attr); + get_attr($pc2,$attr); } oci_close($pc1); @@ -54,7 +54,7 @@ oci_close($pc3); echo "\n**Re-open a pconnect()**\n"; var_dump($pc4 = oci_pconnect($testuser,$testpassword,$dbase)); foreach($attr_array as $attr) { - get_attr($pc4,$attr); + get_attr($pc4,$attr); } oci_close($pc4); @@ -68,10 +68,10 @@ if (!$sys_c1) { var_dump($e); } } else { - set_attr($sys_c1,'ACTION',10); - get_sys_attr($sys_c1,'ACTION'); - get_attr($sys_c1,'ACTION'); - oci_close($sys_c1); + set_attr($sys_c1,'ACTION',10); + get_sys_attr($sys_c1,'ACTION'); + get_attr($sys_c1,'ACTION'); + oci_close($sys_c1); } clean_up($c); diff --git a/ext/oci8/tests/conn_attr_4.phpt b/ext/oci8/tests/conn_attr_4.phpt index 46a219c05d..7a7f5269eb 100644 --- a/ext/oci8/tests/conn_attr_4.phpt +++ b/ext/oci8/tests/conn_attr_4.phpt @@ -59,16 +59,16 @@ echo "\nSetting to different values \n"; $values_array = array(1000,NULL,'this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!'); foreach($values_array as $val ) { - oci_set_module_name($c1,$val); - oci_set_client_identifier($c1,$val); - oci_set_client_info($c1,$val); - $r = oci_set_action($c1,$val); - if ($r) { - echo "Values set successfully to $val\n"; - foreach($attr_array as $attr) { + oci_set_module_name($c1,$val); + oci_set_client_identifier($c1,$val); + oci_set_client_info($c1,$val); + $r = oci_set_action($c1,$val); + if ($r) { + echo "Values set successfully to $val\n"; + foreach($attr_array as $attr) { get_attr($c1,$attr); } - } + } } clean_up($c); diff --git a/ext/oci8/tests/connect.phpt b/ext/oci8/tests/connect.phpt index d534e44871..f13d6fd421 100644 --- a/ext/oci8/tests/connect.phpt +++ b/ext/oci8/tests/connect.phpt @@ -8,10 +8,10 @@ oci_connect() require __DIR__."/connect.inc"; if (!empty($dbase)) { - var_dump(oci_connect($user, $password, $dbase)); + var_dump(oci_connect($user, $password, $dbase)); } else { - var_dump(oci_connect($user, $password)); + var_dump(oci_connect($user, $password)); } echo "Done\n"; diff --git a/ext/oci8/tests/connect_1.phpt b/ext/oci8/tests/connect_1.phpt index 6d76c8ddcc..297b0897b6 100644 --- a/ext/oci8/tests/connect_1.phpt +++ b/ext/oci8/tests/connect_1.phpt @@ -8,17 +8,17 @@ oci_pconnect() & oci_new_connect() require __DIR__."/connect.inc"; if (!empty($dbase)) { - var_dump($c1 = oci_pconnect($user, $password, $dbase)); + var_dump($c1 = oci_pconnect($user, $password, $dbase)); } else { - var_dump($c1 = oci_pconnect($user, $password)); + var_dump($c1 = oci_pconnect($user, $password)); } if (!empty($dbase)) { - var_dump($c2 = oci_new_connect($user, $password, $dbase)); + var_dump($c2 = oci_new_connect($user, $password, $dbase)); } else { - var_dump($c2 = oci_new_connect($user, $password)); + var_dump($c2 = oci_new_connect($user, $password)); } var_dump(oci_close($c1)); diff --git a/ext/oci8/tests/connect_1_old.phpt b/ext/oci8/tests/connect_1_old.phpt index 2014d59fe3..3ce756f51c 100644 --- a/ext/oci8/tests/connect_1_old.phpt +++ b/ext/oci8/tests/connect_1_old.phpt @@ -8,17 +8,17 @@ ociplogon() & ocinlogon() require __DIR__."/connect.inc"; if (!empty($dbase)) { - var_dump($c1 = ociplogon($user, $password, $dbase)); + var_dump($c1 = ociplogon($user, $password, $dbase)); } else { - var_dump($c1 = ociplogon($user, $password)); + var_dump($c1 = ociplogon($user, $password)); } if (!empty($dbase)) { - var_dump($c2 = ocinlogon($user, $password, $dbase)); + var_dump($c2 = ocinlogon($user, $password, $dbase)); } else { - var_dump($c2 = ocinlogon($user, $password)); + var_dump($c2 = ocinlogon($user, $password)); } var_dump(ocilogoff($c1)); diff --git a/ext/oci8/tests/connect_old.phpt b/ext/oci8/tests/connect_old.phpt index a2012bfd19..c55197fca1 100644 --- a/ext/oci8/tests/connect_old.phpt +++ b/ext/oci8/tests/connect_old.phpt @@ -8,10 +8,10 @@ ocilogon() require __DIR__."/connect.inc"; if (!empty($dbase)) { - var_dump(ocilogon($user, $password, $dbase)); + var_dump(ocilogon($user, $password, $dbase)); } else { - var_dump(ocilogon($user, $password)); + var_dump(ocilogon($user, $password)); } echo "Done\n"; diff --git a/ext/oci8/tests/connect_scope1.phpt b/ext/oci8/tests/connect_scope1.phpt index aefee2f882..684103b9f3 100644 --- a/ext/oci8/tests/connect_scope1.phpt +++ b/ext/oci8/tests/connect_scope1.phpt @@ -10,14 +10,14 @@ require(__DIR__.'/details.inc'); // Initialization $stmtarray = array( - "drop table connect_scope1_tab", - "create table connect_scope1_tab (c1 number)", + "drop table connect_scope1_tab", + "create table connect_scope1_tab (c1 number)", ); if (!empty($dbase)) - $c1 = oci_new_connect($user,$password,$dbase); + $c1 = oci_new_connect($user,$password,$dbase); else - $c1 = oci_new_connect($user,$password); + $c1 = oci_new_connect($user,$password); oci8_test_sql_execute($c1, $stmtarray); @@ -27,15 +27,15 @@ echo "Test 1 - oci_connect\n"; function f() { - global $user, $password, $dbase; - - if (!empty($dbase)) - $c = oci_connect($user,$password,$dbase); - else - $c = oci_connect($user,$password); - $s = oci_parse($c, "insert into connect_scope1_tab values (1)"); - oci_execute($s, OCI_DEFAULT); // no commit - return($s); // this keeps the connection refcount positive so the connection isn't closed + global $user, $password, $dbase; + + if (!empty($dbase)) + $c = oci_connect($user,$password,$dbase); + else + $c = oci_connect($user,$password); + $s = oci_parse($c, "insert into connect_scope1_tab values (1)"); + oci_execute($s, OCI_DEFAULT); // no commit + return($s); // this keeps the connection refcount positive so the connection isn't closed } $s2 = f(); @@ -60,7 +60,7 @@ var_dump($r); // Cleanup $stmtarray = array( - "drop table connect_scope1_tab" + "drop table connect_scope1_tab" ); oci8_test_sql_execute($c1, $stmtarray); diff --git a/ext/oci8/tests/connect_scope2.phpt b/ext/oci8/tests/connect_scope2.phpt index aa192b1459..9a2de41e30 100644 --- a/ext/oci8/tests/connect_scope2.phpt +++ b/ext/oci8/tests/connect_scope2.phpt @@ -10,14 +10,14 @@ require(__DIR__.'/details.inc'); // Initialization $stmtarray = array( - "drop table connect_scope2_tab", - "create table connect_scope2_tab (c1 number)", + "drop table connect_scope2_tab", + "create table connect_scope2_tab (c1 number)", ); if (!empty($dbase)) - $c1 = oci_new_connect($user,$password,$dbase); + $c1 = oci_new_connect($user,$password,$dbase); else - $c1 = oci_new_connect($user,$password); + $c1 = oci_new_connect($user,$password); oci8_test_sql_execute($c1, $stmtarray); @@ -27,15 +27,15 @@ echo "Test 1 - oci_pconnect\n"; function f() { - global $user, $password, $dbase; - - if (!empty($dbase)) - $c = oci_pconnect($user,$password,$dbase); - else - $c = oci_pconnect($user,$password); - $s = oci_parse($c, "insert into connect_scope2_tab values (1)"); - oci_execute($s, OCI_DEFAULT); // no commit - return($s); // this keeps the connection refcount positive so the connection isn't closed + global $user, $password, $dbase; + + if (!empty($dbase)) + $c = oci_pconnect($user,$password,$dbase); + else + $c = oci_pconnect($user,$password); + $s = oci_parse($c, "insert into connect_scope2_tab values (1)"); + oci_execute($s, OCI_DEFAULT); // no commit + return($s); // this keeps the connection refcount positive so the connection isn't closed } $s2 = f(); @@ -60,7 +60,7 @@ var_dump($r); // Cleanup $stmtarray = array( - "drop table connect_scope2_tab" + "drop table connect_scope2_tab" ); oci8_test_sql_execute($c1, $stmtarray); diff --git a/ext/oci8/tests/connect_scope_try1.phpt b/ext/oci8/tests/connect_scope_try1.phpt index d3628f9eaa..54f4cc552b 100644 --- a/ext/oci8/tests/connect_scope_try1.phpt +++ b/ext/oci8/tests/connect_scope_try1.phpt @@ -12,14 +12,14 @@ require(__DIR__.'/details.inc'); // Initialization $stmtarray = array( - "drop table scope_try1_tab", - "create table scope_try1_tab (c1 number)" + "drop table scope_try1_tab", + "create table scope_try1_tab (c1 number)" ); if (!empty($dbase)) - $c1 = oci_new_connect($user,$password,$dbase); + $c1 = oci_new_connect($user,$password,$dbase); else - $c1 = oci_new_connect($user,$password); + $c1 = oci_new_connect($user,$password); oci8_test_sql_execute($c1, $stmtarray); @@ -33,28 +33,28 @@ set_error_handler(function($x, $y) { throw new Exception($y, $x); }); try { - if (!empty($dbase)) - $c = oci_connect($user,$password,$dbase); - else - $c = oci_connect($user,$password); - $s = oci_parse($c, "insert into scope_try1_tab values (1)"); - oci_execute($s, OCI_DEFAULT); // no commit - $s = oci_parse($c, "insert into scope_try1_tab values (ABC)"); // syntax error -> throws exception - oci_execute($s, OCI_DEFAULT); // no commit + if (!empty($dbase)) + $c = oci_connect($user,$password,$dbase); + else + $c = oci_connect($user,$password); + $s = oci_parse($c, "insert into scope_try1_tab values (1)"); + oci_execute($s, OCI_DEFAULT); // no commit + $s = oci_parse($c, "insert into scope_try1_tab values (ABC)"); // syntax error -> throws exception + oci_execute($s, OCI_DEFAULT); // no commit } catch (Exception $e) { - echo "Caught Exception: ". $e->getMessage(), "\n"; - var_dump($c); + echo "Caught Exception: ". $e->getMessage(), "\n"; + var_dump($c); - // Verify data is not yet committed - $s1 = oci_parse($c1, "select * from scope_try1_tab"); - oci_execute($s1); - oci_fetch_all($s1, $r); - var_dump($r); + // Verify data is not yet committed + $s1 = oci_parse($c1, "select * from scope_try1_tab"); + oci_execute($s1); + oci_fetch_all($s1, $r); + var_dump($r); - // Now commit - oci_commit($c); + // Now commit + oci_commit($c); } // Verify data was committed in the Catch block @@ -67,7 +67,7 @@ var_dump($r); // Cleanup $stmtarray = array( - "drop table scope_try1_tab" + "drop table scope_try1_tab" ); oci8_test_sql_execute($c1, $stmtarray); diff --git a/ext/oci8/tests/connect_scope_try2.phpt b/ext/oci8/tests/connect_scope_try2.phpt index 76e6909f44..2ec7b78c5f 100644 --- a/ext/oci8/tests/connect_scope_try2.phpt +++ b/ext/oci8/tests/connect_scope_try2.phpt @@ -12,14 +12,14 @@ require(__DIR__.'/details.inc'); // Initialization $stmtarray = array( - "drop table scope_try2_tab", - "create table scope_try2_tab (c1 number)" + "drop table scope_try2_tab", + "create table scope_try2_tab (c1 number)" ); if (!empty($dbase)) - $c1 = oci_new_connect($user,$password,$dbase); + $c1 = oci_new_connect($user,$password,$dbase); else - $c1 = oci_new_connect($user,$password); + $c1 = oci_new_connect($user,$password); oci8_test_sql_execute($c1, $stmtarray); @@ -33,28 +33,28 @@ set_error_handler(function($x, $y) { throw new Exception($y, $x); }); try { - if (!empty($dbase)) - $c = oci_connect($user,$password,$dbase); - else - $c = oci_connect($user,$password); - $s = oci_parse($c, "insert into scope_try2_tab values (1)"); - oci_execute($s, OCI_DEFAULT); // no commit - $s = oci_parse($c, "insert into scope_try2_tab values (ABC)"); // syntax error -> throws exception - oci_execute($s, OCI_DEFAULT); // no commit + if (!empty($dbase)) + $c = oci_connect($user,$password,$dbase); + else + $c = oci_connect($user,$password); + $s = oci_parse($c, "insert into scope_try2_tab values (1)"); + oci_execute($s, OCI_DEFAULT); // no commit + $s = oci_parse($c, "insert into scope_try2_tab values (ABC)"); // syntax error -> throws exception + oci_execute($s, OCI_DEFAULT); // no commit } catch (Exception $e) { - echo "Caught Exception: ". $e->getMessage(), "\n"; - var_dump($c); + echo "Caught Exception: ". $e->getMessage(), "\n"; + var_dump($c); - // Verify data is not yet committed - $s1 = oci_parse($c1, "select * from scope_try2_tab"); - oci_execute($s1); - oci_fetch_all($s1, $r); - var_dump($r); + // Verify data is not yet committed + $s1 = oci_parse($c1, "select * from scope_try2_tab"); + oci_execute($s1); + oci_fetch_all($s1, $r); + var_dump($r); - // Now commit - oci_commit($c); + // Now commit + oci_commit($c); } // Verify data was committed in the Catch block @@ -67,7 +67,7 @@ var_dump($r); // Cleanup $stmtarray = array( - "drop table scope_try2_tab" + "drop table scope_try2_tab" ); oci8_test_sql_execute($c1, $stmtarray); diff --git a/ext/oci8/tests/connect_scope_try3.phpt b/ext/oci8/tests/connect_scope_try3.phpt index d9cbfce355..7c09750410 100644 --- a/ext/oci8/tests/connect_scope_try3.phpt +++ b/ext/oci8/tests/connect_scope_try3.phpt @@ -12,14 +12,14 @@ require(__DIR__.'/details.inc'); // Initialization $stmtarray = array( - "drop table scope_try3_tab", - "create table scope_try3_tab (c1 number)" + "drop table scope_try3_tab", + "create table scope_try3_tab (c1 number)" ); if (!empty($dbase)) - $c1 = oci_new_connect($user,$password,$dbase); + $c1 = oci_new_connect($user,$password,$dbase); else - $c1 = oci_new_connect($user,$password); + $c1 = oci_new_connect($user,$password); oci8_test_sql_execute($c1, $stmtarray); @@ -33,28 +33,28 @@ set_error_handler(function($x, $y) { throw new Exception($y, $x); }); try { - if (!empty($dbase)) - $c = oci_new_connect($user,$password,$dbase); - else - $c = oci_new_connect($user,$password); - $s = oci_parse($c, "insert into scope_try3_tab values (1)"); - oci_execute($s, OCI_DEFAULT); // no commit - $s = oci_parse($c, "insert into scope_try3_tab values (ABC)"); // syntax error -> throws exception - oci_execute($s, OCI_DEFAULT); // no commit + if (!empty($dbase)) + $c = oci_new_connect($user,$password,$dbase); + else + $c = oci_new_connect($user,$password); + $s = oci_parse($c, "insert into scope_try3_tab values (1)"); + oci_execute($s, OCI_DEFAULT); // no commit + $s = oci_parse($c, "insert into scope_try3_tab values (ABC)"); // syntax error -> throws exception + oci_execute($s, OCI_DEFAULT); // no commit } catch (Exception $e) { - echo "Caught Exception: ". $e->getMessage(), "\n"; - var_dump($c); + echo "Caught Exception: ". $e->getMessage(), "\n"; + var_dump($c); - // Verify data is not yet committed - $s1 = oci_parse($c1, "select * from scope_try3_tab"); - oci_execute($s1); - oci_fetch_all($s1, $r); - var_dump($r); + // Verify data is not yet committed + $s1 = oci_parse($c1, "select * from scope_try3_tab"); + oci_execute($s1); + oci_fetch_all($s1, $r); + var_dump($r); - // Now commit - oci_commit($c); + // Now commit + oci_commit($c); } // Verify data was committed in the Catch block @@ -67,7 +67,7 @@ var_dump($r); // Cleanup $stmtarray = array( - "drop table scope_try3_tab" + "drop table scope_try3_tab" ); oci8_test_sql_execute($c1, $stmtarray); diff --git a/ext/oci8/tests/connect_scope_try4.phpt b/ext/oci8/tests/connect_scope_try4.phpt index cdefe36ee9..04f82712a8 100644 --- a/ext/oci8/tests/connect_scope_try4.phpt +++ b/ext/oci8/tests/connect_scope_try4.phpt @@ -12,14 +12,14 @@ require(__DIR__.'/details.inc'); // Initialization $stmtarray = array( - "drop table scope_try4_tab", - "create table scope_try4_tab (c1 number)" + "drop table scope_try4_tab", + "create table scope_try4_tab (c1 number)" ); if (!empty($dbase)) - $c1 = oci_new_connect($user,$password,$dbase); + $c1 = oci_new_connect($user,$password,$dbase); else - $c1 = oci_new_connect($user,$password); + $c1 = oci_new_connect($user,$password); oci8_test_sql_execute($c1, $stmtarray); @@ -33,28 +33,28 @@ set_error_handler(function($x, $y) { throw new Exception($y, $x); }); try { - if (!empty($dbase)) - $c = oci_new_connect($user,$password,$dbase); - else - $c = oci_new_connect($user,$password); - $s = oci_parse($c, "insert into scope_try4_tab values (1)"); - oci_execute($s, OCI_DEFAULT); // no commit - $s = oci_parse($c, "insert into scope_try4_tab values (ABC)"); // syntax error -> throws exception - oci_execute($s, OCI_DEFAULT); // no commit + if (!empty($dbase)) + $c = oci_new_connect($user,$password,$dbase); + else + $c = oci_new_connect($user,$password); + $s = oci_parse($c, "insert into scope_try4_tab values (1)"); + oci_execute($s, OCI_DEFAULT); // no commit + $s = oci_parse($c, "insert into scope_try4_tab values (ABC)"); // syntax error -> throws exception + oci_execute($s, OCI_DEFAULT); // no commit } catch (Exception $e) { - echo "Caught Exception: ". $e->getMessage(), "\n"; - var_dump($c); + echo "Caught Exception: ". $e->getMessage(), "\n"; + var_dump($c); - // Verify data is not yet committed - $s1 = oci_parse($c1, "select * from scope_try4_tab"); - oci_execute($s1); - oci_fetch_all($s1, $r); - var_dump($r); + // Verify data is not yet committed + $s1 = oci_parse($c1, "select * from scope_try4_tab"); + oci_execute($s1); + oci_fetch_all($s1, $r); + var_dump($r); - // Now commit - oci_commit($c); + // Now commit + oci_commit($c); } // Verify data was committed in the Catch block @@ -67,7 +67,7 @@ var_dump($r); // Cleanup $stmtarray = array( - "drop table scope_try4_tab" + "drop table scope_try4_tab" ); oci8_test_sql_execute($c1, $stmtarray); diff --git a/ext/oci8/tests/connect_scope_try5.phpt b/ext/oci8/tests/connect_scope_try5.phpt index 1e99d0a2e1..43b7ff0049 100644 --- a/ext/oci8/tests/connect_scope_try5.phpt +++ b/ext/oci8/tests/connect_scope_try5.phpt @@ -12,14 +12,14 @@ require(__DIR__.'/details.inc'); // Initialization $stmtarray = array( - "drop table scope_try5_tab", - "create table scope_try5_tab (c1 number)" + "drop table scope_try5_tab", + "create table scope_try5_tab (c1 number)" ); if (!empty($dbase)) - $c1 = oci_new_connect($user,$password,$dbase); + $c1 = oci_new_connect($user,$password,$dbase); else - $c1 = oci_new_connect($user,$password); + $c1 = oci_new_connect($user,$password); oci8_test_sql_execute($c1, $stmtarray); @@ -33,28 +33,28 @@ set_error_handler(function($x, $y) { throw new Exception($y, $x); }); try { - if (!empty($dbase)) - $c = oci_pconnect($user,$password,$dbase); - else - $c = oci_pconnect($user,$password); - $s = oci_parse($c, "insert into scope_try5_tab values (1)"); - oci_execute($s, OCI_DEFAULT); // no commit - $s = oci_parse($c, "insert into scope_try5_tab values (ABC)"); // syntax error -> throws exception - oci_execute($s, OCI_DEFAULT); // no commit + if (!empty($dbase)) + $c = oci_pconnect($user,$password,$dbase); + else + $c = oci_pconnect($user,$password); + $s = oci_parse($c, "insert into scope_try5_tab values (1)"); + oci_execute($s, OCI_DEFAULT); // no commit + $s = oci_parse($c, "insert into scope_try5_tab values (ABC)"); // syntax error -> throws exception + oci_execute($s, OCI_DEFAULT); // no commit } catch (Exception $e) { - echo "Caught Exception: ". $e->getMessage(), "\n"; - var_dump($c); + echo "Caught Exception: ". $e->getMessage(), "\n"; + var_dump($c); - // Verify data is not yet committed - $s1 = oci_parse($c1, "select * from scope_try5_tab"); - oci_execute($s1); - oci_fetch_all($s1, $r); - var_dump($r); + // Verify data is not yet committed + $s1 = oci_parse($c1, "select * from scope_try5_tab"); + oci_execute($s1); + oci_fetch_all($s1, $r); + var_dump($r); - // Now commit - oci_commit($c); + // Now commit + oci_commit($c); } // Verify data was committed in the Catch block @@ -67,7 +67,7 @@ var_dump($r); // Cleanup $stmtarray = array( - "drop table scope_try5_tab" + "drop table scope_try5_tab" ); oci8_test_sql_execute($c1, $stmtarray); diff --git a/ext/oci8/tests/connect_scope_try6.phpt b/ext/oci8/tests/connect_scope_try6.phpt index 84ea97ac43..fc31bddfd8 100644 --- a/ext/oci8/tests/connect_scope_try6.phpt +++ b/ext/oci8/tests/connect_scope_try6.phpt @@ -12,14 +12,14 @@ require(__DIR__.'/details.inc'); // Initialization $stmtarray = array( - "drop table scope_try6_tab", - "create table scope_try6_tab (c1 number)" + "drop table scope_try6_tab", + "create table scope_try6_tab (c1 number)" ); if (!empty($dbase)) - $c1 = oci_new_connect($user,$password,$dbase); + $c1 = oci_new_connect($user,$password,$dbase); else - $c1 = oci_new_connect($user,$password); + $c1 = oci_new_connect($user,$password); oci8_test_sql_execute($c1, $stmtarray); @@ -33,28 +33,28 @@ set_error_handler(function($x, $y) { throw new Exception($y, $x); }); try { - if (!empty($dbase)) - $c = oci_pconnect($user,$password,$dbase); - else - $c = oci_pconnect($user,$password); - $s = oci_parse($c, "insert into scope_try6_tab values (1)"); - oci_execute($s, OCI_DEFAULT); // no commit - $s = oci_parse($c, "insert into scope_try6_tab values (ABC)"); // syntax error -> throws exception - oci_execute($s, OCI_DEFAULT); // no commit + if (!empty($dbase)) + $c = oci_pconnect($user,$password,$dbase); + else + $c = oci_pconnect($user,$password); + $s = oci_parse($c, "insert into scope_try6_tab values (1)"); + oci_execute($s, OCI_DEFAULT); // no commit + $s = oci_parse($c, "insert into scope_try6_tab values (ABC)"); // syntax error -> throws exception + oci_execute($s, OCI_DEFAULT); // no commit } catch (Exception $e) { - echo "Caught Exception: ". $e->getMessage(), "\n"; - var_dump($c); + echo "Caught Exception: ". $e->getMessage(), "\n"; + var_dump($c); - // Verify data is not yet committed - $s1 = oci_parse($c1, "select * from scope_try6_tab"); - oci_execute($s1); - oci_fetch_all($s1, $r); - var_dump($r); + // Verify data is not yet committed + $s1 = oci_parse($c1, "select * from scope_try6_tab"); + oci_execute($s1); + oci_fetch_all($s1, $r); + var_dump($r); - // Now commit - oci_commit($c); + // Now commit + oci_commit($c); } // Verify data was committed in the Catch block @@ -67,7 +67,7 @@ var_dump($r); // Cleanup $stmtarray = array( - "drop table scope_try6_tab" + "drop table scope_try6_tab" ); oci8_test_sql_execute($c1, $stmtarray); diff --git a/ext/oci8/tests/connect_without_oracle_home.phpt b/ext/oci8/tests/connect_without_oracle_home.phpt index b6fc0087b1..203fd57e92 100644 --- a/ext/oci8/tests/connect_without_oracle_home.phpt +++ b/ext/oci8/tests/connect_without_oracle_home.phpt @@ -23,10 +23,10 @@ ORACLE_HOME="" require __DIR__."/details.inc"; if (!empty($dbase)) { - var_dump(oci_connect($user, $password, $dbase)); + var_dump(oci_connect($user, $password, $dbase)); } else { - var_dump(oci_connect($user, $password)); + var_dump(oci_connect($user, $password)); } ?> diff --git a/ext/oci8/tests/connect_without_oracle_home_11.phpt b/ext/oci8/tests/connect_without_oracle_home_11.phpt index f40675c9c1..85ac993877 100644 --- a/ext/oci8/tests/connect_without_oracle_home_11.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_11.phpt @@ -26,10 +26,10 @@ ORACLE_HOME="" require __DIR__."/details.inc"; if (!empty($dbase)) { - var_dump(oci_connect($user, $password, $dbase)); + var_dump(oci_connect($user, $password, $dbase)); } else { - var_dump(oci_connect($user, $password)); + var_dump(oci_connect($user, $password)); } ?> diff --git a/ext/oci8/tests/connect_without_oracle_home_old.phpt b/ext/oci8/tests/connect_without_oracle_home_old.phpt index d311ffaab1..bd217acd77 100644 --- a/ext/oci8/tests/connect_without_oracle_home_old.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_old.phpt @@ -19,10 +19,10 @@ ORACLE_HOME="" require __DIR__."/details.inc"; if (!empty($dbase)) { - var_dump(ocilogon($user, $password, $dbase)); + var_dump(ocilogon($user, $password, $dbase)); } else { - var_dump(ocilogon($user, $password)); + var_dump(ocilogon($user, $password)); } ?> diff --git a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt index 1c10fd6e1c..243741bfde 100644 --- a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt @@ -26,10 +26,10 @@ ORACLE_HOME="" require __DIR__."/details.inc"; if (!empty($dbase)) { - var_dump(ocilogon($user, $password, $dbase)); + var_dump(ocilogon($user, $password, $dbase)); } else { - var_dump(ocilogon($user, $password)); + var_dump(ocilogon($user, $password)); } ?> diff --git a/ext/oci8/tests/cursors.phpt b/ext/oci8/tests/cursors.phpt index 8a33f51649..a9fa0dcb41 100644 --- a/ext/oci8/tests/cursors.phpt +++ b/ext/oci8/tests/cursors.phpt @@ -14,17 +14,17 @@ require __DIR__."/create_table.inc"; $insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); + die("oci_parse(insert) failed!\n"); } for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } + if (!oci_execute($s)) { + die("oci_execute(insert) failed!\n"); + } } if (!oci_commit($c)) { - die("oci_commit() failed!\n"); + die("oci_commit() failed!\n"); } $sql = "select CURSOR(select * from ".$schema.$table_name.") as curs FROM dual"; @@ -33,13 +33,13 @@ $stmt = oci_parse($c, $sql); oci_execute($stmt); while ($data = oci_fetch_assoc($stmt)) { - oci_execute($data["CURS"]); - $subdata = oci_fetch_assoc($data["CURS"]); - var_dump($subdata); - var_dump(oci_cancel($data["CURS"])); - $subdata = oci_fetch_assoc($data["CURS"]); - var_dump($subdata); - var_dump(oci_cancel($data["CURS"])); + oci_execute($data["CURS"]); + $subdata = oci_fetch_assoc($data["CURS"]); + var_dump($subdata); + var_dump(oci_cancel($data["CURS"])); + $subdata = oci_fetch_assoc($data["CURS"]); + var_dump($subdata); + var_dump(oci_cancel($data["CURS"])); } require __DIR__."/drop_table.inc"; diff --git a/ext/oci8/tests/cursors_old.phpt b/ext/oci8/tests/cursors_old.phpt index b130da5165..7c5c668f62 100644 --- a/ext/oci8/tests/cursors_old.phpt +++ b/ext/oci8/tests/cursors_old.phpt @@ -30,13 +30,13 @@ $stmt = ociparse($c, $sql); ociexecute($stmt); while ($result = ocifetchinto($stmt, $data, OCI_ASSOC)) { - ociexecute($data["CURS"]); - ocifetchinto($data["CURS"], $subdata, OCI_ASSOC); - var_dump($subdata); - var_dump(ocicancel($data["CURS"])); - ocifetchinto($data["CURS"], $subdata, OCI_ASSOC); - var_dump($subdata); - var_dump(ocicancel($data["CURS"])); + ociexecute($data["CURS"]); + ocifetchinto($data["CURS"], $subdata, OCI_ASSOC); + var_dump($subdata); + var_dump(ocicancel($data["CURS"])); + ocifetchinto($data["CURS"], $subdata, OCI_ASSOC); + var_dump($subdata); + var_dump(ocicancel($data["CURS"])); } // Cleanup diff --git a/ext/oci8/tests/dbmsoutput.phpt b/ext/oci8/tests/dbmsoutput.phpt index ff40df1a38..01ba9db0b5 100644 --- a/ext/oci8/tests/dbmsoutput.phpt +++ b/ext/oci8/tests/dbmsoutput.phpt @@ -71,20 +71,20 @@ function getdbmsoutput_do($c) function getdbmsoutput_do2($c) { - $orignumlines = $numlines = 100; - $s = oci_parse($c, "begin dbms_output.get_lines(:lines, :numlines); end;"); - $r = oci_bind_by_name($s, ":numlines", $numlines); - $res = array(); - while ($numlines >= $orignumlines) { - oci_bind_array_by_name($s, ":lines", $lines, $numlines, 255, SQLT_CHR); - oci_execute($s); - if ($numlines == 0) { - break; - } - $res = array_merge($res, array_slice($lines, 0, $numlines)); - unset($lines); - } - return $res; + $orignumlines = $numlines = 100; + $s = oci_parse($c, "begin dbms_output.get_lines(:lines, :numlines); end;"); + $r = oci_bind_by_name($s, ":numlines", $numlines); + $res = array(); + while ($numlines >= $orignumlines) { + oci_bind_array_by_name($s, ":lines", $lines, $numlines, 255, SQLT_CHR); + oci_execute($s); + if ($numlines == 0) { + break; + } + $res = array_merge($res, array_slice($lines, 0, $numlines)); + unset($lines); + } + return $res; } function getdbmsoutput_pl($c) @@ -124,7 +124,7 @@ var_dump(getdbmsoutput_pl($c)); // Clean up $stmtarray = array( - "drop procedure dbmsoutput_proc" + "drop procedure dbmsoutput_proc" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/debug.phpt b/ext/oci8/tests/debug.phpt index a197639af6..f66eeb9698 100644 --- a/ext/oci8/tests/debug.phpt +++ b/ext/oci8/tests/debug.phpt @@ -10,10 +10,10 @@ require(__DIR__."/details.inc"); oci_internal_debug(true); if (!empty($dbase)) { - oci_connect($user, $password, $dbase); + oci_connect($user, $password, $dbase); } else { - oci_connect($user, $password); + oci_connect($user, $password); } oci_internal_debug(false); diff --git a/ext/oci8/tests/default_prefetch0.phpt b/ext/oci8/tests/default_prefetch0.phpt index 6a62328713..4dce73431c 100644 --- a/ext/oci8/tests/default_prefetch0.phpt +++ b/ext/oci8/tests/default_prefetch0.phpt @@ -26,11 +26,11 @@ oci8_test_sql_execute($c, $stmtarray); $select_sql = "select * from default_prefetch_tab"; if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } var_dump(oci_fetch($s)); diff --git a/ext/oci8/tests/default_prefetch1.phpt b/ext/oci8/tests/default_prefetch1.phpt index ca9590a82f..dbe92e75f4 100644 --- a/ext/oci8/tests/default_prefetch1.phpt +++ b/ext/oci8/tests/default_prefetch1.phpt @@ -26,11 +26,11 @@ oci8_test_sql_execute($c, $stmtarray); $select_sql = "select * from default_prefetch1_tab"; if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } var_dump(oci_fetch($s)); diff --git a/ext/oci8/tests/default_prefetch2.phpt b/ext/oci8/tests/default_prefetch2.phpt index 1d2a80b845..6d01fb1bac 100644 --- a/ext/oci8/tests/default_prefetch2.phpt +++ b/ext/oci8/tests/default_prefetch2.phpt @@ -26,13 +26,13 @@ oci8_test_sql_execute($c, $stmtarray); $select_sql = "select * from default_prefetch2_tab"; if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } var_dump(oci_set_prefetch($s, 10)); if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } var_dump(oci_fetch($s)); diff --git a/ext/oci8/tests/define.phpt b/ext/oci8/tests/define.phpt index e3f19e6337..8fd459e10e 100644 --- a/ext/oci8/tests/define.phpt +++ b/ext/oci8/tests/define.phpt @@ -29,7 +29,7 @@ oci_define_by_name($stmt, "STRING", $string, 20); oci_execute($stmt); while (oci_fetch($stmt)) { - var_dump($string); + var_dump($string); } // Cleanup diff --git a/ext/oci8/tests/define0.phpt b/ext/oci8/tests/define0.phpt index c59b24ee76..fecbf23757 100644 --- a/ext/oci8/tests/define0.phpt +++ b/ext/oci8/tests/define0.phpt @@ -29,7 +29,7 @@ $string = ''; oci_define_by_name($stmt, "STRING", $string, 20); oci_execute($stmt); while (oci_fetch($stmt)) { - var_dump($string); + var_dump($string); } echo "Test 2\n"; diff --git a/ext/oci8/tests/define1.phpt b/ext/oci8/tests/define1.phpt index 28c4b7f1f4..37efddafb9 100644 --- a/ext/oci8/tests/define1.phpt +++ b/ext/oci8/tests/define1.phpt @@ -32,7 +32,7 @@ var_dump(oci_define_by_name($stmt, "")); oci_execute($stmt); while (oci_fetch($stmt)) { - var_dump($string); + var_dump($string); } // Cleanup diff --git a/ext/oci8/tests/define2.phpt b/ext/oci8/tests/define2.phpt index a018bbcb44..9dbac4620b 100644 --- a/ext/oci8/tests/define2.phpt +++ b/ext/oci8/tests/define2.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require(__DIR__."/connect.inc"); $stmtarray = array( - "drop table phptestrawtable", - "create table phptestrawtable( id number(10), fileimage raw(1000))" + "drop table phptestrawtable", + "create table phptestrawtable( id number(10), fileimage raw(1000))" ); oci8_test_sql_execute($c, $stmtarray); @@ -34,8 +34,8 @@ var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi)); oci_execute($stmt); while (oci_fetch($stmt)) { - var_dump($fi); - echo "file md5:" . md5($fi) . "\n"; + var_dump($fi); + echo "file md5:" . md5($fi) . "\n"; } echo "Test 2\n"; @@ -44,8 +44,8 @@ var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi)); oci_execute($stmt); while (oci_fetch($stmt)) { - var_dump($fi); - echo "file md5:" . md5($fi) . "\n"; + var_dump($fi); + echo "file md5:" . md5($fi) . "\n"; } echo "Test 3 - test repeatability\n"; @@ -54,8 +54,8 @@ var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi, SQLT_STR)); oci_execute($stmt); while (oci_fetch($stmt)) { - var_dump($fi); - echo "file md5:" . md5($fi) . "\n"; + var_dump($fi); + echo "file md5:" . md5($fi) . "\n"; } echo "Test 4 - wrong type\n"; @@ -64,8 +64,8 @@ var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi, SQLT_RSET)); oci_execute($stmt); while (oci_fetch($stmt)) { - var_dump($fi); - echo "file md5:" . md5($fi) . "\n"; + var_dump($fi); + echo "file md5:" . md5($fi) . "\n"; } // Cleanup diff --git a/ext/oci8/tests/define3.phpt b/ext/oci8/tests/define3.phpt index 669ae39d93..e70f636938 100644 --- a/ext/oci8/tests/define3.phpt +++ b/ext/oci8/tests/define3.phpt @@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc'); require(__DIR__."/connect.inc"); $stmtarray = array( - "drop table phpdefblobtable", - "create table phpdefblobtable (id number(10), fileimage blob)" + "drop table phpdefblobtable", + "create table phpdefblobtable (id number(10), fileimage blob)" ); oci8_test_sql_execute($c, $stmtarray); @@ -76,7 +76,7 @@ while (oci_fetch($stmt)) { } $stmtarray = array( - "drop table phpdefblobtable" + "drop table phpdefblobtable" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/define4.phpt b/ext/oci8/tests/define4.phpt index 25296f96d3..d7ffc3fd58 100644 --- a/ext/oci8/tests/define4.phpt +++ b/ext/oci8/tests/define4.phpt @@ -30,12 +30,12 @@ oci_execute($stmt); echo "Test 2\n"; while (oci_fetch($stmt)) { - var_dump(oci_result($stmt, 'VALUE')); - var_dump($string); - var_dump(oci_result($stmt, 'STRING')); - var_dump($string); - var_dump(oci_result($stmt, 'VALUE')); - var_dump(oci_result($stmt, 'STRING')); + var_dump(oci_result($stmt, 'VALUE')); + var_dump($string); + var_dump(oci_result($stmt, 'STRING')); + var_dump($string); + var_dump(oci_result($stmt, 'VALUE')); + var_dump(oci_result($stmt, 'STRING')); } echo "Test 3\n"; diff --git a/ext/oci8/tests/define5.phpt b/ext/oci8/tests/define5.phpt index 2dd9980d45..3f1e57741b 100644 --- a/ext/oci8/tests/define5.phpt +++ b/ext/oci8/tests/define5.phpt @@ -25,8 +25,8 @@ $stmt = oci_parse($c, "select string from define5_tab where id = 1"); oci_execute($stmt); var_dump(oci_define_by_name($stmt, "STRING", $string)); while (oci_fetch($stmt)) { - var_dump($string); // gives NULL - var_dump(oci_result($stmt, 'STRING')); + var_dump($string); // gives NULL + var_dump(oci_result($stmt, 'STRING')); } echo "Test 2 - normal define order\n"; @@ -35,15 +35,15 @@ var_dump(oci_define_by_name($stmt, "STRING", $string)); oci_execute($stmt); while (oci_fetch($stmt)) { - var_dump($string); + var_dump($string); } echo "Test 3 - no new define done\n"; $stmt = oci_parse($c, "select string from define5_tab where id = 2"); oci_execute($stmt); while (oci_fetch($stmt)) { - var_dump($string); // not updated with new value - var_dump(oci_result($stmt, 'STRING')); + var_dump($string); // not updated with new value + var_dump(oci_result($stmt, 'STRING')); } // Cleanup diff --git a/ext/oci8/tests/define_old.phpt b/ext/oci8/tests/define_old.phpt index 634a86d370..25458e1283 100644 --- a/ext/oci8/tests/define_old.phpt +++ b/ext/oci8/tests/define_old.phpt @@ -29,7 +29,7 @@ ocidefinebyname($stmt, "STRING", $string, 20); ociexecute($stmt); while (ocifetch($stmt)) { - var_dump($string); + var_dump($string); } // Cleanup diff --git a/ext/oci8/tests/descriptors.phpt b/ext/oci8/tests/descriptors.phpt index 193e1e76f8..44d4ab0a01 100644 --- a/ext/oci8/tests/descriptors.phpt +++ b/ext/oci8/tests/descriptors.phpt @@ -12,11 +12,11 @@ require __DIR__.'/connect.inc'; require __DIR__.'/create_table.inc'; $ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; + ".$schema.$table_name." (blob) + VALUES (empty_blob()) + RETURNING + blob + INTO :v_blob "; $statement = oci_parse($c,$ora_sql); $blob = oci_new_descriptor($c,OCI_D_LOB); diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc index 731b562d0a..101ebfcd79 100644 --- a/ext/oci8/tests/details.inc +++ b/ext/oci8/tests/details.inc @@ -12,32 +12,32 @@ */ if (file_exists(dirname(__FILE__)."/details_local.inc")) { - include(dirname(__FILE__)."/details_local.inc"); // this file is not part of the source distribution; make it your own local variant of details.inc + include(dirname(__FILE__)."/details_local.inc"); // this file is not part of the source distribution; make it your own local variant of details.inc } else { - if (false !== getenv('PHP_OCI8_TEST_DB')) { - $user = getenv('PHP_OCI8_TEST_USER'); // Database username for tests - $password = getenv('PHP_OCI8_TEST_PASS'); // Password for $user - $dbase = getenv('PHP_OCI8_TEST_DB'); // Database connection string - $test_drcp = getenv('PHP_OCI8_TEST_DRCP'); - if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) { - $test_drcp = TRUE; - } else { - $test_drcp = FALSE; - } - } else { - $user = "system"; - $password = "oracle"; - $dbase = "localhost/XE"; - $test_drcp = FALSE; - } + if (false !== getenv('PHP_OCI8_TEST_DB')) { + $user = getenv('PHP_OCI8_TEST_USER'); // Database username for tests + $password = getenv('PHP_OCI8_TEST_PASS'); // Password for $user + $dbase = getenv('PHP_OCI8_TEST_DB'); // Database connection string + $test_drcp = getenv('PHP_OCI8_TEST_DRCP'); + if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) { + $test_drcp = TRUE; + } else { + $test_drcp = FALSE; + } + } else { + $user = "system"; + $password = "oracle"; + $dbase = "localhost/XE"; + $test_drcp = FALSE; + } - /* - * Common object names for scripts to use - */ + /* + * Common object names for scripts to use + */ - $table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5); - $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5)); - $schema = ''; + $table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5); + $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5)); + $schema = ''; } @@ -59,14 +59,14 @@ if (!function_exists('oci8_test_sql_execute')) { if (!$r) { $m = oci_error($s); if (!in_array($m['code'], array( // ignore expected errors - 942 // table or view does not exist + 942 // table or view does not exist , 1918 // user does not exist , 2024 // database link not found , 2289 // sequence does not exist , 4080 // trigger does not exist , 38802 // edition does not exist ))) { - echo "oci8_test_sql_execute() error:". PHP_EOL . $stmt . PHP_EOL . $m['message'] . PHP_EOL; + echo "oci8_test_sql_execute() error:". PHP_EOL . $stmt . PHP_EOL . $m['message'] . PHP_EOL; } } } diff --git a/ext/oci8/tests/drcp_characterset.phpt b/ext/oci8/tests/drcp_characterset.phpt index c5a5339e04..fdcacead93 100644 --- a/ext/oci8/tests/drcp_characterset.phpt +++ b/ext/oci8/tests/drcp_characterset.phpt @@ -31,17 +31,17 @@ var_dump($p2); //character sets if((int)$c1 === (int)$c2) - echo "First and third connections share a resource: NOT OK\n"; + echo "First and third connections share a resource: NOT OK\n"; else - echo "First and third connections are different: OK\n"; + echo "First and third connections are different: OK\n"; // The two connections p1 and p2 should not share resources as they use different //character sets if((int)$p1 === (int)$p2) - echo "Second and fourth connections share a resource: NOT OK\n"; + echo "Second and fourth connections share a resource: NOT OK\n"; else - echo "Second and fourth connections are different: OK\n"; + echo "Second and fourth connections are different: OK\n"; // Close all the connections oci_close($c1); diff --git a/ext/oci8/tests/drcp_conn_close1.phpt b/ext/oci8/tests/drcp_conn_close1.phpt index 71a070eadb..b1afb4779b 100644 --- a/ext/oci8/tests/drcp_conn_close1.phpt +++ b/ext/oci8/tests/drcp_conn_close1.phpt @@ -30,9 +30,9 @@ oci_close($conn2); // Compare the resource numbers if ($rn1 === $rn2) - echo "Both connections share a resource : OK\n"; + echo "Both connections share a resource : OK\n"; else - echo "Both connections are different : NOT OK\n"; + echo "Both connections are different : NOT OK\n"; echo "Done\n"; diff --git a/ext/oci8/tests/drcp_conn_close2.phpt b/ext/oci8/tests/drcp_conn_close2.phpt index 7939e53d9e..cb4df083a6 100644 --- a/ext/oci8/tests/drcp_conn_close2.phpt +++ b/ext/oci8/tests/drcp_conn_close2.phpt @@ -31,9 +31,9 @@ oci_close($conn2); // Compare the resource numbers if ($rn1 === $rn2) - echo "Both connections share a resource : NOT OK\n"; + echo "Both connections share a resource : NOT OK\n"; else - echo "Both connections are different : OK\n"; + echo "Both connections are different : OK\n"; echo "Done\n"; diff --git a/ext/oci8/tests/drcp_functions.inc b/ext/oci8/tests/drcp_functions.inc index 320026486e..595f82da1f 100644 --- a/ext/oci8/tests/drcp_functions.inc +++ b/ext/oci8/tests/drcp_functions.inc @@ -4,90 +4,90 @@ function drcp_create_table($conn) { - $create_sql = "CREATE TABLE DRCPTEST (id NUMBER, name VARCHAR2(10), dept VARCHAR2(10))"; - $statement = oci_parse($conn, $create_sql); - oci_execute($statement); + $create_sql = "CREATE TABLE DRCPTEST (id NUMBER, name VARCHAR2(10), dept VARCHAR2(10))"; + $statement = oci_parse($conn, $create_sql); + oci_execute($statement); - $id_values = array(100,101,102,103,104,105,106,107,108); - $name_values = array("WIILIAMS","JOHN","SMITH","JONES","ADAMS","ROBERT", - "BILL","LAWSON","MARY"); - $dept_values = array("ACCOUNTS","HR","HR","ADMIN","ACCOUNTS","HR", - "ACCOUNTS","HR","ACCOUNTS"); - for($i=0; $i<8; $i++) { - $insert = "INSERT INTO DRCPTEST VALUES(".$id_values[$i].",'". $name_values[$i]."','".$dept_values[$i]."')"; - $s = oci_parse($conn, $insert); - oci_execute($s); - } + $id_values = array(100,101,102,103,104,105,106,107,108); + $name_values = array("WIILIAMS","JOHN","SMITH","JONES","ADAMS","ROBERT", + "BILL","LAWSON","MARY"); + $dept_values = array("ACCOUNTS","HR","HR","ADMIN","ACCOUNTS","HR", + "ACCOUNTS","HR","ACCOUNTS"); + for($i=0; $i<8; $i++) { + $insert = "INSERT INTO DRCPTEST VALUES(".$id_values[$i].",'". $name_values[$i]."','".$dept_values[$i]."')"; + $s = oci_parse($conn, $insert); + oci_execute($s); + } } function drcp_drop_table($conn) { - $ora_sql = "DROP TABLE DRCPTEST"; - $statement = oci_parse($conn, $ora_sql); - oci_execute($statement); + $ora_sql = "DROP TABLE DRCPTEST"; + $statement = oci_parse($conn, $ora_sql); + oci_execute($statement); } function drcp_update_table($conn) { - $update_stmt ="Update drcptest set dept ='NEWDEPT' where id = 105"; - $s1 = oci_parse($conn,$update_stmt); - oci_execute($s1,OCI_DEFAULT); - echo "Update done-- DEPT value has been set to NEWDEPT\n"; + $update_stmt ="Update drcptest set dept ='NEWDEPT' where id = 105"; + $s1 = oci_parse($conn,$update_stmt); + oci_execute($s1,OCI_DEFAULT); + echo "Update done-- DEPT value has been set to NEWDEPT\n"; } function drcp_select_value($conn) { - $sel_stmt="select dept from drcptest where id=105"; - $s2 = oci_parse($conn,$sel_stmt); - oci_execute($s2,OCI_DEFAULT); - while(oci_fetch($s2)) { - echo "The value of DEPT for id 105 is ".oci_result($s2,1)."\n"; - } + $sel_stmt="select dept from drcptest where id=105"; + $s2 = oci_parse($conn,$sel_stmt); + oci_execute($s2,OCI_DEFAULT); + while(oci_fetch($s2)) { + echo "The value of DEPT for id 105 is ".oci_result($s2,1)."\n"; + } } function drcp_select_packagevar($conn) { - $sel_stmt="select drcp_test_package.f1 as f1 from dual"; - $s2 = oci_parse($conn, $sel_stmt); - oci_define_by_name($s2,'f1',$ret_num); - oci_execute($s2); - while(oci_fetch($s2)) { - echo " The value of the package variable is ".oci_result($s2,1)."\n"; - } + $sel_stmt="select drcp_test_package.f1 as f1 from dual"; + $s2 = oci_parse($conn, $sel_stmt); + oci_define_by_name($s2,'f1',$ret_num); + oci_execute($s2); + while(oci_fetch($s2)) { + echo " The value of the package variable is ".oci_result($s2,1)."\n"; + } } function drcp_set_packagevar($conn,$num) { - $set_stmt = "begin drcp_test_package.p1($num); end;"; - $s1 = oci_parse($conn,$set_stmt); - oci_execute($s1); - echo " Package variable value set to " .$num."\n"; + $set_stmt = "begin drcp_test_package.p1($num); end;"; + $s1 = oci_parse($conn,$set_stmt); + oci_execute($s1); + echo " Package variable value set to " .$num."\n"; } function drcp_create_package($c) { - $create_package_stmt = "create or replace package drcp_test_package as - var int :=0; - procedure p1(var1 int); - function f1 return number; - end;"; - $s1 = oci_parse($c, $create_package_stmt); - oci_execute($s1); + $create_package_stmt = "create or replace package drcp_test_package as + var int :=0; + procedure p1(var1 int); + function f1 return number; + end;"; + $s1 = oci_parse($c, $create_package_stmt); + oci_execute($s1); - $package_body = "create or replace package body drcp_test_package as - procedure p1(var1 int) is - begin - var :=var1; - end; - function f1 return number is - begin - return drcp_test_package.var; - end; - end;"; + $package_body = "create or replace package body drcp_test_package as + procedure p1(var1 int) is + begin + var :=var1; + end; + function f1 return number is + begin + return drcp_test_package.var; + end; + end;"; - $s2 = oci_parse($c, $package_body); - oci_execute($s2); + $s2 = oci_parse($c, $package_body); + oci_execute($s2); } ?> diff --git a/ext/oci8/tests/drcp_newconnect.phpt b/ext/oci8/tests/drcp_newconnect.phpt index cf4b6de17b..3c41edbb73 100644 --- a/ext/oci8/tests/drcp_newconnect.phpt +++ b/ext/oci8/tests/drcp_newconnect.phpt @@ -24,9 +24,9 @@ $rn2 = (int)$c2; // rn1 and rn2 should be different. if ($rn1 === $rn2) - echo "First and second connections share a resource: Not OK\n"; + echo "First and second connections share a resource: Not OK\n"; else - echo "First and second connections are different OK\n"; + echo "First and second connections are different OK\n"; // Close the connections oci_close($c1); diff --git a/ext/oci8/tests/drcp_pconn_close1.phpt b/ext/oci8/tests/drcp_pconn_close1.phpt index df0caa2433..e4849169ae 100644 --- a/ext/oci8/tests/drcp_pconn_close1.phpt +++ b/ext/oci8/tests/drcp_pconn_close1.phpt @@ -29,9 +29,9 @@ oci_close($conn2); // Compare the resource numbers if ($rn1 === $rn2) - echo "Both connections share a resource : OK\n"; + echo "Both connections share a resource : OK\n"; else - echo "Both connections are different : NOT OK\n"; + echo "Both connections are different : NOT OK\n"; echo "Done\n"; diff --git a/ext/oci8/tests/drcp_pconn_close2.phpt b/ext/oci8/tests/drcp_pconn_close2.phpt index 02bed68358..4961cb9545 100644 --- a/ext/oci8/tests/drcp_pconn_close2.phpt +++ b/ext/oci8/tests/drcp_pconn_close2.phpt @@ -31,9 +31,9 @@ oci_close($conn2); // Compare the resource numbers if ($rn1 === $rn2) - echo "Both connections share a resource : NOT OK\n"; + echo "Both connections share a resource : NOT OK\n"; else - echo "Both connections are different : OK\n"; + echo "Both connections are different : OK\n"; echo "Done\n"; diff --git a/ext/oci8/tests/drcp_scope1.phpt b/ext/oci8/tests/drcp_scope1.phpt index 78e2e900c9..807c352a20 100644 --- a/ext/oci8/tests/drcp_scope1.phpt +++ b/ext/oci8/tests/drcp_scope1.phpt @@ -42,32 +42,32 @@ function2($user,$password,$dbase,$conn_type); function function1($user,$password,$dbase,$conn_type) { - switch($conn_type) - { - case 1: - var_dump($conn1 = oci_new_connect($user,$password,$dbase)); - break; - case 2: - var_dump($conn1 = oci_connect($user,$password,$dbase)); - break; - } - drcp_update_table($conn1); + switch($conn_type) + { + case 1: + var_dump($conn1 = oci_new_connect($user,$password,$dbase)); + break; + case 2: + var_dump($conn1 = oci_connect($user,$password,$dbase)); + break; + } + drcp_update_table($conn1); } // This is the second scope function function2($user,$password,$dbase,$conn_type) { - switch($conn_type) - { - case 1: - var_dump($conn1 = oci_new_connect($user,$password,$dbase)); - break; - case 2: - var_dump($conn1 = oci_connect($user,$password,$dbase)); - break; - } - drcp_select_value($conn1); + switch($conn_type) + { + case 1: + var_dump($conn1 = oci_new_connect($user,$password,$dbase)); + break; + case 2: + var_dump($conn1 = oci_connect($user,$password,$dbase)); + break; + } + drcp_select_value($conn1); } drcp_drop_table($c); diff --git a/ext/oci8/tests/drcp_scope2.phpt b/ext/oci8/tests/drcp_scope2.phpt index 05a4c558ec..99e102075d 100644 --- a/ext/oci8/tests/drcp_scope2.phpt +++ b/ext/oci8/tests/drcp_scope2.phpt @@ -42,32 +42,32 @@ function2($user,$password,$dbase,$conn_type); function function1($user,$password,$dbase,$conn_type) { - switch($conn_type) - { - case 1: - var_dump($conn1 = oci_new_connect($user,$password,$dbase)); - break; - case 2: - var_dump($conn1 = oci_connect($user,$password,$dbase)); - break; - } - drcp_update_table($conn1); + switch($conn_type) + { + case 1: + var_dump($conn1 = oci_new_connect($user,$password,$dbase)); + break; + case 2: + var_dump($conn1 = oci_connect($user,$password,$dbase)); + break; + } + drcp_update_table($conn1); } // This is the second scope function function2($user,$password,$dbase,$conn_type) { - switch($conn_type) - { - case 1: - var_dump($conn1 = oci_new_connect($user,$password,$dbase)); - break; - case 2: - var_dump($conn1 = oci_connect($user,$password,$dbase)); - break; - } - drcp_select_value($conn1); + switch($conn_type) + { + case 1: + var_dump($conn1 = oci_new_connect($user,$password,$dbase)); + break; + case 2: + var_dump($conn1 = oci_connect($user,$password,$dbase)); + break; + } + drcp_select_value($conn1); } drcp_drop_table($c); oci_close($c); diff --git a/ext/oci8/tests/drcp_scope3.phpt b/ext/oci8/tests/drcp_scope3.phpt index 975f87bed9..8d97d48e99 100644 --- a/ext/oci8/tests/drcp_scope3.phpt +++ b/ext/oci8/tests/drcp_scope3.phpt @@ -32,16 +32,16 @@ function2($user,$password,$dbase); function function1($user,$password,$dbase) { - var_dump($c = oci_pconnect($user,$password,$dbase)); - drcp_update_table($c); + var_dump($c = oci_pconnect($user,$password,$dbase)); + drcp_update_table($c); } // This is the second scope function function2($user,$password,$dbase) { - var_dump($c = oci_pconnect($user,$password,$dbase)); - drcp_select_value($c); + var_dump($c = oci_pconnect($user,$password,$dbase)); + drcp_select_value($c); } drcp_drop_table($c); diff --git a/ext/oci8/tests/drcp_scope4.phpt b/ext/oci8/tests/drcp_scope4.phpt index dced1c3f1c..abc631a437 100644 --- a/ext/oci8/tests/drcp_scope4.phpt +++ b/ext/oci8/tests/drcp_scope4.phpt @@ -35,16 +35,16 @@ function2($user,$password,$dbase); function function1($user,$password,$dbase) { - var_dump($c = oci_pconnect($user,$password,$dbase)); - drcp_update_table($c); + var_dump($c = oci_pconnect($user,$password,$dbase)); + drcp_update_table($c); } // This is the second scope function function2($user,$password,$dbase) { - var_dump($c = oci_pconnect($user,$password,$dbase)); - drcp_select_value($c); + var_dump($c = oci_pconnect($user,$password,$dbase)); + drcp_select_value($c); } drcp_drop_table($c); diff --git a/ext/oci8/tests/drcp_scope5.phpt b/ext/oci8/tests/drcp_scope5.phpt index d3ccb56da0..b84853423a 100644 --- a/ext/oci8/tests/drcp_scope5.phpt +++ b/ext/oci8/tests/drcp_scope5.phpt @@ -35,17 +35,17 @@ function2($user,$password,$dbase); function function1($user,$password,$dbase) { - var_dump($c = oci_pconnect($user,$password,$dbase)); - drcp_update_table($c); + var_dump($c = oci_pconnect($user,$password,$dbase)); + drcp_update_table($c); } // This is the second scope function function2($user,$password,$dbase) { - var_dump($c = oci_pconnect($user,$password,$dbase)); - drcp_select_value($c); - oci_commit($c); + var_dump($c = oci_pconnect($user,$password,$dbase)); + drcp_select_value($c); + oci_commit($c); } drcp_drop_table($c); diff --git a/ext/oci8/tests/driver_name.phpt b/ext/oci8/tests/driver_name.phpt index 29b2cef520..c9d1181ef6 100644 --- a/ext/oci8/tests/driver_name.phpt +++ b/ext/oci8/tests/driver_name.phpt @@ -43,7 +43,7 @@ echo "Done\n"; function get_attr($conn) { - $sel_stmt = "select client_driver + $sel_stmt = "select client_driver from v\$session_connect_info sci, v\$session s where sci.client_driver is not null and sci.sid = s.sid diff --git a/ext/oci8/tests/driver_name_11gR2.phpt b/ext/oci8/tests/driver_name_11gR2.phpt index bb82b92fa3..6eb2e0d6e7 100644 --- a/ext/oci8/tests/driver_name_11gR2.phpt +++ b/ext/oci8/tests/driver_name_11gR2.phpt @@ -40,7 +40,7 @@ echo "Done\n"; function get_attr($conn) { - $sel_stmt = "select client_driver + $sel_stmt = "select client_driver from v\$session_connect_info sci, v\$session s where sci.client_driver is not null and sci.sid = s.sid diff --git a/ext/oci8/tests/edition_1.phpt b/ext/oci8/tests/edition_1.phpt index 9bdf699a70..b75dfe4350 100644 --- a/ext/oci8/tests/edition_1.phpt +++ b/ext/oci8/tests/edition_1.phpt @@ -39,11 +39,11 @@ $testpassword = 'testuser'; require(__DIR__."/conn_attr.inc"); function select_fn($conn) { - $s = oci_parse($conn,"select * from view_ed"); - oci_execute($s); - while ($row = oci_fetch_row($s)) { - var_dump($row); - } + $s = oci_parse($conn,"select * from view_ed"); + oci_execute($s); + while ($row = oci_fetch_row($s)) { + var_dump($row); + } } /* Create a editon MYEDITION create a view view_ed in MYEDITION1. diff --git a/ext/oci8/tests/edition_2.phpt b/ext/oci8/tests/edition_2.phpt index 1aebe1a03b..a556fb4a17 100644 --- a/ext/oci8/tests/edition_2.phpt +++ b/ext/oci8/tests/edition_2.phpt @@ -87,12 +87,12 @@ oci_close($c5); echo "\n\n**Test 1.4 - with different type of values *********\n"; $values_array = array(123,NULL,'NO EDITION','edition name which has more than thirty chars!!!edition name which has more than thirty chars!!!'); foreach ($values_array as $val ) { - set_edit_attr($val); - $c1 = get_conn(1); //oci_connect() - if ($c1) { - get_edit_attr($c1); - oci_close($c1); - } + set_edit_attr($val); + $c1 = get_conn(1); //oci_connect() + if ($c1) { + get_edit_attr($c1); + oci_close($c1); + } } echo "\n\n**Test 1.5 - Negative case with an invalid string value. *********\n"; @@ -149,7 +149,7 @@ echo "Done\n"; function set_scope() { - $r = set_edit_attr('MYEDITION1'); + $r = set_edit_attr('MYEDITION1'); } function get_scope() { @@ -158,8 +158,8 @@ function get_scope() { $m = oci_error(); die("Error:" . $m['message']); } - get_edit_attr($sc1); - oci_close($sc1); + get_edit_attr($sc1); + oci_close($sc1); } ?> --EXPECTF-- diff --git a/ext/oci8/tests/error_parse.phpt b/ext/oci8/tests/error_parse.phpt index 1992826618..548ed3bfc0 100644 --- a/ext/oci8/tests/error_parse.phpt +++ b/ext/oci8/tests/error_parse.phpt @@ -15,49 +15,49 @@ require(__DIR__.'/details.inc'); // Test parse error for normal connection if (!empty($dbase)) { - $c1 = oci_connect($user,$password,$dbase); + $c1 = oci_connect($user,$password,$dbase); } else { - $c1 = oci_connect($user,$password); + $c1 = oci_connect($user,$password); } $s = @oci_parse($c1, "select ' from dual"); if (!$s) { - echo "Normal connection: Parse error\n"; - $m = oci_error($c1); - var_dump($m); + echo "Normal connection: Parse error\n"; + $m = oci_error($c1); + var_dump($m); } // Test parse error for new connection if (!empty($dbase)) { - $c2 = oci_new_connect($user,$password,$dbase); + $c2 = oci_new_connect($user,$password,$dbase); } else { - $c2 = oci_new_connect($user,$password); + $c2 = oci_new_connect($user,$password); } $s = @oci_parse($c2, "select ' from dual"); if (!$s) { - echo "New connection: Parse error\n"; - $m = oci_error($c2); - var_dump($m); + echo "New connection: Parse error\n"; + $m = oci_error($c2); + var_dump($m); } // Test parse error for persistent connection if (!empty($dbase)) { - $c3 = oci_pconnect($user,$password,$dbase); + $c3 = oci_pconnect($user,$password,$dbase); } else { - $c3 = oci_pconnect($user,$password); + $c3 = oci_pconnect($user,$password); } $s = @oci_parse($c3, "select ' from dual"); if (!$s) { - echo "Persistent connection: Parse error\n"; - $m = oci_error($c3); - var_dump($m); + echo "Persistent connection: Parse error\n"; + $m = oci_error($c3); + var_dump($m); } // Verify that passing no connection doesn't affect future calls diff --git a/ext/oci8/tests/extauth_01.phpt b/ext/oci8/tests/extauth_01.phpt index f90562d118..db23097d82 100644 --- a/ext/oci8/tests/extauth_01.phpt +++ b/ext/oci8/tests/extauth_01.phpt @@ -18,8 +18,8 @@ echo "Test 1\n"; $c = oci_connect('/', 'notemtpy', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -27,8 +27,8 @@ echo "Test 2\n"; $c = oci_connect('notemtpy', 'notemtpy', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -36,8 +36,8 @@ echo "Test 3\n"; $c = oci_connect('notemtpy', '', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -45,8 +45,8 @@ echo "Test 4\n"; $c = oci_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -54,8 +54,8 @@ echo "Test 5\n"; $c = oci_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER+OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -63,8 +63,8 @@ echo "Test 6\n"; $c = oci_connect('', '', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -72,8 +72,8 @@ echo "Test 7\n"; $c = oci_connect('/', '', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -81,8 +81,8 @@ echo "Test 8\n"; $c = oci_connect('/', null, 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -90,8 +90,8 @@ echo "Test 9\n"; $c = oci_connect('/', '', 'd', null, OCI_SYSDBA+OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -99,8 +99,8 @@ echo "Test 10\n"; $c = oci_connect('/', '', 'd', null, OCI_SYSOPER+OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); diff --git a/ext/oci8/tests/extauth_02.phpt b/ext/oci8/tests/extauth_02.phpt index 11b522e4d7..c8c3dd6725 100644 --- a/ext/oci8/tests/extauth_02.phpt +++ b/ext/oci8/tests/extauth_02.phpt @@ -17,8 +17,8 @@ echo "Test 1\n"; $c = oci_new_connect('/', 'notemtpy', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -26,8 +26,8 @@ echo "Test 2\n"; $c = oci_new_connect('notemtpy', 'notemtpy', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -35,8 +35,8 @@ echo "Test 3\n"; $c = oci_new_connect('notemtpy', '', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -44,8 +44,8 @@ echo "Test 4\n"; $c = oci_new_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -53,8 +53,8 @@ echo "Test 5\n"; $c = oci_new_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER+OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -62,8 +62,8 @@ echo "Test 6\n"; $c = oci_new_connect('', '', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -71,8 +71,8 @@ echo "Test 7\n"; $c = oci_new_connect('/', '', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -80,8 +80,8 @@ echo "Test 8\n"; $c = oci_new_connect('/', null, 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -89,8 +89,8 @@ echo "Test 9\n"; $c = oci_new_connect('/', '', 'd', null, OCI_SYSDBA+OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -98,8 +98,8 @@ echo "Test 10\n"; $c = oci_new_connect('/', '', 'd', null, OCI_SYSOPER+OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); diff --git a/ext/oci8/tests/extauth_03.phpt b/ext/oci8/tests/extauth_03.phpt index 7cb80e261e..863f94499b 100644 --- a/ext/oci8/tests/extauth_03.phpt +++ b/ext/oci8/tests/extauth_03.phpt @@ -17,8 +17,8 @@ echo "Test 1\n"; $c = oci_pconnect('/', 'notemtpy', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -26,8 +26,8 @@ echo "Test 2\n"; $c = oci_pconnect('notemtpy', 'notemtpy', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -35,8 +35,8 @@ echo "Test 3\n"; $c = oci_pconnect('notemtpy', '', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -44,8 +44,8 @@ echo "Test 4\n"; $c = oci_pconnect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -53,8 +53,8 @@ echo "Test 5\n"; $c = oci_pconnect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER+OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -62,8 +62,8 @@ echo "Test 6\n"; $c = oci_pconnect('', '', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -71,8 +71,8 @@ echo "Test 7\n"; $c = oci_pconnect('/', '', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -80,8 +80,8 @@ echo "Test 8\n"; $c = oci_pconnect('/', null, 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -89,8 +89,8 @@ echo "Test 9\n"; $c = oci_pconnect('/', '', 'd', null, OCI_SYSDBA+OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -98,8 +98,8 @@ echo "Test 10\n"; $c = oci_pconnect('/', '', 'd', null, OCI_SYSOPER+OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); diff --git a/ext/oci8/tests/extauth_04.phpt b/ext/oci8/tests/extauth_04.phpt index edb2fbd912..5f4e64fc84 100644 --- a/ext/oci8/tests/extauth_04.phpt +++ b/ext/oci8/tests/extauth_04.phpt @@ -14,8 +14,8 @@ echo "Test 1\n"; $c = oci_connect('/', '', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -23,8 +23,8 @@ echo "Test 2\n"; $c = oci_new_connect('/', '', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); @@ -32,8 +32,8 @@ echo "Test 3\n"; $c = oci_pconnect('/', '', 'anything', null, OCI_CRED_EXT); if (!$c) { - $m = oci_error(); - var_dump($m); + $m = oci_error(); + var_dump($m); } var_dump($c); diff --git a/ext/oci8/tests/fetch.phpt b/ext/oci8/tests/fetch.phpt index eeba992db2..eae30bad23 100644 --- a/ext/oci8/tests/fetch.phpt +++ b/ext/oci8/tests/fetch.phpt @@ -22,18 +22,18 @@ oci8_test_sql_execute($c, $stmtarray); // Run Test if (!($s = oci_parse($c, "select * from fetch_tab"))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } while(ocifetch($s)) { - $row = ociresult($s, 1); - $row1 = ociresult($s, 2); - var_dump($row); - var_dump($row1); + $row = ociresult($s, 1); + $row1 = ociresult($s, 2); + var_dump($row); + var_dump($row1); } // Cleanup diff --git a/ext/oci8/tests/fetch_all1.phpt b/ext/oci8/tests/fetch_all1.phpt index 2d27f8e02b..b531364109 100644 --- a/ext/oci8/tests/fetch_all1.phpt +++ b/ext/oci8/tests/fetch_all1.phpt @@ -20,19 +20,19 @@ $stmtarray = array( oci8_test_sql_execute($c, $stmtarray); if (!($s = oci_parse($c, "select * from fetch_all_tab"))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } /* oci_fetch_all */ if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } var_dump(oci_fetch_all($s, $all)); var_dump($all); /* ocifetchstatement */ if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } var_dump(ocifetchstatement($s, $all)); diff --git a/ext/oci8/tests/fetch_all2.phpt b/ext/oci8/tests/fetch_all2.phpt index cafd0eb509..c9f5175c58 100644 --- a/ext/oci8/tests/fetch_all2.phpt +++ b/ext/oci8/tests/fetch_all2.phpt @@ -16,7 +16,7 @@ $insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; $s = oci_parse($c, $insert_sql); for ($i = 0; $i<3; $i++) { - oci_execute($s); + oci_execute($s); } oci_commit($c); diff --git a/ext/oci8/tests/fetch_all4.phpt b/ext/oci8/tests/fetch_all4.phpt index 4edc820698..039cb9ff47 100644 --- a/ext/oci8/tests/fetch_all4.phpt +++ b/ext/oci8/tests/fetch_all4.phpt @@ -10,9 +10,9 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table fetch_all4_tab", - "create table fetch_all4_tab (mycol1 number, mycol2 varchar2(20))", - "insert into fetch_all4_tab values (1, 'abc')" + "drop table fetch_all4_tab", + "create table fetch_all4_tab (mycol1 number, mycol2 varchar2(20))", + "insert into fetch_all4_tab values (1, 'abc')" ); oci8_test_sql_execute($c, $stmtarray); @@ -39,7 +39,7 @@ var_dump($row); // Clean up $stmtarray = array( - "drop table fetch_all4_tab" + "drop table fetch_all4_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/fetch_all5.phpt b/ext/oci8/tests/fetch_all5.phpt index e8e1ba4757..86d451c98b 100644 --- a/ext/oci8/tests/fetch_all5.phpt +++ b/ext/oci8/tests/fetch_all5.phpt @@ -10,11 +10,11 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table fetch_all5_tab", - "create table fetch_all5_tab (mycol1 number, mycol2 varchar2(20))", - "insert into fetch_all5_tab values (1, 'abc')", - "insert into fetch_all5_tab values (2, 'def')", - "insert into fetch_all5_tab values (3, 'ghi')" + "drop table fetch_all5_tab", + "create table fetch_all5_tab (mycol1 number, mycol2 varchar2(20))", + "insert into fetch_all5_tab values (1, 'abc')", + "insert into fetch_all5_tab values (2, 'def')", + "insert into fetch_all5_tab values (3, 'ghi')" ); oci8_test_sql_execute($c, $stmtarray); @@ -48,7 +48,7 @@ var_dump($res); // Clean up $stmtarray = array( - "drop table fetch_all5_tab" + "drop table fetch_all5_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/fetch_array.phpt b/ext/oci8/tests/fetch_array.phpt index b7f327dcd4..ff74ad7673 100644 --- a/ext/oci8/tests/fetch_array.phpt +++ b/ext/oci8/tests/fetch_array.phpt @@ -14,17 +14,17 @@ require __DIR__.'/create_table.inc'; $insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); + die("oci_parse(insert) failed!\n"); } for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } + if (!oci_execute($s)) { + die("oci_execute(insert) failed!\n"); + } } if (!oci_commit($c)) { - die("oci_commit() failed!\n"); + die("oci_commit() failed!\n"); } echo "Test 1\n"; @@ -32,68 +32,68 @@ echo "Test 1\n"; $select_sql = "SELECT * FROM ".$schema."".$table_name.""; if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } while ($row = oci_fetch_array($s)) { - var_dump($row); + var_dump($row); } echo "Test 2\n"; if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } while ($row = oci_fetch_array($s, OCI_NUM)) { - var_dump($row); + var_dump($row); } echo "Test 3\n"; if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } while ($row = oci_fetch_array($s, OCI_ASSOC)) { - var_dump($row); + var_dump($row); } echo "Test 4\n"; if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } while ($row = oci_fetch_array($s, OCI_BOTH)) { - var_dump($row); + var_dump($row); } echo "Test 5\n"; if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } while ($row = oci_fetch_array($s, OCI_RETURN_LOBS)) { - var_dump($row); + var_dump($row); } echo "Test 6\n"; if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } while ($row = oci_fetch_array($s, OCI_RETURN_NULLS)) { - var_dump($row); + var_dump($row); } echo "Test 7\n"; if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } while ($row = oci_fetch_array($s, OCI_NUM+OCI_RETURN_NULLS)) { - var_dump($row); + var_dump($row); } require __DIR__.'/drop_table.inc'; diff --git a/ext/oci8/tests/fetch_assoc.phpt b/ext/oci8/tests/fetch_assoc.phpt index e891858efa..bf0c1a0f18 100644 --- a/ext/oci8/tests/fetch_assoc.phpt +++ b/ext/oci8/tests/fetch_assoc.phpt @@ -8,11 +8,11 @@ oci_fetch_assoc() require __DIR__."/connect.inc"; $stmtarray = array( - "drop table fetch_assoc_tab", - "create table fetch_assoc_tab (id number, value number, dummy varchar2(20))", - "insert into fetch_assoc_tab values (1,1,null)", - "insert into fetch_assoc_tab values (1,1,null)", - "insert into fetch_assoc_tab values (1,1,null)" + "drop table fetch_assoc_tab", + "create table fetch_assoc_tab (id number, value number, dummy varchar2(20))", + "insert into fetch_assoc_tab values (1,1,null)", + "insert into fetch_assoc_tab values (1,1,null)", + "insert into fetch_assoc_tab values (1,1,null)" ); oci8_test_sql_execute($c, $stmtarray); @@ -20,20 +20,20 @@ oci8_test_sql_execute($c, $stmtarray); $select_sql = "select * from fetch_assoc_tab"; if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } while ($row = oci_fetch_assoc($s)) { - var_dump($row); + var_dump($row); } // Clean up $stmtarray = array( - "drop table fetch_assoc_tab" + "drop table fetch_assoc_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/fetch_into.phpt b/ext/oci8/tests/fetch_into.phpt index 04f6743a75..634e7379ef 100644 --- a/ext/oci8/tests/fetch_into.phpt +++ b/ext/oci8/tests/fetch_into.phpt @@ -22,19 +22,19 @@ oci8_test_sql_execute($c, $stmtarray); // Run Test if (!($s = oci_parse($c, "select * from fetch_into_tab"))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } /* ocifetchinto */ if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } var_dump(ocifetchinto($s, $all)); var_dump($all); /* ocifetchinto */ if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS)); var_dump($all); diff --git a/ext/oci8/tests/fetch_into1.phpt b/ext/oci8/tests/fetch_into1.phpt index 97e511869e..27591eaa97 100644 --- a/ext/oci8/tests/fetch_into1.phpt +++ b/ext/oci8/tests/fetch_into1.phpt @@ -14,27 +14,27 @@ require __DIR__.'/create_table.inc'; $insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value, string) VALUES (1, 1, NULL)"; if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); + die("oci_parse(insert) failed!\n"); } for ($i = 0; $i<20; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } + if (!oci_execute($s)) { + die("oci_execute(insert) failed!\n"); + } } if (!oci_commit($c)) { - die("oci_commit() failed!\n"); + die("oci_commit() failed!\n"); } $select_sql = "SELECT * FROM ".$schema."".$table_name.""; if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } var_dump(ocifetchinto($s, $all, OCI_NUM)); var_dump($all); diff --git a/ext/oci8/tests/fetch_into2.phpt b/ext/oci8/tests/fetch_into2.phpt index b79e282350..8c166e1eca 100644 --- a/ext/oci8/tests/fetch_into2.phpt +++ b/ext/oci8/tests/fetch_into2.phpt @@ -14,27 +14,27 @@ require __DIR__.'/create_table.inc'; $insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value, string) VALUES (1, 1, NULL)"; if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); + die("oci_parse(insert) failed!\n"); } for ($i = 0; $i<20; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } + if (!oci_execute($s)) { + die("oci_execute(insert) failed!\n"); + } } if (!oci_commit($c)) { - die("oci_commit() failed!\n"); + die("oci_commit() failed!\n"); } $select_sql = "SELECT * FROM ".$schema."".$table_name.""; if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } var_dump(ocifetchinto($s)); var_dump($all); diff --git a/ext/oci8/tests/fetch_row.phpt b/ext/oci8/tests/fetch_row.phpt index b50b65d480..6dcc1f2c5c 100644 --- a/ext/oci8/tests/fetch_row.phpt +++ b/ext/oci8/tests/fetch_row.phpt @@ -22,14 +22,14 @@ oci8_test_sql_execute($c, $stmtarray); // Run Test if (!($s = oci_parse($c, "select * from fetch_row_tab"))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } while ($row = oci_fetch_row($s)) { - var_dump($row); + var_dump($row); } // Cleanup diff --git a/ext/oci8/tests/field_funcs.phpt b/ext/oci8/tests/field_funcs.phpt index 1432dcd4c0..76ff3d4f9f 100644 --- a/ext/oci8/tests/field_funcs.phpt +++ b/ext/oci8/tests/field_funcs.phpt @@ -14,41 +14,41 @@ require __DIR__.'/create_table.inc'; $insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); + die("oci_parse(insert) failed!\n"); } for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } + if (!oci_execute($s)) { + die("oci_execute(insert) failed!\n"); + } } if (!oci_commit($c)) { - die("oci_commit() failed!\n"); + die("oci_commit() failed!\n"); } $select_sql = "SELECT * FROM ".$schema."".$table_name.""; if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } $row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS); var_dump($row); foreach ($row as $num => $field) { - $num++; - var_dump(oci_field_is_null($s, $num)); - var_dump(oci_field_name($s, $num)); - var_dump(oci_field_type($s, $num)); - var_dump(oci_field_type_raw($s, $num)); - var_dump(oci_field_scale($s, $num)); - var_dump(oci_field_precision($s, $num)); - var_dump(oci_field_size($s, $num)); + $num++; + var_dump(oci_field_is_null($s, $num)); + var_dump(oci_field_name($s, $num)); + var_dump(oci_field_type($s, $num)); + var_dump(oci_field_type_raw($s, $num)); + var_dump(oci_field_scale($s, $num)); + var_dump(oci_field_precision($s, $num)); + var_dump(oci_field_size($s, $num)); } diff --git a/ext/oci8/tests/field_funcs2.phpt b/ext/oci8/tests/field_funcs2.phpt index 896a63d11b..623bc3d835 100644 --- a/ext/oci8/tests/field_funcs2.phpt +++ b/ext/oci8/tests/field_funcs2.phpt @@ -11,26 +11,26 @@ $s = oci_parse($c, 'drop table field_funcs2_tab'); @oci_execute($s); $t = array("C01" => "NUMBER", - "C02" => "NUMBER(*,1)", - "C03" => "NUMBER(9)", - "C04" => "NUMBER(9,2)", - "C05" => "NUMBER(9,1)", - "C06" => "NUMBER(7,-2)", - "C07" => "DECIMAL(4,9)", - "C08" => "NUMERIC(4,9)", - "C09" => "DECIMAL(4)", - "C10" => "INTEGER", - "C11" => "INT", - "C12" => "SMALLINT", - "C13" => "FLOAT", - "C14" => "FLOAT(9)", - "C15" => "DOUBLE PRECISION", - "C16" => "REAL", - ); + "C02" => "NUMBER(*,1)", + "C03" => "NUMBER(9)", + "C04" => "NUMBER(9,2)", + "C05" => "NUMBER(9,1)", + "C06" => "NUMBER(7,-2)", + "C07" => "DECIMAL(4,9)", + "C08" => "NUMERIC(4,9)", + "C09" => "DECIMAL(4)", + "C10" => "INTEGER", + "C11" => "INT", + "C12" => "SMALLINT", + "C13" => "FLOAT", + "C14" => "FLOAT(9)", + "C15" => "DOUBLE PRECISION", + "C16" => "REAL", + ); $stmt = "create table field_funcs2_tab (\n"; foreach ($t as $colname => $type) { - $stmt .= "$colname $type,\n"; + $stmt .= "$colname $type,\n"; } $stmt[strlen($stmt)-2] = ")"; @@ -41,10 +41,10 @@ $s = oci_parse($c, "select * from field_funcs2_tab"); oci_execute($s); for ($i = 1; $i <= oci_num_fields($s); $i++) { - $name = oci_field_name($s, $i); - $precision = oci_field_precision($s, $i); - $scale = oci_field_scale($s, $i); - echo "$name ".$t[$name] .": precision $precision, scale $scale\n"; + $name = oci_field_name($s, $i); + $precision = oci_field_precision($s, $i); + $scale = oci_field_scale($s, $i); + echo "$name ".$t[$name] .": precision $precision, scale $scale\n"; } echo "Done\n"; diff --git a/ext/oci8/tests/field_funcs3.phpt b/ext/oci8/tests/field_funcs3.phpt index 965b224973..75d050321e 100644 --- a/ext/oci8/tests/field_funcs3.phpt +++ b/ext/oci8/tests/field_funcs3.phpt @@ -25,31 +25,31 @@ oci8_test_sql_execute($c, $stmtarray); $select_sql = "select * from field_funcs3_tab"; if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } $row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS); var_dump($row); foreach ($row as $num => $field) { - $num++; - var_dump(oci_field_is_null($s, $num)); - var_dump(oci_field_name($s, $num)); - var_dump(oci_field_type($s, $num)); - var_dump(oci_field_type_raw($s, $num)); - var_dump(oci_field_scale($s, $num)); - var_dump(oci_field_precision($s, $num)); - var_dump(oci_field_size($s, $num)); + $num++; + var_dump(oci_field_is_null($s, $num)); + var_dump(oci_field_name($s, $num)); + var_dump(oci_field_type($s, $num)); + var_dump(oci_field_type_raw($s, $num)); + var_dump(oci_field_scale($s, $num)); + var_dump(oci_field_precision($s, $num)); + var_dump(oci_field_size($s, $num)); } // Clean up $stmtarray = array( - "drop table field_funcs3_tab" + "drop table field_funcs3_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/field_funcs_old.phpt b/ext/oci8/tests/field_funcs_old.phpt index 6417de15cd..afb6dc62e1 100644 --- a/ext/oci8/tests/field_funcs_old.phpt +++ b/ext/oci8/tests/field_funcs_old.phpt @@ -14,41 +14,41 @@ require __DIR__.'/create_table.inc'; $insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; if (!($s = ociparse($c, $insert_sql))) { - die("ociparse(insert) failed!\n"); + die("ociparse(insert) failed!\n"); } for ($i = 0; $i<3; $i++) { - if (!ociexecute($s)) { - die("ociexecute(insert) failed!\n"); - } + if (!ociexecute($s)) { + die("ociexecute(insert) failed!\n"); + } } if (!ocicommit($c)) { - die("ocicommit() failed!\n"); + die("ocicommit() failed!\n"); } $select_sql = "SELECT * FROM ".$schema."".$table_name.""; if (!($s = ociparse($c, $select_sql))) { - die("ociparse(select) failed!\n"); + die("ociparse(select) failed!\n"); } if (!ociexecute($s)) { - die("ociexecute(select) failed!\n"); + die("ociexecute(select) failed!\n"); } ocifetchinto($s, $row, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS); var_dump($row); foreach ($row as $num => $field) { - $num++; - var_dump(ocicolumnisnull($s, $num)); - var_dump(ocicolumnname($s, $num)); - var_dump(ocicolumntype($s, $num)); - var_dump(ocicolumntyperaw($s, $num)); - var_dump(ocicolumnscale($s, $num)); - var_dump(ocicolumnprecision($s, $num)); - var_dump(ocicolumnsize($s, $num)); + $num++; + var_dump(ocicolumnisnull($s, $num)); + var_dump(ocicolumnname($s, $num)); + var_dump(ocicolumntype($s, $num)); + var_dump(ocicolumntyperaw($s, $num)); + var_dump(ocicolumnscale($s, $num)); + var_dump(ocicolumnprecision($s, $num)); + var_dump(ocicolumnsize($s, $num)); } diff --git a/ext/oci8/tests/lob_001.phpt b/ext/oci8/tests/lob_001.phpt Binary files differindex 72352ef2cf..3e9c061ee0 100644 --- a/ext/oci8/tests/lob_001.phpt +++ b/ext/oci8/tests/lob_001.phpt diff --git a/ext/oci8/tests/lob_002.phpt b/ext/oci8/tests/lob_002.phpt index d914285228..156fd668d3 100644 --- a/ext/oci8/tests/lob_002.phpt +++ b/ext/oci8/tests/lob_002.phpt @@ -13,8 +13,8 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table lob_002_tab", - "create table lob_002_tab (id number, b1 BLOB)", + "drop table lob_002_tab", + "create table lob_002_tab (id number, b1 BLOB)", ); oci8_test_sql_execute($c, $stmtarray); @@ -47,7 +47,7 @@ var_dump(strlen($row[0])); // Cleanup $stmtarray = array( - "drop table lob_002_tab" + "drop table lob_002_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/lob_008.phpt b/ext/oci8/tests/lob_008.phpt index 53b75302ef..57fce95130 100644 --- a/ext/oci8/tests/lob_008.phpt +++ b/ext/oci8/tests/lob_008.phpt @@ -37,7 +37,7 @@ var_dump($row = oci_fetch_array($s)); $len = 0; while (!$row[0]->eof()) { - $len += strlen($row[0]->read(1024)); + $len += strlen($row[0]->read(1024)); } var_dump($len); diff --git a/ext/oci8/tests/lob_009.phpt b/ext/oci8/tests/lob_009.phpt index 090503f927..56d2495a62 100644 --- a/ext/oci8/tests/lob_009.phpt +++ b/ext/oci8/tests/lob_009.phpt @@ -35,7 +35,7 @@ oci_execute($s, OCI_DEFAULT); var_dump($row = oci_fetch_array($s)); while (!$row[0]->eof()) { - var_dump(str_replace("\r", "", $row[0]->read(1024))); + var_dump(str_replace("\r", "", $row[0]->read(1024))); } require __DIR__.'/drop_table.inc'; diff --git a/ext/oci8/tests/lob_010.phpt b/ext/oci8/tests/lob_010.phpt index b4a0a77d1e..50924e5516 100644 --- a/ext/oci8/tests/lob_010.phpt +++ b/ext/oci8/tests/lob_010.phpt @@ -34,7 +34,7 @@ oci_execute($s, OCI_DEFAULT); $row = oci_fetch_array($s); while (!$row[0]->eof()) { - var_dump($row[0]->read(1024)); + var_dump($row[0]->read(1024)); } require __DIR__.'/drop_table.inc'; diff --git a/ext/oci8/tests/lob_018.phpt b/ext/oci8/tests/lob_018.phpt index e618790726..2feab1a3f3 100644 --- a/ext/oci8/tests/lob_018.phpt +++ b/ext/oci8/tests/lob_018.phpt @@ -13,8 +13,8 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table lob_018_tab", - "create table lob_018_tab (mykey number, lob_1 clob)", + "drop table lob_018_tab", + "create table lob_018_tab (mykey number, lob_1 clob)", ); oci8_test_sql_execute($c, $stmtarray); @@ -45,8 +45,8 @@ $statement = oci_parse ($c, $query); oci_execute($statement, OCI_DEFAULT); while ($row = oci_fetch_array($statement, OCI_ASSOC)) { - $result = $row['LOB_1']->load(); - var_dump($result); + $result = $row['LOB_1']->load(); + var_dump($result); } echo "Test 2\n"; @@ -56,8 +56,8 @@ $statement = oci_parse ($c, $query); oci_execute($statement, OCI_DEFAULT); while ($row = oci_fetch_array($statement, OCI_ASSOC)) { - $result = $row['LOB_1']->load(); - var_dump($result); + $result = $row['LOB_1']->load(); + var_dump($result); } echo "Test 3 - bind with SQLT_CLOB (an alias for OCI_B_CLOB)\n"; @@ -76,8 +76,8 @@ $statement = oci_parse ($c, $query); oci_execute($statement, OCI_DEFAULT); while ($row = oci_fetch_array($statement, OCI_ASSOC)) { - $result = $row['LOB_1']->load(); - var_dump($result); + $result = $row['LOB_1']->load(); + var_dump($result); } // Cleanup diff --git a/ext/oci8/tests/lob_022.phpt b/ext/oci8/tests/lob_022.phpt index 3de78dcd2a..e353eda526 100644 --- a/ext/oci8/tests/lob_022.phpt +++ b/ext/oci8/tests/lob_022.phpt @@ -48,8 +48,8 @@ $statement = oci_parse ($c, $query); oci_execute($statement, OCI_DEFAULT); while ($row = oci_fetch_array($statement, OCI_ASSOC)) { - $result = $row['LOB_1']->load(); - var_dump($result); + $result = $row['LOB_1']->load(); + var_dump($result); } $query = 'SELECT * FROM lob_test ORDER BY mykey DESC'; @@ -57,8 +57,8 @@ $statement = oci_parse ($c, $query); oci_execute($statement, OCI_DEFAULT); while ($row = oci_fetch_array($statement, OCI_ASSOC)) { - $result = $row['LOB_1']->load(); - var_dump($result); + $result = $row['LOB_1']->load(); + var_dump($result); } $drop = "DROP table lob_test"; diff --git a/ext/oci8/tests/lob_023.phpt b/ext/oci8/tests/lob_023.phpt index 8093ab63af..f8b295a441 100644 --- a/ext/oci8/tests/lob_023.phpt +++ b/ext/oci8/tests/lob_023.phpt @@ -40,7 +40,7 @@ oci_execute($s, OCI_DEFAULT); var_dump($row = oci_fetch_array($s)); while (!$row[0]->eof()) { - var_dump(str_replace("\r", "", $row[0]->read(1024))); + var_dump(str_replace("\r", "", $row[0]->read(1024))); } require __DIR__.'/drop_table.inc'; diff --git a/ext/oci8/tests/lob_027.phpt b/ext/oci8/tests/lob_027.phpt index ec759ccb0a..ccea9b30cb 100644 --- a/ext/oci8/tests/lob_027.phpt +++ b/ext/oci8/tests/lob_027.phpt @@ -39,15 +39,15 @@ oci_commit($c); for ($i = 5; $i >= 0; $i--) { - $select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; - $s = oci_parse($c, $select_sql); - oci_execute($s, OCI_DEFAULT); + $select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; + $s = oci_parse($c, $select_sql); + oci_execute($s, OCI_DEFAULT); - $row = oci_fetch_array($s); - var_dump($row['BLOB']->load()); - var_dump($row['BLOB']->truncate(($i-1)*10)); + $row = oci_fetch_array($s); + var_dump($row['BLOB']->load()); + var_dump($row['BLOB']->truncate(($i-1)*10)); - oci_commit($c); + oci_commit($c); } $select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; diff --git a/ext/oci8/tests/lob_040.phpt b/ext/oci8/tests/lob_040.phpt index 2c0d361a59..3711c4b54d 100644 --- a/ext/oci8/tests/lob_040.phpt +++ b/ext/oci8/tests/lob_040.phpt @@ -14,8 +14,8 @@ require(__DIR__.'/connect.inc'); require(__DIR__.'/create_table.inc'); for ($i = 0; $i < NUMLOBS; $i++) { - $s = oci_parse($c, "insert into ".$schema.$table_name." (id, clob) values(".$i.", '".$i."aaaa".$i.$i."aaaaaaaaaaaaaaaaaaaaaaaaaaaz')"); - oci_execute($s); + $s = oci_parse($c, "insert into ".$schema.$table_name." (id, clob) values(".$i.", '".$i."aaaa".$i.$i."aaaaaaaaaaaaaaaaaaaaaaaaaaaz')"); + oci_execute($s); } echo "Test 1: CLOB as locator\n"; @@ -25,15 +25,15 @@ oci_execute($s); $row = array(); for ($i = 0; $i < NUMLOBS; $i++) { - $row[$i] = oci_fetch_array($s, OCI_NUM); + $row[$i] = oci_fetch_array($s, OCI_NUM); } for ($i = 0; $i < NUMLOBS; $i++) { - echo "Row $i Size: " . $row[$i][0]->size() . "\n"; - echo "Pos 1: " . $row[$i][0]->tell() . "\n"; - echo "Data: " . $row[$i][0]->read(5) . "\n"; - echo "Pos 2: " . $row[$i][0]->tell() . "\n"; - echo "Data: " . $row[$i][0]->read(12) . "\n"; + echo "Row $i Size: " . $row[$i][0]->size() . "\n"; + echo "Pos 1: " . $row[$i][0]->tell() . "\n"; + echo "Data: " . $row[$i][0]->read(5) . "\n"; + echo "Pos 2: " . $row[$i][0]->tell() . "\n"; + echo "Data: " . $row[$i][0]->read(12) . "\n"; } echo "Done\n"; diff --git a/ext/oci8/tests/lob_041.phpt b/ext/oci8/tests/lob_041.phpt index dd0bfd58be..e2bf5fbaa1 100644 --- a/ext/oci8/tests/lob_041.phpt +++ b/ext/oci8/tests/lob_041.phpt @@ -13,9 +13,9 @@ require __DIR__.'/connect.inc'; // Initialization $stmtarray = array( - "DROP table lob_041_tab", - "CREATE table lob_041_tab(c1 CLOB)", - "INSERT INTO lob_041_tab VALUES('test data')" + "DROP table lob_041_tab", + "CREATE table lob_041_tab(c1 CLOB)", + "INSERT INTO lob_041_tab VALUES('test data')" ); oci8_test_sql_execute($c, $stmtarray); @@ -57,7 +57,7 @@ var_dump($data); echo "Done\n"; $stmtarray = array( - "DROP table lob_041_tab" + "DROP table lob_041_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/lob_043.phpt b/ext/oci8/tests/lob_043.phpt index 32b4ccdbdc..c0f8973dfd 100644 --- a/ext/oci8/tests/lob_043.phpt +++ b/ext/oci8/tests/lob_043.phpt @@ -14,9 +14,9 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table lob_043_tab", - "create table lob_043_tab(id number, c1 clob)", - "begin + "drop table lob_043_tab", + "create table lob_043_tab(id number, c1 clob)", + "begin for i in 1..50000 loop insert into lob_043_tab (id, c1) values (i, i || ' abcdefghijklmnopq'); end loop; @@ -70,7 +70,7 @@ $r = f2($c); // Clean up $stmtarray = array( - "drop table lob_043_tab" + "drop table lob_043_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/lob_044.phpt b/ext/oci8/tests/lob_044.phpt index cec6b126ff..242eef195d 100644 --- a/ext/oci8/tests/lob_044.phpt +++ b/ext/oci8/tests/lob_044.phpt @@ -13,8 +13,8 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table lob_044_tab", - "create table lob_044_tab (blob BLOB)", + "drop table lob_044_tab", + "create table lob_044_tab (blob BLOB)", ); oci8_test_sql_execute($c, $stmtarray); @@ -51,7 +51,7 @@ var_dump($row[0]->read(10000)); // Clean up $stmtarray = array( - "drop table lob_044_tab" + "drop table lob_044_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/password.phpt b/ext/oci8/tests/password.phpt index b3f3bfce0c..1e8d8c83aa 100644 --- a/ext/oci8/tests/password.phpt +++ b/ext/oci8/tests/password.phpt @@ -14,8 +14,8 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode"); require(__DIR__."/connect.inc"); $stmtarray = array( - "drop user testuser_pw cascade", - "create user testuser_pw identified by testuserpwd", + "drop user testuser_pw cascade", + "create user testuser_pw identified by testuserpwd", "grant connect, create session to testuser_pw" ); @@ -41,21 +41,21 @@ $rn3 = (int)$c3; // Connections should differ if ($rn1 == $rn2) { - echo "First and second connections share a resource: Not OK\n"; - var_dump($c1); + echo "First and second connections share a resource: Not OK\n"; + var_dump($c1); } else { - echo "First and second connections are different: OK\n"; + echo "First and second connections are different: OK\n"; } // Connections should be the same if ($rn1 == $rn3) { - echo "First and third connections share a resource: OK\n"; + echo "First and third connections share a resource: OK\n"; } else { - echo "First and third connections are different: Not OK\n"; - var_dump($c1); - var_dump($c2); + echo "First and third connections are different: Not OK\n"; + var_dump($c1); + var_dump($c2); } echo "Done\n"; diff --git a/ext/oci8/tests/password_2.phpt b/ext/oci8/tests/password_2.phpt index b3e9e3058f..b47fad57f3 100644 --- a/ext/oci8/tests/password_2.phpt +++ b/ext/oci8/tests/password_2.phpt @@ -14,7 +14,7 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode"); require(__DIR__."/connect.inc"); $stmtarray = array( - "drop user testuser_pw2 cascade", + "drop user testuser_pw2 cascade", "create user testuser_pw2 identified by testuserpwd", "grant connect, create session to testuser_pw2" ); @@ -40,21 +40,21 @@ $rn3 = (int)$c3; // Connections should differ if ($rn1 == $rn2) { - echo "First and second connections share a resource: Not OK\n"; - var_dump($c1); + echo "First and second connections share a resource: Not OK\n"; + var_dump($c1); } else { - echo "First and second connections are different: OK\n"; + echo "First and second connections are different: OK\n"; } // Connections should be the same if ($rn1 == $rn3) { - echo "First and third connections share a resource: OK\n"; + echo "First and third connections share a resource: OK\n"; } else { - echo "First and third connections are different: Not OK\n"; - var_dump($c1); - var_dump($c2); + echo "First and third connections are different: Not OK\n"; + var_dump($c1); + var_dump($c2); } echo "Done\n"; diff --git a/ext/oci8/tests/pecl_bug10194.phpt b/ext/oci8/tests/pecl_bug10194.phpt index c0265af34f..d4b0707abc 100644 --- a/ext/oci8/tests/pecl_bug10194.phpt +++ b/ext/oci8/tests/pecl_bug10194.phpt @@ -34,7 +34,7 @@ $row = oci_fetch_assoc($statement); $string = str_repeat("test", 32768*4*4); for ($i = 0; $i < 8; $i++) { - $row['CLOB']->write($string); + $row['CLOB']->write($string); } oci_commit($c); diff --git a/ext/oci8/tests/pecl_bug6109.phpt b/ext/oci8/tests/pecl_bug6109.phpt index f5cee7065d..b529058ff8 100644 --- a/ext/oci8/tests/pecl_bug6109.phpt +++ b/ext/oci8/tests/pecl_bug6109.phpt @@ -15,12 +15,12 @@ $s = oci_parse($c, 'delete from table_does_not_exist'); $r = @oci_execute($s); if ($r) { - echo "whoops - table does exist\n"; + echo "whoops - table does exist\n"; } else { - for ($i = 0; $i < 5; $i++) { - $err = oci_error($s); - echo ($i) .' -> '.$err['message'] ."\n"; - } + for ($i = 0; $i < 5; $i++) { + $err = oci_error($s); + echo ($i) .' -> '.$err['message'] ."\n"; + } } // Cleanup diff --git a/ext/oci8/tests/pecl_bug8816.phpt b/ext/oci8/tests/pecl_bug8816.phpt index 30b76265dc..dda6b9f8b1 100644 --- a/ext/oci8/tests/pecl_bug8816.phpt +++ b/ext/oci8/tests/pecl_bug8816.phpt @@ -29,17 +29,17 @@ $values = array("1234567890111111111", "122222222222222", "985456745674567654567 $i = 0; foreach ($values as $val) { - $i++; - $insert = "INSERT INTO t1 VALUES($i, ".$val.")"; - $s = oci_parse($c, $insert); - oci_execute($s); + $i++; + $insert = "INSERT INTO t1 VALUES($i, ".$val.")"; + $s = oci_parse($c, $insert); + oci_execute($s); } foreach ($values as $val) { - $insert = "INSERT INTO t2 VALUES($i, ".$val.")"; - $s = oci_parse($c, $insert); - oci_execute($s); - $i--; + $insert = "INSERT INTO t2 VALUES($i, ".$val.")"; + $s = oci_parse($c, $insert); + oci_execute($s); + $i--; } $query =" @@ -56,7 +56,7 @@ $sth = oci_parse($c, $query); oci_execute($sth); while ( $row = oci_fetch_assoc($sth) ) { - var_dump($row); + var_dump($row); } $s1 = oci_parse($c, $drop_1); diff --git a/ext/oci8/tests/prefetch.phpt b/ext/oci8/tests/prefetch.phpt index fa71b5ac6a..2bf1153ada 100644 --- a/ext/oci8/tests/prefetch.phpt +++ b/ext/oci8/tests/prefetch.phpt @@ -24,13 +24,13 @@ oci8_test_sql_execute($c, $stmtarray); $select_sql = "select * from prefetch_tab"; if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } var_dump(oci_set_prefetch($s, 10)); if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } var_dump(oci_fetch($s)); diff --git a/ext/oci8/tests/prefetch_old.phpt b/ext/oci8/tests/prefetch_old.phpt index 58bdae7565..1fdf01305e 100644 --- a/ext/oci8/tests/prefetch_old.phpt +++ b/ext/oci8/tests/prefetch_old.phpt @@ -20,19 +20,19 @@ oci8_test_sql_execute($c, $stmtarray); // Run Test if (!ocicommit($c)) { - die("ocicommit() failed!\n"); + die("ocicommit() failed!\n"); } $select_sql = "select * from prefetch_old_tab"; if (!($s = ociparse($c, $select_sql))) { - die("ociparse(select) failed!\n"); + die("ociparse(select) failed!\n"); } var_dump(ocisetprefetch($s, 10)); if (!ociexecute($s)) { - die("ociexecute(select) failed!\n"); + die("ociexecute(select) failed!\n"); } var_dump(ocifetch($s)); diff --git a/ext/oci8/tests/refcur_prefetch_1.phpt b/ext/oci8/tests/refcur_prefetch_1.phpt index 1f00b9b031..911a481063 100644 --- a/ext/oci8/tests/refcur_prefetch_1.phpt +++ b/ext/oci8/tests/refcur_prefetch_1.phpt @@ -23,25 +23,25 @@ require(__DIR__."/connect.inc"); // Creates the necessary package and tables. $stmtarray = array( - "DROP TABLE refcurtest", - "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))", + "DROP TABLE refcurtest", + "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))", "CREATE or REPLACE PACKAGE refcurpkg is type refcursortype is ref cursor; procedure open_ref_cur(cur1 out refcursortype); procedure fetch_ref_cur(cur1 in refcursortype, c1 out number,c2 out varchar2); end refcurpkg;", "CREATE or REPLACE PACKAGE body refcurpkg is - procedure open_ref_cur(cur1 out refcursortype) is + procedure open_ref_cur(cur1 out refcursortype) is begin - open cur1 for select * from refcurtest order by c1; - end open_ref_cur; - procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, - c2 out varchar2) is - begin - fetch cur1 into c1,c2; - end fetch_ref_cur; + open cur1 for select * from refcurtest order by c1; + end open_ref_cur; + procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, + c2 out varchar2) is + begin + fetch cur1 into c1,c2; + end fetch_ref_cur; end refcurpkg;" - ); + ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/refcur_prefetch_2.phpt b/ext/oci8/tests/refcur_prefetch_2.phpt index 10f0764a7a..69146914a4 100644 --- a/ext/oci8/tests/refcur_prefetch_2.phpt +++ b/ext/oci8/tests/refcur_prefetch_2.phpt @@ -23,25 +23,25 @@ require __DIR__."/connect.inc"; // Creates the necessary package and tables. $stmtarray = array( - "DROP TABLE refcurtest", - "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))", + "DROP TABLE refcurtest", + "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))", "CREATE or REPLACE PACKAGE refcurpkg is type refcursortype is ref cursor; procedure open_ref_cur(cur1 out refcursortype); procedure fetch_ref_cur(cur1 in refcursortype, c1 out number,c2 out varchar2); end refcurpkg;", "CREATE or REPLACE PACKAGE body refcurpkg is - procedure open_ref_cur(cur1 out refcursortype) is + procedure open_ref_cur(cur1 out refcursortype) is begin - open cur1 for select * from refcurtest order by c1; - end open_ref_cur; - procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, - c2 out varchar2) is - begin - fetch cur1 into c1,c2; - end fetch_ref_cur; + open cur1 for select * from refcurtest order by c1; + end open_ref_cur; + procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, + c2 out varchar2) is + begin + fetch cur1 into c1,c2; + end fetch_ref_cur; end refcurpkg;" - ); + ); oci8_test_sql_execute($c, $stmtarray); @@ -130,7 +130,7 @@ var_dump($c2); function print_roundtrips($c) { $sql_stmt = "select value from v\$mystat a,v\$statname c where - a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'"; + a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'"; $s = oci_parse($c,$sql_stmt); oci_define_by_name($s,"VALUE",$value); oci_execute($s); diff --git a/ext/oci8/tests/refcur_prefetch_4.phpt b/ext/oci8/tests/refcur_prefetch_4.phpt index 8aee48cfee..6c0b1b26d0 100644 --- a/ext/oci8/tests/refcur_prefetch_4.phpt +++ b/ext/oci8/tests/refcur_prefetch_4.phpt @@ -23,9 +23,9 @@ require __DIR__."/connect.inc"; // Creates the necessary package and tables. $stmtarray = array( - "DROP TABLE refcurtest", + "DROP TABLE refcurtest", - "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))", + "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))", "CREATE or REPLACE PACKAGE refcurpkg is type refcursortype is ref cursor; @@ -34,16 +34,16 @@ $stmtarray = array( end refcurpkg;", "CREATE or REPLACE PACKAGE body refcurpkg is - procedure open_ref_cur(cur1 out refcursortype) is + procedure open_ref_cur(cur1 out refcursortype) is begin - open cur1 for select * from refcurtest order by c1; - end open_ref_cur; - procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, c2 out varchar2) is - begin - fetch cur1 into c1,c2; - end fetch_ref_cur; + open cur1 for select * from refcurtest order by c1; + end open_ref_cur; + procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, c2 out varchar2) is + begin + fetch cur1 into c1,c2; + end fetch_ref_cur; end refcurpkg;" - ); + ); oci8_test_sql_execute($c, $stmtarray); @@ -134,7 +134,7 @@ var_dump($c2); function print_roundtrips($c) { $sql_stmt = "select value from v\$mystat a,v\$statname c where - a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'"; + a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'"; $s = oci_parse($c,$sql_stmt); oci_define_by_name($s,"VALUE",$value); oci_execute($s); diff --git a/ext/oci8/tests/serverversion.phpt b/ext/oci8/tests/serverversion.phpt index 2667cc5539..d2a781e6a3 100644 --- a/ext/oci8/tests/serverversion.phpt +++ b/ext/oci8/tests/serverversion.phpt @@ -8,10 +8,10 @@ oci_server_version() require __DIR__."/connect.inc"; if (!empty($dbase)) { - var_dump($c = oci_connect($user, $password, $dbase)); + var_dump($c = oci_connect($user, $password, $dbase)); } else { - var_dump($c = oci_connect($user, $password)); + var_dump($c = oci_connect($user, $password)); } $v = oci_server_version($c); diff --git a/ext/oci8/tests/statement_type.phpt b/ext/oci8/tests/statement_type.phpt index e294cac60e..d8e6772750 100644 --- a/ext/oci8/tests/statement_type.phpt +++ b/ext/oci8/tests/statement_type.phpt @@ -12,8 +12,8 @@ $sqls = Array( "DELETE FROM table WHERE id = 1", "INSERT INTO table VALUES(1)", "UPDATE table SET id = 1", - "DROP TABLE table", - "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;", + "DROP TABLE table", + "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;", "CREATE TABLE table (id NUMBER)", "ALTER TABLE table ADD (col1 NUMBER)", "BEGIN NULL; END;", @@ -24,8 +24,8 @@ $sqls = Array( ); foreach ($sqls as $sql) { - $s = oci_parse($c, $sql); - var_dump(oci_statement_type($s)); + $s = oci_parse($c, $sql); + var_dump(oci_statement_type($s)); } echo "Done\n"; diff --git a/ext/oci8/tests/statement_type_old.phpt b/ext/oci8/tests/statement_type_old.phpt index aa0565e27b..b095bc245f 100644 --- a/ext/oci8/tests/statement_type_old.phpt +++ b/ext/oci8/tests/statement_type_old.phpt @@ -8,10 +8,10 @@ ocistatementtype() require __DIR__."/connect.inc"; if (!empty($dbase)) { - var_dump($c = ocilogon($user, $password, $dbase)); + var_dump($c = ocilogon($user, $password, $dbase)); } else { - var_dump($c = ocilogon($user, $password)); + var_dump($c = ocilogon($user, $password)); } $sqls = Array( @@ -19,8 +19,8 @@ $sqls = Array( "DELETE FROM table WHERE id = 1", "INSERT INTO table VALUES(1)", "UPDATE table SET id = 1", - "DROP TABLE table", - "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;", + "DROP TABLE table", + "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;", "CREATE TABLE table (id NUMBER)", "ALTER TABLE table ADD (col1 NUMBER)", "BEGIN NULL; END;", @@ -31,8 +31,8 @@ $sqls = Array( ); foreach ($sqls as $sql) { - $s = ociparse($c, $sql); - var_dump(ocistatementtype($s)); + $s = ociparse($c, $sql); + var_dump(ocistatementtype($s)); } echo "Done\n"; diff --git a/ext/oci8/tests/testping.phpt b/ext/oci8/tests/testping.phpt index 2c64c440d7..589b5c21b0 100644 --- a/ext/oci8/tests/testping.phpt +++ b/ext/oci8/tests/testping.phpt @@ -10,12 +10,12 @@ oci8.ping_interval=0 require(__DIR__.'/details.inc'); for ($i = 0; $i < 2; $i++) { - if (!empty($dbase)) { - $c = oci_pconnect($user,$password,$dbase); - } - else { - $c = oci_pconnect($user,$password); - } + if (!empty($dbase)) { + $c = oci_pconnect($user,$password,$dbase); + } + else { + $c = oci_pconnect($user,$password); + } } echo "Done\n"; diff --git a/ext/oci8/tests/xmltype_01.phpt b/ext/oci8/tests/xmltype_01.phpt index debbe14f83..a99a39223e 100644 --- a/ext/oci8/tests/xmltype_01.phpt +++ b/ext/oci8/tests/xmltype_01.phpt @@ -14,37 +14,37 @@ require(__DIR__."/connect.inc"); // Initialization $stmtarray = array( - "drop table xtt", - "create table xtt - (xt_id number, xt_spec xmltype) - xmltype xt_spec store as clob", - "insert into xtt (xt_id, xt_spec) values - (1, - xmltype('<?xml version=\"1.0\"?> - <Xt> - <XtId>1</XtId> - <Size>Big</Size> - <Area>12345</Area> - <Hardness>20</Hardness> - <Lip>Curved</Lip> - <Color>Red</Color> - <Nice>N</Nice> - <Compact>Tiny</Compact> - <Material>Steel</Material> - </Xt>'))" + "drop table xtt", + "create table xtt + (xt_id number, xt_spec xmltype) + xmltype xt_spec store as clob", + "insert into xtt (xt_id, xt_spec) values + (1, + xmltype('<?xml version=\"1.0\"?> + <Xt> + <XtId>1</XtId> + <Size>Big</Size> + <Area>12345</Area> + <Hardness>20</Hardness> + <Lip>Curved</Lip> + <Color>Red</Color> + <Nice>N</Nice> + <Compact>Tiny</Compact> + <Material>Steel</Material> + </Xt>'))" ); oci8_test_sql_execute($c, str_replace("\r", "", $stmtarray)); function do_query($c) { - $s = oci_parse($c, 'select XMLType.getClobVal(xt_spec) - from xtt where xt_id = 1'); - oci_execute($s); - $row = oci_fetch_row($s); - $data = $row[0]->load(); - var_dump($data); - return($data); + $s = oci_parse($c, 'select XMLType.getClobVal(xt_spec) + from xtt where xt_id = 1'); + oci_execute($s); + $row = oci_fetch_row($s); + $data = $row[0]->load(); + var_dump($data); + return($data); } // Check @@ -58,8 +58,8 @@ $sx->Nice = 'Y'; // Insert changes using a temporary CLOB $s = oci_parse($c, 'update xtt - set xt_spec = XMLType(:clob) - where xt_id = 1'); + set xt_spec = XMLType(:clob) + where xt_id = 1'); $lob = oci_new_descriptor($c, OCI_D_LOB); oci_bind_by_name($s, ':clob', $lob, -1, OCI_B_CLOB); $lob->writeTemporary($sx->asXml()); @@ -73,7 +73,7 @@ $data = do_query($c); // Cleanup $stmtarray = array( - "drop table xtt", + "drop table xtt", ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/xmltype_02.phpt b/ext/oci8/tests/xmltype_02.phpt index 7e11654b4d..6b701b0c93 100644 --- a/ext/oci8/tests/xmltype_02.phpt +++ b/ext/oci8/tests/xmltype_02.phpt @@ -14,8 +14,8 @@ require(__DIR__.'/connect.inc'); // Initialization $stmtarray = array( - "drop table xmltype_02_tab", - "create table xmltype_02_tab (warehouse_id number, warehouse_spec xmltype)", + "drop table xmltype_02_tab", + "create table xmltype_02_tab (warehouse_id number, warehouse_spec xmltype)", ); oci8_test_sql_execute($c, $stmtarray); @@ -101,7 +101,7 @@ $row[0]->free(); // Clean up $stmtarray = array( - "drop table xmltype_02_tab" + "drop table xmltype_02_tab" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/odbc/tests/bug47803.phpt b/ext/odbc/tests/bug47803.phpt index 8069d5141f..f13da017ba 100644 --- a/ext/odbc/tests/bug47803.phpt +++ b/ext/odbc/tests/bug47803.phpt @@ -8,9 +8,9 @@ Bug #47803 Executing prepared statements is successful only for the first two st include __DIR__ . "/config.inc"; $create_table = "CREATE TABLE FOO( - [PAR_ID] [int] NOT NULL, - [PAR_INT] [int] NULL, - [PAR_CHR] [varchar](500) NULL + [PAR_ID] [int] NOT NULL, + [PAR_INT] [int] NULL, + [PAR_CHR] [varchar](500) NULL )"; $inserts = "INSERT INTO FOO @@ -19,16 +19,16 @@ $inserts = "INSERT INTO FOO ,[PAR_CHR]) VALUES (1,14,''), - (2,30,''), - (3,7,''), - (4,7,''), - (5,0,''), - (6,0,''), - (7,20130901,''), - (8,20140201,''), - (9,20140201,''), - (10,20140620,''), - (11,221,'')"; + (2,30,''), + (3,7,''), + (4,7,''), + (5,0,''), + (6,0,''), + (7,20130901,''), + (8,20140201,''), + (9,20140201,''), + (10,20140620,''), + (11,221,'')"; date_default_timezone_set('Europe/Warsaw'); @@ -40,47 +40,47 @@ odbc_exec($link, $create_table); odbc_exec($link, $inserts); $upd_params = array( - array('id'=>1, 'name'=>'test 1'), - array('id'=>2, 'name'=>'test 2'), - array('id'=>3, 'name'=>'test 3'), - array('id'=>4, 'name'=>'test 4'), - array('id'=>5, 'name'=>'test 5'), - array('id'=>10, 'name'=>'test 10'), - array('id'=>9, 'name'=>'test 9'), - array('id'=>8, 'name'=>'test 8'), - array('id'=>7, 'name'=>'test 7'), - array('id'=>6, 'name'=>'test 6'), + array('id'=>1, 'name'=>'test 1'), + array('id'=>2, 'name'=>'test 2'), + array('id'=>3, 'name'=>'test 3'), + array('id'=>4, 'name'=>'test 4'), + array('id'=>5, 'name'=>'test 5'), + array('id'=>10, 'name'=>'test 10'), + array('id'=>9, 'name'=>'test 9'), + array('id'=>8, 'name'=>'test 8'), + array('id'=>7, 'name'=>'test 7'), + array('id'=>6, 'name'=>'test 6'), ); $sql = "UPDATE FOO SET [PAR_CHR] = ? WHERE [PAR_ID] = ?"; $result = odbc_prepare($link, $sql); if (!$result) { - print ('[sql] prep: '.$sql); - goto out; + print ('[sql] prep: '.$sql); + goto out; } foreach ($upd_params as &$k) { - if(!odbc_execute($result, array($k['name'], $k['id']))) { - print ('[sql] exec: '."array({$k['name']}, {$k['id']})"); - goto out; - } + if(!odbc_execute($result, array($k['name'], $k['id']))) { + print ('[sql] exec: '."array({$k['name']}, {$k['id']})"); + goto out; + } } odbc_free_result($result); $sql = "SELECT * FROM FOO WHERE [PAR_ID] = ?"; $result = odbc_prepare($link, $sql); if (!$result) { - print ('[sql] prep: '.$sql); - goto out; + print ('[sql] prep: '.$sql); + goto out; } foreach ($upd_params as $k) { - if(!odbc_execute($result, array($k['id']))) { - print ('[sql] exec: '."array({$k['id']})"); - goto out; - } - while (($r = odbc_fetch_array($result)) !== false) { - var_dump($r); - } + if(!odbc_execute($result, array($k['id']))) { + print ('[sql] exec: '."array({$k['id']})"); + goto out; + } + while (($r = odbc_fetch_array($result)) !== false) { + var_dump($r); + } } out: diff --git a/ext/odbc/tests/bug60616.phpt b/ext/odbc/tests/bug60616.phpt index 16536881af..9d98d46b08 100644 --- a/ext/odbc/tests/bug60616.phpt +++ b/ext/odbc/tests/bug60616.phpt @@ -31,31 +31,31 @@ odbc_exec($conn, "INSERT INTO FOO(ID, CHAR_COL, VARCHAR_COL, TEXT_COL) VALUES (2 $res = odbc_exec($conn, 'SELECT * FROM FOO ORDER BY ID ASC'); while(odbc_fetch_row($res)) { - $char_col = odbc_result($res, "CHAR_COL"); - $varchar_col = odbc_result($res, "VARCHAR_COL"); - $id = odbc_result($res, "ID"); - $text_col = ""; - while (($chunk=odbc_result($res, "TEXT_COL")) !== false) { - $text_col .= $chunk; - } + $char_col = odbc_result($res, "CHAR_COL"); + $varchar_col = odbc_result($res, "VARCHAR_COL"); + $id = odbc_result($res, "ID"); + $text_col = ""; + while (($chunk=odbc_result($res, "TEXT_COL")) !== false) { + $text_col .= $chunk; + } - if ($id == 1) { - $euc_jp_check = $euc_jp . str_repeat(" ", (200 - mb_strlen($euc_jp))); - if (strcmp($char_col, $euc_jp_check) == 0 && strcmp($varchar_col, $euc_jp) == 0 && - strcmp($text_col, $euc_jp) == 0) { - print "EUC-JP matched\n"; - } else { - print "EUC-JP mismatched\n"; - } - } else { - $ascii_check = $ascii . str_repeat(" ", (200 - strlen($ascii))); - if (strcmp($char_col, $ascii_check) == 0 && strcmp($varchar_col, $ascii) == 0 && - strcmp($text_col, $ascii) == 0) { - print "ASCII matched\n"; - } else { - print "ASCII mismatched\n"; - } - } + if ($id == 1) { + $euc_jp_check = $euc_jp . str_repeat(" ", (200 - mb_strlen($euc_jp))); + if (strcmp($char_col, $euc_jp_check) == 0 && strcmp($varchar_col, $euc_jp) == 0 && + strcmp($text_col, $euc_jp) == 0) { + print "EUC-JP matched\n"; + } else { + print "EUC-JP mismatched\n"; + } + } else { + $ascii_check = $ascii . str_repeat(" ", (200 - strlen($ascii))); + if (strcmp($char_col, $ascii_check) == 0 && strcmp($varchar_col, $ascii) == 0 && + strcmp($text_col, $ascii) == 0) { + print "ASCII matched\n"; + } else { + print "ASCII mismatched\n"; + } + } } ?> diff --git a/ext/odbc/tests/bug68087.phpt b/ext/odbc/tests/bug68087.phpt index 3bc18125a6..64b232d9bc 100644 --- a/ext/odbc/tests/bug68087.phpt +++ b/ext/odbc/tests/bug68087.phpt @@ -22,23 +22,23 @@ odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL, DATE_COL) VALUES (2, 'helloag $res = odbc_exec($conn, 'SELECT * FROM FOO ORDER BY ID ASC'); while(odbc_fetch_row($res)) { - $id = odbc_result($res, "ID"); - $varchar_col = odbc_result($res, "VARCHAR_COL"); - $date = odbc_result($res, "DATE_COL"); - - if ($id == 1) { - if ($date != $id_1_date) { - print "Date_1 mismatched\n"; - } else { - print "Date_1 matched\n"; - } - } else { - if ($date != $id_2_date) { - print "Date_2 mismatched\n"; - } else { - print "Date_2 matched\n"; - } - } + $id = odbc_result($res, "ID"); + $varchar_col = odbc_result($res, "VARCHAR_COL"); + $date = odbc_result($res, "DATE_COL"); + + if ($id == 1) { + if ($date != $id_1_date) { + print "Date_1 mismatched\n"; + } else { + print "Date_1 matched\n"; + } + } else { + if ($date != $id_2_date) { + print "Date_2 mismatched\n"; + } else { + print "Date_2 matched\n"; + } + } } ?> diff --git a/ext/odbc/tests/bug69354.phpt b/ext/odbc/tests/bug69354.phpt index ea27af41d4..cf4e9114ad 100644 --- a/ext/odbc/tests/bug69354.phpt +++ b/ext/odbc/tests/bug69354.phpt @@ -17,12 +17,12 @@ odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL) VALUES (1, '" . str_repeat("a $res = odbc_exec($conn,"select VARCHAR_COL from FOO"); if ($res) { - if (odbc_fetch_row($res)) { - $ret = odbc_result($res,'varchar_col'); - echo strlen($ret), "\n"; - echo $ret[0], "\n"; - echo $ret[strlen($ret)-1], "\n"; - } + if (odbc_fetch_row($res)) { + $ret = odbc_result($res,'varchar_col'); + echo strlen($ret), "\n"; + echo $ret[0], "\n"; + echo $ret[strlen($ret)-1], "\n"; + } } ?> --EXPECT-- diff --git a/ext/odbc/tests/bug71171.phpt b/ext/odbc/tests/bug71171.phpt index b18d86218c..f7a856d14c 100644 --- a/ext/odbc/tests/bug71171.phpt +++ b/ext/odbc/tests/bug71171.phpt @@ -17,7 +17,7 @@ odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL) VALUES (1, '" . chr(0x81) . " $res = odbc_exec($conn,"SELECT ID FROM FOO WHERE VARCHAR_COL = '" . chr(0x81) . "'"); if ($res) { - while($record = odbc_fetch_array($res)) var_dump($record); + while($record = odbc_fetch_array($res)) var_dump($record); } odbc_close($conn); diff --git a/ext/odbc/tests/bug73448.phpt b/ext/odbc/tests/bug73448.phpt index e0a3629700..ea6c585c0f 100644 --- a/ext/odbc/tests/bug73448.phpt +++ b/ext/odbc/tests/bug73448.phpt @@ -10,28 +10,28 @@ include 'config.inc'; $conn = odbc_connect($dsn, $user, $pass); $sqlCommandList = array( - "/* empty batch is without error */", - "/* non existent procedure xy */ execute xy", - "/* empty batch,error message is not empty */", - "/* valid select with result */ select * from sys.sysobjects", - "/* another erroneous query */ SELECT * FROM zwiebelfleisch", - "/* valid select with result */ select * from sys.sysobjects", + "/* empty batch is without error */", + "/* non existent procedure xy */ execute xy", + "/* empty batch,error message is not empty */", + "/* valid select with result */ select * from sys.sysobjects", + "/* another erroneous query */ SELECT * FROM zwiebelfleisch", + "/* valid select with result */ select * from sys.sysobjects", ); foreach ($sqlCommandList as $exampleNumber => $sql) { - $r = @odbc_exec($conn, $sql); + $r = @odbc_exec($conn, $sql); - if (false === $r) { - $e = odbc_errormsg($conn); - $n = odbc_error($conn); + if (false === $r) { + $e = odbc_errormsg($conn); + $n = odbc_error($conn); - var_dump($sql, $n, $e); - echo "\n"; - } + var_dump($sql, $n, $e); + echo "\n"; + } - if ($r) { - odbc_free_result($r); - } + if ($r) { + odbc_free_result($r); + } } diff --git a/ext/odbc/tests/config.inc b/ext/odbc/tests/config.inc index d9da63d0b7..78be4b2d99 100644 --- a/ext/odbc/tests/config.inc +++ b/ext/odbc/tests/config.inc @@ -8,11 +8,11 @@ $user = getenv("ODBC_TEST_USER"); $pass = getenv("ODBC_TEST_PASS"); if (false === $dsn) { - $dsn = 'myodbc3'; + $dsn = 'myodbc3'; } if (false === $user) { - $user = 'root'; + $user = 'root'; } if (false == $pass) { - $pass = ''; + $pass = ''; } diff --git a/ext/odbc/tests/skipif.inc b/ext/odbc/tests/skipif.inc index 4cd13d0be6..a2c9a4aade 100644 --- a/ext/odbc/tests/skipif.inc +++ b/ext/odbc/tests/skipif.inc @@ -6,5 +6,5 @@ include 'config.inc'; $conn = @odbc_connect($dsn, $user, $pass); if (!$conn) { - die('skip could not connect'); + die('skip could not connect'); } diff --git a/ext/opcache/tests/blacklist.inc b/ext/opcache/tests/blacklist.inc index a9db751419..65adb91ced 100644 --- a/ext/opcache/tests/blacklist.inc +++ b/ext/opcache/tests/blacklist.inc @@ -1,3 +1,3 @@ <?php - echo "ok\n"; + echo "ok\n"; ?> diff --git a/ext/opcache/tests/bug64353.phpt b/ext/opcache/tests/bug64353.phpt index 42cb45c915..bfb332e26e 100644 --- a/ext/opcache/tests/bug64353.phpt +++ b/ext/opcache/tests/bug64353.phpt @@ -9,16 +9,16 @@ opcache.enable_cli=1 --FILE-- <?php class BugLoader extends php_user_filter { - public function filter($in, $out, &$consumed, $closing) { - if (!class_exists("Test")) { - eval("class Test extends ArrayObject {}"); - } - while ($bucket = stream_bucket_make_writeable($in)) { - $consumed += $bucket->datalen; - stream_bucket_append($out, $bucket); - } - return PSFS_PASS_ON; - } + public function filter($in, $out, &$consumed, $closing) { + if (!class_exists("Test")) { + eval("class Test extends ArrayObject {}"); + } + while ($bucket = stream_bucket_make_writeable($in)) { + $consumed += $bucket->datalen; + stream_bucket_append($out, $bucket); + } + return PSFS_PASS_ON; + } } stream_filter_register('bug.test', 'BugLoader'); diff --git a/ext/opcache/tests/bug65665.phpt b/ext/opcache/tests/bug65665.phpt index ac5c18dd83..bcdd0e6da1 100644 --- a/ext/opcache/tests/bug65665.phpt +++ b/ext/opcache/tests/bug65665.phpt @@ -8,108 +8,108 @@ opcache.enable_cli=1 --FILE-- <?php function foo() { - try - { - switch (1) - { - case 0: - try - { + try + { + switch (1) + { + case 0: + try + { - } - catch (Exception $e) - { + } + catch (Exception $e) + { - } + } - break; + break; - case 1: - try - { - throw new Exception('aaa'); - } - catch (Exception $e) - { - echo "correct\n"; - } + case 1: + try + { + throw new Exception('aaa'); + } + catch (Exception $e) + { + echo "correct\n"; + } - break; - } - } - catch (Exception $e) - { - echo "wrong\n"; - } - return; + break; + } + } + catch (Exception $e) + { + echo "wrong\n"; + } + return; } function foo1() { - try - { - switch (1) - { - case 0: - try - { + try + { + switch (1) + { + case 0: + try + { - } - catch (Exception $e) - { + } + catch (Exception $e) + { dummy: - echo "ect\n"; - } + echo "ect\n"; + } - break; + break; - case 1: - try - { - throw new Exception('aaa'); - } - catch (Exception $e) - { - echo "corr"; - goto dummy; - } - break; - } - } - catch (Exception $e) - { - echo "wrong\n"; - } - return; + case 1: + try + { + throw new Exception('aaa'); + } + catch (Exception $e) + { + echo "corr"; + goto dummy; + } + break; + } + } + catch (Exception $e) + { + echo "wrong\n"; + } + return; } function foo2() { - try - { - switch (1) - { - case 0: - try - { + try + { + switch (1) + { + case 0: + try + { dummy: - throw new Exception('aaa'); - } - catch (Exception $e) - { - echo "correct\n"; - } + throw new Exception('aaa'); + } + catch (Exception $e) + { + echo "correct\n"; + } - break; + break; - case 1: - goto dummy; - break; - } - } - catch (Exception $e) - { - echo "wrong\n"; - } - return; + case 1: + goto dummy; + break; + } + } + catch (Exception $e) + { + echo "wrong\n"; + } + return; } foo();foo1();foo2(); --EXPECT-- diff --git a/ext/opcache/tests/bug66176.phpt b/ext/opcache/tests/bug66176.phpt index a91024a616..a7c53c1690 100644 --- a/ext/opcache/tests/bug66176.phpt +++ b/ext/opcache/tests/bug66176.phpt @@ -10,8 +10,8 @@ opcache.file_update_protection=0 --FILE-- <?php function foo($v) { - global $a; - return $a[$v]; + global $a; + return $a[$v]; } $a = array(PHP_VERSION => 1); var_dump(foo(PHP_VERSION)); diff --git a/ext/opcache/tests/bug66334.phpt b/ext/opcache/tests/bug66334.phpt index b2c6d7b92c..33e3847e34 100644 --- a/ext/opcache/tests/bug66334.phpt +++ b/ext/opcache/tests/bug66334.phpt @@ -11,9 +11,9 @@ enable_dl=0 --FILE-- <?php if (extension_loaded("unknown_extension")) { - var_dump(1); + var_dump(1); } else { - var_dump(2); + var_dump(2); } --EXPECT-- int(2) diff --git a/ext/opcache/tests/bug66338.phpt b/ext/opcache/tests/bug66338.phpt index 40f5634465..1473481561 100644 --- a/ext/opcache/tests/bug66338.phpt +++ b/ext/opcache/tests/bug66338.phpt @@ -12,20 +12,20 @@ $root = str_replace('.php', "", __FILE__); $base = basename( $root ); file_put_contents( "$root-Officials.inc", '<?php - class Officials { static function getLeader() { return LocalTerms::GOV_LEADER; } } - ' ); + class Officials { static function getLeader() { return LocalTerms::GOV_LEADER; } } + ' ); file_put_contents( "$root-clientUS.php", '<?php - class LocalTerms { const GOV_LEADER = "Barack Hussein Obama II"; } - require \''.$root.'-Officials.inc\'; - printf( "The President of the USA is %s\n", Officials::getLeader() ); - ' ); + class LocalTerms { const GOV_LEADER = "Barack Hussein Obama II"; } + require \''.$root.'-Officials.inc\'; + printf( "The President of the USA is %s\n", Officials::getLeader() ); + ' ); file_put_contents( "$root-clientUK.php", '<?php - class LocalTerms { const GOV_LEADER = "David William Donald Cameron"; } - require \''.$root.'-Officials.inc\'; - printf( "The Prime Minister of the UK is %s\n", Officials::getLeader() ); - ' ); + class LocalTerms { const GOV_LEADER = "David William Donald Cameron"; } + require \''.$root.'-Officials.inc\'; + printf( "The Prime Minister of the UK is %s\n", Officials::getLeader() ); + ' ); include "php_cli_server.inc"; $uri = sprintf("http://%s/%s", PHP_CLI_SERVER_ADDRESS, basename(__FILE__)); diff --git a/ext/opcache/tests/bug66440.phpt b/ext/opcache/tests/bug66440.phpt index b546e32b3c..539b0ce7aa 100644 --- a/ext/opcache/tests/bug66440.phpt +++ b/ext/opcache/tests/bug66440.phpt @@ -10,7 +10,7 @@ opcache.file_update_protection=0 --FILE-- <?php if(constant('PHP_BINARY')) { - echo "OK\n"; + echo "OK\n"; } --EXPECT-- OK diff --git a/ext/opcache/tests/bug66474.phpt b/ext/opcache/tests/bug66474.phpt index 3bd038c0de..10d54a7fa5 100644 --- a/ext/opcache/tests/bug66474.phpt +++ b/ext/opcache/tests/bug66474.phpt @@ -10,7 +10,7 @@ opcache.file_update_protection=0 --FILE-- <?php function foo() { - $speed = 'slow' || 'fast'; + $speed = 'slow' || 'fast'; } foo(); echo "ok\n"; diff --git a/ext/opcache/tests/bug69038.phpt b/ext/opcache/tests/bug69038.phpt index 1670a9eca6..09b9af4077 100644 --- a/ext/opcache/tests/bug69038.phpt +++ b/ext/opcache/tests/bug69038.phpt @@ -10,50 +10,50 @@ opcache.optimization_level=-1 <?php function a($a = "bad") { - switch (PHP_OS) { - case "LALALALA" : return "LALALAL"; - case PHP_OS: return "okey"; - default: break; - } + switch (PHP_OS) { + case "LALALALA" : return "LALALAL"; + case PHP_OS: return "okey"; + default: break; + } - return $a; + return $a; } var_dump(a()); function b($b = "bad") { - switch (PHP_OS) { - case "LALALAL": return "bad"; - case PHP_OS: - switch (PHP_OS) { - case "FOO": break; - case PHP_OS: return "okey"; - default : - break; - } - break; - default: - break; - } - return $b; + switch (PHP_OS) { + case "LALALAL": return "bad"; + case PHP_OS: + switch (PHP_OS) { + case "FOO": break; + case PHP_OS: return "okey"; + default : + break; + } + break; + default: + break; + } + return $b; } var_dump(b()); function c($b = "bad") { - switch (extension_loaded("standard")) { - case 0 : return "LALALAL"; - case 1 : return "okey"; - default : return "bad"; - } + switch (extension_loaded("standard")) { + case 0 : return "LALALAL"; + case 1 : return "okey"; + default : return "bad"; + } } var_dump(c()); function d() { - switch (PHP_OS) { - default: return "bad"; - case PHP_OS: return "okey"; - } + switch (PHP_OS) { + default: return "bad"; + case PHP_OS: return "okey"; + } } var_dump(d()); diff --git a/ext/opcache/tests/bug69159.phpt b/ext/opcache/tests/bug69159.phpt index d8b953a1aa..158f242b3f 100644 --- a/ext/opcache/tests/bug69159.phpt +++ b/ext/opcache/tests/bug69159.phpt @@ -12,7 +12,7 @@ $x1 = "okey"; myFunction(${"x$i"}); function myFunction($x) { - var_dump($x); + var_dump($x); } ?> diff --git a/ext/opcache/tests/bug70207.phpt b/ext/opcache/tests/bug70207.phpt index 2b6e48a2d4..a73b7a6916 100644 --- a/ext/opcache/tests/bug70207.phpt +++ b/ext/opcache/tests/bug70207.phpt @@ -10,7 +10,7 @@ opcache.file_update_protection=0 --FILE-- <?php function bar() { - return "bar"; + return "bar"; } function foo() { try { return bar(); } diff --git a/ext/opcache/tests/bug73402.phpt b/ext/opcache/tests/bug73402.phpt index f325b798e5..d245d58969 100644 --- a/ext/opcache/tests/bug73402.phpt +++ b/ext/opcache/tests/bug73402.phpt @@ -8,19 +8,19 @@ opcache.enable_cli=1 --FILE-- <?php class Logger { - public function info($msg) { - echo $msg; - } + public function info($msg) { + echo $msg; + } } class B { - const LOG_LEVEL = 'Info'; - public function test() - { - $logger = new \Logger(); - $logger->{self::LOG_LEVEL}('test'); - } + const LOG_LEVEL = 'Info'; + public function test() + { + $logger = new \Logger(); + $logger->{self::LOG_LEVEL}('test'); + } } $b = new B; diff --git a/ext/opcache/tests/bug73583.phpt b/ext/opcache/tests/bug73583.phpt index e947b451c9..f533e9caf5 100644 --- a/ext/opcache/tests/bug73583.phpt +++ b/ext/opcache/tests/bug73583.phpt @@ -10,9 +10,9 @@ opcache.file_update_protection=0 --FILE-- <?php if (true) { - class A { } - function A() { } - function A() { } + class A { } + function A() { } + function A() { } } ?> --EXPECTF-- diff --git a/ext/opcache/tests/bug73746.phpt b/ext/opcache/tests/bug73746.phpt index 4f115575cf..c95aed8076 100644 --- a/ext/opcache/tests/bug73746.phpt +++ b/ext/opcache/tests/bug73746.phpt @@ -8,19 +8,19 @@ namespace Core\Bundle\Service\Property\Room\Rooms; class CountryMapping { - const CZ = 'CZ'; - const EN = 'EN'; + const CZ = 'CZ'; + const EN = 'EN'; - public function get(string $countryIsoCode = null) : string // Works correctly if return type is removed - { - switch (strtoupper($countryIsoCode)) { - case 'CZ': - case 'SK': - return self::CZ; // Works correctly if changed to CountryMapping::CZ - default: - return self::EN; // Works correctly if changed to CountryMapping::EN - } - } + public function get(string $countryIsoCode = null) : string // Works correctly if return type is removed + { + switch (strtoupper($countryIsoCode)) { + case 'CZ': + case 'SK': + return self::CZ; // Works correctly if changed to CountryMapping::CZ + default: + return self::EN; // Works correctly if changed to CountryMapping::EN + } + } } $mapping = new CountryMapping(); diff --git a/ext/opcache/tests/bug73789.phpt b/ext/opcache/tests/bug73789.phpt index d5efeb403d..5d5cb92f20 100644 --- a/ext/opcache/tests/bug73789.phpt +++ b/ext/opcache/tests/bug73789.phpt @@ -7,26 +7,26 @@ Bug #73789 (Strange behavior of class constants in switch/case block) <?php class Lexer { - const T_NONE = 1; - const T_STRING = 2; - const T_DOT = 8; - public function getType($value): int - { - $type = self::T_NONE; - switch (true) { - case ctype_alpha($value[0]): - $name = 'Lexer::T_' . strtoupper($value); - $type = constant($name); - if ($type > 100) { - return $type; - } - return self::T_STRING; - case $value === '.': - return self::T_DOT; - default: - } - return $type; - } + const T_NONE = 1; + const T_STRING = 2; + const T_DOT = 8; + public function getType($value): int + { + $type = self::T_NONE; + switch (true) { + case ctype_alpha($value[0]): + $name = 'Lexer::T_' . strtoupper($value); + $type = constant($name); + if ($type > 100) { + return $type; + } + return self::T_STRING; + case $value === '.': + return self::T_DOT; + default: + } + return $type; + } } var_dump((new Lexer())->getType("dot")); ?> diff --git a/ext/opcache/tests/bug74019.phpt b/ext/opcache/tests/bug74019.phpt index 210e223c82..0392963a8b 100644 --- a/ext/opcache/tests/bug74019.phpt +++ b/ext/opcache/tests/bug74019.phpt @@ -9,12 +9,12 @@ opcache.enable_cli=1 <?php class A { - public function seg() { - list($a, $b) = A::CONSTS; - var_dump($a, $b); - return; - } - const CONSTS = [1, 2]; + public function seg() { + list($a, $b) = A::CONSTS; + var_dump($a, $b); + return; + } + const CONSTS = [1, 2]; } $a = new A; diff --git a/ext/opcache/tests/bug74152.phpt b/ext/opcache/tests/bug74152.phpt index f51c26b621..b991365927 100644 --- a/ext/opcache/tests/bug74152.phpt +++ b/ext/opcache/tests/bug74152.phpt @@ -16,11 +16,11 @@ $bar = null; switch ($foo) { default: case 'foo': - if ($bar) { - echo 'true'; - } else { - echo 'false'; - } + if ($bar) { + echo 'true'; + } else { + echo 'false'; + } } ?> --EXPECT-- diff --git a/ext/opcache/tests/bug74456.phpt b/ext/opcache/tests/bug74456.phpt index 9c9a286e2f..10f9b04058 100644 --- a/ext/opcache/tests/bug74456.phpt +++ b/ext/opcache/tests/bug74456.phpt @@ -11,7 +11,7 @@ opcache.optimization_level=-1 function small_numbers() { - return [0,1,2]; + return [0,1,2]; } list ($zero, $one, $two) = small_numbers(); diff --git a/ext/opcache/tests/bug74596.phpt b/ext/opcache/tests/bug74596.phpt index ed1c1b4504..8a1dc17189 100644 --- a/ext/opcache/tests/bug74596.phpt +++ b/ext/opcache/tests/bug74596.phpt @@ -15,14 +15,14 @@ opcache.revalidate_path=1 file_put_contents(__DIR__ . "/bug74596_1.php", <<<CODE <?php class A { - public function __construct() { - \$a = true; - if (\$a) { - echo 1 + 2; - } else { - echo 2 + 3; - } - } + public function __construct() { + \$a = true; + if (\$a) { + echo 1 + 2; + } else { + echo 2 + 3; + } + } } ?> CODE @@ -32,14 +32,14 @@ file_put_contents(__DIR__ . "/bug74596_2.php", "ok\n"); class ufilter extends php_user_filter { - function filter($in, $out, &$consumed, $closing) - { - include_once __DIR__ . "/bug74596_1.php"; - while ($bucket = stream_bucket_make_writeable($in)) { - stream_bucket_append($out, $bucket); - } - return PSFS_PASS_ON; - } + function filter($in, $out, &$consumed, $closing) + { + include_once __DIR__ . "/bug74596_1.php"; + while ($bucket = stream_bucket_make_writeable($in)) { + stream_bucket_append($out, $bucket); + } + return PSFS_PASS_ON; + } } stream_filter_register("ufilter", "ufilter"); diff --git a/ext/opcache/tests/bug74980.phpt b/ext/opcache/tests/bug74980.phpt index e82e234bdd..df77206d7b 100644 --- a/ext/opcache/tests/bug74980.phpt +++ b/ext/opcache/tests/bug74980.phpt @@ -11,16 +11,16 @@ opcache.enable_cli=1 class A { - static function foo() - { - while ($undef) { - $arr[][] = NULL; - } + static function foo() + { + while ($undef) { + $arr[][] = NULL; + } - foreach ($arr as $a) { - bar($a + []); - } - } + foreach ($arr as $a) { + bar($a + []); + } + } } diff --git a/ext/opcache/tests/bug75230.phpt b/ext/opcache/tests/bug75230.phpt index 13100b3679..ce67bb06b9 100644 --- a/ext/opcache/tests/bug75230.phpt +++ b/ext/opcache/tests/bug75230.phpt @@ -9,8 +9,8 @@ opcache.optimization_level=-1 --FILE-- <?php function f() { - $retval = false; - if ($retval) { } + $retval = false; + if ($retval) { } } f(); exit("OK"); diff --git a/ext/opcache/tests/bug75357.phpt b/ext/opcache/tests/bug75357.phpt index 359f6160c2..99537ed097 100644 --- a/ext/opcache/tests/bug75357.phpt +++ b/ext/opcache/tests/bug75357.phpt @@ -10,23 +10,23 @@ opcache.optimization_level=-1 <?php function wp_slash( $value ) { - if ( is_array( $value ) ) { - foreach ( $value as $k => $v ) { - if ( is_array( $v ) ) { - $value[$k] = wp_slash( $v ); - } else { - $value[$k] = addslashes( $v ); - } - } - } else { - $value = addslashes( $value ); - } + if ( is_array( $value ) ) { + foreach ( $value as $k => $v ) { + if ( is_array( $v ) ) { + $value[$k] = wp_slash( $v ); + } else { + $value[$k] = addslashes( $v ); + } + } + } else { + $value = addslashes( $value ); + } - return $value; + return $value; } function addslashes_gpc($gpc) { - return wp_slash($gpc); + return wp_slash($gpc); } var_dump(addslashes_gpc(array(array("test")))); diff --git a/ext/opcache/tests/bug75370.phpt b/ext/opcache/tests/bug75370.phpt index d576f592d4..5cc344e3f6 100644 --- a/ext/opcache/tests/bug75370.phpt +++ b/ext/opcache/tests/bug75370.phpt @@ -10,9 +10,9 @@ opcache.optimization_level=-1 <?php function test() { - $success = true; - $success = $success AND true; - return $success; + $success = true; + $success = $success AND true; + return $success; } var_dump(test()); diff --git a/ext/opcache/tests/bug75556.phpt b/ext/opcache/tests/bug75556.phpt index 1b2511c580..c1faa5e15a 100644 --- a/ext/opcache/tests/bug75556.phpt +++ b/ext/opcache/tests/bug75556.phpt @@ -10,14 +10,14 @@ opcache.optimization_level=-1 <?php function createFromFormat($format, $date, ?\DateTimeZone $tz = null): ?\DateTimeInterface { - if ($tz !== null - || ($tz instanceof \DateTimeZone && !in_array($tz->getName(), ['UTC', 'Z'], true)) - ) { - $msg = 'Date objects must have UTC as their timezone'; - throw new \UnexpectedValueException($msg); - } + if ($tz !== null + || ($tz instanceof \DateTimeZone && !in_array($tz->getName(), ['UTC', 'Z'], true)) + ) { + $msg = 'Date objects must have UTC as their timezone'; + throw new \UnexpectedValueException($msg); + } - return null; + return null; } var_dump(createFromFormat('m/d/Y', '12/07/2017', null)); diff --git a/ext/opcache/tests/bug75687.phpt b/ext/opcache/tests/bug75687.phpt index 67cf8288a9..1d9c55f96c 100644 --- a/ext/opcache/tests/bug75687.phpt +++ b/ext/opcache/tests/bug75687.phpt @@ -11,9 +11,9 @@ opcache.optimization_level=-1 function x($y) { - if (is_array($y)) { - $z = is_array($y) ? array() : array($y); - } + if (is_array($y)) { + $z = is_array($y) ? array() : array($y); + } } ?> okey diff --git a/ext/opcache/tests/bug75938.phpt b/ext/opcache/tests/bug75938.phpt index cfe6a65503..7fba940e97 100644 --- a/ext/opcache/tests/bug75938.phpt +++ b/ext/opcache/tests/bug75938.phpt @@ -5,11 +5,11 @@ Bug #75938: Modulus value not stored in variable --FILE-- <?php function borken($columns) { - $columns = (int) $columns; - if ($columns < 1) return 0; - $count = count([1,2,3,4,5]); - var_dump($mod = ($count % $columns)); - var_dump($mod); + $columns = (int) $columns; + if ($columns < 1) return 0; + $count = count([1,2,3,4,5]); + var_dump($mod = ($count % $columns)); + var_dump($mod); } borken(2); ?> diff --git a/ext/opcache/tests/bug76074.phpt b/ext/opcache/tests/bug76074.phpt index d12ebb26fa..94c79beff6 100644 --- a/ext/opcache/tests/bug76074.phpt +++ b/ext/opcache/tests/bug76074.phpt @@ -6,8 +6,8 @@ Bug #76074 (opcache corrupts variable in for-loop) <?php function test(int $nr) { - for ($i = $nr; $i <= $nr + 1; $i++) - var_dump($i); + for ($i = $nr; $i <= $nr + 1; $i++) + var_dump($i); } test(1); diff --git a/ext/opcache/tests/bug76094.phpt b/ext/opcache/tests/bug76094.phpt index 4f5e037ead..35f8d321de 100644 --- a/ext/opcache/tests/bug76094.phpt +++ b/ext/opcache/tests/bug76094.phpt @@ -11,13 +11,13 @@ opcache.optimization_level=-1 function MetaType($t) { - switch (strtoupper($t)) { - case PHP_INT_MAX : - return 1; - case 0: - default: - return 0; - } + switch (strtoupper($t)) { + case PHP_INT_MAX : + return 1; + case 0: + default: + return 0; + } } var_dump(MetaType("aa")); diff --git a/ext/opcache/tests/bug76446.phpt b/ext/opcache/tests/bug76446.phpt index 98b1d3dc56..a2b02de032 100644 --- a/ext/opcache/tests/bug76446.phpt +++ b/ext/opcache/tests/bug76446.phpt @@ -10,9 +10,9 @@ opcache.optimization_level=-1 <?php function test() { - $openmenu = ''; - $openstr2 = "&openmenu={$openmenu}{$addlang}\""; - return 0; + $openmenu = ''; + $openstr2 = "&openmenu={$openmenu}{$addlang}\""; + return 0; } var_dump(test()); diff --git a/ext/opcache/tests/bug76463.phpt b/ext/opcache/tests/bug76463.phpt index 0fa9be990c..e3dacb691c 100644 --- a/ext/opcache/tests/bug76463.phpt +++ b/ext/opcache/tests/bug76463.phpt @@ -10,7 +10,7 @@ opcache.optimization_level=-1 <?php function test() { - $old_data = isset($old_data) ? (array)$old_data : []; + $old_data = isset($old_data) ? (array)$old_data : []; } ?> diff --git a/ext/opcache/tests/bug76477.phpt b/ext/opcache/tests/bug76477.phpt index 39bff0d46c..7978ce4d7b 100644 --- a/ext/opcache/tests/bug76477.phpt +++ b/ext/opcache/tests/bug76477.phpt @@ -11,9 +11,9 @@ opcache.optimization_level=-1 testString(); function testString() { - $token = "ABC"; - $lengthBytes = strlenb($token); - var_dump($lengthBytes == 0); + $token = "ABC"; + $lengthBytes = strlenb($token); + var_dump($lengthBytes == 0); } function strlenb() { return call_user_func_array("strlen", func_get_args()); } diff --git a/ext/opcache/tests/bug77058.phpt b/ext/opcache/tests/bug77058.phpt index 22a36d1e3d..18d510bbde 100644 --- a/ext/opcache/tests/bug77058.phpt +++ b/ext/opcache/tests/bug77058.phpt @@ -3,7 +3,7 @@ Bug #77058: Type inference in opcache causes side effects --SKIPIF-- <?php require_once('skipif.inc'); ?> --FILE-- -<?php +<?php function myfunc(){ $Nr = 0; diff --git a/ext/opcache/tests/bug77191.phpt b/ext/opcache/tests/bug77191.phpt index ca04b4aadd..ffbc90700c 100644 --- a/ext/opcache/tests/bug77191.phpt +++ b/ext/opcache/tests/bug77191.phpt @@ -3,13 +3,13 @@ Bug #77191: Assertion failure in dce_live_ranges() when silencing is used --FILE-- <?php function test($x) { - switch (@$x['y']) { - case 1: return 'a'; - case 2: return 'b'; - case 3: return 'c'; - case 4: return 'd'; - } - return 'e'; + switch (@$x['y']) { + case 1: return 'a'; + case 2: return 'b'; + case 3: return 'c'; + case 4: return 'd'; + } + return 'e'; } var_dump(test([])); ?> diff --git a/ext/opcache/tests/bug77266.phpt b/ext/opcache/tests/bug77266.phpt index 8e225b8480..08fc74f96d 100644 --- a/ext/opcache/tests/bug77266.phpt +++ b/ext/opcache/tests/bug77266.phpt @@ -10,21 +10,21 @@ opcache.optimization_level=-1 <?php final class Lock { - private static function clearOrphanedLocks() - { - $lockList = []; + private static function clearOrphanedLocks() + { + $lockList = []; - $serverMonitors = array(); - $listCount = count($lockList); - if ( is_array($lockList) && $listCount > 0 ) { - $v = explode(':', $value); - if (!$serverMonitors[$v[0]]['m']) { - $serverMonitors[$v[0]]['m'] = new ServerMonitor($v[0]); - } + $serverMonitors = array(); + $listCount = count($lockList); + if ( is_array($lockList) && $listCount > 0 ) { + $v = explode(':', $value); + if (!$serverMonitors[$v[0]]['m']) { + $serverMonitors[$v[0]]['m'] = new ServerMonitor($v[0]); + } - } + } - } + } } ?> diff --git a/ext/opcache/tests/bug77743.phpt b/ext/opcache/tests/bug77743.phpt index b73da2baaf..f9075a3a7f 100644 --- a/ext/opcache/tests/bug77743.phpt +++ b/ext/opcache/tests/bug77743.phpt @@ -6,12 +6,12 @@ Bug #77743: Incorrect pi node insertion for jmpznz with identical successors <?php function buggy($a) { - $id_country = $a; - if ($id_country === false) { - if (true) { - } - } - var_dump($id_country); + $id_country = $a; + if ($id_country === false) { + if (true) { + } + } + var_dump($id_country); } buggy(42); diff --git a/ext/opcache/tests/bug78014.inc b/ext/opcache/tests/bug78014.inc index 51a1196476..aed61ab743 100644 --- a/ext/opcache/tests/bug78014.inc +++ b/ext/opcache/tests/bug78014.inc @@ -1,4 +1,4 @@ -<?php +<?php class A { function foo() { return 0; } } diff --git a/ext/opcache/tests/bug78185.phpt b/ext/opcache/tests/bug78185.phpt index 51a89f98d3..926bb96404 100644 --- a/ext/opcache/tests/bug78185.phpt +++ b/ext/opcache/tests/bug78185.phpt @@ -10,12 +10,12 @@ opcache.file_cache_only=1 --FILE-- <?php if (substr(PHP_OS, 0, 3) !== 'WIN') { - $pattern = __DIR__ . '/*/' . __DIR__ . '/*78185.php.bin'; + $pattern = __DIR__ . '/*/' . __DIR__ . '/*78185.php.bin'; } else { - $pattern = __DIR__ . '/*/*/' . str_replace(':', '', __DIR__) . '/*78185.php.bin'; + $pattern = __DIR__ . '/*/*/' . str_replace(':', '', __DIR__) . '/*78185.php.bin'; } foreach (glob($pattern) as $p) { - var_dump($p); + var_dump($p); } ?> --CLEAN-- diff --git a/ext/opcache/tests/bug78986.phpt b/ext/opcache/tests/bug78986.phpt index 9479460f76..420c828aa4 100644 --- a/ext/opcache/tests/bug78986.phpt +++ b/ext/opcache/tests/bug78986.phpt @@ -11,7 +11,7 @@ class TestClass2 { class TestClass extends TestClass2 { var $test = [ - TEST_TEST => 'test' + TEST_TEST => 'test' ]; } diff --git a/ext/opcache/tests/compact_literals.phpt b/ext/opcache/tests/compact_literals.phpt index 0aabb22b50..0963c27705 100644 --- a/ext/opcache/tests/compact_literals.phpt +++ b/ext/opcache/tests/compact_literals.phpt @@ -11,10 +11,10 @@ opcache.optimization_level=-1 echo "array key hash" . ":" . PHP_EOL; $array = array( - "1" => "one", - "2" => "two", - "one" => 1, - "two" => 2, + "1" => "one", + "2" => "two", + "one" => 1, + "two" => 2, ); unset($array["one"]); @@ -24,9 +24,9 @@ print_r($array); echo "function define" . ":" . PHP_EOL; if (!function_exists("dummy")) { - function dummy() { - var_dump(__FUNCTION__); - } + function dummy() { + var_dump(__FUNCTION__); + } } dummy(); @@ -35,22 +35,22 @@ $dummy = function () { var_dump("lambda" . "dummy"); }; $dummy(); if (!class_exists("A")) { - class A { - public static $name = "A"; - public static function say($n = "name") { - var_dump(static::$name); - } - } + class A { + public static $name = "A"; + public static function say($n = "name") { + var_dump(static::$name); + } + } } class B extends A { - public static $name = "B"; + public static $name = "B"; } if (!class_exists("C")) { - class C extends B { - public static $name = "C"; - } + class C extends B { + public static $name = "C"; + } } A::say(); @@ -60,7 +60,7 @@ B::say(); C::say(); function get_eol_define() { - define("MY_EOL", PHP_EOL); + define("MY_EOL", PHP_EOL); } get_eol_define(); define("EOL", MY_EOL); @@ -71,17 +71,17 @@ echo "define " . "TEST" . EOL; define("TEST", "TEST"); class E { - public static $E="EP"; - const E="E"; - const TEST="NULL"; + public static $E="EP"; + const E="E"; + const TEST="NULL"; } class F { - const F="F"; - public static $E="FEP"; - const E="FE"; - const TEST="FALSE"; - public static $F = "FP"; + const F="F"; + public static $E="FEP"; + const E="FE"; + const TEST="FALSE"; + public static $F = "FP"; } var_dump(TEST); //"TEST" @@ -97,25 +97,25 @@ var_dumP(F::$E); //"FEP" echo "propertes and methods" . EOL; class CH { - const H = "H"; - public function h() { - var_dump(self::H); - } + const H = "H"; + public function h() { + var_dump(self::H); + } } class CI { - const H = "I"; - public function h() { - var_dump(self::H); - } + const H = "I"; + public function h() { + var_dump(self::H); + } } function change(&$obj) { - $obj = new CH; + $obj = new CH; } function geti() { - return new CI; + return new CI; } $h = new CH; diff --git a/ext/opcache/tests/issue0183.phpt b/ext/opcache/tests/issue0183.phpt index 9e18f6d2e8..26da4d97cc 100644 --- a/ext/opcache/tests/issue0183.phpt +++ b/ext/opcache/tests/issue0183.phpt @@ -11,15 +11,15 @@ opcache.optimization_level=-1 <?php switch (PHP_OS) { - case "Windows": - break; - case "Darwin": - break; - case "Linux": - echo "okey"; - break; - default: - break; + case "Windows": + break; + case "Darwin": + break; + case "Linux": + echo "okey"; + break; + default: + break; } --EXPECT-- okey diff --git a/ext/opcache/tests/jit/assign_001.phpt b/ext/opcache/tests/jit/assign_001.phpt index b52824b900..959659cff1 100644 --- a/ext/opcache/tests/jit/assign_001.phpt +++ b/ext/opcache/tests/jit/assign_001.phpt @@ -11,12 +11,12 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = array(); - $b = $a; - $c = $a; - $a = 1; - $x = $a; - var_dump($x, $b, $c); + $a = array(); + $b = $a; + $c = $a; + $a = 1; + $x = $a; + var_dump($x, $b, $c); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_002.phpt b/ext/opcache/tests/jit/assign_002.phpt index 34ed996928..355fdd4472 100644 --- a/ext/opcache/tests/jit/assign_002.phpt +++ b/ext/opcache/tests/jit/assign_002.phpt @@ -11,14 +11,14 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $ref1 = 2.3; - $ref2 =& $ref1; - $a = array(); - $b = $a; - $c = $a; - $a = $ref1; - $x = $a; - var_dump($x, $b, $c); + $ref1 = 2.3; + $ref2 =& $ref1; + $a = array(); + $b = $a; + $c = $a; + $a = $ref1; + $x = $a; + var_dump($x, $b, $c); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_003.phpt b/ext/opcache/tests/jit/assign_003.phpt index f096d0b811..7e885d38aa 100644 --- a/ext/opcache/tests/jit/assign_003.phpt +++ b/ext/opcache/tests/jit/assign_003.phpt @@ -11,10 +11,10 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = array(); // [rc1, array] - $a = 1; // [rc1, long, reg] - $x = $a; - var_dump($x); + $a = array(); // [rc1, array] + $a = 1; // [rc1, long, reg] + $x = $a; + var_dump($x); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_004.phpt b/ext/opcache/tests/jit/assign_004.phpt index 23314fa55b..70c25bc888 100644 --- a/ext/opcache/tests/jit/assign_004.phpt +++ b/ext/opcache/tests/jit/assign_004.phpt @@ -11,13 +11,13 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = null; - $b = $a; - $c = null; - $d = $c; - $a = 1; - $c = $a; - return $c; + $a = null; + $b = $a; + $c = null; + $d = $c; + $a = 1; + $c = $a; + return $c; } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_005.phpt b/ext/opcache/tests/jit/assign_005.phpt index 6975cd41ed..d3f9dca61c 100644 --- a/ext/opcache/tests/jit/assign_005.phpt +++ b/ext/opcache/tests/jit/assign_005.phpt @@ -11,13 +11,13 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = array(); - $b = $a; - $c = array(); - $d = $c; - $a = 1; - $c = $a; - return $c; + $a = array(); + $b = $a; + $c = array(); + $d = $c; + $a = 1; + $c = $a; + return $c; } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_006.phpt b/ext/opcache/tests/jit/assign_006.phpt index 680c2f96f4..6efc98fe0f 100644 --- a/ext/opcache/tests/jit/assign_006.phpt +++ b/ext/opcache/tests/jit/assign_006.phpt @@ -11,11 +11,11 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = array(); - $c = array(); - $a = 1; - $c = $a; - return $c; + $a = array(); + $c = array(); + $a = 1; + $c = $a; + return $c; } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_007.phpt b/ext/opcache/tests/jit/assign_007.phpt index 2e6ab218f4..f54ede5ec5 100644 --- a/ext/opcache/tests/jit/assign_007.phpt +++ b/ext/opcache/tests/jit/assign_007.phpt @@ -11,10 +11,10 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = 1.0; - $c = 2.0; - $a = 1; - var_dump($a); + $a = 1.0; + $c = 2.0; + $a = 1; + var_dump($a); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_008.phpt b/ext/opcache/tests/jit/assign_008.phpt index b4fa5f15bb..22b6a465f5 100644 --- a/ext/opcache/tests/jit/assign_008.phpt +++ b/ext/opcache/tests/jit/assign_008.phpt @@ -11,10 +11,10 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = 1.0; - $c = 2.0; - $c = $a; - var_dump($a); + $a = 1.0; + $c = 2.0; + $c = $a; + var_dump($a); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_009.phpt b/ext/opcache/tests/jit/assign_009.phpt index 24ba9892f1..6772e9028f 100644 --- a/ext/opcache/tests/jit/assign_009.phpt +++ b/ext/opcache/tests/jit/assign_009.phpt @@ -11,9 +11,9 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = array(); - $b = $a; - $a = $b; + $a = array(); + $b = $a; + $a = $b; } foo(); echo "ok\n"; diff --git a/ext/opcache/tests/jit/assign_010.phpt b/ext/opcache/tests/jit/assign_010.phpt index f8e20b3fa0..77886de67a 100644 --- a/ext/opcache/tests/jit/assign_010.phpt +++ b/ext/opcache/tests/jit/assign_010.phpt @@ -11,9 +11,9 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = array(); - $b =& $a; - $a = $b; + $a = array(); + $b =& $a; + $a = $b; } foo(); echo "ok\n"; diff --git a/ext/opcache/tests/jit/assign_011.phpt b/ext/opcache/tests/jit/assign_011.phpt index 5de684aa25..dc9b5e756c 100644 --- a/ext/opcache/tests/jit/assign_011.phpt +++ b/ext/opcache/tests/jit/assign_011.phpt @@ -11,16 +11,16 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = 1; - $c = 2; - $d = 3; - if ($a) { - $b = array(); - } else { - $b =& $c; - } - $b = $d; - var_dump($b, $c); + $a = 1; + $c = 2; + $d = 3; + if ($a) { + $b = array(); + } else { + $b =& $c; + } + $b = $d; + var_dump($b, $c); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_012.phpt b/ext/opcache/tests/jit/assign_012.phpt index 192d770db0..82d42d9b46 100644 --- a/ext/opcache/tests/jit/assign_012.phpt +++ b/ext/opcache/tests/jit/assign_012.phpt @@ -11,16 +11,16 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = 0; - $c = 2; - $d = 3; - if ($a) { - $b = array(); - } else { - $b =& $c; - } - $b = $d; - var_dump($b, $c); + $a = 0; + $c = 2; + $d = 3; + if ($a) { + $b = array(); + } else { + $b =& $c; + } + $b = $d; + var_dump($b, $c); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_013.phpt b/ext/opcache/tests/jit/assign_013.phpt index 94bd11b6f4..a2da0b34d8 100644 --- a/ext/opcache/tests/jit/assign_013.phpt +++ b/ext/opcache/tests/jit/assign_013.phpt @@ -11,10 +11,10 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = array(); - $b = 2; - $c = $a = $b; - var_dump($c); + $a = array(); + $b = 2; + $c = $a = $b; + var_dump($c); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_014.phpt b/ext/opcache/tests/jit/assign_014.phpt index 9d14511163..0313753aff 100644 --- a/ext/opcache/tests/jit/assign_014.phpt +++ b/ext/opcache/tests/jit/assign_014.phpt @@ -11,10 +11,10 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = 1; - $b = array(); - $c = $a = $b; - var_dump($c); + $a = 1; + $b = array(); + $c = $a = $b; + var_dump($c); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_015.phpt b/ext/opcache/tests/jit/assign_015.phpt index 4211f83503..248259e328 100644 --- a/ext/opcache/tests/jit/assign_015.phpt +++ b/ext/opcache/tests/jit/assign_015.phpt @@ -11,10 +11,10 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = 1; - $b = 2; - $c = $a = $b; - var_dump($c); + $a = 1; + $b = 2; + $c = $a = $b; + var_dump($c); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_016.phpt b/ext/opcache/tests/jit/assign_016.phpt index 7598709cb9..a2ba0e0a7f 100644 --- a/ext/opcache/tests/jit/assign_016.phpt +++ b/ext/opcache/tests/jit/assign_016.phpt @@ -11,10 +11,10 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = 1; - $b = 2; - $c = $a = $b; - return $c; + $a = 1; + $b = 2; + $c = $a = $b; + return $c; } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_017.phpt b/ext/opcache/tests/jit/assign_017.phpt index 6fa9c562e4..7aafdefd70 100644 --- a/ext/opcache/tests/jit/assign_017.phpt +++ b/ext/opcache/tests/jit/assign_017.phpt @@ -11,10 +11,10 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = array(); - $b = 2; - $c = $a = $b; - return $c; + $a = array(); + $b = 2; + $c = $a = $b; + return $c; } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_018.phpt b/ext/opcache/tests/jit/assign_018.phpt index 74258fbb15..8b19921e28 100644 --- a/ext/opcache/tests/jit/assign_018.phpt +++ b/ext/opcache/tests/jit/assign_018.phpt @@ -11,12 +11,12 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $c = array(); - $d = $c; - $a = 1; - $b = 2; - $c = $a = $b; - var_dump($c, $d); + $c = array(); + $d = $c; + $a = 1; + $b = 2; + $c = $a = $b; + var_dump($c, $d); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_019.phpt b/ext/opcache/tests/jit/assign_019.phpt index 4c01164dcf..6c84c4fbad 100644 --- a/ext/opcache/tests/jit/assign_019.phpt +++ b/ext/opcache/tests/jit/assign_019.phpt @@ -11,12 +11,12 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $c = array(); - $d =& $c; - $a = 1; - $b = 2; - $c = $a = $b; - var_dump($c, $d); + $c = array(); + $d =& $c; + $a = 1; + $b = 2; + $c = $a = $b; + var_dump($c, $d); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_020.phpt b/ext/opcache/tests/jit/assign_020.phpt index 24ef6fcfc9..6d1ccc89b2 100644 --- a/ext/opcache/tests/jit/assign_020.phpt +++ b/ext/opcache/tests/jit/assign_020.phpt @@ -11,11 +11,11 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $c = array(); - $a = 1; - $b = 2; - $c = $a = $b; - var_dump($c); + $c = array(); + $a = 1; + $b = 2; + $c = $a = $b; + var_dump($c); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_021.phpt b/ext/opcache/tests/jit/assign_021.phpt index 52e20d1aac..caad315d3e 100644 --- a/ext/opcache/tests/jit/assign_021.phpt +++ b/ext/opcache/tests/jit/assign_021.phpt @@ -11,11 +11,11 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = array(); - $b = $a; - $c = 1; - $d = $a = $c; - var_dump($b, $d); + $a = array(); + $b = $a; + $c = 1; + $d = $a = $c; + var_dump($b, $d); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_022.phpt b/ext/opcache/tests/jit/assign_022.phpt index ebe153f140..8298c28b22 100644 --- a/ext/opcache/tests/jit/assign_022.phpt +++ b/ext/opcache/tests/jit/assign_022.phpt @@ -11,11 +11,11 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = array(1); - $a[0] = $undef; - for($i=0; $i<6; $i++) { - $undef = 1; - } + $a = array(1); + $a[0] = $undef; + for($i=0; $i<6; $i++) { + $undef = 1; + } } foo(); echo "ok\n"; diff --git a/ext/opcache/tests/jit/assign_023.phpt b/ext/opcache/tests/jit/assign_023.phpt index ebe5ff288f..e1211f5569 100644 --- a/ext/opcache/tests/jit/assign_023.phpt +++ b/ext/opcache/tests/jit/assign_023.phpt @@ -11,11 +11,11 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = array(1); - $a = $undef; - for($i=0; $i<6; $i++) { - $undef = 1; - } + $a = array(1); + $a = $undef; + for($i=0; $i<6; $i++) { + $undef = 1; + } } foo(); echo "ok\n"; diff --git a/ext/opcache/tests/jit/assign_024.phpt b/ext/opcache/tests/jit/assign_024.phpt index 4f48a3e75c..f77296f84d 100644 --- a/ext/opcache/tests/jit/assign_024.phpt +++ b/ext/opcache/tests/jit/assign_024.phpt @@ -11,10 +11,10 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = $undef; - for($i=0; $i<6; $i++) { - $undef = 1; - } + $a = $undef; + for($i=0; $i<6; $i++) { + $undef = 1; + } } foo(); echo "ok\n"; diff --git a/ext/opcache/tests/jit/assign_025.phpt b/ext/opcache/tests/jit/assign_025.phpt index 36b76dba09..9bafa43cb6 100644 --- a/ext/opcache/tests/jit/assign_025.phpt +++ b/ext/opcache/tests/jit/assign_025.phpt @@ -11,11 +11,11 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $arr[0][0] = $ref; - for($cnt=0;$cnt<6;$cnt++) { - $ref = 1; - $arr[0][0] = $ref; - } + $arr[0][0] = $ref; + for($cnt=0;$cnt<6;$cnt++) { + $ref = 1; + $arr[0][0] = $ref; + } } foo(); echo "ok\n"; diff --git a/ext/opcache/tests/jit/assign_026.phpt b/ext/opcache/tests/jit/assign_026.phpt index 4ea0e773e4..160d066b51 100644 --- a/ext/opcache/tests/jit/assign_026.phpt +++ b/ext/opcache/tests/jit/assign_026.phpt @@ -11,13 +11,13 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = array(1,2,3); - $b=&$a; - $b=1; - $a = new stdClass; - $a->a=1; - $a->b=2; - $b=&$a; + $a = array(1,2,3); + $b=&$a; + $b=1; + $a = new stdClass; + $a->a=1; + $a->b=2; + $b=&$a; } foo(); echo "ok\n"; diff --git a/ext/opcache/tests/jit/assign_027.phpt b/ext/opcache/tests/jit/assign_027.phpt index 20e4f65442..a704e3cdd6 100644 --- a/ext/opcache/tests/jit/assign_027.phpt +++ b/ext/opcache/tests/jit/assign_027.phpt @@ -13,7 +13,7 @@ opcache.jit_buffer_size=1M function foo() { $persons = 2; for ($i=0; $i<$persons; $i++) { - $children = 2; + $children = 2; } } foo(); diff --git a/ext/opcache/tests/jit/assign_033.phpt b/ext/opcache/tests/jit/assign_033.phpt index 5bda1f0192..918f3b6b57 100644 --- a/ext/opcache/tests/jit/assign_033.phpt +++ b/ext/opcache/tests/jit/assign_033.phpt @@ -13,11 +13,11 @@ opcache.protect_memory=1 <?php function foo() { - $mode = 0; - $working = 0; - while ($mode == 0) { - $working = $mode = 1; - } + $mode = 0; + $working = 0; + while ($mode == 0) { + $working = $mode = 1; + } } echo "ok\n"; --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_034.phpt b/ext/opcache/tests/jit/assign_034.phpt index b444dd9c07..4fa7af3e9f 100644 --- a/ext/opcache/tests/jit/assign_034.phpt +++ b/ext/opcache/tests/jit/assign_034.phpt @@ -12,9 +12,9 @@ opcache.protect_memory=1 --FILE-- <?php function bar() { - $a = strlen("a"); - $a++; - return $a; + $a = strlen("a"); + $a++; + return $a; } var_dump(bar()); --EXPECT-- diff --git a/ext/opcache/tests/jit/assign_035.phpt b/ext/opcache/tests/jit/assign_035.phpt index c51b773727..aebefc4391 100644 --- a/ext/opcache/tests/jit/assign_035.phpt +++ b/ext/opcache/tests/jit/assign_035.phpt @@ -19,8 +19,8 @@ class A { $arr = [ 'a' => $closure(), - 'b' => [$closure() => [],], - ]; + 'b' => [$closure() => [],], + ]; $x = $arr; unset($x['b'][$closure()]['d']); diff --git a/ext/opcache/tests/jit/assign_036.phpt b/ext/opcache/tests/jit/assign_036.phpt index a35516d6ea..f7065f0d5e 100644 --- a/ext/opcache/tests/jit/assign_036.phpt +++ b/ext/opcache/tests/jit/assign_036.phpt @@ -12,28 +12,28 @@ opcache.protect_memory=1 --FILE-- <?php class A { - public $result = "string"; - function __set($propName, $propValue) - { - $oldType = \gettype($this->$propName); - $newType = \gettype($propValue); - if ($propValue === 'false') - { - $newType = 'boolean'; - $propValue = \false; - } - elseif ($propValue === 'true') - { - $newType = 'boolean'; - $propValue = \true; - } - if ($oldType !== $newType) - { - $tmp = $propValue; - \settype($tmp, $newType); - } - $this->propName = $propValue; - } + public $result = "string"; + function __set($propName, $propValue) + { + $oldType = \gettype($this->$propName); + $newType = \gettype($propValue); + if ($propValue === 'false') + { + $newType = 'boolean'; + $propValue = \false; + } + elseif ($propValue === 'true') + { + $newType = 'boolean'; + $propValue = \true; + } + if ($oldType !== $newType) + { + $tmp = $propValue; + \settype($tmp, $newType); + } + $this->propName = $propValue; + } } $a = new A; $a->result = "okey"; diff --git a/ext/opcache/tests/jit/assign_dim_002.phpt b/ext/opcache/tests/jit/assign_dim_002.phpt index 845414b7bb..135df92123 100644 --- a/ext/opcache/tests/jit/assign_dim_002.phpt +++ b/ext/opcache/tests/jit/assign_dim_002.phpt @@ -10,63 +10,63 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $var[] = 1; - var_dump($var); + $var[] = 1; + var_dump($var); } foo(); function foo1() { - $var1[] = true; - var_dump($var1); + $var1[] = true; + var_dump($var1); } foo1(); function foo2() { - $var2[] = array(); - var_dump($var2); + $var2[] = array(); + var_dump($var2); } foo2(); function foo3() { - $array = array(PHP_INT_MAX => "dummy"); + $array = array(PHP_INT_MAX => "dummy"); try { $array[] = array(); } catch (Error $e) { echo $e->getMessage(), "\n"; } - $array = new ArrayObject(); - $array[index()] = 1; - $array[offset()] = 2; + $array = new ArrayObject(); + $array[index()] = 1; + $array[offset()] = 2; - var_dump($array); + var_dump($array); } foo3(); function index() { - return 2; + return 2; } function offset() { - return "a"; + return "a"; } function foo4() { - $array = array(); - $array[] = array(); - $array[0][] = 1; - $array[0][1] = 1; - var_dump($array); + $array = array(); + $array[] = array(); + $array[0][] = 1; + $array[0][1] = 1; + var_dump($array); try { $array[function() {}] = 2; } catch (Error $e) { echo $e->getMessage(), "\n"; } - var_dump($array); + var_dump($array); - $array2[][] = 3; - var_dump($array); + $array2[][] = 3; + var_dump($array); } foo4(); diff --git a/ext/opcache/tests/jit/bug77857.phpt b/ext/opcache/tests/jit/bug77857.phpt index 028ea04aa8..9b9a80f533 100644 --- a/ext/opcache/tests/jit/bug77857.phpt +++ b/ext/opcache/tests/jit/bug77857.phpt @@ -11,14 +11,14 @@ opcache.jit=1205 --FILE-- <?php function test() { - $arr = array_fill(0, 1, 1.0); - $y = 0.0; - foreach ($arr as $v) { - $tmp = 1.0 * $v; - var_dump($tmp); - $y = $tmp/1.0; - } - return $y; + $arr = array_fill(0, 1, 1.0); + $y = 0.0; + foreach ($arr as $v) { + $tmp = 1.0 * $v; + var_dump($tmp); + $y = $tmp/1.0; + } + return $y; } var_dump(test()); ?> diff --git a/ext/opcache/tests/jit/cmp_003.phpt b/ext/opcache/tests/jit/cmp_003.phpt index 342d794c2e..60698dea04 100644 --- a/ext/opcache/tests/jit/cmp_003.phpt +++ b/ext/opcache/tests/jit/cmp_003.phpt @@ -11,12 +11,12 @@ opcache.protect_memory=1 --FILE-- <?php function t() { - echo "!"; - return true; + echo "!"; + return true; } function f() { - echo "!"; - return false; + echo "!"; + return false; } $a = 0.0; $i = 0; @@ -37,27 +37,27 @@ var_dump($a <= $b ? 1 : 0); var_dump($a >= $b ? 1 : 0); if ($a == $b) { } else { - echo "1\n"; + echo "1\n"; } if ($a != $b) { } else { - echo "2\n"; + echo "2\n"; } if ($a < $b) { } else { - echo "3\n"; + echo "3\n"; } if ($a > $b) { } else { - echo "4\n"; + echo "4\n"; } if ($a <= $b) { } else { - echo "5\n"; + echo "5\n"; } if ($a >= $b) { } else { - echo "6\n"; + echo "6\n"; } var_dump($i == $b ? 1 : 0); var_dump($i != $b ? 1 : 0); @@ -67,27 +67,27 @@ var_dump($i <= $b ? 1 : 0); var_dump($i >= $b ? 1 : 0); if ($i == $b) { } else { - echo "1\n"; + echo "1\n"; } if ($i != $b) { } else { - echo "2\n"; + echo "2\n"; } if ($i < $b) { } else { - echo "3\n"; + echo "3\n"; } if ($i > $b) { } else { - echo "4\n"; + echo "4\n"; } if ($i <= $b) { } else { - echo "5\n"; + echo "5\n"; } if ($i >= $b) { } else { - echo "6\n"; + echo "6\n"; } var_dump($a == $b && t()); var_dump($a != $b && t()); diff --git a/ext/opcache/tests/jit/cmp_004.phpt b/ext/opcache/tests/jit/cmp_004.phpt index 3d1fb97b85..9a5772e378 100644 --- a/ext/opcache/tests/jit/cmp_004.phpt +++ b/ext/opcache/tests/jit/cmp_004.phpt @@ -11,10 +11,10 @@ opcache.protect_memory=1 --FILE-- <?php function foo(bool $test, int $x) { - if (($test ? $x >= 1 : $x > 1)) { - return 1; - } - return 0; + if (($test ? $x >= 1 : $x > 1)) { + return 1; + } + return 0; } var_dump(foo(true, 9)); ?> diff --git a/ext/opcache/tests/jit/const_001.phpt b/ext/opcache/tests/jit/const_001.phpt index ef97b45c23..67c9a0d121 100644 --- a/ext/opcache/tests/jit/const_001.phpt +++ b/ext/opcache/tests/jit/const_001.phpt @@ -11,12 +11,12 @@ opcache.protect_memory=1 --FILE-- <?php function define_const() { - define("CUSTOM_CONSTANT", 1); + define("CUSTOM_CONSTANT", 1); } function test_defined() { - var_dump(defined("CUSTOM_CONSTANT")); - define_const(); - var_dump(defined("CUSTOM_CONSTANT")); + var_dump(defined("CUSTOM_CONSTANT")); + define_const(); + var_dump(defined("CUSTOM_CONSTANT")); } test_defined(); diff --git a/ext/opcache/tests/jit/defined_001.phpt b/ext/opcache/tests/jit/defined_001.phpt index 43eaf7f59b..76da7760c6 100644 --- a/ext/opcache/tests/jit/defined_001.phpt +++ b/ext/opcache/tests/jit/defined_001.phpt @@ -11,26 +11,26 @@ opcache.jit=1235 --FILE-- <?php function foo($i) { - $a = defined("X"); - $b = defined("X"); - if (defined("X")) { - $c = 1; - } else { - $c = 0; - } - if (!defined("X")) { - $d = 0; - } else { - $d = 1; - } - if ($a || $b || $c || $d) { + $a = defined("X"); + $b = defined("X"); + if (defined("X")) { + $c = 1; + } else { + $c = 0; + } + if (!defined("X")) { + $d = 0; + } else { + $d = 1; + } + if ($a || $b || $c || $d) { - die("Error on $i-th iteration\n"); - } + die("Error on $i-th iteration\n"); + } } for ($i = 0; $i < 10000; $i++) { - foo($i); + foo($i); } echo "ok\n"; ?> diff --git a/ext/opcache/tests/jit/fetch_dim_func_args_001.phpt b/ext/opcache/tests/jit/fetch_dim_func_args_001.phpt index a1ac1d35cc..b2e58c44b4 100644 --- a/ext/opcache/tests/jit/fetch_dim_func_args_001.phpt +++ b/ext/opcache/tests/jit/fetch_dim_func_args_001.phpt @@ -12,9 +12,9 @@ opcache.jit_buffer_size=1M namespace A; class A { - public function change(array $config) { - $config['keys'] = array_keys($config["a"]);; - } + public function change(array $config) { + $config['keys'] = array_keys($config["a"]);; + } } $a = new A(); diff --git a/ext/opcache/tests/jit/fetch_dim_r_001.phpt b/ext/opcache/tests/jit/fetch_dim_r_001.phpt index d38cf6096d..232f62cf75 100644 --- a/ext/opcache/tests/jit/fetch_dim_r_001.phpt +++ b/ext/opcache/tests/jit/fetch_dim_r_001.phpt @@ -11,23 +11,23 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = array(1,2,3,""=>4,"ab"=>5,"2x"=>6); - var_dump($a[0]); - var_dump($a[2]); - var_dump($a[1.0]); - var_dump($a["0"]); - var_dump($a["2"]); - var_dump($a[false]); - var_dump($a[true]); - var_dump($a[null]); - var_dump($a["ab"]); - $x = "a"; - $y = "b"; - var_dump($a[$x . $y]); - var_dump($a["2x"]); - $x = "2"; - $y = "x"; - var_dump($a[$x . $y]); + $a = array(1,2,3,""=>4,"ab"=>5,"2x"=>6); + var_dump($a[0]); + var_dump($a[2]); + var_dump($a[1.0]); + var_dump($a["0"]); + var_dump($a["2"]); + var_dump($a[false]); + var_dump($a[true]); + var_dump($a[null]); + var_dump($a["ab"]); + $x = "a"; + $y = "b"; + var_dump($a[$x . $y]); + var_dump($a["2x"]); + $x = "2"; + $y = "x"; + var_dump($a[$x . $y]); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/fetch_dim_r_002.phpt b/ext/opcache/tests/jit/fetch_dim_r_002.phpt index 36ec162ce5..178071b115 100644 --- a/ext/opcache/tests/jit/fetch_dim_r_002.phpt +++ b/ext/opcache/tests/jit/fetch_dim_r_002.phpt @@ -11,8 +11,8 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo($n) { - $a = array(1,2,3,""=>4,"ab"=>5,"2x"=>6); - var_dump($a[$n]); + $a = array(1,2,3,""=>4,"ab"=>5,"2x"=>6); + var_dump($a[$n]); } foo(0); foo(2); diff --git a/ext/opcache/tests/jit/fetch_dim_r_003.phpt b/ext/opcache/tests/jit/fetch_dim_r_003.phpt index 2e82cb926c..2638715236 100644 --- a/ext/opcache/tests/jit/fetch_dim_r_003.phpt +++ b/ext/opcache/tests/jit/fetch_dim_r_003.phpt @@ -11,23 +11,23 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a = "ABCDEF"; - var_dump($a[0]); - var_dump($a[2]); - var_dump($a[1.0]); - var_dump($a["0"]); - var_dump($a["2"]); - var_dump($a[false]); - var_dump($a[true]); - var_dump($a[null]); - var_dump($a["ab"]); - $x = "a"; - $y = "b"; - var_dump($a[$x . $y]); - var_dump($a["2x"]); - $x = "2"; - $y = "x"; - var_dump($a[$x . $y]); + $a = "ABCDEF"; + var_dump($a[0]); + var_dump($a[2]); + var_dump($a[1.0]); + var_dump($a["0"]); + var_dump($a["2"]); + var_dump($a[false]); + var_dump($a[true]); + var_dump($a[null]); + var_dump($a["ab"]); + $x = "a"; + $y = "b"; + var_dump($a[$x . $y]); + var_dump($a["2x"]); + $x = "2"; + $y = "x"; + var_dump($a[$x . $y]); } foo(); --EXPECTF-- diff --git a/ext/opcache/tests/jit/fetch_dim_r_004.phpt b/ext/opcache/tests/jit/fetch_dim_r_004.phpt index 66a88977d9..0fd705942e 100644 --- a/ext/opcache/tests/jit/fetch_dim_r_004.phpt +++ b/ext/opcache/tests/jit/fetch_dim_r_004.phpt @@ -11,8 +11,8 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo($n) { - $a = "ABCDEF"; - var_dump($a[$n]); + $a = "ABCDEF"; + var_dump($a[$n]); } foo(0); foo(2); diff --git a/ext/opcache/tests/jit/fetch_dim_rw_001.phpt b/ext/opcache/tests/jit/fetch_dim_rw_001.phpt index a828e0a5ea..39b9fd33ff 100644 --- a/ext/opcache/tests/jit/fetch_dim_rw_001.phpt +++ b/ext/opcache/tests/jit/fetch_dim_rw_001.phpt @@ -11,8 +11,8 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo() { - $a[0][0] += 2; - return $a[0]; + $a[0][0] += 2; + return $a[0]; } var_dump(foo()); --EXPECTF-- diff --git a/ext/opcache/tests/jit/fetch_obj_001.phpt b/ext/opcache/tests/jit/fetch_obj_001.phpt index 2fa44d69ca..d309442187 100644 --- a/ext/opcache/tests/jit/fetch_obj_001.phpt +++ b/ext/opcache/tests/jit/fetch_obj_001.phpt @@ -10,7 +10,7 @@ opcache.jit_buffer_size=1M --FILE-- <?php function foo(&$a) { - $a = 2; + $a = 2; } function foo2(&$a) { @@ -36,17 +36,17 @@ var_dump($obj); function bar() { $obj = new stdClass; - foo($obj->a); - var_dump($obj); - foo2($obj->b); - var_dump($obj); - foo3($obj->a, "2" . "3"); - foo3($obj->a, $obj->b); - var_dump($obj); + foo($obj->a); + var_dump($obj); + foo2($obj->b); + var_dump($obj); + foo3($obj->a, "2" . "3"); + foo3($obj->a, $obj->b); + var_dump($obj); - $a = &$obj->a; - $a = fopen(__FILE__, "r"); - var_dump($obj); + $a = &$obj->a; + $a = fopen(__FILE__, "r"); + var_dump($obj); $d = array(); try { @@ -54,7 +54,7 @@ function bar() { } catch (Error $err) { echo $err->getMessage(), "\n"; } - var_dump($d); + var_dump($d); $e = NULL; try { @@ -62,7 +62,7 @@ function bar() { } catch (Error $err) { echo $err->getMessage(), "\n"; } - var_dump($e); + var_dump($e); $f = ""; try { @@ -70,7 +70,7 @@ function bar() { } catch (Error $err) { echo $err->getMessage(), "\n"; } - var_dump($f); + var_dump($f); } bar(); diff --git a/ext/opcache/tests/jit/fetch_obj_003.phpt b/ext/opcache/tests/jit/fetch_obj_003.phpt index 9232ccd64b..de51b45fa7 100644 --- a/ext/opcache/tests/jit/fetch_obj_003.phpt +++ b/ext/opcache/tests/jit/fetch_obj_003.phpt @@ -10,22 +10,22 @@ opcache.jit_buffer_size=1M --FILE-- <?php class C { - var $a = 0; + var $a = 0; } function foo() { - $x = new C; - $x->a = 1; - unset($x->a); - $x->a += 2; - var_dump($x); + $x = new C; + $x->a = 1; + unset($x->a); + $x->a += 2; + var_dump($x); } function bar() { - $x = new C; - $x->a = 1; - $x->b = 2; - unset($x->a); - $x->a += 2; - var_dump($x); + $x = new C; + $x->a = 1; + $x->b = 2; + unset($x->a); + $x->a += 2; + var_dump($x); } foo(); bar(); diff --git a/ext/opcache/tests/jit/fetch_obj_004.phpt b/ext/opcache/tests/jit/fetch_obj_004.phpt index 10e459b093..ec4d74f0e6 100644 --- a/ext/opcache/tests/jit/fetch_obj_004.phpt +++ b/ext/opcache/tests/jit/fetch_obj_004.phpt @@ -10,22 +10,22 @@ opcache.jit_buffer_size=1M --FILE-- <?php class C { - var $a = 0; + var $a = 0; } function foo() { - $x = new C; - $x->a = 1; - unset($x->a); - $x->a = 3; - var_dump($x); + $x = new C; + $x->a = 1; + unset($x->a); + $x->a = 3; + var_dump($x); } function bar() { - $x = new C; - $x->a = 1; - $x->b = 2; - unset($x->a); - $x->a = 3; - var_dump($x); + $x = new C; + $x->a = 1; + $x->b = 2; + unset($x->a); + $x->a = 3; + var_dump($x); } foo(); bar(); diff --git a/ext/opcache/tests/jit/inc_001.phpt b/ext/opcache/tests/jit/inc_001.phpt index 7010533e6b..c3807303e7 100644 --- a/ext/opcache/tests/jit/inc_001.phpt +++ b/ext/opcache/tests/jit/inc_001.phpt @@ -12,10 +12,10 @@ opcache.protect_memory=1 --FILE-- <?php function foo() { - $x = 1; - $x += 0; - ++$x; // mem -> mem - var_dump($x); + $x = 1; + $x += 0; + ++$x; // mem -> mem + var_dump($x); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_002.phpt b/ext/opcache/tests/jit/inc_002.phpt index a6962d1cac..4d2757ca75 100644 --- a/ext/opcache/tests/jit/inc_002.phpt +++ b/ext/opcache/tests/jit/inc_002.phpt @@ -11,10 +11,10 @@ opcache.protect_memory=1 <?php require_once('skipif.inc'); ?> --FILE-- <?php -function foo() { - $x = 1; - ++$x; // reg -> mem - var_dump($x); +function foo() { + $x = 1; + ++$x; // reg -> mem + var_dump($x); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_003.phpt b/ext/opcache/tests/jit/inc_003.phpt index d0a022d635..9842527be7 100644 --- a/ext/opcache/tests/jit/inc_003.phpt +++ b/ext/opcache/tests/jit/inc_003.phpt @@ -12,10 +12,10 @@ opcache.protect_memory=1 --FILE-- <?php function foo() { - $x = 1; - $x += 0; - ++$x; // mem -> reg - return $x; + $x = 1; + $x += 0; + ++$x; // mem -> reg + return $x; } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_004.phpt b/ext/opcache/tests/jit/inc_004.phpt index 5c560fc95f..6431020537 100644 --- a/ext/opcache/tests/jit/inc_004.phpt +++ b/ext/opcache/tests/jit/inc_004.phpt @@ -11,10 +11,10 @@ opcache.protect_memory=1 <?php require_once('skipif.inc'); ?> --FILE-- <?php -function foo() { - $x = 1; - ++$x; // reg -> reg - return $x; +function foo() { + $x = 1; + ++$x; // reg -> reg + return $x; } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_005.phpt b/ext/opcache/tests/jit/inc_005.phpt index 99c2b2b858..d784b092e9 100644 --- a/ext/opcache/tests/jit/inc_005.phpt +++ b/ext/opcache/tests/jit/inc_005.phpt @@ -12,10 +12,10 @@ opcache.protect_memory=1 --FILE-- <?php function foo() { - $x = 1; - $x += 0; - var_dump(++$x); // mem -> mem, mem - var_dump($x); + $x = 1; + $x += 0; + var_dump(++$x); // mem -> mem, mem + var_dump($x); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_006.phpt b/ext/opcache/tests/jit/inc_006.phpt index 3cb61691ed..3ecff9e13d 100644 --- a/ext/opcache/tests/jit/inc_006.phpt +++ b/ext/opcache/tests/jit/inc_006.phpt @@ -11,10 +11,10 @@ opcache.protect_memory=1 <?php require_once('skipif.inc'); ?> --FILE-- <?php -function foo() { - $x = 1; - var_dump(++$x); // reg -> mem, mem - var_dump($x); +function foo() { + $x = 1; + var_dump(++$x); // reg -> mem, mem + var_dump($x); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_007.phpt b/ext/opcache/tests/jit/inc_007.phpt index 4ca3f44400..bb1634d731 100644 --- a/ext/opcache/tests/jit/inc_007.phpt +++ b/ext/opcache/tests/jit/inc_007.phpt @@ -12,9 +12,9 @@ opcache.protect_memory=1 --FILE-- <?php function foo() { - $x = 1; - $x += 0; - return ++$x; // mem -> reg, reg + $x = 1; + $x += 0; + return ++$x; // mem -> reg, reg } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_008.phpt b/ext/opcache/tests/jit/inc_008.phpt index 1c1daae827..d008cb094d 100644 --- a/ext/opcache/tests/jit/inc_008.phpt +++ b/ext/opcache/tests/jit/inc_008.phpt @@ -11,9 +11,9 @@ opcache.protect_memory=1 <?php require_once('skipif.inc'); ?> --FILE-- <?php -function foo() { - $x = 1; - return ++$x; // reg -> reg, reg +function foo() { + $x = 1; + return ++$x; // reg -> reg, reg } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_009.phpt b/ext/opcache/tests/jit/inc_009.phpt index 06920f7bde..e600cba7ad 100644 --- a/ext/opcache/tests/jit/inc_009.phpt +++ b/ext/opcache/tests/jit/inc_009.phpt @@ -12,10 +12,10 @@ opcache.protect_memory=1 --FILE-- <?php function foo() { - $x = 1.0; - $x += 0; - ++$x; // mem -> mem - var_dump($x); + $x = 1.0; + $x += 0; + ++$x; // mem -> mem + var_dump($x); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_010.phpt b/ext/opcache/tests/jit/inc_010.phpt index 0d4800efac..105387d924 100644 --- a/ext/opcache/tests/jit/inc_010.phpt +++ b/ext/opcache/tests/jit/inc_010.phpt @@ -11,10 +11,10 @@ opcache.protect_memory=1 <?php require_once('skipif.inc'); ?> --FILE-- <?php -function foo() { - $x = 1.0; - ++$x; // reg -> mem - var_dump($x); +function foo() { + $x = 1.0; + ++$x; // reg -> mem + var_dump($x); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_011.phpt b/ext/opcache/tests/jit/inc_011.phpt index 2cf9678af3..d91c487965 100644 --- a/ext/opcache/tests/jit/inc_011.phpt +++ b/ext/opcache/tests/jit/inc_011.phpt @@ -12,10 +12,10 @@ opcache.protect_memory=1 --FILE-- <?php function foo() { - $x = 1.0; - $x += 0; - ++$x; // mem -> reg - return $x; + $x = 1.0; + $x += 0; + ++$x; // mem -> reg + return $x; } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_012.phpt b/ext/opcache/tests/jit/inc_012.phpt index bbae1ed78f..14fb5c1b90 100644 --- a/ext/opcache/tests/jit/inc_012.phpt +++ b/ext/opcache/tests/jit/inc_012.phpt @@ -11,10 +11,10 @@ opcache.protect_memory=1 <?php require_once('skipif.inc'); ?> --FILE-- <?php -function foo() { - $x = 1.0; - ++$x; // reg -> reg - return $x; +function foo() { + $x = 1.0; + ++$x; // reg -> reg + return $x; } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_013.phpt b/ext/opcache/tests/jit/inc_013.phpt index c07bddc66c..2c2e5f0920 100644 --- a/ext/opcache/tests/jit/inc_013.phpt +++ b/ext/opcache/tests/jit/inc_013.phpt @@ -12,10 +12,10 @@ opcache.protect_memory=1 --FILE-- <?php function foo() { - $x = 1.0; - $x += 0; - var_dump(++$x); // mem -> mem, mem - var_dump($x); + $x = 1.0; + $x += 0; + var_dump(++$x); // mem -> mem, mem + var_dump($x); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_014.phpt b/ext/opcache/tests/jit/inc_014.phpt index d026fae27f..e6f31f32f3 100644 --- a/ext/opcache/tests/jit/inc_014.phpt +++ b/ext/opcache/tests/jit/inc_014.phpt @@ -11,10 +11,10 @@ opcache.protect_memory=1 <?php require_once('skipif.inc'); ?> --FILE-- <?php -function foo() { - $x = 1.0; - var_dump(++$x); // reg -> mem, mem - var_dump($x); +function foo() { + $x = 1.0; + var_dump(++$x); // reg -> mem, mem + var_dump($x); } foo(); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_015.phpt b/ext/opcache/tests/jit/inc_015.phpt index acbc8050c7..d841dc0c9c 100644 --- a/ext/opcache/tests/jit/inc_015.phpt +++ b/ext/opcache/tests/jit/inc_015.phpt @@ -12,9 +12,9 @@ opcache.protect_memory=1 --FILE-- <?php function foo() { - $x = 1.0; - $x += 0; - return ++$x; // mem -> reg, reg + $x = 1.0; + $x += 0; + return ++$x; // mem -> reg, reg } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_016.phpt b/ext/opcache/tests/jit/inc_016.phpt index 2deabbdd5a..c1a6302e92 100644 --- a/ext/opcache/tests/jit/inc_016.phpt +++ b/ext/opcache/tests/jit/inc_016.phpt @@ -11,9 +11,9 @@ opcache.protect_memory=1 <?php require_once('skipif.inc'); ?> --FILE-- <?php -function foo() { - $x = 1.0; - return ++$x; // reg -> reg, reg +function foo() { + $x = 1.0; + return ++$x; // reg -> reg, reg } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_017.phpt b/ext/opcache/tests/jit/inc_017.phpt index 5da8842fc2..c52e018048 100644 --- a/ext/opcache/tests/jit/inc_017.phpt +++ b/ext/opcache/tests/jit/inc_017.phpt @@ -11,9 +11,9 @@ opcache.protect_memory=1 <?php require_once('skipif.inc'); ?> --FILE-- <?php -function foo() { - $x = true; - return ++$x; // reg -> reg, reg +function foo() { + $x = true; + return ++$x; // reg -> reg, reg } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_018.phpt b/ext/opcache/tests/jit/inc_018.phpt index 6ddb4c3174..c992fa528d 100644 --- a/ext/opcache/tests/jit/inc_018.phpt +++ b/ext/opcache/tests/jit/inc_018.phpt @@ -11,9 +11,9 @@ opcache.protect_memory=1 <?php require_once('skipif.inc'); ?> --FILE-- <?php -function foo() { - $x = false; - return ++$x; // reg -> reg, reg +function foo() { + $x = false; + return ++$x; // reg -> reg, reg } var_dump(foo()); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_019.phpt b/ext/opcache/tests/jit/inc_019.phpt index 42e83cc93e..e147ef6f2f 100644 --- a/ext/opcache/tests/jit/inc_019.phpt +++ b/ext/opcache/tests/jit/inc_019.phpt @@ -12,14 +12,14 @@ opcache.protect_memory=1 --FILE-- <?php function bar($b) { - if ($b) { - $a = 1; - } else { - $a = 2; - } - isset($a); - var_dump($a++); - return $a; + if ($b) { + $a = 1; + } else { + $a = 2; + } + isset($a); + var_dump($a++); + return $a; } var_dump(bar(0)); --EXPECT-- diff --git a/ext/opcache/tests/jit/inc_020.phpt b/ext/opcache/tests/jit/inc_020.phpt index 60a98f5c20..5b3530d6e1 100644 --- a/ext/opcache/tests/jit/inc_020.phpt +++ b/ext/opcache/tests/jit/inc_020.phpt @@ -12,15 +12,15 @@ opcache.protect_memory=1 --FILE-- <?php function foo($row) { - foreach ($row as $key => $value) { - if (is_int($key)) { - $key++; - } - if (isset($row[$key])) { - return false; - } - } - return true; + foreach ($row as $key => $value) { + if (is_int($key)) { + $key++; + } + if (isset($row[$key])) { + return false; + } + } + return true; } ?> OK diff --git a/ext/opcache/tests/jit/jmpz_001.phpt b/ext/opcache/tests/jit/jmpz_001.phpt index 46aa0f8825..2772942f39 100644 --- a/ext/opcache/tests/jit/jmpz_001.phpt +++ b/ext/opcache/tests/jit/jmpz_001.phpt @@ -14,10 +14,10 @@ namespace A; function test() { - $modelData = array(); - $ret = false || - ((is_array($modelData) || $modelData instanceof \Countable) && true) || false; - return $ret; + $modelData = array(); + $ret = false || + ((is_array($modelData) || $modelData instanceof \Countable) && true) || false; + return $ret; } var_dump(test()); diff --git a/ext/opcache/tests/jit/mod_001.phpt b/ext/opcache/tests/jit/mod_001.phpt index 88d8bfc767..d9dd638f63 100644 --- a/ext/opcache/tests/jit/mod_001.phpt +++ b/ext/opcache/tests/jit/mod_001.phpt @@ -11,7 +11,7 @@ opcache.protect_memory=1 --FILE-- <?php function mod(int $a, int $b) { - return $a % $b; + return $a % $b; } var_dump(mod(125, 33)); var_dump(mod(125, 32)); @@ -20,14 +20,14 @@ var_dump(mod(-125, 32)); var_dump(mod(125, -33)); var_dump(mod(-125, -33)); try { - var_dump(mod(125, -1)); + var_dump(mod(125, -1)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo "Exception " . $e->getMessage() . "\n"; } try { - var_dump(mod(125, 0)); + var_dump(mod(125, 0)); } catch (Throwable $e) { - echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; + echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/opcache/tests/jit/mod_002.phpt b/ext/opcache/tests/jit/mod_002.phpt index d06645f783..9dada5e400 100644 --- a/ext/opcache/tests/jit/mod_002.phpt +++ b/ext/opcache/tests/jit/mod_002.phpt @@ -11,19 +11,19 @@ opcache.protect_memory=1 --FILE-- <?php function mod33(int $a) { - return $a % 33; + return $a % 33; } function mod32(int $a) { - return $a % 32; + return $a % 32; } function modNeg33(int $a) { - return $a % -33; + return $a % -33; } function modNeg1(int $a) { - return $a % -1; + return $a % -1; } function mod0(int $a) { - return $a % 0; + return $a % 0; } var_dump(mod33(125)); var_dump(mod32(125)); @@ -32,14 +32,14 @@ var_dump(mod32(-125)); var_dump(modNeg33(125)); var_dump(modNeg33(-125)); try { - var_dump(modNeg1(125)); + var_dump(modNeg1(125)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo "Exception " . $e->getMessage() . "\n"; } try { - var_dump(mod0(125)); + var_dump(mod0(125)); } catch (Throwable $e) { - echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; + echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/opcache/tests/jit/recv_001.phpt b/ext/opcache/tests/jit/recv_001.phpt index 1f02ff3381..2213da5f57 100644 --- a/ext/opcache/tests/jit/recv_001.phpt +++ b/ext/opcache/tests/jit/recv_001.phpt @@ -14,7 +14,7 @@ opcache.protect_memory=1 function test(array $args, $short_options, $long_options = null) { - echo "okey"; + echo "okey"; } test(array(), "d:e", 222, 3434); diff --git a/ext/opcache/tests/jit/reg_alloc_002.phpt b/ext/opcache/tests/jit/reg_alloc_002.phpt index 0a6d0a4bff..5593156188 100644 --- a/ext/opcache/tests/jit/reg_alloc_002.phpt +++ b/ext/opcache/tests/jit/reg_alloc_002.phpt @@ -12,10 +12,10 @@ opcache.protect_memory=1 <?php class A { public function process($call) { - $i = 0; - foreach (array("a", "b", "c") as $attr) { - $call($i++, "xxx"); - } + $i = 0; + foreach (array("a", "b", "c") as $attr) { + $call($i++, "xxx"); + } } } diff --git a/ext/opcache/tests/jit/send_val_001.phpt b/ext/opcache/tests/jit/send_val_001.phpt index 1293df7dec..8220b36f1a 100644 --- a/ext/opcache/tests/jit/send_val_001.phpt +++ b/ext/opcache/tests/jit/send_val_001.phpt @@ -14,7 +14,7 @@ function foo($type) { is_array($type) ? \implode('_', $type) : $type . "ops" ); - return $key; + return $key; } var_dump(foo("int")); var_dump(foo(["int"])); diff --git a/ext/opcache/tests/jit/send_var_ex_001.phpt b/ext/opcache/tests/jit/send_var_ex_001.phpt index 2e2a19152c..176f7502f5 100644 --- a/ext/opcache/tests/jit/send_var_ex_001.phpt +++ b/ext/opcache/tests/jit/send_var_ex_001.phpt @@ -13,13 +13,13 @@ opcache.jit_buffer_size=1M namespace A; class A { - private $evalParameters; - public function evaluate() { - $this->evalParameters = array("a" => "okey"); - extract($this->evalParameters, EXTR_SKIP); - echo $a; - return false; - } + private $evalParameters; + public function evaluate() { + $this->evalParameters = array("a" => "okey"); + extract($this->evalParameters, EXTR_SKIP); + echo $a; + return false; + } } $a = new A(); diff --git a/ext/opcache/tests/jit/shift_left_001.phpt b/ext/opcache/tests/jit/shift_left_001.phpt index b0328b1765..4447d0943e 100644 --- a/ext/opcache/tests/jit/shift_left_001.phpt +++ b/ext/opcache/tests/jit/shift_left_001.phpt @@ -11,21 +11,21 @@ opcache.protect_memory=1 --FILE-- <?php function shl(int $a, int $b) { - return $a << $b; + return $a << $b; } var_dump(shl(1, 0)); var_dump(shl(1, 1)); var_dump(shl(1, 2)); var_dump(shl(-1, 2)); try { - var_dump(shl(1, 64)); + var_dump(shl(1, 64)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo "Exception " . $e->getMessage() . "\n"; } try { - var_dump(shl(1, -1)); + var_dump(shl(1, -1)); } catch (Throwable $e) { - echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; + echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/opcache/tests/jit/shift_left_002.phpt b/ext/opcache/tests/jit/shift_left_002.phpt index 4b617530c5..a6478373b9 100644 --- a/ext/opcache/tests/jit/shift_left_002.phpt +++ b/ext/opcache/tests/jit/shift_left_002.phpt @@ -11,33 +11,33 @@ opcache.protect_memory=1 --FILE-- <?php function shl0(int $a) { - return $a << 0; + return $a << 0; } function shl1(int $a) { - return $a << 1; + return $a << 1; } function shl2(int $a) { - return $a << 2; + return $a << 2; } function shl64(int $a) { - return $a << 64; + return $a << 64; } function shlNEG(int $a) { - return $a << -1; + return $a << -1; } var_dump(shl0(1)); var_dump(shl1(1)); var_dump(shl2(1)); var_dump(shl2(-1)); try { - var_dump(shl64(1)); + var_dump(shl64(1)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo "Exception " . $e->getMessage() . "\n"; } try { - var_dump(shlNEG(1)); + var_dump(shlNEG(1)); } catch (Throwable $e) { - echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; + echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/opcache/tests/jit/shift_right_001.phpt b/ext/opcache/tests/jit/shift_right_001.phpt index 9a5f2eb6d5..01a547b9ea 100644 --- a/ext/opcache/tests/jit/shift_right_001.phpt +++ b/ext/opcache/tests/jit/shift_right_001.phpt @@ -11,26 +11,26 @@ opcache.protect_memory=1 --FILE-- <?php function shr(int $a, int $b) { - return $a >> $b; + return $a >> $b; } var_dump(shr(256, 0)); var_dump(shr(256, 1)); var_dump(shr(256, 2)); var_dump(shr(-8, 2)); try { - var_dump(shr(1, 64)); + var_dump(shr(1, 64)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo "Exception " . $e->getMessage() . "\n"; } try { - var_dump(shr(-1, 64)); + var_dump(shr(-1, 64)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo "Exception " . $e->getMessage() . "\n"; } try { - var_dump(shr(1, -1)); + var_dump(shr(1, -1)); } catch (Throwable $e) { - echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; + echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/opcache/tests/jit/shift_right_002.phpt b/ext/opcache/tests/jit/shift_right_002.phpt index 1fea4e1c4b..3d86a08116 100644 --- a/ext/opcache/tests/jit/shift_right_002.phpt +++ b/ext/opcache/tests/jit/shift_right_002.phpt @@ -11,38 +11,38 @@ opcache.protect_memory=1 --FILE-- <?php function shr0(int $a) { - return $a >> 0; + return $a >> 0; } function shr1(int $a) { - return $a >> 1; + return $a >> 1; } function shr2(int $a) { - return $a >> 2; + return $a >> 2; } function shr64(int $a) { - return $a >> 64; + return $a >> 64; } function shrNEG(int $a) { - return $a >> -1; + return $a >> -1; } var_dump(shr0(256)); var_dump(shr1(256)); var_dump(shr2(256)); var_dump(shr2(-8)); try { - var_dump(shr64(1)); + var_dump(shr64(1)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo "Exception " . $e->getMessage() . "\n"; } try { - var_dump(shr64(-1)); + var_dump(shr64(-1)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo "Exception " . $e->getMessage() . "\n"; } try { - var_dump(shrNEG(1)); + var_dump(shrNEG(1)); } catch (Throwable $e) { - echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; + echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/opcache/tests/jit/type_check_001.phpt b/ext/opcache/tests/jit/type_check_001.phpt index c8ef2cf08b..6573f0ebdc 100644 --- a/ext/opcache/tests/jit/type_check_001.phpt +++ b/ext/opcache/tests/jit/type_check_001.phpt @@ -10,15 +10,15 @@ opcache.jit_buffer_size=1M --FILE-- <?php set_error_handler(function($no, $msg) { - throw new Exception($msg); + throw new Exception($msg); }); try { - if (!is_scalar($a)) { - undefined_function('Null'); - } + if (!is_scalar($a)) { + undefined_function('Null'); + } } catch (Exception $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/opcache/tests/jit/unreachable_block.phpt b/ext/opcache/tests/jit/unreachable_block.phpt index d452484a3f..cf60efaef3 100644 --- a/ext/opcache/tests/jit/unreachable_block.phpt +++ b/ext/opcache/tests/jit/unreachable_block.phpt @@ -15,7 +15,7 @@ class A { { switch ($this->returnType) { case 'float': return $this->returnTypeNullable ? null : 0; - default: return; + default: return; } } } diff --git a/ext/opcache/tests/opt/block_pass_002.phpt b/ext/opcache/tests/opt/block_pass_002.phpt index ef7bf479c5..38722ea49b 100644 --- a/ext/opcache/tests/opt/block_pass_002.phpt +++ b/ext/opcache/tests/opt/block_pass_002.phpt @@ -9,9 +9,9 @@ opcache.optimization_level=-1 --FILE-- <?php function foo($key, $value, array $attributes) { - return is_array($value) - ? [$key, array_merge($value, $attributes)] - : [$value, $attributes]; + return is_array($value) + ? [$key, array_merge($value, $attributes)] + : [$value, $attributes]; } ?> OK diff --git a/ext/opcache/tests/opt/dce_001.phpt b/ext/opcache/tests/opt/dce_001.phpt index 1afc3eba06..77a3da6809 100644 --- a/ext/opcache/tests/opt/dce_001.phpt +++ b/ext/opcache/tests/opt/dce_001.phpt @@ -11,9 +11,9 @@ opcache.preload= --FILE-- <?php function foo(string $s1, string $s2, string $s3, string $s4) { - $x = ($s1 . $s2) . ($s3 . $s4); - $x = 0; - return $x; + $x = ($s1 . $s2) . ($s3 . $s4); + $x = 0; + return $x; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/dce_002.phpt b/ext/opcache/tests/opt/dce_002.phpt index fb1c070b35..002ada627d 100644 --- a/ext/opcache/tests/opt/dce_002.phpt +++ b/ext/opcache/tests/opt/dce_002.phpt @@ -11,12 +11,12 @@ opcache.preload= --FILE-- <?php function foo(int $a) { - $a = 10; - $b = 20; - $x = func_get_args(); - $a = 30; - $b = 40; - return $x; + $a = 10; + $b = 20; + $x = func_get_args(); + $a = 30; + $b = 40; + return $x; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/dce_003.phpt b/ext/opcache/tests/opt/dce_003.phpt index 0de39c042c..a60e982b95 100644 --- a/ext/opcache/tests/opt/dce_003.phpt +++ b/ext/opcache/tests/opt/dce_003.phpt @@ -11,8 +11,8 @@ opcache.preload= --FILE-- <?php function foo(int $a) { - $b = $a += 3; - return $a; + $b = $a += 3; + return $a; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/dce_004.phpt b/ext/opcache/tests/opt/dce_004.phpt index 90bfc52d97..d595c17acb 100644 --- a/ext/opcache/tests/opt/dce_004.phpt +++ b/ext/opcache/tests/opt/dce_004.phpt @@ -11,10 +11,10 @@ opcache.preload= --FILE-- <?php function foo(int $x, int $y) { - $a = [$x]; - $a[1] = $y; - $a = $y; - return $a; + $a = [$x]; + $a[1] = $y; + $a = $y; + return $a; } --EXPECTF-- $_main: ; (lines=1, args=0, vars=0, tmps=0) diff --git a/ext/opcache/tests/opt/dce_005.phpt b/ext/opcache/tests/opt/dce_005.phpt index 3888ccd53f..294cf92b33 100644 --- a/ext/opcache/tests/opt/dce_005.phpt +++ b/ext/opcache/tests/opt/dce_005.phpt @@ -13,8 +13,8 @@ opcache.preload= class A { } function foo(int $x) { - $a = new A; - $a->foo = $x; + $a = new A; + $a->foo = $x; } --EXPECTF-- $_main: ; (lines=1, args=0, vars=0, tmps=0) diff --git a/ext/opcache/tests/opt/dce_006.phpt b/ext/opcache/tests/opt/dce_006.phpt index c84805247a..c595f9088d 100644 --- a/ext/opcache/tests/opt/dce_006.phpt +++ b/ext/opcache/tests/opt/dce_006.phpt @@ -11,11 +11,11 @@ opcache.preload= --FILE-- <?php class A { - function __destruct() {} + function __destruct() {} } function foo(int $x) { - $a = new A; - $a->foo = $x; + $a = new A; + $a->foo = $x; } --EXPECTF-- $_main: ; (lines=1, args=0, vars=0, tmps=0) diff --git a/ext/opcache/tests/opt/sccp_001.phpt b/ext/opcache/tests/opt/sccp_001.phpt index 1f67f985e3..d7cb8c700a 100644 --- a/ext/opcache/tests/opt/sccp_001.phpt +++ b/ext/opcache/tests/opt/sccp_001.phpt @@ -11,10 +11,10 @@ opcache.preload= --FILE-- <?php function foo() { - $a = 1; - $b = $a + 2; - $a += $b; - return $a; + $a = 1; + $b = $a + 2; + $a += $b; + return $a; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_002.phpt b/ext/opcache/tests/opt/sccp_002.phpt index fd2b373d73..ff00281a03 100644 --- a/ext/opcache/tests/opt/sccp_002.phpt +++ b/ext/opcache/tests/opt/sccp_002.phpt @@ -11,15 +11,15 @@ opcache.preload= --FILE-- <?php function foo(int $x) { - $a = [$x]; - $i = 1; - $c = $i < 2; - if ($c) { - $k = 2 * $i; - $a[$k] = $i; - echo $a[$k]; - } - echo $a[2]; + $a = [$x]; + $i = 1; + $c = $i < 2; + if ($c) { + $k = 2 * $i; + $a[$k] = $i; + echo $a[$k]; + } + echo $a[2]; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_003.phpt b/ext/opcache/tests/opt/sccp_003.phpt index 50ed9eb759..a0ac2e0236 100644 --- a/ext/opcache/tests/opt/sccp_003.phpt +++ b/ext/opcache/tests/opt/sccp_003.phpt @@ -11,15 +11,15 @@ opcache.preload= --FILE-- <?php function foo() { - $a = [1,2,3]; - $i = 1; - $c = $i < 2; - if ($c) { - $k = 2 * $i; - $a[$k] = $i; - echo $a[$k]; - } - echo $a[2]; + $a = [1,2,3]; + $i = 1; + $c = $i < 2; + if ($c) { + $k = 2 * $i; + $a[$k] = $i; + echo $a[$k]; + } + echo $a[2]; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_004.phpt b/ext/opcache/tests/opt/sccp_004.phpt index 495499f884..659e3488c1 100644 --- a/ext/opcache/tests/opt/sccp_004.phpt +++ b/ext/opcache/tests/opt/sccp_004.phpt @@ -11,18 +11,18 @@ opcache.preload= --FILE-- <?php function foo(int $x) { - $a = [1,2,3]; - $a[2] = $x; - $i = 1; - $c = $i < 2; - if ($c) { - $k = 2 * $i; - $a[$k] = $i; + $a = [1,2,3]; + $a[2] = $x; + $i = 1; + $c = $i < 2; + if ($c) { + $k = 2 * $i; + $a[$k] = $i; // $a[$k]++; - echo isset($a[$k]); + echo isset($a[$k]); // $a[$k] += 5; - } - echo $a[2]; + } + echo $a[2]; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_005.phpt b/ext/opcache/tests/opt/sccp_005.phpt index 1ff0d4e4ae..4fb86eacc0 100644 --- a/ext/opcache/tests/opt/sccp_005.phpt +++ b/ext/opcache/tests/opt/sccp_005.phpt @@ -11,8 +11,8 @@ opcache.preload= --FILE-- <?php function foo(int $x) { - $a = [1,2,$x]; - echo $a[1]; + $a = [1,2,$x]; + echo $a[1]; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_006.phpt b/ext/opcache/tests/opt/sccp_006.phpt index 60fa5f2f01..bc24ebbfb2 100644 --- a/ext/opcache/tests/opt/sccp_006.phpt +++ b/ext/opcache/tests/opt/sccp_006.phpt @@ -11,8 +11,8 @@ opcache.preload= --FILE-- <?php function foo(int $x) { - $a = ["a"=>1,"a"=>2,"a"=>$x]; - echo $a["a"]; + $a = ["a"=>1,"a"=>2,"a"=>$x]; + echo $a["a"]; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_007.phpt b/ext/opcache/tests/opt/sccp_007.phpt index c502a5c6be..44ff01e640 100644 --- a/ext/opcache/tests/opt/sccp_007.phpt +++ b/ext/opcache/tests/opt/sccp_007.phpt @@ -11,12 +11,12 @@ opcache.preload= --FILE-- <?php function foo(int $x) { - if ($x) { - $a = [0,1]; - } else { - $a = [0,2]; - } - echo $a[0]; + if ($x) { + $a = [0,1]; + } else { + $a = [0,2]; + } + echo $a[0]; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_008.phpt b/ext/opcache/tests/opt/sccp_008.phpt index d652964a66..a5ba8a7d22 100644 --- a/ext/opcache/tests/opt/sccp_008.phpt +++ b/ext/opcache/tests/opt/sccp_008.phpt @@ -11,12 +11,12 @@ opcache.preload= --FILE-- <?php function foo(int $x) { - if ($x) { - $a = [0,1]; - } else { - $a = [0,2]; - } - echo $a[1]; + if ($x) { + $a = [0,1]; + } else { + $a = [0,2]; + } + echo $a[1]; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_009.phpt b/ext/opcache/tests/opt/sccp_009.phpt index 47612cdb29..601586fd64 100644 --- a/ext/opcache/tests/opt/sccp_009.phpt +++ b/ext/opcache/tests/opt/sccp_009.phpt @@ -11,9 +11,9 @@ opcache.preload= --FILE-- <?php function foo(int $x) { - $a[0] = $x; - $a[1] = 2; - echo $a[1]; + $a[0] = $x; + $a[1] = 2; + echo $a[1]; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_010.phpt b/ext/opcache/tests/opt/sccp_010.phpt index a2e9945c7f..8943b179e3 100644 --- a/ext/opcache/tests/opt/sccp_010.phpt +++ b/ext/opcache/tests/opt/sccp_010.phpt @@ -13,14 +13,14 @@ opcache.preload= function foo() { $o = new stdClass(); $o->foo = 0; - $i = 1; - $c = $i < 2; - if ($c) { - $k = 2 * $i; - $o->foo = $i; - echo $o->foo; - } - echo $o->foo; + $i = 1; + $c = $i < 2; + if ($c) { + $k = 2 * $i; + $o->foo = $i; + echo $o->foo; + } + echo $o->foo; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_011.phpt b/ext/opcache/tests/opt/sccp_011.phpt index adb2c0a363..4bd90b18e6 100644 --- a/ext/opcache/tests/opt/sccp_011.phpt +++ b/ext/opcache/tests/opt/sccp_011.phpt @@ -11,15 +11,15 @@ opcache.preload= --FILE-- <?php function foo(int $x) { - $o = new stdClass; - if ($x) { - $o->foo = 0; - $o->bar = 1; - } else { - $o->foo = 0; - $o->bar = 2; - } - echo $o->foo; + $o = new stdClass; + if ($x) { + $o->foo = 0; + $o->bar = 1; + } else { + $o->foo = 0; + $o->bar = 2; + } + echo $o->foo; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_012.phpt b/ext/opcache/tests/opt/sccp_012.phpt index 0e3b872e0c..1ad1ed3b4c 100644 --- a/ext/opcache/tests/opt/sccp_012.phpt +++ b/ext/opcache/tests/opt/sccp_012.phpt @@ -13,16 +13,16 @@ opcache.preload= function foo() { $o = new stdClass(); $o->foo = 0; - $i = 1; - $c = $i < 2; - if ($c) { - $k = 2 * $i; - $o->foo = $i; - echo $o->foo; - } - $o->foo += 2; - $o->foo++; - echo $o->foo; + $i = 1; + $c = $i < 2; + if ($c) { + $k = 2 * $i; + $o->foo = $i; + echo $o->foo; + } + $o->foo += 2; + $o->foo++; + echo $o->foo; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_013.phpt b/ext/opcache/tests/opt/sccp_013.phpt index 18b57a4185..1ed9c7703b 100644 --- a/ext/opcache/tests/opt/sccp_013.phpt +++ b/ext/opcache/tests/opt/sccp_013.phpt @@ -9,11 +9,11 @@ opcache.optimization_level=-1 --FILE-- <?php function loadEntities($entity_information) { - $entity_types = []; - foreach ($entity_information as $info) { - $entity_types[$info] = 1; - } - var_dump((bool)($entity_types[$info])); + $entity_types = []; + foreach ($entity_information as $info) { + $entity_types[$info] = 1; + } + var_dump((bool)($entity_types[$info])); } loadEntities(array("first", "second")); diff --git a/ext/opcache/tests/opt/sccp_014.phpt b/ext/opcache/tests/opt/sccp_014.phpt index 2898239e7c..81f21a4ab0 100644 --- a/ext/opcache/tests/opt/sccp_014.phpt +++ b/ext/opcache/tests/opt/sccp_014.phpt @@ -9,12 +9,12 @@ opcache.optimization_level=-1 --FILE-- <?php function loadEntities($entity_information) { - $entity_types = new StdClass(); - $entity_types->a = 1; - foreach ($entity_information as $info) { - $entity_types->a = 0; - } - var_dump((bool)($entity_types->a)); + $entity_types = new StdClass(); + $entity_types->a = 1; + foreach ($entity_information as $info) { + $entity_types->a = 0; + } + var_dump((bool)($entity_types->a)); } loadEntities(array("first", "second")); diff --git a/ext/opcache/tests/opt/sccp_015.phpt b/ext/opcache/tests/opt/sccp_015.phpt index b31f4edc15..d11bd6c9e0 100644 --- a/ext/opcache/tests/opt/sccp_015.phpt +++ b/ext/opcache/tests/opt/sccp_015.phpt @@ -9,14 +9,14 @@ opcache.optimization_level=-1 --FILE-- <?php function loadEntities($entity_information) { - $entity_types = new StdClass(); - $entity_types->b = 0; - foreach ($entity_information as $ex) { - var_dump((bool)$entity_types->b); - foreach ($entity_information as $info) { - $entity_types->b = 1; - } - } + $entity_types = new StdClass(); + $entity_types->b = 0; + foreach ($entity_information as $ex) { + var_dump((bool)$entity_types->b); + foreach ($entity_information as $info) { + $entity_types->b = 1; + } + } } loadEntities(array("first", "second")); diff --git a/ext/opcache/tests/opt/sccp_017.phpt b/ext/opcache/tests/opt/sccp_017.phpt index 6e05163b7c..e72d892bdc 100644 --- a/ext/opcache/tests/opt/sccp_017.phpt +++ b/ext/opcache/tests/opt/sccp_017.phpt @@ -11,11 +11,11 @@ opcache.preload= --FILE-- <?php function foo(int $x) { - $a[0] = 5; - $a[1] = $x; - $b = $a; - $b[0] = 42; - return $a[0]; + $a[0] = 5; + $a[1] = $x; + $b = $a; + $b[0] = 42; + return $a[0]; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_018.phpt b/ext/opcache/tests/opt/sccp_018.phpt index dd1407dcec..e7a78ef50d 100644 --- a/ext/opcache/tests/opt/sccp_018.phpt +++ b/ext/opcache/tests/opt/sccp_018.phpt @@ -10,12 +10,12 @@ opcache.optimization_level=-1 --FILE-- <?php function foo() { - $a = new stdClass; - $b = $a; - $a->x = 5; - $b->x = 42; - echo $a->x; - echo "\n"; + $a = new stdClass; + $b = $a; + $a->x = 5; + $b->x = 42; + echo $a->x; + echo "\n"; } foo(); ?> diff --git a/ext/opcache/tests/opt/sccp_019.phpt b/ext/opcache/tests/opt/sccp_019.phpt index 1f7cba7fad..3ed2d6bd81 100644 --- a/ext/opcache/tests/opt/sccp_019.phpt +++ b/ext/opcache/tests/opt/sccp_019.phpt @@ -11,10 +11,10 @@ opcache.preload= --FILE-- <?php function foo(int $x) { - $a[0] = 5; - $a[1] = $x; - $b = $a; - return $b[0]; + $a[0] = 5; + $a[1] = $x; + $b = $a; + return $b[0]; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_020.phpt b/ext/opcache/tests/opt/sccp_020.phpt index b3aa82bff5..be972f4fdf 100644 --- a/ext/opcache/tests/opt/sccp_020.phpt +++ b/ext/opcache/tests/opt/sccp_020.phpt @@ -10,11 +10,11 @@ opcache.optimization_level=-1 --FILE-- <?php function foo() { - $b = $a = new stdClass; - $a->x = 5; - $b->x = 42; - echo $a->x; - echo "\n"; + $b = $a = new stdClass; + $a->x = 5; + $b->x = 42; + echo $a->x; + echo "\n"; } foo(); ?> diff --git a/ext/opcache/tests/opt/sccp_021.phpt b/ext/opcache/tests/opt/sccp_021.phpt index 327cbc9a91..1eb8de4516 100644 --- a/ext/opcache/tests/opt/sccp_021.phpt +++ b/ext/opcache/tests/opt/sccp_021.phpt @@ -10,19 +10,19 @@ opcache.optimization_level=-1 --FILE-- <?php class A { - public function memleak($num_tokens) { - $queries = array(); - for ( $i = 0; $i < $num_tokens; ++$i ) { - if ( 0 < $i ) - $queries[$i] = $queries[$i - 1] . '&'; - else - $queries[$i] = ''; + public function memleak($num_tokens) { + $queries = array(); + for ( $i = 0; $i < $num_tokens; ++$i ) { + if ( 0 < $i ) + $queries[$i] = $queries[$i - 1] . '&'; + else + $queries[$i] = ''; - $queries[$i] .= $query_token; - } + $queries[$i] .= $query_token; + } - return; - } + return; + } } ?> okey diff --git a/ext/opcache/tests/opt/sccp_022.phpt b/ext/opcache/tests/opt/sccp_022.phpt index 6a6bfbfec9..000b1ab8b3 100644 --- a/ext/opcache/tests/opt/sccp_022.phpt +++ b/ext/opcache/tests/opt/sccp_022.phpt @@ -11,11 +11,11 @@ opcache.preload= --FILE-- <?php function foo(int $x) { - $a[0] = $x; - $a[1] = 5; - echo $a[1]; - $a->foo = 5; - echo $a[1]; + $a[0] = $x; + $a[1] = 5; + echo $a[1]; + $a->foo = 5; + echo $a[1]; } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_023.phpt b/ext/opcache/tests/opt/sccp_023.phpt index d327d6279e..efa7d6b013 100644 --- a/ext/opcache/tests/opt/sccp_023.phpt +++ b/ext/opcache/tests/opt/sccp_023.phpt @@ -10,13 +10,13 @@ opcache.opt_debug_level=0 --FILE-- <?php function a ($field_type, $allowed_values) { - $settings = [ - 'list_string' => [ - 'allowed_values' => $allowed_values, - ], - ]; + $settings = [ + 'list_string' => [ + 'allowed_values' => $allowed_values, + ], + ]; - return $settings[$field_type]; + return $settings[$field_type]; } var_dump(a("list_string", ["xxx"])); diff --git a/ext/opcache/tests/opt/sccp_024.phpt b/ext/opcache/tests/opt/sccp_024.phpt index e6e2e311ef..bd9a2fed67 100644 --- a/ext/opcache/tests/opt/sccp_024.phpt +++ b/ext/opcache/tests/opt/sccp_024.phpt @@ -11,14 +11,14 @@ opcache.preload= --FILE-- <?php class A { - function t($obj) { - $a = "A"; + function t($obj) { + $a = "A"; $b = "self"; $c = 1; echo ($obj instanceof $a); echo ($obj instanceof $b); echo ($obj instanceof $c); - } + } } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_025.phpt b/ext/opcache/tests/opt/sccp_025.phpt index 8f46dab830..f78e8822d7 100644 --- a/ext/opcache/tests/opt/sccp_025.phpt +++ b/ext/opcache/tests/opt/sccp_025.phpt @@ -11,31 +11,31 @@ opcache.opt_debug_level=0 <?php function test($phpEx) { - $expected_data_sets = array( - 1 => array( - 'id' => 1, - ), - 6 => array( - 'viewtopic' => strval("phpBB/viewtopic.$phpEx"), + $expected_data_sets = array( + 1 => array( + 'id' => 1, + ), + 6 => array( + 'viewtopic' => strval("phpBB/viewtopic.$phpEx"), - ), - ); + ), + ); - $test_cases = array( - array( - 'expected' => array(6), - ), - ); + $test_cases = array( + array( + 'expected' => array(6), + ), + ); - foreach ($test_cases as $case => $case_data) - { - foreach ($case_data['expected'] as $data_set => $expected) - { - $test_cases[$case]['expected'][$data_set] = $expected_data_sets[$expected]; - } - } + foreach ($test_cases as $case => $case_data) + { + foreach ($case_data['expected'] as $data_set => $expected) + { + $test_cases[$case]['expected'][$data_set] = $expected_data_sets[$expected]; + } + } - return $test_cases; + return $test_cases; } var_dump(test("xxx")); ?> diff --git a/ext/opcache/tests/opt/sccp_026.phpt b/ext/opcache/tests/opt/sccp_026.phpt index 132c9ddef3..6f02a57a5a 100644 --- a/ext/opcache/tests/opt/sccp_026.phpt +++ b/ext/opcache/tests/opt/sccp_026.phpt @@ -15,7 +15,7 @@ function test($var) { return; } - var_dump($username); + var_dump($username); } ?> --EXPECTF-- diff --git a/ext/opcache/tests/opt/sccp_027.phpt b/ext/opcache/tests/opt/sccp_027.phpt index 38189592b0..5c13111d1c 100644 --- a/ext/opcache/tests/opt/sccp_027.phpt +++ b/ext/opcache/tests/opt/sccp_027.phpt @@ -10,15 +10,15 @@ opcache.preload= --FILE-- <?php class Foo { - protected $arr; - public function init($a) { - $this->arr =& $a; - if (isset($a[0])) { - return 1; - } else { - return 2; - } - } + protected $arr; + public function init($a) { + $this->arr =& $a; + if (isset($a[0])) { + return 1; + } else { + return 2; + } + } } $x = new Foo(); var_dump($x->init([1])); diff --git a/ext/opcache/tests/opt/sccp_029.phpt b/ext/opcache/tests/opt/sccp_029.phpt index 3a16477711..99459f74af 100644 --- a/ext/opcache/tests/opt/sccp_029.phpt +++ b/ext/opcache/tests/opt/sccp_029.phpt @@ -10,7 +10,7 @@ opcache.preload= --FILE-- <?php -class Test { +class Test { public string $x = "x"; } function test() { diff --git a/ext/opcache/tests/opt/sccp_031.phpt b/ext/opcache/tests/opt/sccp_031.phpt index 0f4ff184bd..b787e7c979 100644 --- a/ext/opcache/tests/opt/sccp_031.phpt +++ b/ext/opcache/tests/opt/sccp_031.phpt @@ -11,14 +11,14 @@ opcache.preload= --FILE-- <?php function foo() { - $k = 0; - $a = [null]; - echo isset($a[$k]); - echo "b"; - echo isset($a[$k+1]); - echo "c"; - echo $a[$k]; - echo $a; // Should not be optimized + $k = 0; + $a = [null]; + echo isset($a[$k]); + echo "b"; + echo isset($a[$k+1]); + echo "c"; + echo $a[$k]; + echo $a; // Should not be optimized } ?> --EXPECTF-- diff --git a/ext/opcache/tests/optimize_func_calls.phpt b/ext/opcache/tests/optimize_func_calls.phpt index eb1a6b38b4..3e2a8dd8f4 100644 --- a/ext/opcache/tests/optimize_func_calls.phpt +++ b/ext/opcache/tests/optimize_func_calls.phpt @@ -10,14 +10,14 @@ opcache.optimization_level=-1 <?php class A { - public $obj; - public function test($a) { - } + public $obj; + public function test($a) { + } } function a(&$b) { - $b = "changed"; - return "done"; + $b = "changed"; + return "done"; } $a = "a"; @@ -78,16 +78,16 @@ var_dump($b); ref("xxx"); function retarray() { - return array("retarray"); + return array("retarray"); } function foo($a) { - print_r(func_get_args()); + print_r(func_get_args()); } function ref(&$b) { - $b = "changed"; - return "ref"; + $b = "changed"; + return "ref"; } --EXPECTF-- Array diff --git a/ext/opcache/tests/optimize_static_001.phpt b/ext/opcache/tests/optimize_static_001.phpt index 8279ecacf5..aac2d71907 100644 --- a/ext/opcache/tests/optimize_static_001.phpt +++ b/ext/opcache/tests/optimize_static_001.phpt @@ -9,12 +9,12 @@ opcache.optimization_level=-1 --FILE-- <?php function foo() { - static $a = UNDEFINED_CONST; + static $a = UNDEFINED_CONST; } try { - foo(); + foo(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } ?> OK diff --git a/ext/opcache/tests/phi_remove_001.phpt b/ext/opcache/tests/phi_remove_001.phpt index 3a76a9da5c..d8c1a64eec 100644 --- a/ext/opcache/tests/phi_remove_001.phpt +++ b/ext/opcache/tests/phi_remove_001.phpt @@ -9,58 +9,58 @@ opcache.optimization_level=-1 --FILE-- <?php function getOnlyMPEGaudioInfoBruteForce($info) { - $Distribution['bitrate'] = array(); - $Distribution['frequency'] = array(); - $Distribution['layer'] = array(); - $Distribution['version'] = array(); - $Distribution['padding'] = array(); + $Distribution['bitrate'] = array(); + $Distribution['frequency'] = array(); + $Distribution['layer'] = array(); + $Distribution['version'] = array(); + $Distribution['padding'] = array(); - $max_frames_scan = 5000; - $frames_scanned = 0; + $max_frames_scan = 5000; + $frames_scanned = 0; - $previousvalidframe = $info['avdataoffset']; - while ($info) { - if (!isset($MPEGaudioHeaderDecodeCache[$head4])) { - $MPEGaudioHeaderDecodeCache[$head4] = MPEGaudioHeaderDecode($head4); - } - if (!isset($MPEGaudioHeaderValidCache[$head4])) { - $MPEGaudioHeaderValidCache[$head4] = MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false); - } - if ($MPEGaudioHeaderValidCache[$head4]) { + $previousvalidframe = $info['avdataoffset']; + while ($info) { + if (!isset($MPEGaudioHeaderDecodeCache[$head4])) { + $MPEGaudioHeaderDecodeCache[$head4] = MPEGaudioHeaderDecode($head4); + } + if (!isset($MPEGaudioHeaderValidCache[$head4])) { + $MPEGaudioHeaderValidCache[$head4] = MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false); + } + if ($MPEGaudioHeaderValidCache[$head4]) { - if ($MPEGaudioHeaderLengthCache[$head4] > 4) { - $WhereWeWere = mftell(); - $next4 = test(4); - if ($next4[0] == "\xFF") { - if (!isset($MPEGaudioHeaderDecodeCache[$next4])) { - $MPEGaudioHeaderDecodeCache[$next4] = MPEGaudioHeaderDecode($next4); - } - if (!isset($MPEGaudioHeaderValidCache[$next4])) { - $MPEGaudioHeaderValidCache[$next4] = MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false); - } - if ($MPEGaudioHeaderValidCache[$next4]) { - getid3_lib::safe_inc($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]); - getid3_lib::safe_inc($Distribution['layer'][$LongMPEGlayerLookup[$head4]]); - getid3_lib::safe_inc($Distribution['version'][$LongMPEGversionLookup[$head4]]); - getid3_lib::safe_inc($Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]); - getid3_lib::safe_inc($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]); - if ($max_frames_scan && (++$frames_scanned >= $max_frames_scan)) { - foreach ($Distribution as $key1 => $value1) { - foreach ($value1 as $key2 => $value2) { - $Distribution[$key1][$key2] = round($value2 / $pct_data_scanned); - } - } - break; - } - continue; - } - } - unset($next4); - } + if ($MPEGaudioHeaderLengthCache[$head4] > 4) { + $WhereWeWere = mftell(); + $next4 = test(4); + if ($next4[0] == "\xFF") { + if (!isset($MPEGaudioHeaderDecodeCache[$next4])) { + $MPEGaudioHeaderDecodeCache[$next4] = MPEGaudioHeaderDecode($next4); + } + if (!isset($MPEGaudioHeaderValidCache[$next4])) { + $MPEGaudioHeaderValidCache[$next4] = MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false); + } + if ($MPEGaudioHeaderValidCache[$next4]) { + getid3_lib::safe_inc($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]); + getid3_lib::safe_inc($Distribution['layer'][$LongMPEGlayerLookup[$head4]]); + getid3_lib::safe_inc($Distribution['version'][$LongMPEGversionLookup[$head4]]); + getid3_lib::safe_inc($Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]); + getid3_lib::safe_inc($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]); + if ($max_frames_scan && (++$frames_scanned >= $max_frames_scan)) { + foreach ($Distribution as $key1 => $value1) { + foreach ($value1 as $key2 => $value2) { + $Distribution[$key1][$key2] = round($value2 / $pct_data_scanned); + } + } + break; + } + continue; + } + } + unset($next4); + } - } - } - return true; + } + } + return true; } ?> okey diff --git a/ext/opcache/tests/phi_remove_002.phpt b/ext/opcache/tests/phi_remove_002.phpt index 3b0c429d50..7e8b64bdf3 100644 --- a/ext/opcache/tests/phi_remove_002.phpt +++ b/ext/opcache/tests/phi_remove_002.phpt @@ -9,13 +9,13 @@ opcache.optimization_level=-1 --FILE-- <?php function func($blogname, $user = '' ) { - if (! is_object( $user ) || ( is_object($user) && ( $user->login != $blogname )) ) { - test(); - } + if (! is_object( $user ) || ( is_object($user) && ( $user->login != $blogname )) ) { + test(); + } - $result = array('user' => $user); + $result = array('user' => $user); - return true; + return true; } ?> okey diff --git a/ext/opcache/tests/php_cli_server.inc b/ext/opcache/tests/php_cli_server.inc index e32cf9f97f..8d15b81c79 100644 --- a/ext/opcache/tests/php_cli_server.inc +++ b/ext/opcache/tests/php_cli_server.inc @@ -4,64 +4,64 @@ define ("PHP_CLI_SERVER_PORT", 8964); define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT); function php_cli_server_start($ini = "") { - $php_executable = getenv('TEST_PHP_EXECUTABLE'); - $doc_root = __DIR__; + $php_executable = getenv('TEST_PHP_EXECUTABLE'); + $doc_root = __DIR__; - $ini_array = preg_split('/\s+/', trim($ini)); - $ini_array = array_map(function($arg) { - return trim($arg, '\'"'); - }, $ini_array); - $cmd = [$php_executable, '-t', $doc_root, '-n', ...$ini_array, '-S', PHP_CLI_SERVER_ADDRESS]; - $descriptorspec = array( - 0 => STDIN, - 1 => STDOUT, - 2 => array("null"), - ); - $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root, null, array("suppress_errors" => true)); + $ini_array = preg_split('/\s+/', trim($ini)); + $ini_array = array_map(function($arg) { + return trim($arg, '\'"'); + }, $ini_array); + $cmd = [$php_executable, '-t', $doc_root, '-n', ...$ini_array, '-S', PHP_CLI_SERVER_ADDRESS]; + $descriptorspec = array( + 0 => STDIN, + 1 => STDOUT, + 2 => array("null"), + ); + $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root, null, array("suppress_errors" => true)); - // note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.' - // it might not be listening yet...need to wait until fsockopen() call returns - $error = "Unable to connect to server\n"; - for ($i=0; $i < 60; $i++) { - usleep(50000); // 50ms per try - $status = proc_get_status($handle); - $fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT); - // Failure, the server is no longer running - if (!($status && $status['running'])) { - $error = "Server is not running\n"; - break; - } - // Success, Connected to servers - if ($fp) { - $error = ''; - break; - } - } + // note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.' + // it might not be listening yet...need to wait until fsockopen() call returns + $error = "Unable to connect to server\n"; + for ($i=0; $i < 60; $i++) { + usleep(50000); // 50ms per try + $status = proc_get_status($handle); + $fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT); + // Failure, the server is no longer running + if (!($status && $status['running'])) { + $error = "Server is not running\n"; + break; + } + // Success, Connected to servers + if ($fp) { + $error = ''; + break; + } + } - if ($fp) { - fclose($fp); - } + if ($fp) { + fclose($fp); + } - if ($error) { - echo $error; - proc_terminate($handle); - exit(1); - } + if ($error) { + echo $error; + proc_terminate($handle); + exit(1); + } - register_shutdown_function( - function($handle) { - proc_terminate($handle); - /* Wait for server to shutdown */ - for ($i = 0; $i < 60; $i++) { - $status = proc_get_status($handle); - if (!($status && $status['running'])) { - break; - } - usleep(50000); - } - }, - $handle - ); + register_shutdown_function( + function($handle) { + proc_terminate($handle); + /* Wait for server to shutdown */ + for ($i = 0; $i < 60; $i++) { + $status = proc_get_status($handle); + if (!($status && $status['running'])) { + break; + } + usleep(50000); + } + }, + $handle + ); } ?> diff --git a/ext/opcache/tests/preload.inc b/ext/opcache/tests/preload.inc index 10de9390d0..52bb60e348 100644 --- a/ext/opcache/tests/preload.inc +++ b/ext/opcache/tests/preload.inc @@ -3,39 +3,39 @@ function f1() { } if (isset($rt)) { - function f2() { - } + function f2() { + } } interface a { - function foo(); - function bar(); + function foo(); + function bar(); } interface b { - function foo(); + function foo(); } abstract class c { - function bar() { } + function bar() { } } class x extends c implements a, b { - function foo() { } + function foo() { } } trait T1 { - static function foo() { - var_dump(__METHOD__); - } + static function foo() { + var_dump(__METHOD__); + } } trait T2 { - use T1; - static function bar() { - var_dump(__METHOD__); - } + use T1; + static function bar() { + var_dump(__METHOD__); + } } class Y { - use T2; + use T2; } class Z { @@ -50,9 +50,9 @@ function get_anon() { } if (!isset($rt)) { - eval("class Foo {}"); + eval("class Foo {}"); - class Bar extends Foo {} + class Bar extends Foo {} - eval("function f3() {} "); + eval("function f3() {} "); } diff --git a/ext/opcache/tests/preload_bug78014.inc b/ext/opcache/tests/preload_bug78014.inc index 84cc1d90c8..9c469a72b6 100644 --- a/ext/opcache/tests/preload_bug78014.inc +++ b/ext/opcache/tests/preload_bug78014.inc @@ -1,2 +1,2 @@ -<?php +<?php opcache_compile_file(__DIR__ . "/bug78014.inc"); diff --git a/ext/opcache/tests/preload_bug78175_2.inc b/ext/opcache/tests/preload_bug78175_2.inc index a960e1b08c..cc99105457 100644 --- a/ext/opcache/tests/preload_bug78175_2.inc +++ b/ext/opcache/tests/preload_bug78175_2.inc @@ -1,18 +1,18 @@ <?php class Loader { - static private $loader; + static private $loader; - static function getLoader() { - if (null !== self::$loader) { - return self::$loader; - } - return self::$loader = new Loader(); - } + static function getLoader() { + if (null !== self::$loader) { + return self::$loader; + } + return self::$loader = new Loader(); + } - static function getCounter() { - static $counter = 0; - return $counter++; - } + static function getCounter() { + static $counter = 0; + return $counter++; + } } class ExtLoader extends Loader { diff --git a/ext/opcache/tests/preload_bug78376.inc b/ext/opcache/tests/preload_bug78376.inc index c482e0a821..87145ba3c5 100644 --- a/ext/opcache/tests/preload_bug78376.inc +++ b/ext/opcache/tests/preload_bug78376.inc @@ -1,6 +1,6 @@ <?php const CNST = 'aaaa'; class A { - public static $a = CNST; + public static $a = CNST; } $a = \A::$a; diff --git a/ext/opcache/tests/preload_bug78937.inc b/ext/opcache/tests/preload_bug78937.inc index 7da2dc3227..49acbb1a66 100644 --- a/ext/opcache/tests/preload_bug78937.inc +++ b/ext/opcache/tests/preload_bug78937.inc @@ -3,6 +3,6 @@ function foo() { return new class extends Bar {}; } function bar() { - class Foo extends Bar { - } + class Foo extends Bar { + } } diff --git a/ext/opcache/tests/preload_globals.inc b/ext/opcache/tests/preload_globals.inc index 213dc60fab..7ae442dc03 100644 --- a/ext/opcache/tests/preload_globals.inc +++ b/ext/opcache/tests/preload_globals.inc @@ -1,5 +1,5 @@ <?php function get_x() { - return $GLOBALS["x"]; + return $GLOBALS["x"]; } diff --git a/ext/opcache/tests/revalidate_path_01.phpt b/ext/opcache/tests/revalidate_path_01.phpt index e64dd44cdc..317e872a4c 100644 --- a/ext/opcache/tests/revalidate_path_01.phpt +++ b/ext/opcache/tests/revalidate_path_01.phpt @@ -23,17 +23,17 @@ $main = "$dir/main.php"; @file_put_contents($file1, "TEST 1\n"); @file_put_contents($file2, "TEST 2\n"); while (filemtime($file1) != filemtime($file2)) { - touch($file1); - touch($file2); + touch($file1); + touch($file2); } if (substr(PHP_OS, 0, 3) == 'WIN') { - @rmdir($link); - $ln = str_replace('/', '\\', $link); - $d1 = realpath($dir1); - `mklink /j $ln $d1`; + @rmdir($link); + $ln = str_replace('/', '\\', $link); + $d1 = realpath($dir1); + `mklink /j $ln $d1`; } else { - @unlink($link); - @symlink($dir1, $link); + @unlink($link); + @symlink($dir1, $link); } include "php_cli_server.inc"; @@ -42,13 +42,13 @@ php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.rev echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php'); echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php'); if (substr(PHP_OS, 0, 3) == 'WIN') { - @rmdir($link); - $ln = str_replace('/', '\\', $link); - $d2 = realpath($dir2); - `mklink /j $ln $d2`; + @rmdir($link); + $ln = str_replace('/', '\\', $link); + $d2 = realpath($dir2); + `mklink /j $ln $d2`; } else { - @unlink($link); - @symlink($dir2, $link); + @unlink($link); + @symlink($dir2, $link); } echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php'); echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php'); diff --git a/ext/opcache/tests/ssa_bug_007.phpt b/ext/opcache/tests/ssa_bug_007.phpt index e5237687b2..344a05665d 100644 --- a/ext/opcache/tests/ssa_bug_007.phpt +++ b/ext/opcache/tests/ssa_bug_007.phpt @@ -5,18 +5,18 @@ Incorrect CFG/SSA construction for SWITCH with few identical successors --FILE-- <?php function render($properties) { - foreach ($properties as $key => $value) { - switch ($key) { - case 'Trapped': - if ($value == null) { - $docInfo->$key = 1; - } - case 'CreationDate': - case 'ModDate': - $docInfo->$key = 2; - break; - } - } + foreach ($properties as $key => $value) { + switch ($key) { + case 'Trapped': + if ($value == null) { + $docInfo->$key = 1; + } + case 'CreationDate': + case 'ModDate': + $docInfo->$key = 2; + break; + } + } } ?> OK diff --git a/ext/opcache/tests/ssa_bug_011.phpt b/ext/opcache/tests/ssa_bug_011.phpt index c25e9c46ab..253bdc78d5 100644 --- a/ext/opcache/tests/ssa_bug_011.phpt +++ b/ext/opcache/tests/ssa_bug_011.phpt @@ -5,11 +5,11 @@ Wrong assertion --FILE-- <?php function foo($transitions) { - foreach ($transitions as $transition) { - if (isEmpty()) { - continue; - } - } + foreach ($transitions as $transition) { + if (isEmpty()) { + continue; + } + } } ?> OK diff --git a/ext/openssl/tests/bug28382.phpt b/ext/openssl/tests/bug28382.phpt index f64e77dbd2..3d8cb528ba 100644 --- a/ext/openssl/tests/bug28382.phpt +++ b/ext/openssl/tests/bug28382.phpt @@ -10,9 +10,9 @@ $cert = file_get_contents(__DIR__ . "/bug28382cert.txt"); $ext = openssl_x509_parse($cert); var_dump($ext['extensions']); /* openssl 1.0 prepends the string "Full Name:" to the crlDistributionPoints array key. - For now, as this is the one difference only between 0.9.x and 1.x, it's handled with - placeholders to not to duplicate the test. When more diffs come, a duplication would - be probably a better solution. + For now, as this is the one difference only between 0.9.x and 1.x, it's handled with + placeholders to not to duplicate the test. When more diffs come, a duplication would + be probably a better solution. */ ?> --EXPECTF-- diff --git a/ext/openssl/tests/bug55646.phpt b/ext/openssl/tests/bug55646.phpt index a7e4152779..9de5359008 100644 --- a/ext/openssl/tests/bug55646.phpt +++ b/ext/openssl/tests/bug55646.phpt @@ -36,7 +36,7 @@ $csr_res = openssl_csr_new( if (!$csr_res) { while ($e = openssl_error_string()) { $err = $e; - } + } die("Failed; last error: $err"); } openssl_csr_export($csr_res, $csr); diff --git a/ext/openssl/tests/bug60632.phpt b/ext/openssl/tests/bug60632.phpt index eb51276fa5..5993229a00 100644 --- a/ext/openssl/tests/bug60632.phpt +++ b/ext/openssl/tests/bug60632.phpt @@ -8,11 +8,11 @@ if (!extension_loaded("openssl")) die("skip openssl not loaded"); <?php $pkey = openssl_pkey_new(array( - 'digest_alg' => 'sha256', - 'private_key_bits' => 1024, - 'private_key_type' => OPENSSL_KEYTYPE_RSA, - 'encrypt_key' => false, - 'config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf', + 'digest_alg' => 'sha256', + 'private_key_bits' => 1024, + 'private_key_type' => OPENSSL_KEYTYPE_RSA, + 'encrypt_key' => false, + 'config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf', )); $details = openssl_pkey_get_details($pkey); $test_pubkey = $details['key']; diff --git a/ext/openssl/tests/openssl_csr_get_public_key_basic.phpt b/ext/openssl/tests/openssl_csr_get_public_key_basic.phpt index 866eeae169..185e46539e 100644 --- a/ext/openssl/tests/openssl_csr_get_public_key_basic.phpt +++ b/ext/openssl/tests/openssl_csr_get_public_key_basic.phpt @@ -13,7 +13,7 @@ $phex = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' . '6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab'; $dh_details = array('p' => $phex, 'g' => '2'); $dh = openssl_pkey_new(array( - 'dh'=> array('p' => hex2bin($phex), 'g' => '2')) + 'dh'=> array('p' => hex2bin($phex), 'g' => '2')) ); $dn = array( diff --git a/ext/openssl/tests/openssl_csr_get_subject_basic.phpt b/ext/openssl/tests/openssl_csr_get_subject_basic.phpt index 87ab824f35..8ebc51cc50 100644 --- a/ext/openssl/tests/openssl_csr_get_subject_basic.phpt +++ b/ext/openssl/tests/openssl_csr_get_subject_basic.phpt @@ -13,7 +13,7 @@ $phex = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' . '6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab'; $dh_details = array('p' => $phex, 'g' => '2'); $dh = openssl_pkey_new(array( - 'dh'=> array('p' => hex2bin($phex), 'g' => '2')) + 'dh'=> array('p' => hex2bin($phex), 'g' => '2')) ); $dn = array( diff --git a/ext/openssl/tests/openssl_decrypt_ccm.phpt b/ext/openssl/tests/openssl_decrypt_ccm.phpt index a5f01b87ce..87b6d4b264 100644 --- a/ext/openssl/tests/openssl_decrypt_ccm.phpt +++ b/ext/openssl/tests/openssl_decrypt_ccm.phpt @@ -22,13 +22,13 @@ foreach ($tests as $idx => $test) { // no IV var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA, - NULL, $test['tag'], $test['aad'])); + NULL, $test['tag'], $test['aad'])); // failed because no AAD var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA, - $test['iv'], $test['tag'])); + $test['iv'], $test['tag'])); // failed because wrong tag var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA, - $test['iv'], str_repeat('x', 10), $test['aad'])); + $test['iv'], str_repeat('x', 10), $test['aad'])); ?> --EXPECTF-- diff --git a/ext/openssl/tests/openssl_decrypt_gcm.phpt b/ext/openssl/tests/openssl_decrypt_gcm.phpt index f03c4d2468..5c243a8fad 100644 --- a/ext/openssl/tests/openssl_decrypt_gcm.phpt +++ b/ext/openssl/tests/openssl_decrypt_gcm.phpt @@ -22,13 +22,13 @@ foreach ($tests as $idx => $test) { // no IV var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA, - NULL, $test['tag'], $test['aad'])); + NULL, $test['tag'], $test['aad'])); // failed because no AAD var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA, - $test['iv'], $test['tag'])); + $test['iv'], $test['tag'])); // failed because wrong tag var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA, - $test['iv'], str_repeat('x', 16), $test['aad'])); + $test['iv'], str_repeat('x', 16), $test['aad'])); ?> --EXPECTF-- diff --git a/ext/openssl/tests/openssl_error_string_basic.phpt b/ext/openssl/tests/openssl_error_string_basic.phpt index 3e3bbd03af..12875392f4 100644 --- a/ext/openssl/tests/openssl_error_string_basic.phpt +++ b/ext/openssl/tests/openssl_error_string_basic.phpt @@ -9,15 +9,15 @@ function expect_openssl_errors($name, $expected_error_codes) { $expected_errors = array_fill_keys($expected_error_codes, false); $all_errors = array(); while (($error_string = openssl_error_string()) !== false) { - if (preg_match(",.+:([0-9A-F]+):.+,", $error_string, $m) > 0) { + if (preg_match(",.+:([0-9A-F]+):.+,", $error_string, $m) > 0) { $error_code = $m[1]; if (isset($expected_errors[$error_code])) { $expected_errors[$error_code] = true; } - $all_errors[$error_code] = $error_string; + $all_errors[$error_code] = $error_string; } else { - $all_errors[] = $error_string; - } + $all_errors[] = $error_string; + } } $fail = false; @@ -31,12 +31,12 @@ function expect_openssl_errors($name, $expected_error_codes) { if (!$fail) { echo "$name: ok\n"; } else { - echo "$name: uncaught errors\n"; - foreach ($all_errors as $code => $str) { - if (!isset($expected_errors[$code]) || !$expected_errors[$code]) { - echo "\t", $code, ": ", $str, "\n"; - } - } + echo "$name: uncaught errors\n"; + foreach ($all_errors as $code => $str) { + if (!isset($expected_errors[$code]) || !$expected_errors[$code]) { + echo "\t", $code, ": ", $str, "\n"; + } + } } } @@ -78,7 +78,7 @@ var_dump($enc_error); var_dump(openssl_error_string()); // internally OpenSSL ERR won't save more than 15 (16 - 1) errors so lets test it for ($i = 0; $i < 20; $i++) { - openssl_encrypt($data, $method, $enc_key); + openssl_encrypt($data, $method, $enc_key); } $error_queue_size = 0; while (($enc_error_new = openssl_error_string()) !== false) { diff --git a/ext/openssl/tests/openssl_pkcs7_verify_basic.phpt b/ext/openssl/tests/openssl_pkcs7_verify_basic.phpt index 699253f789..63b181e588 100644 --- a/ext/openssl/tests/openssl_pkcs7_verify_basic.phpt +++ b/ext/openssl/tests/openssl_pkcs7_verify_basic.phpt @@ -6,12 +6,12 @@ openssl_pkcs7_verify() tests <?php $outfile = tempnam(sys_get_temp_dir(), "ssl"); if ($outfile === false) { - die("failed to get a temporary filename!"); + die("failed to get a temporary filename!"); } $contentfile = tempnam(sys_get_temp_dir(), "ssl"); if ($contentfile === false) { - die("failed to get a temporary filename!"); + die("failed to get a temporary filename!"); } $pkcsfile = __DIR__ . "/openssl_pkcs7_verify__pkcsfile.tmp"; @@ -30,13 +30,13 @@ var_dump(openssl_pkcs7_verify($eml, PKCS7_NOVERIFY, $outfile, $cainfo, $outfile, var_dump(file_get_contents($pkcsfile)); if (file_exists($outfile)) { - echo "true\n"; - unlink($outfile); + echo "true\n"; + unlink($outfile); } if (file_exists($contentfile)) { - echo "true\n"; - unlink($contentfile); + echo "true\n"; + unlink($contentfile); } ?> --CLEAN-- diff --git a/ext/openssl/tests/openssl_pkey_new_basic.phpt b/ext/openssl/tests/openssl_pkey_new_basic.phpt index 41e67b2a04..b2c37f6a87 100644 --- a/ext/openssl/tests/openssl_pkey_new_basic.phpt +++ b/ext/openssl/tests/openssl_pkey_new_basic.phpt @@ -5,7 +5,7 @@ openssl_pkey_new() basic usage tests --FILE-- <?php function openssl_pkey_test_cmp($expected, $bin_key) { - var_dump(strcasecmp(ltrim($expected, '0'), bin2hex($bin_key))); + var_dump(strcasecmp(ltrim($expected, '0'), bin2hex($bin_key))); } // RSA diff --git a/ext/openssl/tests/openssl_pkey_new_error.phpt b/ext/openssl/tests/openssl_pkey_new_error.phpt index 9249f252d8..7fada8239a 100644 --- a/ext/openssl/tests/openssl_pkey_new_error.phpt +++ b/ext/openssl/tests/openssl_pkey_new_error.phpt @@ -5,7 +5,7 @@ openssl_pkey_new() error tests --FILE-- <?php /* openssl_pkey_get_details() segfaults when getting the information - from openssl_pkey_new() with an empty sub-array arg */ + from openssl_pkey_new() with an empty sub-array arg */ $rsa = array("rsa" => array()); $dsa = array("dsa" => array()); diff --git a/ext/openssl/tests/sni_server_key_cert.phpt b/ext/openssl/tests/sni_server_key_cert.phpt index 58cf3d741d..77a9d39f44 100644 --- a/ext/openssl/tests/sni_server_key_cert.phpt +++ b/ext/openssl/tests/sni_server_key_cert.phpt @@ -8,31 +8,31 @@ if (!function_exists("proc_open")) die("skip no proc_open"); --FILE-- <?php $serverCode = <<<'CODE' - $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN; - $ctx = stream_context_create(['ssl' => [ - 'local_cert' => __DIR__ . '/domain1.pem', - 'SNI_server_certs' => [ - "cs.php.net" => [ - 'local_cert' => __DIR__ . "/sni_server_cs_cert.pem", - 'local_pk' => __DIR__ . "/sni_server_cs_key.pem" - ], - "uk.php.net" => [ - 'local_cert' => __DIR__ . "/sni_server_uk_cert.pem", - 'local_pk' => __DIR__ . "/sni_server_uk_key.pem" - ], - "us.php.net" => [ - 'local_cert' => __DIR__ . "/sni_server_us_cert.pem", - 'local_pk' => __DIR__ . "/sni_server_us_key.pem" - ], - ] - ]]); + $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN; + $ctx = stream_context_create(['ssl' => [ + 'local_cert' => __DIR__ . '/domain1.pem', + 'SNI_server_certs' => [ + "cs.php.net" => [ + 'local_cert' => __DIR__ . "/sni_server_cs_cert.pem", + 'local_pk' => __DIR__ . "/sni_server_cs_key.pem" + ], + "uk.php.net" => [ + 'local_cert' => __DIR__ . "/sni_server_uk_cert.pem", + 'local_pk' => __DIR__ . "/sni_server_uk_key.pem" + ], + "us.php.net" => [ + 'local_cert' => __DIR__ . "/sni_server_us_cert.pem", + 'local_pk' => __DIR__ . "/sni_server_us_key.pem" + ], + ] + ]]); - $server = stream_socket_server('tls://127.0.0.1:64321', $errno, $errstr, $flags, $ctx); - phpt_notify(); + $server = stream_socket_server('tls://127.0.0.1:64321', $errno, $errstr, $flags, $ctx); + phpt_notify(); - for ($i=0; $i < 3; $i++) { - @stream_socket_accept($server, 3); - } + for ($i=0; $i < 3; $i++) { + @stream_socket_accept($server, 3); + } CODE; $clientCode = <<<'CODE' diff --git a/ext/openssl/tests/stream_security_level.phpt b/ext/openssl/tests/stream_security_level.phpt index b47ab97adc..ebb21c5d1a 100644 --- a/ext/openssl/tests/stream_security_level.phpt +++ b/ext/openssl/tests/stream_security_level.phpt @@ -18,33 +18,33 @@ $certFile = __DIR__ . DIRECTORY_SEPARATOR . 'stream_security_level.pem.tmp'; $cacertFile = __DIR__ . DIRECTORY_SEPARATOR . 'stream_security_level-ca.pem.tmp'; $serverCode = <<<'CODE' - $serverUri = "ssl://127.0.0.1:64322"; - $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN; - $serverCtx = stream_context_create(['ssl' => [ - 'local_cert' => '%s' - ]]); + $serverUri = "ssl://127.0.0.1:64322"; + $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN; + $serverCtx = stream_context_create(['ssl' => [ + 'local_cert' => '%s' + ]]); - $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx); - phpt_notify(); + $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx); + phpt_notify(); - @stream_socket_accept($server, 1); + @stream_socket_accept($server, 1); CODE; $serverCode = sprintf($serverCode, $certFile); $clientCode = <<<'CODE' - $serverUri = "ssl://127.0.0.1:64322"; - $clientFlags = STREAM_CLIENT_CONNECT; - $clientCtx = stream_context_create(['ssl' => [ - 'security_level' => %d, - 'verify_peer' => true, - 'cafile' => '%s', - 'verify_peer_name' => false - ]]); + $serverUri = "ssl://127.0.0.1:64322"; + $clientFlags = STREAM_CLIENT_CONNECT; + $clientCtx = stream_context_create(['ssl' => [ + 'security_level' => %d, + 'verify_peer' => true, + 'cafile' => '%s', + 'verify_peer_name' => false + ]]); - phpt_wait(); - $client = stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx); + phpt_wait(); + $client = stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx); - var_dump($client); + var_dump($client); CODE; $clientCode = sprintf($clientCode, $securityLevel, $cacertFile); diff --git a/ext/pcntl/tests/001.phpt b/ext/pcntl/tests/001.phpt index fe96d50f04..cdfdb0733f 100644 --- a/ext/pcntl/tests/001.phpt +++ b/ext/pcntl/tests/001.phpt @@ -11,60 +11,60 @@ Test pcntl wait functionality --FILE-- <?php function test_exit_waits(){ - print "\n\nTesting pcntl_wifexited and wexitstatus...."; + print "\n\nTesting pcntl_wifexited and wexitstatus...."; - $pid=pcntl_fork(); - if ($pid==0) { - sleep(1); - exit(-1); - } else { - $options=0; - pcntl_waitpid($pid, $status, $options); - if ( pcntl_wifexited($status) ) print "\nExited With: ". pcntl_wexitstatus($status); - } + $pid=pcntl_fork(); + if ($pid==0) { + sleep(1); + exit(-1); + } else { + $options=0; + pcntl_waitpid($pid, $status, $options); + if ( pcntl_wifexited($status) ) print "\nExited With: ". pcntl_wexitstatus($status); + } } function test_exit_signal(){ - print "\n\nTesting pcntl_wifsignaled...."; + print "\n\nTesting pcntl_wifsignaled...."; - $pid=pcntl_fork(); + $pid=pcntl_fork(); - if ($pid==0) { + if ($pid==0) { while(1); - exit; - } else { - $options=0; - posix_kill($pid, SIGTERM); - pcntl_waitpid($pid, $status, $options); - if ( pcntl_wifsignaled($status) ) { - $signal_print=pcntl_wtermsig($status); - if ($signal_print==SIGTERM) $signal_print="SIGTERM"; - print "\nProcess was terminated by signal : ". $signal_print; - } + exit; + } else { + $options=0; + posix_kill($pid, SIGTERM); + pcntl_waitpid($pid, $status, $options); + if ( pcntl_wifsignaled($status) ) { + $signal_print=pcntl_wtermsig($status); + if ($signal_print==SIGTERM) $signal_print="SIGTERM"; + print "\nProcess was terminated by signal : ". $signal_print; + } - } + } } function test_stop_signal(){ - print "\n\nTesting pcntl_wifstopped and pcntl_wstopsig...."; + print "\n\nTesting pcntl_wifstopped and pcntl_wstopsig...."; - $pid=pcntl_fork(); + $pid=pcntl_fork(); - if ($pid==0) { - sleep(1); - exit; - } else { - $options=WUNTRACED; - posix_kill($pid, SIGSTOP); - pcntl_waitpid($pid, $status, $options); - if ( pcntl_wifstopped($status) ) { - $signal_print=pcntl_wstopsig($status); - if ($signal_print==SIGSTOP) $signal_print="SIGSTOP"; - print "\nProcess was stopped by signal : ". $signal_print; - } - posix_kill($pid, SIGCONT); - } + if ($pid==0) { + sleep(1); + exit; + } else { + $options=WUNTRACED; + posix_kill($pid, SIGSTOP); + pcntl_waitpid($pid, $status, $options); + if ( pcntl_wifstopped($status) ) { + $signal_print=pcntl_wstopsig($status); + if ($signal_print==SIGSTOP) $signal_print="SIGSTOP"; + print "\nProcess was stopped by signal : ". $signal_print; + } + posix_kill($pid, SIGCONT); + } } print "Staring wait.h tests...."; diff --git a/ext/pcntl/tests/002.phpt b/ext/pcntl/tests/002.phpt index 7d40735ae5..f93039f412 100644 --- a/ext/pcntl/tests/002.phpt +++ b/ext/pcntl/tests/002.phpt @@ -13,64 +13,64 @@ pcntl: pcntl_sigprocmask(), pcntl_sigwaitinfo(), pcntl_sigtimedwait() $pid = pcntl_fork(); if ($pid == -1) { - die('failed'); + die('failed'); } else if ($pid) { - pcntl_sigprocmask(SIG_BLOCK, array(SIGCHLD,(string)SIGTERM)); - $oldset = array(); - pcntl_sigprocmask(SIG_BLOCK, array(), $oldset); - var_dump(in_array(SIGCHLD, $oldset)); - var_dump(in_array(SIGTERM, $oldset)); + pcntl_sigprocmask(SIG_BLOCK, array(SIGCHLD,(string)SIGTERM)); + $oldset = array(); + pcntl_sigprocmask(SIG_BLOCK, array(), $oldset); + var_dump(in_array(SIGCHLD, $oldset)); + var_dump(in_array(SIGTERM, $oldset)); - posix_kill(posix_getpid(), SIGTERM); - $signo = pcntl_sigwaitinfo(array(SIGTERM), $siginfo); - echo "signo == SIGTERM\n"; - var_dump($signo === SIGTERM && $signo === $siginfo['signo']); - echo "code === SI_USER || SI_NOINFO\n"; - if (defined('SI_NOINFO')) { - var_dump(($siginfo['code'] === SI_USER) || ($siginfo['code'] === SI_NOINFO)); - } else { - var_dump($siginfo['code'] === SI_USER); - } + posix_kill(posix_getpid(), SIGTERM); + $signo = pcntl_sigwaitinfo(array(SIGTERM), $siginfo); + echo "signo == SIGTERM\n"; + var_dump($signo === SIGTERM && $signo === $siginfo['signo']); + echo "code === SI_USER || SI_NOINFO\n"; + if (defined('SI_NOINFO')) { + var_dump(($siginfo['code'] === SI_USER) || ($siginfo['code'] === SI_NOINFO)); + } else { + var_dump($siginfo['code'] === SI_USER); + } - pcntl_signal(SIGCHLD, function($signo){}); - posix_kill($pid, SIGTERM); - $signo = pcntl_sigwaitinfo(array((string)SIGCHLD), $siginfo); - echo "signo == SIGCHLD\n"; - var_dump($signo === SIGCHLD && $signo === $siginfo['signo']); - echo "code === CLD_KILLED\n"; - var_dump($siginfo['code'] === CLD_KILLED); - echo "signo === SIGCHLD\n"; - var_dump($siginfo['signo'] === SIGCHLD); - echo "signo === uid\n"; - var_dump($siginfo['uid'] === posix_getuid()); - echo "signo === pid\n"; - var_dump($siginfo['pid'] === $pid); - pcntl_waitpid($pid, $status); + pcntl_signal(SIGCHLD, function($signo){}); + posix_kill($pid, SIGTERM); + $signo = pcntl_sigwaitinfo(array((string)SIGCHLD), $siginfo); + echo "signo == SIGCHLD\n"; + var_dump($signo === SIGCHLD && $signo === $siginfo['signo']); + echo "code === CLD_KILLED\n"; + var_dump($siginfo['code'] === CLD_KILLED); + echo "signo === SIGCHLD\n"; + var_dump($siginfo['signo'] === SIGCHLD); + echo "signo === uid\n"; + var_dump($siginfo['uid'] === posix_getuid()); + echo "signo === pid\n"; + var_dump($siginfo['pid'] === $pid); + pcntl_waitpid($pid, $status); - set_error_handler(function($errno, $errstr) { echo "Error triggered\n"; }, E_WARNING); + set_error_handler(function($errno, $errstr) { echo "Error triggered\n"; }, E_WARNING); - echo "sigprocmask with invalid arguments\n"; + echo "sigprocmask with invalid arguments\n"; - /* Valgrind expectedly complains about this: + /* Valgrind expectedly complains about this: * "sigprocmask: unknown 'how' field 2147483647" - * Skip */ - if (getenv("USE_ZEND_ALLOC") !== '0') { - var_dump(pcntl_sigprocmask(PHP_INT_MAX, array(SIGTERM))); - } else { - echo "Error triggered\n"; - echo "bool(false)\n"; - } - var_dump(pcntl_sigprocmask(SIG_SETMASK, array(0))); + * Skip */ + if (getenv("USE_ZEND_ALLOC") !== '0') { + var_dump(pcntl_sigprocmask(PHP_INT_MAX, array(SIGTERM))); + } else { + echo "Error triggered\n"; + echo "bool(false)\n"; + } + var_dump(pcntl_sigprocmask(SIG_SETMASK, array(0))); - echo "sigwaitinfo with invalid arguments\n"; - var_dump(pcntl_sigwaitinfo(array(0))); + echo "sigwaitinfo with invalid arguments\n"; + var_dump(pcntl_sigwaitinfo(array(0))); - echo "sigtimedwait with invalid arguments\n"; - var_dump(pcntl_sigtimedwait(array(SIGTERM), $signo, PHP_INT_MAX, PHP_INT_MAX)); + echo "sigtimedwait with invalid arguments\n"; + var_dump(pcntl_sigtimedwait(array(SIGTERM), $signo, PHP_INT_MAX, PHP_INT_MAX)); } else { - $siginfo = NULL; - pcntl_sigtimedwait(array(SIGINT), $siginfo, 3600, 0); - exit; + $siginfo = NULL; + pcntl_sigtimedwait(array(SIGINT), $siginfo, 3600, 0); + exit; } ?> diff --git a/ext/pcntl/tests/pcntl_exec_2.phpt b/ext/pcntl/tests/pcntl_exec_2.phpt index 72274ede5f..18a3a6bc24 100644 --- a/ext/pcntl/tests/pcntl_exec_2.phpt +++ b/ext/pcntl/tests/pcntl_exec_2.phpt @@ -10,14 +10,14 @@ if (!getenv("TEST_PHP_EXECUTABLE") || !is_executable(getenv("TEST_PHP_EXECUTABLE --FILE-- <?php if (getenv("PCNTL_EXEC_TEST_IS_CHILD")) { - var_dump(getenv("FOO")); - exit; + var_dump(getenv("FOO")); + exit; } echo "ok\n"; pcntl_exec(getenv("TEST_PHP_EXECUTABLE"), array('-n', __FILE__), array( - "PCNTL_EXEC_TEST_IS_CHILD" => "1", - "FOO" => "BAR", - 1 => "long") + "PCNTL_EXEC_TEST_IS_CHILD" => "1", + "FOO" => "BAR", + 1 => "long") ); echo "nok\n"; diff --git a/ext/pcntl/tests/pcntl_fork_basic.phpt b/ext/pcntl/tests/pcntl_fork_basic.phpt index 59931df850..3509e14a7f 100644 --- a/ext/pcntl/tests/pcntl_fork_basic.phpt +++ b/ext/pcntl/tests/pcntl_fork_basic.phpt @@ -15,10 +15,10 @@ echo "*** Test by calling method or function with its expected arguments, first $pid = pcntl_fork(); if ($pid > 0) { - pcntl_wait($status); - var_dump($pid); + pcntl_wait($status); + var_dump($pid); } else { - var_dump($pid); + var_dump($pid); } ?> --EXPECTF-- diff --git a/ext/pcntl/tests/pcntl_signal.phpt b/ext/pcntl/tests/pcntl_signal.phpt index 432b57e62e..cd55d9ad96 100644 --- a/ext/pcntl/tests/pcntl_signal.phpt +++ b/ext/pcntl/tests/pcntl_signal.phpt @@ -6,13 +6,13 @@ pcntl_signal() --FILE-- <?php pcntl_signal(SIGTERM, function($signo){ - echo "signal dispatched\n"; + echo "signal dispatched\n"; }); posix_kill(posix_getpid(), SIGTERM); pcntl_signal_dispatch(); pcntl_signal(SIGUSR1, function($signo, $siginfo){ - printf("got signal from %s\n", $siginfo['pid'] ?? 'nobody'); + printf("got signal from %s\n", $siginfo['pid'] ?? 'nobody'); }); posix_kill(posix_getpid(), SIGUSR1); pcntl_signal_dispatch(); diff --git a/ext/pcntl/tests/pcntl_wait.phpt b/ext/pcntl/tests/pcntl_wait.phpt index c745a21dc7..346ca019fb 100644 --- a/ext/pcntl/tests/pcntl_wait.phpt +++ b/ext/pcntl/tests/pcntl_wait.phpt @@ -7,22 +7,22 @@ pcntl_wait() <?php $pid = pcntl_fork(); if ($pid == -1) { - die("failed"); + die("failed"); } else if ($pid) { - $status = 0; - pcntl_wait($status, WUNTRACED); - var_dump(pcntl_wifexited($status)); - posix_kill($pid, SIGCONT); + $status = 0; + pcntl_wait($status, WUNTRACED); + var_dump(pcntl_wifexited($status)); + posix_kill($pid, SIGCONT); - pcntl_wait($status); - var_dump(pcntl_wifsignaled($status)); - var_dump(pcntl_wifstopped($status)); - var_dump(pcntl_wexitstatus($status)); + pcntl_wait($status); + var_dump(pcntl_wifsignaled($status)); + var_dump(pcntl_wifstopped($status)); + var_dump(pcntl_wexitstatus($status)); - var_dump(pcntl_wait($status, WNOHANG | WUNTRACED)); + var_dump(pcntl_wait($status, WNOHANG | WUNTRACED)); } else { - posix_kill(posix_getpid(), SIGSTOP); - exit(42); + posix_kill(posix_getpid(), SIGSTOP); + exit(42); } ?> --EXPECTF-- diff --git a/ext/pcntl/tests/pcntl_wait_rusage1.phpt b/ext/pcntl/tests/pcntl_wait_rusage1.phpt index b23195f914..106c7088b8 100644 --- a/ext/pcntl/tests/pcntl_wait_rusage1.phpt +++ b/ext/pcntl/tests/pcntl_wait_rusage1.phpt @@ -7,34 +7,34 @@ pcntl_wait() and rusage <?php $pid = pcntl_fork(); if ($pid == -1) { - die("failed"); + die("failed"); } else if ($pid) { - $status = 0; - var_dump(pcntl_wait($status, WUNTRACED, $rusage)); - var_dump($rusage['ru_utime.tv_sec']); - var_dump($rusage['ru_utime.tv_usec']); + $status = 0; + var_dump(pcntl_wait($status, WUNTRACED, $rusage)); + var_dump($rusage['ru_utime.tv_sec']); + var_dump($rusage['ru_utime.tv_usec']); - posix_kill($pid, SIGCONT); + posix_kill($pid, SIGCONT); - $rusage = array(1,2,3); - pcntl_wait($status, WUNTRACED, $rusage); - var_dump($rusage['ru_utime.tv_sec']); - var_dump($rusage['ru_utime.tv_usec']); + $rusage = array(1,2,3); + pcntl_wait($status, WUNTRACED, $rusage); + var_dump($rusage['ru_utime.tv_sec']); + var_dump($rusage['ru_utime.tv_usec']); - $rusage = "string"; - pcntl_wait($status, 0, $rusage); - var_dump(gettype($rusage)); - var_dump(count($rusage)); + $rusage = "string"; + pcntl_wait($status, 0, $rusage); + var_dump(gettype($rusage)); + var_dump(count($rusage)); - $rusage = new stdClass; - pcntl_wait($status, 0, $rusage); - var_dump(gettype($rusage)); - var_dump(count($rusage)); + $rusage = new stdClass; + pcntl_wait($status, 0, $rusage); + var_dump(gettype($rusage)); + var_dump(count($rusage)); - echo "END\n"; + echo "END\n"; } else { - posix_kill(posix_getpid(), SIGSTOP); - exit(42); + posix_kill(posix_getpid(), SIGSTOP); + exit(42); } ?> --EXPECTF-- diff --git a/ext/pcntl/tests/pcntl_waitpid_rusage1.phpt b/ext/pcntl/tests/pcntl_waitpid_rusage1.phpt index 393dd59b9c..d9776676a1 100644 --- a/ext/pcntl/tests/pcntl_waitpid_rusage1.phpt +++ b/ext/pcntl/tests/pcntl_waitpid_rusage1.phpt @@ -7,34 +7,34 @@ pcntl_waitpid() and rusage <?php $pid = pcntl_fork(); if ($pid == -1) { - die("failed"); + die("failed"); } else if ($pid) { - $status = 0; - var_dump(pcntl_waitpid($pid, $status, WUNTRACED, $rusage)); - var_dump($rusage['ru_utime.tv_sec']); - var_dump($rusage['ru_utime.tv_usec']); + $status = 0; + var_dump(pcntl_waitpid($pid, $status, WUNTRACED, $rusage)); + var_dump($rusage['ru_utime.tv_sec']); + var_dump($rusage['ru_utime.tv_usec']); - posix_kill($pid, SIGCONT); + posix_kill($pid, SIGCONT); - $rusage = array(1,2,3); - pcntl_waitpid($pid, $status, WUNTRACED, $rusage); - var_dump($rusage['ru_utime.tv_sec']); - var_dump($rusage['ru_utime.tv_usec']); + $rusage = array(1,2,3); + pcntl_waitpid($pid, $status, WUNTRACED, $rusage); + var_dump($rusage['ru_utime.tv_sec']); + var_dump($rusage['ru_utime.tv_usec']); - $rusage = "string"; - pcntl_waitpid($pid, $status, 0, $rusage); - var_dump(gettype($rusage)); - var_dump(count($rusage)); + $rusage = "string"; + pcntl_waitpid($pid, $status, 0, $rusage); + var_dump(gettype($rusage)); + var_dump(count($rusage)); - $rusage = new stdClass; - pcntl_waitpid($pid, $status, 0, $rusage); - var_dump(gettype($rusage)); - var_dump(count($rusage)); + $rusage = new stdClass; + pcntl_waitpid($pid, $status, 0, $rusage); + var_dump(gettype($rusage)); + var_dump(count($rusage)); - echo "END\n"; + echo "END\n"; } else { - posix_kill(posix_getpid(), SIGSTOP); - exit(42); + posix_kill(posix_getpid(), SIGSTOP); + exit(42); } ?> --EXPECTF-- diff --git a/ext/pcre/tests/001.phpt b/ext/pcre/tests/001.phpt index 313f7fdc67..482ba1b732 100644 --- a/ext/pcre/tests/001.phpt +++ b/ext/pcre/tests/001.phpt @@ -4,14 +4,14 @@ abusing preg_match() <?php foreach (array('2006-05-13', '06-12-12', 'data: "12-Aug-87"') as $s) { - var_dump(preg_match('~ - (?P<date> - (?P<year>(\d{2})?\d\d) - - (?P<month>(?:\d\d|[a-zA-Z]{2,3})) - - (?P<day>[0-3]?\d)) - ~x', $s, $m)); + var_dump(preg_match('~ + (?P<date> + (?P<year>(\d{2})?\d\d) - + (?P<month>(?:\d\d|[a-zA-Z]{2,3})) - + (?P<day>[0-3]?\d)) + ~x', $s, $m)); - var_dump($m); + var_dump($m); } ?> diff --git a/ext/pcre/tests/003.phpt b/ext/pcre/tests/003.phpt index e697c375c6..b5fce13194 100644 --- a/ext/pcre/tests/003.phpt +++ b/ext/pcre/tests/003.phpt @@ -4,15 +4,15 @@ abusing preg_match_all() <?php foreach (array(PREG_PATTERN_ORDER, PREG_SET_ORDER) as $flag) { - var_dump(preg_match_all('~ - (?P<date> - (?P<year>(\d{2})?\d\d) - - (?P<month>(?:\d\d|[a-zA-Z]{2,3})) - - (?P<day>[0-3]?\d)) - ~x', - '2006-05-13 e outra data: "12-Aug-37"', $m, $flag)); + var_dump(preg_match_all('~ + (?P<date> + (?P<year>(\d{2})?\d\d) - + (?P<month>(?:\d\d|[a-zA-Z]{2,3})) - + (?P<day>[0-3]?\d)) + ~x', + '2006-05-13 e outra data: "12-Aug-37"', $m, $flag)); - var_dump($m); + var_dump($m); } ?> --EXPECT-- diff --git a/ext/pcre/tests/005.phpt b/ext/pcre/tests/005.phpt index 5eff83eba6..f988da054a 100644 --- a/ext/pcre/tests/005.phpt +++ b/ext/pcre/tests/005.phpt @@ -63,12 +63,12 @@ ext/ming/ming.o(.text+0x851): In function `zif_ming_setSWFCompression': /p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:154: undefined reference to `Ming_setSWFCompression' "; - // Regular expression to select the error and warning information - // tuned for gcc 3.4, 4.0 and 4.1 - $gcc_regex = '/^((.+)(\(\.text\+0x[[:xdigit:]]+\))?: In function [`\'](\w+)\':\s+)?'. - '((?(1)(?(3)[^:\n]+|\2)|[^:\n]+)):(\d+): (?:(error|warning):\s+)?(.+)'. - str_repeat('(?:\s+\5:(\d+): (?:(error|warning):\s+)?(.+))?', 99). // capture up to 100 errors - '/mS'; + // Regular expression to select the error and warning information + // tuned for gcc 3.4, 4.0 and 4.1 + $gcc_regex = '/^((.+)(\(\.text\+0x[[:xdigit:]]+\))?: In function [`\'](\w+)\':\s+)?'. + '((?(1)(?(3)[^:\n]+|\2)|[^:\n]+)):(\d+): (?:(error|warning):\s+)?(.+)'. + str_repeat('(?:\s+\5:(\d+): (?:(error|warning):\s+)?(.+))?', 99). // capture up to 100 errors + '/mS'; var_dump(preg_match_all($gcc_regex, $sampledata, $m, PREG_SET_ORDER)); diff --git a/ext/pcre/tests/007.phpt b/ext/pcre/tests/007.phpt index 776bec27b2..bc213ad0e0 100644 --- a/ext/pcre/tests/007.phpt +++ b/ext/pcre/tests/007.phpt @@ -10,10 +10,10 @@ if (@preg_match('/./u', '') === false) { <?php function evil($x) { - global $txt; - $txt[3] = "\xFF"; - var_dump($x); - return $x[0]; + global $txt; + $txt[3] = "\xFF"; + var_dump($x); + return $x[0]; } $txt = "ola123"; diff --git a/ext/pcre/tests/bug20528.phpt b/ext/pcre/tests/bug20528.phpt index 43e548b26e..a067680b05 100644 --- a/ext/pcre/tests/bug20528.phpt +++ b/ext/pcre/tests/bug20528.phpt @@ -2,8 +2,8 @@ Bug #20528 (preg_split() drops characters (re-opens Bug #15413)) --FILE-- <?php - $data = '(#11/19/2002#)'; - var_dump(preg_split('/\b/', $data)); + $data = '(#11/19/2002#)'; + var_dump(preg_split('/\b/', $data)); ?> --EXPECT-- array(7) { diff --git a/ext/pcre/tests/bug21732.phpt b/ext/pcre/tests/bug21732.phpt index 629e015a06..a88d36c94c 100644 --- a/ext/pcre/tests/bug21732.phpt +++ b/ext/pcre/tests/bug21732.phpt @@ -3,10 +3,10 @@ Bug #21732 (preg_replace() segfaults with invalid parameters) --FILE-- <?php class foo { - function cb($param) { - var_dump($param); - return "yes!"; - } + function cb($param) { + var_dump($param); + return "yes!"; + } } try { diff --git a/ext/pcre/tests/bug26927.phpt b/ext/pcre/tests/bug26927.phpt index 200a534b76..8cc6280afd 100644 --- a/ext/pcre/tests/bug26927.phpt +++ b/ext/pcre/tests/bug26927.phpt @@ -2,9 +2,9 @@ Bug #26927 (preg_quote() does not escape \0) --FILE-- <?php - $str = "a\000b"; - $str_quoted = preg_quote($str); - var_dump(preg_match("!{$str_quoted}!", $str), $str_quoted); + $str = "a\000b"; + $str_quoted = preg_quote($str); + var_dump(preg_match("!{$str_quoted}!", $str), $str_quoted); ?> --EXPECT-- int(1) diff --git a/ext/pcre/tests/bug27103.phpt b/ext/pcre/tests/bug27103.phpt index 0264228aee..0b706010a0 100644 --- a/ext/pcre/tests/bug27103.phpt +++ b/ext/pcre/tests/bug27103.phpt @@ -10,9 +10,9 @@ if (@preg_match('/./u', '') === false) { <?php function iter($ar) { - foreach ($ar as $c) { - echo htmlentities($c, 0, "UTF-8"), ": ", strlen($c), "\n"; - } + foreach ($ar as $c) { + echo htmlentities($c, 0, "UTF-8"), ": ", strlen($c), "\n"; + } } $teststr = "\xe2\x82\xac hi there"; iter(preg_split('//u', $teststr, -1, PREG_SPLIT_NO_EMPTY)); diff --git a/ext/pcre/tests/bug37911.phpt b/ext/pcre/tests/bug37911.phpt index 4f3cb3574d..c9cad1d6d5 100644 --- a/ext/pcre/tests/bug37911.phpt +++ b/ext/pcre/tests/bug37911.phpt @@ -5,8 +5,8 @@ Bug #37911 (preg_replace_callback ignores named groups) function callback($match) { - var_dump($match); - return $match[1].'/'.strlen($match['name']); + var_dump($match); + return $match[1].'/'.strlen($match['name']); } var_dump(preg_replace_callback('|(?P<name>blub)|', 'callback', 'bla blub blah')); diff --git a/ext/pcre/tests/bug44191.phpt b/ext/pcre/tests/bug44191.phpt index 73fc29cd90..7d0b535dc6 100644 --- a/ext/pcre/tests/bug44191.phpt +++ b/ext/pcre/tests/bug44191.phpt @@ -8,7 +8,7 @@ $array = range(1, 10); preg_grep('/asdf/', $array); foreach ($array as $k => $v) { - print $k; + print $k; } ?> diff --git a/ext/pcre/tests/bug47662.phpt b/ext/pcre/tests/bug47662.phpt index abf65e6ca9..84b237864a 100644 --- a/ext/pcre/tests/bug47662.phpt +++ b/ext/pcre/tests/bug47662.phpt @@ -5,7 +5,7 @@ Bug #47662 (support more than 127 named subpatterns) $regex = '@'; for($bar=0; $bar<129; $bar++) { - $regex .= '((?P<x'.$bar.'>))'; + $regex .= '((?P<x'.$bar.'>))'; } $regex .= 'fo+bar@'; diff --git a/ext/pcre/tests/bug73392.phpt b/ext/pcre/tests/bug73392.phpt index 90606c9e05..704cc3d351 100644 --- a/ext/pcre/tests/bug73392.phpt +++ b/ext/pcre/tests/bug73392.phpt @@ -3,22 +3,22 @@ Bug #73392 (A use-after-free in zend allocator management) --FILE-- <?php class Rep { - public function __invoke() { - return "d"; - } + public function __invoke() { + return "d"; + } } class Foo { - public static function rep($rep) { - return "ok"; - } + public static function rep($rep) { + return "ok"; + } } function b() { - return "b"; + return "b"; } var_dump(preg_replace_callback_array( - array( - "/a/" => 'b', "/b/" => function () { return "c"; }, "/c/" => new Rep, "reporting" => array("Foo", "rep"), "a1" => array("Foo", "rep"), - ), 'a')); + array( + "/a/" => 'b', "/b/" => function () { return "c"; }, "/c/" => new Rep, "reporting" => array("Foo", "rep"), "a1" => array("Foo", "rep"), + ), 'a')); ?> --EXPECTF-- Warning: preg_replace_callback_array(): Delimiter must not be alphanumeric or backslash in %sbug73392.php on line %d diff --git a/ext/pcre/tests/bug73483.phpt b/ext/pcre/tests/bug73483.phpt index fd10702527..cbf4a2bdaf 100644 --- a/ext/pcre/tests/bug73483.phpt +++ b/ext/pcre/tests/bug73483.phpt @@ -8,7 +8,7 @@ var_dump(preg_replace_callback($regex, function (array $matches) use($regex) { setlocale(LC_ALL, "en_US"); $ret = preg_replace($regex, "okey", $matches[0]); setlocale(LC_ALL, "C"); - return $ret; + return $ret; }, "dummy")); ?> --EXPECT-- diff --git a/ext/pcre/tests/bug77193.phpt b/ext/pcre/tests/bug77193.phpt index e143841e83..4fdb603b85 100644 --- a/ext/pcre/tests/bug77193.phpt +++ b/ext/pcre/tests/bug77193.phpt @@ -12,12 +12,12 @@ $text = '{CCM:CID_2}'; echo '1'; $mt = array(); preg_replace_callback( - '/([0-9]+)/i', - function ($matches) { - echo $matches[1]; - filter_var('http', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^http$/i']]); - }, - $text + '/([0-9]+)/i', + function ($matches) { + echo $matches[1]; + filter_var('http', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^http$/i']]); + }, + $text ); echo '3', "\n"; ?> diff --git a/ext/pcre/tests/cache_limit.phpt b/ext/pcre/tests/cache_limit.phpt index d6f3510e9d..d15b7675e4 100644 --- a/ext/pcre/tests/cache_limit.phpt +++ b/ext/pcre/tests/cache_limit.phpt @@ -12,10 +12,10 @@ $re = ''; $str = str_repeat('x', PREG_CACHE_SIZE); for ($i=0; $i < PREG_CACHE_SIZE; ++$i) { - $re .= '.'; - if (!preg_match("/$re/", $str)) { - die('non match. error'); - } + $re .= '.'; + if (!preg_match("/$re/", $str)) { + die('non match. error'); + } } var_dump(preg_match('/./', $str)); // this one was already deleted from the cache diff --git a/ext/pcre/tests/marks.phpt b/ext/pcre/tests/marks.phpt index 2a410834c6..e718e78093 100644 --- a/ext/pcre/tests/marks.phpt +++ b/ext/pcre/tests/marks.phpt @@ -4,7 +4,7 @@ Test support for PCRE marks <?php $regex = <<<'REGEX' -/ +/ _ (a) (*MARK:A_MARK) _ | _ (b) _ | _ (c) (*MARK:C_MARK) _ diff --git a/ext/pcre/tests/preg_match_error4.phpt b/ext/pcre/tests/preg_match_error4.phpt index 361ea81ab9..8c8f25b6e9 100644 --- a/ext/pcre/tests/preg_match_error4.phpt +++ b/ext/pcre/tests/preg_match_error4.phpt @@ -926,7 +926,7 @@ if($count === false) { throw new \RuntimeException('Failed to execute regex: Unknown error'); } } else { - var_dump("Done, $count matches."); + var_dump("Done, $count matches."); } ?> --EXPECT-- diff --git a/ext/pcre/tests/preg_replace_callback2.phpt b/ext/pcre/tests/preg_replace_callback2.phpt index 6dab1a0cf2..42c613726f 100644 --- a/ext/pcre/tests/preg_replace_callback2.phpt +++ b/ext/pcre/tests/preg_replace_callback2.phpt @@ -4,7 +4,7 @@ preg_replace_callback() 2 <?php function f() { - throw new Exception(); + throw new Exception(); } try { @@ -12,7 +12,7 @@ var_dump(preg_replace_callback('/\w/', 'f', 'z')); } catch(Exception $e) {} function g($x) { - return "'$x[0]'"; + return "'$x[0]'"; } var_dump(preg_replace_callback('@\b\w{1,2}\b@', 'g', array('a b3 bcd', 'v' => 'aksfjk', 12 => 'aa bb'))); diff --git a/ext/pcre/tests/preg_replace_callback_array.phpt b/ext/pcre/tests/preg_replace_callback_array.phpt index 01973eaa32..ffefa2cc26 100644 --- a/ext/pcre/tests/preg_replace_callback_array.phpt +++ b/ext/pcre/tests/preg_replace_callback_array.phpt @@ -4,41 +4,41 @@ preg_replace_callback_array() basic functions <?php class Rep { - public function __invoke() { - return "d"; - } + public function __invoke() { + return "d"; + } } class Foo { - public static function rep($rep) { - return "ok"; - } + public static function rep($rep) { + return "ok"; + } } function b() { - return "b"; + return "b"; } var_dump(preg_replace_callback_array( - array( - "/a/" => 'b', - "/b/" => function () { return "c"; }, - "/c/" => new Rep, - '/d/' => array("Foo", "rep")), 'a')); + array( + "/a/" => 'b', + "/b/" => function () { return "c"; }, + "/c/" => new Rep, + '/d/' => array("Foo", "rep")), 'a')); var_dump(preg_replace_callback_array( - array( - "/a/" => 'b', - "/c/" => new Rep, - "/b/" => function () { return "ok"; }, - '/d/' => array("Foo", "rep")), 'a')); + array( + "/a/" => 'b', + "/c/" => new Rep, + "/b/" => function () { return "ok"; }, + '/d/' => array("Foo", "rep")), 'a')); var_dump(preg_replace_callback_array( - array( - '/d/' => array("Foo", "rep"), - "/c/" => new Rep, - "/a/" => 'b', - "/b/" => function($a) { return "ok"; }), 'a', -1, $count)); + array( + '/d/' => array("Foo", "rep"), + "/c/" => new Rep, + "/a/" => 'b', + "/b/" => function($a) { return "ok"; }), 'a', -1, $count)); var_dump($count); ?> diff --git a/ext/pcre/tests/preg_replace_callback_array2.phpt b/ext/pcre/tests/preg_replace_callback_array2.phpt index 03d7a60eee..f333d06dcb 100644 --- a/ext/pcre/tests/preg_replace_callback_array2.phpt +++ b/ext/pcre/tests/preg_replace_callback_array2.phpt @@ -8,16 +8,16 @@ $b = ""; var_dump(preg_replace_callback_array(array("xx" => "s"), $a, -1, $b)); var_dump($b); function f() { - static $count = 1; - throw new Exception($count); + static $count = 1; + throw new Exception($count); } var_dump(preg_replace_callback_array(array('/\w' => 'f'), 'z')); try { - var_dump(preg_replace_callback_array(array('/\w/' => 'f', '/.*/' => 'f'), 'z')); + var_dump(preg_replace_callback_array(array('/\w/' => 'f', '/.*/' => 'f'), 'z')); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } echo "Done\n"; diff --git a/ext/pcre/tests/preg_replace_edit_basic.phpt b/ext/pcre/tests/preg_replace_edit_basic.phpt index b272f379be..d5a251392a 100644 --- a/ext/pcre/tests/preg_replace_edit_basic.phpt +++ b/ext/pcre/tests/preg_replace_edit_basic.phpt @@ -16,7 +16,7 @@ var_dump(preg_replace('<- This is a string$>', var_dump(preg_replace('<[0-35-9]>', '4', $string, //finds any number that's not 4 and replaces it with a 4 - '5', $count)); //limits to 5 replacements returns 444444789 + '5', $count)); //limits to 5 replacements returns 444444789 var_dump($count); //counts the number of replacements made (5) diff --git a/ext/pcre/tests/skip_001.inc b/ext/pcre/tests/skip_001.inc index 35434ece5b..13035969b4 100644 --- a/ext/pcre/tests/skip_001.inc +++ b/ext/pcre/tests/skip_001.inc @@ -1,5 +1,5 @@ <?php if (!@setlocale(LC_ALL, 'pt_PT', 'pt', 'pt_PT.ISO8859-1', 'portuguese')) { - die('skip pt locale not available'); + die('skip pt locale not available'); } diff --git a/ext/pcre/tests/skip_002.inc b/ext/pcre/tests/skip_002.inc index 7f3a253faa..e62864b6a8 100644 --- a/ext/pcre/tests/skip_002.inc +++ b/ext/pcre/tests/skip_002.inc @@ -1,5 +1,5 @@ <?php if (@preg_match('/./u', '') === false) { - die('skip'); + die('skip'); } diff --git a/ext/pcre/tests/skip_003.inc b/ext/pcre/tests/skip_003.inc index af2f548ca1..5a03c5802c 100644 --- a/ext/pcre/tests/skip_003.inc +++ b/ext/pcre/tests/skip_003.inc @@ -1,5 +1,5 @@ <?php if (@preg_match_all('/\p{N}/', '0123456789', $dummy) === false) { - die('skip'); + die('skip'); } diff --git a/ext/pdo/tests/bug_34630.phpt b/ext/pdo/tests/bug_34630.phpt index 32a60643db..97845029ef 100644 --- a/ext/pdo/tests/bug_34630.phpt +++ b/ext/pdo/tests/bug_34630.phpt @@ -18,9 +18,9 @@ $driver = $db->getAttribute(PDO::ATTR_DRIVER_NAME); $is_oci = $driver == 'oci'; if ($is_oci) { - $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val BLOB)'); + $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val BLOB)'); } else { - $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val VARCHAR(256))'); + $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val VARCHAR(256))'); } $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); @@ -29,13 +29,13 @@ fwrite($fp, "I am the LOB data"); rewind($fp); if ($is_oci) { - /* oracle is a bit different; you need to initiate a transaction otherwise - * the empty blob will be committed implicitly when the statement is - * executed */ - $db->beginTransaction(); - $insert = $db->prepare("insert into test (id, val) values (1, EMPTY_BLOB()) RETURNING val INTO :blob"); + /* oracle is a bit different; you need to initiate a transaction otherwise + * the empty blob will be committed implicitly when the statement is + * executed */ + $db->beginTransaction(); + $insert = $db->prepare("insert into test (id, val) values (1, EMPTY_BLOB()) RETURNING val INTO :blob"); } else { - $insert = $db->prepare("insert into test (id, val) values (1, :blob)"); + $insert = $db->prepare("insert into test (id, val) values (1, :blob)"); } $insert->bindValue(':blob', $fp, PDO::PARAM_LOB); $insert->execute(); diff --git a/ext/pdo/tests/bug_34687.phpt b/ext/pdo/tests/bug_34687.phpt index f25da54893..c260ddb271 100644 --- a/ext/pdo/tests/bug_34687.phpt +++ b/ext/pdo/tests/bug_34687.phpt @@ -20,10 +20,10 @@ $x = $db->query("UPDATE non_existent_pdo_test_table set foo = 'bar'"); var_dump($x); $code = $db->errorCode(); if ($code !== '00000' && strlen($code)) { - echo "OK: $code\n"; + echo "OK: $code\n"; } else { - echo "ERR: $code\n"; - print_r($db->errorInfo()); + echo "ERR: $code\n"; + print_r($db->errorInfo()); } ?> diff --git a/ext/pdo/tests/bug_35671.phpt b/ext/pdo/tests/bug_35671.phpt index fae84652f8..c5e4bbb609 100644 --- a/ext/pdo/tests/bug_35671.phpt +++ b/ext/pdo/tests/bug_35671.phpt @@ -20,9 +20,9 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $insert = $db->prepare("insert into test (field1, field2, field3) values (:value1, :value2, :value3)"); $parm = array( - ":value1" => 15, - ":value2" => 20, - ":value3" => 25 + ":value1" => 15, + ":value2" => 20, + ":value3" => 25 ); $insert->execute($parm); diff --git a/ext/pdo/tests/bug_42917.phpt b/ext/pdo/tests/bug_42917.phpt index 814086a56a..073e9c0126 100644 --- a/ext/pdo/tests/bug_42917.phpt +++ b/ext/pdo/tests/bug_42917.phpt @@ -17,7 +17,7 @@ $db = PDOTest::factory(); $db->exec("CREATE TABLE test (a varchar(100), b varchar(100), c varchar(100))"); for ($i = 0; $i < 5; $i++) { - $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')"); + $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')"); } $res = $db->query("SELECT a,b FROM test"); diff --git a/ext/pdo/tests/bug_43130.phpt b/ext/pdo/tests/bug_43130.phpt index 4fea1a78ae..bf65bf0513 100644 --- a/ext/pdo/tests/bug_43130.phpt +++ b/ext/pdo/tests/bug_43130.phpt @@ -20,12 +20,12 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); $db->exec("CREATE TABLE test (a varchar(100), b varchar(100), c varchar(100))"); for ($i = 0; $i < 5; $i++) { - $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')"); + $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')"); } $stmt = $db->prepare("SELECT a FROM test WHERE b=:id-value"); diff --git a/ext/pdo/tests/bug_43139.phpt b/ext/pdo/tests/bug_43139.phpt index 066eb2ed18..3b456a2ccc 100644 --- a/ext/pdo/tests/bug_43139.phpt +++ b/ext/pdo/tests/bug_43139.phpt @@ -19,9 +19,9 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); $from = ''; if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') { - $from = 'from dual'; + $from = 'from dual'; } else if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'firebird') { - $from = 'FROM RDB$DATABASE'; + $from = 'FROM RDB$DATABASE'; } var_dump($db->query("select 0 as abc, 1 as xyz, 2 as def $from")->fetchAll(PDO::FETCH_GROUP)); diff --git a/ext/pdo/tests/bug_44159.phpt b/ext/pdo/tests/bug_44159.phpt index 26b0e33b60..bd7aca0e93 100644 --- a/ext/pdo/tests/bug_44159.phpt +++ b/ext/pdo/tests/bug_44159.phpt @@ -16,9 +16,9 @@ $pdo = new PDO("sqlite:".__DIR__."/foo.db"); $attrs = array(PDO::ATTR_STATEMENT_CLASS, PDO::ATTR_STRINGIFY_FETCHES, PDO::NULL_TO_STRING); foreach ($attrs as $attr) { - var_dump($pdo->setAttribute($attr, NULL)); - var_dump($pdo->setAttribute($attr, 1)); - var_dump($pdo->setAttribute($attr, 'nonsense')); + var_dump($pdo->setAttribute($attr, NULL)); + var_dump($pdo->setAttribute($attr, 1)); + var_dump($pdo->setAttribute($attr, 'nonsense')); } @unlink(__DIR__."/foo.db"); diff --git a/ext/pdo/tests/bug_44409.phpt b/ext/pdo/tests/bug_44409.phpt index f32eb879bd..a378301f41 100644 --- a/ext/pdo/tests/bug_44409.phpt +++ b/ext/pdo/tests/bug_44409.phpt @@ -19,20 +19,20 @@ $db->exec("INSERT INTO test (dat) VALUES ('Data from DB')"); class bug44409 implements Serializable { - public function __construct() - { - printf("Method called: %s()\n", __METHOD__); - } - - public function serialize() - { - return "any data from serizalize()"; - } - - public function unserialize($dat) - { - printf("Method called: %s(%s)\n", __METHOD__, var_export($dat, true)); - } + public function __construct() + { + printf("Method called: %s()\n", __METHOD__); + } + + public function serialize() + { + return "any data from serizalize()"; + } + + public function unserialize($dat) + { + printf("Method called: %s(%s)\n", __METHOD__, var_export($dat, true)); + } } $stmt = $db->query("SELECT * FROM test"); diff --git a/ext/pdo/tests/bug_44861.phpt b/ext/pdo/tests/bug_44861.phpt index ec2d779fb5..6ca5b17563 100644 --- a/ext/pdo/tests/bug_44861.phpt +++ b/ext/pdo/tests/bug_44861.phpt @@ -27,11 +27,11 @@ $db = PDOTest::factory(); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') { - $from = 'FROM DUAL'; - $ob = '1'; + $from = 'FROM DUAL'; + $ob = '1'; } else { - $from = ''; - $ob = 'r'; + $from = ''; + $ob = 'r'; } $query = "SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 'row3' $from UNION SELECT 'row4' $from ORDER BY $ob"; diff --git a/ext/pdo/tests/bug_47769.phpt b/ext/pdo/tests/bug_47769.phpt index c0ac8350ce..1c4395cc4b 100644 --- a/ext/pdo/tests/bug_47769.phpt +++ b/ext/pdo/tests/bug_47769.phpt @@ -10,18 +10,18 @@ if (!extension_loaded("pdo_sqlite")) class test extends PDO { - protected function isProtected() { - echo "this is a protected method.\n"; - } - private function isPrivate() { - echo "this is a private method.\n"; - } + protected function isProtected() { + echo "this is a protected method.\n"; + } + private function isPrivate() { + echo "this is a private method.\n"; + } public function quote($str, $paramtype = NULL) { - $this->isProtected(); - $this->isPrivate(); - print $str ."\n"; - } + $this->isProtected(); + $this->isPrivate(); + print $str ."\n"; + } } $test = new test('sqlite::memory:'); diff --git a/ext/pdo/tests/bug_60665.phpt b/ext/pdo/tests/bug_60665.phpt index fef212ae95..efc43e4b50 100644 --- a/ext/pdo/tests/bug_60665.phpt +++ b/ext/pdo/tests/bug_60665.phpt @@ -14,9 +14,9 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { - case 'oci': $from = 'from dual'; break; - case 'firebird': $from = 'from rdb$database'; break; - default: $from = ''; break; + case 'oci': $from = 'from dual'; break; + case 'firebird': $from = 'from rdb$database'; break; + default: $from = ''; break; } $statement = $db->prepare("SELECT NULL AS null_value, 0 AS zero, 1 AS one $from"); $statement->execute(); diff --git a/ext/pdo/tests/bug_61292.phpt b/ext/pdo/tests/bug_61292.phpt index f82619d20e..07501d594f 100644 --- a/ext/pdo/tests/bug_61292.phpt +++ b/ext/pdo/tests/bug_61292.phpt @@ -15,25 +15,25 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; class Database_SQL extends PDO { - function __construct() - { + function __construct() + { $dsn = getenv('PDOTEST_DSN'); $user = getenv('PDOTEST_USER'); $pass = getenv('PDOTEST_PASS'); if ($user === false) $user = NULL; if ($pass === false) $pass = NULL; - $options = array(PDO::ATTR_PERSISTENT => TRUE); + $options = array(PDO::ATTR_PERSISTENT => TRUE); - parent::__construct($dsn, $user, $pass, $options); - } + parent::__construct($dsn, $user, $pass, $options); + } - var $bar = array(); + var $bar = array(); - public function foo() - { - var_dump($this->bar); - } + public function foo() + { + var_dump($this->bar); + } } (new Database_SQL)->foo(); diff --git a/ext/pdo/tests/bug_65946.phpt b/ext/pdo/tests/bug_65946.phpt index db7671de99..7c8f8c93cb 100644 --- a/ext/pdo/tests/bug_65946.phpt +++ b/ext/pdo/tests/bug_65946.phpt @@ -17,22 +17,22 @@ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $db->exec('CREATE TABLE test(id int)'); $db->exec('INSERT INTO test VALUES(1)'); switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { - case 'dblib': - $sql = 'SELECT TOP :limit * FROM test'; - break; - case 'odbc': - $sql = 'SELECT TOP (:limit) * FROM test'; - break; - case 'firebird': - $sql = 'SELECT FIRST :limit * FROM test'; - break; - case 'oci': - //$sql = 'SELECT * FROM test FETCH FIRST :limit ROWS ONLY'; // Oracle 12c syntax - $sql = "select id from (select a.*, rownum rnum from (SELECT * FROM test) a where rownum <= :limit)"; - break; - default: - $sql = 'SELECT * FROM test LIMIT :limit'; - break; + case 'dblib': + $sql = 'SELECT TOP :limit * FROM test'; + break; + case 'odbc': + $sql = 'SELECT TOP (:limit) * FROM test'; + break; + case 'firebird': + $sql = 'SELECT FIRST :limit * FROM test'; + break; + case 'oci': + //$sql = 'SELECT * FROM test FETCH FIRST :limit ROWS ONLY'; // Oracle 12c syntax + $sql = "select id from (select a.*, rownum rnum from (SELECT * FROM test) a where rownum <= :limit)"; + break; + default: + $sql = 'SELECT * FROM test LIMIT :limit'; + break; } $stmt = $db->prepare($sql); $stmt->bindValue('limit', 1, PDO::PARAM_INT); diff --git a/ext/pdo/tests/bug_71447.phpt b/ext/pdo/tests/bug_71447.phpt index 64bdc199fe..1db3ccf151 100644 --- a/ext/pdo/tests/bug_71447.phpt +++ b/ext/pdo/tests/bug_71447.phpt @@ -22,9 +22,9 @@ $db->exec('INSERT INTO test VALUES(1)'); // Comment without quotes or placeholders $stmt = $db->prepare(" - SELECT -- That's all folks! - '\"abc\":8000' - FROM test + SELECT -- That's all folks! + '\"abc\":8000' + FROM test "); $stmt->execute(); @@ -32,9 +32,9 @@ var_dump($stmt->fetchColumn()); // Comment and placeholder within a string $stmt = $db->prepare(" - SELECT - '\"abc\":8001 -- Wat?' - FROM test + SELECT + '\"abc\":8001 -- Wat?' + FROM test "); $stmt->execute(); @@ -42,9 +42,9 @@ var_dump($stmt->fetchColumn()); // Comment with single quote $stmt = $db->prepare(" - SELECT -- That's all folks! - '\"abc\":8002' - FROM test + SELECT -- That's all folks! + '\"abc\":8002' + FROM test "); $stmt->execute(); @@ -52,9 +52,9 @@ var_dump($stmt->fetchColumn()); // C-Style comment with single quote $stmt = $db->prepare(" - SELECT /* That's all folks! */ - '\"abc\":8003' - FROM test + SELECT /* That's all folks! */ + '\"abc\":8003' + FROM test "); $stmt->execute(); @@ -62,9 +62,9 @@ var_dump($stmt->fetchColumn()); // Comment with double quote $stmt = $db->prepare(" - SELECT -- Is it only \"single quotes? - '\"abc\":8004' - FROM test + SELECT -- Is it only \"single quotes? + '\"abc\":8004' + FROM test "); $stmt->execute(); @@ -72,10 +72,10 @@ var_dump($stmt->fetchColumn()); // Comment with ? placeholder $stmt = $db->prepare(" - SELECT -- What about question marks here? - * - FROM test - WHERE id = ? + SELECT -- What about question marks here? + * + FROM test + WHERE id = ? "); $stmt->execute([1]); @@ -83,10 +83,10 @@ var_dump($stmt->fetchColumn()); // Comment with named placeholder $stmt = $db->prepare(" - SELECT -- What about placeholders :bar - * - FROM test - WHERE id = :id + SELECT -- What about placeholders :bar + * + FROM test + WHERE id = :id "); $stmt->execute(['id' => 1]); diff --git a/ext/pdo/tests/bug_71885.phpt b/ext/pdo/tests/bug_71885.phpt index 25ddbdd90f..8eb097f5d9 100644 --- a/ext/pdo/tests/bug_71885.phpt +++ b/ext/pdo/tests/bug_71885.phpt @@ -22,27 +22,27 @@ $db->exec("CREATE TABLE test (a int)"); $sql = "SELECT * FROM test WHERE a ?? 1"; try { - $db->exec($sql); + $db->exec($sql); } catch (PDOException $e) { - var_dump(strpos($e->getMessage(), "?") !== false); + var_dump(strpos($e->getMessage(), "?") !== false); } try { - $stmt = $db->prepare($sql); - $stmt->execute(); + $stmt = $db->prepare($sql); + $stmt->execute(); } catch (PDOException $e) { - var_dump(strpos($e->getMessage(), "?") !== false); + var_dump(strpos($e->getMessage(), "?") !== false); } if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); } try { - $stmt = $db->prepare($sql); - $stmt->execute(); + $stmt = $db->prepare($sql); + $stmt->execute(); } catch (PDOException $e) { - var_dump(strpos($e->getMessage(), "?") !== false); + var_dump(strpos($e->getMessage(), "?") !== false); } ?> diff --git a/ext/pdo/tests/pdo.inc b/ext/pdo/tests/pdo.inc index 8089236bbc..214764fc47 100644 --- a/ext/pdo/tests/pdo.inc +++ b/ext/pdo/tests/pdo.inc @@ -2,9 +2,9 @@ function set_sql($name, $query) { - if (empty($GLOBALS['SQL'][$name])) - { - $GLOBALS['SQL'][$name] = $query; - } + if (empty($GLOBALS['SQL'][$name])) + { + $GLOBALS['SQL'][$name] = $query; + } } ?> diff --git a/ext/pdo/tests/pdo_005.phpt b/ext/pdo/tests/pdo_005.phpt index 6e89aad744..25eab7782f 100644 --- a/ext/pdo/tests/pdo_005.phpt +++ b/ext/pdo/tests/pdo_005.phpt @@ -23,20 +23,20 @@ $stmt = $db->prepare('SELECT id, val, val2 from test'); class TestBase { - public $id; - protected $val; - private $val2; + public $id; + protected $val; + private $val2; } class TestDerived extends TestBase { - protected $row; + protected $row; - public function __construct(&$row) - { - echo __METHOD__ . "($row,{$this->id})\n"; - $this->row = $row++; - } + public function __construct(&$row) + { + echo __METHOD__ . "($row,{$this->id})\n"; + $this->row = $row++; + } } $stmt->execute(); diff --git a/ext/pdo/tests/pdo_009.phpt b/ext/pdo/tests/pdo_009.phpt index bc63aa66fd..7f332db742 100644 --- a/ext/pdo/tests/pdo_009.phpt +++ b/ext/pdo/tests/pdo_009.phpt @@ -28,26 +28,26 @@ $stmt = $db->prepare('SELECT classtypes.name, test.id AS id, test.val AS val FRO class Test1 { - public function __construct() - { - echo __METHOD__ . "()\n"; - } + public function __construct() + { + echo __METHOD__ . "()\n"; + } } class Test2 { - public function __construct() - { - echo __METHOD__ . "()\n"; - } + public function __construct() + { + echo __METHOD__ . "()\n"; + } } class Test3 { - public function __construct() - { - echo __METHOD__ . "()\n"; - } + public function __construct() + { + echo __METHOD__ . "()\n"; + } } $stmt->execute(); diff --git a/ext/pdo/tests/pdo_010.phpt b/ext/pdo/tests/pdo_010.phpt index f5b6bafbb9..7cc4ff15f7 100644 --- a/ext/pdo/tests/pdo_010.phpt +++ b/ext/pdo/tests/pdo_010.phpt @@ -28,26 +28,26 @@ $stmt = $db->prepare('SELECT classtypes.name, test.grp AS grp, test.id AS id, te class Test1 { - public function __construct() - { - echo __METHOD__ . "()\n"; - } + public function __construct() + { + echo __METHOD__ . "()\n"; + } } class Test2 { - public function __construct() - { - echo __METHOD__ . "()\n"; - } + public function __construct() + { + echo __METHOD__ . "()\n"; + } } class Test3 { - public function __construct() - { - echo __METHOD__ . "()\n"; - } + public function __construct() + { + echo __METHOD__ . "()\n"; + } } diff --git a/ext/pdo/tests/pdo_011.phpt b/ext/pdo/tests/pdo_011.phpt index e014ff9c9b..7985d4406a 100644 --- a/ext/pdo/tests/pdo_011.phpt +++ b/ext/pdo/tests/pdo_011.phpt @@ -22,16 +22,16 @@ $db->exec('INSERT INTO test VALUES(4, \'D\', \'Group2\')'); class DerivedStatement extends PDOStatement { - private function __construct($name, $db) - { - $this->name = $name; - echo __METHOD__ . "($name)\n"; - } + private function __construct($name, $db) + { + $this->name = $name; + echo __METHOD__ . "($name)\n"; + } - function reTrieve($id, $val) { - echo __METHOD__ . "($id,$val)\n"; - return array($id=>$val); - } + function reTrieve($id, $val) { + echo __METHOD__ . "($id,$val)\n"; + return array($id=>$val); + } } $select1 = $db->prepare('SELECT grp, id FROM test'); @@ -40,24 +40,24 @@ $derived = $db->prepare('SELECT id, val FROM test', array(PDO::ATTR_STATEMENT_CL class Test1 { - public function __construct($id, $val) - { - echo __METHOD__ . "($id,$val)\n"; - $this->id = $id; - $this->val = $val; - } + public function __construct($id, $val) + { + echo __METHOD__ . "($id,$val)\n"; + $this->id = $id; + $this->val = $val; + } - static public function factory($id, $val) - { - echo __METHOD__ . "($id,$val)\n"; - return new self($id, $val); - } + static public function factory($id, $val) + { + echo __METHOD__ . "($id,$val)\n"; + return new self($id, $val); + } } function test($id,$val='N/A') { - echo __METHOD__ . "($id,$val)\n"; - return array($id=>$val); + echo __METHOD__ . "($id,$val)\n"; + return array($id=>$val); } $f = new Test1(0,0); diff --git a/ext/pdo/tests/pdo_012.phpt b/ext/pdo/tests/pdo_012.phpt index 0570f446cf..1acad839de 100644 --- a/ext/pdo/tests/pdo_012.phpt +++ b/ext/pdo/tests/pdo_012.phpt @@ -25,10 +25,10 @@ var_dump($stmt->fetchAll()); class Test { - function __construct($name = 'N/A') - { - echo __METHOD__ . "($name)\n"; - } + function __construct($name = 'N/A') + { + echo __METHOD__ . "($name)\n"; + } } unset($stmt); diff --git a/ext/pdo/tests/pdo_013.phpt b/ext/pdo/tests/pdo_013.phpt index ab40738051..133fa40f19 100644 --- a/ext/pdo/tests/pdo_013.phpt +++ b/ext/pdo/tests/pdo_013.phpt @@ -26,22 +26,22 @@ $stmt->execute(); $stmt->setFetchMode(PDO::FETCH_NUM); foreach ($stmt as $data) { - var_dump($data); + var_dump($data); } class Test { - function __construct($name = 'N/A') - { - echo __METHOD__ . "($name)\n"; - } + function __construct($name = 'N/A') + { + echo __METHOD__ . "($name)\n"; + } } unset($stmt); foreach ($db->query($SELECT, PDO::FETCH_CLASS, 'Test') as $data) { - var_dump($data); + var_dump($data); } unset($stmt); @@ -50,7 +50,7 @@ $stmt = $db->query($SELECT, PDO::FETCH_CLASS, 'Test', array('WOW')); foreach($stmt as $data) { - var_dump($data); + var_dump($data); } ?> --EXPECTF-- diff --git a/ext/pdo/tests/pdo_014.phpt b/ext/pdo/tests/pdo_014.phpt index 5c7774f2cd..ef47fd89d0 100644 --- a/ext/pdo/tests/pdo_014.phpt +++ b/ext/pdo/tests/pdo_014.phpt @@ -21,10 +21,10 @@ $SELECT = 'SELECT val, grp FROM test'; class Test { - function __construct($name = 'N/A') - { - echo __METHOD__ . "($name)\n"; - } + function __construct($name = 'N/A') + { + echo __METHOD__ . "($name)\n"; + } } $stmt = $db->query($SELECT, PDO::FETCH_CLASS, 'Test', array('WOW')); @@ -35,7 +35,7 @@ $it = new IteratorIterator($stmt); /* check if we can convert that thing */ foreach($it as $data) { - var_dump($data); + var_dump($data); } $it->next(); /* must be allowed */ @@ -44,26 +44,26 @@ var_dump($it->valid()); /* must return false */ class PDOStatementAggregate extends PDOStatement implements IteratorAggregate { - private function __construct() - { - echo __METHOD__ . "\n"; - $this->setFetchMode(PDO::FETCH_NUM); - /* default fetch mode is BOTH, so we see if the ctor can overwrite that */ - } + private function __construct() + { + echo __METHOD__ . "\n"; + $this->setFetchMode(PDO::FETCH_NUM); + /* default fetch mode is BOTH, so we see if the ctor can overwrite that */ + } - function getIterator() - { - echo __METHOD__ . "\n"; - $this->execute(); - return new IteratorIterator($this, 'PDOStatement'); - } + function getIterator() + { + echo __METHOD__ . "\n"; + $this->execute(); + return new IteratorIterator($this, 'PDOStatement'); + } } $stmt = $db->prepare($SELECT, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementAggregate'))); foreach($stmt as $data) { - var_dump($data); + var_dump($data); } ?> diff --git a/ext/pdo/tests/pdo_016.phpt b/ext/pdo/tests/pdo_016.phpt index 6879faa5b9..69a70a1a4b 100644 --- a/ext/pdo/tests/pdo_016.phpt +++ b/ext/pdo/tests/pdo_016.phpt @@ -16,7 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); } $db->exec('CREATE TABLE test(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); @@ -42,7 +42,7 @@ $stmt2->bindColumn('txt', $txt); $stmt2->execute(); while($stmt2->fetch(PDO::FETCH_BOUND)) { - var_dump(array($idx=>$txt)); + var_dump(array($idx=>$txt)); } echo "===ALONE===\n"; @@ -55,26 +55,26 @@ $stmt4->bindParam(':txt', $txt); /* using same name */ foreach($cont as $idx => $txt) { - var_dump(array($idx=>$txt)); - var_dump($stmt3->execute()); - - if ($idx == 0) { - /* portability-wise, you may only bindColumn()s - * after execute() has been called at least once */ - $stmt3->bindColumn('txt', $col1); - } - var_dump($stmt3->fetch(PDO::FETCH_BOUND)); - $stmt3->closeCursor(); - - var_dump($stmt4->execute()); - if ($idx == 0) { - /* portability-wise, you may only bindColumn()s - * after execute() has been called at least once */ - $stmt4->bindColumn('idx', $col2); - } - var_dump($stmt4->fetch(PDO::FETCH_BOUND)); - $stmt4->closeCursor(); - var_dump(array($col2=>$col1)); + var_dump(array($idx=>$txt)); + var_dump($stmt3->execute()); + + if ($idx == 0) { + /* portability-wise, you may only bindColumn()s + * after execute() has been called at least once */ + $stmt3->bindColumn('txt', $col1); + } + var_dump($stmt3->fetch(PDO::FETCH_BOUND)); + $stmt3->closeCursor(); + + var_dump($stmt4->execute()); + if ($idx == 0) { + /* portability-wise, you may only bindColumn()s + * after execute() has been called at least once */ + $stmt4->bindColumn('idx', $col2); + } + var_dump($stmt4->fetch(PDO::FETCH_BOUND)); + $stmt4->closeCursor(); + var_dump(array($col2=>$col1)); } echo "===REBIND/SAME===\n"; @@ -83,15 +83,15 @@ $stmt4->bindColumn('idx', $col1); foreach($cont as $idx => $txt) { - var_dump(array($idx=>$txt)); - var_dump($stmt3->execute()); - var_dump($stmt3->fetch(PDO::FETCH_BOUND)); - $stmt3->closeCursor(); - var_dump($col1); - var_dump($stmt4->execute()); - var_dump($stmt4->fetch(PDO::FETCH_BOUND)); - $stmt4->closeCursor(); - var_dump($col1); + var_dump(array($idx=>$txt)); + var_dump($stmt3->execute()); + var_dump($stmt3->fetch(PDO::FETCH_BOUND)); + $stmt3->closeCursor(); + var_dump($col1); + var_dump($stmt4->execute()); + var_dump($stmt4->fetch(PDO::FETCH_BOUND)); + $stmt4->closeCursor(); + var_dump($col1); } echo "===REBIND/CONFLICT===\n"; @@ -102,7 +102,7 @@ $stmt2->execute(); while($stmt2->fetch(PDO::FETCH_BOUND)) { - var_dump($col1); + var_dump($col1); } diff --git a/ext/pdo/tests/pdo_016a.phpt b/ext/pdo/tests/pdo_016a.phpt index 9f07516f8e..5f64d462d6 100644 --- a/ext/pdo/tests/pdo_016a.phpt +++ b/ext/pdo/tests/pdo_016a.phpt @@ -16,7 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); } $db->exec('CREATE TABLE test(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); @@ -42,7 +42,7 @@ $stmt2->bindColumn('txt', $txt); $stmt2->execute(); while($stmt2->fetch(PDO::FETCH_BOUND)) { - var_dump(array($idx=>$txt)); + var_dump(array($idx=>$txt)); } echo "===ALONE===\n"; @@ -55,26 +55,26 @@ $stmt4->bindParam('txt', $txt); /* using same name */ foreach($cont as $idx => $txt) { - var_dump(array($idx=>$txt)); - var_dump($stmt3->execute()); - - if ($idx == 0) { - /* portability-wise, you may only bindColumn()s - * after execute() has been called at least once */ - $stmt3->bindColumn('txt', $col1); - } - var_dump($stmt3->fetch(PDO::FETCH_BOUND)); - $stmt3->closeCursor(); - - var_dump($stmt4->execute()); - if ($idx == 0) { - /* portability-wise, you may only bindColumn()s - * after execute() has been called at least once */ - $stmt4->bindColumn('idx', $col2); - } - var_dump($stmt4->fetch(PDO::FETCH_BOUND)); - $stmt4->closeCursor(); - var_dump(array($col2=>$col1)); + var_dump(array($idx=>$txt)); + var_dump($stmt3->execute()); + + if ($idx == 0) { + /* portability-wise, you may only bindColumn()s + * after execute() has been called at least once */ + $stmt3->bindColumn('txt', $col1); + } + var_dump($stmt3->fetch(PDO::FETCH_BOUND)); + $stmt3->closeCursor(); + + var_dump($stmt4->execute()); + if ($idx == 0) { + /* portability-wise, you may only bindColumn()s + * after execute() has been called at least once */ + $stmt4->bindColumn('idx', $col2); + } + var_dump($stmt4->fetch(PDO::FETCH_BOUND)); + $stmt4->closeCursor(); + var_dump(array($col2=>$col1)); } echo "===REBIND/SAME===\n"; @@ -83,15 +83,15 @@ $stmt4->bindColumn('idx', $col1); foreach($cont as $idx => $txt) { - var_dump(array($idx=>$txt)); - var_dump($stmt3->execute()); - var_dump($stmt3->fetch(PDO::FETCH_BOUND)); - $stmt3->closeCursor(); - var_dump($col1); - var_dump($stmt4->execute()); - var_dump($stmt4->fetch(PDO::FETCH_BOUND)); - $stmt4->closeCursor(); - var_dump($col1); + var_dump(array($idx=>$txt)); + var_dump($stmt3->execute()); + var_dump($stmt3->fetch(PDO::FETCH_BOUND)); + $stmt3->closeCursor(); + var_dump($col1); + var_dump($stmt4->execute()); + var_dump($stmt4->fetch(PDO::FETCH_BOUND)); + $stmt4->closeCursor(); + var_dump($col1); } echo "===REBIND/CONFLICT===\n"; @@ -102,7 +102,7 @@ $stmt2->execute(); while($stmt2->fetch(PDO::FETCH_BOUND)) { - var_dump($col1); + var_dump($col1); } diff --git a/ext/pdo/tests/pdo_017.phpt b/ext/pdo/tests/pdo_017.phpt index 32018da6e1..f06ebbdc43 100644 --- a/ext/pdo/tests/pdo_017.phpt +++ b/ext/pdo/tests/pdo_017.phpt @@ -29,10 +29,10 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { - require_once(__DIR__ . DIRECTORY_SEPARATOR . '../../pdo_mysql/tests/mysql_pdo_test.inc'); - $suf = ' ENGINE=' . MySQLPDOTest::detect_transactional_mysql_engine($db); + require_once(__DIR__ . DIRECTORY_SEPARATOR . '../../pdo_mysql/tests/mysql_pdo_test.inc'); + $suf = ' ENGINE=' . MySQLPDOTest::detect_transactional_mysql_engine($db); } else { - $suf = ''; + $suf = ''; } $db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'.$suf); @@ -43,8 +43,8 @@ $delete = $db->prepare('DELETE FROM test'); function countRows($action) { global $db; - $select = $db->prepare('SELECT COUNT(*) FROM test'); - $select->execute(); + $select = $db->prepare('SELECT COUNT(*) FROM test'); + $select->execute(); $res = $select->fetchColumn(); return "Counted $res rows after $action.\n"; } diff --git a/ext/pdo/tests/pdo_018.phpt b/ext/pdo/tests/pdo_018.phpt index b99cb80968..d35e078b32 100644 --- a/ext/pdo/tests/pdo_018.phpt +++ b/ext/pdo/tests/pdo_018.phpt @@ -16,50 +16,50 @@ $db = PDOTest::factory(); class TestBase implements Serializable { - public $BasePub = 'Public'; - protected $BasePro = 'Protected'; - private $BasePri = 'Private'; + public $BasePub = 'Public'; + protected $BasePro = 'Protected'; + private $BasePri = 'Private'; - function serialize() - { - $serialized = array(); - foreach($this as $prop => $val) { - $serialized[$prop] = $val; - } - $serialized = serialize($serialized); - echo __METHOD__ . "() = '$serialized'\n"; - return $serialized; - } + function serialize() + { + $serialized = array(); + foreach($this as $prop => $val) { + $serialized[$prop] = $val; + } + $serialized = serialize($serialized); + echo __METHOD__ . "() = '$serialized'\n"; + return $serialized; + } - function unserialize($serialized) - { - echo __METHOD__ . "($serialized)\n"; - foreach(unserialize($serialized) as $prop => $val) { - $this->$prop = '#'.$val; - } - return true; - } + function unserialize($serialized) + { + echo __METHOD__ . "($serialized)\n"; + foreach(unserialize($serialized) as $prop => $val) { + $this->$prop = '#'.$val; + } + return true; + } } class TestDerived extends TestBase { - public $BasePub = 'DerivedPublic'; - protected $BasePro = 'DerivdeProtected'; - public $DerivedPub = 'Public'; - protected $DerivedPro = 'Protected'; - private $DerivedPri = 'Private'; + public $BasePub = 'DerivedPublic'; + protected $BasePro = 'DerivdeProtected'; + public $DerivedPub = 'Public'; + protected $DerivedPro = 'Protected'; + private $DerivedPri = 'Private'; - function serialize() - { - echo __METHOD__ . "()\n"; - return TestBase::serialize(); - } + function serialize() + { + echo __METHOD__ . "()\n"; + return TestBase::serialize(); + } - function unserialize($serialized) - { - echo __METHOD__ . "()\n"; - return TestBase::unserialize($serialized); - } + function unserialize($serialized) + { + echo __METHOD__ . "()\n"; + return TestBase::unserialize($serialized); + } } class TestLeaf extends TestDerived @@ -101,12 +101,12 @@ $ctypes = array(); foreach($objs as $obj) { - $cname = get_class($obj); - $ctype = NULL; /* set default for non stored class name */ - $stmt->execute(); - $stmt->bindColumn('id', $ctype); - $stmt->fetch(PDO::FETCH_BOUND); - $ctypes[$cname] = $ctype; + $cname = get_class($obj); + $ctype = NULL; /* set default for non stored class name */ + $stmt->execute(); + $stmt->bindColumn('id', $ctype); + $stmt->fetch(PDO::FETCH_BOUND); + $ctypes[$cname] = $ctype; } echo "===TYPES===\n"; @@ -122,16 +122,16 @@ $stmt->bindParam(':val', $val); foreach($objs as $idx => $obj) { - $ctype = $ctypes[get_class($obj)]; - if (method_exists($obj, 'serialize')) - { - $val = $obj->serialize(); - } - else - { - $val = ''; - } - $stmt->execute(); + $ctype = $ctypes[get_class($obj)]; + if (method_exists($obj, 'serialize')) + { + $val = $obj->serialize(); + } + else + { + $val = ''; + } + $stmt->execute(); } unset($stmt); @@ -140,31 +140,31 @@ echo "===DATA===\n"; $res = $db->query('SELECT test.val FROM test')->fetchAll(PDO::FETCH_COLUMN); switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { - case 'dblib': - // map whitespace (from early TDS versions) to empty string so the test doesn't diff - if ($res[0] === ' ') { - $res[0] = ''; - } - break; + case 'dblib': + // map whitespace (from early TDS versions) to empty string so the test doesn't diff + if ($res[0] === ' ') { + $res[0] = ''; + } + break; - case 'oci': - // map NULL to empty string so the test doesn't diff - if ($res[0] === null) { - $res[0] = ''; - } - break; + case 'oci': + // map NULL to empty string so the test doesn't diff + if ($res[0] === null) { + $res[0] = ''; + } + break; } var_dump($res); echo "===FAILURE===\n"; try { - $db->query('SELECT classtypes.name AS name, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id')->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_SERIALIZE, 'TestLeaf', array()); + $db->query('SELECT classtypes.name AS name, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id')->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_SERIALIZE, 'TestLeaf', array()); } catch (PDOException $e) { - echo 'Exception:'; - echo $e->getMessage()."\n"; + echo 'Exception:'; + echo $e->getMessage()."\n"; } echo "===COUNT===\n"; diff --git a/ext/pdo/tests/pdo_019.phpt b/ext/pdo/tests/pdo_019.phpt index 68c5311b41..f37b9b13a5 100644 --- a/ext/pdo/tests/pdo_019.phpt +++ b/ext/pdo/tests/pdo_019.phpt @@ -36,7 +36,7 @@ $stmt->bindColumn('txt', $txt); $stmt->execute(); while($stmt->fetch(PDO::FETCH_BOUND)) { - var_dump(array($idx=>$txt)); + var_dump(array($idx=>$txt)); } ?> diff --git a/ext/pdo/tests/pdo_020.phpt b/ext/pdo/tests/pdo_020.phpt index 32f53d840e..4586cc202d 100644 --- a/ext/pdo/tests/pdo_020.phpt +++ b/ext/pdo/tests/pdo_020.phpt @@ -21,10 +21,10 @@ $db->exec("INSERT INTO test VALUES(3, 'C', 'C')"); foreach (array('SELECT id, val FROM test', 'SELECT id, val, val2 FROM test', 'SELECT COUNT(*) FROM test') as $sql) { - $stmt = $db->query($sql); - $res = $stmt->columnCount(); + $stmt = $db->query($sql); + $res = $stmt->columnCount(); echo "Counted $res columns after $sql.\n"; - $stmt = null; + $stmt = null; } ?> diff --git a/ext/pdo/tests/pdo_021.phpt b/ext/pdo/tests/pdo_021.phpt index 10b8029c20..b627c453bf 100644 --- a/ext/pdo/tests/pdo_021.phpt +++ b/ext/pdo/tests/pdo_021.phpt @@ -15,7 +15,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); } $db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); diff --git a/ext/pdo/tests/pdo_023.phpt b/ext/pdo/tests/pdo_023.phpt index e021e67881..61c614ba52 100644 --- a/ext/pdo/tests/pdo_023.phpt +++ b/ext/pdo/tests/pdo_023.phpt @@ -19,14 +19,14 @@ class PDOStatementX extends PDOStatement protected function __construct() { - $this->test2 = 2; - $this->test2 = 22; - echo __METHOD__ . "()\n"; + $this->test2 = 2; + $this->test2 = 22; + echo __METHOD__ . "()\n"; } function __destruct() { - echo __METHOD__ . "()\n"; + echo __METHOD__ . "()\n"; } } @@ -36,23 +36,23 @@ class PDODatabaseX extends PDO function __destruct() { - echo __METHOD__ . "()\n"; + echo __METHOD__ . "()\n"; } function test() { - $this->test2 = 2; + $this->test2 = 2; var_dump($this->test1); var_dump($this->test2); - $this->test2 = 22; + $this->test2 = 22; } function query($sql) { - echo __METHOD__ . "()\n"; - $stmt = parent::prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx'))); - $stmt->execute(); - return $stmt; + echo __METHOD__ . "()\n"; + $stmt = parent::prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx'))); + $stmt->execute(); + return $stmt; } } diff --git a/ext/pdo/tests/pdo_024.phpt b/ext/pdo/tests/pdo_024.phpt index 042322871f..6f8063cc80 100644 --- a/ext/pdo/tests/pdo_024.phpt +++ b/ext/pdo/tests/pdo_024.phpt @@ -15,14 +15,14 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { - case 'dblib': - // environment settings can influence how the table is created if specifics are missing - // https://msdn.microsoft.com/en-us/library/ms174979.aspx#Nullability Rules Within a Table Definition - $sql = 'create table test (id int, name varchar(10) null)'; - break; - default: - $sql = 'create table test (id int, name varchar(10))'; - break; + case 'dblib': + // environment settings can influence how the table is created if specifics are missing + // https://msdn.microsoft.com/en-us/library/ms174979.aspx#Nullability Rules Within a Table Definition + $sql = 'create table test (id int, name varchar(10) null)'; + break; + default: + $sql = 'create table test (id int, name varchar(10))'; + break; } $db->exec($sql); @@ -31,9 +31,9 @@ $name = NULL; $before_bind = $name; $stmt->bindParam(':name', $name, PDO::PARAM_NULL); if ($name !== $before_bind) { - echo "bind: fail\n"; + echo "bind: fail\n"; } else { - echo "bind: success\n"; + echo "bind: success\n"; } var_dump($stmt->execute()); var_dump($db->query('select name from test where id=0')->fetchColumn()); diff --git a/ext/pdo/tests/pdo_025.phpt b/ext/pdo/tests/pdo_025.phpt index 43cc542a00..7bbd9b92f2 100644 --- a/ext/pdo/tests/pdo_025.phpt +++ b/ext/pdo/tests/pdo_025.phpt @@ -33,7 +33,7 @@ foreach ($data as $row) { } class Test { - public $id, $val, $val2; + public $id, $val, $val2; } $stmt = $db->prepare('SELECT * FROM test'); @@ -41,21 +41,21 @@ $stmt->setFetchMode(PDO::FETCH_INTO, new Test); $stmt->execute(); foreach($stmt as $obj) { - var_dump($obj); + var_dump($obj); } echo "===FAIL===\n"; class Fail { - protected $id; - public $val, $val2; + protected $id; + public $val, $val2; } $stmt->setFetchMode(PDO::FETCH_INTO, new Fail); $stmt->execute(); foreach($stmt as $obj) { - var_dump($obj); + var_dump($obj); } ?> diff --git a/ext/pdo/tests/pdo_026.phpt b/ext/pdo/tests/pdo_026.phpt index 8f72aff6e1..4bb1890b36 100644 --- a/ext/pdo/tests/pdo_026.phpt +++ b/ext/pdo/tests/pdo_026.phpt @@ -25,13 +25,13 @@ class PDOStatementX extends PDOStatement protected function __construct($dbh) { - $this->dbh = $dbh; - echo __METHOD__ . "()\n"; + $this->dbh = $dbh; + echo __METHOD__ . "()\n"; } function __destruct() { - echo __METHOD__ . "()\n"; + echo __METHOD__ . "()\n"; } } @@ -39,16 +39,16 @@ class PDODatabase extends PDO { function __destruct() { - echo __METHOD__ . "()\n"; + echo __METHOD__ . "()\n"; } function query($sql) { - echo __METHOD__ . "()\n"; - $stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this)))); - $stmt->setFetchMode(PDO::FETCH_ASSOC); - $stmt->execute(); - return $stmt; + echo __METHOD__ . "()\n"; + $stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this)))); + $stmt->setFetchMode(PDO::FETCH_ASSOC); + $stmt->execute(); + return $stmt; } } @@ -70,7 +70,7 @@ var_dump(get_class($stmt)); var_dump(get_class($stmt->dbh)); foreach($stmt as $obj) { - var_dump($obj); + var_dump($obj); } echo "===DONE===\n"; diff --git a/ext/pdo/tests/pdo_027.phpt b/ext/pdo/tests/pdo_027.phpt index e10ab0aa75..79151d0b6d 100644 --- a/ext/pdo/tests/pdo_027.phpt +++ b/ext/pdo/tests/pdo_027.phpt @@ -19,7 +19,7 @@ $db->exec("INSERT INTO test (id,name) VALUES(1,'test1')"); $db->exec("INSERT INTO test (id,name) VALUES(2,'test2')"); foreach ($db->query("SELECT * FROM test", PDO::FETCH_LAZY) as $v) { - echo "lazy: " . $v->id.$v->name."\n"; + echo "lazy: " . $v->id.$v->name."\n"; } echo "End\n"; ?> diff --git a/ext/pdo/tests/pdo_028.phpt b/ext/pdo/tests/pdo_028.phpt index 726c28b2b8..427a22343c 100644 --- a/ext/pdo/tests/pdo_028.phpt +++ b/ext/pdo/tests/pdo_028.phpt @@ -20,7 +20,7 @@ $stmt = $db->prepare('INSERT INTO test values (1, ?, ?, ?)'); $data = array("one", "two", "three"); foreach ($data as $i => $v) { - $stmt->bindValue($i+1, $v); + $stmt->bindValue($i+1, $v); } $stmt->execute(); diff --git a/ext/pdo/tests/pdo_029.phpt b/ext/pdo/tests/pdo_029.phpt index 8204de236a..10ab369128 100644 --- a/ext/pdo/tests/pdo_029.phpt +++ b/ext/pdo/tests/pdo_029.phpt @@ -25,19 +25,19 @@ class PDOStatementX extends PDOStatement protected function __construct($dbh) { - $this->dbh = $dbh; - echo __METHOD__ . "()\n"; + $this->dbh = $dbh; + echo __METHOD__ . "()\n"; } function __destruct() { - echo __METHOD__ . "()\n"; + echo __METHOD__ . "()\n"; } function execute($params = array()) { - echo __METHOD__ . "()\n"; - parent::execute(); + echo __METHOD__ . "()\n"; + parent::execute(); } } @@ -45,16 +45,16 @@ class PDODatabase extends PDO { function __destruct() { - echo __METHOD__ . "()\n"; + echo __METHOD__ . "()\n"; } function query($sql) { - echo __METHOD__ . "()\n"; - $stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this)))); - $stmt->setFetchMode(PDO::FETCH_ASSOC); - $stmt->execute(); - return $stmt; + echo __METHOD__ . "()\n"; + $stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this)))); + $stmt->setFetchMode(PDO::FETCH_ASSOC); + $stmt->execute(); + return $stmt; } } @@ -80,7 +80,7 @@ var_dump(get_class($stmt->dbh)); echo "===FOREACH===\n"; foreach($stmt as $obj) { - var_dump($obj); + var_dump($obj); } echo "===DONE===\n"; diff --git a/ext/pdo/tests/pdo_030.phpt b/ext/pdo/tests/pdo_030.phpt index bc697d7108..2d054e0dd6 100644 --- a/ext/pdo/tests/pdo_030.phpt +++ b/ext/pdo/tests/pdo_030.phpt @@ -25,20 +25,20 @@ class PDOStatementX extends PDOStatement protected function __construct($dbh) { - $this->dbh = $dbh; - $this->setFetchMode(PDO::FETCH_ASSOC); - echo __METHOD__ . "()\n"; + $this->dbh = $dbh; + $this->setFetchMode(PDO::FETCH_ASSOC); + echo __METHOD__ . "()\n"; } function __destruct() { - echo __METHOD__ . "()\n"; + echo __METHOD__ . "()\n"; } function execute($params = array()) { - echo __METHOD__ . "()\n"; - parent::execute(); + echo __METHOD__ . "()\n"; + parent::execute(); } } @@ -46,13 +46,13 @@ class PDODatabase extends PDO { function __destruct() { - echo __METHOD__ . "()\n"; + echo __METHOD__ . "()\n"; } function query($sql) { - echo __METHOD__ . "()\n"; - return parent::query($sql); + echo __METHOD__ . "()\n"; + return parent::query($sql); } } @@ -81,7 +81,7 @@ var_dump(get_class($stmt->dbh)); echo "===FOREACH===\n"; foreach($stmt as $obj) { - var_dump($obj); + var_dump($obj); } echo "===DONE===\n"; diff --git a/ext/pdo/tests/pdo_031.phpt b/ext/pdo/tests/pdo_031.phpt index 689f7624ce..bf1d0e06ca 100644 --- a/ext/pdo/tests/pdo_031.phpt +++ b/ext/pdo/tests/pdo_031.phpt @@ -36,7 +36,7 @@ $stmt = $db->query('SELECT * FROM test'); foreach(new RecursiveTreeIterator(new RecursiveArrayIterator($stmt->fetchAll(PDO::FETCH_ASSOC)), RecursiveTreeIterator::BYPASS_KEY) as $c=>$v) { - echo "$v [$c]\n"; + echo "$v [$c]\n"; } echo "===DONE===\n"; diff --git a/ext/pdo/tests/pdo_034.phpt b/ext/pdo/tests/pdo_034.phpt index 4f66356729..3a504b6dea 100644 --- a/ext/pdo/tests/pdo_034.phpt +++ b/ext/pdo/tests/pdo_034.phpt @@ -17,7 +17,7 @@ $db = PDOTest::factory(); $db->exec("CREATE TABLE test (a varchar(100), b varchar(100), c varchar(100))"); for ($i = 0; $i < 5; $i++) { - $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')"); + $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')"); } var_dump($db->query("SELECT a,b FROM test")->fetch(PDO::FETCH_KEY_PAIR)); diff --git a/ext/pdo/tests/pdo_dsn_containing_credentials.phpt b/ext/pdo/tests/pdo_dsn_containing_credentials.phpt index dca3ba1709..94859e5360 100644 --- a/ext/pdo/tests/pdo_dsn_containing_credentials.phpt +++ b/ext/pdo/tests/pdo_dsn_containing_credentials.phpt @@ -15,36 +15,36 @@ PDOTest::skip(); ?> --FILE-- <?php - require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; - - $orgDsn = getenv('PDOTEST_DSN'); - $orgUser = getenv('PDOTEST_USER'); - $orgPass = getenv('PDOTEST_PASS'); - - try - { - putenv("PDOTEST_DSN=$orgDsn;user=$orgUser;password=$orgPass"); - putenv("PDOTEST_USER"); - putenv("PDOTEST_PASS"); - - $link = PDOTest::factory(); - echo "using credentials in dsn: done\n"; - - - // test b/c - credentials in DSN are ignored when user/pass passed as separate params - putenv("PDOTEST_DSN=$orgDsn;user=incorrect;password=ignored"); - putenv("PDOTEST_USER=$orgUser"); - putenv("PDOTEST_PASS=$orgPass"); - - $link = PDOTest::factory(); - echo "ignoring credentials in dsn: done\n"; - } - finally - { - putenv("PDOTEST_DSN=$orgDsn"); - putenv("PDOTEST_USER=$orgUser"); - putenv("PDOTEST_PASS=$orgPass"); - } + require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; + + $orgDsn = getenv('PDOTEST_DSN'); + $orgUser = getenv('PDOTEST_USER'); + $orgPass = getenv('PDOTEST_PASS'); + + try + { + putenv("PDOTEST_DSN=$orgDsn;user=$orgUser;password=$orgPass"); + putenv("PDOTEST_USER"); + putenv("PDOTEST_PASS"); + + $link = PDOTest::factory(); + echo "using credentials in dsn: done\n"; + + + // test b/c - credentials in DSN are ignored when user/pass passed as separate params + putenv("PDOTEST_DSN=$orgDsn;user=incorrect;password=ignored"); + putenv("PDOTEST_USER=$orgUser"); + putenv("PDOTEST_PASS=$orgPass"); + + $link = PDOTest::factory(); + echo "ignoring credentials in dsn: done\n"; + } + finally + { + putenv("PDOTEST_DSN=$orgDsn"); + putenv("PDOTEST_USER=$orgUser"); + putenv("PDOTEST_PASS=$orgPass"); + } ?> --EXPECTF-- using credentials in dsn: done diff --git a/ext/pdo/tests/pdo_test.inc b/ext/pdo/tests/pdo_test.inc index 443c8dd822..2238123d40 100644 --- a/ext/pdo/tests/pdo_test.inc +++ b/ext/pdo/tests/pdo_test.inc @@ -2,83 +2,83 @@ # PDO test framework utilities if (getenv('PDOTEST_DSN') === false) { - $common = ''; - $append = false; - foreach(file(dirname($_SERVER['PHP_SELF']).'/common.phpt') as $line) { - if ($append) { - $common .= $line; - } elseif (trim($line) == '--REDIRECTTEST--') { - $append = true; - } - } - $conf = eval($common); - foreach($conf['ENV'] as $n=>$v) putenv("$n=$v"); + $common = ''; + $append = false; + foreach(file(dirname($_SERVER['PHP_SELF']).'/common.phpt') as $line) { + if ($append) { + $common .= $line; + } elseif (trim($line) == '--REDIRECTTEST--') { + $append = true; + } + } + $conf = eval($common); + foreach($conf['ENV'] as $n=>$v) putenv("$n=$v"); } class PDOTest { - // create an instance of the PDO driver, based on - // the current environment - static function factory($classname = 'PDO', $drop_test_tables = true) { - $dsn = getenv('PDOTEST_DSN'); - $user = getenv('PDOTEST_USER'); - $pass = getenv('PDOTEST_PASS'); - $attr = getenv('PDOTEST_ATTR'); - if (is_string($attr) && strlen($attr)) { - $attr = unserialize($attr); - } else { - $attr = null; - } + // create an instance of the PDO driver, based on + // the current environment + static function factory($classname = 'PDO', $drop_test_tables = true) { + $dsn = getenv('PDOTEST_DSN'); + $user = getenv('PDOTEST_USER'); + $pass = getenv('PDOTEST_PASS'); + $attr = getenv('PDOTEST_ATTR'); + if (is_string($attr) && strlen($attr)) { + $attr = unserialize($attr); + } else { + $attr = null; + } - if ($user === false) $user = NULL; - if ($pass === false) $pass = NULL; + if ($user === false) $user = NULL; + if ($pass === false) $pass = NULL; - $db = new $classname($dsn, $user, $pass, $attr); + $db = new $classname($dsn, $user, $pass, $attr); - if (!$db) { - die("Could not create PDO object (DSN=$dsn, user=$user)\n"); - } + if (!$db) { + die("Could not create PDO object (DSN=$dsn, user=$user)\n"); + } - // clean up any crufty test tables we might have left behind - // on a previous run - static $test_tables = array( - 'test', - 'test2', - 'classtypes' - ); - if ($drop_test_tables) { - foreach ($test_tables as $table) { - $db->exec("DROP TABLE $table"); - } - } + // clean up any crufty test tables we might have left behind + // on a previous run + static $test_tables = array( + 'test', + 'test2', + 'classtypes' + ); + if ($drop_test_tables) { + foreach ($test_tables as $table) { + $db->exec("DROP TABLE $table"); + } + } - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); - return $db; - } + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + return $db; + } - static function skip() { - try { - $db = PDOTest::factory(); - } catch (PDOException $e) { - die("skip " . $e->getMessage()); - } - } + static function skip() { + try { + $db = PDOTest::factory(); + } catch (PDOException $e) { + die("skip " . $e->getMessage()); + } + } - static function test_factory($file) { - $config = self::get_config($file); - foreach ($config['ENV'] as $k => $v) { - putenv("$k=$v"); - } - return self::factory(); - } + static function test_factory($file) { + $config = self::get_config($file); + foreach ($config['ENV'] as $k => $v) { + putenv("$k=$v"); + } + return self::factory(); + } - static function get_config($file) { - $data = file_get_contents($file); - $data = preg_replace('/^.*--REDIRECTTEST--/s', '', $data); - $config = eval($data); + static function get_config($file) { + $data = file_get_contents($file); + $data = preg_replace('/^.*--REDIRECTTEST--/s', '', $data); + $config = eval($data); - return $config; - } + return $config; + } } ?> diff --git a/ext/pdo/tests/pecl_bug_5217.phpt b/ext/pdo/tests/pecl_bug_5217.phpt index 458092d25f..6e97ca48c6 100644 --- a/ext/pdo/tests/pecl_bug_5217.phpt +++ b/ext/pdo/tests/pecl_bug_5217.phpt @@ -14,12 +14,12 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); try { - $ser = serialize($db); - debug_zval_dump($ser); - $db = unserialize($ser); - $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); + $ser = serialize($db); + debug_zval_dump($ser); + $db = unserialize($ser); + $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); } catch (Exception $e) { - echo "Safely caught " . $e->getMessage() . "\n"; + echo "Safely caught " . $e->getMessage() . "\n"; } echo "PHP Didn't crash!\n"; diff --git a/ext/pdo/tests/pecl_bug_5772.phpt b/ext/pdo/tests/pecl_bug_5772.phpt index 5363d80cee..28cae695b7 100644 --- a/ext/pdo/tests/pecl_bug_5772.phpt +++ b/ext/pdo/tests/pecl_bug_5772.phpt @@ -18,11 +18,11 @@ $db->exec("CREATE TABLE test (id int NOT NULL, PRIMARY KEY (id))"); $db->exec("INSERT INTO test (id) VALUES (1)"); function heLLO($row) { - return $row; + return $row; } foreach ($db->query("SELECT * FROM test")->fetchAll(PDO::FETCH_FUNC, 'heLLO') as $row) { - var_dump($row); + var_dump($row); } --EXPECT-- string(1) "1" diff --git a/ext/pdo_dblib/tests/bug_50755.phpt b/ext/pdo_dblib/tests/bug_50755.phpt index 33b776c145..17ce3a1214 100644 --- a/ext/pdo_dblib/tests/bug_50755.phpt +++ b/ext/pdo_dblib/tests/bug_50755.phpt @@ -18,7 +18,7 @@ cross join information_schema.columns ic3"); $x = $stmt->execute(); $n = 0; while (($r = $stmt->fetch())) { - $n++; + $n++; } $stmt = null; diff --git a/ext/pdo_dblib/tests/config.inc b/ext/pdo_dblib/tests/config.inc index 2723090f08..165f1d9330 100644 --- a/ext/pdo_dblib/tests/config.inc +++ b/ext/pdo_dblib/tests/config.inc @@ -3,50 +3,50 @@ // bug #72969 reflects a bug with FreeTDS, not with pdo_dblib // this function will version detect so the relevant tests can XFAILIF function driver_supports_batch_statements_without_select($db) { - $version = $db->getAttribute(PDO::DBLIB_ATTR_VERSION); + $version = $db->getAttribute(PDO::DBLIB_ATTR_VERSION); - // assume driver doesn't have this bug if not using FreeTDS - if (!strstartswith($version, 'freetds ')) { - return true; - } + // assume driver doesn't have this bug if not using FreeTDS + if (!strstartswith($version, 'freetds ')) { + return true; + } - // hasn't made it to numbered release yet - if (!strstartswith($version, 'freetds v1.1.dev.')) { - return false; - } + // hasn't made it to numbered release yet + if (!strstartswith($version, 'freetds v1.1.dev.')) { + return false; + } - // fc820490336c50d5c175d2a15327383256add4c9 was committed on the 5th - return intval(substr($version, -8)) >= 20161206; + // fc820490336c50d5c175d2a15327383256add4c9 was committed on the 5th + return intval(substr($version, -8)) >= 20161206; } function strstartswith($haystack, $needle) { - return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false; + return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false; } if (false !== getenv('PDO_DBLIB_TEST_DSN')) { - $dsn = getenv('PDO_DBLIB_TEST_DSN'); + $dsn = getenv('PDO_DBLIB_TEST_DSN'); } else { - $dsn = 'dblib:host=localhost;dbname=test'; + $dsn = 'dblib:host=localhost;dbname=test'; } if (false !== getenv('PDO_DBLIB_TEST_USER')) { - $user = getenv('PDO_DBLIB_TEST_USER'); + $user = getenv('PDO_DBLIB_TEST_USER'); } else { - $user = 'php'; + $user = 'php'; } if (false !== getenv('PDO_DBLIB_TEST_PASS')) { - $pass = getenv('PDO_DBLIB_TEST_PASS'); + $pass = getenv('PDO_DBLIB_TEST_PASS'); } else { - $pass = 'password'; + $pass = 'password'; } try { - $db = new PDO($dsn, $user, $pass); - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); + $db = new PDO($dsn, $user, $pass); + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); } catch (PDOException $e) { - die('skip ' . $e->getMessage()); + die('skip ' . $e->getMessage()); } ?> diff --git a/ext/pdo_dblib/tests/timeout.phpt b/ext/pdo_dblib/tests/timeout.phpt index c0485c6d51..2ef20fd4fc 100644 --- a/ext/pdo_dblib/tests/timeout.phpt +++ b/ext/pdo_dblib/tests/timeout.phpt @@ -15,7 +15,7 @@ $sql = 'WAITFOR DELAY \'00:00:02\''; // querying without a timeout will succeed $stmt = $db->prepare($sql); if ($stmt->execute()) { - echo "OK\n"; + echo "OK\n"; } // regular timeout attribute, set after instance created, will affect query timeout, causing this query to fail @@ -23,12 +23,12 @@ $db = new PDO($dsn, $user, $pass); $db->setAttribute(PDO::ATTR_TIMEOUT, 1); $stmt = $db->prepare($sql); if (!$stmt->execute()) { - echo "OK\n"; + echo "OK\n"; - // expect some kind of error code - if ($stmt->errorCode() != '00000') { - echo "OK\n"; - } + // expect some kind of error code + if ($stmt->errorCode() != '00000') { + echo "OK\n"; + } } // pdo_dblib-specific timeout attribute, set after instance created, will control query timeout, causing this query to fail @@ -36,36 +36,36 @@ $db = new PDO($dsn, $user, $pass); $db->setAttribute(PDO::DBLIB_ATTR_QUERY_TIMEOUT, 1); $stmt = $db->prepare($sql); if (!$stmt->execute()) { - echo "OK\n"; + echo "OK\n"; - // expect some kind of error code - if ($stmt->errorCode() != '00000') { - echo "OK\n"; - } + // expect some kind of error code + if ($stmt->errorCode() != '00000') { + echo "OK\n"; + } } // regular timeout attribute will affect query timeout, causing this query to fail $db = new PDO($dsn, $user, $pass, [PDO::ATTR_TIMEOUT => 1]); $stmt = $db->prepare($sql); if (!$stmt->execute()) { - echo "OK\n"; + echo "OK\n"; - // expect some kind of error code - if ($stmt->errorCode() != '00000') { - echo "OK\n"; - } + // expect some kind of error code + if ($stmt->errorCode() != '00000') { + echo "OK\n"; + } } // pdo_dblib-specific timeout attribute will control query timeout, causing this query to fail $db = new PDO($dsn, $user, $pass, [PDO::DBLIB_ATTR_QUERY_TIMEOUT => 1]); $stmt = $db->prepare($sql); if (!$stmt->execute()) { - echo "OK\n"; + echo "OK\n"; - // expect some kind of error code - if ($stmt->errorCode() != '00000') { - echo "OK\n"; - } + // expect some kind of error code + if ($stmt->errorCode() != '00000') { + echo "OK\n"; + } } ?> diff --git a/ext/pdo_dblib/tests/types.phpt b/ext/pdo_dblib/tests/types.phpt index a4d4fd39f7..fa336d9fb4 100644 --- a/ext/pdo_dblib/tests/types.phpt +++ b/ext/pdo_dblib/tests/types.phpt @@ -10,31 +10,31 @@ require __DIR__ . '/config.inc'; require __DIR__ . '/config.inc'; function get_expected_float_string() { - global $db; + global $db; - switch ($db->getAttribute(PDO::DBLIB_ATTR_TDS_VERSION)) { - case '5.0': - case '6.0': - case '7.0': - case '7.1': - case '7.2': - case '8.0': - return '10.500'; - default: - return '10.5'; - } + switch ($db->getAttribute(PDO::DBLIB_ATTR_TDS_VERSION)) { + case '5.0': + case '6.0': + case '7.0': + case '7.1': + case '7.2': + case '8.0': + return '10.500'; + default: + return '10.5'; + } } $sql = " - SELECT - 'foo' AS [char], - CAST('2030-01-01 23:59:59' AS DATETIME) AS [datetime], - CAST(0 AS BIT) AS [false], - 10.500 AS [float], - 1000 AS [int], - CAST(10.500 AS MONEY) AS [money], - CAST('1950-01-18 23:00:00' AS SMALLDATETIME) as [smalldatetime], - CAST(1 AS BIT) AS [true] + SELECT + 'foo' AS [char], + CAST('2030-01-01 23:59:59' AS DATETIME) AS [datetime], + CAST(0 AS BIT) AS [false], + 10.500 AS [float], + 1000 AS [int], + CAST(10.500 AS MONEY) AS [money], + CAST('1950-01-18 23:00:00' AS SMALLDATETIME) as [smalldatetime], + CAST(1 AS BIT) AS [true] "; $stmt = $db->query($sql); diff --git a/ext/pdo_firebird/tests/bug_48877.phpt b/ext/pdo_firebird/tests/bug_48877.phpt index d685d0ac80..85da7d4285 100644 --- a/ext/pdo_firebird/tests/bug_48877.phpt +++ b/ext/pdo_firebird/tests/bug_48877.phpt @@ -8,7 +8,7 @@ PDO_Firebird: bug 48877 The "bindValue" and "bindParam" do not work for PDO Fire require("testdb.inc"); $value = '2'; - + @$dbh->exec('DROP TABLE testz'); $dbh->exec('CREATE TABLE testz (A integer)'); $dbh->exec("INSERT INTO testz VALUES ('1')"); diff --git a/ext/pdo_firebird/tests/bug_73087.phpt b/ext/pdo_firebird/tests/bug_73087.phpt index b676293e44..cd3d90137e 100644 --- a/ext/pdo_firebird/tests/bug_73087.phpt +++ b/ext/pdo_firebird/tests/bug_73087.phpt @@ -10,13 +10,13 @@ require 'testdb.inc'; $dbh->exec('create table atable (id integer not null, content blob sub_type 1 segment size 80)'); $S = $dbh->prepare('insert into atable (id, content) values (:id, :content)'); for ($I = 1; $I < 10; $I++) { - $Params = [ - 'id' => $I, - 'content' => base64_encode(random_bytes(10)) - ]; - foreach ($Params as $Param => $Value) - $S->bindValue($Param, $Value); - $S->execute(); + $Params = [ + 'id' => $I, + 'content' => base64_encode(random_bytes(10)) + ]; + foreach ($Params as $Param => $Value) + $S->bindValue($Param, $Value); + $S->execute(); } unset($S); unset($dbh); diff --git a/ext/pdo_firebird/tests/bug_76488.phpt b/ext/pdo_firebird/tests/bug_76488.phpt index ffcca7efd3..27b899086d 100644 --- a/ext/pdo_firebird/tests/bug_76488.phpt +++ b/ext/pdo_firebird/tests/bug_76488.phpt @@ -14,15 +14,15 @@ with recursive r(n) as ( ) select n, cast(lpad(\'A\', 8000, \'A\') as BLOB sub_type TEXT) as SRC -from r +from r '; for ($i = 0; $i < 10; $i++) { $sth = $dbh->prepare($sql); $sth->execute(); $rows = $sth->fetchAll(); - unset($rows); - unset($sth); + unset($rows); + unset($sth); } unset($dbh); echo "OK"; diff --git a/ext/pdo_firebird/tests/bug_77863.phpt b/ext/pdo_firebird/tests/bug_77863.phpt index a133de5ba8..e0d8293118 100644 --- a/ext/pdo_firebird/tests/bug_77863.phpt +++ b/ext/pdo_firebird/tests/bug_77863.phpt @@ -107,8 +107,8 @@ try { echo "OK\n"; } catch(Exception $e) { - echo $e->getMessage() . '<br>'; - echo $e->getTraceAsString(); + echo $e->getMessage() . '<br>'; + echo $e->getTraceAsString(); } ?> --EXPECT-- diff --git a/ext/pdo_firebird/tests/connect.phpt b/ext/pdo_firebird/tests/connect.phpt index 20f0ce7013..116e991066 100644 --- a/ext/pdo_firebird/tests/connect.phpt +++ b/ext/pdo_firebird/tests/connect.phpt @@ -4,10 +4,10 @@ PDO_Firebird: connect/disconnect <?php require('skipif.inc'); ?> --FILE-- <?php - require("testdb.inc"); + require("testdb.inc"); - unset($dbh); - echo "done\n"; + unset($dbh); + echo "done\n"; ?> --EXPECT-- diff --git a/ext/pdo_firebird/tests/ddl.phpt b/ext/pdo_firebird/tests/ddl.phpt index b89c70456a..ea2c15cd11 100644 --- a/ext/pdo_firebird/tests/ddl.phpt +++ b/ext/pdo_firebird/tests/ddl.phpt @@ -5,32 +5,32 @@ PDO_Firebird: DDL/transactions --FILE-- <?php - require("testdb.inc"); + require("testdb.inc"); - $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - @$dbh->exec('DROP TABLE ddl'); - @$dbh->exec('DROP GENERATOR gen_ddl_id'); - @$dbh->exec('DROP TRIGGER ddl_bi'); + @$dbh->exec('DROP TABLE ddl'); + @$dbh->exec('DROP GENERATOR gen_ddl_id'); + @$dbh->exec('DROP TRIGGER ddl_bi'); - $dbh->exec("CREATE TABLE ddl (id INT NOT NULL PRIMARY KEY, text BLOB SUB_TYPE 1)"); - $dbh->exec("CREATE GENERATOR gen_ddl_id"); - $dbh->exec("CREATE TRIGGER ddl_bi FOR ddl BEFORE INSERT AS - BEGIN IF (NEW.id IS NULL) THEN NEW.id=GEN_ID(gen_ddl_id,1); END"); + $dbh->exec("CREATE TABLE ddl (id INT NOT NULL PRIMARY KEY, text BLOB SUB_TYPE 1)"); + $dbh->exec("CREATE GENERATOR gen_ddl_id"); + $dbh->exec("CREATE TRIGGER ddl_bi FOR ddl BEFORE INSERT AS + BEGIN IF (NEW.id IS NULL) THEN NEW.id=GEN_ID(gen_ddl_id,1); END"); - $dbh->setAttribute(PDO::ATTR_AUTOCOMMIT,0); + $dbh->setAttribute(PDO::ATTR_AUTOCOMMIT,0); - $dbh->beginTransaction(); - var_dump($dbh->exec("INSERT INTO ddl (text) VALUES ('bla')")); - var_dump($dbh->exec("UPDATE ddl SET text='blabla'")); - $dbh->rollback(); + $dbh->beginTransaction(); + var_dump($dbh->exec("INSERT INTO ddl (text) VALUES ('bla')")); + var_dump($dbh->exec("UPDATE ddl SET text='blabla'")); + $dbh->rollback(); - $dbh->beginTransaction(); - var_dump($dbh->exec("DELETE FROM ddl")); - $dbh->commit(); + $dbh->beginTransaction(); + var_dump($dbh->exec("DELETE FROM ddl")); + $dbh->commit(); - unset($dbh); - echo "done\n"; + unset($dbh); + echo "done\n"; ?> --EXPECT-- diff --git a/ext/pdo_firebird/tests/dialect_1.phpt b/ext/pdo_firebird/tests/dialect_1.phpt index 829025c162..c0f2ff017d 100644 --- a/ext/pdo_firebird/tests/dialect_1.phpt +++ b/ext/pdo_firebird/tests/dialect_1.phpt @@ -8,44 +8,44 @@ if (strpos(getenv('PDO_FIREBIRD_TEST_DSN'), 'dialect=1')===false) { ?> --FILE-- <?php - require("testdb.inc"); + require("testdb.inc"); - $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - $dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S'); + $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + $dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S'); - $sql = - 'SELECT - 1 as N, - 2.0 as F, - cast(0.76 as numeric(15, 2)) as K, - cast(\'2019-06-12\' as date) as DT - FROM RDB$DATABASE'; - $query = $dbh->prepare($sql); - $query->execute(); - $row = $query->fetch(\PDO::FETCH_OBJ); - var_dump($row->N); - var_dump($row->F); - var_dump($row->K); - var_dump($row->DT); + $sql = + 'SELECT + 1 as N, + 2.0 as F, + cast(0.76 as numeric(15, 2)) as K, + cast(\'2019-06-12\' as date) as DT + FROM RDB$DATABASE'; + $query = $dbh->prepare($sql); + $query->execute(); + $row = $query->fetch(\PDO::FETCH_OBJ); + var_dump($row->N); + var_dump($row->F); + var_dump($row->K); + var_dump($row->DT); - unset($query); + unset($query); - $dbh->exec('RECREATE TABLE test_d1(K numeric(15, 2), DT date)'); - $sql='INSERT INTO test_d1(K, DT) values(?, ?)'; - $query = $dbh->prepare($sql); - $query->execute([0.76, '2019-06-12']); - unset($query); + $dbh->exec('RECREATE TABLE test_d1(K numeric(15, 2), DT date)'); + $sql='INSERT INTO test_d1(K, DT) values(?, ?)'; + $query = $dbh->prepare($sql); + $query->execute([0.76, '2019-06-12']); + unset($query); - $sql='SELECT * FROM test_d1'; - $query = $dbh->prepare($sql); - $query->execute(); - $row = $query->fetch(\PDO::FETCH_OBJ); - var_dump($row->K); - var_dump($row->DT); + $sql='SELECT * FROM test_d1'; + $query = $dbh->prepare($sql); + $query->execute(); + $row = $query->fetch(\PDO::FETCH_OBJ); + var_dump($row->K); + var_dump($row->DT); - unset($query); - unset($dbh); - echo "done\n"; + unset($query); + unset($dbh); + echo "done\n"; ?> --EXPECT-- diff --git a/ext/pdo_firebird/tests/execute.phpt b/ext/pdo_firebird/tests/execute.phpt index 0f1721f559..56ed10b0d0 100644 --- a/ext/pdo_firebird/tests/execute.phpt +++ b/ext/pdo_firebird/tests/execute.phpt @@ -4,41 +4,41 @@ PDO_Firebird: prepare/execute/binding <?php require('skipif.inc'); ?> --FILE-- <?php - require("testdb.inc"); + require("testdb.inc"); - var_dump($dbh->getAttribute(PDO::ATTR_CONNECTION_STATUS)); + var_dump($dbh->getAttribute(PDO::ATTR_CONNECTION_STATUS)); - $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - $dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S'); + $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + $dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S'); - @$dbh->exec('DROP TABLE ddl'); - $dbh->exec("CREATE TABLE ddl (id SMALLINT NOT NULL PRIMARY KEY, text VARCHAR(32), - datetime TIMESTAMP DEFAULT '2000-02-12' NOT NULL)"); - $dbh->exec("INSERT INTO ddl (id,text) VALUES (1,'bla')"); + @$dbh->exec('DROP TABLE ddl'); + $dbh->exec("CREATE TABLE ddl (id SMALLINT NOT NULL PRIMARY KEY, text VARCHAR(32), + datetime TIMESTAMP DEFAULT '2000-02-12' NOT NULL)"); + $dbh->exec("INSERT INTO ddl (id,text) VALUES (1,'bla')"); - $s = $dbh->prepare("SELECT * FROM ddl WHERE id=? FOR UPDATE"); + $s = $dbh->prepare("SELECT * FROM ddl WHERE id=? FOR UPDATE"); - $id = 0; - $s->bindParam(1,$id); - $var = null; - $s->bindColumn("TEXT",$var); - $id = 1; - $s->execute(); - $s->setAttribute(PDO::ATTR_CURSOR_NAME, "c"); + $id = 0; + $s->bindParam(1,$id); + $var = null; + $s->bindColumn("TEXT",$var); + $id = 1; + $s->execute(); + $s->setAttribute(PDO::ATTR_CURSOR_NAME, "c"); - var_dump($id); + var_dump($id); - var_dump($s->fetch()); + var_dump($s->fetch()); - var_dump($var); + var_dump($var); - var_dump($dbh->exec("UPDATE ddl SET id=2 WHERE CURRENT OF c")); + var_dump($dbh->exec("UPDATE ddl SET id=2 WHERE CURRENT OF c")); - var_dump($s->fetch()); + var_dump($s->fetch()); - unset($s); - unset($dbh); - echo "done\n"; + unset($s); + unset($dbh); + echo "done\n"; ?> --EXPECT-- diff --git a/ext/pdo_firebird/tests/testdb.inc b/ext/pdo_firebird/tests/testdb.inc index d345d090bb..23008fa0d9 100644 --- a/ext/pdo_firebird/tests/testdb.inc +++ b/ext/pdo_firebird/tests/testdb.inc @@ -1,7 +1,7 @@ <?php // Test defaults, assumes the following: -// +// // Username: SYSDBA // Password: phpfi // Database: <nothing> diff --git a/ext/pdo_mysql/tests/bug41125.phpt b/ext/pdo_mysql/tests/bug41125.phpt index 2212bb621d..63ff7df2f3 100644 --- a/ext/pdo_mysql/tests/bug41125.phpt +++ b/ext/pdo_mysql/tests/bug41125.phpt @@ -24,19 +24,19 @@ print implode(' - ', $stmt->errorinfo()) ."\n"; print "-------------------------------------------------------\n"; $queries = array( - "SELECT 1 FROM DUAL WHERE 1 = '?\'\''", - "SELECT 'a\\'0' FROM DUAL WHERE 1 = ?", - "SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\\'' AND ?", - "SELECT 'foo?bar', '', '''' FROM DUAL WHERE ?" + "SELECT 1 FROM DUAL WHERE 1 = '?\'\''", + "SELECT 'a\\'0' FROM DUAL WHERE 1 = ?", + "SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\\'' AND ?", + "SELECT 'foo?bar', '', '''' FROM DUAL WHERE ?" ); foreach ($queries as $k => $query) { - $stmt = $db->prepare($query); - $stmt->execute(array(1)); - printf("[%d] Query: [[%s]]\n", $k + 1, $query); - print implode(' - ', (($r = @$stmt->fetch(PDO::FETCH_NUM)) ? $r : array())) ."\n"; - print implode(' - ', $stmt->errorinfo()) ."\n"; - print "--------\n"; + $stmt = $db->prepare($query); + $stmt->execute(array(1)); + printf("[%d] Query: [[%s]]\n", $k + 1, $query); + print implode(' - ', (($r = @$stmt->fetch(PDO::FETCH_NUM)) ? $r : array())) ."\n"; + print implode(' - ', $stmt->errorinfo()) ."\n"; + print "--------\n"; } $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); @@ -53,33 +53,33 @@ print implode(' - ', $stmt->errorinfo()) ."\n"; print "-------------------------------------------------------\n"; $queries = array( - "SELECT 1, 'foo' FROM DUAL WHERE 1 = :id AND '\\0' IS NULL AND 2 <> :id", - "SELECT 1 FROM DUAL WHERE 1 = :id AND '' AND 2 <> :id", - "SELECT 1 FROM DUAL WHERE 1 = :id AND '\'\'' = '''' AND 2 <> :id", - "SELECT 1 FROM DUAL WHERE 1 = :id AND '\'' = '''' AND 2 <> :id", - "SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\\'' AND 1", - "SELECT 'a''', '\'b\'' FROM DUAL WHERE '''' LIKE '\\'' AND 1", - "SELECT UPPER(:id) FROM DUAL WHERE '1'", - "SELECT 1 FROM DUAL WHERE '\''", - "SELECT 1 FROM DUAL WHERE :id AND '\\0' OR :id", - "SELECT 1 FROM DUAL WHERE 'a\\f\\n\\0' AND 1 >= :id", - "SELECT 1 FROM DUAL WHERE '\'' = ''''", - "SELECT '\\n' '1 FROM DUAL WHERE '''' and :id'", - "SELECT 1 'FROM DUAL WHERE :id AND '''' = '''' OR 1 = 1 AND ':id", + "SELECT 1, 'foo' FROM DUAL WHERE 1 = :id AND '\\0' IS NULL AND 2 <> :id", + "SELECT 1 FROM DUAL WHERE 1 = :id AND '' AND 2 <> :id", + "SELECT 1 FROM DUAL WHERE 1 = :id AND '\'\'' = '''' AND 2 <> :id", + "SELECT 1 FROM DUAL WHERE 1 = :id AND '\'' = '''' AND 2 <> :id", + "SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\\'' AND 1", + "SELECT 'a''', '\'b\'' FROM DUAL WHERE '''' LIKE '\\'' AND 1", + "SELECT UPPER(:id) FROM DUAL WHERE '1'", + "SELECT 1 FROM DUAL WHERE '\''", + "SELECT 1 FROM DUAL WHERE :id AND '\\0' OR :id", + "SELECT 1 FROM DUAL WHERE 'a\\f\\n\\0' AND 1 >= :id", + "SELECT 1 FROM DUAL WHERE '\'' = ''''", + "SELECT '\\n' '1 FROM DUAL WHERE '''' and :id'", + "SELECT 1 'FROM DUAL WHERE :id AND '''' = '''' OR 1 = 1 AND ':id", ); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); $id = 1; foreach ($queries as $k => $query) { - $stmt = $db->prepare($query); - $stmt->bindParam(':id', $id); - $stmt->execute(); - - printf("[%d] Query: [[%s]]\n", $k + 1, $query); - print implode(' - ', (($r = @$stmt->fetch(PDO::FETCH_NUM)) ? $r : array())) ."\n"; - print implode(' - ', $stmt->errorinfo()) ."\n"; - print "--------\n"; + $stmt = $db->prepare($query); + $stmt->bindParam(':id', $id); + $stmt->execute(); + + printf("[%d] Query: [[%s]]\n", $k + 1, $query); + print implode(' - ', (($r = @$stmt->fetch(PDO::FETCH_NUM)) ? $r : array())) ."\n"; + print implode(' - ', $stmt->errorinfo()) ."\n"; + print "--------\n"; } ?> diff --git a/ext/pdo_mysql/tests/bug44327.phpt b/ext/pdo_mysql/tests/bug44327.phpt index f457c97aeb..5adc8209e7 100644 --- a/ext/pdo_mysql/tests/bug44327.phpt +++ b/ext/pdo_mysql/tests/bug44327.phpt @@ -9,35 +9,35 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - $stmt = $db->prepare("SELECT 1 AS \"one\""); - $stmt->execute(); - $row = $stmt->fetch(PDO::FETCH_LAZY); - var_dump($row); - var_dump($row->{0}); - var_dump($row->one); - var_dump($row->queryString); + $stmt = $db->prepare("SELECT 1 AS \"one\""); + $stmt->execute(); + $row = $stmt->fetch(PDO::FETCH_LAZY); + var_dump($row); + var_dump($row->{0}); + var_dump($row->one); + var_dump($row->queryString); - print "----------------------------------\n"; + print "----------------------------------\n"; - @$db->exec("DROP TABLE test"); - $db->exec("CREATE TABLE test (id INT)"); - $db->exec("INSERT INTO test(id) VALUES (1)"); - $stmt = $db->prepare("SELECT id FROM test"); - $stmt->execute(); - $row = $stmt->fetch(PDO::FETCH_LAZY); - var_dump($row); - var_dump($row->queryString); - @$db->exec("DROP TABLE test"); + @$db->exec("DROP TABLE test"); + $db->exec("CREATE TABLE test (id INT)"); + $db->exec("INSERT INTO test(id) VALUES (1)"); + $stmt = $db->prepare("SELECT id FROM test"); + $stmt->execute(); + $row = $stmt->fetch(PDO::FETCH_LAZY); + var_dump($row); + var_dump($row->queryString); + @$db->exec("DROP TABLE test"); - print "----------------------------------\n"; + print "----------------------------------\n"; - $stmt = $db->prepare('foo'); - @$stmt->execute(); - $row = $stmt->fetch(); - var_dump($row->queryString); + $stmt = $db->prepare('foo'); + @$stmt->execute(); + $row = $stmt->fetch(); + var_dump($row->queryString); ?> --EXPECTF-- diff --git a/ext/pdo_mysql/tests/bug46292.phpt b/ext/pdo_mysql/tests/bug46292.phpt index fd2ef759e5..dec4a9f550 100644 --- a/ext/pdo_mysql/tests/bug46292.phpt +++ b/ext/pdo_mysql/tests/bug46292.phpt @@ -9,45 +9,45 @@ MySQLPDOTest::skip(); --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $pdoDb = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $pdoDb = MySQLPDOTest::factory(); - class myclass implements Serializable { - public function __construct() { - printf("%s()\n", __METHOD__); - } + class myclass implements Serializable { + public function __construct() { + printf("%s()\n", __METHOD__); + } - public function serialize() { - printf("%s()\n", __METHOD__); - return "any data from serialize()"; - } + public function serialize() { + printf("%s()\n", __METHOD__); + return "any data from serialize()"; + } - public function unserialize($dat) { - printf("%s(%s)\n", __METHOD__, var_export($dat, true)); - return $dat; - } - } + public function unserialize($dat) { + printf("%s(%s)\n", __METHOD__, var_export($dat, true)); + return $dat; + } + } - class myclass2 extends myclass { } + class myclass2 extends myclass { } - $pdoDb->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); - $pdoDb->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + $pdoDb->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); + $pdoDb->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); - $pdoDb->query('DROP TABLE IF EXISTS testz'); + $pdoDb->query('DROP TABLE IF EXISTS testz'); - $pdoDb->query('CREATE TABLE testz (name VARCHAR(20) NOT NULL, value INT)'); + $pdoDb->query('CREATE TABLE testz (name VARCHAR(20) NOT NULL, value INT)'); - $pdoDb->query("INSERT INTO testz VALUES ('myclass', 1), ('myclass2', 2), ('myclass', NULL), ('myclass3', NULL)"); + $pdoDb->query("INSERT INTO testz VALUES ('myclass', 1), ('myclass2', 2), ('myclass', NULL), ('myclass3', NULL)"); - $stmt = $pdoDb->prepare("SELECT * FROM testz"); + $stmt = $pdoDb->prepare("SELECT * FROM testz"); - var_dump($stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_CLASSTYPE | PDO::FETCH_GROUP)); - $stmt->execute(); + var_dump($stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_CLASSTYPE | PDO::FETCH_GROUP)); + $stmt->execute(); - var_dump($stmt->fetch()); - var_dump($stmt->fetch()); - var_dump($stmt->fetchAll()); + var_dump($stmt->fetch()); + var_dump($stmt->fetch()); + var_dump($stmt->fetchAll()); ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/bug54929.phpt b/ext/pdo_mysql/tests/bug54929.phpt index 6f2c2b0b80..c9f68af862 100644 --- a/ext/pdo_mysql/tests/bug54929.phpt +++ b/ext/pdo_mysql/tests/bug54929.phpt @@ -16,14 +16,14 @@ $pdodb = PDOTest::test_factory(__DIR__ . '/common.phpt'); function testQuery($query) { - global $pdodb; - $stmt = $pdodb->prepare($query); + global $pdodb; + $stmt = $pdodb->prepare($query); - if (!$stmt->execute(array("foo"))) { - var_dump($stmt->errorInfo()); - } else{ - var_dump($stmt->fetch(PDO::FETCH_ASSOC)); - } + if (!$stmt->execute(array("foo"))) { + var_dump($stmt->errorInfo()); + } else{ + var_dump($stmt->fetch(PDO::FETCH_ASSOC)); + } } testQuery("/* ' */ select ? as f1 /* ' */"); diff --git a/ext/pdo_mysql/tests/bug63176.phpt b/ext/pdo_mysql/tests/bug63176.phpt index ed462c0c53..2a75f47384 100644 --- a/ext/pdo_mysql/tests/bug63176.phpt +++ b/ext/pdo_mysql/tests/bug63176.phpt @@ -10,24 +10,24 @@ MySQLPDOTest::skip(); <?php require(__DIR__. DIRECTORY_SEPARATOR . 'config.inc'); class PDO2 extends PDO { - protected $transLevel; + protected $transLevel; } class PDO3 extends PDO { - protected $tomato; + protected $tomato; } class ModelA { - public function __construct($h) { - var_dump($h); - if ($h) { - $this->db = new PDO2(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS, array(PDO::ATTR_PERSISTENT => true)); - } else { - $this->db = new PDO3(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS, array(PDO::ATTR_PERSISTENT => true)); - } - $this->db->query('SELECT 1')->fetchAll(); - } + public function __construct($h) { + var_dump($h); + if ($h) { + $this->db = new PDO2(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS, array(PDO::ATTR_PERSISTENT => true)); + } else { + $this->db = new PDO3(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS, array(PDO::ATTR_PERSISTENT => true)); + } + $this->db->query('SELECT 1')->fetchAll(); + } } $a = new ModelA(true); diff --git a/ext/pdo_mysql/tests/bug68371.phpt b/ext/pdo_mysql/tests/bug68371.phpt index f5046f0375..17eee8c2f4 100644 --- a/ext/pdo_mysql/tests/bug68371.phpt +++ b/ext/pdo_mysql/tests/bug68371.phpt @@ -14,54 +14,54 @@ $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $attrs = array( // Extensive test: default value and set+get values - PDO::ATTR_EMULATE_PREPARES => array(null, 1, 0), - PDO::MYSQL_ATTR_DIRECT_QUERY => array(null, 0, 1), - PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => array(null, 0, 1), + PDO::ATTR_EMULATE_PREPARES => array(null, 1, 0), + PDO::MYSQL_ATTR_DIRECT_QUERY => array(null, 0, 1), + PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => array(null, 0, 1), // Just test the default - PDO::ATTR_AUTOCOMMIT => array(null), - PDO::ATTR_PREFETCH => array(null), - PDO::ATTR_TIMEOUT => array(null), - PDO::ATTR_ERRMODE => array(null), - PDO::ATTR_SERVER_VERSION => array(null), - PDO::ATTR_CLIENT_VERSION => array(null), - PDO::ATTR_SERVER_INFO => array(null), - PDO::ATTR_CONNECTION_STATUS => array(null), - PDO::ATTR_CASE => array(null), - PDO::ATTR_CURSOR_NAME => array(null), - PDO::ATTR_CURSOR => array(null), - PDO::ATTR_ORACLE_NULLS => array(null), - PDO::ATTR_PERSISTENT => array(null), - PDO::ATTR_STATEMENT_CLASS => array(null), - PDO::ATTR_FETCH_TABLE_NAMES => array(null), - PDO::ATTR_FETCH_CATALOG_NAMES => array(null), - PDO::ATTR_DRIVER_NAME => array(null), - PDO::ATTR_STRINGIFY_FETCHES => array(null), - PDO::ATTR_MAX_COLUMN_LEN => array(null), - PDO::ATTR_DEFAULT_FETCH_MODE => array(null), + PDO::ATTR_AUTOCOMMIT => array(null), + PDO::ATTR_PREFETCH => array(null), + PDO::ATTR_TIMEOUT => array(null), + PDO::ATTR_ERRMODE => array(null), + PDO::ATTR_SERVER_VERSION => array(null), + PDO::ATTR_CLIENT_VERSION => array(null), + PDO::ATTR_SERVER_INFO => array(null), + PDO::ATTR_CONNECTION_STATUS => array(null), + PDO::ATTR_CASE => array(null), + PDO::ATTR_CURSOR_NAME => array(null), + PDO::ATTR_CURSOR => array(null), + PDO::ATTR_ORACLE_NULLS => array(null), + PDO::ATTR_PERSISTENT => array(null), + PDO::ATTR_STATEMENT_CLASS => array(null), + PDO::ATTR_FETCH_TABLE_NAMES => array(null), + PDO::ATTR_FETCH_CATALOG_NAMES => array(null), + PDO::ATTR_DRIVER_NAME => array(null), + PDO::ATTR_STRINGIFY_FETCHES => array(null), + PDO::ATTR_MAX_COLUMN_LEN => array(null), + PDO::ATTR_DEFAULT_FETCH_MODE => array(null), ); foreach ($attrs as $a => $vals) { - foreach ($vals as $v) { - try { - if (!isset($v)) { - var_dump($pdo->getAttribute($a)); - } else { - $pdo->setAttribute($a, $v); - if ($pdo->getAttribute($a) === $v) { - echo "OK\n"; - } else { - throw new \Exception('KO'); - } - } - } catch (\Exception $e) { - if ($e->getCode() == 'IM001') { - echo "ERR\n"; - } else { - echo "ERR {$e->getMessage()}\n"; - } - } - } + foreach ($vals as $v) { + try { + if (!isset($v)) { + var_dump($pdo->getAttribute($a)); + } else { + $pdo->setAttribute($a, $v); + if ($pdo->getAttribute($a) === $v) { + echo "OK\n"; + } else { + throw new \Exception('KO'); + } + } + } catch (\Exception $e) { + if ($e->getCode() == 'IM001') { + echo "ERR\n"; + } else { + echo "ERR {$e->getMessage()}\n"; + } + } + } } ?> diff --git a/ext/pdo_mysql/tests/bug70389.phpt b/ext/pdo_mysql/tests/bug70389.phpt index 09f439804e..f2be259543 100644 --- a/ext/pdo_mysql/tests/bug70389.phpt +++ b/ext/pdo_mysql/tests/bug70389.phpt @@ -10,9 +10,9 @@ MySQLPDOTest::skip(); <?php require(__DIR__. DIRECTORY_SEPARATOR . 'config.inc'); $flags = [ - PDO::MYSQL_ATTR_FOUND_ROWS => true, - PDO::MYSQL_ATTR_LOCAL_INFILE => true, - PDO::ATTR_PERSISTENT => true, + PDO::MYSQL_ATTR_FOUND_ROWS => true, + PDO::MYSQL_ATTR_LOCAL_INFILE => true, + PDO::ATTR_PERSISTENT => true, ]; $std = new StdClass(); diff --git a/ext/pdo_mysql/tests/bug70862.phpt b/ext/pdo_mysql/tests/bug70862.phpt index d54d19f17b..fee79cbebb 100644 --- a/ext/pdo_mysql/tests/bug70862.phpt +++ b/ext/pdo_mysql/tests/bug70862.phpt @@ -8,32 +8,32 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec(sprintf('CREATE TABLE test(id INT, label BLOB)')); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec(sprintf('CREATE TABLE test(id INT, label BLOB)')); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); - class HelloWrapper { - public function stream_open() { return true; } - public function stream_eof() { return true; } - public function stream_read() { return NULL; } - public function stream_stat() { return array(); } - } - stream_wrapper_register("hello", "HelloWrapper"); + class HelloWrapper { + public function stream_open() { return true; } + public function stream_eof() { return true; } + public function stream_read() { return NULL; } + public function stream_stat() { return array(); } + } + stream_wrapper_register("hello", "HelloWrapper"); - $f = fopen("hello://there", "r"); + $f = fopen("hello://there", "r"); - $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, :para)'); - $stmt->bindParam(":para", $f, PDO::PARAM_LOB); - $stmt->execute(); + $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, :para)'); + $stmt->bindParam(":para", $f, PDO::PARAM_LOB); + $stmt->execute(); - var_dump($f); + var_dump($f); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/bug75177.phpt b/ext/pdo_mysql/tests/bug75177.phpt index 4f2adaf778..f6414f0b29 100644 --- a/ext/pdo_mysql/tests/bug75177.phpt +++ b/ext/pdo_mysql/tests/bug75177.phpt @@ -21,7 +21,7 @@ $pdo->query("INSERT INTO $tbl (`bit`) VALUES (0b01100)"); $ret = $pdo->query("SELECT * FROM $tbl")->fetchAll(); foreach ($ret as $i) { - var_dump($i["bit"]); + var_dump($i["bit"]); } ?> diff --git a/ext/pdo_mysql/tests/bug_33689.phpt b/ext/pdo_mysql/tests/bug_33689.phpt index 0755112f5f..84b8f5b914 100644 --- a/ext/pdo_mysql/tests/bug_33689.phpt +++ b/ext/pdo_mysql/tests/bug_33689.phpt @@ -18,7 +18,7 @@ $db->exec('INSERT INTO test VALUES(1)'); var_dump($db->query('SELECT * from test')); foreach ($db->query('SELECT * from test') as $row) { - print_r($row); + print_r($row); } $stmt = $db->prepare('SELECT * from test'); @@ -28,9 +28,9 @@ $tmp = $stmt->getColumnMeta(0); // libmysql and mysqlnd will show the pdo_type entry at a different position in the hash if (!isset($tmp['pdo_type']) || (isset($tmp['pdo_type']) && $tmp['pdo_type'] != 2)) - printf("Expecting pdo_type = 2 got %s\n", $tmp['pdo_type']); + printf("Expecting pdo_type = 2 got %s\n", $tmp['pdo_type']); else - unset($tmp['pdo_type']); + unset($tmp['pdo_type']); print_r($tmp); ?> diff --git a/ext/pdo_mysql/tests/bug_38546.phpt b/ext/pdo_mysql/tests/bug_38546.phpt index 0d7b44d1dc..238bccb035 100644 --- a/ext/pdo_mysql/tests/bug_38546.phpt +++ b/ext/pdo_mysql/tests/bug_38546.phpt @@ -21,20 +21,20 @@ $db->exec("SET sql_mode='STRICT_TRANS_TABLES'"); $db->exec("DROP TABLE IF EXISTS test"); $query = "CREATE TABLE test( - uid MEDIUMINT UNSIGNED NOT NULL, + uid MEDIUMINT UNSIGNED NOT NULL, some_bool_1 BOOL NOT NULL, some_bool_2 BOOL NOT NULL, some_int TINYINT NOT NULL - )"; + )"; $db->exec($query); $st = $db->prepare("INSERT INTO test (uid, some_bool_1, some_bool_2, some_int) VALUES (?, ?, ?, ?)"); $values = [ - 'uid' => 6, - 'some_bool_1' => false, - 'some_bool_2' => true, - 'some_int' => -23 + 'uid' => 6, + 'some_bool_1' => false, + 'some_bool_2' => true, + 'some_int' => -23 ]; $st->bindParam(1, $values['uid'], PDO::PARAM_INT); $st->bindParam(2, $values['some_bool_1'], PDO::PARAM_BOOL); @@ -50,16 +50,16 @@ if ($result === false) { } foreach ($db->query('SELECT * from test') as $row) { - print_r($row); + print_r($row); } $st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?"); $values = [ - 'uid' => 6, - 'some_bool_1' => (bool) 1, - 'some_bool_2' => (bool) 0, - 'some_int' => 1, + 'uid' => 6, + 'some_bool_1' => (bool) 1, + 'some_bool_2' => (bool) 0, + 'some_int' => 1, ]; $st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL); @@ -76,16 +76,16 @@ if ($result === false) { } foreach ($db->query('SELECT * from test') as $row) { - print_r($row); + print_r($row); } $st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?"); $values = [ - 'uid' => 6, - 'some_bool_1' => (bool) 0, - 'some_bool_2' => (bool) 1, - 'some_int' => 2, + 'uid' => 6, + 'some_bool_1' => (bool) 0, + 'some_bool_2' => (bool) 1, + 'some_int' => 2, ]; $st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL); @@ -102,17 +102,17 @@ if ($result === false) { } foreach ($db->query('SELECT * from test') as $row) { - print_r($row); + print_r($row); } // String true and false should fail $st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?"); $values = [ - 'uid' => 6, - 'some_bool_1' => 'true', - 'some_bool_2' => 'false', - 'some_int' => 3, + 'uid' => 6, + 'some_bool_1' => 'true', + 'some_bool_2' => 'false', + 'some_int' => 3, ]; $st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL); @@ -129,17 +129,17 @@ if ($result === false) { } foreach ($db->query('SELECT * from test') as $row) { - print_r($row); + print_r($row); } // Null should not be treated as false $st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?"); $values = [ - 'uid' => 6, - 'some_bool_1' => true, - 'some_bool_2' => null, - 'some_int' => 4, + 'uid' => 6, + 'some_bool_1' => true, + 'some_bool_2' => null, + 'some_int' => 4, ]; $st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL); @@ -156,17 +156,17 @@ if ($result === false) { } foreach ($db->query('SELECT * from test') as $row) { - print_r($row); + print_r($row); } // Integers converted correctly $st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?"); $values = [ - 'uid' => 6, - 'some_bool_1' => 256, - 'some_bool_2' => 0, - 'some_int' => 5, + 'uid' => 6, + 'some_bool_1' => 256, + 'some_bool_2' => 0, + 'some_int' => 5, ]; $st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL); @@ -183,7 +183,7 @@ if ($result === false) { } foreach ($db->query('SELECT * from test') as $row) { - print_r($row); + print_r($row); } ?> diff --git a/ext/pdo_mysql/tests/bug_39858.phpt b/ext/pdo_mysql/tests/bug_39858.phpt index db8afa99b8..9328c0f20d 100644 --- a/ext/pdo_mysql/tests/bug_39858.phpt +++ b/ext/pdo_mysql/tests/bug_39858.phpt @@ -28,29 +28,29 @@ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); function bug_39858($db) { - $db->exec("DROP PROCEDURE IF EXISTS p"); - $db->exec(" - CREATE PROCEDURE p() - NOT DETERMINISTIC - CONTAINS SQL - SQL SECURITY DEFINER - COMMENT '' - BEGIN - SELECT 2 * 2; - END;"); + $db->exec("DROP PROCEDURE IF EXISTS p"); + $db->exec(" + CREATE PROCEDURE p() + NOT DETERMINISTIC + CONTAINS SQL + SQL SECURITY DEFINER + COMMENT '' + BEGIN + SELECT 2 * 2; + END;"); - $stmt = $db->prepare("CALL p()"); - $stmt->execute(); - do { - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - } while ($stmt->nextRowset()); + $stmt = $db->prepare("CALL p()"); + $stmt->execute(); + do { + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + } while ($stmt->nextRowset()); - $stmt = $db->prepare("CALL p()"); - $stmt->execute(); - do { - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - } while ($stmt->nextRowset()); - $stmt->closeCursor(); + $stmt = $db->prepare("CALL p()"); + $stmt->execute(); + do { + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + } while ($stmt->nextRowset()); + $stmt->closeCursor(); } diff --git a/ext/pdo_mysql/tests/bug_41125.phpt b/ext/pdo_mysql/tests/bug_41125.phpt index e341ed409c..c86cad2b51 100644 --- a/ext/pdo_mysql/tests/bug_41125.phpt +++ b/ext/pdo_mysql/tests/bug_41125.phpt @@ -33,7 +33,7 @@ $sql = "CREATE TABLE IF NOT EXISTS test(id INT); INSERT INTO test(id) VALUES (1) // Compare MySQL C-API documentation $stmt = $db->query($sql); do { - var_dump($stmt->fetchAll()); + var_dump($stmt->fetchAll()); } while ($stmt->nextRowset()); print "done!"; diff --git a/ext/pdo_mysql/tests/bug_41997.phpt b/ext/pdo_mysql/tests/bug_41997.phpt index e3b52944be..def3d4406d 100644 --- a/ext/pdo_mysql/tests/bug_41997.phpt +++ b/ext/pdo_mysql/tests/bug_41997.phpt @@ -29,7 +29,7 @@ $db->exec('CREATE PROCEDURE p() BEGIN SELECT 1 AS "one"; END'); $stmt = $db->query("CALL p()"); do { - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); } while ($stmt->nextRowset()); var_dump($stmt->errorInfo()); diff --git a/ext/pdo_mysql/tests/bug_42499.phpt b/ext/pdo_mysql/tests/bug_42499.phpt index 244101a7ae..4ad38eeca2 100644 --- a/ext/pdo_mysql/tests/bug_42499.phpt +++ b/ext/pdo_mysql/tests/bug_42499.phpt @@ -26,16 +26,16 @@ $db = MySQLPDOTest::factory(); function bug_42499($db) { - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec("CREATE TABLE test(id CHAR(1)); INSERT INTO test(id) VALUES ('a')"); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec("CREATE TABLE test(id CHAR(1)); INSERT INTO test(id) VALUES ('a')"); - $stmt = $db->query('SELECT id AS _id FROM test'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->query('SELECT id AS _id FROM test'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - // You must not use exec() to run statements that create a result set! - $db->exec('SELECT id FROM test'); - // This will bail at you because you have not fetched the SELECT results: this is not a bug! - $db->exec("INSERT INTO test(id) VALUES ('b')"); + // You must not use exec() to run statements that create a result set! + $db->exec('SELECT id FROM test'); + // This will bail at you because you have not fetched the SELECT results: this is not a bug! + $db->exec("INSERT INTO test(id) VALUES ('b')"); } diff --git a/ext/pdo_mysql/tests/bug_44454.phpt b/ext/pdo_mysql/tests/bug_44454.phpt index d21cf3a4e2..e95904dda1 100644 --- a/ext/pdo_mysql/tests/bug_44454.phpt +++ b/ext/pdo_mysql/tests/bug_44454.phpt @@ -15,43 +15,43 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); function bug_44454($db) { - try { + try { - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec('CREATE TABLE test(a INT, b INT, UNIQUE KEY idx_ab (a, b))'); - $db->exec('INSERT INTO test(a, b) VALUES (1, 1)'); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec('CREATE TABLE test(a INT, b INT, UNIQUE KEY idx_ab (a, b))'); + $db->exec('INSERT INTO test(a, b) VALUES (1, 1)'); - $stmt = $db->query('SELECT a, b FROM test'); - printf("... SELECT has returned %d row...\n", $stmt->rowCount()); - while ($row = $stmt->fetch()) { - try { - printf("... INSERT should fail...\n"); - $db->exec('INSERT INTO test(a, b) VALUES (1, 1)'); - } catch (Exception $e) { - printf("... STMT - %s\n", var_export($stmt->errorCode(), true)); - printf("... PDO - %s\n", var_export($db->errorInfo(), true)); - } - } + $stmt = $db->query('SELECT a, b FROM test'); + printf("... SELECT has returned %d row...\n", $stmt->rowCount()); + while ($row = $stmt->fetch()) { + try { + printf("... INSERT should fail...\n"); + $db->exec('INSERT INTO test(a, b) VALUES (1, 1)'); + } catch (Exception $e) { + printf("... STMT - %s\n", var_export($stmt->errorCode(), true)); + printf("... PDO - %s\n", var_export($db->errorInfo(), true)); + } + } - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec('CREATE TABLE test(a INT, b INT, UNIQUE KEY idx_ab (a, b))'); - $db->exec('INSERT INTO test(a, b) VALUES (1, 1)'); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec('CREATE TABLE test(a INT, b INT, UNIQUE KEY idx_ab (a, b))'); + $db->exec('INSERT INTO test(a, b) VALUES (1, 1)'); - } catch (Exception $e) { - printf("... While error %s\n", $e->getMessage()); ; - } + } catch (Exception $e) { + printf("... While error %s\n", $e->getMessage()); ; + } - $stmt = $db->query('SELECT a, b FROM test'); - printf("... SELECT has returned %d row...\n", $stmt->rowCount()); - foreach ($stmt as $row) { - try { - printf("... INSERT should fail...\n"); - $db->exec('INSERT INTO test(a, b) VALUES (1, 1)'); - } catch (Exception $e) { - printf("... STMT - %s\n", var_export($stmt->errorCode(), true)); - printf("... PDO - %s\n", var_export($db->errorInfo(), true)); - } - } + $stmt = $db->query('SELECT a, b FROM test'); + printf("... SELECT has returned %d row...\n", $stmt->rowCount()); + foreach ($stmt as $row) { + try { + printf("... INSERT should fail...\n"); + $db->exec('INSERT INTO test(a, b) VALUES (1, 1)'); + } catch (Exception $e) { + printf("... STMT - %s\n", var_export($stmt->errorCode(), true)); + printf("... PDO - %s\n", var_export($db->errorInfo(), true)); + } + } } diff --git a/ext/pdo_mysql/tests/bug_44707.phpt b/ext/pdo_mysql/tests/bug_44707.phpt index 60f4ccdfae..6bd7114431 100644 --- a/ext/pdo_mysql/tests/bug_44707.phpt +++ b/ext/pdo_mysql/tests/bug_44707.phpt @@ -28,32 +28,32 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); function bug_44707($db) { - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec('CREATE TABLE test(id INT, mybool TINYINT)'); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec('CREATE TABLE test(id INT, mybool TINYINT)'); - $id = 1; - $mybool = false; - var_dump($mybool); + $id = 1; + $mybool = false; + var_dump($mybool); - $stmt = $db->prepare('INSERT INTO test(id, mybool) VALUES (?, ?)'); - $stmt->bindParam(1, $id); - $stmt->bindParam(2, $mybool, PDO::PARAM_BOOL); - var_dump($mybool); + $stmt = $db->prepare('INSERT INTO test(id, mybool) VALUES (?, ?)'); + $stmt->bindParam(1, $id); + $stmt->bindParam(2, $mybool, PDO::PARAM_BOOL); + var_dump($mybool); - $stmt->execute(); - var_dump($mybool); + $stmt->execute(); + var_dump($mybool); - $stmt = $db->query('SELECT * FROM test'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->query('SELECT * FROM test'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $stmt = $db->prepare('INSERT INTO test(id, mybool) VALUES (?, ?)'); - $stmt->bindParam(1, $id); - // INT and integer work well together - $stmt->bindParam(2, $mybool, PDO::PARAM_INT); - $stmt->execute(); + $stmt = $db->prepare('INSERT INTO test(id, mybool) VALUES (?, ?)'); + $stmt->bindParam(1, $id); + // INT and integer work well together + $stmt->bindParam(2, $mybool, PDO::PARAM_INT); + $stmt->execute(); - $stmt = $db->query('SELECT * FROM test'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->query('SELECT * FROM test'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); } diff --git a/ext/pdo_mysql/tests/bug_45120.phpt b/ext/pdo_mysql/tests/bug_45120.phpt index bc2ea76629..b281a6a354 100644 --- a/ext/pdo_mysql/tests/bug_45120.phpt +++ b/ext/pdo_mysql/tests/bug_45120.phpt @@ -15,20 +15,20 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); function bug_45120($db) { - $stmt = $db->prepare("SELECT 1 AS 'one'"); - if (true !== $stmt->execute()) - printf("[001] Execute has failed: %s\n", var_export($stmt->errorInfo(), true)); + $stmt = $db->prepare("SELECT 1 AS 'one'"); + if (true !== $stmt->execute()) + printf("[001] Execute has failed: %s\n", var_export($stmt->errorInfo(), true)); - $res = $stmt->fetch(PDO::FETCH_ASSOC); - if ($res['one'] != 1) - printf("[002] Wrong results: %s\n", var_export($res, true)); + $res = $stmt->fetch(PDO::FETCH_ASSOC); + if ($res['one'] != 1) + printf("[002] Wrong results: %s\n", var_export($res, true)); - if (true !== $stmt->execute()) - printf("[003] Execute has failed: %s\n", var_export($stmt->errorInfo(), true)); + if (true !== $stmt->execute()) + printf("[003] Execute has failed: %s\n", var_export($stmt->errorInfo(), true)); - $res = $stmt->fetch(PDO::FETCH_ASSOC); - if ($res['one'] != 1) - printf("[004] Wrong results: %s\n", var_export($res, true)); + $res = $stmt->fetch(PDO::FETCH_ASSOC); + if ($res['one'] != 1) + printf("[004] Wrong results: %s\n", var_export($res, true)); } diff --git a/ext/pdo_mysql/tests/bug_61207.phpt b/ext/pdo_mysql/tests/bug_61207.phpt index 346c1687e7..b8a6a21f09 100644 --- a/ext/pdo_mysql/tests/bug_61207.phpt +++ b/ext/pdo_mysql/tests/bug_61207.phpt @@ -26,9 +26,9 @@ $handle1->execute(); $i = 1; print("Handle 1:\n"); do { - print('Rowset ' . $i++ . "\n"); - if ($handle1->columnCount() > 0) - print("Results detected\n"); + print('Rowset ' . $i++ . "\n"); + if ($handle1->columnCount() > 0) + print("Results detected\n"); } while($handle1->nextRowset()); $handle2 = $db->prepare('select * from test where id = ?; @@ -42,9 +42,9 @@ $handle2->execute(); $i = 1; print("Handle 2:\n"); do { - print('Rowset ' . $i++ . "\n"); - if ($handle2->columnCount() > 0) - print("Results detected\n"); + print('Rowset ' . $i++ . "\n"); + if ($handle2->columnCount() > 0) + print("Results detected\n"); } while($handle2->nextRowset()); $handle3 = $db->prepare('update test set id = 2 where id = ?; @@ -58,9 +58,9 @@ $handle3->execute(); $i = 1; print("Handle 3:\n"); do { - print('Rowset ' . $i++ . "\n"); - if ($handle3->columnCount() > 0) - print("Results detected\n"); + print('Rowset ' . $i++ . "\n"); + if ($handle3->columnCount() > 0) + print("Results detected\n"); } while($handle3->nextRowset()); $handle4 = $db->prepare('insert into test(id) values(3); @@ -75,9 +75,9 @@ $handle4->execute(); $i = 1; print("Handle 4:\n"); do { - print('Rowset ' . $i++ . "\n"); - if ($handle1->columnCount() > 0) - print("Results detected\n"); + print('Rowset ' . $i++ . "\n"); + if ($handle1->columnCount() > 0) + print("Results detected\n"); } while($handle1->nextRowset()); $db->query("DROP TABLE test"); diff --git a/ext/pdo_mysql/tests/bug_61411.phpt b/ext/pdo_mysql/tests/bug_61411.phpt index f12804ab5f..920dc4e067 100644 --- a/ext/pdo_mysql/tests/bug_61411.phpt +++ b/ext/pdo_mysql/tests/bug_61411.phpt @@ -24,9 +24,9 @@ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); $attr = getenv('PDOTEST_ATTR'); if (!$attr) { - $attr = array(); + $attr = array(); } else { - $attr = unserialize($attr); + $attr = unserialize($attr); } $attr[PDO::ATTR_PERSISTENT] = true; $attr[PDO::ATTR_EMULATE_PREPARES] = false; @@ -38,7 +38,7 @@ $stmt = $db->prepare("SELECT 1"); $stmt->execute(); foreach ($stmt as $line) { - var_dump($line); + var_dump($line); } print "done!"; diff --git a/ext/pdo_mysql/tests/bug_pecl_12925.phpt b/ext/pdo_mysql/tests/bug_pecl_12925.phpt index 361ef719d0..2075d14581 100644 --- a/ext/pdo_mysql/tests/bug_pecl_12925.phpt +++ b/ext/pdo_mysql/tests/bug_pecl_12925.phpt @@ -15,17 +15,17 @@ $db = MySQLPDOTest::factory(); function bug_pecl_1295($db) { - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec('CREATE TABLE test(id CHAR(1))'); - $db->exec("INSERT INTO test(id) VALUES ('a')"); - $stmt = $db->prepare("UPDATE test SET id = 'b'"); - $stmt->execute(); - $stmt = $db->prepare("UPDATE test SET id = 'c'"); - $stmt->execute(); - $stmt = $db->prepare('SELECT id FROM test'); - $stmt->execute(); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $stmt->closeCursor(); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec('CREATE TABLE test(id CHAR(1))'); + $db->exec("INSERT INTO test(id) VALUES ('a')"); + $stmt = $db->prepare("UPDATE test SET id = 'b'"); + $stmt->execute(); + $stmt = $db->prepare("UPDATE test SET id = 'c'"); + $stmt->execute(); + $stmt = $db->prepare('SELECT id FROM test'); + $stmt->execute(); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt->closeCursor(); } diff --git a/ext/pdo_mysql/tests/bug_pecl_7976.phpt b/ext/pdo_mysql/tests/bug_pecl_7976.phpt index 9eb50abd43..00446edc47 100644 --- a/ext/pdo_mysql/tests/bug_pecl_7976.phpt +++ b/ext/pdo_mysql/tests/bug_pecl_7976.phpt @@ -25,16 +25,16 @@ $db = MySQLPDOTest::factory(); function bug_pecl_7976($db) { - $db->exec('DROP PROCEDURE IF EXISTS p'); - $db->exec('CREATE PROCEDURE p() BEGIN SELECT "1" AS _one; END;'); + $db->exec('DROP PROCEDURE IF EXISTS p'); + $db->exec('CREATE PROCEDURE p() BEGIN SELECT "1" AS _one; END;'); - $stmt = $db->query('CALL p()'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $stmt->closeCursor(); + $stmt = $db->query('CALL p()'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt->closeCursor(); - $stmt = $db->query('CALL p()'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $stmt->closeCursor(); + $stmt = $db->query('CALL p()'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt->closeCursor(); } diff --git a/ext/pdo_mysql/tests/config.inc b/ext/pdo_mysql/tests/config.inc index f5ea020b78..d0a67ccd16 100644 --- a/ext/pdo_mysql/tests/config.inc +++ b/ext/pdo_mysql/tests/config.inc @@ -2,21 +2,21 @@ /* Overrule global settings, if need be */ if (false !== getenv('PDO_MYSQL_TEST_DSN')) { - # user set them from their shell - $config['ENV']['PDOTEST_DSN'] = getenv('PDO_MYSQL_TEST_DSN'); - $config['ENV']['PDOTEST_USER'] = getenv('PDO_MYSQL_TEST_USER'); - $config['ENV']['PDOTEST_PASS'] = getenv('PDO_MYSQL_TEST_PASS'); - if (false !== getenv('PDO_MYSQL_TEST_ATTR')) { - $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_MYSQL_TEST_ATTR'); - } + # user set them from their shell + $config['ENV']['PDOTEST_DSN'] = getenv('PDO_MYSQL_TEST_DSN'); + $config['ENV']['PDOTEST_USER'] = getenv('PDO_MYSQL_TEST_USER'); + $config['ENV']['PDOTEST_PASS'] = getenv('PDO_MYSQL_TEST_PASS'); + if (false !== getenv('PDO_MYSQL_TEST_ATTR')) { + $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_MYSQL_TEST_ATTR'); + } } else { - $config['ENV']['PDOTEST_DSN'] = 'mysql:host=localhost;dbname=test'; - $config['ENV']['PDOTEST_USER'] = 'root'; - $config['ENV']['PDOTEST_PASS'] = ''; + $config['ENV']['PDOTEST_DSN'] = 'mysql:host=localhost;dbname=test'; + $config['ENV']['PDOTEST_USER'] = 'root'; + $config['ENV']['PDOTEST_PASS'] = ''; } foreach ($config['ENV'] as $k => $v) { - putenv("$k=$v"); + putenv("$k=$v"); } /* MySQL specific settings */ @@ -31,22 +31,22 @@ define('PDO_MYSQL_TEST_PASS', (false !== getenv('PDO_MYSQL_TEST_PASS')) ? getenv define('PDO_MYSQL_TEST_CHARSET', (false !== getenv('PDO_MYSQL_TEST_CHARSET')) ? getenv('PDO_MYSQL_TEST_CHARSET') : NULL); if (!function_exists('sys_get_temp_dir')) { - function sys_get_temp_dir() { + function sys_get_temp_dir() { - if (!empty($_ENV['TMP'])) - return realpath( $_ENV['TMP'] ); - if (!empty($_ENV['TMPDIR'])) - return realpath( $_ENV['TMPDIR'] ); - if (!empty($_ENV['TEMP'])) - return realpath( $_ENV['TEMP'] ); + if (!empty($_ENV['TMP'])) + return realpath( $_ENV['TMP'] ); + if (!empty($_ENV['TMPDIR'])) + return realpath( $_ENV['TMPDIR'] ); + if (!empty($_ENV['TEMP'])) + return realpath( $_ENV['TEMP'] ); - $temp_file = tempnam(md5(uniqid(rand(), TRUE)), ''); - if ($temp_file) { - $temp_dir = realpath(dirname($temp_file)); - unlink($temp_file); - return $temp_dir; - } - return FALSE; - } + $temp_file = tempnam(md5(uniqid(rand(), TRUE)), ''); + if ($temp_file) { + $temp_dir = realpath(dirname($temp_file)); + unlink($temp_file); + return $temp_dir; + } + return FALSE; + } } ?> diff --git a/ext/pdo_mysql/tests/mysql_pdo_test.inc b/ext/pdo_mysql/tests/mysql_pdo_test.inc index 65ad7b2d17..880f8dbf75 100644 --- a/ext/pdo_mysql/tests/mysql_pdo_test.inc +++ b/ext/pdo_mysql/tests/mysql_pdo_test.inc @@ -4,174 +4,174 @@ require_once(dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'); class MySQLPDOTest extends PDOTest { - static function factory($classname = 'PDO', $drop_test_tables = false, $myattr = null, $mydsn = null) { - - $dsn = self::getDSN($mydsn); - $user = PDO_MYSQL_TEST_USER; - $pass = PDO_MYSQL_TEST_PASS; - $attr = getenv('PDOTEST_ATTR'); - - if (is_string($attr) && strlen($attr)) { - $attr = unserialize($attr); - } else { - $attr = null; - } - if ($user === false) - $user = NULL; - if ($pass === false) - $pass = NULL; - - $db = new $classname($dsn, $user, $pass, $attr); - if (!$db) { - die("Could not create PDO object (DSN=$dsn, user=$user)\n"); - } - - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); - - return $db; - } - - static function createTestTable($db, $engine = null) { - if (!$engine) - $engine = PDO_MYSQL_TEST_ENGINE; - - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine); - $db->exec("INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')"); - } - - static function getTableEngine() { - return PDO_MYSQL_TEST_ENGINE; - } - - - static function getDSN($new_options = null, $addition = '') { - if (!$new_options) - return PDO_MYSQL_TEST_DSN . $addition; - - $old_options = array(); - $dsn = substr(PDO_MYSQL_TEST_DSN, - strpos(PDO_MYSQL_TEST_DSN, ':') + 1, - strlen(PDO_MYSQL_TEST_DSN)); - - // no real parser - any exotic setting can fool us - $parts = explode(';', $dsn); - foreach ($parts as $k => $v) { - $tmp = explode('=', $v); - if (count($tmp) == 2) - $old_options[$tmp[0]] = $tmp[1]; - } - - $options = $old_options; - foreach ($new_options as $k => $v) - $options[$k] = $v; - - $dsn = 'mysql:'; - foreach ($options as $k => $v) - $dsn .= sprintf('%s=%s;', $k, $v); - - if ($addition) - $dsn .= $addition; - else - $dsn = substr($dsn, 0, strlen($dsn) -1); - - return $dsn; - } - - static function getClientVersion($db) { - return self::extractVersion($db->getAttribute(PDO::ATTR_CLIENT_VERSION)); - } - - static function getServerVersion($db) { - return self::extractVersion($db->getAttribute(PDO::ATTR_SERVER_VERSION)); - } - - static function extractVersion($version_string) { - /* - TODO: - We're a bit in trouble: PDO_MYSQL returns version strings. - That's wrong according to the manual. According to the manual - integers should be returned. However, this code needs to work - with stinky PDO_MYSQL and hopefully better PDO_MYSQLND. - */ - - // already an int value? - if (is_int($version_string)) - return $version_string; - - // string but int value? - $tmp = (int)$version_string; - if (((string)$tmp) === $version_string) - return $tmp; - - // stinky string which we need to parse - $parts = explode('.', $version_string); - if (count($parts) < 3) - return -1; - - $version = (int)$parts[0] * 10000; - $version+= (int)$parts[1] * 100; - $version+= (int)$parts[2]; - - return $version; - } - - static function getTempDir() { - - if (!function_exists('sys_get_temp_dir')) { - - if (!empty($_ENV['TMP'])) - return realpath( $_ENV['TMP'] ); - if (!empty($_ENV['TMPDIR'])) - return realpath( $_ENV['TMPDIR'] ); - if (!empty($_ENV['TEMP'])) - return realpath( $_ENV['TEMP'] ); - - $temp_file = tempnam(md5(uniqid(rand(), TRUE)), ''); - if ($temp_file) { - $temp_dir = realpath(dirname($temp_file)); - unlink($temp_file); - return $temp_dir; - } - return FALSE; - } else { - return sys_get_temp_dir(); - } - - } - - static function detect_transactional_mysql_engine($db) { - foreach ($db->query("show variables like 'have%'") as $row) { - if (!empty($row) && $row[1] == 'YES' && ($row[0] == 'have_innodb' || $row[0] == 'have_bdb')) { - return str_replace("have_", "", $row[0]); - } - } - /* MySQL 5.6.1+ */ - foreach ($db->query("SHOW ENGINES") as $row) { - if (isset($row['engine']) && isset($row['support'])) { - if ('InnoDB' == $row['engine'] && ('YES' == $row['support'] || 'DEFAULT' == $row['support'])) - return 'innodb'; - } - } - return false; - } - - static function isPDOMySQLnd() { - ob_start(); - phpinfo(); - $tmp = ob_get_contents(); - ob_end_clean(); - return (preg_match('/PDO Driver for MySQL.*enabled/', $tmp) && - preg_match('/Client API version.*mysqlnd/', $tmp)); - } - - static function dropTestTable($db = NULL) { - if (is_null($db)) - $db = self::factory(); - - $db->exec('DROP TABLE IF EXISTS test'); - } + static function factory($classname = 'PDO', $drop_test_tables = false, $myattr = null, $mydsn = null) { + + $dsn = self::getDSN($mydsn); + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; + $attr = getenv('PDOTEST_ATTR'); + + if (is_string($attr) && strlen($attr)) { + $attr = unserialize($attr); + } else { + $attr = null; + } + if ($user === false) + $user = NULL; + if ($pass === false) + $pass = NULL; + + $db = new $classname($dsn, $user, $pass, $attr); + if (!$db) { + die("Could not create PDO object (DSN=$dsn, user=$user)\n"); + } + + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); + + return $db; + } + + static function createTestTable($db, $engine = null) { + if (!$engine) + $engine = PDO_MYSQL_TEST_ENGINE; + + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine); + $db->exec("INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')"); + } + + static function getTableEngine() { + return PDO_MYSQL_TEST_ENGINE; + } + + + static function getDSN($new_options = null, $addition = '') { + if (!$new_options) + return PDO_MYSQL_TEST_DSN . $addition; + + $old_options = array(); + $dsn = substr(PDO_MYSQL_TEST_DSN, + strpos(PDO_MYSQL_TEST_DSN, ':') + 1, + strlen(PDO_MYSQL_TEST_DSN)); + + // no real parser - any exotic setting can fool us + $parts = explode(';', $dsn); + foreach ($parts as $k => $v) { + $tmp = explode('=', $v); + if (count($tmp) == 2) + $old_options[$tmp[0]] = $tmp[1]; + } + + $options = $old_options; + foreach ($new_options as $k => $v) + $options[$k] = $v; + + $dsn = 'mysql:'; + foreach ($options as $k => $v) + $dsn .= sprintf('%s=%s;', $k, $v); + + if ($addition) + $dsn .= $addition; + else + $dsn = substr($dsn, 0, strlen($dsn) -1); + + return $dsn; + } + + static function getClientVersion($db) { + return self::extractVersion($db->getAttribute(PDO::ATTR_CLIENT_VERSION)); + } + + static function getServerVersion($db) { + return self::extractVersion($db->getAttribute(PDO::ATTR_SERVER_VERSION)); + } + + static function extractVersion($version_string) { + /* + TODO: + We're a bit in trouble: PDO_MYSQL returns version strings. + That's wrong according to the manual. According to the manual + integers should be returned. However, this code needs to work + with stinky PDO_MYSQL and hopefully better PDO_MYSQLND. + */ + + // already an int value? + if (is_int($version_string)) + return $version_string; + + // string but int value? + $tmp = (int)$version_string; + if (((string)$tmp) === $version_string) + return $tmp; + + // stinky string which we need to parse + $parts = explode('.', $version_string); + if (count($parts) < 3) + return -1; + + $version = (int)$parts[0] * 10000; + $version+= (int)$parts[1] * 100; + $version+= (int)$parts[2]; + + return $version; + } + + static function getTempDir() { + + if (!function_exists('sys_get_temp_dir')) { + + if (!empty($_ENV['TMP'])) + return realpath( $_ENV['TMP'] ); + if (!empty($_ENV['TMPDIR'])) + return realpath( $_ENV['TMPDIR'] ); + if (!empty($_ENV['TEMP'])) + return realpath( $_ENV['TEMP'] ); + + $temp_file = tempnam(md5(uniqid(rand(), TRUE)), ''); + if ($temp_file) { + $temp_dir = realpath(dirname($temp_file)); + unlink($temp_file); + return $temp_dir; + } + return FALSE; + } else { + return sys_get_temp_dir(); + } + + } + + static function detect_transactional_mysql_engine($db) { + foreach ($db->query("show variables like 'have%'") as $row) { + if (!empty($row) && $row[1] == 'YES' && ($row[0] == 'have_innodb' || $row[0] == 'have_bdb')) { + return str_replace("have_", "", $row[0]); + } + } + /* MySQL 5.6.1+ */ + foreach ($db->query("SHOW ENGINES") as $row) { + if (isset($row['engine']) && isset($row['support'])) { + if ('InnoDB' == $row['engine'] && ('YES' == $row['support'] || 'DEFAULT' == $row['support'])) + return 'innodb'; + } + } + return false; + } + + static function isPDOMySQLnd() { + ob_start(); + phpinfo(); + $tmp = ob_get_contents(); + ob_end_clean(); + return (preg_match('/PDO Driver for MySQL.*enabled/', $tmp) && + preg_match('/Client API version.*mysqlnd/', $tmp)); + } + + static function dropTestTable($db = NULL) { + if (is_null($db)) + $db = self::factory(); + + $db->exec('DROP TABLE IF EXISTS test'); + } } ?> diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct.phpt index b849f274be..2231f8b449 100644 --- a/ext/pdo_mysql/tests/pdo_mysql___construct.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql___construct.phpt @@ -8,289 +8,289 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - - function tryandcatch($offset, $code) { - - try { - eval($code); - assert(sprintf("[%03d] Should have failed\n", $offset) != ''); - } catch (PDOException $e) { - return sprintf("[%03d] %s, [%s] %s\n", - $offset, - $e->getMessage(), - (isset($db) && is_object($db)) ? $db->errorCode() : 'n/a', - (isset($db) && is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); - } - - return ''; - } - - try { - - try { - if (NULL !== ($db = @new PDO())) - printf("[001] Too few parameters\n"); - } catch (TypeError $ex) { - } - - print tryandcatch(2, '$db = new PDO(chr(0));'); - print tryandcatch(3, '$db = new PDO("a" . chr(0) . "b");'); - print tryandcatch(4, '$db = new PDO("MYSQL");'); - print tryandcatch(5, '$db = new PDO("mysql");'); - print tryandcatch(6, '$db = new PDO("mysql ");'); - print tryandcatch(7, '$db = new PDO("fantasyandfriends :");'); - - $dsn = PDO_MYSQL_TEST_DSN; - // MySQL Server might accept anonymous connections, don't - // print anything - tryandcatch(8, '$db = new PDO("' . $dsn . '");'); - - $user = 'dontcreatesuchauser'; - $pass = 'withthispassword'; - print tryandcatch(9, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); - - // should fail - $dsn = 'mysql:'; - // don't print the message since it can be different - tryandcatch(10, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); - - $dsn = PDO_MYSQL_TEST_DSN; - $user = PDO_MYSQL_TEST_USER; - $pass = PDO_MYSQL_TEST_PASS; - // should work... - $db = new PDO($dsn, $user, $pass); - - // Reaction on host not specified differs for different configs, so no printing - $dsn = 'mysql:invalid=foo'; - tryandcatch(11, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); - - $dsn = 'mysql:' . str_repeat('howmuch=canpdoeat;', 1000); - tryandcatch(12, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); - - $dsn = 'mysql:' . str_repeat('abcdefghij', 1024 * 10) . '=somevalue'; - tryandcatch(13, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); - - if (PDO_MYSQL_TEST_HOST) { - $host = PDO_MYSQL_TEST_HOST; - $invalid_host = $host . 'invalid'; - - // last host specification should be the one used - $dsn = MySQLPDOTest::getDSN(array('host' => $host), 'host=' . $invalid_host); - try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { - $tmp = $e->getMessage(); - if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002')) - printf("[014] Cannot find proper error codes: %s\n", $tmp); - } - - $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host), 'host=' . $host); - try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { - printf("[015] DSN=%s, %s\n", $dsn, $e->getMessage()); - } - - $invalid_host = '-' . chr(0); - - $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host)); - try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { - $tmp = $e->getMessage(); - if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002')) - printf("[016] Cannot find proper error codes: %s\n", $tmp); - } - - // parsing should not get confused by chr(0) - $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host), 'host=' . $host); - try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { - printf("[017] DSN=%s, %s\n", $dsn, $e->getMessage()); - } - - } - - // what about long values for a valid option ... - // hostnames > 1024 chars break on some NIS-enabled FreeBSD... - $dsn = MySQLPDOTest::getDSN(array('host' => str_repeat('0123456789', 100))); - try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { - $tmp = $e->getMessage(); - if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002')) - printf("[018] Cannot find proper error codes: %s\n", $tmp); - } - - if (PDO_MYSQL_TEST_PORT && (PDO_MYSQL_TEST_SOCKET == '')) { - // Playing with the port makes only sense if no socket gets used - - $port = PDO_MYSQL_TEST_PORT; - // let's hope we don't hit a MySQL running on that port... - $invalid_port = $port * 2; - - $dsn = MySQLPDOTest::getDSN(array('port' => $port), 'port=' . $invalid_port); - try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { - $tmp = $e->getMessage(); - if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005')) - printf("[019] Cannot find proper error codes: %s\n", $tmp); - } - - $dsn = MySQLPDOTest::getDSN(array('port' => $invalid_port), 'port=' . $port); - try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { - printf("[020] DSN=%s, %s\n", $dsn, $e->getMessage()); - } - - $invalid_port = 'abc'; - $dsn = MySQLPDOTest::getDSN(array('port' => $port), 'port=' . $invalid_port); - try { - $db = @new PDO($dsn, $user, $pass); - // atoi('abc') = 0, 0 -> fallback to default 3306 -> may or may not fail! - } catch (PDOException $e) { - } - - } - - if (PDO_MYSQL_TEST_DB) { - $db = PDO_MYSQL_TEST_DB; - $invalid_db = 'letshopeitdoesnotexist'; - - $dsn = MySQLPDOTest::getDSN(array('dbname' => $db), 'dbname=' . $invalid_db); - try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { - $tmp = $e->getMessage(); - if (!stristr($tmp, '42000') && !stristr($tmp, '1049')) - printf("[022] Cannot find proper error codes: %s\n", $tmp); - } - - $dsn = MySQLPDOTest::getDSN(array('dbname' => $invalid_db), 'dbname=' . $db); - try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { - printf("[023] DSN=%s, %s\n", $dsn, $e->getMessage()); - } - - } - - if (PDO_MYSQL_TEST_SOCKET && (stristr(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_SOCKET) !== false)) { - $socket = PDO_MYSQL_TEST_SOCKET; - $invalid_socket = '/lets/hope/it/does/not/exist'; - - $dsn = MySQLPDOTest::getDSN(array('unix_socket' => $socket), 'unix_socket=' . $invalid_socket); - try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { - $tmp = $e->getMessage(); - if (!stristr($tmp, 'HY000') && !stristr($tmp, '2002')) - printf("[024] Cannot find proper error codes: %s\n", $tmp); - } - - $dsn = MySQLPDOTest::getDSN(array('unix_socket' => $invalid_socket), 'unix_socket=' . $socket); - try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { - printf("[025] DSN=%s, %s\n", $dsn, $e->getMessage()); - } - - } - - $have_charset_support = false; - $dsn = MySQLPDOTest::getDSN(); - try { - $db = new PDO($dsn, $user, $pass); - $stmt = $db->query('SELECT VERSION() as _version'); - $version = $stmt->fetch(PDO::FETCH_ASSOC); - - $tmp = explode('.', $version['_version']); - if ((count($tmp) == 3) && - (($tmp[0] >= 4 && $tmp[1] >= 1) || ($tmp[0] >= 5))) { - // MySQL Server 4.1 - charset support available - $have_charset_support = true; - } - - } catch (PDOException $e) { - printf("[026] DSN=%s, %s\n", $dsn, $e->getMessage()); - } - - if (PDO_MYSQL_TEST_CHARSET) { - $charset = PDO_MYSQL_TEST_CHARSET; - $invalid_charset = 'invalid'; - - if ($have_charset_support) { - $dsn = MySQLPDOTest::getDSN(); - $db = new PDO($dsn, $user, $pass); - $stmt = $db->query(sprintf('SHOW CHARACTER SET LIKE "%s"', $charset)); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - $have_charset = (empty($tmp)) ? false : true; - - if ($have_charset) { - $dsn = MySQLPDOTest::getDSN(array('charset' => $charset), 'charset=' . $invalid_charset); - try { - $db = @new PDO($dsn, $user, $pass); - /* NOTE: MySQL does a fallback to the charset suggested during the handshake - no error - no bug! */ - } catch (PDOException $e) { - $tmp = $e->getMessage(); - /* TODO: add proper codes */ - if (!stristr($tmp, 'sqlstatecode') || !stristr($tmp, 'mysqlinternalerrcode')) - printf("[027] TODO - Cannot find proper error codes: %s\n", $tmp); - } - - $dsn = MySQLPDOTest::getDSN(array('charset' => $invalid_charset), 'charset=' . $charset); - try { - $db = @new PDO($dsn, $user, $pass); - /* Strictly speaking we should test more: character_set_client, character_set_results, and character_set_connection */ - $stmt = $db->query('SELECT @@character_set_connection AS _charset'); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - if ($tmp['_charset'] != $charset) - printf("[028] Character sets has not been set, @@character_set_connection reports '%s', expecting '%s'", - $tmp['_charset'], $charset); - } catch (PDOException $e) { - printf("[029] DSN=%s, %s\n", $dsn, $e->getMessage()); - } - } else { - printf("[030] You're trying to run the tests with charset '%s' which seems not supported by the server!", $charset); - } - - } - - } - - if ($have_charset_support) { - // In case the PDO_MYSQL_TEST_CHARSET interferes with any defaults - // we do another test to verify that the charset has been set. - $dsn = MySQLPDOTest::getDSN(); - $db = new PDO($dsn, $user, $pass); - $stmt = $db->query('SHOW CHARACTER SET LIKE "latin1"'); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - $have_latin1 =(empty($tmp)) ? false : true; - $stmt = $db->query('SHOW CHARACTER SET LIKE "latin2"'); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - $have_latin2 =(empty($tmp)) ? false : true; - - if ($have_latin1 && $have_latin2) { - // very likely we do have both of them... - try { - $dsn = MySQLPDOTest::getDSN(array('charset' => 'latin1')); - $db = new PDO($dsn, $user, $pass); - $stmt = $db->query('SELECT @@character_set_connection AS _charset'); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - if ($tmp['_charset'] != 'latin1') - printf("[031] DSN = %s, Character sets has not been set, @@character_set_connection reports '%s', expecting '%s'", - $dsn, $tmp['_charset'], 'latin1'); - - } catch (PDOException $e) { - printf("[032] %s\n", $e->getMessage()); - } - - try { - $dsn = MySQLPDOTest::getDSN(array('charset' => 'latin2')); - $db = new PDO($dsn, $user, $pass); - $stmt = $db->query('SELECT @@character_set_connection AS _charset'); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - if ($tmp['_charset'] != 'latin2') - printf("[033] DSN = %s, character sets has not been set, @@character_set_connection reports '%s', expecting '%s'", - $dsn, $tmp['_charset'], 'latin2'); - - } catch (PDOException $e) { - printf("[034] %s\n", $e->getMessage()); - } - - } - } - - } catch (PDOException $e) { - printf("[001] %s, [%s] %s\n", - $e->getMessage(), - (is_object($db)) ? $db->errorCode() : 'n/a', - (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); - } - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + + function tryandcatch($offset, $code) { + + try { + eval($code); + assert(sprintf("[%03d] Should have failed\n", $offset) != ''); + } catch (PDOException $e) { + return sprintf("[%03d] %s, [%s] %s\n", + $offset, + $e->getMessage(), + (isset($db) && is_object($db)) ? $db->errorCode() : 'n/a', + (isset($db) && is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); + } + + return ''; + } + + try { + + try { + if (NULL !== ($db = @new PDO())) + printf("[001] Too few parameters\n"); + } catch (TypeError $ex) { + } + + print tryandcatch(2, '$db = new PDO(chr(0));'); + print tryandcatch(3, '$db = new PDO("a" . chr(0) . "b");'); + print tryandcatch(4, '$db = new PDO("MYSQL");'); + print tryandcatch(5, '$db = new PDO("mysql");'); + print tryandcatch(6, '$db = new PDO("mysql ");'); + print tryandcatch(7, '$db = new PDO("fantasyandfriends :");'); + + $dsn = PDO_MYSQL_TEST_DSN; + // MySQL Server might accept anonymous connections, don't + // print anything + tryandcatch(8, '$db = new PDO("' . $dsn . '");'); + + $user = 'dontcreatesuchauser'; + $pass = 'withthispassword'; + print tryandcatch(9, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); + + // should fail + $dsn = 'mysql:'; + // don't print the message since it can be different + tryandcatch(10, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); + + $dsn = PDO_MYSQL_TEST_DSN; + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; + // should work... + $db = new PDO($dsn, $user, $pass); + + // Reaction on host not specified differs for different configs, so no printing + $dsn = 'mysql:invalid=foo'; + tryandcatch(11, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); + + $dsn = 'mysql:' . str_repeat('howmuch=canpdoeat;', 1000); + tryandcatch(12, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); + + $dsn = 'mysql:' . str_repeat('abcdefghij', 1024 * 10) . '=somevalue'; + tryandcatch(13, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); + + if (PDO_MYSQL_TEST_HOST) { + $host = PDO_MYSQL_TEST_HOST; + $invalid_host = $host . 'invalid'; + + // last host specification should be the one used + $dsn = MySQLPDOTest::getDSN(array('host' => $host), 'host=' . $invalid_host); + try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { + $tmp = $e->getMessage(); + if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002')) + printf("[014] Cannot find proper error codes: %s\n", $tmp); + } + + $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host), 'host=' . $host); + try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { + printf("[015] DSN=%s, %s\n", $dsn, $e->getMessage()); + } + + $invalid_host = '-' . chr(0); + + $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host)); + try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { + $tmp = $e->getMessage(); + if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002')) + printf("[016] Cannot find proper error codes: %s\n", $tmp); + } + + // parsing should not get confused by chr(0) + $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host), 'host=' . $host); + try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { + printf("[017] DSN=%s, %s\n", $dsn, $e->getMessage()); + } + + } + + // what about long values for a valid option ... + // hostnames > 1024 chars break on some NIS-enabled FreeBSD... + $dsn = MySQLPDOTest::getDSN(array('host' => str_repeat('0123456789', 100))); + try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { + $tmp = $e->getMessage(); + if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002')) + printf("[018] Cannot find proper error codes: %s\n", $tmp); + } + + if (PDO_MYSQL_TEST_PORT && (PDO_MYSQL_TEST_SOCKET == '')) { + // Playing with the port makes only sense if no socket gets used + + $port = PDO_MYSQL_TEST_PORT; + // let's hope we don't hit a MySQL running on that port... + $invalid_port = $port * 2; + + $dsn = MySQLPDOTest::getDSN(array('port' => $port), 'port=' . $invalid_port); + try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { + $tmp = $e->getMessage(); + if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005')) + printf("[019] Cannot find proper error codes: %s\n", $tmp); + } + + $dsn = MySQLPDOTest::getDSN(array('port' => $invalid_port), 'port=' . $port); + try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { + printf("[020] DSN=%s, %s\n", $dsn, $e->getMessage()); + } + + $invalid_port = 'abc'; + $dsn = MySQLPDOTest::getDSN(array('port' => $port), 'port=' . $invalid_port); + try { + $db = @new PDO($dsn, $user, $pass); + // atoi('abc') = 0, 0 -> fallback to default 3306 -> may or may not fail! + } catch (PDOException $e) { + } + + } + + if (PDO_MYSQL_TEST_DB) { + $db = PDO_MYSQL_TEST_DB; + $invalid_db = 'letshopeitdoesnotexist'; + + $dsn = MySQLPDOTest::getDSN(array('dbname' => $db), 'dbname=' . $invalid_db); + try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { + $tmp = $e->getMessage(); + if (!stristr($tmp, '42000') && !stristr($tmp, '1049')) + printf("[022] Cannot find proper error codes: %s\n", $tmp); + } + + $dsn = MySQLPDOTest::getDSN(array('dbname' => $invalid_db), 'dbname=' . $db); + try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { + printf("[023] DSN=%s, %s\n", $dsn, $e->getMessage()); + } + + } + + if (PDO_MYSQL_TEST_SOCKET && (stristr(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_SOCKET) !== false)) { + $socket = PDO_MYSQL_TEST_SOCKET; + $invalid_socket = '/lets/hope/it/does/not/exist'; + + $dsn = MySQLPDOTest::getDSN(array('unix_socket' => $socket), 'unix_socket=' . $invalid_socket); + try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { + $tmp = $e->getMessage(); + if (!stristr($tmp, 'HY000') && !stristr($tmp, '2002')) + printf("[024] Cannot find proper error codes: %s\n", $tmp); + } + + $dsn = MySQLPDOTest::getDSN(array('unix_socket' => $invalid_socket), 'unix_socket=' . $socket); + try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { + printf("[025] DSN=%s, %s\n", $dsn, $e->getMessage()); + } + + } + + $have_charset_support = false; + $dsn = MySQLPDOTest::getDSN(); + try { + $db = new PDO($dsn, $user, $pass); + $stmt = $db->query('SELECT VERSION() as _version'); + $version = $stmt->fetch(PDO::FETCH_ASSOC); + + $tmp = explode('.', $version['_version']); + if ((count($tmp) == 3) && + (($tmp[0] >= 4 && $tmp[1] >= 1) || ($tmp[0] >= 5))) { + // MySQL Server 4.1 - charset support available + $have_charset_support = true; + } + + } catch (PDOException $e) { + printf("[026] DSN=%s, %s\n", $dsn, $e->getMessage()); + } + + if (PDO_MYSQL_TEST_CHARSET) { + $charset = PDO_MYSQL_TEST_CHARSET; + $invalid_charset = 'invalid'; + + if ($have_charset_support) { + $dsn = MySQLPDOTest::getDSN(); + $db = new PDO($dsn, $user, $pass); + $stmt = $db->query(sprintf('SHOW CHARACTER SET LIKE "%s"', $charset)); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + $have_charset = (empty($tmp)) ? false : true; + + if ($have_charset) { + $dsn = MySQLPDOTest::getDSN(array('charset' => $charset), 'charset=' . $invalid_charset); + try { + $db = @new PDO($dsn, $user, $pass); + /* NOTE: MySQL does a fallback to the charset suggested during the handshake - no error - no bug! */ + } catch (PDOException $e) { + $tmp = $e->getMessage(); + /* TODO: add proper codes */ + if (!stristr($tmp, 'sqlstatecode') || !stristr($tmp, 'mysqlinternalerrcode')) + printf("[027] TODO - Cannot find proper error codes: %s\n", $tmp); + } + + $dsn = MySQLPDOTest::getDSN(array('charset' => $invalid_charset), 'charset=' . $charset); + try { + $db = @new PDO($dsn, $user, $pass); + /* Strictly speaking we should test more: character_set_client, character_set_results, and character_set_connection */ + $stmt = $db->query('SELECT @@character_set_connection AS _charset'); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + if ($tmp['_charset'] != $charset) + printf("[028] Character sets has not been set, @@character_set_connection reports '%s', expecting '%s'", + $tmp['_charset'], $charset); + } catch (PDOException $e) { + printf("[029] DSN=%s, %s\n", $dsn, $e->getMessage()); + } + } else { + printf("[030] You're trying to run the tests with charset '%s' which seems not supported by the server!", $charset); + } + + } + + } + + if ($have_charset_support) { + // In case the PDO_MYSQL_TEST_CHARSET interferes with any defaults + // we do another test to verify that the charset has been set. + $dsn = MySQLPDOTest::getDSN(); + $db = new PDO($dsn, $user, $pass); + $stmt = $db->query('SHOW CHARACTER SET LIKE "latin1"'); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + $have_latin1 =(empty($tmp)) ? false : true; + $stmt = $db->query('SHOW CHARACTER SET LIKE "latin2"'); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + $have_latin2 =(empty($tmp)) ? false : true; + + if ($have_latin1 && $have_latin2) { + // very likely we do have both of them... + try { + $dsn = MySQLPDOTest::getDSN(array('charset' => 'latin1')); + $db = new PDO($dsn, $user, $pass); + $stmt = $db->query('SELECT @@character_set_connection AS _charset'); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + if ($tmp['_charset'] != 'latin1') + printf("[031] DSN = %s, Character sets has not been set, @@character_set_connection reports '%s', expecting '%s'", + $dsn, $tmp['_charset'], 'latin1'); + + } catch (PDOException $e) { + printf("[032] %s\n", $e->getMessage()); + } + + try { + $dsn = MySQLPDOTest::getDSN(array('charset' => 'latin2')); + $db = new PDO($dsn, $user, $pass); + $stmt = $db->query('SELECT @@character_set_connection AS _charset'); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + if ($tmp['_charset'] != 'latin2') + printf("[033] DSN = %s, character sets has not been set, @@character_set_connection reports '%s', expecting '%s'", + $dsn, $tmp['_charset'], 'latin2'); + + } catch (PDOException $e) { + printf("[034] %s\n", $e->getMessage()); + } + + } + } + + } catch (PDOException $e) { + printf("[001] %s, [%s] %s\n", + $e->getMessage(), + (is_object($db)) ? $db->errorCode() : 'n/a', + (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); + } + + print "done!"; ?> --EXPECTF-- [002] invalid data source name, [n/a] n/a diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_ini.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_ini.phpt index a03ad7f324..985179b84c 100644 --- a/ext/pdo_mysql/tests/pdo_mysql___construct_ini.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql___construct_ini.phpt @@ -13,43 +13,43 @@ if (getenv('PDO_MYSQL_TEST_DSN') !== "mysql:dbname=phptest;unix_socket=/tmp/mysq pdo.dsn.mysql="mysql:dbname=phptest;socket=/tmp/mysql.sock" --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - - $found = false; - $values = ini_get_all(); - foreach ($values as $name => $dsn) - if ('pdo.dsn.mysql' == $name) { - printf("pdo.dsn.mysql=%s\n", $dsn); - $found = true; - break; - } - - if (!$found) { - $dsn = ini_get('pdo.dsn.mysql'); - $found = ($dsn !== false); - } - - if (!$found) - printf("pdo.dsn.mysql cannot be accessed through ini_get_all()/ini_get()\n"); - - if (MySQLPDOTest::getDSN() == $dsn) { - // we are lucky, we can run the test - try { - - $user = PDO_MYSQL_TEST_USER; - $pass = PDO_MYSQL_TEST_PASS; - $db = new PDO('mysql', $user, $pass); - - } catch (PDOException $e) { - printf("[001] %s, [%s] %s\n", - $e->getMessage(), - (is_object($db)) ? $db->errorCode() : 'n/a', - (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); - } - - } - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + + $found = false; + $values = ini_get_all(); + foreach ($values as $name => $dsn) + if ('pdo.dsn.mysql' == $name) { + printf("pdo.dsn.mysql=%s\n", $dsn); + $found = true; + break; + } + + if (!$found) { + $dsn = ini_get('pdo.dsn.mysql'); + $found = ($dsn !== false); + } + + if (!$found) + printf("pdo.dsn.mysql cannot be accessed through ini_get_all()/ini_get()\n"); + + if (MySQLPDOTest::getDSN() == $dsn) { + // we are lucky, we can run the test + try { + + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; + $db = new PDO('mysql', $user, $pass); + + } catch (PDOException $e) { + printf("[001] %s, [%s] %s\n", + $e->getMessage(), + (is_object($db)) ? $db->errorCode() : 'n/a', + (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); + } + + } + + print "done!"; ?> --EXPECT-- pdo.dsn.mysql cannot be accessed through ini_get_all()/ini_get() diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt index b7a52127c5..ac5f7f6911 100644 --- a/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt @@ -8,160 +8,160 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - - function set_option_and_check($offset, $option, $value, $option_desc) { - - $dsn = MySQLPDOTest::getDSN(); - $user = PDO_MYSQL_TEST_USER; - $pass = PDO_MYSQL_TEST_PASS; - - try { - $db = new PDO($dsn, $user, $pass, array($option => $value)); - if (!is_object($db) || ($value !== ($tmp = @$db->getAttribute($option)))) - printf("[%03d] Expecting '%s'/%s got '%s'/%s' for options '%s'\n", - $offset, - $value, gettype($value), - $tmp, gettype($tmp), - $option_desc); - } catch (PDOException $e) { - printf("[%03d] %s\n", $offset, $e->getMessage()); - } - - } - - try { - - $dsn = MySQLPDOTest::getDSN(); - $user = PDO_MYSQL_TEST_USER; - $pass = PDO_MYSQL_TEST_PASS; - - $valid_options = array( - /* pdo_dbh.c */ - PDO::ATTR_PERSISTENT => 'PDO::ATTR_PERSISTENT', - PDO::ATTR_AUTOCOMMIT => 'PDO::ATTR_AUTOCOMMIT', - /* mysql_driver.c */ - /* TODO Possible bug PDO::ATTR_TIMEOUT != MYSQLI_OPT_CONNECT_TIMEOUT*/ - PDO::ATTR_TIMEOUT => 'PDO::ATTR_TIMEOUT', - PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES', - - PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY', - PDO::MYSQL_ATTR_LOCAL_INFILE => 'PDO::MYSQL_ATTR_LOCAL_INFILE', - PDO::MYSQL_ATTR_DIRECT_QUERY => 'PDO::MYSQL_ATTR_DIRECT_QUERY', - - PDO::MYSQL_ATTR_INIT_COMMAND => 'PDO::MYSQL_ATTR_INIT_COMMAND', - PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES', - ); - - $defaults = array( - PDO::ATTR_PERSISTENT => false, - PDO::ATTR_AUTOCOMMIT => 1, - /* TODO - why is this a valid option if getAttribute() does not support it?! */ - PDO::ATTR_TIMEOUT => false, - PDO::ATTR_EMULATE_PREPARES => 1, - PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 1, - /* TODO getAttribute() does not handle it */ - PDO::MYSQL_ATTR_LOCAL_INFILE => false, - /* TODO getAttribute() does not handle it */ - PDO::MYSQL_ATTR_DIRECT_QUERY => 1, - PDO::MYSQL_ATTR_INIT_COMMAND => '', - ); - - try { - if (NULL !== ($db = @new PDO($dsn, $user, $pass, 'wrong type'))) - printf("[001] Expecting NULL got %s/%s\n", gettype($db), $db); - } catch (TypeError $e) { - } - - if (!is_object($db = new PDO($dsn, $user, $pass, array()))) - printf("[002] Expecting object got %s/%s¸\n", gettype($db), $db); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + + function set_option_and_check($offset, $option, $value, $option_desc) { + + $dsn = MySQLPDOTest::getDSN(); + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; + + try { + $db = new PDO($dsn, $user, $pass, array($option => $value)); + if (!is_object($db) || ($value !== ($tmp = @$db->getAttribute($option)))) + printf("[%03d] Expecting '%s'/%s got '%s'/%s' for options '%s'\n", + $offset, + $value, gettype($value), + $tmp, gettype($tmp), + $option_desc); + } catch (PDOException $e) { + printf("[%03d] %s\n", $offset, $e->getMessage()); + } + + } + + try { + + $dsn = MySQLPDOTest::getDSN(); + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; + + $valid_options = array( + /* pdo_dbh.c */ + PDO::ATTR_PERSISTENT => 'PDO::ATTR_PERSISTENT', + PDO::ATTR_AUTOCOMMIT => 'PDO::ATTR_AUTOCOMMIT', + /* mysql_driver.c */ + /* TODO Possible bug PDO::ATTR_TIMEOUT != MYSQLI_OPT_CONNECT_TIMEOUT*/ + PDO::ATTR_TIMEOUT => 'PDO::ATTR_TIMEOUT', + PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES', + + PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY', + PDO::MYSQL_ATTR_LOCAL_INFILE => 'PDO::MYSQL_ATTR_LOCAL_INFILE', + PDO::MYSQL_ATTR_DIRECT_QUERY => 'PDO::MYSQL_ATTR_DIRECT_QUERY', + + PDO::MYSQL_ATTR_INIT_COMMAND => 'PDO::MYSQL_ATTR_INIT_COMMAND', + PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES', + ); + + $defaults = array( + PDO::ATTR_PERSISTENT => false, + PDO::ATTR_AUTOCOMMIT => 1, + /* TODO - why is this a valid option if getAttribute() does not support it?! */ + PDO::ATTR_TIMEOUT => false, + PDO::ATTR_EMULATE_PREPARES => 1, + PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 1, + /* TODO getAttribute() does not handle it */ + PDO::MYSQL_ATTR_LOCAL_INFILE => false, + /* TODO getAttribute() does not handle it */ + PDO::MYSQL_ATTR_DIRECT_QUERY => 1, + PDO::MYSQL_ATTR_INIT_COMMAND => '', + ); + + try { + if (NULL !== ($db = @new PDO($dsn, $user, $pass, 'wrong type'))) + printf("[001] Expecting NULL got %s/%s\n", gettype($db), $db); + } catch (TypeError $e) { + } + + if (!is_object($db = new PDO($dsn, $user, $pass, array()))) + printf("[002] Expecting object got %s/%s¸\n", gettype($db), $db); $invalid = 999; - if (is_object($db = new PDO($dsn, $user, $pass, array($invalid => true)))) - printf("[003] [TODO][CHANGEREQUEST] Please, lets not ignore invalid options and bail out!\n"); - - $db = new PDO($dsn, $user, $pass); - foreach ($valid_options as $option => $name) { - /* TODO getAttribute() is pretty poor in supporting the options, suppress errors */ - $tmp = @$db->getAttribute($option); - if ($tmp !== $defaults[$option]) - printf("[003a] Expecting default value for '%s' of '%s'/%s, getAttribute() reports setting '%s'/%s\n", - $name, $defaults[$option], gettype($defaults[$option]), - $tmp, gettype($tmp)); - } - - $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => true)); - if (!is_object($db) || !$db->getAttribute(PDO::ATTR_AUTOCOMMIT)) - printf("[004] Autocommit should be on\n"); - - $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => false)); - if (!is_object($db) || $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) - printf("[005] Autocommit should be off\n"); - - /* TODO: no way to check ATTR_TIMEOUT settings */ - if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => 10)))) - printf("[006] ATTR_TIMEOUT should be accepted\n"); - - if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => PHP_INT_MAX)))) - printf("[007] ATTR_TIMEOUT should be accepted\n"); - - if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => -PHP_INT_MAX)))) - printf("[008] ATTR_TIMEOUT should be accepted\n"); - - /* TODO: Its ugly that PDO::ATTR_EMULATE_PREPARES == PDO::MYSQL_ATTR_DIRECT_QUERY */ - $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true)); - if (!is_object($db)) - printf("[009] ATTR_EMULATE_PREPARES should be accepted and on\n"); - if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES)) - printf("[010] [TODO][CHANGEREQUEST] ATTR_EMULATE_PREPARES should be on\n"); - if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[011] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES - and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n"); - - $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false)); - if (!is_object($db)) - printf("[012] ATTR_EMULATE_PREPARES should be accepted and on\n"); - if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES)) - printf("[013] [TODO][CHANGEREQUEST] ATTR_EMULATE_PREPARES should be off\n"); - if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[014] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES - and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n"); - - // PDO::ATTR_EMULATE_PREPARES overrules PDO::MYSQL_ATTR_DIRECT_QUERY - // TODO: is it clever that a generic setting overrules a specific setting? - $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true, PDO::MYSQL_ATTR_DIRECT_QUERY => false)); - if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES)) - printf("[015] PDO::ATTR_EMULATE_PREPARES should be on\n"); - if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[016] PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n"); - - $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::MYSQL_ATTR_DIRECT_QUERY => true)); - if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES)) - printf("[017] PDO::ATTR_EMULATE_PREPARES should be off\n"); - if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[018] PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n"); - - set_option_and_check(19, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY'); - set_option_and_check(20, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY'); - - set_option_and_check(21, PDO::MYSQL_ATTR_LOCAL_INFILE, true, 'PDO::MYSQL_ATTR_LOCAL_INFILE'); - set_option_and_check(22, PDO::MYSQL_ATTR_LOCAL_INFILE, false, 'PDO::MYSQL_ATTR_LOCAL_INFILE'); - - set_option_and_check(23, PDO::MYSQL_ATTR_INIT_COMMAND, 'SET @a=1', 'PDO::MYSQL_ATTR_INIT_COMMAND'); - set_option_and_check(24, PDO::MYSQL_ATTR_INIT_COMMAND, '', 'PDO::MYSQL_ATTR_INIT_COMMAND'); - set_option_and_check(25, PDO::MYSQL_ATTR_INIT_COMMAND, 'INSERT INTO nonexistent(invalid) VALUES (1)', 'PDO::MYSQL_ATTR_INIT_COMMAND'); - - set_option_and_check(33, PDO::MYSQL_ATTR_DIRECT_QUERY, 1, 'PDO::MYSQL_ATTR_DIRECT_QUERY'); - set_option_and_check(34, PDO::MYSQL_ATTR_DIRECT_QUERY, 0, 'PDO::MYSQL_ATTR_DIRECT_QUERY'); - - } catch (PDOException $e) { - printf("[001] %s, [%s] %s\n", - $e->getMessage(), - (is_object($db)) ? $db->errorCode() : 'n/a', - (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); - } - - print "done!"; + if (is_object($db = new PDO($dsn, $user, $pass, array($invalid => true)))) + printf("[003] [TODO][CHANGEREQUEST] Please, lets not ignore invalid options and bail out!\n"); + + $db = new PDO($dsn, $user, $pass); + foreach ($valid_options as $option => $name) { + /* TODO getAttribute() is pretty poor in supporting the options, suppress errors */ + $tmp = @$db->getAttribute($option); + if ($tmp !== $defaults[$option]) + printf("[003a] Expecting default value for '%s' of '%s'/%s, getAttribute() reports setting '%s'/%s\n", + $name, $defaults[$option], gettype($defaults[$option]), + $tmp, gettype($tmp)); + } + + $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => true)); + if (!is_object($db) || !$db->getAttribute(PDO::ATTR_AUTOCOMMIT)) + printf("[004] Autocommit should be on\n"); + + $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => false)); + if (!is_object($db) || $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) + printf("[005] Autocommit should be off\n"); + + /* TODO: no way to check ATTR_TIMEOUT settings */ + if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => 10)))) + printf("[006] ATTR_TIMEOUT should be accepted\n"); + + if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => PHP_INT_MAX)))) + printf("[007] ATTR_TIMEOUT should be accepted\n"); + + if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => -PHP_INT_MAX)))) + printf("[008] ATTR_TIMEOUT should be accepted\n"); + + /* TODO: Its ugly that PDO::ATTR_EMULATE_PREPARES == PDO::MYSQL_ATTR_DIRECT_QUERY */ + $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true)); + if (!is_object($db)) + printf("[009] ATTR_EMULATE_PREPARES should be accepted and on\n"); + if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES)) + printf("[010] [TODO][CHANGEREQUEST] ATTR_EMULATE_PREPARES should be on\n"); + if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[011] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES + and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n"); + + $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false)); + if (!is_object($db)) + printf("[012] ATTR_EMULATE_PREPARES should be accepted and on\n"); + if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES)) + printf("[013] [TODO][CHANGEREQUEST] ATTR_EMULATE_PREPARES should be off\n"); + if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[014] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES + and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n"); + + // PDO::ATTR_EMULATE_PREPARES overrules PDO::MYSQL_ATTR_DIRECT_QUERY + // TODO: is it clever that a generic setting overrules a specific setting? + $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true, PDO::MYSQL_ATTR_DIRECT_QUERY => false)); + if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES)) + printf("[015] PDO::ATTR_EMULATE_PREPARES should be on\n"); + if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[016] PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n"); + + $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::MYSQL_ATTR_DIRECT_QUERY => true)); + if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES)) + printf("[017] PDO::ATTR_EMULATE_PREPARES should be off\n"); + if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[018] PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n"); + + set_option_and_check(19, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY'); + set_option_and_check(20, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY'); + + set_option_and_check(21, PDO::MYSQL_ATTR_LOCAL_INFILE, true, 'PDO::MYSQL_ATTR_LOCAL_INFILE'); + set_option_and_check(22, PDO::MYSQL_ATTR_LOCAL_INFILE, false, 'PDO::MYSQL_ATTR_LOCAL_INFILE'); + + set_option_and_check(23, PDO::MYSQL_ATTR_INIT_COMMAND, 'SET @a=1', 'PDO::MYSQL_ATTR_INIT_COMMAND'); + set_option_and_check(24, PDO::MYSQL_ATTR_INIT_COMMAND, '', 'PDO::MYSQL_ATTR_INIT_COMMAND'); + set_option_and_check(25, PDO::MYSQL_ATTR_INIT_COMMAND, 'INSERT INTO nonexistent(invalid) VALUES (1)', 'PDO::MYSQL_ATTR_INIT_COMMAND'); + + set_option_and_check(33, PDO::MYSQL_ATTR_DIRECT_QUERY, 1, 'PDO::MYSQL_ATTR_DIRECT_QUERY'); + set_option_and_check(34, PDO::MYSQL_ATTR_DIRECT_QUERY, 0, 'PDO::MYSQL_ATTR_DIRECT_QUERY'); + + } catch (PDOException $e) { + printf("[001] %s, [%s] %s\n", + $e->getMessage(), + (is_object($db)) ? $db->errorCode() : 'n/a', + (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); + } + + print "done!"; ?> --EXPECTF-- [003] [TODO][CHANGEREQUEST] Please, lets not ignore invalid options and bail out! diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_options_libmysql.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_options_libmysql.phpt index 3d7e1d4396..99754c9058 100644 --- a/ext/pdo_mysql/tests/pdo_mysql___construct_options_libmysql.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql___construct_options_libmysql.phpt @@ -10,72 +10,72 @@ if (MySQLPDOTest::isPDOMySQLnd()) ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - function set_option_and_check($offset, $option, $value, $option_desc, $ignore_diff = false) { + function set_option_and_check($offset, $option, $value, $option_desc, $ignore_diff = false) { - $dsn = MySQLPDOTest::getDSN(); - $user = PDO_MYSQL_TEST_USER; - $pass = PDO_MYSQL_TEST_PASS; + $dsn = MySQLPDOTest::getDSN(); + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; - try { - $db = new PDO($dsn, $user, $pass, array($option => $value)); - if (!is_object($db) || (!$ignore_diff && ($value !== ($tmp = @$db->getAttribute($option))))) - printf("[%03d] Expecting '%s'/%s got '%s'/%s' for options '%s'\n", - $offset, - $value, gettype($value), - $tmp, gettype($tmp), - $option_desc); - } catch (PDOException $e) { - printf("[%03d] %s\n", $offset, $e->getMessage()); - } + try { + $db = new PDO($dsn, $user, $pass, array($option => $value)); + if (!is_object($db) || (!$ignore_diff && ($value !== ($tmp = @$db->getAttribute($option))))) + printf("[%03d] Expecting '%s'/%s got '%s'/%s' for options '%s'\n", + $offset, + $value, gettype($value), + $tmp, gettype($tmp), + $option_desc); + } catch (PDOException $e) { + printf("[%03d] %s\n", $offset, $e->getMessage()); + } - } + } - try { + try { - $dsn = MySQLPDOTest::getDSN(); - $user = PDO_MYSQL_TEST_USER; - $pass = PDO_MYSQL_TEST_PASS; + $dsn = MySQLPDOTest::getDSN(); + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; - $valid_options = array(); - $valid_options[PDO::MYSQL_ATTR_MAX_BUFFER_SIZE] = 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE'; - $valid_options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'PDO::MYSQL_ATTR_INIT_COMMAND'; - $valid_options[PDO::MYSQL_ATTR_READ_DEFAULT_FILE] = 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE'; - $valid_options[PDO::MYSQL_ATTR_READ_DEFAULT_GROUP] = 'PDO::MYSQL_ATTR_READ_DEFAULT_GROUP'; + $valid_options = array(); + $valid_options[PDO::MYSQL_ATTR_MAX_BUFFER_SIZE] = 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE'; + $valid_options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'PDO::MYSQL_ATTR_INIT_COMMAND'; + $valid_options[PDO::MYSQL_ATTR_READ_DEFAULT_FILE] = 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE'; + $valid_options[PDO::MYSQL_ATTR_READ_DEFAULT_GROUP] = 'PDO::MYSQL_ATTR_READ_DEFAULT_GROUP'; - $defaults[PDO::MYSQL_ATTR_MAX_BUFFER_SIZE] = 1048576; - /* TODO getAttribute() does not handle it */ - $defaults[PDO::MYSQL_ATTR_INIT_COMMAND] = ''; - $defaults[PDO::MYSQL_ATTR_READ_DEFAULT_FILE] = false; - $defaults[PDO::MYSQL_ATTR_READ_DEFAULT_GROUP] = false; + $defaults[PDO::MYSQL_ATTR_MAX_BUFFER_SIZE] = 1048576; + /* TODO getAttribute() does not handle it */ + $defaults[PDO::MYSQL_ATTR_INIT_COMMAND] = ''; + $defaults[PDO::MYSQL_ATTR_READ_DEFAULT_FILE] = false; + $defaults[PDO::MYSQL_ATTR_READ_DEFAULT_GROUP] = false; - $db = new PDO($dsn, $user, $pass); - foreach ($valid_options as $option => $name) { - /* TODO getAttribute() is pretty poor in supporting the options, suppress errors */ - $tmp = @$db->getAttribute($option); - if ($tmp !== $defaults[$option]) - printf("[001] Expecting default value for '%s' of '%s'/%s, getAttribute() reports setting '%s'/%s\n", - $name, $defaults[$option], gettype($defaults[$option]), - $tmp, gettype($tmp)); - } + $db = new PDO($dsn, $user, $pass); + foreach ($valid_options as $option => $name) { + /* TODO getAttribute() is pretty poor in supporting the options, suppress errors */ + $tmp = @$db->getAttribute($option); + if ($tmp !== $defaults[$option]) + printf("[001] Expecting default value for '%s' of '%s'/%s, getAttribute() reports setting '%s'/%s\n", + $name, $defaults[$option], gettype($defaults[$option]), + $tmp, gettype($tmp)); + } - set_option_and_check(26, PDO::MYSQL_ATTR_READ_DEFAULT_FILE, true, 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE'); - set_option_and_check(27, PDO::MYSQL_ATTR_READ_DEFAULT_FILE, false, 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE'); + set_option_and_check(26, PDO::MYSQL_ATTR_READ_DEFAULT_FILE, true, 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE'); + set_option_and_check(27, PDO::MYSQL_ATTR_READ_DEFAULT_FILE, false, 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE'); - set_option_and_check(30, PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, -1, 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE', true); - set_option_and_check(31, PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, PHP_INT_MAX, 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE'); - set_option_and_check(32, PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, 1, 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE'); + set_option_and_check(30, PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, -1, 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE', true); + set_option_and_check(31, PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, PHP_INT_MAX, 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE'); + set_option_and_check(32, PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, 1, 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE'); - } catch (PDOException $e) { - printf("[001] %s, [%s] %s\n", - $e->getMessage(), - (is_object($db)) ? $db->errorCode() : 'n/a', - (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); - } + } catch (PDOException $e) { + printf("[001] %s, [%s] %s\n", + $e->getMessage(), + (is_object($db)) ? $db->errorCode() : 'n/a', + (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); + } - print "done!"; + print "done!"; ?> --EXPECT-- [001] Expecting default value for 'PDO::MYSQL_ATTR_INIT_COMMAND' of ''/string, getAttribute() reports setting ''/boolean diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt index 7418033768..8d51961c9d 100644 --- a/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt @@ -8,68 +8,68 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - try { + try { - if ($tmp = MySQLPDOTest::getTempDir()) { + if ($tmp = MySQLPDOTest::getTempDir()) { - $file = $tmp . DIRECTORY_SEPARATOR . 'pdomuri.tst'; - $dsn = MySQLPDOTest::getDSN(); - $user = PDO_MYSQL_TEST_USER; - $pass = PDO_MYSQL_TEST_PASS; - $uri = sprintf('uri:file://%s', (substr(PHP_OS, 0, 3) == 'WIN' ? str_replace('\\', '/', $file) : $file)); + $file = $tmp . DIRECTORY_SEPARATOR . 'pdomuri.tst'; + $dsn = MySQLPDOTest::getDSN(); + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; + $uri = sprintf('uri:file://%s', (substr(PHP_OS, 0, 3) == 'WIN' ? str_replace('\\', '/', $file) : $file)); - if ($fp = @fopen($file, 'w')) { - // ok, great we can create a file with a DSN in it - fwrite($fp, $dsn); - fclose($fp); - clearstatcache(); - assert(file_exists($file)); - try { - $db = new PDO($uri, $user, $pass); - } catch (PDOException $e) { - printf("[002] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), %s\n", - $uri, $dsn, - $file, filesize($file), file_get_contents($file), - $e->getMessage()); - } - unlink($file); - } + if ($fp = @fopen($file, 'w')) { + // ok, great we can create a file with a DSN in it + fwrite($fp, $dsn); + fclose($fp); + clearstatcache(); + assert(file_exists($file)); + try { + $db = new PDO($uri, $user, $pass); + } catch (PDOException $e) { + printf("[002] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), %s\n", + $uri, $dsn, + $file, filesize($file), file_get_contents($file), + $e->getMessage()); + } + unlink($file); + } - if ($fp = @fopen($file, 'w')) { - fwrite($fp, sprintf('mysql:dbname=letshopeinvalid;%s%s', - chr(0), $dsn)); - fclose($fp); - clearstatcache(); - assert(file_exists($file)); - try { - $db = new PDO($uri, $user, $pass); - } catch (PDOException $e) { - $expected = array( - "SQLSTATE[HY000] [1049] Unknown database 'letshopeinvalid'", - "SQLSTATE[HY000] [2002] No such file or directory" - ); - printf("[003] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), chr(0) test, %s\n", - $uri, $dsn, - $file, filesize($file), file_get_contents($file), - (in_array($e->getMessage(), $expected) ? 'EXPECTED ERROR' : $e->getMessage())); - } - unlink($file); - } + if ($fp = @fopen($file, 'w')) { + fwrite($fp, sprintf('mysql:dbname=letshopeinvalid;%s%s', + chr(0), $dsn)); + fclose($fp); + clearstatcache(); + assert(file_exists($file)); + try { + $db = new PDO($uri, $user, $pass); + } catch (PDOException $e) { + $expected = array( + "SQLSTATE[HY000] [1049] Unknown database 'letshopeinvalid'", + "SQLSTATE[HY000] [2002] No such file or directory" + ); + printf("[003] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), chr(0) test, %s\n", + $uri, $dsn, + $file, filesize($file), file_get_contents($file), + (in_array($e->getMessage(), $expected) ? 'EXPECTED ERROR' : $e->getMessage())); + } + unlink($file); + } - } + } - /* TODO: safe mode */ + /* TODO: safe mode */ - } catch (PDOException $e) { - printf("[001] %s, [%s] %s\n", - $e->getMessage(), - (is_object($db)) ? $db->errorCode() : 'n/a', - (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); - } + } catch (PDOException $e) { + printf("[001] %s, [%s] %s\n", + $e->getMessage(), + (is_object($db)) ? $db->errorCode() : 'n/a', + (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); + } - print "done!"; + print "done!"; ?> --EXPECTF-- [003] URI=uri:file://%spdomuri.tst, DSN=mysql%sdbname=%s, File=%spdomuri.tst (%d bytes, 'mysql%sdbname=letshopeinvalid%s'), chr(0) test, EXPECTED ERROR diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt index 361750260b..0dd8663d08 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt @@ -9,85 +9,85 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - // autocommit should be on by default - if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT))) - printf("[001] Expecting int/1 got %s\n", var_export($tmp, true)); + // autocommit should be on by default + if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT))) + printf("[001] Expecting int/1 got %s\n", var_export($tmp, true)); - // lets see if the server agrees to that - $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC); - if (!$row['_autocommit']) - printf("[002] Server autocommit mode should be on, got '%s'\n", var_export($row['_autocommit'])); + // lets see if the server agrees to that + $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC); + if (!$row['_autocommit']) + printf("[002] Server autocommit mode should be on, got '%s'\n", var_export($row['_autocommit'])); - // on -> off - if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0)) - printf("[003] Cannot turn off autocommit\n"); + // on -> off + if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0)) + printf("[003] Cannot turn off autocommit\n"); - $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC); - if ($row['_autocommit']) - printf("[004] Server autocommit mode should be off, got '%s'\n", var_export($row['_autocommit'])); + $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC); + if ($row['_autocommit']) + printf("[004] Server autocommit mode should be off, got '%s'\n", var_export($row['_autocommit'])); - // PDO thinks autocommit is off, but its manually turned on... - if (!$db->query('SET autocommit = 1')) - printf("[005] Cannot turn on server autocommit mode, %s\n", var_export($db->errorInfo(), true)); + // PDO thinks autocommit is off, but its manually turned on... + if (!$db->query('SET autocommit = 1')) + printf("[005] Cannot turn on server autocommit mode, %s\n", var_export($db->errorInfo(), true)); - if (0 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT))) - printf("[006] Expecting int/0 got %s\n", var_export($tmp, true)); + if (0 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT))) + printf("[006] Expecting int/0 got %s\n", var_export($tmp, true)); - // off -> on - if (!$db->query('SET autocommit = 0')) - printf("[007] Cannot turn off server autocommit mode, %s\n", var_export($db->errorInfo(), true)); + // off -> on + if (!$db->query('SET autocommit = 0')) + printf("[007] Cannot turn off server autocommit mode, %s\n", var_export($db->errorInfo(), true)); - if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1)) - printf("[008] Cannot turn on autocommit\n"); + if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1)) + printf("[008] Cannot turn on autocommit\n"); - $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC); - if (!$row['_autocommit']) - printf("[009] Server autocommit mode should be on, got '%s'\n", var_export($row['_autocommit'])); + $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC); + if (!$row['_autocommit']) + printf("[009] Server autocommit mode should be on, got '%s'\n", var_export($row['_autocommit'])); - if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT))) - printf("[010] Expecting int/1 got %s\n", var_export($tmp, true)); + if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT))) + printf("[010] Expecting int/1 got %s\n", var_export($tmp, true)); - if (MySQLPDOTest::detect_transactional_mysql_engine($db)) { - // nice, we have a transactional engine to play with + if (MySQLPDOTest::detect_transactional_mysql_engine($db)) { + // nice, we have a transactional engine to play with - MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); - $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); - $num = $row['_num']; + MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); + $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); + $num = $row['_num']; - $db->query("INSERT INTO test(id, label) VALUES (100, 'z')"); - $num++; - $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); - if ($row['_num'] != $num) - printf("[011] Insert has failed, test will fail\n"); + $db->query("INSERT INTO test(id, label) VALUES (100, 'z')"); + $num++; + $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); + if ($row['_num'] != $num) + printf("[011] Insert has failed, test will fail\n"); - // autocommit is on, no rollback possible - $db->query('ROLLBACK'); - $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); - if ($row['_num'] != $num) - printf("[012] ROLLBACK should not have undone anything\n"); + // autocommit is on, no rollback possible + $db->query('ROLLBACK'); + $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); + if ($row['_num'] != $num) + printf("[012] ROLLBACK should not have undone anything\n"); - if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0)) - printf("[013] Cannot turn off autocommit\n"); + if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0)) + printf("[013] Cannot turn off autocommit\n"); - $db->query('DELETE FROM test WHERE id = 100'); - $db->query('ROLLBACK'); - $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); - if ($row['_num'] != $num) - printf("[014] ROLLBACK should have undone the DELETE\n"); + $db->query('DELETE FROM test WHERE id = 100'); + $db->query('ROLLBACK'); + $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); + if ($row['_num'] != $num) + printf("[014] ROLLBACK should have undone the DELETE\n"); - $db->query('DELETE FROM test WHERE id = 100'); - $db->query('COMMIT'); - $num--; - $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); - if ($row['_num'] != $num) - printf("[015] DELETE should have been committed\n"); + $db->query('DELETE FROM test WHERE id = 100'); + $db->query('COMMIT'); + $num--; + $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); + if ($row['_num'] != $num) + printf("[015] DELETE should have been committed\n"); - } + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt index a011c864c5..2b45154248 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt @@ -9,80 +9,80 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); - $default = $db->getAttribute(PDO::ATTR_CASE); - $known = array( - PDO::CASE_LOWER => 'PDO::CASE_LOWER', - PDO::CASE_UPPER => 'PDO::CASE_UPPER', - PDO::CASE_NATURAL => 'PDO::CASE_NATURAL' - ); - if (!isset($known[$default])) - printf("[001] getAttribute(PDO::ATTR_CASE) returns unknown value '%s'\n", - var_export($default, true)); - else - var_dump($known[$default]); + $default = $db->getAttribute(PDO::ATTR_CASE); + $known = array( + PDO::CASE_LOWER => 'PDO::CASE_LOWER', + PDO::CASE_UPPER => 'PDO::CASE_UPPER', + PDO::CASE_NATURAL => 'PDO::CASE_NATURAL' + ); + if (!isset($known[$default])) + printf("[001] getAttribute(PDO::ATTR_CASE) returns unknown value '%s'\n", + var_export($default, true)); + else + var_dump($known[$default]); - // lets see what the default is... - if (!is_object($stmt = $db->query("SELECT id, id AS 'ID_UPPER', label FROM test ORDER BY id ASC LIMIT 2"))) - printf("[002] %s - %s\n", - var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); + // lets see what the default is... + if (!is_object($stmt = $db->query("SELECT id, id AS 'ID_UPPER', label FROM test ORDER BY id ASC LIMIT 2"))) + printf("[002] %s - %s\n", + var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); - var_dump($stmt->fetchAll(PDO::FETCH_BOTH)); + var_dump($stmt->fetchAll(PDO::FETCH_BOTH)); - if (true !== $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER)) - printf("[003] Cannot set PDO::ATTR_CASE = PDO::CASE_LOWER, %s - %s\n", - var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); + if (true !== $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER)) + printf("[003] Cannot set PDO::ATTR_CASE = PDO::CASE_LOWER, %s - %s\n", + var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); - if (($tmp = $db->getAttribute(PDO::ATTR_CASE)) !== PDO::CASE_LOWER) - printf("[004] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n", - var_export($tmp, true)); + if (($tmp = $db->getAttribute(PDO::ATTR_CASE)) !== PDO::CASE_LOWER) + printf("[004] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n", + var_export($tmp, true)); - if (true === $db->exec('ALTER TABLE test ADD MiXeD CHAR(1)')) - printf("[005] Cannot add column %s - %s\n", - var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); + if (true === $db->exec('ALTER TABLE test ADD MiXeD CHAR(1)')) + printf("[005] Cannot add column %s - %s\n", + var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); - if (false === $db->exec('ALTER TABLE test ADD MYUPPER CHAR(1)')) - printf("[006] Cannot add column %s - %s\n", - var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); + if (false === $db->exec('ALTER TABLE test ADD MYUPPER CHAR(1)')) + printf("[006] Cannot add column %s - %s\n", + var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); - if (!is_object($stmt = $db->query("SELECT id, id AS 'ID_UPPER', label, MiXeD, MYUPPER FROM test ORDER BY id ASC LIMIT 2"))) - printf("[007] %s - %s\n", - var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); + if (!is_object($stmt = $db->query("SELECT id, id AS 'ID_UPPER', label, MiXeD, MYUPPER FROM test ORDER BY id ASC LIMIT 2"))) + printf("[007] %s - %s\n", + var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); - var_dump($stmt->fetchAll(PDO::FETCH_BOTH)); + var_dump($stmt->fetchAll(PDO::FETCH_BOTH)); - if (true !== $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER)) - printf("[008] Cannot set PDO::ATTR_CASE = PDO::CASE_UPPER %s - %s\n", - var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); + if (true !== $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER)) + printf("[008] Cannot set PDO::ATTR_CASE = PDO::CASE_UPPER %s - %s\n", + var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); - if (($tmp = $db->getAttribute(PDO::ATTR_CASE)) !== PDO::CASE_UPPER) - printf("[009] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n", - var_export($tmp, true)); + if (($tmp = $db->getAttribute(PDO::ATTR_CASE)) !== PDO::CASE_UPPER) + printf("[009] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n", + var_export($tmp, true)); - if (!is_object($stmt = $db->query("SELECT id, label, MiXeD, MYUPPER, MYUPPER AS 'lower' FROM test ORDER BY id ASC LIMIT 1"))) - printf("[010] %s - %s\n", - var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); + if (!is_object($stmt = $db->query("SELECT id, label, MiXeD, MYUPPER, MYUPPER AS 'lower' FROM test ORDER BY id ASC LIMIT 1"))) + printf("[010] %s - %s\n", + var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); - var_dump($stmt->fetchAll(PDO::FETCH_BOTH)); + var_dump($stmt->fetchAll(PDO::FETCH_BOTH)); - if (true !== $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL)) - printf("[011] Cannot set PDO::ATTR_CASE = PDO::CASE_NATURAL %s - %s\n", - var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); + if (true !== $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL)) + printf("[011] Cannot set PDO::ATTR_CASE = PDO::CASE_NATURAL %s - %s\n", + var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); - if (($tmp = $db->getAttribute(PDO::ATTR_CASE)) !== PDO::CASE_NATURAL) - printf("[012] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n", - var_export($tmp, true)); + if (($tmp = $db->getAttribute(PDO::ATTR_CASE)) !== PDO::CASE_NATURAL) + printf("[012] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n", + var_export($tmp, true)); - if (!is_object($stmt = $db->query("SELECT id, label, MiXeD, MYUPPER, id AS 'ID' FROM test ORDER BY id ASC LIMIT 1"))) - printf("[013] %s - %s\n", - var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); + if (!is_object($stmt = $db->query("SELECT id, label, MiXeD, MYUPPER, id AS 'ID' FROM test ORDER BY id ASC LIMIT 1"))) + printf("[013] %s - %s\n", + var_export($db->errorInfo(), true), var_export($db->errorCode(), true)); - var_dump($stmt->fetchAll(PDO::FETCH_BOTH)); + var_dump($stmt->fetchAll(PDO::FETCH_BOTH)); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_client_version.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_client_version.phpt index ce50df80eb..604ec90c41 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_client_version.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_client_version.phpt @@ -9,29 +9,29 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - assert(('' == $db->errorCode()) || ('00000' == $db->errorCode())); + assert(('' == $db->errorCode()) || ('00000' == $db->errorCode())); - $version = $db->getAttribute(PDO::ATTR_CLIENT_VERSION); + $version = $db->getAttribute(PDO::ATTR_CLIENT_VERSION); - // No more constraints - mysqlnd and libmysql return different strings at least - // with mysqli. Return type check is already performed in the generic test. - // According to the manual we should get an int but as of today we do get a string... - if ('' == $version) - printf("[001] Client version must not be empty\n"); + // No more constraints - mysqlnd and libmysql return different strings at least + // with mysqli. Return type check is already performed in the generic test. + // According to the manual we should get an int but as of today we do get a string... + if ('' == $version) + printf("[001] Client version must not be empty\n"); - // Read-only - if (false !== $db->setAttribute(PDO::ATTR_CLIENT_VERSION, '1.0')) - printf("[002] Wonderful, I can change the client version!\n"); + // Read-only + if (false !== $db->setAttribute(PDO::ATTR_CLIENT_VERSION, '1.0')) + printf("[002] Wonderful, I can change the client version!\n"); - $new_version = $db->getAttribute(PDO::ATTR_CLIENT_VERSION); - if ($new_version !== $version) - printf("[003] Did we change it from '%s' to '%s'?\n", $version, $new_version); + $new_version = $db->getAttribute(PDO::ATTR_CLIENT_VERSION); + if ($new_version !== $version) + printf("[003] Did we change it from '%s' to '%s'?\n", $version, $new_version); - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_connection_status.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_connection_status.phpt index 8abb16a1c7..07a1de5b65 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_connection_status.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_connection_status.phpt @@ -9,24 +9,24 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - $status = $db->getAttribute(PDO::ATTR_CONNECTION_STATUS); + $status = $db->getAttribute(PDO::ATTR_CONNECTION_STATUS); if (!is_string($status)) printf("[002] Expecting string, got '%s'\n", var_export($status, true)); - if ('' == $status) - printf("[003] Connection status string must not be empty\n"); + if ('' == $status) + printf("[003] Connection status string must not be empty\n"); - if (false !== $db->setAttribute(PDO::ATTR_CONNECTION_STATUS, 'my own connection status')) - printf("[004] Changing read only attribute\n"); + if (false !== $db->setAttribute(PDO::ATTR_CONNECTION_STATUS, 'my own connection status')) + printf("[004] Changing read only attribute\n"); - $status2 = $db->getAttribute(PDO::ATTR_CONNECTION_STATUS); - if ($status !== $status2) - printf("[005] Connection status should not have changed\n"); + $status2 = $db->getAttribute(PDO::ATTR_CONNECTION_STATUS); + if ($status !== $status2) + printf("[005] Connection status should not have changed\n"); - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt index 65ab531ffd..e105a0eac1 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt @@ -9,22 +9,22 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - assert(('' == $db->errorCode()) || ('00000' == $db->errorCode())); + assert(('' == $db->errorCode()) || ('00000' == $db->errorCode())); - $name = $db->getAttribute(PDO::ATTR_DRIVER_NAME); - var_dump($name); + $name = $db->getAttribute(PDO::ATTR_DRIVER_NAME); + var_dump($name); - if (false !== $db->setAttribute(PDO::ATTR_DRIVER_NAME, 'mydriver')) - printf("[001] Wonderful, I can create new PDO drivers!\n"); + if (false !== $db->setAttribute(PDO::ATTR_DRIVER_NAME, 'mydriver')) + printf("[001] Wonderful, I can create new PDO drivers!\n"); - $new_name = $db->getAttribute(PDO::ATTR_DRIVER_NAME); - if ($name != $new_name) - printf("[002] Did we change it from '%s' to '%s'?\n", $name, $new_name); + $new_name = $db->getAttribute(PDO::ATTR_DRIVER_NAME); + if ($name != $new_name) + printf("[002] Did we change it from '%s' to '%s'?\n", $name, $new_name); - print "done!"; + print "done!"; ?> --EXPECT-- string(5) "mysql" diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_errmode.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_errmode.phpt index f0dc29b8d4..13c331633c 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_errmode.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_errmode.phpt @@ -11,153 +11,153 @@ $db = MySQLPDOTest::factory(); error_reporting=E_ALL --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - - $valid = array(PDO::ERRMODE_SILENT, PDO::ERRMODE_WARNING, PDO::ERRMODE_EXCEPTION); - do { - $invalid = mt_rand(-1000, 1000); - } while (in_array($invalid, $valid)); - - - $tmp = array(); - if (false != @$db->setAttribute(PDO::ATTR_ERRMODE, $tmp)) - printf("[001] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...\n"); - - $tmp = new stdClass(); - $ret = @$db->setAttribute(PDO::ATTR_ERRMODE, $tmp); - if (false != $ret) - printf("[002] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...%s\n", - var_export($ret, true)); - - $ret = @$db->setAttribute(PDO::ATTR_ERRMODE, 'pdo'); - if (false != $ret) - printf("[003] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...%s\n", - var_export($ret, true)); - - if (false != @$db->setAttribute(PDO::ATTR_ERRMODE, $invalid)) - printf("[004] Invalid ERRMODE should be rejected\n"); - - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); - // no message for any PDO call but... - $db->query('THIS IS NOT VALID SQL'); - // ... still messages for everything else - $code = $db->errorCode(); - $info = $db->errorInfo(); - - if ($code != '42000') - printf("[005] Expecting SQL code 42000 got '%s'\n", $code); - if ($code !== $info[0]) - printf("[006] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n", - $code, $info[0]); - if ('' == $info[1]) - printf("[007] Driver specific error code not set\n"); - if ('' == $info[2]) - printf("[008] Driver specific error message not set\n"); - - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - $db->query('THIS IS NOT VALID SQL'); - - $code = $db->errorCode(); - $info = $db->errorInfo(); - - if ($code != '42000') - printf("[009] Expecting SQL code 42000 got '%s'\n", $code); - if ($code !== $info[0]) - printf("[010] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n", - $code, $info[0]); - if ('' == $info[1]) - printf("[011] Driver specific error code not set\n"); - if ('' == $info[2]) - printf("[012] Driver specific error message not set\n"); - - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - try { - $line = __LINE__ + 1; - $db->query('THIS IS NOT VALID SQL'); - } catch (PDOException $e) { - - $code = $db->errorCode(); - $info = $db->errorInfo(); - - if ($code != '42000') - printf("[013] Expecting SQL code 42000 got '%s'\n", $code); - if ($code !== $info[0]) - printf("[014] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n", - $code, $info[0]); - if ('' == $info[1]) - printf("[015] Driver specific error code not set\n"); - if ('' == $info[2]) - printf("[016] Driver specific error message not set\n"); - - if ($e->getCode() !== $code) - printf("[017] Exception code '%s' differs from errorCode '%s'\n", - $e->getCode(), $code); - - $msg = $e->getMessage(); - foreach ($info as $k => $v) { - if (false === stristr($msg, (string)$v)) { - printf("[018] Cannot find all parts of the error info ('%s') in the exception message '%s'\n", - $v, $msg); - } - } - - if ($e->getLine() !== $line) - printf("[019] Exception has been thrown in line %d, exception object reports line %d\n", - $line, $e->getLine()); - - if ($e->getFile() !== __FILE__) - printf("[020] Exception has been thrown in file '%s', exception object reports file '%s'\n", - __FILE__, $e->getFile()); - - } - - function my_handler($e) { - global $db, $line; - - $code = $db->errorCode(); - $info = $db->errorInfo(); - - if ($code != '42000') - printf("[021] Expecting SQL code 42000 got '%s'\n", $code); - if ($code !== $info[0]) - printf("[022] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n", - $code, $info[0]); - if ('' == $info[1]) - printf("[023] Driver specific error code not set\n"); - if ('' == $info[2]) - printf("[024] Driver specific error message not set\n"); - - if ($e->getCode() !== $code) - printf("[025] Exception code '%s' differs from errorCode '%s'\n", - $e->getCode(), $code); - - $msg = $e->getMessage(); - foreach ($info as $k => $v) { - if (false === stristr($msg, (string)$v)) { - printf("[026] Cannot find all parts of the error info ('%s') in the exception message '%s'\n", - $v, $msg); - } - } - - if ($e->getLine() !== $line) - printf("[027] Exception has been thrown in line %d, exception object reports line %d\n", - $line, $e->getLine()); - - if ($e->getFile() !== __FILE__) - printf("[028] Exception has been thrown in file '%s', exception object reports file '%s'\n", - __FILE__, $e->getFile()); - - if (get_class($e) != 'PDOException') - printf("[029] Expecting PDO exception got exception of type '%s'\n", get_class($e)); - - print "\nend of execution"; - } - set_exception_handler('my_handler'); - $line = __LINE__ + 1; - $db->query('THIS IS NOT VALID SQL'); - - print "done!\n"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + + $valid = array(PDO::ERRMODE_SILENT, PDO::ERRMODE_WARNING, PDO::ERRMODE_EXCEPTION); + do { + $invalid = mt_rand(-1000, 1000); + } while (in_array($invalid, $valid)); + + + $tmp = array(); + if (false != @$db->setAttribute(PDO::ATTR_ERRMODE, $tmp)) + printf("[001] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...\n"); + + $tmp = new stdClass(); + $ret = @$db->setAttribute(PDO::ATTR_ERRMODE, $tmp); + if (false != $ret) + printf("[002] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...%s\n", + var_export($ret, true)); + + $ret = @$db->setAttribute(PDO::ATTR_ERRMODE, 'pdo'); + if (false != $ret) + printf("[003] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...%s\n", + var_export($ret, true)); + + if (false != @$db->setAttribute(PDO::ATTR_ERRMODE, $invalid)) + printf("[004] Invalid ERRMODE should be rejected\n"); + + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); + // no message for any PDO call but... + $db->query('THIS IS NOT VALID SQL'); + // ... still messages for everything else + $code = $db->errorCode(); + $info = $db->errorInfo(); + + if ($code != '42000') + printf("[005] Expecting SQL code 42000 got '%s'\n", $code); + if ($code !== $info[0]) + printf("[006] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n", + $code, $info[0]); + if ('' == $info[1]) + printf("[007] Driver specific error code not set\n"); + if ('' == $info[2]) + printf("[008] Driver specific error message not set\n"); + + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + $db->query('THIS IS NOT VALID SQL'); + + $code = $db->errorCode(); + $info = $db->errorInfo(); + + if ($code != '42000') + printf("[009] Expecting SQL code 42000 got '%s'\n", $code); + if ($code !== $info[0]) + printf("[010] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n", + $code, $info[0]); + if ('' == $info[1]) + printf("[011] Driver specific error code not set\n"); + if ('' == $info[2]) + printf("[012] Driver specific error message not set\n"); + + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + try { + $line = __LINE__ + 1; + $db->query('THIS IS NOT VALID SQL'); + } catch (PDOException $e) { + + $code = $db->errorCode(); + $info = $db->errorInfo(); + + if ($code != '42000') + printf("[013] Expecting SQL code 42000 got '%s'\n", $code); + if ($code !== $info[0]) + printf("[014] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n", + $code, $info[0]); + if ('' == $info[1]) + printf("[015] Driver specific error code not set\n"); + if ('' == $info[2]) + printf("[016] Driver specific error message not set\n"); + + if ($e->getCode() !== $code) + printf("[017] Exception code '%s' differs from errorCode '%s'\n", + $e->getCode(), $code); + + $msg = $e->getMessage(); + foreach ($info as $k => $v) { + if (false === stristr($msg, (string)$v)) { + printf("[018] Cannot find all parts of the error info ('%s') in the exception message '%s'\n", + $v, $msg); + } + } + + if ($e->getLine() !== $line) + printf("[019] Exception has been thrown in line %d, exception object reports line %d\n", + $line, $e->getLine()); + + if ($e->getFile() !== __FILE__) + printf("[020] Exception has been thrown in file '%s', exception object reports file '%s'\n", + __FILE__, $e->getFile()); + + } + + function my_handler($e) { + global $db, $line; + + $code = $db->errorCode(); + $info = $db->errorInfo(); + + if ($code != '42000') + printf("[021] Expecting SQL code 42000 got '%s'\n", $code); + if ($code !== $info[0]) + printf("[022] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n", + $code, $info[0]); + if ('' == $info[1]) + printf("[023] Driver specific error code not set\n"); + if ('' == $info[2]) + printf("[024] Driver specific error message not set\n"); + + if ($e->getCode() !== $code) + printf("[025] Exception code '%s' differs from errorCode '%s'\n", + $e->getCode(), $code); + + $msg = $e->getMessage(); + foreach ($info as $k => $v) { + if (false === stristr($msg, (string)$v)) { + printf("[026] Cannot find all parts of the error info ('%s') in the exception message '%s'\n", + $v, $msg); + } + } + + if ($e->getLine() !== $line) + printf("[027] Exception has been thrown in line %d, exception object reports line %d\n", + $line, $e->getLine()); + + if ($e->getFile() !== __FILE__) + printf("[028] Exception has been thrown in file '%s', exception object reports file '%s'\n", + __FILE__, $e->getFile()); + + if (get_class($e) != 'PDOException') + printf("[029] Expecting PDO exception got exception of type '%s'\n", get_class($e)); + + print "\nend of execution"; + } + set_exception_handler('my_handler'); + $line = __LINE__ + 1; + $db->query('THIS IS NOT VALID SQL'); + + print "done!\n"; --EXPECTF-- [003] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...true diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt index a19e680de1..eabc4db829 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt @@ -8,21 +8,21 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); - $db->setAttribute(PDO::ATTR_FETCH_TABLE_NAMES, 1); - $stmt = $db->query('SELECT label FROM test LIMIT 1'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $stmt->closeCursor(); + $db->setAttribute(PDO::ATTR_FETCH_TABLE_NAMES, 1); + $stmt = $db->query('SELECT label FROM test LIMIT 1'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt->closeCursor(); - $db->setAttribute(PDO::ATTR_FETCH_TABLE_NAMES, 0); - $stmt = $db->query('SELECT label FROM test LIMIT 1'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $stmt->closeCursor(); + $db->setAttribute(PDO::ATTR_FETCH_TABLE_NAMES, 0); + $stmt = $db->query('SELECT label FROM test LIMIT 1'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt->closeCursor(); - print "done!"; + print "done!"; ?> --EXPECT-- array(1) { diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt index cd3b40d6d1..c979075fd7 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt @@ -11,29 +11,29 @@ $db = MySQLPDOTest::factory(); error_reporting=E_ALL --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $dsn = MySQLPDOTest::getDSN(); - $user = PDO_MYSQL_TEST_USER; - $pass = PDO_MYSQL_TEST_PASS; + $dsn = MySQLPDOTest::getDSN(); + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; - $table = sprintf("test_%s", md5(mt_rand(0, PHP_INT_MAX))); - $db = new PDO($dsn, $user, $pass); - $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table)); + $table = sprintf("test_%s", md5(mt_rand(0, PHP_INT_MAX))); + $db = new PDO($dsn, $user, $pass); + $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table)); - $create = sprintf('CREATE TABLE %s(id INT)', $table); - var_dump($create); - $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => $create)); + $create = sprintf('CREATE TABLE %s(id INT)', $table); + var_dump($create); + $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => $create)); - $info = $db->errorInfo(); - var_dump($info[0]); + $info = $db->errorInfo(); + var_dump($info[0]); - $db->exec(sprintf('INSERT INTO %s(id) VALUES (1)', $table)); - $stmt = $db->query(sprintf('SELECT id FROM %s', $table)); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $db->exec(sprintf('INSERT INTO %s(id) VALUES (1)', $table)); + $stmt = $db->query(sprintf('SELECT id FROM %s', $table)); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table)); - print "done!"; + $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table)); + print "done!"; ?> --EXPECTF-- string(58) "CREATE TABLE test_%s(id INT)" diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_max_buffer_size.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_max_buffer_size.phpt index c988b2b3cb..1337c1ac95 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_max_buffer_size.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_max_buffer_size.phpt @@ -10,58 +10,58 @@ if (MySQLPDOTest::isPDOMySQLnd()) ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - function try_buffer_size($offset, $buffer_size) { + function try_buffer_size($offset, $buffer_size) { - try { + try { - $dsn = MySQLPDOTest::getDSN(); - $user = PDO_MYSQL_TEST_USER; - $pass = PDO_MYSQL_TEST_PASS; + $dsn = MySQLPDOTest::getDSN(); + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; - /* unsigned overflow possible ? */ - $db = new PDO($dsn, $user, $pass, - array( - PDO::MYSQL_ATTR_MAX_BUFFER_SIZE => $buffer_size, - /* buffer is only relevant with native PS */ - PDO::MYSQL_ATTR_DIRECT_QUERY => 0, - PDO::ATTR_EMULATE_PREPARES => 0, - )); + /* unsigned overflow possible ? */ + $db = new PDO($dsn, $user, $pass, + array( + PDO::MYSQL_ATTR_MAX_BUFFER_SIZE => $buffer_size, + /* buffer is only relevant with native PS */ + PDO::MYSQL_ATTR_DIRECT_QUERY => 0, + PDO::ATTR_EMULATE_PREPARES => 0, + )); - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec(sprintf('CREATE TABLE test(id INT, val LONGBLOB) ENGINE = %s', PDO_MYSQL_TEST_ENGINE)); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec(sprintf('CREATE TABLE test(id INT, val LONGBLOB) ENGINE = %s', PDO_MYSQL_TEST_ENGINE)); - // 10 * (10 * 1024) = 10 * (10 * 1k) = 100k - $db->exec('INSERT INTO test(id, val) VALUES (1, REPEAT("01234567890", 10240))'); + // 10 * (10 * 1024) = 10 * (10 * 1k) = 100k + $db->exec('INSERT INTO test(id, val) VALUES (1, REPEAT("01234567890", 10240))'); - $stmt = $db->prepare('SELECT id, val FROM test'); - $stmt->execute(); + $stmt = $db->prepare('SELECT id, val FROM test'); + $stmt->execute(); - $id = $val = NULL; - $stmt->bindColumn(1, $id); - $stmt->bindColumn(2, $val); - while ($row = $stmt->fetch(PDO::FETCH_BOUND)) { - printf("[%03d] id = %d, val = %s... (length: %d)\n", - $offset, $id, substr($val, 0, 10), strlen($val)); - } - $db->exec('DROP TABLE IF EXISTS test'); + $id = $val = NULL; + $stmt->bindColumn(1, $id); + $stmt->bindColumn(2, $val); + while ($row = $stmt->fetch(PDO::FETCH_BOUND)) { + printf("[%03d] id = %d, val = %s... (length: %d)\n", + $offset, $id, substr($val, 0, 10), strlen($val)); + } + $db->exec('DROP TABLE IF EXISTS test'); - } catch (PDOException $e) { - printf("[%03d] %s, [%s] %s\n", - $offset, - $e->getMessage(), - (is_object($db)) ? $db->errorCode() : 'n/a', - (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); - } - } + } catch (PDOException $e) { + printf("[%03d] %s, [%s] %s\n", + $offset, + $e->getMessage(), + (is_object($db)) ? $db->errorCode() : 'n/a', + (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); + } + } - try_buffer_size(1, -1); - try_buffer_size(2, 1000); - try_buffer_size(3, NULL); - try_buffer_size(4, 2000); + try_buffer_size(1, -1); + try_buffer_size(2, 1000); + try_buffer_size(3, NULL); + try_buffer_size(4, 2000); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_multi_statements.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_multi_statements.phpt index 92bab1d30d..65b5e1bdc9 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_multi_statements.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_multi_statements.phpt @@ -11,43 +11,43 @@ $db = MySQLPDOTest::factory(); error_reporting=E_ALL --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $dsn = MySQLPDOTest::getDSN(); - $user = PDO_MYSQL_TEST_USER; - $pass = PDO_MYSQL_TEST_PASS; + $dsn = MySQLPDOTest::getDSN(); + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; - $table = sprintf("test_%s", md5(mt_rand(0, PHP_INT_MAX))); - $db = new PDO($dsn, $user, $pass); - $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table)); - $create = sprintf('CREATE TABLE %s(id INT)', $table); - $db->exec($create); - $db->exec(sprintf('INSERT INTO %s(id) VALUES (1)', $table)); - $stmt = $db->query(sprintf('SELECT * FROM %s; INSERT INTO %s(id) VALUES (2)', $table, $table)); - $stmt->closeCursor(); - $info = $db->errorInfo(); - var_dump($info[0]); - $stmt = $db->query(sprintf('SELECT id FROM %s', $table)); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $table = sprintf("test_%s", md5(mt_rand(0, PHP_INT_MAX))); + $db = new PDO($dsn, $user, $pass); + $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table)); + $create = sprintf('CREATE TABLE %s(id INT)', $table); + $db->exec($create); + $db->exec(sprintf('INSERT INTO %s(id) VALUES (1)', $table)); + $stmt = $db->query(sprintf('SELECT * FROM %s; INSERT INTO %s(id) VALUES (2)', $table, $table)); + $stmt->closeCursor(); + $info = $db->errorInfo(); + var_dump($info[0]); + $stmt = $db->query(sprintf('SELECT id FROM %s', $table)); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); // A single query with a trailing delimiter. - $stmt = $db->query('SELECT 1 AS value;'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->query('SELECT 1 AS value;'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - // New connection, does not allow multiple statements. - $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => false)); - $stmt = $db->query(sprintf('SELECT * FROM %s; INSERT INTO %s(id) VALUES (3)', $table, $table)); - var_dump($stmt); - $info = $db->errorInfo(); - var_dump($info[0]); + // New connection, does not allow multiple statements. + $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => false)); + $stmt = $db->query(sprintf('SELECT * FROM %s; INSERT INTO %s(id) VALUES (3)', $table, $table)); + var_dump($stmt); + $info = $db->errorInfo(); + var_dump($info[0]); - $stmt = $db->query(sprintf('SELECT id FROM %s', $table)); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->query(sprintf('SELECT id FROM %s', $table)); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); // A single query with a trailing delimiter. $stmt = $db->query('SELECT 1 AS value;'); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table)); - print "done!"; + $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table)); + print "done!"; ?> --EXPECT-- string(5) "00000" diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt index 44503c1053..694a039441 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt @@ -8,78 +8,78 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); - $tmp = array(); - if (false !== @$db->setAttribute(PDO::ATTR_ORACLE_NULLS, $tmp)) - printf("[001] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...\n"); + $tmp = array(); + if (false !== @$db->setAttribute(PDO::ATTR_ORACLE_NULLS, $tmp)) + printf("[001] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...\n"); - $tmp = new stdClass(); - if (false !== @$db->setAttribute(PDO::ATTR_ORACLE_NULLS, $tmp)); - printf("[002] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...\n"); + $tmp = new stdClass(); + if (false !== @$db->setAttribute(PDO::ATTR_ORACLE_NULLS, $tmp)); + printf("[002] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...\n"); - if (false !== @$db->setAttribute(PDO::ATTR_ORACLE_NULLS, 'pdo')) - printf("[003] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...\n"); + if (false !== @$db->setAttribute(PDO::ATTR_ORACLE_NULLS, 'pdo')) + printf("[003] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...\n"); - $db->setAttribute(PDO::ATTR_ORACLE_NULLS, 1); - $stmt = $db->query("SELECT NULL AS z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, '" . chr(0) . " e' AS e"); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $db->setAttribute(PDO::ATTR_ORACLE_NULLS, 1); + $stmt = $db->query("SELECT NULL AS z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, '" . chr(0) . " e' AS e"); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $db->setAttribute(PDO::ATTR_ORACLE_NULLS, 0); - $stmt = $db->query("SELECT NULL AS z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, '" . chr(0) . " e' AS e"); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $db->setAttribute(PDO::ATTR_ORACLE_NULLS, 0); + $stmt = $db->query("SELECT NULL AS z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, '" . chr(0) . " e' AS e"); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $db->setAttribute(PDO::ATTR_ORACLE_NULLS, 1); - $stmt = $db->query('SELECT VERSION() as _version'); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - if ((int)substr($row['_version'], 0, 1) >= 5) - $have_procedures = true; - else - $have_procedures = false; + $db->setAttribute(PDO::ATTR_ORACLE_NULLS, 1); + $stmt = $db->query('SELECT VERSION() as _version'); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + if ((int)substr($row['_version'], 0, 1) >= 5) + $have_procedures = true; + else + $have_procedures = false; - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); - if ($have_procedures && (false !== $db->exec('DROP PROCEDURE IF EXISTS p')) && - (false !== $db->exec("CREATE PROCEDURE p() BEGIN SELECT NULL as z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, ' e' AS e; END;"))) { - // requires MySQL 5+ - $stmt = $db->prepare('CALL p()'); - $stmt->execute(); - $expected = array( - array( - "z" => NULL, - "a" => NULL, - "b" => " ", - "c" => NULL, - "d" => " d", - "e" => " e", - ), - ); - do { - $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); - if ($tmp != $expected) { - printf("[004] Expecting %s got %s\n", - var_export($expected, true), var_export($tmp, true)); - } - } while ($stmt->nextRowset()); + if ($have_procedures && (false !== $db->exec('DROP PROCEDURE IF EXISTS p')) && + (false !== $db->exec("CREATE PROCEDURE p() BEGIN SELECT NULL as z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, ' e' AS e; END;"))) { + // requires MySQL 5+ + $stmt = $db->prepare('CALL p()'); + $stmt->execute(); + $expected = array( + array( + "z" => NULL, + "a" => NULL, + "b" => " ", + "c" => NULL, + "d" => " d", + "e" => " e", + ), + ); + do { + $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); + if ($tmp != $expected) { + printf("[004] Expecting %s got %s\n", + var_export($expected, true), var_export($tmp, true)); + } + } while ($stmt->nextRowset()); - $stmt->execute(); - do { - $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); - if ($tmp != $expected) { - printf("[005] Expecting %s got %s\n", - var_export($expected, true), var_export($tmp, true)); - } - } while ($stmt->nextRowset()); + $stmt->execute(); + do { + $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); + if ($tmp != $expected) { + printf("[005] Expecting %s got %s\n", + var_export($expected, true), var_export($tmp, true)); + } + } while ($stmt->nextRowset()); - } + } - if ($have_procedures) - @$db->exec('DROP PROCEDURE IF EXISTS p'); + if ($have_procedures) + @$db->exec('DROP PROCEDURE IF EXISTS p'); - print "done!"; + print "done!"; ?> --EXPECTF-- [002] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS... diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_prefetch.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_prefetch.phpt index f1ca4be1de..155f3514fa 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_prefetch.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_prefetch.phpt @@ -9,11 +9,11 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - var_dump($db->getAttribute(PDO::ATTR_PREFETCH)); - var_dump($db->setAttribute(PDO::ATTR_PREFETCH, true)); - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + var_dump($db->getAttribute(PDO::ATTR_PREFETCH)); + var_dump($db->setAttribute(PDO::ATTR_PREFETCH, true)); + print "done!"; --EXPECTF-- Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in %s on line %d bool(false) diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt index 4a142eee38..d1b6e1e02b 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt @@ -9,43 +9,43 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - - assert(('' == $db->errorCode()) || ('00000' == $db->errorCode())); - - $info = $db->getAttribute(PDO::ATTR_SERVER_INFO); - if ('' == $info) - printf("[001] Server info must not be empty\n"); - - // Read-only? - if (false !== $db->setAttribute(PDO::ATTR_SERVER_INFO, 'new uptime: 0s')) - printf("[002] Wonderful, I can change the client version!\n"); - - $new_info = $db->getAttribute(PDO::ATTR_SERVER_INFO); - if (soundex($new_info) != soundex($info)) - printf("[003] Did we change it from '%s' to '%s'?\n", $info, $info); - - // lets hope we always run this in the same second as we did run the server info request... - if (!$stmt = $db->query("SHOW STATUS LIKE '%uptime%'")) - printf("[004] Cannot run SHOW STATUS, [%s]\n", $db->errorCode()); - else { - if (!$row = $stmt->fetch(PDO::FETCH_NUM)) - printf("[005] Unable to fetch uptime, [%s]\n", $db->errorCode()); - else - $uptime = $row[1]; - $stmt->closeCursor(); - } - - if (!preg_match('/Uptime/i', $info)) - printf("[006] Can't find uptime in server info '%s'\n", $info); - - if (isset($uptime)) { - if (!preg_match('/Uptime: (\d+)/i', $info, $matches) || $uptime - $matches[1] > 1) { - printf("[007] SHOW STATUS and server info have reported a different uptime, please check. Server info: '%s', SHOW STATUS: '%s'\n", $info, $uptime); - } - } - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + + assert(('' == $db->errorCode()) || ('00000' == $db->errorCode())); + + $info = $db->getAttribute(PDO::ATTR_SERVER_INFO); + if ('' == $info) + printf("[001] Server info must not be empty\n"); + + // Read-only? + if (false !== $db->setAttribute(PDO::ATTR_SERVER_INFO, 'new uptime: 0s')) + printf("[002] Wonderful, I can change the client version!\n"); + + $new_info = $db->getAttribute(PDO::ATTR_SERVER_INFO); + if (soundex($new_info) != soundex($info)) + printf("[003] Did we change it from '%s' to '%s'?\n", $info, $info); + + // lets hope we always run this in the same second as we did run the server info request... + if (!$stmt = $db->query("SHOW STATUS LIKE '%uptime%'")) + printf("[004] Cannot run SHOW STATUS, [%s]\n", $db->errorCode()); + else { + if (!$row = $stmt->fetch(PDO::FETCH_NUM)) + printf("[005] Unable to fetch uptime, [%s]\n", $db->errorCode()); + else + $uptime = $row[1]; + $stmt->closeCursor(); + } + + if (!preg_match('/Uptime/i', $info)) + printf("[006] Can't find uptime in server info '%s'\n", $info); + + if (isset($uptime)) { + if (!preg_match('/Uptime: (\d+)/i', $info, $matches) || $uptime - $matches[1] > 1) { + printf("[007] SHOW STATUS and server info have reported a different uptime, please check. Server info: '%s', SHOW STATUS: '%s'\n", $info, $uptime); + } + } + + print "done!"; --EXPECT-- done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_server_version.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_server_version.phpt index a635c3771a..62a2fae8b0 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_server_version.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_server_version.phpt @@ -9,57 +9,57 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - assert(('' == $db->errorCode()) || ('00000' == $db->errorCode())); + assert(('' == $db->errorCode()) || ('00000' == $db->errorCode())); - $version = $db->getAttribute(PDO::ATTR_SERVER_VERSION); - if ('' == $version) - printf("[001] Server version must not be empty\n"); + $version = $db->getAttribute(PDO::ATTR_SERVER_VERSION); + if ('' == $version) + printf("[001] Server version must not be empty\n"); - // Ideally the server version would be an integer - as documented but BC break! - // If its a version string it should be of the format \d+\.\d+\.\d+.* + // Ideally the server version would be an integer - as documented but BC break! + // If its a version string it should be of the format \d+\.\d+\.\d+.* - if (is_string($version)) { - // Its not an int like documented but a string - maybe for BC reasons... - if (!preg_match('/(\d+)\.(\d+)\.(\d+)(.*)/', $version, $matches)) - printf("[002] Client version string seems wrong, got '%s'\n", $version); - else { - // Difficult to define any meaningful constraints - // A possible better check would be calling mysqli_get_server_version() and - // comparing what we get. However, mysqli_get_server_version() needs a mysqli handle - // for which in turn one needs to parse the PDO test environment variables - // for connection parameter... - if ($matches[1] < 3) - printf("[003] Strange major version: '%s'. Should be more than 3\n", $matches[1]); - if ($matches[2] < 0) - printf("[004] Minor version should be at least 0, got '%s'\n", $matches[2]); - if ($matches[3] < 0) - printf("[005] Sub version should be at least 0, got '%s'\n", $matches[2]); - } - } else if (is_int($version)) { - // Lets accept also int if it follows the rules from the original MYSQL C API - $major = floor($version / 10000); - $minor = floor(($version - ($main * 10000)) / 100); - $sub = $version - ($main * 10000) - ($minor * 100); - if ($major < 3) - printf("[006] Strange major version: '%s'. Should be more than 3\n", $major); - if ($minor < 0) - printf("[007] Minor version should be at least 0, got '%s'\n", $minor); - if ($sub < 0) - printf("[008] Sub version should be at least 0, got '%s'\n", $sub); - } + if (is_string($version)) { + // Its not an int like documented but a string - maybe for BC reasons... + if (!preg_match('/(\d+)\.(\d+)\.(\d+)(.*)/', $version, $matches)) + printf("[002] Client version string seems wrong, got '%s'\n", $version); + else { + // Difficult to define any meaningful constraints + // A possible better check would be calling mysqli_get_server_version() and + // comparing what we get. However, mysqli_get_server_version() needs a mysqli handle + // for which in turn one needs to parse the PDO test environment variables + // for connection parameter... + if ($matches[1] < 3) + printf("[003] Strange major version: '%s'. Should be more than 3\n", $matches[1]); + if ($matches[2] < 0) + printf("[004] Minor version should be at least 0, got '%s'\n", $matches[2]); + if ($matches[3] < 0) + printf("[005] Sub version should be at least 0, got '%s'\n", $matches[2]); + } + } else if (is_int($version)) { + // Lets accept also int if it follows the rules from the original MYSQL C API + $major = floor($version / 10000); + $minor = floor(($version - ($main * 10000)) / 100); + $sub = $version - ($main * 10000) - ($minor * 100); + if ($major < 3) + printf("[006] Strange major version: '%s'. Should be more than 3\n", $major); + if ($minor < 0) + printf("[007] Minor version should be at least 0, got '%s'\n", $minor); + if ($sub < 0) + printf("[008] Sub version should be at least 0, got '%s'\n", $sub); + } - // Read-only? - if (false !== $db->setAttribute(PDO::ATTR_CLIENT_VERSION, '1.0')) - printf("[009] Wonderful, I can change the client version!\n"); + // Read-only? + if (false !== $db->setAttribute(PDO::ATTR_CLIENT_VERSION, '1.0')) + printf("[009] Wonderful, I can change the client version!\n"); - $new_version = $db->getAttribute(PDO::ATTR_SERVER_VERSION); - if ($new_version !== $version) - printf("[010] Did we change it from '%s' to '%s'?\n", $version, $new_version); + $new_version = $db->getAttribute(PDO::ATTR_SERVER_VERSION); + if ($new_version !== $version) + printf("[010] Did we change it from '%s' to '%s'?\n", $version, $new_version); - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt index 237f03af38..e8bdd16434 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt @@ -9,100 +9,100 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); - - $default = $db->getAttribute(PDO::ATTR_STATEMENT_CLASS); - var_dump($default); - - if (false !== ($tmp = @$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, 'foo'))) - printf("[002] Expecting boolean/false got %s\n", var_export($tmp, true)); - - if (false !== ($tmp = @$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('classname')))) - printf("[003] Expecting boolean/false got %s\n", var_export($tmp, true)); - - // unknown class - if (false !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('classname', array())))) - printf("[004] Expecting boolean/false got %s\n", var_export($tmp, true)); - - // class not derived from PDOStatement - class myclass { - function __construct() { - printf("myclass\n"); - } - } - if (false !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('myclass', array())))) - printf("[005] Expecting boolean/false got %s\n", var_export($tmp, true)); - - // public constructor not allowed - class mystatement extends PDOStatement { - public function __construct() { - printf("mystatement\n"); - } - } - - if (false !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement', array())))) - printf("[006] Expecting boolean/false got %s\n", var_export($tmp, true)); - - // ... but a public destructor is allowed - class mystatement2 extends PDOStatement { - public function __destruct() { - printf("mystatement\n"); - } - } - - if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement2', array())))) - printf("[007] Expecting boolean/true got %s\n", var_export($tmp, true)); - - // private constructor - class mystatement3 extends PDOStatement { - private function __construct($msg) { - printf("mystatement3\n"); - var_dump($msg); - } - } - if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement3', array('param1'))))) - printf("[008] Expecting boolean/true got %s\n", var_export($tmp, true)); - - // private constructor - class mystatement4 extends PDOStatement { - private function __construct($msg) { - printf("%s\n", get_class($this)); - var_dump($msg); - } - } - if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement4', array('param1'))))) - printf("[008] Expecting boolean/true got %s\n", var_export($tmp, true)); - - var_dump($db->getAttribute(PDO::ATTR_STATEMENT_CLASS)); - $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2'); - - class mystatement5 extends mystatement4 { - public function fetchAll($fetch_style = 1, $column_index = 1, $ctor_args = array()) { - return "no data :)"; - } - } - - if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement5', array('mystatement5'))))) - printf("[009] Expecting boolean/true got %s\n", var_export($tmp, true)); - $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2'); - var_dump($stmt->fetchAll()); - - if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatement')))) - printf("[010] Expecting boolean/true got %s\n", var_export($tmp, true)); - - $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 1'); - var_dump($stmt->fetchAll()); - - // Yes, this is a fatal error and I want it to fail. - abstract class mystatement6 extends mystatement5 { - } - if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement6', array('mystatement6'))))) - printf("[011] Expecting boolean/true got %s\n", var_export($tmp, true)); - $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 1'); - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); + + $default = $db->getAttribute(PDO::ATTR_STATEMENT_CLASS); + var_dump($default); + + if (false !== ($tmp = @$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, 'foo'))) + printf("[002] Expecting boolean/false got %s\n", var_export($tmp, true)); + + if (false !== ($tmp = @$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('classname')))) + printf("[003] Expecting boolean/false got %s\n", var_export($tmp, true)); + + // unknown class + if (false !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('classname', array())))) + printf("[004] Expecting boolean/false got %s\n", var_export($tmp, true)); + + // class not derived from PDOStatement + class myclass { + function __construct() { + printf("myclass\n"); + } + } + if (false !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('myclass', array())))) + printf("[005] Expecting boolean/false got %s\n", var_export($tmp, true)); + + // public constructor not allowed + class mystatement extends PDOStatement { + public function __construct() { + printf("mystatement\n"); + } + } + + if (false !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement', array())))) + printf("[006] Expecting boolean/false got %s\n", var_export($tmp, true)); + + // ... but a public destructor is allowed + class mystatement2 extends PDOStatement { + public function __destruct() { + printf("mystatement\n"); + } + } + + if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement2', array())))) + printf("[007] Expecting boolean/true got %s\n", var_export($tmp, true)); + + // private constructor + class mystatement3 extends PDOStatement { + private function __construct($msg) { + printf("mystatement3\n"); + var_dump($msg); + } + } + if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement3', array('param1'))))) + printf("[008] Expecting boolean/true got %s\n", var_export($tmp, true)); + + // private constructor + class mystatement4 extends PDOStatement { + private function __construct($msg) { + printf("%s\n", get_class($this)); + var_dump($msg); + } + } + if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement4', array('param1'))))) + printf("[008] Expecting boolean/true got %s\n", var_export($tmp, true)); + + var_dump($db->getAttribute(PDO::ATTR_STATEMENT_CLASS)); + $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2'); + + class mystatement5 extends mystatement4 { + public function fetchAll($fetch_style = 1, $column_index = 1, $ctor_args = array()) { + return "no data :)"; + } + } + + if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement5', array('mystatement5'))))) + printf("[009] Expecting boolean/true got %s\n", var_export($tmp, true)); + $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2'); + var_dump($stmt->fetchAll()); + + if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatement')))) + printf("[010] Expecting boolean/true got %s\n", var_export($tmp, true)); + + $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 1'); + var_dump($stmt->fetchAll()); + + // Yes, this is a fatal error and I want it to fail. + abstract class mystatement6 extends mystatement5 { + } + if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement6', array('mystatement6'))))) + printf("[011] Expecting boolean/true got %s\n", var_export($tmp, true)); + $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 1'); + + print "done!"; ?> --EXPECTF-- array(1) { diff --git a/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt b/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt index f2653f4b6b..2fc60f9fc2 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt @@ -11,175 +11,175 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db)) ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); - if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) - printf("[001] Autocommit should be on by default\n"); + if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) + printf("[001] Autocommit should be on by default\n"); - if (false == $db->beginTransaction()) - printf("[002] Cannot start a transaction, [%s] [%s]\n", - $db->errorCode(), implode(' ', $db->errorInfo())); + if (false == $db->beginTransaction()) + printf("[002] Cannot start a transaction, [%s] [%s]\n", + $db->errorCode(), implode(' ', $db->errorInfo())); - if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) - printf("[003] Autocommit should be on by default, beginTransaction() shall not impact it\n"); + if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) + printf("[003] Autocommit should be on by default, beginTransaction() shall not impact it\n"); - if (0 == $db->exec('DELETE FROM test')) - printf("[004] No rows deleted, can't be true.\n"); + if (0 == $db->exec('DELETE FROM test')) + printf("[004] No rows deleted, can't be true.\n"); - /* This is the PDO way to close a connection */ - $db = null; - $db = MySQLPDOTest::factory(); + /* This is the PDO way to close a connection */ + $db = null; + $db = MySQLPDOTest::factory(); - /* Autocommit was off - by definition. Commit was not issued. DELETE should have been rolled back. */ - if (!($stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC'))) - printf("[005] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + /* Autocommit was off - by definition. Commit was not issued. DELETE should have been rolled back. */ + if (!($stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC'))) + printf("[005] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - var_dump($row); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + var_dump($row); - if (!$db->beginTransaction()) - printf("[006] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (!$db->beginTransaction()) + printf("[006] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - if (1 !== $db->exec(sprintf('DELETE FROM test WHERE id = %d', $row['id']))) - printf("[007] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (1 !== $db->exec(sprintf('DELETE FROM test WHERE id = %d', $row['id']))) + printf("[007] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - if (!$db->commit()) - printf("[008] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (!$db->commit()) + printf("[008] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) - printf("[009] Autocommit should be on after commit()\n"); + if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) + printf("[009] Autocommit should be on after commit()\n"); - if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id'])))) - printf("[010] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id'])))) + printf("[010] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - var_dump($stmt->fetch(PDO::FETCH_ASSOC)); + var_dump($stmt->fetch(PDO::FETCH_ASSOC)); - if (!$db->beginTransaction()) - printf("[011] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (!$db->beginTransaction()) + printf("[011] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - $db->exec(sprintf("INSERT INTO test(id, label) VALUES (%d, 'z')", $row['id'])); + $db->exec(sprintf("INSERT INTO test(id, label) VALUES (%d, 'z')", $row['id'])); - if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id'])))) - printf("[012] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id'])))) + printf("[012] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - $new_row1 = $stmt->fetch(PDO::FETCH_ASSOC); - var_dump($new_row1); + $new_row1 = $stmt->fetch(PDO::FETCH_ASSOC); + var_dump($new_row1); - if (!$db->commit()) - printf("[013] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (!$db->commit()) + printf("[013] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id'])))) - printf("[014] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id'])))) + printf("[014] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - $new_row2 = $stmt->fetch(PDO::FETCH_ASSOC); - if ($new_row1 != $new_row2) { - printf("[015] Results must not differ!\n"); - var_dump($new_row1); - var_dump($new_row2); - } + $new_row2 = $stmt->fetch(PDO::FETCH_ASSOC); + if ($new_row1 != $new_row2) { + printf("[015] Results must not differ!\n"); + var_dump($new_row1); + var_dump($new_row2); + } - if (!$db->beginTransaction()) - printf("[016] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (!$db->beginTransaction()) + printf("[016] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - if (1 !== $db->exec(sprintf('DELETE FROM test WHERE id = %d', $row['id']))) - printf("[017] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (1 !== $db->exec(sprintf('DELETE FROM test WHERE id = %d', $row['id']))) + printf("[017] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - if (!$db->rollback()) - printf("[018] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (!$db->rollback()) + printf("[018] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) - printf("[019] Autocommit should be on after rollback\n"); + if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) + printf("[019] Autocommit should be on after rollback\n"); - if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id'])))) - printf("[020] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id'])))) + printf("[020] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - $new_row2 = $stmt->fetch(PDO::FETCH_ASSOC); - if ($new_row1 != $new_row2) { - printf("[021] Results must not differ!\n"); - var_dump($new_row1); - var_dump($new_row2); - } + $new_row2 = $stmt->fetch(PDO::FETCH_ASSOC); + if ($new_row1 != $new_row2) { + printf("[021] Results must not differ!\n"); + var_dump($new_row1); + var_dump($new_row2); + } - // now, lets check the server variables - if (!($stmt = $db->query('SELECT @@autocommit as auto_commit'))) - printf("[022] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + // now, lets check the server variables + if (!($stmt = $db->query('SELECT @@autocommit as auto_commit'))) + printf("[022] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - if ($tmp['auto_commit'] != 1) - printf("[023] MySQL Server should indicate autocommit mode, expecting 1, got '%s', [%d] %s\n", - $tmp['auto_commit'], $stmt->errorCode(), $stmt->errorInfo()); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + if ($tmp['auto_commit'] != 1) + printf("[023] MySQL Server should indicate autocommit mode, expecting 1, got '%s', [%d] %s\n", + $tmp['auto_commit'], $stmt->errorCode(), $stmt->errorInfo()); - if (!$db->beginTransaction()) - printf("[024] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (!$db->beginTransaction()) + printf("[024] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - if (!($stmt = $db->query('SELECT @@autocommit as auto_commit'))) - printf("[025] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (!($stmt = $db->query('SELECT @@autocommit as auto_commit'))) + printf("[025] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - if ($tmp['auto_commit'] != 0) - printf("[026] Autocommit mode of the MySQL Server should be off, got '%s', [%d] %s\n", - $tmp['auto_commit'], $stmt->errorCode(), trim(implode(' ', $stmt->errorInfo()))); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + if ($tmp['auto_commit'] != 0) + printf("[026] Autocommit mode of the MySQL Server should be off, got '%s', [%d] %s\n", + $tmp['auto_commit'], $stmt->errorCode(), trim(implode(' ', $stmt->errorInfo()))); - $db->commit(); - // Now we should be back to autocommit - we've issues a commit - if ($tmp['auto_commit'] != 1) - printf("[027] MySQL Server should indicate autocommit mode, expecting 1, got '%s', [%d] %s\n", - $tmp['auto_commit'], $stmt->errorCode(), $stmt->errorInfo()); + $db->commit(); + // Now we should be back to autocommit - we've issues a commit + if ($tmp['auto_commit'] != 1) + printf("[027] MySQL Server should indicate autocommit mode, expecting 1, got '%s', [%d] %s\n", + $tmp['auto_commit'], $stmt->errorCode(), $stmt->errorInfo()); - // Turn off autocommit using a server variable - $db->exec('SET @@autocommit = 0'); - if (1 === $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) - printf("[028] I'm confused, how can autocommit be on? Didn't I say I want to manually control transactions?\n"); + // Turn off autocommit using a server variable + $db->exec('SET @@autocommit = 0'); + if (1 === $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) + printf("[028] I'm confused, how can autocommit be on? Didn't I say I want to manually control transactions?\n"); - if (!$db->beginTransaction()) - printf("[029] Cannot start a transaction, [%d] %s\n", - $db->errorCode(), implode(' ', $db->errorInfo())); + if (!$db->beginTransaction()) + printf("[029] Cannot start a transaction, [%d] %s\n", + $db->errorCode(), implode(' ', $db->errorInfo())); - try { - if (false !== $db->beginTransaction()) { - printf("[030] No false and no exception - that's wrong.\n"); - } - } catch (PDOException $e) { - assert($e->getMessage() != ''); - } + try { + if (false !== $db->beginTransaction()) { + printf("[030] No false and no exception - that's wrong.\n"); + } + } catch (PDOException $e) { + assert($e->getMessage() != ''); + } - // TODO: What about an engine that does not support transactions? - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db, 'MyISAM'); + // TODO: What about an engine that does not support transactions? + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db, 'MyISAM'); - if (false == $db->beginTransaction()) - printf("[031] Cannot start a transaction, [%s] [%s]\n", - $db->errorCode(), implode(' ', $db->errorInfo())); + if (false == $db->beginTransaction()) + printf("[031] Cannot start a transaction, [%s] [%s]\n", + $db->errorCode(), implode(' ', $db->errorInfo())); - if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) - printf("[032] Autocommit should be on my default, beginTransaction() should not change that\n"); + if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT)) + printf("[032] Autocommit should be on my default, beginTransaction() should not change that\n"); - if (0 == $db->exec('DELETE FROM test')) - printf("[033] No rows deleted, can't be true.\n"); + if (0 == $db->exec('DELETE FROM test')) + printf("[033] No rows deleted, can't be true.\n"); - if (!$db->commit()) - printf("[034] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + if (!$db->commit()) + printf("[034] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - if (false == $db->beginTransaction()) - printf("[035] Cannot start a transaction, [%s] [%s]\n", - $db->errorCode(), implode(' ', $db->errorInfo())); + if (false == $db->beginTransaction()) + printf("[035] Cannot start a transaction, [%s] [%s]\n", + $db->errorCode(), implode(' ', $db->errorInfo())); - if (0 == $db->exec("INSERT INTO test(id, label) VALUES (1, 'a')")) - printf("[036] Cannot insert data, [%s] [%s]\n", - $db->errorCode(), implode(' ', $db->errorInfo())); + if (0 == $db->exec("INSERT INTO test(id, label) VALUES (1, 'a')")) + printf("[036] Cannot insert data, [%s] [%s]\n", + $db->errorCode(), implode(' ', $db->errorInfo())); - // Should cause a Server warning but no error - if (!$db->rollback()) - printf("[037] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + // Should cause a Server warning but no error + if (!$db->rollback()) + printf("[037] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - var_dump($db->errorCode()); + var_dump($db->errorCode()); - if (1 != $db->exec('DELETE FROM test')) - printf("[038] No rows deleted, can't be true.\n"); + if (1 != $db->exec('DELETE FROM test')) + printf("[038] No rows deleted, can't be true.\n"); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_bit.phpt b/ext/pdo_mysql/tests/pdo_mysql_bit.phpt index caa81e96ac..9e53f18154 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_bit.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_bit.phpt @@ -10,42 +10,42 @@ if (MySQLPDOTest::isPDOMySQLnd()) ?> --FILE-- <?php - /* TODO: remove this test after fix and enable the BIT test in pdo_mysql_types.phpt again */ - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + /* TODO: remove this test after fix and enable the BIT test in pdo_mysql_types.phpt again */ + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL) { + function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL) { - $db->exec('DROP TABLE IF EXISTS test'); - $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine()); - @$db->exec($sql); - if ($db->errorCode() != 0) { - // not all MySQL Server versions and/or engines might support the type - return true; - } + $db->exec('DROP TABLE IF EXISTS test'); + $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine()); + @$db->exec($sql); + if ($db->errorCode() != 0) { + // not all MySQL Server versions and/or engines might support the type + return true; + } - $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)'); - $stmt->bindValue(1, $offset); - $stmt->bindValue(2, $value); - if (!$stmt->execute()) { - printf("[%03d + 1] INSERT failed, %s\n", $offset, var_export($stmt->errorInfo(), true)); - return false; - } - $stmt = $db->query('SELECT id, label FROM test'); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - var_dump($row); - var_dump($value); + $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)'); + $stmt->bindValue(1, $offset); + $stmt->bindValue(2, $value); + if (!$stmt->execute()) { + printf("[%03d + 1] INSERT failed, %s\n", $offset, var_export($stmt->errorInfo(), true)); + return false; + } + $stmt = $db->query('SELECT id, label FROM test'); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + var_dump($row); + var_dump($value); - return true; - } + return true; + } - $db = MySQLPDOTest::factory(); - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + $db = MySQLPDOTest::factory(); + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); - test_type($db, 20, 'BIT(8)', 1); + test_type($db, 20, 'BIT(8)', 1); - echo "done!\n"; + echo "done!\n"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt b/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt index 05f3151e8b..e5809c5a76 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt @@ -11,95 +11,95 @@ if (!extension_loaded('mysqli') && !extension_loaded('mysqlnd')) { ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $expected = array( - 'MYSQL_ATTR_USE_BUFFERED_QUERY' => true, - 'MYSQL_ATTR_LOCAL_INFILE' => true, - 'MYSQL_ATTR_DIRECT_QUERY' => true, - 'MYSQL_ATTR_FOUND_ROWS' => true, - 'MYSQL_ATTR_IGNORE_SPACE' => true, - 'MYSQL_ATTR_INIT_COMMAND' => true, - "MYSQL_ATTR_SSL_KEY" => true, - "MYSQL_ATTR_SSL_CERT" => true, - "MYSQL_ATTR_SSL_CA" => true, - "MYSQL_ATTR_SSL_CAPATH" => true, - "MYSQL_ATTR_SSL_CIPHER" => true, - "MYSQL_ATTR_COMPRESS" => true, - "MYSQL_ATTR_MULTI_STATEMENTS" => true, - "MYSQL_ATTR_SSL_VERIFY_SERVER_CERT" => true, - ); + $expected = array( + 'MYSQL_ATTR_USE_BUFFERED_QUERY' => true, + 'MYSQL_ATTR_LOCAL_INFILE' => true, + 'MYSQL_ATTR_DIRECT_QUERY' => true, + 'MYSQL_ATTR_FOUND_ROWS' => true, + 'MYSQL_ATTR_IGNORE_SPACE' => true, + 'MYSQL_ATTR_INIT_COMMAND' => true, + "MYSQL_ATTR_SSL_KEY" => true, + "MYSQL_ATTR_SSL_CERT" => true, + "MYSQL_ATTR_SSL_CA" => true, + "MYSQL_ATTR_SSL_CAPATH" => true, + "MYSQL_ATTR_SSL_CIPHER" => true, + "MYSQL_ATTR_COMPRESS" => true, + "MYSQL_ATTR_MULTI_STATEMENTS" => true, + "MYSQL_ATTR_SSL_VERIFY_SERVER_CERT" => true, + ); - if (!MySQLPDOTest::isPDOMySQLnd()) { - $expected['MYSQL_ATTR_MAX_BUFFER_SIZE'] = true; - $expected['MYSQL_ATTR_READ_DEFAULT_FILE'] = true; - $expected['MYSQL_ATTR_READ_DEFAULT_GROUP'] = true; - } + if (!MySQLPDOTest::isPDOMySQLnd()) { + $expected['MYSQL_ATTR_MAX_BUFFER_SIZE'] = true; + $expected['MYSQL_ATTR_READ_DEFAULT_FILE'] = true; + $expected['MYSQL_ATTR_READ_DEFAULT_GROUP'] = true; + } - if (extension_loaded('mysqlnd')) { - $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true; - } else if (extension_loaded('mysqli')) { - if (mysqli_get_client_version() > 50605) { - $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true; - } - } else if (MySQLPDOTest::getClientVersion(MySQLPDOTest::factory()) > 50605) { - /* XXX the MySQL client library version isn't exposed with any - constants, the single possibility is to use the PDO::getAttribute(). - This however will fail with no connection. */ - $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true; - } + if (extension_loaded('mysqlnd')) { + $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true; + } else if (extension_loaded('mysqli')) { + if (mysqli_get_client_version() > 50605) { + $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true; + } + } else if (MySQLPDOTest::getClientVersion(MySQLPDOTest::factory()) > 50605) { + /* XXX the MySQL client library version isn't exposed with any + constants, the single possibility is to use the PDO::getAttribute(). + This however will fail with no connection. */ + $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true; + } - /* - TODO + /* + TODO - MYSQLI_OPT_CONNECT_TIMEOUT != PDO::ATTR_TIMEOUT (integer) + MYSQLI_OPT_CONNECT_TIMEOUT != PDO::ATTR_TIMEOUT (integer) Sets the timeout value in seconds for communications with the database. - ^ Potential BUG, PDO::ATTR_TIMEOUT is used in pdo_mysql_handle_factory + ^ Potential BUG, PDO::ATTR_TIMEOUT is used in pdo_mysql_handle_factory - MYSQLI_SET_CHARSET_NAME -> DSN/charset=<charset_name> - ^ Undocumented and pitfall for ext/mysqli users + MYSQLI_SET_CHARSET_NAME -> DSN/charset=<charset_name> + ^ Undocumented and pitfall for ext/mysqli users - Assorted mysqlnd settings missing - */ - $ref = new ReflectionClass('PDO'); - $constants = $ref->getConstants(); - $values = array(); + Assorted mysqlnd settings missing + */ + $ref = new ReflectionClass('PDO'); + $constants = $ref->getConstants(); + $values = array(); - foreach ($constants as $name => $value) - if (substr($name, 0, 11) == 'MYSQL_ATTR_') { - if (!isset($values[$value])) - $values[$value] = array($name); - else - $values[$value][] = $name; + foreach ($constants as $name => $value) + if (substr($name, 0, 11) == 'MYSQL_ATTR_') { + if (!isset($values[$value])) + $values[$value] = array($name); + else + $values[$value][] = $name; - if (isset($expected[$name])) { - unset($expected[$name]); - unset($constants[$name]); - } + if (isset($expected[$name])) { + unset($expected[$name]); + unset($constants[$name]); + } - } else { - unset($constants[$name]); - } + } else { + unset($constants[$name]); + } - if (!empty($constants)) { - printf("[001] Dumping list of unexpected constants\n"); - var_dump($constants); - } + if (!empty($constants)) { + printf("[001] Dumping list of unexpected constants\n"); + var_dump($constants); + } - if (!empty($expected)) { - printf("[002] Dumping list of missing constants\n"); - var_dump($expected); - } + if (!empty($expected)) { + printf("[002] Dumping list of missing constants\n"); + var_dump($expected); + } - if (!empty($values)) { - foreach ($values as $value => $constants) { - if (count($constants) > 1) { - printf("[003] Several constants share the same value '%s'\n", $value); - var_dump($constants); - } - } - } + if (!empty($values)) { + foreach ($values as $value => $constants) { + if (count($constants) > 1) { + printf("[003] Several constants share the same value '%s'\n", $value); + var_dump($constants); + } + } + } - print "done!"; + print "done!"; --EXPECT-- done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_commit.phpt b/ext/pdo_mysql/tests/pdo_mysql_commit.phpt index 6141ff611b..9dec5700b6 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_commit.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_commit.phpt @@ -11,74 +11,74 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db)) ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); - try { - if (true !== ($tmp = $db->beginTransaction())) { - printf("[001] Expecting true, got %s/%s\n", gettype($tmp), $tmp); - } + try { + if (true !== ($tmp = $db->beginTransaction())) { + printf("[001] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + } - // DDL will issue an implicit commit - $db->exec(sprintf('DROP TABLE IF EXISTS test_commit')); - $db->exec(sprintf('CREATE TABLE test_commit(id INT) ENGINE=%s', MySQLPDOTest::detect_transactional_mysql_engine($db))); - if (true !== ($tmp = $db->commit())) { - printf("[002] No commit allowed? [%s] %s\n", - $db->errorCode(), implode(' ', $db->errorInfo())); - } + // DDL will issue an implicit commit + $db->exec(sprintf('DROP TABLE IF EXISTS test_commit')); + $db->exec(sprintf('CREATE TABLE test_commit(id INT) ENGINE=%s', MySQLPDOTest::detect_transactional_mysql_engine($db))); + if (true !== ($tmp = $db->commit())) { + printf("[002] No commit allowed? [%s] %s\n", + $db->errorCode(), implode(' ', $db->errorInfo())); + } - // pdo_transaction_transitions should check this as well... - // ... just to be sure the most basic stuff really works we check it again... - if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT))) - printf("[003] According to the manual we should be back to autocommit mode, got %s/%s\n", - gettype($tmp), var_export($tmp, true)); + // pdo_transaction_transitions should check this as well... + // ... just to be sure the most basic stuff really works we check it again... + if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT))) + printf("[003] According to the manual we should be back to autocommit mode, got %s/%s\n", + gettype($tmp), var_export($tmp, true)); - if (true !== ($tmp = $db->beginTransaction())) - printf("[004] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = $db->beginTransaction())) + printf("[004] Expecting true, got %s/%s\n", gettype($tmp), $tmp); - $db->exec("INSERT INTO test(id, label) VALUES (100, 'z')"); + $db->exec("INSERT INTO test(id, label) VALUES (100, 'z')"); - if (true !== ($tmp = $db->commit())) - printf("[005] No commit allowed? [%s] %s\n", - $db->errorCode(), implode(' ', $db->errorInfo())); + if (true !== ($tmp = $db->commit())) + printf("[005] No commit allowed? [%s] %s\n", + $db->errorCode(), implode(' ', $db->errorInfo())); - // a weak test without unicode etc. - lets leave that to dedicated tests - $stmt = $db->query('SELECT id, label FROM test WHERE id = 100'); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - if (!isset($rows[0]['label']) || ($rows[0]['label'] != 'z')) { - printf("[006] Record data is strange, dumping rows\n"); - var_dump($rows); - } + // a weak test without unicode etc. - lets leave that to dedicated tests + $stmt = $db->query('SELECT id, label FROM test WHERE id = 100'); + $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); + if (!isset($rows[0]['label']) || ($rows[0]['label'] != 'z')) { + printf("[006] Record data is strange, dumping rows\n"); + var_dump($rows); + } - // Ok, lets check MyISAM resp. any other non-transactional engine - // pdo_mysql_begin_transaction has more on this, quick check only - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db, 'MyISAM'); + // Ok, lets check MyISAM resp. any other non-transactional engine + // pdo_mysql_begin_transaction has more on this, quick check only + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db, 'MyISAM'); - if (true !== ($tmp = $db->beginTransaction())) - printf("[007] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + if (true !== ($tmp = $db->beginTransaction())) + printf("[007] Expecting true, got %s/%s\n", gettype($tmp), $tmp); - $db->exec("INSERT INTO test(id, label) VALUES (100, 'z')"); - if (true !== ($tmp = $db->commit())) - printf("[008] No commit allowed? [%s] %s\n", - $db->errorCode(), implode(' ', $db->errorInfo())); + $db->exec("INSERT INTO test(id, label) VALUES (100, 'z')"); + if (true !== ($tmp = $db->commit())) + printf("[008] No commit allowed? [%s] %s\n", + $db->errorCode(), implode(' ', $db->errorInfo())); - // a weak test without unicode etc. - lets leave that to dedicated tests - $stmt = $db->query('SELECT id, label FROM test WHERE id = 100'); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - if (!isset($rows[0]['label']) || ($rows[0]['label'] != 'z')) { - printf("[009] Record data is strange, dumping rows\n"); - var_dump($rows); - } + // a weak test without unicode etc. - lets leave that to dedicated tests + $stmt = $db->query('SELECT id, label FROM test WHERE id = 100'); + $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); + if (!isset($rows[0]['label']) || ($rows[0]['label'] != 'z')) { + printf("[009] Record data is strange, dumping rows\n"); + var_dump($rows); + } - } catch (PDOException $e) { - printf("[002] %s, [%s] %s\n", - $e->getMessage(), - $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[002] %s, [%s] %s\n", + $e->getMessage(), + $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; --CLEAN-- <?php require __DIR__ . '/mysql_pdo_test.inc'; diff --git a/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt b/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt index 84ce556d32..294d45e586 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt @@ -8,26 +8,26 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + require_once(__DIR__ . 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; + /* 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'); + /* 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); + /* 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; + $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"; - } + if ($charset !== $conn_charset) { + echo "done!\n"; + } else { + echo "failed!\n"; + } ?> --EXPECT-- done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_errorcode.phpt b/ext/pdo_mysql/tests/pdo_mysql_errorcode.phpt index 5bf6c10448..c2b07100c0 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_errorcode.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_errorcode.phpt @@ -9,73 +9,73 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); - function check_error($offset, &$obj, $expected = '00000') { + function check_error($offset, &$obj, $expected = '00000') { - $code = $obj->errorCode(); - if (($code != $expected) && (($expected != '00000') && ($code != ''))) { - printf("[%03d] Expecting error code '%s' got code '%s'\n", - $offset, $expected, $code); - } + $code = $obj->errorCode(); + if (($code != $expected) && (($expected != '00000') && ($code != ''))) { + printf("[%03d] Expecting error code '%s' got code '%s'\n", + $offset, $expected, $code); + } - } + } - try { + try { - /* - If you create a PDOStatement object through PDO->prepare() - or PDO->query() and invoke an error on the statement handle, - PDO->errorCode() will not reflect that error. You must call - PDOStatement->errorCode() to return the error code for an - operation performed on a particular statement handle. - */ - $code = $db->errorCode(); - check_error(2, $db); + /* + If you create a PDOStatement object through PDO->prepare() + or PDO->query() and invoke an error on the statement handle, + PDO->errorCode() will not reflect that error. You must call + PDOStatement->errorCode() to return the error code for an + operation performed on a particular statement handle. + */ + $code = $db->errorCode(); + check_error(2, $db); - $stmt = $db->query('SELECT id, label FROM test'); - $stmt2 = &$stmt; - check_error(3, $db); - check_error(4, $stmt); + $stmt = $db->query('SELECT id, label FROM test'); + $stmt2 = &$stmt; + check_error(3, $db); + check_error(4, $stmt); - $db->exec('DROP TABLE IF EXISTS test'); - @$stmt->execute(); - check_error(4, $db); - check_error(5, $stmt, '42S02'); - check_error(6, $stmt2, '42S02'); + $db->exec('DROP TABLE IF EXISTS test'); + @$stmt->execute(); + check_error(4, $db); + check_error(5, $stmt, '42S02'); + check_error(6, $stmt2, '42S02'); - $db->exec('DROP TABLE IF EXISTS unknown'); - @$stmt = $db->query('SELECT id, label FROM unknown'); - check_error(7, $db, '42S02'); + $db->exec('DROP TABLE IF EXISTS unknown'); + @$stmt = $db->query('SELECT id, label FROM unknown'); + check_error(7, $db, '42S02'); - MySQLPDOTest::createTestTable($db); - $stmt = $db->query('SELECT id, label FROM test'); - check_error(8, $db); - check_error(9, $stmt); + MySQLPDOTest::createTestTable($db); + $stmt = $db->query('SELECT id, label FROM test'); + check_error(8, $db); + check_error(9, $stmt); - $db2 = &$db; - @$db->query('SELECT id, label FROM unknown'); - check_error(10, $db, '42S02'); - check_error(11, $db2, '42S02'); - check_error(12, $stmt); - check_error(13, $stmt2); + $db2 = &$db; + @$db->query('SELECT id, label FROM unknown'); + check_error(10, $db, '42S02'); + check_error(11, $db2, '42S02'); + check_error(12, $stmt); + check_error(13, $stmt2); - // lets hope this is an invalid attribute code - $invalid_attr = -1 * PHP_INT_MAX + 3; - $tmp = @$db->getAttribute($invalid_attr); - check_error(14, $db, 'IM001'); - check_error(15, $db2, 'IM001'); - check_error(16, $stmt); - check_error(17, $stmt2); + // lets hope this is an invalid attribute code + $invalid_attr = -1 * PHP_INT_MAX + 3; + $tmp = @$db->getAttribute($invalid_attr); + check_error(14, $db, 'IM001'); + check_error(15, $db2, 'IM001'); + check_error(16, $stmt); + check_error(17, $stmt2); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt index 487f8ab97a..2da0f4aaa3 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt @@ -9,92 +9,92 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); - - function check_error($offset, &$obj, $expected = '00000') { - $info = $obj->errorInfo(); - $code = $info[0]; - - if (($code != $expected) && (($expected != '00000') && ($code != ''))) { - printf("[%03d] Expecting error code '%s' got code '%s'\n", - $offset, $expected, $code); - } - - if ($expected != '00000') { - if (!isset($info[1]) || $info[1] == '') - printf("[%03d] Driver-specific error code not set\n", $offset); - if (!isset($info[2]) || $info[2] == '') - printf("[%03d] Driver-specific error message.not set\n", $offset); - } - - } - - function pdo_mysql_errorinfo($db, $offset) { - - try { - - /* - If you create a PDOStatement object through PDO->prepare() - or PDO->query() and invoke an error on the statement handle, - PDO->errorCode() will not reflect that error. You must call - PDOStatement->errorCode() to return the error code for an - operation performed on a particular statement handle. - */ - $code = $db->errorCode(); - check_error($offset + 2, $db); - - $stmt = $db->query('SELECT id, label FROM test'); - $stmt2 = &$stmt; - check_error($offset + 3, $db); - check_error($offset + 4, $stmt); - - $db->exec('DROP TABLE IF EXISTS test'); - @$stmt->execute(); - check_error($offset + 5, $db); - check_error($offset + 6, $stmt, '42S02'); - check_error($offset + 7, $stmt2, '42S02'); - - @$stmt = $db->query('SELECT id, label FROM unknown'); - check_error($offset + 8, $db, '42S02'); - - MySQLPDOTest::createTestTable($db); - $stmt = $db->query('SELECT id, label FROM test'); - check_error($offset + 9, $db); - check_error($offset + 10, $stmt); - - $db2 = &$db; - $db->exec('DROP TABLE IF EXISTS unknown'); - @$db->query('SELECT id, label FROM unknown'); - check_error($offset + 11, $db, '42S02'); - check_error($offset + 12, $db2, '42S02'); - check_error($offset + 13, $stmt); - check_error($offset + 14, $stmt2); - - // lets hope this is an invalid attribute code - $invalid_attr = -1 * PHP_INT_MAX + 3; - $tmp = @$db->getAttribute($invalid_attr); - check_error($offset + 15, $db, 'IM001'); - check_error($offset + 16, $db2, 'IM001'); - check_error($offset + 17, $stmt); - check_error($offset + 18, $stmt2); - - } catch (PDOException $e) { - printf("[%03d] %s [%s] %s\n", - $offset + 19, $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - } - - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); - printf("Emulated Prepared Statements...\n"); - pdo_mysql_errorinfo($db, 0); - - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - printf("Native Prepared Statements...\n"); - pdo_mysql_errorinfo($db, 20); - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); + + function check_error($offset, &$obj, $expected = '00000') { + $info = $obj->errorInfo(); + $code = $info[0]; + + if (($code != $expected) && (($expected != '00000') && ($code != ''))) { + printf("[%03d] Expecting error code '%s' got code '%s'\n", + $offset, $expected, $code); + } + + if ($expected != '00000') { + if (!isset($info[1]) || $info[1] == '') + printf("[%03d] Driver-specific error code not set\n", $offset); + if (!isset($info[2]) || $info[2] == '') + printf("[%03d] Driver-specific error message.not set\n", $offset); + } + + } + + function pdo_mysql_errorinfo($db, $offset) { + + try { + + /* + If you create a PDOStatement object through PDO->prepare() + or PDO->query() and invoke an error on the statement handle, + PDO->errorCode() will not reflect that error. You must call + PDOStatement->errorCode() to return the error code for an + operation performed on a particular statement handle. + */ + $code = $db->errorCode(); + check_error($offset + 2, $db); + + $stmt = $db->query('SELECT id, label FROM test'); + $stmt2 = &$stmt; + check_error($offset + 3, $db); + check_error($offset + 4, $stmt); + + $db->exec('DROP TABLE IF EXISTS test'); + @$stmt->execute(); + check_error($offset + 5, $db); + check_error($offset + 6, $stmt, '42S02'); + check_error($offset + 7, $stmt2, '42S02'); + + @$stmt = $db->query('SELECT id, label FROM unknown'); + check_error($offset + 8, $db, '42S02'); + + MySQLPDOTest::createTestTable($db); + $stmt = $db->query('SELECT id, label FROM test'); + check_error($offset + 9, $db); + check_error($offset + 10, $stmt); + + $db2 = &$db; + $db->exec('DROP TABLE IF EXISTS unknown'); + @$db->query('SELECT id, label FROM unknown'); + check_error($offset + 11, $db, '42S02'); + check_error($offset + 12, $db2, '42S02'); + check_error($offset + 13, $stmt); + check_error($offset + 14, $stmt2); + + // lets hope this is an invalid attribute code + $invalid_attr = -1 * PHP_INT_MAX + 3; + $tmp = @$db->getAttribute($invalid_attr); + check_error($offset + 15, $db, 'IM001'); + check_error($offset + 16, $db2, 'IM001'); + check_error($offset + 17, $stmt); + check_error($offset + 18, $stmt2); + + } catch (PDOException $e) { + printf("[%03d] %s [%s] %s\n", + $offset + 19, $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + } + + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); + printf("Emulated Prepared Statements...\n"); + pdo_mysql_errorinfo($db, 0); + + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + printf("Native Prepared Statements...\n"); + pdo_mysql_errorinfo($db, 20); + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec.phpt index 71d93815ff..c6f3d54ddd 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_exec.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_exec.phpt @@ -8,169 +8,169 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - function exec_and_count($offset, &$db, $sql, $exp = NULL) { - - try { - - $ret = $db->exec($sql); - if (!is_null($exp) && ($ret !== $exp)) { - printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n", - $offset, $exp, gettype($exp), $ret, gettype($ret), $sql, - $db->errorCode(), implode(' ', $db->errorInfo())); - return false; - } - - } catch (PDOException $e) { - printf("[%03d] '%s' has failed, [%s] %s\n", - $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo())); - return false; - } - - return true; - } - - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); - - /* affected rows related */ - try { - - exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0); - exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0); - exec_and_count(4, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1); - exec_and_count(5, $db, "INSERT INTO test(id, col1) VALUES (2, 'b'), (3, 'c')", 2); - exec_and_count(6, $db, "UPDATE test SET id = 4 WHERE id = 3", 1); - exec_and_count(7, $db, "INSERT INTO test(id, col1) VALUES (1, 'd') ON DUPLICATE KEY UPDATE id = 3", 2); - exec_and_count(8, $db, "UPDATE test SET id = 5 WHERE id = 5", 0); - exec_and_count(9, $db, "INSERT INTO test(id, col1) VALUES (5, 'e') ON DUPLICATE KEY UPDATE id = 6", 1); - exec_and_count(10, $db, "REPLACE INTO test(id, col1) VALUES (5, 'f')", 2); - exec_and_count(11, $db, "REPLACE INTO test(id, col1) VALUES (6, 'g')", 1); - exec_and_count(12, $db, 'DELETE FROM test WHERE id > 2', 4); - exec_and_count(13, $db, 'DROP TABLE test', 0); - exec_and_count(14, $db, 'SET @myvar = 1', 0); - - exec_and_count(15, $db, 'THIS IS NOT VALID SQL, I HOPE', false); - printf("[016] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); - - exec_and_count(36, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0); - exec_and_count(37, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1); - // Results may vary. Typically you will get 1. But the MySQL 5.1 manual states: Truncation operations do not return the number of deleted rows. - // Don't rely on any return value! - exec_and_count(38, $db, 'TRUNCATE TABLE test', NULL); - - } catch (PDOException $e) { - printf("[001] %s, [%s] %s\n", - $e->getMessage(), - $db->errorCode(), implode(' ', $db->errorInfo())); - } - - - /* CREATE, DROP, CALL SP and SF */ - if (MySQLPDOTest::getServerVersion($db) > 50000) { - // let's try to play with stored procedures - try { - $ignore_exception = true; - exec_and_count(18, $db, 'DROP PROCEDURE IF EXISTS p', 0); - exec_and_count(19, $db, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(255)) BEGIN SELECT VERSION() INTO ver_param; END;', 0); - // we got this far without problems. If there's an issue from now on, its a failure - $ignore_exception = false; - exec_and_count(20, $db, 'CALL p(@version)', 1); - $stmt = $db->query('SELECT @version AS p_version'); - $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); - if (count($tmp) > 1 || !isset($tmp[0]['p_version'])) { - printf("[022] Data seems wrong, dumping\n"); - var_dump($tmp); - } else { - $p_version = $tmp[0]['p_version']; - } - - $stmt = $db->query('SELECT VERSION() AS _version'); - $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); - if (count($tmp) > 1 || !isset($tmp[0]['_version'])) { - printf("[023] Data seems wrong, dumping\n"); - var_dump($tmp); - } else { - if ($p_version !== $tmp[0]['_version']) { - printf("[024] Found different version strings, SP returned '%s'/%s, SELECT returned '%s'/%s\n", - $p_version, gettype($p_version), - $tmp[0]['_version'], gettype($tmp[0]['_version'])); - } - } - exec_and_count(25, $db, 'DROP PROCEDURE IF EXISTS p', 0); - - } catch (PDOException $e) { - // ignore it, we might not have sufficient permissions - if (!$ignore_exception) - printf("[021] %s, [%s] %s\n", - $e->getMessage(), - $db->errorCode(), implode(' ', $db->errorInfo())); - } - - // stored function - try { - $ignore_exception = true; - exec_and_count(27, $db, 'DROP FUNCTION IF EXISTS f', 0); - exec_and_count(28, $db, 'CREATE FUNCTION f( ver_param VARCHAR(255)) RETURNS VARCHAR(255) DETERMINISTIC RETURN ver_param;', 0); - // we got this far without problems. If there's an issue from now on, its a failure - $ignore_exception = false; - $stmt = $db->query('SELECT f(VERSION()) AS f_version'); - $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); - if (count($tmp) > 1 || !isset($tmp[0]['f_version'])) { - printf("[029] Data seems wrong, dumping\n"); - var_dump($tmp); - } else { - $f_version = $tmp[0]['f_version']; - } - $stmt = $db->query('SELECT VERSION() AS _version'); - $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); - if (count($tmp) > 1 || !isset($tmp[0]['_version'])) { - printf("[030] Data seems wrong, dumping\n"); - var_dump($tmp); - } else { - if ($f_version !== $tmp[0]['_version']) { - printf("[031] Found different version strings, SF returned '%s'/%s, SELECT returned '%s'/%s\n", - $f_version, gettype($f_version), - $tmp[0]['_version'], gettype($tmp[0]['_version'])); - } - } - exec_and_count(32, $db, 'DROP FUNCTION IF EXISTS f', 0); - - } catch (PDOException $e) { - // ignore it, we might not have sufficient permissions - if (!$ignore_exception) - printf("[026] %s, [%s] %s\n", - $e->getMessage(), - $db->errorCode(), implode(' ', $db->errorInfo())); - } - } - - // multi query - try { - - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); - $exp = 0; - - $tmp = @$db->exec(sprintf('DROP TABLE IF EXISTS test; CREATE TABLE test(id INT) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); - if ($exp !== $tmp) - printf("[034] Expecting %s/%s got %s/%s, [%s] %s\n", - $exp, gettype($exp), - $tmp, gettype($tmp), - $db->errorCode(), var_export($db->errorInfo(), true)); - - // this is interesting: if we get sort of affected rows, what will happen now? - $tmp = @$db->exec('INSERT INTO test(id) VALUES (1); INSERT INTO test(id) VALUES (2)'); - printf("[035] With emulated PS it works but makes no sense given that exec() returns sort of affected rows...\n"); - - - } catch (PDOException $e) { - printf("[033] %s, [%s] %s\n", - $e->getMessage(), - $db->errorCode(), implode(' ', $db->errorInfo())); - } - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - - print "done!"; + function exec_and_count($offset, &$db, $sql, $exp = NULL) { + + try { + + $ret = $db->exec($sql); + if (!is_null($exp) && ($ret !== $exp)) { + printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n", + $offset, $exp, gettype($exp), $ret, gettype($ret), $sql, + $db->errorCode(), implode(' ', $db->errorInfo())); + return false; + } + + } catch (PDOException $e) { + printf("[%03d] '%s' has failed, [%s] %s\n", + $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo())); + return false; + } + + return true; + } + + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); + + /* affected rows related */ + try { + + exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0); + exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0); + exec_and_count(4, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1); + exec_and_count(5, $db, "INSERT INTO test(id, col1) VALUES (2, 'b'), (3, 'c')", 2); + exec_and_count(6, $db, "UPDATE test SET id = 4 WHERE id = 3", 1); + exec_and_count(7, $db, "INSERT INTO test(id, col1) VALUES (1, 'd') ON DUPLICATE KEY UPDATE id = 3", 2); + exec_and_count(8, $db, "UPDATE test SET id = 5 WHERE id = 5", 0); + exec_and_count(9, $db, "INSERT INTO test(id, col1) VALUES (5, 'e') ON DUPLICATE KEY UPDATE id = 6", 1); + exec_and_count(10, $db, "REPLACE INTO test(id, col1) VALUES (5, 'f')", 2); + exec_and_count(11, $db, "REPLACE INTO test(id, col1) VALUES (6, 'g')", 1); + exec_and_count(12, $db, 'DELETE FROM test WHERE id > 2', 4); + exec_and_count(13, $db, 'DROP TABLE test', 0); + exec_and_count(14, $db, 'SET @myvar = 1', 0); + + exec_and_count(15, $db, 'THIS IS NOT VALID SQL, I HOPE', false); + printf("[016] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo())); + + exec_and_count(36, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0); + exec_and_count(37, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1); + // Results may vary. Typically you will get 1. But the MySQL 5.1 manual states: Truncation operations do not return the number of deleted rows. + // Don't rely on any return value! + exec_and_count(38, $db, 'TRUNCATE TABLE test', NULL); + + } catch (PDOException $e) { + printf("[001] %s, [%s] %s\n", + $e->getMessage(), + $db->errorCode(), implode(' ', $db->errorInfo())); + } + + + /* CREATE, DROP, CALL SP and SF */ + if (MySQLPDOTest::getServerVersion($db) > 50000) { + // let's try to play with stored procedures + try { + $ignore_exception = true; + exec_and_count(18, $db, 'DROP PROCEDURE IF EXISTS p', 0); + exec_and_count(19, $db, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(255)) BEGIN SELECT VERSION() INTO ver_param; END;', 0); + // we got this far without problems. If there's an issue from now on, its a failure + $ignore_exception = false; + exec_and_count(20, $db, 'CALL p(@version)', 1); + $stmt = $db->query('SELECT @version AS p_version'); + $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); + if (count($tmp) > 1 || !isset($tmp[0]['p_version'])) { + printf("[022] Data seems wrong, dumping\n"); + var_dump($tmp); + } else { + $p_version = $tmp[0]['p_version']; + } + + $stmt = $db->query('SELECT VERSION() AS _version'); + $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); + if (count($tmp) > 1 || !isset($tmp[0]['_version'])) { + printf("[023] Data seems wrong, dumping\n"); + var_dump($tmp); + } else { + if ($p_version !== $tmp[0]['_version']) { + printf("[024] Found different version strings, SP returned '%s'/%s, SELECT returned '%s'/%s\n", + $p_version, gettype($p_version), + $tmp[0]['_version'], gettype($tmp[0]['_version'])); + } + } + exec_and_count(25, $db, 'DROP PROCEDURE IF EXISTS p', 0); + + } catch (PDOException $e) { + // ignore it, we might not have sufficient permissions + if (!$ignore_exception) + printf("[021] %s, [%s] %s\n", + $e->getMessage(), + $db->errorCode(), implode(' ', $db->errorInfo())); + } + + // stored function + try { + $ignore_exception = true; + exec_and_count(27, $db, 'DROP FUNCTION IF EXISTS f', 0); + exec_and_count(28, $db, 'CREATE FUNCTION f( ver_param VARCHAR(255)) RETURNS VARCHAR(255) DETERMINISTIC RETURN ver_param;', 0); + // we got this far without problems. If there's an issue from now on, its a failure + $ignore_exception = false; + $stmt = $db->query('SELECT f(VERSION()) AS f_version'); + $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); + if (count($tmp) > 1 || !isset($tmp[0]['f_version'])) { + printf("[029] Data seems wrong, dumping\n"); + var_dump($tmp); + } else { + $f_version = $tmp[0]['f_version']; + } + $stmt = $db->query('SELECT VERSION() AS _version'); + $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); + if (count($tmp) > 1 || !isset($tmp[0]['_version'])) { + printf("[030] Data seems wrong, dumping\n"); + var_dump($tmp); + } else { + if ($f_version !== $tmp[0]['_version']) { + printf("[031] Found different version strings, SF returned '%s'/%s, SELECT returned '%s'/%s\n", + $f_version, gettype($f_version), + $tmp[0]['_version'], gettype($tmp[0]['_version'])); + } + } + exec_and_count(32, $db, 'DROP FUNCTION IF EXISTS f', 0); + + } catch (PDOException $e) { + // ignore it, we might not have sufficient permissions + if (!$ignore_exception) + printf("[026] %s, [%s] %s\n", + $e->getMessage(), + $db->errorCode(), implode(' ', $db->errorInfo())); + } + } + + // multi query + try { + + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); + $exp = 0; + + $tmp = @$db->exec(sprintf('DROP TABLE IF EXISTS test; CREATE TABLE test(id INT) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); + if ($exp !== $tmp) + printf("[034] Expecting %s/%s got %s/%s, [%s] %s\n", + $exp, gettype($exp), + $tmp, gettype($tmp), + $db->errorCode(), var_export($db->errorInfo(), true)); + + // this is interesting: if we get sort of affected rows, what will happen now? + $tmp = @$db->exec('INSERT INTO test(id) VALUES (1); INSERT INTO test(id) VALUES (2)'); + printf("[035] With emulated PS it works but makes no sense given that exec() returns sort of affected rows...\n"); + + + } catch (PDOException $e) { + printf("[033] %s, [%s] %s\n", + $e->getMessage(), + $db->errorCode(), implode(' ', $db->errorInfo())); + } + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec_ddl.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec_ddl.phpt index 0b2428cc1c..53d36af4ff 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_exec_ddl.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_exec_ddl.phpt @@ -8,75 +8,75 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - function exec_and_count($offset, &$db, $sql, $exp, $suppress_warning = false) { + function exec_and_count($offset, &$db, $sql, $exp, $suppress_warning = false) { - try { + try { - if ($suppress_warning) - $ret = @$db->exec($sql); - else - $ret = $db->exec($sql); + if ($suppress_warning) + $ret = @$db->exec($sql); + else + $ret = $db->exec($sql); - if ($ret !== $exp) { - printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n", - $offset, $exp, gettype($exp), $ret, gettype($ret), $sql, - $db->errorCode(), implode(' ', $db->errorInfo())); - return false; - } + if ($ret !== $exp) { + printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n", + $offset, $exp, gettype($exp), $ret, gettype($ret), $sql, + $db->errorCode(), implode(' ', $db->errorInfo())); + return false; + } - } catch (PDOException $e) { - printf("[%03d] '%s' has failed, [%s] %s\n", - $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo())); - return false; - } + } catch (PDOException $e) { + printf("[%03d] '%s' has failed, [%s] %s\n", + $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo())); + return false; + } - return true; - } + return true; + } - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); - /* affected rows related */ - try { + /* affected rows related */ + try { - @$db->exec('DROP DATABASE IF EXISTS pdo_exec_ddl'); - @$db->exec('DROP DATABASE IF EXISTS pdo_exec_ddl2'); - if (1 === @$db->exec('CREATE DATABASE pdo_exec_ddl')) { - // yippie - we can create databases etc. - exec_and_count(3, $db, 'ALTER DATABASE pdo_exec_ddl CHARACTER SET latin1', 1); - } + @$db->exec('DROP DATABASE IF EXISTS pdo_exec_ddl'); + @$db->exec('DROP DATABASE IF EXISTS pdo_exec_ddl2'); + if (1 === @$db->exec('CREATE DATABASE pdo_exec_ddl')) { + // yippie - we can create databases etc. + exec_and_count(3, $db, 'ALTER DATABASE pdo_exec_ddl CHARACTER SET latin1', 1); + } - exec_and_count(4, $db, 'DROP TABLE IF EXISTS pdo_exec_ddl', 0); - exec_and_count(5, $db, 'DROP TABLE IF EXISTS pdo_exec_ddl2', 0); - if (0 === $db->exec('CREATE TABLE pdo_exec_ddl(id INT, col1 CHAR(2))')) { - exec_and_count(5, $db, 'CREATE INDEX idx1 ON pdo_exec_ddl(id)', 0); - exec_and_count(6, $db, 'DROP INDEX idx1 ON pdo_exec_ddl', 0); - exec_and_count(7, $db, 'ALTER TABLE pdo_exec_ddl DROP id', 0); - exec_and_count(8, $db, 'ALTER TABLE pdo_exec_ddl ADD id INT', 0); - exec_and_count(9, $db, 'ALTER TABLE pdo_exec_ddl ALTER id SET DEFAULT 1', 0); - exec_and_count(10, $db, 'RENAME TABLE pdo_exec_ddl TO pdo_exec_ddl2', 0); - } + exec_and_count(4, $db, 'DROP TABLE IF EXISTS pdo_exec_ddl', 0); + exec_and_count(5, $db, 'DROP TABLE IF EXISTS pdo_exec_ddl2', 0); + if (0 === $db->exec('CREATE TABLE pdo_exec_ddl(id INT, col1 CHAR(2))')) { + exec_and_count(5, $db, 'CREATE INDEX idx1 ON pdo_exec_ddl(id)', 0); + exec_and_count(6, $db, 'DROP INDEX idx1 ON pdo_exec_ddl', 0); + exec_and_count(7, $db, 'ALTER TABLE pdo_exec_ddl DROP id', 0); + exec_and_count(8, $db, 'ALTER TABLE pdo_exec_ddl ADD id INT', 0); + exec_and_count(9, $db, 'ALTER TABLE pdo_exec_ddl ALTER id SET DEFAULT 1', 0); + exec_and_count(10, $db, 'RENAME TABLE pdo_exec_ddl TO pdo_exec_ddl2', 0); + } - /* - 11.1.2. ALTER LOGFILE GROUP Syntax - 11.1.3. ALTER SERVER Syntax - 11.1.5. ALTER TABLESPACE Syntax - 11.1.8. CREATE LOGFILE GROUP Syntax - 11.1.9. CREATE SERVER Syntax - 11.1.11. CREATE TABLESPACE Syntax - 11.1.14. DROP LOGFILE GROUP Syntax - 11.1.15. DROP SERVER Syntax - 11.1.17. DROP TABLESPACE Syntax - */ + /* + 11.1.2. ALTER LOGFILE GROUP Syntax + 11.1.3. ALTER SERVER Syntax + 11.1.5. ALTER TABLESPACE Syntax + 11.1.8. CREATE LOGFILE GROUP Syntax + 11.1.9. CREATE SERVER Syntax + 11.1.11. CREATE TABLESPACE Syntax + 11.1.14. DROP LOGFILE GROUP Syntax + 11.1.15. DROP SERVER Syntax + 11.1.17. DROP TABLESPACE Syntax + */ - } catch (PDOException $e) { - printf("[001] %s, [%s] %s\n", - $e->getMessage(), - $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s, [%s] %s\n", + $e->getMessage(), + $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; --CLEAN-- <?php require __DIR__ . '/mysql_pdo_test.inc'; diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt index 50b35618b3..4e3f40d369 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt @@ -30,85 +30,85 @@ if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) { ?> --FILE-- <?php - function exec_and_count($offset, &$db, $sql, $exp) { - - try { - - $ret = $db->exec($sql); - if ($ret !== $exp) { - printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n", - $offset, $exp, gettype($exp), $ret, gettype($ret), $sql, - $db->errorCode(), implode(' ', $db->errorInfo())); - return false; - } - - } catch (PDOException $e) { - - if (42000 == $db->errorCode()) { - // Error: 1148 SQLSTATE: 42000 (ER_NOT_ALLOWED_COMMAND) - // Load data infile not allowed - return false; - } - - printf("[%03d] '%s' has failed, [%s] %s\n", - $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo())); - return false; - } - - return true; - } - - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - putenv('PDOTEST_ATTR='.serialize([PDO::MYSQL_ATTR_LOCAL_INFILE=>true])); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); - - /* affected rows related */ - try { - - exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0); - exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0); - - $stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'"); - if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) { - $filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv"; - } else { - $filename = MySQLPDOTest::getTempDir() . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv"; - } - - $fp = fopen($filename, "w"); - fwrite($fp, "1;foo\n"); - fwrite($fp, "2;bar"); - fclose($fp); - - $sql = sprintf("LOAD DATA LOCAL INFILE %s INTO TABLE test FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n'", $db->quote($filename)); - - if (exec_and_count(4, $db, $sql, 2)) { - - $stmt = $db->query('SELECT id, col1 FROM test ORDER BY id ASC'); - $expected = array(array("id" => 1, "col1" => "foo"), array("id" => 2, "col1" => "bar")); - $ret = $stmt->fetchAll(PDO::FETCH_ASSOC); - foreach ($expected as $offset => $exp) { - foreach ($exp as $key => $value) { - if ($ret[$offset][$key] != $value) { - printf("Results seem wrong, check manually\n"); - var_dump($ret); - var_dump($expected); - break 2; - } - } - } - } - - unlink($filename); - - } catch (PDOException $e) { - printf("[001] %s, [%s] %s\n", - $e->getMessage(), - $db->errorCode(), implode(' ', $db->errorInfo())); - } - - print "done!"; + function exec_and_count($offset, &$db, $sql, $exp) { + + try { + + $ret = $db->exec($sql); + if ($ret !== $exp) { + printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n", + $offset, $exp, gettype($exp), $ret, gettype($ret), $sql, + $db->errorCode(), implode(' ', $db->errorInfo())); + return false; + } + + } catch (PDOException $e) { + + if (42000 == $db->errorCode()) { + // Error: 1148 SQLSTATE: 42000 (ER_NOT_ALLOWED_COMMAND) + // Load data infile not allowed + return false; + } + + printf("[%03d] '%s' has failed, [%s] %s\n", + $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo())); + return false; + } + + return true; + } + + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + putenv('PDOTEST_ATTR='.serialize([PDO::MYSQL_ATTR_LOCAL_INFILE=>true])); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); + + /* affected rows related */ + try { + + exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0); + exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0); + + $stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'"); + if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) { + $filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv"; + } else { + $filename = MySQLPDOTest::getTempDir() . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv"; + } + + $fp = fopen($filename, "w"); + fwrite($fp, "1;foo\n"); + fwrite($fp, "2;bar"); + fclose($fp); + + $sql = sprintf("LOAD DATA LOCAL INFILE %s INTO TABLE test FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n'", $db->quote($filename)); + + if (exec_and_count(4, $db, $sql, 2)) { + + $stmt = $db->query('SELECT id, col1 FROM test ORDER BY id ASC'); + $expected = array(array("id" => 1, "col1" => "foo"), array("id" => 2, "col1" => "bar")); + $ret = $stmt->fetchAll(PDO::FETCH_ASSOC); + foreach ($expected as $offset => $exp) { + foreach ($exp as $key => $value) { + if ($ret[$offset][$key] != $value) { + printf("Results seem wrong, check manually\n"); + var_dump($ret); + var_dump($expected); + break 2; + } + } + } + } + + unlink($filename); + + } catch (PDOException $e) { + printf("[001] %s, [%s] %s\n", + $e->getMessage(), + $db->errorCode(), implode(' ', $db->errorInfo())); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt index 901a4ad9a8..2cff2e3915 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt @@ -8,50 +8,50 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - function exec_and_count($offset, &$db, $sql, $exp) { + function exec_and_count($offset, &$db, $sql, $exp) { - try { + try { - $ret = $db->exec($sql); - if ($ret !== $exp) { - printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n", - $offset, $exp, gettype($exp), $ret, gettype($ret), $sql, - $db->errorCode(), implode(' ', $db->errorInfo())); - return false; - } + $ret = $db->exec($sql); + if ($ret !== $exp) { + printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n", + $offset, $exp, gettype($exp), $ret, gettype($ret), $sql, + $db->errorCode(), implode(' ', $db->errorInfo())); + return false; + } - } catch (PDOException $e) { - printf("[%03d] '%s' has failed, [%s] %s\n", - $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo())); - return false; - } + } catch (PDOException $e) { + printf("[%03d] '%s' has failed, [%s] %s\n", + $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo())); + return false; + } - return true; - } + return true; + } - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); - /* affected rows related */ - try { + /* affected rows related */ + try { - exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0); - exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0); - exec_and_count(4, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1); - // question is: will the result set be cleaned up, will it be possible to run more queries on the line? - // buffered or unbuffered does not matter! - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); - exec_and_count(5, $db, 'SELECT id FROM test', 0); - exec_and_count(6, $db, "INSERT INTO test(id, col1) VALUES (2, 'b')", 1); + exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0); + exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0); + exec_and_count(4, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1); + // question is: will the result set be cleaned up, will it be possible to run more queries on the line? + // buffered or unbuffered does not matter! + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); + exec_and_count(5, $db, 'SELECT id FROM test', 0); + exec_and_count(6, $db, "INSERT INTO test(id, col1) VALUES (2, 'b')", 1); - } catch (PDOException $e) { - printf("[001] %s, [%s] %s\n", - $e->getMessage(), - $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s, [%s] %s\n", + $e->getMessage(), + $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt b/ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt index 31b2bd5d75..fb20dff5bc 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt @@ -9,54 +9,54 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - function fetch($offset, &$db, $query, $expect = null) { + function fetch($offset, &$db, $query, $expect = null) { - try { - $stmt = $db->query('SELECT 1'); - $num = $stmt->fetch(PDO::FETCH_NUM); + try { + $stmt = $db->query('SELECT 1'); + $num = $stmt->fetch(PDO::FETCH_NUM); - $stmt = $db->query('SELECT 1'); - $assoc = $stmt->fetch(PDO::FETCH_ASSOC); + $stmt = $db->query('SELECT 1'); + $assoc = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt = $db->query('SELECT 1'); - $both = $stmt->fetch(PDO::FETCH_BOTH); + $stmt = $db->query('SELECT 1'); + $both = $stmt->fetch(PDO::FETCH_BOTH); - $computed_both = array_merge($num, $assoc); - if ($computed_both != $both) { - printf("[%03d] Suspicious FETCH_BOTH result, dumping\n", $offset); - var_dump($computed_both); - var_dump($both); - } + $computed_both = array_merge($num, $assoc); + if ($computed_both != $both) { + printf("[%03d] Suspicious FETCH_BOTH result, dumping\n", $offset); + var_dump($computed_both); + var_dump($both); + } - if (!is_null($expect) && ($expect != $both)) { - printf("[%03d] Expected differs from returned data, dumping\n", $offset); - var_dump($expect); - var_dump($both); - } + if (!is_null($expect) && ($expect != $both)) { + printf("[%03d] Expected differs from returned data, dumping\n", $offset); + var_dump($expect); + var_dump($both); + } - } catch (PDOException $e) { + } catch (PDOException $e) { - printf("[%03d] %s, [%s] %s\n", - $offset, - $e->getMessage(), $db->errroCode(), implode(' ', $db->errorInfo())); + printf("[%03d] %s, [%s] %s\n", + $offset, + $e->getMessage(), $db->errroCode(), implode(' ', $db->errorInfo())); - } + } - } + } - try { + try { - fetch(2, $db, 'SELECT 1', array(0 => '1', '1' => '1')); + fetch(2, $db, 'SELECT 1', array(0 => '1', '1' => '1')); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt b/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt index 51310faa9e..386dfb1e1e 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt @@ -11,60 +11,60 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db)) ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); - - function set_and_get($offset, $db, $attribute, $value) { - - $value_type = gettype($value); - try { - - if (!$db->setAttribute($attribute, $value)) { - printf("[%03d] Cannot set attribute '%s' to value '%s'\n", - $offset, $attribute, var_export($tmp, true)); - return false; - } - - if (gettype($value) != $value_type) { - printf("[%03d] Call to PDO::setAttribute(int attribute, mixed value) has changed the type of value from %s to %s, test will not work properly\n", - $offset, $value_type, gettype($value)); - return false; - } - - $tmp = $db->getAttribute($attribute); - if ($tmp !== $value) { - printf("[%03d] Attribute '%s' was set to '%s'/%s but getAttribute() reports '%s'/%s\n", - $offset, $attribute, var_export($value, true), gettype($value), var_export($tmp, true), gettype($tmp)); - return false; - } - - } catch (PDOException $e) { - printf("[%03d] %s, [%s] %s\n", - $offset, $e->getMessage(), - $db->errorCode(), implode(' ', $db->errorInfo())); - return false; - } - - return true; - } - - set_and_get(1, $db, PDO::ATTR_AUTOCOMMIT, 1); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); + + function set_and_get($offset, $db, $attribute, $value) { + + $value_type = gettype($value); + try { + + if (!$db->setAttribute($attribute, $value)) { + printf("[%03d] Cannot set attribute '%s' to value '%s'\n", + $offset, $attribute, var_export($tmp, true)); + return false; + } + + if (gettype($value) != $value_type) { + printf("[%03d] Call to PDO::setAttribute(int attribute, mixed value) has changed the type of value from %s to %s, test will not work properly\n", + $offset, $value_type, gettype($value)); + return false; + } + + $tmp = $db->getAttribute($attribute); + if ($tmp !== $value) { + printf("[%03d] Attribute '%s' was set to '%s'/%s but getAttribute() reports '%s'/%s\n", + $offset, $attribute, var_export($value, true), gettype($value), var_export($tmp, true), gettype($tmp)); + return false; + } + + } catch (PDOException $e) { + printf("[%03d] %s, [%s] %s\n", + $offset, $e->getMessage(), + $db->errorCode(), implode(' ', $db->errorInfo())); + return false; + } + + return true; + } + + set_and_get(1, $db, PDO::ATTR_AUTOCOMMIT, 1); /* - set_and_get(2, $db, PDO::ATTR_AUTOCOMMIT, 0); - set_and_get(3, $db, PDO::ATTR_AUTOCOMMIT, -1); - $obj = new stdClass(); - set_and_get(4, $db, PDO::ATTR_AUTOCOMMIT, $obj); + set_and_get(2, $db, PDO::ATTR_AUTOCOMMIT, 0); + set_and_get(3, $db, PDO::ATTR_AUTOCOMMIT, -1); + $obj = new stdClass(); + set_and_get(4, $db, PDO::ATTR_AUTOCOMMIT, $obj); - set_and_get(5, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, 1); - set_and_get(6, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, 0); - set_and_get(7, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, -1); - $tmp = array(); - set_and_get(8, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, $tmp); + set_and_get(5, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, 1); + set_and_get(6, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, 0); + set_and_get(7, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, -1); + $tmp = array(); + set_and_get(8, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, $tmp); - set_and_get(9, $db, PPDO::MYSQL_ATTR_INIT_COMMAND, ''); - set_and_get(10, $db, PPDO::MYSQL_ATTR_INIT_COMMAND, 'SOME SQL'); - set_and_get(11, $db, PPDO::MYSQL_ATTR_INIT_COMMAND, -1); + set_and_get(9, $db, PPDO::MYSQL_ATTR_INIT_COMMAND, ''); + set_and_get(10, $db, PPDO::MYSQL_ATTR_INIT_COMMAND, 'SOME SQL'); + set_and_get(11, $db, PPDO::MYSQL_ATTR_INIT_COMMAND, -1); */ /* @@ -87,7 +87,7 @@ PDO::ATTR_CONNECTION_STATUS PDO::ATTR_SERVER_INFO */ - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_interface.phpt b/ext/pdo_mysql/tests/pdo_mysql_interface.phpt index cc949b265d..fbf0938dc9 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_interface.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_interface.phpt @@ -11,48 +11,48 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db)) ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - $expected = array( - '__construct' => true, - 'prepare' => true, - 'beginTransaction' => true, - 'commit' => true, - 'rollBack' => true, - 'setAttribute' => true, - 'exec' => true, - 'query' => true, - 'lastInsertId' => true, - 'errorCode' => true, - 'errorInfo' => true, - 'getAttribute' => true, - 'quote' => true, - 'inTransaction' => true, - 'getAvailableDrivers' => true, - ); - $classname = get_class($db); + $expected = array( + '__construct' => true, + 'prepare' => true, + 'beginTransaction' => true, + 'commit' => true, + 'rollBack' => true, + 'setAttribute' => true, + 'exec' => true, + 'query' => true, + 'lastInsertId' => true, + 'errorCode' => true, + 'errorInfo' => true, + 'getAttribute' => true, + 'quote' => true, + 'inTransaction' => true, + 'getAvailableDrivers' => true, + ); + $classname = get_class($db); - $methods = get_class_methods($classname); - foreach ($methods as $k => $method) { - if (isset($expected[$method])) { - unset($expected[$method]); - unset($methods[$k]); - } - if ($method == $classname) { - unset($expected['__construct']); - unset($methods[$k]); - } - } - if (!empty($expected)) { - printf("Dumping missing class methods\n"); - var_dump($expected); - } - if (!empty($methods)) { - printf("Found more methods than expected, dumping list\n"); - var_dump($methods); - } + $methods = get_class_methods($classname); + foreach ($methods as $k => $method) { + if (isset($expected[$method])) { + unset($expected[$method]); + unset($methods[$k]); + } + if ($method == $classname) { + unset($expected['__construct']); + unset($methods[$k]); + } + } + if (!empty($expected)) { + printf("Dumping missing class methods\n"); + var_dump($expected); + } + if (!empty($methods)) { + printf("Found more methods than expected, dumping list\n"); + var_dump($methods); + } - print "done!"; + print "done!"; --EXPECT-- done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt b/ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt index d9dec0bcd3..b63ecb2c52 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt @@ -9,106 +9,106 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - - try { - if ('0' !== ($tmp = $db->lastInsertId())) - printf("[001] No query has been run, lastInsertId() should return '0'/string got '%s'/%s\n", - var_export($tmp, true), gettype($tmp)); - - if ('0' !== ($tmp = $db->lastInsertId('sequence_name'))) - printf("[002] MySQL does not support sequences, expecting '0'/string got '%s'/%s\n", - var_export($tmp, true), gettype($tmp)); - - $db->exec('DROP TABLE IF EXISTS test'); - if ('0' !== ($tmp = $db->lastInsertId())) - printf("[003] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); - - $db->exec(sprintf('CREATE TABLE test(id INT, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); - if ('0' !== ($tmp = $db->lastInsertId())) - printf("[004] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); - - $stmt = $db->query('SELECT id FROM test LIMIT 1'); - if ('0' !== ($tmp = $db->lastInsertId())) - printf("[005] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); - - // no auto increment column - $db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')"); - if ('0' !== ($tmp = $db->lastInsertId())) - printf("[006] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); - - $db->exec('ALTER TABLE test MODIFY id INT AUTO_INCREMENT PRIMARY KEY'); - if ('0' !== ($tmp = $db->lastInsertId())) - printf("[006] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); - - // duplicate key - @$db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')"); - if ('0' !== ($tmp = $db->lastInsertId())) - printf("[007] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); - - $db->exec("INSERT INTO test(id, col1) VALUES (101, 'b')"); - if ('101' !== ($tmp = $db->lastInsertId())) - printf("[008] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); - - $db->exec('ALTER TABLE test MODIFY col1 CHAR(10) UNIQUE'); - // replace = delete + insert -> new auto increment value - $db->exec("REPLACE INTO test(col1) VALUES ('b')"); - $next_id = (int)$db->lastInsertId(); - - if ($next_id <= 101) - printf("[009] Expecting at least 102, got %d\n",$next_id); - - $stmt = $db->query('SELECT LAST_INSERT_ID() as _last_id'); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $last_id = $row['_last_id']; - if ($next_id != $last_id) { - printf("[010] LAST_INSERT_ID() = %d and lastInserId() = %d differ\n", - $last_id, $next_id); - } - - $db->exec("INSERT INTO test(col1) VALUES ('c'), ('d'), ('e')"); - $next_id = (int)$db->lastInsertId(); - if ($next_id <= $last_id) - printf("[011] Expecting at least %d, got %d\n", $last_id + 1, $next_id); - - // warnings are unhandy, lets go for exceptions for a second - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - try { - $ignore_exception = true; - $db->exec('LOCK TABLE test WRITE'); - $ignore_exception = false; - - if (MySQLPDOTest::getServerVersion($db) >= 50000) { - $stmt = $db->query('SELECT @@auto_increment_increment AS inc'); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $inc = $row['inc']; - } else { - $inc = 1; - } - - $stmt = $db->query('SELECT LAST_INSERT_ID() as _last_id'); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $last_id = $row['_last_id']; - - $db->exec("INSERT INTO test(col1) VALUES ('z')"); - $next_id = (int)$db->lastInsertId(); - if ($next_id < ($last_id + $inc)) - printf("[012] Expecting at least %d, got %d\n", $last_id + $inc, $next_id); - - } catch (PDOException $e) { - if (!$ignore_exception) - printf("[014] %s, [%s} %s\n", $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - @$db->exec('UNLOCK TABLE test'); - - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + + try { + if ('0' !== ($tmp = $db->lastInsertId())) + printf("[001] No query has been run, lastInsertId() should return '0'/string got '%s'/%s\n", + var_export($tmp, true), gettype($tmp)); + + if ('0' !== ($tmp = $db->lastInsertId('sequence_name'))) + printf("[002] MySQL does not support sequences, expecting '0'/string got '%s'/%s\n", + var_export($tmp, true), gettype($tmp)); + + $db->exec('DROP TABLE IF EXISTS test'); + if ('0' !== ($tmp = $db->lastInsertId())) + printf("[003] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); + + $db->exec(sprintf('CREATE TABLE test(id INT, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); + if ('0' !== ($tmp = $db->lastInsertId())) + printf("[004] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); + + $stmt = $db->query('SELECT id FROM test LIMIT 1'); + if ('0' !== ($tmp = $db->lastInsertId())) + printf("[005] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); + + // no auto increment column + $db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')"); + if ('0' !== ($tmp = $db->lastInsertId())) + printf("[006] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); + + $db->exec('ALTER TABLE test MODIFY id INT AUTO_INCREMENT PRIMARY KEY'); + if ('0' !== ($tmp = $db->lastInsertId())) + printf("[006] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); + + // duplicate key + @$db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')"); + if ('0' !== ($tmp = $db->lastInsertId())) + printf("[007] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); + + $db->exec("INSERT INTO test(id, col1) VALUES (101, 'b')"); + if ('101' !== ($tmp = $db->lastInsertId())) + printf("[008] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp)); + + $db->exec('ALTER TABLE test MODIFY col1 CHAR(10) UNIQUE'); + // replace = delete + insert -> new auto increment value + $db->exec("REPLACE INTO test(col1) VALUES ('b')"); + $next_id = (int)$db->lastInsertId(); + + if ($next_id <= 101) + printf("[009] Expecting at least 102, got %d\n",$next_id); + + $stmt = $db->query('SELECT LAST_INSERT_ID() as _last_id'); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + $last_id = $row['_last_id']; + if ($next_id != $last_id) { + printf("[010] LAST_INSERT_ID() = %d and lastInserId() = %d differ\n", + $last_id, $next_id); + } + + $db->exec("INSERT INTO test(col1) VALUES ('c'), ('d'), ('e')"); + $next_id = (int)$db->lastInsertId(); + if ($next_id <= $last_id) + printf("[011] Expecting at least %d, got %d\n", $last_id + 1, $next_id); + + // warnings are unhandy, lets go for exceptions for a second + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + try { + $ignore_exception = true; + $db->exec('LOCK TABLE test WRITE'); + $ignore_exception = false; + + if (MySQLPDOTest::getServerVersion($db) >= 50000) { + $stmt = $db->query('SELECT @@auto_increment_increment AS inc'); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + $inc = $row['inc']; + } else { + $inc = 1; + } + + $stmt = $db->query('SELECT LAST_INSERT_ID() as _last_id'); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + $last_id = $row['_last_id']; + + $db->exec("INSERT INTO test(col1) VALUES ('z')"); + $next_id = (int)$db->lastInsertId(); + if ($next_id < ($last_id + $inc)) + printf("[012] Expecting at least %d, got %d\n", $last_id + $inc, $next_id); + + } catch (PDOException $e) { + if (!$ignore_exception) + printf("[014] %s, [%s} %s\n", $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + @$db->exec('UNLOCK TABLE test'); + + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_multi_stmt_nextrowset.phpt b/ext/pdo_mysql/tests/pdo_mysql_multi_stmt_nextrowset.phpt index f520c1d828..74ab7858d4 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_multi_stmt_nextrowset.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_multi_stmt_nextrowset.phpt @@ -21,65 +21,65 @@ if (!MySQLPDOTest::isPDOMySQLnd()) ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); - MySQLPDOTest::createTestTable($db); + MySQLPDOTest::createTestTable($db); - function test_proc($db) { + function test_proc($db) { - $db->exec('DROP PROCEDURE IF EXISTS p'); - $db->exec('CREATE PROCEDURE p() BEGIN SELECT id FROM test ORDER BY id ASC LIMIT 3; SELECT id, label FROM test WHERE id < 4 ORDER BY id DESC LIMIT 3; END;'); - $stmt = $db->query('CALL p()'); - do { - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - } while ($stmt->nextRowSet()); - var_dump($stmt->nextRowSet()); + $db->exec('DROP PROCEDURE IF EXISTS p'); + $db->exec('CREATE PROCEDURE p() BEGIN SELECT id FROM test ORDER BY id ASC LIMIT 3; SELECT id, label FROM test WHERE id < 4 ORDER BY id DESC LIMIT 3; END;'); + $stmt = $db->query('CALL p()'); + do { + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + } while ($stmt->nextRowSet()); + var_dump($stmt->nextRowSet()); - } + } - try { + try { - // Using native PS for proc, since emulated fails. - printf("Native PS...\n"); - foreach (array(false, true) as $multi) { - $value = $multi ? 'true' : 'false'; - echo "\nTesting with PDO::MYSQL_ATTR_MULTI_STATEMENTS set to {$value}\n"; - $dsn = MySQLPDOTest::getDSN(); - $user = PDO_MYSQL_TEST_USER; - $pass = PDO_MYSQL_TEST_PASS; - $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => $multi)); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - test_proc($db); + // Using native PS for proc, since emulated fails. + printf("Native PS...\n"); + foreach (array(false, true) as $multi) { + $value = $multi ? 'true' : 'false'; + echo "\nTesting with PDO::MYSQL_ATTR_MULTI_STATEMENTS set to {$value}\n"; + $dsn = MySQLPDOTest::getDSN(); + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; + $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => $multi)); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + test_proc($db); - $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => $multi)); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => $multi)); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - test_proc($db); + test_proc($db); - // Switch back to emulated prepares to verify multi statement attribute. - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); - // This will fail when $multi is false. - $stmt = $db->query("SELECT * FROM test; INSERT INTO test (id, label) VALUES (99, 'x')"); - if ($stmt !== false) { - $stmt->closeCursor(); - } - $info = $db->errorInfo(); - var_dump($info[0]); - } - @$db->exec('DROP PROCEDURE IF EXISTS p'); + // Switch back to emulated prepares to verify multi statement attribute. + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); + // This will fail when $multi is false. + $stmt = $db->query("SELECT * FROM test; INSERT INTO test (id, label) VALUES (99, 'x')"); + if ($stmt !== false) { + $stmt->closeCursor(); + } + $info = $db->errorInfo(); + var_dump($info[0]); + } + @$db->exec('DROP PROCEDURE IF EXISTS p'); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_param_str_natl.phpt b/ext/pdo_mysql/tests/pdo_mysql_param_str_natl.phpt index 01964c0cd9..a45259f0e0 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_param_str_natl.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_param_str_natl.phpt @@ -23,7 +23,7 @@ $stmt->execute(); var_dump($db->query('SELECT * from test')); foreach ($db->query('SELECT * from test') as $row) { - print_r($row); + print_r($row); } ?> diff --git a/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt b/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt index 3656e71a0c..4d95c73cdc 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt @@ -8,92 +8,92 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - - try { - - $dsn = MySQLPDOTest::getDSN(); - $user = PDO_MYSQL_TEST_USER; - $pass = PDO_MYSQL_TEST_PASS; - - $db1 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true)); - $db2 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true)); - $db1->exec('SET @pdo_persistent_connection=1'); - $stmt = $db2->query('SELECT @pdo_persistent_connection as _pers'); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - if ($tmp['_pers'] !== '1') - printf("[001] Both handles should use the same connection."); - - $stmt = $db1->query('SELECT CONNECTION_ID() as _con1'); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - $con1 = $tmp['_con1']; - - $stmt = $db2->query('SELECT CONNECTION_ID() as _con2'); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - $con2 = $tmp['_con2']; - - if ($con1 !== $con2) - printf("[002] Both handles should report the same MySQL thread ID"); - - $db1 = NULL; /* should be equal to closing to my understanding */ - $db1 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true)); - $stmt = $db1->query('SELECT CONNECTION_ID() as _con1'); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - $con1 = $tmp['_con1']; - - if ($con1 !== $con2) - printf("[003] Both handles should report the same MySQL thread ID"); - - $affected = $db1->exec(sprintf('KILL %d', $con1)); - // Server needs some think-time sometimes - sleep(1); - if ('00000' == $db1->errorCode()) { - // looks like KILL has worked ? Or not... TODO: why no warning with libmysql?! - @$db1->exec("SET @pdo_persistent_connection=2"); - // but now I want to see some error... - if ('HY000' != $db1->errorCode()) - printf("[004] Wrong error code %s\n", $db1->errorCode()); - - $tmp = implode(' ', $db1->errorInfo()); - if (!strstr($tmp, '2006')) - printf("[005] Wrong error info %s\n", $tmp); - } - - $db1 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => false)); - $stmt = $db1->query('SELECT CONNECTION_ID() as _con1'); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - $con1 = $tmp['_con1']; - - @$db2 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true)); - $stmt = $db2->query('SELECT CONNECTION_ID() as _con2'); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - $con2 = $tmp['_con2']; - - if ($con1 == $con2) - printf("[006] Looks like the persistent and the non persistent connection are using the same link?!\n"); - - // lets go crazy and create a few pconnections... - $connections = array(); - for ($i = 0; $i <= 20; $i++) { - $connections[$i] = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true)); - } - do { - $i = mt_rand(0, 20); - if (isset($connections[$i])) - unset($connections[$i]); - } while (!empty($connections)); - - - } catch (PDOException $e) { - printf("[001] %s, [%s] %s [%s] %s\n", - $e->getMessage(), - (is_object($db1)) ? $db1->errorCode() : 'n/a', - (is_object($db1)) ? implode(' ', $db1->errorInfo()) : 'n/a', - (is_object($db2)) ? $db2->errorCode() : 'n/a', - (is_object($db2)) ? implode(' ', $db2->errorInfo()) : 'n/a'); - } - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + + try { + + $dsn = MySQLPDOTest::getDSN(); + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; + + $db1 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true)); + $db2 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true)); + $db1->exec('SET @pdo_persistent_connection=1'); + $stmt = $db2->query('SELECT @pdo_persistent_connection as _pers'); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + if ($tmp['_pers'] !== '1') + printf("[001] Both handles should use the same connection."); + + $stmt = $db1->query('SELECT CONNECTION_ID() as _con1'); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + $con1 = $tmp['_con1']; + + $stmt = $db2->query('SELECT CONNECTION_ID() as _con2'); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + $con2 = $tmp['_con2']; + + if ($con1 !== $con2) + printf("[002] Both handles should report the same MySQL thread ID"); + + $db1 = NULL; /* should be equal to closing to my understanding */ + $db1 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true)); + $stmt = $db1->query('SELECT CONNECTION_ID() as _con1'); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + $con1 = $tmp['_con1']; + + if ($con1 !== $con2) + printf("[003] Both handles should report the same MySQL thread ID"); + + $affected = $db1->exec(sprintf('KILL %d', $con1)); + // Server needs some think-time sometimes + sleep(1); + if ('00000' == $db1->errorCode()) { + // looks like KILL has worked ? Or not... TODO: why no warning with libmysql?! + @$db1->exec("SET @pdo_persistent_connection=2"); + // but now I want to see some error... + if ('HY000' != $db1->errorCode()) + printf("[004] Wrong error code %s\n", $db1->errorCode()); + + $tmp = implode(' ', $db1->errorInfo()); + if (!strstr($tmp, '2006')) + printf("[005] Wrong error info %s\n", $tmp); + } + + $db1 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => false)); + $stmt = $db1->query('SELECT CONNECTION_ID() as _con1'); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + $con1 = $tmp['_con1']; + + @$db2 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true)); + $stmt = $db2->query('SELECT CONNECTION_ID() as _con2'); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + $con2 = $tmp['_con2']; + + if ($con1 == $con2) + printf("[006] Looks like the persistent and the non persistent connection are using the same link?!\n"); + + // lets go crazy and create a few pconnections... + $connections = array(); + for ($i = 0; $i <= 20; $i++) { + $connections[$i] = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true)); + } + do { + $i = mt_rand(0, 20); + if (isset($connections[$i])) + unset($connections[$i]); + } while (!empty($connections)); + + + } catch (PDOException $e) { + printf("[001] %s, [%s] %s [%s] %s\n", + $e->getMessage(), + (is_object($db1)) ? $db1->errorCode() : 'n/a', + (is_object($db1)) ? implode(' ', $db1->errorInfo()) : 'n/a', + (is_object($db2)) ? $db2->errorCode() : 'n/a', + (is_object($db2)) ? implode(' ', $db2->errorInfo()) : 'n/a'); + } + + print "done!"; ?> --EXPECT-- done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt index a230b3c19f..e44f1d2a52 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt @@ -9,22 +9,22 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - ob_start(); - phpinfo(); - $tmp = ob_get_contents(); - ob_end_clean(); + ob_start(); + phpinfo(); + $tmp = ob_get_contents(); + ob_end_clean(); - /* PDO Driver for MySQL, client library version => 6.0.3-alpha */ - $reg = 'Client API version.*' . preg_quote($db->getAttribute(PDO::ATTR_CLIENT_VERSION), '/'); + /* PDO Driver for MySQL, client library version => 6.0.3-alpha */ + $reg = 'Client API version.*' . preg_quote($db->getAttribute(PDO::ATTR_CLIENT_VERSION), '/'); - if (!preg_match("/$reg/", $tmp)) { - printf("[001] Cannot find MySQL PDO driver line in phpinfo() output\n"); - } + if (!preg_match("/$reg/", $tmp)) { + printf("[001] Cannot find MySQL PDO driver line in phpinfo() output\n"); + } - print "done!"; + print "done!"; ?> --EXPECT-- done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt index 8db812ee19..6fe2ff20ba 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt @@ -9,314 +9,314 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - - function prepex($offset, &$db, $query, $input_params = null, $error_info = null) { - - try { - - if (is_array($error_info) && isset($error_info['prepare'])) - $stmt = @$db->prepare($query); - else - $stmt = $db->prepare($query); - - if (is_array($error_info) && isset($error_info['prepare'])) { - $tmp = $db->errorInfo(); - - if (isset($error_info['prepare']['sqlstate']) && - ($error_info['prepare']['sqlstate'] !== $tmp[0])) { - printf("[%03d] prepare() - expecting SQLSTATE '%s' got '%s'\n", - $offset, $error_info['prepare']['sqlstate'], $tmp[0]); - return false; - } - - if (isset($error_info['prepare']['mysql']) && - ($error_info['prepare']['mysql'] !== $tmp[1])) { - printf("[%03d] prepare() - expecting MySQL Code '%s' got '%s'\n", - $offset, $error_info['prepare']['mysql'], $tmp[0]); - return false; - } - - return false; - } - - if (is_null($input_params)) - $input_params = array(); - - if (is_array($error_info) && isset($error_info['execute'])) - $ret = @$stmt->execute($input_params); - else - $ret = $stmt->execute($input_params); - - if (!is_bool($ret)) - printf("[%03d] PDO::execute() should return a boolean value, got %s/%s\n", - var_export($ret, true), $ret); - - if (is_array($error_info) && isset($error_info['execute'])) { - $tmp = $stmt->errorInfo(); - - if (isset($error_info['execute']['sqlstate']) && - ($error_info['execute']['sqlstate'] !== $tmp[0])) { - printf("[%03d] execute() - expecting SQLSTATE '%s' got '%s'\n", - $offset, $error_info['execute']['sqlstate'], $tmp[0]); - return false; - } - - if (isset($error_info['execute']['mysql']) && - ($error_info['execute']['mysql'] !== $tmp[1])) { - printf("[%03d] execute() - expecting MySQL Code '%s' got '%s'\n", - $offset, $error_info['execute']['mysql'], $tmp[0]); - return false; - } - - return false; - } - - } catch (PDOException $e) { - printf("[%03d] %s, [%s} %s\n", - $offset, $e->getMessage(), - $db->errorCode(), implode(' ', $db->errorInfo())); - return false; - } - - return $stmt; - } - - try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to switch to emulated prepared statements, test will fail\n"); - - // TODO - that's PDO - you can prepare empty statements! - prepex(3, $db, '', - array(), array('execute' => array('sqlstate' => '42000'))); - - // lets be fair and do the most simple SELECT first - $stmt = prepex(4, $db, 'SELECT 1 as "one"'); - var_dump($stmt->fetch(PDO::FETCH_ASSOC)); - - prepex(5, $db, 'DROP TABLE IF EXISTS test'); - prepex(6, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); - prepex(7, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')"); - $stmt = prepex(8, $db, 'SELECT label FROM test'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - prepex(9, $db, 'DELETE FROM test'); - prepex(10, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')", - array(':placeholder' => 'first row')); - $stmt = prepex(11, $db, 'SELECT label FROM test'); - - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - prepex(12, $db, 'DELETE FROM test'); - prepex(13, $db, 'INSERT INTO test(id, label) VALUES(1, :placeholder)', - array(':placeholder' => 'first row')); - prepex(14, $db, 'INSERT INTO test(id, label) VALUES(2, :placeholder)', - array(':placeholder' => 'second row')); - $stmt = prepex(15, $db, 'SELECT label FROM test'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - // Is PDO fun? - prepex(16, $db, 'SELECT label FROM test WHERE :placeholder > 1', - array(':placeholder' => 'id')); - prepex(17, $db, 'SELECT :placeholder FROM test WHERE id > 1', - array(':placeholder' => 'id')); - prepex(18, $db, 'SELECT :placeholder FROM test WHERE :placeholder > :placeholder', - array(':placeholder' => 'test')); - - for ($num_params = 2; $num_params < 100; $num_params++) { - $params = array(':placeholder' => 'a'); - for ($i = 1; $i < $num_params; $i++) { - $params[str_repeat('a', $i)] = 'some data'; - } - prepex(19, $db, 'SELECT id, label FROM test WHERE label > :placeholder', - $params, array('execute' => array('sqlstate' => 'HY093'))); - } - - prepex(20, $db, 'DELETE FROM test'); - prepex(21, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder), (2, :placeholder)', - array(':placeholder' => 'row')); - $stmt = prepex(22, $db, 'SELECT id, label FROM test'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - $stmt = prepex(23, $db, 'SELECT id, label FROM test WHERE :placeholder IS NOT NULL', - array(':placeholder' => 1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) - printf("[024] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp); - - $stmt = prepex(25, $db, 'SELECT id, label FROM test WHERE :placeholder IS NULL', - array(':placeholder' => 1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) - printf("[026] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp); - - prepex(27, $db, 'DROP TABLE IF EXISTS test'); - prepex(28, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM'); - if (is_object(prepex(29, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)'))) { - prepex(30, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder)', - array(':placeholder' => 'MySQL is the best database in the world!')); - prepex(31, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder)', - array(':placeholder' => 'If I have the freedom to choose, I would always go again for the MySQL Server')); - $stmt = prepex(32, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)', - array(':placeholder' => 'mysql')); - /* - Lets ignore this - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) - printf("[033] Expecting two rows, got %d rows\n", $tmp); - */ - } - prepex(34, $db, 'DELETE FROM test'); - prepex(35, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder), (2, :placeholder)', - array(':placeholder' => 'row')); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + + function prepex($offset, &$db, $query, $input_params = null, $error_info = null) { + + try { + + if (is_array($error_info) && isset($error_info['prepare'])) + $stmt = @$db->prepare($query); + else + $stmt = $db->prepare($query); + + if (is_array($error_info) && isset($error_info['prepare'])) { + $tmp = $db->errorInfo(); + + if (isset($error_info['prepare']['sqlstate']) && + ($error_info['prepare']['sqlstate'] !== $tmp[0])) { + printf("[%03d] prepare() - expecting SQLSTATE '%s' got '%s'\n", + $offset, $error_info['prepare']['sqlstate'], $tmp[0]); + return false; + } + + if (isset($error_info['prepare']['mysql']) && + ($error_info['prepare']['mysql'] !== $tmp[1])) { + printf("[%03d] prepare() - expecting MySQL Code '%s' got '%s'\n", + $offset, $error_info['prepare']['mysql'], $tmp[0]); + return false; + } + + return false; + } + + if (is_null($input_params)) + $input_params = array(); + + if (is_array($error_info) && isset($error_info['execute'])) + $ret = @$stmt->execute($input_params); + else + $ret = $stmt->execute($input_params); + + if (!is_bool($ret)) + printf("[%03d] PDO::execute() should return a boolean value, got %s/%s\n", + var_export($ret, true), $ret); + + if (is_array($error_info) && isset($error_info['execute'])) { + $tmp = $stmt->errorInfo(); + + if (isset($error_info['execute']['sqlstate']) && + ($error_info['execute']['sqlstate'] !== $tmp[0])) { + printf("[%03d] execute() - expecting SQLSTATE '%s' got '%s'\n", + $offset, $error_info['execute']['sqlstate'], $tmp[0]); + return false; + } + + if (isset($error_info['execute']['mysql']) && + ($error_info['execute']['mysql'] !== $tmp[1])) { + printf("[%03d] execute() - expecting MySQL Code '%s' got '%s'\n", + $offset, $error_info['execute']['mysql'], $tmp[0]); + return false; + } + + return false; + } + + } catch (PDOException $e) { + printf("[%03d] %s, [%s} %s\n", + $offset, $e->getMessage(), + $db->errorCode(), implode(' ', $db->errorInfo())); + return false; + } + + return $stmt; + } + + try { + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to switch to emulated prepared statements, test will fail\n"); + + // TODO - that's PDO - you can prepare empty statements! + prepex(3, $db, '', + array(), array('execute' => array('sqlstate' => '42000'))); + + // lets be fair and do the most simple SELECT first + $stmt = prepex(4, $db, 'SELECT 1 as "one"'); + var_dump($stmt->fetch(PDO::FETCH_ASSOC)); + + prepex(5, $db, 'DROP TABLE IF EXISTS test'); + prepex(6, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); + prepex(7, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')"); + $stmt = prepex(8, $db, 'SELECT label FROM test'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + prepex(9, $db, 'DELETE FROM test'); + prepex(10, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')", + array(':placeholder' => 'first row')); + $stmt = prepex(11, $db, 'SELECT label FROM test'); + + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + prepex(12, $db, 'DELETE FROM test'); + prepex(13, $db, 'INSERT INTO test(id, label) VALUES(1, :placeholder)', + array(':placeholder' => 'first row')); + prepex(14, $db, 'INSERT INTO test(id, label) VALUES(2, :placeholder)', + array(':placeholder' => 'second row')); + $stmt = prepex(15, $db, 'SELECT label FROM test'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + // Is PDO fun? + prepex(16, $db, 'SELECT label FROM test WHERE :placeholder > 1', + array(':placeholder' => 'id')); + prepex(17, $db, 'SELECT :placeholder FROM test WHERE id > 1', + array(':placeholder' => 'id')); + prepex(18, $db, 'SELECT :placeholder FROM test WHERE :placeholder > :placeholder', + array(':placeholder' => 'test')); + + for ($num_params = 2; $num_params < 100; $num_params++) { + $params = array(':placeholder' => 'a'); + for ($i = 1; $i < $num_params; $i++) { + $params[str_repeat('a', $i)] = 'some data'; + } + prepex(19, $db, 'SELECT id, label FROM test WHERE label > :placeholder', + $params, array('execute' => array('sqlstate' => 'HY093'))); + } + + prepex(20, $db, 'DELETE FROM test'); + prepex(21, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder), (2, :placeholder)', + array(':placeholder' => 'row')); + $stmt = prepex(22, $db, 'SELECT id, label FROM test'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + $stmt = prepex(23, $db, 'SELECT id, label FROM test WHERE :placeholder IS NOT NULL', + array(':placeholder' => 1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) + printf("[024] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp); + + $stmt = prepex(25, $db, 'SELECT id, label FROM test WHERE :placeholder IS NULL', + array(':placeholder' => 1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) + printf("[026] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp); + + prepex(27, $db, 'DROP TABLE IF EXISTS test'); + prepex(28, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM'); + if (is_object(prepex(29, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)'))) { + prepex(30, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder)', + array(':placeholder' => 'MySQL is the best database in the world!')); + prepex(31, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder)', + array(':placeholder' => 'If I have the freedom to choose, I would always go again for the MySQL Server')); + $stmt = prepex(32, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)', + array(':placeholder' => 'mysql')); + /* + Lets ignore this + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) + printf("[033] Expecting two rows, got %d rows\n", $tmp); + */ + } + prepex(34, $db, 'DELETE FROM test'); + prepex(35, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder), (2, :placeholder)', + array(':placeholder' => 'row')); /* - $stmt = prepex(36, $db, 'SELECT id, label FROM "test WHERE MATCH label AGAINST (:placeholder)', - array(':placeholder' => 'row'), - array('execute' => array('sqlstate' => '42000', 'mysql' => 1064))); + $stmt = prepex(36, $db, 'SELECT id, label FROM "test WHERE MATCH label AGAINST (:placeholder)', + array(':placeholder' => 'row'), + array('execute' => array('sqlstate' => '42000', 'mysql' => 1064))); */ - $stmt = prepex(37, $db, 'SELECT id, label FROM \'test WHERE MATCH label AGAINST (:placeholder)', - array(':placeholder' => 'row'), - array('execute' => array('sqlstate' => '42000', 'mysql' => 1064))); - - $stmt = prepex(38, $db, 'SELECT id, label AS "label" FROM test WHERE label = :placeholder', - array(':placeholder' => 'row')); - - $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = :placeholder)", - $db->quote('%ro%')); - $stmt = prepex(39, $db, $sql, array('placeholder' => -1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) - printf("[040] Expecting zero rows, got %d rows\n", $tmp); - - - $sql = sprintf("SELECT id, label FROM test WHERE (id = :placeholder) OR (label LIKE %s)", - $db->quote('%ro%')); - $stmt = prepex(41, $db, $sql, array('placeholder' => 1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) - printf("[042] Expecting two rows, got %d rows\n", $tmp); - - $sql = "SELECT id, label FROM test WHERE id = :placeholder AND label = (SELECT label AS 'SELECT' FROM test WHERE id = :placeholder)"; - $stmt = prepex(43, $db, $sql, array('placeholder' => 1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1) - printf("[044] Expecting onw row, got %d rows\n", $tmp); - - // and now, the same with anonymous placeholders... - prepex(45, $db, 'DROP TABLE IF EXISTS test'); - prepex(46, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); - prepex(47, $db, "INSERT INTO test(id, label) VALUES(1, '?')"); - $stmt = prepex(48, $db, 'SELECT label FROM test'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - prepex(49, $db, 'DELETE FROM test'); - prepex(50, $db, "INSERT INTO test(id, label) VALUES(1, '?')", - array('first row')); - $stmt = prepex(51, $db, 'SELECT label FROM test'); - - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - prepex(52, $db, 'DELETE FROM test'); - prepex(53, $db, 'INSERT INTO test(id, label) VALUES(1, ?)', - array('first row')); - prepex(54, $db, 'INSERT INTO test(id, label) VALUES(2, ?)', - array('second row')); - $stmt = prepex(55, $db, 'SELECT label FROM test'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - // Is PDO fun? - prepex(56, $db, 'SELECT label FROM test WHERE ? > 1', - array('id')); - prepex(57, $db, 'SELECT ? FROM test WHERE id > 1', - array('id')); - prepex(58, $db, 'SELECT ? FROM test WHERE ? > ?', - array('test'), array('execute' => array('sqlstate' => 'HY093'))); - - prepex(59, $db, 'SELECT ? FROM test WHERE ? > ?', - array('id', 'label', 'value')); - - for ($num_params = 2; $num_params < 100; $num_params++) { - $params = array('a'); - for ($i = 1; $i < $num_params; $i++) { - $params[] = 'some data'; - } - prepex(60, $db, 'SELECT id, label FROM test WHERE label > ?', - $params, array('execute' => array('sqlstate' => 'HY093'))); - } - - prepex(61, $db, 'DELETE FROM test'); - prepex(62, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)', - array('row', 'row')); - $stmt = prepex(63, $db, 'SELECT id, label FROM test'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - $stmt = prepex(64, $db, 'SELECT id, label FROM test WHERE ? IS NOT NULL', - array(1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) - printf("[065] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp); - - $stmt = prepex(66, $db, 'SELECT id, label FROM test WHERE ? IS NULL', - array(1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) - printf("[067] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp); - - prepex(68, $db, 'DROP TABLE IF EXISTS test'); - prepex(69, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM'); - if (is_object(prepex(70, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)'))) { - prepex(71, $db, 'INSERT INTO test(id, label) VALUES (1, ?)', - array('MySQL is the best database in the world!')); - prepex(72, $db, 'INSERT INTO test(id, label) VALUES (1, ?)', - array('If I have the freedom to choose, I would always go again for the MySQL Server')); - $stmt = prepex(73, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (?)', - array('mysql')); - /* - Lets ignore that - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) - printf("[074] Expecting two rows, got %d rows\n", $tmp); - */ - } - - prepex(74, $db, 'DELETE FROM test'); - prepex(75, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)', - array('row', 'row')); - - $stmt = prepex(76, $db, 'SELECT id, label FROM "test WHERE MATCH label AGAINST (?)', - array('row'), - array('execute' => array('sqlstate' => '42000', 'mysql' => 1064))); - - /* - TODO enable after fix - $stmt = prepex(37, $db, 'SELECT id, label FROM \'test WHERE MATCH label AGAINST (:placeholder)', - array(':placeholder' => 'row'), - array('execute' => array('sqlstate' => '42000', 'mysql' => 1064))); - */ - - $stmt = prepex(78, $db, 'SELECT id, label AS "label" FROM test WHERE label = ?', - array('row')); - - $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = ?)", - $db->quote('%ro%')); - $stmt = prepex(79, $db, $sql, array(-1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) - printf("[080] Expecting zero rows, got %d rows\n", $tmp); - - - $sql = sprintf("SELECT id, label FROM test WHERE (id = ?) OR (label LIKE %s)", - $db->quote('%ro%')); - $stmt = prepex(81, $db, $sql, array(1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) - printf("[082] Expecting two rows, got %d rows\n", $tmp); - - $sql = "SELECT id, label FROM test WHERE id = ? AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)"; - $stmt = prepex(83, $db, $sql, array(1, 1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1) - printf("[084] Expecting one row, got %d rows\n", $tmp); - - $sql = "SELECT id, label FROM test WHERE id = :placeholder AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)"; - $stmt = prepex(85, $db, $sql, array(1, 1), array('execute' => array('sqlstate' => 'HY093'))); - if (is_object($stmt) && count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) - printf("[086] Expecting no rows, got %d rows\n", $tmp); - - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - - print "done!"; + $stmt = prepex(37, $db, 'SELECT id, label FROM \'test WHERE MATCH label AGAINST (:placeholder)', + array(':placeholder' => 'row'), + array('execute' => array('sqlstate' => '42000', 'mysql' => 1064))); + + $stmt = prepex(38, $db, 'SELECT id, label AS "label" FROM test WHERE label = :placeholder', + array(':placeholder' => 'row')); + + $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = :placeholder)", + $db->quote('%ro%')); + $stmt = prepex(39, $db, $sql, array('placeholder' => -1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) + printf("[040] Expecting zero rows, got %d rows\n", $tmp); + + + $sql = sprintf("SELECT id, label FROM test WHERE (id = :placeholder) OR (label LIKE %s)", + $db->quote('%ro%')); + $stmt = prepex(41, $db, $sql, array('placeholder' => 1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) + printf("[042] Expecting two rows, got %d rows\n", $tmp); + + $sql = "SELECT id, label FROM test WHERE id = :placeholder AND label = (SELECT label AS 'SELECT' FROM test WHERE id = :placeholder)"; + $stmt = prepex(43, $db, $sql, array('placeholder' => 1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1) + printf("[044] Expecting onw row, got %d rows\n", $tmp); + + // and now, the same with anonymous placeholders... + prepex(45, $db, 'DROP TABLE IF EXISTS test'); + prepex(46, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); + prepex(47, $db, "INSERT INTO test(id, label) VALUES(1, '?')"); + $stmt = prepex(48, $db, 'SELECT label FROM test'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + prepex(49, $db, 'DELETE FROM test'); + prepex(50, $db, "INSERT INTO test(id, label) VALUES(1, '?')", + array('first row')); + $stmt = prepex(51, $db, 'SELECT label FROM test'); + + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + prepex(52, $db, 'DELETE FROM test'); + prepex(53, $db, 'INSERT INTO test(id, label) VALUES(1, ?)', + array('first row')); + prepex(54, $db, 'INSERT INTO test(id, label) VALUES(2, ?)', + array('second row')); + $stmt = prepex(55, $db, 'SELECT label FROM test'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + // Is PDO fun? + prepex(56, $db, 'SELECT label FROM test WHERE ? > 1', + array('id')); + prepex(57, $db, 'SELECT ? FROM test WHERE id > 1', + array('id')); + prepex(58, $db, 'SELECT ? FROM test WHERE ? > ?', + array('test'), array('execute' => array('sqlstate' => 'HY093'))); + + prepex(59, $db, 'SELECT ? FROM test WHERE ? > ?', + array('id', 'label', 'value')); + + for ($num_params = 2; $num_params < 100; $num_params++) { + $params = array('a'); + for ($i = 1; $i < $num_params; $i++) { + $params[] = 'some data'; + } + prepex(60, $db, 'SELECT id, label FROM test WHERE label > ?', + $params, array('execute' => array('sqlstate' => 'HY093'))); + } + + prepex(61, $db, 'DELETE FROM test'); + prepex(62, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)', + array('row', 'row')); + $stmt = prepex(63, $db, 'SELECT id, label FROM test'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + $stmt = prepex(64, $db, 'SELECT id, label FROM test WHERE ? IS NOT NULL', + array(1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) + printf("[065] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp); + + $stmt = prepex(66, $db, 'SELECT id, label FROM test WHERE ? IS NULL', + array(1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) + printf("[067] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp); + + prepex(68, $db, 'DROP TABLE IF EXISTS test'); + prepex(69, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM'); + if (is_object(prepex(70, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)'))) { + prepex(71, $db, 'INSERT INTO test(id, label) VALUES (1, ?)', + array('MySQL is the best database in the world!')); + prepex(72, $db, 'INSERT INTO test(id, label) VALUES (1, ?)', + array('If I have the freedom to choose, I would always go again for the MySQL Server')); + $stmt = prepex(73, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (?)', + array('mysql')); + /* + Lets ignore that + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) + printf("[074] Expecting two rows, got %d rows\n", $tmp); + */ + } + + prepex(74, $db, 'DELETE FROM test'); + prepex(75, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)', + array('row', 'row')); + + $stmt = prepex(76, $db, 'SELECT id, label FROM "test WHERE MATCH label AGAINST (?)', + array('row'), + array('execute' => array('sqlstate' => '42000', 'mysql' => 1064))); + + /* + TODO enable after fix + $stmt = prepex(37, $db, 'SELECT id, label FROM \'test WHERE MATCH label AGAINST (:placeholder)', + array(':placeholder' => 'row'), + array('execute' => array('sqlstate' => '42000', 'mysql' => 1064))); + */ + + $stmt = prepex(78, $db, 'SELECT id, label AS "label" FROM test WHERE label = ?', + array('row')); + + $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = ?)", + $db->quote('%ro%')); + $stmt = prepex(79, $db, $sql, array(-1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) + printf("[080] Expecting zero rows, got %d rows\n", $tmp); + + + $sql = sprintf("SELECT id, label FROM test WHERE (id = ?) OR (label LIKE %s)", + $db->quote('%ro%')); + $stmt = prepex(81, $db, $sql, array(1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) + printf("[082] Expecting two rows, got %d rows\n", $tmp); + + $sql = "SELECT id, label FROM test WHERE id = ? AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)"; + $stmt = prepex(83, $db, $sql, array(1, 1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1) + printf("[084] Expecting one row, got %d rows\n", $tmp); + + $sql = "SELECT id, label FROM test WHERE id = :placeholder AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)"; + $stmt = prepex(85, $db, $sql, array(1, 1), array('execute' => array('sqlstate' => 'HY093'))); + if (is_object($stmt) && count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) + printf("[086] Expecting no rows, got %d rows\n", $tmp); + + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt index e8b5cb39ae..abd2615ce8 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt @@ -9,54 +9,54 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to switch to emulated prepared statements, test will fail\n"); + try { + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to switch to emulated prepared statements, test will fail\n"); - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); - $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(1, '?')"); - // you can bind as many values as you want no matter if they can be replaced or not - $stmt->execute(array('first row')); - if ('00000' !== $stmt->errorCode()) - printf("[003] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); + $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(1, '?')"); + // you can bind as many values as you want no matter if they can be replaced or not + $stmt->execute(array('first row')); + if ('00000' !== $stmt->errorCode()) + printf("[003] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); - $stmt = $db->prepare('SELECT id, label FROM test'); - $stmt->execute(); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->prepare('SELECT id, label FROM test'); + $stmt->execute(); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - // now the same with native PS - printf("now the same with native PS\n"); - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[004] Unable to switch off emulated prepared statements, test will fail\n"); + // now the same with native PS + printf("now the same with native PS\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[004] Unable to switch off emulated prepared statements, test will fail\n"); - $db->exec('DELETE FROM test'); - $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(1, '?')"); - // you can bind as many values as you want no matter if they can be replaced or not - $stmt->execute(array('first row')); - if ('00000' !== $stmt->errorCode()) - printf("[005] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); + $db->exec('DELETE FROM test'); + $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(1, '?')"); + // you can bind as many values as you want no matter if they can be replaced or not + $stmt->execute(array('first row')); + if ('00000' !== $stmt->errorCode()) + printf("[005] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); - $stmt = $db->prepare('SELECT id, label FROM test'); - $stmt->execute(); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->prepare('SELECT id, label FROM test'); + $stmt->execute(); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt index 5ad3c85641..e47b03b999 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt @@ -9,50 +9,50 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - try { - // native PS - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to switch off emulated prepared statements, test will fail\n"); + try { + // native PS + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to switch off emulated prepared statements, test will fail\n"); - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); - $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')"); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); + $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')"); - // So, what will happen? More placeholder but values and - // placeholders in interesting places... - $stmt = $db->prepare('SELECT ? FROM test WHERE ? > ?'); - $stmt->execute(array('test')); - if ('00000' !== $stmt->errorCode()) { - printf("[003] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); - } - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + // So, what will happen? More placeholder but values and + // placeholders in interesting places... + $stmt = $db->prepare('SELECT ? FROM test WHERE ? > ?'); + $stmt->execute(array('test')); + if ('00000' !== $stmt->errorCode()) { + printf("[003] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); + } + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - // now the same with emulated PS - printf("now the same with emulated PS\n"); - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[004] Unable to switch on emulated prepared statements, test will fail\n"); + // now the same with emulated PS + printf("now the same with emulated PS\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[004] Unable to switch on emulated prepared statements, test will fail\n"); - $stmt = $db->prepare('SELECT ? FROM test WHERE ? > ?'); - $stmt->execute(array('test')); - if ('00000' !== $stmt->errorCode()) - printf("[005] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->prepare('SELECT ? FROM test WHERE ? > ?'); + $stmt->execute(array('test')); + if ('00000' !== $stmt->errorCode()) + printf("[005] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt index 0e7dc4b3ab..c76a7460c9 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt @@ -30,89 +30,89 @@ if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) { ?> --FILE-- <?php - function exec_and_count($offset, &$db, $sql, $exp) { - - try { - - $ret = $db->exec($sql); - if ($ret !== $exp) { - printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n", - $offset, $exp, gettype($exp), $ret, gettype($ret), $sql, - $db->errorCode(), implode(' ', $db->errorInfo())); - return false; - } - - } catch (PDOException $e) { - - if (42000 == $db->errorCode()) { - // Error: 1148 SQLSTATE: 42000 (ER_NOT_ALLOWED_COMMAND) - // Load data infile not allowed - return false; - } - - printf("[%03d] '%s' has failed, [%s] %s\n", - $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo())); - return false; - } - - return true; - } - - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - // Run with native PS. - // The test is about checking the fallback to emulation - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); - - /* affected rows related */ - try { - - exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0); - exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0); - - $stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'"); - if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) { - $filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv"; - } else { - $filename = MySQLPDOTest::getTempDir() . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv"; - } - - $fp = fopen($filename, "w"); - fwrite($fp, "1;foo\n"); - fwrite($fp, "2;bar"); - fclose($fp); - - // This should fail, the PS protocol should not support it. - // mysqlnd will give 2014 as a follow-up of the fallback logic - // libmysql will give a little more precise 2030 error code - // However, you get an error and the big question is what happens to the line - $stmt = $db->prepare(sprintf("LOAD DATA INFILE %s INTO TABLE test FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n'", $db->quote($filename))); - if (!$stmt->execute()) { - printf("[004] [%d] %s\n", $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - } - - // Check the line - $stmt = $db->query("SELECT 1 as 'one'"); - if ($stmt->errorCode() != '0000') { - printf("[005] [%d] %s\n", $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - } else { - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - if (!isset($rows[0]['one']) || $rows[0]['one'] != 1) - printf("[006] [%d] %s\n", $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - } - - unlink($filename); - - } catch (PDOException $e) { - printf("[001] %s, [%s] %s (%s)\n", - $e->getMessage(), - $db->errorCode(), - implode(' ', $db->errorInfo()), - (isset($stmt)) ? implode(' ', $stmt->errorInfo()) : 'N/A'); - } - - print "done!"; + function exec_and_count($offset, &$db, $sql, $exp) { + + try { + + $ret = $db->exec($sql); + if ($ret !== $exp) { + printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n", + $offset, $exp, gettype($exp), $ret, gettype($ret), $sql, + $db->errorCode(), implode(' ', $db->errorInfo())); + return false; + } + + } catch (PDOException $e) { + + if (42000 == $db->errorCode()) { + // Error: 1148 SQLSTATE: 42000 (ER_NOT_ALLOWED_COMMAND) + // Load data infile not allowed + return false; + } + + printf("[%03d] '%s' has failed, [%s] %s\n", + $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo())); + return false; + } + + return true; + } + + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + // Run with native PS. + // The test is about checking the fallback to emulation + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); + + /* affected rows related */ + try { + + exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0); + exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0); + + $stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'"); + if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) { + $filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv"; + } else { + $filename = MySQLPDOTest::getTempDir() . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv"; + } + + $fp = fopen($filename, "w"); + fwrite($fp, "1;foo\n"); + fwrite($fp, "2;bar"); + fclose($fp); + + // This should fail, the PS protocol should not support it. + // mysqlnd will give 2014 as a follow-up of the fallback logic + // libmysql will give a little more precise 2030 error code + // However, you get an error and the big question is what happens to the line + $stmt = $db->prepare(sprintf("LOAD DATA INFILE %s INTO TABLE test FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n'", $db->quote($filename))); + if (!$stmt->execute()) { + printf("[004] [%d] %s\n", $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + } + + // Check the line + $stmt = $db->query("SELECT 1 as 'one'"); + if ($stmt->errorCode() != '0000') { + printf("[005] [%d] %s\n", $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + } else { + $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); + if (!isset($rows[0]['one']) || $rows[0]['one'] != 1) + printf("[006] [%d] %s\n", $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + } + + unlink($filename); + + } catch (PDOException $e) { + printf("[001] %s, [%s] %s (%s)\n", + $e->getMessage(), + $db->errorCode(), + implode(' ', $db->errorInfo()), + (isset($stmt)) ? implode(' ', $stmt->errorInfo()) : 'N/A'); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_match_against.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_match_against.phpt index f77c420d67..9c5b953a52 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_match_against.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_match_against.phpt @@ -8,35 +8,35 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - try { + try { - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM'); - $db->exec('CREATE FULLTEXT INDEX idx1 ON test(label)'); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM'); + $db->exec('CREATE FULLTEXT INDEX idx1 ON test(label)'); - $stmt = $db->prepare('SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)'); - $stmt->execute(array(':placeholder' => 'row')); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->prepare('SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)'); + $stmt->execute(array(':placeholder' => 'row')); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $stmt = $db->prepare('SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)'); - $stmt->execute(array('placeholder' => 'row')); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->prepare('SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)'); + $stmt->execute(array('placeholder' => 'row')); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $stmt = $db->prepare('SELECT id, label FROM test WHERE MATCH label AGAINST (?)'); - $stmt->execute(array('row')); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->prepare('SELECT id, label FROM test WHERE MATCH label AGAINST (?)'); + $stmt->execute(array('row')); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - } catch (PDOException $e) { + } catch (PDOException $e) { - printf("[001] %s, [%s} %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + printf("[001] %s, [%s} %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt index efd472edc6..5ea3e94c1e 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt @@ -9,331 +9,331 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - function prepex($offset, &$db, $query, $input_params = null, $error_info = null, $suppress_warning = false) { + function prepex($offset, &$db, $query, $input_params = null, $error_info = null, $suppress_warning = false) { - try { + try { - if ($suppress_warning || (is_array($error_info) && isset($error_info['prepare']))) - $stmt = @$db->prepare($query); - else - $stmt = $db->prepare($query); + if ($suppress_warning || (is_array($error_info) && isset($error_info['prepare']))) + $stmt = @$db->prepare($query); + else + $stmt = $db->prepare($query); - if (is_array($error_info) && isset($error_info['prepare'])) { - $tmp = $db->errorInfo(); + if (is_array($error_info) && isset($error_info['prepare'])) { + $tmp = $db->errorInfo(); - if (isset($error_info['prepare']['sqlstate']) && - ($error_info['prepare']['sqlstate'] !== $tmp[0])) { - printf("[%03d] prepare() - expecting SQLSTATE '%s' got '%s'\n", - $offset, $error_info['prepare']['sqlstate'], $tmp[0]); - return false; - } + if (isset($error_info['prepare']['sqlstate']) && + ($error_info['prepare']['sqlstate'] !== $tmp[0])) { + printf("[%03d] prepare() - expecting SQLSTATE '%s' got '%s'\n", + $offset, $error_info['prepare']['sqlstate'], $tmp[0]); + return false; + } - if (isset($error_info['prepare']['mysql']) && - ($error_info['prepare']['mysql'] !== $tmp[1])) { - printf("[%03d] prepare() - expecting MySQL Code '%s' got '%s'\n", - $offset, $error_info['prepare']['mysql'], $tmp[0]); - return false; - } + if (isset($error_info['prepare']['mysql']) && + ($error_info['prepare']['mysql'] !== $tmp[1])) { + printf("[%03d] prepare() - expecting MySQL Code '%s' got '%s'\n", + $offset, $error_info['prepare']['mysql'], $tmp[0]); + return false; + } - return false; - } + return false; + } - if (!is_object($stmt)) - return false; + if (!is_object($stmt)) + return false; - if (is_null($input_params)) - $input_params = array(); + if (is_null($input_params)) + $input_params = array(); // 5.0.18, 5.1.14 @ 15 // printf("[%03d]\n", $offset); - if ($suppress_warning || (is_array($error_info) && isset($error_info['execute']))) - $ret = @$stmt->execute($input_params); - else - $ret = $stmt->execute($input_params); - - if (!is_bool($ret)) - printf("[%03d] PDO::execute() should return a boolean value, got %s/%s\n", - var_export($ret, true), $ret); - - $tmp = $stmt->errorInfo(); - if (isset($tmp[1]) && ($tmp[1] == 2030)) { - // Trying to hack around MySQL Server version dependent features - // 2030 This command is not supported in the prepared statement protocol yet - return false; - } - - if (is_array($error_info) && isset($error_info['execute'])) { - - if (isset($error_info['execute']['sqlstate']) && - ($error_info['execute']['sqlstate'] !== $tmp[0])) { - printf("[%03d] execute() - expecting SQLSTATE '%s' got '%s'\n", - $offset, $error_info['execute']['sqlstate'], $tmp[0]); - return false; - } - - if (isset($error_info['execute']['mysql']) && - ($error_info['execute']['mysql'] !== $tmp[1])) { - printf("[%03d] execute() - expecting MySQL Code '%s' got '%s'\n", - $offset, $error_info['execute']['mysql'], $tmp[0]); - return false; - } - - return false; - - } - - } catch (PDOException $e) { - printf("[%03d] %s, [%s} %s\n", - $offset, $e->getMessage(), - $db->errorCode(), implode(' ', $db->errorInfo())); - return false; - } - - return $stmt; - } - - try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn off emulated prepared statements\n"); - - // TODO - that's PDO - you can prepare empty statements! - prepex(3, $db, '', - array(), array('prepare' => array('sqlstate' => '42000'))); - - // lets be fair and do the most simple SELECT first - $stmt = prepex(4, $db, 'SELECT 1 as "one"'); - if (MySQLPDOTest::isPDOMySQLnd()) - // native types - int - $expected = array('one' => 1); - else - // always strings, like STRINGIFY flag - $expected = array('one' => '1'); - - $row = $stmt->fetch(PDO::FETCH_ASSOC); - if ($row !== $expected) { - printf("[004a] Expecting %s got %s\n", var_export($expected, true), var_export($row, true)); - } - - prepex(5, $db, 'DROP TABLE IF EXISTS test'); - prepex(6, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); - prepex(7, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')"); - $stmt = prepex(8, $db, 'SELECT label FROM test ORDER BY id ASC'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - prepex(9, $db, 'DELETE FROM test'); - prepex(10, $db, 'INSERT INTO test(id, label) VALUES(1, :placeholder)', - array(':placeholder' => 'first row')); - prepex(11, $db, 'INSERT INTO test(id, label) VALUES(2, :placeholder)', - array(':placeholder' => 'second row')); - $stmt = prepex(12, $db, 'SELECT label FROM test ORDER BY id ASC'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - // Is PDO fun? - $stmt = prepex(13, $db, 'SELECT label FROM test WHERE :placeholder > 1', - array(':placeholder' => 'id')); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - for ($num_params = 2; $num_params < 100; $num_params++) { - $params = array(':placeholder' => 'a'); - for ($i = 1; $i < $num_params; $i++) { - $params[str_repeat('a', $i)] = 'some data'; - } - prepex(16, $db, 'SELECT id, label FROM test WHERE label > :placeholder', - $params, array('execute' => array('sqlstate' => 'HY093'))); - } - - $stmt = prepex(16, $db, 'SELECT id, label FROM test WHERE :placeholder IS NOT NULL', - array(':placeholder' => 1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) - printf("[017] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp); - - $stmt = prepex(18, $db, 'SELECT id, label FROM test WHERE :placeholder IS NULL', - array(':placeholder' => 1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) - printf("[019] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp); - - prepex(20, $db, 'DROP TABLE IF EXISTS test'); - prepex(21, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM'); - // Not every MySQL Server version supports this - if (is_object(prepex(22, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)', null, null, true))) { - prepex(23, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder)', - array(':placeholder' => 'MySQL is the best database in the world!')); - prepex(24, $db, 'INSERT INTO test(id, label) VALUES (2, :placeholder)', - array(':placeholder' => 'If I have the freedom to choose, I would always go again for the MySQL Server')); - $stmt = prepex(25, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)', - array(':placeholder' => 'mysql'), null, true); - if (is_object($stmt)) { - /* - Lets ignore this - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) - printf("[033] Expecting two rows, got %d rows\n", $tmp); - */ - $stmt = prepex(26, $db, 'SELECT id, label FROM test ORDER BY id ASC'); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) - printf("[027] Expecting two rows, got %d rows\n", $tmp); - - if ($tmp[0]['label'] !== 'MySQL is the best database in the world!') { - printf("[028] INSERT seems to have failed, dumping data, check manually\n"); - var_dump($tmp); - } - } - } - - $db->exec('DELETE FROM test'); - $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')"); - $db->exec("INSERT INTO test(id, label) VALUES (2, 'row2')"); - - $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = :placeholder)", - $db->quote('%ro%')); - $stmt = prepex(29, $db, $sql, array('placeholder' => -1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) - printf("[030] Expecting zero rows, got %d rows\n", $tmp); - - $sql = sprintf("SELECT id, label FROM test WHERE (id = :placeholder) OR (label LIKE %s)", - $db->quote('%go%')); - $stmt = prepex(31, $db, $sql, array('placeholder' => 1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1) - printf("[032] Expecting one row, got %d rows\n", $tmp); - - // and now, the same with anonymous placeholders... - prepex(33, $db, 'DROP TABLE IF EXISTS test'); - prepex(34, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); - prepex(35, $db, "INSERT INTO test(id, label) VALUES(1, '?')"); - $stmt = prepex(36, $db, 'SELECT label FROM test'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - prepex(37, $db, 'DELETE FROM test'); - prepex(38, $db, 'INSERT INTO test(id, label) VALUES(1, ?)', - array('first row')); - prepex(39, $db, 'INSERT INTO test(id, label) VALUES(2, ?)', - array('second row')); - $stmt = prepex(40, $db, 'SELECT label FROM test'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - // Is PDO fun? - prepex(40, $db, 'SELECT label FROM test WHERE ? > 1', - array('id')); - prepex(41, $db, 'SELECT ? FROM test WHERE id > 1', - array('id')); - prepex(42, $db, 'SELECT ? FROM test WHERE ? > ?', - array('id', 'label', 'value')); - - for ($num_params = 2; $num_params < 100; $num_params++) { - $params = array('a'); - for ($i = 1; $i < $num_params; $i++) { - $params[] = 'some data'; - } - prepex(43, $db, 'SELECT id, label FROM test WHERE label > ?', - $params, array('execute' => array('sqlstate' => 'HY093'))); - } - - prepex(44, $db, 'DELETE FROM test'); - prepex(45, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)', - array('row', 'row')); - $stmt = prepex(46, $db, 'SELECT id, label FROM test ORDER BY id'); - $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); - $exp = array( - 0 => array( - "id" => "1", - "label" => "row" - ), - 1 => array( - "id" => "2", - "label" => "row" - ), - ); - - if (MySQLPDOTest::isPDOMySQLnd()) { - // mysqlnd returns native types - $exp[0]['id'] = 1; - $exp[1]['id'] = 2; - } - if ($tmp !== $exp) { - printf("[064] Results seem wrong. Please check dumps manually.\n"); - var_dump($exp); - var_dump($tmp); - } - - $stmt = prepex(47, $db, 'SELECT id, label FROM test WHERE ? IS NOT NULL', - array(1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) - printf("[048] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp); - - $stmt = prepex(49, $db, 'SELECT id, label FROM test WHERE ? IS NULL', - array(1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) - printf("[050] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp); - - prepex(51, $db, 'DROP TABLE IF EXISTS test'); - prepex(52, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM'); - if (is_object(prepex(53, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)', null, null, true))) { - prepex(54, $db, 'INSERT INTO test(id, label) VALUES (1, ?)', - array('MySQL is the best database in the world!')); - prepex(55, $db, 'INSERT INTO test(id, label) VALUES (1, ?)', - array('If I have the freedom to choose, I would always go again for the MySQL Server')); - $stmt = prepex(56, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (?)', - array('mysql'), null, true); - /* - Lets ignore that - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) - printf("[074] Expecting two rows, got %d rows\n", $tmp); - */ - } - - prepex(57, $db, 'DELETE FROM test'); - prepex(58, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)', - array('row1', 'row2')); - - /* - TODO enable after fix - $stmt = prepex(37, $db, 'SELECT id, label FROM \'test WHERE MATCH label AGAINST (:placeholder)', - array(':placeholder' => 'row'), - array('execute' => array('sqlstate' => '42000', 'mysql' => 1064))); - */ - - $stmt = prepex(59, $db, 'SELECT id, label AS "label" FROM test WHERE label = ?', - array('row1')); - $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); - $exp = array( - 0 => array("id" => "1", "label" => "row1") - ); - - if (MySQLPDOTest::isPDOMySQLnd()) { - // mysqlnd returns native types - $exp[0]['id'] = 1; - } - if ($tmp !== $exp) { - printf("[065] Results seem wrong. Please check dumps manually.\n"); - var_dump($exp); - var_dump($tmp); - } - - $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = ?)", - $db->quote('%ro%')); - $stmt = prepex(60, $db, $sql, array(-1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) - printf("[061] Expecting zero rows, got %d rows\n", $tmp); - - $sql = sprintf("SELECT id, label FROM test WHERE (id = ?) OR (label LIKE %s)", - $db->quote('%ro%')); - $stmt = prepex(61, $db, $sql, array(1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) - printf("[062] Expecting two rows, got %d rows\n", $tmp); - - $sql = "SELECT id, label FROM test WHERE id = ? AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)"; - $stmt = prepex(63, $db, $sql, array(1, 1)); - if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1) - printf("[064] Expecting one row, got %d rows\n", $tmp); - - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - - print "done!"; + if ($suppress_warning || (is_array($error_info) && isset($error_info['execute']))) + $ret = @$stmt->execute($input_params); + else + $ret = $stmt->execute($input_params); + + if (!is_bool($ret)) + printf("[%03d] PDO::execute() should return a boolean value, got %s/%s\n", + var_export($ret, true), $ret); + + $tmp = $stmt->errorInfo(); + if (isset($tmp[1]) && ($tmp[1] == 2030)) { + // Trying to hack around MySQL Server version dependent features + // 2030 This command is not supported in the prepared statement protocol yet + return false; + } + + if (is_array($error_info) && isset($error_info['execute'])) { + + if (isset($error_info['execute']['sqlstate']) && + ($error_info['execute']['sqlstate'] !== $tmp[0])) { + printf("[%03d] execute() - expecting SQLSTATE '%s' got '%s'\n", + $offset, $error_info['execute']['sqlstate'], $tmp[0]); + return false; + } + + if (isset($error_info['execute']['mysql']) && + ($error_info['execute']['mysql'] !== $tmp[1])) { + printf("[%03d] execute() - expecting MySQL Code '%s' got '%s'\n", + $offset, $error_info['execute']['mysql'], $tmp[0]); + return false; + } + + return false; + + } + + } catch (PDOException $e) { + printf("[%03d] %s, [%s} %s\n", + $offset, $e->getMessage(), + $db->errorCode(), implode(' ', $db->errorInfo())); + return false; + } + + return $stmt; + } + + try { + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn off emulated prepared statements\n"); + + // TODO - that's PDO - you can prepare empty statements! + prepex(3, $db, '', + array(), array('prepare' => array('sqlstate' => '42000'))); + + // lets be fair and do the most simple SELECT first + $stmt = prepex(4, $db, 'SELECT 1 as "one"'); + if (MySQLPDOTest::isPDOMySQLnd()) + // native types - int + $expected = array('one' => 1); + else + // always strings, like STRINGIFY flag + $expected = array('one' => '1'); + + $row = $stmt->fetch(PDO::FETCH_ASSOC); + if ($row !== $expected) { + printf("[004a] Expecting %s got %s\n", var_export($expected, true), var_export($row, true)); + } + + prepex(5, $db, 'DROP TABLE IF EXISTS test'); + prepex(6, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); + prepex(7, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')"); + $stmt = prepex(8, $db, 'SELECT label FROM test ORDER BY id ASC'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + prepex(9, $db, 'DELETE FROM test'); + prepex(10, $db, 'INSERT INTO test(id, label) VALUES(1, :placeholder)', + array(':placeholder' => 'first row')); + prepex(11, $db, 'INSERT INTO test(id, label) VALUES(2, :placeholder)', + array(':placeholder' => 'second row')); + $stmt = prepex(12, $db, 'SELECT label FROM test ORDER BY id ASC'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + // Is PDO fun? + $stmt = prepex(13, $db, 'SELECT label FROM test WHERE :placeholder > 1', + array(':placeholder' => 'id')); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + for ($num_params = 2; $num_params < 100; $num_params++) { + $params = array(':placeholder' => 'a'); + for ($i = 1; $i < $num_params; $i++) { + $params[str_repeat('a', $i)] = 'some data'; + } + prepex(16, $db, 'SELECT id, label FROM test WHERE label > :placeholder', + $params, array('execute' => array('sqlstate' => 'HY093'))); + } + + $stmt = prepex(16, $db, 'SELECT id, label FROM test WHERE :placeholder IS NOT NULL', + array(':placeholder' => 1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) + printf("[017] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp); + + $stmt = prepex(18, $db, 'SELECT id, label FROM test WHERE :placeholder IS NULL', + array(':placeholder' => 1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) + printf("[019] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp); + + prepex(20, $db, 'DROP TABLE IF EXISTS test'); + prepex(21, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM'); + // Not every MySQL Server version supports this + if (is_object(prepex(22, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)', null, null, true))) { + prepex(23, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder)', + array(':placeholder' => 'MySQL is the best database in the world!')); + prepex(24, $db, 'INSERT INTO test(id, label) VALUES (2, :placeholder)', + array(':placeholder' => 'If I have the freedom to choose, I would always go again for the MySQL Server')); + $stmt = prepex(25, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)', + array(':placeholder' => 'mysql'), null, true); + if (is_object($stmt)) { + /* + Lets ignore this + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) + printf("[033] Expecting two rows, got %d rows\n", $tmp); + */ + $stmt = prepex(26, $db, 'SELECT id, label FROM test ORDER BY id ASC'); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) + printf("[027] Expecting two rows, got %d rows\n", $tmp); + + if ($tmp[0]['label'] !== 'MySQL is the best database in the world!') { + printf("[028] INSERT seems to have failed, dumping data, check manually\n"); + var_dump($tmp); + } + } + } + + $db->exec('DELETE FROM test'); + $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')"); + $db->exec("INSERT INTO test(id, label) VALUES (2, 'row2')"); + + $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = :placeholder)", + $db->quote('%ro%')); + $stmt = prepex(29, $db, $sql, array('placeholder' => -1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) + printf("[030] Expecting zero rows, got %d rows\n", $tmp); + + $sql = sprintf("SELECT id, label FROM test WHERE (id = :placeholder) OR (label LIKE %s)", + $db->quote('%go%')); + $stmt = prepex(31, $db, $sql, array('placeholder' => 1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1) + printf("[032] Expecting one row, got %d rows\n", $tmp); + + // and now, the same with anonymous placeholders... + prepex(33, $db, 'DROP TABLE IF EXISTS test'); + prepex(34, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); + prepex(35, $db, "INSERT INTO test(id, label) VALUES(1, '?')"); + $stmt = prepex(36, $db, 'SELECT label FROM test'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + prepex(37, $db, 'DELETE FROM test'); + prepex(38, $db, 'INSERT INTO test(id, label) VALUES(1, ?)', + array('first row')); + prepex(39, $db, 'INSERT INTO test(id, label) VALUES(2, ?)', + array('second row')); + $stmt = prepex(40, $db, 'SELECT label FROM test'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + // Is PDO fun? + prepex(40, $db, 'SELECT label FROM test WHERE ? > 1', + array('id')); + prepex(41, $db, 'SELECT ? FROM test WHERE id > 1', + array('id')); + prepex(42, $db, 'SELECT ? FROM test WHERE ? > ?', + array('id', 'label', 'value')); + + for ($num_params = 2; $num_params < 100; $num_params++) { + $params = array('a'); + for ($i = 1; $i < $num_params; $i++) { + $params[] = 'some data'; + } + prepex(43, $db, 'SELECT id, label FROM test WHERE label > ?', + $params, array('execute' => array('sqlstate' => 'HY093'))); + } + + prepex(44, $db, 'DELETE FROM test'); + prepex(45, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)', + array('row', 'row')); + $stmt = prepex(46, $db, 'SELECT id, label FROM test ORDER BY id'); + $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); + $exp = array( + 0 => array( + "id" => "1", + "label" => "row" + ), + 1 => array( + "id" => "2", + "label" => "row" + ), + ); + + if (MySQLPDOTest::isPDOMySQLnd()) { + // mysqlnd returns native types + $exp[0]['id'] = 1; + $exp[1]['id'] = 2; + } + if ($tmp !== $exp) { + printf("[064] Results seem wrong. Please check dumps manually.\n"); + var_dump($exp); + var_dump($tmp); + } + + $stmt = prepex(47, $db, 'SELECT id, label FROM test WHERE ? IS NOT NULL', + array(1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) + printf("[048] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp); + + $stmt = prepex(49, $db, 'SELECT id, label FROM test WHERE ? IS NULL', + array(1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) + printf("[050] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp); + + prepex(51, $db, 'DROP TABLE IF EXISTS test'); + prepex(52, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM'); + if (is_object(prepex(53, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)', null, null, true))) { + prepex(54, $db, 'INSERT INTO test(id, label) VALUES (1, ?)', + array('MySQL is the best database in the world!')); + prepex(55, $db, 'INSERT INTO test(id, label) VALUES (1, ?)', + array('If I have the freedom to choose, I would always go again for the MySQL Server')); + $stmt = prepex(56, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (?)', + array('mysql'), null, true); + /* + Lets ignore that + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) + printf("[074] Expecting two rows, got %d rows\n", $tmp); + */ + } + + prepex(57, $db, 'DELETE FROM test'); + prepex(58, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)', + array('row1', 'row2')); + + /* + TODO enable after fix + $stmt = prepex(37, $db, 'SELECT id, label FROM \'test WHERE MATCH label AGAINST (:placeholder)', + array(':placeholder' => 'row'), + array('execute' => array('sqlstate' => '42000', 'mysql' => 1064))); + */ + + $stmt = prepex(59, $db, 'SELECT id, label AS "label" FROM test WHERE label = ?', + array('row1')); + $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); + $exp = array( + 0 => array("id" => "1", "label" => "row1") + ); + + if (MySQLPDOTest::isPDOMySQLnd()) { + // mysqlnd returns native types + $exp[0]['id'] = 1; + } + if ($tmp !== $exp) { + printf("[065] Results seem wrong. Please check dumps manually.\n"); + var_dump($exp); + var_dump($tmp); + } + + $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = ?)", + $db->quote('%ro%')); + $stmt = prepex(60, $db, $sql, array(-1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0) + printf("[061] Expecting zero rows, got %d rows\n", $tmp); + + $sql = sprintf("SELECT id, label FROM test WHERE (id = ?) OR (label LIKE %s)", + $db->quote('%ro%')); + $stmt = prepex(61, $db, $sql, array(1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2) + printf("[062] Expecting two rows, got %d rows\n", $tmp); + + $sql = "SELECT id, label FROM test WHERE id = ? AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)"; + $stmt = prepex(63, $db, $sql, array(1, 1)); + if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1) + printf("[064] Expecting one row, got %d rows\n", $tmp); + + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt index 48bd33fda5..88f9f5dcf1 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt @@ -9,64 +9,64 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - try { + try { - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); - // We need to run the emulated version first. Native version will cause a fatal error - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn on emulated prepared statements\n"); + // We need to run the emulated version first. Native version will cause a fatal error + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn on emulated prepared statements\n"); - // INSERT a single row - $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')"); + // INSERT a single row + $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')"); - $stmt = $db->prepare('SELECT unknown_column FROM test WHERE id > :placeholder ORDER BY id ASC'); - $stmt->execute(array(':placeholder' => 0)); - if ('00000' !== $stmt->errorCode()) - printf("[003] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); + $stmt = $db->prepare('SELECT unknown_column FROM test WHERE id > :placeholder ORDER BY id ASC'); + $stmt->execute(array(':placeholder' => 0)); + if ('00000' !== $stmt->errorCode()) + printf("[003] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); - $stmt = $db->prepare('SELECT id, label FROM test WHERE id > :placeholder ORDER BY id ASC'); - $stmt->execute(array(':placeholder' => 0)); - if ('00000' !== $stmt->errorCode()) - printf("[004] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->prepare('SELECT id, label FROM test WHERE id > :placeholder ORDER BY id ASC'); + $stmt->execute(array(':placeholder' => 0)); + if ('00000' !== $stmt->errorCode()) + printf("[004] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - // Native PS - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[005] Unable to turn off emulated prepared statements\n"); + // Native PS + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[005] Unable to turn off emulated prepared statements\n"); - $stmt = $db->prepare('SELECT unknown_column FROM test WHERE id > :placeholder ORDER BY id ASC'); - $stmt->execute(array(':placeholder' => 0)); - if ('00000' !== $stmt->errorCode()) - printf("[006] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); + $stmt = $db->prepare('SELECT unknown_column FROM test WHERE id > :placeholder ORDER BY id ASC'); + $stmt->execute(array(':placeholder' => 0)); + if ('00000' !== $stmt->errorCode()) + printf("[006] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); - $stmt = $db->prepare('SELECT id, label FROM test WHERE id > :placeholder ORDER BY id ASC'); - $stmt->execute(array(':placeholder' => 0)); - if ('00000' !== $stmt->errorCode()) - printf("[007] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->prepare('SELECT id, label FROM test WHERE id > :placeholder ORDER BY id ASC'); + $stmt->execute(array(':placeholder' => 0)); + if ('00000' !== $stmt->errorCode()) + printf("[007] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_column.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_column.phpt index 1ee1c3a43b..4c9dcb0e7e 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_column.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_column.phpt @@ -9,24 +9,24 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn off emulated prepared statements\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn off emulated prepared statements\n"); - $stmt = $db->prepare("SELECT :param FROM test ORDER BY id ASC LIMIT 1"); - $stmt->execute(array(':param' => 'id')); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->prepare("SELECT :param FROM test ORDER BY id ASC LIMIT 1"); + $stmt->execute(array(':param' => 'id')); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $db->prepare('SELECT :placeholder FROM test WHERE :placeholder > :placeholder'); - $stmt->execute(array(':placeholder' => 'test')); + $db->prepare('SELECT :placeholder FROM test WHERE :placeholder > :placeholder'); + $stmt->execute(array(':placeholder' => 'test')); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt index c9465b62a2..1c5ddc407f 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt @@ -9,90 +9,90 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - - try { - - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec(sprintf('CREATE TABLE test(id INT, label1 CHAR(255), label2 CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); - - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn off emulated prepared statements\n"); - printf("Native...\n"); - - // INSERT a single row - $stmt = $db->prepare('INSERT INTO test(id, label1, label2) VALUES (1, :placeholder, :placeholder)'); - - $stmt->execute(array(':placeholder' => 'row1')); - if ('00000' !== $stmt->errorCode()) - printf("[003] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); - - // Ok, what has happened: anything inserted into the DB? - $stmt = $db->prepare('SELECT id, label1, label2 FROM test WHERE id = 1'); - $stmt->execute(); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - // Now the same with emulated PS. - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[004] Unable to turn on emulated prepared statements\n"); - printf("Emulated...\n"); - - $stmt = $db->prepare('INSERT INTO test(id, label1, label2) VALUES(2, :placeholder, :placeholder)'); - // No replacement shall be made - $stmt->execute(array(':placeholder' => 'row2')); - if ('00000' !== $stmt->errorCode()) - printf("[005] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); - - // Now, what do we have in the DB? - $stmt = $db->prepare('SELECT id, label1, label2 FROM test WHERE id = 2'); - $stmt->execute(); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - // - // Another variation of the theme - // - - $db->exec('DELETE FROM test'); - $db->exec("INSERT INTO test (id, label1, label2) VALUES (1, 'row1', 'row2')"); - $sql = "SELECT id, label1 FROM test WHERE id = :placeholder AND label1 = (SELECT label1 AS 'SELECT' FROM test WHERE id = :placeholder)"; - - // emulated... - $stmt = $db->prepare($sql); - $stmt->execute(array(':placeholder' => 1)); - if ('00000' !== $stmt->errorCode()) - printf("[006] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - // native... - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[007] Unable to turn off emulated prepared statements\n"); - printf("Native...\n"); - - $stmt = $db->prepare($sql); - $stmt->execute(array(':placeholder' => 1)); - if ('00000' !== $stmt->errorCode()) - printf("[008] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + + try { + + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec(sprintf('CREATE TABLE test(id INT, label1 CHAR(255), label2 CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); + + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn off emulated prepared statements\n"); + printf("Native...\n"); + + // INSERT a single row + $stmt = $db->prepare('INSERT INTO test(id, label1, label2) VALUES (1, :placeholder, :placeholder)'); + + $stmt->execute(array(':placeholder' => 'row1')); + if ('00000' !== $stmt->errorCode()) + printf("[003] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); + + // Ok, what has happened: anything inserted into the DB? + $stmt = $db->prepare('SELECT id, label1, label2 FROM test WHERE id = 1'); + $stmt->execute(); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + // Now the same with emulated PS. + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[004] Unable to turn on emulated prepared statements\n"); + printf("Emulated...\n"); + + $stmt = $db->prepare('INSERT INTO test(id, label1, label2) VALUES(2, :placeholder, :placeholder)'); + // No replacement shall be made + $stmt->execute(array(':placeholder' => 'row2')); + if ('00000' !== $stmt->errorCode()) + printf("[005] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); + + // Now, what do we have in the DB? + $stmt = $db->prepare('SELECT id, label1, label2 FROM test WHERE id = 2'); + $stmt->execute(); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + // + // Another variation of the theme + // + + $db->exec('DELETE FROM test'); + $db->exec("INSERT INTO test (id, label1, label2) VALUES (1, 'row1', 'row2')"); + $sql = "SELECT id, label1 FROM test WHERE id = :placeholder AND label1 = (SELECT label1 AS 'SELECT' FROM test WHERE id = :placeholder)"; + + // emulated... + $stmt = $db->prepare($sql); + $stmt->execute(array(':placeholder' => 1)); + if ('00000' !== $stmt->errorCode()) + printf("[006] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + // native... + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[007] Unable to turn off emulated prepared statements\n"); + printf("Native...\n"); + + $stmt = $db->prepare($sql); + $stmt->execute(array(':placeholder' => 1)); + if ('00000' !== $stmt->errorCode()) + printf("[008] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt index e706b92616..d24cb894ac 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt @@ -9,22 +9,22 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn off emulated prepared statements\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn off emulated prepared statements\n"); - $stmt = $db->query('DELETE FROM test'); - $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, ?), (2, ?)'); - $stmt->execute(array('a', 'b')); - $stmt = $db->prepare("SELECT id, label FROM test WHERE id = :placeholder AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)"); - $stmt->execute(array(1, 1)); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->query('DELETE FROM test'); + $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, ?), (2, ?)'); + $stmt->execute(array('a', 'b')); + $stmt = $db->prepare("SELECT id, label FROM test WHERE id = :placeholder AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)"); + $stmt->execute(array(1, 1)); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt index 12acdcc0b1..6b553375d6 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt @@ -9,62 +9,62 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - try { + try { - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn off emulated prepared statements\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn off emulated prepared statements\n"); - // INSERT a single row - $stmt = $db->prepare("INSERT INTO test(id, label) VALUES (100, ':placeholder')"); + // INSERT a single row + $stmt = $db->prepare("INSERT INTO test(id, label) VALUES (100, ':placeholder')"); - // Yes, there is no placeholder to bind to and named placeholder - // do not work with MySQL native PS, but lets see what happens! - // The ':placeholder' is a string constant in the INSERT statement. - // I would expect to get an error message, but this is not what happens. - $stmt->execute(array(':placeholder' => 'row1')); - if ('00000' !== $stmt->errorCode()) - printf("[003] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); + // Yes, there is no placeholder to bind to and named placeholder + // do not work with MySQL native PS, but lets see what happens! + // The ':placeholder' is a string constant in the INSERT statement. + // I would expect to get an error message, but this is not what happens. + $stmt->execute(array(':placeholder' => 'row1')); + if ('00000' !== $stmt->errorCode()) + printf("[003] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); - // Ok, what has happened: anything inserted into the DB? - $stmt = $db->prepare('SELECT id, label FROM test'); - $stmt->execute(); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + // Ok, what has happened: anything inserted into the DB? + $stmt = $db->prepare('SELECT id, label FROM test'); + $stmt->execute(); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - // Now the same with emulated PS. - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[004] Unable to turn on emulated prepared statements\n"); + // Now the same with emulated PS. + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[004] Unable to turn on emulated prepared statements\n"); - // Note that the "named placeholder" is enclosed by double quotes. - $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(101, ':placeholder')"); - // No replacement shall be made - $stmt->execute(array(':placeholder' => 'row1')); - // Again, I'd like to see an error message - if ('00000' !== $stmt->errorCode()) - printf("[005] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); + // Note that the "named placeholder" is enclosed by double quotes. + $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(101, ':placeholder')"); + // No replacement shall be made + $stmt->execute(array(':placeholder' => 'row1')); + // Again, I'd like to see an error message + if ('00000' !== $stmt->errorCode()) + printf("[005] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); - // Now, what do we have in the DB? - $stmt = $db->prepare('SELECT id, label FROM test ORDER BY id'); - $stmt->execute(); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + // Now, what do we have in the DB? + $stmt = $db->prepare('SELECT id, label FROM test ORDER BY id'); + $stmt->execute(); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt index 8df6961f93..a7a76a462b 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt @@ -9,55 +9,55 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to switch on emulated prepared statements, test will fail\n"); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + try { + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to switch on emulated prepared statements, test will fail\n"); - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); - $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')"); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE)); + $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')"); - $stmt = $db->prepare('SELECT ?, id, label FROM test WHERE ? = ? ORDER BY id ASC'); - $stmt->execute(array('id', 'label', 'label')); - if ('00000' !== $stmt->errorCode()) - printf("[003] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->prepare('SELECT ?, id, label FROM test WHERE ? = ? ORDER BY id ASC'); + $stmt->execute(array('id', 'label', 'label')); + if ('00000' !== $stmt->errorCode()) + printf("[003] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - // now the same with native PS - printf("now the same with native PS\n"); - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[004] Unable to switch off emulated prepared statements, test will fail\n"); + // now the same with native PS + printf("now the same with native PS\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[004] Unable to switch off emulated prepared statements, test will fail\n"); - $stmt = $db->prepare('SELECT ?, id, label FROM test WHERE ? = ? ORDER BY id ASC'); - $stmt->execute(array('id', 'label', 'label')); - if ('00000' !== $stmt->errorCode()) - printf("[005] Execute has failed, %s %s\n", - var_export($stmt->errorCode(), true), - var_export($stmt->errorInfo(), true)); + $stmt = $db->prepare('SELECT ?, id, label FROM test WHERE ? = ? ORDER BY id ASC'); + $stmt->execute(array('id', 'label', 'label')); + if ('00000' !== $stmt->errorCode()) + printf("[005] Execute has failed, %s %s\n", + var_export($stmt->errorCode(), true), + var_export($stmt->errorInfo(), true)); - $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); - if (!MySQLPDOTest::isPDOMySQLnd()) { - if (isset($tmp[0]['id'])) { - // libmysql should return a string here whereas mysqlnd returns a native int - if (gettype($tmp[0]['id']) == 'string') - // convert to int for the test output... - settype($tmp[0]['id'], 'integer'); - } - } - var_dump($tmp); + $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); + if (!MySQLPDOTest::isPDOMySQLnd()) { + if (isset($tmp[0]['id'])) { + // libmysql should return a string here whereas mysqlnd returns a native int + if (gettype($tmp[0]['id']) == 'string') + // convert to int for the test output... + settype($tmp[0]['id'], 'integer'); + } + } + var_dump($tmp); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_rollback.phpt b/ext/pdo_mysql/tests/pdo_mysql_rollback.phpt index 30f1d56f88..96e77a1326 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_rollback.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_rollback.phpt @@ -11,75 +11,75 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db)) ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); - $db->beginTransaction(); + $db->beginTransaction(); - $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); - $num = $row['_num']; + $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); + $num = $row['_num']; - $db->query("INSERT INTO test(id, label) VALUES (100, 'z')"); - $num++; - $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); - if ($row['_num'] != $num) - printf("[001] INSERT has failed, test will fail\n"); + $db->query("INSERT INTO test(id, label) VALUES (100, 'z')"); + $num++; + $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); + if ($row['_num'] != $num) + printf("[001] INSERT has failed, test will fail\n"); - $db->rollBack(); - $num--; - $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); - if ($row['_num'] != $num) - printf("[002] ROLLBACK has failed\n"); + $db->rollBack(); + $num--; + $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); + if ($row['_num'] != $num) + printf("[002] ROLLBACK has failed\n"); - $db->beginTransaction(); - $db->query("INSERT INTO test(id, label) VALUES (100, 'z')"); - $db->query('DROP TABLE IF EXISTS test2'); - $db->query('CREATE TABLE test2(id INT)'); - $num++; - $db->rollBack(); - $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); - if ($row['_num'] != $num) - printf("[002] ROLLBACK should have no effect because of the implicit COMMIT - triggered by DROP/CREATE TABLE\n"); + $db->beginTransaction(); + $db->query("INSERT INTO test(id, label) VALUES (100, 'z')"); + $db->query('DROP TABLE IF EXISTS test2'); + $db->query('CREATE TABLE test2(id INT)'); + $num++; + $db->rollBack(); + $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC); + if ($row['_num'] != $num) + printf("[002] ROLLBACK should have no effect because of the implicit COMMIT + triggered by DROP/CREATE TABLE\n"); - $db->query('DROP TABLE IF EXISTS test2'); - $db->query('CREATE TABLE test2(id INT) ENGINE=MyISAM'); - $db->beginTransaction(); - $db->query('INSERT INTO test2(id) VALUES (1)'); - $db->rollBack(); - $row = $db->query('SELECT COUNT(*) AS _num FROM test2')->fetch(PDO::FETCH_ASSOC); - if ($row['_num'] != 1) - printf("[003] ROLLBACK should have no effect\n"); + $db->query('DROP TABLE IF EXISTS test2'); + $db->query('CREATE TABLE test2(id INT) ENGINE=MyISAM'); + $db->beginTransaction(); + $db->query('INSERT INTO test2(id) VALUES (1)'); + $db->rollBack(); + $row = $db->query('SELECT COUNT(*) AS _num FROM test2')->fetch(PDO::FETCH_ASSOC); + if ($row['_num'] != 1) + printf("[003] ROLLBACK should have no effect\n"); - $db->query('DROP TABLE IF EXISTS test2'); + $db->query('DROP TABLE IF EXISTS test2'); - $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1); - $db->beginTransaction(); - $db->query('DELETE FROM test'); - $db->rollBack(); - var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT)); + $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1); + $db->beginTransaction(); + $db->query('DELETE FROM test'); + $db->rollBack(); + var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT)); - $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0); - $db->beginTransaction(); - $db->query('DELETE FROM test'); - $db->rollBack(); - var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT)); + $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0); + $db->beginTransaction(); + $db->query('DELETE FROM test'); + $db->rollBack(); + var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT)); - $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1); - $db->beginTransaction(); - $db->query('DELETE FROM test'); - $db->commit(); - var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT)); + $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1); + $db->beginTransaction(); + $db->query('DELETE FROM test'); + $db->commit(); + var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT)); - $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0); - $db->beginTransaction(); - $db->query('DELETE FROM test'); - $db->commit(); - var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT)); + $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0); + $db->beginTransaction(); + $db->query('DELETE FROM test'); + $db->commit(); + var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT)); - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindcolumn.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindcolumn.phpt index bf56cbc835..6d1ac4bbfb 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindcolumn.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindcolumn.phpt @@ -9,97 +9,97 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); - try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn on emulated prepared statements\n"); + try { + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn on emulated prepared statements\n"); - $stmt = $db->prepare('SELECT id, label FROM test ORDER BY id ASC LIMIT 2'); - $stmt->execute(); - $id = $label = null; + $stmt = $db->prepare('SELECT id, label FROM test ORDER BY id ASC LIMIT 2'); + $stmt->execute(); + $id = $label = null; - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[003] Cannot bind integer column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[003] Cannot bind integer column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[004] Cannot bind string column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[004] Cannot bind string column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - $data = array(); - while ($stmt->fetch(PDO::FETCH_BOUND)) { - printf("id = %s (%s) / label = %s (%s)\n", - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - $data[] = array('id' => $id, 'label' => $label); - } + $data = array(); + while ($stmt->fetch(PDO::FETCH_BOUND)) { + printf("id = %s (%s) / label = %s (%s)\n", + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + $data[] = array('id' => $id, 'label' => $label); + } - $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2'); - $index = 0; - while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { - if ($row['id'] != $data[$index]['id']) { - printf("[005] Fetch bound and fetch assoc differ - column 'id', bound: %s/%s, assoc: %s/%s\n", - var_export($data[$index]['id'], true), gettype($data[$index]['id']), - var_export($row['id'], true), gettype($row['id'])); - } - if ($row['label'] != $data[$index]['label']) { - printf("[006] Fetch bound and fetch assoc differ - column 'label', bound: %s/%s, assoc: %s/%s\n", - var_export($data[$index]['label'], true), gettype($data[$index]['label']), - var_export($row['label'], true), gettype($row['label'])); - } - $index++; - } + $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2'); + $index = 0; + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + if ($row['id'] != $data[$index]['id']) { + printf("[005] Fetch bound and fetch assoc differ - column 'id', bound: %s/%s, assoc: %s/%s\n", + var_export($data[$index]['id'], true), gettype($data[$index]['id']), + var_export($row['id'], true), gettype($row['id'])); + } + if ($row['label'] != $data[$index]['label']) { + printf("[006] Fetch bound and fetch assoc differ - column 'label', bound: %s/%s, assoc: %s/%s\n", + var_export($data[$index]['label'], true), gettype($data[$index]['label']), + var_export($row['label'], true), gettype($row['label'])); + } + $index++; + } - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[007] Unable to turn off emulated prepared statements\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[007] Unable to turn off emulated prepared statements\n"); - $stmt = $db->prepare('SELECT id, label FROM test ORDER BY id ASC LIMIT 2, 2'); - $stmt->execute(); - $id = $label = null; + $stmt = $db->prepare('SELECT id, label FROM test ORDER BY id ASC LIMIT 2, 2'); + $stmt->execute(); + $id = $label = null; - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[008] Cannot bind integer column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[008] Cannot bind integer column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[009] Cannot bind string column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[009] Cannot bind string column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - $data = array(); - while ($stmt->fetch(PDO::FETCH_BOUND)) { - printf("id = %s (%s) / label = %s (%s)\n", - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - $data[] = array('id' => $id, 'label' => $label); - } + $data = array(); + while ($stmt->fetch(PDO::FETCH_BOUND)) { + printf("id = %s (%s) / label = %s (%s)\n", + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + $data[] = array('id' => $id, 'label' => $label); + } - $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2, 2'); - $index = 0; - while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { - if ($row['id'] != $data[$index]['id']) { - printf("[010] Fetch bound and fetch assoc differ - column 'id', bound: %s/%s, assoc: %s/%s\n", - var_export($data[$index]['id'], true), gettype($data[$index]['id']), - var_export($row['id'], true), gettype($row['id'])); - } - if ($row['label'] != $data[$index]['label']) { - printf("[011] Fetch bound and fetch assoc differ - column 'label', bound: %s/%s, assoc: %s/%s\n", - var_export($data[$index]['label'], true), gettype($data[$index]['label']), - var_export($row['label'], true), gettype($row['label'])); - } - $index++; - } + $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2, 2'); + $index = 0; + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + if ($row['id'] != $data[$index]['id']) { + printf("[010] Fetch bound and fetch assoc differ - column 'id', bound: %s/%s, assoc: %s/%s\n", + var_export($data[$index]['id'], true), gettype($data[$index]['id']), + var_export($row['id'], true), gettype($row['id'])); + } + if ($row['label'] != $data[$index]['label']) { + printf("[011] Fetch bound and fetch assoc differ - column 'label', bound: %s/%s, assoc: %s/%s\n", + var_export($data[$index]['label'], true), gettype($data[$index]['label']), + var_export($row['label'], true), gettype($row['label'])); + } + $index++; + } - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam.phpt index 422c519355..4559c499ea 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam.phpt @@ -8,113 +8,113 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); - - MySQLPDOTest::createTestTable($db); - - function pdo_mysql_stmt_bindparam($db, $offset) { - - $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2'); - $in = 0; - if (!$stmt->bindParam(1, $in)) - printf("[%03d + 1] Cannot bind parameter, %s %s\n", $offset, - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $stmt->execute(); - $id = $label = null; - - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[%03d + 2] Cannot bind integer column, %s %s\n", $offset, - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[%03d + 3] Cannot bind string column, %s %s\n", $offset, - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - - printf("Same again...\n"); - $stmt->execute(); - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - - // NULL values - printf("NULL...\n"); - $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (100, ?)'); - $label = null; - if (!$stmt->bindParam(1, $label)) - printf("[%03d + 4] Cannot bind parameter, %s %s\n", $offset, - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->execute()) - printf("[%03d + 5] Cannot execute statement, %s %s\n", $offset, - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - /* NOTE: you cannot use PDO::query() with unbuffered, native PS - see extra test */ - $stmt = $db->prepare('SELECT id, NULL AS _label FROM test WHERE label IS NULL'); - $stmt->execute(); - - $id = $label = 'bogus'; - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[%03d + 6] Cannot bind NULL column, %s %s\n", $offset, - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[%03d + 3] Cannot bind string column, %s %s\n", $offset, - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - } - - try { - printf("Emulated PS...\n"); - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn on emulated prepared statements\n"); - - printf("Buffered...\n"); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); - pdo_mysql_stmt_bindparam($db, 3); - - printf("Unbuffered...\n"); - MySQLPDOTest::createTestTable($db); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); - pdo_mysql_stmt_bindparam($db, 4); - - printf("Native PS...\n"); - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[004] Unable to turn off emulated prepared statements\n"); - - printf("Buffered...\n"); - MySQLPDOTest::createTestTable($db); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); - pdo_mysql_stmt_bindparam($db, 5); - - printf("Unbuffered...\n"); - MySQLPDOTest::createTestTable($db); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); - pdo_mysql_stmt_bindparam($db, 6); - - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); + + MySQLPDOTest::createTestTable($db); + + function pdo_mysql_stmt_bindparam($db, $offset) { + + $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2'); + $in = 0; + if (!$stmt->bindParam(1, $in)) + printf("[%03d + 1] Cannot bind parameter, %s %s\n", $offset, + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $stmt->execute(); + $id = $label = null; + + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[%03d + 2] Cannot bind integer column, %s %s\n", $offset, + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[%03d + 3] Cannot bind string column, %s %s\n", $offset, + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + + printf("Same again...\n"); + $stmt->execute(); + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + + // NULL values + printf("NULL...\n"); + $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (100, ?)'); + $label = null; + if (!$stmt->bindParam(1, $label)) + printf("[%03d + 4] Cannot bind parameter, %s %s\n", $offset, + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->execute()) + printf("[%03d + 5] Cannot execute statement, %s %s\n", $offset, + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + /* NOTE: you cannot use PDO::query() with unbuffered, native PS - see extra test */ + $stmt = $db->prepare('SELECT id, NULL AS _label FROM test WHERE label IS NULL'); + $stmt->execute(); + + $id = $label = 'bogus'; + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[%03d + 6] Cannot bind NULL column, %s %s\n", $offset, + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[%03d + 3] Cannot bind string column, %s %s\n", $offset, + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + } + + try { + printf("Emulated PS...\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn on emulated prepared statements\n"); + + printf("Buffered...\n"); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); + pdo_mysql_stmt_bindparam($db, 3); + + printf("Unbuffered...\n"); + MySQLPDOTest::createTestTable($db); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); + pdo_mysql_stmt_bindparam($db, 4); + + printf("Native PS...\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[004] Unable to turn off emulated prepared statements\n"); + + printf("Buffered...\n"); + MySQLPDOTest::createTestTable($db); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); + pdo_mysql_stmt_bindparam($db, 5); + + printf("Unbuffered...\n"); + MySQLPDOTest::createTestTable($db); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); + pdo_mysql_stmt_bindparam($db, 6); + + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam_types.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam_types.phpt index 0e34313a96..5da2bb30fb 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam_types.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam_types.phpt @@ -9,160 +9,160 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); - - function pdo_mysql_stmt_bindparam_types_do($db, $offset, $native, $sql_type, $value) { - - if ($native) - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - else - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - - $db->exec('DROP TABLE IF EXISTS test'); - $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine()); - if ((!$stmt = @$db->prepare($sql)) || (!@$stmt->execute())) - // Server might not support column type - skip it - return true; - - $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, ?)'); - if (!$stmt->bindParam(1, $value)) { - printf("[%03d/%s + 1] %s\n", $offset, ($native) ? 'native' : 'emulated', - var_export($stmt->errorInfo(), true)); - return false; - } - if (!$stmt->execute()) { - printf("[%03d/%s + 2] %s\n", $offset, ($native) ? 'native' : 'emulated', - var_export($stmt->errorInfo(), true)); - return false; - } - - $stmt = $db->query('SELECT id, label FROM test'); - $id = $label = null; - if (!$stmt->bindColumn(1, $id)) { - printf("[%03d/%s + 3] %s\n", $offset, ($native) ? 'native' : 'emulated', - var_export($stmt->errorInfo(), true)); - return false; - } - if (!$stmt->bindColumn(2, $label)) { - printf("[%03d/%s + 4] %s\n", $offset, ($native) ? 'native' : 'emulated', - var_export($stmt->errorInfo(), true)); - return false; - } - - if (!$stmt->fetch(PDO::FETCH_BOUND)) { - printf("[%03d/%s + 5] %s\n", $offset, ($native) ? 'native' : 'emulated', - var_export($stmt->errorInfo(), true)); - return false; - } - $stmt->closeCursor(); - - if ($label != $value) { - printf("[%03d/%s + 6] Got %s expecting %s - please check manually\n", - $offset, ($native) ? 'native' : 'emulated', - var_export($label, true), var_export($value, true)); - // fall through - } - - $stmt->execute(); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - if (empty($row)) { - printf("[%03d/%s + 7] %s\n", $offset, ($native) ? 'native' : 'emulated', - var_export($stmt->errorInfo(), true)); - return false; - } - - if ($row['label'] != $value) { - printf("[%03d/%s + 8] Got %s expecting %s - please check manually\n", - $offset, ($native) ? 'native' : 'emulated', - var_export($row['label'], true), var_export($value, true)); - return false; - } - - if ($row['label'] != $label) { - printf("[%03d/%s + 9] Got %s from FETCH_ASSOC and %s from FETCH_BOUND- please check manually\n", - $offset, ($native) ? 'native' : 'emulated', - var_export($row['label'], true), var_export($value, true)); - return false; - } - - $db->exec('DROP TABLE IF EXISTS test'); - return true; - } - - function pdo_mysql_stmt_bindparam_types($db, $offset, $sql_type, $value) { - - pdo_mysql_stmt_bindparam_types_do($db, $offset, true, $sql_type, $value); - pdo_mysql_stmt_bindparam_types_do($db, $offset, false, $sql_type, $value); - - } - - try { - - // pdo_mysql_stmt_bindparam_types($db, 2, 'BIT(8)', 1); - pdo_mysql_stmt_bindparam_types($db, 3, 'TINYINT', -127); - pdo_mysql_stmt_bindparam_types($db, 4, 'TINYINT UNSIGNED', 255); - pdo_mysql_stmt_bindparam_types($db, 5, 'BOOLEAN', 1); - pdo_mysql_stmt_bindparam_types($db, 6, 'SMALLINT', -32768); - pdo_mysql_stmt_bindparam_types($db, 7, 'SMALLINT UNSIGNED', 65535); - pdo_mysql_stmt_bindparam_types($db, 8, 'MEDIUMINT', -8388608); - pdo_mysql_stmt_bindparam_types($db, 9, 'MEDIUMINT UNSIGNED', 16777215); - pdo_mysql_stmt_bindparam_types($db, 10, 'INT', -2147483648); - pdo_mysql_stmt_bindparam_types($db, 11, 'INT UNSIGNED', 4294967295); - pdo_mysql_stmt_bindparam_types($db, 12, 'BIGINT', -1000); - pdo_mysql_stmt_bindparam_types($db, 13, 'BIGINT UNSIGNED', 1000); - pdo_mysql_stmt_bindparam_types($db, 14, 'REAL', -1000); - pdo_mysql_stmt_bindparam_types($db, 15, 'REAL UNSIGNED', 1000); - pdo_mysql_stmt_bindparam_types($db, 16, 'REAL ZEROFILL', '0000000000000000000000'); - pdo_mysql_stmt_bindparam_types($db, 17, 'REAL UNSIGNED ZEROFILL', '0000000000000000000010'); - pdo_mysql_stmt_bindparam_types($db, 18, 'DOUBLE', -1000); - pdo_mysql_stmt_bindparam_types($db, 19, 'DOUBLE UNSIGNED', 1000); - pdo_mysql_stmt_bindparam_types($db, 20, 'DOUBLE ZEROFILL', '000000000000'); - pdo_mysql_stmt_bindparam_types($db, 21, 'DOUBLE ZEROFILL UNSIGNED', '000000001000'); - pdo_mysql_stmt_bindparam_types($db, 22, 'FLOAT', -1000); - pdo_mysql_stmt_bindparam_types($db, 23, 'FLOAT UNSIGNED', 1000); - pdo_mysql_stmt_bindparam_types($db, 24, 'FLOAT ZEROFILL', '000000000000'); - pdo_mysql_stmt_bindparam_types($db, 25, 'FLOAT ZEROFILL UNSIGNED', '000000001000'); - pdo_mysql_stmt_bindparam_types($db, 26, 'DECIMAL', -1000); - pdo_mysql_stmt_bindparam_types($db, 27, 'DECIMAL UNSIGNED', 1000); - pdo_mysql_stmt_bindparam_types($db, 28, 'DECIMAL ZEROFILL', '000000000000'); - pdo_mysql_stmt_bindparam_types($db, 29, 'DECIMAL ZEROFILL UNSIGNED', '000000001000'); - pdo_mysql_stmt_bindparam_types($db, 30, 'NUMERIC', -1000); - pdo_mysql_stmt_bindparam_types($db, 31, 'NUMERIC UNSIGNED', 1000); - pdo_mysql_stmt_bindparam_types($db, 32, 'NUMERIC ZEROFILL', '000000000000'); - pdo_mysql_stmt_bindparam_types($db, 33, 'NUMERIC ZEROFILL UNSIGNED', '000000001000'); - pdo_mysql_stmt_bindparam_types($db, 34, 'DATE', '2008-04-23'); - pdo_mysql_stmt_bindparam_types($db, 35, 'TIME', '16:43:12'); - pdo_mysql_stmt_bindparam_types($db, 36, 'TIMESTAMP', '2008-04-23 16:44:53'); - pdo_mysql_stmt_bindparam_types($db, 37, 'DATETIME', '2008-04-23 16:44:53'); - pdo_mysql_stmt_bindparam_types($db, 38, 'YEAR', '2008'); - pdo_mysql_stmt_bindparam_types($db, 39, 'CHAR(1)', 'a'); - pdo_mysql_stmt_bindparam_types($db, 40, 'CHAR(255)', 'abc'); - pdo_mysql_stmt_bindparam_types($db, 41, 'VARCHAR(255)', str_repeat('a', 255)); - pdo_mysql_stmt_bindparam_types($db, 42, 'BINARY(255)', str_repeat('a', 255)); - pdo_mysql_stmt_bindparam_types($db, 43, 'VARBINARY(255)', str_repeat('a', 255)); - pdo_mysql_stmt_bindparam_types($db, 44, 'TINYBLOB', str_repeat('a', 255)); - pdo_mysql_stmt_bindparam_types($db, 45, 'BLOB', str_repeat('b', 300)); - pdo_mysql_stmt_bindparam_types($db, 46, 'MEDIUMBLOB', str_repeat('b', 300)); - pdo_mysql_stmt_bindparam_types($db, 47, 'LONGBLOB', str_repeat('b', 300)); - pdo_mysql_stmt_bindparam_types($db, 48, 'TINYTEXT', str_repeat('c', 255)); - pdo_mysql_stmt_bindparam_types($db, 49, 'TINYTEXT BINARY', str_repeat('c', 255)); - pdo_mysql_stmt_bindparam_types($db, 50, 'TEXT', str_repeat('d', 300)); - pdo_mysql_stmt_bindparam_types($db, 51, 'TEXT BINARY', str_repeat('d', 300)); - pdo_mysql_stmt_bindparam_types($db, 52, 'MEDIUMTEXT', str_repeat('d', 300)); - pdo_mysql_stmt_bindparam_types($db, 53, 'MEDIUMTEXT BINARY', str_repeat('d', 300)); - pdo_mysql_stmt_bindparam_types($db, 54, 'LONGTEXT', str_repeat('d', 300)); - pdo_mysql_stmt_bindparam_types($db, 55, 'LONGTEXT BINARY', str_repeat('d', 300)); - pdo_mysql_stmt_bindparam_types($db, 56, "ENUM('yes', 'no') DEFAULT 'yes'", "no"); - pdo_mysql_stmt_bindparam_types($db, 57, "SET('yes', 'no') DEFAULT 'yes'", "no"); - - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); + + function pdo_mysql_stmt_bindparam_types_do($db, $offset, $native, $sql_type, $value) { + + if ($native) + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + else + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + + $db->exec('DROP TABLE IF EXISTS test'); + $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine()); + if ((!$stmt = @$db->prepare($sql)) || (!@$stmt->execute())) + // Server might not support column type - skip it + return true; + + $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, ?)'); + if (!$stmt->bindParam(1, $value)) { + printf("[%03d/%s + 1] %s\n", $offset, ($native) ? 'native' : 'emulated', + var_export($stmt->errorInfo(), true)); + return false; + } + if (!$stmt->execute()) { + printf("[%03d/%s + 2] %s\n", $offset, ($native) ? 'native' : 'emulated', + var_export($stmt->errorInfo(), true)); + return false; + } + + $stmt = $db->query('SELECT id, label FROM test'); + $id = $label = null; + if (!$stmt->bindColumn(1, $id)) { + printf("[%03d/%s + 3] %s\n", $offset, ($native) ? 'native' : 'emulated', + var_export($stmt->errorInfo(), true)); + return false; + } + if (!$stmt->bindColumn(2, $label)) { + printf("[%03d/%s + 4] %s\n", $offset, ($native) ? 'native' : 'emulated', + var_export($stmt->errorInfo(), true)); + return false; + } + + if (!$stmt->fetch(PDO::FETCH_BOUND)) { + printf("[%03d/%s + 5] %s\n", $offset, ($native) ? 'native' : 'emulated', + var_export($stmt->errorInfo(), true)); + return false; + } + $stmt->closeCursor(); + + if ($label != $value) { + printf("[%03d/%s + 6] Got %s expecting %s - please check manually\n", + $offset, ($native) ? 'native' : 'emulated', + var_export($label, true), var_export($value, true)); + // fall through + } + + $stmt->execute(); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + if (empty($row)) { + printf("[%03d/%s + 7] %s\n", $offset, ($native) ? 'native' : 'emulated', + var_export($stmt->errorInfo(), true)); + return false; + } + + if ($row['label'] != $value) { + printf("[%03d/%s + 8] Got %s expecting %s - please check manually\n", + $offset, ($native) ? 'native' : 'emulated', + var_export($row['label'], true), var_export($value, true)); + return false; + } + + if ($row['label'] != $label) { + printf("[%03d/%s + 9] Got %s from FETCH_ASSOC and %s from FETCH_BOUND- please check manually\n", + $offset, ($native) ? 'native' : 'emulated', + var_export($row['label'], true), var_export($value, true)); + return false; + } + + $db->exec('DROP TABLE IF EXISTS test'); + return true; + } + + function pdo_mysql_stmt_bindparam_types($db, $offset, $sql_type, $value) { + + pdo_mysql_stmt_bindparam_types_do($db, $offset, true, $sql_type, $value); + pdo_mysql_stmt_bindparam_types_do($db, $offset, false, $sql_type, $value); + + } + + try { + + // pdo_mysql_stmt_bindparam_types($db, 2, 'BIT(8)', 1); + pdo_mysql_stmt_bindparam_types($db, 3, 'TINYINT', -127); + pdo_mysql_stmt_bindparam_types($db, 4, 'TINYINT UNSIGNED', 255); + pdo_mysql_stmt_bindparam_types($db, 5, 'BOOLEAN', 1); + pdo_mysql_stmt_bindparam_types($db, 6, 'SMALLINT', -32768); + pdo_mysql_stmt_bindparam_types($db, 7, 'SMALLINT UNSIGNED', 65535); + pdo_mysql_stmt_bindparam_types($db, 8, 'MEDIUMINT', -8388608); + pdo_mysql_stmt_bindparam_types($db, 9, 'MEDIUMINT UNSIGNED', 16777215); + pdo_mysql_stmt_bindparam_types($db, 10, 'INT', -2147483648); + pdo_mysql_stmt_bindparam_types($db, 11, 'INT UNSIGNED', 4294967295); + pdo_mysql_stmt_bindparam_types($db, 12, 'BIGINT', -1000); + pdo_mysql_stmt_bindparam_types($db, 13, 'BIGINT UNSIGNED', 1000); + pdo_mysql_stmt_bindparam_types($db, 14, 'REAL', -1000); + pdo_mysql_stmt_bindparam_types($db, 15, 'REAL UNSIGNED', 1000); + pdo_mysql_stmt_bindparam_types($db, 16, 'REAL ZEROFILL', '0000000000000000000000'); + pdo_mysql_stmt_bindparam_types($db, 17, 'REAL UNSIGNED ZEROFILL', '0000000000000000000010'); + pdo_mysql_stmt_bindparam_types($db, 18, 'DOUBLE', -1000); + pdo_mysql_stmt_bindparam_types($db, 19, 'DOUBLE UNSIGNED', 1000); + pdo_mysql_stmt_bindparam_types($db, 20, 'DOUBLE ZEROFILL', '000000000000'); + pdo_mysql_stmt_bindparam_types($db, 21, 'DOUBLE ZEROFILL UNSIGNED', '000000001000'); + pdo_mysql_stmt_bindparam_types($db, 22, 'FLOAT', -1000); + pdo_mysql_stmt_bindparam_types($db, 23, 'FLOAT UNSIGNED', 1000); + pdo_mysql_stmt_bindparam_types($db, 24, 'FLOAT ZEROFILL', '000000000000'); + pdo_mysql_stmt_bindparam_types($db, 25, 'FLOAT ZEROFILL UNSIGNED', '000000001000'); + pdo_mysql_stmt_bindparam_types($db, 26, 'DECIMAL', -1000); + pdo_mysql_stmt_bindparam_types($db, 27, 'DECIMAL UNSIGNED', 1000); + pdo_mysql_stmt_bindparam_types($db, 28, 'DECIMAL ZEROFILL', '000000000000'); + pdo_mysql_stmt_bindparam_types($db, 29, 'DECIMAL ZEROFILL UNSIGNED', '000000001000'); + pdo_mysql_stmt_bindparam_types($db, 30, 'NUMERIC', -1000); + pdo_mysql_stmt_bindparam_types($db, 31, 'NUMERIC UNSIGNED', 1000); + pdo_mysql_stmt_bindparam_types($db, 32, 'NUMERIC ZEROFILL', '000000000000'); + pdo_mysql_stmt_bindparam_types($db, 33, 'NUMERIC ZEROFILL UNSIGNED', '000000001000'); + pdo_mysql_stmt_bindparam_types($db, 34, 'DATE', '2008-04-23'); + pdo_mysql_stmt_bindparam_types($db, 35, 'TIME', '16:43:12'); + pdo_mysql_stmt_bindparam_types($db, 36, 'TIMESTAMP', '2008-04-23 16:44:53'); + pdo_mysql_stmt_bindparam_types($db, 37, 'DATETIME', '2008-04-23 16:44:53'); + pdo_mysql_stmt_bindparam_types($db, 38, 'YEAR', '2008'); + pdo_mysql_stmt_bindparam_types($db, 39, 'CHAR(1)', 'a'); + pdo_mysql_stmt_bindparam_types($db, 40, 'CHAR(255)', 'abc'); + pdo_mysql_stmt_bindparam_types($db, 41, 'VARCHAR(255)', str_repeat('a', 255)); + pdo_mysql_stmt_bindparam_types($db, 42, 'BINARY(255)', str_repeat('a', 255)); + pdo_mysql_stmt_bindparam_types($db, 43, 'VARBINARY(255)', str_repeat('a', 255)); + pdo_mysql_stmt_bindparam_types($db, 44, 'TINYBLOB', str_repeat('a', 255)); + pdo_mysql_stmt_bindparam_types($db, 45, 'BLOB', str_repeat('b', 300)); + pdo_mysql_stmt_bindparam_types($db, 46, 'MEDIUMBLOB', str_repeat('b', 300)); + pdo_mysql_stmt_bindparam_types($db, 47, 'LONGBLOB', str_repeat('b', 300)); + pdo_mysql_stmt_bindparam_types($db, 48, 'TINYTEXT', str_repeat('c', 255)); + pdo_mysql_stmt_bindparam_types($db, 49, 'TINYTEXT BINARY', str_repeat('c', 255)); + pdo_mysql_stmt_bindparam_types($db, 50, 'TEXT', str_repeat('d', 300)); + pdo_mysql_stmt_bindparam_types($db, 51, 'TEXT BINARY', str_repeat('d', 300)); + pdo_mysql_stmt_bindparam_types($db, 52, 'MEDIUMTEXT', str_repeat('d', 300)); + pdo_mysql_stmt_bindparam_types($db, 53, 'MEDIUMTEXT BINARY', str_repeat('d', 300)); + pdo_mysql_stmt_bindparam_types($db, 54, 'LONGTEXT', str_repeat('d', 300)); + pdo_mysql_stmt_bindparam_types($db, 55, 'LONGTEXT BINARY', str_repeat('d', 300)); + pdo_mysql_stmt_bindparam_types($db, 56, "ENUM('yes', 'no') DEFAULT 'yes'", "no"); + pdo_mysql_stmt_bindparam_types($db, 57, "SET('yes', 'no') DEFAULT 'yes'", "no"); + + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindvalue.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindvalue.phpt index 173105a48e..537156ebbf 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindvalue.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindvalue.phpt @@ -9,291 +9,291 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); - - printf("Testing native PS...\n"); - try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn off emulated prepared statements\n"); - - printf("Binding variable...\n"); - $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2'); - $in = 0; - if (!$stmt->bindValue(1, $in)) - printf("[003] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $stmt->execute(); - $id = $label = null; - - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[004] Cannot bind integer column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[005] Cannot bind string column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - - printf("Binding value and not variable...\n"); - if (!$stmt->bindValue(1, 0)) - printf("[006] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $stmt->execute(); - $id = $label = null; - - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[007] Cannot bind integer column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[008] Cannot bind string column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - - printf("Binding variable which references another variable...\n"); - $in = 0; - $in_ref = &$in; - if (!$stmt->bindValue(1, $in_ref)) - printf("[009] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $stmt->execute(); - $id = $label = null; - - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[010] Cannot bind integer column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[011] Cannot bind string column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - - - printf("Binding a variable and a value...\n"); - $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2'); - $in = 0; - if (!$stmt->bindValue(1, $in)) - printf("[012] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindValue(2, 2)) - printf("[013] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $stmt->execute(); - $id = $label = null; - - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[014] Cannot bind integer column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[015] Cannot bind string column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - - printf("Binding a variable to two placeholders and changing the variable value in between the binds...\n"); - // variable value change shall have no impact - $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2'); - $in = 0; - if (!$stmt->bindValue(1, $in)) - printf("[016] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $in = 2; - if (!$stmt->bindValue(2, $in)) - printf("[017] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $stmt->execute(); - $id = $label = null; - - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[018] Cannot bind integer column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[019] Cannot bind string column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - - printf("Testing emulated PS...\n"); - try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn on emulated prepared statements\n"); - - printf("Binding variable...\n"); - $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2'); - $in = 0; - if (!$stmt->bindValue(1, $in)) - printf("[003] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $stmt->execute(); - $id = $label = null; - - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[004] Cannot bind integer column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[005] Cannot bind string column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - - printf("Binding value and not variable...\n"); - if (!$stmt->bindValue(1, 0)) - printf("[006] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $stmt->execute(); - $id = $label = null; - - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[007] Cannot bind integer column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[008] Cannot bind string column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - - printf("Binding variable which references another variable...\n"); - $in = 0; - $in_ref = &$in; - if (!$stmt->bindValue(1, $in_ref)) - printf("[009] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $stmt->execute(); - $id = $label = null; - - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[010] Cannot bind integer column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[011] Cannot bind string column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - - - printf("Binding a variable and a value...\n"); - $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2'); - $in = 0; - if (!$stmt->bindValue(1, $in)) - printf("[012] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindValue(2, 2)) - printf("[013] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $stmt->execute(); - $id = $label = null; - - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[014] Cannot bind integer column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[015] Cannot bind string column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - - printf("Binding a variable to two placeholders and changing the variable value in between the binds...\n"); - // variable value change shall have no impact - $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2'); - $in = 0; - if (!$stmt->bindValue(1, $in)) - printf("[016] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $in = 2; - if (!$stmt->bindValue(2, $in)) - printf("[017] Cannot bind value, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $stmt->execute(); - $id = $label = null; - - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[018] Cannot bind integer column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[019] Cannot bind string column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); + + printf("Testing native PS...\n"); + try { + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn off emulated prepared statements\n"); + + printf("Binding variable...\n"); + $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2'); + $in = 0; + if (!$stmt->bindValue(1, $in)) + printf("[003] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $stmt->execute(); + $id = $label = null; + + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[004] Cannot bind integer column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[005] Cannot bind string column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + + printf("Binding value and not variable...\n"); + if (!$stmt->bindValue(1, 0)) + printf("[006] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $stmt->execute(); + $id = $label = null; + + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[007] Cannot bind integer column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[008] Cannot bind string column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + + printf("Binding variable which references another variable...\n"); + $in = 0; + $in_ref = &$in; + if (!$stmt->bindValue(1, $in_ref)) + printf("[009] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $stmt->execute(); + $id = $label = null; + + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[010] Cannot bind integer column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[011] Cannot bind string column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + + + printf("Binding a variable and a value...\n"); + $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2'); + $in = 0; + if (!$stmt->bindValue(1, $in)) + printf("[012] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindValue(2, 2)) + printf("[013] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $stmt->execute(); + $id = $label = null; + + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[014] Cannot bind integer column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[015] Cannot bind string column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + + printf("Binding a variable to two placeholders and changing the variable value in between the binds...\n"); + // variable value change shall have no impact + $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2'); + $in = 0; + if (!$stmt->bindValue(1, $in)) + printf("[016] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $in = 2; + if (!$stmt->bindValue(2, $in)) + printf("[017] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $stmt->execute(); + $id = $label = null; + + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[018] Cannot bind integer column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[019] Cannot bind string column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + + printf("Testing emulated PS...\n"); + try { + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn on emulated prepared statements\n"); + + printf("Binding variable...\n"); + $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2'); + $in = 0; + if (!$stmt->bindValue(1, $in)) + printf("[003] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $stmt->execute(); + $id = $label = null; + + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[004] Cannot bind integer column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[005] Cannot bind string column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + + printf("Binding value and not variable...\n"); + if (!$stmt->bindValue(1, 0)) + printf("[006] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $stmt->execute(); + $id = $label = null; + + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[007] Cannot bind integer column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[008] Cannot bind string column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + + printf("Binding variable which references another variable...\n"); + $in = 0; + $in_ref = &$in; + if (!$stmt->bindValue(1, $in_ref)) + printf("[009] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $stmt->execute(); + $id = $label = null; + + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[010] Cannot bind integer column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[011] Cannot bind string column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + + + printf("Binding a variable and a value...\n"); + $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2'); + $in = 0; + if (!$stmt->bindValue(1, $in)) + printf("[012] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindValue(2, 2)) + printf("[013] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $stmt->execute(); + $id = $label = null; + + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[014] Cannot bind integer column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[015] Cannot bind string column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + + printf("Binding a variable to two placeholders and changing the variable value in between the binds...\n"); + // variable value change shall have no impact + $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2'); + $in = 0; + if (!$stmt->bindValue(1, $in)) + printf("[016] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $in = 2; + if (!$stmt->bindValue(2, $in)) + printf("[017] Cannot bind value, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $stmt->execute(); + $id = $label = null; + + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[018] Cannot bind integer column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[019] Cannot bind string column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_blobfromsteam.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_blobfromsteam.phpt index bea8773a23..9d6ee3d9b8 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_blobfromsteam.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_blobfromsteam.phpt @@ -28,112 +28,112 @@ unlink($file); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - - function blob_from_stream($offset, $db, $file, $blob) { - - @unlink($file); - clearstatcache(); - if (file_exists($file)) { - printf("[%03d + 1] Cannot remove old test file\n", $offset); - return false; - } - - $fp = fopen($file, 'w'); - if (!$fp || !fwrite($fp, $blob)) { - printf("[%03d + 2] Cannot create test file '%s'\n", $offset, $file); - return false; - } - - fclose($fp); - clearstatcache(); - if (!file_exists($file)) { - printf("[%03d + 3] Failed to create test file '%s'\n", $offset, $file); - return false; - } - - $db->exec('DROP TABLE IF EXISTS test'); - $sql = sprintf('CREATE TABLE test(id INT, label BLOB) ENGINE=%s', PDO_MYSQL_TEST_ENGINE); - $db->exec($sql); - - if (!$stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)')) { - printf("[%03d + 4] %s\n", $offset, var_export($db->errorInfo(), true)); - return false; - } - - $fp = fopen($file, 'r'); - if (!$fp) { - printf("[%03d + 5] Cannot create test file '%s'\n", $offset, $file); - return false; - } - - - $id = 1; - $stmt->bindParam(1, $id); - if (true !== ($tmp = $stmt->bindParam(2, $fp, PDO::PARAM_LOB))) { - printf("[%03d + 6] Expecting true, got %s. %s\n", - $offset, - var_export($tmp, true), - var_export($db->errorInfo(), true)); - return false; - } - - if (true !== $stmt->execute()) { - printf("[%03d + 7] Failed to INSERT data, %s\n", $offset, var_export($stmt->errorInfo(), true)); - return false; - } - - $stmt2 = $db->query('SELECT id, label FROM test WHERE id = 1'); - $row = $stmt2->fetch(PDO::FETCH_ASSOC); - if ($row['label'] != $blob) { - printf("[%03d + 8] INSERT and/or SELECT has failed, dumping data.\n", $offset); - var_dump($row); - var_dump($blob); - return false; - } - - // Lets test the chr(0) handling in case the streaming has failed: - // is the bug about chr(0) or the streaming... - $db->exec('DELETE FROM test'); - $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)'); - $stmt->bindParam(1, $id); - $stmt->bindParam(2, $blob); - if (true !== $stmt->execute()) - printf("[%03d + 9] %s\n", $offset, var_export($stmt->errorInfo(), true)); - - $stmt2 = $db->query('SELECT id, label FROM test WHERE id = 1'); - $row = $stmt2->fetch(PDO::FETCH_ASSOC); - if ($row['label'] != $blob) { - printf("[%03d + 10] INSERT and/or SELECT has failed, dumping data.\n", $offset); - var_dump($row); - var_dump($blob); - return false; - } - - return true; - } - - $db = MySQLPDOTest::factory(); - $blob = 'I am a mighty BLOB!' . chr(0) . "I am a binary thingie!"; - $tmp = MySQLPDOTest::getTempDir(); - $file = $tmp . DIRECTORY_SEPARATOR . 'pdoblob.tst'; - - try { - - printf("Emulated PS...\n"); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); - blob_from_stream(10, $db, $file, $blob); - - printf("Native PS...\n"); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - blob_from_stream(30, $db, $file, $blob); - - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + + function blob_from_stream($offset, $db, $file, $blob) { + + @unlink($file); + clearstatcache(); + if (file_exists($file)) { + printf("[%03d + 1] Cannot remove old test file\n", $offset); + return false; + } + + $fp = fopen($file, 'w'); + if (!$fp || !fwrite($fp, $blob)) { + printf("[%03d + 2] Cannot create test file '%s'\n", $offset, $file); + return false; + } + + fclose($fp); + clearstatcache(); + if (!file_exists($file)) { + printf("[%03d + 3] Failed to create test file '%s'\n", $offset, $file); + return false; + } + + $db->exec('DROP TABLE IF EXISTS test'); + $sql = sprintf('CREATE TABLE test(id INT, label BLOB) ENGINE=%s', PDO_MYSQL_TEST_ENGINE); + $db->exec($sql); + + if (!$stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)')) { + printf("[%03d + 4] %s\n", $offset, var_export($db->errorInfo(), true)); + return false; + } + + $fp = fopen($file, 'r'); + if (!$fp) { + printf("[%03d + 5] Cannot create test file '%s'\n", $offset, $file); + return false; + } + + + $id = 1; + $stmt->bindParam(1, $id); + if (true !== ($tmp = $stmt->bindParam(2, $fp, PDO::PARAM_LOB))) { + printf("[%03d + 6] Expecting true, got %s. %s\n", + $offset, + var_export($tmp, true), + var_export($db->errorInfo(), true)); + return false; + } + + if (true !== $stmt->execute()) { + printf("[%03d + 7] Failed to INSERT data, %s\n", $offset, var_export($stmt->errorInfo(), true)); + return false; + } + + $stmt2 = $db->query('SELECT id, label FROM test WHERE id = 1'); + $row = $stmt2->fetch(PDO::FETCH_ASSOC); + if ($row['label'] != $blob) { + printf("[%03d + 8] INSERT and/or SELECT has failed, dumping data.\n", $offset); + var_dump($row); + var_dump($blob); + return false; + } + + // Lets test the chr(0) handling in case the streaming has failed: + // is the bug about chr(0) or the streaming... + $db->exec('DELETE FROM test'); + $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)'); + $stmt->bindParam(1, $id); + $stmt->bindParam(2, $blob); + if (true !== $stmt->execute()) + printf("[%03d + 9] %s\n", $offset, var_export($stmt->errorInfo(), true)); + + $stmt2 = $db->query('SELECT id, label FROM test WHERE id = 1'); + $row = $stmt2->fetch(PDO::FETCH_ASSOC); + if ($row['label'] != $blob) { + printf("[%03d + 10] INSERT and/or SELECT has failed, dumping data.\n", $offset); + var_dump($row); + var_dump($blob); + return false; + } + + return true; + } + + $db = MySQLPDOTest::factory(); + $blob = 'I am a mighty BLOB!' . chr(0) . "I am a binary thingie!"; + $tmp = MySQLPDOTest::getTempDir(); + $file = $tmp . DIRECTORY_SEPARATOR . 'pdoblob.tst'; + + try { + + printf("Emulated PS...\n"); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); + blob_from_stream(10, $db, $file, $blob); + + printf("Native PS...\n"); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + blob_from_stream(30, $db, $file, $blob); + + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_blobs.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_blobs.phpt index a247de534e..9bdd03d7bd 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_blobs.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_blobs.phpt @@ -8,85 +8,85 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - $blobs = array( - 'TINYBLOB' => 255, - 'TINYTEXT' => 255, - 'BLOB' => 32767, - 'TEXT' => 32767, - 'MEDIUMBLOB' => 100000, - 'MEDIUMTEXT' => 100000, - 'LONGBLOB' => 100000, - 'LONGTEXT' => 100000, - ); + $blobs = array( + 'TINYBLOB' => 255, + 'TINYTEXT' => 255, + 'BLOB' => 32767, + 'TEXT' => 32767, + 'MEDIUMBLOB' => 100000, + 'MEDIUMTEXT' => 100000, + 'LONGBLOB' => 100000, + 'LONGTEXT' => 100000, + ); - function test_blob($db, $offset, $sql_type, $test_len) { + function test_blob($db, $offset, $sql_type, $test_len) { - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec(sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, PDO_MYSQL_TEST_ENGINE)); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec(sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, PDO_MYSQL_TEST_ENGINE)); - $value = str_repeat('a', $test_len); - $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)'); - $stmt->bindValue(1, 1); - $stmt->bindValue(2, $value); - if (!$stmt->execute()) { - printf("[%03d + 1] %d %s\n", - $offset, $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - return false; - } + $value = str_repeat('a', $test_len); + $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)'); + $stmt->bindValue(1, 1); + $stmt->bindValue(2, $value); + if (!$stmt->execute()) { + printf("[%03d + 1] %d %s\n", + $offset, $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + return false; + } - $stmt = $db->query('SELECT id, label FROM test'); - $id = $label = NULL; - $stmt->bindColumn(1, $id, PDO::PARAM_INT); - $stmt->bindColumn(2, $label, PDO::PARAM_LOB); + $stmt = $db->query('SELECT id, label FROM test'); + $id = $label = NULL; + $stmt->bindColumn(1, $id, PDO::PARAM_INT); + $stmt->bindColumn(2, $label, PDO::PARAM_LOB); - if (!$stmt->fetch(PDO::FETCH_BOUND)) { - printf("[%03d + 2] %d %s\n", - $offset, $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - return false; - } + if (!$stmt->fetch(PDO::FETCH_BOUND)) { + printf("[%03d + 2] %d %s\n", + $offset, $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + return false; + } - if ($label !== $value) { - printf("[%03d + 3] Returned value seems to be wrong (%d vs. %d characters). Check manually\n", - $offset, strlen($label), strlen($value)); - return false; - } + if ($label !== $value) { + printf("[%03d + 3] Returned value seems to be wrong (%d vs. %d characters). Check manually\n", + $offset, strlen($label), strlen($value)); + return false; + } - if (1 != $id) { - printf("[%03d + 3] Returned id column value seems wrong, expecting 1 got %s.\n", - $offset, var_export($id, true)); - return false; - } + if (1 != $id) { + printf("[%03d + 3] Returned id column value seems wrong, expecting 1 got %s.\n", + $offset, var_export($id, true)); + return false; + } - $stmt = $db->query('SELECT id, label FROM test'); - $ret = $stmt->fetch(PDO::FETCH_ASSOC); + $stmt = $db->query('SELECT id, label FROM test'); + $ret = $stmt->fetch(PDO::FETCH_ASSOC); - if ($ret['label'] !== $value) { - printf("[%03d + 3] Returned value seems to be wrong (%d vs. %d characters). Check manually\n", - $offset, strlen($ret['label']), strlen($value)); - return false; - } + if ($ret['label'] !== $value) { + printf("[%03d + 3] Returned value seems to be wrong (%d vs. %d characters). Check manually\n", + $offset, strlen($ret['label']), strlen($value)); + return false; + } - if (1 != $ret['id']) { - printf("[%03d + 3] Returned id column value seems wrong, expecting 1 got %s.\n", - $offset, var_export($ret['id'], true)); - return false; - } + if (1 != $ret['id']) { + printf("[%03d + 3] Returned id column value seems wrong, expecting 1 got %s.\n", + $offset, var_export($ret['id'], true)); + return false; + } - return true; - } + return true; + } - $offset = 0; - foreach ($blobs as $sql_type => $test_len) { - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); - test_blob($db, ++$offset, $sql_type, $test_len); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - test_blob($db, ++$offset, $sql_type, $test_len); - } + $offset = 0; + foreach ($blobs as $sql_type => $test_len) { + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); + test_blob($db, ++$offset, $sql_type, $test_len); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + test_blob($db, ++$offset, $sql_type, $test_len); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor.phpt index d0da7a8e16..4125155f6d 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor.phpt @@ -9,140 +9,140 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - /* TODO the results look wrong, why do we get 2014 with buffered AND unbuffered queries */ - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - - function pdo_mysql_stmt_closecursor($db) { - - // This one should fail. I let it fail to prove that closeCursor() makes a difference. - // If no error messages gets printed do not know if proper usage of closeCursor() makes any - // difference or not. That's why we need to cause an error here. - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); - $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); - // query() shall fail! - $stmt2 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); - $stmt1->closeCursor(); - - // This is proper usage of closeCursor(). It shall prevent any further error messages. - if (MySQLPDOTest::isPDOMySQLnd()) { - $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); - } else { - // see pdo_mysql_stmt_unbuffered_2050.phpt for an explanation - unset($stmt1); - $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); - } - // fetch only the first rows and let closeCursor() clean up - $row1 = $stmt1->fetch(PDO::FETCH_ASSOC); - $stmt1->closeCursor(); - - $stmt2 = $db->prepare('UPDATE test SET label = ? WHERE id = ?'); - $stmt2->bindValue(1, "z"); - - $stmt2->bindValue(2, $row1['id']); - $stmt2->execute(); - $stmt2->closeCursor(); - - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); - // check if changing the fetch mode from unbuffered to buffered will - // cause any harm to a statement created prior to the change - $stmt1->execute(); - $row2 = $stmt1->fetch(PDO::FETCH_ASSOC); - $stmt1->closeCursor(); - if (!isset($row2['label']) || ('z' !== $row2['label'])) - printf("Expecting array(id => 1, label => z) got %s\n", var_export($row2, true)); - unset($stmt1); - - $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); - // should work - $stmt2 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); - $stmt1->closeCursor(); - - $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); - // fetch only the first rows and let closeCursor() clean up - $row3 = $stmt1->fetch(PDO::FETCH_ASSOC); - $stmt1->closeCursor(); - assert($row3 == $row2); - - $stmt2 = $db->prepare('UPDATE test SET label = ? WHERE id = ?'); - $stmt2->bindValue(1, "a"); - $stmt2->bindValue(2, $row1['id']); - $stmt2->execute(); - $stmt2->closeCursor(); - - $stmt1->execute(); - $row4 = $stmt1->fetch(PDO::FETCH_ASSOC); - $stmt1->closeCursor(); - assert($row4 == $row1); - - $offset = 0; - $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2'); - $in = 0; - if (!$stmt->bindParam(1, $in)) - printf("[%03d + 1] Cannot bind parameter, %s %s\n", $offset, - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - $stmt->execute(); - $id = $label = null; - - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[%03d + 2] Cannot bind integer column, %s %s\n", $offset, - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[%03d + 3] Cannot bind string column, %s %s\n", $offset, - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); - - $stmt->closeCursor(); - $stmt->execute(); - - } - - - try { - - printf("Testing emulated PS...\n"); - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn on emulated prepared statements\n"); - - printf("Buffered...\n"); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); - MySQLPDOTest::createTestTable($db); - pdo_mysql_stmt_closecursor($db); - - printf("Unbuffered...\n"); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); - MySQLPDOTest::createTestTable($db); - pdo_mysql_stmt_closecursor($db); - - printf("Testing native PS...\n"); - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn off emulated prepared statements\n"); - - printf("Buffered...\n"); - MySQLPDOTest::createTestTable($db); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); - pdo_mysql_stmt_closecursor($db); - - printf("Unbuffered...\n"); - MySQLPDOTest::createTestTable($db); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); - pdo_mysql_stmt_closecursor($db); - - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - - print "done!"; + /* TODO the results look wrong, why do we get 2014 with buffered AND unbuffered queries */ + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + + function pdo_mysql_stmt_closecursor($db) { + + // This one should fail. I let it fail to prove that closeCursor() makes a difference. + // If no error messages gets printed do not know if proper usage of closeCursor() makes any + // difference or not. That's why we need to cause an error here. + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); + $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); + // query() shall fail! + $stmt2 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); + $stmt1->closeCursor(); + + // This is proper usage of closeCursor(). It shall prevent any further error messages. + if (MySQLPDOTest::isPDOMySQLnd()) { + $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); + } else { + // see pdo_mysql_stmt_unbuffered_2050.phpt for an explanation + unset($stmt1); + $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); + } + // fetch only the first rows and let closeCursor() clean up + $row1 = $stmt1->fetch(PDO::FETCH_ASSOC); + $stmt1->closeCursor(); + + $stmt2 = $db->prepare('UPDATE test SET label = ? WHERE id = ?'); + $stmt2->bindValue(1, "z"); + + $stmt2->bindValue(2, $row1['id']); + $stmt2->execute(); + $stmt2->closeCursor(); + + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); + // check if changing the fetch mode from unbuffered to buffered will + // cause any harm to a statement created prior to the change + $stmt1->execute(); + $row2 = $stmt1->fetch(PDO::FETCH_ASSOC); + $stmt1->closeCursor(); + if (!isset($row2['label']) || ('z' !== $row2['label'])) + printf("Expecting array(id => 1, label => z) got %s\n", var_export($row2, true)); + unset($stmt1); + + $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); + // should work + $stmt2 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); + $stmt1->closeCursor(); + + $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC'); + // fetch only the first rows and let closeCursor() clean up + $row3 = $stmt1->fetch(PDO::FETCH_ASSOC); + $stmt1->closeCursor(); + assert($row3 == $row2); + + $stmt2 = $db->prepare('UPDATE test SET label = ? WHERE id = ?'); + $stmt2->bindValue(1, "a"); + $stmt2->bindValue(2, $row1['id']); + $stmt2->execute(); + $stmt2->closeCursor(); + + $stmt1->execute(); + $row4 = $stmt1->fetch(PDO::FETCH_ASSOC); + $stmt1->closeCursor(); + assert($row4 == $row1); + + $offset = 0; + $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2'); + $in = 0; + if (!$stmt->bindParam(1, $in)) + printf("[%03d + 1] Cannot bind parameter, %s %s\n", $offset, + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + $stmt->execute(); + $id = $label = null; + + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[%03d + 2] Cannot bind integer column, %s %s\n", $offset, + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[%03d + 3] Cannot bind string column, %s %s\n", $offset, + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); + + $stmt->closeCursor(); + $stmt->execute(); + + } + + + try { + + printf("Testing emulated PS...\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn on emulated prepared statements\n"); + + printf("Buffered...\n"); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); + MySQLPDOTest::createTestTable($db); + pdo_mysql_stmt_closecursor($db); + + printf("Unbuffered...\n"); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); + MySQLPDOTest::createTestTable($db); + pdo_mysql_stmt_closecursor($db); + + printf("Testing native PS...\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn off emulated prepared statements\n"); + + printf("Buffered...\n"); + MySQLPDOTest::createTestTable($db); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); + pdo_mysql_stmt_closecursor($db); + + printf("Unbuffered...\n"); + MySQLPDOTest::createTestTable($db); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); + pdo_mysql_stmt_closecursor($db); + + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor_empty.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor_empty.phpt index 77f663584a..e732ed5e34 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor_empty.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor_empty.phpt @@ -9,57 +9,57 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - try { + try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn off emulated prepared statements\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn off emulated prepared statements\n"); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); - MySQLPDOTest::createTestTable($db); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); + MySQLPDOTest::createTestTable($db); - $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2'); - $in = 0; - if (!$stmt->bindParam(1, $in)) - printf("[003] Cannot bind parameter, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2'); + $in = 0; + if (!$stmt->bindParam(1, $in)) + printf("[003] Cannot bind parameter, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - $stmt->execute(); - $id = $label = null; + $stmt->execute(); + $id = $label = null; - if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) - printf("[004] Cannot bind integer column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT)) + printf("[004] Cannot bind integer column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) - printf("[005] Cannot bind string column, %s %s\n", - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR)) + printf("[005] Cannot bind string column, %s %s\n", + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); - $stmt->closeCursor(); - $stmt->execute(); - while ($stmt->fetch(PDO::FETCH_BOUND)) - printf("in = %d -> id = %s (%s) / label = %s (%s)\n", - $in, - var_export($id, true), gettype($id), - var_export($label, true), gettype($label)); + $stmt->closeCursor(); + $stmt->execute(); + while ($stmt->fetch(PDO::FETCH_BOUND)) + printf("in = %d -> id = %s (%s) / label = %s (%s)\n", + $in, + var_export($id, true), gettype($id), + var_export($label, true), gettype($label)); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - $db->exec('DROP TABLE IF EXISTS test'); - print "done!"; + $db->exec('DROP TABLE IF EXISTS test'); + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt index a701469ed1..2c4de9f87c 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt @@ -9,50 +9,50 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); - // The only purpose of this is to check if emulated and native PS + // The only purpose of this is to check if emulated and native PS // return the same. If it works for one, it should work for all. - // Internal data structures should be the same in both cases. - printf("Testing emulated PS...\n"); - try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn on emulated prepared statements\n"); + // Internal data structures should be the same in both cases. + printf("Testing emulated PS...\n"); + try { + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn on emulated prepared statements\n"); - $stmt = $db->prepare("SELECT id, label, '?' as foo FROM test"); - $stmt->execute(); - var_dump($stmt->columnCount()); + $stmt = $db->prepare("SELECT id, label, '?' as foo FROM test"); + $stmt->execute(); + var_dump($stmt->columnCount()); - $stmt = $db->query('SELECT * FROM test'); - var_dump($stmt->columnCount()); + $stmt = $db->query('SELECT * FROM test'); + var_dump($stmt->columnCount()); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - printf("Testing native PS...\n"); - try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[004] Unable to turn off emulated prepared statements\n"); + printf("Testing native PS...\n"); + try { + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[004] Unable to turn off emulated prepared statements\n"); - $stmt = $db->prepare("SELECT id, label, '?' as foo, 'TODO - Stored Procedure' as bar FROM test"); - $stmt->execute(); - var_dump($stmt->columnCount()); + $stmt = $db->prepare("SELECT id, label, '?' as foo, 'TODO - Stored Procedure' as bar FROM test"); + $stmt->execute(); + var_dump($stmt->columnCount()); - $stmt = $db->query('SELECT * FROM test'); - var_dump($stmt->columnCount()); + $stmt = $db->query('SELECT * FROM test'); + var_dump($stmt->columnCount()); - } catch (PDOException $e) { - printf("[003] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[003] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt index f77ba60f75..cfd30a635d 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt @@ -9,43 +9,43 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - $db->exec('DROP TABLE IF EXISTS ihopeitdoesnotexist'); + $db->exec('DROP TABLE IF EXISTS ihopeitdoesnotexist'); - printf("Testing emulated PS...\n"); - try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn on emulated prepared statements\n"); + printf("Testing emulated PS...\n"); + try { + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn on emulated prepared statements\n"); - $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC'); - $stmt->execute(); - var_dump($stmt->errorCode()); + $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC'); + $stmt->execute(); + var_dump($stmt->errorCode()); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - printf("Testing native PS...\n"); - try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[004] Unable to turn off emulated prepared statements\n"); + printf("Testing native PS...\n"); + try { + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[004] Unable to turn off emulated prepared statements\n"); - $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC'); - $stmt->execute(); - var_dump($stmt->errorCode()); + $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC'); + $stmt->execute(); + var_dump($stmt->errorCode()); - } catch (PDOException $e) { - printf("[003] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[003] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --EXPECTF-- Testing emulated PS... diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt index e9dbeab3a6..b876628e25 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt @@ -9,55 +9,55 @@ $db = MySQLPDOTest::factory(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); - printf("Testing emulated PS...\n"); - try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn on emulated prepared statements\n"); + printf("Testing emulated PS...\n"); + try { + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn on emulated prepared statements\n"); - $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC'); - var_dump($stmt->errorInfo()); - $stmt->execute(); - var_dump($stmt->errorInfo()); + $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC'); + var_dump($stmt->errorInfo()); + $stmt->execute(); + var_dump($stmt->errorInfo()); - MySQLPDOTest::createTestTable($db); - $stmt = $db->prepare('SELECT label FROM test ORDER BY id ASC LIMIT 1'); - $db->exec('DROP TABLE test'); - var_dump($stmt->execute()); - var_dump($stmt->errorInfo()); - var_dump($db->errorInfo()); + MySQLPDOTest::createTestTable($db); + $stmt = $db->prepare('SELECT label FROM test ORDER BY id ASC LIMIT 1'); + $db->exec('DROP TABLE test'); + var_dump($stmt->execute()); + var_dump($stmt->errorInfo()); + var_dump($db->errorInfo()); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo())); + } - printf("Testing native PS...\n"); - try { - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[004] Unable to turn off emulated prepared statements\n"); + printf("Testing native PS...\n"); + try { + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[004] Unable to turn off emulated prepared statements\n"); - $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC'); - var_dump($stmt); + $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC'); + var_dump($stmt); - MySQLPDOTest::createTestTable($db); - $stmt = $db->prepare('SELECT label FROM test ORDER BY id ASC LIMIT 1'); - var_dump($stmt->errorInfo()); - $db->exec('DROP TABLE test'); - $stmt->execute(); - var_dump($stmt->errorInfo()); - var_dump($db->errorInfo()); + MySQLPDOTest::createTestTable($db); + $stmt = $db->prepare('SELECT label FROM test ORDER BY id ASC LIMIT 1'); + var_dump($stmt->errorInfo()); + $db->exec('DROP TABLE test'); + $stmt->execute(); + var_dump($stmt->errorInfo()); + var_dump($db->errorInfo()); - } catch (PDOException $e) { - printf("[003] %s [%s] %s\n", - $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo())); - } - print "done!"; + } catch (PDOException $e) { + printf("[003] %s [%s] %s\n", + $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo())); + } + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt index 46ab4f911c..8e414a6c16 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt @@ -8,179 +8,179 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); - - try { - - // Emulated PS first - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); - if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn on emulated prepared statements\n"); - - if (!is_object($stmt = $db->query('DESCRIBE test id'))) - printf("[003] Emulated PS, DESCRIBE failed, %s\n", var_export($db->errorInfo(), true)); - - $describe = array(); - $valid = false; - while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { - $describe[] = $row; - foreach ($row as $column => $value) - if (isset($row['field']) && ($row['field'] == 'id')) - $valid = true; - } - if (empty($describe)) - printf("[004] Emulated PS, DESCRIBE returned no results\n"); - else if (!$valid) - printf("[005] Emulated PS, DESCRIBE, returned data seems wrong, dumping %s\n", - var_export($describe, true)); - - if (!is_object($stmt = $db->query('SHOW ENGINES'))) - printf("[006] Emulated PS, SHOW failed, %s\n", var_export($db->errorInfo(), true)); - - $show = array(); - $valid = false; - while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { - $show[] = $row; - foreach ($row as $column => $value) - // MyISAM engine should be part of _every_ MySQL today - if ($value == 'MyISAM') - $valid = true; - } - if (empty($show)) - printf("[007] Emulated PS, SHOW returned no results\n"); - else if (!$valid) - printf("[008] Emulated PS, SHOW data seems wrong, dumping %s\n", - var_export($show, true)); - - if (!is_object($stmt = $db->query("EXPLAIN SELECT id FROM test"))) - printf("[009] Emulated PS, EXPLAIN returned no results\n"); - - $explain = array(); - while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) - $explain[] = $row; - - if (empty($explain)) - printf("[010] Emulated PS, EXPLAIN returned no results\n"); - - // And now native PS - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[011] Unable to turn off emulated prepared statements\n"); - - $native_support = 'no'; - if ($db->exec("PREPARE mystmt FROM 'DESCRIBE test id'")) { - $native_support = 'yes'; - $db->exec('DEALLOCATE PREPARE mystmt'); - } - - if (!is_object($stmt = $db->query('DESCRIBE test id'))) - printf("[012] Native PS (native support: %s), DESCRIBE failed, %s\n", - $native_support, - var_export($db->errorInfo(), true)); - - $describe_native = array(); - $valid = false; - while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { - $describe_native[] = $row; - foreach ($row as $column => $value) - if (isset($row['field']) && ($row['field'] == 'id')) - $valid = true; - } - if (empty($describe_native)) - printf("[013] Native PS (native support: %s), DESCRIBE returned no results\n", - $native_support); - else if (!$valid) - printf("[014] Native PS (native support: %s), DESCRIBE, returned data seems wrong, dumping %s\n", - $native_support, - var_export($describe_native, true)); - - if ($describe != $describe_native) - printf("[015] Emulated and native PS (native support: %s) results of DESCRIBE differ: %s vs. %s\n", - $native_support, - var_export($describe, true), - var_export($describe_native, true)); - - - $native_support = 'no'; - if ($db->exec("PREPARE mystmt FROM 'SHOW ENGINES'")) { - $native_support = 'yes'; - $db->exec('DEALLOCATE PREPARE mystmt'); - } - - if (!is_object($stmt = $db->query('SHOW ENGINES'))) - printf("[016] Native PS (native support: %s), SHOW failed, %s\n", - $native_support, - var_export($db->errorInfo(), true)); - - $show_native = array(); - $valid = false; - while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { - $show_native[] = $row; - foreach ($row as $column => $value) - // MyISAM engine should be part of _every_ MySQL today - if ($value == 'MyISAM') - $valid = true; - } - if (empty($show_native)) - printf("[017] Native PS (native support: %s), SHOW returned no results\n", - $native_support); - else if (!$valid) - printf("[018] Native PS (native support: %s), SHOW data seems wrong, dumping %s\n", - var_export($show_native, true)); - - if ($show != $show_native) - printf("Native PS (native support: %s) and emulated PS returned different data for SHOW: %s vs. %s\n", - $native_support, - var_export($show, true), - var_export($show_native, true)); - - $native_support = 'no'; - if ($db->exec("PREPARE mystmt FROM 'EXPLAIN SELECT id FROM test'")) { - $native_support = 'yes'; - $db->exec('DEALLOCATE PREPARE mystmt'); - } - - if (!is_object($stmt = $db->query("EXPLAIN SELECT id FROM test"))) - printf("[012] Native PS (native support: %s), EXPLAIN failed, %s\n", - $native_support, - var_export($db->errorInfo(), true)); - - $explain_native = array(); - while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) - $explain_native[] = $row; - - if (empty($explain_native)) - printf("[013] Native PS (native support: %s), EXPLAIN returned no results\n", - $native_support); - - if ($explain != $explain_native) - printf("Native PS (native support: %s) and emulated PS returned different data for EXPLAIN: %s vs. %s\n", - $native_support, - var_export($explain, true), - var_export($explain_native, true)); - - $stmt->execute(); - $explain_native = $stmt->fetchAll(PDO::FETCH_ASSOC); - if ($explain != $explain_native) - printf("Native PS (native support: %s) and emulated PS returned different data for EXPLAIN: %s vs. %s\n", - $native_support, - var_export($explain, true), - var_export($explain_native, true)); - - $stmt->execute(); - $stmt->execute(); - // libmysql needs this - otherwise we get a 2015 error - if (!MYSQLPDOTest::isPDOMySQLnd()) - $stmt->fetchAll(PDO::FETCH_ASSOC); - - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - - print "done!\n"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); + + try { + + // Emulated PS first + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1); + if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn on emulated prepared statements\n"); + + if (!is_object($stmt = $db->query('DESCRIBE test id'))) + printf("[003] Emulated PS, DESCRIBE failed, %s\n", var_export($db->errorInfo(), true)); + + $describe = array(); + $valid = false; + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + $describe[] = $row; + foreach ($row as $column => $value) + if (isset($row['field']) && ($row['field'] == 'id')) + $valid = true; + } + if (empty($describe)) + printf("[004] Emulated PS, DESCRIBE returned no results\n"); + else if (!$valid) + printf("[005] Emulated PS, DESCRIBE, returned data seems wrong, dumping %s\n", + var_export($describe, true)); + + if (!is_object($stmt = $db->query('SHOW ENGINES'))) + printf("[006] Emulated PS, SHOW failed, %s\n", var_export($db->errorInfo(), true)); + + $show = array(); + $valid = false; + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + $show[] = $row; + foreach ($row as $column => $value) + // MyISAM engine should be part of _every_ MySQL today + if ($value == 'MyISAM') + $valid = true; + } + if (empty($show)) + printf("[007] Emulated PS, SHOW returned no results\n"); + else if (!$valid) + printf("[008] Emulated PS, SHOW data seems wrong, dumping %s\n", + var_export($show, true)); + + if (!is_object($stmt = $db->query("EXPLAIN SELECT id FROM test"))) + printf("[009] Emulated PS, EXPLAIN returned no results\n"); + + $explain = array(); + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) + $explain[] = $row; + + if (empty($explain)) + printf("[010] Emulated PS, EXPLAIN returned no results\n"); + + // And now native PS + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[011] Unable to turn off emulated prepared statements\n"); + + $native_support = 'no'; + if ($db->exec("PREPARE mystmt FROM 'DESCRIBE test id'")) { + $native_support = 'yes'; + $db->exec('DEALLOCATE PREPARE mystmt'); + } + + if (!is_object($stmt = $db->query('DESCRIBE test id'))) + printf("[012] Native PS (native support: %s), DESCRIBE failed, %s\n", + $native_support, + var_export($db->errorInfo(), true)); + + $describe_native = array(); + $valid = false; + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + $describe_native[] = $row; + foreach ($row as $column => $value) + if (isset($row['field']) && ($row['field'] == 'id')) + $valid = true; + } + if (empty($describe_native)) + printf("[013] Native PS (native support: %s), DESCRIBE returned no results\n", + $native_support); + else if (!$valid) + printf("[014] Native PS (native support: %s), DESCRIBE, returned data seems wrong, dumping %s\n", + $native_support, + var_export($describe_native, true)); + + if ($describe != $describe_native) + printf("[015] Emulated and native PS (native support: %s) results of DESCRIBE differ: %s vs. %s\n", + $native_support, + var_export($describe, true), + var_export($describe_native, true)); + + + $native_support = 'no'; + if ($db->exec("PREPARE mystmt FROM 'SHOW ENGINES'")) { + $native_support = 'yes'; + $db->exec('DEALLOCATE PREPARE mystmt'); + } + + if (!is_object($stmt = $db->query('SHOW ENGINES'))) + printf("[016] Native PS (native support: %s), SHOW failed, %s\n", + $native_support, + var_export($db->errorInfo(), true)); + + $show_native = array(); + $valid = false; + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + $show_native[] = $row; + foreach ($row as $column => $value) + // MyISAM engine should be part of _every_ MySQL today + if ($value == 'MyISAM') + $valid = true; + } + if (empty($show_native)) + printf("[017] Native PS (native support: %s), SHOW returned no results\n", + $native_support); + else if (!$valid) + printf("[018] Native PS (native support: %s), SHOW data seems wrong, dumping %s\n", + var_export($show_native, true)); + + if ($show != $show_native) + printf("Native PS (native support: %s) and emulated PS returned different data for SHOW: %s vs. %s\n", + $native_support, + var_export($show, true), + var_export($show_native, true)); + + $native_support = 'no'; + if ($db->exec("PREPARE mystmt FROM 'EXPLAIN SELECT id FROM test'")) { + $native_support = 'yes'; + $db->exec('DEALLOCATE PREPARE mystmt'); + } + + if (!is_object($stmt = $db->query("EXPLAIN SELECT id FROM test"))) + printf("[012] Native PS (native support: %s), EXPLAIN failed, %s\n", + $native_support, + var_export($db->errorInfo(), true)); + + $explain_native = array(); + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) + $explain_native[] = $row; + + if (empty($explain_native)) + printf("[013] Native PS (native support: %s), EXPLAIN returned no results\n", + $native_support); + + if ($explain != $explain_native) + printf("Native PS (native support: %s) and emulated PS returned different data for EXPLAIN: %s vs. %s\n", + $native_support, + var_export($explain, true), + var_export($explain_native, true)); + + $stmt->execute(); + $explain_native = $stmt->fetchAll(PDO::FETCH_ASSOC); + if ($explain != $explain_native) + printf("Native PS (native support: %s) and emulated PS returned different data for EXPLAIN: %s vs. %s\n", + $native_support, + var_export($explain, true), + var_export($explain_native, true)); + + $stmt->execute(); + $stmt->execute(); + // libmysql needs this - otherwise we get a 2015 error + if (!MYSQLPDOTest::isPDOMySQLnd()) + $stmt->fetchAll(PDO::FETCH_ASSOC); + + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + + print "done!\n"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt index d0a889a6d4..d1c00f1aa3 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt @@ -8,110 +8,110 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - try { - - class myclass implements Serializable { - - private static $instance = null; - protected $myprotected = 'a protected property'; - - // Good old magic stuff - private function __construct($caller = NULL) { - printf("%s(%s)\n", __METHOD__, $caller); - } - - - public function __destruct() { - // printf("%s()\n", __METHOD__); - } - - public function __sleep() { - printf("%s()\n", __METHOD__); - } - - public function __wakeup() { - printf("%s()\n", __METHOD__); - } - - public function __call($method, $params) { - printf("%s(%s, %s)\n", __METHOD__, $method, var_export($params, true)); - } - - public function __set($prop, $value) { - printf("%s(%s, %s)\n", __METHOD__, $prop, var_export($value, true)); - $this->{$prop} = $value; - } - - public function __get($prop) { - printf("%s(%s)\n", __METHOD__, $prop); - return NULL; - } - - // Singleton - public static function singleton($caller) { - printf("%s(%s)\n", __METHOD__, $caller); - - if (!self::$instance) { - $c = __CLASS__; - self::$instance = new $c($caller); - } - return self::$instance; - } - - // Serializable - public function serialize() { - printf("%s()\n", __METHOD__); - return 'Data from serialize'; - } - - public function unserialize($data) { - printf("%s(%s)\n", __METHOD__, var_export($data, true)); - } - - } - - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[002] Unable to turn off emulated prepared statements\n"); - - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec(sprintf('CREATE TABLE test(id INT, myobj BLOB) ENGINE=%s', - MySQLPDOTest::getTableEngine())); - - printf("Creating an object, serializing it and writing it to DB...\n"); - $id = 1; - $obj = myclass::singleton('Creating object'); - $myobj = serialize($obj); - $stmt = $db->prepare('INSERT INTO test(id, myobj) VALUES (?, ?)'); - $stmt->bindValue(1, $id); - $stmt->bindValue(2, $myobj); - $stmt->execute(); - - printf("\nUnserializing the previously serialized object...\n"); - var_dump(unserialize($myobj)); - - printf("\nUsing PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE to fetch the object from DB and unserialize it...\n"); - $stmt = $db->prepare('SELECT myobj FROM test'); - $stmt->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass', array('PDO shall not call __construct()')); - $stmt->execute(); - var_dump($stmt->fetch()); - - printf("\nUsing PDO::FETCH_CLASS to fetch the object from DB and unserialize it...\n"); - $stmt = $db->prepare('SELECT myobj FROM test'); - $stmt->setFetchMode(PDO::FETCH_CLASS, 'myclass', array('PDO shall call __construct()')); - $stmt->execute(); - var_dump($stmt->fetch()); - - - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + try { + + class myclass implements Serializable { + + private static $instance = null; + protected $myprotected = 'a protected property'; + + // Good old magic stuff + private function __construct($caller = NULL) { + printf("%s(%s)\n", __METHOD__, $caller); + } + + + public function __destruct() { + // printf("%s()\n", __METHOD__); + } + + public function __sleep() { + printf("%s()\n", __METHOD__); + } + + public function __wakeup() { + printf("%s()\n", __METHOD__); + } + + public function __call($method, $params) { + printf("%s(%s, %s)\n", __METHOD__, $method, var_export($params, true)); + } + + public function __set($prop, $value) { + printf("%s(%s, %s)\n", __METHOD__, $prop, var_export($value, true)); + $this->{$prop} = $value; + } + + public function __get($prop) { + printf("%s(%s)\n", __METHOD__, $prop); + return NULL; + } + + // Singleton + public static function singleton($caller) { + printf("%s(%s)\n", __METHOD__, $caller); + + if (!self::$instance) { + $c = __CLASS__; + self::$instance = new $c($caller); + } + return self::$instance; + } + + // Serializable + public function serialize() { + printf("%s()\n", __METHOD__); + return 'Data from serialize'; + } + + public function unserialize($data) { + printf("%s(%s)\n", __METHOD__, var_export($data, true)); + } + + } + + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[002] Unable to turn off emulated prepared statements\n"); + + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec(sprintf('CREATE TABLE test(id INT, myobj BLOB) ENGINE=%s', + MySQLPDOTest::getTableEngine())); + + printf("Creating an object, serializing it and writing it to DB...\n"); + $id = 1; + $obj = myclass::singleton('Creating object'); + $myobj = serialize($obj); + $stmt = $db->prepare('INSERT INTO test(id, myobj) VALUES (?, ?)'); + $stmt->bindValue(1, $id); + $stmt->bindValue(2, $myobj); + $stmt->execute(); + + printf("\nUnserializing the previously serialized object...\n"); + var_dump(unserialize($myobj)); + + printf("\nUsing PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE to fetch the object from DB and unserialize it...\n"); + $stmt = $db->prepare('SELECT myobj FROM test'); + $stmt->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass', array('PDO shall not call __construct()')); + $stmt->execute(); + var_dump($stmt->fetch()); + + printf("\nUsing PDO::FETCH_CLASS to fetch the object from DB and unserialize it...\n"); + $stmt = $db->prepare('SELECT myobj FROM test'); + $stmt->setFetchMode(PDO::FETCH_CLASS, 'myclass', array('PDO shall call __construct()')); + $stmt->execute(); + var_dump($stmt->fetch()); + + + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!\n"; + print "done!\n"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt index bfc907dbcb..07c9205796 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt @@ -8,65 +8,65 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); - try { + try { - class myclass implements Serializable { + class myclass implements Serializable { - public function __construct($caller = null) { - printf("%s(%s) - note that it must not be called when unserializing\n", __METHOD__, var_export($caller, true)); - } + public function __construct($caller = null) { + printf("%s(%s) - note that it must not be called when unserializing\n", __METHOD__, var_export($caller, true)); + } - public function __set($prop, $value) { - printf("%s(%s, %s)\n", __METHOD__, var_export($prop, true), var_export($value, true)); - $this->{$prop} = $value; - } + public function __set($prop, $value) { + printf("%s(%s, %s)\n", __METHOD__, var_export($prop, true), var_export($value, true)); + $this->{$prop} = $value; + } - public function serialize() { - printf("%s()\n", __METHOD__); - return 'Value from serialize()'; - } + public function serialize() { + printf("%s()\n", __METHOD__); + return 'Value from serialize()'; + } - public function unserialize($data) { - printf("%s(%s)\n", __METHOD__, var_export($data, true)); - } + public function unserialize($data) { + printf("%s(%s)\n", __METHOD__, var_export($data, true)); + } - } + } - printf("Lets see what the Serializeable interface makes our object behave like...\n"); - $obj = new myclass('Called by script'); - $tmp = unserialize(serialize($obj)); - var_dump($tmp); + printf("Lets see what the Serializeable interface makes our object behave like...\n"); + $obj = new myclass('Called by script'); + $tmp = unserialize(serialize($obj)); + var_dump($tmp); - printf("\nAnd now magic PDO using fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE)...\n"); - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec(sprintf('CREATE TABLE test(myobj BLOB) ENGINE=%s', MySQLPDOTest::getTableEngine())); - $db->exec("INSERT INTO test(myobj) VALUES ('Data fetched from DB to be given to unserialize()')"); + printf("\nAnd now magic PDO using fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE)...\n"); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec(sprintf('CREATE TABLE test(myobj BLOB) ENGINE=%s', MySQLPDOTest::getTableEngine())); + $db->exec("INSERT INTO test(myobj) VALUES ('Data fetched from DB to be given to unserialize()')"); - $stmt = $db->prepare('SELECT myobj FROM test'); - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass', array('Called by PDO')); - var_dump($rows[0]); + $stmt = $db->prepare('SELECT myobj FROM test'); + $stmt->execute(); + $rows = $stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass', array('Called by PDO')); + var_dump($rows[0]); - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass'); - var_dump($rows[0]); + $stmt->execute(); + $rows = $stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass'); + var_dump($rows[0]); - printf("\nAnd now PDO using setFetchMode(PDO::FETCH:CLASS|PDO::FETCH_SERIALIZE) + fetch()...\n"); - $stmt = $db->prepare('SELECT myobj FROM test'); - $stmt->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass', array('Called by PDO')); - $stmt->execute(); - var_dump($stmt->fetch()); + printf("\nAnd now PDO using setFetchMode(PDO::FETCH:CLASS|PDO::FETCH_SERIALIZE) + fetch()...\n"); + $stmt = $db->prepare('SELECT myobj FROM test'); + $stmt->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass', array('Called by PDO')); + $stmt->execute(); + var_dump($stmt->fetch()); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - $db->exec('DROP TABLE IF EXISTS test'); - print "done!\n"; + $db->exec('DROP TABLE IF EXISTS test'); + print "done!\n"; ?> --EXPECTF-- Lets see what the Serializeable interface makes our object behave like... diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt index ae14c056f3..9760682358 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt @@ -25,52 +25,52 @@ MySQLPDOTest::createTestTable($db); try { - $query = "SELECT id, '', NULL, \"\" FROM test ORDER BY id ASC LIMIT 3"; - $stmt = $db->prepare($query); + $query = "SELECT id, '', NULL, \"\" FROM test ORDER BY id ASC LIMIT 3"; + $stmt = $db->prepare($query); - class myclass { + class myclass { - private $set_calls = 0; - protected static $static_set_calls = 0; + private $set_calls = 0; + protected static $static_set_calls = 0; - // NOTE: PDO does not care about protected - protected $grp; + // NOTE: PDO does not care about protected + protected $grp; - // NOTE: PDO does not care about private and calls __construct() after __set() - private function __construct($param1, $param2) { - printf("myclass::__construct(%s, %s): %d / %d\n", - $param1, $param2, - self::$static_set_calls, $this->set_calls); - } + // NOTE: PDO does not care about private and calls __construct() after __set() + private function __construct($param1, $param2) { + printf("myclass::__construct(%s, %s): %d / %d\n", + $param1, $param2, + self::$static_set_calls, $this->set_calls); + } - // NOTE: PDO will call __set() prior to calling __construct() - public function __set($prop, $value) { - $this->not_a_magic_one(); - printf("myclass::__set(%s, -%s-) %d\n", - $prop, var_export($value, true), $this->set_calls, self::$static_set_calls); - if ("" != $prop) - $this->{$prop} = $value; - } + // NOTE: PDO will call __set() prior to calling __construct() + public function __set($prop, $value) { + $this->not_a_magic_one(); + printf("myclass::__set(%s, -%s-) %d\n", + $prop, var_export($value, true), $this->set_calls, self::$static_set_calls); + if ("" != $prop) + $this->{$prop} = $value; + } - // NOTE: PDO can call regular methods prior to calling __construct() - public function not_a_magic_one() { - $this->set_calls++; - self::$static_set_calls++; - } + // NOTE: PDO can call regular methods prior to calling __construct() + public function not_a_magic_one() { + $this->set_calls++; + self::$static_set_calls++; + } - } - $stmt->execute(); - $rowno = 0; - $rows[] = array(); - while (is_object($rows[] = $stmt->fetchObject('myclass', array($rowno++, $rowno)))) - ; + } + $stmt->execute(); + $rowno = 0; + $rows[] = array(); + while (is_object($rows[] = $stmt->fetchObject('myclass', array($rowno++, $rowno)))) + ; - var_dump($rows[$rowno - 1]); + var_dump($rows[$rowno - 1]); } catch (PDOException $e) { - // we should never get here, we use warnings, but never trust a system... - printf("[001] %s, [%s} %s\n", - $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo())); + // we should never get here, we use warnings, but never trust a system... + printf("[001] %s, [%s} %s\n", + $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo())); } print "done!"; diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt index 5ac683ea48..3526b35c24 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt @@ -22,277 +22,277 @@ MySQLPDOTest::createTestTable($db); try { - $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC'); - - // execute() has not been called yet - // NOTE: no warning - if (false !== ($tmp = $stmt->getColumnMeta(0))) - printf("[002] Expecting false got %s\n", var_export($tmp, true)); - - $stmt->execute(); - - // invalid offset - if (false !== ($tmp = @$stmt->getColumnMeta(-1))) - printf("[004] Expecting false got %s\n", var_export($tmp, true)); - - $emulated = $stmt->getColumnMeta(0); - - printf("Testing native PS...\n"); - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[007] Unable to turn off emulated prepared statements\n"); - - $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC'); - $stmt->execute(); - $native = $stmt->getColumnMeta(0); - if (count($native) == 0) { - printf("[008] Meta data seems wrong, %s / %s\n", - var_export($native, true), var_export($emulated, true)); - } - - // invalid offset - if (false !== ($tmp = $stmt->getColumnMeta(1))) - printf("[009] Expecting false because of invalid offset got %s\n", var_export($tmp, true)); - - - function test_meta(&$db, $offset, $sql_type, $value, $native_type, $pdo_type) { - - $db->exec('DROP TABLE IF EXISTS test'); - - $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine()); - if (!($stmt = @$db->prepare($sql)) || (!@$stmt->execute())) { - // Some engines and/or MySQL server versions might not support the data type - return true; - } - - if (!$db->exec(sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $value))) { - printf("[%03d] + 1] Insert failed, %d - %s\n", $offset, - $db->errorCode(), var_export($db->errorInfo(), true)); - return false; - } - - $stmt = $db->prepare('SELECT id, label FROM test'); - $stmt->execute(); - $meta = $stmt->getColumnMeta(1); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - - if (empty($meta)) { - printf("[%03d + 2] getColumnMeta() failed, %d - %s\n", $offset, - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - return false; - } - - $elements = array('flags', 'table', 'name', 'len', 'precision', 'pdo_type'); - foreach ($elements as $k => $element) - if (!isset($meta[$element])) { - printf("[%03d + 3] Element %s missing, %s\n", $offset, - $element, var_export($meta, true)); - return false; - } - - if (($meta['table'] != 'test') || ($meta['name'] != 'label')) { - printf("[%03d + 4] Table or field name is wrong, %s\n", $offset, - var_export($meta, true)); - return false; - } - - if (!is_null($native_type)) { - if (!isset($meta['native_type'])) { - printf("[%03d + 5] Element native_type missing, %s\n", $offset, - var_export($meta, true)); - return false; - } - - if (!is_array($native_type)) - $native_type = array($native_type); - - $found = false; - foreach ($native_type as $k => $type) { - if ($meta['native_type'] == $type) { - $found = true; - break; - } - } - - if (!$found) { - printf("[%03d + 6] Expecting native type %s, %s\n", $offset, - var_export($native_type, true), var_export($meta, true)); - return false; - } - } - - if (!is_null($pdo_type) && ($meta['pdo_type'] != $pdo_type)) { - printf("[%03d + 6] Expecting PDO type %s got %s (%s)\n", $offset, - $pdo_type, var_export($meta, true), var_export($meta['native_type'])); - return false; - } - - return true; - } - - $stmt = $db->prepare('SELECT @@sql_mode AS _mode'); - $stmt->execute(); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $real_as_float = (false === stristr($row['_mode'], "REAL_AS_FLOAT")) ? false : true; - - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); - $is_mysqlnd = MySQLPDOTest::isPDOMySQLnd(); - test_meta($db, 20, 'BIT(8)', 1, 'BIT', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); - test_meta($db, 30, 'TINYINT', -127, 'TINY', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); - test_meta($db, 40, 'TINYINT UNSIGNED', 255, 'TINY', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); - test_meta($db, 50, 'BOOLEAN', 1, NULL, ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); - - test_meta($db, 60, 'SMALLINT', -32768, 'SHORT', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); - test_meta($db, 70, 'SMALLINT UNSIGNED', 65535, 'SHORT', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); - - test_meta($db, 80, 'MEDIUMINT', -8388608, 'INT24', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); - test_meta($db, 90, 'MEDIUMINT UNSIGNED', 16777215, 'INT24', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); - - test_meta($db, 100, 'INT', -2147483648, 'LONG', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); - test_meta($db, 110, 'INT UNSIGNED', 4294967295, 'LONG', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); - - test_meta($db, 120, 'BIGINT', '-9223372036854775808', 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR); - test_meta($db, 130, 'BIGINT UNSIGNED', '18446744073709551615', 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR); - - test_meta($db, 130, 'REAL', -1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR); - test_meta($db, 140, 'REAL UNSIGNED', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR); - test_meta($db, 150, 'REAL ZEROFILL', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR); - test_meta($db, 160, 'REAL UNSIGNED ZEROFILL', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR); - - test_meta($db, 170, 'DOUBLE', -1.01, 'DOUBLE', PDO::PARAM_STR); - test_meta($db, 180, 'DOUBLE UNSIGNED', 1.01, 'DOUBLE', PDO::PARAM_STR); - test_meta($db, 190, 'DOUBLE ZEROFILL', 1.01, 'DOUBLE', PDO::PARAM_STR); - test_meta($db, 200, 'DOUBLE UNSIGNED ZEROFILL', 1.01, 'DOUBLE', PDO::PARAM_STR); - - test_meta($db, 210, 'FLOAT', -1.01, 'FLOAT', PDO::PARAM_STR); - test_meta($db, 220, 'FLOAT UNSIGNED', 1.01, 'FLOAT', PDO::PARAM_STR); - test_meta($db, 230, 'FLOAT ZEROFILL', 1.01, 'FLOAT', PDO::PARAM_STR); - test_meta($db, 240, 'FLOAT UNSIGNED ZEROFILL', 1.01, 'FLOAT', PDO::PARAM_STR); - - test_meta($db, 250, 'DECIMAL', -1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); - test_meta($db, 260, 'DECIMAL UNSIGNED', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); - test_meta($db, 270, 'DECIMAL ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); - test_meta($db, 280, 'DECIMAL UNSIGNED ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); - - test_meta($db, 290, 'NUMERIC', -1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); - test_meta($db, 300, 'NUMERIC UNSIGNED', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); - test_meta($db, 310, 'NUMERIC ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); - test_meta($db, 320, 'NUMERIC UNSIGNED ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); - - test_meta($db, 330, 'DATE', '2008-04-23', array('DATE', 'NEWDATE'), PDO::PARAM_STR); - test_meta($db, 340, 'TIME', '14:37:00', 'TIME', PDO::PARAM_STR); - test_meta($db, 350, 'TIMESTAMP', '2008-03-23 14:38:00', 'TIMESTAMP', PDO::PARAM_STR); - test_meta($db, 360, 'DATETIME', '2008-03-23 14:38:00', 'DATETIME', PDO::PARAM_STR); - test_meta($db, 370, 'YEAR', '2008', 'YEAR', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); - - test_meta($db, 380, 'CHAR(1)', 'a', 'STRING', PDO::PARAM_STR); - test_meta($db, 390, 'CHAR(10)', '0123456789', 'STRING', PDO::PARAM_STR); - test_meta($db, 400, 'CHAR(255)', str_repeat('z', 255), 'STRING', PDO::PARAM_STR); - test_meta($db, 410, 'VARCHAR(1)', 'a', 'VAR_STRING', PDO::PARAM_STR); - test_meta($db, 420, 'VARCHAR(10)', '0123456789', 'VAR_STRING', PDO::PARAM_STR); - test_meta($db, 430, 'VARCHAR(255)', str_repeat('z', 255), 'VAR_STRING', PDO::PARAM_STR); - - test_meta($db, 440, 'BINARY(1)', str_repeat('a', 1), 'STRING', PDO::PARAM_STR); - test_meta($db, 450, 'BINARY(255)', str_repeat('b', 255), 'STRING', PDO::PARAM_STR); - test_meta($db, 460, 'VARBINARY(1)', str_repeat('a', 1), 'VAR_STRING', PDO::PARAM_STR); - test_meta($db, 470, 'VARBINARY(255)', str_repeat('b', 255), 'VAR_STRING', PDO::PARAM_STR); - - test_meta($db, 480, 'TINYBLOB', str_repeat('b', 255), 'BLOB', PDO::PARAM_STR); - test_meta($db, 490, 'BLOB', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); - test_meta($db, 500, 'MEDIUMBLOB', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); - test_meta($db, 510, 'LONGBLOB', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); - - test_meta($db, 520, 'TINYTEXT', str_repeat('b', 255), 'BLOB', PDO::PARAM_STR); - test_meta($db, 530, 'TINYTEXT BINARY', str_repeat('b', 255), 'BLOB', PDO::PARAM_STR); - - test_meta($db, 560, 'TEXT', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); - test_meta($db, 570, 'TEXT BINARY', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); - - test_meta($db, 580, 'MEDIUMTEXT', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); - test_meta($db, 590, 'MEDIUMTEXT BINARY', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); - - test_meta($db, 600, 'LONGTEXT', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); - test_meta($db, 610, 'LONGTEXT BINARY', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); - - test_meta($db, 620, "ENUM('yes', 'no') DEFAULT 'yes'", 'no', NULL, PDO::PARAM_STR); - test_meta($db, 630, "SET('yes', 'no') DEFAULT 'yes'", 'no', NULL, PDO::PARAM_STR); + $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC'); + + // execute() has not been called yet + // NOTE: no warning + if (false !== ($tmp = $stmt->getColumnMeta(0))) + printf("[002] Expecting false got %s\n", var_export($tmp, true)); + + $stmt->execute(); + + // invalid offset + if (false !== ($tmp = @$stmt->getColumnMeta(-1))) + printf("[004] Expecting false got %s\n", var_export($tmp, true)); + + $emulated = $stmt->getColumnMeta(0); + + printf("Testing native PS...\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[007] Unable to turn off emulated prepared statements\n"); + + $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC'); + $stmt->execute(); + $native = $stmt->getColumnMeta(0); + if (count($native) == 0) { + printf("[008] Meta data seems wrong, %s / %s\n", + var_export($native, true), var_export($emulated, true)); + } + + // invalid offset + if (false !== ($tmp = $stmt->getColumnMeta(1))) + printf("[009] Expecting false because of invalid offset got %s\n", var_export($tmp, true)); + + + function test_meta(&$db, $offset, $sql_type, $value, $native_type, $pdo_type) { + + $db->exec('DROP TABLE IF EXISTS test'); + + $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine()); + if (!($stmt = @$db->prepare($sql)) || (!@$stmt->execute())) { + // Some engines and/or MySQL server versions might not support the data type + return true; + } + + if (!$db->exec(sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $value))) { + printf("[%03d] + 1] Insert failed, %d - %s\n", $offset, + $db->errorCode(), var_export($db->errorInfo(), true)); + return false; + } + + $stmt = $db->prepare('SELECT id, label FROM test'); + $stmt->execute(); + $meta = $stmt->getColumnMeta(1); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + + if (empty($meta)) { + printf("[%03d + 2] getColumnMeta() failed, %d - %s\n", $offset, + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + return false; + } + + $elements = array('flags', 'table', 'name', 'len', 'precision', 'pdo_type'); + foreach ($elements as $k => $element) + if (!isset($meta[$element])) { + printf("[%03d + 3] Element %s missing, %s\n", $offset, + $element, var_export($meta, true)); + return false; + } + + if (($meta['table'] != 'test') || ($meta['name'] != 'label')) { + printf("[%03d + 4] Table or field name is wrong, %s\n", $offset, + var_export($meta, true)); + return false; + } + + if (!is_null($native_type)) { + if (!isset($meta['native_type'])) { + printf("[%03d + 5] Element native_type missing, %s\n", $offset, + var_export($meta, true)); + return false; + } + + if (!is_array($native_type)) + $native_type = array($native_type); + + $found = false; + foreach ($native_type as $k => $type) { + if ($meta['native_type'] == $type) { + $found = true; + break; + } + } + + if (!$found) { + printf("[%03d + 6] Expecting native type %s, %s\n", $offset, + var_export($native_type, true), var_export($meta, true)); + return false; + } + } + + if (!is_null($pdo_type) && ($meta['pdo_type'] != $pdo_type)) { + printf("[%03d + 6] Expecting PDO type %s got %s (%s)\n", $offset, + $pdo_type, var_export($meta, true), var_export($meta['native_type'])); + return false; + } + + return true; + } + + $stmt = $db->prepare('SELECT @@sql_mode AS _mode'); + $stmt->execute(); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + $real_as_float = (false === stristr($row['_mode'], "REAL_AS_FLOAT")) ? false : true; + + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); + $is_mysqlnd = MySQLPDOTest::isPDOMySQLnd(); + test_meta($db, 20, 'BIT(8)', 1, 'BIT', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + test_meta($db, 30, 'TINYINT', -127, 'TINY', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + test_meta($db, 40, 'TINYINT UNSIGNED', 255, 'TINY', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + test_meta($db, 50, 'BOOLEAN', 1, NULL, ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + + test_meta($db, 60, 'SMALLINT', -32768, 'SHORT', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + test_meta($db, 70, 'SMALLINT UNSIGNED', 65535, 'SHORT', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + + test_meta($db, 80, 'MEDIUMINT', -8388608, 'INT24', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + test_meta($db, 90, 'MEDIUMINT UNSIGNED', 16777215, 'INT24', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + + test_meta($db, 100, 'INT', -2147483648, 'LONG', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + test_meta($db, 110, 'INT UNSIGNED', 4294967295, 'LONG', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + + test_meta($db, 120, 'BIGINT', '-9223372036854775808', 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR); + test_meta($db, 130, 'BIGINT UNSIGNED', '18446744073709551615', 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR); + + test_meta($db, 130, 'REAL', -1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR); + test_meta($db, 140, 'REAL UNSIGNED', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR); + test_meta($db, 150, 'REAL ZEROFILL', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR); + test_meta($db, 160, 'REAL UNSIGNED ZEROFILL', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR); + + test_meta($db, 170, 'DOUBLE', -1.01, 'DOUBLE', PDO::PARAM_STR); + test_meta($db, 180, 'DOUBLE UNSIGNED', 1.01, 'DOUBLE', PDO::PARAM_STR); + test_meta($db, 190, 'DOUBLE ZEROFILL', 1.01, 'DOUBLE', PDO::PARAM_STR); + test_meta($db, 200, 'DOUBLE UNSIGNED ZEROFILL', 1.01, 'DOUBLE', PDO::PARAM_STR); + + test_meta($db, 210, 'FLOAT', -1.01, 'FLOAT', PDO::PARAM_STR); + test_meta($db, 220, 'FLOAT UNSIGNED', 1.01, 'FLOAT', PDO::PARAM_STR); + test_meta($db, 230, 'FLOAT ZEROFILL', 1.01, 'FLOAT', PDO::PARAM_STR); + test_meta($db, 240, 'FLOAT UNSIGNED ZEROFILL', 1.01, 'FLOAT', PDO::PARAM_STR); + + test_meta($db, 250, 'DECIMAL', -1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + test_meta($db, 260, 'DECIMAL UNSIGNED', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + test_meta($db, 270, 'DECIMAL ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + test_meta($db, 280, 'DECIMAL UNSIGNED ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + + test_meta($db, 290, 'NUMERIC', -1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + test_meta($db, 300, 'NUMERIC UNSIGNED', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + test_meta($db, 310, 'NUMERIC ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + test_meta($db, 320, 'NUMERIC UNSIGNED ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + + test_meta($db, 330, 'DATE', '2008-04-23', array('DATE', 'NEWDATE'), PDO::PARAM_STR); + test_meta($db, 340, 'TIME', '14:37:00', 'TIME', PDO::PARAM_STR); + test_meta($db, 350, 'TIMESTAMP', '2008-03-23 14:38:00', 'TIMESTAMP', PDO::PARAM_STR); + test_meta($db, 360, 'DATETIME', '2008-03-23 14:38:00', 'DATETIME', PDO::PARAM_STR); + test_meta($db, 370, 'YEAR', '2008', 'YEAR', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + + test_meta($db, 380, 'CHAR(1)', 'a', 'STRING', PDO::PARAM_STR); + test_meta($db, 390, 'CHAR(10)', '0123456789', 'STRING', PDO::PARAM_STR); + test_meta($db, 400, 'CHAR(255)', str_repeat('z', 255), 'STRING', PDO::PARAM_STR); + test_meta($db, 410, 'VARCHAR(1)', 'a', 'VAR_STRING', PDO::PARAM_STR); + test_meta($db, 420, 'VARCHAR(10)', '0123456789', 'VAR_STRING', PDO::PARAM_STR); + test_meta($db, 430, 'VARCHAR(255)', str_repeat('z', 255), 'VAR_STRING', PDO::PARAM_STR); + + test_meta($db, 440, 'BINARY(1)', str_repeat('a', 1), 'STRING', PDO::PARAM_STR); + test_meta($db, 450, 'BINARY(255)', str_repeat('b', 255), 'STRING', PDO::PARAM_STR); + test_meta($db, 460, 'VARBINARY(1)', str_repeat('a', 1), 'VAR_STRING', PDO::PARAM_STR); + test_meta($db, 470, 'VARBINARY(255)', str_repeat('b', 255), 'VAR_STRING', PDO::PARAM_STR); + + test_meta($db, 480, 'TINYBLOB', str_repeat('b', 255), 'BLOB', PDO::PARAM_STR); + test_meta($db, 490, 'BLOB', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); + test_meta($db, 500, 'MEDIUMBLOB', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); + test_meta($db, 510, 'LONGBLOB', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); + + test_meta($db, 520, 'TINYTEXT', str_repeat('b', 255), 'BLOB', PDO::PARAM_STR); + test_meta($db, 530, 'TINYTEXT BINARY', str_repeat('b', 255), 'BLOB', PDO::PARAM_STR); + + test_meta($db, 560, 'TEXT', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); + test_meta($db, 570, 'TEXT BINARY', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); + + test_meta($db, 580, 'MEDIUMTEXT', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); + test_meta($db, 590, 'MEDIUMTEXT BINARY', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); + + test_meta($db, 600, 'LONGTEXT', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); + test_meta($db, 610, 'LONGTEXT BINARY', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR); + + test_meta($db, 620, "ENUM('yes', 'no') DEFAULT 'yes'", 'no', NULL, PDO::PARAM_STR); + test_meta($db, 630, "SET('yes', 'no') DEFAULT 'yes'", 'no', NULL, PDO::PARAM_STR); /* | spatial_type */ - // unique key - $db->exec('DROP TABLE IF EXISTS test'); - $sql = sprintf('CREATE TABLE test(id INT, label INT UNIQUE) ENGINE = %s', MySQLPDOTest::getTableEngine()); - if (($stmt = @$db->prepare($sql)) && @$stmt->execute()) { - $db->exec('INSERT INTO test(id, label) VALUES (1, 2)'); - $stmt = $db->query('SELECT id, label FROM test'); - $meta = $stmt->getColumnMeta(1); - if (!isset($meta['flags'])) { - printf("[1000] No flags contained in metadata %s\n", var_export($meta, true)); - } else { - $flags = $meta['flags']; - $found = false; - foreach ($flags as $k => $flag) { - if ($flag == 'unique_key') - $found = true; - } - if (!$found) - printf("[1001] Flags seem wrong %s\n", var_export($meta, true)); - } - } - - // primary key - $db->exec('DROP TABLE IF EXISTS test'); - $sql = sprintf('CREATE TABLE test(id INT PRIMARY KEY NOT NULL AUTO_INCREMENT) ENGINE = %s', MySQLPDOTest::getTableEngine()); - if (($stmt = @$db->prepare($sql)) && @$stmt->execute()) { - $db->exec('INSERT INTO test(id) VALUES (1)'); - $stmt = $db->query('SELECT id FROM test'); - $meta = $stmt->getColumnMeta(0); - if (!isset($meta['flags'])) { - printf("[1002] No flags contained in metadata %s\n", var_export($meta, true)); - } else { - $flags = $meta['flags']; - $found = false; - foreach ($flags as $k => $flag) { - if ($flag == 'primary_key') - $found = true; - } - if (!$found) - printf("[1003] Flags seem wrong %s\n", var_export($meta, true)); - } - } - - // multiple key - $db->exec('DROP TABLE IF EXISTS test'); - $sql = sprintf('CREATE TABLE test(id INT, label1 INT, label2 INT, INDEX idx1(label1, label2)) ENGINE = %s', MySQLPDOTest::getTableEngine()); - if (($stmt = @$db->prepare($sql)) && @$stmt->execute()) { - $db->exec('INSERT INTO test(id, label1, label2) VALUES (1, 2, 3)'); - $stmt = $db->query('SELECT id, label1, label2 FROM test'); - $meta = $stmt->getColumnMeta(1); - if (!isset($meta['flags'])) { - printf("[1004] No flags contained in metadata %s\n", var_export($meta, true)); - } else { - $flags = $meta['flags']; - $found = false; - foreach ($flags as $k => $flag) { - if ($flag == 'multiple_key') - $found = true; - } - if (!$found) - printf("[1005] Flags seem wrong %s\n", var_export($meta, true)); - } - } - - $stmt = $db->query('SELECT NULL AS col1'); - $meta = $stmt->getColumnMeta(0); - if ('NULL' !== $meta['native_type']) - printf("[1006] Expecting NULL got %s\n", $meta['native_type']); + // unique key + $db->exec('DROP TABLE IF EXISTS test'); + $sql = sprintf('CREATE TABLE test(id INT, label INT UNIQUE) ENGINE = %s', MySQLPDOTest::getTableEngine()); + if (($stmt = @$db->prepare($sql)) && @$stmt->execute()) { + $db->exec('INSERT INTO test(id, label) VALUES (1, 2)'); + $stmt = $db->query('SELECT id, label FROM test'); + $meta = $stmt->getColumnMeta(1); + if (!isset($meta['flags'])) { + printf("[1000] No flags contained in metadata %s\n", var_export($meta, true)); + } else { + $flags = $meta['flags']; + $found = false; + foreach ($flags as $k => $flag) { + if ($flag == 'unique_key') + $found = true; + } + if (!$found) + printf("[1001] Flags seem wrong %s\n", var_export($meta, true)); + } + } + + // primary key + $db->exec('DROP TABLE IF EXISTS test'); + $sql = sprintf('CREATE TABLE test(id INT PRIMARY KEY NOT NULL AUTO_INCREMENT) ENGINE = %s', MySQLPDOTest::getTableEngine()); + if (($stmt = @$db->prepare($sql)) && @$stmt->execute()) { + $db->exec('INSERT INTO test(id) VALUES (1)'); + $stmt = $db->query('SELECT id FROM test'); + $meta = $stmt->getColumnMeta(0); + if (!isset($meta['flags'])) { + printf("[1002] No flags contained in metadata %s\n", var_export($meta, true)); + } else { + $flags = $meta['flags']; + $found = false; + foreach ($flags as $k => $flag) { + if ($flag == 'primary_key') + $found = true; + } + if (!$found) + printf("[1003] Flags seem wrong %s\n", var_export($meta, true)); + } + } + + // multiple key + $db->exec('DROP TABLE IF EXISTS test'); + $sql = sprintf('CREATE TABLE test(id INT, label1 INT, label2 INT, INDEX idx1(label1, label2)) ENGINE = %s', MySQLPDOTest::getTableEngine()); + if (($stmt = @$db->prepare($sql)) && @$stmt->execute()) { + $db->exec('INSERT INTO test(id, label1, label2) VALUES (1, 2, 3)'); + $stmt = $db->query('SELECT id, label1, label2 FROM test'); + $meta = $stmt->getColumnMeta(1); + if (!isset($meta['flags'])) { + printf("[1004] No flags contained in metadata %s\n", var_export($meta, true)); + } else { + $flags = $meta['flags']; + $found = false; + foreach ($flags as $k => $flag) { + if ($flag == 'multiple_key') + $found = true; + } + if (!$found) + printf("[1005] Flags seem wrong %s\n", var_export($meta, true)); + } + } + + $stmt = $db->query('SELECT NULL AS col1'); + $meta = $stmt->getColumnMeta(0); + if ('NULL' !== $meta['native_type']) + printf("[1006] Expecting NULL got %s\n", $meta['native_type']); } catch (PDOException $e) { - // we should never get here, we use warnings, but never trust a system... - printf("[001] %s, [%s} %s\n", - $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo())); + // we should never get here, we use warnings, but never trust a system... + printf("[001] %s, [%s} %s\n", + $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo())); } $db->exec('DROP TABLE IF EXISTS test'); diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt index 9e36714d54..7f4904d23b 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt @@ -8,48 +8,48 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - function mysql_stmt_multiquery_wrong_usage($db) { + function mysql_stmt_multiquery_wrong_usage($db) { - $stmt = $db->query('SELECT label FROM test ORDER BY id ASC LIMIT 1; SELECT label FROM test ORDER BY id ASC LIMIT 1'); - var_dump($stmt->errorInfo()); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - var_dump($stmt->errorInfo()); + $stmt = $db->query('SELECT label FROM test ORDER BY id ASC LIMIT 1; SELECT label FROM test ORDER BY id ASC LIMIT 1'); + var_dump($stmt->errorInfo()); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + var_dump($stmt->errorInfo()); - } + } - function mysql_stmt_multiquery_proper_usage($db) { + function mysql_stmt_multiquery_proper_usage($db) { - $stmt = $db->query('SELECT label FROM test ORDER BY id ASC LIMIT 1; SELECT label FROM test ORDER BY id ASC LIMIT 1'); - do { - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - } while ($stmt->nextRowset()); + $stmt = $db->query('SELECT label FROM test ORDER BY id ASC LIMIT 1; SELECT label FROM test ORDER BY id ASC LIMIT 1'); + do { + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + } while ($stmt->nextRowset()); - } + } - try { + try { - printf("Emulated Prepared Statements...\n"); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); - mysql_stmt_multiquery_wrong_usage($db); - mysql_stmt_multiquery_proper_usage($db); + printf("Emulated Prepared Statements...\n"); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); + mysql_stmt_multiquery_wrong_usage($db); + mysql_stmt_multiquery_proper_usage($db); - printf("Native Prepared Statements...\n"); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - mysql_stmt_multiquery_wrong_usage($db); - mysql_stmt_multiquery_proper_usage($db); + printf("Native Prepared Statements...\n"); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + mysql_stmt_multiquery_wrong_usage($db); + mysql_stmt_multiquery_proper_usage($db); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt index 9452ca8ec5..e473d6716e 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt @@ -23,90 +23,90 @@ if (!MySQLPDOTest::isPDOMySQLnd()) ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); - MySQLPDOTest::createTestTable($db); + MySQLPDOTest::createTestTable($db); - $stmt = $db->query('SELECT id FROM test'); - if (false !== ($tmp = $stmt->nextRowSet())) - printf("[002] Expecting false got %s\n", var_export($tmp, true)); + $stmt = $db->query('SELECT id FROM test'); + if (false !== ($tmp = $stmt->nextRowSet())) + printf("[002] Expecting false got %s\n", var_export($tmp, true)); - // TODO: should give a warning, but its PDO, let's ignore the missing warning for now - if (false !== ($tmp = $stmt->nextRowSet(1))) - printf("[003] Expecting false got %s\n", var_export($tmp, true)); + // TODO: should give a warning, but its PDO, let's ignore the missing warning for now + if (false !== ($tmp = $stmt->nextRowSet(1))) + printf("[003] Expecting false got %s\n", var_export($tmp, true)); - function test_proc1($db) { + function test_proc1($db) { - $stmt = $db->query('SELECT @VERSION as _version'); - $tmp = $stmt->fetch(PDO::FETCH_ASSOC); - assert($tmp['_version'] === NULL); - while ($stmt->fetch()) ; + $stmt = $db->query('SELECT @VERSION as _version'); + $tmp = $stmt->fetch(PDO::FETCH_ASSOC); + assert($tmp['_version'] === NULL); + while ($stmt->fetch()) ; - $db->exec('DROP PROCEDURE IF EXISTS p'); - $db->exec('CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;'); - $db->exec('CALL p(@VERSION)'); - $stmt = $db->query('SELECT @VERSION as _version'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - var_dump($stmt->nextRowSet()); + $db->exec('DROP PROCEDURE IF EXISTS p'); + $db->exec('CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;'); + $db->exec('CALL p(@VERSION)'); + $stmt = $db->query('SELECT @VERSION as _version'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + var_dump($stmt->nextRowSet()); - } + } - function test_proc2($db) { + function test_proc2($db) { - $db->exec('DROP PROCEDURE IF EXISTS p'); - $db->exec('CREATE PROCEDURE p() BEGIN SELECT id FROM test ORDER BY id ASC LIMIT 3; SELECT id, label FROM test WHERE id < 4 ORDER BY id DESC LIMIT 3; END;'); - $stmt = $db->query('CALL p()'); - do { - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - } while ($stmt->nextRowSet()); - var_dump($stmt->nextRowSet()); + $db->exec('DROP PROCEDURE IF EXISTS p'); + $db->exec('CREATE PROCEDURE p() BEGIN SELECT id FROM test ORDER BY id ASC LIMIT 3; SELECT id, label FROM test WHERE id < 4 ORDER BY id DESC LIMIT 3; END;'); + $stmt = $db->query('CALL p()'); + do { + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + } while ($stmt->nextRowSet()); + var_dump($stmt->nextRowSet()); - } + } - try { + try { - // Emulated PS - printf("Emulated PS...\n"); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); + // Emulated PS + printf("Emulated PS...\n"); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1); - test_proc1($db); - test_proc2($db); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1); + test_proc1($db); + test_proc2($db); - $db = MySQLPDOTest::factory(); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0); - test_proc1($db); - test_proc2($db); + $db = MySQLPDOTest::factory(); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0); + test_proc1($db); + test_proc2($db); - // Native PS - printf("Native PS...\n"); - $db = MySQLPDOTest::factory(); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - test_proc1($db); - test_proc2($db); + // Native PS + printf("Native PS...\n"); + $db = MySQLPDOTest::factory(); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + test_proc1($db); + test_proc2($db); - $db = MySQLPDOTest::factory(); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + $db = MySQLPDOTest::factory(); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - test_proc1($db); - test_proc2($db); + test_proc1($db); + test_proc2($db); - @$db->exec('DROP PROCEDURE IF EXISTS p'); + @$db->exec('DROP PROCEDURE IF EXISTS p'); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_rowcount.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_rowcount.phpt index 713945e98d..99eb481304 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_rowcount.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_rowcount.phpt @@ -8,24 +8,24 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - MySQLPDOTest::createTestTable($db); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + MySQLPDOTest::createTestTable($db); - try { + try { - if (0 !== ($tmp = $db->query('SELECT id FROM test WHERE 1 = 0')->rowCount())) - printf("[002] Expecting 0 got %s", var_export($tmp, true)); + if (0 !== ($tmp = $db->query('SELECT id FROM test WHERE 1 = 0')->rowCount())) + printf("[002] Expecting 0 got %s", var_export($tmp, true)); - if (1 !== ($tmp = $db->query('SELECT id FROM test WHERE id = 1')->rowCount())) - printf("[003] Expecting 1 got %s", var_export($tmp, true)); + if (1 !== ($tmp = $db->query('SELECT id FROM test WHERE id = 1')->rowCount())) + printf("[003] Expecting 1 got %s", var_export($tmp, true)); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt index 35d4ba3cba..13f4f5769a 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt @@ -11,104 +11,104 @@ if (MYSQLPDOTest::isPDOMySQLnd()) ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - - try { - - printf("Native PS...\n"); - $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); - if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) - printf("[004] Unable to turn off emulated prepared statements\n"); - - printf("Buffered...\n"); - MySQLPDOTest::createTestTable($db); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); - $stmt = $db->query('SELECT id, label FROM test WHERE id = 1'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - $stmt = $db->query('SELECT id, label FROM test WHERE id = 1'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - printf("Unbuffered...\n"); - MySQLPDOTest::createTestTable($db); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); - $stmt = $db->query('SELECT id, label FROM test WHERE id = 1'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - /* - NOTE - this will cause an error and it OK - When using unbuffered prepared statements MySQL expects you to - fetch all data from the row before sending new data to the server. - PDO::query() will prepare and execute a statement in one step. - After the execution of PDO::query(), MySQL expects you to fetch - the results from the line before sending new commands. However, - PHP/PDO will send a CLOSE message as part of the PDO::query() call. - - The following happens: - - $stmt = PDO::query(<some query>) - mysql_stmt_prepare() - mysql_stmt_execute() - - $stmt->fetchAll() - mysql_stmt_fetch() - - And now the right side of the expression will be executed first: - $stmt = PDO::query(<some query>) - PDO::query(<some query>) - mysql_stmt_prepare - mysql_stmt_execute - - PHP continues at the left side of the expression: - - $stmt = PDO::query(<some query>) - - What happens is that $stmt gets overwritten. The reference counter of the - zval representing the current value of $stmt. PDO gets a callback that - it has to free the resources associated with the zval representing the - current value of stmt: - mysql_stmt_close - ---> ERROR - ---> execute() has been send on the line, you are supposed to fetch - ---> you must not try to send a CLOSE after execute() - ---> Error: 2050 (CR_FETCH_CANCELED) - ---> Message: Row retrieval was canceled by mysql_stmt_close() call - ---> MySQL does its best to recover the line and cancels the retrieval - - PHP proceeds and assigns the new statement object/zval obtained from - PDO to $stmt. - - Solutions: - - use mysqlnd - - use prepare() + execute() instead of query() - - as there is no explicit close() in PDO, try unset($stmt) before the new assignment - - fix PDO::query() [not the driver, fix PDO itself] - */ - - $stmt = $db->query('SELECT id, label FROM test WHERE id = 1'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - $stmt = $db->prepare('SELECT id, label FROM test WHERE id = 1'); - $stmt->execute(); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - $stmt = $db->prepare('SELECT id, label FROM test WHERE id = 1'); - $stmt->execute(); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - unset($stmt); - $stmt = $db->query('SELECT id, label FROM test WHERE id = 1'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - unset($stmt); - $stmt = $db->query('SELECT id, label FROM test WHERE id = 1'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + + try { + + printf("Native PS...\n"); + $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0); + if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY)) + printf("[004] Unable to turn off emulated prepared statements\n"); + + printf("Buffered...\n"); + MySQLPDOTest::createTestTable($db); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); + $stmt = $db->query('SELECT id, label FROM test WHERE id = 1'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $stmt = $db->query('SELECT id, label FROM test WHERE id = 1'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + printf("Unbuffered...\n"); + MySQLPDOTest::createTestTable($db); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); + $stmt = $db->query('SELECT id, label FROM test WHERE id = 1'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + /* + NOTE - this will cause an error and it OK + When using unbuffered prepared statements MySQL expects you to + fetch all data from the row before sending new data to the server. + PDO::query() will prepare and execute a statement in one step. + After the execution of PDO::query(), MySQL expects you to fetch + the results from the line before sending new commands. However, + PHP/PDO will send a CLOSE message as part of the PDO::query() call. + + The following happens: + + $stmt = PDO::query(<some query>) + mysql_stmt_prepare() + mysql_stmt_execute() + + $stmt->fetchAll() + mysql_stmt_fetch() + + And now the right side of the expression will be executed first: + $stmt = PDO::query(<some query>) + PDO::query(<some query>) + mysql_stmt_prepare + mysql_stmt_execute + + PHP continues at the left side of the expression: + + $stmt = PDO::query(<some query>) + + What happens is that $stmt gets overwritten. The reference counter of the + zval representing the current value of $stmt. PDO gets a callback that + it has to free the resources associated with the zval representing the + current value of stmt: + mysql_stmt_close + ---> ERROR + ---> execute() has been send on the line, you are supposed to fetch + ---> you must not try to send a CLOSE after execute() + ---> Error: 2050 (CR_FETCH_CANCELED) + ---> Message: Row retrieval was canceled by mysql_stmt_close() call + ---> MySQL does its best to recover the line and cancels the retrieval + + PHP proceeds and assigns the new statement object/zval obtained from + PDO to $stmt. + + Solutions: + - use mysqlnd + - use prepare() + execute() instead of query() + - as there is no explicit close() in PDO, try unset($stmt) before the new assignment + - fix PDO::query() [not the driver, fix PDO itself] + */ + + $stmt = $db->query('SELECT id, label FROM test WHERE id = 1'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + $stmt = $db->prepare('SELECT id, label FROM test WHERE id = 1'); + $stmt->execute(); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + $stmt = $db->prepare('SELECT id, label FROM test WHERE id = 1'); + $stmt->execute(); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + unset($stmt); + $stmt = $db->query('SELECT id, label FROM test WHERE id = 1'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + unset($stmt); + $stmt = $db->query('SELECT id, label FROM test WHERE id = 1'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + + print "done!"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt index 7c39b88558..21fd83f57d 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt @@ -21,105 +21,105 @@ if ($version < 50000) ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - $db = MySQLPDOTest::factory(); - - function check_result($offset, $stmt, $columns) { - - do { - $row = $stmt->fetch(PDO::FETCH_ASSOC); - } while ($stmt->nextRowSet()); - - if (!isset($row['one']) || ($row['one'] != 1)) { - printf("[%03d + 1] Expecting array('one' => 1), got %s\n", $offset, var_export($row, true)); - return false; - } - - if (($columns == 2) && - (!isset($row['two']) || ($row['two'] != 2))) { - printf("[%03d + 2] Expecting array('one' => 1, 'two' => 2), got %s\n", $offset, var_export($row, true)); - return false; - } else if (($columns == 1) && isset($row['two'])) { - printf("[%03d + 3] Expecting one array element got two\n", $offset); - return false; - } - - return true; - } - - try { - - // What will happen if a PS returns a different number of result set column upon each execution? - // Lets try with a SP accepting parameters... - $db->exec('DROP PROCEDURE IF EXISTS p'); - $db->exec('CREATE PROCEDURE p(IN cols INT) BEGIN IF cols < 2 THEN SELECT cols AS "one"; ELSE SELECT 1 AS "one", cols AS "two"; END IF; END;'); - - // Emulates PS first - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); - $stmt = $db->prepare('CALL p(?)'); - - $columns = null; - $stmt->bindParam(1, $columns); - for ($i = 0; $i < 5; $i++) { - $columns = ($i % 2) + 1; - $stmt->execute(); - check_result($i, $stmt, $columns); - } - - if (MySQLPDOTest::isPDOMySQLnd()) { - // Native PS - // Libmysql cannot handle such a stored procedure. You will see leaks with libmysql - $db = MySQLPDOTest::factory(); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1); - $stmt = $db->prepare('CALL p(?)'); - $stmt->bindParam(1, $columns); - for ($i = 5; $i < 10; $i++) { - $columns = ($i % 2) + 1; - $stmt->execute(); - check_result($i, $stmt, $columns); - } - } - - // And now without parameters... - this gives a different control flow inside PDO - $db->exec('DROP PROCEDURE IF EXISTS p'); - $db->exec('CREATE PROCEDURE p() BEGIN DECLARE cols INT; SELECT @numcols INTO cols; IF cols < 2 THEN SET @numcols = 2; SELECT cols AS "one"; ELSE SET @numcols = 1; SELECT 1 AS "one", cols AS "two"; END IF; END;'); - - // Emulates PS first - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); - $db->exec('SET @numcols = 1'); - $stmt = $db->prepare('CALL p()'); - $stmt->execute(); - check_result(11, $stmt, 1); - $stmt->execute(); - check_result(12, $stmt, 2); - $db->exec('SET @numcols = 1'); - $stmt->execute(); - check_result(13, $stmt, 1); - - if (MySQLPDOTest::isPDOMySQLnd()) { - // Native PS - // Libmysql cannot handle such a stored procedure. You will see leaks with libmysql - $db = MySQLPDOTest::factory(); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); - $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1); - $db->exec('SET @numcols = 1'); - $stmt = $db->prepare('CALL p()'); - $stmt->execute(); - check_result(14, $stmt, 1); - $stmt->execute(); - check_result(15, $stmt, 2); - $db->exec('SET @numcols = 1'); - $stmt->execute(); - check_result(16, $stmt, 1); - } - - } catch (PDOException $e) { - printf("[99] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } - - print "done!"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + $db = MySQLPDOTest::factory(); + + function check_result($offset, $stmt, $columns) { + + do { + $row = $stmt->fetch(PDO::FETCH_ASSOC); + } while ($stmt->nextRowSet()); + + if (!isset($row['one']) || ($row['one'] != 1)) { + printf("[%03d + 1] Expecting array('one' => 1), got %s\n", $offset, var_export($row, true)); + return false; + } + + if (($columns == 2) && + (!isset($row['two']) || ($row['two'] != 2))) { + printf("[%03d + 2] Expecting array('one' => 1, 'two' => 2), got %s\n", $offset, var_export($row, true)); + return false; + } else if (($columns == 1) && isset($row['two'])) { + printf("[%03d + 3] Expecting one array element got two\n", $offset); + return false; + } + + return true; + } + + try { + + // What will happen if a PS returns a different number of result set column upon each execution? + // Lets try with a SP accepting parameters... + $db->exec('DROP PROCEDURE IF EXISTS p'); + $db->exec('CREATE PROCEDURE p(IN cols INT) BEGIN IF cols < 2 THEN SELECT cols AS "one"; ELSE SELECT 1 AS "one", cols AS "two"; END IF; END;'); + + // Emulates PS first + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); + $stmt = $db->prepare('CALL p(?)'); + + $columns = null; + $stmt->bindParam(1, $columns); + for ($i = 0; $i < 5; $i++) { + $columns = ($i % 2) + 1; + $stmt->execute(); + check_result($i, $stmt, $columns); + } + + if (MySQLPDOTest::isPDOMySQLnd()) { + // Native PS + // Libmysql cannot handle such a stored procedure. You will see leaks with libmysql + $db = MySQLPDOTest::factory(); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1); + $stmt = $db->prepare('CALL p(?)'); + $stmt->bindParam(1, $columns); + for ($i = 5; $i < 10; $i++) { + $columns = ($i % 2) + 1; + $stmt->execute(); + check_result($i, $stmt, $columns); + } + } + + // And now without parameters... - this gives a different control flow inside PDO + $db->exec('DROP PROCEDURE IF EXISTS p'); + $db->exec('CREATE PROCEDURE p() BEGIN DECLARE cols INT; SELECT @numcols INTO cols; IF cols < 2 THEN SET @numcols = 2; SELECT cols AS "one"; ELSE SET @numcols = 1; SELECT 1 AS "one", cols AS "two"; END IF; END;'); + + // Emulates PS first + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); + $db->exec('SET @numcols = 1'); + $stmt = $db->prepare('CALL p()'); + $stmt->execute(); + check_result(11, $stmt, 1); + $stmt->execute(); + check_result(12, $stmt, 2); + $db->exec('SET @numcols = 1'); + $stmt->execute(); + check_result(13, $stmt, 1); + + if (MySQLPDOTest::isPDOMySQLnd()) { + // Native PS + // Libmysql cannot handle such a stored procedure. You will see leaks with libmysql + $db = MySQLPDOTest::factory(); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); + $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1); + $db->exec('SET @numcols = 1'); + $stmt = $db->prepare('CALL p()'); + $stmt->execute(); + check_result(14, $stmt, 1); + $stmt->execute(); + check_result(15, $stmt, 2); + $db->exec('SET @numcols = 1'); + $stmt->execute(); + check_result(16, $stmt, 1); + } + + } catch (PDOException $e) { + printf("[99] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } + + print "done!"; ?> --EXPECT-- done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt b/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt index 83158b3484..f98271d792 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt @@ -8,65 +8,65 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - try { + try { - class MyPDO extends PDO { + class MyPDO extends PDO { - public function __construct() { - $this->protocol(); - return call_user_func_array(array($this, 'parent::__construct'), func_get_args()); - } + public function __construct() { + $this->protocol(); + return call_user_func_array(array($this, 'parent::__construct'), func_get_args()); + } - public function exec($statement) { - $this->protocol(); - return parent::exec($statement); - } + public function exec($statement) { + $this->protocol(); + return parent::exec($statement); + } - public function query($statement) { - $this->protocol(); - return call_user_func_array(array($this, 'parent::query'), func_get_args()); - } + public function query($statement) { + $this->protocol(); + return call_user_func_array(array($this, 'parent::query'), func_get_args()); + } - public function __call($method, $args) { - print "__call(".var_export($method,true).", ".var_export($args, true).")\n"; - // $this->protocol(); - } + public function __call($method, $args) { + print "__call(".var_export($method,true).", ".var_export($args, true).")\n"; + // $this->protocol(); + } - private function protocol() { - $stack = debug_backtrace(); - if (!isset($stack[1])) - return; + private function protocol() { + $stack = debug_backtrace(); + if (!isset($stack[1])) + return; - printf("%s(", $stack[1]['function']); - $args = ''; - foreach ($stack[1]['args'] as $k => $v) - $args .= sprintf("%s, ", var_export($v, true)); - if ($args != '') - printf("%s", substr($args, 0, -2)); - printf(")\n"); - } + printf("%s(", $stack[1]['function']); + $args = ''; + foreach ($stack[1]['args'] as $k => $v) + $args .= sprintf("%s, ", var_export($v, true)); + if ($args != '') + printf("%s", substr($args, 0, -2)); + printf(")\n"); + } - } + } - $db = new MyPDO(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS); - $db->exec('DROP TABLE IF EXISTS test'); - $db->exec('CREATE TABLE test(id INT)'); - $db->exec('INSERT INTO test(id) VALUES (1), (2)'); - $stmt = $db->query('SELECT * FROM test ORDER BY id ASC'); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); - var_dump($stmt->fetch()); - $db->intercept_call(); + $db = new MyPDO(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS); + $db->exec('DROP TABLE IF EXISTS test'); + $db->exec('CREATE TABLE test(id INT)'); + $db->exec('INSERT INTO test(id) VALUES (1), (2)'); + $stmt = $db->query('SELECT * FROM test ORDER BY id ASC'); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + var_dump($stmt->fetch()); + $db->intercept_call(); - } catch (PDOException $e) { - printf("[001] %s [%s] %s\n", - $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); - } + } catch (PDOException $e) { + printf("[001] %s [%s] %s\n", + $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); + } - $db->exec('DROP TABLE IF EXISTS test'); - print "done!\n"; + $db->exec('DROP TABLE IF EXISTS test'); + print "done!\n"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_types.phpt b/ext/pdo_mysql/tests/pdo_mysql_types.phpt index fee1aff514..6360c9a61b 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_types.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_types.phpt @@ -8,171 +8,171 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - - function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL, $alternative_type = NULL) { - - $db->exec('DROP TABLE IF EXISTS test'); - $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine()); - @$db->exec($sql); - if ($db->errorCode() != 0) { - // not all MySQL Server versions and/or engines might support the type - return true; - } - - $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)'); - $stmt->bindValue(1, $offset); - $stmt->bindValue(2, $value); - if (!$stmt->execute()) { - printf("[%03d + 1] INSERT failed, %s\n", $offset, var_export($stmt->errorInfo(), true)); - return false; - } - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); - $stmt = $db->query('SELECT id, label FROM test'); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - if (!isset($row['id']) || !isset($row['label'])) { - printf("[%03d + 2] Fetched result seems wrong, dumping result: %s\n", $offset, var_export($row, true)); - return false; - } - - if ($row['id'] != $offset) { - printf("[%03d + 3] Expecting %s got %s\n", $offset, $row['id']); - return false; - } - - if (!is_null($pattern)) { - if (!preg_match($pattern, $row['label'])) { - printf("[%03d + 5] Value seems wrong, accepting pattern %s got %s, check manually\n", - $offset, $pattern, var_export($row['label'], true)); - return false; - } - - } else { - - $exp = $value; - if (!is_null($ret_value)) { - // we expect a different return value than our input value - // typically the difference is only the type - $exp = $ret_value; - } - if ($row['label'] !== $exp && !is_null($alternative_type) && gettype($row['label']) != $alternative_type) { - printf("[%03d + 4] %s - input = %s/%s, output = %s/%s (alternative type: %s)\n", $offset, - $sql_type, var_export($exp, true), gettype($exp), - var_export($row['label'], true), gettype($row['label']), - $alternative_type); - return false; - } - - } - - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); - $stmt = $db->query('SELECT id, label FROM test'); - $row_string = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - if (is_null($pattern) && ($row['label'] != $row_string['label'])) { - printf("%s - STRINGIGY = %s, NATIVE = %s\n", $sql_type, var_export($row_string['label'], true), var_export($row['label'], true)); - return false; - } else if (!is_null($pattern) && !preg_match($pattern, $row_string['label'])) { - printf("%s - STRINGIGY = %s, NATIVE = %s, pattern '%s'\n", $sql_type, var_export($row_string['label'], true), var_export($row['label'], true), $pattern); - return false; - } - - - return true; - } - - $db = MySQLPDOTest::factory(); - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + + function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL, $alternative_type = NULL) { + + $db->exec('DROP TABLE IF EXISTS test'); + $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine()); + @$db->exec($sql); + if ($db->errorCode() != 0) { + // not all MySQL Server versions and/or engines might support the type + return true; + } + + $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)'); + $stmt->bindValue(1, $offset); + $stmt->bindValue(2, $value); + if (!$stmt->execute()) { + printf("[%03d + 1] INSERT failed, %s\n", $offset, var_export($stmt->errorInfo(), true)); + return false; + } + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); + $stmt = $db->query('SELECT id, label FROM test'); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + if (!isset($row['id']) || !isset($row['label'])) { + printf("[%03d + 2] Fetched result seems wrong, dumping result: %s\n", $offset, var_export($row, true)); + return false; + } + + if ($row['id'] != $offset) { + printf("[%03d + 3] Expecting %s got %s\n", $offset, $row['id']); + return false; + } + + if (!is_null($pattern)) { + if (!preg_match($pattern, $row['label'])) { + printf("[%03d + 5] Value seems wrong, accepting pattern %s got %s, check manually\n", + $offset, $pattern, var_export($row['label'], true)); + return false; + } + + } else { + + $exp = $value; + if (!is_null($ret_value)) { + // we expect a different return value than our input value + // typically the difference is only the type + $exp = $ret_value; + } + if ($row['label'] !== $exp && !is_null($alternative_type) && gettype($row['label']) != $alternative_type) { + printf("[%03d + 4] %s - input = %s/%s, output = %s/%s (alternative type: %s)\n", $offset, + $sql_type, var_export($exp, true), gettype($exp), + var_export($row['label'], true), gettype($row['label']), + $alternative_type); + return false; + } + + } + + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + $stmt = $db->query('SELECT id, label FROM test'); + $row_string = $stmt->fetch(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + if (is_null($pattern) && ($row['label'] != $row_string['label'])) { + printf("%s - STRINGIGY = %s, NATIVE = %s\n", $sql_type, var_export($row_string['label'], true), var_export($row['label'], true)); + return false; + } else if (!is_null($pattern) && !preg_match($pattern, $row_string['label'])) { + printf("%s - STRINGIGY = %s, NATIVE = %s, pattern '%s'\n", $sql_type, var_export($row_string['label'], true), var_export($row['label'], true), $pattern); + return false; + } + + + return true; + } + + $db = MySQLPDOTest::factory(); + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); /* - test_type($db, 20, 'BIT(8)', 1); + test_type($db, 20, 'BIT(8)', 1); */ - $is_mysqlnd = MySQLPDOTest::isPDOMySQLnd(); + $is_mysqlnd = MySQLPDOTest::isPDOMySQLnd(); - test_type($db, 30, 'TINYINT', -127, ($is_mysqlnd) ? -127: '-127'); - test_type($db, 40, 'TINYINT UNSIGNED', 255, ($is_mysqlnd) ? 255 : '255'); - test_type($db, 50, 'BOOLEAN', 1, ($is_mysqlnd) ? 1 : '1'); + test_type($db, 30, 'TINYINT', -127, ($is_mysqlnd) ? -127: '-127'); + test_type($db, 40, 'TINYINT UNSIGNED', 255, ($is_mysqlnd) ? 255 : '255'); + test_type($db, 50, 'BOOLEAN', 1, ($is_mysqlnd) ? 1 : '1'); - test_type($db, 60, 'SMALLINT', -32768, ($is_mysqlnd) ? -32768 : '-32768'); - test_type($db, 70, 'SMALLINT UNSIGNED', 65535, ($is_mysqlnd) ? 65535 : '65535'); + test_type($db, 60, 'SMALLINT', -32768, ($is_mysqlnd) ? -32768 : '-32768'); + test_type($db, 70, 'SMALLINT UNSIGNED', 65535, ($is_mysqlnd) ? 65535 : '65535'); - test_type($db, 80, 'MEDIUMINT', -8388608, ($is_mysqlnd) ? -8388608 : '-8388608'); - test_type($db, 90, 'MEDIUMINT UNSIGNED', 16777215, ($is_mysqlnd) ? 16777215 : '16777215'); + test_type($db, 80, 'MEDIUMINT', -8388608, ($is_mysqlnd) ? -8388608 : '-8388608'); + test_type($db, 90, 'MEDIUMINT UNSIGNED', 16777215, ($is_mysqlnd) ? 16777215 : '16777215'); - test_type($db, 100, 'INT', -2147483648, - ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? (int)-2147483648 : (double)-2147483648) : '-2147483648', - NULL, ($is_mysqlnd) ? 'integer' : NULL); + test_type($db, 100, 'INT', -2147483648, + ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? (int)-2147483648 : (double)-2147483648) : '-2147483648', + NULL, ($is_mysqlnd) ? 'integer' : NULL); - test_type($db, 110, 'INT UNSIGNED', 4294967295, ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? 4294967295 : '4294967295') : '4294967295'); + test_type($db, 110, 'INT UNSIGNED', 4294967295, ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? 4294967295 : '4294967295') : '4294967295'); - // no chance to return int with the current PDO version - we are forced to return strings - test_type($db, 120, 'BIGINT', 1, ($is_mysqlnd) ? 1 : '1'); - // to avoid trouble with numeric ranges, lets pass the numbers as a string - test_type($db, 130, 'BIGINT', '-9223372036854775808', NULL, '/^\-9[\.]*22/'); - test_type($db, 140, 'BIGINT UNSIGNED', '18446744073709551615', NULL, '/^1[\.]*844/'); + // no chance to return int with the current PDO version - we are forced to return strings + test_type($db, 120, 'BIGINT', 1, ($is_mysqlnd) ? 1 : '1'); + // to avoid trouble with numeric ranges, lets pass the numbers as a string + test_type($db, 130, 'BIGINT', '-9223372036854775808', NULL, '/^\-9[\.]*22/'); + test_type($db, 140, 'BIGINT UNSIGNED', '18446744073709551615', NULL, '/^1[\.]*844/'); - test_type($db, 150, 'REAL', -1.01, ($is_mysqlnd) ? -1.01 : '-1.01'); - test_type($db, 160, 'REAL UNSIGNED', 1.01, ($is_mysqlnd) ? 1.01 : '1.01'); + test_type($db, 150, 'REAL', -1.01, ($is_mysqlnd) ? -1.01 : '-1.01'); + test_type($db, 160, 'REAL UNSIGNED', 1.01, ($is_mysqlnd) ? 1.01 : '1.01'); - test_type($db, 170, 'DOUBLE', -1.01, ($is_mysqlnd) ? -1.01 : '-1.01'); - test_type($db, 180, 'DOUBLE UNSIGNED', 1.01, ($is_mysqlnd) ? 1.01 : '1.01'); + test_type($db, 170, 'DOUBLE', -1.01, ($is_mysqlnd) ? -1.01 : '-1.01'); + test_type($db, 180, 'DOUBLE UNSIGNED', 1.01, ($is_mysqlnd) ? 1.01 : '1.01'); - test_type($db, 210, 'FLOAT', -1.01, NULL, '/^\-1.0\d+/'); - test_type($db, 220, 'FLOAT UNSIGNED', 1.01, NULL, '/^1.0\d+/'); + test_type($db, 210, 'FLOAT', -1.01, NULL, '/^\-1.0\d+/'); + test_type($db, 220, 'FLOAT UNSIGNED', 1.01, NULL, '/^1.0\d+/'); - test_type($db, 250, 'DECIMAL', -1.01, '-1'); - test_type($db, 260, 'DECIMAL UNSIGNED', 1.01, '1'); + test_type($db, 250, 'DECIMAL', -1.01, '-1'); + test_type($db, 260, 'DECIMAL UNSIGNED', 1.01, '1'); - test_type($db, 290, 'NUMERIC', -1.01, '-1'); - test_type($db, 300, 'NUMERIC UNSIGNED', 1.01, '1'); + test_type($db, 290, 'NUMERIC', -1.01, '-1'); + test_type($db, 300, 'NUMERIC UNSIGNED', 1.01, '1'); - test_type($db, 330, 'DATE', '2008-04-23'); - test_type($db, 340, 'TIME', '14:37:00'); - test_type($db, 350, 'TIMESTAMP', '2008-05-06 21:09:00'); - test_type($db, 360, 'DATETIME', '2008-03-23 14:38:00'); - test_type($db, 370, 'YEAR', 2008, ($is_mysqlnd) ? 2008 : '2008'); + test_type($db, 330, 'DATE', '2008-04-23'); + test_type($db, 340, 'TIME', '14:37:00'); + test_type($db, 350, 'TIMESTAMP', '2008-05-06 21:09:00'); + test_type($db, 360, 'DATETIME', '2008-03-23 14:38:00'); + test_type($db, 370, 'YEAR', 2008, ($is_mysqlnd) ? 2008 : '2008'); - test_type($db, 380, 'CHAR(1)', 'a'); - test_type($db, 390, 'CHAR(10)', '0123456789'); - test_type($db, 400, 'CHAR(255)', str_repeat('z', 255)); - test_type($db, 410, 'VARCHAR(1)', 'a'); - test_type($db, 420, 'VARCHAR(10)', '0123456789'); - test_type($db, 430, 'VARCHAR(255)', str_repeat('z', 255)); + test_type($db, 380, 'CHAR(1)', 'a'); + test_type($db, 390, 'CHAR(10)', '0123456789'); + test_type($db, 400, 'CHAR(255)', str_repeat('z', 255)); + test_type($db, 410, 'VARCHAR(1)', 'a'); + test_type($db, 420, 'VARCHAR(10)', '0123456789'); + test_type($db, 430, 'VARCHAR(255)', str_repeat('z', 255)); - test_type($db, 440, 'BINARY(1)', str_repeat('a', 1)); - test_type($db, 450, 'BINARY(255)', str_repeat('b', 255)); - test_type($db, 460, 'VARBINARY(1)', str_repeat('a', 1)); - test_type($db, 470, 'VARBINARY(255)', str_repeat('b', 255)); + test_type($db, 440, 'BINARY(1)', str_repeat('a', 1)); + test_type($db, 450, 'BINARY(255)', str_repeat('b', 255)); + test_type($db, 460, 'VARBINARY(1)', str_repeat('a', 1)); + test_type($db, 470, 'VARBINARY(255)', str_repeat('b', 255)); - test_type($db, 480, 'TINYBLOB', str_repeat('b', 255)); - test_type($db, 490, 'BLOB', str_repeat('b', 256)); - test_type($db, 500, 'MEDIUMBLOB', str_repeat('b', 256)); - test_type($db, 510, 'LONGBLOB', str_repeat('b', 256)); + test_type($db, 480, 'TINYBLOB', str_repeat('b', 255)); + test_type($db, 490, 'BLOB', str_repeat('b', 256)); + test_type($db, 500, 'MEDIUMBLOB', str_repeat('b', 256)); + test_type($db, 510, 'LONGBLOB', str_repeat('b', 256)); - test_type($db, 520, 'TINYTEXT', str_repeat('b', 255)); - test_type($db, 530, 'TINYTEXT BINARY', str_repeat('b', 255)); + test_type($db, 520, 'TINYTEXT', str_repeat('b', 255)); + test_type($db, 530, 'TINYTEXT BINARY', str_repeat('b', 255)); - test_type($db, 560, 'TEXT', str_repeat('b', 256)); - test_type($db, 570, 'TEXT BINARY', str_repeat('b', 256)); + test_type($db, 560, 'TEXT', str_repeat('b', 256)); + test_type($db, 570, 'TEXT BINARY', str_repeat('b', 256)); - test_type($db, 580, 'MEDIUMTEXT', str_repeat('b', 256)); - test_type($db, 590, 'MEDIUMTEXT BINARY', str_repeat('b', 256)); + test_type($db, 580, 'MEDIUMTEXT', str_repeat('b', 256)); + test_type($db, 590, 'MEDIUMTEXT BINARY', str_repeat('b', 256)); - test_type($db, 600, 'LONGTEXT', str_repeat('b', 256)); - test_type($db, 610, 'LONGTEXT BINARY', str_repeat('b', 256)); + test_type($db, 600, 'LONGTEXT', str_repeat('b', 256)); + test_type($db, 610, 'LONGTEXT BINARY', str_repeat('b', 256)); - test_type($db, 620, "ENUM('yes', 'no') DEFAULT 'yes'", 'no'); - test_type($db, 630, "SET('yes', 'no') DEFAULT 'yes'", 'no'); + test_type($db, 620, "ENUM('yes', 'no') DEFAULT 'yes'", 'no'); + test_type($db, 630, "SET('yes', 'no') DEFAULT 'yes'", 'no'); - test_type($db, 640, 'DECIMAL(3,2)', -1.01, '-1.01'); + test_type($db, 640, 'DECIMAL(3,2)', -1.01, '-1.01'); - echo "done!\n"; + echo "done!\n"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt b/ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt index 1ef5ab1370..8e98b74acb 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt @@ -8,115 +8,115 @@ MySQLPDOTest::skip(); ?> --FILE-- <?php - require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - - function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL) { - - $db->exec('DROP TABLE IF EXISTS test'); - $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine()); - @$db->exec($sql); - if ($db->errorCode() != 0) { - // not all MySQL Server versions and/or engines might support the type - return true; - } - - $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)'); - $stmt->bindValue(1, $offset); - $stmt->bindValue(2, $value); - try { - if (!$stmt->execute()) { - printf("[%03d + 1] INSERT failed, %s\n", $offset, var_export($stmt->errorInfo(), true)); - return false; - } - } catch (PDOException $e) { - // This might be a SQL warning on signed values inserted in unsigned columns - // Zerofill implies unsigned but the test plays with signed = negative values as well! - return true; - } - - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); - $stmt = $db->query('SELECT id, label FROM test'); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - if (!isset($row['id']) || !isset($row['label'])) { - printf("[%03d + 2] Fetched result seems wrong, dumping result: %s\n", $offset, var_export($row, true)); - return false; - } - - if ($row['id'] != $offset) { - printf("[%03d + 3] Expecting %s got %s\n", $offset, $row['id']); - return false; - } - - if (!is_null($pattern)) { - - if (!preg_match($pattern, $row['label'])) { - printf("[%03d + 5] Value seems wrong, accepting pattern %s got %s, check manually\n", - $offset, $pattern, var_export($row['label'], true)); - return false; - } - - } else { - - $exp = $value; - if (!is_null($ret_value)) { - // we expect a different return value than our input value - // typically the difference is only the type - $exp = $ret_value; - } - - if ($row['label'] !== $exp) { - printf("[%03d + 4] %s - input = %s/%s, output = %s/%s\n", $offset, - $sql_type, var_export($exp, true), gettype($exp), - var_export($row['label'], true), gettype($row['label'])); - return false; - } - - } - - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); - $stmt = $db->query('SELECT id, label FROM test'); - $row_string = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - if ($row['label'] != $row_string['label']) { - printf("%s - STRINGIGY = %s, NATIVE = %s\n", $sql_type, var_export($row_string['label'], true), var_export($row['label'], true)); - return false; - } - - return true; - } - - $db = MySQLPDOTest::factory(); - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); - - $stmt = $db->prepare('SELECT @@sql_mode AS _mode'); - $stmt->execute(); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $real_as_float = (false === stristr($row['_mode'], "REAL_AS_FLOAT")) ? false : true; - - test_type($db, 100, 'REAL ZEROFILL', -1.01, NULL, '/^[0]*0$/'); - test_type($db, 110, 'REAL ZEROFILL', 1.01, NULL, ($real_as_float) ? '/^[0]*1\.0.*$/' : '/^[0]*1\.01$/'); - test_type($db, 120, 'REAL UNSIGNED ZEROFILL', 1.01, NULL, ($real_as_float) ? '/^[0]*1\..*$/' : '/^[0]*1\.01$/'); - - test_type($db, 130, 'DOUBLE ZEROFILL', -1.01, NULL, '/^[0]*0$/'); - test_type($db, 140, 'DOUBLE ZEROFILL', 1.01, NULL, '/^[0]*1\.01$/'); - test_type($db, 150, 'DOUBLE UNSIGNED ZEROFILL', 1.01, NULL, '/^[0]*1\.01$/'); - - test_type($db, 160, 'FLOAT ZEROFILL', -1.01, NULL, '/^[0]*0$/'); - test_type($db, 170, 'FLOAT ZEROFILL', 1, NULL, '/^[0]*1$/'); - test_type($db, 180, 'FLOAT UNSIGNED ZEROFILL', -1, NULL, '/^[0]*0$/'); - - test_type($db, 190, 'DECIMAL ZEROFILL', -1.01, NULL, '/^[0]*0$/'); - test_type($db, 200, 'DECIMAL ZEROFILL', 1.01, NULL, '/^[0]*1$/'); - test_type($db, 210, 'DECIMAL UNSIGNED ZEROFILL', 1.01, NULL, '/^[0]*1$/'); - - test_type($db, 220, 'NUMERIC ZEROFILL', -1, NULL, '/^[0]*0$/'); - test_type($db, 230, 'NUMERIC ZEROFILL', 1, NULL, '/^[0]*1$/'); - test_type($db, 240, 'NUMERIC UNSIGNED ZEROFILL', 1.01, NULL, '/^[0]*1$/'); - - echo "done!\n"; + require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + + function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL) { + + $db->exec('DROP TABLE IF EXISTS test'); + $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine()); + @$db->exec($sql); + if ($db->errorCode() != 0) { + // not all MySQL Server versions and/or engines might support the type + return true; + } + + $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)'); + $stmt->bindValue(1, $offset); + $stmt->bindValue(2, $value); + try { + if (!$stmt->execute()) { + printf("[%03d + 1] INSERT failed, %s\n", $offset, var_export($stmt->errorInfo(), true)); + return false; + } + } catch (PDOException $e) { + // This might be a SQL warning on signed values inserted in unsigned columns + // Zerofill implies unsigned but the test plays with signed = negative values as well! + return true; + } + + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); + $stmt = $db->query('SELECT id, label FROM test'); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + if (!isset($row['id']) || !isset($row['label'])) { + printf("[%03d + 2] Fetched result seems wrong, dumping result: %s\n", $offset, var_export($row, true)); + return false; + } + + if ($row['id'] != $offset) { + printf("[%03d + 3] Expecting %s got %s\n", $offset, $row['id']); + return false; + } + + if (!is_null($pattern)) { + + if (!preg_match($pattern, $row['label'])) { + printf("[%03d + 5] Value seems wrong, accepting pattern %s got %s, check manually\n", + $offset, $pattern, var_export($row['label'], true)); + return false; + } + + } else { + + $exp = $value; + if (!is_null($ret_value)) { + // we expect a different return value than our input value + // typically the difference is only the type + $exp = $ret_value; + } + + if ($row['label'] !== $exp) { + printf("[%03d + 4] %s - input = %s/%s, output = %s/%s\n", $offset, + $sql_type, var_export($exp, true), gettype($exp), + var_export($row['label'], true), gettype($row['label'])); + return false; + } + + } + + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + $stmt = $db->query('SELECT id, label FROM test'); + $row_string = $stmt->fetch(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + if ($row['label'] != $row_string['label']) { + printf("%s - STRINGIGY = %s, NATIVE = %s\n", $sql_type, var_export($row_string['label'], true), var_export($row['label'], true)); + return false; + } + + return true; + } + + $db = MySQLPDOTest::factory(); + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); + $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); + + $stmt = $db->prepare('SELECT @@sql_mode AS _mode'); + $stmt->execute(); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + $real_as_float = (false === stristr($row['_mode'], "REAL_AS_FLOAT")) ? false : true; + + test_type($db, 100, 'REAL ZEROFILL', -1.01, NULL, '/^[0]*0$/'); + test_type($db, 110, 'REAL ZEROFILL', 1.01, NULL, ($real_as_float) ? '/^[0]*1\.0.*$/' : '/^[0]*1\.01$/'); + test_type($db, 120, 'REAL UNSIGNED ZEROFILL', 1.01, NULL, ($real_as_float) ? '/^[0]*1\..*$/' : '/^[0]*1\.01$/'); + + test_type($db, 130, 'DOUBLE ZEROFILL', -1.01, NULL, '/^[0]*0$/'); + test_type($db, 140, 'DOUBLE ZEROFILL', 1.01, NULL, '/^[0]*1\.01$/'); + test_type($db, 150, 'DOUBLE UNSIGNED ZEROFILL', 1.01, NULL, '/^[0]*1\.01$/'); + + test_type($db, 160, 'FLOAT ZEROFILL', -1.01, NULL, '/^[0]*0$/'); + test_type($db, 170, 'FLOAT ZEROFILL', 1, NULL, '/^[0]*1$/'); + test_type($db, 180, 'FLOAT UNSIGNED ZEROFILL', -1, NULL, '/^[0]*0$/'); + + test_type($db, 190, 'DECIMAL ZEROFILL', -1.01, NULL, '/^[0]*0$/'); + test_type($db, 200, 'DECIMAL ZEROFILL', 1.01, NULL, '/^[0]*1$/'); + test_type($db, 210, 'DECIMAL UNSIGNED ZEROFILL', 1.01, NULL, '/^[0]*1$/'); + + test_type($db, 220, 'NUMERIC ZEROFILL', -1, NULL, '/^[0]*0$/'); + test_type($db, 230, 'NUMERIC ZEROFILL', 1, NULL, '/^[0]*1$/'); + test_type($db, 240, 'NUMERIC UNSIGNED ZEROFILL', 1.01, NULL, '/^[0]*1$/'); + + echo "done!\n"; ?> --CLEAN-- <?php diff --git a/ext/pdo_mysql/tests/pecl_bug_5200.phpt b/ext/pdo_mysql/tests/pecl_bug_5200.phpt index d44a5c2282..941dc7836e 100644 --- a/ext/pdo_mysql/tests/pecl_bug_5200.phpt +++ b/ext/pdo_mysql/tests/pecl_bug_5200.phpt @@ -15,7 +15,7 @@ $db = PDOTest::test_factory(__DIR__. '/common.phpt'); $db->exec("CREATE TABLE test (bar INT NOT NULL, phase enum('please_select', 'I', 'II', 'IIa', 'IIb', 'III', 'IV'))"); foreach ($db->query('DESCRIBE test phase')->fetchAll(PDO::FETCH_ASSOC) as $row) { - print_r($row); + print_r($row); } ?> --CLEAN-- diff --git a/ext/pdo_mysql/tests/skipif.inc b/ext/pdo_mysql/tests/skipif.inc index e503f55b3c..65c7f34fc6 100644 --- a/ext/pdo_mysql/tests/skipif.inc +++ b/ext/pdo_mysql/tests/skipif.inc @@ -1,3 +1,3 @@ <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) - die('skip PDO_MySQL driver not loaded'); + die('skip PDO_MySQL driver not loaded'); diff --git a/ext/pdo_mysql/tests/table.inc b/ext/pdo_mysql/tests/table.inc index 54bf14f07d..9ef8fac134 100644 --- a/ext/pdo_mysql/tests/table.inc +++ b/ext/pdo_mysql/tests/table.inc @@ -1,7 +1,7 @@ <?php if (!$db) { - require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; - $db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); + require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; + $db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); } // $db->exec('DROP TABLE IF EXISTS test'); $db->exec('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine); diff --git a/ext/pdo_oci/tests/bug46274.phpt b/ext/pdo_oci/tests/bug46274.phpt index 91aa5c883f..388d297199 100644 --- a/ext/pdo_oci/tests/bug46274.phpt +++ b/ext/pdo_oci/tests/bug46274.phpt @@ -16,7 +16,7 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); try { - $db->exec("DROP TABLE test_one_blob"); + $db->exec("DROP TABLE test_one_blob"); } catch (Exception $e) { } diff --git a/ext/pdo_oci/tests/bug46274_2.phpt b/ext/pdo_oci/tests/bug46274_2.phpt index 434cdbc218..cf2618366e 100644 --- a/ext/pdo_oci/tests/bug46274_2.phpt +++ b/ext/pdo_oci/tests/bug46274_2.phpt @@ -16,7 +16,7 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); try { - $db->exec("DROP TABLE test_one_blob"); + $db->exec("DROP TABLE test_one_blob"); } catch (Exception $e) { } diff --git a/ext/pdo_oci/tests/bug57702.phpt b/ext/pdo_oci/tests/bug57702.phpt index ff64399a9a..12f91226c6 100644 --- a/ext/pdo_oci/tests/bug57702.phpt +++ b/ext/pdo_oci/tests/bug57702.phpt @@ -25,20 +25,20 @@ $stmt->execute(); function do_insert($db, $id, $data1, $data2) { - $db->beginTransaction(); - $stmt = $db->prepare("insert into bug57702 (id, data1, data2) values (:id, empty_blob(), empty_blob()) returning data1, data2 into :blob1, :blob2"); - $stmt->bindParam(':id', $id); - $stmt->bindParam(':blob1', $blob1, PDO::PARAM_LOB); - $stmt->bindParam(':blob2', $blob2, PDO::PARAM_LOB); - $blob1 = null; - $blob2 = null; - $stmt->execute(); - - fwrite($blob1, $data1); - fclose($blob1); - fwrite($blob2, $data2); - fclose($blob2); - $db->commit(); + $db->beginTransaction(); + $stmt = $db->prepare("insert into bug57702 (id, data1, data2) values (:id, empty_blob(), empty_blob()) returning data1, data2 into :blob1, :blob2"); + $stmt->bindParam(':id', $id); + $stmt->bindParam(':blob1', $blob1, PDO::PARAM_LOB); + $stmt->bindParam(':blob2', $blob2, PDO::PARAM_LOB); + $blob1 = null; + $blob2 = null; + $stmt->execute(); + + fwrite($blob1, $data1); + fclose($blob1); + fwrite($blob2, $data2); + fclose($blob2); + $db->commit(); } do_insert($db, 1, "row 1 col 1", "row 1 col 2"); @@ -63,8 +63,8 @@ var_dump($row['data2']); echo "\nSecond Query\n"; foreach($db->query("select data1 as d1, data2 as d2 from bug57702 order by id") as $row) { - var_dump($row['d1']); - var_dump($row['d2']); + var_dump($row['d1']); + var_dump($row['d2']); } //////////////////// @@ -89,8 +89,8 @@ echo "\nFourth Query\n"; $a = array(); $i = 0; foreach($db->query("select data1 as d4_1, data2 as d4_2 from bug57702 order by id") as $row) { - $a[$i][0] = $row['d4_1']; - $a[$i][1] = $row['d4_2']; + $a[$i][0] = $row['d4_1']; + $a[$i][1] = $row['d4_2']; $i++; } @@ -112,8 +112,8 @@ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams $a = array(); $i = 0; foreach($db->query("select data1 as d4_1, data2 as d4_2 from bug57702 order by id") as $row) { - $a[$i][0] = $row['d4_1']; - $a[$i][1] = $row['d4_2']; + $a[$i][0] = $row['d4_1']; + $a[$i][1] = $row['d4_2']; $i++; } @@ -131,11 +131,11 @@ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams $a = array(); $i = 0; foreach($db->query("select data1 as d4_1, data2 as d4_2 from bug57702 order by id") as $row) { - $a[$i][0] = $row['d4_1']; - $a[$i][1] = $row['d4_2']; - var_dump(stream_get_contents($a[$i][0])); - var_dump(stream_get_contents($a[$i][1])); - $i++; + $a[$i][0] = $row['d4_1']; + $a[$i][1] = $row['d4_2']; + var_dump(stream_get_contents($a[$i][0])); + var_dump(stream_get_contents($a[$i][1])); + $i++; } // Cleanup diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt index f208fd56d9..bfe4c59f87 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt @@ -22,28 +22,28 @@ echo "Test 1 Check beginTransaction insertion\n"; $dbh->beginTransaction(); try { - $dbh->exec("insert into pdo_ac_tab (col1) values ('data 1')"); - $dbh->exec("insert into pdo_ac_tab (col1) values ('data 2')"); - $dbh->commit(); + $dbh->exec("insert into pdo_ac_tab (col1) values ('data 1')"); + $dbh->exec("insert into pdo_ac_tab (col1) values ('data 2')"); + $dbh->commit(); } catch (PDOException $e) { - echo "Caught unexpected exception at line " . __LINE__ . "\n"; - echo $e->getMessage() . "\n"; - $dbh->rollback(); + echo "Caught unexpected exception at line " . __LINE__ . "\n"; + echo $e->getMessage() . "\n"; + $dbh->rollback(); } echo "Test 2 Cause an exception and test beginTransaction rollback\n"; $dbh->beginTransaction(); try { - $dbh->exec("insert into pdo_ac_tab (col1) values ('not committed #1')"); - $dbh->exec("insert into pdo_ac_tab (col1) values ('data that is too long to fit and will barf')"); - $dbh->commit(); + $dbh->exec("insert into pdo_ac_tab (col1) values ('not committed #1')"); + $dbh->exec("insert into pdo_ac_tab (col1) values ('data that is too long to fit and will barf')"); + $dbh->commit(); } catch (PDOException $e) { - echo "Caught expected exception at line " . __LINE__ . "\n"; - echo $e->getMessage() . "\n"; - $dbh->rollback(); + echo "Caught expected exception at line " . __LINE__ . "\n"; + echo $e->getMessage() . "\n"; + $dbh->rollback(); } echo "Test 3 Setting ATTR_AUTOCOMMIT to true will commit and end the transaction\n"; @@ -53,11 +53,11 @@ $dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, true); print "PDO::ATTR_AUTOCOMMIT: "; var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT)); try { - $dbh->rollback(); + $dbh->rollback(); } catch (PDOException $e) { - echo "Caught expected exception at line " . __LINE__ . "\n"; - echo $e->getMessage() . "\n"; + echo "Caught expected exception at line " . __LINE__ . "\n"; + echo $e->getMessage() . "\n"; } echo "Test 4 Setting ATTR_AUTOCOMMIT to false will commit and end the transaction\n"; @@ -68,11 +68,11 @@ $dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, false); print "PDO::ATTR_AUTOCOMMIT: "; var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT)); try { - $dbh->rollback(); + $dbh->rollback(); } catch (PDOException $e) { - echo "Caught expected exception at line " . __LINE__ . "\n"; - echo $e->getMessage() . "\n"; + echo "Caught expected exception at line " . __LINE__ . "\n"; + echo $e->getMessage() . "\n"; } echo "Test 5 Handle transactions ourselves\n"; diff --git a/ext/pdo_oci/tests/pdo_oci_attr_case.phpt b/ext/pdo_oci/tests/pdo_oci_attr_case.phpt index 5ad89af6b1..09821cb74d 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_case.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_case.phpt @@ -13,22 +13,22 @@ require(__DIR__ . '/../../pdo/tests/pdo_test.inc'); function do_query1($dbh) { - var_dump($dbh->getAttribute(PDO::ATTR_CASE)); - $s = $dbh->prepare("select dummy from dual"); - $s->execute(); - while ($r = $s->fetch(PDO::FETCH_ASSOC)) { - var_dump($r); - } + var_dump($dbh->getAttribute(PDO::ATTR_CASE)); + $s = $dbh->prepare("select dummy from dual"); + $s->execute(); + while ($r = $s->fetch(PDO::FETCH_ASSOC)) { + var_dump($r); + } } function do_query2($dbh, $mode) { - echo "Mode desired is $mode\n"; - $s = $dbh->prepare("select dummy from dual", array(PDO::ATTR_CASE, $mode)); - $s->execute(); - while ($r = $s->fetch(PDO::FETCH_ASSOC)) { - var_dump($r); - } + echo "Mode desired is $mode\n"; + $s = $dbh->prepare("select dummy from dual", array(PDO::ATTR_CASE, $mode)); + $s->execute(); + while ($r = $s->fetch(PDO::FETCH_ASSOC)) { + var_dump($r); + } } $dbh = PDOTest::factory(); diff --git a/ext/pdo_oci/tests/pdo_oci_attr_client.phpt b/ext/pdo_oci/tests/pdo_oci_attr_client.phpt index 3febab71ea..fdb65cf156 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_client.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_client.phpt @@ -19,19 +19,19 @@ var_dump($cv); $s = explode(".", $cv); if (count($s) > 1 && (($s[0] == 10 && $s[1] >= 2) || $s[0] >= 11)) { - if (count($s) != 5) { - echo "Wrong number of values in array\nVersion was: "; - var_dump($cv); - } else { - echo "Version OK, so far as can be portably checked\n"; - } + if (count($s) != 5) { + echo "Wrong number of values in array\nVersion was: "; + var_dump($cv); + } else { + echo "Version OK, so far as can be portably checked\n"; + } } else { - if (count($s) != 2) { - echo "Wrong number of values in array\nVersion was: "; - var_dump($cv); - } else { - echo "Version OK, so far as can be portably checked\n"; - } + if (count($s) != 2) { + echo "Wrong number of values in array\nVersion was: "; + var_dump($cv); + } else { + echo "Version OK, so far as can be portably checked\n"; + } } echo "Done\n"; diff --git a/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt b/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt index 2a38341b27..cb8edba543 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt @@ -13,13 +13,13 @@ require(__DIR__ . '/../../pdo/tests/pdo_test.inc'); function do_query($dbh) { - var_dump($dbh->getAttribute(PDO::ATTR_ORACLE_NULLS)); - $s = $dbh->prepare("select '' as myempty, null as mynull from dual"); - $s->execute(); - while ($r = $s->fetch()) { - var_dump($r[0]); - var_dump($r[1]); - } + var_dump($dbh->getAttribute(PDO::ATTR_ORACLE_NULLS)); + $s = $dbh->prepare("select '' as myempty, null as mynull from dual"); + $s->execute(); + while ($r = $s->fetch()) { + var_dump($r[0]); + var_dump($r[1]); + } } $dbh = PDOTest::factory(); diff --git a/ext/pdo_oci/tests/pdo_oci_attr_server.phpt b/ext/pdo_oci/tests/pdo_oci_attr_server.phpt index 566bd0749d..e17401ddac 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_server.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_server.phpt @@ -22,10 +22,10 @@ echo "ATTR_SERVER_INFO\n"; $si = $dbh->getAttribute(PDO::ATTR_SERVER_INFO); $pos = strpos($si, "Oracle"); if ($pos === 0) { - echo "Found 'Oracle' at position $pos as expected\n"; + echo "Found 'Oracle' at position $pos as expected\n"; } else { - echo "Unexpected result. Server info was:\n"; - var_dump($si); + echo "Unexpected result. Server info was:\n"; + var_dump($si); } echo "Done\n"; diff --git a/ext/pdo_oci/tests/pdo_oci_class_constants.phpt b/ext/pdo_oci/tests/pdo_oci_class_constants.phpt index 0946b3f89b..f66c825245 100644 --- a/ext/pdo_oci/tests/pdo_oci_class_constants.phpt +++ b/ext/pdo_oci/tests/pdo_oci_class_constants.phpt @@ -12,11 +12,11 @@ PDOTest::skip(); require(__DIR__ . '/../../pdo/tests/pdo_test.inc'); $expected = [ - 'OCI_ATTR_CLIENT_INFO' => true, - 'OCI_ATTR_ACTION' => true, - 'OCI_ATTR_CLIENT_IDENTIFIER' => true, - 'OCI_ATTR_MODULE' => true, - 'OCI_ATTR_CALL_TIMEOUT' => true, + 'OCI_ATTR_CLIENT_INFO' => true, + 'OCI_ATTR_ACTION' => true, + 'OCI_ATTR_CLIENT_IDENTIFIER' => true, + 'OCI_ATTR_MODULE' => true, + 'OCI_ATTR_CALL_TIMEOUT' => true, ]; $ref = new ReflectionClass('PDO'); @@ -24,40 +24,40 @@ $constants = $ref->getConstants(); $values = []; foreach ($constants as $name => $value) { - if (substr($name, 0, 8) == 'OCI_ATTR') { - if (!isset($values[$value])) { - $values[$value] = [$name]; + if (substr($name, 0, 8) == 'OCI_ATTR') { + if (!isset($values[$value])) { + $values[$value] = [$name]; } else { - $values[$value][] = $name; + $values[$value][] = $name; } - if (isset($expected[$name])) { - unset($expected[$name]); - unset($constants[$name]); - } + if (isset($expected[$name])) { + unset($expected[$name]); + unset($constants[$name]); + } - } else { - unset($constants[$name]); - } + } else { + unset($constants[$name]); + } } if (!empty($constants)) { - printf("[001] Dumping list of unexpected constants\n"); - var_dump($constants); + printf("[001] Dumping list of unexpected constants\n"); + var_dump($constants); } if (!empty($expected)) { - printf("[002] Dumping list of missing constants\n"); - var_dump($expected); + printf("[002] Dumping list of missing constants\n"); + var_dump($expected); } if (!empty($values)) { - foreach ($values as $value => $constants) { - if (count($constants) > 1) { - printf("[003] Several constants share the same value '%s'\n", $value); - var_dump($constants); - } - } + foreach ($values as $value => $constants) { + if (count($constants) > 1) { + printf("[003] Several constants share the same value '%s'\n", $value); + var_dump($constants); + } + } } print "done!"; diff --git a/ext/pdo_oci/tests/pdo_oci_fread_1.phpt b/ext/pdo_oci/tests/pdo_oci_fread_1.phpt index 0fa06c9ce4..85a0ca19ed 100644 --- a/ext/pdo_oci/tests/pdo_oci_fread_1.phpt +++ b/ext/pdo_oci/tests/pdo_oci_fread_1.phpt @@ -19,7 +19,7 @@ $dbh->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Initialization $stmtarray = array( "begin execute immediate 'drop table pdo_oci_fread_tab'; exception when others then null; end;", - "create table pdo_oci_fread_tab (id number, data clob)", + "create table pdo_oci_fread_tab (id number, data clob)", "declare lob1 clob := 'abc' || lpad('j',4020,'j') || 'xyz'; begin @@ -28,7 +28,7 @@ $stmtarray = array( ); foreach ($stmtarray as $stmt) { - $dbh->exec($stmt); + $dbh->exec($stmt); } echo "Test 1\n"; @@ -47,11 +47,11 @@ fclose($sh); // Clean up $stmtarray = array( - "drop table pdo_oci_fread_tab" + "drop table pdo_oci_fread_tab" ); foreach ($stmtarray as $stmt) { - $dbh->exec($stmt); + $dbh->exec($stmt); } ?> diff --git a/ext/pdo_oci/tests/pdo_oci_quote1.phpt b/ext/pdo_oci/tests/pdo_oci_quote1.phpt index b71ff17e80..415917829f 100644 --- a/ext/pdo_oci/tests/pdo_oci_quote1.phpt +++ b/ext/pdo_oci/tests/pdo_oci_quote1.phpt @@ -21,17 +21,17 @@ $stmt = $db->prepare('select * from poq_tab'); $a = array(null, "", "a", "ab", "abc", "ab'cd", "a\b\n", "'", "''", "a'", "'z", "a''b", '"'); foreach ($a as $u) { - $q = $db->quote($u); - echo "Unquoted : "; - var_dump($u); - echo "Quoted : "; - var_dump($q); + $q = $db->quote($u); + echo "Unquoted : "; + var_dump($u); + echo "Quoted : "; + var_dump($q); - $db->exec("delete from poq_tab"); + $db->exec("delete from poq_tab"); - $db->query("insert into poq_tab (t) values($q)"); - $stmt->execute(); - var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + $db->query("insert into poq_tab (t) values($q)"); + $stmt->execute(); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); } echo "Done\n"; diff --git a/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt b/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt index 1b152c5039..4f3a19c8be 100644 --- a/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt +++ b/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt @@ -13,116 +13,116 @@ echo "Preparations before the test\n"; require(__DIR__ . '/../../pdo/tests/pdo_test.inc'); try { - $db = PDOTest::factory(); - $db->exec(<<<SQL + $db = PDOTest::factory(); + $db->exec(<<<SQL BEGIN EXECUTE IMMEDIATE 'DROP TABLE test'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN - RAISE; + RAISE; END IF; END; SQL ); - $db->exec("CREATE TABLE test(id INT)"); - - $db->beginTransaction(); - - $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC'); - - echo "Test 1. calling function with invalid parameters\n"; - - // execute() has not been called yet - // NOTE: no warning - if (false !== ($tmp = $stmt->getColumnMeta(0))) - printf("[002] Expecting false got %s\n", var_export($tmp, true)); - - $stmt->execute(); - // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 0 given in - if (false !== ($tmp = @$stmt->getColumnMeta())) - printf("[003] Expecting false got %s\n", var_export($tmp, true)); - - // invalid offset - if (false !== ($tmp = @$stmt->getColumnMeta(-1))) - printf("[004] Expecting false got %s\n", var_export($tmp, true)); - - // Warning: PDOStatement::getColumnMeta() expects parameter 1 to be int, array given in - if (false !== ($tmp = @$stmt->getColumnMeta(array()))) - printf("[005] Expecting false got %s\n", var_export($tmp, true)); - - // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 2 given in - if (false !== ($tmp = @$stmt->getColumnMeta(1, 1))) - printf("[006] Expecting false got %s\n", var_export($tmp, true)); - - // invalid offset - if (false !== ($tmp = $stmt->getColumnMeta(1))) - printf("[007] Expecting false because of invalid offset got %s\n", var_export($tmp, true)); - - echo "Test 2. testing return values\n"; - echo "Test 2.1 testing array returned\n"; - - $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC'); - $stmt->execute(); - $native = $stmt->getColumnMeta(0); - if (count($native) == 0) { - printf("[008] Meta data seems wrong, %s / %s\n", - var_export($native, true), var_export($emulated, true)); - } - - - function test_return($meta, $offset, $native_type, $pdo_type){ - if (empty($meta)) { - printf("[%03d + 2] getColumnMeta() failed, %d - %s\n", $offset, - $stmt->errorCode(), var_export($stmt->errorInfo(), true)); - return false; - } - $elements = array('flags', 'scale', 'name', 'len', 'precision', 'pdo_type'); - foreach ($elements as $k => $element) - if (!isset($meta[$element])) { - printf("[%03d + 3] Element %s missing, %s\n", $offset, - $element, var_export($meta, true)); - return false; - } - - if (!is_null($native_type)) { - if (!isset($meta['native_type'])) { - printf("[%03d + 4] Element native_type missing, %s\n", $offset, - var_export($meta, true)); - return false; - } - - if (!is_array($native_type)) - $native_type = array($native_type); - - $found = false; - foreach ($native_type as $k => $type) { - if ($meta['native_type'] == $type) { - $found = true; - break; - } - } - - if (!$found) { - printf("[%03d + 5] Expecting native type %s, %s\n", $offset, - var_export($native_type, true), var_export($meta, true)); - return false; - } - } - - if (!is_null($pdo_type) && ($meta['pdo_type'] != $pdo_type)) { - printf("[%03d + 6] Expecting PDO type %s got %s (%s)\n", $offset, - $pdo_type, var_export($meta, true), var_export($meta['native_type'])); - return false; - } - - return true; - } - - - function test_meta(&$db, $offset, $sql_type, $value, $native_type, $pdo_type) { - - $db->exec(<<<SQL + $db->exec("CREATE TABLE test(id INT)"); + + $db->beginTransaction(); + + $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC'); + + echo "Test 1. calling function with invalid parameters\n"; + + // execute() has not been called yet + // NOTE: no warning + if (false !== ($tmp = $stmt->getColumnMeta(0))) + printf("[002] Expecting false got %s\n", var_export($tmp, true)); + + $stmt->execute(); + // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 0 given in + if (false !== ($tmp = @$stmt->getColumnMeta())) + printf("[003] Expecting false got %s\n", var_export($tmp, true)); + + // invalid offset + if (false !== ($tmp = @$stmt->getColumnMeta(-1))) + printf("[004] Expecting false got %s\n", var_export($tmp, true)); + + // Warning: PDOStatement::getColumnMeta() expects parameter 1 to be int, array given in + if (false !== ($tmp = @$stmt->getColumnMeta(array()))) + printf("[005] Expecting false got %s\n", var_export($tmp, true)); + + // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 2 given in + if (false !== ($tmp = @$stmt->getColumnMeta(1, 1))) + printf("[006] Expecting false got %s\n", var_export($tmp, true)); + + // invalid offset + if (false !== ($tmp = $stmt->getColumnMeta(1))) + printf("[007] Expecting false because of invalid offset got %s\n", var_export($tmp, true)); + + echo "Test 2. testing return values\n"; + echo "Test 2.1 testing array returned\n"; + + $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC'); + $stmt->execute(); + $native = $stmt->getColumnMeta(0); + if (count($native) == 0) { + printf("[008] Meta data seems wrong, %s / %s\n", + var_export($native, true), var_export($emulated, true)); + } + + + function test_return($meta, $offset, $native_type, $pdo_type){ + if (empty($meta)) { + printf("[%03d + 2] getColumnMeta() failed, %d - %s\n", $offset, + $stmt->errorCode(), var_export($stmt->errorInfo(), true)); + return false; + } + $elements = array('flags', 'scale', 'name', 'len', 'precision', 'pdo_type'); + foreach ($elements as $k => $element) + if (!isset($meta[$element])) { + printf("[%03d + 3] Element %s missing, %s\n", $offset, + $element, var_export($meta, true)); + return false; + } + + if (!is_null($native_type)) { + if (!isset($meta['native_type'])) { + printf("[%03d + 4] Element native_type missing, %s\n", $offset, + var_export($meta, true)); + return false; + } + + if (!is_array($native_type)) + $native_type = array($native_type); + + $found = false; + foreach ($native_type as $k => $type) { + if ($meta['native_type'] == $type) { + $found = true; + break; + } + } + + if (!$found) { + printf("[%03d + 5] Expecting native type %s, %s\n", $offset, + var_export($native_type, true), var_export($meta, true)); + return false; + } + } + + if (!is_null($pdo_type) && ($meta['pdo_type'] != $pdo_type)) { + printf("[%03d + 6] Expecting PDO type %s got %s (%s)\n", $offset, + $pdo_type, var_export($meta, true), var_export($meta['native_type'])); + return false; + } + + return true; + } + + + function test_meta(&$db, $offset, $sql_type, $value, $native_type, $pdo_type) { + + $db->exec(<<<SQL BEGIN EXECUTE IMMEDIATE 'DROP TABLE test'; EXCEPTION @@ -134,77 +134,77 @@ END; SQL ); - $sql = sprintf('CREATE TABLE test(id INT, label %s)', $sql_type); - $stmt = $db->prepare($sql); - $stmt->execute(); - - if (!$db->exec(sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $value))) { - printf("[%03d] + 1] Insert failed, %d - %s\n", $offset, - $db->errorCode(), var_export($db->errorInfo(), true)); - return false; - } - - $stmt = $db->prepare('SELECT id, label FROM test'); - $stmt->execute(); - $meta = $stmt->getColumnMeta(1); - return test_return($meta, $offset, $native_type, $pdo_type); - } - - echo "Test 2.2 testing numeric columns\n"; - - test_meta($db, 20, 'NUMBER' , 0 , 'NUMBER', PDO::PARAM_STR); - test_meta($db, 30, 'NUMBER' , 256 , 'NUMBER', PDO::PARAM_STR); - test_meta($db, 40, 'INT' , 256 , 'NUMBER', PDO::PARAM_STR); - test_meta($db, 50, 'INTEGER' , 256 , 'NUMBER', PDO::PARAM_STR); - test_meta($db, 60, 'NUMBER' , 256.01 , 'NUMBER', PDO::PARAM_STR); - test_meta($db, 70, 'NUMBER' , -8388608 , 'NUMBER', PDO::PARAM_STR); - - test_meta($db, 80, 'NUMBER' , 2147483648 , 'NUMBER', PDO::PARAM_STR); - test_meta($db, 90, 'NUMBER' , 4294967295 , 'NUMBER', PDO::PARAM_STR); - - test_meta($db, 100, 'DEC' , 1.01 , 'NUMBER' , PDO::PARAM_STR); - test_meta($db, 110, 'DECIMAL' , 1.01 , 'NUMBER' , PDO::PARAM_STR); - test_meta($db, 120, 'FLOAT' , 1.01 , 'FLOAT' , PDO::PARAM_STR); - test_meta($db, 130, 'DOUBLE PRECISION', 1.01 , 'FLOAT' , PDO::PARAM_STR); - test_meta($db, 140, 'BINARY_FLOAT' , 1.01 , 'BINARY_FLOAT' , PDO::PARAM_STR); - test_meta($db, 150, 'BINARY_DOUBLE' , 1.01 , 'BINARY_DOUBLE', PDO::PARAM_STR); - - echo "Test 2.3 testing temporal columns\n"; - - $db->exec("alter session set nls_date_format='YYYY-MM-DD'"); - test_meta($db, 160, 'DATE' , '2008-04-23' , 'DATE', PDO::PARAM_STR); - - echo "Test 2.4 testing string columns\n"; - - test_meta($db, 170, 'CHAR(1)' , 'a' , 'CHAR' , PDO::PARAM_STR); - test_meta($db, 180, 'CHAR(10)' , '0123456789' , 'CHAR' , PDO::PARAM_STR); - test_meta($db, 190, 'CHAR(255)' , str_repeat('z', 255) , 'CHAR' , PDO::PARAM_STR); - test_meta($db, 200, 'VARCHAR(1)' , 'a' , 'VARCHAR2' , PDO::PARAM_STR); - test_meta($db, 210, 'VARCHAR(10)' , '0123456789' , 'VARCHAR2' , PDO::PARAM_STR); - test_meta($db, 220, 'VARCHAR(255)' , str_repeat('z', 255) , 'VARCHAR2' , PDO::PARAM_STR); - test_meta($db, 230, 'VARCHAR2(1)' , 'a' , 'VARCHAR2' , PDO::PARAM_STR); - test_meta($db, 240, 'VARCHAR2(10)' , '0123456789' , 'VARCHAR2' , PDO::PARAM_STR); - test_meta($db, 250, 'VARCHAR2(255)' , str_repeat('z', 255) , 'VARCHAR2' , PDO::PARAM_STR); - - test_meta($db, 260, 'NCHAR(1)' , 'a' , 'NCHAR' , PDO::PARAM_STR); - test_meta($db, 270, 'NCHAR(10)' , '0123456789' , 'NCHAR' , PDO::PARAM_STR); - test_meta($db, 280, 'NCHAR(255)' , str_repeat('z', 255) , 'NCHAR' , PDO::PARAM_STR); - test_meta($db, 290, 'NVARCHAR2(1)' , 'a' , 'NVARCHAR2', PDO::PARAM_STR); - test_meta($db, 300, 'NVARCHAR2(10)' , '0123456789' , 'NVARCHAR2', PDO::PARAM_STR); - test_meta($db, 310, 'NVARCHAR2(255)', str_repeat('z', 255) , 'NVARCHAR2', PDO::PARAM_STR); - - echo "Test 2.5 testing lobs columns\n"; - - test_meta($db, 320, 'CLOB' , str_repeat('b', 255) , 'CLOB' , PDO::PARAM_LOB); - test_meta($db, 330, 'BLOB' , str_repeat('b', 256) , 'BLOB' , PDO::PARAM_LOB); - test_meta($db, 340, 'NCLOB' , str_repeat('b', 255) , 'NCLOB' , PDO::PARAM_LOB); - - test_meta($db, 350, 'LONG' , str_repeat('b', 256) , 'LONG' , PDO::PARAM_STR); - test_meta($db, 360, 'LONG RAW' , str_repeat('b', 256) , 'LONG RAW', PDO::PARAM_STR); - test_meta($db, 370, 'RAW(256)' , str_repeat('b', 256) , 'RAW' , PDO::PARAM_STR); - - - $db->exec(<<<SQL + $sql = sprintf('CREATE TABLE test(id INT, label %s)', $sql_type); + $stmt = $db->prepare($sql); + $stmt->execute(); + + if (!$db->exec(sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $value))) { + printf("[%03d] + 1] Insert failed, %d - %s\n", $offset, + $db->errorCode(), var_export($db->errorInfo(), true)); + return false; + } + + $stmt = $db->prepare('SELECT id, label FROM test'); + $stmt->execute(); + $meta = $stmt->getColumnMeta(1); + return test_return($meta, $offset, $native_type, $pdo_type); + } + + echo "Test 2.2 testing numeric columns\n"; + + test_meta($db, 20, 'NUMBER' , 0 , 'NUMBER', PDO::PARAM_STR); + test_meta($db, 30, 'NUMBER' , 256 , 'NUMBER', PDO::PARAM_STR); + test_meta($db, 40, 'INT' , 256 , 'NUMBER', PDO::PARAM_STR); + test_meta($db, 50, 'INTEGER' , 256 , 'NUMBER', PDO::PARAM_STR); + test_meta($db, 60, 'NUMBER' , 256.01 , 'NUMBER', PDO::PARAM_STR); + test_meta($db, 70, 'NUMBER' , -8388608 , 'NUMBER', PDO::PARAM_STR); + + test_meta($db, 80, 'NUMBER' , 2147483648 , 'NUMBER', PDO::PARAM_STR); + test_meta($db, 90, 'NUMBER' , 4294967295 , 'NUMBER', PDO::PARAM_STR); + + test_meta($db, 100, 'DEC' , 1.01 , 'NUMBER' , PDO::PARAM_STR); + test_meta($db, 110, 'DECIMAL' , 1.01 , 'NUMBER' , PDO::PARAM_STR); + test_meta($db, 120, 'FLOAT' , 1.01 , 'FLOAT' , PDO::PARAM_STR); + test_meta($db, 130, 'DOUBLE PRECISION', 1.01 , 'FLOAT' , PDO::PARAM_STR); + test_meta($db, 140, 'BINARY_FLOAT' , 1.01 , 'BINARY_FLOAT' , PDO::PARAM_STR); + test_meta($db, 150, 'BINARY_DOUBLE' , 1.01 , 'BINARY_DOUBLE', PDO::PARAM_STR); + + echo "Test 2.3 testing temporal columns\n"; + + $db->exec("alter session set nls_date_format='YYYY-MM-DD'"); + test_meta($db, 160, 'DATE' , '2008-04-23' , 'DATE', PDO::PARAM_STR); + + echo "Test 2.4 testing string columns\n"; + + test_meta($db, 170, 'CHAR(1)' , 'a' , 'CHAR' , PDO::PARAM_STR); + test_meta($db, 180, 'CHAR(10)' , '0123456789' , 'CHAR' , PDO::PARAM_STR); + test_meta($db, 190, 'CHAR(255)' , str_repeat('z', 255) , 'CHAR' , PDO::PARAM_STR); + test_meta($db, 200, 'VARCHAR(1)' , 'a' , 'VARCHAR2' , PDO::PARAM_STR); + test_meta($db, 210, 'VARCHAR(10)' , '0123456789' , 'VARCHAR2' , PDO::PARAM_STR); + test_meta($db, 220, 'VARCHAR(255)' , str_repeat('z', 255) , 'VARCHAR2' , PDO::PARAM_STR); + test_meta($db, 230, 'VARCHAR2(1)' , 'a' , 'VARCHAR2' , PDO::PARAM_STR); + test_meta($db, 240, 'VARCHAR2(10)' , '0123456789' , 'VARCHAR2' , PDO::PARAM_STR); + test_meta($db, 250, 'VARCHAR2(255)' , str_repeat('z', 255) , 'VARCHAR2' , PDO::PARAM_STR); + + test_meta($db, 260, 'NCHAR(1)' , 'a' , 'NCHAR' , PDO::PARAM_STR); + test_meta($db, 270, 'NCHAR(10)' , '0123456789' , 'NCHAR' , PDO::PARAM_STR); + test_meta($db, 280, 'NCHAR(255)' , str_repeat('z', 255) , 'NCHAR' , PDO::PARAM_STR); + test_meta($db, 290, 'NVARCHAR2(1)' , 'a' , 'NVARCHAR2', PDO::PARAM_STR); + test_meta($db, 300, 'NVARCHAR2(10)' , '0123456789' , 'NVARCHAR2', PDO::PARAM_STR); + test_meta($db, 310, 'NVARCHAR2(255)', str_repeat('z', 255) , 'NVARCHAR2', PDO::PARAM_STR); + + echo "Test 2.5 testing lobs columns\n"; + + test_meta($db, 320, 'CLOB' , str_repeat('b', 255) , 'CLOB' , PDO::PARAM_LOB); + test_meta($db, 330, 'BLOB' , str_repeat('b', 256) , 'BLOB' , PDO::PARAM_LOB); + test_meta($db, 340, 'NCLOB' , str_repeat('b', 255) , 'NCLOB' , PDO::PARAM_LOB); + + test_meta($db, 350, 'LONG' , str_repeat('b', 256) , 'LONG' , PDO::PARAM_STR); + test_meta($db, 360, 'LONG RAW' , str_repeat('b', 256) , 'LONG RAW', PDO::PARAM_STR); + test_meta($db, 370, 'RAW(256)' , str_repeat('b', 256) , 'RAW' , PDO::PARAM_STR); + + + $db->exec(<<<SQL BEGIN EXECUTE IMMEDIATE 'DROP TABLE test'; EXCEPTION @@ -215,63 +215,63 @@ EXCEPTION END; SQL ); - echo "Test 2.6 testing function return\n"; - - $stmt = $db->query('SELECT count(*) FROM dual'); - $meta = $stmt->getColumnMeta(0); - test_return($meta, 380, 'NUMBER', PDO::PARAM_STR); - $stmt = $db->query("SELECT TO_DATE('2008-04-23') FROM dual"); - $meta = $stmt->getColumnMeta(0); - test_return($meta, 390, 'DATE', PDO::PARAM_STR); - $stmt = $db->query("SELECT TO_CHAR(542) FROM dual"); - $meta = $stmt->getColumnMeta(0); - test_return($meta, 400, 'VARCHAR2', PDO::PARAM_STR); - - - echo "Test 2.7 testing flags returned\n"; - - $sql = sprintf('CREATE TABLE test(id INT NOT NULL, label INT NULL)'); - $stmt = $db->prepare($sql); - $stmt->execute(); - $db->exec('INSERT INTO test(id, label) VALUES (1, 1)'); - $stmt = $db->query('SELECT id, label FROM test'); - $meta = $stmt->getColumnMeta(0); - // verify the flags array contains a not_null flag and not nullable flags - if (!isset($meta['flags'])) { - printf("[1001] No flags contained in metadata %s\n", var_export($meta, true)); - } else { - $flags = $meta['flags']; - $found = false; - foreach ($flags as $k => $flag) { - if ($flag == 'not_null') - $found = true; - if ($flag == 'nullable') - printf("[1003] Flags seem wrong %s\n", var_export($meta, true)); - } - if (!$found) - printf("[1002] Flags seem wrong %s\n", var_export($meta, true)); - } - $meta = $stmt->getColumnMeta(1); - // verify the flags array contains a nullable flag and not not_null flags - if (!isset($meta['flags'])) { - printf("[1003] No flags contained in metadata %s\n", var_export($meta, true)); - } else { - $flags = $meta['flags']; - $found = false; - foreach ($flags as $k => $flag) { - if ($flag == 'not_null') - printf("[1004] Flags seem wrong %s\n", var_export($meta, true)); - if ($flag == 'nullable') - $found = true; - } - if (!$found) - printf("[1005] Flags seem wrong %s\n", var_export($meta, true)); - } + echo "Test 2.6 testing function return\n"; + + $stmt = $db->query('SELECT count(*) FROM dual'); + $meta = $stmt->getColumnMeta(0); + test_return($meta, 380, 'NUMBER', PDO::PARAM_STR); + $stmt = $db->query("SELECT TO_DATE('2008-04-23') FROM dual"); + $meta = $stmt->getColumnMeta(0); + test_return($meta, 390, 'DATE', PDO::PARAM_STR); + $stmt = $db->query("SELECT TO_CHAR(542) FROM dual"); + $meta = $stmt->getColumnMeta(0); + test_return($meta, 400, 'VARCHAR2', PDO::PARAM_STR); + + + echo "Test 2.7 testing flags returned\n"; + + $sql = sprintf('CREATE TABLE test(id INT NOT NULL, label INT NULL)'); + $stmt = $db->prepare($sql); + $stmt->execute(); + $db->exec('INSERT INTO test(id, label) VALUES (1, 1)'); + $stmt = $db->query('SELECT id, label FROM test'); + $meta = $stmt->getColumnMeta(0); + // verify the flags array contains a not_null flag and not nullable flags + if (!isset($meta['flags'])) { + printf("[1001] No flags contained in metadata %s\n", var_export($meta, true)); + } else { + $flags = $meta['flags']; + $found = false; + foreach ($flags as $k => $flag) { + if ($flag == 'not_null') + $found = true; + if ($flag == 'nullable') + printf("[1003] Flags seem wrong %s\n", var_export($meta, true)); + } + if (!$found) + printf("[1002] Flags seem wrong %s\n", var_export($meta, true)); + } + $meta = $stmt->getColumnMeta(1); + // verify the flags array contains a nullable flag and not not_null flags + if (!isset($meta['flags'])) { + printf("[1003] No flags contained in metadata %s\n", var_export($meta, true)); + } else { + $flags = $meta['flags']; + $found = false; + foreach ($flags as $k => $flag) { + if ($flag == 'not_null') + printf("[1004] Flags seem wrong %s\n", var_export($meta, true)); + if ($flag == 'nullable') + $found = true; + } + if (!$found) + printf("[1005] Flags seem wrong %s\n", var_export($meta, true)); + } } catch (PDOException $e) { - // we should never get here, we use warnings, but never trust a system... - printf("[001] %s, [%s} %s\n", - $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo())); + // we should never get here, we use warnings, but never trust a system... + printf("[001] %s, [%s} %s\n", + $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo())); } $db->exec(<<<SQL diff --git a/ext/pdo_oci/tests/pdo_oci_stream_1.phpt b/ext/pdo_oci/tests/pdo_oci_stream_1.phpt index ee2008d33f..a1dd8451ba 100644 --- a/ext/pdo_oci/tests/pdo_oci_stream_1.phpt +++ b/ext/pdo_oci/tests/pdo_oci_stream_1.phpt @@ -20,11 +20,11 @@ $dbh->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); @$dbh->exec("drop table pdo_oci_stream_1_tab"); $stmtarray = array( - "create table pdo_oci_stream_1_tab (id number, data clob)", + "create table pdo_oci_stream_1_tab (id number, data clob)", ); foreach ($stmtarray as $stmt) { - $dbh->exec($stmt); + $dbh->exec($stmt); } $dbh->exec(" @@ -76,11 +76,11 @@ echo 'Read '.stream_get_contents($r['data'], -1, 30000)."\n"; // jjjxyz // Clean up $stmtarray = array( - "drop table pdo_oci_stream_1_tab" + "drop table pdo_oci_stream_1_tab" ); foreach ($stmtarray as $stmt) { - $dbh->exec($stmt); + $dbh->exec($stmt); } ?> diff --git a/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt b/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt index 7164f5ad6f..a50b4815c3 100644 --- a/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt +++ b/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt @@ -26,16 +26,16 @@ $j = 9; $a_val = ord('a'); foreach($db->query("select data1 as d4_1, data2 as d4_2 from pdo_oci_stream_2 order by id") as $row) { $a = $row['d4_1']; - $a1 = $row['d4_2']; + $a1 = $row['d4_2']; $str1 = stream_get_contents($a); - $str2 = stream_get_contents($a1); + $str2 = stream_get_contents($a1); $str1len = strlen($str1); - $str2len = strlen($str2); + $str2len = strlen($str2); $b = ord($str1[0]); - $b1 = ord($str2[0]); + $b1 = ord($str2[0]); if (($b != ($a_val + $i)) && ($str1len != (4086 + $i)) && ($b1 != ($a_val + $j)) && ($str2len != (4086 + $j))) { @@ -56,8 +56,8 @@ foreach($db->query("select data1 as d4_1, data2 as d4_2 from pdo_oci_stream_2 or $i++; if ($i>9) $i = 0; - $j--; - if ($j<0) + $j--; + if ($j<0) $j = 9; } echo "Fetch operation done!\n"; diff --git a/ext/pdo_oci/tests/pecl_bug_6364.phpt b/ext/pdo_oci/tests/pecl_bug_6364.phpt index 054d58a0f8..affdc77649 100644 --- a/ext/pdo_oci/tests/pecl_bug_6364.phpt +++ b/ext/pdo_oci/tests/pecl_bug_6364.phpt @@ -32,7 +32,7 @@ var_dump($out_param1); var_dump($out_param2); foreach ($dbh->query("select * from bug_6364_t") as $row) { - var_dump($row); + var_dump($row); } print "Done\n"; diff --git a/ext/pdo_odbc/tests/long_columns.phpt b/ext/pdo_odbc/tests/long_columns.phpt index bb02dcf89f..5f369a50d4 100644 --- a/ext/pdo_odbc/tests/long_columns.phpt +++ b/ext/pdo_odbc/tests/long_columns.phpt @@ -46,11 +46,11 @@ $db = PDOTest::test_factory('ext/pdo_odbc/tests/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data CLOB)')) { - if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data longtext)')) { - if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data varchar(4000))')) { - die("BORK: don't know how to create a long column here:\n" . implode(", ", $db->errorInfo())); - } - } + if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data longtext)')) { + if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data varchar(4000))')) { + die("BORK: don't know how to create a long column here:\n" . implode(", ", $db->errorInfo())); + } + } } $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); @@ -61,32 +61,32 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sizes = array(32, 53, 64, 79, 128, 253, 254, 255, 256, 257, 258, 1022, 1023, 1024, 1025, 1026, 510, 511, 512, 513, 514, 1278, 1279, 1280, 1281, 1282, 2046, 2047, 2048, 2049, 2050, 1534, 1535, 1536, 1537, 1538, 3070, 3071, 3072, 3073, 3074, 3998, 3999, 4000); function alpha_repeat($len) { - // use the alphabet instead of 'i' characters to make sure the blocks don't overlap when they are reassembled - $out = ""; - while (strlen($out) < $len) { - $out .= "abcdefghijklmnopqrstuvwxyz"; - } - return substr($out, 0, $len); + // use the alphabet instead of 'i' characters to make sure the blocks don't overlap when they are reassembled + $out = ""; + while (strlen($out) < $len) { + $out .= "abcdefghijklmnopqrstuvwxyz"; + } + return substr($out, 0, $len); } // don't use Prepared Statements. that fails on MS SQL server (works with Access, MyODBC), which is a separate failure, feature/code-path from what // this test does - nice to be able to test using MS SQL server foreach ($sizes as $num) { - $text = alpha_repeat($num); - $db->exec("INSERT INTO TEST VALUES($num, '$text')"); + $text = alpha_repeat($num); + $db->exec("INSERT INTO TEST VALUES($num, '$text')"); } // verify data foreach ($db->query('SELECT id, data from TEST ORDER BY LEN(data) ASC') as $row) { - $expect = alpha_repeat($row[0]); - if (strcmp($expect, $row[1])) { - echo "Failed on size $row[id]:\n"; - printf("Expected %d bytes, got %d\n", strlen($expect), strlen($row['data'])); - echo ($expect) . "\n"; - echo ($row['data']) . "\n"; - } else { - echo "Passed on size $row[id]\n"; - } + $expect = alpha_repeat($row[0]); + if (strcmp($expect, $row[1])) { + echo "Failed on size $row[id]:\n"; + printf("Expected %d bytes, got %d\n", strlen($expect), strlen($row['data'])); + echo ($expect) . "\n"; + echo ($row['data']) . "\n"; + } else { + echo "Passed on size $row[id]\n"; + } } echo "Finished\n"; diff --git a/ext/pdo_odbc/tests/max_columns.phpt b/ext/pdo_odbc/tests/max_columns.phpt index ae68a09e91..b36eb5381f 100644 --- a/ext/pdo_odbc/tests/max_columns.phpt +++ b/ext/pdo_odbc/tests/max_columns.phpt @@ -11,11 +11,11 @@ $db = PDOTest::test_factory('ext/pdo_odbc/tests/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data varchar(max))')) { - if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data longtext)')) { - if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data CLOB)')) { - die("BORK: don't know how to create a long column here:\n" . implode(", ", $db->errorInfo())); - } - } + if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data longtext)')) { + if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data CLOB)')) { + die("BORK: don't know how to create a long column here:\n" . implode(", ", $db->errorInfo())); + } + } } $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); @@ -25,19 +25,19 @@ $sizes = array(32, 64, 128, 253, 254, 255, 256, 257, 258, 512, 1024, 2048, 3998, $db->beginTransaction(); $insert = $db->prepare('INSERT INTO TEST VALUES (?, ?)'); foreach ($sizes as $num) { - $insert->execute(array($num, str_repeat('i', $num))); + $insert->execute(array($num, str_repeat('i', $num))); } $insert = null; $db->commit(); foreach ($db->query('SELECT id, data from TEST') as $row) { - $expect = str_repeat('i', $row[0]); - if (strcmp($expect, $row[1])) { - echo "Failed on size $row[id]:\n"; - printf("Expected %d bytes, got %d\n", strlen($expect), strlen($row['data'])); - echo bin2hex($expect) . "\n"; - echo bin2hex($row['data']) . "\n"; - } + $expect = str_repeat('i', $row[0]); + if (strcmp($expect, $row[1])) { + echo "Failed on size $row[id]:\n"; + printf("Expected %d bytes, got %d\n", strlen($expect), strlen($row['data'])); + echo bin2hex($expect) . "\n"; + echo bin2hex($row['data']) . "\n"; + } } echo "Finished\n"; diff --git a/ext/pdo_pgsql/tests/bug43925.phpt b/ext/pdo_pgsql/tests/bug43925.phpt index d90f36fbbc..20b1156de5 100644 --- a/ext/pdo_pgsql/tests/bug43925.phpt +++ b/ext/pdo_pgsql/tests/bug43925.phpt @@ -29,13 +29,13 @@ $dbh->query('INSERT INTO nodes (id, root, lft, rgt) VALUES (3, 1, 4, 5);'); $stmt = $dbh->prepare(' - SELECT * - FROM nodes - WHERE (:rootId > 0 OR lft > :left OR rgt > :left) - AND (root = :rootId OR root = :left) - AND (1 > :left OR 1 < :left OR 1 = :left) - AND (:x > 0 OR :x < 10 OR :x > 100) - OR :y = 1 OR :left = 1 + SELECT * + FROM nodes + WHERE (:rootId > 0 OR lft > :left OR rgt > :left) + AND (root = :rootId OR root = :left) + AND (1 > :left OR 1 < :left OR 1 = :left) + AND (:x > 0 OR :x < 10 OR :x > 100) + OR :y = 1 OR :left = 1 '); $stmt->bindValue('left', 1, PDO::PARAM_INT); @@ -46,8 +46,8 @@ $stmt->bindValue('y', 50, PDO::PARAM_INT); $stmt->execute(); foreach ($stmt->fetchAll() as $row) { - print implode(' - ', $row); - print "\n"; + print implode(' - ', $row); + print "\n"; } $dbh->query('DROP TABLE nodes'); diff --git a/ext/pdo_pgsql/tests/bug46274.phpt b/ext/pdo_pgsql/tests/bug46274.phpt index 0ae6849b41..9f3dbf0542 100644 --- a/ext/pdo_pgsql/tests/bug46274.phpt +++ b/ext/pdo_pgsql/tests/bug46274.phpt @@ -15,7 +15,7 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); try { - @$db->query("SET bytea_output = 'escape'"); + @$db->query("SET bytea_output = 'escape'"); } catch (Exception $e) { } diff --git a/ext/pdo_pgsql/tests/bug48764.phpt b/ext/pdo_pgsql/tests/bug48764.phpt index 1f890267e5..c1d6c6a74f 100644 --- a/ext/pdo_pgsql/tests/bug48764.phpt +++ b/ext/pdo_pgsql/tests/bug48764.phpt @@ -37,7 +37,7 @@ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); bug($db); putenv('PDOTEST_ATTR='.serialize(array( - PDO::ATTR_EMULATE_PREPARES => 1, + PDO::ATTR_EMULATE_PREPARES => 1, ))); $db = PDOTest::factory('PDO', false); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); @@ -50,14 +50,14 @@ putenv('PDOTEST_ATTR'); function bug($db, $options = array()) { - try { - $stmt = $db->prepare("SELECT ?", $options); - $stmt->execute(array(1)); - echo "OK\n"; - } catch (PDOException $e) { - // Indetermined data type when using native prepared statements - echo $e->getCode()."\n"; - } + try { + $stmt = $db->prepare("SELECT ?", $options); + $stmt->execute(array(1)); + echo "OK\n"; + } catch (PDOException $e) { + // Indetermined data type when using native prepared statements + echo $e->getCode()."\n"; + } } --EXPECT-- Test 1 diff --git a/ext/pdo_pgsql/tests/bug66584.phpt b/ext/pdo_pgsql/tests/bug66584.phpt index 7c98046a30..4fc43d8817 100644 --- a/ext/pdo_pgsql/tests/bug66584.phpt +++ b/ext/pdo_pgsql/tests/bug66584.phpt @@ -21,24 +21,24 @@ $pdo->query("CREATE TABLE b66584 (a int)"); $pdo->query("INSERT INTO b66584 VALUES (165)"); for ($i = 1; $i >= 0; $i--) { - $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, (bool)$i); + $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, (bool)$i); - try { - run($pdo, [0 => 1, 2 => 165, 5 => 3]); - } catch (\Exception $e) { - var_dump($e->getMessage()); - } + try { + run($pdo, [0 => 1, 2 => 165, 5 => 3]); + } catch (\Exception $e) { + var_dump($e->getMessage()); + } - try { - run($pdo, json_decode('{"0":234,"1":165,"2":221,"3":207,"4":188,"5":216,"6":1150,"7":916,"8":967,"9":987,"10":951,"11":990,"12":959,"13":896,"14":947,"15":877,"16":1000,"17":1023,"18":904,"19":856,"20":860,"21":866,"22":930,"23":974,"24":1032,"25":1016,"26":1050,"27":1059,"28":1040,"29":1064,"30":1004,"31":214,"32":189,"33":166,"34":1002,"35":167,"36":191,"37":859,"38":204,"39":181,"40":1001,"42":208,"43":198,"44":177,"45":1003,"46":858,"47":190,"48":162,"49":210,"50":171,"51":197,"52":168,"53":194,"54":209,"55":200,"56":192,"57":180,"58":232,"59":222,"60":163,"61":196,"62":217,"64":176,"65":193,"66":172,"67":195,"68":170,"69":173,"70":233,"71":223,"72":218,"73":186,"74":175,"75":224,"76":205,"77":211,"78":235,"79":1101,"80":225,"81":236,"82":1102,"83":1164,"84":1083,"85":1005,"86":861,"87":1179,"88":960,"89":991,"90":1187,"91":880,"92":1149,"93":1033,"94":931,"95":1006,"96":862,"97":1151,"98":917,"99":881,"100":1148,"101":1065,"102":867,"103":952,"104":1152,"105":918,"106":961,"107":1180,"108":992,"109":1188,"110":932,"111":933,"112":968,"113":868,"114":882,"115":1147,"116":1017,"117":1131,"118":1174,"119":1178,"120":1186,"121":869,"122":1051,"123":934,"124":969,"125":975,"126":1066,"127":237,"128":953,"129":1024,"130":1146,"131":883,"132":1145,"133":884,"134":885,"135":1144,"136":886,"137":1143,"138":1025,"139":897,"140":898,"141":899,"142":1026,"143":1142,"144":887,"145":1141,"146":888,"147":889,"148":1140,"149":1189,"150":993,"151":1139,"152":890,"153":1138,"154":891,"155":900,"156":892,"157":1137,"158":1027,"159":901,"160":1136,"161":893,"162":870,"163":1052,"164":954,"165":1041,"166":1018,"167":1165,"168":1084,"169":962,"170":1181,"171":994,"172":1190,"173":1042,"174":935,"175":226,"176":871,"177":1191,"178":995,"179":977,"180":948,"181":1175,"182":1053,"183":955,"184":1182,"185":963,"186":1067,"187":919,"188":1153,"189":920,"190":1154,"191":1055,"192":1054,"193":1056,"194":863,"195":872,"196":1028,"197":921,"198":1155,"199":936,"200":970,"201":1019,"202":1166,"203":1085,"204":1135,"205":894,"206":1034,"207":905,"208":873,"209":937,"210":902,"211":1029,"212":1007,"213":864,"214":1043,"215":1057,"216":956,"217":957,"218":939,"219":1086,"220":1167,"221":1087,"222":1168,"223":1173,"224":1108,"225":978,"226":1044,"227":1183,"228":964,"229":965,"230":1184,"231":1045,"232":874,"233":940,"234":1046,"235":979,"236":903,"237":980,"238":1156,"239":922,"240":1035,"241":906,"242":971,"243":972,"244":878,"245":1134,"246":879,"247":1133,"248":907,"249":1036,"250":908,"251":1132,"252":895,"253":909,"254":1060,"255":981,"256":1068,"257":996,"258":1192,"259":941,"260":865,"261":1008,"262":910,"263":997,"264":1193,"265":982,"266":942,"267":1020,"268":983,"269":1061,"270":949,"271":1176,"272":875,"273":911,"274":1069,"275":1157,"276":923,"277":1158,"278":924,"279":988,"280":984,"281":925,"282":1159,"283":1062,"284":1047,"285":1194,"286":998,"287":1021,"288":1030,"289":1031,"290":1070,"291":1088,"292":1169,"293":958,"294":1195,"295":999,"296":966,"297":1185,"298":944,"299":945,"300":1022,"301":1103,"302":220,"303":1099,"304":1048,"305":927,"306":1161,"307":989,"308":973,"309":1071,"310":1074,"311":1072,"312":1073,"313":912,"314":1037,"315":913,"316":914,"317":1177,"318":950,"319":1049,"320":876,"321":985,"322":915,"323":1038,"324":946,"325":1089,"326":1170,"327":1090,"328":1171,"329":1091,"330":1172,"331":1063,"332":986,"333":928,"334":1162,"335":929,"336":1163,"337":976,"338":231,"339":201,"340":1098,"341":215}', true)); - } catch (\Exception $e) { - var_dump($e->getMessage()); - } + try { + run($pdo, json_decode('{"0":234,"1":165,"2":221,"3":207,"4":188,"5":216,"6":1150,"7":916,"8":967,"9":987,"10":951,"11":990,"12":959,"13":896,"14":947,"15":877,"16":1000,"17":1023,"18":904,"19":856,"20":860,"21":866,"22":930,"23":974,"24":1032,"25":1016,"26":1050,"27":1059,"28":1040,"29":1064,"30":1004,"31":214,"32":189,"33":166,"34":1002,"35":167,"36":191,"37":859,"38":204,"39":181,"40":1001,"42":208,"43":198,"44":177,"45":1003,"46":858,"47":190,"48":162,"49":210,"50":171,"51":197,"52":168,"53":194,"54":209,"55":200,"56":192,"57":180,"58":232,"59":222,"60":163,"61":196,"62":217,"64":176,"65":193,"66":172,"67":195,"68":170,"69":173,"70":233,"71":223,"72":218,"73":186,"74":175,"75":224,"76":205,"77":211,"78":235,"79":1101,"80":225,"81":236,"82":1102,"83":1164,"84":1083,"85":1005,"86":861,"87":1179,"88":960,"89":991,"90":1187,"91":880,"92":1149,"93":1033,"94":931,"95":1006,"96":862,"97":1151,"98":917,"99":881,"100":1148,"101":1065,"102":867,"103":952,"104":1152,"105":918,"106":961,"107":1180,"108":992,"109":1188,"110":932,"111":933,"112":968,"113":868,"114":882,"115":1147,"116":1017,"117":1131,"118":1174,"119":1178,"120":1186,"121":869,"122":1051,"123":934,"124":969,"125":975,"126":1066,"127":237,"128":953,"129":1024,"130":1146,"131":883,"132":1145,"133":884,"134":885,"135":1144,"136":886,"137":1143,"138":1025,"139":897,"140":898,"141":899,"142":1026,"143":1142,"144":887,"145":1141,"146":888,"147":889,"148":1140,"149":1189,"150":993,"151":1139,"152":890,"153":1138,"154":891,"155":900,"156":892,"157":1137,"158":1027,"159":901,"160":1136,"161":893,"162":870,"163":1052,"164":954,"165":1041,"166":1018,"167":1165,"168":1084,"169":962,"170":1181,"171":994,"172":1190,"173":1042,"174":935,"175":226,"176":871,"177":1191,"178":995,"179":977,"180":948,"181":1175,"182":1053,"183":955,"184":1182,"185":963,"186":1067,"187":919,"188":1153,"189":920,"190":1154,"191":1055,"192":1054,"193":1056,"194":863,"195":872,"196":1028,"197":921,"198":1155,"199":936,"200":970,"201":1019,"202":1166,"203":1085,"204":1135,"205":894,"206":1034,"207":905,"208":873,"209":937,"210":902,"211":1029,"212":1007,"213":864,"214":1043,"215":1057,"216":956,"217":957,"218":939,"219":1086,"220":1167,"221":1087,"222":1168,"223":1173,"224":1108,"225":978,"226":1044,"227":1183,"228":964,"229":965,"230":1184,"231":1045,"232":874,"233":940,"234":1046,"235":979,"236":903,"237":980,"238":1156,"239":922,"240":1035,"241":906,"242":971,"243":972,"244":878,"245":1134,"246":879,"247":1133,"248":907,"249":1036,"250":908,"251":1132,"252":895,"253":909,"254":1060,"255":981,"256":1068,"257":996,"258":1192,"259":941,"260":865,"261":1008,"262":910,"263":997,"264":1193,"265":982,"266":942,"267":1020,"268":983,"269":1061,"270":949,"271":1176,"272":875,"273":911,"274":1069,"275":1157,"276":923,"277":1158,"278":924,"279":988,"280":984,"281":925,"282":1159,"283":1062,"284":1047,"285":1194,"286":998,"287":1021,"288":1030,"289":1031,"290":1070,"291":1088,"292":1169,"293":958,"294":1195,"295":999,"296":966,"297":1185,"298":944,"299":945,"300":1022,"301":1103,"302":220,"303":1099,"304":1048,"305":927,"306":1161,"307":989,"308":973,"309":1071,"310":1074,"311":1072,"312":1073,"313":912,"314":1037,"315":913,"316":914,"317":1177,"318":950,"319":1049,"320":876,"321":985,"322":915,"323":1038,"324":946,"325":1089,"326":1170,"327":1090,"328":1171,"329":1091,"330":1172,"331":1063,"332":986,"333":928,"334":1162,"335":929,"336":1163,"337":976,"338":231,"339":201,"340":1098,"341":215}', true)); + } catch (\Exception $e) { + var_dump($e->getMessage()); + } } try { - $pdo->query("DROP TABLE b66584"); - $pdo->rollback(); + $pdo->query("DROP TABLE b66584"); + $pdo->rollback(); } catch (\Exception $e) { } @@ -48,11 +48,11 @@ function run($pdo, $data) $stmt = $pdo->prepare("SELECT COUNT(*) FROM b66584 WHERE a IN ({$bind})"); - var_dump(count($data)); + var_dump(count($data)); $stmt->execute($data); - var_dump($stmt->fetchColumn()); + var_dump($stmt->fetchColumn()); } ?> diff --git a/ext/pdo_pgsql/tests/bug67462.phpt b/ext/pdo_pgsql/tests/bug67462.phpt index 11a39a5f12..197bbb32ed 100644 --- a/ext/pdo_pgsql/tests/bug67462.phpt +++ b/ext/pdo_pgsql/tests/bug67462.phpt @@ -17,14 +17,14 @@ $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $pdo->beginTransaction(); try { - $pdo->query("CREATE TABLE b67462 (a int NOT NULL PRIMARY KEY DEFERRABLE INITIALLY DEFERRED)"); - $pdo->query("INSERT INTO b67462 VALUES (1), (1)"); + $pdo->query("CREATE TABLE b67462 (a int NOT NULL PRIMARY KEY DEFERRABLE INITIALLY DEFERRED)"); + $pdo->query("INSERT INTO b67462 VALUES (1), (1)"); - var_dump($pdo->inTransaction()); - $pdo->commit(); // This should fail! + var_dump($pdo->inTransaction()); + $pdo->commit(); // This should fail! } catch (\Exception $e) { - var_dump($pdo->inTransaction()); - var_dump($pdo->beginTransaction()); + var_dump($pdo->inTransaction()); + var_dump($pdo->beginTransaction()); } ?> diff --git a/ext/pdo_pgsql/tests/bug68371.phpt b/ext/pdo_pgsql/tests/bug68371.phpt index 24dc5f501f..8cbcc7179c 100644 --- a/ext/pdo_pgsql/tests/bug68371.phpt +++ b/ext/pdo_pgsql/tests/bug68371.phpt @@ -16,53 +16,53 @@ $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $attrs = array( // Extensive test: default value and set+get values - PDO::ATTR_EMULATE_PREPARES => array(null, true, false), - PDO::PGSQL_ATTR_DISABLE_PREPARES => array(null, true, false), + PDO::ATTR_EMULATE_PREPARES => array(null, true, false), + PDO::PGSQL_ATTR_DISABLE_PREPARES => array(null, true, false), // Just test the default - PDO::ATTR_AUTOCOMMIT => array(null), - PDO::ATTR_PREFETCH => array(null), - PDO::ATTR_TIMEOUT => array(null), - PDO::ATTR_ERRMODE => array(null), - PDO::ATTR_SERVER_VERSION => array(null), - PDO::ATTR_CLIENT_VERSION => array(null), - PDO::ATTR_SERVER_INFO => array(null), - PDO::ATTR_CONNECTION_STATUS => array(null), - PDO::ATTR_CASE => array(null), - PDO::ATTR_CURSOR_NAME => array(null), - PDO::ATTR_CURSOR => array(null), - PDO::ATTR_ORACLE_NULLS => array(null), - PDO::ATTR_PERSISTENT => array(null), - PDO::ATTR_STATEMENT_CLASS => array(null), - PDO::ATTR_FETCH_TABLE_NAMES => array(null), - PDO::ATTR_FETCH_CATALOG_NAMES => array(null), - PDO::ATTR_DRIVER_NAME => array(null), - PDO::ATTR_STRINGIFY_FETCHES => array(null), - PDO::ATTR_MAX_COLUMN_LEN => array(null), - PDO::ATTR_DEFAULT_FETCH_MODE => array(null), + PDO::ATTR_AUTOCOMMIT => array(null), + PDO::ATTR_PREFETCH => array(null), + PDO::ATTR_TIMEOUT => array(null), + PDO::ATTR_ERRMODE => array(null), + PDO::ATTR_SERVER_VERSION => array(null), + PDO::ATTR_CLIENT_VERSION => array(null), + PDO::ATTR_SERVER_INFO => array(null), + PDO::ATTR_CONNECTION_STATUS => array(null), + PDO::ATTR_CASE => array(null), + PDO::ATTR_CURSOR_NAME => array(null), + PDO::ATTR_CURSOR => array(null), + PDO::ATTR_ORACLE_NULLS => array(null), + PDO::ATTR_PERSISTENT => array(null), + PDO::ATTR_STATEMENT_CLASS => array(null), + PDO::ATTR_FETCH_TABLE_NAMES => array(null), + PDO::ATTR_FETCH_CATALOG_NAMES => array(null), + PDO::ATTR_DRIVER_NAME => array(null), + PDO::ATTR_STRINGIFY_FETCHES => array(null), + PDO::ATTR_MAX_COLUMN_LEN => array(null), + PDO::ATTR_DEFAULT_FETCH_MODE => array(null), ); foreach ($attrs as $a => $vals) { - foreach ($vals as $v) { - try { - if (!isset($v)) { - var_dump($pdo->getAttribute($a)); - } else { - $pdo->setAttribute($a, $v); - if ($pdo->getAttribute($a) === $v) { - echo "OK\n"; - } else { - throw new \Exception('KO'); - } - } - } catch (\Exception $e) { - if ($e->getCode() == 'IM001') { - echo "ERR\n"; - } else { - echo "ERR {$e->getMessage()}\n"; - } - } - } + foreach ($vals as $v) { + try { + if (!isset($v)) { + var_dump($pdo->getAttribute($a)); + } else { + $pdo->setAttribute($a, $v); + if ($pdo->getAttribute($a) === $v) { + echo "OK\n"; + } else { + throw new \Exception('KO'); + } + } + } catch (\Exception $e) { + if ($e->getCode() == 'IM001') { + echo "ERR\n"; + } else { + echo "ERR {$e->getMessage()}\n"; + } + } + } } ?> diff --git a/ext/pdo_pgsql/tests/bug69344.phpt b/ext/pdo_pgsql/tests/bug69344.phpt index 14d45d0ddb..f544518455 100644 --- a/ext/pdo_pgsql/tests/bug69344.phpt +++ b/ext/pdo_pgsql/tests/bug69344.phpt @@ -16,19 +16,19 @@ $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $pdo->setAttribute (\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC); $test = function () use ($pdo) { - $arr = [ - 0 => "a", - 2 => "b", - ]; - - $stmt = $pdo->prepare("SELECT (?)::text AS a, (?)::text AS b"); - - try { - $stmt->execute($arr); - var_dump($stmt->fetch()); - } catch (\Exception $e) { - echo $e->getMessage()."\n"; - } + $arr = [ + 0 => "a", + 2 => "b", + ]; + + $stmt = $pdo->prepare("SELECT (?)::text AS a, (?)::text AS b"); + + try { + $stmt->execute($arr); + var_dump($stmt->fetch()); + } catch (\Exception $e) { + echo $e->getMessage()."\n"; + } }; $test(); diff --git a/ext/pdo_pgsql/tests/bug70313.phpt b/ext/pdo_pgsql/tests/bug70313.phpt index f734442f8c..07c7f68ab3 100644 --- a/ext/pdo_pgsql/tests/bug70313.phpt +++ b/ext/pdo_pgsql/tests/bug70313.phpt @@ -15,20 +15,20 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); try { - $stmt = $db->prepare(");"); + $stmt = $db->prepare(");"); - $stmt->execute([1]); + $stmt->execute([1]); } catch (PDOException $e) { - var_dump($e->getCode()); + var_dump($e->getCode()); } $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); try { - $stmt = $db->prepare(");"); + $stmt = $db->prepare(");"); - $stmt->execute([1]); + $stmt->execute([1]); } catch (PDOException $e) { - var_dump($e->getCode()); + var_dump($e->getCode()); } ?> diff --git a/ext/pdo_pgsql/tests/bug70861.phpt b/ext/pdo_pgsql/tests/bug70861.phpt index 2da08e6e03..a7d1d1f9d6 100644 --- a/ext/pdo_pgsql/tests/bug70861.phpt +++ b/ext/pdo_pgsql/tests/bug70861.phpt @@ -15,7 +15,7 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); try { - @$db->query("SET bytea_output = 'escape'"); + @$db->query("SET bytea_output = 'escape'"); } catch (Exception $e) { } @@ -23,10 +23,10 @@ $db->query('DROP TABLE IF EXISTS test_blob_crash CASCADE'); $db->query('CREATE TABLE test_blob_crash (id SERIAL NOT NULL, blob1 BYTEA)'); class HelloWrapper { - public function stream_open() { return true; } - public function stream_eof() { return true; } - public function stream_read() { return NULL; } - public function stream_stat() { return array(); } + public function stream_open() { return true; } + public function stream_eof() { return true; } + public function stream_read() { return NULL; } + public function stream_stat() { return array(); } } stream_wrapper_register("hello", "HelloWrapper"); diff --git a/ext/pdo_pgsql/tests/bug71885.phpt b/ext/pdo_pgsql/tests/bug71885.phpt index ea5b1882ff..f47ffcb444 100644 --- a/ext/pdo_pgsql/tests/bug71885.phpt +++ b/ext/pdo_pgsql/tests/bug71885.phpt @@ -16,19 +16,19 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_NUM); foreach ([false, true] as $emulate) { - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, $emulate); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, $emulate); - try { - $stmt = $db->prepare('select ?- lseg \'((-1,0),(1,0))\''); - $stmt->execute(); - } catch (PDOException $e) { - var_dump('ERR'); - } + try { + $stmt = $db->prepare('select ?- lseg \'((-1,0),(1,0))\''); + $stmt->execute(); + } catch (PDOException $e) { + var_dump('ERR'); + } - $stmt = $db->prepare('select ??- lseg \'((-1,0),(1,0))\''); - $stmt->execute(); + $stmt = $db->prepare('select ??- lseg \'((-1,0),(1,0))\''); + $stmt->execute(); - var_dump($stmt->fetch()); + var_dump($stmt->fetch()); } ?> diff --git a/ext/pdo_pgsql/tests/bug71885_2.phpt b/ext/pdo_pgsql/tests/bug71885_2.phpt index f957a39610..452902ed38 100644 --- a/ext/pdo_pgsql/tests/bug71885_2.phpt +++ b/ext/pdo_pgsql/tests/bug71885_2.phpt @@ -25,15 +25,15 @@ $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_NUM); $jsonb = $db->quote(json_encode(['a' => 1])); foreach ([false, true] as $emulate) { - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, $emulate); + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, $emulate); - $stmt = $db->prepare("SELECT {$jsonb}::jsonb ?? ?"); - $stmt->execute(['b']); - var_dump($stmt->fetch()); + $stmt = $db->prepare("SELECT {$jsonb}::jsonb ?? ?"); + $stmt->execute(['b']); + var_dump($stmt->fetch()); - $stmt = $db->prepare("SELECT {$jsonb}::jsonb ???"); - $stmt->execute(['a']); - var_dump($stmt->fetch()); + $stmt = $db->prepare("SELECT {$jsonb}::jsonb ???"); + $stmt->execute(['a']); + var_dump($stmt->fetch()); } ?> diff --git a/ext/pdo_pgsql/tests/bug72294.phpt b/ext/pdo_pgsql/tests/bug72294.phpt index bd5124ff17..6940fa8d1f 100644 --- a/ext/pdo_pgsql/tests/bug72294.phpt +++ b/ext/pdo_pgsql/tests/bug72294.phpt @@ -102,7 +102,7 @@ class PreparedStatementCache //return $pdo->prepare( $sql ); $this->cached_statements[$sql] = $pdo->prepare( $sql ); - return $this->cached_statements[$sql]; + return $this->cached_statements[$sql]; } } @@ -110,29 +110,29 @@ class DatabaseTest extends PHPUnit_Framework_TestCase { public function testIt() { - $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); + $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); - $prepared_statement_cache = new PreparedStatementCache( $pdo ); + $prepared_statement_cache = new PreparedStatementCache( $pdo ); - for( $i = 1; $i <= 300; ++$i ) { - $statement = $prepared_statement_cache->prepare( $pdo, <<<SQL + for( $i = 1; $i <= 300; ++$i ) { + $statement = $prepared_statement_cache->prepare( $pdo, <<<SQL SELECT $i; SQL - ); + ); $statement->execute(); - } + } } public function test_construct() { - $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); + $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); - $pdo->exec( 'CREATE TEMPORARY TABLE temp_table ( test_column INT NOT NULL );' ); + $pdo->exec( 'CREATE TEMPORARY TABLE temp_table ( test_column INT NOT NULL );' ); - $this->cache = new PreparedStatementCache( $pdo ); + $this->cache = new PreparedStatementCache( $pdo ); - $statement = $this->cache->prepare( $pdo, 'SELECT * FROM temp_table WHERE test_column > 0' ); - $statement->execute(); + $statement = $this->cache->prepare( $pdo, 'SELECT * FROM temp_table WHERE test_column > 0' ); + $statement->execute(); } } diff --git a/ext/pdo_pgsql/tests/bug72570.phpt b/ext/pdo_pgsql/tests/bug72570.phpt index b479974484..1d5512f1f6 100644 --- a/ext/pdo_pgsql/tests/bug72570.phpt +++ b/ext/pdo_pgsql/tests/bug72570.phpt @@ -18,9 +18,9 @@ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $stmt = $db->prepare("SELECT 1"); try { - var_dump($stmt->execute([1])); + var_dump($stmt->execute([1])); } catch (PDOException $e) { - var_dump($e->getCode()); + var_dump($e->getCode()); } ?> diff --git a/ext/pdo_pgsql/tests/bug75402.phpt b/ext/pdo_pgsql/tests/bug75402.phpt index 9c7460b871..52ae4df957 100644 --- a/ext/pdo_pgsql/tests/bug75402.phpt +++ b/ext/pdo_pgsql/tests/bug75402.phpt @@ -46,7 +46,7 @@ $db->query("INSERT INTO bug75402 (\"id\", \"group_id\", \"submitter\", \"operati -$sql = "SELECT +$sql = "SELECT ID as \"sID\", GROUP_ID as \"sGroupID\", SUBMITTER as \"sOwner\", @@ -56,19 +56,19 @@ $sql = "SELECT STATUS as \"sStatus\", PROGRESS as \"sProgress\", HIDDEN as \"bHidden\", - to_char(INSERT_DATETIME, 'IYYY.MM.DD HH24:MI:SS') as \"sDatetime\" - FROM bug75402 + to_char(INSERT_DATETIME, 'IYYY.MM.DD HH24:MI:SS') as \"sDatetime\" + FROM bug75402 ORDER BY INSERT_DATETIME DESC"; if ($db) { $stmt = $db->prepare($sql, - array( - // With the following options memory is not being - // deallocated - \PDO::ATTR_CURSOR => \PDO::CURSOR_SCROLL - // With the following option memory is de-allocated - // \PDO::ATTR_CURSOR => \PDO::CURSOR_FWDONLY - ) + array( + // With the following options memory is not being + // deallocated + \PDO::ATTR_CURSOR => \PDO::CURSOR_SCROLL + // With the following option memory is de-allocated + // \PDO::ATTR_CURSOR => \PDO::CURSOR_FWDONLY + ) ); $stmt->execute(); diff --git a/ext/pdo_pgsql/tests/bug_33876.phpt b/ext/pdo_pgsql/tests/bug_33876.phpt index dc213f6abb..a425f6d9f6 100644 --- a/ext/pdo_pgsql/tests/bug_33876.phpt +++ b/ext/pdo_pgsql/tests/bug_33876.phpt @@ -23,70 +23,70 @@ $res = $db->prepare('SELECT foo from test where bar = ?'); # this is the portable approach to binding a bool $res->bindValue(1, false, PDO::PARAM_BOOL); if (!$res->execute()) - print_r($res->errorInfo()); + print_r($res->errorInfo()); else - print_r($res->fetchAll(PDO::FETCH_ASSOC)); + print_r($res->fetchAll(PDO::FETCH_ASSOC)); # this is the portable approach to binding a bool $res->bindValue(1, true, PDO::PARAM_BOOL); if (!$res->execute()) - print_r($res->errorInfo()); + print_r($res->errorInfo()); else - print_r($res->fetchAll(PDO::FETCH_ASSOC)); + print_r($res->fetchAll(PDO::FETCH_ASSOC)); # true gets cast to string (because the implied default is string) # true-as-string is 1, so this "works" if (!$res->execute(array(true))) - print_r($res->errorInfo()); + print_r($res->errorInfo()); else - print_r($res->fetchAll(PDO::FETCH_ASSOC)); + print_r($res->fetchAll(PDO::FETCH_ASSOC)); # Expected to fail; unless told otherwise, PDO assumes string inputs # false -> "" as string, which pgsql doesn't like if (!$res->execute(array(false))) - print_r($res->errorInfo()); + print_r($res->errorInfo()); else - print_r($res->fetchAll(PDO::FETCH_ASSOC)); + print_r($res->fetchAll(PDO::FETCH_ASSOC)); # And now using emulator prepares echo "EMUL\n"; $res = $db->prepare('SELECT foo from test where bar = ?', array( - PDO::ATTR_EMULATE_PREPARES => true)); + PDO::ATTR_EMULATE_PREPARES => true)); # this is the portable approach to binding a bool $res->bindValue(1, false, PDO::PARAM_BOOL); if (!$res->execute()) - print_r($res->errorInfo()); + print_r($res->errorInfo()); else - print_r($res->fetchAll(PDO::FETCH_ASSOC)); + print_r($res->fetchAll(PDO::FETCH_ASSOC)); # this is the portable approach to binding a bool $res->bindValue(1, true, PDO::PARAM_BOOL); if (!$res->execute()) - print_r($res->errorInfo()); + print_r($res->errorInfo()); else - print_r($res->fetchAll(PDO::FETCH_ASSOC)); + print_r($res->fetchAll(PDO::FETCH_ASSOC)); # true gets cast to string (because the implied default is string) # true-as-string is 1, so this "works" if (!$res->execute(array(true))) - print_r($res->errorInfo()); + print_r($res->errorInfo()); else - print_r($res->fetchAll(PDO::FETCH_ASSOC)); + print_r($res->fetchAll(PDO::FETCH_ASSOC)); # Expected to fail; unless told otherwise, PDO assumes string inputs # false -> "" as string, which pgsql doesn't like if (!$res->execute(array(false))) { - $err = $res->errorInfo(); - // Strip additional lines outputted by recent PgSQL versions - $err[2] = trim(current(explode("\n", $err[2]))); - print_r($err); + $err = $res->errorInfo(); + // Strip additional lines outputted by recent PgSQL versions + $err[2] = trim(current(explode("\n", $err[2]))); + print_r($err); } else { - print_r($res->fetchAll(PDO::FETCH_ASSOC)); + print_r($res->fetchAll(PDO::FETCH_ASSOC)); } --EXPECTF-- Array diff --git a/ext/pdo_pgsql/tests/config.inc b/ext/pdo_pgsql/tests/config.inc index 0fefe4664b..367671e42a 100644 --- a/ext/pdo_pgsql/tests/config.inc +++ b/ext/pdo_pgsql/tests/config.inc @@ -1,16 +1,16 @@ <?php if (false !== getenv('PDO_PGSQL_TEST_DSN')) { - # user set them from their shell - $config['ENV']['PDOTEST_DSN'] = getenv('PDO_PGSQL_TEST_DSN'); - if (false !== getenv('PDO_PGSQL_TEST_ATTR')) { - $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_PGSQL_TEST_ATTR'); - } + # user set them from their shell + $config['ENV']['PDOTEST_DSN'] = getenv('PDO_PGSQL_TEST_DSN'); + if (false !== getenv('PDO_PGSQL_TEST_ATTR')) { + $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_PGSQL_TEST_ATTR'); + } } else { - $config['ENV']['PDOTEST_DSN'] = 'pgsql:host=localhost port=5432 dbname=test user=postgres password=postgres'; - $config['ENV']['PDOTEST_USER'] = 'postgres'; - $config['ENV']['PDOTEST_PASS'] = 'postgres'; + $config['ENV']['PDOTEST_DSN'] = 'pgsql:host=localhost port=5432 dbname=test user=postgres password=postgres'; + $config['ENV']['PDOTEST_USER'] = 'postgres'; + $config['ENV']['PDOTEST_PASS'] = 'postgres'; } foreach ($config['ENV'] as $k => $v) { - putenv("$k=$v"); + putenv("$k=$v"); } diff --git a/ext/pdo_pgsql/tests/copy_from.phpt b/ext/pdo_pgsql/tests/copy_from.phpt index 55a9df72aa..b57a8ea9ae 100644 --- a/ext/pdo_pgsql/tests/copy_from.phpt +++ b/ext/pdo_pgsql/tests/copy_from.phpt @@ -22,11 +22,11 @@ $tableRows = array(); $tableRowsWithDifferentNullValues = array(); for($i=0;$i<3;$i++) { - $firstParameter = $i; - $secondParameter = "test insert {$i}"; - $tableRows[] = "{$firstParameter}\t{$secondParameter}\t\\N"; - $tableRowsWithDifferentNullValues[] = "{$firstParameter};{$secondParameter};NULL"; - $tableRowsWithDifferentNullValuesAndSelectedFields[] = "{$firstParameter};NULL"; + $firstParameter = $i; + $secondParameter = "test insert {$i}"; + $tableRows[] = "{$firstParameter}\t{$secondParameter}\t\\N"; + $tableRowsWithDifferentNullValues[] = "{$firstParameter};{$secondParameter};NULL"; + $tableRowsWithDifferentNullValuesAndSelectedFields[] = "{$firstParameter};NULL"; } $filename = 'test_pgsqlCopyFromFile.csv'; $filenameWithDifferentNullValues = 'test_pgsqlCopyFromFileWithDifferentNullValues.csv'; @@ -42,7 +42,7 @@ var_dump($db->pgsqlCopyFromArray('test',$tableRows)); $stmt = $db->query("select * from test"); foreach($stmt as $r) { - var_dump($r); + var_dump($r); } $db->rollback(); @@ -51,7 +51,7 @@ $db->beginTransaction(); var_dump($db->pgsqlCopyFromArray('test',$tableRowsWithDifferentNullValues,";","NULL")); $stmt = $db->query("select * from test"); foreach($stmt as $r) { - var_dump($r); + var_dump($r); } $db->rollback(); @@ -60,16 +60,16 @@ $db->beginTransaction(); var_dump($db->pgsqlCopyFromArray('test',$tableRowsWithDifferentNullValuesAndSelectedFields,";","NULL",'a,c')); $stmt = $db->query("select * from test"); foreach($stmt as $r) { - var_dump($r); + var_dump($r); } $db->rollback(); echo "Testing pgsqlCopyFromArray() with error\n"; $db->beginTransaction(); try { - var_dump($db->pgsqlCopyFromArray('test_error',$tableRowsWithDifferentNullValuesAndSelectedFields,";","NULL",'a,c')); + var_dump($db->pgsqlCopyFromArray('test_error',$tableRowsWithDifferentNullValuesAndSelectedFields,";","NULL",'a,c')); } catch (Exception $e) { - echo "Exception: {$e->getMessage()}\n"; + echo "Exception: {$e->getMessage()}\n"; } $db->rollback(); @@ -79,7 +79,7 @@ var_dump($db->pgsqlCopyFromFile('test',$filename)); $stmt = $db->query("select * from test"); foreach($stmt as $r) { - var_dump($r); + var_dump($r); } $db->rollback(); @@ -88,7 +88,7 @@ $db->beginTransaction(); var_dump($db->pgsqlCopyFromFile('test',$filenameWithDifferentNullValues,";","NULL")); $stmt = $db->query("select * from test"); foreach($stmt as $r) { - var_dump($r); + var_dump($r); } $db->rollback(); @@ -97,31 +97,31 @@ $db->beginTransaction(); var_dump($db->pgsqlCopyFromFile('test',$filenameWithDifferentNullValuesAndSelectedFields,";","NULL",'a,c')); $stmt = $db->query("select * from test"); foreach($stmt as $r) { - var_dump($r); + var_dump($r); } $db->rollback(); echo "Testing pgsqlCopyFromFile() with error\n"; $db->beginTransaction(); try { - var_dump($db->pgsqlCopyFromFile('test_error',$filenameWithDifferentNullValuesAndSelectedFields,";","NULL",'a,c')); + var_dump($db->pgsqlCopyFromFile('test_error',$filenameWithDifferentNullValuesAndSelectedFields,";","NULL",'a,c')); } catch (Exception $e) { - echo "Exception: {$e->getMessage()}\n"; + echo "Exception: {$e->getMessage()}\n"; } $db->rollback(); echo "Testing pgsqlCopyFromFile() with non existing file\n"; $db->beginTransaction(); try { - var_dump($db->pgsqlCopyFromFile('test',"nonexisting/foo.csv",";","NULL",'a,c')); + var_dump($db->pgsqlCopyFromFile('test',"nonexisting/foo.csv",";","NULL",'a,c')); } catch (Exception $e) { - echo "Exception: {$e->getMessage()}\n"; + echo "Exception: {$e->getMessage()}\n"; } $db->rollback(); // Clean up foreach (array($filename, $filenameWithDifferentNullValues, $filenameWithDifferentNullValuesAndSelectedFields) as $f) { - @unlink($f); + @unlink($f); } ?> --EXPECTF-- diff --git a/ext/pdo_pgsql/tests/copy_to.phpt b/ext/pdo_pgsql/tests/copy_to.phpt index 3df882c93c..edda1483db 100644 --- a/ext/pdo_pgsql/tests/copy_to.phpt +++ b/ext/pdo_pgsql/tests/copy_to.phpt @@ -22,13 +22,13 @@ echo "Preparing test table for CopyTo tests\n"; $stmt = $db->prepare("INSERT INTO test (a, b, c) values (?, ?, ?)"); for($i=0;$i<3;$i++) { - $firstParameter = $i; - $secondParameter = "test insert {$i}"; - $thirdParameter = NULL; - $stmt->bindValue(1, $firstParameter); - $stmt->bindValue(2, $secondParameter); - $stmt->bindValue(3, $thirdParameter); - $stmt->execute(); + $firstParameter = $i; + $secondParameter = "test insert {$i}"; + $thirdParameter = NULL; + $stmt->bindValue(1, $firstParameter); + $stmt->bindValue(2, $secondParameter); + $stmt->bindValue(3, $thirdParameter); + $stmt->execute(); } $db->commit(); @@ -42,9 +42,9 @@ var_dump($db->pgsqlCopyToArray('test',";","NULL",'a,c')); echo "Testing pgsqlCopyToArray() with error\n"; try { - var_dump($db->pgsqlCopyToArray('test_error')); + var_dump($db->pgsqlCopyToArray('test_error')); } catch (Exception $e) { - echo "Exception: {$e->getMessage()}\n"; + echo "Exception: {$e->getMessage()}\n"; } echo "Testing pgsqlCopyToFile() with default parameters\n"; @@ -61,20 +61,20 @@ echo file_get_contents($filename); echo "Testing pgsqlCopyToFile() with error\n"; try { - var_dump($db->pgsqlCopyToFile('test_error',$filename)); + var_dump($db->pgsqlCopyToFile('test_error',$filename)); } catch (Exception $e) { - echo "Exception: {$e->getMessage()}\n"; + echo "Exception: {$e->getMessage()}\n"; } echo "Testing pgsqlCopyToFile() to unwritable file\n"; try { - var_dump($db->pgsqlCopyToFile('test', 'nonexistent/foo.csv')); + var_dump($db->pgsqlCopyToFile('test', 'nonexistent/foo.csv')); } catch (Exception $e) { - echo "Exception: {$e->getMessage()}\n"; + echo "Exception: {$e->getMessage()}\n"; } if(isset($filename)) { - @unlink($filename); + @unlink($filename); } ?> --EXPECTF-- diff --git a/ext/pdo_pgsql/tests/disable_prepares.phpt b/ext/pdo_pgsql/tests/disable_prepares.phpt index bbc6a62e87..f224bffb15 100644 --- a/ext/pdo_pgsql/tests/disable_prepares.phpt +++ b/ext/pdo_pgsql/tests/disable_prepares.phpt @@ -15,7 +15,7 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_COLUMN); $stmt = $db->prepare("SELECT statement FROM pg_prepared_statements", array( - PDO::ATTR_EMULATE_PREPARES => true)); + PDO::ATTR_EMULATE_PREPARES => true)); $stmt2 = $db->prepare("SELECT (?)::int2"); $stmt2->execute(array(1)); @@ -27,7 +27,7 @@ $stmt->execute(); $first = $stmt->fetchAll(); $stmt3 = $db->prepare("SELECT (?)::int4", array( - PDO::PGSQL_ATTR_DISABLE_PREPARES => true)); + PDO::PGSQL_ATTR_DISABLE_PREPARES => true)); $stmt3->execute(array(3)); var_dump($stmt3->fetch()); $stmt3->execute(array(4)); diff --git a/ext/pdo_pgsql/tests/is_in_transaction.phpt b/ext/pdo_pgsql/tests/is_in_transaction.phpt index f5e950a047..cff798619b 100644 --- a/ext/pdo_pgsql/tests/is_in_transaction.phpt +++ b/ext/pdo_pgsql/tests/is_in_transaction.phpt @@ -39,19 +39,19 @@ $stmt->bindValue(1, "error"); $stmt->bindValue(2, "test insert"); $stmt->execute(); } catch (Exception $e) { - /* We catch the exception because the execute will give error and we must test the PDO::PGSQL_TRANSACTION_ERROR */ - echo "Test PDO::PGSQL_TRANSACTION_INERROR\n"; - var_dump($db->inTransaction()); - $db->rollBack(); + /* We catch the exception because the execute will give error and we must test the PDO::PGSQL_TRANSACTION_ERROR */ + echo "Test PDO::PGSQL_TRANSACTION_INERROR\n"; + var_dump($db->inTransaction()); + $db->rollBack(); } echo "Test PDO::PGSQL_TRANSACTION_IDLE\n"; var_dump($db->inTransaction()); } catch (Exception $e) { - /* catch exceptions so that we can show the relative error */ - echo "Exception! at line ", $e->getLine(), "\n"; - var_dump($e->getMessage()); + /* catch exceptions so that we can show the relative error */ + echo "Exception! at line ", $e->getLine(), "\n"; + var_dump($e->getMessage()); } ?> diff --git a/ext/pdo_pgsql/tests/large_objects.phpt b/ext/pdo_pgsql/tests/large_objects.phpt index 6215e49cb5..d1f1f05048 100644 --- a/ext/pdo_pgsql/tests/large_objects.phpt +++ b/ext/pdo_pgsql/tests/large_objects.phpt @@ -38,8 +38,8 @@ $stmt->bindColumn('bloboid', $lob, PDO::PARAM_LOB); $stmt->execute(); echo "Fetching:\n"; while (($row = $stmt->fetch(PDO::FETCH_ASSOC))) { - var_dump($row['blobid']); - var_dump(stream_get_contents($lob)); + var_dump($row['blobid']); + var_dump(stream_get_contents($lob)); } echo "Fetched!\n"; @@ -49,8 +49,8 @@ $stmt->execute(); $stmt->bindColumn('bloboid', $lob, PDO::PARAM_LOB); echo "Fetching late bind:\n"; while (($row = $stmt->fetch(PDO::FETCH_ASSOC))) { - var_dump($row['blobid']); - var_dump(is_int($row['bloboid'])); + var_dump($row['blobid']); + var_dump(is_int($row['bloboid'])); } echo "Fetched!\n"; @@ -60,16 +60,16 @@ $stmt->execute(); $stmt->bindColumn('bloboid', $lob, PDO::PARAM_LOB); echo "Fetching NO bind:\n"; while (($row = $stmt->fetch(PDO::FETCH_ASSOC))) { - var_dump($row['blobid']); - var_dump(is_int($row['bloboid'])); + var_dump($row['blobid']); + var_dump(is_int($row['bloboid'])); } echo "Fetched!\n"; } catch (Exception $e) { - /* catch exceptions so that we can guarantee to clean - * up the LOB */ - echo "Exception! at line ", $e->getLine(), "\n"; - var_dump($e->getMessage()); + /* catch exceptions so that we can guarantee to clean + * up the LOB */ + echo "Exception! at line ", $e->getLine(), "\n"; + var_dump($e->getMessage()); } /* Now to remove the large object from the database, so it doesn't diff --git a/ext/pdo_sqlite/tests/bug35336.phpt b/ext/pdo_sqlite/tests/bug35336.phpt index 201429bc4e..52a425b62f 100644 --- a/ext/pdo_sqlite/tests/bug35336.phpt +++ b/ext/pdo_sqlite/tests/bug35336.phpt @@ -7,9 +7,9 @@ if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; --FILE-- <?php class EEE { - function __set ($field, $value) { - echo "hello world\n"; - } + function __set ($field, $value) { + echo "hello world\n"; + } } $a = new PDO("sqlite::memory:");// pool ("sqlite::memory:"); diff --git a/ext/pdo_sqlite/tests/bug43831.phpt b/ext/pdo_sqlite/tests/bug43831.phpt index 514b8c2b5f..1909d88033 100644 --- a/ext/pdo_sqlite/tests/bug43831.phpt +++ b/ext/pdo_sqlite/tests/bug43831.phpt @@ -6,23 +6,23 @@ Bug #43831 ($this gets mangled when extending PDO with persistent connection) <?php class Foo extends PDO { - function __construct($dsn) { - parent::__construct($dsn, null, null, array(PDO::ATTR_PERSISTENT => true)); - } + function __construct($dsn) { + parent::__construct($dsn, null, null, array(PDO::ATTR_PERSISTENT => true)); + } } class Baz extends PDO { - function __construct($dsn) { - parent::__construct($dsn, null, null, array(PDO::ATTR_PERSISTENT => true)); - } + function __construct($dsn) { + parent::__construct($dsn, null, null, array(PDO::ATTR_PERSISTENT => true)); + } } class Bar extends Baz { - function quux() { - echo get_class($this), "\n"; - $foo = new Foo("sqlite::memory:"); - echo get_class($this), "\n"; - } + function quux() { + echo get_class($this), "\n"; + $foo = new Foo("sqlite::memory:"); + echo get_class($this), "\n"; + } } $bar = new Bar("sqlite::memory:"); diff --git a/ext/pdo_sqlite/tests/bug48773.phpt b/ext/pdo_sqlite/tests/bug48773.phpt index c9a2f64bef..a5f43cdd92 100644 --- a/ext/pdo_sqlite/tests/bug48773.phpt +++ b/ext/pdo_sqlite/tests/bug48773.phpt @@ -8,18 +8,18 @@ if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; <?php class bar extends PDOStatement { - private function __construct() { - } + private function __construct() { + } } class foo extends PDO { - public $statementClass = 'bar'; - function __construct($dsn, $username, $password, $driver_options = array()) { - $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; - parent::__construct($dsn, $username, $password, $driver_options); + public $statementClass = 'bar'; + function __construct($dsn, $username, $password, $driver_options = array()) { + $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; + parent::__construct($dsn, $username, $password, $driver_options); - $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array($this))); - } + $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array($this))); + } } $db = new foo('sqlite::memory:', '', ''); diff --git a/ext/pdo_sqlite/tests/bug50728.phpt b/ext/pdo_sqlite/tests/bug50728.phpt index b00ea50cf0..98f8907f48 100644 --- a/ext/pdo_sqlite/tests/bug50728.phpt +++ b/ext/pdo_sqlite/tests/bug50728.phpt @@ -7,9 +7,9 @@ if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; --FILE-- <?php try { - $a = new PDO("sqlite:/this/path/should/not/exist.db"); + $a = new PDO("sqlite:/this/path/should/not/exist.db"); } catch (PDOException $e) { - var_dump($e->getCode()); + var_dump($e->getCode()); } ?> --EXPECT-- diff --git a/ext/pdo_sqlite/tests/bug52487.phpt b/ext/pdo_sqlite/tests/bug52487.phpt index ff586d2f64..17a581296a 100644 --- a/ext/pdo_sqlite/tests/bug52487.phpt +++ b/ext/pdo_sqlite/tests/bug52487.phpt @@ -11,7 +11,7 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $stmt = $db->prepare("select 1 as attr"); for ($i = 0; $i < 10; $i++) { - $stmt->setFetchMode(PDO::FETCH_INTO, new stdClass); + $stmt->setFetchMode(PDO::FETCH_INTO, new stdClass); } print "ok\n"; diff --git a/ext/pdo_sqlite/tests/bug66033.phpt b/ext/pdo_sqlite/tests/bug66033.phpt index ebd519171a..c48ebe41ec 100644 --- a/ext/pdo_sqlite/tests/bug66033.phpt +++ b/ext/pdo_sqlite/tests/bug66033.phpt @@ -7,26 +7,26 @@ if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; --FILE-- <?php class DBStatement extends PDOStatement { - public $dbh; - protected function __construct($dbh) { - $this->dbh = $dbh; - throw new Exception("Blah"); - } + public $dbh; + protected function __construct($dbh) { + $this->dbh = $dbh; + throw new Exception("Blah"); + } } $pdo = new PDO('sqlite::memory:', null, null); $pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('DBStatement', - array($pdo))); + array($pdo))); $pdo->exec("CREATE TABLE IF NOT EXISTS messages ( - id INTEGER PRIMARY KEY, - title TEXT, - message TEXT, - time INTEGER)"); + id INTEGER PRIMARY KEY, + title TEXT, + message TEXT, + time INTEGER)"); try { - $pdoStatement = $pdo->query("select * from messages"); + $pdoStatement = $pdo->query("select * from messages"); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> --EXPECT-- diff --git a/ext/pdo_sqlite/tests/bug70862.phpt b/ext/pdo_sqlite/tests/bug70862.phpt index d66bb6262f..f676d66387 100644 --- a/ext/pdo_sqlite/tests/bug70862.phpt +++ b/ext/pdo_sqlite/tests/bug70862.phpt @@ -14,10 +14,10 @@ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); class HelloWrapper { - public function stream_open() { return true; } - public function stream_eof() { return true; } - public function stream_read() { return NULL; } - public function stream_stat() { return array(); } + public function stream_open() { return true; } + public function stream_eof() { return true; } + public function stream_read() { return NULL; } + public function stream_stat() { return array(); } } stream_wrapper_register("hello", "HelloWrapper"); diff --git a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt index c788b4ee90..525e29b953 100644 --- a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt +++ b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt @@ -34,27 +34,27 @@ $st = $db->query('SELECT * FROM testing'); var_dump($st->fetchAll(PDO::FETCH_FUNC, array('self', 'foo'))); class foo { - public function method($x) { - return "--- $x ---"; - } + public function method($x) { + return "--- $x ---"; + } } class bar extends foo { - public function __construct($db) { - $st = $db->query('SELECT * FROM testing'); - var_dump($st->fetchAll(PDO::FETCH_FUNC, array($this, 'parent::method'))); - } - - static public function test($x, $y) { - return $x .'---'. $y; - } - - private function test2($x, $y) { - return $x; - } - - public function test3($x, $y) { - return $x .'==='. $y; - } + public function __construct($db) { + $st = $db->query('SELECT * FROM testing'); + var_dump($st->fetchAll(PDO::FETCH_FUNC, array($this, 'parent::method'))); + } + + static public function test($x, $y) { + return $x .'---'. $y; + } + + private function test2($x, $y) { + return $x; + } + + public function test3($x, $y) { + return $x .'==='. $y; + } } new bar($db); diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt index c9157d1b05..b21620bee7 100644 --- a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt +++ b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt @@ -16,7 +16,7 @@ $db->sqliteCreateAggregate('testing', function(&$a, $b) { $a .= $b; return $a; } foreach ($db->query('SELECT testing(name) FROM foobar') as $row) { - var_dump($row); + var_dump($row); } $db->query('DROP TABLE foobar'); diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt index fcfc344896..0742d20e84 100644 --- a/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt +++ b/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt @@ -18,7 +18,7 @@ $db->sqliteCreateCollation('MYCOLLATE', function($a, $b) { return strnatcmp($a, $result = $db->query('SELECT name FROM foobar ORDER BY name COLLATE MYCOLLATE'); foreach ($result as $row) { - echo $row['name'] . "\n"; + echo $row['name'] . "\n"; } $result = $db->query('SELECT name FROM foobar ORDER BY name'); diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt index 1e753f3799..45075e9748 100644 --- a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt +++ b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt @@ -17,7 +17,7 @@ $db->sqliteCreateFunction('testing', function($v) { return strtolower($v); }); foreach ($db->query('SELECT testing(name) FROM foobar') as $row) { - var_dump($row); + var_dump($row); } $db->query('DROP TABLE foobar'); diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt index 5a329a1d97..9cb6ecc02d 100644 --- a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt +++ b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt @@ -20,7 +20,7 @@ $db->sqliteCreateFunction('testing', function($v) { return strtolower($v); }, 1, foreach ($db->query('SELECT testing(name) FROM foobar') as $row) { - var_dump($row); + var_dump($row); } $db->query('DROP TABLE foobar'); diff --git a/ext/pgsql/tests/01createdb.phpt b/ext/pgsql/tests/01createdb.phpt index 45062c3b49..2abd051c8b 100644 --- a/ext/pgsql/tests/01createdb.phpt +++ b/ext/pgsql/tests/01createdb.phpt @@ -11,22 +11,22 @@ include('config.inc'); $db = pg_connect($conn_str); if (!($q = @pg_query($db, "SELECT * FROM ".$table_name)) || !@pg_num_rows($q)) { - pg_query($db,$table_def); // Create table here - for ($i=0; $i < $num_test_record; $i++) { - pg_query($db,"INSERT INTO ".$table_name." VALUES ($i, 'ABC');"); - } + pg_query($db,$table_def); // Create table here + for ($i=0; $i < $num_test_record; $i++) { + pg_query($db,"INSERT INTO ".$table_name." VALUES ($i, 'ABC');"); + } } else { - echo pg_last_error()."\n"; + echo pg_last_error()."\n"; } $v = pg_version(); if (version_compare($v['server'], '9.2', '>=') && (!($q = @pg_query($db, "SELECT * FROM ".$table_name_92)) || !@pg_num_rows($q))) { - pg_query($db,$table_def_92); // Create table here + pg_query($db,$table_def_92); // Create table here } else { - echo pg_last_error()."\n"; + echo pg_last_error()."\n"; } // Create view here diff --git a/ext/pgsql/tests/02connection.phpt b/ext/pgsql/tests/02connection.phpt index 16a44e5dd9..9922bba98f 100644 --- a/ext/pgsql/tests/02connection.phpt +++ b/ext/pgsql/tests/02connection.phpt @@ -13,41 +13,41 @@ var_dump($db); if (pg_connection_status($db) != PGSQL_CONNECTION_OK) { - echo "pg_connection_status() error\n"; + echo "pg_connection_status() error\n"; } if (!pg_connection_reset($db)) { - echo "pg_connection_reset() error\n"; + echo "pg_connection_reset() error\n"; } if (pg_connection_busy($db)) { - echo "pg_connection_busy() error\n"; + echo "pg_connection_busy() error\n"; } if (function_exists('pg_transaction_status')) { - if (pg_transaction_status($db) != PGSQL_TRANSACTION_IDLE) - { - echo "pg_transaction_status() error\n"; - } + if (pg_transaction_status($db) != PGSQL_TRANSACTION_IDLE) + { + echo "pg_transaction_status() error\n"; + } } if (false === pg_host($db)) { - echo "pg_host() error\n"; + echo "pg_host() error\n"; } if (!pg_dbname($db)) { - echo "pg_dbname() error\n"; + echo "pg_dbname() error\n"; } if (!pg_port($db)) { - echo "pg_port() error\n"; + echo "pg_port() error\n"; } if (pg_tty($db)) { - echo "pg_tty() error\n"; + echo "pg_tty() error\n"; } if (pg_options($db)) { - echo "pg_options() error\n"; + echo "pg_options() error\n"; } pg_close($db); diff --git a/ext/pgsql/tests/03sync_query.phpt b/ext/pgsql/tests/03sync_query.phpt index eb8fae084d..1cd439bc20 100644 --- a/ext/pgsql/tests/03sync_query.phpt +++ b/ext/pgsql/tests/03sync_query.phpt @@ -12,45 +12,45 @@ $db = pg_connect($conn_str); $result = pg_query($db, "SELECT * FROM ".$table_name.";"); if (!($rows = pg_num_rows($result))) { - echo "pg_num_row() error\n"; + echo "pg_num_row() error\n"; } for ($i=0; $i < $rows; $i++) { - pg_fetch_array($result, $i, PGSQL_NUM); + pg_fetch_array($result, $i, PGSQL_NUM); } for ($i=0; $i < $rows; $i++) { - pg_fetch_object($result); + pg_fetch_object($result); } for ($i=0; $i < $rows; $i++) { - pg_fetch_row($result, $i); + pg_fetch_row($result, $i); } for ($i=0; $i < $rows; $i++) { - pg_fetch_result($result, $i, 0); + pg_fetch_result($result, $i, 0); } pg_result_error($result); if (function_exists('pg_result_error_field')) { - pg_result_error_field($result, PGSQL_DIAG_SEVERITY); - pg_result_error_field($result, PGSQL_DIAG_SQLSTATE); - pg_result_error_field($result, PGSQL_DIAG_MESSAGE_PRIMARY); - pg_result_error_field($result, PGSQL_DIAG_MESSAGE_DETAIL); - pg_result_error_field($result, PGSQL_DIAG_MESSAGE_HINT); - pg_result_error_field($result, PGSQL_DIAG_STATEMENT_POSITION); - if (defined('PGSQL_DIAG_INTERNAL_POSITION')) - { - pg_result_error_field($result, PGSQL_DIAG_INTERNAL_POSITION); - } - if (defined('PGSQL_DIAG_INTERNAL_QUERY')) - { - pg_result_error_field($result, PGSQL_DIAG_INTERNAL_QUERY); - } - pg_result_error_field($result, PGSQL_DIAG_CONTEXT); - pg_result_error_field($result, PGSQL_DIAG_SOURCE_FILE); - pg_result_error_field($result, PGSQL_DIAG_SOURCE_LINE); - pg_result_error_field($result, PGSQL_DIAG_SOURCE_FUNCTION); + pg_result_error_field($result, PGSQL_DIAG_SEVERITY); + pg_result_error_field($result, PGSQL_DIAG_SQLSTATE); + pg_result_error_field($result, PGSQL_DIAG_MESSAGE_PRIMARY); + pg_result_error_field($result, PGSQL_DIAG_MESSAGE_DETAIL); + pg_result_error_field($result, PGSQL_DIAG_MESSAGE_HINT); + pg_result_error_field($result, PGSQL_DIAG_STATEMENT_POSITION); + if (defined('PGSQL_DIAG_INTERNAL_POSITION')) + { + pg_result_error_field($result, PGSQL_DIAG_INTERNAL_POSITION); + } + if (defined('PGSQL_DIAG_INTERNAL_QUERY')) + { + pg_result_error_field($result, PGSQL_DIAG_INTERNAL_QUERY); + } + pg_result_error_field($result, PGSQL_DIAG_CONTEXT); + pg_result_error_field($result, PGSQL_DIAG_SOURCE_FILE); + pg_result_error_field($result, PGSQL_DIAG_SOURCE_LINE); + pg_result_error_field($result, PGSQL_DIAG_SOURCE_FUNCTION); } pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";")); pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";")); diff --git a/ext/pgsql/tests/04async_query.phpt b/ext/pgsql/tests/04async_query.phpt index fe67382026..34d383ed68 100644 --- a/ext/pgsql/tests/04async_query.phpt +++ b/ext/pgsql/tests/04async_query.phpt @@ -10,35 +10,35 @@ include('config.inc'); $db = pg_connect($conn_str); if (!pg_send_query($db, "SELECT * FROM ".$table_name.";")) { - echo "pg_send_query() error\n"; + echo "pg_send_query() error\n"; } while(pg_connection_busy($db)); // busy wait: intended if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) { - echo "pg_connection_status() error\n"; + echo "pg_connection_status() error\n"; } if (!($result = pg_get_result($db))) { - echo "pg_get_result() error\n"; + echo "pg_get_result() error\n"; } if (!($rows = pg_num_rows($result))) { - echo "pg_num_rows() error\n"; + echo "pg_num_rows() error\n"; } for ($i=0; $i < $rows; $i++) { - pg_fetch_array($result, $i, PGSQL_NUM); + pg_fetch_array($result, $i, PGSQL_NUM); } for ($i=0; $i < $rows; $i++) { - pg_fetch_object($result); + pg_fetch_object($result); } for ($i=0; $i < $rows; $i++) { - pg_fetch_row($result, $i); + pg_fetch_row($result, $i); } for ($i=0; $i < $rows; $i++) { - pg_fetch_result($result, $i, 0); + pg_fetch_result($result, $i, 0); } pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";")); @@ -52,7 +52,7 @@ pg_field_is_null($result, 0); if (!pg_send_query($db, "INSERT INTO ".$table_name." VALUES (8888, 'GGG');")) { - echo "pg_send_query() error\n"; + echo "pg_send_query() error\n"; } pg_last_oid($result); diff --git a/ext/pgsql/tests/05large_object.phpt b/ext/pgsql/tests/05large_object.phpt index e091d6072a..df47d07404 100644 --- a/ext/pgsql/tests/05large_object.phpt +++ b/ext/pgsql/tests/05large_object.phpt @@ -63,7 +63,7 @@ pg_query($db, 'begin'); @unlink($path . 'php.gif.exported'); pg_lo_export($oid, $path . 'php.gif.exported', $db); if (!file_exists($path . 'php.gif.exported')) { - echo "Export failed\n"; + echo "Export failed\n"; } @unlink($path . 'php.gif.exported'); pg_query($db, 'commit'); diff --git a/ext/pgsql/tests/07optional.phpt b/ext/pgsql/tests/07optional.phpt index 9fa6f16331..f633f81498 100644 --- a/ext/pgsql/tests/07optional.phpt +++ b/ext/pgsql/tests/07optional.phpt @@ -14,9 +14,9 @@ $enc = pg_client_encoding($db); pg_set_client_encoding($db, $enc); if (function_exists('pg_set_error_verbosity')) { - pg_set_error_verbosity(PGSQL_ERRORS_TERSE); - pg_set_error_verbosity(PGSQL_ERRORS_DEFAULT); - pg_set_error_verbosity(PGSQL_ERRORS_VERBOSE); + pg_set_error_verbosity(PGSQL_ERRORS_TERSE); + pg_set_error_verbosity(PGSQL_ERRORS_DEFAULT); + pg_set_error_verbosity(PGSQL_ERRORS_VERBOSE); } echo "OK"; ?> diff --git a/ext/pgsql/tests/08escape.phpt b/ext/pgsql/tests/08escape.phpt index 6b0d1899d4..6b510aef73 100644 --- a/ext/pgsql/tests/08escape.phpt +++ b/ext/pgsql/tests/08escape.phpt @@ -14,13 +14,13 @@ $expect = "ABC\\\\ABC\\'"; $expect2 = "ABC\\\\ABC\\\\''"; //the way escape string differs from PostgreSQL 9.0 $after = pg_escape_string($before); if ($expect === $after || $expect2 === $after) { - echo "pg_escape_string() is Ok\n"; + echo "pg_escape_string() is Ok\n"; } else { - echo "pg_escape_string() is NOT Ok\n"; - var_dump($before); - var_dump($after); - var_dump($expect); + echo "pg_escape_string() is NOT Ok\n"; + var_dump($before); + var_dump($after); + var_dump($expect); } // pg_escape_bytea() test @@ -28,13 +28,13 @@ $before = "ABC\\ABC"; $expect = "ABC\\\\\\\\ABC"; $after = pg_escape_bytea($before); if ($expect === $after) { - echo "pg_escape_bytea() is Ok\n"; + echo "pg_escape_bytea() is Ok\n"; } else { - echo "pg_escape_byte() is NOT Ok\n"; - var_dump($before); - var_dump($after); - var_dump($expect); + echo "pg_escape_byte() is NOT Ok\n"; + var_dump($before); + var_dump($after); + var_dump($expect); } // Test using database @@ -49,23 +49,23 @@ pg_query($db, $sql); // Retrieve binary from DB for ($i = 0; $i < 2; $i++) { - $sql = "SELECT bin::bytea FROM ".$table_name." WHERE num = 10000"; - $result = pg_query($db, $sql); - $row = pg_fetch_array($result, 0, PGSQL_ASSOC); + $sql = "SELECT bin::bytea FROM ".$table_name." WHERE num = 10000"; + $result = pg_query($db, $sql); + $row = pg_fetch_array($result, 0, PGSQL_ASSOC); - if ($data === pg_unescape_bytea($row['bin'])) { - echo "pg_escape_bytea() actually works with database\n"; - break; - } - elseif (!$i) { - // Force bytea escaping and retry - @pg_query($db, "SET bytea_output = 'escape'"); - } - else { - $result = pg_query($db, $sql); - echo "pg_escape_bytea() is broken\n"; - break; - } + if ($data === pg_unescape_bytea($row['bin'])) { + echo "pg_escape_bytea() actually works with database\n"; + break; + } + elseif (!$i) { + // Force bytea escaping and retry + @pg_query($db, "SET bytea_output = 'escape'"); + } + else { + $result = pg_query($db, $sql); + echo "pg_escape_bytea() is broken\n"; + break; + } } // pg_escape_literal/pg_escape_identifier @@ -73,26 +73,26 @@ $before = "ABC\\ABC\'"; $expect = " E'ABC\\\\ABC\\\\'''"; $after = pg_escape_literal($before); if ($expect === $after) { - echo "pg_escape_literal() is Ok\n"; + echo "pg_escape_literal() is Ok\n"; } else { - echo "pg_escape_literal() is NOT Ok\n"; - var_dump($before); - var_dump($after); - var_dump($expect); + echo "pg_escape_literal() is NOT Ok\n"; + var_dump($before); + var_dump($after); + var_dump($expect); } $before = "ABC\\ABC\'"; $expect = "\"ABC\ABC\'\""; $after = pg_escape_identifier($before); if ($expect === $after) { - echo "pg_escape_identifier() is Ok\n"; + echo "pg_escape_identifier() is Ok\n"; } else { - echo "pg_escape_identifier() is NOT Ok\n"; - var_dump($before); - var_dump($after); - var_dump($expect); + echo "pg_escape_identifier() is NOT Ok\n"; + var_dump($before); + var_dump($after); + var_dump($expect); } ?> diff --git a/ext/pgsql/tests/10pg_convert_json_array.phpt b/ext/pgsql/tests/10pg_convert_json_array.phpt index 960cfd6c99..46aec3ffbc 100644 --- a/ext/pgsql/tests/10pg_convert_json_array.phpt +++ b/ext/pgsql/tests/10pg_convert_json_array.phpt @@ -14,16 +14,16 @@ include 'config.inc'; $db = pg_connect($conn_str); $fields = array( - 'textary'=>'{"meeting", "lunch", "training", "presentation"}', - 'jsn'=>'{"f1":1,"f2":"foo"}', + 'textary'=>'{"meeting", "lunch", "training", "presentation"}', + 'jsn'=>'{"f1":1,"f2":"foo"}', ); $converted = pg_convert($db, $table_name_92, $fields); var_dump($converted); if (!pg_insert($db, $table_name_92, $fields)) { - echo "Error\n"; + echo "Error\n"; } else { - echo "OK\n"; + echo "OK\n"; } ?> diff --git a/ext/pgsql/tests/15pg_delete.phpt b/ext/pgsql/tests/15pg_delete.phpt index 3b9f7d803c..5afcf60253 100644 --- a/ext/pgsql/tests/15pg_delete.phpt +++ b/ext/pgsql/tests/15pg_delete.phpt @@ -15,10 +15,10 @@ $ids = array('num'=>'1234'); echo pg_delete($db, $table_name, $ids, PGSQL_DML_STRING)."\n"; echo pg_delete($db, $table_name, $ids, PGSQL_DML_STRING|PGSQL_DML_ESCAPE)."\n"; if (!pg_delete($db, $table_name, $ids)) { - echo "Error\n"; + echo "Error\n"; } else { - echo "Ok\n"; + echo "Ok\n"; } ?> --EXPECT-- diff --git a/ext/pgsql/tests/18pg_escape_bytea_before.phpt b/ext/pgsql/tests/18pg_escape_bytea_before.phpt index ca2acd9ce7..8222eccde4 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_before.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_before.phpt @@ -20,10 +20,10 @@ $rows = pg_fetch_all($result); $unesc_image = pg_unescape_bytea($rows[0]['bin']); if ($unesc_image !== $image) { - echo "NG"; + echo "NG"; } else { - echo "OK"; + echo "OK"; } ?> --EXPECT-- diff --git a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt index 263adad40c..0420c7eb75 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt @@ -20,10 +20,10 @@ $rows = pg_fetch_all($result); $unesc_image = pg_unescape_bytea($rows[0]['bin']); if ($unesc_image !== $image) { - echo "NG"; + echo "NG"; } else { - echo "OK"; + echo "OK"; } ?> --EXPECT-- diff --git a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt index 5af7bbebef..af2f3cf4d4 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt @@ -23,10 +23,10 @@ $rows = pg_fetch_all($result); $unesc_image = pg_unescape_bytea($rows[0]['bin']); if ($unesc_image !== $image) { - echo "NG"; + echo "NG"; } else { - echo "OK"; + echo "OK"; } ?> --EXPECT-- diff --git a/ext/pgsql/tests/22pg_fetch_object.phpt b/ext/pgsql/tests/22pg_fetch_object.phpt index ebdf77568e..9f9319bcfe 100644 --- a/ext/pgsql/tests/22pg_fetch_object.phpt +++ b/ext/pgsql/tests/22pg_fetch_object.phpt @@ -9,9 +9,9 @@ error_reporting(E_ALL); include 'config.inc'; class test_class { - function __construct($arg1, $arg2) { - echo __METHOD__ . "($arg1,$arg2)\n"; - } + function __construct($arg1, $arg2) { + echo __METHOD__ . "($arg1,$arg2)\n"; + } } $db = pg_connect($conn_str); diff --git a/ext/pgsql/tests/23sync_query_params.phpt b/ext/pgsql/tests/23sync_query_params.phpt index a700ddca17..1406cec5bf 100644 --- a/ext/pgsql/tests/23sync_query_params.phpt +++ b/ext/pgsql/tests/23sync_query_params.phpt @@ -14,42 +14,42 @@ $db = pg_connect($conn_str); $version = pg_version($db); if ($version['protocol'] >= 3) { - $result = pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)); - if (!($rows = pg_num_rows($result))) - { - echo "pg_num_row() 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); - } + $result = pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)); + if (!($rows = pg_num_rows($result))) + { + echo "pg_num_row() 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_result_error($result); - 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); + pg_result_error($result); + 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); - $result = pg_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC")); - pg_last_oid($result); + $result = pg_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC")); + pg_last_oid($result); - pg_free_result($result); + pg_free_result($result); } pg_close($db); diff --git a/ext/pgsql/tests/24sync_query_prepared.phpt b/ext/pgsql/tests/24sync_query_prepared.phpt index ca099eb43b..1ab7e095f4 100644 --- a/ext/pgsql/tests/24sync_query_prepared.phpt +++ b/ext/pgsql/tests/24sync_query_prepared.phpt @@ -14,48 +14,48 @@ $db = pg_connect($conn_str); $version = pg_version($db); if ($version['protocol'] >= 3) { - $result = pg_prepare($db, "php_test", "SELECT * FROM ".$table_name." WHERE num > \$1;"); - pg_result_error($result); - pg_free_result($result); - $result = pg_execute($db, "php_test", array(100)); - if (!($rows = pg_num_rows($result))) - { - echo "pg_num_row() 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); - } + $result = pg_prepare($db, "php_test", "SELECT * FROM ".$table_name." WHERE num > \$1;"); + pg_result_error($result); + pg_free_result($result); + $result = pg_execute($db, "php_test", array(100)); + if (!($rows = pg_num_rows($result))) + { + echo "pg_num_row() 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_result_error($result); - pg_num_rows(pg_execute($db, "php_test", array(100))); - pg_num_fields(pg_execute($db, "php_test", 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); + pg_result_error($result); + pg_num_rows(pg_execute($db, "php_test", array(100))); + pg_num_fields(pg_execute($db, "php_test", 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); - $result = pg_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);"); - pg_result_error($result); - pg_free_result($result); - $result = pg_execute($db, "php_test2", array(9999, "A'BC")); - pg_last_oid($result); + $result = pg_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);"); + pg_result_error($result); + pg_free_result($result); + $result = pg_execute($db, "php_test2", array(9999, "A'BC")); + pg_last_oid($result); - pg_free_result($result); + pg_free_result($result); } pg_close($db); diff --git a/ext/pgsql/tests/25async_query_params.phpt b/ext/pgsql/tests/25async_query_params.phpt index ae1a1630ef..87b5e0dbb1 100644 --- a/ext/pgsql/tests/25async_query_params.phpt +++ b/ext/pgsql/tests/25async_query_params.phpt @@ -14,53 +14,53 @@ $db = pg_connect($conn_str); $version = pg_version($db); if ($version['protocol'] >= 3) { - if (!pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))) { - echo "pg_send_query_params() error\n"; - } - while(pg_connection_busy($db)); // busy wait: intended - if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) { - echo "pg_connection_status() error\n"; - } - 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); - } + if (!pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))) { + echo "pg_send_query_params() error\n"; + } + while(pg_connection_busy($db)); // busy wait: intended + if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) { + echo "pg_connection_status() error\n"; + } + 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); + 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); - if (!pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"))) - { - echo "pg_send_query_params() error\n"; - } + if (!pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"))) + { + echo "pg_send_query_params() error\n"; + } - pg_last_oid($result); - pg_free_result($result); + pg_last_oid($result); + pg_free_result($result); } pg_close($db); diff --git a/ext/pgsql/tests/26async_query_prepared.phpt b/ext/pgsql/tests/26async_query_prepared.phpt index 33ca7c7bfa..6eacb4e3ee 100644 --- a/ext/pgsql/tests/26async_query_prepared.phpt +++ b/ext/pgsql/tests/26async_query_prepared.phpt @@ -14,89 +14,89 @@ $db = pg_connect($conn_str); $version = pg_version($db); if ($version['protocol'] >= 3) { - if (!pg_send_prepare($db, 'php_test', "SELECT * FROM ".$table_name." WHERE num > \$1;")) { - echo "pg_send_prepare() error\n"; - } - while(pg_connection_busy($db)); // busy wait: intended - if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) { - echo "pg_connection_status() error\n"; - } - if (!($result = pg_get_result($db))) - { - echo "pg_get_result() error\n"; - } - pg_free_result($result); + if (!pg_send_prepare($db, 'php_test', "SELECT * FROM ".$table_name." WHERE num > \$1;")) { + echo "pg_send_prepare() error\n"; + } + while(pg_connection_busy($db)); // busy wait: intended + if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) { + echo "pg_connection_status() error\n"; + } + if (!($result = pg_get_result($db))) + { + echo "pg_get_result() error\n"; + } + pg_free_result($result); - if (!pg_send_execute($db, 'php_test', array(100))) { - echo "pg_send_execute() error\n"; - } - while(pg_connection_busy($db)); // busy wait: intended - if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) { - echo "pg_connection_status() error\n"; - } - if (!($result = pg_get_result($db))) - { - echo "pg_get_result() error\n"; - } + if (!pg_send_execute($db, 'php_test', array(100))) { + echo "pg_send_execute() error\n"; + } + while(pg_connection_busy($db)); // busy wait: intended + if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) { + echo "pg_connection_status() error\n"; + } + 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); - } + 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); + 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); - if (!pg_send_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);")) - { - echo "pg_send_prepare() error\n"; - } - while(pg_connection_busy($db)); // busy wait: intended - if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) { - echo "pg_connection_status() error\n"; - } - if (!($result = pg_get_result($db))) - { - echo "pg_get_result() error\n"; - } - pg_free_result($result); + if (!pg_send_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);")) + { + echo "pg_send_prepare() error\n"; + } + while(pg_connection_busy($db)); // busy wait: intended + if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) { + echo "pg_connection_status() error\n"; + } + if (!($result = pg_get_result($db))) + { + echo "pg_get_result() error\n"; + } + pg_free_result($result); - if (!pg_send_execute($db, "php_test2", array(9999, "A'BC"))) - { - echo "pg_send_execute() error\n"; - } - while(pg_connection_busy($db)); // busy wait: intended - if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) { - echo "pg_connection_status() error\n"; - } - if (!($result = pg_get_result($db))) - { - echo "pg_get_result() error\n"; - } + if (!pg_send_execute($db, "php_test2", array(9999, "A'BC"))) + { + echo "pg_send_execute() error\n"; + } + while(pg_connection_busy($db)); // busy wait: intended + if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) { + echo "pg_connection_status() error\n"; + } + if (!($result = pg_get_result($db))) + { + echo "pg_get_result() error\n"; + } - pg_last_oid($result); - pg_free_result($result); + pg_last_oid($result); + pg_free_result($result); } pg_close($db); diff --git a/ext/pgsql/tests/29nb_async_connect.phpt b/ext/pgsql/tests/29nb_async_connect.phpt index a9b17ebc3a..d98b34da47 100644 --- a/ext/pgsql/tests/29nb_async_connect.phpt +++ b/ext/pgsql/tests/29nb_async_connect.phpt @@ -11,30 +11,30 @@ include('config.inc'); include('nonblocking.inc'); if (!$db = pg_connect($conn_str, PGSQL_CONNECT_ASYNC)) { - die("pg_connect() error"); + die("pg_connect() error"); } elseif (pg_connection_status($db) === PGSQL_CONNECTION_BAD) { - die("pg_connect() error"); + die("pg_connect() error"); } elseif ($db_socket = pg_socket($db)) { - stream_set_blocking($db_socket, FALSE); + stream_set_blocking($db_socket, FALSE); } else { - die("pg_socket() error"); + die("pg_socket() error"); } while (TRUE) { - switch ($status = pg_connect_poll($db)) { - case PGSQL_POLLING_READING: - nb_is_readable($db_socket); - break; - case PGSQL_POLLING_WRITING: - nb_is_writable($db_socket); - break; - case PGSQL_POLLING_FAILED: - die("async connection failed"); - case PGSQL_POLLING_OK: - break 2; - default: - die("unknown poll status"); - } + switch ($status = pg_connect_poll($db)) { + case PGSQL_POLLING_READING: + nb_is_readable($db_socket); + break; + case PGSQL_POLLING_WRITING: + nb_is_writable($db_socket); + break; + case PGSQL_POLLING_FAILED: + die("async connection failed"); + case PGSQL_POLLING_OK: + break 2; + default: + die("unknown poll status"); + } } assert(pg_connection_status($db) === PGSQL_CONNECTION_OK); echo "OK"; diff --git a/ext/pgsql/tests/30nb_async_query_params.phpt b/ext/pgsql/tests/30nb_async_query_params.phpt index 1c8a1eed8f..612327a9c4 100644 --- a/ext/pgsql/tests/30nb_async_query_params.phpt +++ b/ext/pgsql/tests/30nb_async_query_params.phpt @@ -15,8 +15,8 @@ $db = pg_connect($conn_str); $version = pg_version($db); if ($version['protocol'] < 3) { - echo "OK"; - exit(0); + echo "OK"; + exit(0); } $db_socket = pg_socket($db); @@ -24,30 +24,30 @@ 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"; + echo "pg_send_query_params() error\n"; } elseif ($sent === 0) { - nb_flush($db, $db_socket); + nb_flush($db, $db_socket); } nb_consume($db, $db_socket); if (!($result = pg_get_result($db))) { - echo "pg_get_result() error\n"; + echo "pg_get_result() error\n"; } if (!($rows = pg_num_rows($result))) { - echo "pg_num_rows() error\n"; + echo "pg_num_rows() error\n"; } for ($i=0; $i < $rows; $i++) { - pg_fetch_array($result, $i, PGSQL_NUM); + pg_fetch_array($result, $i, PGSQL_NUM); } for ($i=0; $i < $rows; $i++) { - pg_fetch_object($result); + pg_fetch_object($result); } for ($i=0; $i < $rows; $i++) { - pg_fetch_row($result, $i); + pg_fetch_row($result, $i); } for ($i=0; $i < $rows; $i++) { - pg_fetch_result($result, $i, 0); + pg_fetch_result($result, $i, 0); } pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); @@ -62,9 +62,9 @@ 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"; + echo "pg_send_query_params() error\n"; } elseif ($sent === 0) { - nb_flush($db, $db_socket); + nb_flush($db, $db_socket); } pg_last_oid($result); diff --git a/ext/pgsql/tests/31nb_async_query_prepared.phpt b/ext/pgsql/tests/31nb_async_query_prepared.phpt index f485e596f9..476f21bc51 100644 --- a/ext/pgsql/tests/31nb_async_query_prepared.phpt +++ b/ext/pgsql/tests/31nb_async_query_prepared.phpt @@ -15,8 +15,8 @@ $db = pg_connect($conn_str); $version = pg_version($db); if ($version['protocol'] < 3) { - echo "OK"; - exit(0); + echo "OK"; + exit(0); } $db_socket = pg_socket($db); @@ -24,45 +24,45 @@ stream_set_blocking($db_socket, false); $nb_send = pg_send_prepare($db, 'php_test', "SELECT * FROM ".$table_name." WHERE num > \$1;"); if ($nb_send === FALSE) { - echo "pg_send_prepare() error\n"; + echo "pg_send_prepare() error\n"; } elseif ($nb_send === 0) { - nb_flush($db, $db_socket); + nb_flush($db, $db_socket); } nb_consume($db, $db_socket); if (!($result = pg_get_result($db))) { - echo "pg_get_result() error\n"; + echo "pg_get_result() error\n"; } pg_free_result($result); $nb_send = pg_send_execute($db, 'php_test', array(100)); if ($nb_send === FALSE) { - echo "pg_send_execute() error\n"; + echo "pg_send_execute() error\n"; } elseif ($nb_send === 0) { - nb_flush($db, $db_socket); + nb_flush($db, $db_socket); } nb_consume($db, $db_socket); if (!($result = pg_get_result($db))) { - echo "pg_get_result() error\n"; + echo "pg_get_result() error\n"; } if (!($rows = pg_num_rows($result))) { - echo "pg_num_rows() error\n"; + echo "pg_num_rows() error\n"; } for ($i=0; $i < $rows; $i++) { - pg_fetch_array($result, $i, PGSQL_NUM); + pg_fetch_array($result, $i, PGSQL_NUM); } for ($i=0; $i < $rows; $i++) { - pg_fetch_object($result); + pg_fetch_object($result); } for ($i=0; $i < $rows; $i++) { - pg_fetch_row($result, $i); + pg_fetch_row($result, $i); } for ($i=0; $i < $rows; $i++) { - pg_fetch_result($result, $i, 0); + pg_fetch_result($result, $i, 0); } pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); @@ -76,29 +76,29 @@ pg_field_is_null($result, 0); $nb_send = pg_send_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);"); if ($nb_send === FALSE) { - echo "pg_send_prepare() error\n"; + echo "pg_send_prepare() error\n"; } elseif ($nb_send === 0) { - nb_flush($db, $db_socket); + nb_flush($db, $db_socket); } nb_consume($db, $db_socket); if (!($result = pg_get_result($db))) { - echo "pg_get_result() error\n"; + echo "pg_get_result() error\n"; } pg_free_result($result); $nb_send = pg_send_execute($db, "php_test2", array(9999, "A'BC")); if ($nb_send === FALSE) { - echo "pg_send_execute() error\n"; + echo "pg_send_execute() error\n"; } elseif ($nb_send === 0) { - nb_flush($db, $db_socket); + nb_flush($db, $db_socket); } nb_consume($db, $db_socket); if (!($result = pg_get_result($db))) { - echo "pg_get_result() error\n"; + echo "pg_get_result() error\n"; } pg_last_oid($result); diff --git a/ext/pgsql/tests/32nb_async_query.phpt b/ext/pgsql/tests/32nb_async_query.phpt index 8ef1591db5..a90f9799a3 100644 --- a/ext/pgsql/tests/32nb_async_query.phpt +++ b/ext/pgsql/tests/32nb_async_query.phpt @@ -15,8 +15,8 @@ $db = pg_connect($conn_str); $version = pg_version($db); if ($version['protocol'] < 3) { - echo "OK"; - exit(0); + echo "OK"; + exit(0); } $db_socket = pg_socket($db); @@ -24,31 +24,31 @@ stream_set_blocking($db_socket, false); $nb_send = pg_send_query($db, "SELECT * FROM ".$table_name.";"); if ($nb_send === FALSE) { - echo "pg_send_query() error\n"; + echo "pg_send_query() error\n"; } elseif ($nb_send === 0) { - nb_flush($db, $db_socket); + nb_flush($db, $db_socket); } nb_consume($db, $db_socket); if (!($result = pg_get_result($db))) { - echo "pg_get_result() error\n"; + echo "pg_get_result() error\n"; } if (!($rows = pg_num_rows($result))) { - echo "pg_num_rows() error\n"; + echo "pg_num_rows() error\n"; } for ($i=0; $i < $rows; $i++) { - pg_fetch_array($result, $i, PGSQL_NUM); + pg_fetch_array($result, $i, PGSQL_NUM); } for ($i=0; $i < $rows; $i++) { - pg_fetch_object($result); + pg_fetch_object($result); } for ($i=0; $i < $rows; $i++) { - pg_fetch_row($result, $i); + pg_fetch_row($result, $i); } for ($i=0; $i < $rows; $i++) { - pg_fetch_result($result, $i, 0); + pg_fetch_result($result, $i, 0); } pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";")); @@ -62,15 +62,15 @@ pg_field_is_null($result, 0); $nb_send = pg_send_query($db, "INSERT INTO ".$table_name." VALUES (8888, 'GGG');"); if ($nb_send === FALSE) { - echo "pg_send_query() error\n"; + echo "pg_send_query() error\n"; } elseif ($nb_send === 0) { - nb_flush($db, $db_socket); + nb_flush($db, $db_socket); } nb_consume($db, $db_socket); if (!($result = pg_get_result($db))) { - echo "pg_get_result() error\n"; + echo "pg_get_result() error\n"; } pg_last_oid($result); diff --git a/ext/pgsql/tests/80_bug14383.phpt b/ext/pgsql/tests/80_bug14383.phpt index 1331f146cc..e9c6093888 100644 --- a/ext/pgsql/tests/80_bug14383.phpt +++ b/ext/pgsql/tests/80_bug14383.phpt @@ -11,7 +11,7 @@ require_once('config.inc'); $dbh = @pg_connect($conn_str); if (!$dbh) { - die ("Could not connect to the server"); + die ("Could not connect to the server"); } pg_close($dbh); diff --git a/ext/pgsql/tests/80_bug24499.phpt b/ext/pgsql/tests/80_bug24499.phpt index a9773bdafe..1ba8accade 100644 --- a/ext/pgsql/tests/80_bug24499.phpt +++ b/ext/pgsql/tests/80_bug24499.phpt @@ -11,7 +11,7 @@ require_once('config.inc'); $dbh = @pg_connect($conn_str); if (!$dbh) { - die ("Could not connect to the server"); + die ("Could not connect to the server"); } @pg_query("DROP SEQUENCE id_id_seq"); @@ -19,24 +19,24 @@ if (!$dbh) { pg_query("CREATE TABLE id (id SERIAL, t INT)"); for ($i=0; $i<4; $i++) { - pg_query("INSERT INTO id (t) VALUES ($i)"); + pg_query("INSERT INTO id (t) VALUES ($i)"); } class Id { - public $id; + public $id; - public function getId() - { - global $dbh; + public function getId() + { + global $dbh; - $q = pg_query($dbh, "SELECT id FROM id"); - print_r(pg_fetch_array($q)); - print_r(pg_fetch_array($q)); - $id = pg_fetch_object($q); - var_dump($id); - return $id->id; - } + $q = pg_query($dbh, "SELECT id FROM id"); + print_r(pg_fetch_array($q)); + print_r(pg_fetch_array($q)); + $id = pg_fetch_object($q); + var_dump($id); + return $id->id; + } } $id = new Id(); diff --git a/ext/pgsql/tests/80_bug27597.phpt b/ext/pgsql/tests/80_bug27597.phpt index 5e28258570..92f0d81800 100644 --- a/ext/pgsql/tests/80_bug27597.phpt +++ b/ext/pgsql/tests/80_bug27597.phpt @@ -11,29 +11,29 @@ require_once(__DIR__ . '/config.inc'); $dbh = @pg_connect($conn_str); if (!$dbh) { - die ("Could not connect to the server"); + die ("Could not connect to the server"); } @pg_query("DROP TABLE id"); pg_query("CREATE TABLE id (id INT)"); for ($i=0; $i<4; $i++) { - pg_query("INSERT INTO id (id) VALUES ($i)"); + pg_query("INSERT INTO id (id) VALUES ($i)"); } function xi_fetch_array($res, $type = PGSQL_ASSOC) { - $a = pg_fetch_array($res, NULL, $type) ; - return $a ; + $a = pg_fetch_array($res, NULL, $type) ; + return $a ; } $res = pg_query("SELECT * FROM id"); $i = 0; // endless-loop protection while($row = xi_fetch_array($res)) { - print_r($row); - if ($i++ > 4) { - echo "ENDLESS-LOOP"; - exit(1); - } + print_r($row); + if ($i++ > 4) { + echo "ENDLESS-LOOP"; + exit(1); + } } pg_close($dbh); diff --git a/ext/pgsql/tests/80_bug32223.phpt b/ext/pgsql/tests/80_bug32223.phpt index 36dd3a803f..08c8903dbf 100644 --- a/ext/pgsql/tests/80_bug32223.phpt +++ b/ext/pgsql/tests/80_bug32223.phpt @@ -25,7 +25,7 @@ require_once('lcmess.inc'); $dbh = @pg_connect($conn_str); if (!$dbh) { - die ("Could not connect to the server"); + die ("Could not connect to the server"); } _set_lc_messages(); @@ -46,7 +46,7 @@ var_dump($row); pg_free_result($res); if ($row[0] == 'f') { - var_dump(pg_last_notice($dbh)); + var_dump(pg_last_notice($dbh)); } pg_close($dbh); diff --git a/ext/pgsql/tests/80_bug36625.phpt b/ext/pgsql/tests/80_bug36625.phpt index 5d83024681..63908f3b7a 100644 --- a/ext/pgsql/tests/80_bug36625.phpt +++ b/ext/pgsql/tests/80_bug36625.phpt @@ -11,7 +11,7 @@ require_once('config.inc'); $dbh = @pg_connect($conn_str); if (!$dbh) { - die ('Could not connect to the server'); + die ('Could not connect to the server'); } $tracefile = __DIR__ . '/trace.tmp'; @@ -27,9 +27,9 @@ pg_close($dbh); $found = 0; function search_trace_file($line) { - if (strpos($line, '"select 1"') !== false || strpos($line, "'select 1'") !== false) { - $GLOBALS['found']++; - } + if (strpos($line, '"select 1"') !== false || strpos($line, "'select 1'") !== false) { + $GLOBALS['found']++; + } } $trace = file($tracefile); diff --git a/ext/pgsql/tests/80_bug39971.phpt b/ext/pgsql/tests/80_bug39971.phpt index 14c7fbd547..4fd065adf7 100644 --- a/ext/pgsql/tests/80_bug39971.phpt +++ b/ext/pgsql/tests/80_bug39971.phpt @@ -11,7 +11,7 @@ require_once('config.inc'); $dbh = @pg_connect($conn_str); if (!$dbh) { - die ("Could not connect to the server"); + die ("Could not connect to the server"); } pg_query("CREATE TABLE php_test (id SERIAL, tm timestamp NOT NULL)"); diff --git a/ext/pgsql/tests/80_bug42783.phpt b/ext/pgsql/tests/80_bug42783.phpt index c375aa0d66..49119891e0 100644 --- a/ext/pgsql/tests/80_bug42783.phpt +++ b/ext/pgsql/tests/80_bug42783.phpt @@ -11,7 +11,7 @@ require_once('config.inc'); $dbh = @pg_connect($conn_str); if (!$dbh) { - die ("Could not connect to the server"); + die ("Could not connect to the server"); } pg_query("CREATE TABLE php_test (id SERIAL PRIMARY KEY, time TIMESTAMP NOT NULL DEFAULT now())"); diff --git a/ext/pgsql/tests/bug71998.phpt b/ext/pgsql/tests/bug71998.phpt index 01d295e3e8..116135ab51 100644 --- a/ext/pgsql/tests/bug71998.phpt +++ b/ext/pgsql/tests/bug71998.phpt @@ -14,61 +14,61 @@ $db = pg_connect($conn_str); pg_query("CREATE TABLE tmp_statistics (id integer NOT NULL, remote_addr inet);"); $ips = array( - /* IPv4*/ - "127.0.0.1", - "10.0.0.1", - "192.168.1.1", - "0.0.0.0", - "255.255.255.255", - "192.168.1.35/24", + /* IPv4*/ + "127.0.0.1", + "10.0.0.1", + "192.168.1.1", + "0.0.0.0", + "255.255.255.255", + "192.168.1.35/24", - /* IPv6 */ - "::1", - "::10.2.3.4", - "::ffff:10.4.3.2", - "1:2:3:4:5:6:7:8", - "::ffff:10.0.0.1", - "::ffff:1.2.3.4", - "::ffff:0.0.0.0", - "1:2:3:4:5:6:77:88", - "::ffff:255.255.255.255", - "fe08::7:8", - "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", - "::5:aef1:ffff/128", - "2001:4f8:3:ba::/112", + /* IPv6 */ + "::1", + "::10.2.3.4", + "::ffff:10.4.3.2", + "1:2:3:4:5:6:7:8", + "::ffff:10.0.0.1", + "::ffff:1.2.3.4", + "::ffff:0.0.0.0", + "1:2:3:4:5:6:77:88", + "::ffff:255.255.255.255", + "fe08::7:8", + "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", + "::5:aef1:ffff/128", + "2001:4f8:3:ba::/112", ); $bad = array( - /* bad */ - "256.257.258.259", - "fe08::7:8interface", - "schnitzel", - "10002.3.4", - "1.2.3.4.5", - "256.0.0.0", - "260.0.0.0", + /* bad */ + "256.257.258.259", + "fe08::7:8interface", + "schnitzel", + "10002.3.4", + "1.2.3.4.5", + "256.0.0.0", + "260.0.0.0", ); $ips = array_merge($ips, $bad); $i = 0; $errors = 0; foreach ($ips as $ip) { - $data = array("id" => ++$i, "remote_addr" => $ip); - $r = @pg_insert($db, 'tmp_statistics', $data); + $data = array("id" => ++$i, "remote_addr" => $ip); + $r = @pg_insert($db, 'tmp_statistics', $data); - if (!$r && in_array($ip, $bad)) { - $errors++; - //echo pg_last_error($db); - } + if (!$r && in_array($ip, $bad)) { + $errors++; + //echo pg_last_error($db); + } - //pg_query($db, "INSERT INTO tmp_statistics (id, remote_addr) VALUES (2, '127.0.0.1')"); // OK, record inserted + //pg_query($db, "INSERT INTO tmp_statistics (id, remote_addr) VALUES (2, '127.0.0.1')"); // OK, record inserted } $r = pg_query($db, "SELECT * FROM tmp_statistics"); while (false != ($row = pg_fetch_row($r))) { - var_dump($row); + var_dump($row); } echo $errors, " errors caught\n"; diff --git a/ext/pgsql/tests/bug72028.phpt b/ext/pgsql/tests/bug72028.phpt index a16f8e72f7..7073ca7d03 100644 --- a/ext/pgsql/tests/bug72028.phpt +++ b/ext/pgsql/tests/bug72028.phpt @@ -29,7 +29,7 @@ $result = pg_query_params($conn, $sql, $params2); $r = pg_query("SELECT * FROM $table"); while (false !== ($i = pg_fetch_assoc($r))) { - var_dump($i); + var_dump($i); } pg_query("DROP TABLE $table"); diff --git a/ext/pgsql/tests/bug77047.phpt b/ext/pgsql/tests/bug77047.phpt index 2cbc4c3dda..222a5398b6 100644 --- a/ext/pgsql/tests/bug77047.phpt +++ b/ext/pgsql/tests/bug77047.phpt @@ -14,8 +14,8 @@ $db = pg_connect($conn_str); pg_query($db, "DROP TABLE IF EXISTS bug77047"); pg_query($db, "CREATE TABLE bug77047 ( - t TIME WITHOUT TIME ZONE - )"); + t TIME WITHOUT TIME ZONE + )"); pg_insert($db, "bug77047", array("t" => "13:31")); pg_insert($db, "bug77047", array("t" => "13:31:13")); @@ -26,7 +26,7 @@ pg_insert($db, "bug77047", array("t" => "")); $res = pg_query($db, "SELECT t FROM bug77047"); while (false !== ($row = pg_fetch_row($res))) { - var_dump(array_pop($row)); + var_dump(array_pop($row)); } ?> diff --git a/ext/pgsql/tests/lcmess.inc b/ext/pgsql/tests/lcmess.inc index 6e0ac25b11..32ab0e36f5 100644 --- a/ext/pgsql/tests/lcmess.inc +++ b/ext/pgsql/tests/lcmess.inc @@ -2,20 +2,20 @@ function _skip_lc_messages($lc_messages = 'C') { - if (!_set_lc_messages($lc_messages)) { - die("skip Cannot set LC_MESSAGES to '{$lc_messages}'\n"); - } + if (!_set_lc_messages($lc_messages)) { + die("skip Cannot set LC_MESSAGES to '{$lc_messages}'\n"); + } } function _set_lc_messages($lc_messages = 'C') { - if (pg_result(pg_query("SHOW LC_MESSAGES"), 0, 0) != $lc_messages) { - if (!@pg_exec("SET LC_MESSAGES='{$lc_messages}'")) { - return false; - } - } + if (pg_result(pg_query("SHOW LC_MESSAGES"), 0, 0) != $lc_messages) { + if (!@pg_exec("SET LC_MESSAGES='{$lc_messages}'")) { + return false; + } + } - return true; + return true; } ?> diff --git a/ext/pgsql/tests/pg_insert_002.phpt b/ext/pgsql/tests/pg_insert_002.phpt index 0dcee55b8f..bb84a00d0d 100644 --- a/ext/pgsql/tests/pg_insert_002.phpt +++ b/ext/pgsql/tests/pg_insert_002.phpt @@ -10,7 +10,7 @@ include('config.inc'); $conn = pg_connect($conn_str); foreach (array('', '.', '..') as $table) { - var_dump(pg_insert($conn, $table, array('id' => 1, 'id2' => 1))); + var_dump(pg_insert($conn, $table, array('id' => 1, 'id2' => 1))); } ?> Done diff --git a/ext/pgsql/tests/pg_update_001.phpt b/ext/pgsql/tests/pg_update_001.phpt index 85a86f3d23..7ef66c2652 100644 --- a/ext/pgsql/tests/pg_update_001.phpt +++ b/ext/pgsql/tests/pg_update_001.phpt @@ -26,7 +26,7 @@ var_dump(pg_update($conn, 'phptests.foo', array('id' => 100), array('id2' => 2), $rs = pg_query('SELECT * FROM foo UNION SELECT * FROM phptests.foo ORDER BY id'); while ($row = pg_fetch_assoc($rs)) { - var_dump($row); + var_dump($row); } pg_query('DROP TABLE foo'); diff --git a/ext/pgsql/tests/skipif.inc b/ext/pgsql/tests/skipif.inc index e24847445c..38c2888afa 100644 --- a/ext/pgsql/tests/skipif.inc +++ b/ext/pgsql/tests/skipif.inc @@ -19,27 +19,27 @@ if (!is_resource($conn)) { function skip_server_version($version, $op = '<') { - $pg = pg_parameter_status('server_version'); - if (version_compare($pg, $version, $op)) { - die("skip Server version {$pg} is {$op} {$version}\n"); - } - return $pg; + $pg = pg_parameter_status('server_version'); + if (version_compare($pg, $version, $op)) { + die("skip Server version {$pg} is {$op} {$version}\n"); + } + return $pg; } function skip_bytea_not_hex() { - $out = pg_escape_bytea("\xFF"); - if (strpos($out, '377') !== false) { - die("skip libpq or backend < 9.0\n"); - } + $out = pg_escape_bytea("\xFF"); + if (strpos($out, '377') !== false) { + die("skip libpq or backend < 9.0\n"); + } } function skip_bytea_not_escape() { - $out = pg_escape_bytea("\xFF"); - if (strpos($out, '377') === false) { - die("skip libpq or backend >= 9.0\n"); - } + $out = pg_escape_bytea("\xFF"); + if (strpos($out, '377') === false) { + die("skip libpq or backend >= 9.0\n"); + } } ?> diff --git a/ext/phar/phar/clicommand.inc b/ext/phar/phar/clicommand.inc index 79bf5c8855..7527e1c4d9 100644 --- a/ext/phar/phar/clicommand.inc +++ b/ext/phar/phar/clicommand.inc @@ -16,336 +16,336 @@ */ abstract class CLICommand { - protected $argc; - protected $argv; - protected $cmds = array(); - protected $args = array(); - protected $typs = array(); - - function __construct($argc, array $argv) - { - $this->argc = $argc; - $this->argv = $argv; - $this->cmds = self::getCommands($this); - $this->typs = self::getArgTyps($this); - - if ($argc < 2) { - self::error("No command given, check ${argv[0]} help\n"); - } elseif (!isset($this->cmds[$argv[1]]['run'])) { - self::error("Unknown command '${argv[1]}', check ${argv[0]} help\n"); - } else { - $command = $argv[1]; - } - - if (isset($this->cmds[$command]['arg'])) { - $this->args = call_user_func(array($this, $this->cmds[$command]['arg'])); - $i = 1; - $missing = false; - while (++$i < $argc) { - if ($argv[$i][0] == '-') { - if (strlen($argv[$i]) == 2 && isset($this->args[$argv[$i][1]])) { - $arg = $argv[$i][1]; - if (++$i >= $argc) { - self::error("Missing argument to parameter '$arg' of command '$command', check ${argv[0]} help\n"); - } else { - $this->args[$arg]['val'] = $this->checkArgTyp($arg, $i, $argc, $argv); - } - } else { - self::error("Unknown parameter '${argv[$i]}' to command $command, check ${argv[0]} help\n"); - } - } else { - break; - } - } - - if (isset($this->args[''])) { - if ($i >= $argc) { - if (isset($this->args['']['require']) && $this->args['']['require']) { - self::error("Missing default trailing arguments to command $command, check ${argv[0]} help\n"); - } - } else { - $this->args['']['val'] = array(); - while($i < $argc) { - $this->args['']['val'][] = $argv[$i++]; - } - } - } else if ($i < $argc) { - self::error("Unexpected default arguments to command $command, check ${argv[0]} help\n"); - } - - foreach($this->args as $arg => $inf) { - if (strlen($arg) && !isset($inf['val']) && isset($inf['required']) && $inf['required']) { - $missing .= "Missing parameter '-$arg' to command $command, check ${argv[0]} help\n"; - } - } - - if (strlen($missing)) { - self::error($missing); - } - } - - call_user_func(array($this, $this->cmds[$command]['run']), $this->args); - } - - static function notice ($msg) - { - fprintf(STDERR, $msg); - } - - static function error ($msg, $exit_code = 1) - { - self::notice($msg); - exit($exit_code); - } - - function checkArgTyp($arg, $i, $argc, $argv) - { - $typ = $this->args[$arg]['typ']; - - if (isset($this->typs[$typ]['typ'])) { - return call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg], $arg); - } else { - return $argv[$i]; - } - } - - static function getSubFuncs(CLICommand $cmdclass, $prefix, array $subs) - { - $a = array(); - $r = new ReflectionClass($cmdclass); - $l = strlen($prefix); - - foreach($r->getMethods() as $m) { - if (substr($m->name, 0, $l) == $prefix) { - foreach($subs as $sub) { - $what = substr($m->name, $l+strlen($sub)+1); - $func = $prefix . $sub . '_' . $what; - $what = str_replace('_', '-', $what); - if ($r->hasMethod($func)) { - if (!isset($a[$what])) { - $a[$what] = array(); - } - $a[$what][$sub] = /*$m->class . '::' .*/ $func; - } - } - } - } - return $a; - } - - static function getCommands(CLICommand $cmdclass) - { - return self::getSubFuncs($cmdclass, 'cli_cmd_', array('arg','inf','run')); - } - - static function getArgTyps(CLICommand $cmdclass) - { - return self::getSubFuncs($cmdclass, 'cli_arg_', array('typ')); - } - - static function cli_arg_typ_bool($arg, $cfg, $key) - { - return (bool)$arg; - } - - static function cli_arg_typ_int($arg, $cfg, $key) - { - if ((int)$arg != $arg) { - self::error("Argument to -$key must be an integer.\n"); - } - - return (int)$arg; - } - - static function cli_arg_typ_regex($arg, $cfg, $key) - { - if (strlen($arg)) { - if (strlen($arg) > 1 && $arg[0] == $arg[strlen($arg)-1] && strpos('/,', $arg) !== false) { - return $arg; - } else { - return '/' . $arg . '/'; - } - } else { - return NULL; - } - } - - static function cli_arg_typ_select($arg, $cfg, $key) - { - if (!in_array($arg, array_keys($cfg['select']))) { - self::error("Parameter value '$arg' not one of '" . join("', '", array_keys($cfg['select'])) . "'.\n"); - } - return $arg; - } - - static function cli_arg_typ_dir($arg, $cfg, $key) - { - $f = realpath($arg); - - if ($f===false || !file_exists($f) || !is_dir($f)) { - self::error("Requested path '$arg' does not exist.\n"); - } - return $f; - } - - static function cli_arg_typ_file($arg) - { - $f = new SplFileInfo($arg); - $f = $f->getRealPath(); - if ($f===false || !file_exists($f)) { - echo "Requested file '$arg' does not exist.\n"; - exit(1); - } - return $f; - } - - static function cli_arg_typ_filenew($arg, $cfg, $key) - { - $d = dirname($arg); - $f = realpath($d); - - if ($f === false) { - self::error("Path for file '$arg' does not exist.\n"); - } - return $f . '/' . basename($arg); - } - - static function cli_arg_typ_filecont($arg, $cfg, $key) - { - return file_get_contents(self::cli_arg_typ_file($arg, $cfg, $key)); - } - - function cli_get_SP2($l1, $arg_inf) - { - return str_repeat(' ', $l1 + 2 + 4 + 8); - } - - function cli_get_SP3($l1, $l2, $arg_inf) - { - return str_repeat(' ', $l1 + 2 + 4 + 8 + 2 + $l2 + 2); - } - - static function cli_cmd_inf_help() - { - return "This help or help for a selected command."; - } - - private function cli_wordwrap($what, $l, $sp) - { - $p = max(79 - $l, 40); // minimum length for paragraph - $b = substr($what, 0, $l); // strip out initial $l - $r = substr($what, $l); // remainder - $r = str_replace("\n", "\n".$sp, $r); // in remainder replace \n's - return $b . wordwrap($r, $p, "\n".$sp); - } - - private function cli_help_get_args($func, $l, $sp, $required) - { - $inf = ""; - foreach(call_user_func($func, $l, $sp) as $arg => $conf) { - if ((isset($conf['required']) && $conf['required']) != $required) { - continue; - } - - if (strlen($arg)) { - $arg = "-$arg "; - } else { - $arg = "... "; - } - - $sp2 = $this->cli_get_SP2($l, $inf); - $l2 = strlen($sp2); - $inf .= $this->cli_wordwrap($sp . $arg . $conf['inf'], $l2, $sp2) . "\n"; - - if (isset($conf['select']) && count($conf['select'])) { - $ls = 0; - foreach($conf['select'] as $opt => $what) { - $ls = max($ls, strlen($opt)); - } - $sp3 = $this->cli_get_SP3($l, $ls, $inf); - $l3 = strlen($sp3); - foreach($conf['select'] as $opt => $what) { - $inf .= $this->cli_wordwrap($sp2 . " " . sprintf("%-${ls}s ", $opt) . $what, $l3, $sp3) . "\n"; - } - } - } - if (strlen($inf)) { - if ($required) { - return $sp . "Required arguments:\n\n" . $inf; - } else { - return $sp . "Optional arguments:\n\n". $inf; - } - } - } - - function cli_cmd_arg_help() - { - return array('' => array('typ'=>'any','val'=>NULL,'inf'=>'Optional command to retrieve help for.')); - } - - function cli_cmd_run_help() - { - $argv = $this->argv; - $which = $this->args['']['val']; - if (isset($which)) { - if (count($which) != 1) { - self::error("More than one command given.\n"); - } - - $which = $which[0]; - if (!array_key_exists($which, $this->cmds)) { - if (strtolower($which) == 'commands') { - self::cli_cmd_run_help_list(); - exit(0); - } - self::error("Unknown command, cannot retrieve help.\n"); - } - - $l = strlen($which); - $cmds = array($which => $this->cmds[$which]); - } else { - echo "\n$argv[0] <command> [options]\n\n"; - $l = 0; - ksort($this->cmds); - foreach($this->cmds as $name => $funcs) { - $l = max($l, strlen($name)); - } - $inf = "Commands:"; - $lst = ""; - $ind = strlen($inf) + 1; - foreach($this->cmds as $name => $funcs) { - $lst .= ' ' . $name; - } - echo $this->cli_wordwrap($inf.$lst, $ind, str_repeat(' ', $ind)) . "\n\n"; - $cmds = $this->cmds; - } - $sp = str_repeat(' ', $l + 2); - foreach($cmds as $name => $funcs) { - $inf = $name . substr($sp, strlen($name)); - if (isset($funcs['inf'])) { - $inf .= $this->cli_wordwrap(call_user_func(array($this, $funcs['inf'])), $l, $sp) . "\n"; - if (isset($funcs['arg'])) { - $inf .= "\n"; - $inf .= $this->cli_help_get_args(array($this, $funcs['arg']), $l, $sp, true); - $inf .= "\n"; - $inf .= $this->cli_help_get_args(array($this, $funcs['arg']), $l, $sp, false); - } - } - echo "$inf\n\n"; - } - exit(0); - } - - static function cli_cmd_inf_help_list() - { - return "Lists available commands."; - } - - function cli_cmd_run_help_list() - { - ksort($this->cmds); - echo join(' ', array_keys($this->cmds)) . "\n"; - } + protected $argc; + protected $argv; + protected $cmds = array(); + protected $args = array(); + protected $typs = array(); + + function __construct($argc, array $argv) + { + $this->argc = $argc; + $this->argv = $argv; + $this->cmds = self::getCommands($this); + $this->typs = self::getArgTyps($this); + + if ($argc < 2) { + self::error("No command given, check ${argv[0]} help\n"); + } elseif (!isset($this->cmds[$argv[1]]['run'])) { + self::error("Unknown command '${argv[1]}', check ${argv[0]} help\n"); + } else { + $command = $argv[1]; + } + + if (isset($this->cmds[$command]['arg'])) { + $this->args = call_user_func(array($this, $this->cmds[$command]['arg'])); + $i = 1; + $missing = false; + while (++$i < $argc) { + if ($argv[$i][0] == '-') { + if (strlen($argv[$i]) == 2 && isset($this->args[$argv[$i][1]])) { + $arg = $argv[$i][1]; + if (++$i >= $argc) { + self::error("Missing argument to parameter '$arg' of command '$command', check ${argv[0]} help\n"); + } else { + $this->args[$arg]['val'] = $this->checkArgTyp($arg, $i, $argc, $argv); + } + } else { + self::error("Unknown parameter '${argv[$i]}' to command $command, check ${argv[0]} help\n"); + } + } else { + break; + } + } + + if (isset($this->args[''])) { + if ($i >= $argc) { + if (isset($this->args['']['require']) && $this->args['']['require']) { + self::error("Missing default trailing arguments to command $command, check ${argv[0]} help\n"); + } + } else { + $this->args['']['val'] = array(); + while($i < $argc) { + $this->args['']['val'][] = $argv[$i++]; + } + } + } else if ($i < $argc) { + self::error("Unexpected default arguments to command $command, check ${argv[0]} help\n"); + } + + foreach($this->args as $arg => $inf) { + if (strlen($arg) && !isset($inf['val']) && isset($inf['required']) && $inf['required']) { + $missing .= "Missing parameter '-$arg' to command $command, check ${argv[0]} help\n"; + } + } + + if (strlen($missing)) { + self::error($missing); + } + } + + call_user_func(array($this, $this->cmds[$command]['run']), $this->args); + } + + static function notice ($msg) + { + fprintf(STDERR, $msg); + } + + static function error ($msg, $exit_code = 1) + { + self::notice($msg); + exit($exit_code); + } + + function checkArgTyp($arg, $i, $argc, $argv) + { + $typ = $this->args[$arg]['typ']; + + if (isset($this->typs[$typ]['typ'])) { + return call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg], $arg); + } else { + return $argv[$i]; + } + } + + static function getSubFuncs(CLICommand $cmdclass, $prefix, array $subs) + { + $a = array(); + $r = new ReflectionClass($cmdclass); + $l = strlen($prefix); + + foreach($r->getMethods() as $m) { + if (substr($m->name, 0, $l) == $prefix) { + foreach($subs as $sub) { + $what = substr($m->name, $l+strlen($sub)+1); + $func = $prefix . $sub . '_' . $what; + $what = str_replace('_', '-', $what); + if ($r->hasMethod($func)) { + if (!isset($a[$what])) { + $a[$what] = array(); + } + $a[$what][$sub] = /*$m->class . '::' .*/ $func; + } + } + } + } + return $a; + } + + static function getCommands(CLICommand $cmdclass) + { + return self::getSubFuncs($cmdclass, 'cli_cmd_', array('arg','inf','run')); + } + + static function getArgTyps(CLICommand $cmdclass) + { + return self::getSubFuncs($cmdclass, 'cli_arg_', array('typ')); + } + + static function cli_arg_typ_bool($arg, $cfg, $key) + { + return (bool)$arg; + } + + static function cli_arg_typ_int($arg, $cfg, $key) + { + if ((int)$arg != $arg) { + self::error("Argument to -$key must be an integer.\n"); + } + + return (int)$arg; + } + + static function cli_arg_typ_regex($arg, $cfg, $key) + { + if (strlen($arg)) { + if (strlen($arg) > 1 && $arg[0] == $arg[strlen($arg)-1] && strpos('/,', $arg) !== false) { + return $arg; + } else { + return '/' . $arg . '/'; + } + } else { + return NULL; + } + } + + static function cli_arg_typ_select($arg, $cfg, $key) + { + if (!in_array($arg, array_keys($cfg['select']))) { + self::error("Parameter value '$arg' not one of '" . join("', '", array_keys($cfg['select'])) . "'.\n"); + } + return $arg; + } + + static function cli_arg_typ_dir($arg, $cfg, $key) + { + $f = realpath($arg); + + if ($f===false || !file_exists($f) || !is_dir($f)) { + self::error("Requested path '$arg' does not exist.\n"); + } + return $f; + } + + static function cli_arg_typ_file($arg) + { + $f = new SplFileInfo($arg); + $f = $f->getRealPath(); + if ($f===false || !file_exists($f)) { + echo "Requested file '$arg' does not exist.\n"; + exit(1); + } + return $f; + } + + static function cli_arg_typ_filenew($arg, $cfg, $key) + { + $d = dirname($arg); + $f = realpath($d); + + if ($f === false) { + self::error("Path for file '$arg' does not exist.\n"); + } + return $f . '/' . basename($arg); + } + + static function cli_arg_typ_filecont($arg, $cfg, $key) + { + return file_get_contents(self::cli_arg_typ_file($arg, $cfg, $key)); + } + + function cli_get_SP2($l1, $arg_inf) + { + return str_repeat(' ', $l1 + 2 + 4 + 8); + } + + function cli_get_SP3($l1, $l2, $arg_inf) + { + return str_repeat(' ', $l1 + 2 + 4 + 8 + 2 + $l2 + 2); + } + + static function cli_cmd_inf_help() + { + return "This help or help for a selected command."; + } + + private function cli_wordwrap($what, $l, $sp) + { + $p = max(79 - $l, 40); // minimum length for paragraph + $b = substr($what, 0, $l); // strip out initial $l + $r = substr($what, $l); // remainder + $r = str_replace("\n", "\n".$sp, $r); // in remainder replace \n's + return $b . wordwrap($r, $p, "\n".$sp); + } + + private function cli_help_get_args($func, $l, $sp, $required) + { + $inf = ""; + foreach(call_user_func($func, $l, $sp) as $arg => $conf) { + if ((isset($conf['required']) && $conf['required']) != $required) { + continue; + } + + if (strlen($arg)) { + $arg = "-$arg "; + } else { + $arg = "... "; + } + + $sp2 = $this->cli_get_SP2($l, $inf); + $l2 = strlen($sp2); + $inf .= $this->cli_wordwrap($sp . $arg . $conf['inf'], $l2, $sp2) . "\n"; + + if (isset($conf['select']) && count($conf['select'])) { + $ls = 0; + foreach($conf['select'] as $opt => $what) { + $ls = max($ls, strlen($opt)); + } + $sp3 = $this->cli_get_SP3($l, $ls, $inf); + $l3 = strlen($sp3); + foreach($conf['select'] as $opt => $what) { + $inf .= $this->cli_wordwrap($sp2 . " " . sprintf("%-${ls}s ", $opt) . $what, $l3, $sp3) . "\n"; + } + } + } + if (strlen($inf)) { + if ($required) { + return $sp . "Required arguments:\n\n" . $inf; + } else { + return $sp . "Optional arguments:\n\n". $inf; + } + } + } + + function cli_cmd_arg_help() + { + return array('' => array('typ'=>'any','val'=>NULL,'inf'=>'Optional command to retrieve help for.')); + } + + function cli_cmd_run_help() + { + $argv = $this->argv; + $which = $this->args['']['val']; + if (isset($which)) { + if (count($which) != 1) { + self::error("More than one command given.\n"); + } + + $which = $which[0]; + if (!array_key_exists($which, $this->cmds)) { + if (strtolower($which) == 'commands') { + self::cli_cmd_run_help_list(); + exit(0); + } + self::error("Unknown command, cannot retrieve help.\n"); + } + + $l = strlen($which); + $cmds = array($which => $this->cmds[$which]); + } else { + echo "\n$argv[0] <command> [options]\n\n"; + $l = 0; + ksort($this->cmds); + foreach($this->cmds as $name => $funcs) { + $l = max($l, strlen($name)); + } + $inf = "Commands:"; + $lst = ""; + $ind = strlen($inf) + 1; + foreach($this->cmds as $name => $funcs) { + $lst .= ' ' . $name; + } + echo $this->cli_wordwrap($inf.$lst, $ind, str_repeat(' ', $ind)) . "\n\n"; + $cmds = $this->cmds; + } + $sp = str_repeat(' ', $l + 2); + foreach($cmds as $name => $funcs) { + $inf = $name . substr($sp, strlen($name)); + if (isset($funcs['inf'])) { + $inf .= $this->cli_wordwrap(call_user_func(array($this, $funcs['inf'])), $l, $sp) . "\n"; + if (isset($funcs['arg'])) { + $inf .= "\n"; + $inf .= $this->cli_help_get_args(array($this, $funcs['arg']), $l, $sp, true); + $inf .= "\n"; + $inf .= $this->cli_help_get_args(array($this, $funcs['arg']), $l, $sp, false); + } + } + echo "$inf\n\n"; + } + exit(0); + } + + static function cli_cmd_inf_help_list() + { + return "Lists available commands."; + } + + function cli_cmd_run_help_list() + { + ksort($this->cmds); + echo join(' ', array_keys($this->cmds)) . "\n"; + } } ?> diff --git a/ext/phar/phar/directorygraphiterator.inc b/ext/phar/phar/directorygraphiterator.inc index 34579678a7..e31f3e4e67 100644 --- a/ext/phar/phar/directorygraphiterator.inc +++ b/ext/phar/phar/directorygraphiterator.inc @@ -16,19 +16,19 @@ */ class DirectoryGraphIterator extends DirectoryTreeIterator { - function __construct($path) - { - RecursiveIteratorIterator::__construct( - new RecursiveCachingIterator( - new ParentIterator( - new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME - ) - ), - CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD - ), - parent::SELF_FIRST - ); - } + function __construct($path) + { + RecursiveIteratorIterator::__construct( + new RecursiveCachingIterator( + new ParentIterator( + new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME + ) + ), + CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD + ), + parent::SELF_FIRST + ); + } } ?> diff --git a/ext/phar/phar/directorytreeiterator.inc b/ext/phar/phar/directorytreeiterator.inc index 2c681632fb..de6acea13d 100644 --- a/ext/phar/phar/directorytreeiterator.inc +++ b/ext/phar/phar/directorytreeiterator.inc @@ -16,39 +16,39 @@ */ class DirectoryTreeIterator extends RecursiveIteratorIterator { - /** Construct from a path. - * @param $path directory to iterate - */ - function __construct($path) - { - parent::__construct( - new RecursiveCachingIterator( - new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME - ), - CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD - ), - parent::SELF_FIRST - ); - } + /** Construct from a path. + * @param $path directory to iterate + */ + function __construct($path) + { + parent::__construct( + new RecursiveCachingIterator( + new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME + ), + CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD + ), + parent::SELF_FIRST + ); + } - /** @return the current element prefixed with ASCII graphics - */ - function current() - { - $tree = ''; - for ($l=0; $l < $this->getDepth(); $l++) { - $tree .= $this->getSubIterator($l)->hasNext() ? '| ' : ' '; - } - return $tree . ($this->getSubIterator($l)->hasNext() ? '|-' : '\-') - . $this->getSubIterator($l)->__toString(); - } + /** @return the current element prefixed with ASCII graphics + */ + function current() + { + $tree = ''; + for ($l=0; $l < $this->getDepth(); $l++) { + $tree .= $this->getSubIterator($l)->hasNext() ? '| ' : ' '; + } + return $tree . ($this->getSubIterator($l)->hasNext() ? '|-' : '\-') + . $this->getSubIterator($l)->__toString(); + } - /** Aggregates the inner iterator - */ - function __call($func, $params) - { - return call_user_func_array(array($this->getSubIterator(), $func), $params); - } + /** Aggregates the inner iterator + */ + function __call($func, $params) + { + return call_user_func_array(array($this->getSubIterator(), $func), $params); + } } ?> diff --git a/ext/phar/phar/invertedregexiterator.inc b/ext/phar/phar/invertedregexiterator.inc index 8f82f41f2a..ff7024e4ec 100644 --- a/ext/phar/phar/invertedregexiterator.inc +++ b/ext/phar/phar/invertedregexiterator.inc @@ -16,12 +16,12 @@ */ class InvertedRegexIterator extends RegexIterator { - /** @return !RegexIterator::accept() - */ - function accept() - { - return !RegexIterator::accept(); - } + /** @return !RegexIterator::accept() + */ + function accept() + { + return !RegexIterator::accept(); + } } ?> diff --git a/ext/phar/phar/phar.inc b/ext/phar/phar/phar.inc index 129a0c43bf..9ca25e7f6f 100644 --- a/ext/phar/phar/phar.inc +++ b/ext/phar/phar/phar.inc @@ -20,61 +20,61 @@ */ class Phar extends PHP_Archive implements RecursiveIterator { - function getSignature() - { - return false; - } + function getSignature() + { + return false; + } - function getAlias() - { - return false; - } + function getAlias() + { + return false; + } - function rewind() - { - } + function rewind() + { + } - function valid() - { - return false; - } + function valid() + { + return false; + } - function current() - { - } + function current() + { + } - function key() - { - } + function key() + { + } - function next() - { - } + function next() + { + } - function hasChildren() - { - return false; - } + function hasChildren() + { + return false; + } - function getChildren() - { - } + function getChildren() + { + } - function hasMetadata() - { - } + function hasMetadata() + { + } - function getMetadata() - { - } + function getMetadata() + { + } - function getStub() - { - } + function getStub() + { + } - function setStub() - { - } + function setStub() + { + } } ?> diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc index 341e5f3465..1fb41dbb6a 100644 --- a/ext/phar/phar/pharcommand.inc +++ b/ext/phar/phar/pharcommand.inc @@ -24,1572 +24,1572 @@ */ class PharCommand extends CLICommand { - // {{{ public function cli_get_SP2 - public function cli_get_SP2($l1, $arg_inf) - { - return str_repeat(' ', $l1 + 2 + 4 + 9); - } - // }}} - // {{{ public function cli_get_SP3 - /** - * Cli Get SP3 - * - * @param string $l1 Eleven - * @param string $l2 Twelve - * @param string $arg_inf - * @return string The repeated string. - */ - function cli_get_SP3($l1, $l2, $arg_inf) - { - return str_repeat(' ', $l1 + 2 + 4 + 9 + 2 + $l2 + 2); - } - // }}} - // {{{ static function phar_args - /** - * Phar arguments - * - * This function contains all the phar commands - * - * @param string $which Which argument is chosen. - * @param string $phartype The type of phar, specific file to work on - * @return unknown - */ - static function phar_args($which, $phartype) - { - $phar_args = array( - 'a' => array( - 'typ' => 'alias', - 'val' => NULL, - 'inf' => '<alias> Provide an alias name for the phar file.' - ), - 'b' => array( - 'typ' => 'any', - 'val' => NULL, - 'inf' => '<bang> Hash-bang line to start the archive (e.g. #!/usr/bin/php). The hash ' - .' mark itself \'#!\' and the newline character are optional.' - ), - 'c' => array( - 'typ' => 'compalg', - 'val' => NULL, - 'inf' => '<algo> Compression algorithm.', - 'select' => array( - '0' => 'No compression', - 'none' => 'No compression', - 'auto' => 'Automatically select compression algorithm' - ) - ), - 'e' => array( - 'typ' => 'entry', - 'val' => NULL, - 'inf' => '<entry> Name of entry to work on (must include PHAR internal directory name if any).' - ), - 'f' => array( - 'typ' => $phartype, - 'val' => NULL, - 'inf' => '<file> Specifies the phar file to work on.' - ), - 'h' => array( - 'typ' => 'select', - 'val' => NULL, - 'inf' => '<method> Selects the hash algorithm.', - 'select' => array('md5' => 'MD5','sha1' => 'SHA1') - ), - 'i' => array( - 'typ' => 'regex', - 'val' => NULL, - 'inf' => '<regex> Specifies a regular expression for input files.' - ), - 'k' => array( - 'typ' => 'any', - 'val' => NULL, - 'inf' => '<index> Subscription index to work on.', - ), - 'l' => array( - 'typ' => 'int', - 'val' => 0, - 'inf' => '<level> Number of preceding subdirectories to strip from file entries', - ), - 'm' => array( - 'typ' => 'any', - 'val' => NULL, - 'inf' => '<meta> Meta data to store with entry (serialized php data).' - ), - 'p' => array( - 'typ' => 'loader', - 'val' => NULL, - 'inf' => '<loader> Location of PHP_Archive class file (pear list-files PHP_Archive).' - .'You can use \'0\' or \'1\' to locate it automatically using the mentioned ' - .'pear command. When using \'0\' the command does not error out when the ' - .'class file cannot be located. This switch also adds some code around the ' - .'stub so that class PHP_Archive gets registered as phar:// stream wrapper ' - .'if necessary. And finally this switch will add the file phar.inc from ' - .'this package and load it to ensure class Phar is present.' - , - ), - 's' => array( - 'typ' => 'file', - 'val' => NULL, - 'inf' => '<stub> Select the stub file.' - ), - 'x' => array( - 'typ' => 'regex', - 'val' => NULL, - 'inf' => '<regex> Regular expression for input files to exclude.' - ), - 'y' => array( - 'typ' => 'privkey', - 'val' => NULL, - 'inf' => '<key> Private key for OpenSSL signing.', - ), - ); - - if (extension_loaded('zlib')) { - $phar_args['c']['select']['gz'] = 'GZip compression'; - $phar_args['c']['select']['gzip'] = 'GZip compression'; - } - - if (extension_loaded('bz2')) { - $phar_args['c']['select']['bz2'] = 'BZip2 compression'; - $phar_args['c']['select']['bzip2'] = 'BZip2 compression'; - } - - $hash_avail = Phar::getSupportedSignatures(); - $hash_optional = array('SHA-256' => 'SHA256', - 'SHA-512' => 'SHA512', - 'OpenSSL' => 'OpenSSL'); - if (!in_array('OpenSSL', $hash_avail)) { - unset($phar_args['y']); - } - - foreach($hash_optional as $key => $name) { - if (in_array($key, $hash_avail)) { - $phar_args['h']['select'][strtolower($name)] = $name; - } - } - - $args = array(); - - foreach($phar_args as $lkey => $cfg) { - $ukey = strtoupper($lkey); - $required = strpos($which, $ukey) !== false; - $optional = strpos($which, $lkey) !== false; - - if ($required || $optional) { - $args[$lkey] = $cfg; - $args[$lkey]['required'] = $required; - } - } - return $args; - } - // }}} - // {{{ static function strEndsWith - /** - * String Ends With - * - * Whether a string ends with another needle. - * - * @param string $haystack The haystack - * @param string $needle The needle. - * @return mixed false if doesn't end with anything, the string - * substr'ed if the string ends with the needle. - */ - static function strEndsWith($haystack, $needle) - { - return substr($haystack, -strlen($needle)) == $needle; - } - // }}} - // {{{ static function cli_arg_typ_loader - /** - * Argument type loader - * - * @param string $arg Either 'auto', 'optional' or an filename that - * contains class PHP_Archive - * @param string $cfg Configuration to pass to a new file - * @param string $key The key - * @return string $arg The argument. - */ - static function cli_arg_typ_loader($arg, $cfg, $key) - { - if (($arg == '0' || $arg == '1') && !file_exists($arg) && substr(PHP_OS, 0, 3) != 'WIN') { - $found = NULL; - $apiver = false; - $path = explode(PATH_SEPARATOR, $_ENV['PATH']); - $pear = false; - foreach ($path as $component) { - if (file_exists($component . DIRECTORY_SEPARATOR . 'pear') - && is_executable($component . DIRECTORY_SEPARATOR . 'pear')) { - $pear = true; - break; - } - } - if ($pear) { - $apiver = `pear -q info PHP_Archive 2>/dev/null|grep 'API Version'`; - $apiver = trim(substr($apiver, strlen('API Version'))); - } - if ($apiver) { - self::notice("PEAR package PHP_Archive: API Version: $apiver.\n"); - $files = explode("\n", `pear list-files PHP_Archive`); - $phpdir = `pear config-get php_dir 2>/dev/null`; - $phpdir = trim($phpdir); - self::notice("PEAR package PHP_Archive: $phpdir.\n"); - if (is_dir($phpdir)) { - foreach($files as $ent) { - $matches = NULL; - if (preg_match(",^php[ \t]+([^ \t].*[\\\\/]PHP[\\\\/]Archive\.php)$,", $ent, $matches)) { - $sub = $matches[1]; - if (strpos($sub, $phpdir) !== 0) { - $found = NULL; - break; - } - $found = $sub; - break; - } - } - } else { - self::notice("PEAR package PHP_Archive: corrupt or inaccessible base dir: $php_dir.\n"); - } - } - if (isset($found)) { - self::notice("PEAR package PHP_Archive: $found.\n"); - } else { - $msg = "PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.\n"; - if ($arg == '0') { - self::notice($msg); - } else { - self::error($msg); - } - } - $arg = $found; - } - return self::cli_arg_typ_file($arg); - } - // }}} - // {{{ static function cli_arg_typ_pharnew - /** - * Argument type new phar - * - * @param string $arg The new phar component. - * @param string $cfg Configuration to pass to a new file - * @param string $key The key - * @return string $arg The new argument file. - */ - static function cli_arg_typ_pharnew($arg, $cfg, $key) - { - $arg = self::cli_arg_typ_filenew($arg, $cfg, $key); - if (!Phar::isValidPharFilename($arg)) { - self::error("Phar files must have file extension '.phar', '.phar.php', '.phar.bz2' or '.phar.gz'.\n"); - } - return $arg; - } - // }}} - // {{{ static function cli_arg_typ_pharfile - /** - * Argument type existing Phar file - * - * Return filename of an existing Phar. - * - * @param string $arg The file in the phar to open. - * @param string $cfg The configuration information - * @param string $key The key information. - * @return string $pharfile The name of the loaded Phar file. - * @note The Phar will be loaded - */ - static function cli_arg_typ_pharfile($arg, $cfg, $key) - { - try { - $pharfile = self::cli_arg_typ_file($arg, $cfg, $key); - - if (!Phar::loadPhar($pharfile)) { - self::error("Unable to open phar '$arg'\n"); - } - - return $pharfile; - } catch(Exception $e) { - self::error("Exception while opening phar '$arg':\n" . $e->getMessage() . "\n"); - } - } - // }}} - // {{{ static function cli_arg_typ_pharurl - /** - * Argument type Phar url-like - * - * Check the argument as cli_arg_Typ_phar and return its name prefixed - * with phar:// - * - * Ex: - * <code> - * $arg = 'pharchive.phar/file.php'; - * cli_arg_typ_pharurl($arg) - * </code> - * - * @param string $arg The url-like phar archive to retrieve. - * @return string The phar file-archive. - */ - static function cli_arg_typ_pharurl($arg, $cfg, $key) - { - return 'phar://' . self::cli_arg_typ_pharfile($arg, $cfg, $key); - } - // }}} - // {{{ static function cli_arg_typ_phar - /** - * Cli argument type phar - * - * @param string $arg The phar archive to use. - * @return object new Phar of the passed argument. - */ - static function cli_arg_typ_phar($arg, $cfg, $key) - { - try { - return new Phar(self::cli_arg_typ_pharfile($arg, $cfg, $key)); - } catch(Exception $e) { - self::error("Exception while opening phar '$argv':\n" . $e->getMessage() . "\n"); - } - } - // }}} - // {{{ static function cli_arg_typ_entry - /** - * Argument type Entry name - * - * @param string $arg The argument (the entry) - * @return string $arg The entry itself. - */ - static function cli_arg_typ_entry($arg, $cfg, $key) - { - // no further check atm, maybe check for no '/' at beginning - return $arg; - } - // }}} - // {{{ static function cli_arg_typ_compalg - /** - * Argument type compression algorithm - * - * @param string $arg The phar selection - * @param string $cfg The config option. - * @param string $key The key information. - * @return string $arg The selected algorithm - */ - static function cli_arg_typ_compalg($arg, $cfg, $key) - { - $arg = self::cli_arg_typ_select($arg, $cfg, $key); - - switch($arg) { - case 'auto': - if (extension_loaded('zlib')) { - $arg = 'gz'; - } elseif (extension_loaded('bz2')) { - $arg = 'bz2'; - } else { - $arg = '0'; - } - break; - } - return $arg; - } - // }}} - // {{{ static function cli_arg_typ_privkey - /** - * Argument type private key (for OpenSSL signing) - * - * @param string $arg The phar selection - * @param string $cfg The config option. - * @param string $key The key information. - * @return string $arg The private key. - */ - static function cli_arg_typ_privkey($arg, $cfg, $key) - { - $arg = self::cli_arg_typ_filecont($arg, $cfg, $key); - - $hash_avail = Phar::getSupportedSignatures(); - if ($arg && !in_array('OpenSSL', $hash_avail)) - { - self::error("Cannot specify private key without OpenSSL support.\n"); - } - return $arg; - } - // }}} - // {{{ static function phar_check_hash - /** - * Check whether hash method is valid. - * - * @return Hash constant to be used. - */ - function phar_check_hash($hash, $privkey) - { - switch($hash) { - case 'md5': - return Phar::MD5; - case 'sha1': - return Phar::SHA1; - case 'sha256': - return Phar::SHA256; - case 'sha512': - return Phar::SHA512; - case 'openssl': - if (!$privkey) { - self::error("Cannot use OpenSSL signing without key.\n"); - } - return Phar::OPENSSL; - } - } - // }}} - // {{{ static function cli_cmd_inf_pack - /** - * Information pack - * - * @return string A description about packing files into a Phar archive. - */ - static function cli_cmd_inf_pack() - { - return "Pack files into a PHAR archive.\n" . - "When using -s <stub>, then the stub file is being " . - "excluded from the list of input files/dirs." . - "To create an archive that contains PEAR class PHP_Archive " . - "then point -p argument to PHP/Archive.php.\n"; - } - // }}} - // {{{ static function cli_cmd_arg_pack - /** - * Pack a new phar infos - * - * @return array $args The arguments for a new Phar archive. - */ - static function cli_cmd_arg_pack() - { - $args = self::phar_args('abcFhilpsxy', 'pharnew'); - - $args[''] = array( - 'typ' => 'any', - 'val' => NULL, - 'required' => 1, - 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', - ); - - return $args; - } - // }}} - // {{{ function phar_set_stub_begin - /** - * Set the stub - */ - public function phar_set_stub_begin(Phar $phar, $stub, $loader = NULL, $hashbang = NULL) - { - if (isset($stub)) { - $c = file_get_contents($stub); - - if (substr($c, 0, 2) == '#!') { - if (strpos($c, "\n") !== false) { - if (!isset($hashbang)) { - $hashbang = substr($c, 0, strpos($c, "\n") + 1); - } - $c = substr($c, strpos($c, "\n") + 1); - } else { - if (!isset($hashbang)) { - $hashbang = $c; - } - $c = NULL; - } - } - - if (isset($hashbang)) { - if (substr($hashbang, 0, 2) != '#!') { - $hashbang = '#!' . $hashbang; - } - if (substr($hashbang, -1) != "\n") { - $hashbang .= "\n"; - } - } else { - $hashbang = ""; - } - - if (isset($loader)) { - $s = "<?php if (!class_exists('PHP_Archive')) {\n?>"; - if (is_file($loader)) { - $s .= file_get_contents($loader); - } - $s .= "<?php\n"; - $s .= "}\n"; - $s .= "if (!in_array('phar', stream_get_wrappers())) {\n"; - $s .= "\tstream_wrapper_register('phar', 'PHP_Archive');\n"; - $s .= "}\n"; - $s .= "if (!class_exists('Phar',0)) {\n"; - $s .= "\tinclude 'phar://'.__FILE__.'/phar.inc';\n"; - $s .= "}\n"; - $s .= '?>'; - $s .= $c; - - $phar->setStub($hashbang . $s); - } else { - $phar->setStub($hashbang . $c); - } - return new SplFileInfo($stub); - } - return NULL; - } - // }}} - // {{{ function phar_set_stub_end - /** - * Set stub end - */ - public function phar_set_stub_end(Phar $phar, $stub, $loader = NULL) - { - if (isset($stub) && isset($loader)) { - if (substr(__FILE__, -15) == 'pharcommand.inc') { - self::phar_add_file($phar, 0, 'phar.inc', 'phar://'.__FILE__.'/phar.inc', NULL); - } else { - self::phar_add_file($phar, 0, 'phar.inc', dirname(__FILE__).'/phar/phar.inc', NULL); - } - } - } - // }}} - // {{{ function cli_cmd_run_pack - /** - * Pack a new Phar - * - * This function will try to pack a new Phar archive. - * - * @see Exit to make sure that we are done. - */ - public function cli_cmd_run_pack() - { - if (ini_get('phar.readonly')) { - self::error("Creating phar files is disabled by ini setting 'phar.readonly'.\n"); - } - - if (!Phar::canWrite()) { - self::error("Creating phar files is disabled, Phar::canWrite() returned false.\n"); - } - - $alias = $this->args['a']['val']; - $hashbang = $this->args['b']['val']; - $archive = $this->args['f']['val']; - $hash = $this->args['h']['val']; - $privkey = $this->args['y']['val'] ?? null; - $regex = $this->args['i']['val']; - $level = $this->args['l']['val']; - $loader = $this->args['p']['val']; - $stub = $this->args['s']['val']; - $invregex = $this->args['x']['val']; - $input = $this->args['']['val']; - - $hash = self::phar_check_hash($hash, $privkey); - - $phar = new Phar($archive, 0, $alias); - - $phar->startBuffering(); - - $stub = $this->phar_set_stub_begin($phar, $stub, $loader, $hashbang); - - if (!is_array($input)) { - $this->phar_add($phar, $level, $input, $regex, $invregex, $stub, NULL, isset($loader)); - } else { - foreach($input as $i) { - $this->phar_add($phar, $level, $i, $regex, $invregex, $stub, NULL, isset($loader)); - } - } - - $this->phar_set_stub_end($phar, $stub, $loader); - - switch($this->args['c']['val']) { - case 'gz': - case 'gzip': - $phar->compressFiles(Phar::GZ); - break; - case 'bz2': - case 'bzip2': - $phar->compressFiles(Phar::BZ2); - break; - default: - $phar->decompressFiles(); - break; - } - - if ($hash) { - $phar->setSignatureAlgorithm($hash, $privkey); - } - - $phar->stopBuffering(); - exit(0); - } - // }}} - // {{{ static function phar_add - /** - * Add files to a phar archive. - * - * This function will take a directory and iterate through - * it and get the files to insert into the Phar archive. - * - * @param Phar $phar The phar object. - * @param string $input The input directory - * @param string $regex The regex used in RegexIterator. - * @param string $invregex The InvertedRegexIterator expression. - * @param SplFileInfo $stub Stub file object - * @param mixed $compress Compression algorithm or NULL - * @param boolean $noloader Whether to prevent adding the loader - */ - static function phar_add(Phar $phar, $level, $input, $regex, $invregex, SplFileInfo $stub = NULL, $compress = NULL, $noloader = false) - { - if ($input && is_file($input) && !is_dir($input)) { - return self::phar_add_file($phar, $level, $input, $input, $compress); - } - $dir = new RecursiveDirectoryIterator($input); - $dir = new RecursiveIteratorIterator($dir); - - if (isset($regex)) { - $dir = new RegexIterator($dir, $regex); - } - - if (isset($invregex)) { - $dir = new InvertedRegexIterator($dir, $invregex); - } - - try { - foreach($dir as $file) { - if ((empty($stub) || $file->getRealPath() != $stub->getRealPath()) && !is_dir($file)) { - self::phar_add_file($phar, $level, $dir->getSubPathName(), $file, $compress, $noloader); - } - } - } catch(Exception $e) { - self::error("Unable to complete operation on file '$file'\n" . $e->getMessage() . "\n"); - } - } - // }}} - // {{{ static function phar_add_file - /** - * Add a phar file - * - * This function adds a file to a phar archive. - * - * @param Phar $phar The phar object - * @param string $level The level of the file. - * @param string $entry The entry point - * @param string $file The file to add to the archive - * @param string $compress The compression scheme for the file. - * @param boolean $noloader Whether to prevent adding the loader - */ - static function phar_add_file(Phar $phar, $level, $entry, $file, $compress, $noloader = false) - { - $entry = str_replace('//', '/', $entry); - while($level-- > 0 && ($p = strpos($entry, '/')) !== false) { - $entry = substr($entry, $p+1); - } - - if ($noloader && $entry == 'phar.inc') { - return; - } - - echo "$entry\n"; - - $phar[$entry] = file_get_contents($file); - switch($compress) { - case 'gz': - case 'gzip': - $phar[$entry]->compress(Phar::GZ); - break; - case 'bz2': - case 'bzip2': - $phar[$entry]->compress(Phar::BZ2); - break; - case '0': - $phar[$entry]->decompress(); - break; - default: - break; - } - } - // }}} - // {{{ public function phar_dir_echo - /** - * Echo directory - * - * @param string $pn - * @param unknown_type $f - */ - public function phar_dir_echo($pn, $f) - { - echo "$f\n"; - } - // }}} - // {{{ public function phar_dir_operation - /** - * Directory operations - * - * Phar directory operations. - * - * @param RecursiveIteratorIterator $dir The recursiveIteratorIterator object. - * @param string $func Function to call on the iterations - * @param array $args Function arguments. - */ - public function phar_dir_operation(RecursiveIteratorIterator $dir, $func, array $args = array()) - { - $regex = $this->args['i']['val']; - $invregex= $this->args['x']['val']; - - if (isset($regex)) { - $dir = new RegexIterator($dir, $regex); - } - - if (isset($invregex)) { - $dir = new InvertedRegexIterator($dir, $invregex); - } - - $any = false; - foreach($dir as $pn => $f) { - $any = true; - call_user_func($func, $pn, $f, $args); - } - return $any; - } - // {{{ static function cli_cmd_inf_list - /** - * Cli Command Info List - * - * @return string What inf does - */ - static function cli_cmd_inf_list() - { - return "List contents of a PHAR archive."; - } - // }}} - // {{{ static function cli_cmd_arg_list - /** - * Cli Command Argument List - * - * @return arguments list - */ - static function cli_cmd_arg_list() - { - return self::phar_args('Fix', 'pharurl'); - } - // }}} - // {{{ public function cli_cmd_run_list - /** - * Cli Command Run List - * - * @see $this->phar_dir_operation - */ - public function cli_cmd_run_list() - { - $this->phar_dir_operation( - new DirectoryTreeIterator( - $this->args['f']['val']), - array($this, 'phar_dir_echo') - ); - } - // }}} - // {{{ static function cli_command_inf_tree - /** - * Cli Command Inf Tree - * - * @return string The description of a directory tree for a Phar archive. - */ - static function cli_cmd_inf_tree() - { - return "Get a directory tree for a PHAR archive."; - } - // }}} - // {{{ static function cli_cmd_arg_tree - /** - * Cli Command Argument Tree - * - * @return string Arguments in URL format. - */ - static function cli_cmd_arg_tree() - { - return self::phar_args('Fix', 'pharurl'); - } - // }}} - // {{{ public function cli_cmd_run_tree - /** - * Cli Command Run Tree - * - * Set the phar_dir_operation with a directorygraphiterator. - * - * @see DirectoryGraphIterator - * @see $this->phar_dir_operation - * - */ - public function cli_cmd_run_tree() - { - $a = $this->phar_dir_operation( - new DirectoryGraphIterator( - $this->args['f']['val']), - array($this, 'phar_dir_echo') - ); - if (!$a) { - echo "|-<root directory>\n"; - } - } - // }}} - // {{{ cli_cmd_inf_extract - /** - * Cli Command Inf Extract - * - * @return string The description of the command extra to a directory. - */ - static function cli_cmd_inf_extract() - { - return "Extract a PHAR package to a directory."; - } - // }}} - // {{{ static function cli_cmd_arg_extract - /** - * Cli Command Arguments Extract - * - * The arguments for the extract function. - * - * @return array The arguments for the extraction. - */ - static function cli_cmd_arg_extract() - { - $args = self::phar_args('Fix', 'phar'); - - $args[''] = array( - 'type' => 'dir', - 'val' => '.', - 'inf' => ' Directory to extract to (defaults to \'.\').', - ); - - return $args; - } - // }}} - // {{{ public function cli_cmd_run_extract - /** - * Run Extract - * - * Run the extraction of a phar Archive. - * - * @see $this->phar_dir_operation - */ - public function cli_cmd_run_extract() - { - $dir = $this->args['']['val']; - - if (is_array($dir)) { - if (count($dir) != 1) { - self::error("Only one target directory allowed.\n"); - } else { - $dir = $dir[0]; - } - } - - $phar = $this->args['f']['val']; - $base = $phar->getPathname(); - $bend = strpos($base, '.phar'); - $bend = strpos($base, '/', $bend); - $base = substr($base, 0, $bend + 1); - $blen = strlen($base); - - $this->phar_dir_operation( - new RecursiveIteratorIterator($phar), - array($this, 'phar_dir_extract'), - array($blen, $dir) - ); - } - // }}} - // {{{ public function phar_dir_extract - /** - * Extract to a directory - * - * This function will extract the content of a Phar - * to a directory and create new files and directories - * depending on the permissions on that folder. - * - * @param string $pn - * @param string $f The file name - * @param array $args The directory and Blen information - */ - public function phar_dir_extract($pn, $f, $args) - { - $blen = $args[0]; - $dir = $args[1]; - $sub = substr($pn, $blen); - $target = $dir . '/' . $sub; - - if (!file_exists(dirname($target))) { - @mkdir(dirname($target), 0777, true); - } - if (!file_exists(dirname($target))) { - self::error("Operation could not be completed\n"); - } - - echo "$sub"; - - if (!@copy($f, $target)) { - echo " ...error\n"; - } else { - echo " ...ok\n"; - } - } - // }}} - // {{{ static function cli_cmd_inf_delete - /** - * Delete an entry from a phar information. - * - * @return string The information - */ - static function cli_cmd_inf_delete() - { - return 'Delete entry from a PHAR archive'; - } - // }}} - // {{{ static function cli_cmd_arg_delete - /** - * The cli command argument for deleting. - * - * @return array information about the arguments to use. - */ - static function cli_cmd_arg_delete() - { - return self::phar_args('FE', 'phar'); - } - // }}} - // {{{ public function cli_cmd_run_delete - /** - * Deleting execution - * - * Execute the deleting of the file from the phar archive. - */ - public function cli_cmd_run_delete() - { - $phar = $this->args['f']['val']; - $entry = $this->args['e']['val']; - - $phar->startBuffering(); - unset($phar[$entry]); - $phar->stopBuffering(); - } - // }}} - // {{{ static function cli_cmd_inf_add - /** - * Client comment add file information - * - * @return string The description of the feature - */ - static function cli_cmd_inf_add() - { - return "Add entries to a PHAR package."; - } - // }}} - // {{{ static function cli_cmd_arg_add - /** - * Add a file arguments - */ - static function cli_cmd_arg_add() - { - $args = self::phar_args('acFilx', 'phar'); - $args[''] = array( - 'type' => 'any', - 'val' => NULL, - 'required' => 1, - 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', - ); - return $args; - } - // }}} - // {{{ public functio cli_cmd_run_add - /** - * Add a file - * - * Run the action of adding a file to - * a phar archive. - */ - public function cli_cmd_run_add() - { - $compress= $this->args['c']['val']; - $phar = $this->args['f']['val']; - $regex = $this->args['i']['val']; - $level = $this->args['l']['val']; - $invregex= $this->args['x']['val']; - $input = $this->args['']['val']; - - $phar->startBuffering(); - - if (!is_array($input)) { - $this->phar_add($phar, $level, $input, $regex, $invregex, NULL, $compress); - } else { - foreach($input as $i) { - $this->phar_add($phar, $level, $i, $regex, $invregex, NULL, $compress); - } - } - $phar->stopBuffering(); - exit(0); - } - // }}} - // {{{ public function cli_cmd_inf_stub_set - /** - * Set the stup of a phar file. - * - * @return string The stub set description. - */ - public function cli_cmd_inf_stub_set() - { - return "Set the stub of a PHAR file. " . - "If no input file is specified as stub then stdin is being used."; - } - // }}} - // {{{ public function cli_cmd_arg_stub_set - /** - * Set the argument stub - * - * @return string arguments for a stub - */ - public function cli_cmd_arg_stub_set() - { - $args = self::phar_args('bFps', 'phar'); - $args['s']['val'] = 'php://stdin'; - return $args; - } - // }}} - // {{{ public function cli_cmd_run_stub_set - /** - * Cli Command run stub set - * - * @see $phar->setStub() - */ - public function cli_cmd_run_stub_set() - { - $hashbang = $this->args['b']['val']; - $phar = $this->args['f']['val']; - $stub = $this->args['s']['val']; - $loader = $this->args['p']['val']; - - $this->phar_set_stub_begin($phar, $stub, $loader, $hashbang); - $this->phar_set_stub_end($phar, $stub, $loader); - } - // }}} - // {{{ public function cli_cmd_inf_stub_get - /** - * Get the command stub infos. - * - * @return string a description of the stub of a Phar file. - */ - public function cli_cmd_inf_stub_get() - { - return "Get the stub of a PHAR file. " . - "If no output file is specified as stub then stdout is being used."; - } - // }}} - // {{{ public function cli_cmd_arg_stub_get - /** - * Get the argument stub - * - * @return array $args The arguments passed to the stub. - */ - public function cli_cmd_arg_stub_get() - { - $args = self::phar_args('Fs', 'phar'); - $args['s']['val'] = 'php://stdin'; - return $args; - } - // }}} - // {{{ public function cli_cmd_run_stub_get - /** - * Cli Command Run Stub - * - * Get arguments and store them into a stub. - * - * @param arguments $args - * @see $this->args - */ - public function cli_cmd_run_stub_get($args) - { - $phar = $this->args['f']['val']; - $stub = $this->args['s']['val']; - - file_put_contents($stub, $phar->getStub()); - } - // }}} - // {{{ public function cli_cmd_inf_compress - /** - * Cli Command Inf Compress - * - * Cli Command compress information - * - * @return string A description of the command. - */ - public function cli_cmd_inf_compress() - { - return "Compress or uncompress all files or a selected entry."; - } - // }}} - // {{{ public function cli_cmd_arg_cmpress - /** - * Cli Command Arg Compress - * - * @return array The arguments for compress - */ - public function cli_cmd_arg_compress() - { - return self::phar_args('FCe', 'phar'); - } - // }}} - // {{{ public function cli_cmd_run_compress - /** - * Cli Command Run Compress - * - * @see $this->args - */ - public function cli_cmd_run_compress() - { - $phar = $this->args['f']['val']; - $entry = $this->args['e']['val']; - - switch($this->args['c']['val']) { - case 'gz': - case 'gzip': - if (isset($entry)) { - $phar[$entry]->compress(Phar::GZ); - } else { - $phar->compressFiles(Phar::GZ); - } - break; - case 'bz2': - case 'bzip2': - if (isset($entry)) { - $phar[$entry]->compress(Phar::BZ2); - } else { - $phar->compressFiles(Phar::BZ2); - } - break; - default: - if (isset($entry)) { - $phar[$entry]->decompress(); - } else { - $phar->decompressFiles(); - } - break; - } - } - // }}} - // {{{ public function cli_cmd_inf_sign - /** - * Cli Command Info Signature - * - * @return string A description of the signature arguments. - */ - public function cli_cmd_inf_sign() - { - return "Set signature hash algorithm."; - } - // }}} - // {{{ public function cli_cmd_arg_sign - /** - * Cli Command Argument Sign - * - * @return array Arguments for Signature - */ - public function cli_cmd_arg_sign() - { - return self::phar_args('FHy', 'phar'); - } - // }}} - // {{{ public function cli_cmd_run_sign - /** - * Cli Command Run Signature - * - * @see $phar->setSignaturealgorithm - */ - public function cli_cmd_run_sign() - { - $phar = $this->args['f']['val']; - $hash = $this->args['h']['val']; - $privkey = $this->args['y']['val']; - - $hash = self::phar_check_hash($hash, $privkey); - - $phar->setSignatureAlgorithm($hash, $privkey); - } - // }}} - // {{{ public function cli_cmd_inf_meta_set - /** - * Cli Command Inf Meta Set - * - * @return string A description - */ - public function cli_cmd_inf_meta_set() - { - return "Set meta data of a PHAR entry or a PHAR package using serialized input. " . - "If no input file is specified for meta data then stdin is being used." . - "You can also specify a particular index using -k. In that case the metadata is " . - "expected to be an array and the value of the given index is being set. If " . - "the metadata is not present or empty a new array will be created. If the " . - "metadata is present and a flat value then the return value is 1. Also using -k " . - "the input is been taken directly rather then being serialized."; - } - // }}} - // {{{ public function cli_cmd_arg_meta_set - /** - * Cli Command Argument Meta Set - * - * @return array The arguments for meta set - */ - public function cli_cmd_arg_meta_set() - { - return self::phar_args('FekM', 'phar'); - } - // }}} - // {{{ public function cli_cmd_run_met_set - /** - * Cli Command Run Metaset - * - * @see $phar->startBuffering - * @see $phar->setMetadata - * @see $phar->stopBuffering - */ - public function cli_cmd_run_meta_set() - { - $phar = $this->args['f']['val']; - $entry = $this->args['e']['val']; - $index = $this->args['k']['val']; - $meta = $this->args['m']['val']; - - $phar->startBuffering(); - - if (isset($index)) { - if (isset($entry)) { - if ($phar[$entry]->hasMetadata()) { - $old = $phar[$entry]->getMetadata(); - } else { - $old = array(); - } - } else { - if ($phar->hasMetadata()) { - $old = $phar->getMetadata(); - } else { - $old = array(); - } - } - - if (!is_array($old)) { - self::error('Metadata is a flat value while an index operation was issued.'); - } - - $old[$index] = $meta; - $meta = $old; - } else { - $meta = unserialize($meta); - } - - if (isset($entry)) { - $phar[$entry]->setMetadata($meta); - } else { - $phar->setMetadata($meta); - } - $phar->stopBuffering(); - } - // }}} - // {{{ public function cli_cmd_inf_met_get - /** - * Cli Command Inf Metaget - * - * @return string A description of the metaget arguments - */ - public function cli_cmd_inf_meta_get() - { - return "Get meta information of a PHAR entry or a PHAR package in serialized from. " . - "If no output file is specified for meta data then stdout is being used.\n" . - "You can also specify a particular index using -k. In that case the metadata is " . - "expected to be an array and the value of the given index is returned using echo " . - "rather than using serialize. If that index does not exist or no meta data is " . - "present then the return value is 1."; - } - // }}} - // {{{ public function cli_cmd_arg_meta_get - /** - * Cli Command arg metaget - * - * @return array The arguments for meta get. - */ - public function cli_cmd_arg_meta_get() - { - return self::phar_args('Fek', 'phar'); - } - // }}} - // {{{ public function cli_cmd_run_meta_get - /** - * Cli Command Run Metaget - * - * @see $this->args - * @see $phar[$x]->hasMetadata() - * @see $phar->getMetadata() - */ - public function cli_cmd_run_meta_get() - { - $phar = $this->args['f']['val']; - $entry = $this->args['e']['val']; - $index = $this->args['k']['val']; - - if (isset($entry)) { - if (!$phar[$entry]->hasMetadata()) { - echo "No Metadata\n"; - exit(1); - } - echo serialize($phar[$entry]->getMetadata()); - } else { - if (!$phar->hasMetadata()) { - echo "No Metadata\n"; - exit(1); - } - $meta = $phar->getMetadata(); - } - - if (isset($index)) { - if (isset($index)) { - if (isset($meta[$index])) { - echo $meta[$index]; - exit(0); - } else { - echo "No Metadata\n"; - exit(1); - } - } else { - echo serialize($meta); - } - } - } - // }}} - // {{{ public function cli_cmd_inf_meta_del - /** - * Cli Command Inf Metadel - * - * @return string A description of the metadel function - */ - public function cli_cmd_inf_meta_del() - { - return "Delete meta information of a PHAR entry or a PHAR package.\n" . - "If -k is given then the metadata is expected to be an array " . - "and the given index is being deleted.\n" . - "If something was deleted the return value is 0 otherwise it is 1."; - } - // }}} - // {{{ public function cli_cmd_arg_meta_del - /** - * CliC ommand Arg Metadelete - * - * @return array The arguments for metadel - */ - public function cli_cmd_arg_meta_del() - { - return self::phar_args('Fek', 'phar'); - } - // }}} - // {{{ public function cli_cmd_run_meta_del - /** - * Cli Command Run MetaDel - * - * @see $phar[$x]->delMetadata() - * @see $phar->delMetadata() - */ - public function cli_cmd_run_meta_del() - { - $phar = $this->args['f']['val']; - $entry = $this->args['e']['val']; - $index = $this->args['k']['val']; - - if (isset($entry)) { - if (isset($index)) { - if (!$phar[$entry]->hasMetadata()) { - exit(1); - } - $meta = $phar[$entry]->getMetadata(); - - // @todo add error message here. - if (!is_array($meta)) { - exit(1); - } - - unset($meta[$index]); - $phar[$entry]->setMetadata($meta); - } else { - exit($phar[$entry]->delMetadata() ? 0 : 1); - } - } else { - if (isset($index)) { - if (!$phar->hasMetadata()) { - exit(1); - } - - $meta = $phar->getMetadata(); - - // @todo Add error message - if (!is_array($meta)) { - exit(1); - } - - unset($meta[$index]); - $phar->setMetadata($meta); - } else { - exit($phar->delMetadata() ? 0 : 1); - } - } - } - // }}} - // {{{ public function cli_cmd_inf_info - /** - * CLi Command Inf Info - * - * @return string A description about the info commands. - */ - public function cli_cmd_inf_info() - { - return "Get information about a PHAR package.\n" . - "By using -k it is possible to return a single value."; - } - // }}} - // {{{ public function cli_cmd_arg_info - /** - * Cli Command Arg Infos - * - * @return array The arguments for info command. - */ - public function cli_cmd_arg_info() - { - return self::phar_args('Fk', 'phar'); - } - // }}} - // {{{ public function cli_cmd_run_info - /** - * Cli Command Run Info - * - * @param args $args - */ - public function cli_cmd_run_info() - { - $phar = $this->args['f']['val']; - $index = $this->args['k']['val']; - - $hash = $phar->getSignature(); - $infos = array(); - - if ($phar->getAlias()) { - $infos['Alias'] = $phar->getAlias(); - } - - if (!$hash) { - $infos['Hash-type'] = 'NONE'; - } else { - $infos['Hash-type'] = $hash['hash_type']; - $infos['Hash'] = $hash['hash']; - } - - $csize = 0; - $usize = 0; - $count = 0; - $ccount = 0; - $ucount = 0; - $mcount = 0; - $compalg = array('GZ'=>0, 'BZ2'=>0); - - foreach(new RecursiveIteratorIterator($phar) as $ent) { - $count++; - if ($ent->isCompressed()) { - $ccount++; - $csize += $ent->getCompressedSize(); - if ($ent->isCompressed(Phar::GZ)) { - $compalg['GZ']++; - } elseif ($ent->isCompressed(Phar::BZ2)) { - $compalg['BZ2']++; - } - } else { - $ucount++; - $csize += $ent->getSize(); - } - - $usize += $ent->getSize(); - - if ($ent->hasMetadata()) { - $mcount++; - } - } - - $infos['Entries'] = $count; - $infos['Uncompressed-files'] = $ucount; - $infos['Compressed-files'] = $ccount; - $infos['Compressed-gz'] = $compalg['GZ']; - $infos['Compressed-bz2'] = $compalg['BZ2']; - $infos['Uncompressed-size'] = $usize; - $infos['Compressed-size'] = $csize; - $infos['Compression-ratio'] = sprintf('%.3g%%', $usize ? ($csize * 100) / $usize : 100); - $infos['Metadata-global'] = $phar->hasMetadata() * 1; - $infos['Metadata-files'] = $mcount; - $infos['Stub-size'] = strlen($phar->getStub()); - - if (isset($index)) { - if (!isset($infos[$index])) { - self::error("Requested value does not exist.\n"); - } - - echo $infos[$index]; - exit(0); - } - - $l = 0; - foreach($infos as $which => $val) { - $l = max(strlen($which), $l); - } - - foreach($infos as $which => $val) { - echo $which . ':' . str_repeat(' ', $l + 1 - strlen($which)) . $val . "\n"; - } - } - // }}} - // {{{ public function cli_cmd_inf_version - /** - * CLi Command Inf Version - * - * @return string A description about the info commands. - */ - public function cli_cmd_inf_version() - { - return "Get information about the PHAR environment and the tool version."; - } - // }}} - // {{{ public function cli_cmd_arg_version - /** - * Cli Command Arg Version - * - * @return array The arguments for version command. - */ - public function cli_cmd_arg_version() - { - return self::phar_args('', NULL); - } - // }}} - // {{{ public function cli_cmd_run_info - /** - * Cli Command Run Info - * - * @param args $args - */ - public function cli_cmd_run_version() - { - $use_ext = extension_loaded('phar'); - $version = array( - 'PHP Version' => phpversion(), - 'phar.phar version' => '$Id$', - 'Phar EXT version' => $use_ext ? phpversion('phar') : 'Not available', - 'Phar API version' => Phar::apiVersion(), - 'Phar-based phar archives' => true, - 'Tar-based phar archives' => $use_ext, - 'ZIP-based phar archives' => $use_ext, - 'gzip compression' => extension_loaded('zlib'), - 'bzip2 compression' => extension_loaded('bz2'), - 'supported signatures' => $use_ext ? join(', ', Phar::getSupportedSignatures()) : '', - ); - $klen = 0; - foreach($version as $k => $v) - { - $klen = max($klen, strlen($k)); - } - ++$klen; - foreach($version as $k => $v) { - if (is_bool($v)) { - $v = $v ? 'enabled' : 'disabled'; - } - printf("%-${klen}s %s\n", $k.':', $v); - } - } - // }}} + // {{{ public function cli_get_SP2 + public function cli_get_SP2($l1, $arg_inf) + { + return str_repeat(' ', $l1 + 2 + 4 + 9); + } + // }}} + // {{{ public function cli_get_SP3 + /** + * Cli Get SP3 + * + * @param string $l1 Eleven + * @param string $l2 Twelve + * @param string $arg_inf + * @return string The repeated string. + */ + function cli_get_SP3($l1, $l2, $arg_inf) + { + return str_repeat(' ', $l1 + 2 + 4 + 9 + 2 + $l2 + 2); + } + // }}} + // {{{ static function phar_args + /** + * Phar arguments + * + * This function contains all the phar commands + * + * @param string $which Which argument is chosen. + * @param string $phartype The type of phar, specific file to work on + * @return unknown + */ + static function phar_args($which, $phartype) + { + $phar_args = array( + 'a' => array( + 'typ' => 'alias', + 'val' => NULL, + 'inf' => '<alias> Provide an alias name for the phar file.' + ), + 'b' => array( + 'typ' => 'any', + 'val' => NULL, + 'inf' => '<bang> Hash-bang line to start the archive (e.g. #!/usr/bin/php). The hash ' + .' mark itself \'#!\' and the newline character are optional.' + ), + 'c' => array( + 'typ' => 'compalg', + 'val' => NULL, + 'inf' => '<algo> Compression algorithm.', + 'select' => array( + '0' => 'No compression', + 'none' => 'No compression', + 'auto' => 'Automatically select compression algorithm' + ) + ), + 'e' => array( + 'typ' => 'entry', + 'val' => NULL, + 'inf' => '<entry> Name of entry to work on (must include PHAR internal directory name if any).' + ), + 'f' => array( + 'typ' => $phartype, + 'val' => NULL, + 'inf' => '<file> Specifies the phar file to work on.' + ), + 'h' => array( + 'typ' => 'select', + 'val' => NULL, + 'inf' => '<method> Selects the hash algorithm.', + 'select' => array('md5' => 'MD5','sha1' => 'SHA1') + ), + 'i' => array( + 'typ' => 'regex', + 'val' => NULL, + 'inf' => '<regex> Specifies a regular expression for input files.' + ), + 'k' => array( + 'typ' => 'any', + 'val' => NULL, + 'inf' => '<index> Subscription index to work on.', + ), + 'l' => array( + 'typ' => 'int', + 'val' => 0, + 'inf' => '<level> Number of preceding subdirectories to strip from file entries', + ), + 'm' => array( + 'typ' => 'any', + 'val' => NULL, + 'inf' => '<meta> Meta data to store with entry (serialized php data).' + ), + 'p' => array( + 'typ' => 'loader', + 'val' => NULL, + 'inf' => '<loader> Location of PHP_Archive class file (pear list-files PHP_Archive).' + .'You can use \'0\' or \'1\' to locate it automatically using the mentioned ' + .'pear command. When using \'0\' the command does not error out when the ' + .'class file cannot be located. This switch also adds some code around the ' + .'stub so that class PHP_Archive gets registered as phar:// stream wrapper ' + .'if necessary. And finally this switch will add the file phar.inc from ' + .'this package and load it to ensure class Phar is present.' + , + ), + 's' => array( + 'typ' => 'file', + 'val' => NULL, + 'inf' => '<stub> Select the stub file.' + ), + 'x' => array( + 'typ' => 'regex', + 'val' => NULL, + 'inf' => '<regex> Regular expression for input files to exclude.' + ), + 'y' => array( + 'typ' => 'privkey', + 'val' => NULL, + 'inf' => '<key> Private key for OpenSSL signing.', + ), + ); + + if (extension_loaded('zlib')) { + $phar_args['c']['select']['gz'] = 'GZip compression'; + $phar_args['c']['select']['gzip'] = 'GZip compression'; + } + + if (extension_loaded('bz2')) { + $phar_args['c']['select']['bz2'] = 'BZip2 compression'; + $phar_args['c']['select']['bzip2'] = 'BZip2 compression'; + } + + $hash_avail = Phar::getSupportedSignatures(); + $hash_optional = array('SHA-256' => 'SHA256', + 'SHA-512' => 'SHA512', + 'OpenSSL' => 'OpenSSL'); + if (!in_array('OpenSSL', $hash_avail)) { + unset($phar_args['y']); + } + + foreach($hash_optional as $key => $name) { + if (in_array($key, $hash_avail)) { + $phar_args['h']['select'][strtolower($name)] = $name; + } + } + + $args = array(); + + foreach($phar_args as $lkey => $cfg) { + $ukey = strtoupper($lkey); + $required = strpos($which, $ukey) !== false; + $optional = strpos($which, $lkey) !== false; + + if ($required || $optional) { + $args[$lkey] = $cfg; + $args[$lkey]['required'] = $required; + } + } + return $args; + } + // }}} + // {{{ static function strEndsWith + /** + * String Ends With + * + * Whether a string ends with another needle. + * + * @param string $haystack The haystack + * @param string $needle The needle. + * @return mixed false if doesn't end with anything, the string + * substr'ed if the string ends with the needle. + */ + static function strEndsWith($haystack, $needle) + { + return substr($haystack, -strlen($needle)) == $needle; + } + // }}} + // {{{ static function cli_arg_typ_loader + /** + * Argument type loader + * + * @param string $arg Either 'auto', 'optional' or an filename that + * contains class PHP_Archive + * @param string $cfg Configuration to pass to a new file + * @param string $key The key + * @return string $arg The argument. + */ + static function cli_arg_typ_loader($arg, $cfg, $key) + { + if (($arg == '0' || $arg == '1') && !file_exists($arg) && substr(PHP_OS, 0, 3) != 'WIN') { + $found = NULL; + $apiver = false; + $path = explode(PATH_SEPARATOR, $_ENV['PATH']); + $pear = false; + foreach ($path as $component) { + if (file_exists($component . DIRECTORY_SEPARATOR . 'pear') + && is_executable($component . DIRECTORY_SEPARATOR . 'pear')) { + $pear = true; + break; + } + } + if ($pear) { + $apiver = `pear -q info PHP_Archive 2>/dev/null|grep 'API Version'`; + $apiver = trim(substr($apiver, strlen('API Version'))); + } + if ($apiver) { + self::notice("PEAR package PHP_Archive: API Version: $apiver.\n"); + $files = explode("\n", `pear list-files PHP_Archive`); + $phpdir = `pear config-get php_dir 2>/dev/null`; + $phpdir = trim($phpdir); + self::notice("PEAR package PHP_Archive: $phpdir.\n"); + if (is_dir($phpdir)) { + foreach($files as $ent) { + $matches = NULL; + if (preg_match(",^php[ \t]+([^ \t].*[\\\\/]PHP[\\\\/]Archive\.php)$,", $ent, $matches)) { + $sub = $matches[1]; + if (strpos($sub, $phpdir) !== 0) { + $found = NULL; + break; + } + $found = $sub; + break; + } + } + } else { + self::notice("PEAR package PHP_Archive: corrupt or inaccessible base dir: $php_dir.\n"); + } + } + if (isset($found)) { + self::notice("PEAR package PHP_Archive: $found.\n"); + } else { + $msg = "PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.\n"; + if ($arg == '0') { + self::notice($msg); + } else { + self::error($msg); + } + } + $arg = $found; + } + return self::cli_arg_typ_file($arg); + } + // }}} + // {{{ static function cli_arg_typ_pharnew + /** + * Argument type new phar + * + * @param string $arg The new phar component. + * @param string $cfg Configuration to pass to a new file + * @param string $key The key + * @return string $arg The new argument file. + */ + static function cli_arg_typ_pharnew($arg, $cfg, $key) + { + $arg = self::cli_arg_typ_filenew($arg, $cfg, $key); + if (!Phar::isValidPharFilename($arg)) { + self::error("Phar files must have file extension '.phar', '.phar.php', '.phar.bz2' or '.phar.gz'.\n"); + } + return $arg; + } + // }}} + // {{{ static function cli_arg_typ_pharfile + /** + * Argument type existing Phar file + * + * Return filename of an existing Phar. + * + * @param string $arg The file in the phar to open. + * @param string $cfg The configuration information + * @param string $key The key information. + * @return string $pharfile The name of the loaded Phar file. + * @note The Phar will be loaded + */ + static function cli_arg_typ_pharfile($arg, $cfg, $key) + { + try { + $pharfile = self::cli_arg_typ_file($arg, $cfg, $key); + + if (!Phar::loadPhar($pharfile)) { + self::error("Unable to open phar '$arg'\n"); + } + + return $pharfile; + } catch(Exception $e) { + self::error("Exception while opening phar '$arg':\n" . $e->getMessage() . "\n"); + } + } + // }}} + // {{{ static function cli_arg_typ_pharurl + /** + * Argument type Phar url-like + * + * Check the argument as cli_arg_Typ_phar and return its name prefixed + * with phar:// + * + * Ex: + * <code> + * $arg = 'pharchive.phar/file.php'; + * cli_arg_typ_pharurl($arg) + * </code> + * + * @param string $arg The url-like phar archive to retrieve. + * @return string The phar file-archive. + */ + static function cli_arg_typ_pharurl($arg, $cfg, $key) + { + return 'phar://' . self::cli_arg_typ_pharfile($arg, $cfg, $key); + } + // }}} + // {{{ static function cli_arg_typ_phar + /** + * Cli argument type phar + * + * @param string $arg The phar archive to use. + * @return object new Phar of the passed argument. + */ + static function cli_arg_typ_phar($arg, $cfg, $key) + { + try { + return new Phar(self::cli_arg_typ_pharfile($arg, $cfg, $key)); + } catch(Exception $e) { + self::error("Exception while opening phar '$argv':\n" . $e->getMessage() . "\n"); + } + } + // }}} + // {{{ static function cli_arg_typ_entry + /** + * Argument type Entry name + * + * @param string $arg The argument (the entry) + * @return string $arg The entry itself. + */ + static function cli_arg_typ_entry($arg, $cfg, $key) + { + // no further check atm, maybe check for no '/' at beginning + return $arg; + } + // }}} + // {{{ static function cli_arg_typ_compalg + /** + * Argument type compression algorithm + * + * @param string $arg The phar selection + * @param string $cfg The config option. + * @param string $key The key information. + * @return string $arg The selected algorithm + */ + static function cli_arg_typ_compalg($arg, $cfg, $key) + { + $arg = self::cli_arg_typ_select($arg, $cfg, $key); + + switch($arg) { + case 'auto': + if (extension_loaded('zlib')) { + $arg = 'gz'; + } elseif (extension_loaded('bz2')) { + $arg = 'bz2'; + } else { + $arg = '0'; + } + break; + } + return $arg; + } + // }}} + // {{{ static function cli_arg_typ_privkey + /** + * Argument type private key (for OpenSSL signing) + * + * @param string $arg The phar selection + * @param string $cfg The config option. + * @param string $key The key information. + * @return string $arg The private key. + */ + static function cli_arg_typ_privkey($arg, $cfg, $key) + { + $arg = self::cli_arg_typ_filecont($arg, $cfg, $key); + + $hash_avail = Phar::getSupportedSignatures(); + if ($arg && !in_array('OpenSSL', $hash_avail)) + { + self::error("Cannot specify private key without OpenSSL support.\n"); + } + return $arg; + } + // }}} + // {{{ static function phar_check_hash + /** + * Check whether hash method is valid. + * + * @return Hash constant to be used. + */ + function phar_check_hash($hash, $privkey) + { + switch($hash) { + case 'md5': + return Phar::MD5; + case 'sha1': + return Phar::SHA1; + case 'sha256': + return Phar::SHA256; + case 'sha512': + return Phar::SHA512; + case 'openssl': + if (!$privkey) { + self::error("Cannot use OpenSSL signing without key.\n"); + } + return Phar::OPENSSL; + } + } + // }}} + // {{{ static function cli_cmd_inf_pack + /** + * Information pack + * + * @return string A description about packing files into a Phar archive. + */ + static function cli_cmd_inf_pack() + { + return "Pack files into a PHAR archive.\n" . + "When using -s <stub>, then the stub file is being " . + "excluded from the list of input files/dirs." . + "To create an archive that contains PEAR class PHP_Archive " . + "then point -p argument to PHP/Archive.php.\n"; + } + // }}} + // {{{ static function cli_cmd_arg_pack + /** + * Pack a new phar infos + * + * @return array $args The arguments for a new Phar archive. + */ + static function cli_cmd_arg_pack() + { + $args = self::phar_args('abcFhilpsxy', 'pharnew'); + + $args[''] = array( + 'typ' => 'any', + 'val' => NULL, + 'required' => 1, + 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', + ); + + return $args; + } + // }}} + // {{{ function phar_set_stub_begin + /** + * Set the stub + */ + public function phar_set_stub_begin(Phar $phar, $stub, $loader = NULL, $hashbang = NULL) + { + if (isset($stub)) { + $c = file_get_contents($stub); + + if (substr($c, 0, 2) == '#!') { + if (strpos($c, "\n") !== false) { + if (!isset($hashbang)) { + $hashbang = substr($c, 0, strpos($c, "\n") + 1); + } + $c = substr($c, strpos($c, "\n") + 1); + } else { + if (!isset($hashbang)) { + $hashbang = $c; + } + $c = NULL; + } + } + + if (isset($hashbang)) { + if (substr($hashbang, 0, 2) != '#!') { + $hashbang = '#!' . $hashbang; + } + if (substr($hashbang, -1) != "\n") { + $hashbang .= "\n"; + } + } else { + $hashbang = ""; + } + + if (isset($loader)) { + $s = "<?php if (!class_exists('PHP_Archive')) {\n?>"; + if (is_file($loader)) { + $s .= file_get_contents($loader); + } + $s .= "<?php\n"; + $s .= "}\n"; + $s .= "if (!in_array('phar', stream_get_wrappers())) {\n"; + $s .= "\tstream_wrapper_register('phar', 'PHP_Archive');\n"; + $s .= "}\n"; + $s .= "if (!class_exists('Phar',0)) {\n"; + $s .= "\tinclude 'phar://'.__FILE__.'/phar.inc';\n"; + $s .= "}\n"; + $s .= '?>'; + $s .= $c; + + $phar->setStub($hashbang . $s); + } else { + $phar->setStub($hashbang . $c); + } + return new SplFileInfo($stub); + } + return NULL; + } + // }}} + // {{{ function phar_set_stub_end + /** + * Set stub end + */ + public function phar_set_stub_end(Phar $phar, $stub, $loader = NULL) + { + if (isset($stub) && isset($loader)) { + if (substr(__FILE__, -15) == 'pharcommand.inc') { + self::phar_add_file($phar, 0, 'phar.inc', 'phar://'.__FILE__.'/phar.inc', NULL); + } else { + self::phar_add_file($phar, 0, 'phar.inc', dirname(__FILE__).'/phar/phar.inc', NULL); + } + } + } + // }}} + // {{{ function cli_cmd_run_pack + /** + * Pack a new Phar + * + * This function will try to pack a new Phar archive. + * + * @see Exit to make sure that we are done. + */ + public function cli_cmd_run_pack() + { + if (ini_get('phar.readonly')) { + self::error("Creating phar files is disabled by ini setting 'phar.readonly'.\n"); + } + + if (!Phar::canWrite()) { + self::error("Creating phar files is disabled, Phar::canWrite() returned false.\n"); + } + + $alias = $this->args['a']['val']; + $hashbang = $this->args['b']['val']; + $archive = $this->args['f']['val']; + $hash = $this->args['h']['val']; + $privkey = $this->args['y']['val'] ?? null; + $regex = $this->args['i']['val']; + $level = $this->args['l']['val']; + $loader = $this->args['p']['val']; + $stub = $this->args['s']['val']; + $invregex = $this->args['x']['val']; + $input = $this->args['']['val']; + + $hash = self::phar_check_hash($hash, $privkey); + + $phar = new Phar($archive, 0, $alias); + + $phar->startBuffering(); + + $stub = $this->phar_set_stub_begin($phar, $stub, $loader, $hashbang); + + if (!is_array($input)) { + $this->phar_add($phar, $level, $input, $regex, $invregex, $stub, NULL, isset($loader)); + } else { + foreach($input as $i) { + $this->phar_add($phar, $level, $i, $regex, $invregex, $stub, NULL, isset($loader)); + } + } + + $this->phar_set_stub_end($phar, $stub, $loader); + + switch($this->args['c']['val']) { + case 'gz': + case 'gzip': + $phar->compressFiles(Phar::GZ); + break; + case 'bz2': + case 'bzip2': + $phar->compressFiles(Phar::BZ2); + break; + default: + $phar->decompressFiles(); + break; + } + + if ($hash) { + $phar->setSignatureAlgorithm($hash, $privkey); + } + + $phar->stopBuffering(); + exit(0); + } + // }}} + // {{{ static function phar_add + /** + * Add files to a phar archive. + * + * This function will take a directory and iterate through + * it and get the files to insert into the Phar archive. + * + * @param Phar $phar The phar object. + * @param string $input The input directory + * @param string $regex The regex used in RegexIterator. + * @param string $invregex The InvertedRegexIterator expression. + * @param SplFileInfo $stub Stub file object + * @param mixed $compress Compression algorithm or NULL + * @param boolean $noloader Whether to prevent adding the loader + */ + static function phar_add(Phar $phar, $level, $input, $regex, $invregex, SplFileInfo $stub = NULL, $compress = NULL, $noloader = false) + { + if ($input && is_file($input) && !is_dir($input)) { + return self::phar_add_file($phar, $level, $input, $input, $compress); + } + $dir = new RecursiveDirectoryIterator($input); + $dir = new RecursiveIteratorIterator($dir); + + if (isset($regex)) { + $dir = new RegexIterator($dir, $regex); + } + + if (isset($invregex)) { + $dir = new InvertedRegexIterator($dir, $invregex); + } + + try { + foreach($dir as $file) { + if ((empty($stub) || $file->getRealPath() != $stub->getRealPath()) && !is_dir($file)) { + self::phar_add_file($phar, $level, $dir->getSubPathName(), $file, $compress, $noloader); + } + } + } catch(Exception $e) { + self::error("Unable to complete operation on file '$file'\n" . $e->getMessage() . "\n"); + } + } + // }}} + // {{{ static function phar_add_file + /** + * Add a phar file + * + * This function adds a file to a phar archive. + * + * @param Phar $phar The phar object + * @param string $level The level of the file. + * @param string $entry The entry point + * @param string $file The file to add to the archive + * @param string $compress The compression scheme for the file. + * @param boolean $noloader Whether to prevent adding the loader + */ + static function phar_add_file(Phar $phar, $level, $entry, $file, $compress, $noloader = false) + { + $entry = str_replace('//', '/', $entry); + while($level-- > 0 && ($p = strpos($entry, '/')) !== false) { + $entry = substr($entry, $p+1); + } + + if ($noloader && $entry == 'phar.inc') { + return; + } + + echo "$entry\n"; + + $phar[$entry] = file_get_contents($file); + switch($compress) { + case 'gz': + case 'gzip': + $phar[$entry]->compress(Phar::GZ); + break; + case 'bz2': + case 'bzip2': + $phar[$entry]->compress(Phar::BZ2); + break; + case '0': + $phar[$entry]->decompress(); + break; + default: + break; + } + } + // }}} + // {{{ public function phar_dir_echo + /** + * Echo directory + * + * @param string $pn + * @param unknown_type $f + */ + public function phar_dir_echo($pn, $f) + { + echo "$f\n"; + } + // }}} + // {{{ public function phar_dir_operation + /** + * Directory operations + * + * Phar directory operations. + * + * @param RecursiveIteratorIterator $dir The recursiveIteratorIterator object. + * @param string $func Function to call on the iterations + * @param array $args Function arguments. + */ + public function phar_dir_operation(RecursiveIteratorIterator $dir, $func, array $args = array()) + { + $regex = $this->args['i']['val']; + $invregex= $this->args['x']['val']; + + if (isset($regex)) { + $dir = new RegexIterator($dir, $regex); + } + + if (isset($invregex)) { + $dir = new InvertedRegexIterator($dir, $invregex); + } + + $any = false; + foreach($dir as $pn => $f) { + $any = true; + call_user_func($func, $pn, $f, $args); + } + return $any; + } + // {{{ static function cli_cmd_inf_list + /** + * Cli Command Info List + * + * @return string What inf does + */ + static function cli_cmd_inf_list() + { + return "List contents of a PHAR archive."; + } + // }}} + // {{{ static function cli_cmd_arg_list + /** + * Cli Command Argument List + * + * @return arguments list + */ + static function cli_cmd_arg_list() + { + return self::phar_args('Fix', 'pharurl'); + } + // }}} + // {{{ public function cli_cmd_run_list + /** + * Cli Command Run List + * + * @see $this->phar_dir_operation + */ + public function cli_cmd_run_list() + { + $this->phar_dir_operation( + new DirectoryTreeIterator( + $this->args['f']['val']), + array($this, 'phar_dir_echo') + ); + } + // }}} + // {{{ static function cli_command_inf_tree + /** + * Cli Command Inf Tree + * + * @return string The description of a directory tree for a Phar archive. + */ + static function cli_cmd_inf_tree() + { + return "Get a directory tree for a PHAR archive."; + } + // }}} + // {{{ static function cli_cmd_arg_tree + /** + * Cli Command Argument Tree + * + * @return string Arguments in URL format. + */ + static function cli_cmd_arg_tree() + { + return self::phar_args('Fix', 'pharurl'); + } + // }}} + // {{{ public function cli_cmd_run_tree + /** + * Cli Command Run Tree + * + * Set the phar_dir_operation with a directorygraphiterator. + * + * @see DirectoryGraphIterator + * @see $this->phar_dir_operation + * + */ + public function cli_cmd_run_tree() + { + $a = $this->phar_dir_operation( + new DirectoryGraphIterator( + $this->args['f']['val']), + array($this, 'phar_dir_echo') + ); + if (!$a) { + echo "|-<root directory>\n"; + } + } + // }}} + // {{{ cli_cmd_inf_extract + /** + * Cli Command Inf Extract + * + * @return string The description of the command extra to a directory. + */ + static function cli_cmd_inf_extract() + { + return "Extract a PHAR package to a directory."; + } + // }}} + // {{{ static function cli_cmd_arg_extract + /** + * Cli Command Arguments Extract + * + * The arguments for the extract function. + * + * @return array The arguments for the extraction. + */ + static function cli_cmd_arg_extract() + { + $args = self::phar_args('Fix', 'phar'); + + $args[''] = array( + 'type' => 'dir', + 'val' => '.', + 'inf' => ' Directory to extract to (defaults to \'.\').', + ); + + return $args; + } + // }}} + // {{{ public function cli_cmd_run_extract + /** + * Run Extract + * + * Run the extraction of a phar Archive. + * + * @see $this->phar_dir_operation + */ + public function cli_cmd_run_extract() + { + $dir = $this->args['']['val']; + + if (is_array($dir)) { + if (count($dir) != 1) { + self::error("Only one target directory allowed.\n"); + } else { + $dir = $dir[0]; + } + } + + $phar = $this->args['f']['val']; + $base = $phar->getPathname(); + $bend = strpos($base, '.phar'); + $bend = strpos($base, '/', $bend); + $base = substr($base, 0, $bend + 1); + $blen = strlen($base); + + $this->phar_dir_operation( + new RecursiveIteratorIterator($phar), + array($this, 'phar_dir_extract'), + array($blen, $dir) + ); + } + // }}} + // {{{ public function phar_dir_extract + /** + * Extract to a directory + * + * This function will extract the content of a Phar + * to a directory and create new files and directories + * depending on the permissions on that folder. + * + * @param string $pn + * @param string $f The file name + * @param array $args The directory and Blen information + */ + public function phar_dir_extract($pn, $f, $args) + { + $blen = $args[0]; + $dir = $args[1]; + $sub = substr($pn, $blen); + $target = $dir . '/' . $sub; + + if (!file_exists(dirname($target))) { + @mkdir(dirname($target), 0777, true); + } + if (!file_exists(dirname($target))) { + self::error("Operation could not be completed\n"); + } + + echo "$sub"; + + if (!@copy($f, $target)) { + echo " ...error\n"; + } else { + echo " ...ok\n"; + } + } + // }}} + // {{{ static function cli_cmd_inf_delete + /** + * Delete an entry from a phar information. + * + * @return string The information + */ + static function cli_cmd_inf_delete() + { + return 'Delete entry from a PHAR archive'; + } + // }}} + // {{{ static function cli_cmd_arg_delete + /** + * The cli command argument for deleting. + * + * @return array information about the arguments to use. + */ + static function cli_cmd_arg_delete() + { + return self::phar_args('FE', 'phar'); + } + // }}} + // {{{ public function cli_cmd_run_delete + /** + * Deleting execution + * + * Execute the deleting of the file from the phar archive. + */ + public function cli_cmd_run_delete() + { + $phar = $this->args['f']['val']; + $entry = $this->args['e']['val']; + + $phar->startBuffering(); + unset($phar[$entry]); + $phar->stopBuffering(); + } + // }}} + // {{{ static function cli_cmd_inf_add + /** + * Client comment add file information + * + * @return string The description of the feature + */ + static function cli_cmd_inf_add() + { + return "Add entries to a PHAR package."; + } + // }}} + // {{{ static function cli_cmd_arg_add + /** + * Add a file arguments + */ + static function cli_cmd_arg_add() + { + $args = self::phar_args('acFilx', 'phar'); + $args[''] = array( + 'type' => 'any', + 'val' => NULL, + 'required' => 1, + 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', + ); + return $args; + } + // }}} + // {{{ public functio cli_cmd_run_add + /** + * Add a file + * + * Run the action of adding a file to + * a phar archive. + */ + public function cli_cmd_run_add() + { + $compress= $this->args['c']['val']; + $phar = $this->args['f']['val']; + $regex = $this->args['i']['val']; + $level = $this->args['l']['val']; + $invregex= $this->args['x']['val']; + $input = $this->args['']['val']; + + $phar->startBuffering(); + + if (!is_array($input)) { + $this->phar_add($phar, $level, $input, $regex, $invregex, NULL, $compress); + } else { + foreach($input as $i) { + $this->phar_add($phar, $level, $i, $regex, $invregex, NULL, $compress); + } + } + $phar->stopBuffering(); + exit(0); + } + // }}} + // {{{ public function cli_cmd_inf_stub_set + /** + * Set the stup of a phar file. + * + * @return string The stub set description. + */ + public function cli_cmd_inf_stub_set() + { + return "Set the stub of a PHAR file. " . + "If no input file is specified as stub then stdin is being used."; + } + // }}} + // {{{ public function cli_cmd_arg_stub_set + /** + * Set the argument stub + * + * @return string arguments for a stub + */ + public function cli_cmd_arg_stub_set() + { + $args = self::phar_args('bFps', 'phar'); + $args['s']['val'] = 'php://stdin'; + return $args; + } + // }}} + // {{{ public function cli_cmd_run_stub_set + /** + * Cli Command run stub set + * + * @see $phar->setStub() + */ + public function cli_cmd_run_stub_set() + { + $hashbang = $this->args['b']['val']; + $phar = $this->args['f']['val']; + $stub = $this->args['s']['val']; + $loader = $this->args['p']['val']; + + $this->phar_set_stub_begin($phar, $stub, $loader, $hashbang); + $this->phar_set_stub_end($phar, $stub, $loader); + } + // }}} + // {{{ public function cli_cmd_inf_stub_get + /** + * Get the command stub infos. + * + * @return string a description of the stub of a Phar file. + */ + public function cli_cmd_inf_stub_get() + { + return "Get the stub of a PHAR file. " . + "If no output file is specified as stub then stdout is being used."; + } + // }}} + // {{{ public function cli_cmd_arg_stub_get + /** + * Get the argument stub + * + * @return array $args The arguments passed to the stub. + */ + public function cli_cmd_arg_stub_get() + { + $args = self::phar_args('Fs', 'phar'); + $args['s']['val'] = 'php://stdin'; + return $args; + } + // }}} + // {{{ public function cli_cmd_run_stub_get + /** + * Cli Command Run Stub + * + * Get arguments and store them into a stub. + * + * @param arguments $args + * @see $this->args + */ + public function cli_cmd_run_stub_get($args) + { + $phar = $this->args['f']['val']; + $stub = $this->args['s']['val']; + + file_put_contents($stub, $phar->getStub()); + } + // }}} + // {{{ public function cli_cmd_inf_compress + /** + * Cli Command Inf Compress + * + * Cli Command compress information + * + * @return string A description of the command. + */ + public function cli_cmd_inf_compress() + { + return "Compress or uncompress all files or a selected entry."; + } + // }}} + // {{{ public function cli_cmd_arg_cmpress + /** + * Cli Command Arg Compress + * + * @return array The arguments for compress + */ + public function cli_cmd_arg_compress() + { + return self::phar_args('FCe', 'phar'); + } + // }}} + // {{{ public function cli_cmd_run_compress + /** + * Cli Command Run Compress + * + * @see $this->args + */ + public function cli_cmd_run_compress() + { + $phar = $this->args['f']['val']; + $entry = $this->args['e']['val']; + + switch($this->args['c']['val']) { + case 'gz': + case 'gzip': + if (isset($entry)) { + $phar[$entry]->compress(Phar::GZ); + } else { + $phar->compressFiles(Phar::GZ); + } + break; + case 'bz2': + case 'bzip2': + if (isset($entry)) { + $phar[$entry]->compress(Phar::BZ2); + } else { + $phar->compressFiles(Phar::BZ2); + } + break; + default: + if (isset($entry)) { + $phar[$entry]->decompress(); + } else { + $phar->decompressFiles(); + } + break; + } + } + // }}} + // {{{ public function cli_cmd_inf_sign + /** + * Cli Command Info Signature + * + * @return string A description of the signature arguments. + */ + public function cli_cmd_inf_sign() + { + return "Set signature hash algorithm."; + } + // }}} + // {{{ public function cli_cmd_arg_sign + /** + * Cli Command Argument Sign + * + * @return array Arguments for Signature + */ + public function cli_cmd_arg_sign() + { + return self::phar_args('FHy', 'phar'); + } + // }}} + // {{{ public function cli_cmd_run_sign + /** + * Cli Command Run Signature + * + * @see $phar->setSignaturealgorithm + */ + public function cli_cmd_run_sign() + { + $phar = $this->args['f']['val']; + $hash = $this->args['h']['val']; + $privkey = $this->args['y']['val']; + + $hash = self::phar_check_hash($hash, $privkey); + + $phar->setSignatureAlgorithm($hash, $privkey); + } + // }}} + // {{{ public function cli_cmd_inf_meta_set + /** + * Cli Command Inf Meta Set + * + * @return string A description + */ + public function cli_cmd_inf_meta_set() + { + return "Set meta data of a PHAR entry or a PHAR package using serialized input. " . + "If no input file is specified for meta data then stdin is being used." . + "You can also specify a particular index using -k. In that case the metadata is " . + "expected to be an array and the value of the given index is being set. If " . + "the metadata is not present or empty a new array will be created. If the " . + "metadata is present and a flat value then the return value is 1. Also using -k " . + "the input is been taken directly rather then being serialized."; + } + // }}} + // {{{ public function cli_cmd_arg_meta_set + /** + * Cli Command Argument Meta Set + * + * @return array The arguments for meta set + */ + public function cli_cmd_arg_meta_set() + { + return self::phar_args('FekM', 'phar'); + } + // }}} + // {{{ public function cli_cmd_run_met_set + /** + * Cli Command Run Metaset + * + * @see $phar->startBuffering + * @see $phar->setMetadata + * @see $phar->stopBuffering + */ + public function cli_cmd_run_meta_set() + { + $phar = $this->args['f']['val']; + $entry = $this->args['e']['val']; + $index = $this->args['k']['val']; + $meta = $this->args['m']['val']; + + $phar->startBuffering(); + + if (isset($index)) { + if (isset($entry)) { + if ($phar[$entry]->hasMetadata()) { + $old = $phar[$entry]->getMetadata(); + } else { + $old = array(); + } + } else { + if ($phar->hasMetadata()) { + $old = $phar->getMetadata(); + } else { + $old = array(); + } + } + + if (!is_array($old)) { + self::error('Metadata is a flat value while an index operation was issued.'); + } + + $old[$index] = $meta; + $meta = $old; + } else { + $meta = unserialize($meta); + } + + if (isset($entry)) { + $phar[$entry]->setMetadata($meta); + } else { + $phar->setMetadata($meta); + } + $phar->stopBuffering(); + } + // }}} + // {{{ public function cli_cmd_inf_met_get + /** + * Cli Command Inf Metaget + * + * @return string A description of the metaget arguments + */ + public function cli_cmd_inf_meta_get() + { + return "Get meta information of a PHAR entry or a PHAR package in serialized from. " . + "If no output file is specified for meta data then stdout is being used.\n" . + "You can also specify a particular index using -k. In that case the metadata is " . + "expected to be an array and the value of the given index is returned using echo " . + "rather than using serialize. If that index does not exist or no meta data is " . + "present then the return value is 1."; + } + // }}} + // {{{ public function cli_cmd_arg_meta_get + /** + * Cli Command arg metaget + * + * @return array The arguments for meta get. + */ + public function cli_cmd_arg_meta_get() + { + return self::phar_args('Fek', 'phar'); + } + // }}} + // {{{ public function cli_cmd_run_meta_get + /** + * Cli Command Run Metaget + * + * @see $this->args + * @see $phar[$x]->hasMetadata() + * @see $phar->getMetadata() + */ + public function cli_cmd_run_meta_get() + { + $phar = $this->args['f']['val']; + $entry = $this->args['e']['val']; + $index = $this->args['k']['val']; + + if (isset($entry)) { + if (!$phar[$entry]->hasMetadata()) { + echo "No Metadata\n"; + exit(1); + } + echo serialize($phar[$entry]->getMetadata()); + } else { + if (!$phar->hasMetadata()) { + echo "No Metadata\n"; + exit(1); + } + $meta = $phar->getMetadata(); + } + + if (isset($index)) { + if (isset($index)) { + if (isset($meta[$index])) { + echo $meta[$index]; + exit(0); + } else { + echo "No Metadata\n"; + exit(1); + } + } else { + echo serialize($meta); + } + } + } + // }}} + // {{{ public function cli_cmd_inf_meta_del + /** + * Cli Command Inf Metadel + * + * @return string A description of the metadel function + */ + public function cli_cmd_inf_meta_del() + { + return "Delete meta information of a PHAR entry or a PHAR package.\n" . + "If -k is given then the metadata is expected to be an array " . + "and the given index is being deleted.\n" . + "If something was deleted the return value is 0 otherwise it is 1."; + } + // }}} + // {{{ public function cli_cmd_arg_meta_del + /** + * CliC ommand Arg Metadelete + * + * @return array The arguments for metadel + */ + public function cli_cmd_arg_meta_del() + { + return self::phar_args('Fek', 'phar'); + } + // }}} + // {{{ public function cli_cmd_run_meta_del + /** + * Cli Command Run MetaDel + * + * @see $phar[$x]->delMetadata() + * @see $phar->delMetadata() + */ + public function cli_cmd_run_meta_del() + { + $phar = $this->args['f']['val']; + $entry = $this->args['e']['val']; + $index = $this->args['k']['val']; + + if (isset($entry)) { + if (isset($index)) { + if (!$phar[$entry]->hasMetadata()) { + exit(1); + } + $meta = $phar[$entry]->getMetadata(); + + // @todo add error message here. + if (!is_array($meta)) { + exit(1); + } + + unset($meta[$index]); + $phar[$entry]->setMetadata($meta); + } else { + exit($phar[$entry]->delMetadata() ? 0 : 1); + } + } else { + if (isset($index)) { + if (!$phar->hasMetadata()) { + exit(1); + } + + $meta = $phar->getMetadata(); + + // @todo Add error message + if (!is_array($meta)) { + exit(1); + } + + unset($meta[$index]); + $phar->setMetadata($meta); + } else { + exit($phar->delMetadata() ? 0 : 1); + } + } + } + // }}} + // {{{ public function cli_cmd_inf_info + /** + * CLi Command Inf Info + * + * @return string A description about the info commands. + */ + public function cli_cmd_inf_info() + { + return "Get information about a PHAR package.\n" . + "By using -k it is possible to return a single value."; + } + // }}} + // {{{ public function cli_cmd_arg_info + /** + * Cli Command Arg Infos + * + * @return array The arguments for info command. + */ + public function cli_cmd_arg_info() + { + return self::phar_args('Fk', 'phar'); + } + // }}} + // {{{ public function cli_cmd_run_info + /** + * Cli Command Run Info + * + * @param args $args + */ + public function cli_cmd_run_info() + { + $phar = $this->args['f']['val']; + $index = $this->args['k']['val']; + + $hash = $phar->getSignature(); + $infos = array(); + + if ($phar->getAlias()) { + $infos['Alias'] = $phar->getAlias(); + } + + if (!$hash) { + $infos['Hash-type'] = 'NONE'; + } else { + $infos['Hash-type'] = $hash['hash_type']; + $infos['Hash'] = $hash['hash']; + } + + $csize = 0; + $usize = 0; + $count = 0; + $ccount = 0; + $ucount = 0; + $mcount = 0; + $compalg = array('GZ'=>0, 'BZ2'=>0); + + foreach(new RecursiveIteratorIterator($phar) as $ent) { + $count++; + if ($ent->isCompressed()) { + $ccount++; + $csize += $ent->getCompressedSize(); + if ($ent->isCompressed(Phar::GZ)) { + $compalg['GZ']++; + } elseif ($ent->isCompressed(Phar::BZ2)) { + $compalg['BZ2']++; + } + } else { + $ucount++; + $csize += $ent->getSize(); + } + + $usize += $ent->getSize(); + + if ($ent->hasMetadata()) { + $mcount++; + } + } + + $infos['Entries'] = $count; + $infos['Uncompressed-files'] = $ucount; + $infos['Compressed-files'] = $ccount; + $infos['Compressed-gz'] = $compalg['GZ']; + $infos['Compressed-bz2'] = $compalg['BZ2']; + $infos['Uncompressed-size'] = $usize; + $infos['Compressed-size'] = $csize; + $infos['Compression-ratio'] = sprintf('%.3g%%', $usize ? ($csize * 100) / $usize : 100); + $infos['Metadata-global'] = $phar->hasMetadata() * 1; + $infos['Metadata-files'] = $mcount; + $infos['Stub-size'] = strlen($phar->getStub()); + + if (isset($index)) { + if (!isset($infos[$index])) { + self::error("Requested value does not exist.\n"); + } + + echo $infos[$index]; + exit(0); + } + + $l = 0; + foreach($infos as $which => $val) { + $l = max(strlen($which), $l); + } + + foreach($infos as $which => $val) { + echo $which . ':' . str_repeat(' ', $l + 1 - strlen($which)) . $val . "\n"; + } + } + // }}} + // {{{ public function cli_cmd_inf_version + /** + * CLi Command Inf Version + * + * @return string A description about the info commands. + */ + public function cli_cmd_inf_version() + { + return "Get information about the PHAR environment and the tool version."; + } + // }}} + // {{{ public function cli_cmd_arg_version + /** + * Cli Command Arg Version + * + * @return array The arguments for version command. + */ + public function cli_cmd_arg_version() + { + return self::phar_args('', NULL); + } + // }}} + // {{{ public function cli_cmd_run_info + /** + * Cli Command Run Info + * + * @param args $args + */ + public function cli_cmd_run_version() + { + $use_ext = extension_loaded('phar'); + $version = array( + 'PHP Version' => phpversion(), + 'phar.phar version' => '$Id$', + 'Phar EXT version' => $use_ext ? phpversion('phar') : 'Not available', + 'Phar API version' => Phar::apiVersion(), + 'Phar-based phar archives' => true, + 'Tar-based phar archives' => $use_ext, + 'ZIP-based phar archives' => $use_ext, + 'gzip compression' => extension_loaded('zlib'), + 'bzip2 compression' => extension_loaded('bz2'), + 'supported signatures' => $use_ext ? join(', ', Phar::getSupportedSignatures()) : '', + ); + $klen = 0; + foreach($version as $k => $v) + { + $klen = max($klen, strlen($k)); + } + ++$klen; + foreach($version as $k => $v) { + if (is_bool($v)) { + $v = $v ? 'enabled' : 'disabled'; + } + printf("%-${klen}s %s\n", $k.':', $v); + } + } + // }}} } // }}} ?> diff --git a/ext/phar/tests/003.phpt b/ext/phar/tests/003.phpt index fcc95a8481..6d57ebd400 100644 --- a/ext/phar/tests/003.phpt +++ b/ext/phar/tests/003.phpt @@ -6,8 +6,8 @@ Phar::canCompress <?php /* check this works and actually returns the boolean value */ var_dump(Phar::canCompress() == ( - extension_loaded("zlib") || extension_loaded("bz2") - )); + extension_loaded("zlib") || extension_loaded("bz2") + )); ?> --EXPECT-- bool(true) diff --git a/ext/phar/tests/018.phpt b/ext/phar/tests/018.phpt index 0f97b361d5..2b61b7e739 100644 --- a/ext/phar/tests/018.phpt +++ b/ext/phar/tests/018.phpt @@ -22,8 +22,8 @@ include 'files/phar_test.inc'; include $fname; $dir = opendir('phar://hio/'); while (false !== ($a = readdir($dir))) { - var_dump($a); - var_dump(is_dir('phar://hio/' . $a)); + var_dump($a); + var_dump(is_dir('phar://hio/' . $a)); } ?> --CLEAN-- diff --git a/ext/phar/tests/019.phpt b/ext/phar/tests/019.phpt index 44e2580f18..92f7b51f88 100644 --- a/ext/phar/tests/019.phpt +++ b/ext/phar/tests/019.phpt @@ -25,10 +25,10 @@ include $fname; $dir = opendir('phar://hio/b'); if ($dir) { - while (false !== ($a = readdir($dir))) { - var_dump($a); - var_dump(is_dir('phar://hio/b/' . $a)); - } + while (false !== ($a = readdir($dir))) { + var_dump($a); + var_dump(is_dir('phar://hio/b/' . $a)); + } } ?> diff --git a/ext/phar/tests/019b.phpt b/ext/phar/tests/019b.phpt index 99415eaa95..34404966b9 100644 --- a/ext/phar/tests/019b.phpt +++ b/ext/phar/tests/019b.phpt @@ -24,21 +24,21 @@ include $fname; function dump($phar, $base) { - var_dump($phar . $base); - $dir = opendir($phar . $base); - if ($base == '/') - { - $base = ''; - } - while (false !== ($entry = readdir($dir))) { - $entry = $base . '/' . $entry; - var_dump($entry); - var_dump(is_dir($phar . $entry)); - if (is_dir($phar . $entry)) - { - dump($phar, $entry); - } - } + var_dump($phar . $base); + $dir = opendir($phar . $base); + if ($base == '/') + { + $base = ''; + } + while (false !== ($entry = readdir($dir))) { + $entry = $base . '/' . $entry; + var_dump($entry); + var_dump(is_dir($phar . $entry)); + if (is_dir($phar . $entry)) + { + dump($phar, $entry); + } + } } dump('phar://hio', '/'); diff --git a/ext/phar/tests/019c.phpt b/ext/phar/tests/019c.phpt index 5eaac90ac7..460b8f5397 100644 --- a/ext/phar/tests/019c.phpt +++ b/ext/phar/tests/019c.phpt @@ -24,25 +24,25 @@ include $fname; function dump($phar, $base) { - var_dump($phar . $base); - $dir = opendir($phar . $base); - if ($base == '/') - { - $base = ''; - } - while (false !== ($entry = readdir($dir))) { - $entry = $base . '/' . $entry; - var_dump($entry); - var_dump(is_dir($phar . $entry)); - if (is_dir($phar . $entry)) - { - dump($phar, $entry); - } - else - { - var_dump(file_get_contents($phar . $entry)); - } - } + var_dump($phar . $base); + $dir = opendir($phar . $base); + if ($base == '/') + { + $base = ''; + } + while (false !== ($entry = readdir($dir))) { + $entry = $base . '/' . $entry; + var_dump($entry); + var_dump(is_dir($phar . $entry)); + if (is_dir($phar . $entry)) + { + dump($phar, $entry); + } + else + { + var_dump(file_get_contents($phar . $entry)); + } + } } dump('phar://hio', '/'); diff --git a/ext/phar/tests/024-opcache-win32.phpt b/ext/phar/tests/024-opcache-win32.phpt index afcd93e5f5..b9d80929cc 100644 --- a/ext/phar/tests/024-opcache-win32.phpt +++ b/ext/phar/tests/024-opcache-win32.phpt @@ -39,15 +39,15 @@ include $pname . '/b/c.php'; $cache_dir = ini_get("opcache.file_cache"); if (is_dir($cache_dir)) { - $it = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($cache_dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST - ); - foreach ($it as $fi) { - $fn = ($fi->isDir() ? 'rmdir' : 'unlink'); - $fn($fi->getRealPath()); - } - - rmdir($cache_dir); + $it = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($cache_dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST + ); + foreach ($it as $fi) { + $fn = ($fi->isDir() ? 'rmdir' : 'unlink'); + $fn($fi->getRealPath()); + } + + rmdir($cache_dir); } ?> diff --git a/ext/phar/tests/027.phpt b/ext/phar/tests/027.phpt index 23e51db0df..4820c74c2e 100644 --- a/ext/phar/tests/027.phpt +++ b/ext/phar/tests/027.phpt @@ -23,21 +23,21 @@ include 'files/phar_test.inc'; function dump($phar, $base) { - var_dump(str_replace(__DIR__, '*', $phar) . $base); - $dir = opendir($phar . $base); - if ($base == '/') - { - $base = ''; - } - while (false !== ($entry = readdir($dir))) { - $entry = $base . '/' . $entry; - var_dump($entry); - var_dump(is_dir($phar . $entry)); - if (is_dir($phar . $entry)) - { - dump($phar, $entry); - } - } + var_dump(str_replace(__DIR__, '*', $phar) . $base); + $dir = opendir($phar . $base); + if ($base == '/') + { + $base = ''; + } + while (false !== ($entry = readdir($dir))) { + $entry = $base . '/' . $entry; + var_dump($entry); + var_dump(is_dir($phar . $entry)); + if (is_dir($phar . $entry)) + { + dump($phar, $entry); + } + } } dump($pname, '/'); diff --git a/ext/phar/tests/029.phpt b/ext/phar/tests/029.phpt index d87064685c..470516ef76 100644 --- a/ext/phar/tests/029.phpt +++ b/ext/phar/tests/029.phpt @@ -29,11 +29,11 @@ var_dump(Phar::loadPhar($fname1, 'copy')); $a = new Phar($fname1); try { - var_dump(Phar::loadPhar($fname2, 'copy')); + var_dump(Phar::loadPhar($fname2, 'copy')); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/phar/tests/033a.phpt b/ext/phar/tests/033a.phpt index 6b5956a714..3186c1853b 100644 --- a/ext/phar/tests/033a.phpt +++ b/ext/phar/tests/033a.phpt @@ -15,14 +15,14 @@ $files = array(); $files['a.php'] = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>'; include 'files/phar_test.inc'; try { - $a = new Phar($fname); - var_dump($a['a.php']->isExecutable()); - $a['a.php']->chmod(0777); - var_dump($a['a.php']->isExecutable()); - $a['a.php']->chmod(0666); - var_dump($a['a.php']->isExecutable()); + $a = new Phar($fname); + var_dump($a['a.php']->isExecutable()); + $a['a.php']->chmod(0777); + var_dump($a['a.php']->isExecutable()); + $a['a.php']->chmod(0666); + var_dump($a['a.php']->isExecutable()); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/badparameters.phpt b/ext/phar/tests/badparameters.phpt index 62c3be2e23..3ee49890c9 100644 --- a/ext/phar/tests/badparameters.phpt +++ b/ext/phar/tests/badparameters.phpt @@ -29,12 +29,12 @@ try { echo $e->getMessage(), "\n"; } try { - $a = new Phar(array()); + $a = new Phar(array()); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } try { - $a = new Phar(__DIR__ . '/files/frontcontroller10.phar'); + $a = new Phar(__DIR__ . '/files/frontcontroller10.phar'); } catch (PharException $e) { echo $e->getMessage(), "\n"; } @@ -49,12 +49,12 @@ try { echo $e->getMessage(), "\n"; } try { - $b = new PharData(__DIR__ . '/whatever.tar'); + $b = new PharData(__DIR__ . '/whatever.tar'); } catch (PharException $e) { echo $e->getMessage(), "\n"; } try { - $c = new PharData(__DIR__ . '/whatever.zip'); + $c = new PharData(__DIR__ . '/whatever.zip'); } catch (PharException $e) { echo $e->getMessage(), "\n"; } diff --git a/ext/phar/tests/bug13727.phpt b/ext/phar/tests/bug13727.phpt index 345968cdbb..ea406a4d8f 100644 --- a/ext/phar/tests/bug13727.phpt +++ b/ext/phar/tests/bug13727.phpt @@ -14,11 +14,11 @@ $pname = 'phar://' . $fname; $pArchive="DataArchive.phar"; $p = new Phar($fname, 0, $pArchive); for ($i = 0; $i < 4*1024; $i++){ - echo("$i\n"); - if (!is_dir($fileDir="$dirName/test_data")) - mkdir($fileDir, 0777, true); - file_put_contents("$fileDir/$i", ""); - $p->addFile("$fileDir/$i", "$dirName"); + echo("$i\n"); + if (!is_dir($fileDir="$dirName/test_data")) + mkdir($fileDir, 0777, true); + file_put_contents("$fileDir/$i", ""); + $p->addFile("$fileDir/$i", "$dirName"); } echo("\n Written Files($i)\n"); ?> diff --git a/ext/phar/tests/bug13786.phpt b/ext/phar/tests/bug13786.phpt index 0ef1c33037..76f05ef1fc 100644 --- a/ext/phar/tests/bug13786.phpt +++ b/ext/phar/tests/bug13786.phpt @@ -10,13 +10,13 @@ phar.readonly=0 try { for ($i = 0; $i < 2; $i++) { - $fname = "DataArchive.phar"; - $path = __DIR__ . DIRECTORY_SEPARATOR . $fname; - $phar = new Phar($path); - $phar->addFromString($i, "file $i in $fname"); - var_dump(file_get_contents($phar[$i])); - unset($phar); - unlink($path); + $fname = "DataArchive.phar"; + $path = __DIR__ . DIRECTORY_SEPARATOR . $fname; + $phar = new Phar($path); + $phar->addFromString($i, "file $i in $fname"); + var_dump(file_get_contents($phar[$i])); + unset($phar); + unlink($path); } echo("\nWritten files: $i\n"); diff --git a/ext/phar/tests/bug45218_SLOWTEST.phpt b/ext/phar/tests/bug45218_SLOWTEST.phpt index 1282ac22e9..aee2aae788 100644 --- a/ext/phar/tests/bug45218_SLOWTEST.phpt +++ b/ext/phar/tests/bug45218_SLOWTEST.phpt @@ -39,16 +39,16 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar($fname); - $ret = $phar->buildFromIterator(new myIterator); - foreach ($ret as $a => $val) { - $ret[$a] = str_replace(dirname($fname2) . DIRECTORY_SEPARATOR, '*', $val); - } - var_dump($ret); + chdir(__DIR__); + $phar = new Phar($fname); + $ret = $phar->buildFromIterator(new myIterator); + foreach ($ret as $a => $val) { + $ret[$a] = str_replace(dirname($fname2) . DIRECTORY_SEPARATOR, '*', $val); + } + var_dump($ret); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/bug46032.phpt b/ext/phar/tests/bug46032.phpt index a20e95d3ed..8f21bf4d59 100644 --- a/ext/phar/tests/bug46032.phpt +++ b/ext/phar/tests/bug46032.phpt @@ -9,13 +9,13 @@ Phar: bug #46032: PharData::__construct wrong memory read $a = __DIR__ .'/mytest'; try { - new phar($a); + new phar($a); } catch (exception $e) { } var_dump($a); try { - new phar($a); + new phar($a); } catch (exception $e) { } var_dump($a); diff --git a/ext/phar/tests/bug48377.2.phpt b/ext/phar/tests/bug48377.2.phpt index 04df8940f2..cdc8a42953 100644 --- a/ext/phar/tests/bug48377.2.phpt +++ b/ext/phar/tests/bug48377.2.phpt @@ -12,9 +12,9 @@ $fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.zip'; $phar = new PharData($fname); $phar['x'] = 'hi'; try { - $phar->convertToData(Phar::ZIP, Phar::NONE, 'phar.zip'); + $phar->convertToData(Phar::ZIP, Phar::NONE, 'phar.zip'); } catch (BadMethodCallException $e) { - echo $e->getMessage(),"\n"; + echo $e->getMessage(),"\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/bug48377.phpt b/ext/phar/tests/bug48377.phpt index ec52c1a0f5..338d98a52f 100644 --- a/ext/phar/tests/bug48377.phpt +++ b/ext/phar/tests/bug48377.phpt @@ -15,9 +15,9 @@ touch($fname2); $phar = new Phar($fname, 0, 'a.phar'); $phar['x'] = 'hi'; try { - $phar->convertToData(Phar::ZIP, Phar::NONE, 'zip'); + $phar->convertToData(Phar::ZIP, Phar::NONE, 'zip'); } catch (BadMethodCallException $e) { - echo $e->getMessage(),"\n"; + echo $e->getMessage(),"\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/bug54395.phpt b/ext/phar/tests/bug54395.phpt index a3d90a1b3e..fb041bc6ff 100644 --- a/ext/phar/tests/bug54395.phpt +++ b/ext/phar/tests/bug54395.phpt @@ -6,9 +6,9 @@ Bug #54395 (Phar::mount() crashes when calling with wrong parameters) <?php try { - phar::mount(1,1); + phar::mount(1,1); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> diff --git a/ext/phar/tests/bug60261.phpt b/ext/phar/tests/bug60261.phpt index 31baa82394..7f32bf6482 100644 --- a/ext/phar/tests/bug60261.phpt +++ b/ext/phar/tests/bug60261.phpt @@ -7,9 +7,9 @@ Bug #60261 (phar dos null pointer) try { $nx = new Phar(); - $nx->getLinkTarget(); + $nx->getLinkTarget(); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } ?> diff --git a/ext/phar/tests/bug64931/bug64931.phpt b/ext/phar/tests/bug64931/bug64931.phpt index 0de8d43e78..6bf3bea7c3 100644 --- a/ext/phar/tests/bug64931/bug64931.phpt +++ b/ext/phar/tests/bug64931/bug64931.phpt @@ -13,33 +13,33 @@ echo "Test\n"; $phar = new Phar(__DIR__."/bug64931.phar"); $phar->addFile(__DIR__."/src/.pharignore", ".pharignore"); try { - $phar->addFile(__DIR__."/src/.pharignore", ".phar/gotcha"); + $phar->addFile(__DIR__."/src/.pharignore", ".phar/gotcha"); } catch (Exception $e) { - echo "CAUGHT: ". $e->getMessage() ."\n"; + echo "CAUGHT: ". $e->getMessage() ."\n"; } try { - $phar->addFromString(".phar", "gotcha"); + $phar->addFromString(".phar", "gotcha"); } catch (Exception $e) { - echo "CAUGHT: ". $e->getMessage() ."\n"; + echo "CAUGHT: ". $e->getMessage() ."\n"; } try { - $phar->addFromString(".phar//", "gotcha"); + $phar->addFromString(".phar//", "gotcha"); } catch (Exception $e) { - echo "CAUGHT: ". $e->getMessage() ."\n"; + echo "CAUGHT: ". $e->getMessage() ."\n"; } try { - $phar->addFromString(".phar\\", "gotcha"); + $phar->addFromString(".phar\\", "gotcha"); } catch (Exception $e) { - echo "CAUGHT: ". $e->getMessage() ."\n"; + echo "CAUGHT: ". $e->getMessage() ."\n"; } try { - $phar->addFromString(".phar\0", "gotcha"); + $phar->addFromString(".phar\0", "gotcha"); } catch (TypeError $e) { - echo "CAUGHT: ". $e->getMessage() ."\n"; + echo "CAUGHT: ". $e->getMessage() ."\n"; } ?> diff --git a/ext/phar/tests/bug65028.phpt b/ext/phar/tests/bug65028.phpt index 7d24ead69d..106b3ad633 100644 --- a/ext/phar/tests/bug65028.phpt +++ b/ext/phar/tests/bug65028.phpt @@ -8,120 +8,120 @@ phar.readonly=0 <?php $files = array( - "lib/widgets/Widgets.php", - "lib/events/FormBeginEventArgs.php", - "lib/events/FormEndEventArgs.php", - "lib/Core.php", - "lib/database/MySqlDatabase.php", - "lib/utils/DateUtil.php", - "js/global.js", - "files/_emptyDirectory", - "files/search/schema.xml", - "vendor/Fusonic/Linq/Internal/WhereIterator.php", - "vendor/Fusonic/Linq/Internal/SelectManyIterator.php", - "vendor/Fusonic/Linq/Internal/SelectIterator.php", - "vendor/Fusonic/Linq/Internal/DiffIterator.php", - "vendor/Fusonic/Linq/Internal/GroupIterator.php", - "vendor/Fusonic/Linq/Internal/DistinctIterator.php", - "vendor/Fusonic/Linq/Internal/LinqHelper.php", - "vendor/Fusonic/Linq/Internal/OrderIterator.php", - "vendor/Fusonic/Linq/Internal/IntersectIterator.php", - "vendor/Fusonic/Linq/GroupedLinq.php", - "vendor/Fusonic/Linq.php", - "vendor/Fusonic/UI/Widgets/Forms/FormBegin.php", - "vendor/Fusonic/UI/Widgets/Forms/FormSectionBuilder.php", - "vendor/Fusonic/UI/Widgets/Forms/AutoSelect.php", - "vendor/Fusonic/UI/Widgets/Forms/ControlGroup.php", - "vendor/Fusonic/UI/Widgets/Forms/FormEnd.php", - "vendor/Fusonic/UI/Widgets/WidgetBase.php", - "modules/calendar/ajax/calendarGetInvitedUsersContentAjaxHandler.php", - "modules/calendar/js/calendarAppointmentForm.js", - "modules/calendar/misc/calendarAppointment.php", - "modules/calendar/pages/forms/calendarAppointmentForm.php", - "modules/calendar/setup/config.xml", - "modules/cmt/js/cmtMicroCommentsWidget.js", - "modules/cmt/setup/config.xml", - "modules/meta/misc/metaContentHelper.php", - "modules/meta/setup/config.xml", - "modules/brd/misc/brdPostStreamFormatter.php", - "modules/brd/misc/brdPost.php", - "modules/brd/setup/config/streamContents.xml", - "modules/brd/setup/resources/lang/en.xml", - "modules/brd/setup/resources/lang/de.xml", - "modules/brd/setup/config.xml", - "modules/auth/misc/authLoginService.php", - "modules/auth/setup/config.xml", - "modules/bwd/cache/bwdWordCacheCreator.php", - "modules/bwd/bwd.php", - "modules/bwd/setup/config.xml", - "modules/nws/templates/pages/forms/nwsNewsForm.tpl", - "modules/nws/templates/pages/nwsShowNewsPage.tpl", - "modules/nws/pages/forms/nwsNewsForm.php", - "modules/nws/pages/nwsShowNewsPage.php", - "modules/nws/setup/config.xml", - "modules/gmp/cache/gmpMarkersCacheCreator.php", - "modules/gmp/select/gmpMapContentSelect.php", - "modules/gmp/templates/gmpShowAppointmentPage.tpl", - "modules/gmp/templates/gmpShowLinkPage.tpl", - "modules/gmp/setup/config.xml", - "modules/mul/cache/mulVideoPortalCacheCreator.php", - "modules/mul/misc/mulPermissionHelper.php", - "modules/mul/templates/widgets/mulFileEmbedWidget_Video_Flv.tpl", - "modules/mul/setup/config/mulUploadVideoPortalMatches.xml", - "modules/mul/setup/config.xml", - "modules/cat/select/catCategorySelect.php", - "modules/cat/misc/catCategory.php", - "modules/cat/templates/pages/forms/catCategoryForm.tpl", - "modules/cat/pages/forms/catEditCategoryForm.php", - "modules/cat/pages/forms/catAddCategoryForm.php", - "modules/cat/setup/config.xml", - "modules/sty/events/styPageShowEventHandler.php", - "modules/sty/misc/styBox.php", - "modules/sty/templates/pages/forms/styLayoutForm.tpl", - "modules/sty/templates/pages/forms/styBoxForm.tpl", - "modules/sty/templates/pages/forms/styVariantForm.tpl", - "modules/sty/setup/resources/lang/en.xml", - "modules/sty/setup/resources/lang/de.xml", - "modules/sty/setup/config.xml", - "modules/reg/misc/regRegistrationHelper.php", - "modules/reg/setup/config.xml", - "modules/not/misc/notEmailNotificationProvider.php", - "modules/not/setup/config.xml", - "modules/styfusonic/setup/config.xml", - "modules/sys/ajax/sysUserAutoSuggestSelectAjaxHandler.php", - "modules/sys/js/sysUserAutoSuggestSelect.js", - "modules/sys/select/sysPermissionSelect.php", - "modules/sys/misc/sysHtaccessConfigWriter.php", - "modules/sys/misc/sysUserRepository.php", - "modules/sys/setup/resources/lang/en.xml", - "modules/sys/setup/resources/lang/de.xml", - "modules/sys/setup/config.xml", - "modules/igr/boxes/igrGreatestEntriesBoxTab.php", - "modules/igr/boxes/igrTopRatedEntriesBoxTab.php", - "modules/igr/setup/config.xml", - "modules/rat/ajax/ratRateAjaxHandler.php", - "modules/rat/ajax/ratUnlikeAjaxHandler.php", - "modules/rat/setup/config.xml", - "modules/search/select/searchModuleSelect.php", - "modules/search/select/searchOrderSelect.php", - "modules/search/misc/searchResultFormatter.php", - "modules/search/misc/searchProviderSolr.php", - "modules/search/misc/searchProviderLucene.php", - "modules/search/misc/searchResultItem.php", - "modules/search/misc/searchProviderBase.php", - "modules/search/misc/searchIProvider.php", - "modules/search/templates/misc/searchResultFormatter.tpl", - "modules/search/templates/pages/searchIndexPage.tpl", - "modules/search/templates/pages/forms/searchSearchForm.tpl", - "modules/search/pages/forms/searchSearchForm.php", - "modules/search/css/searchResultFormatter.css", - "modules/search/setup/config/sysSettings.xml", - "modules/search/setup/resources/lang/en.xml", - "modules/search/setup/resources/lang/de.xml", - "modules/search/setup/config.xml", - "style/Fusonic/40components.css", - "style/_emptyDirectory", - "index.php", + "lib/widgets/Widgets.php", + "lib/events/FormBeginEventArgs.php", + "lib/events/FormEndEventArgs.php", + "lib/Core.php", + "lib/database/MySqlDatabase.php", + "lib/utils/DateUtil.php", + "js/global.js", + "files/_emptyDirectory", + "files/search/schema.xml", + "vendor/Fusonic/Linq/Internal/WhereIterator.php", + "vendor/Fusonic/Linq/Internal/SelectManyIterator.php", + "vendor/Fusonic/Linq/Internal/SelectIterator.php", + "vendor/Fusonic/Linq/Internal/DiffIterator.php", + "vendor/Fusonic/Linq/Internal/GroupIterator.php", + "vendor/Fusonic/Linq/Internal/DistinctIterator.php", + "vendor/Fusonic/Linq/Internal/LinqHelper.php", + "vendor/Fusonic/Linq/Internal/OrderIterator.php", + "vendor/Fusonic/Linq/Internal/IntersectIterator.php", + "vendor/Fusonic/Linq/GroupedLinq.php", + "vendor/Fusonic/Linq.php", + "vendor/Fusonic/UI/Widgets/Forms/FormBegin.php", + "vendor/Fusonic/UI/Widgets/Forms/FormSectionBuilder.php", + "vendor/Fusonic/UI/Widgets/Forms/AutoSelect.php", + "vendor/Fusonic/UI/Widgets/Forms/ControlGroup.php", + "vendor/Fusonic/UI/Widgets/Forms/FormEnd.php", + "vendor/Fusonic/UI/Widgets/WidgetBase.php", + "modules/calendar/ajax/calendarGetInvitedUsersContentAjaxHandler.php", + "modules/calendar/js/calendarAppointmentForm.js", + "modules/calendar/misc/calendarAppointment.php", + "modules/calendar/pages/forms/calendarAppointmentForm.php", + "modules/calendar/setup/config.xml", + "modules/cmt/js/cmtMicroCommentsWidget.js", + "modules/cmt/setup/config.xml", + "modules/meta/misc/metaContentHelper.php", + "modules/meta/setup/config.xml", + "modules/brd/misc/brdPostStreamFormatter.php", + "modules/brd/misc/brdPost.php", + "modules/brd/setup/config/streamContents.xml", + "modules/brd/setup/resources/lang/en.xml", + "modules/brd/setup/resources/lang/de.xml", + "modules/brd/setup/config.xml", + "modules/auth/misc/authLoginService.php", + "modules/auth/setup/config.xml", + "modules/bwd/cache/bwdWordCacheCreator.php", + "modules/bwd/bwd.php", + "modules/bwd/setup/config.xml", + "modules/nws/templates/pages/forms/nwsNewsForm.tpl", + "modules/nws/templates/pages/nwsShowNewsPage.tpl", + "modules/nws/pages/forms/nwsNewsForm.php", + "modules/nws/pages/nwsShowNewsPage.php", + "modules/nws/setup/config.xml", + "modules/gmp/cache/gmpMarkersCacheCreator.php", + "modules/gmp/select/gmpMapContentSelect.php", + "modules/gmp/templates/gmpShowAppointmentPage.tpl", + "modules/gmp/templates/gmpShowLinkPage.tpl", + "modules/gmp/setup/config.xml", + "modules/mul/cache/mulVideoPortalCacheCreator.php", + "modules/mul/misc/mulPermissionHelper.php", + "modules/mul/templates/widgets/mulFileEmbedWidget_Video_Flv.tpl", + "modules/mul/setup/config/mulUploadVideoPortalMatches.xml", + "modules/mul/setup/config.xml", + "modules/cat/select/catCategorySelect.php", + "modules/cat/misc/catCategory.php", + "modules/cat/templates/pages/forms/catCategoryForm.tpl", + "modules/cat/pages/forms/catEditCategoryForm.php", + "modules/cat/pages/forms/catAddCategoryForm.php", + "modules/cat/setup/config.xml", + "modules/sty/events/styPageShowEventHandler.php", + "modules/sty/misc/styBox.php", + "modules/sty/templates/pages/forms/styLayoutForm.tpl", + "modules/sty/templates/pages/forms/styBoxForm.tpl", + "modules/sty/templates/pages/forms/styVariantForm.tpl", + "modules/sty/setup/resources/lang/en.xml", + "modules/sty/setup/resources/lang/de.xml", + "modules/sty/setup/config.xml", + "modules/reg/misc/regRegistrationHelper.php", + "modules/reg/setup/config.xml", + "modules/not/misc/notEmailNotificationProvider.php", + "modules/not/setup/config.xml", + "modules/styfusonic/setup/config.xml", + "modules/sys/ajax/sysUserAutoSuggestSelectAjaxHandler.php", + "modules/sys/js/sysUserAutoSuggestSelect.js", + "modules/sys/select/sysPermissionSelect.php", + "modules/sys/misc/sysHtaccessConfigWriter.php", + "modules/sys/misc/sysUserRepository.php", + "modules/sys/setup/resources/lang/en.xml", + "modules/sys/setup/resources/lang/de.xml", + "modules/sys/setup/config.xml", + "modules/igr/boxes/igrGreatestEntriesBoxTab.php", + "modules/igr/boxes/igrTopRatedEntriesBoxTab.php", + "modules/igr/setup/config.xml", + "modules/rat/ajax/ratRateAjaxHandler.php", + "modules/rat/ajax/ratUnlikeAjaxHandler.php", + "modules/rat/setup/config.xml", + "modules/search/select/searchModuleSelect.php", + "modules/search/select/searchOrderSelect.php", + "modules/search/misc/searchResultFormatter.php", + "modules/search/misc/searchProviderSolr.php", + "modules/search/misc/searchProviderLucene.php", + "modules/search/misc/searchResultItem.php", + "modules/search/misc/searchProviderBase.php", + "modules/search/misc/searchIProvider.php", + "modules/search/templates/misc/searchResultFormatter.tpl", + "modules/search/templates/pages/searchIndexPage.tpl", + "modules/search/templates/pages/forms/searchSearchForm.tpl", + "modules/search/pages/forms/searchSearchForm.php", + "modules/search/css/searchResultFormatter.css", + "modules/search/setup/config/sysSettings.xml", + "modules/search/setup/resources/lang/en.xml", + "modules/search/setup/resources/lang/de.xml", + "modules/search/setup/config.xml", + "style/Fusonic/40components.css", + "style/_emptyDirectory", + "index.php", // "a", // This will make the test pass ); @@ -129,7 +129,7 @@ $files = array( $phar = new Phar(__DIR__ . "/bug65028.phar"); foreach($files as $file) { - $phar->addFromString($file, ""); + $phar->addFromString($file, ""); } // Copy phar @@ -138,12 +138,12 @@ copy(__DIR__ . "/bug65028.phar", __DIR__ . "/bug65028-copy.phar"); // Open phar try { - $phar = new Phar(__DIR__ . "/bug65028-copy.phar"); - echo "No exception thrown.\n"; + $phar = new Phar(__DIR__ . "/bug65028-copy.phar"); + echo "No exception thrown.\n"; } catch(UnexpectedValueException $ex) { - echo "Exception thrown: " . $ex->getMessage() . "\n"; + echo "Exception thrown: " . $ex->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/bug69324.phpt b/ext/phar/tests/bug69324.phpt index b3311c8651..1735fc8afe 100644 --- a/ext/phar/tests/bug69324.phpt +++ b/ext/phar/tests/bug69324.phpt @@ -11,7 +11,7 @@ $p = new Phar(__DIR__.'/bug69324.phar', 0); $meta=$p->getMetadata(); var_dump($meta); } catch(Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } --EXPECTF-- internal corruption of phar "%s" (truncated manifest entry) diff --git a/ext/phar/tests/bug69441.phpt b/ext/phar/tests/bug69441.phpt index b08d015843..4dd136c506 100644 --- a/ext/phar/tests/bug69441.phpt +++ b/ext/phar/tests/bug69441.phpt @@ -8,7 +8,7 @@ $fname = __DIR__ . '/bug69441.phar'; try { $r = new Phar($fname, 0); } catch(UnexpectedValueException $e) { - echo $e; + echo $e; } ?> diff --git a/ext/phar/tests/bug69453.phpt b/ext/phar/tests/bug69453.phpt index eb7d5f248f..18b4a3949f 100644 --- a/ext/phar/tests/bug69453.phpt +++ b/ext/phar/tests/bug69453.phpt @@ -8,7 +8,7 @@ $fname = __DIR__ . '/bug69453.tar.phar'; try { $r = new Phar($fname, 0); } catch(UnexpectedValueException $e) { - echo $e; + echo $e; } ?> diff --git a/ext/phar/tests/bug69720.phpt b/ext/phar/tests/bug69720.phpt index 5c57d6360a..cdb4741ff8 100644 --- a/ext/phar/tests/bug69720.phpt +++ b/ext/phar/tests/bug69720.phpt @@ -8,13 +8,13 @@ try { // open an existing phar $p = new Phar(__DIR__."/bug69720.phar",0); // Phar extends SPL's DirectoryIterator class - echo $p->getMetadata(); + echo $p->getMetadata(); foreach (new RecursiveIteratorIterator($p) as $file) { // $file is a PharFileInfo class, and inherits from SplFileInfo - $temp=""; + $temp=""; $temp= $file->getFileName() . "\n"; $temp.=file_get_contents($file->getPathName()) . "\n"; // display contents - var_dump($file->getMetadata()); + var_dump($file->getMetadata()); } } catch (Exception $e) { diff --git a/ext/phar/tests/bug71498.phpt b/ext/phar/tests/bug71498.phpt index 4157ac20b6..af24724e5c 100644 --- a/ext/phar/tests/bug71498.phpt +++ b/ext/phar/tests/bug71498.phpt @@ -7,7 +7,7 @@ Phar: bug #71498: Out-of-Bound Read in phar_parse_zipfile() try { $p = new PharData(__DIR__."/bug71498.zip"); } catch(UnexpectedValueException $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/phar/tests/bug72321.phpt b/ext/phar/tests/bug72321.phpt index 6e63da42d9..05413a0295 100644 --- a/ext/phar/tests/bug72321.phpt +++ b/ext/phar/tests/bug72321.phpt @@ -12,7 +12,7 @@ $phar = new PharData("72321_2.zip"); try { $phar->extractTo("test72321"); } catch(PharException $e) { - print $e->getMessage()."\n"; + print $e->getMessage()."\n"; } ?> DONE diff --git a/ext/phar/tests/bug72928.phpt b/ext/phar/tests/bug72928.phpt index 1277e88711..6d0e0ff623 100644 --- a/ext/phar/tests/bug72928.phpt +++ b/ext/phar/tests/bug72928.phpt @@ -9,7 +9,7 @@ try { $phar = new PharData('bug72928.zip'); var_dump($phar); } catch(UnexpectedValueException $e) { - print $e->getMessage()."\n"; + print $e->getMessage()."\n"; } ?> DONE diff --git a/ext/phar/tests/bug73035.phpt b/ext/phar/tests/bug73035.phpt index ffdd36c52e..fefd0583bd 100644 --- a/ext/phar/tests/bug73035.phpt +++ b/ext/phar/tests/bug73035.phpt @@ -9,7 +9,7 @@ try { $phar = new PharData('bug73035.tar'); var_dump($phar); } catch(UnexpectedValueException $e) { - print $e->getMessage()."\n"; + print $e->getMessage()."\n"; } ?> DONE diff --git a/ext/phar/tests/bug73764.phpt b/ext/phar/tests/bug73764.phpt index baff083265..fdabd78bbf 100644 --- a/ext/phar/tests/bug73764.phpt +++ b/ext/phar/tests/bug73764.phpt @@ -9,7 +9,7 @@ try { $p = Phar::LoadPhar('bug73764.phar', 'alias.phar'); echo "OK\n"; } catch(PharException $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> --EXPECTF-- diff --git a/ext/phar/tests/bug73768.phpt b/ext/phar/tests/bug73768.phpt index 3062268b80..cdaa6fa723 100644 --- a/ext/phar/tests/bug73768.phpt +++ b/ext/phar/tests/bug73768.phpt @@ -9,7 +9,7 @@ try { $p = Phar::LoadPhar('bug73768.phar', 'alias.phar'); echo "OK\n"; } catch(PharException $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> --EXPECTF-- diff --git a/ext/phar/tests/bug77022.phpt b/ext/phar/tests/bug77022.phpt index c78d1bdafd..c287bb339f 100644 --- a/ext/phar/tests/bug77022.phpt +++ b/ext/phar/tests/bug77022.phpt @@ -14,16 +14,16 @@ $sFile = tempnam(__DIR__, 'test77022'); var_dump(decoct(stat($sFile)['mode'])); foreach([Phar::TAR => 'tar', Phar::ZIP => 'zip'] as $mode => $ext) { - clearstatcache(); - $phar = new PharData(__DIR__ . '/test77022.' . $ext, null, null, $mode); - $phar->addFile($sFile, 'test-file-phar'); - $phar->addFromString("test-from-string", 'test-file-phar'); - $phar->extractTo(__DIR__); - var_dump(decoct(stat(__DIR__ . '/test-file-phar')['mode'])); - var_dump(decoct(stat(__DIR__ . '/test-from-string')['mode'])); - unlink(__DIR__ . '/test-file-phar'); - unlink(__DIR__ . '/test-from-string'); - unlink(__DIR__ . '/test77022.' . $ext); + clearstatcache(); + $phar = new PharData(__DIR__ . '/test77022.' . $ext, null, null, $mode); + $phar->addFile($sFile, 'test-file-phar'); + $phar->addFromString("test-from-string", 'test-file-phar'); + $phar->extractTo(__DIR__); + var_dump(decoct(stat(__DIR__ . '/test-file-phar')['mode'])); + var_dump(decoct(stat(__DIR__ . '/test-from-string')['mode'])); + unlink(__DIR__ . '/test-file-phar'); + unlink(__DIR__ . '/test-from-string'); + unlink(__DIR__ . '/test77022.' . $ext); } unlink($sFile); ?> diff --git a/ext/phar/tests/bug77143.phpt b/ext/phar/tests/bug77143.phpt index f9f80fc4f4..c19c9ed610 100644 --- a/ext/phar/tests/bug77143.phpt +++ b/ext/phar/tests/bug77143.phpt @@ -11,7 +11,7 @@ try { var_dump(new Phar('bug77143.phar',0,'project.phar')); echo "OK\n"; } catch(UnexpectedValueException $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> --EXPECTF-- diff --git a/ext/phar/tests/bug77247.phpt b/ext/phar/tests/bug77247.phpt index 588975f9f2..3f7949293d 100644 --- a/ext/phar/tests/bug77247.phpt +++ b/ext/phar/tests/bug77247.phpt @@ -7,7 +7,7 @@ PHP bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext) try { var_dump(new Phar('a/.b', 0,'test.phar')); } catch(UnexpectedValueException $e) { - echo "OK"; + echo "OK"; } ?> --EXPECT-- diff --git a/ext/phar/tests/cache_list/files/blog.phar.inc b/ext/phar/tests/cache_list/files/blog.phar.inc index 62d86c5c3f..a73f0c89ce 100644 --- a/ext/phar/tests/cache_list/files/blog.phar.inc +++ b/ext/phar/tests/cache_list/files/blog.phar.inc @@ -10,8 +10,8 @@ $phar->setStub('<?php if(file_exists(dirname(__FILE__) . "/files/config.xml")) { Phar::webPhar("blog", "index.php"); __HALT_COMPILER(); ?>'); $phar['index.php'] = '<?php if (!file_exists("config.xml")) { - include "install.php"; - exit; + include "install.php"; + exit; } var_dump(file_get_contents("config.xml")); ?>'; diff --git a/ext/phar/tests/cache_list/files/phar_oo_test.inc b/ext/phar/tests/cache_list/files/phar_oo_test.inc index 0691e4dc80..38443add61 100644 --- a/ext/phar/tests/cache_list/files/phar_oo_test.inc +++ b/ext/phar/tests/cache_list/files/phar_oo_test.inc @@ -12,23 +12,23 @@ if (!isset($pharconfig)) $pharconfig = 0; switch($pharconfig) { - default: - case 0: - $files['a.php'] = '<?php echo "This is a.php\n"; ?>'; - $files['b.php'] = '<?php echo "This is b.php\n"; ?>'; - $files['b/c.php'] = '<?php echo "This is b/c.php\n"; ?>'; - $files['b/d.php'] = '<?php echo "This is b/d.php\n"; ?>'; - $files['e.php'] = '<?php echo "This is e.php\n"; ?>'; - break; - case 1: - $files['a.csv'] =<<<EOF + default: + case 0: + $files['a.php'] = '<?php echo "This is a.php\n"; ?>'; + $files['b.php'] = '<?php echo "This is b.php\n"; ?>'; + $files['b/c.php'] = '<?php echo "This is b/c.php\n"; ?>'; + $files['b/d.php'] = '<?php echo "This is b/d.php\n"; ?>'; + $files['e.php'] = '<?php echo "This is e.php\n"; ?>'; + break; + case 1: + $files['a.csv'] =<<<EOF 1,2,3 2,a,b 3,"c","'e'" EOF; - break; - case 2: - $files['a.csv'] =<<<EOF + break; + case 2: + $files['a.csv'] =<<<EOF 1,2,3 2,a,b 3,"c","'e'" @@ -37,10 +37,10 @@ EOF; 7,777 EOF; - break; - case 3: - $files['a.php'] = '<?php echo new new class;'; - break; + break; + case 3: + $files['a.php'] = '<?php echo new new class;'; + break; } $ftime = mktime(12, 0, 0, 3, 1, 2006); diff --git a/ext/phar/tests/cache_list/files/phar_test.inc b/ext/phar/tests/cache_list/files/phar_test.inc index 5f0031f560..bae9415aac 100644 --- a/ext/phar/tests/cache_list/files/phar_test.inc +++ b/ext/phar/tests/cache_list/files/phar_test.inc @@ -7,43 +7,43 @@ $glags = 0; foreach($files as $name => $cont) { - global $gflags, $files; - - $comp = NULL; - $crc32= NULL; - $clen = NULL; - $ulen = NULL; - $time = isset($ftime) ? $ftime : @mktime(12, 0, 0, 3, 1, 2006); - $flags= 0; - $perm = 0x000001B6; - $meta = NULL; - - // overwrite if array - if (is_array($cont)) - { - foreach(array('comp','crc32','clen','ulen','time','flags','perm','meta','cont') as $what) - { - if (isset($cont[$what])) - { - $$what = $cont[$what]; - } - } - } - - // create if not yet done - if (empty($comp)) $comp = $cont; - if (empty($ulen)) $ulen = strlen($cont); - if (empty($clen)) $clen = strlen($comp); - if (empty($crc32))$crc32= crc32((binary)$cont); - if (isset($meta)) $meta = serialize($meta); - - // write manifest entry - $manifest .= pack('V', strlen($name)) . (binary)$name; - $manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . (binary)$meta; - - // globals - $gflags |= $flags; - $files[$name] = $comp; + global $gflags, $files; + + $comp = NULL; + $crc32= NULL; + $clen = NULL; + $ulen = NULL; + $time = isset($ftime) ? $ftime : @mktime(12, 0, 0, 3, 1, 2006); + $flags= 0; + $perm = 0x000001B6; + $meta = NULL; + + // overwrite if array + if (is_array($cont)) + { + foreach(array('comp','crc32','clen','ulen','time','flags','perm','meta','cont') as $what) + { + if (isset($cont[$what])) + { + $$what = $cont[$what]; + } + } + } + + // create if not yet done + if (empty($comp)) $comp = $cont; + if (empty($ulen)) $ulen = strlen($cont); + if (empty($clen)) $clen = strlen($comp); + if (empty($crc32))$crc32= crc32((binary)$cont); + if (isset($meta)) $meta = serialize($meta); + + // write manifest entry + $manifest .= pack('V', strlen($name)) . (binary)$name; + $manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . (binary)$meta; + + // globals + $gflags |= $flags; + $files[$name] = $comp; } if (!isset($alias)) $alias = 'hio'; @@ -56,21 +56,21 @@ $file .= pack('V', strlen($manifest)) . $manifest; foreach($files as $cont) { - $file .= (binary)$cont; + $file .= (binary)$cont; } file_put_contents($fname, $file); if (@$gzip) { - $fp = gzopen($fname, 'w'); - fwrite($fp, $file); - fclose($fp); + $fp = gzopen($fname, 'w'); + fwrite($fp, $file); + fclose($fp); } if (@$bz2) { - $fp = bzopen($fname, 'w'); - fwrite($fp, $file); - fclose($fp); + $fp = bzopen($fname, 'w'); + fwrite($fp, $file); + fclose($fp); } ?> diff --git a/ext/phar/tests/cache_list/files/write5.phar.inc b/ext/phar/tests/cache_list/files/write5.phar.inc index 5e7b9bb886..1cb6b4e4c0 100644 --- a/ext/phar/tests/cache_list/files/write5.phar.inc +++ b/ext/phar/tests/cache_list/files/write5.phar.inc @@ -16,11 +16,11 @@ var_dump($arr); $phar2 = new Phar(__FILE__); $arr = array(); foreach ($phar2 as $name => $file) { - $arr[$name] = $file->getContent(); + $arr[$name] = $file->getContent(); } ksort($arr); foreach ($arr as $name => $content) { - echo $name, " ", $content; + echo $name, " ", $content; } echo "ok\n"; __HALT_COMPILER(); diff --git a/ext/phar/tests/cache_list/files/write6.phar.inc b/ext/phar/tests/cache_list/files/write6.phar.inc index 3ba5db3c54..543568f5ee 100644 --- a/ext/phar/tests/cache_list/files/write6.phar.inc +++ b/ext/phar/tests/cache_list/files/write6.phar.inc @@ -17,11 +17,11 @@ var_dump($arr); $phar2 = new Phar(__FILE__); $arr = array(); foreach ($phar2 as $name => $file) { - $arr[$name] = $file->getContent(); + $arr[$name] = $file->getContent(); } ksort($arr); foreach ($arr as $name => $content) { - echo $name, " ", $content; + echo $name, " ", $content; } echo "ok\n"; __HALT_COMPILER(); diff --git a/ext/phar/tests/cached_manifest_1.phpt b/ext/phar/tests/cached_manifest_1.phpt index 55669b6956..f3d065e56f 100644 --- a/ext/phar/tests/cached_manifest_1.phpt +++ b/ext/phar/tests/cached_manifest_1.phpt @@ -15,7 +15,7 @@ while (false !== ($b = readdir($a))) { var_dump($b); } foreach (new RecursiveIteratorIterator(new Phar($pname)) as $f) { - var_dump($f->getPathName()); + var_dump($f->getPathName()); } var_dump(is_dir($pname . '/b')); var_dump(is_dir($pname . '/d')); diff --git a/ext/phar/tests/create_new_phar.phpt b/ext/phar/tests/create_new_phar.phpt index 078d75491a..73aca42528 100644 --- a/ext/phar/tests/create_new_phar.phpt +++ b/ext/phar/tests/create_new_phar.phpt @@ -9,12 +9,12 @@ phar.require_hash=1 <?php file_put_contents('phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/a.php', - "brand new!\n"); + "brand new!\n"); include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/a.php'; $fileName = "ChineseFile\xE5\x84\xB7\xE9\xBB\x91.php"; file_put_contents('phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/$fileName.php', - 'Text in utf8 file.'); + 'Text in utf8 file.'); include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/$fileName.php'; ?> diff --git a/ext/phar/tests/create_new_phar_b.phpt b/ext/phar/tests/create_new_phar_b.phpt index 3dc142b94c..3a531fd1e4 100644 --- a/ext/phar/tests/create_new_phar_b.phpt +++ b/ext/phar/tests/create_new_phar_b.phpt @@ -9,7 +9,7 @@ phar.require_hash=1 <?php file_put_contents('phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/a.php', - 'brand new!'); + 'brand new!'); include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/a.php'; ?> diff --git a/ext/phar/tests/create_new_phar_c.phpt b/ext/phar/tests/create_new_phar_c.phpt index dc52dbf45b..547544d758 100644 --- a/ext/phar/tests/create_new_phar_c.phpt +++ b/ext/phar/tests/create_new_phar_c.phpt @@ -9,7 +9,7 @@ phar.require_hash=1 <?php file_put_contents('phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/a.php', - 'brand new!'); + 'brand new!'); $phar = new Phar(__DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php'); diff --git a/ext/phar/tests/create_path_error.phpt b/ext/phar/tests/create_path_error.phpt index 955342d077..ff4fa4530a 100644 --- a/ext/phar/tests/create_path_error.phpt +++ b/ext/phar/tests/create_path_error.phpt @@ -21,7 +21,7 @@ var_dump(file_get_contents($pname . '/b.php')); function error_handler($errno, $errmsg) { - echo "Error: $errmsg"; + echo "Error: $errmsg"; } set_error_handler('error_handler'); @@ -39,24 +39,24 @@ $checks = array( ); foreach($checks as $check) { - $count++; - echo "$count:"; - file_put_contents($pname . '/' . $check, "error"); - echo "\n"; + $count++; + echo "$count:"; + file_put_contents($pname . '/' . $check, "error"); + echo "\n"; } $phar = new Phar($fname); $checks = array("a\0"); foreach($checks as $check) { - try - { - $phar[$check] = 'error'; - } - catch (TypeError $e) - { - echo 'Exception: ' . $e->getMessage() . "\n"; - } + try + { + $phar[$check] = 'error'; + } + catch (TypeError $e) + { + echo 'Exception: ' . $e->getMessage() . "\n"; + } } ?> diff --git a/ext/phar/tests/files/blog.phar.inc b/ext/phar/tests/files/blog.phar.inc index c2599abef8..a3b4a82f20 100644 --- a/ext/phar/tests/files/blog.phar.inc +++ b/ext/phar/tests/files/blog.phar.inc @@ -12,8 +12,8 @@ if(file_exists(dirname(__FILE__) . "/files/config.xml")) { Phar::webPhar("blog", "index.php"); __HALT_COMPILER(); ?>'); $phar['index.php'] = '<?php if (!file_exists("config.xml")) { - include "install.php"; - exit; + include "install.php"; + exit; } var_dump(str_replace("\r\n", "\n", file_get_contents("config.xml"))); ?>'; diff --git a/ext/phar/tests/files/phar_oo_test.inc b/ext/phar/tests/files/phar_oo_test.inc index 3883d494c1..a6f4cee5ee 100644 --- a/ext/phar/tests/files/phar_oo_test.inc +++ b/ext/phar/tests/files/phar_oo_test.inc @@ -13,23 +13,23 @@ if (!isset($pharconfig)) $pharconfig = 0; switch($pharconfig) { - default: - case 0: - $files['a.php'] = '<?php echo "This is a.php\n"; ?>'; - $files['b.php'] = '<?php echo "This is b.php\n"; ?>'; - $files['b/c.php'] = '<?php echo "This is b/c.php\n"; ?>'; - $files['b/d.php'] = '<?php echo "This is b/d.php\n"; ?>'; - $files['e.php'] = '<?php echo "This is e.php\n"; ?>'; - break; - case 1: - $files['a.csv'] =<<<EOF + default: + case 0: + $files['a.php'] = '<?php echo "This is a.php\n"; ?>'; + $files['b.php'] = '<?php echo "This is b.php\n"; ?>'; + $files['b/c.php'] = '<?php echo "This is b/c.php\n"; ?>'; + $files['b/d.php'] = '<?php echo "This is b/d.php\n"; ?>'; + $files['e.php'] = '<?php echo "This is e.php\n"; ?>'; + break; + case 1: + $files['a.csv'] =<<<EOF 1,2,3 2,a,b 3,"c","'e'" EOF; - break; - case 2: - $files['a.csv'] =<<<EOF + break; + case 2: + $files['a.csv'] =<<<EOF 1,2,3 2,a,b 3,"c","'e'" @@ -38,10 +38,10 @@ EOF; 7,777 EOF; - break; - case 3: - $files['a.php'] = '<?php echo new new class;'; - break; + break; + case 3: + $files['a.php'] = '<?php echo new new class;'; + break; } $ftime = mktime(12, 0, 0, 3, 1, 2006); diff --git a/ext/phar/tests/files/phar_test.inc b/ext/phar/tests/files/phar_test.inc index 6a75334cdd..f5279a93d2 100644 --- a/ext/phar/tests/files/phar_test.inc +++ b/ext/phar/tests/files/phar_test.inc @@ -7,43 +7,43 @@ $gflags = 0; foreach($files as $name => $cont) { - global $gflags, $files; - - $comp = NULL; - $crc32= NULL; - $clen = NULL; - $ulen = NULL; - $time = isset($ftime) ? $ftime : @mktime(12, 0, 0, 3, 1, 2006); - $flags= 0; - $perm = 0x000001B6; - $meta = NULL; - - // overwrite if array - if (is_array($cont)) - { - foreach(array('comp','crc32','clen','ulen','time','flags','perm','meta','cont') as $what) - { - if (isset($cont[$what])) - { - $$what = $cont[$what]; - } - } - } - - // create if not yet done - if (empty($comp)) $comp = $cont; - if (empty($ulen)) $ulen = strlen($cont); - if (empty($clen)) $clen = strlen($comp); - if (empty($crc32))$crc32= crc32((binary)$cont); - if (isset($meta)) $meta = serialize($meta); - - // write manifest entry - $manifest .= pack('V', strlen($name)) . (binary)$name; - $manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . (binary)$meta; - - // globals - $gflags |= $flags; - $files[$name] = $comp; + global $gflags, $files; + + $comp = NULL; + $crc32= NULL; + $clen = NULL; + $ulen = NULL; + $time = isset($ftime) ? $ftime : @mktime(12, 0, 0, 3, 1, 2006); + $flags= 0; + $perm = 0x000001B6; + $meta = NULL; + + // overwrite if array + if (is_array($cont)) + { + foreach(array('comp','crc32','clen','ulen','time','flags','perm','meta','cont') as $what) + { + if (isset($cont[$what])) + { + $$what = $cont[$what]; + } + } + } + + // create if not yet done + if (empty($comp)) $comp = $cont; + if (empty($ulen)) $ulen = strlen($cont); + if (empty($clen)) $clen = strlen($comp); + if (empty($crc32))$crc32= crc32((binary)$cont); + if (isset($meta)) $meta = serialize($meta); + + // write manifest entry + $manifest .= pack('V', strlen($name)) . (binary)$name; + $manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . (binary)$meta; + + // globals + $gflags |= $flags; + $files[$name] = $comp; } if (!isset($alias)) $alias = 'hio'; @@ -56,21 +56,21 @@ $file .= pack('V', strlen($manifest)) . $manifest; foreach($files as $cont) { - $file .= (binary)$cont; + $file .= (binary)$cont; } file_put_contents($fname, $file); if (@$gzip) { - $fp = gzopen($fname, 'w'); - fwrite($fp, $file); - fclose($fp); + $fp = gzopen($fname, 'w'); + fwrite($fp, $file); + fclose($fp); } if (@$bz2) { - $fp = bzopen($fname, 'w'); - fwrite($fp, $file); - fclose($fp); + $fp = bzopen($fname, 'w'); + fwrite($fp, $file); + fclose($fp); } ?> diff --git a/ext/phar/tests/invalid_alias.phpt b/ext/phar/tests/invalid_alias.phpt index 255bef52d7..9039b8aa0d 100644 --- a/ext/phar/tests/invalid_alias.phpt +++ b/ext/phar/tests/invalid_alias.phpt @@ -10,26 +10,26 @@ $fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar'; $p = new Phar($fname); try { - $p->setAlias('hi/'); + $p->setAlias('hi/'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - $p->setAlias('hi\\l'); + $p->setAlias('hi\\l'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - $p->setAlias('hil;'); + $p->setAlias('hil;'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - $p->setAlias(':hil'); + $p->setAlias(':hil'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/invalid_setstubalias.phpt b/ext/phar/tests/invalid_setstubalias.phpt index 5456662709..df1b8c90c9 100644 --- a/ext/phar/tests/invalid_setstubalias.phpt +++ b/ext/phar/tests/invalid_setstubalias.phpt @@ -11,25 +11,25 @@ $fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip'; $p = new Phar($fname); try { - $p['.phar/stub.php'] = 'hi'; + $p['.phar/stub.php'] = 'hi'; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - $p['.phar/alias.txt'] = 'hi'; + $p['.phar/alias.txt'] = 'hi'; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } $p = new Phar($fname2); try { - $p['.phar/stub.php'] = 'hi'; + $p['.phar/stub.php'] = 'hi'; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - $p['.phar/alias.txt'] = 'hi'; + $p['.phar/alias.txt'] = 'hi'; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/phar/tests/metadata_read.phpt b/ext/phar/tests/metadata_read.phpt index f67bf692d8..5450dee801 100644 --- a/ext/phar/tests/metadata_read.phpt +++ b/ext/phar/tests/metadata_read.phpt @@ -20,18 +20,18 @@ $files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar')); include 'files/phar_test.inc'; foreach($files as $name => $cont) { - var_dump(file_get_contents($pname.'/'.$name)); + var_dump(file_get_contents($pname.'/'.$name)); } $phar = new Phar($fname); foreach($files as $name => $cont) { - var_dump($phar[$name]->getMetadata()); + var_dump($phar[$name]->getMetadata()); } unset($phar); foreach($files as $name => $cont) { - var_dump(file_get_contents($pname.'/'.$name)); + var_dump(file_get_contents($pname.'/'.$name)); } ?> --CLEAN-- diff --git a/ext/phar/tests/metadata_write.phpt b/ext/phar/tests/metadata_write.phpt index fefa2bc0c0..56d2956aab 100644 --- a/ext/phar/tests/metadata_write.phpt +++ b/ext/phar/tests/metadata_write.phpt @@ -21,7 +21,7 @@ $files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar')); include 'files/phar_test.inc'; foreach($files as $name => $cont) { - var_dump(file_get_contents($pname.'/'.$name)); + var_dump(file_get_contents($pname.'/'.$name)); } $phar = new Phar($fname); @@ -31,13 +31,13 @@ $phar['c']->setMetadata(array(25, 'foo'=>'bar')); $phar['d']->setMetadata(true); foreach($files as $name => $cont) { - var_dump($phar[$name]->getMetadata()); + var_dump($phar[$name]->getMetadata()); } unset($phar); foreach($files as $name => $cont) { - var_dump(file_get_contents($pname.'/'.$name)); + var_dump(file_get_contents($pname.'/'.$name)); } ?> --CLEAN-- diff --git a/ext/phar/tests/metadata_write_commit.phpt b/ext/phar/tests/metadata_write_commit.phpt index 02fceee29d..2fdd6fd884 100644 --- a/ext/phar/tests/metadata_write_commit.phpt +++ b/ext/phar/tests/metadata_write_commit.phpt @@ -21,7 +21,7 @@ $files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar')); include 'files/phar_test.inc'; foreach($files as $name => $cont) { - var_dump(file_get_contents($pname.'/'.$name)); + var_dump(file_get_contents($pname.'/'.$name)); } $phar = new Phar($fname); @@ -32,7 +32,7 @@ $phar['c']->setMetadata(array(25, 'foo'=>'bar')); $phar['d']->setMetadata(true); foreach($files as $name => $cont) { - var_dump($phar[$name]->getMetadata()); + var_dump($phar[$name]->getMetadata()); } $phar->stopBuffering(); @@ -41,11 +41,11 @@ unset($phar); $phar = new Phar($fname); foreach($files as $name => $cont) { - var_dump(file_get_contents($pname.'/'.$name)); + var_dump(file_get_contents($pname.'/'.$name)); } foreach($files as $name => $cont) { - var_dump($phar[$name]->getMetadata()); + var_dump($phar[$name]->getMetadata()); } ?> --CLEAN-- diff --git a/ext/phar/tests/mounteddir.phpt b/ext/phar/tests/mounteddir.phpt index 5e2e94ad71..fe28a56919 100644 --- a/ext/phar/tests/mounteddir.phpt +++ b/ext/phar/tests/mounteddir.phpt @@ -47,19 +47,19 @@ include $fname; $a = opendir($pname . '/testit'); $out = array(); while (false !== ($b = readdir($a))) { - $out[] = $b; + $out[] = $b; } sort($out); foreach ($out as $b) { - echo "$b\n"; + echo "$b\n"; } $out = array(); foreach (new Phar($pname . '/testit') as $b) { - $out[] = $b->getPathName(); + $out[] = $b->getPathName(); } sort($out); foreach ($out as $b) { - echo "$b\n"; + echo "$b\n"; } try { Phar::mount($pname . '/testit', 'another\\..\\mistake'); diff --git a/ext/phar/tests/opendir.phpt b/ext/phar/tests/opendir.phpt index f3f437d67c..3bccb5c4a2 100644 --- a/ext/phar/tests/opendir.phpt +++ b/ext/phar/tests/opendir.phpt @@ -12,9 +12,9 @@ $a = new Phar($fname); $a['index.php'] = '<?php $a = opendir("dir"); if ($a) { - while (false !== ($e = readdir($a))) { - echo $e; - } + while (false !== ($e = readdir($a))) { + echo $e; + } } ?>'; $a['dir/file1.txt'] = 'hi'; diff --git a/ext/phar/tests/phar_buildfromdirectory1.phpt b/ext/phar/tests/phar_buildfromdirectory1.phpt index 71afd1647b..62a3689072 100644 --- a/ext/phar/tests/phar_buildfromdirectory1.phpt +++ b/ext/phar/tests/phar_buildfromdirectory1.phpt @@ -9,11 +9,11 @@ phar.readonly=0 <?php $phar = new Phar(__DIR__ . '/buildfromdirectory1.phar'); try { - ini_set('phar.readonly', 1); - $phar->buildFromDirectory(1); + ini_set('phar.readonly', 1); + $phar->buildFromDirectory(1); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_buildfromdirectory2-win.phpt b/ext/phar/tests/phar_buildfromdirectory2-win.phpt index be8ee60b52..e67d036388 100644 --- a/ext/phar/tests/phar_buildfromdirectory2-win.phpt +++ b/ext/phar/tests/phar_buildfromdirectory2-win.phpt @@ -11,11 +11,11 @@ phar.readonly=0 --FILE-- <?php try { - $phar = new Phar(__DIR__ . '/buildfromdirectory2.phar'); - $phar->buildFromDirectory(1); + $phar = new Phar(__DIR__ . '/buildfromdirectory2.phar'); + $phar->buildFromDirectory(1); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_buildfromdirectory2.phpt b/ext/phar/tests/phar_buildfromdirectory2.phpt index e92b94eb1b..d02d6146d6 100644 --- a/ext/phar/tests/phar_buildfromdirectory2.phpt +++ b/ext/phar/tests/phar_buildfromdirectory2.phpt @@ -11,11 +11,11 @@ phar.readonly=0 --FILE-- <?php try { - $phar = new Phar(__DIR__ . '/buildfromdirectory2.phar'); - $phar->buildFromDirectory(1); + $phar = new Phar(__DIR__ . '/buildfromdirectory2.phar'); + $phar->buildFromDirectory(1); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_buildfromdirectory4.phpt b/ext/phar/tests/phar_buildfromdirectory4.phpt index 78bc0f2f8b..a492592c55 100644 --- a/ext/phar/tests/phar_buildfromdirectory4.phpt +++ b/ext/phar/tests/phar_buildfromdirectory4.phpt @@ -15,13 +15,13 @@ foreach(range(1, 4) as $i) { } try { - $phar = new Phar(__DIR__ . '/buildfromdirectory4.phar'); - $a = $phar->buildFromDirectory(__DIR__ . '/testdir4'); - asort($a); - var_dump($a); + $phar = new Phar(__DIR__ . '/buildfromdirectory4.phar'); + $a = $phar->buildFromDirectory(__DIR__ . '/testdir4'); + asort($a); + var_dump($a); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } var_dump(file_exists(__DIR__ . '/buildfromdirectory4.phar')); diff --git a/ext/phar/tests/phar_buildfromdirectory5.phpt b/ext/phar/tests/phar_buildfromdirectory5.phpt index d1402dd078..f5c48ee163 100644 --- a/ext/phar/tests/phar_buildfromdirectory5.phpt +++ b/ext/phar/tests/phar_buildfromdirectory5.phpt @@ -14,13 +14,13 @@ foreach(range(1, 4) as $i) { } try { - $phar = new Phar(__DIR__ . '/buildfromdirectory5.phar'); - $a = $phar->buildFromDirectory(__DIR__ . '/testdir5', '/\.txt/'); - asort($a); - var_dump($a); + $phar = new Phar(__DIR__ . '/buildfromdirectory5.phar'); + $a = $phar->buildFromDirectory(__DIR__ . '/testdir5', '/\.txt/'); + asort($a); + var_dump($a); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } var_dump(file_exists(__DIR__ . '/buildfromdirectory5.phar')); diff --git a/ext/phar/tests/phar_buildfromdirectory6.phpt b/ext/phar/tests/phar_buildfromdirectory6.phpt index 3780ffbb17..e25439a64b 100644 --- a/ext/phar/tests/phar_buildfromdirectory6.phpt +++ b/ext/phar/tests/phar_buildfromdirectory6.phpt @@ -14,11 +14,11 @@ foreach(range(1, 4) as $i) { } try { - $phar = new Phar(__DIR__ . '/buildfromdirectory6.phar'); - var_dump($phar->buildFromDirectory(__DIR__ . '/testdir6', '/\.php$/')); + $phar = new Phar(__DIR__ . '/buildfromdirectory6.phar'); + var_dump($phar->buildFromDirectory(__DIR__ . '/testdir6', '/\.php$/')); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } var_dump(file_exists(__DIR__ . '/buildfromdirectory6.phar')); diff --git a/ext/phar/tests/phar_buildfromiterator1.phpt b/ext/phar/tests/phar_buildfromiterator1.phpt index bd81538a0b..aac85ff33e 100644 --- a/ext/phar/tests/phar_buildfromiterator1.phpt +++ b/ext/phar/tests/phar_buildfromiterator1.phpt @@ -9,11 +9,11 @@ phar.readonly=0 <?php $phar = new Phar(__DIR__ . '/buildfromiterator1.phar'); try { - ini_set('phar.readonly', 1); - $phar->buildFromIterator(1); + ini_set('phar.readonly', 1); + $phar->buildFromIterator(1); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_buildfromiterator10.phpt b/ext/phar/tests/phar_buildfromiterator10.phpt index 735a53f656..6db0c93cdd 100644 --- a/ext/phar/tests/phar_buildfromiterator10.phpt +++ b/ext/phar/tests/phar_buildfromiterator10.phpt @@ -10,16 +10,16 @@ phar.readonly=0 --FILE-- <?php try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator10.phar'); - $dir = new RecursiveDirectoryIterator('.'); - $iter = new RecursiveIteratorIterator($dir); - $a = $phar->buildFromIterator(new RegexIterator($iter, '/_\d{3}\.phpt$/'), __DIR__ . DIRECTORY_SEPARATOR); - asort($a); - var_dump($a); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator10.phar'); + $dir = new RecursiveDirectoryIterator('.'); + $iter = new RecursiveIteratorIterator($dir); + $a = $phar->buildFromIterator(new RegexIterator($iter, '/_\d{3}\.phpt$/'), __DIR__ . DIRECTORY_SEPARATOR); + asort($a); + var_dump($a); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_buildfromiterator4.phpt b/ext/phar/tests/phar_buildfromiterator4.phpt index 14266bab54..fbe51fd1a3 100644 --- a/ext/phar/tests/phar_buildfromiterator4.phpt +++ b/ext/phar/tests/phar_buildfromiterator4.phpt @@ -36,19 +36,19 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator4.phar'); - var_dump($phar->buildFromIterator(new myIterator( - array( - 'a' => basename(__FILE__, 'php') . 'phpt', - // demonstrate that none of these are added - '.phar/stub.php' => basename(__FILE__, 'php') . 'phpt', - '.phar/alias.txt' => basename(__FILE__, 'php') . 'phpt', - '.phar/oops' => basename(__FILE__, 'php') . 'phpt', - )))); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator4.phar'); + var_dump($phar->buildFromIterator(new myIterator( + array( + 'a' => basename(__FILE__, 'php') . 'phpt', + // demonstrate that none of these are added + '.phar/stub.php' => basename(__FILE__, 'php') . 'phpt', + '.phar/alias.txt' => basename(__FILE__, 'php') . 'phpt', + '.phar/oops' => basename(__FILE__, 'php') . 'phpt', + )))); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_buildfromiterator5.phpt b/ext/phar/tests/phar_buildfromiterator5.phpt index 9417f9a84c..57b1328293 100644 --- a/ext/phar/tests/phar_buildfromiterator5.phpt +++ b/ext/phar/tests/phar_buildfromiterator5.phpt @@ -36,12 +36,12 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator5.phar'); - var_dump($phar->buildFromIterator(new myIterator(array('a' => new stdClass)))); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator5.phar'); + var_dump($phar->buildFromIterator(new myIterator(array('a' => new stdClass)))); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_buildfromiterator6.phpt b/ext/phar/tests/phar_buildfromiterator6.phpt index 982c094caa..612b114e9b 100644 --- a/ext/phar/tests/phar_buildfromiterator6.phpt +++ b/ext/phar/tests/phar_buildfromiterator6.phpt @@ -36,12 +36,12 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator6.phar'); - var_dump($phar->buildFromIterator(new myIterator(array(basename(__FILE__, 'php') . 'phpt')))); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator6.phar'); + var_dump($phar->buildFromIterator(new myIterator(array(basename(__FILE__, 'php') . 'phpt')))); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_buildfromiterator7.phpt b/ext/phar/tests/phar_buildfromiterator7.phpt index aa0cd7bf48..d3fa437a18 100644 --- a/ext/phar/tests/phar_buildfromiterator7.phpt +++ b/ext/phar/tests/phar_buildfromiterator7.phpt @@ -36,12 +36,12 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator7.phar'); - var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt')))); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator7.phar'); + var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt')))); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_buildfromiterator8.phpt b/ext/phar/tests/phar_buildfromiterator8.phpt index ff50fd7748..b3dc947d9e 100644 --- a/ext/phar/tests/phar_buildfromiterator8.phpt +++ b/ext/phar/tests/phar_buildfromiterator8.phpt @@ -7,14 +7,14 @@ phar.readonly=0 --FILE-- <?php try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator8.phar'); - $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^\d{0,3}\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR); - asort($a); - var_dump($a); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator8.phar'); + $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^\d{0,3}\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR); + asort($a); + var_dump($a); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_buildfromiterator9.phpt b/ext/phar/tests/phar_buildfromiterator9.phpt index 9dd091eee5..20637453e0 100644 --- a/ext/phar/tests/phar_buildfromiterator9.phpt +++ b/ext/phar/tests/phar_buildfromiterator9.phpt @@ -36,13 +36,13 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator9.phar'); - var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r'))))); - fclose($a); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator9.phar'); + var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r'))))); + fclose($a); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_construct_invalidurl.phpt b/ext/phar/tests/phar_construct_invalidurl.phpt index 295159fd0b..2b39cc7659 100644 --- a/ext/phar/tests/phar_construct_invalidurl.phpt +++ b/ext/phar/tests/phar_construct_invalidurl.phpt @@ -7,19 +7,19 @@ default_charset=UTF-8 --FILE-- <?php try { - $a = new Phar('http://should.fail.com'); + $a = new Phar('http://should.fail.com'); } catch (UnexpectedValueException $e) { - echo $e->getMessage(),"\n"; + echo $e->getMessage(),"\n"; } try { - $a = new Phar('http://'); + $a = new Phar('http://'); } catch (UnexpectedValueException $e) { - echo $e->getMessage(),"\n"; + echo $e->getMessage(),"\n"; } try { - $a = new Phar('http:/'); + $a = new Phar('http:/'); } catch (UnexpectedValueException $e) { - echo $e->getMessage(),"\n"; + echo $e->getMessage(),"\n"; } ?> --EXPECT-- diff --git a/ext/phar/tests/phar_convert_repeated_b.phpt b/ext/phar/tests/phar_convert_repeated_b.phpt index 484789cf1f..4bb3e81bcf 100644 --- a/ext/phar/tests/phar_convert_repeated_b.phpt +++ b/ext/phar/tests/phar_convert_repeated_b.phpt @@ -43,14 +43,14 @@ var_dump($phar->getAlias()); echo "================= convertToPhar() ====================\n"; try { - $phar = $phar->convertToExecutable(Phar::PHAR); - var_dump($phar->isFileFormat(Phar::PHAR)); - var_dump($phar->isFileFormat(Phar::TAR)); - var_dump($phar->isFileFormat(Phar::ZIP)); - var_dump(strlen($phar->getStub())); - var_dump($phar->getAlias()); + $phar = $phar->convertToExecutable(Phar::PHAR); + var_dump($phar->isFileFormat(Phar::PHAR)); + var_dump($phar->isFileFormat(Phar::TAR)); + var_dump($phar->isFileFormat(Phar::ZIP)); + var_dump(strlen($phar->getStub())); + var_dump($phar->getAlias()); } catch(Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } echo "================ convertToTar(GZ) ====================\n"; @@ -65,14 +65,14 @@ var_dump($phar->getAlias()); echo "================= convertToPhar() ====================\n"; try { - $phar = $phar->convertToExecutable(Phar::PHAR); - var_dump($phar->isFileFormat(Phar::PHAR)); - var_dump($phar->isFileFormat(Phar::TAR)); - var_dump($phar->isFileFormat(Phar::ZIP)); - var_dump(strlen($phar->getStub())); - var_dump($phar->getAlias()); + $phar = $phar->convertToExecutable(Phar::PHAR); + var_dump($phar->isFileFormat(Phar::PHAR)); + var_dump($phar->isFileFormat(Phar::TAR)); + var_dump($phar->isFileFormat(Phar::ZIP)); + var_dump(strlen($phar->getStub())); + var_dump($phar->getAlias()); } catch(Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_copy.phpt b/ext/phar/tests/phar_copy.phpt index 4ab45aad80..c450efaba5 100644 --- a/ext/phar/tests/phar_copy.phpt +++ b/ext/phar/tests/phar_copy.phpt @@ -20,21 +20,21 @@ $p = new Phar($fname); try { - $p['a'] = 'hi'; - $p->startBuffering(); - $p->copy('a', 'b'); - echo file_get_contents($p['b']->getPathName()); - $p['a']->compress(Phar::GZ); - $p['b']->setMetadata('a'); - $p->copy('b', 'c'); - $p->stopBuffering(); - echo file_get_contents($p['c']->getPathName()); - copy($fname, $fname2); - $p->copy('a', $ename); + $p['a'] = 'hi'; + $p->startBuffering(); + $p->copy('a', 'b'); + echo file_get_contents($p['b']->getPathName()); + $p['a']->compress(Phar::GZ); + $p['b']->setMetadata('a'); + $p->copy('b', 'c'); + $p->stopBuffering(); + echo file_get_contents($p['c']->getPathName()); + copy($fname, $fname2); + $p->copy('a', $ename); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ini_set('phar.readonly',1); $p2 = new Phar($fname2); diff --git a/ext/phar/tests/phar_create_in_cwd.phpt b/ext/phar/tests/phar_create_in_cwd.phpt index 3a7b38f698..2f5af26c41 100644 --- a/ext/phar/tests/phar_create_in_cwd.phpt +++ b/ext/phar/tests/phar_create_in_cwd.phpt @@ -9,10 +9,10 @@ phar.readonly=0 <?php chdir(__DIR__); try { - $p = new Phar('phar_create_in_cwd.phar'); - $p['file1.txt'] = 'hi'; - var_dump(strlen($p->getStub())); - $p->setStub("<?php + $p = new Phar('phar_create_in_cwd.phar'); + $p['file1.txt'] = 'hi'; + var_dump(strlen($p->getStub())); + $p->setStub("<?php spl_autoload_register(function(\$class) { include 'phar://' . str_replace('_', '/', \$class); }); @@ -20,9 +20,9 @@ Phar::mapPhar('phar_create_in_cwd.phar'); include 'phar://phar_create_in_cwd.phar/startup.php'; __HALT_COMPILER(); ?>"); - var_dump($p->getStub()); + var_dump($p->getStub()); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_dir_iterate.phpt b/ext/phar/tests/phar_dir_iterate.phpt index 95a0775a87..bc5132aade 100644 --- a/ext/phar/tests/phar_dir_iterate.phpt +++ b/ext/phar/tests/phar_dir_iterate.phpt @@ -15,7 +15,7 @@ $phar['sub/top.txt'] = 'there'; $phar['another.file.txt'] = 'wowee'; $newphar = new Phar($fname); foreach (new RecursiveIteratorIterator($newphar) as $path => $obj) { - var_dump($obj->getPathName()); + var_dump($obj->getPathName()); } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_extract.phpt b/ext/phar/tests/phar_extract.phpt index 89f3dc29a3..a354e0a608 100644 --- a/ext/phar/tests/phar_extract.phpt +++ b/ext/phar/tests/phar_extract.phpt @@ -25,13 +25,13 @@ $a->extractTo(__DIR__ . '/extract'); $out = array(); foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__ . '/extract', 0x00003000), RecursiveIteratorIterator::CHILD_FIRST) as $p => $b) { - $out[] = $p; + $out[] = $p; } sort($out); foreach ($out as $b) { - echo "$b\n"; + echo "$b\n"; } $a->extractTo(__DIR__ . '/extract1', 'file1.txt'); @@ -45,9 +45,9 @@ var_dump(file_get_contents(__DIR__ . '/extract1-2/file2.txt')); var_dump(is_dir(__DIR__ . '/extract1-2/one/level')); try { - $a->extractTo(__DIR__ . '/whatever', 134); + $a->extractTo(__DIR__ . '/whatever', 134); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } try { @@ -57,29 +57,29 @@ try { } try { - $a->extractTo(''); + $a->extractTo(''); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } file_put_contents(__DIR__ . '/oops', 'I is file'); try { - $a->extractTo(__DIR__ . '/oops', 'file1.txt'); + $a->extractTo(__DIR__ . '/oops', 'file1.txt'); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } try { - $a->extractTo(__DIR__ . '/oops1', array(array(), 'file1.txt')); + $a->extractTo(__DIR__ . '/oops1', array(array(), 'file1.txt')); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } try { - $a->extractTo(__DIR__ . '/extract', 'file1.txt'); + $a->extractTo(__DIR__ . '/extract', 'file1.txt'); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } file_put_contents(__DIR__ . '/extract/file1.txt', 'first'); @@ -89,17 +89,17 @@ $a->extractTo(__DIR__ . '/extract', 'file1.txt', true); var_dump(file_get_contents(__DIR__ . '/extract/file1.txt')); try { - $a->extractTo(str_repeat('a', 20000), 'file1.txt'); + $a->extractTo(str_repeat('a', 20000), 'file1.txt'); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } $a[str_repeat('a', 20000)] = 'long'; try { - $a->extractTo(__DIR__ . '/extract', str_repeat('a', 20000)); + $a->extractTo(__DIR__ . '/extract', str_repeat('a', 20000)); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } ?> diff --git a/ext/phar/tests/phar_extract2.phpt b/ext/phar/tests/phar_extract2.phpt index 719189fbf3..8692358827 100644 --- a/ext/phar/tests/phar_extract2.phpt +++ b/ext/phar/tests/phar_extract2.phpt @@ -24,13 +24,13 @@ $phar->extractTo(__DIR__ . '/extract2'); $out = array(); foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__ . '/extract2', 0x00003000), RecursiveIteratorIterator::CHILD_FIRST) as $path => $file) { - $extracted[] = $path; + $extracted[] = $path; } sort($extracted); foreach ($extracted as $out) { - echo "$out\n"; + echo "$out\n"; } ?> diff --git a/ext/phar/tests/phar_extract3.phpt b/ext/phar/tests/phar_extract3.phpt index f342dc6e5a..6a7e6e0815 100644 --- a/ext/phar/tests/phar_extract3.phpt +++ b/ext/phar/tests/phar_extract3.phpt @@ -14,20 +14,20 @@ $extract = __DIR__ . '/test-extract3'; $phar = new PharData($fname); try { - $phar->extractTo($extract); + $phar->extractTo($extract); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } $phar = new PharData($fname2); foreach ($phar as $filename) { - echo "$filename\n"; + echo "$filename\n"; } try { - $phar->extractTo($extract); + $phar->extractTo($extract); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } ?> diff --git a/ext/phar/tests/phar_metadata_read.phpt b/ext/phar/tests/phar_metadata_read.phpt index 56d46713f2..428daf38c8 100644 --- a/ext/phar/tests/phar_metadata_read.phpt +++ b/ext/phar/tests/phar_metadata_read.phpt @@ -22,7 +22,7 @@ $files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar')); include 'files/phar_test.inc'; foreach($files as $name => $cont) { - var_dump(file_get_contents($pname.'/'.$name)); + var_dump(file_get_contents($pname.'/'.$name)); } $phar = new Phar($fname); @@ -33,17 +33,17 @@ var_dump($phar->getMetaData()); var_dump($phar->delMetaData()); var_dump($phar->getMetaData()); foreach($files as $name => $cont) { - echo " meta $name\n"; - var_dump($phar[$name]->hasMetadata()); - var_dump($phar[$name]->getMetadata()); - var_dump($phar[$name]->delMetadata()); - var_dump($phar[$name]->getMetadata()); + echo " meta $name\n"; + var_dump($phar[$name]->hasMetadata()); + var_dump($phar[$name]->getMetadata()); + var_dump($phar[$name]->delMetadata()); + var_dump($phar[$name]->getMetadata()); } unset($phar); foreach($files as $name => $cont) { - var_dump(file_get_contents($pname.'/'.$name)); + var_dump(file_get_contents($pname.'/'.$name)); } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_metadata_write.phpt b/ext/phar/tests/phar_metadata_write.phpt index 7a70491f49..484795ecff 100644 --- a/ext/phar/tests/phar_metadata_write.phpt +++ b/ext/phar/tests/phar_metadata_write.phpt @@ -21,7 +21,7 @@ $files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar')); include 'files/phar_test.inc'; foreach($files as $name => $cont) { - var_dump(file_get_contents($pname.'/'.$name)); + var_dump(file_get_contents($pname.'/'.$name)); } $phar = new Phar($fname); @@ -35,13 +35,13 @@ $phar['c']->setMetadata(array(25, 'foo'=>'bar')); $phar['d']->setMetadata(true); foreach($files as $name => $cont) { - var_dump($phar[$name]->getMetadata()); + var_dump($phar[$name]->getMetadata()); } unset($phar); foreach($files as $name => $cont) { - var_dump(file_get_contents($pname.'/'.$name)); + var_dump(file_get_contents($pname.'/'.$name)); } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_offset_check.phpt b/ext/phar/tests/phar_offset_check.phpt index 32b67685cc..415a886446 100644 --- a/ext/phar/tests/phar_offset_check.phpt +++ b/ext/phar/tests/phar_offset_check.phpt @@ -18,45 +18,45 @@ $phar['a.txt'] = "first file\n"; $phar['b.txt'] = "second file\n"; try { - $phar->offsetGet('.phar/stub.php'); + $phar->offsetGet('.phar/stub.php'); } catch (Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } try { - $phar->offsetGet('.phar/alias.txt'); + $phar->offsetGet('.phar/alias.txt'); } catch (Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } try { - $phar->offsetSet('.phar/stub.php', '<?php __HALT_COMPILER(); ?>'); + $phar->offsetSet('.phar/stub.php', '<?php __HALT_COMPILER(); ?>'); } catch (Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } var_dump(strlen($phar->getStub())); try { - $phar->offsetUnset('.phar/stub.php'); + $phar->offsetUnset('.phar/stub.php'); } catch (Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } var_dump(strlen($phar->getStub())); try { - $phar->offsetSet('.phar/alias.txt', 'dolly'); + $phar->offsetSet('.phar/alias.txt', 'dolly'); } catch (Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } var_dump($phar->getAlias()); try { - $phar->offsetUnset('.phar/alias.txt'); + $phar->offsetUnset('.phar/alias.txt'); } catch (Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } var_dump($phar->getAlias()); diff --git a/ext/phar/tests/phar_offset_get_error.phpt b/ext/phar/tests/phar_offset_get_error.phpt index b49035fd66..6430092846 100644 --- a/ext/phar/tests/phar_offset_get_error.phpt +++ b/ext/phar/tests/phar_offset_get_error.phpt @@ -18,11 +18,11 @@ $p[$iname] = "foobar\n"; try { - $p[$ename] = "foobar\n"; + $p[$ename] = "foobar\n"; } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } include($pname . $iname); diff --git a/ext/phar/tests/phar_oo_001.phpt b/ext/phar/tests/phar_oo_001.phpt index ba93c88107..303e08c15b 100644 --- a/ext/phar/tests/phar_oo_001.phpt +++ b/ext/phar/tests/phar_oo_001.phpt @@ -18,26 +18,26 @@ var_dump(count($phar)); class MyPhar extends Phar { - function __construct() - { - } + function __construct() + { + } } try { - $phar = new MyPhar(); - var_dump($phar->getVersion()); + $phar = new MyPhar(); + var_dump($phar->getVersion()); } catch (LogicException $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } try { - $phar = new Phar('test.phar'); - $phar->__construct('oops'); + $phar = new Phar('test.phar'); + $phar->__construct('oops'); } catch (LogicException $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> diff --git a/ext/phar/tests/phar_oo_002.phpt b/ext/phar/tests/phar_oo_002.phpt index 9be0877676..85723df9a8 100644 --- a/ext/phar/tests/phar_oo_002.phpt +++ b/ext/phar/tests/phar_oo_002.phpt @@ -16,19 +16,19 @@ $phar = new Phar($fname); $phar->setInfoClass('SplFileInfo'); foreach($phar as $name => $ent) { - var_dump(str_replace(str_replace('\\', '/', __DIR__), '*', $name)); - var_dump($ent->getFilename()); - var_dump($ent->getSize()); - var_dump($ent->getType()); - var_dump($ent->isWritable()); - var_dump($ent->isReadable()); - var_dump($ent->isExecutable()); - var_dump($ent->isFile()); - var_dump($ent->isDir()); - var_dump($ent->isLink()); - var_dump($ent->getCTime()); - var_dump($ent->getMTime()); - var_dump($ent->getATime()); + var_dump(str_replace(str_replace('\\', '/', __DIR__), '*', $name)); + var_dump($ent->getFilename()); + var_dump($ent->getSize()); + var_dump($ent->getType()); + var_dump($ent->isWritable()); + var_dump($ent->isReadable()); + var_dump($ent->isExecutable()); + var_dump($ent->isFile()); + var_dump($ent->isDir()); + var_dump($ent->isLink()); + var_dump($ent->getCTime()); + var_dump($ent->getMTime()); + var_dump($ent->getATime()); } echo "==RECURSIVE==\n"; @@ -36,12 +36,12 @@ echo "==RECURSIVE==\n"; $phar = new Phar($fname); foreach(new RecursiveIteratorIterator($phar) as $name => $ent) { - var_dump(str_replace(str_replace('\\', '/', __DIR__), '*', $name)); - var_dump(str_replace('\\', '/', $ent->getFilename())); - var_dump($ent->getCompressedSize()); - var_dump($ent->isCRCChecked()); - var_dump($ent->isCRCChecked() ? $ent->getCRC32() : NULL); - var_dump($ent->getPharFlags()); + var_dump(str_replace(str_replace('\\', '/', __DIR__), '*', $name)); + var_dump(str_replace('\\', '/', $ent->getFilename())); + var_dump($ent->getCompressedSize()); + var_dump($ent->isCRCChecked()); + var_dump($ent->isCRCChecked() ? $ent->getCRC32() : NULL); + var_dump($ent->getPharFlags()); } ?> diff --git a/ext/phar/tests/phar_oo_003.phpt b/ext/phar/tests/phar_oo_003.phpt index 110dcec9e7..8442534152 100644 --- a/ext/phar/tests/phar_oo_003.phpt +++ b/ext/phar/tests/phar_oo_003.phpt @@ -13,13 +13,13 @@ $phar = new Phar($fname); $phar->setInfoClass(); foreach($phar as $name => $ent) { - var_dump($ent->getFilename()); - if ($ent->isDir()) { - var_dump('DIR'); - } else { - var_dump($ent->openFile()->fgets()); - include $ent->getPathName(); - } + var_dump($ent->getFilename()); + if ($ent->isDir()) { + var_dump('DIR'); + } else { + var_dump($ent->openFile()->fgets()); + include $ent->getPathName(); + } } ?> diff --git a/ext/phar/tests/phar_oo_004.phpt b/ext/phar/tests/phar_oo_004.phpt index 5130f816d4..d1dc4ca78c 100644 --- a/ext/phar/tests/phar_oo_004.phpt +++ b/ext/phar/tests/phar_oo_004.phpt @@ -15,10 +15,10 @@ $it = new DirectoryIterator('phar://'.$fname); foreach($it as $name => $ent) { - var_dump($name); - var_dump($ent->getFilename()); - var_dump($ent->isDir()); - var_dump($ent->isDot()); + var_dump($name); + var_dump($ent->getFilename()); + var_dump($ent->isDir()); + var_dump($ent->isDot()); } ?> @@ -27,49 +27,49 @@ foreach($it as $name => $ent) class MyDirectoryIterator extends DirectoryIterator { - function __construct($dir) - { - echo __METHOD__ . "\n"; - parent::__construct($dir); - } + function __construct($dir) + { + echo __METHOD__ . "\n"; + parent::__construct($dir); + } - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } + function rewind() + { + echo __METHOD__ . "\n"; + parent::rewind(); + } - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } + function valid() + { + echo __METHOD__ . "\n"; + return parent::valid(); + } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } + function key() + { + echo __METHOD__ . "\n"; + return parent::key(); + } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } + function current() + { + echo __METHOD__ . "\n"; + return parent::current(); + } - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } + function next() + { + echo __METHOD__ . "\n"; + parent::next(); + } } $it = new MyDirectoryIterator('phar://'.$fname); foreach($it as $name => $ent) { - var_dump($name); - var_dump($ent->getFilename()); + var_dump($name); + var_dump($ent->getFilename()); } ?> diff --git a/ext/phar/tests/phar_oo_005.phpt b/ext/phar/tests/phar_oo_005.phpt index 7b414435c4..83dd3fc16b 100644 --- a/ext/phar/tests/phar_oo_005.phpt +++ b/ext/phar/tests/phar_oo_005.phpt @@ -17,12 +17,12 @@ $it = new RecursiveIteratorIterator($it); foreach($it as $name => $ent) { - var_dump(str_replace(array('\\', $fname), array('/', '*'), $name)); - var_dump(str_replace(array('\\', $fname), array('/', '*'), $ent->getPathname())); - var_dump(str_replace('\\', '/', $it->getSubPath())); - var_dump(str_replace('\\', '/', $it->getSubPathName())); - $sub = $it->getPathInfo(); - var_dump(str_replace('\\', '/', $sub->getFilename())); + var_dump(str_replace(array('\\', $fname), array('/', '*'), $name)); + var_dump(str_replace(array('\\', $fname), array('/', '*'), $ent->getPathname())); + var_dump(str_replace('\\', '/', $it->getSubPath())); + var_dump(str_replace('\\', '/', $it->getSubPathName())); + $sub = $it->getPathInfo(); + var_dump(str_replace('\\', '/', $sub->getFilename())); } ?> diff --git a/ext/phar/tests/phar_oo_006.phpt b/ext/phar/tests/phar_oo_006.phpt index 9e14127a8e..4b1201cc24 100644 --- a/ext/phar/tests/phar_oo_006.phpt +++ b/ext/phar/tests/phar_oo_006.phpt @@ -11,21 +11,21 @@ require_once 'files/phar_oo_test.inc'; class MyFile extends SplFileObject { - function __construct($what) - { - echo __METHOD__ . "($what)\n"; - parent::__construct($what); - } + function __construct($what) + { + echo __METHOD__ . "($what)\n"; + parent::__construct($what); + } } $phar = new Phar($fname); try { - $phar->setFileClass('SplFileInfo'); + $phar->setFileClass('SplFileInfo'); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } $phar->setInfoClass('MyFile'); diff --git a/ext/phar/tests/phar_oo_007.phpt b/ext/phar/tests/phar_oo_007.phpt index 7cb803f15e..14eca23c04 100644 --- a/ext/phar/tests/phar_oo_007.phpt +++ b/ext/phar/tests/phar_oo_007.phpt @@ -11,11 +11,11 @@ require_once 'files/phar_oo_test.inc'; class MyFile extends SplFileObject { - function __construct($name) - { - echo __METHOD__ . "(" . str_replace(str_replace('\\', '/', __DIR__), '*', $name) . ")\n"; - parent::__construct($name); - } + function __construct($name) + { + echo __METHOD__ . "(" . str_replace(str_replace('\\', '/', __DIR__), '*', $name) . ")\n"; + parent::__construct($name); + } } $phar = new Phar($fname); diff --git a/ext/phar/tests/phar_oo_008.phpt b/ext/phar/tests/phar_oo_008.phpt index 7ae68c034d..40027fd97f 100644 --- a/ext/phar/tests/phar_oo_008.phpt +++ b/ext/phar/tests/phar_oo_008.phpt @@ -18,7 +18,7 @@ $f = $phar['a.csv']; echo "===1===\n"; foreach($f as $k => $v) { - echo "$k=>$v\n"; + echo "$k=>$v\n"; } $f->setFlags(SplFileObject::DROP_NEW_LINE); @@ -26,15 +26,15 @@ $f->setFlags(SplFileObject::DROP_NEW_LINE); echo "===2===\n"; foreach($f as $k => $v) { - echo "$k=>$v\n"; + echo "$k=>$v\n"; } class MyCSVFile extends SplFileObject { - function current() - { - return parent::fgetcsv(',', '"'); - } + function current() + { + return parent::fgetcsv(',', '"'); + } } $phar->setInfoClass('MyCSVFile'); @@ -43,30 +43,30 @@ $v = $phar['a.csv']; echo "===3===\n"; while(!$v->eof()) { - echo $v->key() . "=>" . join('|',$v->fgetcsv()) . "\n"; + echo $v->key() . "=>" . join('|',$v->fgetcsv()) . "\n"; } echo "===4===\n"; $v->rewind(); while(!$v->eof()) { - $l = $v->fgetcsv(); - echo $v->key() . "=>" . join('|',$l) . "\n"; + $l = $v->fgetcsv(); + echo $v->key() . "=>" . join('|',$l) . "\n"; } echo "===5===\n"; foreach($v as $k => $d) { - echo "$k=>" . join('|',$d) . "\n"; + echo "$k=>" . join('|',$d) . "\n"; } class MyCSVFile2 extends SplFileObject { - function getCurrentLine() - { - echo __METHOD__ . "\n"; - return parent::fgetcsv(',', '"'); - } + function getCurrentLine() + { + echo __METHOD__ . "\n"; + return parent::fgetcsv(',', '"'); + } } $phar->setInfoClass('MyCSVFile2'); @@ -75,7 +75,7 @@ $v = $phar['a.csv']; echo "===6===\n"; foreach($v as $k => $d) { - echo "$k=>" . join('|',$d) . "\n"; + echo "$k=>" . join('|',$d) . "\n"; } ?> diff --git a/ext/phar/tests/phar_oo_009.phpt b/ext/phar/tests/phar_oo_009.phpt index a630ceb7a3..99c3684523 100644 --- a/ext/phar/tests/phar_oo_009.phpt +++ b/ext/phar/tests/phar_oo_009.phpt @@ -19,7 +19,7 @@ $f = $phar['a.csv']; $f->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE); foreach($f as $k => $v) { - echo "$k=>$v\n"; + echo "$k=>$v\n"; } ?> @@ -29,7 +29,7 @@ foreach($f as $k => $v) $f->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE | SplFileObject::READ_CSV); foreach($f as $k => $v) { - echo "$k=>" . join('|', $v) . "\n"; + echo "$k=>" . join('|', $v) . "\n"; } ?> diff --git a/ext/phar/tests/phar_oo_011b.phpt b/ext/phar/tests/phar_oo_011b.phpt index fcba17e0be..a1d2234bba 100644 --- a/ext/phar/tests/phar_oo_011b.phpt +++ b/ext/phar/tests/phar_oo_011b.phpt @@ -10,20 +10,20 @@ phar.require_hash=0 try { - $pharconfig = 0; + $pharconfig = 0; - require_once 'files/phar_oo_test.inc'; + require_once 'files/phar_oo_test.inc'; - $phar = new Phar($fname); + $phar = new Phar($fname); - $phar['f.php'] = 'hi'; - var_dump(isset($phar['f.php'])); - echo $phar['f.php']; - echo "\n"; + $phar['f.php'] = 'hi'; + var_dump(isset($phar['f.php'])); + echo $phar['f.php']; + echo "\n"; } catch (BadMethodCallException $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } ?> diff --git a/ext/phar/tests/phar_oo_012b.phpt b/ext/phar/tests/phar_oo_012b.phpt index 6f85ac19c0..26cbe65e2a 100644 --- a/ext/phar/tests/phar_oo_012b.phpt +++ b/ext/phar/tests/phar_oo_012b.phpt @@ -10,23 +10,23 @@ phar.require_hash=0 try { - $pharconfig = 0; + $pharconfig = 0; - require_once 'files/phar_oo_test.inc'; + require_once 'files/phar_oo_test.inc'; - $phar = new Phar($fname); - $phar->setInfoClass('SplFileObject'); + $phar = new Phar($fname); + $phar->setInfoClass('SplFileObject'); - $phar['f.php'] = 'hi'; - var_dump(isset($phar['f.php'])); - echo $phar['f.php']; - echo "\n"; - unset($phar['f.php']); - var_dump(isset($phar['f.php'])); + $phar['f.php'] = 'hi'; + var_dump(isset($phar['f.php'])); + echo $phar['f.php']; + echo "\n"; + unset($phar['f.php']); + var_dump(isset($phar['f.php'])); } catch (BadMethodCallException $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } ?> diff --git a/ext/phar/tests/phar_setalias2.phpt b/ext/phar/tests/phar_setalias2.phpt index 6a0876b5f9..82a25f56e1 100644 --- a/ext/phar/tests/phar_setalias2.phpt +++ b/ext/phar/tests/phar_setalias2.phpt @@ -25,14 +25,14 @@ echo $phar->getAlias() . "\n"; $b = $phar; $phar = new Phar(__DIR__ . '/notphar.phar'); try { - $phar->setAlias('test'); + $phar->setAlias('test'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - $b = new Phar(__DIR__ . '/nope.phar', 0, 'test'); + $b = new Phar(__DIR__ . '/nope.phar', 0, 'test'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/phar_setdefaultstub.phpt b/ext/phar/tests/phar_setdefaultstub.phpt index 6fed792966..3aa5b7243a 100644 --- a/ext/phar/tests/phar_setdefaultstub.phpt +++ b/ext/phar/tests/phar_setdefaultstub.phpt @@ -35,16 +35,16 @@ echo "========================================================================== echo "============================================================================\n"; try { - $phar->setDefaultStub(str_repeat('a', 400)); - $phar->stopBuffering(); - var_dump(strlen($phar->getStub())); + $phar->setDefaultStub(str_repeat('a', 400)); + $phar->stopBuffering(); + var_dump(strlen($phar->getStub())); - $phar->setDefaultStub(str_repeat('a', 401)); - $phar->stopBuffering(); - var_dump(strlen($phar->getStub())); + $phar->setDefaultStub(str_repeat('a', 401)); + $phar->stopBuffering(); + var_dump(strlen($phar->getStub())); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/phar/tests/phar_stub.phpt b/ext/phar/tests/phar_stub.phpt index e2fec8054c..cfca8fcb4e 100644 --- a/ext/phar/tests/phar_stub.phpt +++ b/ext/phar/tests/phar_stub.phpt @@ -61,7 +61,7 @@ fclose($fp); $fp = fopen($fname, 'rb'); echo fread($fp, strlen($file)) . "\n"; if (fread($fp, strlen('booya')) == 'booya') { - echo 'failed - copied booya'; + echo 'failed - copied booya'; } fclose($fp); $phar['testing'] = 'hi'; @@ -70,7 +70,7 @@ $phar['testing'] = 'hi'; $fp = fopen($fname, 'rb'); echo fread($fp, strlen($file)) . "\n"; if (fread($fp, strlen('booya')) == 'booya') { - echo 'failed - copied booya'; + echo 'failed - copied booya'; } fclose($fp); diff --git a/ext/phar/tests/phar_stub_error.phpt b/ext/phar/tests/phar_stub_error.phpt index 0a95e290de..972af851ee 100644 --- a/ext/phar/tests/phar_stub_error.phpt +++ b/ext/phar/tests/phar_stub_error.phpt @@ -25,11 +25,11 @@ var_dump($phar->getStub() == $stub); $newstub = '<?php echo "second stub\n"; _x_HALT_COMPILER(); ?>'; try { - $phar->setStub($newstub); + $phar->setStub($newstub); } catch(exception $e) { - echo 'Exception: ' . $e->getMessage() . "\n"; + echo 'Exception: ' . $e->getMessage() . "\n"; } var_dump($phar->getStub()); var_dump($phar->getStub() == $stub); diff --git a/ext/phar/tests/tar/033.phpt b/ext/phar/tests/tar/033.phpt index d881ea125b..cf45cab11d 100644 --- a/ext/phar/tests/tar/033.phpt +++ b/ext/phar/tests/tar/033.phpt @@ -18,19 +18,19 @@ $phar->addEmptyDir('test'); $phar->stopBuffering(); try { - var_dump($phar['a.php']->isExecutable()); - $phar['a.php']->chmod(0777); - var_dump($phar['a.php']->isExecutable()); - $phar['a.php']->chmod(0666); - var_dump($phar['a.php']->isExecutable()); - echo "test dir\n"; - var_dump($phar['test']->isReadable()); - $phar['test']->chmod(0000); - var_dump($phar['test']->isReadable()); - $phar['test']->chmod(0666); - var_dump($phar['test']->isReadable()); + var_dump($phar['a.php']->isExecutable()); + $phar['a.php']->chmod(0777); + var_dump($phar['a.php']->isExecutable()); + $phar['a.php']->chmod(0666); + var_dump($phar['a.php']->isExecutable()); + echo "test dir\n"; + var_dump($phar['test']->isReadable()); + $phar['test']->chmod(0000); + var_dump($phar['test']->isReadable()); + $phar['test']->chmod(0666); + var_dump($phar['test']->isReadable()); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/phar/tests/tar/033a.phpt b/ext/phar/tests/tar/033a.phpt index 3930407087..67216c3317 100644 --- a/ext/phar/tests/tar/033a.phpt +++ b/ext/phar/tests/tar/033a.phpt @@ -19,19 +19,19 @@ $phar->stopBuffering(); ini_set('phar.readonly', 1); try { - var_dump($phar['a.php']->isExecutable()); - $phar['a.php']->chmod(0777); - var_dump($phar['a.php']->isExecutable()); - $phar['a.php']->chmod(0666); - var_dump($phar['a.php']->isExecutable()); - echo "test dir\n"; - var_dump($phar['test']->isReadable()); - $phar['test']->chmod(0000); - var_dump($phar['test']->isReadable()); - $phar['test']->chmod(0666); - var_dump($phar['test']->isReadable()); + var_dump($phar['a.php']->isExecutable()); + $phar['a.php']->chmod(0777); + var_dump($phar['a.php']->isExecutable()); + $phar['a.php']->chmod(0666); + var_dump($phar['a.php']->isExecutable()); + echo "test dir\n"; + var_dump($phar['test']->isReadable()); + $phar['test']->chmod(0000); + var_dump($phar['test']->isReadable()); + $phar['test']->chmod(0666); + var_dump($phar['test']->isReadable()); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/tar/badchecksum.phpt b/ext/phar/tests/tar/badchecksum.phpt index b6b4047263..964f602434 100644 --- a/ext/phar/tests/tar/badchecksum.phpt +++ b/ext/phar/tests/tar/badchecksum.phpt @@ -14,9 +14,9 @@ $a->addFile('hithere', 'contents', null, 'checksum'); $a->close(); try { - $p = new PharData($fname); + $p = new PharData($fname); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/phar/tests/tar/bignames.phpt b/ext/phar/tests/tar/bignames.phpt index a22d5bd40d..f4fefcb13e 100644 --- a/ext/phar/tests/tar/bignames.phpt +++ b/ext/phar/tests/tar/bignames.phpt @@ -21,23 +21,23 @@ echo $p2[str_repeat('a', 100) . '/b']->getContent() . "\n"; echo $p2[str_repeat('a', 155) . '/' . str_repeat('b', 100)]->getContent() . "\n"; try { - $p2[str_repeat('a', 400)] = 'yuck'; + $p2[str_repeat('a', 400)] = 'yuck'; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - $p2 = new PharData($fname3); - $p2[str_repeat('a', 101)] = 'yuck'; + $p2 = new PharData($fname3); + $p2[str_repeat('a', 101)] = 'yuck'; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - $p2 = new PharData($fname4); - $p2[str_repeat('b', 160) . '/' . str_repeat('a', 90)] = 'yuck'; + $p2 = new PharData($fname4); + $p2[str_repeat('b', 160) . '/' . str_repeat('a', 90)] = 'yuck'; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/tar/bignames_overflow.phpt b/ext/phar/tests/tar/bignames_overflow.phpt index 3d3247a806..f3bf29a27a 100644 --- a/ext/phar/tests/tar/bignames_overflow.phpt +++ b/ext/phar/tests/tar/bignames_overflow.phpt @@ -20,7 +20,7 @@ $tar->close(); $p1 = new PharData($fname); foreach ($p1 as $file) { - echo $file->getFileName(), "\n"; + echo $file->getFileName(), "\n"; } echo $p1['a/' . str_repeat('a', 100)]->getContent() . "\n"; echo $p1[str_repeat('a', 155) . '/' . str_repeat('a', 100)]->getContent() . "\n"; diff --git a/ext/phar/tests/tar/bug49910.phpt b/ext/phar/tests/tar/bug49910.phpt index 0854c7284b..04ea485035 100644 --- a/ext/phar/tests/tar/bug49910.phpt +++ b/ext/phar/tests/tar/bug49910.phpt @@ -9,7 +9,7 @@ $fname = str_replace('\\', '/', __DIR__ . '/files/Structures_Graph-1.0.3.tgz'); $tar = new PharData($fname); $files = array(); foreach (new RecursiveIteratorIterator($tar) as $file) { - $files[] = str_replace($fname, '*', $file->getPathName()); + $files[] = str_replace($fname, '*', $file->getPathName()); } print_r($files); ?> diff --git a/ext/phar/tests/tar/bug71317-duplicate-filename.phpt b/ext/phar/tests/tar/bug71317-duplicate-filename.phpt index ee3219c1db..77fbdd50f2 100644 --- a/ext/phar/tests/tar/bug71317-duplicate-filename.phpt +++ b/ext/phar/tests/tar/bug71317-duplicate-filename.phpt @@ -22,17 +22,17 @@ $tar->close(); $fname = str_replace('\\', '/', $testTarFilename); try { - mkdir($testDirectory); - $tar = new PharData($fname); - $tar->extractTo($testDirectory); + mkdir($testDirectory); + $tar = new PharData($fname); + $tar->extractTo($testDirectory); - $fileContent = file_get_contents($testDirectory . '/file2.txt'); - $expectedContent = 'file2a'; - if ($fileContent !== $expectedContent) { - throw new Exception(sprintf('Contents of file2.txt ("%s") is invalid, expected "%s"', $fileContent, $expectedContent)); - } + $fileContent = file_get_contents($testDirectory . '/file2.txt'); + $expectedContent = 'file2a'; + if ($fileContent !== $expectedContent) { + throw new Exception(sprintf('Contents of file2.txt ("%s") is invalid, expected "%s"', $fileContent, $expectedContent)); + } } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> ===DONE=== diff --git a/ext/phar/tests/tar/bug71504.phpt b/ext/phar/tests/tar/bug71504.phpt index fde572beea..9352d80374 100644 --- a/ext/phar/tests/tar/bug71504.phpt +++ b/ext/phar/tests/tar/bug71504.phpt @@ -7,9 +7,9 @@ Bug #71504: Parsing of tar file with duplicate filenames causes memory leak <?php $fname = str_replace('\\', '/', __DIR__ . '/files/HTML_CSS-1.5.4.tgz'); try { - $tar = new PharData($fname); + $tar = new PharData($fname); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> ===DONE=== diff --git a/ext/phar/tests/tar/create_new_phar_b.phpt b/ext/phar/tests/tar/create_new_phar_b.phpt index b8a7d4322b..6d9f3fd009 100644 --- a/ext/phar/tests/tar/create_new_phar_b.phpt +++ b/ext/phar/tests/tar/create_new_phar_b.phpt @@ -9,7 +9,7 @@ phar.require_hash=1 <?php file_put_contents('phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.tar/a.php', - 'brand new!'); + 'brand new!'); include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.tar/a.php'; ?> diff --git a/ext/phar/tests/tar/exists_as_phar.phpt b/ext/phar/tests/tar/exists_as_phar.phpt index 2a87dc7327..667287f61e 100644 --- a/ext/phar/tests/tar/exists_as_phar.phpt +++ b/ext/phar/tests/tar/exists_as_phar.phpt @@ -21,9 +21,9 @@ copy($fname, $tname); $phar->setAlias('hio2'); try { - $p = new Phar($tname); + $p = new Phar($tname); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/phar/tests/tar/files/corrupt_tarmaker.php.inc b/ext/phar/tests/tar/files/corrupt_tarmaker.php.inc index 4e30dca174..9663d89336 100644 --- a/ext/phar/tests/tar/files/corrupt_tarmaker.php.inc +++ b/ext/phar/tests/tar/files/corrupt_tarmaker.php.inc @@ -112,7 +112,7 @@ class corrupt_tarmaker $checksum = 256; // 8 * ord(' '); $checksum += array_reduce($checkheader, '_pear2tarchecksum'); - if ($corrupt === 'checksum') $checksum++; + if ($corrupt === 'checksum') $checksum++; $checksum = pack('a8', sprintf('%6s ', decoct($checksum))); fwrite($this->tmp, $block . $checksum . $blockend, 512); diff --git a/ext/phar/tests/tar/files/make_invalid_tar.php.inc b/ext/phar/tests/tar/files/make_invalid_tar.php.inc index 895977bf2f..2ccdf00201 100644 --- a/ext/phar/tests/tar/files/make_invalid_tar.php.inc +++ b/ext/phar/tests/tar/files/make_invalid_tar.php.inc @@ -3,7 +3,7 @@ include dirname(__FILE__) . '/tarmaker.php.inc'; class corrupter extends tarmaker { function close() { - fwrite($this->tmp, (binary)'oopsie'); - fclose($this->tmp); + fwrite($this->tmp, (binary)'oopsie'); + fclose($this->tmp); } } diff --git a/ext/phar/tests/tar/links.phpt b/ext/phar/tests/tar/links.phpt index 2d1c76b85e..5af9811f4d 100644 --- a/ext/phar/tests/tar/links.phpt +++ b/ext/phar/tests/tar/links.phpt @@ -9,9 +9,9 @@ phar.require_hash=0 $fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.tar'; copy(__DIR__ . '/files/links.tar', $fname); try { - $p = new PharData($fname); + $p = new PharData($fname); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } var_dump($p['testit/link']->getContent()); var_dump($p['testit/hard']->getContent()); diff --git a/ext/phar/tests/tar/links2.phpt b/ext/phar/tests/tar/links2.phpt index 75f5c51e25..bd56fb4761 100644 --- a/ext/phar/tests/tar/links2.phpt +++ b/ext/phar/tests/tar/links2.phpt @@ -20,9 +20,9 @@ $a->addFile('hardlink', 'internal/file.txt', array( $a->close(); try { - $p = new PharData($fname); + $p = new PharData($fname); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/tar/links3.phpt b/ext/phar/tests/tar/links3.phpt index b771da1260..78243c7e12 100644 --- a/ext/phar/tests/tar/links3.phpt +++ b/ext/phar/tests/tar/links3.phpt @@ -7,9 +7,9 @@ phar.require_hash=0 --FILE-- <?php try { - $p = new PharData(__DIR__ . '/files/biglink.tar'); + $p = new PharData(__DIR__ . '/files/biglink.tar'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } echo $p['file.txt']->getContent(); echo $p['my/file']->getContent(); diff --git a/ext/phar/tests/tar/links4.phpt b/ext/phar/tests/tar/links4.phpt index 941197c67b..10c3cf6b6e 100644 --- a/ext/phar/tests/tar/links4.phpt +++ b/ext/phar/tests/tar/links4.phpt @@ -7,9 +7,9 @@ phar.require_hash=0 --FILE-- <?php try { - $p = new PharData(__DIR__ . '/files/tinylink.tar'); + $p = new PharData(__DIR__ . '/files/tinylink.tar'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } echo $p['file.txt']->getContent(); echo $p['link.txt']->getContent(); diff --git a/ext/phar/tests/tar/links5.phpt b/ext/phar/tests/tar/links5.phpt index 17892370f7..fdef2da64a 100644 --- a/ext/phar/tests/tar/links5.phpt +++ b/ext/phar/tests/tar/links5.phpt @@ -7,9 +7,9 @@ phar.require_hash=0 --FILE-- <?php try { - $p = new PharData(__DIR__ . '/files/subdirlink.tar'); + $p = new PharData(__DIR__ . '/files/subdirlink.tar'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } echo $p['hi/test.txt']->getContent(); echo $p['hi/link.txt']->getContent(); diff --git a/ext/phar/tests/tar/open_for_write_existing.phpt b/ext/phar/tests/tar/open_for_write_existing.phpt index 05ab333bfd..247f2559ea 100644 --- a/ext/phar/tests/tar/open_for_write_existing.phpt +++ b/ext/phar/tests/tar/open_for_write_existing.phpt @@ -21,7 +21,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/tar/open_for_write_existing_b.phpt b/ext/phar/tests/tar/open_for_write_existing_b.phpt index eaf1ed9ad2..958fb639c4 100644 --- a/ext/phar/tests/tar/open_for_write_existing_b.phpt +++ b/ext/phar/tests/tar/open_for_write_existing_b.phpt @@ -23,7 +23,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/tar/open_for_write_existing_c.phpt b/ext/phar/tests/tar/open_for_write_existing_c.phpt index d70a96bf3b..c8871f1f49 100644 --- a/ext/phar/tests/tar/open_for_write_existing_c.phpt +++ b/ext/phar/tests/tar/open_for_write_existing_c.phpt @@ -23,7 +23,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/tar/open_for_write_newfile.phpt b/ext/phar/tests/tar/open_for_write_newfile.phpt index f5485eac18..eb2d2509f3 100644 --- a/ext/phar/tests/tar/open_for_write_newfile.phpt +++ b/ext/phar/tests/tar/open_for_write_newfile.phpt @@ -21,7 +21,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/tar/open_for_write_newfile_b.phpt b/ext/phar/tests/tar/open_for_write_newfile_b.phpt index fec1cf2d6c..9494b867dd 100644 --- a/ext/phar/tests/tar/open_for_write_newfile_b.phpt +++ b/ext/phar/tests/tar/open_for_write_newfile_b.phpt @@ -23,7 +23,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/tar/open_for_write_newfile_c.phpt b/ext/phar/tests/tar/open_for_write_newfile_c.phpt index e6d371fb0f..e5fc583660 100644 --- a/ext/phar/tests/tar/open_for_write_newfile_c.phpt +++ b/ext/phar/tests/tar/open_for_write_newfile_c.phpt @@ -23,7 +23,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/tar/phar_buildfromiterator4.phpt b/ext/phar/tests/tar/phar_buildfromiterator4.phpt index bffc21b36c..d78c3a0ed4 100644 --- a/ext/phar/tests/tar/phar_buildfromiterator4.phpt +++ b/ext/phar/tests/tar/phar_buildfromiterator4.phpt @@ -36,13 +36,13 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar'); - var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . 'phpt')))); - var_dump($phar->isFileFormat(Phar::TAR)); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar'); + var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . 'phpt')))); + var_dump($phar->isFileFormat(Phar::TAR)); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/tar/phar_buildfromiterator5.phpt b/ext/phar/tests/tar/phar_buildfromiterator5.phpt index c5191ee3e0..73d23e3218 100644 --- a/ext/phar/tests/tar/phar_buildfromiterator5.phpt +++ b/ext/phar/tests/tar/phar_buildfromiterator5.phpt @@ -36,12 +36,12 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar'); - var_dump($phar->buildFromIterator(new myIterator(array('a' => new stdClass)))); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar'); + var_dump($phar->buildFromIterator(new myIterator(array('a' => new stdClass)))); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/tar/phar_buildfromiterator6.phpt b/ext/phar/tests/tar/phar_buildfromiterator6.phpt index 58706a714c..5c856f58fa 100644 --- a/ext/phar/tests/tar/phar_buildfromiterator6.phpt +++ b/ext/phar/tests/tar/phar_buildfromiterator6.phpt @@ -36,12 +36,12 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar'); - var_dump($phar->buildFromIterator(new myIterator(array(basename(__FILE__, 'php') . 'phpt')))); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar'); + var_dump($phar->buildFromIterator(new myIterator(array(basename(__FILE__, 'php') . 'phpt')))); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/tar/phar_buildfromiterator7.phpt b/ext/phar/tests/tar/phar_buildfromiterator7.phpt index 1ffc2da8d6..92be5ebd7a 100644 --- a/ext/phar/tests/tar/phar_buildfromiterator7.phpt +++ b/ext/phar/tests/tar/phar_buildfromiterator7.phpt @@ -36,12 +36,12 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar'); - var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt')))); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar'); + var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt')))); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/tar/phar_buildfromiterator8.phpt b/ext/phar/tests/tar/phar_buildfromiterator8.phpt index d2efdce66d..f9497a01ce 100644 --- a/ext/phar/tests/tar/phar_buildfromiterator8.phpt +++ b/ext/phar/tests/tar/phar_buildfromiterator8.phpt @@ -7,15 +7,15 @@ phar.readonly=0 --FILE-- <?php try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar'); - $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^frontcontroller\d{0,2}\.phar\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR); - asort($a); - var_dump($a); - var_dump($phar->isFileFormat(Phar::TAR)); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar'); + $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^frontcontroller\d{0,2}\.phar\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR); + asort($a); + var_dump($a); + var_dump($phar->isFileFormat(Phar::TAR)); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/tar/phar_buildfromiterator9.phpt b/ext/phar/tests/tar/phar_buildfromiterator9.phpt index 6653b1dbf2..e113d211a8 100644 --- a/ext/phar/tests/tar/phar_buildfromiterator9.phpt +++ b/ext/phar/tests/tar/phar_buildfromiterator9.phpt @@ -36,13 +36,13 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar'); - var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r'))))); - fclose($a); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar'); + var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r'))))); + fclose($a); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/tar/phar_copy.phpt b/ext/phar/tests/tar/phar_copy.phpt index 61938bf0b5..e760abddd8 100644 --- a/ext/phar/tests/tar/phar_copy.phpt +++ b/ext/phar/tests/tar/phar_copy.phpt @@ -20,20 +20,20 @@ $p = new Phar($fname); try { - $p['a'] = 'hi'; - $p->startBuffering(); - $p->copy('a', 'b'); - echo file_get_contents($p['b']->getPathName()); - $p->copy('b', 'c'); - $p->stopBuffering(); - echo file_get_contents($p['c']->getPathName()); - copy($fname, $fname2); - var_dump($p->isFileFormat(Phar::TAR)); - $p->copy('a', $ename); + $p['a'] = 'hi'; + $p->startBuffering(); + $p->copy('a', 'b'); + echo file_get_contents($p['b']->getPathName()); + $p->copy('b', 'c'); + $p->stopBuffering(); + echo file_get_contents($p['c']->getPathName()); + copy($fname, $fname2); + var_dump($p->isFileFormat(Phar::TAR)); + $p->copy('a', $ename); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ini_set('phar.readonly',1); $p2 = new Phar($fname2); diff --git a/ext/phar/tests/tar/phar_setalias.phpt b/ext/phar/tests/tar/phar_setalias.phpt index 929ba7f0b8..37d0a475e5 100644 --- a/ext/phar/tests/tar/phar_setalias.phpt +++ b/ext/phar/tests/tar/phar_setalias.phpt @@ -22,7 +22,7 @@ $files['b'] = 'b'; $files['c'] = 'c'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/tar/phar_setalias2.phpt b/ext/phar/tests/tar/phar_setalias2.phpt index eb87c0a221..f9d708d586 100644 --- a/ext/phar/tests/tar/phar_setalias2.phpt +++ b/ext/phar/tests/tar/phar_setalias2.phpt @@ -21,7 +21,7 @@ $files['b'] = 'b'; $files['c'] = 'c'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); @@ -33,9 +33,9 @@ $b = $phar; $phar = new Phar(__DIR__ . '/notphar.phar'); try { - $phar->setAlias('test'); + $phar->setAlias('test'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/phar/tests/tar/phar_setdefaultstub.phpt b/ext/phar/tests/tar/phar_setdefaultstub.phpt index 0eedd45861..6811c4c59d 100644 --- a/ext/phar/tests/tar/phar_setdefaultstub.phpt +++ b/ext/phar/tests/tar/phar_setdefaultstub.phpt @@ -20,10 +20,10 @@ echo "========================================================================== echo "============================================================================\n"; try { - $phar->setDefaultStub(); - $phar->stopBuffering(); + $phar->setDefaultStub(); + $phar->stopBuffering(); } catch(Exception $e) { - echo $e->getMessage(). "\n"; + echo $e->getMessage(). "\n"; } var_dump($phar->getStub()); @@ -32,10 +32,10 @@ echo "========================================================================== echo "============================================================================\n"; try { - $phar->setDefaultStub('my/custom/thingy.php'); - $phar->stopBuffering(); + $phar->setDefaultStub('my/custom/thingy.php'); + $phar->stopBuffering(); } catch(Exception $e) { - echo $e->getMessage(). "\n"; + echo $e->getMessage(). "\n"; } var_dump($phar->getStub()); @@ -44,10 +44,10 @@ echo "========================================================================== echo "============================================================================\n"; try { - $phar->setDefaultStub('my/custom/thingy.php', 'the/web.php'); - $phar->stopBuffering(); + $phar->setDefaultStub('my/custom/thingy.php', 'the/web.php'); + $phar->stopBuffering(); } catch(Exception $e) { - echo $e->getMessage(). "\n"; + echo $e->getMessage(). "\n"; } var_dump($phar->getStub()); diff --git a/ext/phar/tests/tar/phar_stub_error.phpt b/ext/phar/tests/tar/phar_stub_error.phpt index 82c0cbf59f..c7f13858dd 100644 --- a/ext/phar/tests/tar/phar_stub_error.phpt +++ b/ext/phar/tests/tar/phar_stub_error.phpt @@ -23,9 +23,9 @@ var_dump($phar->getStub() == $stub); $newstub = '<?php echo "second stub\n"; _x_HALT_COMPILER(); ?>'; try { - $phar->setStub($newstub); + $phar->setStub($newstub); } catch(exception $e) { - echo 'Exception: ' . $e->getMessage() . "\n"; + echo 'Exception: ' . $e->getMessage() . "\n"; } var_dump($phar->getStub()); diff --git a/ext/phar/tests/tar/refcount1.phpt b/ext/phar/tests/tar/refcount1.phpt index df33e3a0d4..cb8b8241aa 100644 --- a/ext/phar/tests/tar/refcount1.phpt +++ b/ext/phar/tests/tar/refcount1.phpt @@ -23,7 +23,7 @@ $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; $files['.phar/alias.txt'] = 'hio'; foreach ($files as $n => $file) { - $tar->addFile($n, $file); + $tar->addFile($n, $file); } $tar->close(); diff --git a/ext/phar/tests/tar/rename.phpt b/ext/phar/tests/tar/rename.phpt index 2adf01d5f6..430d7fabb5 100644 --- a/ext/phar/tests/tar/rename.phpt +++ b/ext/phar/tests/tar/rename.phpt @@ -21,7 +21,7 @@ $files = array(); $files['a'] = 'a'; foreach ($files as $n => $file) { - $tar->addFile($n, $file); + $tar->addFile($n, $file); } $tar->close(); diff --git a/ext/phar/tests/tar/rename_dir.phpt b/ext/phar/tests/tar/rename_dir.phpt index e1a3c5d969..e4c3afc700 100644 --- a/ext/phar/tests/tar/rename_dir.phpt +++ b/ext/phar/tests/tar/rename_dir.phpt @@ -21,7 +21,7 @@ $files = array(); $files['a/x'] = 'a'; foreach ($files as $n => $file) { - $tar->addFile($n, $file); + $tar->addFile($n, $file); } $tar->close(); diff --git a/ext/phar/tests/tar/require_hash.phpt b/ext/phar/tests/tar/require_hash.phpt index 1fd44e18a5..537cadfb31 100644 --- a/ext/phar/tests/tar/require_hash.phpt +++ b/ext/phar/tests/tar/require_hash.phpt @@ -21,20 +21,20 @@ $tar->addFile('.phar/stub.php', "__HALT_COMPILER();"); $tar->close(); try { - $phar = new Phar($fname); - var_dump($phar->getStub()); + $phar = new Phar($fname); + var_dump($phar->getStub()); } catch (Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } ini_set('phar.require_hash', 0); try { - $phar = new PharData($fname2); - $phar['file'] = 'hi'; - var_dump($phar->getSignature()); - $phar->setSignatureAlgorithm(Phar::MD5); - var_dump($phar->getSignature()); + $phar = new PharData($fname2); + $phar['file'] = 'hi'; + var_dump($phar->getSignature()); + $phar->setSignatureAlgorithm(Phar::MD5); + var_dump($phar->getSignature()); } catch (Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } ?> diff --git a/ext/phar/tests/tar/rmdir.phpt b/ext/phar/tests/tar/rmdir.phpt index 8e7b30b0f3..9c48c510c2 100644 --- a/ext/phar/tests/tar/rmdir.phpt +++ b/ext/phar/tests/tar/rmdir.phpt @@ -21,7 +21,7 @@ $files = array(); $files['a/x'] = 'a'; foreach ($files as $n => $file) { - $tar->addFile($n, $file); + $tar->addFile($n, $file); } $tar->mkdir('a'); diff --git a/ext/phar/tests/tar/tar_001.phpt b/ext/phar/tests/tar/tar_001.phpt index 6fc2df3ae7..ec27543494 100644 --- a/ext/phar/tests/tar/tar_001.phpt +++ b/ext/phar/tests/tar/tar_001.phpt @@ -13,10 +13,10 @@ $tar->close(); $tar = fopen('phar://' . __DIR__ . '/tar_001.phar.tar/tar_001.phpt', 'rb'); try { - $phar = new Phar(__DIR__ . '/tar_001.phar.tar'); - echo "should not execute\n"; + $phar = new Phar(__DIR__ . '/tar_001.phar.tar'); + echo "should not execute\n"; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/tar/tar_002.phpt b/ext/phar/tests/tar/tar_002.phpt index 3549035a4d..188b0abb45 100644 --- a/ext/phar/tests/tar/tar_002.phpt +++ b/ext/phar/tests/tar/tar_002.phpt @@ -16,10 +16,10 @@ $tar->close(); $tar = fopen('phar://' . __DIR__ . '/tar_002.phar.tar/tar_002.phpt', 'rb'); try { - $phar = new Phar(__DIR__ . '/tar_002.phar.tar'); - echo "should not execute\n"; + $phar = new Phar(__DIR__ . '/tar_002.phar.tar'); + echo "should not execute\n"; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/tar/tar_003.phpt b/ext/phar/tests/tar/tar_003.phpt index e7b0cf8a7e..321f3f59cf 100644 --- a/ext/phar/tests/tar/tar_003.phpt +++ b/ext/phar/tests/tar/tar_003.phpt @@ -32,8 +32,8 @@ echo $e->getMessage()."\n"; } while (false !== ($v = readdir($tar))) { - echo (is_file($alias . '/' . $v) ? "file\n" : "dir\n"); - echo $v . "\n"; + echo (is_file($alias . '/' . $v) ? "file\n" : "dir\n"); + echo $v . "\n"; } closedir($tar); @@ -41,8 +41,8 @@ closedir($tar); echo "second round\n"; $tar = opendir($alias . '/'); while (false !== ($v = readdir($tar))) { - echo (is_file($alias . '/' . $v) ? "file\n" : "dir\n"); - echo $v . "\n"; + echo (is_file($alias . '/' . $v) ? "file\n" : "dir\n"); + echo $v . "\n"; } closedir($tar); diff --git a/ext/phar/tests/tar/tar_nohash.phpt b/ext/phar/tests/tar/tar_nohash.phpt index e24fea16bf..07caf79c24 100644 --- a/ext/phar/tests/tar/tar_nohash.phpt +++ b/ext/phar/tests/tar/tar_nohash.phpt @@ -9,10 +9,10 @@ phar.require_hash=1 --FILE-- <?php try { - $phar = new PharData(__DIR__ . '/files/Net_URL-1.0.15.tgz'); - var_dump($phar->getStub()); + $phar = new PharData(__DIR__ . '/files/Net_URL-1.0.15.tgz'); + var_dump($phar->getStub()); } catch (Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } ?> diff --git a/ext/phar/tests/tar/tar_nostub.phpt b/ext/phar/tests/tar/tar_nostub.phpt index d100feb830..d9ae0cdf83 100644 --- a/ext/phar/tests/tar/tar_nostub.phpt +++ b/ext/phar/tests/tar/tar_nostub.phpt @@ -19,19 +19,19 @@ $tar->addFile('internal/file/here', "hi there!\n"); $tar->close(); try { - $phar = new Phar($fname); - var_dump($phar->getStub()); + $phar = new Phar($fname); + var_dump($phar->getStub()); } catch (Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } copy($fname, $fname2); try { - $phar = new PharData($fname2); - var_dump($phar->getStub()); + $phar = new PharData($fname2); + var_dump($phar->getStub()); } catch (Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } ?> diff --git a/ext/phar/tests/tar/tar_openssl_hash.phpt b/ext/phar/tests/tar/tar_openssl_hash.phpt index 030ee79db4..b6ed80eeac 100644 --- a/ext/phar/tests/tar/tar_openssl_hash.phpt +++ b/ext/phar/tests/tar/tar_openssl_hash.phpt @@ -10,9 +10,9 @@ phar.require_hash=1 --FILE-- <?php try { - $phar = new PharData(__DIR__ . '/files/P1-1.0.0.tgz'); + $phar = new PharData(__DIR__ . '/files/P1-1.0.0.tgz'); } catch (Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } ?> diff --git a/ext/phar/tests/tar/truncated.phpt b/ext/phar/tests/tar/truncated.phpt index 83adcde243..f57b4ed5e9 100644 --- a/ext/phar/tests/tar/truncated.phpt +++ b/ext/phar/tests/tar/truncated.phpt @@ -5,9 +5,9 @@ Phar: truncated tar --FILE-- <?php try { - $p = new PharData(__DIR__ . '/files/trunc.tar'); + $p = new PharData(__DIR__ . '/files/trunc.tar'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/phar/tests/zip/033.phpt b/ext/phar/tests/zip/033.phpt index 9eba82f78d..4554cfcecf 100644 --- a/ext/phar/tests/zip/033.phpt +++ b/ext/phar/tests/zip/033.phpt @@ -19,23 +19,23 @@ $phar->addEmptyDir('test'); $phar->stopBuffering(); try { - var_dump($phar['a.php']->isExecutable()); - $phar['a.php']->chmod(0777); - copy($fname, $fname2); - $phar->setAlias('unused'); - $phar2 = new Phar($fname2); - var_dump($phar2['a.php']->isExecutable()); - $phar['a.php']->chmod(0666); - var_dump($phar['a.php']->isExecutable()); - echo "test dir\n"; - var_dump($phar['test']->isDir()); - var_dump($phar['test']->isReadable()); - $phar['test']->chmod(0000); - var_dump($phar['test']->isReadable()); - $phar['test']->chmod(0666); - var_dump($phar['test']->isReadable()); + var_dump($phar['a.php']->isExecutable()); + $phar['a.php']->chmod(0777); + copy($fname, $fname2); + $phar->setAlias('unused'); + $phar2 = new Phar($fname2); + var_dump($phar2['a.php']->isExecutable()); + $phar['a.php']->chmod(0666); + var_dump($phar['a.php']->isExecutable()); + echo "test dir\n"; + var_dump($phar['test']->isDir()); + var_dump($phar['test']->isReadable()); + $phar['test']->chmod(0000); + var_dump($phar['test']->isReadable()); + $phar['test']->chmod(0666); + var_dump($phar['test']->isReadable()); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/zip/033a.phpt b/ext/phar/tests/zip/033a.phpt index d0140fba13..5b94c3e224 100644 --- a/ext/phar/tests/zip/033a.phpt +++ b/ext/phar/tests/zip/033a.phpt @@ -19,19 +19,19 @@ $phar->stopBuffering(); ini_set('phar.readonly', 1); try { - var_dump($phar['a.php']->isExecutable()); - $phar['a.php']->chmod(0777); - var_dump($phar['a.php']->isExecutable()); - $phar['a.php']->chmod(0666); - var_dump($phar['a.php']->isExecutable()); - echo "test dir\n"; - var_dump($phar['test']->isExecutable()); - $phar['test']->chmod(0777); - var_dump($phar['test']->isExecutable()); - $phar['test']->chmod(0666); - var_dump($phar['test']->isExecutable()); + var_dump($phar['a.php']->isExecutable()); + $phar['a.php']->chmod(0777); + var_dump($phar['a.php']->isExecutable()); + $phar['a.php']->chmod(0666); + var_dump($phar['a.php']->isExecutable()); + echo "test dir\n"; + var_dump($phar['test']->isExecutable()); + $phar['test']->chmod(0777); + var_dump($phar['test']->isExecutable()); + $phar['test']->chmod(0666); + var_dump($phar['test']->isExecutable()); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/zip/bzip2.phpt b/ext/phar/tests/zip/bzip2.phpt index 0b1fb31081..13bdde3ea6 100644 --- a/ext/phar/tests/zip/bzip2.phpt +++ b/ext/phar/tests/zip/bzip2.phpt @@ -6,14 +6,14 @@ Phar: process bzip2-compressed zip entry --FILE-- <?php try { - $a = new PharData(dirname(__FILE__) . '/files/bzip2.zip'); - foreach ($a as $entry => $file) { - echo $file->getContent(); - } - $a = new Phar(dirname(__FILE__) . '/files/bz2_alias.phar.zip'); - var_dump($a->getAlias()); + $a = new PharData(dirname(__FILE__) . '/files/bzip2.zip'); + foreach ($a as $entry => $file) { + echo $file->getContent(); + } + $a = new Phar(dirname(__FILE__) . '/files/bz2_alias.phar.zip'); + var_dump($a->getAlias()); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/phar/tests/zip/corrupt_001.phpt b/ext/phar/tests/zip/corrupt_001.phpt index 188d9719f7..bccbdc5990 100644 --- a/ext/phar/tests/zip/corrupt_001.phpt +++ b/ext/phar/tests/zip/corrupt_001.phpt @@ -5,14 +5,14 @@ Phar: corrupted zip (count mismatch) --FILE-- <?php try { - new PharData(__DIR__ . '/files/count1.zip'); + new PharData(__DIR__ . '/files/count1.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/count2.zip'); + new PharData(__DIR__ . '/files/count2.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/phar/tests/zip/corrupt_002.phpt b/ext/phar/tests/zip/corrupt_002.phpt index 15058fcb22..4144e5e5b7 100644 --- a/ext/phar/tests/zip/corrupt_002.phpt +++ b/ext/phar/tests/zip/corrupt_002.phpt @@ -5,9 +5,9 @@ Phar: corrupted zip (no end of zip record) --FILE-- <?php try { - new PharData(__DIR__ . '/files/nozipend.zip'); + new PharData(__DIR__ . '/files/nozipend.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/phar/tests/zip/corrupt_003.phpt b/ext/phar/tests/zip/corrupt_003.phpt index 02fc99e59b..6c2aebb928 100644 --- a/ext/phar/tests/zip/corrupt_003.phpt +++ b/ext/phar/tests/zip/corrupt_003.phpt @@ -5,9 +5,9 @@ Phar: corrupted zip (truncated file comment) --FILE-- <?php try { - new PharData(__DIR__ . '/files/filecomment.zip'); + new PharData(__DIR__ . '/files/filecomment.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/phar/tests/zip/corrupt_004.phpt b/ext/phar/tests/zip/corrupt_004.phpt index bfef6cba5d..c77722ca9b 100644 --- a/ext/phar/tests/zip/corrupt_004.phpt +++ b/ext/phar/tests/zip/corrupt_004.phpt @@ -5,9 +5,9 @@ Phar: corrupted zip (central directory offset incorrect) --FILE-- <?php try { - new PharData(__DIR__ . '/files/cdir_offset.zip'); + new PharData(__DIR__ . '/files/cdir_offset.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/phar/tests/zip/corrupt_005.phpt b/ext/phar/tests/zip/corrupt_005.phpt index 795f3f17b2..6f46d27e1f 100644 --- a/ext/phar/tests/zip/corrupt_005.phpt +++ b/ext/phar/tests/zip/corrupt_005.phpt @@ -5,9 +5,9 @@ Phar: encrypted zip --FILE-- <?php try { - new PharData(__DIR__ . '/files/encrypted.zip'); + new PharData(__DIR__ . '/files/encrypted.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/phar/tests/zip/corrupt_006.phpt b/ext/phar/tests/zip/corrupt_006.phpt index 8c36cd98b8..91642cf6bc 100644 --- a/ext/phar/tests/zip/corrupt_006.phpt +++ b/ext/phar/tests/zip/corrupt_006.phpt @@ -5,9 +5,9 @@ Phar: zip with file created from stdin --FILE-- <?php try { - new PharData(__DIR__ . '/files/stdin.zip'); + new PharData(__DIR__ . '/files/stdin.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/phar/tests/zip/corrupt_007.phpt b/ext/phar/tests/zip/corrupt_007.phpt index 21dcee826a..d185d75825 100644 --- a/ext/phar/tests/zip/corrupt_007.phpt +++ b/ext/phar/tests/zip/corrupt_007.phpt @@ -5,9 +5,9 @@ Phar: corrupted zip (truncated filename record) --FILE-- <?php try { - new PharData(__DIR__ . '/files/truncfilename.zip'); + new PharData(__DIR__ . '/files/truncfilename.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/phar/tests/zip/corrupt_008.phpt b/ext/phar/tests/zip/corrupt_008.phpt index 5fcde01c94..dd0ffbf478 100644 --- a/ext/phar/tests/zip/corrupt_008.phpt +++ b/ext/phar/tests/zip/corrupt_008.phpt @@ -5,79 +5,79 @@ Phar: unsupported compression methods --FILE-- <?php try { - new PharData(__DIR__ . '/files/compress_unsup1.zip'); + new PharData(__DIR__ . '/files/compress_unsup1.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsup2.zip'); + new PharData(__DIR__ . '/files/compress_unsup2.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsup3.zip'); + new PharData(__DIR__ . '/files/compress_unsup3.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsup4.zip'); + new PharData(__DIR__ . '/files/compress_unsup4.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsup5.zip'); + new PharData(__DIR__ . '/files/compress_unsup5.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsup6.zip'); + new PharData(__DIR__ . '/files/compress_unsup6.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsup7.zip'); + new PharData(__DIR__ . '/files/compress_unsup7.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsup9.zip'); + new PharData(__DIR__ . '/files/compress_unsup9.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsup10.zip'); + new PharData(__DIR__ . '/files/compress_unsup10.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsup14.zip'); + new PharData(__DIR__ . '/files/compress_unsup14.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsup18.zip'); + new PharData(__DIR__ . '/files/compress_unsup18.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsup19.zip'); + new PharData(__DIR__ . '/files/compress_unsup19.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsup97.zip'); + new PharData(__DIR__ . '/files/compress_unsup97.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsup98.zip'); + new PharData(__DIR__ . '/files/compress_unsup98.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new PharData(__DIR__ . '/files/compress_unsupunknown.zip'); + new PharData(__DIR__ . '/files/compress_unsupunknown.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/phar/tests/zip/corrupt_009.phpt b/ext/phar/tests/zip/corrupt_009.phpt index 9a86a933e6..20f85bcd79 100644 --- a/ext/phar/tests/zip/corrupt_009.phpt +++ b/ext/phar/tests/zip/corrupt_009.phpt @@ -5,9 +5,9 @@ Phar: corrupted zip (extra field way too long) --FILE-- <?php try { - new PharData(__DIR__ . '/files/extralen_toolong.zip'); + new PharData(__DIR__ . '/files/extralen_toolong.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/phar/tests/zip/corrupt_010.phpt b/ext/phar/tests/zip/corrupt_010.phpt index 0106d308ae..7850dcafdb 100644 --- a/ext/phar/tests/zip/corrupt_010.phpt +++ b/ext/phar/tests/zip/corrupt_010.phpt @@ -5,9 +5,9 @@ Phar: unable to process zip (zip spanning multiple archives) --FILE-- <?php try { - new PharData(__DIR__ . '/files/disknumber.zip'); + new PharData(__DIR__ . '/files/disknumber.zip'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/phar/tests/zip/create_new_phar_b.phpt b/ext/phar/tests/zip/create_new_phar_b.phpt index 7f838f3f8a..d14682f3dc 100644 --- a/ext/phar/tests/zip/create_new_phar_b.phpt +++ b/ext/phar/tests/zip/create_new_phar_b.phpt @@ -9,7 +9,7 @@ phar.require_hash=1 <?php file_put_contents('phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip/a.php', - 'brand new!'); + 'brand new!'); include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip/a.php'; ?> diff --git a/ext/phar/tests/zip/exists_as_phar.phpt b/ext/phar/tests/zip/exists_as_phar.phpt index e439eae015..31bec4b970 100644 --- a/ext/phar/tests/zip/exists_as_phar.phpt +++ b/ext/phar/tests/zip/exists_as_phar.phpt @@ -21,9 +21,9 @@ copy($fname, $tname); $phar->setAlias('hio2'); try { - $p = new Phar($tname); + $p = new Phar($tname); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc b/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc index 80c6a3eab6..fdbf3e2f6c 100644 --- a/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc +++ b/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc @@ -34,298 +34,298 @@ */ class corrupt_zipmaker { - /** - * @var int Current position in the writer - * @access private - */ - var $offset = 0; + /** + * @var int Current position in the writer + * @access private + */ + var $offset = 0; - /** - * @var string Optional comment to add to the zip - * @access private - */ - var $comment = ""; + /** + * @var string Optional comment to add to the zip + * @access private + */ + var $comment = ""; - /** - * @var string Data written at the end of the ZIP file - * @access private - */ - var $central = ""; + /** + * @var string Data written at the end of the ZIP file + * @access private + */ + var $central = ""; - /** - * @var string Data written at the start of the ZIP file - * @access private - */ - var $start = ""; + /** + * @var string Data written at the start of the ZIP file + * @access private + */ + var $start = ""; - /** - * Set a comment on the ZIP file - */ - function setComment($comment) { $this->comment = $comment; } + /** + * Set a comment on the ZIP file + */ + function setComment($comment) { $this->comment = $comment; } - /** - * @param int $time Unix timestamp of the date to convert - * @return the date formatted as a ZIP date - */ - function getMTime($time) - { - $mtime = ($time !== null ? getdate($time) : getdate()); - $mtime = preg_replace( - "/(..){1}(..){1}(..){1}(..){1}/", - "\\x\\4\\x\\3\\x\\2\\x\\1", - dechex(($mtime['year']-1980<<25)| - ($mtime['mon' ]<<21)| - ($mtime['mday' ]<<16)| - ($mtime['hours' ]<<11)| - ($mtime['minutes']<<5)| - ($mtime['seconds']>>1))); - eval('$mtime = "'.$mtime.'";'); - return $mtime; - } + /** + * @param int $time Unix timestamp of the date to convert + * @return the date formatted as a ZIP date + */ + function getMTime($time) + { + $mtime = ($time !== null ? getdate($time) : getdate()); + $mtime = preg_replace( + "/(..){1}(..){1}(..){1}(..){1}/", + "\\x\\4\\x\\3\\x\\2\\x\\1", + dechex(($mtime['year']-1980<<25)| + ($mtime['mon' ]<<21)| + ($mtime['mday' ]<<16)| + ($mtime['hours' ]<<11)| + ($mtime['minutes']<<5)| + ($mtime['seconds']>>1))); + eval('$mtime = "'.$mtime.'";'); + return $mtime; + } - private function getFileEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $data, $corrupt, $fakecomp) - { - switch ($corrupt) { - case null : - $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) . - $filename . - $data; - break; - case 'compress' : - $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $fakecomp) . - $mtime . - pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) . - $filename . - $data; - break; - case 'encrypt' : - $file = "PK\x03\x04\x14\x00\x01\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) . - $filename . - $data; - break; - case 'crc32' : - $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvv", $crc32 + 1, $complength, $uncomplength, strlen($filename), 0x00) . - $filename . - $data; - break; - case 'complength' : - $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvv", $crc32, $complength + 1, $uncomplength, strlen($filename), 0x00) . - $filename . - $data; - break; - case 'uncomplength' : - $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvv", $crc32, $complength, $uncomplength - 1, strlen($filename), 0x00) . - $filename . - $data; - break; - case 'filename_len' : - $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename) - 1, 0x00) . - $filename . - $data; - break; - case 'extra_len' : - $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 1) . - $filename . - $data; - break; - case 'filename' : - $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) . - substr($filename, 1) . - $data; - break; - case 'data' : - $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) . - $filename . - substr($data, 1); - break; - } - return $file; - } + private function getFileEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $data, $corrupt, $fakecomp) + { + switch ($corrupt) { + case null : + $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) . + $filename . + $data; + break; + case 'compress' : + $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $fakecomp) . + $mtime . + pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) . + $filename . + $data; + break; + case 'encrypt' : + $file = "PK\x03\x04\x14\x00\x01\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) . + $filename . + $data; + break; + case 'crc32' : + $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvv", $crc32 + 1, $complength, $uncomplength, strlen($filename), 0x00) . + $filename . + $data; + break; + case 'complength' : + $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvv", $crc32, $complength + 1, $uncomplength, strlen($filename), 0x00) . + $filename . + $data; + break; + case 'uncomplength' : + $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvv", $crc32, $complength, $uncomplength - 1, strlen($filename), 0x00) . + $filename . + $data; + break; + case 'filename_len' : + $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename) - 1, 0x00) . + $filename . + $data; + break; + case 'extra_len' : + $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 1) . + $filename . + $data; + break; + case 'filename' : + $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) . + substr($filename, 1) . + $data; + break; + case 'data' : + $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) . + $filename . + substr($data, 1); + break; + } + return $file; + } - private function getCentralEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $comment, $corrupt, &$offset, $fakecomp) - { - settype($comment, 'string'); - switch ($corrupt) { - case null : - $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00, - 0x0000, $this->offset). - $filename . $comment; - $offset = strlen($central); - break; - case 'encrypt' : - $central = "PK\x01\x02\x00\x00\x14\x00\x01\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00, - 0x0000, $this->offset). - $filename . $comment; - $offset = strlen($central); - break; - case 'compress' : - $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $fakecomp) . - $mtime . - pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00, - 0x0000, $this->offset). - $filename . $comment; - $offset = strlen($central); - break; - case 'crc32' : - $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvvvvvVV", $crc32 + 1, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00, - 0x0000, $this->offset). - $filename . $comment; - $offset = strlen($central); - break; - case 'complength' : - $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvvvvvVV", $crc32, $complength - 1, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00, - 0x0000, $this->offset). - $filename . $comment; - $offset = strlen($central); - break; - case 'uncomplength' : - $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvvvvvVV", $crc32, $complength, $uncomplength - 1, strlen($filename), 0x00,strlen($comment),0x00,0x00, - 0x0000, $this->offset). - $filename . $comment; - $offset = strlen($central); - break; - case 'filename_len' : - $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename) - 1, 0x00,strlen($comment),0x00,0x00, - 0x0000, $this->offset). - $filename . $comment; - $offset = strlen($central); - break; - case 'offset' : - $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00, - 0x0000, $this->offset - 1). - $filename . $comment; - $offset = strlen($central) - 1; - break; - case 'comment' : - $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment) + 1,0x00,0x00, - 0x0000, $this->offset). - $filename . $comment; - $offset = strlen($central); - break; - case 'extralen1' : - $extra = 'nu' . 0xffff; // way huge size - $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . - $mtime . - pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), strlen($extra),strlen($comment),0x00,0x00, - 0x0000, $this->offset). - $filename . $extra . $comment; - $offset = strlen($central); - break; - } - return $central; - } + private function getCentralEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $comment, $corrupt, &$offset, $fakecomp) + { + settype($comment, 'string'); + switch ($corrupt) { + case null : + $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00, + 0x0000, $this->offset). + $filename . $comment; + $offset = strlen($central); + break; + case 'encrypt' : + $central = "PK\x01\x02\x00\x00\x14\x00\x01\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00, + 0x0000, $this->offset). + $filename . $comment; + $offset = strlen($central); + break; + case 'compress' : + $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $fakecomp) . + $mtime . + pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00, + 0x0000, $this->offset). + $filename . $comment; + $offset = strlen($central); + break; + case 'crc32' : + $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvvvvvVV", $crc32 + 1, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00, + 0x0000, $this->offset). + $filename . $comment; + $offset = strlen($central); + break; + case 'complength' : + $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvvvvvVV", $crc32, $complength - 1, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00, + 0x0000, $this->offset). + $filename . $comment; + $offset = strlen($central); + break; + case 'uncomplength' : + $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvvvvvVV", $crc32, $complength, $uncomplength - 1, strlen($filename), 0x00,strlen($comment),0x00,0x00, + 0x0000, $this->offset). + $filename . $comment; + $offset = strlen($central); + break; + case 'filename_len' : + $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename) - 1, 0x00,strlen($comment),0x00,0x00, + 0x0000, $this->offset). + $filename . $comment; + $offset = strlen($central); + break; + case 'offset' : + $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00, + 0x0000, $this->offset - 1). + $filename . $comment; + $offset = strlen($central) - 1; + break; + case 'comment' : + $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment) + 1,0x00,0x00, + 0x0000, $this->offset). + $filename . $comment; + $offset = strlen($central); + break; + case 'extralen1' : + $extra = 'nu' . 0xffff; // way huge size + $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), strlen($extra),strlen($comment),0x00,0x00, + 0x0000, $this->offset). + $filename . $extra . $comment; + $offset = strlen($central); + break; + } + return $central; + } - function addFile($filename, $mtime, $data, $comment = null, $compress = null, $filecorrupt = null, $centralcorrupt = null, $fakecomp = 1) - { - $mtime = $this->getMTime($mtime ? $mtime : null); + function addFile($filename, $mtime, $data, $comment = null, $compress = null, $filecorrupt = null, $centralcorrupt = null, $fakecomp = 1) + { + $mtime = $this->getMTime($mtime ? $mtime : null); - $uncomplength = strlen($data); - $crc32 = crc32($data) & 0xFFFFFFFF; - $compmethod = 0; - switch ($compress) { - case 'gz' : - $data = gzcompress($data); - $compmethod = 8; - break; - case 'bz2' : - $data = bzcompress($data); - $compmethod = 12; - break; - } - $complength = strlen($data); + $uncomplength = strlen($data); + $crc32 = crc32($data) & 0xFFFFFFFF; + $compmethod = 0; + switch ($compress) { + case 'gz' : + $data = gzcompress($data); + $compmethod = 8; + break; + case 'bz2' : + $data = bzcompress($data); + $compmethod = 12; + break; + } + $complength = strlen($data); - $this->start .= ($file = $this->getFileEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $data, $filecorrupt, $fakecomp)); + $this->start .= ($file = $this->getFileEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $data, $filecorrupt, $fakecomp)); - $offset = 0; - $this->central .= $this->getCentralEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $comment, $centralcorrupt, $offset, $fakecomp); + $offset = 0; + $this->central .= $this->getCentralEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $comment, $centralcorrupt, $offset, $fakecomp); - $this->offset += $offset; - $this->count++; - } + $this->offset += $offset; + $this->count++; + } - function writeZip($zipfile, $corrupt = null) - { - $write = $this->start . $this->central; - switch ($corrupt) { - case null : - $write .= "PK\x05\x06\x00\x00\x00\x00" . - pack("vvVVv", $this->count, $this->count, - $this->offset, strlen($this->start), - strlen($this->comment)) . $this->comment; - break; - case 'disknumber' : - $write .= "PK\x05\x06\x01\x00\x01\x00" . - pack("vvVVv", $this->count, $this->count, - $this->offset, strlen($this->start), - strlen($this->comment)) . $this->comment; - break; - case 'count1' : - $write .= "PK\x05\x06\x00\x00\x00\x00" . - pack("vvVVv", $this->count + 1, $this->count, - $this->offset, strlen($this->start), - strlen($this->comment)) . $this->comment; - break; - case 'count2' : - $write .= "PK\x05\x06\x00\x00\x00\x00" . - pack("vvVVv", $this->count, $this->count + 1, - $this->offset, strlen($this->start), - strlen($this->comment)) . $this->comment; - break; - case 'cdir_offset' : - $write .= "PK\x05\x06\x00\x00\x00\x00" . - pack("vvVVv", $this->count, $this->count, - $this->offset, strlen($this->start) - 3, - strlen($this->comment)) . $this->comment; - break; - case 'cdir_len' : - $write .= "PK\x05\x06\x00\x00\x00\x00" . - pack("vvVVv", $this->count, $this->count, - $this->offset - 5, strlen($this->start), - strlen($this->comment)) . $this->comment; - break; - case 'comment' : - $write .= "PK\x05\x06\x00\x00\x00\x00" . - pack("vvVVv", $this->count, $this->count, - strlen($this->start), $this->offset + 1, - strlen($this->comment) + 1) . $this->comment; - break; - case 'none' : - } - file_put_contents($zipfile, $write); - } + function writeZip($zipfile, $corrupt = null) + { + $write = $this->start . $this->central; + switch ($corrupt) { + case null : + $write .= "PK\x05\x06\x00\x00\x00\x00" . + pack("vvVVv", $this->count, $this->count, + $this->offset, strlen($this->start), + strlen($this->comment)) . $this->comment; + break; + case 'disknumber' : + $write .= "PK\x05\x06\x01\x00\x01\x00" . + pack("vvVVv", $this->count, $this->count, + $this->offset, strlen($this->start), + strlen($this->comment)) . $this->comment; + break; + case 'count1' : + $write .= "PK\x05\x06\x00\x00\x00\x00" . + pack("vvVVv", $this->count + 1, $this->count, + $this->offset, strlen($this->start), + strlen($this->comment)) . $this->comment; + break; + case 'count2' : + $write .= "PK\x05\x06\x00\x00\x00\x00" . + pack("vvVVv", $this->count, $this->count + 1, + $this->offset, strlen($this->start), + strlen($this->comment)) . $this->comment; + break; + case 'cdir_offset' : + $write .= "PK\x05\x06\x00\x00\x00\x00" . + pack("vvVVv", $this->count, $this->count, + $this->offset, strlen($this->start) - 3, + strlen($this->comment)) . $this->comment; + break; + case 'cdir_len' : + $write .= "PK\x05\x06\x00\x00\x00\x00" . + pack("vvVVv", $this->count, $this->count, + $this->offset - 5, strlen($this->start), + strlen($this->comment)) . $this->comment; + break; + case 'comment' : + $write .= "PK\x05\x06\x00\x00\x00\x00" . + pack("vvVVv", $this->count, $this->count, + strlen($this->start), $this->offset + 1, + strlen($this->comment) + 1) . $this->comment; + break; + case 'none' : + } + file_put_contents($zipfile, $write); + } } ?> diff --git a/ext/phar/tests/zip/files/make_invalid_tar.php.inc b/ext/phar/tests/zip/files/make_invalid_tar.php.inc index 4f4758bbb6..78fc06629c 100644 --- a/ext/phar/tests/zip/files/make_invalid_tar.php.inc +++ b/ext/phar/tests/zip/files/make_invalid_tar.php.inc @@ -3,10 +3,10 @@ include dirname(__FILE__) . '/tarmaker.php.inc'; class corrupter extends tarmaker { function close() { - parent::close(); - $fp = fopen($this->path, 'r+b'); - fseek($fp, 20); - fwrite($fp, 'oopsie'); - fclose($fp); + parent::close(); + $fp = fopen($this->path, 'r+b'); + fseek($fp, 20); + fwrite($fp, 'oopsie'); + fclose($fp); } } diff --git a/ext/phar/tests/zip/metadata_write_commit.phpt b/ext/phar/tests/zip/metadata_write_commit.phpt index 522ddd10e7..e0e09599af 100644 --- a/ext/phar/tests/zip/metadata_write_commit.phpt +++ b/ext/phar/tests/zip/metadata_write_commit.phpt @@ -23,7 +23,7 @@ $files['c'] = array('cont' => 'c', 'meta' => array('hi', 'there')); $files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar')); foreach($files as $name => $cont) { - var_dump(file_get_contents($p2name.'/'.$name)); + var_dump(file_get_contents($p2name.'/'.$name)); } copy($f2name, $fname); @@ -36,7 +36,7 @@ $phar['d']->setMetadata(true); $phar->setMetadata('hi'); foreach($files as $name => $cont) { - var_dump($phar[$name]->getMetadata()); + var_dump($phar[$name]->getMetadata()); } $phar->stopBuffering(); @@ -45,11 +45,11 @@ unset($phar); $phar = new Phar($fname); foreach($files as $name => $cont) { - var_dump(file_get_contents($pname.'/'.$name)); + var_dump(file_get_contents($pname.'/'.$name)); } foreach($files as $name => $cont) { - var_dump($phar[$name]->getMetadata()); + var_dump($phar[$name]->getMetadata()); } var_dump($phar->getMetadata()); ?> diff --git a/ext/phar/tests/zip/odt.phpt b/ext/phar/tests/zip/odt.phpt index 6f229440f3..af3a52cc9d 100644 --- a/ext/phar/tests/zip/odt.phpt +++ b/ext/phar/tests/zip/odt.phpt @@ -7,17 +7,17 @@ Phar: test a zip archive created by openoffice <?php $a = new PharData(__DIR__ . '/files/odt.odt'); foreach (new RecursiveIteratorIterator($a, RecursiveIteratorIterator::LEAVES_ONLY) as $b) { - if ($b->isDir()) { - echo "dir " . $b->getPathName() . "\n"; - } else { - echo $b->getPathName() . "\n"; - } + if ($b->isDir()) { + echo "dir " . $b->getPathName() . "\n"; + } else { + echo $b->getPathName() . "\n"; + } } // this next line is for increased code coverage try { - $b = new Phar(__DIR__ . '/files/odt.odt'); + $b = new Phar(__DIR__ . '/files/odt.odt'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/phar/tests/zip/open_for_write_existing.phpt b/ext/phar/tests/zip/open_for_write_existing.phpt index c878f5cb1d..f679df744e 100644 --- a/ext/phar/tests/zip/open_for_write_existing.phpt +++ b/ext/phar/tests/zip/open_for_write_existing.phpt @@ -21,7 +21,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/zip/open_for_write_existing_b.phpt b/ext/phar/tests/zip/open_for_write_existing_b.phpt index 68a2d14edd..dd605618ea 100644 --- a/ext/phar/tests/zip/open_for_write_existing_b.phpt +++ b/ext/phar/tests/zip/open_for_write_existing_b.phpt @@ -23,7 +23,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/zip/open_for_write_existing_c.phpt b/ext/phar/tests/zip/open_for_write_existing_c.phpt index f62cd4290b..c4eb78c658 100644 --- a/ext/phar/tests/zip/open_for_write_existing_c.phpt +++ b/ext/phar/tests/zip/open_for_write_existing_c.phpt @@ -23,7 +23,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/zip/open_for_write_newfile.phpt b/ext/phar/tests/zip/open_for_write_newfile.phpt index a3db9558b8..3791689a31 100644 --- a/ext/phar/tests/zip/open_for_write_newfile.phpt +++ b/ext/phar/tests/zip/open_for_write_newfile.phpt @@ -21,7 +21,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/zip/open_for_write_newfile_b.phpt b/ext/phar/tests/zip/open_for_write_newfile_b.phpt index 35a50a12fb..167350abd1 100644 --- a/ext/phar/tests/zip/open_for_write_newfile_b.phpt +++ b/ext/phar/tests/zip/open_for_write_newfile_b.phpt @@ -23,7 +23,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/zip/open_for_write_newfile_c.phpt b/ext/phar/tests/zip/open_for_write_newfile_c.phpt index 0b8e86f7f5..1c2d345050 100644 --- a/ext/phar/tests/zip/open_for_write_newfile_c.phpt +++ b/ext/phar/tests/zip/open_for_write_newfile_c.phpt @@ -23,7 +23,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/zip/phar_buildfromiterator4.phpt b/ext/phar/tests/zip/phar_buildfromiterator4.phpt index 8e6f3993c3..aa1e3596ab 100644 --- a/ext/phar/tests/zip/phar_buildfromiterator4.phpt +++ b/ext/phar/tests/zip/phar_buildfromiterator4.phpt @@ -36,13 +36,13 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip'); - var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . 'phpt')))); - var_dump($phar->isFileFormat(Phar::ZIP)); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip'); + var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . 'phpt')))); + var_dump($phar->isFileFormat(Phar::ZIP)); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/zip/phar_buildfromiterator5.phpt b/ext/phar/tests/zip/phar_buildfromiterator5.phpt index cf7700b965..329a30a5c3 100644 --- a/ext/phar/tests/zip/phar_buildfromiterator5.phpt +++ b/ext/phar/tests/zip/phar_buildfromiterator5.phpt @@ -36,12 +36,12 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip'); - var_dump($phar->buildFromIterator(new myIterator(array('a' => new stdClass)))); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip'); + var_dump($phar->buildFromIterator(new myIterator(array('a' => new stdClass)))); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/zip/phar_buildfromiterator6.phpt b/ext/phar/tests/zip/phar_buildfromiterator6.phpt index 0853c8fa24..a2c49f1d56 100644 --- a/ext/phar/tests/zip/phar_buildfromiterator6.phpt +++ b/ext/phar/tests/zip/phar_buildfromiterator6.phpt @@ -36,12 +36,12 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip'); - var_dump($phar->buildFromIterator(new myIterator(array(basename(__FILE__, 'php') . 'phpt')))); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip'); + var_dump($phar->buildFromIterator(new myIterator(array(basename(__FILE__, 'php') . 'phpt')))); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/zip/phar_buildfromiterator7.phpt b/ext/phar/tests/zip/phar_buildfromiterator7.phpt index d4f26e40db..45d36f41e0 100644 --- a/ext/phar/tests/zip/phar_buildfromiterator7.phpt +++ b/ext/phar/tests/zip/phar_buildfromiterator7.phpt @@ -36,12 +36,12 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip'); - var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt')))); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip'); + var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt')))); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/zip/phar_buildfromiterator8.phpt b/ext/phar/tests/zip/phar_buildfromiterator8.phpt index 1713170981..c411e6ee12 100644 --- a/ext/phar/tests/zip/phar_buildfromiterator8.phpt +++ b/ext/phar/tests/zip/phar_buildfromiterator8.phpt @@ -7,15 +7,15 @@ phar.readonly=0 --FILE-- <?php try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip'); - $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^frontcontroller\d{0,2}\.phar\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR); - asort($a); - var_dump($a); - var_dump($phar->isFileFormat(Phar::ZIP)); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip'); + $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^frontcontroller\d{0,2}\.phar\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR); + asort($a); + var_dump($a); + var_dump($phar->isFileFormat(Phar::ZIP)); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/zip/phar_buildfromiterator9.phpt b/ext/phar/tests/zip/phar_buildfromiterator9.phpt index 10361fbeb4..414924d807 100644 --- a/ext/phar/tests/zip/phar_buildfromiterator9.phpt +++ b/ext/phar/tests/zip/phar_buildfromiterator9.phpt @@ -36,13 +36,13 @@ class myIterator implements Iterator } } try { - chdir(__DIR__); - $phar = new Phar(__DIR__ . '/buildfromiterator.phar'); - var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r'))))); - fclose($a); + chdir(__DIR__); + $phar = new Phar(__DIR__ . '/buildfromiterator.phar'); + var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r'))))); + fclose($a); } catch (Exception $e) { - var_dump(get_class($e)); - echo $e->getMessage() . "\n"; + var_dump(get_class($e)); + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/zip/phar_copy.phpt b/ext/phar/tests/zip/phar_copy.phpt index f6424936b7..ea4f108dfc 100644 --- a/ext/phar/tests/zip/phar_copy.phpt +++ b/ext/phar/tests/zip/phar_copy.phpt @@ -19,20 +19,20 @@ $p = new Phar($fname); try { - $p['a'] = 'hi'; - $p->startBuffering(); - $p->copy('a', 'b'); - echo file_get_contents($p['b']->getPathName()); - $p->copy('b', 'c'); - $p->stopBuffering(); - echo file_get_contents($p['c']->getPathName()); - copy($fname, $fname2); - var_dump($p->isFileFormat(Phar::ZIP)); - $p->copy('a', $ename); + $p['a'] = 'hi'; + $p->startBuffering(); + $p->copy('a', 'b'); + echo file_get_contents($p['b']->getPathName()); + $p->copy('b', 'c'); + $p->stopBuffering(); + echo file_get_contents($p['c']->getPathName()); + copy($fname, $fname2); + var_dump($p->isFileFormat(Phar::ZIP)); + $p->copy('a', $ename); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ini_set('phar.readonly',1); $p2 = new Phar($fname2); diff --git a/ext/phar/tests/zip/phar_setalias.phpt b/ext/phar/tests/zip/phar_setalias.phpt index 2148316086..96453a90ff 100644 --- a/ext/phar/tests/zip/phar_setalias.phpt +++ b/ext/phar/tests/zip/phar_setalias.phpt @@ -25,7 +25,7 @@ $files['b'] = 'b'; $files['c'] = 'c'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/zip/phar_setalias2.phpt b/ext/phar/tests/zip/phar_setalias2.phpt index 0af688703b..e438e64bb5 100644 --- a/ext/phar/tests/zip/phar_setalias2.phpt +++ b/ext/phar/tests/zip/phar_setalias2.phpt @@ -21,7 +21,7 @@ $files['b'] = 'b'; $files['c'] = 'c'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); @@ -31,9 +31,9 @@ echo $phar->getAlias() . "\n"; $b = $phar; $phar = new Phar(__DIR__ . '/notphar.phar'); try { - $phar->setAlias('test'); + $phar->setAlias('test'); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --CLEAN-- diff --git a/ext/phar/tests/zip/phar_setdefaultstub.phpt b/ext/phar/tests/zip/phar_setdefaultstub.phpt index 92a721ba37..9b5f395957 100644 --- a/ext/phar/tests/zip/phar_setdefaultstub.phpt +++ b/ext/phar/tests/zip/phar_setdefaultstub.phpt @@ -20,10 +20,10 @@ echo "========================================================================== echo "============================================================================\n"; try { - $phar->setDefaultStub(); - $phar->stopBuffering(); + $phar->setDefaultStub(); + $phar->stopBuffering(); } catch(Exception $e) { - echo $e->getMessage(). "\n"; + echo $e->getMessage(). "\n"; } var_dump($phar->getStub()); @@ -32,10 +32,10 @@ echo "========================================================================== echo "============================================================================\n"; try { - $phar->setDefaultStub('my/custom/thingy.php'); - $phar->stopBuffering(); + $phar->setDefaultStub('my/custom/thingy.php'); + $phar->stopBuffering(); } catch(Exception $e) { - echo $e->getMessage(). "\n"; + echo $e->getMessage(). "\n"; } var_dump($phar->getStub()); @@ -44,10 +44,10 @@ echo "========================================================================== echo "============================================================================\n"; try { - $phar->setDefaultStub('my/custom/thingy.php', 'the/web.php'); - $phar->stopBuffering(); + $phar->setDefaultStub('my/custom/thingy.php', 'the/web.php'); + $phar->stopBuffering(); } catch(Exception $e) { - echo $e->getMessage(). "\n"; + echo $e->getMessage(). "\n"; } var_dump($phar->getStub()); diff --git a/ext/phar/tests/zip/phar_stub_error.phpt b/ext/phar/tests/zip/phar_stub_error.phpt index 0d2cedebc3..d19393f430 100644 --- a/ext/phar/tests/zip/phar_stub_error.phpt +++ b/ext/phar/tests/zip/phar_stub_error.phpt @@ -22,11 +22,11 @@ var_dump($phar->getStub() == $stub); $newstub = '<?php echo "second stub\n"; _x_HALT_COMPILER(); ?>'; try { - $phar->setStub($newstub); + $phar->setStub($newstub); } catch(exception $e) { - echo 'Exception: ' . $e->getMessage() . "\n"; + echo 'Exception: ' . $e->getMessage() . "\n"; } var_dump($phar->getStub()); var_dump($phar->getStub() == $stub); diff --git a/ext/phar/tests/zip/refcount1.phpt b/ext/phar/tests/zip/refcount1.phpt index e5db8285e1..0fd122a79c 100644 --- a/ext/phar/tests/zip/refcount1.phpt +++ b/ext/phar/tests/zip/refcount1.phpt @@ -22,7 +22,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; foreach ($files as $n => $file) { - $phar[$n] = $file; + $phar[$n] = $file; } $phar->stopBuffering(); diff --git a/ext/phar/tests/zip/unixzip.phpt b/ext/phar/tests/zip/unixzip.phpt index e281a18f0b..f1a51fede8 100644 --- a/ext/phar/tests/zip/unixzip.phpt +++ b/ext/phar/tests/zip/unixzip.phpt @@ -6,15 +6,15 @@ Phar: test a zip archive created by unix "zip" command <?php $a = new PharData(__DIR__ . '/files/zip.zip'); foreach ($a as $b) { - if ($b->isDir()) { - echo "dir " . $b->getPathName() . "\n"; - } else { - echo $b->getPathName(), "\n"; - echo file_get_contents($b->getPathName()), "\n"; - } + if ($b->isDir()) { + echo "dir " . $b->getPathName() . "\n"; + } else { + echo $b->getPathName(), "\n"; + echo file_get_contents($b->getPathName()), "\n"; + } } if (isset($a['notempty/hi.txt'])) { - echo $a['notempty/hi.txt']->getPathName() . "\n"; + echo $a['notempty/hi.txt']->getPathName() . "\n"; } ?> --EXPECTF-- diff --git a/ext/phar/tests/zip/zlib.phpt b/ext/phar/tests/zip/zlib.phpt index 5cd59fcac4..96b63e73a6 100644 --- a/ext/phar/tests/zip/zlib.phpt +++ b/ext/phar/tests/zip/zlib.phpt @@ -6,10 +6,10 @@ Phar: process zlib-compressed zip alias --FILE-- <?php try { - $a = new Phar(__DIR__ . '/files/zlib_alias.phar.zip'); - var_dump($a->getAlias()); + $a = new Phar(__DIR__ . '/files/zlib_alias.phar.zip'); + var_dump($a->getAlias()); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/posix/tests/posix_getgroups_basic.phpt b/ext/posix/tests/posix_getgroups_basic.phpt index fd8b3af305..7a877d7663 100644 --- a/ext/posix/tests/posix_getgroups_basic.phpt +++ b/ext/posix/tests/posix_getgroups_basic.phpt @@ -11,9 +11,9 @@ Test posix_getgroups() function : basic functionality $groups = posix_getgroups(); if (!is_array($groups)) { - echo "TEST FAILED - array result expected\n"; + echo "TEST FAILED - array result expected\n"; } else { - echo "TEST PASSED\n"; + echo "TEST PASSED\n"; } ?> diff --git a/ext/posix/tests/posix_kill_basic.phpt b/ext/posix/tests/posix_kill_basic.phpt index 4ce50ca497..6e48ebed3b 100644 --- a/ext/posix/tests/posix_kill_basic.phpt +++ b/ext/posix/tests/posix_kill_basic.phpt @@ -8,24 +8,24 @@ Test posix_kill(), posix_get_last_error and posix_strerror() functions : basic f <?php echo "Basic test of POSIX getpgid(), kill(), get_last_error() and strerror() functions\n"; - // Don't rely on PCNTL extension being around - $SIGKILL = 9; + // Don't rely on PCNTL extension being around + $SIGKILL = 9; - // TODO Once we have PS open working beef up this test to create a process and kill it - // for now start at a low pid and find first pid which does not exist. - $pid = 999; - do { - $pid += 1; - $result = shell_exec("ps -p " . $pid); - } while (stripos($result, (string)$pid) != FALSE); + // TODO Once we have PS open working beef up this test to create a process and kill it + // for now start at a low pid and find first pid which does not exist. + $pid = 999; + do { + $pid += 1; + $result = shell_exec("ps -p " . $pid); + } while (stripos($result, (string)$pid) != FALSE); - echo "Kill pid=" . $pid . "\n"; - var_dump(posix_kill($pid,$SIGKILL)); + echo "Kill pid=" . $pid . "\n"; + var_dump(posix_kill($pid,$SIGKILL)); - $errno = posix_get_last_error(); + $errno = posix_get_last_error(); - var_dump($errno); - var_dump(posix_strerror($errno)); + var_dump($errno); + var_dump(posix_strerror($errno)); ?> ===DONE==== diff --git a/ext/posix/tests/posix_times_basic.phpt b/ext/posix/tests/posix_times_basic.phpt index ad37834fd9..49da6b8aeb 100644 --- a/ext/posix/tests/posix_times_basic.phpt +++ b/ext/posix/tests/posix_times_basic.phpt @@ -14,8 +14,8 @@ Test posix_times() function : basic functionality if ($times == FALSE) { - $errno= posix_get_last_error(); - var_dump(posix_strerror($errno)); + $errno= posix_get_last_error(); + var_dump(posix_strerror($errno)); } ?> diff --git a/ext/pspell/tests/002.phpt b/ext/pspell/tests/002.phpt index 538775d013..34913ae826 100644 --- a/ext/pspell/tests/002.phpt +++ b/ext/pspell/tests/002.phpt @@ -18,11 +18,11 @@ var_dump(pspell_check($p, 'somebogusword')); $res = @pspell_clear_session($p); if ($res) { - var_dump($res); - var_dump(pspell_check($p, 'somebogusword')); + var_dump($res); + var_dump(pspell_check($p, 'somebogusword')); } else { - echo "bool(true)\n"; - echo "bool(false)\n"; + echo "bool(true)\n"; + echo "bool(false)\n"; } ?> --EXPECTF-- diff --git a/ext/readline/tests/libedit_callback_handler_install_001.phpt b/ext/readline/tests/libedit_callback_handler_install_001.phpt index fb69ba5cb0..c4cfced627 100644 --- a/ext/readline/tests/libedit_callback_handler_install_001.phpt +++ b/ext/readline/tests/libedit_callback_handler_install_001.phpt @@ -8,7 +8,7 @@ if (READLINE_LIB != "libedit") die("skip libedit only"); <?php function foo() { - readline_callback_handler_remove(); + readline_callback_handler_remove(); } var_dump(readline_callback_handler_install('testing: ', 'foo')); diff --git a/ext/readline/tests/readline_callback_handler_install_001.phpt b/ext/readline/tests/readline_callback_handler_install_001.phpt index 9dd13b4de1..7f908ee393 100644 --- a/ext/readline/tests/readline_callback_handler_install_001.phpt +++ b/ext/readline/tests/readline_callback_handler_install_001.phpt @@ -8,7 +8,7 @@ if (READLINE_LIB == "libedit") die("skip readline only"); <?php function foo() { - readline_callback_handler_remove(); + readline_callback_handler_remove(); } var_dump(readline_callback_handler_install('testing: ', 'foo')); diff --git a/ext/readline/tests/readline_completion_function_001.phpt b/ext/readline/tests/readline_completion_function_001.phpt index 828636cd83..6ba88756b8 100644 --- a/ext/readline/tests/readline_completion_function_001.phpt +++ b/ext/readline/tests/readline_completion_function_001.phpt @@ -8,14 +8,14 @@ readline_completion_function(): Basic test function foo() { } $data = array( - 'foo', - 'strtolower', - 1, - 1.1231 + 'foo', + 'strtolower', + 1, + 1.1231 ); foreach ($data as $callback) { - readline_completion_function($callback); + readline_completion_function($callback); } ?> diff --git a/ext/reflection/tests/001.phpt b/ext/reflection/tests/001.phpt index 266a1ef5ff..d476013653 100644 --- a/ext/reflection/tests/001.phpt +++ b/ext/reflection/tests/001.phpt @@ -5,17 +5,17 @@ Reflection inheritance class ReflectionClassEx extends ReflectionClass { - public $bla; + public $bla; - function getMethodNames() - { - $res = array(); - foreach($this->getMethods() as $m) - { - $res[] = $m->class . '::' . $m->name; - } - return $res; - } + function getMethodNames() + { + $res = array(); + foreach($this->getMethods() as $m) + { + $res[] = $m->class . '::' . $m->name; + } + return $res; + } } $r = new ReflectionClassEx('ReflectionClassEx'); @@ -62,10 +62,10 @@ $res = $r->getMethodNames(); foreach($exp as $m) { - if (!in_array($m, $exp)) - { - $miss[] = $m; - } + if (!in_array($m, $exp)) + { + $miss[] = $m; + } } var_dump($miss); diff --git a/ext/reflection/tests/002.phpt b/ext/reflection/tests/002.phpt index 6df97f0daa..b10013d2a9 100644 --- a/ext/reflection/tests/002.phpt +++ b/ext/reflection/tests/002.phpt @@ -5,13 +5,13 @@ Reflection properties are read only class ReflectionMethodEx extends ReflectionMethod { - public $foo = "xyz"; + public $foo = "xyz"; - function __construct($c,$m) - { - echo __METHOD__ . "\n"; - parent::__construct($c,$m); - } + function __construct($c,$m) + { + echo __METHOD__ . "\n"; + parent::__construct($c,$m); + } } $r = new ReflectionMethodEx('ReflectionMethodEx','getName'); @@ -23,11 +23,11 @@ var_dump($r->foo); try { - $r->class = 'bullshit'; + $r->class = 'bullshit'; } catch(ReflectionException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { @@ -35,7 +35,7 @@ $r->name = 'bullshit'; } catch(ReflectionException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } $r->foo = 'bar'; diff --git a/ext/reflection/tests/003.phpt b/ext/reflection/tests/003.phpt index 8c37d539ac..dbafebfb8d 100644 --- a/ext/reflection/tests/003.phpt +++ b/ext/reflection/tests/003.phpt @@ -5,18 +5,18 @@ ReflectionMethod::invoke() with base class method class Foo { - function Test() - { - echo __METHOD__ . "\n"; - } + function Test() + { + echo __METHOD__ . "\n"; + } } class Bar extends Foo { - function Test() - { - echo __METHOD__ . "\n"; - } + function Test() + { + echo __METHOD__ . "\n"; + } } $o = new Bar; diff --git a/ext/reflection/tests/004.phpt b/ext/reflection/tests/004.phpt index 924c3fe283..3739d2e55c 100644 --- a/ext/reflection/tests/004.phpt +++ b/ext/reflection/tests/004.phpt @@ -4,8 +4,8 @@ ReflectionMethod::invoke() with non object or null value <?php class a { - function __construct(){ - } + function __construct(){ + } } class b { } diff --git a/ext/reflection/tests/005.phpt b/ext/reflection/tests/005.phpt index cb099129e7..58411f98c8 100644 --- a/ext/reflection/tests/005.phpt +++ b/ext/reflection/tests/005.phpt @@ -7,18 +7,18 @@ opcache.save_comments=1 function strip_doc_comment($c) { - if (!strlen($c) || $c === false) return $c; - return trim(substr($c, 3, -2)); + if (!strlen($c) || $c === false) return $c; + return trim(substr($c, 3, -2)); } /** Comment for class A */ class A { - /** Method A::bla() - */ - function bla() - { - } + /** Method A::bla() + */ + function bla() + { + } function foo() { /** @@ -42,7 +42,7 @@ var_dump(strip_doc_comment($r->getDocComment())); foreach($r->getMethods() as $m) { - var_dump(strip_doc_comment($m->getDocComment())); + var_dump(strip_doc_comment($m->getDocComment())); } ?> diff --git a/ext/reflection/tests/006.phpt b/ext/reflection/tests/006.phpt index 28d4cc592b..c21aa5af8b 100644 --- a/ext/reflection/tests/006.phpt +++ b/ext/reflection/tests/006.phpt @@ -9,73 +9,73 @@ ReflectionClass::[gs]etStaticPropertyValue Class Test { - static public $pub = 'pub'; - static protected $pro = 'pro'; - static private $pri = 'pri'; + static public $pub = 'pub'; + static protected $pro = 'pro'; + static private $pri = 'pri'; - static function testing() - { - $ref = new ReflectionClass('Test'); + static function testing() + { + $ref = new ReflectionClass('Test'); - foreach(array('pub', 'pro', 'pri') as $name) - { - try - { - var_dump($ref->getStaticPropertyValue($name)); - var_dump($ref->getStaticPropertyValue($name)); - $ref->setStaticPropertyValue($name, 'updated'); - var_dump($ref->getStaticPropertyValue($name)); - } - catch(Exception $e) - { - echo "EXCEPTION\n"; - } - } - } + foreach(array('pub', 'pro', 'pri') as $name) + { + try + { + var_dump($ref->getStaticPropertyValue($name)); + var_dump($ref->getStaticPropertyValue($name)); + $ref->setStaticPropertyValue($name, 'updated'); + var_dump($ref->getStaticPropertyValue($name)); + } + catch(Exception $e) + { + echo "EXCEPTION\n"; + } + } + } } Class TestDerived extends Test { // static public $pub = 'pub'; // static protected $pro = 'pro'; - static private $pri = 'pri'; + static private $pri = 'pri'; - static function testing() - { - $ref = new ReflectionClass('Test'); + static function testing() + { + $ref = new ReflectionClass('Test'); - foreach(array('pub', 'pro', 'pri') as $name) - { - try - { - var_dump($ref->getStaticPropertyValue($name)); - var_dump($ref->getStaticPropertyValue($name)); - $ref->setStaticPropertyValue($name, 'updated'); - var_dump($ref->getStaticPropertyValue($name)); - } - catch(Exception $e) - { - echo "EXCEPTION\n"; - } - } - } + foreach(array('pub', 'pro', 'pri') as $name) + { + try + { + var_dump($ref->getStaticPropertyValue($name)); + var_dump($ref->getStaticPropertyValue($name)); + $ref->setStaticPropertyValue($name, 'updated'); + var_dump($ref->getStaticPropertyValue($name)); + } + catch(Exception $e) + { + echo "EXCEPTION\n"; + } + } + } } $ref = new ReflectionClass('Test'); foreach(array('pub', 'pro', 'pri') as $name) { - try - { - var_dump($ref->getStaticPropertyValue($name)); - var_dump($ref->getStaticPropertyValue($name)); - $ref->setStaticPropertyValue($name, 'updated'); - var_dump($ref->getStaticPropertyValue($name)); - } - catch(Exception $e) - { - echo "EXCEPTION\n"; - } + try + { + var_dump($ref->getStaticPropertyValue($name)); + var_dump($ref->getStaticPropertyValue($name)); + $ref->setStaticPropertyValue($name, 'updated'); + var_dump($ref->getStaticPropertyValue($name)); + } + catch(Exception $e) + { + echo "EXCEPTION\n"; + } } Test::testing(); diff --git a/ext/reflection/tests/007.phpt b/ext/reflection/tests/007.phpt index 57e3ee47fe..df1d97eea9 100644 --- a/ext/reflection/tests/007.phpt +++ b/ext/reflection/tests/007.phpt @@ -5,56 +5,56 @@ ReflectionClass::newInstance[Args] function test($class) { - echo "====>$class\n"; - try - { - $ref = new ReflectionClass($class); - } - catch (ReflectionException $e) - { - var_dump($e->getMessage()); - return; // only here - } - - echo "====>newInstance()\n"; - try - { - var_dump($ref->newInstance()); - } - catch (ReflectionException $e) - { - var_dump($e->getMessage()); - } - catch (Throwable $e) - { - echo "Exception: " . $e->getMessage() . "\n"; - } - - echo "====>newInstance(25)\n"; - try - { - var_dump($ref->newInstance(25)); - } - catch (ReflectionException $e) - { - var_dump($e->getMessage()); - } - - echo "====>newInstance(25, 42)\n"; - try - { - var_dump($ref->newInstance(25, 42)); - } - catch (ReflectionException $e) - { - var_dump($e->getMessage()); - } - - echo "\n"; + echo "====>$class\n"; + try + { + $ref = new ReflectionClass($class); + } + catch (ReflectionException $e) + { + var_dump($e->getMessage()); + return; // only here + } + + echo "====>newInstance()\n"; + try + { + var_dump($ref->newInstance()); + } + catch (ReflectionException $e) + { + var_dump($e->getMessage()); + } + catch (Throwable $e) + { + echo "Exception: " . $e->getMessage() . "\n"; + } + + echo "====>newInstance(25)\n"; + try + { + var_dump($ref->newInstance(25)); + } + catch (ReflectionException $e) + { + var_dump($e->getMessage()); + } + + echo "====>newInstance(25, 42)\n"; + try + { + var_dump($ref->newInstance(25, 42)); + } + catch (ReflectionException $e) + { + var_dump($e->getMessage()); + } + + echo "\n"; } spl_autoload_register(function ($class) { - echo __FUNCTION__ . "($class)\n"; + echo __FUNCTION__ . "($class)\n"; }); test('Class_does_not_exist'); @@ -67,22 +67,22 @@ test('NoCtor'); Class WithCtor { - function __construct() - { - echo __METHOD__ . "()\n"; - var_dump(func_get_args()); - } + function __construct() + { + echo __METHOD__ . "()\n"; + var_dump(func_get_args()); + } } test('WithCtor'); Class WithCtorWithArgs { - function __construct($arg) - { - echo __METHOD__ . "($arg)\n"; - var_dump(func_get_args()); - } + function __construct($arg) + { + echo __METHOD__ . "($arg)\n"; + var_dump(func_get_args()); + } } test('WithCtorWithArgs'); diff --git a/ext/reflection/tests/008.phpt b/ext/reflection/tests/008.phpt index 80a4a39218..10806b0015 100644 --- a/ext/reflection/tests/008.phpt +++ b/ext/reflection/tests/008.phpt @@ -6,22 +6,22 @@ ReflectionMethod::__construct() tests $a = array("", 1, "::", "a::", "::b", "a::b"); foreach ($a as $val) { - try { - new ReflectionMethod($val); - } catch (Exception $e) { - var_dump($e->getMessage()); - } + try { + new ReflectionMethod($val); + } catch (Exception $e) { + var_dump($e->getMessage()); + } } $a = array("", 1, ""); $b = array("", "", 1); foreach ($a as $key=>$val) { - try { - new ReflectionMethod($val, $b[$key]); - } catch (Exception $e) { - var_dump($e->getMessage()); - } + try { + new ReflectionMethod($val, $b[$key]); + } catch (Exception $e) { + var_dump($e->getMessage()); + } } echo "Done\n"; diff --git a/ext/reflection/tests/009.phpt b/ext/reflection/tests/009.phpt index d582623cbd..8a57ed9d1d 100644 --- a/ext/reflection/tests/009.phpt +++ b/ext/reflection/tests/009.phpt @@ -9,7 +9,7 @@ opcache.save_comments=1 hoho */ function test ($a, $b = 1, $c = "") { - static $var = 1; + static $var = 1; } $func = new ReflectionFunction("test"); diff --git a/ext/reflection/tests/010.phpt b/ext/reflection/tests/010.phpt index ae667b65ab..ae1e4dff0b 100644 --- a/ext/reflection/tests/010.phpt +++ b/ext/reflection/tests/010.phpt @@ -3,12 +3,12 @@ ReflectionMethod::__toString() tests (overridden method) --FILE-- <?php class Foo { - function func() { - } + function func() { + } } class Bar extends Foo { - function func() { - } + function func() { + } } $m = new ReflectionMethod("Bar::func"); echo $m; diff --git a/ext/reflection/tests/012.phpt b/ext/reflection/tests/012.phpt index d2d1c5f384..4eeeb98f3d 100644 --- a/ext/reflection/tests/012.phpt +++ b/ext/reflection/tests/012.phpt @@ -3,7 +3,7 @@ ReflectionClass::getDefaultProperties() --FILE-- <?php class Foo { - public $test = "ok"; + public $test = "ok"; } $class = new ReflectionClass("Foo"); $props = $class->getDefaultProperties(); diff --git a/ext/reflection/tests/017.phpt b/ext/reflection/tests/017.phpt index 322065bf20..be306b53c6 100644 --- a/ext/reflection/tests/017.phpt +++ b/ext/reflection/tests/017.phpt @@ -3,7 +3,7 @@ ReflectionClass::__toString() (constants) --FILE-- <?php class Foo { - const test = "ok"; + const test = "ok"; } $class = new ReflectionClass("Foo"); echo $class; diff --git a/ext/reflection/tests/020.phpt b/ext/reflection/tests/020.phpt index 13ae6fe275..491eed7d1f 100644 --- a/ext/reflection/tests/020.phpt +++ b/ext/reflection/tests/020.phpt @@ -3,14 +3,14 @@ ReflectionObject::hasProperty --FILE-- <?php class Foo { - public $p1; - protected $p2; - private $p3; + public $p1; + protected $p2; + private $p3; - function __isset($name) { - var_dump($name); - return false; - } + function __isset($name) { + var_dump($name); + return false; + } } $obj = new ReflectionObject(new Foo()); var_dump($obj->hasProperty("p1")); diff --git a/ext/reflection/tests/021.phpt b/ext/reflection/tests/021.phpt index 42d11cc445..fefcf34e78 100644 --- a/ext/reflection/tests/021.phpt +++ b/ext/reflection/tests/021.phpt @@ -3,7 +3,7 @@ ReflectionClass::hasConstant --FILE-- <?php class Foo { - const c1 = 1; + const c1 = 1; } $class = new ReflectionClass("Foo"); var_dump($class->hasConstant("c1")); diff --git a/ext/reflection/tests/022.phpt b/ext/reflection/tests/022.phpt index 2cfd603dad..4a6738f97c 100644 --- a/ext/reflection/tests/022.phpt +++ b/ext/reflection/tests/022.phpt @@ -3,7 +3,7 @@ ReflectionClass::getConstant --FILE-- <?php class Foo { - const c1 = 1; + const c1 = 1; } $class = new ReflectionClass("Foo"); var_dump($class->getConstant("c1")); diff --git a/ext/reflection/tests/023.phpt b/ext/reflection/tests/023.phpt index fe10b2531a..7f8c500015 100644 --- a/ext/reflection/tests/023.phpt +++ b/ext/reflection/tests/023.phpt @@ -3,14 +3,14 @@ ReflectionClass::getDefaultProperties (filtering parent privates) --FILE-- <?php class C1 { - private $p1 = 1; - protected $p2 = 2; - public $p3 = 3; + private $p1 = 1; + protected $p2 = 2; + public $p3 = 3; } class C2 extends C1 { - private $p4 = 4; - protected $p5 = 5; - public $p6 = 6; + private $p4 = 4; + protected $p5 = 5; + public $p6 = 6; } $class = new ReflectionClass("C2"); var_dump($class->getDefaultProperties()); diff --git a/ext/reflection/tests/024.phpt b/ext/reflection/tests/024.phpt index 2b894d3f31..0fb1cd6fe2 100644 --- a/ext/reflection/tests/024.phpt +++ b/ext/reflection/tests/024.phpt @@ -3,9 +3,9 @@ ReflectionObject::__toString (filtering privates/protected dynamic properties) --FILE-- <?php class C1 { - private $p1 = 1; - protected $p2 = 2; - public $p3 = 3; + private $p1 = 1; + protected $p2 = 2; + public $p3 = 3; } $x = new C1(); diff --git a/ext/reflection/tests/025.phpt b/ext/reflection/tests/025.phpt index c18a0f5b8e..2e3316d3c0 100644 --- a/ext/reflection/tests/025.phpt +++ b/ext/reflection/tests/025.phpt @@ -9,7 +9,7 @@ opcache.save_comments=1 hoho */ function test ($a, $b = 1, $c = "") { - static $var = 1; + static $var = 1; } $func = new ReflectionFunction("test"); diff --git a/ext/reflection/tests/027.phpt b/ext/reflection/tests/027.phpt index e750682ab6..add38f1476 100644 --- a/ext/reflection/tests/027.phpt +++ b/ext/reflection/tests/027.phpt @@ -4,7 +4,7 @@ ReflectionGenerator::getTrace() <?php function foo() { - yield 1; + yield 1; } $g = foo(); @@ -13,9 +13,9 @@ $r = new ReflectionGenerator($g); $g->next(); try { - $r->getTrace(); + $r->getTrace(); } catch (ReflectionException $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> --EXPECT-- diff --git a/ext/reflection/tests/028.phpt b/ext/reflection/tests/028.phpt index ed6950fce3..bf16785c18 100644 --- a/ext/reflection/tests/028.phpt +++ b/ext/reflection/tests/028.phpt @@ -4,16 +4,16 @@ ReflectionGenerator::__construct() <?php function foo() { - yield 1; + yield 1; } $g = foo(); $g->next(); try { - $r = new ReflectionGenerator($g); + $r = new ReflectionGenerator($g); } catch (ReflectionException $e) { - echo "Done!\n"; + echo "Done!\n"; } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionClass_constructor_001.phpt b/ext/reflection/tests/ReflectionClass_constructor_001.phpt index 1a70fe1f59..0d4fa670c3 100644 --- a/ext/reflection/tests/ReflectionClass_constructor_001.phpt +++ b/ext/reflection/tests/ReflectionClass_constructor_001.phpt @@ -8,10 +8,10 @@ $myInstance = new stdClass; $r2 = new ReflectionClass($myInstance); class TrickClass { - function __toString() { - //Return the name of another class - return "Exception"; - } + function __toString() { + //Return the name of another class + return "Exception"; + } } $myTrickClass = new TrickClass; $r3 = new ReflectionClass($myTrickClass); diff --git a/ext/reflection/tests/ReflectionClass_constructor_002.phpt b/ext/reflection/tests/ReflectionClass_constructor_002.phpt index 7d8a312f51..3744fec06c 100644 --- a/ext/reflection/tests/ReflectionClass_constructor_002.phpt +++ b/ext/reflection/tests/ReflectionClass_constructor_002.phpt @@ -3,45 +3,45 @@ ReflectionClass::__constructor() - bad arguments --FILE-- <?php try { - var_dump(new ReflectionClass()); + var_dump(new ReflectionClass()); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump(new ReflectionClass(null)); + var_dump(new ReflectionClass(null)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump(new ReflectionClass(true)); + var_dump(new ReflectionClass(true)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump(new ReflectionClass(1)); + var_dump(new ReflectionClass(1)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump(new ReflectionClass(array(1,2,3))); + var_dump(new ReflectionClass(array(1,2,3))); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump(new ReflectionClass("stdClass", 1)); + var_dump(new ReflectionClass("stdClass", 1)); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump(new ReflectionClass("X")); + var_dump(new ReflectionClass("X")); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt b/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt index 80d2be2585..2e050af209 100644 --- a/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt +++ b/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt @@ -3,8 +3,8 @@ ReflectionClass::__toString() - array constants --FILE-- <?php Class A { - const A = 8; - const B = ["a", "b"]; + const A = 8; + const B = ["a", "b"]; } echo new ReflectionClass("A"), "\n"; ?> diff --git a/ext/reflection/tests/ReflectionClass_export_basic1.phpt b/ext/reflection/tests/ReflectionClass_export_basic1.phpt index 784fc6a5fb..318e47b355 100644 --- a/ext/reflection/tests/ReflectionClass_export_basic1.phpt +++ b/ext/reflection/tests/ReflectionClass_export_basic1.phpt @@ -3,15 +3,15 @@ ReflectionClass::__toString() - various parameters --FILE-- <?php Class A { - public function privf(Exception $a) {} - public function pubf(A $a, - $b, - C $c = null, - $d = K, - $e = "15 chars long -", - $f = null, - $g = false, - array $h = null) {} + public function privf(Exception $a) {} + public function pubf(A $a, + $b, + C $c = null, + $d = K, + $e = "15 chars long -", + $f = null, + $g = false, + array $h = null) {} } Class C extends A { } diff --git a/ext/reflection/tests/ReflectionClass_export_basic2.phpt b/ext/reflection/tests/ReflectionClass_export_basic2.phpt index 12cee4e6e3..c91c5d1d73 100644 --- a/ext/reflection/tests/ReflectionClass_export_basic2.phpt +++ b/ext/reflection/tests/ReflectionClass_export_basic2.phpt @@ -3,8 +3,8 @@ ReflectionClass::__toString() - ensure inherited private props are hidden. --FILE-- <?php Class c { - private $a; - static private $b; + private $a; + static private $b; } class d extends c {} diff --git a/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt index 59031a26ee..b8906b2070 100644 --- a/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt @@ -3,24 +3,24 @@ ReflectionClass::getConstants() --FILE-- <?php class C { - const a = 'hello from C'; + const a = 'hello from C'; } class D extends C { } class E extends D { } class F extends E { - const a = 'hello from F'; + const a = 'hello from F'; } class X { } $classes = array("C", "D", "E", "F", "X"); foreach($classes as $class) { - echo "Reflecting on class $class: \n"; - $rc = new ReflectionClass($class); - var_dump($rc->getConstant('a')); - var_dump($rc->getConstant('doesnotexist')); + echo "Reflecting on class $class: \n"; + $rc = new ReflectionClass($class); + var_dump($rc->getConstant('a')); + var_dump($rc->getConstant('doesnotexist')); } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt index 020ac6f7f5..ca9bc0ce2d 100644 --- a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt +++ b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt @@ -3,7 +3,7 @@ ReflectionClass::getConstant() - bad params --FILE-- <?php class C { - const myConst = 1; + const myConst = 1; } $rc = new ReflectionClass("C"); diff --git a/ext/reflection/tests/ReflectionClass_getConstants_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstants_basic.phpt index a9c0cd4225..c4d2c5267f 100644 --- a/ext/reflection/tests/ReflectionClass_getConstants_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getConstants_basic.phpt @@ -3,23 +3,23 @@ ReflectionClass::getConstants() --FILE-- <?php class C { - const a = 'hello from C'; + const a = 'hello from C'; } class D extends C { } class E extends D { } class F extends E { - const a = 'hello from F'; + const a = 'hello from F'; } class X { } $classes = array('C', 'D', 'E', 'F', 'X'); foreach($classes as $class) { - echo "Constants from class $class: \n"; - $rc = new ReflectionClass($class); - var_dump($rc->getConstants()); + echo "Constants from class $class: \n"; + $rc = new ReflectionClass($class); + var_dump($rc->getConstants()); } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt index df6880aedb..bbf26e04a5 100644 --- a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt @@ -3,7 +3,7 @@ ReflectionClass::getConstructor() --FILE-- <?php class NewCtor { - function __construct() {} + function __construct() {} } class ExtendsNewCtor extends NewCtor { @@ -11,13 +11,13 @@ class ExtendsNewCtor extends NewCtor { $classes = array('NewCtor', 'ExtendsNewCtor'); foreach ($classes as $class) { - $rc = new ReflectionClass($class); - $rm = $rc->getConstructor(); - if ($rm != null) { - echo "Constructor of $class: " . $rm->getName() . "\n"; - } else { - echo "No constructor for $class\n"; - } + $rc = new ReflectionClass($class); + $rm = $rc->getConstructor(); + if ($rm != null) { + echo "Constructor of $class: " . $rm->getName() . "\n"; + } else { + echo "No constructor for $class\n"; + } } diff --git a/ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt b/ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt index 3778adb403..0adbd34335 100644 --- a/ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt +++ b/ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt @@ -8,68 +8,68 @@ Steve Seear <stevseea@php.net> class A { - static public $statPubC = "stat pubC in A"; - static protected $statProtC = "stat protC in A"; - static private $statPrivC = "stat privC in A"; + static public $statPubC = "stat pubC in A"; + static protected $statProtC = "stat protC in A"; + static private $statPrivC = "stat privC in A"; - static public $statPubA = "stat pubA in A"; - static protected $statProtA = "stat protA in A"; - static private $statPrivA = "stat privA in A"; + static public $statPubA = "stat pubA in A"; + static protected $statProtA = "stat protA in A"; + static private $statPrivA = "stat privA in A"; - public $pubC = "pubC in A"; - protected $protC = "protC in A"; - private $privC = "privC in A"; + public $pubC = "pubC in A"; + protected $protC = "protC in A"; + private $privC = "privC in A"; - public $pubA = "pubA in A"; - protected $protA = "protA in A"; - private $privA = "privA in A"; + public $pubA = "pubA in A"; + protected $protA = "protA in A"; + private $privA = "privA in A"; } class B extends A { - static public $statPubC = "stat pubC in B"; - static protected $statProtC = "stat protC in B"; - static private $statPrivC = "stat privC in B"; + static public $statPubC = "stat pubC in B"; + static protected $statProtC = "stat protC in B"; + static private $statPrivC = "stat privC in B"; - static public $statPubB = "stat pubB in B"; - static protected $statProtB = "stat protB in B"; - static private $statPrivB = "stat privB in B"; + static public $statPubB = "stat pubB in B"; + static protected $statProtB = "stat protB in B"; + static private $statPrivB = "stat privB in B"; - public $pubC = "pubC in B"; - protected $protC = "protC in B"; - private $privC = "privC in B"; + public $pubC = "pubC in B"; + protected $protC = "protC in B"; + private $privC = "privC in B"; - public $pubB = "pubB in B"; - protected $protB = "protB in B"; - private $privB = "privB in B"; + public $pubB = "pubB in B"; + protected $protB = "protB in B"; + private $privB = "privB in B"; } class C extends B { - static public $statPubC = "stat pubC in C"; - static protected $statProtC = "stat protC in C"; - static private $statPrivC = "stat privC in C"; + static public $statPubC = "stat pubC in C"; + static protected $statProtC = "stat protC in C"; + static private $statPrivC = "stat privC in C"; - public $pubC = "pubC in C"; - protected $protC = "protC in C"; - private $privC = "privC in C"; + public $pubC = "pubC in C"; + protected $protC = "protC in C"; + private $privC = "privC in C"; } class X { - static public $statPubC = "stat pubC in X"; - static protected $statProtC = "stat protC in X"; - static private $statPrivC = "stat privC in X"; + static public $statPubC = "stat pubC in X"; + static protected $statProtC = "stat protC in X"; + static private $statPrivC = "stat privC in X"; - public $pubC = "pubC in X"; - protected $protC = "protC in X"; - private $privC = "privC in X"; + public $pubC = "pubC in X"; + protected $protC = "protC in X"; + private $privC = "privC in X"; } $classes = array('A', 'B', 'C', 'X'); foreach ($classes as $class) { - $rc = new ReflectionClass($class); - echo "\n\n---- Static properties in $class ----\n"; - print_r($rc->getStaticProperties()); - echo "\n\n---- Default properties in $class ----\n"; - print_r($rc->getDefaultProperties()); + $rc = new ReflectionClass($class); + echo "\n\n---- Static properties in $class ----\n"; + print_r($rc->getStaticProperties()); + echo "\n\n---- Default properties in $class ----\n"; + print_r($rc->getDefaultProperties()); } ?> diff --git a/ext/reflection/tests/ReflectionClass_getDocComment_001.phpt b/ext/reflection/tests/ReflectionClass_getDocComment_001.phpt index d4f3ed27f2..28b92abedb 100644 --- a/ext/reflection/tests/ReflectionClass_getDocComment_001.phpt +++ b/ext/reflection/tests/ReflectionClass_getDocComment_001.phpt @@ -48,9 +48,9 @@ final class G extends C implements I {} {} $classes = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'I'); foreach ($classes as $class) { - echo "\n\n---> Doc comment for class $class:\n"; - $rc = new ReflectionClass($class); - var_dump($rc->getDocComment()); + echo "\n\n---> Doc comment for class $class:\n"; + $rc = new ReflectionClass($class); + var_dump($rc->getDocComment()); } diff --git a/ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt b/ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt index 310b22e695..84e38b0802 100644 --- a/ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt @@ -7,8 +7,8 @@ Rein Velt <rein@velt.org> #testFest Roosendaal 2008-05-10 --FILE-- <?php - $rc=new reflectionClass('domDocument'); - var_dump( $rc->getExtensionName()) ; + $rc=new reflectionClass('domDocument'); + var_dump( $rc->getExtensionName()) ; ?> --EXPECT-- string(3) "dom" diff --git a/ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt b/ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt index 4f78343081..4b4ed125a4 100644 --- a/ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt +++ b/ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt @@ -6,13 +6,13 @@ Rein Velt <rein@velt.org> --FILE-- <?php - class myClass - { - public $varX; - public $varY; - } - $rc=new reflectionClass('myClass'); - var_dump( $rc->getExtensionName()) ; + class myClass + { + public $varX; + public $varY; + } + $rc=new reflectionClass('myClass'); + var_dump( $rc->getExtensionName()) ; ?> --EXPECT-- bool(false) diff --git a/ext/reflection/tests/ReflectionClass_getExtension_basic.phpt b/ext/reflection/tests/ReflectionClass_getExtension_basic.phpt index dbe157acd6..8cd1caad74 100644 --- a/ext/reflection/tests/ReflectionClass_getExtension_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getExtension_basic.phpt @@ -7,8 +7,8 @@ Rein Velt <rein@velt.org> #testFest Roosendaal 2008-05-10 --FILE-- <?php - $rc=new reflectionClass('domDocument'); - var_dump($rc->getExtension()) ; + $rc=new reflectionClass('domDocument'); + var_dump($rc->getExtension()) ; ?> --EXPECTF-- object(ReflectionExtension)#%d (1) { diff --git a/ext/reflection/tests/ReflectionClass_getExtension_variation.phpt b/ext/reflection/tests/ReflectionClass_getExtension_variation.phpt index f3697792db..b8a881f9b3 100644 --- a/ext/reflection/tests/ReflectionClass_getExtension_variation.phpt +++ b/ext/reflection/tests/ReflectionClass_getExtension_variation.phpt @@ -6,13 +6,13 @@ Rein Velt <rein@velt.org> --FILE-- <?php - class myClass - { - public $varX; - public $varY; - } - $rc=new reflectionClass('myClass'); - var_dump( $rc->getExtension()) ; + class myClass + { + public $varX; + public $varY; + } + $rc=new reflectionClass('myClass'); + var_dump( $rc->getExtension()) ; ?> --EXPECT-- NULL diff --git a/ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt b/ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt index 6f7561c462..feaa703c98 100644 --- a/ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt +++ b/ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt @@ -29,16 +29,16 @@ class C6 implements I1, I2, I3, I4, I5, I6, I7 {} $classes = array( 'A0', 'A1', 'B0', 'B1', - 'I0', 'I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7', - 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6' ); + 'I0', 'I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7', + 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6' ); foreach ($classes as $class) { - echo "---( Interfaces implemented by $class )---\n "; - $rc = new ReflectionClass($class); - $interfaces = $rc->getInterfaces(); - // Sort interfaces so that tests do not fail because of wrong order. - ksort($interfaces); - print_r($interfaces); + echo "---( Interfaces implemented by $class )---\n "; + $rc = new ReflectionClass($class); + $interfaces = $rc->getInterfaces(); + // Sort interfaces so that tests do not fail because of wrong order. + ksort($interfaces); + print_r($interfaces); } ?> diff --git a/ext/reflection/tests/ReflectionClass_getMethod_001.phpt b/ext/reflection/tests/ReflectionClass_getMethod_001.phpt index e2a4eb9903..c8a2ed14ed 100644 --- a/ext/reflection/tests/ReflectionClass_getMethod_001.phpt +++ b/ext/reflection/tests/ReflectionClass_getMethod_001.phpt @@ -6,43 +6,43 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class pubf { - public function f() {} - static public function s() {} + public function f() {} + static public function s() {} } class subpubf extends pubf { } class protf { - protected function f() {} - static protected function s() {} + protected function f() {} + static protected function s() {} } class subprotf extends protf { } class privf { - private function f() {} - static private function s() {} + private function f() {} + static private function s() {} } class subprivf extends privf { } $classes = array("pubf", "subpubf", "protf", "subprotf", - "privf", "subprivf"); + "privf", "subprivf"); foreach($classes as $class) { - echo "Reflecting on class $class: \n"; - $rc = new ReflectionClass($class); - echo " --> Check for f(): "; - var_dump($rc->getMethod("f")); - echo " --> Check for s(): "; - var_dump($rc->getMethod("s")); - echo " --> Check for F(): "; - var_dump($rc->getMethod("F")); - echo " --> Check for doesNotExist(): "; - try { - var_dump($rc->getMethod("doesNotExist")); - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - } + echo "Reflecting on class $class: \n"; + $rc = new ReflectionClass($class); + echo " --> Check for f(): "; + var_dump($rc->getMethod("f")); + echo " --> Check for s(): "; + var_dump($rc->getMethod("s")); + echo " --> Check for F(): "; + var_dump($rc->getMethod("F")); + echo " --> Check for doesNotExist(): "; + try { + var_dump($rc->getMethod("doesNotExist")); + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + } } ?> --EXPECTF-- diff --git a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt index 424550f67a..cebb5cd089 100644 --- a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt @@ -6,50 +6,50 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class C { - function f() {} + function f() {} } $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; try { - var_dump($rc->getMethod()); + var_dump($rc->getMethod()); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getMethod("f", "f")); + var_dump($rc->getMethod("f", "f")); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getMethod(null)); + var_dump($rc->getMethod(null)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getMethod(1)); + var_dump($rc->getMethod(1)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getMethod(1.5)); + var_dump($rc->getMethod(1.5)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getMethod(true)); + var_dump($rc->getMethod(true)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getMethod(array(1,2,3))); + var_dump($rc->getMethod(array(1,2,3))); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getMethod(new C)); + var_dump($rc->getMethod(new C)); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } diff --git a/ext/reflection/tests/ReflectionClass_getMethods_001.phpt b/ext/reflection/tests/ReflectionClass_getMethods_001.phpt index dca9adb56d..1f2ed55ffb 100644 --- a/ext/reflection/tests/ReflectionClass_getMethods_001.phpt +++ b/ext/reflection/tests/ReflectionClass_getMethods_001.phpt @@ -6,32 +6,32 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class pubf { - public function f() {} - static public function s() {} + public function f() {} + static public function s() {} } class subpubf extends pubf { } class protf { - protected function f() {} - static protected function s() {} + protected function f() {} + static protected function s() {} } class subprotf extends protf { } class privf { - private function f() {} - static private function s() {} + private function f() {} + static private function s() {} } class subprivf extends privf { } $classes = array("pubf", "subpubf", "protf", "subprotf", - "privf", "subprivf"); + "privf", "subprivf"); foreach($classes as $class) { - echo "Reflecting on class $class: \n"; - $rc = new ReflectionClass($class); - var_dump($rc->getMethods()); + echo "Reflecting on class $class: \n"; + $rc = new ReflectionClass($class); + var_dump($rc->getMethods()); } ?> diff --git a/ext/reflection/tests/ReflectionClass_getMethods_003.phpt b/ext/reflection/tests/ReflectionClass_getMethods_003.phpt index b08fcaa4d4..d40e0b9122 100644 --- a/ext/reflection/tests/ReflectionClass_getMethods_003.phpt +++ b/ext/reflection/tests/ReflectionClass_getMethods_003.phpt @@ -6,14 +6,14 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class C { - public function pubf1() {} - public function pubf2() {} - private function privf1() {} - private function privf2() {} - static public function pubsf1() {} - static public function pubsf2() {} - static private function privsf1() {} - static private function privsf2() {} + public function pubf1() {} + public function pubf2() {} + private function privf1() {} + private function privf2() {} + static public function pubsf1() {} + static public function pubsf2() {} + static private function privsf1() {} + static private function privsf2() {} } $rc = new ReflectionClass("C"); diff --git a/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt b/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt index ba7fa6880b..f792031a01 100644 --- a/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt @@ -11,34 +11,34 @@ final class c {} class x { - function __construct() {} - function __destruct() {} - private function a() {} - private static function b() {} - protected function c() {} - protected static function d() {} - public function e() {} - public static function f() {} - final function g() {} - function h() {} + function __construct() {} + function __destruct() {} + private function a() {} + private static function b() {} + protected function c() {} + protected static function d() {} + public function e() {} + public static function f() {} + final function g() {} + function h() {} } abstract class y { - abstract function a(); - abstract protected function b(); + abstract function a(); + abstract protected function b(); } function dump_modifierNames($class) { - $obj = new ReflectionClass($class); - var_dump($obj->getName(), Reflection::getModifierNames($obj->getModifiers())); + $obj = new ReflectionClass($class); + var_dump($obj->getName(), Reflection::getModifierNames($obj->getModifiers())); } function dump_methodModifierNames($class) { - $obj = new ReflectionClass($class); - foreach($obj->getMethods() as $method) { - var_dump($obj->getName() . "::" . $method->getName(), Reflection::getModifierNames($method->getModifiers())); - } + $obj = new ReflectionClass($class); + foreach($obj->getMethods() as $method) { + var_dump($obj->getName() . "::" . $method->getName(), Reflection::getModifierNames($method->getModifiers())); + } } dump_modifierNames('a'); diff --git a/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt index ffe8876133..447f8d2edc 100644 --- a/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt @@ -14,8 +14,8 @@ interface f extends d {} class g extends b {} function dump_modifiers($class) { - $obj = new ReflectionClass($class); - var_dump($obj->getModifiers()); + $obj = new ReflectionClass($class); + var_dump($obj->getModifiers()); } dump_modifiers('a'); diff --git a/ext/reflection/tests/ReflectionClass_getName_basic.phpt b/ext/reflection/tests/ReflectionClass_getName_basic.phpt index 37cec4bc81..f230165f0d 100644 --- a/ext/reflection/tests/ReflectionClass_getName_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getName_basic.phpt @@ -3,10 +3,10 @@ ReflectionClass::getName() --FILE-- <?php class TrickClass { - function __toString() { - //Return the name of another class - return "Exception"; - } + function __toString() { + //Return the name of another class + return "Exception"; + } } $r1 = new ReflectionClass("stdClass"); diff --git a/ext/reflection/tests/ReflectionClass_getProperties_001.phpt b/ext/reflection/tests/ReflectionClass_getProperties_001.phpt index 3554af3890..0607822a20 100644 --- a/ext/reflection/tests/ReflectionClass_getProperties_001.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperties_001.phpt @@ -6,32 +6,32 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class pubf { - public $a; - static public $s; + public $a; + static public $s; } class subpubf extends pubf { } class protf { - protected $a; - static protected $s; + protected $a; + static protected $s; } class subprotf extends protf { } class privf { - private $a; - static private $s; + private $a; + static private $s; } class subprivf extends privf { } $classes = array("pubf", "subpubf", "protf", "subprotf", - "privf", "subprivf"); + "privf", "subprivf"); foreach($classes as $class) { - echo "Reflecting on class $class: \n"; - $rc = new ReflectionClass($class); - var_dump($rc->getProperties()); + echo "Reflecting on class $class: \n"; + $rc = new ReflectionClass($class); + var_dump($rc->getProperties()); } ?> diff --git a/ext/reflection/tests/ReflectionClass_getProperties_003.phpt b/ext/reflection/tests/ReflectionClass_getProperties_003.phpt index fe3792a30f..63d5d476b4 100644 --- a/ext/reflection/tests/ReflectionClass_getProperties_003.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperties_003.phpt @@ -6,14 +6,14 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class C { - public $pub1; - public $pub2; - private $priv1; - private $priv2; - static public $pubs; - static public $pubs2; - static private $privs1; - static private $privs2; + public $pub1; + public $pub2; + private $priv1; + private $priv2; + static public $pubs; + static public $pubs2; + static private $privs1; + static private $privs2; } $rc = new ReflectionClass("C"); diff --git a/ext/reflection/tests/ReflectionClass_getProperty_001.phpt b/ext/reflection/tests/ReflectionClass_getProperty_001.phpt index b69d51eb00..2d5494b264 100644 --- a/ext/reflection/tests/ReflectionClass_getProperty_001.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperty_001.phpt @@ -6,55 +6,55 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class pubf { - public $a; - static public $s; + public $a; + static public $s; } class subpubf extends pubf { } class protf { - protected $a; - static protected $s; + protected $a; + static protected $s; } class subprotf extends protf { } class privf { - private $a; - static protected $s; + private $a; + static protected $s; } class subprivf extends privf { } $classes = array("pubf", "subpubf", "protf", "subprotf", - "privf", "subprivf"); + "privf", "subprivf"); foreach($classes as $class) { - echo "Reflecting on class $class: \n"; - $rc = new ReflectionClass($class); - try { - echo " --> Check for s: "; - var_dump($rc->getProperty("s")); - } catch (exception $e) { - echo $e->getMessage() . "\n"; - } - try { - echo " --> Check for a: "; - var_dump($rc->getProperty("a")); - } catch (exception $e) { - echo $e->getMessage() . "\n"; - } - try { - echo " --> Check for A: "; - var_dump($rc->getProperty("A")); - } catch (exception $e) { - echo $e->getMessage() . "\n"; - } - try { - echo " --> Check for doesNotExist: "; - var_dump($rc->getProperty("doesNotExist")); - } catch (exception $e) { - echo $e->getMessage() . "\n"; - } + echo "Reflecting on class $class: \n"; + $rc = new ReflectionClass($class); + try { + echo " --> Check for s: "; + var_dump($rc->getProperty("s")); + } catch (exception $e) { + echo $e->getMessage() . "\n"; + } + try { + echo " --> Check for a: "; + var_dump($rc->getProperty("a")); + } catch (exception $e) { + echo $e->getMessage() . "\n"; + } + try { + echo " --> Check for A: "; + var_dump($rc->getProperty("A")); + } catch (exception $e) { + echo $e->getMessage() . "\n"; + } + try { + echo " --> Check for doesNotExist: "; + var_dump($rc->getProperty("doesNotExist")); + } catch (exception $e) { + echo $e->getMessage() . "\n"; + } } ?> diff --git a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt index d9a2ebcd71..904162b263 100644 --- a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt @@ -6,50 +6,50 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class C { - public $a; + public $a; } $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; try { - var_dump($rc->getProperty()); + var_dump($rc->getProperty()); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getProperty("a", "a")); + var_dump($rc->getProperty("a", "a")); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getProperty(null)); + var_dump($rc->getProperty(null)); } catch (exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getProperty(1)); + var_dump($rc->getProperty(1)); } catch (exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getProperty(1.5)); + var_dump($rc->getProperty(1.5)); } catch (exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getProperty(true)); + var_dump($rc->getProperty(true)); } catch (exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getProperty(array(1,2,3))); + var_dump($rc->getProperty(array(1,2,3))); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getProperty(new C)); + var_dump($rc->getProperty(new C)); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionClass_getProperty_003.phpt b/ext/reflection/tests/ReflectionClass_getProperty_003.phpt index 7011a0912c..34ade2fc5e 100644 --- a/ext/reflection/tests/ReflectionClass_getProperty_003.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperty_003.phpt @@ -6,56 +6,56 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class A { - static public $pubC = "pubC in A"; - static protected $protC = "protC in A"; - static private $privC = "privC in A"; + static public $pubC = "pubC in A"; + static protected $protC = "protC in A"; + static private $privC = "privC in A"; - static public $pubA = "pubA in A"; - static protected $protA = "protA in A"; - static private $privA = "privA in A"; + static public $pubA = "pubA in A"; + static protected $protA = "protA in A"; + static private $privA = "privA in A"; } class B extends A { - static public $pubC = "pubC in B"; - static protected $protC = "protC in B"; - static private $privC = "privC in B"; + static public $pubC = "pubC in B"; + static protected $protC = "protC in B"; + static private $privC = "privC in B"; - static public $pubB = "pubB in B"; - static protected $protB = "protB in B"; - static private $privB = "privB in B"; + static public $pubB = "pubB in B"; + static protected $protB = "protB in B"; + static private $privB = "privB in B"; } class C extends B { - static public $pubC = "pubC in C"; - static protected $protC = "protC in C"; - static private $privC = "privC in C"; + static public $pubC = "pubC in C"; + static protected $protC = "protC in C"; + static private $privC = "privC in C"; } class X { - static public $pubC = "pubC in X"; - static protected $protC = "protC in X"; - static private $privC = "privC in X"; + static public $pubC = "pubC in X"; + static protected $protC = "protC in X"; + static private $privC = "privC in X"; } $myC = new C; $rc = new ReflectionClass("C"); function showInfo($name) { - global $rc, $myC; - echo "--- (Reflecting on $name) ---\n"; - try { - $rp = $rc->getProperty($name); - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - return; - } - try { - var_dump($rp); - var_dump($rp->getValue($myC)); - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - return; - } + global $rc, $myC; + echo "--- (Reflecting on $name) ---\n"; + try { + $rp = $rc->getProperty($name); + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + return; + } + try { + var_dump($rp); + var_dump($rp->getValue($myC)); + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + return; + } } diff --git a/ext/reflection/tests/ReflectionClass_getProperty_004.phpt b/ext/reflection/tests/ReflectionClass_getProperty_004.phpt index 95f821e472..b5396aae40 100644 --- a/ext/reflection/tests/ReflectionClass_getProperty_004.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperty_004.phpt @@ -6,56 +6,56 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class A { - public $pubC = "pubC in A"; - protected $protC = "protC in A"; - private $privC = "privC in A"; + public $pubC = "pubC in A"; + protected $protC = "protC in A"; + private $privC = "privC in A"; - public $pubA = "pubA in A"; - protected $protA = "protA in A"; - private $privA = "privA in A"; + public $pubA = "pubA in A"; + protected $protA = "protA in A"; + private $privA = "privA in A"; } class B extends A { - public $pubC = "pubC in B"; - protected $protC = "protC in B"; - private $privC = "privC in B"; + public $pubC = "pubC in B"; + protected $protC = "protC in B"; + private $privC = "privC in B"; - public $pubB = "pubB in B"; - protected $protB = "protB in B"; - private $privB = "privB in B"; + public $pubB = "pubB in B"; + protected $protB = "protB in B"; + private $privB = "privB in B"; } class C extends B { - public $pubC = "pubC in C"; - protected $protC = "protC in C"; - private $privC = "privC in C"; + public $pubC = "pubC in C"; + protected $protC = "protC in C"; + private $privC = "privC in C"; } class X { - public $pubC = "pubC in X"; - protected $protC = "protC in X"; - private $privC = "privC in X"; + public $pubC = "pubC in X"; + protected $protC = "protC in X"; + private $privC = "privC in X"; } $myC = new C; $rc = new ReflectionClass("C"); function showInfo($name) { - global $rc, $myC; - echo "--- (Reflecting on $name) ---\n"; - try { - $rp = $rc->getProperty($name); - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - return; - } - try { - var_dump($rp); - var_dump($rp->getValue($myC)); - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - return; - } + global $rc, $myC; + echo "--- (Reflecting on $name) ---\n"; + try { + $rp = $rc->getProperty($name); + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + return; + } + try { + var_dump($rp); + var_dump($rp->getValue($myC)); + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + return; + } } diff --git a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt index 365ec89ff1..b11d2ec0d7 100644 --- a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt +++ b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt @@ -6,15 +6,15 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class A { - static private $privateOverridden = "original private"; - static protected $protectedOverridden = "original protected"; - static public $publicOverridden = "original public"; + static private $privateOverridden = "original private"; + static protected $protectedOverridden = "original protected"; + static public $publicOverridden = "original public"; } class B extends A { - static private $privateOverridden = "changed private"; - static protected $protectedOverridden = "changed protected"; - static public $publicOverridden = "changed public"; + static private $privateOverridden = "changed private"; + static protected $protectedOverridden = "changed protected"; + static public $publicOverridden = "changed public"; } echo "Retrieving static values from A:\n"; @@ -34,17 +34,17 @@ var_dump($rcB->getStaticPropertyValue("publicOverridden")); echo "\nRetrieving non-existent values from A with no default value:\n"; try { - var_dump($rcA->getStaticPropertyValue("protectedOverridden")); - echo "you should not see this"; + var_dump($rcA->getStaticPropertyValue("protectedOverridden")); + echo "you should not see this"; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rcA->getStaticPropertyValue("privateOverridden")); - echo "you should not see this"; + var_dump($rcA->getStaticPropertyValue("privateOverridden")); + echo "you should not see this"; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt index 7c071e5ba0..672c7f3e1d 100644 --- a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt @@ -6,34 +6,34 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class C { - public static $x; + public static $x; } $rc = new ReflectionClass('C'); try { - var_dump($rc->getStaticPropertyValue("x", "default value", 'blah')); + var_dump($rc->getStaticPropertyValue("x", "default value", 'blah')); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getStaticPropertyValue()); + var_dump($rc->getStaticPropertyValue()); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getStaticPropertyValue(null)); + var_dump($rc->getStaticPropertyValue(null)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getStaticPropertyValue(1.5, 'def')); + var_dump($rc->getStaticPropertyValue(1.5, 'def')); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->getStaticPropertyValue(array(1,2,3))); + var_dump($rc->getStaticPropertyValue(array(1,2,3))); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } diff --git a/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt b/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt index 22ef1f50c5..5783b2b506 100644 --- a/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt +++ b/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt @@ -6,7 +6,7 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class C { - const myConst = 1; + const myConst = 1; } class D extends C { diff --git a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt index 257d9aa9da..5dcc7df173 100644 --- a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt +++ b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt @@ -6,7 +6,7 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class C { - const myConst = 1; + const myConst = 1; } $rc = new ReflectionClass("C"); diff --git a/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt b/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt index bf2a3c9bb5..d987897a6e 100644 --- a/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt +++ b/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt @@ -6,39 +6,39 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class pubf { - public function f() {} - static public function s() {} + public function f() {} + static public function s() {} } class subpubf extends pubf { } class protf { - protected function f() {} - static protected function s() {} + protected function f() {} + static protected function s() {} } class subprotf extends protf { } class privf { - private function f() {} - static private function s() {} + private function f() {} + static private function s() {} } class subprivf extends privf { } $classes = array("pubf", "subpubf", "protf", "subprotf", - "privf", "subprivf"); + "privf", "subprivf"); foreach($classes as $class) { - echo "Reflecting on class $class: \n"; - $rc = new ReflectionClass($class); - echo " --> Check for f(): "; - var_dump($rc->hasMethod("f")); - echo " --> Check for s(): "; - var_dump($rc->hasMethod("s")); - echo " --> Check for F(): "; - var_dump($rc->hasMethod("F")); - echo " --> Check for doesNotExist(): "; - var_dump($rc->hasMethod("doesNotExist")); + echo "Reflecting on class $class: \n"; + $rc = new ReflectionClass($class); + echo " --> Check for f(): "; + var_dump($rc->hasMethod("f")); + echo " --> Check for s(): "; + var_dump($rc->hasMethod("s")); + echo " --> Check for F(): "; + var_dump($rc->hasMethod("F")); + echo " --> Check for doesNotExist(): "; + var_dump($rc->hasMethod("doesNotExist")); } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt index 77f2865a31..2bbc84551e 100644 --- a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt +++ b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt @@ -6,7 +6,7 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class C { - function f() {} + function f() {} } $rc = new ReflectionClass("C"); diff --git a/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt b/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt index 6abf392eae..12040658ba 100644 --- a/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt +++ b/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt @@ -6,39 +6,39 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class pubf { - public $a; - static public $s; + public $a; + static public $s; } class subpubf extends pubf { } class protf { - protected $a; - static protected $s; + protected $a; + static protected $s; } class subprotf extends protf { } class privf { - private $a; - static protected $s; + private $a; + static protected $s; } class subprivf extends privf { } $classes = array("pubf", "subpubf", "protf", "subprotf", - "privf", "subprivf"); + "privf", "subprivf"); foreach($classes as $class) { - echo "Reflecting on class $class: \n"; - $rc = new ReflectionClass($class); - echo " --> Check for s: "; - var_dump($rc->hasProperty("s")); - echo " --> Check for a: "; - var_dump($rc->hasProperty("a")); - echo " --> Check for A: "; - var_dump($rc->hasProperty("A")); - echo " --> Check for doesNotExist: "; - var_dump($rc->hasProperty("doesNotExist")); + echo "Reflecting on class $class: \n"; + $rc = new ReflectionClass($class); + echo " --> Check for s: "; + var_dump($rc->hasProperty("s")); + echo " --> Check for a: "; + var_dump($rc->hasProperty("a")); + echo " --> Check for A: "; + var_dump($rc->hasProperty("A")); + echo " --> Check for doesNotExist: "; + var_dump($rc->hasProperty("doesNotExist")); } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt index a1bbb9e73c..a135939052 100644 --- a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt +++ b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt @@ -6,7 +6,7 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class C { - public $a; + public $a; } $rc = new ReflectionClass("C"); diff --git a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt index 5176dd75ad..7f28198dfa 100644 --- a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt +++ b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt @@ -15,54 +15,54 @@ class C implements I2 {} $classNames = array('A', 'B', 'C', 'I1', 'I2'); foreach ($classNames as $className) { - $rcs[$className] = new ReflectionClass($className); + $rcs[$className] = new ReflectionClass($className); } foreach ($rcs as $childName => $child) { - foreach ($rcs as $parentName => $parent) { - echo "Does " . $childName . " implement " . $parentName . "? \n"; - echo " - Using object argument: "; - try { - var_dump($child->implementsInterface($parent)); - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - } - echo " - Using string argument: "; - try { - var_dump($child->implementsInterface($parentName)); - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - } - } + foreach ($rcs as $parentName => $parent) { + echo "Does " . $childName . " implement " . $parentName . "? \n"; + echo " - Using object argument: "; + try { + var_dump($child->implementsInterface($parent)); + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + } + echo " - Using string argument: "; + try { + var_dump($child->implementsInterface($parentName)); + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + } + } } echo "\n\nTest bad arguments:\n"; try { - var_dump($rcs['A']->implementsInterface()); + var_dump($rcs['A']->implementsInterface()); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rcs['A']->implementsInterface('C', 'C')); + var_dump($rcs['A']->implementsInterface('C', 'C')); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rcs['A']->implementsInterface(null)); + var_dump($rcs['A']->implementsInterface(null)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rcs['A']->implementsInterface('ThisClassDoesNotExist')); + var_dump($rcs['A']->implementsInterface('ThisClassDoesNotExist')); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rcs['A']->implementsInterface(2)); + var_dump($rcs['A']->implementsInterface(2)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/reflection/tests/ReflectionClass_isCloneable_001.phpt b/ext/reflection/tests/ReflectionClass_isCloneable_001.phpt index 361708a315..caf55fa648 100644 --- a/ext/reflection/tests/ReflectionClass_isCloneable_001.phpt +++ b/ext/reflection/tests/ReflectionClass_isCloneable_001.phpt @@ -17,8 +17,8 @@ var_dump($obj->isCloneable()); $h = clone $foo; class bar { - private function __clone() { - } + private function __clone() { + } } $bar = new bar; print "User class - private __clone\n"; diff --git a/ext/reflection/tests/ReflectionClass_isInstance_basic.phpt b/ext/reflection/tests/ReflectionClass_isInstance_basic.phpt index a108718894..e34176fe51 100644 --- a/ext/reflection/tests/ReflectionClass_isInstance_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_isInstance_basic.phpt @@ -13,17 +13,17 @@ class X {} $classes = array("A", "B", "C", "I", "X"); $instances = array( "myA" => new A, - "myB" => new B, - "myC" => new C, - "myX" => new X ); + "myB" => new B, + "myC" => new C, + "myX" => new X ); foreach ($classes as $class) { - $rc = new ReflectionClass($class); + $rc = new ReflectionClass($class); - foreach ($instances as $name => $instance) { - echo "is $name a $class? "; - var_dump($rc->isInstance($instance)); - } + foreach ($instances as $name => $instance) { + echo "is $name a $class? "; + var_dump($rc->isInstance($instance)); + } } diff --git a/ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt b/ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt index ef179721dc..3bc79b3e79 100644 --- a/ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt @@ -6,28 +6,28 @@ class C { } interface iface { - function f1(); + function f1(); } class ifaceImpl implements iface { - function f1() {} + function f1() {} } abstract class abstractClass { - function f1() {} - abstract function f2(); + function f1() {} + abstract function f2(); } class D extends abstractClass { - function f2() {} + function f2() {} } $classes = array("C", "iface", "ifaceImpl", "abstractClass", "D"); foreach($classes as $class ) { - $reflectionClass = new ReflectionClass($class); - echo "Is $class instantiable? "; - var_dump($reflectionClass->IsInstantiable()); + $reflectionClass = new ReflectionClass($class); + echo "Is $class instantiable? "; + var_dump($reflectionClass->IsInstantiable()); } diff --git a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt index e688b40f46..cdfaf911e4 100644 --- a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt +++ b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt @@ -6,22 +6,22 @@ class noCtor { } class publicCtorNew { - public function __construct() {} + public function __construct() {} } class protectedCtorNew { - protected function __construct() {} + protected function __construct() {} } class privateCtorNew { - private function __construct() {} + private function __construct() {} } $classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew"); foreach ($classes as $class) { - $reflectionClass = new ReflectionClass($class); - echo "Is $class instantiable? "; - var_dump($reflectionClass->IsInstantiable()); + $reflectionClass = new ReflectionClass($class); + echo "Is $class instantiable? "; + var_dump($reflectionClass->IsInstantiable()); } ?> diff --git a/ext/reflection/tests/ReflectionClass_isInternal_basic.phpt b/ext/reflection/tests/ReflectionClass_isInternal_basic.phpt index 9c656a38b6..48f0c963ea 100644 --- a/ext/reflection/tests/ReflectionClass_isInternal_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_isInternal_basic.phpt @@ -12,7 +12,7 @@ $r4 = new ReflectionClass("Exception"); $r5 = new ReflectionClass("C"); var_dump($r1->isInternal(), $r2->isInternal(), $r3->isInternal(), - $r4->isInternal(), $r5->isInternal()); + $r4->isInternal(), $r5->isInternal()); ?> --EXPECT-- bool(true) diff --git a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt index af4ce9d2f4..ca3e4a8e8f 100644 --- a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt +++ b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt @@ -10,14 +10,14 @@ Interface ExtendsIterator extends Iterator { Interface ExtendsIteratorAggregate extends IteratorAggregate { } Class IteratorImpl implements Iterator { - public function next() {} - public function key() {} - public function rewind() {} - public function current() {} - public function valid() {} + public function next() {} + public function key() {} + public function rewind() {} + public function current() {} + public function valid() {} } Class IterarorAggregateImpl implements IteratorAggregate { - public function getIterator() {} + public function getIterator() {} } Class ExtendsIteratorImpl extends IteratorImpl { } @@ -27,12 +27,12 @@ Class A { } $classes = array('Traversable', 'Iterator', 'IteratorAggregate', 'ExtendsIterator', 'ExtendsIteratorAggregate', - 'IteratorImpl', 'IterarorAggregateImpl', 'ExtendsIteratorImpl', 'ExtendsIteratorAggregateImpl', 'A'); + 'IteratorImpl', 'IterarorAggregateImpl', 'ExtendsIteratorImpl', 'ExtendsIteratorAggregateImpl', 'A'); foreach($classes as $class) { - $rc = new ReflectionClass($class); - echo "Is $class iterable? "; - var_dump($rc->isIterateable()); + $rc = new ReflectionClass($class); + echo "Is $class iterable? "; + var_dump($rc->isIterateable()); } echo "\nTest static invocation:\n"; diff --git a/ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt index 8b65b9a0bd..f11433eced 100644 --- a/ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt @@ -6,25 +6,25 @@ Felix De Vliegher <felix.devliegher@gmail.com>, Marc Veldman <marc@ibuildings.nl <?php class IteratorClass implements Iterator { - public function __construct() { } - public function key() {} - public function current() {} - function next() {} - function valid() {} - function rewind() {} + public function __construct() { } + public function key() {} + public function current() {} + function next() {} + function valid() {} + function rewind() {} } class DerivedClass extends IteratorClass {} class NonIterator {} function dump_iterateable($class) { - $reflection = new ReflectionClass($class); - var_dump($reflection->isIterateable()); + $reflection = new ReflectionClass($class); + var_dump($reflection->isIterateable()); } $classes = array("ArrayObject", "IteratorClass", "DerivedClass", "NonIterator"); foreach ($classes as $class) { - echo "Is $class iterateable? "; - dump_iterateable($class); + echo "Is $class iterateable? "; + dump_iterateable($class); } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt index f6d0d5346a..839867893a 100644 --- a/ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt +++ b/ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt @@ -9,8 +9,8 @@ class BasicClass {} function dump_iterateable($obj) { - $reflection = new ReflectionClass($obj); - var_dump($reflection->isIterateable()); + $reflection = new ReflectionClass($obj); + var_dump($reflection->isIterateable()); } $basicClass = new BasicClass(); diff --git a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt index 03d17e223e..b86b70018d 100644 --- a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt +++ b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt @@ -10,29 +10,29 @@ $rc = new ReflectionClass('A'); echo "\n\nTest bad arguments:\n"; try { - var_dump($rc->isSubclassOf()); + var_dump($rc->isSubclassOf()); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->isSubclassOf('C', 'C')); + var_dump($rc->isSubclassOf('C', 'C')); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->isSubclassOf(null)); + var_dump($rc->isSubclassOf(null)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->isSubclassOf('ThisClassDoesNotExist')); + var_dump($rc->isSubclassOf('ThisClassDoesNotExist')); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->isSubclassOf(2)); + var_dump($rc->isSubclassOf(2)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt b/ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt index c05ec27ccd..a52611fb21 100644 --- a/ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt @@ -12,17 +12,17 @@ class X implements I {} $classNames = array('A', 'B', 'C', 'I', 'X'); foreach ($classNames as $className) { - $rcs[$className] = new ReflectionClass($className); + $rcs[$className] = new ReflectionClass($className); } foreach ($rcs as $childName => $child) { - foreach ($rcs as $parentName => $parent) { - echo "Is " . $childName . " a subclass of " . $parentName . "? \n"; - echo " - Using object argument: "; - var_dump($child->isSubclassOf($parent)); - echo " - Using string argument: "; - var_dump($child->isSubclassOf($parentName)); - } + foreach ($rcs as $parentName => $parent) { + echo "Is " . $childName . " a subclass of " . $parentName . "? \n"; + echo " - Using object argument: "; + var_dump($child->isSubclassOf($parent)); + echo " - Using string argument: "; + var_dump($child->isSubclassOf($parentName)); + } } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt b/ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt index e9537c1e8a..ee2206177d 100644 --- a/ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt @@ -12,7 +12,7 @@ $r4 = new ReflectionClass("Exception"); $r5 = new ReflectionClass("C"); var_dump($r1->isUserDefined(), $r2->isUserDefined(), $r3->isUserDefined(), - $r4->isUserDefined(), $r5->isUserDefined()); + $r4->isUserDefined(), $r5->isUserDefined()); ?> --EXPECT-- bool(false) diff --git a/ext/reflection/tests/ReflectionClass_modifiers_001.phpt b/ext/reflection/tests/ReflectionClass_modifiers_001.phpt index 1370228f04..cb2a6555f1 100644 --- a/ext/reflection/tests/ReflectionClass_modifiers_001.phpt +++ b/ext/reflection/tests/ReflectionClass_modifiers_001.phpt @@ -14,11 +14,11 @@ interface I {} $classes = array("A", "B", "C", "D", "I"); foreach ($classes as $class) { - $rc = new ReflectionClass($class); - var_dump($rc->isFinal()); - var_dump($rc->isInterface()); - var_dump($rc->isAbstract()); - var_dump($rc->getModifiers()); + $rc = new ReflectionClass($class); + var_dump($rc->isFinal()); + var_dump($rc->isInterface()); + var_dump($rc->isAbstract()); + var_dump($rc->getModifiers()); } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt index 9f721a4ad4..7dded54d3f 100644 --- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt @@ -7,21 +7,21 @@ Steve Seear <stevseea@php.net> <?php class B { - public function __construct($a, $b) { - echo "In constructor of class B with args $a, $b\n"; - } + public function __construct($a, $b) { + echo "In constructor of class B with args $a, $b\n"; + } } class C { - protected function __construct() { - echo "In constructor of class C\n"; - } + protected function __construct() { + echo "In constructor of class C\n"; + } } class D { - private function __construct() { - echo "In constructor of class D\n"; - } + private function __construct() { + echo "In constructor of class D\n"; + } } class E { } @@ -33,35 +33,35 @@ $rcD = new ReflectionClass('D'); $rcE = new ReflectionClass('E'); try { - $rcB->newInstanceArgs(); + $rcB->newInstanceArgs(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } var_dump($rcB->newInstanceArgs(array('x', 123))); try { - $rcC->newInstanceArgs(); - echo "you should not see this\n"; + $rcC->newInstanceArgs(); + echo "you should not see this\n"; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - $rcD->newInstanceArgs(); - echo "you should not see this\n"; + $rcD->newInstanceArgs(); + echo "you should not see this\n"; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } $e1 = $rcE->newInstanceArgs(); var_dump($e1); try { - $e2 = $rcE->newInstanceArgs(array('x')); - echo "you should not see this\n"; + $e2 = $rcE->newInstanceArgs(array('x')); + echo "you should not see this\n"; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt index de4fe65ace..3295f06108 100644 --- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt @@ -6,9 +6,9 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class A { - public function __construct($a, $b) { - echo "In constructor of class B with arg $a\n"; - } + public function __construct($a, $b) { + echo "In constructor of class B with arg $a\n"; + } } $rc = new ReflectionClass('A'); $a = $rc->newInstanceArgs('x'); diff --git a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt index bf68098a7d..22d06e3282 100644 --- a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt @@ -7,21 +7,21 @@ Steve Seear <stevseea@php.net> <?php class B { - public function __construct($a, $b) { - echo "In constructor of class B with args $a, $b\n"; - } + public function __construct($a, $b) { + echo "In constructor of class B with args $a, $b\n"; + } } class C { - protected function __construct() { - echo "In constructor of class C\n"; - } + protected function __construct() { + echo "In constructor of class C\n"; + } } class D { - private function __construct() { - echo "In constructor of class D\n"; - } + private function __construct() { + echo "In constructor of class D\n"; + } } class E { @@ -33,38 +33,38 @@ $rcD = new ReflectionClass('D'); $rcE = new ReflectionClass('E'); try { - var_dump($rcB->newInstance()); + var_dump($rcB->newInstance()); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } try { - var_dump($rcB->newInstance('x', 123)); + var_dump($rcB->newInstance('x', 123)); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } try { - $rcC->newInstance(); - echo "you should not see this\n"; + $rcC->newInstance(); + echo "you should not see this\n"; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - $rcD->newInstance(); - echo "you should not see this\n"; + $rcD->newInstance(); + echo "you should not see this\n"; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } $e1 = $rcE->newInstance(); var_dump($e1); try { - $e2 = $rcE->newInstance('x'); - echo "you should not see this\n"; + $e2 = $rcE->newInstance('x'); + echo "you should not see this\n"; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt index bfefce369e..f51f4136b1 100644 --- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt +++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt @@ -6,15 +6,15 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class A { - static private $privateOverridden = "original private"; - static protected $protectedOverridden = "original protected"; - static public $publicOverridden = "original public"; + static private $privateOverridden = "original private"; + static protected $protectedOverridden = "original protected"; + static public $publicOverridden = "original public"; } class B extends A { - static private $privateOverridden = "changed private"; - static protected $protectedOverridden = "changed protected"; - static public $publicOverridden = "changed public"; + static private $privateOverridden = "changed private"; + static protected $protectedOverridden = "changed protected"; + static public $publicOverridden = "changed public"; } echo "Set static values in A:\n"; @@ -35,17 +35,17 @@ print_r($rcB->getStaticProperties()); echo "\nSet non-existent values from A with no default value:\n"; try { - var_dump($rcA->setStaticPropertyValue("protectedOverridden", "new value 8")); - echo "you should not see this"; + var_dump($rcA->setStaticPropertyValue("protectedOverridden", "new value 8")); + echo "you should not see this"; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rcA->setStaticPropertyValue("privateOverridden", "new value 9")); - echo "you should not see this"; + var_dump($rcA->setStaticPropertyValue("privateOverridden", "new value 9")); + echo "you should not see this"; } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt index 6d3cf3a44f..9e4c69b489 100644 --- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt +++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt @@ -6,39 +6,39 @@ Steve Seear <stevseea@php.net> --FILE-- <?php class C { - public static $x; + public static $x; } $rc = new ReflectionClass('C'); try { - var_dump($rc->setStaticPropertyValue("x", "default value", 'blah')); + var_dump($rc->setStaticPropertyValue("x", "default value", 'blah')); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->setStaticPropertyValue()); + var_dump($rc->setStaticPropertyValue()); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->setStaticPropertyValue(null)); + var_dump($rc->setStaticPropertyValue(null)); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->setStaticPropertyValue(null,null)); + var_dump($rc->setStaticPropertyValue(null,null)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->setStaticPropertyValue(1.5, 'def')); + var_dump($rc->setStaticPropertyValue(1.5, 'def')); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($rc->setStaticPropertyValue(array(1,2,3), 'blah')); + var_dump($rc->setStaticPropertyValue(array(1,2,3), 'blah')); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt index 352a79ece8..959cc1bea0 100644 --- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt +++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt @@ -11,7 +11,7 @@ class Test { $rc = new ReflectionClass('Test'); try { - $rc->setStaticPropertyValue("y", "foo"); + $rc->setStaticPropertyValue("y", "foo"); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } var_dump(Test::$y); @@ -22,7 +22,7 @@ var_dump(Test::$y); Test::$x =& Test::$y; try { - $rc->setStaticPropertyValue("x", "foo"); + $rc->setStaticPropertyValue("x", "foo"); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } var_dump(Test::$y); diff --git a/ext/reflection/tests/ReflectionClass_toString_002.phpt b/ext/reflection/tests/ReflectionClass_toString_002.phpt index 5395ae66b9..a6824e540d 100644 --- a/ext/reflection/tests/ReflectionClass_toString_002.phpt +++ b/ext/reflection/tests/ReflectionClass_toString_002.phpt @@ -6,21 +6,21 @@ Steve Seear <stevseea@php.net> --FILE-- <?php Class A { - function f() {} + function f() {} } Class B extends A { - function f() {} + function f() {} } Class C extends B { } Class D extends C { - function f() {} + function f() {} } foreach (array('A', 'B', 'C', 'D') as $class) { - echo "\n\n----( Reflection class $class: )----\n"; - $rc = new ReflectionClass($class); - echo $rc; + echo "\n\n----( Reflection class $class: )----\n"; + $rc = new ReflectionClass($class); + echo $rc; } ?> diff --git a/ext/reflection/tests/ReflectionClass_toString_003.phpt b/ext/reflection/tests/ReflectionClass_toString_003.phpt index 1ce1fddf91..a67d0bfac5 100644 --- a/ext/reflection/tests/ReflectionClass_toString_003.phpt +++ b/ext/reflection/tests/ReflectionClass_toString_003.phpt @@ -6,21 +6,21 @@ Steve Seear <stevseea@php.net> --FILE-- <?php Class A { - private function f() {} + private function f() {} } Class B extends A { - private function f() {} + private function f() {} } Class C extends B { } Class D extends C { - private function f() {} + private function f() {} } foreach (array('A', 'B', 'C', 'D') as $class) { - echo "\n\n----( Reflection class $class: )----\n"; - $rc = new ReflectionClass($class); - echo $rc; + echo "\n\n----( Reflection class $class: )----\n"; + $rc = new ReflectionClass($class); + echo $rc; } ?> diff --git a/ext/reflection/tests/ReflectionExtension_constructor_error.phpt b/ext/reflection/tests/ReflectionExtension_constructor_error.phpt index a0b920ac08..9f25858402 100644 --- a/ext/reflection/tests/ReflectionExtension_constructor_error.phpt +++ b/ext/reflection/tests/ReflectionExtension_constructor_error.phpt @@ -6,21 +6,21 @@ Leon Luijkx <leon@phpgg.nl> --FILE-- <?php try { - $obj = new ReflectionExtension(); + $obj = new ReflectionExtension(); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } try { - $obj = new ReflectionExtension('foo', 'bar'); + $obj = new ReflectionExtension('foo', 'bar'); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } try { - $obj = new ReflectionExtension([]); + $obj = new ReflectionExtension([]); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } diff --git a/ext/reflection/tests/ReflectionFunction_001.phpt b/ext/reflection/tests/ReflectionFunction_001.phpt index 6785e5d0b1..4c0a58ca9d 100644 --- a/ext/reflection/tests/ReflectionFunction_001.phpt +++ b/ext/reflection/tests/ReflectionFunction_001.phpt @@ -10,10 +10,10 @@ Steve Seear <stevseea@php.net> * my doc comment */ function foo () { - static $c; - static $a = 1; - static $b = "hello"; - $d = 5; + static $c; + static $a = 1; + static $b = "hello"; + $d = 5; } /*** @@ -23,13 +23,13 @@ function bar () {} function dumpFuncInfo($name) { - $funcInfo = new ReflectionFunction($name); - var_dump($funcInfo->getName()); - var_dump($funcInfo->isInternal()); - var_dump($funcInfo->isUserDefined()); - var_dump($funcInfo->getStartLine()); - var_dump($funcInfo->getEndLine()); - var_dump($funcInfo->getStaticVariables()); + $funcInfo = new ReflectionFunction($name); + var_dump($funcInfo->getName()); + var_dump($funcInfo->isInternal()); + var_dump($funcInfo->isUserDefined()); + var_dump($funcInfo->getStartLine()); + var_dump($funcInfo->getEndLine()); + var_dump($funcInfo->getStaticVariables()); } dumpFuncInfo('foo'); diff --git a/ext/reflection/tests/ReflectionFunction_construct.001.phpt b/ext/reflection/tests/ReflectionFunction_construct.001.phpt index eab542e005..945060b073 100644 --- a/ext/reflection/tests/ReflectionFunction_construct.001.phpt +++ b/ext/reflection/tests/ReflectionFunction_construct.001.phpt @@ -7,30 +7,30 @@ Steve Seear <stevseea@php.net> <?php try { - $a = new ReflectionFunction(array(1, 2, 3)); - echo "exception not thrown.".PHP_EOL; + $a = new ReflectionFunction(array(1, 2, 3)); + echo "exception not thrown.".PHP_EOL; } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } try { - $a = new ReflectionFunction('nonExistentFunction'); + $a = new ReflectionFunction('nonExistentFunction'); } catch (ReflectionException $e) { - echo $e->getMessage().PHP_EOL; + echo $e->getMessage().PHP_EOL; } try { - $a = new ReflectionFunction(); + $a = new ReflectionFunction(); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } try { - $a = new ReflectionFunction(1, 2); + $a = new ReflectionFunction(1, 2); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } try { - $a = new ReflectionFunction([]); + $a = new ReflectionFunction([]); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } ?> diff --git a/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt b/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt index b8b969b0bc..f7cb6b36ec 100644 --- a/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt +++ b/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt @@ -7,9 +7,9 @@ $rf = new ReflectionFunction($closure); var_dump($rf->getClosureScopeClass()); Class A { - public static function getClosure() { - return function($param) { return "this is a closure"; }; - } + public static function getClosure() { + return function($param) { return "this is a closure"; }; + } } $closure = A::getClosure(); diff --git a/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt b/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt index bb72137f69..7772da0509 100644 --- a/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt +++ b/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt @@ -12,12 +12,12 @@ echo "*** Testing ReflectionFunction::getClosure() : basic functionality ***\n"; function foo() { - var_dump( "Inside foo function" ); + var_dump( "Inside foo function" ); } function bar( $arg ) { - var_dump( "Arg is " . $arg ); + var_dump( "Arg is " . $arg ); } $func = new ReflectionFunction( 'foo' ); diff --git a/ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt b/ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt index 03cec2ee79..590f5cfa10 100644 --- a/ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt +++ b/ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt @@ -12,10 +12,10 @@ opcache.save_comments=1 * my doc comment */ function foo () { - static $c; - static $a = 1; - static $b = "hello"; - $d = 5; + static $c; + static $a = 1; + static $b = "hello"; + $d = 5; } /*** @@ -25,8 +25,8 @@ function bar () {} function dumpFuncInfo($name) { - $funcInfo = new ReflectionFunction($name); - var_dump($funcInfo->getDocComment()); + $funcInfo = new ReflectionFunction($name); + var_dump($funcInfo->getDocComment()); } dumpFuncInfo('foo'); diff --git a/ext/reflection/tests/ReflectionFunction_getFileName.002.phpt b/ext/reflection/tests/ReflectionFunction_getFileName.002.phpt index cd75418584..39fa48a3ff 100644 --- a/ext/reflection/tests/ReflectionFunction_getFileName.002.phpt +++ b/ext/reflection/tests/ReflectionFunction_getFileName.002.phpt @@ -10,10 +10,10 @@ Steve Seear <stevseea@php.net> * my doc comment */ function foo () { - static $c; - static $a = 1; - static $b = "hello"; - $d = 5; + static $c; + static $a = 1; + static $b = "hello"; + $d = 5; } /*** @@ -23,8 +23,8 @@ function bar () {} function dumpFuncInfo($name) { - $funcInfo = new ReflectionFunction($name); - var_dump($funcInfo->getFileName()); + $funcInfo = new ReflectionFunction($name); + var_dump($funcInfo->getFileName()); } dumpFuncInfo('foo'); diff --git a/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt b/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt index 8bbbfa516f..b9a84d49c4 100644 --- a/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt +++ b/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt @@ -5,7 +5,7 @@ ReflectionFunction::isGenerator() $closure1 = function() {return "this is a closure"; }; $closure2 = function($param) { - yield $param; + yield $param; }; $rf1 = new ReflectionFunction($closure1); @@ -15,11 +15,11 @@ $rf2 = new ReflectionFunction($closure2); var_dump($rf2->isGenerator()); function func1() { - return 'func1'; + return 'func1'; } function func2() { - yield 'func2'; + yield 'func2'; } $rf1 = new ReflectionFunction('func1'); @@ -30,17 +30,17 @@ var_dump($rf2->isGenerator()); class Foo { - public function f1() { - } + public function f1() { + } - public function f2() { - yield; - } + public function f2() { + yield; + } } $rc = new ReflectionClass('Foo'); foreach($rc->getMethods() as $m) { - var_dump($m->isGenerator()); + var_dump($m->isGenerator()); } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionGenerator_basic.phpt b/ext/reflection/tests/ReflectionGenerator_basic.phpt index 6f35b6c244..f9ecc8e90e 100644 --- a/ext/reflection/tests/ReflectionGenerator_basic.phpt +++ b/ext/reflection/tests/ReflectionGenerator_basic.phpt @@ -4,33 +4,33 @@ ReflectionGenerator basic test <?php function foo() { - yield; + yield; } $gens = [ - (new class() { - function a() { - yield from foo(); - } - })->a(), - (function() { - yield; - })(), - foo(), + (new class() { + function a() { + yield from foo(); + } + })->a(), + (function() { + yield; + })(), + foo(), ]; foreach ($gens as $gen) { - var_dump($gen); + var_dump($gen); - $gen->valid(); // start Generator - $ref = new ReflectionGenerator($gen); + $gen->valid(); // start Generator + $ref = new ReflectionGenerator($gen); - var_dump($ref->getTrace()); - var_dump($ref->getExecutingLine()); - var_dump($ref->getExecutingFile()); - var_dump($ref->getExecutingGenerator()); - var_dump($ref->getFunction()); - var_dump($ref->getThis()); + var_dump($ref->getTrace()); + var_dump($ref->getExecutingLine()); + var_dump($ref->getExecutingFile()); + var_dump($ref->getExecutingGenerator()); + var_dump($ref->getFunction()); + var_dump($ref->getThis()); } ?> diff --git a/ext/reflection/tests/ReflectionGenerator_getTrace.phpt b/ext/reflection/tests/ReflectionGenerator_getTrace.phpt index 05a46009e8..91b7160d4b 100644 --- a/ext/reflection/tests/ReflectionGenerator_getTrace.phpt +++ b/ext/reflection/tests/ReflectionGenerator_getTrace.phpt @@ -4,8 +4,8 @@ ReflectionGenerator::getTrace() over multiple Generators <?php function foo() { - yield 1; - yield 2; + yield 1; + yield 2; } function bar() diff --git a/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt b/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt index a227e1a213..a665d45c30 100644 --- a/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt +++ b/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt @@ -4,31 +4,31 @@ ReflectionGenerator while being currently executed <?php function call(ReflectionGenerator $ref, $method, $rec = true) { - if ($rec) { - call($ref, $method, false); - return; - } - var_dump($ref->$method()); + if ($rec) { + call($ref, $method, false); + return; + } + var_dump($ref->$method()); } function doCalls(ReflectionGenerator $ref) { - call($ref, "getTrace"); - call($ref, "getExecutingLine"); - call($ref, "getExecutingFile"); - call($ref, "getExecutingGenerator"); - call($ref, "getFunction"); - call($ref, "getThis"); + call($ref, "getTrace"); + call($ref, "getExecutingLine"); + call($ref, "getExecutingFile"); + call($ref, "getExecutingGenerator"); + call($ref, "getFunction"); + call($ref, "getThis"); } ($gen = (function() use (&$gen) { - $ref = new ReflectionGenerator($gen); + $ref = new ReflectionGenerator($gen); - doCalls($ref); + doCalls($ref); - yield from (function() use ($ref) { - doCalls($ref); - yield; // Generator ! - })(); + yield from (function() use ($ref) { + doCalls($ref); + yield; // Generator ! + })(); })())->next(); ?> diff --git a/ext/reflection/tests/ReflectionMethod_006.phpt b/ext/reflection/tests/ReflectionMethod_006.phpt index 81f8116d77..bb29b1cbed 100644 --- a/ext/reflection/tests/ReflectionMethod_006.phpt +++ b/ext/reflection/tests/ReflectionMethod_006.phpt @@ -7,14 +7,14 @@ Steve Seear <stevseea@php.net> <?php try { - new ReflectionMethod(); + new ReflectionMethod(); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } try { - new ReflectionMethod('a', 'b', 'c'); + new ReflectionMethod('a', 'b', 'c'); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } ?> diff --git a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt index 5c980536b9..186c61b2b0 100644 --- a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt +++ b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt @@ -14,52 +14,52 @@ class TestClass try { - echo "\nWrong type of argument (bool):\n"; - $methodInfo = new ReflectionMethod(true); + echo "\nWrong type of argument (bool):\n"; + $methodInfo = new ReflectionMethod(true); } catch (Exception $e) { - print $e->__toString(); + print $e->__toString(); } try { - echo "\nWrong type of argument (int):\n"; - $methodInfo = new ReflectionMethod(3); + echo "\nWrong type of argument (int):\n"; + $methodInfo = new ReflectionMethod(3); } catch (Exception $e) { - print $e->__toString(); + print $e->__toString(); } try { - echo "\nWrong type of argument (bool, string):\n"; - $methodInfo = new ReflectionMethod(true, "foo"); + echo "\nWrong type of argument (bool, string):\n"; + $methodInfo = new ReflectionMethod(true, "foo"); } catch (Exception $e) { - print $e->__toString(); + print $e->__toString(); } try { - echo "\nWrong type of argument (string, bool):\n"; - $methodInfo = new ReflectionMethod('TestClass', true); + echo "\nWrong type of argument (string, bool):\n"; + $methodInfo = new ReflectionMethod('TestClass', true); } catch (Exception $e) { - print $e->__toString(); + print $e->__toString(); } try { - echo "\nNo method given:\n"; - $methodInfo = new ReflectionMethod("TestClass"); + echo "\nNo method given:\n"; + $methodInfo = new ReflectionMethod("TestClass"); } catch (Exception $e) { - print $e->__toString(); + print $e->__toString(); } try { - echo "\nClass and Method in same string, bad method name:\n"; - $methodInfo = new ReflectionMethod("TestClass::foop::dedoop"); + echo "\nClass and Method in same string, bad method name:\n"; + $methodInfo = new ReflectionMethod("TestClass::foop::dedoop"); } catch (Exception $e) { - print $e->__toString(); + print $e->__toString(); } try { - echo "\nClass and Method in same string, bad class name:\n"; - $methodInfo = new ReflectionMethod("TestCla::foo"); + echo "\nClass and Method in same string, bad class name:\n"; + $methodInfo = new ReflectionMethod("TestCla::foo"); } catch (Exception $e) { - print $e->__toString(); + print $e->__toString(); } try { - echo "\nClass and Method in same string (ok):\n"; - $methodInfo = new ReflectionMethod("TestClass::foo"); + echo "\nClass and Method in same string (ok):\n"; + $methodInfo = new ReflectionMethod("TestClass::foo"); } catch (Exception $e) { - print $e->__toString(); + print $e->__toString(); } ?> diff --git a/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt b/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt index 723ab00f84..d84fa5dcff 100644 --- a/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt +++ b/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt @@ -14,39 +14,39 @@ class TestClass try { - echo "Too few arguments:\n"; - $methodInfo = new ReflectionMethod(); + echo "Too few arguments:\n"; + $methodInfo = new ReflectionMethod(); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } try { - echo "\nToo many arguments:\n"; - $methodInfo = new ReflectionMethod("TestClass", "foo", true); + echo "\nToo many arguments:\n"; + $methodInfo = new ReflectionMethod("TestClass", "foo", true); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } try { - //invalid class - $methodInfo = new ReflectionMethod("InvalidClassName", "foo"); + //invalid class + $methodInfo = new ReflectionMethod("InvalidClassName", "foo"); } catch (ReflectionException $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } try { - //invalid 1st param - $methodInfo = new ReflectionMethod([], "foo"); + //invalid 1st param + $methodInfo = new ReflectionMethod([], "foo"); } catch (ReflectionException $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } try{ - //invalid 2nd param - $methodInfo = new ReflectionMethod("TestClass", []); + //invalid 2nd param + $methodInfo = new ReflectionMethod("TestClass", []); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } ?> diff --git a/ext/reflection/tests/ReflectionMethod_defaultArg.phpt b/ext/reflection/tests/ReflectionMethod_defaultArg.phpt index 1c04cade5f..521f29da58 100644 --- a/ext/reflection/tests/ReflectionMethod_defaultArg.phpt +++ b/ext/reflection/tests/ReflectionMethod_defaultArg.phpt @@ -3,17 +3,17 @@ ReflectionMethod and RECV_INIT (bug #70957 and #70958) --FILE-- <?php Abstract class F { - private function bar($a = self::class) {} + private function bar($a = self::class) {} } Trait T { - private function bar($a = self::class) {} + private function bar($a = self::class) {} } class B { - use T; + use T; } echo new \ReflectionMethod('F', 'bar'); diff --git a/ext/reflection/tests/ReflectionMethod_getClosureThis.phpt b/ext/reflection/tests/ReflectionMethod_getClosureThis.phpt index 3a931172f1..656fde814d 100644 --- a/ext/reflection/tests/ReflectionMethod_getClosureThis.phpt +++ b/ext/reflection/tests/ReflectionMethod_getClosureThis.phpt @@ -4,19 +4,19 @@ Reflection::getClosureThis() <?php class StaticExample { - static function foo() - { - var_dump( "Static Example class, Hello World!" ); - } + static function foo() + { + var_dump( "Static Example class, Hello World!" ); + } } class Example { - public $bar = 42; - public function foo() - { - var_dump( "Example class, bar: " . $this->bar ); - } + public $bar = 42; + public function foo() + { + var_dump( "Example class, bar: " . $this->bar ); + } } // Initialize classes diff --git a/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt b/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt index 105df87e73..3b0074e5a9 100644 --- a/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt @@ -12,19 +12,19 @@ echo "*** Testing ReflectionMethod::getClosure() : basic functionality ***\n"; class StaticExample { - static function foo() - { - var_dump( "Static Example class, Hello World!" ); - } + static function foo() + { + var_dump( "Static Example class, Hello World!" ); + } } class Example { - public $bar = 42; - public function foo() - { - var_dump( "Example class, bar: " . $this->bar ); - } + public $bar = 42; + public function foo() + { + var_dump( "Example class, bar: " . $this->bar ); + } } // Initialize classes diff --git a/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt index 70c77895d0..728ddf9265 100644 --- a/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt +++ b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt @@ -12,19 +12,19 @@ echo "*** Testing ReflectionMethod::getClosure() : error conditions ***\n"; class StaticExample { - static function foo() - { - var_dump( "Static Example class, Hello World!" ); - } + static function foo() + { + var_dump( "Static Example class, Hello World!" ); + } } class Example { - public $bar = 42; - public function foo() - { - var_dump( "Example class, bar: " . $this->bar ); - } + public $bar = 42; + public function foo() + { + var_dump( "Example class, bar: " . $this->bar ); + } } // Initialize classes diff --git a/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt b/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt index f999b72812..7cda871c18 100644 --- a/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt @@ -25,7 +25,7 @@ class A { * My Doc Comment for A::finalStatPubf */ - final static public function finalStatPubf() {} + final static public function finalStatPubf() {} } diff --git a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt index d867993599..00c1514fd9 100644 --- a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt @@ -60,12 +60,12 @@ class TestClass class DerivedClass extends TestClass {} interface TestInterface { - public function int(); - public function __clone(); + public function int(); + public function __clone(); } abstract class AbstractClass { - public abstract function foo(); + public abstract function foo(); } diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt index 156cc9db52..113cabbbeb 100644 --- a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt +++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt @@ -15,10 +15,10 @@ class TestClass { public static function staticMethod() { echo "Called staticMethod()\n"; try { - var_dump($this); - } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; - } + var_dump($this); + } catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; + } } private static function privateMethod() { diff --git a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt index 6711feb4ac..3ff1052a0a 100644 --- a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt @@ -23,10 +23,10 @@ class TestClass { public static function staticMethod() { echo "Called staticMethod()\n"; try { - var_dump($this); - } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; - } + var_dump($this); + } catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; + } } private static function privateMethod() { @@ -74,9 +74,9 @@ var_dump($staticMethod->invoke(new stdClass())); echo "\nMethod that throws an exception:\n"; try { - var_dump($methodThatThrows->invoke($testClassInstance)); + var_dump($methodThatThrows->invoke($testClassInstance)); } catch (Exception $exc) { - var_dump($exc->getMessage()); + var_dump($exc->getMessage()); } ?> diff --git a/ext/reflection/tests/ReflectionNamedType.phpt b/ext/reflection/tests/ReflectionNamedType.phpt index 78fe1e8fd4..5677d22cf2 100644 --- a/ext/reflection/tests/ReflectionNamedType.phpt +++ b/ext/reflection/tests/ReflectionNamedType.phpt @@ -4,11 +4,11 @@ ReflectionNamedType::getName() and ReflectionNamedType::__toString() <?php function testInternalTypes(?Traversable $traversable): ?string { - return 'test'; + return 'test'; } function testUserDefinedTypes(?Test $traversable): ?Test { - return new Test; + return new Test; } $function = new ReflectionFunction('testInternalTypes'); diff --git a/ext/reflection/tests/ReflectionObject___toString_basic1.phpt b/ext/reflection/tests/ReflectionObject___toString_basic1.phpt index 43210ea686..fdd25739bb 100644 --- a/ext/reflection/tests/ReflectionObject___toString_basic1.phpt +++ b/ext/reflection/tests/ReflectionObject___toString_basic1.phpt @@ -4,7 +4,7 @@ ReflectionObject::__toString() : very basic test with no dynamic properties <?php class Foo { - public $bar = 1; + public $bar = 1; } $f = new foo; diff --git a/ext/reflection/tests/ReflectionObject___toString_basic2.phpt b/ext/reflection/tests/ReflectionObject___toString_basic2.phpt index 970d07b432..db119c92b6 100644 --- a/ext/reflection/tests/ReflectionObject___toString_basic2.phpt +++ b/ext/reflection/tests/ReflectionObject___toString_basic2.phpt @@ -4,7 +4,7 @@ ReflectionObject::__toString() : very basic test with dynamic properties <?php class Foo { - public $bar = 1; + public $bar = 1; } $f = new foo; $f->dynProp = 'hello'; diff --git a/ext/reflection/tests/ReflectionObject_export_basic1.phpt b/ext/reflection/tests/ReflectionObject_export_basic1.phpt index 43210ea686..fdd25739bb 100644 --- a/ext/reflection/tests/ReflectionObject_export_basic1.phpt +++ b/ext/reflection/tests/ReflectionObject_export_basic1.phpt @@ -4,7 +4,7 @@ ReflectionObject::__toString() : very basic test with no dynamic properties <?php class Foo { - public $bar = 1; + public $bar = 1; } $f = new foo; diff --git a/ext/reflection/tests/ReflectionObject_export_basic2.phpt b/ext/reflection/tests/ReflectionObject_export_basic2.phpt index 970d07b432..db119c92b6 100644 --- a/ext/reflection/tests/ReflectionObject_export_basic2.phpt +++ b/ext/reflection/tests/ReflectionObject_export_basic2.phpt @@ -4,7 +4,7 @@ ReflectionObject::__toString() : very basic test with dynamic properties <?php class Foo { - public $bar = 1; + public $bar = 1; } $f = new foo; $f->dynProp = 'hello'; diff --git a/ext/reflection/tests/ReflectionObject_export_basic3.phpt b/ext/reflection/tests/ReflectionObject_export_basic3.phpt index a92c2d4921..612bfa5916 100644 --- a/ext/reflection/tests/ReflectionObject_export_basic3.phpt +++ b/ext/reflection/tests/ReflectionObject_export_basic3.phpt @@ -3,7 +3,7 @@ ReflectionObject::__toString() - ensure dynamic property with same name as inher --FILE-- <?php class C { - private $p = 1; + private $p = 1; } class D extends C{ diff --git a/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt index 9e61ee90da..c132f1121a 100644 --- a/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt @@ -3,24 +3,24 @@ ReflectionObject::getConstant() basic function test --FILE-- <?php class C { - const a = 'hello from C'; + const a = 'hello from C'; } class D extends C { } class E extends D { } class F extends E { - const a = 'hello from F'; + const a = 'hello from F'; } class X { } $classes = array("C", "D", "E", "F", "X"); foreach($classes as $class) { - echo "Reflecting on instance of class $class: \n"; - $rc = new ReflectionObject(new $class); - var_dump($rc->getConstant('a')); - var_dump($rc->getConstant('doesNotexist')); + echo "Reflecting on instance of class $class: \n"; + $rc = new ReflectionObject(new $class); + var_dump($rc->getConstant('a')); + var_dump($rc->getConstant('doesNotexist')); } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionObject_getConstants_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstants_basic.phpt index 0ecbde7991..f5acde8be4 100644 --- a/ext/reflection/tests/ReflectionObject_getConstants_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_getConstants_basic.phpt @@ -3,23 +3,23 @@ ReflectionObject::getConstants() - basic function test --FILE-- <?php class C { - const a = 'hello from C'; + const a = 'hello from C'; } class D extends C { } class E extends D { } class F extends E { - const a = 'hello from F'; + const a = 'hello from F'; } class X { } $classes = array("C", "D", "E", "F", "X"); foreach($classes as $class) { - echo "Reflecting on instance of class $class: \n"; - $rc = new ReflectionObject(new $class); - var_dump($rc->getConstants()); + echo "Reflecting on instance of class $class: \n"; + $rc = new ReflectionObject(new $class); + var_dump($rc->getConstants()); } ?> diff --git a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt index fee873fe01..0401ed1e0c 100644 --- a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt @@ -3,45 +3,45 @@ ReflectionObject::getConstructor() - basic function test --FILE-- <?php class NewCtor { - function __construct() {} + function __construct() {} } class ExtendsNewCtor extends NewCtor { } class X { - function Y() {} + function Y() {} } class Y extends X { } class B { - function B() {} + function B() {} } class C extends B { - function C() {} + function C() {} } class D1 extends C { - function __construct() {} + function __construct() {} } class D2 extends C { } $classes = array('NewCtor', 'ExtendsNewCtor', - 'B', 'C', 'D1', 'D2', 'X', 'Y'); + 'B', 'C', 'D1', 'D2', 'X', 'Y'); foreach ($classes as $class) { - $rc = new ReflectionObject(new $class); - $rm = $rc->getConstructor(); - if ($rm != null) { - echo "Constructor of $class: " . $rm->getName() . "\n"; - } else { - echo "No constructor for $class\n"; - } + $rc = new ReflectionObject(new $class); + $rm = $rc->getConstructor(); + if ($rm != null) { + echo "Constructor of $class: " . $rm->getName() . "\n"; + } else { + echo "No constructor for $class\n"; + } } diff --git a/ext/reflection/tests/ReflectionObject_isInstance_basic.phpt b/ext/reflection/tests/ReflectionObject_isInstance_basic.phpt index ff310df09b..146ac5ccd9 100644 --- a/ext/reflection/tests/ReflectionObject_isInstance_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_isInstance_basic.phpt @@ -9,15 +9,15 @@ class X {} $classes = array("A", "B", "X"); $instances = array( "myA" => new A, - "myB" => new B, - "myX" => new X ); + "myB" => new B, + "myX" => new X ); foreach ($classes as $class) { - $ro = new ReflectionObject(new $class); - foreach ($instances as $name => $instance) { - echo "is $name a $class? "; - var_dump($ro->isInstance($instance)); - } + $ro = new ReflectionObject(new $class); + foreach ($instances as $name => $instance) { + echo "is $name a $class? "; + var_dump($ro->isInstance($instance)); + } } ?> diff --git a/ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt b/ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt index 982580fc56..1b30debc9d 100644 --- a/ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt @@ -6,28 +6,28 @@ class C { } interface iface { - function f1(); + function f1(); } class ifaceImpl implements iface { - function f1() {} + function f1() {} } abstract class abstractClass { - function f1() {} - abstract function f2(); + function f1() {} + abstract function f2(); } class D extends abstractClass { - function f2() {} + function f2() {} } $classes = array("C", "ifaceImpl", "D"); foreach($classes as $class ) { - $ro = new ReflectionObject(new $class); - echo "Is $class instantiable? "; - var_dump($ro->IsInstantiable()); + $ro = new ReflectionObject(new $class); + echo "Is $class instantiable? "; + var_dump($ro->IsInstantiable()); } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt index 3baa8a0950..dada6ffc78 100644 --- a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt +++ b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt @@ -4,43 +4,43 @@ ReflectionObject::IsInstantiable() - variation - constructors <?php class noCtor { - public static function reflectionObjectFactory() { - return new ReflectionObject(new self); - } + public static function reflectionObjectFactory() { + return new ReflectionObject(new self); + } } class publicCtorNew { - public function __construct() {} - public static function reflectionObjectFactory() { - return new ReflectionObject(new self); - } + public function __construct() {} + public static function reflectionObjectFactory() { + return new ReflectionObject(new self); + } } class protectedCtorNew { - protected function __construct() {} - public static function reflectionObjectFactory() { - return new ReflectionObject(new self); - } + protected function __construct() {} + public static function reflectionObjectFactory() { + return new ReflectionObject(new self); + } } class privateCtorNew { - private function __construct() {} - public static function reflectionObjectFactory() { - return new ReflectionObject(new self); - } + private function __construct() {} + public static function reflectionObjectFactory() { + return new ReflectionObject(new self); + } } $reflectionObjects = array( - noCtor::reflectionObjectFactory(), - publicCtorNew::reflectionObjectFactory(), - protectedCtorNew::reflectionObjectFactory(), - privateCtorNew::reflectionObjectFactory(), - ); + noCtor::reflectionObjectFactory(), + publicCtorNew::reflectionObjectFactory(), + protectedCtorNew::reflectionObjectFactory(), + privateCtorNew::reflectionObjectFactory(), + ); foreach ($reflectionObjects as $reflectionObject) { - $name = $reflectionObject->getName(); - echo "Is $name instantiable? "; - var_dump($reflectionObject->IsInstantiable()); + $name = $reflectionObject->getName(); + echo "Is $name instantiable? "; + var_dump($reflectionObject->IsInstantiable()); } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionObject_isInternal_basic.phpt b/ext/reflection/tests/ReflectionObject_isInternal_basic.phpt index 234b8eb27e..8f1c6fc841 100644 --- a/ext/reflection/tests/ReflectionObject_isInternal_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_isInternal_basic.phpt @@ -12,7 +12,7 @@ $r4 = new ReflectionObject(new Exception); $r5 = new ReflectionObject(new C); var_dump($r1->isInternal(), $r2->isInternal(), $r3->isInternal(), - $r4->isInternal(), $r5->isInternal()); + $r4->isInternal(), $r5->isInternal()); ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt index a2484f9dc2..5cebd43016 100644 --- a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt +++ b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt @@ -10,29 +10,29 @@ $ro = new ReflectionObject(new C); echo "\n\nTest bad arguments:\n"; try { - var_dump($ro->isSubclassOf()); + var_dump($ro->isSubclassOf()); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($ro->isSubclassOf('C', 'C')); + var_dump($ro->isSubclassOf('C', 'C')); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($ro->isSubclassOf(null)); + var_dump($ro->isSubclassOf(null)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($ro->isSubclassOf('ThisClassDoesNotExist')); + var_dump($ro->isSubclassOf('ThisClassDoesNotExist')); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($ro->isSubclassOf(2)); + var_dump($ro->isSubclassOf(2)); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt index 25c29c7534..095c59fa34 100644 --- a/ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt @@ -13,28 +13,28 @@ $classNames = array('A', 'B', 'C', 'I', 'X'); //Create ReflectionClasses foreach ($classNames as $className) { - $rcs[$className] = new ReflectionClass($className); + $rcs[$className] = new ReflectionClass($className); } //Create ReflectionObjects foreach ($classNames as $className) { - if ($rcs[$className]->isInstantiable()) { - $ros[$className] = new ReflectionObject(new $className); - } + if ($rcs[$className]->isInstantiable()) { + $ros[$className] = new ReflectionObject(new $className); + } } foreach ($ros as $childName => $child) { - foreach ($rcs as $parentName => $parent) { - echo "Is " . $childName . " a subclass of " . $parentName . "? \n"; - echo " - Using ReflectionClass object argument: "; - var_dump($child->isSubclassOf($parent)); - if ($parent->isInstantiable()) { - echo " - Using ReflectionObject object argument: "; - var_dump($child->isSubclassOf($ros[$parentName])); - } - echo " - Using string argument: "; - var_dump($child->isSubclassOf($parentName)); - } + foreach ($rcs as $parentName => $parent) { + echo "Is " . $childName . " a subclass of " . $parentName . "? \n"; + echo " - Using ReflectionClass object argument: "; + var_dump($child->isSubclassOf($parent)); + if ($parent->isInstantiable()) { + echo " - Using ReflectionObject object argument: "; + var_dump($child->isSubclassOf($ros[$parentName])); + } + echo " - Using string argument: "; + var_dump($child->isSubclassOf($parentName)); + } } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt b/ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt index 1a9dea3aba..f561b909e4 100644 --- a/ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt @@ -12,7 +12,7 @@ $r4 = new ReflectionObject(new Exception); $r5 = new ReflectionObject(new C); var_dump($r1->isUserDefined(), $r2->isUserDefined(), $r3->isUserDefined(), - $r4->isUserDefined(), $r5->isUserDefined()); + $r4->isUserDefined(), $r5->isUserDefined()); ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionParameter_001.phpt b/ext/reflection/tests/ReflectionParameter_001.phpt index 822da2fe9a..b2b5218724 100644 --- a/ext/reflection/tests/ReflectionParameter_001.phpt +++ b/ext/reflection/tests/ReflectionParameter_001.phpt @@ -11,11 +11,11 @@ class ReflectTestClass { } public function oneArgNonStatic($theParam) { - $theParam--; + $theParam--; } public function noArgs() { - echo "No arg function\n"; + echo "No arg function\n"; } } @@ -25,18 +25,18 @@ $method = new ReflectionMethod('ReflectTestClass', 'twoArgFunction'); $parameters = $method->getParameters(); echo "Parameters from twoArgMethod:\n\n"; foreach($parameters as $parameter) { - var_dump($parameter); - $name = $parameter->getName(); - echo "\n"; + var_dump($parameter); + $name = $parameter->getName(); + echo "\n"; } $method = new ReflectionMethod('ReflectTestClass', 'oneArgNonStatic'); $parameters = $method->getParameters(); echo "Parameters from oneArgNonStatic:\n\n"; foreach($parameters as $parameter) { - var_dump($parameter); - $name = $parameter->getName(); - echo "\n"; + var_dump($parameter); + $name = $parameter->getName(); + echo "\n"; } @@ -45,9 +45,9 @@ $parameters = $method->getParameters(); echo "Parameters from noArgs:\n\n"; var_dump($parameters); foreach($parameters as $parameter) { - var_dump($parameter); - $name = $parameter->getName(); - echo "\n"; + var_dump($parameter); + $name = $parameter->getName(); + echo "\n"; } echo "done\n"; diff --git a/ext/reflection/tests/ReflectionParameter_002.phpt b/ext/reflection/tests/ReflectionParameter_002.phpt index 571edac7a9..7ff12c2d33 100644 --- a/ext/reflection/tests/ReflectionParameter_002.phpt +++ b/ext/reflection/tests/ReflectionParameter_002.phpt @@ -21,11 +21,11 @@ $method = new ReflectionMethod('ReflectTestClass', 'staticMethod'); $parameters = $method->getParameters(); echo "Parameters from staticMethod:\n\n"; foreach($parameters as $parameter) { - var_dump($parameter); + var_dump($parameter); if($parameter->isPassedByReference()) { - echo "This param is passed by reference\n"; + echo "This param is passed by reference\n"; } else { - echo "This param is not passed by reference\n"; + echo "This param is not passed by reference\n"; } echo "\n"; } @@ -36,11 +36,11 @@ $method = new ReflectionMethod('ReflectTestClass', 'instanceMethod'); $parameters = $method->getParameters(); echo "Parameters from instanceMethod:\n\n"; foreach($parameters as $parameter) { - var_dump($parameter); + var_dump($parameter); if($parameter->isPassedByReference()) { - echo "This param is passed by reference\n"; + echo "This param is passed by reference\n"; } else { - echo "This param is not passed by reference\n"; + echo "This param is not passed by reference\n"; } echo "\n"; } diff --git a/ext/reflection/tests/ReflectionParameter_003.phpt b/ext/reflection/tests/ReflectionParameter_003.phpt index 581c486f62..8396eeb97c 100644 --- a/ext/reflection/tests/ReflectionParameter_003.phpt +++ b/ext/reflection/tests/ReflectionParameter_003.phpt @@ -24,31 +24,31 @@ $refParameters = $refMethod->getParameters(); echo "parameter names from staticMethod method:\n\n"; foreach($refParameters as $parameter) { - var_dump($parameter); - if($parameter->isOptional()) { - echo "this parameter is optional\n"; - } else { - echo "this parameter is not optional\n"; - } + var_dump($parameter); + if($parameter->isOptional()) { + echo "this parameter is optional\n"; + } else { + echo "this parameter is not optional\n"; + } - if($parameter->isDefaultValueAvailable()) { - echo "this parameter has a default value\n"; - } else { - echo "this parameter has no default value\n"; - } + if($parameter->isDefaultValueAvailable()) { + echo "this parameter has a default value\n"; + } else { + echo "this parameter has no default value\n"; + } - /* - $val = 0; - try { - $val = $parameter->getDefaultValue(); - var_dump($val); - } catch (ReflectionException $e) { - print $e->getMessage(); - echo "\n"; - } - */ + /* + $val = 0; + try { + $val = $parameter->getDefaultValue(); + var_dump($val); + } catch (ReflectionException $e) { + print $e->getMessage(); + echo "\n"; + } + */ - echo "\n"; + echo "\n"; } ?> diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt index 7a92edc4cc..4f3f114bad 100644 --- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt +++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt @@ -6,30 +6,30 @@ ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName() define("CONST_TEST_1", "const1"); function ReflectionParameterTest($test1=array(), $test2 = CONST_TEST_1, $test3 = CASE_LOWER) { - echo $test; + echo $test; } $reflect = new ReflectionFunction('ReflectionParameterTest'); foreach($reflect->getParameters() as $param) { - if($param->getName() == 'test1') { - var_dump($param->isDefaultValueConstant()); - } - if($param->getName() == 'test2') { - var_dump($param->isDefaultValueConstant()); - } - if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) { - var_dump($param->getDefaultValueConstantName()); - } + if($param->getName() == 'test1') { + var_dump($param->isDefaultValueConstant()); + } + if($param->getName() == 'test2') { + var_dump($param->isDefaultValueConstant()); + } + if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) { + var_dump($param->getDefaultValueConstantName()); + } } class Foo2 { - const bar = 'Foo2::bar'; + const bar = 'Foo2::bar'; } class Foo { - const bar = 'Foo::bar'; + const bar = 'Foo::bar'; - public function baz($param1 = self::bar, $param2=Foo2::bar, $param3=CONST_TEST_1) { - } + public function baz($param1 = self::bar, $param2=Foo2::bar, $param3=CONST_TEST_1) { + } } $method = new ReflectionMethod('Foo', 'baz'); diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt index 1ee9e93735..28aeceeb2f 100644 --- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt +++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt @@ -4,24 +4,24 @@ ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName() f <?php namespace ReflectionTestNamespace { - CONST TEST_CONST_1 = "Test Const 1"; + CONST TEST_CONST_1 = "Test Const 1"; - class TestClass { - const TEST_CONST_2 = "Test Const 2 in class"; - } + class TestClass { + const TEST_CONST_2 = "Test Const 2 in class"; + } } namespace { - function ReflectionParameterTest($test=ReflectionTestNamespace\TestClass::TEST_CONST_2, $test2 = ReflectionTestNamespace\CONST_TEST_1) { - echo $test; - } - $reflect = new ReflectionFunction('ReflectionParameterTest'); - foreach($reflect->getParameters() as $param) { - if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) { - echo $param->getDefaultValueConstantName() . "\n"; - } - } - echo "==DONE=="; + function ReflectionParameterTest($test=ReflectionTestNamespace\TestClass::TEST_CONST_2, $test2 = ReflectionTestNamespace\CONST_TEST_1) { + echo $test; + } + $reflect = new ReflectionFunction('ReflectionParameterTest'); + foreach($reflect->getParameters() as $param) { + if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) { + echo $param->getDefaultValueConstantName() . "\n"; + } + } + echo "==DONE=="; } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt index a2c2d24582..7f1451bbdb 100644 --- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt +++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt @@ -6,16 +6,16 @@ ReflectionParameter::getDefaultValueConstant() should raise exception on non opt define("CONST_TEST_1", "const1"); function ReflectionParameterTest($test, $test2 = CONST_TEST_1) { - echo $test; + echo $test; } $reflect = new ReflectionFunction('ReflectionParameterTest'); foreach($reflect->getParameters() as $param) { - try { - echo $param->getDefaultValueConstantName() . "\n"; - } - catch(ReflectionException $e) { - echo $e->getMessage() . "\n"; - } + try { + echo $param->getDefaultValueConstantName() . "\n"; + } + catch(ReflectionException $e) { + echo $e->getMessage() . "\n"; + } } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionParameter_export_basic.phpt b/ext/reflection/tests/ReflectionParameter_export_basic.phpt index 8286078135..22b25de663 100644 --- a/ext/reflection/tests/ReflectionParameter_export_basic.phpt +++ b/ext/reflection/tests/ReflectionParameter_export_basic.phpt @@ -5,11 +5,11 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl> --FILE-- <?php function ReflectionParameterTest($test, $test2 = null) { - echo $test; + echo $test; } $reflect = new ReflectionFunction('ReflectionParameterTest'); foreach($reflect->getParameters() as $key => $value) { - echo new ReflectionParameter('ReflectionParameterTest', $key), "\n"; + echo new ReflectionParameter('ReflectionParameterTest', $key), "\n"; } ?> --EXPECTF-- diff --git a/ext/reflection/tests/ReflectionParameter_export_error2.phpt b/ext/reflection/tests/ReflectionParameter_export_error2.phpt index 38cd99171b..3def577e06 100644 --- a/ext/reflection/tests/ReflectionParameter_export_error2.phpt +++ b/ext/reflection/tests/ReflectionParameter_export_error2.phpt @@ -5,25 +5,25 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl> --FILE-- <?php function ReflectionParameterTest($test, $test2 = null) { - echo $test; + echo $test; } $reflect = new ReflectionFunction('ReflectionParameterTest'); $params = $reflect->getParameters(); try { - foreach($params as $key => $value) { - ReflectionParameter::export($reflect, $key); - } + foreach($params as $key => $value) { + ReflectionParameter::export($reflect, $key); + } } catch (ReflectionException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - foreach($params as $key => $value) { - ReflectionParameter::export(42, $key); - } + foreach($params as $key => $value) { + ReflectionParameter::export(42, $key); + } } catch (ReflectionException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECTF-- diff --git a/ext/reflection/tests/ReflectionParameter_export_error3.phpt b/ext/reflection/tests/ReflectionParameter_export_error3.phpt index b098a9251d..822fca0032 100644 --- a/ext/reflection/tests/ReflectionParameter_export_error3.phpt +++ b/ext/reflection/tests/ReflectionParameter_export_error3.phpt @@ -5,12 +5,12 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl> --FILE-- <?php function ReflectionParameterTest($test, $test2 = null) { - echo $test; + echo $test; } $reflect = new ReflectionFunction('ReflectionParameterTest'); $params = $reflect->getParameters(); foreach($params as $key => $value) { - ReflectionParameter::export('ReflectionParameterTest', 'incorrect_parameter'); + ReflectionParameter::export('ReflectionParameterTest', 'incorrect_parameter'); } --EXPECTF-- Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d diff --git a/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt b/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt index 18d4eb69a4..7cbef67292 100644 --- a/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt +++ b/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt @@ -6,12 +6,12 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl> --FILE-- <?php function ReflectionParameterTest($test, $test2 = null) { - echo $test; + echo $test; } $reflect = new ReflectionFunction('ReflectionParameterTest'); $params = $reflect->getParameters(); foreach($params as $key => $value) { - echo $value->getDeclaringFunction() . "\n"; + echo $value->getDeclaringFunction() . "\n"; } ?> --EXPECTF-- diff --git a/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt b/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt index c5df520c42..485ca37a2b 100644 --- a/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt +++ b/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt @@ -6,12 +6,12 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl> --FILE-- <?php function ReflectionParameterTest($test, $test2 = null) { - echo $test; + echo $test; } $reflect = new ReflectionFunction('ReflectionParameterTest'); $params = $reflect->getParameters(); foreach($params as $key => $value) { - var_dump($value->getPosition()); + var_dump($value->getPosition()); } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt b/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt index eb6d4644a0..ee6ae86cba 100644 --- a/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt +++ b/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt @@ -5,17 +5,17 @@ ReflectionParameter::__construct(): Invalid method as constructor // Invalid class name try { - new ReflectionParameter (array ('A', 'b'), 0); + new ReflectionParameter (array ('A', 'b'), 0); } catch (ReflectionException $e) { echo $e->getMessage()."\n"; } // Invalid class method try { - new ReflectionParameter (array ('C', 'b'), 0); + new ReflectionParameter (array ('C', 'b'), 0); } catch (ReflectionException $e) { echo $e->getMessage ()."\n"; } // Invalid object method try { - new ReflectionParameter (array (new C, 'b'), 0); + new ReflectionParameter (array (new C, 'b'), 0); } catch (ReflectionException $e) { echo $e->getMessage ()."\n"; } @@ -23,17 +23,17 @@ class C { } try { - new ReflectionParameter(array ('A', 'b')); + new ReflectionParameter(array ('A', 'b')); } catch(TypeError $e) { - printf( "Ok - %s\n", $e->getMessage()); + printf( "Ok - %s\n", $e->getMessage()); } try { - new ReflectionParameter(0, 0); + new ReflectionParameter(0, 0); } catch(ReflectionException $e) { - printf( "Ok - %s\n", $e->getMessage()); + printf( "Ok - %s\n", $e->getMessage()); } echo "Done.\n"; diff --git a/ext/reflection/tests/ReflectionParameter_toString_basic.phpt b/ext/reflection/tests/ReflectionParameter_toString_basic.phpt index 35134b7e2d..053c3918db 100644 --- a/ext/reflection/tests/ReflectionParameter_toString_basic.phpt +++ b/ext/reflection/tests/ReflectionParameter_toString_basic.phpt @@ -5,12 +5,12 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl> --FILE-- <?php function ReflectionParameterTest($test, $test2 = null, ...$test3) { - echo $test; + echo $test; } $reflect = new ReflectionFunction('ReflectionParameterTest'); $params = $reflect->getParameters(); foreach($params as $key => $value) { - echo $value->__toString() . "\n"; + echo $value->__toString() . "\n"; } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt b/ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt index 6f39f9db6c..4456960dc7 100644 --- a/ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt +++ b/ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt @@ -4,27 +4,27 @@ ReflectionProperty::__construct(): ensure inherited private props can't be acces <?php class C { - private $p = 1; - - static function testFromC() { - try { - $rp = new ReflectionProperty("D", "p"); - var_dump($rp); - } catch (Exception $e) { - echo $e->getMessage(); - } - } + private $p = 1; + + static function testFromC() { + try { + $rp = new ReflectionProperty("D", "p"); + var_dump($rp); + } catch (Exception $e) { + echo $e->getMessage(); + } + } } class D extends C{ - static function testFromD() { - try { - $rp = new ReflectionProperty("D", "p"); - var_dump($rp); - } catch (Exception $e) { - echo $e->getMessage(); - } - } + static function testFromD() { + try { + $rp = new ReflectionProperty("D", "p"); + var_dump($rp); + } catch (Exception $e) { + echo $e->getMessage(); + } + } } echo "--> Reflect inherited private from global scope:\n"; @@ -32,7 +32,7 @@ try { $rp = new ReflectionProperty("D", "p"); var_dump($rp); } catch (Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } echo "\n\n--> Reflect inherited private from declaring scope:\n"; diff --git a/ext/reflection/tests/ReflectionProperty_error.phpt b/ext/reflection/tests/ReflectionProperty_error.phpt index a7fdff5000..052bfcb97c 100644 --- a/ext/reflection/tests/ReflectionProperty_error.phpt +++ b/ext/reflection/tests/ReflectionProperty_error.phpt @@ -8,20 +8,20 @@ class C { } try { - new ReflectionProperty(); + new ReflectionProperty(); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } try { - new ReflectionProperty('C::p'); + new ReflectionProperty('C::p'); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } try { - new ReflectionProperty('C', 'p', 'x'); + new ReflectionProperty('C', 'p', 'x'); } catch (TypeError $re) { - echo "Ok - ".$re->getMessage().PHP_EOL; + echo "Ok - ".$re->getMessage().PHP_EOL; } ?> diff --git a/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt b/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt index a297a10436..da6cf71b9c 100644 --- a/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt +++ b/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt @@ -7,15 +7,15 @@ Steve Seear <stevseea@php.net> <?php function reflectProperty($class, $property) { - $propInfo = new ReflectionProperty($class, $property); + $propInfo = new ReflectionProperty($class, $property); - echo "**********************************\n"; - echo "Reflecting on property $class::$property\n\n"; + echo "**********************************\n"; + echo "Reflecting on property $class::$property\n\n"; - echo "getModifiers():\n"; - var_dump($propInfo->getModifiers()); + echo "getModifiers():\n"; + var_dump($propInfo->getModifiers()); - echo "\n**********************************\n"; + echo "\n**********************************\n"; } class TestClass @@ -23,8 +23,8 @@ class TestClass public $pub; static public $stat = "static property"; /** - * This property has a comment. - */ + * This property has a comment. + */ protected $prot = 4; private $priv = "keepOut"; } diff --git a/ext/reflection/tests/ReflectionProperty_isInitialized.phpt b/ext/reflection/tests/ReflectionProperty_isInitialized.phpt index f1f6e53ebd..260084fae4 100644 --- a/ext/reflection/tests/ReflectionProperty_isInitialized.phpt +++ b/ext/reflection/tests/ReflectionProperty_isInitialized.phpt @@ -4,12 +4,12 @@ Test ReflectionProperty::isInitialized() <?php class A { - public static ?string $ssv = null; - public static ?string $ss; - public static $s; - public ?int $iv = null; - public ?int $i; - public $n; + public static ?string $ssv = null; + public static ?string $ss; + public static $s; + public ?int $iv = null; + public ?int $i; + public $n; private int $p; } diff --git a/ext/reflection/tests/ReflectionType_001.phpt b/ext/reflection/tests/ReflectionType_001.phpt index 1eb521317c..e31dc11348 100644 --- a/ext/reflection/tests/ReflectionType_001.phpt +++ b/ext/reflection/tests/ReflectionType_001.phpt @@ -77,22 +77,22 @@ foreach ([ echo "\n*** property types\n"; class PropTypeTest { - public int $int; - public string $string; - public array $arr; - public iterable $iterable; - public stdClass $std; - public OtherThing $other; - public $mixed; + public int $int; + public string $string; + public array $arr; + public iterable $iterable; + public stdClass $std; + public OtherThing $other; + public $mixed; } $reflector = new ReflectionClass(PropTypeTest::class); foreach ($reflector->getProperties() as $name => $property) { - if ($property->hasType()) { - printf("public %s $%s;\n", - $property->getType()->getName(), $property->getName()); - } else printf("public $%s;\n", $property->getName()); + if ($property->hasType()) { + printf("public %s $%s;\n", + $property->getType()->getName(), $property->getName()); + } else printf("public $%s;\n", $property->getName()); } echo "*** resolved property types\n"; diff --git a/ext/reflection/tests/bug26640.phpt b/ext/reflection/tests/bug26640.phpt index 8a93d72247..203785f1dc 100644 --- a/ext/reflection/tests/bug26640.phpt +++ b/ext/reflection/tests/bug26640.phpt @@ -4,19 +4,19 @@ Reflection Bug #26640 (__autoload() not invoked by Reflection classes) <?php spl_autoload_register(function ($c) { - class autoload_class - { - public function __construct() - { - print "autoload success\n"; - } - } + class autoload_class + { + public function __construct() + { + print "autoload success\n"; + } + } }); $a = new ReflectionClass('autoload_class'); if (is_object($a)) { - echo "OK\n"; + echo "OK\n"; } ?> diff --git a/ext/reflection/tests/bug29268.phpt b/ext/reflection/tests/bug29268.phpt index 9166bd3aa9..596d3aba1e 100644 --- a/ext/reflection/tests/bug29268.phpt +++ b/ext/reflection/tests/bug29268.phpt @@ -3,21 +3,21 @@ Reflection Bug #29268 (__autoload() not called with reflectionProperty->getClass --FILE-- <?php spl_autoload_register(function ($classname) { - echo "__autoload($classname)\n"; - eval("class $classname {}"); + echo "__autoload($classname)\n"; + eval("class $classname {}"); }); class B{ - public function doit(A $a){ - } + public function doit(A $a){ + } } $ref = new reflectionMethod('B','doit'); $parameters = $ref->getParameters(); foreach($parameters as $parameter) { - $class = $parameter->getClass(); - echo $class->name."\n"; + $class = $parameter->getClass(); + echo $class->name."\n"; } echo "ok\n"; ?> diff --git a/ext/reflection/tests/bug29523.phpt b/ext/reflection/tests/bug29523.phpt index fafc93ef40..a85612935e 100644 --- a/ext/reflection/tests/bug29523.phpt +++ b/ext/reflection/tests/bug29523.phpt @@ -16,15 +16,15 @@ $numberOfNotOptionalParameters = 0; $numberOfOptionalParameters = 0; foreach($function->getParameters() as $parameter) { - var_dump($parameter->isOptional()); - if ($parameter->isOptional()) - { - ++$numberOfOptionalParameters; - } - else - { - ++$numberOfNotOptionalParameters; - } + var_dump($parameter->isOptional()); + if ($parameter->isOptional()) + { + ++$numberOfOptionalParameters; + } + else + { + ++$numberOfNotOptionalParameters; + } } var_dump($function->getNumberOfRequiredParameters()); var_dump($numberOfNotOptionalParameters); diff --git a/ext/reflection/tests/bug29828.phpt b/ext/reflection/tests/bug29828.phpt index a5f3e30c6f..15c1229cc0 100644 --- a/ext/reflection/tests/bug29828.phpt +++ b/ext/reflection/tests/bug29828.phpt @@ -5,15 +5,15 @@ Reflection Bug #29828 (Interfaces no longer work) interface Bla { - function bla(); + function bla(); } class BlaMore implements Bla { - function bla() - { - echo "Hello\n"; - } + function bla() + { + echo "Hello\n"; + } } $r = new ReflectionClass('BlaMore'); diff --git a/ext/reflection/tests/bug30209.phpt b/ext/reflection/tests/bug30209.phpt index 27b546d1cd..0dc453e6c0 100644 --- a/ext/reflection/tests/bug30209.phpt +++ b/ext/reflection/tests/bug30209.phpt @@ -5,20 +5,20 @@ Reflection Bug #30209 (ReflectionClass::getMethod() lowercases attribute) class Foo { - private $name = 'testBAR'; + private $name = 'testBAR'; - public function testBAR() - { - try - { - $class = new ReflectionClass($this); - var_dump($this->name); - $method = $class->getMethod($this->name); - var_dump($this->name); - } + public function testBAR() + { + try + { + $class = new ReflectionClass($this); + var_dump($this->name); + $method = $class->getMethod($this->name); + var_dump($this->name); + } - catch (Exception $e) {} - } + catch (Exception $e) {} + } } $foo = new Foo; diff --git a/ext/reflection/tests/bug31651.phpt b/ext/reflection/tests/bug31651.phpt index 59f19eae5d..e356baf148 100644 --- a/ext/reflection/tests/bug31651.phpt +++ b/ext/reflection/tests/bug31651.phpt @@ -5,7 +5,7 @@ Reflection Bug #31651 (ReflectionClass::getDefaultProperties segfaults with arra class Test { - public $a = array('a' => 1); + public $a = array('a' => 1); } $ref = new ReflectionClass('Test'); diff --git a/ext/reflection/tests/bug32981.phpt b/ext/reflection/tests/bug32981.phpt index 0e3b721a64..fc6960866f 100644 --- a/ext/reflection/tests/bug32981.phpt +++ b/ext/reflection/tests/bug32981.phpt @@ -5,17 +5,17 @@ Reflection Bug #32981 (ReflectionMethod::getStaticVariables() causes apache2.0.5 class TestClass { - static function test() - { - static $enabled = true; - } + static function test() + { + static $enabled = true; + } } $class = new ReflectionClass('TestClass'); foreach ($class->getMethods() as $method) { - var_dump($method->getName()); - $arr_static_vars[] = $method->getStaticVariables(); + var_dump($method->getName()); + $arr_static_vars[] = $method->getStaticVariables(); } var_dump($arr_static_vars); diff --git a/ext/reflection/tests/bug36434.phpt b/ext/reflection/tests/bug36434.phpt index 502ac741a9..04cdcbf01d 100644 --- a/ext/reflection/tests/bug36434.phpt +++ b/ext/reflection/tests/bug36434.phpt @@ -5,24 +5,24 @@ Reflection Bug #36434 (Properties from parent class fail to indetify their true class ancester { public $ancester = 0; - function __construct() - { - return $this->ancester; - } + function __construct() + { + return $this->ancester; + } } class foo extends ancester { public $bar = "1"; - function __construct() - { - return $this->bar; - } + function __construct() + { + return $this->bar; + } } $r = new ReflectionClass('foo'); foreach ($r->GetProperties() as $p) { - echo $p->getName(). " ". $p->getDeclaringClass()->getName()."\n"; + echo $p->getName(). " ". $p->getDeclaringClass()->getName()."\n"; } ?> diff --git a/ext/reflection/tests/bug37816.phpt b/ext/reflection/tests/bug37816.phpt index 3942265a0e..eec6f09411 100644 --- a/ext/reflection/tests/bug37816.phpt +++ b/ext/reflection/tests/bug37816.phpt @@ -5,7 +5,7 @@ Bug #37816 (ReflectionProperty does not throw exception when accessing protected class TestClass { - protected $p = 2; + protected $p = 2; } $o = new TestClass; @@ -14,11 +14,11 @@ $r = new ReflectionProperty($o, 'p'); try { - $x = $r->getValue($o); + $x = $r->getValue($o); } catch (Exception $e) { - echo 'Caught: ' . $e->getMessage() . "\n"; + echo 'Caught: ' . $e->getMessage() . "\n"; } ?> diff --git a/ext/reflection/tests/bug37964.phpt b/ext/reflection/tests/bug37964.phpt index f3ebe9f72a..59b5f85590 100644 --- a/ext/reflection/tests/bug37964.phpt +++ b/ext/reflection/tests/bug37964.phpt @@ -4,19 +4,19 @@ Reflection Bug #37964 (Reflection shows private methods of parent class) <?php abstract class foobar { - private function test2() { - } + private function test2() { + } } class foo extends foobar { - private $foo = 1; - private function test() { - } - protected function test3() { - } + private $foo = 1; + private function test() { + } + protected function test3() { + } } class bar extends foo { - private function foobar() { - } + private function foobar() { + } } echo new ReflectionClass(new bar); diff --git a/ext/reflection/tests/bug38132.phpt b/ext/reflection/tests/bug38132.phpt index 16e56411f2..e500616604 100644 --- a/ext/reflection/tests/bug38132.phpt +++ b/ext/reflection/tests/bug38132.phpt @@ -3,8 +3,8 @@ Reflection Bug #38132 (ReflectionClass::getStaticProperties() retains \0 in key --FILE-- <?php class foo { - static protected $bar = 'baz'; - static public $a = 'a'; + static protected $bar = 'baz'; + static public $a = 'a'; } $class = new ReflectionClass('foo'); diff --git a/ext/reflection/tests/bug38217.phpt b/ext/reflection/tests/bug38217.phpt index 46f2dc3e0e..cc7525c813 100644 --- a/ext/reflection/tests/bug38217.phpt +++ b/ext/reflection/tests/bug38217.phpt @@ -4,24 +4,24 @@ Bug #38217 (ReflectionClass::newInstanceArgs() tries to allocate too much memory <?php class ObjectOne { - public function __construct() { - } + public function __construct() { + } } $class= new ReflectionClass('ObjectOne'); var_dump($class->newInstanceArgs()); class ObjectTwo { - public function __construct($var) { - var_dump($var); - } + public function __construct($var) { + var_dump($var); + } } $class= new ReflectionClass('ObjectTwo'); try { - var_dump($class->newInstanceArgs()); + var_dump($class->newInstanceArgs()); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } var_dump($class->newInstanceArgs(array('test'))); diff --git a/ext/reflection/tests/bug38653.phpt b/ext/reflection/tests/bug38653.phpt index 64b1aad15b..36504e7c7b 100644 --- a/ext/reflection/tests/bug38653.phpt +++ b/ext/reflection/tests/bug38653.phpt @@ -4,9 +4,9 @@ Bug #38653 (memory leak in ReflectionClass::getConstant()) <?php class foo { - const cons = 10; - const cons1 = ""; - const cons2 = "test"; + const cons = 10; + const cons1 = ""; + const cons2 = "test"; } class bar extends foo { diff --git a/ext/reflection/tests/bug39001.phpt b/ext/reflection/tests/bug39001.phpt index ec4b7a5d1b..1e390341e7 100644 --- a/ext/reflection/tests/bug39001.phpt +++ b/ext/reflection/tests/bug39001.phpt @@ -7,8 +7,8 @@ class Meta { } class CParent extends Meta { - public $publicVar; - protected $protectedVar; + public $publicVar; + protected $protectedVar; } class Child extends CParent { diff --git a/ext/reflection/tests/bug39067.phpt b/ext/reflection/tests/bug39067.phpt index f549f794e0..05ce90be46 100644 --- a/ext/reflection/tests/bug39067.phpt +++ b/ext/reflection/tests/bug39067.phpt @@ -4,15 +4,15 @@ Bug #39067 (getDeclaringClass() and private properties) <?php class A { - private $x; + private $x; } class B extends A { - private $x; + private $x; } class C extends B { - private $x; + private $x; } $rc = new ReflectionClass('C'); @@ -25,11 +25,11 @@ $rc = new ReflectionClass('A'); var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); class Test { - private $x; + private $x; } class Test2 extends Test { - public $x; + public $x; } $rc = new ReflectionClass('Test2'); diff --git a/ext/reflection/tests/bug40431.phpt b/ext/reflection/tests/bug40431.phpt index 637b1457cd..41620a3926 100644 --- a/ext/reflection/tests/bug40431.phpt +++ b/ext/reflection/tests/bug40431.phpt @@ -56,7 +56,7 @@ var_dump($props[0]->isProtected()); echo "=== 4th test ===\n"; class test5 { - private $value = 1; + private $value = 1; } class test4 extends test5{ diff --git a/ext/reflection/tests/bug40794.phpt b/ext/reflection/tests/bug40794.phpt index c1830ddcd2..1f1bb61c58 100644 --- a/ext/reflection/tests/bug40794.phpt +++ b/ext/reflection/tests/bug40794.phpt @@ -13,7 +13,7 @@ $reflect = new ReflectionObject($obj); $array = array(); foreach($reflect->getProperties() as $prop) { - $array[$prop->getName()] = $prop->getValue($obj); + $array[$prop->getName()] = $prop->getValue($obj); } var_dump($array); diff --git a/ext/reflection/tests/bug41884.phpt b/ext/reflection/tests/bug41884.phpt index 25d2b7cb74..ae9655765e 100644 --- a/ext/reflection/tests/bug41884.phpt +++ b/ext/reflection/tests/bug41884.phpt @@ -5,8 +5,8 @@ Bug #41884 (ReflectionClass::getDefaultProperties() does not handle static attri class Foo { - protected static $fooStatic = 'foo'; - protected $foo = 'foo'; + protected static $fooStatic = 'foo'; + protected $foo = 'foo'; } $class = new ReflectionClass('Foo'); diff --git a/ext/reflection/tests/bug42976.phpt b/ext/reflection/tests/bug42976.phpt index 0b147aa811..d8ab797b92 100644 --- a/ext/reflection/tests/bug42976.phpt +++ b/ext/reflection/tests/bug42976.phpt @@ -4,9 +4,9 @@ Bug #42976 (Crash when constructor for newInstance() or newInstanceArgs() fails) <?php Class C { - function __construct(&$x) { - $x = "x.changed"; - } + function __construct(&$x) { + $x = "x.changed"; + } } $x = "x.original"; diff --git a/ext/reflection/tests/bug45139.phpt b/ext/reflection/tests/bug45139.phpt index 6aa84263c6..5a8f62d0cd 100644 --- a/ext/reflection/tests/bug45139.phpt +++ b/ext/reflection/tests/bug45139.phpt @@ -4,19 +4,19 @@ Bug #45139 (ReflectionProperty returns incorrect declaring class) <?php class A { - private $foo; + private $foo; } class B extends A { - protected $bar; - private $baz; - private $quux; + protected $bar; + private $baz; + private $quux; } class C extends B { - public $foo; - private $baz; - protected $quux; + public $foo; + private $baz; + protected $quux; } $rc = new ReflectionClass('C'); diff --git a/ext/reflection/tests/bug45571.phpt b/ext/reflection/tests/bug45571.phpt index 74245fc24c..aa482193a7 100644 --- a/ext/reflection/tests/bug45571.phpt +++ b/ext/reflection/tests/bug45571.phpt @@ -4,12 +4,12 @@ Bug #45571 (ReflectionClass::__toString() shows superclasses' private static met <?php Class A { - static private $a = 0; - static protected $b = 1; - static public $c = 2; + static private $a = 0; + static protected $b = 1; + static public $c = 2; - private function f() {} - private static function sf() {} + private function f() {} + private static function sf() {} } Class C extends A { } diff --git a/ext/reflection/tests/bug45765.phpt b/ext/reflection/tests/bug45765.phpt index 5c33faca2b..af8dd9b47a 100644 --- a/ext/reflection/tests/bug45765.phpt +++ b/ext/reflection/tests/bug45765.phpt @@ -4,23 +4,23 @@ Fixed bug #45765 (ReflectionObject with default parameters of self::xxx cause an <?php class foo2 { - const BAR = 'foobar'; + const BAR = 'foobar'; } class foo extends foo2 { - const BAR = "foo's bar"; + const BAR = "foo's bar"; - function test($a = self::BAR) { - } + function test($a = self::BAR) { + } - function test2($a = parent::BAR) { - } + function test2($a = parent::BAR) { + } - function test3($a = foo::BAR) { - } + function test3($a = foo::BAR) { + } - function test4($a = foo2::BAR) { - } + function test4($a = foo2::BAR) { + } } echo new ReflectionObject(new foo); diff --git a/ext/reflection/tests/bug46064.phpt b/ext/reflection/tests/bug46064.phpt index f11de98733..4a97b3b22a 100644 --- a/ext/reflection/tests/bug46064.phpt +++ b/ext/reflection/tests/bug46064.phpt @@ -4,7 +4,7 @@ Bug #46064 (Exception when creating ReflectionProperty object on dynamicly creat <?php class x { - public $zzz = 2; + public $zzz = 2; } $o = new x; @@ -21,25 +21,25 @@ var_dump($h->getValue($o)); print "---------------------------\n"; try { - var_dump(new reflectionproperty($o, 'zz')); + var_dump(new reflectionproperty($o, 'zz')); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } var_dump(new reflectionproperty($o, 'zzz')); class test { - protected $a = 1; + protected $a = 1; } class bar extends test { - public function __construct() { - $this->foobar = 2; - $this->a = 200; + public function __construct() { + $this->foobar = 2; + $this->a = 200; - $p = new reflectionproperty($this, 'foobar'); - var_dump($p->getValue($this), $p->isDefault(), $p->isPublic()); - } + $p = new reflectionproperty($this, 'foobar'); + var_dump($p->getValue($this), $p->isDefault(), $p->isPublic()); + } } new bar; diff --git a/ext/reflection/tests/bug46064_2.phpt b/ext/reflection/tests/bug46064_2.phpt index 9e10167d30..f1aac5b5c0 100644 --- a/ext/reflection/tests/bug46064_2.phpt +++ b/ext/reflection/tests/bug46064_2.phpt @@ -15,22 +15,22 @@ var_dump($p->getProperty('test')); class bar { - public function __construct() { - $this->a = 1; - } + public function __construct() { + $this->a = 1; + } } class test extends bar { - private $b = 2; + private $b = 2; - public function __construct() { - parent::__construct(); + public function __construct() { + parent::__construct(); - $p = new reflectionobject($this); - var_dump($h = $p->getProperty('a')); - var_dump($h->isDefault(), $h->isProtected(), $h->isPrivate(), $h->isPublic(), $h->isStatic()); - var_dump($p->getProperties()); - } + $p = new reflectionobject($this); + var_dump($h = $p->getProperty('a')); + var_dump($h->isDefault(), $h->isProtected(), $h->isPrivate(), $h->isPublic(), $h->isStatic()); + var_dump($p->getProperties()); + } } new test; diff --git a/ext/reflection/tests/bug46205.phpt b/ext/reflection/tests/bug46205.phpt index 5ca8ac1cd0..78e381370e 100644 --- a/ext/reflection/tests/bug46205.phpt +++ b/ext/reflection/tests/bug46205.phpt @@ -6,7 +6,7 @@ $x = new reflectionmethod('reflectionparameter', 'export'); $y = function() { }; try { - $x->invokeArgs(new reflectionparameter('trim', 'str'), array($y, 1)); + $x->invokeArgs(new reflectionparameter('trim', 'str'), array($y, 1)); } catch (Exception $e) { } ?> ok diff --git a/ext/reflection/tests/bug47254.phpt b/ext/reflection/tests/bug47254.phpt index b6f33fcfc6..6330d6603f 100644 --- a/ext/reflection/tests/bug47254.phpt +++ b/ext/reflection/tests/bug47254.phpt @@ -8,13 +8,13 @@ Testfest 2009 Munich <?php class A { - protected function a() {} + protected function a() {} } class B extends A { - public function b() {} + public function b() {} } $B = new B(); diff --git a/ext/reflection/tests/bug48757.phpt b/ext/reflection/tests/bug48757.phpt index a5ced91d3a..45393470d3 100644 --- a/ext/reflection/tests/bug48757.phpt +++ b/ext/reflection/tests/bug48757.phpt @@ -3,11 +3,11 @@ Bug #48757 (ReflectionFunction::invoke() parameter issues) --FILE-- <?php function test() { - echo "Hello World\n"; + echo "Hello World\n"; } function another_test($parameter) { - var_dump($parameter); + var_dump($parameter); } $func = new ReflectionFunction('test'); diff --git a/ext/reflection/tests/bug49074.phpt b/ext/reflection/tests/bug49074.phpt index 7ce23b41e4..b39814cdf6 100644 --- a/ext/reflection/tests/bug49074.phpt +++ b/ext/reflection/tests/bug49074.phpt @@ -3,13 +3,13 @@ Bug #49074 (private class static fields can be modified by using reflection) --FILE-- <?php class Test { - private static $data1 = 1; - private static $data4 = 4; + private static $data1 = 1; + private static $data4 = 4; } class Test2 extends Test { - private static $data2 = 2; - public static $data3 = 3; + private static $data2 = 2; + public static $data3 = 3; } $r = new ReflectionClass('Test2'); diff --git a/ext/reflection/tests/bug49719.phpt b/ext/reflection/tests/bug49719.phpt index 6211b6b543..37f6ae38af 100644 --- a/ext/reflection/tests/bug49719.phpt +++ b/ext/reflection/tests/bug49719.phpt @@ -4,30 +4,30 @@ Bug #49719 (ReflectionClass::hasProperty returns true for a private property in <?php class A { - private $a; + private $a; } class B extends A { - private $b; + private $b; } try { - $b = new B; - $ref = new ReflectionClass($b); + $b = new B; + $ref = new ReflectionClass($b); - var_dump(property_exists('b', 'a')); - var_dump(property_exists($b, 'a')); - var_dump($ref->hasProperty('a')); - var_dump($ref->getProperty('a')); + var_dump(property_exists('b', 'a')); + var_dump(property_exists($b, 'a')); + var_dump($ref->hasProperty('a')); + var_dump($ref->getProperty('a')); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } class A2 { - private $a = 1; + private $a = 1; } class B2 extends A2 { - private $a = 2; + private $a = 2; } $b2 = new ReflectionClass('B2'); diff --git a/ext/reflection/tests/bug51905.phpt b/ext/reflection/tests/bug51905.phpt index 8969924e45..2d956386a5 100644 --- a/ext/reflection/tests/bug51905.phpt +++ b/ext/reflection/tests/bug51905.phpt @@ -4,12 +4,12 @@ Bug #51905 (ReflectionParameter fails if default value is an array with an acces <?php class Bar { - const Y = 20; + const Y = 20; } class Foo extends Bar { - const X = 12; - public function x($x = 1, $y = array(self::X), $z = parent::Y) {} + const X = 12; + public function x($x = 1, $y = array(self::X), $z = parent::Y) {} } $clazz = new ReflectionClass('Foo'); diff --git a/ext/reflection/tests/bug52854.phpt b/ext/reflection/tests/bug52854.phpt index 255522de5d..2d174bc11e 100644 --- a/ext/reflection/tests/bug52854.phpt +++ b/ext/reflection/tests/bug52854.phpt @@ -11,9 +11,9 @@ var_dump($c->newInstance()); var_dump($c->newInstanceArgs(array())); try { - var_dump($c->newInstanceArgs(array(1))); + var_dump($c->newInstanceArgs(array(1))); } catch(ReflectionException $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } ?> --EXPECTF-- diff --git a/ext/reflection/tests/bug53915.phpt b/ext/reflection/tests/bug53915.phpt index f2f2ae5675..f4df7cc839 100644 --- a/ext/reflection/tests/bug53915.phpt +++ b/ext/reflection/tests/bug53915.phpt @@ -4,8 +4,8 @@ Bug #53915 - ReflectionClass::getConstant(s) emits fatal error on selfreferencin <?php Class Foo { - const A = 1; - const B = self::A; + const A = 1; + const B = self::A; } $rc = new ReflectionClass('Foo'); diff --git a/ext/reflection/tests/bug60367.phpt b/ext/reflection/tests/bug60367.phpt index 3834445733..afc67ccc47 100644 --- a/ext/reflection/tests/bug60367.phpt +++ b/ext/reflection/tests/bug60367.phpt @@ -4,17 +4,17 @@ Bug #60367 (Reflection and Late Static Binding) <?php abstract class A { - const WHAT = 'A'; + const WHAT = 'A'; - public static function call() { - echo static::WHAT; - } + public static function call() { + echo static::WHAT; + } } class B extends A { - const WHAT = 'B'; + const WHAT = 'B'; } diff --git a/ext/reflection/tests/bug64239.phpt b/ext/reflection/tests/bug64239.phpt index 9acdc1987b..100c09d2eb 100644 --- a/ext/reflection/tests/bug64239.phpt +++ b/ext/reflection/tests/bug64239.phpt @@ -3,11 +3,11 @@ Bug #64239 (ReflectionClass::getMethods() changed behavior) --FILE-- <?php class A { - use T2 { t2method as Bmethod; } + use T2 { t2method as Bmethod; } } trait T2 { - public function t2method() { - } + public function t2method() { + } } class B extends A{ diff --git a/ext/reflection/tests/bug64936.phpt b/ext/reflection/tests/bug64936.phpt index 71be47f65b..ae63d43008 100644 --- a/ext/reflection/tests/bug64936.phpt +++ b/ext/reflection/tests/bug64936.phpt @@ -9,8 +9,8 @@ opcache.save_comments=1 function strip_doc_comment($c) { - if (!strlen($c) || $c === false) return $c; - return trim(substr($c, 3, -2)); + if (!strlen($c) || $c === false) return $c; + return trim(substr($c, 3, -2)); } token_get_all("<?php\n/**\n * Foo\n */"); // doc_comment compiler global now contains this Foo comment diff --git a/ext/reflection/tests/bug66430.phpt b/ext/reflection/tests/bug66430.phpt index 921e2c99d8..bd3100b47b 100644 --- a/ext/reflection/tests/bug66430.phpt +++ b/ext/reflection/tests/bug66430.phpt @@ -4,11 +4,11 @@ Bug #66430: ReflectionFunction::invoke does not invoke closure with object scope <?php class Alpha { - public $message = "Valid representation"; + public $message = "Valid representation"; - public function bravo() { - return $this->message; - } + public function bravo() { + return $this->message; + } } $alpha = new Alpha(); diff --git a/ext/reflection/tests/bug70982.phpt b/ext/reflection/tests/bug70982.phpt index d530846f64..644531e373 100644 --- a/ext/reflection/tests/bug70982.phpt +++ b/ext/reflection/tests/bug70982.phpt @@ -3,11 +3,11 @@ Bug #70982 (setStaticPropertyValue behaviors inconsistently with 5.6) --FILE-- <?php class Foo { - static $abc; - function __construct() - { - var_dump(self::$abc); - } + static $abc; + function __construct() + { + var_dump(self::$abc); + } } class Bar extends Foo { diff --git a/ext/reflection/tests/bug74454.inc b/ext/reflection/tests/bug74454.inc index 5136591367..e668e88643 100644 --- a/ext/reflection/tests/bug74454.inc +++ b/ext/reflection/tests/bug74454.inc @@ -1,4 +1,4 @@ <?php class A { - if (wrongsyntax) + if (wrongsyntax) } diff --git a/ext/reflection/tests/bug74454.phpt b/ext/reflection/tests/bug74454.phpt index 0c85baa7c3..e311ab3beb 100644 --- a/ext/reflection/tests/bug74454.phpt +++ b/ext/reflection/tests/bug74454.phpt @@ -4,13 +4,13 @@ Bug #74454 (Wrong exception being thrown when using ReflectionMethod) <?php spl_autoload_register('load_file'); try { - $x = new ReflectionMethod('A', 'b'); + $x = new ReflectionMethod('A', 'b'); } catch (\Throwable $e) { - echo get_class($e), ': ', $e->getMessage(), PHP_EOL; + echo get_class($e), ': ', $e->getMessage(), PHP_EOL; } function load_file() { - require __DIR__ . '/bug74454.inc'; + require __DIR__ . '/bug74454.inc'; } ?> --EXPECT-- diff --git a/ext/reflection/tests/bug74673.phpt b/ext/reflection/tests/bug74673.phpt index 42675f263e..321195c16e 100644 --- a/ext/reflection/tests/bug74673.phpt +++ b/ext/reflection/tests/bug74673.phpt @@ -5,9 +5,9 @@ Bug #74673 (Segfault when cast Reflection object to string with undefined consta class A { - public function method($test = PHP_SELF + 1) - { - } + public function method($test = PHP_SELF + 1) + { + } } $class = new ReflectionClass('A'); diff --git a/ext/reflection/tests/bug74949.phpt b/ext/reflection/tests/bug74949.phpt index 2970c5911f..20e0fc00e1 100644 --- a/ext/reflection/tests/bug74949.phpt +++ b/ext/reflection/tests/bug74949.phpt @@ -12,9 +12,9 @@ unset($f); echo $r, "\n"; try { - echo $r->getPrototype(); + echo $r->getPrototype(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/reflection/tests/bug77882.phpt b/ext/reflection/tests/bug77882.phpt index ff1d212861..71e430d178 100644 --- a/ext/reflection/tests/bug77882.phpt +++ b/ext/reflection/tests/bug77882.phpt @@ -7,7 +7,7 @@ class Test { public function __construct() { throw new Exception(); } - + public function __destruct() { echo "__destruct\n"; } diff --git a/ext/reflection/tests/bug78895.phpt b/ext/reflection/tests/bug78895.phpt index 7e616c4456..b5f84e2d02 100644 --- a/ext/reflection/tests/bug78895.phpt +++ b/ext/reflection/tests/bug78895.phpt @@ -3,18 +3,18 @@ Fixed bug #78895 (Reflection detects abstract non-static class as abstract stati --FILE-- <?php abstract class Foo { - abstract public function f1(); + abstract public function f1(); } interface I { - public function f2(); + public function f2(); } trait T { - abstract public function f2(); + abstract public function f2(); } class Bar extends Foo implements I { - use T; - function f1() {} - function f2() {} + use T; + function f1() {} + function f2() {} } $ref = new ReflectionClass(Foo::class); var_dump(Reflection::getModifierNames($ref->getModifiers())); diff --git a/ext/reflection/tests/closures_001.phpt b/ext/reflection/tests/closures_001.phpt index 926951eef2..56581c05b8 100644 --- a/ext/reflection/tests/closures_001.phpt +++ b/ext/reflection/tests/closures_001.phpt @@ -11,10 +11,10 @@ var_dump($rm->getNumberOfParameters()); var_dump($rm->getNumberOfRequiredParameters()); $rms = $ro->getMethods(); foreach($rms as $rm) { - if ($rm->getName() == '__invoke') { - var_dump($rm->getNumberOfParameters()); - var_dump($rm->getNumberOfRequiredParameters()); - } + if ($rm->getName() == '__invoke') { + var_dump($rm->getNumberOfParameters()); + var_dump($rm->getNumberOfRequiredParameters()); + } } echo "---\n"; diff --git a/ext/reflection/tests/closures_002.phpt b/ext/reflection/tests/closures_002.phpt index 4b127810fb..9e606857b6 100644 --- a/ext/reflection/tests/closures_002.phpt +++ b/ext/reflection/tests/closures_002.phpt @@ -4,7 +4,7 @@ Reflection on invocable objects <?php class Test { - function __invoke($a, $b = 0) { } + function __invoke($a, $b = 0) { } } $rm = new ReflectionMethod(new Test, '__invoke'); diff --git a/ext/reflection/tests/included4.inc b/ext/reflection/tests/included4.inc index 313fc5feca..7b64eb29cf 100644 --- a/ext/reflection/tests/included4.inc +++ b/ext/reflection/tests/included4.inc @@ -3,7 +3,7 @@ echo __FILE__ . "\n"; echo __LINE__ . "\n"; function g() { - echo __FILE__ . "\n"; - echo __LINE__ . "\n"; + echo __FILE__ . "\n"; + echo __LINE__ . "\n"; } ?> diff --git a/ext/reflection/tests/parameters_001.phpt b/ext/reflection/tests/parameters_001.phpt index 92869a2faf..6c57b2c307 100644 --- a/ext/reflection/tests/parameters_001.phpt +++ b/ext/reflection/tests/parameters_001.phpt @@ -4,8 +4,8 @@ ReflectionParameter Check for parameter being optional <?php class Test { - function func($x, $y = NULL){ - } + function func($x, $y = NULL){ + } } @@ -20,11 +20,11 @@ $p = new ReflectionParameter(array('Test', 'func'), 'y'); var_dump($p->isOptional()); try { - $p = new ReflectionParameter(array('Test', 'func'), 'z'); - var_dump($p->isOptional()); + $p = new ReflectionParameter(array('Test', 'func'), 'z'); + var_dump($p->isOptional()); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> diff --git a/ext/reflection/tests/parameters_002.phpt b/ext/reflection/tests/parameters_002.phpt index aed8d7afa0..14cb7fdefb 100644 --- a/ext/reflection/tests/parameters_002.phpt +++ b/ext/reflection/tests/parameters_002.phpt @@ -10,61 +10,61 @@ function test($nix, Array $ar, &$ref, stdClass $std, class test { - function method($nix, Array $ar, &$ref, stdClass $std, + function method($nix, Array $ar, &$ref, stdClass $std, NonExistingClass $na, stdClass $opt = NULL, $def = "FooBar") - { - } + { + } } function check_params_decl_func($r, $f) { - $c = $r->$f(); + $c = $r->$f(); $sep = $c instanceof ReflectionMethod ? $c->class . '::' : ''; - echo $f . ': ' . ($c ? $sep . $c->name : 'NULL') . "()\n"; + echo $f . ': ' . ($c ? $sep . $c->name : 'NULL') . "()\n"; } function check_params_decl_class($r, $f) { - $c = $r->$f(); - echo $f . ': ' . ($c ? $c->name : 'NULL') . "\n"; + $c = $r->$f(); + echo $f . ': ' . ($c ? $c->name : 'NULL') . "\n"; } function check_params_func($r, $f) { - echo $f . ': '; - $v = $r->$f(); - var_dump($v); + echo $f . ': '; + $v = $r->$f(); + var_dump($v); } function check_params($r) { - echo "#####" . ($r instanceof ReflectionMethod ? $r->class . '::' : '') . $r->name . "()#####\n"; - $i = 0; - foreach($r->getParameters() as $p) - { - echo "===" . $i . "===\n"; - $i++; - check_params_func($p, 'getName'); - check_params_func($p, 'isPassedByReference'); - try - { - check_params_decl_class($p, 'getClass'); - } - catch(ReflectionException $e) - { - echo $e->getMessage() . "\n"; - } - check_params_decl_class($p, 'getDeclaringClass'); + echo "#####" . ($r instanceof ReflectionMethod ? $r->class . '::' : '') . $r->name . "()#####\n"; + $i = 0; + foreach($r->getParameters() as $p) + { + echo "===" . $i . "===\n"; + $i++; + check_params_func($p, 'getName'); + check_params_func($p, 'isPassedByReference'); + try + { + check_params_decl_class($p, 'getClass'); + } + catch(ReflectionException $e) + { + echo $e->getMessage() . "\n"; + } + check_params_decl_class($p, 'getDeclaringClass'); // check_params_decl_func($p, 'getDeclaringFunction'); - check_params_func($p, 'isArray'); - check_params_func($p, 'allowsNull'); - check_params_func($p, 'isOptional'); - check_params_func($p, 'isDefaultValueAvailable'); - if ($p->isOptional()) - { - check_params_func($p, 'getDefaultValue'); - } - } + check_params_func($p, 'isArray'); + check_params_func($p, 'allowsNull'); + check_params_func($p, 'isOptional'); + check_params_func($p, 'isDefaultValueAvailable'); + if ($p->isOptional()) + { + check_params_func($p, 'getDefaultValue'); + } + } } check_params(new ReflectionFunction('test')); diff --git a/ext/reflection/tests/property_exists.phpt b/ext/reflection/tests/property_exists.phpt index 002ece12b3..a740589bab 100644 --- a/ext/reflection/tests/property_exists.phpt +++ b/ext/reflection/tests/property_exists.phpt @@ -5,54 +5,54 @@ Reflection and property_exists() class A { - public $a = 1; - protected $b = 2; - private $c = 3; + public $a = 1; + protected $b = 2; + private $c = 3; - public $empty; - public $init = 1; + public $empty; + public $init = 1; - function __toString() - { - return 'obj(' . get_class($this) . ')'; - } + function __toString() + { + return 'obj(' . get_class($this) . ')'; + } - static function test($oc, $props) - { - echo '===' . __CLASS__ . "===\n"; - foreach($props as $p2) { - echo $oc, '::$' , $p2, "\n"; - var_dump(property_exists($oc, $p2)); - } - } + static function test($oc, $props) + { + echo '===' . __CLASS__ . "===\n"; + foreach($props as $p2) { + echo $oc, '::$' , $p2, "\n"; + var_dump(property_exists($oc, $p2)); + } + } } class B extends A { - private $c = 4; + private $c = 4; - static function test($oc, $props) - { - echo '===' . __CLASS__ . "===\n"; - foreach($props as $p2) { - echo $oc, '::$' , $p2, "\n"; - var_dump(property_exists($oc, $p2)); - } - } + static function test($oc, $props) + { + echo '===' . __CLASS__ . "===\n"; + foreach($props as $p2) { + echo $oc, '::$' , $p2, "\n"; + var_dump(property_exists($oc, $p2)); + } + } } class C extends B { - private $d = 5; + private $d = 5; - static function test($oc, $props) - { - echo '===' . __CLASS__ . "===\n"; - foreach($props as $p2) { - echo $oc, '::$' , $p2, "\n"; - var_dump(property_exists($oc, $p2)); - } - } + static function test($oc, $props) + { + echo '===' . __CLASS__ . "===\n"; + foreach($props as $p2) { + echo $oc, '::$' , $p2, "\n"; + var_dump(property_exists($oc, $p2)); + } + } } $oA = new A; @@ -64,17 +64,17 @@ $pc = array($oA, 'A', 'B', 'C', $oC); $pr = array('a', 'b', 'c', 'd', 'e'); foreach($pc as $p1) { - if (is_object($p1)) { - $p1->test($p1, $pr); - } else { - $r = new ReflectionMethod($p1, 'test'); - $r->invoke(NULL, $p1, $pr); - } - echo "===GLOBAL===\n"; - foreach($pr as $p2) { - echo $p1, '::$' , $p2, "\n"; - var_dump(property_exists($p1, $p2)); - } + if (is_object($p1)) { + $p1->test($p1, $pr); + } else { + $r = new ReflectionMethod($p1, 'test'); + $r->invoke(NULL, $p1, $pr); + } + echo "===GLOBAL===\n"; + foreach($pr as $p2) { + echo $p1, '::$' , $p2, "\n"; + var_dump(property_exists($p1, $p2)); + } } echo "===PROBLEMS===\n"; diff --git a/ext/reflection/tests/static_properties_002.phpt b/ext/reflection/tests/static_properties_002.phpt index 0e3baa9530..126aa784a0 100644 --- a/ext/reflection/tests/static_properties_002.phpt +++ b/ext/reflection/tests/static_properties_002.phpt @@ -4,29 +4,29 @@ Reflection and inheriting static properties <?php class base { - static protected $prop = 2; + static protected $prop = 2; - static function show() { - echo __METHOD__ . '(' . self::$prop . ")\n"; - } + static function show() { + echo __METHOD__ . '(' . self::$prop . ")\n"; + } - static function inc() { - base::$prop++; - echo __METHOD__ . "()\n"; - } + static function inc() { + base::$prop++; + echo __METHOD__ . "()\n"; + } } class derived extends base { - static public $prop = 2; + static public $prop = 2; - static function show() { - echo __METHOD__ . '(' . self::$prop . ")\n"; - } + static function show() { + echo __METHOD__ . '(' . self::$prop . ")\n"; + } - static function inc() { - derived::$prop++; - echo __METHOD__ . "()\n"; - } + static function inc() { + derived::$prop++; + echo __METHOD__ . "()\n"; + } } base::show(); diff --git a/ext/reflection/tests/union_types.phpt b/ext/reflection/tests/union_types.phpt index bb568a0cf4..042ba0759d 100644 --- a/ext/reflection/tests/union_types.phpt +++ b/ext/reflection/tests/union_types.phpt @@ -14,7 +14,7 @@ function dumpType(ReflectionUnionType $rt) { echo " Allows Null: " . ($type->allowsNull() ? "true" : "false") . "\n"; } } - + function test1(): X|Y|int|float|false|null { } function test2(): X|iterable|bool { } diff --git a/ext/session/tests/001.phpt b/ext/session/tests/001.phpt index 0643dce51f..adf63c5f6a 100644 --- a/ext/session/tests/001.phpt +++ b/ext/session/tests/001.phpt @@ -12,9 +12,9 @@ session.save_handler=files error_reporting(E_ALL); class foo { - public $bar = "ok"; + public $bar = "ok"; - function method() { $this->yes = "done"; } + function method() { $this->yes = "done"; } } $baz = new foo; diff --git a/ext/session/tests/003.phpt b/ext/session/tests/003.phpt index eae636593d..a20bc9940d 100644 --- a/ext/session/tests/003.phpt +++ b/ext/session/tests/003.phpt @@ -13,8 +13,8 @@ session.save_handler=files error_reporting(E_ALL); class foo { - public $bar = "ok"; - function method() { $this->yes++; } + public $bar = "ok"; + function method() { $this->yes++; } } session_id("abtest"); diff --git a/ext/session/tests/004.phpt b/ext/session/tests/004.phpt index 9e34b7123f..4b81a088b2 100644 --- a/ext/session/tests/004.phpt +++ b/ext/session/tests/004.phpt @@ -33,7 +33,7 @@ class handler { function write($key, $val) { print "WRITE: $key, $val\n"; - $GLOBALS["hnd"]->data = $val; + $GLOBALS["hnd"]->data = $val; return true; } diff --git a/ext/session/tests/005.phpt b/ext/session/tests/005.phpt index 4046b3aebc..a7b42de7fa 100644 --- a/ext/session/tests/005.phpt +++ b/ext/session/tests/005.phpt @@ -14,7 +14,7 @@ error_reporting(E_ALL); ob_start(); class handler { - public $data = 'baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}'; + public $data = 'baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}'; function open($save_path, $session_name) { print "OPEN: $session_name\n"; @@ -22,7 +22,7 @@ class handler { } function close() { - print "CLOSE\n"; + print "CLOSE\n"; return true; } function read($key) @@ -34,7 +34,7 @@ class handler { function write($key, $val) { print "WRITE: $key, $val\n"; - $GLOBALS["hnd"]->data = $val; + $GLOBALS["hnd"]->data = $val; return true; } diff --git a/ext/session/tests/017.phpt b/ext/session/tests/017.phpt index baf7df8c57..957fcb2e45 100644 --- a/ext/session/tests/017.phpt +++ b/ext/session/tests/017.phpt @@ -13,10 +13,10 @@ session.save_handler=files error_reporting(E_ALL); class Kill { - function __construct() { - global $HTTP_SESSION_VARS; - session_start(); - } + function __construct() { + global $HTTP_SESSION_VARS; + session_start(); + } } $k = new Kill(); diff --git a/ext/session/tests/019.phpt b/ext/session/tests/019.phpt index 5846291769..d9a478245b 100644 --- a/ext/session/tests/019.phpt +++ b/ext/session/tests/019.phpt @@ -14,13 +14,13 @@ session.save_handler=files error_reporting(E_ALL); class TFoo { - public $c; - function __construct($c) { - $this->c = $c; - } - function inc() { - $this->c++; - } + public $c; + function __construct($c) { + $this->c = $c; + } + function inc() { + $this->c++; + } } session_id("abtest"); diff --git a/ext/session/tests/022.phpt b/ext/session/tests/022.phpt index 5923bbe0bf..e7e26f88b0 100644 --- a/ext/session/tests/022.phpt +++ b/ext/session/tests/022.phpt @@ -12,9 +12,9 @@ session.save_handler=files error_reporting(E_ALL); class foo { - public $bar = "ok"; + public $bar = "ok"; - function method() { $this->yes = "done"; } + function method() { $this->yes = "done"; } } $baz = new foo; diff --git a/ext/session/tests/023.phpt b/ext/session/tests/023.phpt index 592b4a8c3b..828358dc78 100644 --- a/ext/session/tests/023.phpt +++ b/ext/session/tests/023.phpt @@ -13,8 +13,8 @@ session.save_handler=files error_reporting(E_ALL); class foo { - public $bar = "ok"; - function method() { $this->yes++; } + public $bar = "ok"; + function method() { $this->yes++; } } session_id("abtest"); diff --git a/ext/session/tests/024.phpt b/ext/session/tests/024.phpt index d417a82ca1..174f2e2639 100644 --- a/ext/session/tests/024.phpt +++ b/ext/session/tests/024.phpt @@ -34,7 +34,7 @@ class handler { function write($key, $val) { print "WRITE: $key, $val\n"; - $GLOBALS["hnd"]->data = $val; + $GLOBALS["hnd"]->data = $val; return true; } diff --git a/ext/session/tests/025.phpt b/ext/session/tests/025.phpt index aa1f995c49..172ea579c6 100644 --- a/ext/session/tests/025.phpt +++ b/ext/session/tests/025.phpt @@ -23,7 +23,7 @@ class handler { } function close() { - print "CLOSE\n"; + print "CLOSE\n"; return true; } function read($key) diff --git a/ext/session/tests/bug31454.phpt b/ext/session/tests/bug31454.phpt index 24da588aa4..9e99135e5f 100644 --- a/ext/session/tests/bug31454.phpt +++ b/ext/session/tests/bug31454.phpt @@ -6,12 +6,12 @@ Bug #31454 (session_set_save_handler crashes PHP when supplied non-existent obje <?php session_set_save_handler( - array(&$arf, 'open'), - array(&$arf, 'close'), - array(&$arf, 'read'), - array(&$arf, 'write'), - array(&$arf, 'destroy'), - array(&$arf, 'gc')); + array(&$arf, 'open'), + array(&$arf, 'close'), + array(&$arf, 'read'), + array(&$arf, 'write'), + array(&$arf, 'destroy'), + array(&$arf, 'gc')); echo "Done\n"; ?> diff --git a/ext/session/tests/bug32330.phpt b/ext/session/tests/bug32330.phpt index 4d432ef1d4..4240ff7160 100644 --- a/ext/session/tests/bug32330.phpt +++ b/ext/session/tests/bug32330.phpt @@ -16,38 +16,38 @@ error_reporting(E_ALL); function sOpen($path, $name) { - echo "open: path = {$path}, name = {$name}\n"; - return TRUE; + echo "open: path = {$path}, name = {$name}\n"; + return TRUE; } function sClose() { - echo "close\n"; - return TRUE; + echo "close\n"; + return TRUE; } function sRead($id) { - echo "read: id = {$id}\n"; - return ''; + echo "read: id = {$id}\n"; + return ''; } function sWrite($id, $data) { - echo "write: id = {$id}, data = {$data}\n"; - return TRUE; + echo "write: id = {$id}, data = {$data}\n"; + return TRUE; } function sDestroy($id) { - echo "destroy: id = {$id}\n"; - return TRUE; + echo "destroy: id = {$id}\n"; + return TRUE; } function sGC($maxlifetime) { - echo "gc: maxlifetime = {$maxlifetime}\n"; - return TRUE; + echo "gc: maxlifetime = {$maxlifetime}\n"; + return TRUE; } session_set_save_handler( 'sOpen', 'sClose', 'sRead', 'sWrite', 'sDestroy', 'sGC' ); diff --git a/ext/session/tests/bug60634.phpt b/ext/session/tests/bug60634.phpt index 064f29a0d2..b303134e5b 100644 --- a/ext/session/tests/bug60634.phpt +++ b/ext/session/tests/bug60634.phpt @@ -16,15 +16,15 @@ function open($save_path, $session_name) { } function close() { - die("close: goodbye cruel world\n"); + die("close: goodbye cruel world\n"); } function read($id) { - return ''; + return ''; } function write($id, $session_data) { - die("write: goodbye cruel world\n"); + die("write: goodbye cruel world\n"); } function destroy($id) { diff --git a/ext/session/tests/bug60634_error_1.phpt b/ext/session/tests/bug60634_error_1.phpt index c573b65e36..9a1d2288a3 100644 --- a/ext/session/tests/bug60634_error_1.phpt +++ b/ext/session/tests/bug60634_error_1.phpt @@ -16,17 +16,17 @@ function open($save_path, $session_name) { } function close() { - echo "close: goodbye cruel world\n"; - return true; + echo "close: goodbye cruel world\n"; + return true; } function read($id) { - return ''; + return ''; } function write($id, $session_data) { - echo "write: goodbye cruel world\n"; - undefined_function(); + echo "write: goodbye cruel world\n"; + undefined_function(); } function destroy($id) { diff --git a/ext/session/tests/bug60634_error_2.phpt b/ext/session/tests/bug60634_error_2.phpt index 4ca598b4e7..ef06095692 100644 --- a/ext/session/tests/bug60634_error_2.phpt +++ b/ext/session/tests/bug60634_error_2.phpt @@ -16,17 +16,17 @@ function open($save_path, $session_name) { } function close() { - echo "close: goodbye cruel world\n"; - return true; + echo "close: goodbye cruel world\n"; + return true; } function read($id) { - return ''; + return ''; } function write($id, $session_data) { - echo "write: goodbye cruel world\n"; - throw new Exception; + echo "write: goodbye cruel world\n"; + throw new Exception; } function destroy($id) { diff --git a/ext/session/tests/bug60634_error_3.phpt b/ext/session/tests/bug60634_error_3.phpt index f97da00dce..1909fc8ada 100644 --- a/ext/session/tests/bug60634_error_3.phpt +++ b/ext/session/tests/bug60634_error_3.phpt @@ -16,17 +16,17 @@ function open($save_path, $session_name) { } function close() { - echo "close: goodbye cruel world\n"; - exit; + echo "close: goodbye cruel world\n"; + exit; } function read($id) { - return ''; + return ''; } function write($id, $session_data) { - echo "write: goodbye cruel world\n"; - undefined_function(); + echo "write: goodbye cruel world\n"; + undefined_function(); } function destroy($id) { diff --git a/ext/session/tests/bug60634_error_4.phpt b/ext/session/tests/bug60634_error_4.phpt index ca8672e4f4..e3834f262c 100644 --- a/ext/session/tests/bug60634_error_4.phpt +++ b/ext/session/tests/bug60634_error_4.phpt @@ -16,17 +16,17 @@ function open($save_path, $session_name) { } function close() { - echo "close: goodbye cruel world\n"; - exit; + echo "close: goodbye cruel world\n"; + exit; } function read($id) { - return ''; + return ''; } function write($id, $session_data) { - echo "write: goodbye cruel world\n"; - throw new Exception; + echo "write: goodbye cruel world\n"; + throw new Exception; } function destroy($id) { diff --git a/ext/session/tests/bug60634_error_5.phpt b/ext/session/tests/bug60634_error_5.phpt index 5728d3a90c..333c86c67f 100644 --- a/ext/session/tests/bug60634_error_5.phpt +++ b/ext/session/tests/bug60634_error_5.phpt @@ -16,16 +16,16 @@ function open($save_path, $session_name) { } function close() { - echo "close: goodbye cruel world\n"; - undefined_function(); + echo "close: goodbye cruel world\n"; + undefined_function(); } function read($id) { - return ''; + return ''; } function write($id, $session_data) { - return true; + return true; } function destroy($id) { diff --git a/ext/session/tests/bug71162.phpt b/ext/session/tests/bug71162.phpt index 31d3370499..b475ae6080 100644 --- a/ext/session/tests/bug71162.phpt +++ b/ext/session/tests/bug71162.phpt @@ -36,13 +36,13 @@ class MySessionHandler extends SessionHandler implements SessionUpdateTimestampH return TRUE; } - public function create_sid() { - return sha1(random_bytes(32)); - } + public function create_sid() { + return sha1(random_bytes(32)); + } - public function validateId($sid) { - return TRUE; - } + public function validateId($sid) { + return TRUE; + } public function updateTimestamp($sessid, $sessdata) { echo __FUNCTION__, PHP_EOL; diff --git a/ext/session/tests/bug71972.phpt b/ext/session/tests/bug71972.phpt index e4c5c6b6d3..1384cae21e 100644 --- a/ext/session/tests/bug71972.phpt +++ b/ext/session/tests/bug71972.phpt @@ -13,13 +13,13 @@ $_SESSION['boogie'] = 1; $_SESSION['obj1'] = new stdClass(); for ( $x=2; $x < 20; $x++) { - cyclic_ref($x); + cyclic_ref($x); } function cyclic_ref($num) { - $_SESSION['obj'.$num] = new stdClass(); - $_SESSION['obj'.$num]->test = new stdClass();//NOTE: No bug if try commenting out this too. - $_SESSION['obj'.$num]->obj1 = $_SESSION['obj1']; + $_SESSION['obj'.$num] = new stdClass(); + $_SESSION['obj'.$num]->test = new stdClass();//NOTE: No bug if try commenting out this too. + $_SESSION['obj'.$num]->obj1 = $_SESSION['obj1']; } var_dump(session_decode(session_encode()) == $_SESSION); diff --git a/ext/session/tests/bug72562.phpt b/ext/session/tests/bug72562.phpt index b36cf6df25..8421e8940a 100644 --- a/ext/session/tests/bug72562.phpt +++ b/ext/session/tests/bug72562.phpt @@ -27,12 +27,12 @@ var_dump($out_2); function ptr2str($ptr) { - $out = ''; - for ($i = 0; $i < 8; $i++) { - $out .= chr($ptr & 0xff); - $ptr >>= 8; - } - return $out; + $out = ''; + for ($i = 0; $i < 8; $i++) { + $out .= chr($ptr & 0xff); + $ptr >>= 8; + } + return $out; } ?> --EXPECTF-- diff --git a/ext/session/tests/save_handler_closures.inc b/ext/session/tests/save_handler_closures.inc index 50f33c1098..acf72f00f6 100644 --- a/ext/session/tests/save_handler_closures.inc +++ b/ext/session/tests/save_handler_closures.inc @@ -3,7 +3,7 @@ require_once 'save_handler.inc'; foreach (array ('open', 'close', 'read', 'write', 'destroy', 'gc') as $fn) { - ${$fn.'_closure'} = function () use ($fn) { return call_user_func_array ($fn, func_get_args ()); }; + ${$fn.'_closure'} = function () use ($fn) { return call_user_func_array ($fn, func_get_args ()); }; } ?> diff --git a/ext/session/tests/session_decode_error2.phpt b/ext/session/tests/session_decode_error2.phpt index ff4e618a5e..20415c7a63 100644 --- a/ext/session/tests/session_decode_error2.phpt +++ b/ext/session/tests/session_decode_error2.phpt @@ -18,7 +18,7 @@ $data = "foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;"; var_dump(session_start()); for($index = 0; $index < strlen($data); $index++) { - if(session_status() != PHP_SESSION_ACTIVE) { session_start(); } + if(session_status() != PHP_SESSION_ACTIVE) { session_start(); } echo "\n-- Iteration $index --\n"; $encoded = substr($data, 0, $index); var_dump(session_decode($encoded)); diff --git a/ext/session/tests/session_regenerate_id_cookie.phpt b/ext/session/tests/session_regenerate_id_cookie.phpt index 79d99f3375..76667cdbcc 100644 --- a/ext/session/tests/session_regenerate_id_cookie.phpt +++ b/ext/session/tests/session_regenerate_id_cookie.phpt @@ -32,16 +32,16 @@ file_put_contents($file, '<?php ob_start(); function find_cookie_header() { - $headers = headers_list(); - $target = "Set-Cookie: PHPSESSID="; - foreach ($headers as $h) { - if (strstr($h, $target) !== FALSE) { - echo $h."\n"; - return TRUE; - } - } - var_dump($headers); - return FALSE; + $headers = headers_list(); + $target = "Set-Cookie: PHPSESSID="; + foreach ($headers as $h) { + if (strstr($h, $target) !== FALSE) { + echo $h."\n"; + return TRUE; + } + } + var_dump($headers); + return FALSE; } var_dump(session_start()); diff --git a/ext/session/tests/session_save_path_variation4.phpt b/ext/session/tests/session_save_path_variation4.phpt index 1cb86e1c30..a95b990dbc 100644 --- a/ext/session/tests/session_save_path_variation4.phpt +++ b/ext/session/tests/session_save_path_variation4.phpt @@ -26,7 +26,7 @@ chdir($initdir); // Delete the existing directory if (file_exists($sessions) === TRUE) { - @rmdir($sessions); + @rmdir($sessions); } var_dump(mkdir($sessions)); diff --git a/ext/session/tests/session_save_path_variation5.phpt b/ext/session/tests/session_save_path_variation5.phpt index 557634c903..b97badf7f6 100644 --- a/ext/session/tests/session_save_path_variation5.phpt +++ b/ext/session/tests/session_save_path_variation5.phpt @@ -27,7 +27,7 @@ chdir($directory); ini_set('open_basedir', '.'); // Delete the existing directory if (file_exists($sessions) === TRUE) { - @rmdir($sessions); + @rmdir($sessions); } var_dump(mkdir($sessions)); diff --git a/ext/session/tests/session_set_save_handler_class_001.phpt b/ext/session/tests/session_set_save_handler_class_001.phpt index ea8fc81d74..33d2a76425 100644 --- a/ext/session/tests/session_set_save_handler_class_001.phpt +++ b/ext/session/tests/session_set_save_handler_class_001.phpt @@ -20,57 +20,57 @@ ob_start(); echo "*** Testing session_set_save_handler() : basic class wrapping existing handler ***\n"; class MySession extends SessionHandler { - public $i = 0; - public function open($path, $name) { - ++$this->i; - echo 'Open ', session_id(), "\n"; - return parent::open($path, $name); - } - public function create_sid() { - // This method should be removed when 5.5 become unsupported. - ++$this->i; - echo 'Old Create SID ', session_id(), "\n"; - return parent::create_sid(); - } - public function read($key) { - ++$this->i; - echo 'Read ', session_id(), "\n"; - return parent::read($key); - } - public function write($key, $data) { - ++$this->i; - echo 'Write ', session_id(), "\n"; - return parent::write($key, $data); - } - public function close() { - ++$this->i; - echo 'Close ', session_id(), "\n"; - return parent::close(); - } - public function createSid() { - // User should use this rather than create_sid() - // If both create_sid() and createSid() exists, - // createSid() is used. - ++$this->i; - echo 'New Create ID ', session_id(), "\n"; - return parent::create_sid(); - } - public function validateId($key) { - ++$this->i; - echo 'Validate ID ', session_id(), "\n"; - return TRUE; - // User must implement their own method and - // cannot call parent as follows. - // return parent::validateSid($key); - } - public function updateTimestamp($key, $data) { - ++$this->i; - echo 'Update Timestamp ', session_id(), "\n"; - return parent::write($key, $data); - // User must implement their own method and - // cannot call parent as follows - // return parent::updateTimestamp($key, $data); - } + public $i = 0; + public function open($path, $name) { + ++$this->i; + echo 'Open ', session_id(), "\n"; + return parent::open($path, $name); + } + public function create_sid() { + // This method should be removed when 5.5 become unsupported. + ++$this->i; + echo 'Old Create SID ', session_id(), "\n"; + return parent::create_sid(); + } + public function read($key) { + ++$this->i; + echo 'Read ', session_id(), "\n"; + return parent::read($key); + } + public function write($key, $data) { + ++$this->i; + echo 'Write ', session_id(), "\n"; + return parent::write($key, $data); + } + public function close() { + ++$this->i; + echo 'Close ', session_id(), "\n"; + return parent::close(); + } + public function createSid() { + // User should use this rather than create_sid() + // If both create_sid() and createSid() exists, + // createSid() is used. + ++$this->i; + echo 'New Create ID ', session_id(), "\n"; + return parent::create_sid(); + } + public function validateId($key) { + ++$this->i; + echo 'Validate ID ', session_id(), "\n"; + return TRUE; + // User must implement their own method and + // cannot call parent as follows. + // return parent::validateSid($key); + } + public function updateTimestamp($key, $data) { + ++$this->i; + echo 'Update Timestamp ', session_id(), "\n"; + return parent::write($key, $data); + // User must implement their own method and + // cannot call parent as follows + // return parent::updateTimestamp($key, $data); + } } $oldHandler = ini_get('session.save_handler'); diff --git a/ext/session/tests/session_set_save_handler_class_002.phpt b/ext/session/tests/session_set_save_handler_class_002.phpt index 29b1d270c6..6343cfdc0e 100644 --- a/ext/session/tests/session_set_save_handler_class_002.phpt +++ b/ext/session/tests/session_set_save_handler_class_002.phpt @@ -19,46 +19,46 @@ ob_start(); echo "*** Testing session_set_save_handler() : full handler implementation ***\n"; class MySession2 extends SessionHandler { - public $path; - - public function open($path, $name) { - if (!$path) { - $path = sys_get_temp_dir(); - } - $this->path = $path . '/u_sess_' . $name; - return true; - } - - public function close() { - return true; - } - - public function read($id) { - return (string)@file_get_contents($this->path . $id); - } - - public function write($id, $data) { - return (bool)file_put_contents($this->path . $id, $data); - } - - public function destroy($id) { - @unlink($this->path . $id); - return true; - } - - public function gc($maxlifetime) { - foreach (glob($this->path . '*') as $filename) { - if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); - } - } - return true; - } + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return (string)@file_get_contents($this->path . $id); + } + + public function write($id, $data) { + return (bool)file_put_contents($this->path . $id, $data); + } + + public function destroy($id) { + @unlink($this->path . $id); + return true; + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } } $handler = new MySession2; session_set_save_handler(array($handler, 'open'), array($handler, 'close'), - array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc')); + array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc')); session_start(); $_SESSION['foo'] = "hello"; diff --git a/ext/session/tests/session_set_save_handler_class_003.phpt b/ext/session/tests/session_set_save_handler_class_003.phpt index ba0311b96b..b3aba74989 100644 --- a/ext/session/tests/session_set_save_handler_class_003.phpt +++ b/ext/session/tests/session_set_save_handler_class_003.phpt @@ -19,22 +19,22 @@ ob_start(); echo "*** Testing session_set_save_handler() : inheritance ***\n"; class MySession3 extends SessionHandler { - public $i = 0; - public function open($path, $name) { - ++$this->i; - return parent::open($path, $name); - } - public function read($key) { - ++$this->i; - return parent::read($key); - } + public $i = 0; + public function open($path, $name) { + ++$this->i; + return parent::open($path, $name); + } + public function read($key) { + ++$this->i; + return parent::read($key); + } } class MySession4 extends MySession3 { - public function write($id, $data) { - $this->i = "hai"; - return parent::write($id, $data); - } + public function write($id, $data) { + $this->i = "hai"; + return parent::write($id, $data); + } } $handler = new MySession3; diff --git a/ext/session/tests/session_set_save_handler_class_005.phpt b/ext/session/tests/session_set_save_handler_class_005.phpt index bada7f52c5..c6f8dfe622 100644 --- a/ext/session/tests/session_set_save_handler_class_005.phpt +++ b/ext/session/tests/session_set_save_handler_class_005.phpt @@ -20,15 +20,15 @@ ob_start(); echo "*** Testing session_set_save_handler() : incomplete implementation ***\n"; class MySession6 extends SessionHandler { - public function open($path, $name) { - // don't call parent - return true; - } - - public function read($id) { - // should error because parent::open hasn't been called - return parent::read($id); - } + public function open($path, $name) { + // don't call parent + return true; + } + + public function read($id) { + // should error because parent::open hasn't been called + return parent::read($id); + } } $handler = new MySession6; diff --git a/ext/session/tests/session_set_save_handler_class_006.phpt b/ext/session/tests/session_set_save_handler_class_006.phpt index 3f86437207..5b7d3be084 100644 --- a/ext/session/tests/session_set_save_handler_class_006.phpt +++ b/ext/session/tests/session_set_save_handler_class_006.phpt @@ -19,19 +19,19 @@ ob_start(); echo "*** Testing session_set_save_handler() : using objects in close ***\n"; class MySession7_Foo { - public $state = 'ok'; - function __destruct() { - $this->state = 'destroyed'; - } + public $state = 'ok'; + function __destruct() { + $this->state = 'destroyed'; + } } class MySession7 extends SessionHandler { - public $foo; - public function close() { - var_dump($this->foo); - @var_dump($GLOBALS['bar']); - return parent::close(); - } + public $foo; + public function close() { + var_dump($this->foo); + @var_dump($GLOBALS['bar']); + return parent::close(); + } } $bar = new MySession7_Foo; diff --git a/ext/session/tests/session_set_save_handler_class_007.phpt b/ext/session/tests/session_set_save_handler_class_007.phpt index 0416a894c6..b2ad9eee34 100644 --- a/ext/session/tests/session_set_save_handler_class_007.phpt +++ b/ext/session/tests/session_set_save_handler_class_007.phpt @@ -19,28 +19,28 @@ ob_start(); echo "*** Testing session_set_save_handler() : manual shutdown, reopen ***\n"; class MySession extends SessionHandler { - public $num; - public function __construct($num) { - $this->num = $num; - echo "(#$this->num) constructor called\n"; - } - public function __destruct() { - echo "(#$this->num) destructor called\n"; - } - public function finish() { - $id = session_id(); - echo "(#$this->num) finish called $id\n"; - session_write_close(); - } - public function write($id, $data) { - echo "(#$this->num) writing $id = $data\n"; - return parent::write($id, $data); - } - public function close() { - $id = session_id(); - echo "(#$this->num) closing $id\n"; - return parent::close(); - } + public $num; + public function __construct($num) { + $this->num = $num; + echo "(#$this->num) constructor called\n"; + } + public function __destruct() { + echo "(#$this->num) destructor called\n"; + } + public function finish() { + $id = session_id(); + echo "(#$this->num) finish called $id\n"; + session_write_close(); + } + public function write($id, $data) { + echo "(#$this->num) writing $id = $data\n"; + return parent::write($id, $data); + } + public function close() { + $id = session_id(); + echo "(#$this->num) closing $id\n"; + return parent::close(); + } } $handler = new MySession(1); diff --git a/ext/session/tests/session_set_save_handler_class_008.phpt b/ext/session/tests/session_set_save_handler_class_008.phpt index da9611a8c7..1d39fbd535 100644 --- a/ext/session/tests/session_set_save_handler_class_008.phpt +++ b/ext/session/tests/session_set_save_handler_class_008.phpt @@ -19,28 +19,28 @@ ob_start(); echo "*** Testing session_set_save_handler() : manual shutdown ***\n"; class MySession extends SessionHandler { - public $num; - public function __construct($num) { - $this->num = $num; - echo "(#$this->num) constructor called\n"; - } - public function __destruct() { - echo "(#$this->num) destructor called\n"; - } - public function finish() { - $id = session_id(); - echo "(#$this->num) finish called $id\n"; - session_write_close(); - } - public function write($id, $data) { - echo "(#$this->num) writing $id = $data\n"; - return parent::write($id, $data); - } - public function close() { - $id = session_id(); - echo "(#$this->num) closing $id\n"; - return parent::close(); - } + public $num; + public function __construct($num) { + $this->num = $num; + echo "(#$this->num) constructor called\n"; + } + public function __destruct() { + echo "(#$this->num) destructor called\n"; + } + public function finish() { + $id = session_id(); + echo "(#$this->num) finish called $id\n"; + session_write_close(); + } + public function write($id, $data) { + echo "(#$this->num) writing $id = $data\n"; + return parent::write($id, $data); + } + public function close() { + $id = session_id(); + echo "(#$this->num) closing $id\n"; + return parent::close(); + } } $handler = new MySession(1); diff --git a/ext/session/tests/session_set_save_handler_class_009.phpt b/ext/session/tests/session_set_save_handler_class_009.phpt index d878450540..6969542251 100644 --- a/ext/session/tests/session_set_save_handler_class_009.phpt +++ b/ext/session/tests/session_set_save_handler_class_009.phpt @@ -19,28 +19,28 @@ ob_start(); echo "*** Testing session_set_save_handler() : implicit shutdown ***\n"; class MySession extends SessionHandler { - public $num; - public function __construct($num) { - $this->num = $num; - echo "(#$this->num) constructor called\n"; - } - public function __destruct() { - echo "(#$this->num) destructor called\n"; - } - public function finish() { - $id = session_id(); - echo "(#$this->num) finish called $id\n"; - $this->shutdown(); - } - public function write($id, $data) { - echo "(#$this->num) writing $id = $data\n"; - return parent::write($id, $data); - } - public function close() { - $id = session_id(); - echo "(#$this->num) closing $id\n"; - return parent::close(); - } + public $num; + public function __construct($num) { + $this->num = $num; + echo "(#$this->num) constructor called\n"; + } + public function __destruct() { + echo "(#$this->num) destructor called\n"; + } + public function finish() { + $id = session_id(); + echo "(#$this->num) finish called $id\n"; + $this->shutdown(); + } + public function write($id, $data) { + echo "(#$this->num) writing $id = $data\n"; + return parent::write($id, $data); + } + public function close() { + $id = session_id(); + echo "(#$this->num) closing $id\n"; + return parent::close(); + } } $handler = new MySession(1); diff --git a/ext/session/tests/session_set_save_handler_class_010.phpt b/ext/session/tests/session_set_save_handler_class_010.phpt index 2424a08d68..8734f71f9f 100644 --- a/ext/session/tests/session_set_save_handler_class_010.phpt +++ b/ext/session/tests/session_set_save_handler_class_010.phpt @@ -19,28 +19,28 @@ ob_start(); echo "*** Testing session_set_save_handler() : manual shutdown function ***\n"; class MySession extends SessionHandler { - public $num; - public function __construct($num) { - $this->num = $num; - echo "(#$this->num) constructor called\n"; - } - public function __destruct() { - echo "(#$this->num) destructor called\n"; - } - public function finish() { - $id = session_id(); - echo "(#$this->num) finish called $id\n"; - session_write_close(); - } - public function write($id, $data) { - echo "(#$this->num) writing $id = $data\n"; - return parent::write($id, $data); - } - public function close() { - $id = session_id(); - echo "(#$this->num) closing $id\n"; - return parent::close(); - } + public $num; + public function __construct($num) { + $this->num = $num; + echo "(#$this->num) constructor called\n"; + } + public function __destruct() { + echo "(#$this->num) destructor called\n"; + } + public function finish() { + $id = session_id(); + echo "(#$this->num) finish called $id\n"; + session_write_close(); + } + public function write($id, $data) { + echo "(#$this->num) writing $id = $data\n"; + return parent::write($id, $data); + } + public function close() { + $id = session_id(); + echo "(#$this->num) closing $id\n"; + return parent::close(); + } } $handler = new MySession(1); diff --git a/ext/session/tests/session_set_save_handler_class_011.phpt b/ext/session/tests/session_set_save_handler_class_011.phpt index 05a84a359a..396bdbc59f 100644 --- a/ext/session/tests/session_set_save_handler_class_011.phpt +++ b/ext/session/tests/session_set_save_handler_class_011.phpt @@ -19,33 +19,33 @@ ob_start(); echo "*** Testing session_set_save_handler() : shutdown failure ***\n"; class MySession extends SessionHandler { - public $num; - public $destroyed = false; - public function __construct($num) { - $this->num = $num; - echo "(#$this->num) constructor called\n"; - } - public function __destruct() { - echo "(#$this->num) destructor called\n"; - $this->destroyed = true; - } - public function write($id, $data) { - if ($this->destroyed) { - echo "(#$this->num) destroyed, cannot write\n"; - } else { - echo "(#$this->num) writing $id = $data\n"; - } - return parent::write($id, $data); - } - public function close() { - $id = session_id(); - if ($this->destroyed) { - echo "(#$this->num) destroyed, cannot write\n"; - } else { - echo "(#$this->num) closing $id\n"; - } - return parent::close(); - } + public $num; + public $destroyed = false; + public function __construct($num) { + $this->num = $num; + echo "(#$this->num) constructor called\n"; + } + public function __destruct() { + echo "(#$this->num) destructor called\n"; + $this->destroyed = true; + } + public function write($id, $data) { + if ($this->destroyed) { + echo "(#$this->num) destroyed, cannot write\n"; + } else { + echo "(#$this->num) writing $id = $data\n"; + } + return parent::write($id, $data); + } + public function close() { + $id = session_id(); + if ($this->destroyed) { + echo "(#$this->num) destroyed, cannot write\n"; + } else { + echo "(#$this->num) closing $id\n"; + } + return parent::close(); + } } $handler = new MySession(1); diff --git a/ext/session/tests/session_set_save_handler_class_012.phpt b/ext/session/tests/session_set_save_handler_class_012.phpt index bbf125bc9a..f81207d2a7 100644 --- a/ext/session/tests/session_set_save_handler_class_012.phpt +++ b/ext/session/tests/session_set_save_handler_class_012.phpt @@ -20,19 +20,19 @@ ob_start(); echo "*** Testing session_set_save_handler() : incorrect arguments for existing handler open ***\n"; class MySession extends SessionHandler { - public $i = 0; - public function open($path, $name) { - ++$this->i; - echo 'Open ', session_id(), "\n"; - // This test was written for broken return value handling - // Mimmick what was actually being tested by returning true here - return (null === parent::open()); - } - public function read($key) { - ++$this->i; - echo 'Read ', session_id(), "\n"; - return parent::read($key); - } + public $i = 0; + public function open($path, $name) { + ++$this->i; + echo 'Open ', session_id(), "\n"; + // This test was written for broken return value handling + // Mimmick what was actually being tested by returning true here + return (null === parent::open()); + } + public function read($key) { + ++$this->i; + echo 'Read ', session_id(), "\n"; + return parent::read($key); + } } $oldHandler = ini_get('session.save_handler'); diff --git a/ext/session/tests/session_set_save_handler_class_013.phpt b/ext/session/tests/session_set_save_handler_class_013.phpt index 79c732f30c..886d6440a7 100644 --- a/ext/session/tests/session_set_save_handler_class_013.phpt +++ b/ext/session/tests/session_set_save_handler_class_013.phpt @@ -19,20 +19,20 @@ ob_start(); echo "*** Testing session_set_save_handler() : incorrect arguments for existing handler close ***\n"; class MySession extends SessionHandler { - public $i = 0; - public function open($path, $name) { - ++$this->i; - echo 'Open ', session_id(), "\n"; - return parent::open($path, $name); - } - public function read($key) { - ++$this->i; - echo 'Read ', session_id(), "\n"; - return parent::read($key); - } - public function close() { - return parent::close(false); - } + public $i = 0; + public function open($path, $name) { + ++$this->i; + echo 'Open ', session_id(), "\n"; + return parent::open($path, $name); + } + public function read($key) { + ++$this->i; + echo 'Read ', session_id(), "\n"; + return parent::read($key); + } + public function close() { + return parent::close(false); + } } $oldHandler = ini_get('session.save_handler'); diff --git a/ext/session/tests/session_set_save_handler_class_016.phpt b/ext/session/tests/session_set_save_handler_class_016.phpt index eadfead304..03bb8eaf95 100644 --- a/ext/session/tests/session_set_save_handler_class_016.phpt +++ b/ext/session/tests/session_set_save_handler_class_016.phpt @@ -19,44 +19,44 @@ ob_start(); echo "*** Testing session_set_save_handler() function: class with create_sid ***\n"; class MySession2 extends SessionHandler { - public $path; - - public function open($path, $name) { - if (!$path) { - $path = sys_get_temp_dir(); - } - $this->path = $path . '/u_sess_' . $name; - return true; - } - - public function close() { - return true; - } - - public function read($id) { - return (string)@file_get_contents($this->path . $id); - } - - public function write($id, $data) { - return (bool)file_put_contents($this->path . $id, $data); - } - - public function destroy($id) { - @unlink($this->path . $id); - } - - public function gc($maxlifetime) { - foreach (glob($this->path . '*') as $filename) { - if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); - } - } - return true; - } - - public function create_sid() { - return parent::create_sid(); - } + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return (string)@file_get_contents($this->path . $id); + } + + public function write($id, $data) { + return (bool)file_put_contents($this->path . $id, $data); + } + + public function destroy($id) { + @unlink($this->path . $id); + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } + + public function create_sid() { + return parent::create_sid(); + } } $handler = new MySession2; diff --git a/ext/session/tests/session_set_save_handler_class_017.phpt b/ext/session/tests/session_set_save_handler_class_017.phpt index 456ea55dff..563d86c013 100644 --- a/ext/session/tests/session_set_save_handler_class_017.phpt +++ b/ext/session/tests/session_set_save_handler_class_017.phpt @@ -19,44 +19,44 @@ ob_start(); echo "*** Testing session_set_save_handler() function: class with create_sid ***\n"; class MySession2 extends SessionHandler { - public $path; - - public function open($path, $name) { - if (!$path) { - $path = sys_get_temp_dir(); - } - $this->path = $path . '/u_sess_' . $name; - return true; - } - - public function close() { - return true; - } - - public function read($id) { - return (string)@file_get_contents($this->path . $id); - } - - public function write($id, $data) { - return (bool)file_put_contents($this->path . $id, $data); - } - - public function destroy($id) { - @unlink($this->path . $id); - } - - public function gc($maxlifetime) { - foreach (glob($this->path . '*') as $filename) { - if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); - } - } - return true; - } - - public function create_sid() { - return pathinfo(__FILE__)['filename']; - } + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return (string)@file_get_contents($this->path . $id); + } + + public function write($id, $data) { + return (bool)file_put_contents($this->path . $id, $data); + } + + public function destroy($id) { + @unlink($this->path . $id); + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } + + public function create_sid() { + return pathinfo(__FILE__)['filename']; + } } $handler = new MySession2; diff --git a/ext/session/tests/session_set_save_handler_class_018.phpt b/ext/session/tests/session_set_save_handler_class_018.phpt index 7336b4ae88..30d72b4708 100644 --- a/ext/session/tests/session_set_save_handler_class_018.phpt +++ b/ext/session/tests/session_set_save_handler_class_018.phpt @@ -19,48 +19,48 @@ ob_start(); echo "*** Testing session_set_save_handler() function: class with validate_sid ***\n"; class MySession2 extends SessionHandler { - public $path; - - public function open($path, $name) { - if (!$path) { - $path = sys_get_temp_dir(); - } - $this->path = $path . '/u_sess_' . $name; - return true; - } - - public function close() { - return true; - } - - public function read($id) { - return (string)@file_get_contents($this->path . $id); - } - - public function write($id, $data) { - return file_put_contents($this->path . $id, $data)===FALSE ? FALSE : TRUE ; - } - - public function destroy($id) { - @unlink($this->path . $id); - } - - public function gc($maxlifetime) { - foreach (glob($this->path . '*') as $filename) { - if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); - } - } - return true; - } - - public function create_sid() { - return pathinfo(__FILE__)['filename']; - } - - public function validate_sid($id) { - return pathinfo(__FILE__)['filename']===$id; - } + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return (string)@file_get_contents($this->path . $id); + } + + public function write($id, $data) { + return file_put_contents($this->path . $id, $data)===FALSE ? FALSE : TRUE ; + } + + public function destroy($id) { + @unlink($this->path . $id); + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } + + public function create_sid() { + return pathinfo(__FILE__)['filename']; + } + + public function validate_sid($id) { + return pathinfo(__FILE__)['filename']===$id; + } } $handler = new MySession2; diff --git a/ext/session/tests/session_set_save_handler_iface_001.phpt b/ext/session/tests/session_set_save_handler_iface_001.phpt index 362ad90dd6..c1981c91b0 100644 --- a/ext/session/tests/session_set_save_handler_iface_001.phpt +++ b/ext/session/tests/session_set_save_handler_iface_001.phpt @@ -19,45 +19,45 @@ ob_start(); echo "*** Testing session_set_save_handler() function: interface ***\n"; class MySession2 implements SessionHandlerInterface { - public $path; - - public function open($path, $name) { - if (!$path) { - $path = sys_get_temp_dir(); - } - $this->path = $path . '/u_sess_' . $name; - return true; - } - - public function close() { - return true; - } - - public function read($id) { - return (string)@file_get_contents($this->path . $id); - } - - public function write($id, $data) { - return (bool)file_put_contents($this->path . $id, $data); - } - - public function destroy($id) { - @unlink($this->path . $id); - } - - public function gc($maxlifetime) { - foreach (glob($this->path . '*') as $filename) { - if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); - } - } - return true; - } + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return (string)@file_get_contents($this->path . $id); + } + + public function write($id, $data) { + return (bool)file_put_contents($this->path . $id, $data); + } + + public function destroy($id) { + @unlink($this->path . $id); + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } } $handler = new MySession2; session_set_save_handler(array($handler, 'open'), array($handler, 'close'), - array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc')); + array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc')); session_start(); $_SESSION['foo'] = "hello"; diff --git a/ext/session/tests/session_set_save_handler_iface_002.phpt b/ext/session/tests/session_set_save_handler_iface_002.phpt index cf01d8badb..cd8f6af9d9 100644 --- a/ext/session/tests/session_set_save_handler_iface_002.phpt +++ b/ext/session/tests/session_set_save_handler_iface_002.phpt @@ -19,61 +19,61 @@ ob_start(); echo "*** Testing session_set_save_handler() function: interface wrong ***\n"; interface MySessionHandlerInterface { - public function open($path, $name); - public function close(); - public function read($id); - public function write($id, $data); - public function destroy($id); - public function gc($maxlifetime); + public function open($path, $name); + public function close(); + public function read($id); + public function write($id, $data); + public function destroy($id); + public function gc($maxlifetime); } class MySession2 implements MySessionHandlerInterface { - public $path; - - public function open($path, $name) { - if (!$path) { - $path = sys_get_temp_dir(); - } - $this->path = $path . '/u_sess_' . $name; - return true; - } - - public function close() { - return true; - } - - public function read($id) { - return (string)@file_get_contents($this->path . $id); - } - - public function write($id, $data) { - echo "Unsupported session handler in use\n"; - } - - public function destroy($id) { - @unlink($this->path . $id); - } - - public function gc($maxlifetime) { - foreach (glob($this->path . '*') as $filename) { - if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); - } - } - return true; - } + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return (string)@file_get_contents($this->path . $id); + } + + public function write($id, $data) { + echo "Unsupported session handler in use\n"; + } + + public function destroy($id) { + @unlink($this->path . $id); + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } } function good_write($id, $data) { - global $handler; - echo "good handler writing\n"; - return file_put_contents($handler->path . $id, $data); + global $handler; + echo "good handler writing\n"; + return file_put_contents($handler->path . $id, $data); } $handler = new MySession2; $ret = session_set_save_handler(array($handler, 'open'), array($handler, 'close'), - array($handler, 'read'), 'good_write', array($handler, 'destroy'), array($handler, 'gc')); + array($handler, 'read'), 'good_write', array($handler, 'destroy'), array($handler, 'gc')); var_dump($ret); try { diff --git a/ext/session/tests/session_set_save_handler_iface_003.phpt b/ext/session/tests/session_set_save_handler_iface_003.phpt index 40474cb72e..61714e0bb3 100644 --- a/ext/session/tests/session_set_save_handler_iface_003.phpt +++ b/ext/session/tests/session_set_save_handler_iface_003.phpt @@ -19,45 +19,45 @@ ob_start(); echo "*** Testing session_set_save_handler() function: id interface ***\n"; class MySession2 implements SessionHandlerInterface, SessionIdInterface { - public $path; - - public function open($path, $name) { - if (!$path) { - $path = sys_get_temp_dir(); - } - $this->path = $path . '/u_sess_' . $name; - return true; - } - - public function close() { - return true; - } - - public function read($id) { - return (string)@file_get_contents($this->path . $id); - } - - public function write($id, $data) { - // Empty $data = 0 = false - return (bool)file_put_contents($this->path . $id, $data); - } - - public function destroy($id) { - @unlink($this->path . $id); - } - - public function gc($maxlifetime) { - foreach (glob($this->path . '*') as $filename) { - if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); - } - } - return true; - } - - public function create_sid() { - return pathinfo(__FILE__)['filename']; - } + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return (string)@file_get_contents($this->path . $id); + } + + public function write($id, $data) { + // Empty $data = 0 = false + return (bool)file_put_contents($this->path . $id, $data); + } + + public function destroy($id) { + @unlink($this->path . $id); + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } + + public function create_sid() { + return pathinfo(__FILE__)['filename']; + } } $handler = new MySession2; diff --git a/ext/session/tests/session_set_save_handler_sid_001.phpt b/ext/session/tests/session_set_save_handler_sid_001.phpt index bd8c18424f..d4097158ed 100644 --- a/ext/session/tests/session_set_save_handler_sid_001.phpt +++ b/ext/session/tests/session_set_save_handler_sid_001.phpt @@ -13,50 +13,50 @@ ob_start(); echo "*** Testing session_set_save_handler() function: create_sid ***\n"; class MySession2 { - public $path; + public $path; - public function open($path, $name) { - if (!$path) { - $path = sys_get_temp_dir(); - } - $this->path = $path . '/u_sess_' . $name; - return true; - } + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } - public function close() { - return true; - } + public function close() { + return true; + } - public function read($id) { - return (string)@file_get_contents($this->path . $id); - } + public function read($id) { + return (string)@file_get_contents($this->path . $id); + } - public function write($id, $data) { - // Empty $data = 0 = false - return (bool)file_put_contents($this->path . $id, $data); - } + public function write($id, $data) { + // Empty $data = 0 = false + return (bool)file_put_contents($this->path . $id, $data); + } - public function destroy($id) { - @unlink($this->path . $id); - } + public function destroy($id) { + @unlink($this->path . $id); + } - public function gc($maxlifetime) { - foreach (glob($this->path . '*') as $filename) { - if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); - } - } - return true; - } + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } - public function create_sid() { - return pathinfo(__FILE__)['filename']; - } + public function create_sid() { + return pathinfo(__FILE__)['filename']; + } } $handler = new MySession2; session_set_save_handler(array($handler, 'open'), array($handler, 'close'), - array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid')); + array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid')); session_start(); $_SESSION['foo'] = "hello"; diff --git a/ext/session/tests/session_set_save_handler_sid_002.phpt b/ext/session/tests/session_set_save_handler_sid_002.phpt index 76ffb63991..faa7663655 100644 --- a/ext/session/tests/session_set_save_handler_sid_002.phpt +++ b/ext/session/tests/session_set_save_handler_sid_002.phpt @@ -14,49 +14,49 @@ ob_start(); echo "*** Testing session_set_save_handler() function: create_sid ***\n"; class MySession2 { - public $path; - - public function open($path, $name) { - if (!$path) { - $path = sys_get_temp_dir(); - } - $this->path = $path . '/u_sess_' . $name; - return true; - } - - public function close() { - return true; - } - - public function read($id) { - return @file_get_contents($this->path . $id); - } - - public function write($id, $data) { - return file_put_contents($this->path . $id, $data); - } - - public function destroy($id) { - @unlink($this->path . $id); - } - - public function gc($maxlifetime) { - foreach (glob($this->path . '*') as $filename) { - if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); - } - } - return true; - } - - public function create_sid() { - return null; - } + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return @file_get_contents($this->path . $id); + } + + public function write($id, $data) { + return file_put_contents($this->path . $id, $data); + } + + public function destroy($id) { + @unlink($this->path . $id); + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } + + public function create_sid() { + return null; + } } $handler = new MySession2; session_set_save_handler(array($handler, 'open'), array($handler, 'close'), - array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid')); + array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid')); session_start(); $_SESSION['foo'] = "hello"; diff --git a/ext/session/tests/session_set_save_handler_variation4.phpt b/ext/session/tests/session_set_save_handler_variation4.phpt index bf74385839..abe3abbeb2 100644 --- a/ext/session/tests/session_set_save_handler_variation4.phpt +++ b/ext/session/tests/session_set_save_handler_variation4.phpt @@ -23,9 +23,9 @@ ob_start(); echo "*** Testing session_set_save_handler() : variation ***\n"; function noisy_gc($maxlifetime) { - echo("GC [".$maxlifetime."]\n"); - echo gc($maxlifetime)." deleted\n"; - return true; + echo("GC [".$maxlifetime."]\n"); + echo gc($maxlifetime)." deleted\n"; + return true; } require_once "save_handler.inc"; diff --git a/ext/session/tests/session_set_save_handler_variation5.phpt b/ext/session/tests/session_set_save_handler_variation5.phpt index 23847aadf4..ad11729b94 100644 --- a/ext/session/tests/session_set_save_handler_variation5.phpt +++ b/ext/session/tests/session_set_save_handler_variation5.phpt @@ -22,9 +22,9 @@ ob_start(); */ function noisy_gc($maxlifetime) { - echo("GC [".$maxlifetime."]\n"); - echo gc($maxlifetime)." deleted\n"; - return true; + echo("GC [".$maxlifetime."]\n"); + echo gc($maxlifetime)." deleted\n"; + return true; } echo "*** Testing session_set_save_handler() : variation ***\n"; diff --git a/ext/session/tests/skipif.inc b/ext/session/tests/skipif.inc index e63f963c5c..c259d9eaca 100644 --- a/ext/session/tests/skipif.inc +++ b/ext/session/tests/skipif.inc @@ -9,17 +9,17 @@ if (!extension_loaded("session")) { } $save_path = ini_get("session.save_path"); if ($save_path) { - if (!file_exists($save_path)) { - die("skip Session save_path doesn't exist"); - } + if (!file_exists($save_path)) { + die("skip Session save_path doesn't exist"); + } - if ($save_path && !@is_writable($save_path)) { - if (($p = strpos($save_path, ';')) !== false) { - $save_path = substr($save_path, ++$p); - } - if (!@is_writable($save_path)) { - die("skip session.save_path $save_path is not writable\n"); - } - } + if ($save_path && !@is_writable($save_path)) { + if (($p = strpos($save_path, ';')) !== false) { + $save_path = substr($save_path, ++$p); + } + if (!@is_writable($save_path)) { + die("skip session.save_path $save_path is not writable\n"); + } + } } ?> diff --git a/ext/shmop/tests/001.phpt b/ext/shmop/tests/001.phpt index 471f82cbda..48e722d2f0 100644 --- a/ext/shmop/tests/001.phpt +++ b/ext/shmop/tests/001.phpt @@ -8,73 +8,73 @@ shmop extension test ?> --FILE-- <?php - $hex_shm_id = 0xff3; - $write_d1 = "test #1 of the shmop() extension"; - $write_d2 = "test #2 append data to shared memory segment"; + $hex_shm_id = 0xff3; + $write_d1 = "test #1 of the shmop() extension"; + $write_d2 = "test #2 append data to shared memory segment"; - echo "shm open for create: "; - $shm_id = shmop_open($hex_shm_id, "n", 0644, 1024); - if (!$shm_id) { - die("failed\n"); - } else { - echo "ok\n"; - } + echo "shm open for create: "; + $shm_id = shmop_open($hex_shm_id, "n", 0644, 1024); + if (!$shm_id) { + die("failed\n"); + } else { + echo "ok\n"; + } - echo "shm size is: " . ($shm_size = shmop_size($shm_id)) . "\n"; + echo "shm size is: " . ($shm_size = shmop_size($shm_id)) . "\n"; - echo "shm write test #1: "; - $written = shmop_write($shm_id, $write_d1, 0); - if ($written != strlen($write_d1)) { - echo "failed\n"; - } else { - echo "ok\n"; - } + echo "shm write test #1: "; + $written = shmop_write($shm_id, $write_d1, 0); + if ($written != strlen($write_d1)) { + echo "failed\n"; + } else { + echo "ok\n"; + } - echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n"; + echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n"; - shmop_close($shm_id); + shmop_close($shm_id); - echo "shm open for read only: "; - $shm_id = shmop_open($hex_shm_id, "a", 0644, 1024); - if (!$shm_id) { - echo "failed\n"; - } else { - echo "ok\n"; - } + echo "shm open for read only: "; + $shm_id = shmop_open($hex_shm_id, "a", 0644, 1024); + if (!$shm_id) { + echo "failed\n"; + } else { + echo "ok\n"; + } - echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n"; + echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n"; - /* try to append data to the shared memory segment, this should fail */ - shmop_write($shm_id, $write_d1, $written); + /* try to append data to the shared memory segment, this should fail */ + shmop_write($shm_id, $write_d1, $written); - shmop_close($shm_id); + shmop_close($shm_id); - echo "shm open for read only: "; - $shm_id = shmop_open($hex_shm_id, "w", 0644, 1024); - if (!$shm_id) { - echo "failed\n"; - } else { - echo "ok\n"; - } + echo "shm open for read only: "; + $shm_id = shmop_open($hex_shm_id, "w", 0644, 1024); + if (!$shm_id) { + echo "failed\n"; + } else { + echo "ok\n"; + } - echo "shm write test #1: "; - $written = shmop_write($shm_id, $write_d2, $written); - if ($written != strlen($write_d2)) { - die("failed\n"); - } else { - echo "ok\n"; - } + echo "shm write test #1: "; + $written = shmop_write($shm_id, $write_d2, $written); + if ($written != strlen($write_d2)) { + die("failed\n"); + } else { + echo "ok\n"; + } - echo "data in memory is: " . shmop_read($shm_id, 0, strlen($write_d1 . $write_d2)) . "\n"; + echo "data in memory is: " . shmop_read($shm_id, 0, strlen($write_d1 . $write_d2)) . "\n"; - echo "deletion of shm segment: "; - if (!shmop_delete($shm_id)) { - echo "failed\n"; - } else { - echo "ok\n"; - } + echo "deletion of shm segment: "; + if (!shmop_delete($shm_id)) { + echo "failed\n"; + } else { + echo "ok\n"; + } - shmop_close($shm_id); + shmop_close($shm_id); ?> --EXPECTF-- shm open for create: ok diff --git a/ext/shmop/tests/002.phpt b/ext/shmop/tests/002.phpt index 12b1b6b95f..c69c79391f 100644 --- a/ext/shmop/tests/002.phpt +++ b/ext/shmop/tests/002.phpt @@ -13,39 +13,39 @@ edgarsandi - <edgar.r.sandi@gmail.com> ?> --FILE-- <?php - $hex_shm_id = function(){ - return mt_rand(1338, 9999); - }; + $hex_shm_id = function(){ + return mt_rand(1338, 9999); + }; echo PHP_EOL, '## shmop_open function tests ##'; - // warning outputs: invalid flag when the flags length != 1 - var_dump(shmop_open($hex_shm_id(), '', 0644, 1024)); + // warning outputs: invalid flag when the flags length != 1 + var_dump(shmop_open($hex_shm_id(), '', 0644, 1024)); - // warning outputs: invalid access mode - var_dump(shmop_open($hex_shm_id(), 'b', 0644, 1024)); + // warning outputs: invalid access mode + var_dump(shmop_open($hex_shm_id(), 'b', 0644, 1024)); - // warning outputs: unable to attach or create shared memory segment - var_dump(shmop_open(null, 'a', 0644, 1024)); + // warning outputs: unable to attach or create shared memory segment + var_dump(shmop_open(null, 'a', 0644, 1024)); - // warning outputs: Shared memory segment size must be greater than zero - var_dump(shmop_open($hex_shm_id(), "c", 0666, 0)); + // warning outputs: Shared memory segment size must be greater than zero + var_dump(shmop_open($hex_shm_id(), "c", 0666, 0)); echo PHP_EOL, '## shmop_read function tests ##'; - // warning outputs: start is out of range - $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024); - var_dump(shmop_read($shm_id, -10, 0)); - shmop_delete($shm_id); + // warning outputs: start is out of range + $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024); + var_dump(shmop_read($shm_id, -10, 0)); + shmop_delete($shm_id); - // warning outputs: count is out of range - $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024); - var_dump(shmop_read($shm_id, 0, -10)); - shmop_delete($shm_id); + // warning outputs: count is out of range + $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024); + var_dump(shmop_read($shm_id, 0, -10)); + shmop_delete($shm_id); echo PHP_EOL, '## shmop_write function tests ##'; - // warning outputs: offset out of range - $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024); - var_dump(shmop_write($shm_id, 'text to try write', -10)); - shmop_delete($shm_id); + // warning outputs: offset out of range + $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024); + var_dump(shmop_write($shm_id, 'text to try write', -10)); + shmop_delete($shm_id); ?> --EXPECTF-- ## shmop_open function tests ## diff --git a/ext/simplexml/tests/000.phpt b/ext/simplexml/tests/000.phpt index f777c67275..453865ef34 100644 --- a/ext/simplexml/tests/000.phpt +++ b/ext/simplexml/tests/000.phpt @@ -9,12 +9,12 @@ $sxe = simplexml_load_file(__DIR__.'/000.xml'); function test($what) { - global $sxe; - echo "===$what\n"; - eval("var_dump(isset(\$$what));"); - eval("var_dump((bool)\$$what);"); - eval("if (isset(\$$what)) var_dump(count(\$$what));"); - eval("var_dump(\$$what);"); + global $sxe; + echo "===$what\n"; + eval("var_dump(isset(\$$what));"); + eval("var_dump((bool)\$$what);"); + eval("if (isset(\$$what)) var_dump(count(\$$what));"); + eval("var_dump(\$$what);"); } test('sxe'); diff --git a/ext/simplexml/tests/006.phpt b/ext/simplexml/tests/006.phpt index 19df52c450..5798e913c0 100644 --- a/ext/simplexml/tests/006.phpt +++ b/ext/simplexml/tests/006.phpt @@ -34,29 +34,29 @@ EOF ); foreach($sxe as $name => $data) { - var_dump($name); - var_dump(trim($data)); + var_dump($name); + var_dump(trim($data)); } echo "===CLONE===\n"; foreach(clone $sxe as $name => $data) { - var_dump($name); - var_dump(trim($data)); + var_dump($name); + var_dump(trim($data)); } echo "===ELEMENT===\n"; foreach($sxe->elem11 as $name => $data) { - var_dump($name); - var_dump(trim($data)); + var_dump($name); + var_dump(trim($data)); } echo "===COMMENT===\n"; foreach($sxe->elem1 as $name => $data) { - var_dump($name); - var_dump(trim($data)); + var_dump($name); + var_dump(trim($data)); } ?> diff --git a/ext/simplexml/tests/009.phpt b/ext/simplexml/tests/009.phpt index 696580d49e..4b2e685c36 100644 --- a/ext/simplexml/tests/009.phpt +++ b/ext/simplexml/tests/009.phpt @@ -29,9 +29,9 @@ $sxe = simplexml_load_string(<<<EOF EOF ); foreach($sxe->children() as $name=>$val) { - var_dump($name); - var_dump(get_class($val)); - var_dump(trim($val)); + var_dump($name); + var_dump(get_class($val)); + var_dump(trim($val)); } ?> --EXPECT-- diff --git a/ext/simplexml/tests/019.phpt b/ext/simplexml/tests/019.phpt index b2406e0991..47bb9aa571 100644 --- a/ext/simplexml/tests/019.phpt +++ b/ext/simplexml/tests/019.phpt @@ -34,29 +34,29 @@ EOF ); foreach($sxe->children() as $name => $data) { - var_dump($name); - var_dump(trim($data)); + var_dump($name); + var_dump(trim($data)); } echo "===CLONE===\n"; foreach(clone $sxe->children() as $name => $data) { - var_dump($name); - var_dump(trim($data)); + var_dump($name); + var_dump(trim($data)); } echo "===ELEMENT===\n"; foreach($sxe->elem11->children() as $name => $data) { - var_dump($name); - var_dump(trim($data)); + var_dump($name); + var_dump(trim($data)); } echo "===COMMENT===\n"; foreach($sxe->elem1->children() as $name => $data) { - var_dump($name); - var_dump(trim($data)); + var_dump($name); + var_dump(trim($data)); } ?> diff --git a/ext/simplexml/tests/021.phpt b/ext/simplexml/tests/021.phpt index e1355fd5ed..ac5a589e9b 100644 --- a/ext/simplexml/tests/021.phpt +++ b/ext/simplexml/tests/021.phpt @@ -8,10 +8,10 @@ SimpleXML: Element check $ok = 1; $doc = simplexml_load_string('<root><exists>foo</exists></root>'); if(!isset($doc->exists)) { - $ok *= 0; + $ok *= 0; } if(isset($doc->doesnotexist)) { - $ok *= 0; + $ok *= 0; } if ($ok) { print "Works\n"; diff --git a/ext/simplexml/tests/022.phpt b/ext/simplexml/tests/022.phpt index 58222e8a68..de4663fd41 100644 --- a/ext/simplexml/tests/022.phpt +++ b/ext/simplexml/tests/022.phpt @@ -21,8 +21,8 @@ var_dump($sxe->content->file); echo "===FOREACH===\n"; foreach($sxe->content->file as $file) { - var_dump($file); - var_dump($file['glob']); + var_dump($file); + var_dump($file['glob']); } ?> diff --git a/ext/simplexml/tests/024.phpt b/ext/simplexml/tests/024.phpt index 789b99a648..2c52ddbc91 100644 --- a/ext/simplexml/tests/024.phpt +++ b/ext/simplexml/tests/024.phpt @@ -18,10 +18,10 @@ $sxe = simplexml_load_string($xml); function test($xpath) { - global $sxe; + global $sxe; - echo "===$xpath===\n"; - var_dump($sxe->xpath($xpath)); + echo "===$xpath===\n"; + var_dump($sxe->xpath($xpath)); } test('elem/@attr2'); diff --git a/ext/simplexml/tests/029.phpt b/ext/simplexml/tests/029.phpt index 41d00d80d3..2b9193bc4b 100644 --- a/ext/simplexml/tests/029.phpt +++ b/ext/simplexml/tests/029.phpt @@ -20,9 +20,9 @@ $people = simplexml_load_string($xml); foreach($people as $person) { - var_dump((string)$person['name']); - var_dump(count($people)); - var_dump(count($person)); + var_dump((string)$person['name']); + var_dump(count($people)); + var_dump(count($person)); } ?> diff --git a/ext/simplexml/tests/030.phpt b/ext/simplexml/tests/030.phpt index 417c5a7f11..7bd8a03491 100644 --- a/ext/simplexml/tests/030.phpt +++ b/ext/simplexml/tests/030.phpt @@ -5,7 +5,7 @@ SimpleXML: isset and unset by offset --FILE-- <?php $xml =<<<EOF -<root s:att1="b" att1="a" +<root s:att1="b" att1="a" xmlns:s="urn::test" xmlns:t="urn::test-t"> <child1>test</child1> <child1>test 2</child1> diff --git a/ext/simplexml/tests/031.phpt b/ext/simplexml/tests/031.phpt index c26cad0637..c370f9ad18 100644 --- a/ext/simplexml/tests/031.phpt +++ b/ext/simplexml/tests/031.phpt @@ -5,7 +5,7 @@ SimpleXML: addChild and addAttribute --FILE-- <?php $xml =<<<EOF -<root s:att1="b" att1="a" +<root s:att1="b" att1="a" xmlns:s="urn::test" xmlns:t="urn::test-t"> <child1>test</child1> <child1>test 2</child1> diff --git a/ext/simplexml/tests/SimpleXMLElement_addAttribute_basic.phpt b/ext/simplexml/tests/SimpleXMLElement_addAttribute_basic.phpt index 52f6222eea..8c512c6252 100644 --- a/ext/simplexml/tests/SimpleXMLElement_addAttribute_basic.phpt +++ b/ext/simplexml/tests/SimpleXMLElement_addAttribute_basic.phpt @@ -4,11 +4,11 @@ SimpleXMLElement->addAttribute() <?php if (!extension_loaded("simplexml")) die("skip"); ?> --FILE-- <?php - $simple = simplexml_load_file(__DIR__."/book.xml"); - $simple->addAttribute('type','novels'); + $simple = simplexml_load_file(__DIR__."/book.xml"); + $simple->addAttribute('type','novels'); - var_dump($simple->attributes()); - echo "Done"; + var_dump($simple->attributes()); + echo "Done"; ?> --EXPECT-- object(SimpleXMLElement)#2 (1) { diff --git a/ext/simplexml/tests/bug24392.phpt b/ext/simplexml/tests/bug24392.phpt index 08d73c630d..0a0c16b9a9 100644 --- a/ext/simplexml/tests/bug24392.phpt +++ b/ext/simplexml/tests/bug24392.phpt @@ -6,7 +6,7 @@ Bug #24392 (empty namespaces causing confusion) <?php $s = simplexml_load_file(__DIR__.'/bug24392.xml'); foreach ($s->item as $item) { - echo $item->title . "\n"; + echo $item->title . "\n"; } ?> --EXPECT-- diff --git a/ext/simplexml/tests/bug37565.phpt b/ext/simplexml/tests/bug37565.phpt index 41ecbd3e27..53508dc9b6 100644 --- a/ext/simplexml/tests/bug37565.phpt +++ b/ext/simplexml/tests/bug37565.phpt @@ -6,7 +6,7 @@ Bug #37565 (Using reflection::export with simplexml causing a crash) <?php function my_error_handler($errno, $errstr, $errfile, $errline) { - echo "Error: $errstr\n"; + echo "Error: $errstr\n"; } set_error_handler('my_error_handler'); @@ -16,15 +16,15 @@ class Setting extends ReflectionObject } try { - Reflection::export(simplexml_load_string('<test/>', 'Setting')); + Reflection::export(simplexml_load_string('<test/>', 'Setting')); } catch (Error $e) { - my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); + my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); } try { - Reflection::export(simplexml_load_file('data:,<test/>', 'Setting')); + Reflection::export(simplexml_load_file('data:,<test/>', 'Setting')); } catch (Error $e) { - my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); + my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); } ?> diff --git a/ext/simplexml/tests/bug38354.phpt b/ext/simplexml/tests/bug38354.phpt index c1147c5d09..9554280177 100644 --- a/ext/simplexml/tests/bug38354.phpt +++ b/ext/simplexml/tests/bug38354.phpt @@ -12,7 +12,7 @@ $xml = simplexml_load_string( ); foreach ($xml->xpath("//*") as $element) { - var_dump($element->asXML()); + var_dump($element->asXML()); } echo "Done\n"; diff --git a/ext/simplexml/tests/bug40451.phpt b/ext/simplexml/tests/bug40451.phpt index dfecc25d1f..7cb01c031f 100644 --- a/ext/simplexml/tests/bug40451.phpt +++ b/ext/simplexml/tests/bug40451.phpt @@ -7,9 +7,9 @@ Bug #40451 (addAttribute() may crash when used with non-existent child node) $string = <<<XML <?xml version="1.0"?> - <Host enable="true"> - <Name>host.server.com</Name> - </Host> + <Host enable="true"> + <Name>host.server.com</Name> + </Host> XML; $xml = simplexml_load_string($string); diff --git a/ext/simplexml/tests/bug41861.phpt b/ext/simplexml/tests/bug41861.phpt index 50c780f9ab..f87c061449 100644 --- a/ext/simplexml/tests/bug41861.phpt +++ b/ext/simplexml/tests/bug41861.phpt @@ -6,11 +6,11 @@ Bug #41861 (getNamespaces() returns the namespaces of a node's siblings) <?php $xml = simplexml_load_string('<root> - <first_node_no_ns /> - <ns1:node1 xmlns:ns1="#ns1" /> - <ns2:node2 xmlns:ns2="#ns2" /> - <ns3:node3 xmlns:ns3="#ns3" /> - <last_node_no_ns /> + <first_node_no_ns /> + <ns1:node1 xmlns:ns1="#ns1" /> + <ns2:node2 xmlns:ns2="#ns2" /> + <ns3:node3 xmlns:ns3="#ns3" /> + <last_node_no_ns /> </root>'); $name = $xml->getName(); @@ -21,13 +21,13 @@ echo "root(non-recursive): '$name' -- namespaces: ", implode(', ', $namespaces), foreach (array(null, '#ns1', '#ns2', '#ns3') as $ns) { - foreach ($xml->children($ns) as $child) - { - $name = $child->getName(); - $namespaces = $child->getNamespaces(false); + foreach ($xml->children($ns) as $child) + { + $name = $child->getName(); + $namespaces = $child->getNamespaces(false); - echo "children($ns): '$name' -- namespaces: ", implode(', ', $namespaces), "\n"; - } + echo "children($ns): '$name' -- namespaces: ", implode(', ', $namespaces), "\n"; + } } ?> --EXPECT-- diff --git a/ext/simplexml/tests/bug51615.phpt b/ext/simplexml/tests/bug51615.phpt index b935414b80..d5759b21fc 100644 --- a/ext/simplexml/tests/bug51615.phpt +++ b/ext/simplexml/tests/bug51615.phpt @@ -14,7 +14,7 @@ $html = simplexml_import_dom($dom); var_dump($html->body->span); foreach ($html->body->span as $obj) { - var_dump((string)$obj->title); + var_dump((string)$obj->title); } ?> diff --git a/ext/simplexml/tests/bug69169.phpt b/ext/simplexml/tests/bug69169.phpt index 08cf299290..ff0d0e9410 100644 --- a/ext/simplexml/tests/bug69169.phpt +++ b/ext/simplexml/tests/bug69169.phpt @@ -8,12 +8,12 @@ if (!extension_loaded("simplexml")) die("skip SimpleXML not available"); <?php $a = '<?xml version="1.0" encoding="UTF-8"?> <root a="b"> - <row b="y"> - <item s="t" /> - </row> - <row p="c"> - <item y="n" /> - </row> + <row b="y"> + <item s="t" /> + </row> + <row p="c"> + <item y="n" /> + </row> </root>'; $b = str_replace(array("\n", "\r", "\t"), "", $a); $simple_xml = simplexml_load_string($b); diff --git a/ext/simplexml/tests/bug72588.phpt b/ext/simplexml/tests/bug72588.phpt index f32ec25104..1f17695054 100644 --- a/ext/simplexml/tests/bug72588.phpt +++ b/ext/simplexml/tests/bug72588.phpt @@ -13,16 +13,16 @@ $dummy = &$tpnb; $xmlStruct = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <templates> - <object type="obj_1" label="Label for object 1"></object> - <object type="obj_2" label="Label for object 2"></object> - <object type="obj_3" label="Label for object 3"></object> - <object type="obj_4" label="Label for object 4"></object> - <object type="obj_5" label="Label for object 5"></object> - <object type="obj_6" label="Label for object 6"></object> - <object type="obj_7" label="Label for object 7"></object> - <object type="obj_8" label="Label for object 8"></object> - <object type="obj_9" label="Label for object 9"></object> - <object type="obj_10" label="Label for object 10"></object> + <object type="obj_1" label="Label for object 1"></object> + <object type="obj_2" label="Label for object 2"></object> + <object type="obj_3" label="Label for object 3"></object> + <object type="obj_4" label="Label for object 4"></object> + <object type="obj_5" label="Label for object 5"></object> + <object type="obj_6" label="Label for object 6"></object> + <object type="obj_7" label="Label for object 7"></object> + <object type="obj_8" label="Label for object 8"></object> + <object type="obj_9" label="Label for object 9"></object> + <object type="obj_10" label="Label for object 10"></object> </templates> EOF; $tplxml = simplexml_load_string($xmlStruct); diff --git a/ext/simplexml/tests/profile02.phpt b/ext/simplexml/tests/profile02.phpt index f2e952bc36..1ec0894d3b 100644 --- a/ext/simplexml/tests/profile02.phpt +++ b/ext/simplexml/tests/profile02.phpt @@ -12,7 +12,7 @@ $root = simplexml_load_string('<?xml version="1.0"?> '); foreach ($root->child as $child) { - echo "$child "; + echo "$child "; } echo "\n---Done---\n"; ?> diff --git a/ext/simplexml/tests/profile12.phpt b/ext/simplexml/tests/profile12.phpt index e52dc5f3d1..973508d777 100644 --- a/ext/simplexml/tests/profile12.phpt +++ b/ext/simplexml/tests/profile12.phpt @@ -8,15 +8,15 @@ SimpleXML [profile]: Accessing namespaced root and non namespaced children $xml =<<<EOF <?xml version="1.0" encoding="utf-8"?> <soap:Envelope -xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" -xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <soap:Body> <businessList foo="bar"> <businessInfo businessKey="bla"/> </businessList> -</soap:Body> +</soap:Body> </soap:Envelope> EOF; diff --git a/ext/simplexml/tests/profile13.phpt b/ext/simplexml/tests/profile13.phpt index 2e692fbcd3..80aad0f453 100644 --- a/ext/simplexml/tests/profile13.phpt +++ b/ext/simplexml/tests/profile13.phpt @@ -8,15 +8,15 @@ SimpleXML [profile]: Accessing by namespace prefix $xml =<<<EOF <?xml version="1.0" encoding="utf-8"?> <soap:Envelope -xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" -xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <soap:Body> <businessList foo="bar"> <businessInfo businessKey="bla"/> </businessList> -</soap:Body> +</soap:Body> </soap:Envelope> EOF; diff --git a/ext/simplexml/tests/simplexml_import_dom.phpt b/ext/simplexml/tests/simplexml_import_dom.phpt index 02fbcdb4dd..82c80e81bc 100644 --- a/ext/simplexml/tests/simplexml_import_dom.phpt +++ b/ext/simplexml/tests/simplexml_import_dom.phpt @@ -14,7 +14,7 @@ if(!$dom) { $s = simplexml_import_dom($dom); $books = $s->book; foreach ($books as $book) { - echo "{$book->title} was written by {$book->author}\n"; + echo "{$book->title} was written by {$book->author}\n"; } ?> --EXPECT-- diff --git a/ext/simplexml/tests/simplexml_load_file.phpt b/ext/simplexml/tests/simplexml_load_file.phpt index 50ee4e9033..80a2a09550 100644 --- a/ext/simplexml/tests/simplexml_load_file.phpt +++ b/ext/simplexml/tests/simplexml_load_file.phpt @@ -4,10 +4,10 @@ simplexml_load_file() <?php if (!extension_loaded("simplexml")) die("skip"); ?> --FILE-- <?php - $simple = simplexml_load_file(__DIR__."/book.xml"); + $simple = simplexml_load_file(__DIR__."/book.xml"); - var_dump($simple); - echo "Done"; + var_dump($simple); + echo "Done"; ?> --EXPECT-- object(SimpleXMLElement)#1 (1) { diff --git a/ext/simplexml/tests/sxe_002.phpt b/ext/simplexml/tests/sxe_002.phpt index eeff0ee215..b3f1b242df 100644 --- a/ext/simplexml/tests/sxe_002.phpt +++ b/ext/simplexml/tests/sxe_002.phpt @@ -38,9 +38,9 @@ EOF; $sxe = simplexml_load_string($xml, 'SimpleXMLIterator'); foreach(new RecursiveIteratorIterator($sxe, 1) as $name => $data) { - var_dump($name); - var_dump(get_class($data)); - var_dump(trim($data)); + var_dump($name); + var_dump(get_class($data)); + var_dump(trim($data)); } echo "===DUMP===\n"; diff --git a/ext/simplexml/tests/sxe_003.phpt b/ext/simplexml/tests/sxe_003.phpt index 36ad9b6dcb..37a4e554d2 100644 --- a/ext/simplexml/tests/sxe_003.phpt +++ b/ext/simplexml/tests/sxe_003.phpt @@ -38,22 +38,22 @@ EOF; $sxe = simplexml_load_string($xml, 'SimpleXMLIterator'); foreach($sxe->getChildren() as $name => $data) { - var_dump($name); - var_dump(get_class($data)); - var_dump(trim($data)); + var_dump($name); + var_dump(get_class($data)); + var_dump(trim($data)); } echo "===RESET===\n"; for ($sxe->rewind(); $sxe->valid(); $sxe->next()) { - var_dump($sxe->hasChildren()); - var_dump(trim($sxe->key())); - var_dump(trim($sxe->current())); - foreach($sxe->getChildren() as $name => $data) { - var_dump($name); - var_dump(get_class($data)); - var_dump(trim($data)); - } + var_dump($sxe->hasChildren()); + var_dump(trim($sxe->key())); + var_dump(trim($sxe->current())); + foreach($sxe->getChildren() as $name => $data) { + var_dump($name); + var_dump(get_class($data)); + var_dump(trim($data)); + } } ?> diff --git a/ext/simplexml/tests/sxe_004.phpt b/ext/simplexml/tests/sxe_004.phpt index 7f06b1918f..5e103cba5b 100644 --- a/ext/simplexml/tests/sxe_004.phpt +++ b/ext/simplexml/tests/sxe_004.phpt @@ -37,49 +37,49 @@ EOF; class SXETest extends SimpleXMLIterator { - function rewind() - { - echo __METHOD__ . "\n"; - return parent::rewind(); - } - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - function next() - { - echo __METHOD__ . "\n"; - return parent::next(); - } - function hasChildren() - { - echo __METHOD__ . "\n"; - return parent::hasChildren(); - } - function getChildren() - { - echo __METHOD__ . "\n"; - return parent::getChildren(); - } + function rewind() + { + echo __METHOD__ . "\n"; + return parent::rewind(); + } + function valid() + { + echo __METHOD__ . "\n"; + return parent::valid(); + } + function current() + { + echo __METHOD__ . "\n"; + return parent::current(); + } + function key() + { + echo __METHOD__ . "\n"; + return parent::key(); + } + function next() + { + echo __METHOD__ . "\n"; + return parent::next(); + } + function hasChildren() + { + echo __METHOD__ . "\n"; + return parent::hasChildren(); + } + function getChildren() + { + echo __METHOD__ . "\n"; + return parent::getChildren(); + } } $sxe = new SXETest($xml); $rit = new RecursiveIteratorIterator($sxe, RecursiveIteratorIterator::SELF_FIRST); foreach($rit as $data) { - var_dump(get_class($data)); - var_dump(trim($data)); + var_dump(get_class($data)); + var_dump(trim($data)); } ?> diff --git a/ext/simplexml/tests/sxe_005.phpt b/ext/simplexml/tests/sxe_005.phpt index e1714489d3..59fe1d2f9c 100644 --- a/ext/simplexml/tests/sxe_005.phpt +++ b/ext/simplexml/tests/sxe_005.phpt @@ -19,11 +19,11 @@ EOF; class SXETest extends SimpleXMLIterator { - function count() - { - echo __METHOD__ . "\n"; - return parent::count(); - } + function count() + { + echo __METHOD__ . "\n"; + return parent::count(); + } } $sxe = new SXETest($xml); diff --git a/ext/snmp/tests/bug60749.phpt b/ext/snmp/tests/bug60749.phpt index 1ada8102c4..b12aa37614 100644 --- a/ext/snmp/tests/bug60749.phpt +++ b/ext/snmp/tests/bug60749.phpt @@ -13,14 +13,14 @@ require_once(__DIR__.'/snmp_include.inc'); $hostname = "php.net"; $ip = gethostbyname($hostname); if (ip2long($ip) === FALSE) { - echo "Could not resolve $hostname properly!\n"; - exit(1); + echo "Could not resolve $hostname properly!\n"; + exit(1); } $port = 1161; $session = new SNMP(SNMP::VERSION_1, "$hostname:$port", $community, $timeout, $retries); $info = $session->info; if (strcmp($info["hostname"], "$ip:$port") !== 0) { - echo "'" . $info["hostname"] . "' != '$ip:$port'\n"; + echo "'" . $info["hostname"] . "' != '$ip:$port'\n"; } var_dump($session->close()); ?> diff --git a/ext/snmp/tests/skipif.inc b/ext/snmp/tests/skipif.inc index ac623c350d..f3fe225e5d 100644 --- a/ext/snmp/tests/skipif.inc +++ b/ext/snmp/tests/skipif.inc @@ -9,4 +9,4 @@ require_once (dirname(__FILE__).'/snmp_include.inc'); //string $object_id [, int $timeout [, int $retries ]] ) if (@snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout) === false) - die('skip NO SNMPD on this host or community invalid'); + die('skip NO SNMPD on this host or community invalid'); diff --git a/ext/snmp/tests/snmp-object-error.phpt b/ext/snmp/tests/snmp-object-error.phpt index 299a76350d..606a8cf7b0 100644 --- a/ext/snmp/tests/snmp-object-error.phpt +++ b/ext/snmp/tests/snmp-object-error.phpt @@ -15,40 +15,40 @@ snmp_set_quick_print(false); snmp_set_valueretrieval(SNMP_VALUE_PLAIN); try { - var_dump(new SNMP(SNMP::VERSION_1, $hostname)); + var_dump(new SNMP(SNMP::VERSION_1, $hostname)); } catch (TypeError $e) { - print $e->getMessage() . "\n"; + print $e->getMessage() . "\n"; } try { - var_dump(new SNMP(SNMP::VERSION_1, $hostname, $community, '')); + var_dump(new SNMP(SNMP::VERSION_1, $hostname, $community, '')); } catch (TypeError $e) { - print $e->getMessage() . "\n"; + print $e->getMessage() . "\n"; } try { - var_dump(new SNMP(SNMP::VERSION_1, $hostname, $community, $timeout, '')); + var_dump(new SNMP(SNMP::VERSION_1, $hostname, $community, $timeout, '')); } catch (TypeError $e) { - print $e->getMessage() . "\n"; + print $e->getMessage() . "\n"; } try { - var_dump(new SNMP(7, $hostname, $community)); + var_dump(new SNMP(7, $hostname, $community)); } catch (Exception $e) { - print $e->getMessage() . "\n"; + print $e->getMessage() . "\n"; } echo "Exception handling\n"; $session = new SNMP(SNMP::VERSION_3, $hostname, $user_noauth, $timeout, $retries); try { - var_dump($session->get('.1.3.6.1.2.1.1.1..0')); + var_dump($session->get('.1.3.6.1.2.1.1.1..0')); } catch (SNMPException $e) { - var_dump($e->getCode()); - var_dump($e->getMessage()); + var_dump($e->getCode()); + var_dump($e->getMessage()); } $session->exceptions_enabled = SNMP::ERRNO_ANY; try { - var_dump($session->get('.1.3.6.1.2.1.1.1..0')); + var_dump($session->get('.1.3.6.1.2.1.1.1..0')); } catch (SNMPException $e) { - var_dump($e->getCode()); - var_dump($e->getMessage()); + var_dump($e->getCode()); + var_dump($e->getMessage()); } var_dump($session->close()); diff --git a/ext/snmp/tests/snmp-object.phpt b/ext/snmp/tests/snmp-object.phpt index 4f22b452f0..22a77947b1 100644 --- a/ext/snmp/tests/snmp-object.phpt +++ b/ext/snmp/tests/snmp-object.phpt @@ -35,7 +35,7 @@ $session = new SNMP(SNMP::VERSION_2c, $hostname, $community, $timeout, $retries) $orig = array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.5.0'); $result = $session->get($orig, TRUE); foreach($orig as $oid){ - var_dump($result[$oid]); + var_dump($result[$oid]); } var_dump($session->close()); diff --git a/ext/snmp/tests/snmp3.phpt b/ext/snmp/tests/snmp3.phpt index 68c14d058f..91f563df90 100644 --- a/ext/snmp/tests/snmp3.phpt +++ b/ext/snmp/tests/snmp3.phpt @@ -20,13 +20,13 @@ echo "GET single: noAuthNoPriv\n"; var_dump(snmp3_get($hostname, $user_noauth, 'noAuthNoPriv', '', '', '', '', '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); foreach(array('MD5', 'SHA') as $signalg) { - echo "GET single: $signalg\n"; - var_dump(snmp3_get($hostname, $user_auth_prefix . $signalg, 'authNoPriv', $signalg, $auth_pass, '', '', '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); + echo "GET single: $signalg\n"; + var_dump(snmp3_get($hostname, $user_auth_prefix . $signalg, 'authNoPriv', $signalg, $auth_pass, '', '', '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); } foreach(array('AES', 'DES', 'AES128') as $chipher) { - echo "GET single: MD5/$chipher\n"; - var_dump(snmp3_get($hostname, $user_auth_prefix . 'MD5' . $chipher, 'authPriv', 'MD5', $auth_pass, $chipher, $priv_pass, '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); + echo "GET single: MD5/$chipher\n"; + var_dump(snmp3_get($hostname, $user_auth_prefix . 'MD5' . $chipher, 'authPriv', 'MD5', $auth_pass, $chipher, $priv_pass, '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); } $username = $user_auth_prefix . 'MD5'; echo "GET multiple\n"; diff --git a/ext/snmp/tests/snmp_include.inc b/ext/snmp/tests/snmp_include.inc index d14de3effe..b31384f7cf 100644 --- a/ext/snmp/tests/snmp_include.inc +++ b/ext/snmp/tests/snmp_include.inc @@ -18,9 +18,9 @@ $timeout = getenv('SNMP_TIMEOUT') ?: -1; $retries = getenv('SNMP_RETRIES') ?: 1; if (stristr(PHP_OS, "FreeBSD")) { - $mibdir = getenv('SNMP_MIBDIR') ?: "/usr/local/share/snmp/mibs"; + $mibdir = getenv('SNMP_MIBDIR') ?: "/usr/local/share/snmp/mibs"; } else { - $mibdir = getenv('SNMP_MIBDIR') ?: "/usr/share/snmp/mibs"; + $mibdir = getenv('SNMP_MIBDIR') ?: "/usr/share/snmp/mibs"; } diff --git a/ext/soap/tests/any.phpt b/ext/soap/tests/any.phpt index d84443b06f..af9696bf51 100644 --- a/ext/soap/tests/any.phpt +++ b/ext/soap/tests/any.phpt @@ -17,15 +17,15 @@ class SOAPComplexType { $struct = new SOAPComplexType('arg',34,325.325); function echoAnyElement($x) { - global $g; + global $g; - $g = $x; - $struct = $x->inputAny->any["SOAPComplexType"]; - if ($struct instanceof SOAPComplexType) { - return array("return" => array("any" => array("SOAPComplexType"=>new SoapVar($struct, SOAP_ENC_OBJECT, "SOAPComplexType", "http://soapinterop.org/xsd", "SOAPComplexType", "http://soapinterop.org/")))); - } else { - return "?"; - } + $g = $x; + $struct = $x->inputAny->any["SOAPComplexType"]; + if ($struct instanceof SOAPComplexType) { + return array("return" => array("any" => array("SOAPComplexType"=>new SoapVar($struct, SOAP_ENC_OBJECT, "SOAPComplexType", "http://soapinterop.org/xsd", "SOAPComplexType", "http://soapinterop.org/")))); + } else { + return "?"; + } } class TestSoapClient extends SoapClient { diff --git a/ext/soap/tests/bug46760.phpt b/ext/soap/tests/bug46760.phpt index 95cb58867f..f591e1b3d6 100644 --- a/ext/soap/tests/bug46760.phpt +++ b/ext/soap/tests/bug46760.phpt @@ -8,9 +8,9 @@ Bug #46760 (SoapClient doRequest fails when proxy is used) $client = new SoapClient(null, array('proxy_host' => "localhost", 'proxy_port' => '8080', 'login' => "user", - 'password' => "test", - 'uri' => 'mo:http://www.w3.org/', - 'location' => 'http://some.url')); + 'password' => "test", + 'uri' => 'mo:http://www.w3.org/', + 'location' => 'http://some.url')); var_dump($client->_proxy_port); ?> diff --git a/ext/soap/tests/bug48557.phpt b/ext/soap/tests/bug48557.phpt index aa20c14610..e4c4e89342 100644 --- a/ext/soap/tests/bug48557.phpt +++ b/ext/soap/tests/bug48557.phpt @@ -9,7 +9,7 @@ ini_set('display_errors', 1); ini_set("soap.wsdl_cache_enabled", 0); function test($map) { - var_dump($map, $map[1], $map[2]);die; + var_dump($map, $map[1], $map[2]);die; } $y = new SoapServer(__DIR__ . '/bug48557.wsdl'); @@ -17,36 +17,36 @@ $y->addfunction("test"); $request = <<<XML <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test-uri/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> - <SOAP-ENV:Body> - <ns1:test> - <testParam xsi:type="ns2:Map"> - <item> - <key xsi:type="xsd:int">1</key> - <value xsi:type="xsd:int">123</value> - </item> - <item> - <key xsi:type="xsd:int">-1000</key> - <value xsi:type="xsd:string">123</value> - </item> - <item> - <key xsi:type="xsd:string">2</key> - <value xsi:type="xsd:float">123.5</value> - </item> - <item> - <key xsi:type="xsd:string">-2000</key> - <value xsi:type="xsd:float">123.5</value> - </item> - <item> - <key xsi:type="xsd:string">011</key> - <value xsi:type="xsd:float">123.5</value> - </item> - <item> - <key xsi:type="xsd:int">012</key> - <value xsi:type="xsd:float">123.5</value> - </item> - </testParam> - </ns1:test> - </SOAP-ENV:Body> + <SOAP-ENV:Body> + <ns1:test> + <testParam xsi:type="ns2:Map"> + <item> + <key xsi:type="xsd:int">1</key> + <value xsi:type="xsd:int">123</value> + </item> + <item> + <key xsi:type="xsd:int">-1000</key> + <value xsi:type="xsd:string">123</value> + </item> + <item> + <key xsi:type="xsd:string">2</key> + <value xsi:type="xsd:float">123.5</value> + </item> + <item> + <key xsi:type="xsd:string">-2000</key> + <value xsi:type="xsd:float">123.5</value> + </item> + <item> + <key xsi:type="xsd:string">011</key> + <value xsi:type="xsd:float">123.5</value> + </item> + <item> + <key xsi:type="xsd:int">012</key> + <value xsi:type="xsd:float">123.5</value> + </item> + </testParam> + </ns1:test> + </SOAP-ENV:Body> </SOAP-ENV:Envelope> XML; diff --git a/ext/soap/tests/bug69137.phpt b/ext/soap/tests/bug69137.phpt index 9160b91c25..d34ba13e3e 100644 --- a/ext/soap/tests/bug69137.phpt +++ b/ext/soap/tests/bug69137.phpt @@ -26,9 +26,9 @@ $client = new SoapClient($testServiceWsdl); unset($client); $parameters = [ - 'proxy_host' => $proxyHost, - 'proxy_port' => $proxyPort, - 'trace' => 1, + 'proxy_host' => $proxyHost, + 'proxy_port' => $proxyPort, + 'trace' => 1, ]; $client = new SoapClient($testServiceWsdl, $parameters); @@ -39,7 +39,7 @@ $lookup->ipAddress = '72.52.91.14'; $result = $client->ResolveIP($lookup); if ($result && is_object($result) && $result->ResolveIPResult && is_object($result->ResolveIPResult)) { - print "successful lookup"; + print "successful lookup"; } ?> --EXPECT-- diff --git a/ext/soap/tests/bug70388.phpt b/ext/soap/tests/bug70388.phpt index 6c0d1081de..fc67de1142 100644 --- a/ext/soap/tests/bug70388.phpt +++ b/ext/soap/tests/bug70388.phpt @@ -6,10 +6,10 @@ Bug #70388 (SOAP serialize_function_call() type confusion / RCE) <?php $dummy = unserialize('O:10:"SoapClient":3:{s:3:"uri";s:1:"X";s:8:"location";s:22:"http://localhost/a.xml";s:17:"__default_headers";a:1:{i:1;s:1337:"'.str_repeat("X", 1337).'";}}'); try { - var_dump($dummy->notexisting()); + var_dump($dummy->notexisting()); } catch(Exception $e) { - var_dump($e->getMessage()); - var_dump(get_class($e)); + var_dump($e->getMessage()); + var_dump(get_class($e)); } ?> --EXPECTF-- diff --git a/ext/soap/tests/bug70875.phpt b/ext/soap/tests/bug70875.phpt index 6f10462bfc..86a16697ce 100644 --- a/ext/soap/tests/bug70875.phpt +++ b/ext/soap/tests/bug70875.phpt @@ -9,19 +9,19 @@ soap.wsdl_cache_enabled=0 class bug70875 extends SOAPClient { - public function __doRequest($request, $location, $action, $version, $one_way = 0) - { - die("no SIGSEGV"); - } + public function __doRequest($request, $location, $action, $version, $one_way = 0) + { + die("no SIGSEGV"); + } } $c = new bug70875(__DIR__.'/bug70875.wsdl', [ - 'trace' => 1, - 'classmap' => [ - 'TestService' => 'TestService', - 'TestServiceRQ' => 'TestServiceRQ', - 'RqHeader' => 'RqHeader', - ], + 'trace' => 1, + 'classmap' => [ + 'TestService' => 'TestService', + 'TestServiceRQ' => 'TestServiceRQ', + 'RqHeader' => 'RqHeader', + ], ]); @@ -32,7 +32,7 @@ class TestService class TestServiceRQ { - public $RqHeader; + public $RqHeader; } class RqHeader diff --git a/ext/soap/tests/bug71610.phpt b/ext/soap/tests/bug71610.phpt index f00d57700a..f88124d50c 100644 --- a/ext/soap/tests/bug71610.phpt +++ b/ext/soap/tests/bug71610.phpt @@ -11,7 +11,7 @@ $exploit = unserialize('O:10:"SoapClient":3:{s:3:"uri";s:1:"a";s:8:"location";s: try { $exploit->blahblah(); } catch(SoapFault $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } ?> --EXPECT-- diff --git a/ext/soap/tests/bug73037.phpt b/ext/soap/tests/bug73037.phpt index dd5b5aa13b..d835f2a280 100644 --- a/ext/soap/tests/bug73037.phpt +++ b/ext/soap/tests/bug73037.phpt @@ -20,46 +20,46 @@ include __DIR__ . "/../../../sapi/cli/tests/php_cli_server.inc"; function get_data($max) { - $piece = "<CD> - <TITLE>Empire Burlesque</TITLE> - <ARTIST>Bob Dylan</ARTIST> - <COUNTRY>USA</COUNTRY> - <COMPANY>Columbia</COMPANY> - <PRICE>10.90</PRICE> - <YEAR>1985</YEAR> - </CD>"; - - $begin = '<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><CATALOG>'; - $end = '</CATALOG></soapenv:Body></soapenv:Envelope>'; - - $min = strlen($begin) + strlen($piece) + strlen($end); - $max = $max < $min ? $min : $max; - - $data = $begin; - $data .= $piece; - while (strlen($data) + strlen($end) < $max) { - /* Randomize a bit, taking gzip in account. */ - $tmp = str_replace( - array( - "Empire Burlesque", - "Bob Dylan", - ), - array( - md5(uniqid()), - sha1(uniqid()), - ), - $piece - ); - - if (strlen($begin) + strlen($tmp) + strlen($end) > $max) { - break; - } - - $data .= $tmp; - } - $data .= $end; - - return $data; + $piece = "<CD> + <TITLE>Empire Burlesque</TITLE> + <ARTIST>Bob Dylan</ARTIST> + <COUNTRY>USA</COUNTRY> + <COMPANY>Columbia</COMPANY> + <PRICE>10.90</PRICE> + <YEAR>1985</YEAR> + </CD>"; + + $begin = '<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><CATALOG>'; + $end = '</CATALOG></soapenv:Body></soapenv:Envelope>'; + + $min = strlen($begin) + strlen($piece) + strlen($end); + $max = $max < $min ? $min : $max; + + $data = $begin; + $data .= $piece; + while (strlen($data) + strlen($end) < $max) { + /* Randomize a bit, taking gzip in account. */ + $tmp = str_replace( + array( + "Empire Burlesque", + "Bob Dylan", + ), + array( + md5(uniqid()), + sha1(uniqid()), + ), + $piece + ); + + if (strlen($begin) + strlen($tmp) + strlen($end) > $max) { + break; + } + + $data .= $tmp; + } + $data .= $end; + + return $data; } $router = "bug73037_server.php"; @@ -74,19 +74,19 @@ PHP; php_cli_server_start($code, $router, $args); foreach (array(1024-1, 1024*8-3, 1024*9+1, 1024*16-1, 1024*32-5, 1024*64+3, 1024*128-7) as $k => $i) { - echo "Iteration $k\n\n"; + echo "Iteration $k\n\n"; - /* with and without compression */ - foreach (array(false, true) as $b) { - $data = get_data($i); - if ($b) { - $data = gzencode($data); - } - $len = strlen($data); + /* with and without compression */ + foreach (array(false, true) as $b) { + $data = get_data($i); + if ($b) { + $data = gzencode($data); + } + $len = strlen($data); - //echo "len=$len\n"; + //echo "len=$len\n"; - $hdrs = <<<HDRS + $hdrs = <<<HDRS POST /bug73037_server.php HTTP/1.1 Content-Type: application/soap+xml; charset=UTF-8 Accept: application/soap+xml, application/dime, multipart/related, text/* @@ -94,41 +94,41 @@ SOAPAction: "urn:adressen#adressen#SetAda" Expect: 100-continue Content-Length: ${len} HDRS; - if ($b) { - $hdrs .="\nContent-Encoding: gzip"; - } - //echo "Headers sent:\n$hdrs\n\n"; - $fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errstr, 5); - if (!$fp) { - die("connect failed"); - } - - if(fwrite($fp, "$hdrs\n\n$data")) { - $out = ""; - while (!feof($fp)) { - $out .= fread($fp, 1024); - } - - $pos = strpos($out, "<env:Text>"); - if (false === $pos) { - echo $out; - goto cleanup; - } - $pos0 = $pos + strlen("<env:Text>"); - $pos = strpos($out, "</env:Text>"); - if (false === $pos) { - echo $out; - goto cleanup; - } - $len = $pos - $pos0; - echo substr($out, $pos0, $len); - } + if ($b) { + $hdrs .="\nContent-Encoding: gzip"; + } + //echo "Headers sent:\n$hdrs\n\n"; + $fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errstr, 5); + if (!$fp) { + die("connect failed"); + } + + if(fwrite($fp, "$hdrs\n\n$data")) { + $out = ""; + while (!feof($fp)) { + $out .= fread($fp, 1024); + } + + $pos = strpos($out, "<env:Text>"); + if (false === $pos) { + echo $out; + goto cleanup; + } + $pos0 = $pos + strlen("<env:Text>"); + $pos = strpos($out, "</env:Text>"); + if (false === $pos) { + echo $out; + goto cleanup; + } + $len = $pos - $pos0; + echo substr($out, $pos0, $len); + } cleanup: - fclose($fp); + fclose($fp); - echo "\n\n"; - } + echo "\n\n"; + } } ?> diff --git a/ext/soap/tests/bug77088.phpt b/ext/soap/tests/bug77088.phpt index e6f5e7582e..17945e136f 100644 --- a/ext/soap/tests/bug77088.phpt +++ b/ext/soap/tests/bug77088.phpt @@ -11,7 +11,7 @@ try { $options = NULL; $sClient = new SoapClient("test.wsdl", $options); -} +} catch(TypeError $e) { var_dump($e); diff --git a/ext/soap/tests/bug77410.phpt b/ext/soap/tests/bug77410.phpt index 2b74102523..4c36e6e9da 100644 --- a/ext/soap/tests/bug77410.phpt +++ b/ext/soap/tests/bug77410.phpt @@ -11,7 +11,7 @@ $client = new class(__DIR__ . '/bug77410.wsdl', [ ]) extends SoapClient { public function __doRequest($request, $location, $action, $version, $one_way = 0) { echo $request, "\n"; - return ''; + return ''; } }; diff --git a/ext/soap/tests/bugs/bug28751.phpt b/ext/soap/tests/bugs/bug28751.phpt index 88187eb109..4b64b62a06 100644 --- a/ext/soap/tests/bugs/bug28751.phpt +++ b/ext/soap/tests/bugs/bug28751.phpt @@ -5,11 +5,11 @@ Bug #28751 (SoapServer does not call _autoload()) --FILE-- <?php spl_autoload_register(function ($className) { - class SoapServerActions { + class SoapServerActions { function test() { return "Hello World"; } - } + } }); $server = new SoapServer(NULL, array('uri'=>"http://testuri.org")); diff --git a/ext/soap/tests/bugs/bug29795.phpt b/ext/soap/tests/bugs/bug29795.phpt index fce064ef43..38d4da3a8d 100644 --- a/ext/soap/tests/bugs/bug29795.phpt +++ b/ext/soap/tests/bugs/bug29795.phpt @@ -14,9 +14,9 @@ class LocalSoapClient extends SoapClient { function __doRequest($request, $location, $action, $version, $one_way = 0) { return <<<EOF -<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" -xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" -xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" +xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Body><Price><Amount>3995</Amount><CurrencyCode>USD</CurrencyCode></Price></SOAP-ENV:Body></SOAP-ENV:Envelope> EOF; } diff --git a/ext/soap/tests/bugs/bug30045.phpt b/ext/soap/tests/bugs/bug30045.phpt index 21889c2fd1..63fbadc639 100644 --- a/ext/soap/tests/bugs/bug30045.phpt +++ b/ext/soap/tests/bugs/bug30045.phpt @@ -42,12 +42,12 @@ $soap = new LocalSoapClient(NULL, array("uri"=>"http://test-uri", "location"=>"t function test($type, $num) { global $soap; try { - printf(" %0.0f\n ", $num); - $ret = $soap->foo($type, new SoapVar($num, $type)); - printf(" %0.0f\n", $ret); - } catch (SoapFault $ex) { - var_dump($ex); - } + printf(" %0.0f\n ", $num); + $ret = $soap->foo($type, new SoapVar($num, $type)); + printf(" %0.0f\n", $ret); + } catch (SoapFault $ex) { + var_dump($ex); + } } /* echo "byte\n"; diff --git a/ext/soap/tests/bugs/bug30106.phpt b/ext/soap/tests/bugs/bug30106.phpt index b02b1bded2..96709d6aa3 100644 --- a/ext/soap/tests/bugs/bug30106.phpt +++ b/ext/soap/tests/bugs/bug30106.phpt @@ -7,25 +7,25 @@ Bug #30106 (SOAP cannot not parse 'ref' element. Causes Uncaught SoapFault excep ini_set("soap.wsdl_cache_enabled", 0); function getContinentList() { - return array("getContinentListResult"=>array( - "schema"=>"<xsd:schema><element name=\"test\" type=\"xsd:string\"/></xsd:schema>", - "any"=>"<test>Hello World!</test><test>Bye World!</test>")); + return array("getContinentListResult"=>array( + "schema"=>"<xsd:schema><element name=\"test\" type=\"xsd:string\"/></xsd:schema>", + "any"=>"<test>Hello World!</test><test>Bye World!</test>")); } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options=array()) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); - $this->server->addFunction("getContinentList"); + $this->server->addFunction("getContinentList"); } function __doRequest($request, $location, $action, $version, $one_way = 0) { - echo $request; + echo $request; ob_start(); $this->server->handle($request); $response = ob_get_contents(); ob_end_clean(); - echo $response; + echo $response; return $response; } } diff --git a/ext/soap/tests/bugs/bug30799.phpt b/ext/soap/tests/bugs/bug30799.phpt index 92fd40f452..81079efbb7 100644 --- a/ext/soap/tests/bugs/bug30799.phpt +++ b/ext/soap/tests/bugs/bug30799.phpt @@ -5,9 +5,9 @@ Bug #30799 (SoapServer doesn't handle private or protected properties) --FILE-- <?php class foo { - public $a="a"; - private $b="b"; - protected $c="c"; + public $a="a"; + private $b="b"; + protected $c="c"; } diff --git a/ext/soap/tests/bugs/bug30928.phpt b/ext/soap/tests/bugs/bug30928.phpt index ace71764f9..89b61cc019 100644 --- a/ext/soap/tests/bugs/bug30928.phpt +++ b/ext/soap/tests/bugs/bug30928.phpt @@ -7,9 +7,9 @@ Bug #30928 (When Using WSDL, SoapServer doesn't handle private or protected prop ini_set("soap.wsdl_cache_enabled", 0); class foo { - public $a="a"; - private $b="b"; - protected $c="c"; + public $a="a"; + private $b="b"; + protected $c="c"; } function test($x) { diff --git a/ext/soap/tests/bugs/bug30994.phpt b/ext/soap/tests/bugs/bug30994.phpt index afd5018a38..d91783cfd0 100644 --- a/ext/soap/tests/bugs/bug30994.phpt +++ b/ext/soap/tests/bugs/bug30994.phpt @@ -7,28 +7,28 @@ Bug #30994 (SOAP server unable to handle request with references) $HTTP_RAW_POST_DATA = <<<EOF <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:tns="http://spock/kunta/kunta" - xmlns:types="http://spock/kunta/kunta/encodedTypes" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" + xmlns:tns="http://spock/kunta/kunta" + xmlns:types="http://spock/kunta/kunta/encodedTypes" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> - <q1:bassCall xmlns:q1="http://spock/bass/types/kunta"> - <system xsi:type="xsd:string">XXX</system> - <function xsi:type="xsd:string">TASKTEST</function> - <parameter href="#id1" /> - </q1:bassCall> + <q1:bassCall xmlns:q1="http://spock/bass/types/kunta"> + <system xsi:type="xsd:string">XXX</system> + <function xsi:type="xsd:string">TASKTEST</function> + <parameter href="#id1" /> + </q1:bassCall> - <soapenc:Array id="id1" soapenc:arrayType="tns:Item[1]"> - <Item href="#id2" /> - </soapenc:Array> + <soapenc:Array id="id1" soapenc:arrayType="tns:Item[1]"> + <Item href="#id2" /> + </soapenc:Array> - <tns:Item id="id2" xsi:type="tns:Item"> - <key xsi:type="xsd:string">ABCabc123</key> - <val xsi:type="xsd:string">123456</val> - </tns:Item> + <tns:Item id="id2" xsi:type="tns:Item"> + <key xsi:type="xsd:string">ABCabc123</key> + <val xsi:type="xsd:string">123456</val> + </tns:Item> </soap:Body> </soap:Envelope> diff --git a/ext/soap/tests/bugs/bug31422.phpt b/ext/soap/tests/bugs/bug31422.phpt index 152781a4ec..c653d5e2f3 100644 --- a/ext/soap/tests/bugs/bug31422.phpt +++ b/ext/soap/tests/bugs/bug31422.phpt @@ -10,8 +10,8 @@ error_log= --FILE-- <?php function Add($x,$y) { - fopen(); - user_error("Hello", E_USER_ERROR); + fopen(); + user_error("Hello", E_USER_ERROR); return $x+$y; } diff --git a/ext/soap/tests/bugs/bug31695.phpt b/ext/soap/tests/bugs/bug31695.phpt index 708d489a0d..abf4168c30 100644 --- a/ext/soap/tests/bugs/bug31695.phpt +++ b/ext/soap/tests/bugs/bug31695.phpt @@ -7,18 +7,18 @@ Bug #31695 (Cannot redefine endpoint when using WSDL) ini_set("soap.wsdl_cache_enabled", 0); function Test($x) { - return $x; + return $x; } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options=array()) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); - $this->server->addFunction("Test"); + $this->server->addFunction("Test"); } function __doRequest($request, $location, $action, $version, $one_way = 0) { - echo "$location\n"; + echo "$location\n"; ob_start(); $this->server->handle($request); $response = ob_get_contents(); diff --git a/ext/soap/tests/bugs/bug32776.phpt b/ext/soap/tests/bugs/bug32776.phpt index 316b0e15ed..978dce877d 100644 --- a/ext/soap/tests/bugs/bug32776.phpt +++ b/ext/soap/tests/bugs/bug32776.phpt @@ -10,8 +10,8 @@ soap.wsdl_cache_enabled=0 $d = null; function test($x) { - global $d; - $d = $x; + global $d; + $d = $x; } class LocalSoapClient extends SoapClient { diff --git a/ext/soap/tests/bugs/bug32941.phpt b/ext/soap/tests/bugs/bug32941.phpt index cbab7008d7..59bd06992b 100644 --- a/ext/soap/tests/bugs/bug32941.phpt +++ b/ext/soap/tests/bugs/bug32941.phpt @@ -6,28 +6,28 @@ Bug #32941 (Sending structured exception kills a php) <?php class TestSoapClient extends SoapClient { function __doRequest($request, $location, $action, $version, $one_way = 0) { - return <<<EOF + return <<<EOF <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <soapenv:Body> - <soapenv:Fault> - <faultcode>soapenv:Server.userException</faultcode> - <faultstring>service.EchoServiceException</faultstring> - <detail> - <service.EchoServiceException xsi:type="ns1:EchoServiceException" xmlns:ns1="urn:service.EchoService"> - <intParameter xsi:type="xsd:int">105</intParameter> - <parameter xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">string param</parameter> - </service.EchoServiceException> - <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">steckovic</ns2:hostname> - </detail> - </soapenv:Fault> - </soapenv:Body> + <soapenv:Body> + <soapenv:Fault> + <faultcode>soapenv:Server.userException</faultcode> + <faultstring>service.EchoServiceException</faultstring> + <detail> + <service.EchoServiceException xsi:type="ns1:EchoServiceException" xmlns:ns1="urn:service.EchoService"> + <intParameter xsi:type="xsd:int">105</intParameter> + <parameter xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">string param</parameter> + </service.EchoServiceException> + <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">steckovic</ns2:hostname> + </detail> + </soapenv:Fault> + </soapenv:Body> </soapenv:Envelope> EOF; - } + } } ini_set("soap.wsdl_cache_enabled", 1); diff --git a/ext/soap/tests/bugs/bug34449.phpt b/ext/soap/tests/bugs/bug34449.phpt index f5766e29bc..f4aa222477 100644 --- a/ext/soap/tests/bugs/bug34449.phpt +++ b/ext/soap/tests/bugs/bug34449.phpt @@ -6,8 +6,8 @@ Bug #34449 (ext/soap: XSD_ANYXML functionality not exposed) <?php class TestSoapClient extends SoapClient { function __doRequest($request, $location, $action, $version, $one_way = 0) { - echo "$request\n"; - exit; + echo "$request\n"; + exit; } } diff --git a/ext/soap/tests/bugs/bug34643.phpt b/ext/soap/tests/bugs/bug34643.phpt index 7430b34474..a4acfa35d6 100644 --- a/ext/soap/tests/bugs/bug34643.phpt +++ b/ext/soap/tests/bugs/bug34643.phpt @@ -9,9 +9,9 @@ soap.wsdl_cache_enabled=0 ini_set("soap.wsdl_cache_enabled", 0); class fp { - public function get_it($opt="zzz") { - return $opt; - } + public function get_it($opt="zzz") { + return $opt; + } } class LocalSoapClient extends SoapClient { diff --git a/ext/soap/tests/bugs/bug34657.phpt b/ext/soap/tests/bugs/bug34657.phpt index 8c182ad7d4..ddf5d2fee0 100644 --- a/ext/soap/tests/bugs/bug34657.phpt +++ b/ext/soap/tests/bugs/bug34657.phpt @@ -7,14 +7,14 @@ require_once('skipif.inc'); --FILE-- <?php try { - $client = new SoapClient('http://i_dont_exist.com/some.wsdl'); - echo "?\n"; + $client = new SoapClient('http://i_dont_exist.com/some.wsdl'); + echo "?\n"; } catch (SoapFault $e) { - echo get_class($e)."\n"; - echo $e->faultstring."\n"; - echo "ok\n"; + echo get_class($e)."\n"; + echo $e->faultstring."\n"; + echo "ok\n"; } catch (Exception $e) { - echo get_class($e)."\n"; + echo get_class($e)."\n"; } ?> --EXPECTF-- diff --git a/ext/soap/tests/bugs/bug35142.phpt b/ext/soap/tests/bugs/bug35142.phpt index f10885767c..840dc8e9a8 100644 --- a/ext/soap/tests/bugs/bug35142.phpt +++ b/ext/soap/tests/bugs/bug35142.phpt @@ -11,8 +11,8 @@ $timestamp = "2005-11-08T11:22:07+03:00"; $wsdl = __DIR__."/bug35142.wsdl"; function PostEvents($x) { - var_dump($x); - exit(); + var_dump($x); + exit(); return $x; } @@ -25,7 +25,7 @@ class TestSoapClient extends SoapClient { } function __doRequest($request, $location, $action, $version, $one_way = 0) { - echo "$request\n"; + echo "$request\n"; $this->server->handle($request); return $response; } @@ -33,10 +33,10 @@ class TestSoapClient extends SoapClient { } $soapClient = new TestSoapClient($wsdl, - array('trace' => 1, 'exceptions' => 0, - 'classmap' => array('logOnEvent' => 'LogOnEvent', - 'logOffEvent' => 'LogOffEvent', - 'events' => 'IVREvents'))); + array('trace' => 1, 'exceptions' => 0, + 'classmap' => array('logOnEvent' => 'LogOnEvent', + 'logOffEvent' => 'LogOffEvent', + 'events' => 'IVREvents'))); $logOnEvent = new LogOnEvent(34567, $timestamp); $logOffEvents[] = new LogOffEvent(34567, $timestamp, "Smoked"); diff --git a/ext/soap/tests/bugs/bug35273.phpt b/ext/soap/tests/bugs/bug35273.phpt index f04dc68646..72c44adbb3 100644 --- a/ext/soap/tests/bugs/bug35273.phpt +++ b/ext/soap/tests/bugs/bug35273.phpt @@ -8,9 +8,9 @@ soap.wsdl_cache_enabled=0 <?php class TestSoapClient extends SoapClient { function __doRequest($request, $location, $action, $version, $one_way = 0) { - echo $request; - exit; - } + echo $request; + exit; + } } ini_set("soap.wsdl_cache_enabled", 0); diff --git a/ext/soap/tests/bugs/bug36226.phpt b/ext/soap/tests/bugs/bug36226.phpt index a54b687f95..5bb3db9fe7 100644 --- a/ext/soap/tests/bugs/bug36226.phpt +++ b/ext/soap/tests/bugs/bug36226.phpt @@ -11,8 +11,8 @@ $timestamp = "2005-11-08T11:22:07+03:00"; $wsdl = __DIR__."/bug35142.wsdl"; function PostEvents($x) { - var_dump($x); - exit(); + var_dump($x); + exit(); return $x; } @@ -25,7 +25,7 @@ class TestSoapClient extends SoapClient { } function __doRequest($request, $location, $action, $version, $one_way = 0) { - echo "$request\n"; + echo "$request\n"; $this->server->handle($request); return $response; } @@ -33,11 +33,11 @@ class TestSoapClient extends SoapClient { } $soapClient = new TestSoapClient($wsdl, - array('trace' => 1, 'exceptions' => 0, - 'classmap' => array('logOnEvent' => 'LogOnEvent', - 'logOffEvent' => 'LogOffEvent', - 'events' => 'IVREvents'), - 'features' => SOAP_SINGLE_ELEMENT_ARRAYS)); + array('trace' => 1, 'exceptions' => 0, + 'classmap' => array('logOnEvent' => 'LogOnEvent', + 'logOffEvent' => 'LogOffEvent', + 'events' => 'IVREvents'), + 'features' => SOAP_SINGLE_ELEMENT_ARRAYS)); $logOnEvent = new LogOnEvent(34567, $timestamp); $logOffEvents[] = new LogOffEvent(34567, $timestamp, "Smoked"); diff --git a/ext/soap/tests/bugs/bug36575.phpt b/ext/soap/tests/bugs/bug36575.phpt index 8e5f469546..dd5a5d99f1 100644 --- a/ext/soap/tests/bugs/bug36575.phpt +++ b/ext/soap/tests/bugs/bug36575.phpt @@ -7,24 +7,24 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php abstract class CT_A1 { - public $var1; + public $var1; } class CT_A2 extends CT_A1 { - public $var2; + public $var2; } class CT_A3 extends CT_A2 { - public $var3; + public $var3; } // returns A2 in WSDL function test( $a1 ) { - $a3 = new CT_A3(); - $a3->var1 = $a1->var1; - $a3->var2 = "var two"; - $a3->var3 = "var three"; - return $a3; + $a3 = new CT_A3(); + $a3->var1 = $a1->var1; + $a3->var2 = "var two"; + $a3->var3 = "var three"; + return $a3; } $classMap = array("A1" => "CT_A1", "A2" => "CT_A2", "A3" => "CT_A3"); diff --git a/ext/soap/tests/bugs/bug36999.phpt b/ext/soap/tests/bugs/bug36999.phpt index 443e90418f..c9d03f57bd 100644 --- a/ext/soap/tests/bugs/bug36999.phpt +++ b/ext/soap/tests/bugs/bug36999.phpt @@ -36,12 +36,12 @@ $soap = new LocalSoapClient(__DIR__."/bug36999.wsdl"); function test($num) { global $soap; try { - printf("%s %0.0f\n", gettype($num), $num); - $ret = $soap->echoLong($num); - printf("%s %0.0f\n", gettype($ret), $ret); - } catch (SoapFault $ex) { - var_dump($ex); - } + printf("%s %0.0f\n", gettype($num), $num); + $ret = $soap->echoLong($num); + printf("%s %0.0f\n", gettype($ret), $ret); + } catch (SoapFault $ex) { + var_dump($ex); + } } test(3706790240); ?> diff --git a/ext/soap/tests/bugs/bug37083.phpt b/ext/soap/tests/bugs/bug37083.phpt index cfd698e4be..89b808eaa1 100644 --- a/ext/soap/tests/bugs/bug37083.phpt +++ b/ext/soap/tests/bugs/bug37083.phpt @@ -7,8 +7,8 @@ soap.wsdl_cache=3 --FILE-- <?php class TestSoapClient extends SoapClient { - function __doRequest($request, $location, $action, $version, $one_way = 0) { - return <<<EOF + function __doRequest($request, $location, $action, $version, $one_way = 0) { + return <<<EOF <?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> @@ -38,19 +38,19 @@ class TestSoapClient extends SoapClient { <multiRef id="id12" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns22:Map" xmlns:ns22="http://xml.apache.org/xml-soap" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><item><key xsi:type="soapenc:string">maxDateTime</key><value soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array"><value xsi:type="xsd:dateTime">2038-12-31T22:59:59.000Z</value></value></item><item><key xsi:type="soapenc:string">minDateTime</key><value soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array"><value xsi:type="xsd:dateTime">2004-11-01T16:58:00.000Z</value></value></item><item><key xsi:type="soapenc:string">minLongitude</key><value soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array"><value xsi:type="soapenc:double">108.11</value></value></item><item><key xsi:type="soapenc:string">maxLongitude</key><value soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array"><value xsi:type="soapenc:double">113.383</value></value></item><item><key xsi:type="soapenc:string">maxLatitude</key><value soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array"><value xsi:type="soapenc:double">-31.666</value></value></item><item><key xsi:type="soapenc:string">minLatitude</key><value soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array"><value xsi:type="soapenc:double">-35.075</value></value></item></multiRef> </soapenv:Body></soapenv:Envelope> EOF; - } + } } for ($i = 0; $i < 10; $i++) { - $ws=new TestSoapClient(__DIR__.'/bug37083.wsdl', + $ws=new TestSoapClient(__DIR__.'/bug37083.wsdl', array('encoding'=>'ISO-8859-1', 'cache_wsdl'=>WSDL_CACHE_BOTH)); - $search=new stdClass(); - $search->queryString='argo'; - $search->ranges[]=$r=new stdClass(); - $r->field='maxDateTime'; - $r->min='2003-04-01'; - $search->index='all'; - $res=$ws->search($search,0,10); + $search=new stdClass(); + $search->queryString='argo'; + $search->ranges[]=$r=new stdClass(); + $r->field='maxDateTime'; + $r->min='2003-04-01'; + $search->index='all'; + $res=$ws->search($search,0,10); } echo "ok\n"; ?> diff --git a/ext/soap/tests/bugs/bug38004.phpt b/ext/soap/tests/bugs/bug38004.phpt index 43d3e86d02..81b8ffc503 100644 --- a/ext/soap/tests/bugs/bug38004.phpt +++ b/ext/soap/tests/bugs/bug38004.phpt @@ -7,9 +7,9 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php function Test($param) { - global $g; - $g = $param->strA."\n".$param->strB."\n"; - return $g; + global $g; + $g = $param->strA."\n".$param->strB."\n"; + return $g; } class TestSoapClient extends SoapClient { diff --git a/ext/soap/tests/bugs/bug38005.phpt b/ext/soap/tests/bugs/bug38005.phpt index 6557867277..6219141ab9 100644 --- a/ext/soap/tests/bugs/bug38005.phpt +++ b/ext/soap/tests/bugs/bug38005.phpt @@ -7,7 +7,7 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php function Test($param=NULL) { - return new SoapFault('Test', 'This is our fault: Ä'); + return new SoapFault('Test', 'This is our fault: Ä'); } class TestSoapClient extends SoapClient { @@ -28,11 +28,11 @@ class TestSoapClient extends SoapClient { $client = new TestSoapClient(NULL, array( 'encoding' => 'ISO-8859-1', - 'uri' => "test://", - 'location' => "test://", - 'soap_version'=>SOAP_1_2, - 'trace'=>1, - 'exceptions'=>0)); + 'uri' => "test://", + 'location' => "test://", + 'soap_version'=>SOAP_1_2, + 'trace'=>1, + 'exceptions'=>0)); $res = $client->Test(); echo($res->faultstring."\n"); echo($client->__getLastResponse()); diff --git a/ext/soap/tests/bugs/bug38055.phpt b/ext/soap/tests/bugs/bug38055.phpt index 7b5ed49a27..df97e1034d 100644 --- a/ext/soap/tests/bugs/bug38055.phpt +++ b/ext/soap/tests/bugs/bug38055.phpt @@ -7,10 +7,10 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php function Test($param) { - global $g1, $g2; - $g1 = $param->boolA; - $g2 = $param->boolB; - return 1; + global $g1, $g2; + $g1 = $param->boolA; + $g2 = $param->boolB; + return 1; } class TestSoapClient extends SoapClient { diff --git a/ext/soap/tests/bugs/bug38067.phpt b/ext/soap/tests/bugs/bug38067.phpt index 7664135de3..0b935f30c2 100644 --- a/ext/soap/tests/bugs/bug38067.phpt +++ b/ext/soap/tests/bugs/bug38067.phpt @@ -7,9 +7,9 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php function Test($param) { - global $g; - $g = $param->str; - return $g; + global $g; + $g = $param->str; + return $g; } class TestSoapClient extends SoapClient { @@ -29,7 +29,7 @@ class TestSoapClient extends SoapClient { } $client = new TestSoapClient(__DIR__.'/bug38067.wsdl', - array('encoding' => 'ISO-8859-1')); + array('encoding' => 'ISO-8859-1')); $str = 'test: Ä'; $res = $client->Test(array('str'=>$str)); echo $str."\n"; diff --git a/ext/soap/tests/bugs/bug41004.phpt b/ext/soap/tests/bugs/bug41004.phpt index c38bf0d62b..442e147bbc 100644 --- a/ext/soap/tests/bugs/bug41004.phpt +++ b/ext/soap/tests/bugs/bug41004.phpt @@ -7,17 +7,17 @@ Bug #41004 (minOccurs="0" and null class member variable) ini_set('soap.wsdl_cache_enabled', false); class EchoBean{ - public $mandatoryElement; - public $optionalElement; + public $mandatoryElement; + public $optionalElement; } class EchoRequest{ - public $in; + public $in; } class EchoResponse{ - public $out; + public $out; } $wsdl = __DIR__."/bug41004.wsdl"; diff --git a/ext/soap/tests/bugs/bug41566.phpt b/ext/soap/tests/bugs/bug41566.phpt index 03ecdde043..557c61780a 100644 --- a/ext/soap/tests/bugs/bug41566.phpt +++ b/ext/soap/tests/bugs/bug41566.phpt @@ -44,8 +44,8 @@ echo "ok\n"; $HTTP_RAW_POST_DATA = <<<EOF <?xml version="1.0" encoding="UTF-8"?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" - xmlns:ns1="http://testuri.org" +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" + xmlns:ns1="http://testuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"> <env:Body> diff --git a/ext/soap/tests/bugs/bug42086.phpt b/ext/soap/tests/bugs/bug42086.phpt index bdaf55ac83..0d4d30486f 100644 --- a/ext/soap/tests/bugs/bug42086.phpt +++ b/ext/soap/tests/bugs/bug42086.phpt @@ -12,17 +12,17 @@ $request = <<<EOF EOF; class firstFunctionWithoutParamResponse { - public $param; + public $param; } function firstFunctionWithoutParam() { - $ret = new firstFunctionWithoutParamResponse(); - $ret->param = "firstFunctionWithoutParam"; - return $ret; + $ret = new firstFunctionWithoutParamResponse(); + $ret->param = "firstFunctionWithoutParam"; + return $ret; } $server = new SoapServer(__DIR__.'/bug42086.wsdl', - array('features'=>SOAP_SINGLE_ELEMENT_ARRAYS)); + array('features'=>SOAP_SINGLE_ELEMENT_ARRAYS)); $server->addFunction('firstFunctionWithoutParam'); $server->handle($request); ?> diff --git a/ext/soap/tests/bugs/bug42151.phpt b/ext/soap/tests/bugs/bug42151.phpt index ee53e6d525..f945a8753e 100644 --- a/ext/soap/tests/bugs/bug42151.phpt +++ b/ext/soap/tests/bugs/bug42151.phpt @@ -5,23 +5,23 @@ Bug #42151 (__destruct functions not called after catching a SoapFault exception --FILE-- <?php class foo { - function __construct(){ - $foo = @ new SoapClient('httpx://'); - } - function __destruct(){ - echo 'I never get executed.' . "\n"; - } + function __construct(){ + $foo = @ new SoapClient('httpx://'); + } + function __destruct(){ + echo 'I never get executed.' . "\n"; + } } class bar { - function __destruct(){ - echo 'I don\'t get executed either.' . "\n"; - } + function __destruct(){ + echo 'I don\'t get executed either.' . "\n"; + } } try { - $bar = new bar(); - $foo = new foo(); + $bar = new bar(); + $foo = new foo(); } catch (Exception $e){ - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } echo "ok\n"; ?> diff --git a/ext/soap/tests/bugs/bug42183.phpt b/ext/soap/tests/bugs/bug42183.phpt index 043487c964..0fed7f1d54 100644 --- a/ext/soap/tests/bugs/bug42183.phpt +++ b/ext/soap/tests/bugs/bug42183.phpt @@ -13,11 +13,11 @@ $req = <<<EOF EOF; function test() { - return new PHPObject(); + return new PHPObject(); } $server = new SoapServer(NULL, array('uri' => 'http://ws.sit.com', - 'classmap' => array('Object' => 'PHPObject'))); + 'classmap' => array('Object' => 'PHPObject'))); $server->addFunction("test"); ob_start(); $server->handle($req); diff --git a/ext/soap/tests/bugs/bug42214.phpt b/ext/soap/tests/bugs/bug42214.phpt index a31f16dcb4..64cd631bc7 100644 --- a/ext/soap/tests/bugs/bug42214.phpt +++ b/ext/soap/tests/bugs/bug42214.phpt @@ -10,12 +10,12 @@ $request = <<<EOF EOF; function test() { - $a = $b; - obvious_error(); // will cause an error + $a = $b; + obvious_error(); // will cause an error } $server = new SoapServer(NULL, array('uri' =>'http://localhost/server.php', - 'send_errors'=>0)); + 'send_errors'=>0)); $server->addFunction('test'); $server->handle($request); ?> diff --git a/ext/soap/tests/bugs/bug42692.phpt b/ext/soap/tests/bugs/bug42692.phpt index b221a3a862..0a1310ab9e 100644 --- a/ext/soap/tests/bugs/bug42692.phpt +++ b/ext/soap/tests/bugs/bug42692.phpt @@ -7,32 +7,32 @@ Bug #42692 (Procedure 'int1' not present with doc/lit SoapServer) ini_set('soap.wsdl_cache_enabled','0'); function checkAuth($peid,$auth) { - return $peid; + return $peid; } class TestSoap extends SoapClient { - function __construct($wsdl, $options) { - parent::__construct($wsdl, $options); - $this->server = new SoapServer($wsdl, $options); - $this->server->addFunction("checkAuth"); - } + function __construct($wsdl, $options) { + parent::__construct($wsdl, $options); + $this->server = new SoapServer($wsdl, $options); + $this->server->addFunction("checkAuth"); + } - function __doRequest($request, $location, $action, $version, $one_way = 0) { - ob_start(); - $this->server->handle($request); - $response = ob_get_contents(); - ob_end_clean(); - return $response; - } + function __doRequest($request, $location, $action, $version, $one_way = 0) { + ob_start(); + $this->server->handle($request); + $response = ob_get_contents(); + ob_end_clean(); + return $response; + } } $client = new TestSoap(__DIR__ . "/bug42692.wsdl", array("trace"=>1)); try { - $result = $client->checkAuth(1,"two"); - echo "Auth for 1 is $result\n"; + $result = $client->checkAuth(1,"two"); + echo "Auth for 1 is $result\n"; } catch (Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> --EXPECT-- diff --git a/ext/soap/tests/bugs/bug43045.phpt b/ext/soap/tests/bugs/bug43045.phpt index f4f3983800..9c2139276d 100644 --- a/ext/soap/tests/bugs/bug43045.phpt +++ b/ext/soap/tests/bugs/bug43045.phpt @@ -36,11 +36,11 @@ xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> } } $client = new TestSoapClient(NULL, array( - "location" => "test://", - "uri" => 'urn:TestSOAP', - "style" => SOAP_RPC, - "use" => SOAP_ENCODED - )); + "location" => "test://", + "uri" => 'urn:TestSOAP', + "style" => SOAP_RPC, + "use" => SOAP_ENCODED + )); var_dump($client->test(0.1)); var_dump($client->test(NAN)); var_dump($response = $client->test(INF)); diff --git a/ext/soap/tests/bugs/bug44882.phpt b/ext/soap/tests/bugs/bug44882.phpt index 128011722f..8357b0c979 100644 --- a/ext/soap/tests/bugs/bug44882.phpt +++ b/ext/soap/tests/bugs/bug44882.phpt @@ -9,10 +9,10 @@ soap.wsdl_cache_enabled=0 class TestSoapClient extends SoapClient { public function __doRequest($req, $loc, $act, $ver, $one_way = 0) - { - return <<<XML + { + return <<<XML <?xml version="1.0" encoding="UTF-8"?> -<SOAP-ENV:Envelope +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns="urn:ebay:api:PayPalAPI"> @@ -35,7 +35,7 @@ class TestSoapClient extends SoapClient </SOAP-ENV:Body> </SOAP-ENV:Envelope> XML; - } + } } $client = new TestSoapClient(__DIR__.'/bug44882.wsdl'); diff --git a/ext/soap/tests/bugs/bug46427.phpt b/ext/soap/tests/bugs/bug46427.phpt index 38d53518b8..3d0b1a4d51 100644 --- a/ext/soap/tests/bugs/bug46427.phpt +++ b/ext/soap/tests/bugs/bug46427.phpt @@ -8,10 +8,10 @@ Bug #46427 (SoapClient() stumbles over its "stream_context" parameter) function getSoapClient_1() { $ctx = stream_context_create(); return new SoapClient(NULL, array( - 'stream_context' => $ctx, - 'location' => 'test://', - 'uri' => 'test://', - 'exceptions' => false)); + 'stream_context' => $ctx, + 'location' => 'test://', + 'uri' => 'test://', + 'exceptions' => false)); } getSoapClient_1()->__soapCall('Help', array()); diff --git a/ext/soap/tests/bugs/bug47049.phpt b/ext/soap/tests/bugs/bug47049.phpt index 467df2b901..7ffc15d0cd 100644 --- a/ext/soap/tests/bugs/bug47049.phpt +++ b/ext/soap/tests/bugs/bug47049.phpt @@ -7,7 +7,7 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php $client = new SoapClient(__DIR__ . '/bug47049.wsdl', - array('trace' => 1 , 'exceptions' => 0)); + array('trace' => 1 , 'exceptions' => 0)); $host = array('uuid' => 'foo'); $software_list = array(array('name' => 'package', 'version' => '1.2.3', 'state' => 'installed')); $updates = array(); diff --git a/ext/soap/tests/bugs/bug47273.phpt b/ext/soap/tests/bugs/bug47273.phpt index c23bb5a592..a393b701ab 100644 --- a/ext/soap/tests/bugs/bug47273.phpt +++ b/ext/soap/tests/bugs/bug47273.phpt @@ -16,12 +16,12 @@ EOF; class SoapFaultTest { public function test1() { - // Test #1 + // Test #1 return 'Test #1 exception with some special chars: Äßö'; } public function test2() { // Test #2 - //throw new SoapFault('Server', 'Test #2 exception with some special chars: Äßö'); + //throw new SoapFault('Server', 'Test #2 exception with some special chars: Äßö'); throw new Exception('Test #2 exception with some special chars: Äßö'); } } @@ -32,9 +32,9 @@ $server = new SoapServer(null, array( $server->setClass('SoapFaultTest'); try { - $server->handle($request1); + $server->handle($request1); } catch (Exception $e) { - $server->fault("Sender", $e->getMessage()); + $server->fault("Sender", $e->getMessage()); } try { $server->handle($request2); diff --git a/ext/soap/tests/bugs/bug50675.phpt b/ext/soap/tests/bugs/bug50675.phpt index 017671620b..00350b1000 100644 --- a/ext/soap/tests/bugs/bug50675.phpt +++ b/ext/soap/tests/bugs/bug50675.phpt @@ -13,29 +13,29 @@ class TestSoapClient extends SoapClient { xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <soapenv:Body> - <soapenv:Fault> - <faultcode>soapenv:Server.userException</faultcode> - <faultstring>service.EchoServiceException</faultstring> - <detail> - <service.EchoServiceException xsi:type="ns1:EchoServiceException" xmlns:ns1="urn:service.EchoService"> - <intParameter xsi:type="xsd:int">105</intParameter> - <parameter xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">string param</parameter> - </service.EchoServiceException> - <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">steckovic</ns2:hostname> - </detail> - </soapenv:Fault> - </soapenv:Body> + <soapenv:Body> + <soapenv:Fault> + <faultcode>soapenv:Server.userException</faultcode> + <faultstring>service.EchoServiceException</faultstring> + <detail> + <service.EchoServiceException xsi:type="ns1:EchoServiceException" xmlns:ns1="urn:service.EchoService"> + <intParameter xsi:type="xsd:int">105</intParameter> + <parameter xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">string param</parameter> + </service.EchoServiceException> + <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">steckovic</ns2:hostname> + </detail> + </soapenv:Fault> + </soapenv:Body> </soapenv:Envelope> EOF; - } + } } ini_set('soap.wsdl_cache_enabled', 0); $parameters = [ - 'trace' => 1, - 'exceptions' => 0, + 'trace' => 1, + 'exceptions' => 0, ]; $client = new TestSoapClient(__DIR__ . '/bug50675.wsdl', $parameters); diff --git a/ext/soap/tests/bugs/bug50762.phpt b/ext/soap/tests/bugs/bug50762.phpt index c48c761ea2..d8ed9ce544 100644 --- a/ext/soap/tests/bugs/bug50762.phpt +++ b/ext/soap/tests/bugs/bug50762.phpt @@ -5,13 +5,13 @@ Bug #50762 (in WSDL mode Soap Header handler function only being called if defin --FILE-- <?php class testSoap { - private $auth; - public function authToken($token){ - $this->auth=true; - } - public function testHeader($param){ - return 'header handler ' . ($this->auth ? 'called' : 'not called'); - } + private $auth; + public function authToken($token){ + $this->auth=true; + } + public function testHeader($param){ + return 'header handler ' . ($this->auth ? 'called' : 'not called'); + } } class LocalSoapClient extends SoapClient { @@ -19,7 +19,7 @@ class LocalSoapClient extends SoapClient { function __construct($wsdl, $options) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); - $this->server->setObject(new testSoap()); + $this->server->setObject(new testSoap()); } function __doRequest($request, $location, $action, $version, $one_way = 0) { @@ -35,9 +35,9 @@ class LocalSoapClient extends SoapClient { $cl = new LocalSoapClient(__DIR__.'/bug50762.wsdl', array('cache_wsdl'=>WSDL_CACHE_NONE, 'trace'=>true)); class authToken{ - public function __construct($token){ - $this->authToken=$token; - } + public function __construct($token){ + $this->authToken=$token; + } } $cl->__setSoapHeaders(array(new SoapHeader('http://sova.pronto.ru/', 'authToken', new authToken('tokendata')))); diff --git a/ext/soap/tests/bugs/bug65018.phpt b/ext/soap/tests/bugs/bug65018.phpt index bbb9b5e42d..762f4f6ec4 100644 --- a/ext/soap/tests/bugs/bug65018.phpt +++ b/ext/soap/tests/bugs/bug65018.phpt @@ -4,24 +4,24 @@ Bug #65018 (SoapHeader problems with SoapServer) <?php require_once('skipif.inc'); ?> --FILE-- <?php - class Tool{ - public function TOKEN($id){ - return new SoapHeader('namespace1', 'TOKEN', $id, true); - } - public function Method(){} - } + class Tool{ + public function TOKEN($id){ + return new SoapHeader('namespace1', 'TOKEN', $id, true); + } + public function Method(){} + } - $input = $input = - '<?xml version="1.0"?>'.PHP_EOL. - '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="namespace1"'. - ' xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'. - ' xmlns:xsd="http://www.w3.org/2001/XMLSchema">'. - '<SOAP-ENV:Header><ns1:TOKEN soapenv:mustUnderstand="1">abc</ns1:TOKEN></SOAP-ENV:Header>'. - '<SOAP-ENV:Body><ns1:Method /></SOAP-ENV:Body></SOAP-ENV:Envelope>'; + $input = $input = + '<?xml version="1.0"?>'.PHP_EOL. + '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="namespace1"'. + ' xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'. + ' xmlns:xsd="http://www.w3.org/2001/XMLSchema">'. + '<SOAP-ENV:Header><ns1:TOKEN soapenv:mustUnderstand="1">abc</ns1:TOKEN></SOAP-ENV:Header>'. + '<SOAP-ENV:Body><ns1:Method /></SOAP-ENV:Body></SOAP-ENV:Envelope>'; - $soap = new SoapServer(null, array('uri' => '127.0.0.1')); - $soap->setClass('Tool'); - $soap->handle($input); + $soap = new SoapServer(null, array('uri' => '127.0.0.1')); + $soap->setClass('Tool'); + $soap->handle($input); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> diff --git a/ext/soap/tests/bugs/bug66112.phpt b/ext/soap/tests/bugs/bug66112.phpt index 743297ac23..7dd067d614 100644 --- a/ext/soap/tests/bugs/bug66112.phpt +++ b/ext/soap/tests/bugs/bug66112.phpt @@ -8,12 +8,12 @@ soap.wsdl_cache_enabled=0 <?php define('WSDL', __DIR__."/bug66112.wsdl"); function Mist($p) { - $client=new soapclient(WSDL, array('typemap'=>array(array("type_ns"=>"uri:mist", "type_name"=>"A")))); - try{ - $client->Mist(array("XX"=>"xx")); - }catch(SoapFault $x){ - } - return array("A"=>"ABC","B"=>"sss"); + $client=new soapclient(WSDL, array('typemap'=>array(array("type_ns"=>"uri:mist", "type_name"=>"A")))); + try{ + $client->Mist(array("XX"=>"xx")); + }catch(SoapFault $x){ + } + return array("A"=>"ABC","B"=>"sss"); } $s = new SoapServer(WSDL, array('typemap'=>array(array("type_ns"=>"uri:mist", "type_name"=>"A")))); $s->addFunction("Mist"); diff --git a/ext/soap/tests/bugs/bug69085.phpt b/ext/soap/tests/bugs/bug69085.phpt index cb27cfd89e..7d7f36e9bd 100644 --- a/ext/soap/tests/bugs/bug69085.phpt +++ b/ext/soap/tests/bugs/bug69085.phpt @@ -9,9 +9,9 @@ soap.wsdl_cache_enabled=0 $dummy = unserialize('O:10:"SoapClient":5:{s:3:"uri";s:1:"a";s:8:"location";s:22:"http://localhost/a.xml";s:17:"__default_headers";i:1337;s:15:"__last_response";s:1:"a";s:5:"trace";s:1:"x";}'); try { - $dummy->whatever(); + $dummy->whatever(); } catch (Exception $e) { - echo "okey"; + echo "okey"; } --EXPECT-- okey diff --git a/ext/soap/tests/bugs/bug69462.phpt b/ext/soap/tests/bugs/bug69462.phpt index eecd8d6749..003d62e495 100644 --- a/ext/soap/tests/bugs/bug69462.phpt +++ b/ext/soap/tests/bugs/bug69462.phpt @@ -9,18 +9,18 @@ $namespace = "http://example.com/ns"; $client = new SoapClient(null, [ 'exceptions' => 1, 'location' => "", 'uri' => $namespace ]); $soapvar = new SoapVar( - array( - new SoapVar('value', XSD_STRING, null, null, null, $namespace) - ), - SOAP_ENC_OBJECT, null, null, 'name', $namespace + array( + new SoapVar('value', XSD_STRING, null, null, null, $namespace) + ), + SOAP_ENC_OBJECT, null, null, 'name', $namespace ); try { - $client->__soapCall('method', array($soapvar)); + $client->__soapCall('method', array($soapvar)); } catch (Exception $e) { - /* ignore any errors, we're testing for segmentation fault anyway */ - echo "good"; + /* ignore any errors, we're testing for segmentation fault anyway */ + echo "good"; } ?> --EXPECT-- diff --git a/ext/soap/tests/bugs/multiport.phpt b/ext/soap/tests/bugs/multiport.phpt index 53e281130f..549a5b3c72 100644 --- a/ext/soap/tests/bugs/multiport.phpt +++ b/ext/soap/tests/bugs/multiport.phpt @@ -7,7 +7,7 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php $client = new SoapClient(__DIR__.'/multiport.wsdl', - array('trace' => true, 'exceptions' => false)); + array('trace' => true, 'exceptions' => false)); $response = $client->GetSessionId(array('userId'=>'user', 'password'=>'password')); echo $client->__getLastRequest(); ?> diff --git a/ext/soap/tests/classmap001.phpt b/ext/soap/tests/classmap001.phpt index 1a3a472c27..c3f5301f46 100644 --- a/ext/soap/tests/classmap001.phpt +++ b/ext/soap/tests/classmap001.phpt @@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php $GLOBALS['HTTP_RAW_POST_DATA']=" -<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" - xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" - xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" - xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" - xmlns:ns1=\"http://schemas.nothing.com\" +<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" + xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" + xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" + xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" + xmlns:ns1=\"http://schemas.nothing.com\" > <env:Body> <dotest> @@ -25,21 +25,21 @@ $GLOBALS['HTTP_RAW_POST_DATA']=" </env:Envelope>"; class test{ - function dotest(book $book){ - $classname=get_class($book); - return "Classname: ".$classname; - } + function dotest(book $book){ + $classname=get_class($book); + return "Classname: ".$classname; + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } $options=Array( - 'actor' =>'http://schema.nothing.com', - 'classmap' => array('book'=>'book', 'wsdltype2'=>'classname2') - ); + 'actor' =>'http://schema.nothing.com', + 'classmap' => array('book'=>'book', 'wsdltype2'=>'classname2') + ); $server = new SoapServer(__DIR__."/classmap.wsdl",$options); $server->setClass("test"); diff --git a/ext/soap/tests/classmap002.phpt b/ext/soap/tests/classmap002.phpt index 2f16cf506a..cf3dd78e3f 100644 --- a/ext/soap/tests/classmap002.phpt +++ b/ext/soap/tests/classmap002.phpt @@ -8,7 +8,7 @@ soap.wsdl_cache_enabled=0 <?php class TestSoapClient extends SoapClient{ function __doRequest($request, $location, $action, $version, $one_way = 0) { - return <<<EOF + return <<<EOF <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nothing.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body> <ns1:dotest2Response><res xsi:type="ns1:book"> @@ -17,19 +17,19 @@ class TestSoapClient extends SoapClient{ </res> </ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope> EOF; - } + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } $options=Array( - 'actor' =>'http://schema.nothing.com', - 'classmap' => array('book'=>'book', 'wsdltype2'=>'classname2') - ); + 'actor' =>'http://schema.nothing.com', + 'classmap' => array('book'=>'book', 'wsdltype2'=>'classname2') + ); $client = new TestSoapClient(__DIR__."/classmap.wsdl",$options); $ret = $client->dotest2("???"); diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt index 681f604e6a..f81a0c13f4 100644 --- a/ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt +++ b/ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt @@ -7,9 +7,9 @@ precision=14 --FILE-- <?php $param = new SoapParam(new SoapVar(array( - new SoapVar('arg', XSD_STRING, null, null, 'varString'), - new SoapVar('34', XSD_INT, null, null, 'varInt'), - new SoapVar('325.325', XSD_FLOAT, null, null, 'varFloat') + new SoapVar('arg', XSD_STRING, null, null, 'varString'), + new SoapVar('34', XSD_INT, null, null, 'varInt'), + new SoapVar('325.325', XSD_FLOAT, null, null, 'varFloat') ),SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd"), "inputStruct"); $client = new SoapClient(NULL,array("location"=>"test://","uri"=>"http://soapinterop.org/","trace"=>1,"exceptions"=>0)); $client->__soapCall("echoStruct", array($param), array("soapaction"=>"http://soapinterop.org/","uri"=>"http://soapinterop.org/")); diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt index efbad5a121..c167556f12 100644 --- a/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt +++ b/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt @@ -15,14 +15,14 @@ class SOAPStruct { } $struct1 = new SoapVar(array( - new SoapVar('arg', XSD_STRING, null, null, 'varString'), - new SoapVar('34', XSD_INT, null, null, 'varInt'), - new SoapVar('325.325', XSD_FLOAT, null, null, 'varFloat') + new SoapVar('arg', XSD_STRING, null, null, 'varString'), + new SoapVar('34', XSD_INT, null, null, 'varInt'), + new SoapVar('325.325', XSD_FLOAT, null, null, 'varFloat') ),SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd"); $struct2 = new SoapVar(array( - new SoapVar('arg', XSD_STRING, null, null, 'varString'), - new SoapVar('34', XSD_INT, null, null, 'varInt'), - new SoapVar('325.325', XSD_FLOAT, null, null, 'varFloat') + new SoapVar('arg', XSD_STRING, null, null, 'varString'), + new SoapVar('34', XSD_INT, null, null, 'varInt'), + new SoapVar('325.325', XSD_FLOAT, null, null, 'varFloat') ),SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd"); $param = new SoapParam(new SoapVar(array( diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt index 126bdff26d..fe9d90c509 100644 --- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt +++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt @@ -11,7 +11,7 @@ $param = new SoapParam(new SoapVar(array( new SoapVar(34, XSD_INT, null, null, "varInt"), new SoapVar(123.45, XSD_FLOAT, null, null, "varFloat"), new SoapVar(array( - new SoapVar("arg2", XSD_STRING, null, null, "varString"), + new SoapVar("arg2", XSD_STRING, null, null, "varString"), new SoapVar(342, XSD_INT, null, null, "varInt"), new SoapVar(123.452, XSD_FLOAT, null, null, "varFloat") ), SOAP_ENC_OBJECT, "SOAPStruct", "http://soapinterop.org/xsd", 'varStruct') diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt index e8cacfacbb..20d1d1426b 100644 --- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt +++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt @@ -11,9 +11,9 @@ $param = new SoapParam(new SoapVar(array( new SoapVar(34, XSD_INT, null, null, "varInt"), new SoapVar(325.325, XSD_FLOAT, null, null, "varFloat"), new SoapVar(array( - new SoapVar("red", XSD_STRING), - new SoapVar("blue", XSD_STRING), - new SoapVar("green", XSD_STRING), + new SoapVar("red", XSD_STRING), + new SoapVar("blue", XSD_STRING), + new SoapVar("green", XSD_STRING), ), SOAP_ENC_ARRAY, "ArrayOfString", "http://soapinterop.org/xsd", 'varArray') ), SOAP_ENC_OBJECT, "SOAPArrayStruct", "http://soapinterop.org/xsd"), "inputStruct"); $client = new SoapClient(NULL,array("location"=>"test://","uri"=>"http://soapinterop.org/","trace"=>1,"exceptions"=>0)); diff --git a/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc b/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc index 77b81271c9..c8fc93aaa3 100644 --- a/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc +++ b/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc @@ -11,8 +11,8 @@ class SOAP_Interop_GroupB { function echoSimpleTypesAsStruct($string, $int, $float) { return (object)array("varString" => $string, - "varInt" => $int, - "varFloat" => $float); + "varInt" => $int, + "varFloat" => $float); } function echoNestedStruct($struct) diff --git a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc index a27f96e279..845d96d644 100644 --- a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc +++ b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc @@ -14,21 +14,21 @@ class SOAP_Interop_GroupH { } function echoMultipleFaults1($input) { - if ($input->whichFault == 2) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $input->param2, "ComplexFault2"); - } else { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, array("soapStruct"=>$input->param1), "ComplexFault1"); - } + if ($input->whichFault == 2) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $input->param2, "ComplexFault2"); + } else { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, array("soapStruct"=>$input->param1), "ComplexFault1"); + } } function echoMultipleFaults2($input) { - if ($input->whichFault == 2) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param2, "ComplexFault2"); - } else if ($input->whichFault == 3) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param3, "ComplexFault3"); - } else { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param1, "ComplexFault1"); - } + if ($input->whichFault == 2) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param2, "ComplexFault2"); + } else if ($input->whichFault == 3) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param3, "ComplexFault3"); + } else { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param1, "ComplexFault1"); + } } } diff --git a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc index 52165ba56e..1e403e4488 100644 --- a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc +++ b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc @@ -14,21 +14,21 @@ class SOAP_Interop_GroupH { } function echoMultipleFaults1($which, $s1, $s2) { - if ($which == 2) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $s2, "ComplexFault2"); - } else { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, array("soapStruct"=>$s1), "ComplexFault1"); - } + if ($which == 2) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $s2, "ComplexFault2"); + } else { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, array("soapStruct"=>$s1), "ComplexFault1"); + } } function echoMultipleFaults2($which, $s1, $s2, $s3) { - if ($which == 2) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $s2, "ComplexFault2"); - } else if ($which == 3) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $s3, "ComplexFault3"); - } else { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $s1, "ComplexFault1"); - } + if ($which == 2) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $s2, "ComplexFault2"); + } else if ($which == 3) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $s3, "ComplexFault3"); + } else { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $s1, "ComplexFault1"); + } } } diff --git a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc index e0e35f1821..17bcd9c41d 100644 --- a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc +++ b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc @@ -14,39 +14,39 @@ class SOAP_Interop_GroupH { } function echoMultipleFaults1($input) { - if ($input->whichFault == 2) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $input->param1, "SimpleFault2"); - } else if ($input->whichFault == 3) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $input->param2, "SimpleFault3"); - } else { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, null, "SimpleFault1"); - } + if ($input->whichFault == 2) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $input->param1, "SimpleFault2"); + } else if ($input->whichFault == 3) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $input->param2, "SimpleFault3"); + } else { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, null, "SimpleFault1"); + } } function echoMultipleFaults2($input) { - if ($input->whichFault == 2) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param1, "SimpleFault1"); - } else if ($input->whichFault == 3) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param3, "SimpleFault3"); - } else { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param2, "SimpleFault2"); - } + if ($input->whichFault == 2) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param1, "SimpleFault1"); + } else if ($input->whichFault == 3) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param3, "SimpleFault3"); + } else { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param2, "SimpleFault2"); + } } function echoMultipleFaults3($input) { - if ($input->whichFault == 2) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $input->param2, "SimpleFault2"); - } else { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $input->param1, "SimpleFault1"); - } + if ($input->whichFault == 2) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $input->param2, "SimpleFault2"); + } else { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $input->param1, "SimpleFault1"); + } } function echoMultipleFaults4($input) { - if ($input->whichFault == 2) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $input->param2, "SimpleFault2"); - } else { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $input->param1, "SimpleFault1"); - } + if ($input->whichFault == 2) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $input->param2, "SimpleFault2"); + } else { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $input->param1, "SimpleFault1"); + } } } diff --git a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc index d39f060963..01b9870a1a 100644 --- a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc +++ b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc @@ -14,39 +14,39 @@ class SOAP_Interop_GroupH { } function echoMultipleFaults1($param, $string, $floats) { - if ($param == 2) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $string, "SimpleFault2"); - } else if ($param == 3) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $floats, "SimpleFault3"); - } else { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, null, "SimpleFault1"); - } + if ($param == 2) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $string, "SimpleFault2"); + } else if ($param == 3) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $floats, "SimpleFault3"); + } else { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, null, "SimpleFault1"); + } } function echoMultipleFaults2($param, $string, $float, $strings) { - if ($param == 2) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $string, "SimpleFault1"); - } else if ($param == 3) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $strings, "SimpleFault3"); - } else { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $float, "SimpleFault2"); - } + if ($param == 2) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $string, "SimpleFault1"); + } else if ($param == 3) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $strings, "SimpleFault3"); + } else { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $float, "SimpleFault2"); + } } function echoMultipleFaults3($param, $param1, $param2) { - if ($param == 2) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $param2, "SimpleFault2"); - } else { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $param1, "SimpleFault1"); - } + if ($param == 2) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $param2, "SimpleFault2"); + } else { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $param1, "SimpleFault1"); + } } function echoMultipleFaults4($param, $int, $enum) { - if ($param == 2) { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $enum, "SimpleFault2"); - } else { - return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $int, "SimpleFault1"); - } + if ($param == 2) { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $enum, "SimpleFault2"); + } else { + return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $int, "SimpleFault1"); + } } } diff --git a/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc b/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc index af74db7c74..c736bcde4b 100644 --- a/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc +++ b/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc @@ -3,11 +3,11 @@ class SOAP_Interop_GroupI { function echoString($inputString) { - if (isset($inputString->inputString)) { - return array("return"=>$inputString->inputString); - } else { - return $inputString; - } + if (isset($inputString->inputString)) { + return array("return"=>$inputString->inputString); + } else { + return $inputString; + } } function echoInteger($inputInteger) @@ -26,11 +26,11 @@ class SOAP_Interop_GroupI { function echoBase64($inputBase64) { - if (isset($inputBase64->inputBase64)) { - return array("return"=>$inputBase64->inputBase64); - } else { - return $inputBase64; - } + if (isset($inputBase64->inputBase64)) { + return array("return"=>$inputBase64->inputBase64); + } else { + return $inputBase64; + } } function echoDate($timeInstant) @@ -40,56 +40,56 @@ class SOAP_Interop_GroupI { function echoComplexType($inputComplexType) { - if (isset($inputComplexType->inputComplexType)) { - return array("return"=>$inputComplexType->inputComplexType); - } else { - return $inputComplexType; - } + if (isset($inputComplexType->inputComplexType)) { + return array("return"=>$inputComplexType->inputComplexType); + } else { + return $inputComplexType; + } } function echoIntegerMultiOccurs($input) { - if (isset($input->inputIntegerMultiOccurs->int)) { - return array("return"=>$input->inputIntegerMultiOccurs->int); - } else { - return array(); - } + if (isset($input->inputIntegerMultiOccurs->int)) { + return array("return"=>$input->inputIntegerMultiOccurs->int); + } else { + return array(); + } } function echoFloatMultiOccurs($input) { - if (isset($input->inputFloatMultiOccurs->float)) { - return array("return"=>$input->inputFloatMultiOccurs->float); - } else { - return array(); - } + if (isset($input->inputFloatMultiOccurs->float)) { + return array("return"=>$input->inputFloatMultiOccurs->float); + } else { + return array(); + } } function echoStringMultiOccurs($input) { - if (isset($input->inputStringMultiOccurs->string)) { - return array("return"=>$input->inputStringMultiOccurs->string); - } else { - return array(); - } + if (isset($input->inputStringMultiOccurs->string)) { + return array("return"=>$input->inputStringMultiOccurs->string); + } else { + return array(); + } } function echoComplexTypeMultiOccurs($input) { - if (isset($input->inputComplexTypeMultiOccurs->SOAPComplexType)) { - return array("return"=>$input->inputComplexTypeMultiOccurs->SOAPComplexType); - } else { - return array(); - } + if (isset($input->inputComplexTypeMultiOccurs->SOAPComplexType)) { + return array("return"=>$input->inputComplexTypeMultiOccurs->SOAPComplexType); + } else { + return array(); + } } function echoHexBinary($hb) { - if (isset($hb->inputHexBinary)) { - return array("return"=>$hb->inputHexBinary); - } else { - return $hb; - } + if (isset($hb->inputHexBinary)) { + return array("return"=>$hb->inputHexBinary); + } else { + return $hb; + } } function echoDecimal($dec) @@ -104,53 +104,53 @@ class SOAP_Interop_GroupI { function echoComplexTypeAsSimpleTypes($input) { - if (isset($input->inputComplexType)) { - $ret = array("outputInteger" => $input->inputComplexType->varInt, - "outputFloat" => $input->inputComplexType->varFloat); - if (isset($input->inputComplexType->varString)) { - $ret["outputString"] = $input->inputComplexType->varString; - } - return $ret; - } else { - return array(); - } - } + if (isset($input->inputComplexType)) { + $ret = array("outputInteger" => $input->inputComplexType->varInt, + "outputFloat" => $input->inputComplexType->varFloat); + if (isset($input->inputComplexType->varString)) { + $ret["outputString"] = $input->inputComplexType->varString; + } + return $ret; + } else { + return array(); + } + } function echoSimpleTypesAsComplexType($input) { - $ret = array("varInt" => $input->inputInteger, - "varFloat" => $input->inputFloat); - if (isset($input->inputString)) { - $ret["varString"] = $input->inputString; - } - return array("return"=>$ret); + $ret = array("varInt" => $input->inputInteger, + "varFloat" => $input->inputFloat); + if (isset($input->inputString)) { + $ret["varString"] = $input->inputString; + } + return array("return"=>$ret); } function echoNestedComplexType($inputComplexType) { - if (isset($inputComplexType->inputComplexType)) { - return array("return"=>$inputComplexType->inputComplexType); - } else { - return $inputComplexType; - } + if (isset($inputComplexType->inputComplexType)) { + return array("return"=>$inputComplexType->inputComplexType); + } else { + return $inputComplexType; + } } function echoNestedMultiOccurs($inputComplexType) { - if (isset($inputComplexType->inputComplexType)) { - return array("return"=>$inputComplexType->inputComplexType); - } else { - return $inputComplexType; - } + if (isset($inputComplexType->inputComplexType)) { + return array("return"=>$inputComplexType->inputComplexType); + } else { + return $inputComplexType; + } } function echoChoice($input) { - if (isset($input->inputChoice)) { - return array("return"=>$input->inputChoice); - } else { - return $input; - } + if (isset($input->inputChoice)) { + return array("return"=>$input->inputChoice); + } else { + return $input; + } } function echoEnum($input) @@ -160,20 +160,20 @@ class SOAP_Interop_GroupI { function echoAnyType($input) { - if (isset($input->inputAnyType)) { - return array("return"=>$input->inputAnyType); - } else { - return $input; - } + if (isset($input->inputAnyType)) { + return array("return"=>$input->inputAnyType); + } else { + return $input; + } } function echoAnyElement($input) { - if (isset($input->inputAny)) { - return array("return"=>$input->inputAny); - } else { - return $input; - } + if (isset($input->inputAny)) { + return array("return"=>$input->inputAny); + } else { + return $input; + } } function echoVoidSoapHeader() diff --git a/ext/soap/tests/schema/schema001.phpt b/ext/soap/tests/schema/schema001.phpt index 9f2b7e5235..cb031e6ac6 100644 --- a/ext/soap/tests/schema/schema001.phpt +++ b/ext/soap/tests/schema/schema001.phpt @@ -6,9 +6,9 @@ SOAP XML Schema 1: simpleType/restriction <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <restriction base="xsd:int"/> - </simpleType> + <simpleType name="testType"> + <restriction base="xsd:int"/> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',123.5); echo "ok"; diff --git a/ext/soap/tests/schema/schema002.phpt b/ext/soap/tests/schema/schema002.phpt index 41f3bbe3fa..66485aa205 100644 --- a/ext/soap/tests/schema/schema002.phpt +++ b/ext/soap/tests/schema/schema002.phpt @@ -6,12 +6,12 @@ SOAP XML Schema 2: simpleType/restriction (reference to type) <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType2"> - <restriction base="xsd:int"/> - </simpleType> - <simpleType name="testType"> - <restriction base="tns:testType2"/> - </simpleType> + <simpleType name="testType2"> + <restriction base="xsd:int"/> + </simpleType> + <simpleType name="testType"> + <restriction base="tns:testType2"/> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',123.5); echo "ok"; diff --git a/ext/soap/tests/schema/schema003.phpt b/ext/soap/tests/schema/schema003.phpt index 75991001e0..d32dd2434e 100644 --- a/ext/soap/tests/schema/schema003.phpt +++ b/ext/soap/tests/schema/schema003.phpt @@ -6,12 +6,12 @@ SOAP XML Schema 3: simpleType/restriction (reference to type, that is not define <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <restriction base="tns:testType2"/> - </simpleType> - <simpleType name="testType2"> - <restriction base="xsd:int"/> - </simpleType> + <simpleType name="testType"> + <restriction base="tns:testType2"/> + </simpleType> + <simpleType name="testType2"> + <restriction base="xsd:int"/> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',123.5); echo "ok"; diff --git a/ext/soap/tests/schema/schema004.phpt b/ext/soap/tests/schema/schema004.phpt index 93ed1d17f1..b930e40b4c 100644 --- a/ext/soap/tests/schema/schema004.phpt +++ b/ext/soap/tests/schema/schema004.phpt @@ -8,9 +8,9 @@ precision=14 <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <restriction base="tns:testType2"/> - </simpleType> + <simpleType name="testType"> + <restriction base="tns:testType2"/> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',123.5); echo "ok"; diff --git a/ext/soap/tests/schema/schema005.phpt b/ext/soap/tests/schema/schema005.phpt index 1db0c62f99..ddfa92555b 100644 --- a/ext/soap/tests/schema/schema005.phpt +++ b/ext/soap/tests/schema/schema005.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 5: simpleType/restriction (inline type) <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <restriction> - <simpleType name="testType2"> - <restriction base="xsd:int"/> - </simpleType> - </restriction> - </simpleType> + <simpleType name="testType"> + <restriction> + <simpleType name="testType2"> + <restriction base="xsd:int"/> + </simpleType> + </restriction> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',123.5); echo "ok"; diff --git a/ext/soap/tests/schema/schema006.phpt b/ext/soap/tests/schema/schema006.phpt index e41f27545b..9255626581 100644 --- a/ext/soap/tests/schema/schema006.phpt +++ b/ext/soap/tests/schema/schema006.phpt @@ -6,14 +6,14 @@ SOAP XML Schema 6: simpleType/restriction (referenced by ellement) <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <restriction> - <simpleType name="testType2"> - <restriction base="xsd:int"/> - </simpleType> - </restriction> - </simpleType> - <element name="testElement" type="tns:testType"/> + <simpleType name="testType"> + <restriction> + <simpleType name="testType2"> + <restriction base="xsd:int"/> + </simpleType> + </restriction> + </simpleType> + <element name="testElement" type="tns:testType"/> EOF; test_schema($schema,'element="tns:testElement"',123.5); echo "ok"; diff --git a/ext/soap/tests/schema/schema007.phpt b/ext/soap/tests/schema/schema007.phpt index fd93c7aa8e..bf088e7b2d 100644 --- a/ext/soap/tests/schema/schema007.phpt +++ b/ext/soap/tests/schema/schema007.phpt @@ -6,14 +6,14 @@ SOAP XML Schema 7: simpleType/restriction (referenced by ellement) <?php include "test_schema.inc"; $schema = <<<EOF - <element name="testElement" type="tns:testType"/> - <simpleType name="testType"> - <restriction> - <simpleType name="testType2"> - <restriction base="xsd:int"/> - </simpleType> - </restriction> - </simpleType> + <element name="testElement" type="tns:testType"/> + <simpleType name="testType"> + <restriction> + <simpleType name="testType2"> + <restriction base="xsd:int"/> + </simpleType> + </restriction> + </simpleType> EOF; test_schema($schema,'element="tns:testElement"',123.5); echo "ok"; diff --git a/ext/soap/tests/schema/schema008.phpt b/ext/soap/tests/schema/schema008.phpt index 7d8a440dd9..3a9b998580 100644 --- a/ext/soap/tests/schema/schema008.phpt +++ b/ext/soap/tests/schema/schema008.phpt @@ -7,13 +7,13 @@ SOAP XML Schema 8: simpleType/restriction (anonymous, inside an ellement) include "test_schema.inc"; $schema = <<<EOF <element name="testElement"> - <simpleType> - <restriction> - <simpleType name="testType2"> - <restriction base="xsd:int"/> - </simpleType> - </restriction> - </simpleType> + <simpleType> + <restriction> + <simpleType name="testType2"> + <restriction base="xsd:int"/> + </simpleType> + </restriction> + </simpleType> </element> EOF; test_schema($schema,'element="tns:testElement"',123.5); diff --git a/ext/soap/tests/schema/schema009.phpt b/ext/soap/tests/schema/schema009.phpt index f7d10242cc..2de815f455 100644 --- a/ext/soap/tests/schema/schema009.phpt +++ b/ext/soap/tests/schema/schema009.phpt @@ -6,9 +6,9 @@ SOAP XML Schema 9: simpleType/list (as string) <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <list itemType="token"/> - </simpleType> + <simpleType name="testType"> + <list itemType="token"/> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',"one two"); echo "ok"; diff --git a/ext/soap/tests/schema/schema010.phpt b/ext/soap/tests/schema/schema010.phpt index 49136b9fe4..b50a5eeb97 100644 --- a/ext/soap/tests/schema/schema010.phpt +++ b/ext/soap/tests/schema/schema010.phpt @@ -6,9 +6,9 @@ SOAP XML Schema 10: simpleType/list (as array) <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <list itemType="token"/> - </simpleType> + <simpleType name="testType"> + <list itemType="token"/> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',array("one","two")); echo "ok"; diff --git a/ext/soap/tests/schema/schema011.phpt b/ext/soap/tests/schema/schema011.phpt index 8296311a46..fca39291f3 100644 --- a/ext/soap/tests/schema/schema011.phpt +++ b/ext/soap/tests/schema/schema011.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 11: simpleType/list (inline type) (as string) <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <list> - <simpleType> - <restriction base="int"/> - </simpleType> - </list> - </simpleType> + <simpleType name="testType"> + <list> + <simpleType> + <restriction base="int"/> + </simpleType> + </list> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',"123 456.7"); echo "ok"; diff --git a/ext/soap/tests/schema/schema012.phpt b/ext/soap/tests/schema/schema012.phpt index 1d542d81d8..d947980c00 100644 --- a/ext/soap/tests/schema/schema012.phpt +++ b/ext/soap/tests/schema/schema012.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 12: simpleType/list (inline type) (as array) <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <list> - <simpleType> - <restriction base="int"/> - </simpleType> - </list> - </simpleType> + <simpleType name="testType"> + <list> + <simpleType> + <restriction base="int"/> + </simpleType> + </list> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',array(123,456.7)); echo "ok"; diff --git a/ext/soap/tests/schema/schema013.phpt b/ext/soap/tests/schema/schema013.phpt index 4794d2d0f1..9c93ae4d2e 100644 --- a/ext/soap/tests/schema/schema013.phpt +++ b/ext/soap/tests/schema/schema013.phpt @@ -6,9 +6,9 @@ SOAP XML Schema 13: simpleType/union <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <union memberTypes="string int float"/> - </simpleType> + <simpleType name="testType"> + <union memberTypes="string int float"/> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',"str"); echo "ok"; diff --git a/ext/soap/tests/schema/schema014.phpt b/ext/soap/tests/schema/schema014.phpt index 3dab5f350b..b2639fc1e2 100644 --- a/ext/soap/tests/schema/schema014.phpt +++ b/ext/soap/tests/schema/schema014.phpt @@ -8,9 +8,9 @@ precision=14 <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <union memberTypes="string int float"/> - </simpleType> + <simpleType name="testType"> + <union memberTypes="string int float"/> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',123.5); echo "ok"; diff --git a/ext/soap/tests/schema/schema015.phpt b/ext/soap/tests/schema/schema015.phpt index fe9b96b8cf..6f280e78a9 100644 --- a/ext/soap/tests/schema/schema015.phpt +++ b/ext/soap/tests/schema/schema015.phpt @@ -6,19 +6,19 @@ SOAP XML Schema 15: simpleType/union (inline type) <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <union> - <simpleType> - <restriction base="string"/> - </simpleType> - <simpleType> - <restriction base="int"/> - </simpleType> - <simpleType> - <restriction base="float"/> - </simpleType> - </union> - </simpleType> + <simpleType name="testType"> + <union> + <simpleType> + <restriction base="string"/> + </simpleType> + <simpleType> + <restriction base="int"/> + </simpleType> + <simpleType> + <restriction base="float"/> + </simpleType> + </union> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',"str"); echo "ok"; diff --git a/ext/soap/tests/schema/schema016.phpt b/ext/soap/tests/schema/schema016.phpt index 11e9436bcb..4878b710c5 100644 --- a/ext/soap/tests/schema/schema016.phpt +++ b/ext/soap/tests/schema/schema016.phpt @@ -8,19 +8,19 @@ precision=14 <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <union> - <simpleType> - <restriction base="string"/> - </simpleType> - <simpleType> - <restriction base="int"/> - </simpleType> - <simpleType> - <restriction base="float"/> - </simpleType> - </union> - </simpleType> + <simpleType name="testType"> + <union> + <simpleType> + <restriction base="string"/> + </simpleType> + <simpleType> + <restriction base="int"/> + </simpleType> + <simpleType> + <restriction base="float"/> + </simpleType> + </union> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',123.5); echo "ok"; diff --git a/ext/soap/tests/schema/schema017.phpt b/ext/soap/tests/schema/schema017.phpt index 6689c363ed..25a1da054a 100644 --- a/ext/soap/tests/schema/schema017.phpt +++ b/ext/soap/tests/schema/schema017.phpt @@ -8,16 +8,16 @@ precision=14 <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <union> - <simpleType> - <restriction base="float"/> - </simpleType> - <simpleType> - <list itemType="int"/> - </simpleType> - </union> - </simpleType> + <simpleType name="testType"> + <union> + <simpleType> + <restriction base="float"/> + </simpleType> + <simpleType> + <list itemType="int"/> + </simpleType> + </union> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',123.5); echo "ok"; diff --git a/ext/soap/tests/schema/schema018.phpt b/ext/soap/tests/schema/schema018.phpt index 0f3e8b84ac..8b85ea8af3 100644 --- a/ext/soap/tests/schema/schema018.phpt +++ b/ext/soap/tests/schema/schema018.phpt @@ -6,16 +6,16 @@ SOAP XML Schema 18: union with list <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <union> - <simpleType> - <restriction base="float"/> - </simpleType> - <simpleType> - <list itemType="int"/> - </simpleType> - </union> - </simpleType> + <simpleType name="testType"> + <union> + <simpleType> + <restriction base="float"/> + </simpleType> + <simpleType> + <list itemType="int"/> + </simpleType> + </union> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',"123.5"); echo "ok"; diff --git a/ext/soap/tests/schema/schema019.phpt b/ext/soap/tests/schema/schema019.phpt index 0d2d753764..afcae9b1b6 100644 --- a/ext/soap/tests/schema/schema019.phpt +++ b/ext/soap/tests/schema/schema019.phpt @@ -6,16 +6,16 @@ SOAP XML Schema 19: union with list <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <union> - <simpleType> - <restriction base="float"/> - </simpleType> - <simpleType> - <list itemType="int"/> - </simpleType> - </union> - </simpleType> + <simpleType name="testType"> + <union> + <simpleType> + <restriction base="float"/> + </simpleType> + <simpleType> + <list itemType="int"/> + </simpleType> + </union> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',"123.5 456.7"); echo "ok"; diff --git a/ext/soap/tests/schema/schema020.phpt b/ext/soap/tests/schema/schema020.phpt index 344757a327..e8ebf500e1 100644 --- a/ext/soap/tests/schema/schema020.phpt +++ b/ext/soap/tests/schema/schema020.phpt @@ -8,16 +8,16 @@ precision=14 <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <union> - <simpleType> - <restriction base="float"/> - </simpleType> - <simpleType> - <list itemType="int"/> - </simpleType> - </union> - </simpleType> + <simpleType name="testType"> + <union> + <simpleType> + <restriction base="float"/> + </simpleType> + <simpleType> + <list itemType="int"/> + </simpleType> + </union> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',array(123.5,456.7)); echo "ok"; diff --git a/ext/soap/tests/schema/schema021.phpt b/ext/soap/tests/schema/schema021.phpt index 0628c6b3b8..18e1394775 100644 --- a/ext/soap/tests/schema/schema021.phpt +++ b/ext/soap/tests/schema/schema021.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 21: list of unions <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <list> - <simpleType> - <union memberTypes="int float str"/> - </simpleType> - </list> - </simpleType> + <simpleType name="testType"> + <list> + <simpleType> + <union memberTypes="int float str"/> + </simpleType> + </list> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',"123 123.5 456.7 str"); echo "ok"; diff --git a/ext/soap/tests/schema/schema022.phpt b/ext/soap/tests/schema/schema022.phpt index a8f5bb9cad..45bcd29c6e 100644 --- a/ext/soap/tests/schema/schema022.phpt +++ b/ext/soap/tests/schema/schema022.phpt @@ -8,13 +8,13 @@ precision=14 <?php include "test_schema.inc"; $schema = <<<EOF - <simpleType name="testType"> - <list> - <simpleType> - <union memberTypes="int float str"/> - </simpleType> - </list> - </simpleType> + <simpleType name="testType"> + <list> + <simpleType> + <union memberTypes="int float str"/> + </simpleType> + </list> + </simpleType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5,'str')); echo "ok"; diff --git a/ext/soap/tests/schema/schema023.phpt b/ext/soap/tests/schema/schema023.phpt index 550bacfe84..31bfe9ae6f 100644 --- a/ext/soap/tests/schema/schema023.phpt +++ b/ext/soap/tests/schema/schema023.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 23: SOAP 1.1 Array <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="SOAP-ENC:Array"> - <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="SOAP-ENC:Array"> + <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema024.phpt b/ext/soap/tests/schema/schema024.phpt index af836d1ffb..cd58f7efb5 100644 --- a/ext/soap/tests/schema/schema024.phpt +++ b/ext/soap/tests/schema/schema024.phpt @@ -6,15 +6,15 @@ SOAP XML Schema 24: SOAP 1.1 Array (second way) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="SOAP-ENC:Array"> - <all> - <element name="x_item" type="int" maxOccurs="unbounded"/> - </all> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="SOAP-ENC:Array"> + <all> + <element name="x_item" type="int" maxOccurs="unbounded"/> + </all> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema025.phpt b/ext/soap/tests/schema/schema025.phpt index 748e45804d..5237e8979e 100644 --- a/ext/soap/tests/schema/schema025.phpt +++ b/ext/soap/tests/schema/schema025.phpt @@ -6,14 +6,14 @@ SOAP XML Schema 25: SOAP 1.2 Array <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> - <attribute ref="enc12:itemType" wsdl:itemType="int"/> - <attribute ref="enc12:arraySize" wsdl:arraySize="*"/> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> + <attribute ref="enc12:itemType" wsdl:itemType="int"/> + <attribute ref="enc12:arraySize" wsdl:arraySize="*"/> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema026.phpt b/ext/soap/tests/schema/schema026.phpt index e17b5ac60b..983ee8e5ef 100644 --- a/ext/soap/tests/schema/schema026.phpt +++ b/ext/soap/tests/schema/schema026.phpt @@ -6,15 +6,15 @@ SOAP XML Schema 26: SOAP 1.2 Array (second way) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> - <all> - <element name="x_item" type="int" maxOccurs="unbounded"/> - </all> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> + <all> + <element name="x_item" type="int" maxOccurs="unbounded"/> + </all> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema027.phpt b/ext/soap/tests/schema/schema027.phpt index e3b382ebe9..39ca3dc3cd 100644 --- a/ext/soap/tests/schema/schema027.phpt +++ b/ext/soap/tests/schema/schema027.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 27: SOAP 1.1 Multidimensional array <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="SOAP-ENC:Array"> - <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[,]"/> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="SOAP-ENC:Array"> + <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[,]"/> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(array(123),array(123.5))); echo "ok"; diff --git a/ext/soap/tests/schema/schema028.phpt b/ext/soap/tests/schema/schema028.phpt index 7cc4ba568a..84a059b602 100644 --- a/ext/soap/tests/schema/schema028.phpt +++ b/ext/soap/tests/schema/schema028.phpt @@ -6,14 +6,14 @@ SOAP XML Schema 28: SOAP 1.2 Multidimensional array <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> - <attribute ref="enc12:itemType" wsdl:itemType="int"/> - <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> + <attribute ref="enc12:itemType" wsdl:itemType="int"/> + <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(array(123),array(123.5))); echo "ok"; diff --git a/ext/soap/tests/schema/schema029.phpt b/ext/soap/tests/schema/schema029.phpt index 2081affc6d..70f1b21e91 100644 --- a/ext/soap/tests/schema/schema029.phpt +++ b/ext/soap/tests/schema/schema029.phpt @@ -6,16 +6,16 @@ SOAP XML Schema 29: SOAP 1.2 Multidimensional array (second way) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> - <all> - <element name="x_item" type="int" maxOccurs="unbounded"/> - </all> - <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> + <all> + <element name="x_item" type="int" maxOccurs="unbounded"/> + </all> + <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(array(123),array(123.5))); echo "ok"; diff --git a/ext/soap/tests/schema/schema030.phpt b/ext/soap/tests/schema/schema030.phpt index e468613916..1047119295 100644 --- a/ext/soap/tests/schema/schema030.phpt +++ b/ext/soap/tests/schema/schema030.phpt @@ -6,12 +6,12 @@ SOAP XML Schema 30: Structure (sequence) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="int" type="int"/> - <element name="str" type="string"/> - </sequence> - </complexType> + <complexType name="testType"> + <sequence> + <element name="int" type="int"/> + <element name="str" type="string"/> + </sequence> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema031.phpt b/ext/soap/tests/schema/schema031.phpt index 479abfee9d..4b03358372 100644 --- a/ext/soap/tests/schema/schema031.phpt +++ b/ext/soap/tests/schema/schema031.phpt @@ -6,12 +6,12 @@ SOAP XML Schema 31: Structure (all) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <all> - <element name="int" type="int"/> - <element name="str" type="string"/> - </all> - </complexType> + <complexType name="testType"> + <all> + <element name="int" type="int"/> + <element name="str" type="string"/> + </all> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema032.phpt b/ext/soap/tests/schema/schema032.phpt index 47b4af121c..397636083c 100644 --- a/ext/soap/tests/schema/schema032.phpt +++ b/ext/soap/tests/schema/schema032.phpt @@ -6,12 +6,12 @@ SOAP XML Schema 32: Structure (choice) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <choice> - <element name="int" type="int"/> - <element name="str" type="string"/> - </choice> - </complexType> + <complexType name="testType"> + <choice> + <element name="int" type="int"/> + <element name="str" type="string"/> + </choice> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema033.phpt b/ext/soap/tests/schema/schema033.phpt index b504bc077a..7c1ce0fc8a 100644 --- a/ext/soap/tests/schema/schema033.phpt +++ b/ext/soap/tests/schema/schema033.phpt @@ -6,17 +6,17 @@ SOAP XML Schema 33: Nested complex types <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType2"> - <sequence> - <element name="int" type="int"/> - </sequence> - </complexType> - <complexType name="testType"> - <sequence> - <element name="int" type="int"/> - <element name="nest" type="tns:testType2"/> - </sequence> - </complexType> + <complexType name="testType2"> + <sequence> + <element name="int" type="int"/> + </sequence> + </complexType> + <complexType name="testType"> + <sequence> + <element name="int" type="int"/> + <element name="nest" type="tns:testType2"/> + </sequence> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"nest"=>array("int"=>123.5))); echo "ok"; diff --git a/ext/soap/tests/schema/schema034.phpt b/ext/soap/tests/schema/schema034.phpt index a83d6ea846..42536d89c3 100644 --- a/ext/soap/tests/schema/schema034.phpt +++ b/ext/soap/tests/schema/schema034.phpt @@ -6,18 +6,18 @@ SOAP XML Schema 34: Nested complex types (element ref) <?php include "test_schema.inc"; $schema = <<<EOF - <element name="testType2" type="tns:testType2"/> - <complexType name="testType2"> - <sequence> - <element name="int" type="int"/> - </sequence> - </complexType> - <complexType name="testType"> - <sequence> - <element name="int" type="int"/> - <element ref="tns:testType2"/> - </sequence> - </complexType> + <element name="testType2" type="tns:testType2"/> + <complexType name="testType2"> + <sequence> + <element name="int" type="int"/> + </sequence> + </complexType> + <complexType name="testType"> + <sequence> + <element name="int" type="int"/> + <element ref="tns:testType2"/> + </sequence> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"testType2"=>array("int"=>123.5))); echo "ok"; diff --git a/ext/soap/tests/schema/schema035.phpt b/ext/soap/tests/schema/schema035.phpt index 8974ed00c5..d62dfbc98e 100644 --- a/ext/soap/tests/schema/schema035.phpt +++ b/ext/soap/tests/schema/schema035.phpt @@ -6,19 +6,19 @@ SOAP XML Schema 35: Nested complex types (element ref + anonymous type) <?php include "test_schema.inc"; $schema = <<<EOF - <element name="testType2"> - <complexType> - <sequence> - <element name="int" type="int"/> - </sequence> - </complexType> - </element> - <complexType name="testType"> - <sequence> - <element name="int" type="int"/> - <element ref="tns:testType2"/> - </sequence> - </complexType> + <element name="testType2"> + <complexType> + <sequence> + <element name="int" type="int"/> + </sequence> + </complexType> + </element> + <complexType name="testType"> + <sequence> + <element name="int" type="int"/> + <element ref="tns:testType2"/> + </sequence> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"testType2"=>array("int"=>123.5))); echo "ok"; diff --git a/ext/soap/tests/schema/schema036.phpt b/ext/soap/tests/schema/schema036.phpt index 9d6dac4534..12c5c40e0b 100644 --- a/ext/soap/tests/schema/schema036.phpt +++ b/ext/soap/tests/schema/schema036.phpt @@ -6,18 +6,18 @@ SOAP XML Schema 36: Nested complex types (inline) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="int" type="int"/> - <element name="testType2"> - <complexType> - <sequence> - <element name="int" type="int"/> - </sequence> - </complexType> - </element> - </sequence> - </complexType> + <complexType name="testType"> + <sequence> + <element name="int" type="int"/> + <element name="testType2"> + <complexType> + <sequence> + <element name="int" type="int"/> + </sequence> + </complexType> + </element> + </sequence> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"testType2"=>array("int"=>123.5))); echo "ok"; diff --git a/ext/soap/tests/schema/schema037.phpt b/ext/soap/tests/schema/schema037.phpt index 4e59981fc9..dbc5dc38c8 100644 --- a/ext/soap/tests/schema/schema037.phpt +++ b/ext/soap/tests/schema/schema037.phpt @@ -6,12 +6,12 @@ SOAP XML Schema 37: Structure with attributes <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="str" type="string"/> - </sequence> - <attribute name="int" type="int"/> - </complexType> + <complexType name="testType"> + <sequence> + <element name="str" type="string"/> + </sequence> + <attribute name="int" type="int"/> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema038.phpt b/ext/soap/tests/schema/schema038.phpt index 2d37e89e0b..70b5b207ee 100644 --- a/ext/soap/tests/schema/schema038.phpt +++ b/ext/soap/tests/schema/schema038.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 38: Structure with attributes (ref) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="str" type="string"/> - </sequence> - <attribute ref="tns:int"/> - </complexType> - <attribute name="int" type="int"/> + <complexType name="testType"> + <sequence> + <element name="str" type="string"/> + </sequence> + <attribute ref="tns:int"/> + </complexType> + <attribute name="int" type="int"/> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema039.phpt b/ext/soap/tests/schema/schema039.phpt index 0b7ef5afc4..5b3f454bf9 100644 --- a/ext/soap/tests/schema/schema039.phpt +++ b/ext/soap/tests/schema/schema039.phpt @@ -6,15 +6,15 @@ SOAP XML Schema 39: Structure with attributes (attributeGroup) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="str" type="string"/> - </sequence> - <attributeGroup ref="tns:intGroup"/> - </complexType> - <attributeGroup name="intGroup"> - <attribute name="int" type="int"/> - </attributeGroup> + <complexType name="testType"> + <sequence> + <element name="str" type="string"/> + </sequence> + <attributeGroup ref="tns:intGroup"/> + </complexType> + <attributeGroup name="intGroup"> + <attribute name="int" type="int"/> + </attributeGroup> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema040.phpt b/ext/soap/tests/schema/schema040.phpt index f7ddc04546..51bcd776e1 100644 --- a/ext/soap/tests/schema/schema040.phpt +++ b/ext/soap/tests/schema/schema040.phpt @@ -6,16 +6,16 @@ SOAP XML Schema 40: Structure with attributes (inline types) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="str" type="string"/> - </sequence> - <attribute name="int"> - <simpleType> - <restriction base="int"/> - </simpleType> - </attribute> - </complexType> + <complexType name="testType"> + <sequence> + <element name="str" type="string"/> + </sequence> + <attribute name="int"> + <simpleType> + <restriction base="int"/> + </simpleType> + </attribute> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema041.phpt b/ext/soap/tests/schema/schema041.phpt index 1264cf5c90..4613f15729 100644 --- a/ext/soap/tests/schema/schema041.phpt +++ b/ext/soap/tests/schema/schema041.phpt @@ -6,15 +6,15 @@ SOAP XML Schema 41: Structure (group) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <group ref="tns:testGroup"/> - </complexType> - <group name="testGroup"> - <sequence> - <element name="int" type="int"/> - <element name="str" type="string"/> - </sequence> - </group> + <complexType name="testType"> + <group ref="tns:testGroup"/> + </complexType> + <group name="testGroup"> + <sequence> + <element name="int" type="int"/> + <element name="str" type="string"/> + </sequence> + </group> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema042.phpt b/ext/soap/tests/schema/schema042.phpt index a8aa8857d9..c0a938aa27 100644 --- a/ext/soap/tests/schema/schema042.phpt +++ b/ext/soap/tests/schema/schema042.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 42: Extension of simple type <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <simpleContent> - <extension base="int"> - <attribute name="int" type="int"/> - </extension> - </simpleContent> - </complexType> + <complexType name="testType"> + <simpleContent> + <extension base="int"> + <attribute name="int" type="int"/> + </extension> + </simpleContent> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema043.phpt b/ext/soap/tests/schema/schema043.phpt index 08c2996363..cc628eefea 100644 --- a/ext/soap/tests/schema/schema043.phpt +++ b/ext/soap/tests/schema/schema043.phpt @@ -6,20 +6,20 @@ SOAP XML Schema 43: Extension of simple type (2) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType2"> - <simpleContent> - <extension base="int"> - <attribute name="int" type="int"/> - </extension> - </simpleContent> - </complexType> - <complexType name="testType"> - <simpleContent> - <extension base="tns:testType2"> - <attribute name="int2" type="int"/> - </extension> - </simpleContent> - </complexType> + <complexType name="testType2"> + <simpleContent> + <extension base="int"> + <attribute name="int" type="int"/> + </extension> + </simpleContent> + </complexType> + <complexType name="testType"> + <simpleContent> + <extension base="tns:testType2"> + <attribute name="int2" type="int"/> + </extension> + </simpleContent> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5,"int2"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema044.phpt b/ext/soap/tests/schema/schema044.phpt index 8fc0705518..3158d46049 100644 --- a/ext/soap/tests/schema/schema044.phpt +++ b/ext/soap/tests/schema/schema044.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 44: Restriction of simple type <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <simpleContent> - <restriction base="int"> - <attribute name="int" type="int"/> - </restriction> - </simpleContent> - </complexType> + <complexType name="testType"> + <simpleContent> + <restriction base="int"> + <attribute name="int" type="int"/> + </restriction> + </simpleContent> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema045.phpt b/ext/soap/tests/schema/schema045.phpt index 346a929d85..8055b39914 100644 --- a/ext/soap/tests/schema/schema045.phpt +++ b/ext/soap/tests/schema/schema045.phpt @@ -6,20 +6,20 @@ SOAP XML Schema 45: Restriction of simple type (2) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType2"> - <simpleContent> - <extension base="int"> - <attribute name="int" type="int"/> - </extension> - </simpleContent> - </complexType> - <complexType name="testType"> - <simpleContent> - <restriction base="tns:testType2"> - <attribute name="int2" type="int"/> - </restriction> - </simpleContent> - </complexType> + <complexType name="testType2"> + <simpleContent> + <extension base="int"> + <attribute name="int" type="int"/> + </extension> + </simpleContent> + </complexType> + <complexType name="testType"> + <simpleContent> + <restriction base="tns:testType2"> + <attribute name="int2" type="int"/> + </restriction> + </simpleContent> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5,"int2"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema046.phpt b/ext/soap/tests/schema/schema046.phpt index 3f9d03afad..9f3efd79ca 100644 --- a/ext/soap/tests/schema/schema046.phpt +++ b/ext/soap/tests/schema/schema046.phpt @@ -6,20 +6,20 @@ SOAP XML Schema 46: Extension of complex type <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType2"> - <simpleContent> - <extension base="int"> - <attribute name="int" type="int"/> - </extension> - </simpleContent> - </complexType> - <complexType name="testType"> - <complexContent> - <extension base="tns:testType2"> - <attribute name="int2" type="int"/> - </extension> - </complexContent> - </complexType> + <complexType name="testType2"> + <simpleContent> + <extension base="int"> + <attribute name="int" type="int"/> + </extension> + </simpleContent> + </complexType> + <complexType name="testType"> + <complexContent> + <extension base="tns:testType2"> + <attribute name="int2" type="int"/> + </extension> + </complexContent> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5,"int2"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema047.phpt b/ext/soap/tests/schema/schema047.phpt index 1265cfd3a3..a67973eeb0 100644 --- a/ext/soap/tests/schema/schema047.phpt +++ b/ext/soap/tests/schema/schema047.phpt @@ -6,18 +6,18 @@ SOAP XML Schema 47: Extension of complex type (2) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType2"> - <sequence> - <element name="int" type="int"/> - </sequence> - </complexType> - <complexType name="testType"> - <complexContent> - <extension base="tns:testType2"> - <attribute name="int2" type="int"/> - </extension> - </complexContent> - </complexType> + <complexType name="testType2"> + <sequence> + <element name="int" type="int"/> + </sequence> + </complexType> + <complexType name="testType"> + <complexContent> + <extension base="tns:testType2"> + <attribute name="int2" type="int"/> + </extension> + </complexContent> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5,"int2"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema048.phpt b/ext/soap/tests/schema/schema048.phpt index 98d4d4be44..c2a372e1d1 100644 --- a/ext/soap/tests/schema/schema048.phpt +++ b/ext/soap/tests/schema/schema048.phpt @@ -6,20 +6,20 @@ SOAP XML Schema 48: Restriction of complex type <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType2"> - <simpleContent> - <extension base="int"> - <attribute name="int" type="int"/> - </extension> - </simpleContent> - </complexType> - <complexType name="testType"> - <complexContent> - <restriction base="tns:testType2"> - <attribute name="int2" type="int"/> - </restriction> - </complexContent> - </complexType> + <complexType name="testType2"> + <simpleContent> + <extension base="int"> + <attribute name="int" type="int"/> + </extension> + </simpleContent> + </complexType> + <complexType name="testType"> + <complexContent> + <restriction base="tns:testType2"> + <attribute name="int2" type="int"/> + </restriction> + </complexContent> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5,"int2"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema049.phpt b/ext/soap/tests/schema/schema049.phpt index 7268a4b67a..84b22fe5e7 100644 --- a/ext/soap/tests/schema/schema049.phpt +++ b/ext/soap/tests/schema/schema049.phpt @@ -6,21 +6,21 @@ SOAP XML Schema 49: Restriction of complex type (2) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType2"> - <sequence> - <element name="int" type="int"/> - <element name="int2" type="int"/> - </sequence> - </complexType> - <complexType name="testType"> - <complexContent> - <restriction base="tns:testType2"> - <sequence> - <element name="int2" type="int"/> - </sequence> - </restriction> - </complexContent> - </complexType> + <complexType name="testType2"> + <sequence> + <element name="int" type="int"/> + <element name="int2" type="int"/> + </sequence> + </complexType> + <complexType name="testType"> + <complexContent> + <restriction base="tns:testType2"> + <sequence> + <element name="int2" type="int"/> + </sequence> + </restriction> + </complexContent> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5,"int2"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema050.phpt b/ext/soap/tests/schema/schema050.phpt index 6c735125b7..0bb3d35dc9 100644 --- a/ext/soap/tests/schema/schema050.phpt +++ b/ext/soap/tests/schema/schema050.phpt @@ -6,12 +6,12 @@ SOAP XML Schema 50: Array in complex type (maxOccurs > 1, one value) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="int" type="int"/> - <element name="int2" type="int" maxOccurs="unbounded"/> - </sequence> - </complexType> + <complexType name="testType"> + <sequence> + <element name="int" type="int"/> + <element name="int2" type="int" maxOccurs="unbounded"/> + </sequence> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"int2"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema051.phpt b/ext/soap/tests/schema/schema051.phpt index 9636399814..0f5ad8b718 100644 --- a/ext/soap/tests/schema/schema051.phpt +++ b/ext/soap/tests/schema/schema051.phpt @@ -6,12 +6,12 @@ SOAP XML Schema 51: Array in complex type (maxOccurs > 1, array) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="int" type="int"/> - <element name="int2" type="int" maxOccurs="unbounded"/> - </sequence> - </complexType> + <complexType name="testType"> + <sequence> + <element name="int" type="int"/> + <element name="int2" type="int" maxOccurs="unbounded"/> + </sequence> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"int2"=>array(123.5,456.7))); echo "ok"; diff --git a/ext/soap/tests/schema/schema052.phpt b/ext/soap/tests/schema/schema052.phpt index 8e7121ae2d..5e30c8287e 100644 --- a/ext/soap/tests/schema/schema052.phpt +++ b/ext/soap/tests/schema/schema052.phpt @@ -6,12 +6,12 @@ SOAP XML Schema 52: Array in complex type (maxOccurs > 1, array with one value) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="int" type="int"/> - <element name="int2" type="int" maxOccurs="unbounded"/> - </sequence> - </complexType> + <complexType name="testType"> + <sequence> + <element name="int" type="int"/> + <element name="int2" type="int" maxOccurs="unbounded"/> + </sequence> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"int2"=>array(123.5))); echo "ok"; diff --git a/ext/soap/tests/schema/schema053.phpt b/ext/soap/tests/schema/schema053.phpt index 8893bf5df3..f276978a4c 100644 --- a/ext/soap/tests/schema/schema053.phpt +++ b/ext/soap/tests/schema/schema053.phpt @@ -6,12 +6,12 @@ SOAP XML Schema 52: Array in complex type (maxOccurs > 1, empty array) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="int" type="int"/> - <element name="int2" type="int" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - </complexType> + <complexType name="testType"> + <sequence> + <element name="int" type="int"/> + <element name="int2" type="int" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"int2"=>array())); echo "ok"; diff --git a/ext/soap/tests/schema/schema055.phpt b/ext/soap/tests/schema/schema055.phpt index 14dbdb7c1d..1a23e2fa6e 100644 --- a/ext/soap/tests/schema/schema055.phpt +++ b/ext/soap/tests/schema/schema055.phpt @@ -8,12 +8,12 @@ precision=14 <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <extension base="apache:Map" xmlns:apache="http://xml.apache.org/xml-soap"> - </extension> + <complexType name="testType"> + <complexContent> + <extension base="apache:Map" xmlns:apache="http://xml.apache.org/xml-soap"> + </extension> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="testType"',array('a'=>123,'b'=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema056.phpt b/ext/soap/tests/schema/schema056.phpt index 1ada78ea2a..d2aac098d0 100644 --- a/ext/soap/tests/schema/schema056.phpt +++ b/ext/soap/tests/schema/schema056.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 56: SOAP 1.1 Array (literal encoding) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="SOAP-ENC:Array"> - <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="SOAP-ENC:Array"> + <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5),'rpc','literal'); echo "ok"; diff --git a/ext/soap/tests/schema/schema057.phpt b/ext/soap/tests/schema/schema057.phpt index 1848b9c24a..13521b2a60 100644 --- a/ext/soap/tests/schema/schema057.phpt +++ b/ext/soap/tests/schema/schema057.phpt @@ -6,15 +6,15 @@ SOAP XML Schema 57: SOAP 1.1 Array (second way, literal encoding) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="SOAP-ENC:Array"> - <all> - <element name="x_item" type="int" maxOccurs="unbounded"/> - </all> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="SOAP-ENC:Array"> + <all> + <element name="x_item" type="int" maxOccurs="unbounded"/> + </all> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5),'rpc','literal'); echo "ok"; diff --git a/ext/soap/tests/schema/schema058.phpt b/ext/soap/tests/schema/schema058.phpt index b96fc9fcca..aee0a96111 100644 --- a/ext/soap/tests/schema/schema058.phpt +++ b/ext/soap/tests/schema/schema058.phpt @@ -6,14 +6,14 @@ SOAP XML Schema 58: SOAP 1.2 Array (literal encoding) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> - <attribute ref="enc12:itemType" wsdl:itemType="int"/> - <attribute ref="enc12:arraySize" wsdl:arraySize="*"/> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> + <attribute ref="enc12:itemType" wsdl:itemType="int"/> + <attribute ref="enc12:arraySize" wsdl:arraySize="*"/> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5),'rpc','literal'); echo "ok"; diff --git a/ext/soap/tests/schema/schema059.phpt b/ext/soap/tests/schema/schema059.phpt index 875bae9868..bbed854fbb 100644 --- a/ext/soap/tests/schema/schema059.phpt +++ b/ext/soap/tests/schema/schema059.phpt @@ -6,15 +6,15 @@ SOAP XML Schema 59: SOAP 1.2 Array (second way, literal encoding) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> - <all> - <element name="x_item" type="int" maxOccurs="unbounded"/> - </all> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> + <all> + <element name="x_item" type="int" maxOccurs="unbounded"/> + </all> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5),'rpc','literal'); echo "ok"; diff --git a/ext/soap/tests/schema/schema060.phpt b/ext/soap/tests/schema/schema060.phpt index 4daa83c191..9029a470e4 100644 --- a/ext/soap/tests/schema/schema060.phpt +++ b/ext/soap/tests/schema/schema060.phpt @@ -6,14 +6,14 @@ SOAP XML Schema 60: SOAP 1.2 Multidimensional array (literal encoding) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> - <attribute ref="enc12:itemType" wsdl:itemType="int"/> - <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> + <attribute ref="enc12:itemType" wsdl:itemType="int"/> + <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(array(123),array(123.5)),'rpc','literal'); echo "ok"; diff --git a/ext/soap/tests/schema/schema061.phpt b/ext/soap/tests/schema/schema061.phpt index bbd2aa6579..73cf1546d9 100644 --- a/ext/soap/tests/schema/schema061.phpt +++ b/ext/soap/tests/schema/schema061.phpt @@ -6,16 +6,16 @@ SOAP XML Schema 61: SOAP 1.2 Multidimensional array (second way, literal encodin <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> - <all> - <element name="x_item" type="int" maxOccurs="unbounded"/> - </all> - <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> + <all> + <element name="x_item" type="int" maxOccurs="unbounded"/> + </all> + <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(array(123),array(123.5)),'rpc','literal'); echo "ok"; diff --git a/ext/soap/tests/schema/schema062.phpt b/ext/soap/tests/schema/schema062.phpt index 60b06568ed..ae26c7b1cd 100644 --- a/ext/soap/tests/schema/schema062.phpt +++ b/ext/soap/tests/schema/schema062.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 62: NULL with attributes <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <simpleContent> - <restriction base="int"> - <attribute name="int" type="int"/> - </restriction> - </simpleContent> - </complexType> + <complexType name="testType"> + <simpleContent> + <restriction base="int"> + <attribute name="int" type="int"/> + </restriction> + </simpleContent> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("_"=>NULL,"int"=>123.5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema064.phpt b/ext/soap/tests/schema/schema064.phpt index 913cbd16e0..88f58cf8ce 100644 --- a/ext/soap/tests/schema/schema064.phpt +++ b/ext/soap/tests/schema/schema064.phpt @@ -10,30 +10,30 @@ require_once('skipif.inc'); ?> <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="dateTime" type="dateTime"/> - <element name="time" type="time"/> - <element name="date" type="date"/> - <element name="gYearMonth" type="gYearMonth"/> - <element name="gYear" type="gYear"/> - <element name="gMonthDay" type="gMonthDay"/> - <element name="gDay" type="gDay"/> - <element name="gMonth" type="gMonth"/> - </sequence> - </complexType> + <complexType name="testType"> + <sequence> + <element name="dateTime" type="dateTime"/> + <element name="time" type="time"/> + <element name="date" type="date"/> + <element name="gYearMonth" type="gYearMonth"/> + <element name="gYear" type="gYear"/> + <element name="gMonthDay" type="gMonthDay"/> + <element name="gDay" type="gDay"/> + <element name="gMonth" type="gMonth"/> + </sequence> + </complexType> EOF; $date = gmmktime(1,2,3,4,5,1976); putenv('TZ=GMT'); test_schema($schema,'type="tns:testType"',array( - 'dateTime' => $date, - 'time' => $date, - 'date' => $date, - 'gYearMonth' => $date, - 'gYear' => $date, - 'gMonthDay' => $date, - 'gDay' => $date, - 'gMonth' => $date + 'dateTime' => $date, + 'time' => $date, + 'date' => $date, + 'gYearMonth' => $date, + 'gYear' => $date, + 'gMonthDay' => $date, + 'gDay' => $date, + 'gMonth' => $date )); echo "ok"; ?> diff --git a/ext/soap/tests/schema/schema065.phpt b/ext/soap/tests/schema/schema065.phpt index 3199a6bc8f..0e5a66cd3f 100644 --- a/ext/soap/tests/schema/schema065.phpt +++ b/ext/soap/tests/schema/schema065.phpt @@ -6,10 +6,10 @@ SOAP XML Schema 65: Attribute with default value <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <attribute name="str" type="string"/> - <attribute name="int" type="int" default="5"/> - </complexType> + <complexType name="testType"> + <attribute name="str" type="string"/> + <attribute name="int" type="int" default="5"/> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str")); echo "ok"; diff --git a/ext/soap/tests/schema/schema066.phpt b/ext/soap/tests/schema/schema066.phpt index 7fe47bbd2c..c6692535a6 100644 --- a/ext/soap/tests/schema/schema066.phpt +++ b/ext/soap/tests/schema/schema066.phpt @@ -6,10 +6,10 @@ SOAP XML Schema 66: Attribute with fixed value (1) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <attribute name="str" type="string"/> - <attribute name="int" type="int" fixed="5"/> - </complexType> + <complexType name="testType"> + <attribute name="str" type="string"/> + <attribute name="int" type="int" fixed="5"/> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str")); echo "ok"; diff --git a/ext/soap/tests/schema/schema067.phpt b/ext/soap/tests/schema/schema067.phpt index 5ee0036ebe..7fb7eff233 100644 --- a/ext/soap/tests/schema/schema067.phpt +++ b/ext/soap/tests/schema/schema067.phpt @@ -6,10 +6,10 @@ SOAP XML Schema 67: Attribute with fixed value (2) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <attribute name="str" type="string"/> - <attribute name="int" type="int" fixed="5"/> - </complexType> + <complexType name="testType"> + <attribute name="str" type="string"/> + <attribute name="int" type="int" fixed="5"/> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>5)); echo "ok"; diff --git a/ext/soap/tests/schema/schema068.phpt b/ext/soap/tests/schema/schema068.phpt index 5ab63be097..4372cdfa23 100644 --- a/ext/soap/tests/schema/schema068.phpt +++ b/ext/soap/tests/schema/schema068.phpt @@ -6,10 +6,10 @@ SOAP XML Schema 68: Attribute with fixed value (3) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <attribute name="str" type="string"/> - <attribute name="int" type="int" fixed="5"/> - </complexType> + <complexType name="testType"> + <attribute name="str" type="string"/> + <attribute name="int" type="int" fixed="5"/> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>4)); echo "ok"; diff --git a/ext/soap/tests/schema/schema069.phpt b/ext/soap/tests/schema/schema069.phpt index ccaa342406..d944765e32 100644 --- a/ext/soap/tests/schema/schema069.phpt +++ b/ext/soap/tests/schema/schema069.phpt @@ -6,11 +6,11 @@ SOAP XML Schema 69: Attribute with default value (reference) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <attribute name="str" type="string"/> - <attribute ref="tns:int"/> - </complexType> - <attribute name="int" type="int" default="5"/> + <complexType name="testType"> + <attribute name="str" type="string"/> + <attribute ref="tns:int"/> + </complexType> + <attribute name="int" type="int" default="5"/> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str")); echo "ok"; diff --git a/ext/soap/tests/schema/schema070.phpt b/ext/soap/tests/schema/schema070.phpt index 0c1e249392..3135183398 100644 --- a/ext/soap/tests/schema/schema070.phpt +++ b/ext/soap/tests/schema/schema070.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 70: Attribute with default value (attributeGroup) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <attribute name="str" type="string"/> - <attributeGroup ref="tns:int_group"/> - </complexType> - <attributeGroup name="int_group"> - <attribute name="int" type="int" default="5"/> - </attributeGroup> + <complexType name="testType"> + <attribute name="str" type="string"/> + <attributeGroup ref="tns:int_group"/> + </complexType> + <attributeGroup name="int_group"> + <attribute name="int" type="int" default="5"/> + </attributeGroup> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str")); echo "ok"; diff --git a/ext/soap/tests/schema/schema071.phpt b/ext/soap/tests/schema/schema071.phpt index 1991f7ad8e..65ea47bf9e 100644 --- a/ext/soap/tests/schema/schema071.phpt +++ b/ext/soap/tests/schema/schema071.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 71: SOAP 1.1 Array (document style) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="SOAP-ENC:Array"> - <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="SOAP-ENC:Array"> + <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5),'document','literal'); echo "ok"; diff --git a/ext/soap/tests/schema/schema072.phpt b/ext/soap/tests/schema/schema072.phpt index 89a0ed3597..cbf08db00b 100644 --- a/ext/soap/tests/schema/schema072.phpt +++ b/ext/soap/tests/schema/schema072.phpt @@ -6,15 +6,15 @@ SOAP XML Schema 72: SOAP 1.1 Array (document style, element with inline type) <?php include "test_schema.inc"; $schema = <<<EOF - <element name="testElement"> - <complexType name="testType"> - <complexContent> - <restriction base="SOAP-ENC:Array"> - <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/> - </restriction> + <element name="testElement"> + <complexType name="testType"> + <complexContent> + <restriction base="SOAP-ENC:Array"> + <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/> + </restriction> </complexContent> - </complexType> - </element> + </complexType> + </element> EOF; test_schema($schema,'element="tns:testElement"',array(123,123.5),'document','literal'); echo "ok"; diff --git a/ext/soap/tests/schema/schema073.phpt b/ext/soap/tests/schema/schema073.phpt index 22dd9e2604..3338684a9b 100644 --- a/ext/soap/tests/schema/schema073.phpt +++ b/ext/soap/tests/schema/schema073.phpt @@ -6,14 +6,14 @@ SOAP XML Schema 73: SOAP 1.1 Array (document style, element with type ref) <?php include "test_schema.inc"; $schema = <<<EOF - <element name="testElement" type="tns:testType"/> - <complexType name="testType"> - <complexContent> - <restriction base="SOAP-ENC:Array"> - <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/> - </restriction> + <element name="testElement" type="tns:testType"/> + <complexType name="testType"> + <complexContent> + <restriction base="SOAP-ENC:Array"> + <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'element="tns:testElement"',array(123,123.5),'document','literal'); echo "ok"; diff --git a/ext/soap/tests/schema/schema074.phpt b/ext/soap/tests/schema/schema074.phpt index 3dbba0cd25..4735957bfa 100644 --- a/ext/soap/tests/schema/schema074.phpt +++ b/ext/soap/tests/schema/schema074.phpt @@ -6,12 +6,12 @@ SOAP XML Schema 74: Structure with attributes and qualified elements <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="str" type="string"/> - </sequence> - <attribute name="int" type="int"/> - </complexType> + <complexType name="testType"> + <sequence> + <element name="str" type="string"/> + </sequence> + <attribute name="int" type="int"/> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5), "rpc", "encoded", 'attributeFormDefault="qualified"'); diff --git a/ext/soap/tests/schema/schema075.phpt b/ext/soap/tests/schema/schema075.phpt index 5867e55a7c..eb3729a9b2 100644 --- a/ext/soap/tests/schema/schema075.phpt +++ b/ext/soap/tests/schema/schema075.phpt @@ -6,11 +6,11 @@ SOAP XML Schema 75: Attributes form qualified/unqualified (attributeFormDefault= <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <attribute name="int1" type="int"/> - <attribute name="int2" type="int" form="qualified"/> - <attribute name="int3" type="int" form="unqualified"/> - </complexType> + <complexType name="testType"> + <attribute name="int1" type="int"/> + <attribute name="int2" type="int" form="qualified"/> + <attribute name="int3" type="int" form="unqualified"/> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int1"=>1.1,"int2"=>2.2,"int3"=>3.3), "rpc", "encoded", 'attributeFormDefault="qualified"'); diff --git a/ext/soap/tests/schema/schema076.phpt b/ext/soap/tests/schema/schema076.phpt index 3ad2eae33a..d4940deb6b 100644 --- a/ext/soap/tests/schema/schema076.phpt +++ b/ext/soap/tests/schema/schema076.phpt @@ -6,11 +6,11 @@ SOAP XML Schema 76: Attributes form qualified/unqualified (attributeFormDefault= <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <attribute name="int1" type="int"/> - <attribute name="int2" type="int" form="qualified"/> - <attribute name="int3" type="int" form="unqualified"/> - </complexType> + <complexType name="testType"> + <attribute name="int1" type="int"/> + <attribute name="int2" type="int" form="qualified"/> + <attribute name="int3" type="int" form="unqualified"/> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int1"=>1.1,"int2"=>2.2,"int3"=>3.3), "rpc", "encoded", 'attributeFormDefault="unqualified"'); diff --git a/ext/soap/tests/schema/schema077.phpt b/ext/soap/tests/schema/schema077.phpt index 16057cfcf9..7da8b4a1a2 100644 --- a/ext/soap/tests/schema/schema077.phpt +++ b/ext/soap/tests/schema/schema077.phpt @@ -6,11 +6,11 @@ SOAP XML Schema 77: Attributes form qualified/unqualified (attributeFormDefault <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <attribute name="int1" type="int"/> - <attribute name="int2" type="int" form="qualified"/> - <attribute name="int3" type="int" form="unqualified"/> - </complexType> + <complexType name="testType"> + <attribute name="int1" type="int"/> + <attribute name="int2" type="int" form="qualified"/> + <attribute name="int3" type="int" form="unqualified"/> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int1"=>1.1,"int2"=>2.2,"int3"=>3.3), "rpc", "encoded"); diff --git a/ext/soap/tests/schema/schema078.phpt b/ext/soap/tests/schema/schema078.phpt index 7636a78f93..a051acd8f2 100644 --- a/ext/soap/tests/schema/schema078.phpt +++ b/ext/soap/tests/schema/schema078.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 78: Element form qualified/unqualified (elementFormDefault="qual <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="int1" type="int"/> - <element name="int2" type="int" form="qualified"/> - <element name="int3" type="int" form="unqualified"/> - </sequence> - </complexType> + <complexType name="testType"> + <sequence> + <element name="int1" type="int"/> + <element name="int2" type="int" form="qualified"/> + <element name="int3" type="int" form="unqualified"/> + </sequence> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int1"=>1.1,"int2"=>2.2,"int3"=>3.3), "rpc", "literal", 'elementFormDefault="qualified"'); diff --git a/ext/soap/tests/schema/schema079.phpt b/ext/soap/tests/schema/schema079.phpt index 34dcd9bee7..de1a4480fe 100644 --- a/ext/soap/tests/schema/schema079.phpt +++ b/ext/soap/tests/schema/schema079.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 79: Element form qualified/unqualified (elementFormDefault="unqu <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="int1" type="int"/> - <element name="int2" type="int" form="qualified"/> - <element name="int3" type="int" form="unqualified"/> - </sequence> - </complexType> + <complexType name="testType"> + <sequence> + <element name="int1" type="int"/> + <element name="int2" type="int" form="qualified"/> + <element name="int3" type="int" form="unqualified"/> + </sequence> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int1"=>1.1,"int2"=>2.2,"int3"=>3.3), "rpc", "literal", 'elementFormDefault="unqualified"'); diff --git a/ext/soap/tests/schema/schema080.phpt b/ext/soap/tests/schema/schema080.phpt index 7519d6a30d..926bc8ae22 100644 --- a/ext/soap/tests/schema/schema080.phpt +++ b/ext/soap/tests/schema/schema080.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 80: Element form qualified/unqualified (elementFormDefault - def <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <sequence> - <element name="int1" type="int"/> - <element name="int2" type="int" form="qualified"/> - <element name="int3" type="int" form="unqualified"/> - </sequence> - </complexType> + <complexType name="testType"> + <sequence> + <element name="int1" type="int"/> + <element name="int2" type="int" form="qualified"/> + <element name="int3" type="int" form="unqualified"/> + </sequence> + </complexType> EOF; test_schema($schema,'type="tns:testType"',(object)array("int1"=>1.1,"int2"=>2.2,"int3"=>3.3), "rpc", "literal"); diff --git a/ext/soap/tests/schema/schema081.phpt b/ext/soap/tests/schema/schema081.phpt index 337f081261..976d95baf8 100644 --- a/ext/soap/tests/schema/schema081.phpt +++ b/ext/soap/tests/schema/schema081.phpt @@ -6,13 +6,13 @@ SOAP XML Schema 81: SOAP 1.1 Array with SOAP_USE_XSI_ARRAY_TYPE <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="SOAP-ENC:Array"> - <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="SOAP-ENC:Array"> + <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5),"rpc","encoded",'',SOAP_USE_XSI_ARRAY_TYPE); echo "ok"; diff --git a/ext/soap/tests/schema/schema082.phpt b/ext/soap/tests/schema/schema082.phpt index 34c4c76c25..229e566afc 100644 --- a/ext/soap/tests/schema/schema082.phpt +++ b/ext/soap/tests/schema/schema082.phpt @@ -6,15 +6,15 @@ SOAP XML Schema 82: SOAP 1.1 Array with SOAP_USE_XSI_ARRAY_TYPE (second way) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="SOAP-ENC:Array"> - <all> - <element name="x_item" type="int" maxOccurs="unbounded"/> - </all> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="SOAP-ENC:Array"> + <all> + <element name="x_item" type="int" maxOccurs="unbounded"/> + </all> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5),"rpc","encoded",'',SOAP_USE_XSI_ARRAY_TYPE); echo "ok"; diff --git a/ext/soap/tests/schema/schema083.phpt b/ext/soap/tests/schema/schema083.phpt index 854c4f9ff6..8bcf602305 100644 --- a/ext/soap/tests/schema/schema083.phpt +++ b/ext/soap/tests/schema/schema083.phpt @@ -6,14 +6,14 @@ SOAP XML Schema 83: SOAP 1.2 Array with SOAP_USE_XSI_ARRAY_TYPE <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> - <attribute ref="enc12:itemType" wsdl:itemType="int"/> - <attribute ref="enc12:arraySize" wsdl:arraySize="*"/> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> + <attribute ref="enc12:itemType" wsdl:itemType="int"/> + <attribute ref="enc12:arraySize" wsdl:arraySize="*"/> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5),"rpc","encoded",'',SOAP_USE_XSI_ARRAY_TYPE); echo "ok"; diff --git a/ext/soap/tests/schema/schema084.phpt b/ext/soap/tests/schema/schema084.phpt index 94a9551faf..62804c9ccc 100644 --- a/ext/soap/tests/schema/schema084.phpt +++ b/ext/soap/tests/schema/schema084.phpt @@ -6,15 +6,15 @@ SOAP XML Schema 84: SOAP 1.2 Array with SOAP_USE_XSI_ARRAY_TYPE (second way) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType"> - <complexContent> - <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> - <all> - <element name="x_item" type="int" maxOccurs="unbounded"/> - </all> - </restriction> + <complexType name="testType"> + <complexContent> + <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"> + <all> + <element name="x_item" type="int" maxOccurs="unbounded"/> + </all> + </restriction> </complexContent> - </complexType> + </complexType> EOF; test_schema($schema,'type="tns:testType"',array(123,123.5),"rpc","encoded",'',SOAP_USE_XSI_ARRAY_TYPE); echo "ok"; diff --git a/ext/soap/tests/schema/schema085.phpt b/ext/soap/tests/schema/schema085.phpt index 1a1ab15999..206553bb51 100644 --- a/ext/soap/tests/schema/schema085.phpt +++ b/ext/soap/tests/schema/schema085.phpt @@ -6,20 +6,20 @@ SOAP XML Schema 85: Extension of complex type (elements order) <?php include "test_schema.inc"; $schema = <<<EOF - <complexType name="testType2"> - <sequence> - <element name="int" type="int"/> - </sequence> - </complexType> - <complexType name="testType"> - <complexContent> - <extension base="tns:testType2"> - <sequence> - <element name="int2" type="int"/> - </sequence> - </extension> - </complexContent> - </complexType> + <complexType name="testType2"> + <sequence> + <element name="int" type="int"/> + </sequence> + </complexType> + <complexType name="testType"> + <complexContent> + <extension base="tns:testType2"> + <sequence> + <element name="int2" type="int"/> + </sequence> + </extension> + </complexContent> + </complexType> EOF; class A { public $int = 1; diff --git a/ext/soap/tests/schema/test_schema.inc b/ext/soap/tests/schema/test_schema.inc index 7afc4e697c..a0ba2c4dc1 100644 --- a/ext/soap/tests/schema/test_schema.inc +++ b/ext/soap/tests/schema/test_schema.inc @@ -2,8 +2,8 @@ $val = null; function test($input) { - global $val; - $val = $input; + global $val; + $val = $input; } function test_schema($schema,$type,$param,$style="rpc",$use="encoded", $attributeFormDefault='',$features=0) { @@ -22,27 +22,27 @@ $wsdl = <<<EOF <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://test-uri/" $attributeFormDefault> <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" /> - $schema + $schema </schema> </types> <message name="testMessage"> - <part name="testParam" $type/> + <part name="testParam" $type/> </message> - <portType name="testPortType"> - <operation name="test"> - <input message="testMessage"/> - </operation> - </portType> - <binding name="testBinding" type="testPortType"> - <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> - <operation name="test"> - <soap:operation soapAction="#test" style="$style"/> - <input> - <soap:body use="$use" namespace="http://test-uri/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> - </input> - </operation> - </binding> - <service name="testService"> + <portType name="testPortType"> + <operation name="test"> + <input message="testMessage"/> + </operation> + </portType> + <binding name="testBinding" type="testPortType"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> + <operation name="test"> + <soap:operation soapAction="#test" style="$style"/> + <input> + <soap:body use="$use" namespace="http://test-uri/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> + </input> + </operation> + </binding> + <service name="testService"> <port name="testPort" binding="tns:testBinding"> <soap:address location="test://" /> </port> @@ -57,7 +57,7 @@ EOF; ini_set("soap.wsdl_cache_enabled",0); $x = new SoapClient($fname, array("trace"=>1,"exceptions"=>0,"features"=>$features)); $y = new SoapServer($fname, array("features"=>$features)); - $y->addfunction("test"); + $y->addfunction("test"); unlink($fname); $x->test($param); diff --git a/ext/soap/tests/server011.phpt b/ext/soap/tests/server011.phpt index 1c367d7d56..53c6521314 100644 --- a/ext/soap/tests/server011.phpt +++ b/ext/soap/tests/server011.phpt @@ -20,7 +20,7 @@ ob_end_clean(); if ($wsdl == file_get_contents(__DIR__."/test.wsdl")) { echo "ok\n"; } else { - echo "fail\n"; + echo "fail\n"; } ?> --EXPECT-- diff --git a/ext/soap/tests/server016.phpt b/ext/soap/tests/server016.phpt index 8934f46afe..acef045a46 100644 --- a/ext/soap/tests/server016.phpt +++ b/ext/soap/tests/server016.phpt @@ -5,8 +5,8 @@ SOAP Server 16: user fault --FILE-- <?php function test() { - global $server; - $server->fault("MyFault","My fault string"); + global $server; + $server->fault("MyFault","My fault string"); } $server = new soapserver(null,array('uri'=>"http://testuri.org")); diff --git a/ext/soap/tests/server017.phpt b/ext/soap/tests/server017.phpt index 3ff0acb4e9..a635065750 100644 --- a/ext/soap/tests/server017.phpt +++ b/ext/soap/tests/server017.phpt @@ -5,7 +5,7 @@ SOAP Server 17: user fault (through return) --FILE-- <?php function test() { - return new SoapFault("MyFault","My fault string"); + return new SoapFault("MyFault","My fault string"); } $server = new soapserver(null,array('uri'=>"http://testuri.org")); diff --git a/ext/soap/tests/server018.phpt b/ext/soap/tests/server018.phpt index b033ed9c57..2c379d85dd 100644 --- a/ext/soap/tests/server018.phpt +++ b/ext/soap/tests/server018.phpt @@ -5,7 +5,7 @@ SOAP Server 18: user fault (through throw) --FILE-- <?php function test() { - throw new SoapFault("MyFault","My fault string"); + throw new SoapFault("MyFault","My fault string"); } $server = new soapserver(null,array('uri'=>"http://testuri.org")); diff --git a/ext/soap/tests/server022.phpt b/ext/soap/tests/server022.phpt index ff79a1518f..82270f8eef 100644 --- a/ext/soap/tests/server022.phpt +++ b/ext/soap/tests/server022.phpt @@ -5,14 +5,14 @@ SOAP Server 22: user fault (through throw of subclass) --FILE-- <?php class MyFault extends SoapFault { - function __construct() { - parent::__construct("MyFault","My fault string"); - } + function __construct() { + parent::__construct("MyFault","My fault string"); + } } function test() { - throw new MyFault; + throw new MyFault; } $server = new soapserver(null,array('uri'=>"http://testuri.org")); diff --git a/ext/soap/tests/server023.phpt b/ext/soap/tests/server023.phpt index 5614599f3a..07f3aea554 100644 --- a/ext/soap/tests/server023.phpt +++ b/ext/soap/tests/server023.phpt @@ -5,10 +5,10 @@ SOAP Server 23: Send SOAP headers those were not received --FILE-- <?php function test() { - global $server; - $server->addSoapHeader(new SoapHeader("http://testuri.org", "Test1", "Hello Header!")); - $server->addSoapHeader(new SoapHeader("http://testuri.org", "Test2", "Hello Header!")); - return "Hello Body!"; + global $server; + $server->addSoapHeader(new SoapHeader("http://testuri.org", "Test1", "Hello Header!")); + $server->addSoapHeader(new SoapHeader("http://testuri.org", "Test2", "Hello Header!")); + return "Hello Body!"; } $server = new soapserver(null,array('uri'=>"http://testuri.org")); diff --git a/ext/soap/tests/server024.phpt b/ext/soap/tests/server024.phpt index 7db30621d3..63cf06cd02 100644 --- a/ext/soap/tests/server024.phpt +++ b/ext/soap/tests/server024.phpt @@ -5,22 +5,22 @@ SOAP Server 24: Send SOAP headers those were not received --FILE-- <?php class TestHeader1 extends SoapHeader { - function __construct($data) { - parent::__construct("http://testuri.org", "Test1", $data); - } + function __construct($data) { + parent::__construct("http://testuri.org", "Test1", $data); + } } class TestHeader2 extends SoapHeader { - function __construct($data) { - parent::__construct("http://testuri.org", "Test2", $data); - } + function __construct($data) { + parent::__construct("http://testuri.org", "Test2", $data); + } } function test() { - global $server; - $server->addSoapHeader(new TestHeader1("Hello Header!")); - $server->addSoapHeader(new TestHeader2("Hello Header!")); - return "Hello Body!"; + global $server; + $server->addSoapHeader(new TestHeader1("Hello Header!")); + $server->addSoapHeader(new TestHeader2("Hello Header!")); + return "Hello Body!"; } $server = new soapserver(null,array('uri'=>"http://testuri.org")); diff --git a/ext/soap/tests/server025.phpt b/ext/soap/tests/server025.phpt index 5366c7ad91..871134f935 100644 --- a/ext/soap/tests/server025.phpt +++ b/ext/soap/tests/server025.phpt @@ -7,22 +7,22 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php class TestHeader1 extends SoapHeader { - function __construct($data) { - parent::__construct("http://testuri.org", "Test1", $data); - } + function __construct($data) { + parent::__construct("http://testuri.org", "Test1", $data); + } } class TestHeader2 extends SoapHeader { - function __construct($data) { - parent::__construct("http://testuri.org", "Test2", $data); - } + function __construct($data) { + parent::__construct("http://testuri.org", "Test2", $data); + } } function test() { - global $server; - $server->addSoapHeader(new TestHeader1("Hello Header!")); - $server->addSoapHeader(new TestHeader2("Hello Header!")); - return "Hello Body!"; + global $server; + $server->addSoapHeader(new TestHeader1("Hello Header!")); + $server->addSoapHeader(new TestHeader2("Hello Header!")); + return "Hello Body!"; } $server = new soapserver(__DIR__."/server025.wsdl"); diff --git a/ext/soap/tests/server031.phpt b/ext/soap/tests/server031.phpt index c9f8d95f8e..987ad4ab59 100644 --- a/ext/soap/tests/server031.phpt +++ b/ext/soap/tests/server031.phpt @@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php class ItemArray implements Iterator { - private $a = array(); + private $a = array(); - public function __construct(array $a) { - $this->a = $a; - } + public function __construct(array $a) { + $this->a = $a; + } public function rewind() { return reset($this->a); } public function current() { return current($this->a); } @@ -23,26 +23,26 @@ class ItemArray implements Iterator { class Item { public $text; - public function __construct($n) { - $this->text = 'text'.$n; - } + public function __construct($n) { + $this->text = 'text'.$n; + } } class handlerClass { public function getItems() { return new ItemArray(array( - new Item(0), - new Item(1), - new Item(2), - new Item(3), - new Item(4), - new Item(5), - new Item(6), - new Item(7), - new Item(8), - new Item(9) - )); + new Item(0), + new Item(1), + new Item(2), + new Item(3), + new Item(4), + new Item(5), + new Item(6), + new Item(7), + new Item(8), + new Item(9) + )); } } diff --git a/ext/soap/tests/soap12/T01.phpt b/ext/soap/tests/soap12/T01.phpt index d584812d09..45aadbad86 100644 --- a/ext/soap/tests/soap12/T01.phpt +++ b/ext/soap/tests/soap12/T01.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T01 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoOk xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/next">foo</test:echoOk> diff --git a/ext/soap/tests/soap12/T02.phpt b/ext/soap/tests/soap12/T02.phpt index db2c260684..d7f9880143 100644 --- a/ext/soap/tests/soap12/T02.phpt +++ b/ext/soap/tests/soap12/T02.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T02 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoOk xmlns:test="http://example.org/ts-tests" env:role="http://example.org/ts-tests/C">foo</test:echoOk> diff --git a/ext/soap/tests/soap12/T03.phpt b/ext/soap/tests/soap12/T03.phpt index 19c29dd3dd..1d7aa3b0d3 100644 --- a/ext/soap/tests/soap12/T03.phpt +++ b/ext/soap/tests/soap12/T03.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T03 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk> </env:Header> diff --git a/ext/soap/tests/soap12/T04.phpt b/ext/soap/tests/soap12/T04.phpt index 7445caedee..2bef7626d8 100644 --- a/ext/soap/tests/soap12/T04.phpt +++ b/ext/soap/tests/soap12/T04.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T04 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoOk xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:echoOk> diff --git a/ext/soap/tests/soap12/T05.phpt b/ext/soap/tests/soap12/T05.phpt index 187eb2ee83..c5e0054eb3 100644 --- a/ext/soap/tests/soap12/T05.phpt +++ b/ext/soap/tests/soap12/T05.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T05 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoOk xmlns:test="http://example.org/ts-tests" env:role="http://example.org/ts-tests/B">foo</test:echoOk> diff --git a/ext/soap/tests/soap12/T10.phpt b/ext/soap/tests/soap12/T10.phpt index 54186f6a0d..6c2a3ea417 100644 --- a/ext/soap/tests/soap12/T10.phpt +++ b/ext/soap/tests/soap12/T10.phpt @@ -6,9 +6,9 @@ SOAP 1.2: T10 unknownHdr <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> - <test:Unknown xmlns:test="http://example.org/ts-tests" + <test:Unknown xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:Unknown> </env:Header> <env:Body> diff --git a/ext/soap/tests/soap12/T11.phpt b/ext/soap/tests/soap12/T11.phpt index 3423d54329..d805596bed 100644 --- a/ext/soap/tests/soap12/T11.phpt +++ b/ext/soap/tests/soap12/T11.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T11 unknownHdr <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:Unknown xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" diff --git a/ext/soap/tests/soap12/T12.phpt b/ext/soap/tests/soap12/T12.phpt index c67917f0e3..7a1cc56bec 100644 --- a/ext/soap/tests/soap12/T12.phpt +++ b/ext/soap/tests/soap12/T12.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T12 unknownHdr <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:Unknown xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" diff --git a/ext/soap/tests/soap12/T13.phpt b/ext/soap/tests/soap12/T13.phpt index 95e1c8ad4e..2d7fec0757 100644 --- a/ext/soap/tests/soap12/T13.phpt +++ b/ext/soap/tests/soap12/T13.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T13 unknownHdr <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:Unknown xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" diff --git a/ext/soap/tests/soap12/T14.phpt b/ext/soap/tests/soap12/T14.phpt index dbf4e1bab5..1bed2aa2d0 100644 --- a/ext/soap/tests/soap12/T14.phpt +++ b/ext/soap/tests/soap12/T14.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T14 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoOk xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" diff --git a/ext/soap/tests/soap12/T15.phpt b/ext/soap/tests/soap12/T15.phpt index 546f94237f..d68d43c097 100644 --- a/ext/soap/tests/soap12/T15.phpt +++ b/ext/soap/tests/soap12/T15.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T15 unknownHdr <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:Unknown xmlns:test="http://example.org/ts-tests" env:role="http://example.org/ts-tests/B" diff --git a/ext/soap/tests/soap12/T19.phpt b/ext/soap/tests/soap12/T19.phpt index 8ddb5b4f8b..2f5e132f01 100644 --- a/ext/soap/tests/soap12/T19.phpt +++ b/ext/soap/tests/soap12/T19.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T19 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoOk xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/none" diff --git a/ext/soap/tests/soap12/T22.phpt b/ext/soap/tests/soap12/T22.phpt index 5844550ced..2976bc577a 100644 --- a/ext/soap/tests/soap12/T22.phpt +++ b/ext/soap/tests/soap12/T22.phpt @@ -6,9 +6,9 @@ SOAP 1.2: T22 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> - <test:echoOk xmlns:test="http://example.org/ts-tests" + <test:echoOk xmlns:test="http://example.org/ts-tests" env:mustUnderstand = "1">foo</test:echoOk> </env:Header> <env:Body> diff --git a/ext/soap/tests/soap12/T23.phpt b/ext/soap/tests/soap12/T23.phpt index c676fb176c..095e5e725f 100644 --- a/ext/soap/tests/soap12/T23.phpt +++ b/ext/soap/tests/soap12/T23.phpt @@ -6,11 +6,11 @@ SOAP 1.2: T23 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> - <test:Unknown xmlns:test="http://example.org/ts-tests" + <test:Unknown xmlns:test="http://example.org/ts-tests" env:mustUnderstand="1">foo</test:Unknown> - <test:echoOk xmlns:test="http://example.org/ts-tests" + <test:echoOk xmlns:test="http://example.org/ts-tests" env:mustUnderstand="wrong">foo</test:echoOk> </env:Header> <env:Body> diff --git a/ext/soap/tests/soap12/T24.phpt b/ext/soap/tests/soap12/T24.phpt index ebee3b764a..97bd56cf47 100644 --- a/ext/soap/tests/soap12/T24.phpt +++ b/ext/soap/tests/soap12/T24.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T24 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://wrong-version/"> +<env:Envelope xmlns:env="http://wrong-version/"> <env:Body> <test:echoOk xmlns:test="http://example.org/ts-tests"> foo diff --git a/ext/soap/tests/soap12/T25.phpt b/ext/soap/tests/soap12/T25.phpt index ac45e9c52d..ac5e1a0efd 100644 --- a/ext/soap/tests/soap12/T25.phpt +++ b/ext/soap/tests/soap12/T25.phpt @@ -7,7 +7,7 @@ SOAP 1.2: T25 echoOk $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> <!DOCTYPE env:Envelope SYSTEM "env.dtd"[]> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Body> <test:echoOk xmlns:test="http://example.org/ts-tests"> foo diff --git a/ext/soap/tests/soap12/T26.phpt b/ext/soap/tests/soap12/T26.phpt index 53c8cec495..8b23ba7b63 100644 --- a/ext/soap/tests/soap12/T26.phpt +++ b/ext/soap/tests/soap12/T26.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T26 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <?xml-stylesheet href="http://example.org/ts-tests/sub.xsl" type = "text/xsl"?> <env:Body> <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk> diff --git a/ext/soap/tests/soap12/T27.phpt b/ext/soap/tests/soap12/T27.phpt index 81db8ee5bc..3cb42940be 100644 --- a/ext/soap/tests/soap12/T27.phpt +++ b/ext/soap/tests/soap12/T27.phpt @@ -9,14 +9,14 @@ $HTTP_RAW_POST_DATA = <<<EOF <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <env:Body> - <test:echoStringArray xmlns:test="http://example.org/ts-tests" + <test:echoStringArray xmlns:test="http://example.org/ts-tests" xmlns:enc="http://www.w3.org/2003/05/soap-encoding" env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <test:array enc:itemType="xs:string" enc:arraySize="1"> <a> <b>1</b> </a> - </test:array> + </test:array> </test:echoStringArray> </env:Body> </env:Envelope> diff --git a/ext/soap/tests/soap12/T28.phpt b/ext/soap/tests/soap12/T28.phpt index 751df133db..019cabcdb9 100644 --- a/ext/soap/tests/soap12/T28.phpt +++ b/ext/soap/tests/soap12/T28.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T28 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Body env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <test:echoOk xmlns:test="http://example.org/ts-tests" > foo diff --git a/ext/soap/tests/soap12/T29.phpt b/ext/soap/tests/soap12/T29.phpt index 3784da4030..85a3a61ae1 100644 --- a/ext/soap/tests/soap12/T29.phpt +++ b/ext/soap/tests/soap12/T29.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T29 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoOk xmlns:test="http://example.org/ts-tests" env:role="http://example.org/ts-tests/Czzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz">foo</test:echoOk> diff --git a/ext/soap/tests/soap12/T31.phpt b/ext/soap/tests/soap12/T31.phpt index f00e25a59a..689f62bd00 100644 --- a/ext/soap/tests/soap12/T31.phpt +++ b/ext/soap/tests/soap12/T31.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T31 returnVoid <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Body> <test:returnVoid xmlns:test="http://example.org/ts-tests"> </test:returnVoid> diff --git a/ext/soap/tests/soap12/T32.phpt b/ext/soap/tests/soap12/T32.phpt index 8f77873f4c..7d9dc1006a 100644 --- a/ext/soap/tests/soap12/T32.phpt +++ b/ext/soap/tests/soap12/T32.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T32 echoHeader <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:requiredHeader xmlns:test="http://example.org/ts-tests" env:mustUnderstand="true">foo</test:requiredHeader> diff --git a/ext/soap/tests/soap12/T33.phpt b/ext/soap/tests/soap12/T33.phpt index 00ded875b5..76f90bce1b 100644 --- a/ext/soap/tests/soap12/T33.phpt +++ b/ext/soap/tests/soap12/T33.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T33 nonexistentMethod <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Body> <test:DoesNotExist xmlns:test="http://example.org/ts-tests"> </test:DoesNotExist> diff --git a/ext/soap/tests/soap12/T34.phpt b/ext/soap/tests/soap12/T34.phpt index 39e0095d43..873013cbc8 100644 --- a/ext/soap/tests/soap12/T34.phpt +++ b/ext/soap/tests/soap12/T34.phpt @@ -6,9 +6,9 @@ SOAP 1.2: T34 unknownHdr <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> - <test:Unknown xmlns:test="http://example.org/ts-tests" + <test:Unknown xmlns:test="http://example.org/ts-tests" xmlns:env1="http://schemas.xmlsoap.org/soap/envelope/" env1:mustUnderstand="true">foo</test:Unknown> </env:Header> diff --git a/ext/soap/tests/soap12/T35.phpt b/ext/soap/tests/soap12/T35.phpt index a736010ce0..b6511e8e80 100644 --- a/ext/soap/tests/soap12/T35.phpt +++ b/ext/soap/tests/soap12/T35.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T35 unknownHdr <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:Unknown xmlns:test="http://example.org/ts-tests" env:mustUnderstand="1"> diff --git a/ext/soap/tests/soap12/T36.phpt b/ext/soap/tests/soap12/T36.phpt index d625813942..b1efaeaf90 100644 --- a/ext/soap/tests/soap12/T36.phpt +++ b/ext/soap/tests/soap12/T36.phpt @@ -6,10 +6,10 @@ SOAP 1.2: T36 unknownHdr <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:Unknown xmlns:test="http://example.org/ts-tests" - env:mustUnderstand="1" + env:mustUnderstand="1" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:Unknown> </env:Header> <env:Body> diff --git a/ext/soap/tests/soap12/T37.phpt b/ext/soap/tests/soap12/T37.phpt index cdce8a4429..848c0a4aa4 100644 --- a/ext/soap/tests/soap12/T37.phpt +++ b/ext/soap/tests/soap12/T37.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T37 unknownHdr <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:Unknown xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:Unknown> diff --git a/ext/soap/tests/soap12/T38_1.phpt b/ext/soap/tests/soap12/T38_1.phpt index 30007e55ef..8bc8cf185b 100644 --- a/ext/soap/tests/soap12/T38_1.phpt +++ b/ext/soap/tests/soap12/T38_1.phpt @@ -6,13 +6,13 @@ SOAP 1.2: T38.1 doubleHdr <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:Unknown xmlns:test="http://example.org/ts-tests" - env:mustUnderstand="false" + env:mustUnderstand="false" env:role="http://example.org/ts-tests/C">foo</test:Unknown> <test:echoOk xmlns:test="http://example.org/ts-tests" - env:mustUnderstand="0" + env:mustUnderstand="0" env:role="http://example.org/ts-tests/C">foo</test:echoOk> </env:Header> <env:Body> diff --git a/ext/soap/tests/soap12/T38_2.phpt b/ext/soap/tests/soap12/T38_2.phpt index efff2f4db3..8408ab783f 100644 --- a/ext/soap/tests/soap12/T38_2.phpt +++ b/ext/soap/tests/soap12/T38_2.phpt @@ -6,13 +6,13 @@ SOAP 1.2: T38.2 doubleHdr <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoOk xmlns:test="http://example.org/ts-tests" - env:mustUnderstand="true" + env:mustUnderstand="true" env:role="http://example.org/ts-tests/C">foo</test:echoOk> <test:echoOk xmlns:test="http://example.org/ts-tests" - env:mustUnderstand="1" + env:mustUnderstand="1" env:role="http://example.org/ts-tests/C">bar</test:echoOk> </env:Header> <env:Body> diff --git a/ext/soap/tests/soap12/T39.phpt b/ext/soap/tests/soap12/T39.phpt index 2b29562aba..f4ddcc9d20 100644 --- a/ext/soap/tests/soap12/T39.phpt +++ b/ext/soap/tests/soap12/T39.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T39 unknownHdr <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:Unknown xmlns:test="http://example.org/ts-tests" env:mustUnderstand="9">foo</test:Unknown> diff --git a/ext/soap/tests/soap12/T40.phpt b/ext/soap/tests/soap12/T40.phpt index 332e5768dd..2814309321 100644 --- a/ext/soap/tests/soap12/T40.phpt +++ b/ext/soap/tests/soap12/T40.phpt @@ -6,10 +6,10 @@ SOAP 1.2: T40 echoOK <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:Unknown xmlns:test="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]/ts-tests" - env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" + env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" env:mustUnderstand="false"> foo </test:Unknown> diff --git a/ext/soap/tests/soap12/T46.phpt b/ext/soap/tests/soap12/T46.phpt index fe091323f1..fbbf543fdf 100644 --- a/ext/soap/tests/soap12/T46.phpt +++ b/ext/soap/tests/soap12/T46.phpt @@ -18,7 +18,7 @@ $HTTP_RAW_POST_DATA = <<<EOF <varFloat xsi:type="xsd:float">0.005</varFloat> <varString xsi:type="xsd:string">hello world</varString> <varArray enc:itemType="xsd:string" enc:arraySize="3" - xmlns:enc="http://www.w3.org/2003/05/soap-encoding"> + xmlns:enc="http://www.w3.org/2003/05/soap-encoding"> <item xsi:type="xsd:string">red</item> <item xsi:type="xsd:string">blue</item> <item xsi:type="xsd:string">green</item> diff --git a/ext/soap/tests/soap12/T49.phpt b/ext/soap/tests/soap12/T49.phpt index 9687d03b94..01ac0e679f 100644 --- a/ext/soap/tests/soap12/T49.phpt +++ b/ext/soap/tests/soap12/T49.phpt @@ -7,7 +7,7 @@ SOAP 1.2: T49 echoStringArray $HTTP_RAW_POST_DATA = <<<EOF <?xml version="1.0"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <test:echoStringArray xmlns:test="http://example.org/ts-tests" diff --git a/ext/soap/tests/soap12/T50.phpt b/ext/soap/tests/soap12/T50.phpt index e3fcc0c316..66263abcb7 100644 --- a/ext/soap/tests/soap12/T50.phpt +++ b/ext/soap/tests/soap12/T50.phpt @@ -7,7 +7,7 @@ SOAP 1.2: T50 echoIntegerArray $HTTP_RAW_POST_DATA = <<<EOF <?xml version="1.0"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <test:echoIntegerArray xmlns:test="http://example.org/ts-tests" diff --git a/ext/soap/tests/soap12/T52.phpt b/ext/soap/tests/soap12/T52.phpt index 9d75fb9823..7cd229b741 100644 --- a/ext/soap/tests/soap12/T52.phpt +++ b/ext/soap/tests/soap12/T52.phpt @@ -7,7 +7,7 @@ SOAP 1.2: T52 echoBoolean $HTTP_RAW_POST_DATA = <<<EOF <?xml version="1.0"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <test:echoBoolean xmlns:test="http://example.org/ts-tests" diff --git a/ext/soap/tests/soap12/T53.phpt b/ext/soap/tests/soap12/T53.phpt index c1c8fe63aa..5bff2c775f 100644 --- a/ext/soap/tests/soap12/T53.phpt +++ b/ext/soap/tests/soap12/T53.phpt @@ -7,7 +7,7 @@ SOAP 1.2: T53 echoDate $HTTP_RAW_POST_DATA = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <test:echoDate xmlns:test="http://example.org/ts-tests" diff --git a/ext/soap/tests/soap12/T54.phpt b/ext/soap/tests/soap12/T54.phpt index ba3ed35526..ac33859a75 100644 --- a/ext/soap/tests/soap12/T54.phpt +++ b/ext/soap/tests/soap12/T54.phpt @@ -7,7 +7,7 @@ SOAP 1.2: T54 echoDecimal $HTTP_RAW_POST_DATA = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <test:echoDecimal xmlns:test="http://example.org/ts-tests" diff --git a/ext/soap/tests/soap12/T55.phpt b/ext/soap/tests/soap12/T55.phpt index 1c12e504f2..5e362854f9 100644 --- a/ext/soap/tests/soap12/T55.phpt +++ b/ext/soap/tests/soap12/T55.phpt @@ -7,7 +7,7 @@ SOAP 1.2: T55 echoFloat $HTTP_RAW_POST_DATA = <<<EOF <?xml version="1.0"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <test:echoFloat xmlns:test="http://example.org/ts-tests" diff --git a/ext/soap/tests/soap12/T58.phpt b/ext/soap/tests/soap12/T58.phpt index aa53985486..9878baeacf 100644 --- a/ext/soap/tests/soap12/T58.phpt +++ b/ext/soap/tests/soap12/T58.phpt @@ -6,16 +6,16 @@ SOAP 1.2: T58 echoIntegerArray <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> - <test:echoIntegerArray xmlns:test="http://example.org/ts-tests" + <test:echoIntegerArray xmlns:test="http://example.org/ts-tests" env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <inputIntegerArray enc:itemType="xsd:int" enc:arraySize="1" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"> <a><b>1</b></a> - </inputIntegerArray> + </inputIntegerArray> </test:echoIntegerArray> </env:Body> </env:Envelope> diff --git a/ext/soap/tests/soap12/T59.phpt b/ext/soap/tests/soap12/T59.phpt index 2ceef325bb..4c0ec5a382 100644 --- a/ext/soap/tests/soap12/T59.phpt +++ b/ext/soap/tests/soap12/T59.phpt @@ -7,12 +7,12 @@ SOAP 1.2: T59 echoStringArray $HTTP_RAW_POST_DATA = <<<EOF <?xml version="1.0"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <test:echoStringArray xmlns:test="http://example.org/ts-tests" env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> - <inputStringArray enc:itemType="xsd:string" + <inputStringArray enc:itemType="xsd:string" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"> <item enc:id="data" xsi:type="xsd:string" enc:ref="#data">hello</item> <item>world</item> diff --git a/ext/soap/tests/soap12/T63.phpt b/ext/soap/tests/soap12/T63.phpt index 5a41ef0109..72b9ca35f5 100644 --- a/ext/soap/tests/soap12/T63.phpt +++ b/ext/soap/tests/soap12/T63.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T63 validateCountryCode <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:validateCountryCode xmlns:test="http://example.org/ts-tests" env:role="http://example.org/ts-tests/C" diff --git a/ext/soap/tests/soap12/T64.phpt b/ext/soap/tests/soap12/T64.phpt index 24e62ecb6b..932c112d83 100644 --- a/ext/soap/tests/soap12/T64.phpt +++ b/ext/soap/tests/soap12/T64.phpt @@ -9,7 +9,7 @@ $HTTP_RAW_POST_DATA = <<<EOF <!DOCTYPE DOC [ <!NOTATION application_xml SYSTEM 'http://www.isi.edu/in-notes/iana/assignments/media-types/application/xml'> ]> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Body> <test:echoOk xmlns:test="http://example.org/ts-tests"> foo diff --git a/ext/soap/tests/soap12/T65.phpt b/ext/soap/tests/soap12/T65.phpt index cd96d4a82f..e89ce995d8 100644 --- a/ext/soap/tests/soap12/T65.phpt +++ b/ext/soap/tests/soap12/T65.phpt @@ -11,7 +11,7 @@ $HTTP_RAW_POST_DATA = <<<EOF <!ELEMENT Body (echoOk) > <!ELEMENT echoOk (#PCDATA) > ]> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Body> <test:echoOk xmlns:test="http://example.org/ts-tests"> foo diff --git a/ext/soap/tests/soap12/T66.phpt b/ext/soap/tests/soap12/T66.phpt index cc7cc2e3e3..23586b8ee7 100644 --- a/ext/soap/tests/soap12/T66.phpt +++ b/ext/soap/tests/soap12/T66.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T66 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' encoding='UTF8'?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoOk xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/next">foo</test:echoOk> diff --git a/ext/soap/tests/soap12/T67.phpt b/ext/soap/tests/soap12/T67.phpt index ddc527a6ec..dd197a1b82 100644 --- a/ext/soap/tests/soap12/T67.phpt +++ b/ext/soap/tests/soap12/T67.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T67 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' standalone='yes'?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoOk xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/next">foo</test:echoOk> diff --git a/ext/soap/tests/soap12/T68.phpt b/ext/soap/tests/soap12/T68.phpt index acf4230973..0dfa08ff16 100644 --- a/ext/soap/tests/soap12/T68.phpt +++ b/ext/soap/tests/soap12/T68.phpt @@ -5,7 +5,7 @@ SOAP 1.2: T68 echoOk --FILE-- <?php $HTTP_RAW_POST_DATA = <<<EOF -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header > diff --git a/ext/soap/tests/soap12/T69.phpt b/ext/soap/tests/soap12/T69.phpt index 0fb02dec06..8a64745f95 100644 --- a/ext/soap/tests/soap12/T69.phpt +++ b/ext/soap/tests/soap12/T69.phpt @@ -8,7 +8,7 @@ $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> - <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk> + <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk> </env:Header> </env:Envelope> EOF; diff --git a/ext/soap/tests/soap12/T70.phpt b/ext/soap/tests/soap12/T70.phpt index 3622c320e7..9b665bf176 100644 --- a/ext/soap/tests/soap12/T70.phpt +++ b/ext/soap/tests/soap12/T70.phpt @@ -8,7 +8,7 @@ $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> - <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk> + <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk> </env:Header> <env:Body> </env:Body> diff --git a/ext/soap/tests/soap12/T71.phpt b/ext/soap/tests/soap12/T71.phpt index fdb5b8d460..dffaf585d3 100644 --- a/ext/soap/tests/soap12/T71.phpt +++ b/ext/soap/tests/soap12/T71.phpt @@ -9,7 +9,7 @@ $HTTP_RAW_POST_DATA = <<<EOF <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" attr1="a-value"> <env:Header> - <test:echoOk xmlns:test="http://example.org/ts-tests"> + <test:echoOk xmlns:test="http://example.org/ts-tests"> foo </test:echoOk> </env:Header> diff --git a/ext/soap/tests/soap12/T72.phpt b/ext/soap/tests/soap12/T72.phpt index b8f5060c6b..3b4db8c3f3 100644 --- a/ext/soap/tests/soap12/T72.phpt +++ b/ext/soap/tests/soap12/T72.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T72 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <env:Body> <test:echoOk xmlns:test="http://example.org/ts-tests"> diff --git a/ext/soap/tests/soap12/T74.phpt b/ext/soap/tests/soap12/T74.phpt index 703e1870a6..4f210b642e 100644 --- a/ext/soap/tests/soap12/T74.phpt +++ b/ext/soap/tests/soap12/T74.phpt @@ -6,12 +6,12 @@ SOAP 1.2: T74 doubleHdr <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoOk xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/next">foo</test:echoOk> <test:Unknown xmlns:test="http://example.org/ts-tests"> - <test:raiseFault env:mustUnderstand="1" + <test:raiseFault env:mustUnderstand="1" env:role="http://www.w3.org/2003/05/soap-envelope/role/next"> </test:raiseFault> </test:Unknown> diff --git a/ext/soap/tests/soap12/T75.phpt b/ext/soap/tests/soap12/T75.phpt index 3e2166d957..cdee965db0 100644 --- a/ext/soap/tests/soap12/T75.phpt +++ b/ext/soap/tests/soap12/T75.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T75 echoResolvedRef <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoResolvedRef xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/next" diff --git a/ext/soap/tests/soap12/T76_1.phpt b/ext/soap/tests/soap12/T76_1.phpt index e97c179768..87f4c55f09 100644 --- a/ext/soap/tests/soap12/T76_1.phpt +++ b/ext/soap/tests/soap12/T76_1.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T76.1 echoString <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> diff --git a/ext/soap/tests/soap12/T77_1.phpt b/ext/soap/tests/soap12/T77_1.phpt index d847b6cfd8..3cf3f4358a 100644 --- a/ext/soap/tests/soap12/T77_1.phpt +++ b/ext/soap/tests/soap12/T77_1.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T77.1 isNil <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> diff --git a/ext/soap/tests/soap12/T77_2.phpt b/ext/soap/tests/soap12/T77_2.phpt index c829b57892..4d18b374dc 100644 --- a/ext/soap/tests/soap12/T77_2.phpt +++ b/ext/soap/tests/soap12/T77_2.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T77.2 isNil <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> diff --git a/ext/soap/tests/soap12/T77_3.phpt b/ext/soap/tests/soap12/T77_3.phpt index 0e1355a5a2..1242daf0ea 100644 --- a/ext/soap/tests/soap12/T77_3.phpt +++ b/ext/soap/tests/soap12/T77_3.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T77.3 isNul <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> diff --git a/ext/soap/tests/soap12/T78.phpt b/ext/soap/tests/soap12/T78.phpt index 63d13c7cae..228a88ad43 100644 --- a/ext/soap/tests/soap12/T78.phpt +++ b/ext/soap/tests/soap12/T78.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T78 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version='1.0' ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <test:echoOk xmlns:test="http://example.org/ts-tests" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:echoOk> diff --git a/ext/soap/tests/soap12/T80.phpt b/ext/soap/tests/soap12/T80.phpt index 1ac114ba32..e987338ea8 100644 --- a/ext/soap/tests/soap12/T80.phpt +++ b/ext/soap/tests/soap12/T80.phpt @@ -6,7 +6,7 @@ SOAP 1.2: T80 echoOk <?php $HTTP_RAW_POST_DATA = <<<EOF <?xml version="1.0"?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Body> <test:echoOk xmlns:test="http://example.org/ts-tests" env:encodingStyle="http://example.org/PoisonEncoding">foo</test:echoOk> </env:Body> diff --git a/ext/soap/tests/soap12/soap12-test.inc b/ext/soap/tests/soap12/soap12-test.inc index e27712241f..550494e516 100644 --- a/ext/soap/tests/soap12/soap12-test.inc +++ b/ext/soap/tests/soap12/soap12-test.inc @@ -1,124 +1,124 @@ <?php class Soap12test { - public $header; + public $header; - function echoOk($x) { - return $x; - } + function echoOk($x) { + return $x; + } - function echoString($inputString) { - return $inputString; - } + function echoString($inputString) { + return $inputString; + } - function echoStringArray($inputStringArray) { - return $inputStringArray; - } + function echoStringArray($inputStringArray) { + return $inputStringArray; + } - function echoInteger($inputInteger) { - return $inputInteger; - } + function echoInteger($inputInteger) { + return $inputInteger; + } - function echoIntegerArray($inputIntegerArray) { - return $inputIntegerArray; - } + function echoIntegerArray($inputIntegerArray) { + return $inputIntegerArray; + } - function echoFloat($inputFloat) { - return $inputFloat; - } + function echoFloat($inputFloat) { + return $inputFloat; + } - function echoFloatArray($inputFloatArray) { - return $inputFloatArray; + function echoFloatArray($inputFloatArray) { + return $inputFloatArray; } - function echoStruct($x) { - return $x; - } + function echoStruct($x) { + return $x; + } - function echoStructArray($x) { - return $x; - } + function echoStructArray($x) { + return $x; + } - function echoVoid() { - return NULL; - } + function echoVoid() { + return NULL; + } - function echoBase64($b_encoded) { - return $b_encoded; + function echoBase64($b_encoded) { + return $b_encoded; } - function echoDate($timeInstant) { - return $timeInstant; - } - - function echoHexBinary($hb) { - return $hb; - } - - function echoDecimal($dec) { - return $dec; - } - - function echoBoolean($boolean) { - return $boolean; - } - - function echoStructAsSimpleTypes ($struct) { - return array('outputString' => $struct->varString, - 'outputInteger' => $struct->varInt, - 'outputFloat' => $struct->varFloat); - } - - function echoSimpleTypesAsStruct($string, $int, $float) { - return (object)array("varString" => $string, - "varInt" => $int, - "varFloat" => $float); - } - - function echoNestedStruct($struct) { - return $struct; - } - - function echo2DStringArray($ary) { - return $ary; - } - - function echoNestedArray($ary) { - return $ary; - } - - function countItems($input) { - return count($input); - } - - function isNil($input=NULL) { - return is_null($input); - } - - function returnVoid() { - } - - function emptyBody() { - } - - function requiredHeader($x) { - $this->header = $x; - } - - function echoHeader() { - return $this->header; - } - - function echoResolvedRef($ref) { - return $ref->RelativeReference->base.$ref->RelativeReference->href; - } - - function validateCountryCode($code) { - if (strlen($code) != 2) { - return new SoapFault("Client", "Not a valid country code", NULL, NULL, NULL, new SoapHeader("http://example.org/ts-tests", "validateCountryCodeFault", "Country code must be 2 letters.")); - } else { - return "OK"; - } - } + function echoDate($timeInstant) { + return $timeInstant; + } + + function echoHexBinary($hb) { + return $hb; + } + + function echoDecimal($dec) { + return $dec; + } + + function echoBoolean($boolean) { + return $boolean; + } + + function echoStructAsSimpleTypes ($struct) { + return array('outputString' => $struct->varString, + 'outputInteger' => $struct->varInt, + 'outputFloat' => $struct->varFloat); + } + + function echoSimpleTypesAsStruct($string, $int, $float) { + return (object)array("varString" => $string, + "varInt" => $int, + "varFloat" => $float); + } + + function echoNestedStruct($struct) { + return $struct; + } + + function echo2DStringArray($ary) { + return $ary; + } + + function echoNestedArray($ary) { + return $ary; + } + + function countItems($input) { + return count($input); + } + + function isNil($input=NULL) { + return is_null($input); + } + + function returnVoid() { + } + + function emptyBody() { + } + + function requiredHeader($x) { + $this->header = $x; + } + + function echoHeader() { + return $this->header; + } + + function echoResolvedRef($ref) { + return $ref->RelativeReference->base.$ref->RelativeReference->href; + } + + function validateCountryCode($code) { + if (strlen($code) != 2) { + return new SoapFault("Client", "Not a valid country code", NULL, NULL, NULL, new SoapHeader("http://example.org/ts-tests", "validateCountryCodeFault", "Country code must be 2 letters.")); + } else { + return "OK"; + } + } } diff --git a/ext/soap/tests/typemap001.phpt b/ext/soap/tests/typemap001.phpt index c582406f41..04c72eb836 100644 --- a/ext/soap/tests/typemap001.phpt +++ b/ext/soap/tests/typemap001.phpt @@ -8,11 +8,11 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php $GLOBALS['HTTP_RAW_POST_DATA']=" -<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" - xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" - xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" - xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" - xmlns:ns1=\"http://schemas.nothing.com\" +<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" + xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" + xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" + xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" + xmlns:ns1=\"http://schemas.nothing.com\" > <env:Body> <ns1:dotest> @@ -26,31 +26,31 @@ $GLOBALS['HTTP_RAW_POST_DATA']=" </env:Envelope>"; function book_from_xml($xml) { - $sxe = simplexml_load_string($xml); - $obj = new book; - $obj->a = (string)$sxe->a; - $obj->b = (string)$sxe->b; - return $obj; + $sxe = simplexml_load_string($xml); + $obj = new book; + $obj->a = (string)$sxe->a; + $obj->b = (string)$sxe->b; + return $obj; } class test{ - function dotest($book){ - $classname=get_class($book); - return "Object: ".$classname. "(".$book->a.",".$book->b.")"; - } + function dotest($book){ + $classname=get_class($book); + return "Object: ".$classname. "(".$book->a.",".$book->b.")"; + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } $options=Array( - 'actor' =>'http://schemas.nothing.com', - 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", - "type_name" => "book", - "from_xml" => "book_from_xml")) - ); + 'actor' =>'http://schemas.nothing.com', + 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", + "type_name" => "book", + "from_xml" => "book_from_xml")) + ); $server = new SoapServer(__DIR__."/classmap.wsdl",$options); $server->setClass("test"); diff --git a/ext/soap/tests/typemap002.phpt b/ext/soap/tests/typemap002.phpt index 84ef043ac3..551d8ee71f 100644 --- a/ext/soap/tests/typemap002.phpt +++ b/ext/soap/tests/typemap002.phpt @@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php $GLOBALS['HTTP_RAW_POST_DATA']=" -<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" - xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" - xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" - xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" - xmlns:ns1=\"http://schemas.nothing.com\" +<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" + xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" + xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" + xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" + xmlns:ns1=\"http://schemas.nothing.com\" > <env:Body> <ns1:dotest2> @@ -22,30 +22,30 @@ $GLOBALS['HTTP_RAW_POST_DATA']=" </env:Envelope>"; function book_to_xml($book) { - return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>'; + return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>'; } class test{ - function dotest2($str){ - $book = new book; - $book->a = "foo"; - $book->b = "bar"; - return $book; - } + function dotest2($str){ + $book = new book; + $book->a = "foo"; + $book->b = "bar"; + return $book; + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } $options=Array( - 'actor' =>'http://schemas.nothing.com', - 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", - "type_name" => "book", - "to_xml" => "book_to_xml")) - ); + 'actor' =>'http://schemas.nothing.com', + 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", + "type_name" => "book", + "to_xml" => "book_to_xml")) + ); $server = new SoapServer(__DIR__."/classmap.wsdl",$options); $server->setClass("test"); diff --git a/ext/soap/tests/typemap003.phpt b/ext/soap/tests/typemap003.phpt index 0770d1be67..2cd0ac64e4 100644 --- a/ext/soap/tests/typemap003.phpt +++ b/ext/soap/tests/typemap003.phpt @@ -9,7 +9,7 @@ soap.wsdl_cache_enabled=0 <?php class TestSoapClient extends SoapClient{ function __doRequest($request, $location, $action, $version, $one_way = 0) { - return <<<EOF + return <<<EOF <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nothing.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body> <ns1:dotest2Response><res xsi:type="ns1:book"> @@ -18,29 +18,29 @@ class TestSoapClient extends SoapClient{ </res> </ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope> EOF; - } + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } function book_from_xml($xml) { - $sxe = simplexml_load_string($xml); - $obj = new book; - $obj->a = (string)$sxe->a; - $obj->b = (string)$sxe->b; - return $obj; + $sxe = simplexml_load_string($xml); + $obj = new book; + $obj->a = (string)$sxe->a; + $obj->b = (string)$sxe->b; + return $obj; } $options=Array( - 'actor' =>'http://schemas.nothing.com', - 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", - "type_name" => "book", - "from_xml" => "book_from_xml")) - ); + 'actor' =>'http://schemas.nothing.com', + 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", + "type_name" => "book", + "from_xml" => "book_from_xml")) + ); $client = new TestSoapClient(__DIR__."/classmap.wsdl",$options); $ret = $client->dotest2("???"); diff --git a/ext/soap/tests/typemap004.phpt b/ext/soap/tests/typemap004.phpt index 07d489db95..bf0a643abe 100644 --- a/ext/soap/tests/typemap004.phpt +++ b/ext/soap/tests/typemap004.phpt @@ -8,27 +8,27 @@ soap.wsdl_cache_enabled=0 <?php class TestSoapClient extends SoapClient{ function __doRequest($request, $location, $action, $version, $one_way = 0) { - echo $request; - exit; - } + echo $request; + exit; + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } function book_to_xml($book) { - return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>'; + return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>'; } $options=Array( - 'actor' =>'http://schemas.nothing.com', - 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", - "type_name" => "book", - "to_xml" => "book_to_xml")) - ); + 'actor' =>'http://schemas.nothing.com', + 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", + "type_name" => "book", + "to_xml" => "book_to_xml")) + ); $client = new TestSoapClient(__DIR__."/classmap.wsdl",$options); $book = new book(); diff --git a/ext/soap/tests/typemap005.phpt b/ext/soap/tests/typemap005.phpt index 5a8319fab7..4a4c81c118 100644 --- a/ext/soap/tests/typemap005.phpt +++ b/ext/soap/tests/typemap005.phpt @@ -8,11 +8,11 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php $GLOBALS['HTTP_RAW_POST_DATA']=" -<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" - xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" - xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" - xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" - xmlns:ns1=\"http://schemas.nothing.com\" +<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" + xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" + xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" + xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" + xmlns:ns1=\"http://schemas.nothing.com\" > <env:Body> <ns1:dotest> @@ -26,32 +26,32 @@ $GLOBALS['HTTP_RAW_POST_DATA']=" </env:Envelope>"; function book_from_xml($xml) { - $sxe = simplexml_load_string($xml); - $obj = new book; - $obj->a = (string)$sxe->a; - $obj->b = (string)$sxe->b; - return $obj; + $sxe = simplexml_load_string($xml); + $obj = new book; + $obj->a = (string)$sxe->a; + $obj->b = (string)$sxe->b; + return $obj; } class test{ - function dotest($book){ - $classname=get_class($book); - return "Object: ".$classname. "(".$book->a.",".$book->b.")"; - } + function dotest($book){ + $classname=get_class($book); + return "Object: ".$classname. "(".$book->a.",".$book->b.")"; + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } $options=Array( - 'uri' => "http://schemas.nothing.com", - 'actor' => 'http://schemas.nothing.com', - 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", - "type_name" => "book", - "from_xml" => "book_from_xml")) - ); + 'uri' => "http://schemas.nothing.com", + 'actor' => 'http://schemas.nothing.com', + 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", + "type_name" => "book", + "from_xml" => "book_from_xml")) + ); $server = new SoapServer(NULL,$options); $server->setClass("test"); diff --git a/ext/soap/tests/typemap006.phpt b/ext/soap/tests/typemap006.phpt index 9de9e245d2..ca8c3351e8 100644 --- a/ext/soap/tests/typemap006.phpt +++ b/ext/soap/tests/typemap006.phpt @@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php $GLOBALS['HTTP_RAW_POST_DATA']=" -<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" - xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" - xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" - xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" - xmlns:ns1=\"http://schemas.nothing.com\" +<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" + xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" + xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" + xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" + xmlns:ns1=\"http://schemas.nothing.com\" > <env:Body> <ns1:dotest2> @@ -22,31 +22,31 @@ $GLOBALS['HTTP_RAW_POST_DATA']=" </env:Envelope>"; function book_to_xml($book) { - return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>'; + return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>'; } class test{ - function dotest2($str){ - $book = new book; - $book->a = "foo"; - $book->b = "bar"; - return new SoapVar($book, null, "book", "http://schemas.nothing.com"); - } + function dotest2($str){ + $book = new book; + $book->a = "foo"; + $book->b = "bar"; + return new SoapVar($book, null, "book", "http://schemas.nothing.com"); + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } $options=Array( - 'uri' => "http://schemas.nothing.com", - 'actor' => 'http://schemas.nothing.com', - 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", - "type_name" => "book", - "to_xml" => "book_to_xml")) - ); + 'uri' => "http://schemas.nothing.com", + 'actor' => 'http://schemas.nothing.com', + 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", + "type_name" => "book", + "to_xml" => "book_to_xml")) + ); $server = new SoapServer(NULL,$options); $server->setClass("test"); diff --git a/ext/soap/tests/typemap007.phpt b/ext/soap/tests/typemap007.phpt index 1dd2becb61..5b7cbd10d7 100644 --- a/ext/soap/tests/typemap007.phpt +++ b/ext/soap/tests/typemap007.phpt @@ -9,7 +9,7 @@ soap.wsdl_cache_enabled=0 <?php class TestSoapClient extends SoapClient{ function __doRequest($request, $location, $action, $version, $one_way = 0) { - return <<<EOF + return <<<EOF <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nothing.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body> <ns1:dotest2Response><res xsi:type="ns1:book"> @@ -18,31 +18,31 @@ class TestSoapClient extends SoapClient{ </res> </ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope> EOF; - } + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } function book_from_xml($xml) { - $sxe = simplexml_load_string($xml); - $obj = new book; - $obj->a = (string)$sxe->a; - $obj->b = (string)$sxe->b; - return $obj; + $sxe = simplexml_load_string($xml); + $obj = new book; + $obj->a = (string)$sxe->a; + $obj->b = (string)$sxe->b; + return $obj; } $options=Array( 'uri' => 'http://schemas.nothing.com', 'location' => 'test://', - 'actor' => 'http://schemas.nothing.com', - 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", - "type_name" => "book", - "from_xml" => "book_from_xml")) - ); + 'actor' => 'http://schemas.nothing.com', + 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", + "type_name" => "book", + "from_xml" => "book_from_xml")) + ); $client = new TestSoapClient(NULL, $options); $ret = $client->dotest2("???"); diff --git a/ext/soap/tests/typemap008.phpt b/ext/soap/tests/typemap008.phpt index 4ba1fb5bef..c4bd649f51 100644 --- a/ext/soap/tests/typemap008.phpt +++ b/ext/soap/tests/typemap008.phpt @@ -8,29 +8,29 @@ soap.wsdl_cache_enabled=0 <?php class TestSoapClient extends SoapClient{ function __doRequest($request, $location, $action, $version, $one_way = 0) { - echo $request; - exit; - } + echo $request; + exit; + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } function book_to_xml($book) { - return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>'; + return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>'; } $options=Array( 'uri' => 'http://schemas.nothing.com', 'location' => 'test://', - 'actor' => 'http://schemas.nothing.com', - 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", - "type_name" => "book", - "to_xml" => "book_to_xml")) - ); + 'actor' => 'http://schemas.nothing.com', + 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", + "type_name" => "book", + "to_xml" => "book_to_xml")) + ); $client = new TestSoapClient(NULL, $options); $book = new book(); diff --git a/ext/soap/tests/typemap009.phpt b/ext/soap/tests/typemap009.phpt index 37e73edeca..a36a64136f 100644 --- a/ext/soap/tests/typemap009.phpt +++ b/ext/soap/tests/typemap009.phpt @@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php $GLOBALS['HTTP_RAW_POST_DATA']=" -<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" - xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" - xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" - xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" - xmlns:ns1=\"http://schemas.nothing.com\" +<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" + xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" + xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" + xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" + xmlns:ns1=\"http://schemas.nothing.com\" > <env:Body> <ns1:dotest> @@ -25,27 +25,27 @@ $GLOBALS['HTTP_RAW_POST_DATA']=" </env:Envelope>"; function book_from_xml($xml) { - throw new SoapFault("Server", "Conversion Failed"); + throw new SoapFault("Server", "Conversion Failed"); } class test{ - function dotest($book){ - $classname=get_class($book); - return "Object: ".$classname. "(".$book->a.",".$book->b.")"; - } + function dotest($book){ + $classname=get_class($book); + return "Object: ".$classname. "(".$book->a.",".$book->b.")"; + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } $options=Array( - 'actor' =>'http://schemas.nothing.com', - 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", - "type_name" => "book", - "from_xml" => "book_from_xml")) - ); + 'actor' =>'http://schemas.nothing.com', + 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", + "type_name" => "book", + "from_xml" => "book_from_xml")) + ); $server = new SoapServer(__DIR__."/classmap.wsdl",$options); $server->setClass("test"); diff --git a/ext/soap/tests/typemap010.phpt b/ext/soap/tests/typemap010.phpt index 46e9909a62..fde89a4603 100644 --- a/ext/soap/tests/typemap010.phpt +++ b/ext/soap/tests/typemap010.phpt @@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php $GLOBALS['HTTP_RAW_POST_DATA']=" -<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" - xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" - xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" - xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" - xmlns:ns1=\"http://schemas.nothing.com\" +<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" + xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" + xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" + xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" + xmlns:ns1=\"http://schemas.nothing.com\" > <env:Body> <ns1:dotest2> @@ -22,30 +22,30 @@ $GLOBALS['HTTP_RAW_POST_DATA']=" </env:Envelope>"; function book_to_xml($book) { - throw new SoapFault("Server", "Conversion Fault"); + throw new SoapFault("Server", "Conversion Fault"); } class test{ - function dotest2($str){ - $book = new book; - $book->a = "foo"; - $book->b = "bar"; - return $book; - } + function dotest2($str){ + $book = new book; + $book->a = "foo"; + $book->b = "bar"; + return $book; + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } $options=Array( - 'actor' =>'http://schemas.nothing.com', - 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", - "type_name" => "book", - "to_xml" => "book_to_xml")) - ); + 'actor' =>'http://schemas.nothing.com', + 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", + "type_name" => "book", + "to_xml" => "book_to_xml")) + ); $server = new SoapServer(__DIR__."/classmap.wsdl",$options); $server->setClass("test"); diff --git a/ext/soap/tests/typemap011.phpt b/ext/soap/tests/typemap011.phpt index ac6b9f3924..b0c75ce0c7 100644 --- a/ext/soap/tests/typemap011.phpt +++ b/ext/soap/tests/typemap011.phpt @@ -8,7 +8,7 @@ soap.wsdl_cache_enabled=0 <?php class TestSoapClient extends SoapClient{ function __doRequest($request, $location, $action, $version, $one_way = 0) { - return <<<EOF + return <<<EOF <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nothing.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body> <ns1:dotest2Response><res xsi:type="ns1:book"> @@ -17,31 +17,31 @@ class TestSoapClient extends SoapClient{ </res> </ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope> EOF; - } + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } function book_from_xml($xml) { - throw new SoapFault("Client", "Conversion Error"); + throw new SoapFault("Client", "Conversion Error"); } $options=Array( - 'actor' =>'http://schemas.nothing.com', - 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", - "type_name" => "book", - "from_xml" => "book_from_xml")) - ); + 'actor' =>'http://schemas.nothing.com', + 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", + "type_name" => "book", + "from_xml" => "book_from_xml")) + ); $client = new TestSoapClient(__DIR__."/classmap.wsdl",$options); try { - $ret = $client->dotest2("???"); + $ret = $client->dotest2("???"); } catch (SoapFault $e) { - $ret = "SoapFault = " . $e->faultcode . " - " . $e->faultstring; + $ret = "SoapFault = " . $e->faultcode . " - " . $e->faultstring; } var_dump($ret); echo "ok\n"; diff --git a/ext/soap/tests/typemap012.phpt b/ext/soap/tests/typemap012.phpt index 837ae1fd80..039a4f9ba7 100644 --- a/ext/soap/tests/typemap012.phpt +++ b/ext/soap/tests/typemap012.phpt @@ -8,36 +8,36 @@ soap.wsdl_cache_enabled=0 <?php class TestSoapClient extends SoapClient{ function __doRequest($request, $location, $action, $version, $one_way = 0) { - echo $request; - exit; - } + echo $request; + exit; + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } function book_to_xml($book) { - throw new SoapFault("Client", "Conversion Error"); + throw new SoapFault("Client", "Conversion Error"); } $options=Array( - 'actor' =>'http://schemas.nothing.com', - 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", - "type_name" => "book", - "to_xml" => "book_to_xml")) - ); + 'actor' =>'http://schemas.nothing.com', + 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", + "type_name" => "book", + "to_xml" => "book_to_xml")) + ); $client = new TestSoapClient(__DIR__."/classmap.wsdl",$options); $book = new book(); $book->a = "foo"; $book->b = "bar"; try { - $ret = $client->dotest($book); + $ret = $client->dotest($book); } catch (SoapFault $e) { - $ret = "SoapFault = " . $e->faultcode . " - " . $e->faultstring; + $ret = "SoapFault = " . $e->faultcode . " - " . $e->faultstring; } var_dump($ret); echo "ok\n"; diff --git a/ext/soap/tests/typemap013.phpt b/ext/soap/tests/typemap013.phpt index 6d414fdbc0..f73a257d75 100644 --- a/ext/soap/tests/typemap013.phpt +++ b/ext/soap/tests/typemap013.phpt @@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0 --FILE-- <?php $GLOBALS['HTTP_RAW_POST_DATA']=" -<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" - xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" - xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" - xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" - xmlns:ns1=\"http://schemas.nothing.com\" +<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" + xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" + xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" + xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" + xmlns:ns1=\"http://schemas.nothing.com\" > <env:Body> <ns1:dotest2> @@ -22,30 +22,30 @@ $GLOBALS['HTTP_RAW_POST_DATA']=" </env:Envelope>"; function book_to_xml($book) { - return '<book xmlns="http://schemas.nothing.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>'; + return '<book xmlns="http://schemas.nothing.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>'; } class test{ - function dotest2($str){ - $book = new book; - $book->a = "foo"; - $book->b = "bar"; - return $book; - } + function dotest2($str){ + $book = new book; + $book->a = "foo"; + $book->b = "bar"; + return $book; + } } class book{ - public $a="a"; - public $b="c"; + public $a="a"; + public $b="c"; } $options=Array( - 'actor' =>'http://schemas.nothing.com', - 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", - "type_name" => "book", - "to_xml" => "book_to_xml")) - ); + 'actor' =>'http://schemas.nothing.com', + 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", + "type_name" => "book", + "to_xml" => "book_to_xml")) + ); $server = new SoapServer(__DIR__."/classmap.wsdl",$options); $server->setClass("test"); diff --git a/ext/sockets/tests/ipv4loop.phpt b/ext/sockets/tests/ipv4loop.phpt index 7d72992012..4e5d15453b 100644 --- a/ext/sockets/tests/ipv4loop.phpt +++ b/ext/sockets/tests/ipv4loop.phpt @@ -8,45 +8,45 @@ IPv4 Loopback test ?> --FILE-- <?php - /* Setup socket server */ - $server = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp')); - if (!$server) { - die('Unable to create AF_INET socket [server]'); - } - - if (!socket_bind($server, '127.0.0.1', 0)) { - die("Unable to bind to 127.0.0.1"); - } - - if (!socket_listen($server, 2)) { - die('Unable to listen on socket'); - } - - socket_getsockname($server, $unused, $port); - - /* Connect to it */ - $client = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp')); - if (!$client) { - die('Unable to create AF_INET socket [client]'); - } - if (!socket_connect($client, '127.0.0.1', $port)) { - die('Unable to connect to server socket'); - } - - /* Accept that connection */ - $socket = socket_accept($server); - if (!$socket) { - die('Unable to accept connection'); - } - - socket_write($client, "ABCdef123\n"); - - $data = socket_read($socket, 10, PHP_BINARY_READ); - var_dump($data); - - socket_close($client); - socket_close($socket); - socket_close($server); + /* Setup socket server */ + $server = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp')); + if (!$server) { + die('Unable to create AF_INET socket [server]'); + } + + if (!socket_bind($server, '127.0.0.1', 0)) { + die("Unable to bind to 127.0.0.1"); + } + + if (!socket_listen($server, 2)) { + die('Unable to listen on socket'); + } + + socket_getsockname($server, $unused, $port); + + /* Connect to it */ + $client = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp')); + if (!$client) { + die('Unable to create AF_INET socket [client]'); + } + if (!socket_connect($client, '127.0.0.1', $port)) { + die('Unable to connect to server socket'); + } + + /* Accept that connection */ + $socket = socket_accept($server); + if (!$socket) { + die('Unable to accept connection'); + } + + socket_write($client, "ABCdef123\n"); + + $data = socket_read($socket, 10, PHP_BINARY_READ); + var_dump($data); + + socket_close($client); + socket_close($socket); + socket_close($server); ?> --EXPECT-- string(10) "ABCdef123 diff --git a/ext/sockets/tests/ipv6_skipif.inc b/ext/sockets/tests/ipv6_skipif.inc index 8c723a0b20..b2a28bfb02 100644 --- a/ext/sockets/tests/ipv6_skipif.inc +++ b/ext/sockets/tests/ipv6_skipif.inc @@ -1,7 +1,7 @@ <?php if (getenv("CI_NO_IPV6") || !defined("AF_INET6")) { - die('skip no IPv6 support'); + die('skip no IPv6 support'); } if (@stream_socket_client('udp://[::1]:8888') === false) - die('skip no IPv6 support'); + die('skip no IPv6 support'); diff --git a/ext/sockets/tests/ipv6loop.phpt b/ext/sockets/tests/ipv6loop.phpt index 24e2b6d4f6..109da5bc2d 100644 --- a/ext/sockets/tests/ipv6loop.phpt +++ b/ext/sockets/tests/ipv6loop.phpt @@ -9,48 +9,48 @@ IPv6 Loopback test ?> --FILE-- <?php - /* Setup socket server */ - $server = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp')); - if (!$server) { - die('Unable to create AF_INET6 socket [server]'); - } - $bound = false; - for($port = 31337; $port < 31357; ++$port) { - if (@socket_bind($server, '::1', $port)) { - $bound = true; - break; - } - } - if (!$bound) { - die("Unable to bind to [::1]:$port"); - } - if (!socket_listen($server, 2)) { - die('Unable to listen on socket'); - } + /* Setup socket server */ + $server = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp')); + if (!$server) { + die('Unable to create AF_INET6 socket [server]'); + } + $bound = false; + for($port = 31337; $port < 31357; ++$port) { + if (@socket_bind($server, '::1', $port)) { + $bound = true; + break; + } + } + if (!$bound) { + die("Unable to bind to [::1]:$port"); + } + if (!socket_listen($server, 2)) { + die('Unable to listen on socket'); + } - /* Connect to it */ - $client = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp')); - if (!$client) { - die('Unable to create AF_INET6 socket [client]'); - } - if (!socket_connect($client, '::1', $port)) { - die('Unable to connect to server socket'); - } + /* Connect to it */ + $client = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp')); + if (!$client) { + die('Unable to create AF_INET6 socket [client]'); + } + if (!socket_connect($client, '::1', $port)) { + die('Unable to connect to server socket'); + } - /* Accept that connection */ - $socket = socket_accept($server); - if (!$socket) { - die('Unable to accept connection'); - } + /* Accept that connection */ + $socket = socket_accept($server); + if (!$socket) { + die('Unable to accept connection'); + } - socket_write($client, "ABCdef123\n"); + socket_write($client, "ABCdef123\n"); - $data = socket_read($socket, 10, PHP_BINARY_READ); - var_dump($data); + $data = socket_read($socket, 10, PHP_BINARY_READ); + var_dump($data); - socket_close($client); - socket_close($socket); - socket_close($server); + socket_close($client); + socket_close($socket); + socket_close($server); ?> --EXPECT-- string(10) "ABCdef123 diff --git a/ext/sockets/tests/mcast_helpers.php.inc b/ext/sockets/tests/mcast_helpers.php.inc index ad65a3f9d6..7b73a9d77a 100644 --- a/ext/sockets/tests/mcast_helpers.php.inc +++ b/ext/sockets/tests/mcast_helpers.php.inc @@ -1,8 +1,8 @@ <?php function checktimeout($sock, $limit) { - $readfs = array($sock); - $writefs = $exceptfs = array(); - if (socket_select($readfs, $writefs, $exceptfs, 0, $limit*1000) != 1) { - die("Socket read timeout hit. Can be a bug, a test bug, or a firewall issue."); - } + $readfs = array($sock); + $writefs = $exceptfs = array(); + if (socket_select($readfs, $writefs, $exceptfs, 0, $limit*1000) != 1) { + die("Socket read timeout hit. Can be a bug, a test bug, or a firewall issue."); + } } diff --git a/ext/sockets/tests/mcast_ipv4_recv.phpt b/ext/sockets/tests/mcast_ipv4_recv.phpt index aef566e915..16e2e91b62 100644 --- a/ext/sockets/tests/mcast_ipv4_recv.phpt +++ b/ext/sockets/tests/mcast_ipv4_recv.phpt @@ -43,8 +43,8 @@ $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, + "group" => $mcastaddr, + "interface" => $interface, )); var_dump($so); @@ -54,101 +54,101 @@ var_dump($r); $i = 0; checktimeout($s, 500); while (($str = socket_read($s, 3000)) !== FALSE) { - $i++; - echo "$i> ", $str, "\n"; + $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); + 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); + 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); + 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); + 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); + 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); + 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); + 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; + $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + )); + var_dump($so);*/ + break; } } diff --git a/ext/sockets/tests/mcast_ipv6_recv.phpt b/ext/sockets/tests/mcast_ipv6_recv.phpt index 62fa1a9c4d..10233b49a5 100644 --- a/ext/sockets/tests/mcast_ipv6_recv.phpt +++ b/ext/sockets/tests/mcast_ipv6_recv.phpt @@ -63,8 +63,8 @@ $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, + "group" => $mcastaddr, + "interface" => $interface, )) or die("err"); var_dump($so); @@ -81,100 +81,100 @@ var_dump($r); $i = 0; checktimeout($s, 500); while (($str = socket_read($s, 3000)) !== FALSE) { - $i++; - echo "$i> ", $str, "\n"; + $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); + 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); + 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); + 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); + 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); + 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); + 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); + 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; + /*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; } } diff --git a/ext/sockets/tests/mcast_ipv6_recv_limited.phpt b/ext/sockets/tests/mcast_ipv6_recv_limited.phpt index c739264062..87b38c144c 100644 --- a/ext/sockets/tests/mcast_ipv6_recv_limited.phpt +++ b/ext/sockets/tests/mcast_ipv6_recv_limited.phpt @@ -58,8 +58,8 @@ $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, + "group" => $mcastaddr, + "interface" => $interface, )) or die("err"); var_dump($so); @@ -76,33 +76,33 @@ var_dump($r); $i = 0; checktimeout($s, 500); while (($str = socket_read($s, 3000, 500)) !== FALSE) { - $i++; - echo "$i> ", $str, "\n"; + $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); + 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); + 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; + break; } } diff --git a/ext/sockets/tests/socket_abstract_path.phpt b/ext/sockets/tests/socket_abstract_path.phpt index 4c89dc4238..bbe4debeaa 100644 --- a/ext/sockets/tests/socket_abstract_path.phpt +++ b/ext/sockets/tests/socket_abstract_path.phpt @@ -28,8 +28,8 @@ socket_connect($clients, $path) or die("Error connecting"); $conns = socket_accept($servers) or die("Could not accept connection"); $r = socket_sendmsg($clients, [ - //"name" => [ "addr" => $path, ], - "iov" => ["test ", "thing", "\n"], + //"name" => [ "addr" => $path, ], + "iov" => ["test ", "thing", "\n"], ], 0); var_dump($r); checktimeout($conns, 500); diff --git a/ext/sockets/tests/socket_abstract_path_sendmsg.phpt b/ext/sockets/tests/socket_abstract_path_sendmsg.phpt index e8499e021c..ca9ab3f534 100644 --- a/ext/sockets/tests/socket_abstract_path_sendmsg.phpt +++ b/ext/sockets/tests/socket_abstract_path_sendmsg.phpt @@ -24,8 +24,8 @@ $s = socket_create(AF_UNIX, SOCK_DGRAM, 0) or die("err"); socket_bind($s, $path) or die("err"); $r = socket_sendmsg($sends1, [ - "name" => [ "path" => $path], - "iov" => ["test ", "thing", "\n"], + "name" => [ "path" => $path], + "iov" => ["test ", "thing", "\n"], ], 0); var_dump($r); checktimeout($s, 500); diff --git a/ext/sockets/tests/socket_export_stream-3.phpt b/ext/sockets/tests/socket_export_stream-3.phpt index b59c7700da..ac48d865b9 100644 --- a/ext/sockets/tests/socket_export_stream-3.phpt +++ b/ext/sockets/tests/socket_export_stream-3.phpt @@ -23,8 +23,8 @@ socket_bind($sock, '0.0.0.0', 58393); $stream = socket_export_stream($sock); var_dump($stream); $so = socket_set_option($sock, IPPROTO_IP, MCAST_JOIN_GROUP, array( - "group" => '224.0.0.23', - "interface" => "lo", + "group" => '224.0.0.23', + "interface" => "lo", )); var_dump($so); diff --git a/ext/sockets/tests/socket_export_stream-4-win.phpt b/ext/sockets/tests/socket_export_stream-4-win.phpt index 1d53fef361..24fc604f6e 100644 --- a/ext/sockets/tests/socket_export_stream-4-win.phpt +++ b/ext/sockets/tests/socket_export_stream-4-win.phpt @@ -12,32 +12,32 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) { <?php function test($stream, $sock) { - if ($stream !== null) { - echo "stream_set_blocking "; - try { - print_r(stream_set_blocking($stream, 0)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - echo "\n"; - } - if ($sock !== null) { - echo "socket_set_block "; - try { - print_r(socket_set_block($sock)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - echo "\n"; - echo "socket_get_option "; - try { - print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - echo "\n"; - } - echo "\n"; + if ($stream !== null) { + echo "stream_set_blocking "; + try { + print_r(stream_set_blocking($stream, 0)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + echo "\n"; + } + if ($sock !== null) { + echo "socket_set_block "; + try { + print_r(socket_set_block($sock)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + echo "\n"; + echo "socket_get_option "; + try { + print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + echo "\n"; + } + echo "\n"; } echo "normal\n"; diff --git a/ext/sockets/tests/socket_export_stream-4.phpt b/ext/sockets/tests/socket_export_stream-4.phpt index 668ac648d3..a42c31e123 100644 --- a/ext/sockets/tests/socket_export_stream-4.phpt +++ b/ext/sockets/tests/socket_export_stream-4.phpt @@ -12,32 +12,32 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) { <?php function test($stream, $sock) { - if ($stream !== null) { - echo "stream_set_blocking "; - try { - print_r(stream_set_blocking($stream, 0)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - echo "\n"; - } - if ($sock !== null) { - echo "socket_set_block "; - try { + if ($stream !== null) { + echo "stream_set_blocking "; + try { + print_r(stream_set_blocking($stream, 0)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + echo "\n"; + } + if ($sock !== null) { + echo "socket_set_block "; + try { print_r(socket_set_block($sock)); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } - echo "\n"; - echo "socket_get_option "; - try { + echo "\n"; + echo "socket_get_option "; + try { print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } - echo "\n"; - } - echo "\n"; + echo "\n"; + } + echo "\n"; } echo "normal\n"; diff --git a/ext/sockets/tests/socket_getpeername_ipv4loop.phpt b/ext/sockets/tests/socket_getpeername_ipv4loop.phpt index c7eb1003e0..0c242e75c1 100644 --- a/ext/sockets/tests/socket_getpeername_ipv4loop.phpt +++ b/ext/sockets/tests/socket_getpeername_ipv4loop.phpt @@ -11,8 +11,8 @@ Tatjana Andersen tatjana.andersen@redpill-linpro.com ?> --FILE-- <?php - /* Bind and connect sockets to localhost */ - $localhost = '127.0.0.1'; + /* Bind and connect sockets to localhost */ + $localhost = '127.0.0.1'; /* Setup socket server */ $server = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp')); @@ -20,16 +20,16 @@ Tatjana Andersen tatjana.andersen@redpill-linpro.com die('Unable to create AF_INET socket [server]'); } - $minport = 31337; - $maxport = 31356; - $bound = false; - for($port = $minport; $port <= $maxport; ++$port) { - if (@socket_bind($server, $localhost, $port)) { - $bound = true; - break; - } - } - if (!$bound) { + $minport = 31337; + $maxport = 31356; + $bound = false; + for($port = $minport; $port <= $maxport; ++$port) { + if (@socket_bind($server, $localhost, $port)) { + $bound = true; + break; + } + } + if (!$bound) { die('Unable to bind to '.$localhost); } if (!socket_listen($server, 2)) { @@ -51,9 +51,9 @@ Tatjana Andersen tatjana.andersen@redpill-linpro.com die('Unable to accept connection'); } - if (!socket_getpeername($client, $address, $peerport)) { - die('Unable to retrieve peer name'); - } + if (!socket_getpeername($client, $address, $peerport)) { + die('Unable to retrieve peer name'); + } var_dump($address, $port === $peerport); socket_close($client); diff --git a/ext/sockets/tests/socket_getpeername_ipv6loop.phpt b/ext/sockets/tests/socket_getpeername_ipv6loop.phpt index 73a5a66410..3dab562bbb 100644 --- a/ext/sockets/tests/socket_getpeername_ipv6loop.phpt +++ b/ext/sockets/tests/socket_getpeername_ipv6loop.phpt @@ -12,8 +12,8 @@ require 'ipv6_skipif.inc'; ?> --FILE-- <?php - /* Bind and connect sockets to localhost */ - $localhost = '::1'; + /* Bind and connect sockets to localhost */ + $localhost = '::1'; /* Setup socket server */ $server = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp')); @@ -21,16 +21,16 @@ require 'ipv6_skipif.inc'; die('Unable to create AF_INET6 socket [server]'); } - $minport = 31337; - $maxport = 31356; - $bound = false; - for($port = $minport; $port <= $maxport; ++$port) { - if (@socket_bind($server, $localhost, $port)) { - $bound = true; - break; - } - } - if (!$bound) { + $minport = 31337; + $maxport = 31356; + $bound = false; + for($port = $minport; $port <= $maxport; ++$port) { + if (@socket_bind($server, $localhost, $port)) { + $bound = true; + break; + } + } + if (!$bound) { die('Unable to bind to '.$localhost); } if (!socket_listen($server, 2)) { @@ -49,12 +49,12 @@ require 'ipv6_skipif.inc'; /* Accept that connection */ $socket = socket_accept($server); if (!$socket) { - die('Unable to accept connection'); + die('Unable to accept connection'); } - if (!socket_getpeername($client, $address, $peerport)) { - die('Unable to retrieve peer name'); - } + if (!socket_getpeername($client, $address, $peerport)) { + die('Unable to retrieve peer name'); + } var_dump($address, $port === $peerport); socket_close($client); diff --git a/ext/sockets/tests/socket_import_stream-3.phpt b/ext/sockets/tests/socket_import_stream-3.phpt index 61eccfc537..4f8668ec87 100644 --- a/ext/sockets/tests/socket_import_stream-3.phpt +++ b/ext/sockets/tests/socket_import_stream-3.phpt @@ -22,8 +22,8 @@ $stream = stream_socket_server("udp://0.0.0.0:58379", $errno, $errstr, STREAM_SE $sock = socket_import_stream($stream); var_dump($sock); $so = socket_set_option($sock, IPPROTO_IP, MCAST_JOIN_GROUP, array( - "group" => '224.0.0.23', - "interface" => "lo", + "group" => '224.0.0.23', + "interface" => "lo", )); var_dump($so); diff --git a/ext/sockets/tests/socket_import_stream-4-win.phpt b/ext/sockets/tests/socket_import_stream-4-win.phpt index 9161db2cf1..16a9c0087e 100644 --- a/ext/sockets/tests/socket_import_stream-4-win.phpt +++ b/ext/sockets/tests/socket_import_stream-4-win.phpt @@ -12,32 +12,32 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) { <?php function test($stream, $sock) { - if ($stream !== null) { - echo "stream_set_blocking "; - try { - print_r(stream_set_blocking($stream, 0)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - echo "\n"; - } - if ($sock !== null) { - echo "socket_set_block "; - try { - print_r(socket_set_block($sock)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - echo "\n"; - echo "socket_get_option "; - try { - print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - echo "\n"; - } - echo "\n"; + if ($stream !== null) { + echo "stream_set_blocking "; + try { + print_r(stream_set_blocking($stream, 0)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + echo "\n"; + } + if ($sock !== null) { + echo "socket_set_block "; + try { + print_r(socket_set_block($sock)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + echo "\n"; + echo "socket_get_option "; + try { + print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + echo "\n"; + } + echo "\n"; } echo "normal\n"; diff --git a/ext/sockets/tests/socket_import_stream-4.phpt b/ext/sockets/tests/socket_import_stream-4.phpt index 5a528c6e33..d0ccf6b71e 100644 --- a/ext/sockets/tests/socket_import_stream-4.phpt +++ b/ext/sockets/tests/socket_import_stream-4.phpt @@ -12,32 +12,32 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) { <?php function test($stream, $sock) { - if ($stream !== null) { - echo "stream_set_blocking "; - try { - print_r(stream_set_blocking($stream, 0)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - echo "\n"; - } - if ($sock !== null) { - echo "socket_set_block "; - try { - print_r(socket_set_block($sock)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - echo "\n"; - echo "socket_get_option "; - try { - print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - echo "\n"; - } - echo "\n"; + if ($stream !== null) { + echo "stream_set_blocking "; + try { + print_r(stream_set_blocking($stream, 0)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + echo "\n"; + } + if ($sock !== null) { + echo "socket_set_block "; + try { + print_r(socket_set_block($sock)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + echo "\n"; + echo "socket_get_option "; + try { + print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + echo "\n"; + } + echo "\n"; } echo "normal\n"; diff --git a/ext/sockets/tests/socket_sendrecvmsg_multi_msg-unix.phpt b/ext/sockets/tests/socket_sendrecvmsg_multi_msg-unix.phpt index be42447f58..2de272356a 100644 --- a/ext/sockets/tests/socket_sendrecvmsg_multi_msg-unix.phpt +++ b/ext/sockets/tests/socket_sendrecvmsg_multi_msg-unix.phpt @@ -41,13 +41,13 @@ socket_set_option($s, IPPROTO_IPV6, IPV6_RECVPKTINFO, 1) or die("err"); socket_set_option($s, IPPROTO_IPV6, IPV6_RECVTCLASS, 1) or die("err"); $r = socket_sendmsg($sends1, [ - "name" => [ "addr" => "::1", "port" => 3002], - "iov" => ["test ", "thing", "\n"], - "control" => [[ - "level" => IPPROTO_IPV6, - "type" => IPV6_TCLASS, - "data" => 40, - ]] + "name" => [ "addr" => "::1", "port" => 3002], + "iov" => ["test ", "thing", "\n"], + "control" => [[ + "level" => IPPROTO_IPV6, + "type" => IPV6_TCLASS, + "data" => 40, + ]] ], 0); var_dump($r); checktimeout($s, 500); @@ -56,7 +56,7 @@ $data = [ "name" => ["family" => AF_INET6, "addr" => "::1"], "buffer_size" => 2000, "controllen" => socket_cmsg_space(IPPROTO_IPV6, IPV6_PKTINFO) + - socket_cmsg_space(IPPROTO_IPV6, IPV6_TCLASS), + socket_cmsg_space(IPPROTO_IPV6, IPV6_TCLASS), ]; if (!socket_recvmsg($s, $data, 0)) die("recvmsg"); print_r($data); diff --git a/ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt b/ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt index f06e0a4789..ff61d3a230 100644 --- a/ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt +++ b/ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt @@ -32,16 +32,16 @@ socket_set_option($s, IPPROTO_IPV6, IPV6_RECVPKTINFO, 1) or die("err"); socket_set_option($s, IPPROTO_IPV6, IPV6_RECVTCLASS, 1) or die("err"); $r = socket_sendmsg($sends1, [ - "name" => [ "addr" => "::1", "port" => 3003], - "iov" => ["test ", "thing", "\n"], - "control" => [[ - "level" => IPPROTO_IPV6, - "type" => IPV6_PKTINFO, - "data" => [ - 'addr' => '::1', + "name" => [ "addr" => "::1", "port" => 3003], + "iov" => ["test ", "thing", "\n"], + "control" => [[ + "level" => IPPROTO_IPV6, + "type" => IPV6_PKTINFO, + "data" => [ + 'addr' => '::1', 'ifindex' => 1 /* we're assuming loopback is 1. Is this a safe assumption? */ - ], - ]] + ], + ]] ], 0); var_dump($r); checktimeout($s, 500); @@ -50,7 +50,7 @@ $data = [ "name" => ["family" => AF_INET6, "addr" => "::1"], "buffer_size" => 2000, "controllen" => socket_cmsg_space(IPPROTO_IPV6, IPV6_PKTINFO) + - socket_cmsg_space(IPPROTO_IPV6, IPV6_TCLASS), + socket_cmsg_space(IPPROTO_IPV6, IPV6_TCLASS), ]; if (!socket_recvmsg($s, $data, 0)) die("recvmsg"); print_r($data); diff --git a/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt index 600cbea595..6e063c5b52 100644 --- a/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt +++ b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt @@ -28,10 +28,10 @@ if (!extension_loaded('sockets')) { $len = strlen($msg); $bytes_sent = socket_sendto($socket, $msg, $len, 0, $address); if ($bytes_sent == -1) { - @unlink($address); + @unlink($address); die('An error occurred while sending to the socket'); } else if ($bytes_sent != $len) { - @unlink($address); + @unlink($address); die($bytes_sent . ' bytes have been sent instead of the ' . $len . ' bytes expected'); } @@ -39,16 +39,16 @@ if (!extension_loaded('sockets')) { var_dump(socket_recvfrom($socket, $buf, 0, 0, $from)); // expect false $bytes_received = socket_recvfrom($socket, $buf, 12, 0, $from); if ($bytes_received == -1) { - @unlink($address); + @unlink($address); die('An error occurred while receiving from the socket'); } else if ($bytes_received != $len) { - @unlink($address); + @unlink($address); die($bytes_received . ' bytes have been received instead of the ' . $len . ' bytes expected'); } echo "Received $buf"; socket_close($socket); - @unlink($address); + @unlink($address); ?> --EXPECTF-- Warning: socket_create(): Unable to create socket [%d]: Protocol not supported in %s on line %d diff --git a/ext/sockets/tests/unixloop.phpt b/ext/sockets/tests/unixloop.phpt index cd4afd65c7..31740c97c6 100644 --- a/ext/sockets/tests/unixloop.phpt +++ b/ext/sockets/tests/unixloop.phpt @@ -11,47 +11,47 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { ?> --FILE-- <?php - $sock_path = sprintf("/tmp/%s.sock", uniqid()); + $sock_path = sprintf("/tmp/%s.sock", uniqid()); - if (file_exists($sock_path)) - die('Temporary socket already exists.'); + if (file_exists($sock_path)) + die('Temporary socket already exists.'); - /* Setup socket server */ - $server = socket_create(AF_UNIX, SOCK_STREAM, 0); - if (!$server) { - die('Unable to create AF_UNIX socket [server]'); - } - if (!socket_bind($server, $sock_path)) { - die("Unable to bind to $sock_path"); - } - if (!socket_listen($server, 2)) { - die('Unable to listen on socket'); - } + /* Setup socket server */ + $server = socket_create(AF_UNIX, SOCK_STREAM, 0); + if (!$server) { + die('Unable to create AF_UNIX socket [server]'); + } + if (!socket_bind($server, $sock_path)) { + die("Unable to bind to $sock_path"); + } + if (!socket_listen($server, 2)) { + die('Unable to listen on socket'); + } - /* Connect to it */ - $client = socket_create(AF_UNIX, SOCK_STREAM, 0); - if (!$client) { - die('Unable to create AF_UNIX socket [client]'); - } - if (!socket_connect($client, $sock_path)) { - die('Unable to connect to server socket'); - } + /* Connect to it */ + $client = socket_create(AF_UNIX, SOCK_STREAM, 0); + if (!$client) { + die('Unable to create AF_UNIX socket [client]'); + } + if (!socket_connect($client, $sock_path)) { + die('Unable to connect to server socket'); + } - /* Accept that connection */ - $socket = socket_accept($server); - if (!$socket) { - die('Unable to accept connection'); - } + /* Accept that connection */ + $socket = socket_accept($server); + if (!$socket) { + die('Unable to accept connection'); + } - socket_write($client, "ABCdef123\n"); + socket_write($client, "ABCdef123\n"); - $data = socket_read($socket, 10, PHP_BINARY_READ); - var_dump($data); + $data = socket_read($socket, 10, PHP_BINARY_READ); + var_dump($data); - socket_close($client); - socket_close($socket); - socket_close($server); - @unlink($sock_path); + socket_close($client); + socket_close($socket); + socket_close($server); + @unlink($sock_path); ?> --EXPECT-- string(10) "ABCdef123 diff --git a/ext/sockets/tests/wsaprotocol_info_0.phpt b/ext/sockets/tests/wsaprotocol_info_0.phpt index 8653fe1bab..3e251914ed 100644 --- a/ext/sockets/tests/wsaprotocol_info_0.phpt +++ b/ext/sockets/tests/wsaprotocol_info_0.phpt @@ -11,40 +11,40 @@ if (!extension_loaded('sockets')) { ?> --FILE-- <?php - $address = 'localhost'; - $port = 10000; + $address = 'localhost'; + $port = 10000; - if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) { - fprintf(STDERR, "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n"); - } + if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) { + fprintf(STDERR, "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n"); + } - if (socket_bind($sock, $address, $port) === false) { - fprintf(STDERR, "socket_bind() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"); - } + if (socket_bind($sock, $address, $port) === false) { + fprintf(STDERR, "socket_bind() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"); + } - if (socket_listen($sock, 5) === false) { - fprintf(STDERR, "socket_listen() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"); - } + if (socket_listen($sock, 5) === false) { + fprintf(STDERR, "socket_listen() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"); + } - /* Duplicate socket in the same process. */ - $pid = getmypid(); - $info = socket_wsaprotocol_info_export($sock, $pid); - $sock2 = socket_wsaprotocol_info_import($info); - var_dump(socket_wsaprotocol_info_release($info)); + /* Duplicate socket in the same process. */ + $pid = getmypid(); + $info = socket_wsaprotocol_info_export($sock, $pid); + $sock2 = socket_wsaprotocol_info_import($info); + var_dump(socket_wsaprotocol_info_release($info)); - var_dump($sock, $sock2); + var_dump($sock, $sock2); - /* Close duplicated socket, the original is still valid. */ - socket_close($sock2); - var_dump($sock, $sock2); + /* Close duplicated socket, the original is still valid. */ + socket_close($sock2); + var_dump($sock, $sock2); - /* Using invalid PID. */ - $info = socket_wsaprotocol_info_export($sock, 123412341); + /* Using invalid PID. */ + $info = socket_wsaprotocol_info_export($sock, 123412341); - socket_close($sock); + socket_close($sock); - /* Importing with invalid identifier. */ - $sock2 = socket_wsaprotocol_info_import("garbage"); + /* Importing with invalid identifier. */ + $sock2 = socket_wsaprotocol_info_import("garbage"); ?> --EXPECTF-- bool(true) diff --git a/ext/sodium/tests/installed.phpt b/ext/sodium/tests/installed.phpt index e6101ed509..f004efa714 100644 --- a/ext/sodium/tests/installed.phpt +++ b/ext/sodium/tests/installed.phpt @@ -9,7 +9,7 @@ echo "sodium extension is available"; you can add regression tests for your extension here the output of your test code has to be equal to the - text in the --EXPECT-- section below for the tests + text in the--EXPECT-- section below for the tests to pass, differences between the output and the expected text are interpreted as failure */ diff --git a/ext/sodium/tests/pwhash_scrypt.phpt b/ext/sodium/tests/pwhash_scrypt.phpt index 92db7ac7e0..8e02f7ba0e 100644 --- a/ext/sodium/tests/pwhash_scrypt.phpt +++ b/ext/sodium/tests/pwhash_scrypt.phpt @@ -9,9 +9,9 @@ $passwd = 'test'; $hash = sodium_crypto_pwhash_scryptsalsa208sha256_str ($passwd, SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE, - SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE); + SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE); var_dump(substr($hash, 0, 3) === - SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX); + SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX); $c = sodium_crypto_pwhash_scryptsalsa208sha256_str_verify($hash, $passwd); var_dump($c); diff --git a/ext/sodium/tests/utils.phpt b/ext/sodium/tests/utils.phpt index 5823ab0b7f..eeca5363e1 100644 --- a/ext/sodium/tests/utils.phpt +++ b/ext/sodium/tests/utils.phpt @@ -93,7 +93,7 @@ if (defined('SODIUM_BASE64_VARIANT_ORIGINAL')) { var_dump('base64("O") case passed'); var_dump('abcd'); } - + function sodium_foo() { throw new SodiumException('test'); diff --git a/ext/spl/tests/CallbackFilterIteratorTest-002.phpt b/ext/spl/tests/CallbackFilterIteratorTest-002.phpt index 3579508472..62beb88cd5 100644 --- a/ext/spl/tests/CallbackFilterIteratorTest-002.phpt +++ b/ext/spl/tests/CallbackFilterIteratorTest-002.phpt @@ -4,41 +4,41 @@ CallbackFilterIterator 002 <?php set_error_handler(function($errno, $errstr){ - echo $errstr . "\n"; - return true; + echo $errstr . "\n"; + return true; }); try { - new CallbackFilterIterator(); + new CallbackFilterIterator(); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new CallbackFilterIterator(null); + new CallbackFilterIterator(null); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new CallbackFilterIterator(new ArrayIterator(array()), null); + new CallbackFilterIterator(new ArrayIterator(array()), null); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - new CallbackFilterIterator(new ArrayIterator(array()), array()); + new CallbackFilterIterator(new ArrayIterator(array()), array()); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } $it = new CallbackFilterIterator(new ArrayIterator(array(1)), function() { - throw new Exception("some message"); + throw new Exception("some message"); }); try { - foreach($it as $e); + foreach($it as $e); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } --EXPECT-- CallbackFilterIterator::__construct() expects exactly 2 parameters, 0 given diff --git a/ext/spl/tests/CallbackFilterIteratorTest.phpt b/ext/spl/tests/CallbackFilterIteratorTest.phpt index 36bc770a95..bf8f85b8db 100644 --- a/ext/spl/tests/CallbackFilterIteratorTest.phpt +++ b/ext/spl/tests/CallbackFilterIteratorTest.phpt @@ -16,13 +16,13 @@ class B { } function test($value, $key, $inner) { - printf("%s / %s / %d / %d\n" - , $value - , $key - , $value == $inner->current() - , $key == $inner->key() - ); - return $value === 1 || $value === 4; + printf("%s / %s / %d / %d\n" + , $value + , $key + , $value == $inner->current() + , $key == $inner->key() + ); + return $value === 1 || $value === 4; } $tests = array( @@ -45,7 +45,7 @@ foreach($tests as $name => $test) { echo "=> $value\n"; } - // same test, with no reference to callback + // same test, with no reference to callback $it = new ArrayIterator(range(1, 5)); $it = new CallbackFilterIterator($it, $test()); diff --git a/ext/spl/tests/DirectoryIterator_by_reference.phpt b/ext/spl/tests/DirectoryIterator_by_reference.phpt index 570d09f406..0f28262190 100644 --- a/ext/spl/tests/DirectoryIterator_by_reference.phpt +++ b/ext/spl/tests/DirectoryIterator_by_reference.phpt @@ -7,7 +7,7 @@ Havard Eide <nucleuz@gmail.com> <?php $it = new DirectoryIterator(__DIR__); foreach( $it as &$file ) { - echo $file . "\n"; + echo $file . "\n"; } ?> --EXPECTF-- diff --git a/ext/spl/tests/RecursiveCallbackFilterIteratorTest.phpt b/ext/spl/tests/RecursiveCallbackFilterIteratorTest.phpt index f55afd8202..7620138eb9 100644 --- a/ext/spl/tests/RecursiveCallbackFilterIteratorTest.phpt +++ b/ext/spl/tests/RecursiveCallbackFilterIteratorTest.phpt @@ -16,16 +16,16 @@ class B { } function test($value, $key, $inner) { - if ($inner->hasChildren()) { - return true; - } - printf("%s / %s / %d / %d\n" - , print_r($value, true) - , $key - , $value == $inner->current() - , $key == $inner->key() - ); - return $value === 1 || $value === 4; + if ($inner->hasChildren()) { + return true; + } + printf("%s / %s / %d / %d\n" + , print_r($value, true) + , $key + , $value == $inner->current() + , $key == $inner->key() + ); + return $value === 1 || $value === 4; } $tests = array( @@ -41,7 +41,7 @@ foreach($tests as $name => $test) { $callback = $test(); $it = new RecursiveArrayIterator(array(1, array(2, 3), array(4, 5))); $it = new RecursiveCallbackFilterIterator($it, $callback); - $it = new RecursiveIteratorIterator($it); + $it = new RecursiveIteratorIterator($it); echo " = $name =\n"; @@ -49,11 +49,11 @@ foreach($tests as $name => $test) { echo "=> $value\n"; } - // same test, with no reference to callback + // same test, with no reference to callback $it = new RecursiveArrayIterator(array(1, array(2, 3), array(4, 5))); $it = new RecursiveCallbackFilterIterator($it, $test()); - $it = new RecursiveIteratorIterator($it); + $it = new RecursiveIteratorIterator($it); unset($callback); foreach($it as $value) { diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt index 4d8c1394b6..c050f2e79e 100644 --- a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt +++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt @@ -21,7 +21,7 @@ while($it->valid()) { } asort($list); foreach ($list as $item) { - echo $item . "\n"; + echo $item . "\n"; } ?> --CLEAN-- diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt index 6527d84bfe..e7238252f0 100644 --- a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt +++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt @@ -24,7 +24,7 @@ while($it->valid()) { } asort($list); foreach ($list as $item) { - echo $item . "\n"; + echo $item . "\n"; } ?> --CLEAN-- diff --git a/ext/spl/tests/SplDoublyLinkedList_add_invalid_offset.phpt b/ext/spl/tests/SplDoublyLinkedList_add_invalid_offset.phpt index fa38d93425..401d8ae1b3 100644 --- a/ext/spl/tests/SplDoublyLinkedList_add_invalid_offset.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_add_invalid_offset.phpt @@ -3,10 +3,10 @@ Check that SplDoublyLinkedList::add throws an exception with an invalid offset a --FILE-- <?php try { - $dll = new SplDoublyLinkedList(); - var_dump($dll->add(12,'Offset 12 should not exist')); + $dll = new SplDoublyLinkedList(); + var_dump($dll->add(12,'Offset 12 should not exist')); } catch (OutOfRangeException $e) { - echo "Exception: ".$e->getMessage()."\n"; + echo "Exception: ".$e->getMessage()."\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/SplDoublyLinkedList_add_null_offset.phpt b/ext/spl/tests/SplDoublyLinkedList_add_null_offset.phpt index b14c9ab013..f8c58d9c70 100644 --- a/ext/spl/tests/SplDoublyLinkedList_add_null_offset.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_add_null_offset.phpt @@ -3,10 +3,10 @@ Check that SplDoublyLinkedList::add throws an exception with an invalid offset a --FILE-- <?php try { - $dll = new SplDoublyLinkedList(); - var_dump($dll->add(NULL,2)); + $dll = new SplDoublyLinkedList(); + var_dump($dll->add(NULL,2)); } catch (OutOfRangeException $e) { - echo "Exception: ".$e->getMessage()."\n"; + echo "Exception: ".$e->getMessage()."\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/SplDoublyLinkedList_debug-info.phpt b/ext/spl/tests/SplDoublyLinkedList_debug-info.phpt index c5d10919ff..b008715eef 100644 --- a/ext/spl/tests/SplDoublyLinkedList_debug-info.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_debug-info.phpt @@ -4,16 +4,16 @@ Check that SplDoublyLinkedList returns debug info when print_r is used. PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com ) --FILE-- <?php - // Create a new Doubly Linked List - $dll = new SplDoublyLinkedList(); + // Create a new Doubly Linked List + $dll = new SplDoublyLinkedList(); - // Add some items to the list - $dll->push(1); - $dll->push(2); - $dll->push(3); + // Add some items to the list + $dll->push(1); + $dll->push(2); + $dll->push(3); - // Check the debug info - print_r($dll); + // Check the debug info + print_r($dll); ?> --EXPECT-- SplDoublyLinkedList Object diff --git a/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt b/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt index 4e9e2b33de..8c8012202e 100644 --- a/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt @@ -4,10 +4,10 @@ Check that SplDoublyLinkedList->isEmpty() correctly returns true for an empty li PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com ) --FILE-- <?php - // Create a new Doubly Linked List - $dll = new SplDoublyLinkedList(); + // Create a new Doubly Linked List + $dll = new SplDoublyLinkedList(); - var_dump($dll->isEmpty()); + var_dump($dll->isEmpty()); ?> --EXPECT-- bool(true) diff --git a/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt b/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt index 4b308f345b..0d26da14d5 100644 --- a/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt @@ -4,16 +4,16 @@ Check that SplDoublyLinkedList->isEmpty() correctly returns true for a non-empty PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com ) --FILE-- <?php - // Create a new Doubly Linked List - $dll = new SplDoublyLinkedList(); + // Create a new Doubly Linked List + $dll = new SplDoublyLinkedList(); - // Add some items to the list - $dll->push(1); - $dll->push(2); - $dll->push(3); - //var_dump($dll); + // Add some items to the list + $dll->push(1); + $dll->push(2); + $dll->push(3); + //var_dump($dll); - var_dump($dll->isEmpty()); + var_dump($dll->isEmpty()); ?> --EXPECT-- bool(false) diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt index fc8c4b7dcd..a6c5db200e 100644 --- a/ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt @@ -12,17 +12,17 @@ $list->push('def'); // Validate that we can see the first value if($list->offsetExists(0) === true) { - echo "PASS\n"; + echo "PASS\n"; } // Validate that we can see the second value if($list->offsetExists(1) === true) { - echo "PASS\n"; + echo "PASS\n"; } // Check that there is no third value if($list->offsetExists(2) === false) { - echo "PASS\n"; + echo "PASS\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt index 838100be1e..364eb5ca79 100644 --- a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt @@ -4,20 +4,20 @@ Check that SplDoublyLinkedList->offsetUnset() returns an error message when the PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com ) --FILE-- <?php - // Create a new Doubly Linked List - $dll = new SplDoublyLinkedList(); + // Create a new Doubly Linked List + $dll = new SplDoublyLinkedList(); - // Add some items to the list - $dll->push(1); - $dll->push(2); - $dll->push(3); + // Add some items to the list + $dll->push(1); + $dll->push(2); + $dll->push(3); - try { - $dll->offsetUnset(-1); - } - catch (Exception $e) { - echo $e->getMessage() . "\n"; - } + try { + $dll->offsetUnset(-1); + } + catch (Exception $e) { + echo $e->getMessage() . "\n"; + } ?> --EXPECT-- Offset out of range diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt index cd77f11aef..5ba7b27e56 100644 --- a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt @@ -4,20 +4,20 @@ Check that SplDoublyLinkedList->offsetUnset() returns an error message when the PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com ) --FILE-- <?php - // Create a new Doubly Linked List - $dll = new SplDoublyLinkedList(); + // Create a new Doubly Linked List + $dll = new SplDoublyLinkedList(); - // Add some items to the list - $dll->push(1); - $dll->push(2); - $dll->push(3); + // Add some items to the list + $dll->push(1); + $dll->push(2); + $dll->push(3); - try { - $dll->offsetUnset(3); - } - catch (Exception $e) { - echo $e->getMessage() . "\n"; - } + try { + $dll->offsetUnset(3); + } + catch (Exception $e) { + echo $e->getMessage() . "\n"; + } ?> --EXPECT-- Offset out of range diff --git a/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt index 28901050d3..2580021426 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt @@ -4,10 +4,10 @@ SplFileObject::fgetcsv default path <?php $fp = fopen('SplFileObject__fgetcsv1.csv', 'w+'); fputcsv($fp, array( - 'field1', - 'field2', - 'field3', - 5 + 'field1', + 'field2', + 'field3', + 5 )); fclose($fp); diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt index 585e0b6e39..6bf5b43f6b 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt @@ -4,10 +4,10 @@ SplFileObject::fgetcsv with alternative delimiter <?php $fp = fopen('SplFileObject__fgetcsv2.csv', 'w+'); fputcsv($fp, array( - 'field1', - 'field2', - 'field3', - 5 + 'field1', + 'field2', + 'field3', + 5 ), '|'); fclose($fp); diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt index 169ded7dc3..2db10f989a 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt @@ -4,10 +4,10 @@ SplFileObject::fgetcsv with alternative delimiter <?php $fp = fopen('SplFileObject__fgetcsv3.csv', 'w+'); fputcsv($fp, array( - 'field1', - 'field2', - 'field3', - 5 + 'field1', + 'field2', + 'field3', + 5 ), '|'); fclose($fp); diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt index 32527a9238..971e44ba4d 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt @@ -4,10 +4,10 @@ SplFileObject::fgetcsv with alternative delimiter <?php $fp = fopen('SplFileObject__fgetcsv4.csv', 'w+'); fputcsv($fp, array( - 'field1', - 'field2', - 'field3', - 5 + 'field1', + 'field2', + 'field3', + 5 ), ',', '"'); fclose($fp); diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt index f8c14f0e35..6dd0a593c5 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt @@ -4,10 +4,10 @@ SplFileObject::fgetcsv with alternative delimiter <?php $fp = fopen('SplFileObject__fgetcsv5.csv', 'w+'); fputcsv($fp, array( - 'field1', - 'field2', - 'field3', - 5 + 'field1', + 'field2', + 'field3', + 5 ), ',', '"'); fclose($fp); diff --git a/ext/spl/tests/SplFileObject_fputcsv.phpt b/ext/spl/tests/SplFileObject_fputcsv.phpt index a007946a46..ec32ae686b 100644 --- a/ext/spl/tests/SplFileObject_fputcsv.phpt +++ b/ext/spl/tests/SplFileObject_fputcsv.phpt @@ -29,14 +29,14 @@ $list = array ( ); foreach ($list as $v) { - $fo->fputcsv(explode(',', $v)); + $fo->fputcsv(explode(',', $v)); } unset($fo); $res = file($file); foreach($res as &$val) { - $val = substr($val, 0, -1); + $val = substr($val, 0, -1); } echo '$list = ';var_export($res);echo ";\n"; @@ -44,7 +44,7 @@ $fp = fopen($file, "r"); $res = array(); while($l=fgetcsv($fp)) { - $res[] = join(',',$l); + $res[] = join(',',$l); } fclose($fp); diff --git a/ext/spl/tests/SplFileObject_ftruncate_error_001.phpt b/ext/spl/tests/SplFileObject_ftruncate_error_001.phpt index 831e855b85..4e0642c6ae 100644 --- a/ext/spl/tests/SplFileObject_ftruncate_error_001.phpt +++ b/ext/spl/tests/SplFileObject_ftruncate_error_001.phpt @@ -23,9 +23,9 @@ $ftruncate_test = ""; //open an SplFileObject using the above test stream $obj = New SplFileObject("SPLtest://ftruncate_test"); try { - $obj->ftruncate(1); + $obj->ftruncate(1); } catch (LogicException $e) { - echo($e->getMessage()); + echo($e->getMessage()); } ?> --EXPECTF-- diff --git a/ext/spl/tests/SplFileObject_fwrite_variation_001.phpt b/ext/spl/tests/SplFileObject_fwrite_variation_001.phpt index a8e36cd046..999adaa3c8 100644 --- a/ext/spl/tests/SplFileObject_fwrite_variation_001.phpt +++ b/ext/spl/tests/SplFileObject_fwrite_variation_001.phpt @@ -4,7 +4,7 @@ SplFileObject::fwrite function - writing with two parameters length < input stri <?php $file = __DIR__.'/SplFileObject_fwrite_variation_001.txt'; if(file_exists($file)) { - unlink($file); + unlink($file); } $obj = New SplFileObject($file,'w'); $obj->fwrite('test_write',4); diff --git a/ext/spl/tests/SplFileObject_fwrite_variation_002.phpt b/ext/spl/tests/SplFileObject_fwrite_variation_002.phpt index cea92a349c..6c061eed84 100644 --- a/ext/spl/tests/SplFileObject_fwrite_variation_002.phpt +++ b/ext/spl/tests/SplFileObject_fwrite_variation_002.phpt @@ -4,7 +4,7 @@ SplFileObject::fwrite function - writing with two parameters, length > input str <?php $file = __DIR__.'/SplFileObject_fwrite_variation_002.txt'; if(file_exists($file)) { - unlink($file); + unlink($file); } $obj = New SplFileObject($file,'w'); $obj->fwrite('test_write',12); diff --git a/ext/spl/tests/SplFileObject_seek_error_001.phpt b/ext/spl/tests/SplFileObject_seek_error_001.phpt index 8741e3b788..acebb66f41 100644 --- a/ext/spl/tests/SplFileObject_seek_error_001.phpt +++ b/ext/spl/tests/SplFileObject_seek_error_001.phpt @@ -4,9 +4,9 @@ SplFileObject::seek function - test parameters <?php $obj = new SplFileObject(__FILE__); try { - $obj->seek(-1); + $obj->seek(-1); } catch (LogicException $e) { - echo($e->getMessage()); + echo($e->getMessage()); } ?> --EXPECTF-- diff --git a/ext/spl/tests/SplFixedArray__construct_param_array.phpt b/ext/spl/tests/SplFixedArray__construct_param_array.phpt index 89983c377e..15e1c0c438 100644 --- a/ext/spl/tests/SplFixedArray__construct_param_array.phpt +++ b/ext/spl/tests/SplFixedArray__construct_param_array.phpt @@ -6,9 +6,9 @@ PHPNW Test Fest 2009 - Jordan Hatch <?php try { - $array = new SplFixedArray( array("string", 1) ); + $array = new SplFixedArray( array("string", 1) ); } catch (TypeError $iae) { - echo "Ok - ".$iae->getMessage().PHP_EOL; + echo "Ok - ".$iae->getMessage().PHP_EOL; } ?> diff --git a/ext/spl/tests/SplFixedArray__construct_param_string.phpt b/ext/spl/tests/SplFixedArray__construct_param_string.phpt index bfec39de32..654ac4b95f 100644 --- a/ext/spl/tests/SplFixedArray__construct_param_string.phpt +++ b/ext/spl/tests/SplFixedArray__construct_param_string.phpt @@ -5,9 +5,9 @@ PHPNW Test Fest 2009 - Jordan Hatch --FILE-- <?php try { - $array = new SplFixedArray( "string" ); + $array = new SplFixedArray( "string" ); } catch (TypeError $iae) { - echo "Ok - ".$iae->getMessage().PHP_EOL; + echo "Ok - ".$iae->getMessage().PHP_EOL; } diff --git a/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt b/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt index af9f5f3ee8..efb1d0e65d 100644 --- a/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt +++ b/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt @@ -5,9 +5,9 @@ Philip Norton philipnorton42@gmail.com --FILE-- <?php try { - $array = new SplFixedArray(new SplFixedArray(3)); + $array = new SplFixedArray(new SplFixedArray(3)); } catch (TypeError $iae) { - echo "Ok - ".$iae->getMessage().PHP_EOL; + echo "Ok - ".$iae->getMessage().PHP_EOL; } ?> diff --git a/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt b/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt index c649e3b6c3..8ec02b8d49 100644 --- a/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt +++ b/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt @@ -5,8 +5,8 @@ Philip Norton philipnorton42@gmail.com --FILE-- <?php $array = SplFixedArray::fromArray(array(1 => 1, - 2 => '2', - 3 => false)); + 2 => '2', + 3 => false)); var_dump($array); ?> --EXPECT-- diff --git a/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt b/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt index b3e7497397..af5f663f33 100644 --- a/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt +++ b/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt @@ -5,9 +5,9 @@ Philip Norton philipnorton42@gmail.com --FILE-- <?php $array = SplFixedArray::fromArray(array(1 => 1, - 2 => '2', - 3 => false), - false); + 2 => '2', + 3 => false), + false); var_dump($array); ?> --EXPECT-- diff --git a/ext/spl/tests/SplFixedArray_key_setsize.phpt b/ext/spl/tests/SplFixedArray_key_setsize.phpt index 091c4650e2..5c035e71c7 100644 --- a/ext/spl/tests/SplFixedArray_key_setsize.phpt +++ b/ext/spl/tests/SplFixedArray_key_setsize.phpt @@ -12,7 +12,7 @@ $array[1] = "world"; $array[2] = "elePHPant"; foreach ( $array as $value ) { - echo $array->key( ); + echo $array->key( ); } ?> diff --git a/ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt b/ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt index 9bfda34073..da6acd15ca 100644 --- a/ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt +++ b/ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt @@ -6,7 +6,7 @@ PHPNW TestFest 2009 - Ben Longden <?php $array = new SplFixedArray(5); if($array->offsetExists(-10) === false) { - echo 'PASS'; + echo 'PASS'; } ?> --EXPECT-- diff --git a/ext/spl/tests/SplFixedArray_offsetUnset_string.phpt b/ext/spl/tests/SplFixedArray_offsetUnset_string.phpt index 3b0e6bb222..1d7c50d39e 100644 --- a/ext/spl/tests/SplFixedArray_offsetUnset_string.phpt +++ b/ext/spl/tests/SplFixedArray_offsetUnset_string.phpt @@ -4,18 +4,18 @@ Check removing an item from an array when the offset is not an integer. PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com ) --FILE-- <?php - // Create a fixed array - $fixedArray = new SplFixedArray(5); + // Create a fixed array + $fixedArray = new SplFixedArray(5); - // Fill it up - for ($i=0; $i < 5; $i++) { - $fixedArray[$i] = "PHPNW Testfest"; - } + // Fill it up + for ($i=0; $i < 5; $i++) { + $fixedArray[$i] = "PHPNW Testfest"; + } - // remove an item - $fixedArray->offsetUnset("4"); + // remove an item + $fixedArray->offsetUnset("4"); - var_dump($fixedArray); + var_dump($fixedArray); ?> --EXPECT-- diff --git a/ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt b/ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt index fa2c7aabe9..54fcc23d4d 100644 --- a/ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt +++ b/ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt @@ -9,9 +9,9 @@ $s = new SplObjectStorage(); $o1 = new stdClass(); try { - $s->offsetGet($o1); + $s->offsetGet($o1); } catch (UnexpectedValueException $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/spl/tests/SplObjectStorage_unserialize_bad.phpt b/ext/spl/tests/SplObjectStorage_unserialize_bad.phpt index a5678eab40..a0f3e8c93d 100644 --- a/ext/spl/tests/SplObjectStorage_unserialize_bad.phpt +++ b/ext/spl/tests/SplObjectStorage_unserialize_bad.phpt @@ -15,7 +15,7 @@ try { $so->unserialize($blob); var_dump($so); } catch(UnexpectedValueException $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } } echo "DONE\n"; diff --git a/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt index 8ea0b6656e..0ff158c85c 100644 --- a/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt +++ b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt @@ -15,7 +15,7 @@ $data_provider = array( foreach($data_provider as $input) { - $s = new SplObjectStorage(); + $s = new SplObjectStorage(); try { $s->unserialize($input); diff --git a/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt b/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt index c3071f2399..255f0cd2e4 100644 --- a/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt +++ b/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt @@ -7,11 +7,11 @@ PHPNW Test Fest 2009 - Jeremy Coates jeremy@phpnw.org.uk try { - $dll = new SplQueue(); - $dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO); + $dll = new SplQueue(); + $dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO); } catch (Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/spl/tests/arrayObject___construct_basic2.phpt b/ext/spl/tests/arrayObject___construct_basic2.phpt index ddbf074bf3..2e5970004e 100644 --- a/ext/spl/tests/arrayObject___construct_basic2.phpt +++ b/ext/spl/tests/arrayObject___construct_basic2.phpt @@ -3,11 +3,11 @@ SPL: ArrayObject::__construct basic usage. --FILE-- <?php class C { - public $prop = 'C::prop.orig'; + public $prop = 'C::prop.orig'; } class MyArrayObject extends ArrayObject { - public $prop = 'MyArrayObject::prop.orig'; + public $prop = 'MyArrayObject::prop.orig'; } echo "--> Access prop on instance of ArrayObject:\n"; @@ -21,29 +21,29 @@ $ao = new MyArrayObject($c); testAccess($c, $ao); function testAccess($c, $ao) { - echo " - Iteration:\n"; - foreach ($ao as $key=>$value) { - echo " $key=>$value\n"; - } + echo " - Iteration:\n"; + foreach ($ao as $key=>$value) { + echo " $key=>$value\n"; + } - echo " - Read:\n"; - @var_dump($ao->prop, $ao['prop']); + echo " - Read:\n"; + @var_dump($ao->prop, $ao['prop']); - echo " - Write:\n"; - $ao->prop = 'changed1'; - $ao['prop'] = 'changed2'; - var_dump($ao->prop, $ao['prop']); + echo " - Write:\n"; + $ao->prop = 'changed1'; + $ao['prop'] = 'changed2'; + var_dump($ao->prop, $ao['prop']); - echo " - Isset:\n"; - var_dump(isset($ao->prop), isset($ao['prop'])); + echo " - Isset:\n"; + var_dump(isset($ao->prop), isset($ao['prop'])); - echo " - Unset:\n"; - unset($ao->prop); - unset($ao['prop']); - var_dump($ao->prop, $ao['prop']); + echo " - Unset:\n"; + unset($ao->prop); + unset($ao['prop']); + var_dump($ao->prop, $ao['prop']); - echo " - After:\n"; - var_dump($ao, $c); + echo " - After:\n"; + var_dump($ao, $c); } ?> --EXPECTF-- diff --git a/ext/spl/tests/arrayObject___construct_basic3.phpt b/ext/spl/tests/arrayObject___construct_basic3.phpt index f162317773..2628c991a7 100644 --- a/ext/spl/tests/arrayObject___construct_basic3.phpt +++ b/ext/spl/tests/arrayObject___construct_basic3.phpt @@ -3,11 +3,11 @@ SPL: ArrayObject::__construct basic usage with ArrayObject::STD_PROP_LIST. --FILE-- <?php class C { - public $prop = 'C::prop.orig'; + public $prop = 'C::prop.orig'; } class MyArrayObject extends ArrayObject { - public $prop = 'MyArrayObject::prop.orig'; + public $prop = 'MyArrayObject::prop.orig'; } echo "\n--> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST:\n"; @@ -21,29 +21,29 @@ $ao = new MyArrayObject($c, ArrayObject::STD_PROP_LIST); testAccess($c, $ao); function testAccess($c, $ao) { - echo " - Iteration:\n"; - foreach ($ao as $key=>$value) { - echo " $key=>$value\n"; - } + echo " - Iteration:\n"; + foreach ($ao as $key=>$value) { + echo " $key=>$value\n"; + } - echo " - Read:\n"; - @var_dump($ao->prop, $ao['prop']); + echo " - Read:\n"; + @var_dump($ao->prop, $ao['prop']); - echo " - Write:\n"; - $ao->prop = 'changed1'; - $ao['prop'] = 'changed2'; - var_dump($ao->prop, $ao['prop']); + echo " - Write:\n"; + $ao->prop = 'changed1'; + $ao['prop'] = 'changed2'; + var_dump($ao->prop, $ao['prop']); - echo " - Isset:\n"; - var_dump(isset($ao->prop), isset($ao['prop'])); + echo " - Isset:\n"; + var_dump(isset($ao->prop), isset($ao['prop'])); - echo " - Unset:\n"; - unset($ao->prop); - unset($ao['prop']); - var_dump($ao->prop, $ao['prop']); + echo " - Unset:\n"; + unset($ao->prop); + unset($ao['prop']); + var_dump($ao->prop, $ao['prop']); - echo " - After:\n"; - var_dump($ao, $c); + echo " - After:\n"; + var_dump($ao, $c); } ?> --EXPECTF-- diff --git a/ext/spl/tests/arrayObject___construct_basic4.phpt b/ext/spl/tests/arrayObject___construct_basic4.phpt index c136c949e2..ba0ab08ff6 100644 --- a/ext/spl/tests/arrayObject___construct_basic4.phpt +++ b/ext/spl/tests/arrayObject___construct_basic4.phpt @@ -3,11 +3,11 @@ SPL: ArrayObject::__construct basic usage with ArrayObject::ARRAY_AS_PROPS. Curr --FILE-- <?php class C { - public $prop = 'C::prop.orig'; + public $prop = 'C::prop.orig'; } class MyArrayObject extends ArrayObject { - public $prop = 'MyArrayObject::prop.orig'; + public $prop = 'MyArrayObject::prop.orig'; } echo "\n--> Access prop on instance of ArrayObject with ArrayObject::ARRAY_AS_PROPS:\n"; @@ -21,29 +21,29 @@ $ao = new MyArrayObject($c, ArrayObject::ARRAY_AS_PROPS); testAccess($c, $ao); function testAccess($c, $ao) { - echo " - Iteration:\n"; - foreach ($ao as $key=>$value) { - echo " $key=>$value\n"; - } + echo " - Iteration:\n"; + foreach ($ao as $key=>$value) { + echo " $key=>$value\n"; + } - echo " - Read:\n"; - @var_dump($ao->prop, $ao['prop']); + echo " - Read:\n"; + @var_dump($ao->prop, $ao['prop']); - echo " - Write:\n"; - $ao->prop = 'changed1'; - $ao['prop'] = 'changed2'; - var_dump($ao->prop, $ao['prop']); + echo " - Write:\n"; + $ao->prop = 'changed1'; + $ao['prop'] = 'changed2'; + var_dump($ao->prop, $ao['prop']); - echo " - Isset:\n"; - var_dump(isset($ao->prop), isset($ao['prop'])); + echo " - Isset:\n"; + var_dump(isset($ao->prop), isset($ao['prop'])); - echo " - Unset:\n"; - unset($ao->prop); - unset($ao['prop']); - var_dump($ao->prop, $ao['prop']); + echo " - Unset:\n"; + unset($ao->prop); + unset($ao['prop']); + var_dump($ao->prop, $ao['prop']); - echo " - After:\n"; - var_dump($ao, $c); + echo " - After:\n"; + var_dump($ao, $c); } ?> --EXPECTF-- diff --git a/ext/spl/tests/arrayObject___construct_basic5.phpt b/ext/spl/tests/arrayObject___construct_basic5.phpt index 0eb8904bac..93fcf256ee 100644 --- a/ext/spl/tests/arrayObject___construct_basic5.phpt +++ b/ext/spl/tests/arrayObject___construct_basic5.phpt @@ -3,11 +3,11 @@ SPL: ArrayObject::__construct basic usage with ArrayObject::STD_PROP_LIST|ArrayO --FILE-- <?php class C { - public $prop = 'C::prop.orig'; + public $prop = 'C::prop.orig'; } class MyArrayObject extends ArrayObject { - public $prop = 'MyArrayObject::prop.orig'; + public $prop = 'MyArrayObject::prop.orig'; } echo "\n--> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:\n"; @@ -21,29 +21,29 @@ $ao = new MyArrayObject($c, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PRO testAccess($c, $ao); function testAccess($c, $ao) { - echo " - Iteration:\n"; - foreach ($ao as $key=>$value) { - echo " $key=>$value\n"; - } + echo " - Iteration:\n"; + foreach ($ao as $key=>$value) { + echo " $key=>$value\n"; + } - echo " - Read:\n"; - @var_dump($ao->prop, $ao['prop']); + echo " - Read:\n"; + @var_dump($ao->prop, $ao['prop']); - echo " - Write:\n"; - $ao->prop = 'changed1'; - $ao['prop'] = 'changed2'; - var_dump($ao->prop, $ao['prop']); + echo " - Write:\n"; + $ao->prop = 'changed1'; + $ao['prop'] = 'changed2'; + var_dump($ao->prop, $ao['prop']); - echo " - Isset:\n"; - var_dump(isset($ao->prop), isset($ao['prop'])); + echo " - Isset:\n"; + var_dump(isset($ao->prop), isset($ao['prop'])); - echo " - Unset:\n"; - unset($ao->prop); - unset($ao['prop']); - var_dump($ao->prop, $ao['prop']); + echo " - Unset:\n"; + unset($ao->prop); + unset($ao['prop']); + var_dump($ao->prop, $ao['prop']); - echo " - After:\n"; - var_dump($ao, $c); + echo " - After:\n"; + var_dump($ao, $c); } ?> --EXPECTF-- diff --git a/ext/spl/tests/arrayObject___construct_basic6.phpt b/ext/spl/tests/arrayObject___construct_basic6.phpt index befa6eab3c..681e6e0d31 100644 --- a/ext/spl/tests/arrayObject___construct_basic6.phpt +++ b/ext/spl/tests/arrayObject___construct_basic6.phpt @@ -3,8 +3,8 @@ SPL: ArrayObject::__construct: check impact of ArrayObject::STD_PROP_LIST on var --FILE-- <?php class MyArrayObject extends ArrayObject { - private $priv1 = 'secret1'; - public $pub1 = 'public1'; + private $priv1 = 'secret1'; + public $pub1 = 'public1'; } $ao = new ArrayObject(array(1,2,3)); diff --git a/ext/spl/tests/arrayObject___construct_error2.phpt b/ext/spl/tests/arrayObject___construct_error2.phpt index ec01f57e34..742512e02c 100644 --- a/ext/spl/tests/arrayObject___construct_error2.phpt +++ b/ext/spl/tests/arrayObject___construct_error2.phpt @@ -4,11 +4,11 @@ SPL: ArrayObject::__construct with too many arguments. <?php echo "Too many arguments:\n"; Class C implements Iterator { - function current() {} - function next() {} - function key() {} - function valid() {} - function rewind() {} + function current() {} + function next() {} + function key() {} + function valid() {} + function rewind() {} } try { diff --git a/ext/spl/tests/arrayObject_asort_basic2.phpt b/ext/spl/tests/arrayObject_asort_basic2.phpt index 34afc83a5e..80248cbeb3 100644 --- a/ext/spl/tests/arrayObject_asort_basic2.phpt +++ b/ext/spl/tests/arrayObject_asort_basic2.phpt @@ -11,10 +11,10 @@ SPL: Test ArrayObject::asort() function : basic functionality with object based echo "*** Testing ArrayObject::asort() : basic functionality ***\n"; Class C { - public $prop1 = 'x'; - public $prop2 = 'z'; - private $prop3 = 'a'; - public $prop4 = 'x'; + public $prop1 = 'x'; + public $prop2 = 'z'; + private $prop3 = 'a'; + public $prop4 = 'x'; } $c = new C; diff --git a/ext/spl/tests/arrayObject_clone_basic3.phpt b/ext/spl/tests/arrayObject_clone_basic3.phpt index 27f2098740..f348043c0b 100644 --- a/ext/spl/tests/arrayObject_clone_basic3.phpt +++ b/ext/spl/tests/arrayObject_clone_basic3.phpt @@ -3,7 +3,7 @@ SPL: Cloning nested ArrayObjects. --FILE-- <?php class C { - public $p = 'C::p.orig'; + public $p = 'C::p.orig'; } $wrappedObject = new C; diff --git a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt index 68f20f7bb6..1dc93ceaa9 100644 --- a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt +++ b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt @@ -4,7 +4,7 @@ SPL: ArrayObject::exchangeArray() basic usage with object as underlying data sto <?php class C { - public $pub1 = 'public1'; + public $pub1 = 'public1'; } echo "--> exchangeArray() with objects:\n"; @@ -12,10 +12,10 @@ $original = new C; $ao = new ArrayObject($original); $swapIn = new C; try { - $copy = $ao->exchangeArray($swapIn); - $copy['addedToCopy'] = 'added To Copy'; + $copy = $ao->exchangeArray($swapIn); + $copy['addedToCopy'] = 'added To Copy'; } catch (Exception $e) { - echo "Exception:" . $e->getMessage() . "\n"; + echo "Exception:" . $e->getMessage() . "\n"; } $swapIn->addedToSwapIn = 'added To Swap-In'; $original->addedToOriginal = 'added To Original'; @@ -27,10 +27,10 @@ unset($original, $ao, $swapIn, $copy); $original = new C; $ao = new ArrayObject($original); try { - $copy = $ao->exchangeArray(); - $copy['addedToCopy'] = 'added To Copy'; + $copy = $ao->exchangeArray(); + $copy['addedToCopy'] = 'added To Copy'; } catch (TypeError $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } $original->addedToOriginal = 'added To Original'; var_dump($ao, $original, $copy); @@ -40,10 +40,10 @@ unset($original, $ao, $swapIn, $copy); $original = new C; $ao = new ArrayObject($original); try { - $copy = $ao->exchangeArray(null); - $copy['addedToCopy'] = 'added To Copy'; + $copy = $ao->exchangeArray(null); + $copy['addedToCopy'] = 'added To Copy'; } catch (Exception $e) { - echo "Exception:" . $e->getMessage() . "\n"; + echo "Exception:" . $e->getMessage() . "\n"; } $original->addedToOriginal = 'added To Original'; var_dump($ao, $original, $copy); diff --git a/ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt b/ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt index e6e950c628..58419c06bd 100644 --- a/ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt +++ b/ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt @@ -4,40 +4,40 @@ SPL: ArrayObject::getIteratorClass and ArrayObject::setIteratorClass basic funct <?php class MyIterator extends ArrayIterator { - function __construct() { - $args = func_get_args(); - echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; - } + function __construct() { + $args = func_get_args(); + echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; + } - function rewind() { - $args = func_get_args(); - echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; - return parent::rewind(); - } + function rewind() { + $args = func_get_args(); + echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; + return parent::rewind(); + } - function valid() { - $args = func_get_args(); - echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; - return parent::valid(); - } + function valid() { + $args = func_get_args(); + echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; + return parent::valid(); + } - function current() { - $args = func_get_args(); - echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; - return parent::current(); - } + function current() { + $args = func_get_args(); + echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; + return parent::current(); + } - function next() { - $args = func_get_args(); - echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; - return parent::next(); - } + function next() { + $args = func_get_args(); + echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; + return parent::next(); + } - function key() { - $args = func_get_args(); - echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; - return parent::key(); - } + function key() { + $args = func_get_args(); + echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; + return parent::key(); + } } $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3), 0, "MyIterator"); @@ -46,7 +46,7 @@ echo "--> Access using MyIterator:\n"; var_dump($ao->getIteratorClass()); var_dump($ao->getIterator()); foreach($ao as $key=>$value) { - echo " $key=>$value\n"; + echo " $key=>$value\n"; } echo "\n\n--> Access using ArrayIterator:\n"; @@ -54,7 +54,7 @@ var_dump($ao->setIteratorClass("ArrayIterator")); var_dump($ao->getIteratorClass()); var_dump($ao->getIterator()); foreach($ao as $key=>$value) { - echo "$key=>$value\n"; + echo "$key=>$value\n"; } ?> diff --git a/ext/spl/tests/arrayObject_ksort_basic2.phpt b/ext/spl/tests/arrayObject_ksort_basic2.phpt index fa0485aff8..6ef06b331b 100644 --- a/ext/spl/tests/arrayObject_ksort_basic2.phpt +++ b/ext/spl/tests/arrayObject_ksort_basic2.phpt @@ -11,10 +11,10 @@ SPL: Test ArrayObject::ksort() function : basic functionality with object base s echo "*** Testing ArrayObject::ksort() : basic functionality ***\n"; Class C { - public $x = 'prop1'; - public $z = 'prop2'; - public $a = 'prop3'; - private $b = 'prop4'; + public $x = 'prop1'; + public $z = 'prop2'; + public $a = 'prop3'; + private $b = 'prop4'; } $c = new C; diff --git a/ext/spl/tests/arrayObject_magicMethods1.phpt b/ext/spl/tests/arrayObject_magicMethods1.phpt index 351f68214a..dbe75bff24 100644 --- a/ext/spl/tests/arrayObject_magicMethods1.phpt +++ b/ext/spl/tests/arrayObject_magicMethods1.phpt @@ -3,28 +3,28 @@ SPL: ArrayObject: ensure a wrapped object's magic methods for property access ar --FILE-- <?php class UsesMagic { - public $a = 1; - public $b = 2; - public $c = 3; + public $a = 1; + public $b = 2; + public $c = 3; - private $priv = 'secret'; + private $priv = 'secret'; - function __get($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __set($name, $value) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __isset($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __unset($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } + function __get($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __set($name, $value) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __isset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __unset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } } diff --git a/ext/spl/tests/arrayObject_magicMethods2.phpt b/ext/spl/tests/arrayObject_magicMethods2.phpt index 3f88654a5d..13b91e6e86 100644 --- a/ext/spl/tests/arrayObject_magicMethods2.phpt +++ b/ext/spl/tests/arrayObject_magicMethods2.phpt @@ -3,28 +3,28 @@ SPL: ArrayObject: ensure a wrapped object's magic methods for property access ar --FILE-- <?php class UsesMagic { - public $a = 1; - public $b = 2; - public $c = 3; + public $a = 1; + public $b = 2; + public $c = 3; - private $priv = 'secret'; + private $priv = 'secret'; - function __get($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __set($name, $value) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __isset($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __unset($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } + function __get($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __set($name, $value) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __isset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __unset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } } diff --git a/ext/spl/tests/arrayObject_magicMethods3.phpt b/ext/spl/tests/arrayObject_magicMethods3.phpt index 6771c46800..f8b2c2e41c 100644 --- a/ext/spl/tests/arrayObject_magicMethods3.phpt +++ b/ext/spl/tests/arrayObject_magicMethods3.phpt @@ -3,28 +3,28 @@ SPL: ArrayObject: ensure a wrapped object's magic methods for property access ar --FILE-- <?php class UsesMagic { - public $a = 1; - public $b = 2; - public $c = 3; + public $a = 1; + public $b = 2; + public $c = 3; - private $priv = 'secret'; + private $priv = 'secret'; - function __get($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __set($name, $value) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __isset($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __unset($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } + function __get($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __set($name, $value) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __isset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __unset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } } diff --git a/ext/spl/tests/arrayObject_magicMethods4.phpt b/ext/spl/tests/arrayObject_magicMethods4.phpt index d6a6292fc0..e038a1e09c 100644 --- a/ext/spl/tests/arrayObject_magicMethods4.phpt +++ b/ext/spl/tests/arrayObject_magicMethods4.phpt @@ -3,33 +3,33 @@ SPL: ArrayObject: ensure the magic methods for property access of a subclass of --FILE-- <?php class C { - public $a = 1; - public $b = 2; - public $c = 3; + public $a = 1; + public $b = 2; + public $c = 3; - private $priv = 'secret'; + private $priv = 'secret'; } class UsesMagic extends ArrayObject { - public $b = "This should not be in the storage"; + public $b = "This should not be in the storage"; - function __get($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __set($name, $value) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __isset($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __unset($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } + function __get($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __set($name, $value) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __isset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __unset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } } $obj = new C; diff --git a/ext/spl/tests/arrayObject_magicMethods5.phpt b/ext/spl/tests/arrayObject_magicMethods5.phpt index 6d2ced3a71..c0393ffea4 100644 --- a/ext/spl/tests/arrayObject_magicMethods5.phpt +++ b/ext/spl/tests/arrayObject_magicMethods5.phpt @@ -3,33 +3,33 @@ SPL: ArrayObject: ensure the magic methods for property access of a subclass of --FILE-- <?php class C { - public $a = 1; - public $b = 2; - public $c = 3; + public $a = 1; + public $b = 2; + public $c = 3; - private $priv = 'secret'; + private $priv = 'secret'; } class UsesMagic extends ArrayObject { - public $b = "This should appear in storage"; + public $b = "This should appear in storage"; - function __get($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; - } - function __set($name, $value) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; - } - function __isset($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; - } - function __unset($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; - } + function __get($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; + } + function __set($name, $value) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; + } + function __isset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; + } + function __unset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n"; + } } $obj = new C; diff --git a/ext/spl/tests/arrayObject_magicMethods6.phpt b/ext/spl/tests/arrayObject_magicMethods6.phpt index 243e0f53a8..e0ccb43dd4 100644 --- a/ext/spl/tests/arrayObject_magicMethods6.phpt +++ b/ext/spl/tests/arrayObject_magicMethods6.phpt @@ -3,33 +3,33 @@ SPL: ArrayObject: ensure the magic methods for property access of a subclass of --FILE-- <?php class C { - public $a = 1; - public $b = 2; - public $c = 3; + public $a = 1; + public $b = 2; + public $c = 3; - private $priv = 'secret'; + private $priv = 'secret'; } class UsesMagic extends ArrayObject { - public $b = "This should never appear in storage"; + public $b = "This should never appear in storage"; - function __get($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __set($name, $value) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __isset($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } - function __unset($name) { - $args = func_get_args(); - echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; - } + function __get($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __set($name, $value) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __isset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __unset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } } $obj = new C; diff --git a/ext/spl/tests/arrayObject_setFlags_basic1.phpt b/ext/spl/tests/arrayObject_setFlags_basic1.phpt index b8bf099dd6..173836cebc 100644 --- a/ext/spl/tests/arrayObject_setFlags_basic1.phpt +++ b/ext/spl/tests/arrayObject_setFlags_basic1.phpt @@ -3,7 +3,7 @@ SPL: ArrayObject::setFlags basic usage with ArrayObject::ARRAY_AS_PROPS. Current --FILE-- <?php class C extends ArrayObject { - public $p = 'object property'; + public $p = 'object property'; } function access_p($ao) { diff --git a/ext/spl/tests/arrayObject_setFlags_basic2.phpt b/ext/spl/tests/arrayObject_setFlags_basic2.phpt index fe9111c90b..452ce799bb 100644 --- a/ext/spl/tests/arrayObject_setFlags_basic2.phpt +++ b/ext/spl/tests/arrayObject_setFlags_basic2.phpt @@ -3,11 +3,11 @@ SPL: Ensure access to non-visible properties falls back to dimension access with --FILE-- <?php class C extends ArrayObject { - private $x = 'secret'; + private $x = 'secret'; - static function go($c) { - var_dump($c->x); - } + static function go($c) { + var_dump($c->x); + } } $c = new C(array('x'=>'public')); diff --git a/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt b/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt index d0910b3a0a..591f84c3d4 100644 --- a/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt +++ b/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt @@ -9,7 +9,7 @@ try { echo " $key=>$value\n"; } } catch (TypeError $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } try { @@ -19,7 +19,7 @@ try { echo " $key=>$value\n"; } } catch (TypeError $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } @@ -29,7 +29,7 @@ try { echo " $key=>$value\n"; } } catch (TypeError $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } try { @@ -38,7 +38,7 @@ try { echo " $key=>$value\n"; } } catch (TypeError $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> diff --git a/ext/spl/tests/arrayObject_uasort_error1.phpt b/ext/spl/tests/arrayObject_uasort_error1.phpt index 55c5e200e6..5dc63373ef 100644 --- a/ext/spl/tests/arrayObject_uasort_error1.phpt +++ b/ext/spl/tests/arrayObject_uasort_error1.phpt @@ -12,15 +12,15 @@ Test ArrayObject::uasort() function : wrong arg count $ao = new ArrayObject(); try { - $ao->uasort(); + $ao->uasort(); } catch (BadMethodCallException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - $ao->uasort(1,2); + $ao->uasort(1,2); } catch (BadMethodCallException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/arrayObject_uksort_error1.phpt b/ext/spl/tests/arrayObject_uksort_error1.phpt index 3332839b8b..e2bbf9968c 100644 --- a/ext/spl/tests/arrayObject_uksort_error1.phpt +++ b/ext/spl/tests/arrayObject_uksort_error1.phpt @@ -12,15 +12,15 @@ Test ArrayObject::uksort() function : wrong arg count $ao = new ArrayObject(); try { - $ao->uksort(); + $ao->uksort(); } catch (BadMethodCallException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - $ao->uksort(1,2); + $ao->uksort(1,2); } catch (BadMethodCallException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/array_003.phpt b/ext/spl/tests/array_003.phpt index f77b7862d1..e4c0a1f9f8 100644 --- a/ext/spl/tests/array_003.phpt +++ b/ext/spl/tests/array_003.phpt @@ -9,14 +9,14 @@ SPL: ArrayObject from object class test { - public $pub = "public"; - protected $pro = "protected"; - private $pri = "private"; - - function __construct() - { - $this->imp = "implicit"; - } + public $pub = "public"; + protected $pro = "protected"; + private $pri = "private"; + + function __construct() + { + $this->imp = "implicit"; + } }; $test = new test; @@ -30,7 +30,7 @@ print_r($object); foreach($test as $key => $val) { - echo "$key => $val\n"; + echo "$key => $val\n"; } ?> diff --git a/ext/spl/tests/array_004.phpt b/ext/spl/tests/array_004.phpt index c976bdd87b..e962477a9e 100644 --- a/ext/spl/tests/array_004.phpt +++ b/ext/spl/tests/array_004.phpt @@ -7,12 +7,12 @@ $arr = array(0=>0, 1=>1, 2=>2); $obj = new ArrayObject($arr); foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==0 && $bk==0) { - $arr[0] = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } + foreach($obj as $bk=>$bv) { + if ($ak==0 && $bk==0) { + $arr[0] = "modify"; + } + echo "$ak=>$av - $bk=>$bv\n"; + } } echo "Done\n"; diff --git a/ext/spl/tests/array_005.phpt b/ext/spl/tests/array_005.phpt index 00cc313f2a..cae8f422a7 100644 --- a/ext/spl/tests/array_005.phpt +++ b/ext/spl/tests/array_005.phpt @@ -5,73 +5,73 @@ SPL: ArrayObject/Iterator interaction class Student { - private $id; - private $name; + private $id; + private $name; public function __construct($id, $name) { - $this->id = $id; - $this->name = $name; + $this->id = $id; + $this->name = $name; } - public function __toString() - { - return $this->id . ', ' . $this->name; - } + public function __toString() + { + return $this->id . ', ' . $this->name; + } - public function getId() - { - return $this->id; - } + public function getId() + { + return $this->id; + } } class StudentIdFilter extends FilterIterator { - private $id; + private $id; - public function __construct(ArrayObject $students, Student $other) - { - FilterIterator::__construct($students->getIterator()); - $this->id = $other->getId(); - } + public function __construct(ArrayObject $students, Student $other) + { + FilterIterator::__construct($students->getIterator()); + $this->id = $other->getId(); + } - public function accept() - { - echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n"; - return $this->current()->getId() == $this->id; - } + public function accept() + { + echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n"; + return $this->current()->getId() == $this->id; + } } class StudentList implements IteratorAggregate { - private $students; + private $students; - public function __construct() - { - $this->students = new ArrayObject(array()); - } + public function __construct() + { + $this->students = new ArrayObject(array()); + } - public function add(Student $student) - { - if (!$this->contains($student)) { - $this->students[] = $student; - } - } + public function add(Student $student) + { + if (!$this->contains($student)) { + $this->students[] = $student; + } + } - public function contains(Student $student) - { - foreach ($this->students as $s) - { - if ($s->getId() == $student->getId()) { - return true; - } - } - return false; - } + public function contains(Student $student) + { + foreach ($this->students as $s) + { + if ($s->getId() == $student->getId()) { + return true; + } + } + return false; + } - public function getIterator() { - return $this->students->getIterator(); - } + public function getIterator() { + return $this->students->getIterator(); + } } $students = new StudentList(); @@ -80,7 +80,7 @@ $students->add(new Student('00000014', 'Bob')); $students->add(new Student('00000014', 'Foo')); foreach ($students as $student) { - echo $student, "\n"; + echo $student, "\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/array_006.phpt b/ext/spl/tests/array_006.phpt index 1a21cec1aa..e46ca25cc3 100644 --- a/ext/spl/tests/array_006.phpt +++ b/ext/spl/tests/array_006.phpt @@ -11,12 +11,12 @@ $arr = array(0=>0, 1=>1, 2=>2); $obj = new ArrayIterator($arr); foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==0 && $bk==0) { - $arr[0] = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } + foreach($obj as $bk=>$bv) { + if ($ak==0 && $bk==0) { + $arr[0] = "modify"; + } + echo "$ak=>$av - $bk=>$bv\n"; + } } ?> diff --git a/ext/spl/tests/array_007.phpt b/ext/spl/tests/array_007.phpt index e32f138940..13d841792c 100644 --- a/ext/spl/tests/array_007.phpt +++ b/ext/spl/tests/array_007.phpt @@ -9,20 +9,20 @@ SPL: ArrayObject/Iterator from IteratorAggregate class test implements IteratorAggregate { - public $pub = "public"; - protected $pro = "protected"; - private $pri = "private"; + public $pub = "public"; + protected $pro = "protected"; + private $pri = "private"; - function __construct() - { - $this->imp = "implicit"; - } + function __construct() + { + $this->imp = "implicit"; + } - function getIterator() - { - $it = new ArrayObject($this); - return $it->getIterator(); - } + function getIterator() + { + $it = new ArrayObject($this); + return $it->getIterator(); + } }; $test = new test; @@ -34,7 +34,7 @@ print_r($test->getIterator()); foreach($test as $key => $val) { - echo "$key => $val\n"; + echo "$key => $val\n"; } ?> diff --git a/ext/spl/tests/array_008.phpt b/ext/spl/tests/array_008.phpt index 1165647d7b..6b4f42262d 100644 --- a/ext/spl/tests/array_008.phpt +++ b/ext/spl/tests/array_008.phpt @@ -7,12 +7,12 @@ $arr = array(0=>0, 1=>1, 2=>2); $obj = new ArrayObject($arr); foreach($obj as $ak=>&$av) { - foreach($obj as $bk=>&$bv) { - if ($ak==0 && $bk==0) { - $bv = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } + foreach($obj as $bk=>&$bv) { + if ($ak==0 && $bk==0) { + $bv = "modify"; + } + echo "$ak=>$av - $bk=>$bv\n"; + } } ?> diff --git a/ext/spl/tests/array_009.phpt b/ext/spl/tests/array_009.phpt index 91875639e2..05c53e9b44 100644 --- a/ext/spl/tests/array_009.phpt +++ b/ext/spl/tests/array_009.phpt @@ -8,7 +8,7 @@ $array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3); $dir = new RecursiveIteratorIterator(new RecursiveArrayIterator($array), RecursiveIteratorIterator::LEAVES_ONLY); foreach ($dir as $file) { - print "$file\n"; + print "$file\n"; } ?> diff --git a/ext/spl/tests/array_009a.phpt b/ext/spl/tests/array_009a.phpt index a642f29156..451c22b565 100644 --- a/ext/spl/tests/array_009a.phpt +++ b/ext/spl/tests/array_009a.phpt @@ -5,15 +5,15 @@ SPL: ArrayIterator implementing RecursiveIterator class MyRecursiveArrayIterator extends ArrayIterator implements RecursiveIterator { - function hasChildren() - { - return is_array($this->current()); - } + function hasChildren() + { + return is_array($this->current()); + } - function getChildren() - { - return new MyRecursiveArrayIterator($this->current()); - } + function getChildren() + { + return new MyRecursiveArrayIterator($this->current()); + } } $array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3); @@ -21,7 +21,7 @@ $array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3); $dir = new RecursiveIteratorIterator(new MyRecursiveArrayIterator($array), RecursiveIteratorIterator::LEAVES_ONLY); foreach ($dir as $file) { - print "$file\n"; + print "$file\n"; } ?> diff --git a/ext/spl/tests/array_011.phpt b/ext/spl/tests/array_011.phpt index 0ba0bd8769..647e1ed3ba 100644 --- a/ext/spl/tests/array_011.phpt +++ b/ext/spl/tests/array_011.phpt @@ -7,7 +7,7 @@ $a = array('zero' => 0, 'one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, 'five //foreach (new ArrayIterator($a) as $k => $v) foreach (new LimitIterator(new ArrayIterator($a), 1, 3) as $k => $v) { - var_dump(array($k, $v)); + var_dump(array($k, $v)); } ?> diff --git a/ext/spl/tests/array_012.phpt b/ext/spl/tests/array_012.phpt index 3b2eb1f3f2..5d5993d936 100644 --- a/ext/spl/tests/array_012.phpt +++ b/ext/spl/tests/array_012.phpt @@ -11,8 +11,8 @@ $it = new ArrayIterator($a); var_dump($it->count()); foreach($it as $key => $val) { - echo "$key=>$val\n"; - var_dump($it->count()); + echo "$key=>$val\n"; + var_dump($it->count()); } var_dump($it->count()); @@ -20,11 +20,11 @@ echo "===Object===\n"; class test { - public $zero = 0; - protected $pro; - public $one = 1; - private $pri; - public $two = 2; + public $zero = 0; + protected $pro; + public $one = 1; + private $pri; + public $two = 2; } $o = new test; @@ -33,8 +33,8 @@ $it = new ArrayIterator($o); var_dump($it->count()); foreach($it as $key => $val) { - echo "$key=>$val\n"; - var_dump($it->count()); + echo "$key=>$val\n"; + var_dump($it->count()); } var_dump($it->count()); diff --git a/ext/spl/tests/array_013.phpt b/ext/spl/tests/array_013.phpt index 54a798d80d..9ad11c8f38 100644 --- a/ext/spl/tests/array_013.phpt +++ b/ext/spl/tests/array_013.phpt @@ -5,7 +5,7 @@ SPL: ArrayIterator::append if (!class_exists('NoRewindIterator', false)) { - require_once(__DIR__ . '/../examples/norewinditerator.inc'); + require_once(__DIR__ . '/../examples/norewinditerator.inc'); } echo "===Array===\n"; @@ -15,7 +15,7 @@ $it = new ArrayIterator($a); foreach($it as $key => $val) { - echo "$key=>$val\n"; + echo "$key=>$val\n"; } echo "===Append===\n"; @@ -25,18 +25,18 @@ $it->append('four'); foreach(new NoRewindIterator($it) as $key => $val) { - echo "$key=>$val\n"; + echo "$key=>$val\n"; } echo "===Object===\n"; class test { - public $zero = 0; - protected $pro; - public $one = 1; - private $pri; - public $two = 2; + public $zero = 0; + protected $pro; + public $one = 1; + private $pri; + public $two = 2; } $o = new test; @@ -44,7 +44,7 @@ $it = new ArrayIterator($o); foreach($it as $key => $val) { - echo "$key=>$val\n"; + echo "$key=>$val\n"; } echo "===Append===\n"; @@ -54,7 +54,7 @@ $it->append('four'); foreach(new NoRewindIterator($it) as $key => $val) { - echo "$key=>$val\n"; + echo "$key=>$val\n"; } var_dump($o->{0}); /* doesn't wotk anyway */ diff --git a/ext/spl/tests/array_014.phpt b/ext/spl/tests/array_014.phpt index 4793de34d6..37ed9abad5 100644 --- a/ext/spl/tests/array_014.phpt +++ b/ext/spl/tests/array_014.phpt @@ -11,29 +11,29 @@ $it->seek(4); var_dump($it->current()); try { - $it->seek(-1); - var_dump($it->current()); + $it->seek(-1); + var_dump($it->current()); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - $it->seek(12); - var_dump($it->current()); + $it->seek(12); + var_dump($it->current()); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } $pos = 0; foreach($it as $v) { - $it->seek($pos++); - var_dump($v); + $it->seek($pos++); + var_dump($v); } ?> diff --git a/ext/spl/tests/array_015.phpt b/ext/spl/tests/array_015.phpt index 8571e930d5..45cf466b76 100644 --- a/ext/spl/tests/array_015.phpt +++ b/ext/spl/tests/array_015.phpt @@ -23,16 +23,16 @@ var_dump($ar); foreach($it as $k => $v) { - $ar->offsetUnset($k+1); - echo "$k=>$v\n"; + $ar->offsetUnset($k+1); + echo "$k=>$v\n"; } var_dump($ar); foreach($it as $k => $v) { - $ar->offsetUnset($k); - echo "$k=>$v\n"; + $ar->offsetUnset($k); + echo "$k=>$v\n"; } var_dump($ar); diff --git a/ext/spl/tests/array_016.phpt b/ext/spl/tests/array_016.phpt index 576ab6c803..a40d4d5b8a 100644 --- a/ext/spl/tests/array_016.phpt +++ b/ext/spl/tests/array_016.phpt @@ -7,14 +7,14 @@ $it = new ArrayIterator(range(0,3)); foreach(new IteratorIterator($it) as $v) { - var_dump($v); + var_dump($v); } $it = new ArrayObject(range(0,3)); foreach(new IteratorIterator($it) as $v) { - var_dump($v); + var_dump($v); } ?> diff --git a/ext/spl/tests/array_017.phpt b/ext/spl/tests/array_017.phpt index ef739eb7e1..1165133b35 100644 --- a/ext/spl/tests/array_017.phpt +++ b/ext/spl/tests/array_017.phpt @@ -5,113 +5,113 @@ SPL: ArrayObject::exchangeArray($this) class ArrayIteratorEx extends ArrayIterator { - public $pub2 = 1; - protected $pro2 = 2; - private $pri2 = 3; + public $pub2 = 1; + protected $pro2 = 2; + private $pri2 = 3; - function __construct($ar, $flags = 0) - { - echo __METHOD__ . "()\n"; - parent::__construct($ar, $flags); - $this->imp2 = 4; - } + function __construct($ar, $flags = 0) + { + echo __METHOD__ . "()\n"; + parent::__construct($ar, $flags); + $this->imp2 = 4; + } - function dump() - { - echo __METHOD__ . "()\n"; - var_dump(array('Flags'=>$this->getFlags() - ,'OVars'=>get_object_vars($this) - ,'$this'=>$this)); - } + function dump() + { + echo __METHOD__ . "()\n"; + var_dump(array('Flags'=>$this->getFlags() + ,'OVars'=>get_object_vars($this) + ,'$this'=>$this)); + } - function setFlags($flags) - { - echo __METHOD__ . "($flags)\n"; - ArrayIterator::setFlags($flags); - } + function setFlags($flags) + { + echo __METHOD__ . "($flags)\n"; + ArrayIterator::setFlags($flags); + } } class ArrayObjectEx extends ArrayObject { - public $pub1 = 1; - protected $pro1 = 2; - private $pri1 = 3; + public $pub1 = 1; + protected $pro1 = 2; + private $pri1 = 3; - function __construct($ar = array(), $flags = 0) - { - echo __METHOD__ . "()\n"; - parent::__construct($ar, $flags); - $this->imp1 = 4; - } + function __construct($ar = array(), $flags = 0) + { + echo __METHOD__ . "()\n"; + parent::__construct($ar, $flags); + $this->imp1 = 4; + } - function exchange() - { - echo __METHOD__ . "()\n"; - $this->exchangeArray($this); - } + function exchange() + { + echo __METHOD__ . "()\n"; + $this->exchangeArray($this); + } - function dump() - { - echo __METHOD__ . "()\n"; - var_dump(array('Flags'=>$this->getFlags() - ,'OVars'=>get_object_vars($this) - ,'$this'=>$this)); - } + function dump() + { + echo __METHOD__ . "()\n"; + var_dump(array('Flags'=>$this->getFlags() + ,'OVars'=>get_object_vars($this) + ,'$this'=>$this)); + } - function show() - { - echo __METHOD__ . "()\n"; - foreach($this as $n => $v) - { - var_dump(array($n => $v)); - } - } + function show() + { + echo __METHOD__ . "()\n"; + foreach($this as $n => $v) + { + var_dump(array($n => $v)); + } + } - function setFlags($flags) - { - echo __METHOD__ . "($flags)\n"; - ArrayObject::setFlags($flags); - } + function setFlags($flags) + { + echo __METHOD__ . "($flags)\n"; + ArrayObject::setFlags($flags); + } - function getIterator() - { - echo __METHOD__ . "()\n"; - $it = new ArrayIteratorEx($this, $this->getFlags()); - $it->dyn2 = 5; - $it->dump(); - return $it; - } + function getIterator() + { + echo __METHOD__ . "()\n"; + $it = new ArrayIteratorEx($this, $this->getFlags()); + $it->dyn2 = 5; + $it->dump(); + return $it; + } } function check($obj, $flags) { - echo "===CHECK===\n"; + echo "===CHECK===\n"; - $obj->setFlags($flags); - $obj->dump(); - $obj->show(); + $obj->setFlags($flags); + $obj->dump(); + $obj->show(); - echo "===FOREACH===\n"; + echo "===FOREACH===\n"; - $it = $obj->getIterator(); - foreach($it as $n => $v) - { - var_dump(array($n => $v)); - } + $it = $obj->getIterator(); + foreach($it as $n => $v) + { + var_dump(array($n => $v)); + } - echo "===PROPERTY===\n"; + echo "===PROPERTY===\n"; - var_dump($obj->pub1); - var_dump(isset($obj->a)); - $obj->setFlags($flags | 2); - var_dump($obj->pub1); - var_dump(isset($obj->a)); + var_dump($obj->pub1); + var_dump(isset($obj->a)); + $obj->setFlags($flags | 2); + var_dump($obj->pub1); + var_dump(isset($obj->a)); - var_dump($it->pub2); - var_dump(isset($it->pub1)); - $it->setFlags($flags | 2); - var_dump($it->pub2); - var_dump(isset($it->pub1)); + var_dump($it->pub2); + var_dump(isset($it->pub1)); + $it->setFlags($flags | 2); + var_dump($it->pub2); + var_dump(isset($it->pub1)); } $obj = new ArrayObjectEx(array(0=>1,'a'=>25, 'pub1'=>42), 0); diff --git a/ext/spl/tests/array_018.phpt b/ext/spl/tests/array_018.phpt Binary files differindex 2fe18daa59..8da46a24db 100644 --- a/ext/spl/tests/array_018.phpt +++ b/ext/spl/tests/array_018.phpt diff --git a/ext/spl/tests/array_019.phpt b/ext/spl/tests/array_019.phpt index 9a10a2e365..2a86e70589 100644 --- a/ext/spl/tests/array_019.phpt +++ b/ext/spl/tests/array_019.phpt @@ -9,10 +9,10 @@ $ar = new RecursiveArrayIterator(array(3)); foreach($ar as &$v) var_dump($v); class ArrayIteratorEx extends ArrayIterator { - function current() - { - return ArrayIterator::current(); - } + function current() + { + return ArrayIterator::current(); + } } $ar = new ArrayIteratorEx(array(4)); foreach($ar as $v) var_dump($v); diff --git a/ext/spl/tests/array_020.phpt b/ext/spl/tests/array_020.phpt index 3a218bdabc..fa96f92ab3 100644 --- a/ext/spl/tests/array_020.phpt +++ b/ext/spl/tests/array_020.phpt @@ -5,42 +5,42 @@ SPL: ArrayIterator overloading class ArrayIteratorEx extends ArrayIterator { - function rewind() - { - echo __METHOD__ . "\n"; - ArrayIterator::rewind(); - } + function rewind() + { + echo __METHOD__ . "\n"; + ArrayIterator::rewind(); + } - function valid() - { - echo __METHOD__ . "\n"; - return ArrayIterator::valid(); - } + function valid() + { + echo __METHOD__ . "\n"; + return ArrayIterator::valid(); + } - function key() - { - echo __METHOD__ . "\n"; - return ArrayIterator::key(); - } + function key() + { + echo __METHOD__ . "\n"; + return ArrayIterator::key(); + } - function current() - { - echo __METHOD__ . "\n"; - return ArrayIterator::current(); - } + function current() + { + echo __METHOD__ . "\n"; + return ArrayIterator::current(); + } - function next() - { - echo __METHOD__ . "\n"; - return ArrayIterator::next(); - } + function next() + { + echo __METHOD__ . "\n"; + return ArrayIterator::next(); + } } $ar = new ArrayIteratorEx(array(1,2)); foreach($ar as $k => $v) { - var_dump($k); - var_dump($v); + var_dump($k); + var_dump($v); } ?> diff --git a/ext/spl/tests/array_021.phpt b/ext/spl/tests/array_021.phpt index f2f0fd3d73..620347dcd7 100644 --- a/ext/spl/tests/array_021.phpt +++ b/ext/spl/tests/array_021.phpt @@ -5,22 +5,22 @@ SPL: ArrayObject::seek() and exceptions class foo extends ArrayObject { - public function seek($key) - { - echo __METHOD__ . "($key)\n"; - throw new Exception("hi"); - } + public function seek($key) + { + echo __METHOD__ . "($key)\n"; + throw new Exception("hi"); + } } $test = new foo(array(1,2,3)); try { - $test->seek('bar'); + $test->seek('bar'); } catch (Exception $e) { - echo "got exception\n"; + echo "got exception\n"; } ?> diff --git a/ext/spl/tests/array_022.phpt b/ext/spl/tests/array_022.phpt index ffb75ec3d4..f7407bf602 100644 --- a/ext/spl/tests/array_022.phpt +++ b/ext/spl/tests/array_022.phpt @@ -6,11 +6,11 @@ SPL: ArrayObject/Iterator and reference to self class MyArrayObject extends ArrayObject { - public function __construct() - { - parent::__construct($this); - $this['bar'] = 'baz'; - } + public function __construct() + { + parent::__construct($this); + $this['bar'] = 'baz'; + } } $a = new MyArrayObject; @@ -27,11 +27,11 @@ var_dump($b); class MyArrayIterator extends ArrayIterator { - public function __construct() - { - parent::__construct($this); - $this['bar'] = 'baz'; - } + public function __construct() + { + parent::__construct($this); + $this['bar'] = 'baz'; + } } $a = new MyArrayIterator; diff --git a/ext/spl/tests/bug31185.phpt b/ext/spl/tests/bug31185.phpt index 0086c64a34..88cb3dbf7c 100644 --- a/ext/spl/tests/bug31185.phpt +++ b/ext/spl/tests/bug31185.phpt @@ -4,25 +4,25 @@ Bug #31185 (Crash when exceptions thrown from ArrayAccess::offsetUnset()) <?php class FooBar implements ArrayAccess { - private $array = array(); + private $array = array(); - public function offsetExists($index) { - return isset($this->array[$index]); - } + public function offsetExists($index) { + return isset($this->array[$index]); + } - public function offsetGet($index) { - return $this->array[$index]; - } + public function offsetGet($index) { + return $this->array[$index]; + } - public function offsetSet($index, $value) { - echo __METHOD__ . "($index, $value)\n"; - $this->array[$index] = $value; - } + public function offsetSet($index, $value) { + echo __METHOD__ . "($index, $value)\n"; + $this->array[$index] = $value; + } - public function offsetUnset($index) { - throw new Exception('FAIL'); - unset($this->array[$index]); - } + public function offsetUnset($index) { + throw new Exception('FAIL'); + unset($this->array[$index]); + } } @@ -33,11 +33,11 @@ $foo[$j++] = $i++; $foo[$j++] = $i++; try { - unset($foo[1]); + unset($foo[1]); } catch (Exception $e) { - echo "CAUGHT: " . $e->getMessage() . "\n"; + echo "CAUGHT: " . $e->getMessage() . "\n"; } print_R($foo); diff --git a/ext/spl/tests/bug32134.phpt b/ext/spl/tests/bug32134.phpt index 7a6012b7f8..a81924ed1d 100644 --- a/ext/spl/tests/bug32134.phpt +++ b/ext/spl/tests/bug32134.phpt @@ -13,7 +13,7 @@ class myArray extends ArrayIterator public function offsetGet($index) { - static $i = 0; + static $i = 0; echo __METHOD__ . "($index)\n"; if (++$i > 3) exit(1); return parent::offsetGet($index); diff --git a/ext/spl/tests/bug32394.phpt b/ext/spl/tests/bug32394.phpt index 8189b23f7a..519b0b049e 100644 --- a/ext/spl/tests/bug32394.phpt +++ b/ext/spl/tests/bug32394.phpt @@ -8,7 +8,7 @@ $object->append(1); foreach($object as $key => $value) { - $object->offsetUnset($key); + $object->offsetUnset($key); } ?> diff --git a/ext/spl/tests/bug33136.phpt b/ext/spl/tests/bug33136.phpt index 1e1e3a18dc..8b52eae599 100644 --- a/ext/spl/tests/bug33136.phpt +++ b/ext/spl/tests/bug33136.phpt @@ -5,25 +5,25 @@ Bug #33136 (method offsetSet in class extended from ArrayObject crash PHP) class Collection extends ArrayObject { - private $data; + private $data; - function __construct() - { - $this->data = array(); - parent::__construct($this->data); - } + function __construct() + { + $this->data = array(); + parent::__construct($this->data); + } - function offsetGet($index) - { - echo __METHOD__ . "($index)\n"; - return parent::offsetGet($index); - } + function offsetGet($index) + { + echo __METHOD__ . "($index)\n"; + return parent::offsetGet($index); + } - function offsetSet($index, $value) - { - echo __METHOD__ . "(" . (is_null($index) ? "NULL" : $index) . ",$value)\n"; - parent::offsetSet($index, $value); - } + function offsetSet($index, $value) + { + echo __METHOD__ . "(" . (is_null($index) ? "NULL" : $index) . ",$value)\n"; + parent::offsetSet($index, $value); + } } echo "\n\nInitiate Obj\n"; diff --git a/ext/spl/tests/bug34548.phpt b/ext/spl/tests/bug34548.phpt index 399aa33788..4615b1306b 100644 --- a/ext/spl/tests/bug34548.phpt +++ b/ext/spl/tests/bug34548.phpt @@ -5,15 +5,15 @@ Bug #34548 (Method append() in class extended from ArrayObject crashes PHP) class Collection extends ArrayObject { - public function add($dataArray) - { - foreach($dataArray as $value) $this->append($value); - } + public function add($dataArray) + { + foreach($dataArray as $value) $this->append($value); + } - public function offsetSet($index, $value) - { - parent::offsetSet($index, $value); - } + public function offsetSet($index, $value) + { + parent::offsetSet($index, $value); + } } $data1=array('one', 'two', 'three'); diff --git a/ext/spl/tests/bug36258.phpt b/ext/spl/tests/bug36258.phpt index db7bfa7c70..5e61b29928 100644 --- a/ext/spl/tests/bug36258.phpt +++ b/ext/spl/tests/bug36258.phpt @@ -6,9 +6,9 @@ Bug #36258 (SplFileObject::getPath() may lead to segfault) $diriter = new RecursiveIteratorIterator( new RecursiveDirectoryIterator('.') ); foreach ($diriter as $key => $file) { - var_dump($file->getFilename()); - var_dump($file->getPath()); - break; + var_dump($file->getFilename()); + var_dump($file->getPath()); + break; } ?> diff --git a/ext/spl/tests/bug36287.phpt b/ext/spl/tests/bug36287.phpt index e4970cbf3b..0fa6e1bc1e 100644 --- a/ext/spl/tests/bug36287.phpt +++ b/ext/spl/tests/bug36287.phpt @@ -8,14 +8,14 @@ $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("."), true); $idx = 0; foreach($it as $file) { - echo "First\n"; - var_Dump($file->getFilename()); - echo "Second\n"; - var_dump($file->getFilename()); - if (++$idx > 1) - { - break; - } + echo "First\n"; + var_Dump($file->getFilename()); + echo "Second\n"; + var_dump($file->getFilename()); + if (++$idx > 1) + { + break; + } } ?> diff --git a/ext/spl/tests/bug36825.phpt b/ext/spl/tests/bug36825.phpt index 4aa6cf4d13..072009cf84 100644 --- a/ext/spl/tests/bug36825.phpt +++ b/ext/spl/tests/bug36825.phpt @@ -5,22 +5,22 @@ Bug #36825 (Exceptions thrown in ArrayObject::offsetGet cause segfault) class foo extends ArrayObject { - public function offsetGet($key) - { - echo __METHOD__ . "($key)\n"; - throw new Exception("hi"); - } + public function offsetGet($key) + { + echo __METHOD__ . "($key)\n"; + throw new Exception("hi"); + } } $test = new foo(); try { - var_dump($test['bar']); + var_dump($test['bar']); } catch (Exception $e) { - echo "got exception\n"; + echo "got exception\n"; } ?> diff --git a/ext/spl/tests/bug37457.phpt b/ext/spl/tests/bug37457.phpt index 9f723c94fb..792d5ae2a7 100644 --- a/ext/spl/tests/bug37457.phpt +++ b/ext/spl/tests/bug37457.phpt @@ -5,51 +5,51 @@ Bug #37457 (Crash when an exception is thrown in accept() method of FilterIterat class Collection implements Iterator { - protected $array, $valid = false; + protected $array, $valid = false; - public function __construct(array $a) - { - echo __METHOD__ . "\n"; - $this->array = $a; - } + public function __construct(array $a) + { + echo __METHOD__ . "\n"; + $this->array = $a; + } - public function current() - { - echo __METHOD__ . "\n"; - return current($this->array); - } + public function current() + { + echo __METHOD__ . "\n"; + return current($this->array); + } - public function key() - { - echo __METHOD__ . "\n"; - return key($this->array); - } + public function key() + { + echo __METHOD__ . "\n"; + return key($this->array); + } - public function next() - { - echo __METHOD__ . "\n"; - $this->valid = (false !== next($this->array)); - } + public function next() + { + echo __METHOD__ . "\n"; + $this->valid = (false !== next($this->array)); + } - public function valid() - { - echo __METHOD__ . "\n"; - return $this->valid; - } + public function valid() + { + echo __METHOD__ . "\n"; + return $this->valid; + } - public function rewind() - { - echo __METHOD__ . "\n"; - $this->valid = (false !== reset($this->array)); - } + public function rewind() + { + echo __METHOD__ . "\n"; + $this->valid = (false !== reset($this->array)); + } } class TestFilter extends FilterIterator { public function accept() { - echo __METHOD__ . "\n"; - throw new Exception("Failure in Accept"); + echo __METHOD__ . "\n"; + throw new Exception("Failure in Accept"); } } @@ -57,14 +57,14 @@ $test = new TestFilter(new Collection(array(0))); try { - foreach ($test as $item) - { - echo $item; - } + foreach ($test as $item) + { + echo $item; + } } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> diff --git a/ext/spl/tests/bug40091.phpt b/ext/spl/tests/bug40091.phpt index f5719751e4..3bb1bbf152 100644 --- a/ext/spl/tests/bug40091.phpt +++ b/ext/spl/tests/bug40091.phpt @@ -3,10 +3,10 @@ Bug #40091 (issue with spl_autoload_register() and 2 instances of the same class --FILE-- <?php class MyAutoloader { - function __construct($directory_to_use) {} - function autoload($class_name) { - // code to autoload based on directory - } + function __construct($directory_to_use) {} + function autoload($class_name) { + // code to autoload based on directory + } } $autloader1 = new MyAutoloader('dir1'); diff --git a/ext/spl/tests/bug40872.phpt b/ext/spl/tests/bug40872.phpt index 909951f3d3..77c0063de4 100644 --- a/ext/spl/tests/bug40872.phpt +++ b/ext/spl/tests/bug40872.phpt @@ -2,26 +2,26 @@ Bug #40872 (inconsistency in offsetSet, offsetExists treatment of string enclosed integers) --FILE-- <?php - class Project { - public $id; + class Project { + public $id; - function __construct($id) { - $this->id = $id; - } - } + function __construct($id) { + $this->id = $id; + } + } - class ProjectsList extends ArrayIterator { - public function add(Project $item) { - $this->offsetSet($item->id, $item); - } - } + class ProjectsList extends ArrayIterator { + public function add(Project $item) { + $this->offsetSet($item->id, $item); + } + } - $projects = new ProjectsList(); - $projects->add(new Project('1')); - $projects->add(new Project(2)); + $projects = new ProjectsList(); + $projects->add(new Project('1')); + $projects->add(new Project(2)); - var_dump($projects->offsetExists(1)); - var_dump($projects->offsetExists('2')); + var_dump($projects->offsetExists(1)); + var_dump($projects->offsetExists('2')); ?> --EXPECT-- bool(true) diff --git a/ext/spl/tests/bug41691.phpt b/ext/spl/tests/bug41691.phpt index d1c53a6fe6..93af430b48 100644 --- a/ext/spl/tests/bug41691.phpt +++ b/ext/spl/tests/bug41691.phpt @@ -4,12 +4,12 @@ Bug #41691 (ArrayObject::exchangeArray hangs Apache) <?php class A extends ArrayObject { - public function __construct($dummy, $flags) { - parent::__construct($this, $flags); - } - public $a; - public $b; - public $c; + public function __construct($dummy, $flags) { + parent::__construct($this, $flags); + } + public $a; + public $b; + public $c; } $a = new A(null, ArrayObject::ARRAY_AS_PROPS ); diff --git a/ext/spl/tests/bug42703.phpt b/ext/spl/tests/bug42703.phpt index ab4ee5ed50..b54425c310 100644 --- a/ext/spl/tests/bug42703.phpt +++ b/ext/spl/tests/bug42703.phpt @@ -4,20 +4,20 @@ Bug #42703 (Exception raised in an iterator::current() causes segfault in Filter <?php class BlaIterator implements Iterator { - public function rewind() { } + public function rewind() { } - public function next() { } + public function next() { } - public function valid() { - return true; - } + public function valid() { + return true; + } - public function current() - { - throw new Exception('boo'); - } + public function current() + { + throw new Exception('boo'); + } - public function key() { } + public function key() { } } $it = new BlaIterator(); @@ -25,11 +25,11 @@ $itit = new IteratorIterator($it); try { foreach($itit as $key => $value) { - echo $key, $value; + echo $key, $value; } } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } var_dump($itit->current()); diff --git a/ext/spl/tests/bug45614.phpt b/ext/spl/tests/bug45614.phpt index d9e9207d28..8c688555d3 100644 --- a/ext/spl/tests/bug45614.phpt +++ b/ext/spl/tests/bug45614.phpt @@ -3,12 +3,12 @@ SPL: Bug#45614 (ArrayIterator can show 1st private prop of wrapped object) --FILE-- <?php class C { - private $priv1 = 'secret1'; - private $priv2 = 'secret2'; - public $pub1 = 'public1'; - public $pub2 = 'public2'; - public $pub3 = 'public3'; - public $pub4 = 'public4'; + private $priv1 = 'secret1'; + private $priv2 = 'secret2'; + public $pub1 = 'public1'; + public $pub2 = 'public2'; + public $pub3 = 'public3'; + public $pub4 = 'public4'; } function showFirstTwoItems($it) { diff --git a/ext/spl/tests/bug45622.phpt b/ext/spl/tests/bug45622.phpt index e2a7b905d5..ad84dda1d2 100644 --- a/ext/spl/tests/bug45622.phpt +++ b/ext/spl/tests/bug45622.phpt @@ -4,7 +4,7 @@ SPL: Bug #45622 (isset($arrayObject->p) misbehaves with ArrayObject::ARRAY_AS_PR <?php class C extends ArrayObject { - public $p = 'object property'; + public $p = 'object property'; } $ao = new C(array('p'=>'array element')); diff --git a/ext/spl/tests/bug45622b.phpt b/ext/spl/tests/bug45622b.phpt index bf0ab8242e..c829b185dd 100644 --- a/ext/spl/tests/bug45622b.phpt +++ b/ext/spl/tests/bug45622b.phpt @@ -3,10 +3,10 @@ Ensure fix to bug45622 doesn't cause __isset() to be called when ArrayObject::AR --FILE-- <?php class UsesMagic extends ArrayObject { - function __get($n) { echo "In " . __METHOD__ . "!\n"; } - function __set($n, $v) { echo "In " . __METHOD__ . "!\n"; } - function __isset($n) { echo "In " . __METHOD__ . "!\n"; } - function __unset($n) { echo "In " . __METHOD__ . "!\n"; } + function __get($n) { echo "In " . __METHOD__ . "!\n"; } + function __set($n, $v) { echo "In " . __METHOD__ . "!\n"; } + function __isset($n) { echo "In " . __METHOD__ . "!\n"; } + function __unset($n) { echo "In " . __METHOD__ . "!\n"; } } $ao = new UsesMagic(array(), ArrayObject::ARRAY_AS_PROPS); diff --git a/ext/spl/tests/bug46160.phpt b/ext/spl/tests/bug46160.phpt index e4dbdff192..3e03f094d3 100644 --- a/ext/spl/tests/bug46160.phpt +++ b/ext/spl/tests/bug46160.phpt @@ -4,8 +4,8 @@ Bug #46160 (SPL - Memory leak when exception is throwed in offsetSet method) <?php try { - $x = new splqueue; - $x->offsetSet(0, 0); + $x = new splqueue; + $x->offsetSet(0, 0); } catch (Exception $e) { } ?> diff --git a/ext/spl/tests/bug50579.phpt b/ext/spl/tests/bug50579.phpt index 7bc5deede8..fcf75b4b8d 100644 --- a/ext/spl/tests/bug50579.phpt +++ b/ext/spl/tests/bug50579.phpt @@ -4,30 +4,30 @@ Bug #50579 (RegexIterator::REPLACE doesn't work) <?php class foo extends ArrayIterator { - public function __construct( ) { - parent::__construct(array( - 'test1'=>'test888', - 'test2'=>'what?', - 'test3'=>'test999')); - } + public function __construct( ) { + parent::__construct(array( + 'test1'=>'test888', + 'test2'=>'what?', + 'test3'=>'test999')); + } } $h = new foo; $i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE); $i->replacement = '[$0]'; foreach ($i as $name=>$value) { - echo $name . '=>' . $value . "\n"; + echo $name . '=>' . $value . "\n"; } $i->replacement = '$1'; foreach ($i as $name=>$value) { - echo $name . '=>' . $value . "\n"; + echo $name . '=>' . $value . "\n"; } $h = new foo; $i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE); $i->replacement = '[$1]'; foreach ($i as $name=>$value) { - echo $name . '=>' . $value . "\n"; + echo $name . '=>' . $value . "\n"; } ?> diff --git a/ext/spl/tests/bug51068.phpt b/ext/spl/tests/bug51068.phpt index 0263536cc3..fd49c03be3 100644 --- a/ext/spl/tests/bug51068.phpt +++ b/ext/spl/tests/bug51068.phpt @@ -7,8 +7,8 @@ mkdir('bug.51068.dir'); touch('bug.51068.dir/lvl2.bug.51068'); $iter = new DirectoryIterator('glob://*.51068'); foreach ($iter as $f) { - var_dump($f->getFilename()); - var_dump($f->getSize()); + var_dump($f->getFilename()); + var_dump($f->getSize()); } $iter = new DirectoryIterator('glob://bug.51068.dir/*.51068'); foreach ($iter as $f) { diff --git a/ext/spl/tests/bug53071.phpt b/ext/spl/tests/bug53071.phpt index 4a2450e201..9ab108cfd5 100644 --- a/ext/spl/tests/bug53071.phpt +++ b/ext/spl/tests/bug53071.phpt @@ -5,16 +5,16 @@ Bug #53071 (Usage of SPLObjectStorage defeats gc_collect_cycles) gc_enable(); class myClass { - public $member; + public $member; } function LimitedScope() { - $myA = new myClass(); - $myB = new SplObjectStorage(); - $myC = new myClass(); - $myC->member = $myA; // myC has a reference to myA - $myB->Attach($myC); // myB attaches myC - $myA->member = $myB; // myA has myB, comleting the cycle + $myA = new myClass(); + $myB = new SplObjectStorage(); + $myC = new myClass(); + $myC->member = $myA; // myC has a reference to myA + $myB->Attach($myC); // myB attaches myC + $myA->member = $myB; // myA has myB, comleting the cycle } LimitedScope(); var_dump(gc_collect_cycles()); diff --git a/ext/spl/tests/bug53362.phpt b/ext/spl/tests/bug53362.phpt index 7ae74ce559..eec1f037eb 100644 --- a/ext/spl/tests/bug53362.phpt +++ b/ext/spl/tests/bug53362.phpt @@ -4,9 +4,9 @@ Bug #53362 (Segmentation fault when extending SplFixedArray) <?php class obj extends SplFixedArray{ - public function offsetSet($offset, $value) { - var_dump($offset); - } + public function offsetSet($offset, $value) { + var_dump($offset); + } } $obj = new obj; diff --git a/ext/spl/tests/bug54281.phpt b/ext/spl/tests/bug54281.phpt index 1d83699e14..5d214d9b18 100644 --- a/ext/spl/tests/bug54281.phpt +++ b/ext/spl/tests/bug54281.phpt @@ -4,7 +4,7 @@ Bug #54281 (Crash in spl_recursive_it_rewind_ex) <?php class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator { - function __construct($it, $max_depth) { } + function __construct($it, $max_depth) { } } $it = new RecursiveArrayIteratorIterator(new RecursiveArrayIterator(array()), 2); diff --git a/ext/spl/tests/bug54292.phpt b/ext/spl/tests/bug54292.phpt index ffbbcc3220..ac0cee10d4 100644 --- a/ext/spl/tests/bug54292.phpt +++ b/ext/spl/tests/bug54292.phpt @@ -4,9 +4,9 @@ Bug #54292 (Wrong parameter causes crash in SplFileObject::__construct()) <?php try { - new SplFileObject('foo', array()); + new SplFileObject('foo', array()); } catch (TypeError $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> diff --git a/ext/spl/tests/bug54304.phpt b/ext/spl/tests/bug54304.phpt index 143c26e153..5c6991a1ad 100644 --- a/ext/spl/tests/bug54304.phpt +++ b/ext/spl/tests/bug54304.phpt @@ -3,10 +3,10 @@ Bug #54304 (Setting replacement value for RegexIterator doesn't work) --FILE-- <?php class foo extends ArrayIterator { - public function __construct( ) { - parent::__construct(array( - 'test3'=>'test999')); - } + public function __construct( ) { + parent::__construct(array( + 'test3'=>'test999')); + } } $h = new foo; @@ -14,7 +14,7 @@ $i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE); $i->replacement = 42; var_dump($i->replacement); foreach ($i as $name=>$value) { - var_dump($name, $value); + var_dump($name, $value); } var_dump($i->replacement); ?> diff --git a/ext/spl/tests/bug54384.phpt b/ext/spl/tests/bug54384.phpt index a9dae2e736..581845a43a 100644 --- a/ext/spl/tests/bug54384.phpt +++ b/ext/spl/tests/bug54384.phpt @@ -4,12 +4,12 @@ Bug #54384: Several SPL classes crash when the parent constructor is not called <?php function test($f) { - try { - $f(); - echo "ran normally (unexpected)\n\n"; - } catch (LogicException $e) { - echo "exception (expected)\n"; - } + try { + $f(); + echo "ran normally (unexpected)\n\n"; + } catch (LogicException $e) { + echo "exception (expected)\n"; + } } echo "IteratorIterator... "; @@ -17,8 +17,8 @@ class IteratorIteratorTest extends IteratorIterator { function __construct(){} } test( function() { - $o = new IteratorIteratorTest; - $o->rewind(); + $o = new IteratorIteratorTest; + $o->rewind(); } ); echo "FilterIterator... "; @@ -27,8 +27,8 @@ class FilterIteratorTest extends FilterIterator { function accept(){} } test( function() { - $o = new FilterIteratorTest; - $o->rewind(); + $o = new FilterIteratorTest; + $o->rewind(); } ); echo "RecursiveFilterIterator... "; diff --git a/ext/spl/tests/bug61453.phpt b/ext/spl/tests/bug61453.phpt index e5b1387fd2..92312d542f 100644 --- a/ext/spl/tests/bug61453.phpt +++ b/ext/spl/tests/bug61453.phpt @@ -5,13 +5,13 @@ Bug #61453: SplObjectStorage does not identify objects correctly $limit = 1000; $objects = new SplObjectStorage; for($i = 0; $i < $limit; $i++){ - $object = new StdClass; + $object = new StdClass; - if(isset($objects[$object])){ - die("this should never happen, but did after $i iteration"); - } + if(isset($objects[$object])){ + die("this should never happen, but did after $i iteration"); + } - $objects[$object] = 1; + $objects[$object] = 1; } ?> ==DONE== diff --git a/ext/spl/tests/bug64023.phpt b/ext/spl/tests/bug64023.phpt index cb98445279..82924659e0 100644 --- a/ext/spl/tests/bug64023.phpt +++ b/ext/spl/tests/bug64023.phpt @@ -4,7 +4,7 @@ Bug #64023: Overloading __toString() in SplFileInfo has no effect <?php class A extends \SplFileInfo { - public function __toString() {return ' -expected- ';} + public function __toString() {return ' -expected- ';} } $a = new A('/'); diff --git a/ext/spl/tests/bug66834.phpt b/ext/spl/tests/bug66834.phpt index eed26c815f..0ff909f422 100644 --- a/ext/spl/tests/bug66834.phpt +++ b/ext/spl/tests/bug66834.phpt @@ -6,47 +6,47 @@ SPL: Bug #66834 // overrides both offsetExists and offsetGet class ArrayObjectBoth extends ArrayObject { - public function offsetExists($offset) { - var_dump('Called: '.__METHOD__); - return parent::offsetExists($offset); - } + public function offsetExists($offset) { + var_dump('Called: '.__METHOD__); + return parent::offsetExists($offset); + } - public function offsetGet($offset) { - var_dump('Called: '.__METHOD__); - return parent::offsetGet($offset); - } + public function offsetGet($offset) { + var_dump('Called: '.__METHOD__); + return parent::offsetGet($offset); + } } // overrides only offsetExists class ArrayObjectExists extends ArrayObject { - public function offsetExists($offset) { - var_dump('Called: '.__METHOD__); - return parent::offsetExists($offset); - } + public function offsetExists($offset) { + var_dump('Called: '.__METHOD__); + return parent::offsetExists($offset); + } } // overrides only offsetGet class ArrayObjectGet extends ArrayObject { - public function offsetGet($offset) { - var_dump('Called: '.__METHOD__); - return parent::offsetGet($offset); - } + public function offsetGet($offset) { + var_dump('Called: '.__METHOD__); + return parent::offsetGet($offset); + } } // overrides only offsetGet and offsetSet class ArrayObjectGetSet extends ArrayObject { - public function offsetGet($offset) - { - return parent::offsetGet(str_rot13($offset)); - } + public function offsetGet($offset) + { + return parent::offsetGet(str_rot13($offset)); + } - public function offsetSet($offset, $value) - { - return parent::offsetSet(str_rot13($offset), $value); - } + public function offsetSet($offset, $value) + { + return parent::offsetSet(str_rot13($offset), $value); + } } $values = ['foo' => '', 'bar' => null, 'baz' => 42]; diff --git a/ext/spl/tests/bug67359.phpt b/ext/spl/tests/bug67359.phpt index 3e8f30cd2b..3a867f1f87 100644 --- a/ext/spl/tests/bug67359.phpt +++ b/ext/spl/tests/bug67359.phpt @@ -4,20 +4,20 @@ Bug #67359 (Segfault in recursiveDirectoryIterator) <?php try { - $rdi = new recursiveDirectoryIterator(__DIR__, FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS); - $it = new recursiveIteratorIterator( $rdi ); - $it->seek(1); - while( $it->valid()) - { - if( $it->isFile() ) - { - $it->current(); - } + $rdi = new recursiveDirectoryIterator(__DIR__, FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS); + $it = new recursiveIteratorIterator( $rdi ); + $it->seek(1); + while( $it->valid()) + { + if( $it->isFile() ) + { + $it->current(); + } - $it->next(); - } + $it->next(); + } - $it->current(); + $it->current(); } catch(Exception $e) { diff --git a/ext/spl/tests/bug67582.phpt b/ext/spl/tests/bug67582.phpt index b22f615034..331accbe7e 100644 --- a/ext/spl/tests/bug67582.phpt +++ b/ext/spl/tests/bug67582.phpt @@ -4,8 +4,8 @@ Bug #67582: Cloned SplObjectStorage with overwritten getHash fails offsetExists( <?php class MyObjectStorage extends SplObjectStorage { - // Overwrite getHash() with just some (working) test-method - public function getHash($object) { return get_class($object); } + // Overwrite getHash() with just some (working) test-method + public function getHash($object) { return get_class($object); } } class TestObject {} diff --git a/ext/spl/tests/bug68128.phpt b/ext/spl/tests/bug68128.phpt index 5ac7f8b2fb..69d63a890a 100644 --- a/ext/spl/tests/bug68128.phpt +++ b/ext/spl/tests/bug68128.phpt @@ -21,13 +21,13 @@ foreach ($rRegexIterator as $key1 => $value1) { // print all children echo "Children: "; foreach ($rRegexIterator->getChildren() as $key => $value) { - print_r($value); + print_r($value); } echo "\n"; } else { echo "No children "; - print_r($value1); - echo "\n"; + print_r($value1); + echo "\n"; } } diff --git a/ext/spl/tests/bug69108.phpt b/ext/spl/tests/bug69108.phpt index 1829e9b2a2..3122da599c 100644 --- a/ext/spl/tests/bug69108.phpt +++ b/ext/spl/tests/bug69108.phpt @@ -7,9 +7,9 @@ zend.enable_gc=1 $a = array(); $b = new SplObjectStorage(); for ($i = 10000; $i > 0; $i--) { - $object = new StdClass(); - $a[] = $object; - $b->attach($object); + $object = new StdClass(); + $a[] = $object; + $b->attach($object); } $c = serialize(array($a, $b)); diff --git a/ext/spl/tests/bug69335.phpt b/ext/spl/tests/bug69335.phpt index 3b065b6473..acd5588b3e 100644 --- a/ext/spl/tests/bug69335.phpt +++ b/ext/spl/tests/bug69335.phpt @@ -6,10 +6,10 @@ $a = array(1=>1, 3=>3, 5=>5, 7=>7); $a = new ArrayObject($a); foreach ($a as $k => $v) { - var_dump("$k => $v"); - if ($k == 3) { - $a['a'] = "?"; - } + var_dump("$k => $v"); + if ($k == 3) { + $a['a'] = "?"; + } } ?> --EXPECT-- diff --git a/ext/spl/tests/bug69845.phpt b/ext/spl/tests/bug69845.phpt index db88a8e10d..09c9f2356d 100644 --- a/ext/spl/tests/bug69845.phpt +++ b/ext/spl/tests/bug69845.phpt @@ -3,9 +3,9 @@ Fixed bug #69845 (ArrayObject with ARRAY_AS_PROPS broken) --FILE-- <?php for ($i = 0; $i<2; $i++) { - $data = new \ArrayObject(new stdClass(), ArrayObject::ARRAY_AS_PROPS); - $data->itemType = 'bulletin'; - var_dump(!is_null($data['itemType'])); + $data = new \ArrayObject(new stdClass(), ArrayObject::ARRAY_AS_PROPS); + $data->itemType = 'bulletin'; + var_dump(!is_null($data['itemType'])); } ?> --EXPECT-- diff --git a/ext/spl/tests/bug69970.phpt b/ext/spl/tests/bug69970.phpt index a488037b8c..c82d0b58c6 100644 --- a/ext/spl/tests/bug69970.phpt +++ b/ext/spl/tests/bug69970.phpt @@ -10,12 +10,12 @@ class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator { echo "dummy\n"; } function endChildren() { - global $count; - echo $this->getDepth(); - if (--$count > 0) { - // Trigger use-after-free - parent::rewind(); - } + global $count; + echo $this->getDepth(); + if (--$count > 0) { + // Trigger use-after-free + parent::rewind(); + } } } $arr = array("a", array("ba", array("bba", "bbb"))); diff --git a/ext/spl/tests/bug70068.phpt b/ext/spl/tests/bug70068.phpt index dc949da8fa..54f3cca449 100644 --- a/ext/spl/tests/bug70068.phpt +++ b/ext/spl/tests/bug70068.phpt @@ -5,7 +5,7 @@ Bug #70068 (Dangling pointer in the unserialization of ArrayObject items) try { $a = unserialize('a:3:{i:0;C:11:"ArrayObject":20:{x:i:0;r:3;;m:a:0:{};}i:1;d:11;i:2;S:31:"AAAAAAAABBBBCCCC\01\00\00\00\04\00\00\00\00\00\00\00\00\00\00";}'); } catch(Exception $e) { - print $e->getMessage()."\n"; + print $e->getMessage()."\n"; } ?> OK diff --git a/ext/spl/tests/bug70365.phpt b/ext/spl/tests/bug70365.phpt index c18110e3ca..06786aaf16 100644 --- a/ext/spl/tests/bug70365.phpt +++ b/ext/spl/tests/bug70365.phpt @@ -3,10 +3,10 @@ SPL: Bug #70365 use-after-free vulnerability in unserialize() with SplObjectStor --FILE-- <?php class obj { - var $ryat; - function __wakeup() { - $this->ryat = 1; - } + var $ryat; + function __wakeup() { + $this->ryat = 1; + } } $fakezval = ptr2str(1122334455); @@ -25,12 +25,12 @@ var_dump($data); function ptr2str($ptr) { - $out = ''; - for ($i = 0; $i < 8; $i++) { - $out .= chr($ptr & 0xff); - $ptr >>= 8; - } - return $out; + $out = ''; + for ($i = 0; $i < 8; $i++) { + $out .= chr($ptr & 0xff); + $ptr >>= 8; + } + return $out; } --EXPECTF-- array(5) { diff --git a/ext/spl/tests/bug70366.phpt b/ext/spl/tests/bug70366.phpt index da4cc2d389..d3d3317bff 100644 --- a/ext/spl/tests/bug70366.phpt +++ b/ext/spl/tests/bug70366.phpt @@ -3,10 +3,10 @@ SPL: Bug #70366 use-after-free vulnerability in unserialize() with SplDoublyLink --FILE-- <?php class obj { - var $ryat; - function __wakeup() { - $this->ryat = 1; - } + var $ryat; + function __wakeup() { + $this->ryat = 1; + } } $fakezval = ptr2str(1122334455); @@ -25,12 +25,12 @@ var_dump($data); function ptr2str($ptr) { - $out = ''; - for ($i = 0; $i < 8; $i++) { - $out .= chr($ptr & 0xff); - $ptr >>= 8; - } - return $out; + $out = ''; + for ($i = 0; $i < 8; $i++) { + $out .= chr($ptr & 0xff); + $ptr >>= 8; + } + return $out; } ?> --EXPECTF-- diff --git a/ext/spl/tests/bug70730.phpt b/ext/spl/tests/bug70730.phpt index 5710c9586d..9d52238426 100644 --- a/ext/spl/tests/bug70730.phpt +++ b/ext/spl/tests/bug70730.phpt @@ -4,20 +4,20 @@ Bug #70730 (Incorrect ArrayObject serialization if unset is called in serialize( <?php class A extends \ArrayObject { - protected $foo; + protected $foo; - public function __construct() - { - $this->foo = 'bar'; - } + public function __construct() + { + $this->foo = 'bar'; + } - public function serialize() - { - unset($this->foo); - $result = parent::serialize(); - $this->foo = 'bar'; - return $result; - } + public function serialize() + { + unset($this->foo); + $result = parent::serialize(); + $this->foo = 'bar'; + return $result; + } } $a = new A(); diff --git a/ext/spl/tests/bug70959.phpt b/ext/spl/tests/bug70959.phpt index 541807ae16..fde022ab92 100644 --- a/ext/spl/tests/bug70959.phpt +++ b/ext/spl/tests/bug70959.phpt @@ -3,15 +3,15 @@ Bug #70959 (ArrayObject unserialize does not restore protected fields) --FILE-- <?php class testObject extends ArrayObject { - protected $test; + protected $test; - public function getTest() { - return $this->test; - } + public function getTest() { + return $this->test; + } - public function setTest($test) { - $this->test = $test; - } + public function setTest($test) { + $this->test = $test; + } } $obj = new testObject(); diff --git a/ext/spl/tests/bug71028.phpt b/ext/spl/tests/bug71028.phpt index b8f0cc962f..20aa4467e9 100644 --- a/ext/spl/tests/bug71028.phpt +++ b/ext/spl/tests/bug71028.phpt @@ -3,7 +3,7 @@ Bug #71028 (Undefined index with ArrayIterator) --FILE-- <?php function cast(&$a) { - $a = (int)$a; + $a = (int)$a; } $a = new ArrayIterator; diff --git a/ext/spl/tests/bug71202.phpt b/ext/spl/tests/bug71202.phpt index d26d7e1f35..84c9b60944 100644 --- a/ext/spl/tests/bug71202.phpt +++ b/ext/spl/tests/bug71202.phpt @@ -4,34 +4,34 @@ Bug #71202 (Autoload function registered by another not activated immediately) <?php function inner_autoload ($name){ - if ($name == 'A') { - class A { - function __construct(){ - echo "okey, "; - } - } - } else { - class B { - function __construct() { - die("error"); - } - } - } + if ($name == 'A') { + class A { + function __construct(){ + echo "okey, "; + } + } + } else { + class B { + function __construct() { + die("error"); + } + } + } } spl_autoload_register(function ($name) { - if ($name == 'A') { - spl_autoload_register("inner_autoload"); - } else { - spl_autoload_unregister("inner_autoload"); - } + if ($name == 'A') { + spl_autoload_register("inner_autoload"); + } else { + spl_autoload_unregister("inner_autoload"); + } }); $c = new A(); try { - $c = new B(); + $c = new B(); } catch (Error $e) { - echo "done"; + echo "done"; } ?> --EXPECT-- diff --git a/ext/spl/tests/bug71204.phpt b/ext/spl/tests/bug71204.phpt index 64fa13bfb1..a984690fcb 100644 --- a/ext/spl/tests/bug71204.phpt +++ b/ext/spl/tests/bug71204.phpt @@ -4,7 +4,7 @@ Bug #71204 (segfault if clean spl_autoload_funcs while autoloading ) <?php spl_autoload_register(function ($name) { - spl_autoload_unregister("spl_autoload_call"); + spl_autoload_unregister("spl_autoload_call"); }); spl_autoload_register(function ($name) { diff --git a/ext/spl/tests/bug71617.phpt b/ext/spl/tests/bug71617.phpt index 412f83f541..cc0c105a96 100644 --- a/ext/spl/tests/bug71617.phpt +++ b/ext/spl/tests/bug71617.phpt @@ -6,23 +6,23 @@ Bug #71617: private properties lost when unserializing ArrayObject class Test extends ArrayObject { - private $name = null; - - public function __construct(array $input) - { - parent::__construct($input, ArrayObject::ARRAY_AS_PROPS); - } - - public function setName($name) - { - $this->name = $name; - return $this; - } - - public function getName() - { - return $this->name; - } + private $name = null; + + public function __construct(array $input) + { + parent::__construct($input, ArrayObject::ARRAY_AS_PROPS); + } + + public function setName($name) + { + $this->name = $name; + return $this; + } + + public function getName() + { + return $this->name; + } } $test = new Test(['a' => 'a', 'b' => 'b']); diff --git a/ext/spl/tests/bug71735.phpt b/ext/spl/tests/bug71735.phpt index ea6cf347ea..fd89cade78 100644 --- a/ext/spl/tests/bug71735.phpt +++ b/ext/spl/tests/bug71735.phpt @@ -6,7 +6,7 @@ try { $var_1=new SplStack(); $var_1->offsetSet(100,new DateTime('2000-01-01')); } catch(OutOfRangeException $e) { - print $e->getMessage()."\n"; + print $e->getMessage()."\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/bug72051.phpt b/ext/spl/tests/bug72051.phpt index 1dfc056d7e..b0fe05169a 100644 --- a/ext/spl/tests/bug72051.phpt +++ b/ext/spl/tests/bug72051.phpt @@ -4,12 +4,12 @@ Bug #72051 (The reference in CallbackFilterIterator doesn't work as expected) <?php $data = [ - [1,2] + [1,2] ]; $callbackTest = new CallbackFilterIterator(new ArrayIterator($data), function (&$current) { - $current['message'] = 'Test message'; - return true; + $current['message'] = 'Test message'; + return true; }); $callbackTest->rewind(); diff --git a/ext/spl/tests/bug72684.phpt b/ext/spl/tests/bug72684.phpt index 7a99901f53..06665efdaa 100644 --- a/ext/spl/tests/bug72684.phpt +++ b/ext/spl/tests/bug72684.phpt @@ -11,9 +11,9 @@ $appendIterator->append($generator); iterator_to_array($appendIterator); try { - iterator_to_array($appendIterator); + iterator_to_array($appendIterator); } catch (\Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/spl/tests/bug72888.phpt b/ext/spl/tests/bug72888.phpt index c27c8424ef..5e1aa2344b 100644 --- a/ext/spl/tests/bug72888.phpt +++ b/ext/spl/tests/bug72888.phpt @@ -5,9 +5,9 @@ Bug #72888 (Segfault on clone on splFileObject) $x = new SplFileObject(__FILE__); try { - $y=clone $x; + $y=clone $x; } catch (Error $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } var_dump($y); ?> diff --git a/ext/spl/tests/bug73029.phpt b/ext/spl/tests/bug73029.phpt index 8789e91df2..5c3cd8420d 100644 --- a/ext/spl/tests/bug73029.phpt +++ b/ext/spl/tests/bug73029.phpt @@ -7,7 +7,7 @@ $a = 'C:11:"ArrayObject":19:0x:i:0;r:2;;m:a:0:{}}'; $m = unserialize($a); $x = $m[2]; } catch(UnexpectedValueException $e) { - print $e->getMessage() . "\n"; + print $e->getMessage() . "\n"; } ?> DONE diff --git a/ext/spl/tests/bug73423.phpt b/ext/spl/tests/bug73423.phpt index 549ceabb8a..451748e52b 100644 --- a/ext/spl/tests/bug73423.phpt +++ b/ext/spl/tests/bug73423.phpt @@ -48,7 +48,7 @@ class fooIterator extends \RecursiveFilterIterator { public Function __destruct () { - eval("class A extends NotExists {}"); + eval("class A extends NotExists {}"); /* CRASH */ } diff --git a/ext/spl/tests/bug73686.phpt b/ext/spl/tests/bug73686.phpt index ae9a59c4aa..51858bc33c 100644 --- a/ext/spl/tests/bug73686.phpt +++ b/ext/spl/tests/bug73686.phpt @@ -7,8 +7,8 @@ $ao = new ArrayObject; foreach ([1, 2, 3] as $i => $var) { - settype($var, 'string'); - $ao[$i] = $var; + settype($var, 'string'); + $ao[$i] = $var; } var_dump($ao); @@ -16,7 +16,7 @@ $ao = new ArrayObject; foreach ([1, 2, 3] as $i => $var) { - $ao[$i] = &$var; + $ao[$i] = &$var; } var_dump($ao); ?> diff --git a/ext/spl/tests/bug73896.phpt b/ext/spl/tests/bug73896.phpt index 08d8f1e6c8..18e54644a9 100644 --- a/ext/spl/tests/bug73896.phpt +++ b/ext/spl/tests/bug73896.phpt @@ -18,7 +18,7 @@ class teLoader { } protected function autoload($class) { - die("Protected autoload() called!\n"); + die("Protected autoload() called!\n"); } public function doSomething() { @@ -29,9 +29,9 @@ class teLoader { $teLoader = new teLoader(); try { - new teChild(); + new teChild(); } catch (Throwable $e) { - echo "Exception: ", $e->getMessage() , "\n"; + echo "Exception: ", $e->getMessage() , "\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/bug74519.phpt b/ext/spl/tests/bug74519.phpt index 537366d498..5a2b958d01 100644 --- a/ext/spl/tests/bug74519.phpt +++ b/ext/spl/tests/bug74519.phpt @@ -10,8 +10,8 @@ $iterator->append($events); $events->next(); while($iterator->valid()) { - echo $iterator->current(), "\n"; - $iterator->next(); + echo $iterator->current(), "\n"; + $iterator->next(); } ?> --EXPECT-- diff --git a/ext/spl/tests/bug75049.phpt b/ext/spl/tests/bug75049.phpt index eafdb84541..cf1f80367c 100644 --- a/ext/spl/tests/bug75049.phpt +++ b/ext/spl/tests/bug75049.phpt @@ -9,7 +9,7 @@ echo (int)spl_autoload_register($autoloader); echo (int)spl_autoload_unregister($autoloader); echo (int)spl_autoload_register($autoloader); foreach (spl_autoload_functions() as $loader) { - echo (int)spl_autoload_unregister($loader); + echo (int)spl_autoload_unregister($loader); } echo (int)count(spl_autoload_functions()); --EXPECT-- diff --git a/ext/spl/tests/bug76367.phpt b/ext/spl/tests/bug76367.phpt index 38aefbc922..7e9d7e66ba 100644 --- a/ext/spl/tests/bug76367.phpt +++ b/ext/spl/tests/bug76367.phpt @@ -7,7 +7,7 @@ $arr = [1,3,55,66,43,6]; $iter = new NoRewindIterator(new ArrayIterator($arr)); while($iter->valid()) { - $iter->next(); + $iter->next(); } var_dump($iter->current()); diff --git a/ext/spl/tests/class_implements_variation1.phpt b/ext/spl/tests/class_implements_variation1.phpt index 26368ca709..65fbe1a58a 100644 --- a/ext/spl/tests/class_implements_variation1.phpt +++ b/ext/spl/tests/class_implements_variation1.phpt @@ -13,10 +13,10 @@ echo "*** Testing class_implements() : variation ***\n"; // Define error handler function test_error_handler($err_no, $err_msg, $filename, $linenum) { - if (error_reporting() & $err_no) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } + if (error_reporting() & $err_no) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } } set_error_handler('test_error_handler'); @@ -33,9 +33,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/spl/tests/class_uses_variation1.phpt b/ext/spl/tests/class_uses_variation1.phpt index 5962e904c4..c26fb67e0f 100644 --- a/ext/spl/tests/class_uses_variation1.phpt +++ b/ext/spl/tests/class_uses_variation1.phpt @@ -13,10 +13,10 @@ echo "*** Testing class_uses() : variation ***\n"; // Define error handler function test_error_handler($err_no, $err_msg, $filename, $linenum) { - if (error_reporting() & $err_no) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } + if (error_reporting() & $err_no) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } } set_error_handler('test_error_handler'); @@ -33,9 +33,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/spl/tests/countable_count_variation1.phpt b/ext/spl/tests/countable_count_variation1.phpt index 0a99399329..8ce29410d9 100644 --- a/ext/spl/tests/countable_count_variation1.phpt +++ b/ext/spl/tests/countable_count_variation1.phpt @@ -4,32 +4,32 @@ SPL: Countable::count() with wrong return types and exception. <?php Class returnNull implements Countable { - function count() { - } + function count() { + } } Class returnString implements Countable { - function count() { - return "hello"; - } + function count() { + return "hello"; + } } Class returnObject implements Countable { - function count() { - return new returnObject; - } + function count() { + return new returnObject; + } } Class returnArray implements Countable { - function count() { - return array(1,2,3); - } + function count() { + return array(1,2,3); + } } Class throwException implements Countable { - function count() { - throw new Exception('Thrown from count'); - } + function count() { + throw new Exception('Thrown from count'); + } } @@ -47,9 +47,9 @@ var_dump(count(new returnArray)); echo "Count throws an exception:\n"; try { - echo count(new throwException); + echo count(new throwException); } catch (Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/spl/tests/dit_002.phpt b/ext/spl/tests/dit_002.phpt index 17f8d01346..f456101ed2 100644 --- a/ext/spl/tests/dit_002.phpt +++ b/ext/spl/tests/dit_002.phpt @@ -6,41 +6,41 @@ SPL: DirectoryIterator defaults <?php $classes = array( - 'DirectoryIterator' => 0, - 'FilesystemIterator' => 1, - 'RecursiveDirectoryIterator' => 1, - 'GlobIterator' => 1, + 'DirectoryIterator' => 0, + 'FilesystemIterator' => 1, + 'RecursiveDirectoryIterator' => 1, + 'GlobIterator' => 1, ); foreach ($classes as $class => $flags) { - echo "===$class===\n"; - $ref = new ReflectionClass($class); - $obj = $ref->newInstance('glob://*'); - echo get_class($obj->current()) . "\n"; - if ($flags) - { - var_dump($obj->getFlags()); - $flags = array( - FilesystemIterator::CURRENT_AS_FILEINFO => 0, - FilesystemIterator::CURRENT_AS_SELF => 0, - FilesystemIterator::CURRENT_AS_PATHNAME => 1, - ); - foreach($flags as $flag => $isstring) { - $obj->setFlags($flag); - $obj->rewind(); - var_dump($obj->getFlags()); - if ($isstring) { - $val = $obj->current(); - if (is_string($val)) { - var_dump(true); - } else { - var_dump($val); - } - } else { - echo get_class($obj->current()) . "\n"; - } - } - } + echo "===$class===\n"; + $ref = new ReflectionClass($class); + $obj = $ref->newInstance('glob://*'); + echo get_class($obj->current()) . "\n"; + if ($flags) + { + var_dump($obj->getFlags()); + $flags = array( + FilesystemIterator::CURRENT_AS_FILEINFO => 0, + FilesystemIterator::CURRENT_AS_SELF => 0, + FilesystemIterator::CURRENT_AS_PATHNAME => 1, + ); + foreach($flags as $flag => $isstring) { + $obj->setFlags($flag); + $obj->rewind(); + var_dump($obj->getFlags()); + if ($isstring) { + $val = $obj->current(); + if (is_string($val)) { + var_dump(true); + } else { + var_dump($val); + } + } else { + echo get_class($obj->current()) . "\n"; + } + } + } } ?> --EXPECTF-- diff --git a/ext/spl/tests/dit_003.phpt b/ext/spl/tests/dit_003.phpt index 0d44a3e8b2..f943075878 100644 --- a/ext/spl/tests/dit_003.phpt +++ b/ext/spl/tests/dit_003.phpt @@ -5,7 +5,7 @@ SPL: FilesystemIterator and foreach $count = 0; foreach(new FilesystemIterator(__DIR__) as $ent) { - ++$count; + ++$count; } var_dump($count > 0); ?> diff --git a/ext/spl/tests/dllist_013.phpt b/ext/spl/tests/dllist_013.phpt index edab2b3056..49b89d39a8 100644 --- a/ext/spl/tests/dllist_013.phpt +++ b/ext/spl/tests/dllist_013.phpt @@ -5,9 +5,9 @@ SPL: DoublyLinkedList: insert operations $dll = new SplDoublyLinkedList(); // errors try { - $dll->add(2,5); + $dll->add(2,5); } catch (OutOfRangeException $e) { - echo "Exception: ".$e->getMessage()."\n"; + echo "Exception: ".$e->getMessage()."\n"; } $dll->add(0,6); // 6 diff --git a/ext/spl/tests/dualiterator.inc b/ext/spl/tests/dualiterator.inc index eeb8ae869c..0830ebe644 100644 --- a/ext/spl/tests/dualiterator.inc +++ b/ext/spl/tests/dualiterator.inc @@ -16,195 +16,195 @@ */ class DualIterator implements Iterator { - const CURRENT_LHS = 0x01; - const CURRENT_RHS = 0x02; - const CURRENT_ARRAY = 0x03; - const CURRENT_0 = 0x00; - - const KEY_LHS = 0x10; - const KEY_RHS = 0x20; - const KEY_0 = 0x00; - - const DEFAULT_FLAGS = 0x13; - - private $lhs; - private $rhs; - private $flags; - - /** construct iterator from two iterators - * - * @param lhs Left Hand Side Iterator - * @param rhs Right Hand Side Iterator - * @param flags iteration flags - */ - function __construct(Iterator $lhs, Iterator $rhs, - $flags = 0x13 /*DualIterator::DEFAULT_FLAGS*/) - { - $this->lhs = $lhs; - $this->rhs = $rhs; - $this->flags = $flags; - } - - /** @return Left Hand Side Iterator - */ - function getLHS() - { - return $this->lhs; - } - - /** @return Right Hand Side Iterator - */ - function getRHS() - { - return $this->rhs; - } - - /** @param flags new flags - */ - function setFlags($flags) - { - $this->flags = $flags; - } - - /** @return current flags - */ - function getFlags() - { - return $this->flags; - } - - /** rewind both inner iterators - */ - function rewind() - { - $this->lhs->rewind(); - $this->rhs->rewind(); - } - - /** @return whether both inner iterators are valid - */ - function valid() - { - return $this->lhs->valid() && $this->rhs->valid(); - } - - /** @return current value depending on CURRENT_* flags - */ - function current() - { - switch($this->flags & 0x0F) - { - default: - case self::CURRENT_ARRAY: - return array($this->lhs->current(), $this->rhs->current()); - case self::CURRENT_LHS: - return $this->lhs->current(); - case self::CURRENT_RHS: - return $this->rhs->current(); - case self::CURRENT_0: - return NULL; - } - } - - /** @return key value depending on KEY_* flags - */ - function key() - { - switch($this->flags & 0xF0) - { - default: - case self::KEY_LHS: - return $this->lhs->key(); - case self::KEY_RHS: - return $this->rhs->key(); - case self::KEY_0: - return NULL; - } - } - - /** move both inner iterators forward - */ - function next() - { - $this->lhs->next(); - $this->rhs->next(); - } - - /** @return whether both inner iterators are valid and have identical - * current and key values or both are non valid. - */ - function areIdentical() - { - return $this->valid() - ? $this->lhs->current() === $this->rhs->current() - && $this->lhs->key() === $this->rhs->key() - : $this->lhs->valid() == $this->rhs->valid(); - } - - /** @return whether both inner iterators are valid and have equal current - * and key values or both are non valid. - */ - function areEqual() - { - return $this->valid() - ? $this->lhs->current() == $this->rhs->current() - && $this->lhs->key() == $this->rhs->key() - : $this->lhs->valid() == $this->rhs->valid(); - } - - /** Compare two iterators - * - * @param lhs Left Hand Side Iterator - * @param rhs Right Hand Side Iterator - * @param identical whether to use areEqual() or areIdentical() - * @return whether both iterators are equal/identical - * - * @note If one implements RecursiveIterator the other must do as well. - * And if both do then a recursive comparison is being used. - */ - static function compareIterators(Iterator $lhs, Iterator $rhs, - $identical = false) - { - if ($lhs instanceof RecursiveIterator) - { - if ($rhs instanceof RecursiveIterator) - { - $it = new RecursiveDualIterator($lhs, $rhs, - self::CURRENT_0 | self::KEY_0); - $it = new RecursiveCompareDualIterator($it); - } - else - { - return false; - } - } - else - { - $it = new DualIterator($lhs, $rhs, self::CURRENT_0 | self::KEY_0); - } - - if ($identical) - { - foreach($it as $n) - { - if (!$it->areIdentical()) - { - return false; - } - } - } - else - { - foreach($it as $n) - { - if (!$it->areEqual()) - { - return false; - } - } - } - return $identical ? $it->areIdentical() : $it->areEqual(); - } + const CURRENT_LHS = 0x01; + const CURRENT_RHS = 0x02; + const CURRENT_ARRAY = 0x03; + const CURRENT_0 = 0x00; + + const KEY_LHS = 0x10; + const KEY_RHS = 0x20; + const KEY_0 = 0x00; + + const DEFAULT_FLAGS = 0x13; + + private $lhs; + private $rhs; + private $flags; + + /** construct iterator from two iterators + * + * @param lhs Left Hand Side Iterator + * @param rhs Right Hand Side Iterator + * @param flags iteration flags + */ + function __construct(Iterator $lhs, Iterator $rhs, + $flags = 0x13 /*DualIterator::DEFAULT_FLAGS*/) + { + $this->lhs = $lhs; + $this->rhs = $rhs; + $this->flags = $flags; + } + + /** @return Left Hand Side Iterator + */ + function getLHS() + { + return $this->lhs; + } + + /** @return Right Hand Side Iterator + */ + function getRHS() + { + return $this->rhs; + } + + /** @param flags new flags + */ + function setFlags($flags) + { + $this->flags = $flags; + } + + /** @return current flags + */ + function getFlags() + { + return $this->flags; + } + + /** rewind both inner iterators + */ + function rewind() + { + $this->lhs->rewind(); + $this->rhs->rewind(); + } + + /** @return whether both inner iterators are valid + */ + function valid() + { + return $this->lhs->valid() && $this->rhs->valid(); + } + + /** @return current value depending on CURRENT_* flags + */ + function current() + { + switch($this->flags & 0x0F) + { + default: + case self::CURRENT_ARRAY: + return array($this->lhs->current(), $this->rhs->current()); + case self::CURRENT_LHS: + return $this->lhs->current(); + case self::CURRENT_RHS: + return $this->rhs->current(); + case self::CURRENT_0: + return NULL; + } + } + + /** @return key value depending on KEY_* flags + */ + function key() + { + switch($this->flags & 0xF0) + { + default: + case self::KEY_LHS: + return $this->lhs->key(); + case self::KEY_RHS: + return $this->rhs->key(); + case self::KEY_0: + return NULL; + } + } + + /** move both inner iterators forward + */ + function next() + { + $this->lhs->next(); + $this->rhs->next(); + } + + /** @return whether both inner iterators are valid and have identical + * current and key values or both are non valid. + */ + function areIdentical() + { + return $this->valid() + ? $this->lhs->current() === $this->rhs->current() + && $this->lhs->key() === $this->rhs->key() + : $this->lhs->valid() == $this->rhs->valid(); + } + + /** @return whether both inner iterators are valid and have equal current + * and key values or both are non valid. + */ + function areEqual() + { + return $this->valid() + ? $this->lhs->current() == $this->rhs->current() + && $this->lhs->key() == $this->rhs->key() + : $this->lhs->valid() == $this->rhs->valid(); + } + + /** Compare two iterators + * + * @param lhs Left Hand Side Iterator + * @param rhs Right Hand Side Iterator + * @param identical whether to use areEqual() or areIdentical() + * @return whether both iterators are equal/identical + * + * @note If one implements RecursiveIterator the other must do as well. + * And if both do then a recursive comparison is being used. + */ + static function compareIterators(Iterator $lhs, Iterator $rhs, + $identical = false) + { + if ($lhs instanceof RecursiveIterator) + { + if ($rhs instanceof RecursiveIterator) + { + $it = new RecursiveDualIterator($lhs, $rhs, + self::CURRENT_0 | self::KEY_0); + $it = new RecursiveCompareDualIterator($it); + } + else + { + return false; + } + } + else + { + $it = new DualIterator($lhs, $rhs, self::CURRENT_0 | self::KEY_0); + } + + if ($identical) + { + foreach($it as $n) + { + if (!$it->areIdentical()) + { + return false; + } + } + } + else + { + foreach($it as $n) + { + if (!$it->areEqual()) + { + return false; + } + } + } + return $identical ? $it->areIdentical() : $it->areEqual(); + } } ?> diff --git a/ext/spl/tests/dualiterator_001.phpt b/ext/spl/tests/dualiterator_001.phpt index 2a8358ae9c..2bbdc0c56f 100644 --- a/ext/spl/tests/dualiterator_001.phpt +++ b/ext/spl/tests/dualiterator_001.phpt @@ -5,17 +5,17 @@ SPL: DualIterator function spl_examples_autoload($classname) { - include(__DIR__ . '/' . strtolower($classname) . '.inc'); + include(__DIR__ . '/' . strtolower($classname) . '.inc'); } spl_autoload_register('spl_examples_autoload'); function test($a, $b, $identical = false) { - var_dump(DualIterator::compareIterators( - new RecursiveArrayIterator($a), - new RecursiveArrayIterator($b), - $identical)); + var_dump(DualIterator::compareIterators( + new RecursiveArrayIterator($a), + new RecursiveArrayIterator($b), + $identical)); } test(array(1,2,3), array(1,2,3)); diff --git a/ext/spl/tests/fileobject_001.phpt b/ext/spl/tests/fileobject_001.phpt index 7bd3e0c8bd..5c2240b3c5 100644 --- a/ext/spl/tests/fileobject_001.phpt +++ b/ext/spl/tests/fileobject_001.phpt @@ -27,7 +27,7 @@ var_dump($o->key()); echo "===A===\n"; foreach($o as $n => $l) { - var_dump($n, $l); + var_dump($n, $l); } echo "===B===\n"; @@ -35,7 +35,7 @@ $o = new SplFileObject(__DIR__ . '/fileobject_001b.txt'); $o->setFlags(SplFileObject::DROP_NEW_LINE); foreach($o as $n => $l) { - var_dump($n, $l); + var_dump($n, $l); } ?> diff --git a/ext/spl/tests/fileobject_002.phpt b/ext/spl/tests/fileobject_002.phpt index e8ecad609e..ba30caf23a 100644 --- a/ext/spl/tests/fileobject_002.phpt +++ b/ext/spl/tests/fileobject_002.phpt @@ -5,23 +5,23 @@ SPL: SplFileObject::fgetc function test($name) { - echo "===$name===\n"; + echo "===$name===\n"; - $o = new SplFileObject(__DIR__ . '/' . $name); + $o = new SplFileObject(__DIR__ . '/' . $name); - var_dump($o->key()); - while(($c = $o->fgetc()) !== false) - { + var_dump($o->key()); + while(($c = $o->fgetc()) !== false) + { // Kinda ugly but works around new lines mess if ($c === "\r") { continue; } - var_dump($o->key(), $c, $o->eof()); - } - echo "===EOF?===\n"; - var_dump($o->eof()); - var_dump($o->key()); - var_dump($o->eof()); + var_dump($o->key(), $c, $o->eof()); + } + echo "===EOF?===\n"; + var_dump($o->eof()); + var_dump($o->key()); + var_dump($o->eof()); } test('fileobject_001a.txt'); diff --git a/ext/spl/tests/fileobject_003.phpt b/ext/spl/tests/fileobject_003.phpt index 6c2751c89b..4f33065d42 100644 --- a/ext/spl/tests/fileobject_003.phpt +++ b/ext/spl/tests/fileobject_003.phpt @@ -5,40 +5,40 @@ SPL: SplFileInfo cloning function test($name, $lc, $lp) { - static $i = 0; - echo "===$i===\n"; - $i++; + static $i = 0; + echo "===$i===\n"; + $i++; - $o = new SplFileInfo($name); + $o = new SplFileInfo($name); - var_dump($o); - $c = clone $o; - var_dump($c); - var_dump($o === $c); - var_dump($o == $c); - var_dump($o->getPathname() == $c->getPathname()); + var_dump($o); + $c = clone $o; + var_dump($c); + var_dump($o === $c); + var_dump($o == $c); + var_dump($o->getPathname() == $c->getPathname()); - try { - $f = new SplFileObject($name); - var_dump($name); - var_dump($f->getPathName()); - $l = substr($f->getPathName(), -1); - var_dump($l != '/' && $l != '\\' && $l == $lc); - var_dump($f->getFileName()); - $l = substr($f->getFileName(), -1); - var_dump($l != '/' && $l != '\\' && $l == $lc); - var_dump($f->getPath()); - $l = substr($f->getPath(), -1); - var_dump($l != '/' && $l != '\\' && $l == $lp); - } catch (LogicException $e) { - echo "LogicException: ".$e->getMessage()."\n"; - } - try { - $fo = $o->openFile(); - var_dump($fo->getPathName(), $fo->getFileName(), $fo->getPath()); - } catch (LogicException $e) { - echo "LogicException: ".$e->getMessage()."\n"; - } + try { + $f = new SplFileObject($name); + var_dump($name); + var_dump($f->getPathName()); + $l = substr($f->getPathName(), -1); + var_dump($l != '/' && $l != '\\' && $l == $lc); + var_dump($f->getFileName()); + $l = substr($f->getFileName(), -1); + var_dump($l != '/' && $l != '\\' && $l == $lc); + var_dump($f->getPath()); + $l = substr($f->getPath(), -1); + var_dump($l != '/' && $l != '\\' && $l == $lp); + } catch (LogicException $e) { + echo "LogicException: ".$e->getMessage()."\n"; + } + try { + $fo = $o->openFile(); + var_dump($fo->getPathName(), $fo->getFileName(), $fo->getPath()); + } catch (LogicException $e) { + echo "LogicException: ".$e->getMessage()."\n"; + } } test(__DIR__ . '/' . 'fileobject_001a.txt', 't', substr(__DIR__,-1)); diff --git a/ext/spl/tests/filesystemiterator_flags.phpt b/ext/spl/tests/filesystemiterator_flags.phpt index c74129760c..1a8cce034e 100644 --- a/ext/spl/tests/filesystemiterator_flags.phpt +++ b/ext/spl/tests/filesystemiterator_flags.phpt @@ -9,19 +9,19 @@ $it = new FileSystemIterator("."); printflags($it); $it->setFlags(FileSystemIterator::CURRENT_AS_SELF | - FileSystemIterator::KEY_AS_FILENAME | - FileSystemIterator::SKIP_DOTS | - FileSystemIterator::UNIX_PATHS); + FileSystemIterator::KEY_AS_FILENAME | + FileSystemIterator::SKIP_DOTS | + FileSystemIterator::UNIX_PATHS); printflags($it); $it->setFlags(-1); printflags($it); function printflags($it) { - printf("%08X\n", $it->getFlags()); - printf("%08X\n", ($it->getFlags() & FileSystemIterator::CURRENT_MODE_MASK)); - printf("%08X\n", ($it->getFlags() & FileSystemIterator::KEY_MODE_MASK)); - printf("%08X\n", ($it->getFlags() & FileSystemIterator::OTHER_MODE_MASK)); + printf("%08X\n", $it->getFlags()); + printf("%08X\n", ($it->getFlags() & FileSystemIterator::CURRENT_MODE_MASK)); + printf("%08X\n", ($it->getFlags() & FileSystemIterator::KEY_MODE_MASK)); + printf("%08X\n", ($it->getFlags() & FileSystemIterator::OTHER_MODE_MASK)); } ?> diff --git a/ext/spl/tests/fixedarray_002.phpt b/ext/spl/tests/fixedarray_002.phpt index 27d25c0273..f111dd1bfc 100644 --- a/ext/spl/tests/fixedarray_002.phpt +++ b/ext/spl/tests/fixedarray_002.phpt @@ -3,8 +3,8 @@ SPL: FixedArray: overloading --FILE-- <?php class A extends SplFixedArray { - public $prop1 = NULL; - public $prop2 = NULL; + public $prop1 = NULL; + public $prop2 = NULL; public function count() { return 2; diff --git a/ext/spl/tests/fixedarray_003.phpt b/ext/spl/tests/fixedarray_003.phpt index a4c313cd84..d2f8a78fdf 100644 --- a/ext/spl/tests/fixedarray_003.phpt +++ b/ext/spl/tests/fixedarray_003.phpt @@ -3,8 +3,8 @@ SPL: FixedArray: Iterators --FILE-- <?php class A extends SplFixedArray { - public $prop1 = "dummy"; - public $prop2 = "dummy"; + public $prop1 = "dummy"; + public $prop2 = "dummy"; public function current() { echo "A::current\n"; diff --git a/ext/spl/tests/fixedarray_004.phpt b/ext/spl/tests/fixedarray_004.phpt index c7c37426b5..054fb3d9b5 100644 --- a/ext/spl/tests/fixedarray_004.phpt +++ b/ext/spl/tests/fixedarray_004.phpt @@ -6,9 +6,9 @@ SPL: FixedArray: adding new elements $a = new SplFixedArray(10); try { - $a[] = 1; + $a[] = 1; } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> diff --git a/ext/spl/tests/fixedarray_005.phpt b/ext/spl/tests/fixedarray_005.phpt index 274fc34245..7295a317ab 100644 --- a/ext/spl/tests/fixedarray_005.phpt +++ b/ext/spl/tests/fixedarray_005.phpt @@ -4,21 +4,21 @@ SPL: FixedArray: Invalid arguments <?php try { - $a = new SplFixedArray(new stdClass); + $a = new SplFixedArray(new stdClass); } catch (TypeError $iae) { - echo "Ok - ".$iae->getMessage().PHP_EOL; + echo "Ok - ".$iae->getMessage().PHP_EOL; } try { - $a = new SplFixedArray('FOO'); + $a = new SplFixedArray('FOO'); } catch (TypeError $iae) { - echo "Ok - ".$iae->getMessage().PHP_EOL; + echo "Ok - ".$iae->getMessage().PHP_EOL; } try { - $a = new SplFixedArray(''); + $a = new SplFixedArray(''); } catch (TypeError $iae) { - echo "Ok - ".$iae->getMessage().PHP_EOL; + echo "Ok - ".$iae->getMessage().PHP_EOL; } ?> diff --git a/ext/spl/tests/fixedarray_006.phpt b/ext/spl/tests/fixedarray_006.phpt index 8641821ae3..2e762467c4 100644 --- a/ext/spl/tests/fixedarray_006.phpt +++ b/ext/spl/tests/fixedarray_006.phpt @@ -7,11 +7,11 @@ $b = 10000; $a = new SplFixedArray($b); try { - for ($i = 0; $i < 100; $i++) { - $a[] = new stdClass; - } + for ($i = 0; $i < 100; $i++) { + $a[] = new stdClass; + } } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } print "ok\n"; diff --git a/ext/spl/tests/fixedarray_007.phpt b/ext/spl/tests/fixedarray_007.phpt index 308ce315a5..65b4dad90e 100644 --- a/ext/spl/tests/fixedarray_007.phpt +++ b/ext/spl/tests/fixedarray_007.phpt @@ -7,15 +7,15 @@ $b = 10; $a = new SplFixedArray($b); try { - $a[1] = $a; + $a[1] = $a; } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } foreach ($a as $c) { - if ($c) { - echo $c->getSize(), "\n"; - } + if ($c) { + echo $c->getSize(), "\n"; + } } print "ok\n"; diff --git a/ext/spl/tests/fixedarray_008.phpt b/ext/spl/tests/fixedarray_008.phpt index 6d9c9cbf09..8bac0824d1 100644 --- a/ext/spl/tests/fixedarray_008.phpt +++ b/ext/spl/tests/fixedarray_008.phpt @@ -13,11 +13,11 @@ $a[2] = $a; $a[2][0] = 3; foreach ($a as $x) { - if (is_object($x)) { - var_dump($x[0]); - } else { - var_dump($x); - } + if (is_object($x)) { + var_dump($x[0]); + } else { + var_dump($x); + } } var_dump($a->getSize()); diff --git a/ext/spl/tests/fixedarray_009.phpt b/ext/spl/tests/fixedarray_009.phpt index b885fe9957..71d6a42a6f 100644 --- a/ext/spl/tests/fixedarray_009.phpt +++ b/ext/spl/tests/fixedarray_009.phpt @@ -4,9 +4,9 @@ SPL: FixedArray: Trying to instantiate passing string to constructor parameter <?php try { - $a = new SplFixedArray('FOO'); + $a = new SplFixedArray('FOO'); } catch (TypeError $iae) { - echo "Ok - ".$iae->getMessage().PHP_EOL; + echo "Ok - ".$iae->getMessage().PHP_EOL; } ?> --EXPECT-- diff --git a/ext/spl/tests/fixedarray_012.phpt b/ext/spl/tests/fixedarray_012.phpt index 3461b3a9b5..df725aad46 100644 --- a/ext/spl/tests/fixedarray_012.phpt +++ b/ext/spl/tests/fixedarray_012.phpt @@ -6,9 +6,9 @@ SPL: FixedArray: Assigning the object to another variable using [] $a = new SplFixedArray(100); try { - $b = &$a[]; + $b = &$a[]; } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } print "ok\n"; diff --git a/ext/spl/tests/fixedarray_013.phpt b/ext/spl/tests/fixedarray_013.phpt index 52ae3c161e..cf43b3c7e7 100644 --- a/ext/spl/tests/fixedarray_013.phpt +++ b/ext/spl/tests/fixedarray_013.phpt @@ -7,13 +7,13 @@ $a = new SplFixedArray(100); function test(SplFixedArray &$arr) { - print "ok\n"; + print "ok\n"; } try { - test($a[]); + test($a[]); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } ?> diff --git a/ext/spl/tests/fixedarray_014.phpt b/ext/spl/tests/fixedarray_014.phpt index de8e214dc0..a6f2fc188c 100644 --- a/ext/spl/tests/fixedarray_014.phpt +++ b/ext/spl/tests/fixedarray_014.phpt @@ -4,10 +4,10 @@ SPL: FixedArray: Trying to access inexistent item <?php try { - $a = new SplFixedArray(NULL); - echo $a[0]++; + $a = new SplFixedArray(NULL); + echo $a[0]++; } catch (Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/spl/tests/fixedarray_015.phpt b/ext/spl/tests/fixedarray_015.phpt index 3fedd35090..2a2d5a26f7 100644 --- a/ext/spl/tests/fixedarray_015.phpt +++ b/ext/spl/tests/fixedarray_015.phpt @@ -4,9 +4,9 @@ SPL: FixedArray: accessing uninitialized array <?php try { - $a = new SplFixedArray(''); + $a = new SplFixedArray(''); } catch (TypeError $iae) { - echo "Ok - ".$iae->getMessage().PHP_EOL; + echo "Ok - ".$iae->getMessage().PHP_EOL; } echo "Done\n"; diff --git a/ext/spl/tests/fixedarray_021.phpt b/ext/spl/tests/fixedarray_021.phpt index 813de176c8..db4962ef48 100644 --- a/ext/spl/tests/fixedarray_021.phpt +++ b/ext/spl/tests/fixedarray_021.phpt @@ -11,17 +11,17 @@ var_dump($a->count()); /* negative init value */ try { - $b = new SplFixedArray(-10); + $b = new SplFixedArray(-10); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } /* resize and negative value */ $b = new SplFixedArray(); try { - $b->setSize(-5); + $b->setSize(-5); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } /* calling __construct() twice */ @@ -43,11 +43,11 @@ $e[1] = 5; $e[2] = 10; try { - foreach ($e as $k=>&$v) { - var_dump($v); - } + foreach ($e as $k=>&$v) { + var_dump($v); + } } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } //non-long indexes diff --git a/ext/spl/tests/heap_corruption.phpt b/ext/spl/tests/heap_corruption.phpt index 47e8d008c0..9b14a0fe0b 100644 --- a/ext/spl/tests/heap_corruption.phpt +++ b/ext/spl/tests/heap_corruption.phpt @@ -8,30 +8,30 @@ Mike Sullivan <mikesul@php.net> class myHeap extends SplHeap { - public $allow_compare = true; + public $allow_compare = true; - public function compare($v1, $v2) - { - if ($this->allow_compare == true) - { - if ($v1 > $v2) - { - return 1; - } - else if ($v1 < $v2) - { - return -1; - } - else - { - return 0; - } - } - else - { - throw new Exception('Compare exception'); - } - } + public function compare($v1, $v2) + { + if ($this->allow_compare == true) + { + if ($v1 > $v2) + { + return 1; + } + else if ($v1 < $v2) + { + return -1; + } + else + { + return 0; + } + } + else + { + throw new Exception('Compare exception'); + } + } } $heap = new myHeap(); @@ -45,17 +45,17 @@ $heap->allow_compare = false; var_dump($heap->isCorrupted()); try { - $heap->extract(); + $heap->extract(); } catch (Exception $e) { - echo "Compare Exception: " . $e->getMessage() . PHP_EOL; + echo "Compare Exception: " . $e->getMessage() . PHP_EOL; } try { - $heap->top(); + $heap->top(); } catch (Exception $e) { - echo "Corruption Exception: " . $e->getMessage() . PHP_EOL; + echo "Corruption Exception: " . $e->getMessage() . PHP_EOL; } var_dump($heap->isCorrupted()); diff --git a/ext/spl/tests/heap_current_variation_001.phpt b/ext/spl/tests/heap_current_variation_001.phpt index f67eb428c3..a55bb486e9 100644 --- a/ext/spl/tests/heap_current_variation_001.phpt +++ b/ext/spl/tests/heap_current_variation_001.phpt @@ -8,10 +8,10 @@ Mike Sullivan <mikesul@php.net> class myHeap extends SplHeap { - public function compare($v1, $v2) - { - throw new Exception(''); - } + public function compare($v1, $v2) + { + throw new Exception(''); + } } $heap = new myHeap(); diff --git a/ext/spl/tests/heap_top_variation_002.phpt b/ext/spl/tests/heap_top_variation_002.phpt index 4d6bdd593a..add363eab3 100644 --- a/ext/spl/tests/heap_top_variation_002.phpt +++ b/ext/spl/tests/heap_top_variation_002.phpt @@ -7,9 +7,9 @@ TestFest London May 2009 <?php // override heap to force corruption by throwing exception in compare class SplMinHeap2 extends SplMinHeap { - public function compare($a, $b) { - throw new Exception('Corrupt heap'); - } + public function compare($a, $b) { + throw new Exception('Corrupt heap'); + } } $h = new SplMinHeap2(); @@ -17,14 +17,14 @@ $h = new SplMinHeap2(); // insert 2 elements to hit our overridden compare $h->insert(4); try { - $h->insert(5); + $h->insert(5); } catch (Exception $e) {} // call top, should fail with corrupted heap try { - $h->top(); + $h->top(); } catch (Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> --EXPECT-- diff --git a/ext/spl/tests/heap_top_variation_003.phpt b/ext/spl/tests/heap_top_variation_003.phpt index c2ea2bcd95..40d70c5966 100644 --- a/ext/spl/tests/heap_top_variation_003.phpt +++ b/ext/spl/tests/heap_top_variation_003.phpt @@ -7,9 +7,9 @@ TestFest London May 2009 <?php $h = new SplMinHeap(); try { - $h->top(); + $h->top(); } catch (Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> --EXPECT-- diff --git a/ext/spl/tests/iterator_001.phpt b/ext/spl/tests/iterator_001.phpt index e87d49f140..c8151533a8 100644 --- a/ext/spl/tests/iterator_001.phpt +++ b/ext/spl/tests/iterator_001.phpt @@ -5,69 +5,69 @@ SPL: Iterator aggregating inner iterator's methods class NumericArrayIterator implements Iterator { - protected $a; - protected $i = 0; + protected $a; + protected $i = 0; - public function __construct($a) - { - echo __METHOD__ . "\n"; - $this->a = $a; - } + public function __construct($a) + { + echo __METHOD__ . "\n"; + $this->a = $a; + } - public function rewind() - { - echo __METHOD__ . "\n"; - $this->i = 0; - } + public function rewind() + { + echo __METHOD__ . "\n"; + $this->i = 0; + } - public function valid() - { - $ret = $this->i < count($this->a); - echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n"; - return $ret; - } + public function valid() + { + $ret = $this->i < count($this->a); + echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n"; + return $ret; + } - public function key() - { - echo __METHOD__ . "\n"; - return $this->i; - } + public function key() + { + echo __METHOD__ . "\n"; + return $this->i; + } - public function current() - { - echo __METHOD__ . "\n"; - return $this->a[$this->i]; - } + public function current() + { + echo __METHOD__ . "\n"; + return $this->a[$this->i]; + } - public function next() - { - echo __METHOD__ . "\n"; - $this->i++; - } + public function next() + { + echo __METHOD__ . "\n"; + $this->i++; + } - public function greaterThan($comp) - { - echo get_class($this) . '::' . __FUNCTION__ . '(' . $comp . ")\n"; - return $this->current() > $comp; - } + public function greaterThan($comp) + { + echo get_class($this) . '::' . __FUNCTION__ . '(' . $comp . ")\n"; + return $this->current() > $comp; + } } class SeekableNumericArrayIterator extends NumericArrayIterator implements SeekableIterator { - public function seek($index) - { - if ($index < count($this->a)) { - $this->i = $index; - } - echo __METHOD__ . '(' . $index . ")\n"; - } + public function seek($index) + { + if ($index < count($this->a)) { + $this->i = $index; + } + echo __METHOD__ . '(' . $index . ")\n"; + } } $a = array(1, 2, 3, 4, 5); $it = new LimitIterator(new NumericArrayIterator($a), 1, 3); foreach ($it as $v) { - print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n"; + print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n"; } echo "===SEEKABLE===\n"; @@ -75,7 +75,7 @@ $a = array(1, 2, 3, 4, 5); $it = new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3); foreach($it as $v) { - print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n"; + print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n"; } echo "===STACKED===\n"; @@ -84,7 +84,7 @@ $a = array(1, 2, 3, 4, 5); $it = new CachingIterator(new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3)); foreach($it as $v) { - print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n"; + print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n"; } ?> diff --git a/ext/spl/tests/iterator_002.phpt b/ext/spl/tests/iterator_002.phpt index 44943d6438..da790988fc 100644 --- a/ext/spl/tests/iterator_002.phpt +++ b/ext/spl/tests/iterator_002.phpt @@ -5,33 +5,33 @@ SPL: Iterator using getInnerIterator class RecursiceArrayIterator extends ArrayIterator implements RecursiveIterator { - function hasChildren() - { - return is_array($this->current()); - } - - function getChildren() - { - return new RecursiceArrayIterator($this->current()); - } + function hasChildren() + { + return is_array($this->current()); + } + + function getChildren() + { + return new RecursiceArrayIterator($this->current()); + } } class CrashIterator extends FilterIterator implements RecursiveIterator { - function accept() - { - return true; - } - - function hasChildren() - { - return $this->getInnerIterator()->hasChildren(); - } - - function getChildren() - { - return new RecursiceArrayIterator($this->getInnerIterator()->current()); - } + function accept() + { + return true; + } + + function hasChildren() + { + return $this->getInnerIterator()->hasChildren(); + } + + function getChildren() + { + return new RecursiceArrayIterator($this->getInnerIterator()->current()); + } } $array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3); @@ -39,7 +39,7 @@ $array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3); $dir = new RecursiveIteratorIterator(new CrashIterator(new RecursiceArrayIterator($array)), RecursiveIteratorIterator::LEAVES_ONLY); foreach ($dir as $file) { - print "$file\n"; + print "$file\n"; } ?> diff --git a/ext/spl/tests/iterator_003.phpt b/ext/spl/tests/iterator_003.phpt index e2a4246075..b7b331a496 100644 --- a/ext/spl/tests/iterator_003.phpt +++ b/ext/spl/tests/iterator_003.phpt @@ -5,73 +5,73 @@ SPL: CachingIterator and __toString() class Student { - private $id; - private $name; + private $id; + private $name; public function __construct($id, $name) { - $this->id = $id; - $this->name = $name; + $this->id = $id; + $this->name = $name; } - public function __toString() - { - return $this->id . ', ' . $this->name; - } + public function __toString() + { + return $this->id . ', ' . $this->name; + } - public function getId() - { - return $this->id; - } + public function getId() + { + return $this->id; + } } class StudentIdFilter extends FilterIterator { - private $id; + private $id; - public function __construct(ArrayObject $students, Student $other) - { - FilterIterator::__construct($students->getIterator()); - $this->id = $other->getId(); - } + public function __construct(ArrayObject $students, Student $other) + { + FilterIterator::__construct($students->getIterator()); + $this->id = $other->getId(); + } - public function accept() - { - echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n"; - return $this->current()->getId() == $this->id; - } + public function accept() + { + echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n"; + return $this->current()->getId() == $this->id; + } } class StudentList implements IteratorAggregate { - private $students; + private $students; - public function __construct() - { - $this->students = new ArrayObject(array()); - } + public function __construct() + { + $this->students = new ArrayObject(array()); + } - public function add(Student $student) - { - if (!$this->contains($student)) { - $this->students[] = $student; - } - } + public function add(Student $student) + { + if (!$this->contains($student)) { + $this->students[] = $student; + } + } - public function contains(Student $student) - { - foreach ($this->students as $s) - { - if ($s->getId() == $student->getId()) { - return true; - } - } - return false; - } + public function contains(Student $student) + { + foreach ($this->students as $s) + { + if ($s->getId() == $student->getId()) { + return true; + } + } + return false; + } - public function getIterator() { - return new CachingIterator($this->students->getIterator(), true); - } + public function getIterator() { + return new CachingIterator($this->students->getIterator(), true); + } } $students = new StudentList(); @@ -84,7 +84,7 @@ $students->add(new Student('00000014', 'Foo')); // iterator's __toString() method. $it = $students->getIterator(); foreach ($it as $student) { - echo $it->__toString(), "\n"; + echo $it->__toString(), "\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/iterator_004.phpt b/ext/spl/tests/iterator_004.phpt index 17c03c8650..d131593ad2 100644 --- a/ext/spl/tests/iterator_004.phpt +++ b/ext/spl/tests/iterator_004.phpt @@ -5,69 +5,69 @@ SPL: SeekableIterator and string keys class NumericArrayIterator implements Iterator { - protected $a; - protected $i; + protected $a; + protected $i; - public function __construct($a) - { - echo __METHOD__ . "\n"; - $this->a = $a; - } + public function __construct($a) + { + echo __METHOD__ . "\n"; + $this->a = $a; + } - public function rewind() - { - echo __METHOD__ . "\n"; - $this->i = 0; - } + public function rewind() + { + echo __METHOD__ . "\n"; + $this->i = 0; + } - public function valid() - { - $ret = $this->i < count($this->a); - echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n"; - return $ret; - } + public function valid() + { + $ret = $this->i < count($this->a); + echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n"; + return $ret; + } - public function key() - { - echo __METHOD__ . "\n"; - return $this->i; - } + public function key() + { + echo __METHOD__ . "\n"; + return $this->i; + } - public function current() - { - echo __METHOD__ . "\n"; - return $this->a[$this->i]; - } + public function current() + { + echo __METHOD__ . "\n"; + return $this->a[$this->i]; + } - public function next() - { - echo __METHOD__ . "\n"; - $this->i++; - } + public function next() + { + echo __METHOD__ . "\n"; + $this->i++; + } } class SeekableNumericArrayIterator extends NumericArrayIterator implements SeekableIterator { - public function seek($index) - { - if ($index < count($this->a)) { - $this->i = $index; - } - echo __METHOD__ . '(' . $index . ")\n"; - } + public function seek($index) + { + if ($index < count($this->a)) { + $this->i = $index; + } + echo __METHOD__ . '(' . $index . ")\n"; + } } $a = array(1, 2, 3, 4, 5); foreach (new LimitIterator(new NumericArrayIterator($a), 1, 3) as $v) { - print "$v\n"; + print "$v\n"; } echo "===SEEKABLE===\n"; $a = array(1, 2, 3, 4, 5); foreach(new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3) as $v) { - print "$v\n"; + print "$v\n"; } echo "===SEEKING===\n"; @@ -75,8 +75,8 @@ $a = array(1, 2, 3, 4, 5); $l = new LimitIterator(new SeekableNumericArrayIterator($a)); for($i = 1; $i < 4; $i++) { - $l->seek($i); - print $l->current() . "\n"; + $l->seek($i); + print $l->current() . "\n"; } ?> diff --git a/ext/spl/tests/iterator_005.phpt b/ext/spl/tests/iterator_005.phpt index 8f8d11e311..9f13889a18 100644 --- a/ext/spl/tests/iterator_005.phpt +++ b/ext/spl/tests/iterator_005.phpt @@ -5,34 +5,34 @@ SPL: IteratorIterator and ArrayIterator/Object class ArrayIteratorEx extends ArrayIterator { - function rewind() - { - echo __METHOD__ . "\n"; - return parent::rewind(); - } + function rewind() + { + echo __METHOD__ . "\n"; + return parent::rewind(); + } } $it = new ArrayIteratorEx(range(0,3)); foreach(new IteratorIterator($it) as $v) { - var_dump($v); + var_dump($v); } class ArrayObjectEx extends ArrayObject { - function getIterator() - { - echo __METHOD__ . "\n"; - return parent::getIterator(); - } + function getIterator() + { + echo __METHOD__ . "\n"; + return parent::getIterator(); + } } $it = new ArrayObjectEx(range(0,3)); foreach(new IteratorIterator($it) as $v) { - var_dump($v); + var_dump($v); } ?> diff --git a/ext/spl/tests/iterator_006.phpt b/ext/spl/tests/iterator_006.phpt index 667c3cee12..78c597a795 100644 --- a/ext/spl/tests/iterator_006.phpt +++ b/ext/spl/tests/iterator_006.phpt @@ -13,7 +13,7 @@ $root = simplexml_load_string('<?xml version="1.0"?> '); foreach (new IteratorIterator($root->child) as $child) { - echo $child."\n"; + echo $child."\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/iterator_007.phpt b/ext/spl/tests/iterator_007.phpt index 4f63585d70..8fb503c79a 100644 --- a/ext/spl/tests/iterator_007.phpt +++ b/ext/spl/tests/iterator_007.phpt @@ -5,72 +5,72 @@ SPL: NoRewindIterator class ArrayIteratorEx extends ArrayIterator { - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } + function rewind() + { + echo __METHOD__ . "\n"; + parent::rewind(); + } + function valid() + { + echo __METHOD__ . "\n"; + return parent::valid(); + } + function current() + { + echo __METHOD__ . "\n"; + return parent::current(); + } + function key() + { + echo __METHOD__ . "\n"; + return parent::key(); + } + function next() + { + echo __METHOD__ . "\n"; + parent::next(); + } } class NoRewindIteratorEx extends NoRewindIterator { - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } + function rewind() + { + echo __METHOD__ . "\n"; + parent::rewind(); + } + function valid() + { + echo __METHOD__ . "\n"; + return parent::valid(); + } + function current() + { + echo __METHOD__ . "\n"; + return parent::current(); + } + function key() + { + echo __METHOD__ . "\n"; + return parent::key(); + } + function next() + { + echo __METHOD__ . "\n"; + parent::next(); + } } $it = new NoRewindIteratorEx(new ArrayIteratorEx(range(0,3))); echo "===0===\n"; foreach ($it->getInnerIterator() as $v) { - var_dump($v); + var_dump($v); } echo "===1===\n"; foreach ($it as $v) { - var_dump($v); + var_dump($v); } $pos =0; @@ -79,20 +79,20 @@ $it = new NoRewindIteratorEx(new ArrayIteratorEx(range(0,3))); echo "===2===\n"; foreach ($it as $v) { - var_dump($v); - if ($pos++ > 1) { - break; - } + var_dump($v); + if ($pos++ > 1) { + break; + } } echo "===3===\n"; foreach ($it as $v) { - var_dump($v); + var_dump($v); } echo "===4===\n"; foreach ($it as $v) { - var_dump($v); + var_dump($v); } ?> --EXPECT-- diff --git a/ext/spl/tests/iterator_008.phpt b/ext/spl/tests/iterator_008.phpt index 0d6290f504..19c6038e3c 100644 --- a/ext/spl/tests/iterator_008.phpt +++ b/ext/spl/tests/iterator_008.phpt @@ -5,31 +5,31 @@ SPL: InfiniteIterator class ArrayIteratorEx extends ArrayIterator { - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } + function rewind() + { + echo __METHOD__ . "\n"; + parent::rewind(); + } + function valid() + { + echo __METHOD__ . "\n"; + return parent::valid(); + } + function current() + { + echo __METHOD__ . "\n"; + return parent::current(); + } + function key() + { + echo __METHOD__ . "\n"; + return parent::key(); + } + function next() + { + echo __METHOD__ . "\n"; + parent::next(); + } } $it = new InfiniteIterator(new ArrayIteratorEx(range(0,2))); @@ -37,10 +37,10 @@ $it = new InfiniteIterator(new ArrayIteratorEx(range(0,2))); $pos =0; foreach ($it as $v) { - var_dump($v); - if ($pos++ > 5) { - break; - } + var_dump($v); + if ($pos++ > 5) { + break; + } } ?> diff --git a/ext/spl/tests/iterator_009.phpt b/ext/spl/tests/iterator_009.phpt index 78213b6224..19447deac4 100644 --- a/ext/spl/tests/iterator_009.phpt +++ b/ext/spl/tests/iterator_009.phpt @@ -5,35 +5,35 @@ SPL: EmptyIterator class EmptyIteratorEx extends EmptyIterator { - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } + function rewind() + { + echo __METHOD__ . "\n"; + parent::rewind(); + } + function valid() + { + echo __METHOD__ . "\n"; + return parent::valid(); + } + function current() + { + echo __METHOD__ . "\n"; + return parent::current(); + } + function key() + { + echo __METHOD__ . "\n"; + return parent::key(); + } + function next() + { + echo __METHOD__ . "\n"; + parent::next(); + } } foreach (new EmptyIteratorEx() as $v) { - var_dump($v); + var_dump($v); } ?> diff --git a/ext/spl/tests/iterator_010.phpt b/ext/spl/tests/iterator_010.phpt index 15c79f8d40..17e901f0c1 100644 --- a/ext/spl/tests/iterator_010.phpt +++ b/ext/spl/tests/iterator_010.phpt @@ -7,7 +7,7 @@ echo "===EmptyIterator===\n"; foreach(new LimitIterator(new EmptyIterator(), 0, 3) as $key => $val) { - echo "$key=>$val\n"; + echo "$key=>$val\n"; } ?> diff --git a/ext/spl/tests/iterator_011.phpt b/ext/spl/tests/iterator_011.phpt index 3b703b79bd..5d814ce1f7 100644 --- a/ext/spl/tests/iterator_011.phpt +++ b/ext/spl/tests/iterator_011.phpt @@ -7,7 +7,7 @@ echo "===EmptyIterator===\n"; foreach(new LimitIterator(new InfiniteIterator(new EmptyIterator()), 0, 3) as $key=>$val) { - echo "$key=>$val\n"; + echo "$key=>$val\n"; } echo "===InfiniteIterator===\n"; @@ -17,7 +17,7 @@ $it = new InfiniteIterator($it); $it = new LimitIterator($it, 2, 5); foreach($it as $val=>$key) { - echo "$val=>$key\n"; + echo "$val=>$key\n"; } echo "===Infinite/LimitIterator===\n"; @@ -28,7 +28,7 @@ $it = new InfiniteIterator($it); $it = new LimitIterator($it, 2, 5); foreach($it as $val=>$key) { - echo "$val=>$key\n"; + echo "$val=>$key\n"; } ?> diff --git a/ext/spl/tests/iterator_012.phpt b/ext/spl/tests/iterator_012.phpt index f00cac697e..733dc10a12 100644 --- a/ext/spl/tests/iterator_012.phpt +++ b/ext/spl/tests/iterator_012.phpt @@ -17,7 +17,7 @@ echo "===Foreach===\n"; foreach($it as $key=>$val) { - echo "$key=>$val\n"; + echo "$key=>$val\n"; } ?> diff --git a/ext/spl/tests/iterator_013.phpt b/ext/spl/tests/iterator_013.phpt index edc8ea75ed..daab33ab7e 100644 --- a/ext/spl/tests/iterator_013.phpt +++ b/ext/spl/tests/iterator_013.phpt @@ -9,7 +9,7 @@ $it = new AppendIterator; foreach($it as $key=>$val) { - echo "$key=>$val\n"; + echo "$key=>$val\n"; } echo "===Append===\n"; @@ -18,14 +18,14 @@ $it->append(new ArrayIterator(array(0 => 'A', 1 => 'B'))); foreach($it as $key=>$val) { - echo "$key=>$val\n"; + echo "$key=>$val\n"; } echo "===Rewind===\n"; foreach($it as $key=>$val) { - echo "$key=>$val\n"; + echo "$key=>$val\n"; } echo "===Append===\n"; @@ -34,14 +34,14 @@ $it->append(new ArrayIterator(array(2 => 'C', 3 => 'D'))); foreach(new NoRewindIterator($it) as $key=>$val) { - echo "$key=>$val\n"; + echo "$key=>$val\n"; } echo "===Rewind===\n"; foreach($it as $key=>$val) { - echo "$key=>$val\n"; + echo "$key=>$val\n"; } ?> diff --git a/ext/spl/tests/iterator_014.phpt b/ext/spl/tests/iterator_014.phpt index bbcacba51f..363b2916fe 100644 --- a/ext/spl/tests/iterator_014.phpt +++ b/ext/spl/tests/iterator_014.phpt @@ -5,72 +5,72 @@ SPL: RecursiveIteratorIterator and beginChildren/endChildren class MyRecursiveArrayIterator extends RecursiveArrayIterator { - function valid() - { - if (!parent::valid()) - { - echo __METHOD__ . " = false\n"; - return false; - } - else - { - return true; - } - } + function valid() + { + if (!parent::valid()) + { + echo __METHOD__ . " = false\n"; + return false; + } + else + { + return true; + } + } - function getChildren() - { - echo __METHOD__ . "\n"; - return parent::getChildren(); - } + function getChildren() + { + echo __METHOD__ . "\n"; + return parent::getChildren(); + } } class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator { - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } + function rewind() + { + echo __METHOD__ . "\n"; + parent::rewind(); + } - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } + function valid() + { + echo __METHOD__ . "\n"; + return parent::valid(); + } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } + function current() + { + echo __METHOD__ . "\n"; + return parent::current(); + } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } + function key() + { + echo __METHOD__ . "\n"; + return parent::key(); + } - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } + function next() + { + echo __METHOD__ . "\n"; + parent::next(); + } - function beginChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } + function beginChildren() + { + echo __METHOD__ . "(".$this->getDepth().")\n"; + } - function endChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } + function endChildren() + { + echo __METHOD__ . "(".$this->getDepth().")\n"; + } } foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d"))) as $k=>$v) { - echo "$k=>$v\n"; + echo "$k=>$v\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/iterator_015.phpt b/ext/spl/tests/iterator_015.phpt index ea507143f8..f83366bb1c 100644 --- a/ext/spl/tests/iterator_015.phpt +++ b/ext/spl/tests/iterator_015.phpt @@ -5,28 +5,28 @@ SPL: RecursiveIteratorIterator and beginChildren/endChildren class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator { - function rewind() - { - echo "<ul>\n"; - parent::rewind(); - } - function beginChildren() - { - echo str_repeat(' ',$this->getDepth())."<ul>\n"; - } + function rewind() + { + echo "<ul>\n"; + parent::rewind(); + } + function beginChildren() + { + echo str_repeat(' ',$this->getDepth())."<ul>\n"; + } - function endChildren() - { - echo str_repeat(' ',$this->getDepth())."</ul>\n"; - } - function valid() - { - if (!parent::valid()) { - echo "<ul>\n"; - return false; - } - return true; - } + function endChildren() + { + echo str_repeat(' ',$this->getDepth())."</ul>\n"; + } + function valid() + { + if (!parent::valid()) { + echo "<ul>\n"; + return false; + } + return true; + } } $arr = array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d"); @@ -34,7 +34,7 @@ $obj = new RecursiveArrayIterator($arr); $rit = new RecursiveArrayIteratorIterator($obj); foreach($rit as $k=>$v) { - echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n"; + echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/iterator_016.phpt b/ext/spl/tests/iterator_016.phpt index 95ffcdfc19..966c05d989 100644 --- a/ext/spl/tests/iterator_016.phpt +++ b/ext/spl/tests/iterator_016.phpt @@ -5,41 +5,41 @@ SPL: RecursiveIteratorIterator and beginChildren/endChildren class Menu extends ArrayObject { - function getIterator() - { - echo __METHOD__ . "\n"; - return new RecursiveArrayIterator($this); - } + function getIterator() + { + echo __METHOD__ . "\n"; + return new RecursiveArrayIterator($this); + } } class MenuOutput extends RecursiveIteratorIterator { - function __construct(Menu $it) - { - parent::__construct($it); - } - function rewind() - { - echo "<ul>\n"; - parent::rewind(); - } - function beginChildren() - { - echo str_repeat(' ',$this->getDepth())."<ul>\n"; - } + function __construct(Menu $it) + { + parent::__construct($it); + } + function rewind() + { + echo "<ul>\n"; + parent::rewind(); + } + function beginChildren() + { + echo str_repeat(' ',$this->getDepth())."<ul>\n"; + } - function endChildren() - { - echo str_repeat(' ',$this->getDepth())."</ul>\n"; - } - function valid() - { - if (!parent::valid()) { - echo "<ul>\n"; - return false; - } - return true; - } + function endChildren() + { + echo str_repeat(' ',$this->getDepth())."</ul>\n"; + } + function valid() + { + if (!parent::valid()) { + echo "<ul>\n"; + return false; + } + return true; + } } $arr = array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d"); @@ -47,7 +47,7 @@ $obj = new Menu($arr); $rit = new MenuOutput($obj); foreach($rit as $k=>$v) { - echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n"; + echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/iterator_018.phpt b/ext/spl/tests/iterator_018.phpt index 3b703b79bd..5d814ce1f7 100644 --- a/ext/spl/tests/iterator_018.phpt +++ b/ext/spl/tests/iterator_018.phpt @@ -7,7 +7,7 @@ echo "===EmptyIterator===\n"; foreach(new LimitIterator(new InfiniteIterator(new EmptyIterator()), 0, 3) as $key=>$val) { - echo "$key=>$val\n"; + echo "$key=>$val\n"; } echo "===InfiniteIterator===\n"; @@ -17,7 +17,7 @@ $it = new InfiniteIterator($it); $it = new LimitIterator($it, 2, 5); foreach($it as $val=>$key) { - echo "$val=>$key\n"; + echo "$val=>$key\n"; } echo "===Infinite/LimitIterator===\n"; @@ -28,7 +28,7 @@ $it = new InfiniteIterator($it); $it = new LimitIterator($it, 2, 5); foreach($it as $val=>$key) { - echo "$val=>$key\n"; + echo "$val=>$key\n"; } ?> diff --git a/ext/spl/tests/iterator_021.phpt b/ext/spl/tests/iterator_021.phpt index 343dc41140..433ced95e7 100644 --- a/ext/spl/tests/iterator_021.phpt +++ b/ext/spl/tests/iterator_021.phpt @@ -5,105 +5,105 @@ SPL: RecursiveIteratorIterator and hasChildren class MyRecursiveArrayIterator extends RecursiveArrayIterator { - function valid() - { - if (!parent::valid()) - { - echo __METHOD__ . " = false\n"; - return false; - } - else - { - return true; - } - } + function valid() + { + if (!parent::valid()) + { + echo __METHOD__ . " = false\n"; + return false; + } + else + { + return true; + } + } - function getChildren() - { - echo __METHOD__ . "\n"; - return parent::getChildren(); - } + function getChildren() + { + echo __METHOD__ . "\n"; + return parent::getChildren(); + } } class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator { - private $max_depth; - private $over = 0; - private $skip = false; + private $max_depth; + private $over = 0; + private $skip = false; - function __construct($it, $max_depth) - { - $this->max_depth = $max_depth; - parent::__construct($it); - } + function __construct($it, $max_depth) + { + $this->max_depth = $max_depth; + parent::__construct($it); + } - function rewind() - { - echo __METHOD__ . "\n"; - $this->skip = false; - parent::rewind(); - } + function rewind() + { + echo __METHOD__ . "\n"; + $this->skip = false; + parent::rewind(); + } - function valid() - { - echo __METHOD__ . "\n"; - if ($this->skip) - { - $this->skip = false; - $this->next(); - } - return parent::valid(); - } + function valid() + { + echo __METHOD__ . "\n"; + if ($this->skip) + { + $this->skip = false; + $this->next(); + } + return parent::valid(); + } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } + function current() + { + echo __METHOD__ . "\n"; + return parent::current(); + } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } + function key() + { + echo __METHOD__ . "\n"; + return parent::key(); + } - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } + function next() + { + echo __METHOD__ . "\n"; + parent::next(); + } - function callHasChildren() - { - $this->skip = false; - $has = parent::callHasChildren(); - $res = $this->getDepth() < $this->max_depth && $has; - echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n"; - if ($has && !$res) - { - $this->over++; - if ($this->over == 2) { - $this->skip = true; - } - } - return $res; - } + function callHasChildren() + { + $this->skip = false; + $has = parent::callHasChildren(); + $res = $this->getDepth() < $this->max_depth && $has; + echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n"; + if ($has && !$res) + { + $this->over++; + if ($this->over == 2) { + $this->skip = true; + } + } + return $res; + } - function beginChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } + function beginChildren() + { + echo __METHOD__ . "(".$this->getDepth().")\n"; + } - function endChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } + function endChildren() + { + echo __METHOD__ . "(".$this->getDepth().")\n"; + } } foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v) { - if (is_array($v)) $v = join('',$v); - echo "$k=>$v\n"; + if (is_array($v)) $v = join('',$v); + echo "$k=>$v\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/iterator_022.phpt b/ext/spl/tests/iterator_022.phpt index 3ff52a101b..ae79932828 100644 --- a/ext/spl/tests/iterator_022.phpt +++ b/ext/spl/tests/iterator_022.phpt @@ -5,123 +5,123 @@ SPL: RecursiveIteratorIterator and callHasChildren/callGetChildren class MyRecursiveArrayIterator extends RecursiveArrayIterator { - function getChildren() - { - echo __METHOD__ . "\n"; - return $this->current(); - } + function getChildren() + { + echo __METHOD__ . "\n"; + return $this->current(); + } - function valid() - { - if (!parent::valid()) - { - echo __METHOD__ . " = false\n"; - return false; - } - else - { - return true; - } - } + function valid() + { + if (!parent::valid()) + { + echo __METHOD__ . " = false\n"; + return false; + } + else + { + return true; + } + } } class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator { - private $max_depth; - private $over = 0; - private $skip = false; + private $max_depth; + private $over = 0; + private $skip = false; - function __construct($it, $max_depth) - { - $this->max_depth = $max_depth; - parent::__construct($it); - } + function __construct($it, $max_depth) + { + $this->max_depth = $max_depth; + parent::__construct($it); + } - function rewind() - { - echo __METHOD__ . "\n"; - $this->skip = false; - parent::rewind(); - } + function rewind() + { + echo __METHOD__ . "\n"; + $this->skip = false; + parent::rewind(); + } - function valid() - { - echo __METHOD__ . "\n"; - if ($this->skip) - { - $this->skip = false; - $this->next(); - } - return parent::valid(); - } + function valid() + { + echo __METHOD__ . "\n"; + if ($this->skip) + { + $this->skip = false; + $this->next(); + } + return parent::valid(); + } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } + function current() + { + echo __METHOD__ . "\n"; + return parent::current(); + } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } + function key() + { + echo __METHOD__ . "\n"; + return parent::key(); + } - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } + function next() + { + echo __METHOD__ . "\n"; + parent::next(); + } - function callHasChildren() - { - $this->skip = false; - $has = parent::callHasChildren(); - $res = $this->getDepth() < $this->max_depth && $has; - echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n"; - if ($has && !$res) - { - $this->over++; - if ($this->over == 2) { - $this->skip = true; - } - } - return $res; - } + function callHasChildren() + { + $this->skip = false; + $has = parent::callHasChildren(); + $res = $this->getDepth() < $this->max_depth && $has; + echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n"; + if ($has && !$res) + { + $this->over++; + if ($this->over == 2) { + $this->skip = true; + } + } + return $res; + } - function callGetChildren() - { - if ($this->over == 2) - { - echo __METHOD__ . "(skip)\n"; - return NULL; - } - echo __METHOD__ . "(ok:{$this->over})\n"; - return new MyRecursiveArrayIterator($this->current()); - } + function callGetChildren() + { + if ($this->over == 2) + { + echo __METHOD__ . "(skip)\n"; + return NULL; + } + echo __METHOD__ . "(ok:{$this->over})\n"; + return new MyRecursiveArrayIterator($this->current()); + } - function beginChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } + function beginChildren() + { + echo __METHOD__ . "(".$this->getDepth().")\n"; + } - function endChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } + function endChildren() + { + echo __METHOD__ . "(".$this->getDepth().")\n"; + } } try { - foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v) - { - if (is_array($v)) $v = join('',$v); - echo "$k=>$v\n"; - } + foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v) + { + if (is_array($v)) $v = join('',$v); + echo "$k=>$v\n"; + } } catch(UnexpectedValueException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/spl/tests/iterator_023.phpt b/ext/spl/tests/iterator_023.phpt index 3f27a620e2..b75b2bcb7a 100644 --- a/ext/spl/tests/iterator_023.phpt +++ b/ext/spl/tests/iterator_023.phpt @@ -5,123 +5,123 @@ SPL: RecursiveIteratorIterator and catch getChildren class MyRecursiveArrayIterator extends RecursiveArrayIterator { - function getChildren() - { - echo __METHOD__ . "\n"; - return $this->current(); - } + function getChildren() + { + echo __METHOD__ . "\n"; + return $this->current(); + } - function valid() - { - if (!parent::valid()) - { - echo __METHOD__ . " = false\n"; - return false; - } - else - { - return true; - } - } + function valid() + { + if (!parent::valid()) + { + echo __METHOD__ . " = false\n"; + return false; + } + else + { + return true; + } + } } class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator { - private $max_depth; - private $over = 0; - private $skip = false; + private $max_depth; + private $over = 0; + private $skip = false; - function __construct($it, $max_depth) - { - $this->max_depth = $max_depth; - parent::__construct($it, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD); - } + function __construct($it, $max_depth) + { + $this->max_depth = $max_depth; + parent::__construct($it, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD); + } - function rewind() - { - echo __METHOD__ . "\n"; - $this->skip = false; - parent::rewind(); - } + function rewind() + { + echo __METHOD__ . "\n"; + $this->skip = false; + parent::rewind(); + } - function valid() - { - echo __METHOD__ . "\n"; - if ($this->skip) - { - $this->skip = false; - $this->next(); - } - return parent::valid(); - } + function valid() + { + echo __METHOD__ . "\n"; + if ($this->skip) + { + $this->skip = false; + $this->next(); + } + return parent::valid(); + } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } + function current() + { + echo __METHOD__ . "\n"; + return parent::current(); + } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } + function key() + { + echo __METHOD__ . "\n"; + return parent::key(); + } - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } + function next() + { + echo __METHOD__ . "\n"; + parent::next(); + } - function callHasChildren() - { - $this->skip = false; - $has = parent::callHasChildren(); - $res = $this->getDepth() < $this->max_depth && $has; - echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n"; - if ($has && !$res) - { - $this->over++; - if ($this->over == 2) { - $this->skip = true; - } - } - return $res; - } + function callHasChildren() + { + $this->skip = false; + $has = parent::callHasChildren(); + $res = $this->getDepth() < $this->max_depth && $has; + echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n"; + if ($has && !$res) + { + $this->over++; + if ($this->over == 2) { + $this->skip = true; + } + } + return $res; + } - function callGetChildren() - { - if ($this->over == 2) - { - echo __METHOD__ . "(throw)\n"; - throw new Exception("Thrown in callGetChildren()"); - } - echo __METHOD__ . "(ok:{$this->over})\n"; - return new MyRecursiveArrayIterator($this->current()); - } + function callGetChildren() + { + if ($this->over == 2) + { + echo __METHOD__ . "(throw)\n"; + throw new Exception("Thrown in callGetChildren()"); + } + echo __METHOD__ . "(ok:{$this->over})\n"; + return new MyRecursiveArrayIterator($this->current()); + } - function beginChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } + function beginChildren() + { + echo __METHOD__ . "(".$this->getDepth().")\n"; + } - function endChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } + function endChildren() + { + echo __METHOD__ . "(".$this->getDepth().")\n"; + } } try { - foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v) - { - if (is_array($v)) $v = join('',$v); - echo "$k=>$v\n"; - } + foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v) + { + if (is_array($v)) $v = join('',$v); + echo "$k=>$v\n"; + } } catch(UnexpectedValueException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> diff --git a/ext/spl/tests/iterator_024.phpt b/ext/spl/tests/iterator_024.phpt index 1af642b311..21f0216d9b 100644 --- a/ext/spl/tests/iterator_024.phpt +++ b/ext/spl/tests/iterator_024.phpt @@ -12,11 +12,11 @@ var_dump($it->getIteratorClass()); try { - foreach(new RecursiveIteratorIterator(new ArrayObject($ar)) as $v) echo "$v\n"; + foreach(new RecursiveIteratorIterator(new ArrayObject($ar)) as $v) echo "$v\n"; } catch (InvalidArgumentException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } echo "===MANUAL===\n"; diff --git a/ext/spl/tests/iterator_025.phpt b/ext/spl/tests/iterator_025.phpt index 34d418fe4c..f3df902a64 100644 --- a/ext/spl/tests/iterator_025.phpt +++ b/ext/spl/tests/iterator_025.phpt @@ -5,15 +5,15 @@ SPL: RecursiveIteratorIterator and begin/endIteration() class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { - function beginIteration() - { - echo __METHOD__ . "()\n"; - } + function beginIteration() + { + echo __METHOD__ . "()\n"; + } - function endIteration() - { - echo __METHOD__ . "()\n"; - } + function endIteration() + { + echo __METHOD__ . "()\n"; + } } $ar = array(1, 2, array(31, 32, array(331)), 4); @@ -37,15 +37,15 @@ echo "===MANUAL===\n"; $it->rewind(); while($it->valid()) { - echo $it->current() . "\n"; - $it->next(); - break; + echo $it->current() . "\n"; + $it->next(); + break; } $it->rewind(); while($it->valid()) { - echo $it->current() . "\n"; - $it->next(); + echo $it->current() . "\n"; + $it->next(); } ?> diff --git a/ext/spl/tests/iterator_026.phpt b/ext/spl/tests/iterator_026.phpt index 23a1173b65..1117b65f8a 100644 --- a/ext/spl/tests/iterator_026.phpt +++ b/ext/spl/tests/iterator_026.phpt @@ -11,8 +11,8 @@ $it = new RecursiveIteratorIterator($it); foreach($it as $k=>$v) { - echo "$k=>$v\n"; - echo "hasNext: " . ($it->getInnerIterator()->hasNext() ? "yes" : "no") . "\n"; + echo "$k=>$v\n"; + echo "hasNext: " . ($it->getInnerIterator()->hasNext() ? "yes" : "no") . "\n"; } ?> diff --git a/ext/spl/tests/iterator_027.phpt b/ext/spl/tests/iterator_027.phpt index 0b7cd72b10..1bd6990493 100644 --- a/ext/spl/tests/iterator_027.phpt +++ b/ext/spl/tests/iterator_027.phpt @@ -11,17 +11,17 @@ $it = new CachingIterator($it, CachingIterator::FULL_CACHE); foreach($it as $k=>$v) { - echo "$k=>$v\n"; + echo "$k=>$v\n"; } echo "===CHECK===\n"; for ($i = 0; $i < 4; $i++) { - if (isset($it[$i])) - { - var_dump($i, $it[$i]); - } + if (isset($it[$i])) + { + var_dump($i, $it[$i]); + } } $it[2] = 'foo'; diff --git a/ext/spl/tests/iterator_028.phpt b/ext/spl/tests/iterator_028.phpt index 8a42985e02..5d681ccac0 100644 --- a/ext/spl/tests/iterator_028.phpt +++ b/ext/spl/tests/iterator_028.phpt @@ -41,12 +41,12 @@ $it->setMaxDepth(-1); var_dump($it->getMaxDepth()); try { - $it->setMaxDepth(4); - $it->setMaxDepth(-2); + $it->setMaxDepth(4); + $it->setMaxDepth(-2); } catch(Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } var_dump($it->getMaxDepth()); ?> diff --git a/ext/spl/tests/iterator_029.phpt b/ext/spl/tests/iterator_029.phpt index 5cafda584c..a6f79343c7 100644 --- a/ext/spl/tests/iterator_029.phpt +++ b/ext/spl/tests/iterator_029.phpt @@ -7,7 +7,7 @@ $ar = array(0, "123", 123, 22 => "abc", "a2b", 22, "a2d" => 7, 42); foreach(new RegexIterator(new ArrayIterator($ar), "/2/") as $k => $v) { - echo "$k=>$v\n"; + echo "$k=>$v\n"; } ?> @@ -16,7 +16,7 @@ foreach(new RegexIterator(new ArrayIterator($ar), "/2/") as $k => $v) foreach(new RegexIterator(new ArrayIterator($ar), "/2/", 0, RegexIterator::USE_KEY) as $k => $v) { - echo "$k=>$v\n"; + echo "$k=>$v\n"; } ?> diff --git a/ext/spl/tests/iterator_030.phpt b/ext/spl/tests/iterator_030.phpt index c1c2b33a45..6a684ec300 100644 --- a/ext/spl/tests/iterator_030.phpt +++ b/ext/spl/tests/iterator_030.phpt @@ -13,20 +13,20 @@ var_dump($it->valid()); try { - var_dump($it->key()); + var_dump($it->key()); } catch(BadMethodCallException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { - var_dump($it->current()); + var_dump($it->current()); } catch(BadMethodCallException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } var_dump($it->valid()); diff --git a/ext/spl/tests/iterator_031.phpt b/ext/spl/tests/iterator_031.phpt index f935e0393b..247e13bfff 100644 --- a/ext/spl/tests/iterator_031.phpt +++ b/ext/spl/tests/iterator_031.phpt @@ -5,71 +5,71 @@ SPL: AppendIterator::append() rewinds when necessary class MyArrayIterator extends ArrayIterator { - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } + function rewind() + { + echo __METHOD__ . "\n"; + parent::rewind(); + } } $it = new MyArrayIterator(array(1,2)); foreach($it as $k=>$v) { - echo "$k=>$v\n"; + echo "$k=>$v\n"; } class MyAppendIterator extends AppendIterator { - function __construct() - { - echo __METHOD__ . "\n"; - } + function __construct() + { + echo __METHOD__ . "\n"; + } - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } + function rewind() + { + echo __METHOD__ . "\n"; + parent::rewind(); + } - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } + function valid() + { + echo __METHOD__ . "\n"; + return parent::valid(); + } - function append(Iterator $what) - { - echo __METHOD__ . "\n"; - parent::append($what); - } + function append(Iterator $what) + { + echo __METHOD__ . "\n"; + parent::append($what); + } - function parent__construct() - { - parent::__construct(); - } + function parent__construct() + { + parent::__construct(); + } } $ap = new MyAppendIterator; try { - $ap->append($it); + $ap->append($it); } catch(LogicException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } $ap->parent__construct(); try { - $ap->parent__construct($it); + $ap->parent__construct($it); } catch(BadMethodCallException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } $ap->append($it); @@ -78,7 +78,7 @@ $ap->append($it); foreach($ap as $k=>$v) { - echo "$k=>$v\n"; + echo "$k=>$v\n"; } ?> diff --git a/ext/spl/tests/iterator_032.phpt b/ext/spl/tests/iterator_032.phpt index 258b3c6934..9f56d7574d 100644 --- a/ext/spl/tests/iterator_032.phpt +++ b/ext/spl/tests/iterator_032.phpt @@ -7,17 +7,17 @@ $it = new LimitIterator(new ArrayIterator(array(1,2,3,4)), 1, 2); foreach($it as $k=>$v) { - echo "$k=>$v\n"; - var_dump($it->getPosition()); + echo "$k=>$v\n"; + var_dump($it->getPosition()); } try { - $it->seek(0); + $it->seek(0); } catch(OutOfBoundsException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } $it->seek(2); @@ -25,11 +25,11 @@ var_dump($it->current()); try { - $it->seek(3); + $it->seek(3); } catch(OutOfBoundsException $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } $it->next(); diff --git a/ext/spl/tests/iterator_033.phpt b/ext/spl/tests/iterator_033.phpt index 44cde1962b..7e1f93a6ee 100644 --- a/ext/spl/tests/iterator_033.phpt +++ b/ext/spl/tests/iterator_033.phpt @@ -7,16 +7,16 @@ $it = new ParentIterator(new RecursiveArrayIterator(array(1,array(21,22, array(2 foreach(new RecursiveIteratorIterator($it) as $k=>$v) { - var_dump($k); - var_dump($v); + var_dump($k); + var_dump($v); } echo "==SECOND==\n"; foreach(new RecursiveIteratorIterator($it, 1) as $k=>$v) { - var_dump($k); - var_dump($v); + var_dump($k); + var_dump($v); } ?> diff --git a/ext/spl/tests/iterator_034.phpt b/ext/spl/tests/iterator_034.phpt index 402ef7e43c..76cc9589ce 100644 --- a/ext/spl/tests/iterator_034.phpt +++ b/ext/spl/tests/iterator_034.phpt @@ -5,106 +5,106 @@ SPL: RecursiveIteratorIterator and break deep class MyRecursiveArrayIterator extends RecursiveArrayIterator { - function valid() - { - if (!parent::valid()) - { - echo __METHOD__ . "() = false\n"; - return false; - } - else - { - return true; - } - } - - function getChildren() - { - echo __METHOD__ . "()\n"; - return parent::getChildren(); - } - - function rewind() - { - echo __METHOD__ . "()\n"; - parent::rewind(); - } + function valid() + { + if (!parent::valid()) + { + echo __METHOD__ . "() = false\n"; + return false; + } + else + { + return true; + } + } + + function getChildren() + { + echo __METHOD__ . "()\n"; + return parent::getChildren(); + } + + function rewind() + { + echo __METHOD__ . "()\n"; + parent::rewind(); + } } class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator { - private $max_depth; - private $over = 0; - - function __construct($it, $max_depth) - { - $this->max_depth = $max_depth; - parent::__construct($it); - } - - function rewind() - { - echo __METHOD__ . "() - BEGIN\n"; - parent::rewind(); - echo __METHOD__ . "() - DONE\n"; - } - - function valid() - { - echo __METHOD__ . "()\n"; - return parent::valid(); - } - - function current() - { - echo __METHOD__ . "()\n"; - return parent::current(); - } - - function key() - { - echo __METHOD__ . "()\n"; - return parent::key(); - } - - function next() - { - echo __METHOD__ . "()\n"; - parent::next(); - } - - function callHasChildren() - { - $has = parent::callHasChildren(); - $res = $this->getDepth() < $this->max_depth && $has; - echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n"; - return $res; - } - - function beginChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - parent::beginChildren(); - } - - function endChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - parent::endChildren(); - } + private $max_depth; + private $over = 0; + + function __construct($it, $max_depth) + { + $this->max_depth = $max_depth; + parent::__construct($it); + } + + function rewind() + { + echo __METHOD__ . "() - BEGIN\n"; + parent::rewind(); + echo __METHOD__ . "() - DONE\n"; + } + + function valid() + { + echo __METHOD__ . "()\n"; + return parent::valid(); + } + + function current() + { + echo __METHOD__ . "()\n"; + return parent::current(); + } + + function key() + { + echo __METHOD__ . "()\n"; + return parent::key(); + } + + function next() + { + echo __METHOD__ . "()\n"; + parent::next(); + } + + function callHasChildren() + { + $has = parent::callHasChildren(); + $res = $this->getDepth() < $this->max_depth && $has; + echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n"; + return $res; + } + + function beginChildren() + { + echo __METHOD__ . "(".$this->getDepth().")\n"; + parent::beginChildren(); + } + + function endChildren() + { + echo __METHOD__ . "(".$this->getDepth().")\n"; + parent::endChildren(); + } } $p = 0; $it = new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2); foreach($it as $k=>$v) { - if (is_array($v)) $v = join('',$v); - echo "$k=>$v\n"; - if ($p++ == 5) - { - echo "===BREAK===\n"; - break; - } + if (is_array($v)) $v = join('',$v); + echo "$k=>$v\n"; + if ($p++ == 5) + { + echo "===BREAK===\n"; + break; + } } echo "===FOREND===\n"; diff --git a/ext/spl/tests/iterator_036.phpt b/ext/spl/tests/iterator_036.phpt index 07a1f79134..bfe1825abe 100644 --- a/ext/spl/tests/iterator_036.phpt +++ b/ext/spl/tests/iterator_036.phpt @@ -5,10 +5,10 @@ SPL: CachingIterator and __toString and flags = 0 function test($it) { - foreach($it as $v) - { - var_dump((string)$it); - } + foreach($it as $v) + { + var_dump((string)$it); + } } $ar = new ArrayIterator(array(1, 2, 3)); diff --git a/ext/spl/tests/iterator_037.phpt b/ext/spl/tests/iterator_037.phpt index 4b4f14e4d3..1792b1cb66 100644 --- a/ext/spl/tests/iterator_037.phpt +++ b/ext/spl/tests/iterator_037.phpt @@ -5,51 +5,51 @@ SPL: CachingIterator and __toString function test($ar, $flags) { - echo "===$flags===\n"; - $it = new CachingIterator($ar, 0); - try - { - $it->setFlags($flags); - } - catch (Exception $e) - { - echo 'Exception: ' . $e->getMessage() . "\n"; - var_dump($it->getFlags()); - return; - } - var_dump($it->getFlags()); - try - { - foreach($it as $v) - { - var_dump((string)$it); - } - } - catch (Exception $e) - { - echo 'Exception: ' . $e->getMessage() . "\n"; - } + echo "===$flags===\n"; + $it = new CachingIterator($ar, 0); + try + { + $it->setFlags($flags); + } + catch (Exception $e) + { + echo 'Exception: ' . $e->getMessage() . "\n"; + var_dump($it->getFlags()); + return; + } + var_dump($it->getFlags()); + try + { + foreach($it as $v) + { + var_dump((string)$it); + } + } + catch (Exception $e) + { + echo 'Exception: ' . $e->getMessage() . "\n"; + } } class MyItem { - function __construct($value) - { - $this->value = $value; - } + function __construct($value) + { + $this->value = $value; + } - function __toString() - { - return (string)$this->value; - } + function __toString() + { + return (string)$this->value; + } } class MyArrayIterator extends ArrayIterator { - function __toString() - { - return $this->key() . ':' . $this->current(); - } + function __toString() + { + return $this->key() . ':' . $this->current(); + } } $ar = new MyArrayIterator(array(1, 2, 3)); @@ -70,21 +70,21 @@ test($ar, CachingIterator::TOSTRING_USE_KEY | CachingIterator::TOSTRING_USE_INNE echo "===X===\n"; try { - $it = new CachingIterator($ar, CachingIterator::CALL_TOSTRING); - $it->setFlags(0); + $it = new CachingIterator($ar, CachingIterator::CALL_TOSTRING); + $it->setFlags(0); } catch (Exception $e) { - echo 'Exception: ' . $e->getMessage() . "\n"; + echo 'Exception: ' . $e->getMessage() . "\n"; } try { - $it = new CachingIterator($ar, CachingIterator::TOSTRING_USE_INNER); - $it->setFlags(0); + $it = new CachingIterator($ar, CachingIterator::TOSTRING_USE_INNER); + $it->setFlags(0); } catch (Exception $e) { - echo 'Exception: ' . $e->getMessage() . "\n"; + echo 'Exception: ' . $e->getMessage() . "\n"; } ?> diff --git a/ext/spl/tests/iterator_038.phpt b/ext/spl/tests/iterator_038.phpt index 1ac3262181..cb4d3a3795 100644 --- a/ext/spl/tests/iterator_038.phpt +++ b/ext/spl/tests/iterator_038.phpt @@ -5,8 +5,8 @@ SPL: RoRewindIterator and string keys foreach(new NoRewindIterator(new ArrayIterator(array('Hello'=>0, 'World'=>1))) as $k => $v) { - var_dump($v); - var_dump($k); + var_dump($v); + var_dump($k); } ?> diff --git a/ext/spl/tests/iterator_039.phpt b/ext/spl/tests/iterator_039.phpt index eb5018e07f..18f9a24168 100644 --- a/ext/spl/tests/iterator_039.phpt +++ b/ext/spl/tests/iterator_039.phpt @@ -5,52 +5,52 @@ SPL: LimitIterator and backward seeking class NumericArrayIterator implements Iterator { - protected $a; - protected $i = 0; + protected $a; + protected $i = 0; - public function __construct($a) - { - echo __METHOD__ . "\n"; - $this->a = $a; - } + public function __construct($a) + { + echo __METHOD__ . "\n"; + $this->a = $a; + } - public function valid() - { - echo __METHOD__ . "\n"; - return $this->i < count($this->a); - } + public function valid() + { + echo __METHOD__ . "\n"; + return $this->i < count($this->a); + } - public function rewind() - { - echo __METHOD__ . "\n"; - $this->i = 0; - } + public function rewind() + { + echo __METHOD__ . "\n"; + $this->i = 0; + } - public function key() - { - echo __METHOD__ . "\n"; - return $this->i; - } + public function key() + { + echo __METHOD__ . "\n"; + return $this->i; + } - public function current() - { - echo __METHOD__ . "\n"; - return $this->a[$this->i]; - } + public function current() + { + echo __METHOD__ . "\n"; + return $this->a[$this->i]; + } - public function next() - { - echo __METHOD__ . "\n"; - $this->i++; - } + public function next() + { + echo __METHOD__ . "\n"; + $this->i++; + } } $it = new LimitIterator(new NumericArrayIterator(array(12, 25, 42, 56))); foreach($it as $k => $v) { - var_dump($k); - var_dump($v); + var_dump($k); + var_dump($v); } echo "===SEEK===\n"; @@ -61,8 +61,8 @@ echo "===LOOP===\n"; foreach(new NoRewindIterator($it) as $k => $v) { - var_dump($k); - var_dump($v); + var_dump($k); + var_dump($v); } ?> diff --git a/ext/spl/tests/iterator_040.phpt b/ext/spl/tests/iterator_040.phpt index abc5193769..1e8bd55764 100644 --- a/ext/spl/tests/iterator_040.phpt +++ b/ext/spl/tests/iterator_040.phpt @@ -5,10 +5,10 @@ SPL: RecursiveFilterIterator class MyRecursiveFilterIterator extends RecursiveFilterIterator { - function accept() - { - return true; - } + function accept() + { + return true; + } } $ar = array(1, array(21, 22), 3); @@ -18,10 +18,10 @@ $it = new RecursiveIteratorIterator($it); foreach($it as $k => $v) { - echo "===\n"; - var_dump($it->getDepth()); - var_dump($k); - var_dump($v); + echo "===\n"; + var_dump($it->getDepth()); + var_dump($k); + var_dump($v); } ?> diff --git a/ext/spl/tests/iterator_041.phpt b/ext/spl/tests/iterator_041.phpt index cb4ca9cd46..98892c87e0 100644 --- a/ext/spl/tests/iterator_041.phpt +++ b/ext/spl/tests/iterator_041.phpt @@ -5,85 +5,85 @@ SPL: iterator_to_array() and exceptions class MyArrayIterator extends ArrayIterator { - static protected $fail = 0; - public $state; + static protected $fail = 0; + public $state; - static function fail($state, $method) - { - if (self::$fail == $state) - { - throw new Exception("State $state: $method()"); - } - } + static function fail($state, $method) + { + if (self::$fail == $state) + { + throw new Exception("State $state: $method()"); + } + } - function __construct() - { - $this->state = MyArrayIterator::$fail; - self::fail(0, __FUNCTION__); - parent::__construct(array(1, 2)); - self::fail(1, __FUNCTION__); - } + function __construct() + { + $this->state = MyArrayIterator::$fail; + self::fail(0, __FUNCTION__); + parent::__construct(array(1, 2)); + self::fail(1, __FUNCTION__); + } - function rewind() - { - self::fail(2, __FUNCTION__); - return parent::rewind(); - } + function rewind() + { + self::fail(2, __FUNCTION__); + return parent::rewind(); + } - function valid() - { - self::fail(3, __FUNCTION__); - return parent::valid(); - } + function valid() + { + self::fail(3, __FUNCTION__); + return parent::valid(); + } - function current() - { - self::fail(4, __FUNCTION__); - return parent::current(); - } + function current() + { + self::fail(4, __FUNCTION__); + return parent::current(); + } - function key() - { - self::fail(5, __FUNCTION__); - return parent::key(); - } + function key() + { + self::fail(5, __FUNCTION__); + return parent::key(); + } - function next() - { - self::fail(6, __FUNCTION__); - return parent::next(); - } + function next() + { + self::fail(6, __FUNCTION__); + return parent::next(); + } - function __destruct() - { + function __destruct() + { // self::fail(7, __FUNCTION__); - } + } - static function test($func, $skip = null) - { - echo "===$func===\n"; - self::$fail = 0; - while(self::$fail < 10) - { - try - { - var_dump($func(new MyArrayIterator())); - break; - } - catch (Exception $e) - { - echo $e->getMessage() . "\n"; - } - if (isset($skip[self::$fail])) - { - self::$fail = $skip[self::$fail]; - } - else - { - self::$fail++; - } - } - } + static function test($func, $skip = null) + { + echo "===$func===\n"; + self::$fail = 0; + while(self::$fail < 10) + { + try + { + var_dump($func(new MyArrayIterator())); + break; + } + catch (Exception $e) + { + echo $e->getMessage() . "\n"; + } + if (isset($skip[self::$fail])) + { + self::$fail = $skip[self::$fail]; + } + else + { + self::$fail++; + } + } + } } MyArrayIterator::test('iterator_to_array'); diff --git a/ext/spl/tests/iterator_041a.phpt b/ext/spl/tests/iterator_041a.phpt index e7277dcaf9..37b4341297 100644 --- a/ext/spl/tests/iterator_041a.phpt +++ b/ext/spl/tests/iterator_041a.phpt @@ -5,85 +5,85 @@ SPL: iterator_to_array() and exceptions from destruct class MyArrayIterator extends ArrayIterator { - static protected $fail = 0; - public $state; + static protected $fail = 0; + public $state; - static function fail($state, $method) - { - if (self::$fail == $state) - { - throw new Exception("State $state: $method()"); - } - } + static function fail($state, $method) + { + if (self::$fail == $state) + { + throw new Exception("State $state: $method()"); + } + } - function __construct() - { - $this->state = MyArrayIterator::$fail; - self::fail(0, __FUNCTION__); - parent::__construct(array(1, 2)); - self::fail(1, __FUNCTION__); - } + function __construct() + { + $this->state = MyArrayIterator::$fail; + self::fail(0, __FUNCTION__); + parent::__construct(array(1, 2)); + self::fail(1, __FUNCTION__); + } - function rewind() - { - self::fail(2, __FUNCTION__); - return parent::rewind(); - } + function rewind() + { + self::fail(2, __FUNCTION__); + return parent::rewind(); + } - function valid() - { - self::fail(3, __FUNCTION__); - return parent::valid(); - } + function valid() + { + self::fail(3, __FUNCTION__); + return parent::valid(); + } - function current() - { - self::fail(4, __FUNCTION__); - return parent::current(); - } + function current() + { + self::fail(4, __FUNCTION__); + return parent::current(); + } - function key() - { - self::fail(5, __FUNCTION__); - return parent::key(); - } + function key() + { + self::fail(5, __FUNCTION__); + return parent::key(); + } - function next() - { - self::fail(6, __FUNCTION__); - return parent::next(); - } + function next() + { + self::fail(6, __FUNCTION__); + return parent::next(); + } - function __destruct() - { - self::fail(7, __FUNCTION__); - } + function __destruct() + { + self::fail(7, __FUNCTION__); + } - static function test($func, $skip = null) - { - echo "===$func===\n"; - self::$fail = 7; - while(self::$fail < 10) - { - try - { - var_dump($func(new MyArrayIterator())); - break; - } - catch (Exception $e) - { - echo $e->getMessage() . "\n"; - } - if (isset($skip[self::$fail])) - { - self::$fail = $skip[self::$fail]; - } - else - { - self::$fail++; - } - } - } + static function test($func, $skip = null) + { + echo "===$func===\n"; + self::$fail = 7; + while(self::$fail < 10) + { + try + { + var_dump($func(new MyArrayIterator())); + break; + } + catch (Exception $e) + { + echo $e->getMessage() . "\n"; + } + if (isset($skip[self::$fail])) + { + self::$fail = $skip[self::$fail]; + } + else + { + self::$fail++; + } + } + } } MyArrayIterator::test('iterator_to_array'); diff --git a/ext/spl/tests/iterator_041b.phpt b/ext/spl/tests/iterator_041b.phpt index 829bde94f7..517b8fc5e4 100644 --- a/ext/spl/tests/iterator_041b.phpt +++ b/ext/spl/tests/iterator_041b.phpt @@ -5,89 +5,89 @@ SPL: iterator_to_array() and exceptions from delayed destruct class MyArrayIterator extends ArrayIterator { - static protected $fail = 0; - public $state; + static protected $fail = 0; + public $state; - static function fail($state, $method) - { - if (self::$fail == $state) - { - throw new Exception("State $state: $method()"); - } - } + static function fail($state, $method) + { + if (self::$fail == $state) + { + throw new Exception("State $state: $method()"); + } + } - function __construct() - { - $this->state = MyArrayIterator::$fail; - self::fail(0, __FUNCTION__); - parent::__construct(array(1, 2)); - self::fail(1, __FUNCTION__); - } + function __construct() + { + $this->state = MyArrayIterator::$fail; + self::fail(0, __FUNCTION__); + parent::__construct(array(1, 2)); + self::fail(1, __FUNCTION__); + } - function rewind() - { - self::fail(2, __FUNCTION__); - return parent::rewind(); - } + function rewind() + { + self::fail(2, __FUNCTION__); + return parent::rewind(); + } - function valid() - { - self::fail(3, __FUNCTION__); - return parent::valid(); - } + function valid() + { + self::fail(3, __FUNCTION__); + return parent::valid(); + } - function current() - { - self::fail(4, __FUNCTION__); - return parent::current(); - } + function current() + { + self::fail(4, __FUNCTION__); + return parent::current(); + } - function key() - { - self::fail(5, __FUNCTION__); - return parent::key(); - } + function key() + { + self::fail(5, __FUNCTION__); + return parent::key(); + } - function next() - { - self::fail(6, __FUNCTION__); - return parent::next(); - } + function next() + { + self::fail(6, __FUNCTION__); + return parent::next(); + } - function __destruct() - { - self::fail(7, __FUNCTION__); - } + function __destruct() + { + self::fail(7, __FUNCTION__); + } - static function test($func, $skip = null) - { - echo "===$func===\n"; - self::$fail = 0; - while(self::$fail < 10) - { - try - { - var_dump($func(new MyArrayIterator())); - break; - } - catch (Exception $e) - { - echo $e->getMessage() . "\n"; - } - if (isset($skip[self::$fail])) - { - self::$fail = $skip[self::$fail]; - } - else - { - self::$fail++; - } - try { - $e = null; - } catch (Exception $e) { - } - } - } + static function test($func, $skip = null) + { + echo "===$func===\n"; + self::$fail = 0; + while(self::$fail < 10) + { + try + { + var_dump($func(new MyArrayIterator())); + break; + } + catch (Exception $e) + { + echo $e->getMessage() . "\n"; + } + if (isset($skip[self::$fail])) + { + self::$fail = $skip[self::$fail]; + } + else + { + self::$fail++; + } + try { + $e = null; + } catch (Exception $e) { + } + } + } } MyArrayIterator::test('iterator_to_array'); diff --git a/ext/spl/tests/iterator_042.phpt b/ext/spl/tests/iterator_042.phpt index 9c656cbad7..2c14fc3d40 100644 --- a/ext/spl/tests/iterator_042.phpt +++ b/ext/spl/tests/iterator_042.phpt @@ -5,8 +5,8 @@ SPL: AppendIterator and its ArrayIterator function test_error_handler($errno, $msg, $filename, $linenum) { - echo "Error $msg in $filename on line $linenum\n"; - return true; + echo "Error $msg in $filename on line $linenum\n"; + return true; } set_error_handler('test_error_handler'); @@ -14,9 +14,9 @@ set_error_handler('test_error_handler'); $it = new AppendIterator; try { - $it->append(array()); + $it->append(array()); } catch (Error $e) { - test_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); + test_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); } $it->append(new ArrayIterator(array(1))); $it->append(new ArrayIterator(array(21, 22))); @@ -31,10 +31,10 @@ $idx = 0; foreach($it as $k => $v) { - echo '===' . $idx++ . "===\n"; - var_dump($it->getIteratorIndex()); - var_dump($k); - var_dump($v); + echo '===' . $idx++ . "===\n"; + var_dump($it->getIteratorIndex()); + var_dump($k); + var_dump($v); } ?> diff --git a/ext/spl/tests/iterator_044.phpt b/ext/spl/tests/iterator_044.phpt index 68842cd6f0..89d8bef772 100644 --- a/ext/spl/tests/iterator_044.phpt +++ b/ext/spl/tests/iterator_044.phpt @@ -5,57 +5,57 @@ SPL: CachingIterator and offsetGet/Exists using flag FULL_CACHE class MyFoo { - function __toString() - { - return 'foo'; - } + function __toString() + { + return 'foo'; + } } class MyCachingIterator extends CachingIterator { - function __construct(Iterator $it, $flags = 0) - { - parent::__construct($it, $flags); - } - - function test($ar) - { - foreach($ar as $k => $v) - { - echo "===$k===\n"; - var_dump($v); - try { + function __construct(Iterator $it, $flags = 0) + { + parent::__construct($it, $flags); + } + + function test($ar) + { + foreach($ar as $k => $v) + { + echo "===$k===\n"; + var_dump($v); + try { var_dump($this->offsetExists($v)); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } - try { + try { var_dump($this->offsetGet($v)); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } - } - } + } + } } $it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4))); try { - var_dump($it->offsetExists(0)); + var_dump($it->offsetExists(0)); } catch(Exception $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } try { - var_dump($it->offsetGet(0)); + var_dump($it->offsetGet(0)); } catch(Exception $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } $it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4)), CachingIterator::FULL_CACHE); diff --git a/ext/spl/tests/iterator_045.phpt b/ext/spl/tests/iterator_045.phpt index e0e2070ec1..63d78cc78e 100644 --- a/ext/spl/tests/iterator_045.phpt +++ b/ext/spl/tests/iterator_045.phpt @@ -5,70 +5,70 @@ SPL: CachingIterator and offsetSet/Unset, getCache using flag FULL_CACHE class MyFoo { - function __toString() - { - return 'foo'; - } + function __toString() + { + return 'foo'; + } } class MyCachingIterator extends CachingIterator { - function __construct(Iterator $it, $flags = 0) - { - parent::__construct($it, $flags); - } + function __construct(Iterator $it, $flags = 0) + { + parent::__construct($it, $flags); + } - function testSet($ar) - { - echo __METHOD__ . "()\n"; - foreach($ar as $k => $v) - { - echo "set($k,$v)\n"; - $this->offsetSet($k, $v); - } - } + function testSet($ar) + { + echo __METHOD__ . "()\n"; + foreach($ar as $k => $v) + { + echo "set($k,$v)\n"; + $this->offsetSet($k, $v); + } + } - function testUnset($ar) - { - echo __METHOD__ . "()\n"; - foreach($ar as $k => $v) - { - echo "unset($v)\n"; - $this->offsetUnset($v); - } - } + function testUnset($ar) + { + echo __METHOD__ . "()\n"; + foreach($ar as $k => $v) + { + echo "unset($v)\n"; + $this->offsetUnset($v); + } + } - function fill() - { - echo __METHOD__ . "()\n"; - foreach($this as $v) ; - } + function fill() + { + echo __METHOD__ . "()\n"; + foreach($this as $v) ; + } - function show() - { - echo __METHOD__ . "()\n"; - var_dump($this->getCache()); - } + function show() + { + echo __METHOD__ . "()\n"; + var_dump($this->getCache()); + } } $it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4))); try { - var_dump($it->offsetSet(0, 0)); + var_dump($it->offsetSet(0, 0)); } catch(Exception $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } try { - var_dump($it->offsetUnset(0)); + var_dump($it->offsetUnset(0)); } catch(Exception $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } $it = new MyCachingIterator(new ArrayIterator(array(0, 1, 2, 3)), CachingIterator::FULL_CACHE); diff --git a/ext/spl/tests/iterator_046.phpt b/ext/spl/tests/iterator_046.phpt index 03d833921b..e377dcb731 100644 --- a/ext/spl/tests/iterator_046.phpt +++ b/ext/spl/tests/iterator_046.phpt @@ -5,33 +5,33 @@ SPL: CachingIterator and __toString using bypassed string keys class MyFoo { - function __toString() - { - return 'foo'; - } + function __toString() + { + return 'foo'; + } } class MyCachingIterator extends CachingIterator { - function __construct(Iterator $it, $flags = 0) - { - parent::__construct($it, $flags); - } + function __construct(Iterator $it, $flags = 0) + { + parent::__construct($it, $flags); + } - function fill() - { - echo __METHOD__ . "()\n"; - foreach($this as $v) ; - } + function fill() + { + echo __METHOD__ . "()\n"; + foreach($this as $v) ; + } - function show() - { - echo __METHOD__ . "()\n"; - foreach($this as $v) - { - var_dump((string)$this); - } - } + function show() + { + echo __METHOD__ . "()\n"; + foreach($this as $v) + { + var_dump((string)$this); + } + } } $it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 'bar'=>2)), CachingIterator::TOSTRING_USE_KEY); diff --git a/ext/spl/tests/iterator_047.phpt b/ext/spl/tests/iterator_047.phpt index 32495c5c40..9d7586bf4e 100644 --- a/ext/spl/tests/iterator_047.phpt +++ b/ext/spl/tests/iterator_047.phpt @@ -5,54 +5,54 @@ SPL: RecursiveCachingIterator and exception in has/getChildren class MyRecursiveArrayIterator extends RecursiveArrayIterator { - static public $fail = 0; + static public $fail = 0; - static function fail($state, $method) - { - if (self::$fail == $state) - { - throw new Exception("State $state: $method()"); - } - } + static function fail($state, $method) + { + if (self::$fail == $state) + { + throw new Exception("State $state: $method()"); + } + } - function hasChildren() - { - echo __METHOD__ . "()\n"; - self::fail(1, __METHOD__); - return parent::hasChildren(); - } + function hasChildren() + { + echo __METHOD__ . "()\n"; + self::fail(1, __METHOD__); + return parent::hasChildren(); + } - function getChildren() - { - echo __METHOD__ . "()\n"; - self::fail(2, __METHOD__); - return parent::getChildren(); - } + function getChildren() + { + echo __METHOD__ . "()\n"; + self::fail(2, __METHOD__); + return parent::getChildren(); + } } class MyRecursiveCachingIterator extends RecursiveCachingIterator { - function show() - { - MyRecursiveArrayIterator::$fail = 0; - while(MyRecursiveArrayIterator::$fail < 4) - { - echo "===" . MyRecursiveArrayIterator::$fail . "===\n"; - try - { - foreach(new RecursiveIteratorIterator($this) as $k => $v) - { - var_dump($k); - var_dump($v); - } - } - catch (Exception $e) - { - echo "Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; - } - MyRecursiveArrayIterator::$fail++; - } - } + function show() + { + MyRecursiveArrayIterator::$fail = 0; + while(MyRecursiveArrayIterator::$fail < 4) + { + echo "===" . MyRecursiveArrayIterator::$fail . "===\n"; + try + { + foreach(new RecursiveIteratorIterator($this) as $k => $v) + { + var_dump($k); + var_dump($v); + } + } + catch (Exception $e) + { + echo "Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; + } + MyRecursiveArrayIterator::$fail++; + } + } } $it = new MyRecursiveArrayIterator(array(0, array(10), 2, array(30), 4)); diff --git a/ext/spl/tests/iterator_048.phpt b/ext/spl/tests/iterator_048.phpt index ba776881dd..ce5a06993a 100644 --- a/ext/spl/tests/iterator_048.phpt +++ b/ext/spl/tests/iterator_048.phpt @@ -5,14 +5,14 @@ SPL: RecursiveRegexIterator and exception in has/getChildren class MyRecursiveRegexIterator extends RecursiveRegexIterator { - function show() - { - foreach(new RecursiveIteratorIterator($this) as $k => $v) - { - var_dump($k); - var_dump($v); - } - } + function show() + { + foreach(new RecursiveIteratorIterator($this) as $k => $v) + { + var_dump($k); + var_dump($v); + } + } } $ar = new RecursiveArrayIterator(array('Foo', array('Bar'), 'FooBar', array('Baz'), 'Biz')); diff --git a/ext/spl/tests/iterator_049b.phpt b/ext/spl/tests/iterator_049b.phpt Binary files differindex 5a374cafc8..54a2c2e040 100644 --- a/ext/spl/tests/iterator_049b.phpt +++ b/ext/spl/tests/iterator_049b.phpt diff --git a/ext/spl/tests/iterator_050.phpt b/ext/spl/tests/iterator_050.phpt index a0ef976066..dd8ad544b8 100644 --- a/ext/spl/tests/iterator_050.phpt +++ b/ext/spl/tests/iterator_050.phpt @@ -5,14 +5,14 @@ SPL: RegexIterator::GET_MATCH class MyRegexIterator extends RegexIterator { - function show() - { - foreach($this as $k => $v) - { - var_dump($k); - var_dump($v); - } - } + function show() + { + foreach($this as $k => $v) + { + var_dump($k); + var_dump($v); + } + } } $ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,')); diff --git a/ext/spl/tests/iterator_051.phpt b/ext/spl/tests/iterator_051.phpt index 93a2df5f1c..8b3c6563d1 100644 --- a/ext/spl/tests/iterator_051.phpt +++ b/ext/spl/tests/iterator_051.phpt @@ -5,14 +5,14 @@ SPL: RegexIterator::GET_MATCH, USE_KEY class MyRegexIterator extends RegexIterator { - function show() - { - foreach($this as $k => $v) - { - var_dump($k); - var_dump($v); - } - } + function show() + { + foreach($this as $k => $v) + { + var_dump($k); + var_dump($v); + } + } } $ar = new ArrayIterator(array('1'=>0,'1,2'=>1,'1,2,3'=>2,0=>3,'FooBar'=>4,','=>5,',,'=>6)); diff --git a/ext/spl/tests/iterator_052.phpt b/ext/spl/tests/iterator_052.phpt index 3ea69ac80b..e73d40203d 100644 --- a/ext/spl/tests/iterator_052.phpt +++ b/ext/spl/tests/iterator_052.phpt @@ -5,31 +5,31 @@ SPL: RegexIterator::ALL_MATCHES class MyRegexIterator extends RegexIterator { - public $uk, $re; + public $uk, $re; - function __construct($it, $re, $mode, $flags = 0) - { - $this->uk = $flags & self::USE_KEY; - $this->re = $re; - parent::__construct($it, $re, $mode, $flags); - } + function __construct($it, $re, $mode, $flags = 0) + { + $this->uk = $flags & self::USE_KEY; + $this->re = $re; + parent::__construct($it, $re, $mode, $flags); + } - function show() - { - foreach($this as $k => $v) - { - var_dump($k); - var_dump($v); - } - } + function show() + { + foreach($this as $k => $v) + { + var_dump($k); + var_dump($v); + } + } - function accept() - { - @preg_match_all($this->re, (string)($this->uk ? $this->key() : $this->current()), $sub); - $ret = parent::accept(); - var_dump($sub == $this->current()); - return $ret; - } + function accept() + { + @preg_match_all($this->re, (string)($this->uk ? $this->key() : $this->current()), $sub); + $ret = parent::accept(); + var_dump($sub == $this->current()); + return $ret; + } } $ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,')); diff --git a/ext/spl/tests/iterator_053.phpt b/ext/spl/tests/iterator_053.phpt index 02c18fdd6b..ac8f438a04 100644 --- a/ext/spl/tests/iterator_053.phpt +++ b/ext/spl/tests/iterator_053.phpt @@ -5,31 +5,31 @@ SPL: RegexIterator::ALL_MATCHES class MyRegexIterator extends RegexIterator { - public $uk, $re; + public $uk, $re; - function __construct($it, $re, $mode, $flags = 0) - { - $this->uk = $flags & self::USE_KEY; - $this->re = $re; - parent::__construct($it, $re, $mode, $flags); - } + function __construct($it, $re, $mode, $flags = 0) + { + $this->uk = $flags & self::USE_KEY; + $this->re = $re; + parent::__construct($it, $re, $mode, $flags); + } - function show() - { - foreach($this as $k => $v) - { - var_dump($k); - var_dump($v); - } - } + function show() + { + foreach($this as $k => $v) + { + var_dump($k); + var_dump($v); + } + } - function accept() - { - @preg_match_all($this->re, (string)($this->uk ? $this->key() : $this->current()), $sub); - $ret = parent::accept(); - var_dump($sub == $this->current()); - return $ret; - } + function accept() + { + @preg_match_all($this->re, (string)($this->uk ? $this->key() : $this->current()), $sub); + $ret = parent::accept(); + var_dump($sub == $this->current()); + return $ret; + } } $ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,')); diff --git a/ext/spl/tests/iterator_054.phpt b/ext/spl/tests/iterator_054.phpt index b3df5a7e6b..f40639dd36 100644 --- a/ext/spl/tests/iterator_054.phpt +++ b/ext/spl/tests/iterator_054.phpt @@ -5,14 +5,14 @@ SPL: RegexIterator::SPLIT class MyRegexIterator extends RegexIterator { - function show() - { - foreach($this as $k => $v) - { - var_dump($k); - var_dump($v); - } - } + function show() + { + foreach($this as $k => $v) + { + var_dump($k); + var_dump($v); + } + } } $ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,')); diff --git a/ext/spl/tests/iterator_055.phpt b/ext/spl/tests/iterator_055.phpt index 1ae21a6611..58d710c04a 100644 --- a/ext/spl/tests/iterator_055.phpt +++ b/ext/spl/tests/iterator_055.phpt @@ -5,14 +5,14 @@ SPL: RegexIterator::SPLIT, USE_KEY class MyRegexIterator extends RegexIterator { - function show() - { - foreach($this as $k => $v) - { - var_dump($k); - var_dump($v); - } - } + function show() + { + foreach($this as $k => $v) + { + var_dump($k); + var_dump($v); + } + } } $ar = new ArrayIterator(array('1'=>0,'1,2'=>1,'1,2,3'=>2,0=>3,'FooBar'=>4,','=>5,',,'=>6)); diff --git a/ext/spl/tests/iterator_056.phpt b/ext/spl/tests/iterator_056.phpt index ec49e6b740..28dd444856 100644 --- a/ext/spl/tests/iterator_056.phpt +++ b/ext/spl/tests/iterator_056.phpt @@ -6,7 +6,7 @@ Sebastian Schürmann <?php class myFilterIterator extends FilterIterator { - function accept() { } + function accept() { } } class myCachingIterator extends CachingIterator { } @@ -20,36 +20,36 @@ class myLimitIterator extends LimitIterator { } class myNoRewindIterator extends NoRewindIterator {} try { - $it = new myFilterIterator(); + $it = new myFilterIterator(); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } try { - $it = new myCachingIterator(); + $it = new myCachingIterator(); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } try { - $it = new myRecursiveCachingIterator(); + $it = new myRecursiveCachingIterator(); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } try { - $it = new myParentIterator(); + $it = new myParentIterator(); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } try { - $it = new myLimitIterator(); + $it = new myLimitIterator(); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } try { - $it = new myNoRewindIterator(); + $it = new myNoRewindIterator(); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } diff --git a/ext/spl/tests/iterator_057.phpt b/ext/spl/tests/iterator_057.phpt index 61c1dfced6..e88e6a92b0 100644 --- a/ext/spl/tests/iterator_057.phpt +++ b/ext/spl/tests/iterator_057.phpt @@ -11,9 +11,9 @@ Sebastian Schürmann class myArrayIterator extends ArrayIterator { } try { - $it = new myArrayIterator(); + $it = new myArrayIterator(); } catch (InvalidArgumentException $e) { - echo 'InvalidArgumentException thrown'; + echo 'InvalidArgumentException thrown'; } echo 'no Exception thrown' ?> diff --git a/ext/spl/tests/iterator_058.phpt b/ext/spl/tests/iterator_058.phpt index 83d9d91feb..ebe7a1ed2c 100644 --- a/ext/spl/tests/iterator_058.phpt +++ b/ext/spl/tests/iterator_058.phpt @@ -6,17 +6,17 @@ Sebastian Schürmann <?php class myIterator implements Iterator { - function current() {} - function next() {} - function key() {} - function valid() {} - function rewind() {} + function current() {} + function next() {} + function key() {} + function valid() {} + function rewind() {} } try { - $it = new myIterator(); + $it = new myIterator(); } catch (InvalidArgumentException $e) { - echo 'InvalidArgumentException thrown'; + echo 'InvalidArgumentException thrown'; } echo 'no Exception thrown'; ?> diff --git a/ext/spl/tests/iterator_062.phpt b/ext/spl/tests/iterator_062.phpt index 3694cf1956..30011343d2 100644 --- a/ext/spl/tests/iterator_062.phpt +++ b/ext/spl/tests/iterator_062.phpt @@ -9,9 +9,9 @@ class myRecursiveIteratorIterator extends RecursiveIteratorIterator { } try { - $it = new myRecursiveIteratorIterator(); + $it = new myRecursiveIteratorIterator(); } catch (InvalidArgumentException $e) { - echo 'InvalidArgumentException thrown'; + echo 'InvalidArgumentException thrown'; } ?> --EXPECT-- diff --git a/ext/spl/tests/iterator_067.phpt b/ext/spl/tests/iterator_067.phpt index e05a48d4e0..3c35bd06f7 100644 --- a/ext/spl/tests/iterator_067.phpt +++ b/ext/spl/tests/iterator_067.phpt @@ -6,10 +6,10 @@ Sebastian Schürmann <?php class myAppendIterator extends AppendIterator {} try { - $it = new myAppendIterator(); - echo "no exception"; + $it = new myAppendIterator(); + echo "no exception"; } catch (InvalidArgumentException $e) { - echo 'InvalidArgumentException thrown'; + echo 'InvalidArgumentException thrown'; } ?> --EXPECT-- diff --git a/ext/spl/tests/iterator_068.phpt b/ext/spl/tests/iterator_068.phpt index d44b219fa5..00006a3b60 100644 --- a/ext/spl/tests/iterator_068.phpt +++ b/ext/spl/tests/iterator_068.phpt @@ -4,21 +4,21 @@ SPL: Iterator: Overloaded object and destruction <?php class Test implements Iterator { - function foo() { - echo __METHOD__ . "()\n"; - } - function rewind() {} - function valid() {} - function current() {} - function key() {} - function next() {} + function foo() { + echo __METHOD__ . "()\n"; + } + function rewind() {} + function valid() {} + function current() {} + function key() {} + function next() {} } class TestIteratorIterator extends IteratorIterator { - function __destruct() { - echo __METHOD__ . "()\n"; - $this->foo(); - } + function __destruct() { + echo __METHOD__ . "()\n"; + $this->foo(); + } } $obj = new TestIteratorIterator(new Test); diff --git a/ext/spl/tests/iterator_071.phpt b/ext/spl/tests/iterator_071.phpt index 9f48f6ee14..501771119a 100644 --- a/ext/spl/tests/iterator_071.phpt +++ b/ext/spl/tests/iterator_071.phpt @@ -11,7 +11,7 @@ $recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { function nextelement() { - echo __METHOD__."\n"; + echo __METHOD__."\n"; } } diff --git a/ext/spl/tests/multiple_iterator_001.phpt b/ext/spl/tests/multiple_iterator_001.phpt index be7eeeac7e..56a08da272 100644 --- a/ext/spl/tests/multiple_iterator_001.phpt +++ b/ext/spl/tests/multiple_iterator_001.phpt @@ -11,7 +11,7 @@ $m = new MultipleIterator(); echo "-- Default flags, no iterators --\n"; foreach($m as $value) { - var_dump($value); + var_dump($value); } var_dump($m->current()); @@ -24,17 +24,17 @@ echo "-- Default flags, MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_K var_dump($m->getFlags() === (MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC)); foreach($m as $key => $value) { - var_dump($key, $value); + var_dump($key, $value); } try { - $m->current(); + $m->current(); } catch(RuntimeException $e) { - echo "RuntimeException thrown: " . $e->getMessage() . "\n"; + echo "RuntimeException thrown: " . $e->getMessage() . "\n"; } try { - $m->key(); + $m->key(); } catch(RuntimeException $e) { - echo "RuntimeException thrown: " . $e->getMessage() . "\n"; + echo "RuntimeException thrown: " . $e->getMessage() . "\n"; } echo "-- Flags = MultipleIterator::MIT_NEED_ANY | MultipleIterator::MIT_KEYS_NUMERIC --\n"; @@ -43,7 +43,7 @@ $m->setFlags(MultipleIterator::MIT_NEED_ANY | MultipleIterator::MIT_KEYS_NUMERIC var_dump($m->getFlags() === (MultipleIterator::MIT_NEED_ANY | MultipleIterator::MIT_KEYS_NUMERIC)); foreach($m as $key => $value) { - var_dump($key, $value); + var_dump($key, $value); } echo "-- Default flags, added element --\n"; @@ -52,7 +52,7 @@ $m->setFlags(MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC $iter2[] = 3; foreach($m as $key => $value) { - var_dump($key, $value); + var_dump($key, $value); } echo "-- Flags |= MultipleIterator::MIT_KEYS_ASSOC, with iterator associated with NULL --\n"; @@ -60,9 +60,9 @@ echo "-- Flags |= MultipleIterator::MIT_KEYS_ASSOC, with iterator associated wit $m->setFlags(MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_ASSOC); $m->rewind(); try { - $m->current(); + $m->current(); } catch(InvalidArgumentException $e) { - echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n"; + echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n"; } echo "-- Flags |= MultipleIterator::MIT_KEYS_ASSOC --\n"; @@ -72,23 +72,23 @@ $m->attachIterator($iter2, "iter2"); $m->attachIterator($iter3, 3); foreach($m as $key => $value) { - var_dump($key, $value); + var_dump($key, $value); } echo "-- Associate with invalid value --\n"; try { - $m->attachIterator($iter3, new stdClass()); + $m->attachIterator($iter3, new stdClass()); } catch(InvalidArgumentException $e) { - echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n"; + echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n"; } echo "-- Associate with duplicate value --\n"; try { - $m->attachIterator($iter3, "iter1"); + $m->attachIterator($iter3, "iter1"); } catch(InvalidArgumentException $e) { - echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n"; + echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n"; } echo "-- Count, contains, detach, count, contains, iterate --\n"; @@ -99,7 +99,7 @@ var_dump($m->detachIterator($iter2)); var_dump($m->countIterators()); var_dump($m->containsIterator($iter2)); foreach($m as $key => $value) { - var_dump($key, $value); + var_dump($key, $value); } ?> diff --git a/ext/spl/tests/observer_001.phpt b/ext/spl/tests/observer_001.phpt index 05fe361dce..72feb08a40 100644 --- a/ext/spl/tests/observer_001.phpt +++ b/ext/spl/tests/observer_001.phpt @@ -5,66 +5,66 @@ SPL: SplObserver and SplSubject (empty notify) class ObserverImpl implements SplObserver { - protected $name = ''; - - function __construct($name = 'obj') - { - $this->name = '$' . $name; - } - - function update(SplSubject $subject) - { - echo $this->name . '->' . __METHOD__ . '(' . $subject->getName() . ");\n"; - } - - function getName() - { - return $this->name; - } + protected $name = ''; + + function __construct($name = 'obj') + { + $this->name = '$' . $name; + } + + function update(SplSubject $subject) + { + echo $this->name . '->' . __METHOD__ . '(' . $subject->getName() . ");\n"; + } + + function getName() + { + return $this->name; + } } class SubjectImpl implements SplSubject { - protected $name = ''; - protected $observers = array(); + protected $name = ''; + protected $observers = array(); - function __construct($name = 'sub') - { - $this->name = '$' . $name; - } + function __construct($name = 'sub') + { + $this->name = '$' . $name; + } function attach(SplObserver $observer) { - echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n"; - if (!in_array($observer, $this->observers)) - { - $this->observers[] = $observer; - } + echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n"; + if (!in_array($observer, $this->observers)) + { + $this->observers[] = $observer; + } } function detach(SplObserver $observer) { - echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n"; - $idx = array_search($observer, $this->observers); - if ($idx !== false) - { - unset($this->observers[$idx]); - } + echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n"; + $idx = array_search($observer, $this->observers); + if ($idx !== false) + { + unset($this->observers[$idx]); + } } function notify() { - echo '$sub->' . __METHOD__ . "();\n"; - foreach($this->observers as $observer) - { - $observer->update($this); - } + echo '$sub->' . __METHOD__ . "();\n"; + foreach($this->observers as $observer) + { + $observer->update($this); + } } - function getName() - { - return $this->name; - } + function getName() + { + return $this->name; + } } $sub = new SubjectImpl; diff --git a/ext/spl/tests/observer_002.phpt b/ext/spl/tests/observer_002.phpt index 3d5b31d483..2642c28bd5 100644 --- a/ext/spl/tests/observer_002.phpt +++ b/ext/spl/tests/observer_002.phpt @@ -5,103 +5,103 @@ SPL: SplObjectStorage class MyObjectStorage extends SplObjectStorage { - function rewind() - { - echo __METHOD__ . "()\n"; - parent::rewind(); - } - - function valid() - { - echo __METHOD__ . "(" . (parent::valid() ? 1 : 0) . ")\n"; - return parent::valid(); - } - - function key() - { - echo __METHOD__ . "(" . parent::key() . ")\n"; - return parent::key(); - } - - function current() - { - echo __METHOD__ . "(" . parent::current()->getName() . ")\n"; - return parent::current(); - } - - function next() - { - echo __METHOD__ . "()\n"; - parent::next(); - } + function rewind() + { + echo __METHOD__ . "()\n"; + parent::rewind(); + } + + function valid() + { + echo __METHOD__ . "(" . (parent::valid() ? 1 : 0) . ")\n"; + return parent::valid(); + } + + function key() + { + echo __METHOD__ . "(" . parent::key() . ")\n"; + return parent::key(); + } + + function current() + { + echo __METHOD__ . "(" . parent::current()->getName() . ")\n"; + return parent::current(); + } + + function next() + { + echo __METHOD__ . "()\n"; + parent::next(); + } } class ObserverImpl implements SplObserver { - protected $name = ''; - - function __construct($name = 'obj') - { - $this->name = '$' . $name; - } - - function update(SplSubject $subject) - { - echo $this->name . '->' . __METHOD__ . '(' . $subject->getName() . ");\n"; - } - - function getName() - { - return $this->name; - } + protected $name = ''; + + function __construct($name = 'obj') + { + $this->name = '$' . $name; + } + + function update(SplSubject $subject) + { + echo $this->name . '->' . __METHOD__ . '(' . $subject->getName() . ");\n"; + } + + function getName() + { + return $this->name; + } } class SubjectImpl implements SplSubject { - protected $name = ''; - protected $observers; - - function __construct($name = 'sub') - { - $this->observers = new MyObjectStorage; - $this->name = '$' . $name; - } - - function attach(SplObserver $observer) - { - echo $this->name . '->' . __METHOD__ . '(' . $observer->getName() . ");\n"; - $this->observers->attach($observer); - } - - function detach(SplObserver $observer) - { - echo $this->name . '->' . __METHOD__ . '(' . $observer->getName() . ");\n"; - $this->observers->detach($observer); - } - - function count() - { - return $this->observers->count(); - } - - function notify() - { - echo $this->name . '->' . __METHOD__ . "();\n"; - foreach($this->observers as $key => $observer) - { - $observer->update($this); - } - } - - function getName() - { - return $this->name; - } - - function contains($obj) - { - return $this->observers->contains($obj); - } + protected $name = ''; + protected $observers; + + function __construct($name = 'sub') + { + $this->observers = new MyObjectStorage; + $this->name = '$' . $name; + } + + function attach(SplObserver $observer) + { + echo $this->name . '->' . __METHOD__ . '(' . $observer->getName() . ");\n"; + $this->observers->attach($observer); + } + + function detach(SplObserver $observer) + { + echo $this->name . '->' . __METHOD__ . '(' . $observer->getName() . ");\n"; + $this->observers->detach($observer); + } + + function count() + { + return $this->observers->count(); + } + + function notify() + { + echo $this->name . '->' . __METHOD__ . "();\n"; + foreach($this->observers as $key => $observer) + { + $observer->update($this); + } + } + + function getName() + { + return $this->name; + } + + function contains($obj) + { + return $this->observers->contains($obj); + } } $sub = new SubjectImpl; diff --git a/ext/spl/tests/observer_003.phpt b/ext/spl/tests/observer_003.phpt index 1854210544..36ead92336 100644 --- a/ext/spl/tests/observer_003.phpt +++ b/ext/spl/tests/observer_003.phpt @@ -5,12 +5,12 @@ SPL: SplObjectStorage serialization class TestClass { - public $test = 25; + public $test = 25; - public function __construct($test = 42) - { - $this->test = $test; - } + public function __construct($test = 42) + { + $this->test = $test; + } } $storage = new SplObjectStorage(); @@ -24,7 +24,7 @@ var_dump(count($storage)); foreach($storage as $object) { - var_dump($object->test); + var_dump($object->test); } var_dump(serialize($storage)); @@ -36,7 +36,7 @@ var_dump(count($storage2)); foreach($storage2 as $object) { - var_dump($object->test); + var_dump($object->test); } ?> diff --git a/ext/spl/tests/observer_004.phpt b/ext/spl/tests/observer_004.phpt index be09734f80..7da7f1a651 100644 --- a/ext/spl/tests/observer_004.phpt +++ b/ext/spl/tests/observer_004.phpt @@ -5,22 +5,22 @@ SPL: SplObjectStorage serialization & overloading class TestClass { - public $test = 25; + public $test = 25; - public function __construct($test = 42) - { - $this->test = $test; - } + public function __construct($test = 42) + { + $this->test = $test; + } } class MyStorage extends SplObjectStorage { - public $bla = 25; + public $bla = 25; - public function __construct($bla = 26) - { - $this->bla = $bla; - } + public function __construct($bla = 26) + { + $this->bla = $bla; + } } $storage = new MyStorage(); @@ -34,7 +34,7 @@ var_dump(count($storage)); foreach($storage as $object) { - var_dump($object->test); + var_dump($object->test); } var_dump($storage); @@ -48,7 +48,7 @@ var_dump(count($storage2)); foreach($storage2 as $object) { - var_dump($object->test); + var_dump($object->test); } var_dump($storage2); diff --git a/ext/spl/tests/observer_005.phpt b/ext/spl/tests/observer_005.phpt index cf5db3bfda..57f632cfbc 100644 --- a/ext/spl/tests/observer_005.phpt +++ b/ext/spl/tests/observer_005.phpt @@ -5,17 +5,17 @@ SPL: SplObjectStorage serialization & visibility class TestClass { - public $def = 24; - public $pub = 25; - protected $pro = 26; - private $pri = 27; - - public function __construct($pub = 42, $pro = 43, $pri = 44) - { - $this->pub = $pub; - $this->pro = $pro; - $this->pri = $pri; - } + public $def = 24; + public $pub = 25; + protected $pro = 26; + private $pri = 27; + + public function __construct($pub = 42, $pro = 43, $pri = 44) + { + $this->pub = $pub; + $this->pro = $pro; + $this->pri = $pri; + } } class ExtTestClass @@ -24,17 +24,17 @@ class ExtTestClass class MyStorage extends SplObjectStorage { - public $def = 24; - public $pub = 25; - protected $pro = 26; - private $pri = 27; - - public function __construct($pub = 52, $pro = 53, $pri = 54) - { - $this->pub = $pub; - $this->pro = $pro; - $this->pri = $pri; - } + public $def = 24; + public $pub = 25; + protected $pro = 26; + private $pri = 27; + + public function __construct($pub = 52, $pro = 53, $pri = 54) + { + $this->pub = $pub; + $this->pro = $pro; + $this->pri = $pri; + } } class ExtStorage extends MyStorage @@ -52,7 +52,7 @@ var_dump(count($storage)); foreach($storage as $object) { - var_dump($object); + var_dump($object); } var_dump($storage); @@ -66,7 +66,7 @@ var_dump(count($storage2)); foreach($storage2 as $object) { - var_dump($object); + var_dump($object); } var_dump($storage2); diff --git a/ext/spl/tests/observer_006.phpt b/ext/spl/tests/observer_006.phpt index 89a3dabdbb..e130f469ad 100644 --- a/ext/spl/tests/observer_006.phpt +++ b/ext/spl/tests/observer_006.phpt @@ -5,22 +5,22 @@ SPL: SplObjectStorage with accociatied information class TestClass { - public $test = 25; + public $test = 25; - public function __construct($test = 42) - { - $this->test = $test; - } + public function __construct($test = 42) + { + $this->test = $test; + } } class MyStorage extends SplObjectStorage { - public $bla = 25; + public $bla = 25; - public function __construct($bla = 26) - { - $this->bla = $bla; - } + public function __construct($bla = 26) + { + $this->bla = $bla; + } } $storage = new MyStorage(); @@ -34,7 +34,7 @@ var_dump(count($storage)); foreach($storage as $object) { - var_dump($object->test); + var_dump($object->test); } var_dump($storage); @@ -48,7 +48,7 @@ var_dump(count($storage2)); foreach($storage2 as $object) { - var_dump($object->test); + var_dump($object->test); } var_dump($storage2); diff --git a/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt index cac0e2c479..e8b71ebb0d 100644 --- a/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt +++ b/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt @@ -11,7 +11,7 @@ $recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { function beginchildren() { - throw new Exception; + throw new Exception; } } diff --git a/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt index 1961517253..df66937525 100644 --- a/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt +++ b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt @@ -11,7 +11,7 @@ $recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { function callHasChildren() { - throw new Exception; + throw new Exception; } } diff --git a/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt index 941f92be82..7bd08d444f 100644 --- a/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt +++ b/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt @@ -11,7 +11,7 @@ $recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { function endchildren() { - throw new Exception; + throw new Exception; } } diff --git a/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt b/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt index dd4f038710..bd084f54e6 100644 --- a/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt +++ b/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt @@ -11,7 +11,7 @@ $recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { function nextelement() { - throw new Exception; + throw new Exception; } } diff --git a/ext/spl/tests/recursive_tree_iterator_001.phpt b/ext/spl/tests/recursive_tree_iterator_001.phpt index 693593f85a..c3172a58b7 100644 --- a/ext/spl/tests/recursive_tree_iterator_001.phpt +++ b/ext/spl/tests/recursive_tree_iterator_001.phpt @@ -4,44 +4,44 @@ SPL: RecursiveTreeIterator <?php $ary = array( - 0 => array( - "a", - 1, - ), - "a" => array( - 2, - "b", - 3 => array( - 4, - "c", - ), - "3" => array( - 4, - "c", - ), - ), + 0 => array( + "a", + 1, + ), + "a" => array( + 2, + "b", + 3 => array( + 4, + "c", + ), + "3" => array( + 4, + "c", + ), + ), ); $it = new RecursiveArrayIterator($ary); echo "-- flags = BYPASS_KEY --\n"; foreach(new RecursiveTreeIterator($it) as $k => $v) { - echo "[$k] => $v\n"; + echo "[$k] => $v\n"; } echo "-- flags = BYPASS_CURRENT --\n"; foreach(new RecursiveTreeIterator($it, RecursiveTreeIterator::BYPASS_CURRENT) as $k => $v) { - echo "[$k] => $v\n"; + echo "[$k] => $v\n"; } echo "-- flags = BYPASS_KEY|BYPASS_KEY --\n"; foreach(new RecursiveTreeIterator($it, RecursiveTreeIterator::BYPASS_CURRENT|RecursiveTreeIterator::BYPASS_KEY) as $k => $v) { - echo "[$k] => $v\n"; + echo "[$k] => $v\n"; } echo "-- flags = 0 --\n"; foreach(new RecursiveTreeIterator($it, 0) as $k => $v) { - echo "[$k] => $v\n"; + echo "[$k] => $v\n"; } echo "-- flags = 0, caching_it_flags = CachingIterator::CATCH_GET_CHILD --\n"; foreach(new RecursiveTreeIterator($it, 0, CachingIterator::CATCH_GET_CHILD) as $k => $v) { - echo "[$k] => $v\n"; + echo "[$k] => $v\n"; } ?> diff --git a/ext/spl/tests/recursive_tree_iterator_002.phpt b/ext/spl/tests/recursive_tree_iterator_002.phpt index a67e3d1c77..e32b3bd00e 100644 --- a/ext/spl/tests/recursive_tree_iterator_002.phpt +++ b/ext/spl/tests/recursive_tree_iterator_002.phpt @@ -5,9 +5,9 @@ error_reporting=E_ALL&~E_NOTICE --FILE-- <?php try { - new RecursiveTreeIterator(); + new RecursiveTreeIterator(); } catch (InvalidArgumentException $e) { - echo "InvalidArgumentException thrown\n"; + echo "InvalidArgumentException thrown\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/recursive_tree_iterator_003.phpt b/ext/spl/tests/recursive_tree_iterator_003.phpt index 84eef88d2f..c87f942f0d 100644 --- a/ext/spl/tests/recursive_tree_iterator_003.phpt +++ b/ext/spl/tests/recursive_tree_iterator_003.phpt @@ -3,7 +3,7 @@ SPL: RecursiveTreeIterator(non-traversable) --FILE-- <?php try { - new RecursiveTreeIterator(new ArrayIterator(array())); + new RecursiveTreeIterator(new ArrayIterator(array())); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } diff --git a/ext/spl/tests/recursive_tree_iterator_004.phpt b/ext/spl/tests/recursive_tree_iterator_004.phpt index 47ba4e880e..28fe8e05f2 100644 --- a/ext/spl/tests/recursive_tree_iterator_004.phpt +++ b/ext/spl/tests/recursive_tree_iterator_004.phpt @@ -6,27 +6,27 @@ error_reporting=E_ALL&~E_NOTICE <?php $ary = array( - 0 => array( - "a", - 1, - ), - "a" => array( - 2, - "b", - 3 => array( - 4, - "c", - ), - "3" => array( - 4, - "c", - ), - ), + 0 => array( + "a", + 1, + ), + "a" => array( + 2, + "b", + 3 => array( + 4, + "c", + ), + "3" => array( + 4, + "c", + ), + ), ); $it = new RecursiveTreeIterator(new RecursiveArrayIterator($ary)); foreach($it as $k => $v) { - echo '[' . $it->key() . '] => ' . $it->getPrefix() . $it->getEntry() . $it->getPostfix() . "\n"; + echo '[' . $it->key() . '] => ' . $it->getPrefix() . $it->getEntry() . $it->getPostfix() . "\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/recursive_tree_iterator_005.phpt b/ext/spl/tests/recursive_tree_iterator_005.phpt index 2b42267b44..a63b26685c 100644 --- a/ext/spl/tests/recursive_tree_iterator_005.phpt +++ b/ext/spl/tests/recursive_tree_iterator_005.phpt @@ -6,37 +6,37 @@ error_reporting=E_ALL&~E_NOTICE <?php $ary = array( - 0 => array( - (binary) "binary", - "abc2", - 1, - ), - (binary) "binary" => array( - 2, - "b", - 3 => array( - 4, - "c", - ), - "4abc" => array( - 4, - "c", - ), - ), + 0 => array( + (binary) "binary", + "abc2", + 1, + ), + (binary) "binary" => array( + 2, + "b", + 3 => array( + 4, + "c", + ), + "4abc" => array( + 4, + "c", + ), + ), ); $it = new RecursiveTreeIterator(new RecursiveArrayIterator($ary), 0); foreach($it as $k => $v) { - var_dump($v); + var_dump($v); } echo "\n----------------\n\n"; foreach($it as $k => $v) { - var_dump($k); + var_dump($k); } echo "\n----------------\n\n"; echo "key, getEntry, current:\n"; foreach($it as $k => $v) { - var_dump($it->key(), $it->getEntry(), $it->current()); + var_dump($it->key(), $it->getEntry(), $it->current()); } ?> --EXPECT-- diff --git a/ext/spl/tests/recursive_tree_iterator_006.phpt b/ext/spl/tests/recursive_tree_iterator_006.phpt index 96ef815a60..ba71586396 100644 --- a/ext/spl/tests/recursive_tree_iterator_006.phpt +++ b/ext/spl/tests/recursive_tree_iterator_006.phpt @@ -4,54 +4,54 @@ SPL: RecursiveTreeIterator and IteratorAggregate <?php $ary = array( - 0 => array( - "a", - 1, - ), - "a" => array( - 2, - "b", - 3 => array( - 4, - "c", - ), - "3" => array( - 4, - "c", - ), - ), + 0 => array( + "a", + 1, + ), + "a" => array( + 2, + "b", + 3 => array( + 4, + "c", + ), + "3" => array( + 4, + "c", + ), + ), ); class RecursiveArrayIteratorAggregated implements IteratorAggregate { - public $it; - function __construct($it) { - $this->it = new RecursiveArrayIterator($it); - } - function getIterator() { - return $this->it; - } + public $it; + function __construct($it) { + $this->it = new RecursiveArrayIterator($it); + } + function getIterator() { + return $this->it; + } } $it = new RecursiveArrayIteratorAggregated($ary); echo "-- flags = BYPASS_KEY --\n"; foreach(new RecursiveTreeIterator($it) as $k => $v) { - echo "[$k] => $v\n"; + echo "[$k] => $v\n"; } echo "-- flags = BYPASS_CURRENT --\n"; foreach(new RecursiveTreeIterator($it, RecursiveTreeIterator::BYPASS_CURRENT) as $k => $v) { - echo "[$k] => $v\n"; + echo "[$k] => $v\n"; } echo "-- flags = BYPASS_KEY|BYPASS_KEY --\n"; foreach(new RecursiveTreeIterator($it, RecursiveTreeIterator::BYPASS_CURRENT|RecursiveTreeIterator::BYPASS_KEY) as $k => $v) { - echo "[$k] => $v\n"; + echo "[$k] => $v\n"; } echo "-- flags = 0 --\n"; foreach(new RecursiveTreeIterator($it, 0) as $k => $v) { - echo "[$k] => $v\n"; + echo "[$k] => $v\n"; } echo "-- flags = 0, caching_it_flags = CachingIterator::CATCH_GET_CHILD --\n"; foreach(new RecursiveTreeIterator($it, 0, CachingIterator::CATCH_GET_CHILD) as $k => $v) { - echo "[$k] => $v\n"; + echo "[$k] => $v\n"; } ?> diff --git a/ext/spl/tests/recursive_tree_iterator_007.phpt b/ext/spl/tests/recursive_tree_iterator_007.phpt index fc60d70383..196f6a1d90 100644 --- a/ext/spl/tests/recursive_tree_iterator_007.phpt +++ b/ext/spl/tests/recursive_tree_iterator_007.phpt @@ -8,22 +8,22 @@ error_reporting=E_ALL&~E_NOTICE $ary = array(new stdClass); class RecursiveArrayIteratorAggregated implements IteratorAggregate { - public $it; - function __construct($it) { - $this->it = new RecursiveArrayIterator($it); - } - function getIterator() { - return $this->it; - } + public $it; + function __construct($it) { + $this->it = new RecursiveArrayIterator($it); + } + function getIterator() { + return $this->it; + } } $it = new RecursiveArrayIteratorAggregated($ary); try { - foreach(new RecursiveTreeIterator($it) as $k => $v) { - echo "[$k] => $v\n"; - } + foreach(new RecursiveTreeIterator($it) as $k => $v) { + echo "[$k] => $v\n"; + } } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } ?> diff --git a/ext/spl/tests/recursive_tree_iterator_008.phpt b/ext/spl/tests/recursive_tree_iterator_008.phpt index 5a522ef65f..fbdc3a5cb1 100644 --- a/ext/spl/tests/recursive_tree_iterator_008.phpt +++ b/ext/spl/tests/recursive_tree_iterator_008.phpt @@ -6,28 +6,28 @@ error_reporting=E_ALL&~E_NOTICE <?php $ary = array( - "a" => array("b"), - "c" => array("d"), + "a" => array("b"), + "c" => array("d"), ); $it = new RecursiveArrayIterator($ary); $it = new RecursiveTreeIterator($it); for($i = 0; $i < 6; ++$i) { - $it->setPrefixPart($i, $i); + $it->setPrefixPart($i, $i); } foreach($it as $k => $v) { - echo "[$k] => $v\n"; + echo "[$k] => $v\n"; } try { - $it->setPrefixPart(-1, ""); - $it->setPrefixPart(6, ""); + $it->setPrefixPart(-1, ""); + $it->setPrefixPart(6, ""); } catch (OutOfRangeException $e) { - echo "OutOfRangeException thrown\n"; + echo "OutOfRangeException thrown\n"; } try { - $it->setPrefixPart(6, ""); + $it->setPrefixPart(6, ""); } catch (OutOfRangeException $e) { - echo "OutOfRangeException thrown\n"; + echo "OutOfRangeException thrown\n"; } ?> --EXPECT-- diff --git a/ext/spl/tests/recursive_tree_iterator_setpostfix.phpt b/ext/spl/tests/recursive_tree_iterator_setpostfix.phpt index 8b39c32d54..eea4da795a 100644 --- a/ext/spl/tests/recursive_tree_iterator_setpostfix.phpt +++ b/ext/spl/tests/recursive_tree_iterator_setpostfix.phpt @@ -6,22 +6,22 @@ Joshua Thijssen (jthijssen@noxlogic.nl) <?php $arr = array( - 0 => array( - "a", - 1, - ), - "a" => array( - 2, - "b", - 3 => array( - 4, - "c", - ), - "3" => array( - 4, - "c", - ), - ), + 0 => array( + "a", + 1, + ), + "a" => array( + 2, + "b", + 3 => array( + 4, + "c", + ), + "3" => array( + 4, + "c", + ), + ), ); $it = new RecursiveArrayIterator($arr); @@ -38,7 +38,7 @@ echo "\n\n"; echo "----\n"; foreach($it as $k => $v) { - echo "[$k] => $v\n"; + echo "[$k] => $v\n"; } echo "----\n"; @@ -48,7 +48,7 @@ echo "\n\n"; echo "----\n"; foreach($it as $k => $v) { - echo "[$k] => $v\n"; + echo "[$k] => $v\n"; } diff --git a/ext/spl/tests/recursivecomparedualiterator.inc b/ext/spl/tests/recursivecomparedualiterator.inc index 5b63e9f0b3..ad0657b9bd 100644 --- a/ext/spl/tests/recursivecomparedualiterator.inc +++ b/ext/spl/tests/recursivecomparedualiterator.inc @@ -16,54 +16,54 @@ */ class RecursiveCompareDualIterator extends RecursiveIteratorIterator { - /** Used to keep end of recursion equality. That is en leaving a nesting - * level we need to check whether both child iterators are at their end. - */ - protected $equal = false; + /** Used to keep end of recursion equality. That is en leaving a nesting + * level we need to check whether both child iterators are at their end. + */ + protected $equal = false; - /** Construct from RecursiveDualIterator - * - * @param $it RecursiveDualIterator - * @param $mode should be LEAVES_ONLY - * @param $flags should be 0 - */ - function __construct(RecursiveDualIterator $it, $mode = self::LEAVES_ONLY, $flags = 0) - { - parent::__construct($it); - } + /** Construct from RecursiveDualIterator + * + * @param $it RecursiveDualIterator + * @param $mode should be LEAVES_ONLY + * @param $flags should be 0 + */ + function __construct(RecursiveDualIterator $it, $mode = self::LEAVES_ONLY, $flags = 0) + { + parent::__construct($it); + } - /** Rewind iteration andcomparison process. Starting with $equal = true. - */ - function rewind() - { - $this->equal = true; - parent::rewind(); - } + /** Rewind iteration andcomparison process. Starting with $equal = true. + */ + function rewind() + { + $this->equal = true; + parent::rewind(); + } - /** Calculate $equal - * @see $equal - */ - function endChildren() - { - $this->equal &= !$this->getInnerIterator()->getLHS()->valid() - && !$this->getInnerIterator()->getRHS()->valid(); - } + /** Calculate $equal + * @see $equal + */ + function endChildren() + { + $this->equal &= !$this->getInnerIterator()->getLHS()->valid() + && !$this->getInnerIterator()->getRHS()->valid(); + } - /** @return whether both inner iterators are valid and have identical - * current and key values or both are non valid. - */ - function areIdentical() - { - return $this->equal && $this->getInnerIterator()->areIdentical(); - } + /** @return whether both inner iterators are valid and have identical + * current and key values or both are non valid. + */ + function areIdentical() + { + return $this->equal && $this->getInnerIterator()->areIdentical(); + } - /** @return whether both inner iterators are valid and have equal current - * and key values or both are non valid. - */ - function areEqual() - { - return $this->equal && $this->getInnerIterator()->areEqual(); - } + /** @return whether both inner iterators are valid and have equal current + * and key values or both are non valid. + */ + function areEqual() + { + return $this->equal && $this->getInnerIterator()->areEqual(); + } } ?> diff --git a/ext/spl/tests/recursivedualiterator.inc b/ext/spl/tests/recursivedualiterator.inc index a56984e083..45abf4c8f4 100644 --- a/ext/spl/tests/recursivedualiterator.inc +++ b/ext/spl/tests/recursivedualiterator.inc @@ -16,57 +16,57 @@ */ class RecursiveDualIterator extends DualIterator implements RecursiveIterator { - private $ref; + private $ref; - /** construct iterator from two RecursiveIterator instances - * - * @param lhs Left Hand Side Iterator - * @param rhs Right Hand Side Iterator - * @param flags iteration flags - */ - function __construct(RecursiveIterator $lhs, RecursiveIterator $rhs, - $flags = 0x33 /*DualIterator::DEFAULT_FLAGS*/) - { - parent::__construct($lhs, $rhs, $flags); - } + /** construct iterator from two RecursiveIterator instances + * + * @param lhs Left Hand Side Iterator + * @param rhs Right Hand Side Iterator + * @param flags iteration flags + */ + function __construct(RecursiveIterator $lhs, RecursiveIterator $rhs, + $flags = 0x33 /*DualIterator::DEFAULT_FLAGS*/) + { + parent::__construct($lhs, $rhs, $flags); + } - /** @return whether both LHS and RHS have children - */ - function hasChildren() - { - return $this->getLHS()->hasChildren() && $this->getRHS()->hasChildren(); - } + /** @return whether both LHS and RHS have children + */ + function hasChildren() + { + return $this->getLHS()->hasChildren() && $this->getRHS()->hasChildren(); + } - /** @return new RecursiveDualIterator (late binding) for the two inner - * iterators current children. - */ - function getChildren() - { - if (empty($this->ref)) - { - $this->ref = new ReflectionClass($this); - } - return $this->ref->newInstance( - $this->getLHS()->getChildren(), $this->getRHS()->getChildren(), $this->getFlags()); - } + /** @return new RecursiveDualIterator (late binding) for the two inner + * iterators current children. + */ + function getChildren() + { + if (empty($this->ref)) + { + $this->ref = new ReflectionClass($this); + } + return $this->ref->newInstance( + $this->getLHS()->getChildren(), $this->getRHS()->getChildren(), $this->getFlags()); + } - /** @return whether both inner iterators are valid, have same hasChildren() - * state and identical current and key values or both are non valid. - */ - function areIdentical() - { - return $this->getLHS()->hasChildren() === $this->getRHS()->hasChildren() - && parent::areIdentical(); - } + /** @return whether both inner iterators are valid, have same hasChildren() + * state and identical current and key values or both are non valid. + */ + function areIdentical() + { + return $this->getLHS()->hasChildren() === $this->getRHS()->hasChildren() + && parent::areIdentical(); + } - /** @return whether both inner iterators are valid, have same hasChildren() - * state and equal current and key values or both are invalid. - */ - function areEqual() - { - return $this->getLHS()->hasChildren() === $this->getRHS()->hasChildren() - && parent::areEqual(); - } + /** @return whether both inner iterators are valid, have same hasChildren() + * state and equal current and key values or both are invalid. + */ + function areEqual() + { + return $this->getLHS()->hasChildren() === $this->getRHS()->hasChildren() + && parent::areEqual(); + } } ?> diff --git a/ext/spl/tests/regexIterator_setMode_error.phpt b/ext/spl/tests/regexIterator_setMode_error.phpt index 046086102b..4816896d8a 100644 --- a/ext/spl/tests/regexIterator_setMode_error.phpt +++ b/ext/spl/tests/regexIterator_setMode_error.phpt @@ -11,10 +11,10 @@ $regexIterator = new RegexIterator(new ArrayIterator($array), "/f/"); var_dump($regexIterator->getMode()); try { - $regexIterator->setMode(7); + $regexIterator->setMode(7); } catch (InvalidArgumentException $e) { - var_dump($e->getMessage()); - var_dump($e->getCode()); + var_dump($e->getMessage()); + var_dump($e->getCode()); } ?> diff --git a/ext/spl/tests/spl_001.phpt b/ext/spl/tests/spl_001.phpt index 98eec24ded..4fc0be3d0c 100644 --- a/ext/spl/tests/spl_001.phpt +++ b/ext/spl/tests/spl_001.phpt @@ -13,7 +13,7 @@ print_r($ar); foreach($ar as $v) { - var_dump($v); + var_dump($v); } ?> diff --git a/ext/spl/tests/spl_002.phpt b/ext/spl/tests/spl_002.phpt index e8e9424a21..5442b1991d 100644 --- a/ext/spl/tests/spl_002.phpt +++ b/ext/spl/tests/spl_002.phpt @@ -5,10 +5,10 @@ SPL: Countable class Test implements Countable { - function count() - { - return 4; - } + function count() + { + return 4; + } }; $a = new Test; diff --git a/ext/spl/tests/spl_004.phpt b/ext/spl/tests/spl_004.phpt index 7563f28001..570b4ae226 100644 --- a/ext/spl/tests/spl_004.phpt +++ b/ext/spl/tests/spl_004.phpt @@ -4,30 +4,30 @@ SPL: iterator_apply() <?php function my_error_handler($errno, $errstr, $errfile, $errline) { - echo "Error: $errstr\n"; + echo "Error: $errstr\n"; } set_error_handler('my_error_handler'); function test_arg($arg) { - if ($arg instanceof Iterator) - { - var_dump($arg->key()); - var_dump($arg->current()); - } - else - { - var_dump($arg); - } - return true; + if ($arg instanceof Iterator) + { + var_dump($arg->key()); + var_dump($arg->current()); + } + else + { + var_dump($arg); + } + return true; } function test() { - static $arg = 0; - var_dump($arg++); - return true; + static $arg = 0; + var_dump($arg++); + return true; } $it = new RecursiveArrayIterator(array(1, array(21, 22), 3)); @@ -43,7 +43,7 @@ var_dump(iterator_apply($it, 'test')); echo "===ERRORS===\n"; try { - var_dump(iterator_apply($it, 'test', 1)); + var_dump(iterator_apply($it, 'test', 1)); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } diff --git a/ext/spl/tests/spl_autoload_001.phpt b/ext/spl/tests/spl_autoload_001.phpt index 8801d13833..6025ac6538 100644 --- a/ext/spl/tests/spl_autoload_001.phpt +++ b/ext/spl/tests/spl_autoload_001.phpt @@ -17,7 +17,7 @@ if (!class_exists("TestClass")) { $test_exts = array(NULL, "1", ".inc,,.php.inc", ""); foreach($test_exts as $exts) { - echo "===($exts)===\n"; + echo "===($exts)===\n"; spl_autoload("TestClass", $exts); if (!class_exists("TestClass")) { echo "Class TestClass could not be loaded\n"; @@ -32,12 +32,12 @@ if (!class_exists("TestClass")) { function TestFunc1($classname) { - echo __METHOD__ . "($classname)\n"; + echo __METHOD__ . "($classname)\n"; } function TestFunc2($classname) { - echo __METHOD__ . "($classname)\n"; + echo __METHOD__ . "($classname)\n"; } echo "===SPL_AUTOLOAD()===\n"; @@ -66,11 +66,11 @@ echo "===NOFUNCTION===\n"; try { - spl_autoload_register("unavailable_autoload_function"); + spl_autoload_register("unavailable_autoload_function"); } catch(Exception $e) { - echo 'Exception: ' . $e->getMessage() . "\n"; + echo 'Exception: ' . $e->getMessage() . "\n"; } ?> diff --git a/ext/spl/tests/spl_autoload_003.phpt b/ext/spl/tests/spl_autoload_003.phpt index e9af346814..016bcf2394 100644 --- a/ext/spl/tests/spl_autoload_003.phpt +++ b/ext/spl/tests/spl_autoload_003.phpt @@ -7,18 +7,18 @@ include_path=. function TestFunc1($classname) { - echo __METHOD__ . "($classname)\n"; + echo __METHOD__ . "($classname)\n"; } function TestFunc2($classname) { - echo __METHOD__ . "($classname)\n"; - throw new Exception("Class $classname missing"); + echo __METHOD__ . "($classname)\n"; + throw new Exception("Class $classname missing"); } function TestFunc3($classname) { - echo __METHOD__ . "($classname)\n"; + echo __METHOD__ . "($classname)\n"; } spl_autoload_register("TestFunc1"); @@ -27,11 +27,11 @@ spl_autoload_register("TestFunc3"); try { - var_dump(class_exists("TestClass", true)); + var_dump(class_exists("TestClass", true)); } catch(Exception $e) { - echo 'Exception: ' . $e->getMessage() . "\n"; + echo 'Exception: ' . $e->getMessage() . "\n"; } ?> diff --git a/ext/spl/tests/spl_autoload_004.phpt b/ext/spl/tests/spl_autoload_004.phpt index 800112e262..8e1eafc37a 100644 --- a/ext/spl/tests/spl_autoload_004.phpt +++ b/ext/spl/tests/spl_autoload_004.phpt @@ -8,7 +8,7 @@ include_path=. class MyAutoLoader { static function autoLoad($className) { - echo __METHOD__ . "($className)\n"; + echo __METHOD__ . "($className)\n"; } } diff --git a/ext/spl/tests/spl_autoload_005.phpt b/ext/spl/tests/spl_autoload_005.phpt index 7e060494b3..53fbf27663 100644 --- a/ext/spl/tests/spl_autoload_005.phpt +++ b/ext/spl/tests/spl_autoload_005.phpt @@ -9,23 +9,23 @@ class MyAutoLoader { function autoLoad($className) { - echo __METHOD__ . "($className)\n"; + echo __METHOD__ . "($className)\n"; } function autoThrow($className) { - echo __METHOD__ . "($className)\n"; - throw new Exception("Unavailable"); + echo __METHOD__ . "($className)\n"; + throw new Exception("Unavailable"); } } try { - spl_autoload_register(array('MyAutoLoader', 'autoLoad'), true); + spl_autoload_register(array('MyAutoLoader', 'autoLoad'), true); } catch(Exception $e) { - echo 'Exception: ' . $e->getMessage() . "\n"; + echo 'Exception: ' . $e->getMessage() . "\n"; } // and @@ -37,11 +37,11 @@ spl_autoload_register(array($myAutoLoader, 'autoThrow')); try { - var_dump(class_exists("TestClass", true)); + var_dump(class_exists("TestClass", true)); } catch(Exception $e) { - echo 'Exception: ' . $e->getMessage() . "\n"; + echo 'Exception: ' . $e->getMessage() . "\n"; } ?> diff --git a/ext/spl/tests/spl_autoload_006.phpt b/ext/spl/tests/spl_autoload_006.phpt index 5c0505cfe3..7db2b462ca 100644 --- a/ext/spl/tests/spl_autoload_006.phpt +++ b/ext/spl/tests/spl_autoload_006.phpt @@ -8,7 +8,7 @@ include_path=. class MyAutoLoader { static function autoLoad($className) { - echo __METHOD__ . "($className)\n"; + echo __METHOD__ . "($className)\n"; } } diff --git a/ext/spl/tests/spl_autoload_007.phpt b/ext/spl/tests/spl_autoload_007.phpt index 44c5eb5fc3..db5f394260 100644 --- a/ext/spl/tests/spl_autoload_007.phpt +++ b/ext/spl/tests/spl_autoload_007.phpt @@ -8,48 +8,48 @@ include_path=. class MyAutoLoader { static protected function noAccess($className) { - echo __METHOD__ . "($className)\n"; + echo __METHOD__ . "($className)\n"; } static function autoLoad($className) { - echo __METHOD__ . "($className)\n"; + echo __METHOD__ . "($className)\n"; } function dynaLoad($className) { - echo __METHOD__ . "($className)\n"; + echo __METHOD__ . "($className)\n"; } } $obj = new MyAutoLoader; $funcs = array( - 'MyAutoLoader::notExist', - 'MyAutoLoader::noAccess', - 'MyAutoLoader::autoLoad', - 'MyAutoLoader::dynaLoad', - array('MyAutoLoader', 'notExist'), - array('MyAutoLoader', 'noAccess'), - array('MyAutoLoader', 'autoLoad'), - array('MyAutoLoader', 'dynaLoad'), - array($obj, 'notExist'), - array($obj, 'noAccess'), - array($obj, 'autoLoad'), - array($obj, 'dynaLoad'), + 'MyAutoLoader::notExist', + 'MyAutoLoader::noAccess', + 'MyAutoLoader::autoLoad', + 'MyAutoLoader::dynaLoad', + array('MyAutoLoader', 'notExist'), + array('MyAutoLoader', 'noAccess'), + array('MyAutoLoader', 'autoLoad'), + array('MyAutoLoader', 'dynaLoad'), + array($obj, 'notExist'), + array($obj, 'noAccess'), + array($obj, 'autoLoad'), + array($obj, 'dynaLoad'), ); foreach($funcs as $idx => $func) { - if ($idx) echo "\n"; - try - { - var_dump($func); - spl_autoload_register($func); - echo "ok\n"; - } - catch (Exception $e) - { - echo $e->getMessage() . "\n"; - } + if ($idx) echo "\n"; + try + { + var_dump($func); + spl_autoload_register($func); + echo "ok\n"; + } + catch (Exception $e) + { + echo $e->getMessage() . "\n"; + } } ?> diff --git a/ext/spl/tests/spl_autoload_008.phpt b/ext/spl/tests/spl_autoload_008.phpt index 85718014dd..eadc861ca1 100644 --- a/ext/spl/tests/spl_autoload_008.phpt +++ b/ext/spl/tests/spl_autoload_008.phpt @@ -7,59 +7,59 @@ include_path=. function MyAutoLoad($className) { - echo __METHOD__ . "($className)\n"; - throw new Exception('Bla'); + echo __METHOD__ . "($className)\n"; + throw new Exception('Bla'); } class MyAutoLoader { - static function autoLoad($className) - { - echo __METHOD__ . "($className)\n"; - throw new Exception('Bla'); - } + static function autoLoad($className) + { + echo __METHOD__ . "($className)\n"; + throw new Exception('Bla'); + } - function dynaLoad($className) - { - echo __METHOD__ . "($className)\n"; - throw new Exception('Bla'); - } + function dynaLoad($className) + { + echo __METHOD__ . "($className)\n"; + throw new Exception('Bla'); + } } $obj = new MyAutoLoader; $funcs = array( - 'MyAutoLoad', - 'MyAutoLoader::autoLoad', - 'MyAutoLoader::dynaLoad', - array('MyAutoLoader', 'autoLoad'), - array('MyAutoLoader', 'dynaLoad'), - array($obj, 'autoLoad'), - array($obj, 'dynaLoad'), + 'MyAutoLoad', + 'MyAutoLoader::autoLoad', + 'MyAutoLoader::dynaLoad', + array('MyAutoLoader', 'autoLoad'), + array('MyAutoLoader', 'dynaLoad'), + array($obj, 'autoLoad'), + array($obj, 'dynaLoad'), ); foreach($funcs as $idx => $func) { - echo "====$idx====\n"; + echo "====$idx====\n"; - try - { - var_dump($func); - spl_autoload_register($func); - if (count(spl_autoload_functions())) - { - echo "registered\n"; + try + { + var_dump($func); + spl_autoload_register($func); + if (count(spl_autoload_functions())) + { + echo "registered\n"; - var_dump(class_exists("NoExistingTestClass", true)); - } - } - catch (Exception $e) - { - echo get_class($e) . ": " . $e->getMessage() . "\n"; - } + var_dump(class_exists("NoExistingTestClass", true)); + } + } + catch (Exception $e) + { + echo get_class($e) . ": " . $e->getMessage() . "\n"; + } - spl_autoload_unregister($func); - var_dump(count(spl_autoload_functions())); + spl_autoload_unregister($func); + var_dump(count(spl_autoload_functions())); } ?> diff --git a/ext/spl/tests/spl_autoload_009.phpt b/ext/spl/tests/spl_autoload_009.phpt index 10973ae44a..f12fd0af7e 100644 --- a/ext/spl/tests/spl_autoload_009.phpt +++ b/ext/spl/tests/spl_autoload_009.phpt @@ -7,8 +7,8 @@ include_path=. function my_autoload($name) { - require $name . '.class.inc'; - var_dump(class_exists($name)); + require $name . '.class.inc'; + var_dump(class_exists($name)); } spl_autoload_register("spl_autoload"); diff --git a/ext/spl/tests/spl_fileinfo_getlinktarget_basic.phpt b/ext/spl/tests/spl_fileinfo_getlinktarget_basic.phpt index cee557e330..92aae6dc78 100644 --- a/ext/spl/tests/spl_fileinfo_getlinktarget_basic.phpt +++ b/ext/spl/tests/spl_fileinfo_getlinktarget_basic.phpt @@ -13,7 +13,7 @@ symlink(__FILE__, $link ); $fileInfo = new SplFileInfo($link); if ($fileInfo->isLink()) { - echo $fileInfo->getLinkTarget() == __FILE__ ? 'same' : 'different',PHP_EOL; + echo $fileInfo->getLinkTarget() == __FILE__ ? 'same' : 'different',PHP_EOL; } var_dump(unlink($link)); ?> diff --git a/ext/spl/tests/spl_heap_count_basic.phpt b/ext/spl/tests/spl_heap_count_basic.phpt index 3bdd6580dc..2be8c432fc 100644 --- a/ext/spl/tests/spl_heap_count_basic.phpt +++ b/ext/spl/tests/spl_heap_count_basic.phpt @@ -24,9 +24,9 @@ class MyHeap extends SplHeap $heap = new MyHeap(); $heap->insert(1); try { - count($heap);// refers to MyHeap->count() method + count($heap);// refers to MyHeap->count() method } catch (Exception $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } ?> diff --git a/ext/spl/tests/spl_iterator_apply_error.phpt b/ext/spl/tests/spl_iterator_apply_error.phpt index 8e7cba483a..c73fe468a1 100644 --- a/ext/spl/tests/spl_iterator_apply_error.phpt +++ b/ext/spl/tests/spl_iterator_apply_error.phpt @@ -4,9 +4,9 @@ SPL: Error: iterator_apply when an iterator method (eg rewind) throws exception <?php class MyArrayIterator extends ArrayIterator { - public function rewind() { - throw new Exception('Make the iterator break'); - } + public function rewind() { + throw new Exception('Make the iterator break'); + } } function test() {} @@ -14,9 +14,9 @@ function test() {} $it = new MyArrayIterator(array(1, 21, 22)); try { - $res = iterator_apply($it, 'test'); + $res = iterator_apply($it, 'test'); } catch (Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/spl/tests/spl_iterator_apply_error_001.phpt b/ext/spl/tests/spl_iterator_apply_error_001.phpt index 54663c0da8..9c021cf98f 100644 --- a/ext/spl/tests/spl_iterator_apply_error_001.phpt +++ b/ext/spl/tests/spl_iterator_apply_error_001.phpt @@ -4,15 +4,15 @@ SPL: Error: iterator_apply when the callback throws an exception <?php function test() { - throw new Exception('Broken callback'); + throw new Exception('Broken callback'); } $it = new RecursiveArrayIterator(array(1, 21, 22)); try { - iterator_apply($it, 'test'); + iterator_apply($it, 'test'); } catch (Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> diff --git a/ext/spl/tests/spl_iterator_to_array_error.phpt b/ext/spl/tests/spl_iterator_to_array_error.phpt index 755ef7b990..2704fea29d 100644 --- a/ext/spl/tests/spl_iterator_to_array_error.phpt +++ b/ext/spl/tests/spl_iterator_to_array_error.phpt @@ -4,25 +4,25 @@ SPL: Error: iterator_to_array when the current operation throws an exception <?php class MyArrayIterator extends ArrayIterator { - public function current() { - throw new Exception('Make the iterator break'); - } + public function current() { + throw new Exception('Make the iterator break'); + } } $it = new MyArrayIterator(array(4, 6, 2)); try { - // get keys - $ar = iterator_to_array($it); + // get keys + $ar = iterator_to_array($it); } catch (Exception $e) { - echo $e->getMessage() . PHP_EOL; + echo $e->getMessage() . PHP_EOL; } try { - // get values - $ar = iterator_to_array($it, false); + // get values + $ar = iterator_to_array($it, false); } catch (Exception $e) { - echo $e->getMessage() . PHP_EOL; + echo $e->getMessage() . PHP_EOL; } ?> diff --git a/ext/spl/tests/spl_pq_top_error_corrupt.phpt b/ext/spl/tests/spl_pq_top_error_corrupt.phpt index 30b6fde5a1..838e763447 100644 --- a/ext/spl/tests/spl_pq_top_error_corrupt.phpt +++ b/ext/spl/tests/spl_pq_top_error_corrupt.phpt @@ -8,13 +8,13 @@ Nathaniel McHugh nat@fishtrap.co.uk class myPriorityQueue extends SplPriorityQueue{ - public function compare($a, $b){ - if ($b == 2) { - throw new Exception('ignore me'); - } else { - return parent::compare($a, $b); - } - } + public function compare($a, $b){ + if ($b == 2) { + throw new Exception('ignore me'); + } else { + return parent::compare($a, $b); + } + } } $priorityQueue = new myPriorityQueue(); diff --git a/ext/spl/tests/spl_pqueue_gc.phpt b/ext/spl/tests/spl_pqueue_gc.phpt index cc392cbac2..18c96c5a29 100644 --- a/ext/spl/tests/spl_pqueue_gc.phpt +++ b/ext/spl/tests/spl_pqueue_gc.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #78436: Broken GC for SplPriorityQueue --FILE-- -<?php +<?php $pqueue = new SplPriorityQueue(); $pqueue->insert($pqueue, 1); diff --git a/ext/spl/tests/unserialize.phpt b/ext/spl/tests/unserialize.phpt index 81b0894990..97031ceac4 100644 --- a/ext/spl/tests/unserialize.phpt +++ b/ext/spl/tests/unserialize.phpt @@ -6,16 +6,16 @@ SPL: unserialize with no data (for PHPUnit) $types = array('SplDoublyLinkedList', 'SplObjectStorage', 'ArrayObject'); foreach ($types as $type) { - // serialize an empty new object - $exp = serialize(new $type()); - // hack to instantiate an object without constructor - $str = sprintf('C:%d:"%s":0:{}', strlen($type), $type); - $obj = unserialize($str); - var_dump($obj); - // serialize result - $out = serialize($obj); - // both should match - var_dump($exp === $out); + // serialize an empty new object + $exp = serialize(new $type()); + // hack to instantiate an object without constructor + $str = sprintf('C:%d:"%s":0:{}', strlen($type), $type); + $obj = unserialize($str); + var_dump($obj); + // serialize result + $out = serialize($obj); + // both should match + var_dump($exp === $out); } ?> --EXPECTF-- diff --git a/ext/sqlite3/tests/bug45798.phpt b/ext/sqlite3/tests/bug45798.phpt index 9637c1fc9b..7184d58d54 100644 --- a/ext/sqlite3/tests/bug45798.phpt +++ b/ext/sqlite3/tests/bug45798.phpt @@ -18,7 +18,7 @@ $stmt->bindParam(1, $foo, SQLITE3_TEXT); $results = $stmt->execute(); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/bug68760.phpt b/ext/sqlite3/tests/bug68760.phpt index 7eb97ee013..7cc646780b 100644 --- a/ext/sqlite3/tests/bug68760.phpt +++ b/ext/sqlite3/tests/bug68760.phpt @@ -7,8 +7,8 @@ if (!extension_loaded('sqlite3')) die('skip'); --FILE-- <?php function oopsFunction($a, $b) { - echo "callback".PHP_EOL; - throw new \Exception("oops"); + echo "callback".PHP_EOL; + throw new \Exception("oops"); } $db = new SQLite3(":memory:"); diff --git a/ext/sqlite3/tests/bug72668.phpt b/ext/sqlite3/tests/bug72668.phpt index 2845fa0a7c..6f566d2df1 100644 --- a/ext/sqlite3/tests/bug72668.phpt +++ b/ext/sqlite3/tests/bug72668.phpt @@ -6,33 +6,33 @@ if (!extension_loaded('sqlite3')) die('skip'); ?> --FILE-- <?php function my_udf_md5($string) { - throw new \Exception("test exception\n"); + throw new \Exception("test exception\n"); } $db = new SQLite3(':memory:'); $db->createFunction('my_udf_md5', 'my_udf_md5'); try { - $result = $db->query('SELECT my_udf_md5("test")'); - var_dump($result); + $result = $db->query('SELECT my_udf_md5("test")'); + var_dump($result); } catch(\Exception $e) { - echo "Exception: ".$e->getMessage(); + echo "Exception: ".$e->getMessage(); } try { - $result = $db->querySingle('SELECT my_udf_md5("test")'); - var_dump($result); + $result = $db->querySingle('SELECT my_udf_md5("test")'); + var_dump($result); } catch(\Exception $e) { - echo "Exception: ".$e->getMessage(); + echo "Exception: ".$e->getMessage(); } $statement = $db->prepare('SELECT my_udf_md5("test")'); try { - $result = $statement->execute(); - var_dump($result); + $result = $statement->execute(); + var_dump($result); } catch(\Exception $e) { - echo "Exception: ".$e->getMessage(); + echo "Exception: ".$e->getMessage(); } ?> --EXPECT-- diff --git a/ext/sqlite3/tests/skipif.inc b/ext/sqlite3/tests/skipif.inc index 9614e679b9..0f930332ea 100644 --- a/ext/sqlite3/tests/skipif.inc +++ b/ext/sqlite3/tests/skipif.inc @@ -1,7 +1,7 @@ <?php if (!extension_loaded('sqlite3')) { - die("skip sqlite3 extension not loaded"); + die("skip sqlite3 extension not loaded"); } ?> diff --git a/ext/sqlite3/tests/sqlite3_03_insert.phpt b/ext/sqlite3/tests/sqlite3_03_insert.phpt index 1a0690a000..60880de880 100644 --- a/ext/sqlite3/tests/sqlite3_03_insert.phpt +++ b/ext/sqlite3/tests/sqlite3_03_insert.phpt @@ -19,7 +19,7 @@ echo "SELECTING results\n"; $results = $db->query("SELECT * FROM test ORDER BY id ASC"); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_04_update.phpt b/ext/sqlite3/tests/sqlite3_04_update.phpt index 3ce7d9cf8b..fe55464ef6 100644 --- a/ext/sqlite3/tests/sqlite3_04_update.phpt +++ b/ext/sqlite3/tests/sqlite3_04_update.phpt @@ -19,7 +19,7 @@ echo "SELECTING results\n"; $results = $db->query("SELECT * FROM test ORDER BY id ASC"); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); @@ -30,7 +30,7 @@ echo "Checking results\n"; $results = $db->query("SELECT * FROM test ORDER BY id ASC"); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_05_delete.phpt b/ext/sqlite3/tests/sqlite3_05_delete.phpt index 9ce50c4789..8768d0b575 100644 --- a/ext/sqlite3/tests/sqlite3_05_delete.phpt +++ b/ext/sqlite3/tests/sqlite3_05_delete.phpt @@ -19,7 +19,7 @@ echo "SELECTING results\n"; $results = $db->query("SELECT * FROM test ORDER BY id ASC"); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); @@ -30,7 +30,7 @@ echo "Checking results\n"; $results = $db->query("SELECT * FROM test ORDER BY id ASC"); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_06_prepared_stmt.phpt b/ext/sqlite3/tests/sqlite3_06_prepared_stmt.phpt index 710813e8f5..28fd2d264a 100644 --- a/ext/sqlite3/tests/sqlite3_06_prepared_stmt.phpt +++ b/ext/sqlite3/tests/sqlite3_06_prepared_stmt.phpt @@ -24,7 +24,7 @@ $foo = 'a'; $results = $stmt->execute(); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_07_prepared_stmt.phpt b/ext/sqlite3/tests/sqlite3_07_prepared_stmt.phpt index d9a2408123..393386fead 100644 --- a/ext/sqlite3/tests/sqlite3_07_prepared_stmt.phpt +++ b/ext/sqlite3/tests/sqlite3_07_prepared_stmt.phpt @@ -23,7 +23,7 @@ var_dump($stmt->bindValue(1, $foo, SQLITE3_TEXT)); $results = $stmt->execute(); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_08_udf.phpt b/ext/sqlite3/tests/sqlite3_08_udf.phpt index 7f00dbb1c4..24862ddda8 100644 --- a/ext/sqlite3/tests/sqlite3_08_udf.phpt +++ b/ext/sqlite3/tests/sqlite3_08_udf.phpt @@ -7,7 +7,7 @@ SQLite3::createFunction function my_udf_md5($foo) { - return md5($foo); + return md5($foo); } require_once(__DIR__ . '/new_db.inc'); @@ -27,7 +27,7 @@ echo "SELECTING results\n"; $results = $db->query("SELECT my_udf_md5(id) FROM test ORDER BY id ASC"); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_09_blob_bound_param.phpt b/ext/sqlite3/tests/sqlite3_09_blob_bound_param.phpt index 994503dd03..27497f7448 100644 --- a/ext/sqlite3/tests/sqlite3_09_blob_bound_param.phpt +++ b/ext/sqlite3/tests/sqlite3_09_blob_bound_param.phpt @@ -30,7 +30,7 @@ echo "SELECTING results\n"; $results = $db->query("SELECT id, quote(data) AS data FROM test ORDER BY id ASC"); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_10_bound_value_name.phpt b/ext/sqlite3/tests/sqlite3_10_bound_value_name.phpt index 712ad2e539..f7bd34f388 100644 --- a/ext/sqlite3/tests/sqlite3_10_bound_value_name.phpt +++ b/ext/sqlite3/tests/sqlite3_10_bound_value_name.phpt @@ -25,7 +25,7 @@ var_dump($stmt->bindValue('id', $foo, SQLITE3_TEXT)); $results = $stmt->execute(); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt b/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt index eac5a59a8a..e3e67f1ff4 100644 --- a/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt +++ b/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt @@ -19,9 +19,9 @@ echo "SELECTING results\n"; $results = $db->query("SELECT * FROM test ORDER BY id ASC"); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); - /* Only read one row and break */ - break; + var_dump($result); + /* Only read one row and break */ + break; } echo "Closing database\n"; diff --git a/ext/sqlite3/tests/sqlite3_13_skip_all_cleanup.phpt b/ext/sqlite3/tests/sqlite3_13_skip_all_cleanup.phpt index daeacc0832..0bced8c19a 100644 --- a/ext/sqlite3/tests/sqlite3_13_skip_all_cleanup.phpt +++ b/ext/sqlite3/tests/sqlite3_13_skip_all_cleanup.phpt @@ -19,7 +19,7 @@ echo "SELECTING results\n"; $results = $db->query("SELECT * FROM test ORDER BY id ASC"); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } echo "Done\n"; ?> diff --git a/ext/sqlite3/tests/sqlite3_15_open_error-win.phpt b/ext/sqlite3/tests/sqlite3_15_open_error-win.phpt index d9c7e2fa41..4b75b3b28f 100644 --- a/ext/sqlite3/tests/sqlite3_15_open_error-win.phpt +++ b/ext/sqlite3/tests/sqlite3_15_open_error-win.phpt @@ -19,9 +19,9 @@ $cmd = $icacls . ' ' . $unreadable . ' /inheritance:r /deny ' . $user . ':(F,M,R exec($cmd); try { - $db = new SQLite3($unreadable); + $db = new SQLite3($unreadable); } catch (Exception $e) { - echo $e . "\n"; + echo $e . "\n"; } echo "Done\n"; diff --git a/ext/sqlite3/tests/sqlite3_15_open_error.phpt b/ext/sqlite3/tests/sqlite3_15_open_error.phpt index 74bcc920d0..0c3e9537db 100644 --- a/ext/sqlite3/tests/sqlite3_15_open_error.phpt +++ b/ext/sqlite3/tests/sqlite3_15_open_error.phpt @@ -16,9 +16,9 @@ $unreadable = __DIR__ . '/unreadable.db'; touch($unreadable); chmod($unreadable, 0200); try { - $db = new SQLite3($unreadable); + $db = new SQLite3($unreadable); } catch (Exception $e) { - echo $e . "\n"; + echo $e . "\n"; } echo "Done\n"; unlink($unreadable); diff --git a/ext/sqlite3/tests/sqlite3_16_select_no_results.phpt b/ext/sqlite3/tests/sqlite3_16_select_no_results.phpt index 91875b68ad..08fe5eeb24 100644 --- a/ext/sqlite3/tests/sqlite3_16_select_no_results.phpt +++ b/ext/sqlite3/tests/sqlite3_16_select_no_results.phpt @@ -15,7 +15,7 @@ echo "SELECTING results\n"; $results = $db->query("SELECT * FROM test ORDER BY id ASC"); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_19_columninfo.phpt b/ext/sqlite3/tests/sqlite3_19_columninfo.phpt index 2395c75399..51017bb0bc 100644 --- a/ext/sqlite3/tests/sqlite3_19_columninfo.phpt +++ b/ext/sqlite3/tests/sqlite3_19_columninfo.phpt @@ -18,10 +18,10 @@ var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'b')")) echo "SELECTING results\n"; $result = $db->query("SELECT * FROM test ORDER BY id ASC"); while ($row = $result->fetchArray(SQLITE3_NUM)) { - $totalColumns = $result->numColumns(); - for ($i = 0; $i < $totalColumns; $i++) { - echo "Name: " . $result->columnName($i) . " - Type: " . $result->columnType($i) . "\n"; - } + $totalColumns = $result->numColumns(); + for ($i = 0; $i < $totalColumns; $i++) { + echo "Name: " . $result->columnName($i) . " - Type: " . $result->columnType($i) . "\n"; + } } $result->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_20_error.phpt b/ext/sqlite3/tests/sqlite3_20_error.phpt index a9324c3999..9b1579a83e 100644 --- a/ext/sqlite3/tests/sqlite3_20_error.phpt +++ b/ext/sqlite3/tests/sqlite3_20_error.phpt @@ -10,8 +10,8 @@ require_once(__DIR__ . '/new_db.inc'); echo "SELECTING from invalid table\n"; $result = $db->query("SELECT * FROM non_existent_table"); if (!$result) { - echo "Error Code: " . $db->lastErrorCode() . "\n"; - echo "Error Msg: " . $db->lastErrorMsg() . "\n"; + echo "Error Code: " . $db->lastErrorCode() . "\n"; + echo "Error Msg: " . $db->lastErrorMsg() . "\n"; } echo "Closing database\n"; var_dump($db->close()); diff --git a/ext/sqlite3/tests/sqlite3_21_security.phpt b/ext/sqlite3/tests/sqlite3_21_security.phpt index 5221807cd5..407869b3f8 100644 --- a/ext/sqlite3/tests/sqlite3_21_security.phpt +++ b/ext/sqlite3/tests/sqlite3_21_security.phpt @@ -19,9 +19,9 @@ unlink($directory . $file); echo "Above test directory\n"; try { - $db = new SQLite3('../bad' . $file); + $db = new SQLite3('../bad' . $file); } catch (Exception $e) { - echo $e . "\n"; + echo $e . "\n"; } echo "Done\n"; diff --git a/ext/sqlite3/tests/sqlite3_23_escape_string.phpt b/ext/sqlite3/tests/sqlite3_23_escape_string.phpt index 6552c222a7..f91213ae64 100644 --- a/ext/sqlite3/tests/sqlite3_23_escape_string.phpt +++ b/ext/sqlite3/tests/sqlite3_23_escape_string.phpt @@ -19,7 +19,7 @@ echo "SELECTING results\n"; $results = $db->query("SELECT * FROM test ORDER BY id ASC"); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt b/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt index 84993571ec..c8a033e738 100644 --- a/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt +++ b/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt @@ -8,17 +8,17 @@ SQLite3::createAggregate() test require_once(__DIR__ . '/new_db.inc'); function sum_list_step($context, $rows, $string) { - if (empty($context)) - { - $context = array('total' => 0, 'values' => array()); - } - $context['total'] += intval($string); - $context['values'][] = $context['total']; - return $context; + if (empty($context)) + { + $context = array('total' => 0, 'values' => array()); + } + $context['total'] += intval($string); + $context['values'][] = $context['total']; + return $context; } function sum_list_finalize($context) { - return implode(',', $context['values']); + return implode(',', $context['values']); } echo "Creating Table\n"; diff --git a/ext/sqlite3/tests/sqlite3_26_reset_prepared_stmt.phpt b/ext/sqlite3/tests/sqlite3_26_reset_prepared_stmt.phpt index ffd05d3329..39e9e48676 100644 --- a/ext/sqlite3/tests/sqlite3_26_reset_prepared_stmt.phpt +++ b/ext/sqlite3/tests/sqlite3_26_reset_prepared_stmt.phpt @@ -23,11 +23,11 @@ var_dump($stmt->bindParam(1, $foo, SQLITE3_TEXT)); $foo = 'a'; $results = $stmt->execute(); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $stmt->reset(); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_27_reset_prepared_stmt_result.phpt b/ext/sqlite3/tests/sqlite3_27_reset_prepared_stmt_result.phpt index 646cb473f3..6257d6483c 100644 --- a/ext/sqlite3/tests/sqlite3_27_reset_prepared_stmt_result.phpt +++ b/ext/sqlite3/tests/sqlite3_27_reset_prepared_stmt_result.phpt @@ -23,11 +23,11 @@ var_dump($stmt->bindParam(1, $foo, SQLITE3_TEXT)); $foo = 'a'; $results = $stmt->execute(); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->reset(); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_28_clear_bindings.phpt b/ext/sqlite3/tests/sqlite3_28_clear_bindings.phpt index a17e1fb3f1..4472b878bc 100644 --- a/ext/sqlite3/tests/sqlite3_28_clear_bindings.phpt +++ b/ext/sqlite3/tests/sqlite3_28_clear_bindings.phpt @@ -23,14 +23,14 @@ var_dump($stmt->bindParam(1, $foo, SQLITE3_TEXT)); $foo = 'a'; $results = $stmt->execute(); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $stmt->reset(); $stmt->clear(); var_dump($stmt->bindValue(1, 'b', SQLITE3_TEXT)); $results = $stmt->execute(); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_36_create_collation.phpt b/ext/sqlite3/tests/sqlite3_36_create_collation.phpt index 90fbd9d37b..644ceb02c6 100644 --- a/ext/sqlite3/tests/sqlite3_36_create_collation.phpt +++ b/ext/sqlite3/tests/sqlite3_36_create_collation.phpt @@ -13,8 +13,8 @@ $db->exec('CREATE TABLE t (s varchar(4))'); $stmt = $db->prepare('INSERT INTO t VALUES (?)'); foreach(array('a1', 'a10', 'a2') as $s){ - $stmt->bindParam(1, $s); - $stmt->execute(); + $stmt->bindParam(1, $s); + $stmt->execute(); } $defaultSort = $db->query('SELECT s FROM t ORDER BY s'); //memcmp() sort @@ -22,12 +22,12 @@ $naturalSort = $db->query('SELECT s FROM t ORDER BY s COLLATE NAT'); //strnatcmp echo "default\n"; while ($row = $defaultSort->fetchArray()){ - echo $row['s'], "\n"; + echo $row['s'], "\n"; } echo "natural\n"; while ($row = $naturalSort->fetchArray()){ - echo $row['s'], "\n"; + echo $row['s'], "\n"; } $db->close(); diff --git a/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt b/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt index 57f05216df..994c67e0c3 100644 --- a/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt +++ b/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt @@ -9,21 +9,21 @@ $db = new SQLite3(':memory:'); $db->enableExceptions(true); $db->setAuthorizer(function (int $action) { - if ($action == SQLite3::SELECT) { - return SQLite3::OK; - } + if ($action == SQLite3::SELECT) { + return SQLite3::OK; + } - return SQLite3::DENY; + return SQLite3::DENY; }); // This query should be accepted var_dump($db->querySingle('SELECT 1;')); try { - // This one should fail - var_dump($db->querySingle('CREATE TABLE test (a, b);')); + // This one should fail + var_dump($db->querySingle('CREATE TABLE test (a, b);')); } catch (\Exception $e) { - echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } // Test disabling the authorizer @@ -35,11 +35,11 @@ var_dump($db->querySingle('SELECT a FROM test;')); // Test if we are getting the correct arguments $db->setAuthorizer(function (int $action) { - $constants = (new ReflectionClass('SQLite3'))->getConstants(); - $constants = array_flip($constants); + $constants = (new ReflectionClass('SQLite3'))->getConstants(); + $constants = array_flip($constants); - var_dump($constants[$action], implode(',', array_slice(func_get_args(), 1))); - return SQLITE3::OK; + var_dump($constants[$action], implode(',', array_slice(func_get_args(), 1))); + return SQLITE3::OK; }); var_dump($db->exec('SELECT * FROM test WHERE a = 42;')); @@ -47,25 +47,25 @@ var_dump($db->exec('DROP TABLE test;')); // Try to return something invalid from the authorizer $db->setAuthorizer(function () { - return 'FAIL'; + return 'FAIL'; }); try { - var_dump($db->querySingle('SELECT 1;')); + var_dump($db->querySingle('SELECT 1;')); } catch (\Exception $e) { - echo $e->getMessage() . "\n"; - echo $e->getPrevious()->getMessage() . "\n"; + echo $e->getMessage() . "\n"; + echo $e->getPrevious()->getMessage() . "\n"; } $db->setAuthorizer(function () { - return 4200; + return 4200; }); try { - var_dump($db->querySingle('SELECT 1;')); + var_dump($db->querySingle('SELECT 1;')); } catch (\Exception $e) { - echo $e->getMessage() . "\n"; - echo $e->getPrevious()->getMessage() . "\n"; + echo $e->getMessage() . "\n"; + echo $e->getPrevious()->getMessage() . "\n"; } ?> diff --git a/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt b/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt index 9b6e3ae29a..179e04d35d 100644 --- a/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt +++ b/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt @@ -8,9 +8,9 @@ Bug #68849 bindValue is not using the right data type $db = new SQLite3(':memory:'); $db->exec("CREATE TABLE test (a INTEGER, b TEXT, c REAL);" . - "INSERT INTO test VALUES (1, 'hello', 3.14);" . - "INSERT INTO test VALUES (3, 'world', 3.15);" . - "INSERT INTO test VALUES (0, '42', 0.42);" + "INSERT INTO test VALUES (1, 'hello', 3.14);" . + "INSERT INTO test VALUES (3, 'world', 3.15);" . + "INSERT INTO test VALUES (0, '42', 0.42);" ); $s = $db->prepare('SELECT * FROM test WHERE (a+2) = ?;'); diff --git a/ext/sqlite3/tests/sqlite3_blob_bind_resource.phpt b/ext/sqlite3/tests/sqlite3_blob_bind_resource.phpt index c35af945db..de7edfbbac 100644 --- a/ext/sqlite3/tests/sqlite3_blob_bind_resource.phpt +++ b/ext/sqlite3/tests/sqlite3_blob_bind_resource.phpt @@ -13,10 +13,10 @@ $insert_stmt = $db->prepare("INSERT INTO test (id, data) VALUES (1, ?)"); class HelloWrapper { - public function stream_open() { return true; } - public function stream_eof() { return true; } - public function stream_read() { return NULL; } - public function stream_stat() { return array(); } + public function stream_open() { return true; } + public function stream_eof() { return true; } + public function stream_read() { return NULL; } + public function stream_stat() { return array(); } } stream_wrapper_register("hello", "HelloWrapper"); diff --git a/ext/sqlite3/tests/sqlite3_bound_value_at_name.phpt b/ext/sqlite3/tests/sqlite3_bound_value_at_name.phpt index d0eec87a2f..c441b1bc4a 100644 --- a/ext/sqlite3/tests/sqlite3_bound_value_at_name.phpt +++ b/ext/sqlite3/tests/sqlite3_bound_value_at_name.phpt @@ -23,7 +23,7 @@ var_dump($stmt->bindValue('@id', $foo, SQLITE3_TEXT)); $results = $stmt->execute(); while ($result = $results->fetchArray(SQLITE3_NUM)) { - var_dump($result); + var_dump($result); } $results->finalize(); diff --git a/ext/sqlite3/tests/sqlite3_prepare_001.phpt b/ext/sqlite3/tests/sqlite3_prepare_001.phpt index 5142081b3a..f97eaab021 100644 --- a/ext/sqlite3/tests/sqlite3_prepare_001.phpt +++ b/ext/sqlite3/tests/sqlite3_prepare_001.phpt @@ -6,8 +6,8 @@ SQLite3 - memory leak on SQLite3Result and SQLite3Stmt <?php function test(&$x) { - $class = new SQLite3(':memory:'); - $x = $class->prepare('SELECT 1'); + $class = new SQLite3(':memory:'); + $x = $class->prepare('SELECT 1'); } test($foo); diff --git a/ext/sqlite3/tests/sqlite3stmt_paramCount_basic.phpt b/ext/sqlite3/tests/sqlite3stmt_paramCount_basic.phpt index a520f5715b..81eae9e566 100644 --- a/ext/sqlite3/tests/sqlite3stmt_paramCount_basic.phpt +++ b/ext/sqlite3/tests/sqlite3stmt_paramCount_basic.phpt @@ -16,21 +16,21 @@ var_dump($db->exec("INSERT INTO foobar (id, name, city) VALUES (2, 'doe', 'SF')" $queryArray = array( - "SELECT * FROM foobar WHERE id = ? ORDER BY id ASC", - "SELECT * FROM foobar WHERE id = 2 ORDER BY id ASC", - "SELECT * FROM foobar WHERE id = :id AND name = :name ORDER BY id ASC", - "SELECT * FROM foobar WHERE id = 1 AND name = :name ORDER BY id ASC", + "SELECT * FROM foobar WHERE id = ? ORDER BY id ASC", + "SELECT * FROM foobar WHERE id = 2 ORDER BY id ASC", + "SELECT * FROM foobar WHERE id = :id AND name = :name ORDER BY id ASC", + "SELECT * FROM foobar WHERE id = 1 AND name = :name ORDER BY id ASC", ); echo "SELECTING results\n"; foreach($queryArray as $key => $query) { - $stmt = $db->prepare($query); + $stmt = $db->prepare($query); - echo 'Param count for query ' . ($key + 1) . ":\n"; - var_dump($stmt->paramCount()); + echo 'Param count for query ' . ($key + 1) . ":\n"; + var_dump($stmt->paramCount()); - $result = $stmt->execute(); + $result = $stmt->execute(); } echo "Closing database\n"; diff --git a/ext/sqlite3/tests/stream_test.inc b/ext/sqlite3/tests/stream_test.inc index 13fd6f89f9..0d53d0f7be 100644 --- a/ext/sqlite3/tests/stream_test.inc +++ b/ext/sqlite3/tests/stream_test.inc @@ -2,42 +2,42 @@ class SQLite3_Test_Stream { - private $position; - public static $string_length = 10; - public static $string = "abcdefg\0hi"; - - public function stream_open($path, $mode, $options, &$opened_path) - { - $this->position = 0; - return true; - } - - public function stream_read($count) - { - $ret = substr(self::$string, $this->position, $count); - $this->position += strlen($ret); - return $ret; - } - - public function stream_write($data) - { - return 0; - } - - public function stream_stat() - { - return array('size' => self::$string_length); - } - - public function stream_tell() - { - return $this->position; - } - - public function stream_eof() - { - return ($this->position >= self::$string_length); - } + private $position; + public static $string_length = 10; + public static $string = "abcdefg\0hi"; + + public function stream_open($path, $mode, $options, &$opened_path) + { + $this->position = 0; + return true; + } + + public function stream_read($count) + { + $ret = substr(self::$string, $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + + public function stream_write($data) + { + return 0; + } + + public function stream_stat() + { + return array('size' => self::$string_length); + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return ($this->position >= self::$string_length); + } } stream_wrapper_register('sqliteBlobTest', "SQLite3_Test_Stream") or die("Unable to register sqliteBlobTest stream"); diff --git a/ext/standard/tests/array/002.phpt b/ext/standard/tests/array/002.phpt index 8d088f9129..589514ae03 100644 --- a/ext/standard/tests/array/002.phpt +++ b/ext/standard/tests/array/002.phpt @@ -8,16 +8,16 @@ require(__DIR__ . '/data.inc'); function test_sort ($sort_function, $data) { echo "\n -- Testing $sort_function() -- \n"; - echo "No second argument:\n"; + echo "No second argument:\n"; $sort_function ($data); var_dump ($data); - echo "Using SORT_REGULAR:\n"; + echo "Using SORT_REGULAR:\n"; $sort_function ($data, SORT_REGULAR); var_dump ($data); - echo "Using SORT_NUMERIC:\n"; + echo "Using SORT_NUMERIC:\n"; $sort_function ($data, SORT_NUMERIC); var_dump ($data); - echo "Using SORT_STRING\n"; + echo "Using SORT_STRING\n"; $sort_function ($data, SORT_STRING); var_dump ($data); } diff --git a/ext/standard/tests/array/004.phpt b/ext/standard/tests/array/004.phpt index 765637b26c..0f9fc5507c 100644 --- a/ext/standard/tests/array/004.phpt +++ b/ext/standard/tests/array/004.phpt @@ -5,11 +5,11 @@ precision=14 --FILE-- <?php $data = array( - 'Test1', - 'teST2'=>0, - 5=>'test2', - 'abc'=>'test10', - 'test21' + 'Test1', + 'teST2'=>0, + 5=>'test2', + 'abc'=>'test10', + 'test21' ); var_dump($data); diff --git a/ext/standard/tests/array/007.phpt b/ext/standard/tests/array/007.phpt index 4a1270eca6..a1c984a18b 100644 --- a/ext/standard/tests/array/007.phpt +++ b/ext/standard/tests/array/007.phpt @@ -51,27 +51,27 @@ var_dump(array_diff_assoc($a,$b,$c)); echo "-=-=-=-=-=-=-=-=- New functionality from 5.0.0 -=-=-=-=-=-=-=-\n"; error_reporting(E_ALL); class cr { - private $priv_member; - public $public_member; - function __construct($val) { - $this->priv_member = $val; - $this->public_member = $val; - } - static function comp_func_cr($a, $b) { - if ($a->priv_member === $b->priv_member) return 0; - return ($a->priv_member > $b->priv_member)? 1:-1; - } + private $priv_member; + public $public_member; + function __construct($val) { + $this->priv_member = $val; + $this->public_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member)? 1:-1; + } } function comp_func($a, $b) { - if ($a === $b) return 0; - return ($a > $b)? 1:-1; + if ($a === $b) return 0; + return ($a > $b)? 1:-1; } function comp_func_cr($a, $b) { - if ($a->public_member === $b->public_member) return 0; - return ($a->public_member > $b->public_member)? 1:-1; + if ($a->public_member === $b->public_member) return 0; + return ($a->public_member > $b->public_member)? 1:-1; } diff --git a/ext/standard/tests/array/array_change_key_case.phpt b/ext/standard/tests/array/array_change_key_case.phpt index ca9a21128b..115a7096d8 100644 --- a/ext/standard/tests/array/array_change_key_case.phpt +++ b/ext/standard/tests/array/array_change_key_case.phpt @@ -52,10 +52,10 @@ echo "*** Testing basic operations ***\n"; $loop_counter = 1; foreach ($arrays as $item) { echo "** Iteration $loop_counter **\n"; $loop_counter++; - var_dump(array_change_key_case($item)); - var_dump(array_change_key_case($item, CASE_UPPER)); - var_dump(array_change_key_case($item, CASE_LOWER)); - echo "\n"; + var_dump(array_change_key_case($item)); + var_dump(array_change_key_case($item, CASE_UPPER)); + var_dump(array_change_key_case($item, CASE_LOWER)); + echo "\n"; } echo "end\n"; diff --git a/ext/standard/tests/array/array_change_key_case_variation4.phpt b/ext/standard/tests/array/array_change_key_case_variation4.phpt index 52017177cc..eaacfaac58 100644 --- a/ext/standard/tests/array/array_change_key_case_variation4.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation4.phpt @@ -15,9 +15,9 @@ echo "*** Testing array_change_key_case() : usage variations ***\n"; $input = array('One' => 'un', 'TWO' => 'deux', 'three' => 'trois'); for ($i = -5; $i <=5; $i += 1){ - echo "\n-- \$sort argument is $i --\n"; - $temp = $input; - var_dump(array_change_key_case($temp, $i)); + echo "\n-- \$sort argument is $i --\n"; + $temp = $input; + var_dump(array_change_key_case($temp, $i)); } echo "Done"; diff --git a/ext/standard/tests/array/array_change_key_case_variation8.phpt b/ext/standard/tests/array/array_change_key_case_variation8.phpt index 493862ccd4..17455c54da 100644 --- a/ext/standard/tests/array/array_change_key_case_variation8.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation8.phpt @@ -14,18 +14,18 @@ Test array_change_key_case() function : usage variations - Different strings as echo "*** Testing array_change_key_case() : usage variations ***\n"; $inputs = array ( - // group of escape sequences - array(null => 1, NULL => 2, "\a" => 3, "\cx" => 4, "\e" => 5, "\f" => 6, "\n" => 7, "\t" => 8, "\xhh" => 9, "\ddd" => 10, "\v" => 11), + // group of escape sequences + array(null => 1, NULL => 2, "\a" => 3, "\cx" => 4, "\e" => 5, "\f" => 6, "\n" => 7, "\t" => 8, "\xhh" => 9, "\ddd" => 10, "\v" => 11), - // array contains combination of capital/small letters - array("lemoN" => 1, "Orange" => 2, "banana" => 3, "apple" => 4, "Test" => 5, "TTTT" => 6, "ttt" => 7, "ww" => 8, "x" => 9, "X" => 10, "oraNGe" => 11, "BANANA" => 12) + // array contains combination of capital/small letters + array("lemoN" => 1, "Orange" => 2, "banana" => 3, "apple" => 4, "Test" => 5, "TTTT" => 6, "ttt" => 7, "ww" => 8, "x" => 9, "X" => 10, "oraNGe" => 11, "BANANA" => 12) ); foreach($inputs as $input) { - echo "\n-- \$case = default --\n"; - var_dump(array_change_key_case($input)); - echo "-- \$case = upper --\n"; - var_dump(array_change_key_case($input, CASE_UPPER)); + echo "\n-- \$case = default --\n"; + var_dump(array_change_key_case($input)); + echo "-- \$case = upper --\n"; + var_dump(array_change_key_case($input, CASE_UPPER)); } echo "Done"; diff --git a/ext/standard/tests/array/array_chunk_variation10.phpt b/ext/standard/tests/array/array_chunk_variation10.phpt index be5fcdc7f3..326d7de98f 100644 --- a/ext/standard/tests/array/array_chunk_variation10.phpt +++ b/ext/standard/tests/array/array_chunk_variation10.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 10 $array = array (1 => 1, 2 => 2, 3 => 3); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation11.phpt b/ext/standard/tests/array/array_chunk_variation11.phpt index 09ec255744..e3ce445370 100644 --- a/ext/standard/tests/array/array_chunk_variation11.phpt +++ b/ext/standard/tests/array/array_chunk_variation11.phpt @@ -6,11 +6,11 @@ $array = array (0 => 0, 3 => 2); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation12.phpt b/ext/standard/tests/array/array_chunk_variation12.phpt index f85f2a8c0d..3b0cb79beb 100644 --- a/ext/standard/tests/array/array_chunk_variation12.phpt +++ b/ext/standard/tests/array/array_chunk_variation12.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 12 $array = array (1 => 1, 5 => 2, 8 => 3); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation13.phpt b/ext/standard/tests/array/array_chunk_variation13.phpt index 5cd6f0ea34..f62d309c15 100644 --- a/ext/standard/tests/array/array_chunk_variation13.phpt +++ b/ext/standard/tests/array/array_chunk_variation13.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 13 $array = array (1, 2); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation14.phpt b/ext/standard/tests/array/array_chunk_variation14.phpt index 97fce1e722..64746bf6e7 100644 --- a/ext/standard/tests/array/array_chunk_variation14.phpt +++ b/ext/standard/tests/array/array_chunk_variation14.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 14 $array = array (0, 1, 2); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation15.phpt b/ext/standard/tests/array/array_chunk_variation15.phpt index c48af63f6c..294dd9f8f9 100644 --- a/ext/standard/tests/array/array_chunk_variation15.phpt +++ b/ext/standard/tests/array/array_chunk_variation15.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 15 $array = array (1, 2, 3); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation16.phpt b/ext/standard/tests/array/array_chunk_variation16.phpt index 3426f9278b..b7159cba99 100644 --- a/ext/standard/tests/array/array_chunk_variation16.phpt +++ b/ext/standard/tests/array/array_chunk_variation16.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 16 $array = array (0, 1, 2, 3); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation17.phpt b/ext/standard/tests/array/array_chunk_variation17.phpt index 1a8bb5d340..07826d06f8 100644 --- a/ext/standard/tests/array/array_chunk_variation17.phpt +++ b/ext/standard/tests/array/array_chunk_variation17.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 17 $array = array (1, 2, 3, 4); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation18.phpt b/ext/standard/tests/array/array_chunk_variation18.phpt index 593c702ce9..1fa9ca6ec4 100644 --- a/ext/standard/tests/array/array_chunk_variation18.phpt +++ b/ext/standard/tests/array/array_chunk_variation18.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 18 $array = array (0, 1, 2, 3, 4); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation19.phpt b/ext/standard/tests/array/array_chunk_variation19.phpt index f160cba263..2591db89eb 100644 --- a/ext/standard/tests/array/array_chunk_variation19.phpt +++ b/ext/standard/tests/array/array_chunk_variation19.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 19 $array = array (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation20.phpt b/ext/standard/tests/array/array_chunk_variation20.phpt index d47279915c..ec2e45b104 100644 --- a/ext/standard/tests/array/array_chunk_variation20.phpt +++ b/ext/standard/tests/array/array_chunk_variation20.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 20 $array = array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation21.phpt b/ext/standard/tests/array/array_chunk_variation21.phpt index e8c7784325..ce672a9209 100644 --- a/ext/standard/tests/array/array_chunk_variation21.phpt +++ b/ext/standard/tests/array/array_chunk_variation21.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 21 $array = array ("a" => 1); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation22.phpt b/ext/standard/tests/array/array_chunk_variation22.phpt index b0eeade3ab..d67269f4e7 100644 --- a/ext/standard/tests/array/array_chunk_variation22.phpt +++ b/ext/standard/tests/array/array_chunk_variation22.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 22 $array = array ("b" => 1, "c" => 2); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation23.phpt b/ext/standard/tests/array/array_chunk_variation23.phpt index 87ced15132..99138eaeb3 100644 --- a/ext/standard/tests/array/array_chunk_variation23.phpt +++ b/ext/standard/tests/array/array_chunk_variation23.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 23 $array = array ("p" => 1, "q" => 2, "r" => 3, "s" => 4, "u" => 5, "v" => 6); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation24.phpt b/ext/standard/tests/array/array_chunk_variation24.phpt index 69dce7be17..c96d59d874 100644 --- a/ext/standard/tests/array/array_chunk_variation24.phpt +++ b/ext/standard/tests/array/array_chunk_variation24.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 24 $array = array ("a" => "A"); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation25.phpt b/ext/standard/tests/array/array_chunk_variation25.phpt index 09303c30ba..978588e02c 100644 --- a/ext/standard/tests/array/array_chunk_variation25.phpt +++ b/ext/standard/tests/array/array_chunk_variation25.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 25 $array = array ("p" => "A", "q" => "B", "r" => "C", "s" => "D", "u" => "E", "v" => "F"); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation26.phpt b/ext/standard/tests/array/array_chunk_variation26.phpt index ca6975a64e..7b46215ffb 100644 --- a/ext/standard/tests/array/array_chunk_variation26.phpt +++ b/ext/standard/tests/array/array_chunk_variation26.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 26 $array =array (0); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation27.phpt b/ext/standard/tests/array/array_chunk_variation27.phpt index aa91036a52..a91a8b91b9 100644 --- a/ext/standard/tests/array/array_chunk_variation27.phpt +++ b/ext/standard/tests/array/array_chunk_variation27.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 27 $array = array (1); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation28.phpt b/ext/standard/tests/array/array_chunk_variation28.phpt index 5389049ce4..707b0cdefc 100644 --- a/ext/standard/tests/array/array_chunk_variation28.phpt +++ b/ext/standard/tests/array/array_chunk_variation28.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 28 $array = array (-1); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation29.phpt b/ext/standard/tests/array/array_chunk_variation29.phpt index f18de5ea85..07187135be 100644 --- a/ext/standard/tests/array/array_chunk_variation29.phpt +++ b/ext/standard/tests/array/array_chunk_variation29.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 29 $array = array (0, 2); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation30.phpt b/ext/standard/tests/array/array_chunk_variation30.phpt index 0dbd9b6368..5400b595eb 100644 --- a/ext/standard/tests/array/array_chunk_variation30.phpt +++ b/ext/standard/tests/array/array_chunk_variation30.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 30 $array = array (1, 2, 3); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation31.phpt b/ext/standard/tests/array/array_chunk_variation31.phpt index fd7f358ca0..ffdfa2bc13 100644 --- a/ext/standard/tests/array/array_chunk_variation31.phpt +++ b/ext/standard/tests/array/array_chunk_variation31.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 31 $array = array (1 => 0); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation32.phpt b/ext/standard/tests/array/array_chunk_variation32.phpt index 09471a59aa..b0a01f209a 100644 --- a/ext/standard/tests/array/array_chunk_variation32.phpt +++ b/ext/standard/tests/array/array_chunk_variation32.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 32 $array = array (2 => 1); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation8.phpt b/ext/standard/tests/array/array_chunk_variation8.phpt index 64b9bb2036..2d8fa07c97 100644 --- a/ext/standard/tests/array/array_chunk_variation8.phpt +++ b/ext/standard/tests/array/array_chunk_variation8.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 8 $array = array (3 => -1); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_chunk_variation9.phpt b/ext/standard/tests/array/array_chunk_variation9.phpt index a68240e6f6..2be7b81e83 100644 --- a/ext/standard/tests/array/array_chunk_variation9.phpt +++ b/ext/standard/tests/array/array_chunk_variation9.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 9 $array = array (1 => 0, 2 => 2); var_dump ($array); for ($i = 1; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (array_chunk ($array, $i)); - var_dump (array_chunk ($array, $i, TRUE)); - var_dump (array_chunk ($array, $i, FALSE)); - echo "\n"; + echo "[$i]\n"; + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_column_basic.phpt b/ext/standard/tests/array/array_column_basic.phpt index 418f373872..57056b971f 100644 --- a/ext/standard/tests/array/array_column_basic.phpt +++ b/ext/standard/tests/array/array_column_basic.phpt @@ -12,21 +12,21 @@ Test array_column() function: basic functionality echo "*** Testing array_column() : basic functionality ***\n"; /* Array representing a possible record set returned from a database */ $records = array( - array( - 'id' => 1, - 'first_name' => 'John', - 'last_name' => 'Doe' - ), - array( - 'id' => 2, - 'first_name' => 'Sally', - 'last_name' => 'Smith' - ), - array( - 'id' => 3, - 'first_name' => 'Jane', - 'last_name' => 'Jones' - ) + array( + 'id' => 1, + 'first_name' => 'John', + 'last_name' => 'Doe' + ), + array( + 'id' => 2, + 'first_name' => 'Sally', + 'last_name' => 'Smith' + ), + array( + 'id' => 3, + 'first_name' => 'Jane', + 'last_name' => 'Jones' + ) ); echo "-- first_name column from recordset --\n"; @@ -44,47 +44,47 @@ var_dump(array_column($records, 'last_name', 'first_name')); echo "\n*** Testing multiple data types ***\n"; $fh = fopen(__FILE__, 'r', true); $values = array( - array( - 'id' => 1, - 'value' => new stdClass - ), - array( - 'id' => 2, - 'value' => 34.2345 - ), - array( - 'id' => 3, - 'value' => true - ), - array( - 'id' => 4, - 'value' => false - ), - array( - 'id' => 5, - 'value' => null - ), - array( - 'id' => 6, - 'value' => 1234 - ), - array( - 'id' => 7, - 'value' => 'Foo' - ), - array( - 'id' => 8, - 'value' => $fh - ) + array( + 'id' => 1, + 'value' => new stdClass + ), + array( + 'id' => 2, + 'value' => 34.2345 + ), + array( + 'id' => 3, + 'value' => true + ), + array( + 'id' => 4, + 'value' => false + ), + array( + 'id' => 5, + 'value' => null + ), + array( + 'id' => 6, + 'value' => 1234 + ), + array( + 'id' => 7, + 'value' => 'Foo' + ), + array( + 'id' => 8, + 'value' => $fh + ) ); var_dump(array_column($values, 'value')); var_dump(array_column($values, 'value', 'id')); echo "\n*** Testing numeric column keys ***\n"; $numericCols = array( - array('aaa', '111'), - array('bbb', '222'), - array('ccc', '333', -1 => 'ddd') + array('aaa', '111'), + array('bbb', '222'), + array('ccc', '333', -1 => 'ddd') ); var_dump(array_column($numericCols, 1)); var_dump(array_column($numericCols, 1, 0)); diff --git a/ext/standard/tests/array/array_column_variant_objects.phpt b/ext/standard/tests/array/array_column_variant_objects.phpt index dc9c0e7e8f..612573e8fd 100644 --- a/ext/standard/tests/array/array_column_variant_objects.phpt +++ b/ext/standard/tests/array/array_column_variant_objects.phpt @@ -5,14 +5,14 @@ Test array_column() function: testing with objects class User { - public $id, $first_name, $last_name; - - public function __construct($id, $first_name, $last_name) - { - $this->id = $id; - $this->first_name = $first_name; - $this->last_name = $last_name; - } + public $id, $first_name, $last_name; + + public function __construct($id, $first_name, $last_name) + { + $this->id = $id; + $this->first_name = $first_name; + $this->last_name = $last_name; + } } function newUser($id, $first_name, $last_name) @@ -27,15 +27,15 @@ function newUser($id, $first_name, $last_name) class Something { - public function __isset($name) - { - return $name == 'first_name'; - } - - public function __get($name) - { - return new User(4, 'Jack', 'Sparrow'); - } + public function __isset($name) + { + return $name == 'first_name'; + } + + public function __get($name) + { + return new User(4, 'Jack', 'Sparrow'); + } } $records = array( @@ -45,7 +45,7 @@ $records = array( new User(1, 'John', 'Doe'), new User(2, 'Sally', 'Smith'), new User(3, 'Jane', 'Jones'), - new Something, + new Something, ); echo "*** Testing array_column() : object property fetching (numeric property names) ***\n"; diff --git a/ext/standard/tests/array/array_combine.phpt b/ext/standard/tests/array/array_combine.phpt index 28eb54929e..b1b707aed6 100644 --- a/ext/standard/tests/array/array_combine.phpt +++ b/ext/standard/tests/array/array_combine.phpt @@ -2,30 +2,30 @@ basic array_combine test --FILE-- <?php - $array1 = array('green', 'red', 'yellow'); - $array2 = array('1', '2', '3'); - $array3 = array(0, 1, 2); - $array4 = array(TRUE, FALSE, NULL); - $a = array_combine($array1, $array1); - $b = array_combine($array1, $array2); - $c = array_combine($array1, $array3); - $d = array_combine($array1, $array4); - $e = array_combine($array2, $array1); - $f = array_combine($array2, $array2); - $g = array_combine($array2, $array3); - $h = array_combine($array2, $array4); - $i = array_combine($array3, $array1); - $j = array_combine($array3, $array2); - $k = array_combine($array3, $array3); - $l = array_combine($array3, $array4); - $m = array_combine($array4, $array1); - $n = array_combine($array4, $array2); - $o = array_combine($array4, $array3); - $p = array_combine($array4, $array4); - for($letter = "a"; $letter <= "p"; $letter++) - { - print_r($$letter); - } + $array1 = array('green', 'red', 'yellow'); + $array2 = array('1', '2', '3'); + $array3 = array(0, 1, 2); + $array4 = array(TRUE, FALSE, NULL); + $a = array_combine($array1, $array1); + $b = array_combine($array1, $array2); + $c = array_combine($array1, $array3); + $d = array_combine($array1, $array4); + $e = array_combine($array2, $array1); + $f = array_combine($array2, $array2); + $g = array_combine($array2, $array3); + $h = array_combine($array2, $array4); + $i = array_combine($array3, $array1); + $j = array_combine($array3, $array2); + $k = array_combine($array3, $array3); + $l = array_combine($array3, $array4); + $m = array_combine($array4, $array1); + $n = array_combine($array4, $array2); + $o = array_combine($array4, $array3); + $p = array_combine($array4, $array4); + for($letter = "a"; $letter <= "p"; $letter++) + { + print_r($$letter); + } ?> --EXPECT-- Array diff --git a/ext/standard/tests/array/array_count_values.phpt b/ext/standard/tests/array/array_count_values.phpt index a6424aab9a..eb51512430 100644 --- a/ext/standard/tests/array/array_count_values.phpt +++ b/ext/standard/tests/array/array_count_values.phpt @@ -3,23 +3,23 @@ array_count_values() --FILE-- <?php $arrays = array ( - array (), - array (0), - array (1), - array (-1), - array (0, 0), - array (0, 1), - array (1, 1), - array (1, "hello", 1, "world", "hello"), - array ("hello", "world", "hello"), - array ("", "world", "", "hello", "world", "hello", "hello", "world", "hello"), - array (0, array (1, "hello", 1, "world", "hello")), - array (1, array (1, "hello", 1, "world", "hello"), array (1, "hello", 1, "world", "hello"), array (1, "hello", 1, "world", "hello")), + array (), + array (0), + array (1), + array (-1), + array (0, 0), + array (0, 1), + array (1, 1), + array (1, "hello", 1, "world", "hello"), + array ("hello", "world", "hello"), + array ("", "world", "", "hello", "world", "hello", "hello", "world", "hello"), + array (0, array (1, "hello", 1, "world", "hello")), + array (1, array (1, "hello", 1, "world", "hello"), array (1, "hello", 1, "world", "hello"), array (1, "hello", 1, "world", "hello")), ); foreach ($arrays as $item) { - var_dump (@array_count_values ($item)); - echo "\n"; + var_dump (@array_count_values ($item)); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/array_count_values2.phpt b/ext/standard/tests/array/array_count_values2.phpt index cb0c330965..a38b02c8be 100644 --- a/ext/standard/tests/array/array_count_values2.phpt +++ b/ext/standard/tests/array/array_count_values2.phpt @@ -3,18 +3,18 @@ basic array_count_values test --FILE-- <?php $array1 = array(1, - "hello", - 1, - "world", - "hello", - "", - "rabbit", - "foo", - "Foo", - TRUE, - FALSE, - NULL, - 0); + "hello", + 1, + "world", + "hello", + "", + "rabbit", + "foo", + "Foo", + TRUE, + FALSE, + NULL, + 0); var_dump(array_count_values($array1)); ?> --EXPECTF-- diff --git a/ext/standard/tests/array/array_count_values_variation.phpt b/ext/standard/tests/array/array_count_values_variation.phpt index 00f13c8a5b..2156db0ad9 100644 --- a/ext/standard/tests/array/array_count_values_variation.phpt +++ b/ext/standard/tests/array/array_count_values_variation.phpt @@ -15,9 +15,9 @@ Test array_count_values() function : Test all normal parameter variations echo "*** Testing array_count_values() : parameter variations ***\n"; class A { - static function hello() { - echo "Hello\n"; - } + static function hello() { + echo "Hello\n"; + } } $ob = new A(); diff --git a/ext/standard/tests/array/array_diff_assoc_variation1.phpt b/ext/standard/tests/array/array_diff_assoc_variation1.phpt index 270660a8cf..a723930b34 100644 --- a/ext/standard/tests/array/array_diff_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_diff_assoc_variation1.phpt @@ -73,7 +73,7 @@ $inputs = array( // binary data /*21*/ b"binary", - (binary)"binary", + (binary)"binary", // object data /*23*/ new classA(), diff --git a/ext/standard/tests/array/array_diff_assoc_variation2.phpt b/ext/standard/tests/array/array_diff_assoc_variation2.phpt index 9185b53439..dc5e7c87c3 100644 --- a/ext/standard/tests/array/array_diff_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_diff_assoc_variation2.phpt @@ -73,7 +73,7 @@ $inputs = array( // binary data /*21*/ b"binary", - (binary)"binary", + (binary)"binary", // object data /*23*/ new classA(), diff --git a/ext/standard/tests/array/array_diff_assoc_variation3.phpt b/ext/standard/tests/array/array_diff_assoc_variation3.phpt index 959ddd5428..023beb1ed0 100644 --- a/ext/standard/tests/array/array_diff_assoc_variation3.phpt +++ b/ext/standard/tests/array/array_diff_assoc_variation3.phpt @@ -39,7 +39,7 @@ $inputs = array( // int data /*1*/ 'int' => array( - 0, + 0, 1, 12345, -2345), @@ -84,7 +84,7 @@ $inputs = array( /*7*/ 'binary' => array( b"binary", - (binary)"binary"), + (binary)"binary"), // object data /*8*/ diff --git a/ext/standard/tests/array/array_diff_assoc_variation4.phpt b/ext/standard/tests/array/array_diff_assoc_variation4.phpt index 8cb05f8562..70ea73f96d 100644 --- a/ext/standard/tests/array/array_diff_assoc_variation4.phpt +++ b/ext/standard/tests/array/array_diff_assoc_variation4.phpt @@ -75,7 +75,7 @@ $inputs = array( /*7*/ 'binary' => array( b"binary1" => 'binary 1', - (binary)"binary2" => 'binary 2'), + (binary)"binary2" => 'binary 2'), // undefined data /*8*/ diff --git a/ext/standard/tests/array/array_diff_assoc_variation6.phpt b/ext/standard/tests/array/array_diff_assoc_variation6.phpt index bfbb0582ea..b4ef6d2304 100644 --- a/ext/standard/tests/array/array_diff_assoc_variation6.phpt +++ b/ext/standard/tests/array/array_diff_assoc_variation6.phpt @@ -28,41 +28,41 @@ $inputs = array ( //numeric keys => string values /*2*/ array(2 => '2.00000000000001', - 1 => '1', - 0 => 'zero', - 3 => 'a'), + 1 => '1', + 0 => 'zero', + 3 => 'a'), //string keys => string values /*3*/ array('2' => '2.00000000000001', - '1' => '1', - '0' => 'zero', - '3' => 'a') , + '1' => '1', + '0' => 'zero', + '3' => 'a') , //default keys => numeric values /*4*/ array(2, 1, 0), //numeric keys => numeric values /*5*/ array(2 => 2, - 1 => 1, - 0 => 0), + 1 => 1, + 0 => 0), //string keys => numeric values /*6*/ array('two' => 2, - '1' => 1, - '0' => 0), + '1' => 1, + '0' => 0), //default keys => float values /*7*/ array(2.00000000000001, 1.00, 0.01E-9), //numeric keys => float values /*8*/ array(2 => 2.00000000000001, - 1 => 1.00, - 0 => 0.01E-9), + 1 => 1.00, + 0 => 0.01E-9), //string keys => float values /*9*/ array ('two' => 2.00000000000001, - '1' => 1.00, - '0' =>0.01E-9) + '1' => 1.00, + '0' =>0.01E-9) ); // loop through each element of $inputs to check the behavior of array_diff_assoc diff --git a/ext/standard/tests/array/array_diff_key_variation1.phpt b/ext/standard/tests/array/array_diff_key_variation1.phpt index 7cc280c966..bdfac2c196 100644 --- a/ext/standard/tests/array/array_diff_key_variation1.phpt +++ b/ext/standard/tests/array/array_diff_key_variation1.phpt @@ -23,9 +23,9 @@ $fp = fopen(__FILE__, "r"); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_diff_key_variation2.phpt b/ext/standard/tests/array/array_diff_key_variation2.phpt index e38c10a3c9..4f84db5dd1 100644 --- a/ext/standard/tests/array/array_diff_key_variation2.phpt +++ b/ext/standard/tests/array/array_diff_key_variation2.phpt @@ -23,9 +23,9 @@ $fp = fopen(__FILE__, "r"); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_diff_key_variation8.phpt b/ext/standard/tests/array/array_diff_key_variation8.phpt index f96a1db578..65c09557a3 100644 --- a/ext/standard/tests/array/array_diff_key_variation8.phpt +++ b/ext/standard/tests/array/array_diff_key_variation8.phpt @@ -12,7 +12,7 @@ echo "*** Testing array_diff_key() : usage variation ***\n"; // Initialise function arguments not being substituted (if any) $array1 = array( - 'first' => array('blue' => 1, 'red' => 2), + 'first' => array('blue' => 1, 'red' => 2), 'second' => array('yellow' => 7), @@ -21,7 +21,7 @@ $array1 = array( $array2 = array ( - 'first' => array('blue' => 1, 'red' => 2,), + 'first' => array('blue' => 1, 'red' => 2,), 'second' => array('cyan' => 8), diff --git a/ext/standard/tests/array/array_diff_uassoc_variation1.phpt b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt index b0cf97e0a4..0891cd2ee1 100644 --- a/ext/standard/tests/array/array_diff_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt @@ -31,9 +31,9 @@ $fp = fopen(__FILE__, "r"); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_diff_uassoc_variation2.phpt b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt index a05cc8332f..0d5271d6ec 100644 --- a/ext/standard/tests/array/array_diff_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt @@ -31,9 +31,9 @@ $fp = fopen(__FILE__, "r"); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_diff_ukey_variation1.phpt b/ext/standard/tests/array/array_diff_ukey_variation1.phpt index 12df148790..a48ad44fd1 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation1.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation1.phpt @@ -31,9 +31,9 @@ $fp = fopen(__FILE__, "r"); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_diff_ukey_variation2.phpt b/ext/standard/tests/array/array_diff_ukey_variation2.phpt index ee0251f177..d39453086d 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation2.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation2.phpt @@ -33,9 +33,9 @@ $fp = fopen(__FILE__, "r"); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_diff_ukey_variation5.phpt b/ext/standard/tests/array/array_diff_ukey_variation5.phpt index 10946aa0ba..97ccfaab44 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation5.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation5.phpt @@ -12,7 +12,7 @@ echo "*** Testing array_diff_ukey() : usage variation ***\n"; // Initialise function arguments not being substituted (if any) $array1 = array( - 'first' => array('blue' => 1, 'red' => 2), + 'first' => array('blue' => 1, 'red' => 2), 'second' => array('yellow' => 7), @@ -21,7 +21,7 @@ $array1 = array( $array2 = array ( - 'first' => array('blue' => 1, 'red' => 2,), + 'first' => array('blue' => 1, 'red' => 2,), 'second' => array('cyan' => 8), diff --git a/ext/standard/tests/array/array_diff_variation1.phpt b/ext/standard/tests/array/array_diff_variation1.phpt index 5b92231642..765fae39cd 100644 --- a/ext/standard/tests/array/array_diff_variation1.phpt +++ b/ext/standard/tests/array/array_diff_variation1.phpt @@ -73,7 +73,7 @@ $inputs = array( // binary data /*21*/ b"binary", - (binary)"binary", + (binary)"binary", // object data /*23*/ new classA(), diff --git a/ext/standard/tests/array/array_diff_variation2.phpt b/ext/standard/tests/array/array_diff_variation2.phpt index a9ddb22b82..0bceeea1f0 100644 --- a/ext/standard/tests/array/array_diff_variation2.phpt +++ b/ext/standard/tests/array/array_diff_variation2.phpt @@ -73,7 +73,7 @@ $inputs = array( // binary data /*21*/ b"binary", - (binary)"binary", + (binary)"binary", // object data /*23*/ new classA(), diff --git a/ext/standard/tests/array/array_diff_variation3.phpt b/ext/standard/tests/array/array_diff_variation3.phpt index b7c842f21b..073d6ca5c9 100644 --- a/ext/standard/tests/array/array_diff_variation3.phpt +++ b/ext/standard/tests/array/array_diff_variation3.phpt @@ -80,7 +80,7 @@ $values = array( "binary" => array( // binary data b"binary", - (binary)"binary"), + (binary)"binary"), /*9*/ "undefined" => array( diff --git a/ext/standard/tests/array/array_diff_variation4.phpt b/ext/standard/tests/array/array_diff_variation4.phpt index 3b02c21b36..07bb7293bc 100644 --- a/ext/standard/tests/array/array_diff_variation4.phpt +++ b/ext/standard/tests/array/array_diff_variation4.phpt @@ -80,7 +80,7 @@ $values = array( "binary" => array( // binary data b"binary", - (binary)"binary"), + (binary)"binary"), /*9*/ "undefined" => array( diff --git a/ext/standard/tests/array/array_fill.phpt b/ext/standard/tests/array/array_fill.phpt index 2c90402fe8..4f2aa41b01 100644 --- a/ext/standard/tests/array/array_fill.phpt +++ b/ext/standard/tests/array/array_fill.phpt @@ -11,9 +11,9 @@ foreach($array1 as $start) foreach($array2 as $value) { echo '==========================='."\n"; - echo 'start: '.$start.' num: '.$num.' value: '.$value."\n"; - $output = array_fill($start, $num, $value); - var_dump($output); + echo 'start: '.$start.' num: '.$num.' value: '.$value."\n"; + $output = array_fill($start, $num, $value); + var_dump($output); } } } diff --git a/ext/standard/tests/array/array_fill_keys.phpt b/ext/standard/tests/array/array_fill_keys.phpt index fb222a414b..eebfd0aafd 100644 --- a/ext/standard/tests/array/array_fill_keys.phpt +++ b/ext/standard/tests/array/array_fill_keys.phpt @@ -4,10 +4,10 @@ basic array_fill_keys test precision=14 --FILE-- <?php - var_dump(array_fill_keys(array(), 1)); - var_dump(array_fill_keys(array('foo', 'bar'), NULL)); - var_dump(array_fill_keys(array('5', 'foo', 10, 1.23), 123)); - var_dump(array_fill_keys(array('test', TRUE, 10, 100), '')); + var_dump(array_fill_keys(array(), 1)); + var_dump(array_fill_keys(array('foo', 'bar'), NULL)); + var_dump(array_fill_keys(array('5', 'foo', 10, 1.23), 123)); + var_dump(array_fill_keys(array('test', TRUE, 10, 100), '')); ?> --EXPECT-- array(0) { diff --git a/ext/standard/tests/array/array_filter_variation10.phpt b/ext/standard/tests/array/array_filter_variation10.phpt index a32fdadc05..265daf1fb4 100644 --- a/ext/standard/tests/array/array_filter_variation10.phpt +++ b/ext/standard/tests/array/array_filter_variation10.phpt @@ -35,9 +35,9 @@ var_dump( array_filter($input, 'dump2', true) ); echo "*** Testing array_filter() : usage variations - 'callback' expecting second argument ***\n"; try { - var_dump( array_filter($small, 'dump', false) ); + var_dump( array_filter($small, 'dump', false) ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "*** Testing array_filter() with various use types ***\n"; diff --git a/ext/standard/tests/array/array_intersect_1.phpt b/ext/standard/tests/array/array_intersect_1.phpt index ce8fdd1cac..518dfd392f 100644 --- a/ext/standard/tests/array/array_intersect_1.phpt +++ b/ext/standard/tests/array/array_intersect_1.phpt @@ -4,27 +4,27 @@ Test of the *intersect* bunch of functions (both assoc and non-assoc) <?php error_reporting(E_ALL); class cr { - private $priv_member; - public $public_member; - function __construct($val) { - $this->priv_member = $val; - $this->public_member = $val; - } - static function comp_func_cr($a, $b) { - if ($a->priv_member === $b->priv_member) return 0; - return ($a->priv_member > $b->priv_member)? 1:-1; - } + private $priv_member; + public $public_member; + function __construct($val) { + $this->priv_member = $val; + $this->public_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member)? 1:-1; + } } function comp_func($a, $b) { - if ($a === $b) return 0; - return ($a > $b)? 1:-1; + if ($a === $b) return 0; + return ($a > $b)? 1:-1; } function comp_func_cr($a, $b) { - if ($a->public_member === $b->public_member) return 0; - return ($a->public_member > $b->public_member)? 1:-1; + if ($a->public_member === $b->public_member) return 0; + return ($a->public_member > $b->public_member)? 1:-1; } $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),); diff --git a/ext/standard/tests/array/array_intersect_key_variation1.phpt b/ext/standard/tests/array/array_intersect_key_variation1.phpt index 198cb1dfc6..fc1d858516 100644 --- a/ext/standard/tests/array/array_intersect_key_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation1.phpt @@ -23,9 +23,9 @@ $fp = fopen(__FILE__, "r"); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_intersect_key_variation2.phpt b/ext/standard/tests/array/array_intersect_key_variation2.phpt index c178480fca..bae7600b9d 100644 --- a/ext/standard/tests/array/array_intersect_key_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation2.phpt @@ -23,9 +23,9 @@ $fp = fopen(__FILE__, "r"); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_intersect_key_variation8.phpt b/ext/standard/tests/array/array_intersect_key_variation8.phpt index 892863991a..faa56eeb3d 100644 --- a/ext/standard/tests/array/array_intersect_key_variation8.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation8.phpt @@ -12,7 +12,7 @@ echo "*** Testing array_intersect_key() : usage variation ***\n"; /// Initialise function arguments not being substituted (if any) $array1 = array( - 'first' => array('blue' => 1, 'red' => 2), + 'first' => array('blue' => 1, 'red' => 2), 'second' => array('yellow' => 7), @@ -21,7 +21,7 @@ $array1 = array( $array2 = array ( - 'first' => array('blue' => 1, 'red' => 2,), + 'first' => array('blue' => 1, 'red' => 2,), 'second' => array('cyan' => 8), diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt index a26a5d99ec..c663269b2a 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt @@ -31,9 +31,9 @@ $fp = fopen(__FILE__, "r"); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt index d8accf2886..c7ef8174f1 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt @@ -15,13 +15,13 @@ $array2 = array("a" => "green", "yellow", "red"); // define some class with method class MyClass { - static function static_compare_func($a, $b) { - return strcasecmp($a, $b); - } + static function static_compare_func($a, $b) { + return strcasecmp($a, $b); + } - public function class_compare_func($a, $b) { - return strcasecmp($a, $b); - } + public function class_compare_func($a, $b) { + return strcasecmp($a, $b); + } } diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt index 61877a0653..20701a5c0b 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt @@ -31,9 +31,9 @@ $fp = fopen(__FILE__, "r"); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_intersect_ukey_variation1.phpt b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt index 417087feca..a02d3c03e3 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt @@ -32,9 +32,9 @@ $fp = fopen(__FILE__, "r"); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt index f9f479915f..a8f01201d5 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt @@ -32,9 +32,9 @@ $fp = fopen(__FILE__, "r"); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_intersect_ukey_variation9.phpt b/ext/standard/tests/array/array_intersect_ukey_variation9.phpt index 09ff302a47..205991cd41 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation9.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation9.phpt @@ -15,13 +15,13 @@ $array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); class MyClass { - static function static_compare_func($key1, $key2) { - return strcasecmp($key1, $key2); - } + static function static_compare_func($key1, $key2) { + return strcasecmp($key1, $key2); + } - public function class_compare_func($key1, $key2) { - return strcasecmp($key1, $key2); - } + public function class_compare_func($key1, $key2) { + return strcasecmp($key1, $key2); + } } diff --git a/ext/standard/tests/array/array_key_exists_variation3.phpt b/ext/standard/tests/array/array_key_exists_variation3.phpt index 11f0125be2..4a6409bb1f 100644 --- a/ext/standard/tests/array/array_key_exists_variation3.phpt +++ b/ext/standard/tests/array/array_key_exists_variation3.phpt @@ -21,15 +21,15 @@ $search = array ('zero', 'one', 'two'); $iterator = 1; foreach($keys as $key) { - echo "\n-- Iteration $iterator --\n"; - echo "Pass float as \$key:\n"; - try { - var_dump(array_key_exists($key, $search)); - } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; - } - echo "Cast float to int:\n"; - var_dump(array_key_exists((int)$key, $search)); + echo "\n-- Iteration $iterator --\n"; + echo "Pass float as \$key:\n"; + try { + var_dump(array_key_exists($key, $search)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } + echo "Cast float to int:\n"; + var_dump(array_key_exists((int)$key, $search)); } echo "Done"; diff --git a/ext/standard/tests/array/array_key_exists_variation6.phpt b/ext/standard/tests/array/array_key_exists_variation6.phpt index a801acdd34..fb81d3277a 100644 --- a/ext/standard/tests/array/array_key_exists_variation6.phpt +++ b/ext/standard/tests/array/array_key_exists_variation6.phpt @@ -27,17 +27,17 @@ $array = array ('null' => null, //iterate through original array foreach($array as $name => $input) { - $iterator = 1; - echo "\n-- Key in \$search array is : $name --\n"; - $search[$input] = 'test'; + $iterator = 1; + echo "\n-- Key in \$search array is : $name --\n"; + $search[$input] = 'test'; - //iterate through array again to see which values are considered equal - foreach($array as $key) { - echo "Iteration $iterator: "; - var_dump(array_key_exists($key, $search)); - $iterator++; - } - $search = null; + //iterate through array again to see which values are considered equal + foreach($array as $key) { + echo "Iteration $iterator: "; + var_dump(array_key_exists($key, $search)); + $iterator++; + } + $search = null; } echo "Done"; diff --git a/ext/standard/tests/array/array_key_exists_variation8.phpt b/ext/standard/tests/array/array_key_exists_variation8.phpt index 1d98b0eefb..a52a9acdaa 100644 --- a/ext/standard/tests/array/array_key_exists_variation8.phpt +++ b/ext/standard/tests/array/array_key_exists_variation8.phpt @@ -95,16 +95,16 @@ $inputs = array( // loop through each element of $inputs to check the behavior of array_key_exists() $iterator = 1; foreach($inputs as $type => $input) { - echo "\n-- Iteration $iterator: $type data --\n"; + echo "\n-- Iteration $iterator: $type data --\n"; - //iterate over again to get all different key values - foreach ($inputs as $new_type => $new_input) { - echo "-- \$key arguments are $new_type data:\n"; - foreach ($new_input as $key => $search) { - var_dump(array_key_exists($key, $input)); - } - } - $iterator++; + //iterate over again to get all different key values + foreach ($inputs as $new_type => $new_input) { + echo "-- \$key arguments are $new_type data:\n"; + foreach ($new_input as $key => $search) { + var_dump(array_key_exists($key, $input)); + } + } + $iterator++; }; echo "Done"; diff --git a/ext/standard/tests/array/array_keys_variation_003.phpt b/ext/standard/tests/array/array_keys_variation_003.phpt index adb2baea66..3163820de0 100644 --- a/ext/standard/tests/array/array_keys_variation_003.phpt +++ b/ext/standard/tests/array/array_keys_variation_003.phpt @@ -20,8 +20,8 @@ $types_arr = array( ); $values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", ""); foreach ($values as $value){ - var_dump($value); - var_dump(array_keys($types_arr, $value)); + var_dump($value); + var_dump(array_keys($types_arr, $value)); } echo "Done\n"; diff --git a/ext/standard/tests/array/array_map_001.phpt b/ext/standard/tests/array/array_map_001.phpt index c5d78c257e..ffa56c1309 100644 --- a/ext/standard/tests/array/array_map_001.phpt +++ b/ext/standard/tests/array/array_map_001.phpt @@ -6,13 +6,13 @@ array_map() and exceptions in the callback $a = array(1,2,3); function foo() { - throw new exception(1); + throw new exception(1); } try { - array_map("foo", $a, array(2,3)); + array_map("foo", $a, array(2,3)); } catch (Exception $e) { - var_dump("exception caught!"); + var_dump("exception caught!"); } echo "Done\n"; diff --git a/ext/standard/tests/array/array_map_error.phpt b/ext/standard/tests/array/array_map_error.phpt index d15f28425e..4739bbf663 100644 --- a/ext/standard/tests/array/array_map_error.phpt +++ b/ext/standard/tests/array/array_map_error.phpt @@ -15,9 +15,9 @@ function callback1() { return 1; } try { - var_dump( array_map('callback1') ); + var_dump( array_map('callback1') ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "\n-- Testing array_map() function with less no. of arrays than callback function arguments --\n"; @@ -26,9 +26,9 @@ function callback2($p, $q) { return $p * $q; } try { - var_dump( array_map('callback2', $arr1) ); + var_dump( array_map('callback2', $arr1) ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "\n-- Testing array_map() function with more no. of arrays than callback function arguments --\n"; diff --git a/ext/standard/tests/array/array_map_variation10.phpt b/ext/standard/tests/array/array_map_variation10.phpt index 184019cdf1..d5324f3e28 100644 --- a/ext/standard/tests/array/array_map_variation10.phpt +++ b/ext/standard/tests/array/array_map_variation10.phpt @@ -21,9 +21,9 @@ var_dump( array_map( function($a, $b) { return array($a, $b); }, $array1, $array echo "-- anonymous function with two parameters and passing one array --\n"; try { - var_dump( array_map( function($a, $b) { return array($a, $b); }, $array1)); + var_dump( array_map( function($a, $b) { return array($a, $b); }, $array1)); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "-- anonymous function with NULL parameter --\n"; diff --git a/ext/standard/tests/array/array_map_variation9.phpt b/ext/standard/tests/array/array_map_variation9.phpt index 9c70340b30..7089f9abc6 100644 --- a/ext/standard/tests/array/array_map_variation9.phpt +++ b/ext/standard/tests/array/array_map_variation9.phpt @@ -30,9 +30,9 @@ var_dump( array_map('callback1', $arr1) ); echo "-- checking binary safe array with two parameter callback function --\n"; try { - var_dump( array_map(b"callback2", $arr1) ); + var_dump( array_map(b"callback2", $arr1) ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "Done"; diff --git a/ext/standard/tests/array/array_merge_variation3.phpt b/ext/standard/tests/array/array_merge_variation3.phpt index b8444ffb09..1b15153c7f 100644 --- a/ext/standard/tests/array/array_merge_variation3.phpt +++ b/ext/standard/tests/array/array_merge_variation3.phpt @@ -42,7 +42,7 @@ $inputs = array( // int data /*1*/ 'int' => array( - 0, + 0, 1, 12345, -2345, diff --git a/ext/standard/tests/array/array_multisort_case.phpt b/ext/standard/tests/array/array_multisort_case.phpt index e56d297e49..39d9280c28 100644 --- a/ext/standard/tests/array/array_multisort_case.phpt +++ b/ext/standard/tests/array/array_multisort_case.phpt @@ -11,23 +11,23 @@ Test array_multisort() function : case-sensitive echo "*** Testing array_multisort() : case-sensitive\n"; $a = array( - 'Second', - 'First.1', - 'First.2', - 'First.3', - 'Twentieth', - 'Tenth', - 'Third', + 'Second', + 'First.1', + 'First.2', + 'First.3', + 'Twentieth', + 'Tenth', + 'Third', ); $b = array( - '2 a', - '1 bb 1', - '1 bB 2', - '1 BB 3', - '20 c', - '10 d', - '3 e', + '2 a', + '1 bb 1', + '1 bB 2', + '1 BB 3', + '20 c', + '10 d', + '3 e', ); array_multisort($b, SORT_STRING, $a); diff --git a/ext/standard/tests/array/array_multisort_incase.phpt b/ext/standard/tests/array/array_multisort_incase.phpt index 4799d8bcb5..98be7d06bc 100644 --- a/ext/standard/tests/array/array_multisort_incase.phpt +++ b/ext/standard/tests/array/array_multisort_incase.phpt @@ -11,23 +11,23 @@ Test array_multisort() function : case-insensitive echo "*** Testing array_multisort() : case-insensitive\n"; $a = array( - 'Second', - 'First.1', - 'First.2', - 'First.3', - 'Twentieth', - 'Tenth', - 'Third', + 'Second', + 'First.1', + 'First.2', + 'First.3', + 'Twentieth', + 'Tenth', + 'Third', ); $b = array( - '2 a', - '1 bb 1', - '1 bB 2', - '1 BB 3', - '20 c', - '10 d', - '3 e', + '2 a', + '1 bb 1', + '1 bB 2', + '1 BB 3', + '20 c', + '10 d', + '3 e', ); array_multisort($b, SORT_STRING | SORT_FLAG_CASE, $a); diff --git a/ext/standard/tests/array/array_multisort_natural.phpt b/ext/standard/tests/array/array_multisort_natural.phpt index 27b22a799d..f56c1b00a2 100644 --- a/ext/standard/tests/array/array_multisort_natural.phpt +++ b/ext/standard/tests/array/array_multisort_natural.phpt @@ -11,19 +11,19 @@ Test array_multisort() function : natural sorting echo "*** Testing array_multisort() : natural sorting\n"; $a = array( - 'Second', - 'First', - 'Twentieth', - 'Tenth', - 'Third', + 'Second', + 'First', + 'Twentieth', + 'Tenth', + 'Third', ); $b = array( - '2 a', - '1 b', - '20 c', - '10 d', - '3 e', + '2 a', + '1 b', + '20 c', + '10 d', + '3 e', ); array_multisort($b, SORT_NATURAL, $a); diff --git a/ext/standard/tests/array/array_multisort_natural_case.phpt b/ext/standard/tests/array/array_multisort_natural_case.phpt index 75db1565df..fc42219972 100644 --- a/ext/standard/tests/array/array_multisort_natural_case.phpt +++ b/ext/standard/tests/array/array_multisort_natural_case.phpt @@ -11,23 +11,23 @@ Test array_multisort() function : natural sorting case-sensitive echo "*** Testing array_multisort() : natural sorting case-sensitive\n"; $a = array( - 'Second', - 'First.1', - 'First.2', - 'First.3', - 'Twentieth', - 'Tenth', - 'Third', + 'Second', + 'First.1', + 'First.2', + 'First.3', + 'Twentieth', + 'Tenth', + 'Third', ); $b = array( - '2 a', - '1 bb 1', - '1 bB 2', - '1 BB 3', - '20 c', - '10 d', - '3 e', + '2 a', + '1 bb 1', + '1 bB 2', + '1 BB 3', + '20 c', + '10 d', + '3 e', ); array_multisort($b, SORT_NATURAL, $a); diff --git a/ext/standard/tests/array/array_multisort_natural_incase.phpt b/ext/standard/tests/array/array_multisort_natural_incase.phpt index b603dd57a4..0b12bf776d 100644 --- a/ext/standard/tests/array/array_multisort_natural_incase.phpt +++ b/ext/standard/tests/array/array_multisort_natural_incase.phpt @@ -11,23 +11,23 @@ Test array_multisort() function : natural sorting case-insensitive echo "*** Testing array_multisort() : natural sorting case-insensitive\n"; $a = array( - 'Second', - 'First.1', - 'First.2', - 'First.3', - 'Twentieth', - 'Tenth', - 'Third', + 'Second', + 'First.1', + 'First.2', + 'First.3', + 'Twentieth', + 'Tenth', + 'Third', ); $b = array( - '2 a', - '1 bb 1', - '1 bB 2', - '1 BB 3', - '20 c', - '10 d', - '3 e', + '2 a', + '1 bb 1', + '1 bB 2', + '1 BB 3', + '20 c', + '10 d', + '3 e', ); array_multisort($b, SORT_NATURAL | SORT_FLAG_CASE, $a); diff --git a/ext/standard/tests/array/array_multisort_variation1.phpt b/ext/standard/tests/array/array_multisort_variation1.phpt index a912680421..4cedadf071 100644 --- a/ext/standard/tests/array/array_multisort_variation1.phpt +++ b/ext/standard/tests/array/array_multisort_variation1.phpt @@ -12,10 +12,10 @@ echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler function test_error_handler($err_no, $err_msg, $filename, $linenum) { - if (error_reporting() & $err_no) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } + if (error_reporting() & $err_no) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } } set_error_handler('test_error_handler'); @@ -28,9 +28,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_multisort_variation2.phpt b/ext/standard/tests/array/array_multisort_variation2.phpt index f28988ecfa..4900b838ae 100644 --- a/ext/standard/tests/array/array_multisort_variation2.phpt +++ b/ext/standard/tests/array/array_multisort_variation2.phpt @@ -12,10 +12,10 @@ echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler function test_error_handler($err_no, $err_msg, $filename, $linenum) { - if (error_reporting() & $err_no) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } + if (error_reporting() & $err_no) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } } set_error_handler('test_error_handler'); @@ -30,9 +30,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_multisort_variation3.phpt b/ext/standard/tests/array/array_multisort_variation3.phpt index 07669d7fd2..02883e87d1 100644 --- a/ext/standard/tests/array/array_multisort_variation3.phpt +++ b/ext/standard/tests/array/array_multisort_variation3.phpt @@ -12,10 +12,10 @@ echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler function test_error_handler($err_no, $err_msg, $filename, $linenum) { - if (error_reporting() & $err_no) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } + if (error_reporting() & $err_no) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } } set_error_handler('test_error_handler'); @@ -29,9 +29,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_multisort_variation7.phpt b/ext/standard/tests/array/array_multisort_variation7.phpt index f073cd5df2..7ad9bd72a7 100644 --- a/ext/standard/tests/array/array_multisort_variation7.phpt +++ b/ext/standard/tests/array/array_multisort_variation7.phpt @@ -12,9 +12,9 @@ echo "*** Testing array_multisort() : usage variation - test sort order of all // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString { } diff --git a/ext/standard/tests/array/array_multisort_variation8.phpt b/ext/standard/tests/array/array_multisort_variation8.phpt index f0ef3e0dd5..5658e12420 100644 --- a/ext/standard/tests/array/array_multisort_variation8.phpt +++ b/ext/standard/tests/array/array_multisort_variation8.phpt @@ -12,15 +12,15 @@ echo "*** Testing array_multisort() : usage variation - test sort order of all // Define error handler function test_error_handler($err_no, $err_msg, $filename, $linenum) { - // We're testing sort order not errors so ignore. + // We're testing sort order not errors so ignore. } set_error_handler('test_error_handler'); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString { } diff --git a/ext/standard/tests/array/array_multisort_variation9.phpt b/ext/standard/tests/array/array_multisort_variation9.phpt index a5d689cc87..63f42f407d 100644 --- a/ext/standard/tests/array/array_multisort_variation9.phpt +++ b/ext/standard/tests/array/array_multisort_variation9.phpt @@ -12,9 +12,9 @@ echo "*** Testing array_multisort() : usage variation - test sort order of all // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString { } diff --git a/ext/standard/tests/array/array_reduce_variation1.phpt b/ext/standard/tests/array/array_reduce_variation1.phpt index 34c2856bac..6b1d21e046 100644 --- a/ext/standard/tests/array/array_reduce_variation1.phpt +++ b/ext/standard/tests/array/array_reduce_variation1.phpt @@ -26,9 +26,9 @@ var_dump(array_reduce($array, "oneArg", 2)); echo "\n--- Testing with a callback with too many parameters ---\n"; try { - var_dump(array_reduce($array, "threeArgs", 2)); + var_dump(array_reduce($array, "threeArgs", 2)); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } ?> diff --git a/ext/standard/tests/array/array_replace.phpt b/ext/standard/tests/array/array_replace.phpt index 48b616ab04..c3edba008c 100644 --- a/ext/standard/tests/array/array_replace.phpt +++ b/ext/standard/tests/array/array_replace.phpt @@ -4,26 +4,26 @@ Test array_replace and array_replace_recursive <?php $array1 = array( - 0 => 'dontclobber', - '1' => 'unclobbered', - 'test2' => 0.0, - 'test3' => array( - 'testarray2' => true, - 1 => array( - 'testsubarray1' => 'dontclobber2', - 'testsubarray2' => 'dontclobber3', - ), + 0 => 'dontclobber', + '1' => 'unclobbered', + 'test2' => 0.0, + 'test3' => array( + 'testarray2' => true, + 1 => array( + 'testsubarray1' => 'dontclobber2', + 'testsubarray2' => 'dontclobber3', + ), ), ); $array2 = array( - 1 => 'clobbered', - 'test3' => array( - 'testarray2' => false, - ), - 'test4' => array( - 'clobbered3' => array(0, 1, 2), - ), + 1 => 'clobbered', + 'test3' => array( + 'testarray2' => false, + ), + 'test4' => array( + 'clobbered3' => array(0, 1, 2), + ), ); $array3 = array(array(array(array()))); diff --git a/ext/standard/tests/array/array_shift_variation2.phpt b/ext/standard/tests/array/array_shift_variation2.phpt index 9e37cbb204..fae2e06e0f 100644 --- a/ext/standard/tests/array/array_shift_variation2.phpt +++ b/ext/standard/tests/array/array_shift_variation2.phpt @@ -39,7 +39,7 @@ $inputs = array( // int data /*1*/ 'int' => array( - 0, + 0, 1, 12345, -2345, diff --git a/ext/standard/tests/array/array_slice_variation5.phpt b/ext/standard/tests/array/array_slice_variation5.phpt index 5f127fd2eb..06f79c7168 100644 --- a/ext/standard/tests/array/array_slice_variation5.phpt +++ b/ext/standard/tests/array/array_slice_variation5.phpt @@ -16,8 +16,8 @@ echo "*** Testing array_slice() : usage variations ***\n"; $input = array ('one' => 1, 2 => 'two', 'three', 9 => 'nine', 'ten' => 10); for ($i = -7; $i <= 7; $i++) { - echo "\n-- \$offset is $i --\n"; - var_dump(array_slice($input, $i)); + echo "\n-- \$offset is $i --\n"; + var_dump(array_slice($input, $i)); } echo "\n-- \$offset is maximum integer value --\n"; var_dump(array_slice($input, PHP_INT_MAX)); diff --git a/ext/standard/tests/array/array_slice_variation6.phpt b/ext/standard/tests/array/array_slice_variation6.phpt index 86bde4ae3c..b54cd1a16b 100644 --- a/ext/standard/tests/array/array_slice_variation6.phpt +++ b/ext/standard/tests/array/array_slice_variation6.phpt @@ -17,8 +17,8 @@ $input = array ('one' => 1, 2 => 'two', 'three', 9 => 'nine', 'ten' => 10); $offset = 1; for ($i = -6; $i <= 6; $i++) { - echo "\n-- \$length is $i --\n"; - var_dump(array_slice($input, $offset, $i)); + echo "\n-- \$length is $i --\n"; + var_dump(array_slice($input, $offset, $i)); } echo "\n-- \$length is maximum integer value --\n"; var_dump(array_slice($input, $offset, PHP_INT_MAX)); diff --git a/ext/standard/tests/array/array_splice_variation3.phpt b/ext/standard/tests/array/array_splice_variation3.phpt index b5a55ca144..d5f76ac805 100644 --- a/ext/standard/tests/array/array_splice_variation3.phpt +++ b/ext/standard/tests/array/array_splice_variation3.phpt @@ -12,14 +12,14 @@ echo "*** array_splice() function : usage variations - lengths and offsets\n"; function test_splice ($offset, $length) { - echo " - No replacement\n"; - $input_array=array(0,1,2,3,4,5); - var_dump (array_splice ($input_array,$offset,$length)); - var_dump ($input_array); + echo " - No replacement\n"; + $input_array=array(0,1,2,3,4,5); + var_dump (array_splice ($input_array,$offset,$length)); + var_dump ($input_array); echo " - With replacement\n"; $input_array=array(0,1,2,3,4,5); var_dump (array_splice ($input_array,$offset,$length,array ("A","B","C"))); - var_dump ($input_array); + var_dump ($input_array); } echo "absolute offset - absolute length - cut from beginning\n"; diff --git a/ext/standard/tests/array/array_splice_variation4.phpt b/ext/standard/tests/array/array_splice_variation4.phpt index ddd966780e..06eecdf005 100644 --- a/ext/standard/tests/array/array_splice_variation4.phpt +++ b/ext/standard/tests/array/array_splice_variation4.phpt @@ -9,9 +9,9 @@ Test array_splice() function : usage variations - non array replacement values function test_splice ($replacement) { - $input_array=array(0,1); - var_dump (array_splice ($input_array,2,0,$replacement)); - var_dump ($input_array); + $input_array=array(0,1); + var_dump (array_splice ($input_array,2,0,$replacement)); + var_dump ($input_array); } test_splice (2); diff --git a/ext/standard/tests/array/array_sum.phpt b/ext/standard/tests/array/array_sum.phpt index 08aec2155e..9ba80beba6 100644 --- a/ext/standard/tests/array/array_sum.phpt +++ b/ext/standard/tests/array/array_sum.phpt @@ -7,8 +7,8 @@ memory_limit=128M <?php $i = 0; while ($i++ < 1000) { - $a[] = $i; - $b[] = (string)$i; + $a[] = $i; + $b[] = (string)$i; } $s1 = array_sum($a); $s2 = array_sum($b); @@ -16,8 +16,8 @@ var_dump($s1, $s2); $j = 0; while ($j++ < 100000) { - $c[] = $j; - $d[] = (string) $j; + $c[] = $j; + $d[] = (string) $j; } $s3 = array_sum($c); $s4 = array_sum($d); diff --git a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt index cc9e035f70..76dd2972c5 100644 --- a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt @@ -23,9 +23,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt index 4ded746508..9b84e8d489 100644 --- a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt @@ -23,9 +23,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_udiff_assoc_variation5.phpt b/ext/standard/tests/array/array_udiff_assoc_variation5.phpt index a48bda09b0..bfed60d30d 100644 --- a/ext/standard/tests/array/array_udiff_assoc_variation5.phpt +++ b/ext/standard/tests/array/array_udiff_assoc_variation5.phpt @@ -25,9 +25,9 @@ function too_many_parameters ($val1, $val2, $val3) { return 1; } try { - var_dump(array_udiff_assoc($arr1, $arr2, 'too_many_parameters')); + var_dump(array_udiff_assoc($arr1, $arr2, 'too_many_parameters')); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "\n-- comparison function taking too few parameters --\n"; diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt index dcfe07083f..e59012cbb6 100644 --- a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt @@ -24,9 +24,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt index e15076db5f..ee7cf405dc 100644 --- a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt @@ -24,9 +24,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt index e6f256d79a..2c917014ca 100644 --- a/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt +++ b/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt @@ -24,9 +24,9 @@ function too_many_parameters ($val1, $val2, $val3) { return 1; } try { - var_dump(array_udiff_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters')); + var_dump(array_udiff_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters')); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "\n-- comparison function taking too few parameters --\n"; diff --git a/ext/standard/tests/array/array_udiff_variation1.phpt b/ext/standard/tests/array/array_udiff_variation1.phpt index a90e3b0e67..9e98bda727 100644 --- a/ext/standard/tests/array/array_udiff_variation1.phpt +++ b/ext/standard/tests/array/array_udiff_variation1.phpt @@ -23,9 +23,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_udiff_variation2.phpt b/ext/standard/tests/array/array_udiff_variation2.phpt index 5c37a3a20a..28f1e8e1b1 100644 --- a/ext/standard/tests/array/array_udiff_variation2.phpt +++ b/ext/standard/tests/array/array_udiff_variation2.phpt @@ -23,9 +23,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_udiff_variation5.phpt b/ext/standard/tests/array/array_udiff_variation5.phpt index 1ca7977999..24d1207ed4 100644 --- a/ext/standard/tests/array/array_udiff_variation5.phpt +++ b/ext/standard/tests/array/array_udiff_variation5.phpt @@ -25,9 +25,9 @@ function too_many_parameters ($val1, $val2, $val3) { return 0; } try { - var_dump(array_udiff($arr1, $arr2, 'too_many_parameters')); + var_dump(array_udiff($arr1, $arr2, 'too_many_parameters')); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "\n-- comparison function taking too few parameters --\n"; diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt index c99a9947c5..8111006e3c 100644 --- a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt @@ -23,9 +23,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt index 00a50f3c2f..5ce935321f 100644 --- a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt @@ -23,9 +23,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt index 3b6befcc5e..990a711219 100644 --- a/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt +++ b/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt @@ -24,9 +24,9 @@ function too_many_parameters ($val1, $val2, $val3) { return 1; } try { - var_dump(array_uintersect_assoc($arr1, $arr2, 'too_many_parameters')); + var_dump(array_uintersect_assoc($arr1, $arr2, 'too_many_parameters')); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "\n-- comparison function taking too few parameters --\n"; diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt index 4889025872..908b39c859 100644 --- a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt @@ -24,9 +24,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt index a1d897d86e..c9b3e051c3 100644 --- a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt @@ -24,9 +24,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt index 5553adffb5..76d387d9c8 100644 --- a/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt @@ -24,9 +24,9 @@ function too_many_parameters ($val1, $val2, $val3) { return 1; } try { - var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters')); + var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters')); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "\n-- comparison function taking too few parameters --\n"; diff --git a/ext/standard/tests/array/array_uintersect_variation1.phpt b/ext/standard/tests/array/array_uintersect_variation1.phpt index 47534f70bc..336ce0a169 100644 --- a/ext/standard/tests/array/array_uintersect_variation1.phpt +++ b/ext/standard/tests/array/array_uintersect_variation1.phpt @@ -23,9 +23,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_uintersect_variation2.phpt b/ext/standard/tests/array/array_uintersect_variation2.phpt index d79cf66c21..851927e98b 100644 --- a/ext/standard/tests/array/array_uintersect_variation2.phpt +++ b/ext/standard/tests/array/array_uintersect_variation2.phpt @@ -23,9 +23,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/array/array_uintersect_variation5.phpt b/ext/standard/tests/array/array_uintersect_variation5.phpt index 1996d386f1..bcfdac094b 100644 --- a/ext/standard/tests/array/array_uintersect_variation5.phpt +++ b/ext/standard/tests/array/array_uintersect_variation5.phpt @@ -24,9 +24,9 @@ function too_many_parameters ($val1, $val2, $val3) { return 1; } try { - var_dump(array_uintersect($arr1, $arr2, 'too_many_parameters')); + var_dump(array_uintersect($arr1, $arr2, 'too_many_parameters')); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "\n-- comparison function taking too few parameters --\n"; diff --git a/ext/standard/tests/array/array_values_variation2.phpt b/ext/standard/tests/array/array_values_variation2.phpt index 5105168c1e..a334140001 100644 --- a/ext/standard/tests/array/array_values_variation2.phpt +++ b/ext/standard/tests/array/array_values_variation2.phpt @@ -38,7 +38,7 @@ $inputs = array( // int data /*1*/ 'int' => array( - 0, + 0, 1, 12345, -2345, diff --git a/ext/standard/tests/array/array_walk.phpt b/ext/standard/tests/array/array_walk.phpt index cf792bfa19..1f5457c9f7 100644 --- a/ext/standard/tests/array/array_walk.phpt +++ b/ext/standard/tests/array/array_walk.phpt @@ -4,22 +4,22 @@ array_walk() tests <?php function foo($v1, $v2, $v3) { - var_dump($v1); - var_dump($v2); - var_dump($v3); + var_dump($v1); + var_dump($v2); + var_dump($v3); } $var = array(1,2); var_dump(array_walk($var, "foo", "data")); function foo2($v1, $v2, $v3) { - throw new Exception($v3); + throw new Exception($v3); } try { - var_dump(array_walk($var,"foo2", "data")); + var_dump(array_walk($var,"foo2", "data")); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } echo "Done\n"; diff --git a/ext/standard/tests/array/array_walk_closure.phpt b/ext/standard/tests/array/array_walk_closure.phpt index 7ac62d7484..6cc49cf9d3 100644 --- a/ext/standard/tests/array/array_walk_closure.phpt +++ b/ext/standard/tests/array/array_walk_closure.phpt @@ -10,8 +10,8 @@ echo "\nclosure with array\n"; $ar = ["one" => 1, "two"=>2, "three" => 3]; $user_data = ["sum" => 42]; $func = function($value, $key, &$udata) { - var_dump($udata); - $udata["sum"] += $value; + var_dump($udata); + $udata["sum"] += $value; }; var_dump(array_walk($ar, $func, $user_data)); @@ -22,8 +22,8 @@ echo "\nclosure with use\n"; $ar = ["one" => 1, "two"=>2, "three" => 3]; $user_data = ["sum" => 42]; $func = function($value, $key) use (&$user_data) { - var_dump($user_data); - $user_data["sum"] += $value; + var_dump($user_data); + $user_data["sum"] += $value; }; var_dump(array_walk($ar, $func, $user_data)); @@ -35,8 +35,8 @@ echo "\nclosure with object\n"; $ar = ["one" => 1, "two"=>2, "three" => 3]; $user_data = (object)["sum" => 42]; $func = function($value, $key, &$udata) { - var_dump($udata); - $udata->sum += $value; + var_dump($udata); + $udata->sum += $value; }; var_dump(array_walk($ar, $func, $user_data)); @@ -48,8 +48,8 @@ var_dump($user_data->sum); echo "\nfunction with object\n"; function sum_it_up_object($value, $key, $udata) { - var_dump($udata); - $udata->sum += $value; + var_dump($udata); + $udata->sum += $value; } $ar = ["one" => 1, "two"=>2, "three" => 3]; @@ -63,8 +63,8 @@ var_dump($user_data->sum); echo "\nfunction with array\n"; function sum_it_up_array($value, $key, $udata) { - var_dump($udata); - $udata['sum'] += $value; + var_dump($udata); + $udata['sum'] += $value; } $ar = ["one" => 1, "two"=>2, "three" => 3]; @@ -77,9 +77,9 @@ var_dump($user_data['sum']); echo "\nclosure and exception\n"; $ar = ["one" => 1, "two"=>2, "three" => 3]; try { - var_dump(array_walk($ar, function($v, $k) { if ($v == 2) throw new Exception; } )); + var_dump(array_walk($ar, function($v, $k) { if ($v == 2) throw new Exception; } )); } catch (Exception $e) { - var_dump($e->getTrace()); + var_dump($e->getTrace()); } diff --git a/ext/standard/tests/array/array_walk_error2.phpt b/ext/standard/tests/array/array_walk_error2.phpt index 73445892a6..dfc95d3af8 100644 --- a/ext/standard/tests/array/array_walk_error2.phpt +++ b/ext/standard/tests/array/array_walk_error2.phpt @@ -23,33 +23,33 @@ echo "*** Testing array_walk() : error conditions - callback parameters ***\n"; // expected: Missing argument Warning try { - var_dump( array_walk($input, "callback1") ); + var_dump( array_walk($input, "callback1") ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } try { - var_dump( array_walk($input, "callback2", 4) ); + var_dump( array_walk($input, "callback2", 4) ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } // expected: Warning is suppressed try { - var_dump( @array_walk($input, "callback1") ); + var_dump( @array_walk($input, "callback1") ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } try { - var_dump( @array_walk($input, "callback2", 4) ); + var_dump( @array_walk($input, "callback2", 4) ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "-- Testing array_walk() function with too many callback parameters --\n"; try { - var_dump( array_walk($input, "callback1", 20, 10) ); + var_dump( array_walk($input, "callback1", 20, 10) ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "Done"; diff --git a/ext/standard/tests/array/array_walk_objects.phpt b/ext/standard/tests/array/array_walk_objects.phpt index 9f3ac8c1cd..a4a517746d 100644 --- a/ext/standard/tests/array/array_walk_objects.phpt +++ b/ext/standard/tests/array/array_walk_objects.phpt @@ -4,13 +4,13 @@ array_walk() and objects <?php function walk($key, $value) { - var_dump($value, $key); + var_dump($value, $key); } class test { - private $var_pri = "test_private"; - protected $var_pro = "test_protected"; - public $var_pub = "test_public"; + private $var_pri = "test_private"; + protected $var_pro = "test_protected"; + public $var_pub = "test_public"; } $stdclass = new stdclass; diff --git a/ext/standard/tests/array/array_walk_rec_objects.phpt b/ext/standard/tests/array/array_walk_rec_objects.phpt index 097143e8ec..51aeae11c9 100644 --- a/ext/standard/tests/array/array_walk_rec_objects.phpt +++ b/ext/standard/tests/array/array_walk_rec_objects.phpt @@ -4,13 +4,13 @@ array_walk_recursive() and objects <?php function walk($key, $value) { - var_dump($value, $key); + var_dump($value, $key); } class test { - private $var_pri = "test_private"; - protected $var_pro = "test_protected"; - public $var_pub = "test_public"; + private $var_pri = "test_private"; + protected $var_pro = "test_protected"; + public $var_pub = "test_public"; } $stdclass = new stdclass; diff --git a/ext/standard/tests/array/array_walk_recursive.phpt b/ext/standard/tests/array/array_walk_recursive.phpt index c8523055e9..0a7fc03a85 100644 --- a/ext/standard/tests/array/array_walk_recursive.phpt +++ b/ext/standard/tests/array/array_walk_recursive.phpt @@ -3,11 +3,11 @@ Test array_walk_recursive() --FILE-- <?php function foo($value) { - echo $value . " foo\n"; + echo $value . " foo\n"; } function bar($value) { - echo $value . " bar\n"; + echo $value . " bar\n"; } $arr = array (1,2,3); diff --git a/ext/standard/tests/array/array_walk_recursive1.phpt b/ext/standard/tests/array/array_walk_recursive1.phpt index f952b4410b..472cb1032d 100644 --- a/ext/standard/tests/array/array_walk_recursive1.phpt +++ b/ext/standard/tests/array/array_walk_recursive1.phpt @@ -4,22 +4,22 @@ array_walk_recursive() tests <?php function foo($v1, $v2, $v3) { - var_dump($v1); - var_dump($v2); - var_dump($v3); + var_dump($v1); + var_dump($v2); + var_dump($v3); } $var = array(1,2, array(2,3)); var_dump(array_walk_recursive($var, "foo", "data")); function foo2($v1, $v2, $v3) { - throw new Exception($v3); + throw new Exception($v3); } try { - var_dump(array_walk_recursive($var,"foo2", "data")); + var_dump(array_walk_recursive($var,"foo2", "data")); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } echo "Done\n"; diff --git a/ext/standard/tests/array/array_walk_recursive_error2.phpt b/ext/standard/tests/array/array_walk_recursive_error2.phpt index e9bd7ea175..f1686d7acd 100644 --- a/ext/standard/tests/array/array_walk_recursive_error2.phpt +++ b/ext/standard/tests/array/array_walk_recursive_error2.phpt @@ -23,33 +23,33 @@ echo "*** Testing array_walk_recursive() : error conditions - callback parameter // expected: Missing argument Warning try { - var_dump( array_walk_recursive($input, "callback1") ); + var_dump( array_walk_recursive($input, "callback1") ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } try { - var_dump( array_walk_recursive($input, "callback2", 4) ); + var_dump( array_walk_recursive($input, "callback2", 4) ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } // expected: Warning is suppressed try { - var_dump( @array_walk_recursive($input, "callback1") ); + var_dump( @array_walk_recursive($input, "callback1") ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } try { - var_dump( @array_walk_recursive($input, "callback2", 4) ); + var_dump( @array_walk_recursive($input, "callback2", 4) ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "-- Testing array_walk_recursive() function with too many callback parameters --\n"; try { - var_dump( array_walk_recursive($input, "callback1", 20, 10) ); + var_dump( array_walk_recursive($input, "callback1", 20, 10) ); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } echo "Done"; diff --git a/ext/standard/tests/array/arsort_basic.phpt b/ext/standard/tests/array/arsort_basic.phpt index afd8bb8f49..7ed285aac7 100644 --- a/ext/standard/tests/array/arsort_basic.phpt +++ b/ext/standard/tests/array/arsort_basic.phpt @@ -21,9 +21,9 @@ echo "*** Testing arsort() : basic functionality ***\n"; // an array containing unsorted string values with indices $unsorted_strings = array( - "l" => "lemon", "o" => "orange", - "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", - "b" => "banana", + "l" => "lemon", "o" => "orange", + "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", + "b" => "banana", ); // an array containing unsorted numeric values with indices $unsorted_numerics = array( 1 => 100, 2 => 33, 3 => 555, 4 => 22 ); diff --git a/ext/standard/tests/array/asort_basic.phpt b/ext/standard/tests/array/asort_basic.phpt index c0ae2bc88d..8b4a7c2081 100644 --- a/ext/standard/tests/array/asort_basic.phpt +++ b/ext/standard/tests/array/asort_basic.phpt @@ -21,9 +21,9 @@ echo "*** Testing asort() : basic functionality ***\n"; // an array containing unsorted string values with indices $unsorted_strings = array( - "l" => "lemon", "o" => "orange", - "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", - "b" => "banana", + "l" => "lemon", "o" => "orange", + "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", + "b" => "banana", ); // an array containing unsorted numeric values with indices $unsorted_numerics = array( 1 => 100, 2 => 33, 3 => 555, 4 => 22 ); diff --git a/ext/standard/tests/array/bug12776.phpt b/ext/standard/tests/array/bug12776.phpt index 54c6f6fceb..957832b97e 100644 --- a/ext/standard/tests/array/bug12776.phpt +++ b/ext/standard/tests/array/bug12776.phpt @@ -5,10 +5,10 @@ Bug #12776 (array_walk crash) function test($val,$key) { - global $globalArray; - $globalArray[]=$key; // this will end up crashing - $globalArray[]=(string)$key; // this will end up OK - print "val: $val; key: $key\n"; flush(); + global $globalArray; + $globalArray[]=$key; // this will end up crashing + $globalArray[]=(string)$key; // this will end up OK + print "val: $val; key: $key\n"; flush(); } $arr=array('k'=>'v'); diff --git a/ext/standard/tests/array/bug14580.phpt b/ext/standard/tests/array/bug14580.phpt index 1cf27f22d6..8f4c7d5bd3 100644 --- a/ext/standard/tests/array/bug14580.phpt +++ b/ext/standard/tests/array/bug14580.phpt @@ -2,10 +2,10 @@ Bug #14580 (key() not binary safe) --FILE-- <?php - $arr = array ("foo\0bar" => "foo\0bar"); - $key = key($arr); - echo strlen($key), ': '; - echo urlencode($key), "\n"; + $arr = array ("foo\0bar" => "foo\0bar"); + $key = key($arr); + echo strlen($key), ': '; + echo urlencode($key), "\n"; ?> --EXPECT-- 7: foo%00bar diff --git a/ext/standard/tests/array/bug20381.phpt b/ext/standard/tests/array/bug20381.phpt index 1adaa863b7..0da52d9fd9 100644 --- a/ext/standard/tests/array/bug20381.phpt +++ b/ext/standard/tests/array/bug20381.phpt @@ -3,20 +3,20 @@ Bug #20381 (array_merge_recursive mangles input arrays) --FILE-- <?php $a = array( - 'a1' => 1, - 'a2' => array( 1, 2, 3 ), - 'a3' => array( - 'a' => array( 10, 20, 30 ), - 'b' => 'b' - ) - ); + 'a1' => 1, + 'a2' => array( 1, 2, 3 ), + 'a3' => array( + 'a' => array( 10, 20, 30 ), + 'b' => 'b' + ) + ); $b = array( 'a1' => 2, - 'a2' => array( 3, 4, 5 ), - 'a3' => array( - 'c' => 'cc', - 'a' => array( 10, 40 ) - ) - ); + 'a2' => array( 3, 4, 5 ), + 'a3' => array( + 'c' => 'cc', + 'a' => array( 10, 40 ) + ) + ); var_dump($a); array_merge_recursive( $a, $b ); diff --git a/ext/standard/tests/array/bug20865.phpt b/ext/standard/tests/array/bug20865.phpt index f1edbabab5..6dfad2bcec 100644 --- a/ext/standard/tests/array/bug20865.phpt +++ b/ext/standard/tests/array/bug20865.phpt @@ -2,10 +2,10 @@ Bug #20865 (array_key_exists and NULL key) --FILE-- <?php - $ta = array(1, 2, 3); - $ta[NULL] = "Null Value"; + $ta = array(1, 2, 3); + $ta[NULL] = "Null Value"; - var_dump(array_key_exists(NULL, $ta)); + var_dump(array_key_exists(NULL, $ta)); ?> --EXPECT-- bool(true) diff --git a/ext/standard/tests/array/bug21918.phpt b/ext/standard/tests/array/bug21918.phpt index 8e440baf8c..e855aacd7e 100644 --- a/ext/standard/tests/array/bug21918.phpt +++ b/ext/standard/tests/array/bug21918.phpt @@ -7,8 +7,8 @@ echo "==Mixed==\n"; $a = array(-1=>'a', '-2'=>'b', 3=>'c', '4'=>'d', 5=>'e', '6001'=>'f', '07'=>'g'); foreach($a as $k => $v) { - var_dump($k); - var_dump($v); + var_dump($k); + var_dump($v); } echo "==Normal==\n"; @@ -16,16 +16,16 @@ $b = array(); $b[] = 'a'; foreach($b as $k => $v) { - var_dump($k); - var_dump($v); + var_dump($k); + var_dump($v); } echo "==Negative==\n"; $c = array('-2' => 'a'); foreach($c as $k => $v) { - var_dump($k); - var_dump($v); + var_dump($k); + var_dump($v); } ?> diff --git a/ext/standard/tests/array/bug22463.phpt b/ext/standard/tests/array/bug22463.phpt index 7993ac2576..434c2b6e23 100644 --- a/ext/standard/tests/array/bug22463.phpt +++ b/ext/standard/tests/array/bug22463.phpt @@ -4,23 +4,23 @@ Bug #22463 (array_reduce() segfaults) <?php function a($ary) { - return (is_array($ary) ? array_reduce($ary, 'cb', 0) : 1); + return (is_array($ary) ? array_reduce($ary, 'cb', 0) : 1); } function cb($v, $elem) { - return $v + a($elem); + return $v + a($elem); } $ary = array( - array( - array( - array( - array( - array(0, 1, 2, 3, 4) - ) - ) - ) - ) + array( + array( + array( + array( + array(0, 1, 2, 3, 4) + ) + ) + ) + ) ); var_dump(a($ary)); diff --git a/ext/standard/tests/array/bug24220.phpt b/ext/standard/tests/array/bug24220.phpt index c8e25709e9..d0242e6bf9 100644 --- a/ext/standard/tests/array/bug24220.phpt +++ b/ext/standard/tests/array/bug24220.phpt @@ -2,9 +2,9 @@ Bug #24220 (range() numeric string handling) --FILE-- <?php - var_dump(range("2003", "2004")); - var_dump(range("a", "z")); - var_dump(range("1", "10")); + var_dump(range("2003", "2004")); + var_dump(range("a", "z")); + var_dump(range("1", "10")); ?> --EXPECT-- array(2) { diff --git a/ext/standard/tests/array/bug24980.phpt b/ext/standard/tests/array/bug24980.phpt index 6c97562f6c..829e156afd 100644 --- a/ext/standard/tests/array/bug24980.phpt +++ b/ext/standard/tests/array/bug24980.phpt @@ -5,9 +5,9 @@ Bug #24980 (array_reduce() uses first element as default running total) /* test #1: numeric data */ function add_up($running_total, $current_value) { - echo "running_total is ".(int)$running_total.", current_value is {$current_value}\n"; - $running_total += $current_value * $current_value; - return $running_total; + echo "running_total is ".(int)$running_total.", current_value is {$current_value}\n"; + $running_total += $current_value * $current_value; + return $running_total; } $numbers = array (2,3,5,7); @@ -18,20 +18,20 @@ print "Total is $total\n"; $a = array("a", "b", "c"); function foo ($a, $b) { - return $a . $b; + return $a . $b; } var_dump(array_reduce($a, "foo")); /* test #3: basic test (used to leak memory) */ function rsum($v, $w) { - $v += $w; - return $v; + $v += $w; + return $v; } function rmul($v, $w) { - $v *= $w; - return $v; + $v *= $w; + return $v; } $a = array(1, 2, 3, 4, 5); $x = array(); diff --git a/ext/standard/tests/array/bug25708.phpt b/ext/standard/tests/array/bug25708.phpt index ff8b9f4304..0e695b69c9 100644 --- a/ext/standard/tests/array/bug25708.phpt +++ b/ext/standard/tests/array/bug25708.phpt @@ -3,55 +3,55 @@ Bug #25708 (extract($GLOBALS, EXTR_REFS) mangles $GLOBALS) --FILE-- <?php function foo($ref, $alt) { - unset($GLOBALS['a']); - unset($GLOBALS['b']); - $GLOBALS['a'] = 1; - $GLOBALS['b'] = 2; + unset($GLOBALS['a']); + unset($GLOBALS['b']); + $GLOBALS['a'] = 1; + $GLOBALS['b'] = 2; - $org_a = $GLOBALS['a']; - $org_b = $GLOBALS['b']; + $org_a = $GLOBALS['a']; + $org_b = $GLOBALS['b']; - if ($ref) { - global $a, $b; - } else { - /* zval temp_var(NULL); // refcount = 1 - * a = temp_var[x] // refcount = 2 - */ - $a = NULL; - $b = NULL; - } + if ($ref) { + global $a, $b; + } else { + /* zval temp_var(NULL); // refcount = 1 + * a = temp_var[x] // refcount = 2 + */ + $a = NULL; + $b = NULL; + } - debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); - echo "--\n"; - if ($alt) { - $a = &$GLOBALS['a']; - $b = &$GLOBALS['b']; - } else { - extract($GLOBALS, EXTR_REFS); - } - debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); - echo "--\n"; - $a = &$GLOBALS['a']; - $b = &$GLOBALS['b']; - debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); - echo "--\n"; - $GLOBALS['b'] = 3; - debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); - echo "--\n"; - $a = 4; - debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); - echo "--\n"; - $c = $b; - debug_zval_dump($b, $GLOBALS['b'], $c); - echo "--\n"; - $b = 'x'; - debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b'], $c); - echo "--\n"; - debug_zval_dump($org_a, $org_b); - echo "----"; - if ($ref) echo 'r'; - if ($alt) echo 'a'; - echo "\n"; + debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); + echo "--\n"; + if ($alt) { + $a = &$GLOBALS['a']; + $b = &$GLOBALS['b']; + } else { + extract($GLOBALS, EXTR_REFS); + } + debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); + echo "--\n"; + $a = &$GLOBALS['a']; + $b = &$GLOBALS['b']; + debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); + echo "--\n"; + $GLOBALS['b'] = 3; + debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); + echo "--\n"; + $a = 4; + debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); + echo "--\n"; + $c = $b; + debug_zval_dump($b, $GLOBALS['b'], $c); + echo "--\n"; + $b = 'x'; + debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b'], $c); + echo "--\n"; + debug_zval_dump($org_a, $org_b); + echo "----"; + if ($ref) echo 'r'; + if ($alt) echo 'a'; + echo "\n"; } $a = 'ok'; diff --git a/ext/standard/tests/array/bug25758.phpt b/ext/standard/tests/array/bug25758.phpt index ff97d2e3fb..a2d2952d85 100644 --- a/ext/standard/tests/array/bug25758.phpt +++ b/ext/standard/tests/array/bug25758.phpt @@ -2,8 +2,8 @@ Bug #25758 (var_export does not escape ' & \ inside array keys) --FILE-- <?php - $a = array ("quote'" => array("quote'")); - echo var_export($a, true); + $a = array ("quote'" => array("quote'")); + echo var_export($a, true); ?> --EXPECT-- array ( diff --git a/ext/standard/tests/array/bug29493.phpt b/ext/standard/tests/array/bug29493.phpt index 0cfe45910b..30a7c058c2 100644 --- a/ext/standard/tests/array/bug29493.phpt +++ b/ext/standard/tests/array/bug29493.phpt @@ -4,68 +4,68 @@ Bug #29493 (extract(EXTR_REFS) fails if array has multiple referrals) <?php function t1() { - $a = array('foo' => 'aaa'); - // refcount($a) = 1 - // refcount($a['foo']) = 1 - $b = $a; - // refcount($a) = 2 - // refcount($a['foo']) = 1 - $b['foo'] = 'bbb'; - // refcount($a) = 1 - // refcount($a['foo']) = 1 + $a = array('foo' => 'aaa'); + // refcount($a) = 1 + // refcount($a['foo']) = 1 + $b = $a; + // refcount($a) = 2 + // refcount($a['foo']) = 1 + $b['foo'] = 'bbb'; + // refcount($a) = 1 + // refcount($a['foo']) = 1 - var_dump($a, $b); + var_dump($a, $b); - extract($a, EXTR_REFS); + extract($a, EXTR_REFS); - $foo = 'noo'; + $foo = 'noo'; - var_dump($a, $b); + var_dump($a, $b); } function t2() { - $a = array('foo' => 'aaa'); - // refcount($a) = 1 - // refcount($a['foo']) = 1 - $b = &$a; - // refcount($a) = 2 - // is_ref($a) = true - // refcount($a['foo']) = 1 - $b['foo'] = 'bbb'; - // refcount($a) = 2 - // refcount($a['foo']) = 1 + $a = array('foo' => 'aaa'); + // refcount($a) = 1 + // refcount($a['foo']) = 1 + $b = &$a; + // refcount($a) = 2 + // is_ref($a) = true + // refcount($a['foo']) = 1 + $b['foo'] = 'bbb'; + // refcount($a) = 2 + // refcount($a['foo']) = 1 - var_dump($a, $b); + var_dump($a, $b); - extract($a, EXTR_REFS); + extract($a, EXTR_REFS); - $foo = 'noo'; + $foo = 'noo'; - var_dump($a, $b); + var_dump($a, $b); } function t3() { - $a = array('foo' => 'aaa'); - // refcount($a) = 1 - // refcount($a['foo']) = 1 - $b = &$a; - // refcount($a) = 2 - // is_ref($a) = true - // refcount($a['foo']) = 1 - unset($b); - // refcount($a) = 1 - // is_ref($a) = true - // refcount($a['foo']) = 1 + $a = array('foo' => 'aaa'); + // refcount($a) = 1 + // refcount($a['foo']) = 1 + $b = &$a; + // refcount($a) = 2 + // is_ref($a) = true + // refcount($a['foo']) = 1 + unset($b); + // refcount($a) = 1 + // is_ref($a) = true + // refcount($a['foo']) = 1 - var_dump($a); + var_dump($a); - extract($a, EXTR_REFS); + extract($a, EXTR_REFS); - $foo = 'noo'; + $foo = 'noo'; - var_dump($a); + var_dump($a); } t1(); diff --git a/ext/standard/tests/array/bug30266.phpt b/ext/standard/tests/array/bug30266.phpt index 0a196c0cb8..2579714ae7 100644 --- a/ext/standard/tests/array/bug30266.phpt +++ b/ext/standard/tests/array/bug30266.phpt @@ -4,13 +4,13 @@ Bug #30266 (Invalid opcode 137/1/8) and array_walk <?php class testc { - public $b = "c"; + public $b = "c"; - function crash($val) - { - $this->b = $val; - throw new Exception("Error"); - } + function crash($val) + { + $this->b = $val; + throw new Exception("Error"); + } } $fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); @@ -19,16 +19,16 @@ $myobj = new testc(); function test($item2, $key, $userd) { - $userd->crash($item2); + $userd->crash($item2); } try { - array_walk($fruits, 'test', $myobj); + array_walk($fruits, 'test', $myobj); } catch(Exception $e) { - echo "Caught: " . $e->getMessage() . "\n"; + echo "Caught: " . $e->getMessage() . "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/array/bug31213.phpt b/ext/standard/tests/array/bug31213.phpt index 6aa31d5e0e..829c657d1e 100644 --- a/ext/standard/tests/array/bug31213.phpt +++ b/ext/standard/tests/array/bug31213.phpt @@ -3,27 +3,27 @@ Bug #31213 (Sideeffects caused by bug #29493) --FILE-- <?php function test($use_extract) { - $a = 1; - $b = 1; + $a = 1; + $b = 1; - $arr = array( - '_a' => $a, - '_b' => &$b - ); + $arr = array( + '_a' => $a, + '_b' => &$b + ); - var_dump($a, $b); + var_dump($a, $b); - if ($use_extract) { - extract($arr, EXTR_REFS); - } else { - $_a = &$arr['_a']; - $_b = &$arr['_b']; - } + if ($use_extract) { + extract($arr, EXTR_REFS); + } else { + $_a = &$arr['_a']; + $_b = &$arr['_b']; + } - $_a++; - $_b++; + $_a++; + $_b++; - var_dump($a, $b, $_a, $_b, $arr); + var_dump($a, $b, $_a, $_b, $arr); } test(false); diff --git a/ext/standard/tests/array/bug34066.phpt b/ext/standard/tests/array/bug34066.phpt index 44710b0426..df524feb9c 100644 --- a/ext/standard/tests/array/bug34066.phpt +++ b/ext/standard/tests/array/bug34066.phpt @@ -245,21 +245,21 @@ function gen_xml($val, $key, $prefix) global $xml_fd; print "gen_xml(prefix=$prefix)\n"; if (is_array($val)) { - if (preg_match('/^\d+$/', $key)) { - if ($key == 1) { - print substr($prefix, 0, -1) . "\n"; - } - array_walk($val, "gen_xml", "$prefix@"); - } - else { - array_walk($val, "gen_xml", "$prefix$key/"); - } + if (preg_match('/^\d+$/', $key)) { + if ($key == 1) { + print substr($prefix, 0, -1) . "\n"; + } + array_walk($val, "gen_xml", "$prefix@"); } else { - if (strlen($val) > 0) - print "$prefix$key=$val\n"; - else - print "$prefix$key\n"; + array_walk($val, "gen_xml", "$prefix$key/"); + } + } + else { + if (strlen($val) > 0) + print "$prefix$key=$val\n"; + else + print "$prefix$key\n"; } print "gen_xml(prefix=$prefix) end\n"; } diff --git a/ext/standard/tests/array/bug34066_1.phpt b/ext/standard/tests/array/bug34066_1.phpt index 5200fa86a6..5ded4ea816 100644 --- a/ext/standard/tests/array/bug34066_1.phpt +++ b/ext/standard/tests/array/bug34066_1.phpt @@ -245,21 +245,21 @@ function gen_xml($val, $key, $prefix) global $xml_fd; print "gen_xml(prefix=$prefix)\n"; if (is_array($val)) { - if (preg_match('/^\d+$/', $key)) { - if ($key == 1) { - print substr($prefix, 0, -1) . "\n"; - } - array_walk_recursive($val, "gen_xml", "$prefix@"); - } - else { - array_walk_recursive($val, "gen_xml", "$prefix$key/"); - } + if (preg_match('/^\d+$/', $key)) { + if ($key == 1) { + print substr($prefix, 0, -1) . "\n"; + } + array_walk_recursive($val, "gen_xml", "$prefix@"); } else { - if (strlen($val) > 0) - print "$prefix$key=$val\n"; - else - print "$prefix$key\n"; + array_walk_recursive($val, "gen_xml", "$prefix$key/"); + } + } + else { + if (strlen($val) > 0) + print "$prefix$key=$val\n"; + else + print "$prefix$key\n"; } print "gen_xml(prefix=$prefix) end\n"; } diff --git a/ext/standard/tests/array/bug35014.phpt b/ext/standard/tests/array/bug35014.phpt index b674590fd6..8980f00d80 100644 --- a/ext/standard/tests/array/bug35014.phpt +++ b/ext/standard/tests/array/bug35014.phpt @@ -7,18 +7,18 @@ precision=14 --FILE-- <?php $tests = array( - array(), - array(0), - array(3), - array(3, 3), - array(0.5, 2), - array(99999999, 99999999), - array(8.993, 7443241,988, sprintf("%u", -1)+0.44), - array(2,sprintf("%u", -1)), + array(), + array(0), + array(3), + array(3, 3), + array(0.5, 2), + array(99999999, 99999999), + array(8.993, 7443241,988, sprintf("%u", -1)+0.44), + array(2,sprintf("%u", -1)), ); foreach ($tests as $v) { - var_dump(array_product($v)); + var_dump(array_product($v)); } ?> --EXPECT-- diff --git a/ext/standard/tests/array/bug35014_64bit.phpt b/ext/standard/tests/array/bug35014_64bit.phpt index 3b3d29b5be..91face05af 100644 --- a/ext/standard/tests/array/bug35014_64bit.phpt +++ b/ext/standard/tests/array/bug35014_64bit.phpt @@ -7,18 +7,18 @@ precision=14 --FILE-- <?php $tests = array( - array(), - array(0), - array(3), - array(3, 3), - array(0.5, 2), - array(99999999, 99999999), - array(8.993, 7443241,988, sprintf("%u", -1)+0.44), - array(2,sprintf("%u", -1)), + array(), + array(0), + array(3), + array(3, 3), + array(0.5, 2), + array(99999999, 99999999), + array(8.993, 7443241,988, sprintf("%u", -1)+0.44), + array(2,sprintf("%u", -1)), ); foreach ($tests as $v) { - var_dump(array_product($v)); + var_dump(array_product($v)); } ?> --EXPECT-- diff --git a/ext/standard/tests/array/bug35022.phpt b/ext/standard/tests/array/bug35022.phpt index 07138f138d..8c67c5201a 100644 --- a/ext/standard/tests/array/bug35022.phpt +++ b/ext/standard/tests/array/bug35022.phpt @@ -6,7 +6,7 @@ $state = array("one" => 1, "two" => 2, "three" => 3); function foo( &$state ) { $contentDict = end( $state ); for ( $contentDict = end( $state ); $contentDict !== false; $contentDict = prev( $state ) ) { - echo key($state) . " => " . current($state) . "\n"; + echo key($state) . " => " . current($state) . "\n"; } } foo($state); diff --git a/ext/standard/tests/array/bug35821.phpt b/ext/standard/tests/array/bug35821.phpt index 3b1ecb6278..e01ec6e392 100644 --- a/ext/standard/tests/array/bug35821.phpt +++ b/ext/standard/tests/array/bug35821.phpt @@ -5,15 +5,15 @@ Bug #35821 (array_map() segfaults when exception is throwed from the callback) class Element { - public function ThrowException () - { - throw new Exception(); - } + public function ThrowException () + { + throw new Exception(); + } - public static function CallBack(Element $elem) - { - $elem->ThrowException(); - } + public static function CallBack(Element $elem) + { + $elem->ThrowException(); + } } $arr = array(new Element(), new Element(), new Element()); diff --git a/ext/standard/tests/array/bug39576.phpt b/ext/standard/tests/array/bug39576.phpt index bb58e79183..3ac9756941 100644 --- a/ext/standard/tests/array/bug39576.phpt +++ b/ext/standard/tests/array/bug39576.phpt @@ -5,9 +5,9 @@ Bug #39576 (array_walk() doesn't separate userdata zval) class Test { - public $_table = ''; - public $_columns = array (); - public $_primary = array (); + public $_table = ''; + public $_columns = array (); + public $_primary = array (); } @@ -18,16 +18,16 @@ $test->_columns['name'] = new stdClass; function test ($value, $column, &$columns) {} array_walk ( - get_object_vars ($test), - 'test', - $test->_columns + get_object_vars ($test), + 'test', + $test->_columns ); var_dump($test); array_intersect_key ( - get_object_vars ($test), - $test->_primary + get_object_vars ($test), + $test->_primary ); echo "Done\n"; diff --git a/ext/standard/tests/array/bug41686.phpt b/ext/standard/tests/array/bug41686.phpt index d293fdf175..b94acb608d 100644 --- a/ext/standard/tests/array/bug41686.phpt +++ b/ext/standard/tests/array/bug41686.phpt @@ -6,12 +6,12 @@ $a = array(1,2,3); $b = array('a'=>1,'b'=>1,'c'=>2); var_dump( - array_slice($a, 1), - array_slice($a, 1, 2, TRUE), - array_slice($a, 1, NULL, TRUE), - array_slice($b, 1), - array_slice($b, 1, 2, TRUE), - array_slice($b, 1, NULL, TRUE) + array_slice($a, 1), + array_slice($a, 1, 2, TRUE), + array_slice($a, 1, NULL, TRUE), + array_slice($b, 1), + array_slice($b, 1, 2, TRUE), + array_slice($b, 1, NULL, TRUE) ); echo "Done\n"; diff --git a/ext/standard/tests/array/bug42233.phpt b/ext/standard/tests/array/bug42233.phpt index 0cebc428f7..c02a620ae6 100644 --- a/ext/standard/tests/array/bug42233.phpt +++ b/ext/standard/tests/array/bug42233.phpt @@ -4,9 +4,9 @@ Bug #42233 (extract(): scandic characters not allowed as variable name) <?php $test = array( - 'a' => '1', - 'æ' => '2', - 'æøåäö' => '3', + 'a' => '1', + 'æ' => '2', + 'æøåäö' => '3', ); var_dump($test); diff --git a/ext/standard/tests/array/bug42838.phpt b/ext/standard/tests/array/bug42838.phpt index 5a09ae9c8e..fbd8234987 100644 --- a/ext/standard/tests/array/bug42838.phpt +++ b/ext/standard/tests/array/bug42838.phpt @@ -5,10 +5,10 @@ Bug #42838 (Wrong results in array_diff_uassoc()) function key_compare_func($a, $b) { - if ($a === $b) { - return 0; - } - return ($a > $b)? 1:-1; + if ($a === $b) { + return 0; + } + return ($a > $b)? 1:-1; } $array1 = array("a" => "green", "b" => "Brown", 'c' => 'blue', 0 => 'red'); diff --git a/ext/standard/tests/array/bug45312.phpt b/ext/standard/tests/array/bug45312.phpt index 858bdfa4bf..a315814108 100644 --- a/ext/standard/tests/array/bug45312.phpt +++ b/ext/standard/tests/array/bug45312.phpt @@ -12,7 +12,7 @@ class cr { return ($a->priv_member > $b->priv_member) ? 1 : -1; } static function comp_func_cr2($a, $b) { - echo "."; + echo "."; if ($a->priv_member === $b->priv_member) return 0; return ($a->priv_member < $b->priv_member) ? 1 : -1; } @@ -24,11 +24,11 @@ $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),); $result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr")); foreach($result as $val) { - $val->dump(); + $val->dump(); } $result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr2")); foreach($result as $val) { - $val->dump(); + $val->dump(); } ?> --EXPECT-- diff --git a/ext/standard/tests/array/bug68553.phpt b/ext/standard/tests/array/bug68553.phpt index fbee975d17..966c98b544 100644 --- a/ext/standard/tests/array/bug68553.phpt +++ b/ext/standard/tests/array/bug68553.phpt @@ -5,19 +5,19 @@ Bug #68553 (array_column: null values in $index_key become incrementing keys in $i = 100; /* increase the resource id to make test stable */ while ($i--) { - $fd = fopen(__FILE__, "r"); - fclose($fd); + $fd = fopen(__FILE__, "r"); + fclose($fd); } $a = [ - ['a' => 10], - ['a' => 20], - ['a' => true], - ['a' => false], - ['a' => fopen(__FILE__, "r")], - ['a' => -5], - ['a' => 7.38], - ['a' => null, "test"], - ['a' => null], + ['a' => 10], + ['a' => 20], + ['a' => true], + ['a' => false], + ['a' => fopen(__FILE__, "r")], + ['a' => -5], + ['a' => 7.38], + ['a' => null, "test"], + ['a' => null], ]; var_dump(array_column($a, null, 'a')); diff --git a/ext/standard/tests/array/bug69198.phpt b/ext/standard/tests/array/bug69198.phpt index 96a0f9a963..3441bee5d7 100644 --- a/ext/standard/tests/array/bug69198.phpt +++ b/ext/standard/tests/array/bug69198.phpt @@ -3,7 +3,7 @@ Bug #69198 (Compact function generate array with length but no content) --FILE-- <?php if (false) { - $willNeverBeDefined = true; + $willNeverBeDefined = true; } $result = compact('willNeverBeDefined'); var_dump($result, empty($result), $result === array(), empty($willNeverBeDefined)); diff --git a/ext/standard/tests/array/bug69299.phpt b/ext/standard/tests/array/bug69299.phpt index 088b10fd13..77c76166af 100644 --- a/ext/standard/tests/array/bug69299.phpt +++ b/ext/standard/tests/array/bug69299.phpt @@ -4,12 +4,12 @@ Bug #69299 (Regression in array_filter's $flag argument in PHP 7) <?php $toFilter = array('foo' => 'bar', 'fiz' => 'buz'); $filtered = array_filter($toFilter, function ($value, $key) { - if ($value === 'buz' - || $key === 'foo' - ) { - return false; - } - return true; + if ($value === 'buz' + || $key === 'foo' + ) { + return false; + } + return true; }, ARRAY_FILTER_USE_BOTH); var_dump($filtered); ?> diff --git a/ext/standard/tests/array/bug69723.phpt b/ext/standard/tests/array/bug69723.phpt index 23b3576a51..88183c5aae 100644 --- a/ext/standard/tests/array/bug69723.phpt +++ b/ext/standard/tests/array/bug69723.phpt @@ -3,23 +3,23 @@ Bug #69723 (Passing parameters by reference and array_column) --FILE-- <?php function byReference( & $array){ - foreach($array as &$item){ - $item['nanana'] = 'batman'; - $item['superhero'] = 'robin'; - } + foreach($array as &$item){ + $item['nanana'] = 'batman'; + $item['superhero'] = 'robin'; + } } $array = [ - [ - 'superhero'=> 'superman', - 'nanana' => 'no nana' - ], - [ - 'superhero'=> 'acuaman', - 'nanana' => 'no nana' - ], + [ + 'superhero'=> 'superman', + 'nanana' => 'no nana' + ], + [ + 'superhero'=> 'acuaman', + 'nanana' => 'no nana' + ], - ]; + ]; var_dump(array_column($array, 'superhero')); byReference($array); diff --git a/ext/standard/tests/array/bug70713.phpt b/ext/standard/tests/array/bug70713.phpt index f24720607d..fab1661e84 100644 --- a/ext/standard/tests/array/bug70713.phpt +++ b/ext/standard/tests/array/bug70713.phpt @@ -5,17 +5,17 @@ Bug #70713: Use After Free Vulnerability in array_walk()/array_walk_recursive() class obj { - function __tostring() - { - global $arr; + function __tostring() + { + global $arr; - $arr = 1; - for ($i = 0; $i < 5; $i++) { - $v[$i] = 'hi'.$i; - } + $arr = 1; + for ($i = 0; $i < 5; $i++) { + $v[$i] = 'hi'.$i; + } - return 'hi'; - } + return 'hi'; + } } $arr = array('string' => new obj); diff --git a/ext/standard/tests/array/bug71334.phpt b/ext/standard/tests/array/bug71334.phpt index 7a37d0953a..ba14f08c18 100644 --- a/ext/standard/tests/array/bug71334.phpt +++ b/ext/standard/tests/array/bug71334.phpt @@ -5,29 +5,29 @@ Bug #71334: Cannot access array keys while uksort() class myClass { - private $a = [ - 'foo-test' => [1], - '-' => [2], - 'bar-test' => [3] - ]; + private $a = [ + 'foo-test' => [1], + '-' => [2], + 'bar-test' => [3] + ]; - private function _mySort($x, $y) - { - if (!isset($this->a[$x])) { - throw new Exception('Missing X: "' . $x . '"'); - } + private function _mySort($x, $y) + { + if (!isset($this->a[$x])) { + throw new Exception('Missing X: "' . $x . '"'); + } - if (!isset($this->a[$y])) { - throw new Exception('Missing Y: "' . $y . '"'); - } + if (!isset($this->a[$y])) { + throw new Exception('Missing Y: "' . $y . '"'); + } - return $x < $y; - } + return $x < $y; + } - public function __construct() - { - uksort($this->a, [$this, '_mySort']); - } + public function __construct() + { + uksort($this->a, [$this, '_mySort']); + } } new myClass(); diff --git a/ext/standard/tests/array/bug71660.phpt b/ext/standard/tests/array/bug71660.phpt index c2d7192378..067f533381 100644 --- a/ext/standard/tests/array/bug71660.phpt +++ b/ext/standard/tests/array/bug71660.phpt @@ -4,7 +4,7 @@ Bug #71660 (array_column behaves incorrectly after foreach by reference) <?php $arr = array('id' => 12345, 'name' => 'sam'); foreach ($arr as &$v) { - $v = $v; + $v = $v; } $arr = [$arr]; diff --git a/ext/standard/tests/array/bug72622.phpt b/ext/standard/tests/array/bug72622.phpt index 66e22f3bf9..cf1a3ece8a 100644 --- a/ext/standard/tests/array/bug72622.phpt +++ b/ext/standard/tests/array/bug72622.phpt @@ -4,11 +4,11 @@ Bug #72622 (array_walk + array_replace_recursive create references from nothing) <?php function walk (array $arr) { - array_walk($arr, function (&$val, $name) { + array_walk($arr, function (&$val, $name) { - }); + }); - return $arr; + return $arr; } $arr3 = ['foo' => 'foo']; diff --git a/ext/standard/tests/array/bug76713.phpt b/ext/standard/tests/array/bug76713.phpt index 0c993f5721..8bb8bf221f 100644 --- a/ext/standard/tests/array/bug76713.phpt +++ b/ext/standard/tests/array/bug76713.phpt @@ -4,7 +4,7 @@ Bug #76713 (Segmentation fault caused by property corruption) <?php function test($obj) { - return array_column(array($obj), "prop"); + return array_column(array($obj), "prop"); } $obj = new Stdclass(); @@ -18,10 +18,10 @@ test($obj); var_dump($obj->prop); class C { - public $name; - public function __get($name) { - return $this->name; - } + public $name; + public function __get($name) { + return $this->name; + } } $obj = new C; diff --git a/ext/standard/tests/array/bug77395.phpt b/ext/standard/tests/array/bug77395.phpt index bca1e3136c..a4a79f5e2f 100644 --- a/ext/standard/tests/array/bug77395.phpt +++ b/ext/standard/tests/array/bug77395.phpt @@ -3,10 +3,10 @@ Bug #77395 (segfault about array_multisort) --FILE-- <?php function error_handle($level, $message, $file = '', $line = 0){ - $a = [1,2,3]; - $b = [3,2,1]; - echo $message; - array_multisort($a, SORT_ASC, $b); // if comment this line, no segfault happen + $a = [1,2,3]; + $b = [3,2,1]; + echo $message; + array_multisort($a, SORT_ASC, $b); // if comment this line, no segfault happen } set_error_handler('error_handle'); $data = [['aa'=> 'bb',], ['aa'=> 'bb',],]; diff --git a/ext/standard/tests/array/compact_variation2.phpt b/ext/standard/tests/array/compact_variation2.phpt index 17ac7882c7..fb186ae002 100644 --- a/ext/standard/tests/array/compact_variation2.phpt +++ b/ext/standard/tests/array/compact_variation2.phpt @@ -13,10 +13,10 @@ $a = 'main.a'; $b = 'main.b'; function f() { - $b = 'f.b'; - $c = 'f.c'; - var_dump(compact('a','b','c')); - var_dump(compact(array('a','b','c'))); + $b = 'f.b'; + $c = 'f.c'; + var_dump(compact('a','b','c')); + var_dump(compact(array('a','b','c'))); } f(); diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt index dd5c2342fc..a7d4afb53b 100644 --- a/ext/standard/tests/array/count_recursive.phpt +++ b/ext/standard/tests/array/count_recursive.phpt @@ -31,7 +31,7 @@ print "COUNT_NORMAL: should be 1, is ".count("string")."\n"; print "COUNT_NORMAL: should be 2, is ".count(array("a", array("b")))."\n"; $arr = array('a'=>array(NULL, NULL, NULL), 1=>array(NULL=>1, 1=>NULL), - array(array(array(array(array(NULL)))))); + array(array(array(array(array(NULL)))))); print "-- Testing really cool arrays --\n"; print "COUNT_NORMAL: should be 3, is ".count($arr, COUNT_NORMAL)."\n"; print "COUNT_RECURSIVE: should be 13, is ".count($arr, COUNT_RECURSIVE)."\n"; @@ -47,7 +47,7 @@ $count_array = array( array( 4 => 1, 3 => -2.344, "3" => "string", "2" => NULL, 1 => -2.344, array()), array( TRUE => TRUE, FALSE => FALSE, "" => "", " " => " ", - NULL => NULL, "\x000" => "\x000", "\000" => "\000"), + NULL => NULL, "\x000" => "\x000", "\000" => "\000"), array( NULL, 1.23 => "Hi", "string" => "hello", array("" => "World", "-2.34" => "a", "0" => "b")) ); diff --git a/ext/standard/tests/array/current_variation2.phpt b/ext/standard/tests/array/current_variation2.phpt index 2bbc5dca42..8a6b56d99a 100644 --- a/ext/standard/tests/array/current_variation2.phpt +++ b/ext/standard/tests/array/current_variation2.phpt @@ -39,7 +39,7 @@ $inputs = array( // int data /*1*/ 'int' => array( - 0, + 0, 1, 12345, -2345, diff --git a/ext/standard/tests/array/data.inc b/ext/standard/tests/array/data.inc index bbc8d43c23..c8ad4fe295 100644 --- a/ext/standard/tests/array/data.inc +++ b/ext/standard/tests/array/data.inc @@ -1,13 +1,13 @@ <?php $tmp = pow(2,24); $data = array( - 'PHP', - 17=>'PHP: Hypertext Preprocessor', - 5=>'Test', - 'test'=>27, - 1000=>'test', - "-1000"=>array('banana', 'orange'), - 'monkey', - $tmp=>-1/3 + 'PHP', + 17=>'PHP: Hypertext Preprocessor', + 5=>'Test', + 'test'=>27, + 1000=>'test', + "-1000"=>array('banana', 'orange'), + 'monkey', + $tmp=>-1/3 ); ?> diff --git a/ext/standard/tests/array/extract_typed_ref.phpt b/ext/standard/tests/array/extract_typed_ref.phpt index 8b697d5ccb..6d2a5a9272 100644 --- a/ext/standard/tests/array/extract_typed_ref.phpt +++ b/ext/standard/tests/array/extract_typed_ref.phpt @@ -2,17 +2,17 @@ extract() into typed references must respect their type --FILE-- <?php - + class Test { - public int $i = 0; - public string $s = ""; + public int $i = 0; + public string $s = ""; } $test = new Test; $i =& $test->i; $s =& $test->s; try { - extract(['i' => 'foo', 's' => 42]); + extract(['i' => 'foo', 's' => 42]); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } var_dump($test->i, $test->s); diff --git a/ext/standard/tests/array/extract_variation7.phpt b/ext/standard/tests/array/extract_variation7.phpt index 1502a52380..eb5171bfc7 100644 --- a/ext/standard/tests/array/extract_variation7.phpt +++ b/ext/standard/tests/array/extract_variation7.phpt @@ -9,7 +9,7 @@ $a = array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "f var_dump ( extract($a, EXTR_PREFIX_ALL, "same")); $b = array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", - "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ); + "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ); var_dump ( extract($b, EXTR_PREFIX_ALL, "same")); var_dump ( extract($b, EXTR_PREFIX_ALL, "diff")); diff --git a/ext/standard/tests/array/key_variation2.phpt b/ext/standard/tests/array/key_variation2.phpt index 67c7105ec6..3a6022e08a 100644 --- a/ext/standard/tests/array/key_variation2.phpt +++ b/ext/standard/tests/array/key_variation2.phpt @@ -97,8 +97,8 @@ $iterator = 1; foreach($inputs as $key => $input) { echo "\n-- Iteration $iterator : $key data --\n"; while (key($input) !== NULL) { - var_dump(key($input)); - next($input); + var_dump(key($input)); + next($input); } $iterator++; }; diff --git a/ext/standard/tests/array/krsort_basic.phpt b/ext/standard/tests/array/krsort_basic.phpt index 642dfc2070..393b7f06e4 100644 --- a/ext/standard/tests/array/krsort_basic.phpt +++ b/ext/standard/tests/array/krsort_basic.phpt @@ -21,9 +21,9 @@ echo "*** Testing krsort() : basic functionality ***\n"; // an array containing unsorted string values with indices $unsorted_strings = array( "lemon" => "l", "orange" => "o", "banana" => "b" ); $unsorted_strings = array( - "l" => "lemon", "o" => "orange", - "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", - "b" => "banana", + "l" => "lemon", "o" => "orange", + "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", + "b" => "banana", ); // an array containing unsorted numeric values with indices $unsorted_numerics = array( 100 => 4, 33 => 3, 555 => 2, 22 => 1 ); diff --git a/ext/standard/tests/array/ksort_basic.phpt b/ext/standard/tests/array/ksort_basic.phpt index a24674ff33..1a62f3ac2c 100644 --- a/ext/standard/tests/array/ksort_basic.phpt +++ b/ext/standard/tests/array/ksort_basic.phpt @@ -19,9 +19,9 @@ echo "*** Testing ksort() : basic functionality ***\n"; // an array containing unsorted string values with indices $unsorted_strings = array( - "l" => "lemon", "o" => "orange", - "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", - "b" => "banana", + "l" => "lemon", "o" => "orange", + "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", + "b" => "banana", ); // an array containing unsorted numeric values with indices $unsorted_numerics = array( 100 => 4, 33 => 3, 555 => 2, 22 => 1 ); diff --git a/ext/standard/tests/array/natcasesort_object2.phpt b/ext/standard/tests/array/natcasesort_object2.phpt index 3eef437588..b82d0a0b7a 100644 --- a/ext/standard/tests/array/natcasesort_object2.phpt +++ b/ext/standard/tests/array/natcasesort_object2.phpt @@ -17,20 +17,20 @@ echo "*** Testing natcasesort() : object functionality ***\n"; // class declaration for string objects class for_string_natcasesort { - public $public_class_value; - private $private_class_value; - protected $protected_class_value; - // initializing object member value - function __construct($value1, $value2,$value3){ - $this->public_class_value = $value1; - $this->private_class_value = $value2; - $this->protected_class_value = $value3; - } + public $public_class_value; + private $private_class_value; + protected $protected_class_value; + // initializing object member value + function __construct($value1, $value2,$value3){ + $this->public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } - // return string value - function __tostring() { - return (string)$this->public_class_value; - } + // return string value + function __tostring() { + return (string)$this->public_class_value; + } } diff --git a/ext/standard/tests/array/natcasesort_variation11.phpt b/ext/standard/tests/array/natcasesort_variation11.phpt index 365600edd7..27e41865f1 100644 --- a/ext/standard/tests/array/natcasesort_variation11.phpt +++ b/ext/standard/tests/array/natcasesort_variation11.phpt @@ -103,10 +103,10 @@ $inputs = array( // loop through each element of $inputs to check the behavior of natcasesort() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( natcasesort($input) ); - var_dump($input); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump( natcasesort($input) ); + var_dump($input); + $iterator++; }; echo "Done"; diff --git a/ext/standard/tests/array/natcasesort_variation2.phpt b/ext/standard/tests/array/natcasesort_variation2.phpt index ce34db1246..c9dbec1e1f 100644 --- a/ext/standard/tests/array/natcasesort_variation2.phpt +++ b/ext/standard/tests/array/natcasesort_variation2.phpt @@ -39,7 +39,7 @@ $inputs = array( // int data /*1*/ 'int' => array( - 0, + 0, 1, 12345, -2345, @@ -107,10 +107,10 @@ $inputs = array( // loop through each element of $inputs to check the behavior of natcasesort() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( natcasesort($input) ); - var_dump($input); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump( natcasesort($input) ); + var_dump($input); + $iterator++; }; fclose($fp); diff --git a/ext/standard/tests/array/natcasesort_variation3.phpt b/ext/standard/tests/array/natcasesort_variation3.phpt index c3400f4d65..b2523dc426 100644 --- a/ext/standard/tests/array/natcasesort_variation3.phpt +++ b/ext/standard/tests/array/natcasesort_variation3.phpt @@ -34,9 +34,9 @@ $inputs = array ( $iterator = 1; foreach ($inputs as $array_arg) { - echo "\n-- Iteration $iterator --\n"; - var_dump(natcasesort($array_arg)); - var_dump($array_arg); + echo "\n-- Iteration $iterator --\n"; + var_dump(natcasesort($array_arg)); + var_dump($array_arg); } echo "Done"; diff --git a/ext/standard/tests/array/natcasesort_variation4.phpt b/ext/standard/tests/array/natcasesort_variation4.phpt index b8d4d2c220..452e2e48b2 100644 --- a/ext/standard/tests/array/natcasesort_variation4.phpt +++ b/ext/standard/tests/array/natcasesort_variation4.phpt @@ -14,16 +14,16 @@ Test natcasesort() function : usage variations - different string types echo "*** Testing natcasesort() : usage variation ***\n"; $inputs = array ( - // group of escape sequences - array(null, NULL, "\a", "\cx", "\e", "\f", "\n", "\t", "\xhh", "\ddd", "\v"), + // group of escape sequences + array(null, NULL, "\a", "\cx", "\e", "\f", "\n", "\t", "\xhh", "\ddd", "\v"), - // array contains combination of capital/small letters - array("lemoN", "Orange", "banana", "apple", "Test", "TTTT", "ttt", "ww", "x", "X", "oraNGe", "BANANA") + // array contains combination of capital/small letters + array("lemoN", "Orange", "banana", "apple", "Test", "TTTT", "ttt", "ww", "x", "X", "oraNGe", "BANANA") ); foreach ($inputs as $array_arg) { - var_dump( natcasesort($array_arg) ); - var_dump($array_arg); + var_dump( natcasesort($array_arg) ); + var_dump($array_arg); } echo "Done"; diff --git a/ext/standard/tests/array/prev_error2.phpt b/ext/standard/tests/array/prev_error2.phpt index 37049cf854..45d2930ad7 100644 --- a/ext/standard/tests/array/prev_error2.phpt +++ b/ext/standard/tests/array/prev_error2.phpt @@ -12,8 +12,8 @@ prev - ensure warning is received when passing an indirect temporary. */ function f() { - $array = array(1,2); - end($array); + $array = array(1,2); + end($array); return $array; } diff --git a/ext/standard/tests/array/rsort_basic.phpt b/ext/standard/tests/array/rsort_basic.phpt index 9d82ea5c94..76123b7c02 100644 --- a/ext/standard/tests/array/rsort_basic.phpt +++ b/ext/standard/tests/array/rsort_basic.phpt @@ -15,9 +15,9 @@ echo "*** Testing rsort() : basic functionality ***\n"; // associative array containing unsorted string values $unsorted_strings = array( - "l" => "lemon", "o" => "orange", - "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", - "b" => "banana", + "l" => "lemon", "o" => "orange", + "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", + "b" => "banana", ); // array with default keys containing unsorted numeric values diff --git a/ext/standard/tests/array/rsort_object1.phpt b/ext/standard/tests/array/rsort_object1.phpt index fdbdaedb7b..df7ca491ff 100644 --- a/ext/standard/tests/array/rsort_object1.phpt +++ b/ext/standard/tests/array/rsort_object1.phpt @@ -16,27 +16,27 @@ echo "*** Testing rsort() : object functionality ***\n"; // class declaration for integer objects class for_integer_rsort { - public $class_value; - // initializing object member value - function __construct($value){ - $this->class_value = $value; - } + public $class_value; + // initializing object member value + function __construct($value){ + $this->class_value = $value; + } } // class declaration for string objects class for_string_rsort { - public $class_value; - // initializing object member value - function __construct($value){ - $this->class_value = $value; - } - - // return string value - function __tostring() { - return (string)$this->value; - } + public $class_value; + // initializing object member value + function __construct($value){ + $this->class_value = $value; + } + + // return string value + function __tostring() { + return (string)$this->value; + } } diff --git a/ext/standard/tests/array/rsort_object2.phpt b/ext/standard/tests/array/rsort_object2.phpt index 5f2eba168e..21789ba026 100644 --- a/ext/standard/tests/array/rsort_object2.phpt +++ b/ext/standard/tests/array/rsort_object2.phpt @@ -16,36 +16,36 @@ echo "*** Testing rsort() : object functionality ***\n"; // class declaration for integer objects class for_integer_rsort { - public $public_class_value; - private $private_class_value; - protected $protected_class_value; + public $public_class_value; + private $private_class_value; + protected $protected_class_value; - // initializing object member value - function __construct($value1, $value2,$value3){ - $this->public_class_value = $value1; - $this->private_class_value = $value2; - $this->protected_class_value = $value3; - } + // initializing object member value + function __construct($value1, $value2,$value3){ + $this->public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } } // class declaration for string objects class for_string_rsort { - public $public_class_value; - private $private_class_value; - protected $protected_class_value; - // initializing object member value - function __construct($value1, $value2,$value3){ - $this->public_class_value = $value1; - $this->private_class_value = $value2; - $this->protected_class_value = $value3; - } + public $public_class_value; + private $private_class_value; + protected $protected_class_value; + // initializing object member value + function __construct($value1, $value2,$value3){ + $this->public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } - // return string value - function __tostring() { - return (string)$this->value; - } + // return string value + function __tostring() { + return (string)$this->value; + } } diff --git a/ext/standard/tests/array/rsort_variation5.phpt b/ext/standard/tests/array/rsort_variation5.phpt index 44a8b2b473..20d061f4c4 100644 --- a/ext/standard/tests/array/rsort_variation5.phpt +++ b/ext/standard/tests/array/rsort_variation5.phpt @@ -26,22 +26,22 @@ $flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING); $count = 1; // loop through to test rsort() with different arrays foreach ($various_arrays as $array) { - echo "\n-- Iteration $count --\n"; + echo "\n-- Iteration $count --\n"; - echo "- With Default sort flag -\n"; - $temp_array = $array; - var_dump(rsort($temp_array) ); - var_dump($temp_array); + echo "- With Default sort flag -\n"; + $temp_array = $array; + var_dump(rsort($temp_array) ); + var_dump($temp_array); - // loop through $flags array and setting all possible flag values - foreach($flags as $key => $flag){ - echo "- Sort flag = $key -\n"; + // loop through $flags array and setting all possible flag values + foreach($flags as $key => $flag){ + echo "- Sort flag = $key -\n"; - $temp_array = $array; - var_dump(rsort($temp_array, $flag) ); - var_dump($temp_array); - } - $count++; + $temp_array = $array; + var_dump(rsort($temp_array, $flag) ); + var_dump($temp_array); + } + $count++; } echo "Done"; diff --git a/ext/standard/tests/array/rsort_variation9.phpt b/ext/standard/tests/array/rsort_variation9.phpt index d3b44ec0bb..93cdff2228 100644 --- a/ext/standard/tests/array/rsort_variation9.phpt +++ b/ext/standard/tests/array/rsort_variation9.phpt @@ -15,22 +15,22 @@ echo "*** Testing rsort() : variation ***\n"; // Associative arrays $various_arrays = array( - // numeric assoc. only array - array(5 => 55, 6 => 66, 2 => 22, 3 => 33, 1 => 11), + // numeric assoc. only array + array(5 => 55, 6 => 66, 2 => 22, 3 => 33, 1 => 11), - // two-dimensional assoc. and default key array - array("fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"), - "numbers" => array(1, 2, 3, 4, 5, 6), - "holes" => array("first", 5 => "second", "third")), + // two-dimensional assoc. and default key array + array("fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"), + "numbers" => array(1, 2, 3, 4, 5, 6), + "holes" => array("first", 5 => "second", "third")), - // numeric assoc. and default key array - array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13), + // numeric assoc. and default key array + array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13), - // mixed assoc. array - array('bar' => 'baz', "foo" => 1), + // mixed assoc. array + array('bar' => 'baz', "foo" => 1), - // assoc. only multi-dimensional array - array('a' => 1,'b' => array('e' => 2,'f' => 3),'c' => array('g' => 4),'d' => 5), + // assoc. only multi-dimensional array + array('a' => 1,'b' => array('e' => 2,'f' => 3),'c' => array('g' => 4),'d' => 5), ); $count = 1; diff --git a/ext/standard/tests/array/sort_basic.phpt b/ext/standard/tests/array/sort_basic.phpt index e409ac3d33..451fd5788f 100644 --- a/ext/standard/tests/array/sort_basic.phpt +++ b/ext/standard/tests/array/sort_basic.phpt @@ -21,9 +21,9 @@ echo "*** Testing sort() : basic functionality ***\n"; // associative array containing unsorted string values $unsorted_strings = array( - "l" => "lemon", "o" => "orange", - "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", - "b" => "banana", + "l" => "lemon", "o" => "orange", + "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", + "b" => "banana", ); // array with default keys containing unsorted numeric values diff --git a/ext/standard/tests/array/usort_object1.phpt b/ext/standard/tests/array/usort_object1.phpt index c1e20b181c..b1002a53e4 100644 --- a/ext/standard/tests/array/usort_object1.phpt +++ b/ext/standard/tests/array/usort_object1.phpt @@ -16,51 +16,51 @@ echo "*** Testing usort() : object functionality ***\n"; function simple_cmp($value1, $value2) { - if($value1 == $value2) { - return 0; - } - else if($value1 > $value2) { - return 1; - } - else - return -1; + if($value1 == $value2) { + return 0; + } + else if($value1 > $value2) { + return 1; + } + else + return -1; } // comparison function for SimpleClass2 objects which has more than one member function multiple_cmp($value1, $value2) { - if($value1->getValue() == $value2->getValue()) - return 0; - else if($value1->getValue() > $value2->getValue()) - return 1; - else - return -1; + if($value1->getValue() == $value2->getValue()) + return 0; + else if($value1->getValue() > $value2->getValue()) + return 1; + else + return -1; } // Simple class with single property class SimpleClass1 { - private $int_value; + private $int_value; - public function __construct($value) { - $this->int_value = $value; - } + public function __construct($value) { + $this->int_value = $value; + } } // Simple class with more than one property class SimpleClass2 { - private $int_value; - protected $float_value; - public $string_value; - public function __construct($int, $float, $str) { - $this->int_value = $int; - $this->float_value = $float; - $this->string_value = $str; - } - public function getValue() { - return $this->int_value; - } + private $int_value; + protected $float_value; + public $string_value; + public function __construct($int, $float, $str) { + $this->int_value = $int; + $this->float_value = $float; + $this->string_value = $str; + } + public function getValue() { + return $this->int_value; + } } // array of SimpleClass objects with only one property diff --git a/ext/standard/tests/array/usort_variation11.phpt b/ext/standard/tests/array/usort_variation11.phpt index b6cdeef766..d07dfb48e0 100644 --- a/ext/standard/tests/array/usort_variation11.phpt +++ b/ext/standard/tests/array/usort_variation11.phpt @@ -4,20 +4,20 @@ Test usort() function : usage variations - binary return cmp <?php function ucmp($a, $b) { - return $a > $b; + return $a > $b; } $range = array(2, 4, 8, 16, 32, 64, 128); foreach ($range as $r) { - $backup = $array = range(0, $r); - shuffle($array); - usort($array, "ucmp"); - if ($array != $backup) { - var_dump($array); - var_dump($backup); - die("Whatever sorting algo you used, this test should never be broken"); - } + $backup = $array = range(0, $r); + shuffle($array); + usort($array, "ucmp"); + if ($array != $backup) { + var_dump($array); + var_dump($backup); + die("Whatever sorting algo you used, this test should never be broken"); + } } echo "okey"; ?> diff --git a/ext/standard/tests/array/var_export3.phpt b/ext/standard/tests/array/var_export3.phpt index 6d39946916..e7d3c851f2 100644 --- a/ext/standard/tests/array/var_export3.phpt +++ b/ext/standard/tests/array/var_export3.phpt @@ -3,14 +3,14 @@ var_export() and classes --FILE-- <?php class kake { - public $mann; - protected $kvinne; + public $mann; + protected $kvinne; - function __construct() - { - $this->mann = 42; - $this->kvinne = 43; - } + function __construct() + { + $this->mann = 42; + $this->kvinne = 43; + } } $kake = new kake; diff --git a/ext/standard/tests/assert/assert.phpt b/ext/standard/tests/assert/assert.phpt index 71b0649141..7935b7c8fd 100644 --- a/ext/standard/tests/assert/assert.phpt +++ b/ext/standard/tests/assert/assert.phpt @@ -9,15 +9,15 @@ assert.bail = 0 <?php function a($file, $line, $unused, $desc) { - echo "assertion failed $line,\"$desc\"\n"; + echo "assertion failed $line,\"$desc\"\n"; } class a { - static function assert($file, $line, $unused, $desc) - { - echo "class assertion failed $line,\"$desc\"\n"; - } + static function assert($file, $line, $unused, $desc) + { + echo "class assertion failed $line,\"$desc\"\n"; + } } assert_options(ASSERT_ACTIVE,1); diff --git a/ext/standard/tests/assert/assert03.phpt b/ext/standard/tests/assert/assert03.phpt index a15e936af3..4428790fa2 100644 --- a/ext/standard/tests/assert/assert03.phpt +++ b/ext/standard/tests/assert/assert03.phpt @@ -9,12 +9,12 @@ assert.bail = 0 <?php function a($file, $line, $unused, $desc) { - echo "assertion failed - a - $line,\"$desc\"\n"; + echo "assertion failed - a - $line,\"$desc\"\n"; } function b($file, $line, $unused, $desc) { - echo "assertion failed - b - $line,\"$desc\"\n"; + echo "assertion failed - b - $line,\"$desc\"\n"; } assert_options(ASSERT_ACTIVE,1); diff --git a/ext/standard/tests/assert/assert_basic.phpt b/ext/standard/tests/assert/assert_basic.phpt index ce53a17a61..dbf15c1998 100644 --- a/ext/standard/tests/assert/assert_basic.phpt +++ b/ext/standard/tests/assert/assert_basic.phpt @@ -9,7 +9,7 @@ assert.bail = 0 <?php function f1() { - echo "f1 called\n"; + echo "f1 called\n"; } var_dump($r2 = assert(0)); diff --git a/ext/standard/tests/assert/assert_basic1.phpt b/ext/standard/tests/assert/assert_basic1.phpt index cd4a5601ab..5961811468 100644 --- a/ext/standard/tests/assert/assert_basic1.phpt +++ b/ext/standard/tests/assert/assert_basic1.phpt @@ -9,7 +9,7 @@ assert.bail = 0 <?php function f1() { - echo "f1 called\n"; + echo "f1 called\n"; } var_dump($r2=assert(0)); diff --git a/ext/standard/tests/assert/assert_basic2.phpt b/ext/standard/tests/assert/assert_basic2.phpt index 052e7d4e89..9d768e0d36 100644 --- a/ext/standard/tests/assert/assert_basic2.phpt +++ b/ext/standard/tests/assert/assert_basic2.phpt @@ -9,12 +9,12 @@ assert.bail = 0 <?php function f2() { - echo "f2 called\n"; + echo "f2 called\n"; } function f1() { - echo "f1 called\n"; + echo "f1 called\n"; } var_dump($o = assert_options(ASSERT_CALLBACK)); diff --git a/ext/standard/tests/assert/assert_basic3.phpt b/ext/standard/tests/assert/assert_basic3.phpt index 87103cbfbb..8374eff951 100644 --- a/ext/standard/tests/assert/assert_basic3.phpt +++ b/ext/standard/tests/assert/assert_basic3.phpt @@ -9,7 +9,7 @@ assert.bail = 0 <?php function f1() { - echo "f1 called\n"; + echo "f1 called\n"; } //bail out on error diff --git a/ext/standard/tests/assert/assert_basic5.phpt b/ext/standard/tests/assert/assert_basic5.phpt index cf2ed6ded3..98053c7313 100644 --- a/ext/standard/tests/assert/assert_basic5.phpt +++ b/ext/standard/tests/assert/assert_basic5.phpt @@ -9,7 +9,7 @@ assert.bail = 0 <?php function f1() { - echo "f1 called\n"; + echo "f1 called\n"; } //switch warning on and test return value diff --git a/ext/standard/tests/assert/assert_error2.phpt b/ext/standard/tests/assert/assert_error2.phpt index de00743b1b..027bd03067 100644 --- a/ext/standard/tests/assert/assert_error2.phpt +++ b/ext/standard/tests/assert/assert_error2.phpt @@ -11,7 +11,7 @@ display_errors = 1 <?php function f1($script, $line, $message, $user_message) { - echo "f1 called\n"; + echo "f1 called\n"; } //bail out on error diff --git a/ext/standard/tests/assert/assert_variation.phpt b/ext/standard/tests/assert/assert_variation.phpt index d0cb90ff66..a28ea58d5a 100644 --- a/ext/standard/tests/assert/assert_variation.phpt +++ b/ext/standard/tests/assert/assert_variation.phpt @@ -9,22 +9,22 @@ assert.bail = 0 <?php function f1() { - echo "f1 called\n"; + echo "f1 called\n"; } function f2() { - echo "f2 called\n"; + echo "f2 called\n"; } function f3() { - echo "f3 called\n"; + echo "f3 called\n"; } class c1 { - static function assert($file, $line, $unused, $desc) - { - echo "Class assertion failed $line, \"$desc\"\n"; - } + static function assert($file, $line, $unused, $desc) + { + echo "Class assertion failed $line, \"$desc\"\n"; + } } echo "Initial values: assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; diff --git a/ext/standard/tests/bug49244.phpt b/ext/standard/tests/bug49244.phpt index 60942966a7..a50aacee8d 100644 --- a/ext/standard/tests/bug49244.phpt +++ b/ext/standard/tests/bug49244.phpt @@ -4,8 +4,8 @@ Bug #49244 (Floating point NaN cause garbage characters) <?php for ($i = 0; $i < 10; $i++) { - printf("{%f} %1\$f\n", pow(-1.0, 0.3)); - printf("{%f} %1\$f\n", pow(-1.0, 0.3)); + printf("{%f} %1\$f\n", pow(-1.0, 0.3)); + printf("{%f} %1\$f\n", pow(-1.0, 0.3)); } ?> diff --git a/ext/standard/tests/bug64370_var2.phpt b/ext/standard/tests/bug64370_var2.phpt index 3618a46980..601f8b93e0 100644 --- a/ext/standard/tests/bug64370_var2.phpt +++ b/ext/standard/tests/bug64370_var2.phpt @@ -5,15 +5,15 @@ Test bug #64370 sequential microtime(true) calls $i = 0; while(100000 > $i++) { - $m0 = microtime(true); - $m1 = microtime(true); - $d = $m1 - $m0; + $m0 = microtime(true); + $m1 = microtime(true); + $d = $m1 - $m0; - /*echo "$d\n";*/ + /*echo "$d\n";*/ - if ($d < 0) { - die("failed in {$i}th iteration"); - } + if ($d < 0) { + die("failed in {$i}th iteration"); + } } echo "ok\n"; ?> diff --git a/ext/standard/tests/bug75220.phpt b/ext/standard/tests/bug75220.phpt index ca6c3ef4ea..f0ba55a702 100644 --- a/ext/standard/tests/bug75220.phpt +++ b/ext/standard/tests/bug75220.phpt @@ -9,16 +9,16 @@ $a->bar('foo'); class B {}; class A extends B { - function bar($func) - { - var_dump('foo'); - var_dump(is_callable('parent::foo')); - var_dump(is_callable(array('parent', 'foo'))); - } + function bar($func) + { + var_dump('foo'); + var_dump(is_callable('parent::foo')); + var_dump(is_callable(array('parent', 'foo'))); + } - function __call($func, $args) - { - } + function __call($func, $args) + { + } }; ?> diff --git a/ext/standard/tests/class_object/bug71442.phpt b/ext/standard/tests/class_object/bug71442.phpt index d6b3d6699b..27a025c4e4 100644 --- a/ext/standard/tests/class_object/bug71442.phpt +++ b/ext/standard/tests/class_object/bug71442.phpt @@ -5,29 +5,29 @@ Bug #71442 (forward_static_call crash) class A { - const NAME = 'A'; - public static function test() { - $args = func_get_args(); - echo static::NAME, " ".join(',', $args)." \n"; - } + const NAME = 'A'; + public static function test() { + $args = func_get_args(); + echo static::NAME, " ".join(',', $args)." \n"; + } } class B extends A { - const NAME = 'B'; + const NAME = 'B'; - public static function test() { - echo self::NAME, "\n"; - forward_static_call(array('A', 'test'), 'more', 'args'); - forward_static_call( 'test', 'other', 'args'); - } + public static function test() { + echo self::NAME, "\n"; + forward_static_call(array('A', 'test'), 'more', 'args'); + forward_static_call( 'test', 'other', 'args'); + } } B::test('foo'); function test() { - $args = func_get_args(); - echo "C ".join(',', $args)." \n"; + $args = func_get_args(); + echo "C ".join(',', $args)." \n"; } ?> diff --git a/ext/standard/tests/class_object/class_exists_basic_001.phpt b/ext/standard/tests/class_object/class_exists_basic_001.phpt index b95efecd65..9192ea80b7 100644 --- a/ext/standard/tests/class_object/class_exists_basic_001.phpt +++ b/ext/standard/tests/class_object/class_exists_basic_001.phpt @@ -11,7 +11,7 @@ Test class_exists() function : basic functionality echo "*** Testing class_exists() : basic functionality ***\n"; spl_autoload_register(function ($className) { - echo "In autoload($className)\n"; + echo "In autoload($className)\n"; }); echo "Calling class_exists() on non-existent class with autoload explicitly enabled:\n"; diff --git a/ext/standard/tests/class_object/forward_static_call_001.phpt b/ext/standard/tests/class_object/forward_static_call_001.phpt index 0eadad3d79..30459f0c43 100644 --- a/ext/standard/tests/class_object/forward_static_call_001.phpt +++ b/ext/standard/tests/class_object/forward_static_call_001.phpt @@ -5,41 +5,41 @@ forward_static_call() called from outside of a method. class A { - const NAME = 'A'; - public static function test() { - echo static::NAME, "\n"; - } + const NAME = 'A'; + public static function test() { + echo static::NAME, "\n"; + } } class B extends A { - const NAME = 'B'; + const NAME = 'B'; - public static function test() { - echo self::NAME, "\n"; - forward_static_call(array('parent', 'test')); - } + public static function test() { + echo self::NAME, "\n"; + forward_static_call(array('parent', 'test')); + } - public static function test2() { - echo self::NAME, "\n"; - forward_static_call(array('self', 'test')); - } + public static function test2() { + echo self::NAME, "\n"; + forward_static_call(array('self', 'test')); + } - public static function test3() { - echo self::NAME, "\n"; - forward_static_call(array('A', 'test')); - } + public static function test3() { + echo self::NAME, "\n"; + forward_static_call(array('A', 'test')); + } } class C extends B { - const NAME = 'C'; + const NAME = 'C'; - public static function test() - { - echo self::NAME, "\n"; - forward_static_call(array('A', 'test')); - } + public static function test() + { + echo self::NAME, "\n"; + forward_static_call(array('A', 'test')); + } } A::test(); diff --git a/ext/standard/tests/class_object/forward_static_call_002.phpt b/ext/standard/tests/class_object/forward_static_call_002.phpt index 64406feb3e..7bc0092321 100644 --- a/ext/standard/tests/class_object/forward_static_call_002.phpt +++ b/ext/standard/tests/class_object/forward_static_call_002.phpt @@ -5,13 +5,13 @@ forward_static_call() from outside of a class method. class A { - public static function test() { - echo "A\n"; - } + public static function test() { + echo "A\n"; + } } function test() { - forward_static_call(array('A', 'test')); + forward_static_call(array('A', 'test')); } test(); diff --git a/ext/standard/tests/class_object/forward_static_call_003.phpt b/ext/standard/tests/class_object/forward_static_call_003.phpt index 8a846fe3da..c2c0035f6b 100644 --- a/ext/standard/tests/class_object/forward_static_call_003.phpt +++ b/ext/standard/tests/class_object/forward_static_call_003.phpt @@ -5,30 +5,30 @@ forward_static_call() calling outside of the inheritance chain. class A { - const NAME = 'A'; - public static function test() { - echo static::NAME, "\n"; - } + const NAME = 'A'; + public static function test() { + echo static::NAME, "\n"; + } } class B extends A { - const NAME = 'B'; + const NAME = 'B'; - public static function test() { - echo self::NAME, "\n"; - forward_static_call(array('parent', 'test')); - } + public static function test() { + echo self::NAME, "\n"; + forward_static_call(array('parent', 'test')); + } } class C { - const NAME = 'C'; + const NAME = 'C'; - public static function test() { - echo self::NAME, "\n"; - forward_static_call(array('B', 'test')); - } + public static function test() { + echo self::NAME, "\n"; + forward_static_call(array('B', 'test')); + } } A::test(); diff --git a/ext/standard/tests/class_object/get_class_methods_basic_001.phpt b/ext/standard/tests/class_object/get_class_methods_basic_001.phpt index 843e9f1a53..4c091da565 100644 --- a/ext/standard/tests/class_object/get_class_methods_basic_001.phpt +++ b/ext/standard/tests/class_object/get_class_methods_basic_001.phpt @@ -15,9 +15,9 @@ Test get_class_methods() function : basic functionality echo "*** Testing get_class_methods() : basic functionality ***\n"; class C { - function f() {} - function g() {} - function h() {} + function f() {} + function g() {} + function h() {} } echo "Argument is class name:\n"; diff --git a/ext/standard/tests/class_object/get_class_methods_basic_002.phpt b/ext/standard/tests/class_object/get_class_methods_basic_002.phpt index 8a11eba589..59d8606d8d 100644 --- a/ext/standard/tests/class_object/get_class_methods_basic_002.phpt +++ b/ext/standard/tests/class_object/get_class_methods_basic_002.phpt @@ -13,48 +13,48 @@ Test get_class_methods() function : basic functionality */ class C { - private function privC() {} - protected function protC() {} - public function pubC() {} + private function privC() {} + protected function protC() {} + public function pubC() {} - public static function testFromC() { - echo "Accessing C from C:\n"; - var_dump(get_class_methods("C")); - echo "Accessing D from C:\n"; - var_dump(get_class_methods("D")); - echo "Accessing X from C:\n"; - var_dump(get_class_methods("X")); - } + public static function testFromC() { + echo "Accessing C from C:\n"; + var_dump(get_class_methods("C")); + echo "Accessing D from C:\n"; + var_dump(get_class_methods("D")); + echo "Accessing X from C:\n"; + var_dump(get_class_methods("X")); + } } class D extends C { - private function privD() {} - protected function protD() {} - public function pubD() {} + private function privD() {} + protected function protD() {} + public function pubD() {} - public static function testFromD() { - echo "Accessing C from D:\n"; - var_dump(get_class_methods("C")); - echo "Accessing D from D:\n"; - var_dump(get_class_methods("D")); - echo "Accessing X from D:\n"; - var_dump(get_class_methods("X")); - } + public static function testFromD() { + echo "Accessing C from D:\n"; + var_dump(get_class_methods("C")); + echo "Accessing D from D:\n"; + var_dump(get_class_methods("D")); + echo "Accessing X from D:\n"; + var_dump(get_class_methods("X")); + } } class X { - private function privX() {} - protected function protX() {} - public function pubX() {} + private function privX() {} + protected function protX() {} + public function pubX() {} - public static function testFromX() { - echo "Accessing C from X:\n"; - var_dump(get_class_methods("C")); - echo "Accessing D from X:\n"; - var_dump(get_class_methods("D")); - echo "Accessing X from X:\n"; - var_dump(get_class_methods("X")); - } + public static function testFromX() { + echo "Accessing C from X:\n"; + var_dump(get_class_methods("C")); + echo "Accessing D from X:\n"; + var_dump(get_class_methods("D")); + echo "Accessing X from X:\n"; + var_dump(get_class_methods("X")); + } } echo "Accessing D from global scope:\n"; diff --git a/ext/standard/tests/class_object/get_class_methods_basic_003.phpt b/ext/standard/tests/class_object/get_class_methods_basic_003.phpt index c7662f8605..e15d962b16 100644 --- a/ext/standard/tests/class_object/get_class_methods_basic_003.phpt +++ b/ext/standard/tests/class_object/get_class_methods_basic_003.phpt @@ -13,23 +13,23 @@ Test get_class_methods() function : basic functionality */ interface I { - public function pubI(); + public function pubI(); } class C implements I { - public function pubI() {} + public function pubI() {} - private function privC() {} - protected function protC() {} - public function pubC() {} + private function privC() {} + protected function protC() {} + public function pubC() {} - public static function testFromC() { - echo "Accessing I from C:\n"; - var_dump(get_class_methods("I")); - echo "Accessing C from C:\n"; - var_dump(get_class_methods("C")); - } + public static function testFromC() { + echo "Accessing I from C:\n"; + var_dump(get_class_methods("I")); + echo "Accessing C from C:\n"; + var_dump(get_class_methods("C")); + } } diff --git a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt index 2e2e1657af..e44a3d1fd9 100644 --- a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt +++ b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt @@ -10,7 +10,7 @@ Test get_class_methods() function : usage variations - unexpected types function test_error_handler($err_no, $err_msg, $filename, $linenum) { - echo "Error: $err_no - $err_msg\n"; + echo "Error: $err_no - $err_msg\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/get_class_methods_variation_002.phpt b/ext/standard/tests/class_object/get_class_methods_variation_002.phpt index 23416234f9..449df8845c 100644 --- a/ext/standard/tests/class_object/get_class_methods_variation_002.phpt +++ b/ext/standard/tests/class_object/get_class_methods_variation_002.phpt @@ -11,7 +11,7 @@ Test get_class_methods() function : usage variations - case sensitivity echo "*** Testing get_class_methods() : usage variations ***\n"; class caseSensitivityTest { - function MyMeThOd() {} + function MyMeThOd() {} } var_dump( get_class_methods('CasesensitivitytesT') ); diff --git a/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt b/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt index 78d27fa3a5..519f8beae0 100644 --- a/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt +++ b/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt @@ -16,9 +16,9 @@ echo "\n-- Testing get_declared_classes() function with Zero arguments --\n"; var_dump(get_declared_classes()); foreach (get_declared_classes() as $class) { - if (!class_exists($class)) { - echo "Error: $class is not a valid class.\n"; - } + if (!class_exists($class)) { + echo "Error: $class is not a valid class.\n"; + } } echo "\n-- Ensure userspace classes are listed --\n"; diff --git a/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt b/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt index 749ee69ab7..d328a02a03 100644 --- a/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt +++ b/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt @@ -16,9 +16,9 @@ echo "\n-- Testing get_declared_interfaces() function with Zero arguments --\n"; var_dump(get_declared_interfaces()); foreach (get_declared_interfaces() as $interface) { - if (!interface_exists($interface)) { - echo "Error: $interface is not a valid interface.\n"; - } + if (!interface_exists($interface)) { + echo "Error: $interface is not a valid interface.\n"; + } } echo "\n-- Ensure userspace classes are not listed --\n"; diff --git a/ext/standard/tests/class_object/get_declared_traits_basic_001.phpt b/ext/standard/tests/class_object/get_declared_traits_basic_001.phpt index 8ce2d2df56..2ca0ce00ca 100644 --- a/ext/standard/tests/class_object/get_declared_traits_basic_001.phpt +++ b/ext/standard/tests/class_object/get_declared_traits_basic_001.phpt @@ -18,9 +18,9 @@ echo "\n-- Testing get_declared_traits() function with Zero arguments --\n"; var_dump(get_declared_traits()); foreach (get_declared_traits() as $trait) { - if (!trait_exists($trait)) { - echo "Error: $trait is not a valid trait.\n"; - } + if (!trait_exists($trait)) { + echo "Error: $trait is not a valid trait.\n"; + } } echo "\n-- Ensure trait is listed --\n"; diff --git a/ext/standard/tests/class_object/get_object_vars_basic_001.phpt b/ext/standard/tests/class_object/get_object_vars_basic_001.phpt index 253ebd2be4..1133202cbf 100644 --- a/ext/standard/tests/class_object/get_object_vars_basic_001.phpt +++ b/ext/standard/tests/class_object/get_object_vars_basic_001.phpt @@ -9,40 +9,40 @@ get_object_vars(): visibility from static methods (target object passed as arg) */ Class A { - private $hiddenPriv = 'A::hiddenPriv'; + private $hiddenPriv = 'A::hiddenPriv'; - public static function test($b) { - echo __METHOD__ . "\n"; - var_dump(get_object_vars($b)); - } + public static function test($b) { + echo __METHOD__ . "\n"; + var_dump(get_object_vars($b)); + } } Class B extends A { - private $hiddenPriv = 'B::hiddenPriv'; - private $priv = 'B::priv'; - protected $prot = 'B::prot'; - public $pub = 'B::pub'; + private $hiddenPriv = 'B::hiddenPriv'; + private $priv = 'B::priv'; + protected $prot = 'B::prot'; + public $pub = 'B::pub'; - public static function test($b) { - echo __METHOD__ . "\n"; - var_dump(get_object_vars($b)); - } + public static function test($b) { + echo __METHOD__ . "\n"; + var_dump(get_object_vars($b)); + } } Class C extends B { - private $hiddenPriv = 'C::hiddenPriv'; + private $hiddenPriv = 'C::hiddenPriv'; - public static function test($b) { - echo __METHOD__ . "\n"; - var_dump(get_object_vars($b)); - } + public static function test($b) { + echo __METHOD__ . "\n"; + var_dump(get_object_vars($b)); + } } Class X { - public static function test($b) { - echo __METHOD__ . "\n"; - var_dump(get_object_vars($b)); - } + public static function test($b) { + echo __METHOD__ . "\n"; + var_dump(get_object_vars($b)); + } } diff --git a/ext/standard/tests/class_object/get_object_vars_basic_002.phpt b/ext/standard/tests/class_object/get_object_vars_basic_002.phpt index 41a1758baa..ff0664ea46 100644 --- a/ext/standard/tests/class_object/get_object_vars_basic_002.phpt +++ b/ext/standard/tests/class_object/get_object_vars_basic_002.phpt @@ -9,24 +9,24 @@ get_object_vars(): visibility from non static methods (target object passed as a */ Class A { - private $hiddenPriv = 'A::hiddenPriv'; + private $hiddenPriv = 'A::hiddenPriv'; - public function testA($b) { - echo __METHOD__ . "\n"; - var_dump(get_object_vars($b)); - } + public function testA($b) { + echo __METHOD__ . "\n"; + var_dump(get_object_vars($b)); + } } Class B extends A { - private $hiddenPriv = 'B::hiddenPriv'; - private $priv = 'B::priv'; - protected $prot = 'B::prot'; - public $pub = 'B::pub'; - - public function testB($b) { - echo __METHOD__ . "\n"; - var_dump(get_object_vars($b)); - } + private $hiddenPriv = 'B::hiddenPriv'; + private $priv = 'B::priv'; + protected $prot = 'B::prot'; + public $pub = 'B::pub'; + + public function testB($b) { + echo __METHOD__ . "\n"; + var_dump(get_object_vars($b)); + } } diff --git a/ext/standard/tests/class_object/get_object_vars_variation_001.phpt b/ext/standard/tests/class_object/get_object_vars_variation_001.phpt index 2a310227a5..0cc7d492c8 100644 --- a/ext/standard/tests/class_object/get_object_vars_variation_001.phpt +++ b/ext/standard/tests/class_object/get_object_vars_variation_001.phpt @@ -9,7 +9,7 @@ get_object_vars() - ensure statics are not shown */ Class A { - public static $var = 'hello'; + public static $var = 'hello'; } $a = new A; diff --git a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt index 2aaa93fa8a..d564ad3cd0 100644 --- a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt +++ b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt @@ -9,11 +9,11 @@ Test get_parent_class() function : usage variations - unexpected argument type. */ spl_autoload_register(function ($className) { - echo "In autoload($className)\n"; + echo "In autoload($className)\n"; }); function test_error_handler($err_no, $err_msg, $filename, $linenum) { - echo "Error: $err_no - $err_msg\n"; + echo "Error: $err_no - $err_msg\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/is_a.phpt b/ext/standard/tests/class_object/is_a.phpt index 92d289ba18..efb03b3434 100644 --- a/ext/standard/tests/class_object/is_a.phpt +++ b/ext/standard/tests/class_object/is_a.phpt @@ -4,51 +4,51 @@ is_a and is_subclass_of behaviour (with and without autoload) <?php interface if_a { - function f_a(); + function f_a(); } interface if_b extends if_a { - function f_b(); + function f_b(); } class base { - function _is_a($sub) { - - echo "\n>>> With Defined class\n"; - echo str_pad('is_a( OBJECT:'.get_class($this).', '.$sub.') = ', 60) . (is_a($this, $sub) ? 'yes' : 'no')."\n"; - echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_a(get_class($this), $sub) ? 'yes' : 'no')."\n"; - echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.', true) = ', 60). (is_a(get_class($this), $sub, true) ? 'yes' : 'no')."\n"; - echo str_pad('is_subclass_of( OBJECT:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of($this, $sub) ? 'yes' : 'no')."\n"; - echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of(get_class($this), $sub) ? 'yes' : 'no')."\n"; - echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.',false) = ', 60). (is_subclass_of(get_class($this), $sub , false) ? 'yes' : 'no')."\n"; - - // with autoload options.. - echo ">>> With Undefined\n"; - echo str_pad('is_a( STRING:undefB, '.$sub.',true) = ', 60). (is_a('undefB', $sub, true) ? 'yes' : 'no')."\n"; - echo str_pad('is_a( STRING:undefB, '.$sub.') = ', 60). (is_a('undefB', $sub) ? 'yes' : 'no')."\n"; - echo str_pad('is_subclass_of( STRING:undefB, '.$sub.',false) = ', 60). (is_subclass_of('undefB', $sub, false) ? 'yes' : 'no')."\n"; - echo str_pad('is_subclass_of( STRING:undefB, '.$sub.') = ', 60). (is_subclass_of('undefB', $sub) ? 'yes' : 'no')."\n"; - } - function test() { - echo $this->_is_a('base'); - echo $this->_is_a('derived_a'); - echo $this->_is_a('if_a'); - echo $this->_is_a('undefA'); - echo "\n"; - } + function _is_a($sub) { + + echo "\n>>> With Defined class\n"; + echo str_pad('is_a( OBJECT:'.get_class($this).', '.$sub.') = ', 60) . (is_a($this, $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_a(get_class($this), $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.', true) = ', 60). (is_a(get_class($this), $sub, true) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( OBJECT:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of($this, $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of(get_class($this), $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.',false) = ', 60). (is_subclass_of(get_class($this), $sub , false) ? 'yes' : 'no')."\n"; + + // with autoload options.. + echo ">>> With Undefined\n"; + echo str_pad('is_a( STRING:undefB, '.$sub.',true) = ', 60). (is_a('undefB', $sub, true) ? 'yes' : 'no')."\n"; + echo str_pad('is_a( STRING:undefB, '.$sub.') = ', 60). (is_a('undefB', $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( STRING:undefB, '.$sub.',false) = ', 60). (is_subclass_of('undefB', $sub, false) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( STRING:undefB, '.$sub.') = ', 60). (is_subclass_of('undefB', $sub) ? 'yes' : 'no')."\n"; + } + function test() { + echo $this->_is_a('base'); + echo $this->_is_a('derived_a'); + echo $this->_is_a('if_a'); + echo $this->_is_a('undefA'); + echo "\n"; + } } class derived_a extends base implements if_a { - function f_a() {} + function f_a() {} } class derived_b extends base implements if_a, if_b { - function f_a() {} - function f_b() {} + function f_a() {} + function f_b() {} } class derived_c extends derived_a implements if_b { - function f_b() {} + function f_b() {} } class derived_d extends derived_c { diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt index 961ae96287..37743f393e 100644 --- a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt +++ b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt @@ -9,11 +9,11 @@ Test is_subclass_of() function : usage variations - unexpected type for arg 1 */ // Note: basic use cases in Zend/tests/is_a.phpt spl_autoload_register(function ($className) { - echo "In autoload($className)\n"; + echo "In autoload($className)\n"; }); function test_error_handler($err_no, $err_msg, $filename, $linenum) { - echo "Error: $err_no - $err_msg\n"; + echo "Error: $err_no - $err_msg\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt index dba37cc3f4..c9409dcac8 100644 --- a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt +++ b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt @@ -9,11 +9,11 @@ Test is_subclass_of() function : usage variations - unexpected type for arg 1 w */ // Note: basic use cases in Zend/tests/is_a.phpt spl_autoload_register(function ($className) { - echo "In autoload($className)\n"; + echo "In autoload($className)\n"; }); function test_error_handler($err_no, $err_msg, $filename, $linenum) { - echo "Error: $err_no - $err_msg\n"; + echo "Error: $err_no - $err_msg\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/method_exists_basic_001.phpt b/ext/standard/tests/class_object/method_exists_basic_001.phpt index c0b656b3f9..5d1e2c89df 100644 --- a/ext/standard/tests/class_object/method_exists_basic_001.phpt +++ b/ext/standard/tests/class_object/method_exists_basic_001.phpt @@ -9,30 +9,30 @@ method_exists() on userspace classes; static & non-static methods with various v */ Class B { - public function inherit_pub() {} - protected function inherit_prot() {} - private function inherit_priv() {} - static public function inherit_static_pub() {} - static protected function inherit_static_prot() {} - static private function inherit_static_priv() {} + public function inherit_pub() {} + protected function inherit_prot() {} + private function inherit_priv() {} + static public function inherit_static_pub() {} + static protected function inherit_static_prot() {} + static private function inherit_static_priv() {} } Class C extends B { - public function pub() {} - protected function prot() {} - private function priv() {} - static public function static_pub() {} - static protected function static_prot() {} - static private function static_priv() {} + public function pub() {} + protected function prot() {} + private function priv() {} + static public function static_pub() {} + static protected function static_prot() {} + static private function static_priv() {} } $methods = array( - 'inherit_pub', 'inherit_prot', 'inherit_priv', - 'inherit_static_pub', 'inherit_static_prot', 'inherit_static_priv', - 'pub', 'prot', 'priv', - 'static_pub', 'static_prot', 'static_priv', - 'non_existent'); + 'inherit_pub', 'inherit_prot', 'inherit_priv', + 'inherit_static_pub', 'inherit_static_prot', 'inherit_static_priv', + 'pub', 'prot', 'priv', + 'static_pub', 'static_prot', 'static_priv', + 'non_existent'); echo "\n ---(Using string class name)---\n"; foreach ($methods as $method) { diff --git a/ext/standard/tests/class_object/method_exists_basic_003.phpt b/ext/standard/tests/class_object/method_exists_basic_003.phpt index e92b7a9135..42225a8ebd 100644 --- a/ext/standard/tests/class_object/method_exists_basic_003.phpt +++ b/ext/standard/tests/class_object/method_exists_basic_003.phpt @@ -9,7 +9,7 @@ method_exists() on non-existent class, with __autoload(). */ spl_autoload_register(function ($name) { - echo "In autoload($name)\n"; + echo "In autoload($name)\n"; }); var_dump(method_exists('UndefC', 'func')); diff --git a/ext/standard/tests/class_object/method_exists_variation_001.phpt b/ext/standard/tests/class_object/method_exists_variation_001.phpt index b975f81958..0f2293cf7b 100644 --- a/ext/standard/tests/class_object/method_exists_variation_001.phpt +++ b/ext/standard/tests/class_object/method_exists_variation_001.phpt @@ -9,11 +9,11 @@ Test method_exists() function : usage variations - unexpected type for arg 1 */ spl_autoload_register(function ($className) { - echo "In autoload($className)\n"; + echo "In autoload($className)\n"; }); function test_error_handler($err_no, $err_msg, $filename, $linenum) { - echo "Error: $err_no - $err_msg\n"; + echo "Error: $err_no - $err_msg\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/method_exists_variation_003.phpt b/ext/standard/tests/class_object/method_exists_variation_003.phpt index d5835b0b87..72b63f1e33 100644 --- a/ext/standard/tests/class_object/method_exists_variation_003.phpt +++ b/ext/standard/tests/class_object/method_exists_variation_003.phpt @@ -11,7 +11,7 @@ Test method_exists() function : variation - Case sensitivity echo "*** Testing method_exists() : variation ***\n"; Class caseSensitivityTest { - public function myMethod() {} + public function myMethod() {} } var_dump(method_exists(new casesensitivitytest, 'myMetHOD')); diff --git a/ext/standard/tests/class_object/trait_exists_basic_001.phpt b/ext/standard/tests/class_object/trait_exists_basic_001.phpt index 708c6c91e4..55b92da0d2 100644 --- a/ext/standard/tests/class_object/trait_exists_basic_001.phpt +++ b/ext/standard/tests/class_object/trait_exists_basic_001.phpt @@ -11,7 +11,7 @@ Test trait_exists() function : basic functionality echo "*** Testing trait_exists() : basic functionality ***\n"; spl_autoload_register(function ($traitName) { - echo "In autoload($traitName)\n"; + echo "In autoload($traitName)\n"; }); trait MyTrait {} diff --git a/ext/standard/tests/dir/bug72625.phpt b/ext/standard/tests/dir/bug72625.phpt index e3594414ad..2ea6da9699 100644 --- a/ext/standard/tests/dir/bug72625.phpt +++ b/ext/standard/tests/dir/bug72625.phpt @@ -11,7 +11,7 @@ if (substr(PHP_OS, 0, 3) != 'WIN') { $base = sys_get_temp_dir() . "/" . md5(uniqid()); while (strlen($base) < 260) { - $base = "$base/" . md5(uniqid()); + $base = "$base/" . md5(uniqid()); } $f0 = "$base/_test/documents/projects/myproject/vendor/name/library/classpath"; @@ -22,21 +22,21 @@ mkdir($f0, 0777, true); var_dump( - $f0, - file_exists($f0), - realpath($f0), - dirname($f0), - - $f1, - file_exists($f1), - realpath($f1), - dirname($f1) + $f0, + file_exists($f0), + realpath($f0), + dirname($f0), + + $f1, + file_exists($f1), + realpath($f1), + dirname($f1) ); $tmp = $f0; while ($tmp > $base) { - rmdir($tmp); - $tmp = dirname($tmp); + rmdir($tmp); + $tmp = dirname($tmp); } ?> diff --git a/ext/standard/tests/dir/bug73877.phpt b/ext/standard/tests/dir/bug73877.phpt index 633a4eef81..ceb272ea65 100644 --- a/ext/standard/tests/dir/bug73877.phpt +++ b/ext/standard/tests/dir/bug73877.phpt @@ -21,10 +21,10 @@ mkdir($dir1); `mklink /J $junk0 $dir0`; var_dump( - readlink($dir0), - readlink($dir1), - readlink($junk0), - strlen(readlink($dir0)) === strlen(readlink($junk0)) + readlink($dir0), + readlink($dir1), + readlink($junk0), + strlen(readlink($dir0)) === strlen(readlink($junk0)) ); ?> diff --git a/ext/standard/tests/dir/closedir_basic-win32-mb.phpt b/ext/standard/tests/dir/closedir_basic-win32-mb.phpt index dad5b2b657..7db6b7740a 100644 --- a/ext/standard/tests/dir/closedir_basic-win32-mb.phpt +++ b/ext/standard/tests/dir/closedir_basic-win32-mb.phpt @@ -34,7 +34,7 @@ echo "\n-- Call closedir() with \$dir_handle argument supplied: --\n"; $dh2 = opendir($dir_path); if ((int)$dh1 === (int)$dh2) { - echo "\nNo new resource created\n"; + echo "\nNo new resource created\n"; } var_dump(closedir($dh2)); echo "-- Check Directory Handle: --\n"; diff --git a/ext/standard/tests/dir/closedir_basic.phpt b/ext/standard/tests/dir/closedir_basic.phpt index 41b51f2080..5ec72cd8a5 100644 --- a/ext/standard/tests/dir/closedir_basic.phpt +++ b/ext/standard/tests/dir/closedir_basic.phpt @@ -28,7 +28,7 @@ echo "\n-- Call closedir() with \$dir_handle argument supplied: --\n"; $dh2 = opendir($dir_path); if ((int)$dh1 === (int)$dh2) { - echo "\nNo new resource created\n"; + echo "\nNo new resource created\n"; } var_dump(closedir($dh2)); echo "-- Check Directory Handle: --\n"; diff --git a/ext/standard/tests/dir/closedir_variation3.phpt b/ext/standard/tests/dir/closedir_variation3.phpt index 65418ca636..1d9c644a3e 100644 --- a/ext/standard/tests/dir/closedir_variation3.phpt +++ b/ext/standard/tests/dir/closedir_variation3.phpt @@ -27,7 +27,7 @@ echo "\n-- Check file pointer: --\n"; var_dump($fp); if(is_resource($fp)) { - fclose($fp); + fclose($fp); } ?> --EXPECTF-- diff --git a/ext/standard/tests/dir/dir_bug73971.phpt b/ext/standard/tests/dir/dir_bug73971.phpt index e32516ea15..1fd3eb6691 100644 --- a/ext/standard/tests/dir/dir_bug73971.phpt +++ b/ext/standard/tests/dir/dir_bug73971.phpt @@ -26,7 +26,7 @@ $d->close(); echo "\ntest DirectoryIterator\n"; $dir = new DirectoryIterator($base); foreach ($dir as $finfo) { - var_dump($finfo->getFilename()); + var_dump($finfo->getFilename()); } ?> diff --git a/ext/standard/tests/dir/opendir_variation3-win32-mb.phpt b/ext/standard/tests/dir/opendir_variation3-win32-mb.phpt index 7185cff737..82f2a330d0 100644 --- a/ext/standard/tests/dir/opendir_variation3-win32-mb.phpt +++ b/ext/standard/tests/dir/opendir_variation3-win32-mb.phpt @@ -29,9 +29,9 @@ echo "\n-- Open directory second time: --\n"; var_dump($dh2 = opendir($path)); if ($dh1 !== $dh2) { - echo "\nNew resource created\n"; + echo "\nNew resource created\n"; } else { - echo "\nNo new resource created\n"; + echo "\nNo new resource created\n"; } closedir($dh1); diff --git a/ext/standard/tests/dir/opendir_variation3.phpt b/ext/standard/tests/dir/opendir_variation3.phpt index 83a265ab81..2169684fba 100644 --- a/ext/standard/tests/dir/opendir_variation3.phpt +++ b/ext/standard/tests/dir/opendir_variation3.phpt @@ -23,9 +23,9 @@ echo "\n-- Open directory second time: --\n"; var_dump($dh2 = opendir($path)); if ($dh1 !== $dh2) { - echo "\nNew resource created\n"; + echo "\nNew resource created\n"; } else { - echo "\nNo new resource created\n"; + echo "\nNo new resource created\n"; } closedir($dh1); diff --git a/ext/standard/tests/dir/opendir_variation4-win32-mb.phpt b/ext/standard/tests/dir/opendir_variation4-win32-mb.phpt index 319e178a2e..00d09985de 100644 --- a/ext/standard/tests/dir/opendir_variation4-win32-mb.phpt +++ b/ext/standard/tests/dir/opendir_variation4-win32-mb.phpt @@ -70,10 +70,10 @@ clean_dh($dh); * and to ensure directory is not in use at CLEAN section so can me removed */ function clean_dh($dh){ - if (is_resource($dh)) { - closedir($dh); - } - unset($dh); + if (is_resource($dh)) { + closedir($dh); + } + unset($dh); } ?> --CLEAN-- diff --git a/ext/standard/tests/dir/opendir_variation4.phpt b/ext/standard/tests/dir/opendir_variation4.phpt index 6434c9ef52..c206ac4d1e 100644 --- a/ext/standard/tests/dir/opendir_variation4.phpt +++ b/ext/standard/tests/dir/opendir_variation4.phpt @@ -64,10 +64,10 @@ clean_dh($dh); * and to ensure directory is not in use at CLEAN section so can me removed */ function clean_dh($dh){ - if (is_resource($dh)) { - closedir($dh); - } - unset($dh); + if (is_resource($dh)) { + closedir($dh); + } + unset($dh); } ?> --CLEAN-- diff --git a/ext/standard/tests/dir/opendir_variation5.phpt b/ext/standard/tests/dir/opendir_variation5.phpt index f8023288d1..15e6e16c8f 100644 --- a/ext/standard/tests/dir/opendir_variation5.phpt +++ b/ext/standard/tests/dir/opendir_variation5.phpt @@ -57,10 +57,10 @@ $dir_handle2 = opendir($child_dir_path); // try to open, expected failure var_dump( $dir_handle2 ); // dump it if (is_resource($dir_handle1)) { - closedir($dir_handle1); + closedir($dir_handle1); } if (is_resource($dir_handle2)) { - closedir($dir_handle2); + closedir($dir_handle2); } ?> --CLEAN-- diff --git a/ext/standard/tests/dir/opendir_variation7.phpt b/ext/standard/tests/dir/opendir_variation7.phpt index fff52b88d9..aa45f443f0 100644 --- a/ext/standard/tests/dir/opendir_variation7.phpt +++ b/ext/standard/tests/dir/opendir_variation7.phpt @@ -48,23 +48,23 @@ $permission_values = array( $iterator = 1; foreach ($permission_values as $perm) { - echo "\n-- Iteration $iterator --\n"; - // try to remove the dir if exists & create - if (is_dir($dir_path)){ - chmod ($dir_path, 0777); // change dir permission to allow all operation - rmdir ($dir_path); - } - mkdir($dir_path); - - // change the dir permission to test dir on it - var_dump( chmod($dir_path, $perm) ); - - var_dump($dh = opendir($dir_path)); - - if (is_resource($dh)) { - closedir($dh); - } - $iterator++; + echo "\n-- Iteration $iterator --\n"; + // try to remove the dir if exists & create + if (is_dir($dir_path)){ + chmod ($dir_path, 0777); // change dir permission to allow all operation + rmdir ($dir_path); + } + mkdir($dir_path); + + // change the dir permission to test dir on it + var_dump( chmod($dir_path, $perm) ); + + var_dump($dh = opendir($dir_path)); + + if (is_resource($dh)) { + closedir($dh); + } + $iterator++; } ?> --CLEAN-- diff --git a/ext/standard/tests/dir/readdir_basic-win32-mb.phpt b/ext/standard/tests/dir/readdir_basic-win32-mb.phpt index 18ee74e6b3..7b371ec3ac 100644 --- a/ext/standard/tests/dir/readdir_basic-win32-mb.phpt +++ b/ext/standard/tests/dir/readdir_basic-win32-mb.phpt @@ -31,22 +31,22 @@ echo "\n-- Call readdir() with \$path argument --\n"; var_dump($dh = opendir($path)); $a = array(); while( FALSE !== ($file = readdir($dh)) ) { - $a[] = $file; + $a[] = $file; } sort($a); foreach($a as $file) { - var_dump($file); + var_dump($file); } echo "\n-- Call readdir() without \$path argument --\n"; var_dump($dh = opendir($path)); $a = array(); while( FALSE !== ( $file = readdir() ) ) { - $a[] = $file; + $a[] = $file; } sort($a); foreach($a as $file) { - var_dump($file); + var_dump($file); } delete_files($path, 3); diff --git a/ext/standard/tests/dir/readdir_basic.phpt b/ext/standard/tests/dir/readdir_basic.phpt index 9a45ee4002..16437eb5a6 100644 --- a/ext/standard/tests/dir/readdir_basic.phpt +++ b/ext/standard/tests/dir/readdir_basic.phpt @@ -25,22 +25,22 @@ echo "\n-- Call readdir() with \$path argument --\n"; var_dump($dh = opendir($path)); $a = array(); while( FALSE !== ($file = readdir($dh)) ) { - $a[] = $file; + $a[] = $file; } sort($a); foreach($a as $file) { - var_dump($file); + var_dump($file); } echo "\n-- Call readdir() without \$path argument --\n"; var_dump($dh = opendir($path)); $a = array(); while( FALSE !== ( $file = readdir() ) ) { - $a[] = $file; + $a[] = $file; } sort($a); foreach($a as $file) { - var_dump($file); + var_dump($file); } delete_files($path, 3); diff --git a/ext/standard/tests/dir/readdir_variation2-win32-mb.phpt b/ext/standard/tests/dir/readdir_variation2-win32-mb.phpt index 01ae34fb88..4e0a8d7158 100644 --- a/ext/standard/tests/dir/readdir_variation2-win32-mb.phpt +++ b/ext/standard/tests/dir/readdir_variation2-win32-mb.phpt @@ -25,18 +25,18 @@ $dir_handle = opendir($path); echo "\n-- Pass an empty directory to readdir() --\n"; function mysort($a,$b) { - return strlen($a) > strlen($b) ? 1 : -1; + return strlen($a) > strlen($b) ? 1 : -1; } $entries = array(); while(FALSE !== ($file = readdir($dir_handle))){ - $entries[] = $file; + $entries[] = $file; } closedir($dir_handle); usort($entries, "mysort"); foreach($entries as $entry) { - var_dump($entry); + var_dump($entry); } ?> --CLEAN-- diff --git a/ext/standard/tests/dir/readdir_variation2.phpt b/ext/standard/tests/dir/readdir_variation2.phpt index 3fb35a778e..979c4f4057 100644 --- a/ext/standard/tests/dir/readdir_variation2.phpt +++ b/ext/standard/tests/dir/readdir_variation2.phpt @@ -19,18 +19,18 @@ $dir_handle = opendir($path); echo "\n-- Pass an empty directory to readdir() --\n"; function mysort($a,$b) { - return strlen($a) > strlen($b) ? 1 : -1; + return strlen($a) > strlen($b) ? 1 : -1; } $entries = array(); while(FALSE !== ($file = readdir($dir_handle))){ - $entries[] = $file; + $entries[] = $file; } closedir($dir_handle); usort($entries, "mysort"); foreach($entries as $entry) { - var_dump($entry); + var_dump($entry); } ?> --CLEAN-- diff --git a/ext/standard/tests/dir/readdir_variation3-win32-mb.phpt b/ext/standard/tests/dir/readdir_variation3-win32-mb.phpt index b3f831e067..594838fe11 100644 --- a/ext/standard/tests/dir/readdir_variation3-win32-mb.phpt +++ b/ext/standard/tests/dir/readdir_variation3-win32-mb.phpt @@ -35,9 +35,9 @@ create_files($path_sub, 2); $dir_handle = opendir($path_top); while(FALSE !== ($file = readdir($dir_handle))) { - // different OS order files differently so will - // store file names into an array so can use sorted in expected output - $contents[] = $file; + // different OS order files differently so will + // store file names into an array so can use sorted in expected output + $contents[] = $file; } // more important to check that all contents are present than order they are returned in diff --git a/ext/standard/tests/dir/readdir_variation3.phpt b/ext/standard/tests/dir/readdir_variation3.phpt index 6adac51215..6cc6f9e0a4 100644 --- a/ext/standard/tests/dir/readdir_variation3.phpt +++ b/ext/standard/tests/dir/readdir_variation3.phpt @@ -29,9 +29,9 @@ create_files($path_sub, 2); $dir_handle = opendir($path_top); while(FALSE !== ($file = readdir($dir_handle))) { - // different OS order files differently so will - // store file names into an array so can use sorted in expected output - $contents[] = $file; + // different OS order files differently so will + // store file names into an array so can use sorted in expected output + $contents[] = $file; } // more important to check that all contents are present than order they are returned in diff --git a/ext/standard/tests/dir/readdir_variation4-win32-mb.phpt b/ext/standard/tests/dir/readdir_variation4-win32-mb.phpt index 8e9e3b610e..c2bf8b1616 100644 --- a/ext/standard/tests/dir/readdir_variation4-win32-mb.phpt +++ b/ext/standard/tests/dir/readdir_variation4-win32-mb.phpt @@ -55,24 +55,24 @@ $inputs = array( $iterator = 1; foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator --\n"; - $handle = "fp{$iterator}"; - var_dump( $$handle = @fopen($dir_path . "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™$input.tmp", 'w') ); - var_dump( fwrite($$handle, $key)); - fclose($$handle); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + $handle = "fp{$iterator}"; + var_dump( $$handle = @fopen($dir_path . "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™$input.tmp", 'w') ); + var_dump( fwrite($$handle, $key)); + fclose($$handle); + $iterator++; }; echo "\n-- Call to readdir() --\n"; $dir_handle = opendir($dir_path); while(FALSE !== ($file = readdir($dir_handle))){ - // different OS order files differently so will - // store file names into an array so can use sorted in expected output - $contents[] = $file; + // different OS order files differently so will + // store file names into an array so can use sorted in expected output + $contents[] = $file; - // remove files while going through directory - @unlink($dir_path . $file); + // remove files while going through directory + @unlink($dir_path . $file); } // more important to check that all contents are present than order they are returned in diff --git a/ext/standard/tests/dir/readdir_variation4.phpt b/ext/standard/tests/dir/readdir_variation4.phpt index 8bfe176946..37e5b80ecb 100644 --- a/ext/standard/tests/dir/readdir_variation4.phpt +++ b/ext/standard/tests/dir/readdir_variation4.phpt @@ -49,24 +49,24 @@ $inputs = array( $iterator = 1; foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator --\n"; - $handle = "fp{$iterator}"; - var_dump( $$handle = fopen(@"$dir_path$input.tmp", 'w') ); - var_dump( fwrite($$handle, $key)); - fclose($$handle); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + $handle = "fp{$iterator}"; + var_dump( $$handle = fopen(@"$dir_path$input.tmp", 'w') ); + var_dump( fwrite($$handle, $key)); + fclose($$handle); + $iterator++; }; echo "\n-- Call to readdir() --\n"; $dir_handle = opendir($dir_path); while(FALSE !== ($file = readdir($dir_handle))){ - // different OS order files differently so will - // store file names into an array so can use sorted in expected output - $contents[] = $file; + // different OS order files differently so will + // store file names into an array so can use sorted in expected output + $contents[] = $file; - // remove files while going through directory - @unlink($dir_path . $file); + // remove files while going through directory + @unlink($dir_path . $file); } // more important to check that all contents are present than order they are returned in diff --git a/ext/standard/tests/dir/readdir_variation5.phpt b/ext/standard/tests/dir/readdir_variation5.phpt index e9d88dc835..d1cdc1bd58 100644 --- a/ext/standard/tests/dir/readdir_variation5.phpt +++ b/ext/standard/tests/dir/readdir_variation5.phpt @@ -46,23 +46,23 @@ $permission_values = array( // Open directory with different permission values, read and close, expected: none of them to succeed. $iterator = 1; foreach($permission_values as $perm) { - echo "\n-- Iteration $iterator --\n"; + echo "\n-- Iteration $iterator --\n"; - if (is_dir($dir_path)) { - chmod ($dir_path, 0777); // change dir permission to allow all operation - rmdir ($dir_path); - } - mkdir($dir_path); + if (is_dir($dir_path)) { + chmod ($dir_path, 0777); // change dir permission to allow all operation + rmdir ($dir_path); + } + mkdir($dir_path); - // change the dir permission to test dir on it - var_dump( chmod($dir_path, $perm) ); - var_dump($dh = opendir($dir_path)); + // change the dir permission to test dir on it + var_dump( chmod($dir_path, $perm) ); + var_dump($dh = opendir($dir_path)); - echo "-- Calling readdir() --\n"; - var_dump(readdir($dh)); + echo "-- Calling readdir() --\n"; + var_dump(readdir($dh)); - closedir($dh); - $iterator++; + closedir($dh); + $iterator++; } ?> --CLEAN-- diff --git a/ext/standard/tests/dir/readdir_variation6-win32-mb.phpt b/ext/standard/tests/dir/readdir_variation6-win32-mb.phpt index 3646316247..806fdec87e 100644 --- a/ext/standard/tests/dir/readdir_variation6-win32-mb.phpt +++ b/ext/standard/tests/dir/readdir_variation6-win32-mb.phpt @@ -39,21 +39,21 @@ opendir($dir_path); echo "\n-- Reading Directory Contents with Previous Handle --\n"; $a = array(); while (FALSE !== ($file = readdir($dir_handle1))) { - $a[] = $file; + $a[] = $file; } sort($a); foreach ($a as $file) { - var_dump($file); + var_dump($file); } echo "\n-- Reading Directory Contents with Current Handle (no arguments supplied) --\n"; $a = array(); while (FALSE !== ($file = readdir())) { - $a[] = $file; + $a[] = $file; } sort($a); foreach ($a as $file) { - var_dump($file); + var_dump($file); } // delete temporary files diff --git a/ext/standard/tests/dir/readdir_variation6.phpt b/ext/standard/tests/dir/readdir_variation6.phpt index 19bb906f14..532a20fd21 100644 --- a/ext/standard/tests/dir/readdir_variation6.phpt +++ b/ext/standard/tests/dir/readdir_variation6.phpt @@ -33,21 +33,21 @@ opendir($dir_path); echo "\n-- Reading Directory Contents with Previous Handle --\n"; $a = array(); while (FALSE !== ($file = readdir($dir_handle1))) { - $a[] = $file; + $a[] = $file; } sort($a); foreach ($a as $file) { - var_dump($file); + var_dump($file); } echo "\n-- Reading Directory Contents with Current Handle (no arguments supplied) --\n"; $a = array(); while (FALSE !== ($file = readdir())) { - $a[] = $file; + $a[] = $file; } sort($a); foreach ($a as $file) { - var_dump($file); + var_dump($file); } // delete temporary files diff --git a/ext/standard/tests/dir/rewinddir_basic-win32-mb.phpt b/ext/standard/tests/dir/rewinddir_basic-win32-mb.phpt index c16e993f83..fc5539666d 100644 --- a/ext/standard/tests/dir/rewinddir_basic-win32-mb.phpt +++ b/ext/standard/tests/dir/rewinddir_basic-win32-mb.phpt @@ -36,7 +36,7 @@ var_dump($dh2 = opendir($dir_path2)); $data = array(); echo "\n-- Read and rewind first directory (argument supplied) --\n"; while(FALSE !== $file1 = readdir($dh1)) { - $data[] = $file1; + $data[] = $file1; } $first = $data[0]; sort($data); @@ -48,7 +48,7 @@ var_dump(readdir($dh1) == $first); $data = array(); echo "\n-- Read and rewind second directory (no argument supplied) --\n"; while(FALSE !== $file2 = readdir()) { - $data[] = $file2; + $data[] = $file2; } $first = $data[0]; sort($data); diff --git a/ext/standard/tests/dir/rewinddir_basic.phpt b/ext/standard/tests/dir/rewinddir_basic.phpt index 1750121b3e..714d75266c 100644 --- a/ext/standard/tests/dir/rewinddir_basic.phpt +++ b/ext/standard/tests/dir/rewinddir_basic.phpt @@ -30,7 +30,7 @@ var_dump($dh2 = opendir($dir_path2)); $data = array(); echo "\n-- Read and rewind first directory (argument supplied) --\n"; while(FALSE !== $file1 = readdir($dh1)) { - $data[] = $file1; + $data[] = $file1; } $first = $data[0]; sort($data); @@ -42,7 +42,7 @@ var_dump(readdir($dh1) == $first); $data = array(); echo "\n-- Read and rewind second directory (no argument supplied) --\n"; while(FALSE !== $file2 = readdir()) { - $data[] = $file2; + $data[] = $file2; } $first = $data[0]; sort($data); diff --git a/ext/standard/tests/dir/rewinddir_variation3.phpt b/ext/standard/tests/dir/rewinddir_variation3.phpt index 2bd69e45fc..07508eac3f 100644 --- a/ext/standard/tests/dir/rewinddir_variation3.phpt +++ b/ext/standard/tests/dir/rewinddir_variation3.phpt @@ -28,9 +28,9 @@ $result2 = fread($fp, 5); echo "\n-- Check if rewinddir() has repositioned the file pointer --\n"; if ($result1 === $result2) { - echo "rewinddir() works on file pointers\n"; + echo "rewinddir() works on file pointers\n"; } else { - echo "rewinddir() does not work on file pointers\n"; + echo "rewinddir() does not work on file pointers\n"; } ?> --EXPECTF-- diff --git a/ext/standard/tests/dir/scandir_variation7.phpt b/ext/standard/tests/dir/scandir_variation7.phpt index a0fede44ad..eb4c7e9d21 100644 --- a/ext/standard/tests/dir/scandir_variation7.phpt +++ b/ext/standard/tests/dir/scandir_variation7.phpt @@ -44,20 +44,20 @@ $permission_values = array( $iterator = 1; foreach ($permission_values as $perm) { - echo "\n-- Iteration $iterator --\n"; + echo "\n-- Iteration $iterator --\n"; - // Remove the directory if already exists - if (is_dir($dir_path)){ - chmod ($dir_path, 0777); // change dir permission to allow all operation - rmdir ($dir_path); - } - mkdir($dir_path); + // Remove the directory if already exists + if (is_dir($dir_path)){ + chmod ($dir_path, 0777); // change dir permission to allow all operation + rmdir ($dir_path); + } + mkdir($dir_path); - // change the dir permission to test dir on it - var_dump( chmod($dir_path, $perm) ); + // change the dir permission to test dir on it + var_dump( chmod($dir_path, $perm) ); - var_dump(scandir($dir_path)); - $iterator++; + var_dump(scandir($dir_path)); + $iterator++; } ?> --CLEAN-- diff --git a/ext/standard/tests/dir/scandir_variation8-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation8-win32-mb.phpt index ffeda65be7..e353dc3725 100644 --- a/ext/standard/tests/dir/scandir_variation8-win32-mb.phpt +++ b/ext/standard/tests/dir/scandir_variation8-win32-mb.phpt @@ -55,11 +55,11 @@ $inputs = array( $iterator = 1; foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator --\n"; - $handle = "fp{$iterator}"; - var_dump( $$handle = @fopen($dir_path . "/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™$input.tmp", 'w') ); - fclose($$handle); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + $handle = "fp{$iterator}"; + var_dump( $$handle = @fopen($dir_path . "/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™$input.tmp", 'w') ); + fclose($$handle); + $iterator++; }; echo "\n-- Call to scandir() --\n"; @@ -67,8 +67,8 @@ var_dump($content = scandir($dir_path)); // remove all files in directory so can remove directory in CLEAN section foreach ($content as $file_name) { - // suppress errors as won't be able to remove "." and ".." entries - @unlink($dir_path . $file_name); + // suppress errors as won't be able to remove "." and ".." entries + @unlink($dir_path . $file_name); } ?> --CLEAN-- diff --git a/ext/standard/tests/dir/scandir_variation8.phpt b/ext/standard/tests/dir/scandir_variation8.phpt index 7734c1531f..1eec187f70 100644 --- a/ext/standard/tests/dir/scandir_variation8.phpt +++ b/ext/standard/tests/dir/scandir_variation8.phpt @@ -49,11 +49,11 @@ $inputs = array( $iterator = 1; foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator --\n"; - $handle = "fp{$iterator}"; - var_dump( $$handle = fopen(@"$dir_path$input.tmp", 'w') ); - fclose($$handle); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + $handle = "fp{$iterator}"; + var_dump( $$handle = fopen(@"$dir_path$input.tmp", 'w') ); + fclose($$handle); + $iterator++; }; echo "\n-- Call to scandir() --\n"; @@ -61,8 +61,8 @@ var_dump($content = scandir($dir_path)); // remove all files in directory so can remove directory in CLEAN section foreach ($content as $file_name) { - // suppress errors as won't be able to remove "." and ".." entries - @unlink($dir_path . $file_name); + // suppress errors as won't be able to remove "." and ".." entries + @unlink($dir_path . $file_name); } ?> --CLEAN-- diff --git a/ext/standard/tests/dir/scandir_variation9-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation9-win32-mb.phpt index 16b26fbb78..c609975dda 100644 --- a/ext/standard/tests/dir/scandir_variation9-win32-mb.phpt +++ b/ext/standard/tests/dir/scandir_variation9-win32-mb.phpt @@ -32,7 +32,7 @@ mkdir($dir); $ints = array (PHP_INT_MAX, -PHP_INT_MAX, 0); foreach($ints as $sorting_order) { - var_dump( scandir($dir, $sorting_order) ); + var_dump( scandir($dir, $sorting_order) ); } delete_files($dir, 2, "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™file"); diff --git a/ext/standard/tests/dir/scandir_variation9.phpt b/ext/standard/tests/dir/scandir_variation9.phpt index 6bfbe28ea0..7e623c0e6f 100644 --- a/ext/standard/tests/dir/scandir_variation9.phpt +++ b/ext/standard/tests/dir/scandir_variation9.phpt @@ -26,7 +26,7 @@ mkdir($dir); $ints = array (PHP_INT_MAX, -PHP_INT_MAX, 0); foreach($ints as $sorting_order) { - var_dump( scandir($dir, $sorting_order) ); + var_dump( scandir($dir, $sorting_order) ); } delete_files($dir, 2); diff --git a/ext/standard/tests/directory/bug74589_utf8.phpt b/ext/standard/tests/directory/bug74589_utf8.phpt index 5bf047fbe2..7a13b57f04 100644 --- a/ext/standard/tests/directory/bug74589_utf8.phpt +++ b/ext/standard/tests/directory/bug74589_utf8.phpt @@ -23,9 +23,9 @@ mkdir($dir); file_put_contents($test_file, "<?php - var_dump(__DIR__); - var_dump(__FILE__); - var_dump(__DIR__ === __DIR__);"); + var_dump(__DIR__); + var_dump(__FILE__); + var_dump(__DIR__ === __DIR__);"); $php = getenv('TEST_PHP_EXECUTABLE'); diff --git a/ext/standard/tests/file/001.phpt b/ext/standard/tests/file/001.phpt index d5ab2e5a0b..e2fa6cce59 100644 --- a/ext/standard/tests/file/001.phpt +++ b/ext/standard/tests/file/001.phpt @@ -50,14 +50,14 @@ $s = stat ('test.file'); $ls = lstat ('test.file'); for ($i = 0; $i <= 12; $i++) { if ($ls[$i] != $s[$i]) { - echo "test.file lstat and stat differ at element $i\n"; + echo "test.file lstat and stat differ at element $i\n"; } } $s = stat ('test.link'); $ls = lstat ('test.link'); for ($i = 0; $i <= 11; $i++) { if ($ls[$i] != $s[$i]) { - if ($i != 6 && $i != 10 && $i != 11) echo "test.link lstat and stat differ at element $i\n"; + if ($i != 6 && $i != 10 && $i != 11) echo "test.link lstat and stat differ at element $i\n"; } } echo "test.file is " . filetype('test.file') . "\n"; diff --git a/ext/standard/tests/file/003.phpt b/ext/standard/tests/file/003.phpt index 8eeaa939eb..59e03f0cef 100644 --- a/ext/standard/tests/file/003.phpt +++ b/ext/standard/tests/file/003.phpt @@ -4,27 +4,27 @@ is_*() and file_exists() return values are boolean. <?php $funcs = array( - 'is_writable', - 'is_readable', - 'is_executable', - 'is_file', - 'file_exists', + 'is_writable', + 'is_readable', + 'is_executable', + 'is_file', + 'file_exists', ); $filename=""; foreach ($funcs as $test) { - $bb = $test($filename); - echo gettype($bb)."\n"; - clearstatcache(); + $bb = $test($filename); + echo gettype($bb)."\n"; + clearstatcache(); } $filename="run-tests.php"; foreach ($funcs as $test) { - $bb = $test($filename); - echo gettype($bb)."\n"; - clearstatcache(); + $bb = $test($filename); + echo gettype($bb)."\n"; + clearstatcache(); } ?> diff --git a/ext/standard/tests/file/004.phpt b/ext/standard/tests/file/004.phpt index 522b8320e4..742457c7aa 100644 --- a/ext/standard/tests/file/004.phpt +++ b/ext/standard/tests/file/004.phpt @@ -2,56 +2,56 @@ file_put_contents() test --FILE-- <?php - chdir(__DIR__); - for ($i = 1; $i < 6; $i++) { - @unlink("./TEST{$i}"); - } + chdir(__DIR__); + for ($i = 1; $i < 6; $i++) { + @unlink("./TEST{$i}"); + } - echo "String Test: "; - echo file_put_contents("TEST1", file_get_contents(__FILE__)) !== FALSE ? 'OK' : 'FAIL'; - echo "\n"; + echo "String Test: "; + echo file_put_contents("TEST1", file_get_contents(__FILE__)) !== FALSE ? 'OK' : 'FAIL'; + echo "\n"; - $old_int = $int = rand(); - $ret = file_put_contents("TEST2", $int); - echo "Integer Test: "; - if ($int === $old_int && $ret !== FALSE && md5($int) == md5_file("TEST2")) { - echo 'OK'; - } else { - echo 'FAIL'; - } - echo "\n"; + $old_int = $int = rand(); + $ret = file_put_contents("TEST2", $int); + echo "Integer Test: "; + if ($int === $old_int && $ret !== FALSE && md5($int) == md5_file("TEST2")) { + echo 'OK'; + } else { + echo 'FAIL'; + } + echo "\n"; - $old_int = $int = time() / 1000; - $ret = file_put_contents("TEST3", $int); - echo "Float Test: "; - if ($int === $old_int && $ret !== FALSE && md5($int) == md5_file("TEST3")) { - echo 'OK'; - } else { - echo 'FAIL'; - } - echo "\n"; + $old_int = $int = time() / 1000; + $ret = file_put_contents("TEST3", $int); + echo "Float Test: "; + if ($int === $old_int && $ret !== FALSE && md5($int) == md5_file("TEST3")) { + echo 'OK'; + } else { + echo 'FAIL'; + } + echo "\n"; - $ret = file_put_contents("TEST4", __FILE__); - echo "Bool Test: "; - if ($ret !== FALSE && md5(__FILE__) == md5_file("TEST4")) { - echo 'OK'; - } else { - echo 'FAIL'; - } - echo "\n"; + $ret = file_put_contents("TEST4", __FILE__); + echo "Bool Test: "; + if ($ret !== FALSE && md5(__FILE__) == md5_file("TEST4")) { + echo 'OK'; + } else { + echo 'FAIL'; + } + echo "\n"; - $ret = @file_put_contents("TEST5", $_SERVER); - echo "Array Test: "; - if ($ret !== FALSE && @md5(implode('', $_SERVER)) == md5_file("TEST5")) { - echo 'OK'; - } else { - echo 'FAIL'; - } - echo "\n"; + $ret = @file_put_contents("TEST5", $_SERVER); + echo "Array Test: "; + if ($ret !== FALSE && @md5(implode('', $_SERVER)) == md5_file("TEST5")) { + echo 'OK'; + } else { + echo 'FAIL'; + } + echo "\n"; - for ($i = 1; $i < 6; $i++) { - @unlink("./TEST{$i}"); - } + for ($i = 1; $i < 6; $i++) { + @unlink("./TEST{$i}"); + } ?> --EXPECT-- String Test: OK diff --git a/ext/standard/tests/file/basename_basic-win32.phpt b/ext/standard/tests/file/basename_basic-win32.phpt index ceccf9eef7..79de350eae 100644 --- a/ext/standard/tests/file/basename_basic-win32.phpt +++ b/ext/standard/tests/file/basename_basic-win32.phpt @@ -60,7 +60,7 @@ $file_paths = array ( ); foreach ($file_paths as $file_path) { - var_dump(basename($file_path)); + var_dump(basename($file_path)); } ?> diff --git a/ext/standard/tests/file/basename_basic.phpt b/ext/standard/tests/file/basename_basic.phpt index 6354b2acd7..55bd868c55 100644 --- a/ext/standard/tests/file/basename_basic.phpt +++ b/ext/standard/tests/file/basename_basic.phpt @@ -60,7 +60,7 @@ $file_paths = array ( ); foreach ($file_paths as $file_path) { - var_dump(basename($file_path)); + var_dump(basename($file_path)); } ?> diff --git a/ext/standard/tests/file/basename_variation1-win32.phpt b/ext/standard/tests/file/basename_variation1-win32.phpt index eb2a4ff497..b68765ca68 100644 --- a/ext/standard/tests/file/basename_variation1-win32.phpt +++ b/ext/standard/tests/file/basename_variation1-win32.phpt @@ -12,25 +12,25 @@ if (substr(PHP_OS, 0, 3) != 'WIN') { $prefixes = array ( // drive letters - "A:/", + "A:/", "Z:/", "A:\\", // other prefixes "http://", "blah://", - "blah:\\", + "blah:\\", "hostname:", - // home directory ~ - "~/", - "~\\", + // home directory ~ + "~/", + "~\\", ); $paths = array ( - "foo", - "foo/", + "foo", + "foo/", "foo\\", "foo.bar", "foo.bar/", @@ -43,11 +43,11 @@ $paths = array ( ); foreach ($prefixes as $prefix) { - foreach ($paths as $path) { - $input = $prefix . $path; - echo "basename for path $input is:\n"; - var_dump(basename($input)); - } + foreach ($paths as $path) { + $input = $prefix . $path; + echo "basename for path $input is:\n"; + var_dump(basename($input)); + } } echo "\ndone\n"; diff --git a/ext/standard/tests/file/basename_variation1.phpt b/ext/standard/tests/file/basename_variation1.phpt index ea7cdfe8b7..2b2ac3110e 100644 --- a/ext/standard/tests/file/basename_variation1.phpt +++ b/ext/standard/tests/file/basename_variation1.phpt @@ -12,25 +12,25 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { $prefixes = array ( // drive letters - "A:/", + "A:/", "Z:/", "A:\\", // other prefixes "http://", "blah://", - "blah:\\", + "blah:\\", "hostname:", - // home directory ~ - "~/", - "~\\", + // home directory ~ + "~/", + "~\\", ); $paths = array ( - "foo", - "foo/", + "foo", + "foo/", "foo\\", "foo.bar", "foo.bar/", @@ -43,11 +43,11 @@ $paths = array ( ); foreach ($prefixes as $prefix) { - foreach ($paths as $path) { - $input = $prefix . $path; - echo "basename for path $input is:\n"; - var_dump(basename($input)); - } + foreach ($paths as $path) { + $input = $prefix . $path; + echo "basename for path $input is:\n"; + var_dump(basename($input)); + } } echo "\ndone\n"; diff --git a/ext/standard/tests/file/basename_variation2-win32.phpt b/ext/standard/tests/file/basename_variation2-win32.phpt index 43d6de5060..870fc617dd 100644 --- a/ext/standard/tests/file/basename_variation2-win32.phpt +++ b/ext/standard/tests/file/basename_variation2-win32.phpt @@ -11,8 +11,8 @@ if (substr(PHP_OS, 0, 3) != 'WIN') { $paths = array ( - "foo", - "foo/", + "foo", + "foo/", "foo\\", "foo.bar", "foo.bar/", @@ -26,8 +26,8 @@ $paths = array ( $suffixes = array ( - ".bar", - ".b", + ".bar", + ".b", ".", " ", "foo", @@ -39,10 +39,10 @@ $suffixes = array ( ); foreach ($paths as $path) { - foreach ($suffixes as $suffix) { - echo "basename for path $path, supplying suffix $suffix is:\n"; - var_dump(basename($path, $suffix)); - } + foreach ($suffixes as $suffix) { + echo "basename for path $path, supplying suffix $suffix is:\n"; + var_dump(basename($path, $suffix)); + } } echo "\ndone\n"; diff --git a/ext/standard/tests/file/basename_variation2.phpt b/ext/standard/tests/file/basename_variation2.phpt index 195b98a6d3..a428d84e06 100644 --- a/ext/standard/tests/file/basename_variation2.phpt +++ b/ext/standard/tests/file/basename_variation2.phpt @@ -11,8 +11,8 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { $paths = array ( - "foo", - "foo/", + "foo", + "foo/", "foo\\", "foo.bar", "foo.bar/", @@ -26,8 +26,8 @@ $paths = array ( $suffixes = array ( - ".bar", - ".b", + ".bar", + ".b", ".", " ", "foo", @@ -39,10 +39,10 @@ $suffixes = array ( ); foreach ($paths as $path) { - foreach ($suffixes as $suffix) { - echo "basename for path $path, supplying suffix $suffix is:\n"; - var_dump(basename($path, $suffix)); - } + foreach ($suffixes as $suffix) { + echo "basename for path $path, supplying suffix $suffix is:\n"; + var_dump(basename($path, $suffix)); + } } echo "\ndone\n"; diff --git a/ext/standard/tests/file/bug12556.phpt b/ext/standard/tests/file/bug12556.phpt index 30299899a1..83b39ad782 100644 --- a/ext/standard/tests/file/bug12556.phpt +++ b/ext/standard/tests/file/bug12556.phpt @@ -4,8 +4,8 @@ Bug #12556 (fgetcsv() ignores lengths when quotes not closed) <?php $fp = fopen(__DIR__."/test.csv", "r"); while($line = fgetcsv($fp, 24)) { - $line = str_replace("\x0d\x0a", "\x0a", $line); - var_dump($line); + $line = str_replace("\x0d\x0a", "\x0a", $line); + var_dump($line); } fclose($fp); ?> diff --git a/ext/standard/tests/file/bug22382.phpt b/ext/standard/tests/file/bug22382.phpt index 7768a13b3e..c8dd01efd0 100644 --- a/ext/standard/tests/file/bug22382.phpt +++ b/ext/standard/tests/file/bug22382.phpt @@ -4,7 +4,7 @@ Bug #22382 (fgetcsv() does not handle escaped quotes correctly) <?php $fp = fopen(__DIR__."/test2.csv", "r"); while(($line = fgetcsv($fp, 1024))) { - var_dump($line); + var_dump($line); } fclose($fp); ?> diff --git a/ext/standard/tests/file/bug22414.phpt b/ext/standard/tests/file/bug22414.phpt index c6e993ac9f..5507856815 100644 --- a/ext/standard/tests/file/bug22414.phpt +++ b/ext/standard/tests/file/bug22414.phpt @@ -5,33 +5,33 @@ output_handler= --FILE-- <?php - $php = getenv('TEST_PHP_EXECUTABLE'); - $tmpfile = tempnam(__DIR__, 'phpt'); - $args = ' -n '; + $php = getenv('TEST_PHP_EXECUTABLE'); + $tmpfile = tempnam(__DIR__, 'phpt'); + $args = ' -n '; - /* Regular Data Test */ - passthru($php . $args . ' -r " echo \"HELLO\"; "'); + /* Regular Data Test */ + passthru($php . $args . ' -r " echo \"HELLO\"; "'); - echo "\n"; + echo "\n"; - /* Binary Data Test */ + /* Binary Data Test */ - if (substr(PHP_OS, 0, 3) != 'WIN') { - $cmd = $php . $args . ' -r \"readfile(@getenv(\'\\\'\'TEST_PHP_EXECUTABLE\'\\\'\')); \"'; - $cmd = $php . $args . ' -r \' passthru("'.$cmd.'"); \' > '.$tmpfile ; - } else { - $cmd = $php . $args . ' -r \"readfile(@getenv(\\\\\\"TEST_PHP_EXECUTABLE\\\\\\")); \"'; - $cmd = $php . $args . ' -r " passthru(\''.$cmd.'\');" > '.$tmpfile ; - } - exec($cmd); + if (substr(PHP_OS, 0, 3) != 'WIN') { + $cmd = $php . $args . ' -r \"readfile(@getenv(\'\\\'\'TEST_PHP_EXECUTABLE\'\\\'\')); \"'; + $cmd = $php . $args . ' -r \' passthru("'.$cmd.'"); \' > '.$tmpfile ; + } else { + $cmd = $php . $args . ' -r \"readfile(@getenv(\\\\\\"TEST_PHP_EXECUTABLE\\\\\\")); \"'; + $cmd = $php . $args . ' -r " passthru(\''.$cmd.'\');" > '.$tmpfile ; + } + exec($cmd); - if (md5_file($php) == md5_file($tmpfile)) { - echo "Works\n"; - } else { - echo "Does not work\n"; - } + if (md5_file($php) == md5_file($tmpfile)) { + echo "Works\n"; + } else { + echo "Does not work\n"; + } - @unlink($tmpfile); + @unlink($tmpfile); ?> --EXPECT-- HELLO diff --git a/ext/standard/tests/file/bug24313.phpt b/ext/standard/tests/file/bug24313.phpt index e5bceee856..0893889a02 100644 --- a/ext/standard/tests/file/bug24313.phpt +++ b/ext/standard/tests/file/bug24313.phpt @@ -10,7 +10,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { open_basedir=/dev --FILE-- <?php - var_dump(file_exists("/dev/bogus_file_no_such_thing")); + var_dump(file_exists("/dev/bogus_file_no_such_thing")); ?> --EXPECT-- bool(false) diff --git a/ext/standard/tests/file/bug24482.phpt b/ext/standard/tests/file/bug24482.phpt index 9fe4d2d9ee..ba3dd73318 100644 --- a/ext/standard/tests/file/bug24482.phpt +++ b/ext/standard/tests/file/bug24482.phpt @@ -18,24 +18,24 @@ $globdirs = glob("*", GLOB_ONLYDIR); $dirs = array(); $dh = opendir("."); while (is_string($file = readdir($dh))) { - if ($file[0] === ".") continue; - if (!is_dir($file)) continue; - $dirs[] = $file; + if ($file[0] === ".") continue; + if (!is_dir($file)) continue; + $dirs[] = $file; } closedir($dh); if (count($dirs) != count($globdirs)) { - echo "Directory count mismatch\n"; + echo "Directory count mismatch\n"; - echo "glob found:\n"; - sort($globdirs); - var_dump($globdirs); + echo "glob found:\n"; + sort($globdirs); + var_dump($globdirs); - echo "opendir/readdir/isdir found:\n"; - sort($dirs); - var_dump($dirs); + echo "opendir/readdir/isdir found:\n"; + sort($dirs); + var_dump($dirs); } else { - echo "OK\n"; + echo "OK\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/file/bug26615.phpt b/ext/standard/tests/file/bug26615.phpt index 3689fdfe16..8a5df91ec1 100644 --- a/ext/standard/tests/file/bug26615.phpt +++ b/ext/standard/tests/file/bug26615.phpt @@ -7,9 +7,9 @@ variables_order=E $out = array(); $status = -1; if (substr(PHP_OS, 0, 3) != 'WIN') { - exec($_ENV['TEST_PHP_EXECUTABLE'].' -n -r \'for($i=1;$i<=5000;$i++) print "$i\n";\' | tr \'\n\' \' \'', $out, $status); + exec($_ENV['TEST_PHP_EXECUTABLE'].' -n -r \'for($i=1;$i<=5000;$i++) print "$i\n";\' | tr \'\n\' \' \'', $out, $status); } else { - exec($_ENV['TEST_PHP_EXECUTABLE'].' -n -r "for($i=1;$i<=5000;$i++) echo $i,\' \';"', $out, $status); + exec($_ENV['TEST_PHP_EXECUTABLE'].' -n -r "for($i=1;$i<=5000;$i++) echo $i,\' \';"', $out, $status); } print_r($out); ?> diff --git a/ext/standard/tests/file/bug26938.phpt b/ext/standard/tests/file/bug26938.phpt index d1ad6b6526..13732c03f6 100644 --- a/ext/standard/tests/file/bug26938.phpt +++ b/ext/standard/tests/file/bug26938.phpt @@ -6,19 +6,19 @@ $out = array(); $status = -1; $php = getenv('TEST_PHP_EXECUTABLE'); if (substr(PHP_OS, 0, 3) != 'WIN') { - exec($php . ' -n -r \'' - . '$lengths = array(10,20000,10000,5,10000,3);' - . 'foreach($lengths as $length) {' - . ' for($i=0;$i<$length;$i++) print chr(65+$i % 27);' - . ' print "\n";' - . '}\'', $out, $status); + exec($php . ' -n -r \'' + . '$lengths = array(10,20000,10000,5,10000,3);' + . 'foreach($lengths as $length) {' + . ' for($i=0;$i<$length;$i++) print chr(65+$i % 27);' + . ' print "\n";' + . '}\'', $out, $status); } else { - exec($php . ' -n -r "' - . '$lengths = array(10,20000,10000,5,10000,3);' - . 'foreach($lengths as $length) {' - . ' for($i=0;$i<$length;$i++) print chr(65+$i % 27);' - . ' print \\"\\n\\";' - . '}"', $out, $status); + exec($php . ' -n -r "' + . '$lengths = array(10,20000,10000,5,10000,3);' + . 'foreach($lengths as $length) {' + . ' for($i=0;$i<$length;$i++) print chr(65+$i % 27);' + . ' print \\"\\n\\";' + . '}"', $out, $status); } for ($i=0;$i<6;$i++) print "md5(line $i)= " . md5($out[$i]) . " (length " . diff --git a/ext/standard/tests/file/bug27619.phpt b/ext/standard/tests/file/bug27619.phpt index 095a18c199..6f377b52a9 100644 --- a/ext/standard/tests/file/bug27619.phpt +++ b/ext/standard/tests/file/bug27619.phpt @@ -2,17 +2,17 @@ Bug #27619 (filters not applied to pre-buffered data) --FILE-- <?php - $fp = tmpfile(); - fwrite($fp, "this is a lowercase string.\n"); - rewind($fp); + $fp = tmpfile(); + fwrite($fp, "this is a lowercase string.\n"); + rewind($fp); - /* Echo out the first four bytes 'this' without applying filter - Remainder will get sucked into the read buffer though. */ - echo fread($fp, 4); + /* Echo out the first four bytes 'this' without applying filter + Remainder will get sucked into the read buffer though. */ + echo fread($fp, 4); - stream_filter_append($fp, "string.toupper"); + stream_filter_append($fp, "string.toupper"); - fpassthru($fp); + fpassthru($fp); ?> --EXPECT-- this IS A LOWERCASE STRING. diff --git a/ext/standard/tests/file/bug37158.phpt b/ext/standard/tests/file/bug37158.phpt index 3200a62cf9..9afeaeeb8c 100644 --- a/ext/standard/tests/file/bug37158.phpt +++ b/ext/standard/tests/file/bug37158.phpt @@ -17,7 +17,7 @@ $file = __DIR__ . '/footest.txt'; $x = str_repeat(1, 8192); $fp = fopen($file, 'w'); for ($i = 0; $i < 5; $i++) { - fwrite($fp, $x); + fwrite($fp, $x); } fclose($fp); diff --git a/ext/standard/tests/file/bug37864.phpt b/ext/standard/tests/file/bug37864.phpt index f8743bd5ec..1da8f16183 100644 --- a/ext/standard/tests/file/bug37864.phpt +++ b/ext/standard/tests/file/bug37864.phpt @@ -2,10 +2,10 @@ Bug #37864 (file_get_contents() leaks on empty file) --FILE-- <?php - $tmpfname = tempnam(sys_get_temp_dir(), "emptyfile"); - var_dump(file_get_contents($tmpfname)); - echo "done.\n"; - unlink($tmpfname); + $tmpfname = tempnam(sys_get_temp_dir(), "emptyfile"); + var_dump(file_get_contents($tmpfname)); + echo "done.\n"; + unlink($tmpfname); ?> --EXPECT-- string(0) "" diff --git a/ext/standard/tests/file/bug38450.phpt b/ext/standard/tests/file/bug38450.phpt index eae86cf9a0..a82be7848a 100644 --- a/ext/standard/tests/file/bug38450.phpt +++ b/ext/standard/tests/file/bug38450.phpt @@ -4,85 +4,85 @@ Bug #38450 (constructor is not called for classes used in userspace stream wrapp <?php class VariableStream { - var $position; - var $varname; - - function __construct($var=null) { - var_dump("constructor!"); - } - - function stream_open($path, $mode, $options, &$opened_path) - { - $url = parse_url($path); - $this->varname = $url["host"]; - $this->position = 0; - - return true; - } - - function stream_read($count) - { - $ret = substr($GLOBALS[$this->varname], $this->position, $count); - $this->position += strlen($ret); - return $ret; - } - - function stream_write($data) - { - $left = substr($GLOBALS[$this->varname], 0, $this->position); - $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); - $GLOBALS[$this->varname] = $left . $data . $right; - $this->position += strlen($data); - return strlen($data); - } - - function stream_tell() - { - return $this->position; - } - - function stream_eof() - { - return $this->position >= strlen($GLOBALS[$this->varname]); - } - function stream_seek($offset, $whence) - { - switch ($whence) { - case SEEK_SET: - if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { - $this->position = $offset; - return true; - } else { - return false; - } - break; - - case SEEK_CUR: - if ($offset >= 0) { - $this->position += $offset; - return true; - } else { - return false; - } - break; - - case SEEK_END: - if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { - $this->position = strlen($GLOBALS[$this->varname]) + $offset; - return true; - } else { - return false; - } - break; - - default: - return false; - } - } + var $position; + var $varname; + + function __construct($var=null) { + var_dump("constructor!"); + } + + function stream_open($path, $mode, $options, &$opened_path) + { + $url = parse_url($path); + $this->varname = $url["host"]; + $this->position = 0; + + return true; + } + + function stream_read($count) + { + $ret = substr($GLOBALS[$this->varname], $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + + function stream_write($data) + { + $left = substr($GLOBALS[$this->varname], 0, $this->position); + $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); + $GLOBALS[$this->varname] = $left . $data . $right; + $this->position += strlen($data); + return strlen($data); + } + + function stream_tell() + { + return $this->position; + } + + function stream_eof() + { + return $this->position >= strlen($GLOBALS[$this->varname]); + } + function stream_seek($offset, $whence) + { + switch ($whence) { + case SEEK_SET: + if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { + $this->position = $offset; + return true; + } else { + return false; + } + break; + + case SEEK_CUR: + if ($offset >= 0) { + $this->position += $offset; + return true; + } else { + return false; + } + break; + + case SEEK_END: + if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { + $this->position = strlen($GLOBALS[$this->varname]) + $offset; + return true; + } else { + return false; + } + break; + + default: + return false; + } + } } stream_wrapper_register("var", "VariableStream") - or die("Failed to register protocol"); + or die("Failed to register protocol"); $myvar = ""; @@ -94,7 +94,7 @@ fwrite($fp, "line3\n"); rewind($fp); while (!feof($fp)) { - echo fgets($fp); + echo fgets($fp); } fclose($fp); var_dump($myvar); diff --git a/ext/standard/tests/file/bug38450_1.phpt b/ext/standard/tests/file/bug38450_1.phpt index 9cc383171b..6eea9e2000 100644 --- a/ext/standard/tests/file/bug38450_1.phpt +++ b/ext/standard/tests/file/bug38450_1.phpt @@ -4,85 +4,85 @@ Bug #38450 (constructor is not called for classes used in userspace stream wrapp <?php class VariableStream { - var $position; - var $varname; - - function __construct($var = null) { - var_dump("constructor!"); - } - - function stream_open($path, $mode, $options, &$opened_path) - { - $url = parse_url($path); - $this->varname = $url["host"]; - $this->position = 0; - - return true; - } - - function stream_read($count) - { - $ret = substr($GLOBALS[$this->varname], $this->position, $count); - $this->position += strlen($ret); - return $ret; - } - - function stream_write($data) - { - $left = substr($GLOBALS[$this->varname], 0, $this->position); - $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); - $GLOBALS[$this->varname] = $left . $data . $right; - $this->position += strlen($data); - return strlen($data); - } - - function stream_tell() - { - return $this->position; - } - - function stream_eof() - { - return $this->position >= strlen($GLOBALS[$this->varname]); - } - function stream_seek($offset, $whence) - { - switch ($whence) { - case SEEK_SET: - if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { - $this->position = $offset; - return true; - } else { - return false; - } - break; - - case SEEK_CUR: - if ($offset >= 0) { - $this->position += $offset; - return true; - } else { - return false; - } - break; - - case SEEK_END: - if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { - $this->position = strlen($GLOBALS[$this->varname]) + $offset; - return true; - } else { - return false; - } - break; - - default: - return false; - } - } + var $position; + var $varname; + + function __construct($var = null) { + var_dump("constructor!"); + } + + function stream_open($path, $mode, $options, &$opened_path) + { + $url = parse_url($path); + $this->varname = $url["host"]; + $this->position = 0; + + return true; + } + + function stream_read($count) + { + $ret = substr($GLOBALS[$this->varname], $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + + function stream_write($data) + { + $left = substr($GLOBALS[$this->varname], 0, $this->position); + $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); + $GLOBALS[$this->varname] = $left . $data . $right; + $this->position += strlen($data); + return strlen($data); + } + + function stream_tell() + { + return $this->position; + } + + function stream_eof() + { + return $this->position >= strlen($GLOBALS[$this->varname]); + } + function stream_seek($offset, $whence) + { + switch ($whence) { + case SEEK_SET: + if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { + $this->position = $offset; + return true; + } else { + return false; + } + break; + + case SEEK_CUR: + if ($offset >= 0) { + $this->position += $offset; + return true; + } else { + return false; + } + break; + + case SEEK_END: + if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { + $this->position = strlen($GLOBALS[$this->varname]) + $offset; + return true; + } else { + return false; + } + break; + + default: + return false; + } + } } stream_wrapper_register("var", "VariableStream") - or die("Failed to register protocol"); + or die("Failed to register protocol"); $myvar = ""; @@ -94,7 +94,7 @@ fwrite($fp, "line3\n"); rewind($fp); while (!feof($fp)) { - echo fgets($fp); + echo fgets($fp); } fclose($fp); var_dump($myvar); diff --git a/ext/standard/tests/file/bug38450_2.phpt b/ext/standard/tests/file/bug38450_2.phpt index 33a13da0db..cf4cb91928 100644 --- a/ext/standard/tests/file/bug38450_2.phpt +++ b/ext/standard/tests/file/bug38450_2.phpt @@ -4,85 +4,85 @@ Bug #38450 (constructor is not called for classes used in userspace stream wrapp <?php class VariableStream { - var $position; - var $varname; - - function __construct($var = null) { - throw new Exception("constructor"); - } - - function stream_open($path, $mode, $options, &$opened_path) - { - $url = parse_url($path); - $this->varname = $url["host"]; - $this->position = 0; - - return true; - } - - function stream_read($count) - { - $ret = substr($GLOBALS[$this->varname], $this->position, $count); - $this->position += strlen($ret); - return $ret; - } - - function stream_write($data) - { - $left = substr($GLOBALS[$this->varname], 0, $this->position); - $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); - $GLOBALS[$this->varname] = $left . $data . $right; - $this->position += strlen($data); - return strlen($data); - } - - function stream_tell() - { - return $this->position; - } - - function stream_eof() - { - return $this->position >= strlen($GLOBALS[$this->varname]); - } - function stream_seek($offset, $whence) - { - switch ($whence) { - case SEEK_SET: - if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { - $this->position = $offset; - return true; - } else { - return false; - } - break; - - case SEEK_CUR: - if ($offset >= 0) { - $this->position += $offset; - return true; - } else { - return false; - } - break; - - case SEEK_END: - if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { - $this->position = strlen($GLOBALS[$this->varname]) + $offset; - return true; - } else { - return false; - } - break; - - default: - return false; - } - } + var $position; + var $varname; + + function __construct($var = null) { + throw new Exception("constructor"); + } + + function stream_open($path, $mode, $options, &$opened_path) + { + $url = parse_url($path); + $this->varname = $url["host"]; + $this->position = 0; + + return true; + } + + function stream_read($count) + { + $ret = substr($GLOBALS[$this->varname], $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + + function stream_write($data) + { + $left = substr($GLOBALS[$this->varname], 0, $this->position); + $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); + $GLOBALS[$this->varname] = $left . $data . $right; + $this->position += strlen($data); + return strlen($data); + } + + function stream_tell() + { + return $this->position; + } + + function stream_eof() + { + return $this->position >= strlen($GLOBALS[$this->varname]); + } + function stream_seek($offset, $whence) + { + switch ($whence) { + case SEEK_SET: + if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { + $this->position = $offset; + return true; + } else { + return false; + } + break; + + case SEEK_CUR: + if ($offset >= 0) { + $this->position += $offset; + return true; + } else { + return false; + } + break; + + case SEEK_END: + if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { + $this->position = strlen($GLOBALS[$this->varname]) + $offset; + return true; + } else { + return false; + } + break; + + default: + return false; + } + } } stream_wrapper_register("var", "VariableStream") - or die("Failed to register protocol"); + or die("Failed to register protocol"); $myvar = ""; @@ -94,7 +94,7 @@ fwrite($fp, "line3\n"); rewind($fp); while (!feof($fp)) { - echo fgets($fp); + echo fgets($fp); } fclose($fp); var_dump($myvar); diff --git a/ext/standard/tests/file/bug38450_3.phpt b/ext/standard/tests/file/bug38450_3.phpt index 8a5c696587..cbd03e908e 100644 --- a/ext/standard/tests/file/bug38450_3.phpt +++ b/ext/standard/tests/file/bug38450_3.phpt @@ -4,85 +4,85 @@ Bug #38450 (constructor is not called for classes used in userspace stream wrapp <?php class VariableStream { - var $position; - var $varname; - - function __construct(array $var) { - var_dump("constructor!"); - } - - function stream_open($path, $mode, $options, &$opened_path) - { - $url = parse_url($path); - $this->varname = $url["host"]; - $this->position = 0; - - return true; - } - - function stream_read($count) - { - $ret = substr($GLOBALS[$this->varname], $this->position, $count); - $this->position += strlen($ret); - return $ret; - } - - function stream_write($data) - { - $left = substr($GLOBALS[$this->varname], 0, $this->position); - $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); - $GLOBALS[$this->varname] = $left . $data . $right; - $this->position += strlen($data); - return strlen($data); - } - - function stream_tell() - { - return $this->position; - } - - function stream_eof() - { - return $this->position >= strlen($GLOBALS[$this->varname]); - } - function stream_seek($offset, $whence) - { - switch ($whence) { - case SEEK_SET: - if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { - $this->position = $offset; - return true; - } else { - return false; - } - break; - - case SEEK_CUR: - if ($offset >= 0) { - $this->position += $offset; - return true; - } else { - return false; - } - break; - - case SEEK_END: - if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { - $this->position = strlen($GLOBALS[$this->varname]) + $offset; - return true; - } else { - return false; - } - break; - - default: - return false; - } - } + var $position; + var $varname; + + function __construct(array $var) { + var_dump("constructor!"); + } + + function stream_open($path, $mode, $options, &$opened_path) + { + $url = parse_url($path); + $this->varname = $url["host"]; + $this->position = 0; + + return true; + } + + function stream_read($count) + { + $ret = substr($GLOBALS[$this->varname], $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + + function stream_write($data) + { + $left = substr($GLOBALS[$this->varname], 0, $this->position); + $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); + $GLOBALS[$this->varname] = $left . $data . $right; + $this->position += strlen($data); + return strlen($data); + } + + function stream_tell() + { + return $this->position; + } + + function stream_eof() + { + return $this->position >= strlen($GLOBALS[$this->varname]); + } + function stream_seek($offset, $whence) + { + switch ($whence) { + case SEEK_SET: + if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { + $this->position = $offset; + return true; + } else { + return false; + } + break; + + case SEEK_CUR: + if ($offset >= 0) { + $this->position += $offset; + return true; + } else { + return false; + } + break; + + case SEEK_END: + if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { + $this->position = strlen($GLOBALS[$this->varname]) + $offset; + return true; + } else { + return false; + } + break; + + default: + return false; + } + } } stream_wrapper_register("var", "VariableStream") - or die("Failed to register protocol"); + or die("Failed to register protocol"); $myvar = ""; @@ -94,7 +94,7 @@ fwrite($fp, "line3\n"); rewind($fp); while (!feof($fp)) { - echo fgets($fp); + echo fgets($fp); } fclose($fp); var_dump($myvar); diff --git a/ext/standard/tests/file/bug39538.phpt b/ext/standard/tests/file/bug39538.phpt index cdff507b48..5f40192ec9 100644 --- a/ext/standard/tests/file/bug39538.phpt +++ b/ext/standard/tests/file/bug39538.phpt @@ -7,8 +7,8 @@ $content = array("\"\nthis is an test\", \"next data\", \"p\narsed\"","\"\r\nthi $file = __DIR__ . "/bug39538.csv"; @unlink($file); foreach ($content as $v) { - file_put_contents($file, $v); - print_r (fgetcsv(fopen($file, "r"), filesize($file))); + file_put_contents($file, $v); + print_r (fgetcsv(fopen($file, "r"), filesize($file))); } @unlink($file); ?> diff --git a/ext/standard/tests/file/bug39551.phpt b/ext/standard/tests/file/bug39551.phpt index 2877c4951f..c3d011351e 100644 --- a/ext/standard/tests/file/bug39551.phpt +++ b/ext/standard/tests/file/bug39551.phpt @@ -6,12 +6,12 @@ Bug #39551 (Segfault with stream_bucket_new in user filter) $bucket = stream_bucket_new(fopen('php://temp', 'w+'), ''); class bucketFilter { - public function filter($in, $out, &$consumed, $closing ){ + public function filter($in, $out, &$consumed, $closing ){ - $bucket = stream_bucket_new(fopen('php://temp', 'w+'), ''); - stream_bucket_append($out, $bucket); - return PSFS_PASS_ON; - } + $bucket = stream_bucket_new(fopen('php://temp', 'w+'), ''); + stream_bucket_append($out, $bucket); + return PSFS_PASS_ON; + } } stream_filter_register('bucketfault', 'bucketFilter'); diff --git a/ext/standard/tests/file/bug39673.phpt b/ext/standard/tests/file/bug39673.phpt index 70a47e3fc1..64c66cc141 100644 --- a/ext/standard/tests/file/bug39673.phpt +++ b/ext/standard/tests/file/bug39673.phpt @@ -9,20 +9,20 @@ $filename = __DIR__.'/bug39673.txt'; file_put_contents($filename, $str); $offsets = array( - -1, - 0, - 3456*4, - 3456*4 - 1, - 3456*4 + 1, - 2000, - 5000, - 100000, + -1, + 0, + 3456*4, + 3456*4 - 1, + 3456*4 + 1, + 2000, + 5000, + 100000, ); foreach ($offsets as $offset) { - $r = file_get_contents($filename, false, null, $offset); - if ($r !== false) var_dump(strlen($r)); + $r = file_get_contents($filename, false, null, $offset); + if ($r !== false) var_dump(strlen($r)); } @unlink($filename); diff --git a/ext/standard/tests/file/bug41655_2.phpt b/ext/standard/tests/file/bug41655_2.phpt index 20c29844c1..61fdec1054 100644 --- a/ext/standard/tests/file/bug41655_2.phpt +++ b/ext/standard/tests/file/bug41655_2.phpt @@ -4,9 +4,9 @@ Bug #41655 (open_basedir bypass via glob()) 2/2 open_basedir=/ --FILE-- <?php - $dir = __DIR__; - $a=glob($dir . "/test*csv"); - print_r($a); + $dir = __DIR__; + $a=glob($dir . "/test*csv"); + print_r($a); ?> --EXPECTF-- Array diff --git a/ext/standard/tests/file/bug41815.phpt b/ext/standard/tests/file/bug41815.phpt index 58f287cedf..d77d73055b 100644 --- a/ext/standard/tests/file/bug41815.phpt +++ b/ext/standard/tests/file/bug41815.phpt @@ -12,7 +12,7 @@ fread($reader, 1); fwrite($writer, "foo"); if (strlen(fread($reader, 10)) > 0) { - echo "OK\n"; + echo "OK\n"; } fclose($writer); diff --git a/ext/standard/tests/file/bug43008.phpt b/ext/standard/tests/file/bug43008.phpt index 0d9d6ed986..60bea35429 100644 --- a/ext/standard/tests/file/bug43008.phpt +++ b/ext/standard/tests/file/bug43008.phpt @@ -9,12 +9,12 @@ allow_url_fopen=1 --FILE-- <?php $url = "" - . "php://filter/read=" - . urlencode("convert.iconv.ISO-8859-15/UTF-8") - . '|' . urlencode("string.rot13") - . '|' . urlencode("string.rot13") - . '|' . urlencode("convert.iconv.UTF-8/ISO-8859-15") - . "/resource=data://text/plain,foob%E2r"; + . "php://filter/read=" + . urlencode("convert.iconv.ISO-8859-15/UTF-8") + . '|' . urlencode("string.rot13") + . '|' . urlencode("string.rot13") + . '|' . urlencode("convert.iconv.UTF-8/ISO-8859-15") + . "/resource=data://text/plain,foob%E2r"; var_dump(urlencode(file_get_contents($url))); ?> --EXPECTF-- diff --git a/ext/standard/tests/file/bug43137.phpt b/ext/standard/tests/file/bug43137.phpt index 8125445bb0..f0f17895b7 100644 --- a/ext/standard/tests/file/bug43137.phpt +++ b/ext/standard/tests/file/bug43137.phpt @@ -2,16 +2,16 @@ Bug #43137 (rmdir() and rename() do not clear statcache) --FILE-- <?php - $toname = "TO_" . md5(microtime()); - $dirname = "FROM_" . md5(microtime()); + $toname = "TO_" . md5(microtime()); + $dirname = "FROM_" . md5(microtime()); - mkdir($dirname); - var_dump(is_dir($dirname)); // Expected: true - rename($dirname, $toname); - var_dump(is_dir($dirname)); // Expected: false - var_dump(is_dir($toname)); // Expected: true - rmdir($toname); - var_dump(is_dir($toname)); // Expected: false + mkdir($dirname); + var_dump(is_dir($dirname)); // Expected: true + rename($dirname, $toname); + var_dump(is_dir($dirname)); // Expected: false + var_dump(is_dir($toname)); // Expected: true + rmdir($toname); + var_dump(is_dir($toname)); // Expected: false ?> --EXPECT-- bool(true) diff --git a/ext/standard/tests/file/bug43522.phpt b/ext/standard/tests/file/bug43522.phpt index 10e44fc352..185f2c3697 100644 --- a/ext/standard/tests/file/bug43522.phpt +++ b/ext/standard/tests/file/bug43522.phpt @@ -9,10 +9,10 @@ DoTest($fp, 'ZZZ'); // test multi-char delimiter DoTest($fp, "Z"); // test single-char delimiter function DoTest($fp, $delim) { - echo "Delimiter: " . $delim . "\n"; - rewind($fp); - echo "\t" . stream_get_line($fp, 10, $delim) . "\n"; - echo "\t" . stream_get_line($fp, 10, $delim) . "\n"; + echo "Delimiter: " . $delim . "\n"; + rewind($fp); + echo "\t" . stream_get_line($fp, 10, $delim) . "\n"; + echo "\t" . stream_get_line($fp, 10, $delim) . "\n"; } ?> diff --git a/ext/standard/tests/file/bug44034.phpt b/ext/standard/tests/file/bug44034.phpt index 887b9eb08e..2b7e1168c8 100644 --- a/ext/standard/tests/file/bug44034.phpt +++ b/ext/standard/tests/file/bug44034.phpt @@ -11,8 +11,8 @@ $urls[] = "data://text/plain,\r\nfoo\r\nbar\r\n"; $urls[] = "data://text/plain,foo\r\nbar"; foreach($urls as $url) { - echo strtr($url, array("\r" => "\\r", "\n" => "\\n")) . "\n"; - var_dump(file($url, FILE_IGNORE_NEW_LINES)); + echo strtr($url, array("\r" => "\\r", "\n" => "\\n")) . "\n"; + var_dump(file($url, FILE_IGNORE_NEW_LINES)); } ?> --EXPECT-- diff --git a/ext/standard/tests/file/bug44805.phpt b/ext/standard/tests/file/bug44805.phpt index ac4e334f53..0b81be6a06 100644 --- a/ext/standard/tests/file/bug44805.phpt +++ b/ext/standard/tests/file/bug44805.phpt @@ -14,10 +14,10 @@ rename($file1, $file2); echo "reading file 2: "; readfile($file2); if (file_exists($file1)) { - unlink($file1); + unlink($file1); } if (file_exists($file2)) { - unlink($file2); + unlink($file2); } ?> --EXPECT-- diff --git a/ext/standard/tests/file/bug55124.phpt b/ext/standard/tests/file/bug55124.phpt index 7938196dbc..a894ff32e0 100644 --- a/ext/standard/tests/file/bug55124.phpt +++ b/ext/standard/tests/file/bug55124.phpt @@ -6,10 +6,10 @@ $old_dir_path = getcwd(); chdir(__DIR__); mkdir('a/./b', 0755, true); if (is_dir('a/b')) { - rmdir('a/b'); + rmdir('a/b'); } if (is_dir('./a')) { - rmdir('a'); + rmdir('a'); } chdir($old_dir_path); echo "OK"; diff --git a/ext/standard/tests/file/bug60120.phpt b/ext/standard/tests/file/bug60120.phpt index 77ebf086bd..9d964e34cb 100644 --- a/ext/standard/tests/file/bug60120.phpt +++ b/ext/standard/tests/file/bug60120.phpt @@ -14,7 +14,7 @@ error_reporting(E_ALL); $php = getenv('TEST_PHP_EXECUTABLE'); if (!$php) { - die("No php executable defined\n"); + 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')); diff --git a/ext/standard/tests/file/bug63512.phpt b/ext/standard/tests/file/bug63512.phpt index 9277359256..a22ba9f0cf 100644 --- a/ext/standard/tests/file/bug63512.phpt +++ b/ext/standard/tests/file/bug63512.phpt @@ -4,13 +4,13 @@ Fixed bug #63512 (parse_ini_file() with INI_SCANNER_RAW removes quotes from valu <?php $array = parse_ini_string(' - int = 123 - constant = INSTALL_ROOT - quotedString = "string" - a = INSTALL_ROOT "waa" - b = "INSTALL_ROOT" - c = "waa" INSTALL_ROOT - d = INSTALL_ROOT "INSTALL_ROOT"', false, INI_SCANNER_RAW); + int = 123 + constant = INSTALL_ROOT + quotedString = "string" + a = INSTALL_ROOT "waa" + b = "INSTALL_ROOT" + c = "waa" INSTALL_ROOT + d = INSTALL_ROOT "INSTALL_ROOT"', false, INI_SCANNER_RAW); var_dump($array); --EXPECT-- diff --git a/ext/standard/tests/file/bug65701.phpt b/ext/standard/tests/file/bug65701.phpt index c4a356b41b..f70446a17e 100644 --- a/ext/standard/tests/file/bug65701.phpt +++ b/ext/standard/tests/file/bug65701.phpt @@ -7,7 +7,7 @@ Boro Sitnikovski <buritomath@yahoo.com> $file_path = __DIR__ . "/bug65701/"; if (!is_dir($file_path)) { - mkdir($file_path); + mkdir($file_path); } $src = $file_path . '/srcbug65701_file.txt'; diff --git a/ext/standard/tests/file/bug71287.phpt b/ext/standard/tests/file/bug71287.phpt index b7987829b0..f88414f2c2 100644 --- a/ext/standard/tests/file/bug71287.phpt +++ b/ext/standard/tests/file/bug71287.phpt @@ -3,13 +3,13 @@ Bug #71287 (Error message contains hexadecimal instead of decimal number) --FILE-- <?php class Stream { - public function stream_open($path, $mode, $options, $opened_path) { - return true; - } + public function stream_open($path, $mode, $options, $opened_path) { + return true; + } - public function stream_write($data) { - return strlen($data) - 2; - } + public function stream_write($data) { + return strlen($data) - 2; + } } stream_wrapper_register('test', Stream::class); diff --git a/ext/standard/tests/file/bug72035.phpt b/ext/standard/tests/file/bug72035.phpt index 1fd5b5c148..6ed7fe470f 100644 --- a/ext/standard/tests/file/bug72035.phpt +++ b/ext/standard/tests/file/bug72035.phpt @@ -23,9 +23,9 @@ $cmd = "$cgi -n -C $fl"; $desc = array(0 => array("pipe", "r")); $proc = proc_open($cmd, $desc, $pipes, getcwd(), array()); if (is_resource($proc)) { - echo stream_get_contents($pipes[0]); + echo stream_get_contents($pipes[0]); - proc_close($proc); + proc_close($proc); } unlink($fl); diff --git a/ext/standard/tests/file/chmod_basic-win32-mb.phpt b/ext/standard/tests/file/chmod_basic-win32-mb.phpt index 3970504ddb..a3c0b62410 100644 --- a/ext/standard/tests/file/chmod_basic-win32-mb.phpt +++ b/ext/standard/tests/file/chmod_basic-win32-mb.phpt @@ -17,10 +17,10 @@ $fd = fopen($filename, "w+"); fclose($fd); for ($perms_to_set = 0777; $perms_to_set >= 0; $perms_to_set--) { - chmod($filename, $perms_to_set); - $set_perms = (fileperms($filename) & PERMISSIONS_MASK); - clearstatcache(); - printf("Setting mode %o gives mode %o\n", $perms_to_set, $set_perms); + chmod($filename, $perms_to_set); + $set_perms = (fileperms($filename) & PERMISSIONS_MASK); + clearstatcache(); + printf("Setting mode %o gives mode %o\n", $perms_to_set, $set_perms); } var_dump(chmod($filename, 0777)); diff --git a/ext/standard/tests/file/chmod_basic-win32.phpt b/ext/standard/tests/file/chmod_basic-win32.phpt index 31d44c80aa..072f98d644 100644 --- a/ext/standard/tests/file/chmod_basic-win32.phpt +++ b/ext/standard/tests/file/chmod_basic-win32.phpt @@ -17,10 +17,10 @@ $fd = fopen($filename, "w+"); fclose($fd); for ($perms_to_set = 0777; $perms_to_set >= 0; $perms_to_set--) { - chmod($filename, $perms_to_set); - $set_perms = (fileperms($filename) & PERMISSIONS_MASK); - clearstatcache(); - printf("Setting mode %o gives mode %o\n", $perms_to_set, $set_perms); + chmod($filename, $perms_to_set); + $set_perms = (fileperms($filename) & PERMISSIONS_MASK); + clearstatcache(); + printf("Setting mode %o gives mode %o\n", $perms_to_set, $set_perms); } var_dump(chmod($filename, 0777)); diff --git a/ext/standard/tests/file/chmod_basic.phpt b/ext/standard/tests/file/chmod_basic.phpt index fc983074fd..635ea8de79 100644 --- a/ext/standard/tests/file/chmod_basic.phpt +++ b/ext/standard/tests/file/chmod_basic.phpt @@ -17,12 +17,12 @@ $fd = fopen($filename, "w+"); fclose($fd); for ($perms_to_set = 07777; $perms_to_set >= 0; $perms_to_set--) { - chmod($filename, $perms_to_set); - $set_perms = (fileperms($filename) & MODE_MASK); - clearstatcache(); - if ($set_perms != $perms_to_set) { - printf("Error: %o does not match %o\n", $set_perms, $perms_to_set); - } + chmod($filename, $perms_to_set); + $set_perms = (fileperms($filename) & MODE_MASK); + clearstatcache(); + if ($set_perms != $perms_to_set) { + printf("Error: %o does not match %o\n", $set_perms, $perms_to_set); + } } var_dump(chmod($filename, 0777)); diff --git a/ext/standard/tests/file/chmod_variation1.phpt b/ext/standard/tests/file/chmod_variation1.phpt index 935d30ce55..f89c70fa5d 100644 --- a/ext/standard/tests/file/chmod_variation1.phpt +++ b/ext/standard/tests/file/chmod_variation1.phpt @@ -15,12 +15,12 @@ $dirname = __DIR__ . "/" . basename(__FILE__, ".php") . "testdir"; mkdir($dirname); for ($perms_to_set = 0777; $perms_to_set >= 0; $perms_to_set--) { - chmod($dirname, $perms_to_set); - $set_perms = (fileperms($dirname) & PERMISSIONS_MASK); - clearstatcache(); - if ($set_perms != $perms_to_set) { - printf("Error: %o does not match %o\n", $set_perms, $perms_to_set); - } + chmod($dirname, $perms_to_set); + $set_perms = (fileperms($dirname) & PERMISSIONS_MASK); + clearstatcache(); + if ($set_perms != $perms_to_set) { + printf("Error: %o does not match %o\n", $set_perms, $perms_to_set); + } } var_dump(chmod($dirname, 0777)); diff --git a/ext/standard/tests/file/dirname_basic-win32.phpt b/ext/standard/tests/file/dirname_basic-win32.phpt index f596f9a359..1ae436d1e1 100644 --- a/ext/standard/tests/file/dirname_basic-win32.phpt +++ b/ext/standard/tests/file/dirname_basic-win32.phpt @@ -20,40 +20,40 @@ echo "*** Testing dirname() : basic functionality ***\n"; // Initialise all required variables $paths = array( - '', - ' ', - 'c:', - 'c:\\', - 'c:/', - 'afile', - 'c:\test\afile', - 'c:\\test\\afile', - 'c://test//afile', - 'c:\test\afile\\', - '/usr/lib/locale/en_US', - '//usr/lib//locale/en_US', - '\\', - '\\\\', - '/', - '//', - '///', - '/usr/lib/locale/en_US/', - 'c:\windows/system32\drivers/etc\hosts', - '/usr\lib/locale\en_US', - ' c:\test\adir\afile.txt', - 'c:\test\adir\afile.txt ', - ' c:\test\adir\afile.txt ', - ' /usr/lib/locale/en_US', - '/usr/lib/locale/en_US ', - ' /usr/lib/locale/en_US ', - ' c:', - ' c:\test\adir\afile.txt', - '/usr', - '/usr/', - ); + '', + ' ', + 'c:', + 'c:\\', + 'c:/', + 'afile', + 'c:\test\afile', + 'c:\\test\\afile', + 'c://test//afile', + 'c:\test\afile\\', + '/usr/lib/locale/en_US', + '//usr/lib//locale/en_US', + '\\', + '\\\\', + '/', + '//', + '///', + '/usr/lib/locale/en_US/', + 'c:\windows/system32\drivers/etc\hosts', + '/usr\lib/locale\en_US', + ' c:\test\adir\afile.txt', + 'c:\test\adir\afile.txt ', + ' c:\test\adir\afile.txt ', + ' /usr/lib/locale/en_US', + '/usr/lib/locale/en_US ', + ' /usr/lib/locale/en_US ', + ' c:', + ' c:\test\adir\afile.txt', + '/usr', + '/usr/', + ); foreach ($paths as $path) { - var_dump( dirname($path) ); + var_dump( dirname($path) ); } ?> diff --git a/ext/standard/tests/file/dirname_basic.phpt b/ext/standard/tests/file/dirname_basic.phpt index 774192830a..75355a7135 100644 --- a/ext/standard/tests/file/dirname_basic.phpt +++ b/ext/standard/tests/file/dirname_basic.phpt @@ -20,40 +20,40 @@ echo "*** Testing dirname() : basic functionality ***\n"; // Initialise all required variables $paths = array( - '', - ' ', - 'c:', - 'c:\\', - 'c:/', - 'afile', - 'c:\test\afile', - 'c:\\test\\afile', - 'c://test//afile', - 'c:\test\afile\\', - '/usr/lib/locale/en_US', - '//usr/lib//locale/en_US', - '\\', - '\\\\', - '/', - '//', - '///', - '/usr/lib/locale/en_US/', - 'c:\windows/system32\drivers/etc\hosts', - '/usr\lib/locale\en_US', - ' c:\test\adir\afile.txt', - 'c:\test\adir\afile.txt ', - ' c:\test\adir\afile.txt ', - ' /usr/lib/locale/en_US', - '/usr/lib/locale/en_US ', - ' /usr/lib/locale/en_US ', - ' c:', - ' c:\test\adir\afile.txt', - '/usr', - '/usr/' - ); + '', + ' ', + 'c:', + 'c:\\', + 'c:/', + 'afile', + 'c:\test\afile', + 'c:\\test\\afile', + 'c://test//afile', + 'c:\test\afile\\', + '/usr/lib/locale/en_US', + '//usr/lib//locale/en_US', + '\\', + '\\\\', + '/', + '//', + '///', + '/usr/lib/locale/en_US/', + 'c:\windows/system32\drivers/etc\hosts', + '/usr\lib/locale\en_US', + ' c:\test\adir\afile.txt', + 'c:\test\adir\afile.txt ', + ' c:\test\adir\afile.txt ', + ' /usr/lib/locale/en_US', + '/usr/lib/locale/en_US ', + ' /usr/lib/locale/en_US ', + ' c:', + ' c:\test\adir\afile.txt', + '/usr', + '/usr/' + ); foreach ($paths as $path) { - var_dump( dirname($path) ); + var_dump( dirname($path) ); } ?> diff --git a/ext/standard/tests/file/dirname_no_path_normalization-win32.phpt b/ext/standard/tests/file/dirname_no_path_normalization-win32.phpt index 6098ca2694..cde1e92e24 100644 --- a/ext/standard/tests/file/dirname_no_path_normalization-win32.phpt +++ b/ext/standard/tests/file/dirname_no_path_normalization-win32.phpt @@ -10,15 +10,15 @@ if(substr(PHP_OS, 0, 3) != "WIN") $s = '/php_sanity/sanity.php?'; while (dirname($s) == "/php_sanity" && strlen($s) < 10000) { - $s .= str_repeat('X', 250); + $s .= str_repeat('X', 250); } if (strlen($s) >= 10000) { - echo "OK\n"; + echo "OK\n"; } else { - print "ERROR: " . PHP_EOL; - var_dump(dirname($s)); - var_dump(strlen($s)); + print "ERROR: " . PHP_EOL; + var_dump(dirname($s)); + var_dump(strlen($s)); } ?> --EXPECT-- diff --git a/ext/standard/tests/file/fflush_basic.phpt b/ext/standard/tests/file/fflush_basic.phpt index 2c9314394b..854a23db45 100644 --- a/ext/standard/tests/file/fflush_basic.phpt +++ b/ext/standard/tests/file/fflush_basic.phpt @@ -22,7 +22,7 @@ if($file_handle == false) exit("Error:failed to open file $filename"); if(substr(PHP_OS, 0, 3) == "WIN") { - $data = str_replace("\r",'', $data); + $data = str_replace("\r",'', $data); } // writing data to the file diff --git a/ext/standard/tests/file/fgetcsv.phpt b/ext/standard/tests/file/fgetcsv.phpt index 7a6d7d59db..17ac19ca60 100644 --- a/ext/standard/tests/file/fgetcsv.phpt +++ b/ext/standard/tests/file/fgetcsv.phpt @@ -2,39 +2,39 @@ various fgetcsv() functionality tests --FILE-- <?php - $list = array( - 'aaa,bbb', - 'aaa,"bbb"', - '"aaa","bbb"', - 'aaa,bbb', - '"aaa",bbb', - '"aaa", "bbb"', - ',', - 'aaa,', - ',"aaa"', - '"",""', - '"\\"","aaa"', - '"""""",', - '""""",aaa', - '"\\""",aaa', - 'aaa,"\\"bbb,ccc', - 'aaa,bbb ', - 'aaa,"bbb "', - 'aaa"aaa","bbb"bbb', - 'aaa"aaa""",bbb', - 'aaa"\\"a","bbb"' - ); + $list = array( + 'aaa,bbb', + 'aaa,"bbb"', + '"aaa","bbb"', + 'aaa,bbb', + '"aaa",bbb', + '"aaa", "bbb"', + ',', + 'aaa,', + ',"aaa"', + '"",""', + '"\\"","aaa"', + '"""""",', + '""""",aaa', + '"\\""",aaa', + 'aaa,"\\"bbb,ccc', + 'aaa,bbb ', + 'aaa,"bbb "', + 'aaa"aaa","bbb"bbb', + 'aaa"aaa""",bbb', + 'aaa"\\"a","bbb"' + ); - $file = __DIR__ . '/fgetcsv.csv'; - @unlink($file); - foreach ($list as $v) { - $fp = fopen($file, "w"); - fwrite($fp, $v . "\n"); - fclose($fp); + $file = __DIR__ . '/fgetcsv.csv'; + @unlink($file); + foreach ($list as $v) { + $fp = fopen($file, "w"); + fwrite($fp, $v . "\n"); + fclose($fp); - var_dump(fgetcsv(fopen($file, "r"), 1024)); - } - @unlink($file); + var_dump(fgetcsv(fopen($file, "r"), 1024)); + } + @unlink($file); ?> --EXPECT-- array(2) { diff --git a/ext/standard/tests/file/fgets_socket_variation1.phpt b/ext/standard/tests/file/fgets_socket_variation1.phpt index 429ad67d69..ac1086ef56 100644 --- a/ext/standard/tests/file/fgets_socket_variation1.phpt +++ b/ext/standard/tests/file/fgets_socket_variation1.phpt @@ -18,7 +18,7 @@ for ($i=0; $i<100; $i++) { $client = fsockopen("tcp://127.0.0.1:$port"); if (!$client) { - die("Unable to create socket"); + die("Unable to create socket"); } /* Accept that connection */ @@ -38,7 +38,7 @@ echo "\n\nClose the server side socket and read the remaining data from the clie fclose($socket); fclose($server); while(!feof($client)) { - fread($client, 1); + fread($client, 1); } echo "done\n"; diff --git a/ext/standard/tests/file/fgets_socket_variation2.phpt b/ext/standard/tests/file/fgets_socket_variation2.phpt index da1f0b47ad..88fbbd45b9 100644 --- a/ext/standard/tests/file/fgets_socket_variation2.phpt +++ b/ext/standard/tests/file/fgets_socket_variation2.phpt @@ -12,7 +12,7 @@ $fd = fopen($filename, "w+"); // populate the file with lines of data define("LINE_OF_DATA", "12345678\n"); for ($i = 0; $i < 1000; $i++) { - fwrite($fd, LINE_OF_DATA); + fwrite($fd, LINE_OF_DATA); } fclose($fd); @@ -29,7 +29,7 @@ for ($i=0; $i<100; $i++) { $client = fsockopen("tcp://127.0.0.1:$port"); if (!$client) { - die("Unable to create socket"); + die("Unable to create socket"); } /* Accept that connection */ @@ -44,16 +44,16 @@ fclose($socket); echo "\nRead lines from the client\n"; while ($line = fgets($client,256)) { - if (strcmp($line, LINE_OF_DATA) != 0) { - echo "Error - $line does not match " . LINE_OF_DATA; - break; - } + if (strcmp($line, LINE_OF_DATA) != 0) { + echo "Error - $line does not match " . LINE_OF_DATA; + break; + } } echo "\nClose the server side socket and read the remaining data from the client\n"; fclose($server); while(!feof($client)) { - fread($client, 1); + fread($client, 1); } echo "done\n"; diff --git a/ext/standard/tests/file/file.inc b/ext/standard/tests/file/file.inc index aaa151ac0d..08825f4502 100644 --- a/ext/standard/tests/file/file.inc +++ b/ext/standard/tests/file/file.inc @@ -309,7 +309,7 @@ function create_files( $file_path, /* Function: function create_links( $file_path, - $filename, + $filename, $link_count = 1, $link_type = "soft", $link_size = 1024, diff --git a/ext/standard/tests/file/file_get_contents_basic001.phpt b/ext/standard/tests/file/file_get_contents_basic001.phpt index 86569d7917..d54bf2bcb4 100644 --- a/ext/standard/tests/file/file_get_contents_basic001.phpt +++ b/ext/standard/tests/file/file_get_contents_basic001.phpt @@ -4,13 +4,13 @@ file_get_contents() test using basic syntax "Blanche V.N." <valerie_nare@yahoo.fr> --FILE-- <?php - $file_content = "Bienvenue au CodeFest a Montreal"; - $temp_filename = __DIR__."/fichier_a_lire.txt"; - $handle = fopen($temp_filename,"w"); - fwrite($handle,$file_content); - fclose($handle); - $var = file_get_contents($temp_filename); - echo $var; + $file_content = "Bienvenue au CodeFest a Montreal"; + $temp_filename = __DIR__."/fichier_a_lire.txt"; + $handle = fopen($temp_filename,"w"); + fwrite($handle,$file_content); + fclose($handle); + $var = file_get_contents($temp_filename); + echo $var; ?> --CLEAN-- <?php diff --git a/ext/standard/tests/file/file_get_contents_error001.phpt b/ext/standard/tests/file/file_get_contents_error001.phpt index 45c376b913..0bbce038e6 100644 --- a/ext/standard/tests/file/file_get_contents_error001.phpt +++ b/ext/standard/tests/file/file_get_contents_error001.phpt @@ -11,7 +11,7 @@ display_errors=false ?> --FILE-- <?php - var_dump(file_get_contents("php://stdin",null,null,8000,1)); + var_dump(file_get_contents("php://stdin",null,null,8000,1)); ?> --EXPECT-- bool(false) diff --git a/ext/standard/tests/file/file_put_contents_variation2.phpt b/ext/standard/tests/file/file_put_contents_variation2.phpt index 279291f2cf..098ed37589 100644 --- a/ext/standard/tests/file/file_put_contents_variation2.phpt +++ b/ext/standard/tests/file/file_put_contents_variation2.phpt @@ -14,10 +14,10 @@ echo "*** Testing file_put_contents() : usage variation ***\n"; // Define error handler function test_error_handler($err_no, $err_msg, $filename, $linenum) { - if (error_reporting() & $err_no) { - // report non-silenced errors - echo "Error: $err_no - $err_msg\n"; - } + if (error_reporting() & $err_no) { + // report non-silenced errors + echo "Error: $err_no - $err_msg\n"; + } } set_error_handler('test_error_handler'); @@ -34,9 +34,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/file/file_variation6.phpt b/ext/standard/tests/file/file_variation6.phpt index b8078d2bd1..e5d8b6d51a 100644 --- a/ext/standard/tests/file/file_variation6.phpt +++ b/ext/standard/tests/file/file_variation6.phpt @@ -10,7 +10,7 @@ fclose($fd); for ($flags = 0; $flags <= 32; $flags++) { try { - var_dump(file($filepath, $flags)); + var_dump(file($filepath, $flags)); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } diff --git a/ext/standard/tests/file/file_variation9.phpt b/ext/standard/tests/file/file_variation9.phpt index 13860878d9..39f58aa788 100644 --- a/ext/standard/tests/file/file_variation9.phpt +++ b/ext/standard/tests/file/file_variation9.phpt @@ -27,7 +27,7 @@ foreach ($contents as $content) { fwrite($h, $content); fclose($h); var_dump(file($testfile)); - unlink($testfile); + unlink($testfile); } echo "\n*** Done ***\n"; diff --git a/ext/standard/tests/file/fopen_include_path.inc b/ext/standard/tests/file/fopen_include_path.inc index e33dae4915..160f9aee5f 100644 --- a/ext/standard/tests/file/fopen_include_path.inc +++ b/ext/standard/tests/file/fopen_include_path.inc @@ -11,82 +11,82 @@ $newdirs = array($dir1, $dir2, $dir3); $reldirs = array("dir1", "dir2", "dir3"); function generate_next_rel_path() { - global $reldirs; - //create the include directory structure - $pathSep = ":"; - $newIncludePath = ""; - if(substr(PHP_OS, 0, 3) == 'WIN' ) { - $pathSep = ";"; - } - foreach($reldirs as $newdir) { - $newIncludePath .= $newdir.$pathSep; - } - return "dir4".$pathSep . $newIncludePath; + global $reldirs; + //create the include directory structure + $pathSep = ":"; + $newIncludePath = ""; + if(substr(PHP_OS, 0, 3) == 'WIN' ) { + $pathSep = ";"; + } + foreach($reldirs as $newdir) { + $newIncludePath .= $newdir.$pathSep; + } + return "dir4".$pathSep . $newIncludePath; } function generate_next_path() { - global $newdirs, $dir4; - //create the include directory structure - $pathSep = ":"; - $newIncludePath = ""; - if(substr(PHP_OS, 0, 3) == 'WIN' ) { - $pathSep = ";"; - } - foreach($newdirs as $newdir) { - $newIncludePath .= $newdir.$pathSep; - } - return $dir4.$pathSep . $newIncludePath; + global $newdirs, $dir4; + //create the include directory structure + $pathSep = ":"; + $newIncludePath = ""; + if(substr(PHP_OS, 0, 3) == 'WIN' ) { + $pathSep = ";"; + } + foreach($newdirs as $newdir) { + $newIncludePath .= $newdir.$pathSep; + } + return $dir4.$pathSep . $newIncludePath; } function create_include_path() { - global $newdirs; - //create the include directory structure - $pathSep = ":"; - $newIncludePath = ""; - if(substr(PHP_OS, 0, 3) == 'WIN' ) { - $pathSep = ";"; - } - foreach($newdirs as $newdir) { - mkdir($newdir); - $newIncludePath .= $newdir.$pathSep; - } - return $newIncludePath; + global $newdirs; + //create the include directory structure + $pathSep = ":"; + $newIncludePath = ""; + if(substr(PHP_OS, 0, 3) == 'WIN' ) { + $pathSep = ";"; + } + foreach($newdirs as $newdir) { + mkdir($newdir); + $newIncludePath .= $newdir.$pathSep; + } + return $newIncludePath; } function relative_include_path() { - global $reldirs; - //create the include directory structure - $pathSep = ":"; - $newIncludePath = ""; - if(substr(PHP_OS, 0, 3) == 'WIN' ) { - $pathSep = ";"; - } - foreach($reldirs as $newdir) { - mkdir($newdir); - $newIncludePath .= $newdir.$pathSep; - } - return $newIncludePath; + global $reldirs; + //create the include directory structure + $pathSep = ":"; + $newIncludePath = ""; + if(substr(PHP_OS, 0, 3) == 'WIN' ) { + $pathSep = ";"; + } + foreach($reldirs as $newdir) { + mkdir($newdir); + $newIncludePath .= $newdir.$pathSep; + } + return $newIncludePath; } function teardown_include_path() { - global $newdirs; - // remove the directory structure - foreach($newdirs as $newdir) { - rmdir($newdir); - } + global $newdirs; + // remove the directory structure + foreach($newdirs as $newdir) { + rmdir($newdir); + } } function teardown_relative_path() { - global $reldirs; - // remove the directory structure - foreach($reldirs as $newdir) { - rmdir($newdir); - } + global $reldirs; + // remove the directory structure + foreach($reldirs as $newdir) { + rmdir($newdir); + } } ?> diff --git a/ext/standard/tests/file/fopen_unlink.phpt b/ext/standard/tests/file/fopen_unlink.phpt index c87a8bb055..8e66ae0608 100644 --- a/ext/standard/tests/file/fopen_unlink.phpt +++ b/ext/standard/tests/file/fopen_unlink.phpt @@ -4,17 +4,17 @@ Test fopen() function : check fopen()ed descriptor is usable after the fs object <?php var_dump( - $p = __DIR__ . DIRECTORY_SEPARATOR . 'tututu', - $f = fopen($p, 'w+'), - unlink($p), - file_exists($p), - fwrite($f, 'hello'), - fseek($f, 0), - fread($f, 16), - fwrite($f, 'world'), - fseek($f, 0), - fread($f, 16), - fclose($f) + $p = __DIR__ . DIRECTORY_SEPARATOR . 'tututu', + $f = fopen($p, 'w+'), + unlink($p), + file_exists($p), + fwrite($f, 'hello'), + fseek($f, 0), + fread($f, 16), + fwrite($f, 'world'), + fseek($f, 0), + fread($f, 16), + fclose($f) ); ?> diff --git a/ext/standard/tests/file/fopen_variation12.phpt b/ext/standard/tests/file/fopen_variation12.phpt index 8786337e23..1ac67df048 100644 --- a/ext/standard/tests/file/fopen_variation12.phpt +++ b/ext/standard/tests/file/fopen_variation12.phpt @@ -15,33 +15,33 @@ testme(); function testme() { - $tmpfile = basename(__FILE__, ".php") . ".tmp"; - $h = fopen($tmpfile, "w", true); - fwrite($h, "This is the test file"); - fclose($h); + $tmpfile = basename(__FILE__, ".php") . ".tmp"; + $h = fopen($tmpfile, "w", true); + fwrite($h, "This is the test file"); + fclose($h); - $h = @fopen($tmpfile, "r"); - if ($h === false) { - echo "Not created in working dir\n"; - } - else { - echo "created in working dir\n"; - fclose($h); - unlink($tmpfile); - } + $h = @fopen($tmpfile, "r"); + if ($h === false) { + echo "Not created in working dir\n"; + } + else { + echo "created in working dir\n"; + fclose($h); + unlink($tmpfile); + } - $scriptDirFile = __DIR__.'/'.$tmpfile; - $h = @fopen($scriptDirFile, "r"); - if ($h === false) { - echo "Not created in script dir\n"; - } - else { - echo "created in script dir\n"; - fclose($h); - unlink($scriptDirFile); - } + $scriptDirFile = __DIR__.'/'.$tmpfile; + $h = @fopen($scriptDirFile, "r"); + if ($h === false) { + echo "Not created in script dir\n"; + } + else { + echo "created in script dir\n"; + fclose($h); + unlink($scriptDirFile); + } } ?> --EXPECT-- diff --git a/ext/standard/tests/file/fopen_variation13.phpt b/ext/standard/tests/file/fopen_variation13.phpt index 0609f42d3b..0c446485a3 100644 --- a/ext/standard/tests/file/fopen_variation13.phpt +++ b/ext/standard/tests/file/fopen_variation13.phpt @@ -25,23 +25,23 @@ teardown_include_path(); function runtest() { $tempDir = 'fopen_variation13.dir.tmp'; - $tmpfile = 'fopen_variation13.tmp'; - $absFile = getcwd().'/'.$tempDir.'/'.$tmpfile; - - mkdir($tempDir); - $h = fopen($absFile, "w", true); - fwrite($h, "This is the test file"); - fclose($h); - - - $h = fopen($absFile, "r"); - if ($h === false) { - echo "Not created absolute location\n"; - } - else { - echo "Created in correct location\n"; - fclose($h); - } + $tmpfile = 'fopen_variation13.tmp'; + $absFile = getcwd().'/'.$tempDir.'/'.$tmpfile; + + mkdir($tempDir); + $h = fopen($absFile, "w", true); + fwrite($h, "This is the test file"); + fclose($h); + + + $h = fopen($absFile, "r"); + if ($h === false) { + echo "Not created absolute location\n"; + } + else { + echo "Created in correct location\n"; + fclose($h); + } unlink($absFile); rmdir($tempDir); diff --git a/ext/standard/tests/file/fopen_variation14-win32.phpt b/ext/standard/tests/file/fopen_variation14-win32.phpt index 470a2efd1e..f989e8c420 100644 --- a/ext/standard/tests/file/fopen_variation14-win32.phpt +++ b/ext/standard/tests/file/fopen_variation14-win32.phpt @@ -78,21 +78,21 @@ function runtest($fileURIs) { // create the file to test write $h = fopen($fileURI, 'w'); if ($h !== false) { - fwrite($h, $writeData); - fclose($h); - - $h = fopen($absFile, 'r'); - if ($h !== false) { - if (fread($h, 4096) != $writeData) { - echo "contents not correct\n"; - } - else { - echo "test passed\n"; - } - fclose($h); - } - unlink($absFile); - } + fwrite($h, $writeData); + fclose($h); + + $h = fopen($absFile, 'r'); + if ($h !== false) { + if (fread($h, 4096) != $writeData) { + echo "contents not correct\n"; + } + else { + echo "test passed\n"; + } + fclose($h); + } + unlink($absFile); + } } } diff --git a/ext/standard/tests/file/fopen_variation14.phpt b/ext/standard/tests/file/fopen_variation14.phpt index df9f115d14..fc98194d34 100644 --- a/ext/standard/tests/file/fopen_variation14.phpt +++ b/ext/standard/tests/file/fopen_variation14.phpt @@ -70,21 +70,21 @@ function runtest($fileURIs) { // create the file to test write $h = fopen($fileURI, 'w'); if ($h !== false) { - fwrite($h, $writeData); - fclose($h); - - $h = fopen($absFile, 'r'); - if ($h !== false) { - if (fread($h, 4096) != $writeData) { - echo "contents not correct\n"; - } - else { - echo "test passed\n"; - } - fclose($h); - } - unlink($absFile); - } + fwrite($h, $writeData); + fclose($h); + + $h = fopen($absFile, 'r'); + if ($h !== false) { + if (fread($h, 4096) != $writeData) { + echo "contents not correct\n"; + } + else { + echo "test passed\n"; + } + fclose($h); + } + unlink($absFile); + } } } diff --git a/ext/standard/tests/file/fopen_variation15-win32.phpt b/ext/standard/tests/file/fopen_variation15-win32.phpt index 9daac25c00..f263b1b393 100644 --- a/ext/standard/tests/file/fopen_variation15-win32.phpt +++ b/ext/standard/tests/file/fopen_variation15-win32.phpt @@ -82,21 +82,21 @@ function runtest($fileURIs) { // create the file to test write $h = fopen($fileURI, 'w', true); if ($h !== false) { - fwrite($h, $writeData); - fclose($h); - - $h = fopen($absFile, 'r'); - if ($h !== false) { - if (fread($h, 4096) != $writeData) { - echo "contents not correct\n"; - } - else { - echo "test passed\n"; - } - fclose($h); - } - unlink($absFile); - } + fwrite($h, $writeData); + fclose($h); + + $h = fopen($absFile, 'r'); + if ($h !== false) { + if (fread($h, 4096) != $writeData) { + echo "contents not correct\n"; + } + else { + echo "test passed\n"; + } + fclose($h); + } + unlink($absFile); + } } } diff --git a/ext/standard/tests/file/fopen_variation15.phpt b/ext/standard/tests/file/fopen_variation15.phpt index 36b1455250..a86b7d9642 100644 --- a/ext/standard/tests/file/fopen_variation15.phpt +++ b/ext/standard/tests/file/fopen_variation15.phpt @@ -74,21 +74,21 @@ function runtest($fileURIs) { // create the file to test write $h = fopen($fileURI, 'w', true); if ($h !== false) { - fwrite($h, $writeData); - fclose($h); - - $h = fopen($absFile, 'r'); - if ($h !== false) { - if (fread($h, 4096) != $writeData) { - echo "contents not correct\n"; - } - else { - echo "test passed\n"; - } - fclose($h); - } - unlink($absFile); - } + fwrite($h, $writeData); + fclose($h); + + $h = fopen($absFile, 'r'); + if ($h !== false) { + if (fread($h, 4096) != $writeData) { + echo "contents not correct\n"; + } + else { + echo "test passed\n"; + } + fclose($h); + } + unlink($absFile); + } } } diff --git a/ext/standard/tests/file/fopen_variation16.phpt b/ext/standard/tests/file/fopen_variation16.phpt index 6fe240bec9..fa2fc02682 100644 --- a/ext/standard/tests/file/fopen_variation16.phpt +++ b/ext/standard/tests/file/fopen_variation16.phpt @@ -36,31 +36,31 @@ function runtest() { mkdir($dir1.'/'.$extraDir); mkdir($extraDir); - $tmpfile = $extraDir.'/fopen_variation16.tmp'; + $tmpfile = $extraDir.'/fopen_variation16.tmp'; - $h = fopen($tmpfile, "w+", true); - fwrite($h, "This is the test file"); - fclose($h); + $h = fopen($tmpfile, "w+", true); + fwrite($h, "This is the test file"); + fclose($h); - $h = @fopen($dir1.'/'.$tmpfile, "r"); - if ($h === false) { - echo "Not created in dir1\n"; - } - else { - echo "created in dir1\n"; - fclose($h); - } + $h = @fopen($dir1.'/'.$tmpfile, "r"); + if ($h === false) { + echo "Not created in dir1\n"; + } + else { + echo "created in dir1\n"; + fclose($h); + } - $h = fopen($tmpfile, "r", true); - if ($h === false) { - echo "could not find file for reading\n"; - } - else { - echo "found file - not in dir1\n"; - fclose($h); - } + $h = fopen($tmpfile, "r", true); + if ($h === false) { + echo "could not find file for reading\n"; + } + else { + echo "found file - not in dir1\n"; + fclose($h); + } - unlink($tmpfile); + unlink($tmpfile); rmdir($dir1.'/'.$extraDir); rmdir($extraDir); } diff --git a/ext/standard/tests/file/fopen_variation17.phpt b/ext/standard/tests/file/fopen_variation17.phpt index 851493eb08..9565cf614c 100644 --- a/ext/standard/tests/file/fopen_variation17.phpt +++ b/ext/standard/tests/file/fopen_variation17.phpt @@ -36,30 +36,30 @@ function runtest() { mkdir($dir1.'/'.$extraDir); mkdir($extraDir); - $tmpfile = $extraDir . '/' . basename(__FILE__, ".php") . ".tmp"; - $h = fopen($tmpfile, "w+", true); - fwrite($h, "This is the test file"); - fclose($h); + $tmpfile = $extraDir . '/' . basename(__FILE__, ".php") . ".tmp"; + $h = fopen($tmpfile, "w+", true); + fwrite($h, "This is the test file"); + fclose($h); - $h = @fopen($dir1.'/'.$tmpfile, "r"); - if ($h === false) { - echo "Not created in dir1\n"; - } - else { - echo "created in dir1\n"; - fclose($h); - } + $h = @fopen($dir1.'/'.$tmpfile, "r"); + if ($h === false) { + echo "Not created in dir1\n"; + } + else { + echo "created in dir1\n"; + fclose($h); + } - $h = fopen($tmpfile, "r", true); - if ($h === false) { - echo "could not find file for reading\n"; - } - else { - echo "found file for reading\n"; - fclose($h); - } + $h = fopen($tmpfile, "r", true); + if ($h === false) { + echo "could not find file for reading\n"; + } + else { + echo "found file for reading\n"; + fclose($h); + } - unlink($tmpfile); + unlink($tmpfile); rmdir($dir1.'/'.$extraDir); rmdir($extraDir); } diff --git a/ext/standard/tests/file/fopen_variation7.phpt b/ext/standard/tests/file/fopen_variation7.phpt index c4800ae9b2..2a1e0268bc 100644 --- a/ext/standard/tests/file/fopen_variation7.phpt +++ b/ext/standard/tests/file/fopen_variation7.phpt @@ -29,31 +29,31 @@ rmdir($thisTestDir); function runtest() { global $dir1; - $tmpfile = basename(__FILE__, ".php") . ".tmp"; - $h = fopen($tmpfile, "w", true); - fwrite($h, "This is the test file"); - fclose($h); - - - $h = @fopen($tmpfile, "r"); - if ($h === false) { - echo "Not created in working dir\n"; - } - else { - echo "created in working dir\n"; - fclose($h); - unlink($tmpfile); - } - - $h = @fopen($dir1.'/'.$tmpfile, "r"); - if ($h === false) { - echo "Not created in dir1\n"; - } - else { - echo "created in dir1\n"; - fclose($h); - unlink($dir1.'/'.$tmpfile); - } + $tmpfile = basename(__FILE__, ".php") . ".tmp"; + $h = fopen($tmpfile, "w", true); + fwrite($h, "This is the test file"); + fclose($h); + + + $h = @fopen($tmpfile, "r"); + if ($h === false) { + echo "Not created in working dir\n"; + } + else { + echo "created in working dir\n"; + fclose($h); + unlink($tmpfile); + } + + $h = @fopen($dir1.'/'.$tmpfile, "r"); + if ($h === false) { + echo "Not created in dir1\n"; + } + else { + echo "created in dir1\n"; + fclose($h); + unlink($dir1.'/'.$tmpfile); + } } ?> --EXPECT-- diff --git a/ext/standard/tests/file/fopen_variation9.phpt b/ext/standard/tests/file/fopen_variation9.phpt index 0f1c2bafb8..850bf138d6 100644 --- a/ext/standard/tests/file/fopen_variation9.phpt +++ b/ext/standard/tests/file/fopen_variation9.phpt @@ -29,31 +29,31 @@ chdir(".."); rmdir($thisTestDir); function runtest() { - $tmpfile = basename(__FILE__, ".php") . ".tmp"; - $h = fopen($tmpfile, "w", true); - fwrite($h, "This is the test file"); - fclose($h); - - - $h = @fopen($tmpfile, "r"); - if ($h === false) { - echo "Not created in working dir\n"; - } - else { - echo "created in working dir\n"; - fclose($h); - unlink($tmpfile); - } - - $h = @fopen('dir1/'.$tmpfile, "r"); - if ($h === false) { - echo "Not created in dir1\n"; - } - else { - echo "created in dir1\n"; - fclose($h); - unlink('dir1/'.$tmpfile); - } + $tmpfile = basename(__FILE__, ".php") . ".tmp"; + $h = fopen($tmpfile, "w", true); + fwrite($h, "This is the test file"); + fclose($h); + + + $h = @fopen($tmpfile, "r"); + if ($h === false) { + echo "Not created in working dir\n"; + } + else { + echo "created in working dir\n"; + fclose($h); + unlink($tmpfile); + } + + $h = @fopen('dir1/'.$tmpfile, "r"); + if ($h === false) { + echo "Not created in dir1\n"; + } + else { + echo "created in dir1\n"; + fclose($h); + unlink('dir1/'.$tmpfile); + } } ?> --EXPECT-- diff --git a/ext/standard/tests/file/fopencookie.phpt b/ext/standard/tests/file/fopencookie.phpt index 20fd181cbd..03c9a84cd4 100644 --- a/ext/standard/tests/file/fopencookie.phpt +++ b/ext/standard/tests/file/fopencookie.phpt @@ -17,68 +17,68 @@ fopencookie detected and working (or cast mechanism works) */ class userstream { - public $position = 0; - public $data = "If you can read this, it worked"; + public $position = 0; + public $data = "If you can read this, it worked"; - function stream_open($path, $mode, $options, &$opened_path) - { - return true; - } + function stream_open($path, $mode, $options, &$opened_path) + { + return true; + } - function stream_read($count) - { - $ret = substr($this->data, $this->position, $count); - $this->position += strlen($ret); - return $ret; - } + function stream_read($count) + { + $ret = substr($this->data, $this->position, $count); + $this->position += strlen($ret); + return $ret; + } - function stream_tell() - { - return $this->position; - } + function stream_tell() + { + return $this->position; + } - function stream_eof() - { - return $this->position >= strlen($this->data); - } + function stream_eof() + { + return $this->position >= strlen($this->data); + } - function stream_seek($offset, $whence) - { - switch($whence) { - case SEEK_SET: - if ($offset < strlen($this->data) && $offset >= 0) { - $this->position = $offset; - return true; - } else { - return false; - } - break; - case SEEK_CUR: - if ($offset >= 0) { - $this->position += $offset; - return true; - } else { - return false; - } - break; - case SEEK_END: - if (strlen($this->data) + $offset >= 0) { - $this->position = strlen($this->data) + $offset; - return true; - } else { - return false; - } - break; - default: - return false; - } - } - function stream_stat() { - return array('size' => strlen($this->data)); - } - function stream_set_option($option, $arg1, $arg2) { - return false; - } + function stream_seek($offset, $whence) + { + switch($whence) { + case SEEK_SET: + if ($offset < strlen($this->data) && $offset >= 0) { + $this->position = $offset; + return true; + } else { + return false; + } + break; + case SEEK_CUR: + if ($offset >= 0) { + $this->position += $offset; + return true; + } else { + return false; + } + break; + case SEEK_END: + if (strlen($this->data) + $offset >= 0) { + $this->position = strlen($this->data) + $offset; + return true; + } else { + return false; + } + break; + default: + return false; + } + } + function stream_stat() { + return array('size' => strlen($this->data)); + } + function stream_set_option($option, $arg1, $arg2) { + return false; + } } stream_wrapper_register("cookietest", "userstream"); diff --git a/ext/standard/tests/file/fpassthru_basic.phpt b/ext/standard/tests/file/fpassthru_basic.phpt index f453a484f9..3304de406d 100644 --- a/ext/standard/tests/file/fpassthru_basic.phpt +++ b/ext/standard/tests/file/fpassthru_basic.phpt @@ -14,7 +14,7 @@ $write_handle = fopen($file_name, "w"); $string = "Hello, world\n, abcdefg\tadsdsfdf\n8u2394723947\t$%$%#$%#$%#^#%^ Hello, world\n, abcdefg\tadsdsfdf\n8u2394723947\t$%$%#$%#$%#^#%^\n"; if(substr(PHP_OS, 0, 3) == "WIN") { - $string = str_replace("\r",'', $string); + $string = str_replace("\r",'', $string); } fwrite($write_handle, $string); fclose($write_handle); diff --git a/ext/standard/tests/file/fputcsv.phpt b/ext/standard/tests/file/fputcsv.phpt index f7286254f2..b303554e9c 100644 --- a/ext/standard/tests/file/fputcsv.phpt +++ b/ext/standard/tests/file/fputcsv.phpt @@ -31,14 +31,14 @@ $file = __DIR__ . '/fputcsv.csv'; $fp = fopen($file, "w"); foreach ($list as $v) { - fputcsv($fp, explode(',', $v)); + fputcsv($fp, explode(',', $v)); } fclose($fp); $res = file($file); foreach($res as &$val) { - $val = substr($val, 0, -1); + $val = substr($val, 0, -1); } echo '$list = ';var_export($res);echo ";\n"; @@ -46,7 +46,7 @@ $fp = fopen($file, "r"); $res = array(); while($l=fgetcsv($fp)) { - $res[] = join(',',$l); + $res[] = join(',',$l); } fclose($fp); diff --git a/ext/standard/tests/file/fputcsv_variation15.phpt b/ext/standard/tests/file/fputcsv_variation15.phpt index 1715d09e28..150fdd69d5 100644 --- a/ext/standard/tests/file/fputcsv_variation15.phpt +++ b/ext/standard/tests/file/fputcsv_variation15.phpt @@ -33,14 +33,14 @@ $file = __DIR__ . '/fputcsv_variation15.csv'; $fp = fopen($file, "w"); foreach ($list as $v) { - fputcsv($fp, explode(',', $v), ',', '"', '/'); + fputcsv($fp, explode(',', $v), ',', '"', '/'); } fclose($fp); $res = file($file); foreach($res as &$val) { - $val = substr($val, 0, -1); + $val = substr($val, 0, -1); } echo '$list = ';var_export($res);echo ";\n"; @@ -48,7 +48,7 @@ $fp = fopen($file, "r"); $res = array(); while($l=fgetcsv($fp, 0, ',', '"', '/')) { - $res[] = join(',',$l); + $res[] = join(',',$l); } fclose($fp); diff --git a/ext/standard/tests/file/fscanf_variation19.phpt b/ext/standard/tests/file/fscanf_variation19.phpt index bfb5d40223..31cc83297b 100644 --- a/ext/standard/tests/file/fscanf_variation19.phpt +++ b/ext/standard/tests/file/fscanf_variation19.phpt @@ -31,8 +31,8 @@ $bool_types = array ( $string_formats = array( "%s", "%hs", "%ls", "%Ls", " %s", "%s ", "% s", - "\t%s", "\n%s", "%4s", - "%30s", "%[a-zA-Z0-9]", "%*s"); + "\t%s", "\n%s", "%4s", + "%30s", "%[a-zA-Z0-9]", "%*s"); $counter = 1; diff --git a/ext/standard/tests/file/fscanf_variation20.phpt b/ext/standard/tests/file/fscanf_variation20.phpt index 10f3a2142d..34dac83bf1 100644 --- a/ext/standard/tests/file/fscanf_variation20.phpt +++ b/ext/standard/tests/file/fscanf_variation20.phpt @@ -43,10 +43,10 @@ $valid_ints = array( ); // various char formats $char_formats = array( "%c", - "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", - "\t%c", "\n%c", "%4c", - "%30c", "%[a-bA-B@#$&]", "%*c"); + "%hc", "%lc", "%Lc", + " %c", "%c ", "% c", + "\t%c", "\n%c", "%4c", + "%30c", "%[a-bA-B@#$&]", "%*c"); $counter = 1; diff --git a/ext/standard/tests/file/fscanf_variation21.phpt b/ext/standard/tests/file/fscanf_variation21.phpt index 39958c8de8..e0c8074ead 100644 --- a/ext/standard/tests/file/fscanf_variation21.phpt +++ b/ext/standard/tests/file/fscanf_variation21.phpt @@ -42,9 +42,9 @@ $float_values = array ( $char_formats = array( "%c", "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", - "\t%c", "\n%c", "%4c", - "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); + " %c", "%c ", "% c", + "\t%c", "\n%c", "%4c", + "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); $counter = 1; diff --git a/ext/standard/tests/file/fscanf_variation22.phpt b/ext/standard/tests/file/fscanf_variation22.phpt index b5656ce907..2fb450750d 100644 --- a/ext/standard/tests/file/fscanf_variation22.phpt +++ b/ext/standard/tests/file/fscanf_variation22.phpt @@ -32,10 +32,10 @@ $resource_types = array ( ); $char_formats = array( "%c", - "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", - "\t%c", "\n%c", "%4c", - "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); + "%hc", "%lc", "%Lc", + " %c", "%c ", "% c", + "\t%c", "\n%c", "%4c", + "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); $counter = 1; diff --git a/ext/standard/tests/file/fscanf_variation23.phpt b/ext/standard/tests/file/fscanf_variation23.phpt index 61d62fc05c..e8b9c0dae2 100644 --- a/ext/standard/tests/file/fscanf_variation23.phpt +++ b/ext/standard/tests/file/fscanf_variation23.phpt @@ -37,10 +37,10 @@ $array_types = array ( ); $char_formats = array( "%c", - "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", - "\t%c", "\n%c", "%4c", - "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); + "%hc", "%lc", "%Lc", + " %c", "%c ", "% c", + "\t%c", "\n%c", "%4c", + "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); $counter = 1; diff --git a/ext/standard/tests/file/fscanf_variation24.phpt b/ext/standard/tests/file/fscanf_variation24.phpt index 1177e2e2d0..576919c886 100644 --- a/ext/standard/tests/file/fscanf_variation24.phpt +++ b/ext/standard/tests/file/fscanf_variation24.phpt @@ -43,10 +43,10 @@ $strings = array ( ); $char_formats = array( "%c", - "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", - "\t%c", "\n%c", "%4c", - "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); + "%hc", "%lc", "%Lc", + " %c", "%c ", "% c", + "\t%c", "\n%c", "%4c", + "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); $counter = 1; diff --git a/ext/standard/tests/file/fscanf_variation25.phpt b/ext/standard/tests/file/fscanf_variation25.phpt index ba37a07a3e..0fea04e438 100644 --- a/ext/standard/tests/file/fscanf_variation25.phpt +++ b/ext/standard/tests/file/fscanf_variation25.phpt @@ -29,10 +29,10 @@ $bool_types = array ( ); $char_formats = array( "%c", - "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", - "\t%c", "\n%c", "%4c", - "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); + "%hc", "%lc", "%Lc", + " %c", "%c ", "% c", + "\t%c", "\n%c", "%4c", + "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); $counter = 1; diff --git a/ext/standard/tests/file/fscanf_variation26.phpt b/ext/standard/tests/file/fscanf_variation26.phpt index bd499d37c5..5b1c5b0428 100644 --- a/ext/standard/tests/file/fscanf_variation26.phpt +++ b/ext/standard/tests/file/fscanf_variation26.phpt @@ -24,10 +24,10 @@ if($file_handle == false) $char_types = array( 'a', "a", 67, -67, 99 ); $char_formats = array( "%c", - "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", - "\t%c", "\n%c", "%4c", - "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); + "%hc", "%lc", "%Lc", + " %c", "%c ", "% c", + "\t%c", "\n%c", "%4c", + "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); $counter = 1; diff --git a/ext/standard/tests/file/fscanf_variation29.phpt b/ext/standard/tests/file/fscanf_variation29.phpt index 1d25e81ceb..1621958fa4 100644 --- a/ext/standard/tests/file/fscanf_variation29.phpt +++ b/ext/standard/tests/file/fscanf_variation29.phpt @@ -32,11 +32,11 @@ $resource_types = array ( ); $octal_formats = array( "%o", - "%ho", "%lo", "%Lo", - " %o", "%o ", "% o", - "\t%o", "\n%o", "%4o", - "%30o", "%[0-7]", "%*o" - ); + "%ho", "%lo", "%Lo", + " %o", "%o ", "% o", + "\t%o", "\n%o", "%4o", + "%30o", "%[0-7]", "%*o" + ); $counter = 1; diff --git a/ext/standard/tests/file/fscanf_variation30.phpt b/ext/standard/tests/file/fscanf_variation30.phpt index 5b7dd02147..3af42e34bc 100644 --- a/ext/standard/tests/file/fscanf_variation30.phpt +++ b/ext/standard/tests/file/fscanf_variation30.phpt @@ -37,11 +37,11 @@ $array_types = array ( ); $octal_formats = array ( "%o", - "%ho", "%lo", "%Lo", - " %o", "%o ", "% o", - "\t%o", "\n%o", "%4o", - "%30o", "%[0-7]", "%*o" - ); + "%ho", "%lo", "%Lo", + " %o", "%o ", "% o", + "\t%o", "\n%o", "%4o", + "%30o", "%[0-7]", "%*o" + ); $counter = 1; diff --git a/ext/standard/tests/file/fscanf_variation32.phpt b/ext/standard/tests/file/fscanf_variation32.phpt index ef0c2b7036..556f60363e 100644 --- a/ext/standard/tests/file/fscanf_variation32.phpt +++ b/ext/standard/tests/file/fscanf_variation32.phpt @@ -29,11 +29,11 @@ $bool_types = array ( ); $octal_formats = array( "%o", - "%ho", "%lo", "%Lo", - " %o", "%o ", "% o", - "\t%o", "\n%o", "%4o", - "%30o", "%[0-7]", "%*o" - ); + "%ho", "%lo", "%Lo", + " %o", "%o ", "% o", + "\t%o", "\n%o", "%4o", + "%30o", "%[0-7]", "%*o" + ); $counter = 1; diff --git a/ext/standard/tests/file/fscanf_variation33.phpt b/ext/standard/tests/file/fscanf_variation33.phpt index 357544d1c4..2753a890b5 100644 --- a/ext/standard/tests/file/fscanf_variation33.phpt +++ b/ext/standard/tests/file/fscanf_variation33.phpt @@ -49,11 +49,11 @@ $valid_ints = array( ); // various hexa formats $hexa_formats = array( "%x", - "%xx", "%lx", "%Lx", - " %x", "%x ", "% x", - "\t%x", "\n%x", "%4x", - "%30x", "%[0-9A-Fa-f]", "%*x" - ); + "%xx", "%lx", "%Lx", + " %x", "%x ", "% x", + "\t%x", "\n%x", "%4x", + "%30x", "%[0-9A-Fa-f]", "%*x" + ); $counter = 1; diff --git a/ext/standard/tests/file/fscanf_variation34.phpt b/ext/standard/tests/file/fscanf_variation34.phpt index 949ee5fb56..ca0ca65e95 100644 --- a/ext/standard/tests/file/fscanf_variation34.phpt +++ b/ext/standard/tests/file/fscanf_variation34.phpt @@ -47,10 +47,10 @@ $float_values = array ( ); $hexa_formats = array( "%x", - "%hx", "%lx", "%Lx", - " %x", "%x ", "% x", - "\t%x", "\n%x", "%4x", - "%30x", "%[0-9A-Za-z]", "%*x"); + "%hx", "%lx", "%Lx", + " %x", "%x ", "% x", + "\t%x", "\n%x", "%4x", + "%30x", "%[0-9A-Za-z]", "%*x"); $counter = 1; diff --git a/ext/standard/tests/file/fstat_variation8.phpt b/ext/standard/tests/file/fstat_variation8.phpt index 4376d6e563..95036f5013 100644 --- a/ext/standard/tests/file/fstat_variation8.phpt +++ b/ext/standard/tests/file/fstat_variation8.phpt @@ -15,10 +15,10 @@ foreach($stat_result as $key =>$value) { // windows, dev and rdev will not match this is expected } else { - if ($fstat_result[$key] != $value) { - echo "FAIL: stat differs at '$key'. $fstat_result[$key] -- $value\n"; - $failed = true; - } + if ($fstat_result[$key] != $value) { + echo "FAIL: stat differs at '$key'. $fstat_result[$key] -- $value\n"; + $failed = true; + } } } if ($failed !== true) { diff --git a/ext/standard/tests/file/ftruncate_bug76422.phpt b/ext/standard/tests/file/ftruncate_bug76422.phpt index d291ec2efc..84134acfd0 100644 --- a/ext/standard/tests/file/ftruncate_bug76422.phpt +++ b/ext/standard/tests/file/ftruncate_bug76422.phpt @@ -33,7 +33,7 @@ $ftruncate_result = ftruncate($file_handle, $truncate_offset); if (false === $ftruncate_result) { // NOTE: unlink() is deliberately repeated - If this test runs out of disk space attempting to reserve space for this temporary file, - // then the --CLEAN-- script can't be run (if we don't delete the file), + // then the--CLEAN-- script can't be run (if we don't delete the file), // because there wouldn't be any free disk space to save a new php file. fclose($file_handle); unlink($fn); diff --git a/ext/standard/tests/file/include_streams.phpt b/ext/standard/tests/file/include_streams.phpt index 0b9446ff9e..90629d3ffc 100644 --- a/ext/standard/tests/file/include_streams.phpt +++ b/ext/standard/tests/file/include_streams.phpt @@ -10,99 +10,99 @@ EOD; class mystream { - public $path; - public $mode; - public $options; - - public $position; - public $varname; - - function url_stat($path, $flags) { - return array(); - } - - function stream_stat() { - return array(); - } - - function stream_open($path, $mode, $options, &$opened_path) - { - $this->path = $path; - $this->mode = $mode; - $this->options = $options; - - $split = parse_url($path); - if ($split["host"] !== "GLOBALS" || - empty($split["path"]) || - empty($GLOBALS[substr($split["path"],1)])) { - return false; - } - $this->varname = substr($split["path"],1); - - if (strchr($mode, 'a')) - $this->position = strlen($GLOBALS[$this->varname]); - else - $this->position = 0; - - return true; - } - - function stream_read($count) - { - $ret = substr($GLOBALS[$this->varname], $this->position, $count); - $this->position += strlen($ret); - return $ret; - } - - function stream_tell() - { - return $this->position; - } - - function stream_eof() - { - return $this->position >= strlen($GLOBALS[$this->varname]); - } - - function stream_seek($offset, $whence) - { - switch($whence) { - case SEEK_SET: - if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { - $this->position = $offset; - return true; - } else { - return false; - } - break; - case SEEK_CUR: - if ($offset >= 0) { - $this->position += $offset; - return true; - } else { - return false; - } - break; - case SEEK_END: - if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { - $this->position = strlen($GLOBALS[$this->varname]) + $offset; - return true; - } else { - return false; - } - break; - default: - return false; - } - } - - function stream_set_option($option, $arg1, $arg2) { - return false; - } + public $path; + public $mode; + public $options; + + public $position; + public $varname; + + function url_stat($path, $flags) { + return array(); + } + + function stream_stat() { + return array(); + } + + function stream_open($path, $mode, $options, &$opened_path) + { + $this->path = $path; + $this->mode = $mode; + $this->options = $options; + + $split = parse_url($path); + if ($split["host"] !== "GLOBALS" || + empty($split["path"]) || + empty($GLOBALS[substr($split["path"],1)])) { + return false; + } + $this->varname = substr($split["path"],1); + + if (strchr($mode, 'a')) + $this->position = strlen($GLOBALS[$this->varname]); + else + $this->position = 0; + + return true; + } + + function stream_read($count) + { + $ret = substr($GLOBALS[$this->varname], $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + + function stream_tell() + { + return $this->position; + } + + function stream_eof() + { + return $this->position >= strlen($GLOBALS[$this->varname]); + } + + function stream_seek($offset, $whence) + { + switch($whence) { + case SEEK_SET: + if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { + $this->position = $offset; + return true; + } else { + return false; + } + break; + case SEEK_CUR: + if ($offset >= 0) { + $this->position += $offset; + return true; + } else { + return false; + } + break; + case SEEK_END: + if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { + $this->position = strlen($GLOBALS[$this->varname]) + $offset; + return true; + } else { + return false; + } + break; + default: + return false; + } + } + + function stream_set_option($option, $arg1, $arg2) { + return false; + } } if (!stream_wrapper_register("test", "mystream")) { - die("test wrapper registration failed"); + die("test wrapper registration failed"); } echo file_get_contents("test://GLOBALS/data1"); diff --git a/ext/standard/tests/file/include_userstream_001.phpt b/ext/standard/tests/file/include_userstream_001.phpt index d769a4f3b2..988a8bf085 100644 --- a/ext/standard/tests/file/include_userstream_001.phpt +++ b/ext/standard/tests/file/include_userstream_001.phpt @@ -7,66 +7,66 @@ allow_url_include=0 <?php class test { private $data = '<?php echo "Hello World\n";?>'; - private $pos; + private $pos; - function stream_open($path, $mode, $options, &$opened_path) - { - if (strchr($mode, 'a')) - $this->pos = strlen($this->data); - else - $this->po = 0; + function stream_open($path, $mode, $options, &$opened_path) + { + if (strchr($mode, 'a')) + $this->pos = strlen($this->data); + else + $this->po = 0; - return true; - } + return true; + } - function stream_read($count) - { - $ret = substr($this->data, $this->pos, $count); - $this->pos += strlen($ret); - return $ret; - } + function stream_read($count) + { + $ret = substr($this->data, $this->pos, $count); + $this->pos += strlen($ret); + return $ret; + } - function stream_tell() - { - return $this->pos; - } + function stream_tell() + { + return $this->pos; + } - function stream_eof() - { - return $this->pos >= strlen($this->data); - } + function stream_eof() + { + return $this->pos >= strlen($this->data); + } - function stream_seek($offset, $whence) - { - switch($whence) { - case SEEK_SET: - if ($offset < $this->data && $offset >= 0) { - $this->pos = $offset; - return true; - } else { - return false; - } - break; - case SEEK_CUR: - if ($offset >= 0) { - $this->pos += $offset; - return true; - } else { - return false; - } - break; - case SEEK_END: - if (strlen($this->data) + $offset >= 0) { - $this->pos = strlen($this->data) + $offset; - return true; - } else { - return false; - } - break; - default: - return false; - } - } + function stream_seek($offset, $whence) + { + switch($whence) { + case SEEK_SET: + if ($offset < $this->data && $offset >= 0) { + $this->pos = $offset; + return true; + } else { + return false; + } + break; + case SEEK_CUR: + if ($offset >= 0) { + $this->pos += $offset; + return true; + } else { + return false; + } + break; + case SEEK_END: + if (strlen($this->data) + $offset >= 0) { + $this->pos = strlen($this->data) + $offset; + return true; + } else { + return false; + } + break; + default: + return false; + } + } } diff --git a/ext/standard/tests/file/include_userstream_002.phpt b/ext/standard/tests/file/include_userstream_002.phpt index 208248f873..15c05314a5 100644 --- a/ext/standard/tests/file/include_userstream_002.phpt +++ b/ext/standard/tests/file/include_userstream_002.phpt @@ -7,83 +7,83 @@ allow_url_include=0 <?php class test { private $data = '<?php echo "Hello World\n";?>'; - private $pos; - private $stream = null; + private $pos; + private $stream = null; - function stream_open($path, $mode, $options, &$opened_path) - { - if (strpos($path, "test2://") === 0) { - $this->stream = fopen("test1://".substr($path, 8), $mode); - return !empty($this->stream); - } - if (strchr($mode, 'a')) - $this->pos = strlen($this->data); - else - $this->po = 0; + function stream_open($path, $mode, $options, &$opened_path) + { + if (strpos($path, "test2://") === 0) { + $this->stream = fopen("test1://".substr($path, 8), $mode); + return !empty($this->stream); + } + if (strchr($mode, 'a')) + $this->pos = strlen($this->data); + else + $this->po = 0; - return true; - } + return true; + } - function stream_read($count) - { - if (!empty($this->stream)) { - return fread($this->stream, $count); - } - $ret = substr($this->data, $this->pos, $count); - $this->pos += strlen($ret); - return $ret; - } + function stream_read($count) + { + if (!empty($this->stream)) { + return fread($this->stream, $count); + } + $ret = substr($this->data, $this->pos, $count); + $this->pos += strlen($ret); + return $ret; + } - function stream_tell() - { - if (!empty($this->stream)) { - return ftell($this->stream); - } - return $this->pos; - } + function stream_tell() + { + if (!empty($this->stream)) { + return ftell($this->stream); + } + return $this->pos; + } - function stream_eof() - { - if (!empty($this->stream)) { - return feof($this->stream); - } - return $this->pos >= strlen($this->data); - } + function stream_eof() + { + if (!empty($this->stream)) { + return feof($this->stream); + } + return $this->pos >= strlen($this->data); + } - function stream_seek($offset, $whence) - { - if (!empty($this->stream)) { - return fseek($this->stream, $offset, $whence); - } - switch($whence) { - case SEEK_SET: - if ($offset < $this->data && $offset >= 0) { - $this->pos = $offset; - return true; - } else { - return false; - } - break; - case SEEK_CUR: - if ($offset >= 0) { - $this->pos += $offset; - return true; - } else { - return false; - } - break; - case SEEK_END: - if (strlen($this->data) + $offset >= 0) { - $this->pos = strlen($this->data) + $offset; - return true; - } else { - return false; - } - break; - default: - return false; - } - } + function stream_seek($offset, $whence) + { + if (!empty($this->stream)) { + return fseek($this->stream, $offset, $whence); + } + switch($whence) { + case SEEK_SET: + if ($offset < $this->data && $offset >= 0) { + $this->pos = $offset; + return true; + } else { + return false; + } + break; + case SEEK_CUR: + if ($offset >= 0) { + $this->pos += $offset; + return true; + } else { + return false; + } + break; + case SEEK_END: + if (strlen($this->data) + $offset >= 0) { + $this->pos = strlen($this->data) + $offset; + return true; + } else { + return false; + } + break; + default: + return false; + } + } } diff --git a/ext/standard/tests/file/include_userstream_003.phpt b/ext/standard/tests/file/include_userstream_003.phpt index 5ffe28a840..ae6ec62649 100644 --- a/ext/standard/tests/file/include_userstream_003.phpt +++ b/ext/standard/tests/file/include_userstream_003.phpt @@ -7,83 +7,83 @@ allow_url_include=1 <?php class test { private $data = '<?php echo "Hello World\n";?>'; - private $pos; - private $stream = null; - - function stream_open($path, $mode, $options, &$opened_path) - { - if (strpos($path, "test2://") === 0) { - $this->stream = fopen("test1://".substr($path, 8), $mode); - return !empty($this->stream); - } - if (strchr($mode, 'a')) - $this->pos = strlen($this->data); - else - $this->po = 0; - - return true; - } - - function stream_read($count) - { - if (!empty($this->stream)) { - return fread($this->stream, $count); - } - $ret = substr($this->data, $this->pos, $count); - $this->pos += strlen($ret); - return $ret; - } - - function stream_tell() - { - if (!empty($this->stream)) { - return ftell($this->stream); - } - return $this->pos; - } - - function stream_eof() - { - if (!empty($this->stream)) { - return feof($this->stream); - } - return $this->pos >= strlen($this->data); - } - - function stream_seek($offset, $whence) - { - if (!empty($this->stream)) { - return fseek($this->stream, $offset, $whence); - } - switch($whence) { - case SEEK_SET: - if ($offset < $this->data && $offset >= 0) { - $this->pos = $offset; - return true; - } else { - return false; - } - break; - case SEEK_CUR: - if ($offset >= 0) { - $this->pos += $offset; - return true; - } else { - return false; - } - break; - case SEEK_END: - if (strlen($this->data) + $offset >= 0) { - $this->pos = strlen($this->data) + $offset; - return true; - } else { - return false; - } - break; - default: - return false; - } - } + private $pos; + private $stream = null; + + function stream_open($path, $mode, $options, &$opened_path) + { + if (strpos($path, "test2://") === 0) { + $this->stream = fopen("test1://".substr($path, 8), $mode); + return !empty($this->stream); + } + if (strchr($mode, 'a')) + $this->pos = strlen($this->data); + else + $this->po = 0; + + return true; + } + + function stream_read($count) + { + if (!empty($this->stream)) { + return fread($this->stream, $count); + } + $ret = substr($this->data, $this->pos, $count); + $this->pos += strlen($ret); + return $ret; + } + + function stream_tell() + { + if (!empty($this->stream)) { + return ftell($this->stream); + } + return $this->pos; + } + + function stream_eof() + { + if (!empty($this->stream)) { + return feof($this->stream); + } + return $this->pos >= strlen($this->data); + } + + function stream_seek($offset, $whence) + { + if (!empty($this->stream)) { + return fseek($this->stream, $offset, $whence); + } + switch($whence) { + case SEEK_SET: + if ($offset < $this->data && $offset >= 0) { + $this->pos = $offset; + return true; + } else { + return false; + } + break; + case SEEK_CUR: + if ($offset >= 0) { + $this->pos += $offset; + return true; + } else { + return false; + } + break; + case SEEK_END: + if (strlen($this->data) + $offset >= 0) { + $this->pos = strlen($this->data) + $offset; + return true; + } else { + return false; + } + break; + default: + return false; + } + } } diff --git a/ext/standard/tests/file/parse_ini_file.phpt b/ext/standard/tests/file/parse_ini_file.phpt index eed17c0093..817b92aa7f 100644 --- a/ext/standard/tests/file/parse_ini_file.phpt +++ b/ext/standard/tests/file/parse_ini_file.phpt @@ -25,7 +25,7 @@ PHP_CONSTANT = 1.2345678 HELLO = HELLO [date] -date = +date = time = [paths] @@ -64,7 +64,7 @@ Non_alpha11 = / Non_alpha12 = \ ;These chars have a special meaning when used in the value, ; hence parser throws an error -;Non_alpha13 = & +;Non_alpha13 = & ;Non_alpha14 = ^ ;Non_alpha15 = {} ;Non_alpha16 = | @@ -172,7 +172,7 @@ Key16 = Null Key17 = nuLL Key18 = null -[ReservedKeys_as_Keys] +[ReservedKeys_as_Keys] ; Expected:error, reserved key words must not be used as keys for ini file ;YES = 1 ;Yes = 2 diff --git a/ext/standard/tests/file/pathinfo_basic1-win32.phpt b/ext/standard/tests/file/pathinfo_basic1-win32.phpt index acca647a97..060c7e3423 100644 --- a/ext/standard/tests/file/pathinfo_basic1-win32.phpt +++ b/ext/standard/tests/file/pathinfo_basic1-win32.phpt @@ -16,45 +16,45 @@ if(substr(PHP_OS, 0, 3) != "WIN") echo "*** Testing basic functions of pathinfo() ***\n"; $paths = array ( - '', - ' ', - 'c:', - 'c:\\', - 'c:/', - 'afile', - 'c:\test\adir', - 'c:\test\adir\\', - '/usr/include/arpa', - '/usr/include/arpa/', - 'usr/include/arpa', - 'usr/include/arpa/', - 'c:\test\afile', - 'c:\\test\\afile', - 'c://test//afile', - 'c:\test\afile\\', - 'c:\test\prog.exe', - 'c:\\test\\prog.exe', - 'c:/test/prog.exe', - '/usr/include/arpa/inet.h', - '//usr/include//arpa/inet.h', - '\\', - '\\\\', - '/', - '//', - '///', - '/usr/include/arpa/inet.h', - 'c:\windows/system32\drivers/etc\hosts', - '/usr\include/arpa\inet.h', - ' c:\test\adir\afile.txt', - 'c:\test\adir\afile.txt ', - ' c:\test\adir\afile.txt ', - ' /usr/include/arpa/inet.h', - '/usr/include/arpa/inet.h ', - ' /usr/include/arpa/inet.h ', - ' c:', - ' c:\test\adir\afile.txt', - '/usr', - '/usr/' + '', + ' ', + 'c:', + 'c:\\', + 'c:/', + 'afile', + 'c:\test\adir', + 'c:\test\adir\\', + '/usr/include/arpa', + '/usr/include/arpa/', + 'usr/include/arpa', + 'usr/include/arpa/', + 'c:\test\afile', + 'c:\\test\\afile', + 'c://test//afile', + 'c:\test\afile\\', + 'c:\test\prog.exe', + 'c:\\test\\prog.exe', + 'c:/test/prog.exe', + '/usr/include/arpa/inet.h', + '//usr/include//arpa/inet.h', + '\\', + '\\\\', + '/', + '//', + '///', + '/usr/include/arpa/inet.h', + 'c:\windows/system32\drivers/etc\hosts', + '/usr\include/arpa\inet.h', + ' c:\test\adir\afile.txt', + 'c:\test\adir\afile.txt ', + ' c:\test\adir\afile.txt ', + ' /usr/include/arpa/inet.h', + '/usr/include/arpa/inet.h ', + ' /usr/include/arpa/inet.h ', + ' c:', + ' c:\test\adir\afile.txt', + '/usr', + '/usr/' ); $counter = 1; diff --git a/ext/standard/tests/file/pathinfo_basic1.phpt b/ext/standard/tests/file/pathinfo_basic1.phpt index c9e84522a8..d195a76fb3 100644 --- a/ext/standard/tests/file/pathinfo_basic1.phpt +++ b/ext/standard/tests/file/pathinfo_basic1.phpt @@ -16,45 +16,45 @@ if(substr(PHP_OS, 0, 3) == "WIN") echo "*** Testing basic functions of pathinfo() ***\n"; $paths = array ( - '', - ' ', - 'c:', - 'c:\\', - 'c:/', - 'afile', - 'c:\test\adir', - 'c:\test\adir\\', - '/usr/include/arpa', - '/usr/include/arpa/', - 'usr/include/arpa', - 'usr/include/arpa/', - 'c:\test\afile', - 'c:\\test\\afile', - 'c://test//afile', - 'c:\test\afile\\', - 'c:\test\prog.exe', - 'c:\\test\\prog.exe', - 'c:/test/prog.exe', - '/usr/include/arpa/inet.h', - '//usr/include//arpa/inet.h', - '\\', - '\\\\', - '/', - '//', - '///', - '/usr/include/arpa/inet.h', - 'c:\windows/system32\drivers/etc\hosts', - '/usr\include/arpa\inet.h', - ' c:\test\adir\afile.txt', - 'c:\test\adir\afile.txt ', - ' c:\test\adir\afile.txt ', - ' /usr/include/arpa/inet.h', - '/usr/include/arpa/inet.h ', - ' /usr/include/arpa/inet.h ', - ' c:', - ' c:\test\adir\afile.txt', - '/usr', - '/usr/' + '', + ' ', + 'c:', + 'c:\\', + 'c:/', + 'afile', + 'c:\test\adir', + 'c:\test\adir\\', + '/usr/include/arpa', + '/usr/include/arpa/', + 'usr/include/arpa', + 'usr/include/arpa/', + 'c:\test\afile', + 'c:\\test\\afile', + 'c://test//afile', + 'c:\test\afile\\', + 'c:\test\prog.exe', + 'c:\\test\\prog.exe', + 'c:/test/prog.exe', + '/usr/include/arpa/inet.h', + '//usr/include//arpa/inet.h', + '\\', + '\\\\', + '/', + '//', + '///', + '/usr/include/arpa/inet.h', + 'c:\windows/system32\drivers/etc\hosts', + '/usr\include/arpa\inet.h', + ' c:\test\adir\afile.txt', + 'c:\test\adir\afile.txt ', + ' c:\test\adir\afile.txt ', + ' /usr/include/arpa/inet.h', + '/usr/include/arpa/inet.h ', + ' /usr/include/arpa/inet.h ', + ' c:', + ' c:\test\adir\afile.txt', + '/usr', + '/usr/' ); $counter = 1; diff --git a/ext/standard/tests/file/pathinfo_basic2-win32.phpt b/ext/standard/tests/file/pathinfo_basic2-win32.phpt index 5a88b648d3..97f3899426 100644 --- a/ext/standard/tests/file/pathinfo_basic2-win32.phpt +++ b/ext/standard/tests/file/pathinfo_basic2-win32.phpt @@ -16,21 +16,21 @@ if(substr(PHP_OS, 0, 3) != "WIN") echo "*** Testing basic functions of pathinfo() ***\n"; $paths = array ( - 'c:\..\dir1', - 'c:\test\..\test2\.\adir\afile.txt', - '/usr/include/../arpa/./inet.h', - 'c:\test\adir\afile..txt', - '/usr/include/arpa/inet..h', - 'c:\test\adir\afile.', - '/usr/include/arpa/inet.', - '/usr/include/arpa/inet,h', - 'c:afile.txt', - '..\.\..\test\afile.txt', - '.././../test/afile', - '.', - '..', - '...', - '/usr/lib/.../afile' + 'c:\..\dir1', + 'c:\test\..\test2\.\adir\afile.txt', + '/usr/include/../arpa/./inet.h', + 'c:\test\adir\afile..txt', + '/usr/include/arpa/inet..h', + 'c:\test\adir\afile.', + '/usr/include/arpa/inet.', + '/usr/include/arpa/inet,h', + 'c:afile.txt', + '..\.\..\test\afile.txt', + '.././../test/afile', + '.', + '..', + '...', + '/usr/lib/.../afile' ); diff --git a/ext/standard/tests/file/pathinfo_basic2.phpt b/ext/standard/tests/file/pathinfo_basic2.phpt index 51de45d33d..3ae6e1338c 100644 --- a/ext/standard/tests/file/pathinfo_basic2.phpt +++ b/ext/standard/tests/file/pathinfo_basic2.phpt @@ -16,21 +16,21 @@ if(substr(PHP_OS, 0, 3) == "WIN") echo "*** Testing basic functions of pathinfo() ***\n"; $paths = array ( - 'c:\..\dir1', - 'c:\test\..\test2\.\adir\afile.txt', - '/usr/include/../arpa/./inet.h', - 'c:\test\adir\afile..txt', - '/usr/include/arpa/inet..h', - 'c:\test\adir\afile.', - '/usr/include/arpa/inet.', - '/usr/include/arpa/inet,h', - 'c:afile.txt', - '..\.\..\test\afile.txt', - '.././../test/afile', - '.', - '..', - '...', - '/usr/lib/.../afile' + 'c:\..\dir1', + 'c:\test\..\test2\.\adir\afile.txt', + '/usr/include/../arpa/./inet.h', + 'c:\test\adir\afile..txt', + '/usr/include/arpa/inet..h', + 'c:\test\adir\afile.', + '/usr/include/arpa/inet.', + '/usr/include/arpa/inet,h', + 'c:afile.txt', + '..\.\..\test\afile.txt', + '.././../test/afile', + '.', + '..', + '...', + '/usr/lib/.../afile' ); diff --git a/ext/standard/tests/file/popen_pclose_basic-win32-mb.phpt b/ext/standard/tests/file/popen_pclose_basic-win32-mb.phpt index 2d9b2b92dc..008cef3643 100644 --- a/ext/standard/tests/file/popen_pclose_basic-win32-mb.phpt +++ b/ext/standard/tests/file/popen_pclose_basic-win32-mb.phpt @@ -28,7 +28,7 @@ echo "*** Testing popen(): writing to the pipe ***\n"; $arr = array("ggg", "ddd", "aaa", "sss"); // popen("sort", "w") fails if variables_order="GPCS" // this is set in the default INI file -// it doesn't seem to be changeable in the --INI-- section +// it doesn't seem to be changeable in the--INI-- section // also, doing: ini_set('variables_order', ''); doesn't work! // // the only solution is to either put the absolute path here, or diff --git a/ext/standard/tests/file/popen_pclose_basic-win32.phpt b/ext/standard/tests/file/popen_pclose_basic-win32.phpt index dfb00fbeb2..5be3ee4ca8 100644 --- a/ext/standard/tests/file/popen_pclose_basic-win32.phpt +++ b/ext/standard/tests/file/popen_pclose_basic-win32.phpt @@ -28,7 +28,7 @@ echo "*** Testing popen(): writing to the pipe ***\n"; $arr = array("ggg", "ddd", "aaa", "sss"); // popen("sort", "w") fails if variables_order="GPCS" // this is set in the default INI file -// it doesn't seem to be changeable in the --INI-- section +// it doesn't seem to be changeable in the--INI-- section // also, doing: ini_set('variables_order', ''); doesn't work! // // the only solution is to either put the absolute path here, or diff --git a/ext/standard/tests/file/proc_open01.phpt b/ext/standard/tests/file/proc_open01.phpt index 66c601fb91..2f74a17464 100644 --- a/ext/standard/tests/file/proc_open01.phpt +++ b/ext/standard/tests/file/proc_open01.phpt @@ -6,15 +6,15 @@ $pipes = array(1, 2, 3); $orig_pipes = $pipes; $php = getenv('TEST_PHP_EXECUTABLE'); if ($php === false) { - die("no php executable defined"); + die("no php executable defined"); } $proc = proc_open( - "$php -n", - array(0 => array('pipe', 'r'), 1 => array('pipe', 'w')), - $pipes, getcwd(), array(), array() + "$php -n", + array(0 => array('pipe', 'r'), 1 => array('pipe', 'w')), + $pipes, getcwd(), array(), array() ); if ($proc === false) { - print "something went wrong.\n"; + print "something went wrong.\n"; } var_dump($pipes); stream_set_blocking($pipes[1], FALSE); @@ -25,25 +25,25 @@ fclose($pipes[0]); $cnt = ''; $n=0; for ($left = strlen($test_string); $left > 0;) { - if (++$n >1000) { - print "terminated after 1000 iterations\n"; - break; - } - $read_fds = array($pipes[1]); - $write_fds = NULL; - $exp_fds = NULL; - $retval = stream_select($read_fds, $write_fds, $exp_fds, 5); - if ($retval === false) { - print "select() failed\n"; - break; - } - if ($retval === 0) { - print "timed out\n"; - break; - } - $buf = fread($pipes[1], 1024); - $cnt .= $buf; - $left -= strlen($buf); + if (++$n >1000) { + print "terminated after 1000 iterations\n"; + break; + } + $read_fds = array($pipes[1]); + $write_fds = NULL; + $exp_fds = NULL; + $retval = stream_select($read_fds, $write_fds, $exp_fds, 5); + if ($retval === false) { + print "select() failed\n"; + break; + } + if ($retval === 0) { + print "timed out\n"; + break; + } + $buf = fread($pipes[1], 1024); + $cnt .= $buf; + $left -= strlen($buf); } var_dump($cnt); fclose($pipes[1]); diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt index 83a4a88b29..e80acae01b 100644 --- a/ext/standard/tests/file/rename_variation13-win32.phpt +++ b/ext/standard/tests/file/rename_variation13-win32.phpt @@ -42,7 +42,7 @@ $file_path = __DIR__."/renameVar13"; $aFile = $file_path.'/afile.tmp'; if (!mkdir($file_path)) { - die("fail to create $file_path tmp dir"); + die("fail to create $file_path tmp dir"); } for( $i=0; $i < count($names_arr); $i++ ) { diff --git a/ext/standard/tests/file/rename_variation3-win32.phpt b/ext/standard/tests/file/rename_variation3-win32.phpt index b14b814295..a9e3057340 100644 --- a/ext/standard/tests/file/rename_variation3-win32.phpt +++ b/ext/standard/tests/file/rename_variation3-win32.phpt @@ -25,7 +25,7 @@ mkdir($dirname); $filename = "$file_path/rename_variation3.tmp"; $fp = fopen($filename, "w"); if (!$fp) { - die("Cannot create $filename\n"); + die("Cannot create $filename\n"); } fclose($fp); diff --git a/ext/standard/tests/file/rename_variation7-win32.phpt b/ext/standard/tests/file/rename_variation7-win32.phpt index fb7c805cbf..bf879ce7d9 100644 --- a/ext/standard/tests/file/rename_variation7-win32.phpt +++ b/ext/standard/tests/file/rename_variation7-win32.phpt @@ -12,7 +12,7 @@ $tmp_link = __FILE__.".tmp.link"; $tmp_link2 = __FILE__.".tmp.link2"; if (symlink(__DIR__."/there_is_no_such_file", $tmp_link)) { - rename($tmp_link, $tmp_link2); + rename($tmp_link, $tmp_link2); } clearstatcache(); diff --git a/ext/standard/tests/file/stream_get_line.phpt b/ext/standard/tests/file/stream_get_line.phpt index 9421bd44c1..773efd2c88 100644 --- a/ext/standard/tests/file/stream_get_line.phpt +++ b/ext/standard/tests/file/stream_get_line.phpt @@ -7,7 +7,7 @@ $path = __DIR__ . '/test.html'; file_put_contents($path, "foo<br>bar<br>foo"); $fp = fopen($path, "r"); while ($fp && !feof($fp)) { - echo stream_get_line($fp, 0, "<br>")."\n"; + echo stream_get_line($fp, 0, "<br>")."\n"; } fclose($fp); @unlink($path); diff --git a/ext/standard/tests/file/stream_rfc2397_002.phpt b/ext/standard/tests/file/stream_rfc2397_002.phpt index 162f1ea9ea..d145456fdb 100644 --- a/ext/standard/tests/file/stream_rfc2397_002.phpt +++ b/ext/standard/tests/file/stream_rfc2397_002.phpt @@ -6,24 +6,24 @@ allow_url_fopen=1 <?php $streams = array( - 'data://,', - 'data://', - 'data://;base64,', - 'data://;base64', - 'data://foo,', - 'data://foo=bar,', - 'data://text/plain,', - 'data://text/plain;foo,', - 'data://text/plain;foo=bar,', - 'data://text/plain;foo=bar;bla,', - 'data://text/plain;foo=bar;base64,', - 'data://text/plain;foo=bar;bar=baz', - 'data://text/plain;foo=bar;bar=baz,', - ); + 'data://,', + 'data://', + 'data://;base64,', + 'data://;base64', + 'data://foo,', + 'data://foo=bar,', + 'data://text/plain,', + 'data://text/plain;foo,', + 'data://text/plain;foo=bar,', + 'data://text/plain;foo=bar;bla,', + 'data://text/plain;foo=bar;base64,', + 'data://text/plain;foo=bar;bar=baz', + 'data://text/plain;foo=bar;bar=baz,', + ); foreach($streams as $stream) { - $stream = fopen($stream, 'r'); + $stream = fopen($stream, 'r'); if ($stream) { $meta = stream_get_meta_data($stream); var_dump($meta); diff --git a/ext/standard/tests/file/stream_rfc2397_003.phpt b/ext/standard/tests/file/stream_rfc2397_003.phpt index 1797d02ab5..a1437a04bb 100644 --- a/ext/standard/tests/file/stream_rfc2397_003.phpt +++ b/ext/standard/tests/file/stream_rfc2397_003.phpt @@ -6,25 +6,25 @@ allow_url_fopen=1 <?php $streams = array( - 'data://,A%20brief%20note', - 'data://application/vnd-xxx-query,select_vcount,fcol_from_fieldtable/local', - 'data://;base64,Zm9vYmFyIGZvb2Jhcg==', - 'stream_rfc2397_003.gif' => 'data://image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw + 'data://,A%20brief%20note', + 'data://application/vnd-xxx-query,select_vcount,fcol_from_fieldtable/local', + 'data://;base64,Zm9vYmFyIGZvb2Jhcg==', + 'stream_rfc2397_003.gif' => 'data://image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw AAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFz ByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSp a/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJl ZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uis F81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PH hhx4dbgYKAAA7', - ); + ); foreach($streams as $original => $stream) { - if (is_string($original)) { - var_dump(file_get_contents(__DIR__ . '/' . $original) == file_get_contents($stream)); - } else { - var_dump(file_get_contents($stream)); - } + if (is_string($original)) { + var_dump(file_get_contents(__DIR__ . '/' . $original) == file_get_contents($stream)); + } else { + var_dump(file_get_contents($stream)); + } } ?> diff --git a/ext/standard/tests/file/stream_rfc2397_004.phpt b/ext/standard/tests/file/stream_rfc2397_004.phpt index 239a12e3bf..cb7012f650 100644 --- a/ext/standard/tests/file/stream_rfc2397_004.phpt +++ b/ext/standard/tests/file/stream_rfc2397_004.phpt @@ -6,17 +6,17 @@ allow_url_fopen=1 <?php $streams = array( - 'data://,;test', - 'data://text/plain,test', - 'data://text/plain;charset=US-ASCII,test', - 'data://;charset=UTF-8,Hello', - 'data://text/plain;charset=UTF-8,Hello', - 'data://,a,b', - ); + 'data://,;test', + 'data://text/plain,test', + 'data://text/plain;charset=US-ASCII,test', + 'data://;charset=UTF-8,Hello', + 'data://text/plain;charset=UTF-8,Hello', + 'data://,a,b', + ); foreach($streams as $stream) { - var_dump(@file_get_contents($stream)); + var_dump(@file_get_contents($stream)); } ?> diff --git a/ext/standard/tests/file/stream_rfc2397_005.phpt b/ext/standard/tests/file/stream_rfc2397_005.phpt index fb1cb85a07..38c0f4b77e 100644 --- a/ext/standard/tests/file/stream_rfc2397_005.phpt +++ b/ext/standard/tests/file/stream_rfc2397_005.phpt @@ -6,20 +6,20 @@ allow_url_fopen=1 <?php $streams = array( - 'data:,A%20brief%20note', - 'data:application/vnd-xxx-query,select_vcount,fcol_from_fieldtable/local', - 'data:;base64,Zm9vYmFyIGZvb2Jhcg==', - 'data:,;test', - 'data:text/plain,test', - 'data:text/plain;charset=US-ASCII,test', - 'data:;charset=UTF-8,Hello', - 'data:text/plain;charset=UTF-8,Hello', - 'data:,a,b', - ); + 'data:,A%20brief%20note', + 'data:application/vnd-xxx-query,select_vcount,fcol_from_fieldtable/local', + 'data:;base64,Zm9vYmFyIGZvb2Jhcg==', + 'data:,;test', + 'data:text/plain,test', + 'data:text/plain;charset=US-ASCII,test', + 'data:;charset=UTF-8,Hello', + 'data:text/plain;charset=UTF-8,Hello', + 'data:,a,b', + ); foreach($streams as $stream) { - var_dump(@file_get_contents($stream)); + var_dump(@file_get_contents($stream)); } ?> diff --git a/ext/standard/tests/file/stream_rfc2397_006.phpt b/ext/standard/tests/file/stream_rfc2397_006.phpt index 7caf1b666e..2c8b8fd720 100644 --- a/ext/standard/tests/file/stream_rfc2397_006.phpt +++ b/ext/standard/tests/file/stream_rfc2397_006.phpt @@ -6,19 +6,19 @@ allow_url_fopen=1 <?php $streams = array( - "data:;base64,\0Zm9vYmFyIGZvb2Jhcg==", - "data:;base64,Zm9vYmFy\0IGZvb2Jhcg==", - 'data:;base64,#Zm9vYmFyIGZvb2Jhcg==', - 'data:;base64,#Zm9vYmFyIGZvb2Jhc=', - ); + "data:;base64,\0Zm9vYmFyIGZvb2Jhcg==", + "data:;base64,Zm9vYmFy\0IGZvb2Jhcg==", + 'data:;base64,#Zm9vYmFyIGZvb2Jhcg==', + 'data:;base64,#Zm9vYmFyIGZvb2Jhc=', + ); foreach($streams as $stream) { - try { - var_dump(file_get_contents($stream)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } + try { + var_dump(file_get_contents($stream)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } ?> diff --git a/ext/standard/tests/file/stream_rfc2397_007.phpt b/ext/standard/tests/file/stream_rfc2397_007.phpt index a1558980c9..56d9162157 100644 --- a/ext/standard/tests/file/stream_rfc2397_007.phpt +++ b/ext/standard/tests/file/stream_rfc2397_007.phpt @@ -6,76 +6,76 @@ allow_url_fopen=1 <?php $streams = array( - "data:,012345", - ); + "data:,012345", + ); foreach($streams as $stream) { - echo "===$stream===\n"; + echo "===$stream===\n"; - $fp = fopen($stream, 'rb'); + $fp = fopen($stream, 'rb'); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===S:4,S===\n"; - var_dump(fseek($fp, 4)); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===GETC===\n"; - var_dump(fgetc($fp)); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===GETC===\n"; - var_dump(fgetc($fp)); - var_dump(fgetc($fp)); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===REWIND===\n"; - var_dump(rewind($fp)); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===GETC===\n"; - var_dump(fgetc($fp)); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===S:3,S===\n"; - var_dump(fseek($fp, 3, SEEK_SET)); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===S:1,C===\n"; - var_dump(fseek($fp, 1, SEEK_CUR)); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===S:-2,C===\n"; - var_dump(fseek($fp, -2, SEEK_CUR)); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===S:-10,C===\n"; - var_dump(fseek($fp, -10, SEEK_CUR)); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===S:3,S===\n"; - var_dump(fseek($fp, 3, SEEK_SET)); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===S:10,C===\n"; - var_dump(fseek($fp, 10, SEEK_CUR)); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===S:-1,E===\n"; - var_dump(fseek($fp, -1, SEEK_END)); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===S:0,E===\n"; - var_dump(fseek($fp, 0, SEEK_END)); - var_dump(ftell($fp)); - var_dump(feof($fp)); - echo "===S:1,E===\n"; - var_dump(fseek($fp, 1, SEEK_END)); - var_dump(ftell($fp)); - var_dump(feof($fp)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===S:4,S===\n"; + var_dump(fseek($fp, 4)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===GETC===\n"; + var_dump(fgetc($fp)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===GETC===\n"; + var_dump(fgetc($fp)); + var_dump(fgetc($fp)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===REWIND===\n"; + var_dump(rewind($fp)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===GETC===\n"; + var_dump(fgetc($fp)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===S:3,S===\n"; + var_dump(fseek($fp, 3, SEEK_SET)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===S:1,C===\n"; + var_dump(fseek($fp, 1, SEEK_CUR)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===S:-2,C===\n"; + var_dump(fseek($fp, -2, SEEK_CUR)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===S:-10,C===\n"; + var_dump(fseek($fp, -10, SEEK_CUR)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===S:3,S===\n"; + var_dump(fseek($fp, 3, SEEK_SET)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===S:10,C===\n"; + var_dump(fseek($fp, 10, SEEK_CUR)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===S:-1,E===\n"; + var_dump(fseek($fp, -1, SEEK_END)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===S:0,E===\n"; + var_dump(fseek($fp, 0, SEEK_END)); + var_dump(ftell($fp)); + var_dump(feof($fp)); + echo "===S:1,E===\n"; + var_dump(fseek($fp, 1, SEEK_END)); + var_dump(ftell($fp)); + var_dump(feof($fp)); - fclose($fp); + fclose($fp); } ?> diff --git a/ext/standard/tests/file/tempnam_variation3-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt index 33965b4f26..3311b0bc7c 100644 --- a/ext/standard/tests/file/tempnam_variation3-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt @@ -18,76 +18,76 @@ obscure_filename echo "*** Testing tempnam() with obscure prefixes ***\n"; $file_path = __DIR__."/tempnamVar3"; if (!mkdir($file_path)) { - echo "Failed, cannot create temp dir $filepath\n"; - exit(1); + echo "Failed, cannot create temp dir $filepath\n"; + exit(1); } $file_path = realpath($file_path); /* An array of prefixes */ $names_arr = array( - /* Valid args (casting)*/ - -1, - TRUE, - FALSE, - NULL, - "", - " ", - "\0", - /* Invalid args */ - array(), + /* Valid args (casting)*/ + -1, + TRUE, + FALSE, + NULL, + "", + " ", + "\0", + /* Invalid args */ + array(), - /* Valid args*/ - /* prefix with path separator of a non existing directory*/ - "/no/such/file/dir", - "php/php" + /* Valid args*/ + /* prefix with path separator of a non existing directory*/ + "/no/such/file/dir", + "php/php" ); $res_arr = array( - /* Invalid args */ - true, - true, - true, - true, - true, - true, - true, - false, + /* Invalid args */ + true, + true, + true, + true, + true, + true, + true, + false, - /* prefix with path separator of a non existing directory*/ - true, - true + /* prefix with path separator of a non existing directory*/ + true, + true ); for( $i=0; $i<count($names_arr); $i++ ) { - echo "-- Iteration $i --\n"; - try { + echo "-- Iteration $i --\n"; + try { $file_name = tempnam($file_path, $names_arr[$i]); } catch (TypeError $e) { echo $e->getMessage(), "\n"; continue; } - /* creating the files in existing dir */ - if (file_exists($file_name) && !$res_arr[$i]) { - echo "Failed\n"; - } - if ($res_arr[$i]) { - $file_dir = dirname($file_name); - if (realpath($file_dir) == $file_path || realpath($file_dir . "\\") == $file_path) { - echo "OK\n"; - } else { - echo "Failed, not created in the correct directory " . realpath($file_dir) . ' vs ' . $file_path ."\n"; - } + /* creating the files in existing dir */ + if (file_exists($file_name) && !$res_arr[$i]) { + echo "Failed\n"; + } + if ($res_arr[$i]) { + $file_dir = dirname($file_name); + if (realpath($file_dir) == $file_path || realpath($file_dir . "\\") == $file_path) { + echo "OK\n"; + } else { + echo "Failed, not created in the correct directory " . realpath($file_dir) . ' vs ' . $file_path ."\n"; + } - if (!is_writable($file_name)) { - printf("%o\n", fileperms($file_name) ); + if (!is_writable($file_name)) { + printf("%o\n", fileperms($file_name) ); - } - } else { - echo "OK\n"; - } - @unlink($file_name); + } + } else { + echo "OK\n"; + } + @unlink($file_name); } rmdir($file_path); diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt index bfc23a9541..26ccaef84d 100644 --- a/ext/standard/tests/file/tempnam_variation7-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt @@ -19,52 +19,52 @@ obscure_filename echo "*** Testing tempnam() with invalid/non-existing directory names ***\n"; /* An array of names, which will be passed as a dir name */ $names_arr = array( - /* Invalid args */ - -1, - TRUE, - FALSE, - NULL, - "", - " ", - "\0", - array(), + /* Invalid args */ + -1, + TRUE, + FALSE, + NULL, + "", + " ", + "\0", + array(), - /* Non-existing dirs */ - "/no/such/file/dir", - "php" + /* Non-existing dirs */ + "/no/such/file/dir", + "php" ); for( $i=0; $i<count($names_arr); $i++ ) { - echo "-- Iteration $i --\n"; - try { + echo "-- Iteration $i --\n"; + try { $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); } catch (TypeError $e) { echo $e->getMessage(), "\n"; continue; } - if( file_exists($file_name) ){ + if( file_exists($file_name) ){ - echo "File name is => "; - print($file_name); - echo "\n"; + echo "File name is => "; + print($file_name); + echo "\n"; - echo "File permissions are => "; - printf("%o", fileperms($file_name) ); - echo "\n"; + echo "File permissions are => "; + printf("%o", fileperms($file_name) ); + echo "\n"; - echo "File created in => "; - $file_dir = dirname($file_name); - if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) { - echo "temp dir\n"; - } else { - echo "unknown location\n"; - } - } else { - echo "-- File is not created --\n"; - } + echo "File created in => "; + $file_dir = dirname($file_name); + if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) { + echo "temp dir\n"; + } else { + echo "unknown location\n"; + } + } else { + echo "-- File is not created --\n"; + } - unlink($file_name); + unlink($file_name); } ?> --EXPECTF-- diff --git a/ext/standard/tests/file/touch_variation5-win32.phpt b/ext/standard/tests/file/touch_variation5-win32.phpt index 02cc4cfb4e..83d1879634 100644 --- a/ext/standard/tests/file/touch_variation5-win32.phpt +++ b/ext/standard/tests/file/touch_variation5-win32.phpt @@ -22,7 +22,7 @@ chdir($cwd); if (!mkdir($cwd . '/' . $workDir)) die("cannot create directory $workDir"); $paths = array( - // relative + // relative $workDir.'/'.$subDirOrFile, './'.$workDir.'/'.$subDirOrFile, $workDir.'/../'.$workDir.'/'.$subDirOrFile, @@ -66,66 +66,66 @@ rmdir($workDir); function test_nonexisting($paths) { - foreach($paths as $path) { - echo "--- testing $path ---\n"; - - if (is_dir($path) || is_file($path)) { - echo "FAILED: $path - exists\n"; - } - else { - $res = touch($path); - if ($res === true) { - // something was created - if (file_exists($path)) { - // something found - if (is_dir($path)) { - echo "FAILED: $path - unexpected directory\n"; - } - else { - echo "PASSED: $path - created\n"; - unlink($path); - } - } - else { - // nothing found - echo "FAILED: $path - touch returned true, nothing there\n"; - } - } - else { - // nothing created - if (file_exists($path)) { - //something found - echo "FAILED: $path - touch returned false, something there\n"; - if (is_dir($path)) { - rmdir($path); - } - else { - unlink($path); - } - } - } - } - } + foreach($paths as $path) { + echo "--- testing $path ---\n"; + + if (is_dir($path) || is_file($path)) { + echo "FAILED: $path - exists\n"; + } + else { + $res = touch($path); + if ($res === true) { + // something was created + if (file_exists($path)) { + // something found + if (is_dir($path)) { + echo "FAILED: $path - unexpected directory\n"; + } + else { + echo "PASSED: $path - created\n"; + unlink($path); + } + } + else { + // nothing found + echo "FAILED: $path - touch returned true, nothing there\n"; + } + } + else { + // nothing created + if (file_exists($path)) { + //something found + echo "FAILED: $path - touch returned false, something there\n"; + if (is_dir($path)) { + rmdir($path); + } + else { + unlink($path); + } + } + } + } + } } function test_existing($paths, $are_dirs) { - foreach($paths as $path) { - if ($are_dirs) { - $res = @mkdir($path); - if ($res == true) { + foreach($paths as $path) { + if ($are_dirs) { + $res = @mkdir($path); + if ($res == true) { test_path($path); rmdir($path); } - } - else { - $h = @fopen($path,"w"); - if ($h !== false) { - fclose($h); + } + else { + $h = @fopen($path,"w"); + if ($h !== false) { + fclose($h); test_path($path); unlink($path); } - } - } + } + } } diff --git a/ext/standard/tests/file/touch_variation5.phpt b/ext/standard/tests/file/touch_variation5.phpt index a42e509809..67382f3b99 100644 --- a/ext/standard/tests/file/touch_variation5.phpt +++ b/ext/standard/tests/file/touch_variation5.phpt @@ -22,7 +22,7 @@ mkdir($workDir); $cwd = getcwd(); $paths = array( - // relative + // relative $workDir.'/'.$subDirOrFile, './'.$workDir.'/'.$subDirOrFile, $workDir.'/../'.$workDir.'/'.$subDirOrFile, @@ -66,66 +66,66 @@ rmdir($workDir); function test_nonexisting($paths) { - foreach($paths as $path) { - echo "--- testing $path ---\n"; - - if (is_dir($path) || is_file($path)) { - echo "FAILED: $path - exists\n"; - } - else { - $res = touch($path); - if ($res === true) { - // something was created - if (file_exists($path)) { - // something found - if (is_dir($path)) { - echo "FAILED: $path - unexpected directory\n"; - } - else { - echo "PASSED: $path - created\n"; - unlink($path); - } - } - else { - // nothing found - echo "FAILED: $path - touch returned true, nothing there\n"; - } - } - else { - // nothing created - if (file_exists($path)) { - //something found - echo "FAILED: $path - touch returned false, something there\n"; - if (is_dir($path)) { - rmdir($path); - } - else { - unlink($path); - } - } - } - } - } + foreach($paths as $path) { + echo "--- testing $path ---\n"; + + if (is_dir($path) || is_file($path)) { + echo "FAILED: $path - exists\n"; + } + else { + $res = touch($path); + if ($res === true) { + // something was created + if (file_exists($path)) { + // something found + if (is_dir($path)) { + echo "FAILED: $path - unexpected directory\n"; + } + else { + echo "PASSED: $path - created\n"; + unlink($path); + } + } + else { + // nothing found + echo "FAILED: $path - touch returned true, nothing there\n"; + } + } + else { + // nothing created + if (file_exists($path)) { + //something found + echo "FAILED: $path - touch returned false, something there\n"; + if (is_dir($path)) { + rmdir($path); + } + else { + unlink($path); + } + } + } + } + } } function test_existing($paths, $are_dirs) { - foreach($paths as $path) { - if ($are_dirs) { - $res = @mkdir($path); - if ($res == true) { + foreach($paths as $path) { + if ($are_dirs) { + $res = @mkdir($path); + if ($res == true) { test_path($path); rmdir($path); } - } - else { - $h = @fopen($path,"w"); - if ($h !== false) { - fclose($h); + } + else { + $h = @fopen($path,"w"); + if ($h !== false) { + fclose($h); test_path($path); unlink($path); } - } - } + } + } } diff --git a/ext/standard/tests/file/touch_variation6-win32.phpt b/ext/standard/tests/file/touch_variation6-win32.phpt index d03671fff8..b9e9ce7a6c 100644 --- a/ext/standard/tests/file/touch_variation6-win32.phpt +++ b/ext/standard/tests/file/touch_variation6-win32.phpt @@ -25,7 +25,7 @@ $cwd = getcwd(); $unixifiedDirOrFile = '/'.substr(str_replace('\\','/',$cwd).'/'.$workDir.'/'.$subDirOrFile, 3); $paths = array( - // relative + // relative $workDir.'\\'.$subDirOrFile, '.\\'.$workDir.'\\'.$subDirOrFile, $workDir.'\\..\\'.$workDir.'\\'.$subDirOrFile, @@ -72,66 +72,66 @@ rmdir($workDir); function test_nonexisting($paths) { - foreach($paths as $path) { - echo "--- testing $path ---\n"; - - if (is_dir($path) || is_file($path)) { - echo "FAILED: $path - exists\n"; - } - else { - $res = touch($path); - if ($res === true) { - // something was created - if (file_exists($path)) { - // something found - if (is_dir($path)) { - echo "FAILED: $path - unexpected directory\n"; - } - else { - echo "PASSED: $path - created\n"; - unlink($path); - } - } - else { - // nothing found - echo "FAILED: $path - touch returned true, nothing there\n"; - } - } - else { - // nothing created - if (file_exists($path)) { - //something found - echo "FAILED: $path - touch returned false, something there\n"; - if (is_dir($path)) { - rmdir($path); - } - else { - unlink($path); - } - } - } - } - } + foreach($paths as $path) { + echo "--- testing $path ---\n"; + + if (is_dir($path) || is_file($path)) { + echo "FAILED: $path - exists\n"; + } + else { + $res = touch($path); + if ($res === true) { + // something was created + if (file_exists($path)) { + // something found + if (is_dir($path)) { + echo "FAILED: $path - unexpected directory\n"; + } + else { + echo "PASSED: $path - created\n"; + unlink($path); + } + } + else { + // nothing found + echo "FAILED: $path - touch returned true, nothing there\n"; + } + } + else { + // nothing created + if (file_exists($path)) { + //something found + echo "FAILED: $path - touch returned false, something there\n"; + if (is_dir($path)) { + rmdir($path); + } + else { + unlink($path); + } + } + } + } + } } function test_existing($paths, $are_dirs) { - foreach($paths as $path) { - if ($are_dirs) { - $res = @mkdir($path); - if ($res == true) { + foreach($paths as $path) { + if ($are_dirs) { + $res = @mkdir($path); + if ($res == true) { test_path($path); rmdir($path); } - } - else { - $h = @fopen($path,"w"); - if ($h !== false) { - fclose($h); + } + else { + $h = @fopen($path,"w"); + if ($h !== false) { + fclose($h); test_path($path); unlink($path); } - } - } + } + } } diff --git a/ext/standard/tests/file/unlink_variation10.phpt b/ext/standard/tests/file/unlink_variation10.phpt index 3a56a73a5a..ae48764d9b 100644 --- a/ext/standard/tests/file/unlink_variation10.phpt +++ b/ext/standard/tests/file/unlink_variation10.phpt @@ -56,18 +56,18 @@ rmdir($workDir); function test_link($linkedDir, $toLinkTo, $tounlink, $softlink) { if ($softlink == true) { - symlink($toLinkTo, $linkedDir); - $msg = "soft link"; + symlink($toLinkTo, $linkedDir); + $msg = "soft link"; } else { - link($toLinkTo, $linkedDir); - $msg = "hard link"; + link($toLinkTo, $linkedDir); + $msg = "hard link"; } echo "-- unlinking $msg $tounlink --\n"; $res = unlink($tounlink); if ($res === true) { if (is_link($tounlink) === false) { - echo "directory unlinked\n"; + echo "directory unlinked\n"; } else { echo "FAILED: directory not unlinked\n"; diff --git a/ext/standard/tests/file/unlink_variation8-win32.phpt b/ext/standard/tests/file/unlink_variation8-win32.phpt index efd24a22cb..12b43a340f 100644 --- a/ext/standard/tests/file/unlink_variation8-win32.phpt +++ b/ext/standard/tests/file/unlink_variation8-win32.phpt @@ -65,7 +65,7 @@ function test_realfile($file, $tounlink) { $res = unlink($tounlink); if ($res === true) { if (file_exists($tounlink) === false) { - echo "file removed\n"; + echo "file removed\n"; } else { echo "FAILED: file not removed\n"; diff --git a/ext/standard/tests/file/unlink_variation8.phpt b/ext/standard/tests/file/unlink_variation8.phpt index ee2540dd69..41c18f710b 100644 --- a/ext/standard/tests/file/unlink_variation8.phpt +++ b/ext/standard/tests/file/unlink_variation8.phpt @@ -70,7 +70,7 @@ function test_realfile($file, $tounlink) { $res = unlink($tounlink); if ($res === true) { if (file_exists($tounlink) === false) { - echo "file removed\n"; + echo "file removed\n"; } else { echo "FAILED: file not removed\n"; @@ -83,18 +83,18 @@ function test_realfile($file, $tounlink) { function test_link($linkedfile, $toLinkTo, $tounlink, $softlink) { if ($softlink == true) { - symlink($toLinkTo, $linkedfile); - $msg = "soft link"; + symlink($toLinkTo, $linkedfile); + $msg = "soft link"; } else { - link($toLinkTo, $linkedfile); - $msg = "hard link"; + link($toLinkTo, $linkedfile); + $msg = "hard link"; } echo "-- unlinking $msg $tounlink --\n"; $res = unlink($tounlink); if ($res === true) { if (file_exists($tounlink) === false) { - echo "file unlinked\n"; + echo "file unlinked\n"; } else { echo "FAILED: file not unlinked\n"; diff --git a/ext/standard/tests/file/unlink_variation9-win32.phpt b/ext/standard/tests/file/unlink_variation9-win32.phpt index 3c9d5e4a14..83a3f5617d 100644 --- a/ext/standard/tests/file/unlink_variation9-win32.phpt +++ b/ext/standard/tests/file/unlink_variation9-win32.phpt @@ -58,14 +58,14 @@ $files = array( foreach($files as $fileToUnlink) { - $file = $workDir.'/'.$tmpFile; - $tounlink = $fileToUnlink; + $file = $workDir.'/'.$tmpFile; + $tounlink = $fileToUnlink; touch($file); echo "-- removing $tounlink --\n"; $res = unlink($tounlink); if ($res === true) { if (file_exists($tounlink) === false) { - echo "file removed\n"; + echo "file removed\n"; } else { echo "FAILED: file not removed\n"; diff --git a/ext/standard/tests/file/userdirstream.phpt b/ext/standard/tests/file/userdirstream.phpt index a83e899b83..e2f03dabb7 100644 --- a/ext/standard/tests/file/userdirstream.phpt +++ b/ext/standard/tests/file/userdirstream.phpt @@ -3,33 +3,33 @@ Directory Streams --FILE-- <?php class test { - public $idx = 0; + public $idx = 0; - function dir_opendir($path, $options) { - print "Opening\n"; - $this->idx = 0; + function dir_opendir($path, $options) { + print "Opening\n"; + $this->idx = 0; - return true; - } + return true; + } - function dir_readdir() { - $sample = array('first','second','third','fourth'); + function dir_readdir() { + $sample = array('first','second','third','fourth'); - if ($this->idx >= count($sample)) return false; - else return $sample[$this->idx++]; - } + if ($this->idx >= count($sample)) return false; + else return $sample[$this->idx++]; + } - function dir_rewinddir() { - $this->idx = 0; + function dir_rewinddir() { + $this->idx = 0; - return true; - } + return true; + } - function dir_closedir() { - print "Closing up!\n"; + function dir_closedir() { + print "Closing up!\n"; - return true; - } + return true; + } } stream_wrapper_register('test', 'test'); diff --git a/ext/standard/tests/file/userstreams.phpt b/ext/standard/tests/file/userstreams.phpt index 790b74a0c3..5b753e02e4 100644 --- a/ext/standard/tests/file/userstreams.phpt +++ b/ext/standard/tests/file/userstreams.phpt @@ -22,7 +22,7 @@ call me what you will Free to speak my mind anywhere and Ill redefine anywhere Anywhere I roam - Where I lay my head is home + Where I lay my head is home ...and the earth becomes my throne I adapt to the unknown under wandering stars Ive grown @@ -38,12 +38,12 @@ call me what you will Free to speak my mind anywhere and Ill never mind anywhere Anywhere I roam - Where I lay my head is home + Where I lay my head is home But Ill take my time anywhere Free to speak my mind anywhere and Ill take my find anywhere Anywhere I roam - Where I lay my head is home + Where I lay my head is home carved upon my stone my body lie but still I roam Wherever I may roam. @@ -57,10 +57,10 @@ EOD; * to seek around... */ $DATA = ""; for ($i = 0; $i < 30; $i++) { - if ($i % 2 == 0) - $DATA .= str_rot13($lyrics); - else - $DATA .= $lyrics; + if ($i % 2 == 0) + $DATA .= str_rot13($lyrics); + else + $DATA .= $lyrics; } /* store the data in a regular file so that we can compare @@ -70,10 +70,10 @@ fwrite($tf, $DATA); $n = ftell($tf); rewind($tf) or die("failed to rewind tmp file!"); if (ftell($tf) != 0) - die("tmpfile is not at start!"); + die("tmpfile is not at start!"); $DATALEN = strlen($DATA); if ($n != $DATALEN) - die("tmpfile stored $n bytes; should be $DATALEN!"); + die("tmpfile stored $n bytes; should be $DATALEN!"); class uselessstream { @@ -81,150 +81,150 @@ class uselessstream class mystream { - public $path; - public $mode; - public $options; - - public $position; - public $varname; - - function stream_open($path, $mode, $options, &$opened_path) - { - $this->path = $path; - $this->mode = $mode; - $this->options = $options; - - $split = parse_url($path); - $this->varname = $split["host"]; - - if (strchr($mode, 'a')) - $this->position = strlen($GLOBALS[$this->varname]); - else - $this->position = 0; - - return true; - } - - function stream_read($count) - { - $ret = substr($GLOBALS[$this->varname], $this->position, $count); - $this->position += strlen($ret); - return $ret; - } - - function stream_tell() - { - return $this->position; - } - - function stream_eof() - { - return $this->position >= strlen($GLOBALS[$this->varname]); - } - - function stream_seek($offset, $whence) - { - switch($whence) { - case SEEK_SET: - if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { - $this->position = $offset; - return true; - } else { - return false; - } - break; - case SEEK_CUR: - if ($offset >= 0) { - $this->position += $offset; - return true; - } else { - return false; - } - break; - case SEEK_END: - if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { - $this->position = strlen($GLOBALS[$this->varname]) + $offset; - return true; - } else { - return false; - } - break; - default: - return false; - } - } + public $path; + public $mode; + public $options; + + public $position; + public $varname; + + function stream_open($path, $mode, $options, &$opened_path) + { + $this->path = $path; + $this->mode = $mode; + $this->options = $options; + + $split = parse_url($path); + $this->varname = $split["host"]; + + if (strchr($mode, 'a')) + $this->position = strlen($GLOBALS[$this->varname]); + else + $this->position = 0; + + return true; + } + + function stream_read($count) + { + $ret = substr($GLOBALS[$this->varname], $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + + function stream_tell() + { + return $this->position; + } + + function stream_eof() + { + return $this->position >= strlen($GLOBALS[$this->varname]); + } + + function stream_seek($offset, $whence) + { + switch($whence) { + case SEEK_SET: + if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { + $this->position = $offset; + return true; + } else { + return false; + } + break; + case SEEK_CUR: + if ($offset >= 0) { + $this->position += $offset; + return true; + } else { + return false; + } + break; + case SEEK_END: + if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { + $this->position = strlen($GLOBALS[$this->varname]) + $offset; + return true; + } else { + return false; + } + break; + default: + return false; + } + } } if (@stream_wrapper_register("bogus", "class_not_exist")) { - die("Registered a non-existent class!!!???"); + die("Registered a non-existent class!!!???"); } echo "Not Registered\n"; if (!stream_wrapper_register("test", "mystream")) { - die("test wrapper registration failed"); + die("test wrapper registration failed"); } echo "Registered\n"; if (!stream_wrapper_register("bogon", "uselessstream")) { - die("bogon wrapper registration failed"); + die("bogon wrapper registration failed"); } echo "Registered\n"; $b = @fopen("bogon://url", "rb"); if (is_resource($b)) { - die("Opened a bogon??"); + die("Opened a bogon??"); } $fp = fopen("test://DATA", "rb"); if (!$fp || !is_resource($fp)) { - die("Failed to open resource"); + die("Failed to open resource"); } /* some default seeks that will cause buffer/cache misses */ $seeks = array( - array(SEEK_SET, 0, 0), - array(SEEK_CUR, 8450, 8450), - array(SEEK_CUR, -7904, 546), - array(SEEK_CUR, 12456, 13002), - - /* end up at BOF so that randomly generated seek offsets - * below will know where they are supposed to be */ - array(SEEK_SET, 0, 0) + array(SEEK_SET, 0, 0), + array(SEEK_CUR, 8450, 8450), + array(SEEK_CUR, -7904, 546), + array(SEEK_CUR, 12456, 13002), + + /* end up at BOF so that randomly generated seek offsets + * below will know where they are supposed to be */ + array(SEEK_SET, 0, 0) ); $whence_map = array( - SEEK_CUR, - SEEK_SET, - SEEK_END + SEEK_CUR, + SEEK_SET, + SEEK_END ); $whence_names = array( - SEEK_CUR => "SEEK_CUR", - SEEK_SET => "SEEK_SET", - SEEK_END => "SEEK_END" - ); + SEEK_CUR => "SEEK_CUR", + SEEK_SET => "SEEK_SET", + SEEK_END => "SEEK_END" + ); /* generate some random seek offsets */ $position = 0; for ($i = 0; $i < 256; $i++) { - $whence = $whence_map[array_rand($whence_map, 1)]; - switch($whence) { - case SEEK_SET: - $offset = rand(0, $DATALEN - 1); - $position = $offset; - break; - case SEEK_END: - $offset = -rand(0, $DATALEN - 1); - $position = $DATALEN + $offset; - break; - case SEEK_CUR: - $offset = rand(0, $DATALEN - 1); - $offset -= $position; - $position += $offset; - break; - } - - $seeks[] = array($whence, $offset, $position); + $whence = $whence_map[array_rand($whence_map, 1)]; + switch($whence) { + case SEEK_SET: + $offset = rand(0, $DATALEN - 1); + $position = $offset; + break; + case SEEK_END: + $offset = -rand(0, $DATALEN - 1); + $position = $DATALEN + $offset; + break; + case SEEK_CUR: + $offset = rand(0, $DATALEN - 1); + $offset -= $position; + $position += $offset; + break; + } + + $seeks[] = array($whence, $offset, $position); } /* we compare the results of fgets using differing line lengths to @@ -234,50 +234,50 @@ $fail_count = 0; ob_start(); foreach($line_lengths as $line_length) { - /* now compare the real stream with the user stream */ - $j = 0; - rewind($tf); - rewind($fp); - foreach($seeks as $seekdata) { - list($whence, $offset, $position) = $seekdata; - - $rpb = ftell($tf); - $rr = (int)fseek($tf, $offset, $whence); - $rpa = ftell($tf); - $rline = fgets($tf, $line_length); - (int)fseek($tf, - strlen($rline), SEEK_CUR); - - $upb = ftell($fp); - $ur = (int)fseek($fp, $offset, $whence); - $upa = ftell($fp); - $uline = fgets($fp, $line_length); - (int)fseek($fp, - strlen($uline), SEEK_CUR); - - printf("\n--[%d] whence=%s offset=%d line_length=%d position_should_be=%d --\n", - $j, $whence_names[$whence], $offset, $line_length, $position); - printf("REAL: pos=(%d,%d,%d) ret=%d line[%d]=`%s'\n", $rpb, $rpa, ftell($tf), $rr, strlen($rline), $rline); - printf("USER: pos=(%d,%d,%d) ret=%d line[%d]=`%s'\n", $upb, $upa, ftell($fp), $ur, strlen($uline), $uline); - - if ($rr != $ur || $rline != $uline || $rpa != $position || $upa != $position) { - $fail_count++; - echo "###################################### FAIL!\n"; - $dat = stream_get_meta_data($fp); - var_dump($dat); - break; - } - - $j++; - } - if ($fail_count) - break; + /* now compare the real stream with the user stream */ + $j = 0; + rewind($tf); + rewind($fp); + foreach($seeks as $seekdata) { + list($whence, $offset, $position) = $seekdata; + + $rpb = ftell($tf); + $rr = (int)fseek($tf, $offset, $whence); + $rpa = ftell($tf); + $rline = fgets($tf, $line_length); + (int)fseek($tf, - strlen($rline), SEEK_CUR); + + $upb = ftell($fp); + $ur = (int)fseek($fp, $offset, $whence); + $upa = ftell($fp); + $uline = fgets($fp, $line_length); + (int)fseek($fp, - strlen($uline), SEEK_CUR); + + printf("\n--[%d] whence=%s offset=%d line_length=%d position_should_be=%d --\n", + $j, $whence_names[$whence], $offset, $line_length, $position); + printf("REAL: pos=(%d,%d,%d) ret=%d line[%d]=`%s'\n", $rpb, $rpa, ftell($tf), $rr, strlen($rline), $rline); + printf("USER: pos=(%d,%d,%d) ret=%d line[%d]=`%s'\n", $upb, $upa, ftell($fp), $ur, strlen($uline), $uline); + + if ($rr != $ur || $rline != $uline || $rpa != $position || $upa != $position) { + $fail_count++; + echo "###################################### FAIL!\n"; + $dat = stream_get_meta_data($fp); + var_dump($dat); + break; + } + + $j++; + } + if ($fail_count) + break; } if ($fail_count == 0) { - ob_end_clean(); - echo "SEEK: OK\n"; + ob_end_clean(); + echo "SEEK: OK\n"; } else { - echo "SEEK: FAIL\n"; - ob_end_flush(); + echo "SEEK: FAIL\n"; + ob_end_flush(); } $fail_count = 0; @@ -286,23 +286,23 @@ fseek($fp, $DATALEN / 2, SEEK_SET); fseek($tf, $DATALEN / 2, SEEK_SET); if (ftell($fp) != ftell($tf)) { - echo "SEEK: positions do not match!\n"; + echo "SEEK: positions do not match!\n"; } $n = 0; while(!feof($fp)) { - $uline = fgets($fp, 1024); - $rline = fgets($tf, 1024); - - if ($uline != $rline) { - echo "FGETS: FAIL\niter=$n user=$uline [pos=" . ftell($fp) . "]\nreal=$rline [pos=" . ftell($tf) . "]\n"; - $fail_count++; - break; - } + $uline = fgets($fp, 1024); + $rline = fgets($tf, 1024); + + if ($uline != $rline) { + echo "FGETS: FAIL\niter=$n user=$uline [pos=" . ftell($fp) . "]\nreal=$rline [pos=" . ftell($tf) . "]\n"; + $fail_count++; + break; + } } if ($fail_count == 0) { - echo "FGETS: OK\n"; + echo "FGETS: OK\n"; } /* One final test to see if the position is respected when opened for append */ diff --git a/ext/standard/tests/file/userstreams_002.phpt b/ext/standard/tests/file/userstreams_002.phpt index b625e46f26..95e085947f 100644 --- a/ext/standard/tests/file/userstreams_002.phpt +++ b/ext/standard/tests/file/userstreams_002.phpt @@ -3,30 +3,30 @@ User-space streams: stream_cast() --FILE-- <?php class test_wrapper_base { - public $return_value; - function stream_open($path, $mode, $openedpath) { - return true; - } - function stream_eof() { - return false; - } + public $return_value; + function stream_open($path, $mode, $openedpath) { + return true; + } + function stream_eof() { + return false; + } } class test_wrapper extends test_wrapper_base { - function stream_cast($castas) { - return $this->return_value; - } + function stream_cast($castas) { + return $this->return_value; + } } function test($name, $fd, $return_value) { - echo "\n------ $name: -------\n"; - $data = stream_get_meta_data($fd); - $data['wrapper_data']->return_value = $return_value; - $r = array($fd); - $w = $e = null; - try { - var_dump(stream_select($r, $w, $e, 0) !== false); - } catch (TypeError|ValueError $e) { - echo $e->getMessage(), "\n"; - } + echo "\n------ $name: -------\n"; + $data = stream_get_meta_data($fd); + $data['wrapper_data']->return_value = $return_value; + $r = array($fd); + $w = $e = null; + try { + var_dump(stream_select($r, $w, $e, 0) !== false); + } catch (TypeError|ValueError $e) { + echo $e->getMessage(), "\n"; + } } var_dump(stream_wrapper_register('test', 'test_wrapper')); diff --git a/ext/standard/tests/file/userstreams_003.phpt b/ext/standard/tests/file/userstreams_003.phpt index 9ee71f2666..686963adf7 100644 --- a/ext/standard/tests/file/userstreams_003.phpt +++ b/ext/standard/tests/file/userstreams_003.phpt @@ -3,37 +3,37 @@ User-space streams: stream_set_option() --FILE-- <?php class test_wrapper_base { - public $return_value; - public $expected_option; - public $expected_value; - function stream_open($path, $mode, $openedpath) { - return true; - } - function stream_eof() { - return false; - } + public $return_value; + public $expected_option; + public $expected_value; + function stream_open($path, $mode, $openedpath) { + return true; + } + function stream_eof() { + return false; + } } class test_wrapper extends test_wrapper_base { - function stream_set_option($option, $value, $ptrparam) { - echo "value:\n"; - var_dump($value); - echo "ptrparam:\n"; - var_dump($ptrparam); - echo "\$option === $option === " . $this->expected_option . ":\n"; - var_dump($option === $this->expected_option); - echo "\$value === $value === " . $this->expected_value. ":\n"; - var_dump($value === $this->expected_value); - return $this->return_value; - } + function stream_set_option($option, $value, $ptrparam) { + echo "value:\n"; + var_dump($value); + echo "ptrparam:\n"; + var_dump($ptrparam); + echo "\$option === $option === " . $this->expected_option . ":\n"; + var_dump($option === $this->expected_option); + echo "\$value === $value === " . $this->expected_value. ":\n"; + var_dump($value === $this->expected_value); + return $this->return_value; + } } function test($name, $fd, $return_value, $func, $args, $expected_option, $expected_value) { - echo "\n------ $name: -------\n"; - $data = stream_get_meta_data($fd); - $data['wrapper_data']->return_value = $return_value; - $data['wrapper_data']->expected_option = $expected_option; - $data['wrapper_data']->expected_value = $expected_value; - var_dump(call_user_func_array($func, $args)); + echo "\n------ $name: -------\n"; + $data = stream_get_meta_data($fd); + $data['wrapper_data']->return_value = $return_value; + $data['wrapper_data']->expected_option = $expected_option; + $data['wrapper_data']->expected_value = $expected_value; + var_dump(call_user_func_array($func, $args)); } var_dump(stream_wrapper_register('test', 'test_wrapper')); diff --git a/ext/standard/tests/file/userstreams_004.phpt b/ext/standard/tests/file/userstreams_004.phpt index da9f148b5d..df1a9f3604 100644 --- a/ext/standard/tests/file/userstreams_004.phpt +++ b/ext/standard/tests/file/userstreams_004.phpt @@ -3,24 +3,24 @@ User-space streams: stream_lock() --FILE-- <?php class test_wrapper_base { - public $mode; - function stream_open($path, $mode, $openedpath) { - return true; - } - function stream_eof() { - return false; - } + public $mode; + function stream_open($path, $mode, $openedpath) { + return true; + } + function stream_eof() { + return false; + } } class test_wrapper extends test_wrapper_base { - function stream_lock($mode) { - $this->mode = $mode; - } + function stream_lock($mode) { + $this->mode = $mode; + } } function test($name, $fd, $mode) { - echo "------ $name: -------\n"; - flock($fd, $mode); - $data = stream_get_meta_data($fd); - var_dump($data['wrapper_data']->mode === $mode); + echo "------ $name: -------\n"; + flock($fd, $mode); + $data = stream_get_meta_data($fd); + var_dump($data['wrapper_data']->mode === $mode); } var_dump(stream_wrapper_register('test', 'test_wrapper')); @@ -32,8 +32,8 @@ $fd2 = fopen("test2://foo","r"); test("stream_lock not implemented", $fd2, LOCK_EX); foreach(array("LOCK_SH","LOCK_EX","LOCK_UN") as $mode) { - test("fclock($mode)", $fd, constant($mode)); - test("fclock($mode|LOCK_NB)", $fd, constant($mode)|LOCK_NB); + test("fclock($mode)", $fd, constant($mode)); + test("fclock($mode|LOCK_NB)", $fd, constant($mode)|LOCK_NB); } ?> diff --git a/ext/standard/tests/file/userstreams_005.phpt b/ext/standard/tests/file/userstreams_005.phpt index 0c3113c197..5650df2aa0 100644 --- a/ext/standard/tests/file/userstreams_005.phpt +++ b/ext/standard/tests/file/userstreams_005.phpt @@ -3,29 +3,29 @@ User-space streams: stream_truncate() --FILE-- <?php class test_wrapper_base { - public $mode; - function stream_open($path, $mode, $openedpath) { - return true; - } - function stream_eof() { - return false; - } + public $mode; + function stream_open($path, $mode, $openedpath) { + return true; + } + function stream_eof() { + return false; + } } class test_wrapper extends test_wrapper_base { - function stream_truncate($new_size) { - echo "truncation with new_size=$new_size\n"; - return true; - } + function stream_truncate($new_size) { + echo "truncation with new_size=$new_size\n"; + return true; + } } class test_wrapper_bad extends test_wrapper_base { - function stream_truncate($new_size) { - echo "truncation with new_size=$new_size\n"; - return "kkk"; - } + function stream_truncate($new_size) { + echo "truncation with new_size=$new_size\n"; + return "kkk"; + } } function test($name, $fd, $dest_size) { - echo "------ $name: -------\n"; - var_dump(ftruncate($fd, $dest_size)); + echo "------ $name: -------\n"; + var_dump(ftruncate($fd, $dest_size)); } var_dump(stream_wrapper_register('test', 'test_wrapper')); var_dump(stream_wrapper_register('test2', 'test_wrapper_base')); diff --git a/ext/standard/tests/file/userstreams_006.phpt b/ext/standard/tests/file/userstreams_006.phpt index 3269ccce3e..561bea4fb5 100644 --- a/ext/standard/tests/file/userstreams_006.phpt +++ b/ext/standard/tests/file/userstreams_006.phpt @@ -3,20 +3,20 @@ User-space streams: set_options returns "not implemented" for unhandled option t --FILE-- <?php class test_wrapper { - function stream_open($path, $mode, $openedpath) { - return true; - } - function stream_eof() { - return false; - } - function stream_write($data) { - echo "size: ", strlen($data), "\n"; - return strlen($data); - } - function stream_set_option($option, $arg1, $arg2) { - echo "option: ", $option, ", ", $arg1, ", ", $arg2, "\n"; - return false; - } + function stream_open($path, $mode, $openedpath) { + return true; + } + function stream_eof() { + return false; + } + function stream_write($data) { + echo "size: ", strlen($data), "\n"; + return strlen($data); + } + function stream_set_option($option, $arg1, $arg2) { + echo "option: ", $option, ", ", $arg1, ", ", $arg2, "\n"; + return false; + } } var_dump(stream_wrapper_register('test', 'test_wrapper')); diff --git a/ext/standard/tests/file/userstreams_007.phpt b/ext/standard/tests/file/userstreams_007.phpt index b3e52bb098..31a7e4f872 100644 --- a/ext/standard/tests/file/userstreams_007.phpt +++ b/ext/standard/tests/file/userstreams_007.phpt @@ -3,19 +3,19 @@ User-space streams: test metadata option --FILE-- <?php class test_wrapper { - function stream_open($path, $mode, $openedpath) { - return true; - } + function stream_open($path, $mode, $openedpath) { + return true; + } public function stream_metadata($path, $option, $var) { - echo "metadata: $path, $option\n"; - if(is_array($var)) { - echo join(",", $var); - } else { - echo $var; - } - echo "\n"; - return false; - } + echo "metadata: $path, $option\n"; + if(is_array($var)) { + echo join(",", $var); + } else { + echo $var; + } + echo "\n"; + return false; + } } var_dump(stream_wrapper_register('test', 'test_wrapper')); diff --git a/ext/standard/tests/file/userwrapper.phpt b/ext/standard/tests/file/userwrapper.phpt index dd4f0d3dd1..6e516d68db 100644 --- a/ext/standard/tests/file/userwrapper.phpt +++ b/ext/standard/tests/file/userwrapper.phpt @@ -20,9 +20,9 @@ class test { } function url_stat($path, $options) { - /* By printing out a notice that we are actively stating the file - then subsequently performing multiple stat operations on it - we effectively test the stat cache mechanism */ + /* By printing out a notice that we are actively stating the file + then subsequently performing multiple stat operations on it + we effectively test the stat cache mechanism */ print "Stating file: $path\n"; return array('dev'=>1, 'ino'=>2, 'mode'=>0644, 'nlink'=>3, 'uid'=>100, 'gid'=>1000, 'rdev'=>-1, 'size'=>31337, diff --git a/ext/standard/tests/file/windows_acls/bug44859.phpt b/ext/standard/tests/file/windows_acls/bug44859.phpt index 679734b379..513c3a6af8 100644 --- a/ext/standard/tests/file/windows_acls/bug44859.phpt +++ b/ext/standard/tests/file/windows_acls/bug44859.phpt @@ -12,42 +12,42 @@ include_once __DIR__ . '/common.inc'; fix_acls(); $iteration = array( - PHPT_ACL_READ => false, - PHPT_ACL_NONE => false, - PHPT_ACL_WRITE => true, - PHPT_ACL_WRITE|PHPT_ACL_READ => true, + PHPT_ACL_READ => false, + PHPT_ACL_NONE => false, + PHPT_ACL_WRITE => true, + PHPT_ACL_WRITE|PHPT_ACL_READ => true, ); echo "Testing file:\n"; $i = 1; $path = $uniqueBasePath . '_file.txt'; foreach ($iteration as $perms => $exp) { - create_file($path, $perms); - clearstatcache(true, $path); - echo 'Iteration #' . $i++ . ': '; - if (is_writable($path) == $exp) { - echo "passed.\n"; - } else { - var_dump(is_writable($path), $exp); - echo "failed.\n"; - } - delete_file($path); + create_file($path, $perms); + clearstatcache(true, $path); + echo 'Iteration #' . $i++ . ': '; + if (is_writable($path) == $exp) { + echo "passed.\n"; + } else { + var_dump(is_writable($path), $exp); + echo "failed.\n"; + } + delete_file($path); } echo "Testing directory:\n"; $path = $uniqueBasePath . '_dir'; $i = 1; foreach ($iteration as $perms => $exp) { - create_dir($path, $perms); - clearstatcache(true, $path); - echo 'Iteration #' . $i++ . ': '; - if (is_writable($path) == $exp) { - echo "passed.\n"; - } else { - var_dump(is_writable($path), $exp); - echo "failed.\n"; - } - delete_dir($path); + create_dir($path, $perms); + clearstatcache(true, $path); + echo 'Iteration #' . $i++ . ': '; + if (is_writable($path) == $exp) { + echo "passed.\n"; + } else { + var_dump(is_writable($path), $exp); + echo "failed.\n"; + } + delete_dir($path); } ?> diff --git a/ext/standard/tests/file/windows_acls/bug44859_2.phpt b/ext/standard/tests/file/windows_acls/bug44859_2.phpt index b88d07f820..4b5fd9e139 100644 --- a/ext/standard/tests/file/windows_acls/bug44859_2.phpt +++ b/ext/standard/tests/file/windows_acls/bug44859_2.phpt @@ -12,42 +12,42 @@ include_once __DIR__ . '/common.inc'; fix_acls(); $iteration = array( - PHPT_ACL_READ => true, - PHPT_ACL_NONE => false, - PHPT_ACL_WRITE => false, - PHPT_ACL_WRITE|PHPT_ACL_READ => true, + PHPT_ACL_READ => true, + PHPT_ACL_NONE => false, + PHPT_ACL_WRITE => false, + PHPT_ACL_WRITE|PHPT_ACL_READ => true, ); echo "Testing file:\n"; $i = 1; $path = $uniqueBasePath . '_file.txt'; foreach ($iteration as $perms => $exp) { - create_file($path, $perms); - clearstatcache(true, $path); - echo 'Iteration #' . $i++ . ': '; - if (is_readable($path) == $exp) { - echo "passed.\n"; - } else { - var_dump(is_readable($path), $exp); - echo "failed.\n"; - } - delete_file($path); + create_file($path, $perms); + clearstatcache(true, $path); + echo 'Iteration #' . $i++ . ': '; + if (is_readable($path) == $exp) { + echo "passed.\n"; + } else { + var_dump(is_readable($path), $exp); + echo "failed.\n"; + } + delete_file($path); } echo "Testing directory:\n"; $path = $uniqueBasePath . '_dir'; $i = 1; foreach ($iteration as $perms => $exp) { - create_dir($path, $perms); - clearstatcache(true, $path); - echo 'Iteration #' . $i++ . ': '; - if (is_readable($path) == $exp) { - echo "passed.\n"; - } else { - var_dump(is_readable($path), $exp); - echo "failed.\n"; - } - delete_dir($path); + create_dir($path, $perms); + clearstatcache(true, $path); + echo 'Iteration #' . $i++ . ': '; + if (is_readable($path) == $exp) { + echo "passed.\n"; + } else { + var_dump(is_readable($path), $exp); + echo "failed.\n"; + } + delete_dir($path); } ?> diff --git a/ext/standard/tests/file/windows_acls/bug44859_3.phpt b/ext/standard/tests/file/windows_acls/bug44859_3.phpt index 35db1f29be..465c7557ac 100644 --- a/ext/standard/tests/file/windows_acls/bug44859_3.phpt +++ b/ext/standard/tests/file/windows_acls/bug44859_3.phpt @@ -11,23 +11,23 @@ include_once __DIR__ . '/common.inc'; fix_acls(); $iteration = array( - 'tiny.exe' => true, - //'tiny.bat' => true, To be fixed in _access - __FILE__ => false + 'tiny.exe' => true, + //'tiny.bat' => true, To be fixed in _access + __FILE__ => false ); $i = 1; $path = __DIR__; foreach ($iteration as $file => $exp) { - $path = __DIR__ . '/' . $file; - echo 'Iteration #' . $i++ . ': '; - if (is_executable($path) == $exp) { - echo "passed.\n"; - } else { - var_dump(is_executable($path), $exp); - echo "failed.\n"; - } + $path = __DIR__ . '/' . $file; + echo 'Iteration #' . $i++ . ': '; + if (is_executable($path) == $exp) { + echo "passed.\n"; + } else { + var_dump(is_executable($path), $exp); + echo "failed.\n"; + } } diff --git a/ext/standard/tests/file/windows_acls/bug44859_4.phpt b/ext/standard/tests/file/windows_acls/bug44859_4.phpt index e0fbe11f4b..483438bcf6 100644 --- a/ext/standard/tests/file/windows_acls/bug44859_4.phpt +++ b/ext/standard/tests/file/windows_acls/bug44859_4.phpt @@ -14,42 +14,42 @@ include_once __DIR__ . '/common.inc'; fix_acls(); $iteration = array( - PHPT_ACL_READ => true, - PHPT_ACL_NONE => false, - PHPT_ACL_WRITE => false, - PHPT_ACL_WRITE|PHPT_ACL_READ => true, + PHPT_ACL_READ => true, + PHPT_ACL_NONE => false, + PHPT_ACL_WRITE => false, + PHPT_ACL_WRITE|PHPT_ACL_READ => true, ); echo "Testing file with relative path:\n"; $i = 1; $path = './' . $uniqueBaseName . '_file.txt'; foreach ($iteration as $perms => $exp) { - create_file($path, $perms); - clearstatcache(true, $path); - echo 'Iteration #' . $i++ . ': '; - if (is_readable($path) == $exp) { - echo "passed.\n"; - } else { - var_dump(is_readable($path), $exp); - echo "failed.\n"; - } - delete_file($path); + create_file($path, $perms); + clearstatcache(true, $path); + echo 'Iteration #' . $i++ . ': '; + if (is_readable($path) == $exp) { + echo "passed.\n"; + } else { + var_dump(is_readable($path), $exp); + echo "failed.\n"; + } + delete_file($path); } echo "Testing directory with relative path:\n"; $path = $uniqueBaseName . '_dir'; $i = 1; foreach ($iteration as $perms => $exp) { - create_dir($path, $perms); - clearstatcache(true, $path); - echo 'Iteration #' . $i++ . ': '; - if (is_readable($path) == $exp) { - echo "passed.\n"; - } else { - var_dump(is_readable($path), $exp); - echo "failed.\n"; - } - delete_dir($path); + create_dir($path, $perms); + clearstatcache(true, $path); + echo 'Iteration #' . $i++ . ': '; + if (is_readable($path) == $exp) { + echo "passed.\n"; + } else { + var_dump(is_readable($path), $exp); + echo "failed.\n"; + } + delete_dir($path); } ?> diff --git a/ext/standard/tests/file/windows_acls/common.inc b/ext/standard/tests/file/windows_acls/common.inc index 5d4b402840..b3490ebb43 100644 --- a/ext/standard/tests/file/windows_acls/common.inc +++ b/ext/standard/tests/file/windows_acls/common.inc @@ -10,161 +10,161 @@ define('PHPT_ACL_GRANT', 1); define('PHPT_ACL_DENY', 2); function skipif() { - if(substr(PHP_OS, 0, 3) != 'WIN' ) { - die('skip windows only test'); - } - if(stripos(php_uname(), 'XP') !== FALSE) { - die('skip windows 2003 or newer only test'); - } + if(substr(PHP_OS, 0, 3) != 'WIN' ) { + die('skip windows only test'); + } + if(stripos(php_uname(), 'XP') !== FALSE) { + die('skip windows 2003 or newer only test'); + } } function get_username(){ - $user = getenv('USERNAME'); + $user = getenv('USERNAME'); - if (!$user) { - $user = get_current_user(); - } + if (!$user) { + $user = get_current_user(); + } - if (!$user) { - $user = exec('echo %USERNAME%'); - } + if (!$user) { + $user = exec('echo %USERNAME%'); + } - return $user; + return $user; } function get_domainname() { - $domain = getenv('USERDOMAIN'); + $domain = getenv('USERDOMAIN'); - return $domain; + return $domain; } function get_icacls() { - $sysroot = exec('echo %SYSTEMROOT%'); + $sysroot = exec('echo %SYSTEMROOT%'); - return "$sysroot\\System32\\icacls.exe"; + return "$sysroot\\System32\\icacls.exe"; } function fix_acls() { - $user = get_username(); - /* Current user needs to be owner of the test files. As well - all the other users having acls on the files must loose them. - The following fixes this just partially, as dynamically reading - all the users having acls on a file could be sophisticated. */ - exec(get_icacls() . ' ' . __DIR__ . ' /setowner ' . escapeshellarg($user) . ' /T /L /Q /C > nul 2>&1'); - exec(get_icacls() . ' ' . __DIR__ . ' /remove:g Administrators /T /L /Q /C > nul 2>&1'); + $user = get_username(); + /* Current user needs to be owner of the test files. As well + all the other users having acls on the files must loose them. + The following fixes this just partially, as dynamically reading + all the users having acls on a file could be sophisticated. */ + exec(get_icacls() . ' ' . __DIR__ . ' /setowner ' . escapeshellarg($user) . ' /T /L /Q /C > nul 2>&1'); + exec(get_icacls() . ' ' . __DIR__ . ' /remove:g Administrators /T /L /Q /C > nul 2>&1'); } function icacls_set($path, $mode, $perm) { - $icacls = get_icacls(); - $user = get_username(); - $path_escaped = '"' . $path . '"'; - $perm_entry = array(); - - if ($perm & PHPT_ACL_READ) $perm_entry[] = 'R'; - if ($perm & PHPT_ACL_WRITE) $perm_entry[] = 'W'; - if ($perm & PHPT_ACL_EXEC) $perm_entry[] = 'RX'; - if ($perm & PHPT_ACL_FULL) $perm_entry[] = 'F'; - - // Deny all - $cmd = $icacls . ' ' . $path_escaped . ' /inheritance:r /deny ' . $user . ':(F,M,R,RX,W)'; - exec($cmd); - - if ($perm & PHPT_ACL_NONE) { - /* - This is required to remove all the previously denied - permission for the USER. Just granting permission doesn't - remove the previously denied permission. - */ - $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user; - exec($cmd); - $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user; - exec($cmd); - return; - } - - if ($mode == PHPT_ACL_GRANT) { - $mode = 'grant'; - } else { - $mode = 'deny'; - } - - - // Deny all - $cmd = $icacls . ' ' . $path_escaped . ' /deny ' . $user . ':(F,M,R,RX,W)'; - exec($cmd); - - /* - This is required to remove all the previously denied - permission for the USER. Just granting permission doesn't - remove the previously denied permission. - */ - $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user; - exec($cmd); - $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user; - exec($cmd); - - - /* - Required to set no permission and check that is_readable() - returns false. If the $perm_entry contains 'N' skip this step. - This will make the file/dir with NO aceess. - */ - if (!in_array('N', $perm_entry)) { - /* - This is required to remove all the previously denied - permission for the USER. Just granting permission doesn't - remove the previously denied permission. - */ - $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user; - exec($cmd); - $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user; - exec($cmd); - - $cmd = $icacls . ' ' . $path_escaped . ' /' . $mode . ' ' . $user; - $cmd .= ':' . '(' . implode(',', $perm_entry) . ')'; - exec($cmd); - } + $icacls = get_icacls(); + $user = get_username(); + $path_escaped = '"' . $path . '"'; + $perm_entry = array(); + + if ($perm & PHPT_ACL_READ) $perm_entry[] = 'R'; + if ($perm & PHPT_ACL_WRITE) $perm_entry[] = 'W'; + if ($perm & PHPT_ACL_EXEC) $perm_entry[] = 'RX'; + if ($perm & PHPT_ACL_FULL) $perm_entry[] = 'F'; + + // Deny all + $cmd = $icacls . ' ' . $path_escaped . ' /inheritance:r /deny ' . $user . ':(F,M,R,RX,W)'; + exec($cmd); + + if ($perm & PHPT_ACL_NONE) { + /* + This is required to remove all the previously denied + permission for the USER. Just granting permission doesn't + remove the previously denied permission. + */ + $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user; + exec($cmd); + $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user; + exec($cmd); + return; + } + + if ($mode == PHPT_ACL_GRANT) { + $mode = 'grant'; + } else { + $mode = 'deny'; + } + + + // Deny all + $cmd = $icacls . ' ' . $path_escaped . ' /deny ' . $user . ':(F,M,R,RX,W)'; + exec($cmd); + + /* + This is required to remove all the previously denied + permission for the USER. Just granting permission doesn't + remove the previously denied permission. + */ + $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user; + exec($cmd); + $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user; + exec($cmd); + + + /* + Required to set no permission and check that is_readable() + returns false. If the $perm_entry contains 'N' skip this step. + This will make the file/dir with NO aceess. + */ + if (!in_array('N', $perm_entry)) { + /* + This is required to remove all the previously denied + permission for the USER. Just granting permission doesn't + remove the previously denied permission. + */ + $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user; + exec($cmd); + $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user; + exec($cmd); + + $cmd = $icacls . ' ' . $path_escaped . ' /' . $mode . ' ' . $user; + $cmd .= ':' . '(' . implode(',', $perm_entry) . ')'; + exec($cmd); + } } function create_dir($name, $perms) { - if (empty($name)) { - echo "create_dir: Empty name is not allowed\n"; - return; - } - - mkdir($name); - $dst = realpath($name); - icacls_set($name, PHPT_ACL_GRANT, $perms); + if (empty($name)) { + echo "create_dir: Empty name is not allowed\n"; + return; + } + + mkdir($name); + $dst = realpath($name); + icacls_set($name, PHPT_ACL_GRANT, $perms); } function create_file($name, $perms) { - if (empty($name)) { - echo "create_file: Empty name is not allowed\n"; - return; - } + if (empty($name)) { + echo "create_file: Empty name is not allowed\n"; + return; + } - touch($name); - icacls_set($name, PHPT_ACL_GRANT, $perms); + touch($name); + icacls_set($name, PHPT_ACL_GRANT, $perms); } function delete_file($path) { - icacls_set($path, PHPT_ACL_GRANT, PHPT_ACL_FULL); - if (is_file($path)) { - unlink($path); - } else { - echo "delete_file: '$path' is not a file\n"; - return; - } + icacls_set($path, PHPT_ACL_GRANT, PHPT_ACL_FULL); + if (is_file($path)) { + unlink($path); + } else { + echo "delete_file: '$path' is not a file\n"; + return; + } } function delete_dir($path) { - if (is_dir($path)) { - icacls_set($path, PHPT_ACL_GRANT, PHPT_ACL_FULL); - rmdir($path); - } else { - echo "delete_dir: '$path' is not a directory\n"; - return; - } + if (is_dir($path)) { + icacls_set($path, PHPT_ACL_GRANT, PHPT_ACL_FULL); + rmdir($path); + } else { + echo "delete_dir: '$path' is not a directory\n"; + return; + } } diff --git a/ext/standard/tests/file/windows_links/common.inc b/ext/standard/tests/file/windows_links/common.inc index 505368b8b0..4d4409e9d8 100644 --- a/ext/standard/tests/file/windows_links/common.inc +++ b/ext/standard/tests/file/windows_links/common.inc @@ -1,23 +1,23 @@ <?php function get_sysroot() { - // usually c:\\windows, but not always - return exec('echo %SYSTEMROOT%'); + // usually c:\\windows, but not always + return exec('echo %SYSTEMROOT%'); } function get_junction(){ - // junction.exe isn't included with Windows - // its a sysinternals tool for working with filesystem links - // see: http://technet.microsoft.com/en-us/sysinternals/bb896768 + // junction.exe isn't included with Windows + // its a sysinternals tool for working with filesystem links + // see: http://technet.microsoft.com/en-us/sysinternals/bb896768 - // install somewhere that is on %path% or added to %path% - return "junction.exe"; + // install somewhere that is on %path% or added to %path% + return "junction.exe"; } function get_mountvol() { - $sysroot = get_sysroot(); + $sysroot = get_sysroot(); - return "$sysroot\\System32\\mountvol.exe"; + return "$sysroot\\System32\\mountvol.exe"; } ?> diff --git a/ext/standard/tests/file/windows_links/readlink_compat.phpt b/ext/standard/tests/file/windows_links/readlink_compat.phpt index e119473895..b4ac07682e 100644 --- a/ext/standard/tests/file/windows_links/readlink_compat.phpt +++ b/ext/standard/tests/file/windows_links/readlink_compat.phpt @@ -20,7 +20,7 @@ mkdir($tmpDir); // mounted volume $volume = trim(exec('mountvol C: /L')); exec(sprintf('mountvol "%s" %s', $tmpDir, $volume)); -var_dump(readlink($tmpDir)); +var_dump(readlink($tmpDir)); exec(sprintf('mountvol "%s" /D', $tmpDir)); mkdir($tmpDir . '\\test\\directory', 0777, true); @@ -35,7 +35,7 @@ rmdir($link); // junction to a directory $link = $tmpDir . '\\test\\directory_junction'; $target = $tmpDir . '\\test\\directory'; -exec(sprintf('mklink /J "%s" "%s"', $link, $target)); +exec(sprintf('mklink /J "%s" "%s"', $link, $target)); var_dump(readlink($link)); rmdir($link); @@ -56,7 +56,7 @@ fclose($fh); // symlink to a file (absolute and relative) $link = $tmpDir . '\\test\\file_symlink'; -exec(sprintf('mklink "%s" "%s"', $link, $filename)); +exec(sprintf('mklink "%s" "%s"', $link, $filename)); var_dump(readlink($link)); unlink($link); exec(sprintf('mklink "%s" directory\\a.php', $link)); @@ -64,7 +64,7 @@ var_dump(readlink($link)); unlink($link); // unexpected behaviour -echo "\n*** Unexpected behaviour when not a reparse point\n"; +echo "\n*** Unexpected behaviour when not a reparse point\n"; var_dump(readlink($tmpDir . '\\test\\directory')); var_dump(readlink($filename)); diff --git a/ext/standard/tests/file/windows_mb_path/bug54028.phpt b/ext/standard/tests/file/windows_mb_path/bug54028.phpt index 9c11be61f4..6f3e6dab51 100644 --- a/ext/standard/tests/file/windows_mb_path/bug54028.phpt +++ b/ext/standard/tests/file/windows_mb_path/bug54028.phpt @@ -22,23 +22,23 @@ $dirs = array("a", "ソ", "ゾ", "şŞıİğĞ", "多国語", "王", "æ±šã‚Œã¦æ mkdir($prefix); foreach ($dirs as $d) { - mkdir($prefix . $d); + mkdir($prefix . $d); } $directory = dir($prefix); while (false !== ($content = $directory->read())) { - if ("." == $content || ".." == $content) continue; + if ("." == $content || ".." == $content) continue; printf("Returned (%s)\n", $content); printf("Encoding: %s\n", mb_detect_encoding($content)); if ($content != get_basename_with_cp($prefix . $content, 65001, false)) { - echo "Verification failed!\n"; - } - echo "\n"; + echo "Verification failed!\n"; + } + echo "\n"; } foreach ($dirs as $d) { - rmdir($prefix . $d); + rmdir($prefix . $d); } rmdir($prefix); diff --git a/ext/standard/tests/file/windows_mb_path/bug54028_2.phpt b/ext/standard/tests/file/windows_mb_path/bug54028_2.phpt index 87e7c162b0..d6ef5925a8 100644 --- a/ext/standard/tests/file/windows_mb_path/bug54028_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/bug54028_2.phpt @@ -22,20 +22,20 @@ $dirs = array("a", "ソ", "ゾ", "şŞıİğĞ", "多国語", "王", "æ±šã‚Œã¦æ mkdir($prefix); foreach ($dirs as $d) { - mkdir($prefix . $d); + mkdir($prefix . $d); } $old_cwd = getcwd(); foreach ($dirs as $d) { - $now = $prefix . $d; - var_dump(chdir($now)); - var_dump($dn = realpath(".")); - var_dump($d == get_basename_with_cp($dn, 65001, false)); + $now = $prefix . $d; + var_dump(chdir($now)); + var_dump($dn = realpath(".")); + var_dump($d == get_basename_with_cp($dn, 65001, false)); } chdir($old_cwd); foreach ($dirs as $d) { - rmdir($prefix . $d); + rmdir($prefix . $d); } rmdir($prefix); diff --git a/ext/standard/tests/file/windows_mb_path/bug54977.phpt b/ext/standard/tests/file/windows_mb_path/bug54977.phpt index b8749576ae..5edead63ed 100644 --- a/ext/standard/tests/file/windows_mb_path/bug54977.phpt +++ b/ext/standard/tests/file/windows_mb_path/bug54977.phpt @@ -22,19 +22,19 @@ $paths = array("多国語", "王", "æ±šã‚Œã¦æŽ˜ã‚‹"); mkdir($prefix); foreach ($paths as $d) { - mkdir($prefix . $d); - file_put_contents($prefix . $d . ".test", $d); + mkdir($prefix . $d); + file_put_contents($prefix . $d . ".test", $d); } $myDirectory = opendir($prefix); while($entryName = readdir($myDirectory)) { - echo get_basename_with_cp($prefix . $entryName, 65001, false) . "\n"; + echo get_basename_with_cp($prefix . $entryName, 65001, false) . "\n"; } closedir($myDirectory); foreach ($paths as $d) { - rmdir($prefix . $d); - unlink($prefix . $d . ".test"); + rmdir($prefix . $d); + unlink($prefix . $d . ".test"); } rmdir($prefix); diff --git a/ext/standard/tests/file/windows_mb_path/bug64506.phpt b/ext/standard/tests/file/windows_mb_path/bug64506.phpt index fa9653fbd2..0bcf0d778c 100644 --- a/ext/standard/tests/file/windows_mb_path/bug64506.phpt +++ b/ext/standard/tests/file/windows_mb_path/bug64506.phpt @@ -22,9 +22,9 @@ $fnw = __DIR__ . DIRECTORY_SEPARATOR . "Å¡.txt"; // UTF-8 $f = fopen($fnw, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump($f, fwrite($f, "writing to an mb filename")); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(fclose($f)); diff --git a/ext/standard/tests/file/windows_mb_path/bug64699.phpt b/ext/standard/tests/file/windows_mb_path/bug64699.phpt index 8b6859176f..20d4182b71 100644 --- a/ext/standard/tests/file/windows_mb_path/bug64699.phpt +++ b/ext/standard/tests/file/windows_mb_path/bug64699.phpt @@ -25,7 +25,7 @@ $dirs = array("a", "ソ", "ゾ", "şŞıİğĞ", "多国語", "表"); mkdir($prefix); foreach ($dirs as $d) { - mkdir($prefix . $d); + mkdir($prefix . $d); } $dir = $prefix; @@ -41,7 +41,7 @@ if ($dh = opendir($dir)) { } foreach ($dirs as $d) { - rmdir($prefix . $d); + rmdir($prefix . $d); } rmdir($prefix); diff --git a/ext/standard/tests/file/windows_mb_path/bug74923.phpt b/ext/standard/tests/file/windows_mb_path/bug74923.phpt index 544a7110ee..9cffd5860f 100644 --- a/ext/standard/tests/file/windows_mb_path/bug74923.phpt +++ b/ext/standard/tests/file/windows_mb_path/bug74923.phpt @@ -12,7 +12,7 @@ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); <?php /* No way to affect timeout here. On different systems this might take some - dozens of seconds to complete. */ + dozens of seconds to complete. */ $s = '\\\\hello.com' . str_repeat('\\', 260); diff --git a/ext/standard/tests/file/windows_mb_path/bug75063_cp1251.phpt b/ext/standard/tests/file/windows_mb_path/bug75063_cp1251.phpt index c841aff194..32cb2adead 100644 --- a/ext/standard/tests/file/windows_mb_path/bug75063_cp1251.phpt +++ b/ext/standard/tests/file/windows_mb_path/bug75063_cp1251.phpt @@ -34,16 +34,16 @@ $code = <<<CODE <?php foreach(["test", "òàñò"] as \$fn) { - file_put_contents("\$fn.txt", ""); + file_put_contents("\$fn.txt", ""); } var_dump(getcwd()); if (\$dh = opendir(getcwd())) { - while ((\$file = readdir(\$dh)) !== false) { - if ("." == \$file || ".." == \$file) continue; - var_dump(\$file); - } - closedir(\$dh); + while ((\$file = readdir(\$dh)) !== false) { + if ("." == \$file || ".." == \$file) continue; + var_dump(\$file); + } + closedir(\$dh); } CODE; $code_fn = "code.php"; @@ -53,7 +53,7 @@ print(shell_exec(getenv('TEST_PHP_EXECUTABLE') . " -n -d default_charset=cp1251 chdir($old_cwd); -/* --CLEAN-- section were the right place, but it won't accept default_charset ATM, it seems. */ +/*--CLEAN-- section were the right place, but it won't accept default_charset ATM, it seems. */ $dir_basename = "òåñò"; $prefix = __DIR__ . DIRECTORY_SEPARATOR . "bug75063-cp1251"; $d0 = $prefix . DIRECTORY_SEPARATOR . $dir_basename; diff --git a/ext/standard/tests/file/windows_mb_path/bug75063_utf8.phpt b/ext/standard/tests/file/windows_mb_path/bug75063_utf8.phpt index 49a5229cf6..b8235c8842 100644 --- a/ext/standard/tests/file/windows_mb_path/bug75063_utf8.phpt +++ b/ext/standard/tests/file/windows_mb_path/bug75063_utf8.phpt @@ -32,16 +32,16 @@ $code = <<<CODE <?php foreach(["test", "таÑÑ‚"] as \$fn) { - file_put_contents("\$fn.txt", ""); + file_put_contents("\$fn.txt", ""); } var_dump(getcwd()); if (\$dh = opendir(getcwd())) { - while ((\$file = readdir(\$dh)) !== false) { - if ("." == \$file || ".." == \$file) continue; - var_dump(\$file); - } - closedir(\$dh); + while ((\$file = readdir(\$dh)) !== false) { + if ("." == \$file || ".." == \$file) continue; + var_dump(\$file); + } + closedir(\$dh); } CODE; $code_fn = "code.php"; diff --git a/ext/standard/tests/file/windows_mb_path/recursive_it.phpt b/ext/standard/tests/file/windows_mb_path/recursive_it.phpt index 538aa0ad21..fb97086b2b 100644 --- a/ext/standard/tests/file/windows_mb_path/recursive_it.phpt +++ b/ext/standard/tests/file/windows_mb_path/recursive_it.phpt @@ -15,7 +15,7 @@ $need_len = 1024; //$need_len = 259; $dir = __DIR__; while ($need_len - strlen($dir) > 32) { - $dir .= DIRECTORY_SEPARATOR . str_repeat("a", 32); + $dir .= DIRECTORY_SEPARATOR . str_repeat("a", 32); } $dir .= DIRECTORY_SEPARATOR . str_repeat("a", $need_len - strlen($dir)); mkdir($dir, 0700, true); @@ -26,34 +26,34 @@ file_put_contents($fl, ""); $start = substr($dir, 0, strpos($dir, DIRECTORY_SEPARATOR, strlen(__DIR__)+1)); $iter = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator( - $start, - FilesystemIterator::SKIP_DOTS - ), - RecursiveIteratorIterator::CHILD_FIRST + new RecursiveDirectoryIterator( + $start, + FilesystemIterator::SKIP_DOTS + ), + RecursiveIteratorIterator::CHILD_FIRST ); foreach ($iter as $item) { - if (!$item->isDir()) { - var_dump($item->getPathname()); - } + if (!$item->isDir()) { + var_dump($item->getPathname()); + } } $iter->rewind(); foreach ($iter as $item) { - if ($item->isDir()) { - rmdir($item->getPathname()); - } else { - unlink($item->getPathname()); - } + if ($item->isDir()) { + rmdir($item->getPathname()); + } else { + unlink($item->getPathname()); + } } rmdir($start); var_dump(file_exists($start)); /*unlink($fl); do { - rmdir($dir); - $dir = dirname($dir); + rmdir($dir); + $dir = dirname($dir); } while (__DIR__ != $dir);*/ ?> diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_0.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_0.phpt index 39a6d30c77..41fd2e7552 100644 --- a/ext/standard/tests/file/windows_mb_path/test_big5_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_big5_0.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "$item"; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_big5"); diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_2.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_2.phpt index 5cc2c736ec..5460ae9dfa 100644 --- a/ext/standard/tests/file/windows_mb_path/test_big5_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_big5_2.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "{$item}25"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_0.phpt index 4a6dd19864..0dcc09dae9 100644 --- a/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_0.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "$item"; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_big5"); diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_2.phpt index e9294ababd..6269aaf050 100644 --- a/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_2.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "{$item}25"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_0.phpt index 6de73c02a8..10db18c19b 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_0.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp1250"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_2.phpt index 82255919ab..571daff094 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_2.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_3.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_3.phpt index d359158564..568f56361b 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_3.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_3.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp1250"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_5.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_5.phpt index d5230c3782..ef9e17b7f2 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_5.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_5.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_0.phpt index aeedc2c875..d1c4f0f4fc 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1251_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_0.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp1251"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_2.phpt index 06bc8d2d87..1161747564 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1251_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_2.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}7"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_0.phpt index dc870e829d..b780065d90 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_0.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp1251"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_2.phpt index b5192dcf84..251fa2c000 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_2.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}7"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_0.phpt index 9694e54ffd..2f28a922e3 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_0.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open failed\n"; + echo "open failed\n"; } remove_data("file_cp1251"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_2.phpt index 3788ef2411..d6ff64e4e5 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_2.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open failed\n"; + echo "open failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_0.phpt index 8a601bf666..e85636d989 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_0.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp1252"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_2.phpt index dc042a0475..0709d1270c 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_2.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}7"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_3.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_3.phpt index 264558a657..3abbc58205 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_3.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_3.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file2_cp1252"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_5.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_5.phpt index 1945fc54be..8f45ed24e4 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_5.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_5.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}7"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_0.phpt index 08ab2aa7bb..8ed2b2d97b 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1253_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_0.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp1253"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_2.phpt index c1ea99e32b..88f28fa281 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1253_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_2.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_0.phpt index 675bdd12c4..4f0d601d4a 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_0.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp1253"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_2.phpt index 8210704b3f..af329eadcf 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_2.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_0.phpt index 1ceefc759e..d619576ad5 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1254_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_0.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp1254"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_2.phpt index 4de9478b32..f6357366e7 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1254_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_2.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_0.phpt index 39308b3368..eac345d8be 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_0.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp1254"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_2.phpt index 1f0c7816ec..09caa2c386 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_2.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_0.phpt index 26388620a1..c360e82119 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1255_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_0.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp1255"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_2.phpt index 4b7ac57968..346620c6c5 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1255_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_2.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_0.phpt index c9517a18e3..c930515c57 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_0.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp1255"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_2.phpt index 363d1b02b5..8e18ca690f 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_2.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_0.phpt index 35ad1def2e..5619b33f06 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1256_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_0.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp1256"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_2.phpt index b277fc208b..e756a3e093 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1256_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_2.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_0.phpt index 306414e5ca..d7e0ed5afc 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_0.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp1256"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_2.phpt index 38ae6a4754..b05c4301e5 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_2.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp874_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp874_0.phpt index 7beae3a6bb..e8bc394a5d 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp874_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp874_0.phpt @@ -22,27 +22,27 @@ default_charset=cp874 include __DIR__ . DIRECTORY_SEPARATOR . "util.inc"; $names = array( /* cp874 */ - "à»ç¹á¿éÁ·Õè·´Êͺ1", - "à»ç¹á¿éÁ·Õè·´Êͺ2", - "à»ç¹á¿éÁ·Õè·´Êͺ3", - "à»ç¹á¿éÁ·Õè·´Êͺ4", - "à»ç¹á¿éÁ·Õè·´Êͺ5", - "à»ç¹á¿éÁ·Õè·´Êͺ6", - "à»ç¹á¿éÁ·Õè·´Êͺ7", - "à»ç¹á¿éÁ·Õè·´Êͺ8", - "à»ç¹á¿éÁ·Õè·´Êͺ8 10", + "à»ç¹á¿éÁ·Õè·´Êͺ1", + "à»ç¹á¿éÁ·Õè·´Êͺ2", + "à»ç¹á¿éÁ·Õè·´Êͺ3", + "à»ç¹á¿éÁ·Õè·´Êͺ4", + "à»ç¹á¿éÁ·Õè·´Êͺ5", + "à»ç¹á¿éÁ·Õè·´Êͺ6", + "à»ç¹á¿éÁ·Õè·´Êͺ7", + "à»ç¹á¿éÁ·Õè·´Êͺ8", + "à»ç¹á¿éÁ·Õè·´Êͺ8 10", ); $i = 0; foreach ($names as $name) { - $path = __DIR__ . DIRECTORY_SEPARATOR . $name . ".txt"; + $path = __DIR__ . DIRECTORY_SEPARATOR . $name . ".txt"; - file_put_contents($path, "hello" . $i++); + file_put_contents($path, "hello" . $i++); - get_basename_with_cp($path, 874); - var_dump(file_get_contents($path)); + get_basename_with_cp($path, 874); + var_dump(file_get_contents($path)); - unlink($path); + unlink($path); } ?> diff --git a/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_0.phpt index 009fcf16a5..c21f124b6e 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_0.phpt @@ -19,27 +19,27 @@ skip_if_no_required_exts(); include __DIR__ . DIRECTORY_SEPARATOR . "util.inc"; $names = array( /* cp874 */ - "à»ç¹á¿éÁ·Õè·´Êͺ1", - "à»ç¹á¿éÁ·Õè·´Êͺ2", - "à»ç¹á¿éÁ·Õè·´Êͺ3", - "à»ç¹á¿éÁ·Õè·´Êͺ4", - "à»ç¹á¿éÁ·Õè·´Êͺ5", - "à»ç¹á¿éÁ·Õè·´Êͺ6", - "à»ç¹á¿éÁ·Õè·´Êͺ7", - "à»ç¹á¿éÁ·Õè·´Êͺ8", - "à»ç¹á¿éÁ·Õè·´Êͺ8 10", + "à»ç¹á¿éÁ·Õè·´Êͺ1", + "à»ç¹á¿éÁ·Õè·´Êͺ2", + "à»ç¹á¿éÁ·Õè·´Êͺ3", + "à»ç¹á¿éÁ·Õè·´Êͺ4", + "à»ç¹á¿éÁ·Õè·´Êͺ5", + "à»ç¹á¿éÁ·Õè·´Êͺ6", + "à»ç¹á¿éÁ·Õè·´Êͺ7", + "à»ç¹á¿éÁ·Õè·´Êͺ8", + "à»ç¹á¿éÁ·Õè·´Êͺ8 10", ); $i = 0; foreach ($names as $name) { - $pathw = __DIR__ . DIRECTORY_SEPARATOR . iconv('cp874', 'utf-8', $name) . ".txt"; + $pathw = __DIR__ . DIRECTORY_SEPARATOR . iconv('cp874', 'utf-8', $name) . ".txt"; - file_put_contents($pathw, "hello" . $i++); + file_put_contents($pathw, "hello" . $i++); - get_basename_with_cp($pathw, 65001); - var_dump(file_get_contents($pathw)); + get_basename_with_cp($pathw, 65001); + var_dump(file_get_contents($pathw)); - unlink($pathw); + unlink($pathw); } ?> diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_0.phpt index f56aa7231e..afd1ef3e7a 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp932_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp932_0.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp932"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_2.phpt index 51420195e8..97bad6412e 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp932_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp932_2.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_0.phpt index 40cef63621..7da7aff1fc 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_0.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp932"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_2.phpt index 2c1adc9e0a..c8aaa0b56b 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_2.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_0.phpt index 9b65cd6905..a67cc6683c 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp936_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp936_0.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "$item"; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp936"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_2.phpt index d079666467..c913f4e352 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp936_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp936_2.phpt @@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "{$item}25"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_0.phpt index 1be1f57f5f..9653f2ec1f 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_0.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "$item"; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_cp936"); diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_2.phpt index 9d6ba06c21..ab0b836da7 100644 --- a/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_2.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "{$item}25"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_0.phpt index a8d4e99a69..a72a80ac8b 100644 --- a/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_0.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_eucjp"); diff --git a/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_2.phpt index dfd7de5273..f43e27bd29 100644 --- a/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_2.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_0.phpt index 796abf9867..b9a8552313 100644 --- a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_0.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item; $f = fopen($fn, 'r'); if ($f) { - var_dump($f, fread($f, 42)); - var_dump(fclose($f)); + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } remove_data("file_kartuli"); diff --git a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_2.phpt index 04b4dc0aa3..c0c881f0f3 100644 --- a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_2.phpt @@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; $f = fopen($fn, 'w'); if ($f) { - var_dump($f, fwrite($f, "writing to an mb filename")); - var_dump(fclose($f)); + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); } else { - echo "open utf8 failed\n"; + echo "open utf8 failed\n"; } var_dump(file_get_contents($fn)); diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_0.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_0.phpt index b88424471f..3705582484 100644 --- a/ext/standard/tests/file/windows_mb_path/test_long_path_0.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_0.phpt @@ -17,8 +17,8 @@ $s = str_repeat('a', 50); $how_many = 32; for ($i = 0; $i < $how_many; $i++) { - $p .= "$s"; - $p .= DIRECTORY_SEPARATOR; + $p .= "$s"; + $p .= DIRECTORY_SEPARATOR; } $p = realpath(__DIR__) . DIRECTORY_SEPARATOR . $p; @@ -30,8 +30,8 @@ var_dump(mkdir($p, 0777, true)); var_dump(file_exists($p)); for ($i = 0; $i < $how_many; $i++) { - $p0 = substr($p, 0, strlen($p) - $i*51); - rmdir($p0); + $p0 = substr($p, 0, strlen($p) - $i*51); + rmdir($p0); } var_dump(file_exists(realpath(__DIR__) . DIRECTORY_SEPARATOR . $s)); diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_1.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_1.phpt index ae3e1635a5..427f0e9cf5 100644 --- a/ext/standard/tests/file/windows_mb_path/test_long_path_1.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_1.phpt @@ -17,8 +17,8 @@ $how_many = 32; for ($i = 0; $i < $how_many; $i++) { - $p .= "$s"; - $p .= DIRECTORY_SEPARATOR; + $p .= "$s"; + $p .= DIRECTORY_SEPARATOR; } $p = realpath(__DIR__) . DIRECTORY_SEPARATOR . $p; @@ -37,8 +37,8 @@ var_dump(file_get_contents($p7)); unlink($p7); for ($i = 0; $i < $how_many; $i++) { - $p0 = substr($p, 0, strlen($p) - $i*51); - rmdir($p0); + $p0 = substr($p, 0, strlen($p) - $i*51); + rmdir($p0); } var_dump(file_exists(realpath(__DIR__) . DIRECTORY_SEPARATOR . $s)); diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_2.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_2.phpt index 2e39fa8d5c..05982133c1 100644 --- a/ext/standard/tests/file/windows_mb_path/test_long_path_2.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_2.phpt @@ -17,8 +17,8 @@ $how_many = 32; for ($i = 0; $i < $how_many; $i++) { - $p .= "$s"; - $p .= DIRECTORY_SEPARATOR; + $p .= "$s"; + $p .= DIRECTORY_SEPARATOR; } /* path doesn't exist at this point! */ @@ -43,8 +43,8 @@ var_dump(file_get_contents($p7)); unlink($p7); for ($i = 0; $i < $how_many; $i++) { - $p0 = substr($p, 0, strlen($p) - $i*(strlen($s) + 1)); - rmdir($p0); + $p0 = substr($p, 0, strlen($p) - $i*(strlen($s) + 1)); + rmdir($p0); } var_dump(file_exists(realpath(__DIR__) . DIRECTORY_SEPARATOR . $s)); diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_bug70943.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_bug70943.phpt index 72d78b3b60..5b797d293b 100644 --- a/ext/standard/tests/file/windows_mb_path/test_long_path_bug70943.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_bug70943.phpt @@ -17,8 +17,8 @@ touch($testFile); echo "Opening file... "; if ($fp = fopen($testFile, "r")) { - fclose($fp); - echo "OK", "\n"; + fclose($fp); + echo "OK", "\n"; } unlink($testFile); diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt index b98e087560..a81ff66dfb 100644 --- a/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt @@ -20,27 +20,27 @@ $bar = $d . '\\5b53796d666f6e795c42756e646c655c5477696742756e646c655c436f6e74726 mkdir($d, NULL, true); foreach (array($foo, $bar) as $f) { - touch($f); - - $foo_obj = new \SplFileInfo($f); - var_dump( - $f, - strlen($f) > 260, /* exceeds _MAX_PATH */ - file_exists($f), - file_exists($foo_obj), - is_readable($f), - is_readable($foo_obj), - is_writable($f), - is_writable($foo_obj) - ); - - unlink($f); + touch($f); + + $foo_obj = new \SplFileInfo($f); + var_dump( + $f, + strlen($f) > 260, /* exceeds _MAX_PATH */ + file_exists($f), + file_exists($foo_obj), + is_readable($f), + is_readable($foo_obj), + is_writable($f), + is_writable($foo_obj) + ); + + unlink($f); } $p = $d; do { - rmdir($p); - $p = dirname($p); + rmdir($p); + $p = dirname($p); } while ($p != $base); ?> diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt index c3cceb6d1a..1e3d7cd19c 100644 --- a/ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt @@ -20,15 +20,15 @@ $s = str_repeat('a', 50); $how_many = 32; for ($i = 0; $i < $how_many; $i++) { - $p .= "$s\\"; + $p .= "$s\\"; } $start = realpath(__DIR__); $newstart = false; if (strlen($start) <= 248) { - // create the exact length - $start = $start . "\\" . str_repeat('a', 251 - strlen($start) - 1); - $newstart = true; + // create the exact length + $start = $start . "\\" . str_repeat('a', 251 - strlen($start) - 1); + $newstart = true; } var_dump($start); @@ -46,11 +46,11 @@ var_dump(file_get_contents($p7)); // cleanup unlink($p7); for ($i = 0; $i < $how_many; $i++) { - $p0 = substr($p, 0, strlen($p) - $i*51); - rmdir($p0); + $p0 = substr($p, 0, strlen($p) - $i*51); + rmdir($p0); } if ($newstart) { - rmdir($start); + rmdir($start); } ?> diff --git a/ext/standard/tests/file/windows_mb_path/test_readdir_mb_names.phpt b/ext/standard/tests/file/windows_mb_path/test_readdir_mb_names.phpt index 62db0c8c65..e671ef8f1d 100644 --- a/ext/standard/tests/file/windows_mb_path/test_readdir_mb_names.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_readdir_mb_names.phpt @@ -47,7 +47,7 @@ if (is_dir($dirw)) { closedir($dh); } } else { - echo "is_dir failed\n"; + echo "is_dir failed\n"; } set_active_cp($old_cp); diff --git a/ext/standard/tests/file/windows_mb_path/util.inc b/ext/standard/tests/file/windows_mb_path/util.inc index fc80a7613f..a26a66c017 100644 --- a/ext/standard/tests/file/windows_mb_path/util.inc +++ b/ext/standard/tests/file/windows_mb_path/util.inc @@ -2,153 +2,153 @@ function get_active_cp($kind = "") { - if (version_compare(PHP_VERSION, '7.1', '<')) { - $s = exec("chcp"); - preg_match(",.*: (\d+),", $s, $m); - - return $m[1]; - } else { - return sapi_windows_cp_get($kind); - } + if (version_compare(PHP_VERSION, '7.1', '<')) { + $s = exec("chcp"); + preg_match(",.*: (\d+),", $s, $m); + + return $m[1]; + } else { + return sapi_windows_cp_get($kind); + } } function set_active_cp($cp, $echo = true) { - if (version_compare(PHP_VERSION, '7.1', '<')) { - $ret = exec("chcp $cp"); - } else { - if (!sapi_windows_cp_set($cp)) { - echo "Failed to set cp $cp\n"; - return; - } - - if ($echo) echo "Active code page: ", get_active_cp(), "\n"; - } + if (version_compare(PHP_VERSION, '7.1', '<')) { + $ret = exec("chcp $cp"); + } else { + if (!sapi_windows_cp_set($cp)) { + echo "Failed to set cp $cp\n"; + return; + } + + if ($echo) echo "Active code page: ", get_active_cp(), "\n"; + } } function get_basename_with_cp($path, $cp, $echo = true) { - $old_cp = get_active_cp(); - set_active_cp($cp, $echo); + $old_cp = get_active_cp(); + set_active_cp($cp, $echo); - if ($echo) echo "getting basename of $path\n"; + if ($echo) echo "getting basename of $path\n"; - $cmd = "powershell -command \"Get-Item -Path '$path' | Format-Table -HideTableHeaders Name\""; - $out = trim(shell_exec($cmd)); + $cmd = "powershell -command \"Get-Item -Path '$path' | Format-Table -HideTableHeaders Name\""; + $out = trim(shell_exec($cmd)); - if ($echo) var_dump($out, $out == basename($path)); - if ($echo) var_dump(realpath($path)); + if ($echo) var_dump($out, $out == basename($path)); + if ($echo) var_dump(realpath($path)); - set_active_cp($old_cp, $echo); + set_active_cp($old_cp, $echo); - return $out; + return $out; } function skip_if_wrong_cp($cp, $kind = "") { - if (get_active_cp($kind) != $cp) { - die("skip this test expect codepage $cp"); - } + if (get_active_cp($kind) != $cp) { + die("skip this test expect codepage $cp"); + } } function skip_if_no_required_exts() { - $exts = func_get_args(); - $exts[] = "iconv"; - - foreach ($exts as $ext) { - if (!extension_loaded($ext)) { - die("skip $ext is not loaded"); - } - } + $exts = func_get_args(); + $exts[] = "iconv"; + + foreach ($exts as $ext) { + if (!extension_loaded($ext)) { + die("skip $ext is not loaded"); + } + } } function skip_if_not_win() { - if(substr(PHP_OS, 0, 3) != 'WIN' ) { - die('skip windows only test'); - } + if(substr(PHP_OS, 0, 3) != 'WIN' ) { + die('skip windows only test'); + } } function create_verify_file($prefix, $basename, $content = "", $cp = 65001) { - $full = $prefix . DIRECTORY_SEPARATOR . $basename; - - if (!touch($full)) { - echo "failed to touch create $full\n"; - return; - } - - $now = get_basename_with_cp($full, $cp, false); - if ($now !== $basename) { - echo "expected '$basename', got '$now'\n"; - return; - } - - if ($content) { - file_put_contents($full, $content); - } + $full = $prefix . DIRECTORY_SEPARATOR . $basename; + + if (!touch($full)) { + echo "failed to touch create $full\n"; + return; + } + + $now = get_basename_with_cp($full, $cp, false); + if ($now !== $basename) { + echo "expected '$basename', got '$now'\n"; + return; + } + + if ($content) { + file_put_contents($full, $content); + } } function create_verify_dir($prefix, $basename, $cp = 65001) { - $full = $prefix . DIRECTORY_SEPARATOR . $basename; + $full = $prefix . DIRECTORY_SEPARATOR . $basename; - if (!mkdir($full)) { - echo "failed to create dir '$full'\n"; - return; - } + if (!mkdir($full)) { + echo "failed to create dir '$full'\n"; + return; + } - $now = get_basename_with_cp($full, $cp, false); - if ($now !== $basename) { - echo "expected '$basename', got '$now'\n"; - } + $now = get_basename_with_cp($full, $cp, false); + if ($now !== $basename) { + echo "expected '$basename', got '$now'\n"; + } } function remove_data($id, $dir = NULL) { - if (!$dir) { - $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id; - } - - if (is_dir($dir)) { - $objects = scandir($dir); - foreach ($objects as $object) { - if ($object != "." && $object != "..") { - if (filetype($dir . DIRECTORY_SEPARATOR . $object) == "dir") - remove_data($id, $dir . DIRECTORY_SEPARATOR . $object); - else - unlink($dir . DIRECTORY_SEPARATOR . $object); - } - } - reset($objects); - rmdir($dir); - } + if (!$dir) { + $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id; + } + + if (is_dir($dir)) { + $objects = scandir($dir); + foreach ($objects as $object) { + if ($object != "." && $object != "..") { + if (filetype($dir . DIRECTORY_SEPARATOR . $object) == "dir") + remove_data($id, $dir . DIRECTORY_SEPARATOR . $object); + else + unlink($dir . DIRECTORY_SEPARATOR . $object); + } + } + reset($objects); + rmdir($dir); + } } function create_data($id, $item = "", $cp = 65001, $utf8 = true) { - if ($utf8) { - /* Keep this file ASCII, so zend.multibyte related stuff can be tasted as well. */ - include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util_utf8.inc"; - return create_data_from_utf8($id, $item, $cp); - } else { - - $prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id; - - if (!is_dir($prefix)) { - mkdir($prefix); - } - - if (0 === strpos($id, "dir")) { - create_verify_dir($prefix, $item, $cp); - } else if (0 === strpos($id, "file")) { - /* a bit unhandy, but content can be put from outside, if needed */ - create_verify_file($prefix, $item, "dummy content", $cp); - } else { - echo "Item has either to start with \"dir\" or \"file\""; - } - } - - return $prefix; + if ($utf8) { + /* Keep this file ASCII, so zend.multibyte related stuff can be tasted as well. */ + include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util_utf8.inc"; + return create_data_from_utf8($id, $item, $cp); + } else { + + $prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id; + + if (!is_dir($prefix)) { + mkdir($prefix); + } + + if (0 === strpos($id, "dir")) { + create_verify_dir($prefix, $item, $cp); + } else if (0 === strpos($id, "file")) { + /* a bit unhandy, but content can be put from outside, if needed */ + create_verify_file($prefix, $item, "dummy content", $cp); + } else { + echo "Item has either to start with \"dir\" or \"file\""; + } + } + + return $prefix; } diff --git a/ext/standard/tests/file/windows_mb_path/util_utf8.inc b/ext/standard/tests/file/windows_mb_path/util_utf8.inc index e091564998..e51fad13b6 100644 --- a/ext/standard/tests/file/windows_mb_path/util_utf8.inc +++ b/ext/standard/tests/file/windows_mb_path/util_utf8.inc @@ -2,93 +2,93 @@ function create_data_from_utf8($id, $item = "", $cp = 65001) { - $prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id; + $prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id; - if (!is_dir($prefix)) { - mkdir($prefix); - } + if (!is_dir($prefix)) { + mkdir($prefix); + } - /* Using a UTF-8 encoded filenames if !zend.multibyte, otherwise files in retrospective charset. */ - switch ($id) { + /* Using a UTF-8 encoded filenames if !zend.multibyte, otherwise files in retrospective charset. */ + switch ($id) { - case "file_mb3": - $content = "<?php + case "file_mb3": + $content = "<?php echo \"hello there from the include\n\";"; - create_verify_file($prefix, "ÄeskýtestovánÃ.inc", $content); - break; + create_verify_file($prefix, "ÄeskýtestovánÃ.inc", $content); + break; - case "bug71509": - $content = "that's my file with swedish filename + case "bug71509": + $content = "that's my file with swedish filename "; - create_verify_file($prefix, $item, $content); - break; + create_verify_file($prefix, $item, $content); + break; - case "file_mb4": - create_verify_file($prefix, "Å¡.txt", ""); - break; + case "file_mb4": + create_verify_file($prefix, "Å¡.txt", ""); + break; - case "file_cp1252": - $content = "hallo + case "file_cp1252": + $content = "hallo "; - create_verify_file($prefix, "tschüß", $content); - break; - - case "file2_cp1252": - create_verify_file($prefix, $item, "hola"); - break; - - case "file2_mb": - create_verify_file($prefix, "Ελλάδα.txt", ""); - break; - - case "file_cp1251": - create_verify_file($prefix, $item, "opened an utf8 filename for reading", $cp); - break; - - case "file_cp1255": - case "file_cp1254": - case "file_cp1253": - case "file_kartuli": - case "file_cp1250": - case "file_cp1256": - case "file_cp874": - case "file_big5": - case "file_cp936": - case "file_cp932": - case "file_eucjp": - case "file_mb": - $content = "reading file wihh multibyte filename + create_verify_file($prefix, "tschüß", $content); + break; + + case "file2_cp1252": + create_verify_file($prefix, $item, "hola"); + break; + + case "file2_mb": + create_verify_file($prefix, "Ελλάδα.txt", ""); + break; + + case "file_cp1251": + create_verify_file($prefix, $item, "opened an utf8 filename for reading", $cp); + break; + + case "file_cp1255": + case "file_cp1254": + case "file_cp1253": + case "file_kartuli": + case "file_cp1250": + case "file_cp1256": + case "file_cp874": + case "file_big5": + case "file_cp936": + case "file_cp932": + case "file_eucjp": + case "file_mb": + $content = "reading file wihh multibyte filename "; - create_verify_file($prefix, $item, $content, $cp); - break; - - case "dir_mb": - create_verify_dir($prefix, "テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス42"); - break; - - case "dir_cp1255": - case "dir_cp1254": - case "dir_cp1253": - case "dir_kartuli": - case "dir_cp1250": - case "dir_cp1256": - case "dir_cp874": - case "dir_cp932": - case "dir_cp936": - case "dir_eucjp": - case "dir2_cp1252": - case "dir_cp1252": - case "dir_cp1251": - case "dir_big5": - case "dir": - create_verify_dir($prefix, $item, $cp); - break; - - case "file": - create_verify_file($prefix, $item, "", $cp); - break; - } - - return $prefix; + create_verify_file($prefix, $item, $content, $cp); + break; + + case "dir_mb": + create_verify_dir($prefix, "テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス42"); + break; + + case "dir_cp1255": + case "dir_cp1254": + case "dir_cp1253": + case "dir_kartuli": + case "dir_cp1250": + case "dir_cp1256": + case "dir_cp874": + case "dir_cp932": + case "dir_cp936": + case "dir_eucjp": + case "dir2_cp1252": + case "dir_cp1252": + case "dir_cp1251": + case "dir_big5": + case "dir": + create_verify_dir($prefix, $item, $cp); + break; + + case "file": + create_verify_file($prefix, $item, "", $cp); + break; + } + + return $prefix; } diff --git a/ext/standard/tests/filters/basic.phpt b/ext/standard/tests/filters/basic.phpt index c9162e5bef..c0d4e5d85b 100644 --- a/ext/standard/tests/filters/basic.phpt +++ b/ext/standard/tests/filters/basic.phpt @@ -8,19 +8,19 @@ $filters = array("string.rot13", "string.toupper", "string.tolower"); function filter_test($names) { - $fp = tmpfile(); - fwrite($fp, $GLOBALS["text"]); - rewind($fp); - foreach ($names as $name) { - echo "filter: $name\n"; - var_dump(stream_filter_prepend($fp, $name)); - } - var_dump(fgets($fp)); - fclose($fp); + $fp = tmpfile(); + fwrite($fp, $GLOBALS["text"]); + rewind($fp); + foreach ($names as $name) { + echo "filter: $name\n"; + var_dump(stream_filter_prepend($fp, $name)); + } + var_dump(fgets($fp)); + fclose($fp); } foreach ($filters as $filter) { - filter_test(array($filter)); + filter_test(array($filter)); } filter_test(array($filters[0], $filters[1])); diff --git a/ext/standard/tests/filters/bug22538.phpt b/ext/standard/tests/filters/bug22538.phpt index 0ef37a7bc1..920dd55c79 100644 --- a/ext/standard/tests/filters/bug22538.phpt +++ b/ext/standard/tests/filters/bug22538.phpt @@ -3,16 +3,16 @@ Bug #22538 (filtered stream doesn't update file pointer) --FILE-- <?php function my_stream_copy_to_stream($fin, $fout) { - while (!feof($fin)) { - fwrite($fout, fread($fin, 4096)); - } + while (!feof($fin)) { + fwrite($fout, fread($fin, 4096)); + } } $size = 65536; do { - $path1 = sprintf("%s/%s%da", __DIR__, uniqid(), time()); - $path2 = sprintf("%s/%s%db", __DIR__, uniqid(), time()); + $path1 = sprintf("%s/%s%da", __DIR__, uniqid(), time()); + $path2 = sprintf("%s/%s%db", __DIR__, uniqid(), time()); } while ($path1 == $path2); $fp = fopen($path1, "w") or die("Can not open $path1\n"); @@ -20,7 +20,7 @@ $str = "abcdefghijklmnopqrstuvwxyz\n"; $str_len = strlen($str); $cnt = $size; while (($cnt -= $str_len) > 0) { - fwrite($fp, $str); + fwrite($fp, $str); } $cnt = $size - ($str_len + $cnt); fclose($fp); diff --git a/ext/standard/tests/filters/bug35916.phpt b/ext/standard/tests/filters/bug35916.phpt index a890b41a57..e234949303 100644 --- a/ext/standard/tests/filters/bug35916.phpt +++ b/ext/standard/tests/filters/bug35916.phpt @@ -9,22 +9,22 @@ class strtoupper_filter extends php_user_filter { function filter($in, $out, &$consumed, $closing) { - while($bucket=stream_bucket_make_writeable($in)) { - $bucket->data = strtoupper($bucket->data); - $consumed += $bucket->datalen; - stream_bucket_append($out, $bucket); - stream_bucket_append($out, $bucket); + while($bucket=stream_bucket_make_writeable($in)) { + $bucket->data = strtoupper($bucket->data); + $consumed += $bucket->datalen; + stream_bucket_append($out, $bucket); + stream_bucket_append($out, $bucket); } - return PSFS_PASS_ON; + return PSFS_PASS_ON; } - function onCreate() - { - echo "fffffffffff\n"; - } - function onClose() - { - echo "hello\n"; - } + function onCreate() + { + echo "fffffffffff\n"; + } + function onClose() + { + echo "hello\n"; + } } stream_filter_register("strtoupper", "strtoupper_filter"); diff --git a/ext/standard/tests/filters/bug46164-1.phpt b/ext/standard/tests/filters/bug46164-1.phpt index b2d2d4e85d..ecdd86bbe2 100644 --- a/ext/standard/tests/filters/bug46164-1.phpt +++ b/ext/standard/tests/filters/bug46164-1.phpt @@ -3,13 +3,13 @@ Bug #46164 - 1 (stream_filter_remove() closes the stream) --FILE-- <?php class user_filter extends php_user_filter { - function filter($in, $out, &$consumed, $closing) { - while($bucket = stream_bucket_make_writeable($in)) { - $consumed += $bucket->datalen; - stream_bucket_append($out, $bucket); - } - return PSFS_PASS_ON; - } + function filter($in, $out, &$consumed, $closing) { + while($bucket = stream_bucket_make_writeable($in)) { + $consumed += $bucket->datalen; + stream_bucket_append($out, $bucket); + } + return PSFS_PASS_ON; + } } stream_filter_register('user_filter','user_filter'); diff --git a/ext/standard/tests/filters/bug46164-2.phpt b/ext/standard/tests/filters/bug46164-2.phpt index 6a1bde5962..c58295076f 100644 --- a/ext/standard/tests/filters/bug46164-2.phpt +++ b/ext/standard/tests/filters/bug46164-2.phpt @@ -3,14 +3,14 @@ Bug #46164 - 2 (stream_filter_remove() closes the stream) --FILE-- <?php class user_filter extends php_user_filter { - function filter($in, $out, &$consumed, $closing) { - while($bucket = stream_bucket_make_writeable($in)) { - $consumed += $bucket->datalen; - stream_bucket_append($out, $bucket); - } - unset($this->stream); - return PSFS_PASS_ON; - } + function filter($in, $out, &$consumed, $closing) { + while($bucket = stream_bucket_make_writeable($in)) { + $consumed += $bucket->datalen; + stream_bucket_append($out, $bucket); + } + unset($this->stream); + return PSFS_PASS_ON; + } } stream_filter_register('user_filter','user_filter'); diff --git a/ext/standard/tests/filters/chunked_001.phpt b/ext/standard/tests/filters/chunked_001.phpt index c90dd403ec..094b49d7b9 100644 --- a/ext/standard/tests/filters/chunked_001.phpt +++ b/ext/standard/tests/filters/chunked_001.phpt @@ -10,19 +10,19 @@ allow_url_fopen=1 --FILE-- <?php $streams = array( - "data://text/plain,0\r\n", - "data://text/plain,2\r\nte\r\n2\r\nst\r\n0\r\n", - "data://text/plain,2\nte\n2\nst\n0\n", - "data://text/plain,2;a=1\nte\n2;a=2;b=3\r\nst\n0\n", - "data://text/plain,2\nte\n2\nst\n0\na=b\r\nc=d\n\r\n", - "data://text/plain,1f\n0123456789abcdef0123456789abcde\n1\nf\n0\n", - "data://text/plain,1E\n0123456789abcdef0123456789abcd\n2\nef\n0\n", + "data://text/plain,0\r\n", + "data://text/plain,2\r\nte\r\n2\r\nst\r\n0\r\n", + "data://text/plain,2\nte\n2\nst\n0\n", + "data://text/plain,2;a=1\nte\n2;a=2;b=3\r\nst\n0\n", + "data://text/plain,2\nte\n2\nst\n0\na=b\r\nc=d\n\r\n", + "data://text/plain,1f\n0123456789abcdef0123456789abcde\n1\nf\n0\n", + "data://text/plain,1E\n0123456789abcdef0123456789abcd\n2\nef\n0\n", ); foreach ($streams as $name) { - $fp = fopen($name, "r"); - stream_filter_append($fp, "dechunk", STREAM_FILTER_READ); - var_dump(stream_get_contents($fp)); - fclose($fp); + $fp = fopen($name, "r"); + stream_filter_append($fp, "dechunk", STREAM_FILTER_READ); + var_dump(stream_get_contents($fp)); + fclose($fp); } ?> --EXPECT-- diff --git a/ext/standard/tests/filters/filter_errors.inc b/ext/standard/tests/filters/filter_errors.inc index 8636fbe17f..18711844f8 100644 --- a/ext/standard/tests/filters/filter_errors.inc +++ b/ext/standard/tests/filters/filter_errors.inc @@ -1,36 +1,36 @@ <?php function filter_errors_skipif($needle) { - if (!function_exists('fnmatch')) { - die('skip fnmatch() not available'); - } - $filters = stream_get_filters(); - foreach($filters as $filter) { - if (fnmatch($filter, $needle)) return; - } - die("skip $needle not available"); + if (!function_exists('fnmatch')) { + die('skip fnmatch() not available'); + } + $filters = stream_get_filters(); + foreach($filters as $filter) { + if (fnmatch($filter, $needle)) return; + } + die("skip $needle not available"); } function filter_errors_test($filter, $data) { - echo "test filtering of buffered data\n"; + echo "test filtering of buffered data\n"; - $stream = fopen('php://memory', 'wb+'); + $stream = fopen('php://memory', 'wb+'); - fwrite($stream, ".\r\n$data"); - fseek($stream, 0, SEEK_SET); - stream_get_line($stream, 8192, "\r\n"); + fwrite($stream, ".\r\n$data"); + fseek($stream, 0, SEEK_SET); + stream_get_line($stream, 8192, "\r\n"); - $f = stream_filter_append($stream, $filter); + $f = stream_filter_append($stream, $filter); - echo "test filtering of non buffered data\n"; + echo "test filtering of non buffered data\n"; - $stream = fopen('php://memory', 'wb+'); + $stream = fopen('php://memory', 'wb+'); - fwrite($stream, "$data"); - fseek($stream, 0, SEEK_SET); + fwrite($stream, "$data"); + fseek($stream, 0, SEEK_SET); - stream_filter_append($stream, $filter); - stream_get_contents($stream); + stream_filter_append($stream, $filter); + stream_get_contents($stream); } diff --git a/ext/standard/tests/filters/filter_errors_user.phpt b/ext/standard/tests/filters/filter_errors_user.phpt index 9b911cf81f..a8547fe9ed 100644 --- a/ext/standard/tests/filters/filter_errors_user.phpt +++ b/ext/standard/tests/filters/filter_errors_user.phpt @@ -5,58 +5,58 @@ Filter errors: user filter require 'filter_errors.inc'; class test_filter0 extends php_user_filter { - function filter($in, $out, &$consumed, $closing) { - return PSFS_ERR_FATAL; - } + function filter($in, $out, &$consumed, $closing) { + return PSFS_ERR_FATAL; + } } class test_filter1 extends php_user_filter { - function filter($in, $out, &$consumed, $closing) { - $bucket = stream_bucket_make_writeable($in); - return PSFS_ERR_FATAL; - } + function filter($in, $out, &$consumed, $closing) { + $bucket = stream_bucket_make_writeable($in); + return PSFS_ERR_FATAL; + } } class test_filter2 extends php_user_filter { - function filter($in, $out, &$consumed, $closing) { - while ($bucket = stream_bucket_make_writeable($in)) { - $consumed += $bucket->datalen; - stream_bucket_append($out, $bucket); - } - return PSFS_ERR_FATAL; - } + function filter($in, $out, &$consumed, $closing) { + while ($bucket = stream_bucket_make_writeable($in)) { + $consumed += $bucket->datalen; + stream_bucket_append($out, $bucket); + } + return PSFS_ERR_FATAL; + } } class test_filter3 extends php_user_filter { - function filter($in, $out, &$consumed, $closing) { - if (!$closing) { - $bucket = stream_bucket_new($this->stream, "42"); - stream_bucket_append($out, $bucket); - } - return PSFS_ERR_FATAL; - } + function filter($in, $out, &$consumed, $closing) { + if (!$closing) { + $bucket = stream_bucket_new($this->stream, "42"); + stream_bucket_append($out, $bucket); + } + return PSFS_ERR_FATAL; + } } class test_filter4 extends php_user_filter { - function filter($in, $out, &$consumed, $closing) { - if (!$closing) { - $bucket = stream_bucket_new($this->stream, "42"); - } - return PSFS_ERR_FATAL; - } + function filter($in, $out, &$consumed, $closing) { + if (!$closing) { + $bucket = stream_bucket_new($this->stream, "42"); + } + return PSFS_ERR_FATAL; + } } for($i = 0; $i < 5; ++$i) { - echo "test_filter$i\n"; - var_dump(stream_filter_register("test_filter$i", "test_filter$i")); - filter_errors_test("test_filter$i", "42"); + echo "test_filter$i\n"; + var_dump(stream_filter_register("test_filter$i", "test_filter$i")); + filter_errors_test("test_filter$i", "42"); } echo "test append / read / remove\n"; for($i = 0; $i < 5; ++$i) { - echo "test_filter$i\n"; - $stream = fopen('php://memory', 'wb+'); - fwrite($stream, "42"); - fseek($stream, 0, SEEK_SET); - $f = stream_filter_append($stream, "test_filter$i"); - stream_get_contents($stream); - stream_filter_remove($f); + echo "test_filter$i\n"; + $stream = fopen('php://memory', 'wb+'); + fwrite($stream, "42"); + fseek($stream, 0, SEEK_SET); + $f = stream_filter_append($stream, "test_filter$i"); + stream_get_contents($stream); + stream_filter_remove($f); } echo "test append all / read / remove all\n"; @@ -65,12 +65,12 @@ fwrite($stream, "42"); fseek($stream, 0, SEEK_SET); $filters = array(); for($i = 0; $i < 5; ++$i) { - echo "test_filter$i\n"; - $filters[] = stream_filter_append($stream, "test_filter$i"); + echo "test_filter$i\n"; + $filters[] = stream_filter_append($stream, "test_filter$i"); } stream_get_contents($stream); foreach($filters as $filter) { - stream_filter_remove($filter); + stream_filter_remove($filter); } echo "test append all / read / close\n"; @@ -79,8 +79,8 @@ fwrite($stream, "42"); fseek($stream, 0, SEEK_SET); $filters = array(); for($i = 0; $i < 5; ++$i) { - echo "test_filter$i\n"; - $filters[] = stream_filter_append($stream, "test_filter$i"); + echo "test_filter$i\n"; + $filters[] = stream_filter_append($stream, "test_filter$i"); } stream_get_contents($stream); fclose($stream); diff --git a/ext/standard/tests/general_functions/001.phpt b/ext/standard/tests/general_functions/001.phpt index 307122e1cb..a43215c2c7 100644 --- a/ext/standard/tests/general_functions/001.phpt +++ b/ext/standard/tests/general_functions/001.phpt @@ -7,41 +7,41 @@ $agent = sprintf("%.5s", "James Bond, 007"); echo("sprintf string truncate test: "); if ($agent == "James") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo("sprintf padding and align test: "); $test = sprintf("abc%04d %-20s%c", 20, "fisketur", 33); if ($test == "abc0020 fisketur !") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo("sprintf octal and hex test: "); $test = sprintf("%4o %4x %4X %0"."8x", 128, 1024, 49151, 3457925); if ($test == " 200 400 BFFF 0034c385") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo("sprintf octal binary test: "); $test = sprintf("%b", 3457925); if ($test == "1101001100001110000101") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo("sprintf float test: "); $test = sprintf("%0"."06.2f", 10000/3.0); if ($test == "003333.33") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo sprintf("%.2f\n", "99.00"); diff --git a/ext/standard/tests/general_functions/002.phpt b/ext/standard/tests/general_functions/002.phpt index 58528da13a..43c67ec07b 100644 --- a/ext/standard/tests/general_functions/002.phpt +++ b/ext/standard/tests/general_functions/002.phpt @@ -1,9 +1,9 @@ --TEST-- quoted_printable_decode() function test --FILE-- -<?php echo quoted_printable_decode("=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A= -=20=D4=cf=D2=C7=CF=D7=D9=C5= -=20= +<?php echo quoted_printable_decode("=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A= +=20=D4=cf=D2=C7=CF=D7=D9=C5= +=20= =D0= =D2=CF=C5=CB=D4=D9"); ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/003.phpt b/ext/standard/tests/general_functions/003.phpt index 0388cf95b0..573491b8a2 100644 --- a/ext/standard/tests/general_functions/003.phpt +++ b/ext/standard/tests/general_functions/003.phpt @@ -6,18 +6,18 @@ levenshtein() function test function test_me($title,$expect,$text1,$text2,$cost1=0,$cost2=0,$cost3=0) { if($cost1==0) - $result=levenshtein($text1,$text2); - else + $result=levenshtein($text1,$text2); + else $result=levenshtein($text1,$text2,$cost1,$cost2,$cost3); - if($result==$expect) return 0; + if($result==$expect) return 0; - echo "$title: result is $result instead of $expect "; - echo "for '$text1'/'$text2' "; - if($cost1) echo "($cost1:$cost2:$cost3)"; - echo "\n"; + echo "$title: result is $result instead of $expect "; + echo "for '$text1'/'$text2' "; + if($cost1) echo "($cost1:$cost2:$cost3)"; + echo "\n"; - return 1; + return 1; } $n=0; diff --git a/ext/standard/tests/general_functions/004.phpt b/ext/standard/tests/general_functions/004.phpt index fa83c7c220..80a7216939 100644 --- a/ext/standard/tests/general_functions/004.phpt +++ b/ext/standard/tests/general_functions/004.phpt @@ -5,7 +5,7 @@ fgetcsv() with tab delimited fields (BUG #8258) chdir(__DIR__); $fp=fopen("004.data","r"); while($a=fgetcsv($fp,100,"\t")) { - echo join(",",$a)."\n"; + echo join(",",$a)."\n"; } fclose($fp); ?> diff --git a/ext/standard/tests/general_functions/006.phpt b/ext/standard/tests/general_functions/006.phpt index 6852286c5e..80a8fd4168 100644 --- a/ext/standard/tests/general_functions/006.phpt +++ b/ext/standard/tests/general_functions/006.phpt @@ -1,9 +1,9 @@ --TEST-- quoted_printable_decode() function test with CR/LF --FILE-- -<?php echo quoted_printable_decode("=FAwow-factor=C1=D0=D5=DD=C5=CE=CE=D9=C5=0A= -=20=D4=CF=D2=C7=CF=D7=D9=C5= -=20= +<?php echo quoted_printable_decode("=FAwow-factor=C1=D0=D5=DD=C5=CE=CE=D9=C5=0A= +=20=D4=CF=D2=C7=CF=D7=D9=C5= +=20= =D0= =D2=CF=C5=CB=D4=D9"); ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/007.phpt b/ext/standard/tests/general_functions/007.phpt index 02fc6c6480..e5775bb742 100644 --- a/ext/standard/tests/general_functions/007.phpt +++ b/ext/standard/tests/general_functions/007.phpt @@ -3,8 +3,8 @@ MD5 / Base64 --FILE-- <?php function test($str) { - $res = md5(base64_decode(base64_encode($str)))."\n"; - return $res; + $res = md5(base64_decode(base64_encode($str)))."\n"; + return $res; } echo test(""); echo test("a"); diff --git a/ext/standard/tests/general_functions/009.phpt b/ext/standard/tests/general_functions/009.phpt index 39dc2189b3..254572f612 100644 --- a/ext/standard/tests/general_functions/009.phpt +++ b/ext/standard/tests/general_functions/009.phpt @@ -3,8 +3,8 @@ SHA1 --FILE-- <?php function test($str) { - $res = sha1($str)."\n"; - return $res; + $res = sha1($str)."\n"; + return $res; } echo test(""); echo test("a"); diff --git a/ext/standard/tests/general_functions/boolval.phpt b/ext/standard/tests/general_functions/boolval.phpt index 3c998520ff..fbe66264c3 100644 --- a/ext/standard/tests/general_functions/boolval.phpt +++ b/ext/standard/tests/general_functions/boolval.phpt @@ -2,18 +2,18 @@ Testing boolval() --FILE-- <?php - var_dump(boolval(false)); - var_dump(boolval(NULL)); - var_dump(boolval("")); - var_dump(boolval(0)); - var_dump(boolval(array())); + var_dump(boolval(false)); + var_dump(boolval(NULL)); + var_dump(boolval("")); + var_dump(boolval(0)); + var_dump(boolval(array())); - var_dump(boolval(true)); - var_dump(boolval("abc")); - var_dump(boolval(0.5)); - var_dump(boolval(100)); - var_dump(boolval(new stdClass())); - var_dump(boolval(STDIN)); + var_dump(boolval(true)); + var_dump(boolval("abc")); + var_dump(boolval(0.5)); + var_dump(boolval(100)); + var_dump(boolval(new stdClass())); + var_dump(boolval(STDIN)); ?> --EXPECT-- bool(false) diff --git a/ext/standard/tests/general_functions/bug25038.phpt b/ext/standard/tests/general_functions/bug25038.phpt index 5bd549fd0f..58acf1c977 100644 --- a/ext/standard/tests/general_functions/bug25038.phpt +++ b/ext/standard/tests/general_functions/bug25038.phpt @@ -9,19 +9,19 @@ function bar($x='no argument') } try { - bar('first try'); + bar('first try'); } catch (Exception $e) { - print $e->getMessage()."\n"; + print $e->getMessage()."\n"; } try { - call_user_func('bar','second try'); + call_user_func('bar','second try'); } catch (Exception $e) { - print $e->getMessage()."\n"; + print $e->getMessage()."\n"; } ?> diff --git a/ext/standard/tests/general_functions/bug29038.phpt b/ext/standard/tests/general_functions/bug29038.phpt index d0c87fb199..5502ecf61a 100644 --- a/ext/standard/tests/general_functions/bug29038.phpt +++ b/ext/standard/tests/general_functions/bug29038.phpt @@ -3,8 +3,8 @@ Bug #29038 (extract(), EXTR_PREFIX_SAME option prefixes empty strings) --FILE-- <?php function my_print_r($a) { - ksort($a); - print_r($a); + ksort($a); + print_r($a); } function f1() { $c = extract(array("" => 1),EXTR_PREFIX_SAME,"prefix"); diff --git a/ext/standard/tests/general_functions/bug32647.phpt b/ext/standard/tests/general_functions/bug32647.phpt index 92fa547820..4f5697a0d4 100644 --- a/ext/standard/tests/general_functions/bug32647.phpt +++ b/ext/standard/tests/general_functions/bug32647.phpt @@ -10,8 +10,8 @@ function foo() class bar { - function barfoo () - { echo "bar!\n"; } + function barfoo () + { echo "bar!\n"; } } unset($obj); diff --git a/ext/standard/tests/general_functions/bug35229.phpt b/ext/standard/tests/general_functions/bug35229.phpt index 8e8895dd59..c0b3614f6e 100644 --- a/ext/standard/tests/general_functions/bug35229.phpt +++ b/ext/standard/tests/general_functions/bug35229.phpt @@ -9,9 +9,9 @@ class test2 { } spl_autoload_register(function ($class) { - eval('class test1 extends test2 {}'); + eval('class test1 extends test2 {}'); - test1::use_stack( + test1::use_stack( 1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30 diff --git a/ext/standard/tests/general_functions/bug36011.phpt b/ext/standard/tests/general_functions/bug36011.phpt index 63e0015437..3fe4e774b4 100644 --- a/ext/standard/tests/general_functions/bug36011.phpt +++ b/ext/standard/tests/general_functions/bug36011.phpt @@ -5,25 +5,25 @@ Bug #36011 (Strict errormsg wrong for call_user_func() and the likes) class TestClass { - static function test() - { - echo __METHOD__ . "()\n"; - } - - function whee() - { - array_map(array('TestClass', 'test'), array('array_value')); - } - - function whee4() - { - call_user_func(array('TestClass', 'test')); - } - - static function whee5() - { - call_user_func(array('TestClass', 'test')); - } + static function test() + { + echo __METHOD__ . "()\n"; + } + + function whee() + { + array_map(array('TestClass', 'test'), array('array_value')); + } + + function whee4() + { + call_user_func(array('TestClass', 'test')); + } + + static function whee5() + { + call_user_func(array('TestClass', 'test')); + } } TestClass::test(); diff --git a/ext/standard/tests/general_functions/bug40398.phpt b/ext/standard/tests/general_functions/bug40398.phpt index b187c64efe..274faf8308 100644 --- a/ext/standard/tests/general_functions/bug40398.phpt +++ b/ext/standard/tests/general_functions/bug40398.phpt @@ -5,64 +5,64 @@ Bug #40398 (parent and self callback functions erroneously called statically) class Base { - function __construct($msg) - { - echo __METHOD__ . "($msg)\n"; - } + function __construct($msg) + { + echo __METHOD__ . "($msg)\n"; + } } class Derived_1 extends Base { - public function __construct() - { - $args = func_get_args(); - call_user_func_array(array($this, 'Base::__construct'), $args); - } + public function __construct() + { + $args = func_get_args(); + call_user_func_array(array($this, 'Base::__construct'), $args); + } } class Derived_2 extends Base { - public function __construct() - { - $args = func_get_args(); - call_user_func_array(array($this, 'parent::__construct'), $args); - } + public function __construct() + { + $args = func_get_args(); + call_user_func_array(array($this, 'parent::__construct'), $args); + } } class Derived_3 extends Base { - public function __construct() - { - $args = func_get_args(); - call_user_func_array('Base::__construct', $args); - } + public function __construct() + { + $args = func_get_args(); + call_user_func_array('Base::__construct', $args); + } } class Derived_4 extends Base { - public function __construct() - { - $args = func_get_args(); - call_user_func_array('parent::__construct', $args); - } + public function __construct() + { + $args = func_get_args(); + call_user_func_array('parent::__construct', $args); + } } class Derived_5 extends Base { - public function __construct() - { - $args = func_get_args(); - call_user_func_array(array('Base', '__construct'), $args); - } + public function __construct() + { + $args = func_get_args(); + call_user_func_array(array('Base', '__construct'), $args); + } } class Derived_6 extends Base { - public function __construct() - { - $args = func_get_args(); - call_user_func_array(array('parent', '__construct'), $args); - } + public function __construct() + { + $args = func_get_args(); + call_user_func_array(array('parent', '__construct'), $args); + } } new Derived_1('1'); diff --git a/ext/standard/tests/general_functions/bug41037.phpt b/ext/standard/tests/general_functions/bug41037.phpt index b9bb5856d8..c8d0a668d0 100644 --- a/ext/standard/tests/general_functions/bug41037.phpt +++ b/ext/standard/tests/general_functions/bug41037.phpt @@ -4,8 +4,8 @@ Bug #41037 (unregister_tick_function() inside the tick function crash PHP) <?php function a() { - echo "hello"; - unregister_tick_function('a'); + echo "hello"; + unregister_tick_function('a'); } declare (ticks=1) { diff --git a/ext/standard/tests/general_functions/bug44667.phpt b/ext/standard/tests/general_functions/bug44667.phpt index d4d7b94b4b..00c8224416 100644 --- a/ext/standard/tests/general_functions/bug44667.phpt +++ b/ext/standard/tests/general_functions/bug44667.phpt @@ -8,8 +8,8 @@ Bug #44667 (proc_open() does not handle pipes with the mode 'wb' correctly) $pipes = array(); $descriptor_spec = array( - 0 => array('pipe', 'rb'), - 1 => array('pipe', 'wb'), + 0 => array('pipe', 'rb'), + 1 => array('pipe', 'wb'), ); $proc = proc_open('cat', $descriptor_spec, $pipes); diff --git a/ext/standard/tests/general_functions/bug47857.phpt b/ext/standard/tests/general_functions/bug47857.phpt index c06673bc34..0d2b35b09f 100644 --- a/ext/standard/tests/general_functions/bug47857.phpt +++ b/ext/standard/tests/general_functions/bug47857.phpt @@ -3,9 +3,9 @@ Bug #47851 (is_callable throws fatal error) --FILE-- <?php class foo { - function bar() { - echo "ok\n"; - } + function bar() { + echo "ok\n"; + } } var_dump(is_callable(array('foo','bar'))); try { diff --git a/ext/standard/tests/general_functions/bug49847.phpt b/ext/standard/tests/general_functions/bug49847.phpt index a35477d00c..1a09c364d8 100644 --- a/ext/standard/tests/general_functions/bug49847.phpt +++ b/ext/standard/tests/general_functions/bug49847.phpt @@ -5,17 +5,17 @@ Bug #49847 (exec() fails on lines larger then 4095 bytes) $iswin = substr(PHP_OS, 0, 3) == "WIN"; if ($iswin) { - $f = __DIR__ . '\\bug49847.tmp'; - $s = str_repeat(' ', 4097); - $s .= '1'; - file_put_contents($f, $s); - exec('type ' . $f, $output); + $f = __DIR__ . '\\bug49847.tmp'; + $s = str_repeat(' ', 4097); + $s .= '1'; + file_put_contents($f, $s); + exec('type ' . $f, $output); } else { - exec("printf %4098d 1", $output); + exec("printf %4098d 1", $output); } var_dump($output); if ($iswin) { - unlink($f); + unlink($f); } ?> --EXPECTF-- diff --git a/ext/standard/tests/general_functions/bug71891.phpt b/ext/standard/tests/general_functions/bug71891.phpt index b1f7e200d8..4de58f2c29 100644 --- a/ext/standard/tests/general_functions/bug71891.phpt +++ b/ext/standard/tests/general_functions/bug71891.phpt @@ -4,10 +4,10 @@ Bug #71891 (header_register_callback() and register_shutdown_function()) <?php header_register_callback(function () { - echo 'header'; - register_shutdown_function(function () { - echo 'shutdown'; - }); + echo 'header'; + register_shutdown_function(function () { + echo 'shutdown'; + }); }); ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/bug72306.phpt b/ext/standard/tests/general_functions/bug72306.phpt index 05c25e6f1e..761a6454b3 100644 --- a/ext/standard/tests/general_functions/bug72306.phpt +++ b/ext/standard/tests/general_functions/bug72306.phpt @@ -3,8 +3,8 @@ Bug #72306 (Heap overflow through proc_open and $env parameter) --FILE-- <?php class moo { - function __construct() { $this->a = 0; } - function __toString() { return $this->a++ ? str_repeat("a", 0x8000) : "a"; } + function __construct() { $this->a = 0; } + function __toString() { return $this->a++ ? str_repeat("a", 0x8000) : "a"; } } $env = array('some_option' => new moo()); diff --git a/ext/standard/tests/general_functions/bug72920.phpt b/ext/standard/tests/general_functions/bug72920.phpt index d3508044fb..24a8724904 100644 --- a/ext/standard/tests/general_functions/bug72920.phpt +++ b/ext/standard/tests/general_functions/bug72920.phpt @@ -3,7 +3,7 @@ Bug #72920 (Accessing a private constant using constant() creates an exception A --FILE-- <?php class Foo { - private const C1 = "a"; + private const C1 = "a"; } try { diff --git a/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt b/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt index c05a329342..a5b61d9971 100644 --- a/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt +++ b/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt @@ -4,11 +4,11 @@ call_user_func_array() passes by reference if the array element is referenced, r <?php function by_val($arg) { - $arg = 'changed'; + $arg = 'changed'; } function by_ref(&$arg) { - $arg = 'changed'; + $arg = 'changed'; } echo "------ Calling by_val() with unreferenced argument ------\n"; diff --git a/ext/standard/tests/general_functions/call_user_func_return.phpt b/ext/standard/tests/general_functions/call_user_func_return.phpt index 1457ae2e36..4719587ffc 100644 --- a/ext/standard/tests/general_functions/call_user_func_return.phpt +++ b/ext/standard/tests/general_functions/call_user_func_return.phpt @@ -7,24 +7,24 @@ $t1 = 'test1'; function test1($arg1, $arg2) { - global $t1; - echo "$arg1 $arg2\n"; - return $t1; + global $t1; + echo "$arg1 $arg2\n"; + return $t1; } $t2 = 'test2'; function & test2($arg1, $arg2) { - global $t2; - echo "$arg1 $arg2\n"; - return $t2; + global $t2; + echo "$arg1 $arg2\n"; + return $t2; } function test($func) { - debug_zval_dump($func('Direct', 'Call')); - debug_zval_dump(call_user_func_array($func, array('User', 'Func'))); + debug_zval_dump($func('Direct', 'Call')); + debug_zval_dump(call_user_func_array($func, array('User', 'Func'))); } test('test1'); diff --git a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt index 64352105db..ac4149f61c 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt @@ -29,13 +29,13 @@ class object_class { public $value4 = 30; private function foo1() { - echo "function foo1\n"; + echo "function foo1\n"; } protected function foo2() { - echo "function foo2\n"; + echo "function foo2\n"; } public function foo3() { - echo "function foo3\n"; + echo "function foo3\n"; } public $array_var = array( "key1" => 1, "key2 " => 3); diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt index 1a3eadbb80..309eca316e 100644 --- a/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt +++ b/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt @@ -69,9 +69,9 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of escapeshellarg() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(escapeshellarg($input)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(escapeshellarg($input)); + $iterator++; }; ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt index ba56db69ea..e2aec56c27 100644 --- a/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt +++ b/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt @@ -69,9 +69,9 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of escapeshellarg() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(escapeshellarg($input)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(escapeshellarg($input)); + $iterator++; }; ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt index 5254e5d57a..3f014fdf81 100644 --- a/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt +++ b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt @@ -10,21 +10,21 @@ if( substr(PHP_OS, 0, 3) != 'WIN' ) { <?php echo "*** Testing escapeshellcmd() basic operations ***\n"; $data = array( - '"abc', - "'abc", - '?<>', - '()[]{}$', - '%^', - '#&;`|*?', - '~<>\\', - '%NOENV%', - '!NOENV!' + '"abc', + "'abc", + '?<>', + '()[]{}$', + '%^', + '#&;`|*?', + '~<>\\', + '%NOENV%', + '!NOENV!' ); $count = 1; foreach ($data AS $value) { - echo "-- Test " . $count++ . " --\n"; - var_dump(escapeshellcmd($value)); + echo "-- Test " . $count++ . " --\n"; + var_dump(escapeshellcmd($value)); } echo "Done\n"; diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt index f6f354509a..a409f92a75 100644 --- a/ext/standard/tests/general_functions/floatval.phpt +++ b/ext/standard/tests/general_functions/floatval.phpt @@ -13,23 +13,23 @@ $valid_floats = array( 1.0, -1.0, 1.234, - -1.234, + -1.234, 1.2e3, - -1.2e3, - 10.0000000000000000005, - 10.5e+5, + -1.2e3, + 10.0000000000000000005, + 10.5e+5, 1e5, - -1e5, + -1e5, 1e-5, - -1e-1, - 1e+5, - -1e+5, - 1E5, - -1E5, - 1E+5, - -1E+5, - .5e+7, - -.5e+7 + -1e-1, + 1e+5, + -1e+5, + 1E5, + -1E5, + 1E+5, + -1E+5, + .5e+7, + -.5e+7 ); /* loop to check that floatval() recognizes different @@ -65,12 +65,12 @@ $not_float_types = array ( $dfp, "0.0", // string "1.0", - "-1.3e3", - "bob-1.3e3", + "-1.3e3", + "bob-1.3e3", "10 Some dollars", - "10.2 Some Dollars", - "10.0 dollar" + 1, - "10.0 dollar" + 1.0, + "10.2 Some Dollars", + "10.0 dollar" + 1, + "10.0 dollar" + 1.0, "", true, NULL, diff --git a/ext/standard/tests/general_functions/floatval_basic.phpt b/ext/standard/tests/general_functions/floatval_basic.phpt index dc1c547731..d6a3b72a19 100644 --- a/ext/standard/tests/general_functions/floatval_basic.phpt +++ b/ext/standard/tests/general_functions/floatval_basic.phpt @@ -14,23 +14,23 @@ $valid_floats = array( "1.0" => 1.0, "-1.0" => -1.0, "1.234" => 1.234, - "-1.234" => -1.234, + "-1.234" => -1.234, "1.2e3" => 1.2e3, - "-1.2e3" => -1.2e3, - "10.0000000000000000005" => 10.0000000000000000005, - "10.5e+5" => 10.5e+5, + "-1.2e3" => -1.2e3, + "10.0000000000000000005" => 10.0000000000000000005, + "10.5e+5" => 10.5e+5, "1e5" => 1e5, - "-1e5" => -1e5, + "-1e5" => -1e5, "1e5" => 1e-5, - "-1e-1" => -1e-1, - "1e+5" => 1e+5, - "-1e+5" =>-1e+5, - "1E5" => 1E5, - "-1E5" => -1E5, - "1E+5" => 1E+5, - "-1E5" => -1E+5, - ".5e+7" => .5e+7, - "-.5e+7" =>-.5e+7 + "-1e-1" => -1e-1, + "1e+5" => 1e+5, + "-1e+5" =>-1e+5, + "1E5" => 1E5, + "-1E5" => -1E5, + "1E+5" => 1E+5, + "-1E5" => -1E+5, + ".5e+7" => .5e+7, + "-.5e+7" =>-.5e+7 ); /* loop to check that floatval() recognizes different diff --git a/ext/standard/tests/general_functions/floatval_variation1.phpt b/ext/standard/tests/general_functions/floatval_variation1.phpt index 098c4ad252..e688253e3f 100644 --- a/ext/standard/tests/general_functions/floatval_variation1.phpt +++ b/ext/standard/tests/general_functions/floatval_variation1.phpt @@ -22,12 +22,12 @@ $not_float_types = array ( "directory resource" => $dfp, "\"0.0\"" => "0.0", // string "\"1.0\"" => "1.0", - "\"-1.3e3\"" => "-1.3e3", - "\"bob-1.3e3\"" => "bob-1.3e3", + "\"-1.3e3\"" => "-1.3e3", + "\"bob-1.3e3\"" => "bob-1.3e3", "\"10 Some dollars\"" => "10 Some dollars", - "\"10.2 Some Dollars\"" => "10.2 Some Dollars", - "\"10.0 dollar\" + 1" => "10.0 dollar" + 1, - "\"10.0 dollar\" + 1.0" => "10.0 dollar" + 1.0, + "\"10.2 Some Dollars\"" => "10.2 Some Dollars", + "\"10.0 dollar\" + 1" => "10.0 dollar" + 1, + "\"10.0 dollar\" + 1.0" => "10.0 dollar" + 1.0, "\"\"" => "", "true" => true, "NULL" => NULL, 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 2aee70e6d0..7876540e8a 100644 --- a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt +++ b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt @@ -22,9 +22,9 @@ $arr2 = get_defined_constants(); $n2 = count($arr2); if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) { - echo "TEST PASSED\n"; + echo "TEST PASSED\n"; } else { - echo "TEST FAILED\n"; + echo "TEST FAILED\n"; } ?> diff --git a/ext/standard/tests/general_functions/get_defined_vars_basic.phpt b/ext/standard/tests/general_functions/get_defined_vars_basic.phpt index 7f2b7a180e..19b59fea96 100644 --- a/ext/standard/tests/general_functions/get_defined_vars_basic.phpt +++ b/ext/standard/tests/general_functions/get_defined_vars_basic.phpt @@ -15,7 +15,7 @@ function f1() { $vars = get_defined_vars(); if (count($vars) != 0) { - echo "TEST FAILED\n"; + echo "TEST FAILED\n"; } echo "\n-- ..define some local variables --\n"; @@ -33,7 +33,7 @@ function f2() { $vars= get_defined_vars(); if (count($vars) != 0) { - echo "TEST FAILED\n"; + echo "TEST FAILED\n"; } echo "\n-- ...define some variables --\n"; diff --git a/ext/standard/tests/general_functions/get_include_path_basic.phpt b/ext/standard/tests/general_functions/get_include_path_basic.phpt index 809faf694d..bb7ccf542b 100644 --- a/ext/standard/tests/general_functions/get_include_path_basic.phpt +++ b/ext/standard/tests/general_functions/get_include_path_basic.phpt @@ -14,9 +14,9 @@ echo "*** Testing get_include_path()\n"; var_dump(get_include_path()); if (ini_get("include_path") == get_include_path()) { - echo "PASSED\n"; + echo "PASSED\n"; } else { - echo "FAILED\n"; + echo "FAILED\n"; } ?> diff --git a/ext/standard/tests/general_functions/getopt.phpt b/ext/standard/tests/general_functions/getopt.phpt index 67864e9a96..4424072d1a 100644 --- a/ext/standard/tests/general_functions/getopt.phpt +++ b/ext/standard/tests/general_functions/getopt.phpt @@ -7,7 +7,7 @@ register_argc_argv=On variables_order=GPS --FILE-- <?php - var_dump(getopt("d:m:j:vht")); + var_dump(getopt("d:m:j:vht")); ?> --EXPECT-- array(5) { diff --git a/ext/standard/tests/general_functions/getopt_002.phpt b/ext/standard/tests/general_functions/getopt_002.phpt index 1bf65e70ab..6ae2d3cb3d 100644 --- a/ext/standard/tests/general_functions/getopt_002.phpt +++ b/ext/standard/tests/general_functions/getopt_002.phpt @@ -7,7 +7,7 @@ register_argc_argv=On variables_order=GPS --FILE-- <?php - var_dump(getopt("2a:vcd1")); + var_dump(getopt("2a:vcd1")); ?> --EXPECT-- array(4) { diff --git a/ext/standard/tests/general_functions/getopt_003.phpt b/ext/standard/tests/general_functions/getopt_003.phpt index e1a5146065..e40de84674 100644 --- a/ext/standard/tests/general_functions/getopt_003.phpt +++ b/ext/standard/tests/general_functions/getopt_003.phpt @@ -7,7 +7,7 @@ register_argc_argv=On variables_order=GPS --FILE-- <?php - var_dump(getopt("2a:vcd1", array("another:", 12, 0, 1, "v"))); + var_dump(getopt("2a:vcd1", array("another:", 12, 0, 1, "v"))); ?> --EXPECT-- array(7) { diff --git a/ext/standard/tests/general_functions/getopt_004.phpt b/ext/standard/tests/general_functions/getopt_004.phpt index ac0aafe27b..5e8e810d38 100644 --- a/ext/standard/tests/general_functions/getopt_004.phpt +++ b/ext/standard/tests/general_functions/getopt_004.phpt @@ -7,7 +7,7 @@ register_argc_argv=On variables_order=GPS --FILE-- <?php - var_dump(getopt("v::", array("v::"))); + var_dump(getopt("v::", array("v::"))); ?> --EXPECT-- array(1) { diff --git a/ext/standard/tests/general_functions/getopt_005.phpt b/ext/standard/tests/general_functions/getopt_005.phpt index 3fa1791eab..d75c4709ea 100644 --- a/ext/standard/tests/general_functions/getopt_005.phpt +++ b/ext/standard/tests/general_functions/getopt_005.phpt @@ -7,7 +7,7 @@ register_argc_argv=On variables_order=GPS --FILE-- <?php - var_dump(getopt("a:", array("arg:"))); + var_dump(getopt("a:", array("arg:"))); ?> --EXPECT-- array(2) { diff --git a/ext/standard/tests/general_functions/getrusage_basic.phpt b/ext/standard/tests/general_functions/getrusage_basic.phpt index 7aaacd51a0..b057b57fae 100644 --- a/ext/standard/tests/general_functions/getrusage_basic.phpt +++ b/ext/standard/tests/general_functions/getrusage_basic.phpt @@ -15,7 +15,7 @@ echo "Simple testcase for getrusage() function\n"; $dat = getrusage(); if (!is_array($dat)) { - echo "TEST FAILED : getrusage should return an array\n"; + echo "TEST FAILED : getrusage should return an array\n"; } // echo the fields which are common to all platforms diff --git a/ext/standard/tests/general_functions/getservbyname_basic.phpt b/ext/standard/tests/general_functions/getservbyname_basic.phpt index adaa7afb43..edc210fc39 100644 --- a/ext/standard/tests/general_functions/getservbyname_basic.phpt +++ b/ext/standard/tests/general_functions/getservbyname_basic.phpt @@ -8,12 +8,12 @@ Simone Gentili (sensorario@gmail.com) --FILE-- <?php - $services = array('http', 'ftp', 'ssh', 'telnet', 'imap', 'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www'); + $services = array('http', 'ftp', 'ssh', 'telnet', 'imap', 'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www'); - foreach ($services as $service) { - $port = getservbyname($service, 'tcp'); - var_dump($port); - } + foreach ($services as $service) { + $port = getservbyname($service, 'tcp'); + var_dump($port); + } ?> diff --git a/ext/standard/tests/general_functions/getservbyport_basic.phpt b/ext/standard/tests/general_functions/getservbyport_basic.phpt index b9e0f83c98..cc02a4508e 100644 --- a/ext/standard/tests/general_functions/getservbyport_basic.phpt +++ b/ext/standard/tests/general_functions/getservbyport_basic.phpt @@ -7,21 +7,21 @@ Michele Orselli (mo@ideato.it) Simone Gentili (sensorario@gmail.com) --FILE-- <?php - if (file_exists("/etc/services")) { - $file = "/etc/services"; - } - elseif(substr(PHP_OS,0,3) == "WIN") $file = "C:/WINDOWS/system32/drivers/etc/services"; - else die(PHP_OS. " unsupported"); + if (file_exists("/etc/services")) { + $file = "/etc/services"; + } + elseif(substr(PHP_OS,0,3) == "WIN") $file = "C:/WINDOWS/system32/drivers/etc/services"; + else die(PHP_OS. " unsupported"); - if(file_exists($file)){ - $services = file_get_contents($file); + if(file_exists($file)){ + $services = file_get_contents($file); $service = getservbyport( 80, "tcp" ); if(preg_match("/$service\s+80\/tcp/", $services)) { - echo "PASS\n"; - } - }else{ - echo "Services file not found in expected location\n"; - } + echo "PASS\n"; + } + }else{ + echo "Services file not found in expected location\n"; + } ?> --EXPECT-- PASS diff --git a/ext/standard/tests/general_functions/getservbyport_variation1.phpt b/ext/standard/tests/general_functions/getservbyport_variation1.phpt index f387161bf4..349fe16a94 100644 --- a/ext/standard/tests/general_functions/getservbyport_variation1.phpt +++ b/ext/standard/tests/general_functions/getservbyport_variation1.phpt @@ -9,11 +9,11 @@ Michele Orselli (mo@ideato.it) Simone Gentili (sensorario@gmail.com) --FILE-- <?php - var_dump(getservbyport( -1, "tcp" )); - var_dump(getservbyport( 80, "ppp" )); - var_dump(getservbyport( null, null)); - var_dump(getservbyport( 2, 2)); - var_dump(getservbyport( "80", "tcp")); + var_dump(getservbyport( -1, "tcp" )); + var_dump(getservbyport( 80, "ppp" )); + var_dump(getservbyport( null, null)); + var_dump(getservbyport( 2, 2)); + var_dump(getservbyport( "80", "tcp")); ?> --EXPECTF-- diff --git a/ext/standard/tests/general_functions/intval_variation1.phpt b/ext/standard/tests/general_functions/intval_variation1.phpt index 470fa03630..c968b39a90 100644 --- a/ext/standard/tests/general_functions/intval_variation1.phpt +++ b/ext/standard/tests/general_functions/intval_variation1.phpt @@ -12,10 +12,10 @@ echo "*** Testing intval() : usage variation ***\n"; // Define error handler function test_error_handler($err_no, $err_msg, $filename, $linenum) { - if (error_reporting() & $err_no) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } + if (error_reporting() & $err_no) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } } set_error_handler('test_error_handler'); @@ -29,9 +29,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString diff --git a/ext/standard/tests/general_functions/is_resource.phpt b/ext/standard/tests/general_functions/is_resource.phpt index 2717e3fa43..ff6f1fd422 100644 --- a/ext/standard/tests/general_functions/is_resource.phpt +++ b/ext/standard/tests/general_functions/is_resource.phpt @@ -2,9 +2,9 @@ Bug #27822 (is_resource() returns TRUE for closed resources) --FILE-- <?php - $f = fopen(__FILE__, 'r'); - fclose($f); - var_dump(is_resource($f)); + $f = fopen(__FILE__, 'r'); + fclose($f); + var_dump(is_resource($f)); ?> --EXPECT-- bool(false) diff --git a/ext/standard/tests/general_functions/is_resource_basic.phpt b/ext/standard/tests/general_functions/is_resource_basic.phpt index f8e9ff6369..06988850ee 100644 --- a/ext/standard/tests/general_functions/is_resource_basic.phpt +++ b/ext/standard/tests/general_functions/is_resource_basic.phpt @@ -11,39 +11,39 @@ echo "*** Testing is_resource() : basic functionality ***\n"; class Hello { public function SayHello($arg) { - echo "Hello\n"; + echo "Hello\n"; } } $vars = array( - false, - true, - 10, - 10.5, - "Helo World", - array(1,2,3,4,5), - NULL, - new Hello()); + false, + true, + 10, + 10.5, + "Helo World", + array(1,2,3,4,5), + NULL, + new Hello()); $types = array( - "bool=false", - "bool=true", - "integer", - "double", - "string", - "array", - "NULL", - "object"); + "bool=false", + "bool=true", + "integer", + "double", + "string", + "array", + "NULL", + "object"); echo "\nNon-resource type cases\n"; for ($i=0; $i < count($vars); $i++) { - if (is_resource($vars[$i])) { - echo $types[$i]. " test returns TRUE\n"; - } else { - echo $types[$i]. " test returns FALSE\n"; - } + if (is_resource($vars[$i])) { + echo $types[$i]. " test returns TRUE\n"; + } else { + echo $types[$i]. " test returns FALSE\n"; + } } $res = fopen(__FILE__, "r"); @@ -51,9 +51,9 @@ echo "\nResource type..var_dump after file open returns\n"; var_dump($res); echo "Resource type..after file open is_resource() returns"; if (is_resource($res)) { - echo " TRUE\n"; + echo " TRUE\n"; } else { - echo " FALSE\n"; + echo " FALSE\n"; } fclose($res); @@ -61,9 +61,9 @@ echo "\nResource type..var_dump after file close returns\n"; var_dump($res); echo "Resource type..after file close is_resource() returns"; if (is_resource($res)) { - echo " TRUE\n"; + echo " TRUE\n"; } else { - echo " FALSE\n"; + echo " FALSE\n"; } diff --git a/ext/standard/tests/general_functions/is_string.phpt b/ext/standard/tests/general_functions/is_string.phpt index a062cc17e1..7760f79831 100644 --- a/ext/standard/tests/general_functions/is_string.phpt +++ b/ext/standard/tests/general_functions/is_string.phpt @@ -17,7 +17,7 @@ EOT; /* heredoc string with only numerics */ $heredoc_numeric_string = <<<EOT 123456 3993 -4849 string +4849 string EOT; /* null heardoc string */ $heredoc_empty_string = <<<EOT diff --git a/ext/standard/tests/general_functions/ob_get_length_basic.phpt b/ext/standard/tests/general_functions/ob_get_length_basic.phpt index 12e0a72026..46d5d2d0f6 100644 --- a/ext/standard/tests/general_functions/ob_get_length_basic.phpt +++ b/ext/standard/tests/general_functions/ob_get_length_basic.phpt @@ -12,11 +12,11 @@ output_buffering=0 function dump_string_length( $string ) { - ob_start(); - echo $string; - $len = ob_get_length(); - ob_end_clean(); - var_dump( $len ); + ob_start(); + echo $string; + $len = ob_get_length(); + ob_end_clean(); + var_dump( $len ); } echo "*** Testing ob_get_length() : basic functionality ***\n"; diff --git a/ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt b/ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt index 58b6f19f5c..980ae129ef 100644 --- a/ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt +++ b/ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt @@ -7,7 +7,7 @@ session.trans_sid_tags="a=href,area=href,frame=src,form=" url_rewriter.tags="a=href,area=href,frame=src,form=" --FILE-- <?php - ob_start(); + ob_start(); // Common setting ini_set('url_rewriter.hosts', 'php.net,www.php.net'); ini_set('session.trans_sid_hosts', 'php.net,www.php.net'); diff --git a/ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt b/ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt index 6b0c4e85a9..e888932a60 100644 --- a/ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt +++ b/ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt @@ -7,7 +7,7 @@ session.trans_sid_tags="a=href,area=href,frame=src,form=" url_rewriter.tags="a=href,area=href,frame=src,form=" --FILE-- <?php - ob_start(); + ob_start(); // Common setting ini_set('url_rewriter.hosts', 'php.net,www.php.net'); ini_set('session.trans_sid_hosts', 'php.net,www.php.net'); diff --git a/ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt b/ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt index 9e35f967f0..0cf10f7249 100644 --- a/ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt +++ b/ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt @@ -7,7 +7,7 @@ session.trans_sid_tags="a=href,area=href,frame=src,form=" url_rewriter.tags="a=href,area=href,frame=src,form=" --FILE-- <?php - ob_start(); + ob_start(); // Common setting ini_set('url_rewriter.hosts', 'example.com'); ini_set('session.use_only_cookies', 0); diff --git a/ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt b/ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt index 2dda4e7896..332f7cfdc2 100644 --- a/ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt +++ b/ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt @@ -7,7 +7,7 @@ session.trans_sid_tags="a=href,area=href,frame=src,form=" url_rewriter.tags="a=href,area=href,frame=src,form=" --FILE-- <?php - ob_start(); + ob_start(); // Common setting ini_set('url_rewriter.hosts', 'example.com'); ini_set('session.use_only_cookies', 1); diff --git a/ext/standard/tests/general_functions/parse_ini_string_001.phpt b/ext/standard/tests/general_functions/parse_ini_string_001.phpt index 1621fe9f16..de1daa7637 100644 --- a/ext/standard/tests/general_functions/parse_ini_string_001.phpt +++ b/ext/standard/tests/general_functions/parse_ini_string_001.phpt @@ -23,7 +23,7 @@ PHP_CONSTANT = 1.2345678 HELLO = HELLO [date] -date = +date = time = [paths] @@ -62,7 +62,7 @@ Non_alpha11 = / Non_alpha12 = \ ;These chars have a special meaning when used in the value, ; hence parser throws an error -;Non_alpha13 = & +;Non_alpha13 = & ;Non_alpha14 = ^ ;Non_alpha15 = {} ;Non_alpha16 = | @@ -170,7 +170,7 @@ Key16 = Null Key17 = nuLL Key18 = null -[ReservedKeys_as_Keys] +[ReservedKeys_as_Keys] ; Expected:error, reserved key words must not be used as keys for ini file ;YES = 1 ;Yes = 2 diff --git a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt index 37f8e17af2..6bf3b2c0a6 100644 --- a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt +++ b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt @@ -15,71 +15,71 @@ if (getenv('SKIP_SLOW_TESTS')) { --FILE-- <?php function get_priority_from_wmic() { - static $bin, $pid; + static $bin, $pid; - if (!$bin) { - $t = explode('\\', PHP_BINARY); + if (!$bin) { + $t = explode('\\', PHP_BINARY); - $bin = end($t); - $pid = getmypid(); - } + $bin = end($t); + $pid = getmypid(); + } - $t = ''; - $p = popen('wmic process where name="' . $bin . '"', 'r'); + $t = ''; + $p = popen('wmic process where name="' . $bin . '"', 'r'); - if (!$p) { - return false; - } + if (!$p) { + return false; + } - while(!feof($p)) { - $t .= fread($p, 1024); - } + while(!feof($p)) { + $t .= fread($p, 1024); + } - pclose($p); + pclose($p); - $t = explode(PHP_EOL, $t); + $t = explode(PHP_EOL, $t); - $f = false; - $m = [ - strpos($t[0], ' ProcessId' ), - strpos($t[0], ' Priority ') - ]; + $f = false; + $m = [ + strpos($t[0], ' ProcessId' ), + strpos($t[0], ' Priority ') + ]; - foreach ($t as $n => $l) { - if (!$n || empty($l)) { - continue; - } + foreach ($t as $n => $l) { + if (!$n || empty($l)) { + continue; + } - $d = []; + $d = []; - foreach ($m as $c) { - $d[] = (int) substr($l, $c + 1, strpos($l, ' ', $c + 2) - ($c + 1)); - } + foreach ($m as $c) { + $d[] = (int) substr($l, $c + 1, strpos($l, ' ', $c + 2) - ($c + 1)); + } - if ($d[0] === $pid) { - return $d[1]; - } - } + if ($d[0] === $pid) { + return $d[1]; + } + } - return false; + return false; } $p = [ - /* '<verbose name>' => ['<wmic value>', '<proc_nice value>'] */ + /* '<verbose name>' => ['<wmic value>', '<proc_nice value>'] */ - 'Idle' => [4, 10], - 'Below normal' => [6, 5], - 'Normal' => [8, 0], - 'Above normal' => [10, -5], - 'High priority' => [13, -10] - ]; + 'Idle' => [4, 10], + 'Below normal' => [6, 5], + 'Normal' => [8, 0], + 'Above normal' => [10, -5], + 'High priority' => [13, -10] + ]; foreach ($p as $test => $data) { - printf('Testing \'%s\' (%d): ', $test, $data[1]); + printf('Testing \'%s\' (%d): ', $test, $data[1]); - proc_nice($data[1]); + proc_nice($data[1]); - print (($wp = get_priority_from_wmic()) === $data[0] ? 'Passed' : 'Failed (' . $wp . ')') . PHP_EOL; + print (($wp = get_priority_from_wmic()) === $data[0] ? 'Passed' : 'Failed (' . $wp . ')') . PHP_EOL; } ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/proc_nice_basic.phpt b/ext/standard/tests/general_functions/proc_nice_basic.phpt index d14a5f62a9..687152ee10 100644 --- a/ext/standard/tests/general_functions/proc_nice_basic.phpt +++ b/ext/standard/tests/general_functions/proc_nice_basic.phpt @@ -12,21 +12,21 @@ if(substr(strtoupper(PHP_OS), 0, 3) == 'WIN') die('skip. not for Windows'); ?> --FILE-- <?php - function getNice($id) - { - $res = shell_exec('ps -p ' . $id .' -o "pid,nice"'); - preg_match('/^\s*\w+\s+\w+\s*(\d+)\s+(\d+)/m', $res, $matches); - if (count($matches) > 2) - return $matches[2]; - else - return -1; - } - $delta = 10; - $pid = getmypid(); - $niceBefore = getNice($pid); - proc_nice($delta); - $niceAfter = getNice($pid); - var_dump($niceBefore == ($niceAfter - $delta)); + function getNice($id) + { + $res = shell_exec('ps -p ' . $id .' -o "pid,nice"'); + preg_match('/^\s*\w+\s+\w+\s*(\d+)\s+(\d+)/m', $res, $matches); + if (count($matches) > 2) + return $matches[2]; + else + return -1; + } + $delta = 10; + $pid = getmypid(); + $niceBefore = getNice($pid); + proc_nice($delta); + $niceAfter = getNice($pid); + var_dump($niceBefore == ($niceAfter - $delta)); ?> --EXPECT-- bool(true) diff --git a/ext/standard/tests/general_functions/proc_open-mb0.phpt b/ext/standard/tests/general_functions/proc_open-mb0.phpt index 672a8cd357..c97ebda970 100644 --- a/ext/standard/tests/general_functions/proc_open-mb0.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb0.phpt @@ -13,24 +13,24 @@ $f = __DIR__ . DIRECTORY_SEPARATOR . "proc_only_mb0.php"; file_put_contents($f,'<?php var_dump($argv); ?>'); $ds = array( - 0 => array("pipe", "r"), - 1 => array("pipe", "w"), - 2 => array("pipe", "w") - ); + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "w") + ); $p = proc_open( - "$php -n $f テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス füße карамба", - $ds, - $pipes, - NULL, - NULL, - array("bypass_shell" => true) - ); + "$php -n $f テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス füße карамба", + $ds, + $pipes, + NULL, + NULL, + array("bypass_shell" => true) + ); $out = ""; while (!feof($pipes[1])) { - $out .= fread($pipes[1], 1024); + $out .= fread($pipes[1], 1024); } proc_close($p); diff --git a/ext/standard/tests/general_functions/proc_open-mb1.phpt b/ext/standard/tests/general_functions/proc_open-mb1.phpt index af46346fbb..8a735cf306 100644 --- a/ext/standard/tests/general_functions/proc_open-mb1.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb1.phpt @@ -13,21 +13,21 @@ $f = __DIR__ . DIRECTORY_SEPARATOR . "proc_only_mb1.php"; file_put_contents($f,'<?php var_dump($argv); ?>'); $ds = array( - 0 => array("pipe", "r"), - 1 => array("pipe", "w"), - 2 => array("pipe", "w") - ); + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "w") + ); $p = proc_open( - "$php -n $f テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス füße карамба", - $ds, - $pipes - ); + "$php -n $f テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス füße карамба", + $ds, + $pipes + ); $out = ""; while (!feof($pipes[1])) { - $out .= fread($pipes[1], 1024); + $out .= fread($pipes[1], 1024); } proc_close($p); diff --git a/ext/standard/tests/general_functions/proc_open.phpt b/ext/standard/tests/general_functions/proc_open.phpt index 4d0a21d165..cf0bffffb5 100644 --- a/ext/standard/tests/general_functions/proc_open.phpt +++ b/ext/standard/tests/general_functions/proc_open.phpt @@ -8,16 +8,16 @@ if (!function_exists("proc_open")) echo "skip proc_open() is not available"; --FILE-- <?php $ds = array( - 0 => array("pipe", "r"), - 1 => array("pipe", "w"), - 2 => array("pipe", "w") - ); + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "w") + ); $cat = proc_open( - "/bin/cat", - $ds, - $pipes - ); + "/bin/cat", + $ds, + $pipes + ); proc_close($cat); diff --git a/ext/standard/tests/general_functions/proc_open02.phpt b/ext/standard/tests/general_functions/proc_open02.phpt index d5d878ed24..a81ce5934f 100644 --- a/ext/standard/tests/general_functions/proc_open02.phpt +++ b/ext/standard/tests/general_functions/proc_open02.phpt @@ -10,9 +10,9 @@ if (getenv('SKIP_SLOW_TESTS')) echo 'skip slow test'; $ds = array(array('pipe', 'r')); $cat = proc_open( - '/bin/sleep 2', - $ds, - $pipes + '/bin/sleep 2', + $ds, + $pipes ); usleep(20000); // let the OS run the sleep process before sending the signal diff --git a/ext/standard/tests/general_functions/proc_open_pipes1.phpt b/ext/standard/tests/general_functions/proc_open_pipes1.phpt index dd0550f7fd..076b8c941e 100644 --- a/ext/standard/tests/general_functions/proc_open_pipes1.phpt +++ b/ext/standard/tests/general_functions/proc_open_pipes1.phpt @@ -4,7 +4,7 @@ proc_open() with > 16 pipes <?php for ($i = 3; $i<= 30; $i++) { - $spec[$i] = array('pipe', 'w'); + $spec[$i] = array('pipe', 'w'); } $php = getenv("TEST_PHP_EXECUTABLE"); diff --git a/ext/standard/tests/general_functions/proc_open_pipes3.phpt b/ext/standard/tests/general_functions/proc_open_pipes3.phpt index 0cb9f03eb8..848850b327 100644 --- a/ext/standard/tests/general_functions/proc_open_pipes3.phpt +++ b/ext/standard/tests/general_functions/proc_open_pipes3.phpt @@ -4,7 +4,7 @@ proc_open() with invalid pipes <?php for ($i = 3; $i<= 5; $i++) { - $spec[$i] = array('pipe', 'w'); + $spec[$i] = array('pipe', 'w'); } $php = getenv("TEST_PHP_EXECUTABLE"); diff --git a/ext/standard/tests/general_functions/sleep_basic.phpt b/ext/standard/tests/general_functions/sleep_basic.phpt index 3c7bcdfc09..4371cc99ed 100644 --- a/ext/standard/tests/general_functions/sleep_basic.phpt +++ b/ext/standard/tests/general_functions/sleep_basic.phpt @@ -32,9 +32,9 @@ echo "Thread slept for " . $time . " seconds\n"; echo "Return value: " . $result . "\n"; if ($time >= $sleeplow) { - echo "TEST PASSED\n"; + echo "TEST PASSED\n"; } else { - echo "TEST FAILED - time is ${time} secs and sleep was ${sleeptime} secs\n"; + echo "TEST FAILED - time is ${time} secs and sleep was ${sleeptime} secs\n"; } ?> --EXPECTF-- diff --git a/ext/standard/tests/general_functions/type.phpt b/ext/standard/tests/general_functions/type.phpt index 342b353baf..a32e4b44a1 100644 --- a/ext/standard/tests/general_functions/type.phpt +++ b/ext/standard/tests/general_functions/type.phpt @@ -4,7 +4,7 @@ gettype(), settype() and friends <?php function foo($errno, $errstr, $errfile, $errline) { - var_dump($errstr); + var_dump($errstr); } set_error_handler("foo"); @@ -17,43 +17,43 @@ $var1 = "another string"; $var2 = array(2,3,4); $array = array( - array(1,2,3), - $var1, - $var2, - 1, - 2.0, - NULL, - false, - "some string", - $fp, - $fp1, - new stdclass, + array(1,2,3), + $var1, + $var2, + 1, + 2.0, + NULL, + false, + "some string", + $fp, + $fp1, + new stdclass, ); $types = array( - "null", - "integer", - "double", - "boolean", - "resource", - "array", - "object", - "string" - ); + "null", + "integer", + "double", + "boolean", + "resource", + "array", + "object", + "string" + ); foreach ($array as $var) { - var_dump(gettype($var)); + var_dump(gettype($var)); } foreach ($types as $type) { - foreach ($array as $var) { - try { - var_dump(settype($var, $type)); - } catch (Error $e) { - echo "Error: ", $e->getMessage(), "\n"; - } - var_dump($var); - } + foreach ($array as $var) { + try { + var_dump(settype($var, $type)); + } catch (Error $e) { + echo "Error: ", $e->getMessage(), "\n"; + } + var_dump($var); + } } echo "Done\n"; diff --git a/ext/standard/tests/general_functions/uniqid_basic.phpt b/ext/standard/tests/general_functions/uniqid_basic.phpt index 66cfdf8f97..6bfc478fad 100644 --- a/ext/standard/tests/general_functions/uniqid_basic.phpt +++ b/ext/standard/tests/general_functions/uniqid_basic.phpt @@ -18,19 +18,19 @@ echo "uniqid() with a prefix\n"; // Use a fixed prefix so we can ensure length of o/p id is fixed $prefix = array ( - 99999, - "99999", - 10.5e2, - null, - true, - false - ); + 99999, + "99999", + 10.5e2, + null, + true, + false + ); for ($i = 0; $i < count($prefix); $i++) { - var_dump(uniqid($prefix[$i])); - var_dump(uniqid($prefix[$i], true)); - var_dump(uniqid($prefix[$i], false)); - echo "\n"; + var_dump(uniqid($prefix[$i])); + var_dump(uniqid($prefix[$i], true)); + var_dump(uniqid($prefix[$i], false)); + echo "\n"; } ?> diff --git a/ext/standard/tests/general_functions/usleep_basic.phpt b/ext/standard/tests/general_functions/usleep_basic.phpt index d057d47c11..c2af61f8a2 100644 --- a/ext/standard/tests/general_functions/usleep_basic.phpt +++ b/ext/standard/tests/general_functions/usleep_basic.phpt @@ -30,9 +30,9 @@ $time = ($time_end - $time_start) * 1000 * 1000; $summary = "Thread slept for " . $time . " micro-seconds\n"; if ($time >= $sleeplow) { - echo "TEST PASSED: $summary"; + echo "TEST PASSED: $summary"; } else { - echo "TEST FAILED: $summary"; + echo "TEST FAILED: $summary"; } ?> --EXPECTF-- diff --git a/ext/standard/tests/general_functions/var_export-locale.phpt b/ext/standard/tests/general_functions/var_export-locale.phpt index 3512006624..bdc61d9928 100644 --- a/ext/standard/tests/general_functions/var_export-locale.phpt +++ b/ext/standard/tests/general_functions/var_export-locale.phpt @@ -58,12 +58,12 @@ $counter++; echo "*** Testing var_export() with valid boolean values ***\n"; // different valid boolean values $valid_bool = array( - 1, - TRUE, + 1, + TRUE, true, 0, - FALSE, - false + FALSE, + false ); $counter = 1; /* Loop to check for above boolean values with var_export() */ diff --git a/ext/standard/tests/general_functions/var_export-locale_32.phpt b/ext/standard/tests/general_functions/var_export-locale_32.phpt index baaddcefae..d64fa3b8d7 100644 --- a/ext/standard/tests/general_functions/var_export-locale_32.phpt +++ b/ext/standard/tests/general_functions/var_export-locale_32.phpt @@ -58,12 +58,12 @@ $counter++; echo "*** Testing var_export() with valid boolean values ***\n"; // different valid boolean values $valid_bool = array( - 1, - TRUE, + 1, + TRUE, true, 0, - FALSE, - false + FALSE, + false ); $counter = 1; /* Loop to check for above boolean values with var_export() */ diff --git a/ext/standard/tests/general_functions/var_export_basic1.phpt b/ext/standard/tests/general_functions/var_export_basic1.phpt index f97fab2396..27c56a7b8f 100644 --- a/ext/standard/tests/general_functions/var_export_basic1.phpt +++ b/ext/standard/tests/general_functions/var_export_basic1.phpt @@ -40,12 +40,12 @@ $valid_ints = array( /* Loop to check for above integer values with var_export() */ echo "\n*** Output for integer values ***\n"; foreach($valid_ints as $key => $int_value) { - echo "\n-- Iteration: $key --\n"; - var_export( $int_value ); - echo "\n"; - var_export( $int_value, FALSE); - echo "\n"; - var_dump( var_export( $int_value, TRUE) ); + echo "\n-- Iteration: $key --\n"; + var_export( $int_value ); + echo "\n"; + var_export( $int_value, FALSE); + echo "\n"; + var_dump( var_export( $int_value, TRUE) ); } ?> diff --git a/ext/standard/tests/general_functions/var_export_basic1_32.phpt b/ext/standard/tests/general_functions/var_export_basic1_32.phpt index 7473fbd8a3..0eb6ce889f 100644 --- a/ext/standard/tests/general_functions/var_export_basic1_32.phpt +++ b/ext/standard/tests/general_functions/var_export_basic1_32.phpt @@ -40,12 +40,12 @@ $valid_ints = array( /* Loop to check for above integer values with var_export() */ echo "\n*** Output for integer values ***\n"; foreach($valid_ints as $key => $int_value) { - echo "\n-- Iteration: $key --\n"; - var_export( $int_value ); - echo "\n"; - var_export( $int_value, FALSE); - echo "\n"; - var_dump( var_export( $int_value, TRUE) ); + echo "\n-- Iteration: $key --\n"; + var_export( $int_value ); + echo "\n"; + var_export( $int_value, FALSE); + echo "\n"; + var_dump( var_export( $int_value, TRUE) ); } ?> diff --git a/ext/standard/tests/general_functions/var_export_basic2.phpt b/ext/standard/tests/general_functions/var_export_basic2.phpt index 87e92f20fd..1698a28001 100644 --- a/ext/standard/tests/general_functions/var_export_basic2.phpt +++ b/ext/standard/tests/general_functions/var_export_basic2.phpt @@ -12,24 +12,24 @@ Test var_export() function with valid boolean values echo "*** Testing var_export() with valid boolean values ***\n"; // different valid boolean values $valid_bool = array( - "1" => 1, - "TRUE" => TRUE, + "1" => 1, + "TRUE" => TRUE, "true" => true, "0" => 0, - "FALSE" => FALSE, - "false" => false + "FALSE" => FALSE, + "false" => false ); /* Loop to check for above boolean values with var_export() */ echo "\n*** Output for boolean values ***\n"; foreach($valid_bool as $key => $bool_value) { - echo "\n-- Iteration: $key --\n"; - var_export( $bool_value ); - echo "\n"; - var_export( $bool_value, FALSE); - echo "\n"; - var_dump( var_export( $bool_value, TRUE) ); - echo "\n"; + echo "\n-- Iteration: $key --\n"; + var_export( $bool_value ); + echo "\n"; + var_export( $bool_value, FALSE); + echo "\n"; + var_dump( var_export( $bool_value, TRUE) ); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/var_export_basic3.phpt b/ext/standard/tests/general_functions/var_export_basic3.phpt index 38618faea9..92d5bbbe76 100644 --- a/ext/standard/tests/general_functions/var_export_basic3.phpt +++ b/ext/standard/tests/general_functions/var_export_basic3.phpt @@ -13,37 +13,37 @@ serialize_precision=17 echo "*** Testing var_export() with valid float values ***\n"; // different valid float values $valid_floats = array( - "-2147483649" => (float)-2147483649, // float value - "2147483648" => (float)2147483648, // float value - "-0x80000001" => (float)-0x80000001, // float value, beyond max negative int - "0x800000001" => (float)0x800000001, // float value, beyond max positive int - "020000000001" => (float)020000000001, // float value, beyond max positive int - "-020000000001" => (float)-020000000001, // float value, beyond max negative int - "0.0" => 0.0, - "-0.1" => -0.1, - "10.0000000000000000005" => 10.0000000000000000005, - "10.5e+5" => 10.5e+5, - "1e5" => 1e5, - "1e-5" => 1e-5, - "1e+5" => 1e+5, - "1E5" => 1E5, - "1E+5" => 1E+5, - "1E-5" => 1E-5, - ".5e+7" => .5e+7, - ".6e-19" => .6e-19, - ".05E+44" => .05E+44, - ".0034E-30" => .0034E-30 + "-2147483649" => (float)-2147483649, // float value + "2147483648" => (float)2147483648, // float value + "-0x80000001" => (float)-0x80000001, // float value, beyond max negative int + "0x800000001" => (float)0x800000001, // float value, beyond max positive int + "020000000001" => (float)020000000001, // float value, beyond max positive int + "-020000000001" => (float)-020000000001, // float value, beyond max negative int + "0.0" => 0.0, + "-0.1" => -0.1, + "10.0000000000000000005" => 10.0000000000000000005, + "10.5e+5" => 10.5e+5, + "1e5" => 1e5, + "1e-5" => 1e-5, + "1e+5" => 1e+5, + "1E5" => 1E5, + "1E+5" => 1E+5, + "1E-5" => 1E-5, + ".5e+7" => .5e+7, + ".6e-19" => .6e-19, + ".05E+44" => .05E+44, + ".0034E-30" => .0034E-30 ); /* Loop to check for above float values with var_export() */ echo "\n*** Output for float values ***\n"; foreach($valid_floats as $key => $float_value) { - echo "\n-- Iteration: $key --\n"; - var_export( $float_value ); - echo "\n"; - var_export( $float_value, FALSE); - echo "\n"; - var_dump( var_export( $float_value, TRUE) ); - echo "\n"; + echo "\n-- Iteration: $key --\n"; + var_export( $float_value ); + echo "\n"; + var_export( $float_value, FALSE); + echo "\n"; + var_dump( var_export( $float_value, TRUE) ); + echo "\n"; } ?> diff --git a/ext/standard/tests/general_functions/var_export_basic4.phpt b/ext/standard/tests/general_functions/var_export_basic4.phpt index c1b7b8cb5b..789140d255 100644 --- a/ext/standard/tests/general_functions/var_export_basic4.phpt +++ b/ext/standard/tests/general_functions/var_export_basic4.phpt @@ -33,13 +33,13 @@ $valid_strings = array( /* Loop to check for above strings with var_export() */ echo "\n*** Output for strings ***\n"; foreach($valid_strings as $key => $str) { - echo "\n-- Iteration: $key --\n"; - var_export( $str ); - echo "\n"; - var_export( $str, FALSE); - echo "\n"; - var_dump( var_export( $str, TRUE) ); - echo "\n"; + echo "\n-- Iteration: $key --\n"; + var_export( $str ); + echo "\n"; + var_export( $str, FALSE); + echo "\n"; + var_dump( var_export( $str, TRUE) ); + echo "\n"; } ?> diff --git a/ext/standard/tests/general_functions/var_export_basic5.phpt b/ext/standard/tests/general_functions/var_export_basic5.phpt index 989197a23d..731e84ff99 100644 --- a/ext/standard/tests/general_functions/var_export_basic5.phpt +++ b/ext/standard/tests/general_functions/var_export_basic5.phpt @@ -34,13 +34,13 @@ $valid_arrays = array( /* Loop to check for above arrays with var_export() */ echo "\n*** Output for arrays ***\n"; foreach($valid_arrays as $key => $arr) { - echo "\n--Iteration: $key --\n"; - var_export( $arr ); - echo "\n"; - var_export( $arr, FALSE); - echo "\n"; - var_dump( var_export( $arr, TRUE) ); - echo "\n"; + echo "\n--Iteration: $key --\n"; + var_export( $arr ); + echo "\n"; + var_export( $arr, FALSE); + echo "\n"; + var_dump( var_export( $arr, TRUE) ); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/var_export_basic6.phpt b/ext/standard/tests/general_functions/var_export_basic6.phpt index a120f2fd1a..4d09f0a794 100644 --- a/ext/standard/tests/general_functions/var_export_basic6.phpt +++ b/ext/standard/tests/general_functions/var_export_basic6.phpt @@ -92,13 +92,13 @@ $valid_objects = array( /* Loop to check for above objects with var_export() */ echo "\n*** Output for objects ***\n"; foreach($valid_objects as $key => $obj) { - echo "\n-- Iteration: $key --\n"; - var_export( $obj ); - echo "\n"; - var_export( $obj, FALSE); - echo "\n"; - var_dump( var_export( $obj, TRUE) ); - echo "\n"; + echo "\n-- Iteration: $key --\n"; + var_export( $obj ); + echo "\n"; + var_export( $obj, FALSE); + echo "\n"; + var_dump( var_export( $obj, TRUE) ); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/var_export_basic7.phpt b/ext/standard/tests/general_functions/var_export_basic7.phpt index 928721b926..f9a68f0f13 100644 --- a/ext/standard/tests/general_functions/var_export_basic7.phpt +++ b/ext/standard/tests/general_functions/var_export_basic7.phpt @@ -24,13 +24,13 @@ $valid_nulls = array( /* Loop to check for above null values with var_export() */ echo "\n*** Output for null values ***\n"; foreach($valid_nulls as $key => $null_value) { - echo "\n-- Iteration: $key --\n"; - var_export( $null_value ); - echo "\n"; - var_export( $null_value, FALSE); - echo "\n"; - var_dump( var_export( $null_value, true) ); - echo "\n"; + echo "\n-- Iteration: $key --\n"; + var_export( $null_value ); + echo "\n"; + var_export( $null_value, FALSE); + echo "\n"; + var_dump( var_export( $null_value, true) ); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/var_export_basic9.phpt b/ext/standard/tests/general_functions/var_export_basic9.phpt index fd78c18c8e..26815bec1b 100644 --- a/ext/standard/tests/general_functions/var_export_basic9.phpt +++ b/ext/standard/tests/general_functions/var_export_basic9.phpt @@ -2,9 +2,9 @@ Bug #55082: var_export() doesn't escape properties properly --FILE-- <?php - $x = new stdClass(); - $x->{'\'\\'} = 7; - echo var_export($x); + $x = new stdClass(); + $x->{'\'\\'} = 7; + echo var_export($x); --EXPECT-- (object) array( '\'\\' => 7, diff --git a/ext/standard/tests/hrtime/hrtime.phpt b/ext/standard/tests/hrtime/hrtime.phpt index bac127bf44..9cd31435b8 100644 --- a/ext/standard/tests/hrtime/hrtime.phpt +++ b/ext/standard/tests/hrtime/hrtime.phpt @@ -16,9 +16,9 @@ $d1 = $h1 - $h0; $d = abs($d0 - $d1)/$d1; if ($d > 0.05) { - print "FAIL, $d"; + print "FAIL, $d"; } else { - print "OK, $d"; + print "OK, $d"; } ?> diff --git a/ext/standard/tests/http/bug38802.phpt b/ext/standard/tests/http/bug38802.phpt index 53a607655d..77fa16b5e4 100644 --- a/ext/standard/tests/http/bug38802.phpt +++ b/ext/standard/tests/http/bug38802.phpt @@ -10,31 +10,31 @@ require 'server.inc'; function do_test($context_options) { - $context = stream_context_create(array('http' => $context_options)); + $context = stream_context_create(array('http' => $context_options)); - $responses = array( - "data://text/plain,HTTP/1.0 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar2\r\n\r\n1", - "data://text/plain,HTTP/1.0 301 Moved Permanently\r\nLocation: http://127.0.0.1:12342/foo/bar3\r\n\r\n", - "data://text/plain,HTTP/1.0 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar4\r\n\r\n3", - "data://text/plain,HTTP/1.0 200 OK\r\n\r\ndone.", - ); + $responses = array( + "data://text/plain,HTTP/1.0 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar2\r\n\r\n1", + "data://text/plain,HTTP/1.0 301 Moved Permanently\r\nLocation: http://127.0.0.1:12342/foo/bar3\r\n\r\n", + "data://text/plain,HTTP/1.0 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar4\r\n\r\n3", + "data://text/plain,HTTP/1.0 200 OK\r\n\r\ndone.", + ); - $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); + $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); - $fd = fopen('http://127.0.0.1:12342/foo/bar', 'rb', false, $context); - var_dump($fd); + $fd = fopen('http://127.0.0.1:12342/foo/bar', 'rb', false, $context); + var_dump($fd); - if ($fd) { - $meta_data = stream_get_meta_data($fd); - var_dump($meta_data['wrapper_data']); + if ($fd) { + $meta_data = stream_get_meta_data($fd); + var_dump($meta_data['wrapper_data']); - var_dump(stream_get_contents($fd)); - } + var_dump(stream_get_contents($fd)); + } - fseek($output, 0, SEEK_SET); - var_dump(stream_get_contents($output)); + fseek($output, 0, SEEK_SET); + var_dump(stream_get_contents($output)); - http_server_kill($pid); + http_server_kill($pid); } echo "-- Test: follow all redirections --\n"; diff --git a/ext/standard/tests/http/bug43510.phpt b/ext/standard/tests/http/bug43510.phpt index d973612372..45ba4fb20f 100644 --- a/ext/standard/tests/http/bug43510.phpt +++ b/ext/standard/tests/http/bug43510.phpt @@ -9,17 +9,17 @@ allow_url_fopen=1 require 'server.inc'; $responses = array( - "data://text/plain,HTTP/1.0 200 OK\r\n\r\n", - "data://text/plain,HTTP/1.0 200 OK\r\n\r\n", + "data://text/plain,HTTP/1.0 200 OK\r\n\r\n", + "data://text/plain,HTTP/1.0 200 OK\r\n\r\n", ); $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); foreach(array('r', 'rb') as $mode) { - $fd = fopen('http://127.0.0.1:12342/', $mode, false); - $meta = stream_get_meta_data($fd); - var_dump($meta['mode']); - fclose($fd); + $fd = fopen('http://127.0.0.1:12342/', $mode, false); + $meta = stream_get_meta_data($fd); + var_dump($meta['mode']); + fclose($fd); } http_server_kill($pid); diff --git a/ext/standard/tests/http/bug47021.phpt b/ext/standard/tests/http/bug47021.phpt index f3db3e1be2..b3acd1bc3a 100644 --- a/ext/standard/tests/http/bug47021.phpt +++ b/ext/standard/tests/http/bug47021.phpt @@ -13,7 +13,7 @@ function stream_notification_callback($notification_code, $severity, $message, $ switch($notification_code) { case STREAM_NOTIFY_MIME_TYPE_IS: echo "Type='$message'\n"; - break; + break; case STREAM_NOTIFY_FILE_SIZE_IS: echo "Size=$bytes_max\n"; break; diff --git a/ext/standard/tests/http/bug48929.phpt b/ext/standard/tests/http/bug48929.phpt index b31ed292be..9a769d8674 100644 --- a/ext/standard/tests/http/bug48929.phpt +++ b/ext/standard/tests/http/bug48929.phpt @@ -10,24 +10,24 @@ require 'server.inc'; function do_test($context_options) { - $context = stream_context_create(array('http' => $context_options)); + $context = stream_context_create(array('http' => $context_options)); - $responses = array( - "data://text/plain,HTTP/1.0 200 OK\r\n\r\n", - ); + $responses = array( + "data://text/plain,HTTP/1.0 200 OK\r\n\r\n", + ); - $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); + $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); - foreach($responses as $r) { + foreach($responses as $r) { - $fd = fopen('http://127.0.0.1:12342/', 'rb', false, $context); + $fd = fopen('http://127.0.0.1:12342/', 'rb', false, $context); - fseek($output, 0, SEEK_SET); - var_dump(stream_get_contents($output)); - fseek($output, 0, SEEK_SET); - } + fseek($output, 0, SEEK_SET); + var_dump(stream_get_contents($output)); + fseek($output, 0, SEEK_SET); + } - http_server_kill($pid); + http_server_kill($pid); } echo "-- Test: requests with 'header' as array --\n"; diff --git a/ext/standard/tests/http/bug53198.phpt b/ext/standard/tests/http/bug53198.phpt index 2585c3df6e..add07c3f47 100644 --- a/ext/standard/tests/http/bug53198.phpt +++ b/ext/standard/tests/http/bug53198.phpt @@ -11,22 +11,22 @@ require 'server.inc'; function do_test() { - $responses = array( - "data://text/plain,HTTP/1.0 200 OK\r\n\r\n", - ); + $responses = array( + "data://text/plain,HTTP/1.0 200 OK\r\n\r\n", + ); - $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); + $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); - foreach($responses as $r) { + foreach($responses as $r) { - $fd = fopen('http://127.0.0.1:12342/', 'rb', false); + $fd = fopen('http://127.0.0.1:12342/', 'rb', false); - fseek($output, 0, SEEK_SET); - var_dump(stream_get_contents($output)); - fseek($output, 0, SEEK_SET); - } + fseek($output, 0, SEEK_SET); + var_dump(stream_get_contents($output)); + fseek($output, 0, SEEK_SET); + } - http_server_kill($pid); + http_server_kill($pid); } diff --git a/ext/standard/tests/http/bug60570.phpt b/ext/standard/tests/http/bug60570.phpt index b72011d5e2..3c16d78033 100644 --- a/ext/standard/tests/http/bug60570.phpt +++ b/ext/standard/tests/http/bug60570.phpt @@ -10,30 +10,30 @@ require 'server.inc'; function do_test() { - $responses = array( - "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n", - "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n", - "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n" - ); + $responses = array( + "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n", + "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n", + "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n" + ); - $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); + $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); - $a = $b = count(get_resources()); + $a = $b = count(get_resources()); - $i = 3; - while ($i--) { - $context = stream_context_create(array('http'=>array('timeout'=>1))); - file_get_contents('http://127.0.0.1:12342/', 0, $context); - unset($context); + $i = 3; + while ($i--) { + $context = stream_context_create(array('http'=>array('timeout'=>1))); + file_get_contents('http://127.0.0.1:12342/', 0, $context); + unset($context); - $b = $a; - $a = count(get_resources()); - } + $b = $a; + $a = count(get_resources()); + } - http_server_kill($pid); + http_server_kill($pid); - echo "leak? penultimate iteration: $b, last one: $a\n"; - var_dump($a == $b); + echo "leak? penultimate iteration: $b, last one: $a\n"; + var_dump($a == $b); } do_test(); diff --git a/ext/standard/tests/http/bug61548.phpt b/ext/standard/tests/http/bug61548.phpt index 38b2bbf086..04ea55341b 100644 --- a/ext/standard/tests/http/bug61548.phpt +++ b/ext/standard/tests/http/bug61548.phpt @@ -11,8 +11,8 @@ require 'server.inc'; function do_test($header) { $options = [ 'http' => [ - 'method' => 'POST', - 'header' => $header, + 'method' => 'POST', + 'header' => $header, 'follow_location' => true, ], ]; @@ -20,9 +20,9 @@ function do_test($header) { $ctx = stream_context_create($options); $responses = [ - "data://text/plain,HTTP/1.1 201\r\nLocation: /foo\r\n\r\n", - "data://text/plain,HTTP/1.1 200\r\nConnection: close\r\n\r\n", - ]; + "data://text/plain,HTTP/1.1 201\r\nLocation: /foo\r\n\r\n", + "data://text/plain,HTTP/1.1 200\r\nConnection: close\r\n\r\n", + ]; $pid = http_server('tcp://127.0.0.1:12342', $responses, $output); $fd = fopen('http://127.0.0.1:12342/', 'rb', false, $ctx); diff --git a/ext/standard/tests/http/bug69337.phpt b/ext/standard/tests/http/bug69337.phpt index c9c2a199dd..7136ff474d 100644 --- a/ext/standard/tests/http/bug69337.phpt +++ b/ext/standard/tests/http/bug69337.phpt @@ -10,8 +10,8 @@ require 'server.inc'; function stream_notification_callback($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) { - if($notification_code == STREAM_NOTIFY_REDIRECTED) { - // $http_response_header is now a string, but will be used as an array + if($notification_code == STREAM_NOTIFY_REDIRECTED) { + // $http_response_header is now a string, but will be used as an array // by php_stream_url_wrap_http_ex() later on $GLOBALS['http_response_header'] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\0\0\0\0"; } @@ -21,8 +21,8 @@ $ctx = stream_context_create(); stream_context_set_params($ctx, array("notification" => "stream_notification_callback")); $responses = array( - "data://text/plain,HTTP/1.0 302 Found\r\nLocation: http://127.0.0.1:22345/try-again\r\n\r\n", - "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n", + "data://text/plain,HTTP/1.0 302 Found\r\nLocation: http://127.0.0.1:22345/try-again\r\n\r\n", + "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n", ); $pid = http_server("tcp://127.0.0.1:22345", $responses, $output); diff --git a/ext/standard/tests/http/bug75535.phpt b/ext/standard/tests/http/bug75535.phpt index 57a75a3ee5..236a96820c 100644 --- a/ext/standard/tests/http/bug75535.phpt +++ b/ext/standard/tests/http/bug75535.phpt @@ -9,7 +9,7 @@ allow_url_fopen=1 require 'server.inc'; $responses = array( - "data://text/plain,HTTP/1.0 200 Ok\r\nContent-Length\r\n", + "data://text/plain,HTTP/1.0 200 Ok\r\nContent-Length\r\n", ); $pid = http_server("tcp://127.0.0.1:22351", $responses, $output); diff --git a/ext/standard/tests/http/bug75981.phpt b/ext/standard/tests/http/bug75981.phpt index d415de66b9..52a560cfbc 100644 --- a/ext/standard/tests/http/bug75981.phpt +++ b/ext/standard/tests/http/bug75981.phpt @@ -18,7 +18,7 @@ $options = [ $ctx = stream_context_create($options); $responses = [ - "data://text/plain,000000000100\xA\xA" + "data://text/plain,000000000100\xA\xA" ]; $pid = http_server('tcp://127.0.0.1:12342', $responses); diff --git a/ext/standard/tests/http/http_response_header_01.phpt b/ext/standard/tests/http/http_response_header_01.phpt index 9772c09b02..05037f24b1 100644 --- a/ext/standard/tests/http/http_response_header_01.phpt +++ b/ext/standard/tests/http/http_response_header_01.phpt @@ -9,7 +9,7 @@ allow_url_fopen=1 require 'server.inc'; $responses = array( - "data://text/plain,HTTP/1.0 200 Ok\r\nSome: Header\r\nSome: Header\r\n\r\nBody", + "data://text/plain,HTTP/1.0 200 Ok\r\nSome: Header\r\nSome: Header\r\n\r\nBody", ); $pid = http_server("tcp://127.0.0.1:22346", $responses, $output); diff --git a/ext/standard/tests/http/http_response_header_02.phpt b/ext/standard/tests/http/http_response_header_02.phpt index 0868672b01..873a8621a5 100644 --- a/ext/standard/tests/http/http_response_header_02.phpt +++ b/ext/standard/tests/http/http_response_header_02.phpt @@ -9,7 +9,7 @@ allow_url_fopen=1 require 'server.inc'; $responses = array( - "data://text/plain,HTTP/1.0 302 Found\r\n" + "data://text/plain,HTTP/1.0 302 Found\r\n" . "Some: Header\r\nLocation: http://127.0.0.1:22347/try-again\r\n\r\n", "data://test/plain,HTTP/1.0 200 Ok\r\nSome: Header\r\n\r\nBody", ); diff --git a/ext/standard/tests/http/http_response_header_03.phpt b/ext/standard/tests/http/http_response_header_03.phpt index 1b743259ad..832382de23 100644 --- a/ext/standard/tests/http/http_response_header_03.phpt +++ b/ext/standard/tests/http/http_response_header_03.phpt @@ -9,7 +9,7 @@ allow_url_fopen=1 require 'server.inc'; $responses = array( - "data://text/plain,HTTP/1.0 302 Found\r\n" + "data://text/plain,HTTP/1.0 302 Found\r\n" . "Some: Header\r\nLocation: http://127.0.0.1:22348/try-again\r\n\r\n", "data://test/plain,HTTP/1.0 404 Not Found\r\nSome: Header\r\n\r\nBody", ); diff --git a/ext/standard/tests/http/http_response_header_04.phpt b/ext/standard/tests/http/http_response_header_04.phpt index 0d518327aa..89a4d466fd 100644 --- a/ext/standard/tests/http/http_response_header_04.phpt +++ b/ext/standard/tests/http/http_response_header_04.phpt @@ -9,7 +9,7 @@ allow_url_fopen=1 require 'server.inc'; $responses = array( - "data://text/plain,HTTP/1.0 200 Ok\r\nSome: Header \r\n\r\nBody", + "data://text/plain,HTTP/1.0 200 Ok\r\nSome: Header \r\n\r\nBody", ); $pid = http_server("tcp://127.0.0.1:22349", $responses, $output); diff --git a/ext/standard/tests/http/http_response_header_05.phpt b/ext/standard/tests/http/http_response_header_05.phpt index 97c275413d..372de1163d 100644 --- a/ext/standard/tests/http/http_response_header_05.phpt +++ b/ext/standard/tests/http/http_response_header_05.phpt @@ -9,7 +9,7 @@ allow_url_fopen=1 require 'server.inc'; $responses = array( - "data://text/plain,HTTP/1.0 200 Ok\r\n \r\n\r\nBody", + "data://text/plain,HTTP/1.0 200 Ok\r\n \r\n\r\nBody", ); $pid = http_server("tcp://127.0.0.1:22350", $responses, $output); diff --git a/ext/standard/tests/http/ignore_errors.phpt b/ext/standard/tests/http/ignore_errors.phpt index 176d6dd2ce..38a1cf6985 100644 --- a/ext/standard/tests/http/ignore_errors.phpt +++ b/ext/standard/tests/http/ignore_errors.phpt @@ -10,33 +10,33 @@ require 'server.inc'; function do_test($context_options) { - $context = stream_context_create(array('http' => $context_options)); + $context = stream_context_create(array('http' => $context_options)); - $responses = array( - "data://text/plain,HTTP/1.0 200 Ok\r\nX-Foo: bar\r\n\r\n1", - "data://text/plain,HTTP/1.0 404 Not found\r\nX-bar: baz\r\n\r\n2", - ); + $responses = array( + "data://text/plain,HTTP/1.0 200 Ok\r\nX-Foo: bar\r\n\r\n1", + "data://text/plain,HTTP/1.0 404 Not found\r\nX-bar: baz\r\n\r\n2", + ); - $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); + $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); - foreach($responses as $r) { + foreach($responses as $r) { - $fd = fopen('http://127.0.0.1:12342/foo/bar', 'rb', false, $context); - var_dump($fd); + $fd = fopen('http://127.0.0.1:12342/foo/bar', 'rb', false, $context); + var_dump($fd); - if ($fd) { - $meta_data = stream_get_meta_data($fd); - var_dump($meta_data['wrapper_data']); + if ($fd) { + $meta_data = stream_get_meta_data($fd); + var_dump($meta_data['wrapper_data']); - var_dump(stream_get_contents($fd)); - } + var_dump(stream_get_contents($fd)); + } - fseek($output, 0, SEEK_SET); - var_dump(stream_get_contents($output)); - fseek($output, 0, SEEK_SET); - } + fseek($output, 0, SEEK_SET); + var_dump(stream_get_contents($output)); + fseek($output, 0, SEEK_SET); + } - http_server_kill($pid); + http_server_kill($pid); } echo "-- Test: requests without ignore_errors --\n"; diff --git a/ext/standard/tests/http/server.inc b/ext/standard/tests/http/server.inc index e580674928..81cc131a8a 100644 --- a/ext/standard/tests/http/server.inc +++ b/ext/standard/tests/http/server.inc @@ -2,34 +2,34 @@ function http_server_skipif($socket_string) { - if (!function_exists('pcntl_fork')) die('skip pcntl_fork() not available'); - if (!function_exists('posix_kill')) die('skip posix_kill() not available'); - if (!stream_socket_server($socket_string)) die('skip stream_socket_server() failed'); + if (!function_exists('pcntl_fork')) die('skip pcntl_fork() not available'); + if (!function_exists('posix_kill')) die('skip posix_kill() not available'); + if (!stream_socket_server($socket_string)) die('skip stream_socket_server() failed'); } function http_server_init($socket_string, &$output = null) { - pcntl_alarm(60); - - $server = stream_socket_server($socket_string, $errno, $errstr); - if (!$server) { - return false; - } - - if ($output === null) { - $output = tmpfile(); - if ($output === false) { - return false; - } - } - - $pid = pcntl_fork(); - if ($pid == -1) { - die('could not fork'); - } else if ($pid) { - return $pid; - } - - return $server; + pcntl_alarm(60); + + $server = stream_socket_server($socket_string, $errno, $errstr); + if (!$server) { + return false; + } + + if ($output === null) { + $output = tmpfile(); + if ($output === false) { + return false; + } + } + + $pid = pcntl_fork(); + if ($pid == -1) { + die('could not fork'); + } else if ($pid) { + return $pid; + } + + return $server; } /* Minimal HTTP server with predefined responses. @@ -40,79 +40,79 @@ function http_server_init($socket_string, &$output = null) { */ function http_server($socket_string, array $files, &$output = null) { - if (!is_resource($server = http_server_init($socket_string, $output))) { - return $server; - } + if (!is_resource($server = http_server_init($socket_string, $output))) { + return $server; + } - foreach($files as $file) { + foreach($files as $file) { - $sock = stream_socket_accept($server); - if (!$sock) { - exit(1); - } + $sock = stream_socket_accept($server); + if (!$sock) { + exit(1); + } - // read headers + // read headers - $content_length = 0; + $content_length = 0; - stream_set_blocking($sock, 0); - while (!feof($sock)) { + stream_set_blocking($sock, 0); + while (!feof($sock)) { - list($r, $w, $e) = array(array($sock), null, null); - if (!stream_select($r, $w, $e, 1)) continue; + list($r, $w, $e) = array(array($sock), null, null); + if (!stream_select($r, $w, $e, 1)) continue; - $line = stream_get_line($sock, 8192, "\r\n"); - if ($line === '') { - fwrite($output, "\r\n"); - break; - } else if ($line !== false) { - fwrite($output, "$line\r\n"); + $line = stream_get_line($sock, 8192, "\r\n"); + if ($line === '') { + fwrite($output, "\r\n"); + break; + } else if ($line !== false) { + fwrite($output, "$line\r\n"); - if (preg_match('#^Content-Length\s*:\s*([[:digit:]]+)\s*$#i', $line, $matches)) { - $content_length = (int) $matches[1]; - } - } - } - stream_set_blocking($sock, 1); + if (preg_match('#^Content-Length\s*:\s*([[:digit:]]+)\s*$#i', $line, $matches)) { + $content_length = (int) $matches[1]; + } + } + } + stream_set_blocking($sock, 1); - // read content + // read content - if ($content_length > 0) { - stream_copy_to_stream($sock, $output, $content_length); - } + if ($content_length > 0) { + stream_copy_to_stream($sock, $output, $content_length); + } - // send response + // send response - $fd = fopen($file, 'rb'); - stream_copy_to_stream($fd, $sock); + $fd = fopen($file, 'rb'); + stream_copy_to_stream($fd, $sock); - fclose($sock); - } + fclose($sock); + } - exit(0); + exit(0); } function http_server_sleep($socket_string, $micro_seconds = 500000) { - if (!is_resource($server = http_server_init($socket_string, $output))) { - return $server; - } + if (!is_resource($server = http_server_init($socket_string, $output))) { + return $server; + } - $sock = stream_socket_accept($server); - if (!$sock) { - exit(1); - } + $sock = stream_socket_accept($server); + if (!$sock) { + exit(1); + } - usleep($micro_seconds); + usleep($micro_seconds); - fclose($sock); + fclose($sock); - exit(0); + exit(0); } function http_server_kill($pid) { - posix_kill($pid, SIGTERM); - pcntl_waitpid($pid, $status); + posix_kill($pid, SIGTERM); + pcntl_waitpid($pid, $status); } ?> diff --git a/ext/standard/tests/image/getimagesize.phpt b/ext/standard/tests/image/getimagesize.phpt index db8213b7dc..ed32ac7c0e 100644 --- a/ext/standard/tests/image/getimagesize.phpt +++ b/ext/standard/tests/image/getimagesize.phpt @@ -6,21 +6,21 @@ GetImageSize() ?> --FILE-- <?php - // Note: SWC requires zlib - $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__); - $result = array(); - $files = array(); - while (($file = readdir($dir)) !== FALSE) { - if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") { - $files[] = $file; - } - } - closedir($dir); - sort($files); - foreach($files as $file) { - $result[$file] = getimagesize(__DIR__."/$file"); - } - var_dump($result); + // Note: SWC requires zlib + $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__); + $result = array(); + $files = array(); + while (($file = readdir($dir)) !== FALSE) { + if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") { + $files[] = $file; + } + } + closedir($dir); + sort($files); + foreach($files as $file) { + $result[$file] = getimagesize(__DIR__."/$file"); + } + var_dump($result); ?> --EXPECT-- array(16) { diff --git a/ext/standard/tests/image/getimagesize_246x247.phpt b/ext/standard/tests/image/getimagesize_246x247.phpt index 5908671f1c..0e1290fcf2 100644 --- a/ext/standard/tests/image/getimagesize_246x247.phpt +++ b/ext/standard/tests/image/getimagesize_246x247.phpt @@ -6,21 +6,21 @@ GetImageSize() with 246x247 pixels ?> --FILE-- <?php - // Note: SWC requires zlib - $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__); - $result = array(); - $files = array(); - while (($file = readdir($dir)) !== FALSE) { - if (preg_match('/^246x247\./',$file)) { - $files[] = $file; - } - } - closedir($dir); - sort($files); - foreach($files as $file) { - $result[$file] = getimagesize(__DIR__."/$file"); - } - var_dump($result); + // Note: SWC requires zlib + $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__); + $result = array(); + $files = array(); + while (($file = readdir($dir)) !== FALSE) { + if (preg_match('/^246x247\./',$file)) { + $files[] = $file; + } + } + closedir($dir); + sort($files); + foreach($files as $file) { + $result[$file] = getimagesize(__DIR__."/$file"); + } + var_dump($result); ?> --EXPECT-- array(1) { diff --git a/ext/standard/tests/image/getimagesize_384x385.phpt b/ext/standard/tests/image/getimagesize_384x385.phpt index 9ed1104220..cef9d73b3f 100644 --- a/ext/standard/tests/image/getimagesize_384x385.phpt +++ b/ext/standard/tests/image/getimagesize_384x385.phpt @@ -6,21 +6,21 @@ GetImageSize() with 384x385 pixels ?> --FILE-- <?php - // Note: SWC requires zlib - $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__); - $result = array(); - $files = array(); - while (($file = readdir($dir)) !== FALSE) { - if (preg_match('/^384x385\./',$file)) { - $files[] = $file; - } - } - closedir($dir); - sort($files); - foreach($files as $file) { - $result[$file] = getimagesize(__DIR__."/$file"); - } - var_dump($result); + // Note: SWC requires zlib + $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__); + $result = array(); + $files = array(); + while (($file = readdir($dir)) !== FALSE) { + if (preg_match('/^384x385\./',$file)) { + $files[] = $file; + } + } + closedir($dir); + sort($files); + foreach($files as $file) { + $result[$file] = getimagesize(__DIR__."/$file"); + } + var_dump($result); ?> --EXPECT-- array(1) { diff --git a/ext/standard/tests/image/getimagesize_jpgapp.phpt b/ext/standard/tests/image/getimagesize_jpgapp.phpt index 74fd4e57d7..b4c6413a08 100644 --- a/ext/standard/tests/image/getimagesize_jpgapp.phpt +++ b/ext/standard/tests/image/getimagesize_jpgapp.phpt @@ -19,7 +19,7 @@ $arr['APP1'] = "and this too"; getimagesize( __DIR__."/testAPP.jpg", $arr); foreach ($arr as $key => $value) { - echo "$key - length: ". strlen($value) ."; md5: " . md5($value) . "\n" ; + echo "$key - length: ". strlen($value) ."; md5: " . md5($value) . "\n" ; } ?> diff --git a/ext/standard/tests/image/getimagesize_swc.phpt b/ext/standard/tests/image/getimagesize_swc.phpt index 5e79a5d0a2..bba67d4f09 100644 --- a/ext/standard/tests/image/getimagesize_swc.phpt +++ b/ext/standard/tests/image/getimagesize_swc.phpt @@ -8,7 +8,7 @@ GetImageSize() for compressed swf files ?> --FILE-- <?php - var_dump(getimagesize(__DIR__ . "/test13pix.swf")); + var_dump(getimagesize(__DIR__ . "/test13pix.swf")); ?> --EXPECT-- array(5) { diff --git a/ext/standard/tests/image/getimagesize_variation2.phpt b/ext/standard/tests/image/getimagesize_variation2.phpt index 6419881abc..7799303c62 100644 --- a/ext/standard/tests/image/getimagesize_variation2.phpt +++ b/ext/standard/tests/image/getimagesize_variation2.phpt @@ -9,7 +9,7 @@ Test getimagesize() function : usage variations - unexpected type for arg 2 */ function test_error_handler($err_no, $err_msg, $filename, $linenum) { - echo "Error: $err_no - $err_msg\n"; + echo "Error: $err_no - $err_msg\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/image/getimagesize_variation3.phpt b/ext/standard/tests/image/getimagesize_variation3.phpt index f65869af9e..b50e822d70 100644 --- a/ext/standard/tests/image/getimagesize_variation3.phpt +++ b/ext/standard/tests/image/getimagesize_variation3.phpt @@ -10,10 +10,10 @@ Test getimagesize() function : variation - Passing non image files $file_types_array = array ( //File containing text string - "File with text data" => "test.txt", + "File with text data" => "test.txt", - //File containing forcibly corrupted bmp image - "File with corrupted BMP data" => "200x100_unknown.unknown", + //File containing forcibly corrupted bmp image + "File with corrupted BMP data" => "200x100_unknown.unknown", //File which doesn't exist "Non-existent file" => "nofile.ext", diff --git a/ext/standard/tests/image/image_type_to_mime_type.phpt b/ext/standard/tests/image/image_type_to_mime_type.phpt index b1781aac2b..aff49ae58f 100644 --- a/ext/standard/tests/image/image_type_to_mime_type.phpt +++ b/ext/standard/tests/image/image_type_to_mime_type.phpt @@ -6,22 +6,22 @@ image_type_to_mime_type() ?> --FILE-- <?php - // Note: SWC requires zlib - $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__); - $result = array(); - $files = array(); - while (($file = readdir($dir)) !== FALSE) { - if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") { - $files[] = $file; - } - } - closedir($dir); - sort($files); - foreach($files as $file) { - $result[$file] = getimagesize(__DIR__."/$file"); - $result[$file] = image_type_to_mime_type($result[$file][2]); - } - var_dump($result); + // Note: SWC requires zlib + $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__); + $result = array(); + $files = array(); + while (($file = readdir($dir)) !== FALSE) { + if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") { + $files[] = $file; + } + } + closedir($dir); + sort($files); + foreach($files as $file) { + $result[$file] = getimagesize(__DIR__."/$file"); + $result[$file] = image_type_to_mime_type($result[$file][2]); + } + var_dump($result); ?> --EXPECT-- array(16) { diff --git a/ext/standard/tests/image/image_type_to_mime_type_basic.phpt b/ext/standard/tests/image/image_type_to_mime_type_basic.phpt index 40b5a07725..684056459e 100644 --- a/ext/standard/tests/image/image_type_to_mime_type_basic.phpt +++ b/ext/standard/tests/image/image_type_to_mime_type_basic.phpt @@ -12,28 +12,28 @@ image_type_to_mime_type() echo "Starting image_type_to_mime_type() test\n\n"; $image_types = array ( - IMAGETYPE_GIF, - IMAGETYPE_JPEG, - IMAGETYPE_PNG, - IMAGETYPE_SWF, - IMAGETYPE_PSD, - IMAGETYPE_BMP, - IMAGETYPE_TIFF_II, - IMAGETYPE_TIFF_MM, - IMAGETYPE_JPC, - IMAGETYPE_JP2, - IMAGETYPE_JPX, - IMAGETYPE_JB2, - IMAGETYPE_IFF, - IMAGETYPE_WBMP, - IMAGETYPE_JPEG2000, - IMAGETYPE_XBM, - IMAGETYPE_WEBP + IMAGETYPE_GIF, + IMAGETYPE_JPEG, + IMAGETYPE_PNG, + IMAGETYPE_SWF, + IMAGETYPE_PSD, + IMAGETYPE_BMP, + IMAGETYPE_TIFF_II, + IMAGETYPE_TIFF_MM, + IMAGETYPE_JPC, + IMAGETYPE_JP2, + IMAGETYPE_JPX, + IMAGETYPE_JB2, + IMAGETYPE_IFF, + IMAGETYPE_WBMP, + IMAGETYPE_JPEG2000, + IMAGETYPE_XBM, + IMAGETYPE_WEBP ); - foreach($image_types as $image_type) { - var_dump(image_type_to_mime_type($image_type)); - } + foreach($image_types as $image_type) { + var_dump(image_type_to_mime_type($image_type)); + } echo "\nDone image_type_to_mime_type() test\n"; ?> diff --git a/ext/standard/tests/mail/mail_basic7.phpt b/ext/standard/tests/mail/mail_basic7.phpt index c01fb5fe25..9c9c61d835 100644 --- a/ext/standard/tests/mail/mail_basic7.phpt +++ b/ext/standard/tests/mail/mail_basic7.phpt @@ -22,13 +22,13 @@ $to = 'user@example.com'; $subject = 'Test Subject'; $message = 'A Message'; $additional_headers = array( - 'KHeaders' => 'aaaa', - 'bcc'=>'foo@bar', - 'foo'=> - array( - "bar\r\n hoge", - "bar\r\n\t fuga", - ), + 'KHeaders' => 'aaaa', + 'bcc'=>'foo@bar', + 'foo'=> + array( + "bar\r\n hoge", + "bar\r\n\t fuga", + ), ); $outFile = "mailBasic7.out"; @unlink($outFile); @@ -48,14 +48,14 @@ $subject = 'Test Subject'; $message = 'A Message'; // Headers should not have array values $additional_headers = array( - 'orig-date' => array('foo1'), - 'from' => array('foo2'), - 'sender' => array('foo3'), - 'reply-to' => array('foo4'), - 'to' => array('foo5'), - 'bcc' => array('foo6'), - 'message-id' => array('foo7'), - 'in-reply-to'=> array('foo8'), + 'orig-date' => array('foo1'), + 'from' => array('foo2'), + 'sender' => array('foo3'), + 'reply-to' => array('foo4'), + 'to' => array('foo5'), + 'bcc' => array('foo6'), + 'message-id' => array('foo7'), + 'in-reply-to'=> array('foo8'), ); $outFile = "mailBasic7.out"; @unlink($outFile); @@ -74,13 +74,13 @@ $to = 'user@example.com'; $subject = 'Test Subject'; $message = 'A Message'; $additional_headers = array( - 'foo1' => array('foo1'=>'bar1'), - 'foo2' => array('foo2', array('foo3')), - 'foo3' => array(123), - 'foo4' => array(123.456), - 'foo5' => array(FALSE), - 'foo6' => array(NULL), - 'foo7' => array(new StdClass), + 'foo1' => array('foo1'=>'bar1'), + 'foo2' => array('foo2', array('foo3')), + 'foo3' => array(123), + 'foo4' => array(123.456), + 'foo5' => array(FALSE), + 'foo6' => array(NULL), + 'foo7' => array(new StdClass), ); $outFile = "mailBasic7.out"; @unlink($outFile); @@ -99,16 +99,16 @@ $to = 'user@example.com'; $subject = 'Test Subject'; $message = 'A Message'; $additional_headers = array( - '*:foo1' => array('bar1'), - 'foo2:::' => array('bar1'), - 'foo3()' => array('bar1'), - 'foo4@' => array('bar1'), - 'foo5|' => array('bar1'), - "\0foo6" => array('bar1'), - "foo7\0" => array('bar1'), - "foo8" => array(), - "foo9" => '%&$#!', - "foo10" => "abc\0\tdef", + '*:foo1' => array('bar1'), + 'foo2:::' => array('bar1'), + 'foo3()' => array('bar1'), + 'foo4@' => array('bar1'), + 'foo5|' => array('bar1'), + "\0foo6" => array('bar1'), + "foo7\0" => array('bar1'), + "foo8" => array(), + "foo9" => '%&$#!', + "foo10" => "abc\0\tdef", ); $outFile = "mailBasic7.out"; @unlink($outFile); diff --git a/ext/standard/tests/mail/mail_basic_alt1-win32.phpt b/ext/standard/tests/mail/mail_basic_alt1-win32.phpt index c48634e99c..5952a14f59 100644 --- a/ext/standard/tests/mail/mail_basic_alt1-win32.phpt +++ b/ext/standard/tests/mail/mail_basic_alt1-win32.phpt @@ -38,48 +38,48 @@ HERE; $res = mail($to, $subject, $message); if ($res !== true) { - exit("TEST FAILED : Unable to send test email\n"); + exit("TEST FAILED : Unable to send test email\n"); } else { - echo "Msg sent OK\n"; + echo "Msg sent OK\n"; } // Search for email message on the mail server using imap. $imap_stream = imap_open($default_mailbox, $username, $password); if ($imap_stream === false) { - echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; - return false; + echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; + return false; } $found = false; $repeat_count = 20; // we will repeat a max of 20 times while (!$found && $repeat_count > 0) { - // sleep for a while to allow msg to be delivered - sleep(1); + // sleep for a while to allow msg to be delivered + sleep(1); - $current_msg_count = imap_check($imap_stream)->Nmsgs; + $current_msg_count = imap_check($imap_stream)->Nmsgs; - // Iterate over recent msgs to find the one we sent above - for ($i = 1; $i <= $current_msg_count; $i++) { - // get hdr details - $hdr = imap_headerinfo($imap_stream, $i); + // Iterate over recent msgs to find the one we sent above + for ($i = 1; $i <= $current_msg_count; $i++) { + // get hdr details + $hdr = imap_headerinfo($imap_stream, $i); - if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { - echo "Id of msg just sent is $i\n"; - echo ".. delete it\n"; - imap_delete($imap_stream, $i); - $found = true; - break; - } - } + if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { + echo "Id of msg just sent is $i\n"; + echo ".. delete it\n"; + imap_delete($imap_stream, $i); + $found = true; + break; + } + } - $repeat_count -= 1; + $repeat_count -= 1; } if (!$found) { - echo "TEST FAILED: email not delivered\n"; + echo "TEST FAILED: email not delivered\n"; } else { - echo "TEST PASSED: Msgs sent and deleted OK\n"; + echo "TEST PASSED: Msgs sent and deleted OK\n"; } imap_close($imap_stream, CL_EXPUNGE); diff --git a/ext/standard/tests/mail/mail_basic_alt2-win32.phpt b/ext/standard/tests/mail/mail_basic_alt2-win32.phpt index 3aff59a614..8c7a28983c 100644 --- a/ext/standard/tests/mail/mail_basic_alt2-win32.phpt +++ b/ext/standard/tests/mail/mail_basic_alt2-win32.phpt @@ -35,48 +35,48 @@ $extra_headers = "from: user@example.com"; $res = mail($to, $subject, $message, $extra_headers); if ($res !== true) { - exit("TEST FAILED : Unable to send test email\n"); + exit("TEST FAILED : Unable to send test email\n"); } else { - echo "Msg sent OK\n"; + echo "Msg sent OK\n"; } // Search for email message on the mail server using imap. $imap_stream = imap_open($default_mailbox, $username, $password); if ($imap_stream === false) { - echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; - return false; + echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; + return false; } $found = false; $repeat_count = 20; // we will repeat a max of 20 times while (!$found && $repeat_count > 0) { - // sleep for a while to allow msg to be delivered - sleep(1); + // sleep for a while to allow msg to be delivered + sleep(1); - $current_msg_count = imap_check($imap_stream)->Nmsgs; + $current_msg_count = imap_check($imap_stream)->Nmsgs; - // Iterate over recent msgs to find the one we sent above - for ($i = 1; $i <= $current_msg_count; $i++) { - // get hdr details - $hdr = imap_headerinfo($imap_stream, $i); + // Iterate over recent msgs to find the one we sent above + for ($i = 1; $i <= $current_msg_count; $i++) { + // get hdr details + $hdr = imap_headerinfo($imap_stream, $i); - if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { - echo "Id of msg just sent is $i\n"; - echo ".. delete it\n"; - imap_delete($imap_stream, $i); - $found = true; - break; - } - } + if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { + echo "Id of msg just sent is $i\n"; + echo ".. delete it\n"; + imap_delete($imap_stream, $i); + $found = true; + break; + } + } - $repeat_count -= 1; + $repeat_count -= 1; } if (!$found) { - echo "TEST FAILED: email not delivered\n"; + echo "TEST FAILED: email not delivered\n"; } else { - echo "TEST PASSED: Msgs sent and deleted OK\n"; + echo "TEST PASSED: Msgs sent and deleted OK\n"; } imap_close($imap_stream, CL_EXPUNGE); diff --git a/ext/standard/tests/mail/mail_basic_alt3-win32.phpt b/ext/standard/tests/mail/mail_basic_alt3-win32.phpt index 52d48937ed..15fb701e28 100644 --- a/ext/standard/tests/mail/mail_basic_alt3-win32.phpt +++ b/ext/standard/tests/mail/mail_basic_alt3-win32.phpt @@ -35,48 +35,48 @@ $extra_headers = "FRom: user@example.com"; $res = mail($to, $subject, $message, $extra_headers); if ($res !== true) { - exit("TEST FAILED : Unable to send test email\n"); + exit("TEST FAILED : Unable to send test email\n"); } else { - echo "Msg sent OK\n"; + echo "Msg sent OK\n"; } // Search for email message on the mail server using imap. $imap_stream = imap_open($default_mailbox, $username, $password); if ($imap_stream === false) { - echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; - return false; + echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; + return false; } $found = false; $repeat_count = 20; // we will repeat a max of 20 times while (!$found && $repeat_count > 0) { - // sleep for a while to allow msg to be delivered - sleep(1); + // sleep for a while to allow msg to be delivered + sleep(1); - $current_msg_count = imap_check($imap_stream)->Nmsgs; + $current_msg_count = imap_check($imap_stream)->Nmsgs; - // Iterate over recent msgs to find the one we sent above - for ($i = 1; $i <= $current_msg_count; $i++) { - // get hdr details - $hdr = imap_headerinfo($imap_stream, $i); + // Iterate over recent msgs to find the one we sent above + for ($i = 1; $i <= $current_msg_count; $i++) { + // get hdr details + $hdr = imap_headerinfo($imap_stream, $i); - if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { - echo "Id of msg just sent is $i\n"; - echo ".. delete it\n"; - imap_delete($imap_stream, $i); - $found = true; - break; - } - } + if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { + echo "Id of msg just sent is $i\n"; + echo ".. delete it\n"; + imap_delete($imap_stream, $i); + $found = true; + break; + } + } - $repeat_count -= 1; + $repeat_count -= 1; } if (!$found) { - echo "TEST FAILED: email not delivered\n"; + echo "TEST FAILED: email not delivered\n"; } else { - echo "TEST PASSED: Msgs sent and deleted OK\n"; + echo "TEST PASSED: Msgs sent and deleted OK\n"; } imap_close($imap_stream, CL_EXPUNGE); diff --git a/ext/standard/tests/mail/mail_basic_alt4-win32.phpt b/ext/standard/tests/mail/mail_basic_alt4-win32.phpt index a677312442..96c6fb11f5 100644 --- a/ext/standard/tests/mail/mail_basic_alt4-win32.phpt +++ b/ext/standard/tests/mail/mail_basic_alt4-win32.phpt @@ -36,48 +36,48 @@ $extra_parameters = "addons"; // should be ignored $res = mail($to, $subject, $message, $extra_headers, $extra_parameters); if ($res !== true) { - exit("TEST FAILED : Unable to send test email\n"); + exit("TEST FAILED : Unable to send test email\n"); } else { - echo "Msg sent OK\n"; + echo "Msg sent OK\n"; } // Search for email message on the mail server using imap. $imap_stream = imap_open($default_mailbox, $username, $password); if ($imap_stream === false) { - echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; - return false; + echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; + return false; } $found = false; $repeat_count = 20; // we will repeat a max of 20 times while (!$found && $repeat_count > 0) { - // sleep for a while to allow msg to be delivered - sleep(1); + // sleep for a while to allow msg to be delivered + sleep(1); - $current_msg_count = imap_check($imap_stream)->Nmsgs; + $current_msg_count = imap_check($imap_stream)->Nmsgs; - // Iterate over recent msgs to find the one we sent above - for ($i = 1; $i <= $current_msg_count; $i++) { - // get hdr details - $hdr = imap_headerinfo($imap_stream, $i); + // Iterate over recent msgs to find the one we sent above + for ($i = 1; $i <= $current_msg_count; $i++) { + // get hdr details + $hdr = imap_headerinfo($imap_stream, $i); - if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { - echo "Id of msg just sent is $i\n"; - echo ".. delete it\n"; - imap_delete($imap_stream, $i); - $found = true; - break; - } - } + if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { + echo "Id of msg just sent is $i\n"; + echo ".. delete it\n"; + imap_delete($imap_stream, $i); + $found = true; + break; + } + } - $repeat_count -= 1; + $repeat_count -= 1; } if (!$found) { - echo "TEST FAILED: email not delivered\n"; + echo "TEST FAILED: email not delivered\n"; } else { - echo "TEST PASSED: Msgs sent and deleted OK\n"; + echo "TEST PASSED: Msgs sent and deleted OK\n"; } imap_close($imap_stream, CL_EXPUNGE); diff --git a/ext/standard/tests/mail/mail_include.inc b/ext/standard/tests/mail/mail_include.inc index ba7ee121b5..c69d4a7182 100644 --- a/ext/standard/tests/mail/mail_include.inc +++ b/ext/standard/tests/mail/mail_include.inc @@ -18,32 +18,32 @@ $mailbox_prefix = "phpttest"; // name used for test mailbox * @return IMAP stream to new mailbox on success; FALSE on failure */ function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = null, $msg_type = "simple"){ - global $server, $default_mailbox, $username, $password; + global $server, $default_mailbox, $username, $password; - // open a stream to default mailbox - $imap_stream = imap_open($default_mailbox, $username, $password); + // open a stream to default mailbox + $imap_stream = imap_open($default_mailbox, $username, $password); - if ($imap_stream === false) { - echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; - return false; - } + if ($imap_stream === false) { + echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; + return false; + } - echo "Create a temporary mailbox and add " . $message_count . " msgs\n"; - $new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type); - if ($new_mailbox === false) { - echo "Can't create a temporary mailbox: " . imap_last_error(). "\n"; - return false; - } + echo "Create a temporary mailbox and add " . $message_count . " msgs\n"; + $new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type); + if ($new_mailbox === false) { + echo "Can't create a temporary mailbox: " . imap_last_error(). "\n"; + return false; + } - echo ".. mailbox '$new_mailbox' created\n"; + echo ".. mailbox '$new_mailbox' created\n"; - // reopen stream to new mailbox - if (imap_reopen($imap_stream, $new_mailbox) === false) { - echo "can't re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n"; - return false; - } + // reopen stream to new mailbox + if (imap_reopen($imap_stream, $new_mailbox) === false) { + echo "can't re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n"; + return false; + } - return $imap_stream; + return $imap_stream; } /** @@ -53,30 +53,30 @@ function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = nul * @param string $mailbox */ function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type= "simple"){ - global $default_mailbox, $mailbox_prefix; - $mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix; - - $mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*'); - - // check mailbox does not already exist - if ($mailboxes) { - foreach($mailboxes as $value) { - if ($value->name == $mailbox) { - exit ("TEST FAILED : Mailbox '$mailbox' already exists\n"); - } - } - } - - if (imap_createmailbox($imap_stream, $mailbox) === false) { - return false; - } - - // Add number of test msgs requested - if ($message_count > 0) { - populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type); - } - - return $mailbox; + global $default_mailbox, $mailbox_prefix; + $mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix; + + $mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*'); + + // check mailbox does not already exist + if ($mailboxes) { + foreach($mailboxes as $value) { + if ($value->name == $mailbox) { + exit ("TEST FAILED : Mailbox '$mailbox' already exists\n"); + } + } + } + + if (imap_createmailbox($imap_stream, $mailbox) === false) { + return false; + } + + // Add number of test msgs requested + if ($message_count > 0) { + populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type); + } + + return $mailbox; } /** @@ -87,48 +87,48 @@ function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type */ function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "simple"){ - global $users, $domain; - - for($i = 1; $i <= $message_count; $i++) { - if ($msg_type == "simple") { - $msg = "From: foo@anywhere.com\r\n" - . "To: $users[0]@$domain\r\n" - . "Subject: test$i\r\n" - . "\r\n" - . "$i: this is a test message, please ignore\r\n"; - } else { - $envelope["from"]= "foo@anywhere.com"; - $envelope["to"] = "$users[0]@$domain"; - $envelope["subject"] = "Test msg $i"; - - $part1["type"] = TYPEMULTIPART; - $part1["subtype"] = "mixed"; - - $part2["type"] = TYPETEXT; - $part2["subtype"] = "plain"; - $part2["description"] = "imap_mail_compose() function"; - $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx"; - - $part3["type"] = TYPETEXT; - $part3["subtype"] = "plain"; - $part3["description"] = "Example"; - $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"; - - $part4["type"] = TYPETEXT; - $part4["subtype"] = "plain"; - $part4["description"] = "Return Values"; - $part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz"; - - $body[1] = $part1; - $body[2] = $part2; - $body[3] = $part3; - $body[4] = $part4; - - $msg = imap_mail_compose($envelope, $body); - } - - imap_append($imap_stream, $mailbox, $msg); - } + global $users, $domain; + + for($i = 1; $i <= $message_count; $i++) { + if ($msg_type == "simple") { + $msg = "From: foo@anywhere.com\r\n" + . "To: $users[0]@$domain\r\n" + . "Subject: test$i\r\n" + . "\r\n" + . "$i: this is a test message, please ignore\r\n"; + } else { + $envelope["from"]= "foo@anywhere.com"; + $envelope["to"] = "$users[0]@$domain"; + $envelope["subject"] = "Test msg $i"; + + $part1["type"] = TYPEMULTIPART; + $part1["subtype"] = "mixed"; + + $part2["type"] = TYPETEXT; + $part2["subtype"] = "plain"; + $part2["description"] = "imap_mail_compose() function"; + $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx"; + + $part3["type"] = TYPETEXT; + $part3["subtype"] = "plain"; + $part3["description"] = "Example"; + $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"; + + $part4["type"] = TYPETEXT; + $part4["subtype"] = "plain"; + $part4["description"] = "Return Values"; + $part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz"; + + $body[1] = $part1; + $body[2] = $part2; + $body[3] = $part3; + $body[4] = $part4; + + $msg = imap_mail_compose($envelope, $body); + } + + imap_append($imap_stream, $mailbox, $msg); + } } /** @@ -139,12 +139,12 @@ function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "s */ function get_mailbox_name($mailbox){ - if (preg_match('/\{.*?\}(.*)/', $mailbox, $match) != 1) { - echo "Unrecpognized mailbox name\n"; - return false; - } + if (preg_match('/\{.*?\}(.*)/', $mailbox, $match) != 1) { + echo "Unrecpognized mailbox name\n"; + return false; + } - return $match[1]; + return $match[1]; } ?> diff --git a/ext/standard/tests/mail/mail_log.phpt b/ext/standard/tests/mail/mail_log.phpt index e60aa621b0..4f9e9423f4 100644 --- a/ext/standard/tests/mail/mail_log.phpt +++ b/ext/standard/tests/mail/mail_log.phpt @@ -9,7 +9,7 @@ date_default_timezone_set("UTC"); $logfile = ini_get("mail.log"); if (file_exists($logfile)) { - unlink($logfile); + unlink($logfile); } touch($logfile); clearstatcache(); diff --git a/ext/standard/tests/mail/mail_skipif.inc b/ext/standard/tests/mail/mail_skipif.inc index fedcfbbe4e..8f2468581d 100644 --- a/ext/standard/tests/mail/mail_skipif.inc +++ b/ext/standard/tests/mail/mail_skipif.inc @@ -2,13 +2,13 @@ extension_loaded('imap') or die('skip imap extension not available in this build'); if( substr(PHP_OS, 0, 3) == 'WIN' && extension_loaded('sockets')) { - // be sure mail server is accessible... on PHP 5.3.13 release build, using test-pack PHP-5.3-r1af8b3f, - // the code below didn't skip test even though there was no mail server - // test then failed (no mail server to test against) - $socket = socket_create(AF_INET, SOCK_RAW, 1); - socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 10, 'usec' => 10)); - // imap uses tcp port 143 - socket_connect($socket, "localhost", 143) or die ("skip can't socket to mail server"); + // be sure mail server is accessible... on PHP 5.3.13 release build, using test-pack PHP-5.3-r1af8b3f, + // the code below didn't skip test even though there was no mail server + // test then failed (no mail server to test against) + $socket = socket_create(AF_INET, SOCK_RAW, 1); + socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 10, 'usec' => 10)); + // imap uses tcp port 143 + socket_connect($socket, "localhost", 143) or die ("skip can't socket to mail server"); } // Change these to make tests run successfully @@ -20,7 +20,7 @@ $retries = 0; // don't retry connect on failure $mbox = imap_open($mailbox, $username, $password, $options, $retries); if (!$mbox) { - die("skip could not connect to mailbox $mailbox"); + die("skip could not connect to mailbox $mailbox"); } imap_close($mbox); ?> diff --git a/ext/standard/tests/mail/mail_variation_alt1-win32.phpt b/ext/standard/tests/mail/mail_variation_alt1-win32.phpt index 92a59477d0..155dc9815a 100644 --- a/ext/standard/tests/mail/mail_variation_alt1-win32.phpt +++ b/ext/standard/tests/mail/mail_variation_alt1-win32.phpt @@ -37,48 +37,48 @@ HERE; $res = mail($to, $subject, $message); if ($res !== true) { - exit("TEST COMPLETED : Unable to send test email\n"); + exit("TEST COMPLETED : Unable to send test email\n"); } else { - echo "Msg sent OK\n"; + echo "Msg sent OK\n"; } // Search for email message on the mail server using imap. $imap_stream = imap_open($default_mailbox, $username, $password); if ($imap_stream === false) { - echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; - return false; + echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; + return false; } $found = false; $repeat_count = 20; // we will repeat a max of 20 times while (!$found && $repeat_count > 0) { - // sleep for a while to allow msg to be delivered - sleep(1); + // sleep for a while to allow msg to be delivered + sleep(1); - $current_msg_count = imap_check($imap_stream)->Nmsgs; + $current_msg_count = imap_check($imap_stream)->Nmsgs; - // Iterate over recent msgs to find the one we sent above - for ($i = 1; $i <= $current_msg_count; $i++) { - // get hdr details - $hdr = imap_headerinfo($imap_stream, $i); + // Iterate over recent msgs to find the one we sent above + for ($i = 1; $i <= $current_msg_count; $i++) { + // get hdr details + $hdr = imap_headerinfo($imap_stream, $i); - if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { - echo "Id of msg just sent is $i\n"; - echo ".. delete it\n"; - imap_delete($imap_stream, $i); - $found = true; - break; - } - } + if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { + echo "Id of msg just sent is $i\n"; + echo ".. delete it\n"; + imap_delete($imap_stream, $i); + $found = true; + break; + } + } - $repeat_count -= 1; + $repeat_count -= 1; } if (!$found) { - echo "TEST FAILED: email not delivered\n"; + echo "TEST FAILED: email not delivered\n"; } else { - echo "TEST PASSED: Msgs sent and deleted OK\n"; + echo "TEST PASSED: Msgs sent and deleted OK\n"; } imap_close($imap_stream, CL_EXPUNGE); diff --git a/ext/standard/tests/mail/mail_variation_alt2-win32.phpt b/ext/standard/tests/mail/mail_variation_alt2-win32.phpt index 06c16eb5f8..36d971329f 100644 --- a/ext/standard/tests/mail/mail_variation_alt2-win32.phpt +++ b/ext/standard/tests/mail/mail_variation_alt2-win32.phpt @@ -37,48 +37,48 @@ HERE; $res = mail($to, $subject, $message); if ($res !== true) { - exit("TEST COMPLETED : Unable to send test email\n"); + exit("TEST COMPLETED : Unable to send test email\n"); } else { - echo "Msg sent OK\n"; + echo "Msg sent OK\n"; } // Search for email message on the mail server using imap. $imap_stream = imap_open($default_mailbox, $username, $password); if ($imap_stream === false) { - echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; - return false; + echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; + return false; } $found = false; $repeat_count = 20; // we will repeat a max of 20 times while (!$found && $repeat_count > 0) { - // sleep for a while to allow msg to be delivered - sleep(1); + // sleep for a while to allow msg to be delivered + sleep(1); - $current_msg_count = imap_check($imap_stream)->Nmsgs; + $current_msg_count = imap_check($imap_stream)->Nmsgs; - // Iterate over recent msgs to find the one we sent above - for ($i = 1; $i <= $current_msg_count; $i++) { - // get hdr details - $hdr = imap_headerinfo($imap_stream, $i); + // Iterate over recent msgs to find the one we sent above + for ($i = 1; $i <= $current_msg_count; $i++) { + // get hdr details + $hdr = imap_headerinfo($imap_stream, $i); - if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { - echo "Id of msg just sent is $i\n"; - echo ".. delete it\n"; - imap_delete($imap_stream, $i); - $found = true; - break; - } - } + if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { + echo "Id of msg just sent is $i\n"; + echo ".. delete it\n"; + imap_delete($imap_stream, $i); + $found = true; + break; + } + } - $repeat_count -= 1; + $repeat_count -= 1; } if (!$found) { - echo "TEST FAILED: email not delivered\n"; + echo "TEST FAILED: email not delivered\n"; } else { - echo "TEST PASSED: Msgs sent and deleted OK\n"; + echo "TEST PASSED: Msgs sent and deleted OK\n"; } imap_close($imap_stream, CL_EXPUNGE); diff --git a/ext/standard/tests/mail/mail_variation_alt3-win32.phpt b/ext/standard/tests/mail/mail_variation_alt3-win32.phpt index 44eda4555b..96d5d796bb 100644 --- a/ext/standard/tests/mail/mail_variation_alt3-win32.phpt +++ b/ext/standard/tests/mail/mail_variation_alt3-win32.phpt @@ -36,48 +36,48 @@ HERE; $res = mail($to, $subject, $message); if ($res !== true) { - exit("TEST COMPLETED : Unable to send test email\n"); + exit("TEST COMPLETED : Unable to send test email\n"); } else { - echo "Msg sent OK\n"; + echo "Msg sent OK\n"; } // Search for email message on the mail server using imap. $imap_stream = imap_open($default_mailbox, $username, $password); if ($imap_stream === false) { - echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; - return false; + echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; + return false; } $found = false; $repeat_count = 20; // we will repeat a max of 20 times while (!$found && $repeat_count > 0) { - // sleep for a while to allow msg to be delivered - sleep(1); + // sleep for a while to allow msg to be delivered + sleep(1); - $current_msg_count = imap_check($imap_stream)->Nmsgs; + $current_msg_count = imap_check($imap_stream)->Nmsgs; - // Iterate over recent msgs to find the one we sent above - for ($i = 1; $i <= $current_msg_count; $i++) { - // get hdr details - $hdr = imap_headerinfo($imap_stream, $i); + // Iterate over recent msgs to find the one we sent above + for ($i = 1; $i <= $current_msg_count; $i++) { + // get hdr details + $hdr = imap_headerinfo($imap_stream, $i); - if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { - echo "Id of msg just sent is $i\n"; - echo ".. delete it\n"; - imap_delete($imap_stream, $i); - $found = true; - break; - } - } + if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { + echo "Id of msg just sent is $i\n"; + echo ".. delete it\n"; + imap_delete($imap_stream, $i); + $found = true; + break; + } + } - $repeat_count -= 1; + $repeat_count -= 1; } if (!$found) { - echo "TEST FAILED: email not delivered\n"; + echo "TEST FAILED: email not delivered\n"; } else { - echo "TEST PASSED: Msgs sent and deleted OK\n"; + echo "TEST PASSED: Msgs sent and deleted OK\n"; } imap_close($imap_stream, CL_EXPUNGE); diff --git a/ext/standard/tests/math/abs.phpt b/ext/standard/tests/math/abs.phpt index af8732811d..f1ff71b6f2 100644 --- a/ext/standard/tests/math/abs.phpt +++ b/ext/standard/tests/math/abs.phpt @@ -6,7 +6,7 @@ Simple math tests define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF); define('LONG_MIN', -LONG_MAX - 1); printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ), - is_int(LONG_MIN-1),is_int(LONG_MAX+1)); + is_int(LONG_MIN-1),is_int(LONG_MAX+1)); $tests = <<<TESTS 1 === abs(-1) diff --git a/ext/standard/tests/math/abs_basic.phpt b/ext/standard/tests/math/abs_basic.phpt index 1866097c3e..b7da2a49bd 100644 --- a/ext/standard/tests/math/abs_basic.phpt +++ b/ext/standard/tests/math/abs_basic.phpt @@ -12,23 +12,23 @@ precision = 14 echo "*** Testing abs() : basic functionality ***\n"; $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "-23", - "23.45", - "2.345e1", - "-2.345e1", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "-23", + "23.45", + "2.345e1", + "-2.345e1", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = abs($values[$i]); - var_dump($res); + $res = abs($values[$i]); + var_dump($res); } ?> --EXPECT-- diff --git a/ext/standard/tests/math/abs_variation.phpt b/ext/standard/tests/math/abs_variation.phpt index f27a73559a..854cb71181 100644 --- a/ext/standard/tests/math/abs_variation.phpt +++ b/ext/standard/tests/math/abs_variation.phpt @@ -72,13 +72,13 @@ $inputs = array( // loop through each element of $inputs to check the behavior of abs() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(abs($input)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump(abs($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); diff --git a/ext/standard/tests/math/acos_basic.phpt b/ext/standard/tests/math/acos_basic.phpt index 6f73d40f40..4f7962ce5e 100644 --- a/ext/standard/tests/math/acos_basic.phpt +++ b/ext/standard/tests/math/acos_basic.phpt @@ -19,20 +19,20 @@ echo "acos .5 = "; $acosv1 = 360.0 * acos(0.5) / (2.0 * M_PI ); var_dump($acosv1); if (allowed_rounding_error($acosv1 ,60 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "acos 0.86602540378444 = "; $acosv2 = 360.0 * acos(0.86602540378444) / (2.0 * M_PI ); var_dump($acosv2); if (allowed_rounding_error($acosv2 ,30 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } @@ -40,10 +40,10 @@ echo "acos 1.0 = "; $acosv3 = 360.0 * acos(1.0) / (2.0 * M_PI); var_dump($acosv3); if (allowed_rounding_error($acosv3 ,0 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } @@ -51,10 +51,10 @@ echo "acos 0.0 = "; $acosv4 = 360.0 * acos(0.0) / (2.0 * M_PI ); var_dump($acosv4); if (allowed_rounding_error($acosv3 ,0 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } ?> diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt index 4fe8437fd5..20065d62eb 100644 --- a/ext/standard/tests/math/acos_variation.phpt +++ b/ext/standard/tests/math/acos_variation.phpt @@ -13,23 +13,23 @@ precision=10 //Test acos with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = acos($values[$i]); - var_dump($res); + $res = acos($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/acosh_basic.phpt b/ext/standard/tests/math/acosh_basic.phpt index a9ba199df5..aed150cba8 100644 --- a/ext/standard/tests/math/acosh_basic.phpt +++ b/ext/standard/tests/math/acosh_basic.phpt @@ -16,20 +16,20 @@ echo "acosh 1.1276259652064= "; var_dump(acosh(1.1276259652064)); if (allowed_rounding_error(acosh(1.1276259652064), 0.5)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "acosh 10.067661995778= "; var_dump(acosh(10.067661995778)); if (allowed_rounding_error(acosh(10.067661995778), 3.0)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } diff --git a/ext/standard/tests/math/acosh_variation.phpt b/ext/standard/tests/math/acosh_variation.phpt index 12200e035c..27e1a9ac24 100644 --- a/ext/standard/tests/math/acosh_variation.phpt +++ b/ext/standard/tests/math/acosh_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test acosh with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = acosh($values[$i]); - var_dump($res); + $res = acosh($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/allowed_rounding_error.inc b/ext/standard/tests/math/allowed_rounding_error.inc index 9ba754b582..c4a1cce4bf 100644 --- a/ext/standard/tests/math/allowed_rounding_error.inc +++ b/ext/standard/tests/math/allowed_rounding_error.inc @@ -1,18 +1,18 @@ <?php function allowed_rounding_error ($number, $expected) { - //different machines may give slightly different floating point numbers - //This assumes that the results will be the same to + or - 1.0E-10. + //different machines may give slightly different floating point numbers + //This assumes that the results will be the same to + or - 1.0E-10. - $small_number = 1.0e-10; - $min = $expected - $small_number; - $max = $expected + $small_number; + $small_number = 1.0e-10; + $min = $expected - $small_number; + $max = $expected + $small_number; - if ($number < $max && $number > $min ) { - return true; - } - else { - return false; - } + if ($number < $max && $number > $min ) { + return true; + } + else { + return false; + } } ?> diff --git a/ext/standard/tests/math/asin_basic.phpt b/ext/standard/tests/math/asin_basic.phpt index ec43d50692..419a9ef343 100644 --- a/ext/standard/tests/math/asin_basic.phpt +++ b/ext/standard/tests/math/asin_basic.phpt @@ -19,30 +19,30 @@ echo "asin .5 = "; $asinv1 = 360.0 * asin(0.5) / (2.0 * M_PI ); var_dump($asinv1); if (allowed_rounding_error($asinv1 ,30 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "asin 0.86602540378444 = "; $asinv2 = 360.0 * asin(0.86602540378444) / (2.0 * M_PI ); var_dump($asinv2); if (allowed_rounding_error($asinv2 ,60 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "asin 1.0 = "; $asinv3 = 360.0 * asin(1.0) / (2.0 * M_PI ); var_dump($asinv3); if (allowed_rounding_error($asinv3 ,90 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } @@ -50,10 +50,10 @@ echo "asin 0.0 = "; $asinv4 = 360.0 * asin(0.0) / (2.0 * M_PI ); var_dump($asinv4); if (allowed_rounding_error($asinv4 ,0 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } ?> diff --git a/ext/standard/tests/math/asin_variation.phpt b/ext/standard/tests/math/asin_variation.phpt index c5d170e8db..7c0e5a37d6 100644 --- a/ext/standard/tests/math/asin_variation.phpt +++ b/ext/standard/tests/math/asin_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test asin with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = asin($values[$i]); - var_dump($res); + $res = asin($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/asinh_basic.phpt b/ext/standard/tests/math/asinh_basic.phpt index 8fd189c66a..16380da128 100644 --- a/ext/standard/tests/math/asinh_basic.phpt +++ b/ext/standard/tests/math/asinh_basic.phpt @@ -16,20 +16,20 @@ echo "asinh 0.52109530549375= "; var_dump(asinh(0.52109530549375)); if (allowed_rounding_error(asinh(0.52109530549375), 0.5)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "asinh 10.01787492741= "; var_dump(asinh(10.01787492741)); if (allowed_rounding_error(asinh(10.01787492741), 3.0)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } ?> diff --git a/ext/standard/tests/math/asinh_variation.phpt b/ext/standard/tests/math/asinh_variation.phpt index 2470f7d401..f4304148cb 100644 --- a/ext/standard/tests/math/asinh_variation.phpt +++ b/ext/standard/tests/math/asinh_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test asinh with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = asinh($values[$i]); - var_dump($res); + $res = asinh($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/atan2_basic.phpt b/ext/standard/tests/math/atan2_basic.phpt index f6dae62900..fe015ac2aa 100644 --- a/ext/standard/tests/math/atan2_basic.phpt +++ b/ext/standard/tests/math/atan2_basic.phpt @@ -5,37 +5,37 @@ precision=14 --FILE-- <?php $valuesy = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + null, + true, + false); $valuesx = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + null, + true, + false); for ($i = 0; $i < count($valuesy); $i++) { - for ($j = 0; $j < count($valuesx); $j++) { - $res = atan2($valuesy[$i], $valuesx[$j]); - echo "Y:$valuesy[$i] X:$valuesx[$j] "; - var_dump($res); - } + for ($j = 0; $j < count($valuesx); $j++) { + $res = atan2($valuesy[$i], $valuesx[$j]); + echo "Y:$valuesy[$i] X:$valuesx[$j] "; + var_dump($res); + } } ?> --EXPECT-- diff --git a/ext/standard/tests/math/atan2_basiclong_64bit.phpt b/ext/standard/tests/math/atan2_basiclong_64bit.phpt index 235be3eca8..e29501232d 100644 --- a/ext/standard/tests/math/atan2_basiclong_64bit.phpt +++ b/ext/standard/tests/math/atan2_basiclong_64bit.phpt @@ -23,7 +23,7 @@ $otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal, $otherVal ---\n"; + echo "--- testing: $longVal, $otherVal ---\n"; var_dump(atan2($longVal, $otherVal)); } } diff --git a/ext/standard/tests/math/atan_basic.phpt b/ext/standard/tests/math/atan_basic.phpt index 24f1f4b924..9f41e58234 100644 --- a/ext/standard/tests/math/atan_basic.phpt +++ b/ext/standard/tests/math/atan_basic.phpt @@ -16,20 +16,20 @@ echo "atan 1.7320508075689 = "; $atan1 = 360 * atan(1.7320508075689) / (2.0 * M_PI); var_dump($atan1); if (allowed_rounding_error($atan1 ,60 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "atan 0.57735026918963 = "; $atan2 = 360 * atan(0.57735026918963) / (2.0 * M_PI); var_dump($atan2); if (allowed_rounding_error($atan2 ,30 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } ?> diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt index 625b6d0b83..409f0b1719 100644 --- a/ext/standard/tests/math/atan_variation.phpt +++ b/ext/standard/tests/math/atan_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test atan with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = atan($values[$i]); - var_dump($res); + $res = atan($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/atanh_basic.phpt b/ext/standard/tests/math/atanh_basic.phpt index 8b994bc5fd..0a7040360b 100644 --- a/ext/standard/tests/math/atanh_basic.phpt +++ b/ext/standard/tests/math/atanh_basic.phpt @@ -16,20 +16,20 @@ echo "atanh 0.46211715726001 = "; var_dump(atanh(0.46211715726001)); if (allowed_rounding_error(atanh(0.46211715726001), 0.5)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "atanh 0.99505475368673 = "; var_dump(atanh(0.99505475368673)); if (allowed_rounding_error(atanh(0.99505475368673), 3.0)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } diff --git a/ext/standard/tests/math/atanh_variation.phpt b/ext/standard/tests/math/atanh_variation.phpt index f14406bb0d..610aaab3fb 100644 --- a/ext/standard/tests/math/atanh_variation.phpt +++ b/ext/standard/tests/math/atanh_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test atanh with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = atanh($values[$i]); - var_dump($res); + $res = atanh($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/base_convert_basic.phpt b/ext/standard/tests/math/base_convert_basic.phpt index 14767faeea..bdef339f3b 100644 --- a/ext/standard/tests/math/base_convert_basic.phpt +++ b/ext/standard/tests/math/base_convert_basic.phpt @@ -6,26 +6,26 @@ $frombase = array(2,8,10,16,36); $tobase = array(2,8,10,16,36); $values = array(10, - 27, - 39, - 03, - 0x5F, - "10", - "27", - "39", - "5F", - "3XYZ" - ); + 27, + 39, + 03, + 0x5F, + "10", + "27", + "39", + "5F", + "3XYZ" + ); for ($f= 0; $f < count($frombase); $f++) { - echo "\n...from base is ", $frombase[$f], "\n"; - for ($t= 0; $t < count($tobase); $t++) { - echo "......to base is ", $tobase[$t], "\n"; - for ($i =0; $i < count($values); $i++){ - $res = base_convert($values[$i],$frombase[$f],$tobase[$t]); - echo ".........value= ", $values[$i], " res = ", $res, "\n"; - } - } + echo "\n...from base is ", $frombase[$f], "\n"; + for ($t= 0; $t < count($tobase); $t++) { + echo "......to base is ", $tobase[$t], "\n"; + for ($i =0; $i < count($values); $i++){ + $res = base_convert($values[$i],$frombase[$f],$tobase[$t]); + echo ".........value= ", $values[$i], " res = ", $res, "\n"; + } + } } ?> --EXPECTF-- diff --git a/ext/standard/tests/math/base_convert_variation1.phpt b/ext/standard/tests/math/base_convert_variation1.phpt index 00eb9e7585..b0dba2b49b 100644 --- a/ext/standard/tests/math/base_convert_variation1.phpt +++ b/ext/standard/tests/math/base_convert_variation1.phpt @@ -70,9 +70,9 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of base_convert() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(base_convert($input, 10, 8)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(base_convert($input, 10, 8)); + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/bindec_basic.phpt b/ext/standard/tests/math/bindec_basic.phpt index 70c29b6fd2..03eec8ee30 100644 --- a/ext/standard/tests/math/bindec_basic.phpt +++ b/ext/standard/tests/math/bindec_basic.phpt @@ -9,28 +9,28 @@ precision=14 --FILE-- <?php $values = array(111000111, - 011100000, - 1111111111111111111111111111111, - 10000000000000000000000000000000, - 100002001, - '111000111', - '011100000', - '1111111111111111111111111111111', - '10000000000000000000000000000000', - '100002001', - 'abcdefg', - 311015, - 31101.3, - 31.1013e5, - 0x111ABC, - 011237, - true, - false, - null); + 011100000, + 1111111111111111111111111111111, + 10000000000000000000000000000000, + 100002001, + '111000111', + '011100000', + '1111111111111111111111111111111', + '10000000000000000000000000000000', + '100002001', + 'abcdefg', + 311015, + 31101.3, + 31.1013e5, + 0x111ABC, + 011237, + true, + false, + null); for ($i = 0; $i < count($values); $i++) { - $res = bindec($values[$i]); - var_dump($res); + $res = bindec($values[$i]); + var_dump($res); } ?> --EXPECTF-- diff --git a/ext/standard/tests/math/bindec_basic_64bit.phpt b/ext/standard/tests/math/bindec_basic_64bit.phpt index 8408944acb..b8f46b6748 100644 --- a/ext/standard/tests/math/bindec_basic_64bit.phpt +++ b/ext/standard/tests/math/bindec_basic_64bit.phpt @@ -9,28 +9,28 @@ precision=14 --FILE-- <?php $values = array(111000111, - 011100000, - 1111111111111111111111111111111, - 10000000000000000000000000000000, - 100002001, - '111000111', - '011100000', - '1111111111111111111111111111111', - '10000000000000000000000000000000', - '100002001', - 'abcdefg', - 311015, - 31101.3, - 31.1013e5, - 0x111ABC, - 011237, - true, - false, - null); + 011100000, + 1111111111111111111111111111111, + 10000000000000000000000000000000, + 100002001, + '111000111', + '011100000', + '1111111111111111111111111111111', + '10000000000000000000000000000000', + '100002001', + 'abcdefg', + 311015, + 31101.3, + 31.1013e5, + 0x111ABC, + 011237, + true, + false, + null); for ($i = 0; $i < count($values); $i++) { - $res = bindec($values[$i]); - var_dump($res); + $res = bindec($values[$i]); + var_dump($res); } ?> --EXPECTF-- diff --git a/ext/standard/tests/math/bindec_variation1.phpt b/ext/standard/tests/math/bindec_variation1.phpt index f215e8ee26..2b166a3edd 100644 --- a/ext/standard/tests/math/bindec_variation1.phpt +++ b/ext/standard/tests/math/bindec_variation1.phpt @@ -72,13 +72,13 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of bindec() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(bindec($input)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump(bindec($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/bindec_variation1_64bit.phpt b/ext/standard/tests/math/bindec_variation1_64bit.phpt index 3b5b3e82e0..6784c13601 100644 --- a/ext/standard/tests/math/bindec_variation1_64bit.phpt +++ b/ext/standard/tests/math/bindec_variation1_64bit.phpt @@ -72,13 +72,13 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of bindec() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(bindec($input)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump(bindec($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/bug24142.phpt b/ext/standard/tests/math/bug24142.phpt index 3696b6e790..947deaebd6 100644 --- a/ext/standard/tests/math/bug24142.phpt +++ b/ext/standard/tests/math/bug24142.phpt @@ -4,8 +4,8 @@ Bug #24142 (round() problems) <?php $v = 0.005; for ($i = 1; $i < 10; $i++) { - echo "round({$v}, 2) -> ".round($v, 2)."\n"; - $v += 0.01; + echo "round({$v}, 2) -> ".round($v, 2)."\n"; + $v += 0.01; } ?> --EXPECT-- diff --git a/ext/standard/tests/math/bug30695.phpt b/ext/standard/tests/math/bug30695.phpt index 938b0e7fc8..a0034892db 100644 --- a/ext/standard/tests/math/bug30695.phpt +++ b/ext/standard/tests/math/bug30695.phpt @@ -2,7 +2,7 @@ Bug #30695 (32 bit issues) --FILE-- <?php - function toUTF8( $char_code ) + function toUTF8( $char_code ) { switch ( $char_code ) { @@ -44,7 +44,7 @@ Bug #30695 (32 bit issues) } - echo "\n", toUTF8(65), "\n", toUTF8(233), "\n", toUTF8(1252), "\n", toUTF8(20095), "\n"; + echo "\n", toUTF8(65), "\n", toUTF8(233), "\n", toUTF8(1252), "\n", toUTF8(20095), "\n"; ?> --EXPECT-- A diff --git a/ext/standard/tests/math/ceil_basic.phpt b/ext/standard/tests/math/ceil_basic.phpt index 61c3dd683d..54b91836d1 100644 --- a/ext/standard/tests/math/ceil_basic.phpt +++ b/ext/standard/tests/math/ceil_basic.phpt @@ -11,30 +11,30 @@ precision=14 echo "*** Testing ceil() : basic functionality ***\n"; $values = array(0, - -0, - 0.5, - -0.5, - 1, - -1, - 1.5, - -1.5, - 2.6, - -2.6, - 037, - 0x5F, - "10.5", - "-10.5", - "3.95E3", - "-3.95E3", - "039", - true, - false, - null, - ); + -0, + 0.5, + -0.5, + 1, + -1, + 1.5, + -1.5, + 2.6, + -2.6, + 037, + 0x5F, + "10.5", + "-10.5", + "3.95E3", + "-3.95E3", + "039", + true, + false, + null, + ); for ($i = 0; $i < count($values); $i++) { - $res = ceil($values[$i]); - var_dump($res); + $res = ceil($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/ceil_variation1.phpt b/ext/standard/tests/math/ceil_variation1.phpt index a6f308d386..815093ea49 100644 --- a/ext/standard/tests/math/ceil_variation1.phpt +++ b/ext/standard/tests/math/ceil_variation1.phpt @@ -66,13 +66,13 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of ceil() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(ceil($input)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump(ceil($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/cos_basic.phpt b/ext/standard/tests/math/cos_basic.phpt index 863d443830..5e471ae07f 100644 --- a/ext/standard/tests/math/cos_basic.phpt +++ b/ext/standard/tests/math/cos_basic.phpt @@ -26,55 +26,55 @@ $threesixty = M_PI * 2.0; echo "cos 30 = "; var_dump(cos($thirty)); if (allowed_rounding_error(cos($thirty),0.86602540378444)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "cos 60 = "; var_dump(cos($sixty)); if (allowed_rounding_error(cos($sixty),0.5)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "cos 90 = "; var_dump(cos($ninety)); if (allowed_rounding_error(cos($ninety),0.0)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "cos 180 = "; var_dump(cos($oneeighty)); if (allowed_rounding_error(cos($oneeighty),-1.0)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "cos 270 = "; var_dump(cos($twoseventy)); if (allowed_rounding_error(cos($twoseventy),0.0)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "cos 360 = "; var_dump(cos($threesixty)); if (allowed_rounding_error(cos($threesixty),1.0)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } ?> --EXPECTF-- diff --git a/ext/standard/tests/math/cos_variation.phpt b/ext/standard/tests/math/cos_variation.phpt index f9d1b26246..da92b6aafe 100644 --- a/ext/standard/tests/math/cos_variation.phpt +++ b/ext/standard/tests/math/cos_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test cos with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = cos($values[$i]); - var_dump($res); + $res = cos($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/cosh_basic.phpt b/ext/standard/tests/math/cosh_basic.phpt index 5b52fb2a63..620bbbebcd 100644 --- a/ext/standard/tests/math/cosh_basic.phpt +++ b/ext/standard/tests/math/cosh_basic.phpt @@ -16,37 +16,37 @@ echo "cosh .5 = "; var_dump(cosh(0.5)); if (allowed_rounding_error(cosh(0.5),1.1276259652064)){ - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "cosh -0.5 = "; var_dump(cosh(-0.5)); if (allowed_rounding_error(cosh(-0.5),1.1276259652064)){ - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "cosh 3 = "; var_dump(cosh(3.0)); if (allowed_rounding_error(cosh(3.0), 10.067661995778)){ - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "cosh -3 = "; var_dump(cosh(-3.0)); if (allowed_rounding_error(cosh(-3.0), 10.067661995778)){ - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } ?> diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt index ec58c0151f..a0b3b60f19 100644 --- a/ext/standard/tests/math/cosh_variation.phpt +++ b/ext/standard/tests/math/cosh_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test cosh with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = cosh($values[$i]); - var_dump($res); + $res = cosh($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/decbin_basic.phpt b/ext/standard/tests/math/decbin_basic.phpt index b067030a48..da681dfbe8 100644 --- a/ext/standard/tests/math/decbin_basic.phpt +++ b/ext/standard/tests/math/decbin_basic.phpt @@ -3,23 +3,23 @@ Test decbin() - basic function test --FILE-- <?php $values = array(10, - 3950.5, - 3.9505e3, - 03, - 0x5F, - "10", - "3950.5", - "3.9505e3", - "039", - "0x5F", - true, - false, - null, - ); + 3950.5, + 3.9505e3, + 03, + 0x5F, + "10", + "3950.5", + "3.9505e3", + "039", + "0x5F", + true, + false, + null, + ); for ($i = 0; $i < count($values); $i++) { - $res = decbin($values[$i]); - var_dump($res); + $res = decbin($values[$i]); + var_dump($res); } ?> --EXPECT-- diff --git a/ext/standard/tests/math/decbin_variation1.phpt b/ext/standard/tests/math/decbin_variation1.phpt index 46b509be3b..581e88b283 100644 --- a/ext/standard/tests/math/decbin_variation1.phpt +++ b/ext/standard/tests/math/decbin_variation1.phpt @@ -84,9 +84,9 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of decbin() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(decbin($input)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(decbin($input)); + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/decbin_variation1_64bit.phpt b/ext/standard/tests/math/decbin_variation1_64bit.phpt index 589c954651..91f79aaecb 100644 --- a/ext/standard/tests/math/decbin_variation1_64bit.phpt +++ b/ext/standard/tests/math/decbin_variation1_64bit.phpt @@ -84,9 +84,9 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of decbin() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(decbin($input)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(decbin($input)); + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/dechex_basic.phpt b/ext/standard/tests/math/dechex_basic.phpt index 9f6328c24a..690e2a9842 100644 --- a/ext/standard/tests/math/dechex_basic.phpt +++ b/ext/standard/tests/math/dechex_basic.phpt @@ -3,23 +3,23 @@ Test dechex() - basic function dechex() --FILE-- <?php $values = array(10, - 3950.5, - 3.9505e3, - 03, - 0x5F, - "10", - "3950.5", - "3.9505e3", - "039", - "0x5F", - true, - false, - null, - ); + 3950.5, + 3.9505e3, + 03, + 0x5F, + "10", + "3950.5", + "3.9505e3", + "039", + "0x5F", + true, + false, + null, + ); for ($i = 0; $i < count($values); $i++) { - $res = dechex($values[$i]); - var_dump($res); + $res = dechex($values[$i]); + var_dump($res); } ?> --EXPECT-- diff --git a/ext/standard/tests/math/dechex_variation1.phpt b/ext/standard/tests/math/dechex_variation1.phpt index e2a3e4ed67..fd1ea6def1 100644 --- a/ext/standard/tests/math/dechex_variation1.phpt +++ b/ext/standard/tests/math/dechex_variation1.phpt @@ -84,9 +84,9 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of dechex() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(dechex($input)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(dechex($input)); + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/dechex_variation1_64bit.phpt b/ext/standard/tests/math/dechex_variation1_64bit.phpt index 6d186fa008..a566001d62 100644 --- a/ext/standard/tests/math/dechex_variation1_64bit.phpt +++ b/ext/standard/tests/math/dechex_variation1_64bit.phpt @@ -84,9 +84,9 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of dechex() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(dechex($input)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(dechex($input)); + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/decoct_basic.phpt b/ext/standard/tests/math/decoct_basic.phpt index 19bda37bff..46418df67d 100644 --- a/ext/standard/tests/math/decoct_basic.phpt +++ b/ext/standard/tests/math/decoct_basic.phpt @@ -3,23 +3,23 @@ Test decoct() - basic function test decoct() --FILE-- <?php $values = array(10, - 3950.5, - 3.9505e3, - 03, - 0x5F, - "10", - "3950.5", - "3.9505e3", - "039", - "0x5F", - true, - false, - null, - ); + 3950.5, + 3.9505e3, + 03, + 0x5F, + "10", + "3950.5", + "3.9505e3", + "039", + "0x5F", + true, + false, + null, + ); for ($i = 0; $i < count($values); $i++) { - $res = decoct($values[$i]); - var_dump($res); + $res = decoct($values[$i]); + var_dump($res); } ?> --EXPECT-- diff --git a/ext/standard/tests/math/decoct_variation1.phpt b/ext/standard/tests/math/decoct_variation1.phpt index ad6c63f0dc..174fddf470 100644 --- a/ext/standard/tests/math/decoct_variation1.phpt +++ b/ext/standard/tests/math/decoct_variation1.phpt @@ -85,9 +85,9 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of decoct() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(decoct($input)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(decoct($input)); + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/decoct_variation1_64bit.phpt b/ext/standard/tests/math/decoct_variation1_64bit.phpt index 0a35475883..2ff2c4c48e 100644 --- a/ext/standard/tests/math/decoct_variation1_64bit.phpt +++ b/ext/standard/tests/math/decoct_variation1_64bit.phpt @@ -85,9 +85,9 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of decoct() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(decoct($input)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(decoct($input)); + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/deg2rad_basic.phpt b/ext/standard/tests/math/deg2rad_basic.phpt index 6db1be4da8..ea1eba6ddf 100644 --- a/ext/standard/tests/math/deg2rad_basic.phpt +++ b/ext/standard/tests/math/deg2rad_basic.phpt @@ -22,38 +22,38 @@ echo "deg2rad $arg_0 = "; $r0 = deg2rad($arg_0); var_dump($r0); if (allowed_rounding_error($r0 ,0 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "deg2rad $arg_1 = "; $r1 = deg2rad($arg_1); var_dump($r1); if (allowed_rounding_error($r1 ,1.5707963267949 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "deg2rad $arg_2 = "; $r2 = deg2rad($arg_2); var_dump($r2); if (allowed_rounding_error($r2 ,3.1415926535898 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "deg2rad $arg_3 = "; $r3 = deg2rad($arg_3); var_dump($r3); if (allowed_rounding_error($r3 ,6.2831853071796 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } ?> --EXPECTF-- diff --git a/ext/standard/tests/math/deg2rad_variation.phpt b/ext/standard/tests/math/deg2rad_variation.phpt index eb3c7eae0e..3e344540a2 100644 --- a/ext/standard/tests/math/deg2rad_variation.phpt +++ b/ext/standard/tests/math/deg2rad_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test deg2rad with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = deg2rad($values[$i]); - var_dump($res); + $res = deg2rad($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/exp_basic.phpt b/ext/standard/tests/math/exp_basic.phpt index ba53e22f28..b73889153f 100644 --- a/ext/standard/tests/math/exp_basic.phpt +++ b/ext/standard/tests/math/exp_basic.phpt @@ -5,24 +5,24 @@ precision=14 --FILE-- <?php $values = array(10, - 10.3, - 3.9505e3, - 037, - 0x5F, - "10", - "3950.5", - "3.9505e3", - "039", - true, - false, - null, - ); + 10.3, + 3.9505e3, + 037, + 0x5F, + "10", + "3950.5", + "3.9505e3", + "039", + true, + false, + null, + ); $iterator = 1; foreach($values as $value) { - echo "\n-- Iteration $iterator --\n"; - var_dump(exp($value)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(exp($value)); + $iterator++; }; ?> diff --git a/ext/standard/tests/math/expm1_basic.phpt b/ext/standard/tests/math/expm1_basic.phpt index 9e926b869d..296838570c 100644 --- a/ext/standard/tests/math/expm1_basic.phpt +++ b/ext/standard/tests/math/expm1_basic.phpt @@ -12,25 +12,25 @@ precision=14 echo "*** Testing expm1() : basic functionality ***\n"; $values = array(10, - 10.3, - 3.9505e3, - 037, - 0x5F, - "10", - "3950.5", - "3.9505e3", - "039", - true, - false, - null, - ); + 10.3, + 3.9505e3, + 037, + 0x5F, + "10", + "3950.5", + "3.9505e3", + "039", + true, + false, + null, + ); // loop through each element of $values to check the behaviour of expm1() $iterator = 1; foreach($values as $value) { - echo "\n-- Iteration $iterator --\n"; - var_dump(expm1($value)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(expm1($value)); + $iterator++; }; ?> --EXPECT-- diff --git a/ext/standard/tests/math/floor_basic.phpt b/ext/standard/tests/math/floor_basic.phpt index c5d2fc46b1..84153af08e 100644 --- a/ext/standard/tests/math/floor_basic.phpt +++ b/ext/standard/tests/math/floor_basic.phpt @@ -11,30 +11,30 @@ precision=14 echo "*** Testing floor() : basic functionality ***\n"; $values = array(0, - -0, - 0.5, - -0.5, - 1, - -1, - 1.5, - -1.5, - 2.6, - -2.6, - 037, - 0x5F, - "10.5", - "-10.5", - "3.95E3", - "-3.95E3", - "039", - true, - false, - null, - ); + -0, + 0.5, + -0.5, + 1, + -1, + 1.5, + -1.5, + 2.6, + -2.6, + 037, + 0x5F, + "10.5", + "-10.5", + "3.95E3", + "-3.95E3", + "039", + true, + false, + null, + ); foreach($values as $value) { - echo "\n-- floor $value --\n"; - var_dump(floor($value)); + echo "\n-- floor $value --\n"; + var_dump(floor($value)); }; ?> diff --git a/ext/standard/tests/math/floor_variation1.phpt b/ext/standard/tests/math/floor_variation1.phpt index 6774816ead..dd0e70b863 100644 --- a/ext/standard/tests/math/floor_variation1.phpt +++ b/ext/standard/tests/math/floor_variation1.phpt @@ -66,13 +66,13 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of floor() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(floor($input)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump(floor($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/fmod_basic.phpt b/ext/standard/tests/math/fmod_basic.phpt index 875ae8dd05..e7b204f540 100644 --- a/ext/standard/tests/math/fmod_basic.phpt +++ b/ext/standard/tests/math/fmod_basic.phpt @@ -5,37 +5,37 @@ precision=14 --FILE-- <?php $values1 = array(234, - -234, - 23.45e1, - -23.45e1, - 0xEA, - 0352, - "234", - "234.5", - "23.45e1", - null, - true, - false); + -234, + 23.45e1, + -23.45e1, + 0xEA, + 0352, + "234", + "234.5", + "23.45e1", + null, + true, + false); $values2 = array(2, - -2, - 2.3e1, - -2.3e1, - 0x2, - 02, - "2", - "2.3", - "2.3e1", - null, - true, - false); + -2, + 2.3e1, + -2.3e1, + 0x2, + 02, + "2", + "2.3", + "2.3e1", + null, + true, + false); for ($i = 0; $i < count($values1); $i++) { - echo "\niteration ", $i, "\n"; + echo "\niteration ", $i, "\n"; - for ($j = 0; $j < count($values2); $j++) { - $res = fmod($values1[$i], $values2[$j]); - var_dump($res); - } + for ($j = 0; $j < count($values2); $j++) { + $res = fmod($values1[$i], $values2[$j]); + var_dump($res); + } } ?> --EXPECT-- diff --git a/ext/standard/tests/math/fmod_basiclong_64bit.phpt b/ext/standard/tests/math/fmod_basiclong_64bit.phpt index e949aab00a..5ef283689e 100644 --- a/ext/standard/tests/math/fmod_basiclong_64bit.phpt +++ b/ext/standard/tests/math/fmod_basiclong_64bit.phpt @@ -23,7 +23,7 @@ $otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal, $otherVal ---\n"; + echo "--- testing: $longVal, $otherVal ---\n"; var_dump(fmod($longVal, $otherVal)); } } diff --git a/ext/standard/tests/math/hexdec_basic.phpt b/ext/standard/tests/math/hexdec_basic.phpt index 0ca2342d81..748c641a1a 100644 --- a/ext/standard/tests/math/hexdec_basic.phpt +++ b/ext/standard/tests/math/hexdec_basic.phpt @@ -7,26 +7,26 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); --FILE-- <?php $values = array(0x123abc, - 0x789DEF, - 0x7FFFFFFF, - 0x80000000, - '0x123abc', - '0x789DEF', - '0x7FFFFFFF', - '0x80000000', - '0x123XYZABC', - 311015, - '311015', - 31101.3, - 31.1013e5, - 011237, - '011237', - true, - false, - null); + 0x789DEF, + 0x7FFFFFFF, + 0x80000000, + '0x123abc', + '0x789DEF', + '0x7FFFFFFF', + '0x80000000', + '0x123XYZABC', + 311015, + '311015', + 31101.3, + 31.1013e5, + 011237, + '011237', + true, + false, + null); for ($i = 0; $i < count($values); $i++) { - $res = hexdec($values[$i]); - var_dump($res); + $res = hexdec($values[$i]); + var_dump($res); } ?> --EXPECTF-- diff --git a/ext/standard/tests/math/hexdec_basic_64bit.phpt b/ext/standard/tests/math/hexdec_basic_64bit.phpt index bb8c3d3f27..c7c59451f5 100644 --- a/ext/standard/tests/math/hexdec_basic_64bit.phpt +++ b/ext/standard/tests/math/hexdec_basic_64bit.phpt @@ -9,27 +9,27 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); echo "*** Testing hexdec() : basic functionality ***\n"; $values = array(0x123abc, - 0x789DEF, - 0x7FFFFFFF, - 0x80000000, - '0x123abc', - '0x789DEF', - '0x7FFFFFFF', - '0x80000000', - '0x123XYZABC', - 311015, - '311015', - 31101.3, - 31.1013e5, - 011237, - '011237', - true, - false, - null); + 0x789DEF, + 0x7FFFFFFF, + 0x80000000, + '0x123abc', + '0x789DEF', + '0x7FFFFFFF', + '0x80000000', + '0x123XYZABC', + 311015, + '311015', + 31101.3, + 31.1013e5, + 011237, + '011237', + true, + false, + null); foreach($values as $value) { - echo "\n-- hexdec $value --\n"; - var_dump(hexdec($value)); + echo "\n-- hexdec $value --\n"; + var_dump(hexdec($value)); }; ?> diff --git a/ext/standard/tests/math/hexdec_variation1.phpt b/ext/standard/tests/math/hexdec_variation1.phpt index d395f8a8f1..c50c550f61 100644 --- a/ext/standard/tests/math/hexdec_variation1.phpt +++ b/ext/standard/tests/math/hexdec_variation1.phpt @@ -76,13 +76,13 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of hexdec() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(hexdec($input)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump(hexdec($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/hexdec_variation1_64bit.phpt b/ext/standard/tests/math/hexdec_variation1_64bit.phpt index 35c17f727a..d3b22d8040 100644 --- a/ext/standard/tests/math/hexdec_variation1_64bit.phpt +++ b/ext/standard/tests/math/hexdec_variation1_64bit.phpt @@ -76,13 +76,13 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of hexdec() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(hexdec($input)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump(hexdec($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/hypot_basic.phpt b/ext/standard/tests/math/hypot_basic.phpt index 796c160810..f9e5787f40 100644 --- a/ext/standard/tests/math/hypot_basic.phpt +++ b/ext/standard/tests/math/hypot_basic.phpt @@ -13,39 +13,39 @@ precision=14 echo "*** Testing hypot() : basic functionality ***\n"; $valuesy = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "23abc", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "23abc", + null, + true, + false); $valuesx = array(33, - -33, - 3.345e1, - -3.345e1, - 0x27, - 037, - "33", - "43.45", - "1.345e1", - "33abc", - null, - true, - false); + -33, + 3.345e1, + -3.345e1, + 0x27, + 037, + "33", + "43.45", + "1.345e1", + "33abc", + null, + true, + false); for ($i = 0; $i < count($valuesy); $i++) { - for ($j = 0; $j < count($valuesx); $j++) { - echo "\nY:$valuesy[$i] X:$valuesx[$j] "; - $res = hypot($valuesy[$i], $valuesx[$j]); - var_dump($res); - } + for ($j = 0; $j < count($valuesx); $j++) { + echo "\nY:$valuesy[$i] X:$valuesx[$j] "; + $res = hypot($valuesy[$i], $valuesx[$j]); + var_dump($res); + } } ?> --EXPECTF-- diff --git a/ext/standard/tests/math/hypot_basiclong_64bit.phpt b/ext/standard/tests/math/hypot_basiclong_64bit.phpt index 9a0b71ffc1..1e1ca60996 100644 --- a/ext/standard/tests/math/hypot_basiclong_64bit.phpt +++ b/ext/standard/tests/math/hypot_basiclong_64bit.phpt @@ -23,7 +23,7 @@ $otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal, $otherVal ---\n"; + echo "--- testing: $longVal, $otherVal ---\n"; var_dump(hypot($longVal, $otherVal)); } } diff --git a/ext/standard/tests/math/is_finite_basic.phpt b/ext/standard/tests/math/is_finite_basic.phpt index 11db785ae4..9ee9d544e3 100644 --- a/ext/standard/tests/math/is_finite_basic.phpt +++ b/ext/standard/tests/math/is_finite_basic.phpt @@ -3,23 +3,23 @@ Test is_finite() - basic function test is_finite() --FILE-- <?php $values = array(234, - -234, - 23.45e1, - -23.45e1, - 0xEA, - 0352, - "234", - "234.5", - "23.45e1", - null, - true, - false, - pow(0, -2), - acos(1.01)); + -234, + 23.45e1, + -23.45e1, + 0xEA, + 0352, + "234", + "234.5", + "23.45e1", + null, + true, + false, + pow(0, -2), + acos(1.01)); ; for ($i = 0; $i < count($values); $i++) { - $res = is_finite($values[$i]); - var_dump($res); + $res = is_finite($values[$i]); + var_dump($res); } ?> --EXPECT-- diff --git a/ext/standard/tests/math/is_infinite_basic.phpt b/ext/standard/tests/math/is_infinite_basic.phpt index 4f90340311..076f202c14 100644 --- a/ext/standard/tests/math/is_infinite_basic.phpt +++ b/ext/standard/tests/math/is_infinite_basic.phpt @@ -3,23 +3,23 @@ Test is_infinite() - basic function test is_infinite() --FILE-- <?php $values = array(234, - -234, - 23.45e1, - -23.45e1, - 0xEA, - 0352, - "234", - "234.5", - "23.45e1", - null, - true, - false, - pow(0, -2), - acos(1.01)); + -234, + 23.45e1, + -23.45e1, + 0xEA, + 0352, + "234", + "234.5", + "23.45e1", + null, + true, + false, + pow(0, -2), + acos(1.01)); ; for ($i = 0; $i < count($values); $i++) { - $res = is_infinite($values[$i]); - var_dump($res); + $res = is_infinite($values[$i]); + var_dump($res); } ?> --EXPECT-- diff --git a/ext/standard/tests/math/is_nan_basic.phpt b/ext/standard/tests/math/is_nan_basic.phpt index 49d2ce4ccf..fabc40b97b 100644 --- a/ext/standard/tests/math/is_nan_basic.phpt +++ b/ext/standard/tests/math/is_nan_basic.phpt @@ -3,24 +3,24 @@ Test is_nan() - basic function test is_nan() --FILE-- <?php $values = array(234, - -234, - 23.45e1, - -23.45e1, - 0xEA, - 0352, - "234", - "234.5", - "23.45e1", - null, - true, - false, - pow(0, -2), - acos(1.01)); + -234, + 23.45e1, + -23.45e1, + 0xEA, + 0352, + "234", + "234.5", + "23.45e1", + null, + true, + false, + pow(0, -2), + acos(1.01)); for ($i = 0; $i < count($values); $i++) { - $res = is_nan($values[$i]); - var_dump($res); + $res = is_nan($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/lcg_value_basic.phpt b/ext/standard/tests/math/lcg_value_basic.phpt index 7660f67c24..95811c6f3c 100644 --- a/ext/standard/tests/math/lcg_value_basic.phpt +++ b/ext/standard/tests/math/lcg_value_basic.phpt @@ -8,17 +8,17 @@ echo "MATHS test script started\n"; echo "\n lcg_value tests...\n"; for ($i = 0; $i < 100; $i++) { - $res = lcg_value(); + $res = lcg_value(); - if (!is_float($res) || $res < 0 || $res > 1) { - break; - } + if (!is_float($res) || $res < 0 || $res > 1) { + break; + } } if ($i != 100) { - echo "FAILED\n"; + echo "FAILED\n"; } else { - echo "PASSED\n"; + echo "PASSED\n"; } echo "MATHS test script completed\n"; diff --git a/ext/standard/tests/math/log10_basic.phpt b/ext/standard/tests/math/log10_basic.phpt index b81284faf2..0997d3db4b 100644 --- a/ext/standard/tests/math/log10_basic.phpt +++ b/ext/standard/tests/math/log10_basic.phpt @@ -20,30 +20,30 @@ echo "log10 $arg_0 = "; $r0 = log10($arg_0); var_dump($r0); if (allowed_rounding_error($r0 ,0.0 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "log10 $arg_1 = "; $r1 = log10($arg_1); var_dump($r1); if (allowed_rounding_error($r1 ,1.0 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "log10 $arg_2 = "; $r2 = log10($arg_2); var_dump($r2); if (allowed_rounding_error($r2 ,2.0 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } ?> --EXPECTF-- diff --git a/ext/standard/tests/math/log10_variation.phpt b/ext/standard/tests/math/log10_variation.phpt index 8dbea47a84..e852d82ea9 100644 --- a/ext/standard/tests/math/log10_variation.phpt +++ b/ext/standard/tests/math/log10_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test log10 with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = log10($values[$i]); - var_dump($res); + $res = log10($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/log1p_basic.phpt b/ext/standard/tests/math/log1p_basic.phpt index 2b8c7f8cc5..115deec1d9 100644 --- a/ext/standard/tests/math/log1p_basic.phpt +++ b/ext/standard/tests/math/log1p_basic.phpt @@ -13,23 +13,23 @@ precision=14 echo "*** Testing log1p() : basic functionality ***\n"; $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + null, + true, + false); echo "\n LOG1p tests\n"; foreach($values as $value) { - echo "\n-- log1p $value --\n"; - var_dump(log1p($value)); + echo "\n-- log1p $value --\n"; + var_dump(log1p($value)); }; diff --git a/ext/standard/tests/math/log_basic.phpt b/ext/standard/tests/math/log_basic.phpt index de97ee264b..8ff1c88ccf 100644 --- a/ext/standard/tests/math/log_basic.phpt +++ b/ext/standard/tests/math/log_basic.phpt @@ -5,28 +5,28 @@ precision=14 --FILE-- <?php $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + null, + true, + false); echo "\n LOG tests...no base\n"; for ($i = 0; $i < count($values); $i++) { - $res = log($values[$i]); - var_dump($res); + $res = log($values[$i]); + var_dump($res); } echo "\n LOG tests...base\n"; for ($i = 0; $i < count($values); $i++) { - $res = log($values[$i], 4); - var_dump($res); + $res = log($values[$i], 4); + var_dump($res); } ?> --EXPECT-- diff --git a/ext/standard/tests/math/mt_rand_basic.phpt b/ext/standard/tests/math/mt_rand_basic.phpt index 3a1e4406eb..24050bbc8a 100644 --- a/ext/standard/tests/math/mt_rand_basic.phpt +++ b/ext/standard/tests/math/mt_rand_basic.phpt @@ -6,77 +6,77 @@ $default_max = mt_getrandmax(); echo "\nmt_rand() tests with default min and max value (i.e 0 thru ", $default_max, ")\n"; for ($i = 0; $i < 100; $i++) { - $res = mt_rand(); + $res = mt_rand(); // By default RAND_MAX is 32768 although no constant is defined for it for user space apps - if (!is_int($res) || $res < 0 || $res > $default_max) { - break; - } + if (!is_int($res) || $res < 0 || $res > $default_max) { + break; + } } if ($i != 100) { - echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n"; + echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n"; } else { - echo "PASSED: range min = 0 max = ", $default_max, "\n"; + echo "PASSED: range min = 0 max = ", $default_max, "\n"; } echo "\nmt_rand() tests with defined min and max value\n"; $min = array(10, - 100, - 10.5, - 10.5e3, - 0x10, - 0400); + 100, + 10.5, + 10.5e3, + 0x10, + 0400); $max = array(100, - 1000, - 19.5, - 10.5e5, - 0x10000, - 0700); + 1000, + 19.5, + 10.5e5, + 0x10000, + 0700); for ($x = 0; $x < count($min); $x++) { - for ($i = 0; $i < 100; $i++) { - $res = mt_rand($min[$x], $max[$x]); + for ($i = 0; $i < 100; $i++) { + $res = mt_rand($min[$x], $max[$x]); - if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) { - echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; - break; - } - } + if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) { + echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; + break; + } + } - if ($i == 100) { - echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; - } + if ($i == 100) { + echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; + } } echo "\nNon-numeric cases\n"; $min = array(true, - false, - null, - "10", - "10.5"); + false, + null, + "10", + "10.5"); // Expected numerical equivalent of above non-numerics $minval = array(1, - 0, - 0, - 10, - 10); + 0, + 0, + 10, + 10); for ($x = 0; $x < count($min); $x++) { - for ($i = 0; $i < 100; $i++) { - $res = mt_rand($min[$x], 100); + for ($i = 0; $i < 100; $i++) { + $res = mt_rand($min[$x], 100); - if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) { - echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; - break; - } - } + if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) { + echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; + break; + } + } - if ($i == 100) { - echo "PASSED range min = ", intval($min[$x]), " max = 100\n"; - } + if ($i == 100) { + echo "PASSED range min = ", intval($min[$x]), " max = 100\n"; + } } ?> --EXPECT-- diff --git a/ext/standard/tests/math/number_format_basic.phpt b/ext/standard/tests/math/number_format_basic.phpt index 5a2570126a..b82ad5c753 100644 --- a/ext/standard/tests/math/number_format_basic.phpt +++ b/ext/standard/tests/math/number_format_basic.phpt @@ -3,40 +3,40 @@ Test number_format() - basic function test number_format() --FILE-- <?php $values = array(1234.5678, - -1234.5678, - 1234.6578e4, - -1234.56789e4, - 0x1234CDEF, - 02777777777, - "123456789", - "123.456789", - "12.3456789e1", - null, - true, - false); + -1234.5678, + 1234.6578e4, + -1234.56789e4, + 0x1234CDEF, + 02777777777, + "123456789", + "123.456789", + "12.3456789e1", + null, + true, + false); echo "\n number_format tests.....default\n"; for ($i = 0; $i < count($values); $i++) { - $res = number_format($values[$i]); - var_dump($res); + $res = number_format($values[$i]); + var_dump($res); } echo "\n number_format tests.....with two dp\n"; for ($i = 0; $i < count($values); $i++) { - $res = number_format($values[$i], 2); - var_dump($res); + $res = number_format($values[$i], 2); + var_dump($res); } echo "\n number_format tests.....English format\n"; for ($i = 0; $i < count($values); $i++) { - $res = number_format($values[$i], 2, '.', ' '); - var_dump($res); + $res = number_format($values[$i], 2, '.', ' '); + var_dump($res); } echo "\n number_format tests.....French format\n"; for ($i = 0; $i < count($values); $i++) { - $res = number_format($values[$i], 2, ',' , ' '); - var_dump($res); + $res = number_format($values[$i], 2, ',' , ' '); + var_dump($res); } ?> --EXPECT-- diff --git a/ext/standard/tests/math/number_format_multichar.phpt b/ext/standard/tests/math/number_format_multichar.phpt index b12c81c1a2..5648257e03 100644 --- a/ext/standard/tests/math/number_format_multichar.phpt +++ b/ext/standard/tests/math/number_format_multichar.phpt @@ -3,34 +3,34 @@ Test number_format() - multiple character separator support --FILE-- <?php $values = array(1234.5678, - -1234.5678, - 1234.6578e4, - -1234.56789e4, - 0x1234CDEF, - 02777777777, - "123456789", - "123.456789", - "12.3456789e1", - null, - true, - false); + -1234.5678, + 1234.6578e4, + -1234.56789e4, + 0x1234CDEF, + 02777777777, + "123456789", + "123.456789", + "12.3456789e1", + null, + true, + false); echo " number_format tests.....multiple character decimal point\n"; for ($i = 0; $i < count($values); $i++) { - $res = number_format($values[$i], 2, '·', ' '); - var_dump($res); + $res = number_format($values[$i], 2, '·', ' '); + var_dump($res); } echo "\n number_format tests.....multiple character thousand separator\n"; for ($i = 0; $i < count($values); $i++) { - $res = number_format($values[$i], 2, '.' , ' '); - var_dump($res); + $res = number_format($values[$i], 2, '.' , ' '); + var_dump($res); } echo "\n number_format tests.....multiple character decimal and thousep\n"; for ($i = 0; $i < count($values); $i++) { - $res = number_format($values[$i], 2, '·' , ' '); - var_dump($res); + $res = number_format($values[$i], 2, '·' , ' '); + var_dump($res); } ?> --EXPECT-- diff --git a/ext/standard/tests/math/octdec_basic.phpt b/ext/standard/tests/math/octdec_basic.phpt index c31af55673..1daf9a4338 100644 --- a/ext/standard/tests/math/octdec_basic.phpt +++ b/ext/standard/tests/math/octdec_basic.phpt @@ -7,26 +7,26 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); --FILE-- <?php $values = array(01234567, - 0567, - 017777777777, - 020000000000, - 0x1234ABC, - 12345, - '01234567', - '0567', - '017777777777', - '020000000000', - '0x1234ABC', - '12345', - 31101.3, - 31.1013e5, - true, - false, - null); + 0567, + 017777777777, + 020000000000, + 0x1234ABC, + 12345, + '01234567', + '0567', + '017777777777', + '020000000000', + '0x1234ABC', + '12345', + 31101.3, + 31.1013e5, + true, + false, + null); for ($i = 0; $i < count($values); $i++) { - $res = octdec($values[$i]); - var_dump($res); + $res = octdec($values[$i]); + var_dump($res); } ?> --EXPECTF-- diff --git a/ext/standard/tests/math/octdec_basic_64bit.phpt b/ext/standard/tests/math/octdec_basic_64bit.phpt index 6401fdff3c..bb8f70085d 100644 --- a/ext/standard/tests/math/octdec_basic_64bit.phpt +++ b/ext/standard/tests/math/octdec_basic_64bit.phpt @@ -10,26 +10,26 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); echo "*** Testing octdec() : basic functionality ***\n"; $values = array(01234567, - 0567, - 017777777777, - 020000000000, - 0x1234ABC, - 12345, - '01234567', - '0567', - '017777777777', - '020000000000', - '0x1234ABC', - '12345', - 31101.3, - 31.1013e5, - true, - false, - null); + 0567, + 017777777777, + 020000000000, + 0x1234ABC, + 12345, + '01234567', + '0567', + '017777777777', + '020000000000', + '0x1234ABC', + '12345', + 31101.3, + 31.1013e5, + true, + false, + null); for ($i = 0; $i < count($values); $i++) { - $res = octdec($values[$i]); - var_dump($res); + $res = octdec($values[$i]); + var_dump($res); } ?> --EXPECTF-- diff --git a/ext/standard/tests/math/octdec_variation1.phpt b/ext/standard/tests/math/octdec_variation1.phpt index b59b3b71eb..48e4faf466 100644 --- a/ext/standard/tests/math/octdec_variation1.phpt +++ b/ext/standard/tests/math/octdec_variation1.phpt @@ -72,13 +72,13 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of octdec() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(octdec($input)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump(octdec($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); ?> diff --git a/ext/standard/tests/math/pow.phpt b/ext/standard/tests/math/pow.phpt index 534ecbd58f..e8ee73135e 100644 --- a/ext/standard/tests/math/pow.phpt +++ b/ext/standard/tests/math/pow.phpt @@ -6,7 +6,7 @@ Various pow() tests define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF); define('LONG_MIN', -LONG_MAX - 1); printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ), - is_int(LONG_MIN-1),is_int(LONG_MAX+1)); + is_int(LONG_MIN-1),is_int(LONG_MAX+1)); $tests = <<<TESTS 0.25 === pow(-2,-2) diff --git a/ext/standard/tests/math/pow_basic.phpt b/ext/standard/tests/math/pow_basic.phpt index e23dac3fb4..bc594b27c6 100644 --- a/ext/standard/tests/math/pow_basic.phpt +++ b/ext/standard/tests/math/pow_basic.phpt @@ -9,18 +9,18 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); --FILE-- <?php $bases = array(23, - -23, - 23.1, - -23.1, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - PHP_INT_MAX, - -PHP_INT_MAX - 1); + -23, + 23.1, + -23.1, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + PHP_INT_MAX, + -PHP_INT_MAX - 1); $exponents = array(0, 1, @@ -34,16 +34,16 @@ $exponents = array(0, 500, -500, 2147483647, - -2147483648); + -2147483648); foreach($bases as $base) { - echo "\n\nBase = $base"; - foreach($exponents as $exponent) { - echo "\n..... Exponent = $exponent Result = "; - $res = pow($base, $exponent); - echo $res; - } - echo "\n\n"; + echo "\n\nBase = $base"; + foreach($exponents as $exponent) { + echo "\n..... Exponent = $exponent Result = "; + $res = pow($base, $exponent); + echo $res; + } + echo "\n\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/math/pow_basic_64bit.phpt b/ext/standard/tests/math/pow_basic_64bit.phpt index 3dc37c4774..95ecd8c487 100644 --- a/ext/standard/tests/math/pow_basic_64bit.phpt +++ b/ext/standard/tests/math/pow_basic_64bit.phpt @@ -9,18 +9,18 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); --FILE-- <?php $bases = array(23, - -23, - 23.1, - -23.1, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - PHP_INT_MAX, - -PHP_INT_MAX - 1); + -23, + 23.1, + -23.1, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + PHP_INT_MAX, + -PHP_INT_MAX - 1); $exponents = array(0, 1, @@ -34,16 +34,16 @@ $exponents = array(0, 500, -500, 2147483647, - -2147483648); + -2147483648); foreach($bases as $base) { - echo "\n\nBase = $base"; - foreach($exponents as $exponent) { - echo "\n..... Exponent = $exponent Result = "; - $res = pow($base, $exponent); - echo $res; - } - echo "\n\n"; + echo "\n\nBase = $base"; + foreach($exponents as $exponent) { + echo "\n..... Exponent = $exponent Result = "; + $res = pow($base, $exponent); + echo $res; + } + echo "\n\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/math/pow_basiclong_64bit.phpt b/ext/standard/tests/math/pow_basiclong_64bit.phpt index ff661c3a9a..d955edfcf3 100644 --- a/ext/standard/tests/math/pow_basiclong_64bit.phpt +++ b/ext/standard/tests/math/pow_basiclong_64bit.phpt @@ -23,7 +23,7 @@ $otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal, $otherVal ---\n"; + echo "--- testing: $longVal, $otherVal ---\n"; var_dump(pow($longVal, $otherVal)); } } diff --git a/ext/standard/tests/math/rad2deg_basic.phpt b/ext/standard/tests/math/rad2deg_basic.phpt index d09f376151..df5f837422 100644 --- a/ext/standard/tests/math/rad2deg_basic.phpt +++ b/ext/standard/tests/math/rad2deg_basic.phpt @@ -21,37 +21,37 @@ echo "rad2deg $arg_0= "; $r0 = rad2deg($arg_0); var_dump($r0); if (allowed_rounding_error($r0 ,0 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "rad2deg $arg_1 = "; $r1 = rad2deg($arg_1); var_dump($r1); if (allowed_rounding_error($r1 ,90.000000011752)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "rad2deg $arg_2 = "; $r2 = rad2deg($arg_2); var_dump($r2); if (allowed_rounding_error($r2 ,180.0000000235 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "rad2deg $arg_3 = "; $r3 = rad2deg($arg_3); var_dump($r3); if (allowed_rounding_error($r3 ,359.99999998971 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } ?> --EXPECTF-- diff --git a/ext/standard/tests/math/rad2deg_variation.phpt b/ext/standard/tests/math/rad2deg_variation.phpt index 6ea7d0c8a4..7144f18b61 100644 --- a/ext/standard/tests/math/rad2deg_variation.phpt +++ b/ext/standard/tests/math/rad2deg_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test rad2deg with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = rad2deg($values[$i]); - var_dump($res); + $res = rad2deg($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/rand_basic.phpt b/ext/standard/tests/math/rand_basic.phpt index fbaab3c9af..87e9d7cd42 100644 --- a/ext/standard/tests/math/rand_basic.phpt +++ b/ext/standard/tests/math/rand_basic.phpt @@ -6,77 +6,77 @@ $default_max = getrandmax(); echo "\nrand() tests with default min and max value (i.e 0 thru ", $default_max, ")\n"; for ($i = 0; $i < 100; $i++) { - $res = rand(); + $res = rand(); // By default RAND_MAX is 32768 although no constant is defined for it for user space apps - if (!is_int($res) || $res < 0 || $res > $default_max) { - break; - } + if (!is_int($res) || $res < 0 || $res > $default_max) { + break; + } } if ($i != 100) { - echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n"; + echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n"; } else { - echo "PASSED: range min = 0 max = ", $default_max, "\n"; + echo "PASSED: range min = 0 max = ", $default_max, "\n"; } echo "\nrand() tests with defined min and max value\n"; $min = array(10, - 100, - 10.5, - 10.5e3, - 0x10, - 0400); + 100, + 10.5, + 10.5e3, + 0x10, + 0400); $max = array(100, - 1000, - 19.5, - 10.5e5, - 0x10000, - 0700); + 1000, + 19.5, + 10.5e5, + 0x10000, + 0700); for ($x = 0; $x < count($min); $x++) { - for ($i = 0; $i < 100; $i++) { - $res = rand($min[$x], $max[$x]); + for ($i = 0; $i < 100; $i++) { + $res = rand($min[$x], $max[$x]); - if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) { - echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; - break; - } - } + if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) { + echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; + break; + } + } - if ($i == 100) { - echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; - } + if ($i == 100) { + echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; + } } echo "\nNon-numeric cases\n"; $min = array(true, - false, - null, - "10", - "10.5"); + false, + null, + "10", + "10.5"); // Eexepcted numerical equivalent of above non-numerics $minval = array(1, - 0, - 0, - 10, - 10); + 0, + 0, + 10, + 10); for ($x = 0; $x < count($min); $x++) { - for ($i = 0; $i < 100; $i++) { - $res = rand($min[$x], 100); + for ($i = 0; $i < 100; $i++) { + $res = rand($min[$x], 100); - if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) { - echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; - break; - } - } + if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) { + echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; + break; + } + } - if ($i == 100) { - echo "PASSED range min = ", intval($min[$x]), " max = 100\n"; - } + if ($i == 100) { + echo "PASSED range min = ", intval($min[$x]), " max = 100\n"; + } } ?> --EXPECTF-- diff --git a/ext/standard/tests/math/round.phpt b/ext/standard/tests/math/round.phpt index 16255c0a30..f78d2757c2 100644 --- a/ext/standard/tests/math/round.phpt +++ b/ext/standard/tests/math/round.phpt @@ -6,7 +6,7 @@ Simple math tests define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF); define('LONG_MIN', -LONG_MAX - 1); printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ), - is_int(LONG_MIN-1),is_int(LONG_MAX+1)); + is_int(LONG_MIN-1),is_int(LONG_MAX+1)); $tests = <<<TESTS -1 ~== ceil(-1.5) diff --git a/ext/standard/tests/math/round_basic.phpt b/ext/standard/tests/math/round_basic.phpt index 912529433e..70d5ae4806 100644 --- a/ext/standard/tests/math/round_basic.phpt +++ b/ext/standard/tests/math/round_basic.phpt @@ -13,35 +13,35 @@ precision=14 echo "*** Testing round() : basic functionality ***\n"; $values = array(123456789, - 123.456789, - -4.5679123, - 1.23E4, - -4.567E3, - 0x234567, - 067777777, - "1.234567", - "2.3456789e8"); + 123.456789, + -4.5679123, + 1.23E4, + -4.567E3, + 0x234567, + 067777777, + "1.234567", + "2.3456789e8"); $precision = array(2, - 8, - 0x3, - 04, - 3.6, - "2", - "04", - "3.6", - "2.1e1", - null, - true, - false); + 8, + 0x3, + 04, + 3.6, + "2", + "04", + "3.6", + "2.1e1", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - echo "round: $values[$i]\n"; - for ($j = 0; $j < count($precision); $j++) { - $res = round($values[$i], $precision[$j]); - echo "...with precision $precision[$j]-> "; - var_dump($res); - } + echo "round: $values[$i]\n"; + for ($j = 0; $j < count($precision); $j++) { + $res = round($values[$i], $precision[$j]); + echo "...with precision $precision[$j]-> "; + var_dump($res); + } } ?> --EXPECT-- diff --git a/ext/standard/tests/math/sin_basic.phpt b/ext/standard/tests/math/sin_basic.phpt index f9be13bec9..7c5b787a7a 100644 --- a/ext/standard/tests/math/sin_basic.phpt +++ b/ext/standard/tests/math/sin_basic.phpt @@ -26,55 +26,55 @@ $threesixty = M_PI * 2.0; echo "sin 30 = "; var_dump(sin($thirty)); if (allowed_rounding_error(sin($thirty),0.5)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "sin 60 = "; var_dump(sin($sixty)); if (allowed_rounding_error(sin($sixty),0.86602540378444)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "sin 90 = "; var_dump(sin($ninety)); if (allowed_rounding_error(sin($ninety),1.0)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "sin 180 = "; var_dump(sin($oneeighty)); if (allowed_rounding_error(sin($oneeighty),0.0)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "sin 270 = "; var_dump(sin($twoseventy)); if (allowed_rounding_error(sin($twoseventy),-1.0)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "sin 360 = "; var_dump(sin($threesixty)); if (allowed_rounding_error(sin($threesixty),0.0)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } ?> --EXPECTF-- diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt index d044a16b40..bad70c710d 100644 --- a/ext/standard/tests/math/sin_variation.phpt +++ b/ext/standard/tests/math/sin_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test sin with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = sin($values[$i]); - var_dump($res); + $res = sin($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/sinh_basic.phpt b/ext/standard/tests/math/sinh_basic.phpt index 8d16e1712e..0cdd8f1179 100644 --- a/ext/standard/tests/math/sinh_basic.phpt +++ b/ext/standard/tests/math/sinh_basic.phpt @@ -15,37 +15,37 @@ require($file_path."/allowed_rounding_error.inc"); echo "sinh .5 = "; var_dump(sinh(0.5)); if (allowed_rounding_error(sinh(0.5),0.52109530549375)){ - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "sinh -0.5 = "; var_dump(sinh(-0.5)); if (allowed_rounding_error(sinh(-0.5), -0.52109530549375)){ - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "sinh 3 = "; var_dump(sinh(3.0)); if (allowed_rounding_error(sinh(3.0), 10.01787492741)){ - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "sinh -3 = "; var_dump(sinh(-3.0)); if (allowed_rounding_error(sinh(-3.0), -10.01787492741)){ - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } ?> diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt index 5e576f447f..5b3a79ca78 100644 --- a/ext/standard/tests/math/sinh_variation.phpt +++ b/ext/standard/tests/math/sinh_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test sinh with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = sinh($values[$i]); - var_dump($res); + $res = sinh($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt index 696596cefa..75c460db7a 100644 --- a/ext/standard/tests/math/sqrt_variation.phpt +++ b/ext/standard/tests/math/sqrt_variation.phpt @@ -14,23 +14,23 @@ precision = 14 echo "*** Testing sqrt() : usage variations ***\n"; $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = sqrt($values[$i]); - var_dump($res); + $res = sqrt($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/tan_basic.phpt b/ext/standard/tests/math/tan_basic.phpt index a4d95d77b0..15e7848c48 100644 --- a/ext/standard/tests/math/tan_basic.phpt +++ b/ext/standard/tests/math/tan_basic.phpt @@ -18,19 +18,19 @@ $thirty = M_PI / 6.0; echo "tan 60 = "; var_dump(tan($sixty)); if (allowed_rounding_error(tan($sixty),1.7320508075689)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "tan 30 = "; var_dump(tan($thirty)); if (allowed_rounding_error(tan($thirty),0.57735026918963)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } ?> diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt index 2c9ede4738..1575e24694 100644 --- a/ext/standard/tests/math/tan_variation.phpt +++ b/ext/standard/tests/math/tan_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test tan with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = tan($values[$i]); - var_dump($res); + $res = tan($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/math/tanh_basic.phpt b/ext/standard/tests/math/tanh_basic.phpt index 472d88b94e..d8288843a1 100644 --- a/ext/standard/tests/math/tanh_basic.phpt +++ b/ext/standard/tests/math/tanh_basic.phpt @@ -15,37 +15,37 @@ require($file_path."/allowed_rounding_error.inc"); echo "tanh .5 = "; var_dump(tanh(0.5)); if (allowed_rounding_error(tanh(0.5), 0.46211715726001)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "tanh -0.5 = "; var_dump(tanh(-0.5)); if (allowed_rounding_error(tanh(-0.5), -0.46211715726001)) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "tanh 3 = "; var_dump(tanh(3.0)); if (allowed_rounding_error(tanh(3.0),0.99505475368673 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } echo "tanh -3 = "; var_dump(tanh(-3.0)); if (allowed_rounding_error(tanh(-3.0),-0.99505475368673 )) { - echo "Pass\n"; + echo "Pass\n"; } else { - echo "Fail\n"; + echo "Fail\n"; } ?> diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt index 907f802b8a..502130c5d4 100644 --- a/ext/standard/tests/math/tanh_variation.phpt +++ b/ext/standard/tests/math/tanh_variation.phpt @@ -13,23 +13,23 @@ precision = 10 //Test tanh with a different input values $values = array(23, - -23, - 2.345e1, - -2.345e1, - 0x17, - 027, - "23", - "23.45", - "2.345e1", - "1000", - "1000ABC", - null, - true, - false); + -23, + 2.345e1, + -2.345e1, + 0x17, + 027, + "23", + "23.45", + "2.345e1", + "1000", + "1000ABC", + null, + true, + false); for ($i = 0; $i < count($values); $i++) { - $res = tanh($values[$i]); - var_dump($res); + $res = tanh($values[$i]); + var_dump($res); } ?> diff --git a/ext/standard/tests/misc/browsernames.inc b/ext/standard/tests/misc/browsernames.inc index cac8f9a782..fe4350e222 100644 --- a/ext/standard/tests/misc/browsernames.inc +++ b/ext/standard/tests/misc/browsernames.inc @@ -4,48 +4,48 @@ * Common browser names. Used with: get_browser() */ return array( - "Opera/7.11 (Windows NT 5.1; U) [en]", - "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 7.02 Bork-edition [en]", - "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 4.0) Opera 7.0 [en]", - "Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.0 [en]", - "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 5.0 [en]", - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Opera 8.60 [en]", - "Opera/9.00 (Windows NT 5.1; U; en)", - "Opera/9.26 (Macintosh; PPC Mac OS X; U; en)", + "Opera/7.11 (Windows NT 5.1; U) [en]", + "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 7.02 Bork-edition [en]", + "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 4.0) Opera 7.0 [en]", + "Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.0 [en]", + "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 5.0 [en]", + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Opera 8.60 [en]", + "Opera/9.00 (Windows NT 5.1; U; en)", + "Opera/9.26 (Macintosh; PPC Mac OS X; U; en)", - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)", - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)", - "Mozilla/4.0 (compatible; MSIE 5.22; Mac_PowerPC)", - "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC; e504460WanadooNL)", - "Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1; .NET CLR 3.0.04506.30)", - "Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1)", - "Mozilla/4.0 (compatible;MSIE 7.0;Windows NT 6.0)", + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)", + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)", + "Mozilla/4.0 (compatible; MSIE 5.22; Mac_PowerPC)", + "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC; e504460WanadooNL)", + "Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1; .NET CLR 3.0.04506.30)", + "Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1)", + "Mozilla/4.0 (compatible;MSIE 7.0;Windows NT 6.0)", - "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/74 (KHTML, like Gecko) Safari/74", - "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/51 (like Gecko) Safari/51", - "Mozilla/5.0 (Windows; U; Windows NT 6.0; en) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3", - "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3", - "Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3", - "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; ru-ru) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18", - "Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8", - "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.12) Gecko/20080206 Camino/1.5.5", + "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/74 (KHTML, like Gecko) Safari/74", + "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/51 (like Gecko) Safari/51", + "Mozilla/5.0 (Windows; U; Windows NT 6.0; en) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3", + "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3", + "Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3", + "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; ru-ru) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18", + "Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8", + "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.12) Gecko/20080206 Camino/1.5.5", - "Mozilla/5.0 (compatible; Konqueror/3.1; Linux; X11; i686)", - "Mozilla/5.0 (compatible; Konqueror/3.1; Linux 2.4.19-32mdkenterprise; X11; i686; ar, en_US)", - "Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)", + "Mozilla/5.0 (compatible; Konqueror/3.1; Linux; X11; i686)", + "Mozilla/5.0 (compatible; Konqueror/3.1; Linux 2.4.19-32mdkenterprise; X11; i686; ar, en_US)", + "Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)", - "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4b) Gecko/20030504 Mozilla", - "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2a) Gecko/20020910", - "Mozilla/5.0 (X11; U; Linux 2.4.3-20mdk i586; en-US; rv:0.9.1) Gecko/20010611", - "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.9) Gecko/20050711", - "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9) Gecko/2008052906", + "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4b) Gecko/20030504 Mozilla", + "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2a) Gecko/20020910", + "Mozilla/5.0 (X11; U; Linux 2.4.3-20mdk i586; en-US; rv:0.9.1) Gecko/20010611", + "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.9) Gecko/20050711", + "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9) Gecko/2008052906", - "Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5", - "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6", - "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4a) Gecko/20030423 Firebird Browser/0.6", - "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8", - "Mozilla/5.0 (Windows 98; U; en; rv:1.8.0) Gecko/20060728 Firefox/1.5.0", - "Mozilla/5.0 (Macintosh; PPC Mac OS X; U; en; rv:1.8.0) Gecko/20060728 Firefox/1.5.0", - "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.8.1.12) Gecko/20080210 Firefox/2.0.0.12", - "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.12) Gecko/20080214 Firefox/2.0.0.12", + "Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5", + "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6", + "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4a) Gecko/20030423 Firebird Browser/0.6", + "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8", + "Mozilla/5.0 (Windows 98; U; en; rv:1.8.0) Gecko/20060728 Firefox/1.5.0", + "Mozilla/5.0 (Macintosh; PPC Mac OS X; U; en; rv:1.8.0) Gecko/20060728 Firefox/1.5.0", + "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.8.1.12) Gecko/20080210 Firefox/2.0.0.12", + "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.12) Gecko/20080214 Firefox/2.0.0.12", ); diff --git a/ext/standard/tests/misc/get_browser_basic.phpt b/ext/standard/tests/misc/get_browser_basic.phpt index 81eb9d52e9..85ac8e3493 100644 --- a/ext/standard/tests/misc/get_browser_basic.phpt +++ b/ext/standard/tests/misc/get_browser_basic.phpt @@ -18,7 +18,7 @@ $browsers = include __DIR__ . DIRECTORY_SEPARATOR . 'browsernames.inc'; echo "*** Testing get_browser() : basic functionality ***\n"; for( $x = 0; $x < 20; $x++) { - var_dump( get_browser( $browsers[$x], true ) ); + var_dump( get_browser( $browsers[$x], true ) ); } ?> diff --git a/ext/standard/tests/misc/get_browser_variation1.phpt b/ext/standard/tests/misc/get_browser_variation1.phpt index 7c32a722c7..58c3a24267 100644 --- a/ext/standard/tests/misc/get_browser_variation1.phpt +++ b/ext/standard/tests/misc/get_browser_variation1.phpt @@ -19,7 +19,7 @@ echo "*** Testing get_browser() : variation functionality: extra browser names * $count = count( $browsers ); for( $x = 20; $x < $count; $x++) { - var_dump( get_browser( $browsers[$x], true ) ); + var_dump( get_browser( $browsers[$x], true ) ); } ?> diff --git a/ext/standard/tests/network/bug20134.phpt b/ext/standard/tests/network/bug20134.phpt index 260878d474..669f5c74ea 100644 --- a/ext/standard/tests/network/bug20134.phpt +++ b/ext/standard/tests/network/bug20134.phpt @@ -5,17 +5,17 @@ Bug #20134 (UDP reads from invalid ports) $fp = fsockopen("udp://localhost", 65534, $errno, $errstr); if (!$fp) { - /* UDP will never cause a connection error, as it is - * a connection-LESS protocol */ + /* UDP will never cause a connection error, as it is + * a connection-LESS protocol */ echo "ERROR: $errno - $errstr<br>\n"; } else { - /* Likewise, writes will always appear to succeed */ + /* Likewise, writes will always appear to succeed */ $x = fwrite($fp,"\n"); - var_dump($x); - /* But reads should always fail */ + var_dump($x); + /* But reads should always fail */ $content = fread($fp, 40); - var_dump($content); + var_dump($content); fclose($fp); } ?> diff --git a/ext/standard/tests/network/bug64330.phpt b/ext/standard/tests/network/bug64330.phpt index 836709ea49..311376503a 100644 --- a/ext/standard/tests/network/bug64330.phpt +++ b/ext/standard/tests/network/bug64330.phpt @@ -11,7 +11,7 @@ echo "Test\n"; $server = stream_socket_server("unix://\x00/MyBindName"); $client = stream_socket_client("unix://\x00/MyBindName"); if ($client) { - echo "ok\n"; + echo "ok\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/network/gethostbyname_basic001.phpt b/ext/standard/tests/network/gethostbyname_basic001.phpt index e917b59920..d65289ca41 100644 --- a/ext/standard/tests/network/gethostbyname_basic001.phpt +++ b/ext/standard/tests/network/gethostbyname_basic001.phpt @@ -8,7 +8,7 @@ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); ?> --FILE-- <?php - var_dump(is_string(gethostbyname("www.php.net"))); + var_dump(is_string(gethostbyname("www.php.net"))); ?> --EXPECT-- bool(true) diff --git a/ext/standard/tests/network/gethostbyname_error001.phpt b/ext/standard/tests/network/gethostbyname_error001.phpt index f141be8b4e..87f4571fd3 100644 --- a/ext/standard/tests/network/gethostbyname_error001.phpt +++ b/ext/standard/tests/network/gethostbyname_error001.phpt @@ -4,7 +4,7 @@ gethostbyname() function - basic type return error test "Sylvain R." <sracine@phpquebec.org> --FILE-- <?php - var_dump(is_string(gethostbyname("192.168.0.101"))); + var_dump(is_string(gethostbyname("192.168.0.101"))); ?> --EXPECT-- bool(true) diff --git a/ext/standard/tests/network/gethostbyname_error002.phpt b/ext/standard/tests/network/gethostbyname_error002.phpt index 2430a7fcdc..8f586d02ba 100644 --- a/ext/standard/tests/network/gethostbyname_error002.phpt +++ b/ext/standard/tests/network/gethostbyname_error002.phpt @@ -4,7 +4,7 @@ gethostbyname() function - basic type return error test "Sylvain R." <sracine@phpquebec.org> --FILE-- <?php - var_dump(is_string(gethostbyname("1234567890"))); + var_dump(is_string(gethostbyname("1234567890"))); ?> --EXPECT-- bool(true) diff --git a/ext/standard/tests/network/gethostbyname_error003.phpt b/ext/standard/tests/network/gethostbyname_error003.phpt index 3d4bb7a55e..ebc8a971cb 100644 --- a/ext/standard/tests/network/gethostbyname_error003.phpt +++ b/ext/standard/tests/network/gethostbyname_error003.phpt @@ -4,7 +4,7 @@ gethostbyname() function - basic type return error test "Sylvain R." <sracine@phpquebec.org> --FILE-- <?php - var_dump(is_string(gethostbyname("asdfasdf"))); + var_dump(is_string(gethostbyname("asdfasdf"))); ?> --EXPECT-- bool(true) diff --git a/ext/standard/tests/network/gethostbyname_error004.phpt b/ext/standard/tests/network/gethostbyname_error004.phpt index 274301a236..25ded4bc24 100644 --- a/ext/standard/tests/network/gethostbyname_error004.phpt +++ b/ext/standard/tests/network/gethostbyname_error004.phpt @@ -9,8 +9,8 @@ if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet connection"); ?> --FILE-- <?php - $ip = gethostbyname("www.php.net"); - var_dump((bool) ip2long($ip)); + $ip = gethostbyname("www.php.net"); + var_dump((bool) ip2long($ip)); ?> --EXPECT-- bool(true) diff --git a/ext/standard/tests/network/gethostbyname_error006.phpt b/ext/standard/tests/network/gethostbyname_error006.phpt index 46247a113d..156ba0e623 100644 --- a/ext/standard/tests/network/gethostbyname_error006.phpt +++ b/ext/standard/tests/network/gethostbyname_error006.phpt @@ -4,7 +4,7 @@ gethostbyname() function - basic invalid parameter test "Sylvain R." <sracine@phpquebec.org> --FILE-- <?php - var_dump(gethostbyname(".toto.toto.toto")); + var_dump(gethostbyname(".toto.toto.toto")); ?> --EXPECT-- string(15) ".toto.toto.toto" diff --git a/ext/standard/tests/network/getprotobyname_basic.phpt b/ext/standard/tests/network/getprotobyname_basic.phpt index 37cc26aa2b..ee5e396114 100644 --- a/ext/standard/tests/network/getprotobyname_basic.phpt +++ b/ext/standard/tests/network/getprotobyname_basic.phpt @@ -4,7 +4,7 @@ getprotobyname function basic test edgarsandi - <edgar.r.sandi@gmail.com> --FILE-- <?php - var_dump(getprotobyname('tcp')); + var_dump(getprotobyname('tcp')); ?> --EXPECT-- int(6) diff --git a/ext/standard/tests/network/getprotobynumber_basic.phpt b/ext/standard/tests/network/getprotobynumber_basic.phpt index 7850e60ffd..d781ab92b0 100644 --- a/ext/standard/tests/network/getprotobynumber_basic.phpt +++ b/ext/standard/tests/network/getprotobynumber_basic.phpt @@ -4,7 +4,7 @@ getprotobynumber function basic test edgarsandi - <edgar.r.sandi@gmail.com> --FILE-- <?php - var_dump(getprotobynumber(6)); + var_dump(getprotobynumber(6)); ?> --EXPECT-- string(3) "tcp" diff --git a/ext/standard/tests/network/inet.phpt b/ext/standard/tests/network/inet.phpt index 81db0016b5..29b4aa0e6b 100644 --- a/ext/standard/tests/network/inet.phpt +++ b/ext/standard/tests/network/inet.phpt @@ -23,14 +23,14 @@ var_dump(inet_pton(-1)); var_dump(inet_pton("abra")); $array = array( - "127.0.0.1", - "66.163.161.116", - "255.255.255.255", - "0.0.0.0", - ); + "127.0.0.1", + "66.163.161.116", + "255.255.255.255", + "0.0.0.0", + ); foreach ($array as $val) { - var_dump(bin2hex($packed = inet_pton($val))); - var_dump(inet_ntop($packed)); + var_dump(bin2hex($packed = inet_pton($val))); + var_dump(inet_ntop($packed)); } echo "Done\n"; diff --git a/ext/standard/tests/network/inet_ipv6.phpt b/ext/standard/tests/network/inet_ipv6.phpt index 55323688de..f78d4be7cc 100644 --- a/ext/standard/tests/network/inet_ipv6.phpt +++ b/ext/standard/tests/network/inet_ipv6.phpt @@ -15,20 +15,20 @@ if (stristr(PHP_OS, "darwin") !== false) die("skip MacOS has broken inet_*() fun <?php $a = array( - '::1', - '::2', - '::35', - '::255', - '::1024', - '', - '2001:0db8:85a3:08d3:1319:8a2e:0370:7344', - '2001:0db8:1234:0000:0000:0000:0000:0000', - '2001:0db8:1234:FFFF:FFFF:FFFF:FFFF:FFFF', + '::1', + '::2', + '::35', + '::255', + '::1024', + '', + '2001:0db8:85a3:08d3:1319:8a2e:0370:7344', + '2001:0db8:1234:0000:0000:0000:0000:0000', + '2001:0db8:1234:FFFF:FFFF:FFFF:FFFF:FFFF', ); foreach ($a as $address) { - $packed = inet_pton($address); - var_dump(inet_ntop($packed)); + $packed = inet_pton($address); + var_dump(inet_ntop($packed)); } echo "Done\n"; diff --git a/ext/standard/tests/network/ip.phpt b/ext/standard/tests/network/ip.phpt index 831eee018a..97e06b3187 100644 --- a/ext/standard/tests/network/ip.phpt +++ b/ext/standard/tests/network/ip.phpt @@ -8,17 +8,17 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); <?php $array = array( - "127.0.0.1", - "10.0.0.1", - "255.255.255.255", - "255.255.255.0", - "0.0.0.0", - "66.163.161.116", + "127.0.0.1", + "10.0.0.1", + "255.255.255.255", + "255.255.255.0", + "0.0.0.0", + "66.163.161.116", ); foreach ($array as $ip) { - var_dump($long = ip2long($ip)); - var_dump(long2ip($long)); + var_dump($long = ip2long($ip)); + var_dump(long2ip($long)); } var_dump(ip2long("")); diff --git a/ext/standard/tests/network/ip2long_variation2.phpt b/ext/standard/tests/network/ip2long_variation2.phpt index 0fcd701b26..56c74bb37e 100644 --- a/ext/standard/tests/network/ip2long_variation2.phpt +++ b/ext/standard/tests/network/ip2long_variation2.phpt @@ -12,18 +12,18 @@ Test ip2long() function : usage variation 2, 32 bit */ $ips = array( - "1.1.011.011", - "127.0.0.1", - "1.1.071.071", - "0.0.0.0", - "1.1.081.081", - "192.168.0.0", - "256.0.0.1", - "192.168.0xa.5", + "1.1.011.011", + "127.0.0.1", + "1.1.071.071", + "0.0.0.0", + "1.1.081.081", + "192.168.0.0", + "256.0.0.1", + "192.168.0xa.5", ); foreach($ips as $ip) { - var_dump(ip2long($ip)); + var_dump(ip2long($ip)); } ?> diff --git a/ext/standard/tests/network/ip2long_variation2_x64.phpt b/ext/standard/tests/network/ip2long_variation2_x64.phpt index 563f579b84..3ee59c9efb 100644 --- a/ext/standard/tests/network/ip2long_variation2_x64.phpt +++ b/ext/standard/tests/network/ip2long_variation2_x64.phpt @@ -19,18 +19,18 @@ if(PHP_INT_SIZE != 8) {die('skip 64 bit only');} */ $ips = array( - "1.1.011.011", - "127.0.0.1", - "1.1.071.071", - "0.0.0.0", - "1.1.081.081", - "192.168.0.0", - "256.0.0.1", - "192.168.0xa.5", + "1.1.011.011", + "127.0.0.1", + "1.1.071.071", + "0.0.0.0", + "1.1.081.081", + "192.168.0.0", + "256.0.0.1", + "192.168.0xa.5", ); foreach($ips as $ip) { - var_dump(ip2long($ip)); + var_dump(ip2long($ip)); } ?> diff --git a/ext/standard/tests/network/ip_x86_64.phpt b/ext/standard/tests/network/ip_x86_64.phpt index 06ed1549a6..c659eb70fb 100644 --- a/ext/standard/tests/network/ip_x86_64.phpt +++ b/ext/standard/tests/network/ip_x86_64.phpt @@ -8,17 +8,17 @@ if (PHP_INT_SIZE == 4) die("skip this test is for >32bit platform only"); <?php $array = array( - "127.0.0.1", - "10.0.0.1", - "255.255.255.255", - "255.255.255.0", - "0.0.0.0", - "66.163.161.116", + "127.0.0.1", + "10.0.0.1", + "255.255.255.255", + "255.255.255.0", + "0.0.0.0", + "66.163.161.116", ); foreach ($array as $ip) { - var_dump($long = ip2long($ip)); - var_dump(long2ip($long)); + var_dump($long = ip2long($ip)); + var_dump(long2ip($long)); } var_dump(ip2long("")); diff --git a/ext/standard/tests/network/setcookie.phpt b/ext/standard/tests/network/setcookie.phpt index 1033b7bbbe..c2806ad8a9 100644 --- a/ext/standard/tests/network/setcookie.phpt +++ b/ext/standard/tests/network/setcookie.phpt @@ -21,54 +21,54 @@ setcookie('name', 'value', ['expires' => $tsp]); setcookie('name', 'value', ['expires' => $tsn, 'path' => '/path/', 'domain' => 'domain.tld', 'secure' => true, 'httponly' => true, 'samesite' => 'Strict']); $expected = array( - 'Set-Cookie: name=deleted; expires='.date('D, d-M-Y H:i:s', 1).' GMT; Max-Age=0', - 'Set-Cookie: name=deleted; expires='.date('D, d-M-Y H:i:s', 1).' GMT; Max-Age=0', - 'Set-Cookie: name=value', - 'Set-Cookie: name=space%20value', - 'Set-Cookie: name=value', - 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsp).' GMT; Max-Age=5', - 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsn).' GMT; Max-Age=0', - 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsc).' GMT; Max-Age=0', - 'Set-Cookie: name=value; path=/path/', - 'Set-Cookie: name=value; domain=domain.tld', - 'Set-Cookie: name=value; secure', - 'Set-Cookie: name=value; HttpOnly', - 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsp).' GMT; Max-Age=5', - 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsn).' GMT; Max-Age=0; path=/path/; domain=domain.tld; secure; HttpOnly; SameSite=Strict' + 'Set-Cookie: name=deleted; expires='.date('D, d-M-Y H:i:s', 1).' GMT; Max-Age=0', + 'Set-Cookie: name=deleted; expires='.date('D, d-M-Y H:i:s', 1).' GMT; Max-Age=0', + 'Set-Cookie: name=value', + 'Set-Cookie: name=space%20value', + 'Set-Cookie: name=value', + 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsp).' GMT; Max-Age=5', + 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsn).' GMT; Max-Age=0', + 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsc).' GMT; Max-Age=0', + 'Set-Cookie: name=value; path=/path/', + 'Set-Cookie: name=value; domain=domain.tld', + 'Set-Cookie: name=value; secure', + 'Set-Cookie: name=value; HttpOnly', + 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsp).' GMT; Max-Age=5', + 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsn).' GMT; Max-Age=0; path=/path/; domain=domain.tld; secure; HttpOnly; SameSite=Strict' ); $headers = headers_list(); if (($i = count($expected)) > count($headers)) { - echo "Fewer headers are being sent than expected - aborting"; - return; + echo "Fewer headers are being sent than expected - aborting"; + return; } do { - if (strncmp(current($headers), 'Set-Cookie:', 11) !== 0) - { - continue; - } + if (strncmp(current($headers), 'Set-Cookie:', 11) !== 0) + { + continue; + } - if (current($headers) === current($expected)) - { - $i--; - } - else - { - echo "Header mismatch:\n\tExpected: " - .current($expected) - ."\n\tReceived: ".current($headers)."\n"; - } + if (current($headers) === current($expected)) + { + $i--; + } + else + { + echo "Header mismatch:\n\tExpected: " + .current($expected) + ."\n\tReceived: ".current($headers)."\n"; + } - next($expected); + next($expected); } while (next($headers) !== FALSE); echo ($i === 0) - ? 'OK' - : 'A total of '.$i.' errors found.'; + ? 'OK' + : 'A total of '.$i.' errors found.'; ?> --EXPECTHEADERS-- diff --git a/ext/standard/tests/network/shutdown.phpt b/ext/standard/tests/network/shutdown.phpt index 1e79b059b1..b8655cc1f4 100644 --- a/ext/standard/tests/network/shutdown.phpt +++ b/ext/standard/tests/network/shutdown.phpt @@ -17,56 +17,56 @@ stream_socket_shutdown() test on IPv4 TCP Loopback } if (!$server) { - die('Unable to create AF_INET socket [server]'); - } + die('Unable to create AF_INET socket [server]'); + } - /* Connect and send request 1 */ - $client1 = stream_socket_client("tcp://127.0.0.1:$port"); - if (!$client1) { - die('Unable to create AF_INET socket [client]'); - } - @fwrite($client1, "Client 1\n"); - stream_socket_shutdown($client1, STREAM_SHUT_WR); - @fwrite($client1, "Error 1\n"); + /* Connect and send request 1 */ + $client1 = stream_socket_client("tcp://127.0.0.1:$port"); + if (!$client1) { + die('Unable to create AF_INET socket [client]'); + } + @fwrite($client1, "Client 1\n"); + stream_socket_shutdown($client1, STREAM_SHUT_WR); + @fwrite($client1, "Error 1\n"); - /* Connect and send request 2 */ - $client2 = stream_socket_client("tcp://127.0.0.1:$port"); - if (!$client2) { - die('Unable to create AF_INET socket [client]'); - } - @fwrite($client2, "Client 2\n"); - stream_socket_shutdown($client2, STREAM_SHUT_WR); - @fwrite($client2, "Error 2\n"); + /* Connect and send request 2 */ + $client2 = stream_socket_client("tcp://127.0.0.1:$port"); + if (!$client2) { + die('Unable to create AF_INET socket [client]'); + } + @fwrite($client2, "Client 2\n"); + stream_socket_shutdown($client2, STREAM_SHUT_WR); + @fwrite($client2, "Error 2\n"); - /* Accept connection 1 */ - $socket = stream_socket_accept($server); - if (!$socket) { - die('Unable to accept connection'); - } - @fwrite($socket, fgets($socket)); - @fwrite($socket, fgets($socket)); - fclose($socket); + /* Accept connection 1 */ + $socket = stream_socket_accept($server); + if (!$socket) { + die('Unable to accept connection'); + } + @fwrite($socket, fgets($socket)); + @fwrite($socket, fgets($socket)); + fclose($socket); - /* Read Response 1 */ - echo fgets($client1); - echo fgets($client1); + /* Read Response 1 */ + echo fgets($client1); + echo fgets($client1); - /* Accept connection 2 */ - $socket = stream_socket_accept($server); - if (!$socket) { - die('Unable to accept connection'); - } - @fwrite($socket, fgets($socket)); - @fwrite($socket, fgets($socket)); - fclose($socket); + /* Accept connection 2 */ + $socket = stream_socket_accept($server); + if (!$socket) { + die('Unable to accept connection'); + } + @fwrite($socket, fgets($socket)); + @fwrite($socket, fgets($socket)); + fclose($socket); - /* Read Response 2 */ - echo fgets($client2); - echo fgets($client2); + /* Read Response 2 */ + echo fgets($client2); + echo fgets($client2); - fclose($client1); - fclose($client2); - fclose($server); + fclose($client1); + fclose($client2); + fclose($server); ?> --EXPECT-- Client 1 diff --git a/ext/standard/tests/network/socket_bug74429.phpt b/ext/standard/tests/network/socket_bug74429.phpt index 2c955bb5be..f72e9e31d7 100644 --- a/ext/standard/tests/network/socket_bug74429.phpt +++ b/ext/standard/tests/network/socket_bug74429.phpt @@ -4,8 +4,8 @@ Bug #74429 Remote socket URI with unique persistence identifier broken <?php /* This behavior is undocumented, but might be in use. Until there's no officially - supported alternative, ensure changes doesn't cause BC breach. Otherwise, - the test should be removed once the undocumented behavior changes. */ + supported alternative, ensure changes doesn't cause BC breach. Otherwise, + the test should be removed once the undocumented behavior changes. */ for ($i=0; $i<100; $i++) { $port = rand(10000, 65000); diff --git a/ext/standard/tests/network/tcp4loop.phpt b/ext/standard/tests/network/tcp4loop.phpt index a18fa3ba57..1632eba423 100644 --- a/ext/standard/tests/network/tcp4loop.phpt +++ b/ext/standard/tests/network/tcp4loop.phpt @@ -11,30 +11,30 @@ Streams Based IPv4 TCP Loopback test break; } } - if (!$server) { - die('Unable to create AF_INET socket [server]'); - } + if (!$server) { + die('Unable to create AF_INET socket [server]'); + } - /* Connect to it */ - $client = stream_socket_client("tcp://127.0.0.1:$port"); - if (!$client) { - die('Unable to create AF_INET socket [client]'); - } + /* Connect to it */ + $client = stream_socket_client("tcp://127.0.0.1:$port"); + if (!$client) { + die('Unable to create AF_INET socket [client]'); + } - /* Accept that connection */ - $socket = stream_socket_accept($server); - if (!$socket) { - die('Unable to accept connection'); - } + /* Accept that connection */ + $socket = stream_socket_accept($server); + if (!$socket) { + die('Unable to accept connection'); + } - fwrite($client, "ABCdef123\n"); + fwrite($client, "ABCdef123\n"); - $data = fread($socket, 10); - var_dump($data); + $data = fread($socket, 10); + var_dump($data); - fclose($client); - fclose($socket); - fclose($server); + fclose($client); + fclose($socket); + fclose($server); ?> --EXPECT-- string(10) "ABCdef123 diff --git a/ext/standard/tests/network/tcp6loop.phpt b/ext/standard/tests/network/tcp6loop.phpt index c8223633ca..6f6e418ffc 100644 --- a/ext/standard/tests/network/tcp6loop.phpt +++ b/ext/standard/tests/network/tcp6loop.phpt @@ -20,30 +20,30 @@ Streams Based IPv6 TCP Loopback test } } - if (!$server) { - die('Unable to create AF_INET6 socket [server]'); - } + if (!$server) { + die('Unable to create AF_INET6 socket [server]'); + } - /* Connect to it */ - $client = stream_socket_client("tcp://[::1]:$port"); - if (!$client) { - die('Unable to create AF_INET6 socket [client]'); - } + /* Connect to it */ + $client = stream_socket_client("tcp://[::1]:$port"); + if (!$client) { + die('Unable to create AF_INET6 socket [client]'); + } - /* Accept that connection */ - $socket = stream_socket_accept($server); - if (!$socket) { - die('Unable to accept connection'); - } + /* Accept that connection */ + $socket = stream_socket_accept($server); + if (!$socket) { + die('Unable to accept connection'); + } - fwrite($client, "ABCdef123\n"); + fwrite($client, "ABCdef123\n"); - $data = fread($socket, 10); - var_dump($data); + $data = fread($socket, 10); + var_dump($data); - fclose($client); - fclose($socket); - fclose($server); + fclose($client); + fclose($socket); + fclose($server); ?> --EXPECT-- string(10) "ABCdef123 diff --git a/ext/standard/tests/network/udgloop.phpt b/ext/standard/tests/network/udgloop.phpt index 47ecaf042e..3a7e1bf267 100644 --- a/ext/standard/tests/network/udgloop.phpt +++ b/ext/standard/tests/network/udgloop.phpt @@ -7,30 +7,30 @@ Streams Based Unix Domain Datagram Loopback test ?> --FILE-- <?php - $uniqid = uniqid(); - if (file_exists("/tmp/$uniqid.sock")) - die('Temporary socket /tmp/$uniqid.sock already exists.'); + $uniqid = uniqid(); + if (file_exists("/tmp/$uniqid.sock")) + die('Temporary socket /tmp/$uniqid.sock already exists.'); - /* Setup socket server */ - $server = stream_socket_server("udg:///tmp/$uniqid.sock", $errno, $errstr, STREAM_SERVER_BIND); - if (!$server) { - die('Unable to create AF_UNIX socket [server]'); - } + /* Setup socket server */ + $server = stream_socket_server("udg:///tmp/$uniqid.sock", $errno, $errstr, STREAM_SERVER_BIND); + if (!$server) { + die('Unable to create AF_UNIX socket [server]'); + } - /* Connect to it */ - $client = stream_socket_client("udg:///tmp/$uniqid.sock"); - if (!$client) { - die('Unable to create AF_UNIX socket [client]'); - } + /* Connect to it */ + $client = stream_socket_client("udg:///tmp/$uniqid.sock"); + if (!$client) { + die('Unable to create AF_UNIX socket [client]'); + } - fwrite($client, "ABCdef123\n"); + fwrite($client, "ABCdef123\n"); - $data = fread($server, 10); - var_dump($data); + $data = fread($server, 10); + var_dump($data); - fclose($client); - fclose($server); - unlink("/tmp/$uniqid.sock"); + fclose($client); + fclose($server); + unlink("/tmp/$uniqid.sock"); ?> --EXPECT-- string(10) "ABCdef123 diff --git a/ext/standard/tests/network/udp4loop.phpt b/ext/standard/tests/network/udp4loop.phpt index 3f78df267a..92709233ba 100644 --- a/ext/standard/tests/network/udp4loop.phpt +++ b/ext/standard/tests/network/udp4loop.phpt @@ -2,29 +2,29 @@ Streams Based IPv4 UDP Loopback test --FILE-- <?php - /* Setup socket server */ - for ($port = 31338; $port < 31500; ++$port) { - $uri = "udp://127.0.0.1:$port"; - $server = @stream_socket_server($uri, $errno, $errstr, STREAM_SERVER_BIND); - if ($server) break; - } - if (!$server) { - die('Unable to create AF_INET socket [server]: ' . $errstr); - } + /* Setup socket server */ + for ($port = 31338; $port < 31500; ++$port) { + $uri = "udp://127.0.0.1:$port"; + $server = @stream_socket_server($uri, $errno, $errstr, STREAM_SERVER_BIND); + if ($server) break; + } + if (!$server) { + die('Unable to create AF_INET socket [server]: ' . $errstr); + } - /* Connect to it */ - $client = stream_socket_client($uri); - if (!$client) { - die('Unable to create AF_INET socket [client]'); - } + /* Connect to it */ + $client = stream_socket_client($uri); + if (!$client) { + die('Unable to create AF_INET socket [client]'); + } - fwrite($client, "ABCdef123\n"); + fwrite($client, "ABCdef123\n"); - $data = fread($server, 10); - var_dump($data); + $data = fread($server, 10); + var_dump($data); - fclose($client); - fclose($server); + fclose($client); + fclose($server); ?> --EXPECT-- string(10) "ABCdef123 diff --git a/ext/standard/tests/network/udp6loop.phpt b/ext/standard/tests/network/udp6loop.phpt index 3b70f43119..06d9bf4811 100644 --- a/ext/standard/tests/network/udp6loop.phpt +++ b/ext/standard/tests/network/udp6loop.phpt @@ -26,23 +26,23 @@ Streams Based IPv6 UDP Loopback test } } - if (!$server) { - die('Unable to create AF_INET6 socket [server]'); - } + if (!$server) { + die('Unable to create AF_INET6 socket [server]'); + } - /* Connect to it */ - $client = stream_socket_client("udp://[::1]:$port"); - if (!$client) { - die('Unable to create AF_INET6 socket [client]'); - } + /* Connect to it */ + $client = stream_socket_client("udp://[::1]:$port"); + if (!$client) { + die('Unable to create AF_INET6 socket [client]'); + } - fwrite($client, "ABCdef123\n"); + fwrite($client, "ABCdef123\n"); - $data = fread($server, 10); - var_dump($data); + $data = fread($server, 10); + var_dump($data); - fclose($client); - fclose($server); + fclose($client); + fclose($server); ?> --EXPECT-- string(10) "ABCdef123 diff --git a/ext/standard/tests/network/unixloop.phpt b/ext/standard/tests/network/unixloop.phpt index 2e95beb9f5..4b5bde2262 100644 --- a/ext/standard/tests/network/unixloop.phpt +++ b/ext/standard/tests/network/unixloop.phpt @@ -7,37 +7,37 @@ Streams Based Unix Domain Loopback test ?> --FILE-- <?php - $uniqid = uniqid(); - if (file_exists("/tmp/$uniqid.sock")) - die('Temporary socket already exists.'); + $uniqid = uniqid(); + if (file_exists("/tmp/$uniqid.sock")) + die('Temporary socket already exists.'); - /* Setup socket server */ - $server = stream_socket_server("unix:///tmp/$uniqid.sock"); - if (!$server) { - die('Unable to create AF_UNIX socket [server]'); - } + /* Setup socket server */ + $server = stream_socket_server("unix:///tmp/$uniqid.sock"); + if (!$server) { + die('Unable to create AF_UNIX socket [server]'); + } - /* Connect to it */ - $client = stream_socket_client("unix:///tmp/$uniqid.sock"); - if (!$client) { - die('Unable to create AF_UNIX socket [client]'); - } + /* Connect to it */ + $client = stream_socket_client("unix:///tmp/$uniqid.sock"); + if (!$client) { + die('Unable to create AF_UNIX socket [client]'); + } - /* Accept that connection */ - $socket = stream_socket_accept($server); - if (!$socket) { - die('Unable to accept connection'); - } + /* Accept that connection */ + $socket = stream_socket_accept($server); + if (!$socket) { + die('Unable to accept connection'); + } - fwrite($client, "ABCdef123\n"); + fwrite($client, "ABCdef123\n"); - $data = fread($socket, 10); - var_dump($data); + $data = fread($socket, 10); + var_dump($data); - fclose($client); - fclose($socket); - fclose($server); - unlink("/tmp/$uniqid.sock"); + fclose($client); + fclose($socket); + fclose($server); + unlink("/tmp/$uniqid.sock"); ?> --EXPECT-- string(10) "ABCdef123 diff --git a/ext/standard/tests/password/password_hash_argon2.phpt b/ext/standard/tests/password/password_hash_argon2.phpt index a7612effa9..399c4cd4bc 100644 --- a/ext/standard/tests/password/password_hash_argon2.phpt +++ b/ext/standard/tests/password/password_hash_argon2.phpt @@ -10,12 +10,12 @@ if (!defined('PASSWORD_ARGON2ID')) die('skip password_hash not built with Argon2 $password = "the password for testing 12345!"; $algos = [ - PASSWORD_ARGON2I, - 'argon2i', - 2, - PASSWORD_ARGON2ID, - 'argon2id', - 3, + PASSWORD_ARGON2I, + 'argon2i', + 2, + PASSWORD_ARGON2ID, + 'argon2id', + 3, ]; foreach ($algos as $algo) { $hash = password_hash($password, $algo); diff --git a/ext/standard/tests/serialize/001.phpt b/ext/standard/tests/serialize/001.phpt index 5551956e92..147c355b08 100644 --- a/ext/standard/tests/serialize/001.phpt +++ b/ext/standard/tests/serialize/001.phpt @@ -6,36 +6,36 @@ serialize_precision=100 <?php class t { - function __construct() - { - $this->a = "hallo"; - } + function __construct() + { + $this->a = "hallo"; + } } class s { - public $a; - public $b; - public $c; + public $a; + public $b; + public $c; - function __construct() - { - $this->a = "hallo"; - $this->b = "php"; - $this->c = "world"; - $this->d = "!"; - } + function __construct() + { + $this->a = "hallo"; + $this->b = "php"; + $this->c = "world"; + $this->d = "!"; + } - function __sleep() - { - echo "__sleep called\n"; - return array("a","c"); - } + function __sleep() + { + echo "__sleep called\n"; + return array("a","c"); + } - function __wakeup() - { - echo "__wakeup called\n"; - } + function __wakeup() + { + echo "__wakeup called\n"; + } } diff --git a/ext/standard/tests/serialize/003.phpt b/ext/standard/tests/serialize/003.phpt index 5011412809..cf54f40406 100644 --- a/ext/standard/tests/serialize/003.phpt +++ b/ext/standard/tests/serialize/003.phpt @@ -6,9 +6,9 @@ serialize_precision=100 --FILE-- <?php foreach(array(1e2, 5.2e25, 85.29e-23, 9e-9) AS $value) { - echo ($ser = serialize($value))."\n"; - var_dump(unserialize($ser)); - echo "\n"; + echo ($ser = serialize($value))."\n"; + var_dump(unserialize($ser)); + echo "\n"; } ?> --EXPECTREGEX-- diff --git a/ext/standard/tests/serialize/005.phpt b/ext/standard/tests/serialize/005.phpt index 13ae050129..fd9fcaac18 100644 --- a/ext/standard/tests/serialize/005.phpt +++ b/ext/standard/tests/serialize/005.phpt @@ -7,93 +7,93 @@ serialize()/unserialize() objects function do_autoload($class_name) { - if ($class_name != 'autoload_not_available') - { - require_once(__DIR__ . '/' . strtolower($class_name) . '.inc'); - } - echo __FUNCTION__ . "($class_name)\n"; + if ($class_name != 'autoload_not_available') + { + require_once(__DIR__ . '/' . strtolower($class_name) . '.inc'); + } + echo __FUNCTION__ . "($class_name)\n"; } function unserializer($class_name) { - echo __METHOD__ . "($class_name)\n"; - switch($class_name) - { - case 'TestNAOld': - eval("class TestNAOld extends TestOld {}"); - break; - case 'TestNANew': - eval("class TestNANew extends TestNew {}"); - break; - case 'TestNANew2': - eval("class TestNANew2 extends TestNew {}"); - break; - default: - echo "Try autoloader\n"; - if (!spl_autoload_functions()) { - spl_autoload_register(function ($class_name) { do_autoload($class_name); }); - } - spl_autoload_call($class_name); - break; - } + echo __METHOD__ . "($class_name)\n"; + switch($class_name) + { + case 'TestNAOld': + eval("class TestNAOld extends TestOld {}"); + break; + case 'TestNANew': + eval("class TestNANew extends TestNew {}"); + break; + case 'TestNANew2': + eval("class TestNANew2 extends TestNew {}"); + break; + default: + echo "Try autoloader\n"; + if (!spl_autoload_functions()) { + spl_autoload_register(function ($class_name) { do_autoload($class_name); }); + } + spl_autoload_call($class_name); + break; + } } ini_set('unserialize_callback_func', 'unserializer'); class TestOld { - function serialize() - { - echo __METHOD__ . "()\n"; - } - - function unserialize($serialized) - { - echo __METHOD__ . "()\n"; - } - - function __wakeup() - { - echo __METHOD__ . "()\n"; - } - - function __sleep() - { - echo __METHOD__ . "()\n"; - return array(); - } + function serialize() + { + echo __METHOD__ . "()\n"; + } + + function unserialize($serialized) + { + echo __METHOD__ . "()\n"; + } + + function __wakeup() + { + echo __METHOD__ . "()\n"; + } + + function __sleep() + { + echo __METHOD__ . "()\n"; + return array(); + } } class TestNew implements Serializable { - protected static $check = 0; - - function serialize() - { - echo __METHOD__ . "()\n"; - switch(++self::$check) - { - case 1: - return NULL; - case 2: - return "2"; - } - } - - function unserialize($serialized) - { - echo __METHOD__ . "()\n"; - } - - function __wakeup() - { - echo __METHOD__ . "()\n"; - } - - function __sleep() - { - echo __METHOD__ . "()\n"; - } + protected static $check = 0; + + function serialize() + { + echo __METHOD__ . "()\n"; + switch(++self::$check) + { + case 1: + return NULL; + case 2: + return "2"; + } + } + + function unserialize($serialized) + { + echo __METHOD__ . "()\n"; + } + + function __wakeup() + { + echo __METHOD__ . "()\n"; + } + + function __sleep() + { + echo __METHOD__ . "()\n"; + } } echo "===O1===\n"; diff --git a/ext/standard/tests/serialize/006.phpt b/ext/standard/tests/serialize/006.phpt index 6ba93f4d23..24b3cbbe2d 100644 --- a/ext/standard/tests/serialize/006.phpt +++ b/ext/standard/tests/serialize/006.phpt @@ -2,19 +2,19 @@ serialize()/unserialize() with exotic letters --FILE-- <?php - $åäöÅÄÖ = array('åäöÅÄÖ' => 'åäöÅÄÖ'); + $åäöÅÄÖ = array('åäöÅÄÖ' => 'åäöÅÄÖ'); - class ÜberKööliäå - { - public $åäöÅÄÖüÜber = 'åäöÅÄÖ'; - } + class ÜberKööliäå + { + public $åäöÅÄÖüÜber = 'åäöÅÄÖ'; + } $foo = new Überkööliäå(); - var_dump(serialize($foo)); - var_dump(unserialize(serialize($foo))); - var_dump(serialize($åäöÅÄÖ)); - var_dump(unserialize(serialize($åäöÅÄÖ))); + var_dump(serialize($foo)); + var_dump(unserialize(serialize($foo))); + var_dump(serialize($åäöÅÄÖ)); + var_dump(unserialize(serialize($åäöÅÄÖ))); ?> --EXPECT-- string(55) "O:11:"ÜberKööliäå":1:{s:11:"åäöÅÄÖüÜber";s:6:"åäöÅÄÖ";}" diff --git a/ext/standard/tests/serialize/autoload_implements.inc b/ext/standard/tests/serialize/autoload_implements.inc index 55fcc3cd9f..e5f19c0680 100644 --- a/ext/standard/tests/serialize/autoload_implements.inc +++ b/ext/standard/tests/serialize/autoload_implements.inc @@ -1,10 +1,10 @@ <?php class autoload_implements implements autoload_interface { - function testFunction() - { - return true; - } + function testFunction() + { + return true; + } } ?> diff --git a/ext/standard/tests/serialize/autoload_interface.inc b/ext/standard/tests/serialize/autoload_interface.inc index e6a416e721..6e696f36bf 100644 --- a/ext/standard/tests/serialize/autoload_interface.inc +++ b/ext/standard/tests/serialize/autoload_interface.inc @@ -1,7 +1,7 @@ <?php interface autoload_interface { - function testFunction(); + function testFunction(); } ?> diff --git a/ext/standard/tests/serialize/bug14293.phpt b/ext/standard/tests/serialize/bug14293.phpt index 73636ba56d..875f8b2bc8 100644 --- a/ext/standard/tests/serialize/bug14293.phpt +++ b/ext/standard/tests/serialize/bug14293.phpt @@ -4,16 +4,16 @@ Bug #14293 (serialize() and __sleep()) <?php class t { - function __construct() - { - $this->a = 'hello'; - } + function __construct() + { + $this->a = 'hello'; + } - function __sleep() - { - echo "__sleep called\n"; - return array('a','b'); - } + function __sleep() + { + echo "__sleep called\n"; + return array('a','b'); + } } $t = new t(); diff --git a/ext/standard/tests/serialize/bug21957.phpt b/ext/standard/tests/serialize/bug21957.phpt index 070eda3f4c..9d761a6699 100644 --- a/ext/standard/tests/serialize/bug21957.phpt +++ b/ext/standard/tests/serialize/bug21957.phpt @@ -4,18 +4,18 @@ Bug #21957 (serialize() mangles objects with __sleep) <?php class test { - public $a, $b; + public $a, $b; - function __construct() - { - $this->a = 7; - $this->b = 2; - } + function __construct() + { + $this->a = 7; + $this->b = 2; + } - function __sleep() - { - $this->b = 0; - } + function __sleep() + { + $this->b = 0; + } } $t['one'] = 'ABC'; diff --git a/ext/standard/tests/serialize/bug23298.phpt b/ext/standard/tests/serialize/bug23298.phpt index fe56fccc45..29d09d18e9 100644 --- a/ext/standard/tests/serialize/bug23298.phpt +++ b/ext/standard/tests/serialize/bug23298.phpt @@ -4,10 +4,10 @@ Bug #23298 (serialize() and floats/doubles) serialize_precision=100 --FILE-- <?php - ini_set('precision', 12); - $foo = 1.428571428571428647642857142; - $bar = unserialize(serialize($foo)); - var_dump(($foo === $bar)); + ini_set('precision', 12); + $foo = 1.428571428571428647642857142; + $bar = unserialize(serialize($foo)); + var_dump(($foo === $bar)); ?> --EXPECT-- bool(true) diff --git a/ext/standard/tests/serialize/bug24063.phpt b/ext/standard/tests/serialize/bug24063.phpt index 38c9d6ed24..e3102245f8 100644 --- a/ext/standard/tests/serialize/bug24063.phpt +++ b/ext/standard/tests/serialize/bug24063.phpt @@ -7,8 +7,8 @@ precision=12 <?php $v = 1; for ($i = 1; $i < 10; $i++) { - $v /= 10; - echo "{$v} ".unserialize(serialize($v))."\n"; + $v /= 10; + echo "{$v} ".unserialize(serialize($v))."\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/serialize/bug26762.phpt b/ext/standard/tests/serialize/bug26762.phpt index ad6c0e0b41..d4daf34464 100644 --- a/ext/standard/tests/serialize/bug26762.phpt +++ b/ext/standard/tests/serialize/bug26762.phpt @@ -10,15 +10,15 @@ Bug #26762 (unserialize() produces lowercase classnames) ini_set('unserialize_callback_func','check'); function check($name) { - var_dump($name); - throw new exception; + var_dump($name); + throw new exception; } try { - @unserialize('O:3:"FOO":0:{}'); + @unserialize('O:3:"FOO":0:{}'); } catch (Exception $e) { - /* ignore */ + /* ignore */ } ?> diff --git a/ext/standard/tests/serialize/bug28325.phpt b/ext/standard/tests/serialize/bug28325.phpt index ee0e60e1ad..cd909dc07d 100644 --- a/ext/standard/tests/serialize/bug28325.phpt +++ b/ext/standard/tests/serialize/bug28325.phpt @@ -3,13 +3,13 @@ Bug #28325 (Problem in serialisation of circular references) --FILE-- <?php class a { - public $b; + public $b; } class b { - public $c; + public $c; } class c { - public $d; + public $d; } $a = new a(); $a->b = new b(); diff --git a/ext/standard/tests/serialize/bug30234.phpt b/ext/standard/tests/serialize/bug30234.phpt index 4b45d8d1ef..66e5aa3547 100644 --- a/ext/standard/tests/serialize/bug30234.phpt +++ b/ext/standard/tests/serialize/bug30234.phpt @@ -8,8 +8,8 @@ Bug #30234 (__autoload() not invoked for interfaces) <?php spl_autoload_register(function ($class_name) { - require_once(__DIR__ . '/' . strtolower($class_name) . '.inc'); - echo __FUNCTION__ . '(' . $class_name . ")\n"; + require_once(__DIR__ . '/' . strtolower($class_name) . '.inc'); + echo __FUNCTION__ . '(' . $class_name . ")\n"; }); var_dump(interface_exists('autoload_interface', false)); diff --git a/ext/standard/tests/serialize/bug49649.phpt b/ext/standard/tests/serialize/bug49649.phpt index d6acb80764..455c1e17d4 100644 --- a/ext/standard/tests/serialize/bug49649.phpt +++ b/ext/standard/tests/serialize/bug49649.phpt @@ -23,11 +23,11 @@ $serialized = 'TzozOiJGb28iOjQ6e3M6MTI6IgBGb28AcHJpdmF0ZSI7aToxO3M6MTI6IgAqAHByb class Foo { - public $public = null; + public $public = null; - public $protected = null; + public $protected = null; - public $private = null; + public $private = null; } $class = unserialize(base64_decode($serialized)); diff --git a/ext/standard/tests/serialize/bug49649_1.phpt b/ext/standard/tests/serialize/bug49649_1.phpt index fb6d6dba52..a2f5427edd 100644 --- a/ext/standard/tests/serialize/bug49649_1.phpt +++ b/ext/standard/tests/serialize/bug49649_1.phpt @@ -23,11 +23,11 @@ $serialized = 'TzozOiJGb28iOjQ6e3M6MTI6IgBGb28AcHJpdmF0ZSI7aToxO3M6MTI6IgAqAHByb class Foo { - protected $public = null; + protected $public = null; - protected $protected = null; + protected $protected = null; - protected $private = null; + protected $private = null; } $class = unserialize(base64_decode($serialized)); diff --git a/ext/standard/tests/serialize/bug49649_2.phpt b/ext/standard/tests/serialize/bug49649_2.phpt index fe5b43a6ad..18796b21f7 100644 --- a/ext/standard/tests/serialize/bug49649_2.phpt +++ b/ext/standard/tests/serialize/bug49649_2.phpt @@ -23,11 +23,11 @@ $serialized = 'TzozOiJGb28iOjQ6e3M6MTI6IgBGb28AcHJpdmF0ZSI7aToxO3M6MTI6IgAqAHByb class Foo { - private $public = null; + private $public = null; - private $protected = null; + private $protected = null; - private $private = null; + private $private = null; } $class = unserialize(base64_decode($serialized)); diff --git a/ext/standard/tests/serialize/bug65481.phpt b/ext/standard/tests/serialize/bug65481.phpt index 65634f63ba..ece721b6fe 100644 --- a/ext/standard/tests/serialize/bug65481.phpt +++ b/ext/standard/tests/serialize/bug65481.phpt @@ -5,29 +5,29 @@ Bug #65481 (shutdown segfault due to serialize) echo "Test\n"; class A { - public $e = array(); + public $e = array(); } class Token implements \Serializable { - public function serialize() - { - $c = new A; + public function serialize() + { + $c = new A; - for ($i = 0; $i < 4; $i++) - { - $e = new A; - $c->e[] = $e; - $e->e = $c->e; - } + for ($i = 0; $i < 4; $i++) + { + $e = new A; + $c->e[] = $e; + $e->e = $c->e; + } - return serialize(array(serialize($c))); - } + return serialize(array(serialize($c))); + } - public function unserialize($str) - { - $r = unserialize($str); - $r = unserialize($r[0]); - } + public function unserialize($str) + { + $r = unserialize($str); + $r = unserialize($r[0]); + } } $token = new Token; diff --git a/ext/standard/tests/serialize/bug65806.phpt b/ext/standard/tests/serialize/bug65806.phpt index cefb923f23..166b694442 100644 --- a/ext/standard/tests/serialize/bug65806.phpt +++ b/ext/standard/tests/serialize/bug65806.phpt @@ -33,8 +33,8 @@ class myList { } public function __wakeup() { - $this->_obj = unserialize($this->_serialized); - } + $this->_obj = unserialize($this->_serialized); + } } echo "SCRIPT START" . PHP_EOL; diff --git a/ext/standard/tests/serialize/bug67072.phpt b/ext/standard/tests/serialize/bug67072.phpt index 951db75a07..df0593180d 100644 --- a/ext/standard/tests/serialize/bug67072.phpt +++ b/ext/standard/tests/serialize/bug67072.phpt @@ -2,7 +2,7 @@ Bug #67072 Echoing unserialized "SplFileObject" crash --FILE-- <?php - echo unserialize('O:13:"SplFileObject":1:{s:9:"*filename";s:15:"/home/flag/flag";}'); + echo unserialize('O:13:"SplFileObject":1:{s:9:"*filename";s:15:"/home/flag/flag";}'); ?> ===DONE== --EXPECTF-- diff --git a/ext/standard/tests/serialize/bug68044.phpt b/ext/standard/tests/serialize/bug68044.phpt index 01ada07ad8..dc6053c501 100644 --- a/ext/standard/tests/serialize/bug68044.phpt +++ b/ext/standard/tests/serialize/bug68044.phpt @@ -2,7 +2,7 @@ Bug #68044 Integer overflow in unserialize() (32-bits only) --FILE-- <?php - echo unserialize('C:3:"XYZ":18446744075857035259:{}'); + echo unserialize('C:3:"XYZ":18446744075857035259:{}'); ?> ===DONE== --EXPECTF-- diff --git a/ext/standard/tests/serialize/bug68594.phpt b/ext/standard/tests/serialize/bug68594.phpt index fbf9310d0b..69ff9e2bf4 100644 --- a/ext/standard/tests/serialize/bug68594.phpt +++ b/ext/standard/tests/serialize/bug68594.phpt @@ -3,19 +3,19 @@ Bug #68545 Use after free vulnerability in unserialize() --FILE-- <?php for ($i=4; $i<100; $i++) { - $m = new StdClass(); + $m = new StdClass(); - $u = array(1); + $u = array(1); - $m->aaa = array(1,2,&$u,4,5); - $m->bbb = 1; - $m->ccc = &$u; - $m->ddd = str_repeat("A", $i); + $m->aaa = array(1,2,&$u,4,5); + $m->bbb = 1; + $m->ccc = &$u; + $m->ddd = str_repeat("A", $i); - $z = serialize($m); - $z = str_replace("bbb", "aaa", $z); - $y = unserialize($z); - $z = serialize($y); + $z = serialize($m); + $z = str_replace("bbb", "aaa", $z); + $y = unserialize($z); + $z = serialize($y); } ?> ===DONE=== diff --git a/ext/standard/tests/serialize/bug68976.phpt b/ext/standard/tests/serialize/bug68976.phpt index d9ca33bdf7..514bd8b453 100644 --- a/ext/standard/tests/serialize/bug68976.phpt +++ b/ext/standard/tests/serialize/bug68976.phpt @@ -3,10 +3,10 @@ Bug #68976 Use After Free Vulnerability in unserialize() --FILE-- <?php class evilClass { - public $name; - function __wakeup() { - unset($this->name); - } + public $name; + function __wakeup() { + unset($this->name); + } } $fakezval = pack( diff --git a/ext/standard/tests/serialize/bug69210.phpt b/ext/standard/tests/serialize/bug69210.phpt index c06fe50e02..610c88f879 100644 --- a/ext/standard/tests/serialize/bug69210.phpt +++ b/ext/standard/tests/serialize/bug69210.phpt @@ -4,22 +4,22 @@ serialize() integrity with non string on __sleep <?php class testString { - public $a = true; + public $a = true; - public function __sleep() - { - return array('a', '1'); - } + public function __sleep() + { + return array('a', '1'); + } } class testInteger { - public $a = true; + public $a = true; - public function __sleep() - { - return array('a', 1); - } + public function __sleep() + { + return array('a', 1); + } } $cs = new testString(); diff --git a/ext/standard/tests/serialize/bug69425.phpt b/ext/standard/tests/serialize/bug69425.phpt index c7f4265789..e080fda7dd 100644 --- a/ext/standard/tests/serialize/bug69425.phpt +++ b/ext/standard/tests/serialize/bug69425.phpt @@ -6,12 +6,12 @@ Bug #69425: Use After Free in unserialize() // POC 1 class test { - var $ryat; + var $ryat; - function __wakeup() - { - $this->ryat = 1; - } + function __wakeup() + { + $this->ryat = 1; + } } $data = unserialize('a:2:{i:0;O:4:"test":1:{s:4:"ryat";R:1;}i:1;i:2;}'); diff --git a/ext/standard/tests/serialize/bug70172.phpt b/ext/standard/tests/serialize/bug70172.phpt index a2359d6434..18bc2fe85d 100644 --- a/ext/standard/tests/serialize/bug70172.phpt +++ b/ext/standard/tests/serialize/bug70172.phpt @@ -3,13 +3,13 @@ Bug #70172 - Use After Free Vulnerability in unserialize() --FILE-- <?php class obj implements Serializable { - var $data; - function serialize() { - return serialize($this->data); - } - function unserialize($data) { - $this->data = unserialize($data); - } + var $data; + function serialize() { + return serialize($this->data); + } + function unserialize($data) { + $this->data = unserialize($data); + } } $fakezval = ptr2str(1122334455); @@ -25,19 +25,19 @@ $exploit = 'a:2:{i:0;i:1;i:1;C:3:"obj":'.strlen($inner).':{'.$inner.'}}'; $data = unserialize($exploit); for ($i = 0; $i < 5; $i++) { - $v[$i] = $fakezval.$i; + $v[$i] = $fakezval.$i; } var_dump($data); function ptr2str($ptr) { - $out = ''; - for ($i = 0; $i < 8; $i++) { - $out .= chr($ptr & 0xff); - $ptr >>= 8; - } - return $out; + $out = ''; + for ($i = 0; $i < 8; $i++) { + $out .= chr($ptr & 0xff); + $ptr >>= 8; + } + return $out; } ?> --EXPECTF-- diff --git a/ext/standard/tests/serialize/bug70172_2.phpt b/ext/standard/tests/serialize/bug70172_2.phpt index 2b12a78edb..771f9ba1d7 100644 --- a/ext/standard/tests/serialize/bug70172_2.phpt +++ b/ext/standard/tests/serialize/bug70172_2.phpt @@ -3,20 +3,20 @@ Bug #70172 - Use After Free Vulnerability in unserialize() --FILE-- <?php class obj implements Serializable { - var $data; - function serialize() { - return serialize($this->data); - } - function unserialize($data) { - $this->data = unserialize($data); - } + var $data; + function serialize() { + return serialize($this->data); + } + function unserialize($data) { + $this->data = unserialize($data); + } } class obj2 { - var $ryat; - function __wakeup() { - $this->ryat = 1; - } + var $ryat; + function __wakeup() { + $this->ryat = 1; + } } $fakezval = ptr2str(1122334455); @@ -32,19 +32,19 @@ $exploit = 'a:2:{i:0;O:4:"obj2":1:{s:4:"ryat";C:3:"obj":'.strlen($inner).':{'.$i $data = unserialize($exploit); for ($i = 0; $i < 5; $i++) { - $v[$i] = $fakezval.$i; + $v[$i] = $fakezval.$i; } var_dump($data); function ptr2str($ptr) { - $out = ''; - for ($i = 0; $i < 8; $i++) { - $out .= chr($ptr & 0xff); - $ptr >>= 8; - } - return $out; + $out = ''; + for ($i = 0; $i < 8; $i++) { + $out .= chr($ptr & 0xff); + $ptr >>= 8; + } + return $out; } ?> --EXPECTF-- diff --git a/ext/standard/tests/serialize/bug70213.phpt b/ext/standard/tests/serialize/bug70213.phpt index fd7d4001f8..7129fe45f6 100644 --- a/ext/standard/tests/serialize/bug70213.phpt +++ b/ext/standard/tests/serialize/bug70213.phpt @@ -6,7 +6,7 @@ Bug #70213: Unserialize context shared on double class lookup ini_set('unserialize_callback_func', 'evil'); function evil() { - spl_autoload_register(function ($arg) { + spl_autoload_register(function ($arg) { var_dump(unserialize('R:1;')); }); } diff --git a/ext/standard/tests/serialize/bug70436.phpt b/ext/standard/tests/serialize/bug70436.phpt index 1bbf3b98ab..9cd97a689c 100644 --- a/ext/standard/tests/serialize/bug70436.phpt +++ b/ext/standard/tests/serialize/bug70436.phpt @@ -5,17 +5,17 @@ Bug #70436: Use After Free Vulnerability in unserialize() class obj implements Serializable { - var $data; + var $data; - function serialize() - { - return serialize($this->data); - } + function serialize() + { + return serialize($this->data); + } - function unserialize($data) - { - $this->data = unserialize($data); - } + function unserialize($data) + { + $this->data = unserialize($data); + } } $fakezval = ptr2str(1122334455); @@ -34,14 +34,14 @@ var_dump($data); function ptr2str($ptr) { - $out = ''; + $out = ''; - for ($i = 0; $i < 8; $i++) { - $out .= chr($ptr & 0xff); - $ptr >>= 8; - } + for ($i = 0; $i < 8; $i++) { + $out .= chr($ptr & 0xff); + $ptr >>= 8; + } - return $out; + return $out; } ?> DONE diff --git a/ext/standard/tests/serialize/bug70513.phpt b/ext/standard/tests/serialize/bug70513.phpt index cbdbdb8222..4f228b5b7b 100644 --- a/ext/standard/tests/serialize/bug70513.phpt +++ b/ext/standard/tests/serialize/bug70513.phpt @@ -7,12 +7,12 @@ Bug #70513: GMP Deserialization Type Confusion Vulnerability class obj { - var $ryat; + var $ryat; - function __wakeup() - { - $this->ryat = 1; - } + function __wakeup() + { + $this->ryat = 1; + } } $obj = new stdClass; diff --git a/ext/standard/tests/serialize/bug71995.phpt b/ext/standard/tests/serialize/bug71995.phpt index 0f7ac98722..f1c45d25cc 100644 --- a/ext/standard/tests/serialize/bug71995.phpt +++ b/ext/standard/tests/serialize/bug71995.phpt @@ -4,13 +4,13 @@ Bug #71995 (Returning the same var twice from __sleep() produces broken serializ <?php class A { - public $b; - public function __construct() { - $this->b = new StdClass(); - } - public function __sleep() { - return array("b", "b"); - } + public $b; + public function __construct() { + $this->b = new StdClass(); + } + public function __sleep() { + return array("b", "b"); + } } $a = new A(); $s = serialize($a); diff --git a/ext/standard/tests/serialize/bug72731.phpt b/ext/standard/tests/serialize/bug72731.phpt index 020fb3281f..9489928cfb 100644 --- a/ext/standard/tests/serialize/bug72731.phpt +++ b/ext/standard/tests/serialize/bug72731.phpt @@ -4,10 +4,10 @@ Bug #72731: Type Confusion in Object Deserialization <?php class obj { - var $ryat; - function __wakeup() { - $this->ryat = 0x1122334455; - } + var $ryat; + function __wakeup() { + $this->ryat = 0x1122334455; + } } $poc = 'O:8:"stdClass":1:{i:0;O:3:"obj":1:{s:4:"ryat";R:1;}}'; diff --git a/ext/standard/tests/serialize/bug73341.phpt b/ext/standard/tests/serialize/bug73341.phpt index 86fd457c60..2f38949c1a 100644 --- a/ext/standard/tests/serialize/bug73341.phpt +++ b/ext/standard/tests/serialize/bug73341.phpt @@ -6,7 +6,7 @@ try { $token = 'a:2:{i:0;O:1:"0":2:0s:1:"0";i:0;s:1:"0";a:1:{i:0;C:11:"ArrayObject":7:{x:i:0;r}'; $obj = unserialize($token); } catch(Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } try { @@ -14,7 +14,7 @@ $inner = 'x:i:1;O:8:"stdClass":1:{};m:a:0:{}'; $exploit = 'C:11:"ArrayObject":'.strlen($inner).':{'.$inner.'}'; unserialize($exploit); } catch(Exception $e) { - echo $e->getMessage()."\n"; + echo $e->getMessage()."\n"; } ?> --EXPECTF-- diff --git a/ext/standard/tests/serialize/bug76300.phpt b/ext/standard/tests/serialize/bug76300.phpt index 13e50f0332..156c31a909 100644 --- a/ext/standard/tests/serialize/bug76300.phpt +++ b/ext/standard/tests/serialize/bug76300.phpt @@ -3,19 +3,19 @@ Bug #76300: Unserialize of extended protected member broken --FILE-- <?php class Base { - private $id; - public function __construct($id) - { - $this->id = $id; - } + private $id; + public function __construct($id) + { + $this->id = $id; + } } class Derived extends Base { - protected $id; - public function __construct($id) - { - parent::__construct($id + 20); - $this->id = $id; - } + protected $id; + public function __construct($id) + { + parent::__construct($id + 20); + $this->id = $id; + } } $a = new Derived(44); $s = serialize($a); diff --git a/ext/standard/tests/serialize/precision.phpt b/ext/standard/tests/serialize/precision.phpt index 229c514e69..ec6d8e3408 100644 --- a/ext/standard/tests/serialize/precision.phpt +++ b/ext/standard/tests/serialize/precision.phpt @@ -8,30 +8,30 @@ if (pack('s', 1) != "\x01\x00") <?php $numbers = array( - "0000000000000000", //0 - "2d431cebe2362a3f", //.0002 - "2e431cebe2362a3f", //.0002 + 10^-Accuracy[.0002]*1.01 - "0000000000001000", //2^-1022. (minimum normal double) - "0100000000001000", //2^-1022. + 10^-Accuracy[2^-1022.]*1.01 - "ffffffffffffef7f", //2^1024. (maximum normal double) - "feffffffffffef7f", //2^1024. - 10^-Accuracy[2^1024.] - "0100000000000000", //minimum subnormal double - "0200000000000000", //2nd minimum subnormal double - "fffffffffffff000", //maximum subnormal double - "fefffffffffff000", //2nd maximum subnormal double - "0000000000000f7f", //+inf - "0000000000000fff", //-inf + "0000000000000000", //0 + "2d431cebe2362a3f", //.0002 + "2e431cebe2362a3f", //.0002 + 10^-Accuracy[.0002]*1.01 + "0000000000001000", //2^-1022. (minimum normal double) + "0100000000001000", //2^-1022. + 10^-Accuracy[2^-1022.]*1.01 + "ffffffffffffef7f", //2^1024. (maximum normal double) + "feffffffffffef7f", //2^1024. - 10^-Accuracy[2^1024.] + "0100000000000000", //minimum subnormal double + "0200000000000000", //2nd minimum subnormal double + "fffffffffffff000", //maximum subnormal double + "fefffffffffff000", //2nd maximum subnormal double + "0000000000000f7f", //+inf + "0000000000000fff", //-inf ); foreach ($numbers as $ns) { - $num = unpack("d", pack("H*", $ns)); $num = reset($num); - echo "number: ", sprintf("%.17e", $num), "... "; - $num2 = unserialize(serialize($num)); - $repr = unpack("H*", pack("d", $num2)); $repr = reset($repr); - if ($repr == $ns) - echo "OK\n"; - else - echo "mismatch\n\twas: $ns\n\tbecame: $repr\n"; + $num = unpack("d", pack("H*", $ns)); $num = reset($num); + echo "number: ", sprintf("%.17e", $num), "... "; + $num2 = unserialize(serialize($num)); + $repr = unpack("H*", pack("d", $num2)); $repr = reset($repr); + if ($repr == $ns) + echo "OK\n"; + else + echo "mismatch\n\twas: $ns\n\tbecame: $repr\n"; } --EXPECT-- number: 0.00000000000000000e+0... OK diff --git a/ext/standard/tests/serialize/serialization_arrays_002.phpt b/ext/standard/tests/serialize/serialization_arrays_002.phpt index 9fbf8d4ee7..67ad5b5daa 100644 --- a/ext/standard/tests/serialize/serialization_arrays_002.phpt +++ b/ext/standard/tests/serialize/serialization_arrays_002.phpt @@ -14,18 +14,18 @@ serialization: arrays with references amongst elements */ function check(&$a) { - var_dump($a); - $ser = serialize($a); - var_dump($ser); + var_dump($a); + $ser = serialize($a); + var_dump($ser); - $b = unserialize($ser); - var_dump($b); - $b[0] = "b0.changed"; - var_dump($b); - $b[1] = "b1.changed"; - var_dump($b); - $b[2] = "b2.changed"; - var_dump($b); + $b = unserialize($ser); + var_dump($b); + $b[0] = "b0.changed"; + var_dump($b); + $b[1] = "b1.changed"; + var_dump($b); + $b[2] = "b2.changed"; + var_dump($b); } echo "\n\n--- No references:\n"; diff --git a/ext/standard/tests/serialize/serialization_arrays_003.phpt b/ext/standard/tests/serialize/serialization_arrays_003.phpt index 18238d7b1e..8444f812a5 100644 --- a/ext/standard/tests/serialize/serialization_arrays_003.phpt +++ b/ext/standard/tests/serialize/serialization_arrays_003.phpt @@ -14,18 +14,18 @@ serialization: arrays with references to an external variable */ function check(&$a) { - var_dump($a); - $ser = serialize($a); - var_dump($ser); + var_dump($a); + $ser = serialize($a); + var_dump($ser); - $b = unserialize($ser); - var_dump($b); - $b[0] = "b0.changed"; - var_dump($b); - $b[1] = "b1.changed"; - var_dump($b); - $b[2] = "b2.changed"; - var_dump($b); + $b = unserialize($ser); + var_dump($b); + $b[0] = "b0.changed"; + var_dump($b); + $b[1] = "b1.changed"; + var_dump($b); + $b[2] = "b2.changed"; + var_dump($b); } echo "\n\n--- 0 refs external:\n"; diff --git a/ext/standard/tests/serialize/serialization_arrays_004.phpt b/ext/standard/tests/serialize/serialization_arrays_004.phpt index a6209688ea..e2e383ef82 100644 --- a/ext/standard/tests/serialize/serialization_arrays_004.phpt +++ b/ext/standard/tests/serialize/serialization_arrays_004.phpt @@ -14,18 +14,18 @@ serialization: arrays with references to the containing array */ function check(&$a) { - var_dump($a); - $ser = serialize($a); - var_dump($ser); + var_dump($a); + $ser = serialize($a); + var_dump($ser); - $b = unserialize($ser); - var_dump($b); - $b[0] = "b0.changed"; - var_dump($b); - $b[1] = "b1.changed"; - var_dump($b); - $b[2] = "b2.changed"; - var_dump($b); + $b = unserialize($ser); + var_dump($b); + $b[0] = "b0.changed"; + var_dump($b); + $b[1] = "b1.changed"; + var_dump($b); + $b[2] = "b2.changed"; + var_dump($b); } echo "\n\n--- 1 refs container:\n"; diff --git a/ext/standard/tests/serialize/serialization_arrays_005.phpt b/ext/standard/tests/serialize/serialization_arrays_005.phpt index 9d3bbcabea..b1f300b308 100644 --- a/ext/standard/tests/serialize/serialization_arrays_005.phpt +++ b/ext/standard/tests/serialize/serialization_arrays_005.phpt @@ -14,24 +14,24 @@ serialization: arrays with references, nested */ function check(&$a) { - var_dump($a); - $ser = serialize($a); - var_dump($ser); + var_dump($a); + $ser = serialize($a); + var_dump($ser); - $b = unserialize($ser); + $b = unserialize($ser); - // Change each element and dump result. - foreach($b as $k=>$v) { - if (is_array($v)){ - foreach($b[$k] as $sk=>$sv) { - $b[$k][$sk] = "b$k.$sk.changed"; - var_dump($b); - } - } else { - $b[$k] = "b$k.changed"; - var_dump($b); - } - } + // Change each element and dump result. + foreach($b as $k=>$v) { + if (is_array($v)){ + foreach($b[$k] as $sk=>$sv) { + $b[$k][$sk] = "b$k.$sk.changed"; + var_dump($b); + } + } else { + $b[$k] = "b$k.changed"; + var_dump($b); + } + } } echo "\n\n--- Nested array references 1 element in containing array:\n"; diff --git a/ext/standard/tests/serialize/serialization_objects_007.phpt b/ext/standard/tests/serialize/serialization_objects_007.phpt index ff584a0919..5082b7ff01 100644 --- a/ext/standard/tests/serialize/serialization_objects_007.phpt +++ b/ext/standard/tests/serialize/serialization_objects_007.phpt @@ -14,13 +14,13 @@ Ensure __autoload is called twice if unserialize_callback_func is defined. */ spl_autoload_register(function ($name) { - echo "in autoload($name)\n"; + echo "in autoload($name)\n"; }); ini_set('unserialize_callback_func','check'); function check($name) { - echo "in check($name)\n"; + echo "in check($name)\n"; } $o = unserialize('O:3:"FOO":0:{}'); diff --git a/ext/standard/tests/serialize/serialization_objects_010.phpt b/ext/standard/tests/serialize/serialization_objects_010.phpt index 32205209f7..51938710cd 100644 --- a/ext/standard/tests/serialize/serialization_objects_010.phpt +++ b/ext/standard/tests/serialize/serialization_objects_010.phpt @@ -14,18 +14,18 @@ Serialize() must return a string or NULL */ Class C implements Serializable { - public function serialize() { - return $this; - } + public function serialize() { + return $this; + } - public function unserialize($blah) { - } + public function unserialize($blah) { + } } try { - var_dump(serialize(new C)); + var_dump(serialize(new C)); } catch (Exception $e) { - echo $e->getMessage(). "\n"; + echo $e->getMessage(). "\n"; } echo "Done"; diff --git a/ext/standard/tests/serialize/serialization_objects_011.phpt b/ext/standard/tests/serialize/serialization_objects_011.phpt index a224a13d0c..9f360c2cb9 100644 --- a/ext/standard/tests/serialize/serialization_objects_011.phpt +++ b/ext/standard/tests/serialize/serialization_objects_011.phpt @@ -14,57 +14,57 @@ Object serialization / unserialization with inherited and hidden properties. */ Class A { - private $APriv = "A.APriv"; - protected $AProt = "A.AProt"; - public $APub = "A.APub"; + private $APriv = "A.APriv"; + protected $AProt = "A.AProt"; + public $APub = "A.APub"; - function audit() { - return isset($this->APriv, $this->AProt, $this->APub); - } + function audit() { + return isset($this->APriv, $this->AProt, $this->APub); + } } Class B extends A { - private $BPriv = "B.BPriv"; - protected $BProt = "B.BProt"; - public $BPub = "B.BPub"; - - function audit() { - return parent::audit() && isset($this->AProt, $this->APub, - $this->BPriv, $this->BProt, $this->BPub); - } + private $BPriv = "B.BPriv"; + protected $BProt = "B.BProt"; + public $BPub = "B.BPub"; + + function audit() { + return parent::audit() && isset($this->AProt, $this->APub, + $this->BPriv, $this->BProt, $this->BPub); + } } Class C extends B { - private $APriv = "C.APriv"; - protected $AProt = "C.AProt"; - public $APub = "C.APub"; - - private $CPriv = "C.CPriv"; - protected $CProt = "C.BProt"; - public $CPub = "C.CPub"; - - function audit() { - return parent::audit() && isset($this->APriv, $this->AProt, $this->APub, - $this->BProt, $this->BPub, - $this->CPriv, $this->CProt, $this->CPub); - } + private $APriv = "C.APriv"; + protected $AProt = "C.AProt"; + public $APub = "C.APub"; + + private $CPriv = "C.CPriv"; + protected $CProt = "C.BProt"; + public $CPub = "C.CPub"; + + function audit() { + return parent::audit() && isset($this->APriv, $this->AProt, $this->APub, + $this->BProt, $this->BPub, + $this->CPriv, $this->CProt, $this->CPub); + } } function prettyPrint($obj) { - echo "\n\nBefore serialization:\n"; - var_dump($obj); + echo "\n\nBefore serialization:\n"; + var_dump($obj); - echo "Serialized form:\n"; - $ser = serialize($obj); - $serPrintable = str_replace("\0", '\0', $ser); - var_dump($serPrintable); + echo "Serialized form:\n"; + $ser = serialize($obj); + $serPrintable = str_replace("\0", '\0', $ser); + var_dump($serPrintable); - echo "Unserialized:\n"; - $uobj = unserialize($ser); - var_dump($uobj); + echo "Unserialized:\n"; + $uobj = unserialize($ser); + var_dump($uobj); - echo "Sanity check: "; - var_dump($uobj->audit()); + echo "Sanity check: "; + var_dump($uobj->audit()); } echo "-- Test instance of A --\n"; diff --git a/ext/standard/tests/serialize/serialization_objects_013.phpt b/ext/standard/tests/serialize/serialization_objects_013.phpt index 3ff2d3cc11..547d7f75e8 100644 --- a/ext/standard/tests/serialize/serialization_objects_013.phpt +++ b/ext/standard/tests/serialize/serialization_objects_013.phpt @@ -14,18 +14,18 @@ Object serialization / unserialization: references amongst properties */ function check(&$obj) { - var_dump($obj); - $ser = serialize($obj); - var_dump($ser); + var_dump($obj); + $ser = serialize($obj); + var_dump($ser); - $uobj = unserialize($ser); - var_dump($uobj); - $uobj->a = "obj->a.changed"; - var_dump($uobj); - $uobj->b = "obj->b.changed"; - var_dump($uobj); - $uobj->c = "obj->c.changed"; - var_dump($uobj); + $uobj = unserialize($ser); + var_dump($uobj); + $uobj->a = "obj->a.changed"; + var_dump($uobj); + $uobj->b = "obj->b.changed"; + var_dump($uobj); + $uobj->c = "obj->c.changed"; + var_dump($uobj); } echo "\n\n--- a refs b:\n"; diff --git a/ext/standard/tests/serialize/serialization_objects_014.phpt b/ext/standard/tests/serialize/serialization_objects_014.phpt index fa15a577b0..b8bf6fd3bc 100644 --- a/ext/standard/tests/serialize/serialization_objects_014.phpt +++ b/ext/standard/tests/serialize/serialization_objects_014.phpt @@ -14,18 +14,18 @@ Object serialization / unserialization: references to external values */ function check(&$obj) { - var_dump($obj); - $ser = serialize($obj); - var_dump($ser); + var_dump($obj); + $ser = serialize($obj); + var_dump($ser); - $uobj = unserialize($ser); - var_dump($uobj); - $uobj->a = "obj->a.changed"; - var_dump($uobj); - $uobj->b = "obj->b.changed"; - var_dump($uobj); - $uobj->c = "obj->c.changed"; - var_dump($uobj); + $uobj = unserialize($ser); + var_dump($uobj); + $uobj->a = "obj->a.changed"; + var_dump($uobj); + $uobj->b = "obj->b.changed"; + var_dump($uobj); + $uobj->c = "obj->c.changed"; + var_dump($uobj); } echo "\n\n--- a refs external:\n"; diff --git a/ext/standard/tests/serialize/serialization_objects_015.phpt b/ext/standard/tests/serialize/serialization_objects_015.phpt index c1a6675db4..522450bfc1 100644 --- a/ext/standard/tests/serialize/serialization_objects_015.phpt +++ b/ext/standard/tests/serialize/serialization_objects_015.phpt @@ -4,18 +4,18 @@ Object serialization / unserialization: properties reference containing object <?php function check(&$obj) { - var_dump($obj); - $ser = serialize($obj); - var_dump($ser); + var_dump($obj); + $ser = serialize($obj); + var_dump($ser); - $uobj = unserialize($ser); - var_dump($uobj); - $uobj->a = "obj->a.changed"; - var_dump($uobj); - $uobj->b = "obj->b.changed"; - var_dump($uobj); - $uobj->c = "obj->c.changed"; - var_dump($uobj); + $uobj = unserialize($ser); + var_dump($uobj); + $uobj->a = "obj->a.changed"; + var_dump($uobj); + $uobj->b = "obj->b.changed"; + var_dump($uobj); + $uobj->c = "obj->c.changed"; + var_dump($uobj); } echo "\n\n--- a refs container:\n"; diff --git a/ext/standard/tests/serialize/typed_property_refs.phpt b/ext/standard/tests/serialize/typed_property_refs.phpt index 72bad612b0..3c8096a392 100644 --- a/ext/standard/tests/serialize/typed_property_refs.phpt +++ b/ext/standard/tests/serialize/typed_property_refs.phpt @@ -4,18 +4,18 @@ unserialize with references to typed properties shall skip the references or fai <?php class A { - public int $a; - public $b; + public int $a; + public $b; } class B { - public $a; - public int $b; + public $a; + public int $b; } class C { - public int $a; - public string $b; + public int $a; + public string $b; } class D { diff --git a/ext/standard/tests/serialize/unserialize_mem_leak.phpt b/ext/standard/tests/serialize/unserialize_mem_leak.phpt index 2a295d83b9..ad010df535 100644 --- a/ext/standard/tests/serialize/unserialize_mem_leak.phpt +++ b/ext/standard/tests/serialize/unserialize_mem_leak.phpt @@ -5,7 +5,7 @@ report_memleaks=1 --FILE-- <?php function foo() { - gc_collect_cycles(); + gc_collect_cycles(); } $str = 'a:1:{i:0;R:1;}'; diff --git a/ext/standard/tests/streams/bug40459.phpt b/ext/standard/tests/streams/bug40459.phpt index 9dc501170a..437e44e3d7 100644 --- a/ext/standard/tests/streams/bug40459.phpt +++ b/ext/standard/tests/streams/bug40459.phpt @@ -6,53 +6,53 @@ allow_url_fopen=1 <?php // Test whether the constructor of the user-space stream wrapper is called when stream functions are called class testwrapper { - private $constructorCalled = false; - function __construct() { - $this->constructorCalled = true; - } - - function stream_open($path, $mode, $options, &$opened_path) - { - echo $this->constructorCalled ? 'yes' : 'no'; - return true; - } - - function url_stat($url, $flags) - { - echo $this->constructorCalled ? 'yes' : 'no'; - return array(); - } - - function unlink($url) - { - echo $this->constructorCalled ? 'yes' : 'no'; - } - - function rename($from, $to) - { - echo $this->constructorCalled ? 'yes' : 'no'; - } - - function mkdir($dir, $mode, $options) - { - echo $this->constructorCalled ? 'yes' : 'no'; - } - - function rmdir($dir, $options) - { - echo $this->constructorCalled ? 'yes' : 'no'; - } - - function dir_opendir($url, $options) - { - echo $this->constructorCalled ? 'yes' : 'no'; - return TRUE; - } - function stream_metadata() - { - echo $this->constructorCalled ? 'yes' : 'no'; - return TRUE; - } + private $constructorCalled = false; + function __construct() { + $this->constructorCalled = true; + } + + function stream_open($path, $mode, $options, &$opened_path) + { + echo $this->constructorCalled ? 'yes' : 'no'; + return true; + } + + function url_stat($url, $flags) + { + echo $this->constructorCalled ? 'yes' : 'no'; + return array(); + } + + function unlink($url) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function rename($from, $to) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function mkdir($dir, $mode, $options) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function rmdir($dir, $options) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function dir_opendir($url, $options) + { + echo $this->constructorCalled ? 'yes' : 'no'; + return TRUE; + } + function stream_metadata() + { + echo $this->constructorCalled ? 'yes' : 'no'; + return TRUE; + } } stream_wrapper_register('test', 'testwrapper', STREAM_IS_URL); diff --git a/ext/standard/tests/streams/bug44818.phpt b/ext/standard/tests/streams/bug44818.phpt index 0446dfd3be..2fe14bd0f1 100644 --- a/ext/standard/tests/streams/bug44818.phpt +++ b/ext/standard/tests/streams/bug44818.phpt @@ -3,11 +3,11 @@ Bug #44818 (php://memory writeable when opened read only) --FILE-- <?php function test($url, $mode) { - echo "$url, $mode\n"; - $fd = fopen($url, $mode); - var_dump($fd, fwrite($fd, "foo")); - var_dump(fseek($fd, 0, SEEK_SET), fread($fd, 3)); - fclose($fd); + echo "$url, $mode\n"; + $fd = fopen($url, $mode); + var_dump($fd, fwrite($fd, "foo")); + var_dump(fseek($fd, 0, SEEK_SET), fread($fd, 3)); + fclose($fd); } test("php://memory","r"); test("php://memory","r+"); diff --git a/ext/standard/tests/streams/bug46024.phpt b/ext/standard/tests/streams/bug46024.phpt index 4fb0eee402..145e66c1bd 100644 --- a/ext/standard/tests/streams/bug46024.phpt +++ b/ext/standard/tests/streams/bug46024.phpt @@ -7,13 +7,13 @@ Bug #46024 stream_select() doesn't return the correct number $php = realpath(getenv('TEST_PHP_EXECUTABLE')); $pipes = array(); $proc = proc_open( - "$php -n -i" - ,array(0 => array('pipe', 'r'), 1 => array('pipe', 'w')) - ,$pipes, __DIR__, array(), array() + "$php -n -i" + ,array(0 => array('pipe', 'r'), 1 => array('pipe', 'w')) + ,$pipes, __DIR__, array(), array() ); var_dump($proc); if (!$proc) { - exit(1); + exit(1); } $r = array($pipes[1]); $w = array($pipes[0]); @@ -30,13 +30,13 @@ var_dump($ret === (count($r) + count($w))); foreach($pipes as $pipe) { - fclose($pipe); + fclose($pipe); } proc_terminate($proc); if (defined('SIGKILL')) { - proc_terminate($proc, SIGKILL); + proc_terminate($proc, SIGKILL); } else { - proc_terminate($proc); + proc_terminate($proc); } proc_close($proc); ?> diff --git a/ext/standard/tests/streams/bug53903.phpt b/ext/standard/tests/streams/bug53903.phpt index ca04a5ca14..d4c3586dd9 100644 --- a/ext/standard/tests/streams/bug53903.phpt +++ b/ext/standard/tests/streams/bug53903.phpt @@ -9,11 +9,11 @@ class sw { return true; } - public function stream_stat() { - return array( + public function stream_stat() { + return array( 'atime' => $this->undefined, ); - } + } } stream_wrapper_register('sx', 'sw') or die('failed'); diff --git a/ext/standard/tests/streams/bug60455_01.phpt b/ext/standard/tests/streams/bug60455_01.phpt index 466998201a..453be553c3 100644 --- a/ext/standard/tests/streams/bug60455_01.phpt +++ b/ext/standard/tests/streams/bug60455_01.phpt @@ -8,7 +8,7 @@ Bug #60455: stream_get_line and 1-line noeol input $domain = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' ? STREAM_PF_INET : STREAM_PF_UNIX); $sockets = stream_socket_pair($domain, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP) - or die("stream_socket_pair"); + or die("stream_socket_pair"); fwrite($sockets[0], "a"); stream_socket_shutdown($sockets[0], STREAM_SHUT_RDWR); diff --git a/ext/standard/tests/streams/bug60455_02.phpt b/ext/standard/tests/streams/bug60455_02.phpt index c68a1a07ab..632b12085c 100644 --- a/ext/standard/tests/streams/bug60455_02.phpt +++ b/ext/standard/tests/streams/bug60455_02.phpt @@ -3,19 +3,19 @@ Bug #60455: stream_get_line and 1-line followed by eol input --FILE-- <?php class TestStream { - private $s = 0; - function stream_open($path, $mode, $options, &$opened_path) { - return true; - } - function stream_read($count) { - if ($this->s++ == 0) - return "a\n"; + private $s = 0; + function stream_open($path, $mode, $options, &$opened_path) { + return true; + } + function stream_read($count) { + if ($this->s++ == 0) + return "a\n"; - return ""; - } - function stream_eof() { - return $this->s >= 2; - } + return ""; + } + function stream_eof() { + return $this->s >= 2; + } } diff --git a/ext/standard/tests/streams/bug60455_03.phpt b/ext/standard/tests/streams/bug60455_03.phpt index 4cfc373408..d0a48ea780 100644 --- a/ext/standard/tests/streams/bug60455_03.phpt +++ b/ext/standard/tests/streams/bug60455_03.phpt @@ -3,25 +3,25 @@ Bug #60455: stream_get_line and 2 lines, one possibly empty --FILE-- <?php class TestStream { - private $lines = array(); - private $s = 0; - private $eofth = 3; - function stream_open($path, $mode, $options, &$opened_path) { - $this->lines[] = "a\n"; - $this->lines[] = ($path == "test://nonempty2nd" ? "b\n" : "\n"); - if ($path == "test://eofafter2nd") - $this->eofth = 2; - return true; - } - function stream_read($count) { - if (key_exists($this->s++, $this->lines)) - return $this->lines[$this->s - 1]; + private $lines = array(); + private $s = 0; + private $eofth = 3; + function stream_open($path, $mode, $options, &$opened_path) { + $this->lines[] = "a\n"; + $this->lines[] = ($path == "test://nonempty2nd" ? "b\n" : "\n"); + if ($path == "test://eofafter2nd") + $this->eofth = 2; + return true; + } + function stream_read($count) { + if (key_exists($this->s++, $this->lines)) + return $this->lines[$this->s - 1]; - return ""; - } - function stream_eof() { - return $this->s >= $this->eofth; - } + return ""; + } + function stream_eof() { + return $this->s >= $this->eofth; + } } diff --git a/ext/standard/tests/streams/bug60455_04.phpt b/ext/standard/tests/streams/bug60455_04.phpt index 123a8653d3..73d2aadf53 100644 --- a/ext/standard/tests/streams/bug60455_04.phpt +++ b/ext/standard/tests/streams/bug60455_04.phpt @@ -4,19 +4,19 @@ read with EOL indication --FILE-- <?php class TestStream { - private $s = 0; - function stream_open($path, $mode, $options, &$opened_path) { - return true; - } - function stream_read($count) { - if ($this->s++ == 0) - return "a\n"; + private $s = 0; + function stream_open($path, $mode, $options, &$opened_path) { + return true; + } + function stream_read($count) { + if ($this->s++ == 0) + return "a\n"; - return ""; - } - function stream_eof() { - return $this->s >= 2; - } + return ""; + } + function stream_eof() { + return $this->s >= 2; + } } diff --git a/ext/standard/tests/streams/bug60602.phpt b/ext/standard/tests/streams/bug60602.phpt index 396695f772..b97f6f877a 100644 --- a/ext/standard/tests/streams/bug60602.phpt +++ b/ext/standard/tests/streams/bug60602.phpt @@ -4,9 +4,9 @@ Bug #60602 proc_open() modifies environment if it contains arrays <?php $descs = array( - 0 => array('pipe', 'r'), // stdin - 1 => array('pipe', 'w'), // stdout - 2 => array('pipe', 'w'), // strerr + 0 => array('pipe', 'r'), // stdin + 1 => array('pipe', 'w'), // stdout + 2 => array('pipe', 'w'), // strerr ); $environment = array('test' => array(1, 2, 3)); @@ -15,35 +15,35 @@ $cmd = (substr(PHP_OS, 0, 3) == 'WIN') ? 'dir' : 'ls'; $p = proc_open($cmd, $descs, $pipes, '.', $environment); if (is_resource($p)) { - $data = ''; + $data = ''; - while (1) { - $w = $e = NULL; - $n = stream_select($pipes, $w, $e, 300); + while (1) { + $w = $e = NULL; + $n = stream_select($pipes, $w, $e, 300); - if ($n === false) { - echo "no streams \n"; - break; - } else if ($n === 0) { - echo "process timed out\n"; - proc_terminate($p, 9); - break; - } else if ($n > 0) { - $line = fread($pipes[1], 8192); - if (strlen($line) == 0) { - /* EOF */ - break; - } - $data .= $line; - } - } - var_dump(strlen($data)); + if ($n === false) { + echo "no streams \n"; + break; + } else if ($n === 0) { + echo "process timed out\n"; + proc_terminate($p, 9); + break; + } else if ($n > 0) { + $line = fread($pipes[1], 8192); + if (strlen($line) == 0) { + /* EOF */ + break; + } + $data .= $line; + } + } + var_dump(strlen($data)); - $ret = proc_close($p); - var_dump($ret); - var_dump(is_array($environment['test'])); + $ret = proc_close($p); + var_dump($ret); + var_dump(is_array($environment['test'])); } else { - echo "no process\n"; + echo "no process\n"; } ?> --EXPECTF-- diff --git a/ext/standard/tests/streams/bug61019.phpt b/ext/standard/tests/streams/bug61019.phpt index db0bf9d6a5..929de1c2af 100644 --- a/ext/standard/tests/streams/bug61019.phpt +++ b/ext/standard/tests/streams/bug61019.phpt @@ -6,65 +6,65 @@ Bug #61019 (Out of memory on command stream_get_contents) echo "Test\n"; $descriptorspec = array( - 0 => array("pipe", "r"), // stdin is a pipe that the child will read from - 1 => array("pipe", "w"), // stdout is a pipe that the child will write to - 2 => array("pipe", "w") // stderr is a pipe that the child will write to + 0 => array("pipe", "r"), // stdin is a pipe that the child will read from + 1 => array("pipe", "w"), // stdout is a pipe that the child will write to + 2 => array("pipe", "w") // stderr is a pipe that the child will write to ); $process=proc_open("echo testtext",$descriptorspec,$pipes); if(is_resource($process)) { - stream_set_blocking($pipes[0],false); - stream_set_blocking($pipes[1],false); - stream_set_blocking($pipes[2],false); - stream_set_write_buffer($pipes[0],0); - stream_set_read_buffer($pipes[1],0); - stream_set_read_buffer($pipes[2],0); - $stdin_stream=""; - $stderr_stream=""; + stream_set_blocking($pipes[0],false); + stream_set_blocking($pipes[1],false); + stream_set_blocking($pipes[2],false); + stream_set_write_buffer($pipes[0],0); + stream_set_read_buffer($pipes[1],0); + stream_set_read_buffer($pipes[2],0); + $stdin_stream=""; + $stderr_stream=""; - echo "External command executed\n"; - do - { - $process_state=proc_get_status($process); - $tmp_stdin=stream_get_contents($pipes[1]); - if($tmp_stdin) - { - $stdin_stream=$stdin_stream.$tmp_stdin; - } - $tmp_stderr=stream_get_contents($pipes[2]); - if($tmp_stderr) - { - $stderr_stream=$stderr_stream.$tmp_stderr; - } - } while($process_state['running']); + echo "External command executed\n"; + do + { + $process_state=proc_get_status($process); + $tmp_stdin=stream_get_contents($pipes[1]); + if($tmp_stdin) + { + $stdin_stream=$stdin_stream.$tmp_stdin; + } + $tmp_stderr=stream_get_contents($pipes[2]); + if($tmp_stderr) + { + $stderr_stream=$stderr_stream.$tmp_stderr; + } + } while($process_state['running']); - echo "External command exit: ".$process_state['exitcode']."\n"; + echo "External command exit: ".$process_state['exitcode']."\n"; - //read outstanding data - $tmp_stdin=stream_get_contents($pipes[1]); - if($tmp_stdin) - { - $stdin_stream=$stdin_stream.$tmp_stdin; - } - $tmp_stderr=stream_get_contents($pipes[2]); - if($tmp_stderr) - { - $stderr_stream=$stderr_stream.$tmp_stderr; - } + //read outstanding data + $tmp_stdin=stream_get_contents($pipes[1]); + if($tmp_stdin) + { + $stdin_stream=$stdin_stream.$tmp_stdin; + } + $tmp_stderr=stream_get_contents($pipes[2]); + if($tmp_stderr) + { + $stderr_stream=$stderr_stream.$tmp_stderr; + } - fclose ($pipes[0]); - fclose ($pipes[1]); - fclose ($pipes[2]); + fclose ($pipes[0]); + fclose ($pipes[1]); + fclose ($pipes[2]); - proc_close($process); + proc_close($process); - echo "STDOUT: ".$stdin_stream."\n"; - echo "STDERR: ".$stderr_stream."\n"; + echo "STDOUT: ".$stdin_stream."\n"; + echo "STDERR: ".$stderr_stream."\n"; } else { - echo "Can't start external command\n"; + echo "Can't start external command\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/streams/bug61371-unix.phpt b/ext/standard/tests/streams/bug61371-unix.phpt index 7c64d1d30f..20361095f6 100644 --- a/ext/standard/tests/streams/bug61371-unix.phpt +++ b/ext/standard/tests/streams/bug61371-unix.phpt @@ -11,21 +11,21 @@ function test($doFclose) { $previous = null; $current = null; for($test=1;$test<=3;$test++) { - $current = memory_get_usage(true); - if (!is_null($previous)) { - var_dump($previous == $current); - } - $previous = $current; - echo 'memory: '.round($current / 1024, 0)."kb\n"; - for($i=0;$i<=100;$i++) { - $context = stream_context_create(array()); - $stream = stream_socket_client('udp://0.0.0.0:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context); - if ($doFclose) fclose($stream); - unset($context); - unset($stream); - unset($errno); - unset($errstr); - } + $current = memory_get_usage(true); + if (!is_null($previous)) { + var_dump($previous == $current); + } + $previous = $current; + echo 'memory: '.round($current / 1024, 0)."kb\n"; + for($i=0;$i<=100;$i++) { + $context = stream_context_create(array()); + $stream = stream_socket_client('udp://0.0.0.0:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context); + if ($doFclose) fclose($stream); + unset($context); + unset($stream); + unset($errno); + unset($errstr); + } } } diff --git a/ext/standard/tests/streams/bug61371.phpt b/ext/standard/tests/streams/bug61371.phpt index 924219f896..00e6372e85 100644 --- a/ext/standard/tests/streams/bug61371.phpt +++ b/ext/standard/tests/streams/bug61371.phpt @@ -6,21 +6,21 @@ function test($doFclose) { $previous = null; $current = null; for($test=1;$test<=3;$test++) { - $current = memory_get_usage(true); - if (!is_null($previous)) { - var_dump($previous == $current); - } - $previous = $current; - echo 'memory: '.round($current / 1024, 0)."kb\n"; - for($i=0;$i<=100;$i++) { - $context = stream_context_create(array()); - $stream = stream_socket_client('udp://127.0.0.1:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context); - if ($doFclose) fclose($stream); - unset($context); - unset($stream); - unset($errno); - unset($errstr); - } + $current = memory_get_usage(true); + if (!is_null($previous)) { + var_dump($previous == $current); + } + $previous = $current; + echo 'memory: '.round($current / 1024, 0)."kb\n"; + for($i=0;$i<=100;$i++) { + $context = stream_context_create(array()); + $stream = stream_socket_client('udp://127.0.0.1:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context); + if ($doFclose) fclose($stream); + unset($context); + unset($stream); + unset($errno); + unset($errstr); + } } } diff --git a/ext/standard/tests/streams/bug64166.phpt b/ext/standard/tests/streams/bug64166.phpt index e725a4b698..f03d9c15ac 100644 --- a/ext/standard/tests/streams/bug64166.phpt +++ b/ext/standard/tests/streams/bug64166.phpt @@ -9,8 +9,8 @@ function test_64166($data) { rewind($fd); $res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array( - 'line-break-chars' => "\n", - 'line-length' => 74 + 'line-break-chars' => "\n", + 'line-length' => 74 )); var_dump(stream_get_contents($fd, -1, 0)); @@ -18,8 +18,8 @@ function test_64166($data) { rewind($fd); stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array( - 'line-break-chars' => "\n", - 'line-length' => 6 + 'line-break-chars' => "\n", + 'line-length' => 6 )); var_dump(stream_get_contents($fd, -1, 0)); diff --git a/ext/standard/tests/streams/bug64166_2.phpt b/ext/standard/tests/streams/bug64166_2.phpt index b4224662ee..3321978bba 100644 --- a/ext/standard/tests/streams/bug64166_2.phpt +++ b/ext/standard/tests/streams/bug64166_2.phpt @@ -9,8 +9,8 @@ function test_64166($data) { rewind($fd); $res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array( - 'line-break-chars' => "\n", - 'line-length' => 74 + 'line-break-chars' => "\n", + 'line-length' => 74 )); $str = ""; while(($c = fread($fd, 1))!= "") $str .= $c; @@ -20,8 +20,8 @@ function test_64166($data) { rewind($fd); stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array( - 'line-break-chars' => "\n", - 'line-length' => 6 + 'line-break-chars' => "\n", + 'line-length' => 6 )); $str = ""; while(($c = fread($fd, 1))!= "") $str .= $c; diff --git a/ext/standard/tests/streams/bug64166_3.phpt b/ext/standard/tests/streams/bug64166_3.phpt index d896ba800c..5cc0077f79 100644 --- a/ext/standard/tests/streams/bug64166_3.phpt +++ b/ext/standard/tests/streams/bug64166_3.phpt @@ -6,8 +6,8 @@ Bug #64166: quoted-printable-encode stream filter incorrectly discarding whitesp function test_64166($data) { $fd = fopen('php://temp', 'w+'); $res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_WRITE, array( - 'line-break-chars' => "\n", - 'line-length' => 74 + 'line-break-chars' => "\n", + 'line-length' => 74 )); fwrite($fd, $data); rewind($fd); @@ -18,8 +18,8 @@ function test_64166($data) { rewind($fd); stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_WRITE, array( - 'line-break-chars' => "\n", - 'line-length' => 6 + 'line-break-chars' => "\n", + 'line-length' => 6 )); fwrite($fd, $data); rewind($fd); diff --git a/ext/standard/tests/streams/bug64433.phpt b/ext/standard/tests/streams/bug64433.phpt index bb22edee55..d1100c5713 100644 --- a/ext/standard/tests/streams/bug64433.phpt +++ b/ext/standard/tests/streams/bug64433.phpt @@ -20,7 +20,7 @@ echo file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php"); echo "default\n"; $codes = array(200, 201, 204, 301, 302, 303, 304, 305, 307, 404, 500); foreach($codes as $code) { - echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1"); + echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1"); } echo "follow=0\n"; $arr = array('http'=> @@ -30,7 +30,7 @@ $arr = array('http'=> ); $context = stream_context_create($arr); foreach($codes as $code) { - echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1", false, $context); + echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1", false, $context); } echo "follow=1\n"; $arr = array('http'=> @@ -40,7 +40,7 @@ $arr = array('http'=> ); $context = stream_context_create($arr); foreach($codes as $code) { - echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1", false, $context); + echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1", false, $context); } --EXPECT-- HELLO! diff --git a/ext/standard/tests/streams/bug64433_srv.inc b/ext/standard/tests/streams/bug64433_srv.inc index dcdb1bcbaa..035343369c 100644 --- a/ext/standard/tests/streams/bug64433_srv.inc +++ b/ext/standard/tests/streams/bug64433_srv.inc @@ -1,14 +1,14 @@ if(!empty($_REQUEST["redir"])) { - echo "REDIRECTED\n"; - return; + echo "REDIRECTED\n"; + return; } if(!empty($_REQUEST["loc"])) { - header("Location: index.php?redir=1"); + header("Location: index.php?redir=1"); } if(!empty($_REQUEST["status"])) { - http_response_code($_REQUEST["status"]); + http_response_code($_REQUEST["status"]); } echo "HELLO!\n"; diff --git a/ext/standard/tests/streams/bug64770.phpt b/ext/standard/tests/streams/bug64770.phpt index df25d3f8ca..ba39bb5f84 100644 --- a/ext/standard/tests/streams/bug64770.phpt +++ b/ext/standard/tests/streams/bug64770.phpt @@ -4,9 +4,9 @@ Bug #64770 stream_select() fails with pipes from proc_open() <?php $descs = array( - 0 => array('pipe', 'r'), // stdin - 1 => array('pipe', 'w'), // stdout - 2 => array('pipe', 'w'), // strerr + 0 => array('pipe', 'r'), // stdin + 1 => array('pipe', 'w'), // stdout + 2 => array('pipe', 'w'), // strerr ); $other_opts = array('suppress_errors' => false); @@ -15,34 +15,34 @@ $cmd = (substr(PHP_OS, 0, 3) == 'WIN') ? 'dir' : 'ls'; $p = proc_open($cmd, $descs, $pipes, '.', NULL, $other_opts); if (is_resource($p)) { - $data = ''; + $data = ''; - while (1) { - $w = $e = NULL; - $n = stream_select($pipes, $w, $e, 300); + while (1) { + $w = $e = NULL; + $n = stream_select($pipes, $w, $e, 300); - if ($n === false) { - echo "no streams \n"; - break; - } else if ($n === 0) { - echo "process timed out\n"; - proc_terminate($p, 9); - break; - } else if ($n > 0) { - $line = fread($pipes[1], 8192); - if (strlen($line) == 0) { - /* EOF */ - break; - } - $data .= $line; - } - } - var_dump(strlen($data)); + if ($n === false) { + echo "no streams \n"; + break; + } else if ($n === 0) { + echo "process timed out\n"; + proc_terminate($p, 9); + break; + } else if ($n > 0) { + $line = fread($pipes[1], 8192); + if (strlen($line) == 0) { + /* EOF */ + break; + } + $data .= $line; + } + } + var_dump(strlen($data)); - $ret = proc_close($p); - var_dump($ret); + $ret = proc_close($p); + var_dump($ret); } else { - echo "no process\n"; + echo "no process\n"; } ?> --EXPECTF-- diff --git a/ext/standard/tests/streams/bug67626.phpt b/ext/standard/tests/streams/bug67626.phpt index 79aaed55cb..c251a40b92 100644 --- a/ext/standard/tests/streams/bug67626.phpt +++ b/ext/standard/tests/streams/bug67626.phpt @@ -4,24 +4,24 @@ Bug #67626: Exceptions not properly handled in user stream handlers <?php class MyStream { - public function stream_open() { return true; } + public function stream_open() { return true; } - public function stream_read() - { - throw new Exception('stream_read_exception'); - return 'read'; - } + public function stream_read() + { + throw new Exception('stream_read_exception'); + return 'read'; + } - public function stream_eof() - { - return true; - } + public function stream_eof() + { + return true; + } - public function stream_write() - { - throw new Exception('stream_write_exception'); - return 42; - } + public function stream_write() + { + throw new Exception('stream_write_exception'); + return 42; + } } stream_wrapper_register("my", "MyStream"); @@ -29,15 +29,15 @@ stream_wrapper_register("my", "MyStream"); $fp = fopen('my://foobar', 'r+'); try { - fread($fp, 42); + fread($fp, 42); } catch (Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } echo "\n"; try { - fwrite($fp, 'foobar'); + fwrite($fp, 'foobar'); } catch (Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(); } ?> --EXPECT-- diff --git a/ext/standard/tests/streams/bug69521.phpt b/ext/standard/tests/streams/bug69521.phpt index 75e1cdf99d..9ec244f799 100644 --- a/ext/standard/tests/streams/bug69521.phpt +++ b/ext/standard/tests/streams/bug69521.phpt @@ -19,15 +19,15 @@ fclose($link); while (!feof($fp)) { - $read = $write = array($fp); + $read = $write = array($fp); - if ($written === strlen($data)) - $write = array(); + if ($written === strlen($data)) + $write = array(); - $changed = stream_select($read, $write, $except, 0, 500000); + $changed = stream_select($read, $write, $except, 0, 500000); - if (!empty($read)) - echo fread($fp, 4); + if (!empty($read)) + echo fread($fp, 4); } ?> --EXPECT-- diff --git a/ext/standard/tests/streams/bug70198.phpt b/ext/standard/tests/streams/bug70198.phpt index 94585db882..fc9c30f6fe 100644 --- a/ext/standard/tests/streams/bug70198.phpt +++ b/ext/standard/tests/streams/bug70198.phpt @@ -10,9 +10,9 @@ server <?php /* What is checked here is - - start a server and listen - - as soon as client connects, close connection and exit - - on the client side - sleep(1) and check feof() + - start a server and listen + - as soon as client connects, close connection and exit + - on the client side - sleep(1) and check feof() */ $srv_addr = "tcp://127.0.0.1:8964"; @@ -22,15 +22,15 @@ $srv_fl_cont = <<<SRV \$socket = stream_socket_server('$srv_addr', \$errno, \$errstr); if (!\$socket) { - echo "\$errstr (\$errno)\\n"; + echo "\$errstr (\$errno)\\n"; } else { - if (\$conn = stream_socket_accept(\$socket, 3)) { - sleep(1); - /* just close the connection immediately after accepting, - the client side will need wait a bit longer to realize it.*/ - fclose(\$conn); - } - fclose(\$socket); + if (\$conn = stream_socket_accept(\$socket, 3)) { + sleep(1); + /* just close the connection immediately after accepting, + the client side will need wait a bit longer to realize it.*/ + fclose(\$conn); + } + fclose(\$socket); } SRV; file_put_contents($srv_fl, $srv_fl_cont); @@ -42,15 +42,15 @@ $i = 0; sleep(1); $fp = stream_socket_client($srv_addr, $errno, $errstr, 2); if (!$fp) { - echo "$errstr ($errno)\n"; + echo "$errstr ($errno)\n"; } else { - stream_set_blocking($fp, 0); - sleep(2); - while (!feof($fp)) { - ++$i; - } - fclose($fp); - var_dump($i); + stream_set_blocking($fp, 0); + sleep(2); + while (!feof($fp)) { + ++$i; + } + fclose($fp); + var_dump($i); } proc_close($srv_proc); diff --git a/ext/standard/tests/streams/bug71245.phpt b/ext/standard/tests/streams/bug71245.phpt index c9cad0c6d7..3dfda8d00a 100644 --- a/ext/standard/tests/streams/bug71245.phpt +++ b/ext/standard/tests/streams/bug71245.phpt @@ -4,15 +4,15 @@ Bug #71245 (file_get_contents() ignores "header" context option if it's a refere <?php $headers = ['Host: okey.com']; $httpContext = [ - 'http' => [ - 'protocol_version' => '1.1', - 'method' => 'GET', - 'header' => &$headers, - 'follow_location' => 0, - 'max_redirects' => 0, - 'ignore_errors' => true, - 'timeout' => 60, - ], + 'http' => [ + 'protocol_version' => '1.1', + 'method' => 'GET', + 'header' => &$headers, + 'follow_location' => 0, + 'max_redirects' => 0, + 'ignore_errors' => true, + 'timeout' => 60, + ], ]; $context = stream_context_create($httpContext); $headers = ["Host: bad.com"]; diff --git a/ext/standard/tests/streams/bug72853.phpt b/ext/standard/tests/streams/bug72853.phpt index 8de0264ac0..ab06f81e8c 100644 --- a/ext/standard/tests/streams/bug72853.phpt +++ b/ext/standard/tests/streams/bug72853.phpt @@ -10,8 +10,8 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) { <?php $descs = array( - 0 => array('pipe', 'r'), // stdin - 1 => array('pipe', 'w'), // stdout + 0 => array('pipe', 'r'), // stdin + 1 => array('pipe', 'w'), // stdout ); $p = proc_open("ls", $descs, $pipes, '.', NULL, NULL); diff --git a/ext/standard/tests/streams/bug72857.phpt b/ext/standard/tests/streams/bug72857.phpt index a74dff9c7e..f6addb1a63 100644 --- a/ext/standard/tests/streams/bug72857.phpt +++ b/ext/standard/tests/streams/bug72857.phpt @@ -2,16 +2,16 @@ Bug #72857 stream_socket_recvfrom read access violation --FILE-- <?php - $fname = __DIR__ . DIRECTORY_SEPARATOR . "stream_socket_recvfrom.tmp"; - $fp0 = fopen($fname, 'w'); - $v2=10; - $v3=STREAM_PEEK; - $v4="A"; + $fname = __DIR__ . DIRECTORY_SEPARATOR . "stream_socket_recvfrom.tmp"; + $fp0 = fopen($fname, 'w'); + $v2=10; + $v3=STREAM_PEEK; + $v4="A"; - var_dump(stream_socket_recvfrom($fp0,$v2,$v3,$v4), $v4); + var_dump(stream_socket_recvfrom($fp0,$v2,$v3,$v4), $v4); - fclose($fp0); - unlink($fname); + fclose($fp0); + unlink($fname); ?> --EXPECT-- bool(false) diff --git a/ext/standard/tests/streams/bug77664.phpt b/ext/standard/tests/streams/bug77664.phpt index ff2e317026..01722033b5 100644 --- a/ext/standard/tests/streams/bug77664.phpt +++ b/ext/standard/tests/streams/bug77664.phpt @@ -3,8 +3,8 @@ BUG #77664 (Segmentation fault when using undefined constant in custom wrapper) --FILE-- <?php class ErrorWrapper { - public $context; - public $var = self::INVALID; + public $context; + public $var = self::INVALID; } stream_wrapper_register('error',ErrorWrapper::class); file_get_contents('error://test'); diff --git a/ext/standard/tests/streams/bug78883.phpt b/ext/standard/tests/streams/bug78883.phpt index ed040e0044..7ce440a042 100644 --- a/ext/standard/tests/streams/bug78883.phpt +++ b/ext/standard/tests/streams/bug78883.phpt @@ -20,9 +20,9 @@ $pid = proc_get_status($proc)['pid']; sleep(3);
$bug_is_present = !proc_get_status($proc)['running'];
if (!$bug_is_present) {
- // if the bug is not present, it will hang waiting for stdin,
- // thus cmd is still running and we should kill it
- shell_exec("taskkill /T /F /PID {$pid} 2>nul");
+ // if the bug is not present, it will hang waiting for stdin,
+ // thus cmd is still running and we should kill it
+ shell_exec("taskkill /T /F /PID {$pid} 2>nul");
}
fclose($pipes[0]);
fclose($pipes[1]);
diff --git a/ext/standard/tests/streams/proc_open_bug51800.phpt b/ext/standard/tests/streams/proc_open_bug51800.phpt index d54ba00262..7cf502edd8 100644 --- a/ext/standard/tests/streams/proc_open_bug51800.phpt +++ b/ext/standard/tests/streams/proc_open_bug51800.phpt @@ -47,7 +47,7 @@ exit(0); '); if (!$r) { - die("couldn't create helper script '$callee'"); + die("couldn't create helper script '$callee'"); } $process = proc_open($cmd, $descriptors, $pipes); @@ -56,13 +56,13 @@ if (is_resource($process)) { fclose($pipes[0]); - while (!feof($pipes[1])) - $stdout .= fread($pipes[1], 1024); - fclose($pipes[1]); + while (!feof($pipes[1])) + $stdout .= fread($pipes[1], 1024); + fclose($pipes[1]); - while (!feof($pipes[2])) - $stderr .= fread($pipes[2], 1024); - fclose($pipes[2]); + while (!feof($pipes[2])) + $stderr .= fread($pipes[2], 1024); + fclose($pipes[2]); $status = proc_close($process); } diff --git a/ext/standard/tests/streams/proc_open_bug51800_right.phpt b/ext/standard/tests/streams/proc_open_bug51800_right.phpt index 12871cc1d3..c9e517cc65 100644 --- a/ext/standard/tests/streams/proc_open_bug51800_right.phpt +++ b/ext/standard/tests/streams/proc_open_bug51800_right.phpt @@ -31,7 +31,7 @@ exit(0); '); if (!$r) { - die("couldn't create helper script '$callee'"); + die("couldn't create helper script '$callee'"); } $process = proc_open($cmd, $descriptors, $pipes); diff --git a/ext/standard/tests/streams/proc_open_bug51800_right2.phpt b/ext/standard/tests/streams/proc_open_bug51800_right2.phpt index 1a2f69adbb..71b2fcc71a 100644 --- a/ext/standard/tests/streams/proc_open_bug51800_right2.phpt +++ b/ext/standard/tests/streams/proc_open_bug51800_right2.phpt @@ -27,17 +27,17 @@ $i0 = $i1 = 0; $step = 1024; while ($i0 < strlen($data0) && $i1 < strlen($data1)) { - fwrite(STDOUT, substr($data0, $i0, $step)); - fwrite(STDERR, substr($data1, $i1, $step)); - $i0 += $step; - $i1 += $step; + fwrite(STDOUT, substr($data0, $i0, $step)); + fwrite(STDERR, substr($data1, $i1, $step)); + $i0 += $step; + $i1 += $step; } exit(0); '); if (!$r) { - die("couldn't create helper script '$callee'"); + die("couldn't create helper script '$callee'"); } $process = proc_open($cmd, $descriptors, $pipes); diff --git a/ext/standard/tests/streams/proc_open_bug60120.phpt b/ext/standard/tests/streams/proc_open_bug60120.phpt index 053de2ebe0..9cce5a4c94 100644 --- a/ext/standard/tests/streams/proc_open_bug60120.phpt +++ b/ext/standard/tests/streams/proc_open_bug60120.phpt @@ -32,14 +32,14 @@ $process = proc_open( getcwd(), [], [ - 'suppress_errors' => true, + 'suppress_errors' => true, 'bypass_shell' => false ] ); if (!is_resource($process)) { die(sprintf( - "could not open process \"%s\"", + "could not open process \"%s\"", $command)); } diff --git a/ext/standard/tests/streams/proc_open_bug64438.phpt b/ext/standard/tests/streams/proc_open_bug64438.phpt index c310775a4d..8e4320cae9 100644 --- a/ext/standard/tests/streams/proc_open_bug64438.phpt +++ b/ext/standard/tests/streams/proc_open_bug64438.phpt @@ -6,9 +6,9 @@ Bug #64438 proc_open hangs with stdin/out with 4097+ bytes error_reporting(E_ALL); if (substr(PHP_OS, 0, 3) == 'WIN') { - $cmd = PHP_BINARY . ' -n -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"'; + $cmd = PHP_BINARY . ' -n -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"'; } else { - $cmd = PHP_BINARY . ' -n -r \'fwrite(STDOUT, $in = file_get_contents("php://stdin")); fwrite(STDERR, $in);\''; + $cmd = PHP_BINARY . ' -n -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('*', 4097); diff --git a/ext/standard/tests/streams/proc_open_bug69900.phpt b/ext/standard/tests/streams/proc_open_bug69900.phpt index e4d18b1cf8..de13d1bfdd 100644 --- a/ext/standard/tests/streams/proc_open_bug69900.phpt +++ b/ext/standard/tests/streams/proc_open_bug69900.phpt @@ -14,7 +14,7 @@ $in = fopen("php://stdin", "rb", false, stream_context_create(array("pipe" => ar while(!feof($in)){ $s = fgets($in); - fwrite(STDOUT, $s); + fwrite(STDOUT, $s); } ?>'; @@ -27,19 +27,19 @@ $process = proc_open(PHP_BINARY.' -n -f ' . $fl, $descriptorspec, $pipes, NULL, $moreThanLimit = 0; for($i = 0; $i < 10; $i++){ - fwrite($pipes[0], "hello$i\r\n"); - fflush($pipes[0]); + fwrite($pipes[0], "hello$i\r\n"); + fflush($pipes[0]); - $t0 = microtime(1); - $s = fgets($pipes[1]); - $t1 = microtime(1); + $t0 = microtime(1); + $s = fgets($pipes[1]); + $t1 = microtime(1); - echo $s; + echo $s; - $dt_ms = ($t1 - $t0)*1000; - if ($dt_ms > $max_ms) { + $dt_ms = ($t1 - $t0)*1000; + if ($dt_ms > $max_ms) { $moreThanLimit++; - } + } } fclose($pipes[0]); diff --git a/ext/standard/tests/streams/stream_context_tcp_nodelay.phpt b/ext/standard/tests/streams/stream_context_tcp_nodelay.phpt index 1e5b7e31d8..7af03726e6 100644 --- a/ext/standard/tests/streams/stream_context_tcp_nodelay.phpt +++ b/ext/standard/tests/streams/stream_context_tcp_nodelay.phpt @@ -8,16 +8,16 @@ if (!extension_loaded("sockets")) die("skip: need sockets"); --FILE-- <?php $ctxt = stream_context_create([ - "socket" => [ - "tcp_nodelay" => true - ] + "socket" => [ + "tcp_nodelay" => true + ] ]); $stream = stream_socket_client( - "tcp://www.php.net:80", $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $ctxt); + "tcp://www.php.net:80", $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $ctxt); $socket = - socket_import_stream($stream); + socket_import_stream($stream); var_dump(socket_get_option($socket, SOL_TCP, TCP_NODELAY) > 0); ?> diff --git a/ext/standard/tests/streams/stream_context_tcp_nodelay_fopen.phpt b/ext/standard/tests/streams/stream_context_tcp_nodelay_fopen.phpt index 7142dae73b..133b7a94ba 100644 --- a/ext/standard/tests/streams/stream_context_tcp_nodelay_fopen.phpt +++ b/ext/standard/tests/streams/stream_context_tcp_nodelay_fopen.phpt @@ -8,18 +8,18 @@ if (!extension_loaded("sockets")) die("skip: need sockets"); --FILE-- <?php $ctxt = stream_context_create([ - "socket" => [ - "tcp_nodelay" => true - ], - "http" => [ - "follow_location" => 0 - ] + "socket" => [ + "tcp_nodelay" => true + ], + "http" => [ + "follow_location" => 0 + ] ]); $stream = fopen("http://www.php.net", "r", false, $ctxt); $socket = - @socket_import_stream($stream); + @socket_import_stream($stream); var_dump(socket_get_option($socket, STREAM_IPPROTO_TCP, TCP_NODELAY) > 0); ?> diff --git a/ext/standard/tests/streams/stream_context_tcp_nodelay_server.phpt b/ext/standard/tests/streams/stream_context_tcp_nodelay_server.phpt index 420d5ad490..7d685e16df 100644 --- a/ext/standard/tests/streams/stream_context_tcp_nodelay_server.phpt +++ b/ext/standard/tests/streams/stream_context_tcp_nodelay_server.phpt @@ -6,40 +6,40 @@ stream context tcp_nodelay server <?php $serverCode = <<<'CODE' $ctxt = stream_context_create([ - "socket" => [ - "tcp_nodelay" => true - ] - ]); + "socket" => [ + "tcp_nodelay" => true + ] + ]); - $server = stream_socket_server( - "tcp://127.0.0.1:9099", $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $ctxt); + $server = stream_socket_server( + "tcp://127.0.0.1:9099", $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $ctxt); - $client = stream_socket_accept($server); + $client = stream_socket_accept($server); - var_dump(socket_get_option( - socket_import_stream($server), - SOL_TCP, TCP_NODELAY) > 0); + var_dump(socket_get_option( + socket_import_stream($server), + SOL_TCP, TCP_NODELAY) > 0); - var_dump(socket_get_option( - socket_import_stream($client), - SOL_TCP, TCP_NODELAY) > 0); + var_dump(socket_get_option( + socket_import_stream($client), + SOL_TCP, TCP_NODELAY) > 0); - fclose($client); - fclose($server); + fclose($client); + fclose($server); CODE; $clientCode = <<<'CODE' $test = stream_socket_client( - "tcp://127.0.0.1:9099", $errno, $errstr, 10); + "tcp://127.0.0.1:9099", $errno, $errstr, 10); - sleep(1); + sleep(1); - fclose($test); + fclose($test); CODE; include sprintf( - "%s/../../../openssl/tests/ServerClientTestCase.inc", - __DIR__); + "%s/../../../openssl/tests/ServerClientTestCase.inc", + __DIR__); ServerClientTestCase::getInstance()->run($serverCode, $clientCode); ?> --EXPECT-- diff --git a/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt b/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt index 8cdd5c1779..79daabd977 100644 --- a/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt +++ b/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt @@ -3,19 +3,19 @@ Bug #60455: stream_get_line and \0 as a delimiter --FILE-- <?php class TestStream { - private $s = 0; - function stream_open($path, $mode, $options, &$opened_path) { - return true; - } - function stream_read($count) { - if ($this->s++ == 0) - return "a\0"; + private $s = 0; + function stream_open($path, $mode, $options, &$opened_path) { + return true; + } + function stream_read($count) { + if ($this->s++ == 0) + return "a\0"; - return ""; - } - function stream_eof() { - return $this->s >= 2; - } + return ""; + } + function stream_eof() { + return $this->s >= 2; + } } diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt index f7ccc7783b..9627367c72 100644 --- a/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt +++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt @@ -15,13 +15,13 @@ fclose($fp); // open file in each access mode and get meta data foreach ($filemodes as $mode) { - if (strncmp($mode, 'x', 1) == 0) { - // x modes require that file does not exist - unlink($filename); - } - $fp = fopen($filename, $mode); - var_dump(stream_get_meta_data($fp)); - fclose($fp); + if (strncmp($mode, 'x', 1) == 0) { + // x modes require that file does not exist + unlink($filename); + } + $fp = fopen($filename, $mode); + var_dump(stream_get_meta_data($fp)); + fclose($fp); } unlink($filename); diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt index 6b3fde203a..e0ebaab2ee 100644 --- a/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt +++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt @@ -10,7 +10,7 @@ $fp = fopen($filename, "w+"); echo "Write some data to the file:\n"; $i = 0; while ($i++ < 20) { - fwrite($fp, "a line of data\n"); + fwrite($fp, "a line of data\n"); } var_dump(stream_get_meta_data($fp)); @@ -30,7 +30,7 @@ var_dump(stream_get_meta_data($fp)); echo "\n\nRead entire file:\n"; while(!feof($fp)) { - fread($fp, 1); + fread($fp, 1); } var_dump(stream_get_meta_data($fp)); diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt index 22fcee4b6f..202fc7a2ec 100644 --- a/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt +++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt @@ -10,7 +10,7 @@ $fp = fopen($filename, "w+"); echo "Write some data to the file:\n"; $i = 0; while ($i++ < 20) { - fwrite($fp, "a line of data\n"); + fwrite($fp, "a line of data\n"); } var_dump(stream_get_meta_data($fp)); @@ -20,7 +20,7 @@ rewind($fp); echo "\n\nRead entire file:\n"; while(!feof($fp)) { - fread($fp, 1); + fread($fp, 1); } var_dump(stream_get_meta_data($fp)); diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt index 1c7f1fd256..9db45e8c2f 100644 --- a/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt +++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt @@ -9,7 +9,7 @@ $server = stream_socket_server('tcp://127.0.0.1:31331'); /* Connect to it */ $client = fsockopen('tcp://127.0.0.1:31331'); if (!$client) { - die("Unable to create socket"); + die("Unable to create socket"); } /* Accept that connection */ @@ -31,7 +31,7 @@ echo "\n\nClose the server side socket and read the remaining data from the clie fclose($socket); fclose($server); while(!feof($client)) { - fread($client, 1); + fread($client, 1); } var_dump(stream_get_meta_data($client)); diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt index cb713c8525..f6e6504536 100644 --- a/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt +++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt @@ -9,7 +9,7 @@ $server = stream_socket_server('tcp://127.0.0.1:31332'); /* Connect to it */ $client = fsockopen('tcp://127.0.0.1:31332'); if (!$client) { - die("Unable to create socket"); + die("Unable to create socket"); } /* Accept that connection */ diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt index c7f08cbe12..ef1a22a3a1 100644 --- a/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt +++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt @@ -9,7 +9,7 @@ $server = stream_socket_server('tcp://127.0.0.1:31333'); /* Connect to it */ $client = fsockopen('tcp://127.0.0.1:31333'); if (!$client) { - die("Unable to create socket"); + die("Unable to create socket"); } /* Accept that connection */ diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt index e37e991f16..cd83b1342c 100644 --- a/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt +++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt @@ -9,7 +9,7 @@ $server = stream_socket_server('tcp://127.0.0.1:31334'); /* Connect to it */ $client = fsockopen('tcp://127.0.0.1:31334'); if (!$client) { - die("Unable to create socket"); + die("Unable to create socket"); } /* Accept that connection */ @@ -27,7 +27,7 @@ echo "\n\nClose the server side socket and read the remaining data from the clie fclose($socket); fclose($server); while(!feof($client)) { - fread($client, 1); + fread($client, 1); } var_dump(stream_get_meta_data($client)); diff --git a/ext/standard/tests/streams/stream_multi_filters_close.phpt b/ext/standard/tests/streams/stream_multi_filters_close.phpt index f1eb18a15c..6b955cf1a7 100644 --- a/ext/standard/tests/streams/stream_multi_filters_close.phpt +++ b/ext/standard/tests/streams/stream_multi_filters_close.phpt @@ -4,41 +4,41 @@ Check if multiple filters are closed correctly and never called again after clos <?php class FirstFilter extends php_user_filter { - public function filter($in, $out, &$consumed, $closing) { - static $closed = 0; - - while ($bucket = stream_bucket_make_writeable($in)) { - stream_bucket_append($out, stream_bucket_new($this->stream, $bucket->data)); - } - - if ($closing) { - $closed++; - } - - if ($closed > 0) { - var_dump($closed++); - } - return PSFS_PASS_ON; - } + public function filter($in, $out, &$consumed, $closing) { + static $closed = 0; + + while ($bucket = stream_bucket_make_writeable($in)) { + stream_bucket_append($out, stream_bucket_new($this->stream, $bucket->data)); + } + + if ($closing) { + $closed++; + } + + if ($closed > 0) { + var_dump($closed++); + } + return PSFS_PASS_ON; + } } class SecondFilter extends php_user_filter { - public function filter($in, $out, &$consumed, $closing) { - static $closed = 0; - - while ($bucket = stream_bucket_make_writeable($in)) { - stream_bucket_append($out, stream_bucket_new($this->stream, $bucket->data)); - } - - if ($closing) { - $closed++; - } - - if ($closed > 0) { - var_dump($closed++); - } - return PSFS_PASS_ON; - } + public function filter($in, $out, &$consumed, $closing) { + static $closed = 0; + + while ($bucket = stream_bucket_make_writeable($in)) { + stream_bucket_append($out, stream_bucket_new($this->stream, $bucket->data)); + } + + if ($closing) { + $closed++; + } + + if ($closed > 0) { + var_dump($closed++); + } + return PSFS_PASS_ON; + } } $r = fopen("php://stdout", "w+"); diff --git a/ext/standard/tests/streams/stream_set_chunk_size.phpt b/ext/standard/tests/streams/stream_set_chunk_size.phpt index 6b90f86cd0..ac50db6867 100644 --- a/ext/standard/tests/streams/stream_set_chunk_size.phpt +++ b/ext/standard/tests/streams/stream_set_chunk_size.phpt @@ -3,24 +3,24 @@ stream_set_chunk_size basic tests --FILE-- <?php class test_wrapper { - function stream_open($path, $mode, $openedpath) { - return true; - } - function stream_eof() { - return false; - } - function stream_read($count) { - echo "read with size: ", $count, "\n"; - return str_repeat('a', $count); - } - function stream_write($data) { - echo "write with size: ", strlen($data), "\n"; - return strlen($data); - } - function stream_set_option($option, $arg1, $arg2) { - echo "option: ", $option, ", ", $arg1, ", ", $arg2, "\n"; - return false; - } + function stream_open($path, $mode, $openedpath) { + return true; + } + function stream_eof() { + return false; + } + function stream_read($count) { + echo "read with size: ", $count, "\n"; + return str_repeat('a', $count); + } + function stream_write($data) { + echo "write with size: ", strlen($data), "\n"; + return strlen($data); + } + function stream_set_option($option, $arg1, $arg2) { + echo "option: ", $option, ", ", $arg1, ", ", $arg2, "\n"; + return false; + } } var_dump(stream_wrapper_register('test', 'test_wrapper')); diff --git a/ext/standard/tests/strings/add-and-stripslashes.phpt b/ext/standard/tests/strings/add-and-stripslashes.phpt index 6f01176d4e..4855ff02fe 100644 --- a/ext/standard/tests/strings/add-and-stripslashes.phpt +++ b/ext/standard/tests/strings/add-and-stripslashes.phpt @@ -5,14 +5,14 @@ addslashes() and stripslashes() functions $input = ''; for($i=0; $i<512; $i++) { - $input .= chr($i%256); + $input .= chr($i%256); } echo "Normal: "; if($input === stripslashes(addslashes($input))) { - echo "OK\n"; + echo "OK\n"; } else { - echo "FAILED\n"; + echo "FAILED\n"; } ?> diff --git a/ext/standard/tests/strings/addslashes_variation2.phpt b/ext/standard/tests/strings/addslashes_variation2.phpt index 4de6c75697..d4c0257b6e 100644 --- a/ext/standard/tests/strings/addslashes_variation2.phpt +++ b/ext/standard/tests/strings/addslashes_variation2.phpt @@ -43,7 +43,7 @@ $str_array = array( "", "\"", '"', - "hello\"", + "hello\"", // string with backslash characters 'Is your name Ram\Krishna?', @@ -65,7 +65,7 @@ $str_array = array( '"c:\php\"'.chr(0)."'", '"hello"'."'world'".chr(0).'//', - // string with hexadecimal number + // string with hexadecimal number "0xABCDEF0123456789", "\x00", '!@#$%&*@$%#&/;:,<>', diff --git a/ext/standard/tests/strings/basename.phpt b/ext/standard/tests/strings/basename.phpt Binary files differindex a39a6f9aeb..1f69bf4bce 100644 --- a/ext/standard/tests/strings/basename.phpt +++ b/ext/standard/tests/strings/basename.phpt diff --git a/ext/standard/tests/strings/bin2hex.phpt b/ext/standard/tests/strings/bin2hex.phpt index 42a4f4c594..dbc440c094 100644 --- a/ext/standard/tests/strings/bin2hex.phpt +++ b/ext/standard/tests/strings/bin2hex.phpt @@ -4,7 +4,7 @@ bin2hex() function <?php $s = ''; for($i=0; $i<256; $i++) { - $s .= chr($i); + $s .= chr($i); } echo bin2hex($s)."\n"; echo bin2hex("abc")."\n"; diff --git a/ext/standard/tests/strings/bin2hex_basic.phpt b/ext/standard/tests/strings/bin2hex_basic.phpt index 9079f77323..8842b8fea8 100644 --- a/ext/standard/tests/strings/bin2hex_basic.phpt +++ b/ext/standard/tests/strings/bin2hex_basic.phpt @@ -13,15 +13,15 @@ echo "*** Testing bin2hex() : basic functionality ***\n"; // array with different values for $string $strings = array ( - //double quoted strings + //double quoted strings /*1*/ "Here is a simple string", - "\t This String contains \t\t some control characters\r\n", - "\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f", + "\t This String contains \t\t some control characters\r\n", + "\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f", - //single quoted strings + //single quoted strings /*4*/ 'Here is a simple string', - '\t This String contains \t\t some control characters\r\n', - '\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f', + '\t This String contains \t\t some control characters\r\n', + '\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f', ); // loop through with each element of the $strings array to test bin2hex() function diff --git a/ext/standard/tests/strings/bug20108.phpt b/ext/standard/tests/strings/bug20108.phpt index 6e2219d990..e0be12b242 100644 --- a/ext/standard/tests/strings/bug20108.phpt +++ b/ext/standard/tests/strings/bug20108.phpt @@ -2,9 +2,9 @@ Bug #20108 (Segfault on printf statement) --FILE-- <?php - $a = "boo"; - $z = sprintf("%580.58s\n", $a); - var_dump($z); + $a = "boo"; + $z = sprintf("%580.58s\n", $a); + var_dump($z); ?> --EXPECT-- string(581) " boo diff --git a/ext/standard/tests/strings/bug20169.phpt b/ext/standard/tests/strings/bug20169.phpt index c606578677..fd5de0ee88 100644 --- a/ext/standard/tests/strings/bug20169.phpt +++ b/ext/standard/tests/strings/bug20169.phpt @@ -2,12 +2,12 @@ Bug #20169 (implode() clobbers first argument) --FILE-- <?php - @set_time_limit(5); - $delimiter = "|"; + @set_time_limit(5); + $delimiter = "|"; - echo "delimiter: $delimiter\n"; - implode($delimiter, array("foo", "bar")); - echo "delimiter: $delimiter\n"; + echo "delimiter: $delimiter\n"; + implode($delimiter, array("foo", "bar")); + echo "delimiter: $delimiter\n"; ?> --EXPECT-- delimiter: | diff --git a/ext/standard/tests/strings/bug21338.phpt b/ext/standard/tests/strings/bug21338.phpt index c84576563e..c118ee18de 100644 --- a/ext/standard/tests/strings/bug21338.phpt +++ b/ext/standard/tests/strings/bug21338.phpt @@ -2,8 +2,8 @@ Bug #20934 (html_entity_decode() crash when "" is passed) --FILE-- <?php - var_dump(html_entity_decode(NULL)); - var_dump(html_entity_decode("")); + var_dump(html_entity_decode(NULL)); + var_dump(html_entity_decode("")); ?> --EXPECT-- string(0) "" diff --git a/ext/standard/tests/strings/bug22187.phpt b/ext/standard/tests/strings/bug22187.phpt index dccaccc04d..9b77569b47 100644 --- a/ext/standard/tests/strings/bug22187.phpt +++ b/ext/standard/tests/strings/bug22187.phpt @@ -2,8 +2,8 @@ Bug #22187 (possible crash in number_format() function) --FILE-- <?php - var_dump(number_format(0.0001, 1)); - var_dump(number_format(0.0001, 0)); + var_dump(number_format(0.0001, 1)); + var_dump(number_format(0.0001, 0)); ?> --EXPECT-- string(3) "0.0" diff --git a/ext/standard/tests/strings/bug22207.phpt b/ext/standard/tests/strings/bug22207.phpt index 956acd2103..eddfa942e2 100644 --- a/ext/standard/tests/strings/bug22207.phpt +++ b/ext/standard/tests/strings/bug22207.phpt @@ -2,8 +2,8 @@ Bug #22207 (missing 0 when using the e notation in *printf functions) --FILE-- <?php - printf("%10.5e\n", 1.1); - var_dump(sprintf("%10.5e\n", 1.1)); + printf("%10.5e\n", 1.1); + var_dump(sprintf("%10.5e\n", 1.1)); ?> --EXPECT-- 1.10000e+0 diff --git a/ext/standard/tests/strings/bug22224.phpt b/ext/standard/tests/strings/bug22224.phpt index 0ab00a6c42..c9a669eb46 100644 --- a/ext/standard/tests/strings/bug22224.phpt +++ b/ext/standard/tests/strings/bug22224.phpt @@ -6,10 +6,10 @@ error_reporting=0 <?php class foo { - function __toString() - { - return "Object"; - } + function __toString() + { + return "Object"; + } } diff --git a/ext/standard/tests/strings/bug24098.phpt b/ext/standard/tests/strings/bug24098.phpt index 1998d9ed0a..16d2f7720e 100644 --- a/ext/standard/tests/strings/bug24098.phpt +++ b/ext/standard/tests/strings/bug24098.phpt @@ -4,7 +4,7 @@ Bug #24098 (pathinfo() crash) <?php if (DIRECTORY_SEPARATOR == '\\') die("skip directory separator won't match expected output"); ?> --FILE-- <?php - var_dump(pathinfo("/dsds.asa")); + var_dump(pathinfo("/dsds.asa")); ?> --EXPECT-- array(4) { diff --git a/ext/standard/tests/strings/bug24312.phpt b/ext/standard/tests/strings/bug24312.phpt index 5ec444dd58..fb1f494b18 100644 --- a/ext/standard/tests/strings/bug24312.phpt +++ b/ext/standard/tests/strings/bug24312.phpt @@ -4,8 +4,8 @@ Bug #24208 (base64_decode() not skipping 0xF0 - 0xFF) <?php $data = str_repeat("a", 100); for ($i = 0xF0; $i < 0xFF + 1; $i++) { - $enc = chunk_split(base64_encode($data), 10, chr($i)); - var_dump(base64_decode($enc)); + $enc = chunk_split(base64_encode($data), 10, chr($i)); + var_dump(base64_decode($enc)); } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/bug25671.phpt b/ext/standard/tests/strings/bug25671.phpt index ab26ddf772..cd6dec6641 100644 --- a/ext/standard/tests/strings/bug25671.phpt +++ b/ext/standard/tests/strings/bug25671.phpt @@ -3,12 +3,12 @@ Bug #25671 (subarrays not copied correctly) --FILE-- <?php $arr = array( - "This is string one.", - "This is string two.", - array( - "This is another string.", - "This is a last string."), - "This is a last string."); + "This is string one.", + "This is string two.", + array( + "This is another string.", + "This is a last string."), + "This is a last string."); echo serialize(str_replace("string", "strung", $arr)) . "\n"; echo serialize(str_replace("string", "strung", $arr)) . "\n"; diff --git a/ext/standard/tests/strings/bug26817.phpt b/ext/standard/tests/strings/bug26817.phpt index 2e31d30be9..e3b6539a1c 100644 --- a/ext/standard/tests/strings/bug26817.phpt +++ b/ext/standard/tests/strings/bug26817.phpt @@ -3,18 +3,18 @@ Bug #26817 (http_build_query() did not handle private & protected object propert --FILE-- <?php class test { - protected $foo; - private $bar; - public $test; + protected $foo; + private $bar; + public $test; - function foo() - { - $this->bar = 'meuh'; - $this->foo = 'lala'; - $this->test = 'test'; + function foo() + { + $this->bar = 'meuh'; + $this->foo = 'lala'; + $this->test = 'test'; - var_dump(http_build_query($this)); - } + var_dump(http_build_query($this)); + } } $obj = new test(); diff --git a/ext/standard/tests/strings/bug26878.phpt b/ext/standard/tests/strings/bug26878.phpt index 602f710c83..da6c0a2aa4 100644 --- a/ext/standard/tests/strings/bug26878.phpt +++ b/ext/standard/tests/strings/bug26878.phpt @@ -2,8 +2,8 @@ Bug #26878 (problem with multiple references to the same variable with different types) --FILE-- <?php - printf('Int: %1$d and as string: %1$s', 'some string'); - echo "\n"; + printf('Int: %1$d and as string: %1$s', 'some string'); + echo "\n"; ?> --EXPECT-- Int: 0 and as string: some string diff --git a/ext/standard/tests/strings/bug27278.phpt b/ext/standard/tests/strings/bug27278.phpt index 1a94692d19..f3d8eced90 100644 --- a/ext/standard/tests/strings/bug27278.phpt +++ b/ext/standard/tests/strings/bug27278.phpt @@ -5,8 +5,8 @@ Bug #27278 (*printf() functions treat arguments as if passed by reference) function foo ($a) { - $a=sprintf("%02d",$a); - var_dump($a); + $a=sprintf("%02d",$a); + var_dump($a); } $x="02"; diff --git a/ext/standard/tests/strings/bug27295.phpt b/ext/standard/tests/strings/bug27295.phpt index d23d27049f..b8c53e4906 100644 --- a/ext/standard/tests/strings/bug27295.phpt +++ b/ext/standard/tests/strings/bug27295.phpt @@ -5,8 +5,8 @@ Bug #27295 (memory leak inside sscanf()) $strings = array("foo = bar", "bar = foo"); foreach( $strings as $string ) { - sscanf( $string, "%s = %[^[]]", $var, $val ); - echo "$var = $val\n"; + sscanf( $string, "%s = %[^[]]", $var, $val ); + echo "$var = $val\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/bug27457.phpt b/ext/standard/tests/strings/bug27457.phpt index 6f5ec05f79..e9ac42e031 100644 --- a/ext/standard/tests/strings/bug27457.phpt +++ b/ext/standard/tests/strings/bug27457.phpt @@ -2,16 +2,16 @@ Bug #27457 (Problem with strtr() and translation array) --FILE-- <?php - $test = "Dot in brackets [.]\n"; - echo $test; - $test = strtr($test, array('.' => '0')); - echo $test; - $test = strtr($test, array('0' => '.')); - echo $test; - $test = strtr($test, '.', '0'); - echo $test; - $test = strtr($test, '0', '.'); - echo $test; + $test = "Dot in brackets [.]\n"; + echo $test; + $test = strtr($test, array('.' => '0')); + echo $test; + $test = strtr($test, array('0' => '.')); + echo $test; + $test = strtr($test, '.', '0'); + echo $test; + $test = strtr($test, '0', '.'); + echo $test; ?> --EXPECT-- Dot in brackets [.] diff --git a/ext/standard/tests/strings/bug28633.phpt b/ext/standard/tests/strings/bug28633.phpt index 5a1c2567fa..9dc83a40ad 100644 --- a/ext/standard/tests/strings/bug28633.phpt +++ b/ext/standard/tests/strings/bug28633.phpt @@ -2,8 +2,8 @@ Bug #28633 (sprintf incorrectly adding padding to floats) --FILE-- <?php - echo sprintf("%05.2f", 0.02) . "\n"; - echo sprintf("%05.2f", 2.02) . "\n"; + echo sprintf("%05.2f", 0.02) . "\n"; + echo sprintf("%05.2f", 2.02) . "\n"; ?> --EXPECT-- 00.02 diff --git a/ext/standard/tests/strings/bug29075.phpt b/ext/standard/tests/strings/bug29075.phpt index 7fe7da6c49..63a4fdb074 100644 --- a/ext/standard/tests/strings/bug29075.phpt +++ b/ext/standard/tests/strings/bug29075.phpt @@ -2,11 +2,11 @@ Bug #29075 (strnatcmp() incorrectly handles whitespace) --FILE-- <?php - var_dump( - strnatcmp('foo ', 'foo '), - strnatcmp('foo', 'foo'), - strnatcmp(' foo', ' foo') - ); + var_dump( + strnatcmp('foo ', 'foo '), + strnatcmp('foo', 'foo'), + strnatcmp(' foo', ' foo') + ); ?> --EXPECT-- int(0) diff --git a/ext/standard/tests/strings/bug29538.phpt b/ext/standard/tests/strings/bug29538.phpt index 6af25fb89a..13065a4e11 100644 --- a/ext/standard/tests/strings/bug29538.phpt +++ b/ext/standard/tests/strings/bug29538.phpt @@ -2,8 +2,8 @@ Bug #29538 (number_format and problem with 0) --FILE-- <?php - echo number_format(0.25, 2, '', ''), "\n"; - echo number_format(1234, 2, '', ','); + echo number_format(0.25, 2, '', ''), "\n"; + echo number_format(1234, 2, '', ','); ?> --EXPECT-- 025 diff --git a/ext/standard/tests/strings/bug36148.phpt b/ext/standard/tests/strings/bug36148.phpt index 06caac3334..2e9a81c5ea 100644 --- a/ext/standard/tests/strings/bug36148.phpt +++ b/ext/standard/tests/strings/bug36148.phpt @@ -4,10 +4,10 @@ Bug #36148 (unpack("H*hex", $data) is adding an extra character to the end of th <?php $values = array("a", "aa", "aaa", "aaaa"); foreach ($values as $value) { - $a = pack("H*", $value); - $b = unpack("H*", $a); - echo $value.": "; - var_dump($b); + $a = pack("H*", $value); + $b = unpack("H*", $a); + echo $value.": "; + var_dump($b); } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/bug36392.phpt b/ext/standard/tests/strings/bug36392.phpt index 8e4cd16c67..b98f7e6293 100644 --- a/ext/standard/tests/strings/bug36392.phpt +++ b/ext/standard/tests/strings/bug36392.phpt @@ -2,11 +2,11 @@ Bug #36392 (wrong number of decimal digits with %e specifier in sprintf) --FILE-- <?php - echo sprintf("%e\n", 1.123456789); - echo sprintf("%.10e\n", 1.123456789); - echo sprintf("%.0e\n", 1.123456789); - echo sprintf("%.1e\n", 1.123456789); - echo sprintf("%5.1e\n", 1.123456789); + echo sprintf("%e\n", 1.123456789); + echo sprintf("%.10e\n", 1.123456789); + echo sprintf("%.0e\n", 1.123456789); + echo sprintf("%.1e\n", 1.123456789); + echo sprintf("%5.1e\n", 1.123456789); ?> --EXPECT-- 1.123457e+0 diff --git a/ext/standard/tests/strings/bug38770.phpt b/ext/standard/tests/strings/bug38770.phpt index 76ec33572b..a349ebff15 100644 --- a/ext/standard/tests/strings/bug38770.phpt +++ b/ext/standard/tests/strings/bug38770.phpt @@ -8,7 +8,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); <?php foreach (array('N','l') as $v) { - print_r(unpack($v, pack($v, -30000))); + print_r(unpack($v, pack($v, -30000))); } echo "Done\n"; diff --git a/ext/standard/tests/strings/bug39873.phpt b/ext/standard/tests/strings/bug39873.phpt index 527b7d3c92..f264f6bb02 100644 --- a/ext/standard/tests/strings/bug39873.phpt +++ b/ext/standard/tests/strings/bug39873.phpt @@ -8,10 +8,10 @@ if (!setlocale(LC_ALL, "ita","it","Italian","it_IT","it_IT.ISO8859-1","it_IT.ISO ?> --FILE-- <?php - setlocale(LC_ALL, "ita","it","Italian","it_IT","it_IT.ISO8859-1","it_IT.ISO_8859-1"); - $num = 0+"1234.56"; - echo number_format($num,2); - echo "\n"; + setlocale(LC_ALL, "ita","it","Italian","it_IT","it_IT.ISO8859-1","it_IT.ISO_8859-1"); + $num = 0+"1234.56"; + echo number_format($num,2); + echo "\n"; ?> --EXPECT-- 1,234.56 diff --git a/ext/standard/tests/strings/bug45166.phpt b/ext/standard/tests/strings/bug45166.phpt index 0b694518df..2ed07b62f8 100644 --- a/ext/standard/tests/strings/bug45166.phpt +++ b/ext/standard/tests/strings/bug45166.phpt @@ -2,7 +2,7 @@ Bug #45166 (substr() ) --FILE-- <?php - echo substr('cd', -3) . "\n"; + echo substr('cd', -3) . "\n"; ?> --EXPECT-- cd diff --git a/ext/standard/tests/strings/bug48709.phpt b/ext/standard/tests/strings/bug48709.phpt index 6a93b8dae4..9e0789a61f 100644 --- a/ext/standard/tests/strings/bug48709.phpt +++ b/ext/standard/tests/strings/bug48709.phpt @@ -5,18 +5,18 @@ Bug #48709 (metaphone and 'wh') /* Initial letter exceptions */ $exceptions = array( - 'kn', // Drop first letter - 'gn', // ditto - 'pn', // ditto - 'ae', // ditto - 'wr', // ditto - 'x', // s - 'wh', // w - 'wa' // w + 'kn', // Drop first letter + 'gn', // ditto + 'pn', // ditto + 'ae', // ditto + 'wr', // ditto + 'x', // s + 'wh', // w + 'wa' // w ); foreach ($exceptions as $letter) { - printf("%s => %s\n", $letter, metaphone($letter)); + printf("%s => %s\n", $letter, metaphone($letter)); } ?> diff --git a/ext/standard/tests/strings/bug55871.phpt b/ext/standard/tests/strings/bug55871.phpt index 0c8fd4c6e6..60a857ec67 100644 --- a/ext/standard/tests/strings/bug55871.phpt +++ b/ext/standard/tests/strings/bug55871.phpt @@ -3,15 +3,15 @@ Bug #55871 (Interruption in substr_replace()) (PHP7) --FILE-- <?php class test1 { - public function __toString() { - preg_match('//', '', $GLOBALS['my_var']); - return ''; - } + public function __toString() { + preg_match('//', '', $GLOBALS['my_var']); + return ''; + } } class test2 { public function __toString() { - $GLOBALS['my_var'] += 0x08048000; + $GLOBALS['my_var'] += 0x08048000; return ''; } } diff --git a/ext/standard/tests/strings/bug65230.phpt b/ext/standard/tests/strings/bug65230.phpt index 4363462934..1efcc6cf2e 100644 --- a/ext/standard/tests/strings/bug65230.phpt +++ b/ext/standard/tests/strings/bug65230.phpt @@ -13,16 +13,16 @@ date.timezone=Europe/Berlin function test($locale, $value) { - $newlocale = setlocale(LC_ALL, $locale); - $conv = localeconv(); - $sep = $conv['decimal_point']; + $newlocale = setlocale(LC_ALL, $locale); + $conv = localeconv(); + $sep = $conv['decimal_point']; - printf("%s\n--------------------------\n", $newlocale); - printf(" sep: %s\n", $sep); - printf(" %%f: %f\n", $value); - printf(" %%F: %F\n", $value); - printf("date: %s\n", strftime('%x', mktime(0, 0, 0, 12, 5, 2014))); - printf("\n"); + printf("%s\n--------------------------\n", $newlocale); + printf(" sep: %s\n", $sep); + printf(" %%f: %f\n", $value); + printf(" %%F: %F\n", $value); + printf("date: %s\n", strftime('%x', mktime(0, 0, 0, 12, 5, 2014))); + printf("\n"); } test('german', 3.41); diff --git a/ext/standard/tests/strings/bug65769.phpt b/ext/standard/tests/strings/bug65769.phpt index efe5788ce4..31656ee60f 100644 --- a/ext/standard/tests/strings/bug65769.phpt +++ b/ext/standard/tests/strings/bug65769.phpt @@ -15,21 +15,21 @@ if (PHP_WINDOWS_VERSION_MAJOR < 10) { $locales = array('sve', 'french', 'us', 'ru', 'czech', 'serbian'); foreach ($locales as $locale) { - $locale = setlocale(LC_ALL, $locale); - $lconv = localeconv(); - var_dump( - $locale, - $lconv['decimal_point'], - $lconv['thousands_sep'], - $lconv['int_curr_symbol'], - $lconv['currency_symbol'], - $lconv['mon_decimal_point'], - $lconv['mon_thousands_sep'] - ); - if ($locale === 'Swedish_Sweden.1252') { - var_dump(in_array($lconv['mon_thousands_sep'], ['.', ' '])); - } - echo '++++++++++++++++++++++', "\n"; + $locale = setlocale(LC_ALL, $locale); + $lconv = localeconv(); + var_dump( + $locale, + $lconv['decimal_point'], + $lconv['thousands_sep'], + $lconv['int_curr_symbol'], + $lconv['currency_symbol'], + $lconv['mon_decimal_point'], + $lconv['mon_thousands_sep'] + ); + if ($locale === 'Swedish_Sweden.1252') { + var_dump(in_array($lconv['mon_thousands_sep'], ['.', ' '])); + } + echo '++++++++++++++++++++++', "\n"; } ?> diff --git a/ext/standard/tests/strings/bug65947.phpt b/ext/standard/tests/strings/bug65947.phpt index ff7dbf4b8c..3ffecf3cac 100644 --- a/ext/standard/tests/strings/bug65947.phpt +++ b/ext/standard/tests/strings/bug65947.phpt @@ -8,8 +8,8 @@ $csv = base64_decode('6Q=='); $adata = str_getcsv($csv,";"); $b2 = basename($filename); if ($filename != $b2) - print "BUG"; + print "BUG"; else - print "OKEY"; + print "OKEY"; --EXPECT-- OKEY diff --git a/ext/standard/tests/strings/bug71969.phpt b/ext/standard/tests/strings/bug71969.phpt index aafceb09ad..9795186e15 100644 --- a/ext/standard/tests/strings/bug71969.phpt +++ b/ext/standard/tests/strings/bug71969.phpt @@ -3,13 +3,13 @@ Bug #71969 (str_replace returns an incorrect resulting array after a foreach by --FILE-- <?php $a = array( - array("one" => array("a"=>"0000", "b"=>"1111")), + array("one" => array("a"=>"0000", "b"=>"1111")), ); //foreach by reference, changing the array value foreach($a as &$record) { - $record["one"]["a"] = "2222"; + $record["one"]["a"] = "2222"; } var_dump(str_replace("2", "3", $a)); ?> diff --git a/ext/standard/tests/strings/bug72663_3.phpt b/ext/standard/tests/strings/bug72663_3.phpt index 3b949b0239..d8be463887 100644 --- a/ext/standard/tests/strings/bug72663_3.phpt +++ b/ext/standard/tests/strings/bug72663_3.phpt @@ -3,10 +3,10 @@ Bug #72663: Create an Unexpected Object and Don't Invoke __wakeup() in Deseriali --FILE-- <?php class obj { - var $ryat; - function __wakeup() { - $this->ryat = str_repeat('A', 0x112); - } + var $ryat; + function __wakeup() { + $this->ryat = str_repeat('A', 0x112); + } } $poc = 'O:8:"stdClass":1:{i:0;O:3:"obj":1:{s:4:"ryat";R:1;'; diff --git a/ext/standard/tests/strings/bug78612.phpt b/ext/standard/tests/strings/bug78612.phpt index 7dad605e80..13fb324052 100644 --- a/ext/standard/tests/strings/bug78612.phpt +++ b/ext/standard/tests/strings/bug78612.phpt @@ -8,7 +8,7 @@ $_a = 7111222333000001; $_b = 5000001; for ($j=0; $j<10; $j++) { - $find_replace[$_a + $j] = $_b + $j; + $find_replace[$_a + $j] = $_b + $j; } echo strtr('Hello', $find_replace), "\n"; diff --git a/ext/standard/tests/strings/chop_variation3.phpt b/ext/standard/tests/strings/chop_variation3.phpt Binary files differindex 36f81d34c8..1a4568dc28 100644 --- a/ext/standard/tests/strings/chop_variation3.phpt +++ b/ext/standard/tests/strings/chop_variation3.phpt diff --git a/ext/standard/tests/strings/chop_variation4.phpt b/ext/standard/tests/strings/chop_variation4.phpt Binary files differindex 628c87cbce..192e07aa3a 100644 --- a/ext/standard/tests/strings/chop_variation4.phpt +++ b/ext/standard/tests/strings/chop_variation4.phpt diff --git a/ext/standard/tests/strings/chr_variation1.phpt b/ext/standard/tests/strings/chr_variation1.phpt index 7aae1bf905..fbf8e21f49 100644 --- a/ext/standard/tests/strings/chr_variation1.phpt +++ b/ext/standard/tests/strings/chr_variation1.phpt @@ -27,31 +27,31 @@ $file_handle = fopen(__FILE__, "r"); // array with different values for $input $inputs = array ( - // integer values + // integer values /*1*/ 0, - 1, - 255, - 256, + 1, + 255, + 256, - // float values + // float values /*5*/ 10.5, - -20.5, - 1.1234e6, + -20.5, + 1.1234e6, - // boolean values + // boolean values /*11*/ true, - false, - TRUE, - FALSE, + false, + TRUE, + FALSE, - // null values + // null values /*15*/ NULL, - null, + null, - // undefined variable + // undefined variable /*19*/ @$undefined_var, - // unset variable + // unset variable /*20*/ @$unset_var ); diff --git a/ext/standard/tests/strings/convert_uudecode_basic.phpt b/ext/standard/tests/strings/convert_uudecode_basic.phpt index 7422ac06c0..0c378bdb22 100644 --- a/ext/standard/tests/strings/convert_uudecode_basic.phpt +++ b/ext/standard/tests/strings/convert_uudecode_basic.phpt @@ -37,8 +37,8 @@ foreach($strings as $string) { $decode = convert_uudecode($encode); if ($decode != $string) { - var_dump($encode, $decode, $string); - exit("TEST FAILED on iteration $count\n"); + var_dump($encode, $decode, $string); + exit("TEST FAILED on iteration $count\n"); } $count ++; diff --git a/ext/standard/tests/strings/count_chars.phpt b/ext/standard/tests/strings/count_chars.phpt index fe21b656f0..6199461174 100644 --- a/ext/standard/tests/strings/count_chars.phpt +++ b/ext/standard/tests/strings/count_chars.phpt @@ -4,7 +4,7 @@ count_chars() function <?php $s = "het leven is net erwtensoep - je kunt er geen touw aan vastknopen"; for($i=0; $i<3; $i++) { - echo implode(count_chars($s, $i))."\n"; + echo implode(count_chars($s, $i))."\n"; } echo $a = count_chars($s, 3), "\n"; echo (int) strlen(count_chars($s, 4)) == 256-strlen($a),"\n"; diff --git a/ext/standard/tests/strings/crc32.phpt b/ext/standard/tests/strings/crc32.phpt index e1b338f011..2fa8be59d8 100644 --- a/ext/standard/tests/strings/crc32.phpt +++ b/ext/standard/tests/strings/crc32.phpt @@ -4,7 +4,7 @@ crc32() function <?php $input = array("foo", "bar", "baz", "grldsajkopallkjasd"); foreach($input AS $i) { - printf("%u\n", crc32($i)); + printf("%u\n", crc32($i)); } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/crc32_variation4.phpt b/ext/standard/tests/strings/crc32_variation4.phpt index f3f11972fb..6953994a74 100644 --- a/ext/standard/tests/strings/crc32_variation4.phpt +++ b/ext/standard/tests/strings/crc32_variation4.phpt @@ -74,7 +74,7 @@ $heredoc_strings = array( $heredoc_with_alphanumerics, $heredoc_with_embedded_nulls, $heredoc_with_hexa_octal, - $heredoc_with_long_string + $heredoc_with_long_string ); // loop to test the function with each heredoc string in the array diff --git a/ext/standard/tests/strings/crypt_blowfish.phpt b/ext/standard/tests/strings/crypt_blowfish.phpt index 3af9cb77eb..a8eda72120 100644 --- a/ext/standard/tests/strings/crypt_blowfish.phpt +++ b/ext/standard/tests/strings/crypt_blowfish.phpt @@ -4,44 +4,44 @@ Official blowfish tests (http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/ <?php $tests =array( - array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', 'U*U'), - array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.VGOzA784oUp/Z0DY336zx7pLYAy0lwK', 'U*U*'), - array('$2a$05$XXXXXXXXXXXXXXXXXXXXXOAcXxm9kjPGEMsLznoKqmqw7tc8WCx4a', 'U*U*U'), - array('$2a$05$abcdefghijklmnopqrstuu5s2v8.iXieOjg/.AySBTTZIIVFJeBui', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789chars after 72 are ignored'), - array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xa3"), - array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"), - array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"), - array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.nqd1wy.pTMdcvrRWxyiGL2eMz.2a85.', "\xff\xff\xa3"), - array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"), - array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"), - array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"), - array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"), - array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "1\xa3345"), - array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa3345"), - array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345"), - array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345"), - array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.ZC1JEJ8Z4gPfpe1JOr/oyPXTWl9EFd.', "\xff\xa334\xff\xff\xff\xa3345"), - array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345"), - array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345"), - array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"), - array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"), - array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"), - array('$2x$05$6bNw2HLQYeqHYyBfLMsv/OiwqTymGIGzFsA4hOTWebfehXHNprcAS', "\xd1\x91"), - array('$2x$05$6bNw2HLQYeqHYyBfLMsv/O9LIGgn8OMzuDoHfof8AQimSGfcSWxnS', "\xd0\xc1\xd2\xcf\xcc\xd8"), - array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.swQOIzjOiJ9GHEPuhEkvqrUyvWhEMx6', "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaachars after 72 are ignored as usual"), - array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.R9xrDjiycxMbQE2bp.vgqlYpW5wx2yy', "\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55"), - array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.9tQZzcJfm3uj2NvJ/n5xkhpqLrMpWCe', "\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff"), - array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.7uG0VCzI2bS7j6ymqJi9CdcdxiRTWNy', ''), + array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', 'U*U'), + array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.VGOzA784oUp/Z0DY336zx7pLYAy0lwK', 'U*U*'), + array('$2a$05$XXXXXXXXXXXXXXXXXXXXXOAcXxm9kjPGEMsLznoKqmqw7tc8WCx4a', 'U*U*U'), + array('$2a$05$abcdefghijklmnopqrstuu5s2v8.iXieOjg/.AySBTTZIIVFJeBui', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789chars after 72 are ignored'), + array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xa3"), + array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"), + array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"), + array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.nqd1wy.pTMdcvrRWxyiGL2eMz.2a85.', "\xff\xff\xa3"), + array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"), + array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"), + array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"), + array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"), + array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "1\xa3345"), + array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa3345"), + array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345"), + array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345"), + array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.ZC1JEJ8Z4gPfpe1JOr/oyPXTWl9EFd.', "\xff\xa334\xff\xff\xff\xa3345"), + array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345"), + array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345"), + array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"), + array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"), + array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"), + array('$2x$05$6bNw2HLQYeqHYyBfLMsv/OiwqTymGIGzFsA4hOTWebfehXHNprcAS', "\xd1\x91"), + array('$2x$05$6bNw2HLQYeqHYyBfLMsv/O9LIGgn8OMzuDoHfof8AQimSGfcSWxnS', "\xd0\xc1\xd2\xcf\xcc\xd8"), + array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.swQOIzjOiJ9GHEPuhEkvqrUyvWhEMx6', "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaachars after 72 are ignored as usual"), + array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.R9xrDjiycxMbQE2bp.vgqlYpW5wx2yy', "\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55"), + array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.9tQZzcJfm3uj2NvJ/n5xkhpqLrMpWCe', "\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff"), + array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.7uG0VCzI2bS7j6ymqJi9CdcdxiRTWNy', ''), ); $tests2 = array( - array('$2a$03$CCCCCCCCCCCCCCCCCCCCC.', '*0'), - array('$2a$32$CCCCCCCCCCCCCCCCCCCCC.', '*0'), - array('$2c$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'), - array('$2z$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'), - array('$2`$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'), - array('$2{$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'), - array('*0', '*1'), + array('$2a$03$CCCCCCCCCCCCCCCCCCCCC.', '*0'), + array('$2a$32$CCCCCCCCCCCCCCCCCCCCC.', '*0'), + array('$2c$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'), + array('$2z$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'), + array('$2`$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'), + array('$2{$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'), + array('*0', '*1'), ); $i=0; diff --git a/ext/standard/tests/strings/crypt_sha256.phpt b/ext/standard/tests/strings/crypt_sha256.phpt index c361dc48cb..c011984ed9 100644 --- a/ext/standard/tests/strings/crypt_sha256.phpt +++ b/ext/standard/tests/strings/crypt_sha256.phpt @@ -4,51 +4,51 @@ crypt() SHA-256 <?php $tests = array( - 1 => array( - '$5$saltstring', - 'Hello world!', - '$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5' - ), - 2 => array( - '$5$rounds=10000$saltstringsaltstring', - 'Hello world!', - '$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA' - ), - 3 => array( - '$5$rounds=10000$saltstringsaltstring', - 'Hello world!', - '$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA' - ), - 4 => array( - '$5$rounds=5000$toolongsaltstring', - 'This is just a test', - '$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8mGRcvxa5' - ), - 5 => array( - '$5$rounds=1400$anotherlongsaltstring', - 'a very much longer text to encrypt. This one even stretches over morethan one line.', - '$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12oP84Bnq1' - ), - 6 => array( - '$5$rounds=77777$short', - 'we have a short salt string but not a short password', - '$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/' - ), - 7 => array( - '$5$rounds=123456$asaltof16chars..', - 'a short string', - '$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/cZKmF/wJvD' - ), - 8 => array( - '$5$rounds=10$roundstoolow', - 'the minimum number is still observed', - '$5$rounds=1000$roundstoolow$yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL972bIC' - ) + 1 => array( + '$5$saltstring', + 'Hello world!', + '$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5' + ), + 2 => array( + '$5$rounds=10000$saltstringsaltstring', + 'Hello world!', + '$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA' + ), + 3 => array( + '$5$rounds=10000$saltstringsaltstring', + 'Hello world!', + '$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA' + ), + 4 => array( + '$5$rounds=5000$toolongsaltstring', + 'This is just a test', + '$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8mGRcvxa5' + ), + 5 => array( + '$5$rounds=1400$anotherlongsaltstring', + 'a very much longer text to encrypt. This one even stretches over morethan one line.', + '$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12oP84Bnq1' + ), + 6 => array( + '$5$rounds=77777$short', + 'we have a short salt string but not a short password', + '$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/' + ), + 7 => array( + '$5$rounds=123456$asaltof16chars..', + 'a short string', + '$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/cZKmF/wJvD' + ), + 8 => array( + '$5$rounds=10$roundstoolow', + 'the minimum number is still observed', + '$5$rounds=1000$roundstoolow$yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL972bIC' + ) ); foreach ($tests as $iter => $t) { - $res = crypt($t[1], $t[0]); - if ($res != $t[2]) echo "Iteration $iter failed. + $res = crypt($t[1], $t[0]); + if ($res != $t[2]) echo "Iteration $iter failed. Expected: <$t[2]> Got <$res>\n"; } diff --git a/ext/standard/tests/strings/crypt_sha512.phpt b/ext/standard/tests/strings/crypt_sha512.phpt index 408a5a00c7..589a2622de 100644 --- a/ext/standard/tests/strings/crypt_sha512.phpt +++ b/ext/standard/tests/strings/crypt_sha512.phpt @@ -4,51 +4,51 @@ crypt() SHA-512 <?php $tests = array( - 1 => array( - '$6$saltstring', - 'Hello world!', - '$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJuesI68u4OTLiBFdcbYEdFCoEOfaS35inz1' - ), - 2 => array( - '$6$rounds=10000$saltstringsaltstring', - 'Hello world!', - '$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sbHbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v.' - ), - 3 => array( - '$6$rounds=5000$toolongsaltstring', - 'This is just a test', - '$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQzQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0' - ), - 4 => array( - '$6$rounds=1400$anotherlongsaltstring', - 'a very much longer text to encrypt. This one even stretches over morethan one line.', - '$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wPvMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1' - ), - 5 => array( - '$6$rounds=77777$short', - 'we have a short salt string but not a short password', - '$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0gge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0' - ), - 6 => array( - '$6$rounds=123456$asaltof16chars..', - 'a short string', - '$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwcelCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1' - ), - 7 => array( - '$6$rounds=10$roundstoolow', - 'the minimum number is still observed', - '$6$rounds=1000$roundstoolow$kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1xhLsPuWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX.' - ), - 8 => array( - '$6$$bar$', - 'foo', - '$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu.' - ), + 1 => array( + '$6$saltstring', + 'Hello world!', + '$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJuesI68u4OTLiBFdcbYEdFCoEOfaS35inz1' + ), + 2 => array( + '$6$rounds=10000$saltstringsaltstring', + 'Hello world!', + '$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sbHbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v.' + ), + 3 => array( + '$6$rounds=5000$toolongsaltstring', + 'This is just a test', + '$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQzQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0' + ), + 4 => array( + '$6$rounds=1400$anotherlongsaltstring', + 'a very much longer text to encrypt. This one even stretches over morethan one line.', + '$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wPvMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1' + ), + 5 => array( + '$6$rounds=77777$short', + 'we have a short salt string but not a short password', + '$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0gge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0' + ), + 6 => array( + '$6$rounds=123456$asaltof16chars..', + 'a short string', + '$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwcelCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1' + ), + 7 => array( + '$6$rounds=10$roundstoolow', + 'the minimum number is still observed', + '$6$rounds=1000$roundstoolow$kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1xhLsPuWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX.' + ), + 8 => array( + '$6$$bar$', + 'foo', + '$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu.' + ), ); foreach ($tests as $iter => $t) { - $res = crypt($t[1], $t[0]); - if ($res != $t[2]) echo "Iteration $iter failed. + $res = crypt($t[1], $t[0]); + if ($res != $t[2]) echo "Iteration $iter failed. Expected: <$t[2]> Got <$res>\n"; } diff --git a/ext/standard/tests/strings/default_charset.phpt b/ext/standard/tests/strings/default_charset.phpt index 3665132413..3a8e2696d1 100644 --- a/ext/standard/tests/strings/default_charset.phpt +++ b/ext/standard/tests/strings/default_charset.phpt @@ -9,10 +9,10 @@ output_encoding= <?php echo "*** Default php.ini value ***\n"; var_dump(ini_get('default_charset'), - ini_get('internal_encoding'), - ini_get('input_encoding'), - ini_get('output_encoding') - ); + ini_get('internal_encoding'), + ini_get('input_encoding'), + ini_get('output_encoding') + ); echo "*** Runtime change of default_charset ***\n"; @@ -20,10 +20,10 @@ var_dump(ini_set('default_charset', 'cp1252')); echo "*** Test with updated default_charset ***\n"; var_dump(ini_get('default_charset'), - ini_get('internal_encoding'), - ini_get('input_encoding'), - ini_get('output_encoding') - ); + ini_get('internal_encoding'), + ini_get('input_encoding'), + ini_get('output_encoding') + ); var_dump(htmlentities("\xA3", ENT_HTML5)); var_dump(htmlentities("\xA3", ENT_HTML5, 'cp1252')); @@ -35,10 +35,10 @@ var_dump(bin2hex(html_entity_decode("£", ENT_HTML5, 'cp1252'))); echo "*** Change internal_encoding to empty ***\n"; var_dump(ini_set('internal_encoding', '')); var_dump(ini_get('default_charset'), - ini_get('internal_encoding'), - ini_get('input_encoding'), - ini_get('output_encoding') - ); + ini_get('internal_encoding'), + ini_get('input_encoding'), + ini_get('output_encoding') + ); var_dump(htmlentities("\xA3", ENT_HTML5)); var_dump(htmlentities("\xA3", ENT_HTML5, 'cp1252')); @@ -49,10 +49,10 @@ echo "*** Update input/output_encoding ***\n"; var_dump(ini_set('input_encoding', 'ISO-8859-1')); var_dump(ini_set('output_encoding', 'ISO-8859-1')); var_dump(ini_get('default_charset'), - ini_get('internal_encoding'), - ini_get('input_encoding'), - ini_get('output_encoding') - ); + ini_get('internal_encoding'), + ini_get('input_encoding'), + ini_get('output_encoding') + ); // Should not be affected var_dump(htmlentities("\xA3", ENT_HTML5)); diff --git a/ext/standard/tests/strings/dirname_multi.phpt b/ext/standard/tests/strings/dirname_multi.phpt index eb29de39a2..62943fe69a 100644 --- a/ext/standard/tests/strings/dirname_multi.phpt +++ b/ext/standard/tests/strings/dirname_multi.phpt @@ -12,7 +12,7 @@ if((substr(PHP_OS, 0, 3) == "WIN")) */ for ($i=0 ; $i<5 ; $i++) { try { - var_dump(dirname("/foo/bar/baz", $i)); + var_dump(dirname("/foo/bar/baz", $i)); } catch (\ValueError $e) { echo $e->getMessage() . "\n"; } diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt index 7c1fe0fd5e..cfc203b428 100644 --- a/ext/standard/tests/strings/explode1.phpt +++ b/ext/standard/tests/strings/explode1.phpt @@ -40,17 +40,17 @@ foreach($delimiters as $delimiter) { echo $e->getMessage() . "\n"; } try { - var_dump( explode($delimiter, $string, 0) ); + var_dump( explode($delimiter, $string, 0) ); } catch (\ValueError $e) { echo $e->getMessage() . "\n"; } try { - var_dump( explode($delimiter, $string, 1) ); + var_dump( explode($delimiter, $string, 1) ); } catch (\ValueError $e) { echo $e->getMessage() . "\n"; } try { - var_dump( explode($delimiter, $string, 2) ); + var_dump( explode($delimiter, $string, 2) ); } catch (\ValueError $e) { echo $e->getMessage() . "\n"; } diff --git a/ext/standard/tests/strings/explode_variation6.phpt b/ext/standard/tests/strings/explode_variation6.phpt index 2a823a4a3e..0dcce23077 100644 --- a/ext/standard/tests/strings/explode_variation6.phpt +++ b/ext/standard/tests/strings/explode_variation6.phpt @@ -32,11 +32,11 @@ $e = test_explode("\x00", $str, 100); function test_explode($delim, $string, $limit) { - $e = explode($delim, $string, $limit); - foreach ( $e as $v) - { - var_dump(bin2hex($v)); - } + $e = explode($delim, $string, $limit); + foreach ( $e as $v) + { + var_dump(bin2hex($v)); + } } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/get_meta_tags.phpt b/ext/standard/tests/strings/get_meta_tags.phpt index 406ceb2590..8752117aea 100644 --- a/ext/standard/tests/strings/get_meta_tags.phpt +++ b/ext/standard/tests/strings/get_meta_tags.phpt @@ -47,8 +47,8 @@ DATA; $array = array($data, $data1, $data2, $data3, $data4, "", "<>", "<meta<<<<<"); foreach ($array as $html) { - file_put_contents($filename, $html); - var_dump(get_meta_tags($filename)); + file_put_contents($filename, $html); + var_dump(get_meta_tags($filename)); } @unlink($filename); diff --git a/ext/standard/tests/strings/html_entity_decode_html4.phpt b/ext/standard/tests/strings/html_entity_decode_html4.phpt index 34753396de..dad8a3eb1f 100644 --- a/ext/standard/tests/strings/html_entity_decode_html4.phpt +++ b/ext/standard/tests/strings/html_entity_decode_html4.phpt @@ -3,258 +3,258 @@ html_entity_decode() conformance check (HTML 4) --FILE-- <?php $map = array( - """, - "&", - "<", - ">", - " ", - "¡", - "¢", - "£", - "¤", - "¥", - "¦", - "§", - "¨", - "©", - "ª", - "«", - "¬", - "­", - "®", - "¯", - "°", - "±", - "²", - "³", - "´", - "µ", - "¶", - "·", - "¸", - "¹", - "º", - "»", - "¼", - "½", - "¾", - "¿", - "À", - "Á", - "Â", - "Ã", - "Ä", - "Å", - "Æ", - "Ç", - "È", - "É", - "Ê", - "Ë", - "Ì", - "Í", - "Î", - "Ï", - "Ð", - "Ñ", - "Ò", - "Ó", - "Ô", - "Õ", - "Ö", - "×", - "Ø", - "Ù", - "Ú", - "Û", - "Ü", - "Ý", - "Þ", - "ß", - "à", - "á", - "â", - "ã", - "ä", - "å", - "æ", - "ç", - "è", - "é", - "ê", - "ë", - "ì", - "í", - "î", - "ï", - "ð", - "ñ", - "ò", - "ó", - "ô", - "õ", - "ö", - "÷", - "ø", - "ù", - "ú", - "û", - "ü", - "ý", - "þ", - "ÿ", - "Œ", - "œ", - "Š", - "š", - "Ÿ", - "ƒ", - "ˆ", - "˜", - "Α", - "Β", - "Γ", - "Δ", - "Ε", - "Ζ", - "Η", - "Θ", - "Ι", - "Κ", - "Λ", - "Μ", - "Ν", - "Ξ", - "Ο", - "Π", - "Ρ", - "Σ", - "Τ", - "Υ", - "Φ", - "Χ", - "Ψ", - "Ω", - "α", - "β", - "γ", - "δ", - "ε", - "ζ", - "η", - "θ", - "ι", - "κ", - "λ", - "μ", - "ν", - "ξ", - "ο", - "π", - "ρ", - "ς", - "σ", - "τ", - "υ", - "φ", - "χ", - "ψ", - "ω", - "ϑ", - "ϒ", - "ϖ", - " ", - " ", - " ", - "‌", - "‍", - "‎", - "‏", - "–", - "—", - "‘", - "’", - "‚", - "“", - "”", - "„", - "†", - "‡", - "•", - "…", - "‰", - "′", - "″", - "‹", - "›", - "‾", - "⁄", - "€", - "ℑ", - "℘", - "ℜ", - "™", - "ℵ", - "←", - "↑", - "→", - "↓", - "↔", - "↵", - "⇐", - "⇑", - "⇒", - "⇓", - "⇔", - "∀", - "∂", - "∃", - "∅", - "∇", - "∈", - "∉", - "∋", - "∏", - "∑", - "−", - "∗", - "√", - "∝", - "∞", - "∠", - "∧", - "∨", - "∩", - "∪", - "∫", - "∴", - "∼", - "≅", - "≈", - "≠", - "≡", - "≤", - "≥", - "⊂", - "⊃", - "⊄", - "⊆", - "⊇", - "⊕", - "⊗", - "⊥", - "⋅", - "⌈", - "⌉", - "⌊", - "⌋", - "⟨", - "⟩", - "◊", - "♠", - "♣", - "♥", - "♦" + """, + "&", + "<", + ">", + " ", + "¡", + "¢", + "£", + "¤", + "¥", + "¦", + "§", + "¨", + "©", + "ª", + "«", + "¬", + "­", + "®", + "¯", + "°", + "±", + "²", + "³", + "´", + "µ", + "¶", + "·", + "¸", + "¹", + "º", + "»", + "¼", + "½", + "¾", + "¿", + "À", + "Á", + "Â", + "Ã", + "Ä", + "Å", + "Æ", + "Ç", + "È", + "É", + "Ê", + "Ë", + "Ì", + "Í", + "Î", + "Ï", + "Ð", + "Ñ", + "Ò", + "Ó", + "Ô", + "Õ", + "Ö", + "×", + "Ø", + "Ù", + "Ú", + "Û", + "Ü", + "Ý", + "Þ", + "ß", + "à", + "á", + "â", + "ã", + "ä", + "å", + "æ", + "ç", + "è", + "é", + "ê", + "ë", + "ì", + "í", + "î", + "ï", + "ð", + "ñ", + "ò", + "ó", + "ô", + "õ", + "ö", + "÷", + "ø", + "ù", + "ú", + "û", + "ü", + "ý", + "þ", + "ÿ", + "Œ", + "œ", + "Š", + "š", + "Ÿ", + "ƒ", + "ˆ", + "˜", + "Α", + "Β", + "Γ", + "Δ", + "Ε", + "Ζ", + "Η", + "Θ", + "Ι", + "Κ", + "Λ", + "Μ", + "Ν", + "Ξ", + "Ο", + "Π", + "Ρ", + "Σ", + "Τ", + "Υ", + "Φ", + "Χ", + "Ψ", + "Ω", + "α", + "β", + "γ", + "δ", + "ε", + "ζ", + "η", + "θ", + "ι", + "κ", + "λ", + "μ", + "ν", + "ξ", + "ο", + "π", + "ρ", + "ς", + "σ", + "τ", + "υ", + "φ", + "χ", + "ψ", + "ω", + "ϑ", + "ϒ", + "ϖ", + " ", + " ", + " ", + "‌", + "‍", + "‎", + "‏", + "–", + "—", + "‘", + "’", + "‚", + "“", + "”", + "„", + "†", + "‡", + "•", + "…", + "‰", + "′", + "″", + "‹", + "›", + "‾", + "⁄", + "€", + "ℑ", + "℘", + "ℜ", + "™", + "ℵ", + "←", + "↑", + "→", + "↓", + "↔", + "↵", + "⇐", + "⇑", + "⇒", + "⇓", + "⇔", + "∀", + "∂", + "∃", + "∅", + "∇", + "∈", + "∉", + "∋", + "∏", + "∑", + "−", + "∗", + "√", + "∝", + "∞", + "∠", + "∧", + "∨", + "∩", + "∪", + "∫", + "∴", + "∼", + "≅", + "≈", + "≠", + "≡", + "≤", + "≥", + "⊂", + "⊃", + "⊄", + "⊆", + "⊇", + "⊕", + "⊗", + "⊥", + "⋅", + "⌈", + "⌉", + "⌊", + "⌋", + "⟨", + "⟩", + "◊", + "♠", + "♣", + "♥", + "♦" ); foreach ($map as $str) { diff --git a/ext/standard/tests/strings/html_entity_decode_html5.phpt b/ext/standard/tests/strings/html_entity_decode_html5.phpt index 6e0d4cf167..81f692c5dc 100644 --- a/ext/standard/tests/strings/html_entity_decode_html5.phpt +++ b/ext/standard/tests/strings/html_entity_decode_html5.phpt @@ -3,2131 +3,2131 @@ html_entity_decode() conformance check (HTML 5) --FILE-- <?php $map = array( - "Æ", - "&", - "Á", - "Ă", - "Â", - "А", - "𝔄", - "À", - "Α", - "Ā", - "⩓", - "Ą", - "𝔸", - "⁡", - "Å", - "𝒜", - "≔", - "Ã", - "Ä", - "∖", - "⫧", - "⌆", - "Б", - "∵", - "ℬ", - "Β", - "𝔅", - "𝔹", - "˘", - "ℬ", - "≎", - "Ч", - "©", - "Ć", - "⋒", - "ⅅ", - "ℭ", - "Č", - "Ç", - "Ĉ", - "∰", - "Ċ", - "¸", - "·", - "ℭ", - "Χ", - "⊙", - "⊖", - "⊕", - "⊗", - "∲", - "”", - "’", - "∷", - "⩴", - "≡", - "∯", - "∮", - "ℂ", - "∐", - "∳", - "⨯", - "𝒞", - "⋓", - "≍", - "ⅅ", - "⤑", - "Ђ", - "Ѕ", - "Џ", - "‡", - "↡", - "⫤", - "Ď", - "Д", - "∇", - "Δ", - "𝔇", - "´", - "˙", - "˝", - "`", - "˜", - "⋄", - "ⅆ", - "𝔻", - "¨", - "⃜", - "≐", - "∯", - "¨", - "⇓", - "⇐", - "⇔", - "⫤", - "⟸", - "⟺", - "⟹", - "⇒", - "⊨", - "⇑", - "⇕", - "∥", - "↓", - "⤓", - "⇵", - "̑", - "⥐", - "⥞", - "↽", - "⥖", - "⥟", - "⇁", - "⥗", - "⊤", - "↧", - "⇓", - "𝒟", - "Đ", - "Ŋ", - "Ð", - "É", - "Ě", - "Ê", - "Э", - "Ė", - "𝔈", - "È", - "∈", - "Ē", - "◻", - "▫", - "Ę", - "𝔼", - "Ε", - "⩵", - "≂", - "⇌", - "ℰ", - "⩳", - "Η", - "Ë", - "∃", - "ⅇ", - "Ф", - "𝔉", - "◼", - "▪", - "𝔽", - "∀", - "ℱ", - "ℱ", - "Ѓ", - ">", - "Γ", - "Ϝ", - "Ğ", - "Ģ", - "Ĝ", - "Г", - "Ġ", - "𝔊", - "⋙", - "𝔾", - "≥", - "⋛", - "≧", - "⪢", - "≷", - "⩾", - "≳", - "𝒢", - "≫", - "Ъ", - "ˇ", - "^", - "Ĥ", - "ℌ", - "ℋ", - "ℍ", - "─", - "ℋ", - "Ħ", - "≎", - "≏", - "Е", - "IJ", - "Ё", - "Í", - "Î", - "И", - "İ", - "ℑ", - "Ì", - "ℑ", - "Ī", - "ⅈ", - "⇒", - "∬", - "∫", - "⋂", - "⁣", - "⁢", - "Į", - "𝕀", - "Ι", - "ℐ", - "Ĩ", - "І", - "Ï", - "Ĵ", - "Й", - "𝔍", - "𝕁", - "𝒥", - "Ј", - "Є", - "Х", - "Ќ", - "Κ", - "Ķ", - "К", - "𝔎", - "𝕂", - "𝒦", - "Љ", - "<", - "Ĺ", - "Λ", - "⟪", - "ℒ", - "↞", - "Ľ", - "Ļ", - "Л", - "⟨", - "←", - "⇤", - "⇆", - "⌈", - "⟦", - "⥡", - "⇃", - "⥙", - "⌊", - "↔", - "⥎", - "⊣", - "↤", - "⥚", - "⊲", - "⧏", - "⊴", - "⥑", - "⥠", - "↿", - "⥘", - "↼", - "⥒", - "⇐", - "⇔", - "⋚", - "≦", - "≶", - "⪡", - "⩽", - "≲", - "𝔏", - "⋘", - "⇚", - "Ŀ", - "⟵", - "⟷", - "⟶", - "⟸", - "⟺", - "⟹", - "𝕃", - "↙", - "↘", - "ℒ", - "↰", - "Ł", - "≪", - "⤅", - "М", - " ", - "ℳ", - "𝔐", - "∓", - "𝕄", - "ℳ", - "Μ", - "Њ", - "Ń", - "Ň", - "Ņ", - "Н", - "​", - "​", - "​", - "​", - "≫", - "≪", - "
", - "𝔑", - "⁠", - " ", - "ℕ", - "⫬", - "≢", - "≭", - "∦", - "∉", - "≠", - "≂̸", - "∄", - "≯", - "≱", - "≧̸", - "≫̸", - "≹", - "⩾̸", - "≵", - "≎̸", - "≏̸", - "⋪", - "⧏̸", - "⋬", - "≮", - "≰", - "≸", - "≪̸", - "⩽̸", - "≴", - "⪢̸", - "⪡̸", - "⊀", - "⪯̸", - "⋠", - "∌", - "⋫", - "⧐̸", - "⋭", - "⊏̸", - "⋢", - "⊐̸", - "⋣", - "⊂⃒", - "⊈", - "⊁", - "⪰̸", - "⋡", - "≿̸", - "⊃⃒", - "⊉", - "≁", - "≄", - "≇", - "≉", - "∤", - "𝒩", - "Ñ", - "Ν", - "Œ", - "Ó", - "Ô", - "О", - "Ő", - "𝔒", - "Ò", - "Ō", - "Ω", - "Ο", - "𝕆", - "“", - "‘", - "⩔", - "𝒪", - "Ø", - "Õ", - "⨷", - "Ö", - "‾", - "⏞", - "⎴", - "⏜", - "∂", - "П", - "𝔓", - "Φ", - "Π", - "±", - "ℌ", - "ℙ", - "⪻", - "≺", - "⪯", - "≼", - "≾", - "″", - "∏", - "∷", - "∝", - "𝒫", - "Ψ", - """, - "𝔔", - "ℚ", - "𝒬", - "⤐", - "®", - "Ŕ", - "⟫", - "↠", - "⤖", - "Ř", - "Ŗ", - "Р", - "ℜ", - "∋", - "⇋", - "⥯", - "ℜ", - "Ρ", - "⟩", - "→", - "⇥", - "⇄", - "⌉", - "⟧", - "⥝", - "⇂", - "⥕", - "⌋", - "⊢", - "↦", - "⥛", - "⊳", - "⧐", - "⊵", - "⥏", - "⥜", - "↾", - "⥔", - "⇀", - "⥓", - "⇒", - "ℝ", - "⥰", - "⇛", - "ℛ", - "↱", - "⧴", - "Щ", - "Ш", - "Ь", - "Ś", - "⪼", - "Š", - "Ş", - "Ŝ", - "С", - "𝔖", - "↓", - "←", - "→", - "↑", - "Σ", - "∘", - "𝕊", - "√", - "□", - "⊓", - "⊏", - "⊑", - "⊐", - "⊒", - "⊔", - "𝒮", - "⋆", - "⋐", - "⋐", - "⊆", - "≻", - "⪰", - "≽", - "≿", - "∋", - "∑", - "⋑", - "⊃", - "⊇", - "⋑", - "Þ", - "™", - "Ћ", - "Ц", - "	", - "Τ", - "Ť", - "Ţ", - "Т", - "𝔗", - "∴", - "Θ", - "  ", - " ", - "∼", - "≃", - "≅", - "≈", - "𝕋", - "⃛", - "𝒯", - "Ŧ", - "Ú", - "↟", - "⥉", - "Ў", - "Ŭ", - "Û", - "У", - "Ű", - "𝔘", - "Ù", - "Ū", - "_", - "⏟", - "⎵", - "⏝", - "⋃", - "⊎", - "Ų", - "𝕌", - "↑", - "⤒", - "⇅", - "↕", - "⥮", - "⊥", - "↥", - "⇑", - "⇕", - "↖", - "↗", - "ϒ", - "Υ", - "Ů", - "𝒰", - "Ũ", - "Ü", - "⊫", - "⫫", - "В", - "⊩", - "⫦", - "⋁", - "‖", - "‖", - "∣", - "|", - "❘", - "≀", - " ", - "𝔙", - "𝕍", - "𝒱", - "⊪", - "Ŵ", - "⋀", - "𝔚", - "𝕎", - "𝒲", - "𝔛", - "Ξ", - "𝕏", - "𝒳", - "Я", - "Ї", - "Ю", - "Ý", - "Ŷ", - "Ы", - "𝔜", - "𝕐", - "𝒴", - "Ÿ", - "Ж", - "Ź", - "Ž", - "З", - "Ż", - "​", - "Ζ", - "ℨ", - "ℤ", - "𝒵", - "á", - "ă", - "∾", - "∾̳", - "∿", - "â", - "´", - "а", - "æ", - "⁡", - "𝔞", - "à", - "ℵ", - "ℵ", - "α", - "ā", - "⨿", - "&", - "∧", - "⩕", - "⩜", - "⩘", - "⩚", - "∠", - "⦤", - "∠", - "∡", - "⦨", - "⦩", - "⦪", - "⦫", - "⦬", - "⦭", - "⦮", - "⦯", - "∟", - "⊾", - "⦝", - "∢", - "Å", - "⍼", - "ą", - "𝕒", - "≈", - "⩰", - "⩯", - "≊", - "≋", - "'", - "≈", - "≊", - "å", - "𝒶", - "*", - "≈", - "≍", - "ã", - "ä", - "∳", - "⨑", - "⫭", - "≌", - "϶", - "‵", - "∽", - "⋍", - "⊽", - "⌅", - "⌅", - "⎵", - "⎶", - "≌", - "б", - "„", - "∵", - "∵", - "⦰", - "϶", - "ℬ", - "β", - "ℶ", - "≬", - "𝔟", - "⋂", - "◯", - "⋃", - "⨀", - "⨁", - "⨂", - "⨆", - "★", - "▽", - "△", - "⨄", - "⋁", - "⋀", - "⤍", - "⧫", - "▪", - "▴", - "▾", - "◂", - "▸", - "␣", - "▒", - "░", - "▓", - "█", - "=⃥", - "≡⃥", - "⌐", - "𝕓", - "⊥", - "⊥", - "⋈", - "╗", - "╔", - "╖", - "╓", - "═", - "╦", - "╩", - "╤", - "╧", - "╝", - "╚", - "╜", - "╙", - "║", - "╬", - "╣", - "╠", - "╫", - "╢", - "╟", - "⧉", - "╕", - "╒", - "┐", - "┌", - "─", - "╥", - "╨", - "┬", - "┴", - "⊟", - "⊞", - "⊠", - "╛", - "╘", - "┘", - "└", - "│", - "╪", - "╡", - "╞", - "┼", - "┤", - "├", - "‵", - "˘", - "¦", - "𝒷", - "⁏", - "∽", - "⋍", - "\", - "⧅", - "⟈", - "•", - "•", - "≎", - "⪮", - "≏", - "≏", - "ć", - "∩", - "⩄", - "⩉", - "⩋", - "⩇", - "⩀", - "∩︀", - "⁁", - "ˇ", - "⩍", - "č", - "ç", - "ĉ", - "⩌", - "⩐", - "ċ", - "¸", - "⦲", - "¢", - "·", - "𝔠", - "ч", - "✓", - "✓", - "χ", - "○", - "⧃", - "ˆ", - "≗", - "↺", - "↻", - "®", - "Ⓢ", - "⊛", - "⊚", - "⊝", - "≗", - "⨐", - "⫯", - "⧂", - "♣", - "♣", - ":", - "≔", - "≔", - ",", - "@", - "∁", - "∘", - "∁", - "ℂ", - "≅", - "⩭", - "∮", - "𝕔", - "∐", - "©", - "℗", - "↵", - "✗", - "𝒸", - "⫏", - "⫑", - "⫐", - "⫒", - "⋯", - "⤸", - "⤵", - "⋞", - "⋟", - "↶", - "⤽", - "∪", - "⩈", - "⩆", - "⩊", - "⊍", - "⩅", - "∪︀", - "↷", - "⤼", - "⋞", - "⋟", - "⋎", - "⋏", - "¤", - "↶", - "↷", - "⋎", - "⋏", - "∲", - "∱", - "⌭", - "⇓", - "⥥", - "†", - "ℸ", - "↓", - "‐", - "⊣", - "⤏", - "˝", - "ď", - "д", - "ⅆ", - "‡", - "⇊", - "⩷", - "°", - "δ", - "⦱", - "⥿", - "𝔡", - "⇃", - "⇂", - "⋄", - "⋄", - "♦", - "♦", - "¨", - "ϝ", - "⋲", - "÷", - "÷", - "⋇", - "⋇", - "ђ", - "⌞", - "⌍", - "$", - "𝕕", - "˙", - "≐", - "≑", - "∸", - "∔", - "⊡", - "⌆", - "↓", - "⇊", - "⇃", - "⇂", - "⤐", - "⌟", - "⌌", - "𝒹", - "ѕ", - "⧶", - "đ", - "⋱", - "▿", - "▾", - "⇵", - "⥯", - "⦦", - "џ", - "⟿", - "⩷", - "≑", - "é", - "⩮", - "ě", - "≖", - "ê", - "≕", - "э", - "ė", - "ⅇ", - "≒", - "𝔢", - "⪚", - "è", - "⪖", - "⪘", - "⪙", - "⏧", - "ℓ", - "⪕", - "⪗", - "ē", - "∅", - "∅", - "∅", - " ", - " ", - " ", - "ŋ", - " ", - "ę", - "𝕖", - "⋕", - "⧣", - "⩱", - "ε", - "ε", - "ϵ", - "≖", - "≕", - "≂", - "⪖", - "⪕", - "=", - "≟", - "≡", - "⩸", - "⧥", - "≓", - "⥱", - "ℯ", - "≐", - "≂", - "η", - "ð", - "ë", - "€", - "!", - "∃", - "ℰ", - "ⅇ", - "≒", - "ф", - "♀", - "ffi", - "ff", - "ffl", - "𝔣", - "fi", - "fj", - "♭", - "fl", - "▱", - "ƒ", - "𝕗", - "∀", - "⋔", - "⫙", - "⨍", - "½", - "⅓", - "¼", - "⅕", - "⅙", - "⅛", - "⅔", - "⅖", - "¾", - "⅗", - "⅜", - "⅘", - "⅚", - "⅝", - "⅞", - "⁄", - "⌢", - "𝒻", - "≧", - "⪌", - "ǵ", - "γ", - "ϝ", - "⪆", - "ğ", - "ĝ", - "г", - "ġ", - "≥", - "⋛", - "≥", - "≧", - "⩾", - "⩾", - "⪩", - "⪀", - "⪂", - "⪄", - "⋛︀", - "⪔", - "𝔤", - "≫", - "⋙", - "ℷ", - "ѓ", - "≷", - "⪒", - "⪥", - "⪤", - "≩", - "⪊", - "⪊", - "⪈", - "⪈", - "≩", - "⋧", - "𝕘", - "`", - "ℊ", - "≳", - "⪎", - "⪐", - ">", - "⪧", - "⩺", - "⋗", - "⦕", - "⩼", - "⪆", - "⥸", - "⋗", - "⋛", - "⪌", - "≷", - "≳", - "≩︀", - "≩︀", - "⇔", - " ", - "½", - "ℋ", - "ъ", - "↔", - "⥈", - "↭", - "ℏ", - "ĥ", - "♥", - "♥", - "…", - "⊹", - "𝔥", - "⤥", - "⤦", - "⇿", - "∻", - "↩", - "↪", - "𝕙", - "―", - "𝒽", - "ℏ", - "ħ", - "⁃", - "‐", - "í", - "⁣", - "î", - "и", - "е", - "¡", - "⇔", - "𝔦", - "ì", - "ⅈ", - "⨌", - "∭", - "⧜", - "℩", - "ij", - "ī", - "ℑ", - "ℐ", - "ℑ", - "ı", - "⊷", - "Ƶ", - "∈", - "℅", - "∞", - "⧝", - "ı", - "∫", - "⊺", - "ℤ", - "⊺", - "⨗", - "⨼", - "ё", - "į", - "𝕚", - "ι", - "⨼", - "¿", - "𝒾", - "∈", - "⋹", - "⋵", - "⋴", - "⋳", - "∈", - "⁢", - "ĩ", - "і", - "ï", - "ĵ", - "й", - "𝔧", - "ȷ", - "𝕛", - "𝒿", - "ј", - "є", - "κ", - "ϰ", - "ķ", - "к", - "𝔨", - "ĸ", - "х", - "ќ", - "𝕜", - "𝓀", - "⇚", - "⇐", - "⤛", - "⤎", - "≦", - "⪋", - "⥢", - "ĺ", - "⦴", - "ℒ", - "λ", - "⟨", - "⦑", - "⟨", - "⪅", - "«", - "←", - "⇤", - "⤟", - "⤝", - "↩", - "↫", - "⤹", - "⥳", - "↢", - "⪫", - "⤙", - "⪭", - "⪭︀", - "⤌", - "❲", - "{", - "[", - "⦋", - "⦏", - "⦍", - "ľ", - "ļ", - "⌈", - "{", - "л", - "⤶", - "“", - "„", - "⥧", - "⥋", - "↲", - "≤", - "←", - "↢", - "↽", - "↼", - "⇇", - "↔", - "⇆", - "⇋", - "↭", - "⋋", - "⋚", - "≤", - "≦", - "⩽", - "⩽", - "⪨", - "⩿", - "⪁", - "⪃", - "⋚︀", - "⪓", - "⪅", - "⋖", - "⋚", - "⪋", - "≶", - "≲", - "⥼", - "⌊", - "𝔩", - "≶", - "⪑", - "↽", - "↼", - "⥪", - "▄", - "љ", - "≪", - "⇇", - "⌞", - "⥫", - "◺", - "ŀ", - "⎰", - "⎰", - "≨", - "⪉", - "⪉", - "⪇", - "⪇", - "≨", - "⋦", - "⟬", - "⇽", - "⟦", - "⟵", - "⟷", - "⟼", - "⟶", - "↫", - "↬", - "⦅", - "𝕝", - "⨭", - "⨴", - "∗", - "_", - "◊", - "◊", - "⧫", - "(", - "⦓", - "⇆", - "⌟", - "⇋", - "⥭", - "‎", - "⊿", - "‹", - "𝓁", - "↰", - "≲", - "⪍", - "⪏", - "[", - "‘", - "‚", - "ł", - "<", - "⪦", - "⩹", - "⋖", - "⋋", - "⋉", - "⥶", - "⩻", - "⦖", - "◃", - "⊴", - "◂", - "⥊", - "⥦", - "≨︀", - "≨︀", - "∺", - "¯", - "♂", - "✠", - "✠", - "↦", - "↦", - "↧", - "↤", - "↥", - "▮", - "⨩", - "м", - "—", - "∡", - "𝔪", - "℧", - "µ", - "∣", - "*", - "⫰", - "·", - "−", - "⊟", - "∸", - "⨪", - "⫛", - "…", - "∓", - "⊧", - "𝕞", - "∓", - "𝓂", - "∾", - "μ", - "⊸", - "⊸", - "⋙̸", - "≫⃒", - "≫̸", - "⇍", - "⇎", - "⋘̸", - "≪⃒", - "≪̸", - "⇏", - "⊯", - "⊮", - "∇", - "ń", - "∠⃒", - "≉", - "⩰̸", - "≋̸", - "ʼn", - "≉", - "♮", - "♮", - "ℕ", - " ", - "≎̸", - "≏̸", - "⩃", - "ň", - "ņ", - "≇", - "⩭̸", - "⩂", - "н", - "–", - "≠", - "⇗", - "⤤", - "↗", - "↗", - "≐̸", - "≢", - "⤨", - "≂̸", - "∄", - "∄", - "𝔫", - "≧̸", - "≱", - "≱", - "≧̸", - "⩾̸", - "⩾̸", - "≵", - "≯", - "≯", - "⇎", - "↮", - "⫲", - "∋", - "⋼", - "⋺", - "∋", - "њ", - "⇍", - "≦̸", - "↚", - "‥", - "≰", - "↚", - "↮", - "≰", - "≦̸", - "⩽̸", - "⩽̸", - "≮", - "≴", - "≮", - "⋪", - "⋬", - "∤", - "𝕟", - "¬", - "∉", - "⋹̸", - "⋵̸", - "∉", - "⋷", - "⋶", - "∌", - "∌", - "⋾", - "⋽", - "∦", - "∦", - "⫽⃥", - "∂̸", - "⨔", - "⊀", - "⋠", - "⪯̸", - "⊀", - "⪯̸", - "⇏", - "↛", - "⤳̸", - "↝̸", - "↛", - "⋫", - "⋭", - "⊁", - "⋡", - "⪰̸", - "𝓃", - "∤", - "∦", - "≁", - "≄", - "≄", - "∤", - "∦", - "⋢", - "⋣", - "⊄", - "⫅̸", - "⊈", - "⊂⃒", - "⊈", - "⫅̸", - "⊁", - "⪰̸", - "⊅", - "⫆̸", - "⊉", - "⊃⃒", - "⊉", - "⫆̸", - "≹", - "ñ", - "≸", - "⋪", - "⋬", - "⋫", - "⋭", - "ν", - "#", - "№", - " ", - "⊭", - "⤄", - "≍⃒", - "⊬", - "≥⃒", - ">⃒", - "⧞", - "⤂", - "≤⃒", - "<⃒", - "⊴⃒", - "⤃", - "⊵⃒", - "∼⃒", - "⇖", - "⤣", - "↖", - "↖", - "⤧", - "Ⓢ", - "ó", - "⊛", - "⊚", - "ô", - "о", - "⊝", - "ő", - "⨸", - "⊙", - "⦼", - "œ", - "⦿", - "𝔬", - "˛", - "ò", - "⧁", - "⦵", - "Ω", - "∮", - "↺", - "⦾", - "⦻", - "‾", - "⧀", - "ō", - "ω", - "ο", - "⦶", - "⊖", - "𝕠", - "⦷", - "⦹", - "⊕", - "∨", - "↻", - "⩝", - "ℴ", - "ℴ", - "ª", - "º", - "⊶", - "⩖", - "⩗", - "⩛", - "ℴ", - "ø", - "⊘", - "õ", - "⊗", - "⨶", - "ö", - "⌽", - "∥", - "¶", - "∥", - "⫳", - "⫽", - "∂", - "п", - "%", - ".", - "‰", - "⊥", - "‱", - "𝔭", - "φ", - "ϕ", - "ℳ", - "☎", - "π", - "⋔", - "ϖ", - "ℏ", - "ℎ", - "ℏ", - "+", - "⨣", - "⊞", - "⨢", - "∔", - "⨥", - "⩲", - "±", - "⨦", - "⨧", - "±", - "⨕", - "𝕡", - "£", - "≺", - "⪳", - "⪷", - "≼", - "⪯", - "≺", - "⪷", - "≼", - "⪯", - "⪹", - "⪵", - "⋨", - "≾", - "′", - "ℙ", - "⪵", - "⪹", - "⋨", - "∏", - "⌮", - "⌒", - "⌓", - "∝", - "∝", - "≾", - "⊰", - "𝓅", - "ψ", - " ", - "𝔮", - "⨌", - "𝕢", - "⁗", - "𝓆", - "ℍ", - "⨖", - "?", - "≟", - """, - "⇛", - "⇒", - "⤜", - "⤏", - "⥤", - "∽̱", - "ŕ", - "√", - "⦳", - "⟩", - "⦒", - "⦥", - "⟩", - "»", - "→", - "⥵", - "⇥", - "⤠", - "⤳", - "⤞", - "↪", - "↬", - "⥅", - "⥴", - "↣", - "↝", - "⤚", - "∶", - "ℚ", - "⤍", - "❳", - "}", - "]", - "⦌", - "⦎", - "⦐", - "ř", - "ŗ", - "⌉", - "}", - "р", - "⤷", - "⥩", - "”", - "”", - "↳", - "ℜ", - "ℛ", - "ℜ", - "ℝ", - "▭", - "®", - "⥽", - "⌋", - "𝔯", - "⇁", - "⇀", - "⥬", - "ρ", - "ϱ", - "→", - "↣", - "⇁", - "⇀", - "⇄", - "⇌", - "⇉", - "↝", - "⋌", - "˚", - "≓", - "⇄", - "⇌", - "‏", - "⎱", - "⎱", - "⫮", - "⟭", - "⇾", - "⟧", - "⦆", - "𝕣", - "⨮", - "⨵", - ")", - "⦔", - "⨒", - "⇉", - "›", - "𝓇", - "↱", - "]", - "’", - "’", - "⋌", - "⋊", - "▹", - "⊵", - "▸", - "⧎", - "⥨", - "℞", - "ś", - "‚", - "≻", - "⪴", - "⪸", - "š", - "≽", - "⪰", - "ş", - "ŝ", - "⪶", - "⪺", - "⋩", - "⨓", - "≿", - "с", - "⋅", - "⊡", - "⩦", - "⇘", - "⤥", - "↘", - "↘", - "§", - ";", - "⤩", - "∖", - "∖", - "✶", - "𝔰", - "⌢", - "♯", - "щ", - "ш", - "∣", - "∥", - "­", - "σ", - "ς", - "ς", - "∼", - "⩪", - "≃", - "≃", - "⪞", - "⪠", - "⪝", - "⪟", - "≆", - "⨤", - "⥲", - "←", - "∖", - "⨳", - "⧤", - "∣", - "⌣", - "⪪", - "⪬", - "⪬︀", - "ь", - "/", - "⧄", - "⌿", - "𝕤", - "♠", - "♠", - "∥", - "⊓", - "⊓︀", - "⊔", - "⊔︀", - "⊏", - "⊑", - "⊏", - "⊑", - "⊐", - "⊒", - "⊐", - "⊒", - "□", - "□", - "▪", - "▪", - "→", - "𝓈", - "∖", - "⌣", - "⋆", - "☆", - "★", - "ϵ", - "ϕ", - "¯", - "⊂", - "⫅", - "⪽", - "⊆", - "⫃", - "⫁", - "⫋", - "⊊", - "⪿", - "⥹", - "⊂", - "⊆", - "⫅", - "⊊", - "⫋", - "⫇", - "⫕", - "⫓", - "≻", - "⪸", - "≽", - "⪰", - "⪺", - "⪶", - "⋩", - "≿", - "∑", - "♪", - "⊃", - "¹", - "²", - "³", - "⫆", - "⪾", - "⫘", - "⊇", - "⫄", - "⟉", - "⫗", - "⥻", - "⫂", - "⫌", - "⊋", - "⫀", - "⊃", - "⊇", - "⫆", - "⊋", - "⫌", - "⫈", - "⫔", - "⫖", - "⇙", - "⤦", - "↙", - "↙", - "⤪", - "ß", - "⌖", - "τ", - "⎴", - "ť", - "ţ", - "т", - "⃛", - "⌕", - "𝔱", - "∴", - "∴", - "θ", - "ϑ", - "ϑ", - "≈", - "∼", - " ", - "≈", - "∼", - "þ", - "˜", - "×", - "⊠", - "⨱", - "⨰", - "∭", - "⤨", - "⊤", - "⌶", - "⫱", - "𝕥", - "⫚", - "⤩", - "‴", - "™", - "▵", - "▿", - "◃", - "⊴", - "≜", - "▹", - "⊵", - "◬", - "≜", - "⨺", - "⨹", - "⧍", - "⨻", - "⏢", - "𝓉", - "ц", - "ћ", - "ŧ", - "≬", - "↞", - "↠", - "⇑", - "⥣", - "ú", - "↑", - "ў", - "ŭ", - "û", - "у", - "⇅", - "ű", - "⥮", - "⥾", - "𝔲", - "ù", - "↿", - "↾", - "▀", - "⌜", - "⌜", - "⌏", - "◸", - "ū", - "¨", - "ų", - "𝕦", - "↑", - "↕", - "↿", - "↾", - "⊎", - "υ", - "ϒ", - "υ", - "⇈", - "⌝", - "⌝", - "⌎", - "ů", - "◹", - "𝓊", - "⋰", - "ũ", - "▵", - "▴", - "⇈", - "ü", - "⦧", - "⇕", - "⫨", - "⫩", - "⊨", - "⦜", - "ϵ", - "ϰ", - "∅", - "ϕ", - "ϖ", - "∝", - "↕", - "ϱ", - "ς", - "⊊︀", - "⫋︀", - "⊋︀", - "⫌︀", - "ϑ", - "⊲", - "⊳", - "в", - "⊢", - "∨", - "⊻", - "≚", - "⋮", - "|", - "|", - "𝔳", - "⊲", - "⊂⃒", - "⊃⃒", - "𝕧", - "∝", - "⊳", - "𝓋", - "⫋︀", - "⊊︀", - "⫌︀", - "⊋︀", - "⦚", - "ŵ", - "⩟", - "∧", - "≙", - "℘", - "𝔴", - "𝕨", - "℘", - "≀", - "≀", - "𝓌", - "⋂", - "◯", - "⋃", - "▽", - "𝔵", - "⟺", - "⟷", - "ξ", - "⟸", - "⟵", - "⟼", - "⋻", - "⨀", - "𝕩", - "⨁", - "⨂", - "⟹", - "⟶", - "𝓍", - "⨆", - "⨄", - "△", - "⋁", - "⋀", - "ý", - "я", - "ŷ", - "ы", - "¥", - "𝔶", - "ї", - "𝕪", - "𝓎", - "ю", - "ÿ", - "ź", - "ž", - "з", - "ż", - "ℨ", - "ζ", - "𝔷", - "ж", - "⇝", - "𝕫", - "𝓏", - "‍", - "‌", + "Æ", + "&", + "Á", + "Ă", + "Â", + "А", + "𝔄", + "À", + "Α", + "Ā", + "⩓", + "Ą", + "𝔸", + "⁡", + "Å", + "𝒜", + "≔", + "Ã", + "Ä", + "∖", + "⫧", + "⌆", + "Б", + "∵", + "ℬ", + "Β", + "𝔅", + "𝔹", + "˘", + "ℬ", + "≎", + "Ч", + "©", + "Ć", + "⋒", + "ⅅ", + "ℭ", + "Č", + "Ç", + "Ĉ", + "∰", + "Ċ", + "¸", + "·", + "ℭ", + "Χ", + "⊙", + "⊖", + "⊕", + "⊗", + "∲", + "”", + "’", + "∷", + "⩴", + "≡", + "∯", + "∮", + "ℂ", + "∐", + "∳", + "⨯", + "𝒞", + "⋓", + "≍", + "ⅅ", + "⤑", + "Ђ", + "Ѕ", + "Џ", + "‡", + "↡", + "⫤", + "Ď", + "Д", + "∇", + "Δ", + "𝔇", + "´", + "˙", + "˝", + "`", + "˜", + "⋄", + "ⅆ", + "𝔻", + "¨", + "⃜", + "≐", + "∯", + "¨", + "⇓", + "⇐", + "⇔", + "⫤", + "⟸", + "⟺", + "⟹", + "⇒", + "⊨", + "⇑", + "⇕", + "∥", + "↓", + "⤓", + "⇵", + "̑", + "⥐", + "⥞", + "↽", + "⥖", + "⥟", + "⇁", + "⥗", + "⊤", + "↧", + "⇓", + "𝒟", + "Đ", + "Ŋ", + "Ð", + "É", + "Ě", + "Ê", + "Э", + "Ė", + "𝔈", + "È", + "∈", + "Ē", + "◻", + "▫", + "Ę", + "𝔼", + "Ε", + "⩵", + "≂", + "⇌", + "ℰ", + "⩳", + "Η", + "Ë", + "∃", + "ⅇ", + "Ф", + "𝔉", + "◼", + "▪", + "𝔽", + "∀", + "ℱ", + "ℱ", + "Ѓ", + ">", + "Γ", + "Ϝ", + "Ğ", + "Ģ", + "Ĝ", + "Г", + "Ġ", + "𝔊", + "⋙", + "𝔾", + "≥", + "⋛", + "≧", + "⪢", + "≷", + "⩾", + "≳", + "𝒢", + "≫", + "Ъ", + "ˇ", + "^", + "Ĥ", + "ℌ", + "ℋ", + "ℍ", + "─", + "ℋ", + "Ħ", + "≎", + "≏", + "Е", + "IJ", + "Ё", + "Í", + "Î", + "И", + "İ", + "ℑ", + "Ì", + "ℑ", + "Ī", + "ⅈ", + "⇒", + "∬", + "∫", + "⋂", + "⁣", + "⁢", + "Į", + "𝕀", + "Ι", + "ℐ", + "Ĩ", + "І", + "Ï", + "Ĵ", + "Й", + "𝔍", + "𝕁", + "𝒥", + "Ј", + "Є", + "Х", + "Ќ", + "Κ", + "Ķ", + "К", + "𝔎", + "𝕂", + "𝒦", + "Љ", + "<", + "Ĺ", + "Λ", + "⟪", + "ℒ", + "↞", + "Ľ", + "Ļ", + "Л", + "⟨", + "←", + "⇤", + "⇆", + "⌈", + "⟦", + "⥡", + "⇃", + "⥙", + "⌊", + "↔", + "⥎", + "⊣", + "↤", + "⥚", + "⊲", + "⧏", + "⊴", + "⥑", + "⥠", + "↿", + "⥘", + "↼", + "⥒", + "⇐", + "⇔", + "⋚", + "≦", + "≶", + "⪡", + "⩽", + "≲", + "𝔏", + "⋘", + "⇚", + "Ŀ", + "⟵", + "⟷", + "⟶", + "⟸", + "⟺", + "⟹", + "𝕃", + "↙", + "↘", + "ℒ", + "↰", + "Ł", + "≪", + "⤅", + "М", + " ", + "ℳ", + "𝔐", + "∓", + "𝕄", + "ℳ", + "Μ", + "Њ", + "Ń", + "Ň", + "Ņ", + "Н", + "​", + "​", + "​", + "​", + "≫", + "≪", + "
", + "𝔑", + "⁠", + " ", + "ℕ", + "⫬", + "≢", + "≭", + "∦", + "∉", + "≠", + "≂̸", + "∄", + "≯", + "≱", + "≧̸", + "≫̸", + "≹", + "⩾̸", + "≵", + "≎̸", + "≏̸", + "⋪", + "⧏̸", + "⋬", + "≮", + "≰", + "≸", + "≪̸", + "⩽̸", + "≴", + "⪢̸", + "⪡̸", + "⊀", + "⪯̸", + "⋠", + "∌", + "⋫", + "⧐̸", + "⋭", + "⊏̸", + "⋢", + "⊐̸", + "⋣", + "⊂⃒", + "⊈", + "⊁", + "⪰̸", + "⋡", + "≿̸", + "⊃⃒", + "⊉", + "≁", + "≄", + "≇", + "≉", + "∤", + "𝒩", + "Ñ", + "Ν", + "Œ", + "Ó", + "Ô", + "О", + "Ő", + "𝔒", + "Ò", + "Ō", + "Ω", + "Ο", + "𝕆", + "“", + "‘", + "⩔", + "𝒪", + "Ø", + "Õ", + "⨷", + "Ö", + "‾", + "⏞", + "⎴", + "⏜", + "∂", + "П", + "𝔓", + "Φ", + "Π", + "±", + "ℌ", + "ℙ", + "⪻", + "≺", + "⪯", + "≼", + "≾", + "″", + "∏", + "∷", + "∝", + "𝒫", + "Ψ", + """, + "𝔔", + "ℚ", + "𝒬", + "⤐", + "®", + "Ŕ", + "⟫", + "↠", + "⤖", + "Ř", + "Ŗ", + "Р", + "ℜ", + "∋", + "⇋", + "⥯", + "ℜ", + "Ρ", + "⟩", + "→", + "⇥", + "⇄", + "⌉", + "⟧", + "⥝", + "⇂", + "⥕", + "⌋", + "⊢", + "↦", + "⥛", + "⊳", + "⧐", + "⊵", + "⥏", + "⥜", + "↾", + "⥔", + "⇀", + "⥓", + "⇒", + "ℝ", + "⥰", + "⇛", + "ℛ", + "↱", + "⧴", + "Щ", + "Ш", + "Ь", + "Ś", + "⪼", + "Š", + "Ş", + "Ŝ", + "С", + "𝔖", + "↓", + "←", + "→", + "↑", + "Σ", + "∘", + "𝕊", + "√", + "□", + "⊓", + "⊏", + "⊑", + "⊐", + "⊒", + "⊔", + "𝒮", + "⋆", + "⋐", + "⋐", + "⊆", + "≻", + "⪰", + "≽", + "≿", + "∋", + "∑", + "⋑", + "⊃", + "⊇", + "⋑", + "Þ", + "™", + "Ћ", + "Ц", + "	", + "Τ", + "Ť", + "Ţ", + "Т", + "𝔗", + "∴", + "Θ", + "  ", + " ", + "∼", + "≃", + "≅", + "≈", + "𝕋", + "⃛", + "𝒯", + "Ŧ", + "Ú", + "↟", + "⥉", + "Ў", + "Ŭ", + "Û", + "У", + "Ű", + "𝔘", + "Ù", + "Ū", + "_", + "⏟", + "⎵", + "⏝", + "⋃", + "⊎", + "Ų", + "𝕌", + "↑", + "⤒", + "⇅", + "↕", + "⥮", + "⊥", + "↥", + "⇑", + "⇕", + "↖", + "↗", + "ϒ", + "Υ", + "Ů", + "𝒰", + "Ũ", + "Ü", + "⊫", + "⫫", + "В", + "⊩", + "⫦", + "⋁", + "‖", + "‖", + "∣", + "|", + "❘", + "≀", + " ", + "𝔙", + "𝕍", + "𝒱", + "⊪", + "Ŵ", + "⋀", + "𝔚", + "𝕎", + "𝒲", + "𝔛", + "Ξ", + "𝕏", + "𝒳", + "Я", + "Ї", + "Ю", + "Ý", + "Ŷ", + "Ы", + "𝔜", + "𝕐", + "𝒴", + "Ÿ", + "Ж", + "Ź", + "Ž", + "З", + "Ż", + "​", + "Ζ", + "ℨ", + "ℤ", + "𝒵", + "á", + "ă", + "∾", + "∾̳", + "∿", + "â", + "´", + "а", + "æ", + "⁡", + "𝔞", + "à", + "ℵ", + "ℵ", + "α", + "ā", + "⨿", + "&", + "∧", + "⩕", + "⩜", + "⩘", + "⩚", + "∠", + "⦤", + "∠", + "∡", + "⦨", + "⦩", + "⦪", + "⦫", + "⦬", + "⦭", + "⦮", + "⦯", + "∟", + "⊾", + "⦝", + "∢", + "Å", + "⍼", + "ą", + "𝕒", + "≈", + "⩰", + "⩯", + "≊", + "≋", + "'", + "≈", + "≊", + "å", + "𝒶", + "*", + "≈", + "≍", + "ã", + "ä", + "∳", + "⨑", + "⫭", + "≌", + "϶", + "‵", + "∽", + "⋍", + "⊽", + "⌅", + "⌅", + "⎵", + "⎶", + "≌", + "б", + "„", + "∵", + "∵", + "⦰", + "϶", + "ℬ", + "β", + "ℶ", + "≬", + "𝔟", + "⋂", + "◯", + "⋃", + "⨀", + "⨁", + "⨂", + "⨆", + "★", + "▽", + "△", + "⨄", + "⋁", + "⋀", + "⤍", + "⧫", + "▪", + "▴", + "▾", + "◂", + "▸", + "␣", + "▒", + "░", + "▓", + "█", + "=⃥", + "≡⃥", + "⌐", + "𝕓", + "⊥", + "⊥", + "⋈", + "╗", + "╔", + "╖", + "╓", + "═", + "╦", + "╩", + "╤", + "╧", + "╝", + "╚", + "╜", + "╙", + "║", + "╬", + "╣", + "╠", + "╫", + "╢", + "╟", + "⧉", + "╕", + "╒", + "┐", + "┌", + "─", + "╥", + "╨", + "┬", + "┴", + "⊟", + "⊞", + "⊠", + "╛", + "╘", + "┘", + "└", + "│", + "╪", + "╡", + "╞", + "┼", + "┤", + "├", + "‵", + "˘", + "¦", + "𝒷", + "⁏", + "∽", + "⋍", + "\", + "⧅", + "⟈", + "•", + "•", + "≎", + "⪮", + "≏", + "≏", + "ć", + "∩", + "⩄", + "⩉", + "⩋", + "⩇", + "⩀", + "∩︀", + "⁁", + "ˇ", + "⩍", + "č", + "ç", + "ĉ", + "⩌", + "⩐", + "ċ", + "¸", + "⦲", + "¢", + "·", + "𝔠", + "ч", + "✓", + "✓", + "χ", + "○", + "⧃", + "ˆ", + "≗", + "↺", + "↻", + "®", + "Ⓢ", + "⊛", + "⊚", + "⊝", + "≗", + "⨐", + "⫯", + "⧂", + "♣", + "♣", + ":", + "≔", + "≔", + ",", + "@", + "∁", + "∘", + "∁", + "ℂ", + "≅", + "⩭", + "∮", + "𝕔", + "∐", + "©", + "℗", + "↵", + "✗", + "𝒸", + "⫏", + "⫑", + "⫐", + "⫒", + "⋯", + "⤸", + "⤵", + "⋞", + "⋟", + "↶", + "⤽", + "∪", + "⩈", + "⩆", + "⩊", + "⊍", + "⩅", + "∪︀", + "↷", + "⤼", + "⋞", + "⋟", + "⋎", + "⋏", + "¤", + "↶", + "↷", + "⋎", + "⋏", + "∲", + "∱", + "⌭", + "⇓", + "⥥", + "†", + "ℸ", + "↓", + "‐", + "⊣", + "⤏", + "˝", + "ď", + "д", + "ⅆ", + "‡", + "⇊", + "⩷", + "°", + "δ", + "⦱", + "⥿", + "𝔡", + "⇃", + "⇂", + "⋄", + "⋄", + "♦", + "♦", + "¨", + "ϝ", + "⋲", + "÷", + "÷", + "⋇", + "⋇", + "ђ", + "⌞", + "⌍", + "$", + "𝕕", + "˙", + "≐", + "≑", + "∸", + "∔", + "⊡", + "⌆", + "↓", + "⇊", + "⇃", + "⇂", + "⤐", + "⌟", + "⌌", + "𝒹", + "ѕ", + "⧶", + "đ", + "⋱", + "▿", + "▾", + "⇵", + "⥯", + "⦦", + "џ", + "⟿", + "⩷", + "≑", + "é", + "⩮", + "ě", + "≖", + "ê", + "≕", + "э", + "ė", + "ⅇ", + "≒", + "𝔢", + "⪚", + "è", + "⪖", + "⪘", + "⪙", + "⏧", + "ℓ", + "⪕", + "⪗", + "ē", + "∅", + "∅", + "∅", + " ", + " ", + " ", + "ŋ", + " ", + "ę", + "𝕖", + "⋕", + "⧣", + "⩱", + "ε", + "ε", + "ϵ", + "≖", + "≕", + "≂", + "⪖", + "⪕", + "=", + "≟", + "≡", + "⩸", + "⧥", + "≓", + "⥱", + "ℯ", + "≐", + "≂", + "η", + "ð", + "ë", + "€", + "!", + "∃", + "ℰ", + "ⅇ", + "≒", + "ф", + "♀", + "ffi", + "ff", + "ffl", + "𝔣", + "fi", + "fj", + "♭", + "fl", + "▱", + "ƒ", + "𝕗", + "∀", + "⋔", + "⫙", + "⨍", + "½", + "⅓", + "¼", + "⅕", + "⅙", + "⅛", + "⅔", + "⅖", + "¾", + "⅗", + "⅜", + "⅘", + "⅚", + "⅝", + "⅞", + "⁄", + "⌢", + "𝒻", + "≧", + "⪌", + "ǵ", + "γ", + "ϝ", + "⪆", + "ğ", + "ĝ", + "г", + "ġ", + "≥", + "⋛", + "≥", + "≧", + "⩾", + "⩾", + "⪩", + "⪀", + "⪂", + "⪄", + "⋛︀", + "⪔", + "𝔤", + "≫", + "⋙", + "ℷ", + "ѓ", + "≷", + "⪒", + "⪥", + "⪤", + "≩", + "⪊", + "⪊", + "⪈", + "⪈", + "≩", + "⋧", + "𝕘", + "`", + "ℊ", + "≳", + "⪎", + "⪐", + ">", + "⪧", + "⩺", + "⋗", + "⦕", + "⩼", + "⪆", + "⥸", + "⋗", + "⋛", + "⪌", + "≷", + "≳", + "≩︀", + "≩︀", + "⇔", + " ", + "½", + "ℋ", + "ъ", + "↔", + "⥈", + "↭", + "ℏ", + "ĥ", + "♥", + "♥", + "…", + "⊹", + "𝔥", + "⤥", + "⤦", + "⇿", + "∻", + "↩", + "↪", + "𝕙", + "―", + "𝒽", + "ℏ", + "ħ", + "⁃", + "‐", + "í", + "⁣", + "î", + "и", + "е", + "¡", + "⇔", + "𝔦", + "ì", + "ⅈ", + "⨌", + "∭", + "⧜", + "℩", + "ij", + "ī", + "ℑ", + "ℐ", + "ℑ", + "ı", + "⊷", + "Ƶ", + "∈", + "℅", + "∞", + "⧝", + "ı", + "∫", + "⊺", + "ℤ", + "⊺", + "⨗", + "⨼", + "ё", + "į", + "𝕚", + "ι", + "⨼", + "¿", + "𝒾", + "∈", + "⋹", + "⋵", + "⋴", + "⋳", + "∈", + "⁢", + "ĩ", + "і", + "ï", + "ĵ", + "й", + "𝔧", + "ȷ", + "𝕛", + "𝒿", + "ј", + "є", + "κ", + "ϰ", + "ķ", + "к", + "𝔨", + "ĸ", + "х", + "ќ", + "𝕜", + "𝓀", + "⇚", + "⇐", + "⤛", + "⤎", + "≦", + "⪋", + "⥢", + "ĺ", + "⦴", + "ℒ", + "λ", + "⟨", + "⦑", + "⟨", + "⪅", + "«", + "←", + "⇤", + "⤟", + "⤝", + "↩", + "↫", + "⤹", + "⥳", + "↢", + "⪫", + "⤙", + "⪭", + "⪭︀", + "⤌", + "❲", + "{", + "[", + "⦋", + "⦏", + "⦍", + "ľ", + "ļ", + "⌈", + "{", + "л", + "⤶", + "“", + "„", + "⥧", + "⥋", + "↲", + "≤", + "←", + "↢", + "↽", + "↼", + "⇇", + "↔", + "⇆", + "⇋", + "↭", + "⋋", + "⋚", + "≤", + "≦", + "⩽", + "⩽", + "⪨", + "⩿", + "⪁", + "⪃", + "⋚︀", + "⪓", + "⪅", + "⋖", + "⋚", + "⪋", + "≶", + "≲", + "⥼", + "⌊", + "𝔩", + "≶", + "⪑", + "↽", + "↼", + "⥪", + "▄", + "љ", + "≪", + "⇇", + "⌞", + "⥫", + "◺", + "ŀ", + "⎰", + "⎰", + "≨", + "⪉", + "⪉", + "⪇", + "⪇", + "≨", + "⋦", + "⟬", + "⇽", + "⟦", + "⟵", + "⟷", + "⟼", + "⟶", + "↫", + "↬", + "⦅", + "𝕝", + "⨭", + "⨴", + "∗", + "_", + "◊", + "◊", + "⧫", + "(", + "⦓", + "⇆", + "⌟", + "⇋", + "⥭", + "‎", + "⊿", + "‹", + "𝓁", + "↰", + "≲", + "⪍", + "⪏", + "[", + "‘", + "‚", + "ł", + "<", + "⪦", + "⩹", + "⋖", + "⋋", + "⋉", + "⥶", + "⩻", + "⦖", + "◃", + "⊴", + "◂", + "⥊", + "⥦", + "≨︀", + "≨︀", + "∺", + "¯", + "♂", + "✠", + "✠", + "↦", + "↦", + "↧", + "↤", + "↥", + "▮", + "⨩", + "м", + "—", + "∡", + "𝔪", + "℧", + "µ", + "∣", + "*", + "⫰", + "·", + "−", + "⊟", + "∸", + "⨪", + "⫛", + "…", + "∓", + "⊧", + "𝕞", + "∓", + "𝓂", + "∾", + "μ", + "⊸", + "⊸", + "⋙̸", + "≫⃒", + "≫̸", + "⇍", + "⇎", + "⋘̸", + "≪⃒", + "≪̸", + "⇏", + "⊯", + "⊮", + "∇", + "ń", + "∠⃒", + "≉", + "⩰̸", + "≋̸", + "ʼn", + "≉", + "♮", + "♮", + "ℕ", + " ", + "≎̸", + "≏̸", + "⩃", + "ň", + "ņ", + "≇", + "⩭̸", + "⩂", + "н", + "–", + "≠", + "⇗", + "⤤", + "↗", + "↗", + "≐̸", + "≢", + "⤨", + "≂̸", + "∄", + "∄", + "𝔫", + "≧̸", + "≱", + "≱", + "≧̸", + "⩾̸", + "⩾̸", + "≵", + "≯", + "≯", + "⇎", + "↮", + "⫲", + "∋", + "⋼", + "⋺", + "∋", + "њ", + "⇍", + "≦̸", + "↚", + "‥", + "≰", + "↚", + "↮", + "≰", + "≦̸", + "⩽̸", + "⩽̸", + "≮", + "≴", + "≮", + "⋪", + "⋬", + "∤", + "𝕟", + "¬", + "∉", + "⋹̸", + "⋵̸", + "∉", + "⋷", + "⋶", + "∌", + "∌", + "⋾", + "⋽", + "∦", + "∦", + "⫽⃥", + "∂̸", + "⨔", + "⊀", + "⋠", + "⪯̸", + "⊀", + "⪯̸", + "⇏", + "↛", + "⤳̸", + "↝̸", + "↛", + "⋫", + "⋭", + "⊁", + "⋡", + "⪰̸", + "𝓃", + "∤", + "∦", + "≁", + "≄", + "≄", + "∤", + "∦", + "⋢", + "⋣", + "⊄", + "⫅̸", + "⊈", + "⊂⃒", + "⊈", + "⫅̸", + "⊁", + "⪰̸", + "⊅", + "⫆̸", + "⊉", + "⊃⃒", + "⊉", + "⫆̸", + "≹", + "ñ", + "≸", + "⋪", + "⋬", + "⋫", + "⋭", + "ν", + "#", + "№", + " ", + "⊭", + "⤄", + "≍⃒", + "⊬", + "≥⃒", + ">⃒", + "⧞", + "⤂", + "≤⃒", + "<⃒", + "⊴⃒", + "⤃", + "⊵⃒", + "∼⃒", + "⇖", + "⤣", + "↖", + "↖", + "⤧", + "Ⓢ", + "ó", + "⊛", + "⊚", + "ô", + "о", + "⊝", + "ő", + "⨸", + "⊙", + "⦼", + "œ", + "⦿", + "𝔬", + "˛", + "ò", + "⧁", + "⦵", + "Ω", + "∮", + "↺", + "⦾", + "⦻", + "‾", + "⧀", + "ō", + "ω", + "ο", + "⦶", + "⊖", + "𝕠", + "⦷", + "⦹", + "⊕", + "∨", + "↻", + "⩝", + "ℴ", + "ℴ", + "ª", + "º", + "⊶", + "⩖", + "⩗", + "⩛", + "ℴ", + "ø", + "⊘", + "õ", + "⊗", + "⨶", + "ö", + "⌽", + "∥", + "¶", + "∥", + "⫳", + "⫽", + "∂", + "п", + "%", + ".", + "‰", + "⊥", + "‱", + "𝔭", + "φ", + "ϕ", + "ℳ", + "☎", + "π", + "⋔", + "ϖ", + "ℏ", + "ℎ", + "ℏ", + "+", + "⨣", + "⊞", + "⨢", + "∔", + "⨥", + "⩲", + "±", + "⨦", + "⨧", + "±", + "⨕", + "𝕡", + "£", + "≺", + "⪳", + "⪷", + "≼", + "⪯", + "≺", + "⪷", + "≼", + "⪯", + "⪹", + "⪵", + "⋨", + "≾", + "′", + "ℙ", + "⪵", + "⪹", + "⋨", + "∏", + "⌮", + "⌒", + "⌓", + "∝", + "∝", + "≾", + "⊰", + "𝓅", + "ψ", + " ", + "𝔮", + "⨌", + "𝕢", + "⁗", + "𝓆", + "ℍ", + "⨖", + "?", + "≟", + """, + "⇛", + "⇒", + "⤜", + "⤏", + "⥤", + "∽̱", + "ŕ", + "√", + "⦳", + "⟩", + "⦒", + "⦥", + "⟩", + "»", + "→", + "⥵", + "⇥", + "⤠", + "⤳", + "⤞", + "↪", + "↬", + "⥅", + "⥴", + "↣", + "↝", + "⤚", + "∶", + "ℚ", + "⤍", + "❳", + "}", + "]", + "⦌", + "⦎", + "⦐", + "ř", + "ŗ", + "⌉", + "}", + "р", + "⤷", + "⥩", + "”", + "”", + "↳", + "ℜ", + "ℛ", + "ℜ", + "ℝ", + "▭", + "®", + "⥽", + "⌋", + "𝔯", + "⇁", + "⇀", + "⥬", + "ρ", + "ϱ", + "→", + "↣", + "⇁", + "⇀", + "⇄", + "⇌", + "⇉", + "↝", + "⋌", + "˚", + "≓", + "⇄", + "⇌", + "‏", + "⎱", + "⎱", + "⫮", + "⟭", + "⇾", + "⟧", + "⦆", + "𝕣", + "⨮", + "⨵", + ")", + "⦔", + "⨒", + "⇉", + "›", + "𝓇", + "↱", + "]", + "’", + "’", + "⋌", + "⋊", + "▹", + "⊵", + "▸", + "⧎", + "⥨", + "℞", + "ś", + "‚", + "≻", + "⪴", + "⪸", + "š", + "≽", + "⪰", + "ş", + "ŝ", + "⪶", + "⪺", + "⋩", + "⨓", + "≿", + "с", + "⋅", + "⊡", + "⩦", + "⇘", + "⤥", + "↘", + "↘", + "§", + ";", + "⤩", + "∖", + "∖", + "✶", + "𝔰", + "⌢", + "♯", + "щ", + "ш", + "∣", + "∥", + "­", + "σ", + "ς", + "ς", + "∼", + "⩪", + "≃", + "≃", + "⪞", + "⪠", + "⪝", + "⪟", + "≆", + "⨤", + "⥲", + "←", + "∖", + "⨳", + "⧤", + "∣", + "⌣", + "⪪", + "⪬", + "⪬︀", + "ь", + "/", + "⧄", + "⌿", + "𝕤", + "♠", + "♠", + "∥", + "⊓", + "⊓︀", + "⊔", + "⊔︀", + "⊏", + "⊑", + "⊏", + "⊑", + "⊐", + "⊒", + "⊐", + "⊒", + "□", + "□", + "▪", + "▪", + "→", + "𝓈", + "∖", + "⌣", + "⋆", + "☆", + "★", + "ϵ", + "ϕ", + "¯", + "⊂", + "⫅", + "⪽", + "⊆", + "⫃", + "⫁", + "⫋", + "⊊", + "⪿", + "⥹", + "⊂", + "⊆", + "⫅", + "⊊", + "⫋", + "⫇", + "⫕", + "⫓", + "≻", + "⪸", + "≽", + "⪰", + "⪺", + "⪶", + "⋩", + "≿", + "∑", + "♪", + "⊃", + "¹", + "²", + "³", + "⫆", + "⪾", + "⫘", + "⊇", + "⫄", + "⟉", + "⫗", + "⥻", + "⫂", + "⫌", + "⊋", + "⫀", + "⊃", + "⊇", + "⫆", + "⊋", + "⫌", + "⫈", + "⫔", + "⫖", + "⇙", + "⤦", + "↙", + "↙", + "⤪", + "ß", + "⌖", + "τ", + "⎴", + "ť", + "ţ", + "т", + "⃛", + "⌕", + "𝔱", + "∴", + "∴", + "θ", + "ϑ", + "ϑ", + "≈", + "∼", + " ", + "≈", + "∼", + "þ", + "˜", + "×", + "⊠", + "⨱", + "⨰", + "∭", + "⤨", + "⊤", + "⌶", + "⫱", + "𝕥", + "⫚", + "⤩", + "‴", + "™", + "▵", + "▿", + "◃", + "⊴", + "≜", + "▹", + "⊵", + "◬", + "≜", + "⨺", + "⨹", + "⧍", + "⨻", + "⏢", + "𝓉", + "ц", + "ћ", + "ŧ", + "≬", + "↞", + "↠", + "⇑", + "⥣", + "ú", + "↑", + "ў", + "ŭ", + "û", + "у", + "⇅", + "ű", + "⥮", + "⥾", + "𝔲", + "ù", + "↿", + "↾", + "▀", + "⌜", + "⌜", + "⌏", + "◸", + "ū", + "¨", + "ų", + "𝕦", + "↑", + "↕", + "↿", + "↾", + "⊎", + "υ", + "ϒ", + "υ", + "⇈", + "⌝", + "⌝", + "⌎", + "ů", + "◹", + "𝓊", + "⋰", + "ũ", + "▵", + "▴", + "⇈", + "ü", + "⦧", + "⇕", + "⫨", + "⫩", + "⊨", + "⦜", + "ϵ", + "ϰ", + "∅", + "ϕ", + "ϖ", + "∝", + "↕", + "ϱ", + "ς", + "⊊︀", + "⫋︀", + "⊋︀", + "⫌︀", + "ϑ", + "⊲", + "⊳", + "в", + "⊢", + "∨", + "⊻", + "≚", + "⋮", + "|", + "|", + "𝔳", + "⊲", + "⊂⃒", + "⊃⃒", + "𝕧", + "∝", + "⊳", + "𝓋", + "⫋︀", + "⊊︀", + "⫌︀", + "⊋︀", + "⦚", + "ŵ", + "⩟", + "∧", + "≙", + "℘", + "𝔴", + "𝕨", + "℘", + "≀", + "≀", + "𝓌", + "⋂", + "◯", + "⋃", + "▽", + "𝔵", + "⟺", + "⟷", + "ξ", + "⟸", + "⟵", + "⟼", + "⋻", + "⨀", + "𝕩", + "⨁", + "⨂", + "⟹", + "⟶", + "𝓍", + "⨆", + "⨄", + "△", + "⋁", + "⋀", + "ý", + "я", + "ŷ", + "ы", + "¥", + "𝔶", + "ї", + "𝕪", + "𝓎", + "ю", + "ÿ", + "ź", + "ž", + "з", + "ż", + "ℨ", + "ζ", + "𝔷", + "ж", + "⇝", + "𝕫", + "𝓏", + "‍", + "‌", ); foreach ($map as $str) { diff --git a/ext/standard/tests/strings/htmlentities-utf-2.phpt b/ext/standard/tests/strings/htmlentities-utf-2.phpt index 3c0b9dde71..1fdd05e271 100644 --- a/ext/standard/tests/strings/htmlentities-utf-2.phpt +++ b/ext/standard/tests/strings/htmlentities-utf-2.phpt @@ -6,15 +6,15 @@ output_handler= <?php @setlocale (LC_CTYPE, "C"); $strings = array("<", "\xD0", "\xD0\x90", "\xD0\x90\xD0", "\xD0\x90\xD0\xB0", "\xE0", "A\xE0", "\xE0\x80", "\xE0\x79", "\xE0\x80\xBE", - "Voil\xE0", "Clich\xE9s", - "\xFE", "\xFE\x41", "\xC3\xA9", "\xC3\x79", "\xF7\xBF\xBF\xBF", "\xFB\xBF\xBF\xBF\xBF", "\xFD\xBF\xBF\xBF\xBF\xBF", - "\x41\xF7\xF7\x42", "\x42\xFB\xFB\x42", "\x43\xFD\xFD\x42", "\x44\xF7\xF7", "\x45\xFB\xFB", "\x46\xFD\xFD" - ); + "Voil\xE0", "Clich\xE9s", + "\xFE", "\xFE\x41", "\xC3\xA9", "\xC3\x79", "\xF7\xBF\xBF\xBF", "\xFB\xBF\xBF\xBF\xBF", "\xFD\xBF\xBF\xBF\xBF\xBF", + "\x41\xF7\xF7\x42", "\x42\xFB\xFB\x42", "\x43\xFD\xFD\x42", "\x44\xF7\xF7", "\x45\xFB\xFB", "\x46\xFD\xFD" + ); foreach($strings as $string) { - $sc_encoded = htmlspecialchars ($string, ENT_QUOTES | ENT_IGNORE, "utf-8"); - var_dump(bin2hex($sc_encoded)); - $ent_encoded = htmlentities ($string, ENT_QUOTES | ENT_IGNORE, "utf-8"); - var_dump(bin2hex($ent_encoded)); + $sc_encoded = htmlspecialchars ($string, ENT_QUOTES | ENT_IGNORE, "utf-8"); + var_dump(bin2hex($sc_encoded)); + $ent_encoded = htmlentities ($string, ENT_QUOTES | ENT_IGNORE, "utf-8"); + var_dump(bin2hex($ent_encoded)); } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/htmlentities-utf-3.phpt b/ext/standard/tests/strings/htmlentities-utf-3.phpt index 82693056ef..56d4cdc2f8 100644 --- a/ext/standard/tests/strings/htmlentities-utf-3.phpt +++ b/ext/standard/tests/strings/htmlentities-utf-3.phpt @@ -6,77 +6,77 @@ Test get_next_char(), used by htmlentities()/htmlspecialchars(): validity of UTF /* 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)), + 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; + 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); + $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 ($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 ($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"; - } + 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-- diff --git a/ext/standard/tests/strings/htmlentities-utf.phpt b/ext/standard/tests/strings/htmlentities-utf.phpt index 215f500c91..5325378593 100644 --- a/ext/standard/tests/strings/htmlentities-utf.phpt +++ b/ext/standard/tests/strings/htmlentities-utf.phpt @@ -6,15 +6,15 @@ output_handler= <?php @setlocale (LC_CTYPE, "C"); $strings = array("<", "\xD0", "\xD0\x90", "\xD0\x90\xD0", "\xD0\x90\xD0\xB0", "\xE0", "A\xE0", "\xE0\x80", "\xE0\x79", "\xE0\x80\xBE", - "Voil\xE0", "Clich\xE9s", - "\xFE", "\xFE\x41", "\xC3\xA9", "\xC3\x79", "\xF7\xBF\xBF\xBF", "\xFB\xBF\xBF\xBF\xBF", "\xFD\xBF\xBF\xBF\xBF\xBF", - "\x41\xF7\xF7\x42", "\x42\xFB\xFB\x42", "\x43\xFD\xFD\x42", "\x44\xF7\xF7", "\x45\xFB\xFB", "\x46\xFD\xFD" - ); + "Voil\xE0", "Clich\xE9s", + "\xFE", "\xFE\x41", "\xC3\xA9", "\xC3\x79", "\xF7\xBF\xBF\xBF", "\xFB\xBF\xBF\xBF\xBF", "\xFD\xBF\xBF\xBF\xBF\xBF", + "\x41\xF7\xF7\x42", "\x42\xFB\xFB\x42", "\x43\xFD\xFD\x42", "\x44\xF7\xF7", "\x45\xFB\xFB", "\x46\xFD\xFD" + ); foreach($strings as $string) { - $sc_encoded = htmlspecialchars ($string, ENT_QUOTES, "utf-8"); - var_dump(bin2hex($sc_encoded)); - $ent_encoded = htmlentities ($string, ENT_QUOTES, "utf-8"); - var_dump(bin2hex($ent_encoded)); + $sc_encoded = htmlspecialchars ($string, ENT_QUOTES, "utf-8"); + var_dump(bin2hex($sc_encoded)); + $ent_encoded = htmlentities ($string, ENT_QUOTES, "utf-8"); + var_dump(bin2hex($ent_encoded)); } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/htmlentities01.phpt b/ext/standard/tests/strings/htmlentities01.phpt index 092027a7a4..269bd467b9 100644 --- a/ext/standard/tests/strings/htmlentities01.phpt +++ b/ext/standard/tests/strings/htmlentities01.phpt @@ -5,8 +5,8 @@ output_handler= internal_encoding=pass --FILE-- <?php - var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, 'cp1252')); - var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, 'cp1252')); + var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, 'cp1252')); + var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, 'cp1252')); ?> --EXPECT-- string(28) "‚†™Ÿ" diff --git a/ext/standard/tests/strings/htmlentities02.phpt b/ext/standard/tests/strings/htmlentities02.phpt index ad75766ee6..6dcc4de483 100644 --- a/ext/standard/tests/strings/htmlentities02.phpt +++ b/ext/standard/tests/strings/htmlentities02.phpt @@ -13,8 +13,8 @@ default_charset= internal_encoding=pass --FILE-- <?php - setlocale(LC_CTYPE, "fr_FR.ISO-8859-15", "fr_FR.ISO8859-15", 'fr_FR@euro'); - var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, '')); + setlocale(LC_CTYPE, "fr_FR.ISO-8859-15", "fr_FR.ISO8859-15", 'fr_FR@euro'); + var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, '')); ?> --EXPECT-- string(20) "ŒœŸ" diff --git a/ext/standard/tests/strings/htmlentities03.phpt b/ext/standard/tests/strings/htmlentities03.phpt index 6b00e8b48c..b7e07fb375 100644 --- a/ext/standard/tests/strings/htmlentities03.phpt +++ b/ext/standard/tests/strings/htmlentities03.phpt @@ -13,8 +13,8 @@ default_charset= internal_encoding=pass --FILE-- <?php - setlocale( LC_CTYPE, "de_DE.ISO-8859-1", "de_DE.ISO8859-1"); - var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, '')); + setlocale( LC_CTYPE, "de_DE.ISO-8859-1", "de_DE.ISO8859-1"); + var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, '')); ?> --EXPECT-- string(18) "äöü" diff --git a/ext/standard/tests/strings/htmlentities04.phpt b/ext/standard/tests/strings/htmlentities04.phpt index 33f38682da..7e47d8d4fc 100644 --- a/ext/standard/tests/strings/htmlentities04.phpt +++ b/ext/standard/tests/strings/htmlentities04.phpt @@ -13,8 +13,8 @@ default_charset= internal_encoding=pass --FILE-- <?php - setlocale( LC_CTYPE, "ja_JP.EUC-JP", "ja_JP.eucJP" ); - var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, '')); + setlocale( LC_CTYPE, "ja_JP.EUC-JP", "ja_JP.eucJP" ); + var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, '')); ?> --EXPECTF-- Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d diff --git a/ext/standard/tests/strings/htmlentities05.phpt b/ext/standard/tests/strings/htmlentities05.phpt index f65a1a435a..04bf4deb00 100644 --- a/ext/standard/tests/strings/htmlentities05.phpt +++ b/ext/standard/tests/strings/htmlentities05.phpt @@ -8,9 +8,9 @@ internal_encoding=cp1252 extension_loaded("mbstring") or die("skip mbstring not available\n"); --FILE-- <?php - print mb_internal_encoding()."\n"; - var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, '')); - var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, '')); + print mb_internal_encoding()."\n"; + var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, '')); + var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, '')); ?> --EXPECT-- Windows-1252 diff --git a/ext/standard/tests/strings/htmlentities06.phpt b/ext/standard/tests/strings/htmlentities06.phpt index 5027c0c193..487b5d33ff 100644 --- a/ext/standard/tests/strings/htmlentities06.phpt +++ b/ext/standard/tests/strings/htmlentities06.phpt @@ -8,9 +8,9 @@ internal_encoding=ISO-8859-15 extension_loaded("mbstring") or die("skip mbstring not available\n"); --FILE-- <?php - mb_internal_encoding('ISO-8859-15'); - print mb_internal_encoding()."\n"; - var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, '')); + mb_internal_encoding('ISO-8859-15'); + print mb_internal_encoding()."\n"; + var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, '')); ?> --EXPECT-- ISO-8859-15 diff --git a/ext/standard/tests/strings/htmlentities07.phpt b/ext/standard/tests/strings/htmlentities07.phpt index fe43d32d49..04e138e0c7 100644 --- a/ext/standard/tests/strings/htmlentities07.phpt +++ b/ext/standard/tests/strings/htmlentities07.phpt @@ -8,9 +8,9 @@ internal_encoding=ISO-8859-1 extension_loaded("mbstring") or die("skip mbstring not available\n"); --FILE-- <?php - mb_internal_encoding('ISO-8859-1'); - print mb_internal_encoding()."\n"; - var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, '')); + mb_internal_encoding('ISO-8859-1'); + print mb_internal_encoding()."\n"; + var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, '')); ?> --EXPECT-- ISO-8859-1 diff --git a/ext/standard/tests/strings/htmlentities08.phpt b/ext/standard/tests/strings/htmlentities08.phpt index b44796ec80..fdba4ede80 100644 --- a/ext/standard/tests/strings/htmlentities08.phpt +++ b/ext/standard/tests/strings/htmlentities08.phpt @@ -8,9 +8,9 @@ internal_encoding=EUC-JP extension_loaded("mbstring") or die("skip mbstring not available\n"); --FILE-- <?php - mb_internal_encoding('EUC-JP'); - print mb_internal_encoding()."\n"; - var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, '')); + mb_internal_encoding('EUC-JP'); + print mb_internal_encoding()."\n"; + var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, '')); ?> --EXPECTF-- EUC-JP diff --git a/ext/standard/tests/strings/htmlentities09.phpt b/ext/standard/tests/strings/htmlentities09.phpt index 11493b62a4..6ca0a1e39e 100644 --- a/ext/standard/tests/strings/htmlentities09.phpt +++ b/ext/standard/tests/strings/htmlentities09.phpt @@ -8,9 +8,9 @@ internal_encoding=Shift_JIS extension_loaded("mbstring") or die("skip mbstring not available\n"); --FILE-- <?php - mb_internal_encoding('Shift_JIS'); - print mb_internal_encoding()."\n"; - var_dump(bin2hex(htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, ''))); + mb_internal_encoding('Shift_JIS'); + print mb_internal_encoding()."\n"; + var_dump(bin2hex(htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, ''))); ?> --EXPECTF-- SJIS diff --git a/ext/standard/tests/strings/htmlentities10.phpt b/ext/standard/tests/strings/htmlentities10.phpt index 5f6d8ffc57..2f8c42b7e5 100644 --- a/ext/standard/tests/strings/htmlentities10.phpt +++ b/ext/standard/tests/strings/htmlentities10.phpt @@ -6,9 +6,9 @@ internal_encoding=pass default_charset=cp1252 --FILE-- <?php - print ini_get('default_charset')."\n"; - var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, '')); - var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, '')); + print ini_get('default_charset')."\n"; + var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, '')); + var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, '')); ?> --EXPECT-- cp1252 diff --git a/ext/standard/tests/strings/htmlentities11.phpt b/ext/standard/tests/strings/htmlentities11.phpt index 0ee1044c13..c803f76a53 100644 --- a/ext/standard/tests/strings/htmlentities11.phpt +++ b/ext/standard/tests/strings/htmlentities11.phpt @@ -6,8 +6,8 @@ internal_encoding=pass default_charset=ISO-8859-15 --FILE-- <?php - print ini_get('default_charset')."\n"; - var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, '')); + print ini_get('default_charset')."\n"; + var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, '')); ?> --EXPECT-- ISO-8859-15 diff --git a/ext/standard/tests/strings/htmlentities12.phpt b/ext/standard/tests/strings/htmlentities12.phpt index c3cb7b6440..c2963f1c86 100644 --- a/ext/standard/tests/strings/htmlentities12.phpt +++ b/ext/standard/tests/strings/htmlentities12.phpt @@ -6,8 +6,8 @@ internal_encoding=pass default_charset=ISO-8859-1 --FILE-- <?php - print ini_get('default_charset')."\n"; - var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, '')); + print ini_get('default_charset')."\n"; + var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, '')); ?> --EXPECT-- ISO-8859-1 diff --git a/ext/standard/tests/strings/htmlentities13.phpt b/ext/standard/tests/strings/htmlentities13.phpt index bdea7a30ee..ac2c8cd4b0 100644 --- a/ext/standard/tests/strings/htmlentities13.phpt +++ b/ext/standard/tests/strings/htmlentities13.phpt @@ -7,8 +7,8 @@ default_charset=EUC-JP filter.default=unsafe_raw --FILE-- <?php - print ini_get('default_charset')."\n"; - var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, '')); + print ini_get('default_charset')."\n"; + var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, '')); ?> --EXPECTF-- EUC-JP diff --git a/ext/standard/tests/strings/htmlentities14.phpt b/ext/standard/tests/strings/htmlentities14.phpt index e39a003726..60226cbe10 100644 --- a/ext/standard/tests/strings/htmlentities14.phpt +++ b/ext/standard/tests/strings/htmlentities14.phpt @@ -7,8 +7,8 @@ default_charset=Shift_JIS filter.default=unsafe_raw --FILE-- <?php - print ini_get('default_charset')."\n"; - var_dump(htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, '')); + print ini_get('default_charset')."\n"; + var_dump(htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, '')); ?> --EXPECTF-- Shift_JIS diff --git a/ext/standard/tests/strings/htmlentities17.phpt b/ext/standard/tests/strings/htmlentities17.phpt index d9e67a9b87..5e29de5d8e 100644 --- a/ext/standard/tests/strings/htmlentities17.phpt +++ b/ext/standard/tests/strings/htmlentities17.phpt @@ -3,25 +3,25 @@ htmlentities() / html_entity_decode() #8592 - #9002 table test --FILE-- <?php $tests = array( - array(8853, '⊕', "e28a95"), - array(8855, '⊗', "e28a97"), - array(8869, '⊥', "e28aa5"), - array(8901, '⋅', "e28b85"), - array(8968, '⌈', "e28c88"), - array(8969, '⌉', "e28c89"), - array(8970, '⌊', "e28c8a"), - array(8971, '⌋', "e28c8b"), - array(9001, '⟨', "e28ca9"), - array(9002, '⟩', "e28caa") + array(8853, '⊕', "e28a95"), + array(8855, '⊗', "e28a97"), + array(8869, '⊥', "e28aa5"), + array(8901, '⋅', "e28b85"), + array(8968, '⌈', "e28c88"), + array(8969, '⌉', "e28c89"), + array(8970, '⌊', "e28c8a"), + array(8971, '⌋', "e28c8b"), + array(9001, '⟨', "e28ca9"), + array(9002, '⟩', "e28caa") ); foreach ($tests as $test) { - var_dump(htmlentities(pack('H*', $test[2]), ENT_QUOTES, 'UTF-8')); + var_dump(htmlentities(pack('H*', $test[2]), ENT_QUOTES, 'UTF-8')); } foreach ($tests as $test) { - list(,$result) = unpack('H6', html_entity_decode($test[1], ENT_QUOTES, 'UTF-8')); - var_dump($result); + list(,$result) = unpack('H6', html_entity_decode($test[1], ENT_QUOTES, 'UTF-8')); + var_dump($result); } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/htmlentities18.phpt b/ext/standard/tests/strings/htmlentities18.phpt index d7bd2302c1..d9582e7dbc 100644 --- a/ext/standard/tests/strings/htmlentities18.phpt +++ b/ext/standard/tests/strings/htmlentities18.phpt @@ -3,21 +3,21 @@ htmlentities() / htmlspecialchars() "don't double encode" flag support --FILE-- <?php $tests = array( - "abc", - "abc&sfdsa", - "test+s & some more D", - "test+s & some more D", - "&; & &#a; &9; &#xyz;", - "&kffjadfdhsjfhjasdhffasdfas;", - "�", - "&", - "&&&", - "&ab&&", + "abc", + "abc&sfdsa", + "test+s & some more D", + "test+s & some more D", + "&; & &#a; &9; &#xyz;", + "&kffjadfdhsjfhjasdhffasdfas;", + "�", + "&", + "&&&", + "&ab&&", ); foreach ($tests as $test) { - var_dump(htmlentities($test, ENT_QUOTES, NULL, FALSE)); - var_dump(htmlspecialchars($test, ENT_QUOTES, NULL, FALSE)); + var_dump(htmlentities($test, ENT_QUOTES, NULL, FALSE)); + var_dump(htmlspecialchars($test, ENT_QUOTES, NULL, FALSE)); } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/htmlentities19.phpt b/ext/standard/tests/strings/htmlentities19.phpt index a90358c613..bc607ad240 100644 --- a/ext/standard/tests/strings/htmlentities19.phpt +++ b/ext/standard/tests/strings/htmlentities19.phpt @@ -3,16 +3,16 @@ htmlentities() / htmlspecialchars() ENT_SUBSTITUTE --FILE-- <?php $tests = array( - "\x41\xC2\x3E\x42", // Unicode TR #36, 3.1.1; do not consume valid successor bytes - "\xE3\x80\x22", // Unicode TR #36, 3.6.1; use strategy #2 + "\x41\xC2\x3E\x42", // Unicode TR #36, 3.1.1; do not consume valid successor bytes + "\xE3\x80\x22", // Unicode TR #36, 3.6.1; use strategy #2 "\x41\x98\xBA\x42\xE2\x98\x43\xE2\x98\xBA\xE2\x98", // example from HTML5, section 2.4 ); foreach ($tests as $test) { $a = htmlentities($test, ENT_QUOTES | ENT_SUBSTITUTE, "UTF-8"); - var_dump($a, bin2hex($a)); + var_dump($a, bin2hex($a)); $a = htmlspecialchars($test, ENT_QUOTES | ENT_SUBSTITUTE, "UTF-8"); - var_dump($a, bin2hex($a)); + var_dump($a, bin2hex($a)); } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/htmlentities20.phpt b/ext/standard/tests/strings/htmlentities20.phpt index ff52aca07a..956ecfc1b9 100644 --- a/ext/standard/tests/strings/htmlentities20.phpt +++ b/ext/standard/tests/strings/htmlentities20.phpt @@ -3,25 +3,25 @@ htmlentities() / htmlspecialchars() ENT_DISALLOWED --FILE-- <?php function codepoint_to_utf8($k) { - if ($k < 0x80) { - $retval = pack('C', $k); - } else if ($k < 0x800) { - $retval = pack('C2', + if ($k < 0x80) { + $retval = pack('C', $k); + } else if ($k < 0x800) { + $retval = pack('C2', 0xc0 | ($k >> 6), 0x80 | ($k & 0x3f)); - } else if ($k < 0x10000) { + } else if ($k < 0x10000) { $retval = pack('C3', 0xe0 | ($k >> 12), 0x80 | (($k >> 6) & 0x3f), 0x80 | ($k & 0x3f)); - } else { + } else { $retval = pack('C4', 0xf0 | ($k >> 18), 0x80 | (($k >> 12) & 0x3f), 0x80 | (($k >> 6) & 0x3f), 0x80 | ($k & 0x3f)); - } - return $retval; + } + return $retval; } $tests = array( diff --git a/ext/standard/tests/strings/htmlentities23.phpt b/ext/standard/tests/strings/htmlentities23.phpt index 68e6e9439e..3b33e382e5 100644 --- a/ext/standard/tests/strings/htmlentities23.phpt +++ b/ext/standard/tests/strings/htmlentities23.phpt @@ -20,9 +20,9 @@ $tests = array( foreach ($tests as $test) { $a = htmlentities($test, ENT_QUOTES | ENT_SUBSTITUTE, "EUC-JP"); - var_dump($a, bin2hex($a)); + var_dump($a, bin2hex($a)); $a = htmlspecialchars($test, ENT_QUOTES | ENT_SUBSTITUTE, "EUC-JP"); - var_dump($a, bin2hex($a)); + var_dump($a, bin2hex($a)); echo "\n"; } ?> diff --git a/ext/standard/tests/strings/htmlentities_html4.phpt b/ext/standard/tests/strings/htmlentities_html4.phpt index 5d784c2af5..8e23fbaeca 100644 --- a/ext/standard/tests/strings/htmlentities_html4.phpt +++ b/ext/standard/tests/strings/htmlentities_html4.phpt @@ -3,31 +3,31 @@ htmlentities() conformance check (HTML 4) --FILE-- <?php function utf32_utf8($k) { - if ($k < 0x80) { - $retval = pack('C', $k); - } else if ($k < 0x800) { - $retval = pack('C2', + if ($k < 0x80) { + $retval = pack('C', $k); + } else if ($k < 0x800) { + $retval = pack('C2', 0xc0 | ($k >> 6), 0x80 | ($k & 0x3f)); - } else if ($k < 0x10000) { + } else if ($k < 0x10000) { $retval = pack('C3', 0xe0 | ($k >> 12), 0x80 | (($k >> 6) & 0x3f), 0x80 | ($k & 0x3f)); - } else if ($k < 0x200000) { + } else if ($k < 0x200000) { $retval = pack('C4', 0xf0 | ($k >> 18), 0x80 | (($k >> 12) & 0x3f), 0x80 | (($k >> 6) & 0x3f), 0x80 | ($k & 0x3f)); - } else if ($k < 0x4000000) { + } else if ($k < 0x4000000) { $retval = pack('C5', 0xf8 | ($k >> 24), 0x80 | (($k >> 18) & 0x3f), 0x80 | (($k >> 12) & 0x3f), 0x80 | (($k >> 6) & 0x3f), 0x80 | ($k & 0x3f)); - } else { + } else { $retval = pack('C6', 0xfc | ($k >> 30), 0x80 | (($k >> 24) & 0x3f), @@ -35,8 +35,8 @@ function utf32_utf8($k) { 0x80 | (($k >> 12) & 0x3f), 0x80 | (($k >> 6) & 0x3f), 0x80 | ($k & 0x3f)); - } - return $retval; + } + return $retval; } $table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, 'UTF-8'); @@ -45,15 +45,15 @@ for ($i = 0; $i < 0x2710; $i++) { if ($i >= 0xd800 && $i < 0xe000) continue; $str = utf32_utf8($i); - if (isset($table[$str])) { - printf("%s\tU+%05X\n", $table[$str], $i); - unset($table[$str]); - } + if (isset($table[$str])) { + printf("%s\tU+%05X\n", $table[$str], $i); + unset($table[$str]); + } } if (!empty($table)) { - echo "Not matched entities: "; - var_dump($table); + echo "Not matched entities: "; + var_dump($table); } ?> diff --git a/ext/standard/tests/strings/htmlentities_html5.phpt b/ext/standard/tests/strings/htmlentities_html5.phpt index 4a91012bd7..d3e94d5dba 100644 --- a/ext/standard/tests/strings/htmlentities_html5.phpt +++ b/ext/standard/tests/strings/htmlentities_html5.phpt @@ -3,25 +3,25 @@ htmlentities() conformance check (HTML 5) --FILE-- <?php function utf32_utf8($k) { - if ($k < 0x80) { - $retval = pack('C', $k); - } else if ($k < 0x800) { - $retval = pack('C2', + if ($k < 0x80) { + $retval = pack('C', $k); + } else if ($k < 0x800) { + $retval = pack('C2', 0xc0 | ($k >> 6), 0x80 | ($k & 0x3f)); - } else if ($k < 0x10000) { + } else if ($k < 0x10000) { $retval = pack('C3', 0xe0 | ($k >> 12), 0x80 | (($k >> 6) & 0x3f), 0x80 | ($k & 0x3f)); - } else { + } else { $retval = pack('C4', 0xf0 | ($k >> 18), 0x80 | (($k >> 12) & 0x3f), 0x80 | (($k >> 6) & 0x3f), 0x80 | ($k & 0x3f)); - } - return $retval; + } + return $retval; } for ($i = 0; $i < 0x1DFFF; $i++) { diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt Binary files differindex 596a883be2..8a6100ac45 100644 --- a/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt +++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt Binary files differindex ed25d329b2..5f754d7b2b 100644 --- a/ext/standard/tests/strings/lcfirst.phpt +++ b/ext/standard/tests/strings/lcfirst.phpt diff --git a/ext/standard/tests/strings/md5_basic2.phpt b/ext/standard/tests/strings/md5_basic2.phpt index f302753cd3..0e2db58e95 100644 --- a/ext/standard/tests/strings/md5_basic2.phpt +++ b/ext/standard/tests/strings/md5_basic2.phpt @@ -15,10 +15,10 @@ var_dump(bin2hex($md5_raw)); $md5 = md5($str, false); if (strcmp(bin2hex($md5_raw), $md5) == 0 ) { - echo "TEST PASSED\n"; + echo "TEST PASSED\n"; } else { - echo "TEST FAILED\n"; - var_dump($md5_raw, $md5); + echo "TEST FAILED\n"; + var_dump($md5_raw, $md5); } ?> diff --git a/ext/standard/tests/strings/metaphone.phpt b/ext/standard/tests/strings/metaphone.phpt index c70b4846a1..2bc16b3248 100644 --- a/ext/standard/tests/strings/metaphone.phpt +++ b/ext/standard/tests/strings/metaphone.phpt @@ -19,7 +19,7 @@ $array = array( ); foreach($array as $str) { - var_dump(metaphone($str)); + var_dump(metaphone($str)); } echo "Done\n"; diff --git a/ext/standard/tests/strings/nl2br.phpt b/ext/standard/tests/strings/nl2br.phpt index 728f3339a0..b2ff9cf090 100644 --- a/ext/standard/tests/strings/nl2br.phpt +++ b/ext/standard/tests/strings/nl2br.phpt @@ -2,17 +2,17 @@ nl2br() function --FILE-- <?php - var_dump(nl2br("test")); - var_dump(nl2br("")); - var_dump(nl2br(NULL)); - var_dump(nl2br("\r\n")); - var_dump(nl2br("\n")); - var_dump(nl2br("\r")); - var_dump(nl2br("\n\r")); + var_dump(nl2br("test")); + var_dump(nl2br("")); + var_dump(nl2br(NULL)); + var_dump(nl2br("\r\n")); + var_dump(nl2br("\n")); + var_dump(nl2br("\r")); + var_dump(nl2br("\n\r")); - var_dump(nl2br("\n\r\r\n\r\r\r\r")); - var_dump(nl2br("\n\r\n\n\r\n\r\r\n\r\n")); - var_dump(nl2br("\n\r\n\n\n\n\r\r\r\r\n\r")); + var_dump(nl2br("\n\r\r\n\r\r\r\r")); + var_dump(nl2br("\n\r\n\n\r\n\r\r\n\r\n")); + var_dump(nl2br("\n\r\n\n\n\n\r\r\r\r\n\r")); ?> --EXPECT-- diff --git a/ext/standard/tests/strings/number_format_basic.phpt b/ext/standard/tests/strings/number_format_basic.phpt index 4eb4d51086..f06a55cb63 100644 --- a/ext/standard/tests/strings/number_format_basic.phpt +++ b/ext/standard/tests/strings/number_format_basic.phpt @@ -11,40 +11,40 @@ Test number_format() - basic function test number_format() echo "*** Testing number_format() : basic functionality ***\n"; $values = array(1234.5678, - -1234.5678, - 1234.6578e4, - -1234.56789e4, - 0x1234CDEF, - 02777777777, - "123456789", - "123.456789", - "12.3456789e1", - null, - true, - false); + -1234.5678, + 1234.6578e4, + -1234.56789e4, + 0x1234CDEF, + 02777777777, + "123456789", + "123.456789", + "12.3456789e1", + null, + true, + false); echo "\n-- number_format tests.....default --\n"; for ($i = 0; $i < count($values); $i++) { - $res = number_format($values[$i]); - var_dump($res); + $res = number_format($values[$i]); + var_dump($res); } echo "\n-- number_format tests.....with two dp --\n"; for ($i = 0; $i < count($values); $i++) { - $res = number_format($values[$i], 2); - var_dump($res); + $res = number_format($values[$i], 2); + var_dump($res); } echo "\n-- number_format tests.....English format --\n"; for ($i = 0; $i < count($values); $i++) { - $res = number_format($values[$i], 2, '.', ' '); - var_dump($res); + $res = number_format($values[$i], 2, '.', ' '); + var_dump($res); } echo "\n-- number_format tests.....French format --\n"; for ($i = 0; $i < count($values); $i++) { - $res = number_format($values[$i], 2, ',' , ' '); - var_dump($res); + $res = number_format($values[$i], 2, ',' , ' '); + var_dump($res); } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/ord_basic.phpt b/ext/standard/tests/strings/ord_basic.phpt index a7c93fc6d3..c7d6891a09 100644 --- a/ext/standard/tests/strings/ord_basic.phpt +++ b/ext/standard/tests/strings/ord_basic.phpt @@ -24,9 +24,9 @@ var_dump(ord("Hello")); // Make sure all valid ascii chars round trip for ($i = 0; $i < 255; $i++) { - if (ord(chr($i)) != $i) { - exit("TEST FAILED: $i does not round trip\n"); - } + if (ord(chr($i)) != $i) { + exit("TEST FAILED: $i does not round trip\n"); + } } ?> diff --git a/ext/standard/tests/strings/pack_A.phpt b/ext/standard/tests/strings/pack_A.phpt index b5a7b97fc3..abc12ac1b1 100644 --- a/ext/standard/tests/strings/pack_A.phpt +++ b/ext/standard/tests/strings/pack_A.phpt @@ -3,11 +3,11 @@ pack()/unpack(): "A" modifier --FILE-- <?php var_dump( - pack("A5", "foo "), - pack("A4", "fooo"), - pack("A4", "foo"), - unpack("A*", "foo\0\rbar\0 \t\r\n"), - unpack("A4", "foo\0\rbar\0 \t\r\n") + pack("A5", "foo "), + pack("A4", "fooo"), + pack("A4", "foo"), + unpack("A*", "foo\0\rbar\0 \t\r\n"), + unpack("A4", "foo\0\rbar\0 \t\r\n") ); ?> --EXPECTF-- diff --git a/ext/standard/tests/strings/pack_Z.phpt b/ext/standard/tests/strings/pack_Z.phpt index 4fd007ae0f..5a7c5d95a6 100644 --- a/ext/standard/tests/strings/pack_Z.phpt +++ b/ext/standard/tests/strings/pack_Z.phpt @@ -3,11 +3,11 @@ pack()/unpack(): "Z" format --FILE-- <?php var_dump( - pack("Z0", "f"), + pack("Z0", "f"), pack("Z5", "foo\0"), pack("Z4", "fooo"), pack("Z4", "foo"), - pack("Z*", "foo"), + pack("Z*", "foo"), unpack("Z*", "foo\0\rbar\0 \t\r\n"), unpack("Z9", "foo\0\rbar\0 \t\r\n"), unpack("Z2", "\0"), diff --git a/ext/standard/tests/strings/php_strip_whitespace.phpt b/ext/standard/tests/strings/php_strip_whitespace.phpt index cdc599fc91..9f22daa9eb 100644 --- a/ext/standard/tests/strings/php_strip_whitespace.phpt +++ b/ext/standard/tests/strings/php_strip_whitespace.phpt @@ -19,15 +19,15 @@ $data = '<?php /* test class */ class test { - /* function foo () */ + /* function foo () */ - function foo () /* {{{ */ - { + function foo () /* {{{ */ + { - echo $var; //does not exist - } - /* }}} */ + echo $var; //does not exist + } + /* }}} */ } ?>'; diff --git a/ext/standard/tests/strings/print_variation1.phpt b/ext/standard/tests/strings/print_variation1.phpt index f06b83ee8f..e5849ecfdf 100644 --- a/ext/standard/tests/strings/print_variation1.phpt +++ b/ext/standard/tests/strings/print_variation1.phpt @@ -28,43 +28,43 @@ $file_handle = fopen(__FILE__, "r"); // array with different values for $input $inputs = array ( - // integer values + // integer values /*1*/ 0, - 1, - -2, - 2147483647, - -2147483648, + 1, + -2, + 2147483647, + -2147483648, - // float values + // float values /*6*/ 10.5, - -20.5, - 10.1234567e10, + -20.5, + 10.1234567e10, - // array values + // array values /*9*/ array(), - array(0), - array(1, 2), + array(0), + array(1, 2), - // boolean values + // boolean values /*12*/ true, - false, - TRUE, - FALSE, + false, + TRUE, + FALSE, - // null values + // null values /*16*/ NULL, - null, + null, - // objects + // objects /*18*/ new sample(), - // resource + // resource /*19*/ $file_handle, - // undefined variable + // undefined variable /*20*/ @$undefined_var, - // unset variable + // unset variable /*21*/ @$unset_var ); diff --git a/ext/standard/tests/strings/printf_variation1.phpt b/ext/standard/tests/strings/printf_variation1.phpt index 4ec032f9ce..d6fad7e97a 100644 --- a/ext/standard/tests/strings/printf_variation1.phpt +++ b/ext/standard/tests/strings/printf_variation1.phpt @@ -35,50 +35,50 @@ $file_handle = fopen(__FILE__, 'r'); //array of values to iterate over $values = array( - // int data + // int data /*1*/ 0, - 1, - 12345, - -2345, + 1, + 12345, + -2345, - // float data + // float data /*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, - // array data + // array data /*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), - // null data + // null data /*15*/ NULL, - null, + null, - // boolean data + // boolean data /*17*/ true, - false, - TRUE, - FALSE, + false, + TRUE, + FALSE, - // empty data + // empty data /*21*/ "", - '', + '', - // object data + // object data /*23*/ new sample(), - // undefined data + // undefined data /*24*/ @$undefined_var, - // unset data + // unset data /*25*/ @$unset_var, - // resource data + // resource data /*26*/ $file_handle ); diff --git a/ext/standard/tests/strings/printf_variation2.phpt b/ext/standard/tests/strings/printf_variation2.phpt index 3c3d92cbe3..d0335b455e 100644 --- a/ext/standard/tests/strings/printf_variation2.phpt +++ b/ext/standard/tests/strings/printf_variation2.phpt @@ -31,54 +31,54 @@ $file_handle = fopen(__FILE__, 'r'); //array of values to iterate over $values = array( - // int data + // int data /*1*/ 0, - 1, - 12345, - -2345, + 1, + 12345, + -2345, - // float data + // float data /*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, - // array data + // array data /*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), - // null data + // null data /*15*/ NULL, - null, + null, - // boolean data + // boolean data /*17*/ true, - false, - TRUE, - FALSE, + false, + TRUE, + FALSE, - // empty data + // empty data /*21*/ "", - '', + '', - // string data + // string data /*23*/ "string", - 'string', + 'string', - // object data + // object data /*25*/ new sample(), - // undefined data + // undefined data /*26*/ @$undefined_var, - // unset data + // unset data /*27*/ @$unset_var, - // resource data + // resource data /*28*/ $file_handle ); diff --git a/ext/standard/tests/strings/quoted_printable_decode_basic.phpt b/ext/standard/tests/strings/quoted_printable_decode_basic.phpt index 09bcd343d0..b40080cdf3 100644 --- a/ext/standard/tests/strings/quoted_printable_decode_basic.phpt +++ b/ext/standard/tests/strings/quoted_printable_decode_basic.phpt @@ -9,9 +9,9 @@ Test quoted_printable_decode() function : basic functionality echo "*** Testing quoted_printable_decode() : basic functionality ***\n"; -$str = "=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A= -=20=D4=cf=D2=C7=CF=D7=D9=C5= -=20= +$str = "=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A= +=20=D4=cf=D2=C7=CF=D7=D9=C5= +=20= =D0= =D2=CF=C5=CB=D4=D9"; diff --git a/ext/standard/tests/strings/quoted_printable_encode_002.phpt b/ext/standard/tests/strings/quoted_printable_encode_002.phpt Binary files differindex aaf5608f33..b01b6957c9 100644 --- a/ext/standard/tests/strings/quoted_printable_encode_002.phpt +++ b/ext/standard/tests/strings/quoted_printable_encode_002.phpt diff --git a/ext/standard/tests/strings/setlocale_variation2.phpt b/ext/standard/tests/strings/setlocale_variation2.phpt index fad3298cc7..41a706c8bf 100644 --- a/ext/standard/tests/strings/setlocale_variation2.phpt +++ b/ext/standard/tests/strings/setlocale_variation2.phpt @@ -22,7 +22,7 @@ function good_locale($locale) { /** * Note: no_NO is a bogus locale and should not be used, see https://bugzilla.redhat.com/971416 **/ - return $locale !== 'tt_RU@iqtelif.UTF-8' && $locale !== 'no_NO.ISO-8859-1'; + return $locale !== 'tt_RU@iqtelif.UTF-8' && $locale !== 'no_NO.ISO-8859-1'; } /* Prototype : array list_system_locales( void ) diff --git a/ext/standard/tests/strings/sha1.phpt b/ext/standard/tests/strings/sha1.phpt index 4473598d06..1fea3566b5 100644 --- a/ext/standard/tests/strings/sha1.phpt +++ b/ext/standard/tests/strings/sha1.phpt @@ -5,18 +5,18 @@ sha1() with ASCII output $filename = __DIR__."/sha1.dat"; $a = array( - "abc", - "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "a", - "0123456701234567012345670123456701234567012345670123456701234567", - "" + "abc", + "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + "a", + "0123456701234567012345670123456701234567012345670123456701234567", + "" ); foreach ($a as $str) { - var_dump($val1 = sha1($str)); - file_put_contents($filename, $str); - var_dump($val2 = sha1_file($filename)); - var_dump($val1 === $val2); + var_dump($val1 = sha1($str)); + file_put_contents($filename, $str); + var_dump($val2 = sha1_file($filename)); + var_dump($val1 === $val2); } var_dump(sha1($str, true)); diff --git a/ext/standard/tests/strings/soundex.phpt b/ext/standard/tests/strings/soundex.phpt index 744f71c17a..ef61ac495e 100644 --- a/ext/standard/tests/strings/soundex.phpt +++ b/ext/standard/tests/strings/soundex.phpt @@ -25,7 +25,7 @@ $array = array( ); foreach ($array as $str) { - var_dump(soundex($str)); + var_dump(soundex($str)); } echo "Done\n"; diff --git a/ext/standard/tests/strings/str_pad_variation2.phpt b/ext/standard/tests/strings/str_pad_variation2.phpt index 1ebf1b2825..0bf8ad3ad8 100644 --- a/ext/standard/tests/strings/str_pad_variation2.phpt +++ b/ext/standard/tests/strings/str_pad_variation2.phpt @@ -11,7 +11,7 @@ $string = chr(0).chr(255).chr(128).chr(234).chr(143); /* different pad_lengths */ $pad_lengths = [ -PHP_INT_MAX, // huge negative value - -1, // negative value + -1, // negative value 0, // pad_length < sizeof(input_string) 9, // pad_length <= sizeof(input_string) 10, // pad_length > sizeof(input_string) diff --git a/ext/standard/tests/strings/str_replace_variation3.phpt b/ext/standard/tests/strings/str_replace_variation3.phpt index d52c0676c9..f1bbf89b9f 100644 --- a/ext/standard/tests/strings/str_replace_variation3.phpt +++ b/ext/standard/tests/strings/str_replace_variation3.phpt @@ -16,10 +16,10 @@ echo "\n*** Testing Miscellaneous input data ***\n"; /* If replace has fewer values than search, then an empty string is used for the rest of replacement values */ var_dump( str_replace(array("a", "a", "b"), - array("q", "q"), - "aaabb", $count - ) - ); + array("q", "q"), + "aaabb", $count + ) + ); var_dump($count); var_dump( str_replace(array("a", "a", "b"), array("q", "q"), diff --git a/ext/standard/tests/strings/str_rot13_basic.phpt b/ext/standard/tests/strings/str_rot13_basic.phpt index b90e86fd4f..bc071be2b4 100644 --- a/ext/standard/tests/strings/str_rot13_basic.phpt +++ b/ext/standard/tests/strings/str_rot13_basic.phpt @@ -14,16 +14,16 @@ 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"; + echo "Strings equal : TEST PASSED\n"; } else { - echo "Strings unequal : TEST FAILED\n"; + 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"; + echo "Strings equal : TEST PASSED\n"; } else { - echo "Strings unequal : TEST FAILED\n"; + echo "Strings unequal : TEST FAILED\n"; } echo "\nEnsure strings round trip\n"; @@ -31,9 +31,9 @@ $str = "str_rot13() tests starting"; $encode = str_rot13($str); $decode = str_rot13($encode); if (strcmp($str, $decode) == 0) { - echo "Strings equal : TEST PASSED\n"; + echo "Strings equal : TEST PASSED\n"; } else { - echo "Strings unequal : TEST FAILED\n"; + echo "Strings unequal : TEST FAILED\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/str_shuffle_basic.phpt b/ext/standard/tests/strings/str_shuffle_basic.phpt index 037d65ac0e..8e857ff4ec 100644 --- a/ext/standard/tests/strings/str_shuffle_basic.phpt +++ b/ext/standard/tests/strings/str_shuffle_basic.phpt @@ -29,13 +29,13 @@ for ($i = 0; $i < $trys; $i++) { $op = str_shuffle($ip); if (!is_string($op) || strlen($op) != $len_ip) { - echo "TEST FAILED\n"; + echo "TEST FAILED\n"; } // Combination already hit ? if (empty($a[$op])) { - // No first time init - $a[$op] = 0; + // No first time init + $a[$op] = 0; } // Increment count for this combination @@ -45,9 +45,9 @@ for ($i = 0; $i < $trys; $i++) { $combinations = count($a); if ($combinations != 24) { - echo "TEST FAILED.. Only $combinations out of a possible 24 combinations used\n"; + echo "TEST FAILED.. Only $combinations out of a possible 24 combinations used\n"; } else { - echo "TEST PASSED\n"; + echo "TEST PASSED\n"; } ?> diff --git a/ext/standard/tests/strings/str_split_variation6.phpt b/ext/standard/tests/strings/str_split_variation6.phpt index 2d73a06d10..270fcad05a 100644 --- a/ext/standard/tests/strings/str_split_variation6.phpt +++ b/ext/standard/tests/strings/str_split_variation6.phpt @@ -38,7 +38,7 @@ for($count = 0; $count < count($values); $count++) { echo "-- Iteration ".($count + 1)." --\n"; try { - var_dump( str_split($str, $values[$count]) ); + var_dump( str_split($str, $values[$count]) ); } catch (\ValueError $e) { echo $e->getMessage() . "\n"; } diff --git a/ext/standard/tests/strings/str_split_variation7.phpt b/ext/standard/tests/strings/str_split_variation7.phpt index 4d28b765ac..097607bf8b 100644 --- a/ext/standard/tests/strings/str_split_variation7.phpt +++ b/ext/standard/tests/strings/str_split_variation7.phpt @@ -40,7 +40,7 @@ for($count = 0; $count < count($values); $count++) { echo "-- Iteration ".($count + 1)." --\n"; try { - var_dump( str_split($str, $values[$count]) ); + var_dump( str_split($str, $values[$count]) ); } catch (\ValueError $e) { echo $e->getMessage() . "\n"; } diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt Binary files differindex 7c4fe920ad..4258f11ee3 100644 --- a/ext/standard/tests/strings/strcasecmp.phpt +++ b/ext/standard/tests/strings/strcasecmp.phpt diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt Binary files differindex e18a854244..d4110601af 100644 --- a/ext/standard/tests/strings/strcmp.phpt +++ b/ext/standard/tests/strings/strcmp.phpt diff --git a/ext/standard/tests/strings/strcoll.phpt b/ext/standard/tests/strings/strcoll.phpt index 37fe251b66..d1d3df11fc 100644 --- a/ext/standard/tests/strings/strcoll.phpt +++ b/ext/standard/tests/strings/strcoll.phpt @@ -13,7 +13,7 @@ Testfest 2009 Munich setlocale (LC_COLLATE, 'C'); $result = strcoll($a, $b); if($result > 0) { - echo "Pass\n"; + echo "Pass\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/strcspn_variation10.phpt b/ext/standard/tests/strings/strcspn_variation10.phpt index 1ad369f5dd..0b933b8049 100644 --- a/ext/standard/tests/strings/strcspn_variation10.phpt +++ b/ext/standard/tests/strings/strcspn_variation10.phpt @@ -18,35 +18,35 @@ echo "*** Testing strcspn() : with different mask strings and default start and // initialing required variables $strings = array( "", - '', - "\n", - '\n', - "hello\tworld\nhello\nworld\n", - 'hello\tworld\nhello\nworld\n', - "1234hello45world\t123", - '1234hello45world\t123', - "hello\0world\012", - 'hello\0world\012', - chr(0).chr(0), - chr(0)."hello\0world".chr(0), - chr(0).'hello\0world'.chr(0), - "hello".chr(0)."world", - 'hello'.chr(0).'world', - "hello\0\100\xaaaworld", - 'hello\0\100\xaaaworld' + '', + "\n", + '\n', + "hello\tworld\nhello\nworld\n", + 'hello\tworld\nhello\nworld\n', + "1234hello45world\t123", + '1234hello45world\t123', + "hello\0world\012", + 'hello\0world\012', + chr(0).chr(0), + chr(0)."hello\0world".chr(0), + chr(0).'hello\0world'.chr(0), + "hello".chr(0)."world", + 'hello'.chr(0).'world', + "hello\0\100\xaaaworld", + 'hello\0\100\xaaaworld' ); // defining array of mask strings $mask_array = array( - "", - '', - "\n\trsti \l", - '\n\trsti \l', - "\t", - "t\ ", - '\t', - "\t\ ", - " \t", + "", + '', + "\n\trsti \l", + '\n\trsti \l', + "\t", + "t\ ", + '\t', + "\t\ ", + " \t", "\t\i\100\xa" ); diff --git a/ext/standard/tests/strings/strcspn_variation12.phpt b/ext/standard/tests/strings/strcspn_variation12.phpt index 4495e7c26d..83530aee71 100644 --- a/ext/standard/tests/strings/strcspn_variation12.phpt +++ b/ext/standard/tests/strings/strcspn_variation12.phpt @@ -43,22 +43,22 @@ $mask_array = array( //defining array of start values $start_array = array( - 0, - 1, - 2, - -1, - 2147483647, // max positive integer - -2147483648 // min negative integer + 0, + 1, + 2, + -1, + 2147483647, // max positive integer + -2147483648 // min negative integer ); //defining array of len values $len_array = array( - 0, - 1, - 2, - -1, - 2147483647, // max positive integer - -2147483648 // min negative integer + 0, + 1, + 2, + -1, + 2147483647, // max positive integer + -2147483648 // min negative integer ); diff --git a/ext/standard/tests/strings/strcspn_variation6.phpt b/ext/standard/tests/strings/strcspn_variation6.phpt index 4d6c81d0fb..dc8ceb6ddf 100644 --- a/ext/standard/tests/strings/strcspn_variation6.phpt +++ b/ext/standard/tests/strings/strcspn_variation6.phpt @@ -62,15 +62,15 @@ $heredoc_strings = array( // defining array of mask strings $mask_array = array( - "", - '', - "\n\trsti \l", - '\n\trsti \l', - "\t", - "t\ ", - '\t', - "\t\ ", - " \t", + "", + '', + "\n\trsti \l", + '\n\trsti \l', + "\t", + "t\ ", + '\t', + "\t\ ", + " \t", "\t\i\100\xaa" ); diff --git a/ext/standard/tests/strings/strcspn_variation7.phpt b/ext/standard/tests/strings/strcspn_variation7.phpt index 1f53e20d6f..6c88b45f28 100644 --- a/ext/standard/tests/strings/strcspn_variation7.phpt +++ b/ext/standard/tests/strings/strcspn_variation7.phpt @@ -57,34 +57,34 @@ $heredoc_strings = array( $heredoc_with_newline_and_tabs, $heredoc_with_alphanumerics, $heredoc_with_embedded_nulls, - $heredoc_with_hexa_octal - ); + $heredoc_with_hexa_octal + ); // defining array of mask strings $mask_array = array( - "", - '', - "\n\trsti \l", - '\n\trsti \l', - "\t", - "t\ ", - '\t', - "\t\ ", - " \t", + "", + '', + "\n\trsti \l", + '\n\trsti \l', + "\t", + "t\ ", + '\t', + "\t\ ", + " \t", "\t\i\100\xaa" ); // definig array of start values $start_array = array( - 0, - 1, - 2, - -1, - -2, - 2147483647, // max positive integer - -2147483648, // min negative integer + 0, + 1, + 2, + -1, + -2, + 2147483647, // max positive integer + -2147483648, // min negative integer ); diff --git a/ext/standard/tests/strings/strcspn_variation8.phpt b/ext/standard/tests/strings/strcspn_variation8.phpt index 10c42731e7..388d9156a5 100644 --- a/ext/standard/tests/strings/strcspn_variation8.phpt +++ b/ext/standard/tests/strings/strcspn_variation8.phpt @@ -57,38 +57,38 @@ $heredoc_strings = array( $heredoc_with_newline_and_tabs, $heredoc_with_alphanumerics, $heredoc_with_embedded_nulls, - $heredoc_with_hexa_octal - ); + $heredoc_with_hexa_octal + ); // defining array of mask strings $mask_array = array( - "", - '', - "\n\trsti \l", - "\t", - "t\ ", - " \t", + "", + '', + "\n\trsti \l", + "\t", + "t\ ", + " \t", "\t\i\100\xaa" ); // definig array of start values $start_array = array( - 0, - 1, - 2, - -1, - 2147483647, // max positive integer - -2147483648, // min negative integer + 0, + 1, + 2, + -1, + 2147483647, // max positive integer + -2147483648, // min negative integer ); // defining array of len values $len_array = array( - 0, - 1, - 2, - -1, - 2147483647, // max positive integer - -2147483648, // min negative integer + 0, + 1, + 2, + -1, + 2147483647, // max positive integer + -2147483648, // min negative integer ); diff --git a/ext/standard/tests/strings/strcspn_variation9.phpt b/ext/standard/tests/strings/strcspn_variation9.phpt Binary files differindex 632aaa4b5d..6fd70827a5 100644 --- a/ext/standard/tests/strings/strcspn_variation9.phpt +++ b/ext/standard/tests/strings/strcspn_variation9.phpt diff --git a/ext/standard/tests/strings/strip_tags.phpt b/ext/standard/tests/strings/strip_tags.phpt index 7beebf1b0c..e594e1793c 100644 --- a/ext/standard/tests/strings/strip_tags.phpt +++ b/ext/standard/tests/strings/strip_tags.phpt @@ -2,20 +2,20 @@ strip_tags() function --FILE-- <?php - echo strip_tags('NEAT <? cool < blah ?> STUFF'); - echo "\n"; - echo strip_tags('NEAT <? cool > blah ?> STUFF'); - echo "\n"; - echo strip_tags('NEAT <!-- cool < blah --> STUFF'); - echo "\n"; - echo strip_tags('NEAT <!-- cool > blah --> STUFF'); - echo "\n"; - echo strip_tags('NEAT <? echo \"\\\"\"?> STUFF'); - echo "\n"; - echo strip_tags('NEAT <? echo \'\\\'\'?> STUFF'); - echo "\n"; - echo strip_tags('TESTS ?!!?!?!!!?!!'); - echo "\n"; + echo strip_tags('NEAT <? cool < blah ?> STUFF'); + echo "\n"; + echo strip_tags('NEAT <? cool > blah ?> STUFF'); + echo "\n"; + echo strip_tags('NEAT <!-- cool < blah --> STUFF'); + echo "\n"; + echo strip_tags('NEAT <!-- cool > blah --> STUFF'); + echo "\n"; + echo strip_tags('NEAT <? echo \"\\\"\"?> STUFF'); + echo "\n"; + echo strip_tags('NEAT <? echo \'\\\'\'?> STUFF'); + echo "\n"; + echo strip_tags('TESTS ?!!?!?!!!?!!'); + echo "\n"; ?> --EXPECT-- NEAT STUFF diff --git a/ext/standard/tests/strings/stripos.phpt b/ext/standard/tests/strings/stripos.phpt index bc2a7bc8e5..f56d38d3de 100644 --- a/ext/standard/tests/strings/stripos.phpt +++ b/ext/standard/tests/strings/stripos.phpt @@ -2,29 +2,29 @@ stripos() function test --FILE-- <?php - var_dump(stripos("test string", "TEST")); - var_dump(stripos("test string", "strIng")); - var_dump(stripos("test string", "stRin")); - var_dump(stripos("test string", "t S")); - var_dump(stripos("test string", "G")); - var_dump(stripos("te".chr(0)."st", chr(0))); - var_dump(stripos("tEst", "test")); - var_dump(stripos("teSt", "test")); - var_dump(stripos("", "")); - var_dump(stripos("a", "")); - var_dump(stripos("", "a")); - var_dump(stripos("a", " ")); - var_dump(stripos("a", "a")); - var_dump(stripos("", 1)); - var_dump(stripos("", false)); - var_dump(stripos("", true)); - var_dump(stripos("a", 1)); - var_dump(stripos("a", false)); - var_dump(stripos("a", true)); - var_dump(stripos("1", 1)); - var_dump(stripos("0", false)); - var_dump(stripos("1", true)); - var_dump(stripos("\\\\a", "\\a")); + var_dump(stripos("test string", "TEST")); + var_dump(stripos("test string", "strIng")); + var_dump(stripos("test string", "stRin")); + var_dump(stripos("test string", "t S")); + var_dump(stripos("test string", "G")); + var_dump(stripos("te".chr(0)."st", chr(0))); + var_dump(stripos("tEst", "test")); + var_dump(stripos("teSt", "test")); + var_dump(stripos("", "")); + var_dump(stripos("a", "")); + var_dump(stripos("", "a")); + var_dump(stripos("a", " ")); + var_dump(stripos("a", "a")); + var_dump(stripos("", 1)); + var_dump(stripos("", false)); + var_dump(stripos("", true)); + var_dump(stripos("a", 1)); + var_dump(stripos("a", false)); + var_dump(stripos("a", true)); + var_dump(stripos("1", 1)); + var_dump(stripos("0", false)); + var_dump(stripos("1", true)); + var_dump(stripos("\\\\a", "\\a")); ?> DONE diff --git a/ext/standard/tests/strings/stripslashes_variation2.phpt b/ext/standard/tests/strings/stripslashes_variation2.phpt Binary files differindex 5bfe5ce1fd..fdca660c4d 100644 --- a/ext/standard/tests/strings/stripslashes_variation2.phpt +++ b/ext/standard/tests/strings/stripslashes_variation2.phpt diff --git a/ext/standard/tests/strings/stripslashes_variation3.phpt b/ext/standard/tests/strings/stripslashes_variation3.phpt index 61af9db836..54a8b3d02e 100644 --- a/ext/standard/tests/strings/stripslashes_variation3.phpt +++ b/ext/standard/tests/strings/stripslashes_variation3.phpt @@ -28,22 +28,22 @@ EOT; $str_array = array( // string with newline character "\n", - "\\n", + "\\n", "Hello \nworld", "Hello \\nworld", '\n', - '\\n', + '\\n', 'Hello \nworld', 'Hello \\nworld', $heredoc_string_with_newline, // string with tab character - "\t", - "\\t", + "\t", + "\\t", "Hello \tworld", "Hello \\tworld", - '\t', - '\\t', + '\t', + '\\t', 'Hello \tworld', 'Hello \\tworld', $heredoc_string_with_tab diff --git a/ext/standard/tests/strings/stristr.phpt b/ext/standard/tests/strings/stristr.phpt index 0d47e80bcb..7b1b5312a1 100644 --- a/ext/standard/tests/strings/stristr.phpt +++ b/ext/standard/tests/strings/stristr.phpt @@ -2,17 +2,17 @@ stristr() function --FILE-- <?php - var_dump(stristr("tEsT sTrInG", "tEsT")); - var_dump(stristr("tEsT sTrInG", "stRiNg")); - var_dump(stristr("tEsT sTrInG", "stRiN")); - var_dump(stristr("tEsT sTrInG", "t S")); - var_dump(stristr("tEsT sTrInG", "g")); - var_dump(md5(stristr("te".chr(0)."st", chr(0)))); - var_dump(stristr("", "")); - var_dump(stristr("a", "")); - var_dump(stristr("", "a")); - var_dump(md5(stristr("\\\\a\\", "\\a"))); - var_dump(stristr("tEsT sTrInG", " ")); + var_dump(stristr("tEsT sTrInG", "tEsT")); + var_dump(stristr("tEsT sTrInG", "stRiNg")); + var_dump(stristr("tEsT sTrInG", "stRiN")); + var_dump(stristr("tEsT sTrInG", "t S")); + var_dump(stristr("tEsT sTrInG", "g")); + var_dump(md5(stristr("te".chr(0)."st", chr(0)))); + var_dump(stristr("", "")); + var_dump(stristr("a", "")); + var_dump(stristr("", "a")); + var_dump(md5(stristr("\\\\a\\", "\\a"))); + var_dump(stristr("tEsT sTrInG", " ")); ?> --EXPECTF-- string(11) "tEsT sTrInG" diff --git a/ext/standard/tests/strings/stristr_variation2.phpt b/ext/standard/tests/strings/stristr_variation2.phpt index 553c462097..8448292802 100644 --- a/ext/standard/tests/strings/stristr_variation2.phpt +++ b/ext/standard/tests/strings/stristr_variation2.phpt @@ -26,42 +26,42 @@ $file_handle = fopen(__FILE__, "r"); // array with different values for $input $inputs = array ( - // integer values + // integer values /*1*/ 0, - 1, - -2, - -PHP_INT_MAX, + 1, + -2, + -PHP_INT_MAX, - // float values + // float values /*5*/ 10.5, - -20.5, - 10.1234567e10, + -20.5, + 10.1234567e10, - // array values + // array values /*8*/ array(), - array(0), - array(1, 2), + array(0), + array(1, 2), - // boolean values + // boolean values /*11*/ true, - false, - TRUE, - FALSE, + false, + TRUE, + FALSE, - // null values + // null values /*15*/ NULL, - null, + null, - // objects + // objects /*17*/ new sample(), - // resource + // resource /*18*/ $file_handle, - // undefined variable + // undefined variable /*19*/ @$undefined_var, - // unset variable + // unset variable /*20*/ @$unset_var ); diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt Binary files differindex 14aa687a1a..6be163d8fe 100644 --- a/ext/standard/tests/strings/strlen.phpt +++ b/ext/standard/tests/strings/strlen.phpt diff --git a/ext/standard/tests/strings/strnatcasecmp_basic.phpt b/ext/standard/tests/strings/strnatcasecmp_basic.phpt index 043ad43d37..5968980642 100644 --- a/ext/standard/tests/strings/strnatcasecmp_basic.phpt +++ b/ext/standard/tests/strings/strnatcasecmp_basic.phpt @@ -11,7 +11,7 @@ Felix De Vliegher <felix.devliegher@gmail.com> */ function str_dump($one, $two) { - var_dump(strnatcasecmp($one, $two)); + var_dump(strnatcasecmp($one, $two)); } echo "*** Testing strnatcasecmp() : basic functionality ***\n"; diff --git a/ext/standard/tests/strings/strnatcasecmp_variation1.phpt b/ext/standard/tests/strings/strnatcasecmp_variation1.phpt index 7f6d4579c3..44d2a09c5a 100644 --- a/ext/standard/tests/strings/strnatcasecmp_variation1.phpt +++ b/ext/standard/tests/strings/strnatcasecmp_variation1.phpt @@ -13,25 +13,25 @@ Felix De Vliegher <felix.devliegher@gmail.com> /* Preparation */ class a { - function __toString() - { - return "Hello WORLD"; - } + function __toString() + { + return "Hello WORLD"; + } } class b { - function __toString() - { - return "HELLO world"; - } + function __toString() + { + return "HELLO world"; + } } $a = new a(); $b = new b(); function str_dump($a, $b) { - var_dump(strnatcasecmp($a, $b)); + var_dump(strnatcasecmp($a, $b)); } echo "*** Testing strnatcasecmp() : variation ***\n"; diff --git a/ext/standard/tests/strings/strrev.phpt b/ext/standard/tests/strings/strrev.phpt index 92c66817d9..6303fccc20 100644 --- a/ext/standard/tests/strings/strrev.phpt +++ b/ext/standard/tests/strings/strrev.phpt @@ -2,16 +2,16 @@ strrev() function --FILE-- <?php - $i = 0; - $str = ''; + $i = 0; + $str = ''; - while ($i<256) { - $str .= chr($i++); - } + while ($i<256) { + $str .= chr($i++); + } - var_dump(md5(strrev($str))); - var_dump(strrev(NULL)); - var_dump(strrev("")); + var_dump(md5(strrev($str))); + var_dump(strrev(NULL)); + var_dump(strrev("")); ?> --EXPECT-- string(32) "ec6df70f2569891eae50321a9179eb82" diff --git a/ext/standard/tests/strings/strripos.phpt b/ext/standard/tests/strings/strripos.phpt index c343e92731..81881c3796 100644 --- a/ext/standard/tests/strings/strripos.phpt +++ b/ext/standard/tests/strings/strripos.phpt @@ -2,19 +2,19 @@ strripos() function --FILE-- <?php - var_dump(strripos("test test string", "test")); - var_dump(strripos("test string sTring", "string")); - var_dump(strripos("test strip string strand", "str")); - var_dump(strripos("I am what I am and that's all what I am", "am", -3)); - var_dump(strripos("test string", "g")); - var_dump(strripos("te".chr(0)."st", chr(0))); - var_dump(strripos("tEst", "test")); - var_dump(strripos("teSt", "test")); - var_dump(strripos("foo", "f", 1)); - var_dump(strripos("", "")); - var_dump(strripos("a", "")); - var_dump(strripos("", "a")); - var_dump(strripos("\\\\a", "\\a")); + var_dump(strripos("test test string", "test")); + var_dump(strripos("test string sTring", "string")); + var_dump(strripos("test strip string strand", "str")); + var_dump(strripos("I am what I am and that's all what I am", "am", -3)); + var_dump(strripos("test string", "g")); + var_dump(strripos("te".chr(0)."st", chr(0))); + var_dump(strripos("tEst", "test")); + var_dump(strripos("teSt", "test")); + var_dump(strripos("foo", "f", 1)); + var_dump(strripos("", "")); + var_dump(strripos("a", "")); + var_dump(strripos("", "a")); + var_dump(strripos("\\\\a", "\\a")); ?> --EXPECT-- int(5) diff --git a/ext/standard/tests/strings/strripos_variation1.phpt b/ext/standard/tests/strings/strripos_variation1.phpt index 5c143d2564..d8188bdd87 100644 --- a/ext/standard/tests/strings/strripos_variation1.phpt +++ b/ext/standard/tests/strings/strripos_variation1.phpt @@ -12,54 +12,54 @@ Test strripos() function : usage variations - double quoted strings for 'haystac echo "*** Testing strripos() function: with double quoted strings ***\n"; $haystack = "Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 "; $needles = array( - //regular strings + //regular strings /*1*/ "l", - "L", - "HELLO", - "hEllo", + "L", + "HELLO", + "hEllo", - //escape characters + //escape characters /*5*/ "\t", - "\T", //invalid input - " ", - "\n", - "\N", //invalid input - " + "\T", //invalid input + " ", + "\n", + "\N", //invalid input + " ", //new line - //nulls + //nulls /*11*/ "\0", - NULL, - null, + NULL, + null, - //boolean false + //boolean false /*14*/ FALSE, - false, + false, - //empty string + //empty string /*16*/ "", - //special chars + //special chars /*17*/ " ", - "$", - " $", - "&", - "!#", - "()", - "<=>", - ">", - "=>", - "?", - "@", - "@hEllo", + "$", + " $", + "&", + "!#", + "()", + "<=>", + ">", + "=>", + "?", + "@", + "@hEllo", /*29*/ "12345", //decimal numeric string - "\x23", //hexadecimal numeric string - "#", //respective ASCII char of \x23 - "\101", //octal numeric string - "A", //respective ASCII char of \101 - "456HEE", //numerics + chars - $haystack //haystack as needle + "\x23", //hexadecimal numeric string + "#", //respective ASCII char of \x23 + "\101", //octal numeric string + "A", //respective ASCII char of \101 + "456HEE", //numerics + chars + $haystack //haystack as needle ); /* loop through to get the position of the needle in haystack string */ diff --git a/ext/standard/tests/strings/strripos_variation2.phpt b/ext/standard/tests/strings/strripos_variation2.phpt index 273215b616..55753c5c9b 100644 --- a/ext/standard/tests/strings/strripos_variation2.phpt +++ b/ext/standard/tests/strings/strripos_variation2.phpt @@ -12,55 +12,55 @@ Test strripos() function : usage variations - single quoted strings for 'haystac echo "*** Testing strripos() function: with single quoted strings ***\n"; $haystack = 'Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 '; $needles = array( - //regular strings + //regular strings /*1*/ 'l', - 'L', - 'HELLO', - 'hEllo', + 'L', + 'HELLO', + 'hEllo', - //escape characters + //escape characters /*5*/ '\t', - '\T', - ' ', - '\n', - '\N', - ' - ', //new line + '\T', + ' ', + '\n', + '\N', + ' + ', //new line - //nulls + //nulls /*11*/ '\0', - NULL, - null, + NULL, + null, - //boolean false + //boolean false /*14*/ FALSE, - false, + false, - //empty string + //empty string /*16*/ '', - //special chars + //special chars /*17*/ ' ', - '$', - ' $', - '&', - '!#', - '()', - '<=>', - '>', - '=>', - '?', - '@', - '@hEllo', + '$', + ' $', + '&', + '!#', + '()', + '<=>', + '>', + '=>', + '?', + '@', + '@hEllo', /*29*/ '12345', //decimal numeric string - '\x23', //hexadecimal numeric string - '#', //respective ASCII char of \x23 - '\101', //octal numeric string - 'A', // respective ASCII char for \101 - '456HEE', //numerics + chars - 42, //needle as int(ASCII value of '*') - $haystack //haystack as needle + '\x23', //hexadecimal numeric string + '#', //respective ASCII char of \x23 + '\101', //octal numeric string + 'A', // respective ASCII char for \101 + '456HEE', //numerics + chars + 42, //needle as int(ASCII value of '*') + $haystack //haystack as needle ); /* loop through to get the position of the needle in haystack string */ diff --git a/ext/standard/tests/strings/strrpos.phpt b/ext/standard/tests/strings/strrpos.phpt index f672d93a2a..d374175b5a 100644 --- a/ext/standard/tests/strings/strrpos.phpt +++ b/ext/standard/tests/strings/strrpos.phpt @@ -2,19 +2,19 @@ strrpos() function --FILE-- <?php - var_dump(strrpos("test test string", "test")); - var_dump(strrpos("test string sTring", "string")); - var_dump(strrpos("test strip string strand", "str")); - var_dump(strrpos("I am what I am and that's all what I am", "am", -3)); - var_dump(strrpos("test string", "g")); - var_dump(strrpos("te".chr(0)."st", chr(0))); - var_dump(strrpos("tEst", "test")); - var_dump(strrpos("teSt", "test")); - var_dump(strrpos("foo", "f", 1)); - var_dump(strrpos("", "")); - var_dump(strrpos("a", "")); - var_dump(strrpos("", "a")); - var_dump(strrpos("\\\\a", "\\a")); + var_dump(strrpos("test test string", "test")); + var_dump(strrpos("test string sTring", "string")); + var_dump(strrpos("test strip string strand", "str")); + var_dump(strrpos("I am what I am and that's all what I am", "am", -3)); + var_dump(strrpos("test string", "g")); + var_dump(strrpos("te".chr(0)."st", chr(0))); + var_dump(strrpos("tEst", "test")); + var_dump(strrpos("teSt", "test")); + var_dump(strrpos("foo", "f", 1)); + var_dump(strrpos("", "")); + var_dump(strrpos("a", "")); + var_dump(strrpos("", "a")); + var_dump(strrpos("\\\\a", "\\a")); ?> --EXPECT-- int(5) diff --git a/ext/standard/tests/strings/strrpos_negative_offset.phpt b/ext/standard/tests/strings/strrpos_negative_offset.phpt index 17560f18f7..41b2b16b56 100644 --- a/ext/standard/tests/strings/strrpos_negative_offset.phpt +++ b/ext/standard/tests/strings/strrpos_negative_offset.phpt @@ -2,28 +2,28 @@ strr[i]pos() function with negative offset --FILE-- <?php - var_dump(strrpos("haysthack", 'ha', -9)); - var_dump(strrpos("haystack", 'h', -8)); - var_dump(strrpos("haystack", 'k', -1)); - var_dump(strrpos("haystack", "ka", -1)); - var_dump(strrpos("haystack", 'a', -3)); - var_dump(strrpos("haystack", 'a', -4)); - try { - strrpos("haystack", 'h', -9); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; - } - var_dump(strripos("HAYSTHACk", 'ha', -9)); - var_dump(strripos("HAYSTACK", 'h', -8)); - var_dump(strripos("HAYSTACK", 'k', -1)); - var_dump(strripos("HAYSTACK", "ka", -1)); - var_dump(strripos("HAYSTACK", 'a', -3)); - var_dump(strripos("HAYSTACK", 'a', -4)); - try { - strripos("HAYSTACK", 'h', -9); - } catch (ValueError $exception) { + var_dump(strrpos("haysthack", 'ha', -9)); + var_dump(strrpos("haystack", 'h', -8)); + var_dump(strrpos("haystack", 'k', -1)); + var_dump(strrpos("haystack", "ka", -1)); + var_dump(strrpos("haystack", 'a', -3)); + var_dump(strrpos("haystack", 'a', -4)); + try { + strrpos("haystack", 'h', -9); + } catch (ValueError $exception) { echo $exception->getMessage() . "\n"; - } + } + var_dump(strripos("HAYSTHACk", 'ha', -9)); + var_dump(strripos("HAYSTACK", 'h', -8)); + var_dump(strripos("HAYSTACK", 'k', -1)); + var_dump(strripos("HAYSTACK", "ka", -1)); + var_dump(strripos("HAYSTACK", 'a', -3)); + var_dump(strripos("HAYSTACK", 'a', -4)); + try { + strripos("HAYSTACK", 'h', -9); + } catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; + } ?> --EXPECT-- int(0) diff --git a/ext/standard/tests/strings/strspn_variation10.phpt b/ext/standard/tests/strings/strspn_variation10.phpt index d8eb52aa6f..952110880f 100644 --- a/ext/standard/tests/strings/strspn_variation10.phpt +++ b/ext/standard/tests/strings/strspn_variation10.phpt @@ -19,35 +19,35 @@ echo "*** Testing strspn() : with different mask strings and default start and l // defining different strings $strings = array( "", - '', - "\n", - '\n', - "hello\tworld\nhello\nworld\n", - 'hello\tworld\nhello\nworld\n', - "1234hello45world\t123", - '1234hello45world\t123', - "hello\0world\012", - 'hello\0world\012', - chr(0).chr(0), - chr(0)."hello\0world".chr(0), - chr(0).'hello\0world'.chr(0), - "hello".chr(0)."world", - 'hello'.chr(0).'world', - "hello\0\100\xaaaworld", - 'hello\0\100\xaaaworld' + '', + "\n", + '\n', + "hello\tworld\nhello\nworld\n", + 'hello\tworld\nhello\nworld\n', + "1234hello45world\t123", + '1234hello45world\t123', + "hello\0world\012", + 'hello\0world\012', + chr(0).chr(0), + chr(0)."hello\0world".chr(0), + chr(0).'hello\0world'.chr(0), + "hello".chr(0)."world", + 'hello'.chr(0).'world', + "hello\0\100\xaaaworld", + 'hello\0\100\xaaaworld' ); // define the array of mask strings $mask_array = array( - "", - '', - "f\n\trelshti \l", - 'f\n\trelsthi \l', - "\telh", - "t\ ", - '\telh', - "felh\t\ ", - " \t", + "", + '', + "f\n\trelshti \l", + 'f\n\trelsthi \l', + "\telh", + "t\ ", + '\telh', + "felh\t\ ", + " \t", "fhel\t\i\100\xa" ); diff --git a/ext/standard/tests/strings/strspn_variation11.phpt b/ext/standard/tests/strings/strspn_variation11.phpt index ecbe6a4967..1737155a7a 100644 --- a/ext/standard/tests/strings/strspn_variation11.phpt +++ b/ext/standard/tests/strings/strspn_variation11.phpt @@ -19,47 +19,47 @@ echo "*** Testing strspn() : with different start and default len values ***\n"; // defining different strings $strings = array( "", - '', - "\n", - '\n', - "hello\tworld\nhello\nworld\n", - 'hello\tworld\nhello\nworld\n', - "1234hello45world\t123", - '1234hello45world\t123', - "hello\0world\012", - 'hello\0world\012', - chr(0).chr(0), - chr(0)."hello\0world".chr(0), - chr(0).'hello\0world'.chr(0), - "hello".chr(0)."world", - 'hello'.chr(0).'world', - "hello\0\100\xaaaworld", - 'hello\0\100\xaaaworld' + '', + "\n", + '\n', + "hello\tworld\nhello\nworld\n", + 'hello\tworld\nhello\nworld\n', + "1234hello45world\t123", + '1234hello45world\t123', + "hello\0world\012", + 'hello\0world\012', + chr(0).chr(0), + chr(0)."hello\0world".chr(0), + chr(0).'hello\0world'.chr(0), + "hello".chr(0)."world", + 'hello'.chr(0).'world', + "hello\0\100\xaaaworld", + 'hello\0\100\xaaaworld' ); // define the array of mask strings $mask_array = array( - "", - '', - "f\n\trelshti \l", - 'f\n\trelsthi \l', - "\telh", - "t\ ", - '\telh', - "felh\t\ ", - " \t", + "", + '', + "f\n\trelshti \l", + 'f\n\trelsthi \l', + "\telh", + "t\ ", + '\telh', + "felh\t\ ", + " \t", "fhel\t\i\100\xa" ); // defining the array for start values $start_array = array( - 0, - 1, + 0, + 1, 2, - -1, - -2, - 2147483647, // max positive integer - -2147483648, // min negative integer + -1, + -2, + 2147483647, // max positive integer + -2147483648, // min negative integer ); diff --git a/ext/standard/tests/strings/strspn_variation12.phpt b/ext/standard/tests/strings/strspn_variation12.phpt index 1c404c1914..e5615c9532 100644 --- a/ext/standard/tests/strings/strspn_variation12.phpt +++ b/ext/standard/tests/strings/strspn_variation12.phpt @@ -19,47 +19,47 @@ echo "*** Testing strspn() : with different start and len values ***\n"; // defining different strings $strings = array( "", - '', - "\n", - '\n', - "hello\tworld\nhello\nworld\n", - "1234hello45world\t123", - "hello\0world\012", - chr(0).chr(0), - chr(0)."hello\0world".chr(0), - "hello".chr(0)."world", - "hello\0\100\xaaaworld", + '', + "\n", + '\n', + "hello\tworld\nhello\nworld\n", + "1234hello45world\t123", + "hello\0world\012", + chr(0).chr(0), + chr(0)."hello\0world".chr(0), + "hello".chr(0)."world", + "hello\0\100\xaaaworld", ); // define the array of mask strings $mask_array = array( - "", - '', - "f\n\trelshti \l", - 'f\n\trelsthi \l', - "\telh", - "felh\t\ ", + "", + '', + "f\n\trelshti \l", + 'f\n\trelsthi \l', + "\telh", + "felh\t\ ", "fhel\t\i\100\xa" ); // defining the array for start values $start_array = array( - 0, - 1, - 2, - -1, - 2147483647, // max positive integer - -2147483648, // min negative integer + 0, + 1, + 2, + -1, + 2147483647, // max positive integer + -2147483648, // min negative integer ); // defining an array of len values $len_array = array( - 0, - 1, - 2, - -1, - 2147483647, // max positive integer - -2147483648, // min negative integer + 0, + 1, + 2, + -1, + 2147483647, // max positive integer + -2147483648, // min negative integer ); diff --git a/ext/standard/tests/strings/strspn_variation6.phpt b/ext/standard/tests/strings/strspn_variation6.phpt index b202bb8234..8c75e89775 100644 --- a/ext/standard/tests/strings/strspn_variation6.phpt +++ b/ext/standard/tests/strings/strspn_variation6.phpt @@ -63,15 +63,15 @@ $heredoc_strings = array( // defining array of different mask strings $mask_array = array( - "", - '', - "fh\ne\trlsti \l", - 'fieh\n\trlsti \l', - "\t", - "lt\ ", - 'l\t', - "fl\t\eh ", - "l \te", + "", + '', + "fh\ne\trlsti \l", + 'fieh\n\trlsti \l', + "\t", + "lt\ ", + 'l\t', + "fl\t\eh ", + "l \te", "lf\the\i\100\xaa" ); diff --git a/ext/standard/tests/strings/strspn_variation7.phpt b/ext/standard/tests/strings/strspn_variation7.phpt index bbfe5d4868..962c180c40 100644 --- a/ext/standard/tests/strings/strspn_variation7.phpt +++ b/ext/standard/tests/strings/strspn_variation7.phpt @@ -63,27 +63,27 @@ $heredoc_strings = array( // defining array of different mask strings $mask_array = array( - "", - '', - "f\nh\trstie \l", - 'f\n\thrstei \l', - "\t", - "t\ e", - '\t', - "f\te\h ", - " \t", + "", + '', + "f\nh\trstie \l", + 'f\n\thrstei \l', + "\t", + "t\ e", + '\t', + "f\te\h ", + " \t", "f\t\ih\100e\xa" ); // defining array of different start values $start_array = array( - 0, - 1, - 2, - -1, - -2, - 2147483647, // max positive integer - -2147483648, // min negative integer + 0, + 1, + 2, + -1, + -2, + 2147483647, // max positive integer + -2147483648, // min negative integer ); diff --git a/ext/standard/tests/strings/strspn_variation8.phpt b/ext/standard/tests/strings/strspn_variation8.phpt index 0ff0000132..a3486908b7 100644 --- a/ext/standard/tests/strings/strspn_variation8.phpt +++ b/ext/standard/tests/strings/strspn_variation8.phpt @@ -63,33 +63,33 @@ $heredoc_strings = array( // defining array of different mask strings $mask_array = array( - "", - '', - "f\n\\0htersti \l", - "\t", - "het\ ", - "fel\th\ ", + "", + '', + "f\n\\0htersti \l", + "\t", + "het\ ", + "fel\th\ ", "f\t\hiel\100\xaa" ); // defining array of different start values $start_array = array( - 0, - 1, - 2, - -1, - 2147483647, // max positive integer - -2147483648, // min negative integer + 0, + 1, + 2, + -1, + 2147483647, // max positive integer + -2147483648, // min negative integer ); // defining array of different len values $len_array = array( - 0, - 1, - 2, - -1, - 2147483647, // max positive integer - -2147483648, // min negative integer + 0, + 1, + 2, + -1, + 2147483647, // max positive integer + -2147483648, // min negative integer ); diff --git a/ext/standard/tests/strings/strspn_variation9.phpt b/ext/standard/tests/strings/strspn_variation9.phpt Binary files differindex 0835047ff5..49d590bee8 100644 --- a/ext/standard/tests/strings/strspn_variation9.phpt +++ b/ext/standard/tests/strings/strspn_variation9.phpt diff --git a/ext/standard/tests/strings/strtok_variation4.phpt b/ext/standard/tests/strings/strtok_variation4.phpt index 5db1d39650..fb34639f48 100644 --- a/ext/standard/tests/strings/strtok_variation4.phpt +++ b/ext/standard/tests/strings/strtok_variation4.phpt @@ -15,8 +15,8 @@ echo "*** Testing strtok() : with embedded nulls in the strings ***\n"; // defining varous strings with embedded nulls $strings_with_nulls = array( - "\0", - '\0', + "\0", + '\0', "hello\0world", "\0hel\0lo", "hello\0", diff --git a/ext/standard/tests/strings/strtok_variation5.phpt b/ext/standard/tests/strings/strtok_variation5.phpt index a99d13eb7a..e844f97eef 100644 --- a/ext/standard/tests/strings/strtok_variation5.phpt +++ b/ext/standard/tests/strings/strtok_variation5.phpt @@ -15,31 +15,31 @@ echo "*** Testing strtok() : with miscellaneous inputs ***\n"; // defining arrays for input strings and tokens $string_array = array( - "HELLO WORLD", - "hello world", - "_HELLO_WORLD_", - "/thello/t/wor/ttld", - "hel/lo/t/world", + "HELLO WORLD", + "hello world", + "_HELLO_WORLD_", + "/thello/t/wor/ttld", + "hel/lo/t/world", "one:$:two:!:three:#:four", - "\rhello/r/wor\rrld", - chr(0), + "\rhello/r/wor\rrld", + chr(0), chr(0).chr(0), chr(0).'hello'.chr(0), 'hello'.chr(0).'world' - ); + ); $token_array = array( - "wr", - "hello world", - "__", + "wr", + "hello world", + "__", "t/", - '/t', - ":", - "\r", - "\0", - "\0", - "\0", - "\0", - ); + '/t', + ":", + "\r", + "\0", + "\0", + "\0", + "\0", + ); // loop through each element of the array and check the working of strtok() // when supplied with different string and token values diff --git a/ext/standard/tests/strings/strtok_variation6.phpt b/ext/standard/tests/strings/strtok_variation6.phpt index cd7f3b3041..4d435dcef4 100644 --- a/ext/standard/tests/strings/strtok_variation6.phpt +++ b/ext/standard/tests/strings/strtok_variation6.phpt @@ -15,18 +15,18 @@ echo "*** Testing strtok() : with invalid escape sequences in token ***\n"; // defining arrays for input strings and tokens $string_array = array( - "khellok worldk", - "\khello\k world\k", - "/khello\k world/k", - "/hellok/ world" - ); + "khellok worldk", + "\khello\k world\k", + "/khello\k world/k", + "/hellok/ world" + ); $token_array = array( - "k", - "/ ", - "/k", - "\k", - "\\\\\\\k\h\\e\l\o\w\r\l\d" - ); + "k", + "/ ", + "/k", + "\k", + "\\\\\\\k\h\\e\l\o\w\r\l\d" + ); // loop through each element of the array and check the working of strtok() // when supplied with different string and token values diff --git a/ext/standard/tests/strings/strtr_variation6.phpt b/ext/standard/tests/strings/strtr_variation6.phpt index e0c2458ede..9956acaca8 100644 --- a/ext/standard/tests/strings/strtr_variation6.phpt +++ b/ext/standard/tests/strings/strtr_variation6.phpt @@ -34,41 +34,41 @@ $str = "012atm"; // array of values for 'from' $from_arr = array ( - // integer values + // integer values /*1*/ 0, - 1, - -2, + 1, + -2, - // float values + // float values /*4*/ 10.5, - -20.5, - 10.1234567e10, + -20.5, + 10.1234567e10, - // array values + // array values /*7*/ array(), - array(0), - array(1, 2), + array(0), + array(1, 2), - // boolean values + // boolean values /*10*/ true, - false, - TRUE, - FALSE, + false, + TRUE, + FALSE, - // null values + // null values /*14*/ NULL, - null, + null, - // objects + // objects /*16*/ new sample(), - // resource + // resource /*17*/ $file_handle, - // undefined variable + // undefined variable /*18*/ @$undefined_var, - // unset variable + // unset variable /*19*/ @$unset_var ); diff --git a/ext/standard/tests/strings/strval_basic.phpt b/ext/standard/tests/strings/strval_basic.phpt index ac89554527..9e26446c4c 100644 --- a/ext/standard/tests/strings/strval_basic.phpt +++ b/ext/standard/tests/strings/strval_basic.phpt @@ -18,23 +18,23 @@ EOT; //array of values to iterate over $values = array( - // Simple strings + // Simple strings /*1*/ "Hello World", - 'Hello World', + 'Hello World', - // String with control chars + // String with control chars /*3*/ "String\nwith\ncontrol\ncharacters\r\n", - // String with quotes + // String with quotes /*4*/ "String with \"quotes\"", - //Numeric String + //Numeric String /*5*/ "123456", - // Hexadecimal string + // Hexadecimal string /*6*/ "0xABC", - //Heredoc String + //Heredoc String /*7*/ $simple_heredoc ); diff --git a/ext/standard/tests/strings/strval_error.phpt b/ext/standard/tests/strings/strval_error.phpt index 18d502eb2b..a363e26f24 100644 --- a/ext/standard/tests/strings/strval_error.phpt +++ b/ext/standard/tests/strings/strval_error.phpt @@ -13,7 +13,7 @@ error_reporting(E_ALL ^ E_NOTICE); class MyClass { - // no toString() method defined + // no toString() method defined } // Testing strval with a object which has no toString() method diff --git a/ext/standard/tests/strings/strval_variation1.phpt b/ext/standard/tests/strings/strval_variation1.phpt index 068e1e2649..d64a7c4ab0 100644 --- a/ext/standard/tests/strings/strval_variation1.phpt +++ b/ext/standard/tests/strings/strval_variation1.phpt @@ -25,59 +25,59 @@ class MyClass //array of values to iterate over $values = array( - //Decimal values + //Decimal values /*1*/ 0, - 1, - 12345, - -12345, + 1, + 12345, + -12345, - //Octal values + //Octal values /*5*/ 02, - 010, - 030071, - -030071, + 010, + 030071, + -030071, - //Hexadecimal values + //Hexadecimal values /*9*/ 0x0, - 0x1, - 0xABCD, - -0xABCD, + 0x1, + 0xABCD, + -0xABCD, - // float data + // float data /*13*/ 100.5, - -100.5, - 100.1234567e10, - 100.7654321E-10, - .5, + -100.5, + 100.1234567e10, + 100.7654321E-10, + .5, - // array data + // array data /*18*/ array(), - array('color' => 'red', 'item' => 'pen'), + array('color' => 'red', 'item' => 'pen'), - // null data + // null data /*20*/ NULL, - null, + null, - // boolean data + // boolean data /*22*/ true, - false, - TRUE, - FALSE, + false, + TRUE, + FALSE, - // empty data + // empty data /*26*/ "", - '', + '', - // object data + // object data /*28*/ new MyClass(), - // resource + // resource /*29*/ $file_handle, - // undefined data + // undefined data /*30*/ @$undefined_var, - // unset data + // unset data /*31*/ @$unset_var, ); diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt Binary files differindex c5c7ce3c87..e7c0373a3c 100644 --- a/ext/standard/tests/strings/ucfirst.phpt +++ b/ext/standard/tests/strings/ucfirst.phpt diff --git a/ext/standard/tests/strings/unpack.phpt b/ext/standard/tests/strings/unpack.phpt index 3a6068be71..435361cca5 100644 --- a/ext/standard/tests/strings/unpack.phpt +++ b/ext/standard/tests/strings/unpack.phpt @@ -2,8 +2,8 @@ Invalid format type validation --FILE-- <?php - var_dump(unpack("-2222", 1)); - echo "Done\n"; + var_dump(unpack("-2222", 1)); + echo "Done\n"; ?> --EXPECTF-- Warning: unpack(): Invalid format type - in %sunpack.php on line %d diff --git a/ext/standard/tests/strings/unpack_offset.phpt b/ext/standard/tests/strings/unpack_offset.phpt index 64cb089bc3..451dd36724 100644 --- a/ext/standard/tests/strings/unpack_offset.phpt +++ b/ext/standard/tests/strings/unpack_offset.phpt @@ -8,8 +8,8 @@ $a = unpack("l2", $data, 3); printf("0x%08x 0x%08x\n", $a[1], $a[2]); printf("0x%08x 0x%08x\n", - unpack("l", $data, 3)[1], - unpack("@4/l", $data, 3)[1]); + unpack("l", $data, 3)[1], + unpack("@4/l", $data, 3)[1]); ?> --EXPECT-- 0x01020304 0x05060708 diff --git a/ext/standard/tests/strings/url_t.phpt b/ext/standard/tests/strings/url_t.phpt index 1ff7baff90..caa93cb9cf 100644 --- a/ext/standard/tests/strings/url_t.phpt +++ b/ext/standard/tests/strings/url_t.phpt @@ -81,7 +81,7 @@ $sample_urls = array ( $url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123'; foreach (array(PHP_URL_SCHEME,PHP_URL_HOST,PHP_URL_PORT,PHP_URL_USER,PHP_URL_PASS,PHP_URL_PATH,PHP_URL_QUERY,PHP_URL_FRAGMENT) as $v) { - var_dump(parse_url($url, $v)); + var_dump(parse_url($url, $v)); } ?> --EXPECT-- diff --git a/ext/standard/tests/strings/vfprintf_basic.phpt b/ext/standard/tests/strings/vfprintf_basic.phpt index 16a0014425..3219371594 100644 --- a/ext/standard/tests/strings/vfprintf_basic.phpt +++ b/ext/standard/tests/strings/vfprintf_basic.phpt @@ -14,12 +14,12 @@ precision=14 function writeAndDump($fp, $format, $args) { - ftruncate( $fp, 0 ); - $length = vfprintf( $fp, $format, $args ); - rewind( $fp ); - $content = stream_get_contents( $fp ); - var_dump( $content ); - var_dump( $length ); + ftruncate( $fp, 0 ); + $length = vfprintf( $fp, $format, $args ); + rewind( $fp ); + $content = stream_get_contents( $fp ); + var_dump( $content ); + var_dump( $length ); } echo "*** Testing vfprintf() : basic functionality ***\n"; diff --git a/ext/standard/tests/strings/vfprintf_variation1.phpt b/ext/standard/tests/strings/vfprintf_variation1.phpt index 744d9e2fd8..d7120e41c0 100644 --- a/ext/standard/tests/strings/vfprintf_variation1.phpt +++ b/ext/standard/tests/strings/vfprintf_variation1.phpt @@ -23,21 +23,21 @@ unset( $funset ); class FooClass { - public function __toString() - { - return "Object"; - } + public function __toString() + { + return "Object"; + } } // Output facilitating function function writeAndDump($fp, $format, $args) { - ftruncate( $fp, 0 ); - $length = vfprintf( $fp, $format, $args ); - rewind( $fp ); - $content = stream_get_contents( $fp ); - var_dump( $content ); - var_dump( $length ); + ftruncate( $fp, 0 ); + $length = vfprintf( $fp, $format, $args ); + rewind( $fp ); + $content = stream_get_contents( $fp ); + var_dump( $content ); + var_dump( $length ); } // Test vfprintf() diff --git a/ext/standard/tests/strings/vfprintf_variation20.phpt b/ext/standard/tests/strings/vfprintf_variation20.phpt index 17426c7af7..95477f6c25 100644 --- a/ext/standard/tests/strings/vfprintf_variation20.phpt +++ b/ext/standard/tests/strings/vfprintf_variation20.phpt @@ -36,50 +36,50 @@ $file_handle = fopen(__FILE__, 'r'); //array of values to iterate over $values = array( - // int data + // int data /*1*/ 0, - 1, - 12345, - -2345, + 1, + 12345, + -2345, - // float data + // float data /*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, - // array data + // array data /*10*/ array(), - array(0), - array(1), - array(1,2), - array('color' => 'red', 'item' => 'pen'), + array(0), + array(1), + array(1,2), + array('color' => 'red', 'item' => 'pen'), - // null data + // null data /*15*/ NULL, - null, + null, - // boolean data + // boolean data /*17*/ true, - false, - TRUE, - FALSE, + false, + TRUE, + FALSE, - // empty data + // empty data /*21*/ "", - '', + '', - // object data + // object data /*23*/ new sample(), - // undefined data + // undefined data /*24*/ @$undefined_var, - // unset data + // unset data /*25*/ @$unset_var, - // resource data + // resource data /*26*/ $file_handle ); diff --git a/ext/standard/tests/strings/vfprintf_variation21.phpt b/ext/standard/tests/strings/vfprintf_variation21.phpt index 9b9c3c12ae..f44cc36a2c 100644 --- a/ext/standard/tests/strings/vfprintf_variation21.phpt +++ b/ext/standard/tests/strings/vfprintf_variation21.phpt @@ -36,47 +36,47 @@ $file_handle = fopen(__FILE__, 'r'); //array of values to iterate over $values = array( - // int data + // int data /*1*/ 0, - 1, - 12345, - -2345, + 1, + 12345, + -2345, - // float data + // float data /*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, - // null data + // null data /*10*/ NULL, - null, + null, - // boolean data + // boolean data /*12*/ true, - false, - TRUE, - FALSE, + false, + TRUE, + FALSE, - // empty data + // empty data /*16*/ "", - '', + '', - // string data + // string data /*18*/ "string", - 'string', + 'string', - // object data + // object data /*20*/ new sample(), - // undefined data + // undefined data /*21*/ @$undefined_var, - // unset data + // unset data /*22*/ @$unset_var, - // resource data + // resource data /*23*/ $file_handle ); @@ -91,9 +91,9 @@ $counter = 1; foreach( $values as $value ) { fprintf($fp, "\n-- Iteration %d --\n",$counter); try { - vfprintf($fp, $format, $value); + vfprintf($fp, $format, $value); } catch (\ValueError $e) { - fwrite($fp, $e->getMessage() . "\n"); + fwrite($fp, $e->getMessage() . "\n"); } $counter++; } diff --git a/ext/standard/tests/strings/vprintf_variation1.phpt b/ext/standard/tests/strings/vprintf_variation1.phpt index 0fb8ed8a03..fd479274ef 100644 --- a/ext/standard/tests/strings/vprintf_variation1.phpt +++ b/ext/standard/tests/strings/vprintf_variation1.phpt @@ -36,50 +36,50 @@ $file_handle = fopen(__FILE__, 'r'); //array of values to iterate over $values = array( - // int data + // int data /*1*/ 0, - 1, - 12345, - -2345, + 1, + 12345, + -2345, - // float data + // float data /*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, - // array data + // array data /*10*/ array(), - array(0), - array(1), - array(1,2), - array('color' => 'red', 'item' => 'pen'), + array(0), + array(1), + array(1,2), + array('color' => 'red', 'item' => 'pen'), - // null data + // null data /*15*/ NULL, - null, + null, - // boolean data + // boolean data /*17*/ true, - false, - TRUE, - FALSE, + false, + TRUE, + FALSE, - // empty data + // empty data /*21*/ "", - '', + '', - // object data + // object data /*23*/ new sample(), - // undefined data + // undefined data /*24*/ @$undefined_var, - // unset data + // unset data /*25*/ @$unset_var, - // resource data + // resource data /*26*/ $file_handle ); diff --git a/ext/standard/tests/strings/vprintf_variation2.phpt b/ext/standard/tests/strings/vprintf_variation2.phpt index 4b59a5046d..12ffb6dd1f 100644 --- a/ext/standard/tests/strings/vprintf_variation2.phpt +++ b/ext/standard/tests/strings/vprintf_variation2.phpt @@ -36,47 +36,47 @@ $file_handle = fopen(__FILE__, 'r'); //array of values to iterate over $values = array( - // int data + // int data /*1*/ 0, - 1, - 12345, - -2345, + 1, + 12345, + -2345, - // float data + // float data /*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, - // null data + // null data /*10*/ NULL, - null, + null, - // boolean data + // boolean data /*12*/ true, - false, - TRUE, - FALSE, + false, + TRUE, + FALSE, - // empty data + // empty data /*16*/ "", - '', + '', - // string data + // string data /*18*/ "string", - 'string', + 'string', - // object data + // object data /*20*/ new sample(), - // undefined data + // undefined data /*21*/ @$undefined_var, - // unset data + // unset data /*22*/ @$unset_var, - // resource data + // resource data /*23*/ $file_handle ); @@ -85,11 +85,11 @@ $counter = 1; foreach($values as $value) { echo "\n-- Iteration $counter --\n"; try { - $result = vprintf($format,$value); - echo "\n"; - var_dump($result); + $result = vprintf($format,$value); + echo "\n"; + var_dump($result); } catch (\ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } $counter++; }; diff --git a/ext/standard/tests/time/001.phpt b/ext/standard/tests/time/001.phpt index b8498850f1..34b87157f2 100644 --- a/ext/standard/tests/time/001.phpt +++ b/ext/standard/tests/time/001.phpt @@ -15,14 +15,14 @@ $result = ''; set_time_limit(0); for ($i=1;$i<=100000;$i++) { - list($micro,$time)=explode(" ",microtime()); - if ($time > $last_t || ($time == $last_t && $micro >= $last_m)) { - $passed++; - } else if ($failed++ <=10) { - $result .= sprintf('%06d', $i).": $time $micro < $last_t $last_m\n"; - } - $last_m = $micro; - $last_t = $time; + list($micro,$time)=explode(" ",microtime()); + if ($time > $last_t || ($time == $last_t && $micro >= $last_m)) { + $passed++; + } else if ($failed++ <=10) { + $result .= sprintf('%06d', $i).": $time $micro < $last_t $last_m\n"; + } + $last_m = $micro; + $last_t = $time; } echo "Passed: $passed\n"; echo "Failed: $failed\n"; diff --git a/ext/standard/tests/time/bug38524.phpt b/ext/standard/tests/time/bug38524.phpt index 3def28e082..22ff9e4d76 100644 --- a/ext/standard/tests/time/bug38524.phpt +++ b/ext/standard/tests/time/bug38524.phpt @@ -4,7 +4,7 @@ Bug #38524 (strptime() does not initialize the internal date storage structure) <?php if (!function_exists('strptime')) echo "SKIP"; ?> --FILE-- <?php - var_dump(strptime('2006-08-20', '%Y-%m-%d')); + var_dump(strptime('2006-08-20', '%Y-%m-%d')); ?> --EXPECTF-- array(9) { diff --git a/ext/standard/tests/time/bug60222.phpt b/ext/standard/tests/time/bug60222.phpt index 7ea65ce54c..c74d27d53b 100644 --- a/ext/standard/tests/time/bug60222.phpt +++ b/ext/standard/tests/time/bug60222.phpt @@ -3,7 +3,7 @@ Bug #60222 (time_nanosleep() does validate input params) --FILE-- <?php try { - time_nanosleep(-1, 0); + time_nanosleep(-1, 0); } catch (ValueError $exception) { echo $exception->getMessage() . "\n"; } diff --git a/ext/standard/tests/time/idate.phpt b/ext/standard/tests/time/idate.phpt index 0b54405499..1a06070b45 100644 --- a/ext/standard/tests/time/idate.phpt +++ b/ext/standard/tests/time/idate.phpt @@ -5,7 +5,7 @@ idate() function date_default_timezone_set('GMT0'); $tmp = "UYzymndjHGhgistwLBIW"; for($a = 0;$a < strlen($tmp); $a++){ - echo $tmp[$a], ': ', idate($tmp[$a], 1043324459)."\n"; + echo $tmp[$a], ': ', idate($tmp[$a], 1043324459)."\n"; } ?> --EXPECT-- diff --git a/ext/standard/tests/url/base64_decode_basic_002.phpt b/ext/standard/tests/url/base64_decode_basic_002.phpt index c538d15997..647fbd3b5c 100644 --- a/ext/standard/tests/url/base64_decode_basic_002.phpt +++ b/ext/standard/tests/url/base64_decode_basic_002.phpt @@ -16,7 +16,7 @@ var_dump(base64_decode($noWhiteSpace, true)); echo "\nWhitespace does not affect base64_decode, even with \$strict===true:\n"; $withWhiteSpace = "a GVs bG8gd2 - 9ybGQh"; + 9ybGQh"; var_dump(base64_decode($withWhiteSpace)); var_dump(base64_decode($withWhiteSpace, false)); var_dump(base64_decode($withWhiteSpace, true)); diff --git a/ext/standard/tests/url/base64_decode_basic_003.phpt b/ext/standard/tests/url/base64_decode_basic_003.phpt index 3bcd51e192..13c0f449d8 100644 --- a/ext/standard/tests/url/base64_decode_basic_003.phpt +++ b/ext/standard/tests/url/base64_decode_basic_003.phpt @@ -12,29 +12,29 @@ Test base64_decode() function : basic functionality - padding and whitespace echo "Test base64_decode (output as JSON):\n"; $data = [ - "", "=", "==", "===", "====", - "V", "V=", "V==", "V===", "V====", - "VV", "VV=", "VV==", "VV===", "VV====", - "VVV", "VVV=", "VVV==", "VVV===", "VVV====", - "VVVV", "VVVV=", "VVVV==", "VVVV===", "VVVV====", - "=V", "=VV", "=VVV", - "==V", "==VV", "==VVV", - "===V", "===VV", "===VVV", - "====V", "====VV", "====VVV", - "=VVV", "V=VV", "VV=V", "VVV=", - "=VVVV", "V=VVV", "VV=VV", "VVV=V", "VVVV=", - "=VVV=", "V=VV=", "VV=V=", "VVV==", - "\nVV", "V\nV", "VV\n", - "\nVV==", "V\nV==", "VV\n==", "VV=\n=", "VV==\n", - "*VV", "V*V", "VV*", - "*VV==", "V*V==", "VV*==", "VV=*=", "VV==*", - "\0VV==", "V\0V==", "VV\0==", "VV=\0=", "VV==\0", - "\0VVV==", "V\0VV==", "VV\0V==", "VVV\0==", "VVV=\0=", "VVV==\0", + "", "=", "==", "===", "====", + "V", "V=", "V==", "V===", "V====", + "VV", "VV=", "VV==", "VV===", "VV====", + "VVV", "VVV=", "VVV==", "VVV===", "VVV====", + "VVVV", "VVVV=", "VVVV==", "VVVV===", "VVVV====", + "=V", "=VV", "=VVV", + "==V", "==VV", "==VVV", + "===V", "===VV", "===VVV", + "====V", "====VV", "====VVV", + "=VVV", "V=VV", "VV=V", "VVV=", + "=VVVV", "V=VVV", "VV=VV", "VVV=V", "VVVV=", + "=VVV=", "V=VV=", "VV=V=", "VVV==", + "\nVV", "V\nV", "VV\n", + "\nVV==", "V\nV==", "VV\n==", "VV=\n=", "VV==\n", + "*VV", "V*V", "VV*", + "*VV==", "V*V==", "VV*==", "VV=*=", "VV==*", + "\0VV==", "V\0V==", "VV\0==", "VV=\0=", "VV==\0", + "\0VVV==", "V\0VV==", "VV\0V==", "VVV\0==", "VVV=\0=", "VVV==\0", ]; foreach ($data as $a) { - $b = base64_decode($a, false); - $c = base64_decode($a, true); - printf("base64 %-16s non-strict %-8s strict %s\n", json_encode($a), json_encode($b), json_encode($c)); + $b = base64_decode($a, false); + $c = base64_decode($a, true); + printf("base64 %-16s non-strict %-8s strict %s\n", json_encode($a), json_encode($b), json_encode($c)); } echo "Done\n"; ?> diff --git a/ext/standard/tests/url/base64_encode_basic_001.phpt b/ext/standard/tests/url/base64_encode_basic_001.phpt index 764e15f377..ff8c20e1b5 100644 --- a/ext/standard/tests/url/base64_encode_basic_001.phpt +++ b/ext/standard/tests/url/base64_encode_basic_001.phpt @@ -15,9 +15,9 @@ Test base64_encode() function : basic functionality echo "*** Testing base64_encode() : basic functionality ***\n"; for ($i=0; $i<256; $i++) { - $str = pack("c", $i); - $enc = base64_encode($str); - printf("0x%X: %s\n", $i, $enc); + $str = pack("c", $i); + $enc = base64_encode($str); + printf("0x%X: %s\n", $i, $enc); } echo "Done"; diff --git a/ext/standard/tests/url/base64_encode_basic_002.phpt b/ext/standard/tests/url/base64_encode_basic_002.phpt index 15bd9380b1..94af3c93bd 100644 --- a/ext/standard/tests/url/base64_encode_basic_002.phpt +++ b/ext/standard/tests/url/base64_encode_basic_002.phpt @@ -15,29 +15,29 @@ Test base64_encode() function : basic functionality - check algorithm round trip echo "*** Testing base64_encode() : basic functionality ***\n"; $values = array( - "Hello World", - "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!%^&*(){}[]", - "\n\t Line with control characters\r\n", - "\xC1\xC2\xC3\xC4\xC5\xC6", - "\75\76\77\78\79\80" + "Hello World", + "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!%^&*(){}[]", + "\n\t Line with control characters\r\n", + "\xC1\xC2\xC3\xC4\xC5\xC6", + "\75\76\77\78\79\80" ); echo "\n--- Testing base64_encode() with binary string input ---\n"; $counter = 1; foreach($values as $str) { - echo "-- Iteration $counter --\n"; + echo "-- Iteration $counter --\n"; - $enc = base64_encode($str); - $dec = base64_decode($enc); + $enc = base64_encode($str); + $dec = base64_decode($enc); - if ($dec != $str) { - echo "TEST FAILED\n"; - } else { - echo "TEST PASSED\n"; - } + if ($dec != $str) { + echo "TEST FAILED\n"; + } else { + echo "TEST PASSED\n"; + } - $counter ++; + $counter ++; } ?> diff --git a/ext/standard/tests/url/bug52327.phpt b/ext/standard/tests/url/bug52327.phpt index fb2e0fa25b..3450abcc4b 100644 --- a/ext/standard/tests/url/bug52327.phpt +++ b/ext/standard/tests/url/bug52327.phpt @@ -3,8 +3,8 @@ Bug #52327 (base64_decode() improper handling of leading padding) --FILE-- <?php var_dump( - base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P'), - base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P', true) + base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P'), + base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P', true) ); ?> --EXPECT-- diff --git a/ext/standard/tests/url/bug55273.phpt b/ext/standard/tests/url/bug55273.phpt index 1408506b42..e5c8fca70c 100644 --- a/ext/standard/tests/url/bug55273.phpt +++ b/ext/standard/tests/url/bug55273.phpt @@ -3,9 +3,9 @@ Bug #55273 (base64_decode() with strict rejects whitespace after pad) --FILE-- <?php function test($s) { - $v = chunk_split(base64_encode($s)); - $r = base64_decode($v, True); - var_dump($v, $r); + $v = chunk_split(base64_encode($s)); + $r = base64_decode($v, True); + var_dump($v, $r); } test('PHP'); diff --git a/ext/standard/tests/url/parse_url_basic_001.phpt b/ext/standard/tests/url/parse_url_basic_001.phpt index 3977a3fc2e..89a63010b9 100644 --- a/ext/standard/tests/url/parse_url_basic_001.phpt +++ b/ext/standard/tests/url/parse_url_basic_001.phpt @@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying the component include_once(__DIR__ . '/urls.inc'); foreach ($urls as $url) { - echo "\n--> $url: "; - var_dump(parse_url($url)); + echo "\n--> $url: "; + var_dump(parse_url($url)); } echo "Done"; diff --git a/ext/standard/tests/url/parse_url_basic_002.phpt b/ext/standard/tests/url/parse_url_basic_002.phpt index c8b94dec1c..9616278fc6 100644 --- a/ext/standard/tests/url/parse_url_basic_002.phpt +++ b/ext/standard/tests/url/parse_url_basic_002.phpt @@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_SCHEM include_once(__DIR__ . '/urls.inc'); foreach ($urls as $url) { - echo "--> $url : "; - var_dump(parse_url($url, PHP_URL_SCHEME)); + echo "--> $url : "; + var_dump(parse_url($url, PHP_URL_SCHEME)); } diff --git a/ext/standard/tests/url/parse_url_basic_003.phpt b/ext/standard/tests/url/parse_url_basic_003.phpt index f917b77b97..668ee5aab2 100644 --- a/ext/standard/tests/url/parse_url_basic_003.phpt +++ b/ext/standard/tests/url/parse_url_basic_003.phpt @@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_HOST include_once(__DIR__ . '/urls.inc'); foreach ($urls as $url) { - echo "--> $url : "; - var_dump(parse_url($url, PHP_URL_HOST)); + echo "--> $url : "; + var_dump(parse_url($url, PHP_URL_HOST)); } echo "Done"; diff --git a/ext/standard/tests/url/parse_url_basic_004.phpt b/ext/standard/tests/url/parse_url_basic_004.phpt index 29d4655243..464ed20d42 100644 --- a/ext/standard/tests/url/parse_url_basic_004.phpt +++ b/ext/standard/tests/url/parse_url_basic_004.phpt @@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PORT include_once(__DIR__ . '/urls.inc'); foreach ($urls as $url) { - echo "--> $url : "; - var_dump(parse_url($url, PHP_URL_PORT)); + echo "--> $url : "; + var_dump(parse_url($url, PHP_URL_PORT)); } echo "Done"; diff --git a/ext/standard/tests/url/parse_url_basic_005.phpt b/ext/standard/tests/url/parse_url_basic_005.phpt index 716d8d1dfa..f776181987 100644 --- a/ext/standard/tests/url/parse_url_basic_005.phpt +++ b/ext/standard/tests/url/parse_url_basic_005.phpt @@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_USER include_once(__DIR__ . '/urls.inc'); foreach ($urls as $url) { - echo "--> $url : "; - var_dump(parse_url($url, PHP_URL_USER)); + echo "--> $url : "; + var_dump(parse_url($url, PHP_URL_USER)); } echo "Done"; diff --git a/ext/standard/tests/url/parse_url_basic_006.phpt b/ext/standard/tests/url/parse_url_basic_006.phpt index 3ae94ca626..fc6378106b 100644 --- a/ext/standard/tests/url/parse_url_basic_006.phpt +++ b/ext/standard/tests/url/parse_url_basic_006.phpt @@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PASS include_once(__DIR__ . '/urls.inc'); foreach ($urls as $url) { - echo "--> $url : "; - var_dump(parse_url($url, PHP_URL_PASS)); + echo "--> $url : "; + var_dump(parse_url($url, PHP_URL_PASS)); } echo "Done"; diff --git a/ext/standard/tests/url/parse_url_basic_007.phpt b/ext/standard/tests/url/parse_url_basic_007.phpt index 8cad27e958..ebcd968879 100644 --- a/ext/standard/tests/url/parse_url_basic_007.phpt +++ b/ext/standard/tests/url/parse_url_basic_007.phpt @@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PATH include_once(__DIR__ . '/urls.inc'); foreach ($urls as $url) { - echo "--> $url : "; - var_dump(parse_url($url, PHP_URL_PATH)); + echo "--> $url : "; + var_dump(parse_url($url, PHP_URL_PATH)); } echo "Done"; diff --git a/ext/standard/tests/url/parse_url_basic_008.phpt b/ext/standard/tests/url/parse_url_basic_008.phpt index 142da3d561..033a4489d0 100644 --- a/ext/standard/tests/url/parse_url_basic_008.phpt +++ b/ext/standard/tests/url/parse_url_basic_008.phpt @@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_QUERY include_once(__DIR__ . '/urls.inc'); foreach ($urls as $url) { - echo "--> $url : "; - var_dump(parse_url($url, PHP_URL_QUERY)); + echo "--> $url : "; + var_dump(parse_url($url, PHP_URL_QUERY)); } echo "Done"; diff --git a/ext/standard/tests/url/parse_url_basic_009.phpt b/ext/standard/tests/url/parse_url_basic_009.phpt index 3634046de2..539d05bbd7 100644 --- a/ext/standard/tests/url/parse_url_basic_009.phpt +++ b/ext/standard/tests/url/parse_url_basic_009.phpt @@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_FRAGM include_once(__DIR__ . '/urls.inc'); foreach ($urls as $url) { - echo "--> $url : "; - var_dump(parse_url($url, PHP_URL_FRAGMENT)); + echo "--> $url : "; + var_dump(parse_url($url, PHP_URL_FRAGMENT)); } echo "Done"; diff --git a/ext/standard/tests/url/parse_url_basic_010.phpt b/ext/standard/tests/url/parse_url_basic_010.phpt index 8fecb9d8eb..bf1835fbf8 100644 --- a/ext/standard/tests/url/parse_url_basic_010.phpt +++ b/ext/standard/tests/url/parse_url_basic_010.phpt @@ -12,9 +12,9 @@ Test parse_url() function : check values of URL related constants * check values of URL related constants */ foreach(get_defined_constants() as $constantName => $constantValue) { - if (strpos($constantName, 'PHP_URL')===0) { - echo "$constantName: $constantValue \n"; - } + if (strpos($constantName, 'PHP_URL')===0) { + echo "$constantName: $constantValue \n"; + } } echo "Done"; diff --git a/ext/standard/tests/url/parse_url_unterminated.phpt b/ext/standard/tests/url/parse_url_unterminated.phpt index 7a0cba8ada..f7d5cca896 100644 --- a/ext/standard/tests/url/parse_url_unterminated.phpt +++ b/ext/standard/tests/url/parse_url_unterminated.phpt @@ -14,9 +14,9 @@ if (!function_exists('zend_create_unterminated_string')) die('skip ext/test requ include_once(__DIR__ . '/urls.inc'); foreach ($urls as $url) { - echo "\n--> $url: "; - $str = zend_create_unterminated_string($url); - var_dump(parse_url($str)); + echo "\n--> $url: "; + $str = zend_create_unterminated_string($url); + var_dump(parse_url($str)); zend_terminate_string($str); } diff --git a/ext/standard/tests/versioning/version_compare.phpt b/ext/standard/tests/versioning/version_compare.phpt index 17574e9737..07550dd410 100644 --- a/ext/standard/tests/versioning/version_compare.phpt +++ b/ext/standard/tests/versioning/version_compare.phpt @@ -19,7 +19,7 @@ test("1.0", "1.1"); test("1.2", "1.0.1"); foreach ($special_forms as $f1) { foreach ($special_forms as $f2) { - test("1.0$f1", "1.0$f2"); + test("1.0$f1", "1.0$f2"); } } print "TESTING OPERATORS\n"; @@ -37,16 +37,16 @@ foreach ($special_forms as $f1) { function test($v1, $v2) { $compare = version_compare($v1, $v2); switch ($compare) { - case -1: - print "$v1 < $v2\n"; - break; - case 1: - print "$v1 > $v2\n"; - break; - case 0: - default: - print "$v1 = $v2\n"; - break; + case -1: + print "$v1 < $v2\n"; + break; + case 1: + print "$v1 > $v2\n"; + break; + case 0: + default: + print "$v1 = $v2\n"; + break; } } diff --git a/ext/sysvmsg/tests/001.phpt b/ext/sysvmsg/tests/001.phpt index 1e53f38f20..3dc95f00b3 100644 --- a/ext/sysvmsg/tests/001.phpt +++ b/ext/sysvmsg/tests/001.phpt @@ -10,11 +10,11 @@ $q = msg_get_queue($key); msg_send($q, 1, "hello") or print "FAIL\n"; $type = null; if (msg_receive($q, 0, $type, 1024, $message)) { - echo "TYPE: $type\n"; - echo "DATA: $message\n"; + echo "TYPE: $type\n"; + echo "DATA: $message\n"; } if (!msg_remove_queue($q)) { - echo "BAD: queue removal failed\n"; + echo "BAD: queue removal failed\n"; } ?> --EXPECT-- diff --git a/ext/sysvmsg/tests/002.phpt b/ext/sysvmsg/tests/002.phpt index 82233a4755..ae85b4431a 100644 --- a/ext/sysvmsg/tests/002.phpt +++ b/ext/sysvmsg/tests/002.phpt @@ -7,12 +7,12 @@ msg_receive() should return false when unserialize() failed $queue = msg_get_queue (ftok(__FILE__, 'r'), 0600); if (!msg_send ($queue, 1, 'Hi', false /* ! no_ser*/, true/*block*/, $msg_err)) { - die("error\n"); + die("error\n"); } var_dump($res = msg_receive ($queue, 1, $msg_type, 16384, $msg, true, 0, $msg_error)); if (!msg_remove_queue($queue)) { - echo "BAD: queue removal failed\n"; + echo "BAD: queue removal failed\n"; } echo "Done\n"; diff --git a/ext/sysvmsg/tests/005.phpt b/ext/sysvmsg/tests/005.phpt index 506e383ba0..68323e9a30 100644 --- a/ext/sysvmsg/tests/005.phpt +++ b/ext/sysvmsg/tests/005.phpt @@ -10,12 +10,12 @@ $tests = array(null, 'foo'); foreach ($tests as $q) { if ($q === null) { - do { - $id = ftok(__FILE__, chr(mt_rand(0, 255))); } while (msg_queue_exists($id)); + do { + $id = ftok(__FILE__, chr(mt_rand(0, 255))); } while (msg_queue_exists($id)); } - $q = msg_get_queue($id) or die("Failed to create queue"); - msg_remove_queue($q) or die("Failed to close queue"); + $q = msg_get_queue($id) or die("Failed to create queue"); + msg_remove_queue($q) or die("Failed to close queue"); echo "Using '$q' as queue resource:\n"; diff --git a/ext/sysvmsg/tests/006.phpt b/ext/sysvmsg/tests/006.phpt index 6982572640..fffb684221 100644 --- a/ext/sysvmsg/tests/006.phpt +++ b/ext/sysvmsg/tests/006.phpt @@ -21,7 +21,7 @@ foreach ($tests as $elem) { } if (!msg_remove_queue($queue)) { - echo "BAD: queue removal failed\n"; + echo "BAD: queue removal failed\n"; } echo "Done\n"; diff --git a/ext/sysvsem/tests/nowait.phpt b/ext/sysvsem/tests/nowait.phpt index 13f965ee21..147b8da335 100644 --- a/ext/sysvsem/tests/nowait.phpt +++ b/ext/sysvsem/tests/nowait.phpt @@ -18,8 +18,8 @@ pcntl_signal(SIGCHLD, SIG_IGN); // Get semaphore for parent $p_sem_id = sem_get($P_SEMKEY, 1); if ($p_sem_id === FALSE) { - echo "P: failed to parent get semaphore\n"; - exit; + echo "P: failed to parent get semaphore\n"; + exit; } echo "P: got semaphore $p_sem_id.\n"; @@ -27,24 +27,24 @@ echo "P: got semaphore $p_sem_id.\n"; // Get semaphore for child $c_sem_id = sem_get($C_SEMKEY, 1); if ($c_sem_id === FALSE) { - echo "P: failed to child get semaphore\n"; - exit; + echo "P: failed to child get semaphore\n"; + exit; } // Acquire semaphore for parent if (!sem_acquire($p_sem_id)) { - echo "P: fail to acquire semaphore $p_sem_id.\n"; - sem_remove($p_sem_id); - exit; + echo "P: fail to acquire semaphore $p_sem_id.\n"; + sem_remove($p_sem_id); + exit; } echo "P: acquired semaphore $p_sem_id.\n"; // Acquire semaphore for child if (!sem_acquire($c_sem_id)) { - echo "P: fail to acquire semaphore $c_sem_id.\n"; - sem_remove($c_sem_id); - exit; + echo "P: fail to acquire semaphore $c_sem_id.\n"; + sem_remove($c_sem_id); + exit; } echo "P: acquired semaphore $c_sem_id\n"; // Fork process @@ -52,69 +52,69 @@ $pid = pcntl_fork(); if ($pid) { - register_shutdown_function(function () use ($p_sem_id) { - echo "P: removing semaphore $p_sem_id.\n"; - sem_remove($p_sem_id); - }); + register_shutdown_function(function () use ($p_sem_id) { + echo "P: removing semaphore $p_sem_id.\n"; + sem_remove($p_sem_id); + }); - // Release semaphore after 50ms - usleep(50000); + // Release semaphore after 50ms + usleep(50000); - /* Wait for the child semaphore to be released to - to release the parent semaphore */ - if (!sem_acquire($c_sem_id)) { - echo "P: failed to acquire semaphore $c_sem_id.\n"; - exit; - } + /* Wait for the child semaphore to be released to + to release the parent semaphore */ + if (!sem_acquire($c_sem_id)) { + echo "P: failed to acquire semaphore $c_sem_id.\n"; + exit; + } - /* Release the child semahpore before releasing - the releasing the parent semaphore and letting - the child continue execution */ - sem_release($c_sem_id); + /* Release the child semahpore before releasing + the releasing the parent semaphore and letting + the child continue execution */ + sem_release($c_sem_id); - echo "P: releasing semaphore $p_sem_id.\n"; - if (!sem_release($p_sem_id)) { - echo "P: failed to release semaphore\n"; - } + echo "P: releasing semaphore $p_sem_id.\n"; + if (!sem_release($p_sem_id)) { + echo "P: failed to release semaphore\n"; + } - $status = null; - pcntl_waitpid($pid, $status); + $status = null; + pcntl_waitpid($pid, $status); } else { - register_shutdown_function(function () use ($c_sem_id) { - echo "C: removing semaphore $c_sem_id.\n"; - sem_remove($c_sem_id); - }); + register_shutdown_function(function () use ($c_sem_id) { + echo "C: removing semaphore $c_sem_id.\n"; + sem_remove($c_sem_id); + }); - echo "C: child process running.\n"; + echo "C: child process running.\n"; - // Have the semaphore after process forked - echo "C: got semaphore $p_sem_id and $c_sem_id.\n"; + // Have the semaphore after process forked + echo "C: got semaphore $p_sem_id and $c_sem_id.\n"; - // This should fail to get to the semaphore and not wait - if (sem_acquire($p_sem_id, true)) { - echo "C: test failed, Child was able to acquire semaphore $p_sem_id.\n"; - exit; - } + // This should fail to get to the semaphore and not wait + if (sem_acquire($p_sem_id, true)) { + echo "C: test failed, Child was able to acquire semaphore $p_sem_id.\n"; + exit; + } - // The child process did not wait to acquire the semaphore - echo "C: failed to acquire semaphore $p_sem_id.\n"; + // The child process did not wait to acquire the semaphore + echo "C: failed to acquire semaphore $p_sem_id.\n"; - echo "C: releasing semaphore $c_sem_id\n"; - if (!sem_release($c_sem_id)) { - echo "C: Failed to release semaphore\n"; - } + echo "C: releasing semaphore $c_sem_id\n"; + if (!sem_release($c_sem_id)) { + echo "C: Failed to release semaphore\n"; + } - // Acquire semaphore with waiting - if (!sem_acquire($p_sem_id)) { - echo "C: fail to acquire semaphore $p_sem_id.\n"; - exit; - } - echo "C: success acquired semaphore $p_sem_id.\n"; + // Acquire semaphore with waiting + if (!sem_acquire($p_sem_id)) { + echo "C: fail to acquire semaphore $p_sem_id.\n"; + exit; + } + echo "C: success acquired semaphore $p_sem_id.\n"; - echo "C: releasing semaphore $p_sem_id.\n"; - sem_release($p_sem_id); + echo "C: releasing semaphore $p_sem_id.\n"; + sem_release($p_sem_id); } ?> diff --git a/ext/sysvsem/tests/sysv.phpt b/ext/sysvsem/tests/sysv.phpt index 3f485e2c08..08cb63f839 100644 --- a/ext/sysvsem/tests/sysv.phpt +++ b/ext/sysvsem/tests/sysv.phpt @@ -16,79 +16,79 @@ echo "Start.\n"; // Get semaphore $sem_id = sem_get($SEMKEY, 1); if ($sem_id === FALSE) { - echo "Fail to get semaphore"; - exit; + echo "Fail to get semaphore"; + exit; } echo "Got semaphore $sem_id.\n"; // Accuire semaphore if (! sem_acquire($sem_id)) { - echo "Fail to acquire semaphore $sem_id.\n"; - sem_remove($sem_id); - exit; + echo "Fail to acquire semaphore $sem_id.\n"; + sem_remove($sem_id); + exit; } echo "Success acquire semaphore $sem_id.\n"; $shm_id = shm_attach($SHMKEY, $MEMSIZE); if ($shm_id === FALSE) { - echo "Fail to attach shared memory.\n"; - sem_remove($sem_id); - exit; + echo "Fail to attach shared memory.\n"; + sem_remove($sem_id); + exit; } echo "Success to attach shared memory : $shm_id.\n"; // Write variable 1 if (!shm_put_var($shm_id, 1, "Variable 1")) { - echo "Fail to put var 1 on shared memory $shm_id.\n"; - sem_remove($sem_id); - shm_remove ($shm_id); - exit; + echo "Fail to put var 1 on shared memory $shm_id.\n"; + sem_remove($sem_id); + shm_remove ($shm_id); + exit; } echo "Write var1 to shared memory.\n"; // Write variable 2 if (!shm_put_var($shm_id, 2, "Variable 2")) { - echo "Fail to put var 2 on shared memory $shm_id.\n"; - sem_remove($sem_id); - shm_remove ($shm_id); - exit; + echo "Fail to put var 2 on shared memory $shm_id.\n"; + sem_remove($sem_id); + shm_remove ($shm_id); + exit; } echo "Write var2 to shared memory.\n"; // Read variable 1 $var1 = shm_get_var ($shm_id, 1); if ($var1 === FALSE) { - echo "Fail to retrieve Var 1 from Shared memory $shm_id, return value=$var1.\n"; + echo "Fail to retrieve Var 1 from Shared memory $shm_id, return value=$var1.\n"; } else { - echo "Read var1=$var1.\n"; + echo "Read var1=$var1.\n"; } // Read variable 1 $var2 = shm_get_var ($shm_id, 2); if ($var1 === FALSE) { - echo "Fail to retrieve Var 2 from Shared memory $shm_id, return value=$var2.\n"; + echo "Fail to retrieve Var 2 from Shared memory $shm_id, return value=$var2.\n"; } else { - echo "Read var2=$var2.\n"; + echo "Read var2=$var2.\n"; } // Release semaphore if (!sem_release($sem_id)) { - echo "Fail to release $sem_id semaphore.\n"; + echo "Fail to release $sem_id semaphore.\n"; } else { - echo "Semaphore $sem_id released.\n"; + echo "Semaphore $sem_id released.\n"; } // remove shared memory segmant from SysV if (shm_remove ($shm_id)) { - echo "Shared memory successfully removed from SysV.\n"; + echo "Shared memory successfully removed from SysV.\n"; } else { - echo "Fail to remove $shm_id shared memory from SysV.\n"; + echo "Fail to remove $shm_id shared memory from SysV.\n"; } // Remove semaphore if (sem_remove($sem_id)) { - echo "semaphore removed successfully from SysV.\n"; + echo "semaphore removed successfully from SysV.\n"; } else { - echo "Fail to remove $sem_id semaphore from SysV.\n"; + echo "Fail to remove $sem_id semaphore from SysV.\n"; } echo "End.\n"; /* NOTE: assigned semids differ depending on the kernel, since diff --git a/ext/tidy/tests/002.phpt b/ext/tidy/tests/002.phpt index c6092c7b94..d276cfabed 100644 --- a/ext/tidy/tests/002.phpt +++ b/ext/tidy/tests/002.phpt @@ -4,8 +4,8 @@ tidy_parse_string() <?php if (!extension_loaded("tidy")) print "skip"; ?> --FILE-- <?php - $a = tidy_parse_string("<HTML></HTML>"); - echo tidy_get_output($a); + $a = tidy_parse_string("<HTML></HTML>"); + echo tidy_get_output($a); ?> --EXPECT-- diff --git a/ext/tidy/tests/003.phpt b/ext/tidy/tests/003.phpt index df4cd18f5f..43bd6729d7 100644 --- a/ext/tidy/tests/003.phpt +++ b/ext/tidy/tests/003.phpt @@ -5,9 +5,9 @@ tidy_clean_repair() --FILE-- <?php - $a = tidy_parse_string("<HTML></HTML>"); - tidy_clean_repair($a); - echo tidy_get_output($a); + $a = tidy_parse_string("<HTML></HTML>"); + tidy_clean_repair($a); + echo tidy_get_output($a); ?> --EXPECTF-- diff --git a/ext/tidy/tests/005-mb.phpt b/ext/tidy/tests/005-mb.phpt index c7b8e20676..7fc43d9f27 100644 --- a/ext/tidy/tests/005-mb.phpt +++ b/ext/tidy/tests/005-mb.phpt @@ -4,8 +4,8 @@ tidy_parse_file() <?php if (!extension_loaded("tidy")) print "skip"; ?> --FILE-- <?php - $a = tidy_parse_file(__DIR__."/005ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.html"); - echo tidy_get_output($a); + $a = tidy_parse_file(__DIR__."/005ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.html"); + echo tidy_get_output($a); ?> --EXPECT-- diff --git a/ext/tidy/tests/005.phpt b/ext/tidy/tests/005.phpt index 49b0a2ad4d..88d906e896 100644 --- a/ext/tidy/tests/005.phpt +++ b/ext/tidy/tests/005.phpt @@ -4,8 +4,8 @@ tidy_parse_file() <?php if (!extension_loaded("tidy")) print "skip"; ?> --FILE-- <?php - $a = tidy_parse_file(__DIR__."/005.html"); - echo tidy_get_output($a); + $a = tidy_parse_file(__DIR__."/005.html"); + echo tidy_get_output($a); ?> --EXPECT-- diff --git a/ext/tidy/tests/006.phpt b/ext/tidy/tests/006.phpt index a36006f346..5ca856075d 100644 --- a/ext/tidy/tests/006.phpt +++ b/ext/tidy/tests/006.phpt @@ -4,8 +4,8 @@ Verbose tidy_get_error_buffer() <?php if (!extension_loaded("tidy")) print "skip"; ?> --FILE-- <?php - $a = tidy_parse_string("<HTML><asd asdf></HTML>"); - echo tidy_get_error_buffer($a); + $a = tidy_parse_string("<HTML><asd asdf></HTML>"); + echo tidy_get_error_buffer($a); ?> --EXPECT-- diff --git a/ext/tidy/tests/007.phpt b/ext/tidy/tests/007.phpt index bae8918625..127dcdf472 100644 --- a/ext/tidy/tests/007.phpt +++ b/ext/tidy/tests/007.phpt @@ -6,16 +6,16 @@ Verbose tidy_getopt() tidy.default_config= --FILE-- <?php - $a = new tidy(__DIR__."/007.html"); - echo "Current Value of 'tidy-mark': "; - var_dump($a->getopt("tidy-mark")); - echo "Current Value of 'error-file': "; - var_dump($a->getopt("error-file")); - echo "Current Value of 'tab-size': "; - var_dump($a->getopt("tab-size")); + $a = new tidy(__DIR__."/007.html"); + echo "Current Value of 'tidy-mark': "; + var_dump($a->getopt("tidy-mark")); + echo "Current Value of 'error-file': "; + var_dump($a->getopt("error-file")); + echo "Current Value of 'tab-size': "; + var_dump($a->getopt("tab-size")); - var_dump($a->getopt('bogus-opt')); - var_dump(tidy_getopt($a, 'non-ASCII string àáç')); + var_dump($a->getopt('bogus-opt')); + var_dump(tidy_getopt($a, 'non-ASCII string àáç')); ?> --EXPECTF-- Current Value of 'tidy-mark': bool(false) diff --git a/ext/tidy/tests/008.phpt b/ext/tidy/tests/008.phpt index 303a2f9d8a..f98f79954e 100644 --- a/ext/tidy/tests/008.phpt +++ b/ext/tidy/tests/008.phpt @@ -4,8 +4,8 @@ Accessing the error buffer via $obj->error_buf... <?php if (!extension_loaded("tidy")) print "skip"; ?> --FILE-- <?php - $a = tidy_parse_string("<HTML><asd asdf></HTML>"); - echo $a->errorBuffer; + $a = tidy_parse_string("<HTML><asd asdf></HTML>"); + echo $a->errorBuffer; ?> --EXPECT-- line 1 column 1 - Warning: missing <!DOCTYPE> declaration diff --git a/ext/tidy/tests/009.phpt b/ext/tidy/tests/009.phpt index c2bbfb9760..b3e04d805f 100644 --- a/ext/tidy/tests/009.phpt +++ b/ext/tidy/tests/009.phpt @@ -6,7 +6,7 @@ tidy_doc object overloading <?php $a = tidy_parse_string("<HTML></HTML>"); - echo $a; + echo $a; ?> --EXPECT-- diff --git a/ext/tidy/tests/011.phpt b/ext/tidy/tests/011.phpt index 56cb0aa893..f664f69ebf 100644 --- a/ext/tidy/tests/011.phpt +++ b/ext/tidy/tests/011.phpt @@ -4,7 +4,7 @@ Accessing attributes of a node <?php if (!extension_loaded("tidy")) print "skip"; ?> --FILE-- <?php - $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000></BODY></HTML>"); + $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000></BODY></HTML>"); $body = $a->body(); var_dump($body->attribute); foreach($body->attribute as $key=>$val) { diff --git a/ext/tidy/tests/012.phpt b/ext/tidy/tests/012.phpt index eae6eca44c..0cfa3ef8c6 100644 --- a/ext/tidy/tests/012.phpt +++ b/ext/tidy/tests/012.phpt @@ -25,7 +25,7 @@ Accessing children nodes } - $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000><B>Hi</B><I>Bye<U>Test</U></I></BODY></HTML>", array('newline' => 'LF')); + $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000><B>Hi</B><I>Bye<U>Test</U></I></BODY></HTML>", array('newline' => 'LF')); $html = $a->html(); dump_nodes($html); diff --git a/ext/tidy/tests/014.phpt b/ext/tidy/tests/014.phpt index fd0d55b1fb..70f85eae37 100644 --- a/ext/tidy/tests/014.phpt +++ b/ext/tidy/tests/014.phpt @@ -5,9 +5,9 @@ Passing configuration options through tidy_parse_string(). --FILE-- <?php $text = "<B>testing</I>"; - $tidy = tidy_parse_string($text, array('show-body-only'=>true)); - tidy_clean_repair($tidy); - echo tidy_get_output($tidy); + $tidy = tidy_parse_string($text, array('show-body-only'=>true)); + tidy_clean_repair($tidy); + echo tidy_get_output($tidy); ?> --EXPECT-- diff --git a/ext/tidy/tests/015.phpt b/ext/tidy/tests/015.phpt index c5bc1dc4d3..ca00b5cb4d 100644 --- a/ext/tidy/tests/015.phpt +++ b/ext/tidy/tests/015.phpt @@ -5,8 +5,8 @@ Passing configuration options through tidy_parse_file(). --FILE-- <?php $tidy = tidy_parse_file(__DIR__."/015.html", array('show-body-only'=>true)); - tidy_clean_repair($tidy); - echo tidy_get_output($tidy); + tidy_clean_repair($tidy); + echo tidy_get_output($tidy); ?> --EXPECT-- diff --git a/ext/tidy/tests/018.phpt b/ext/tidy/tests/018.phpt index d2f1d1e0f3..761257e720 100644 --- a/ext/tidy/tests/018.phpt +++ b/ext/tidy/tests/018.phpt @@ -5,10 +5,10 @@ binary safety --FILE-- <?php $x = tidy_repair_string("<p>abra\0cadabra</p>", - array( 'show-body-only' => true, - 'clean' => false, - 'newline' => "\n") - ); + array( 'show-body-only' => true, + 'clean' => false, + 'newline' => "\n") + ); var_dump($x); ?> --EXPECT-- diff --git a/ext/tidy/tests/029.phpt b/ext/tidy/tests/029.phpt index e46181f005..f28f52fba8 100644 --- a/ext/tidy/tests/029.phpt +++ b/ext/tidy/tests/029.phpt @@ -8,16 +8,16 @@ tidy_get_body() crash // bug report taken from http://news.php.net/php.notes/130628 $inputs = array( - '<frameset > </frameset>', - '<html><frameset> </frameset> </html', + '<frameset > </frameset>', + '<html><frameset> </frameset> </html', ); foreach ($inputs as $input) { - $t = tidy_parse_string($input); - $t->cleanRepair(); - var_dump(tidy_get_body($t)); + $t = tidy_parse_string($input); + $t->cleanRepair(); + var_dump(tidy_get_body($t)); } echo "Done\n"; diff --git a/ext/tokenizer/tests/002.phpt b/ext/tokenizer/tests/002.phpt index 11b6d9f78e..e711023eef 100644 --- a/ext/tokenizer/tests/002.phpt +++ b/ext/tokenizer/tests/002.phpt @@ -6,15 +6,15 @@ token_get_all() <?php $strings = array( - '<?php echo 1; if (isset($a)) print $a+1; $a++; $a--; $a == 2; $a === 2; endif; ?>', - '<?php switch($a) { case 1: break; default: break; } while($a) { exit; } ?>', - '<?php /* comment */ if (1 || 2) { } $a = 2 | 1; $b = 3^2; $c = 4&2; ?>', - /* feel free to add more yourself */ - 'wrong syntax here' + '<?php echo 1; if (isset($a)) print $a+1; $a++; $a--; $a == 2; $a === 2; endif; ?>', + '<?php switch($a) { case 1: break; default: break; } while($a) { exit; } ?>', + '<?php /* comment */ if (1 || 2) { } $a = 2 | 1; $b = 3^2; $c = 4&2; ?>', + /* feel free to add more yourself */ + 'wrong syntax here' ); foreach ($strings as $s) { - var_dump(token_get_all($s)); + var_dump(token_get_all($s)); } echo "Done\n"; diff --git a/ext/tokenizer/tests/bug54089.phpt b/ext/tokenizer/tests/bug54089.phpt index ff461ecb78..d3dc834616 100644 --- a/ext/tokenizer/tests/bug54089.phpt +++ b/ext/tokenizer/tests/bug54089.phpt @@ -5,23 +5,23 @@ Bug #54089 (token_get_all() does not stop after __halt_compiler) --FILE-- <?php $codes = array( - "<?php __halt_compiler", - "<?php __halt_compiler(", - "<?php __halt_compiler();", - "<?php __halt_compiler();ABC", - "<?php __halt_compiler\n(\n)\n;ABC", - "<?php __halt_compiler\nabc\ndef\nghi ABC", + "<?php __halt_compiler", + "<?php __halt_compiler(", + "<?php __halt_compiler();", + "<?php __halt_compiler();ABC", + "<?php __halt_compiler\n(\n)\n;ABC", + "<?php __halt_compiler\nabc\ndef\nghi ABC", ); foreach ($codes as $code) { - $tokens = token_get_all($code); - var_dump($tokens); + $tokens = token_get_all($code); + var_dump($tokens); - $code = ''; - foreach ($tokens as $t) - { - $code .= isset($t[1]) ? $t[1] : $t; - } - var_dump($code); + $code = ''; + foreach ($tokens as $t) + { + $code .= isset($t[1]) ? $t[1] : $t; + } + var_dump($code); } ?> diff --git a/ext/tokenizer/tests/token_get_all_variation19.phpt b/ext/tokenizer/tests/token_get_all_variation19.phpt index a853dd2e2f..3190b3fd16 100644 --- a/ext/tokenizer/tests/token_get_all_variation19.phpt +++ b/ext/tokenizer/tests/token_get_all_variation19.phpt @@ -35,17 +35,17 @@ $token_array = token_get_all($phpstr); $script = ""; // reconstruct a script (without open/close tags) from the token array foreach ($token_array as $token) { - if (is_array($token)) { - if (strncmp($token[1], '<?php', 5) == 0) { - continue; - } - if (strncmp($token[1], '?>', 2) == 0) { - continue; - } - $script .= $token[1]; - } else { - $script .= $token; - } + if (is_array($token)) { + if (strncmp($token[1], '<?php', 5) == 0) { + continue; + } + if (strncmp($token[1], '?>', 2) == 0) { + continue; + } + $script .= $token[1]; + } else { + $script .= $token; + } } var_dump($script); diff --git a/ext/xml/tests/bug25666.phpt b/ext/xml/tests/bug25666.phpt index e162d5a2bd..ca4b15f405 100644 --- a/ext/xml/tests/bug25666.phpt +++ b/ext/xml/tests/bug25666.phpt @@ -8,7 +8,7 @@ if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is n --FILE-- <?php function start_elem($parser,$name,$attribs) { - var_dump($name); + var_dump($name); } function end_elem() { @@ -17,7 +17,7 @@ function end_elem() $xml = <<<HERE <foo:a xmlns:foo="http://example.com/foo" xmlns:bar="http://example.com/bar" - xmlns:baz="http://example.com/baz"> + xmlns:baz="http://example.com/baz"> <bar:b /> <baz:c /> </foo> diff --git a/ext/xml/tests/bug26528.phpt b/ext/xml/tests/bug26528.phpt index 96da841004..152a18540d 100644 --- a/ext/xml/tests/bug26528.phpt +++ b/ext/xml/tests/bug26528.phpt @@ -6,11 +6,11 @@ require_once("skipif.inc"); ?> --FILE-- <?php - $sample = "<?xml version=\"1.0\"?><test attr=\"angle<bracket\"/>"; - $parser = xml_parser_create(); - $res = xml_parse_into_struct($parser,$sample,$vals,$index); - xml_parser_free($parser); - var_dump($vals); + $sample = "<?xml version=\"1.0\"?><test attr=\"angle<bracket\"/>"; + $parser = xml_parser_create(); + $res = xml_parse_into_struct($parser,$sample,$vals,$index); + xml_parser_free($parser); + var_dump($vals); ?> --EXPECT-- array(1) { diff --git a/ext/xml/tests/bug26614.phpt b/ext/xml/tests/bug26614.phpt index c95997a8a6..ed42bc1fbf 100644 --- a/ext/xml/tests/bug26614.phpt +++ b/ext/xml/tests/bug26614.phpt @@ -25,7 +25,7 @@ $xmls["CDATA"] ='<?xml version="1.0" encoding="iso-8859-1" ?> <data> <![CDATA[ multi -line +line CDATA block ]]> @@ -36,7 +36,7 @@ $xmls["Comment"] ='<?xml version="1.0" encoding="iso-8859-1" ?> <data> <!-- ATA[ multi -line +line CDATA block --> @@ -47,7 +47,7 @@ $xmls["Text"] ='<?xml version="1.0" encoding="iso-8859-1" ?> <data> -!-- ATA[ multi -line +line CDATA block --- @@ -55,16 +55,16 @@ block function startElement($parser, $name, $attrs) { printf("<$name> at line %d, col %d (byte %d)\n", - xml_get_current_line_number($parser), - xml_get_current_column_number($parser), - xml_get_current_byte_index($parser)); + xml_get_current_line_number($parser), + xml_get_current_column_number($parser), + xml_get_current_byte_index($parser)); } function endElement($parser, $name) { printf("</$name> at line %d, col %d (byte %d)\n", - xml_get_current_line_number($parser), - xml_get_current_column_number($parser), - xml_get_current_byte_index($parser)); + xml_get_current_line_number($parser), + xml_get_current_column_number($parser), + xml_get_current_byte_index($parser)); } function characterData($parser, $data) { @@ -73,12 +73,12 @@ function characterData($parser, $data) { foreach ($xmls as $desc => $xml) { echo "$desc\n"; - $xml_parser = xml_parser_create(); - xml_set_element_handler($xml_parser, "startElement", "endElement"); - xml_set_character_data_handler($xml_parser, "characterData"); - if (!xml_parse($xml_parser, $xml, true)) - echo "Error: ".xml_error_string(xml_get_error_code($xml_parser))."\n"; - xml_parser_free($xml_parser); + $xml_parser = xml_parser_create(); + xml_set_element_handler($xml_parser, "startElement", "endElement"); + xml_set_character_data_handler($xml_parser, "characterData"); + if (!xml_parse($xml_parser, $xml, true)) + echo "Error: ".xml_error_string(xml_get_error_code($xml_parser))."\n"; + xml_parser_free($xml_parser); } ?> --EXPECT-- diff --git a/ext/xml/tests/bug26614_libxml.phpt b/ext/xml/tests/bug26614_libxml.phpt index e479699a8f..b6c0b87581 100644 --- a/ext/xml/tests/bug26614_libxml.phpt +++ b/ext/xml/tests/bug26614_libxml.phpt @@ -55,16 +55,16 @@ block function startElement($parser, $name, $attrs) { printf("<$name> at line %d, col %d (byte %d)\n", - xml_get_current_line_number($parser), - xml_get_current_column_number($parser), - xml_get_current_byte_index($parser)); + xml_get_current_line_number($parser), + xml_get_current_column_number($parser), + xml_get_current_byte_index($parser)); } function endElement($parser, $name) { printf("</$name> at line %d, col %d (byte %d)\n", - xml_get_current_line_number($parser), - xml_get_current_column_number($parser), - xml_get_current_byte_index($parser)); + xml_get_current_line_number($parser), + xml_get_current_column_number($parser), + xml_get_current_byte_index($parser)); } function characterData($parser, $data) { @@ -73,12 +73,12 @@ function characterData($parser, $data) { foreach ($xmls as $desc => $xml) { echo "$desc\n"; - $xml_parser = xml_parser_create(); - xml_set_element_handler($xml_parser, "startElement", "endElement"); - xml_set_character_data_handler($xml_parser, "characterData"); - if (!xml_parse($xml_parser, $xml, true)) - echo "Error: ".xml_error_string(xml_get_error_code($xml_parser))."\n"; - xml_parser_free($xml_parser); + $xml_parser = xml_parser_create(); + xml_set_element_handler($xml_parser, "startElement", "endElement"); + xml_set_character_data_handler($xml_parser, "characterData"); + if (!xml_parse($xml_parser, $xml, true)) + echo "Error: ".xml_error_string(xml_get_error_code($xml_parser))."\n"; + xml_parser_free($xml_parser); } ?> --EXPECTF-- diff --git a/ext/xml/tests/bug30266.phpt b/ext/xml/tests/bug30266.phpt index 2cf0a68cde..a7fe7592fe 100644 --- a/ext/xml/tests/bug30266.phpt +++ b/ext/xml/tests/bug30266.phpt @@ -33,7 +33,7 @@ class XML_Parser function startHandler($XmlParser, $tag, $attr) { $this->dummy = "b"; - throw new Exception("ex"); + throw new Exception("ex"); } function endHandler($XmlParser, $tag) @@ -45,7 +45,7 @@ $p1 = new Xml_Parser(); try { $p1->parse('<tag1><tag2></tag2></tag1>'); } catch (Exception $e) { - echo "OK\n"; + echo "OK\n"; } ?> --EXPECT-- diff --git a/ext/xml/tests/bug32001.phpt b/ext/xml/tests/bug32001.phpt index 2e2f4643d5..5ced128940 100644 --- a/ext/xml/tests/bug32001.phpt +++ b/ext/xml/tests/bug32001.phpt @@ -10,146 +10,146 @@ if (ICONV_IMPL == 'glibc' && version_compare(ICONV_VERSION, '2.12', '<=')) --FILE-- <?php class testcase { - private $encoding; - private $bom; - private $prologue; - private $tags; - private $chunk_size; + private $encoding; + private $bom; + private $prologue; + private $tags; + private $chunk_size; - function __construct($enc, $chunk_size = 0, $bom = 0, $omit_prologue = 0) { - $this->encoding = $enc; - $this->chunk_size = $chunk_size; - $this->bom = $bom; - $this->prologue = !$omit_prologue; - $this->tags = array(); - } + function __construct($enc, $chunk_size = 0, $bom = 0, $omit_prologue = 0) { + $this->encoding = $enc; + $this->chunk_size = $chunk_size; + $this->bom = $bom; + $this->prologue = !$omit_prologue; + $this->tags = array(); + } - function start_element($parser, $name, $attrs) { - $attrs = array_map('bin2hex', $attrs); - $this->tags[] = bin2hex($name).": ".implode(', ', $attrs); - } + function start_element($parser, $name, $attrs) { + $attrs = array_map('bin2hex', $attrs); + $this->tags[] = bin2hex($name).": ".implode(', ', $attrs); + } - function end_element($parser, $name) { - } + function end_element($parser, $name) { + } - function run() { - $data = ''; + function run() { + $data = ''; - if ($this->prologue) { - $canonical_name = preg_replace('/BE|LE/i', '', $this->encoding); - $data .= "<?xml version=\"1.0\" encoding=\"$canonical_name\" ?>\n"; - } + if ($this->prologue) { + $canonical_name = preg_replace('/BE|LE/i', '', $this->encoding); + $data .= "<?xml version=\"1.0\" encoding=\"$canonical_name\" ?>\n"; + } - $data .= <<<HERE + $data .= <<<HERE <テスト:テスト1 xmlns:テスト="http://www.example.com/テスト/" テスト="テスト"> <テスト:テスト2 テスト="テスト"> - <テスト:テスト3> - test! - </テスト:テスト3> + <テスト:テスト3> + test! + </テスト:テスト3> </テスト:テスト2> </テスト:テスト1> HERE; - $data = iconv("UTF-8", $this->encoding, $data); + $data = iconv("UTF-8", $this->encoding, $data); - if ($this->bom) { - switch (strtoupper($this->encoding)) { - case 'UTF-8': - case 'UTF8': - $data = "\xef\xbb\xbf".$data; - break; + if ($this->bom) { + switch (strtoupper($this->encoding)) { + case 'UTF-8': + case 'UTF8': + $data = "\xef\xbb\xbf".$data; + break; - case 'UTF-16': - case 'UTF16': - case 'UTF-16BE': - case 'UTF16BE': - case 'UCS-2': - case 'UCS2': - case 'UCS-2BE': - case 'UCS2BE': - $data = "\xfe\xff".$data; - break; + case 'UTF-16': + case 'UTF16': + case 'UTF-16BE': + case 'UTF16BE': + case 'UCS-2': + case 'UCS2': + case 'UCS-2BE': + case 'UCS2BE': + $data = "\xfe\xff".$data; + break; - case 'UTF-16LE': - case 'UTF16LE': - case 'UCS-2LE': - case 'UCS2LE': - $data = "\xff\xfe".$data; - break; + case 'UTF-16LE': + case 'UTF16LE': + case 'UCS-2LE': + case 'UCS2LE': + $data = "\xff\xfe".$data; + break; - case 'UTF-32': - case 'UTF32': - case 'UTF-32BE': - case 'UTF32BE': - case 'UCS-4': - case 'UCS4': - case 'UCS-4BE': - case 'UCS4BE': - $data = "\x00\x00\xfe\xff".$data; - break; + case 'UTF-32': + case 'UTF32': + case 'UTF-32BE': + case 'UTF32BE': + case 'UCS-4': + case 'UCS4': + case 'UCS-4BE': + case 'UCS4BE': + $data = "\x00\x00\xfe\xff".$data; + break; - case 'UTF-32LE': - case 'UTF32LE': - case 'UCS-4LE': - case 'UCS4LE': - $data = "\xff\xfe\x00\x00".$data; - break; - } - } + case 'UTF-32LE': + case 'UTF32LE': + case 'UCS-4LE': + case 'UCS4LE': + $data = "\xff\xfe\x00\x00".$data; + break; + } + } - $parser = xml_parser_create(NULL); - xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); - xml_set_element_handler($parser, "start_element", "end_element"); - xml_set_object($parser, $this); + $parser = xml_parser_create(NULL); + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); + xml_set_element_handler($parser, "start_element", "end_element"); + xml_set_object($parser, $this); - if ($this->chunk_size == 0) { - $success = @xml_parse($parser, $data, true); - } else { - for ($offset = 0; $offset < strlen($data); - $offset += $this->chunk_size) { - $success = @xml_parse($parser, substr($data, $offset, $this->chunk_size), false); - if (!$success) { - break; - } - } - if ($success) { - $success = @xml_parse($parser, "", true); - } - } + if ($this->chunk_size == 0) { + $success = @xml_parse($parser, $data, true); + } else { + for ($offset = 0; $offset < strlen($data); + $offset += $this->chunk_size) { + $success = @xml_parse($parser, substr($data, $offset, $this->chunk_size), false); + if (!$success) { + break; + } + } + if ($success) { + $success = @xml_parse($parser, "", true); + } + } - echo "Encoding: $this->encoding\n"; - echo "XML Prologue: ".($this->prologue ? 'present': 'not present'), "\n"; - echo "Chunk size: ".($this->chunk_size ? "$this->chunk_size byte(s)\n": "all data at once\n"); - echo "BOM: ".($this->bom ? 'prepended': 'not prepended'), "\n"; + echo "Encoding: $this->encoding\n"; + echo "XML Prologue: ".($this->prologue ? 'present': 'not present'), "\n"; + echo "Chunk size: ".($this->chunk_size ? "$this->chunk_size byte(s)\n": "all data at once\n"); + echo "BOM: ".($this->bom ? 'prepended': 'not prepended'), "\n"; - if ($success) { - var_dump($this->tags); - } else { - echo "[Error] ", xml_error_string(xml_get_error_code($parser)), "\n"; - } - } + if ($success) { + var_dump($this->tags); + } else { + echo "[Error] ", xml_error_string(xml_get_error_code($parser)), "\n"; + } + } } $suite = array( - new testcase("UTF-8", 0, 0, 0), - new testcase("UTF-8", 0, 0, 1), - new testcase("UTF-8", 0, 1, 0), - new testcase("UTF-8", 0, 1, 1), - new testcase("UTF-16BE", 0, 0, 0), - new testcase("UTF-16BE", 0, 1, 0), - new testcase("UTF-16BE", 0, 1, 1), - new testcase("UTF-16LE", 0, 0, 0), - new testcase("UTF-16LE", 0, 1, 0), - new testcase("UTF-16LE", 0, 1, 1), - new testcase("UTF-8", 1, 0, 0), - new testcase("UTF-8", 1, 0, 1), - new testcase("UTF-8", 1, 1, 0), - new testcase("UTF-8", 1, 1, 1), - new testcase("UTF-16BE", 1, 0, 0), - new testcase("UTF-16BE", 1, 1, 0), - new testcase("UTF-16BE", 1, 1, 1), - new testcase("UTF-16LE", 1, 0, 0), - new testcase("UTF-16LE", 1, 1, 0), - new testcase("UTF-16LE", 1, 1, 1), + new testcase("UTF-8", 0, 0, 0), + new testcase("UTF-8", 0, 0, 1), + new testcase("UTF-8", 0, 1, 0), + new testcase("UTF-8", 0, 1, 1), + new testcase("UTF-16BE", 0, 0, 0), + new testcase("UTF-16BE", 0, 1, 0), + new testcase("UTF-16BE", 0, 1, 1), + new testcase("UTF-16LE", 0, 0, 0), + new testcase("UTF-16LE", 0, 1, 0), + new testcase("UTF-16LE", 0, 1, 1), + new testcase("UTF-8", 1, 0, 0), + new testcase("UTF-8", 1, 0, 1), + new testcase("UTF-8", 1, 1, 0), + new testcase("UTF-8", 1, 1, 1), + new testcase("UTF-16BE", 1, 0, 0), + new testcase("UTF-16BE", 1, 1, 0), + new testcase("UTF-16BE", 1, 1, 1), + new testcase("UTF-16LE", 1, 0, 0), + new testcase("UTF-16LE", 1, 1, 0), + new testcase("UTF-16LE", 1, 1, 1), ); if (XML_SAX_IMPL == 'libxml') { @@ -159,7 +159,7 @@ if (XML_SAX_IMPL == 'libxml') { } foreach ($suite as $testcase) { - $testcase->run(); + $testcase->run(); } ?> diff --git a/ext/xml/tests/bug32001b.phpt b/ext/xml/tests/bug32001b.phpt index 3a3c11a3ba..a7762fffca 100644 --- a/ext/xml/tests/bug32001b.phpt +++ b/ext/xml/tests/bug32001b.phpt @@ -11,87 +11,87 @@ foreach(array('EUC-JP', 'Shift_JISP', 'GB2312') as $encoding) { --FILE-- <?php class testcase { - private $encoding; - private $bom; - private $prologue; - private $tags; - private $chunk_size; + private $encoding; + private $bom; + private $prologue; + private $tags; + private $chunk_size; - function testcase($enc, $chunk_size = 0, $bom = 0, $omit_prologue = 0) { - $this->encoding = $enc; - $this->chunk_size = $chunk_size; - $this->bom = $bom; - $this->prologue = !$omit_prologue; - $this->tags = array(); - } + function testcase($enc, $chunk_size = 0, $bom = 0, $omit_prologue = 0) { + $this->encoding = $enc; + $this->chunk_size = $chunk_size; + $this->bom = $bom; + $this->prologue = !$omit_prologue; + $this->tags = array(); + } - function start_element($parser, $name, $attrs) { - $attrs = array_map('bin2hex', $attrs); - $this->tags[] = bin2hex($name).": ".implode(', ', $attrs); - } + function start_element($parser, $name, $attrs) { + $attrs = array_map('bin2hex', $attrs); + $this->tags[] = bin2hex($name).": ".implode(', ', $attrs); + } - function end_element($parser, $name) { - } + function end_element($parser, $name) { + } - function run() { - $data = ''; + function run() { + $data = ''; - if ($this->prologue) { - $canonical_name = preg_replace('/BE|LE/i', '', $this->encoding); - $data .= "<?xml version=\"1.0\" encoding=\"$canonical_name\" ?>\n"; - } + if ($this->prologue) { + $canonical_name = preg_replace('/BE|LE/i', '', $this->encoding); + $data .= "<?xml version=\"1.0\" encoding=\"$canonical_name\" ?>\n"; + } - $data .= <<<HERE + $data .= <<<HERE <テスト:テスト1 xmlns:テスト="http://www.example.com/テスト/" テスト="テスト"> <テスト:テスト2 テスト="テスト"> - <テスト:テスト3> - test! - </テスト:テスト3> + <テスト:テスト3> + test! + </テスト:テスト3> </テスト:テスト2> </テスト:テスト1> HERE; - $data = iconv("UTF-8", $this->encoding, $data); + $data = iconv("UTF-8", $this->encoding, $data); - $parser = xml_parser_create(NULL); - xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); - xml_set_element_handler($parser, "start_element", "end_element"); - xml_set_object($parser, $this); + $parser = xml_parser_create(NULL); + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); + xml_set_element_handler($parser, "start_element", "end_element"); + xml_set_object($parser, $this); - if ($this->chunk_size == 0) { - $success = @xml_parse($parser, $data, true); - } else { - for ($offset = 0; $offset < strlen($data); - $offset += $this->chunk_size) { - $success = @xml_parse($parser, substr($data, $offset, $this->chunk_size), false); - if (!$success) { - break; - } - } - if ($success) { - $success = @xml_parse($parser, "", true); - } - } + if ($this->chunk_size == 0) { + $success = @xml_parse($parser, $data, true); + } else { + for ($offset = 0; $offset < strlen($data); + $offset += $this->chunk_size) { + $success = @xml_parse($parser, substr($data, $offset, $this->chunk_size), false); + if (!$success) { + break; + } + } + if ($success) { + $success = @xml_parse($parser, "", true); + } + } - echo "Encoding: $this->encoding\n"; - echo "XML Prologue: ".($this->prologue ? 'present': 'not present'), "\n"; - echo "Chunk size: ".($this->chunk_size ? "$this->chunk_size byte(s)\n": "all data at once\n"); - echo "BOM: ".($this->bom ? 'prepended': 'not prepended'), "\n"; + echo "Encoding: $this->encoding\n"; + echo "XML Prologue: ".($this->prologue ? 'present': 'not present'), "\n"; + echo "Chunk size: ".($this->chunk_size ? "$this->chunk_size byte(s)\n": "all data at once\n"); + echo "BOM: ".($this->bom ? 'prepended': 'not prepended'), "\n"; - if ($success) { - var_dump($this->tags); - } else { - echo "[Error] ", xml_error_string(xml_get_error_code($parser)), "\n"; - } - } + if ($success) { + var_dump($this->tags); + } else { + echo "[Error] ", xml_error_string(xml_get_error_code($parser)), "\n"; + } + } } $suite = array( - new testcase("EUC-JP" , 0), - new testcase("EUC-JP" , 1), - new testcase("Shift_JIS", 0), - new testcase("Shift_JIS", 1), - new testcase("GB2312", 0), - new testcase("GB2312", 1), + new testcase("EUC-JP" , 0), + new testcase("EUC-JP" , 1), + new testcase("Shift_JIS", 0), + new testcase("Shift_JIS", 1), + new testcase("GB2312", 0), + new testcase("GB2312", 1), ); if (XML_SAX_IMPL == 'libxml') { @@ -101,7 +101,7 @@ if (XML_SAX_IMPL == 'libxml') { } foreach ($suite as $testcase) { - $testcase->run(); + $testcase->run(); } ?> diff --git a/ext/xml/tests/bug76874.phpt b/ext/xml/tests/bug76874.phpt index c4377f0b88..ec0caae706 100644 --- a/ext/xml/tests/bug76874.phpt +++ b/ext/xml/tests/bug76874.phpt @@ -7,19 +7,19 @@ Bug #76874: xml_parser_free() should never leak memory class c { - private $xml; - private $test; + private $xml; + private $test; - public function test() - { - $this->xml = xml_parser_create(); - xml_set_character_data_handler($this->xml, array(&$this, 'handle_cdata')); - xml_parser_free($this->xml); - } + public function test() + { + $this->xml = xml_parser_create(); + xml_set_character_data_handler($this->xml, array(&$this, 'handle_cdata')); + xml_parser_free($this->xml); + } - public function handle_cdata(&$parser, $data) - { - } + public function handle_cdata(&$parser, $data) + { + } } $object = new c(); diff --git a/ext/xml/tests/xml001.phpt b/ext/xml/tests/xml001.phpt index e859a4bbcb..2d8fe54041 100644 --- a/ext/xml/tests/xml001.phpt +++ b/ext/xml/tests/xml001.phpt @@ -22,54 +22,54 @@ if (!($fp = @fopen("xmltest.xml", "r"))) { } while ($data = fread($fp, 4096)) { - if (!xml_parse($xml_parser, $data, feof($fp))) { - die(sprintf("XML error: %s at line %d\n", - xml_error_string(xml_get_error_code($xml_parser)), - xml_get_current_line_number($xml_parser))); - } + if (!xml_parse($xml_parser, $data, feof($fp))) { + die(sprintf("XML error: %s at line %d\n", + xml_error_string(xml_get_error_code($xml_parser)), + xml_get_current_line_number($xml_parser))); + } } print "parse complete\n"; xml_parser_free($xml_parser); function startElement($parser, $name, $attribs) { - print '{'.$name; - if (sizeof($attribs)) { + print '{'.$name; + if (sizeof($attribs)) { foreach ($attribs as $k => $v) { - print " $k=\"$v\""; - } - } - print '}'; + print " $k=\"$v\""; + } + } + print '}'; } function endElement($parser, $name) { - print '{/'.$name.'}'; + print '{/'.$name.'}'; } function characterData($parser, $data) { - print '{CDATA['.$data.']}'; + print '{CDATA['.$data.']}'; } function PIHandler($parser, $target, $data) { - print '{PI['.$target.','.$data.']}'; + print '{PI['.$target.','.$data.']}'; } function defaultHandler($parser, $data) { - if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { - print '{ENTREF['.$data.']}'; - } else { - print '{?['.$data.']}'; - } + if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { + print '{ENTREF['.$data.']}'; + } else { + print '{?['.$data.']}'; + } } function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId) { - print '{EXTENTREF['.$openEntityNames.','.$base.','.$systemId.','.$publicId."]}\n"; - return true; + print '{EXTENTREF['.$openEntityNames.','.$base.','.$systemId.','.$publicId."]}\n"; + return true; } ?> diff --git a/ext/xml/tests/xml002.phpt b/ext/xml/tests/xml002.phpt index e183fa4ae3..27a920cedd 100644 --- a/ext/xml/tests/xml002.phpt +++ b/ext/xml/tests/xml002.phpt @@ -11,41 +11,41 @@ chdir(__DIR__); class myclass { - function startElement($parser, $name, $attribs) - { - print '{'.$name; - if (sizeof($attribs)) { + function startElement($parser, $name, $attribs) + { + print '{'.$name; + if (sizeof($attribs)) { foreach ($attribs as $k => $v) { - print " $k=\"$v\""; - } - } - print '}'; - } - function endElement($parser, $name) - { - print '{/'.$name.'}'; - } - function characterData($parser, $data) - { - print '{CDATA['.$data.']}'; - } - function PIHandler($parser, $target, $data) - { - print '{PI['.$target.','.$data.']}'; - } - function defaultHandler($parser, $data) - { - if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { - print '{ENTREF['.$data.']}'; - } else { - print '{?['.$data.']}'; - } - } - function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId) - { - print '{EXTENTREF['.$openEntityNames.','.$base.','.$systemId.','.$publicId."]}\n"; - return true; - } + print " $k=\"$v\""; + } + } + print '}'; + } + function endElement($parser, $name) + { + print '{/'.$name.'}'; + } + function characterData($parser, $data) + { + print '{CDATA['.$data.']}'; + } + function PIHandler($parser, $target, $data) + { + print '{PI['.$target.','.$data.']}'; + } + function defaultHandler($parser, $data) + { + if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { + print '{ENTREF['.$data.']}'; + } else { + print '{?['.$data.']}'; + } + } + function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId) + { + print '{EXTENTREF['.$openEntityNames.','.$base.','.$systemId.','.$publicId."]}\n"; + return true; + } } $xml_parser = xml_parser_create(); @@ -60,15 +60,15 @@ xml_set_external_entity_ref_handler($xml_parser, array($obj, "externalEntityRefHandler")); if (!($fp = @fopen("xmltest.xml", "r"))) { - die("could not open XML input"); + die("could not open XML input"); } while ($data = fread($fp, 4096)) { - if (!xml_parse($xml_parser, $data, feof($fp))) { - die(sprintf("XML error: %s at line %d\n", - xml_error_string(xml_get_error_code($xml_parser)), - xml_get_current_line_number($xml_parser))); - } + if (!xml_parse($xml_parser, $data, feof($fp))) { + die(sprintf("XML error: %s at line %d\n", + xml_error_string(xml_get_error_code($xml_parser)), + xml_get_current_line_number($xml_parser))); + } } print "parse complete\n"; xml_parser_free($xml_parser); diff --git a/ext/xml/tests/xml003.phpt b/ext/xml/tests/xml003.phpt index fb4cbbd29e..08db287c18 100644 --- a/ext/xml/tests/xml003.phpt +++ b/ext/xml/tests/xml003.phpt @@ -11,41 +11,41 @@ chdir(__DIR__); class myclass { - function startElement($parser, $name, $attribs) - { - print '{'.$name; - if (sizeof($attribs)) { + function startElement($parser, $name, $attribs) + { + print '{'.$name; + if (sizeof($attribs)) { foreach ($attribs as $k => $v) { - print " $k=\"$v\""; - } - } - print '}'; - } - function endElement($parser, $name) - { - print '{/'.$name.'}'; - } - function characterData($parser, $data) - { - print '{CDATA['.$data.']}'; - } - function PIHandler($parser, $target, $data) - { - print '{PI['.$target.','.$data.']}'; - } - function defaultHandler($parser, $data) - { - if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { - print '{ENTREF['.$data.']}'; - } else { - print '{?['.$data.']}'; - } - } - function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId) - { - print '{EXTENTREF['.$openEntityNames.','.$base.','.$systemId.','.$publicId."]}\n"; - return true; - } + print " $k=\"$v\""; + } + } + print '}'; + } + function endElement($parser, $name) + { + print '{/'.$name.'}'; + } + function characterData($parser, $data) + { + print '{CDATA['.$data.']}'; + } + function PIHandler($parser, $target, $data) + { + print '{PI['.$target.','.$data.']}'; + } + function defaultHandler($parser, $data) + { + if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { + print '{ENTREF['.$data.']}'; + } else { + print '{?['.$data.']}'; + } + } + function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId) + { + print '{EXTENTREF['.$openEntityNames.','.$base.','.$systemId.','.$publicId."]}\n"; + return true; + } } $xml_parser = xml_parser_create(); @@ -59,15 +59,15 @@ xml_set_default_handler($xml_parser, "defaultHandler"); xml_set_external_entity_ref_handler($xml_parser, "externalEntityRefHandler"); if (!($fp = @fopen("xmltest.xml", "r"))) { - die("could not open XML input"); + die("could not open XML input"); } while ($data = fread($fp, 4096)) { - if (!xml_parse($xml_parser, $data, feof($fp))) { - die(sprintf("XML error: %s at line %d\n", - xml_error_string(xml_get_error_code($xml_parser)), - xml_get_current_line_number($xml_parser))); - } + if (!xml_parse($xml_parser, $data, feof($fp))) { + die(sprintf("XML error: %s at line %d\n", + xml_error_string(xml_get_error_code($xml_parser)), + xml_get_current_line_number($xml_parser))); + } } print "parse complete\n"; xml_parser_free($xml_parser); diff --git a/ext/xml/tests/xml004.phpt b/ext/xml/tests/xml004.phpt index 1e545db2a1..3d5adaa56b 100644 --- a/ext/xml/tests/xml004.phpt +++ b/ext/xml/tests/xml004.phpt @@ -11,7 +11,7 @@ xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false); xml_set_element_handler($xp, "start_element", "end_element"); $fp = fopen("xmltest.xml", "r"); while ($data = fread($fp, 4096)) { - xml_parse($xp, $data, feof($fp)); + xml_parse($xp, $data, feof($fp)); } xml_parser_free($xp); $xp = xml_parser_create(); @@ -19,24 +19,24 @@ xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true); xml_set_element_handler($xp, "start_element", "end_element"); $fp = fopen("xmltest.xml", "r"); while ($data = fread($fp, 4096)) { - xml_parse($xp, $data, feof($fp)); + xml_parse($xp, $data, feof($fp)); } xml_parser_free($xp); function start_element($xp, $elem, $attribs) { - print "<$elem"; - if (sizeof($attribs)) { + print "<$elem"; + if (sizeof($attribs)) { foreach ($attribs as $k => $v) { - print " $k=\"$v\""; - } - } - print ">\n"; + print " $k=\"$v\""; + } + } + print ">\n"; } function end_element($xp, $elem) { - print "</$elem>\n"; + print "</$elem>\n"; } ?> --EXPECT-- diff --git a/ext/xml/tests/xml007.phpt b/ext/xml/tests/xml007.phpt index f19f0389b6..5b76dfc848 100644 --- a/ext/xml/tests/xml007.phpt +++ b/ext/xml/tests/xml007.phpt @@ -12,12 +12,12 @@ if(strtoupper("äöüß") != "ÄÖÜß") <?php function startHandler($parser,$tag,$attr) { - var_dump($tag,$attr); + var_dump($tag,$attr); } function endHandler($parser,$tag) { - var_dump($tag); + var_dump($tag); } $xmldata = '<?xml version="1.0" encoding="ISO-8859-1"?><äöü üäß="Üäß">ÄÖÜ</äöü>'; diff --git a/ext/xml/tests/xml009.phpt b/ext/xml/tests/xml009.phpt index 7143a9faf7..8a33a4e715 100644 --- a/ext/xml/tests/xml009.phpt +++ b/ext/xml/tests/xml009.phpt @@ -8,7 +8,7 @@ if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is n --FILE-- <?php function start_elem($parser,$name,$attribs) { - var_dump($name); + var_dump($name); } function end_elem() { @@ -17,7 +17,7 @@ function end_elem() $xml = <<<HERE <a xmlns="http://example.com/foo" xmlns:bar="http://example.com/bar" - xmlns:baz="http://example.com/baz"> + xmlns:baz="http://example.com/baz"> <bar:b /> <bar:c xmlns:bar="http://example.com/foo"/> </a> diff --git a/ext/xml/tests/xml010.phpt b/ext/xml/tests/xml010.phpt index e4b4dd6520..69e8469fa6 100644 --- a/ext/xml/tests/xml010.phpt +++ b/ext/xml/tests/xml010.phpt @@ -8,7 +8,7 @@ if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is n --FILE-- <?php function start_elem($parser,$name,$attribs) { - print "$name "; + print "$name "; foreach($attribs as $key => $value) { print "$key = $value "; diff --git a/ext/xml/tests/xml_closures_001.phpt b/ext/xml/tests/xml_closures_001.phpt index da9d849da5..c1f91d50d5 100644 --- a/ext/xml/tests/xml_closures_001.phpt +++ b/ext/xml/tests/xml_closures_001.phpt @@ -8,18 +8,18 @@ chdir(__DIR__); $start_element = function ($xp, $elem, $attribs) { - print "<$elem"; - if (sizeof($attribs)) { + print "<$elem"; + if (sizeof($attribs)) { foreach ($attribs as $k => $v) { - print " $k=\"$v\""; - } - } - print ">\n"; + print " $k=\"$v\""; + } + } + print ">\n"; }; $end_element = function ($xp, $elem) { - print "</$elem>\n"; + print "</$elem>\n"; }; $xp = xml_parser_create(); @@ -27,7 +27,7 @@ xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false); xml_set_element_handler($xp, $start_element, $end_element); $fp = fopen("xmltest.xml", "r"); while ($data = fread($fp, 4096)) { - xml_parse($xp, $data, feof($fp)); + xml_parse($xp, $data, feof($fp)); } xml_parser_free($xp); diff --git a/ext/xml/tests/xml_set_notation_decl_handler_basic.phpt b/ext/xml/tests/xml_set_notation_decl_handler_basic.phpt index a4ea86375e..c7b8b09049 100644 --- a/ext/xml/tests/xml_set_notation_decl_handler_basic.phpt +++ b/ext/xml/tests/xml_set_notation_decl_handler_basic.phpt @@ -18,23 +18,23 @@ class XML_Parser { function unparsed_entity_decl_handler($parser, $entity_name, $base, $system_ID, $public_ID, $notation_name) - { - echo "unparsed_entity_decl_handler called\n"; - echo "...Entity name=" . $entity_name . "\n"; - echo "...Base=" . $base . "\n"; - echo "...System ID=" . $system_ID . "\n"; - echo "...Public ID=" . $public_ID . "\n"; - echo "...Notation name=" . $notation_name . "\n"; - } + { + echo "unparsed_entity_decl_handler called\n"; + echo "...Entity name=" . $entity_name . "\n"; + echo "...Base=" . $base . "\n"; + echo "...System ID=" . $system_ID . "\n"; + echo "...Public ID=" . $public_ID . "\n"; + echo "...Notation name=" . $notation_name . "\n"; + } - function notation_decl_handler($parser, $name, $base, $system_ID,$public_ID) - { - echo "notation_decl_handler called\n"; - echo "...Name=" . $name . "\n"; - echo "...Base=" . $base . "\n"; - echo "...System ID=" . $system_ID . "\n"; - echo "...Public ID=" . $public_ID . "\n"; - } + function notation_decl_handler($parser, $name, $base, $system_ID,$public_ID) + { + echo "notation_decl_handler called\n"; + echo "...Name=" . $name . "\n"; + echo "...Base=" . $base . "\n"; + echo "...System ID=" . $system_ID . "\n"; + echo "...Public ID=" . $public_ID . "\n"; + } function parse($data) { @@ -54,8 +54,8 @@ $xml = <<<HERE <!NOTATION AUSDATE SYSTEM "http://www.schema.net/ausdate.not"> <!NOTATION ISODATE SYSTEM "http://www.schema.net/isodate.not"> <!ENTITY testUS SYSTEM "test_usdate.xml" NDATA USDATE> - <!ENTITY testAUS SYSTEM "test_ausdate.xml" NDATA AUSDATE> - <!ENTITY testISO SYSTEM "test_isodate_xml" NDATA ISODATE>]> + <!ENTITY testAUS SYSTEM "test_ausdate.xml" NDATA AUSDATE> + <!ENTITY testISO SYSTEM "test_isodate_xml" NDATA ISODATE>]> ]> HERE; diff --git a/ext/xml/tests/xml_set_processing_instruction_handler_basic.phpt b/ext/xml/tests/xml_set_processing_instruction_handler_basic.phpt index cd5dda7763..f13c52517f 100644 --- a/ext/xml/tests/xml_set_processing_instruction_handler_basic.phpt +++ b/ext/xml/tests/xml_set_processing_instruction_handler_basic.phpt @@ -18,10 +18,10 @@ class XML_Parser { function PIHandler($parser, $target, $data) - { - echo "Target: " . $target. "\n"; - echo "Data: " . $data . "\n"; - } + { + echo "Target: " . $target. "\n"; + echo "Data: " . $data . "\n"; + } function parse($data) { diff --git a/ext/xml/tests/xml_set_start_namespace_decl_handler_basic.phpt b/ext/xml/tests/xml_set_start_namespace_decl_handler_basic.phpt index 8ee12e77cd..8d75d2099c 100644 --- a/ext/xml/tests/xml_set_start_namespace_decl_handler_basic.phpt +++ b/ext/xml/tests/xml_set_start_namespace_decl_handler_basic.phpt @@ -34,14 +34,14 @@ xml_parser_free( $parser ); echo "Done\n"; function Namespace_Start_Handler( $parser, $prefix, $uri ) { - echo "Namespace_Start_Handler called\n"; - echo "...Prefix: ". $prefix . "\n"; - echo "...Uri: ". $uri . "\n"; + echo "Namespace_Start_Handler called\n"; + echo "...Prefix: ". $prefix . "\n"; + echo "...Uri: ". $uri . "\n"; } function Namespace_End_Handler($parser, $prefix) { - echo "Namespace_End_Handler called\n"; - echo "...Prefix: ". $prefix . "\n\n"; + echo "Namespace_End_Handler called\n"; + echo "...Prefix: ". $prefix . "\n\n"; } function DefaultHandler( $parser, $data ) { diff --git a/ext/xmlreader/tests/001.phpt b/ext/xmlreader/tests/001.phpt index 6541c7e3b5..c10c1a5163 100644 --- a/ext/xmlreader/tests/001.phpt +++ b/ext/xmlreader/tests/001.phpt @@ -13,7 +13,7 @@ $reader->XML($xmlstring); // Only go through while ($reader->read()) { - echo $reader->name."\n"; + echo $reader->name."\n"; } $xmlstring = ''; $reader = new XMLReader(); diff --git a/ext/xmlreader/tests/002.phpt b/ext/xmlreader/tests/002.phpt index 9092740f15..6d12f02204 100644 --- a/ext/xmlreader/tests/002.phpt +++ b/ext/xmlreader/tests/002.phpt @@ -14,13 +14,13 @@ if ($reader->open('')) exit(); $reader = new XMLReader(); if (!$reader->open($filename)) { - $reader->close(); - exit(); + $reader->close(); + exit(); } // Only go through while ($reader->read()) { - echo $reader->name."\n"; + echo $reader->name."\n"; } $reader->close(); unlink($filename); diff --git a/ext/xmlreader/tests/003-mb.phpt b/ext/xmlreader/tests/003-mb.phpt index 18c522201b..5d0ec4de46 100644 --- a/ext/xmlreader/tests/003-mb.phpt +++ b/ext/xmlreader/tests/003-mb.phpt @@ -12,62 +12,62 @@ file_put_contents($filename, $xmlstring); $reader = new XMLReader(); if (!$reader->open($filename)) { - exit(); + exit(); } // Only go through while ($reader->read()) { - if ($reader->nodeType != XMLREADER::END_ELEMENT) { - if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) { - $attr = $reader->moveToFirstAttribute(); - echo $reader->name . ": "; - echo $reader->value . "\n"; + if ($reader->nodeType != XMLREADER::END_ELEMENT) { + if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) { + $attr = $reader->moveToFirstAttribute(); + echo $reader->name . ": "; + echo $reader->value . "\n"; - if ($reader->getAttribute($reader->name) == $reader->value) { - echo "1st attr (num) failed\n"; - } + if ($reader->getAttribute($reader->name) == $reader->value) { + echo "1st attr (num) failed\n"; + } - $attr = $reader->moveToNextAttribute(); - echo $reader->name . ": "; - echo $reader->value . "\n"; + $attr = $reader->moveToNextAttribute(); + echo $reader->name . ": "; + echo $reader->value . "\n"; - if ($reader->getAttribute($reader->name) == $reader->value) { - echo "2nd attr (idx) failed\n"; - } + if ($reader->getAttribute($reader->name) == $reader->value) { + echo "2nd attr (idx) failed\n"; + } - // Named attribute - $attr = $reader->moveToAttribute('num'); - echo $reader->name . ": "; - echo $reader->value . "\n"; + // Named attribute + $attr = $reader->moveToAttribute('num'); + echo $reader->name . ": "; + echo $reader->value . "\n"; - if ($reader->getAttribute('num') == $reader->value) { - echo "attr num failed\n"; - } + if ($reader->getAttribute('num') == $reader->value) { + echo "attr num failed\n"; + } - $attr = $reader->moveToAttribute('idx'); - echo $reader->name . ": "; - echo $reader->value . "\n"; + $attr = $reader->moveToAttribute('idx'); + echo $reader->name . ": "; + echo $reader->value . "\n"; - if ($reader->getAttribute('idx') == $reader->value) { - echo "attr idx failed\n"; - } + if ($reader->getAttribute('idx') == $reader->value) { + echo "attr idx failed\n"; + } - // Numeric positions of attributes - $attr = $reader->moveToAttributeNo(0); - echo $reader->name . ": "; - echo $reader->value . "\n"; + // Numeric positions of attributes + $attr = $reader->moveToAttributeNo(0); + echo $reader->name . ": "; + echo $reader->value . "\n"; - if ($reader->getAttributeNo(0) == $reader->value) { - echo "attr 0 failed\n"; - } + if ($reader->getAttributeNo(0) == $reader->value) { + echo "attr 0 failed\n"; + } - $attr = $reader->moveToAttributeNo(1); - echo $reader->name . ": "; - echo $reader->value . "\n"; + $attr = $reader->moveToAttributeNo(1); + echo $reader->name . ": "; + echo $reader->value . "\n"; - } - } + } + } } $reader->close(); unlink($filename); diff --git a/ext/xmlreader/tests/003.phpt b/ext/xmlreader/tests/003.phpt index 394f95cab5..c52c932c97 100644 --- a/ext/xmlreader/tests/003.phpt +++ b/ext/xmlreader/tests/003.phpt @@ -12,65 +12,65 @@ file_put_contents($filename, $xmlstring); $reader = new XMLReader(); if (!$reader->open($filename)) { - exit(); + exit(); } // Only go through while ($reader->read()) { - if ($reader->nodeType != XMLREADER::END_ELEMENT) { - if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) { - $attr = $reader->moveToFirstAttribute(); - echo $reader->name . ": "; - echo $reader->value . "\n"; - - if ($reader->getAttribute($reader->name) == $reader->value) { - echo "1st attr (num) failed\n"; - } - - - $attr = $reader->moveToNextAttribute(); - echo $reader->name . ": "; - echo $reader->value . "\n"; - - if ($reader->getAttribute($reader->name) == $reader->value) { - echo "2nd attr (idx) failed\n"; - } - - // Named attribute - $attr = $reader->moveToAttribute('num'); - echo $reader->name . ": "; - echo $reader->value . "\n"; - - if ($reader->getAttribute('num') == $reader->value) { - echo "attr num failed\n"; - } - - $attr = $reader->moveToAttribute('idx'); - echo $reader->name . ": "; - echo $reader->value . "\n"; - - if ($reader->getAttribute('idx') == $reader->value) { - echo "attr idx failed\n"; - } - - // Numeric positions of attributes - $attr = $reader->moveToAttributeNo(0); - echo $reader->name . ": "; - echo $reader->value . "\n"; - - if ($reader->getAttributeNo(0) == $reader->value) { - echo "attr 0 failed\n"; - } - - $attr = $reader->moveToAttributeNo(1); - echo $reader->name . ": "; - echo $reader->value . "\n"; - - var_dump($reader->moveToAttributeNo(20)); - var_dump($reader->moveToAttribute('missing-attribute')); - var_dump($reader->moveToAttribute('')); - } - } + if ($reader->nodeType != XMLREADER::END_ELEMENT) { + if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) { + $attr = $reader->moveToFirstAttribute(); + echo $reader->name . ": "; + echo $reader->value . "\n"; + + if ($reader->getAttribute($reader->name) == $reader->value) { + echo "1st attr (num) failed\n"; + } + + + $attr = $reader->moveToNextAttribute(); + echo $reader->name . ": "; + echo $reader->value . "\n"; + + if ($reader->getAttribute($reader->name) == $reader->value) { + echo "2nd attr (idx) failed\n"; + } + + // Named attribute + $attr = $reader->moveToAttribute('num'); + echo $reader->name . ": "; + echo $reader->value . "\n"; + + if ($reader->getAttribute('num') == $reader->value) { + echo "attr num failed\n"; + } + + $attr = $reader->moveToAttribute('idx'); + echo $reader->name . ": "; + echo $reader->value . "\n"; + + if ($reader->getAttribute('idx') == $reader->value) { + echo "attr idx failed\n"; + } + + // Numeric positions of attributes + $attr = $reader->moveToAttributeNo(0); + echo $reader->name . ": "; + echo $reader->value . "\n"; + + if ($reader->getAttributeNo(0) == $reader->value) { + echo "attr 0 failed\n"; + } + + $attr = $reader->moveToAttributeNo(1); + echo $reader->name . ": "; + echo $reader->value . "\n"; + + var_dump($reader->moveToAttributeNo(20)); + var_dump($reader->moveToAttribute('missing-attribute')); + var_dump($reader->moveToAttribute('')); + } + } } $reader->close(); unlink($filename); diff --git a/ext/xmlreader/tests/004.phpt b/ext/xmlreader/tests/004.phpt index c13dc1c0e8..9362c2b1a1 100644 --- a/ext/xmlreader/tests/004.phpt +++ b/ext/xmlreader/tests/004.phpt @@ -12,21 +12,21 @@ file_put_contents($filename, $xmlstring); $reader = new XMLReader(); if (!$reader->open($filename)) { - exit(); + exit(); } while ($reader->read()) { - if ($reader->nodeType != XMLREADER::END_ELEMENT) { - echo $reader->name."\n"; - if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) { - $attr = $reader->moveToFirstAttribute(); - while ($attr) { - echo " Attribute Name: ".$reader->name."\n"; - echo " Attribute Value: ".$reader->value."\n"; - $attr = $reader->moveToNextAttribute(); - } - } - } + if ($reader->nodeType != XMLREADER::END_ELEMENT) { + echo $reader->name."\n"; + if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) { + $attr = $reader->moveToFirstAttribute(); + while ($attr) { + echo " Attribute Name: ".$reader->name."\n"; + echo " Attribute Value: ".$reader->value."\n"; + $attr = $reader->moveToNextAttribute(); + } + } + } } $reader->close(); unlink($filename); diff --git a/ext/xmlreader/tests/005.phpt b/ext/xmlreader/tests/005.phpt index 82a64bff5d..e50b840ef5 100644 --- a/ext/xmlreader/tests/005.phpt +++ b/ext/xmlreader/tests/005.phpt @@ -17,14 +17,14 @@ $a = $reader->setParserProperty(XMLReader::LOADDTD, false); $b = $reader->getParserProperty(XMLReader::LOADDTD); if (!$a && !$b) { - echo "ok\n"; + echo "ok\n"; } $a = $reader->setParserProperty(XMLReader::SUBST_ENTITIES, true); $b = $reader->getParserProperty(XMLReader::SUBST_ENTITIES); if ($a && $b) { - echo "ok\n"; + echo "ok\n"; } // Only go through while ($reader->read()); diff --git a/ext/xmlreader/tests/006.phpt b/ext/xmlreader/tests/006.phpt index 5bdfc46b8d..9702e28270 100644 --- a/ext/xmlreader/tests/006.phpt +++ b/ext/xmlreader/tests/006.phpt @@ -17,14 +17,14 @@ $reader->read(); $reader->read(); if ($reader->nodeType != XMLREADER::END_ELEMENT) { - if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) { - $attr = $reader->moveToFirstAttribute(); - if ($reader->moveToElement()) { - if ($reader->name == 'book') { - echo "ok\n"; - } - } - } + if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) { + $attr = $reader->moveToFirstAttribute(); + if ($reader->moveToElement()) { + if ($reader->name == 'book') { + echo "ok\n"; + } + } + } } $reader->close(); diff --git a/ext/xmlreader/tests/007.phpt b/ext/xmlreader/tests/007.phpt index d6247b9ca9..796b9fa05c 100644 --- a/ext/xmlreader/tests/007.phpt +++ b/ext/xmlreader/tests/007.phpt @@ -43,7 +43,7 @@ $reader = new XMLReader(); $reader->XML($xmlstring); if ($reader->setRelaxNGSchema('')) { - echo 'failed'; + echo 'failed'; } $reader->close(); ?> diff --git a/ext/xmlreader/tests/008.phpt b/ext/xmlreader/tests/008.phpt index c5f7a760ca..12361a0efc 100644 --- a/ext/xmlreader/tests/008.phpt +++ b/ext/xmlreader/tests/008.phpt @@ -32,7 +32,7 @@ $reader->setParserProperty(XMLREADER::LOADDTD, TRUE); $reader->setParserProperty(XMLREADER::VALIDATE, TRUE); while($reader->read()); if ($reader->isValid()) { - echo "file DTD: ok\n"; + echo "file DTD: ok\n"; } $reader->close(); unlink($file); @@ -60,7 +60,7 @@ $reader->setParserProperty(XMLREADER::LOADDTD, TRUE); $reader->setParserProperty(XMLREADER::VALIDATE, TRUE); while($reader->read()); if ($reader->isValid()) { - echo "string DTD: ok\n"; + echo "string DTD: ok\n"; } ?> --EXPECT-- diff --git a/ext/xmlreader/tests/012.phpt b/ext/xmlreader/tests/012.phpt index 558b584912..20d26eaa4b 100644 --- a/ext/xmlreader/tests/012.phpt +++ b/ext/xmlreader/tests/012.phpt @@ -25,7 +25,7 @@ EOF; $xmlstring = str_replace('012.dtd', __DIR__.'/012.dtd', $xmlstring); if (DIRECTORY_SEPARATOR == '\\') { - $xmlstring = str_replace('\\',"/", $xmlstring); + $xmlstring = str_replace('\\',"/", $xmlstring); } $reader = new XMLReader(); $reader->XML($xmlstring); @@ -39,7 +39,7 @@ echo "\nUsing URI:\n"; $reader = new XMLReader(); $file = __DIR__ . '/012.xml'; if (DIRECTORY_SEPARATOR == '\\') { - $file = str_replace('\\',"/", $file); + $file = str_replace('\\',"/", $file); } $reader->open($file); diff --git a/ext/xmlreader/tests/013.phpt b/ext/xmlreader/tests/013.phpt index 0abf4c9aa0..1396485e9a 100644 --- a/ext/xmlreader/tests/013.phpt +++ b/ext/xmlreader/tests/013.phpt @@ -18,10 +18,10 @@ $reader = new XMLReader(); $reader->XML($xml); $reader->setSchema(__DIR__ . '/013.xsd'); while($reader->read()) { - if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'item') { - $reader->read(); - var_dump($reader->value); - } + if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'item') { + $reader->read(); + var_dump($reader->value); + } } $reader->close(); diff --git a/ext/xmlreader/tests/bug64230.phpt b/ext/xmlreader/tests/bug64230.phpt index fb1ab4932f..b584d8f7cf 100644 --- a/ext/xmlreader/tests/bug64230.phpt +++ b/ext/xmlreader/tests/bug64230.phpt @@ -9,10 +9,10 @@ extension_loaded("xmlreader") or die("skip requires xmlreader"); echo "Test\n"; function show_internal_errors() { - foreach (libxml_get_errors() as $error) { - printf("Internal: %s\n", $error->message); - } - libxml_clear_errors(); + foreach (libxml_get_errors() as $error) { + printf("Internal: %s\n", $error->message); + } + libxml_clear_errors(); } echo "Internal errors TRUE\n"; diff --git a/ext/xmlreader/tests/bug71805.phpt b/ext/xmlreader/tests/bug71805.phpt index a1de3ec8f6..9fc66ea2a4 100644 --- a/ext/xmlreader/tests/bug71805.phpt +++ b/ext/xmlreader/tests/bug71805.phpt @@ -9,27 +9,27 @@ TestXML(__DIR__ . DIRECTORY_SEPARATOR . 'XMLReaderGood_bug71805.xml'); TestXML(__DIR__ . DIRECTORY_SEPARATOR . 'XMLReaderBad_bug71805.xml'); function TestXML($file) { - $XR = new XMLReader; - $XR->open($file, null, LIBXML_NOBLANKS); + $XR = new XMLReader; + $XR->open($file, null, LIBXML_NOBLANKS); - while (($lastRead = $XR->read()) && ($XR->name !== 'records')); - while (($lastRead = $XR->read()) && ($XR->name !== 'record')); - while ($lastRead) { - $xml = $XR->readOuterXML(); - if ($xml === '') { - $err = ''; - if ($e = libxml_get_last_error()) { $err = $e->message.' (line: '.$e->line.')'; } - $XR->close(); - echo $file.' : Problem with file'.($err ? ' — '.$err : '').'.'; - echo "\n"; - return; - } - while (($lastRead = $XR->next()) && ($XR->name !== 'record')); - } - $XR->close(); - echo $file.' : Good!'; - echo "\n"; - return; + while (($lastRead = $XR->read()) && ($XR->name !== 'records')); + while (($lastRead = $XR->read()) && ($XR->name !== 'record')); + while ($lastRead) { + $xml = $XR->readOuterXML(); + if ($xml === '') { + $err = ''; + if ($e = libxml_get_last_error()) { $err = $e->message.' (line: '.$e->line.')'; } + $XR->close(); + echo $file.' : Problem with file'.($err ? ' — '.$err : '').'.'; + echo "\n"; + return; + } + while (($lastRead = $XR->next()) && ($XR->name !== 'record')); + } + $XR->close(); + echo $file.' : Good!'; + echo "\n"; + return; } ?> --EXPECTF-- diff --git a/ext/xmlreader/tests/static.phpt b/ext/xmlreader/tests/static.phpt index 0218efd5fc..1c6cb5b870 100644 --- a/ext/xmlreader/tests/static.phpt +++ b/ext/xmlreader/tests/static.phpt @@ -14,12 +14,12 @@ file_put_contents($filename, $xmlstring); $reader = XMLReader::open($filename); while ($reader->read()) { - echo $reader->name, "\n"; + echo $reader->name, "\n"; } $reader = XMLReader::XML($xmlstring); while ($reader->read()) { - echo $reader->name, "\n"; + echo $reader->name, "\n"; } ?> --EXPECTF-- diff --git a/ext/xmlrpc/tests/003.phpt b/ext/xmlrpc/tests/003.phpt index 1125ff2b9c..f164a377da 100644 --- a/ext/xmlrpc/tests/003.phpt +++ b/ext/xmlrpc/tests/003.phpt @@ -6,27 +6,27 @@ xmlrpc_encode() Simple test encode array <?php $params = array( - "one" => "red", - "two" => "blue", - "three" => "green" + "one" => "red", + "two" => "blue", + "three" => "green" ); $response = xmlrpc_encode($params); echo $response; $params = array( - "red", - "blue", - "green" + "red", + "blue", + "green" ); $response = xmlrpc_encode($params); echo $response; $params = array( - 0 => "red", - 1 => "blue", - 3 => "green" + 0 => "red", + 1 => "blue", + 3 => "green" ); $response = xmlrpc_encode($params); diff --git a/ext/xmlrpc/tests/bug42736.phpt b/ext/xmlrpc/tests/bug42736.phpt index 9ab2818169..bb6b787295 100644 --- a/ext/xmlrpc/tests/bug42736.phpt +++ b/ext/xmlrpc/tests/bug42736.phpt @@ -6,9 +6,9 @@ Bug #42736 (xmlrpc_server_call_method() crashes) <?php class SOAP_Array { - public function get($id){ - return $this->add($id); - } + public function get($id){ + return $this->add($id); + } } $xml = xmlrpc_server_create(); @@ -16,9 +16,9 @@ $xml = xmlrpc_server_create(); $Myrequest = '<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>GetProducts</methodName><params><param><value><dateTime.iso8601>20060922T14:26:19</dateTime.iso8601></value></param></params></methodCall>'; class MyClass { - function GetProducts($dummy, $time){ - return array('faultString' => $time); - } + function GetProducts($dummy, $time){ + return array('faultString' => $time); + } } $myclass = new MyClass(); xmlrpc_server_register_method($xml, 'GetProducts', array($myclass, 'GetProducts')); diff --git a/ext/xmlrpc/tests/bug45556.phpt b/ext/xmlrpc/tests/bug45556.phpt index 29d689dc6d..485f2c12de 100644 --- a/ext/xmlrpc/tests/bug45556.phpt +++ b/ext/xmlrpc/tests/bug45556.phpt @@ -13,9 +13,9 @@ $server = xmlrpc_server_create (); function foo() { return 11111; } class bar { - static public function test() { - return 'foo'; - } + static public function test() { + return 'foo'; + } } xmlrpc_server_register_introspection_callback($server, 'foobar'); diff --git a/ext/xmlrpc/tests/bug72155.phpt b/ext/xmlrpc/tests/bug72155.phpt index 40c6c56237..6e05a5113c 100644 --- a/ext/xmlrpc/tests/bug72155.phpt +++ b/ext/xmlrpc/tests/bug72155.phpt @@ -7,9 +7,9 @@ if (!extension_loaded("xmlrpc")) print "skip"; --FILE-- <?php if (false !== strpos(PHP_OS, "WIN")) { - $fl = "c:\\windows\\explorer.exe"; + $fl = "c:\\windows\\explorer.exe"; } else { - $fl = "/etc/passwd"; + $fl = "/etc/passwd"; } $var0 = fopen($fl,"r"); $var1 = xmlrpc_encode($var0); diff --git a/ext/xmlwriter/tests/003.phpt b/ext/xmlwriter/tests/003.phpt index 05ba2e5d4d..4f2003fe35 100644 --- a/ext/xmlwriter/tests/003.phpt +++ b/ext/xmlwriter/tests/003.phpt @@ -18,8 +18,8 @@ xmlwriter_write_attribute($xw, "att2", "att2_value"); xmlwriter_text($xw, "Test text for tag1"); $res = xmlwriter_start_element($xw, 'tag2'); if ($res < 1) { - echo "StartElement context validation failed\n"; - exit(); + echo "StartElement context validation failed\n"; + exit(); } xmlwriter_end_document($xw); diff --git a/ext/xmlwriter/tests/004.phpt b/ext/xmlwriter/tests/004.phpt index 5554046e0e..72766bb0e9 100644 --- a/ext/xmlwriter/tests/004.phpt +++ b/ext/xmlwriter/tests/004.phpt @@ -24,9 +24,9 @@ $md5_res = md5('<?xml version="1.0" encoding="UTF-8"?> unset($xw); unlink($doc_dest); if ($md5_out != $md5_res) { - echo "failed: $md5_res != $md5_out\n"; + echo "failed: $md5_res != $md5_out\n"; } else { - echo "ok.\n"; + echo "ok.\n"; } ?> --EXPECT-- diff --git a/ext/xmlwriter/tests/OO_003.phpt b/ext/xmlwriter/tests/OO_003.phpt index b2e551f32a..ba1e7e177d 100644 --- a/ext/xmlwriter/tests/OO_003.phpt +++ b/ext/xmlwriter/tests/OO_003.phpt @@ -21,8 +21,8 @@ $xw->endAttribute(); $xw->text("Test text for tag1"); $res = $xw->startElement('tag2'); if ($res < 1) { - echo "StartElement context validation failed\n"; - exit(); + echo "StartElement context validation failed\n"; + exit(); } $xw->endDocument(); diff --git a/ext/xmlwriter/tests/OO_004.phpt b/ext/xmlwriter/tests/OO_004.phpt index 50eacfb908..17dbee9d28 100644 --- a/ext/xmlwriter/tests/OO_004.phpt +++ b/ext/xmlwriter/tests/OO_004.phpt @@ -25,9 +25,9 @@ $md5_res = md5('<?xml version="1.0" encoding="UTF-8"?> unset($xw); unlink($doc_dest); if ($md5_out != $md5_res) { - echo "failed: $md5_res != $md5_out\n"; + echo "failed: $md5_res != $md5_out\n"; } else { - echo "ok.\n"; + echo "ok.\n"; } ?> --EXPECT-- diff --git a/ext/xmlwriter/tests/xmlwriter_set_indent_string_basic_001.phpt b/ext/xmlwriter/tests/xmlwriter_set_indent_string_basic_001.phpt index d887008256..26f243dfef 100644 --- a/ext/xmlwriter/tests/xmlwriter_set_indent_string_basic_001.phpt +++ b/ext/xmlwriter/tests/xmlwriter_set_indent_string_basic_001.phpt @@ -5,9 +5,9 @@ xmlwriter_set_indent_string passing xmlwriter resource --FILE-- <?php $temp_filename = __DIR__."/xmlwriter_set_indent_string.tmp"; - $fp = fopen($temp_filename, "w"); - fwrite ($fp, "Hi"); - fclose($fp); + $fp = fopen($temp_filename, "w"); + fwrite ($fp, "Hi"); + fclose($fp); $resource = xmlwriter_open_uri($temp_filename); var_dump(xmlwriter_set_indent_string($resource, ' ')); ?> diff --git a/ext/xsl/tests/bug49634.phpt b/ext/xsl/tests/bug49634.phpt index edf53ba600..86c11b1884 100644 --- a/ext/xsl/tests/bug49634.phpt +++ b/ext/xsl/tests/bug49634.phpt @@ -10,7 +10,7 @@ extension_loaded("xsl") or die("skip need ext/xsl"); $sXml = <<<XML <?xml version="1.0" encoding="UTF-8" ?> <root> - test + test </root> XML; @@ -21,16 +21,16 @@ $sXsl = <<<XSL xmlns:ext="http://php.net/xsl" xsl:extension-element-prefixes="ext" exclude-result-prefixes="ext"> - <xsl:output encoding="UTF-8" indent="yes" method="xml" /> - <xsl:template match="/"> - <xsl:value-of select="ext:function('testFunction', document('$cDIR/bug49634.xml')/root)"/> - </xsl:template> + <xsl:output encoding="UTF-8" indent="yes" method="xml" /> + <xsl:template match="/"> + <xsl:value-of select="ext:function('testFunction', document('$cDIR/bug49634.xml')/root)"/> + </xsl:template> </xsl:stylesheet> XSL; function testFunction($a) { - throw new Exception('Test exception.'); + throw new Exception('Test exception.'); } $domXml = new DOMDocument; @@ -40,14 +40,14 @@ $domXsl->loadXML($sXsl); for ($i = 0; $i < 10; $i++) { - $xsltProcessor = new XSLTProcessor(); - $xsltProcessor->registerPHPFunctions(array('testFunction')); - $xsltProcessor->importStyleSheet($domXsl); - try { - @$xsltProcessor->transformToDoc($domXml); - } catch (Exception $e) { - echo $e,"\n"; - } + $xsltProcessor = new XSLTProcessor(); + $xsltProcessor->registerPHPFunctions(array('testFunction')); + $xsltProcessor->importStyleSheet($domXsl); + try { + @$xsltProcessor->transformToDoc($domXml); + } catch (Exception $e) { + echo $e,"\n"; + } } ?> --EXPECTF-- diff --git a/ext/xsl/tests/bug54446.phpt b/ext/xsl/tests/bug54446.phpt index b9af5581eb..1e518f4977 100644 --- a/ext/xsl/tests/bug54446.phpt +++ b/ext/xsl/tests/bug54446.phpt @@ -15,15 +15,15 @@ if (file_exists($outputfile)) { $sXsl = <<<EOT <xsl:stylesheet version="1.0" - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:sax="http://icl.com/saxon" - extension-element-prefixes="sax"> - - <xsl:template match="/"> - <sax:output href="$outputfile" method="text"> - <xsl:value-of select="'0wn3d via PHP and libxslt ...'"/> - </sax:output> - </xsl:template> + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:sax="http://icl.com/saxon" + extension-element-prefixes="sax"> + + <xsl:template match="/"> + <sax:output href="$outputfile" method="text"> + <xsl:value-of select="'0wn3d via PHP and libxslt ...'"/> + </sax:output> + </xsl:template> </xsl:stylesheet> EOT; diff --git a/ext/xsl/tests/bug54446_with_ini.phpt b/ext/xsl/tests/bug54446_with_ini.phpt index 5327d6d397..9232295358 100644 --- a/ext/xsl/tests/bug54446_with_ini.phpt +++ b/ext/xsl/tests/bug54446_with_ini.phpt @@ -15,15 +15,15 @@ if (file_exists($outputfile)) { $sXsl = <<<EOT <xsl:stylesheet version="1.0" - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:sax="http://icl.com/saxon" - extension-element-prefixes="sax"> - - <xsl:template match="/"> - <sax:output href="$outputfile" method="text"> - <xsl:value-of select="'0wn3d via PHP and libxslt ...'"/> - </sax:output> - </xsl:template> + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:sax="http://icl.com/saxon" + extension-element-prefixes="sax"> + + <xsl:template match="/"> + <sax:output href="$outputfile" method="text"> + <xsl:value-of select="'0wn3d via PHP and libxslt ...'"/> + </sax:output> + </xsl:template> </xsl:stylesheet> EOT; diff --git a/ext/xsl/tests/bug71540.phpt b/ext/xsl/tests/bug71540.phpt index efde4bb77d..367ba49c15 100644 --- a/ext/xsl/tests/bug71540.phpt +++ b/ext/xsl/tests/bug71540.phpt @@ -16,7 +16,7 @@ $xml = <<<EOB EOB; $xsl = <<<EOB <?xml version="1.0" encoding="UTF-8"?> -<xsl:stylesheet version="1.0" +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl"> <xsl:output method="html" encoding="utf-8" indent="yes"/> diff --git a/ext/xsl/tests/xslt012.phpt b/ext/xsl/tests/xslt012.phpt index a24a0d2a7f..737512bbe9 100644 --- a/ext/xsl/tests/xslt012.phpt +++ b/ext/xsl/tests/xslt012.phpt @@ -30,9 +30,9 @@ if(!$proc) { $proc->importStylesheet($xsl); $parameters = Array( - 'foo' => 'barbar', - 'foo1' => 'test', - ); + 'foo' => 'barbar', + 'foo1' => 'test', + ); $proc->setParameter( "", $parameters); diff --git a/ext/zip/tests/bug14962.phpt b/ext/zip/tests/bug14962.phpt index 06a2ce5e6a..fbebfc7275 100644 --- a/ext/zip/tests/bug14962.phpt +++ b/ext/zip/tests/bug14962.phpt @@ -16,7 +16,7 @@ $za->addFromString($file, '1234'); $za->close(); if (!is_file($dir . "/__14962.zip")) { - die('failed to create the archive'); + die('failed to create the archive'); } $za = new ZipArchive; $za->open($dir . '/__14962.zip'); @@ -24,8 +24,8 @@ $za->extractTo($dir, NULL); $za->close(); if (is_file($fullpath)) { - unlink($fullpath); - echo "Ok"; + unlink($fullpath); + echo "Ok"; } unlink($dir . '/' . '__14962.zip'); ?> diff --git a/ext/zip/tests/bug38943.inc b/ext/zip/tests/bug38943.inc index b439939e64..b04049a172 100644 --- a/ext/zip/tests/bug38943.inc +++ b/ext/zip/tests/bug38943.inc @@ -1,13 +1,13 @@ <?php class myZip extends ZipArchive { - private $test = 0; - public $testp = 1; - private $testarray = array(); + private $test = 0; + public $testp = 1; + private $testarray = array(); - public function __construct() { - $this->testarray[] = 1; - var_dump($this->testarray); - } + public function __construct() { + $this->testarray[] = 1; + var_dump($this->testarray); + } } $z = new myZip; diff --git a/ext/zip/tests/bug38943.phpt b/ext/zip/tests/bug38943.phpt index c5e2284719..ffd0f8dc16 100644 --- a/ext/zip/tests/bug38943.phpt +++ b/ext/zip/tests/bug38943.phpt @@ -7,14 +7,14 @@ if(!extension_loaded('zip')) die('skip'); --FILE-- <?php class myZip extends ZipArchive { - private $test = 0; - public $testp = 1; - private $testarray = array(); + private $test = 0; + public $testp = 1; + private $testarray = array(); - public function __construct() { - $this->testarray[] = 1; - var_dump($this->testarray); - } + public function __construct() { + $this->testarray[] = 1; + var_dump($this->testarray); + } } $z = new myZip; diff --git a/ext/zip/tests/bug40228-mb.phpt b/ext/zip/tests/bug40228-mb.phpt index b7095dda68..fddfb65f29 100644 --- a/ext/zip/tests/bug40228-mb.phpt +++ b/ext/zip/tests/bug40228-mb.phpt @@ -10,11 +10,11 @@ $zip = new ZipArchive; $zip->open($arc_name, ZIPARCHIVE::CREATE); $zip->extractTo($dest); if (is_dir($dest . '/test/empty')) { - echo "Ok\n"; - rmdir($dest . '/test/empty'); - rmdir($dest . '/test'); + echo "Ok\n"; + rmdir($dest . '/test/empty'); + rmdir($dest . '/test'); } else { - echo "Failed.\n"; + echo "Failed.\n"; } echo "Done\n"; ?> diff --git a/ext/zip/tests/bug40228.phpt b/ext/zip/tests/bug40228.phpt index ce5f1e6afe..49e202c576 100644 --- a/ext/zip/tests/bug40228.phpt +++ b/ext/zip/tests/bug40228.phpt @@ -10,11 +10,11 @@ $zip = new ZipArchive; $zip->open($arc_name, ZIPARCHIVE::CREATE); $zip->extractTo($dest); if (is_dir($dest . '/test/empty')) { - echo "Ok\n"; - rmdir($dest . '/test/empty'); - rmdir($dest . '/test'); + echo "Ok\n"; + rmdir($dest . '/test/empty'); + rmdir($dest . '/test'); } else { - echo "Failed.\n"; + echo "Failed.\n"; } echo "Done\n"; ?> diff --git a/ext/zip/tests/bug47667.phpt b/ext/zip/tests/bug47667.phpt index 085fb1b87f..ab93202801 100644 --- a/ext/zip/tests/bug47667.phpt +++ b/ext/zip/tests/bug47667.phpt @@ -11,24 +11,24 @@ $filename = $thisdir . "/bug47667.zip"; $zip = new ZipArchive(); if ($zip->open($filename, ZipArchive::CREATE) !== true) { - exit("Unable to open the zip file"); + exit("Unable to open the zip file"); } else { - $zip->addFromString('foo.txt', 'foo bar foobar'); - $zip->close(); + $zip->addFromString('foo.txt', 'foo bar foobar'); + $zip->close(); } for ($i = 0; $i < 10; $i++) { - $zip = new ZipArchive(); - if ($zip->open($filename, ZipArchive::OVERWRITE) !== true) { - exit("Unable to open the zip file"); - } - $zip->addFromString("foo_{$i}.txt", 'foo bar foobar'); - $zip->close(); + $zip = new ZipArchive(); + if ($zip->open($filename, ZipArchive::OVERWRITE) !== true) { + exit("Unable to open the zip file"); + } + $zip->addFromString("foo_{$i}.txt", 'foo bar foobar'); + $zip->close(); } $zip = new ZipArchive(); if ($zip->open($filename, ZipArchive::CREATE) !== true) { - exit("Unable to open the zip file"); + exit("Unable to open the zip file"); } echo "files: " , $zip->numFiles; diff --git a/ext/zip/tests/bug49072.phpt b/ext/zip/tests/bug49072.phpt index b918fba01b..dfe593d01b 100644 --- a/ext/zip/tests/bug49072.phpt +++ b/ext/zip/tests/bug49072.phpt @@ -9,13 +9,13 @@ if(!extension_loaded('zip')) die('skip'); $f = __DIR__ . '/bug49072.zip'; $o = new ZipArchive(); if (! $o->open($f, ZipArchive::CHECKCONS)) { - exit ('error can\'t open'); + exit ('error can\'t open'); } $r = $o->getStream('file1'); // this file has a wrong crc if (!$r)die('failed to open a stream for file1'); $s = ''; while (! feof($r)) { - $s .= fread($r,1024); + $s .= fread($r,1024); } ?> --EXPECTF-- diff --git a/ext/zip/tests/bug51353.phpt b/ext/zip/tests/bug51353.phpt index d84de38f5b..896375dda3 100644 --- a/ext/zip/tests/bug51353.phpt +++ b/ext/zip/tests/bug51353.phpt @@ -13,28 +13,28 @@ set_time_limit(0); $base_path = __DIR__; /* Either we ship a file with 100000 entries which would be >12M big, - or create it dynamically. */ + or create it dynamically. */ $zip = new ZipArchive; $r = $zip->open("$base_path/51353.zip", ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE); if ($r) { - for ($i = 0; $i < 100000; $i++) { - $zip->addFromString("$i.txt", '1'); - } - $zip->close(); + for ($i = 0; $i < 100000; $i++) { + $zip->addFromString("$i.txt", '1'); + } + $zip->close(); } else { - die("failed"); + die("failed"); } $zip = new ZipArchive; $r = $zip->open("$base_path/51353.zip"); if ($r) { - $zip->extractTo("$base_path/51353_unpack"); - $zip->close(); + $zip->extractTo("$base_path/51353_unpack"); + $zip->close(); - $a = glob("$base_path/51353_unpack/*.txt"); - echo count($a) . "\n"; + $a = glob("$base_path/51353_unpack/*.txt"); + echo count($a) . "\n"; } else { - die("failed"); + die("failed"); } echo "OK"; diff --git a/ext/zip/tests/bug53579.phpt b/ext/zip/tests/bug53579.phpt index 371dc31e4f..d0ec350824 100644 --- a/ext/zip/tests/bug53579.phpt +++ b/ext/zip/tests/bug53579.phpt @@ -11,7 +11,7 @@ $file = $dirname . 'test_with_comment.zip'; include $dirname . 'utils.inc'; $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } $fp = $zip->getStream('foo'); diff --git a/ext/zip/tests/bug53603.phpt b/ext/zip/tests/bug53603.phpt index eb8b169f03..1d1703d590 100644 --- a/ext/zip/tests/bug53603.phpt +++ b/ext/zip/tests/bug53603.phpt @@ -8,11 +8,11 @@ if(!extension_loaded('zip')) die('skip'); <?php class TestStream { - function url_stat($path, $flags) { - if (!($flags & STREAM_URL_STAT_QUIET)) - trigger_error("not quiet"); - return array(); - } + function url_stat($path, $flags) { + if (!($flags & STREAM_URL_STAT_QUIET)) + trigger_error("not quiet"); + return array(); + } } stream_wrapper_register("teststream", "TestStream"); @@ -21,8 +21,8 @@ $dirname = __DIR__ . '/'; $file = $dirname . 'test_with_comment.zip'; $zip = new ZipArchive; if ($zip->open($file) !== TRUE) { - echo "open failed.\n"; - exit('failed'); + echo "open failed.\n"; + exit('failed'); } $a = $zip->extractTo('teststream://test'); diff --git a/ext/zip/tests/bug64342_0.phpt b/ext/zip/tests/bug64342_0.phpt index 96e9667dda..f9cde3afed 100644 --- a/ext/zip/tests/bug64342_0.phpt +++ b/ext/zip/tests/bug64342_0.phpt @@ -10,22 +10,22 @@ Bug #64342 ZipArchive::addFile() has to check file existence (variation 1) $zip = new ZipArchive; $res = $zip->open(__DIR__ . '/bug64342.zip', ZipArchive::CREATE); if ($res === TRUE) { - $f = md5(uniqid()) . '.txt'; - echo "$f\n"; - $res = $zip->addFile($f); - if (true == $res) { - echo "add ok\n"; - } else { - echo "add failed\n"; - } - $res = $zip->close(); - if (true == $res) { - echo "close ok\n"; - } else { - echo "close failed\n"; - } + $f = md5(uniqid()) . '.txt'; + echo "$f\n"; + $res = $zip->addFile($f); + if (true == $res) { + echo "add ok\n"; + } else { + echo "add failed\n"; + } + $res = $zip->close(); + if (true == $res) { + echo "close ok\n"; + } else { + echo "close failed\n"; + } } else { - echo "open failed\n"; + echo "open failed\n"; } diff --git a/ext/zip/tests/bug64342_1-mb.phpt b/ext/zip/tests/bug64342_1-mb.phpt index 6b14c7fb5d..4884c9fe5f 100644 --- a/ext/zip/tests/bug64342_1-mb.phpt +++ b/ext/zip/tests/bug64342_1-mb.phpt @@ -15,25 +15,25 @@ copy($dirname . 'test.zip', $file); $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } if (!$zip->addFile($dirname . 'cant_find_me.txt', 'test.php')) { - echo "failed\n"; + echo "failed\n"; } if ($zip->status == ZIPARCHIVE::ER_OK) { - if (!verify_entries($zip, [ - "bar", - "foobar/", - "foobar/baz", - "entry1.txt" - ])) { - echo "failed\n"; - } else { - echo "OK"; - } - $zip->close(); + if (!verify_entries($zip, [ + "bar", + "foobar/", + "foobar/baz", + "entry1.txt" + ])) { + echo "failed\n"; + } else { + echo "OK"; + } + $zip->close(); } else { - echo "failed\n"; + echo "failed\n"; } @unlink($file); ?> diff --git a/ext/zip/tests/bug64342_1.phpt b/ext/zip/tests/bug64342_1.phpt index 13d8a6d388..6b923d3ef1 100644 --- a/ext/zip/tests/bug64342_1.phpt +++ b/ext/zip/tests/bug64342_1.phpt @@ -15,25 +15,25 @@ copy($dirname . 'test.zip', $file); $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } if (!$zip->addFile($dirname . 'cant_find_me.txt', 'test.php')) { - echo "failed\n"; + echo "failed\n"; } if ($zip->status == ZIPARCHIVE::ER_OK) { - if (!verify_entries($zip, [ - "bar", - "foobar/", - "foobar/baz", - "entry1.txt" - ])) { - echo "failed\n"; - } else { - echo "OK"; - } - $zip->close(); + if (!verify_entries($zip, [ + "bar", + "foobar/", + "foobar/baz", + "entry1.txt" + ])) { + echo "failed\n"; + } else { + echo "OK"; + } + $zip->close(); } else { - echo "failed\n"; + echo "failed\n"; } @unlink($file); ?> diff --git a/ext/zip/tests/bug7214.phpt b/ext/zip/tests/bug7214.phpt index d36f0f4b42..b36bb2759f 100644 --- a/ext/zip/tests/bug7214.phpt +++ b/ext/zip/tests/bug7214.phpt @@ -12,9 +12,9 @@ $entries = 0; $entry = zip_read($zip); $contents = zip_entry_read($entry, zip_entry_filesize($entry)); if (strlen($contents) == zip_entry_filesize($entry)) { - echo "Ok"; + echo "Ok"; } else { - echo "failed"; + echo "failed"; } ?> diff --git a/ext/zip/tests/bug72258.phpt b/ext/zip/tests/bug72258.phpt index 208a810c33..4612cc26f0 100644 --- a/ext/zip/tests/bug72258.phpt +++ b/ext/zip/tests/bug72258.phpt @@ -12,13 +12,13 @@ $fn = __DIR__ . DIRECTORY_SEPARATOR . "bug72258.zip"; $zip = new \ZipArchive(); $res = $zip->open($fn); if ($res !== true) { - echo 'Error opening: ' . $res; - die(); + echo 'Error opening: ' . $res; + die(); } for ($i = 0; $i < $zip->numFiles; $i++) { - $fnInArc = $zip->getNameIndex($i, ZipArchive::FL_ENC_RAW); - var_dump($fnInArc); + $fnInArc = $zip->getNameIndex($i, ZipArchive::FL_ENC_RAW); + var_dump($fnInArc); } ?> --EXPECT-- diff --git a/ext/zip/tests/bug76524.phpt b/ext/zip/tests/bug76524.phpt index e087015c3c..5fd66c1535 100644 --- a/ext/zip/tests/bug76524.phpt +++ b/ext/zip/tests/bug76524.phpt @@ -9,7 +9,7 @@ if(!extension_loaded('zip')) die('skip'); $i = 0; do { - $filename = __DIR__ . "/nonexistent" . ($i++) . ".zip"; + $filename = __DIR__ . "/nonexistent" . ($i++) . ".zip"; } while (file_exists($filename)); $zip = new ZipArchive(); diff --git a/ext/zip/tests/bug7658.phpt b/ext/zip/tests/bug7658.phpt index 9253b01c3f..e2a70aac14 100644 --- a/ext/zip/tests/bug7658.phpt +++ b/ext/zip/tests/bug7658.phpt @@ -7,21 +7,21 @@ if(!extension_loaded('zip')) die('skip'); --FILE-- <?php $expect = array( - "mimetype", - "Configurations2/statusbar/", - "Configurations2/accelerator/current.xml", - "Configurations2/floater/", - "Configurations2/popupmenu/", - "Configurations2/progressbar/", - "Configurations2/menubar/", - "Configurations2/toolbar/", - "Configurations2/images/Bitmaps/", - "content.xml", - "styles.xml", - "meta.xml", - "Thumbnails/thumbnail.png", - "settings.xml", - "META-INF/manifest.xml", + "mimetype", + "Configurations2/statusbar/", + "Configurations2/accelerator/current.xml", + "Configurations2/floater/", + "Configurations2/popupmenu/", + "Configurations2/progressbar/", + "Configurations2/menubar/", + "Configurations2/toolbar/", + "Configurations2/images/Bitmaps/", + "content.xml", + "styles.xml", + "meta.xml", + "Thumbnails/thumbnail.png", + "settings.xml", + "META-INF/manifest.xml", ); $dirname = __DIR__ . '/'; include $dirname . 'utils.inc'; @@ -29,7 +29,7 @@ $file = $dirname . '__tmp_bug7658.odt'; $zip = new ZipArchive(); copy($dirname . 'bug7658.odt', $file); if(!$zip->open($file)) { - echo 'failed'; + echo 'failed'; } @@ -40,8 +40,8 @@ echo "\n"; $zip->open($file); for($i=0; $i < $zip->numFiles; $i++) { - $sb = $zip->statIndex($i); - $found[] = $sb['name']; + $sb = $zip->statIndex($i); + $found[] = $sb['name']; } $ar = array_diff($found, $expect); diff --git a/ext/zip/tests/bug8700.phpt b/ext/zip/tests/bug8700.phpt index 67bd265f9a..ad5d91b7c2 100644 --- a/ext/zip/tests/bug8700.phpt +++ b/ext/zip/tests/bug8700.phpt @@ -17,8 +17,8 @@ if ($zip->open($filename) === FALSE) { $contents_from_idx = $zip->getFromIndex(0); $contents_from_name = $zip->getFromName('1.txt'); if ($contents_from_idx != $contents_from_name) { - echo "failed:"; - var_dump($content_from_idx, $content_from_name); + echo "failed:"; + var_dump($content_from_idx, $content_from_name); } $zip->close(); diff --git a/ext/zip/tests/doubleclose.phpt b/ext/zip/tests/doubleclose.phpt index eb0ed7a829..905dc60f0c 100644 --- a/ext/zip/tests/doubleclose.phpt +++ b/ext/zip/tests/doubleclose.phpt @@ -10,7 +10,7 @@ if(!extension_loaded('zip')) die('skip'); echo "Procedural\n"; $zip = zip_open(__DIR__ . '/test.zip'); if (!is_resource($zip)) { - die("Failure"); + die("Failure"); } var_dump(zip_close($zip)); try { @@ -22,17 +22,17 @@ try { echo "Object\n"; $zip = new ZipArchive(); if (!$zip->open(__DIR__ . '/test.zip')) { - die('Failure'); + die('Failure'); } if ($zip->status == ZIPARCHIVE::ER_OK) { - var_dump($zip->close()); - try { - $zip->close(); - } catch (ValueError $err) { - echo $err->getMessage(), PHP_EOL; - } + var_dump($zip->close()); + try { + $zip->close(); + } catch (ValueError $err) { + echo $err->getMessage(), PHP_EOL; + } } else { - die("Failure"); + die("Failure"); } ?> diff --git a/ext/zip/tests/oo_addemptydir.phpt b/ext/zip/tests/oo_addemptydir.phpt index 4ad424ce19..1a95662b15 100644 --- a/ext/zip/tests/oo_addemptydir.phpt +++ b/ext/zip/tests/oo_addemptydir.phpt @@ -15,25 +15,25 @@ copy($dirname . 'test.zip', $file); $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } $zip->addEmptyDir('emptydir'); if ($zip->status == ZIPARCHIVE::ER_OK) { - if (!verify_entries($zip, [ - "bar", - "foobar/", - "foobar/baz", - "entry1.txt", - "emptydir/" - ])) { - echo "failed\n"; - } else { - echo "OK"; - } - $zip->close(); + if (!verify_entries($zip, [ + "bar", + "foobar/", + "foobar/baz", + "entry1.txt", + "emptydir/" + ])) { + echo "failed\n"; + } else { + echo "OK"; + } + $zip->close(); } else { - echo "failed3\n"; + echo "failed3\n"; } @unlink($file); ?> diff --git a/ext/zip/tests/oo_addemptydir_error.phpt b/ext/zip/tests/oo_addemptydir_error.phpt index a1b083ca50..92c220066f 100644 --- a/ext/zip/tests/oo_addemptydir_error.phpt +++ b/ext/zip/tests/oo_addemptydir_error.phpt @@ -12,16 +12,16 @@ include __DIR__ . '/utils.inc'; $zip = new ZipArchive; if (!$zip->open(__DIR__ . '/test.zip', ZipArchive::RDONLY)) { - exit('failed'); + exit('failed'); } var_dump($zip->addEmptyDir('emptydir')); if ($zip->status == ZipArchive::ER_RDONLY) { - echo "OK\n"; + echo "OK\n"; } else if ($zip->status == ZipArchive::ER_OK) { - dump_entries_name($zip); + dump_entries_name($zip); } else { - echo "Lost\n"; + echo "Lost\n"; } $zip->close(); ?> diff --git a/ext/zip/tests/oo_addfile.phpt b/ext/zip/tests/oo_addfile.phpt index 254f2b7620..5dd99faa0b 100644 --- a/ext/zip/tests/oo_addfile.phpt +++ b/ext/zip/tests/oo_addfile.phpt @@ -15,26 +15,26 @@ copy($dirname . 'test.zip', $file); $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } if (!$zip->addFile($dirname . 'utils.inc', 'test.php')) { - echo "failed\n"; + echo "failed\n"; } if ($zip->status == ZIPARCHIVE::ER_OK) { - if (!verify_entries($zip, [ - "bar", - "foobar/", - "foobar/baz", - "entry1.txt", - "test.php" - ])) { - echo "failed\n"; - } else { - echo "OK"; - } - $zip->close(); + if (!verify_entries($zip, [ + "bar", + "foobar/", + "foobar/baz", + "entry1.txt", + "test.php" + ])) { + echo "failed\n"; + } else { + echo "OK"; + } + $zip->close(); } else { - echo "failed\n"; + echo "failed\n"; } @unlink($file); ?> diff --git a/ext/zip/tests/oo_cancel.phpt b/ext/zip/tests/oo_cancel.phpt index c8653ec52e..4c487072c0 100644 --- a/ext/zip/tests/oo_cancel.phpt +++ b/ext/zip/tests/oo_cancel.phpt @@ -17,12 +17,12 @@ $file = $dirname . '__tmp_oo_progress.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } var_dump($zip->registerCancelCallback(function () { - // Always cancel - return -1; + // Always cancel + return -1; })); var_dump($zip->addFromString(PHP_BINARY, 'entry #1')); diff --git a/ext/zip/tests/oo_close.phpt b/ext/zip/tests/oo_close.phpt index 60a7f364d1..962ce183e7 100644 --- a/ext/zip/tests/oo_close.phpt +++ b/ext/zip/tests/oo_close.phpt @@ -10,14 +10,14 @@ if(!extension_loaded('zip')) die('skip'); $dirname = __DIR__ . '/'; $zip = new ZipArchive; if (!$zip->open($dirname . 'test.zip')) { - exit('failed'); + exit('failed'); } if ($zip->status == ZIPARCHIVE::ER_OK) { - $zip->close(); - echo "ok\n"; + $zip->close(); + echo "ok\n"; } else { - echo "failed\n"; + echo "failed\n"; } ?> --EXPECT-- diff --git a/ext/zip/tests/oo_count.phpt b/ext/zip/tests/oo_count.phpt index a5771fa298..426d456a29 100644 --- a/ext/zip/tests/oo_count.phpt +++ b/ext/zip/tests/oo_count.phpt @@ -12,7 +12,7 @@ $file = $dirname . 'test.zip'; $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } var_dump($zip->numFiles, count($zip), $zip->numFiles == count($zip)); diff --git a/ext/zip/tests/oo_delete.phpt b/ext/zip/tests/oo_delete.phpt index 385b943893..033662be3e 100644 --- a/ext/zip/tests/oo_delete.phpt +++ b/ext/zip/tests/oo_delete.phpt @@ -9,50 +9,50 @@ if(!extension_loaded('zip')) die('skip'); $dirname = __DIR__ . '/'; $file = $dirname . 'oo_delete.zip'; if (file_exists($file)) { - unlink($file); + unlink($file); } $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('entry1.txt', 'entry #1'); $zip->addFromString('entry2.txt', 'entry #2'); $zip->addFromString('dir/entry2.txt', 'entry #2'); if ($zip->status == ZIPARCHIVE::ER_OK) { - $zip->close(); - echo "ok\n"; + $zip->close(); + echo "ok\n"; } else { - var_dump($zip); - echo "failed\n"; + var_dump($zip); + echo "failed\n"; } if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } if ($zip->deleteIndex(0)) { - echo "ok\n"; + echo "ok\n"; } if ($zip->deleteName('entry2.txt')) { - echo "ok\n"; + echo "ok\n"; } else { - echo "failed 3\n"; + echo "failed 3\n"; } if ($zip->deleteName('dir/entry2.txt')) { - echo "ok\n"; + echo "ok\n"; } else { - echo "failed 3\n"; + echo "failed 3\n"; } if (!$zip->deleteIndex(123)) { - echo "ok\n"; + echo "ok\n"; } else { - print_r($zip); - echo "failed\n"; + print_r($zip); + echo "failed\n"; } @@ -67,7 +67,7 @@ var_dump($sb); unset($zip); if (file_exists($file)) { - unlink($file); + unlink($file); } ?> --EXPECT-- diff --git a/ext/zip/tests/oo_ext_zip.phpt b/ext/zip/tests/oo_ext_zip.phpt index d35094daeb..70c595a03a 100644 --- a/ext/zip/tests/oo_ext_zip.phpt +++ b/ext/zip/tests/oo_ext_zip.phpt @@ -7,14 +7,14 @@ if(!extension_loaded('zip')) die('skip'); --FILE-- <?php class myZip extends ZipArchive { - private $test = 0; - public $testp = 1; - private $testarray = array(); + private $test = 0; + public $testp = 1; + private $testarray = array(); - public function __construct() { - $this->testarray[] = 1; - var_dump($this->testarray); - } + public function __construct() { + $this->testarray[] = 1; + var_dump($this->testarray); + } } $z = new myZip; diff --git a/ext/zip/tests/oo_extract.phpt b/ext/zip/tests/oo_extract.phpt index d2ae2b5a43..f654ea8c95 100644 --- a/ext/zip/tests/oo_extract.phpt +++ b/ext/zip/tests/oo_extract.phpt @@ -11,57 +11,57 @@ $file = $dirname . 'test_with_comment.zip'; include $dirname . 'utils.inc'; $zip = new ZipArchive; if ($zip->open($file) !== TRUE) { - echo "open failed.\n"; - exit('failed'); + echo "open failed.\n"; + exit('failed'); } $zip->extractTo($dirname . '__oo_extract_tmp'); if (!is_dir($dirname . '__oo_extract_tmp')) { - echo "failed. mkdir\n"; + echo "failed. mkdir\n"; } if (!is_dir($dirname .'__oo_extract_tmp/foobar')) { - echo "failed. mkdir foobar\n"; + echo "failed. mkdir foobar\n"; } if (!file_exists($dirname . '__oo_extract_tmp/foobar/baz')) { - echo "failed. extract foobar/baz\n"; + echo "failed. extract foobar/baz\n"; } else { - echo file_get_contents($dirname . '__oo_extract_tmp/foobar/baz') . "\n"; + echo file_get_contents($dirname . '__oo_extract_tmp/foobar/baz') . "\n"; } if (!file_exists($dirname . '__oo_extract_tmp/bar')) { - echo "failed. bar file\n"; + echo "failed. bar file\n"; } else { - echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; + echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; } if (!file_exists($dirname . '__oo_extract_tmp/foo')) { - echo "failed. foo file\n"; + echo "failed. foo file\n"; } else { - echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n"; + echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n"; } /* extract one file */ $zip->extractTo($dirname . '__oo_extract_tmp', 'bar'); if (!file_exists($dirname . '__oo_extract_tmp/bar')) { - echo "failed. extract bar file\n"; + echo "failed. extract bar file\n"; } else { - echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; + echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; } /* extract two files */ $zip->extractTo($dirname . '__oo_extract_tmp', array('bar','foo')); if (!file_exists($dirname . '__oo_extract_tmp/bar')) { - echo "failed. extract bar file\n"; + echo "failed. extract bar file\n"; } else { - echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; + echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; } if (!file_exists($dirname . '__oo_extract_tmp/foo')) { - echo "failed. extract foo file\n"; + echo "failed. extract foo file\n"; } else { - echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n"; + echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n"; } rmdir_rf($dirname . '__oo_extract_tmp'); diff --git a/ext/zip/tests/oo_getcomment.phpt b/ext/zip/tests/oo_getcomment.phpt index 333dfa96bb..6f54105cc8 100644 --- a/ext/zip/tests/oo_getcomment.phpt +++ b/ext/zip/tests/oo_getcomment.phpt @@ -11,7 +11,7 @@ $file = $dirname . 'test_with_comment.zip'; include $dirname . 'utils.inc'; $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } echo $zip->getArchiveComment() . "\n"; diff --git a/ext/zip/tests/oo_getnameindex.phpt b/ext/zip/tests/oo_getnameindex.phpt index 838a5a91b1..0ed563f447 100644 --- a/ext/zip/tests/oo_getnameindex.phpt +++ b/ext/zip/tests/oo_getnameindex.phpt @@ -14,7 +14,7 @@ $file = $dirname . 'oo_getnameindex.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('entry1.txt', 'entry #1'); @@ -22,12 +22,12 @@ $zip->addFromString('entry2.txt', 'entry #2'); $zip->addFromString('dir/entry2d.txt', 'entry #2'); if (!$zip->status == ZIPARCHIVE::ER_OK) { - echo "failed to write zip\n"; + echo "failed to write zip\n"; } $zip->close(); if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } diff --git a/ext/zip/tests/oo_namelocate.phpt b/ext/zip/tests/oo_namelocate.phpt index f6c837ac20..5b4c6dbf89 100644 --- a/ext/zip/tests/oo_namelocate.phpt +++ b/ext/zip/tests/oo_namelocate.phpt @@ -14,7 +14,7 @@ $file = $dirname . 'oo_namelocate.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('entry1.txt', 'entry #1'); @@ -22,12 +22,12 @@ $zip->addFromString('entry2.txt', 'entry #2'); $zip->addFromString('dir/entry2d.txt', 'entry #2'); if (!$zip->status == ZIPARCHIVE::ER_OK) { - echo "failed to write zip\n"; + echo "failed to write zip\n"; } $zip->close(); if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } diff --git a/ext/zip/tests/oo_open.phpt b/ext/zip/tests/oo_open.phpt index 10ebad9441..2dffdc0d88 100644 --- a/ext/zip/tests/oo_open.phpt +++ b/ext/zip/tests/oo_open.phpt @@ -11,16 +11,16 @@ $dirname = __DIR__ . '/'; $zip = new ZipArchive; $r = $zip->open($dirname . 'nofile'); if ($r !== TRUE) { - echo "ER_OPEN: ok\n"; + echo "ER_OPEN: ok\n"; } else { - echo "ER_OPEN: FAILED\n"; + echo "ER_OPEN: FAILED\n"; } $r = $zip->open($dirname . 'nofile', ZIPARCHIVE::CREATE); if (!$r) { - echo "create: failed\n"; + echo "create: failed\n"; } else { - echo "create: ok\n"; + echo "create: ok\n"; } @unlink($dirname . 'nofile'); @@ -28,13 +28,13 @@ $zip = new ZipArchive; $zip->open(''); if (!$zip->open($dirname . 'test.zip')) { - exit("failed 1\n"); + exit("failed 1\n"); } if ($zip->status == ZIPARCHIVE::ER_OK) { - echo "OK\n"; + echo "OK\n"; } else { - echo "failed\n"; + echo "failed\n"; } ?> --EXPECTF-- diff --git a/ext/zip/tests/oo_progress.phpt b/ext/zip/tests/oo_progress.phpt index 480510d862..c4641653ed 100644 --- a/ext/zip/tests/oo_progress.phpt +++ b/ext/zip/tests/oo_progress.phpt @@ -17,13 +17,13 @@ $file = $dirname . '__tmp_oo_progress.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } var_dump($zip->registerProgressCallback(0.5, function ($r) { - // Only check start/end as intermediate is not reliable - if ($r == 0.0) echo "start\n"; - if ($r == 1.0) echo "end\n"; + // Only check start/end as intermediate is not reliable + if ($r == 0.0) echo "start\n"; + if ($r == 1.0) echo "end\n"; })); var_dump($zip->addFromString('foo', 'entry #1')); diff --git a/ext/zip/tests/oo_properties.phpt b/ext/zip/tests/oo_properties.phpt index 108a85e29b..13482f3541 100644 --- a/ext/zip/tests/oo_properties.phpt +++ b/ext/zip/tests/oo_properties.phpt @@ -14,7 +14,7 @@ copy($dirname . 'test_with_comment.zip', $file); $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } printf("zip->status (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->status, empty($zip->status), isset($zip->status)); diff --git a/ext/zip/tests/oo_rename.phpt b/ext/zip/tests/oo_rename.phpt index cdac489084..9cd9341406 100644 --- a/ext/zip/tests/oo_rename.phpt +++ b/ext/zip/tests/oo_rename.phpt @@ -14,7 +14,7 @@ $file = $dirname . 'oo_rename.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('entry1.txt', 'entry #1'); @@ -22,42 +22,42 @@ $zip->addFromString('entry2.txt', 'entry #2'); $zip->addFromString('dir/entry2.txt', 'entry #2'); if (!$zip->status == ZIPARCHIVE::ER_OK) { - var_dump($zip); - echo "failed2\n"; + var_dump($zip); + echo "failed2\n"; } $zip->close(); if (!$zip->open($file)) { - exit('failed3'); + exit('failed3'); } if (!verify_entries($zip, [ - "entry1.txt", + "entry1.txt", "entry2.txt", "dir/entry2.txt" ])) { - exit("failed4"); + exit("failed4"); } else { - echo "OK\n"; + echo "OK\n"; } if (!$zip->renameIndex(0, 'ren_entry1.txt')) { - echo "failed index 0\n"; + echo "failed index 0\n"; } if (!$zip->renameName('dir/entry2.txt', 'dir3/ren_entry2.txt')) { - echo "failed name dir/entry2.txt\n"; + echo "failed name dir/entry2.txt\n"; } if (!verify_entries($zip, [ - "ren_entry1.txt", + "ren_entry1.txt", "entry2.txt", "dir3/ren_entry2.txt" ])) { - exit("failed5"); + exit("failed5"); } else { - echo "OK\n"; + echo "OK\n"; } $zip->close(); diff --git a/ext/zip/tests/oo_setcomment.phpt b/ext/zip/tests/oo_setcomment.phpt index a4e10bfce5..4518e68647 100644 --- a/ext/zip/tests/oo_setcomment.phpt +++ b/ext/zip/tests/oo_setcomment.phpt @@ -14,7 +14,7 @@ $file = $dirname . 'oo_setcomment.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('entry1.txt', 'entry #1'); @@ -34,13 +34,13 @@ var_dump($zip->setCommentIndex(4, 'entry5.txt')); var_dump($zip->setArchiveComment('archive')); if (!$zip->status == ZIPARCHIVE::ER_OK) { - echo "failed to write zip\n"; + echo "failed to write zip\n"; } $zip->close(); if (!$zip->open($file)) { - @unlink($file); - exit('failed'); + @unlink($file); + exit('failed'); } var_dump($zip->getCommentIndex(0)); diff --git a/ext/zip/tests/oo_setcomment_error.phpt b/ext/zip/tests/oo_setcomment_error.phpt index a4301154c8..78d8d3dc35 100644 --- a/ext/zip/tests/oo_setcomment_error.phpt +++ b/ext/zip/tests/oo_setcomment_error.phpt @@ -12,7 +12,7 @@ $file = __DIR__ . '/__tmp_oo_set_comment_error.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('entry1.txt', 'entry #1'); diff --git a/ext/zip/tests/oo_setcompression.phpt b/ext/zip/tests/oo_setcompression.phpt index 0cdcd791b8..b8519b6834 100644 --- a/ext/zip/tests/oo_setcompression.phpt +++ b/ext/zip/tests/oo_setcompression.phpt @@ -9,13 +9,13 @@ if (!extension_loaded('zip')) die('skip'); $tmpfile = __DIR__ . '/oo_setcompression.zip'; if (file_exists($tmpfile)) { - unlink($tmpfile); + unlink($tmpfile); } // generate the ZIP file $zip = new ZipArchive; if ($zip->open($tmpfile, ZipArchive::CREATE) !== TRUE) { - exit('failed'); + exit('failed'); } $txt = file_get_contents(__FILE__); $zip->addFromString('entry1.txt', $txt); @@ -35,18 +35,18 @@ var_dump($zip->setCompressionIndex(5, ZipArchive::CM_DEFLATE)); var_dump($zip->setCompressionIndex(6, ZipArchive::CM_DEFAULT)); if (!$zip->close()) { - exit('failed'); + exit('failed'); } // check the ZIP file $zip = zip_open($tmpfile); if (!is_resource($zip)) { - exit('failed'); + exit('failed'); } while ($e = zip_read($zip)) { - echo zip_entry_name($e) . ': ' . zip_entry_compressionmethod($e) . "\n"; + echo zip_entry_name($e) . ': ' . zip_entry_compressionmethod($e) . "\n"; } zip_close($zip); ?> diff --git a/ext/zip/tests/oo_setmtime.phpt b/ext/zip/tests/oo_setmtime.phpt index aa1ceb56bb..628f5ac8bb 100644 --- a/ext/zip/tests/oo_setmtime.phpt +++ b/ext/zip/tests/oo_setmtime.phpt @@ -18,7 +18,7 @@ $file = $dirname . '__tmp_oo_set_mtime.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('foo', 'entry #1'); @@ -42,13 +42,13 @@ $s = $zip->statIndex(1); // ONLY with 1.6.0 - var_dump($s['mtime'] == $t2); if (!$zip->status == ZIPARCHIVE::ER_OK) { - echo "failed to write zip\n"; + echo "failed to write zip\n"; } $zip->close(); if (!$zip->open($file)) { - @unlink($file); - exit('failed'); + @unlink($file); + exit('failed'); } echo "Get 1\n"; diff --git a/ext/zip/tests/oo_stream.phpt b/ext/zip/tests/oo_stream.phpt index 89a2711666..d5e58a49a0 100644 --- a/ext/zip/tests/oo_stream.phpt +++ b/ext/zip/tests/oo_stream.phpt @@ -11,7 +11,7 @@ $file = $dirname . 'test_with_comment.zip'; include $dirname . 'utils.inc'; $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } $fp = $zip->getStream('foo'); @@ -19,7 +19,7 @@ var_dump($fp); if(!$fp) exit("\n"); $contents = ''; while (!feof($fp)) { - $contents .= fread($fp, 255); + $contents .= fread($fp, 255); } fclose($fp); diff --git a/ext/zip/tests/pecl12414.phpt b/ext/zip/tests/pecl12414.phpt index 1b728c0ebc..738ed6dd10 100644 --- a/ext/zip/tests/pecl12414.phpt +++ b/ext/zip/tests/pecl12414.phpt @@ -12,24 +12,24 @@ $zipname = __DIR__ . "/pecl12414.zip"; $za = new ZipArchive(); $res =$za->open($zipname); if ($res === TRUE) { - $finfo=$za->statName($filename); - $file_size=$finfo['size']; + $finfo=$za->statName($filename); + $file_size=$finfo['size']; - if($file_size>0) { - $contents=$za->getFromName($filename); + if($file_size>0) { + $contents=$za->getFromName($filename); - echo "ZIP contents size: " . strlen($contents) . "\n"; - if(strlen($contents)!=$file_size) { - echo "zip_readfile recorded data does not match unpacked size: " . $zipname . " : " . $filename; - } - } else { - $contents=false; - echo "zip_readfile could not open stream from zero length file " . $zipname . " : " .$filename; - } + echo "ZIP contents size: " . strlen($contents) . "\n"; + if(strlen($contents)!=$file_size) { + echo "zip_readfile recorded data does not match unpacked size: " . $zipname . " : " . $filename; + } + } else { + $contents=false; + echo "zip_readfile could not open stream from zero length file " . $zipname . " : " .$filename; + } - $za->close(); + $za->close(); } else { - echo "zip_readfile could not read from " . $zipname . " : " . $filename; + echo "zip_readfile could not read from " . $zipname . " : " . $filename; } ?> diff --git a/ext/zip/tests/stream_meta_data.phpt b/ext/zip/tests/stream_meta_data.phpt index 26453af134..735a2e0d7b 100644 --- a/ext/zip/tests/stream_meta_data.phpt +++ b/ext/zip/tests/stream_meta_data.phpt @@ -11,7 +11,7 @@ $file = $dirname . 'test_with_comment.zip'; include $dirname . 'utils.inc'; $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } $fp = $zip->getStream('foo'); diff --git a/ext/zip/tests/utils.inc b/ext/zip/tests/utils.inc index f44ab3af32..6d5049e558 100644 --- a/ext/zip/tests/utils.inc +++ b/ext/zip/tests/utils.inc @@ -9,7 +9,7 @@ function verify_entries($zip, $entries = []) { if (!in_array($stat["name"], $entries)) { $verified = false; } - + $found[] = $stat["name"]; } @@ -22,17 +22,17 @@ function verify_entries($zip, $entries = []) { /* recursively remove a directoryy */ function rmdir_rf($dir) { - if ($handle = opendir($dir)) { - while (false !== ($item = readdir($handle))) { - if ($item != "." && $item != "..") { - if (is_dir($dir . '/' . $item)) { - rmdir_rf($dir . '/' . $item); - } else { - unlink($dir . '/' . $item); - } - } - } - closedir($handle); - rmdir($dir); - } + if ($handle = opendir($dir)) { + while (false !== ($item = readdir($handle))) { + if ($item != "." && $item != "..") { + if (is_dir($dir . '/' . $item)) { + rmdir_rf($dir . '/' . $item); + } else { + unlink($dir . '/' . $item); + } + } + } + closedir($handle); + rmdir($dir); + } } diff --git a/ext/zlib/tests/bug60761.phpt b/ext/zlib/tests/bug60761.phpt index 04763be504..37191c2739 100644 --- a/ext/zlib/tests/bug60761.phpt +++ b/ext/zlib/tests/bug60761.phpt @@ -19,14 +19,14 @@ $lens = array(); for ( $i=0 ; $i < 100 ; $i++ ) { - // can't use ob_gzhandler with zlib.output_compression - ob_start();//"ob_gzhandler"); - phpinfo(); - $html = ob_get_clean(); + // can't use ob_gzhandler with zlib.output_compression + ob_start();//"ob_gzhandler"); + phpinfo(); + $html = ob_get_clean(); - $len = strlen($html); + $len = strlen($html); - $lens[$len] = $len; + $lens[$len] = $len; } $lens = array_values($lens); diff --git a/ext/zlib/tests/bug67724.phpt b/ext/zlib/tests/bug67724.phpt index 1e5026f650..3edbb2ba2c 100644 --- a/ext/zlib/tests/bug67724.phpt +++ b/ext/zlib/tests/bug67724.phpt @@ -9,11 +9,11 @@ extension_loaded("zlib") or die("skip need ext/zlib"); echo "Test\n"; $f = fopen(__DIR__."/bug67724.gz.gz", "rb") - or die(current(error_get_last())); + or die(current(error_get_last())); stream_filter_append($f, "zlib.inflate", STREAM_FILTER_READ, ["window" => 30]); stream_filter_append($f, "zlib.inflate", STREAM_FILTER_READ, ["window" => 30]); for ($i = 0; !feof($f); $i += strlen(fread($f, 0x1000))) - ; + ; fclose($f); var_dump($i); diff --git a/ext/zlib/tests/bug71417.phpt b/ext/zlib/tests/bug71417.phpt index ae1390134e..cadd1e6735 100644 --- a/ext/zlib/tests/bug71417.phpt +++ b/ext/zlib/tests/bug71417.phpt @@ -6,10 +6,10 @@ Bug #71417: fread() does not detect decoding errors from filter zlib.inflate <?php function test($case) { - $plain = "The quick brown fox jumps over the lazy dog."; - $fn = "bug71417.gz"; - $compressed = (string) gzencode($plain); - + $plain = "The quick brown fox jumps over the lazy dog."; + $fn = "bug71417.gz"; + $compressed = (string) gzencode($plain); + if ($case == 1) { // 1. Set a random byte in the middle of the compressed data. // $ php test-zlib-inflate.php @@ -37,26 +37,26 @@ function test($case) { // 4. Corrupted final length. // $ php test-zlib-inflate.phpread: string(0) "" // read: string(44) "The quick brown fox jumps over the lazy dog." - // $ gunzip test-zlib-inflate.gz + // $ gunzip test-zlib-inflate.gz // gzip: test-zlib-inflate.gz: invalid compressed data--length error $compressed[strlen($compressed)-2] = 'X'; } - - // The gzdecode() function applied to the corrupted compressed data always - // detects the error: - // --> gzdecode(): PHP Fatal error: Uncaught ErrorException: gzdecode(): data error in ... - echo "gzdecode(): ", rawurldecode(gzdecode($compressed)), "\n"; - file_put_contents($fn, $compressed); - - $r = fopen($fn, "r"); - stream_filter_append($r, 'zlib.inflate', STREAM_FILTER_READ, array('window' => 15+16)); - while (!feof($r)) { - $s = fread($r, 100); - echo "read: "; var_dump($s); - } - fclose($r); - unlink($fn); + // The gzdecode() function applied to the corrupted compressed data always + // detects the error: + // --> gzdecode(): PHP Fatal error: Uncaught ErrorException: gzdecode(): data error in ... + echo "gzdecode(): ", rawurldecode(gzdecode($compressed)), "\n"; + + file_put_contents($fn, $compressed); + + $r = fopen($fn, "r"); + stream_filter_append($r, 'zlib.inflate', STREAM_FILTER_READ, array('window' => 15+16)); + while (!feof($r)) { + $s = fread($r, 100); + echo "read: "; var_dump($s); + } + fclose($r); + unlink($fn); } test(1); diff --git a/ext/zlib/tests/bug75273.phpt b/ext/zlib/tests/bug75273.phpt index 66ec81edff..f3309546bd 100644 --- a/ext/zlib/tests/bug75273.phpt +++ b/ext/zlib/tests/bug75273.phpt @@ -7,22 +7,22 @@ if (!extension_loaded('zlib')) die('skip zlib extension not available'); --FILE-- <?php function non_repeating_str($len = 8192) { - $ret = ''; - mt_srand(1); - $iterations = (int) ($len / 256) + 1; - for ($i = 0; $i < $iterations; $i++) { - $haves = array(); - $cnt = 0; - while ($cnt < 256) { - $j = mt_rand(0, 255); - if (!isset($haves[$j])) { - $haves[$j] = $j; - $cnt++; - $ret .= chr($j); - } - } - } - return substr($ret, 0, $len); + $ret = ''; + mt_srand(1); + $iterations = (int) ($len / 256) + 1; + for ($i = 0; $i < $iterations; $i++) { + $haves = array(); + $cnt = 0; + while ($cnt < 256) { + $j = mt_rand(0, 255); + if (!isset($haves[$j])) { + $haves[$j] = $j; + $cnt++; + $ret .= chr($j); + } + } + } + return substr($ret, 0, $len); } $base_len = 32768 - 23 /*overhead*/; @@ -30,25 +30,25 @@ $base_len = 32768 - 23 /*overhead*/; $stream = fopen('php://memory', 'rb+'); for ($i = 1; $i <= 8; $i++) { - $in_data = non_repeating_str($base_len + $i); + $in_data = non_repeating_str($base_len + $i); - $deflate_filter = stream_filter_append($stream, 'zlib.deflate', STREAM_FILTER_WRITE, ['window' => 16 + 15]); - rewind($stream); - fwrite($stream, $in_data); - stream_filter_remove($deflate_filter); + $deflate_filter = stream_filter_append($stream, 'zlib.deflate', STREAM_FILTER_WRITE, ['window' => 16 + 15]); + rewind($stream); + fwrite($stream, $in_data); + stream_filter_remove($deflate_filter); - rewind($stream); - $out_data = stream_get_contents($stream); - $out_data_len = strlen($out_data); + rewind($stream); + $out_data = stream_get_contents($stream); + $out_data_len = strlen($out_data); - $inflate_filter = stream_filter_prepend($stream, 'zlib.inflate', STREAM_FILTER_WRITE, ['window' => 16 + 15]); - rewind($stream); - $fwrite_len = fwrite($stream, $out_data); - stream_filter_remove($inflate_filter); + $inflate_filter = stream_filter_prepend($stream, 'zlib.inflate', STREAM_FILTER_WRITE, ['window' => 16 + 15]); + rewind($stream); + $fwrite_len = fwrite($stream, $out_data); + stream_filter_remove($inflate_filter); - if ($out_data_len !== $fwrite_len) { - echo "bug i=$i out_data_len=$out_data_len fwrite_len=$fwrite_len\n"; - } + if ($out_data_len !== $fwrite_len) { + echo "bug i=$i out_data_len=$out_data_len fwrite_len=$fwrite_len\n"; + } } fclose($stream); diff --git a/ext/zlib/tests/bug_34821.phpt b/ext/zlib/tests/bug_34821.phpt index 53ef4d229e..8095bab23a 100644 --- a/ext/zlib/tests/bug_34821.phpt +++ b/ext/zlib/tests/bug_34821.phpt @@ -7,10 +7,10 @@ Bug #34821 (zlib encoders fail on widely varying binary data) // test 50 bytes to 50k $b = array( - 50, - 500, - 5000, - 50000, + 50, + 500, + 5000, + 50000, // 1000000, // works, but test would take too long ); @@ -18,12 +18,12 @@ $s = ''; $i = 0; foreach ($b as $size) { - do { - $s .= chr(rand(0,255)); - } while (++$i < $size); - var_dump($s === gzinflate(gzdeflate($s))); - var_dump($s === gzuncompress(gzcompress($s))); - var_dump($s === gzinflate(substr(gzencode($s), 10, -8))); + do { + $s .= chr(rand(0,255)); + } while (++$i < $size); + var_dump($s === gzinflate(gzdeflate($s))); + var_dump($s === gzuncompress(gzcompress($s))); + var_dump($s === gzinflate(substr(gzencode($s), 10, -8))); } ?> --EXPECT-- diff --git a/ext/zlib/tests/func.inc b/ext/zlib/tests/func.inc index 7556f81e6a..73cfc4e06f 100644 --- a/ext/zlib/tests/func.inc +++ b/ext/zlib/tests/func.inc @@ -2,17 +2,17 @@ function get_zlib_version() { - $version = NULL; + $version = NULL; - ob_start(); - phpinfo(); - $info = ob_get_contents(); - ob_end_clean(); - //if (preg_match(',zlib.*Compiled Version => (\d+\.\d+\.\d+),s', $info, $match)) { - // $version = $match[1]; - if (preg_match(',zlib(?!.*libXML).*Compiled Version (=> |</).*(\d+\.\d+\.\d+?),sU', $info, $match)) { - $version = $match[2]; - } + ob_start(); + phpinfo(); + $info = ob_get_contents(); + ob_end_clean(); + //if (preg_match(',zlib.*Compiled Version => (\d+\.\d+\.\d+),s', $info, $match)) { + // $version = $match[1]; + if (preg_match(',zlib(?!.*libXML).*Compiled Version (=> |</).*(\d+\.\d+\.\d+?),sU', $info, $match)) { + $version = $match[2]; + } - return $version; + return $version; } diff --git a/ext/zlib/tests/gzcompress_basic1.phpt b/ext/zlib/tests/gzcompress_basic1.phpt index a46d0773cf..66231a3f98 100644 --- a/ext/zlib/tests/gzcompress_basic1.phpt +++ b/ext/zlib/tests/gzcompress_basic1.phpt @@ -34,7 +34,7 @@ for($i = -1; $i < 10; $i++) { echo "-- Compression level $i --\n"; $output = gzcompress($data, $i); var_dump(md5($output)); - var_dump(strcmp(gzuncompress($output), $data)); + var_dump(strcmp(gzuncompress($output), $data)); } // Compressing a smaller string @@ -42,7 +42,7 @@ for($i = -1; $i < 10; $i++) { echo "-- Compression level $i --\n"; $output = gzcompress($smallstring, $i); var_dump(bin2hex($output)); - var_dump(strcmp(gzuncompress($output), $smallstring)); + var_dump(strcmp(gzuncompress($output), $smallstring)); } // Calling gzcompress() with mandatory arguments diff --git a/ext/zlib/tests/gzdeflate_basic1.phpt b/ext/zlib/tests/gzdeflate_basic1.phpt index 2bca4e704c..004637902e 100644 --- a/ext/zlib/tests/gzdeflate_basic1.phpt +++ b/ext/zlib/tests/gzdeflate_basic1.phpt @@ -34,7 +34,7 @@ for($i = -1; $i < 10; $i++) { echo "-- Compression level $i --\n"; $output = gzdeflate($data, $i); var_dump(md5($output)); - var_dump(strcmp(gzinflate($output), $data)); + var_dump(strcmp(gzinflate($output), $data)); } // Compressing a smaller string @@ -42,7 +42,7 @@ for($i = -1; $i < 10; $i++) { echo "-- Compression level $i --\n"; $output = gzdeflate($smallstring, $i); var_dump(bin2hex($output)); - var_dump(strcmp(gzinflate($output), $smallstring)); + var_dump(strcmp(gzinflate($output), $smallstring)); } // Calling gzdeflate() with just mandatory arguments diff --git a/ext/zlib/tests/gzencode_basic1.phpt b/ext/zlib/tests/gzencode_basic1.phpt index 8e6732aa7f..bd23ad77e2 100644 --- a/ext/zlib/tests/gzencode_basic1.phpt +++ b/ext/zlib/tests/gzencode_basic1.phpt @@ -35,7 +35,7 @@ for($i = -1; $i < 10; $i++) { $output = gzencode($data, $i); // Clear OS byte before encode - $output[9] = "\x00"; + $output[9] = "\x00"; var_dump(md5($output)); } @@ -46,7 +46,7 @@ for($i = -1; $i < 10; $i++) { $output = gzencode($smallstring, $i); // Clear OS byte before encode - $output[9] = "\x00"; + $output[9] = "\x00"; var_dump(md5($output)); } diff --git a/ext/zlib/tests/gzencode_variation1-win32.phpt b/ext/zlib/tests/gzencode_variation1-win32.phpt index c8345f06c0..140ac6286b 100644 --- a/ext/zlib/tests/gzencode_variation1-win32.phpt +++ b/ext/zlib/tests/gzencode_variation1-win32.phpt @@ -20,10 +20,10 @@ if (!extension_loaded("zlib")) { */ if(!function_exists("gzdecode")) { - function gzdecode($data) - { - return gzinflate(substr($data,10,-8)); - } + function gzdecode($data) + { + return gzinflate(substr($data,10,-8)); + } } diff --git a/ext/zlib/tests/gzgetc_basic_1.phpt b/ext/zlib/tests/gzgetc_basic_1.phpt index 431746f65b..b2a1a056af 100644 --- a/ext/zlib/tests/gzgetc_basic_1.phpt +++ b/ext/zlib/tests/gzgetc_basic_1.phpt @@ -19,14 +19,14 @@ if (version_compare(get_zlib_version(), '1.2.7') < 0) { $f = __DIR__."/004.txt.gz"; $h = gzopen($f, 'r'); if ($h) { - $count = 0; - while (($c = fgetc( $h )) !== false) { - $count++; - echo $c; - } + $count = 0; + while (($c = fgetc( $h )) !== false) { + $count++; + echo $c; + } - echo "\ncharacters counted=$count\n"; - gzclose($h); + echo "\ncharacters counted=$count\n"; + gzclose($h); } ?> diff --git a/ext/zlib/tests/gzopen_include_path.inc b/ext/zlib/tests/gzopen_include_path.inc index add04f74de..ca3da43489 100644 --- a/ext/zlib/tests/gzopen_include_path.inc +++ b/ext/zlib/tests/gzopen_include_path.inc @@ -11,82 +11,82 @@ $newdirs = array($dir1, $dir2, $dir3); $reldirs = array("dir1", "dir2", "dir3"); function generate_next_rel_path() { - global $reldirs; - //create the include directory structure - $pathSep = ":"; - $newIncludePath = ""; - if(substr(PHP_OS, 0, 3) == 'WIN' ) { - $pathSep = ";"; - } - foreach($reldirs as $newdir) { - $newIncludePath .= $newdir.$pathSep; - } - return "dir4".$pathSep . $newIncludePath; + global $reldirs; + //create the include directory structure + $pathSep = ":"; + $newIncludePath = ""; + if(substr(PHP_OS, 0, 3) == 'WIN' ) { + $pathSep = ";"; + } + foreach($reldirs as $newdir) { + $newIncludePath .= $newdir.$pathSep; + } + return "dir4".$pathSep . $newIncludePath; } function generate_next_path() { - global $newdirs, $dir4; - //create the include directory structure - $pathSep = ":"; - $newIncludePath = ""; - if(substr(PHP_OS, 0, 3) == 'WIN' ) { - $pathSep = ";"; - } - foreach($newdirs as $newdir) { - $newIncludePath .= $newdir.$pathSep; - } - return $dir4.$pathSep . $newIncludePath; + global $newdirs, $dir4; + //create the include directory structure + $pathSep = ":"; + $newIncludePath = ""; + if(substr(PHP_OS, 0, 3) == 'WIN' ) { + $pathSep = ";"; + } + foreach($newdirs as $newdir) { + $newIncludePath .= $newdir.$pathSep; + } + return $dir4.$pathSep . $newIncludePath; } function create_include_path() { - global $newdirs; - //create the include directory structure - $pathSep = ":"; - $newIncludePath = ""; - if(substr(PHP_OS, 0, 3) == 'WIN' ) { - $pathSep = ";"; - } - foreach($newdirs as $newdir) { - mkdir($newdir); - $newIncludePath .= $newdir.$pathSep; - } - return $newIncludePath; + global $newdirs; + //create the include directory structure + $pathSep = ":"; + $newIncludePath = ""; + if(substr(PHP_OS, 0, 3) == 'WIN' ) { + $pathSep = ";"; + } + foreach($newdirs as $newdir) { + mkdir($newdir); + $newIncludePath .= $newdir.$pathSep; + } + return $newIncludePath; } function relative_include_path() { - global $reldirs; - //create the include directory structure - $pathSep = ":"; - $newIncludePath = ""; - if(substr(PHP_OS, 0, 3) == 'WIN' ) { - $pathSep = ";"; - } - foreach($reldirs as $newdir) { - mkdir($newdir); - $newIncludePath .= $newdir.$pathSep; - } - return $newIncludePath; + global $reldirs; + //create the include directory structure + $pathSep = ":"; + $newIncludePath = ""; + if(substr(PHP_OS, 0, 3) == 'WIN' ) { + $pathSep = ";"; + } + foreach($reldirs as $newdir) { + mkdir($newdir); + $newIncludePath .= $newdir.$pathSep; + } + return $newIncludePath; } function teardown_include_path() { - global $newdirs; - // remove the directory structure - foreach($newdirs as $newdir) { - rmdir($newdir); - } + global $newdirs; + // remove the directory structure + foreach($newdirs as $newdir) { + rmdir($newdir); + } } function teardown_relative_path() { - global $reldirs; - // remove the directory structure - foreach($reldirs as $newdir) { - rmdir($newdir); - } + global $reldirs; + // remove the directory structure + foreach($reldirs as $newdir) { + rmdir($newdir); + } } ?> diff --git a/ext/zlib/tests/gzopen_variation5.phpt b/ext/zlib/tests/gzopen_variation5.phpt index 825c427007..661ffe8759 100644 --- a/ext/zlib/tests/gzopen_variation5.phpt +++ b/ext/zlib/tests/gzopen_variation5.phpt @@ -33,31 +33,31 @@ chdir(".."); rmdir($thisTestDir); function runtest() { - $tmpfile = 'gzopen_variation5.tmp'; - $h = gzopen($tmpfile, "w", true); - fwrite($h, "This is the test file"); - fclose($h); + $tmpfile = 'gzopen_variation5.tmp'; + $h = gzopen($tmpfile, "w", true); + fwrite($h, "This is the test file"); + fclose($h); - $h = @gzopen($tmpfile, "r"); - if ($h === false) { - echo "Not created in working dir\n"; - } - else { - echo "created in working dir\n"; - gzclose($h); - unlink($tmpfile); - } + $h = @gzopen($tmpfile, "r"); + if ($h === false) { + echo "Not created in working dir\n"; + } + else { + echo "created in working dir\n"; + gzclose($h); + unlink($tmpfile); + } - $h = @gzopen('dir1/'.$tmpfile, "r"); - if ($h === false) { - echo "Not created in dir1\n"; - } - else { - echo "created in dir1\n"; - gzclose($h); - unlink('dir1/'.$tmpfile); - } + $h = @gzopen('dir1/'.$tmpfile, "r"); + if ($h === false) { + echo "Not created in dir1\n"; + } + else { + echo "created in dir1\n"; + gzclose($h); + unlink('dir1/'.$tmpfile); + } } ?> --EXPECT-- diff --git a/ext/zlib/tests/gzreadgzwrite.phpt b/ext/zlib/tests/gzreadgzwrite.phpt index 87b55e673f..f2f2370f36 100644 --- a/ext/zlib/tests/gzreadgzwrite.phpt +++ b/ext/zlib/tests/gzreadgzwrite.phpt @@ -18,14 +18,14 @@ $fp = gzopen($filename, "rb"); $data = ''; while ($buf = gzread($fp, 8092)) { - $data .= $buf; + $data .= $buf; } if ($data == $original) { - echo "Strings are equal\n"; + echo "Strings are equal\n"; } else { - echo "Strings are not equal\n"; - var_dump($data); + echo "Strings are not equal\n"; + var_dump($data); } gzclose($fp); unlink($filename); diff --git a/ext/zlib/tests/gzreadgzwriteplain.phpt b/ext/zlib/tests/gzreadgzwriteplain.phpt index 0d73f022aa..8898cebb93 100644 --- a/ext/zlib/tests/gzreadgzwriteplain.phpt +++ b/ext/zlib/tests/gzreadgzwriteplain.phpt @@ -18,29 +18,29 @@ $fp = gzopen($filename, "rb"); $data = ''; while ($buf = gzread($fp, 8192)) { - $data .= $buf; + $data .= $buf; } if ($data == $original) { - echo "Strings are equal\n"; + echo "Strings are equal\n"; } else { - echo "Strings are not equal\n"; - var_dump($data); + echo "Strings are not equal\n"; + var_dump($data); } gzseek($fp, strlen($original) / 2); $data = ''; while ($buf = gzread($fp, 8192)) { - $data .= $buf; + $data .= $buf; } var_dump(strlen($data)); if ($data == substr($original, strlen($original) / 2)) { - echo "Strings are equal\n"; + echo "Strings are equal\n"; } else { - echo "Strings are not equal\n"; - var_dump($data); + echo "Strings are not equal\n"; + var_dump($data); } gzclose($fp); diff --git a/ext/zlib/tests/ob_gzhandler_legacy_002.phpt b/ext/zlib/tests/ob_gzhandler_legacy_002.phpt index 217a0d2e35..5e940b6187 100644 --- a/ext/zlib/tests/ob_gzhandler_legacy_002.phpt +++ b/ext/zlib/tests/ob_gzhandler_legacy_002.phpt @@ -14,8 +14,8 @@ dummy=42 --FILE-- <?php if (false !== ob_gzhandler("", PHP_OUTPUT_HANDLER_START)) { - ini_set("zlib.output_compression", 0); - ob_start("ob_gzhandler"); + ini_set("zlib.output_compression", 0); + ob_start("ob_gzhandler"); } echo "hi\n"; ?> diff --git a/sapi/cgi/tests/003.phpt b/sapi/cgi/tests/003.phpt index 4b4d29267d..00c59c7278 100644 --- a/sapi/cgi/tests/003.phpt +++ b/sapi/cgi/tests/003.phpt @@ -23,12 +23,12 @@ $code =' /* some test script */ class test { /* {{{ */ - public $var = "test"; //test var -#perl style comment - private $pri; /* private attr */ + public $var = "test"; //test var +#perl style comment + private $pri; /* private attr */ - function foo(/* void */) { - } + function foo(/* void */) { + } } /* }}} */ diff --git a/sapi/cgi/tests/004.phpt b/sapi/cgi/tests/004.phpt index b46dce7052..1de856e346 100644 --- a/sapi/cgi/tests/004.phpt +++ b/sapi/cgi/tests/004.phpt @@ -17,7 +17,7 @@ $code =' <?php class test { - private $pri; + private $pri; } var_dump(test::$pri); @@ -27,9 +27,9 @@ var_dump(test::$pri); file_put_contents($filename, $code); if (defined("PHP_WINDOWS_VERSION_MAJOR")) { - var_dump(`$php -n -f "$filename"`); + var_dump(`$php -n -f "$filename"`); } else { - var_dump(`$php -n -f "$filename" 2>/dev/null`); + var_dump(`$php -n -f "$filename" 2>/dev/null`); } var_dump(`$php -n -f "wrong"`); diff --git a/sapi/cgi/tests/006.phpt b/sapi/cgi/tests/006.phpt index c78229880c..479d4a9441 100644 --- a/sapi/cgi/tests/006.phpt +++ b/sapi/cgi/tests/006.phpt @@ -19,7 +19,7 @@ $code = ' $test = "var"; class test { - private $var; + private $var; } echo test::$var; @@ -35,8 +35,8 @@ var_dump(`"$php" -n -l some.unknown`); $code = ' <?php -class test - private $var; +class test + private $var; } ?> @@ -45,9 +45,9 @@ class test file_put_contents($filename, $code); if (defined("PHP_WINDOWS_VERSION_MAJOR")) { - var_dump(`"$php" -n -l "$filename"`); + var_dump(`"$php" -n -l "$filename"`); } else { - var_dump(`"$php" -n -l "$filename" 2>/dev/null`); + var_dump(`"$php" -n -l "$filename" 2>/dev/null`); } @unlink($filename); diff --git a/sapi/cgi/tests/008.phpt b/sapi/cgi/tests/008.phpt index be2fd578e7..05d9d8c190 100644 --- a/sapi/cgi/tests/008.phpt +++ b/sapi/cgi/tests/008.phpt @@ -16,12 +16,12 @@ $code = ' $test = "var"; //var /* test class */ class test { - private $var = array(); + private $var = array(); - public static function foo(Test $arg) { - echo "hello"; - var_dump($this); - } + public static function foo(Test $arg) { + echo "hello"; + var_dump($this); + } } $o = new test; diff --git a/sapi/cgi/tests/011.phpt b/sapi/cgi/tests/011.phpt index 6d4a6ed7f9..263c2e61ef 100644 --- a/sapi/cgi/tests/011.phpt +++ b/sapi/cgi/tests/011.phpt @@ -13,13 +13,13 @@ reset_env_vars(); $f = tempnam(sys_get_temp_dir(), 'cgitest'); function test($script) { - file_put_contents($GLOBALS['f'], $script); - $cmd = escapeshellcmd($GLOBALS['php']); - $cmd .= ' -n -dreport_zend_debug=0 -dhtml_errors=0 ' . escapeshellarg($GLOBALS['f']); - echo "----------\n"; - echo rtrim($script) . "\n"; - echo "----------\n"; - passthru($cmd); + file_put_contents($GLOBALS['f'], $script); + $cmd = escapeshellcmd($GLOBALS['php']); + $cmd .= ' -n -dreport_zend_debug=0 -dhtml_errors=0 ' . escapeshellarg($GLOBALS['f']); + echo "----------\n"; + echo rtrim($script) . "\n"; + echo "----------\n"; + passthru($cmd); } test('<?php ?>'); diff --git a/sapi/cgi/tests/apache_request_headers.phpt b/sapi/cgi/tests/apache_request_headers.phpt index bda9ef8b70..647508a64a 100644 --- a/sapi/cgi/tests/apache_request_headers.phpt +++ b/sapi/cgi/tests/apache_request_headers.phpt @@ -21,9 +21,9 @@ passthru("$php -n $file"); $names = array('HTTP_X_TEST', 'HTTP_X__TEST', 'HTTP_X_'); foreach ($names as $name) { - putenv($name."=".str_repeat("A", 256)); - passthru("$php -n -q $file"); - putenv($name); + putenv($name."=".str_repeat("A", 256)); + passthru("$php -n -q $file"); + putenv($name); } unlink($file); diff --git a/sapi/cgi/tests/include.inc b/sapi/cgi/tests/include.inc index 61b339e49f..cd9236f116 100644 --- a/sapi/cgi/tests/include.inc +++ b/sapi/cgi/tests/include.inc @@ -2,64 +2,64 @@ function get_cgi_path() /* {{{ */ { - $php = getenv("TEST_PHP_EXECUTABLE"); + $php = getenv("TEST_PHP_EXECUTABLE"); - $cli = false; - $cgi = false; + $cli = false; + $cgi = false; - if (file_exists($php) && is_executable($php)) { - $version = `$php -n -v`; - if (strstr($version, "(cli)")) { - /* that's cli */ - $cli = true; - } else if (strpos($version, "(cgi")) { - /* that's cgi */ - return $php; - } - } + if (file_exists($php) && is_executable($php)) { + $version = `$php -n -v`; + if (strstr($version, "(cli)")) { + /* that's cli */ + $cli = true; + } else if (strpos($version, "(cgi")) { + /* that's cgi */ + return $php; + } + } - if ($cli) { - /* trying to guess ... */ - $php_path = $php; - if (defined("PHP_WINDOWS_VERSION_MAJOR")) { - /* On Windows it should be in the same dir as php.exe in most of the cases. */ - $php_path = dirname($php); + if ($cli) { + /* trying to guess ... */ + $php_path = $php; + if (defined("PHP_WINDOWS_VERSION_MAJOR")) { + /* On Windows it should be in the same dir as php.exe in most of the cases. */ + $php_path = dirname($php); - if (is_dir($php_path) && file_exists("$php_path/php-cgi.exe") && is_executable("$php_path/php-cgi.exe")) { - return "$php_path/php-cgi.exe"; - } - } else { - for ($i = 0; $i < 2; $i++) { - $slash_pos = strrpos($php_path, "/"); - if ($slash_pos) { - $php_path = substr($php_path, 0, $slash_pos); - } else { - return FALSE; - } - } + if (is_dir($php_path) && file_exists("$php_path/php-cgi.exe") && is_executable("$php_path/php-cgi.exe")) { + return "$php_path/php-cgi.exe"; + } + } else { + for ($i = 0; $i < 2; $i++) { + $slash_pos = strrpos($php_path, "/"); + if ($slash_pos) { + $php_path = substr($php_path, 0, $slash_pos); + } else { + return FALSE; + } + } - if ($php_path && is_dir($php_path) && file_exists($php_path."/cgi/php-cgi") && is_executable($php_path."/cgi/php-cgi")) { - /* gotcha */ - return $php_path."/cgi/php-cgi"; - } - } - return false; - } - /* uhm? what's that then? */ - return false; + if ($php_path && is_dir($php_path) && file_exists($php_path."/cgi/php-cgi") && is_executable($php_path."/cgi/php-cgi")) { + /* gotcha */ + return $php_path."/cgi/php-cgi"; + } + } + return false; + } + /* uhm? what's that then? */ + return false; } /* }}} */ function reset_env_vars() /* {{{ */ { - putenv("REDIRECT_STATUS"); - putenv("QUERY_STRING"); - putenv("PATH_TRANSLATED"); - putenv("SCRIPT_FILENAME"); - putenv("SERVER_SOFTWARE"); - putenv("SERVER_NAME"); - putenv("GATEWAY_INTERFACE"); - putenv("REQUEST_METHOD"); + putenv("REDIRECT_STATUS"); + putenv("QUERY_STRING"); + putenv("PATH_TRANSLATED"); + putenv("SCRIPT_FILENAME"); + putenv("SERVER_SOFTWARE"); + putenv("SERVER_NAME"); + putenv("GATEWAY_INTERFACE"); + putenv("REQUEST_METHOD"); } /* }}} */ diff --git a/sapi/cgi/tests/skipif.inc b/sapi/cgi/tests/skipif.inc index d2cef23589..2145a9e410 100644 --- a/sapi/cgi/tests/skipif.inc +++ b/sapi/cgi/tests/skipif.inc @@ -1,13 +1,13 @@ <?php if (substr(php_sapi_name(), 0, 3) == "cgi") { - exit; + exit; } include dirname(__FILE__)."/include.inc"; if (!get_cgi_path()) { - die("skip CGI not found"); + die("skip CGI not found"); } ?> diff --git a/sapi/cli/tests/007.phpt b/sapi/cli/tests/007.phpt index 51858bae48..94ea6fd247 100644 --- a/sapi/cli/tests/007.phpt +++ b/sapi/cli/tests/007.phpt @@ -18,12 +18,12 @@ $code =' /* some test script */ class test { /* {{{ */ - public $var = "test"; //test var -#perl style comment - private $pri; /* private attr */ + public $var = "test"; //test var +#perl style comment + private $pri; /* private attr */ - function foo(/* void */) { - } + function foo(/* void */) { + } } /* }}} */ diff --git a/sapi/cli/tests/008.phpt b/sapi/cli/tests/008.phpt index fb8518535a..c96170d497 100644 --- a/sapi/cli/tests/008.phpt +++ b/sapi/cli/tests/008.phpt @@ -17,7 +17,7 @@ $code =' <?php class test { - private $pri; + private $pri; } var_dump(test::$pri); diff --git a/sapi/cli/tests/011.phpt b/sapi/cli/tests/011.phpt index 3ada7c53bf..24eb9fc2df 100644 --- a/sapi/cli/tests/011.phpt +++ b/sapi/cli/tests/011.phpt @@ -15,7 +15,7 @@ $code = ' $test = "var"; class test { - private $var; + private $var; } echo test::$var; @@ -31,8 +31,8 @@ var_dump(`"$php" -n -l some.unknown`); $code = ' <?php -class test - private $var; +class test + private $var; } ?> diff --git a/sapi/cli/tests/014.phpt b/sapi/cli/tests/014.phpt index 1ee72e05f6..4a458d2ae7 100644 --- a/sapi/cli/tests/014.phpt +++ b/sapi/cli/tests/014.phpt @@ -13,12 +13,12 @@ $code = ' $test = "var"; //var /* test class */ class test { - private $var = array(); + private $var = array(); - public static function foo(Test $arg) { - echo "hello"; - var_dump($this); - } + public static function foo(Test $arg) { + echo "hello"; + var_dump($this); + } } $o = new test; diff --git a/sapi/cli/tests/016.phpt b/sapi/cli/tests/016.phpt index ea735d8d6e..bbba579ec2 100644 --- a/sapi/cli/tests/016.phpt +++ b/sapi/cli/tests/016.phpt @@ -52,9 +52,9 @@ a_function_w ); EOT; foreach ($codes as $key => $code) { - echo "\n--------------\nSnippet no. $key:\n--------------\n"; - $code = escapeshellarg($code); - echo `echo $code | "$php" -a`, "\n"; + echo "\n--------------\nSnippet no. $key:\n--------------\n"; + $code = escapeshellarg($code); + echo `echo $code | "$php" -a`, "\n"; } echo "\nDone\n"; diff --git a/sapi/cli/tests/017.phpt b/sapi/cli/tests/017.phpt index 684e41691e..4cc80a4b0a 100644 --- a/sapi/cli/tests/017.phpt +++ b/sapi/cli/tests/017.phpt @@ -52,9 +52,9 @@ a_function_w ); EOT; foreach ($codes as $key => $code) { - echo "\n--------------\nSnippet no. $key:\n--------------\n"; - $code = escapeshellarg($code); - echo `echo $code | "$php" -a`, "\n"; + echo "\n--------------\nSnippet no. $key:\n--------------\n"; + $code = escapeshellarg($code); + echo `echo $code | "$php" -a`, "\n"; } echo "\nDone\n"; diff --git a/sapi/cli/tests/022.phpt b/sapi/cli/tests/022.phpt index 3b97016b58..40c2265351 100644 --- a/sapi/cli/tests/022.phpt +++ b/sapi/cli/tests/022.phpt @@ -11,23 +11,23 @@ $php = getenv("TEST_PHP_EXECUTABLE"); $socket_file = tempnam(sys_get_temp_dir(), pathinfo(__FILE__, PATHINFO_FILENAME) . '.sock'); $test_file = __DIR__ . '/' . pathinfo(__FILE__, PATHINFO_FILENAME) . '.inc'; if (file_exists($socket_file)) { - unlink($socket_file); + unlink($socket_file); } $socket = stream_socket_server('unix://' . $socket_file); var_dump($socket); if (!$socket) { - exit(1); + exit(1); } $desc = array( - 0 => $socket, - 1 => STDOUT, - 2 => STDERR, + 0 => $socket, + 1 => STDOUT, + 2 => STDERR, ); $pipes = array(); $proc = proc_open("$php -n " . escapeshellarg($test_file), $desc, $pipes); var_dump($proc); if (!$proc) { - exit(1); + exit(1); } $client_socket = stream_socket_client('unix://' . $socket_file); diff --git a/sapi/cli/tests/023.phpt b/sapi/cli/tests/023.phpt index 09b256a9af..4f827ff387 100644 --- a/sapi/cli/tests/023.phpt +++ b/sapi/cli/tests/023.phpt @@ -22,14 +22,14 @@ memory_limit = 70M INI ); $desc = array( - 0 => array("pipe", "r"), - 1 => array("pipe", "w"), - 2 => array("pipe", "w"), + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "w"), ); $pipes = array(); $proc = proc_open("$php -c $ini_file -r 'echo ini_get(\"memory_limit\");'", $desc, $pipes); if (!$proc) { - exit(1); + exit(1); } var_dump(stream_get_contents($pipes[1])); var_dump(stream_get_contents($pipes[2])); diff --git a/sapi/cli/tests/bug43177.phpt b/sapi/cli/tests/bug43177.phpt index 87dc8927ff..f36019ba6b 100644 --- a/sapi/cli/tests/bug43177.phpt +++ b/sapi/cli/tests/bug43177.phpt @@ -8,30 +8,30 @@ include "skipif.inc"; <?php include "php_cli_server.inc"; php_cli_server_start(<<<'SCRIPT' - ini_set('display_errors', 0); - switch($_SERVER["REQUEST_URI"]) { - case "/parse": - try { + ini_set('display_errors', 0); + switch($_SERVER["REQUEST_URI"]) { + case "/parse": + try { eval("this is a parse error"); } catch (ParseError $e) { } - echo "OK\n"; - break; - case "/fatal": - eval("foo();"); - echo "OK\n"; - break; - case "/compile": - eval("class foo { final private final function bar() {} }"); - echo "OK\n"; - break; - case "/fatal2": - foo(); - echo "OK\n"; - break; - default: - return false; - } + echo "OK\n"; + break; + case "/fatal": + eval("foo();"); + echo "OK\n"; + break; + case "/compile": + eval("class foo { final private final function bar() {} }"); + echo "OK\n"; + break; + case "/fatal2": + foo(); + echo "OK\n"; + break; + default: + return false; + } SCRIPT ); @@ -39,12 +39,12 @@ list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); $port = intval($port)?:80; foreach(array("parse", "fatal", "fatal2", "compile") as $url) { - $fp = fsockopen($host, $port, $errno, $errstr, 0.5); - if (!$fp) { - die("connect failed"); - } + $fp = fsockopen($host, $port, $errno, $errstr, 0.5); + if (!$fp) { + die("connect failed"); + } - if(fwrite($fp, <<<HEADER + if(fwrite($fp, <<<HEADER GET /$url HTTP/1.1 Host: {$host} @@ -54,7 +54,7 @@ HEADER while (!feof($fp)) { echo fgets($fp); } - } + } } ?> diff --git a/sapi/cli/tests/bug64529.phpt b/sapi/cli/tests/bug64529.phpt index 7331b8303e..ff3e3029e6 100644 --- a/sapi/cli/tests/bug64529.phpt +++ b/sapi/cli/tests/bug64529.phpt @@ -20,7 +20,7 @@ $php_executable = getenv('TEST_PHP_EXECUTABLE'); $script = __DIR__ . "/expect.sh"; if (extension_loaded("readline")) { - $expect_script = <<<SCRIPT + $expect_script = <<<SCRIPT set php_executable [lindex \$argv 0] @@ -38,7 +38,7 @@ exit SCRIPT; } else { - $expect_script = <<<SCRIPT + $expect_script = <<<SCRIPT set php_executable [lindex \$argv 0] diff --git a/sapi/cli/tests/bug65066_100.phpt b/sapi/cli/tests/bug65066_100.phpt index 4203b7444c..0d211c5f83 100644 --- a/sapi/cli/tests/bug65066_100.phpt +++ b/sapi/cli/tests/bug65066_100.phpt @@ -26,9 +26,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } ?> --EXPECTF-- diff --git a/sapi/cli/tests/bug65066_422.phpt b/sapi/cli/tests/bug65066_422.phpt index e8b497e923..0ecaf6e527 100644 --- a/sapi/cli/tests/bug65066_422.phpt +++ b/sapi/cli/tests/bug65066_422.phpt @@ -26,9 +26,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } ?> --EXPECTF-- diff --git a/sapi/cli/tests/bug65066_511.phpt b/sapi/cli/tests/bug65066_511.phpt index 7e5548aadc..69d4473027 100644 --- a/sapi/cli/tests/bug65066_511.phpt +++ b/sapi/cli/tests/bug65066_511.phpt @@ -26,9 +26,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } ?> --EXPECTF-- diff --git a/sapi/cli/tests/bug66606_2.phpt b/sapi/cli/tests/bug66606_2.phpt index d8bd6162a4..cba0c76e76 100644 --- a/sapi/cli/tests/bug66606_2.phpt +++ b/sapi/cli/tests/bug66606_2.phpt @@ -28,9 +28,9 @@ Content-Length: 3 a=b HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } fclose($fp); diff --git a/sapi/cli/tests/bug70470.phpt b/sapi/cli/tests/bug70470.phpt index 1e05f184b4..0c5fc56591 100644 --- a/sapi/cli/tests/bug70470.phpt +++ b/sapi/cli/tests/bug70470.phpt @@ -12,7 +12,7 @@ php_cli_server_start("var_dump(getAllheaders());"); $fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errmsg, 0.5); if (!$fp) { - die("connect failed: " . $errmsg); + die("connect failed: " . $errmsg); } fwrite($fp, "GET / HTTP/1.1\r\n"); @@ -26,7 +26,7 @@ fflush($fp); usleep(200000); fwrite($fp, "se\r\n\r\n"); while (!feof($fp)) { - echo fgets($fp); + echo fgets($fp); } fclose($fp); ?> diff --git a/sapi/cli/tests/bug71005.phpt b/sapi/cli/tests/bug71005.phpt index 6a163d4639..8341f0c94a 100644 --- a/sapi/cli/tests/bug71005.phpt +++ b/sapi/cli/tests/bug71005.phpt @@ -30,9 +30,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } ?> diff --git a/sapi/cli/tests/bug71624.phpt b/sapi/cli/tests/bug71624.phpt index 67e3e8f343..8b82ebab58 100644 --- a/sapi/cli/tests/bug71624.phpt +++ b/sapi/cli/tests/bug71624.phpt @@ -20,11 +20,11 @@ file_put_contents($filename_txt, $txt); $test_args = ['$argi', '$argn']; foreach ($test_args as $test_arg) { - if (substr(PHP_OS, 0, 3) == 'WIN') { - var_dump(`type "$filename_txt" | "$php" -n -R "echo $test_arg . PHP_EOL;"`); - } else { - var_dump(`cat "$filename_txt" | "$php" -n -R 'echo $test_arg . PHP_EOL;'`); - } + if (substr(PHP_OS, 0, 3) == 'WIN') { + var_dump(`type "$filename_txt" | "$php" -n -R "echo $test_arg . PHP_EOL;"`); + } else { + var_dump(`cat "$filename_txt" | "$php" -n -R 'echo $test_arg . PHP_EOL;'`); + } } @unlink($filename_txt); diff --git a/sapi/cli/tests/bug74600.phpt b/sapi/cli/tests/bug74600.phpt index eee222aaa3..3520982df0 100644 --- a/sapi/cli/tests/bug74600.phpt +++ b/sapi/cli/tests/bug74600.phpt @@ -14,14 +14,14 @@ file_put_contents($ini_file, <<<INI INI ); $desc = array( - 0 => array("pipe", "r"), - 1 => array("pipe", "w"), - 2 => array("pipe", "w"), + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "w"), ); $pipes = array(); $proc = proc_open("$php -c $ini_file -r 'echo \"okey\";'", $desc, $pipes); if (!$proc) { - exit(1); + exit(1); } var_dump(stream_get_contents($pipes[1])); var_dump(stream_get_contents($pipes[2])); diff --git a/sapi/cli/tests/emptyheader.phpt b/sapi/cli/tests/emptyheader.phpt index 9529730e8b..cf6b4cc694 100644 --- a/sapi/cli/tests/emptyheader.phpt +++ b/sapi/cli/tests/emptyheader.phpt @@ -12,13 +12,13 @@ php_cli_server_start("var_dump(getAllheaders());"); $fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errmsg, 0.5); if (!$fp) { - die("connect failed: " . $errmsg); + die("connect failed: " . $errmsg); } fwrite($fp, "GET / HTTP/1.1\r\nUser-Agent\r\nAccept: */*\r\nReferer:\r\nHi\r\n\r\n"); fflush($fp); while (!feof($fp)) { - echo fgets($fp); + echo fgets($fp); } fclose($fp); ?> diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc index 679a55eed4..5767e114ca 100644 --- a/sapi/cli/tests/php_cli_server.inc +++ b/sapi/cli/tests/php_cli_server.inc @@ -4,29 +4,29 @@ define ("PHP_CLI_SERVER_PORT", 8964); define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT); function php_cli_server_start( - ?string $code = 'echo "Hello world";', - ?string $router = 'index.php', - array $cmd_args = [] + ?string $code = 'echo "Hello world";', + ?string $router = 'index.php', + array $cmd_args = [] ) { - $php_executable = getenv('TEST_PHP_EXECUTABLE'); - $doc_root = __DIR__; + $php_executable = getenv('TEST_PHP_EXECUTABLE'); + $doc_root = __DIR__; $error = null; - if ($code) { - file_put_contents($doc_root . '/' . ($router ?: 'index.php'), '<?php ' . $code . ' ?>'); - } - - $cmd = [$php_executable, '-t', $doc_root, '-n', ...$cmd_args, '-S', PHP_CLI_SERVER_ADDRESS]; - if (!is_null($router)) { - $cmd[] = $router; - } - - $descriptorspec = array( - 0 => STDIN, - 1 => STDOUT, - 2 => array("null"), - ); - $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root, null, array("suppress_errors" => true)); + if ($code) { + file_put_contents($doc_root . '/' . ($router ?: 'index.php'), '<?php ' . $code . ' ?>'); + } + + $cmd = [$php_executable, '-t', $doc_root, '-n', ...$cmd_args, '-S', PHP_CLI_SERVER_ADDRESS]; + if (!is_null($router)) { + $cmd[] = $router; + } + + $descriptorspec = array( + 0 => STDIN, + 1 => STDOUT, + 2 => array("null"), + ); + $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root, null, array("suppress_errors" => true)); // note: here we check the process is running for ($i=0; $i < 120; $i++) { diff --git a/sapi/cli/tests/php_cli_server_004.phpt b/sapi/cli/tests/php_cli_server_004.phpt index 9c93de3f92..0391836829 100644 --- a/sapi/cli/tests/php_cli_server_004.phpt +++ b/sapi/cli/tests/php_cli_server_004.phpt @@ -29,9 +29,9 @@ Referer:http://www.php.net/ HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } ?> diff --git a/sapi/cli/tests/php_cli_server_005.phpt b/sapi/cli/tests/php_cli_server_005.phpt index f89245df11..852df3fcb1 100644 --- a/sapi/cli/tests/php_cli_server_005.phpt +++ b/sapi/cli/tests/php_cli_server_005.phpt @@ -41,9 +41,9 @@ Content-Length: {$post_len} {$post_data} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } ?> diff --git a/sapi/cli/tests/php_cli_server_006.phpt b/sapi/cli/tests/php_cli_server_006.phpt index ee851b0edd..87a6fd85c9 100644 --- a/sapi/cli/tests/php_cli_server_006.phpt +++ b/sapi/cli/tests/php_cli_server_006.phpt @@ -25,9 +25,9 @@ Authorization: Basic Zm9vOmJhcg== HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } ?> diff --git a/sapi/cli/tests/php_cli_server_007.phpt b/sapi/cli/tests/php_cli_server_007.phpt index 3e8fc5f48d..bc32d47845 100644 --- a/sapi/cli/tests/php_cli_server_007.phpt +++ b/sapi/cli/tests/php_cli_server_007.phpt @@ -25,9 +25,9 @@ Authorization: Basic Zm9vOmJhcg== HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } ?> diff --git a/sapi/cli/tests/php_cli_server_008.phpt b/sapi/cli/tests/php_cli_server_008.phpt index 2d9955c031..bd5f4f016a 100644 --- a/sapi/cli/tests/php_cli_server_008.phpt +++ b/sapi/cli/tests/php_cli_server_008.phpt @@ -24,9 +24,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } fclose($fp); @@ -44,9 +44,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } fclose($fp); diff --git a/sapi/cli/tests/php_cli_server_009.phpt b/sapi/cli/tests/php_cli_server_009.phpt index cb4a14cb08..87a7b2db4a 100644 --- a/sapi/cli/tests/php_cli_server_009.phpt +++ b/sapi/cli/tests/php_cli_server_009.phpt @@ -27,9 +27,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } fclose($fp); @@ -47,9 +47,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } fclose($fp); @@ -67,10 +67,10 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - break; - } + while (!feof($fp)) { + echo fgets($fp); + break; + } } fclose($fp); diff --git a/sapi/cli/tests/php_cli_server_010.phpt b/sapi/cli/tests/php_cli_server_010.phpt index 22cf3de344..d0cf52a082 100644 --- a/sapi/cli/tests/php_cli_server_010.phpt +++ b/sapi/cli/tests/php_cli_server_010.phpt @@ -24,9 +24,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } fclose($fp); @@ -44,9 +44,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } fclose($fp); diff --git a/sapi/cli/tests/php_cli_server_012.phpt b/sapi/cli/tests/php_cli_server_012.phpt index d60d71b02a..55ecf38146 100644 --- a/sapi/cli/tests/php_cli_server_012.phpt +++ b/sapi/cli/tests/php_cli_server_012.phpt @@ -28,9 +28,9 @@ Content-Length: 3 a=b HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } fclose($fp); diff --git a/sapi/cli/tests/php_cli_server_013.phpt b/sapi/cli/tests/php_cli_server_013.phpt index ec8957c8d1..9587bf0687 100644 --- a/sapi/cli/tests/php_cli_server_013.phpt +++ b/sapi/cli/tests/php_cli_server_013.phpt @@ -28,9 +28,9 @@ Content-Length: 3 a=b HEADER )) { - while (!feof($fp)) { - $output .= fgets($fp); - } + while (!feof($fp)) { + $output .= fgets($fp); + } } echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n"; @@ -50,9 +50,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - $output .= fgets($fp); - } + while (!feof($fp)) { + $output .= fgets($fp); + } } echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n"; @@ -71,9 +71,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - $output .= fgets($fp); - } + while (!feof($fp)) { + $output .= fgets($fp); + } } echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n"; diff --git a/sapi/cli/tests/php_cli_server_014.phpt b/sapi/cli/tests/php_cli_server_014.phpt index 11db82ce90..8a244009e1 100644 --- a/sapi/cli/tests/php_cli_server_014.phpt +++ b/sapi/cli/tests/php_cli_server_014.phpt @@ -33,9 +33,9 @@ Content-Type: application/x-www-form-urlencoded a=b HEADER )) { - while (!feof($fp)) { - $output .= fgets($fp); - } + while (!feof($fp)) { + $output .= fgets($fp); + } } fclose($fp); @@ -52,9 +52,9 @@ Content-Type: application/x-www-form-urlencoded a=b HEADER )) { - while (!feof($fp)) { - $output .= fgets($fp); - } + while (!feof($fp)) { + $output .= fgets($fp); + } } echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n"; diff --git a/sapi/cli/tests/php_cli_server_015.phpt b/sapi/cli/tests/php_cli_server_015.phpt index 990a3db97e..b9e4589f87 100644 --- a/sapi/cli/tests/php_cli_server_015.phpt +++ b/sapi/cli/tests/php_cli_server_015.phpt @@ -30,9 +30,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - $output .= fgets($fp); - } + while (!feof($fp)) { + $output .= fgets($fp); + } } echo $output; @unlink($dir . "/syntax_error.php"); diff --git a/sapi/cli/tests/php_cli_server_016.phpt b/sapi/cli/tests/php_cli_server_016.phpt index ae1d3f272a..269eea66d8 100644 --- a/sapi/cli/tests/php_cli_server_016.phpt +++ b/sapi/cli/tests/php_cli_server_016.phpt @@ -34,10 +34,10 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); + while (!feof($fp)) { + echo fgets($fp); break; - } + } } fclose($fp); diff --git a/sapi/cli/tests/php_cli_server_017.phpt b/sapi/cli/tests/php_cli_server_017.phpt index 067d504800..6a36ec62d1 100644 --- a/sapi/cli/tests/php_cli_server_017.phpt +++ b/sapi/cli/tests/php_cli_server_017.phpt @@ -27,9 +27,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } fclose($fp); diff --git a/sapi/cli/tests/php_cli_server_020.phpt b/sapi/cli/tests/php_cli_server_020.phpt index 23a8bc40e1..ea4f3f9eff 100644 --- a/sapi/cli/tests/php_cli_server_020.phpt +++ b/sapi/cli/tests/php_cli_server_020.phpt @@ -24,9 +24,9 @@ Host: {$host} HEADER )) { - while (!feof($fp)) { - echo fgets($fp); - } + while (!feof($fp)) { + echo fgets($fp); + } } ?> diff --git a/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt b/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt index 9028b6902b..c09e04b5a1 100644 --- a/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt +++ b/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt @@ -15,63 +15,63 @@ $is_child = isset($argv[1]); if ($is_child) { - function handler($evt) - { - exit(3); - } + function handler($evt) + { + exit(3); + } - sapi_windows_set_ctrl_handler('handler'); + sapi_windows_set_ctrl_handler('handler'); - while(1) usleep(100); + while(1) usleep(100); } else { - $cmd = PHP_BINARY . " -n " . $argv[0] . " 1"; - $spec = [0 => ["pipe", "r"], 1 => ["pipe", "w"]]; + $cmd = PHP_BINARY . " -n " . $argv[0] . " 1"; + $spec = [0 => ["pipe", "r"], 1 => ["pipe", "w"]]; - $proc = proc_open($cmd, $spec, $pipes, NULL, NULL, ["bypass_shell" => true, "create_process_group" => true]); + $proc = proc_open($cmd, $spec, $pipes, NULL, NULL, ["bypass_shell" => true, "create_process_group" => true]); - if (!is_resource($proc)) { - die("Failed to start child. "); - } + if (!is_resource($proc)) { + die("Failed to start child. "); + } - $child_pid = proc_get_status($proc)["pid"]; - echo "Started child $child_pid\n"; - usleep(300); + $child_pid = proc_get_status($proc)["pid"]; + echo "Started child $child_pid\n"; + usleep(300); - $cmd = "tasklist /FI \"PID eq $child_pid\" /NH"; - echo "Running `$cmd` to check the process indeed exists:\n"; - echo trim(shell_exec($cmd)) . "\n"; + $cmd = "tasklist /FI \"PID eq $child_pid\" /NH"; + echo "Running `$cmd` to check the process indeed exists:\n"; + echo trim(shell_exec($cmd)) . "\n"; - $evt = PHP_WINDOWS_EVENT_CTRL_C; - echo "Sending ", get_evt_name($evt), " to child $child_pid\n"; - $ret = sapi_windows_generate_ctrl_event($evt, $child_pid); + $evt = PHP_WINDOWS_EVENT_CTRL_C; + echo "Sending ", get_evt_name($evt), " to child $child_pid\n"; + $ret = sapi_windows_generate_ctrl_event($evt, $child_pid); - echo ($ret ? "Successfully" : "Unsuccessfuly"), " sent ", get_evt_name($evt), " to child $child_pid\n"; + echo ($ret ? "Successfully" : "Unsuccessfuly"), " sent ", get_evt_name($evt), " to child $child_pid\n"; - $max = 5000; $total = 0; $step = 100; - while(proc_get_status($proc)["running"] && $max > $total) { - usleep($step); - $total += $step; - } + $max = 5000; $total = 0; $step = 100; + while(proc_get_status($proc)["running"] && $max > $total) { + usleep($step); + $total += $step; + } - $status = proc_get_status($proc); - if ($status["running"]) { - echo "Child $child_pid didn't exit after ${max}us\n"; - } else { - echo "Child $child_pid exit with status ", $status["exitcode"], " after ${total}us\n"; - } + $status = proc_get_status($proc); + if ($status["running"]) { + echo "Child $child_pid didn't exit after ${max}us\n"; + } else { + echo "Child $child_pid exit with status ", $status["exitcode"], " after ${total}us\n"; + } - proc_close($proc); + proc_close($proc); } function get_evt_name(int $evt) : ?string { - if (PHP_WINDOWS_EVENT_CTRL_C == $evt) { - return "CTRL+C"; - } if (PHP_WINDOWS_EVENT_CTRL_BREAK == $evt) { - return "CTRL+BREAK"; - } + if (PHP_WINDOWS_EVENT_CTRL_C == $evt) { + return "CTRL+C"; + } if (PHP_WINDOWS_EVENT_CTRL_BREAK == $evt) { + return "CTRL+BREAK"; + } - return NULL; + return NULL; } ?> diff --git a/sapi/cli/tests/skipif.inc b/sapi/cli/tests/skipif.inc index 79e6c91004..0500d0bb75 100644 --- a/sapi/cli/tests/skipif.inc +++ b/sapi/cli/tests/skipif.inc @@ -1,7 +1,7 @@ <?php if (php_sapi_name() != "cli") { - die("skip CLI only"); + die("skip CLI only"); } ?> diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt index 82bbbca481..5012d05bc4 100644 --- a/sapi/cli/tests/upload_2G.phpt +++ b/sapi/cli/tests/upload_2G.phpt @@ -44,7 +44,7 @@ echo "Test\n"; include "php_cli_server.inc"; php_cli_server_start("var_dump(\$_FILES);", null, - ["-d", "post_max_size=3G", "-d", "upload_max_filesize=3G"]); + ["-d", "post_max_size=3G", "-d", "upload_max_filesize=3G"]); list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); $port = intval($port)?:80; @@ -74,13 +74,13 @@ EOF $data = str_repeat("0123456789", 10000); for ($i = 0; $i < $length; $i += 10000 * 10) { - fwrite($fp, $data) or die("write failed @ ($i)"); + fwrite($fp, $data) or die("write failed @ ($i)"); } fwrite($fp, $post) or die("write post failed"); while (!feof($fp)) { - $output .= fgets($fp); + $output .= fgets($fp); } echo $output; fclose($fp); diff --git a/sapi/fpm/tests/getallheaders.phpt b/sapi/fpm/tests/getallheaders.phpt index b1f9683788..90ecae3e44 100644 --- a/sapi/fpm/tests/getallheaders.phpt +++ b/sapi/fpm/tests/getallheaders.phpt @@ -31,27 +31,27 @@ $tester = new FPM\Tester($cfg, $code); $tester->start(); $tester->expectLogStartNotices(); $tester->request( - '', - [ - 'HTTP_X_FOO' => 'BAR', - 'HTTP_FOO' => 'foo' - ] - )->expectBody( - [ - 'Test Start', - 'array(4) {', - ' ["Foo"]=>', - ' string(3) "foo"', - ' ["X-Foo"]=>', - ' string(3) "BAR"', - ' ["Content-Length"]=>', - ' string(1) "0"', - ' ["Content-Type"]=>', - ' string(0) ""', - '}', - 'Test End', - ] - ); + '', + [ + 'HTTP_X_FOO' => 'BAR', + 'HTTP_FOO' => 'foo' + ] + )->expectBody( + [ + 'Test Start', + 'array(4) {', + ' ["Foo"]=>', + ' string(3) "foo"', + ' ["X-Foo"]=>', + ' string(3) "BAR"', + ' ["Content-Length"]=>', + ' string(1) "0"', + ' ["Content-Type"]=>', + ' string(0) ""', + '}', + 'Test End', + ] + ); $tester->terminate(); $tester->expectLogTerminatingNotices(); $tester->close(); diff --git a/sapi/fpm/tests/status-basic.phpt b/sapi/fpm/tests/status-basic.phpt index 323592262f..245fc425ca 100644 --- a/sapi/fpm/tests/status-basic.phpt +++ b/sapi/fpm/tests/status-basic.phpt @@ -12,7 +12,7 @@ $cfg = <<<EOT error_log = {{FILE:LOG}} [unconfined] listen = {{ADDR}} -pm = static +pm = static pm.max_children = 1 pm.status_path = /status EOT; diff --git a/tests/basic/011.phpt b/tests/basic/011.phpt index b5c769d9bd..03fccaa9b7 100644 --- a/tests/basic/011.phpt +++ b/tests/basic/011.phpt @@ -10,7 +10,7 @@ $argc = $_SERVER['argc']; $argv = $_SERVER['argv']; for ($i=0; $i<$argc; $i++) { - echo "$i: ".$argv[$i]."\n"; + echo "$i: ".$argv[$i]."\n"; } ?> diff --git a/tests/basic/012.phpt b/tests/basic/012.phpt index 50af0b49f6..37e5ecd809 100644 --- a/tests/basic/012.phpt +++ b/tests/basic/012.phpt @@ -11,7 +11,7 @@ $argc = $_SERVER['argc']; $argv = $_SERVER['argv']; for ($i=1; $i<$argc; $i++) { - echo ($i-1).": ".$argv[$i]."\n"; + echo ($i-1).": ".$argv[$i]."\n"; } ?> diff --git a/tests/basic/bug20539.phpt b/tests/basic/bug20539.phpt index 2b84d14189..99a88f66b5 100644 --- a/tests/basic/bug20539.phpt +++ b/tests/basic/bug20539.phpt @@ -9,10 +9,10 @@ session.save_handler=files session.save_path=./tests/basic/ --FILE-- <?php - print "good :)\n"; - $filename = __DIR__ . '/sess_' . session_id(); - var_dump(file_exists($filename)); - @unlink($filename); + print "good :)\n"; + $filename = __DIR__ . '/sess_' . session_id(); + var_dump(file_exists($filename)); + @unlink($filename); ?> --EXPECT-- good :) diff --git a/tests/basic/bug54514.phpt b/tests/basic/bug54514.phpt index 0c5595e3f7..6133ee2caf 100644 --- a/tests/basic/bug54514.phpt +++ b/tests/basic/bug54514.phpt @@ -3,10 +3,10 @@ Req #54514 (Get php binary path during script execution) --FILE-- <?php if(realpath(getenv('TEST_PHP_EXECUTABLE')) === realpath(PHP_BINARY)) { - echo "done"; + echo "done"; } else { - var_dump(getenv('TEST_PHP_EXECUTABLE')); - var_dump(PHP_BINARY); + var_dump(getenv('TEST_PHP_EXECUTABLE')); + var_dump(PHP_BINARY); } --EXPECT-- done diff --git a/tests/basic/bug71273.phpt b/tests/basic/bug71273.phpt index 3a2ff244f4..7634d432d0 100644 --- a/tests/basic/bug71273.phpt +++ b/tests/basic/bug71273.phpt @@ -2,12 +2,12 @@ Bug #71273 A wrong ext directory setup in php.ini leads to crash --FILE-- <?php - /* NOTE this file is required to be encoded in iso-8859-1 */ + /* NOTE this file is required to be encoded in iso-8859-1 */ - $cmd = getenv('TEST_PHP_EXECUTABLE') . " -n -d html_errors=on -d extension_dir=a/é/w -d extension=php_kartoffelbrei.dll -v 2>&1"; - $out = shell_exec($cmd); + $cmd = getenv('TEST_PHP_EXECUTABLE') . " -n -d html_errors=on -d extension_dir=a/é/w -d extension=php_kartoffelbrei.dll -v 2>&1"; + $out = shell_exec($cmd); - var_dump(preg_match(",.+a[\\/].+[\\/]w.php_kartoffelbrei.dll.+,s", $out)); + var_dump(preg_match(",.+a[\\/].+[\\/]w.php_kartoffelbrei.dll.+,s", $out)); ?> --EXPECT-- int(1) diff --git a/tests/basic/enable_post_data_reading_05.phpt b/tests/basic/enable_post_data_reading_05.phpt index d8efa0129e..f6695f84c4 100644 --- a/tests/basic/enable_post_data_reading_05.phpt +++ b/tests/basic/enable_post_data_reading_05.phpt @@ -14,7 +14,7 @@ $f1 = fopen("php://input", "r"); $f2 = fopen("php://input", "r"); while (!feof($f1) && !feof($f2)) { - echo fgetc($f1), fgetc($f2); + echo fgetc($f1), fgetc($f2); } ?> diff --git a/tests/basic/enable_post_data_reading_06.phpt b/tests/basic/enable_post_data_reading_06.phpt index fbed195c03..8e9db3a1d8 100644 --- a/tests/basic/enable_post_data_reading_06.phpt +++ b/tests/basic/enable_post_data_reading_06.phpt @@ -95,7 +95,7 @@ $f1 = fopen("php://input", "r"); $f2 = fopen("php://input", "r"); while (!feof($f1) && !feof($f2)) { - echo fgets($f1), fgets($f2); + echo fgets($f1), fgets($f2); } ?> diff --git a/tests/basic/rfc1867_empty_upload.phpt b/tests/basic/rfc1867_empty_upload.phpt index 77fe53ea58..2b89ca8888 100644 --- a/tests/basic/rfc1867_empty_upload.phpt +++ b/tests/basic/rfc1867_empty_upload.phpt @@ -31,10 +31,10 @@ Content-Type: text/plain-file3 var_dump($_FILES); var_dump($_POST); if (is_uploaded_file($_FILES["file1"]["tmp_name"])) { - var_dump(file_get_contents($_FILES["file1"]["tmp_name"])); + var_dump(file_get_contents($_FILES["file1"]["tmp_name"])); } if (is_uploaded_file($_FILES["file3"]["tmp_name"])) { - var_dump(file_get_contents($_FILES["file3"]["tmp_name"])); + var_dump(file_get_contents($_FILES["file3"]["tmp_name"])); } ?> --EXPECTF-- diff --git a/tests/basic/rfc1867_max_file_size.phpt b/tests/basic/rfc1867_max_file_size.phpt index 89406a407f..8d585f7503 100644 --- a/tests/basic/rfc1867_max_file_size.phpt +++ b/tests/basic/rfc1867_max_file_size.phpt @@ -31,10 +31,10 @@ Content-Type: text/plain-file3; var_dump($_FILES); var_dump($_POST); if (is_uploaded_file($_FILES["file1"]["tmp_name"])) { - var_dump(file_get_contents($_FILES["file1"]["tmp_name"])); + var_dump(file_get_contents($_FILES["file1"]["tmp_name"])); } if (is_uploaded_file($_FILES["file3"]["tmp_name"])) { - var_dump(file_get_contents($_FILES["file3"]["tmp_name"])); + var_dump(file_get_contents($_FILES["file3"]["tmp_name"])); } ?> --EXPECTF-- diff --git a/tests/basic/rfc1867_max_file_uploads_empty_files.phpt b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt index 6ea7915c25..b85ed20971 100644 --- a/tests/basic/rfc1867_max_file_uploads_empty_files.phpt +++ b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt @@ -31,10 +31,10 @@ Content-Type: text/plain-file var_dump($_FILES); var_dump($_POST); if (is_uploaded_file($_FILES["file1"]["tmp_name"])) { - var_dump(file_get_contents($_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"])); + var_dump(file_get_contents($_FILES["file4"]["tmp_name"])); } ?> --EXPECTF-- diff --git a/tests/basic/rfc1867_post_max_filesize.phpt b/tests/basic/rfc1867_post_max_filesize.phpt index 58e05319a1..b03220e915 100644 --- a/tests/basic/rfc1867_post_max_filesize.phpt +++ b/tests/basic/rfc1867_post_max_filesize.phpt @@ -27,10 +27,10 @@ Content-Type: text/plain-file3 var_dump($_FILES); var_dump($_POST); if (is_uploaded_file($_FILES["file1"]["tmp_name"])) { - var_dump(file_get_contents($_FILES["file1"]["tmp_name"])); + var_dump(file_get_contents($_FILES["file1"]["tmp_name"])); } if (is_uploaded_file($_FILES["file3"]["tmp_name"])) { - var_dump(file_get_contents($_FILES["file3"]["tmp_name"])); + var_dump(file_get_contents($_FILES["file3"]["tmp_name"])); } ?> --EXPECTF-- diff --git a/tests/classes/__call_001.phpt b/tests/classes/__call_001.phpt index a70041ae16..654a020339 100644 --- a/tests/classes/__call_001.phpt +++ b/tests/classes/__call_001.phpt @@ -4,13 +4,13 @@ ZE2 __call() <?php class Caller { - public $x = array(1, 2, 3); + public $x = array(1, 2, 3); - function __call($m, $a) { - echo "Method $m called:\n"; - var_dump($a); - return $this->x; - } + function __call($m, $a) { + echo "Method $m called:\n"; + var_dump($a); + return $this->x; + } } $foo = new Caller(); diff --git a/tests/classes/__call_002.phpt b/tests/classes/__call_002.phpt index f58ec47dcb..a0df5a2390 100644 --- a/tests/classes/__call_002.phpt +++ b/tests/classes/__call_002.phpt @@ -4,8 +4,8 @@ ZE2 __call() signature check <?php class Test { - function __call() { - } + function __call() { + } } ?> diff --git a/tests/classes/__call_004.phpt b/tests/classes/__call_004.phpt index ca980c65f0..f8168cedab 100644 --- a/tests/classes/__call_004.phpt +++ b/tests/classes/__call_004.phpt @@ -3,24 +3,24 @@ When __call() is invoked via ::, ensure current scope's __call() is favoured ove --FILE-- <?php class A { - function __call($strMethod, $arrArgs) { - echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n"; - var_dump($this); - } + function __call($strMethod, $arrArgs) { + echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n"; + var_dump($this); + } } class B extends A { - function __call($strMethod, $arrArgs) { - echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n"; - var_dump($this); - } + function __call($strMethod, $arrArgs) { + echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n"; + var_dump($this); + } - function test() { - A::test1(1,'a'); - B::test2(1,'a'); - self::test3(1,'a'); - parent::test4(1,'a'); - } + function test() { + A::test1(1,'a'); + B::test2(1,'a'); + self::test3(1,'a'); + parent::test4(1,'a'); + } } $b = new B(); diff --git a/tests/classes/__call_005.phpt b/tests/classes/__call_005.phpt index 33c4df8e49..8c4d52efa7 100644 --- a/tests/classes/__call_005.phpt +++ b/tests/classes/__call_005.phpt @@ -3,19 +3,19 @@ When __call() is invoked via ::, ensure private implementation of __call() in su --FILE-- <?php class A { - private function __call($strMethod, $arrArgs) { - echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n"; - var_dump($this); - } + private function __call($strMethod, $arrArgs) { + echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n"; + var_dump($this); + } } class B extends A { - function test() { - A::test1(1,'a'); - B::test2(1,'a'); - self::test3(1,'a'); - parent::test4(1,'a'); - } + function test() { + A::test1(1,'a'); + B::test2(1,'a'); + self::test3(1,'a'); + parent::test4(1,'a'); + } } $b = new B(); diff --git a/tests/classes/__call_006.phpt b/tests/classes/__call_006.phpt index 807735401c..6ffc75358f 100644 --- a/tests/classes/__call_006.phpt +++ b/tests/classes/__call_006.phpt @@ -3,51 +3,51 @@ Ensure exceptions are handled properly when thrown in __call. --FILE-- <?php class A { - function __call($strMethod, $arrArgs) { - var_dump($this); - throw new Exception; - echo "You should not see this"; - } - function test() { - A::unknownCalledWithSRO(1,2,3); - } + function __call($strMethod, $arrArgs) { + var_dump($this); + throw new Exception; + echo "You should not see this"; + } + function test() { + A::unknownCalledWithSRO(1,2,3); + } } class B extends A { - function test() { - B::unknownCalledWithSROFromChild(1,2,3); - } + function test() { + B::unknownCalledWithSROFromChild(1,2,3); + } } $a = new A(); echo "---> Invoke __call via simple method call.\n"; try { - $a->unknown(); + $a->unknown(); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } echo "\n\n---> Invoke __call via scope resolution operator within instance.\n"; try { - $a->test(); + $a->test(); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } echo "\n\n---> Invoke __call via scope resolution operator within child instance.\n"; $b = new B(); try { - $b->test(); + $b->test(); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } echo "\n\n---> Invoke __call via callback.\n"; try { - call_user_func(array($b, 'unknownCallback'), 1,2,3); + call_user_func(array($b, 'unknownCallback'), 1,2,3); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } ?> --EXPECTF-- diff --git a/tests/classes/__call_007.phpt b/tests/classes/__call_007.phpt index a1e911d52b..26dd8e29b6 100644 --- a/tests/classes/__call_007.phpt +++ b/tests/classes/__call_007.phpt @@ -3,51 +3,51 @@ Ensure exceptions are handled properly when thrown in a statically declared __ca --FILE-- <?php class A { - static function __call($strMethod, $arrArgs) { - @var_dump($this); - throw new Exception; - echo "You should not see this"; - } - function test() { - A::unknownCalledWithSRO(1,2,3); - } + static function __call($strMethod, $arrArgs) { + @var_dump($this); + throw new Exception; + echo "You should not see this"; + } + function test() { + A::unknownCalledWithSRO(1,2,3); + } } class B extends A { - function test() { - B::unknownCalledWithSROFromChild(1,2,3); - } + function test() { + B::unknownCalledWithSROFromChild(1,2,3); + } } $a = new A(); echo "---> Invoke __call via simple method call.\n"; try { - $a->unknown(); + $a->unknown(); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } echo "\n\n---> Invoke __call via scope resolution operator within instance.\n"; try { - $a->test(); + $a->test(); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } echo "\n\n---> Invoke __call via scope resolution operator within child instance.\n"; $b = new B(); try { - $b->test(); + $b->test(); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } echo "\n\n---> Invoke __call via callback.\n"; try { - call_user_func(array($b, 'unknownCallback'), 1,2,3); + call_user_func(array($b, 'unknownCallback'), 1,2,3); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } ?> --EXPECTF-- diff --git a/tests/classes/__set__get_001.phpt b/tests/classes/__set__get_001.phpt index 244119a2d0..f240817f4a 100644 --- a/tests/classes/__set__get_001.phpt +++ b/tests/classes/__set__get_001.phpt @@ -3,33 +3,33 @@ ZE2 __set() and __get() --FILE-- <?php class setter { - public $n; - public $x = array('a' => 1, 'b' => 2, 'c' => 3); + public $n; + public $x = array('a' => 1, 'b' => 2, 'c' => 3); - function __get($nm) { - echo "Getting [$nm]\n"; + function __get($nm) { + echo "Getting [$nm]\n"; - if (isset($this->x[$nm])) { - $r = $this->x[$nm]; - echo "Returning: $r\n"; - return $r; - } - else { - echo "Nothing!\n"; - } - } + if (isset($this->x[$nm])) { + $r = $this->x[$nm]; + echo "Returning: $r\n"; + return $r; + } + else { + echo "Nothing!\n"; + } + } - function __set($nm, $val) { - echo "Setting [$nm] to $val\n"; + function __set($nm, $val) { + echo "Setting [$nm] to $val\n"; - if (isset($this->x[$nm])) { - $this->x[$nm] = $val; - echo "OK!\n"; - } - else { - echo "Not OK!\n"; - } - } + if (isset($this->x[$nm])) { + $this->x[$nm] = $val; + echo "OK!\n"; + } + else { + echo "Not OK!\n"; + } + } } $foo = new Setter(); diff --git a/tests/classes/__set__get_002.phpt b/tests/classes/__set__get_002.phpt index 5d3b5db543..5fb72e2106 100644 --- a/tests/classes/__set__get_002.phpt +++ b/tests/classes/__set__get_002.phpt @@ -3,8 +3,8 @@ ZE2 __get() signature check --FILE-- <?php class Test { - function __get($x,$y) { - } + function __get($x,$y) { + } } ?> diff --git a/tests/classes/__set__get_003.phpt b/tests/classes/__set__get_003.phpt index 16b09b76b1..0ebac3bccc 100644 --- a/tests/classes/__set__get_003.phpt +++ b/tests/classes/__set__get_003.phpt @@ -3,8 +3,8 @@ ZE2 __set() signature check --FILE-- <?php class Test { - function __set() { - } + function __set() { + } } ?> diff --git a/tests/classes/__set__get_004.phpt b/tests/classes/__set__get_004.phpt index f825cdf971..2818d9700f 100644 --- a/tests/classes/__set__get_004.phpt +++ b/tests/classes/__set__get_004.phpt @@ -3,21 +3,21 @@ ZE2 __set() and __get() --FILE-- <?php class Test { - protected $x; + protected $x; - function __get($name) { - if (isset($this->x[$name])) { - return $this->x[$name]; - } - else - { - return NULL; - } - } + function __get($name) { + if (isset($this->x[$name])) { + return $this->x[$name]; + } + else + { + return NULL; + } + } - function __set($name, $val) { - $this->x[$name] = $val; - } + function __set($name, $val) { + $this->x[$name] = $val; + } } $foo = new Test(); diff --git a/tests/classes/__set__get_005.phpt b/tests/classes/__set__get_005.phpt index 767e54ab0c..298c8b1e11 100644 --- a/tests/classes/__set__get_005.phpt +++ b/tests/classes/__set__get_005.phpt @@ -4,41 +4,41 @@ ZE2 __set() and __get() <?php class Test { - protected $x; + protected $x; - function __get($name) { - echo __METHOD__ . "\n"; - if (isset($this->x[$name])) { - return $this->x[$name]; - } - else - { - return NULL; - } - } + function __get($name) { + echo __METHOD__ . "\n"; + if (isset($this->x[$name])) { + return $this->x[$name]; + } + else + { + return NULL; + } + } - function __set($name, $val) { - echo __METHOD__ . "\n"; - $this->x[$name] = $val; - } + function __set($name, $val) { + echo __METHOD__ . "\n"; + $this->x[$name] = $val; + } } class AutoGen { - protected $x; + protected $x; - function __get($name) { - echo __METHOD__ . "\n"; - if (!isset($this->x[$name])) { - $this->x[$name] = new Test(); - } - return $this->x[$name]; - } + function __get($name) { + echo __METHOD__ . "\n"; + if (!isset($this->x[$name])) { + $this->x[$name] = new Test(); + } + return $this->x[$name]; + } - function __set($name, $val) { - echo __METHOD__ . "\n"; - $this->x[$name] = $val; - } + function __set($name, $val) { + echo __METHOD__ . "\n"; + $this->x[$name] = $val; + } } $foo = new AutoGen(); diff --git a/tests/classes/abstract.phpt b/tests/classes/abstract.phpt index f46e5130a7..8286d6b6aa 100644 --- a/tests/classes/abstract.phpt +++ b/tests/classes/abstract.phpt @@ -4,16 +4,16 @@ ZE2 An abstract method may not be called <?php abstract class fail { - abstract function show(); + abstract function show(); } class pass extends fail { - function show() { - echo "Call to function show()\n"; - } - function error() { - parent::show(); - } + function show() { + echo "Call to function show()\n"; + } + function error() { + parent::show(); + } } $t = new pass(); diff --git a/tests/classes/abstract_by_interface_001.phpt b/tests/classes/abstract_by_interface_001.phpt index 4a746d0d22..a8a6ad31da 100644 --- a/tests/classes/abstract_by_interface_001.phpt +++ b/tests/classes/abstract_by_interface_001.phpt @@ -8,7 +8,7 @@ class Root { interface MyInterface { - function MyInterfaceFunc(); + function MyInterfaceFunc(); } abstract class Derived extends Root implements MyInterface { @@ -16,7 +16,7 @@ abstract class Derived extends Root implements MyInterface { class Leaf extends Derived { - function MyInterfaceFunc() {} + function MyInterfaceFunc() {} } var_dump(new Leaf); diff --git a/tests/classes/abstract_by_interface_002.phpt b/tests/classes/abstract_by_interface_002.phpt index a05660b5b9..83fc18ad95 100644 --- a/tests/classes/abstract_by_interface_002.phpt +++ b/tests/classes/abstract_by_interface_002.phpt @@ -8,7 +8,7 @@ class Root { interface MyInterface { - static function MyInterfaceFunc(); + static function MyInterfaceFunc(); } abstract class Derived extends Root implements MyInterface { @@ -16,7 +16,7 @@ abstract class Derived extends Root implements MyInterface { class Leaf extends Derived { - static function MyInterfaceFunc() {} + static function MyInterfaceFunc() {} } var_dump(new Leaf); diff --git a/tests/classes/abstract_class.phpt b/tests/classes/abstract_class.phpt index fabe890eae..2ede69805c 100644 --- a/tests/classes/abstract_class.phpt +++ b/tests/classes/abstract_class.phpt @@ -4,13 +4,13 @@ ZE2 An abstract class cannot be instantiated <?php abstract class fail { - abstract function show(); + abstract function show(); } class pass extends fail { - function show() { - echo "Call to function show()\n"; - } + function show() { + echo "Call to function show()\n"; + } } $t2 = new pass(); diff --git a/tests/classes/abstract_derived.phpt b/tests/classes/abstract_derived.phpt index 5948692653..db040e1342 100644 --- a/tests/classes/abstract_derived.phpt +++ b/tests/classes/abstract_derived.phpt @@ -7,7 +7,7 @@ class base { } class derived extends base { - abstract function show(); + abstract function show(); } ?> diff --git a/tests/classes/abstract_final.phpt b/tests/classes/abstract_final.phpt index a82bfff227..70aece06fd 100644 --- a/tests/classes/abstract_final.phpt +++ b/tests/classes/abstract_final.phpt @@ -4,7 +4,7 @@ ZE2 A final method cannot be abstract <?php class fail { - abstract final function show(); + abstract final function show(); } echo "Done\n"; // Shouldn't be displayed diff --git a/tests/classes/abstract_inherit.phpt b/tests/classes/abstract_inherit.phpt index 8e9e118e08..6664fd3e90 100644 --- a/tests/classes/abstract_inherit.phpt +++ b/tests/classes/abstract_inherit.phpt @@ -4,7 +4,7 @@ ZE2 A class that inherits an abstract method is abstract <?php abstract class pass { - abstract function show(); + abstract function show(); } abstract class fail extends pass { diff --git a/tests/classes/abstract_not_declared.phpt b/tests/classes/abstract_not_declared.phpt index 8c2d880150..611cb3cc94 100644 --- a/tests/classes/abstract_not_declared.phpt +++ b/tests/classes/abstract_not_declared.phpt @@ -4,7 +4,7 @@ ZE2 An abstract class must be declared abstract <?php class fail { - abstract function show(); + abstract function show(); } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/abstract_redeclare.phpt b/tests/classes/abstract_redeclare.phpt index 5643cb7a61..843570ba2e 100644 --- a/tests/classes/abstract_redeclare.phpt +++ b/tests/classes/abstract_redeclare.phpt @@ -4,13 +4,13 @@ ZE2 A method cannot be redeclared abstract <?php class pass { - function show() { - echo "Call to function show()\n"; - } + function show() { + echo "Call to function show()\n"; + } } class fail extends pass { - abstract function show(); + abstract function show(); } echo "Done\n"; // Shouldn't be displayed diff --git a/tests/classes/abstract_static.phpt b/tests/classes/abstract_static.phpt index 9b9205af3e..60ff284784 100644 --- a/tests/classes/abstract_static.phpt +++ b/tests/classes/abstract_static.phpt @@ -5,14 +5,14 @@ ZE2 A static abstract methods interface showable { - static function show(); + static function show(); } class pass implements showable { - static function show() { - echo "Call to function show()\n"; - } + static function show() { + echo "Call to function show()\n"; + } } pass::show(); @@ -20,7 +20,7 @@ pass::show(); eval(' class fail { - abstract static function func(); + abstract static function func(); } '); diff --git a/tests/classes/abstract_user_call.phpt b/tests/classes/abstract_user_call.phpt index 224461a3bd..0a61d477b6 100644 --- a/tests/classes/abstract_user_call.phpt +++ b/tests/classes/abstract_user_call.phpt @@ -5,15 +5,15 @@ ZE2 An abstrcat method cannot be called indirectly abstract class test_base { - abstract function func(); + abstract function func(); } class test extends test_base { - function func() - { - echo __METHOD__ . "()\n"; - } + function func() + { + echo __METHOD__ . "()\n"; + } } $o = new test; diff --git a/tests/classes/array_access_001.phpt b/tests/classes/array_access_001.phpt index a2ba09e88b..ae2669b670 100644 --- a/tests/classes/array_access_001.phpt +++ b/tests/classes/array_access_001.phpt @@ -4,24 +4,24 @@ ZE2 ArrayAccess <?php class ObjectOne implements ArrayAccess { - public $a = array('1st', 1, 2=>'3rd', '4th'=>4); + public $a = array('1st', 1, 2=>'3rd', '4th'=>4); - function offsetExists($index) { - echo __METHOD__ . "($index)\n"; - return array_key_exists($index, $this->a); - } - function offsetGet($index) { - echo __METHOD__ . "($index)\n"; - return $this->a[$index]; - } - function offsetSet($index, $newval) { - echo __METHOD__ . "($index,$newval)\n"; - return $this->a[$index] = $newval; - } - function offsetUnset($index) { - echo __METHOD__ . "($index)\n"; - unset($this->a[$index]); - } + function offsetExists($index) { + echo __METHOD__ . "($index)\n"; + return array_key_exists($index, $this->a); + } + function offsetGet($index) { + echo __METHOD__ . "($index)\n"; + return $this->a[$index]; + } + function offsetSet($index, $newval) { + echo __METHOD__ . "($index,$newval)\n"; + return $this->a[$index] = $newval; + } + function offsetUnset($index) { + echo __METHOD__ . "($index)\n"; + unset($this->a[$index]); + } } $obj = new ObjectOne; diff --git a/tests/classes/array_access_002.phpt b/tests/classes/array_access_002.phpt index 730ad0952b..79f4a52853 100644 --- a/tests/classes/array_access_002.phpt +++ b/tests/classes/array_access_002.phpt @@ -4,24 +4,24 @@ ZE2 ArrayAccess::offsetSet without return <?php class ObjectOne implements ArrayAccess { - public $a = array('1st', 1, 2=>'3rd', '4th'=>4); + public $a = array('1st', 1, 2=>'3rd', '4th'=>4); - function offsetExists($index) { - echo __METHOD__ . "($index)\n"; - return array_key_exists($index, $this->a); - } - function offsetGet($index) { - echo __METHOD__ . "($index)\n"; - return $this->a[$index]; - } - function offsetSet($index, $newval) { - echo __METHOD__ . "($index,$newval)\n"; - /*return*/ $this->a[$index] = $newval; - } - function offsetUnset($index) { - echo __METHOD__ . "($index)\n"; - unset($this->a[$index]); - } + function offsetExists($index) { + echo __METHOD__ . "($index)\n"; + return array_key_exists($index, $this->a); + } + function offsetGet($index) { + echo __METHOD__ . "($index)\n"; + return $this->a[$index]; + } + function offsetSet($index, $newval) { + echo __METHOD__ . "($index,$newval)\n"; + /*return*/ $this->a[$index] = $newval; + } + function offsetUnset($index) { + echo __METHOD__ . "($index)\n"; + unset($this->a[$index]); + } } $obj = new ObjectOne; diff --git a/tests/classes/array_access_003.phpt b/tests/classes/array_access_003.phpt index 9fa2ee73e6..dbaaa6b192 100644 --- a/tests/classes/array_access_003.phpt +++ b/tests/classes/array_access_003.phpt @@ -6,35 +6,35 @@ error_reporting=4095 <?php class ObjectOne implements ArrayAccess { - public $a = array('1st', 1, 2=>'3rd', '4th'=>4); + public $a = array('1st', 1, 2=>'3rd', '4th'=>4); - function offsetExists($index) { - echo __METHOD__ . "($index)\n"; - return array_key_exists($index, $this->a); - } - function offsetGet($index) { - echo __METHOD__ . "($index)\n"; - switch($index) { - case 1: - $a = 'foo'; - return $a . 'Bar'; - case 2: - static $a=1; - return $a; - } - return $this->a[$index]; - } - function offsetSet($index, $newval) { - echo __METHOD__ . "($index,$newval)\n"; - if ($index==3) { - $this->cnt = $newval; - } - return $this->a[$index] = $newval; - } - function offsetUnset($index) { - echo __METHOD__ . "($index)\n"; - unset($this->a[$index]); - } + function offsetExists($index) { + echo __METHOD__ . "($index)\n"; + return array_key_exists($index, $this->a); + } + function offsetGet($index) { + echo __METHOD__ . "($index)\n"; + switch($index) { + case 1: + $a = 'foo'; + return $a . 'Bar'; + case 2: + static $a=1; + return $a; + } + return $this->a[$index]; + } + function offsetSet($index, $newval) { + echo __METHOD__ . "($index,$newval)\n"; + if ($index==3) { + $this->cnt = $newval; + } + return $this->a[$index] = $newval; + } + function offsetUnset($index) { + echo __METHOD__ . "($index)\n"; + unset($this->a[$index]); + } } $obj = new ObjectOne; diff --git a/tests/classes/array_access_004.phpt b/tests/classes/array_access_004.phpt index 72e1322aba..882ca43762 100644 --- a/tests/classes/array_access_004.phpt +++ b/tests/classes/array_access_004.phpt @@ -4,35 +4,35 @@ ZE2 ArrayAccess::offsetGet ambiguties <?php class ObjectOne implements ArrayAccess { - public $a = array('1st', 1, 2=>'3rd', '4th'=>4); + public $a = array('1st', 1, 2=>'3rd', '4th'=>4); - function offsetExists($index) { - echo __METHOD__ . "($index)\n"; - return array_key_exists($index, $this->a); - } - function offsetGet($index) { - echo __METHOD__ . "($index)\n"; - switch($index) { - case 1: - $a = 'foo'; - return $a . 'Bar'; - case 2: - static $a=1; - return $a; - } - return $this->a[$index]; - } - function offsetSet($index, $newval) { - echo __METHOD__ . "($index,$newval)\n"; - if ($index==3) { - $this->cnt = $newval; - } - return $this->a[$index] = $newval; - } - function offsetUnset($index) { - echo __METHOD__ . "($index)\n"; - unset($this->a[$index]); - } + function offsetExists($index) { + echo __METHOD__ . "($index)\n"; + return array_key_exists($index, $this->a); + } + function offsetGet($index) { + echo __METHOD__ . "($index)\n"; + switch($index) { + case 1: + $a = 'foo'; + return $a . 'Bar'; + case 2: + static $a=1; + return $a; + } + return $this->a[$index]; + } + function offsetSet($index, $newval) { + echo __METHOD__ . "($index,$newval)\n"; + if ($index==3) { + $this->cnt = $newval; + } + return $this->a[$index] = $newval; + } + function offsetUnset($index) { + echo __METHOD__ . "($index)\n"; + unset($this->a[$index]); + } } $obj = new ObjectOne; diff --git a/tests/classes/array_access_005.phpt b/tests/classes/array_access_005.phpt index 91d4a7ca22..7db50f2cb9 100644 --- a/tests/classes/array_access_005.phpt +++ b/tests/classes/array_access_005.phpt @@ -4,27 +4,27 @@ ZE2 ArrayAccess and sub Arrays <?php class Peoples implements ArrayAccess { - public $person; + public $person; - function __construct() { - $this->person = array(array('name'=>'Joe')); - } + function __construct() { + $this->person = array(array('name'=>'Joe')); + } - function offsetExists($index) { - return array_key_exists($this->person, $index); - } + function offsetExists($index) { + return array_key_exists($this->person, $index); + } - function offsetGet($index) { - return $this->person[$index]; - } + function offsetGet($index) { + return $this->person[$index]; + } - function offsetSet($index, $value) { - $this->person[$index] = $value; - } + function offsetSet($index, $value) { + $this->person[$index] = $value; + } - function offsetUnset($index) { - unset($this->person[$index]); - } + function offsetUnset($index) { + unset($this->person[$index]); + } } $people = new Peoples; diff --git a/tests/classes/array_access_006.phpt b/tests/classes/array_access_006.phpt index babc808cb4..7891d2aca4 100644 --- a/tests/classes/array_access_006.phpt +++ b/tests/classes/array_access_006.phpt @@ -4,27 +4,27 @@ ZE2 ArrayAccess and ASSIGN_OP operators (+=) <?php class OverloadedArray implements ArrayAccess { - public $realArray; + public $realArray; - function __construct() { - $this->realArray = array(1,2,3); - } + function __construct() { + $this->realArray = array(1,2,3); + } - function offsetExists($index) { - return array_key_exists($this->realArray, $index); - } + function offsetExists($index) { + return array_key_exists($this->realArray, $index); + } - function offsetGet($index) { - return $this->realArray[$index]; - } + function offsetGet($index) { + return $this->realArray[$index]; + } - function offsetSet($index, $value) { - $this->realArray[$index] = $value; - } + function offsetSet($index, $value) { + $this->realArray[$index] = $value; + } - function offsetUnset($index) { - unset($this->realArray[$index]); - } + function offsetUnset($index) { + unset($this->realArray[$index]); + } } $a = new OverloadedArray; diff --git a/tests/classes/array_access_007.phpt b/tests/classes/array_access_007.phpt index f0dce8a3ad..37a3255d6f 100644 --- a/tests/classes/array_access_007.phpt +++ b/tests/classes/array_access_007.phpt @@ -4,35 +4,35 @@ ZE2 ArrayAccess and [] assignment <?php class OverloadedArray implements ArrayAccess { - public $realArray; - - function __construct() { - $this->realArray = array(); - } - - function offsetExists($index) { - return array_key_exists($this->realArray, $index); - } - - function offsetGet($index) { - return $this->realArray[$index]; - } - - function offsetSet($index, $value) { - if (is_null($index)) { - $this->realArray[] = $value; - } else { - $this->realArray[$index] = $value; - } - } - - function offsetUnset($index) { - unset($this->realArray[$index]); - } - - function dump() { - var_dump($this->realArray); - } + public $realArray; + + function __construct() { + $this->realArray = array(); + } + + function offsetExists($index) { + return array_key_exists($this->realArray, $index); + } + + function offsetGet($index) { + return $this->realArray[$index]; + } + + function offsetSet($index, $value) { + if (is_null($index)) { + $this->realArray[] = $value; + } else { + $this->realArray[$index] = $value; + } + } + + function offsetUnset($index) { + unset($this->realArray[$index]); + } + + function dump() { + var_dump($this->realArray); + } } $a = new OverloadedArray; diff --git a/tests/classes/array_access_008.phpt b/tests/classes/array_access_008.phpt index 5185478403..a6f485eb79 100644 --- a/tests/classes/array_access_008.phpt +++ b/tests/classes/array_access_008.phpt @@ -4,27 +4,27 @@ ZE2 ArrayAccess and ASSIGN_OP operators (.=) <?php class Peoples implements ArrayAccess { - public $person; + public $person; - function __construct() { - $this->person = array(array('name'=>'Foo')); - } + function __construct() { + $this->person = array(array('name'=>'Foo')); + } - function offsetExists($index) { - return array_key_exists($this->person, $index); - } + function offsetExists($index) { + return array_key_exists($this->person, $index); + } - function offsetGet($index) { - return $this->person[$index]; - } + function offsetGet($index) { + return $this->person[$index]; + } - function offsetSet($index, $value) { - $this->person[$index] = $value; - } + function offsetSet($index, $value) { + $this->person[$index] = $value; + } - function offsetUnset($index) { - unset($this->person[$index]); - } + function offsetUnset($index) { + unset($this->person[$index]); + } } $people = new Peoples; diff --git a/tests/classes/array_access_009.phpt b/tests/classes/array_access_009.phpt index e9f9ec0a24..a4aeaea56a 100644 --- a/tests/classes/array_access_009.phpt +++ b/tests/classes/array_access_009.phpt @@ -7,92 +7,92 @@ ZE2 ArrayAccess and ArrayProxyAccess, ArrayProxy interface ArrayProxyAccess extends ArrayAccess { - function proxyGet($element); - function proxySet($element, $index, $value); - function proxyUnset($element, $index); + function proxyGet($element); + function proxySet($element, $index, $value); + function proxyUnset($element, $index); } class ArrayProxy implements ArrayAccess { - private $object; - private $element; - - function __construct(ArrayProxyAccess $object, $element) - { - echo __METHOD__ . "($element)\n"; - if (!$object->offsetExists($element)) - { - $object[$element] = array(); - } - $this->object = $object; - $this->element = $element; - } - - function offsetExists($index) { - echo __METHOD__ . "($this->element, $index)\n"; - return array_key_exists($index, $this->object->proxyGet($this->element)); - } - - function offsetGet($index) { - echo __METHOD__ . "($this->element, $index)\n"; - $tmp = $this->object->proxyGet($this->element); - return isset($tmp[$index]) ? $tmp[$index] : NULL; - } - - function offsetSet($index, $value) { - echo __METHOD__ . "($this->element, $index, $value)\n"; - $this->object->proxySet($this->element, $index, $value); - } - - function offsetUnset($index) { - echo __METHOD__ . "($this->element, $index)\n"; - $this->object->proxyUnset($this->element, $index); - } + private $object; + private $element; + + function __construct(ArrayProxyAccess $object, $element) + { + echo __METHOD__ . "($element)\n"; + if (!$object->offsetExists($element)) + { + $object[$element] = array(); + } + $this->object = $object; + $this->element = $element; + } + + function offsetExists($index) { + echo __METHOD__ . "($this->element, $index)\n"; + return array_key_exists($index, $this->object->proxyGet($this->element)); + } + + function offsetGet($index) { + echo __METHOD__ . "($this->element, $index)\n"; + $tmp = $this->object->proxyGet($this->element); + return isset($tmp[$index]) ? $tmp[$index] : NULL; + } + + function offsetSet($index, $value) { + echo __METHOD__ . "($this->element, $index, $value)\n"; + $this->object->proxySet($this->element, $index, $value); + } + + function offsetUnset($index) { + echo __METHOD__ . "($this->element, $index)\n"; + $this->object->proxyUnset($this->element, $index); + } } class Peoples implements ArrayProxyAccess { - public $person; - - function __construct() - { - $this->person = array(array('name'=>'Foo')); - } - - function offsetExists($index) - { - return array_key_exists($index, $this->person); - } - - function offsetGet($index) - { - return new ArrayProxy($this, $index); - } - - function offsetSet($index, $value) - { - $this->person[$index] = $value; - } - - function offsetUnset($index) - { - unset($this->person[$index]); - } - - function proxyGet($element) - { - return $this->person[$element]; - } - - function proxySet($element, $index, $value) - { - $this->person[$element][$index] = $value; - } - - function proxyUnset($element, $index) - { - unset($this->person[$element][$index]); - } + public $person; + + function __construct() + { + $this->person = array(array('name'=>'Foo')); + } + + function offsetExists($index) + { + return array_key_exists($index, $this->person); + } + + function offsetGet($index) + { + return new ArrayProxy($this, $index); + } + + function offsetSet($index, $value) + { + $this->person[$index] = $value; + } + + function offsetUnset($index) + { + unset($this->person[$index]); + } + + function proxyGet($element) + { + return $this->person[$element]; + } + + function proxySet($element, $index, $value) + { + $this->person[$element][$index] = $value; + } + + function proxyUnset($element, $index) + { + unset($this->person[$element][$index]); + } } $people = new Peoples; diff --git a/tests/classes/array_access_010.phpt b/tests/classes/array_access_010.phpt index 24a0c251f6..f91096c713 100644 --- a/tests/classes/array_access_010.phpt +++ b/tests/classes/array_access_010.phpt @@ -7,65 +7,65 @@ ZE2 ArrayAccess and ArrayReferenceProxy with references class ArrayReferenceProxy implements ArrayAccess { - private $object; - private $element; - - function __construct(ArrayAccess $object, array &$element) - { - echo __METHOD__ . "(Array)\n"; - $this->object = $object; - $this->element = &$element; - } - - function offsetExists($index) { - echo __METHOD__ . "($this->element, $index)\n"; - return array_key_exists($index, $this->element); - } - - function offsetGet($index) { - echo __METHOD__ . "(Array, $index)\n"; - return isset($this->element[$index]) ? $this->element[$index] : NULL; - } - - function offsetSet($index, $value) { - echo __METHOD__ . "(Array, $index, $value)\n"; - $this->element[$index] = $value; - } - - function offsetUnset($index) { - echo __METHOD__ . "(Array, $index)\n"; - unset($this->element[$index]); - } + private $object; + private $element; + + function __construct(ArrayAccess $object, array &$element) + { + echo __METHOD__ . "(Array)\n"; + $this->object = $object; + $this->element = &$element; + } + + function offsetExists($index) { + echo __METHOD__ . "($this->element, $index)\n"; + return array_key_exists($index, $this->element); + } + + function offsetGet($index) { + echo __METHOD__ . "(Array, $index)\n"; + return isset($this->element[$index]) ? $this->element[$index] : NULL; + } + + function offsetSet($index, $value) { + echo __METHOD__ . "(Array, $index, $value)\n"; + $this->element[$index] = $value; + } + + function offsetUnset($index) { + echo __METHOD__ . "(Array, $index)\n"; + unset($this->element[$index]); + } } class Peoples implements ArrayAccess { - public $person; - - function __construct() - { - $this->person = array(array('name'=>'Foo')); - } - - function offsetExists($index) - { - return array_key_exists($index, $this->person); - } - - function offsetGet($index) - { - return new ArrayReferenceProxy($this, $this->person[$index]); - } - - function offsetSet($index, $value) - { - $this->person[$index] = $value; - } - - function offsetUnset($index) - { - unset($this->person[$index]); - } + public $person; + + function __construct() + { + $this->person = array(array('name'=>'Foo')); + } + + function offsetExists($index) + { + return array_key_exists($index, $this->person); + } + + function offsetGet($index) + { + return new ArrayReferenceProxy($this, $this->person[$index]); + } + + function offsetSet($index, $value) + { + $this->person[$index] = $value; + } + + function offsetUnset($index) + { + unset($this->person[$index]); + } } $people = new Peoples; diff --git a/tests/classes/array_access_011.phpt b/tests/classes/array_access_011.phpt index 13c69a7974..3250d64deb 100644 --- a/tests/classes/array_access_011.phpt +++ b/tests/classes/array_access_011.phpt @@ -7,74 +7,74 @@ ZE2 ArrayAccess and ArrayAccessReferenceProxy with references to main array class ArrayAccessReferenceProxy implements ArrayAccess { - private $object; - private $oarray; - private $element; - - function __construct(ArrayAccess $object, array &$array, $element) - { - echo __METHOD__ . "($element)\n"; - $this->object = $object; - $this->oarray = &$array; - $this->element = $element; - } - - function offsetExists($index) { - echo __METHOD__ . "($this->element, $index)\n"; - return array_key_exists($index, $this->oarray[$this->element]); - } - - function offsetGet($index) { - echo __METHOD__ . "($this->element, $index)\n"; - return isset($this->oarray[$this->element][$index]) ? $this->oarray[$this->element][$index] : NULL; - } - - function offsetSet($index, $value) { - echo __METHOD__ . "($this->element, $index, $value)\n"; - $this->oarray[$this->element][$index] = $value; - } - - function offsetUnset($index) { - echo __METHOD__ . "($this->element, $index)\n"; - unset($this->oarray[$this->element][$index]); - } + private $object; + private $oarray; + private $element; + + function __construct(ArrayAccess $object, array &$array, $element) + { + echo __METHOD__ . "($element)\n"; + $this->object = $object; + $this->oarray = &$array; + $this->element = $element; + } + + function offsetExists($index) { + echo __METHOD__ . "($this->element, $index)\n"; + return array_key_exists($index, $this->oarray[$this->element]); + } + + function offsetGet($index) { + echo __METHOD__ . "($this->element, $index)\n"; + return isset($this->oarray[$this->element][$index]) ? $this->oarray[$this->element][$index] : NULL; + } + + function offsetSet($index, $value) { + echo __METHOD__ . "($this->element, $index, $value)\n"; + $this->oarray[$this->element][$index] = $value; + } + + function offsetUnset($index) { + echo __METHOD__ . "($this->element, $index)\n"; + unset($this->oarray[$this->element][$index]); + } } class Peoples implements ArrayAccess { - public $person; - - function __construct() - { - $this->person = array(array('name'=>'Foo')); - } - - function offsetExists($index) - { - return array_key_exists($index, $this->person); - } - - function offsetGet($index) - { - if (is_array($this->person[$index])) - { - return new ArrayAccessReferenceProxy($this, $this->person, $index); - } - else - { - return $this->person[$index]; - } - } - - function offsetSet($index, $value) - { - $this->person[$index] = $value; - } - - function offsetUnset($index) - { - unset($this->person[$index]); - } + public $person; + + function __construct() + { + $this->person = array(array('name'=>'Foo')); + } + + function offsetExists($index) + { + return array_key_exists($index, $this->person); + } + + function offsetGet($index) + { + if (is_array($this->person[$index])) + { + return new ArrayAccessReferenceProxy($this, $this->person, $index); + } + else + { + return $this->person[$index]; + } + } + + function offsetSet($index, $value) + { + $this->person[$index] = $value; + } + + function offsetUnset($index) + { + unset($this->person[$index]); + } } $people = new Peoples; diff --git a/tests/classes/array_access_012.phpt b/tests/classes/array_access_012.phpt index f10a67a6c7..e2fba54781 100644 --- a/tests/classes/array_access_012.phpt +++ b/tests/classes/array_access_012.phpt @@ -4,21 +4,21 @@ ZE2 ArrayAccess cannot assign by reference <?php class ArrayAccessImpl implements ArrayAccess { - private $data = array(); + private $data = array(); - public function offsetUnset($index) {} + public function offsetUnset($index) {} - public function offsetSet($index, $value) { - $this->data[$index] = $value; - } + public function offsetSet($index, $value) { + $this->data[$index] = $value; + } - public function offsetGet($index) { - return $this->data[$index]; - } + public function offsetGet($index) { + return $this->data[$index]; + } - public function offsetExists($index) { - return isset($this->data[$index]); - } + public function offsetExists($index) { + return isset($this->data[$index]); + } } $data = new ArrayAccessImpl(); diff --git a/tests/classes/array_access_013.phpt b/tests/classes/array_access_013.phpt index 8b24ca9017..bcb6a5e00b 100644 --- a/tests/classes/array_access_013.phpt +++ b/tests/classes/array_access_013.phpt @@ -15,7 +15,7 @@ $t = new Test; try { - echo isset($t[0]); + echo isset($t[0]); } catch(Exception $e) { @@ -24,7 +24,7 @@ catch(Exception $e) try { - echo $t[0]; + echo $t[0]; } catch(Exception $e) { @@ -33,7 +33,7 @@ catch(Exception $e) try { - $t[0] = 1; + $t[0] = 1; } catch(Exception $e) { @@ -42,7 +42,7 @@ catch(Exception $e) try { - unset($t[0]); + unset($t[0]); } catch(Exception $e) { diff --git a/tests/classes/array_conversion_keys.phpt b/tests/classes/array_conversion_keys.phpt index 6c642f1f85..2267de06d0 100644 --- a/tests/classes/array_conversion_keys.phpt +++ b/tests/classes/array_conversion_keys.phpt @@ -4,9 +4,9 @@ Verifies the correct conversion of objects to arrays <?php class foo { - private $private = 'private'; - protected $protected = 'protected'; - public $public = 'public'; + private $private = 'private'; + protected $protected = 'protected'; + public $public = 'public'; } var_export((array) new foo); ?> diff --git a/tests/classes/assign_op_property_001.phpt b/tests/classes/assign_op_property_001.phpt index cd5fcff469..71f75d2c71 100644 --- a/tests/classes/assign_op_property_001.phpt +++ b/tests/classes/assign_op_property_001.phpt @@ -4,19 +4,19 @@ ZE2 assign_op property of overloaded object <?php class Test { - private $real_a = 2; + private $real_a = 2; - function __set($property, $value) { - if ($property == "a") { - $this->real_a = $value; - } - } + function __set($property, $value) { + if ($property == "a") { + $this->real_a = $value; + } + } - function __get($property) { - if ($property == "a") { - return $this->real_a; - } - } + function __get($property) { + if ($property == "a") { + return $this->real_a; + } + } } $obj = new Test; diff --git a/tests/classes/autoload_001.phpt b/tests/classes/autoload_001.phpt index bf3307d234..cdea16f689 100644 --- a/tests/classes/autoload_001.phpt +++ b/tests/classes/autoload_001.phpt @@ -8,8 +8,8 @@ ZE2 Autoload and class_exists <?php spl_autoload_register(function ($class_name) { - require_once(__DIR__ . '/' . $class_name . '.inc'); - echo 'autoload(' . $class_name . ")\n"; + require_once(__DIR__ . '/' . $class_name . '.inc'); + echo 'autoload(' . $class_name . ")\n"; }); var_dump(class_exists('autoload_root')); diff --git a/tests/classes/autoload_002.phpt b/tests/classes/autoload_002.phpt index 63364c2082..752a9928af 100644 --- a/tests/classes/autoload_002.phpt +++ b/tests/classes/autoload_002.phpt @@ -8,8 +8,8 @@ ZE2 Autoload and get_class_methods <?php spl_autoload_register(function ($class_name) { - require_once(__DIR__ . '/' . $class_name . '.inc'); - echo 'autoload(' . $class_name . ")\n"; + require_once(__DIR__ . '/' . $class_name . '.inc'); + echo 'autoload(' . $class_name . ")\n"; }); var_dump(get_class_methods('autoload_root')); diff --git a/tests/classes/autoload_003.phpt b/tests/classes/autoload_003.phpt index 7680509b3f..05887433c3 100644 --- a/tests/classes/autoload_003.phpt +++ b/tests/classes/autoload_003.phpt @@ -8,8 +8,8 @@ ZE2 Autoload and derived classes <?php spl_autoload_register(function ($class_name) { - require_once(__DIR__ . '/' . $class_name . '.inc'); - echo 'autoload(' . $class_name . ")\n"; + require_once(__DIR__ . '/' . $class_name . '.inc'); + echo 'autoload(' . $class_name . ")\n"; }); var_dump(class_exists('autoload_derived')); diff --git a/tests/classes/autoload_004.phpt b/tests/classes/autoload_004.phpt index 4fc61a1846..8539e07433 100644 --- a/tests/classes/autoload_004.phpt +++ b/tests/classes/autoload_004.phpt @@ -8,9 +8,9 @@ ZE2 Autoload and recursion <?php spl_autoload_register(function ($class_name) { - var_dump(class_exists($class_name)); - require_once(__DIR__ . '/' . $class_name . '.inc'); - echo 'autoload(' . $class_name . ")\n"; + var_dump(class_exists($class_name)); + require_once(__DIR__ . '/' . $class_name . '.inc'); + echo 'autoload(' . $class_name . ")\n"; }); var_dump(class_exists('autoload_derived')); diff --git a/tests/classes/autoload_005.phpt b/tests/classes/autoload_005.phpt index 408fad259e..72d83b88f6 100644 --- a/tests/classes/autoload_005.phpt +++ b/tests/classes/autoload_005.phpt @@ -8,9 +8,9 @@ ZE2 Autoload from destructor <?php spl_autoload_register(function ($class_name) { - var_dump(class_exists($class_name, false)); - require_once(__DIR__ . '/' . $class_name . '.inc'); - echo 'autoload(' . $class_name . ")\n"; + var_dump(class_exists($class_name, false)); + require_once(__DIR__ . '/' . $class_name . '.inc'); + echo 'autoload(' . $class_name . ")\n"; }); var_dump(class_exists('autoload_derived', false)); diff --git a/tests/classes/autoload_006.phpt b/tests/classes/autoload_006.phpt index fca24441b5..f17011ca5e 100644 --- a/tests/classes/autoload_006.phpt +++ b/tests/classes/autoload_006.phpt @@ -8,8 +8,8 @@ ZE2 Autoload from destructor <?php spl_autoload_register(function ($class_name) { - require_once(__DIR__ . '/' . strtolower($class_name) . '.inc'); - echo 'autoload(' . $class_name . ")\n"; + require_once(__DIR__ . '/' . strtolower($class_name) . '.inc'); + echo 'autoload(' . $class_name . ")\n"; }); var_dump(interface_exists('autoload_interface', false)); diff --git a/tests/classes/autoload_021.phpt b/tests/classes/autoload_021.phpt index f3dd8ff26d..673813cb2e 100644 --- a/tests/classes/autoload_021.phpt +++ b/tests/classes/autoload_021.phpt @@ -3,7 +3,7 @@ Validation of class names in the autoload process --FILE-- <?php spl_autoload_register(function ($name) { - echo "$name\n"; + echo "$name\n"; }); $a = "../BUG"; $x = new $a; diff --git a/tests/classes/autoload_implements.inc b/tests/classes/autoload_implements.inc index 55fcc3cd9f..e5f19c0680 100644 --- a/tests/classes/autoload_implements.inc +++ b/tests/classes/autoload_implements.inc @@ -1,10 +1,10 @@ <?php class autoload_implements implements autoload_interface { - function testFunction() - { - return true; - } + function testFunction() + { + return true; + } } ?> diff --git a/tests/classes/autoload_interface.inc b/tests/classes/autoload_interface.inc index e6a416e721..6e696f36bf 100644 --- a/tests/classes/autoload_interface.inc +++ b/tests/classes/autoload_interface.inc @@ -1,7 +1,7 @@ <?php interface autoload_interface { - function testFunction(); + function testFunction(); } ?> diff --git a/tests/classes/autoload_root.inc b/tests/classes/autoload_root.inc index 98149c59b5..44200a8d8e 100644 --- a/tests/classes/autoload_root.inc +++ b/tests/classes/autoload_root.inc @@ -1,10 +1,10 @@ <?php class autoload_root { - function testFunction() - { - return true; - } + function testFunction() + { + return true; + } } ?> diff --git a/tests/classes/bug26737.phpt b/tests/classes/bug26737.phpt index e190318ffd..ac7b67f5c7 100644 --- a/tests/classes/bug26737.phpt +++ b/tests/classes/bug26737.phpt @@ -4,14 +4,14 @@ Bug #26737 (Protected and private variables are not saved on serialization when <?php class foo { - private $private = 'private'; - protected $protected = 'protected'; - public $public = 'public'; + private $private = 'private'; + protected $protected = 'protected'; + public $public = 'public'; - public function __sleep() - { - return array('private', 'protected', 'public', 'no_such'); - } + public function __sleep() + { + return array('private', 'protected', 'public', 'no_such'); + } } $foo = new foo(); $data = serialize($foo); diff --git a/tests/classes/bug27468.phpt b/tests/classes/bug27468.phpt index 1c54fa61ce..4ef8d44a61 100644 --- a/tests/classes/bug27468.phpt +++ b/tests/classes/bug27468.phpt @@ -3,9 +3,9 @@ Bug #27468 (foreach in __destruct() causes segfault) --FILE-- <?php class foo { - function __destruct() { - foreach ($this->x as $x); - } + function __destruct() { + foreach ($this->x as $x); + } } new foo(); echo 'OK'; diff --git a/tests/classes/bug75765.phpt b/tests/classes/bug75765.phpt index 650ca65e96..b3c8a17f6f 100644 --- a/tests/classes/bug75765.phpt +++ b/tests/classes/bug75765.phpt @@ -4,11 +4,11 @@ Ensure that extending of undefined class throws the exception <?php try { - class A extends B {} + class A extends B {} } catch (Error $e) { - var_dump(class_exists('A')); - var_dump(class_exists('B')); - throw $e; + var_dump(class_exists('A')); + var_dump(class_exists('B')); + throw $e; } ?> diff --git a/tests/classes/class_abstract.phpt b/tests/classes/class_abstract.phpt index d852884d52..2d5b4630c4 100644 --- a/tests/classes/class_abstract.phpt +++ b/tests/classes/class_abstract.phpt @@ -4,9 +4,9 @@ ZE2 An abstract class cannot be instantiated <?php abstract class base { - function show() { - echo "base\n"; - } + function show() { + echo "base\n"; + } } class derived extends base { diff --git a/tests/classes/class_final.phpt b/tests/classes/class_final.phpt index 45cbc72751..885b565952 100644 --- a/tests/classes/class_final.phpt +++ b/tests/classes/class_final.phpt @@ -4,9 +4,9 @@ ZE2 A final class cannot be inherited <?php final class base { - function show() { - echo "base\n"; - } + function show() { + echo "base\n"; + } } $t = new base(); diff --git a/tests/classes/clone_001.phpt b/tests/classes/clone_001.phpt index e1d200be26..ac026e551a 100644 --- a/tests/classes/clone_001.phpt +++ b/tests/classes/clone_001.phpt @@ -3,9 +3,9 @@ ZE2 object cloning, 1 --FILE-- <?php class test { - public $p1 = 1; - public $p2 = 2; - public $p3; + public $p1 = 1; + public $p2 = 2; + public $p3; }; $obj = new test; diff --git a/tests/classes/clone_002.phpt b/tests/classes/clone_002.phpt index b2f73b4b80..7bca4392b7 100644 --- a/tests/classes/clone_002.phpt +++ b/tests/classes/clone_002.phpt @@ -3,11 +3,11 @@ ZE2 object cloning, 2 --FILE-- <?php class test { - public $p1 = 1; - public $p2 = 2; - public $p3; - public function __clone() { - } + public $p1 = 1; + public $p2 = 2; + public $p3; + public function __clone() { + } }; $obj = new test; diff --git a/tests/classes/clone_003.phpt b/tests/classes/clone_003.phpt index e595a59066..30d4cc549a 100644 --- a/tests/classes/clone_003.phpt +++ b/tests/classes/clone_003.phpt @@ -3,24 +3,24 @@ ZE2 object cloning, 3 --FILE-- <?php class base { - protected $p1 = 'base:1'; - public $p2 = 'base:2'; - public $p3 = 'base:3'; - public $p4 = 'base:4'; - public $p5 = 'base:5'; - private $p6 = 'base:6'; - public function __clone() { - } + protected $p1 = 'base:1'; + public $p2 = 'base:2'; + public $p3 = 'base:3'; + public $p4 = 'base:4'; + public $p5 = 'base:5'; + private $p6 = 'base:6'; + public function __clone() { + } }; class test extends base { - public $p1 = 'test:1'; - public $p3 = 'test:3'; - public $p4 = 'test:4'; - public $p5 = 'test:5'; - public function __clone() { - $this->p5 = 'clone:5'; - } + public $p1 = 'test:1'; + public $p3 = 'test:3'; + public $p4 = 'test:4'; + public $p5 = 'test:5'; + public function __clone() { + $this->p5 = 'clone:5'; + } } $obj = new test; diff --git a/tests/classes/clone_004.phpt b/tests/classes/clone_004.phpt index 88ad916bb4..610a00e702 100644 --- a/tests/classes/clone_004.phpt +++ b/tests/classes/clone_004.phpt @@ -16,7 +16,7 @@ class test extends base { public function __clone() {} public function show() { - var_dump($this); + var_dump($this); } } diff --git a/tests/classes/clone_006.phpt b/tests/classes/clone_006.phpt index d8a6140358..16f6bfe508 100644 --- a/tests/classes/clone_006.phpt +++ b/tests/classes/clone_006.phpt @@ -6,16 +6,16 @@ error_reporting=2047 <?php class MyCloneable { - static $id = 0; + static $id = 0; - function __construct() { - $this->id = self::$id++; - } + function __construct() { + $this->id = self::$id++; + } - function __clone() { - $this->address = "New York"; - $this->id = self::$id++; - } + function __clone() { + $this->address = "New York"; + $this->id = self::$id++; + } } $original = new MyCloneable(); diff --git a/tests/classes/constants_basic_003.inc b/tests/classes/constants_basic_003.inc index 17e067b534..c7439f460a 100644 --- a/tests/classes/constants_basic_003.inc +++ b/tests/classes/constants_basic_003.inc @@ -1,5 +1,5 @@ <?php class A { - const MY_CONST = "hello from A"; + const MY_CONST = "hello from A"; } ?> diff --git a/tests/classes/constants_comments_001.phpt b/tests/classes/constants_comments_001.phpt index 297ad9f956..46bf4fafff 100644 --- a/tests/classes/constants_comments_001.phpt +++ b/tests/classes/constants_comments_001.phpt @@ -5,22 +5,22 @@ opcache.save_comments=1 --FILE-- <?php class X { - /** comment X1 */ - const X1 = 1; - const X2 = 2; - /** comment X3 */ - const X3 = 3; + /** comment X1 */ + const X1 = 1; + const X2 = 2; + /** comment X3 */ + const X3 = 3; } class Y extends X { - /** comment Y1 */ - const Y1 = 1; - const Y2 = 2; - /** comment Y3 */ - const Y3 = 3; + /** comment Y1 */ + const Y1 = 1; + const Y2 = 2; + /** comment Y3 */ + const Y3 = 3; } $r = new ReflectionClass('Y'); foreach ($r->getReflectionConstants() as $rc) { - echo $rc->getName() . " : " . $rc->getDocComment() . "\n"; + echo $rc->getName() . " : " . $rc->getDocComment() . "\n"; } diff --git a/tests/classes/constants_scope_001.phpt b/tests/classes/constants_scope_001.phpt index e9635d8d23..54fc8c4a00 100644 --- a/tests/classes/constants_scope_001.phpt +++ b/tests/classes/constants_scope_001.phpt @@ -4,20 +4,20 @@ ZE2 class constants and scope <?php class ErrorCodes { - const FATAL = "Fatal error\n"; - const WARNING = "Warning\n"; - const INFO = "Informational message\n"; + const FATAL = "Fatal error\n"; + const WARNING = "Warning\n"; + const INFO = "Informational message\n"; - static function print_fatal_error_codes() { - echo "self::FATAL = " . self::FATAL; + static function print_fatal_error_codes() { + echo "self::FATAL = " . self::FATAL; } } class ErrorCodesDerived extends ErrorCodes { - const FATAL = "Worst error\n"; - static function print_fatal_error_codes() { - echo "self::FATAL = " . self::FATAL; - echo "parent::FATAL = " . parent::FATAL; + const FATAL = "Worst error\n"; + static function print_fatal_error_codes() { + echo "self::FATAL = " . self::FATAL; + echo "parent::FATAL = " . parent::FATAL; } } diff --git a/tests/classes/constants_visibility_001.phpt b/tests/classes/constants_visibility_001.phpt index a5eeb47f37..b57fd82127 100644 --- a/tests/classes/constants_visibility_001.phpt +++ b/tests/classes/constants_visibility_001.phpt @@ -3,13 +3,13 @@ Class public constant visibility --FILE-- <?php class A { - public const publicConst = 'publicConst'; - static function staticConstDump() { - var_dump(self::publicConst); - } - function constDump() { - var_dump(self::publicConst); - } + public const publicConst = 'publicConst'; + static function staticConstDump() { + var_dump(self::publicConst); + } + function constDump() { + var_dump(self::publicConst); + } } var_dump(A::publicConst); diff --git a/tests/classes/constants_visibility_002.phpt b/tests/classes/constants_visibility_002.phpt index 56c70a99a1..58c35b7a4a 100644 --- a/tests/classes/constants_visibility_002.phpt +++ b/tests/classes/constants_visibility_002.phpt @@ -3,13 +3,13 @@ Class protected constant visibility --FILE-- <?php class A { - protected const protectedConst = 'protectedConst'; - static function staticConstDump() { - var_dump(self::protectedConst); - } - function constDump() { - var_dump(self::protectedConst); - } + protected const protectedConst = 'protectedConst'; + static function staticConstDump() { + var_dump(self::protectedConst); + } + function constDump() { + var_dump(self::protectedConst); + } } A::staticConstDump(); diff --git a/tests/classes/constants_visibility_003.phpt b/tests/classes/constants_visibility_003.phpt index fe9bb6f6a1..7492af90df 100644 --- a/tests/classes/constants_visibility_003.phpt +++ b/tests/classes/constants_visibility_003.phpt @@ -3,13 +3,13 @@ Class private constant visibility --FILE-- <?php class A { - private const privateConst = 'privateConst'; - static function staticConstDump() { - var_dump(self::privateConst); - } - function constDump() { - var_dump(self::privateConst); - } + private const privateConst = 'privateConst'; + static function staticConstDump() { + var_dump(self::privateConst); + } + function constDump() { + var_dump(self::privateConst); + } } A::staticConstDump(); diff --git a/tests/classes/constants_visibility_004.phpt b/tests/classes/constants_visibility_004.phpt index 983b2e247b..d35597b365 100644 --- a/tests/classes/constants_visibility_004.phpt +++ b/tests/classes/constants_visibility_004.phpt @@ -3,16 +3,16 @@ Only public and protected class constants should be inherited --FILE-- <?php class A { - public const X = 1; - protected const Y = 2; - private const Z = 3; + public const X = 1; + protected const Y = 2; + private const Z = 3; } class B extends A { - static public function checkConstants() { - var_dump(self::X); - var_dump(self::Y); - var_dump(self::Z); - } + static public function checkConstants() { + var_dump(self::X); + var_dump(self::Y); + var_dump(self::Z); + } } B::checkConstants(); diff --git a/tests/classes/constants_visibility_005.phpt b/tests/classes/constants_visibility_005.phpt index 813009c675..ff5c10ca13 100644 --- a/tests/classes/constants_visibility_005.phpt +++ b/tests/classes/constants_visibility_005.phpt @@ -3,7 +3,7 @@ Static constants are not allowed --FILE-- <?php class A { - static const X = 1; + static const X = 1; } ?> --EXPECTF-- diff --git a/tests/classes/constants_visibility_006.phpt b/tests/classes/constants_visibility_006.phpt index a3317cca8a..46300abf40 100644 --- a/tests/classes/constants_visibility_006.phpt +++ b/tests/classes/constants_visibility_006.phpt @@ -3,7 +3,7 @@ Abstract constants are not allowed --FILE-- <?php class A { - abstract const X = 1; + abstract const X = 1; } ?> --EXPECTF-- diff --git a/tests/classes/constants_visibility_007.phpt b/tests/classes/constants_visibility_007.phpt index f1b040c5c3..37b5285586 100644 --- a/tests/classes/constants_visibility_007.phpt +++ b/tests/classes/constants_visibility_007.phpt @@ -3,7 +3,7 @@ Final constants are not allowed --FILE-- <?php class A { - final const X = 1; + final const X = 1; } ?> --EXPECTF-- diff --git a/tests/classes/constants_visibility_error_001.phpt b/tests/classes/constants_visibility_error_001.phpt index 397dd24882..35ccf1e83d 100644 --- a/tests/classes/constants_visibility_error_001.phpt +++ b/tests/classes/constants_visibility_error_001.phpt @@ -3,7 +3,7 @@ Class private constant visibility error --FILE-- <?php class A { - private const privateConst = 'privateConst'; + private const privateConst = 'privateConst'; } var_dump(A::privateConst); diff --git a/tests/classes/constants_visibility_error_002.phpt b/tests/classes/constants_visibility_error_002.phpt index 2980b52c37..2068862942 100644 --- a/tests/classes/constants_visibility_error_002.phpt +++ b/tests/classes/constants_visibility_error_002.phpt @@ -3,7 +3,7 @@ Class protected constant visibility error --FILE-- <?php class A { - protected const protectedConst = 'protectedConst'; + protected const protectedConst = 'protectedConst'; } var_dump(A::protectedConst); diff --git a/tests/classes/constants_visibility_error_003.phpt b/tests/classes/constants_visibility_error_003.phpt index 6f62069c2e..c7a8b3139f 100644 --- a/tests/classes/constants_visibility_error_003.phpt +++ b/tests/classes/constants_visibility_error_003.phpt @@ -4,11 +4,11 @@ A redeclared class constant must have the same or higher visibility <?php class A { - public const publicConst = 0; + public const publicConst = 0; } class B extends A { - protected const publicConst = 1; + protected const publicConst = 1; } --EXPECTF-- Fatal error: Access level to B::publicConst must be public (as in class A) in %s on line 9 diff --git a/tests/classes/constants_visibility_error_004.phpt b/tests/classes/constants_visibility_error_004.phpt index 65bfbd3c2b..6fde322cdd 100644 --- a/tests/classes/constants_visibility_error_004.phpt +++ b/tests/classes/constants_visibility_error_004.phpt @@ -4,11 +4,11 @@ A redeclared class constant must have the same or higher visibility <?php class A { - protected const protectedConst = 0; + protected const protectedConst = 0; } class B extends A { - private const protectedConst = 1; + private const protectedConst = 1; } --EXPECTF-- Fatal error: Access level to B::protectedConst must be protected (as in class A) or weaker in %s on line 9 diff --git a/tests/classes/ctor_dtor.phpt b/tests/classes/ctor_dtor.phpt index bcac143025..3a40f7f568 100644 --- a/tests/classes/ctor_dtor.phpt +++ b/tests/classes/ctor_dtor.phpt @@ -4,21 +4,21 @@ ZE2 The new constructor/destructor is called <?php class early { - function __construct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - } - function __destruct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - } + function __construct() { + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + } + function __destruct() { + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + } } class late { - function __construct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - } - function __destruct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - } + function __construct() { + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + } + function __destruct() { + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + } } $t = new early(); diff --git a/tests/classes/ctor_dtor_inheritance.phpt b/tests/classes/ctor_dtor_inheritance.phpt index 1f3d3483d0..bd1414c8b8 100644 --- a/tests/classes/ctor_dtor_inheritance.phpt +++ b/tests/classes/ctor_dtor_inheritance.phpt @@ -9,38 +9,38 @@ ZE2 A derived class can use the inherited constructor/destructor // - base class constructors/destructors know the instantiated class name class base { - public $name; + public $name; - function __construct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - $this->name = 'base'; - print_r($this); - } + function __construct() { + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + $this->name = 'base'; + print_r($this); + } - function __destruct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - print_r($this); - } + function __destruct() { + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + print_r($this); + } } class derived extends base { - public $other; + public $other; - function __construct() { - $this->name = 'init'; - $this->other = 'other'; - print_r($this); - parent::__construct(); - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - $this->name = 'derived'; - print_r($this); - } + function __construct() { + $this->name = 'init'; + $this->other = 'other'; + print_r($this); + parent::__construct(); + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + $this->name = 'derived'; + print_r($this); + } - function __destruct() { - parent::__destruct(); - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - print_r($this); - } + function __destruct() { + parent::__destruct(); + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + print_r($this); + } } echo "Testing class base\n"; diff --git a/tests/classes/ctor_in_interface_01.phpt b/tests/classes/ctor_in_interface_01.phpt index fc97371f6f..e1ef717f90 100644 --- a/tests/classes/ctor_in_interface_01.phpt +++ b/tests/classes/ctor_in_interface_01.phpt @@ -4,14 +4,14 @@ ZE2 A class constructor must keep the signature of an interface <?php interface constr { - function __construct(); + function __construct(); } class implem implements constr { - function __construct($a) - { - } + function __construct($a) + { + } } ?> diff --git a/tests/classes/ctor_in_interface_02.phpt b/tests/classes/ctor_in_interface_02.phpt index 08e6f36e0e..3484432eae 100644 --- a/tests/classes/ctor_in_interface_02.phpt +++ b/tests/classes/ctor_in_interface_02.phpt @@ -4,7 +4,7 @@ ZE2 A class constructor must keep the signature of all interfaces <?php interface constr1 { - function __construct(); + function __construct(); } interface constr2 extends constr1 @@ -13,21 +13,21 @@ interface constr2 extends constr1 class implem12 implements constr2 { - function __construct() - { - } + function __construct() + { + } } interface constr3 { - function __construct($a); + function __construct($a); } class implem13 implements constr1, constr3 { - function __construct() - { - } + function __construct() + { + } } ?> --EXPECTF-- diff --git a/tests/classes/ctor_in_interface_03.phpt b/tests/classes/ctor_in_interface_03.phpt index 25d7f9dc82..42c70764b9 100644 --- a/tests/classes/ctor_in_interface_03.phpt +++ b/tests/classes/ctor_in_interface_03.phpt @@ -4,7 +4,7 @@ ZE2 A class constructor must keep the signature of base class interfaces <?php interface constr { - function __construct(); + function __construct(); } abstract class implem implements constr @@ -13,9 +13,9 @@ abstract class implem implements constr class derived extends implem { - function __construct($a) - { - } + function __construct($a) + { + } } ?> diff --git a/tests/classes/ctor_in_interface_04.phpt b/tests/classes/ctor_in_interface_04.phpt index 0b07f9a1ca..2bc532f434 100644 --- a/tests/classes/ctor_in_interface_04.phpt +++ b/tests/classes/ctor_in_interface_04.phpt @@ -4,21 +4,21 @@ ZE2 A class constructor must keep the signature of base class interfaces <?php interface constr { - function __construct(); + function __construct(); } class implem implements constr { - function __construct() - { - } + function __construct() + { + } } class derived extends implem { - function __construct($a) - { - } + function __construct($a) + { + } } ?> diff --git a/tests/classes/ctor_visibility.phpt b/tests/classes/ctor_visibility.phpt index 685c7dbe41..6316ed5e12 100644 --- a/tests/classes/ctor_visibility.phpt +++ b/tests/classes/ctor_visibility.phpt @@ -13,16 +13,16 @@ class Test class Derived extends Test { - function __construct() - { + function __construct() + { echo __METHOD__ . "()\n"; - parent::__construct(); - } + parent::__construct(); + } - static function f() - { - new Derived; - } + static function f() + { + new Derived; + } } Derived::f(); @@ -34,26 +34,26 @@ class TestPriv echo __METHOD__ . "()\n"; } - static function f() - { - new TestPriv; - } + static function f() + { + new TestPriv; + } } TestPriv::f(); class DerivedPriv extends TestPriv { - function __construct() - { + function __construct() + { echo __METHOD__ . "()\n"; - parent::__construct(); - } + parent::__construct(); + } - static function f() - { - new DerivedPriv; - } + static function f() + { + new DerivedPriv; + } } DerivedPriv::f(); diff --git a/tests/classes/dereferencing_001.phpt b/tests/classes/dereferencing_001.phpt index e7e90cf5e3..4ec2a87659 100644 --- a/tests/classes/dereferencing_001.phpt +++ b/tests/classes/dereferencing_001.phpt @@ -4,25 +4,25 @@ ZE2 dereferencing of objects from methods <?php class Name { - function __construct($_name) { - $this->name = $_name; - } + function __construct($_name) { + $this->name = $_name; + } - function display() { - echo $this->name . "\n"; - } + function display() { + echo $this->name . "\n"; + } } class Person { - private $name; + private $name; - function __construct($_name, $_address) { - $this->name = new Name($_name); - } + function __construct($_name, $_address) { + $this->name = new Name($_name); + } - function getName() { - return $this->name; - } + function getName() { + return $this->name; + } } $person = new Person("John", "New York"); diff --git a/tests/classes/destructor_and_exceptions.phpt b/tests/classes/destructor_and_exceptions.phpt index f58bb8de7f..0f51a21a09 100644 --- a/tests/classes/destructor_and_exceptions.phpt +++ b/tests/classes/destructor_and_exceptions.phpt @@ -5,48 +5,48 @@ ZE2 catch exception thrown in destructor class FailClass { - public $fatal; + public $fatal; - function __destruct() - { - echo __METHOD__ . "\n"; - throw new exception("FailClass"); - echo "Done: " . __METHOD__ . "\n"; - } + function __destruct() + { + echo __METHOD__ . "\n"; + throw new exception("FailClass"); + echo "Done: " . __METHOD__ . "\n"; + } } try { - $a = new FailClass; - unset($a); + $a = new FailClass; + unset($a); } catch(Exception $e) { - echo "Caught: " . $e->getMessage() . "\n"; + echo "Caught: " . $e->getMessage() . "\n"; } class FatalException extends Exception { - function __construct($what) - { - echo __METHOD__ . "\n"; - $o = new FailClass; - unset($o); - echo "Done: " . __METHOD__ . "\n"; - } + function __construct($what) + { + echo __METHOD__ . "\n"; + $o = new FailClass; + unset($o); + echo "Done: " . __METHOD__ . "\n"; + } } try { - throw new FatalException("Damn"); + throw new FatalException("Damn"); } catch(Exception $e) { - echo "Caught Exception: " . $e->getMessage() . "\n"; + echo "Caught Exception: " . $e->getMessage() . "\n"; } catch(FatalException $e) { - echo "Caught FatalException: " . $e->getMessage() . "\n"; + echo "Caught FatalException: " . $e->getMessage() . "\n"; } ?> diff --git a/tests/classes/destructor_and_globals.phpt b/tests/classes/destructor_and_globals.phpt index 1276d28348..5e0773b00c 100644 --- a/tests/classes/destructor_and_globals.phpt +++ b/tests/classes/destructor_and_globals.phpt @@ -30,8 +30,8 @@ class counter { } static public function destroy(&$obj) { - $obj = NULL; - } + $obj = NULL; + } } Show(); $obj1 = new counter; diff --git a/tests/classes/destructor_visibility_001.phpt b/tests/classes/destructor_visibility_001.phpt index b48d000f91..41def0e525 100644 --- a/tests/classes/destructor_visibility_001.phpt +++ b/tests/classes/destructor_visibility_001.phpt @@ -4,9 +4,9 @@ ZE2 Ensuring destructor visibility <?php class Base { - private function __destruct() { - echo __METHOD__ . "\n"; - } + private function __destruct() { + echo __METHOD__ . "\n"; + } } class Derived extends Base { diff --git a/tests/classes/destructor_visibility_002.phpt b/tests/classes/destructor_visibility_002.phpt index 96cf275a7c..227cc1aff0 100644 --- a/tests/classes/destructor_visibility_002.phpt +++ b/tests/classes/destructor_visibility_002.phpt @@ -4,9 +4,9 @@ ZE2 Ensuring destructor visibility <?php class Base { - private function __destruct() { - echo __METHOD__ . "\n"; - } + private function __destruct() { + echo __METHOD__ . "\n"; + } } class Derived extends Base { diff --git a/tests/classes/destructor_visibility_003.phpt b/tests/classes/destructor_visibility_003.phpt index 2af03d7441..78551a7e01 100644 --- a/tests/classes/destructor_visibility_003.phpt +++ b/tests/classes/destructor_visibility_003.phpt @@ -4,15 +4,15 @@ ZE2 Ensuring destructor visibility <?php class Base { - private function __destruct() { - echo __METHOD__ . "\n"; - } + private function __destruct() { + echo __METHOD__ . "\n"; + } } class Derived extends Base { - public function __destruct() { - echo __METHOD__ . "\n"; - } + public function __destruct() { + echo __METHOD__ . "\n"; + } } $obj = new Derived; diff --git a/tests/classes/factory_001.phpt b/tests/classes/factory_001.phpt index 45f97331a5..96af2acef7 100644 --- a/tests/classes/factory_001.phpt +++ b/tests/classes/factory_001.phpt @@ -4,24 +4,24 @@ ZE2 factory objects <?php class Circle { - function draw() { - echo "Circle\n"; - } + function draw() { + echo "Circle\n"; + } } class Square { - function draw() { - print "Square\n"; - } + function draw() { + print "Square\n"; + } } function ShapeFactoryMethod($shape) { - switch ($shape) { - case "Circle": - return new Circle(); - case "Square": - return new Square(); - } + switch ($shape) { + case "Circle": + return new Circle(); + case "Square": + return new Square(); + } } ShapeFactoryMethod("Circle")->draw(); diff --git a/tests/classes/factory_and_singleton_001.phpt b/tests/classes/factory_and_singleton_001.phpt index dbbf07cfad..ead7d480cd 100644 --- a/tests/classes/factory_and_singleton_001.phpt +++ b/tests/classes/factory_and_singleton_001.phpt @@ -27,7 +27,7 @@ class test { } protected function __destruct() { - test::$cnt--; + test::$cnt--; } public function get() { diff --git a/tests/classes/factory_and_singleton_002.phpt b/tests/classes/factory_and_singleton_002.phpt index 6748321242..c4132f9d38 100644 --- a/tests/classes/factory_and_singleton_002.phpt +++ b/tests/classes/factory_and_singleton_002.phpt @@ -27,7 +27,7 @@ class test { } protected function __destruct() { - test::$cnt--; + test::$cnt--; } public function get() { diff --git a/tests/classes/factory_and_singleton_009.phpt b/tests/classes/factory_and_singleton_009.phpt index c1cfcbdcdf..7795ea4a79 100644 --- a/tests/classes/factory_and_singleton_009.phpt +++ b/tests/classes/factory_and_singleton_009.phpt @@ -5,7 +5,7 @@ ZE2 factory and singleton, test 9 class test { protected function __destruct() { - echo __METHOD__ . "\n"; + echo __METHOD__ . "\n"; } } diff --git a/tests/classes/factory_and_singleton_010.phpt b/tests/classes/factory_and_singleton_010.phpt index 9466fe55e4..a816b3f60f 100644 --- a/tests/classes/factory_and_singleton_010.phpt +++ b/tests/classes/factory_and_singleton_010.phpt @@ -5,7 +5,7 @@ ZE2 factory and singleton, test 10 class test { private function __destruct() { - echo __METHOD__ . "\n"; + echo __METHOD__ . "\n"; } } diff --git a/tests/classes/final.phpt b/tests/classes/final.phpt index 0e100d2304..75be8ec2f4 100644 --- a/tests/classes/final.phpt +++ b/tests/classes/final.phpt @@ -4,18 +4,18 @@ ZE2 A method may be redeclared final <?php class first { - function show() { - echo "Call to function first::show()\n"; - } + function show() { + echo "Call to function first::show()\n"; + } } $t = new first(); $t->show(); class second extends first { - final function show() { - echo "Call to function second::show()\n"; - } + final function show() { + echo "Call to function second::show()\n"; + } } $t2 = new second(); diff --git a/tests/classes/final_abstract.phpt b/tests/classes/final_abstract.phpt index 229ae896b0..66f5c87a6f 100644 --- a/tests/classes/final_abstract.phpt +++ b/tests/classes/final_abstract.phpt @@ -4,7 +4,7 @@ ZE2 A final method cannot be abstract <?php class fail { - final abstract function show(); + final abstract function show(); } echo "Done\n"; // Shouldn't be displayed diff --git a/tests/classes/final_ctor1.phpt b/tests/classes/final_ctor1.phpt index 33fcbe6bd8..092dd146d4 100644 --- a/tests/classes/final_ctor1.phpt +++ b/tests/classes/final_ctor1.phpt @@ -5,9 +5,9 @@ ZE2 cannot override final __construct class Base { - public final function __construct() - { - } + public final function __construct() + { + } } class Works extends Base @@ -16,9 +16,9 @@ class Works extends Base class Extended extends Base { - public function __construct() - { - } + public function __construct() + { + } } ?> diff --git a/tests/classes/final_redeclare.phpt b/tests/classes/final_redeclare.phpt index d3d53c5dc7..e6dc38b908 100644 --- a/tests/classes/final_redeclare.phpt +++ b/tests/classes/final_redeclare.phpt @@ -4,17 +4,17 @@ ZE2 A final method may not be overwritten <?php class pass { - final function show() { - echo "Call to function pass::show()\n"; - } + final function show() { + echo "Call to function pass::show()\n"; + } } $t = new pass(); class fail extends pass { - function show() { - echo "Call to function fail::show()\n"; - } + function show() { + echo "Call to function fail::show()\n"; + } } echo "Done\n"; // Shouldn't be displayed diff --git a/tests/classes/incdec_property_001.phpt b/tests/classes/incdec_property_001.phpt index 8517a9fc4d..664c474097 100644 --- a/tests/classes/incdec_property_001.phpt +++ b/tests/classes/incdec_property_001.phpt @@ -4,19 +4,19 @@ ZE2 post increment/decrement property of overloaded object <?php class Test { - private $real_a = 2; + private $real_a = 2; - function __set($property, $value) { - if ($property == "a") { - $this->real_a = $value; - } - } + function __set($property, $value) { + if ($property == "a") { + $this->real_a = $value; + } + } - function __get($property) { - if ($property == "a") { - return $this->real_a; - } - } + function __get($property) { + if ($property == "a") { + return $this->real_a; + } + } } $obj = new Test; diff --git a/tests/classes/incdec_property_002.phpt b/tests/classes/incdec_property_002.phpt index 930a58dc07..5e853c63e9 100644 --- a/tests/classes/incdec_property_002.phpt +++ b/tests/classes/incdec_property_002.phpt @@ -4,19 +4,19 @@ ZE2 post increment/decrement property of overloaded object with assignment <?php class Test { - private $real_a = 2; + private $real_a = 2; - function __set($property, $value) { - if ($property == "a") { - $this->real_a = $value; - } - } + function __set($property, $value) { + if ($property == "a") { + $this->real_a = $value; + } + } - function __get($property) { - if ($property == "a") { - return $this->real_a; - } - } + function __get($property) { + if ($property == "a") { + return $this->real_a; + } + } } $obj = new Test; diff --git a/tests/classes/incdec_property_003.phpt b/tests/classes/incdec_property_003.phpt index edf3c00963..f2a696f7ea 100644 --- a/tests/classes/incdec_property_003.phpt +++ b/tests/classes/incdec_property_003.phpt @@ -4,19 +4,19 @@ ZE2 pre increment/decrement property of overloaded object <?php class Test { - private $real_a = 2; + private $real_a = 2; - function __set($property, $value) { - if ($property == "a") { - $this->real_a = $value; - } - } + function __set($property, $value) { + if ($property == "a") { + $this->real_a = $value; + } + } - function __get($property) { - if ($property == "a") { - return $this->real_a; - } - } + function __get($property) { + if ($property == "a") { + return $this->real_a; + } + } } $obj = new Test; diff --git a/tests/classes/incdec_property_004.phpt b/tests/classes/incdec_property_004.phpt index 2267d568af..7a686bdf59 100644 --- a/tests/classes/incdec_property_004.phpt +++ b/tests/classes/incdec_property_004.phpt @@ -4,19 +4,19 @@ ZE2 pre increment/decrement property of overloaded object with assignment <?php class Test { - private $real_a = 2; + private $real_a = 2; - function __set($property, $value) { - if ($property == "a") { - $this->real_a = $value; - } - } + function __set($property, $value) { + if ($property == "a") { + $this->real_a = $value; + } + } - function __get($property) { - if ($property == "a") { - return $this->real_a; - } - } + function __get($property) { + if ($property == "a") { + return $this->real_a; + } + } } $obj = new Test; diff --git a/tests/classes/inheritance.phpt b/tests/classes/inheritance.phpt index 3f7e38b9ef..44b3cbc5bf 100644 --- a/tests/classes/inheritance.phpt +++ b/tests/classes/inheritance.phpt @@ -9,7 +9,7 @@ class foo { public $a; public $b; function display() { - echo "This is class foo\n"; + echo "This is class foo\n"; echo "a = ".$this->a."\n"; echo "b = ".$this->b."\n"; } diff --git a/tests/classes/inheritance_003.phpt b/tests/classes/inheritance_003.phpt index 925544e754..224c8299aa 100644 --- a/tests/classes/inheritance_003.phpt +++ b/tests/classes/inheritance_003.phpt @@ -5,12 +5,12 @@ ZE2 method inheritance without interfaces class A { - function f($x) {} + function f($x) {} } class B extends A { - function f() {} + function f() {} } ?> diff --git a/tests/classes/inheritance_004.phpt b/tests/classes/inheritance_004.phpt index 682bee7a1b..5ea656febb 100644 --- a/tests/classes/inheritance_004.phpt +++ b/tests/classes/inheritance_004.phpt @@ -10,7 +10,7 @@ function f() {} class B extends A { - function f($x) {} + function f($x) {} } ?> diff --git a/tests/classes/inheritance_006.phpt b/tests/classes/inheritance_006.phpt index 3d5c275011..6009c35ffc 100644 --- a/tests/classes/inheritance_006.phpt +++ b/tests/classes/inheritance_006.phpt @@ -3,11 +3,11 @@ Private property inheritance check --FILE-- <?php Class A { - private $c; + private $c; } Class B extends A { - private $c; + private $c; } Class C extends B { diff --git a/tests/classes/interface_and_extends.phpt b/tests/classes/interface_and_extends.phpt index 8bb1ec05f1..080ba24da9 100644 --- a/tests/classes/interface_and_extends.phpt +++ b/tests/classes/interface_and_extends.phpt @@ -5,14 +5,14 @@ ZE2 a class cannot extend an interface interface Test { - function show(); + function show(); } class Tester extends Test { - function show() { - echo __METHOD__ . "\n"; - } + function show() { + echo __METHOD__ . "\n"; + } } $o = new Tester; diff --git a/tests/classes/interface_constant_inheritance_001.phpt b/tests/classes/interface_constant_inheritance_001.phpt index 9f5e76d297..a925097cdb 100644 --- a/tests/classes/interface_constant_inheritance_001.phpt +++ b/tests/classes/interface_constant_inheritance_001.phpt @@ -3,11 +3,11 @@ Ensure an interface may not shadow an inherited constant. --FILE-- <?php interface I1 { - const FOO = 10; + const FOO = 10; } interface I2 extends I1 { - const FOO = 10; + const FOO = 10; } echo "Done\n"; diff --git a/tests/classes/interface_constant_inheritance_002.phpt b/tests/classes/interface_constant_inheritance_002.phpt index 681de11cbf..8840f7caf4 100644 --- a/tests/classes/interface_constant_inheritance_002.phpt +++ b/tests/classes/interface_constant_inheritance_002.phpt @@ -3,11 +3,11 @@ Ensure a class may not shadow a constant inherited from an interface. --FILE-- <?php interface I { - const FOO = 10; + const FOO = 10; } class C implements I { - const FOO = 10; + const FOO = 10; } echo "Done\n"; diff --git a/tests/classes/interface_constant_inheritance_003.phpt b/tests/classes/interface_constant_inheritance_003.phpt index b4902f7306..de867f5dfc 100644 --- a/tests/classes/interface_constant_inheritance_003.phpt +++ b/tests/classes/interface_constant_inheritance_003.phpt @@ -3,11 +3,11 @@ Ensure a class may not inherit two constants with the same name from two separat --FILE-- <?php interface I1 { - const FOO = 10; + const FOO = 10; } interface I2 { - const FOO = 10; + const FOO = 10; } class C implements I1,I2 { diff --git a/tests/classes/interface_constant_inheritance_004.phpt b/tests/classes/interface_constant_inheritance_004.phpt index aca9865eb1..359ce58b38 100644 --- a/tests/classes/interface_constant_inheritance_004.phpt +++ b/tests/classes/interface_constant_inheritance_004.phpt @@ -3,7 +3,7 @@ Ensure a class may implement two interfaces which include the same constant (due --FILE-- <?php interface IA { - const FOO = 10; + const FOO = 10; } interface IB extends IA { diff --git a/tests/classes/interface_constant_inheritance_005.phpt b/tests/classes/interface_constant_inheritance_005.phpt index 1abb85751e..3d728ae46a 100644 --- a/tests/classes/interface_constant_inheritance_005.phpt +++ b/tests/classes/interface_constant_inheritance_005.phpt @@ -3,7 +3,7 @@ Ensure a interface can have public constants --FILE-- <?php interface IA { - public const FOO = 10; + public const FOO = 10; } echo "Done\n"; diff --git a/tests/classes/interface_constant_inheritance_006.phpt b/tests/classes/interface_constant_inheritance_006.phpt index 7e303bb152..82ffa7c314 100644 --- a/tests/classes/interface_constant_inheritance_006.phpt +++ b/tests/classes/interface_constant_inheritance_006.phpt @@ -3,7 +3,7 @@ Ensure a interface can not have protected constants --FILE-- <?php interface A { - protected const FOO = 10; + protected const FOO = 10; } --EXPECTF-- Fatal error: Access type for interface constant A::FOO must be public in %s on line 3 diff --git a/tests/classes/interface_constant_inheritance_007.phpt b/tests/classes/interface_constant_inheritance_007.phpt index 766f89b95d..e072e65e63 100644 --- a/tests/classes/interface_constant_inheritance_007.phpt +++ b/tests/classes/interface_constant_inheritance_007.phpt @@ -3,7 +3,7 @@ Ensure a interface can not have private constants --FILE-- <?php interface A { - private const FOO = 10; + private const FOO = 10; } --EXPECTF-- Fatal error: Access type for interface constant A::FOO must be public in %s on line 3 diff --git a/tests/classes/interface_doubled.phpt b/tests/classes/interface_doubled.phpt index 30ecbf650e..4a176892db 100644 --- a/tests/classes/interface_doubled.phpt +++ b/tests/classes/interface_doubled.phpt @@ -4,42 +4,42 @@ ZE2 An interface extends base interfaces <?php interface if_a { - function f_a(); + function f_a(); } interface if_b { - function f_b(); + function f_b(); } interface if_c extends if_a, if_b { - function f_c(); + function f_c(); } interface if_d extends if_a, if_b { - function f_d(); + function f_d(); } interface if_e { - function f_d(); + function f_d(); } interface if_f extends /*if_e,*/ if_a, if_b, if_c, if_d /*, if_e*/ { } class base { - function test($class) { - echo "is_a(" . get_class($this) . ", $class) ". (($this instanceof $class) ? "yes\n" : "no\n"); - } + function test($class) { + echo "is_a(" . get_class($this) . ", $class) ". (($this instanceof $class) ? "yes\n" : "no\n"); + } } echo "class_a\n"; class class_a extends base implements if_a { - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_a(); @@ -52,11 +52,11 @@ echo $t->test('if_e'); echo "class_b\n"; class class_b extends base implements if_a, if_b { - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_b(); @@ -69,11 +69,11 @@ echo $t->test('if_e'); echo "class_c\n"; class class_c extends base implements if_c { - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_c(); @@ -86,11 +86,11 @@ echo $t->test('if_e'); echo "class_d\n"; class class_d extends base implements if_d{ - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_d(); @@ -103,11 +103,11 @@ echo $t->test('if_e'); echo "class_e\n"; class class_e extends base implements if_a, if_b, if_c, if_d { - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_e(); @@ -120,11 +120,11 @@ echo $t->test('if_e'); echo "class_f\n"; class class_f extends base implements if_e { - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_f(); @@ -137,11 +137,11 @@ echo $t->test('if_e'); echo "class_g\n"; class class_g extends base implements if_f { - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_g(); diff --git a/tests/classes/interface_implemented.phpt b/tests/classes/interface_implemented.phpt index e224c5bd23..52bb7de02d 100644 --- a/tests/classes/interface_implemented.phpt +++ b/tests/classes/interface_implemented.phpt @@ -4,40 +4,40 @@ ZE2 An interface is inherited <?php interface if_a { - function f_a(); + function f_a(); } interface if_b extends if_a { - function f_b(); + function f_b(); } class base { - function _is_a($sub) { - echo 'is_a('.get_class($this).', '.$sub.') = '.(($this instanceof $sub) ? 'yes' : 'no')."\n"; - } - function test() { - echo $this->_is_a('base'); - echo $this->_is_a('derived_a'); - echo $this->_is_a('derived_b'); - echo $this->_is_a('derived_c'); - echo $this->_is_a('derived_d'); - echo $this->_is_a('if_a'); - echo $this->_is_a('if_b'); - echo "\n"; - } + function _is_a($sub) { + echo 'is_a('.get_class($this).', '.$sub.') = '.(($this instanceof $sub) ? 'yes' : 'no')."\n"; + } + function test() { + echo $this->_is_a('base'); + echo $this->_is_a('derived_a'); + echo $this->_is_a('derived_b'); + echo $this->_is_a('derived_c'); + echo $this->_is_a('derived_d'); + echo $this->_is_a('if_a'); + echo $this->_is_a('if_b'); + echo "\n"; + } } class derived_a extends base implements if_a { - function f_a() {} + function f_a() {} } class derived_b extends base implements if_a, if_b { - function f_a() {} - function f_b() {} + function f_a() {} + function f_b() {} } class derived_c extends derived_a implements if_b { - function f_b() {} + function f_b() {} } class derived_d extends derived_c { diff --git a/tests/classes/interface_instantiate.phpt b/tests/classes/interface_instantiate.phpt index 04b0e29701..2fab5fd3da 100644 --- a/tests/classes/interface_instantiate.phpt +++ b/tests/classes/interface_instantiate.phpt @@ -4,7 +4,7 @@ ZE2 An interface cannot be instantiated <?php interface if_a { - function f_a(); + function f_a(); } $t = new if_a(); diff --git a/tests/classes/interface_member.phpt b/tests/classes/interface_member.phpt index 3b50b30ffe..d44b497ca4 100644 --- a/tests/classes/interface_member.phpt +++ b/tests/classes/interface_member.phpt @@ -4,7 +4,7 @@ ZE2 An interface cannot have properties <?php interface if_a { - public $member; + public $member; } ?> --EXPECTF-- diff --git a/tests/classes/interface_method.phpt b/tests/classes/interface_method.phpt index 491b4c21d6..04e2953676 100644 --- a/tests/classes/interface_method.phpt +++ b/tests/classes/interface_method.phpt @@ -4,7 +4,7 @@ ZE2 An interface method must be abstract <?php interface if_a { - function err() {} + function err() {} } ?> diff --git a/tests/classes/interface_method_final.phpt b/tests/classes/interface_method_final.phpt index e936b5a03a..42783c6f12 100644 --- a/tests/classes/interface_method_final.phpt +++ b/tests/classes/interface_method_final.phpt @@ -4,7 +4,7 @@ ZE2 An interface method cannot be final <?php class if_a { - abstract final function err(); + abstract final function err(); } ?> diff --git a/tests/classes/interface_method_private.phpt b/tests/classes/interface_method_private.phpt index 11f8bf648f..4661a86375 100644 --- a/tests/classes/interface_method_private.phpt +++ b/tests/classes/interface_method_private.phpt @@ -4,7 +4,7 @@ ZE2 An interface method cannot be private <?php interface if_a { - abstract private function err(); + abstract private function err(); } ?> diff --git a/tests/classes/interface_must_be_implemented.phpt b/tests/classes/interface_must_be_implemented.phpt index 7dc39436e9..300ace23e3 100644 --- a/tests/classes/interface_must_be_implemented.phpt +++ b/tests/classes/interface_must_be_implemented.phpt @@ -4,7 +4,7 @@ ZE2 An interface must be implemented <?php interface if_a { - function f_a(); + function f_a(); } class derived_a implements if_a { diff --git a/tests/classes/interface_optional_arg.phpt b/tests/classes/interface_optional_arg.phpt index 6fc97f55fb..ab377e1c76 100644 --- a/tests/classes/interface_optional_arg.phpt +++ b/tests/classes/interface_optional_arg.phpt @@ -6,14 +6,14 @@ ZE2 An interface method allows additional default arguments error_reporting(4095); interface test { - public function bar(); + public function bar(); } class foo implements test { - public function bar($foo = NULL) { - echo "foo\n"; - } + public function bar($foo = NULL) { + echo "foo\n"; + } } $foo = new foo; diff --git a/tests/classes/interface_optional_arg_002.phpt b/tests/classes/interface_optional_arg_002.phpt index 67e6785883..190b47aa4f 100644 --- a/tests/classes/interface_optional_arg_002.phpt +++ b/tests/classes/interface_optional_arg_002.phpt @@ -4,14 +4,14 @@ default argument value in interface implementation <?php interface test { - public function bar(); + public function bar(); } class foo implements test { - public function bar($arg = 2) { - var_dump($arg); - } + public function bar($arg = 2) { + var_dump($arg); + } } $foo = new foo; diff --git a/tests/classes/interface_optional_arg_003.phpt b/tests/classes/interface_optional_arg_003.phpt index cf583fe204..7a972c728b 100644 --- a/tests/classes/interface_optional_arg_003.phpt +++ b/tests/classes/interface_optional_arg_003.phpt @@ -6,7 +6,7 @@ include 'interface_optional_arg_003.inc'; class C implements I { function f($a = 2) { - var_dump($a); + var_dump($a); } } diff --git a/tests/classes/interfaces_001.phpt b/tests/classes/interfaces_001.phpt index 97b48aa03d..3b1aabb6a7 100644 --- a/tests/classes/interfaces_001.phpt +++ b/tests/classes/interfaces_001.phpt @@ -4,15 +4,15 @@ ZE2 interfaces <?php interface ThrowableInterface { - public function getMessage(); + public function getMessage(); } class Exception_foo implements ThrowableInterface { - public $foo = "foo"; + public $foo = "foo"; - public function getMessage() { - return $this->foo; - } + public function getMessage() { + return $this->foo; + } } $foo = new Exception_foo; diff --git a/tests/classes/interfaces_002.phpt b/tests/classes/interfaces_002.phpt index 6cc899bf1d..14ac1f0ffc 100644 --- a/tests/classes/interfaces_002.phpt +++ b/tests/classes/interfaces_002.phpt @@ -4,16 +4,16 @@ ZE2 interface with an unimplemented method <?php interface ThrowableInterface { - public function getMessage(); - public function getErrno(); + public function getMessage(); + public function getErrno(); } class Exception_foo implements ThrowableInterface { - public $foo = "foo"; + public $foo = "foo"; - public function getMessage() { - return $this->foo; - } + public function getMessage() { + return $this->foo; + } } // this should die -- Exception class must be abstract... diff --git a/tests/classes/interfaces_003.phpt b/tests/classes/interfaces_003.phpt index 97b5f7dde5..349dc66bd8 100644 --- a/tests/classes/interfaces_003.phpt +++ b/tests/classes/interfaces_003.phpt @@ -7,14 +7,14 @@ class MyObject {} interface MyInterface { - public function __construct(MyObject $o); + public function __construct(MyObject $o); } class MyTestClass implements MyInterface { - public function __construct(MyObject $o) - { - } + public function __construct(MyObject $o) + { + } } $obj = new MyTestClass; diff --git a/tests/classes/iterators_001.phpt b/tests/classes/iterators_001.phpt index e4060e375f..17588bc8cd 100644 --- a/tests/classes/iterators_001.phpt +++ b/tests/classes/iterators_001.phpt @@ -4,78 +4,78 @@ ZE2 iterators and foreach <?php class c_iter implements Iterator { - private $obj; - private $num = 0; + private $obj; + private $num = 0; - function __construct($obj) { - echo __METHOD__ . "\n"; - $this->num = 0; - $this->obj = $obj; - } - function rewind() { - } - function valid() { - $more = $this->num < $this->obj->max; - echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; - return $more; - } - function current() { - echo __METHOD__ . "\n"; - return $this->num; - } - function next() { - echo __METHOD__ . "\n"; - $this->num++; - } - function key() { - echo __METHOD__ . "\n"; - switch($this->num) { - case 0: return "1st"; - case 1: return "2nd"; - case 2: return "3rd"; - default: return "???"; - } - } + function __construct($obj) { + echo __METHOD__ . "\n"; + $this->num = 0; + $this->obj = $obj; + } + function rewind() { + } + function valid() { + $more = $this->num < $this->obj->max; + echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; + return $more; + } + function current() { + echo __METHOD__ . "\n"; + return $this->num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function key() { + echo __METHOD__ . "\n"; + switch($this->num) { + case 0: return "1st"; + case 1: return "2nd"; + case 2: return "3rd"; + default: return "???"; + } + } } class c implements IteratorAggregate { - public $max = 3; + public $max = 3; - function getIterator() { - echo __METHOD__ . "\n"; - return new c_iter($this); - } + function getIterator() { + echo __METHOD__ . "\n"; + return new c_iter($this); + } } echo "===Array===\n"; $a = array(0,1,2); foreach($a as $v) { - echo "array:$v\n"; + echo "array:$v\n"; } echo "===Manual===\n"; $t = new c(); for ($iter = $t->getIterator(); $iter->valid(); $iter->next()) { - echo $iter->current() . "\n"; + echo $iter->current() . "\n"; } echo "===foreach/std===\n"; foreach($t as $v) { - echo "object:$v\n"; + echo "object:$v\n"; } echo "===foreach/rec===\n"; foreach($t as $v) { - foreach($t as $w) { - echo "double:$v:$w\n"; - } + foreach($t as $w) { + echo "double:$v:$w\n"; + } } echo "===foreach/key===\n"; foreach($t as $i => $v) { - echo "object:$i=>$v\n"; + echo "object:$i=>$v\n"; } print "Done\n"; diff --git a/tests/classes/iterators_002.phpt b/tests/classes/iterators_002.phpt index 5e1ceb6208..4035f7c4f4 100644 --- a/tests/classes/iterators_002.phpt +++ b/tests/classes/iterators_002.phpt @@ -4,64 +4,64 @@ ZE2 iterators and break <?php class c_iter implements Iterator { - private $obj; - private $num = 0; + private $obj; + private $num = 0; - function __construct($obj) { - echo __METHOD__ . "\n"; - $this->obj = $obj; - } - function rewind() { - echo __METHOD__ . "\n"; - $this->num = 0; - } - function valid() { - $more = $this->num < $this->obj->max; - echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; - return $more; - } - function current() { - echo __METHOD__ . "\n"; - return $this->num; - } - function next() { - echo __METHOD__ . "\n"; - $this->num++; - } - function key() { - echo __METHOD__ . "\n"; - switch($this->num) { - case 0: return "1st"; - case 1: return "2nd"; - case 2: return "3rd"; - default: return "???"; - } - } - function __destruct() { - echo __METHOD__ . "\n"; - } + function __construct($obj) { + echo __METHOD__ . "\n"; + $this->obj = $obj; + } + function rewind() { + echo __METHOD__ . "\n"; + $this->num = 0; + } + function valid() { + $more = $this->num < $this->obj->max; + echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; + return $more; + } + function current() { + echo __METHOD__ . "\n"; + return $this->num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function key() { + echo __METHOD__ . "\n"; + switch($this->num) { + case 0: return "1st"; + case 1: return "2nd"; + case 2: return "3rd"; + default: return "???"; + } + } + function __destruct() { + echo __METHOD__ . "\n"; + } } class c implements IteratorAggregate { - public $max = 3; + public $max = 3; - function getIterator() { - echo __METHOD__ . "\n"; - return new c_iter($this); - } - function __destruct() { - echo __METHOD__ . "\n"; - } + function getIterator() { + echo __METHOD__ . "\n"; + return new c_iter($this); + } + function __destruct() { + echo __METHOD__ . "\n"; + } } $t = new c(); foreach($t as $k => $v) { - foreach($t as $w) { - echo "double:$v:$w\n"; - break; - } + foreach($t as $w) { + echo "double:$v:$w\n"; + break; + } } unset($t); diff --git a/tests/classes/iterators_003.phpt b/tests/classes/iterators_003.phpt index f417478d49..5557402d8d 100644 --- a/tests/classes/iterators_003.phpt +++ b/tests/classes/iterators_003.phpt @@ -4,66 +4,66 @@ ZE2 iterators and break <?php class c_iter implements Iterator { - private $obj; - private $num = 0; + private $obj; + private $num = 0; - function __construct($obj) { - echo __METHOD__ . "\n"; - $this->obj = $obj; - } - function rewind() { - echo __METHOD__ . "\n"; - } - function valid() { - $more = $this->num < $this->obj->max; - echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; - return $more; - } - function current() { - echo __METHOD__ . "\n"; - return $this->num; - } - function next() { - echo __METHOD__ . "\n"; - $this->num++; - } - function key() { - return $this->num; - } + function __construct($obj) { + echo __METHOD__ . "\n"; + $this->obj = $obj; + } + function rewind() { + echo __METHOD__ . "\n"; + } + function valid() { + $more = $this->num < $this->obj->max; + echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; + return $more; + } + function current() { + echo __METHOD__ . "\n"; + return $this->num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function key() { + return $this->num; + } } class c implements IteratorAggregate { - public $max = 4; + public $max = 4; - function getIterator() { - echo __METHOD__ . "\n"; - return new c_iter($this); - } + function getIterator() { + echo __METHOD__ . "\n"; + return new c_iter($this); + } } $t = new c(); foreach($t as $v) { - if ($v == 0) { - echo "continue outer\n"; - continue; - } - foreach($t as $w) { - if ($w == 1) { - echo "continue inner\n"; - continue; - } - if ($w == 2) { - echo "break inner\n"; - break; - } - echo "double:$v:$w\n"; - } - if ($v == 2) { - echo "break outer\n"; - break; - } + if ($v == 0) { + echo "continue outer\n"; + continue; + } + foreach($t as $w) { + if ($w == 1) { + echo "continue inner\n"; + continue; + } + if ($w == 2) { + echo "break inner\n"; + break; + } + echo "double:$v:$w\n"; + } + if ($v == 2) { + echo "break outer\n"; + break; + } } print "Done\n"; diff --git a/tests/classes/iterators_004.phpt b/tests/classes/iterators_004.phpt index dc5a07a603..77d036a075 100644 --- a/tests/classes/iterators_004.phpt +++ b/tests/classes/iterators_004.phpt @@ -10,43 +10,43 @@ class c1 {} $obj = new c1(); foreach($obj as $w) { - echo "object:$w\n"; + echo "object:$w\n"; } echo "2nd try\n"; class c2 { - public $max = 3; - public $num = 0; - - function current() { - echo __METHOD__ . "\n"; - return $this->num; - } - function next() { - echo __METHOD__ . "\n"; - $this->num++; - } - function valid() { - echo __METHOD__ . "\n"; - return $this->num < $this->max; - } - function key() { - echo __METHOD__ . "\n"; - switch($this->num) { - case 0: return "1st"; - case 1: return "2nd"; - case 2: return "3rd"; - default: return "???"; - } - } + public $max = 3; + public $num = 0; + + function current() { + echo __METHOD__ . "\n"; + return $this->num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function valid() { + echo __METHOD__ . "\n"; + return $this->num < $this->max; + } + function key() { + echo __METHOD__ . "\n"; + switch($this->num) { + case 0: return "1st"; + case 1: return "2nd"; + case 2: return "3rd"; + default: return "???"; + } + } } $obj = new c2(); foreach($obj as $v => $w) { - echo "object:$v=>$w\n"; + echo "object:$v=>$w\n"; } print "Done\n"; diff --git a/tests/classes/iterators_006.phpt b/tests/classes/iterators_006.phpt index 0a2d7827e0..8bc8516723 100644 --- a/tests/classes/iterators_006.phpt +++ b/tests/classes/iterators_006.phpt @@ -5,47 +5,47 @@ ZE2 iterators and array wrapping class ai implements Iterator { - private $array; + private $array; - function __construct() { - $this->array = array('foo', 'bar', 'baz'); - } + function __construct() { + $this->array = array('foo', 'bar', 'baz'); + } - function rewind() { - reset($this->array); - $this->next(); - } + function rewind() { + reset($this->array); + $this->next(); + } - function valid() { - return $this->key !== NULL; - } + function valid() { + return $this->key !== NULL; + } - function key() { - return $this->key; - } + function key() { + return $this->key; + } - function current() { - return $this->current; - } + function current() { + return $this->current; + } - function next() { + function next() { $this->key = key($this->array); $this->current = current($this->array); next($this->array); - } + } } class a implements IteratorAggregate { - public function getIterator() { - return new ai(); - } + public function getIterator() { + return new ai(); + } } $array = new a(); foreach ($array as $property => $value) { - print "$property: $value\n"; + print "$property: $value\n"; } #$array = $array->getIterator(); @@ -58,13 +58,13 @@ echo "===2nd===\n"; $array = new ai(); foreach ($array as $property => $value) { - print "$property: $value\n"; + print "$property: $value\n"; } echo "===3rd===\n"; foreach ($array as $property => $value) { - print "$property: $value\n"; + print "$property: $value\n"; } ?> diff --git a/tests/classes/iterators_007.phpt b/tests/classes/iterators_007.phpt index 6e76e2d52a..db1c868e0d 100644 --- a/tests/classes/iterators_007.phpt +++ b/tests/classes/iterators_007.phpt @@ -4,32 +4,32 @@ ZE2 iterators and exceptions <?php class Test implements Iterator { - public $arr = array(1, 2, 3); - public $x = 0; + public $arr = array(1, 2, 3); + public $x = 0; - public function rewind() { if ($this->x == 0) throw new Exception(__METHOD__); reset($this->arr); } - public function current() { if ($this->x == 1) throw new Exception(__METHOD__); return current($this->arr); } - public function key() { if ($this->x == 2) throw new Exception(__METHOD__); return key($this->arr); } - public function next() { if ($this->x == 3) throw new Exception(__METHOD__); next($this->arr); } - public function valid() { if ($this->x == 4) throw new Exception(__METHOD__); return (key($this->arr) !== NULL); } + public function rewind() { if ($this->x == 0) throw new Exception(__METHOD__); reset($this->arr); } + public function current() { if ($this->x == 1) throw new Exception(__METHOD__); return current($this->arr); } + public function key() { if ($this->x == 2) throw new Exception(__METHOD__); return key($this->arr); } + public function next() { if ($this->x == 3) throw new Exception(__METHOD__); next($this->arr); } + public function valid() { if ($this->x == 4) throw new Exception(__METHOD__); return (key($this->arr) !== NULL); } } $t = new Test(); while($t->x < 5) { - try - { - foreach($t as $k => $v) - { - echo "Current\n"; - } - } - catch(Exception $e) - { - echo "Caught in " . $e->getMessage() . "()\n"; - } - $t->x++; + try + { + foreach($t as $k => $v) + { + echo "Current\n"; + } + } + catch(Exception $e) + { + echo "Caught in " . $e->getMessage() . "()\n"; + } + $t->x++; } ?> --EXPECT-- diff --git a/tests/classes/method_override_optional_arg_001.phpt b/tests/classes/method_override_optional_arg_001.phpt index ac1a689238..3d9b0f5ff9 100644 --- a/tests/classes/method_override_optional_arg_001.phpt +++ b/tests/classes/method_override_optional_arg_001.phpt @@ -4,20 +4,20 @@ Method override allows optional default argument <?php class A { - function foo($arg1 = 1) { - } + function foo($arg1 = 1) { + } } class B extends A { - function foo($arg1 = 2, $arg2 = 3) { - var_dump($arg1); - var_dump($arg2); - } + function foo($arg1 = 2, $arg2 = 3) { + var_dump($arg1); + var_dump($arg2); + } } class C extends A { - function foo() { - } + function foo() { + } } $b = new B(); diff --git a/tests/classes/method_override_optional_arg_002.phpt b/tests/classes/method_override_optional_arg_002.phpt index df12251e6c..ee94469e51 100644 --- a/tests/classes/method_override_optional_arg_002.phpt +++ b/tests/classes/method_override_optional_arg_002.phpt @@ -4,13 +4,13 @@ Omitting optional arg in method inherited from abstract class <?php abstract class A { - function foo($arg = 1) {} + function foo($arg = 1) {} } class B extends A { - function foo() { - echo "foo\n"; - } + function foo() { + echo "foo\n"; + } } $b = new B(); diff --git a/tests/classes/object_reference_001.phpt b/tests/classes/object_reference_001.phpt index 9842ac00f5..a98802d07a 100644 --- a/tests/classes/object_reference_001.phpt +++ b/tests/classes/object_reference_001.phpt @@ -4,11 +4,11 @@ ZE2 object references <?php class Foo { - public $name; + public $name; - function __construct() { - $this->name = "I'm Foo!\n"; - } + function __construct() { + $this->name = "I'm Foo!\n"; + } } $foo = new Foo; diff --git a/tests/classes/private_001.phpt b/tests/classes/private_001.phpt index 79b94c4f9a..34e716e334 100644 --- a/tests/classes/private_001.phpt +++ b/tests/classes/private_001.phpt @@ -4,13 +4,13 @@ ZE2 A private method can only be called inside the class <?php class pass { - private static function show() { - echo "Call show()\n"; - } + private static function show() { + echo "Call show()\n"; + } - public static function do_show() { - pass::show(); - } + public static function do_show() { + pass::show(); + } } pass::do_show(); diff --git a/tests/classes/private_002.phpt b/tests/classes/private_002.phpt index 892580f36d..7f85324503 100644 --- a/tests/classes/private_002.phpt +++ b/tests/classes/private_002.phpt @@ -4,22 +4,22 @@ ZE2 A private method cannot be called in another class <?php class pass { - private static function show() { - echo "Call pass::show()\n"; - } + private static function show() { + echo "Call pass::show()\n"; + } - public static function do_show() { - pass::show(); - } + public static function do_show() { + pass::show(); + } } pass::do_show(); class fail { - public static function show() { - echo "Call fail::show()\n"; - pass::show(); - } + public static function show() { + echo "Call fail::show()\n"; + pass::show(); + } } fail::show(); diff --git a/tests/classes/private_003.phpt b/tests/classes/private_003.phpt index 0843c5ef63..c142ad5cc7 100644 --- a/tests/classes/private_003.phpt +++ b/tests/classes/private_003.phpt @@ -4,23 +4,23 @@ ZE2 A private method cannot be called in a derived class <?php ini_set("error_reporting",2039); class pass { - private static function show() { - echo "Call show()\n"; - } + private static function show() { + echo "Call show()\n"; + } - protected static function good() { - pass::show(); - } + protected static function good() { + pass::show(); + } } class fail extends pass { - static function ok() { - pass::good(); - } + static function ok() { + pass::good(); + } - static function not_ok() { - pass::show(); - } + static function not_ok() { + pass::show(); + } } fail::ok(); diff --git a/tests/classes/private_003b.phpt b/tests/classes/private_003b.phpt index fe2f464ee8..9c5e5cbb9a 100644 --- a/tests/classes/private_003b.phpt +++ b/tests/classes/private_003b.phpt @@ -4,23 +4,23 @@ ZE2 A private method cannot be called in a derived class <?php class pass { - private function show() { - echo "Call show()\n"; - } + private function show() { + echo "Call show()\n"; + } - protected function good() { - $this->show(); - } + protected function good() { + $this->show(); + } } class fail extends pass { - public function ok() { - $this->good(); - } + public function ok() { + $this->good(); + } - public function not_ok() { - $this->show(); - } + public function not_ok() { + $this->show(); + } } $t = new fail(); diff --git a/tests/classes/private_004.phpt b/tests/classes/private_004.phpt index 13a4e90535..bfecff55b9 100644 --- a/tests/classes/private_004.phpt +++ b/tests/classes/private_004.phpt @@ -4,19 +4,19 @@ ZE2 A private method cannot be called in a derived class <?php class pass { - private static function show() { - echo "Call show()\n"; - } + private static function show() { + echo "Call show()\n"; + } - public static function do_show() { - pass::show(); - } + public static function do_show() { + pass::show(); + } } class fail extends pass { - static function do_show() { - fail::show(); - } + static function do_show() { + fail::show(); + } } pass::do_show(); diff --git a/tests/classes/private_004b.phpt b/tests/classes/private_004b.phpt index db139f65b7..302c617a5f 100644 --- a/tests/classes/private_004b.phpt +++ b/tests/classes/private_004b.phpt @@ -4,19 +4,19 @@ ZE2 A private method cannot be called in a derived class <?php class pass { - private function show() { - echo "Call show()\n"; - } + private function show() { + echo "Call show()\n"; + } - public function do_show() { - $this->show(); - } + public function do_show() { + $this->show(); + } } class fail extends pass { - function do_show() { - $this->show(); - } + function do_show() { + $this->show(); + } } $t = new pass(); diff --git a/tests/classes/private_005.phpt b/tests/classes/private_005.phpt index 0c6d978f79..1fb0e3e9fa 100644 --- a/tests/classes/private_005.phpt +++ b/tests/classes/private_005.phpt @@ -4,19 +4,19 @@ ZE2 A private method cannot be called in a derived class <?php class pass { - private static function show() { - echo "Call show()\n"; - } + private static function show() { + echo "Call show()\n"; + } - public static function do_show() { - pass::show(); - } + public static function do_show() { + pass::show(); + } } class fail extends pass { - static function do_show() { - pass::show(); - } + static function do_show() { + pass::show(); + } } pass::do_show(); diff --git a/tests/classes/private_006.phpt b/tests/classes/private_006.phpt index 895affac75..9f755abf8e 100644 --- a/tests/classes/private_006.phpt +++ b/tests/classes/private_006.phpt @@ -3,13 +3,13 @@ ZE2 A private method can be overwritten in a second derived class --FILE-- <?php class first { - private static function show() { - echo "Call show()\n"; - } + private static function show() { + echo "Call show()\n"; + } - public static function do_show() { - first::show(); - } + public static function do_show() { + first::show(); + } } first::do_show(); @@ -25,9 +25,9 @@ class third extends second { third::do_show(); class fail extends third { - static function show() { // cannot be redeclared - echo "Call show()\n"; - } + static function show() { // cannot be redeclared + echo "Call show()\n"; + } } echo "Done\n"; diff --git a/tests/classes/private_006b.phpt b/tests/classes/private_006b.phpt index 1c678601b6..cdb7f2166e 100644 --- a/tests/classes/private_006b.phpt +++ b/tests/classes/private_006b.phpt @@ -4,13 +4,13 @@ ZE2 A private method can be overwritten in a second derived class <?php class first { - private function show() { - echo "Call show()\n"; - } + private function show() { + echo "Call show()\n"; + } - public function do_show() { - $this->show(); - } + public function do_show() { + $this->show(); + } } $t1 = new first(); @@ -23,9 +23,9 @@ class second extends first { //$t2->do_show(); class third extends second { - private function show() { - echo "Call show()\n"; - } + private function show() { + echo "Call show()\n"; + } } $t3 = new third(); diff --git a/tests/classes/private_007.phpt b/tests/classes/private_007.phpt index abc2258bc2..84cdb137b8 100644 --- a/tests/classes/private_007.phpt +++ b/tests/classes/private_007.phpt @@ -4,17 +4,17 @@ ZE2 A derived class does not know about privates of ancestors <?php class Bar { - public static function pub() { - Bar::priv(); - } - private static function priv() { - echo "Bar::priv()\n"; - } + public static function pub() { + Bar::priv(); + } + private static function priv() { + echo "Bar::priv()\n"; + } } class Foo extends Bar { - public static function priv() { - echo "Foo::priv()\n"; - } + public static function priv() { + echo "Foo::priv()\n"; + } } Foo::pub(); diff --git a/tests/classes/private_007b.phpt b/tests/classes/private_007b.phpt index 3272d0c8a0..305048055f 100644 --- a/tests/classes/private_007b.phpt +++ b/tests/classes/private_007b.phpt @@ -4,17 +4,17 @@ ZE2 A derived class does not know about privates of ancestors <?php class Bar { - public function pub() { - $this->priv(); - } - private function priv() { - echo "Bar::priv()\n"; - } + public function pub() { + $this->priv(); + } + private function priv() { + echo "Bar::priv()\n"; + } } class Foo extends Bar { - public function priv() { - echo "Foo::priv()\n"; - } + public function priv() { + echo "Foo::priv()\n"; + } } $obj = new Foo(); diff --git a/tests/classes/private_members.phpt b/tests/classes/private_members.phpt index 4d8fd9eeb0..1b48722dbb 100644 --- a/tests/classes/private_members.phpt +++ b/tests/classes/private_members.phpt @@ -9,15 +9,15 @@ class base function __construct() { - echo __METHOD__ . "(begin)\n"; + echo __METHOD__ . "(begin)\n"; $this->member = 'base::member'; $this->test(); - echo __METHOD__ . "(end)\n"; + echo __METHOD__ . "(end)\n"; } function test() { - echo __METHOD__ . "\n"; + echo __METHOD__ . "\n"; print_r($this); } } @@ -28,18 +28,18 @@ class derived extends base function __construct() { - echo __METHOD__ . "(begin)\n"; - parent::__construct(); - parent::test(); - $this->test(); + echo __METHOD__ . "(begin)\n"; + parent::__construct(); + parent::test(); + $this->test(); $this->member = 'derived::member'; - echo __METHOD__ . "(end)\n"; + echo __METHOD__ . "(end)\n"; } function test() { - parent::test(); - echo __METHOD__ . "\n"; + parent::test(); + echo __METHOD__ . "\n"; print_r($this); } } diff --git a/tests/classes/private_members_serialization.phpt b/tests/classes/private_members_serialization.phpt index c196f7d8f9..1b04b6f59c 100644 --- a/tests/classes/private_members_serialization.phpt +++ b/tests/classes/private_members_serialization.phpt @@ -4,17 +4,17 @@ Verifies that it is possible to return private member names of parent classes in <?php class foo { - private $private = 'private'; - protected $protected = 'protected'; - public $public = 'public'; + private $private = 'private'; + protected $protected = 'protected'; + public $public = 'public'; } class bar extends foo { - public function __sleep() - { - return array("\0foo\0private", 'protected', 'public'); - } + public function __sleep() + { + return array("\0foo\0private", 'protected', 'public'); + } } var_dump(str_replace("\0", '\0', serialize(new bar()))); diff --git a/tests/classes/private_redeclare.phpt b/tests/classes/private_redeclare.phpt index b42cc7d7fe..cee59985c1 100644 --- a/tests/classes/private_redeclare.phpt +++ b/tests/classes/private_redeclare.phpt @@ -3,27 +3,27 @@ ZE2 A derived class does not know anything about inherited private methods --FILE-- <?php class base { - private function show() { - echo "base\n"; - } - function test() { - $this->show(); - } + private function show() { + echo "base\n"; + } + function test() { + $this->show(); + } } $t = new base(); $t->test(); class derived extends base { - function show() { - echo "derived\n"; - } - function test() { - echo "test\n"; - $this->show(); - parent::test(); - parent::show(); - } + function show() { + echo "derived\n"; + } + function test() { + echo "test\n"; + $this->show(); + parent::test(); + parent::show(); + } } $t = new derived(); diff --git a/tests/classes/property_recreate_private.phpt b/tests/classes/property_recreate_private.phpt index 35724d4b4d..8dc3e18eb0 100644 --- a/tests/classes/property_recreate_private.phpt +++ b/tests/classes/property_recreate_private.phpt @@ -3,19 +3,19 @@ Unsetting and recreating private properties. --FILE-- <?php class C { - private $p = 'test'; - function unsetPrivate() { - unset($this->p); - } - function setPrivate() { - $this->p = 'changed'; - } + private $p = 'test'; + function unsetPrivate() { + unset($this->p); + } + function setPrivate() { + $this->p = 'changed'; + } } class D extends C { - function setP() { - $this->p = 'changed in D'; - } + function setP() { + $this->p = 'changed in D'; + } } echo "Unset and recreate a superclass's private property:\n"; diff --git a/tests/classes/property_recreate_protected.phpt b/tests/classes/property_recreate_protected.phpt index ddbbb71fc9..11c3c7f900 100644 --- a/tests/classes/property_recreate_protected.phpt +++ b/tests/classes/property_recreate_protected.phpt @@ -3,19 +3,19 @@ Unsetting and recreating protected properties. --FILE-- <?php class C { - protected $p = 'test'; - function unsetProtected() { - unset($this->p); - } - function setProtected() { - $this->p = 'changed'; - } + protected $p = 'test'; + function unsetProtected() { + unset($this->p); + } + function setProtected() { + $this->p = 'changed'; + } } class D extends C { - function setP() { - $this->p = 'changed in D'; - } + function setP() { + $this->p = 'changed in D'; + } } $d = new D; diff --git a/tests/classes/protected_001.phpt b/tests/classes/protected_001.phpt index 44099b18fa..026a0f424b 100644 --- a/tests/classes/protected_001.phpt +++ b/tests/classes/protected_001.phpt @@ -4,13 +4,13 @@ ZE2 A protected method can only be called inside the class <?php class pass { - protected static function fail() { - echo "Call fail()\n"; - } + protected static function fail() { + echo "Call fail()\n"; + } - public static function good() { - pass::fail(); - } + public static function good() { + pass::fail(); + } } pass::good(); diff --git a/tests/classes/protected_001b.phpt b/tests/classes/protected_001b.phpt index 6f00ffc1b3..971436c844 100644 --- a/tests/classes/protected_001b.phpt +++ b/tests/classes/protected_001b.phpt @@ -4,13 +4,13 @@ ZE2 A protected method can only be called inside the class <?php class pass { - protected function fail() { - echo "Call fail()\n"; - } + protected function fail() { + echo "Call fail()\n"; + } - public function good() { - $this->fail(); - } + public function good() { + $this->fail(); + } } $t = new pass(); diff --git a/tests/classes/protected_002.phpt b/tests/classes/protected_002.phpt index da87200b6e..f3ddc15db9 100644 --- a/tests/classes/protected_002.phpt +++ b/tests/classes/protected_002.phpt @@ -4,22 +4,22 @@ ZE2 A protected method cannot be called in another class <?php class pass { - protected static function show() { - echo "Call pass::show()\n"; - } + protected static function show() { + echo "Call pass::show()\n"; + } - public static function do_show() { - pass::show(); - } + public static function do_show() { + pass::show(); + } } pass::do_show(); class fail { - public static function show() { - echo "Call fail::show()\n"; - pass::show(); - } + public static function show() { + echo "Call fail::show()\n"; + pass::show(); + } } fail::show(); diff --git a/tests/classes/serialize_001.phpt b/tests/classes/serialize_001.phpt index 25a22821e2..e0f7973cd7 100644 --- a/tests/classes/serialize_001.phpt +++ b/tests/classes/serialize_001.phpt @@ -5,43 +5,43 @@ ZE2 Serializable class Test implements Serializable { - public $data; + public $data; - function __construct($data) - { - echo __METHOD__ . "($data)\n"; - $this->data = $data; - } + function __construct($data) + { + echo __METHOD__ . "($data)\n"; + $this->data = $data; + } - function serialize() - { - echo __METHOD__ . "({$this->data})\n"; - return $this->data; - } + function serialize() + { + echo __METHOD__ . "({$this->data})\n"; + return $this->data; + } - function unserialize($serialized) - { - echo __METHOD__ . "($serialized)\n"; - $this->data = $serialized; - var_dump($this); - } + function unserialize($serialized) + { + echo __METHOD__ . "($serialized)\n"; + $this->data = $serialized; + var_dump($this); + } } $tests = array('String', NULL, 42, false); foreach($tests as $data) { - try - { - echo "==========\n"; - var_dump($data); - $ser = serialize(new Test($data)); - var_dump(unserialize($ser)); - } - catch(Exception $e) - { - echo 'Exception: ' . $e->getMessage() . "\n"; - } + try + { + echo "==========\n"; + var_dump($data); + $ser = serialize(new Test($data)); + var_dump(unserialize($ser)); + } + catch(Exception $e) + { + echo 'Exception: ' . $e->getMessage() . "\n"; + } } ?> diff --git a/tests/classes/singleton_001.phpt b/tests/classes/singleton_001.phpt index 45174158be..27d74122e2 100644 --- a/tests/classes/singleton_001.phpt +++ b/tests/classes/singleton_001.phpt @@ -4,24 +4,24 @@ ZE2 singleton <?php class Counter { - private $counter = 0; + private $counter = 0; - function increment_and_print() { - echo ++$this->counter; - echo "\n"; + function increment_and_print() { + echo ++$this->counter; + echo "\n"; } } class SingletonCounter { - private static $m_instance = NULL; + private static $m_instance = NULL; - static function Instance() { - if (self::$m_instance == NULL) { - self::$m_instance = new Counter(); - } - return self::$m_instance; - } + static function Instance() { + if (self::$m_instance == NULL) { + self::$m_instance = new Counter(); + } + return self::$m_instance; + } } SingletonCounter::Instance()->increment_and_print(); diff --git a/tests/classes/static_mix_1.phpt b/tests/classes/static_mix_1.phpt index 8dead36856..01704193cd 100644 --- a/tests/classes/static_mix_1.phpt +++ b/tests/classes/static_mix_1.phpt @@ -4,15 +4,15 @@ ZE2 You cannot overload a static method with a non static method <?php class pass { - static function show() { - echo "Call to function pass::show()\n"; - } + static function show() { + echo "Call to function pass::show()\n"; + } } class fail extends pass { - function show() { - echo "Call to function fail::show()\n"; - } + function show() { + echo "Call to function fail::show()\n"; + } } pass::show(); diff --git a/tests/classes/static_mix_2.phpt b/tests/classes/static_mix_2.phpt index bbf6f9c1dd..7f89ba3987 100644 --- a/tests/classes/static_mix_2.phpt +++ b/tests/classes/static_mix_2.phpt @@ -4,15 +4,15 @@ ZE2 You cannot overload a non static method with a static method <?php class pass { - function show() { - echo "Call to function pass::show()\n"; - } + function show() { + echo "Call to function pass::show()\n"; + } } class fail extends pass { - static function show() { - echo "Call to function fail::show()\n"; - } + static function show() { + echo "Call to function fail::show()\n"; + } } $t = new pass(); diff --git a/tests/classes/static_properties_001.phpt b/tests/classes/static_properties_001.phpt index e5e545fa22..5772a0dbcc 100644 --- a/tests/classes/static_properties_001.phpt +++ b/tests/classes/static_properties_001.phpt @@ -4,7 +4,7 @@ ZE2 Initializing static properties to arrays <?php class test { - static public $ar = array(); + static public $ar = array(); } var_dump(test::$ar); diff --git a/tests/classes/static_this.phpt b/tests/classes/static_this.phpt index f7a11f5481..a945d76c9d 100644 --- a/tests/classes/static_this.phpt +++ b/tests/classes/static_this.phpt @@ -5,21 +5,21 @@ ZE2 $this can be an argument to a static function class TestClass { - function __construct() - { - self::Test1(); - $this->Test1(); - } + function __construct() + { + self::Test1(); + $this->Test1(); + } - static function Test1() - { - var_dump($this); - } + static function Test1() + { + var_dump($this); + } - static function Test2($this) - { - var_dump($this); - } + static function Test2($this) + { + var_dump($this); + } } $obj = new TestClass; diff --git a/tests/classes/this.phpt b/tests/classes/this.phpt index 30ea83e285..418ea63912 100644 --- a/tests/classes/this.phpt +++ b/tests/classes/this.phpt @@ -10,7 +10,7 @@ class Foo { function replace($other) { - echo __METHOD__ . "\n"; + echo __METHOD__ . "\n"; $this = $other; print $this->prop; print $other->prop; @@ -18,7 +18,7 @@ class Foo function indirect($other) { - echo __METHOD__ . "\n"; + echo __METHOD__ . "\n"; $this = $other; $result = $this = $other; print $result->prop; @@ -27,8 +27,8 @@ class Foo function retrieve(&$other) { - echo __METHOD__ . "\n"; - $other = $this; + echo __METHOD__ . "\n"; + $other = $this; } } diff --git a/tests/classes/tostring_001.phpt b/tests/classes/tostring_001.phpt index ba2bc3eb53..3053da9140 100644 --- a/tests/classes/tostring_001.phpt +++ b/tests/classes/tostring_001.phpt @@ -11,7 +11,7 @@ class test2 { function __toString() { - echo __METHOD__ . "()\n"; + echo __METHOD__ . "()\n"; return "Converted\n"; } } @@ -20,7 +20,7 @@ class test3 { function __toString() { - echo __METHOD__ . "()\n"; + echo __METHOD__ . "()\n"; return 42; } } diff --git a/tests/classes/tostring_002.phpt b/tests/classes/tostring_002.phpt index 7dda92339e..3977ad883f 100644 --- a/tests/classes/tostring_002.phpt +++ b/tests/classes/tostring_002.phpt @@ -5,15 +5,15 @@ ZE2 __toString() in __destruct class Test { - function __toString() - { - return "Hello\n"; - } + function __toString() + { + return "Hello\n"; + } - function __destruct() - { - echo $this; - } + function __destruct() + { + echo $this; + } } $o = new Test; diff --git a/tests/classes/tostring_003.phpt b/tests/classes/tostring_003.phpt index 4dad51f2cf..87a5fe42e1 100644 --- a/tests/classes/tostring_003.phpt +++ b/tests/classes/tostring_003.phpt @@ -5,26 +5,26 @@ ZE2 __toString() in __destruct/exception class Test { - function __toString() - { - throw new Exception("Damn!"); - return "Hello\n"; - } + function __toString() + { + throw new Exception("Damn!"); + return "Hello\n"; + } - function __destruct() - { - echo $this; - } + function __destruct() + { + echo $this; + } } try { - $o = new Test; - $o = NULL; + $o = new Test; + $o = NULL; } catch(Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> diff --git a/tests/classes/tostring_004.phpt b/tests/classes/tostring_004.phpt index 3627cbf215..8cde860d56 100644 --- a/tests/classes/tostring_004.phpt +++ b/tests/classes/tostring_004.phpt @@ -28,9 +28,9 @@ try { echo "\n\nObject with bad __toString():\n"; class badToString { - function __toString() { - return 0; - } + function __toString() { + return 0; + } } $obj = new badToString; diff --git a/tests/classes/type_hinting_001.phpt b/tests/classes/type_hinting_001.phpt index 35356581f4..fdc74a3194 100644 --- a/tests/classes/type_hinting_001.phpt +++ b/tests/classes/type_hinting_001.phpt @@ -4,21 +4,21 @@ ZE2 class type hinting <?php interface Foo { - function a(Foo $foo); + function a(Foo $foo); } interface Bar { - function b(Bar $bar); + function b(Bar $bar); } class FooBar implements Foo, Bar { - function a(Foo $foo) { - // ... - } + function a(Foo $foo) { + // ... + } - function b(Bar $bar) { - // ... - } + function b(Bar $bar) { + // ... + } } class Blort { diff --git a/tests/classes/type_hinting_002.phpt b/tests/classes/type_hinting_002.phpt index b65bc85c93..23d201a51a 100644 --- a/tests/classes/type_hinting_002.phpt +++ b/tests/classes/type_hinting_002.phpt @@ -4,7 +4,7 @@ ZE2 class type hinting non existing class <?php class Foo { - function a(NonExisting $foo) {} + function a(NonExisting $foo) {} } $o = new Foo; diff --git a/tests/classes/type_hinting_003.phpt b/tests/classes/type_hinting_003.phpt index fb788e3d9c..9dfbd7c3b8 100644 --- a/tests/classes/type_hinting_003.phpt +++ b/tests/classes/type_hinting_003.phpt @@ -5,29 +5,29 @@ ZE2 class type hinting with arrays class Test { - static function f1(array $ar) - { - echo __METHOD__ . "()\n"; - var_dump($ar); - } + static function f1(array $ar) + { + echo __METHOD__ . "()\n"; + var_dump($ar); + } - static function f2(array $ar = NULL) - { - echo __METHOD__ . "()\n"; - var_dump($ar); - } + static function f2(array $ar = NULL) + { + echo __METHOD__ . "()\n"; + var_dump($ar); + } - static function f3(array $ar = array()) - { - echo __METHOD__ . "()\n"; - var_dump($ar); - } + static function f3(array $ar = array()) + { + echo __METHOD__ . "()\n"; + var_dump($ar); + } - static function f4(array $ar = array(25)) - { - echo __METHOD__ . "()\n"; - var_dump($ar); - } + static function f4(array $ar = array(25)) + { + echo __METHOD__ . "()\n"; + var_dump($ar); + } } Test::f1(array(42)); diff --git a/tests/classes/unset_properties.phpt b/tests/classes/unset_properties.phpt index 417542ddea..fa576713d5 100644 --- a/tests/classes/unset_properties.phpt +++ b/tests/classes/unset_properties.phpt @@ -6,68 +6,68 @@ methods themselves. class Test { - public $publicProperty = 'publicProperty set'; - - protected $protectedProperty = 'protectedProperty set'; - - private $privateProperty = 'privateProperty set'; - - public function __get($name) - { - return '__get "' . $name . '"'; - } - - public function __set($name, $value) - { - $this->$name = $value; - echo '__set "' . $name . '" to "' . $value . '"'; - } - - public function __isset($name) - { - echo '__isset "' . $name . '"'; - return isset($this->$name); - } - - public function getPublicProperty() - { - return $this->publicProperty; - } - - public function setPublicProperty($publicProperty) - { - $this->publicProperty = $publicProperty; - } - - public function unsetProtectedProperty() - { - unset($this->protectedProperty); - } - - public function getProtectedProperty() - { - return $this->protectedProperty; - } - - public function setProtectedProperty($protectedProperty) - { - $this->protectedProperty = $protectedProperty; - } - - public function unsetPrivateProperty() - { - unset($this->privateProperty); - } - - public function getPrivateProperty() - { - return $this->privateProperty; - } - - public function setPrivateProperty($privateProperty) - { - $this->privateProperty = $privateProperty; - } + public $publicProperty = 'publicProperty set'; + + protected $protectedProperty = 'protectedProperty set'; + + private $privateProperty = 'privateProperty set'; + + public function __get($name) + { + return '__get "' . $name . '"'; + } + + public function __set($name, $value) + { + $this->$name = $value; + echo '__set "' . $name . '" to "' . $value . '"'; + } + + public function __isset($name) + { + echo '__isset "' . $name . '"'; + return isset($this->$name); + } + + public function getPublicProperty() + { + return $this->publicProperty; + } + + public function setPublicProperty($publicProperty) + { + $this->publicProperty = $publicProperty; + } + + public function unsetProtectedProperty() + { + unset($this->protectedProperty); + } + + public function getProtectedProperty() + { + return $this->protectedProperty; + } + + public function setProtectedProperty($protectedProperty) + { + $this->protectedProperty = $protectedProperty; + } + + public function unsetPrivateProperty() + { + unset($this->privateProperty); + } + + public function getPrivateProperty() + { + return $this->privateProperty; + } + + public function setPrivateProperty($privateProperty) + { + $this->privateProperty = $privateProperty; + } } // verifying public property diff --git a/tests/classes/visibility_000a.phpt b/tests/classes/visibility_000a.phpt index 00e918ad30..276e7a9f79 100644 --- a/tests/classes/visibility_000a.phpt +++ b/tests/classes/visibility_000a.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - protected function f0() {} + protected function f0() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_000b.phpt b/tests/classes/visibility_000b.phpt index aeb3078b72..56e5fd9c27 100644 --- a/tests/classes/visibility_000b.phpt +++ b/tests/classes/visibility_000b.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - private function f0() {} + private function f0() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_000c.phpt b/tests/classes/visibility_000c.phpt index d1a7c9f1e1..c56311d72b 100644 --- a/tests/classes/visibility_000c.phpt +++ b/tests/classes/visibility_000c.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - function f0() {} + function f0() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_001a.phpt b/tests/classes/visibility_001a.phpt index 50baf64d67..bb1a7c2714 100644 --- a/tests/classes/visibility_001a.phpt +++ b/tests/classes/visibility_001a.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - protected function f1() {} + protected function f1() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_001b.phpt b/tests/classes/visibility_001b.phpt index 626b5303f8..666a530f36 100644 --- a/tests/classes/visibility_001b.phpt +++ b/tests/classes/visibility_001b.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - private function f1() {} + private function f1() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_001c.phpt b/tests/classes/visibility_001c.phpt index 956c6762df..8185beddc2 100644 --- a/tests/classes/visibility_001c.phpt +++ b/tests/classes/visibility_001c.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - function f1() {} + function f1() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_002a.phpt b/tests/classes/visibility_002a.phpt index 2fd402070d..c1a93482a5 100644 --- a/tests/classes/visibility_002a.phpt +++ b/tests/classes/visibility_002a.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - protected function f2() {} + protected function f2() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_002b.phpt b/tests/classes/visibility_002b.phpt index a8b1c5e79e..a46386d19c 100644 --- a/tests/classes/visibility_002b.phpt +++ b/tests/classes/visibility_002b.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - private function f2() {} + private function f2() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_002c.phpt b/tests/classes/visibility_002c.phpt index 64560171cc..406a16dd20 100644 --- a/tests/classes/visibility_002c.phpt +++ b/tests/classes/visibility_002c.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - function f2() {} + function f2() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_003a.phpt b/tests/classes/visibility_003a.phpt index 17f5b49eb9..4a9bb97f9c 100644 --- a/tests/classes/visibility_003a.phpt +++ b/tests/classes/visibility_003a.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - public function f3() {} + public function f3() {} } echo "Done\n"; diff --git a/tests/classes/visibility_003b.phpt b/tests/classes/visibility_003b.phpt index 474e0df235..504408e68f 100644 --- a/tests/classes/visibility_003b.phpt +++ b/tests/classes/visibility_003b.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - private function f3() {} + private function f3() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_003c.phpt b/tests/classes/visibility_003c.phpt index 7ac3239f59..e396331110 100644 --- a/tests/classes/visibility_003c.phpt +++ b/tests/classes/visibility_003c.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - function f3() {} + function f3() {} } echo "Done\n"; diff --git a/tests/classes/visibility_004a.phpt b/tests/classes/visibility_004a.phpt index a6acb40569..115d5d743e 100644 --- a/tests/classes/visibility_004a.phpt +++ b/tests/classes/visibility_004a.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - public function f4() {} + public function f4() {} } echo "Done\n"; diff --git a/tests/classes/visibility_004b.phpt b/tests/classes/visibility_004b.phpt index 9e416fc6ae..203ae878ff 100644 --- a/tests/classes/visibility_004b.phpt +++ b/tests/classes/visibility_004b.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - protected function f4() {} + protected function f4() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_004c.phpt b/tests/classes/visibility_004c.phpt index abe25b1b39..b2d0939bb9 100644 --- a/tests/classes/visibility_004c.phpt +++ b/tests/classes/visibility_004c.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - function f4() {} + function f4() {} } echo "Done\n"; diff --git a/tests/classes/visibility_005.phpt b/tests/classes/visibility_005.phpt index 859a5f7b6c..ac7a2dd35a 100644 --- a/tests/classes/visibility_005.phpt +++ b/tests/classes/visibility_005.phpt @@ -5,16 +5,16 @@ ZE2 foreach and property visibility class base { - public $a=1; - protected $b=2; - private $c=3; + public $a=1; + protected $b=2; + private $c=3; - function f() - { - foreach($this as $k=>$v) { - echo "$k=>$v\n"; - } - } + function f() + { + foreach($this as $k=>$v) { + echo "$k=>$v\n"; + } + } } class derived extends base @@ -27,7 +27,7 @@ echo "===base::function===\n"; $o->f(); echo "===base,foreach===\n"; foreach($o as $k=>$v) { - echo "$k=>$v\n"; + echo "$k=>$v\n"; } $o = new derived; @@ -36,7 +36,7 @@ echo "===derived::function===\n"; $o->f(); echo "===derived,foreach===\n"; foreach($o as $k=>$v) { - echo "$k=>$v\n"; + echo "$k=>$v\n"; } ?> diff --git a/tests/func/003.phpt b/tests/func/003.phpt index 8234af2e17..2333947249 100644 --- a/tests/func/003.phpt +++ b/tests/func/003.phpt @@ -89,10 +89,10 @@ echo "$result\n"; function andi($i, $j) { - for ($k=$i ; $k<=$j ; $k++) { - if ($k >5) continue; - echo "$k\n"; - } + for ($k=$i ; $k<=$j ; $k++) { + if ($k >5) continue; + echo "$k\n"; + } } andi (3,10); diff --git a/tests/func/005.phpt b/tests/func/005.phpt index 1ba45123c4..6373d2e550 100644 --- a/tests/func/005.phpt +++ b/tests/func/005.phpt @@ -5,7 +5,7 @@ Testing register_shutdown_function() function foo() { - print "foo"; + print "foo"; } register_shutdown_function("foo"); diff --git a/tests/func/005a.phpt b/tests/func/005a.phpt index 8cd0d211ab..a7ed5dbfdd 100644 --- a/tests/func/005a.phpt +++ b/tests/func/005a.phpt @@ -13,7 +13,7 @@ echo "Start\n"; function boo() { - echo "Shutdown\n"; + echo "Shutdown\n"; } register_shutdown_function("boo"); diff --git a/tests/func/010.phpt b/tests/func/010.phpt index 4c28dea1b7..8b21df31ea 100644 --- a/tests/func/010.phpt +++ b/tests/func/010.phpt @@ -14,15 +14,15 @@ $limit = $boundary+42; function test($a,$b) { - var_dump($a === $b); - test2($a,$b); + var_dump($a === $b); + test2($a,$b); } function test2($a, $b) { - if ($a !== $b) { - var_dump("something went wrong: $a !== $b"); - } + if ($a !== $b) { + var_dump("something went wrong: $a !== $b"); + } } @@ -30,25 +30,25 @@ function test2($a, $b) $str = "<?php\nfunction x("; for($i=0; $i < $limit; ++$i) { - $str .= '$v'.dechex($i).($i===($limit-1) ? '' : ','); + $str .= '$v'.dechex($i).($i===($limit-1) ? '' : ','); } $str .= ') { - test($v42, \'42\'); - test(\'4000\', $v4000); - test2($v300, \'300\'); - test($v0, \'0\'); // first - test($v'.dechex($limit-1).", '".dechex($limit-1).'\'); // last - test($v'.dechex($boundary).", '".dechex($boundary).'\'); //boundary - test($v'.dechex($boundary+1).", '".dechex($boundary+1).'\'); //boundary+1 - test($v'.dechex($boundary-1).", '".dechex($boundary-1).'\'); //boundary-1 + test($v42, \'42\'); + test(\'4000\', $v4000); + test2($v300, \'300\'); + test($v0, \'0\'); // first + test($v'.dechex($limit-1).", '".dechex($limit-1).'\'); // last + test($v'.dechex($boundary).", '".dechex($boundary).'\'); //boundary + test($v'.dechex($boundary+1).", '".dechex($boundary+1).'\'); //boundary+1 + test($v'.dechex($boundary-1).", '".dechex($boundary-1).'\'); //boundary-1 }'; // generate the function call $str .= "\n\nx("; for($i=0; $i< $limit; ++$i) { - $str .= "'".dechex($i)."'".($i===($limit-1) ? '' : ','); + $str .= "'".dechex($i)."'".($i===($limit-1) ? '' : ','); } $str .= ");\n"; diff --git a/tests/lang/002.phpt b/tests/lang/002.phpt index 251f90b0a2..b1b4b0849d 100644 --- a/tests/lang/002.phpt +++ b/tests/lang/002.phpt @@ -4,8 +4,8 @@ Simple While Loop Test <?php $a=1; while ($a<10) { - echo $a; - $a++; + echo $a; + $a++; } ?> --EXPECT-- diff --git a/tests/lang/003.phpt b/tests/lang/003.phpt index a580fc60cd..d6f85e0ad0 100644 --- a/tests/lang/003.phpt +++ b/tests/lang/003.phpt @@ -4,15 +4,15 @@ Simple Switch Test <?php $a=1; switch($a) { - case 0: - echo "bad"; - break; - case 1: - echo "good"; - break; - default: - echo "bad"; - break; + case 0: + echo "bad"; + break; + case 1: + echo "good"; + break; + default: + echo "bad"; + break; } ?> --EXPECT-- diff --git a/tests/lang/004.phpt b/tests/lang/004.phpt index 9ca3492cde..5a4ed8797c 100644 --- a/tests/lang/004.phpt +++ b/tests/lang/004.phpt @@ -4,9 +4,9 @@ Simple If/Else Test <?php $a=1; if($a==0) { - echo "bad"; + echo "bad"; } else { - echo "good"; + echo "good"; } ?> --EXPECT-- diff --git a/tests/lang/005.phpt b/tests/lang/005.phpt index fe3633b58b..cb8de72e09 100644 --- a/tests/lang/005.phpt +++ b/tests/lang/005.phpt @@ -5,11 +5,11 @@ Simple If/ElseIf/Else Test $a=1; if($a==0) { - echo "bad"; + echo "bad"; } elseif($a==3) { - echo "bad"; + echo "bad"; } else { - echo "good"; + echo "good"; } ?> --EXPECT-- diff --git a/tests/lang/006.phpt b/tests/lang/006.phpt index 5056b8a4ee..c8ca378d46 100644 --- a/tests/lang/006.phpt +++ b/tests/lang/006.phpt @@ -6,17 +6,17 @@ $a=1; $b=2; if($a==0) { - echo "bad"; + echo "bad"; } elseif($a==3) { - echo "bad"; + echo "bad"; } else { - if($b==1) { - echo "bad"; - } elseif($b==2) { - echo "good"; - } else { - echo "bad"; - } + if($b==1) { + echo "bad"; + } elseif($b==2) { + echo "good"; + } else { + echo "bad"; + } } ?> --EXPECT-- diff --git a/tests/lang/007.phpt b/tests/lang/007.phpt index 946ae9babb..735de94974 100644 --- a/tests/lang/007.phpt +++ b/tests/lang/007.phpt @@ -7,14 +7,14 @@ $a = 10; function Test() { - static $a=1; - global $b; - $c = 1; - $b = 5; - echo "$a $b "; - $a++; - $c++; - echo "$a $c "; + static $a=1; + global $b; + $c = 1; + $b = 5; + echo "$a $b "; + $a++; + $c++; + echo "$a $c "; } Test(); diff --git a/tests/lang/008.phpt b/tests/lang/008.phpt index 8633b6049a..6b5ae75d2d 100644 --- a/tests/lang/008.phpt +++ b/tests/lang/008.phpt @@ -5,10 +5,10 @@ Testing recursive function function Test() { - static $a=1; - echo "$a "; - $a++; - if($a<10): Test(); endif; + static $a=1; + echo "$a "; + $a++; + if($a<10): Test(); endif; } Test(); diff --git a/tests/lang/009.phpt b/tests/lang/009.phpt index 8621a73e50..a5403d696a 100644 --- a/tests/lang/009.phpt +++ b/tests/lang/009.phpt @@ -3,7 +3,7 @@ Testing function parameter passing --FILE-- <?php function test ($a,$b) { - echo $a+$b; + echo $a+$b; } test(1,2); ?> diff --git a/tests/lang/010.phpt b/tests/lang/010.phpt index 603abe34d5..707c2bfae6 100644 --- a/tests/lang/010.phpt +++ b/tests/lang/010.phpt @@ -3,8 +3,8 @@ Testing function parameter passing with a return value --FILE-- <?php function test ($b) { - $b++; - return($b); + $b++; + return($b); } $a = test(1); echo $a; diff --git a/tests/lang/011.phpt b/tests/lang/011.phpt index b7946b7460..99a2d1c6a8 100644 --- a/tests/lang/011.phpt +++ b/tests/lang/011.phpt @@ -4,8 +4,8 @@ Testing nested functions <?php function F() { - $a = "Hello "; - return($a); + $a = "Hello "; + return($a); } function G() diff --git a/tests/lang/012.phpt b/tests/lang/012.phpt index 203d7cebe3..0f88fe21d7 100644 --- a/tests/lang/012.phpt +++ b/tests/lang/012.phpt @@ -3,15 +3,15 @@ Testing stack after early function return --FILE-- <?php function F () { - if(1) { - return("Hello"); - } + if(1) { + return("Hello"); + } } $i=0; while ($i<2) { - echo F(); - $i++; + echo F(); + $i++; } ?> --EXPECT-- diff --git a/tests/lang/014.phpt b/tests/lang/014.phpt index fe6f86e22a..b2d605c8ea 100644 --- a/tests/lang/014.phpt +++ b/tests/lang/014.phpt @@ -3,7 +3,7 @@ Testing eval function inside user-defined function --FILE-- <?php function F ($a) { - eval($a); + eval($a); } error_reporting(0); diff --git a/tests/lang/015.inc b/tests/lang/015.inc index fae56c4810..a528d8cd9f 100644 --- a/tests/lang/015.inc +++ b/tests/lang/015.inc @@ -1,3 +1,3 @@ <?php - echo "Hello"; + echo "Hello"; ?> diff --git a/tests/lang/016.inc b/tests/lang/016.inc index 56aa85d65b..453755d870 100644 --- a/tests/lang/016.inc +++ b/tests/lang/016.inc @@ -1,5 +1,5 @@ <?php function MyFunc ($a) { - echo $a; + echo $a; } ?> diff --git a/tests/lang/017.phpt b/tests/lang/017.phpt index fb90964820..264b3906fe 100644 --- a/tests/lang/017.phpt +++ b/tests/lang/017.phpt @@ -4,14 +4,14 @@ Testing user-defined function falling out of an If into another <?php $a = 1; function Test ($a) { - if ($a<3) { - return(3); - } + if ($a<3) { + return(3); + } } if ($a < Test($a)) { - echo "$a\n"; - $a++; + echo "$a\n"; + $a++; } ?> --EXPECT-- diff --git a/tests/lang/020.phpt b/tests/lang/020.phpt index 9428ec5e6f..97c928d200 100644 --- a/tests/lang/020.phpt +++ b/tests/lang/020.phpt @@ -8,38 +8,38 @@ $i="abc"; for ($j=0; $j<10; $j++) { switch (1) { case 1: - echo "In branch 1\n"; - switch ($i) { - case "ab": - echo "This doesn't work... :(\n"; - break; - case "abcd": - echo "This works!\n"; - break; - case "blah": - echo "Hmmm, no worki\n"; - break; - default: - echo "Inner default...\n"; - } - for ($blah=0; $blah<200; $blah++) { - if ($blah==100) { - echo "blah=$blah\n"; - } - } - break; + echo "In branch 1\n"; + switch ($i) { + case "ab": + echo "This doesn't work... :(\n"; + break; + case "abcd": + echo "This works!\n"; + break; + case "blah": + echo "Hmmm, no worki\n"; + break; + default: + echo "Inner default...\n"; + } + for ($blah=0; $blah<200; $blah++) { + if ($blah==100) { + echo "blah=$blah\n"; + } + } + break; case 2: - echo "In branch 2\n"; - break; + echo "In branch 2\n"; + break; case $i: - echo "In branch \$i\n"; - break; + echo "In branch \$i\n"; + break; case 4: - echo "In branch 4\n"; - break; + echo "In branch 4\n"; + break; default: - echo "Hi, I'm default\n"; - break; + echo "Hi, I'm default\n"; + break; } } ?> diff --git a/tests/lang/022.phpt b/tests/lang/022.phpt index 9660530bc7..74c4e290a8 100644 --- a/tests/lang/022.phpt +++ b/tests/lang/022.phpt @@ -5,24 +5,24 @@ Switch test 3 function switchtest ($i, $j) { - switch ($i) { - case 0: - switch($j) { - case 0: - echo "zero"; - break; - case 1: - echo "one"; - break; - default: - echo $j; - break; - } - echo "\n"; - break; - default: - echo "Default taken\n"; - } + switch ($i) { + case 0: + switch($j) { + case 0: + echo "zero"; + break; + case 1: + echo "one"; + break; + default: + echo $j; + break; + } + echo "\n"; + break; + default: + echo "Default taken\n"; + } } for ($i=0; $i<3; $i++) { for ($k=0; $k<10; $k++) { diff --git a/tests/lang/023-1.inc b/tests/lang/023-1.inc index 153f5d7668..e4c480c730 100644 --- a/tests/lang/023-1.inc +++ b/tests/lang/023-1.inc @@ -59,31 +59,31 @@ Correct result - 3: <?php echo $j%$i; ?><br> /* sick if/elseif/else test by Andi :) */ $a = 5; if ($a == "4") { - echo "This "." does "." not "." work<br>\n"; + echo "This "." does "." not "." work<br>\n"; } elseif ($a == "5") { - echo "This "." works<br>\n"; - $a = 6; - if ("andi" == ($test = "andi")) { - echo "this_still_works<br>\n"; - } elseif (1) { - echo "should_not_print<br>\n"; - } else { - echo "should_not_print<br>\n"; - } + echo "This "." works<br>\n"; + $a = 6; + if ("andi" == ($test = "andi")) { + echo "this_still_works<br>\n"; + } elseif (1) { + echo "should_not_print<br>\n"; + } else { + echo "should_not_print<br>\n"; + } if (44 == 43) { - echo "should_not_print<br>\n"; - } else { - echo "should_print<br>\n"; - } + echo "should_not_print<br>\n"; + } else { + echo "should_print<br>\n"; + } } elseif ($a == 6) { - echo "this "."broken<br>\n"; - if (0) { - echo "this_should_not_print<br>\n"; - } else { - echo "TestingDanglingElse_This_Should_not_print<br>\n"; - } + echo "this "."broken<br>\n"; + if (0) { + echo "this_should_not_print<br>\n"; + } else { + echo "TestingDanglingElse_This_Should_not_print<br>\n"; + } } else { - echo "This "."does "." not"." work<br>\n"; + echo "This "."does "." not"." work<br>\n"; } ?> @@ -277,18 +277,18 @@ echo "commented out..."; $i = 10; $a = 'b'; while ($i > 0) { - $a = $a . 'a'; - echo "$a<br>\n"; - $resize[$a] = $i; - $i--; + $a = $a . 'a'; + echo "$a<br>\n"; + $resize[$a] = $i; + $i--; } $i = 10; $a = 'b'; while ($i > 0) { - $a = $a . 'a'; - echo "$a<br>\n"; - echo $resize[$a]."<br>\n"; - $i--; + $a = $a . 'a'; + echo "$a<br>\n"; + echo $resize[$a]."<br>\n"; + $i--; } ?> **************************<br> diff --git a/tests/lang/024.phpt b/tests/lang/024.phpt index 357846555a..1e2fd76f0b 100644 --- a/tests/lang/024.phpt +++ b/tests/lang/024.phpt @@ -76,31 +76,31 @@ Correct result - 3: <?php echo $j%$i; ?> /* sick if/elseif/else test by Andi :) */ $a = 5; if ($a == "4") { - echo "This "." does "." not "." work\n"; + echo "This "." does "." not "." work\n"; } elseif ($a == "5") { - echo "This "." works\n"; - $a = 6; - if ("andi" == ($test = "andi")) { - echo "this_still_works\n"; - } elseif (1) { - echo "should_not_print\n"; - } else { - echo "should_not_print\n"; - } + echo "This "." works\n"; + $a = 6; + if ("andi" == ($test = "andi")) { + echo "this_still_works\n"; + } elseif (1) { + echo "should_not_print\n"; + } else { + echo "should_not_print\n"; + } if (44 == 43) { - echo "should_not_print\n"; - } else { - echo "should_print\n"; - } + echo "should_not_print\n"; + } else { + echo "should_print\n"; + } } elseif ($a == 6) { - echo "this "."broken\n"; - if (0) { - echo "this_should_not_print\n"; - } else { - echo "TestingDanglingElse_This_Should_not_print\n"; - } + echo "this "."broken\n"; + if (0) { + echo "this_should_not_print\n"; + } else { + echo "TestingDanglingElse_This_Should_not_print\n"; + } } else { - echo "This "."does "." not"." work\n"; + echo "This "."does "." not"." work\n"; } ?> @@ -292,18 +292,18 @@ echo "commented out..."; $i = 10; $a = "b"; while ($i > 0) { - $a = $a . "a"; - echo "$a\n"; - $resize[$a] = $i; - $i--; + $a = $a . "a"; + echo "$a\n"; + $resize[$a] = $i; + $i--; } $i = 10; $a = "b"; while ($i > 0) { - $a = $a . "a"; - echo "$a\n"; - echo $resize[$a]."\n"; - $i--; + $a = $a . "a"; + echo "$a\n"; + echo $resize[$a]."\n"; + $i--; } ?> ************************** diff --git a/tests/lang/025.phpt b/tests/lang/025.phpt index 13c02d31d4..a49b8abb5a 100644 --- a/tests/lang/025.phpt +++ b/tests/lang/025.phpt @@ -3,15 +3,15 @@ Mean recursion test --FILE-- <?php function RekTest ($nr) { - echo " $nr "; - $j=$nr+1; - while ($j < 10) { - echo " a "; - RekTest($j); - $j++; - echo " b $j "; - } - echo "\n"; + echo " $nr "; + $j=$nr+1; + while ($j < 10) { + echo " a "; + RekTest($j); + $j++; + echo " b $j "; + } + echo "\n"; } RekTest(0); diff --git a/tests/lang/027.phpt b/tests/lang/027.phpt index 9c826cfe93..3bcbe3ae4b 100644 --- a/tests/lang/027.phpt +++ b/tests/lang/027.phpt @@ -4,8 +4,8 @@ Testing do-while loop <?php $i=3; do { - echo $i; - $i--; + echo $i; + $i--; } while($i>0); ?> --EXPECT-- diff --git a/tests/lang/028.phpt b/tests/lang/028.phpt index e455c3b446..746101cefe 100644 --- a/tests/lang/028.phpt +++ b/tests/lang/028.phpt @@ -7,43 +7,43 @@ error_reporting(1023); function print_stuff($stuff) { - print $stuff; + print $stuff; } function still_working() { - return "I'm still alive"; + return "I'm still alive"; } function dafna() { - static $foo = 0; + static $foo = 0; - print "Dafna!\n"; - print call_user_func("still_working")."\n"; - $foo++; - return (string) $foo; + print "Dafna!\n"; + print call_user_func("still_working")."\n"; + $foo++; + return (string) $foo; } class dafna_class { - function __construct() { - $this->myname = "Dafna"; - } - function GetMyName() { - return $this->myname; - } - function SetMyName($name) { - $this->myname = $name; - } + function __construct() { + $this->myname = "Dafna"; + } + function GetMyName() { + return $this->myname; + } + function SetMyName($name) { + $this->myname = $name; + } }; for ($i=0; $i<200; $i++): - print "$i\n"; - call_user_func("dafna"); - call_user_func("print_stuff","Hey there!!\n"); - print "$i\n"; + print "$i\n"; + call_user_func("dafna"); + call_user_func("print_stuff","Hey there!!\n"); + print "$i\n"; endfor; diff --git a/tests/lang/030.phpt b/tests/lang/030.phpt index 7f94b2eb74..1d88fa9d69 100644 --- a/tests/lang/030.phpt +++ b/tests/lang/030.phpt @@ -3,19 +3,19 @@ $this in constructor test --FILE-- <?php class foo { - function __construct($name) { - $GLOBALS['List']= &$this; - $this->Name = $name; - $GLOBALS['List']->echoName(); - } + function __construct($name) { + $GLOBALS['List']= &$this; + $this->Name = $name; + $GLOBALS['List']->echoName(); + } - function echoName() { - $GLOBALS['names'][]=$this->Name; - } + function echoName() { + $GLOBALS['names'][]=$this->Name; + } } function &foo2(&$foo) { - return $foo; + return $foo; } diff --git a/tests/lang/032.phpt b/tests/lang/032.phpt index abc98f752d..86d70abbe5 100644 --- a/tests/lang/032.phpt +++ b/tests/lang/032.phpt @@ -3,29 +3,29 @@ Class method registration --FILE-- <?php class A { - function foo() {} + function foo() {} } class B extends A { - function foo() {} + function foo() {} } class C extends B { - function foo() {} + function foo() {} } class D extends A { } class F extends D { - function foo() {} + function foo() {} } // Following class definition should fail, but cannot test /* class X { - function foo() {} - function foo() {} + function foo() {} + function foo() {} } */ diff --git a/tests/lang/033.phpt b/tests/lang/033.phpt index 46db0129b4..4bba5e8783 100644 --- a/tests/lang/033.phpt +++ b/tests/lang/033.phpt @@ -7,34 +7,34 @@ $a = 1; echo "If: "; if ($a) echo 1; else echo 0; if ($a): - echo 1; + echo 1; else: - echo 0; + echo 0; endif; echo "\nWhile: "; while ($a<5) echo $a++; while ($a<9): - echo ++$a; + echo ++$a; endwhile; echo "\nFor: "; for($a=0;$a<5;$a++) echo $a; for($a=0;$a<5;$a++): - echo $a; + echo $a; endfor; echo "\nSwitch: "; switch ($a): - case 0; - echo 0; - break; - case 5: - echo 1; - break; - default; - echo 0; - break; + case 0; + echo 0; + break; + case 5: + echo 1; + break; + default; + echo 0; + break; endswitch; ?> diff --git a/tests/lang/035.phpt b/tests/lang/035.phpt index bc49af99a5..0292868d7f 100644 --- a/tests/lang/035.phpt +++ b/tests/lang/035.phpt @@ -3,33 +3,33 @@ ZE2: set_exception_handler() --FILE-- <?php class MyException extends Exception { - function __construct($_error) { - $this->error = $_error; - } + function __construct($_error) { + $this->error = $_error; + } - function getException() - { - return $this->error; - } + function getException() + { + return $this->error; + } } function ThrowException() { - throw new MyException("'This is an exception!'"); + throw new MyException("'This is an exception!'"); } try { } catch (MyException $exception) { - print "There shouldn't be an exception: " . $exception->getException(); - print "\n"; + print "There shouldn't be an exception: " . $exception->getException(); + print "\n"; } try { - ThrowException(); + ThrowException(); } catch (MyException $exception) { - print "There was an exception: " . $exception->getException(); - print "\n"; + print "There was an exception: " . $exception->getException(); + print "\n"; } ?> --EXPECT-- diff --git a/tests/lang/036.phpt b/tests/lang/036.phpt index 474316e363..973deb6a0a 100644 --- a/tests/lang/036.phpt +++ b/tests/lang/036.phpt @@ -3,20 +3,20 @@ Child public element should not override parent private element in parent method --FILE-- <?php class par { - private $id = "foo"; + private $id = "foo"; - function displayMe() - { - print $this->id; - } + function displayMe() + { + print $this->id; + } }; class chld extends par { - public $id = "bar"; - function displayHim() - { - parent::displayMe(); - } + public $id = "bar"; + function displayHim() + { + parent::displayMe(); + } }; diff --git a/tests/lang/037.phpt b/tests/lang/037.phpt index c2a1ee312f..3d316f571c 100644 --- a/tests/lang/037.phpt +++ b/tests/lang/037.phpt @@ -4,21 +4,21 @@ <?php class par { - private $id="foo"; + private $id="foo"; - function displayMe() - { - $this->displayChild(); - } + function displayMe() + { + $this->displayChild(); + } }; class chld extends par { - private $id = "bar"; + private $id = "bar"; - function displayChild() - { - print $this->id; - } + function displayChild() + { + print $this->id; + } }; diff --git a/tests/lang/038.phpt b/tests/lang/038.phpt index 92f340c3f2..677c11be9c 100644 --- a/tests/lang/038.phpt +++ b/tests/lang/038.phpt @@ -5,17 +5,17 @@ Convert warnings to exceptions class MyException extends Exception { - function __construct($errstr, $errno=0, $errfile='', $errline='') - { - parent::__construct($errstr, $errno); - $this->file = $errfile; - $this->line = $errline; - } + function __construct($errstr, $errno=0, $errfile='', $errline='') + { + parent::__construct($errstr, $errno); + $this->file = $errfile; + $this->line = $errline; + } } function Error2Exception($errno, $errstr, $errfile, $errline) { - throw new MyException($errstr, $errno);//, $errfile, $errline); + throw new MyException($errstr, $errno);//, $errfile, $errline); } $err_msg = 'no exception'; @@ -23,13 +23,13 @@ set_error_handler('Error2Exception'); try { - $con = fopen("/tmp/a_file_that_does_not_exist",'r'); + $con = fopen("/tmp/a_file_that_does_not_exist",'r'); } catch (Exception $e) { - $trace = $e->getTrace(); - var_dump($trace[0]['function']); - var_dump($trace[1]['function']); + $trace = $e->getTrace(); + var_dump($trace[0]['function']); + var_dump($trace[1]['function']); } ?> diff --git a/tests/lang/039.phpt b/tests/lang/039.phpt index 764991fbb3..98d0902f53 100644 --- a/tests/lang/039.phpt +++ b/tests/lang/039.phpt @@ -9,17 +9,17 @@ interface Catchable class MyException extends Exception implements Catchable { - function __construct($errstr, $errno, $errfile, $errline) - { - parent::__construct($errstr, $errno); - $this->file = $errfile; - $this->line = $errline; - } + function __construct($errstr, $errno, $errfile, $errline) + { + parent::__construct($errstr, $errno); + $this->file = $errfile; + $this->line = $errline; + } } function Error2Exception($errno, $errstr, $errfile, $errline) { - throw new MyException($errstr, $errno, $errfile, $errline); + throw new MyException($errstr, $errno, $errfile, $errline); } $err_msg = 'no exception'; @@ -27,15 +27,15 @@ set_error_handler('Error2Exception'); try { - $con = fopen('/tmp/a_file_that_does_not_exist','r'); + $con = fopen('/tmp/a_file_that_does_not_exist','r'); } catch (Catchable $e) { - echo "Catchable\n"; + echo "Catchable\n"; } catch (Exception $e) { - echo "Exception\n"; + echo "Exception\n"; } ?> diff --git a/tests/lang/bug18872.phpt b/tests/lang/bug18872.phpt index 5e5333879d..1b4dd64ea1 100644 --- a/tests/lang/bug18872.phpt +++ b/tests/lang/bug18872.phpt @@ -3,11 +3,11 @@ Bug #18872 (class constant used as default parameter) --FILE-- <?php class FooBar { - const BIFF = 3; + const BIFF = 3; } function foo($biff = FooBar::BIFF) { - echo $biff . "\n"; + echo $biff . "\n"; } foo(); diff --git a/tests/lang/bug19943.phpt b/tests/lang/bug19943.phpt index c951190511..2266e09165 100644 --- a/tests/lang/bug19943.phpt +++ b/tests/lang/bug19943.phpt @@ -2,18 +2,18 @@ Bug #19943 (memleaks) --FILE-- <?php - $ar = array(); - for ($count = 0; $count < 10; $count++) { - $ar[$count] = "$count"; - @$ar[$count]['idx'] = "$count"; - } + $ar = array(); + for ($count = 0; $count < 10; $count++) { + $ar[$count] = "$count"; + @$ar[$count]['idx'] = "$count"; + } - for ($count = 0; $count < 10; $count++) { - echo $ar[$count]." -- ".@$ar[$count]['idx']."\n"; - } - $a = "0123456789"; - $a[9] = $a[0]; - var_dump($a); + for ($count = 0; $count < 10; $count++) { + echo $ar[$count]." -- ".@$ar[$count]['idx']."\n"; + } + $a = "0123456789"; + $a[9] = $a[0]; + var_dump($a); ?> --EXPECT-- 0 -- 0 diff --git a/tests/lang/bug20175.phpt b/tests/lang/bug20175.phpt index 0d040c82d9..5ab5677dd6 100644 --- a/tests/lang/bug20175.phpt +++ b/tests/lang/bug20175.phpt @@ -16,18 +16,18 @@ print zend_version()."\n"; $foo_count = 0; function foo_global() { - global $foo_count; - echo "foo_global()\n"; - return 'foo:' . ++$foo_count; + global $foo_count; + echo "foo_global()\n"; + return 'foo:' . ++$foo_count; } function foo_static() { - static $foo_value; - echo "foo_static()\n"; - if (!isset($foo_value)) { - $foo_value = foo_global(); - } - return $foo_value; + static $foo_value; + echo "foo_static()\n"; + if (!isset($foo_value)) { + $foo_value = foo_global(); + } + return $foo_value; } /* Part 2: @@ -40,18 +40,18 @@ function foo_static() { $bar_count = 0; function bar_global() { - global $bar_count; - echo "bar_global()\n"; - return 'bar:' . ++$bar_count; + global $bar_count; + echo "bar_global()\n"; + return 'bar:' . ++$bar_count; } function bar_static() { - static $bar_value; - echo "bar_static()\n"; - if (!isset($bar_value)) { - $bar_value = &bar_global(); - } - return $bar_value; + static $bar_value; + echo "bar_static()\n"; + if (!isset($bar_value)) { + $bar_value = &bar_global(); + } + return $bar_value; } /* Part 3: TO BE DISCUSSED @@ -66,19 +66,19 @@ $wow_count = 0; $wow_name = ''; function &wow_global() { - global $wow_count, $wow_name; - echo "wow_global()\n"; - $wow_name = 'wow:' . ++$wow_count; - return $wow_name; + global $wow_count, $wow_name; + echo "wow_global()\n"; + $wow_name = 'wow:' . ++$wow_count; + return $wow_name; } function wow_static() { - static $wow_value; - echo "wow_static()\n"; - if (!isset($wow_value)) { - $wow_value = &wow_global(); - } - return $wow_value; + static $wow_value; + echo "wow_static()\n"; + if (!isset($wow_value)) { + $wow_value = &wow_global(); + } + return $wow_value; }*/ /* Part 4: @@ -93,29 +93,29 @@ function wow_static() { */ $oop_global = 0; class oop_class { - var $oop_name; + var $oop_name; - function __construct() { - global $oop_global; - echo "oop_class()\n"; - $this->oop_name = 'oop:' . ++$oop_global; - } + function __construct() { + global $oop_global; + echo "oop_class()\n"; + $this->oop_name = 'oop:' . ++$oop_global; + } } class oop_test { - static $oop_value; - - function __construct() { - echo "oop_test()\n"; - } - - function oop_static() { - echo "oop_static()\n"; - if (!isset(self::$oop_value)) { - self::$oop_value = new oop_class; - } - echo self::$oop_value->oop_name; - } + static $oop_value; + + function __construct() { + echo "oop_test()\n"; + } + + function oop_static() { + echo "oop_static()\n"; + if (!isset(self::$oop_value)) { + self::$oop_value = new oop_class; + } + echo self::$oop_value->oop_name; + } } print foo_static()."\n"; diff --git a/tests/lang/bug21094.phpt b/tests/lang/bug21094.phpt index 346185ba83..68928e9155 100644 --- a/tests/lang/bug21094.phpt +++ b/tests/lang/bug21094.phpt @@ -3,9 +3,9 @@ Bug #21094 (set_error_handler not accepting methods) --FILE-- <?php class test { - function hdlr($errno, $errstr, $errfile, $errline) { - printf("[%d] errstr: %s, errfile: %s, errline: %d\n", $errno, $errstr, $errfile, $errline, $errstr); - } + function hdlr($errno, $errstr, $errfile, $errline) { + printf("[%d] errstr: %s, errfile: %s, errline: %d\n", $errno, $errstr, $errfile, $errline, $errstr); + } } set_error_handler(array(new test(), "hdlr")); diff --git a/tests/lang/bug21669.phpt b/tests/lang/bug21669.phpt index 643b0695ee..17db108157 100644 --- a/tests/lang/bug21669.phpt +++ b/tests/lang/bug21669.phpt @@ -3,17 +3,17 @@ Bug #21669 ("$obj = new $this->var;" doesn't work) --FILE-- <?php class Test { - function say_hello() { - echo "Hello world"; - } + function say_hello() { + echo "Hello world"; + } } class Factory { - public $name = "Test"; - function create() { - $obj = new $this->name; /* Parse error */ - return $obj; - } + public $name = "Test"; + function create() { + $obj = new $this->name; /* Parse error */ + return $obj; + } } $factory = new Factory; $test = $factory->create(); diff --git a/tests/lang/bug21849.phpt b/tests/lang/bug21849.phpt index def754a3a6..3b7f664f86 100644 --- a/tests/lang/bug21849.phpt +++ b/tests/lang/bug21849.phpt @@ -3,11 +3,11 @@ Bug #21849 (self::constant doesn't work as method's default parameter) --FILE-- <?php class foo { - const bar = "fubar\n"; + const bar = "fubar\n"; - function __construct($arg = self::bar) { - echo $arg; - } + function __construct($arg = self::bar) { + echo $arg; + } } new foo(); diff --git a/tests/lang/bug21961.phpt b/tests/lang/bug21961.phpt index 93e4374220..a03c382eb3 100644 --- a/tests/lang/bug21961.phpt +++ b/tests/lang/bug21961.phpt @@ -5,47 +5,47 @@ Bug #21961 (get_parent_class() segfault) class man { - public $name, $bars; - function __construct() - { - $this->name = 'Mr. X'; - $this->bars = array(); - } - - function getdrunk($where) - { - $this->bars[] = new bar($where); - } - - function getName() - { - return $this->name; - } + public $name, $bars; + function __construct() + { + $this->name = 'Mr. X'; + $this->bars = array(); + } + + function getdrunk($where) + { + $this->bars[] = new bar($where); + } + + function getName() + { + return $this->name; + } } class bar extends man { - public $name; - - function __construct($w) - { - $this->name = $w; - } - - function getName() - { - return $this->name; - } - - function whosdrunk() - { - $who = get_parent_class($this); - if($who == NULL) - { - return 'nobody'; - } - return eval("return ".$who.'::getName();'); - } + public $name; + + function __construct($w) + { + $this->name = $w; + } + + function getName() + { + return $this->name; + } + + function whosdrunk() + { + $who = get_parent_class($this); + if($who == NULL) + { + return 'nobody'; + } + return eval("return ".$who.'::getName();'); + } } $x = new man; diff --git a/tests/lang/bug22510.phpt b/tests/lang/bug22510.phpt index 842373c6c6..e79972d29e 100644 --- a/tests/lang/bug22510.phpt +++ b/tests/lang/bug22510.phpt @@ -4,74 +4,74 @@ Bug #22510 (segfault among complex references) <?php class foo { - public $list = array(); - - function finalize() { - print __CLASS__."::".__FUNCTION__."\n"; - $cl = &$this->list; - } - - function &method1() { - print __CLASS__."::".__FUNCTION__."\n"; - return @$this->foo; - } - - function &method2() { - print __CLASS__."::".__FUNCTION__."\n"; - return $this->foo; - } - - function method3() { - print __CLASS__."::".__FUNCTION__."\n"; - return @$this->foo; - } + public $list = array(); + + function finalize() { + print __CLASS__."::".__FUNCTION__."\n"; + $cl = &$this->list; + } + + function &method1() { + print __CLASS__."::".__FUNCTION__."\n"; + return @$this->foo; + } + + function &method2() { + print __CLASS__."::".__FUNCTION__."\n"; + return $this->foo; + } + + function method3() { + print __CLASS__."::".__FUNCTION__."\n"; + return @$this->foo; + } } class bar { - function run1() { - print __CLASS__."::".__FUNCTION__."\n"; - $this->instance = new foo(); - $this->instance->method1($this); - $this->instance->method1($this); - } - - function run2() { - print __CLASS__."::".__FUNCTION__."\n"; - $this->instance = new foo(); - $this->instance->method2($this); - $this->instance->method2($this); - } - - function run3() { - print __CLASS__."::".__FUNCTION__."\n"; - $this->instance = new foo(); - $this->instance->method3($this); - $this->instance->method3($this); - } + function run1() { + print __CLASS__."::".__FUNCTION__."\n"; + $this->instance = new foo(); + $this->instance->method1($this); + $this->instance->method1($this); + } + + function run2() { + print __CLASS__."::".__FUNCTION__."\n"; + $this->instance = new foo(); + $this->instance->method2($this); + $this->instance->method2($this); + } + + function run3() { + print __CLASS__."::".__FUNCTION__."\n"; + $this->instance = new foo(); + $this->instance->method3($this); + $this->instance->method3($this); + } } function ouch(&$bar) { - print __FUNCTION__."\n"; - @$a = $a; - $bar->run1(); + print __FUNCTION__."\n"; + @$a = $a; + $bar->run1(); } function ok1(&$bar) { - print __FUNCTION__."\n"; - $bar->run1(); + print __FUNCTION__."\n"; + $bar->run1(); } function ok2(&$bar) { - print __FUNCTION__."\n"; - @$a = $a; - $bar->run2(); + print __FUNCTION__."\n"; + @$a = $a; + $bar->run2(); } function ok3(&$bar) { - print __FUNCTION__."\n"; - @$a = $a; - $bar->run3(); + print __FUNCTION__."\n"; + @$a = $a; + $bar->run3(); } $foo = new bar(); diff --git a/tests/lang/bug22592.phpt b/tests/lang/bug22592.phpt index 6999c0bccf..24b5f50fdf 100644 --- a/tests/lang/bug22592.phpt +++ b/tests/lang/bug22592.phpt @@ -3,7 +3,7 @@ Bug #22592 (cascading assignments to strings with curly braces broken) --FILE-- <?php function error_hdlr($errno, $errstr) { - echo "[$errstr]\n"; + echo "[$errstr]\n"; } set_error_handler('error_hdlr'); diff --git a/tests/lang/bug24054.phpt b/tests/lang/bug24054.phpt index 4ee5d631e6..267057f165 100644 --- a/tests/lang/bug24054.phpt +++ b/tests/lang/bug24054.phpt @@ -6,12 +6,12 @@ Bug #24054 (Assignment operator *= broken) define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF); define('LONG_MIN', -LONG_MAX - 1); printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ), - is_int(LONG_MIN-1),is_int(LONG_MAX+1)); + is_int(LONG_MIN-1),is_int(LONG_MAX+1)); - $i = LONG_MAX; + $i = LONG_MAX; - $j = $i * 1001; - $i *= 1001; + $j = $i * 1001; + $i *= 1001; $tests = <<<TESTS $i === $j diff --git a/tests/lang/bug24436.phpt b/tests/lang/bug24436.phpt index b0cfbe0931..cb14d29919 100644 --- a/tests/lang/bug24436.phpt +++ b/tests/lang/bug24436.phpt @@ -3,10 +3,10 @@ Bug #24436 (isset() and empty() produce errors with non-existent variables in ob --FILE-- <?php class test { - function __construct() { - if (empty($this->test[0][0])) { print "test1";} - if (!isset($this->test[0][0])) { print "test2";} - } + function __construct() { + if (empty($this->test[0][0])) { print "test1";} + if (!isset($this->test[0][0])) { print "test2";} + } } $test1 = new test(); diff --git a/tests/lang/bug24499.phpt b/tests/lang/bug24499.phpt index 263293391f..b7a35115ae 100644 --- a/tests/lang/bug24499.phpt +++ b/tests/lang/bug24499.phpt @@ -7,7 +7,7 @@ class Id { public function tester($obj) { - $obj->id = "bar"; + $obj->id = "bar"; } } diff --git a/tests/lang/bug24640.phpt b/tests/lang/bug24640.phpt index 6f5c8f5272..7095fed1fe 100644 --- a/tests/lang/bug24640.phpt +++ b/tests/lang/bug24640.phpt @@ -7,11 +7,11 @@ serialize_precision=17 <?php function test($v) { - echo var_export($v, true) . "\n"; - var_dump($v); - echo "$v\n"; - print_r($v); - echo "\n------\n"; + echo var_export($v, true) . "\n"; + var_dump($v); + echo "$v\n"; + print_r($v); + echo "\n------\n"; } test(1.7e+300); diff --git a/tests/lang/bug24658.phpt b/tests/lang/bug24658.phpt index a53457d5d9..4baa195242 100644 --- a/tests/lang/bug24658.phpt +++ b/tests/lang/bug24658.phpt @@ -4,16 +4,16 @@ Bug #24658 (combo of typehint / reference causes crash) <?php class foo {} function no_typehint($a) { - var_dump($a); + var_dump($a); } function typehint(foo $a) { - var_dump($a); + var_dump($a); } function no_typehint_ref(&$a) { - var_dump($a); + var_dump($a); } function typehint_ref(foo &$a) { - var_dump($a); + var_dump($a); } $v = new foo(); $a = array(new foo(), 1, 2); diff --git a/tests/lang/bug24783.phpt b/tests/lang/bug24783.phpt index 8c8cd6ee01..74885f149e 100644 --- a/tests/lang/bug24783.phpt +++ b/tests/lang/bug24783.phpt @@ -3,11 +3,11 @@ Bug #24783 ($key not binary safe in "foreach($arr as $key => $val)") --FILE-- <?php error_reporting(E_ALL); - $arr = array ("foo\0bar" => "foo\0bar"); - foreach ($arr as $key => $val) { - echo strlen($key), ': '; - echo urlencode($key), ' => ', urlencode($val), "\n"; - } + $arr = array ("foo\0bar" => "foo\0bar"); + foreach ($arr as $key => $val) { + echo strlen($key), ': '; + echo urlencode($key), ' => ', urlencode($val), "\n"; + } ?> --EXPECT-- 7: foo%00bar => foo%00bar diff --git a/tests/lang/bug24908.phpt b/tests/lang/bug24908.phpt index 910b715a05..4c40a9fd81 100644 --- a/tests/lang/bug24908.phpt +++ b/tests/lang/bug24908.phpt @@ -5,12 +5,12 @@ variables_order=GPS --FILE-- <?php class test { - function __construct() { - if (count($_SERVER)) echo "O"; - } - function __destruct() { - if (count($_SERVER)) echo "K\n"; - } + function __construct() { + if (count($_SERVER)) echo "O"; + } + function __destruct() { + if (count($_SERVER)) echo "K\n"; + } } $test = new test(); ?> diff --git a/tests/lang/bug24951.phpt b/tests/lang/bug24951.phpt index 5538e13815..7d5df2030f 100644 --- a/tests/lang/bug24951.phpt +++ b/tests/lang/bug24951.phpt @@ -4,26 +4,26 @@ Bug #24951 (ob_flush() destroys output handler) <?php function test($s, $mode) { - return (($mode & PHP_OUTPUT_HANDLER_START)?"[":"") . $s . (($mode & PHP_OUTPUT_HANDLER_END)?"]\n":""); + return (($mode & PHP_OUTPUT_HANDLER_START)?"[":"") . $s . (($mode & PHP_OUTPUT_HANDLER_END)?"]\n":""); } function t1() { - ob_start("test"); - echo "Hello from t1 1 "; + ob_start("test"); + echo "Hello from t1 1 "; echo "Hello from t1 2 "; ob_end_flush(); } function t2() { - ob_start("test"); - echo "Hello from t2 1 "; + ob_start("test"); + echo "Hello from t2 1 "; ob_flush(); echo "Hello from t2 2 "; ob_end_flush(); } function t3() { - ob_start("test"); + ob_start("test"); echo "Hello from t3 1 "; ob_clean(); echo "Hello from t3 2 "; diff --git a/tests/lang/bug25547.phpt b/tests/lang/bug25547.phpt index eae32e7223..238757592e 100644 --- a/tests/lang/bug25547.phpt +++ b/tests/lang/bug25547.phpt @@ -5,13 +5,13 @@ Bug #25547 (error_handler and array index with function call) function handler($errno, $errstr, $errfile, $errline) { - echo __FUNCTION__ . "($errstr)\n"; + echo __FUNCTION__ . "($errstr)\n"; } set_error_handler('handler'); function foo($x) { - return "foo"; + return "foo"; } $output = array(); diff --git a/tests/lang/bug25652.phpt b/tests/lang/bug25652.phpt index b0125de085..037caf3a80 100644 --- a/tests/lang/bug25652.phpt +++ b/tests/lang/bug25652.phpt @@ -3,19 +3,19 @@ Bug #25652 (Calling Global functions dynamically fails from Class scope) --FILE-- <?php - function testfunc ($var) { - echo "testfunc $var\n"; - } + function testfunc ($var) { + echo "testfunc $var\n"; + } - class foo { - public $arr = array('testfunc'); - function bar () { - $this->arr[0]('testvalue'); - } - } + class foo { + public $arr = array('testfunc'); + function bar () { + $this->arr[0]('testvalue'); + } + } - $a = new foo (); - $a->bar (); + $a = new foo (); + $a->bar (); ?> --EXPECT-- diff --git a/tests/lang/bug25922.phpt b/tests/lang/bug25922.phpt index 796ef6df82..96e8f596f1 100644 --- a/tests/lang/bug25922.phpt +++ b/tests/lang/bug25922.phpt @@ -6,15 +6,15 @@ error_reporting=2047 <?php function my_error_handler($error, $errmsg='', $errfile='', $errline=0, $errcontext='') { - echo "$errmsg\n"; - $errcontext = ''; + echo "$errmsg\n"; + $errcontext = ''; } set_error_handler('my_error_handler'); function test() { - echo "Undefined index here: '{$data['HTTP_HEADER']}'\n"; + echo "Undefined index here: '{$data['HTTP_HEADER']}'\n"; } test(); ?> diff --git a/tests/lang/bug26696.phpt b/tests/lang/bug26696.phpt index a73694c95a..1d10297b12 100644 --- a/tests/lang/bug26696.phpt +++ b/tests/lang/bug26696.phpt @@ -6,20 +6,20 @@ Bug #26696 (string index in a switch() crashes with multiple matches) $str = 'asdd/?'; $len = strlen($str); for ($i = 0; $i < $len; $i++) { - switch ($str[$i]) { - case '?': - echo "OK\n"; - break; - } + switch ($str[$i]) { + case '?': + echo "OK\n"; + break; + } } $str = '*'; switch ($str[0]) { - case '*'; - echo "OK\n"; - break; - default: - echo 'Default RAN!'; + case '*'; + echo "OK\n"; + break; + default: + echo 'Default RAN!'; } ?> diff --git a/tests/lang/bug26866.phpt b/tests/lang/bug26866.phpt index abb99c34fd..7761b65d8a 100644 --- a/tests/lang/bug26866.phpt +++ b/tests/lang/bug26866.phpt @@ -3,22 +3,22 @@ Bug #26866 (segfault when exception raised in __get) --FILE-- <?php class bar { - function get_name() { - return 'bar'; - } + function get_name() { + return 'bar'; + } } class foo { - function __get($sName) { - throw new Exception('Exception!'); - return new bar(); - } + function __get($sName) { + throw new Exception('Exception!'); + return new bar(); + } } $foo = new foo(); try { - echo $foo->bar->get_name(); + echo $foo->bar->get_name(); } catch (Exception $E) { - echo "Exception raised!\n"; + echo "Exception raised!\n"; } ?> --EXPECT-- diff --git a/tests/lang/bug26869.phpt b/tests/lang/bug26869.phpt index 77dd2592ed..065cf1dd67 100644 --- a/tests/lang/bug26869.phpt +++ b/tests/lang/bug26869.phpt @@ -2,10 +2,10 @@ Bug #26869 (constant as the key of static array) --FILE-- <?php - define("A", "1"); - static $a=array(A => 1); - var_dump($a); - var_dump(isset($a[A])); + define("A", "1"); + static $a=array(A => 1); + var_dump($a); + var_dump(isset($a[A])); ?> --EXPECT-- array(1) { diff --git a/tests/lang/bug27354.phpt b/tests/lang/bug27354.phpt index e10ad9c924..c6ce9804fd 100644 --- a/tests/lang/bug27354.phpt +++ b/tests/lang/bug27354.phpt @@ -2,10 +2,10 @@ Bug #27354 (Modulus operator crashes PHP) --FILE-- <?php - var_dump(-2147483647 % -1); - var_dump(-2147483649 % -1); - var_dump(-2147483648 % -1); - var_dump(-2147483648 % -2); + var_dump(-2147483647 % -1); + var_dump(-2147483649 % -1); + var_dump(-2147483648 % -1); + var_dump(-2147483648 % -2); ?> --EXPECTF-- int(%i) diff --git a/tests/lang/bug27439.phpt b/tests/lang/bug27439.phpt index de4bcd05a7..ceb714d81b 100644 --- a/tests/lang/bug27439.phpt +++ b/tests/lang/bug27439.phpt @@ -4,54 +4,54 @@ Bug #27439 (foreach() with $this segfaults) <?php class test_props { - public $a = 1; - public $b = 2; - public $c = 3; + public $a = 1; + public $b = 2; + public $c = 3; } class test { - public $array = array(1,2,3); - public $string = "string"; + public $array = array(1,2,3); + public $string = "string"; - public function __construct() { - $this->object = new test_props; - } + public function __construct() { + $this->object = new test_props; + } - public function getArray() { - return $this->array; - } + public function getArray() { + return $this->array; + } - public function getString() { - return $this->string; - } + public function getString() { + return $this->string; + } - public function case1() { - foreach ($this->array as $foo) { - echo $foo; - } - } + public function case1() { + foreach ($this->array as $foo) { + echo $foo; + } + } - public function case2() { - foreach ($this->foobar as $foo); - } + public function case2() { + foreach ($this->foobar as $foo); + } - public function case3() { - foreach ($this->string as $foo); - } + public function case3() { + foreach ($this->string as $foo); + } - public function case4() { - foreach ($this->getArray() as $foo); - } + public function case4() { + foreach ($this->getArray() as $foo); + } - public function case5() { - foreach ($this->getString() as $foo); - } + public function case5() { + foreach ($this->getString() as $foo); + } - public function case6() { - foreach ($this->object as $foo) { - echo $foo; - } - } + public function case6() { + foreach ($this->object as $foo) { + echo $foo; + } + } } $test = new test(); $test->case1(); diff --git a/tests/lang/bug27535.phpt b/tests/lang/bug27535.phpt index 604b2d3d04..a8294e0f09 100644 --- a/tests/lang/bug27535.phpt +++ b/tests/lang/bug27535.phpt @@ -5,19 +5,19 @@ Bug #27535 (Objects pointing to each other cause Apache to crash) class Class1 { - public $_Class2_obj; + public $_Class2_obj; } class Class2 { - public $storage = ''; + public $storage = ''; - function __construct() - { - $this->storage = new Class1(); + function __construct() + { + $this->storage = new Class1(); - $this->storage->_Class2_obj = $this; - } + $this->storage->_Class2_obj = $this; + } } $foo = new Class2(); diff --git a/tests/lang/bug28800.phpt b/tests/lang/bug28800.phpt index 1b84cd6d0d..2845ca7c88 100644 --- a/tests/lang/bug28800.phpt +++ b/tests/lang/bug28800.phpt @@ -2,10 +2,10 @@ Bug #28800 (Incorrect string to number conversion for strings starting with 'inf') --FILE-- <?php - $strings = array('into', 'info', 'inf', 'infinity', 'infin', 'inflammable'); - foreach ($strings as $v) { - echo ($v+0)."\n"; - } + $strings = array('into', 'info', 'inf', 'infinity', 'infin', 'inflammable'); + foreach ($strings as $v) { + echo ($v+0)."\n"; + } ?> --EXPECTF-- Warning: A non-numeric value encountered in %s on line %d diff --git a/tests/lang/bug29944.phpt b/tests/lang/bug29944.phpt index 19321ca574..d0f2dd2943 100644 --- a/tests/lang/bug29944.phpt +++ b/tests/lang/bug29944.phpt @@ -5,12 +5,12 @@ Bug #29944 (function defined in switch crashes PHP) $a = 1; $b = "1"; switch ($a) { - case 1: - function foo($bar) { - if (preg_match('/\d/', $bar)) return true; - return false; - } - echo foo($b); + case 1: + function foo($bar) { + if (preg_match('/\d/', $bar)) return true; + return false; + } + echo foo($b); } ?> diff --git a/tests/lang/bug30862.phpt b/tests/lang/bug30862.phpt index 7f2d3ed4ae..531dc0b482 100644 --- a/tests/lang/bug30862.phpt +++ b/tests/lang/bug30862.phpt @@ -3,7 +3,7 @@ Bug #30862 (Static array with boolean indexes) --FILE-- <?php class T { - static $a = array(false=>"false", true=>"true"); + static $a = array(false=>"false", true=>"true"); } print_r(T::$a); ?> @@ -12,7 +12,7 @@ print_r(T::$a); define("X",0); define("Y",1); class T2 { - static $a = array(X=>"false", Y=>"true"); + static $a = array(X=>"false", Y=>"true"); } print_r(T2::$a); ?> diff --git a/tests/lang/bug32828.phpt b/tests/lang/bug32828.phpt index b5772afc52..fc168971e6 100644 --- a/tests/lang/bug32828.phpt +++ b/tests/lang/bug32828.phpt @@ -5,7 +5,7 @@ Bug #32828 (Throwing exception in output_callback function with ob_start and ob_ function output_handler($buffer) { - throw new Exception; + throw new Exception; } ob_start('output_handler'); diff --git a/tests/lang/bug43958.phpt b/tests/lang/bug43958.phpt index 498b132447..10a083a3f2 100644 --- a/tests/lang/bug43958.phpt +++ b/tests/lang/bug43958.phpt @@ -4,9 +4,9 @@ Bug #43958 (class name added into the error message) <?php class MyClass { - static public function loadCode($p) { - return include $p; - } + static public function loadCode($p) { + return include $p; + } } MyClass::loadCode('file-which-does-not-exist-on-purpose.php'); diff --git a/tests/lang/bug73329.phpt b/tests/lang/bug73329.phpt index 57117bf550..a4f7a53fa7 100644 --- a/tests/lang/bug73329.phpt +++ b/tests/lang/bug73329.phpt @@ -2,12 +2,12 @@ Bug #73329 (Float)"Nano" == NAN --FILE-- <?php - var_dump( - (float)"nanite", - (float)"nan", - (float)"inf", - (float)"infusorian" - ); + var_dump( + (float)"nanite", + (float)"nan", + (float)"inf", + (float)"infusorian" + ); ?> --EXPECT-- float(0) diff --git a/tests/lang/bug7515.phpt b/tests/lang/bug7515.phpt index 8927c5df94..6c8632c0fa 100644 --- a/tests/lang/bug7515.phpt +++ b/tests/lang/bug7515.phpt @@ -3,7 +3,7 @@ Bug #7515 (weird & invisible referencing of objects) --FILE-- <?php class obj { - function method() {} + function method() {} } $o = new stdClass; diff --git a/tests/lang/catchable_error_001.phpt b/tests/lang/catchable_error_001.phpt index b11a7c8d96..499ac14430 100644 --- a/tests/lang/catchable_error_001.phpt +++ b/tests/lang/catchable_error_001.phpt @@ -2,21 +2,21 @@ Catchable fatal error [1] --FILE-- <?php - class Foo { - } + class Foo { + } - function blah (Foo $a) - { - } + function blah (Foo $a) + { + } - function error() - { - $a = func_get_args(); - var_dump($a); - } + function error() + { + $a = func_get_args(); + var_dump($a); + } - blah (new StdClass); - echo "ALIVE!\n"; + blah (new StdClass); + echo "ALIVE!\n"; ?> --EXPECTF-- Fatal error: Uncaught TypeError: Argument 1 passed to blah() must be an instance of Foo, instance of stdClass given, called in %scatchable_error_001.php on line 15 and defined in %scatchable_error_001.php:5 diff --git a/tests/lang/catchable_error_002.phpt b/tests/lang/catchable_error_002.phpt index 10312533c1..7cdc02c899 100644 --- a/tests/lang/catchable_error_002.phpt +++ b/tests/lang/catchable_error_002.phpt @@ -2,27 +2,27 @@ Catchable fatal error [2] --FILE-- <?php - class Foo { - } + class Foo { + } - function blah (Foo $a) - { - } + function blah (Foo $a) + { + } - function error() - { - $a = func_get_args(); - var_dump($a); - } + function error() + { + $a = func_get_args(); + var_dump($a); + } - set_error_handler('error'); + set_error_handler('error'); - try { - blah (new StdClass); - } catch (Error $ex) { - echo $ex->getMessage(), "\n"; - } - echo "ALIVE!\n"; + try { + blah (new StdClass); + } catch (Error $ex) { + echo $ex->getMessage(), "\n"; + } + echo "ALIVE!\n"; ?> --EXPECTF-- Argument 1 passed to blah() must be an instance of Foo, instance of stdClass given, called in %scatchable_error_002.php on line %d diff --git a/tests/lang/compare_objects_basic1.phpt b/tests/lang/compare_objects_basic1.phpt index 9a4c762075..7df64e95c7 100644 --- a/tests/lang/compare_objects_basic1.phpt +++ b/tests/lang/compare_objects_basic1.phpt @@ -10,17 +10,17 @@ class class1{} class class2{} class class3{ - public $aaa; - private $bbb; - protected $ccc; + public $aaa; + private $bbb; + protected $ccc; } class class4 extends class3{ } class class5 extends class3{ - public $ddd; - private $eee; + public $ddd; + private $eee; } // Define a bunch of objects all of which will use standard compare object handler diff --git a/tests/lang/engine_assignExecutionOrder_001.phpt b/tests/lang/engine_assignExecutionOrder_001.phpt index a70e3eee93..e50daa7d17 100644 --- a/tests/lang/engine_assignExecutionOrder_001.phpt +++ b/tests/lang/engine_assignExecutionOrder_001.phpt @@ -4,13 +4,13 @@ Evaluation order during assignments. <?php function f() { - echo "in f()\n"; - return "name"; + echo "in f()\n"; + return "name"; } function g() { - echo "in g()\n"; - return "assigned value"; + echo "in g()\n"; + return "assigned value"; } @@ -41,9 +41,9 @@ var_dump($oc); class C { - public static $name = "original"; - public static $a = array(); - public static $string = "hello"; + public static $name = "original"; + public static $a = array(); + public static $string = "hello"; } echo "\n\nOrder with static property assignment:\n"; C::${f()} = g(); @@ -56,12 +56,12 @@ var_dump(C::$a); echo "\n\nOrder with indexed string assignment:\n"; $string = "hello"; function getOffset() { - echo "in getOffset()\n"; - return 0; + echo "in getOffset()\n"; + return 0; } function newChar() { - echo "in newChar()\n"; - return 'j'; + echo "in newChar()\n"; + return 'j'; } $string[getOffset()] = newChar(); var_dump($string); diff --git a/tests/lang/engine_assignExecutionOrder_008.phpt b/tests/lang/engine_assignExecutionOrder_008.phpt index 76b0cb1a7c..4b2aeb3451 100644 --- a/tests/lang/engine_assignExecutionOrder_008.phpt +++ b/tests/lang/engine_assignExecutionOrder_008.phpt @@ -51,7 +51,7 @@ echo $a[$i->p[0]->p=f()][++$i->p[0]->p]; unset($i); Class C { - static $p; + static $p; } echo "\n" . 'C::$p=f(): '; diff --git a/tests/lang/engine_assignExecutionOrder_009.phpt b/tests/lang/engine_assignExecutionOrder_009.phpt index 5401ecc287..b7086237ed 100644 --- a/tests/lang/engine_assignExecutionOrder_009.phpt +++ b/tests/lang/engine_assignExecutionOrder_009.phpt @@ -3,8 +3,8 @@ Execution ordering with comparison operators. --FILE-- <?php function f($x) { - echo "f($x) "; - return $x; + echo "f($x) "; + return $x; } echo "Function call args:\n"; diff --git a/tests/lang/error_2_exception_001.phpt b/tests/lang/error_2_exception_001.phpt index 6ef3a52676..32d85bf1cb 100644 --- a/tests/lang/error_2_exception_001.phpt +++ b/tests/lang/error_2_exception_001.phpt @@ -4,22 +4,22 @@ ZE2 errors caught as exceptions <?php class MyException extends Exception { - function __construct($_errno, $_errmsg) { - $this->errno = $_errno; - $this->errmsg = $_errmsg; - } - - function getErrno() { - return $this->errno; - } - - function getErrmsg() { - return $this->errmsg; - } + function __construct($_errno, $_errmsg) { + $this->errno = $_errno; + $this->errmsg = $_errmsg; + } + + function getErrno() { + return $this->errno; + } + + function getErrmsg() { + return $this->errmsg; + } } function ErrorsToExceptions($errno, $errmsg) { - throw new MyException($errno, $errmsg); + throw new MyException($errno, $errmsg); } set_error_handler("ErrorsToExceptions"); @@ -29,13 +29,13 @@ set_error_handler("ErrorsToExceptions"); try { } catch (MyException $exception) { - echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n"; + echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n"; } try { - trigger_error("I will become an exception", E_USER_ERROR); + trigger_error("I will become an exception", E_USER_ERROR); } catch (MyException $exception) { - echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n"; + echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n"; } ?> diff --git a/tests/lang/foreachLoop.001.phpt b/tests/lang/foreachLoop.001.phpt index a7ec701fd1..a3315ade9d 100644 --- a/tests/lang/foreachLoop.001.phpt +++ b/tests/lang/foreachLoop.001.phpt @@ -6,10 +6,10 @@ Foreach loop tests - basic loop with just value and key => value. $a = array("a","b","c"); foreach ($a as $v) { - var_dump($v); + var_dump($v); } foreach ($a as $k => $v) { - var_dump($k, $v); + var_dump($k, $v); } //check key and value after the loop. var_dump($k, $v); @@ -17,10 +17,10 @@ var_dump($k, $v); echo "\n"; //Dynamic array foreach (array("d","e","f") as $v) { - var_dump($v); + var_dump($v); } foreach (array("d","e","f") as $k => $v) { - var_dump($k, $v); + var_dump($k, $v); } //check key and value after the loop. var_dump($k, $v); diff --git a/tests/lang/foreachLoop.002.phpt b/tests/lang/foreachLoop.002.phpt index e0426e810f..fe2434fbe4 100644 --- a/tests/lang/foreachLoop.002.phpt +++ b/tests/lang/foreachLoop.002.phpt @@ -6,15 +6,15 @@ Foreach loop tests - modifying the array during the loop. 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); + $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"; + $v="changed.$k"; } var_dump($a); @@ -22,7 +22,7 @@ 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"; + $v="changed.$k"; } var_dump($a); @@ -30,12 +30,12 @@ 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"); + array_push($a, "new.$counter"); - //avoid infinite loop if test is failing + //avoid infinite loop if test is failing if ($counter++>10) { - echo "Loop detected\n"; - break; + echo "Loop detected\n"; + break; } } var_dump($a); @@ -44,12 +44,12 @@ 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"); + array_push($a, "new.$counter"); - //avoid infinite loop if test is failing + //avoid infinite loop if test is failing if ($counter++>10) { - echo "Loop detected\n"; - break; + echo "Loop detected\n"; + break; } } var_dump($a); @@ -57,16 +57,16 @@ 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); + 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); + array_pop($a); + var_dump($v); } var_dump($a); diff --git a/tests/lang/foreachLoop.003.phpt b/tests/lang/foreachLoop.003.phpt index 3f20021a7b..352ac335b7 100644 --- a/tests/lang/foreachLoop.003.phpt +++ b/tests/lang/foreachLoop.003.phpt @@ -5,27 +5,27 @@ Foreach loop tests - error case: not an array. echo "\nNot an array.\n"; $a = TRUE; foreach ($a as $v) { - var_dump($v); + var_dump($v); } $a = null; foreach ($a as $v) { - var_dump($v); + var_dump($v); } $a = 1; foreach ($a as $v) { - var_dump($v); + var_dump($v); } $a = 1.5; foreach ($a as $v) { - var_dump($v); + var_dump($v); } $a = "hello"; foreach ($a as $v) { - var_dump($v); + var_dump($v); } echo "done.\n"; diff --git a/tests/lang/foreachLoop.004.phpt b/tests/lang/foreachLoop.004.phpt index 3cc1960ca1..21283c9c8c 100644 --- a/tests/lang/foreachLoop.004.phpt +++ b/tests/lang/foreachLoop.004.phpt @@ -6,7 +6,7 @@ Foreach loop tests - using an array element as the $value $a=array("a", "b", "c"); $v=array(); foreach($a as $v[0]) { - var_dump($v); + var_dump($v); } var_dump($a); var_dump($v); @@ -15,7 +15,7 @@ echo "\n"; $a=array("a", "b", "c"); $v=array(); foreach($a as $k=>$v[0]) { - var_dump($k, $v); + var_dump($k, $v); } var_dump($a); var_dump($k, $v); diff --git a/tests/lang/foreachLoop.009.phpt b/tests/lang/foreachLoop.009.phpt index 9bf2957e12..a7ab6f49ed 100644 --- a/tests/lang/foreachLoop.009.phpt +++ b/tests/lang/foreachLoop.009.phpt @@ -9,16 +9,16 @@ 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"; + 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"; + array_pop($refedArray); + echo "key: $k; value: $v2\n"; } echo "\nAdd elements to a referenced array during loop\n"; @@ -26,13 +26,13 @@ $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"; + array_push($refedArray, "new.$k"); + echo "key: $k; value: $v3\n"; - if ($count++>5) { - echo "Loop detected, as expected.\n"; - break; - } + if ($count++>5) { + echo "Loop detected, as expected.\n"; + break; + } } echo "\nAdd elements to a referenced array during loop, using &\$value\n"; @@ -40,13 +40,13 @@ $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"; + array_push($refedArray, "new.$k"); + echo "key: $k; value: $v4\n"; - if ($count++>5) { - echo "Loop detected, as expected.\n"; - break; - } + if ($count++>5) { + echo "Loop detected, as expected.\n"; + break; + } } ?> diff --git a/tests/lang/foreachLoop.010.phpt b/tests/lang/foreachLoop.010.phpt index e114e839b9..17b4db85e4 100644 --- a/tests/lang/foreachLoop.010.phpt +++ b/tests/lang/foreachLoop.010.phpt @@ -24,13 +24,13 @@ $container = null; $i=0; foreach ($a as $v) { - array_push($a, 'new'); - var_dump($v); + array_push($a, 'new'); + var_dump($v); - if (++$i>10) { - echo "Infinite loop detected\n"; - break; - } + if (++$i>10) { + echo "Infinite loop detected\n"; + break; + } } ?> diff --git a/tests/lang/foreachLoop.011.phpt b/tests/lang/foreachLoop.011.phpt index b1048fa9a2..ee7066dc35 100644 --- a/tests/lang/foreachLoop.011.phpt +++ b/tests/lang/foreachLoop.011.phpt @@ -6,8 +6,8 @@ echo "\nChange from array to non iterable:\n"; $a = array(1,2,3); $b=&$a; foreach ($a as $v) { - var_dump($v); - $b=1; + var_dump($v); + $b=1; } echo "\nChange from object to non iterable:\n"; @@ -16,8 +16,8 @@ $a->a=1; $a->b=2; $b=&$a; foreach ($a as $v) { - var_dump($v); - $b='x'; + var_dump($v); + $b='x'; } ?> diff --git a/tests/lang/foreachLoop.012.phpt b/tests/lang/foreachLoop.012.phpt index 4d7beeba4f..04908f6c84 100644 --- a/tests/lang/foreachLoop.012.phpt +++ b/tests/lang/foreachLoop.012.phpt @@ -6,29 +6,29 @@ Directly modifying an unreferenced array when foreach'ing over it. 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 "\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); } diff --git a/tests/lang/foreachLoop.013.phpt b/tests/lang/foreachLoop.013.phpt index acc197f86f..3a87007f50 100644 --- a/tests/lang/foreachLoop.013.phpt +++ b/tests/lang/foreachLoop.013.phpt @@ -6,29 +6,29 @@ Directly modifying an unreferenced array when foreach'ing over it while using &$ 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 "\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); } diff --git a/tests/lang/foreachLoop.014.phpt b/tests/lang/foreachLoop.014.phpt index 9db3470e9c..10bf6fba03 100644 --- a/tests/lang/foreachLoop.014.phpt +++ b/tests/lang/foreachLoop.014.phpt @@ -6,31 +6,31 @@ Directly modifying a REFERENCED array when foreach'ing over it. 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 "\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); } diff --git a/tests/lang/foreachLoop.015.phpt b/tests/lang/foreachLoop.015.phpt index ef5d030cd0..04cd570212 100644 --- a/tests/lang/foreachLoop.015.phpt +++ b/tests/lang/foreachLoop.015.phpt @@ -6,31 +6,31 @@ Directly modifying a REFERENCED array when foreach'ing over it while using &$val 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 "\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); } diff --git a/tests/lang/foreachLoop.016.phpt b/tests/lang/foreachLoop.016.phpt index 0fc57147d9..a4aa5c13be 100644 --- a/tests/lang/foreachLoop.016.phpt +++ b/tests/lang/foreachLoop.016.phpt @@ -6,7 +6,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so echo "\n" . '$a' . "\n"; $b = $a = array('original'); foreach($a as $k=>&$v) { - $v = 'changed'; + $v = 'changed'; } var_dump($b); unset($a, $b); @@ -14,7 +14,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so echo "\n" . '${\'a\'}' . "\n"; $b = $a = array('original'); foreach(${'a'} as $k=>&$v) { - $v = 'changed'; + $v = 'changed'; } var_dump($b); unset($a, $b); @@ -24,7 +24,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so $$a = array('original'); $b = $$a; foreach($$a as $k=>&$v) { - $v = 'changed'; + $v = 'changed'; } var_dump($b); unset($a, $b); @@ -32,7 +32,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so echo "\n" . '$a[0]' . "\n"; $b = $a[0] = array('original'); foreach($a[0] as $k=>&$v) { - $v = 'changed'; + $v = 'changed'; } var_dump($b); unset($a, $b); @@ -40,7 +40,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so echo "\n" . '$a[0][0]' . "\n"; $b = $a[0][0] = array('original'); foreach($a[0][0] as $k=>&$v) { - $v = 'changed'; + $v = 'changed'; } var_dump($b); unset($a, $b); @@ -49,7 +49,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so $a = new stdClass; $b = $a->b = array('original'); foreach($a->b as $k=>&$v) { - $v = 'changed'; + $v = 'changed'; } var_dump($b); unset($a, $b); @@ -59,7 +59,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so $a->b = new stdClass; $b = $a->b->c = array('original'); foreach($a->b as $k=>&$v) { - $v = 'changed'; + $v = 'changed'; } var_dump($b); unset($a, $b); @@ -68,7 +68,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so $a = new stdClass; $b = $a->b[0] = array('original'); foreach($a->b[0] as $k=>&$v) { - $v = 'changed'; + $v = 'changed'; } var_dump($b); unset($a, $b); @@ -77,7 +77,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so $a = new stdClass; $b = $a->b[0][0] = array('original'); foreach($a->b[0][0] as $k=>&$v) { - $v = 'changed'; + $v = 'changed'; } var_dump($b); unset($a, $b); @@ -87,20 +87,20 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so $a->b[0] = new stdClass; $b = $a->b[0]->c = array('original'); foreach($a->b[0]->c as $k=>&$v) { - $v = 'changed'; + $v = 'changed'; } var_dump($b); unset($a, $b); class C { - public static $a; + public static $a; } echo "\n" . 'C::$a' . "\n"; C::$a = array('original'); $b = C::$a; foreach(C::$a as $k=>&$v) { - $v = 'changed'; + $v = 'changed'; } var_dump($b); unset($a, $b); @@ -109,7 +109,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so C::$a[0] = array('original'); $b = C::$a[0]; foreach(C::$a[0] as $k=>&$v) { - $v = 'changed'; + $v = 'changed'; } var_dump($b); unset(C::$a[0], $b); @@ -119,7 +119,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so C::$a[0]->b = array('original'); $b = C::$a[0]->b; foreach(C::$a[0]->b as $k=>&$v) { - $v = 'changed'; + $v = 'changed'; } var_dump($b); unset(C::$a[0]->b, $b); diff --git a/tests/lang/foreachLoopIterator.001.phpt b/tests/lang/foreachLoopIterator.001.phpt index a4fed4cfa2..88254558ca 100644 --- a/tests/lang/foreachLoopIterator.001.phpt +++ b/tests/lang/foreachLoopIterator.001.phpt @@ -4,38 +4,38 @@ foreach with Iterator. <?php class MealIterator implements Iterator { - private $pos=0; - private $myContent=array("breakfast", "lunch", "dinner"); - - public function valid() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return $this->pos<3; - } - - public function next() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return $this->myContent[$this->pos++]; - } - - public function rewind() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - $this->pos=0; - } - - public function current() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return $this->myContent[$this->pos]; - } - - public function key() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return "meal " . $this->pos; - } + private $pos=0; + private $myContent=array("breakfast", "lunch", "dinner"); + + public function valid() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->pos<3; + } + + public function next() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->myContent[$this->pos++]; + } + + public function rewind() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + $this->pos=0; + } + + public function current() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->myContent[$this->pos]; + } + + public function key() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return "meal " . $this->pos; + } } @@ -44,7 +44,7 @@ var_dump($f); echo "-----( Simple iteration: )-----\n"; foreach ($f as $k=>$v) { - echo "$k => $v\n"; + echo "$k => $v\n"; } $f->rewind(); @@ -54,13 +54,13 @@ $indent = " "; echo "\n\n\n-----( Nested iteration: )-----\n"; $count=1; foreach ($f as $k=>$v) { - echo "\nTop level " . $count++ . ": \n"; - echo "$k => $v\n"; - $indent = " "; - foreach ($f as $k=>$v) { - echo " $k => $v\n"; - } - $indent = " "; + echo "\nTop level " . $count++ . ": \n"; + echo "$k => $v\n"; + $indent = " "; + foreach ($f as $k=>$v) { + echo " $k => $v\n"; + } + $indent = " "; } diff --git a/tests/lang/foreachLoopIterator.002.phpt b/tests/lang/foreachLoopIterator.002.phpt index fe38145c3b..dc0533be05 100644 --- a/tests/lang/foreachLoopIterator.002.phpt +++ b/tests/lang/foreachLoopIterator.002.phpt @@ -4,17 +4,17 @@ foreach with iterator and &$value reference <?php class MyIterator implements Iterator { - public function valid() { return true; } - public function next() { } - public function rewind() { } - public function current() { } - public function key() { } + public function valid() { return true; } + public function next() { } + public function rewind() { } + public function current() { } + public function key() { } } $f = new MyIterator; echo "-----( Try to iterate with &\$value: )-----\n"; foreach ($f as $k=>&$v) { - echo "$k => $v\n"; + echo "$k => $v\n"; } ?> diff --git a/tests/lang/foreachLoopIteratorAggregate.001.phpt b/tests/lang/foreachLoopIteratorAggregate.001.phpt index e0d55e6955..2920d0aaca 100644 --- a/tests/lang/foreachLoopIteratorAggregate.001.phpt +++ b/tests/lang/foreachLoopIteratorAggregate.001.phpt @@ -3,100 +3,100 @@ foreach with iteratorAggregate --FILE-- <?php class EnglishMealIterator implements Iterator { - private $pos=0; - private $myContent=array("breakfast", "dinner", "tea"); + private $pos=0; + private $myContent=array("breakfast", "dinner", "tea"); - public function valid() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return $this->pos < count($this->myContent); - } + public function valid() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->pos < count($this->myContent); + } - public function next() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - $this->pos++; - } + public function next() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + $this->pos++; + } - public function rewind() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - $this->pos=0; - } + public function rewind() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + $this->pos=0; + } - public function current() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return $this->myContent[$this->pos]; - } + public function current() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->myContent[$this->pos]; + } - public function key() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return "meal " . $this->pos; - } + public function key() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return "meal " . $this->pos; + } } class FrenchMealIterator implements Iterator { - private $pos=0; - private $myContent=array("petit dejeuner", "dejeuner", "gouter", "dinner"); + private $pos=0; + private $myContent=array("petit dejeuner", "dejeuner", "gouter", "dinner"); - public function valid() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return $this->pos < count($this->myContent); - } + public function valid() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->pos < count($this->myContent); + } - public function next() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - $this->pos++; - } + public function next() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + $this->pos++; + } - public function rewind() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - $this->pos=0; - } + public function rewind() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + $this->pos=0; + } - public function current() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return $this->myContent[$this->pos]; - } + public function current() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->myContent[$this->pos]; + } - public function key() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return "meal " . $this->pos; - } + public function key() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return "meal " . $this->pos; + } } Class EuropeanMeals implements IteratorAggregate { - private $storedEnglishMealIterator; - private $storedFrenchMealIterator; + private $storedEnglishMealIterator; + private $storedFrenchMealIterator; - public function __construct() { - $this->storedEnglishMealIterator = new EnglishMealIterator; - $this->storedFrenchMealIterator = new FrenchMealIterator; - } + public function __construct() { + $this->storedEnglishMealIterator = new EnglishMealIterator; + $this->storedFrenchMealIterator = new FrenchMealIterator; + } - public function getIterator() { - global $indent; - echo "$indent--> " . __METHOD__ . "\n"; + public function getIterator() { + global $indent; + echo "$indent--> " . __METHOD__ . "\n"; - //Alternate between English and French meals - static $i = 0; - if ($i++%2 == 0) { - return $this->storedEnglishMealIterator; - } else { - return $this->storedFrenchMealIterator; - } - } + //Alternate between English and French meals + static $i = 0; + if ($i++%2 == 0) { + return $this->storedEnglishMealIterator; + } else { + return $this->storedFrenchMealIterator; + } + } } @@ -105,11 +105,11 @@ var_dump($f); echo "-----( Simple iteration 1: )-----\n"; foreach ($f as $k=>$v) { - echo "$k => $v\n"; + echo "$k => $v\n"; } echo "-----( Simple iteration 2: )-----\n"; foreach ($f as $k=>$v) { - echo "$k => $v\n"; + echo "$k => $v\n"; } @@ -117,13 +117,13 @@ $indent = " "; echo "\n\n\n-----( Nested iteration: )-----\n"; $count=1; foreach ($f as $k=>$v) { - echo "\nTop level " . $count++ . ": \n"; - echo "$k => $v\n"; - $indent = " "; - foreach ($f as $k=>$v) { - echo " $k => $v\n"; - } - $indent = " "; + echo "\nTop level " . $count++ . ": \n"; + echo "$k => $v\n"; + $indent = " "; + foreach ($f as $k=>$v) { + echo " $k => $v\n"; + } + $indent = " "; } diff --git a/tests/lang/foreachLoopIteratorAggregate.002.phpt b/tests/lang/foreachLoopIteratorAggregate.002.phpt index 7ce50ab35d..382adbe2d5 100644 --- a/tests/lang/foreachLoopIteratorAggregate.002.phpt +++ b/tests/lang/foreachLoopIteratorAggregate.002.phpt @@ -4,38 +4,38 @@ IteratorAggregate::getIterator bad return type <?php class bad1 implements IteratorAggregate { - function getIterator() { - return null; - } + function getIterator() { + return null; + } } class bad2 implements IteratorAggregate { - function getIterator() { - return new stdClass; - } + function getIterator() { + return new stdClass; + } } class bad3 implements IteratorAggregate { - function getIterator() { - return 1; - } + function getIterator() { + return 1; + } } class bad4 implements IteratorAggregate { - function getIterator() { - return array(1,2,3); - } + function getIterator() { + return array(1,2,3); + } } function f($className) { - try { - foreach (new $className as $k=>$v) { - echo "$k => $v\n"; - } - } catch (Exception $e) { - echo $e->getLine() . ": " . $e->getMessage() ."\n"; - } + try { + foreach (new $className as $k=>$v) { + echo "$k => $v\n"; + } + } catch (Exception $e) { + echo $e->getLine() . ": " . $e->getMessage() ."\n"; + } } f("bad1"); diff --git a/tests/lang/foreachLoopIteratorAggregate.003.phpt b/tests/lang/foreachLoopIteratorAggregate.003.phpt index 7e96b104e4..cf9d2f73f4 100644 --- a/tests/lang/foreachLoopIteratorAggregate.003.phpt +++ b/tests/lang/foreachLoopIteratorAggregate.003.phpt @@ -3,72 +3,72 @@ foreach with nested iteratorAggregates --FILE-- <?php class EnglishMealIterator implements Iterator { - private $pos=0; - private $myContent=array("breakfast", "dinner", "tea"); + private $pos=0; + private $myContent=array("breakfast", "dinner", "tea"); - public function valid() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return $this->pos<3; - } + public function valid() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->pos<3; + } - public function next() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return $this->myContent[$this->pos++]; - } + public function next() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->myContent[$this->pos++]; + } - public function rewind() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - $this->pos=0; - } + public function rewind() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + $this->pos=0; + } - public function current() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return $this->myContent[$this->pos]; - } + public function current() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->myContent[$this->pos]; + } - public function key() { - global $indent; - echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; - return "meal " . $this->pos; - } + public function key() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return "meal " . $this->pos; + } } class A1 implements IteratorAggregate { - function getIterator() { - return new EnglishMealIterator; - } + function getIterator() { + return new EnglishMealIterator; + } } class A2 implements IteratorAggregate { - function getIterator() { - return new A1; - } + function getIterator() { + return new A1; + } } class A3 implements IteratorAggregate { - function getIterator() { - return new A2; - } + function getIterator() { + return new A2; + } } echo "\n-----( A1: )-----\n"; foreach (new A1 as $k=>$v) { - echo "$k => $v\n"; + echo "$k => $v\n"; } echo "\n-----( A2: )-----\n"; foreach (new A2 as $k=>$v) { - echo "$k => $v\n"; + echo "$k => $v\n"; } echo "\n-----( A3: )-----\n"; foreach (new A3 as $k=>$v) { - echo "$k => $v\n"; + echo "$k => $v\n"; } ?> diff --git a/tests/lang/foreachLoopIteratorAggregate.004.phpt b/tests/lang/foreachLoopIteratorAggregate.004.phpt index 9c453bde21..0e46fec7f0 100644 --- a/tests/lang/foreachLoopIteratorAggregate.004.phpt +++ b/tests/lang/foreachLoopIteratorAggregate.004.phpt @@ -4,62 +4,62 @@ Duplicate of zend test tests/classes/iterators_002.phpt without expected output <?php class c_iter implements Iterator { - private $obj; - private $num = 0; + private $obj; + private $num = 0; - function __construct($obj) { - echo __METHOD__ . "\n"; - $this->obj = $obj; - } - function rewind() { - echo __METHOD__ . "\n"; - $this->num = 0; - } - function valid() { - $more = $this->num < $this->obj->max; - echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; - return $more; - } - function current() { - echo __METHOD__ . "\n"; - return $this->num; - } - function next() { - echo __METHOD__ . "\n"; - $this->num++; - } - function key() { - echo __METHOD__ . "\n"; - switch($this->num) { - case 0: return "1st"; - case 1: return "2nd"; - case 2: return "3rd"; - default: return "???"; - } - } - function __destruct() { - } + function __construct($obj) { + echo __METHOD__ . "\n"; + $this->obj = $obj; + } + function rewind() { + echo __METHOD__ . "\n"; + $this->num = 0; + } + function valid() { + $more = $this->num < $this->obj->max; + echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; + return $more; + } + function current() { + echo __METHOD__ . "\n"; + return $this->num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function key() { + echo __METHOD__ . "\n"; + switch($this->num) { + case 0: return "1st"; + case 1: return "2nd"; + case 2: return "3rd"; + default: return "???"; + } + } + function __destruct() { + } } class c implements IteratorAggregate { - public $max = 3; + public $max = 3; - function getIterator() { - echo __METHOD__ . "\n"; - return new c_iter($this); - } - function __destruct() { - } + function getIterator() { + echo __METHOD__ . "\n"; + return new c_iter($this); + } + function __destruct() { + } } $t = new c(); foreach($t as $k => $v) { - foreach($t as $w) { - echo "double:$v:$w\n"; - break; - } + foreach($t as $w) { + echo "double:$v:$w\n"; + break; + } } unset($t); diff --git a/tests/lang/foreachLoopObjects.001.phpt b/tests/lang/foreachLoopObjects.001.phpt index 7e8a40438e..5526d498a3 100644 --- a/tests/lang/foreachLoopObjects.001.phpt +++ b/tests/lang/foreachLoopObjects.001.phpt @@ -4,21 +4,21 @@ Foreach loop on objects - basic loop with just value and key => value. <?php class C { - public $a = "Original a"; - public $b = "Original b"; - public $c = "Original c"; - protected $d = "Original d"; - private $e = "Original e"; + public $a = "Original a"; + public $b = "Original b"; + public $c = "Original c"; + protected $d = "Original d"; + private $e = "Original e"; } echo "\n\nSimple loop.\n"; $obj = new C; foreach ($obj as $v) { - var_dump($v); + var_dump($v); } foreach ($obj as $k => $v) { - var_dump($k, $v); + var_dump($k, $v); } echo "\nCheck key and value after the loop.\n"; var_dump($k, $v); @@ -26,10 +26,10 @@ var_dump($k, $v); echo "\n\nObject instantiated inside loop.\n"; foreach (new C as $v) { - var_dump($v); + var_dump($v); } foreach (new C as $k => $v) { - var_dump($k, $v); + var_dump($k, $v); } echo "\nCheck key and value after the loop.\n"; var_dump($k, $v); diff --git a/tests/lang/foreachLoopObjects.002.phpt b/tests/lang/foreachLoopObjects.002.phpt index 618a8cd55f..46bd6f8a37 100644 --- a/tests/lang/foreachLoopObjects.002.phpt +++ b/tests/lang/foreachLoopObjects.002.phpt @@ -4,82 +4,82 @@ Foreach loop tests - visibility. <?php class C { - public $a = "Original a"; - public $b = "Original b"; - public $c = "Original c"; - protected $d = "Original d"; - private $e = "Original e"; - - function doForEachC() { - echo "in C::doForEachC\n"; - foreach ($this as $k=>&$v) { - var_dump($v); - $v="changed.$k"; - } - } - - static function doForEach($obj) { - echo "in C::doForEach\n"; - foreach ($obj as $k=>&$v) { - var_dump($v); - $v="changed.$k"; - } - } - - function doForEachOnThis() { - echo "in C::doForEachOnThis\n"; - foreach ($this as $k=>&$v) { - var_dump($v); - $v="changed.$k"; - } - } + public $a = "Original a"; + public $b = "Original b"; + public $c = "Original c"; + protected $d = "Original d"; + private $e = "Original e"; + + function doForEachC() { + echo "in C::doForEachC\n"; + foreach ($this as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } + + static function doForEach($obj) { + echo "in C::doForEach\n"; + foreach ($obj as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } + + function doForEachOnThis() { + echo "in C::doForEachOnThis\n"; + foreach ($this as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } } class D extends C { - private $f = "Original f"; - protected $g = "Original g"; - - static function doForEach($obj) { - echo "in D::doForEach\n"; - foreach ($obj as $k=>&$v) { - var_dump($v); - $v="changed.$k"; - } - } - - function doForEachOnThis() { - echo "in D::doForEachOnThis\n"; - foreach ($this as $k=>&$v) { - var_dump($v); - $v="changed.$k"; - } - } + private $f = "Original f"; + protected $g = "Original g"; + + static function doForEach($obj) { + echo "in D::doForEach\n"; + foreach ($obj as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } + + function doForEachOnThis() { + echo "in D::doForEachOnThis\n"; + foreach ($this as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } } class E extends D { - public $a = "Overridden a"; - public $b = "Overridden b"; - public $c = "Overridden c"; - protected $d = "Overridden d"; - private $e = "Overridden e"; - - static function doForEach($obj) { - echo "in E::doForEach\n"; - foreach ($obj as $k=>&$v) { - var_dump($v); - $v="changed.$k"; - } - } - - function doForEachOnThis() { - echo "in E::doForEachOnThis\n"; - foreach ($this as $k=>&$v) { - var_dump($v); - $v="changed.$k"; - } - } + public $a = "Overridden a"; + public $b = "Overridden b"; + public $c = "Overridden c"; + protected $d = "Overridden d"; + private $e = "Overridden e"; + + static function doForEach($obj) { + echo "in E::doForEach\n"; + foreach ($obj as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } + + function doForEachOnThis() { + echo "in E::doForEachOnThis\n"; + foreach ($this as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } } echo "\n\nIterate over various generations from within overridden methods:\n"; @@ -147,22 +147,22 @@ echo "\n\nIterate over various generations from outside the object:\n"; echo "\n--> Using instance of C:\n"; $myC = new C; foreach ($myC as $k=>&$v) { - var_dump($v); - $v="changed.$k"; + var_dump($v); + $v="changed.$k"; } var_dump($myC); echo "\n--> Using instance of D:\n"; $myD = new D; foreach ($myD as $k=>&$v) { - var_dump($v); - $v="changed.$k"; + var_dump($v); + $v="changed.$k"; } var_dump($myD); echo "\n--> Using instance of E:\n"; $myE = new E; foreach ($myE as $k=>&$v) { - var_dump($v); - $v="changed.$k"; + var_dump($v); + $v="changed.$k"; } var_dump($myE); ?> diff --git a/tests/lang/foreachLoopObjects.003.phpt b/tests/lang/foreachLoopObjects.003.phpt index c3abbf2250..e70d6a386d 100644 --- a/tests/lang/foreachLoopObjects.003.phpt +++ b/tests/lang/foreachLoopObjects.003.phpt @@ -4,25 +4,25 @@ Foreach loop tests - modifying the object during the loop. <?php class C { - public $a = "Original a"; - public $b = "Original b"; - public $c = "Original c"; - protected $d = "Original d"; - private $e = "Original e"; + public $a = "Original a"; + public $b = "Original b"; + public $c = "Original c"; + protected $d = "Original d"; + private $e = "Original e"; } echo "\nDirectly changing object values.\n"; $obj = new C; foreach ($obj as $k=>$v) { - $obj->$k="changed.$k"; - var_dump($v); + $obj->$k="changed.$k"; + var_dump($v); } var_dump($obj); echo "\nModifying the foreach \$value.\n"; $obj = new C; foreach ($obj as $k=>$v) { - $v="changed.$k"; + $v="changed.$k"; } var_dump($obj); @@ -30,7 +30,7 @@ var_dump($obj); echo "\nModifying the foreach &\$value.\n"; $obj = new C; foreach ($obj as $k=>&$v) { - $v="changed.$k"; + $v="changed.$k"; } var_dump($obj); @@ -38,13 +38,13 @@ echo "\nAdding properties to an an object.\n"; $obj = new C; $counter=0; foreach ($obj as $v) { - $newPropName = "new$counter"; - $obj->$newPropName = "Added property $counter"; + $newPropName = "new$counter"; + $obj->$newPropName = "Added property $counter"; if ($counter++>10) { - echo "Loop detected\n"; - break; + echo "Loop detected\n"; + break; } - var_dump($v); + var_dump($v); } var_dump($obj); @@ -52,33 +52,33 @@ echo "\nAdding properties to an an object, using &\$value.\n"; $obj = new C; $counter=0; foreach ($obj as &$v) { - $newPropName = "new$counter"; - $obj->$newPropName = "Added property $counter"; + $newPropName = "new$counter"; + $obj->$newPropName = "Added property $counter"; if ($counter++>10) { - echo "Loop detected\n"; - break; + echo "Loop detected\n"; + break; } - var_dump($v); + var_dump($v); } var_dump($obj); echo "\nRemoving properties from an object.\n"; $obj = new C; foreach ($obj as $v) { - unset($obj->a); - unset($obj->b); - unset($obj->c); - var_dump($v); + unset($obj->a); + unset($obj->b); + unset($obj->c); + var_dump($v); } var_dump($obj); echo "\nRemoving properties from an object, using &\$value.\n"; $obj = new C; foreach ($obj as &$v) { - unset($obj->a); - unset($obj->b); - unset($obj->c); - var_dump($v); + unset($obj->a); + unset($obj->b); + unset($obj->c); + var_dump($v); } var_dump($obj); diff --git a/tests/lang/foreachLoopObjects.004.phpt b/tests/lang/foreachLoopObjects.004.phpt index 9eea3e2084..613037f2ca 100644 --- a/tests/lang/foreachLoopObjects.004.phpt +++ b/tests/lang/foreachLoopObjects.004.phpt @@ -4,25 +4,25 @@ Foreach loop tests - Removing the current element from an iterated object. <?php class C { - public $a = "Original a"; - public $b = "Original b"; - public $c = "Original c"; - public $d = "Original d"; - public $e = "Original e"; + public $a = "Original a"; + public $b = "Original b"; + public $c = "Original c"; + public $d = "Original d"; + public $e = "Original e"; } echo "\nRemoving the current element from an iterated object.\n"; $obj = new C; $count=0; foreach ($obj as $v) { - if ($v==$obj->b) { - unset($obj->b); - } - var_dump($v); - if (++$count>10) { - echo "Loop detected.\n"; - break; - } + if ($v==$obj->b) { + unset($obj->b); + } + var_dump($v); + if (++$count>10) { + echo "Loop detected.\n"; + break; + } } var_dump($obj); diff --git a/tests/lang/foreachLoopObjects.005.phpt b/tests/lang/foreachLoopObjects.005.phpt index 8d6a4d5dc3..cc7f64b855 100644 --- a/tests/lang/foreachLoopObjects.005.phpt +++ b/tests/lang/foreachLoopObjects.005.phpt @@ -4,39 +4,39 @@ Foreach loop tests - removing properties before and after the current property d <?php class C { - public $a = "Original a"; - public $b = "Original b"; - public $c = "Original c"; - public $d = "Original d"; - public $e = "Original e"; + public $a = "Original a"; + public $b = "Original b"; + public $c = "Original c"; + public $d = "Original d"; + public $e = "Original e"; } echo "\nRemoving properties before the current element from an iterated object.\n"; $obj = new C; $count=0; foreach ($obj as $v) { - if ($v==$obj->a) { - unset($obj->c); - } - var_dump($v); - if (++$count>10) { - echo "Loop detected.\n"; - break; - } + if ($v==$obj->a) { + unset($obj->c); + } + var_dump($v); + if (++$count>10) { + echo "Loop detected.\n"; + break; + } } var_dump($obj); echo "\nRemoving properties before the current element from an iterated object.\n"; $obj = new C; foreach ($obj as $v) { - if ($v==$obj->b) { - unset($obj->a); - } - var_dump($v); - if (++$count>10) { - echo "Loop detected.\n"; - break; - } + if ($v==$obj->b) { + unset($obj->a); + } + var_dump($v); + if (++$count>10) { + echo "Loop detected.\n"; + break; + } } var_dump($obj); diff --git a/tests/lang/foreachLoopObjects.006.phpt b/tests/lang/foreachLoopObjects.006.phpt index 3e9b73542a..0d8c3f96a9 100644 --- a/tests/lang/foreachLoopObjects.006.phpt +++ b/tests/lang/foreachLoopObjects.006.phpt @@ -4,11 +4,11 @@ Foreach loop tests - substituting the entire iterated entity during the loop. <?php class C { - public $a = "Original a"; - public $b = "Original b"; - public $c = "Original c"; - public $d = "Original d"; - public $e = "Original e"; + public $a = "Original a"; + public $b = "Original b"; + public $c = "Original c"; + public $d = "Original d"; + public $e = "Original e"; } echo "\nSubstituting the iterated object for a different object.\n"; @@ -23,14 +23,14 @@ $obj2->f = "new f"; $ref = &$obj; $count=0; foreach ($obj as $v) { - var_dump($v); - if ($v==$obj->b) { - $ref=$obj2; - } - if (++$count>10) { - echo "Loop detected.\n"; - break; - } + var_dump($v); + if ($v==$obj->b) { + $ref=$obj2; + } + if (++$count>10) { + echo "Loop detected.\n"; + break; + } } var_dump($obj); @@ -40,14 +40,14 @@ $a = array(1,2,3,4,5,6,7,8); $ref = &$obj; $count=0; foreach ($obj as $v) { - var_dump($v); - if ($v==="Original b") { - $ref=$a; - } - if (++$count>10) { - echo "Loop detected.\n"; - break; - } + var_dump($v); + if ($v==="Original b") { + $ref=$a; + } + if (++$count>10) { + echo "Loop detected.\n"; + break; + } } var_dump($obj); @@ -57,14 +57,14 @@ $obj = new C; $ref = &$a; $count=0; foreach ($a as $v) { - var_dump($v); - if ($v===2) { - $ref=$obj; - } - if (++$count>10) { - echo "Loop detected.\n"; - break; - } + var_dump($v); + if ($v===2) { + $ref=$obj; + } + if (++$count>10) { + echo "Loop detected.\n"; + break; + } } var_dump($obj); diff --git a/tests/lang/foreach_with_references_001.phpt b/tests/lang/foreach_with_references_001.phpt index a1f7c33600..0a7df06502 100644 --- a/tests/lang/foreach_with_references_001.phpt +++ b/tests/lang/foreach_with_references_001.phpt @@ -6,13 +6,13 @@ foreach() with references $arr = array(1 => "one", 2 => "two", 3 => "three"); foreach($arr as $key => $val) { - $val = $key; + $val = $key; } print_r($arr); foreach($arr as $key => &$val) { - $val = $key; + $val = $key; } print_r($arr); diff --git a/tests/lang/func_get_arg.002.phpt b/tests/lang/func_get_arg.002.phpt index 5b80ec1773..3375f3e3c9 100644 --- a/tests/lang/func_get_arg.002.phpt +++ b/tests/lang/func_get_arg.002.phpt @@ -5,10 +5,10 @@ func_get_arg with variable number of args function foo($a) { - $b = func_get_arg(1); - var_dump($b); - $b++; - var_dump(func_get_arg(1)); + $b = func_get_arg(1); + var_dump($b); + $b++; + var_dump(func_get_arg(1)); } foo(2, 3); diff --git a/tests/lang/func_get_arg.004.phpt b/tests/lang/func_get_arg.004.phpt index 0a4547ec18..6d0ab20a4e 100644 --- a/tests/lang/func_get_arg.004.phpt +++ b/tests/lang/func_get_arg.004.phpt @@ -5,7 +5,7 @@ func_get_arg on non-existent arg function foo($a) { - var_dump(func_get_arg(2)); + var_dump(func_get_arg(2)); } foo(2, 3); echo "\n"; diff --git a/tests/lang/func_get_arg.005.phpt b/tests/lang/func_get_arg.005.phpt index 5dd5468721..4c4b1792f4 100644 --- a/tests/lang/func_get_arg.005.phpt +++ b/tests/lang/func_get_arg.005.phpt @@ -4,10 +4,10 @@ During the call, the original variable is updated. This should not affect func_g --FILE-- <?php function refVal($x) { - global $a; - $a = 'changed.a'; - var_dump($x); - var_dump(func_get_arg(0)); + global $a; + $a = 'changed.a'; + var_dump($x); + var_dump(func_get_arg(0)); } $a = "original.a"; diff --git a/tests/lang/func_get_args.001.phpt b/tests/lang/func_get_args.001.phpt index a17cfb3d19..9e64921af5 100644 --- a/tests/lang/func_get_args.001.phpt +++ b/tests/lang/func_get_args.001.phpt @@ -5,7 +5,7 @@ func_get_args with no args function foo() { - var_dump(func_get_args()); + var_dump(func_get_args()); } foo(); diff --git a/tests/lang/func_get_args.002.phpt b/tests/lang/func_get_args.002.phpt index f516893418..60bbb9a40f 100644 --- a/tests/lang/func_get_args.002.phpt +++ b/tests/lang/func_get_args.002.phpt @@ -5,7 +5,7 @@ func_get_args with variable number of args function foo($a) { - var_dump(func_get_args()); + var_dump(func_get_args()); } foo(1, 2, 3); diff --git a/tests/lang/func_get_args.004.phpt b/tests/lang/func_get_args.004.phpt index 6e98c763b2..9e72e519f9 100644 --- a/tests/lang/func_get_args.004.phpt +++ b/tests/lang/func_get_args.004.phpt @@ -3,19 +3,19 @@ Pass same variable by ref and by value (PHP7). --FILE-- <?php function valRef($x, &$y) { - var_dump($x, $y); - var_dump(func_get_args()); - $x = 'changed.x'; - $y = 'changed.y'; - var_dump(func_get_args()); + var_dump($x, $y); + var_dump(func_get_args()); + $x = 'changed.x'; + $y = 'changed.y'; + var_dump(func_get_args()); } function refVal(&$x, $y) { - var_dump($x, $y); - var_dump(func_get_args()); - $x = 'changed.x'; - $y = 'changed.y'; - var_dump(func_get_args()); + var_dump($x, $y); + var_dump(func_get_args()); + $x = 'changed.x'; + $y = 'changed.y'; + var_dump(func_get_args()); } diff --git a/tests/lang/func_num_args.001.phpt b/tests/lang/func_num_args.001.phpt index 5d7a91d25e..dd7f13681f 100644 --- a/tests/lang/func_num_args.001.phpt +++ b/tests/lang/func_num_args.001.phpt @@ -5,7 +5,7 @@ func_num_args with no args function foo() { - var_dump(func_num_args()); + var_dump(func_num_args()); } foo(); diff --git a/tests/lang/func_num_args.002.phpt b/tests/lang/func_num_args.002.phpt index 8586fad735..9b00efa535 100644 --- a/tests/lang/func_num_args.002.phpt +++ b/tests/lang/func_num_args.002.phpt @@ -5,7 +5,7 @@ func_num_args with variable number of args function foo($a) { - var_dump(func_num_args()); + var_dump(func_num_args()); } foo(1, 2, 3); diff --git a/tests/lang/func_num_args.004.phpt b/tests/lang/func_num_args.004.phpt index 7924a85a68..dd8b7047fb 100644 --- a/tests/lang/func_num_args.004.phpt +++ b/tests/lang/func_num_args.004.phpt @@ -3,19 +3,19 @@ Pass same variable by ref and by value. --FILE-- <?php function valRef($x, &$y) { - var_dump($x, $y); - var_dump(func_num_args()); - $x = 'changed.x'; - $y = 'changed.y'; - var_dump(func_num_args()); + var_dump($x, $y); + var_dump(func_num_args()); + $x = 'changed.x'; + $y = 'changed.y'; + var_dump(func_num_args()); } function refVal(&$x, $y) { - var_dump($x, $y); - var_dump(func_num_args()); - $x = 'changed.x'; - $y = 'changed.y'; - var_dump(func_num_args()); + var_dump($x, $y); + var_dump(func_num_args()); + $x = 'changed.x'; + $y = 'changed.y'; + var_dump(func_num_args()); } diff --git a/tests/lang/operators/add_basiclong_64bit.phpt b/tests/lang/operators/add_basiclong_64bit.phpt index a4cdcc70dc..6e09f49eb9 100644 --- a/tests/lang/operators/add_basiclong_64bit.phpt +++ b/tests/lang/operators/add_basiclong_64bit.phpt @@ -24,14 +24,14 @@ error_reporting(E_ERROR); foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal + $otherVal ---\n"; + echo "--- testing: $longVal + $otherVal ---\n"; var_dump($longVal+$otherVal); } } foreach ($otherVals as $otherVal) { foreach($longVals as $longVal) { - echo "--- testing: $otherVal + $longVal ---\n"; + echo "--- testing: $otherVal + $longVal ---\n"; var_dump($otherVal+$longVal); } } diff --git a/tests/lang/operators/add_variationStr.phpt b/tests/lang/operators/add_variationStr.phpt index b626c21841..cea37a0a26 100644 --- a/tests/lang/operators/add_variationStr.phpt +++ b/tests/lang/operators/add_variationStr.phpt @@ -12,7 +12,7 @@ error_reporting(E_ERROR); foreach ($strVals as $strVal) { foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' + '$otherVal' ---\n"; + echo "--- testing: '$strVal' + '$otherVal' ---\n"; var_dump($strVal+$otherVal); } } diff --git a/tests/lang/operators/bitwiseAnd_basiclong_64bit.phpt b/tests/lang/operators/bitwiseAnd_basiclong_64bit.phpt index ba7ea966ea..22982c7bc3 100644 --- a/tests/lang/operators/bitwiseAnd_basiclong_64bit.phpt +++ b/tests/lang/operators/bitwiseAnd_basiclong_64bit.phpt @@ -24,14 +24,14 @@ error_reporting(E_ERROR); foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal & $otherVal ---\n"; + echo "--- testing: $longVal & $otherVal ---\n"; var_dump($longVal&$otherVal); } } foreach ($otherVals as $otherVal) { foreach($longVals as $longVal) { - echo "--- testing: $otherVal & $longVal ---\n"; + echo "--- testing: $otherVal & $longVal ---\n"; var_dump($otherVal&$longVal); } } diff --git a/tests/lang/operators/bitwiseAnd_variationStr.phpt b/tests/lang/operators/bitwiseAnd_variationStr.phpt index 23db7999fe..ed3d55f714 100644 --- a/tests/lang/operators/bitwiseAnd_variationStr.phpt +++ b/tests/lang/operators/bitwiseAnd_variationStr.phpt @@ -12,7 +12,7 @@ error_reporting(E_ERROR); foreach ($strVals as $strVal) { foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' & '$otherVal' ---\n"; + echo "--- testing: '$strVal' & '$otherVal' ---\n"; var_dump(bin2hex($strVal&$otherVal)); } } diff --git a/tests/lang/operators/bitwiseOr_basiclong_64bit.phpt b/tests/lang/operators/bitwiseOr_basiclong_64bit.phpt index 5ae2075e69..50b39181b1 100644 --- a/tests/lang/operators/bitwiseOr_basiclong_64bit.phpt +++ b/tests/lang/operators/bitwiseOr_basiclong_64bit.phpt @@ -24,14 +24,14 @@ error_reporting(E_ERROR); foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal | $otherVal ---\n"; + echo "--- testing: $longVal | $otherVal ---\n"; var_dump($longVal|$otherVal); } } foreach ($otherVals as $otherVal) { foreach($longVals as $longVal) { - echo "--- testing: $otherVal | $longVal ---\n"; + echo "--- testing: $otherVal | $longVal ---\n"; var_dump($otherVal|$longVal); } } diff --git a/tests/lang/operators/bitwiseOr_variationStr.phpt b/tests/lang/operators/bitwiseOr_variationStr.phpt index dfec4b8ae6..f11b8d8df6 100644 --- a/tests/lang/operators/bitwiseOr_variationStr.phpt +++ b/tests/lang/operators/bitwiseOr_variationStr.phpt @@ -12,7 +12,7 @@ error_reporting(E_ERROR); foreach ($strVals as $strVal) { foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' | '$otherVal' ---\n"; + echo "--- testing: '$strVal' | '$otherVal' ---\n"; var_dump(bin2hex($strVal|$otherVal)); } } diff --git a/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt index 8978cee6b7..250813fca3 100644 --- a/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt +++ b/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt @@ -24,8 +24,8 @@ error_reporting(E_ERROR); foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal << $otherVal ---\n"; - try { + echo "--- testing: $longVal << $otherVal ---\n"; + try { var_dump($longVal<<$otherVal); } catch (ArithmeticError $e) { echo "Exception: " . $e->getMessage() . "\n"; @@ -35,8 +35,8 @@ foreach ($longVals as $longVal) { foreach ($otherVals as $otherVal) { foreach($longVals as $longVal) { - echo "--- testing: $otherVal << $longVal ---\n"; - try { + echo "--- testing: $otherVal << $longVal ---\n"; + try { var_dump($otherVal<<$longVal); } catch (ArithmeticError $e) { echo "Exception: " . $e->getMessage() . "\n"; diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt index e9efd388f7..49de21f64b 100644 --- a/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt +++ b/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt @@ -12,7 +12,7 @@ error_reporting(E_ERROR); foreach ($strVals as $strVal) { foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' << '$otherVal' ---\n"; + echo "--- testing: '$strVal' << '$otherVal' ---\n"; try { var_dump($strVal<<$otherVal); } catch (Throwable $e) { diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt index 8a747d12bc..b3ca624abb 100644 --- a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt +++ b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt @@ -16,7 +16,7 @@ error_reporting(E_ERROR); foreach ($strVals as $strVal) { foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' << '$otherVal' ---\n"; + echo "--- testing: '$strVal' << '$otherVal' ---\n"; try { var_dump($strVal<<$otherVal); } catch (ArithmeticError $e) { diff --git a/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt b/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt index 88f9ca59f8..75be6afae2 100644 --- a/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt +++ b/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt @@ -24,7 +24,7 @@ error_reporting(E_ERROR); foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal >> $otherVal ---\n"; + echo "--- testing: $longVal >> $otherVal ---\n"; try { var_dump($longVal>>$otherVal); } catch (ArithmeticError $e) { @@ -35,8 +35,8 @@ foreach ($longVals as $longVal) { foreach ($otherVals as $otherVal) { foreach($longVals as $longVal) { - echo "--- testing: $otherVal >> $longVal ---\n"; - try { + echo "--- testing: $otherVal >> $longVal ---\n"; + try { var_dump($otherVal>>$longVal); } catch (ArithmeticError $e) { echo "Exception: " . $e->getMessage() . "\n"; diff --git a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt index 646b9b4a12..525f951a51 100644 --- a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt +++ b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt @@ -12,8 +12,8 @@ error_reporting(E_ERROR); foreach ($strVals as $strVal) { foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' >> '$otherVal' ---\n"; - try { + echo "--- testing: '$strVal' >> '$otherVal' ---\n"; + try { var_dump($strVal>>$otherVal); } catch (ArithmeticError $e) { echo "Exception: " . $e->getMessage() . "\n"; diff --git a/tests/lang/operators/bitwiseXor_basiclong_64bit.phpt b/tests/lang/operators/bitwiseXor_basiclong_64bit.phpt index f004feaeb3..0b40e9feed 100644 --- a/tests/lang/operators/bitwiseXor_basiclong_64bit.phpt +++ b/tests/lang/operators/bitwiseXor_basiclong_64bit.phpt @@ -24,14 +24,14 @@ error_reporting(E_ERROR); foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal ^ $otherVal ---\n"; + echo "--- testing: $longVal ^ $otherVal ---\n"; var_dump($longVal^$otherVal); } } foreach ($otherVals as $otherVal) { foreach($longVals as $longVal) { - echo "--- testing: $otherVal ^ $longVal ---\n"; + echo "--- testing: $otherVal ^ $longVal ---\n"; var_dump($otherVal^$longVal); } } diff --git a/tests/lang/operators/bitwiseXor_variationStr.phpt b/tests/lang/operators/bitwiseXor_variationStr.phpt index 654db1c9ef..5a74d124ff 100644 --- a/tests/lang/operators/bitwiseXor_variationStr.phpt +++ b/tests/lang/operators/bitwiseXor_variationStr.phpt @@ -12,7 +12,7 @@ error_reporting(E_ERROR); foreach ($strVals as $strVal) { foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' ^ '$otherVal' ---\n"; + echo "--- testing: '$strVal' ^ '$otherVal' ---\n"; var_dump(bin2hex($strVal^$otherVal)); } } diff --git a/tests/lang/operators/coalesce.phpt b/tests/lang/operators/coalesce.phpt index b48d20bab1..7035eac84c 100644 --- a/tests/lang/operators/coalesce.phpt +++ b/tests/lang/operators/coalesce.phpt @@ -10,18 +10,18 @@ $obj = new StdClass; $obj->boo = 7; $arr = [ - 2 => 7, - "foo" => "bar", - "foobar" => NULL, - "qux" => $obj, - "bing" => [ - "bang" - ] + 2 => 7, + "foo" => "bar", + "foobar" => NULL, + "qux" => $obj, + "bing" => [ + "bang" + ] ]; function foobar() { - echo "called\n"; - return ['a']; + echo "called\n"; + return ['a']; } var_dump($nonexistent_variable ?? 3); diff --git a/tests/lang/operators/divide_basiclong_64bit.phpt b/tests/lang/operators/divide_basiclong_64bit.phpt index f86fc7b951..d8c0e60ded 100644 --- a/tests/lang/operators/divide_basiclong_64bit.phpt +++ b/tests/lang/operators/divide_basiclong_64bit.phpt @@ -24,14 +24,14 @@ error_reporting(E_ERROR); foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal / $otherVal ---\n"; + echo "--- testing: $longVal / $otherVal ---\n"; var_dump($longVal/$otherVal); } } foreach ($otherVals as $otherVal) { foreach($longVals as $longVal) { - echo "--- testing: $otherVal / $longVal ---\n"; + echo "--- testing: $otherVal / $longVal ---\n"; var_dump($otherVal/$longVal); } } diff --git a/tests/lang/operators/divide_variationStr.phpt b/tests/lang/operators/divide_variationStr.phpt index 62fc6c8163..3db09e4e95 100644 --- a/tests/lang/operators/divide_variationStr.phpt +++ b/tests/lang/operators/divide_variationStr.phpt @@ -12,7 +12,7 @@ error_reporting(E_ERROR); foreach ($strVals as $strVal) { foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' / '$otherVal' ---\n"; + echo "--- testing: '$strVal' / '$otherVal' ---\n"; var_dump($strVal/$otherVal); } } diff --git a/tests/lang/operators/modulus_basiclong_64bit.phpt b/tests/lang/operators/modulus_basiclong_64bit.phpt index 786d449eb7..34792c2b54 100644 --- a/tests/lang/operators/modulus_basiclong_64bit.phpt +++ b/tests/lang/operators/modulus_basiclong_64bit.phpt @@ -24,9 +24,9 @@ error_reporting(E_ERROR); foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal % $otherVal ---\n"; - try { - var_dump($longVal%$otherVal); + echo "--- testing: $longVal % $otherVal ---\n"; + try { + var_dump($longVal%$otherVal); } catch (DivisionByZeroError $e) { echo "Exception: " . $e->getMessage() . "\n"; } @@ -35,8 +35,8 @@ foreach ($longVals as $longVal) { foreach ($otherVals as $otherVal) { foreach($longVals as $longVal) { - echo "--- testing: $otherVal % $longVal ---\n"; - try { + echo "--- testing: $otherVal % $longVal ---\n"; + try { var_dump($otherVal%$longVal); } catch (DivisionByZeroError $e) { echo "Exception: " . $e->getMessage() . "\n"; diff --git a/tests/lang/operators/modulus_variationStr.phpt b/tests/lang/operators/modulus_variationStr.phpt index e8ec8613fe..8d31c3ec91 100644 --- a/tests/lang/operators/modulus_variationStr.phpt +++ b/tests/lang/operators/modulus_variationStr.phpt @@ -12,7 +12,7 @@ error_reporting(E_ERROR); foreach ($strVals as $strVal) { foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' % '$otherVal' ---\n"; + echo "--- testing: '$strVal' % '$otherVal' ---\n"; try { var_dump($strVal%$otherVal); } catch (DivisionByZeroError $e) { diff --git a/tests/lang/operators/multiply_basiclong_64bit.phpt b/tests/lang/operators/multiply_basiclong_64bit.phpt index 6b2d6e2404..2fbe530bdc 100644 --- a/tests/lang/operators/multiply_basiclong_64bit.phpt +++ b/tests/lang/operators/multiply_basiclong_64bit.phpt @@ -24,14 +24,14 @@ error_reporting(E_ERROR); foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal * $otherVal ---\n"; + echo "--- testing: $longVal * $otherVal ---\n"; var_dump($longVal*$otherVal); } } foreach ($otherVals as $otherVal) { foreach($longVals as $longVal) { - echo "--- testing: $otherVal * $longVal ---\n"; + echo "--- testing: $otherVal * $longVal ---\n"; var_dump($otherVal*$longVal); } } diff --git a/tests/lang/operators/multiply_variationStr.phpt b/tests/lang/operators/multiply_variationStr.phpt index 33991c8b06..8f33aa2f00 100644 --- a/tests/lang/operators/multiply_variationStr.phpt +++ b/tests/lang/operators/multiply_variationStr.phpt @@ -12,7 +12,7 @@ error_reporting(E_ERROR); foreach ($strVals as $strVal) { foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' * '$otherVal' ---\n"; + echo "--- testing: '$strVal' * '$otherVal' ---\n"; var_dump($strVal*$otherVal); } } diff --git a/tests/lang/operators/operator_gt_or_equal_basic.phpt b/tests/lang/operators/operator_gt_or_equal_basic.phpt index de0863aea9..98f7aa543a 100644 --- a/tests/lang/operators/operator_gt_or_equal_basic.phpt +++ b/tests/lang/operators/operator_gt_or_equal_basic.phpt @@ -46,12 +46,12 @@ for ($i = 0; $i < count($toCompare); $i +=3) { } if ($invalid_compares != NULL) { - foreach($invalid_compares as $compareVal) { - if ($typeToTest >= $compareVal) { - echo "FAILED: '$typeToTest' >= '$compareVal'\n"; - $failed = true; - } - } + foreach($invalid_compares as $compareVal) { + if ($typeToTest >= $compareVal) { + echo "FAILED: '$typeToTest' >= '$compareVal'\n"; + $failed = true; + } + } } } diff --git a/tests/lang/operators/operator_lt_or_equal_basic.phpt b/tests/lang/operators/operator_lt_or_equal_basic.phpt index 8bca34e5ca..db09d38776 100644 --- a/tests/lang/operators/operator_lt_or_equal_basic.phpt +++ b/tests/lang/operators/operator_lt_or_equal_basic.phpt @@ -45,12 +45,12 @@ for ($i = 0; $i < count($toCompare); $i +=3) { } if ($invalid_compares != NULL) { - foreach($invalid_compares as $compareVal) { - if ($typeToTest <= $compareVal) { - echo "FAILED: '$typeToTest' <= '$compareVal'\n"; - $failed = true; - } - } + foreach($invalid_compares as $compareVal) { + if ($typeToTest <= $compareVal) { + echo "FAILED: '$typeToTest' <= '$compareVal'\n"; + $failed = true; + } + } } } diff --git a/tests/lang/operators/overloaded_property_ref.phpt b/tests/lang/operators/overloaded_property_ref.phpt index 7561fc9916..8a158fc0fd 100644 --- a/tests/lang/operators/overloaded_property_ref.phpt +++ b/tests/lang/operators/overloaded_property_ref.phpt @@ -3,9 +3,9 @@ Operators on overlaoded property reference --FILE-- <?php class C { - function __construct() { $this->bar = str_repeat("1", 2); } - function &__get($x) { return $this->bar; } - function __set($x, $v) { $this->bar = $v; } + function __construct() { $this->bar = str_repeat("1", 2); } + function &__get($x) { return $this->bar; } + function __set($x, $v) { $this->bar = $v; } } $x = new C; var_dump(++$x->foo); diff --git a/tests/lang/operators/subtract_basiclong_64bit.phpt b/tests/lang/operators/subtract_basiclong_64bit.phpt index 32ed0c8f3e..0685371737 100644 --- a/tests/lang/operators/subtract_basiclong_64bit.phpt +++ b/tests/lang/operators/subtract_basiclong_64bit.phpt @@ -24,14 +24,14 @@ error_reporting(E_ERROR); foreach ($longVals as $longVal) { foreach($otherVals as $otherVal) { - echo "--- testing: $longVal - $otherVal ---\n"; + echo "--- testing: $longVal - $otherVal ---\n"; var_dump($longVal-$otherVal); } } foreach ($otherVals as $otherVal) { foreach($longVals as $longVal) { - echo "--- testing: $otherVal - $longVal ---\n"; + echo "--- testing: $otherVal - $longVal ---\n"; var_dump($otherVal-$longVal); } } diff --git a/tests/lang/operators/subtract_variationStr.phpt b/tests/lang/operators/subtract_variationStr.phpt index 6d81b4fb7a..2c4667c114 100644 --- a/tests/lang/operators/subtract_variationStr.phpt +++ b/tests/lang/operators/subtract_variationStr.phpt @@ -12,7 +12,7 @@ error_reporting(E_ERROR); foreach ($strVals as $strVal) { foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' - '$otherVal' ---\n"; + echo "--- testing: '$strVal' - '$otherVal' ---\n"; var_dump($strVal-$otherVal); } } diff --git a/tests/lang/passByReference_001.phpt b/tests/lang/passByReference_001.phpt index 277f6d4a39..fd05182e68 100644 --- a/tests/lang/passByReference_001.phpt +++ b/tests/lang/passByReference_001.phpt @@ -4,14 +4,14 @@ passing of function parameters by reference <?php function f($arg1, &$arg2) { - var_dump($arg1++); - var_dump($arg2++); + var_dump($arg1++); + var_dump($arg2++); } function g (&$arg1, &$arg2) { - var_dump($arg1); - var_dump($arg2); + var_dump($arg1); + var_dump($arg2); } $a = 7; $b = 15; diff --git a/tests/lang/passByReference_002.phpt b/tests/lang/passByReference_002.phpt index d1968a3528..81868177a8 100644 --- a/tests/lang/passByReference_002.phpt +++ b/tests/lang/passByReference_002.phpt @@ -5,7 +5,7 @@ Attempt to pass a constant by reference function f(&$arg1) { - var_dump($arg1++); + var_dump($arg1++); } f(2); diff --git a/tests/lang/passByReference_003.phpt b/tests/lang/passByReference_003.phpt index de9ac09d8d..cfbc1b02de 100644 --- a/tests/lang/passByReference_003.phpt +++ b/tests/lang/passByReference_003.phpt @@ -3,13 +3,13 @@ Implicit initialisation when passing by reference --FILE-- <?php function passbyVal($val) { - echo "\nInside passbyVal call:\n"; - var_dump($val); + echo "\nInside passbyVal call:\n"; + var_dump($val); } function passbyRef(&$ref) { - echo "\nInside passbyRef call:\n"; - var_dump($ref); + echo "\nInside passbyRef call:\n"; + var_dump($ref); } echo "\nPassing undefined by value\n"; diff --git a/tests/lang/passByReference_004.phpt b/tests/lang/passByReference_004.phpt index a890411b71..e5688a230f 100644 --- a/tests/lang/passByReference_004.phpt +++ b/tests/lang/passByReference_004.phpt @@ -5,12 +5,12 @@ passing the return value from a function by reference function foo(&$ref) { - var_dump($ref); + var_dump($ref); } function bar($value) { - return $value; + return $value; } foo(bar(5)); diff --git a/tests/lang/passByReference_006.phpt b/tests/lang/passByReference_006.phpt index ce5d5ca2af..4c098acff3 100644 --- a/tests/lang/passByReference_006.phpt +++ b/tests/lang/passByReference_006.phpt @@ -11,20 +11,20 @@ function refs(&$ref1, &$ref2) { class C { - function __construct(&$ref1, &$ref2) { - $ref1 = "Ref1 changed"; - $ref2 = "Ref2 changed"; - } - - function refs(&$ref1, &$ref2) { - $ref1 = "Ref1 changed"; - $ref2 = "Ref2 changed"; - } - - static function static_refs(&$ref1, &$ref2) { - $ref1 = "Ref1 changed"; - $ref2 = "Ref2 changed"; - } + function __construct(&$ref1, &$ref2) { + $ref1 = "Ref1 changed"; + $ref2 = "Ref2 changed"; + } + + function refs(&$ref1, &$ref2) { + $ref1 = "Ref1 changed"; + $ref2 = "Ref2 changed"; + } + + static function static_refs(&$ref1, &$ref2) { + $ref1 = "Ref1 changed"; + $ref2 = "Ref2 changed"; + } } diff --git a/tests/lang/passByReference_007.phpt b/tests/lang/passByReference_007.phpt index 51594da0f3..9de00d26fd 100644 --- a/tests/lang/passByReference_007.phpt +++ b/tests/lang/passByReference_007.phpt @@ -3,42 +3,42 @@ Pass function and method calls by reference and by value. --FILE-- <?php class C { - static function sreturnVal() { - global $a; - return $a; - } - - static function &sreturnReference() { - global $a; - return $a; - } - - function returnVal() { - global $a; - return $a; - } - - function &returnReference() { - global $a; - return $a; - } + static function sreturnVal() { + global $a; + return $a; + } + + static function &sreturnReference() { + global $a; + return $a; + } + + function returnVal() { + global $a; + return $a; + } + + function &returnReference() { + global $a; + return $a; + } } function returnVal() { - global $a; - return $a; + global $a; + return $a; } function &returnReference() { - global $a; - return $a; + global $a; + return $a; } function foo(&$ref) { - var_dump($ref); - $ref = "changed"; + var_dump($ref); + $ref = "changed"; } diff --git a/tests/lang/passByReference_008.phpt b/tests/lang/passByReference_008.phpt index 5042b72e4b..ec5f161b40 100644 --- a/tests/lang/passByReference_008.phpt +++ b/tests/lang/passByReference_008.phpt @@ -3,15 +3,15 @@ Pass same variable by ref and by value. --FILE-- <?php function valRef($x, &$y) { - var_dump($x, $y); - $x = 'changed.x'; - $y = 'changed.y'; + var_dump($x, $y); + $x = 'changed.x'; + $y = 'changed.y'; } function refVal(&$x, $y) { - var_dump($x, $y); - $x = 'changed.x'; - $y = 'changed.y'; + var_dump($x, $y); + $x = 'changed.x'; + $y = 'changed.y'; } diff --git a/tests/lang/returnByReference.001.phpt b/tests/lang/returnByReference.001.phpt index 1feccd4a97..5278289f46 100644 --- a/tests/lang/returnByReference.001.phpt +++ b/tests/lang/returnByReference.001.phpt @@ -5,7 +5,7 @@ Returning a reference from a function function &returnByRef(&$arg1) { - return $arg1; + return $arg1; } $a = 7; diff --git a/tests/lang/returnByReference.002.phpt b/tests/lang/returnByReference.002.phpt index 67061048b3..1469e95a49 100644 --- a/tests/lang/returnByReference.002.phpt +++ b/tests/lang/returnByReference.002.phpt @@ -3,13 +3,13 @@ Returning a reference from a function. --FILE-- <?php function &returnRef() { - global $a; - return $a; + global $a; + return $a; } function returnVal() { - global $a; - return $a; + global $a; + return $a; } $a = "original"; diff --git a/tests/lang/returnByReference.003.phpt b/tests/lang/returnByReference.003.phpt index 44b5f7825b..11b91c547c 100644 --- a/tests/lang/returnByReference.003.phpt +++ b/tests/lang/returnByReference.003.phpt @@ -3,15 +3,15 @@ Returning a reference from a function --FILE-- <?php function returnConstantByValue() { - return 100; + return 100; } function &returnConstantByRef() { - return 100; + return 100; } function &returnVariableByRef() { - return $GLOBALS['a']; + return $GLOBALS['a']; } echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n"; diff --git a/tests/lang/returnByReference.004.phpt b/tests/lang/returnByReference.004.phpt index 63d4c709a3..d7e768cb82 100644 --- a/tests/lang/returnByReference.004.phpt +++ b/tests/lang/returnByReference.004.phpt @@ -3,17 +3,17 @@ Returning a reference from a static method --FILE-- <?php Class C { - static function returnConstantByValue() { - return 100; - } + static function returnConstantByValue() { + return 100; + } - static function &returnConstantByRef() { - return 100; - } + static function &returnConstantByRef() { + return 100; + } - static function &returnVariableByRef() { - return $GLOBALS['a']; - } + 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"; diff --git a/tests/lang/returnByReference.005.phpt b/tests/lang/returnByReference.005.phpt index 1d7a390b15..100bfe9ed8 100644 --- a/tests/lang/returnByReference.005.phpt +++ b/tests/lang/returnByReference.005.phpt @@ -3,17 +3,17 @@ Returning a reference from a method --FILE-- <?php Class C { - function returnConstantByValue() { - return 100; - } + function returnConstantByValue() { + return 100; + } - function &returnConstantByRef() { - return 100; - } + function &returnConstantByRef() { + return 100; + } - static function &returnVariableByRef() { - return $GLOBALS['a']; - } + static function &returnVariableByRef() { + return $GLOBALS['a']; + } } $c = new C; diff --git a/tests/lang/returnByReference.006.phpt b/tests/lang/returnByReference.006.phpt index d7a6c580a0..ff1749aa13 100644 --- a/tests/lang/returnByReference.006.phpt +++ b/tests/lang/returnByReference.006.phpt @@ -3,19 +3,19 @@ Returning a reference from a function via another function --FILE-- <?php function returnConstantByValue() { - return 100; + return 100; } function &returnConstantByRef() { - return 100; + return 100; } function &returnVariableByRef() { - return $GLOBALS['a']; + return $GLOBALS['a']; } function &returnFunctionCallByRef($functionToCall) { - return $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"; diff --git a/tests/lang/returnByReference.007.phpt b/tests/lang/returnByReference.007.phpt index b38dfa0cb1..f3f1e5c8a8 100644 --- a/tests/lang/returnByReference.007.phpt +++ b/tests/lang/returnByReference.007.phpt @@ -3,21 +3,21 @@ Returning a reference from a static method via another static method --FILE-- <?php class C { - static function returnConstantByValue() { - return 100; - } + static function returnConstantByValue() { + return 100; + } - static function &returnConstantByRef() { - return 100; - } + static function &returnConstantByRef() { + return 100; + } - static function &returnVariableByRef() { - return $GLOBALS['a']; - } + static function &returnVariableByRef() { + return $GLOBALS['a']; + } - static function &returnFunctionCallByRef($functionToCall) { - return C::$functionToCall(); - } + 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"; diff --git a/tests/lang/returnByReference.008.phpt b/tests/lang/returnByReference.008.phpt index 360df577c2..27a305a0ef 100644 --- a/tests/lang/returnByReference.008.phpt +++ b/tests/lang/returnByReference.008.phpt @@ -3,21 +3,21 @@ Returning a reference from a non-static method via another non-static method --FILE-- <?php class C { - function returnConstantByValue() { - return 100; - } + function returnConstantByValue() { + return 100; + } - function &returnConstantByRef() { - return 100; - } + function &returnConstantByRef() { + return 100; + } - function &returnVariableByRef() { - return $GLOBALS['a']; - } + function &returnVariableByRef() { + return $GLOBALS['a']; + } - function &returnFunctionCallByRef($functionToCall) { - return $this->$functionToCall(); - } + function &returnFunctionCallByRef($functionToCall) { + return $this->$functionToCall(); + } } $c = new C; diff --git a/tests/lang/returnByReference.009.phpt b/tests/lang/returnByReference.009.phpt index 68662f53eb..194f78bd84 100644 --- a/tests/lang/returnByReference.009.phpt +++ b/tests/lang/returnByReference.009.phpt @@ -6,11 +6,11 @@ Returning a references returned by another function function &returnVarByRef () { $b=1; - return $b; + return $b; } function &testReturnVarByRef() { - return returnVarByRef(); + return returnVarByRef(); } function returnVal () { @@ -18,7 +18,7 @@ return 1; } function &testReturnValByRef() { - return returnVal(); + return returnVal(); } echo "\n---> 1. Return a variable by reference -> No warning:\n"; diff --git a/tests/lang/static_basic_001.phpt b/tests/lang/static_basic_001.phpt index 302d2cf131..6a3ea1aa68 100644 --- a/tests/lang/static_basic_001.phpt +++ b/tests/lang/static_basic_001.phpt @@ -5,12 +5,12 @@ Static keyword - basic tests echo "\nSame variable used as static and non static.\n"; function staticNonStatic() { - echo "---------\n"; - $a=0; - echo "$a\n"; - static $a=10; - echo "$a\n"; - $a++; + echo "---------\n"; + $a=0; + echo "$a\n"; + static $a=10; + echo "$a\n"; + $a++; } staticNonStatic(); staticNonStatic(); @@ -18,20 +18,20 @@ staticNonStatic(); echo "\nLots of initialisations in the same statement.\n"; function manyInits() { - static $counter=0; - echo "------------- Call $counter --------------\n"; - static $a, $b=10, $c=20, $d, $e=30; - echo "Unitialised : $a\n"; - echo "Initialised to 10: $b\n"; - echo "Initialised to 20: $c\n"; - echo "Unitialised : $d\n"; - echo "Initialised to 30: $e\n"; - $a++; - $b++; - $c++; - $d++; - $e++; - $counter++; + static $counter=0; + echo "------------- Call $counter --------------\n"; + static $a, $b=10, $c=20, $d, $e=30; + echo "Unitialised : $a\n"; + echo "Initialised to 10: $b\n"; + echo "Initialised to 20: $c\n"; + echo "Unitialised : $d\n"; + echo "Initialised to 30: $e\n"; + $a++; + $b++; + $c++; + $d++; + $e++; + $counter++; } manyInits(); manyInits(); diff --git a/tests/lang/static_basic_002.phpt b/tests/lang/static_basic_002.phpt index 7e4e0bc3f4..b6e9856e82 100644 --- a/tests/lang/static_basic_002.phpt +++ b/tests/lang/static_basic_002.phpt @@ -13,10 +13,10 @@ static $a = 11; var_dump($a); function foo() { - static $a = 13; - static $a = 14; + static $a = 13; + static $a = 14; - var_dump($a); + var_dump($a); } foo(); diff --git a/tests/lang/static_variation_001.phpt b/tests/lang/static_variation_001.phpt index d8ebfd2ea1..13c3395f94 100644 --- a/tests/lang/static_variation_001.phpt +++ b/tests/lang/static_variation_001.phpt @@ -6,14 +6,14 @@ Statics in nested functions & evals. static $a = array(7,8,9); function f1() { - static $a = array(1,2,3); + static $a = array(1,2,3); - function g1() { - static $a = array(4,5,6); - var_dump($a); - } + function g1() { + static $a = array(4,5,6); + var_dump($a); + } - var_dump($a); + var_dump($a); } @@ -24,15 +24,15 @@ var_dump($a); eval(' static $b = array(10,11,12); '); function f2() { - eval(' static $b = array(1,2,3); '); + eval(' static $b = array(1,2,3); '); - function g2a() { - eval(' static $b = array(4,5,6); '); - var_dump($b); - } + function g2a() { + eval(' static $b = array(4,5,6); '); + var_dump($b); + } - eval('function g2b() { static $b = array(7, 8, 9); var_dump($b); } '); - var_dump($b); + eval('function g2b() { static $b = array(7, 8, 9); var_dump($b); } '); + var_dump($b); } f2(); diff --git a/tests/lang/static_variation_002.phpt b/tests/lang/static_variation_002.phpt index abb359c1d4..d1e2345ba1 100644 --- a/tests/lang/static_variation_002.phpt +++ b/tests/lang/static_variation_002.phpt @@ -4,26 +4,26 @@ Static variables in methods & nested functions & evals. <?php Class C { - function f() { - static $a = array(1,2,3); - eval(' static $k = array(4,5,6); '); + function f() { + static $a = array(1,2,3); + eval(' static $k = array(4,5,6); '); - function cfg() { - static $a = array(7,8,9); - eval(' static $k = array(10,11,12); '); - var_dump($a, $k); - } - var_dump($a, $k); - } + function cfg() { + static $a = array(7,8,9); + eval(' static $k = array(10,11,12); '); + var_dump($a, $k); + } + var_dump($a, $k); + } } $c = new C; $c->f(); cfg(); Class D { - static function f() { - eval('function dfg() { static $b = array(1,2,3); var_dump($b); } '); - } + static function f() { + eval('function dfg() { static $b = array(1,2,3); var_dump($b); } '); + } } D::f(); dfg(); diff --git a/tests/lang/throw_variation_001.phpt b/tests/lang/throw_variation_001.phpt index d942a87930..f71ef41ec7 100644 --- a/tests/lang/throw_variation_001.phpt +++ b/tests/lang/throw_variation_001.phpt @@ -4,9 +4,9 @@ Catching an exception thrown from an included file <?php try { - include "inc_throw.inc"; + include "inc_throw.inc"; } catch (Exception $e) { - echo "caught exception\n"; + echo "caught exception\n"; } ?> diff --git a/tests/lang/type_hints_002.phpt b/tests/lang/type_hints_002.phpt index cd348ebfb2..36fe56ad4b 100644 --- a/tests/lang/type_hints_002.phpt +++ b/tests/lang/type_hints_002.phpt @@ -4,10 +4,10 @@ ZE2 type hinting <?php class P { } class T { - function f(P $p = NULL) { - var_dump($p); - echo "-\n"; - } + function f(P $p = NULL) { + var_dump($p); + echo "-\n"; + } } $o=new T(); diff --git a/tests/lang/type_hints_003.phpt b/tests/lang/type_hints_003.phpt index 00471b9448..1a90940f42 100644 --- a/tests/lang/type_hints_003.phpt +++ b/tests/lang/type_hints_003.phpt @@ -3,8 +3,8 @@ ZE2 type --FILE-- <?php class T { - function f(P $p = 42) { - } + function f(P $p = 42) { + } } ?> --EXPECTF-- diff --git a/tests/output/bug70970.phpt b/tests/output/bug70970.phpt index f87e6f6977..902d872b9a 100644 --- a/tests/output/bug70970.phpt +++ b/tests/output/bug70970.phpt @@ -4,20 +4,20 @@ Bug #70970 (Segfault when combining error handler with output buffering) <?php function exception_error_handler($severity, $message, $file, $line) { - throw new Exception($message, 0); + throw new Exception($message, 0); } set_error_handler('exception_error_handler'); function obHandler($buffer, $phase = null) { - try { - ob_start(); - } catch (Exception $e) { - return (string) $e; - } + try { + ob_start(); + } catch (Exception $e) { + return (string) $e; + } - return $buffer; + return $buffer; } ob_start('obHandler'); diff --git a/tests/output/ob_010.phpt b/tests/output/ob_010.phpt index c5581a860e..b73ba1eecb 100644 --- a/tests/output/ob_010.phpt +++ b/tests/output/ob_010.phpt @@ -4,7 +4,7 @@ output buffering - fatalism <?php function obh($s) { - return print_r($s, 1); + return print_r($s, 1); } ob_start("obh"); echo "foo\n"; diff --git a/tests/output/ob_011.phpt b/tests/output/ob_011.phpt index 35b0388339..cd48cc3880 100644 --- a/tests/output/ob_011.phpt +++ b/tests/output/ob_011.phpt @@ -4,7 +4,7 @@ output buffering - fatalism <?php function obh($s) { - return ob_get_flush(); + return ob_get_flush(); } ob_start("obh"); echo "foo\n"; diff --git a/tests/output/ob_012.phpt b/tests/output/ob_012.phpt index 9e6e885abf..b24138bdbf 100644 --- a/tests/output/ob_012.phpt +++ b/tests/output/ob_012.phpt @@ -3,19 +3,19 @@ output buffering - multiple --FILE-- <?php echo 0; - ob_start(); - ob_start(); - ob_start(); - ob_start(); - echo 1; - ob_end_flush(); - echo 2; - $ob = ob_get_clean(); - echo 3; - ob_flush(); - ob_end_clean(); - echo 4; - ob_end_flush(); + ob_start(); + ob_start(); + ob_start(); + ob_start(); + echo 1; + ob_end_flush(); + echo 2; + $ob = ob_get_clean(); + echo 3; + ob_flush(); + ob_end_clean(); + echo 4; + ob_end_flush(); echo $ob; ?> --EXPECT-- diff --git a/tests/output/ob_017.phpt b/tests/output/ob_017.phpt index c6b59cb765..a214d40f18 100644 --- a/tests/output/ob_017.phpt +++ b/tests/output/ob_017.phpt @@ -6,9 +6,9 @@ opcache.optimization_level=0 <?php $statuses = array(); function oh($str, $flags) { - global $statuses; - $statuses[] = "$flags: $str"; - return $str; + global $statuses; + $statuses[] = "$flags: $str"; + return $str; } ob_start("oh", 3); echo "yes"; diff --git a/tests/output/ob_start_basic_002.phpt b/tests/output/ob_start_basic_002.phpt index d79a1fe980..700dab5d3c 100644 --- a/tests/output/ob_start_basic_002.phpt +++ b/tests/output/ob_start_basic_002.phpt @@ -3,23 +3,23 @@ ob_start(): Check behaviour with various callback return values. --FILE-- <?php function return_empty_string($string) { - return ""; + return ""; } function return_false($string) { - return false; + return false; } function return_null($string) { - return null; + return null; } function return_string($string) { - return "I stole your output."; + return "I stole your output."; } function return_zero($string) { - return 0; + return 0; } // Use each of the above functions as an output buffering callback: diff --git a/tests/output/ob_start_basic_003.phpt b/tests/output/ob_start_basic_003.phpt index 23f0bfb274..4ea17132da 100644 --- a/tests/output/ob_start_basic_003.phpt +++ b/tests/output/ob_start_basic_003.phpt @@ -4,7 +4,7 @@ ob_start(): ensure even fatal error test is affected by output buffering. <?php function f() { - return "I have stolen your output"; + return "I have stolen your output"; } ob_start('f'); diff --git a/tests/output/ob_start_basic_004.phpt b/tests/output/ob_start_basic_004.phpt index ba75c16de9..f072a31f13 100644 --- a/tests/output/ob_start_basic_004.phpt +++ b/tests/output/ob_start_basic_004.phpt @@ -10,10 +10,10 @@ opcache.optimization_level=0 */ // In HEAD, $chunk_size value of 1 should not have any special behaviour (http://marc.info/?l=php-internals&m=123476465621346&w=2). function callback($string) { - global $callback_invocations; - $callback_invocations++; - $len = strlen($string); - return "f[call:$callback_invocations; len:$len]$string\n"; + global $callback_invocations; + $callback_invocations++; + $len = strlen($string); + return "f[call:$callback_invocations; len:$len]$string\n"; } for ($cs=-1; $cs<10; $cs++) { diff --git a/tests/output/ob_start_basic_005.phpt b/tests/output/ob_start_basic_005.phpt index 9cd5a0dded..4c3aa9c7eb 100644 --- a/tests/output/ob_start_basic_005.phpt +++ b/tests/output/ob_start_basic_005.phpt @@ -8,9 +8,9 @@ ob_start(): non-static method as static callbacks. */ Class C { - function h($string) { - return $string; - } + function h($string) { + return $string; + } } function checkAndClean() { diff --git a/tests/output/ob_start_basic_006.phpt b/tests/output/ob_start_basic_006.phpt index b3aef511ac..6df545ea22 100644 --- a/tests/output/ob_start_basic_006.phpt +++ b/tests/output/ob_start_basic_006.phpt @@ -8,32 +8,32 @@ ob_start(): ensure multiple buffer initialization with a single call using array */ function f($string) { - static $i=0; - $i++; - $len = strlen($string); - return "f[call:$i; len:$len] - $string\n"; + static $i=0; + $i++; + $len = strlen($string); + return "f[call:$i; len:$len] - $string\n"; } Class C { - public $id = 'none'; - - function __construct($id) { - $this->id = $id; - } - - static function g($string) { - static $i=0; - $i++; - $len = strlen($string); - return "C::g[call:$i; len:$len] - $string\n"; - } - - function h($string) { - static $i=0; - $i++; - $len = strlen($string); - return "C::h[call:$i; len:$len; id:$this->id] - $string\n"; - } + public $id = 'none'; + + function __construct($id) { + $this->id = $id; + } + + static function g($string) { + static $i=0; + $i++; + $len = strlen($string); + return "C::g[call:$i; len:$len] - $string\n"; + } + + function h($string) { + static $i=0; + $i++; + $len = strlen($string); + return "C::h[call:$i; len:$len; id:$this->id] - $string\n"; + } } function checkAndClean() { diff --git a/tests/output/ob_start_basic_unerasable_001.phpt b/tests/output/ob_start_basic_unerasable_001.phpt index ebb03a4c16..658bee2163 100644 --- a/tests/output/ob_start_basic_unerasable_001.phpt +++ b/tests/output/ob_start_basic_unerasable_001.phpt @@ -3,9 +3,9 @@ ob_start(): Ensure content of unerasable buffer can be accessed by ob_get_conten --FILE-- <?php function callback($string) { - static $callback_invocations; - $callback_invocations++; - return "[callback:$callback_invocations]$string\n"; + static $callback_invocations; + $callback_invocations++; + return "[callback:$callback_invocations]$string\n"; } ob_start('callback', 0, false); diff --git a/tests/output/ob_start_basic_unerasable_002.phpt b/tests/output/ob_start_basic_unerasable_002.phpt index 967f467f75..1afe3efbc5 100644 --- a/tests/output/ob_start_basic_unerasable_002.phpt +++ b/tests/output/ob_start_basic_unerasable_002.phpt @@ -3,9 +3,9 @@ ob_start(): Ensure unerasable buffer cannot be erased by ob_clean(), ob_end_clea --FILE-- <?php function callback($string) { - static $callback_invocations; - $callback_invocations++; - return "[callback:$callback_invocations]$string\n"; + static $callback_invocations; + $callback_invocations++; + return "[callback:$callback_invocations]$string\n"; } ob_start('callback', 0, false); diff --git a/tests/output/ob_start_basic_unerasable_003.phpt b/tests/output/ob_start_basic_unerasable_003.phpt index a881d271b6..b3b76da650 100644 --- a/tests/output/ob_start_basic_unerasable_003.phpt +++ b/tests/output/ob_start_basic_unerasable_003.phpt @@ -3,9 +3,9 @@ ob_start(): Ensure unerasable buffer cannot be accessed or erased by ob_get_clea --FILE-- <?php function callback($string) { - static $callback_invocations; - $callback_invocations++; - return "[callback:$callback_invocations]$string\n"; + static $callback_invocations; + $callback_invocations++; + return "[callback:$callback_invocations]$string\n"; } ob_start('callback', 0, false); diff --git a/tests/output/ob_start_basic_unerasable_004.phpt b/tests/output/ob_start_basic_unerasable_004.phpt index 83702fc08f..442462462c 100644 --- a/tests/output/ob_start_basic_unerasable_004.phpt +++ b/tests/output/ob_start_basic_unerasable_004.phpt @@ -3,9 +3,9 @@ ob_start(): Ensure unerasable buffer cannot be accessed or flushed by ob_get_flu --FILE-- <?php function callback($string) { - static $callback_invocations; - $callback_invocations++; - return "[callback:$callback_invocations]$string\n"; + static $callback_invocations; + $callback_invocations++; + return "[callback:$callback_invocations]$string\n"; } ob_start('callback', 0, false); diff --git a/tests/output/ob_start_basic_unerasable_005.phpt b/tests/output/ob_start_basic_unerasable_005.phpt index 86c752e98b..7f99b72dd1 100644 --- a/tests/output/ob_start_basic_unerasable_005.phpt +++ b/tests/output/ob_start_basic_unerasable_005.phpt @@ -3,9 +3,9 @@ ob_start(): Ensure unerasable buffer cannot be flushed by ob_flush() --FILE-- <?php function callback($string) { - static $callback_invocations; - $callback_invocations++; - return "[callback:$callback_invocations]$string\n"; + static $callback_invocations; + $callback_invocations++; + return "[callback:$callback_invocations]$string\n"; } ob_start('callback', 0, false); diff --git a/tests/output/ob_start_callbacks.phpt b/tests/output/ob_start_callbacks.phpt index 6815bccd63..ea6e409534 100644 --- a/tests/output/ob_start_callbacks.phpt +++ b/tests/output/ob_start_callbacks.phpt @@ -11,9 +11,9 @@ ob_end_flush(); // Object (array) in variable class foo { - static function out($foo) { - return strtoupper($foo); - } + static function out($foo) { + return strtoupper($foo); + } } $a = array('foo', 'out'); ob_start($a); @@ -26,7 +26,7 @@ echo 'object via static array', "\n"; ob_end_flush(); function my_strtoupper($foo, $bar) { - return strtoupper($foo); + return strtoupper($foo); } $a = 'my_strtoupper'; ob_start($a); diff --git a/tests/output/ob_start_error_001.phpt b/tests/output/ob_start_error_001.phpt index c838c18bac..36efb124a7 100644 --- a/tests/output/ob_start_error_001.phpt +++ b/tests/output/ob_start_error_001.phpt @@ -8,7 +8,7 @@ Test wrong number of arguments and wrong arg types for ob_start() */ function justPrint($str) { - return $str; + return $str; } $arg_1 = "justPrint"; diff --git a/tests/output/ob_start_error_002.phpt b/tests/output/ob_start_error_002.phpt index e3f45af3df..447547182b 100644 --- a/tests/output/ob_start_error_002.phpt +++ b/tests/output/ob_start_error_002.phpt @@ -8,9 +8,9 @@ Test wrong number of arguments and wrong arg types for ob_start() */ Class C { - static function f($str) { - return $str; - } + static function f($str) { + return $str; + } } var_dump(ob_start(array("nonExistent","f"))); diff --git a/tests/output/ob_start_error_005.phpt b/tests/output/ob_start_error_005.phpt index d6f9dc4c10..e11fc3ad89 100644 --- a/tests/output/ob_start_error_005.phpt +++ b/tests/output/ob_start_error_005.phpt @@ -9,10 +9,10 @@ ob_start(): ensure buffers can't be added from within callback. */ function f($str) { - ob_start(); - echo "hello"; - ob_end_flush(); - return $str; + ob_start(); + echo "hello"; + ob_end_flush(); + return $str; } diff --git a/tests/quicktester.inc b/tests/quicktester.inc index ba60e74a51..ba243beba0 100644 --- a/tests/quicktester.inc +++ b/tests/quicktester.inc @@ -20,55 +20,55 @@ $tests = explode("\n",$tests); $success = TRUE; foreach ($tests as $n=>$test) { - // ignore empty lines - if (!$test) continue; + // ignore empty lines + if (!$test) continue; - // warn for trailing ; - if (substr(trim($test), -1, 1) === ';') { - echo "WARNING: trailing ';' found in test ".($n+1)."\n"; - exit; - } + // warn for trailing ; + if (substr(trim($test), -1, 1) === ';') { + echo "WARNING: trailing ';' found in test ".($n+1)."\n"; + exit; + } - // try for operators - $operators = array('===', '~=='); - $operator = NULL; - foreach ($operators as $a_operator) { - if (strpos($test, $a_operator)!== FALSE) { - $operator = $a_operator; - list($left,$right) = explode($operator, $test); - break; - } - } - if (!$operator) { - echo "WARNING: unknown operator in '$test' (1)\n"; - exit; - } + // try for operators + $operators = array('===', '~=='); + $operator = NULL; + foreach ($operators as $a_operator) { + if (strpos($test, $a_operator)!== FALSE) { + $operator = $a_operator; + list($left,$right) = explode($operator, $test); + break; + } + } + if (!$operator) { + echo "WARNING: unknown operator in '$test' (1)\n"; + exit; + } - $left = eval("return ($left );"); - $right = eval("return ($right);"); - switch (@$operator) { - case '===': // exact match - $result = $left === $right; - break; - case '~==': // may differ after 12th significant number - if ( !is_float($left ) && !is_int($left ) - || !is_float($right) && !is_int($right)) { - $result = FALSE; - break; - } - $result = abs(($left-$right) / $left) < 1e-12; - break; - default: - echo "WARNING: unknown operator in '$test' (2)\n"; - exit; - } + $left = eval("return ($left );"); + $right = eval("return ($right);"); + switch (@$operator) { + case '===': // exact match + $result = $left === $right; + break; + case '~==': // may differ after 12th significant number + if ( !is_float($left ) && !is_int($left ) + || !is_float($right) && !is_int($right)) { + $result = FALSE; + break; + } + $result = abs(($left-$right) / $left) < 1e-12; + break; + default: + echo "WARNING: unknown operator in '$test' (2)\n"; + exit; + } - $success = $success && $result; - if (!$result) { - echo "\nAssert failed:\n"; - echo "$test\n"; - echo "Left: ";var_dump($left ); - echo "Right: ";var_dump($right); - } + $success = $success && $result; + if (!$result) { + echo "\nAssert failed:\n"; + echo "$test\n"; + echo "Left: ";var_dump($left ); + echo "Right: ";var_dump($right); + } } if ($success) echo "OK"; diff --git a/tests/security/open_basedir.inc b/tests/security/open_basedir.inc index d30f2f8384..b97071bfbd 100644 --- a/tests/security/open_basedir.inc +++ b/tests/security/open_basedir.inc @@ -43,7 +43,7 @@ function recursive_delete_directory($directory) { if (is_dir($path) == TRUE) { recursive_delete_directory($path); } else { - @chmod($path, 0777); + @chmod($path, 0777); unlink($path); } } @@ -51,7 +51,7 @@ function recursive_delete_directory($directory) { } closedir($handle); - @chmod($directory, 0777); + @chmod($directory, 0777); rmdir($directory); return TRUE; diff --git a/tests/strings/001.phpt b/tests/strings/001.phpt index 6d0a9d12b9..0f1f749459 100644 --- a/tests/strings/001.phpt +++ b/tests/strings/001.phpt @@ -11,15 +11,15 @@ $tok2 = strtok("/"); $tok3 = strtok("\\"); $tok4 = strtok("."); if ($tok1 != "testing") { - echo("failed 1\n"); + echo("failed 1\n"); } elseif ($tok2 != "1") { - echo("failed 2\n"); + echo("failed 2\n"); } elseif ($tok3 != "2") { - echo("failed 3\n"); + echo("failed 3\n"); } elseif ($tok4 != "3") { - echo("failed 4\n"); + echo("failed 4\n"); } else { - echo("passed\n"); + echo("passed\n"); } echo "Testing strstr: "; @@ -27,11 +27,11 @@ $test = "This is a test"; $found1 = strstr($test, chr(32)); $found2 = strstr($test, "a "); if ($found1 != " is a test") { - echo("failed 1\n"); + echo("failed 1\n"); } elseif ($found2 != "a test") { - echo("failed 2\n"); + echo("failed 2\n"); } else { - echo("passed\n"); + echo("passed\n"); } echo "Testing strrchr: "; @@ -39,30 +39,30 @@ $test = "fola fola blakken"; $found1 = strrchr($test, "b"); $found2 = strrchr($test, chr(102)); if ($found1 != "blakken") { - echo("failed 1\n"); + echo("failed 1\n"); } elseif ($found2 != "fola blakken") { - echo("failed 2\n"); + echo("failed 2\n"); } else { - echo("passed\n"); + echo("passed\n"); } echo "Testing strtoupper: "; $test = "abCdEfg"; $upper = strtoupper($test); if ($upper == "ABCDEFG") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo "Testing strtolower: "; $test = "ABcDeFG"; $lower = strtolower($test); if ($lower == "abcdefg") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo "Testing substr: "; @@ -79,9 +79,9 @@ $tests++; if (substr($string, -1, -2) == "") { $ok++; } $tests++; if (substr($string, -3, -2) == "3") { $ok++; } if ($tests == $ok) { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } $raw = ' !"#$%&\'()*+,-./0123456789:;<=>?' @@ -96,17 +96,17 @@ $correct = '%20%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3 . '%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~' . '%00'; if ($encoded == $correct) { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo "Testing rawurldecode: "; $decoded = rawurldecode($correct); if ($decoded == $raw) { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo "Testing urlencode: "; @@ -116,62 +116,62 @@ $correct = '+%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E% . '%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E' . '%00'; if ($encoded == $correct) { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo "Testing urldecode: "; $decoded = urldecode($correct); if ($decoded == $raw) { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo "Testing quotemeta: "; $raw = "a.\\+*?" . chr(91) . "^" . chr(93) . "b\$c"; $quoted = quotemeta($raw); if ($quoted == "a\\.\\\\\\+\\*\\?\\[\\^\\]b\\\$c") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo "Testing ufirst: "; $str = "fahrvergnuegen"; $uc = ucfirst($str); if ($uc == "Fahrvergnuegen") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo "Testing strtr: "; $str = "test abcdefgh"; $tr = strtr($str, "def", "456"); if ($tr == "t5st abc456gh") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo "Testing addslashes: "; $str = "\"\\'"; $as = addslashes($str); if ($as == "\\\"\\\\\\'") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo "Testing stripslashes: "; $str = "\$\\'"; $ss = stripslashes($str); if ($ss == "\$'") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } @@ -183,9 +183,9 @@ $ui2 = uniqid($str, true); $len = 29; if (strlen($ui1) == strlen($ui2) && strlen($ui1) == $len && $ui1 != $ui2) { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo "Testing uniqid(false): "; @@ -197,9 +197,9 @@ $ui2 = uniqid($str); $len = strncasecmp(PHP_OS, 'CYGWIN', 6) ? 19 : 29; if (strlen($ui1) == strlen($ui2) && strlen($ui1) == $len && $ui1 != $ui2) { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } ?> diff --git a/tests/strings/bug26703.phpt b/tests/strings/bug26703.phpt index bea8fb1214..4e48845fdf 100644 --- a/tests/strings/bug26703.phpt +++ b/tests/strings/bug26703.phpt @@ -8,7 +8,7 @@ highlight.default=#0000BB highlight.html=#000000 --FILE-- <?php - highlight_string('<?php echo "foo[] $a \n"; ?>'); + highlight_string('<?php echo "foo[] $a \n"; ?>'); ?> --EXPECT-- <code><span style="color: #000000"> |