diff --git a/Zend/tests/017.phpt b/Zend/tests/017.phpt index 619365cbce17f..1c4407c69ef63 100644 --- a/Zend/tests/017.phpt +++ b/Zend/tests/017.phpt @@ -28,7 +28,6 @@ var_dump(count(get_defined_functions())); var_dump(gettype(get_declared_interfaces())); var_dump(count(get_declared_interfaces())); -var_dump(get_extension_funcs(true)); var_dump(gettype(get_extension_funcs("standard"))); var_dump(count(get_extension_funcs("standard"))); var_dump(gettype(get_extension_funcs("zend"))); @@ -51,7 +50,6 @@ string(5) "array" int(%d) string(5) "array" int(%d) -bool(false) string(5) "array" int(%d) string(5) "array" diff --git a/Zend/tests/arrow_functions/007.phpt b/Zend/tests/arrow_functions/007.phpt index 66b03b84c2e93..d5cdf7b106e38 100644 --- a/Zend/tests/arrow_functions/007.phpt +++ b/Zend/tests/arrow_functions/007.phpt @@ -12,7 +12,7 @@ try { } try { - assert((fn&(int... $args): ?bool => $args[0])(false)); + assert((fn&(int... $args): ?int => $args[0])(0)); } catch (AssertionError $e) { echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL; } @@ -20,4 +20,4 @@ try { ?> --EXPECT-- assert(): assert((fn() => false)()) failed -assert(): assert((fn&(int ...$args): ?bool => $args[0])(false)) failed +assert(): assert((fn&(int ...$args): ?int => $args[0])(0)) failed diff --git a/Zend/tests/backtrace/debug_backtrace_options.phpt b/Zend/tests/backtrace/debug_backtrace_options.phpt index 460bbe3936ff7..955dcc7038481 100644 --- a/Zend/tests/backtrace/debug_backtrace_options.phpt +++ b/Zend/tests/backtrace/debug_backtrace_options.phpt @@ -16,10 +16,6 @@ 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"; @@ -48,14 +44,6 @@ foo::statCall("doit", "backtrace_print"); #0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...') #1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...') #2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...') -==true -#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...') -#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...') -#2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...') -==false -#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...') -#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...') -#2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...') ==DEBUG_BACKTRACE_PROVIDE_OBJECT #0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...') #1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...') @@ -130,130 +118,6 @@ Array ) -) -==true -Array -( - [0] => Array - ( - [file] => %sdebug_backtrace_options.php - [line] => 17 - [function] => backtrace_print - [args] => Array - ( - [0] => 1 - ) - - ) - - [1] => Array - ( - [file] => %sdebug_backtrace_options.php - [line] => %d - [function] => doit - [args] => Array - ( - [0] => a - [1] => b - [2] => backtrace_print - ) - - ) - - [2] => Array - ( - [file] => %sdebug_backtrace_options.php - [line] => %d - [function] => doCall - [class] => foo - [object] => foo Object - ( - ) - - [type] => -> - [args] => Array - ( - [0] => doit - [1] => backtrace_print - ) - - ) - - [3] => Array - ( - [file] => %sdebug_backtrace_options.php - [line] => %d - [function] => statCall - [class] => foo - [type] => :: - [args] => Array - ( - [0] => doit - [1] => backtrace_print - ) - - ) - -) -==false -Array -( - [0] => Array - ( - [file] => %sdebug_backtrace_options.php - [line] => 19 - [function] => backtrace_print - [args] => Array - ( - [0] => - ) - - ) - - [1] => Array - ( - [file] => %sdebug_backtrace_options.php - [line] => %d - [function] => doit - [args] => Array - ( - [0] => a - [1] => b - [2] => backtrace_print - ) - - ) - - [2] => Array - ( - [file] => %sdebug_backtrace_options.php - [line] => %d - [function] => doCall - [class] => foo - [type] => -> - [args] => Array - ( - [0] => doit - [1] => backtrace_print - ) - - ) - - [3] => Array - ( - [file] => %sdebug_backtrace_options.php - [line] => %d - [function] => statCall - [class] => foo - [type] => :: - [args] => Array - ( - [0] => doit - [1] => backtrace_print - ) - - ) - ) ==DEBUG_BACKTRACE_PROVIDE_OBJECT Array @@ -261,7 +125,7 @@ Array [0] => Array ( [file] => %sdebug_backtrace_options.php - [line] => 21 + [line] => 17 [function] => backtrace_print [args] => Array ( @@ -325,7 +189,7 @@ Array [0] => Array ( [file] => %sdebug_backtrace_options.php - [line] => 23 + [line] => 19 [function] => backtrace_print ) @@ -361,7 +225,7 @@ Array [0] => Array ( [file] => %sdebug_backtrace_options.php - [line] => 25 + [line] => 21 [function] => backtrace_print ) diff --git a/Zend/tests/bug36513.phpt b/Zend/tests/bug36513.phpt index f7b813b6f7847..f43052ca9e575 100644 --- a/Zend/tests/bug36513.phpt +++ b/Zend/tests/bug36513.phpt @@ -3,7 +3,7 @@ Bug #36513 (comment will be output in last line) --FILE-- Add("xx1"); $objRefTest->Add("xx2"); $objRefTest->Add("xx3"); -echo "objRefTest->getArray() = " . print_r($objRefTest->getArray(), 1); +echo "objRefTest->getArray() = " . print_r($objRefTest->getArray(), true); ?> --EXPECT-- intTheValue = 10 diff --git a/Zend/tests/bug79022.phpt b/Zend/tests/bug79022.phpt index 904195518ee55..cd63bf729cfd7 100644 --- a/Zend/tests/bug79022.phpt +++ b/Zend/tests/bug79022.phpt @@ -3,7 +3,7 @@ Bug #79022 (class_exists returns True for classes that are not ready to be used) --FILE-- --EXPECT-- -int(0) +int(2) diff --git a/Zend/tests/class_alias/class_alias_007.phpt b/Zend/tests/class_alias/class_alias_007.phpt index eb953dc15c95f..a315b52d38fc8 100644 --- a/Zend/tests/class_alias/class_alias_007.phpt +++ b/Zend/tests/class_alias/class_alias_007.phpt @@ -7,7 +7,7 @@ spl_autoload_register(function ($a) { class foo { } }); -class_alias('foo', 'bar', 1); +class_alias('foo', 'bar', true); var_dump(new foo, new bar); diff --git a/Zend/tests/dynamic_call/bug47880.phpt b/Zend/tests/dynamic_call/bug47880.phpt index bf2022c8094d8..8c363a5b5b229 100644 --- a/Zend/tests/dynamic_call/bug47880.phpt +++ b/Zend/tests/dynamic_call/bug47880.phpt @@ -4,7 +4,7 @@ Bug #47880 (crashes in call_user_func_array()) prop2)); var_dump($test); ?> ---EXPECT-- +--EXPECTF-- int(40) bool(true) + +Deprecated: Test::$prop2::get(): Returning type bool which is implicitly converted to type int is deprecated in %s on line %d bool(true) object(Test)#1 (1) { ["prop"]=> diff --git a/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt b/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt index 726245705ffc5..87194889df654 100644 --- a/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt +++ b/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt @@ -26,6 +26,7 @@ try { } ?> ---EXPECT-- +--EXPECTF-- +Deprecated: P::foo(): Returning type int which is implicitly converted to type bool is deprecated in %s on line %d bool(false) C::foo(): Return value must be of type array|false, int returned diff --git a/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt b/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt index 7eebe1e3571f0..0be5e720784a9 100644 --- a/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt +++ b/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt @@ -26,6 +26,7 @@ try { } ?> ---EXPECT-- +--EXPECTF-- +Deprecated: P::foo(): Returning type int which is implicitly converted to type bool is deprecated in %s on line %d bool(true) C::foo(): Return value must be of type array|true, int returned diff --git a/Zend/tests/type_declarations/scalar_basic.phpt b/Zend/tests/type_declarations/scalar_basic.phpt index 6b2cf736edbf9..3e90c9e81ee1a 100644 --- a/Zend/tests/type_declarations/scalar_basic.phpt +++ b/Zend/tests/type_declarations/scalar_basic.phpt @@ -72,7 +72,7 @@ int(1) int(1) *** Trying float(1.5) -E_DEPRECATED: Implicit conversion from float 1.5 to int loses precision on line 14 +E_DEPRECATED: Implicit conversion from float 1.5 to int loses precision on line %d int(1) *** Trying string(2) "1a" @@ -91,9 +91,11 @@ int(%d) *** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d *** Trying bool(true) +E_DEPRECATED: {closure:%s:%d}(): Passing bool to parameter #1 ($i) of type int is deprecated on line %d int(1) *** Trying bool(false) +E_DEPRECATED: {closure:%s:%d}(): Passing bool to parameter #1 ($i) of type int is deprecated on line %d int(0) *** Trying NULL @@ -103,11 +105,11 @@ int(0) } *** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d -*** Trying object(stdClass)#%s (0) { +*** Trying object(stdClass)#%d (0) { } *** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d -*** Trying object(StringCapable)#%s (0) { +*** Trying object(StringCapable)#%d (0) { } *** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d @@ -144,9 +146,11 @@ float(%s) float(NAN) *** Trying bool(true) +E_DEPRECATED: {closure:%s:%d}(): Passing bool to parameter #1 ($f) of type float is deprecated on line %d float(1) *** Trying bool(false) +E_DEPRECATED: {closure:%s:%d}(): Passing bool to parameter #1 ($f) of type float is deprecated on line %d float(0) *** Trying NULL @@ -156,11 +160,11 @@ float(0) } *** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d -*** Trying object(stdClass)#%s (0) { +*** Trying object(stdClass)#%d (0) { } *** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d -*** Trying object(StringCapable)#%s (0) { +*** Trying object(StringCapable)#%d (0) { } *** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d @@ -197,9 +201,11 @@ string(%d) "%d" string(3) "NAN" *** Trying bool(true) +E_DEPRECATED: {closure:%s:%d}(): Passing bool to parameter #1 ($s) of type string is deprecated on line %d string(1) "1" *** Trying bool(false) +E_DEPRECATED: {closure:%s:%d}(): Passing bool to parameter #1 ($s) of type string is deprecated on line %d string(0) "" *** Trying NULL @@ -209,11 +215,11 @@ string(0) "" } *** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d -*** Trying object(stdClass)#%s (0) { +*** Trying object(stdClass)#%d (0) { } *** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d -*** Trying object(StringCapable)#%s (0) { +*** Trying object(StringCapable)#%d (0) { } string(6) "foobar" @@ -223,30 +229,39 @@ string(6) "foobar" Testing 'bool' type: *** Trying int(1) +E_DEPRECATED: {closure:%s:%d}(): Passing int to parameter #1 ($b) of type bool is deprecated on line %d bool(true) *** Trying string(1) "1" +E_DEPRECATED: {closure:%s:%d}(): Passing string to parameter #1 ($b) of type bool is deprecated on line %d bool(true) *** Trying float(1) +E_DEPRECATED: {closure:%s:%d}(): Passing float to parameter #1 ($b) of type bool is deprecated on line %d bool(true) *** Trying float(1.5) +E_DEPRECATED: {closure:%s:%d}(): Passing float to parameter #1 ($b) of type bool is deprecated on line %d bool(true) *** Trying string(2) "1a" +E_DEPRECATED: {closure:%s:%d}(): Passing string to parameter #1 ($b) of type bool is deprecated on line %d bool(true) *** Trying string(1) "a" +E_DEPRECATED: {closure:%s:%d}(): Passing string to parameter #1 ($b) of type bool is deprecated on line %d bool(true) *** Trying string(0) "" +E_DEPRECATED: {closure:%s:%d}(): Passing string to parameter #1 ($b) of type bool is deprecated on line %d bool(false) *** Trying int(%d) +E_DEPRECATED: {closure:%s:%d}(): Passing int to parameter #1 ($b) of type bool is deprecated on line %d bool(true) *** Trying float(NAN) +E_DEPRECATED: {closure:%s:%d}(): Passing float to parameter #1 ($b) of type bool is deprecated on line %d bool(true) *** Trying bool(true) @@ -262,11 +277,11 @@ bool(false) } *** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d -*** Trying object(stdClass)#%s (0) { +*** Trying object(stdClass)#%d (0) { } *** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d -*** Trying object(StringCapable)#%s (0) { +*** Trying object(StringCapable)#%d (0) { } *** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d diff --git a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt index 0a32dd3f16f23..8a677fec42477 100644 --- a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt +++ b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt @@ -84,8 +84,10 @@ int(9223372036854775807) *** Trying float(NAN) *** Caught {closure:%s:%d}(): Return value must be of type int, float returned in %s on line %d *** Trying bool(true) +E_DEPRECATED: {closure:%s:%d}(): Returning type bool which is implicitly converted to type int is deprecated on line %d int(1) *** Trying bool(false) +E_DEPRECATED: {closure:%s:%d}(): Returning type bool which is implicitly converted to type int is deprecated on line %d int(0) *** Trying NULL *** Caught {closure:%s:%d}(): Return value must be of type int, null returned in %s on line %d @@ -121,8 +123,10 @@ float(9.223372036854776E+18) *** Trying float(NAN) float(NAN) *** Trying bool(true) +E_DEPRECATED: {closure:%s:%d}(): Returning type bool which is implicitly converted to type float is deprecated on line %d float(1) *** Trying bool(false) +E_DEPRECATED: {closure:%s:%d}(): Returning type bool which is implicitly converted to type float is deprecated on line %d float(0) *** Trying NULL *** Caught {closure:%s:%d}(): Return value must be of type float, null returned in %s on line %d @@ -158,8 +162,10 @@ string(19) "9223372036854775807" *** Trying float(NAN) string(3) "NAN" *** Trying bool(true) +E_DEPRECATED: {closure:%s:%d}(): Returning type bool which is implicitly converted to type string is deprecated on line %d string(1) "1" *** Trying bool(false) +E_DEPRECATED: {closure:%s:%d}(): Returning type bool which is implicitly converted to type string is deprecated on line %d string(0) "" *** Trying NULL *** Caught {closure:%s:%d}(): Return value must be of type string, null returned in %s on line %d @@ -177,22 +183,31 @@ string(6) "foobar" Testing 'bool' type: *** Trying int(1) +E_DEPRECATED: {closure:%s:%d}(): Returning type int which is implicitly converted to type bool is deprecated on line %d bool(true) *** Trying string(1) "1" +E_DEPRECATED: {closure:%s:%d}(): Returning type string which is implicitly converted to type bool is deprecated on line %d bool(true) *** Trying float(1) +E_DEPRECATED: {closure:%s:%d}(): Returning type float which is implicitly converted to type bool is deprecated on line %d bool(true) *** Trying float(1.5) +E_DEPRECATED: {closure:%s:%d}(): Returning type float which is implicitly converted to type bool is deprecated on line %d bool(true) *** Trying string(2) "1a" +E_DEPRECATED: {closure:%s:%d}(): Returning type string which is implicitly converted to type bool is deprecated on line %d bool(true) *** Trying string(1) "a" +E_DEPRECATED: {closure:%s:%d}(): Returning type string which is implicitly converted to type bool is deprecated on line %d bool(true) *** Trying string(0) "" +E_DEPRECATED: {closure:%s:%d}(): Returning type string which is implicitly converted to type bool is deprecated on line %d bool(false) *** Trying int(9223372036854775807) +E_DEPRECATED: {closure:%s:%d}(): Returning type int which is implicitly converted to type bool is deprecated on line %d bool(true) *** Trying float(NAN) +E_DEPRECATED: {closure:%s:%d}(): Returning type float which is implicitly converted to type bool is deprecated on line %d bool(true) *** Trying bool(true) bool(true) diff --git a/Zend/tests/type_declarations/scalar_weak_reference.phpt b/Zend/tests/type_declarations/scalar_weak_reference.phpt index 74069689e6e6f..5247c46fa81ff 100644 --- a/Zend/tests/type_declarations/scalar_weak_reference.phpt +++ b/Zend/tests/type_declarations/scalar_weak_reference.phpt @@ -21,9 +21,11 @@ var_dump($x); to_bool($x); var_dump($x); ?> ---EXPECT-- +--EXPECTF-- float(1) int(1) float(1) string(1) "1" + +Deprecated: to_bool(): Passing string to parameter #1 ($x) of type bool is deprecated in %s on line %d bool(true) diff --git a/Zend/tests/type_declarations/union_types/type_checking_weak.phpt b/Zend/tests/type_declarations/union_types/type_checking_weak.phpt index 9031b002b2a09..5893c962802a3 100644 --- a/Zend/tests/type_declarations/union_types/type_checking_weak.phpt +++ b/Zend/tests/type_declarations/union_types/type_checking_weak.phpt @@ -69,8 +69,8 @@ INF => INF "42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, string given "x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, string given "" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, string given -true => 1 -false => 0 +true => 1 ({closure:%s:%d}(): Passing bool to parameter #1 ($arg) of type int|float is deprecated) +false => 0 ({closure:%s:%d}(): Passing bool to parameter #1 ($arg) of type int|float is deprecated) null => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, null given [] => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, array given new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, stdClass given @@ -85,7 +85,7 @@ INF => INF "42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, string given "x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, string given "" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, string given -true => 1 +true => 1 ({closure:%s:%d}(): Passing bool to parameter #1 ($arg) of type int|float|false is deprecated) false => false null => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, null given [] => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, array given @@ -98,9 +98,9 @@ Type int|float|bool: INF => INF "42" => 42 "42.0" => 42.0 -"42x" => true -"x" => true -"" => false +"42x" => true ({closure:%s:%d}(): Passing string to parameter #1 ($arg) of type int|float|bool is deprecated) +"x" => true ({closure:%s:%d}(): Passing string to parameter #1 ($arg) of type int|float|bool is deprecated) +"" => false ({closure:%s:%d}(): Passing string to parameter #1 ($arg) of type int|float|bool is deprecated) true => true false => false null => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, null given @@ -111,12 +111,12 @@ new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|fl Type int|bool: 42 => 42 42.0 => 42 -INF => true +INF => true ({closure:%s:%d}(): Passing float to parameter #1 ($arg) of type int|bool is deprecated) "42" => 42 "42.0" => 42 -"42x" => true -"x" => true -"" => false +"42x" => true ({closure:%s:%d}(): Passing string to parameter #1 ($arg) of type int|bool is deprecated) +"x" => true ({closure:%s:%d}(): Passing string to parameter #1 ($arg) of type int|bool is deprecated) +"" => false ({closure:%s:%d}(): Passing string to parameter #1 ($arg) of type int|bool is deprecated) true => true false => false null => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, null given @@ -133,8 +133,8 @@ INF => "INF" "42x" => "42x" "x" => "x" "" => "" -true => 1 -false => 0 +true => 1 ({closure:%s:%d}(): Passing bool to parameter #1 ($arg) of type string|int|null is deprecated) +false => 0 ({closure:%s:%d}(): Passing bool to parameter #1 ($arg) of type string|int|null is deprecated) null => null [] => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|int|null, array given new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|int|null, stdClass given @@ -165,8 +165,8 @@ INF => INF "42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, string given "x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, string given "" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, string given -true => 1.0 -false => 0.0 +true => 1.0 ({closure:%s:%d}(): Passing bool to parameter #1 ($arg) of type array|float is deprecated) +false => 0.0 ({closure:%s:%d}(): Passing bool to parameter #1 ($arg) of type array|float is deprecated) null => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, null given [] => [] new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, stdClass given @@ -181,22 +181,22 @@ INF => "INF" "42x" => "42x" "x" => "x" "" => "" -true => "1" -false => "" +true => "1" ({closure:%s:%d}(): Passing bool to parameter #1 ($arg) of type array|string is deprecated) +false => "" ({closure:%s:%d}(): Passing bool to parameter #1 ($arg) of type array|string is deprecated) null => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|string, null given [] => [] new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|string, stdClass given new WithToString => "__toString()" Type bool|array: -42 => true -42.0 => true -INF => true -"42" => true -"42.0" => true -"42x" => true -"x" => true -"" => false +42 => true ({closure:%s:%d}(): Passing int to parameter #1 ($arg) of type array|bool is deprecated) +42.0 => true ({closure:%s:%d}(): Passing float to parameter #1 ($arg) of type array|bool is deprecated) +INF => true ({closure:%s:%d}(): Passing float to parameter #1 ($arg) of type array|bool is deprecated) +"42" => true ({closure:%s:%d}(): Passing string to parameter #1 ($arg) of type array|bool is deprecated) +"42.0" => true ({closure:%s:%d}(): Passing string to parameter #1 ($arg) of type array|bool is deprecated) +"42x" => true ({closure:%s:%d}(): Passing string to parameter #1 ($arg) of type array|bool is deprecated) +"x" => true ({closure:%s:%d}(): Passing string to parameter #1 ($arg) of type array|bool is deprecated) +"" => false ({closure:%s:%d}(): Passing string to parameter #1 ($arg) of type array|bool is deprecated) true => true false => false null => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, null given diff --git a/Zend/tests/type_declarations/weak_bool/from_bool.phpt b/Zend/tests/type_declarations/weak_bool/from_bool.phpt new file mode 100644 index 0000000000000..d8fca2631cd62 --- /dev/null +++ b/Zend/tests/type_declarations/weak_bool/from_bool.phpt @@ -0,0 +1,97 @@ +--TEST-- +Check deprecation from bool type in weak mode +--FILE-- +v = true; +var_dump($o->v); + +echo "float:\n"; +function fpf(float $v) { + var_dump($v); +} + +function frf($v): float { + var_dump($v); + return $v; +} + +class CF { + public float $v; +} +$o = new CF(); + +fpf(true); +frf(true); +$o->v = true; +var_dump($o->v); + +echo "string:\n"; +function fps(string $v) { + var_dump($v); +} + +function frs($v): string { + var_dump($v); + return $v; +} + +class CS { + public string $v; +} +$o = new CS(); + +fps(true); +frs(true); +$o->v = true; +var_dump($o->v); + +?> +--EXPECTF-- +int: + +Deprecated: fpi(): Passing bool to parameter #1 ($v) of type int is deprecated in %s on line %d +int(1) +bool(true) + +Deprecated: fri(): Returning type bool which is implicitly converted to type int is deprecated in %s on line %d + +Deprecated: Assigning bool to typed property which is implicitly converted to type int is deprecated in %s on line %d +int(1) +float: + +Deprecated: fpf(): Passing bool to parameter #1 ($v) of type float is deprecated in %s on line %d +float(1) +bool(true) + +Deprecated: frf(): Returning type bool which is implicitly converted to type float is deprecated in %s on line %d + +Deprecated: Assigning bool to typed property which is implicitly converted to type float is deprecated in %s on line %d +float(1) +string: + +Deprecated: fps(): Passing bool to parameter #1 ($v) of type string is deprecated in %s on line %d +string(1) "1" +bool(true) + +Deprecated: frs(): Returning type bool which is implicitly converted to type string is deprecated in %s on line %d + +Deprecated: Assigning bool to typed property which is implicitly converted to type string is deprecated in %s on line %d +string(1) "1" diff --git a/Zend/tests/type_declarations/weak_bool/to_bool.phpt b/Zend/tests/type_declarations/weak_bool/to_bool.phpt new file mode 100644 index 0000000000000..5f8b905d87492 --- /dev/null +++ b/Zend/tests/type_declarations/weak_bool/to_bool.phpt @@ -0,0 +1,70 @@ +--TEST-- +Check deprecation to bool type in weak mode +--FILE-- +b = 42; +var_dump($o->b); + +echo "float:\n"; +foo(2.5); +bar(12.5); +$o->b = 12.5; +var_dump($o->b); + +echo "string:\n"; +foo("hello"); +bar("hello"); +$o->b = "hello"; +var_dump($o->b); + +?> +--EXPECTF-- +int: + +Deprecated: foo(): Passing int to parameter #1 ($b) of type bool is deprecated in %s on line %d +bool(true) +int(42) + +Deprecated: bar(): Returning type int which is implicitly converted to type bool is deprecated in %s on line %d + +Deprecated: Assigning int to type property which is implicitly converted to type bool is deprecated in %s on line %d +bool(true) +float: + +Deprecated: foo(): Passing float to parameter #1 ($b) of type bool is deprecated in %s on line %d +bool(true) +float(12.5) + +Deprecated: bar(): Returning type float which is implicitly converted to type bool is deprecated in %s on line %d + +Deprecated: Assigning float to type property which is implicitly converted to type bool is deprecated in %s on line %d +bool(true) +string: + +Deprecated: foo(): Passing string to parameter #1 ($b) of type bool is deprecated in %s on line %d +bool(true) +string(5) "hello" + +Deprecated: bar(): Returning type string which is implicitly converted to type bool is deprecated in %s on line %d + +Deprecated: Assigning string to type property which is implicitly converted to type bool is deprecated in %s on line %d +bool(true) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index e0006e7d7275f..d4d2a3199ad30 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -523,10 +523,129 @@ static ZEND_COLD bool zend_null_arg_deprecated(const char *fallback_type, uint32 return !EG(exception); } +static ZEND_COLD bool zend_arg_from_bool_deprecated(const char *fallback_type, const uint32_t arg_num) { + /* Check arg_num is not (uint32_t)-1, as otherwise its called by + * zend_verify_weak_scalar_type_hint_no_sideeffect() */ + if (arg_num == (uint32_t)-1) { + return true; + } + /* Dealing with a class constant assignment should never happen */ + if (arg_num == (uint32_t)-3) { + ZEND_UNREACHABLE(); + return false; + } + + /* Dealing with a property */ + if (arg_num == (uint32_t)-2) { + /* Not enough info for a good error message */ + zend_error(E_DEPRECATED, + "Assigning bool to typed property which is implicitly converted to type %s is deprecated", + fallback_type + ); + return !EG(exception); + } + + zend_function *func = zend_active_function(); + zend_arg_info *arg_info = NULL; + zend_string *type_str = NULL; + if (arg_num != 0) { + uint32_t arg_offset = arg_num - 1; + if (arg_offset >= func->common.num_args) { + ZEND_ASSERT(func->common.fn_flags & ZEND_ACC_VARIADIC); + arg_offset = func->common.num_args; + } + arg_info = &func->common.arg_info[arg_offset]; + type_str = zend_type_to_string(arg_info->type); + } + zend_string *func_name = get_active_function_or_method_name(); + const char *type_param = type_str ? ZSTR_VAL(type_str) : fallback_type; + if (arg_num == 0) { + zend_error(E_DEPRECATED, + "%s(): Returning type bool which is implicitly converted to type %s is deprecated", + ZSTR_VAL(func_name), type_param + ); + } else { + const char *arg_name = get_active_function_arg_name(arg_num); + zend_error(E_DEPRECATED, + "%s(): Passing bool to parameter #%" PRIu32 "%s%s%s of type %s is deprecated", + ZSTR_VAL(func_name), arg_num, + arg_name ? " ($" : "", arg_name ? arg_name : "", arg_name ? ")" : "", + type_param + ); + } + zend_string_release(func_name); + if (type_str) { + zend_string_release(type_str); + } + return !EG(exception); +} + +static ZEND_COLD bool zend_arg_to_bool_deprecated(const zval *arg, uint32_t arg_num) { + /* Check arg_num is not (uint32_t)-1, as otherwise its called by + * zend_verify_weak_scalar_type_hint_no_sideeffect() */ + if (arg_num == (uint32_t)-1) { + return true; + } + /* Dealing with a class constant assignment should never happen */ + if (arg_num == (uint32_t)-3) { + ZEND_UNREACHABLE(); + return false; + } + + const char *type_arg = zend_zval_type_name(arg); + /* Dealing with a property */ + if (arg_num == (uint32_t)-2) { + /* Not enough info for a good error message */ + zend_error(E_DEPRECATED, + "Assigning %s to type property which is implicitly converted to type bool is deprecated", + type_arg + ); + return !EG(exception); + } + + zend_function *func = zend_active_function(); + zend_arg_info *arg_info = NULL; + zend_string *type_str = NULL; + if (arg_num != 0) { + uint32_t arg_offset = arg_num - 1; + if (arg_offset >= func->common.num_args) { + ZEND_ASSERT(func->common.fn_flags & ZEND_ACC_VARIADIC); + arg_offset = func->common.num_args; + } + arg_info = &func->common.arg_info[arg_offset]; + type_str = zend_type_to_string(arg_info->type); + } + zend_string *func_name = get_active_function_or_method_name(); + const char *type_param = type_str ? ZSTR_VAL(type_str) : "bool"; + if (arg_num == 0) { + zend_error(E_DEPRECATED, + "%s(): Returning type %s which is implicitly converted to type %s is deprecated", + ZSTR_VAL(func_name), type_arg, type_param + ); + } else { + const char *arg_name = get_active_function_arg_name(arg_num); + zend_error(E_DEPRECATED, + "%s(): Passing %s to parameter #%" PRIu32 "%s%s%s of type %s is deprecated", + ZSTR_VAL(func_name), type_arg, arg_num, + arg_name ? " ($" : "", arg_name ? arg_name : "", arg_name ? ")" : "", + type_param + ); + } + zend_string_release(func_name); + if (type_str) { + zend_string_release(type_str); + } + return !EG(exception); +} + ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(const zval *arg, bool *dest, uint32_t arg_num) /* {{{ */ { if (EXPECTED(Z_TYPE_P(arg) <= IS_STRING)) { - if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("bool", arg_num)) { + if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) { + if (UNEXPECTED(!zend_null_arg_deprecated("int", arg_num))) { + return 0; + } + } else if (UNEXPECTED(!zend_arg_to_bool_deprecated(arg, arg_num))) { return 0; } *dest = zend_is_true(arg); @@ -611,11 +730,21 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long return 0; } } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) { - if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("int", arg_num)) { - return 0; + if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) { + if (UNEXPECTED(!zend_null_arg_deprecated("int", arg_num))) { + return 0; + } + } else { + ZEND_ASSERT(Z_TYPE_P(arg) == IS_FALSE); + if (UNEXPECTED(!zend_arg_from_bool_deprecated("int", arg_num))) { + return 0; + } } *dest = 0; } else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) { + if (UNEXPECTED(!zend_arg_from_bool_deprecated("int", arg_num))) { + return 0; + } *dest = 1; } else { return 0; @@ -660,11 +789,21 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(const zval *arg, double * return 0; } } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) { - if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("float", arg_num)) { - return 0; + if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) { + if (UNEXPECTED(!zend_null_arg_deprecated("int", arg_num))) { + return 0; + } + } else { + ZEND_ASSERT(Z_TYPE_P(arg) == IS_FALSE); + if (UNEXPECTED(!zend_arg_from_bool_deprecated("float", arg_num))) { + return 0; + } } *dest = 0.0; } else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) { + if (UNEXPECTED(!zend_arg_from_bool_deprecated("float", arg_num))) { + return 0; + } *dest = 1.0; } else { return 0; @@ -704,11 +843,21 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest, u } zend_string_release(str); } else if (Z_TYPE_P(arg) < IS_TRUE) { - if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("int|float", arg_num)) { - return 0; + if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) { + if (UNEXPECTED(!zend_null_arg_deprecated("int", arg_num))) { + return 0; + } + } else { + ZEND_ASSERT(Z_TYPE_P(arg) == IS_FALSE); + if (UNEXPECTED(!zend_arg_from_bool_deprecated("int|float", arg_num))) { + return 0; + } } ZVAL_LONG(arg, 0); } else if (Z_TYPE_P(arg) == IS_TRUE) { + if (UNEXPECTED(!zend_arg_from_bool_deprecated("int|float", arg_num))) { + return 0; + } ZVAL_LONG(arg, 1); } else { return 0; @@ -725,11 +874,21 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_or_str_slow(zval *arg, zval ** return false; } if (Z_TYPE_P(arg) < IS_TRUE) { - if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("string|int|float", arg_num)) { - return false; + if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) { + if (UNEXPECTED(!zend_null_arg_deprecated("int", arg_num))) { + return 0; + } + } else { + ZEND_ASSERT(Z_TYPE_P(arg) == IS_FALSE); + if (UNEXPECTED(!zend_arg_from_bool_deprecated("string|int|float", arg_num))) { + return 0; + } } ZVAL_LONG(arg, 0); } else if (Z_TYPE_P(arg) == IS_TRUE) { + if (UNEXPECTED(!zend_arg_from_bool_deprecated("string|int|float", arg_num))) { + return 0; + } ZVAL_LONG(arg, 1); } else if (UNEXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) { zend_object *zobj = Z_OBJ_P(arg); @@ -753,6 +912,9 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **des if (EXPECTED(Z_TYPE_P(arg) < IS_STRING)) { if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("string", arg_num)) { return 0; + } else if (UNEXPECTED((Z_TYPE_P(arg) == IS_TRUE || Z_TYPE_P(arg) == IS_FALSE) + && !zend_arg_from_bool_deprecated("string", arg_num))) { + return 0; } convert_to_string(arg); *dest = Z_STR_P(arg); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 5d8d9f4caeb86..5ec5818fffcb0 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -730,7 +730,7 @@ ZEND_API ZEND_COLD void zend_verify_arg_error( zend_string_release(need_msg); } -static bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg) +static bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg, uint32_t arg_num) { zend_long lval; double dval; @@ -753,7 +753,7 @@ static bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg) ZVAL_DOUBLE(arg, dval); return 1; } - } else if (zend_parse_arg_long_weak(arg, &lval, 0)) { + } else if (zend_parse_arg_long_weak(arg, &lval, arg_num)) { zval_ptr_dtor(arg); ZVAL_LONG(arg, lval); return 1; @@ -761,16 +761,16 @@ static bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg) return 0; } } - if ((type_mask & MAY_BE_DOUBLE) && zend_parse_arg_double_weak(arg, &dval, 0)) { + if ((type_mask & MAY_BE_DOUBLE) && zend_parse_arg_double_weak(arg, &dval, arg_num)) { zval_ptr_dtor(arg); ZVAL_DOUBLE(arg, dval); return 1; } - if ((type_mask & MAY_BE_STRING) && zend_parse_arg_str_weak(arg, &str, 0)) { + if ((type_mask & MAY_BE_STRING) && zend_parse_arg_str_weak(arg, &str, arg_num)) { /* on success "arg" is converted to IS_STRING */ return 1; } - if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL && zend_parse_arg_bool_weak(arg, &bval, 0)) { + if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL && zend_parse_arg_bool_weak(arg, &bval, arg_num)) { zval_ptr_dtor(arg); ZVAL_BOOL(arg, bval); return 1; @@ -815,7 +815,7 @@ static bool zend_verify_weak_scalar_type_hint_no_sideeffect(uint32_t type_mask, } #endif -ZEND_API bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, bool strict, bool is_internal_arg) +static bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, bool strict, bool is_internal_arg, uint32_t arg_num) { if (UNEXPECTED(strict)) { /* SSTH Exception: IS_LONG may be accepted as IS_DOUBLE (converted) */ @@ -833,10 +833,10 @@ ZEND_API bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, bool s return zend_verify_weak_scalar_type_hint_no_sideeffect(type_mask, arg); } #endif - return zend_verify_weak_scalar_type_hint(type_mask, arg); + return zend_verify_weak_scalar_type_hint(type_mask, arg, arg_num); } -ZEND_COLD zend_never_inline void zend_verify_class_constant_type_error(const zend_class_constant *c, const zend_string *name, const zval *constant) +static ZEND_COLD zend_never_inline void zend_verify_class_constant_type_error(const zend_class_constant *c, const zend_string *name, const zval *constant) { zend_string *type_str = zend_type_to_string(c->type); @@ -846,7 +846,7 @@ ZEND_COLD zend_never_inline void zend_verify_class_constant_type_error(const zen zend_string_release(type_str); } -ZEND_COLD zend_never_inline void zend_verify_property_type_error(const zend_property_info *info, const zval *property) +static ZEND_COLD zend_never_inline void zend_verify_property_type_error(const zend_property_info *info, const zval *property) { zend_string *type_str; @@ -864,7 +864,7 @@ ZEND_COLD zend_never_inline void zend_verify_property_type_error(const zend_prop zend_string_release(type_str); } -ZEND_COLD zend_never_inline void zend_magic_get_property_type_inconsistency_error(const zend_property_info *info, const zval *property) +static ZEND_COLD zend_never_inline void zend_magic_get_property_type_inconsistency_error(const zend_property_info *info, const zval *property) { /* we _may_ land here in case reading already errored and runtime cache thus has not been updated (i.e. it contains a valid but unrelated info) */ if (EG(exception)) { @@ -1051,7 +1051,7 @@ static zend_always_inline bool i_zend_check_property_type(const zend_property_in uint32_t type_mask = ZEND_TYPE_FULL_MASK(info->type); ZEND_ASSERT(!(type_mask & (MAY_BE_CALLABLE|MAY_BE_STATIC|MAY_BE_NEVER|MAY_BE_VOID))); - return zend_verify_scalar_type_hint(type_mask, property, strict, 0); + return zend_verify_scalar_type_hint(type_mask, property, strict, false, (uint32_t)-2); } static zend_always_inline bool i_zend_verify_property_type(const zend_property_info *info, zval *property, bool strict) @@ -1150,7 +1150,7 @@ static bool zend_check_intersection_type_from_list( } static zend_always_inline bool zend_check_type_slow( - const zend_type *type, zval *arg, const zend_reference *ref, + const zend_type *type, zval *arg, uint32_t arg_num, const zend_reference *ref, bool is_return_type, bool is_internal) { if (ZEND_TYPE_IS_COMPLEX(*type) && EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) { @@ -1206,14 +1206,14 @@ static zend_always_inline bool zend_check_type_slow( return zend_verify_scalar_type_hint(type_mask, arg, is_return_type ? ZEND_RET_USES_STRICT_TYPES() : ZEND_ARG_USES_STRICT_TYPES(), - is_internal); + is_internal, arg_num); /* Special handling for IS_VOID is not necessary (for return types), * because this case is already checked at compile-time. */ } static zend_always_inline bool zend_check_type( - const zend_type *type, zval *arg, zend_class_entry *scope, + const zend_type *type, zval *arg, uint32_t arg_num, zend_class_entry *scope, bool is_return_type, bool is_internal) { const zend_reference *ref = NULL; @@ -1228,14 +1228,14 @@ static zend_always_inline bool zend_check_type( return 1; } - return zend_check_type_slow(type, arg, ref, is_return_type, is_internal); + return zend_check_type_slow(type, arg, arg_num, ref, is_return_type, is_internal); } ZEND_API bool zend_check_user_type_slow( - const zend_type *type, zval *arg, const zend_reference *ref, bool is_return_type) + const zend_type *type, zval *arg, uint32_t arg_num, const zend_reference *ref, bool is_return_type) { return zend_check_type_slow( - type, arg, ref, is_return_type, /* is_internal */ false); + type, arg, arg_num, ref, is_return_type, /* is_internal */ false); } static zend_always_inline bool zend_verify_recv_arg_type(const zend_function *zf, uint32_t arg_num, zval *arg) @@ -1246,7 +1246,7 @@ static zend_always_inline bool zend_verify_recv_arg_type(const zend_function *zf cur_arg_info = &zf->common.arg_info[arg_num-1]; if (ZEND_TYPE_IS_SET(cur_arg_info->type) - && UNEXPECTED(!zend_check_type(&cur_arg_info->type, arg, zf->common.scope, 0, 0))) { + && UNEXPECTED(!zend_check_type(&cur_arg_info->type, arg, arg_num, zf->common.scope, 0, 0))) { zend_verify_arg_error(zf, cur_arg_info, arg_num, arg); return 0; } @@ -1258,7 +1258,7 @@ static zend_always_inline bool zend_verify_variadic_arg_type( const zend_function *zf, const zend_arg_info *arg_info, uint32_t arg_num, zval *arg) { ZEND_ASSERT(ZEND_TYPE_IS_SET(arg_info->type)); - if (UNEXPECTED(!zend_check_type(&arg_info->type, arg, zf->common.scope, 0, 0))) { + if (UNEXPECTED(!zend_check_type(&arg_info->type, arg, arg_num, zf->common.scope, 0, 0))) { zend_verify_arg_error(zf, arg_info, arg_num, arg); return 0; } @@ -1283,7 +1283,7 @@ static zend_never_inline ZEND_ATTRIBUTE_UNUSED bool zend_verify_internal_arg_typ } if (ZEND_TYPE_IS_SET(cur_arg_info->type) - && UNEXPECTED(!zend_check_type(&cur_arg_info->type, arg, fbc->common.scope, 0, /* is_internal */ 1))) { + && UNEXPECTED(!zend_check_type(&cur_arg_info->type, arg, i+1, fbc->common.scope, false, /* is_internal */ true))) { return 0; } arg++; @@ -1489,7 +1489,7 @@ ZEND_API bool zend_verify_internal_return_type(const zend_function *zf, zval *re return 1; } - if (UNEXPECTED(!zend_check_type(&ret_info->type, ret, NULL, 1, /* is_internal */ 1))) { + if (UNEXPECTED(!zend_check_type(&ret_info->type, ret, 0, NULL, 1, /* is_internal */ 1))) { zend_verify_internal_return_error(zf, ret); return 0; } @@ -1518,7 +1518,7 @@ static zend_always_inline bool zend_check_class_constant_type(const zend_class_c uint32_t type_mask = ZEND_TYPE_FULL_MASK(c->type); ZEND_ASSERT(!(type_mask & (MAY_BE_CALLABLE|MAY_BE_NEVER|MAY_BE_VOID))); - return zend_verify_scalar_type_hint(type_mask, constant, true, false); + return zend_verify_scalar_type_hint(type_mask, constant, true, false, (uint32_t)-3); } ZEND_API bool zend_never_inline zend_verify_class_constant_type(const zend_class_constant *c, const zend_string *name, zval *constant) @@ -3778,7 +3778,7 @@ ZEND_API zval* ZEND_FASTCALL zend_fetch_static_property(zend_execute_data *ex, i return result; } -ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(const zend_property_info *prop1, const zend_property_info *prop2, const zval *zv) { +static ZEND_COLD void zend_throw_ref_type_error_type(const zend_property_info *prop1, const zend_property_info *prop2, const zval *zv) { zend_string *type1_str = zend_type_to_string(prop1->type); zend_string *type2_str = zend_type_to_string(prop2->type); zend_type_error("Reference with value of type %s held by property %s::$%s of type %s is not compatible with property %s::$%s of type %s", @@ -3794,7 +3794,7 @@ ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(const zend_property_info zend_string_release(type2_str); } -ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval(const zend_property_info *prop, const zval *zv) { +static ZEND_COLD void zend_throw_ref_type_error_zval(const zend_property_info *prop, const zval *zv) { zend_string *type_str = zend_type_to_string(prop->type); zend_type_error("Cannot assign %s to reference held by property %s::$%s of type %s", zend_zval_value_name(zv), @@ -3888,7 +3888,7 @@ ZEND_API bool ZEND_FASTCALL zend_verify_ref_assignable_zval(zend_reference *ref, first_prop = prop; ZVAL_COPY(&coerced_value, zv); if (!zend_verify_weak_scalar_type_hint( - ZEND_TYPE_FULL_MASK(prop->type), &coerced_value)) { + ZEND_TYPE_FULL_MASK(prop->type), &coerced_value, (uint32_t)-2)) { goto type_error; } } else if (Z_ISUNDEF(coerced_value)) { @@ -3898,7 +3898,7 @@ ZEND_API bool ZEND_FASTCALL zend_verify_ref_assignable_zval(zend_reference *ref, } else { zval tmp; ZVAL_COPY(&tmp, zv); - if (!zend_verify_weak_scalar_type_hint(ZEND_TYPE_FULL_MASK(prop->type), &tmp)) { + if (!zend_verify_weak_scalar_type_hint(ZEND_TYPE_FULL_MASK(prop->type), &tmp, (uint32_t)-2)) { zval_ptr_dtor(&tmp); goto type_error; } @@ -3999,7 +3999,7 @@ ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref_ex(const zend_pro * the value is simply illegal for the type, or because or a conflicting coercion. */ zval tmp; ZVAL_COPY(&tmp, val); - if (zend_verify_weak_scalar_type_hint(ZEND_TYPE_FULL_MASK(prop_info->type), &tmp)) { + if (zend_verify_weak_scalar_type_hint(ZEND_TYPE_FULL_MASK(prop_info->type), &tmp, (uint32_t)-2)) { const zend_property_info *ref_prop = ZEND_REF_FIRST_SOURCE(Z_REF_P(orig_val)); zend_throw_ref_type_error_type(ref_prop, prop_info, val); zval_ptr_dtor(&tmp); diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index cf15c9e3b2db5..402c1bcd1a4db 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -80,8 +80,6 @@ typedef enum { ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref_ex(const zend_property_info *prop_info, zval *orig_val, bool strict, zend_verify_prop_assignable_by_ref_context context); ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref(const zend_property_info *prop_info, zval *orig_val, bool strict); -ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval(const zend_property_info *prop, const zval *zv); -ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(const zend_property_info *prop1, const zend_property_info *prop2, const zval *zv); ZEND_API ZEND_COLD zval* ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval); ZEND_API ZEND_COLD zval* ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset); ZEND_API ZEND_COLD void zend_wrong_string_offset_error(void); @@ -99,7 +97,6 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_cannot_add_element(void); ZEND_API bool ZEND_FASTCALL zend_asymmetric_property_has_set_access(const zend_property_info *prop_info); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_asymmetric_visibility_property_modification_error(const zend_property_info *prop_info, const char *operation); -ZEND_API bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, bool strict, bool is_internal_arg); ZEND_API ZEND_COLD void zend_verify_arg_error( const zend_function *zf, const zend_arg_info *arg_info, uint32_t arg_num, const zval *value); ZEND_API ZEND_COLD void zend_verify_return_error( @@ -108,7 +105,7 @@ ZEND_API ZEND_COLD void zend_verify_never_error( const zend_function *zf); ZEND_API bool zend_verify_ref_array_assignable(zend_reference *ref); ZEND_API bool zend_check_user_type_slow( - const zend_type *type, zval *arg, const zend_reference *ref, bool is_return_type); + const zend_type *type, zval *arg, uint32_t arg_num, const zend_reference *ref, bool is_return_type); #if ZEND_DEBUG ZEND_API bool zend_internal_call_should_throw(const zend_function *fbc, zend_execute_data *call); @@ -577,13 +574,9 @@ ZEND_API zend_result ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *cal #define ZEND_CLASS_HAS_TYPE_HINTS(ce) ((bool)(ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS)) #define ZEND_CLASS_HAS_READONLY_PROPS(ce) ((bool)(ce->ce_flags & ZEND_ACC_HAS_READONLY_PROPS)) - ZEND_API bool zend_verify_class_constant_type(const zend_class_constant *c, const zend_string *name, zval *constant); -ZEND_COLD void zend_verify_class_constant_type_error(const zend_class_constant *c, const zend_string *name, const zval *constant); ZEND_API bool zend_verify_property_type(const zend_property_info *info, zval *property, bool strict); -ZEND_COLD void zend_verify_property_type_error(const zend_property_info *info, const zval *property); -ZEND_COLD void zend_magic_get_property_type_inconsistency_error(const zend_property_info *info, const zval *property); #define ZEND_REF_ADD_TYPE_SOURCE(ref, source) \ zend_ref_add_type_source(&ZEND_REF_TYPE_SOURCES(ref), source) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 617e114dd05db..8e5c2dd58ab62 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -4481,7 +4481,7 @@ ZEND_VM_COLD_CONST_HANDLER(124, ZEND_VERIFY_RETURN_TYPE, CONST|TMP|VAR|UNUSED|CV } SAVE_OPLINE(); - if (UNEXPECTED(!zend_check_type_slow(&ret_info->type, retval_ptr, ref, 1, 0))) { + if (UNEXPECTED(!zend_check_type_slow(&ret_info->type, retval_ptr, 0, ref, 1, 0))) { zend_verify_return_error(EX(func), retval_ptr); HANDLE_EXCEPTION(); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 791e4b4e88437..bdd6a51411e40 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -10898,7 +10898,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYP } SAVE_OPLINE(); - if (UNEXPECTED(!zend_check_type_slow(&ret_info->type, retval_ptr, ref, 1, 0))) { + if (UNEXPECTED(!zend_check_type_slow(&ret_info->type, retval_ptr, 0, ref, 1, 0))) { zend_verify_return_error(EX(func), retval_ptr); HANDLE_EXCEPTION(); } @@ -21672,7 +21672,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_TMP_UN } SAVE_OPLINE(); - if (UNEXPECTED(!zend_check_type_slow(&ret_info->type, retval_ptr, ref, 1, 0))) { + if (UNEXPECTED(!zend_check_type_slow(&ret_info->type, retval_ptr, 0, ref, 1, 0))) { zend_verify_return_error(EX(func), retval_ptr); HANDLE_EXCEPTION(); } @@ -30121,7 +30121,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_VAR_UN } SAVE_OPLINE(); - if (UNEXPECTED(!zend_check_type_slow(&ret_info->type, retval_ptr, ref, 1, 0))) { + if (UNEXPECTED(!zend_check_type_slow(&ret_info->type, retval_ptr, 0, ref, 1, 0))) { zend_verify_return_error(EX(func), retval_ptr); HANDLE_EXCEPTION(); } @@ -37928,7 +37928,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_UNUSED } SAVE_OPLINE(); - if (UNEXPECTED(!zend_check_type_slow(&ret_info->type, retval_ptr, ref, 1, 0))) { + if (UNEXPECTED(!zend_check_type_slow(&ret_info->type, retval_ptr, 0, ref, 1, 0))) { zend_verify_return_error(EX(func), retval_ptr); HANDLE_EXCEPTION(); } @@ -50689,7 +50689,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_CV_UNU } SAVE_OPLINE(); - if (UNEXPECTED(!zend_check_type_slow(&ret_info->type, retval_ptr, ref, 1, 0))) { + if (UNEXPECTED(!zend_check_type_slow(&ret_info->type, retval_ptr, 0, ref, 1, 0))) { zend_verify_return_error(EX(func), retval_ptr); HANDLE_EXCEPTION(); } diff --git a/ext/calendar/tests/unixtojd_error1.phpt b/ext/calendar/tests/unixtojd_error1.phpt index 6b8fad05ebd83..171d400b99e76 100644 --- a/ext/calendar/tests/unixtojd_error1.phpt +++ b/ext/calendar/tests/unixtojd_error1.phpt @@ -15,7 +15,6 @@ try { } catch (ValueError $ex) { echo $ex->getMessage(), PHP_EOL; } -var_dump(unixtojd(false)) . PHP_EOL; var_dump(unixtojd(null)) . PHP_EOL; var_dump(unixtojd(time())) . PHP_EOL; ?> @@ -23,4 +22,3 @@ var_dump(unixtojd(time())) . PHP_EOL; unixtojd(): Argument #1 ($timestamp) must be greater than or equal to 0 int(%d) int(%d) -int(%d) diff --git a/ext/date/tests/bug33536.phpt b/ext/date/tests/bug33536.phpt index aa5f5ddb38bfe..e41fc7f1e2490 100644 --- a/ext/date/tests/bug33536.phpt +++ b/ext/date/tests/bug33536.phpt @@ -4,10 +4,6 @@ Bug #33456 (strtotime defaults to now even on non time string) --EXPECT-- bool(false) -1970-01-01 -1970-01-01 diff --git a/ext/date/tests/bug44780.phpt b/ext/date/tests/bug44780.phpt index 5c822d48e6add..964c619f9b73f 100644 --- a/ext/date/tests/bug44780.phpt +++ b/ext/date/tests/bug44780.phpt @@ -2,8 +2,8 @@ Bug #44780 (some time zone offsets not recognized by timezone_name_from_abbr) --FILE-- --EXPECT-- string(12) "Asia/Kolkata" diff --git a/ext/date/tests/date_sun_info_003.phpt b/ext/date/tests/date_sun_info_003.phpt index 7e74bab621e41..e3cdc93823f2f 100644 --- a/ext/date/tests/date_sun_info_003.phpt +++ b/ext/date/tests/date_sun_info_003.phpt @@ -5,38 +5,43 @@ edgarsandi - --FILE-- $elem ) { - echo "$key: " . date("H:i:s", $elem) . "\n"; + +function print_sun_info(string $date) { + echo $date, "\n"; + $sun_info = date_sun_info(strtotime($date), 89.00, 1.00); + foreach ($sun_info as $key => $elem ) { + echo "$key: " . match ($elem) { + true => 'always', + false => 'never', + default => date("H:i:s", $elem), + } . "\n"; + } } +print_sun_info("2015-01-12 00:00:00 UTC"); echo "\n"; +print_sun_info("2015-09-12 00:00:00 UTC"); -$sun_info = date_sun_info(strtotime("2015-09-12 00:00:00 UTC"), 89.00, 1.00); -foreach ($sun_info as $key => $elem ) { - echo "$key: " . date("H:i:s", $elem) . "\n"; -} - -echo "Done\n"; ?> --EXPECT-- -sunrise: 21:00:00 -sunset: 21:00:00 +2015-01-12 00:00:00 UTC +sunrise: never +sunset: never transit: 10:03:48 -civil_twilight_begin: 21:00:00 -civil_twilight_end: 21:00:00 -nautical_twilight_begin: 21:00:00 -nautical_twilight_end: 21:00:00 -astronomical_twilight_begin: 21:00:00 -astronomical_twilight_end: 21:00:00 +civil_twilight_begin: never +civil_twilight_end: never +nautical_twilight_begin: never +nautical_twilight_end: never +astronomical_twilight_begin: never +astronomical_twilight_end: never -sunrise: 21:00:01 -sunset: 21:00:01 +2015-09-12 00:00:00 UTC +sunrise: always +sunset: always transit: 08:52:44 -civil_twilight_begin: 21:00:01 -civil_twilight_end: 21:00:01 -nautical_twilight_begin: 21:00:01 -nautical_twilight_end: 21:00:01 -astronomical_twilight_begin: 21:00:01 -astronomical_twilight_end: 21:00:01 -Done +civil_twilight_begin: always +civil_twilight_end: always +nautical_twilight_begin: always +nautical_twilight_end: always +astronomical_twilight_begin: always +astronomical_twilight_end: always diff --git a/ext/filter/tests/057.phpt b/ext/filter/tests/057.phpt deleted file mode 100644 index ec8083e2f891d..0000000000000 --- a/ext/filter/tests/057.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -filter_input_array() and filter_var_array() with invalid $definition arguments ---EXTENSIONS-- -filter ---FILE-- -getMessage() . "\n"; - } - - try { - var_dump(filter_var_array(array(), $invalid)); - } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; - } -} -?> ---EXPECTF-- -Deprecated: filter_input_array(): Passing null to parameter #2 ($options) of type array|int is deprecated in %s on line %d - -Warning: filter_input_array(): Unknown filter with ID 0 in %s on line %d -bool(false) - -Deprecated: filter_var_array(): Passing null to parameter #2 ($options) of type array|int is deprecated in %s on line %d - -Warning: filter_var_array(): Unknown filter with ID 0 in %s on line %d -bool(false) - -Warning: filter_input_array(): Unknown filter with ID 1 in %s on line %d -bool(false) - -Warning: filter_var_array(): Unknown filter with ID 1 in %s on line %d -bool(false) - -Warning: filter_input_array(): Unknown filter with ID 0 in %s on line %d -bool(false) - -Warning: filter_var_array(): Unknown filter with ID 0 in %s on line %d -bool(false) - -Warning: filter_input_array(): Unknown filter with ID 1 in %s on line %d -bool(false) - -Warning: filter_var_array(): Unknown filter with ID 1 in %s on line %d -bool(false) -filter_input_array(): Argument #2 ($options) must be of type array|int, string given -filter_var_array(): Argument #2 ($options) must be of type array|int, string given -filter_input_array(): Argument #2 ($options) must be of type array|int, stdClass given -filter_var_array(): Argument #2 ($options) must be of type array|int, stdClass given diff --git a/ext/json/tests/001.phpt b/ext/json/tests/001.phpt index 12ff6c15ef58a..bef1734267be9 100644 --- a/ext/json/tests/001.phpt +++ b/ext/json/tests/001.phpt @@ -4,10 +4,10 @@ json_decode() tests ")); var_dump(json_decode(";")); var_dump(json_decode("руссиш")); diff --git a/ext/json/tests/bug69187.phpt b/ext/json/tests/bug69187.phpt index 4d076c4b50b17..66b5b642f4763 100644 --- a/ext/json/tests/bug69187.phpt +++ b/ext/json/tests/bug69187.phpt @@ -2,7 +2,6 @@ Bug #69187 json_last_error return BC in PHP7 --FILE-- --EXPECT-- -NULL -int(4) +int(0) NULL int(4) int(0) int(0) int(1) int(0) -int(1) int(0) int(5) int(3) diff --git a/ext/mbstring/tests/bug43994.phpt b/ext/mbstring/tests/bug43994.phpt index 26f641f6d3d7e..b4ae29ff40e7f 100644 --- a/ext/mbstring/tests/bug43994.phpt +++ b/ext/mbstring/tests/bug43994.phpt @@ -14,55 +14,24 @@ function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build * pattern is supplied to mb_ereg. Similar error message to ereg(). */ -$inputs = array(false, FALSE, "", ''); +$input = ''; +echo "Without \$regs arg:\n"; +try { + var_dump( mb_ereg($input, 'hello, world') ); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} -$iterator = 1; -foreach($inputs as $input) { - if(@is_array($mb_regs)){ - $mb_regs = ''; - } - echo "\n-- Iteration $iterator --\n"; - echo "Without \$regs arg:\n"; - try { - var_dump( mb_ereg($input, 'hello, world') ); - } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; - } +echo "With \$regs arg:\n"; +try { + var_dump(mb_ereg($input, 'hello, world', $mb_regs)); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} - echo "With \$regs arg:\n"; - try { - var_dump(mb_ereg($input, 'hello, world', $mb_regs)); - } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; - } - - var_dump($mb_regs); - $iterator++; -}; +var_dump($mb_regs); ?> --EXPECT-- --- Iteration 1 -- -Without $regs arg: -mb_ereg(): Argument #1 ($pattern) must not be empty -With $regs arg: -mb_ereg(): Argument #1 ($pattern) must not be empty -NULL - --- Iteration 2 -- -Without $regs arg: -mb_ereg(): Argument #1 ($pattern) must not be empty -With $regs arg: -mb_ereg(): Argument #1 ($pattern) must not be empty -NULL - --- Iteration 3 -- -Without $regs arg: -mb_ereg(): Argument #1 ($pattern) must not be empty -With $regs arg: -mb_ereg(): Argument #1 ($pattern) must not be empty -NULL - --- Iteration 4 -- Without $regs arg: mb_ereg(): Argument #1 ($pattern) must not be empty With $regs arg: diff --git a/ext/mbstring/tests/bug43998.phpt b/ext/mbstring/tests/bug43998.phpt index 112ab88728341..5be1bd2cc9ffd 100644 --- a/ext/mbstring/tests/bug43998.phpt +++ b/ext/mbstring/tests/bug43998.phpt @@ -11,41 +11,19 @@ mbstring $sourcestring = 'Hello, World'; -$inputs = array(12345, 12.3456789000E-10, true, false, ""); -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - try { - var_dump( mb_strtolower($sourcestring, $input) ); - } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; - } - try { - var_dump( mb_strtoupper($sourcestring, $input) ); - } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; - } - $iterator++; +$input = ""; +try { + var_dump( mb_strtolower($sourcestring, $input) ); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} +try { + var_dump( mb_strtoupper($sourcestring, $input) ); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; } ?> --EXPECT-- --- Iteration 1 -- -mb_strtolower(): Argument #2 ($encoding) must be a valid encoding, "12345" given -mb_strtoupper(): Argument #2 ($encoding) must be a valid encoding, "12345" given - --- Iteration 2 -- -mb_strtolower(): Argument #2 ($encoding) must be a valid encoding, "1.23456789E-9" given -mb_strtoupper(): Argument #2 ($encoding) must be a valid encoding, "1.23456789E-9" given - --- Iteration 3 -- -mb_strtolower(): Argument #2 ($encoding) must be a valid encoding, "1" given -mb_strtoupper(): Argument #2 ($encoding) must be a valid encoding, "1" given - --- Iteration 4 -- -mb_strtolower(): Argument #2 ($encoding) must be a valid encoding, "" given -mb_strtoupper(): Argument #2 ($encoding) must be a valid encoding, "" given - --- Iteration 5 -- mb_strtolower(): Argument #2 ($encoding) must be a valid encoding, "" given mb_strtoupper(): Argument #2 ($encoding) must be a valid encoding, "" given diff --git a/ext/mbstring/tests/gh16229.phpt b/ext/mbstring/tests/gh16229.phpt index 1fe558d9b1025..6e4924a091a54 100644 --- a/ext/mbstring/tests/gh16229.phpt +++ b/ext/mbstring/tests/gh16229.phpt @@ -14,7 +14,7 @@ if (!function_exists("mb_send_mail") || !mb_language("japanese")) { --FILE-- ---INI-- -error_reporting=E_ALL & ~E_NOTICE +Test mb_ereg_replace() function : usage variations - different input types --EXTENSIONS-- mbstring --SKIPIF-- @@ -17,22 +15,8 @@ $replacement = 'string_val'; $string = 'string_val'; $option = ''; -// get a class -class classA -{ - public function __toString() { - return "UTF-8"; - } -} - -// heredoc string -$heredoc = << 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 10.0e19' => 10.0e19, // Cannot be represented as int - 'float -10.0e19' => -10.0e19, // Cannot be represented as int - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for substchar - -mb_internal_encoding('utf-8'); -foreach($inputs as $key =>$value) { - echo "--$key--\n"; - try { - var_dump( mb_substitute_character($value) ); - } catch (\ValueError|\TypeError $e) { - echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL; - } -} - -fclose($fp); - -?> ---EXPECTF-- -*** Testing mb_substitute_character(): various types in weak typing mode *** ---int 0-- -bool(true) ---int 1-- -bool(true) ---int 12345-- -bool(true) ---int -12345-- -ValueError: mb_substitute_character(): Argument #1 ($substitute_character) is not a valid codepoint ---float 10.5-- - -Deprecated: Implicit conversion from float 10.5 to int loses precision in %s on line %d -bool(true) ---float -10.5-- - -Deprecated: Implicit conversion from float -10.5 to int loses precision in %s on line %d -ValueError: mb_substitute_character(): Argument #1 ($substitute_character) is not a valid codepoint ---float 10.0e19-- -ValueError: mb_substitute_character(): Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint ---float -10.0e19-- -ValueError: mb_substitute_character(): Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint ---float .5-- - -Deprecated: Implicit conversion from float 0.5 to int loses precision in %s on line %d -bool(true) ---empty array-- -TypeError: mb_substitute_character(): Argument #1 ($substitute_character) must be of type string|int|null, array given ---int indexed array-- -TypeError: mb_substitute_character(): Argument #1 ($substitute_character) must be of type string|int|null, array given ---associative array-- -TypeError: mb_substitute_character(): Argument #1 ($substitute_character) must be of type string|int|null, array given ---nested arrays-- -TypeError: mb_substitute_character(): Argument #1 ($substitute_character) must be of type string|int|null, array given ---uppercase NULL-- -int(0) ---lowercase null-- -int(0) ---lowercase true-- -bool(true) ---lowercase false-- -bool(true) ---uppercase TRUE-- -bool(true) ---uppercase FALSE-- -bool(true) ---empty string DQ-- -ValueError: mb_substitute_character(): Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint ---empty string SQ-- -ValueError: mb_substitute_character(): Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint ---string DQ-- -ValueError: mb_substitute_character(): Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint ---string SQ-- -ValueError: mb_substitute_character(): Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint ---mixed case string-- -ValueError: mb_substitute_character(): Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint ---heredoc-- -ValueError: mb_substitute_character(): Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint ---instance of classWithToString-- -ValueError: mb_substitute_character(): Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint ---instance of classWithoutToString-- -TypeError: mb_substitute_character(): Argument #1 ($substitute_character) must be of type string|int|null, classWithoutToString given ---undefined var-- -int(0) ---unset var-- -int(0) diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index b20afffa47df0..f9bef10f977ec 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -1901,7 +1901,7 @@ static bool ZEND_FASTCALL zend_jit_verify_arg_slow(zval *arg, zend_arg_info *arg zend_execute_data *execute_data = EG(current_execute_data); const zend_op *opline = EX(opline); bool ret = zend_check_user_type_slow( - &arg_info->type, arg, /* ref */ NULL, /* is_return_type */ false); + &arg_info->type, arg, opline->op1.num, /* ref */ NULL, /* is_return_type */ false); if (UNEXPECTED(!ret)) { zend_verify_arg_error(EX(func), arg_info, opline->op1.num, arg); return 0; @@ -1918,7 +1918,7 @@ static void ZEND_FASTCALL zend_jit_verify_return_slow(zval *arg, const zend_op_a } } if (UNEXPECTED(!zend_check_user_type_slow( - &arg_info->type, arg, /* ref */ NULL, /* is_return_type */ true))) { + &arg_info->type, arg, /* arg_num */ 0, /* ref */ NULL, /* is_return_type */ true))) { zend_verify_return_error((zend_function*)op_array, arg); } } diff --git a/ext/phar/build_precommand.php b/ext/phar/build_precommand.php index c427ffbd5b12f..57b05faa22e9c 100755 --- a/ext/phar/build_precommand.php +++ b/ext/phar/build_precommand.php @@ -27,7 +27,7 @@ ); foreach($classes as $name) { - echo "if (!class_exists('$name', 0))\n{\n"; + echo "if (!class_exists('$name', false))\n{\n"; $f = file(dirname(__FILE__) . '/phar/' . strtolower($name) . '.inc'); unset($f[0]); $c = count($f); diff --git a/ext/phar/phar/clicommand.inc b/ext/phar/phar/clicommand.inc index 0b84bd6030b4f..9656ce0c8cdb3 100644 --- a/ext/phar/phar/clicommand.inc +++ b/ext/phar/phar/clicommand.inc @@ -40,7 +40,7 @@ abstract class CLICommand if (isset($this->cmds[$command]['arg'])) { $this->args = call_user_func(array($this, $this->cmds[$command]['arg'])); $i = 1; - $missing = false; + $missing = ''; while (++$i < $argc) { if ($argv[$i][0] == '-') { if (strlen($argv[$i]) == 2 && isset($this->args[$argv[$i][1]])) { diff --git a/ext/phar/phar/phar.php b/ext/phar/phar/phar.php index 53aa76f60a0af..49d789809ef80 100755 --- a/ext/phar/phar/phar.php +++ b/ext/phar/phar/phar.php @@ -12,14 +12,14 @@ if (!extension_loaded('phar')) { - if (!class_exists('PHP_Archive', 0)) { + if (!class_exists('PHP_Archive', false)) { echo "Neither Extension Phar nor class PHP_Archive are available.\n"; exit(1); } if (!in_array('phar', stream_get_wrappers())) { stream_wrapper_register('phar', 'PHP_Archive'); } - if (!class_exists('Phar',0)) { + if (!class_exists('Phar', false)) { require 'phar://'.__FILE__.'/phar.inc'; } } diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc index fee6c069ab085..6b943f2eb769e 100644 --- a/ext/phar/phar/pharcommand.inc +++ b/ext/phar/phar/pharcommand.inc @@ -523,7 +523,7 @@ class PharCommand extends CLICommand $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 .= "if (!class_exists('Phar', false)) {\n"; $s .= "\tinclude 'phar://'.__FILE__.'/phar.inc';\n"; $s .= "}\n"; $s .= '?>'; diff --git a/ext/phar/shortarc.php b/ext/phar/shortarc.php index 2d0d37d0dcc56..04065719648be 100644 --- a/ext/phar/shortarc.php +++ b/ext/phar/shortarc.php @@ -2,7 +2,7 @@ $web = '000'; -if (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) { +if (in_array('phar', stream_get_wrappers()) && class_exists('Phar', false)) { Phar::interceptFileFuncs(); set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path()); Phar::webPhar(null, $web); diff --git a/ext/phar/tests/fgc_edgecases.phpt b/ext/phar/tests/fgc_edgecases.phpt index 81a2f43e80a1d..b2655f10ef5f0 100644 --- a/ext/phar/tests/fgc_edgecases.phpt +++ b/ext/phar/tests/fgc_edgecases.phpt @@ -28,18 +28,18 @@ file_put_contents($pname . '/foo/hi', 'getMessage() . "\n"; } echo file_get_contents("fgc_edgecases.txt"); set_include_path("' . addslashes(__DIR__) . '"); echo file_get_contents("fgc_edgecases.txt", true); -echo file_get_contents("./hi", 0, $context); +echo file_get_contents("./hi", false, $context); echo file_get_contents("../oops"); -echo file_get_contents("./hi", 0, $context, 50000); +echo file_get_contents("./hi", false, $context, 50000); echo file_get_contents("./hi"); -echo file_get_contents("./hi", 0, $context, 0, 0); +echo file_get_contents("./hi", false, $context, 0, 0); ?> '); @@ -56,18 +56,18 @@ blah echo file_get_contents("foo/" . basename(__FILE__)); $context = stream_context_create(); try { - file_get_contents("./hi", 0, $context, 0, -1); + file_get_contents("./hi", false, $context, 0, -1); } catch (ValueError $exception) { echo $exception->getMessage() . "\n"; } echo file_get_contents("fgc_edgecases.txt"); set_include_path("%stests"); echo file_get_contents("fgc_edgecases.txt", true); -echo file_get_contents("./hi", 0, $context); +echo file_get_contents("./hi", false, $context); echo file_get_contents("../oops"); -echo file_get_contents("./hi", 0, $context, 50000); +echo file_get_contents("./hi", false, $context, 50000); echo file_get_contents("./hi"); -echo file_get_contents("./hi", 0, $context, 0, 0); +echo file_get_contents("./hi", false, $context, 0, 0); ?> file_get_contents(): Argument #5 ($length) must be greater than or equal to 0 test @@ -76,18 +76,18 @@ test echo file_get_contents("foo/" . basename(__FILE__)); $context = stream_context_create(); try { - file_get_contents("./hi", 0, $context, 0, -1); + file_get_contents("./hi", false, $context, 0, -1); } catch (ValueError $exception) { echo $exception->getMessage() . "\n"; } echo file_get_contents("fgc_edgecases.txt"); set_include_path("%stests"); echo file_get_contents("fgc_edgecases.txt", true); -echo file_get_contents("./hi", 0, $context); +echo file_get_contents("./hi", false, $context); echo file_get_contents("../oops"); -echo file_get_contents("./hi", 0, $context, 50000); +echo file_get_contents("./hi", false, $context, 50000); echo file_get_contents("./hi"); -echo file_get_contents("./hi", 0, $context, 0, 0); +echo file_get_contents("./hi", false, $context, 0, 0); ?> Warning: file_get_contents(phar://%sfgc_edgecases.phar.php/oops): Failed to open stream: phar error: path "oops" is a directory in phar://%sfgc_edgecases.phar.php/foo/hi on line %d @@ -97,16 +97,16 @@ Warning: file_get_contents(): Failed to seek to position 50000 in the stream in echo file_get_contents("foo/" . basename(__FILE__)); $context = stream_context_create(); try { - file_get_contents("./hi", 0, $context, 0, -1); + file_get_contents("./hi", false, $context, 0, -1); } catch (ValueError $exception) { echo $exception->getMessage() . "\n"; } echo file_get_contents("fgc_edgecases.txt"); set_include_path("%stests"); echo file_get_contents("fgc_edgecases.txt", true); -echo file_get_contents("./hi", 0, $context); +echo file_get_contents("./hi", false, $context); echo file_get_contents("../oops"); -echo file_get_contents("./hi", 0, $context, 50000); +echo file_get_contents("./hi", false, $context, 50000); echo file_get_contents("./hi"); -echo file_get_contents("./hi", 0, $context, 0, 0); +echo file_get_contents("./hi", false, $context, 0, 0); ?> diff --git a/ext/phar/tests/mounteddir.phpt b/ext/phar/tests/mounteddir.phpt index 2f6be58eb4d43..77e261c1ed05a 100644 --- a/ext/phar/tests/mounteddir.phpt +++ b/ext/phar/tests/mounteddir.phpt @@ -13,14 +13,14 @@ $pname = 'phar://' . $fname; $a = new Phar($fname); $a['index.php'] = 'getMessage(),"\n"; } diff --git a/ext/phar/tests/phar_buildfromiterator4.phpt b/ext/phar/tests/phar_buildfromiterator4.phpt index e7bccc27c956e..a6aa437496e84 100644 --- a/ext/phar/tests/phar_buildfromiterator4.phpt +++ b/ext/phar/tests/phar_buildfromiterator4.phpt @@ -9,11 +9,7 @@ phar.readonly=0 a = $a; - } + function __construct(public array $a) {} function next(): void { echo "next\n"; next($this->a); @@ -28,7 +24,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return (bool) current($this->a); } function rewind(): void { echo "rewind\n"; diff --git a/ext/phar/tests/phar_buildfromiterator6.phpt b/ext/phar/tests/phar_buildfromiterator6.phpt index 4e4f09f74aa7a..df17032e07052 100644 --- a/ext/phar/tests/phar_buildfromiterator6.phpt +++ b/ext/phar/tests/phar_buildfromiterator6.phpt @@ -9,11 +9,7 @@ phar.readonly=0 a = $a; - } + function __construct(public array $a) {} function next(): void { echo "next\n"; next($this->a); @@ -28,7 +24,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return (bool)current($this->a); } function rewind(): void { echo "rewind\n"; diff --git a/ext/phar/tests/phar_buildfromiterator7.phpt b/ext/phar/tests/phar_buildfromiterator7.phpt index 646bcdac2a5c9..193c46403fbfc 100644 --- a/ext/phar/tests/phar_buildfromiterator7.phpt +++ b/ext/phar/tests/phar_buildfromiterator7.phpt @@ -9,11 +9,7 @@ phar.readonly=0 a = $a; - } + function __construct(public array $a) {} function next(): void { echo "next\n"; next($this->a); @@ -28,7 +24,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return (bool) current($this->a); } function rewind(): void { echo "rewind\n"; diff --git a/ext/phar/tests/readfile_edgecases.phpt b/ext/phar/tests/readfile_edgecases.phpt index c4de84eefe3c0..e11d5278e0006 100644 --- a/ext/phar/tests/readfile_edgecases.phpt +++ b/ext/phar/tests/readfile_edgecases.phpt @@ -22,7 +22,7 @@ $context = stream_context_create(); readfile("readfile_edgecases.txt"); set_include_path("' . addslashes(__DIR__) . '"); readfile("readfile_edgecases.txt", true); -readfile("./hi", 0, $context); +readfile("./hi", false, $context); readfile("../oops"); ?> '); @@ -39,7 +39,7 @@ $context = stream_context_create(); readfile("readfile_edgecases.txt"); set_include_path("%stests"); readfile("readfile_edgecases.txt", true); -readfile("./hi", 0, $context); +readfile("./hi", false, $context); readfile("../oops"); ?> test @@ -50,7 +50,7 @@ $context = stream_context_create(); readfile("readfile_edgecases.txt"); set_include_path("%stests"); readfile("readfile_edgecases.txt", true); -readfile("./hi", 0, $context); +readfile("./hi", false, $context); readfile("../oops"); ?> diff --git a/ext/phar/tests/tar/phar_buildfromiterator4.phpt b/ext/phar/tests/tar/phar_buildfromiterator4.phpt index 8fa55768b082f..4259f4acc8ff0 100644 --- a/ext/phar/tests/tar/phar_buildfromiterator4.phpt +++ b/ext/phar/tests/tar/phar_buildfromiterator4.phpt @@ -9,11 +9,7 @@ phar.readonly=0 a = $a; - } + function __construct(public array $a) {} function next(): void { echo "next\n"; next($this->a); @@ -28,7 +24,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return (bool)current($this->a); } function rewind(): void { echo "rewind\n"; diff --git a/ext/phar/tests/tar/phar_buildfromiterator6.phpt b/ext/phar/tests/tar/phar_buildfromiterator6.phpt index 918203697998f..93cb42b7eedee 100644 --- a/ext/phar/tests/tar/phar_buildfromiterator6.phpt +++ b/ext/phar/tests/tar/phar_buildfromiterator6.phpt @@ -9,11 +9,7 @@ phar.readonly=0 a = $a; - } + function __construct(public array $a) {} function next(): void { echo "next\n"; next($this->a); @@ -28,7 +24,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return (bool)current($this->a); } function rewind(): void { echo "rewind\n"; diff --git a/ext/phar/tests/tar/phar_buildfromiterator7.phpt b/ext/phar/tests/tar/phar_buildfromiterator7.phpt index 297b40b5eedda..200b4f7fe52c8 100644 --- a/ext/phar/tests/tar/phar_buildfromiterator7.phpt +++ b/ext/phar/tests/tar/phar_buildfromiterator7.phpt @@ -9,11 +9,7 @@ phar.readonly=0 a = $a; - } + function __construct(public array $a) {} function next(): void { echo "next\n"; next($this->a); @@ -28,7 +24,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return (bool)current($this->a); } function rewind(): void { echo "rewind\n"; diff --git a/ext/phar/tests/withphar.phpt b/ext/phar/tests/withphar.phpt index 02d05d61e4abc..208912dbb2d87 100644 --- a/ext/phar/tests/withphar.phpt +++ b/ext/phar/tests/withphar.phpt @@ -6,7 +6,8 @@ phar ---EXPECT-- +--EXPECTF-- +Deprecated: class_exists(): Passing int to parameter #2 ($autoload) of type bool is deprecated in %s/files/nophar.phar on line 5 in b a = $a; - } + function __construct(public array $a) {} function next(): void { echo "next\n"; next($this->a); @@ -28,7 +24,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return (bool)current($this->a); } function rewind(): void { echo "rewind\n"; diff --git a/ext/phar/tests/zip/phar_buildfromiterator6.phpt b/ext/phar/tests/zip/phar_buildfromiterator6.phpt index 9d9140bc3433a..ddd21f979b9f4 100644 --- a/ext/phar/tests/zip/phar_buildfromiterator6.phpt +++ b/ext/phar/tests/zip/phar_buildfromiterator6.phpt @@ -9,11 +9,7 @@ phar.readonly=0 a = $a; - } + function __construct(public array $a) {} function next(): void { echo "next\n"; next($this->a); @@ -28,7 +24,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return (bool)current($this->a); } function rewind(): void { echo "rewind\n"; diff --git a/ext/phar/tests/zip/phar_buildfromiterator7.phpt b/ext/phar/tests/zip/phar_buildfromiterator7.phpt index f62be404a1e08..6abf9f02a7b43 100644 --- a/ext/phar/tests/zip/phar_buildfromiterator7.phpt +++ b/ext/phar/tests/zip/phar_buildfromiterator7.phpt @@ -9,11 +9,7 @@ phar.readonly=0 a = $a; - } + function __construct(public array $a) {} function next(): void { echo "next\n"; next($this->a); @@ -28,7 +24,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return (bool)current($this->a); } function rewind(): void { echo "rewind\n"; diff --git a/ext/reflection/tests/005.phpt b/ext/reflection/tests/005.phpt index 58411f98c847c..b6ffe6af8a5ba 100644 --- a/ext/reflection/tests/005.phpt +++ b/ext/reflection/tests/005.phpt @@ -7,7 +7,7 @@ opcache.save_comments=1 function strip_doc_comment($c) { - if (!strlen($c) || $c === false) return $c; + if ($c === false || !strlen($c)) return $c; return trim(substr($c, 3, -2)); } diff --git a/ext/reflection/tests/ReflectionClass_constructor_002.phpt b/ext/reflection/tests/ReflectionClass_constructor_002.phpt index adb3784347374..80d6b249814d5 100644 --- a/ext/reflection/tests/ReflectionClass_constructor_002.phpt +++ b/ext/reflection/tests/ReflectionClass_constructor_002.phpt @@ -2,23 +2,6 @@ ReflectionClass::__constructor() - bad arguments --FILE-- getMessage() . "\n"; -} - -try { - var_dump(new ReflectionClass(null)); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; -} - -try { - var_dump(new ReflectionClass(true)); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; -} try { var_dump(new ReflectionClass(1)); @@ -26,18 +9,6 @@ try { echo $e->getMessage() . "\n"; } -try { - var_dump(new ReflectionClass(array(1,2,3))); -} catch (TypeError $e) { - echo $e->getMessage() . "\n"; -} - -try { - var_dump(new ReflectionClass("stdClass", 1)); -} catch (TypeError $e) { - echo $e->getMessage() . "\n"; -} - try { var_dump(new ReflectionClass("X")); } catch (Exception $e) { @@ -46,12 +17,5 @@ try { ?> --EXPECTF-- -ReflectionClass::__construct() expects exactly 1 argument, 0 given - -Deprecated: ReflectionClass::__construct(): Passing null to parameter #1 ($objectOrClass) of type object|string is deprecated in %s on line %d -Class "" does not exist -Class "1" does not exist Class "1" does not exist -ReflectionClass::__construct(): Argument #1 ($objectOrClass) must be of type object|string, array given -ReflectionClass::__construct() expects exactly 1 argument, 2 given Class "X" does not exist diff --git a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt deleted file mode 100644 index d143006af9992..0000000000000 --- a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -ReflectionClass::getConstant() - bad params ---FILE-- -getConstant(1)); -var_dump($rc->getConstant(1.5)); -var_dump($rc->getConstant(true)); -?> ---EXPECT-- -Check invalid params: -bool(false) -bool(false) -bool(false) diff --git a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt index 9278b47875448..676174fd6893b 100644 --- a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt @@ -12,17 +12,7 @@ class C { $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; try { - var_dump($rc->getMethod()); -} catch (TypeError $e) { - echo $e->getMessage() . "\n"; -} -try { - var_dump($rc->getMethod("f", "f")); -} catch (TypeError $e) { - echo $e->getMessage() . "\n"; -} -try { - var_dump($rc->getMethod(null)); + var_dump($rc->getMethod('')); } catch (Exception $e) { echo $e->getMessage() . "\n"; } @@ -36,33 +26,10 @@ try { } catch (Exception $e) { echo $e->getMessage() . "\n"; } -try { - var_dump($rc->getMethod(true)); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; -} -try { - var_dump($rc->getMethod(array(1,2,3))); -} catch (TypeError $e) { - echo $e->getMessage() . "\n"; -} -try { - var_dump($rc->getMethod(new C)); -} catch (TypeError $e) { - echo $e->getMessage() . "\n"; -} - ?> --EXPECTF-- Check invalid params: -ReflectionClass::getMethod() expects exactly 1 argument, 0 given -ReflectionClass::getMethod() expects exactly 1 argument, 2 given - -Deprecated: ReflectionClass::getMethod(): Passing null to parameter #1 ($name) of type string is deprecated in %s on line %d Method C::() does not exist Method C::1() does not exist Method C::1.5() does not exist -Method C::1() does not exist -ReflectionClass::getMethod(): Argument #1 ($name) must be of type string, array given -ReflectionClass::getMethod(): Argument #1 ($name) must be of type string, C given diff --git a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt index c2f8419a1ea7f..3700ada5634a1 100644 --- a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt @@ -12,17 +12,7 @@ class C { $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; try { - var_dump($rc->getProperty()); -} catch (TypeError $e) { - echo $e->getMessage() . "\n"; -} -try { - var_dump($rc->getProperty("a", "a")); -} catch (TypeError $e) { - echo $e->getMessage() . "\n"; -} -try { - var_dump($rc->getProperty(null)); + var_dump($rc->getProperty('')); } catch (exception $e) { echo $e->getMessage() . "\n"; } @@ -36,31 +26,9 @@ try { } catch (exception $e) { echo $e->getMessage() . "\n"; } -try { - var_dump($rc->getProperty(true)); -} catch (exception $e) { - echo $e->getMessage() . "\n"; -} -try { - var_dump($rc->getProperty(array(1,2,3))); -} catch (TypeError $e) { - echo $e->getMessage() . "\n"; -} -try { - var_dump($rc->getProperty(new C)); -} catch (TypeError $e) { - echo $e->getMessage() . "\n"; -} ?> --EXPECTF-- Check invalid params: -ReflectionClass::getProperty() expects exactly 1 argument, 0 given -ReflectionClass::getProperty() expects exactly 1 argument, 2 given - -Deprecated: ReflectionClass::getProperty(): Passing null to parameter #1 ($name) of type string is deprecated in %s on line %d Property C::$ does not exist Property C::$1 does not exist Property C::$1.5 does not exist -Property C::$1 does not exist -ReflectionClass::getProperty(): Argument #1 ($name) must be of type string, array given -ReflectionClass::getProperty(): Argument #1 ($name) must be of type string, C given diff --git a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt deleted file mode 100644 index 4e4c206ac23ee..0000000000000 --- a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -ReflectionClass::hasConstant() - error cases ---CREDITS-- -Robin Fernandes -Steve Seear ---FILE-- -hasConstant(1)); -var_dump($rc->hasConstant(1.5)); -var_dump($rc->hasConstant(true)); -?> ---EXPECT-- -Check invalid params: -bool(false) -bool(false) -bool(false) diff --git a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt deleted file mode 100644 index 5e175fbb7e5da..0000000000000 --- a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -ReflectionClass::hasMethod() - error cases ---CREDITS-- -Robin Fernandes -Steve Seear ---FILE-- -hasMethod(1)); -var_dump($rc->hasMethod(1.5)); -var_dump($rc->hasMethod(true)); -?> ---EXPECT-- -Check invalid params: -bool(false) -bool(false) -bool(false) diff --git a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt deleted file mode 100644 index 14b4520e07ef0..0000000000000 --- a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -ReflectionClass::hasProperty() - error cases ---CREDITS-- -Robin Fernandes -Steve Seear ---FILE-- -hasProperty(1)); -var_dump($rc->hasProperty(1.5)); -var_dump($rc->hasProperty(true)); -?> ---EXPECT-- -Check invalid params: -bool(false) -bool(false) -bool(false) diff --git a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt index 9a1e340d83a33..8af2e3f191a2d 100644 --- a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt +++ b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt @@ -16,50 +16,50 @@ class TestClass try { echo "\nWrong type of argument (bool):\n"; $methodInfo = new ReflectionMethod(true); -} catch (Exception $e) { - print $e->__toString(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { echo "\nWrong type of argument (int):\n"; $methodInfo = new ReflectionMethod(3); -} catch (Exception $e) { - print $e->__toString(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { echo "\nWrong type of argument (bool, string):\n"; $methodInfo = new ReflectionMethod(true, "foo"); -} catch (Exception $e) { - print $e->__toString(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { echo "\nWrong type of argument (string, bool):\n"; $methodInfo = new ReflectionMethod('TestClass', true); -} catch (Exception $e) { - print $e->__toString(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { echo "\nNo method given:\n"; $methodInfo = new ReflectionMethod("TestClass"); -} catch (Exception $e) { - print $e->__toString(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { echo "\nClass and Method in same string, bad method name:\n"; $methodInfo = new ReflectionMethod("TestClass::foop::dedoop"); -} catch (Exception $e) { - print $e->__toString(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { echo "\nClass and Method in same string, bad class name:\n"; $methodInfo = new ReflectionMethod("TestCla::foo"); -} catch (Exception $e) { - print $e->__toString(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { echo "\nClass and Method in same string (ok):\n"; $methodInfo = new ReflectionMethod("TestClass::foo"); -} catch (Exception $e) { - print $e->__toString(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> @@ -67,48 +67,40 @@ try { Wrong type of argument (bool): Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d -ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name in %s:%d -Stack trace: -#0 %s ReflectionMethod->__construct('1') -#1 {main} + +Deprecated: ReflectionMethod::__construct(): Passing bool to parameter #1 ($objectOrMethod) of type object|string is deprecated in %s on line %d +ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name + Wrong type of argument (int): Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d -ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name in %s:%d -Stack trace: -#0 %s ReflectionMethod->__construct('3') -#1 {main} +ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name + Wrong type of argument (bool, string): -ReflectionException: Class "1" does not exist in %s:%d -Stack trace: -#0 %s ReflectionMethod->__construct('1', 'foo') -#1 {main} + +Deprecated: ReflectionMethod::__construct(): Passing bool to parameter #1 ($objectOrMethod) of type object|string is deprecated in %s on line %d +ReflectionException: Class "1" does not exist + Wrong type of argument (string, bool): -ReflectionException: Method TestClass::1() does not exist in %s:%d -Stack trace: -#0 %s ReflectionMethod->__construct('TestClass', '1') -#1 {main} + +Deprecated: ReflectionMethod::__construct(): Passing bool to parameter #2 ($method) of type ?string is deprecated in %s on line %d +ReflectionException: Method TestClass::1() does not exist + No method given: Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d -ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name in %s:%d -Stack trace: -#0 %s ReflectionMethod->__construct('TestClass') -#1 {main} +ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name + Class and Method in same string, bad method name: Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d -ReflectionException: Method TestClass::foop::dedoop() does not exist in %s:%d -Stack trace: -#0 %s ReflectionMethod->__construct('TestClass::foop...') -#1 {main} +ReflectionException: Method TestClass::foop::dedoop() does not exist + Class and Method in same string, bad class name: Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d -ReflectionException: Class "TestCla" does not exist in %s:%d -Stack trace: -#0 %s ReflectionMethod->__construct('TestCla::foo') -#1 {main} +ReflectionException: Class "TestCla" does not exist + Class and Method in same string (ok): Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d diff --git a/ext/reflection/tests/bug51905.phpt b/ext/reflection/tests/bug51905.phpt index 2d956386a55b4..3dec9eda291f1 100644 --- a/ext/reflection/tests/bug51905.phpt +++ b/ext/reflection/tests/bug51905.phpt @@ -16,7 +16,7 @@ $clazz = new ReflectionClass('Foo'); $method = $clazz->getMethod('x'); foreach ($method->getParameters() as $param) { if ( $param->isDefaultValueAvailable()) - echo '$', $param->getName(), ' : ', var_export($param->getDefaultValue(), 1), "\n"; + echo '$', $param->getName(), ' : ', var_export($param->getDefaultValue(), true), "\n"; } ?> diff --git a/ext/reflection/tests/bug51911.phpt b/ext/reflection/tests/bug51911.phpt index 12eb459fbc2d0..cef41c96aa545 100644 --- a/ext/reflection/tests/bug51911.phpt +++ b/ext/reflection/tests/bug51911.phpt @@ -12,7 +12,7 @@ $clazz = new ReflectionClass('Foo'); $method = $clazz->getMethod('x'); foreach ($method->getParameters() as $param) { if ( $param->isDefaultValueAvailable()) - echo '$', $param->getName(), ' : ', var_export($param->getDefaultValue(), 1), "\n"; + echo '$', $param->getName(), ' : ', var_export($param->getDefaultValue(), true), "\n"; } ?> diff --git a/ext/reflection/tests/bug64936.phpt b/ext/reflection/tests/bug64936.phpt index 537876d1c60cb..b96b186fcf46b 100644 --- a/ext/reflection/tests/bug64936.phpt +++ b/ext/reflection/tests/bug64936.phpt @@ -9,7 +9,7 @@ opcache.save_comments=1 function strip_doc_comment($c) { - if (!strlen($c) || $c === false) return $c; + if ($c === false || !strlen($c)) return $c; return trim(substr($c, 3, -2)); } diff --git a/ext/standard/tests/array/array_column_scalar_index_weak_types.phpt b/ext/standard/tests/array/array_column_scalar_index_weak_types.phpt deleted file mode 100644 index 42ca676ebfcac..0000000000000 --- a/ext/standard/tests/array/array_column_scalar_index_weak_types.phpt +++ /dev/null @@ -1,81 +0,0 @@ ---TEST-- -Test array_column(): Index argument with various types in weak type mode ---FILE-- -getMessage() . "\n"; -} -try { - var_dump(array_column([['php7', 'foo'], ['php8', 'bar']], true)); -} catch (\TypeError $e) { - echo $e->getMessage() . "\n"; -} - -echo "\n-- Testing array_column() column key parameter should be a string or integer (testing array) --\n"; -try { - var_dump(array_column([['php7', 'foo'], ['php8', 'bar']], array())); -} catch (\TypeError $e) { - echo $e->getMessage() . "\n"; -} - -echo "\n-- Testing array_column() index key parameter should be a string or an integer (testing bool) --\n"; -try { - var_dump(array_column([['php' => 7, 'foo'], ['php' => 8, 'bar']], 'php', false)); -} catch (\TypeError $e) { - echo $e->getMessage() . "\n"; -} -try { - var_dump(array_column([['php' => 7, 'foo'], ['php' => 8, 'bar']], 'php', true)); -} catch (\TypeError $e) { - echo $e->getMessage() . "\n"; -} - -echo "\n-- Testing array_column() index key parameter should be a string or integer (testing array) --\n"; -try { - var_dump(array_column([['php' => 7, 'foo'], ['php' => 8, 'bar']], 'php', array())); -} catch (\TypeError $e) { - echo $e->getMessage() . "\n"; -} - -?> - -DONE ---EXPECT-- --- Testing array_column() column key parameter should be a string or an integer (testing bool) -- -array(2) { - [0]=> - string(4) "php7" - [1]=> - string(4) "php8" -} -array(2) { - [0]=> - string(3) "foo" - [1]=> - string(3) "bar" -} - --- Testing array_column() column key parameter should be a string or integer (testing array) -- -array_column(): Argument #2 ($column_key) must be of type string|int|null, array given - --- Testing array_column() index key parameter should be a string or an integer (testing bool) -- -array(2) { - ["foo"]=> - int(7) - ["bar"]=> - int(8) -} -array(2) { - [0]=> - int(7) - [1]=> - int(8) -} - --- Testing array_column() index key parameter should be a string or integer (testing array) -- -array_column(): Argument #3 ($index_key) must be of type string|int|null, array given - -DONE diff --git a/ext/standard/tests/array/array_filter_variation10.phpt b/ext/standard/tests/array/array_filter_variation10.phpt index eef7b64620336..3875617ab4356 100644 --- a/ext/standard/tests/array/array_filter_variation10.phpt +++ b/ext/standard/tests/array/array_filter_variation10.phpt @@ -16,7 +16,7 @@ function dump($value, $key) echo "$key = $value\n"; } -var_dump( array_filter($input, 'dump', true) ); +var_dump( array_filter($input, 'dump', ARRAY_FILTER_USE_BOTH) ); echo "*** Testing array_filter() : usage variations - 'callback' filters based on key value ***\n"; @@ -25,12 +25,12 @@ function dump2($value, $key) return $key > 4; } -var_dump( array_filter($input, 'dump2', true) ); +var_dump( array_filter($input, 'dump2', ARRAY_FILTER_USE_BOTH) ); 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', 0) ); } catch (Throwable $e) { echo "Exception: " . $e->getMessage() . "\n"; } diff --git a/ext/standard/tests/array/array_slice_variation1.phpt b/ext/standard/tests/array/array_slice_variation1.phpt index b1d80d3f52295..d23a7e522af6c 100644 --- a/ext/standard/tests/array/array_slice_variation1.phpt +++ b/ext/standard/tests/array/array_slice_variation1.phpt @@ -3,29 +3,15 @@ Test array_slice() - Third parameter (NULL vs 0) --FILE-- getMessage(), "\n"; -} -try { - var_dump(array_slice(range(1, 3), 0, $a)); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; -} -var_dump($a); +var_dump(array_slice(range(1, 3), -1, NULL, true)); ?> --EXPECT-- @@ -61,6 +47,3 @@ array(1) { [2]=> int(3) } -array_slice(): Argument #3 ($length) must be of type ?int, string given -array_slice(): Argument #3 ($length) must be of type ?int, string given -string(3) "foo" diff --git a/ext/standard/tests/array/count_invalid_mode.phpt b/ext/standard/tests/array/count_invalid_mode.phpt index be39690e856b2..b4b4d549ec24f 100644 --- a/ext/standard/tests/array/count_invalid_mode.phpt +++ b/ext/standard/tests/array/count_invalid_mode.phpt @@ -10,8 +10,6 @@ $modes = [ 1, -1, 2, - TRUE, - FALSE, ]; foreach ($modes as $mode) { @@ -29,5 +27,3 @@ int(0) int(0) count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE -int(0) -int(0) diff --git a/ext/standard/tests/file/005_variation2.phpt b/ext/standard/tests/file/005_variation2.phpt index 270a6cfbdd84c..89e693332e690 100644 --- a/ext/standard/tests/file/005_variation2.phpt +++ b/ext/standard/tests/file/005_variation2.phpt @@ -33,19 +33,15 @@ $dir = __DIR__ . '/005_variation2'; mkdir($dir); chdir($dir); -$b = touch(false); $c = touch(''); $d = touch(' '); $e = touch('|'); -var_dump($a); -var_dump($b); var_dump($c); var_dump($d); var_dump($e); echo "\n*** testing file info ***"; -stat_fn(false); stat_fn(''); stat_fn(' '); stat_fn('|'); @@ -60,10 +56,6 @@ echo "Done"; *** Testing fileattime(), filemtime(), filectime() & touch() : usage variations *** *** testing touch *** - -Warning: Undefined variable $a in %s on line %d -NULL -bool(false) bool(false) bool(true) bool(true) @@ -74,11 +66,6 @@ bool(true) -- File modification time is => -- inode change time is => --- File '' -- --- File access time is => --- File modification time is => --- inode change time is => - -- File ' ' -- -- File access time is => %d -- File modification time is => %d diff --git a/ext/standard/tests/file/file_exists_variation1.phpt b/ext/standard/tests/file/file_exists_variation1.phpt index 446e7fac16a06..01cd63a353b63 100644 --- a/ext/standard/tests/file/file_exists_variation1.phpt +++ b/ext/standard/tests/file/file_exists_variation1.phpt @@ -6,7 +6,6 @@ Dave Kelsey diff --git a/ext/standard/tests/file/file_get_contents_variation8.phpt b/ext/standard/tests/file/file_get_contents_variation8.phpt index d6edef55db612..ccffaa3cdb4c7 100644 --- a/ext/standard/tests/file/file_get_contents_variation8.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8.phpt @@ -14,28 +14,22 @@ obscure_filename getMessage(), "\n"; + var_dump(file_get_contents($name)); + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -43,31 +37,17 @@ echo "\n*** Done ***\n"; ?> --EXPECTF-- *** Testing file_get_contents() : variation *** --- Iteration 0 -- Warning: file_get_contents(-1): Failed to open stream: No such file or directory in %s on line %d bool(false) --- Iteration 1 -- - -Warning: file_get_contents(1): Failed to open stream: No such file or directory in %s on line %d -bool(false) --- Iteration 2 -- -ValueError: Path must not be empty --- Iteration 3 -- ValueError: Path must not be empty --- Iteration 4 -- Warning: file_get_contents( ): Failed to open stream: No such file or directory in %s on line %d bool(false) --- Iteration 5 -- ValueError: file_get_contents(): Argument #1 ($filename) must not contain any null bytes --- Iteration 6 -- -TypeError: file_get_contents(): Argument #1 ($filename) must be of type string, array given --- Iteration 7 -- Warning: file_get_contents(/no/such/file/dir): Failed to open stream: No such file or directory in %s on line %d bool(false) --- Iteration 8 -- Warning: file_get_contents(php/php): Failed to open stream: No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/file_put_contents_variation8.phpt b/ext/standard/tests/file/file_put_contents_variation8.phpt index 81bbd25168801..7e1a7cbce3d14 100644 --- a/ext/standard/tests/file/file_put_contents_variation8.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8.phpt @@ -18,34 +18,28 @@ mkdir($dir); chdir($dir); /* An array of filenames */ -$names_arr = array( - -1, - TRUE, - FALSE, +$names = [ + /* Invalid args */ + '-1', "", " ", - //this one also generates a java message rather than our own so we don't replicate php message "\0", - array(), - - //the next 2 generate java messages so we don't replicate the php messages + /* prefix with path separator of a non existing directory*/ "/no/such/file/dir", - "php/php" - -); + "php/php", +]; -for( $i=0; $igetMessage(), "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -59,25 +53,13 @@ rmdir($dir); ?> --EXPECTF-- *** Testing file_put_contents() : usage variation *** --- Iteration 0 -- 9 bytes written to: '-1' --- Iteration 1 -- -9 bytes written to: '1' --- Iteration 2 -- -ValueError: Path must not be empty --- Iteration 3 -- ValueError: Path must not be empty --- Iteration 4 -- 9 bytes written to: ' ' --- Iteration 5 -- ValueError: file_put_contents(): Argument #1 ($filename) must not contain any null bytes --- Iteration 6 -- -TypeError: file_put_contents(): Argument #1 ($filename) must be of type string, array given --- Iteration 7 -- Warning: file_put_contents(%sdir): Failed to open stream: %s in %s on line %d Failed to write data to: '%sir' --- Iteration 8 -- Warning: file_put_contents(%sphp): Failed to open stream: %s in %s on line %d Failed to write data to: '%sphp' diff --git a/ext/standard/tests/file/filegroup_variation2.phpt b/ext/standard/tests/file/filegroup_variation2.phpt index eeff71fa61ba2..fb3d41e49dbe4 100644 --- a/ext/standard/tests/file/filegroup_variation2.phpt +++ b/ext/standard/tests/file/filegroup_variation2.phpt @@ -11,18 +11,16 @@ obscure_filename $file_path = __DIR__; echo "*** Testing Invalid file types ***\n"; -$filenames = array( +$filenames = [ /* Invalid filenames */ -2.34555, " ", "", - TRUE, - FALSE, - /* scalars */ 1234, - 0 -); + 0, + 1, +]; /* loop through to test each element the above array */ foreach( $filenames as $filename ) { @@ -40,12 +38,11 @@ Warning: filegroup(): stat failed for in %s on line %d bool(false) bool(false) -Warning: filegroup(): stat failed for 1 in %s on line %d -bool(false) -bool(false) - Warning: filegroup(): stat failed for 1234 in %s on line %d bool(false) Warning: filegroup(): stat failed for 0 in %s on line %d bool(false) + +Warning: filegroup(): stat failed for 1 in %s on line %d +bool(false) diff --git a/ext/standard/tests/file/fileinode_variation2.phpt b/ext/standard/tests/file/fileinode_variation2.phpt index c6c26eab8b28a..7678f8fa6fb4e 100644 --- a/ext/standard/tests/file/fileinode_variation2.phpt +++ b/ext/standard/tests/file/fileinode_variation2.phpt @@ -11,18 +11,16 @@ obscure_filename $file_path = __DIR__; echo "*** Testing Invalid file types ***\n"; -$filenames = array( +$filenames = [ /* Invalid filenames */ -2.34555, " ", "", - TRUE, - FALSE, - /* scalars */ 1234, - 0 -); + 0, + 1, +]; /* loop through to test each element the above array */ foreach( $filenames as $filename ) { @@ -40,12 +38,11 @@ Warning: fileinode(): stat failed for in %s on line %d bool(false) bool(false) -Warning: fileinode(): stat failed for 1 in %s on line %d -bool(false) -bool(false) - Warning: fileinode(): stat failed for 1234 in %s on line %d bool(false) Warning: fileinode(): stat failed for 0 in %s on line %d bool(false) + +Warning: fileinode(): stat failed for 1 in %s on line %d +bool(false) diff --git a/ext/standard/tests/file/fileowner_variation2.phpt b/ext/standard/tests/file/fileowner_variation2.phpt index c5ab2042cda42..e90810fc5ede1 100644 --- a/ext/standard/tests/file/fileowner_variation2.phpt +++ b/ext/standard/tests/file/fileowner_variation2.phpt @@ -12,18 +12,16 @@ obscure_filename $file_path = __DIR__; echo "*** Testing Invalid file types ***\n"; -$filenames = array( +$filenames = [ /* Invalid filenames */ -2.34555, " ", "", - TRUE, - FALSE, - /* scalars */ 1234, - 0 -); + 0, + 1, +]; /* loop through to test each element the above array */ foreach( $filenames as $filename ) { @@ -41,12 +39,11 @@ Warning: fileowner(): stat failed for in %s on line %d bool(false) bool(false) -Warning: fileowner(): stat failed for 1 in %s on line %d -bool(false) -bool(false) - Warning: fileowner(): stat failed for 1234 in %s on line %d bool(false) Warning: fileowner(): stat failed for 0 in %s on line %d bool(false) + +Warning: fileowner(): stat failed for 1 in %s on line %d +bool(false) diff --git a/ext/standard/tests/file/fileperms_variation2.phpt b/ext/standard/tests/file/fileperms_variation2.phpt index b1c9695d47ea0..bd5fc75dd3109 100644 --- a/ext/standard/tests/file/fileperms_variation2.phpt +++ b/ext/standard/tests/file/fileperms_variation2.phpt @@ -11,18 +11,16 @@ obscure_filename $file_path = __DIR__; echo "*** Testing Invalid file types ***\n"; -$filenames = array( +$filenames = [ /* Invalid filenames */ -2.34555, " ", "", - TRUE, - FALSE, - /* scalars */ 1234, - 0 -); + 0, + 1, +]; /* loop through to test each element the above array */ foreach( $filenames as $filename ) { @@ -40,12 +38,11 @@ Warning: fileperms(): stat failed for in %s on line %d bool(false) bool(false) -Warning: fileperms(): stat failed for 1 in %s on line %d -bool(false) -bool(false) - Warning: fileperms(): stat failed for 1234 in %s on line %d bool(false) Warning: fileperms(): stat failed for 0 in %s on line %d bool(false) + +Warning: fileperms(): stat failed for 1 in %s on line %d +bool(false) diff --git a/ext/standard/tests/file/filesize_variation5.phpt b/ext/standard/tests/file/filesize_variation5.phpt index 7da6e73e06139..c94840a7f9e0c 100644 --- a/ext/standard/tests/file/filesize_variation5.phpt +++ b/ext/standard/tests/file/filesize_variation5.phpt @@ -6,8 +6,6 @@ Dave Kelsey getMessage() . \PHP_EOL; } - $i++; } @@ -54,20 +45,6 @@ unlink($file); ?> --EXPECT-- *** Testing error conditions *** ---- Iteration 0 --- flock(): Argument #2 ($operation) must be one of LOCK_SH, LOCK_EX, or LOCK_UN ---- Iteration 1 --- flock(): Argument #2 ($operation) must be one of LOCK_SH, LOCK_EX, or LOCK_UN ---- Iteration 2 --- -flock(): Argument #2 ($operation) must be one of LOCK_SH, LOCK_EX, or LOCK_UN ---- Iteration 3 --- -flock(): Argument #2 ($operation) must be of type int, array given ---- Iteration 4 --- -flock(): Argument #2 ($operation) must be of type int, array given ---- Iteration 5 --- -flock(): Argument #2 ($operation) must be of type int, string given ---- Iteration 6 --- -flock(): Argument #2 ($operation) must be of type int, string given ---- Iteration 7 --- -flock(): Argument #2 ($operation) must be of type int, string given flock(): Argument #1 ($stream) must be an open stream resource diff --git a/ext/standard/tests/file/flock_variation.phpt b/ext/standard/tests/file/flock_variation.phpt index 1d73e90d254d4..736a81946fdef 100644 --- a/ext/standard/tests/file/flock_variation.phpt +++ b/ext/standard/tests/file/flock_variation.phpt @@ -9,7 +9,7 @@ $file = preg_replace("~\.phpt?$~", '', __FILE__); $fp = fopen($file, "w"); /* array of operations */ -$operations = array( +$operations = [ LOCK_SH, LOCK_EX, LOCK_SH|LOCK_NB, @@ -18,38 +18,12 @@ $operations = array( LOCK_UN, 1, 2, - TRUE -); - -/* array of wouldblocks */ -$wouldblocks = array( - 0, - 1, - 2, - 1.234, - TRUE, - FALSE, - NULL, - array(1,2,3), - array(), - "string", - "", - /* binary input */ - b"string", - b"", - "\0" -); +]; $i = 0; foreach($operations as $operation) { echo "--- Outer iteration $i ---\n"; - var_dump(flock($fp, $operation)); - $j = 0; - foreach($wouldblocks as $wouldblock) { - echo "-- Inner iteration $j in $i --\n"; - var_dump(flock($fp, $operation, $wouldblock)); - $j++; - } + var_dump(flock($fp, $operation, $wouldblock)); $i++; } @@ -63,273 +37,19 @@ echo "\n*** Done ***\n"; wouldblock values *** --- Outer iteration 0 --- bool(true) --- Inner iteration 0 in 0 -- -bool(true) --- Inner iteration 1 in 0 -- -bool(true) --- Inner iteration 2 in 0 -- -bool(true) --- Inner iteration 3 in 0 -- -bool(true) --- Inner iteration 4 in 0 -- -bool(true) --- Inner iteration 5 in 0 -- -bool(true) --- Inner iteration 6 in 0 -- -bool(true) --- Inner iteration 7 in 0 -- -bool(true) --- Inner iteration 8 in 0 -- -bool(true) --- Inner iteration 9 in 0 -- -bool(true) --- Inner iteration 10 in 0 -- -bool(true) --- Inner iteration 11 in 0 -- -bool(true) --- Inner iteration 12 in 0 -- -bool(true) --- Inner iteration 13 in 0 -- -bool(true) --- Outer iteration 1 --- bool(true) --- Inner iteration 0 in 1 -- -bool(true) --- Inner iteration 1 in 1 -- -bool(true) --- Inner iteration 2 in 1 -- -bool(true) --- Inner iteration 3 in 1 -- -bool(true) --- Inner iteration 4 in 1 -- -bool(true) --- Inner iteration 5 in 1 -- -bool(true) --- Inner iteration 6 in 1 -- -bool(true) --- Inner iteration 7 in 1 -- -bool(true) --- Inner iteration 8 in 1 -- -bool(true) --- Inner iteration 9 in 1 -- -bool(true) --- Inner iteration 10 in 1 -- -bool(true) --- Inner iteration 11 in 1 -- -bool(true) --- Inner iteration 12 in 1 -- -bool(true) --- Inner iteration 13 in 1 -- -bool(true) --- Outer iteration 2 --- bool(true) --- Inner iteration 0 in 2 -- -bool(true) --- Inner iteration 1 in 2 -- -bool(true) --- Inner iteration 2 in 2 -- -bool(true) --- Inner iteration 3 in 2 -- -bool(true) --- Inner iteration 4 in 2 -- -bool(true) --- Inner iteration 5 in 2 -- -bool(true) --- Inner iteration 6 in 2 -- -bool(true) --- Inner iteration 7 in 2 -- -bool(true) --- Inner iteration 8 in 2 -- -bool(true) --- Inner iteration 9 in 2 -- -bool(true) --- Inner iteration 10 in 2 -- -bool(true) --- Inner iteration 11 in 2 -- -bool(true) --- Inner iteration 12 in 2 -- -bool(true) --- Inner iteration 13 in 2 -- -bool(true) --- Outer iteration 3 --- bool(true) --- Inner iteration 0 in 3 -- -bool(true) --- Inner iteration 1 in 3 -- -bool(true) --- Inner iteration 2 in 3 -- -bool(true) --- Inner iteration 3 in 3 -- -bool(true) --- Inner iteration 4 in 3 -- -bool(true) --- Inner iteration 5 in 3 -- -bool(true) --- Inner iteration 6 in 3 -- -bool(true) --- Inner iteration 7 in 3 -- -bool(true) --- Inner iteration 8 in 3 -- -bool(true) --- Inner iteration 9 in 3 -- -bool(true) --- Inner iteration 10 in 3 -- -bool(true) --- Inner iteration 11 in 3 -- -bool(true) --- Inner iteration 12 in 3 -- -bool(true) --- Inner iteration 13 in 3 -- -bool(true) --- Outer iteration 4 --- bool(true) --- Inner iteration 0 in 4 -- -bool(true) --- Inner iteration 1 in 4 -- -bool(true) --- Inner iteration 2 in 4 -- -bool(true) --- Inner iteration 3 in 4 -- -bool(true) --- Inner iteration 4 in 4 -- -bool(true) --- Inner iteration 5 in 4 -- -bool(true) --- Inner iteration 6 in 4 -- -bool(true) --- Inner iteration 7 in 4 -- -bool(true) --- Inner iteration 8 in 4 -- -bool(true) --- Inner iteration 9 in 4 -- -bool(true) --- Inner iteration 10 in 4 -- -bool(true) --- Inner iteration 11 in 4 -- -bool(true) --- Inner iteration 12 in 4 -- -bool(true) --- Inner iteration 13 in 4 -- -bool(true) --- Outer iteration 5 --- bool(true) --- Inner iteration 0 in 5 -- -bool(true) --- Inner iteration 1 in 5 -- -bool(true) --- Inner iteration 2 in 5 -- -bool(true) --- Inner iteration 3 in 5 -- -bool(true) --- Inner iteration 4 in 5 -- -bool(true) --- Inner iteration 5 in 5 -- -bool(true) --- Inner iteration 6 in 5 -- -bool(true) --- Inner iteration 7 in 5 -- -bool(true) --- Inner iteration 8 in 5 -- -bool(true) --- Inner iteration 9 in 5 -- -bool(true) --- Inner iteration 10 in 5 -- -bool(true) --- Inner iteration 11 in 5 -- -bool(true) --- Inner iteration 12 in 5 -- -bool(true) --- Inner iteration 13 in 5 -- -bool(true) --- Outer iteration 6 --- bool(true) --- Inner iteration 0 in 6 -- -bool(true) --- Inner iteration 1 in 6 -- -bool(true) --- Inner iteration 2 in 6 -- -bool(true) --- Inner iteration 3 in 6 -- -bool(true) --- Inner iteration 4 in 6 -- -bool(true) --- Inner iteration 5 in 6 -- -bool(true) --- Inner iteration 6 in 6 -- -bool(true) --- Inner iteration 7 in 6 -- -bool(true) --- Inner iteration 8 in 6 -- -bool(true) --- Inner iteration 9 in 6 -- -bool(true) --- Inner iteration 10 in 6 -- -bool(true) --- Inner iteration 11 in 6 -- -bool(true) --- Inner iteration 12 in 6 -- -bool(true) --- Inner iteration 13 in 6 -- -bool(true) --- Outer iteration 7 --- bool(true) --- Inner iteration 0 in 7 -- -bool(true) --- Inner iteration 1 in 7 -- -bool(true) --- Inner iteration 2 in 7 -- -bool(true) --- Inner iteration 3 in 7 -- -bool(true) --- Inner iteration 4 in 7 -- -bool(true) --- Inner iteration 5 in 7 -- -bool(true) --- Inner iteration 6 in 7 -- -bool(true) --- Inner iteration 7 in 7 -- -bool(true) --- Inner iteration 8 in 7 -- -bool(true) --- Inner iteration 9 in 7 -- -bool(true) --- Inner iteration 10 in 7 -- -bool(true) --- Inner iteration 11 in 7 -- -bool(true) --- Inner iteration 12 in 7 -- -bool(true) --- Inner iteration 13 in 7 -- -bool(true) ---- Outer iteration 8 --- -bool(true) --- Inner iteration 0 in 8 -- -bool(true) --- Inner iteration 1 in 8 -- -bool(true) --- Inner iteration 2 in 8 -- -bool(true) --- Inner iteration 3 in 8 -- -bool(true) --- Inner iteration 4 in 8 -- -bool(true) --- Inner iteration 5 in 8 -- -bool(true) --- Inner iteration 6 in 8 -- -bool(true) --- Inner iteration 7 in 8 -- -bool(true) --- Inner iteration 8 in 8 -- -bool(true) --- Inner iteration 9 in 8 -- -bool(true) --- Inner iteration 10 in 8 -- -bool(true) --- Inner iteration 11 in 8 -- -bool(true) --- Inner iteration 12 in 8 -- -bool(true) --- Inner iteration 13 in 8 -- -bool(true) *** Done *** diff --git a/ext/standard/tests/file/fnmatch_basic.phpt b/ext/standard/tests/file/fnmatch_basic.phpt index 8b74bb430b371..8591a21ffcb40 100644 --- a/ext/standard/tests/file/fnmatch_basic.phpt +++ b/ext/standard/tests/file/fnmatch_basic.phpt @@ -21,8 +21,6 @@ var_dump( fnmatch("*.phpt", $file) ); echo "*** Testing fnmatch() with other than file ***\n"; var_dump( fnmatch(100, 100) ); var_dump( fnmatch("string", "string") ); -var_dump( fnmatch(TRUE, TRUE) ); -var_dump( fnmatch(FALSE, FALSE) ); echo "\n*** Done ***\n"; ?> @@ -37,7 +35,5 @@ bool(false) *** Testing fnmatch() with other than file *** bool(true) bool(true) -bool(true) -bool(true) *** Done *** diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt index 3413c3e6f76c6..8270a6a0afc05 100644 --- a/ext/standard/tests/file/fnmatch_variation.phpt +++ b/ext/standard/tests/file/fnmatch_variation.phpt @@ -111,20 +111,6 @@ $str_arr = array( ); match_($str_arr, $str_arr); -echo "\n--- With booleans ---\n"; -$bool_arr = array( - TRUE, - true, - 1, - 10, - FALSE, - false, - 0, - "", - "string" -); -match_($bool_arr, $bool_arr); - echo "\n--- With NULL ---\n"; $null_arr = array( "", @@ -302,98 +288,6 @@ fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(true) ---- With booleans --- --- Iteration 0 -- -bool(true) -bool(true) -bool(true) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) --- Iteration 1 -- -bool(true) -bool(true) -bool(true) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) --- Iteration 2 -- -bool(true) -bool(true) -bool(true) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) --- Iteration 3 -- -bool(false) -bool(false) -bool(false) -bool(true) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) --- Iteration 4 -- -bool(false) -bool(false) -bool(false) -bool(false) -bool(true) -bool(true) -bool(false) -bool(true) -bool(false) --- Iteration 5 -- -bool(false) -bool(false) -bool(false) -bool(false) -bool(true) -bool(true) -bool(false) -bool(true) -bool(false) --- Iteration 6 -- -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(true) -bool(false) -bool(false) --- Iteration 7 -- -bool(false) -bool(false) -bool(false) -bool(false) -bool(true) -bool(true) -bool(false) -bool(true) -bool(false) --- Iteration 8 -- -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(true) - --- With NULL --- -- Iteration 0 -- bool(true) diff --git a/ext/standard/tests/file/glob_variation.phpt b/ext/standard/tests/file/glob_variation.phpt index 4fc1c240b4d40..21ebc88e2f184 100644 --- a/ext/standard/tests/file/glob_variation.phpt +++ b/ext/standard/tests/file/glob_variation.phpt @@ -25,7 +25,7 @@ fclose($fp); $fp = fopen("$file_path/glob_variation/wonder;123456", "w"); fclose($fp); -$patterns = array ( +$patterns = [ "$file_path/glob_variation/*der*", "$file_path/glob_variation/?onder*", "$file_path/glob_variation/w*der?*", @@ -37,8 +37,7 @@ $patterns = array ( '$file_path/glob_variation/wonder5', "$file_path/glob_variation/?wonder?", "$file_path/glob_variation/wonder?", - TRUE // boolean true -); +]; $counter = 1; /* loop through $patterns to match each $pattern with the files created using glob() */ @@ -284,11 +283,11 @@ array(3) { } array(3) { [0]=> - string(%d) "%s" + string(%d) "%s/glob_variation/wonder" [1]=> - string(%d) "%s" + string(%d) "%s/glob_variation/wonder12345" [2]=> - string(%d) "%s" + string(%d) "%s/glob_variation/wonder;123456" } array(3) { [0]=> @@ -382,22 +381,6 @@ array(0) { array(0) { } --- Iteration 12 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(1) { - [0]=> - string(%d) "1" -} -array(0) { -} -array(0) { -} - *** Testing glob() with pattern within braces *** array(1) { [0]=> @@ -447,7 +430,4 @@ array(1) { [0]=> string(%d) "%s/glob_variation/wonder1" } --- Iteration 12 -- -array(0) { -} Done diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt index 730a2bcfea4d3..67e5cfc29d13e 100644 --- a/ext/standard/tests/file/is_dir_variation3.phpt +++ b/ext/standard/tests/file/is_dir_variation3.phpt @@ -7,17 +7,13 @@ obscure_filename /* Passing invalid arguments to is_dir() */ echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n"; -$dirnames = array( - /* Invalid dirnames */ +$dirnames = [ -2.34555, - TRUE, - FALSE, " ", - - /* scalars */ 0, - 1234 -); + 1, + 1234, +]; /* loop through to test each element the above array */ foreach($dirnames as $dirname) { @@ -31,4 +27,3 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) diff --git a/ext/standard/tests/file/is_executable_variation3.phpt b/ext/standard/tests/file/is_executable_variation3.phpt index b9b3a98e5c626..97deafd7c9ddd 100644 --- a/ext/standard/tests/file/is_executable_variation3.phpt +++ b/ext/standard/tests/file/is_executable_variation3.phpt @@ -17,14 +17,13 @@ $file_handle = fopen(__FILE__, "r"); unset($file_handle); echo "\n*** Testing is_executable() on invalid files ***\n"; -$invalid_files = array( +$invalid_files = [ 0, + 1, 1234, -2.34555, - TRUE, - FALSE, " ", -); +]; /* loop through to test each element in the above array is an executable file */ foreach( $invalid_files as $invalid_file ) { @@ -43,5 +42,4 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) Done diff --git a/ext/standard/tests/file/is_readable_variation3.phpt b/ext/standard/tests/file/is_readable_variation3.phpt index e4a5766762824..3775d8e5e4333 100644 --- a/ext/standard/tests/file/is_readable_variation3.phpt +++ b/ext/standard/tests/file/is_readable_variation3.phpt @@ -11,14 +11,13 @@ require __DIR__ . '/../skipif_root.inc'; echo "*** Testing is_readable(): usage variations ***\n"; echo "\n*** Testing is_readable() on miscellaneous filenames ***\n"; -$misc_files = array( +$misc_files = [ 0, + 1, 1234, -2.34555, - TRUE, - FALSE, " ", -); +]; /* loop through to test each element in the above array is a readable file */ foreach( $misc_files as $misc_file ) { @@ -37,5 +36,4 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) Done diff --git a/ext/standard/tests/file/is_writable_variation3.phpt b/ext/standard/tests/file/is_writable_variation3.phpt index 021d6e5645414..60b617cf63515 100644 --- a/ext/standard/tests/file/is_writable_variation3.phpt +++ b/ext/standard/tests/file/is_writable_variation3.phpt @@ -13,14 +13,13 @@ obscure_filename echo "*** Testing is_writable(): usage variations ***\n"; echo "\n*** Testing is_writable() with invalid filenames ***\n"; -$misc_files = array( +$misc_files = [ 0, + 1, 1234, -2.34555, - TRUE, - FALSE, " ", -); +]; /* loop through to test each element in the above array is a writable file */ foreach( $misc_files as $misc_file ) { @@ -43,5 +42,3 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) -bool(false) diff --git a/ext/standard/tests/file/lstat_stat_variation22.phpt b/ext/standard/tests/file/lstat_stat_variation22.phpt index 9efb23fc4178b..4b8aae576046c 100644 --- a/ext/standard/tests/file/lstat_stat_variation22.phpt +++ b/ext/standard/tests/file/lstat_stat_variation22.phpt @@ -13,13 +13,11 @@ obscure_filename --FILE-- - string(1) "." - ["basename"]=> - string(1) "1" - ["filename"]=> - string(1) "1" -} -string(1) "." -string(1) "1" -string(0) "" -string(1) "1" --- Iteration 6 -- -array(2) { - ["basename"]=> - string(0) "" - ["filename"]=> - string(0) "" -} -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 7 -- array(3) { ["dirname"]=> string(1) "." @@ -166,7 +136,7 @@ string(1) "." string(11) "array(1, 2)" string(0) "" string(11) "array(1, 2)" --- Iteration 8 -- +-- Iteration 6 -- array(3) { ["dirname"]=> string(1) "." @@ -179,20 +149,7 @@ string(1) "." string(21) "array( array(), null)" string(0) "" string(21) "array( array(), null)" --- Iteration 9 -- -array(3) { - ["dirname"]=> - string(1) "." - ["basename"]=> - string(1) " " - ["filename"]=> - string(1) " " -} -string(1) "." -string(1) " " -string(0) "" -string(1) " " --- Iteration 10 -- +-- Iteration 7 -- array(3) { ["dirname"]=> string(1) "." @@ -205,18 +162,7 @@ string(1) "." string(1) " " string(0) "" string(1) " " --- Iteration 11 -- -array(2) { - ["basename"]=> - string(0) "" - ["filename"]=> - string(0) "" -} -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 12 -- +-- Iteration 8 -- array(2) { ["basename"]=> string(0) "" @@ -227,7 +173,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 13 -- +-- Iteration 9 -- array(4) { ["dirname"]=> string(1) "." @@ -242,7 +188,7 @@ string(1) "." string(11) "www.foo.com" string(3) "com" string(7) "www.foo" --- Iteration 14 -- +-- Iteration 10 -- array(4) { ["dirname"]=> string(17) "/var/html/testdir" @@ -257,7 +203,7 @@ string(17) "/var/html/testdir" string(12) "example.html" string(4) "html" string(7) "example" --- Iteration 15 -- +-- Iteration 11 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -270,7 +216,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 16 -- +-- Iteration 12 -- array(4) { ["dirname"]=> string(4) "/foo" @@ -285,7 +231,7 @@ string(4) "/foo" string(12) "symlink.link" string(4) "link" string(7) "symlink" --- Iteration 17 -- +-- Iteration 13 -- array(3) { ["dirname"]=> string(1) "." @@ -298,7 +244,7 @@ string(1) "." string(5) "12345" string(0) "" string(5) "12345" --- Iteration 18 -- +-- Iteration 14 -- array(4) { ["dirname"]=> string(1) "." @@ -313,7 +259,7 @@ string(1) "." string(15) "www.example.com" string(3) "com" string(11) "www.example" --- Iteration 19 -- +-- Iteration 15 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -326,7 +272,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 20 -- +-- Iteration 16 -- array(4) { ["dirname"]=> string(6) "../foo" @@ -341,7 +287,7 @@ string(6) "../foo" string(9) "test.link" string(4) "link" string(4) "test" --- Iteration 21 -- +-- Iteration 17 -- array(4) { ["dirname"]=> string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6" @@ -356,7 +302,7 @@ string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/tes string(8) "test.tmp" string(3) "tmp" string(4) "test" --- Iteration 22 -- +-- Iteration 18 -- array(4) { ["dirname"]=> string(1) "." diff --git a/ext/standard/tests/file/readfile_error.phpt b/ext/standard/tests/file/readfile_error.phpt index ec2cf53946a6d..6fdc1684e80e2 100644 --- a/ext/standard/tests/file/readfile_error.phpt +++ b/ext/standard/tests/file/readfile_error.phpt @@ -13,11 +13,6 @@ try { } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } -try { - var_dump( readfile(false) ); // boolean false as $filename -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; -} echo "\n-- Testing readfile() with non-existent file --\n"; $non_existent_file = __DIR__."/non_existent_file.tmp"; @@ -30,7 +25,6 @@ echo "Done\n"; -- Testing readfile() with invalid arguments -- Path must not be empty -Path must not be empty -- Testing readfile() with non-existent file -- diff --git a/ext/standard/tests/file/readfile_variation10.phpt b/ext/standard/tests/file/readfile_variation10.phpt index d2875215e5f7b..381389682a6f1 100644 --- a/ext/standard/tests/file/readfile_variation10.phpt +++ b/ext/standard/tests/file/readfile_variation10.phpt @@ -15,28 +15,23 @@ echo "*** Testing readfile() : variation ***\n"; /* An array of files */ -$names_arr = array( +$names = [ /* Invalid args */ -1, - TRUE, - FALSE, "", " ", "\0", - /* prefix with path separator of a non existing directory*/ "/no/such/file/dir", - "php/php" - -); + "php/php", +]; -for( $i=0; $igetMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> @@ -45,11 +40,6 @@ for( $i=0; $i @@ -46,17 +43,8 @@ bool(false) Warning: symlink(): %s in %s on line %d bool(false) -Warning: symlink(): %s in %s on line %d -bool(false) - -Warning: symlink(): %s in %s on line %d -bool(false) - *** Testing linkinfo() for error conditions *** -Warning: linkinfo(): %s in %s on line %d -int(-1) - Warning: linkinfo(): %s in %s on line %d int(-1) Done diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt index fcc64d409849d..2319168a8d7d4 100644 --- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt +++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt @@ -21,16 +21,13 @@ echo "*** Testing link() for error conditions ***\n"; //invalid arguments var_dump( link('', $linkname) ); // empty string as filename var_dump( link(' ', $linkname) ); // space as filename -var_dump( link(false, $linkname) ); // boolean false as filename var_dump( link($filename, '') ); // '' as linkname -var_dump( link($filename, false) ); // false as linkname echo "\n*** Testing is_link() for error conditions ***\n"; //invalid arguments var_dump( is_link('') ); // empty string as linkname var_dump( is_link(' ') ); // space as linkname -var_dump( is_link(false) ); // boolean false as linkname var_dump( is_link($filename) ); // file given to is_link echo "Done\n"; @@ -51,15 +48,8 @@ bool(false) Warning: link(): No such file or directory in %s on line %d bool(false) -Warning: link(): No such file or directory in %s on line %d -bool(false) - -Warning: link(): No such file or directory in %s on line %d -bool(false) - *** Testing is_link() for error conditions *** bool(false) bool(false) bool(false) -bool(false) Done diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt index 6f20ec140ef42..90a9f8fa729a0 100644 --- a/ext/standard/tests/file/tempnam_variation3.phpt +++ b/ext/standard/tests/file/tempnam_variation3.phpt @@ -16,21 +16,16 @@ $file_path = __DIR__."/tempnamVar3"; mkdir($file_path); /* An array of prefixes */ -$names_arr = array( +$names_arr = [ /* Invalid args */ -1, - TRUE, - FALSE, "", " ", "\0", - array(), - /* prefix with path separator of a non existing directory*/ "/no/such/file/dir", - "php/php" - -); + "php/php", +]; for( $i=0; $i %s/%s File permissions are => 100600 File created in => directory specified -- Iteration 3 -- -File name is => %s/%s -File permissions are => 100600 -File created in => directory specified --- Iteration 4 -- -File name is => %s/%s -File permissions are => 100600 -File created in => directory specified --- Iteration 5 -- tempnam(): Argument #2 ($prefix) must not contain any null bytes --- Iteration 6 -- -tempnam(): Argument #2 ($prefix) must be of type string, array given --- Iteration 7 -- +-- Iteration 4 -- File name is => %s/dir%s File permissions are => 100600 File created in => directory specified --- Iteration 8 -- +-- Iteration 5 -- File name is => %s/php%s File permissions are => 100600 File created in => directory specified diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt index 1928da4f89624..21c2b852c814c 100644 --- a/ext/standard/tests/file/tempnam_variation7.phpt +++ b/ext/standard/tests/file/tempnam_variation7.phpt @@ -14,21 +14,16 @@ 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( +$names_arr = [ /* Invalid args */ -1, - TRUE, - FALSE, "", " ", "\0", - array(), - /* Non-existing dirs */ "/no/such/file/dir", - "php" - -); + "php", +]; for( $i=0; $i %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 1 -- - -Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 2 -- + +Notice: tempnam(): file created in the system's temporary directory in %s on line %d File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 3 -- -File name is => %s%etempnam_variation3.tmp%s -File permissions are => 100600 -File created in => temp dir +tempnam(): Argument #1 ($directory) must not contain any null bytes -- Iteration 4 -- -Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d +Notice: tempnam(): file created in the system's temporary directory in %s on line %d File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 5 -- -tempnam(): Argument #1 ($directory) must not contain any null bytes --- Iteration 6 -- -tempnam(): Argument #1 ($directory) must be of type string, array given --- Iteration 7 -- - -Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d -File name is => %s/tempnam_variation3.tmp%s -File permissions are => 100600 -File created in => temp dir --- Iteration 8 -- -Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d -File name is => %s/tempnam_variation3.tmp%s +Notice: tempnam(): file created in the system's temporary directory in %s on line %d +File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir diff --git a/ext/standard/tests/file/unlink_error.phpt b/ext/standard/tests/file/unlink_error.phpt index 1dd8ef1a25c9e..02542c5dd1353 100644 --- a/ext/standard/tests/file/unlink_error.phpt +++ b/ext/standard/tests/file/unlink_error.phpt @@ -25,9 +25,6 @@ echo "\n-- Testing unlink() on invalid arguments --\n"; var_dump( unlink('') ); // $filename as empty string var_dump( file_exists('') ); // confirm file doesn't exist -var_dump( unlink(false) ); // $filename as boolean false -var_dump( file_exists(false) ); // confirm file doesn't exist - echo "\n-- Testing unlink() on non-existent file --\n"; var_dump( unlink(__DIR__."/non_existent_file.tmp") ); @@ -55,10 +52,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink(): %s in %s on line %d -bool(false) -bool(false) - -- Testing unlink() on non-existent file -- Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/userstreams_003.phpt b/ext/standard/tests/file/userstreams_003.phpt index 08f508fccfd31..cfc54bd2bed6c 100644 --- a/ext/standard/tests/file/userstreams_003.phpt +++ b/ext/standard/tests/file/userstreams_003.phpt @@ -43,10 +43,10 @@ var_dump(stream_wrapper_register('test2', 'test_wrapper_base')); $fd = fopen("test://foo","r"); $fd2 = fopen("test2://foo","r"); -test("stream_set_blocking - 1", $fd, true, "stream_set_blocking", array($fd,0), STREAM_OPTION_BLOCKING, 0); -test("stream_set_blocking - 2", $fd, false, "stream_set_blocking", array($fd,1), STREAM_OPTION_BLOCKING, 1); -test("stream_set_blocking - 3", $fd, "foo", "stream_set_blocking", array($fd,0), STREAM_OPTION_BLOCKING, 0); -test("stream_set_blocking - 4", $fd2, true, "stream_set_blocking", array($fd2,1), STREAM_OPTION_BLOCKING, 1); +test("stream_set_blocking - 1", $fd, true, "stream_set_blocking", array($fd, false), STREAM_OPTION_BLOCKING, 0); +test("stream_set_blocking - 2", $fd, false, "stream_set_blocking", array($fd, true), STREAM_OPTION_BLOCKING, 1); +test("stream_set_blocking - 3", $fd, "foo", "stream_set_blocking", array($fd, false), STREAM_OPTION_BLOCKING, 0); +test("stream_set_blocking - 4", $fd2, true, "stream_set_blocking", array($fd2, true), STREAM_OPTION_BLOCKING, 1); test("stream_set_write_buffer - 1", $fd, true, "stream_set_write_buffer", array($fd,0), STREAM_OPTION_WRITE_BUFFER, STREAM_BUFFER_NONE); test("stream_set_write_buffer - 2", $fd, true, "stream_set_write_buffer", array($fd,4096), STREAM_OPTION_WRITE_BUFFER, STREAM_BUFFER_FULL); diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt deleted file mode 100644 index 752b1dfa7e331..0000000000000 --- a/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt +++ /dev/null @@ -1,107 +0,0 @@ ---TEST-- -Test escapeshellarg() function : usage variations - different data types as $arg arg ---SKIPIF-- - ---FILE-- - ---EXPECT-- -*** Testing escapeshellarg() : usage variations *** - --- Iteration 1 -- -string(3) ""0"" - --- Iteration 2 -- -string(3) ""1"" - --- Iteration 3 -- -string(4) ""12"" - --- Iteration 4 -- -string(5) ""-12"" - --- Iteration 5 -- -string(12) ""2147483647"" - --- Iteration 6 -- -string(6) ""10.5"" - --- Iteration 7 -- -string(7) ""-10.5"" - --- Iteration 8 -- -string(10) ""123.4567"" - --- Iteration 9 -- -string(12) ""0.01234567"" - --- Iteration 10 -- -string(5) ""0.5"" - --- Iteration 11 -- -string(3) ""1"" - --- Iteration 12 -- -string(2) """" - --- Iteration 13 -- -string(3) ""1"" - --- Iteration 14 -- -string(2) """" - --- Iteration 15 -- -string(2) """" - --- Iteration 16 -- -string(2) """" diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt deleted file mode 100644 index 028b987eece2a..0000000000000 --- a/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt +++ /dev/null @@ -1,106 +0,0 @@ ---TEST-- -Test escapeshellarg() function : usage variations - different data types as $y arg ---SKIPIF-- - ---FILE-- - ---EXPECT-- -*** Testing escapeshellarg() : usage variations *** - --- Iteration 1 -- -string(3) "'0'" - --- Iteration 2 -- -string(3) "'1'" - --- Iteration 3 -- -string(4) "'12'" - --- Iteration 4 -- -string(5) "'-12'" - --- Iteration 5 -- -string(12) "'2147483647'" - --- Iteration 6 -- -string(6) "'10.5'" - --- Iteration 7 -- -string(7) "'-10.5'" - --- Iteration 8 -- -string(10) "'123.4567'" - --- Iteration 9 -- -string(12) "'0.01234567'" - --- Iteration 10 -- -string(5) "'0.5'" - --- Iteration 11 -- -string(3) "'1'" - --- Iteration 12 -- -string(2) "''" - --- Iteration 13 -- -string(3) "'1'" - --- Iteration 14 -- -string(2) "''" - --- Iteration 15 -- -string(2) "''" - --- Iteration 16 -- -string(2) "''" diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation2.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation2.phpt deleted file mode 100644 index 195affe4fc685..0000000000000 --- a/ext/standard/tests/general_functions/get_cfg_var_variation2.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -Test function get_cfg_var() by substituting argument 1 with boolean values. ---CREDITS-- -Francesco Fullone ff@ideato.it -#PHPTestFest Cesena Italia on 2009-06-20 ---INI-- -session.use_cookies=0 -session.serialize_handler=php -session.save_handler=files ---FILE-- - true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - ); - - -foreach ( $variation_array as $var ) { - var_dump(get_cfg_var( $var ) ); -} -?> ---EXPECT-- -*** Test substituting argument 1 with boolean values *** -bool(false) -bool(false) -bool(false) -bool(false) diff --git a/ext/standard/tests/general_functions/ini_get_all.phpt b/ext/standard/tests/general_functions/ini_get_all.phpt index 2b71b474a013b..7f2c6b49723cc 100644 --- a/ext/standard/tests/general_functions/ini_get_all.phpt +++ b/ext/standard/tests/general_functions/ini_get_all.phpt @@ -17,7 +17,7 @@ var_dump(ini_get_all("pcre")); var_dump(ini_get_all("pcre", false)); var_dump(ini_get_all("reflection", false)); -var_dump(ini_get_all("", "")); +var_dump(ini_get_all("", false)); echo "Done\n"; ?> diff --git a/ext/standard/tests/general_functions/parse_ini_basic.phpt b/ext/standard/tests/general_functions/parse_ini_basic.phpt index 516bbd8bab456..49e61410e409b 100644 --- a/ext/standard/tests/general_functions/parse_ini_basic.phpt +++ b/ext/standard/tests/general_functions/parse_ini_basic.phpt @@ -14,7 +14,7 @@ $ini_file = __DIR__."/parse_ini_basic.data"; define('TEST_CONSTANT', 'this_is_test_constant'); -var_dump(parse_ini_file($ini_file, 1)); +var_dump(parse_ini_file($ini_file, true)); echo "Done.\n"; ?> diff --git a/ext/standard/tests/general_functions/parse_ini_booleans.phpt b/ext/standard/tests/general_functions/parse_ini_booleans.phpt index 14459626c7fc3..f74742cd8dd08 100644 --- a/ext/standard/tests/general_functions/parse_ini_booleans.phpt +++ b/ext/standard/tests/general_functions/parse_ini_booleans.phpt @@ -5,7 +5,7 @@ parse_ini_file() boolean operators $ini_file = __DIR__."/parse_ini_booleans.data"; -var_dump(parse_ini_file($ini_file, 1)); +var_dump(parse_ini_file($ini_file, true)); echo "Done.\n"; diff --git a/ext/standard/tests/general_functions/proc_nice_variation2.phpt b/ext/standard/tests/general_functions/proc_nice_variation2.phpt deleted file mode 100644 index f1f93be221ef4..0000000000000 --- a/ext/standard/tests/general_functions/proc_nice_variation2.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Test function proc_nice() by substituting argument 1 with boolean values. ---CREDITS-- -Italian PHP TestFest 2009 Cesena 19-20-21 june -Fabio Fabbrucci (fabbrucci@grupporetina.com) -Michele Orselli (mo@ideato.it) -Simone Gentili (sensorario@gmail.com) ---SKIPIF-- - ---FILE-- - true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - ); - - -foreach ( $variation_array as $var ) { - var_dump(proc_nice( $var ) ); -} -?> ---EXPECT-- -*** Test substituting argument 1 with boolean values *** -bool(true) -bool(true) -bool(true) -bool(true) diff --git a/ext/standard/tests/general_functions/uniqid_basic.phpt b/ext/standard/tests/general_functions/uniqid_basic.phpt index 408f72bfdbaa3..2b109a48f4f1b 100644 --- a/ext/standard/tests/general_functions/uniqid_basic.phpt +++ b/ext/standard/tests/general_functions/uniqid_basic.phpt @@ -13,18 +13,16 @@ echo "\n\n"; 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, - 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)); +$prefixes = [ + 99999, + "99999", + 10.5e2, +]; + +foreach ($prefixes as $prefix) { + var_dump(uniqid($prefix)); + var_dump(uniqid($prefix, true)); + var_dump(uniqid($prefix, false)); echo "\n"; } @@ -50,11 +48,3 @@ string(18) "99999%s" string(17) "1050%s" string(27) "1050%s.%s" string(17) "1050%s" - -string(14) "1%s" -string(24) "1%s.%s" -string(14) "1%s" - -string(13) "%s" -string(23) "%s.%s" -string(13) "%s" diff --git a/ext/standard/tests/http/ghsa-52jp-hrpf-2jff-001.phpt b/ext/standard/tests/http/ghsa-52jp-hrpf-2jff-001.phpt index 744cff9cc72f2..8a086b8b6cf37 100644 --- a/ext/standard/tests/http/ghsa-52jp-hrpf-2jff-001.phpt +++ b/ext/standard/tests/http/ghsa-52jp-hrpf-2jff-001.phpt @@ -35,7 +35,7 @@ $clientCode = <<<'CODE' $ctx = stream_context_create(); stream_context_set_params($ctx, array("notification" => "stream_notification_callback")); - var_dump(trim(file_get_contents("http://{{ ADDR }}", false, $ctx))); + var_dump(file_get_contents("http://{{ ADDR }}", false, $ctx)); var_dump($http_response_header); CODE; @@ -47,7 +47,7 @@ Found the mime-type: text/html; Redirected: string(8000) "%s" Warning: file_get_contents(http://127.0.0.1:%d): Failed to open stream: %s -string(0) "" +bool(false) array(3) { [0]=> string(15) "HTTP/1.0 301 Ok" diff --git a/ext/standard/tests/http/ghsa-52jp-hrpf-2jff-002.phpt b/ext/standard/tests/http/ghsa-52jp-hrpf-2jff-002.phpt index bc71fd4e41167..b4aa8caf33d32 100644 --- a/ext/standard/tests/http/ghsa-52jp-hrpf-2jff-002.phpt +++ b/ext/standard/tests/http/ghsa-52jp-hrpf-2jff-002.phpt @@ -35,7 +35,7 @@ $clientCode = <<<'CODE' $ctx = stream_context_create(); stream_context_set_params($ctx, array("notification" => "stream_notification_callback")); - var_dump(trim(file_get_contents("http://{{ ADDR }}", false, $ctx))); + var_dump(file_get_contents("http://{{ ADDR }}", false, $ctx)); var_dump($http_response_header); CODE; @@ -46,7 +46,7 @@ ServerClientTestCase::getInstance()->run($clientCode, $serverCode); Found the mime-type: text/html; Warning: file_get_contents(http://127.0.0.1:%d): Failed to open stream: HTTP Location header size is over the limit of 8182 bytes in %s -string(0) "" +bool(false) array(2) { [0]=> string(15) "HTTP/1.0 301 Ok" diff --git a/ext/standard/tests/math/abs_basic.phpt b/ext/standard/tests/math/abs_basic.phpt index 2b4957b996a81..235d13ded7e4d 100644 --- a/ext/standard/tests/math/abs_basic.phpt +++ b/ext/standard/tests/math/abs_basic.phpt @@ -1,46 +1,23 @@ --TEST-- Test abs() function : basic functionality --INI-- -precision = 14 +precision=14 --FILE-- ---EXPECTF-- -*** Testing abs() : basic functionality *** +--EXPECT-- int(23) int(23) float(23.45) float(23.45) -int(23) -int(23) -int(23) -int(23) float(23.45) -float(23.45) -float(23.45) - -Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -int(0) -int(1) -int(0) +int(10) +float(10.3) +float(3950.5) diff --git a/ext/standard/tests/math/abs_variation.phpt b/ext/standard/tests/math/abs_variation.phpt deleted file mode 100644 index d7f878bc01bbc..0000000000000 --- a/ext/standard/tests/math/abs_variation.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test abs() function : usage variations - different data types as $number arg ---FILE-- -getMessage(), "\n"; - } - $iterator++; -}; - -fclose($fp); -?> ---EXPECTF-- -*** Testing abs() : usage variations *** - --- Iteration 1 -- - -Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -int(0) - --- Iteration 2 -- - -Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -int(0) - --- Iteration 3 -- -int(1) - --- Iteration 4 -- -int(0) - --- Iteration 5 -- -int(1) - --- Iteration 6 -- -int(0) - --- Iteration 7 -- -abs(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 8 -- -abs(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 9 -- -abs(): Argument #1 ($num) must be of type int|float, array given - --- Iteration 10 -- -abs(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 11 -- -abs(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 12 -- -abs(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 13 -- -abs(): Argument #1 ($num) must be of type int|float, classA given - --- Iteration 14 -- - -Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -int(0) - --- Iteration 15 -- - -Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -int(0) - --- Iteration 16 -- -abs(): Argument #1 ($num) must be of type int|float, resource given diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt index 1fac4ccc246d5..d7eb14de3ad7a 100644 --- a/ext/standard/tests/math/acos_variation.phpt +++ b/ext/standard/tests/math/acos_variation.phpt @@ -1,31 +1,14 @@ --TEST-- Test variations in usage of acos() --INI-- -precision=10 +precision=14 --FILE-- --EXPECT-- -float(3.829113652) -float(-3.829113652) -float(3.848471992) -float(-3.848471992) -float(3.829113652) -float(3.829113652) -float(3.829113652) -float(3.848471992) -float(3.848471992) -float(7.60090271) -float(0.881373587) -float(0) +float(3.8291136516208812) +float(-3.8291136516208812) +float(3.8484719917851553) +float(3.8484719917851553) +float(-3.8484719917851553) +float(2.99822295029797) +float(3.027639279353268) +float(8.97474462874175) diff --git a/ext/standard/tests/math/atan2_basic.phpt b/ext/standard/tests/math/atan2_basic.phpt index 1c89cfa1c2fce..1c05d0f05ff8e 100644 --- a/ext/standard/tests/math/atan2_basic.phpt +++ b/ext/standard/tests/math/atan2_basic.phpt @@ -1,160 +1,83 @@ --TEST-- Test atan2() - basic function test of atan2() --INI-- -serialize_precision=14 +precision=14 --FILE-- --EXPECT-- -Y:23 X:23 float(0.78539816339745) -Y:23 X:-23 float(2.3561944901923) -Y:23 X:23.45 float(0.77571063007847) -Y:23 X:-23.45 float(2.3658820235113) -Y:23 X:23 float(0.78539816339745) -Y:23 X:23 float(0.78539816339745) -Y:23 X:23 float(0.78539816339745) -Y:23 X:23.45 float(0.77571063007847) -Y:23 X:2.345e1 float(0.77571063007847) -Y:23 X:1 float(1.5273454314034) -Y:23 X: float(1.5707963267949) -Y:-23 X:23 float(-0.78539816339745) -Y:-23 X:-23 float(-2.3561944901923) -Y:-23 X:23.45 float(-0.77571063007847) -Y:-23 X:-23.45 float(-2.3658820235113) -Y:-23 X:23 float(-0.78539816339745) -Y:-23 X:23 float(-0.78539816339745) -Y:-23 X:23 float(-0.78539816339745) -Y:-23 X:23.45 float(-0.77571063007847) -Y:-23 X:2.345e1 float(-0.77571063007847) -Y:-23 X:1 float(-1.5273454314034) -Y:-23 X: float(-1.5707963267949) -Y:23.45 X:23 float(0.79508569671643) -Y:23.45 X:-23 float(2.3465069568734) -Y:23.45 X:23.45 float(0.78539816339745) -Y:23.45 X:-23.45 float(2.3561944901923) -Y:23.45 X:23 float(0.79508569671643) -Y:23.45 X:23 float(0.79508569671643) -Y:23.45 X:23 float(0.79508569671643) -Y:23.45 X:23.45 float(0.78539816339745) -Y:23.45 X:2.345e1 float(0.78539816339745) -Y:23.45 X:1 float(1.5281782247706) -Y:23.45 X: float(1.5707963267949) -Y:-23.45 X:23 float(-0.79508569671643) -Y:-23.45 X:-23 float(-2.3465069568734) -Y:-23.45 X:23.45 float(-0.78539816339745) -Y:-23.45 X:-23.45 float(-2.3561944901923) -Y:-23.45 X:23 float(-0.79508569671643) -Y:-23.45 X:23 float(-0.79508569671643) -Y:-23.45 X:23 float(-0.79508569671643) -Y:-23.45 X:23.45 float(-0.78539816339745) -Y:-23.45 X:2.345e1 float(-0.78539816339745) -Y:-23.45 X:1 float(-1.5281782247706) -Y:-23.45 X: float(-1.5707963267949) -Y:23 X:23 float(0.78539816339745) -Y:23 X:-23 float(2.3561944901923) -Y:23 X:23.45 float(0.77571063007847) -Y:23 X:-23.45 float(2.3658820235113) -Y:23 X:23 float(0.78539816339745) -Y:23 X:23 float(0.78539816339745) -Y:23 X:23 float(0.78539816339745) -Y:23 X:23.45 float(0.77571063007847) -Y:23 X:2.345e1 float(0.77571063007847) -Y:23 X:1 float(1.5273454314034) -Y:23 X: float(1.5707963267949) -Y:23 X:23 float(0.78539816339745) -Y:23 X:-23 float(2.3561944901923) -Y:23 X:23.45 float(0.77571063007847) -Y:23 X:-23.45 float(2.3658820235113) -Y:23 X:23 float(0.78539816339745) -Y:23 X:23 float(0.78539816339745) -Y:23 X:23 float(0.78539816339745) -Y:23 X:23.45 float(0.77571063007847) -Y:23 X:2.345e1 float(0.77571063007847) -Y:23 X:1 float(1.5273454314034) -Y:23 X: float(1.5707963267949) -Y:23 X:23 float(0.78539816339745) -Y:23 X:-23 float(2.3561944901923) -Y:23 X:23.45 float(0.77571063007847) -Y:23 X:-23.45 float(2.3658820235113) -Y:23 X:23 float(0.78539816339745) -Y:23 X:23 float(0.78539816339745) -Y:23 X:23 float(0.78539816339745) -Y:23 X:23.45 float(0.77571063007847) -Y:23 X:2.345e1 float(0.77571063007847) -Y:23 X:1 float(1.5273454314034) -Y:23 X: float(1.5707963267949) -Y:23.45 X:23 float(0.79508569671643) -Y:23.45 X:-23 float(2.3465069568734) -Y:23.45 X:23.45 float(0.78539816339745) -Y:23.45 X:-23.45 float(2.3561944901923) -Y:23.45 X:23 float(0.79508569671643) -Y:23.45 X:23 float(0.79508569671643) -Y:23.45 X:23 float(0.79508569671643) -Y:23.45 X:23.45 float(0.78539816339745) -Y:23.45 X:2.345e1 float(0.78539816339745) -Y:23.45 X:1 float(1.5281782247706) -Y:23.45 X: float(1.5707963267949) -Y:2.345e1 X:23 float(0.79508569671643) -Y:2.345e1 X:-23 float(2.3465069568734) -Y:2.345e1 X:23.45 float(0.78539816339745) -Y:2.345e1 X:-23.45 float(2.3561944901923) -Y:2.345e1 X:23 float(0.79508569671643) -Y:2.345e1 X:23 float(0.79508569671643) -Y:2.345e1 X:23 float(0.79508569671643) -Y:2.345e1 X:23.45 float(0.78539816339745) -Y:2.345e1 X:2.345e1 float(0.78539816339745) -Y:2.345e1 X:1 float(1.5281782247706) -Y:2.345e1 X: float(1.5707963267949) -Y:1 X:23 float(0.043450895391531) -Y:1 X:-23 float(3.0981417581983) -Y:1 X:23.45 float(0.042618102024328) -Y:1 X:-23.45 float(3.0989745515655) -Y:1 X:23 float(0.043450895391531) -Y:1 X:23 float(0.043450895391531) -Y:1 X:23 float(0.043450895391531) -Y:1 X:23.45 float(0.042618102024328) -Y:1 X:2.345e1 float(0.042618102024328) -Y:1 X:1 float(0.78539816339745) -Y:1 X: float(1.5707963267949) -Y: X:23 float(0) -Y: X:-23 float(3.1415926535898) -Y: X:23.45 float(0) -Y: X:-23.45 float(3.1415926535898) -Y: X:23 float(0) -Y: X:23 float(0) -Y: X:23 float(0) -Y: X:23.45 float(0) -Y: X:2.345e1 float(0) -Y: X:1 float(0) -Y: X: float(0) +Y:23 X:23 float(0.7853981633974483) +Y:-23 X:23 float(-0.7853981633974483) +Y:23.45 X:23 float(0.795085696716429) +Y:23.45 X:23 float(0.795085696716429) +Y:-23.45 X:23 float(-0.795085696716429) +Y:10 X:23 float(0.41012734054149097) +Y:10.3 X:23 float(0.4210446283062471) +Y:3950.5 X:23 float(1.5649743447333593) +Y:23 X:-23 float(2.356194490192345) +Y:-23 X:-23 float(-2.356194490192345) +Y:23.45 X:-23 float(2.3465069568733643) +Y:23.45 X:-23 float(2.3465069568733643) +Y:-23.45 X:-23 float(-2.3465069568733643) +Y:10 X:-23 float(2.7314653130483024) +Y:10.3 X:-23 float(2.720548025283546) +Y:3950.5 X:-23 float(1.576618308856434) +Y:23 X:23.45 float(0.7757106300784676) +Y:-23 X:23.45 float(-0.7757106300784676) +Y:23.45 X:23.45 float(0.7853981633974483) +Y:23.45 X:23.45 float(0.7853981633974483) +Y:-23.45 X:23.45 float(-0.7853981633974483) +Y:10 X:23.45 float(0.4030890583898821) +Y:10.3 X:23.45 float(0.4138636039995091) +Y:3950.5 X:23.45 float(1.5648604390386753) +Y:23 X:23.45 float(0.7757106300784676) +Y:-23 X:23.45 float(-0.7757106300784676) +Y:23.45 X:23.45 float(0.7853981633974483) +Y:23.45 X:23.45 float(0.7853981633974483) +Y:-23.45 X:23.45 float(-0.7853981633974483) +Y:10 X:23.45 float(0.4030890583898821) +Y:10.3 X:23.45 float(0.4138636039995091) +Y:3950.5 X:23.45 float(1.5648604390386753) +Y:23 X:-23.45 float(2.365882023511326) +Y:-23 X:-23.45 float(-2.365882023511326) +Y:23.45 X:-23.45 float(2.356194490192345) +Y:23.45 X:-23.45 float(2.356194490192345) +Y:-23.45 X:-23.45 float(-2.356194490192345) +Y:10 X:-23.45 float(2.7385035951999113) +Y:10.3 X:-23.45 float(2.727729049590284) +Y:3950.5 X:-23.45 float(1.5767322145511178) +Y:23 X:10 float(1.1606689862534056) +Y:-23 X:10 float(-1.1606689862534056) +Y:23.45 X:10 float(1.1677072684050145) +Y:23.45 X:10 float(1.1677072684050145) +Y:-23.45 X:10 float(-1.1677072684050145) +Y:10 X:10 float(0.7853981633974483) +Y:10.3 X:10 float(0.8001754128049406) +Y:3950.5 X:10 float(1.5682650070527393) +Y:23 X:10.3 float(1.1497516984886496) +Y:-23 X:10.3 float(-1.1497516984886496) +Y:23.45 X:10.3 float(1.1569327227953876) +Y:23.45 X:10.3 float(1.1569327227953876) +Y:-23.45 X:10.3 float(-1.1569327227953876) +Y:10 X:10.3 float(0.770620913989956) +Y:10.3 X:10.3 float(0.7853981633974483) +Y:3950.5 X:10.3 float(1.5681890677996104) +Y:23 X:3950.5 float(0.005821982061537398) +Y:-23 X:3950.5 float(-0.005821982061537398) +Y:23.45 X:3950.5 float(0.005935887756221248) +Y:23.45 X:3950.5 float(0.005935887756221248) +Y:-23.45 X:3950.5 float(-0.005935887756221248) +Y:10 X:3950.5 float(0.002531319742157217) +Y:10.3 X:3950.5 float(0.002607258995286145) +Y:3950.5 X:3950.5 float(0.7853981633974483) diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt index abd3831dddc67..6aa36de464fe4 100644 --- a/ext/standard/tests/math/atan_variation.phpt +++ b/ext/standard/tests/math/atan_variation.phpt @@ -1,31 +1,14 @@ --TEST-- Test variations in usage of atan() --INI-- -precision = 10 +precision=14 --FILE-- getMessage() . "\n"; - } - $iterator++; -} -fclose($fp); -?> ---EXPECTF-- -*** Testing base_convert() : usage variations *** - --- Iteration 1 -- -string(1) "0" - --- Iteration 2 -- -string(1) "1" - --- Iteration 3 -- -string(2) "14" - --- Iteration 4 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -string(2) "14" - --- Iteration 5 -- -string(11) "17777777777" - --- Iteration 6 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -string(3) "151" - --- Iteration 7 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -string(3) "151" - --- Iteration 8 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -string(7) "4553207" - --- Iteration 9 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -string(7) "4553207" - --- Iteration 10 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -string(1) "5" - --- Iteration 11 -- -string(1) "1" - --- Iteration 12 -- -string(1) "0" - --- Iteration 13 -- -string(1) "1" - --- Iteration 14 -- -string(1) "0" - --- Iteration 15 -- -string(1) "0" - --- Iteration 16 -- -string(1) "0" - --- Iteration 17 -- -base_convert(): Argument #1 ($num) must be of type string, array given - --- Iteration 18 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -string(1) "0" - --- Iteration 19 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -string(1) "0" - --- Iteration 20 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -string(1) "0" - --- Iteration 21 -- -base_convert(): Argument #1 ($num) must be of type string, resource given diff --git a/ext/standard/tests/math/bindec_basic.phpt b/ext/standard/tests/math/bindec_basic.phpt index 7640171fe61b6..5fc03f1490e33 100644 --- a/ext/standard/tests/math/bindec_basic.phpt +++ b/ext/standard/tests/math/bindec_basic.phpt @@ -1,76 +1,47 @@ --TEST-- -Test bindec() - basic function test bindec() ---SKIPIF-- - +bindec(): basic --INI-- precision=14 --FILE-- ---EXPECTF-- -int(455) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(32766) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(5) -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(129) -int(455) -int(224) -int(2147483647) -float(2147483648) +$values = [ + 0b101010 => '101010', + 0b111111 => '111111', +]; -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(129) +$values_leading = [ + 0b101010 => '0101010', + 0b111111 => '0111111', +]; -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) +$values_leading_explicit = [ + 0b101010 => '0b101010', + 0b111111 => '0b111111', +]; -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(13) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(13) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(26) +foreach ($values as $nb => $value) { + echo "bindec('$value') should be $nb is "; + $res = bindec($value); + var_dump($res); +} -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(6) +foreach ($values_leading as $nb => $value) { + echo "bindec('$value') should be $nb is "; + $res = bindec($value); + var_dump($res); +} -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) -int(1) -int(0) +foreach ($values_leading_explicit as $nb => $value) { + echo "bindec('$value') should be $nb is "; + $res = bindec($value); + var_dump($res); +} +?> +--EXPECT-- +bindec('101010') should be 42 is int(42) +bindec('111111') should be 63 is int(63) +bindec('0101010') should be 42 is int(42) +bindec('0111111') should be 63 is int(63) +bindec('0b101010') should be 42 is int(42) +bindec('0b111111') should be 63 is int(63) diff --git a/ext/standard/tests/math/bindec_basic_64bit.phpt b/ext/standard/tests/math/bindec_basic_64bit.phpt deleted file mode 100644 index 8fece221c0ede..0000000000000 --- a/ext/standard/tests/math/bindec_basic_64bit.phpt +++ /dev/null @@ -1,76 +0,0 @@ ---TEST-- -Test bindec() - basic function test bindec() ---SKIPIF-- - ---INI-- -precision=14 ---FILE-- - ---EXPECTF-- -int(455) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(32766) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(5) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(129) -int(455) -int(224) -int(2147483647) -int(2147483648) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(129) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(13) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(13) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(26) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(6) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) -int(1) -int(0) diff --git a/ext/standard/tests/math/bindec_invalid.phpt b/ext/standard/tests/math/bindec_invalid.phpt new file mode 100644 index 0000000000000..45bd3a9c57109 --- /dev/null +++ b/ext/standard/tests/math/bindec_invalid.phpt @@ -0,0 +1,27 @@ +--TEST-- +bindec(): basic +--INI-- +precision=14 +--FILE-- + '-0b101010', + 0b111111 => '1111112', + 0b111111 => '111111?x', +]; + +foreach ($values as $nb => $value) { + echo "bindec('$value') should be $nb is"; + $res = bindec($value); + var_dump($res); +} + +?> +--EXPECTF-- +bindec('-0b101010') should be -42 is +Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d +int(42) +bindec('111111?x') should be 63 is +Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d +int(63) diff --git a/ext/standard/tests/math/bindec_large_32bit.phpt b/ext/standard/tests/math/bindec_large_32bit.phpt new file mode 100644 index 0000000000000..3be68c185e7a7 --- /dev/null +++ b/ext/standard/tests/math/bindec_large_32bit.phpt @@ -0,0 +1,23 @@ +--TEST-- +bindec() with number larger than 32 bit (32bit platform) +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +--EXPECT-- +bindec('0b10000000000000000000000000000000') should be 2147483648 is float(2147483648) +bindec('10000000000000000000000000000000') should be 2147483648 is float(2147483648) diff --git a/ext/standard/tests/math/bindec_large_64bit.phpt b/ext/standard/tests/math/bindec_large_64bit.phpt new file mode 100644 index 0000000000000..ae4881e1a18ed --- /dev/null +++ b/ext/standard/tests/math/bindec_large_64bit.phpt @@ -0,0 +1,23 @@ +--TEST-- +bindec() with number larger than 32 bit (64bit platform) +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +--EXPECT-- +bindec('0b10000000000000000000000000000000') should be 2147483648 is int(2147483648) +bindec('10000000000000000000000000000000') should be 2147483648 is int(2147483648) diff --git a/ext/standard/tests/math/bindec_variation1.phpt b/ext/standard/tests/math/bindec_variation1.phpt deleted file mode 100644 index 420ceeed7a6a8..0000000000000 --- a/ext/standard/tests/math/bindec_variation1.phpt +++ /dev/null @@ -1,148 +0,0 @@ ---TEST-- -Test bindec() function : usage variations - different data types as $binary_string arg ---SKIPIF-- - ---FILE-- -getMessage(), "\n"; - } - $iterator++; -}; -fclose($fp); -?> ---EXPECTF-- -*** Testing bindec() : usage variations *** - --- Iteration 1 -- -int(0) - --- Iteration 2 -- -int(1) - --- Iteration 3 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(1) - --- Iteration 4 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - --- Iteration 5 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(2) - --- Iteration 6 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(2) - --- Iteration 7 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(8) - --- Iteration 8 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(1) - --- Iteration 9 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - --- Iteration 10 -- -int(1) - --- Iteration 11 -- -int(0) - --- Iteration 12 -- -int(1) - --- Iteration 13 -- -int(0) - --- Iteration 14 -- -int(0) - --- Iteration 15 -- -int(0) - --- Iteration 16 -- -bindec(): Argument #1 ($binary_string) must be of type string, array given - --- Iteration 17 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - --- Iteration 18 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - --- Iteration 19 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - --- Iteration 20 -- -bindec(): Argument #1 ($binary_string) must be of type string, resource given diff --git a/ext/standard/tests/math/bindec_variation1_64bit.phpt b/ext/standard/tests/math/bindec_variation1_64bit.phpt deleted file mode 100644 index 56bbbd35649b5..0000000000000 --- a/ext/standard/tests/math/bindec_variation1_64bit.phpt +++ /dev/null @@ -1,148 +0,0 @@ ---TEST-- -Test bindec() function : usage variations - different data types as $binary_string arg ---SKIPIF-- - ---FILE-- -getMessage(), "\n"; - } - $iterator++; -}; -fclose($fp); -?> ---EXPECTF-- -*** Testing bindec() : usage variations *** - --- Iteration 1 -- -int(0) - --- Iteration 2 -- -int(1) - --- Iteration 3 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(1) - --- Iteration 4 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - --- Iteration 5 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(2) - --- Iteration 6 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(2) - --- Iteration 7 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(8) - --- Iteration 8 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(1) - --- Iteration 9 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - --- Iteration 10 -- -int(1) - --- Iteration 11 -- -int(0) - --- Iteration 12 -- -int(1) - --- Iteration 13 -- -int(0) - --- Iteration 14 -- -int(0) - --- Iteration 15 -- -int(0) - --- Iteration 16 -- -bindec(): Argument #1 ($binary_string) must be of type string, array given - --- Iteration 17 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - --- Iteration 18 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - --- Iteration 19 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - --- Iteration 20 -- -bindec(): Argument #1 ($binary_string) must be of type string, resource given diff --git a/ext/standard/tests/math/ceil_basic.phpt b/ext/standard/tests/math/ceil_basic.phpt index 7bdc87d16eaf5..efe0760b5ecb2 100644 --- a/ext/standard/tests/math/ceil_basic.phpt +++ b/ext/standard/tests/math/ceil_basic.phpt @@ -4,56 +4,49 @@ Test ceil() - basic function test for ceil() precision=14 --FILE-- ---EXPECTF-- -*** Testing ceil() : basic functionality *** -float(0) -float(0) -float(1) -float(-0) -float(1) -float(-1) -float(2) -float(-1) -float(3) -float(-2) -float(31) -float(95) -float(11) -float(-10) -float(3950) -float(-3950) -float(39) -float(1) -float(0) - -Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) +--EXPECT-- +ceil(0): float(0) +ceil(0): float(0) +ceil(0.5): float(1) +ceil(-0.5): float(-0) +ceil(1): float(1) +ceil(-1): float(-1) +ceil(1.5): float(2) +ceil(-1.5): float(-1) +ceil(2.6): float(3) +ceil(-2.6): float(-2) +ceil(31): float(31) +ceil(95): float(95) +ceil(10.5): float(11) +ceil(-10.5): float(-10) +ceil(3.95E3): float(3950) +ceil(-3.95E3): float(-3950) +ceil(039): float(39) diff --git a/ext/standard/tests/math/ceil_variation1.phpt b/ext/standard/tests/math/ceil_variation1.phpt deleted file mode 100644 index 7751946ea9546..0000000000000 --- a/ext/standard/tests/math/ceil_variation1.phpt +++ /dev/null @@ -1,131 +0,0 @@ ---TEST-- -Test ceil() function : usage variations - different data types as $value arg ---INI-- -precision=14 ---FILE-- -getMessage(), "\n"; - } - $iterator++; -}; -fclose($fp); -?> ---EXPECTF-- -*** Testing ceil() : usage variations *** - --- Iteration 1 -- - -Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) - --- Iteration 2 -- - -Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) - --- Iteration 3 -- -float(1) - --- Iteration 4 -- -float(0) - --- Iteration 5 -- -float(1) - --- Iteration 6 -- -float(0) - --- Iteration 7 -- -ceil(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 8 -- -ceil(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 9 -- -ceil(): Argument #1 ($num) must be of type int|float, array given - --- Iteration 10 -- -ceil(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 11 -- -ceil(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 12 -- -ceil(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 13 -- -ceil(): Argument #1 ($num) must be of type int|float, classA given - --- Iteration 14 -- - -Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) - --- Iteration 15 -- - -Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) - --- Iteration 16 -- -ceil(): Argument #1 ($num) must be of type int|float, resource given diff --git a/ext/standard/tests/math/cos_variation.phpt b/ext/standard/tests/math/cos_variation.phpt index 19d72f60a795f..3e0d7698ed388 100644 --- a/ext/standard/tests/math/cos_variation.phpt +++ b/ext/standard/tests/math/cos_variation.phpt @@ -1,45 +1,24 @@ --TEST-- Test variations in usage of cos() --INI-- -serialize_precision = 10 +precision=14 --FILE-- --EXPECT-- -float(-0.5328330203) -float(-0.5328330203) -float(-0.1117112391) -float(-0.1117112391) -float(-0.5328330203) -float(-0.5328330203) -float(-0.5328330203) -float(-0.1117112391) -float(-0.1117112391) -float(0.5623790763) -float(0.5403023059) -float(1) +float(-0.5328330203333975) +float(-0.5328330203333975) +float(-0.11171123911915933) +float(-0.11171123911915933) +float(-0.11171123911915933) +float(-0.8390715290764524) +float(-0.6408264175949933) +float(-0.052737412665270565) diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt index 475c19fd50d6d..304c2b37b85f0 100644 --- a/ext/standard/tests/math/cosh_variation.phpt +++ b/ext/standard/tests/math/cosh_variation.phpt @@ -1,45 +1,24 @@ --TEST-- Test variations in usage of cosh() --INI-- -serialize_precision = 10 +precision=14 --FILE-- --EXPECT-- -float(4872401723) -float(4872401723) -float(7641446995) -float(7641446995) -float(4872401723) -float(4872401723) -float(4872401723) -float(7641446995) -float(7641446995) +float(4872401723.124452) +float(4872401723.124452) +float(7641446994.979367) +float(7641446994.979367) +float(7641446994.979367) +float(11013.232920103324) +float(14866.309443262266) float(INF) -float(1.543080635) -float(1) diff --git a/ext/standard/tests/math/data/numbers.inc b/ext/standard/tests/math/data/numbers.inc new file mode 100644 index 0000000000000..a18274f7623de --- /dev/null +++ b/ext/standard/tests/math/data/numbers.inc @@ -0,0 +1,12 @@ +getMessage() . "\n"; - } + var_dump(decbin($value)); } ?> ---EXPECTF-- +--EXPECT-- string(4) "1010" - -Deprecated: Implicit conversion from float 3950.5 to int loses precision in %s on line %d -string(12) "111101101110" - -Deprecated: Implicit conversion from float 3950.5 to int loses precision in %s on line %d -string(12) "111101101110" -string(2) "11" +string(5) "11101" string(7) "1011111" -string(4) "1010" - -Deprecated: Implicit conversion from float-string "3950.5" to int loses precision in %s on line %d -string(12) "111101101110" - -Deprecated: Implicit conversion from float-string "3.9505e3" to int loses precision in %s on line %d -string(12) "111101101110" -string(6) "100111" -decbin(): Argument #1 ($num) must be of type int, string given -string(1) "1" -string(1) "0" +string(12) "111111111111" +string(8) "11110101" +string(7) "1010101" diff --git a/ext/standard/tests/math/decbin_variation1.phpt b/ext/standard/tests/math/decbin_variation1.phpt deleted file mode 100644 index b2744bb1b6bf4..0000000000000 --- a/ext/standard/tests/math/decbin_variation1.phpt +++ /dev/null @@ -1,88 +0,0 @@ ---TEST-- -Test decbin() function : usage variations - different data types as $num arg ---INI-- -precision=14 ---SKIPIF-- - ---FILE-- - $input) { - $iterator = $i + 1; - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(decbin($input)); - } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; - } -} - -?> ---EXPECT-- -*** Testing decbin() : usage variations *** - --- Iteration 1 -- -string(1) "0" - --- Iteration 2 -- -string(1) "1" - --- Iteration 3 -- -string(14) "11000000111001" - --- Iteration 4 -- -string(32) "11111111111111111111011011010111" - --- Iteration 5 -- -decbin(): Argument #1 ($num) must be of type int, float given - --- Iteration 6 -- -decbin(): Argument #1 ($num) must be of type int, float given - --- Iteration 7 -- -decbin(): Argument #1 ($num) must be of type int, float given - --- Iteration 8 -- -string(1) "1" - --- Iteration 9 -- -string(1) "0" - --- Iteration 10 -- -string(1) "1" - --- Iteration 11 -- -string(1) "0" - --- Iteration 12 -- -decbin(): Argument #1 ($num) must be of type int, string given - --- Iteration 13 -- -decbin(): Argument #1 ($num) must be of type int, string given diff --git a/ext/standard/tests/math/decbin_variation1_64bit.phpt b/ext/standard/tests/math/decbin_variation1_64bit.phpt deleted file mode 100644 index 0d4e18307eab1..0000000000000 --- a/ext/standard/tests/math/decbin_variation1_64bit.phpt +++ /dev/null @@ -1,88 +0,0 @@ ---TEST-- -Test decbin() function : usage variations - different data types as $number arg ---INI-- -precision=14 ---SKIPIF-- - ---FILE-- - $input) { - $iterator = $i + 1; - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(decbin($input)); - } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; - } -} - -?> ---EXPECT-- -*** Testing decbin() : usage variations *** - --- Iteration 1 -- -string(1) "0" - --- Iteration 2 -- -string(1) "1" - --- Iteration 3 -- -string(14) "11000000111001" - --- Iteration 4 -- -string(64) "1111111111111111111111111111111111111111111111111111011011010111" - --- Iteration 5 -- -decbin(): Argument #1 ($num) must be of type int, float given - --- Iteration 6 -- -decbin(): Argument #1 ($num) must be of type int, float given - --- Iteration 7 -- -string(37) "1110010111110100110010001101000001000" - --- Iteration 8 -- -string(1) "1" - --- Iteration 9 -- -string(1) "0" - --- Iteration 10 -- -string(1) "1" - --- Iteration 11 -- -string(1) "0" - --- Iteration 12 -- -decbin(): Argument #1 ($num) must be of type int, string given - --- Iteration 13 -- -decbin(): Argument #1 ($num) must be of type int, string given diff --git a/ext/standard/tests/math/dechex_basic.phpt b/ext/standard/tests/math/dechex_basic.phpt index 04c1d393e7009..fd4c471f9ce4e 100644 --- a/ext/standard/tests/math/dechex_basic.phpt +++ b/ext/standard/tests/math/dechex_basic.phpt @@ -2,47 +2,22 @@ Test dechex() - basic function dechex() --FILE-- getMessage() . "\n"; - } + var_dump(dechex($value)); } ?> ---EXPECTF-- +--EXPECT-- string(1) "a" - -Deprecated: Implicit conversion from float 3950.5 to int loses precision in %s on line %d -string(3) "f6e" - -Deprecated: Implicit conversion from float 3950.5 to int loses precision in %s on line %d -string(3) "f6e" -string(1) "3" +string(2) "1d" string(2) "5f" -string(1) "a" - -Deprecated: Implicit conversion from float-string "3950.5" to int loses precision in %s on line %d -string(3) "f6e" - -Deprecated: Implicit conversion from float-string "3.9505e3" to int loses precision in %s on line %d -string(3) "f6e" -string(2) "27" -dechex(): Argument #1 ($num) must be of type int, string given -string(1) "1" -string(1) "0" +string(3) "fff" +string(2) "f5" diff --git a/ext/standard/tests/math/dechex_variation1.phpt b/ext/standard/tests/math/dechex_variation1.phpt deleted file mode 100644 index 4e014f35b7606..0000000000000 --- a/ext/standard/tests/math/dechex_variation1.phpt +++ /dev/null @@ -1,88 +0,0 @@ ---TEST-- -Test dechex() function : usage variations - different data types as $num arg ---INI-- -precision=14 ---SKIPIF-- - ---FILE-- - $input) { - $iterator = $i + 1; - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(dechex($input)); - } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; - } -} - -?> ---EXPECT-- -*** Testing dechex() : usage variations *** - --- Iteration 1 -- -string(1) "0" - --- Iteration 2 -- -string(1) "1" - --- Iteration 3 -- -string(4) "3039" - --- Iteration 4 -- -string(8) "fffff6d7" - --- Iteration 5 -- -dechex(): Argument #1 ($num) must be of type int, float given - --- Iteration 6 -- -dechex(): Argument #1 ($num) must be of type int, float given - --- Iteration 7 -- -dechex(): Argument #1 ($num) must be of type int, float given - --- Iteration 8 -- -string(1) "1" - --- Iteration 9 -- -string(1) "0" - --- Iteration 10 -- -string(1) "1" - --- Iteration 11 -- -string(1) "0" - --- Iteration 12 -- -dechex(): Argument #1 ($num) must be of type int, string given - --- Iteration 13 -- -dechex(): Argument #1 ($num) must be of type int, string given diff --git a/ext/standard/tests/math/dechex_variation1_64bit.phpt b/ext/standard/tests/math/dechex_variation1_64bit.phpt deleted file mode 100644 index bd597b2f996a6..0000000000000 --- a/ext/standard/tests/math/dechex_variation1_64bit.phpt +++ /dev/null @@ -1,88 +0,0 @@ ---TEST-- -Test dechex() function : usage variations - different data types as $number arg ---INI-- -precision=14 ---SKIPIF-- - ---FILE-- - $input) { - $iterator = $i + 1; - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(dechex($input)); - } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; - } -} - -?> ---EXPECT-- -*** Testing dechex() : usage variations *** - --- Iteration 1 -- -string(1) "0" - --- Iteration 2 -- -string(1) "1" - --- Iteration 3 -- -string(4) "3039" - --- Iteration 4 -- -string(16) "fffffffffffff6d7" - --- Iteration 5 -- -dechex(): Argument #1 ($num) must be of type int, float given - --- Iteration 6 -- -dechex(): Argument #1 ($num) must be of type int, float given - --- Iteration 7 -- -string(10) "1cbe991a08" - --- Iteration 8 -- -string(1) "1" - --- Iteration 9 -- -string(1) "0" - --- Iteration 10 -- -string(1) "1" - --- Iteration 11 -- -string(1) "0" - --- Iteration 12 -- -dechex(): Argument #1 ($num) must be of type int, string given - --- Iteration 13 -- -dechex(): Argument #1 ($num) must be of type int, string given diff --git a/ext/standard/tests/math/decoct_basic.phpt b/ext/standard/tests/math/decoct_basic.phpt index 30d6712bb47cc..c1c29e0e3f51f 100644 --- a/ext/standard/tests/math/decoct_basic.phpt +++ b/ext/standard/tests/math/decoct_basic.phpt @@ -2,47 +2,22 @@ Test decoct() - basic function test decoct() --FILE-- getMessage() . "\n"; - } + var_dump(decoct($value)); } ?> ---EXPECTF-- +--EXPECT-- string(2) "12" - -Deprecated: Implicit conversion from float 3950.5 to int loses precision in %s on line %d -string(4) "7556" - -Deprecated: Implicit conversion from float 3950.5 to int loses precision in %s on line %d -string(4) "7556" -string(1) "3" +string(2) "35" string(3) "137" -string(2) "12" - -Deprecated: Implicit conversion from float-string "3950.5" to int loses precision in %s on line %d -string(4) "7556" - -Deprecated: Implicit conversion from float-string "3.9505e3" to int loses precision in %s on line %d -string(4) "7556" -string(2) "47" -decoct(): Argument #1 ($num) must be of type int, string given -string(1) "1" -string(1) "0" +string(4) "7777" +string(3) "365" diff --git a/ext/standard/tests/math/decoct_variation1.phpt b/ext/standard/tests/math/decoct_variation1.phpt deleted file mode 100644 index 1936464fd4b39..0000000000000 --- a/ext/standard/tests/math/decoct_variation1.phpt +++ /dev/null @@ -1,88 +0,0 @@ ---TEST-- -Test decoct() function : usage variations - different data types as $num arg ---INI-- -precision=14 ---SKIPIF-- - ---FILE-- - $input) { - $iterator = $i + 1; - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(decoct($input)); - } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; - } -} - -?> ---EXPECT-- -*** Testing decoct() : usage variations *** - --- Iteration 1 -- -string(1) "0" - --- Iteration 2 -- -string(1) "1" - --- Iteration 3 -- -string(5) "30071" - --- Iteration 4 -- -string(11) "37777773327" - --- Iteration 5 -- -decoct(): Argument #1 ($num) must be of type int, float given - --- Iteration 6 -- -decoct(): Argument #1 ($num) must be of type int, float given - --- Iteration 7 -- -decoct(): Argument #1 ($num) must be of type int, float given - --- Iteration 8 -- -string(1) "1" - --- Iteration 9 -- -string(1) "0" - --- Iteration 10 -- -string(1) "1" - --- Iteration 11 -- -string(1) "0" - --- Iteration 12 -- -decoct(): Argument #1 ($num) must be of type int, string given - --- Iteration 13 -- -decoct(): Argument #1 ($num) must be of type int, string given diff --git a/ext/standard/tests/math/decoct_variation1_64bit.phpt b/ext/standard/tests/math/decoct_variation1_64bit.phpt deleted file mode 100644 index cc4b69f07560f..0000000000000 --- a/ext/standard/tests/math/decoct_variation1_64bit.phpt +++ /dev/null @@ -1,88 +0,0 @@ ---TEST-- -Test decoct() function : usage variations - different data types as $number arg ---INI-- -precision=14 ---SKIPIF-- - ---FILE-- - $input) { - $iterator = $i + 1; - echo "\n-- Iteration $iterator --\n"; - try { - var_dump(decoct($input)); - } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; - } -} - -?> ---EXPECT-- -*** Testing decoct() : usage variations *** - --- Iteration 1 -- -string(1) "0" - --- Iteration 2 -- -string(1) "1" - --- Iteration 3 -- -string(5) "30071" - --- Iteration 4 -- -string(22) "1777777777777777773327" - --- Iteration 5 -- -decoct(): Argument #1 ($num) must be of type int, float given - --- Iteration 6 -- -decoct(): Argument #1 ($num) must be of type int, float given - --- Iteration 7 -- -string(13) "1627646215010" - --- Iteration 8 -- -string(1) "1" - --- Iteration 9 -- -string(1) "0" - --- Iteration 10 -- -string(1) "1" - --- Iteration 11 -- -string(1) "0" - --- Iteration 12 -- -decoct(): Argument #1 ($num) must be of type int, string given - --- Iteration 13 -- -decoct(): Argument #1 ($num) must be of type int, string given diff --git a/ext/standard/tests/math/deg2rad_variation.phpt b/ext/standard/tests/math/deg2rad_variation.phpt index 47a5a893679a5..6457a24c8b735 100644 --- a/ext/standard/tests/math/deg2rad_variation.phpt +++ b/ext/standard/tests/math/deg2rad_variation.phpt @@ -1,31 +1,14 @@ --TEST-- Test variations in usage of deg2rad() --INI-- -precision = 10 +precision=14 --FILE-- --EXPECT-- --- Iteration 1 -- -float(22026.465794807) - --- Iteration 2 -- -float(29732.618852891) - --- Iteration 3 -- -float(INF) - --- Iteration 4 -- -float(29048849665247) - --- Iteration 5 -- -float(1.811239082889E+41) - --- Iteration 6 -- -float(22026.465794807) - --- Iteration 7 -- -float(INF) - --- Iteration 8 -- +float(9744803446.248903) +float(1.026187963170189E-10) +float(15282893989.958735) +float(15282893989.958735) +float(6.543263341727205E-11) +float(22026.465794806718) +float(29732.618852891435) float(INF) - --- Iteration 9 -- -float(8.6593400423994E+16) - --- Iteration 10 -- -float(2.718281828459) - --- Iteration 11 -- -float(1) diff --git a/ext/standard/tests/math/expm1_basic.phpt b/ext/standard/tests/math/expm1_basic.phpt index ea4c165da2c46..6e499318e92fe 100644 --- a/ext/standard/tests/math/expm1_basic.phpt +++ b/ext/standard/tests/math/expm1_basic.phpt @@ -1,63 +1,22 @@ --TEST-- Test expm1() - basic function test for expm1() --INI-- -serialize_precision=14 +precision=14 --FILE-- --EXPECT-- -*** Testing expm1() : basic functionality *** - --- Iteration 1 -- -float(22025.465794807) - --- Iteration 2 -- -float(29731.618852891) - --- Iteration 3 -- -float(INF) - --- Iteration 4 -- -float(29048849665246) - --- Iteration 5 -- -float(1.811239082889E+41) - --- Iteration 6 -- -float(22025.465794807) - --- Iteration 7 -- -float(INF) - --- Iteration 8 -- +float(9744803445.248903) +float(-0.9999999998973812) +float(15282893988.958735) +float(15282893988.958735) +float(-0.9999999999345673) +float(22025.465794806718) +float(29731.618852891435) float(INF) - --- Iteration 9 -- -float(8.6593400423994E+16) - --- Iteration 10 -- -float(1.718281828459) - --- Iteration 11 -- -float(0) diff --git a/ext/standard/tests/math/floor_basic.phpt b/ext/standard/tests/math/floor_basic.phpt index 308a055f808a3..d3460eb179293 100644 --- a/ext/standard/tests/math/floor_basic.phpt +++ b/ext/standard/tests/math/floor_basic.phpt @@ -4,96 +4,48 @@ Test floor() - basic function test for floor() precision=14 --FILE-- ---EXPECTF-- -*** Testing floor() : basic functionality *** - --- floor 0 -- -float(0) - --- floor 0 -- -float(0) - --- floor 0.5 -- -float(0) - --- floor -0.5 -- -float(-1) - --- floor 1 -- -float(1) - --- floor -1 -- -float(-1) - --- floor 1.5 -- -float(1) - --- floor -1.5 -- -float(-2) - --- floor 2.6 -- -float(2) - --- floor -2.6 -- -float(-3) - --- floor 31 -- -float(31) - --- floor 95 -- -float(95) - --- floor 10.5 -- -float(10) - --- floor -10.5 -- -float(-11) - --- floor 3.95E3 -- -float(3950) - --- floor -3.95E3 -- -float(-3950) - --- floor 039 -- -float(39) - --- floor 1 -- -float(1) - --- floor -- -float(0) - --- floor -- - -Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) +--EXPECT-- +floor(0): float(0) +floor(0): float(0) +floor(0.5): float(0) +floor(-0.5): float(-1) +floor(1): float(1) +floor(-1): float(-1) +floor(1.5): float(1) +floor(-1.5): float(-2) +floor(2.6): float(2) +floor(-2.6): float(-3) +floor(31): float(31) +floor(95): float(95) +floor(10.5): float(10) +floor(-10.5): float(-11) +floor(3.95E3): float(3950) +floor(-3.95E3): float(-3950) +floor(039): float(39) diff --git a/ext/standard/tests/math/floor_variation1.phpt b/ext/standard/tests/math/floor_variation1.phpt deleted file mode 100644 index c9ec5e710c512..0000000000000 --- a/ext/standard/tests/math/floor_variation1.phpt +++ /dev/null @@ -1,131 +0,0 @@ ---TEST-- -Test floor() function : usage variations - different data types as $value arg ---INI-- -precision=14 ---FILE-- -getMessage(), "\n"; - } - $iterator++; -}; -fclose($fp); -?> ---EXPECTF-- -*** Testing floor() : usage variations *** - --- Iteration 1 -- - -Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) - --- Iteration 2 -- - -Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) - --- Iteration 3 -- -float(1) - --- Iteration 4 -- -float(0) - --- Iteration 5 -- -float(1) - --- Iteration 6 -- -float(0) - --- Iteration 7 -- -floor(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 8 -- -floor(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 9 -- -floor(): Argument #1 ($num) must be of type int|float, array given - --- Iteration 10 -- -floor(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 11 -- -floor(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 12 -- -floor(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 13 -- -floor(): Argument #1 ($num) must be of type int|float, classA given - --- Iteration 14 -- - -Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) - --- Iteration 15 -- - -Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) - --- Iteration 16 -- -floor(): Argument #1 ($num) must be of type int|float, resource given diff --git a/ext/standard/tests/math/fmod_basic.phpt b/ext/standard/tests/math/fmod_basic.phpt index 84cd27125c412..06ceec902fe50 100644 --- a/ext/standard/tests/math/fmod_basic.phpt +++ b/ext/standard/tests/math/fmod_basic.phpt @@ -4,178 +4,42 @@ Test fmod() - basic function test fmod() precision=14 --FILE-- --EXPECT-- -iteration 0 -float(0) -float(0) -float(4) -float(4) -float(0) -float(0) -float(0) -float(1.700000000000018) -float(4) -float(0) -float(NAN) - -iteration 1 -float(-0) -float(-0) -float(-4) -float(-4) -float(-0) -float(-0) -float(-0) -float(-1.700000000000018) -float(-4) -float(-0) -float(NAN) - -iteration 2 -float(0.5) -float(0.5) -float(4.5) -float(4.5) -float(0.5) -float(0.5) -float(0.5) -float(2.200000000000018) -float(4.5) -float(0.5) -float(NAN) - -iteration 3 -float(-0.5) -float(-0.5) -float(-4.5) -float(-4.5) -float(-0.5) -float(-0.5) -float(-0.5) -float(-2.200000000000018) -float(-4.5) -float(-0.5) -float(NAN) - -iteration 4 -float(0) -float(0) -float(4) -float(4) -float(0) -float(0) -float(0) -float(1.700000000000018) -float(4) -float(0) -float(NAN) - -iteration 5 -float(0) -float(0) -float(4) -float(4) -float(0) -float(0) -float(0) -float(1.700000000000018) -float(4) -float(0) -float(NAN) - -iteration 6 -float(0) -float(0) -float(4) -float(4) -float(0) -float(0) -float(0) -float(1.700000000000018) -float(4) -float(0) -float(NAN) - -iteration 7 -float(0.5) -float(0.5) -float(4.5) -float(4.5) -float(0.5) -float(0.5) -float(0.5) -float(2.200000000000018) -float(4.5) -float(0.5) -float(NAN) - -iteration 8 -float(0.5) -float(0.5) -float(4.5) -float(4.5) -float(0.5) -float(0.5) -float(0.5) -float(2.200000000000018) -float(4.5) -float(0.5) -float(NAN) - -iteration 9 -float(1) -float(1) -float(1) -float(1) -float(1) -float(1) -float(1) -float(1) -float(1) -float(0) -float(NAN) - -iteration 10 -float(0) -float(0) -float(0) -float(0) -float(0) -float(0) -float(0) -float(0) -float(0) -float(0) -float(NAN) +fmod(234, 2): float(0) +fmod(234, -2): float(0) +fmod(234, 23): float(4) +fmod(234, -23): float(4) +fmod(-234, 2): float(-0) +fmod(-234, -2): float(-0) +fmod(-234, 23): float(-4) +fmod(-234, -23): float(-4) +fmod(234.5, 2): float(0.5) +fmod(234.5, -2): float(0.5) +fmod(234.5, 23): float(4.5) +fmod(234.5, -23): float(4.5) +fmod(-234.5, 2): float(-0.5) +fmod(-234.5, -2): float(-0.5) +fmod(-234.5, 23): float(-4.5) +fmod(-234.5, -23): float(-4.5) diff --git a/ext/standard/tests/math/hexdec.phpt b/ext/standard/tests/math/hexdec.phpt index ba09875efc393..0d0b36d7ec5e0 100644 --- a/ext/standard/tests/math/hexdec.phpt +++ b/ext/standard/tests/math/hexdec.phpt @@ -1,30 +1,60 @@ --TEST-- -overflow check for _php_math_basetozval +Basic hexdec() test --INI-- precision=14 --FILE-- 'ABCD', + 0x1777 => '1777', + 0x7FFFFFFF => '7FFFFFFF', + 0x80000000 => '80000000', +]; -?> ---EXPECTF-- -int(74565) -int(74565) +$values_leading = [ + 0xABCD => '0ABCD', + 0x1777 => '01777', + 0x7FFFFFFF => '07FFFFFFF', + 0x80000000 => '080000000', +]; + +$values_leading_explicit = [ + 0xABCD => '0xABCD', + 0x1777 => '0x1777', + 0x7FFFFFFF => '0x7FFFFFFF', + 0x80000000 => '0x80000000', +]; -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(74565) +foreach ($values as $nb => $value) { + echo "hexdec('$value') should be $nb is "; + $res = hexdec($value); + var_dump($res); +} -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(74565) +foreach ($values_leading as $nb => $value) { + echo "hexdec('$value') should be $nb is "; + $res = hexdec($value); + var_dump($res); +} -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(74565) -float(78187069441) -float(6442450943) +foreach ($values_leading_explicit as $nb => $value) { + echo "hexdec('$value') should be $nb is "; + $res = hexdec($value); + var_dump($res); +} + +?> +--EXPECT-- +hexdec('ABCD') should be 43981 is int(43981) +hexdec('1777') should be 6007 is int(6007) +hexdec('7FFFFFFF') should be 2147483647 is int(2147483647) +hexdec('80000000') should be 2147483648 is int(2147483648) +hexdec('0ABCD') should be 43981 is int(43981) +hexdec('01777') should be 6007 is int(6007) +hexdec('07FFFFFFF') should be 2147483647 is int(2147483647) +hexdec('080000000') should be 2147483648 is int(2147483648) +hexdec('0xABCD') should be 43981 is int(43981) +hexdec('0x1777') should be 6007 is int(6007) +hexdec('0x7FFFFFFF') should be 2147483647 is int(2147483647) +hexdec('0x80000000') should be 2147483648 is int(2147483648) diff --git a/ext/standard/tests/math/hexdec_basic.phpt b/ext/standard/tests/math/hexdec_basic.phpt deleted file mode 100644 index 2f06b9650aed3..0000000000000 --- a/ext/standard/tests/math/hexdec_basic.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -Test hexdec() - basic function test hexdec() ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -int(18433668) -int(126895953) -float(142929835591) -float(142929835592) -int(1194684) -int(7904751) -int(2147483647) -float(2147483648) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(1194684) -int(3215381) -int(3215381) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(3215379) -int(51446064) -int(18279) -int(70199) -int(1) -int(0) diff --git a/ext/standard/tests/math/hexdec_basic_64bit.phpt b/ext/standard/tests/math/hexdec_basic_64bit.phpt deleted file mode 100644 index fd6d53b601982..0000000000000 --- a/ext/standard/tests/math/hexdec_basic_64bit.phpt +++ /dev/null @@ -1,92 +0,0 @@ ---TEST-- -Test hexdec() - basic function test hexdec() ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -*** Testing hexdec() : basic functionality *** - --- hexdec 1194684 -- -int(18433668) - --- hexdec 7904751 -- -int(126895953) - --- hexdec 2147483647 -- -int(142929835591) - --- hexdec 2147483648 -- -int(142929835592) - --- hexdec 0x123abc -- -int(1194684) - --- hexdec 0x789DEF -- -int(7904751) - --- hexdec 0x7FFFFFFF -- -int(2147483647) - --- hexdec 0x80000000 -- -int(2147483648) - --- hexdec 0x123XYZABC -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(1194684) - --- hexdec 311015 -- -int(3215381) - --- hexdec 311015 -- -int(3215381) - --- hexdec 31101.3 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(3215379) - --- hexdec 3110130 -- -int(51446064) - --- hexdec 4767 -- -int(18279) - --- hexdec 011237 -- -int(70199) - --- hexdec 1 -- -int(1) - --- hexdec -- -int(0) diff --git a/ext/standard/tests/math/hexdec_invalid.phpt b/ext/standard/tests/math/hexdec_invalid.phpt new file mode 100644 index 0000000000000..b3eb253264186 --- /dev/null +++ b/ext/standard/tests/math/hexdec_invalid.phpt @@ -0,0 +1,30 @@ +--TEST-- +hexdec(): with invalid chars +--INI-- +precision=14 +--FILE-- + 'ABCDg', + 0x1777 => '1777?!+', + -0xABCD => '-ABCD', +]; + +foreach ($values as $nb => $value) { + echo "hexdec('$value') should be $nb is"; + $res = hexdec($value); + var_dump($res); +} + +?> +--EXPECTF-- +hexdec('ABCDg') should be 43981 is +Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d +int(43981) +hexdec('1777?!+') should be 6007 is +Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d +int(6007) +hexdec('-ABCD') should be -43981 is +Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d +int(43981) diff --git a/ext/standard/tests/math/hexdec_variation1.phpt b/ext/standard/tests/math/hexdec_variation1.phpt deleted file mode 100644 index 65ebbe347b9b6..0000000000000 --- a/ext/standard/tests/math/hexdec_variation1.phpt +++ /dev/null @@ -1,154 +0,0 @@ ---TEST-- -Test hexdec() function : usage variations - different data types as $number arg ---INI-- -precision=14 ---SKIPIF-- - ---FILE-- -getMessage(), "\n"; - } - $iterator++; -}; -fclose($fp); -?> ---EXPECTF-- -*** Testing hexdec() : usage variations *** - --- Iteration 1 -- -int(0) - --- Iteration 2 -- -int(1) - --- Iteration 3 -- -int(74565) - --- Iteration 4 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(9029) - --- Iteration 5 -- -float(285960729237) - --- Iteration 6 -- -float(285960729238) - --- Iteration 7 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(261) - --- Iteration 8 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(261) - --- Iteration 9 -- -float(20015998341120) - --- Iteration 10 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -float(1250999896553) - --- Iteration 11 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(5) - --- Iteration 12 -- -int(1) - --- Iteration 13 -- -int(0) - --- Iteration 14 -- -int(1) - --- Iteration 15 -- -int(0) - --- Iteration 16 -- -int(0) - --- Iteration 17 -- -int(0) - --- Iteration 18 -- -hexdec(): Argument #1 ($hex_string) must be of type string, array given - --- Iteration 19 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(2748) - --- Iteration 20 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(2748) - --- Iteration 21 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(2748) - --- Iteration 22 -- -hexdec(): Argument #1 ($hex_string) must be of type string, resource given diff --git a/ext/standard/tests/math/hexdec_variation1_64bit.phpt b/ext/standard/tests/math/hexdec_variation1_64bit.phpt deleted file mode 100644 index c892b8049fc9a..0000000000000 --- a/ext/standard/tests/math/hexdec_variation1_64bit.phpt +++ /dev/null @@ -1,154 +0,0 @@ ---TEST-- -Test hexdec() function : usage variations - different data types as $number arg ---INI-- -precision=14 ---SKIPIF-- - ---FILE-- -getMessage(), "\n"; - } - $iterator++; -}; -fclose($fp); -?> ---EXPECTF-- -*** Testing hexdec() : usage variations *** - --- Iteration 1 -- -int(0) - --- Iteration 2 -- -int(1) - --- Iteration 3 -- -int(74565) - --- Iteration 4 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(9029) - --- Iteration 5 -- -int(285960729237) - --- Iteration 6 -- -int(285960729238) - --- Iteration 7 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(261) - --- Iteration 8 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(261) - --- Iteration 9 -- -int(20015998341120) - --- Iteration 10 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(1250999896553) - --- Iteration 11 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(5) - --- Iteration 12 -- -int(1) - --- Iteration 13 -- -int(0) - --- Iteration 14 -- -int(1) - --- Iteration 15 -- -int(0) - --- Iteration 16 -- -int(0) - --- Iteration 17 -- -int(0) - --- Iteration 18 -- -hexdec(): Argument #1 ($hex_string) must be of type string, array given - --- Iteration 19 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(2748) - --- Iteration 20 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(2748) - --- Iteration 21 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(2748) - --- Iteration 22 -- -hexdec(): Argument #1 ($hex_string) must be of type string, resource given diff --git a/ext/standard/tests/math/hypot_basic.phpt b/ext/standard/tests/math/hypot_basic.phpt index 750d688a1705a..d54f9393880da 100644 --- a/ext/standard/tests/math/hypot_basic.phpt +++ b/ext/standard/tests/math/hypot_basic.phpt @@ -1,285 +1,57 @@ --TEST-- Test hypot() - basic function test hypot() --INI-- -serialize_precision=15 +precision=14 --FILE-- --EXPECT-- -*** Testing hypot() : basic functionality *** - -Y:23 X:33 float(40.2243707222375) - -Y:23 X:-33 float(40.2243707222375) - -Y:23 X:33.45 float(40.5943653725489) - -Y:23 X:-33.45 float(40.5943653725489) - -Y:23 X:39 float(45.2769256906871) - -Y:23 X:31 float(38.6005181312376) - -Y:23 X:33 float(40.2243707222375) - -Y:23 X:43.45 float(49.1620026036369) - -Y:23 X:1.345e1 float(26.6439955712352) - -Y:23 X:1 float(23.0217288664427) - -Y:23 X: float(23) - -Y:-23 X:33 float(40.2243707222375) - -Y:-23 X:-33 float(40.2243707222375) - -Y:-23 X:33.45 float(40.5943653725489) - -Y:-23 X:-33.45 float(40.5943653725489) - -Y:-23 X:39 float(45.2769256906871) - -Y:-23 X:31 float(38.6005181312376) - -Y:-23 X:33 float(40.2243707222375) - -Y:-23 X:43.45 float(49.1620026036369) - -Y:-23 X:1.345e1 float(26.6439955712352) - -Y:-23 X:1 float(23.0217288664427) - -Y:-23 X: float(23) - -Y:23.45 X:33 float(40.483360779461) - -Y:23.45 X:-33 float(40.483360779461) - -Y:23.45 X:33.45 float(40.8510097794412) - -Y:23.45 X:-33.45 float(40.8510097794412) - -Y:23.45 X:39 float(45.5071697647744) - -Y:23.45 X:31 float(38.8703293014093) - -Y:23.45 X:33 float(40.483360779461) - -Y:23.45 X:43.45 float(49.3741329037787) - -Y:23.45 X:1.345e1 float(27.033405260899) - -Y:23.45 X:1 float(23.4713122769052) - -Y:23.45 X: float(23.45) - -Y:-23.45 X:33 float(40.483360779461) - -Y:-23.45 X:-33 float(40.483360779461) - -Y:-23.45 X:33.45 float(40.8510097794412) - -Y:-23.45 X:-33.45 float(40.8510097794412) - -Y:-23.45 X:39 float(45.5071697647744) - -Y:-23.45 X:31 float(38.8703293014093) - -Y:-23.45 X:33 float(40.483360779461) - -Y:-23.45 X:43.45 float(49.3741329037787) - -Y:-23.45 X:1.345e1 float(27.033405260899) - -Y:-23.45 X:1 float(23.4713122769052) - -Y:-23.45 X: float(23.45) - -Y:23 X:33 float(40.2243707222375) - -Y:23 X:-33 float(40.2243707222375) - -Y:23 X:33.45 float(40.5943653725489) - -Y:23 X:-33.45 float(40.5943653725489) - -Y:23 X:39 float(45.2769256906871) - -Y:23 X:31 float(38.6005181312376) - -Y:23 X:33 float(40.2243707222375) - -Y:23 X:43.45 float(49.1620026036369) - -Y:23 X:1.345e1 float(26.6439955712352) - -Y:23 X:1 float(23.0217288664427) - -Y:23 X: float(23) - -Y:23 X:33 float(40.2243707222375) - -Y:23 X:-33 float(40.2243707222375) - -Y:23 X:33.45 float(40.5943653725489) - -Y:23 X:-33.45 float(40.5943653725489) - -Y:23 X:39 float(45.2769256906871) - -Y:23 X:31 float(38.6005181312376) - -Y:23 X:33 float(40.2243707222375) - -Y:23 X:43.45 float(49.1620026036369) - -Y:23 X:1.345e1 float(26.6439955712352) - -Y:23 X:1 float(23.0217288664427) - -Y:23 X: float(23) - -Y:23 X:33 float(40.2243707222375) - -Y:23 X:-33 float(40.2243707222375) - -Y:23 X:33.45 float(40.5943653725489) - -Y:23 X:-33.45 float(40.5943653725489) - -Y:23 X:39 float(45.2769256906871) - -Y:23 X:31 float(38.6005181312376) - -Y:23 X:33 float(40.2243707222375) - -Y:23 X:43.45 float(49.1620026036369) - -Y:23 X:1.345e1 float(26.6439955712352) - -Y:23 X:1 float(23.0217288664427) - -Y:23 X: float(23) - -Y:23.45 X:33 float(40.483360779461) - -Y:23.45 X:-33 float(40.483360779461) - -Y:23.45 X:33.45 float(40.8510097794412) - -Y:23.45 X:-33.45 float(40.8510097794412) - -Y:23.45 X:39 float(45.5071697647744) - -Y:23.45 X:31 float(38.8703293014093) - -Y:23.45 X:33 float(40.483360779461) - -Y:23.45 X:43.45 float(49.3741329037787) - -Y:23.45 X:1.345e1 float(27.033405260899) - -Y:23.45 X:1 float(23.4713122769052) - -Y:23.45 X: float(23.45) - -Y:2.345e1 X:33 float(40.483360779461) - -Y:2.345e1 X:-33 float(40.483360779461) - -Y:2.345e1 X:33.45 float(40.8510097794412) - -Y:2.345e1 X:-33.45 float(40.8510097794412) - -Y:2.345e1 X:39 float(45.5071697647744) - -Y:2.345e1 X:31 float(38.8703293014093) - -Y:2.345e1 X:33 float(40.483360779461) - -Y:2.345e1 X:43.45 float(49.3741329037787) - -Y:2.345e1 X:1.345e1 float(27.033405260899) - -Y:2.345e1 X:1 float(23.4713122769052) - -Y:2.345e1 X: float(23.45) - -Y:1 X:33 float(33.0151480384384) - -Y:1 X:-33 float(33.0151480384384) - -Y:1 X:33.45 float(33.4649443447916) - -Y:1 X:-33.45 float(33.4649443447916) - -Y:1 X:39 float(39.0128184062623) - -Y:1 X:31 float(31.0161248385416) - -Y:1 X:33 float(33.0151480384384) - -Y:1 X:43.45 float(43.4615059564208) - -Y:1 X:1.345e1 float(13.4871234887206) - -Y:1 X:1 float(1.4142135623731) - -Y:1 X: float(1) - -Y: X:33 float(33) - -Y: X:-33 float(33) - -Y: X:33.45 float(33.45) - -Y: X:-33.45 float(33.45) - -Y: X:39 float(39) - -Y: X:31 float(31) - -Y: X:33 float(33) - -Y: X:43.45 float(43.45) - -Y: X:1.345e1 float(13.45) - -Y: X:1 float(1) - -Y: X: float(0) +hypot(y: 23, x: 33): float(40.22437072223753) +hypot(y: 23, x: -33): float(40.22437072223753) +hypot(y: 23, x: 33.45): float(40.594365372548936) +hypot(y: 23, x: -33.45): float(40.594365372548936) +hypot(y: -23, x: 33): float(40.22437072223753) +hypot(y: -23, x: -33): float(40.22437072223753) +hypot(y: -23, x: 33.45): float(40.594365372548936) +hypot(y: -23, x: -33.45): float(40.594365372548936) +hypot(y: 23.45, x: 33): float(40.48336077946099) +hypot(y: 23.45, x: -33): float(40.48336077946099) +hypot(y: 23.45, x: 33.45): float(40.85100977944119) +hypot(y: 23.45, x: -33.45): float(40.85100977944119) +hypot(y: 23.45, x: 33): float(40.48336077946099) +hypot(y: 23.45, x: -33): float(40.48336077946099) +hypot(y: 23.45, x: 33.45): float(40.85100977944119) +hypot(y: 23.45, x: -33.45): float(40.85100977944119) +hypot(y: -23.45, x: 33): float(40.48336077946099) +hypot(y: -23.45, x: -33): float(40.48336077946099) +hypot(y: -23.45, x: 33.45): float(40.85100977944119) +hypot(y: -23.45, x: -33.45): float(40.85100977944119) +hypot(y: 10, x: 33): float(34.48187929913333) +hypot(y: 10, x: -33): float(34.48187929913333) +hypot(y: 10, x: 33.45): float(34.91278419146774) +hypot(y: 10, x: -33.45): float(34.91278419146774) +hypot(y: 10.3, x: 33): float(34.57007376329996) +hypot(y: 10.3, x: -33): float(34.57007376329996) +hypot(y: 10.3, x: 33.45): float(34.99989285697887) +hypot(y: 10.3, x: -33.45): float(34.99989285697887) +hypot(y: 3950.5, x: 33): float(3950.6378282500154) +hypot(y: 3950.5, x: -33): float(3950.6378282500154) +hypot(y: 3950.5, x: 33.45): float(3950.6416127636785) +hypot(y: 3950.5, x: -33.45): float(3950.6416127636785) diff --git a/ext/standard/tests/math/is_finite_basic.phpt b/ext/standard/tests/math/is_finite_basic.phpt index 99af66be4e78d..73354e5dff8f8 100644 --- a/ext/standard/tests/math/is_finite_basic.phpt +++ b/ext/standard/tests/math/is_finite_basic.phpt @@ -2,22 +2,16 @@ Test is_finite() - basic function test is_finite() --FILE-- @@ -27,12 +21,5 @@ bool(true) bool(true) bool(true) bool(true) -bool(true) -bool(true) -bool(true) -bool(true) -bool(true) -bool(true) -bool(true) bool(false) bool(false) diff --git a/ext/standard/tests/math/is_infinite_basic.phpt b/ext/standard/tests/math/is_infinite_basic.phpt index 599bdd635fba1..4644a55554a21 100644 --- a/ext/standard/tests/math/is_infinite_basic.phpt +++ b/ext/standard/tests/math/is_infinite_basic.phpt @@ -2,22 +2,16 @@ Test is_infinite() - basic function test is_infinite() --FILE-- @@ -27,12 +21,5 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) bool(true) bool(false) diff --git a/ext/standard/tests/math/is_nan_basic.phpt b/ext/standard/tests/math/is_nan_basic.phpt index f0111e00e979e..d05b58e066e24 100644 --- a/ext/standard/tests/math/is_nan_basic.phpt +++ b/ext/standard/tests/math/is_nan_basic.phpt @@ -2,23 +2,16 @@ Test is_nan() - basic function test is_nan() --FILE-- --EXPECT-- -*** Testing log1p() : basic functionality *** - - LOG1p tests - --- log1p 23 -- -float(3.1780538303479458) - --- log1p -23 -- -float(NAN) - --- log1p 23.45 -- -float(3.196630215920881) - --- log1p -23.45 -- -float(NAN) - --- log1p 23 -- -float(3.1780538303479458) - --- log1p 23 -- -float(3.1780538303479458) - --- log1p 23 -- -float(3.1780538303479458) - --- log1p 23.45 -- -float(3.196630215920881) - --- log1p 2.345e1 -- -float(3.196630215920881) - --- log1p 1 -- -float(0.6931471805599453) - --- log1p -- -float(0) +log1p(23): float(3.1780538303479458) +log1p(-23): float(NAN) +log1p(23.45): float(3.196630215920881) +log1p(23.45): float(3.196630215920881) +log1p(-23.45): float(NAN) +log1p(10): float(2.3978952727983707) +log1p(10.3): float(2.424802725718295) +log1p(3950.5): float(8.28185053264503) diff --git a/ext/standard/tests/math/log_basic.phpt b/ext/standard/tests/math/log_basic.phpt index ae2e790bcceb3..a9fbb21f87e40 100644 --- a/ext/standard/tests/math/log_basic.phpt +++ b/ext/standard/tests/math/log_basic.phpt @@ -4,27 +4,17 @@ Test log() - basic function test log() precision=14 --FILE-- @@ -33,24 +23,18 @@ LOG tests...no base float(3.1354942159291497) float(NAN) float(3.1548704948922883) -float(NAN) -float(3.1354942159291497) -float(3.1354942159291497) -float(3.1354942159291497) -float(3.1548704948922883) float(3.1548704948922883) -float(0) -float(-INF) +float(NAN) +float(2.302585092994046) +float(2.33214389523559) +float(8.281597432162789) - LOG tests...base +LOG tests...base 4 float(2.2617809780285065) float(NAN) float(2.275758008814007) -float(NAN) -float(2.2617809780285065) -float(2.2617809780285065) -float(2.2617809780285065) -float(2.275758008814007) float(2.275758008814007) -float(0) -float(-INF) +float(NAN) +float(1.6609640474436813) +float(1.682286216147928) +float(5.973909773010015) diff --git a/ext/standard/tests/math/number_format_basic.phpt b/ext/standard/tests/math/number_format_basic.phpt index 40b00d1a4f632..cfe3ca0466415 100644 --- a/ext/standard/tests/math/number_format_basic.phpt +++ b/ext/standard/tests/math/number_format_basic.phpt @@ -2,49 +2,44 @@ Test number_format() - basic function test number_format() --FILE-- @@ -53,83 +48,44 @@ number_format tests.....default string(5) "1,235" string(6) "-1,235" string(10) "12,346,578" -string(11) "-12,345,679" +string(10) "12,345,679" string(7) "999,999" string(8) "-999,999" string(7) "999,999" string(8) "-999,999" -string(11) "305,450,479" -string(11) "402,653,183" -string(11) "123,456,789" -string(3) "123" -string(3) "123" -string(1) "1" -string(1) "0" - - number_format tests.....with two dp +number_format tests.....with two dp string(8) "1,234.57" string(9) "-1,234.57" string(13) "12,346,578.00" -string(14) "-12,345,678.90" +string(13) "12,345,678.90" string(10) "999,999.00" string(11) "-999,999.00" string(10) "999,999.00" string(11) "-999,999.00" -string(14) "305,450,479.00" -string(14) "402,653,183.00" -string(14) "123,456,789.00" -string(6) "123.46" -string(6) "123.46" -string(4) "1.00" -string(4) "0.00" - - number_format tests.....English format +number_format tests.....English format string(8) "1 234.57" string(9) "-1 234.57" string(13) "12 346 578.00" -string(14) "-12 345 678.90" +string(13) "12 345 678.90" string(10) "999 999.00" string(11) "-999 999.00" string(10) "999 999.00" string(11) "-999 999.00" -string(14) "305 450 479.00" -string(14) "402 653 183.00" -string(14) "123 456 789.00" -string(6) "123.46" -string(6) "123.46" -string(4) "1.00" -string(4) "0.00" - - number_format tests.....French format +number_format tests.....French format string(8) "1 234,57" string(9) "-1 234,57" string(13) "12 346 578,00" -string(14) "-12 345 678,90" +string(13) "12 345 678,90" string(10) "999 999,00" string(11) "-999 999,00" string(10) "999 999,00" string(11) "-999 999,00" -string(14) "305 450 479,00" -string(14) "402 653 183,00" -string(14) "123 456 789,00" -string(6) "123,46" -string(6) "123,46" -string(4) "1,00" -string(4) "0,00" - - number_format tests.....multichar format +number_format tests.....multichar format string(26) "1 THOUSAND 234 DECIMALS 57" string(27) "-1 THOUSAND 234 DECIMALS 57" string(40) "12 THOUSAND 346 THOUSAND 578 DECIMALS 00" -string(41) "-12 THOUSAND 345 THOUSAND 678 DECIMALS 90" +string(40) "12 THOUSAND 345 THOUSAND 678 DECIMALS 90" string(28) "999 THOUSAND 999 DECIMALS 00" string(29) "-999 THOUSAND 999 DECIMALS 00" string(28) "999 THOUSAND 999 DECIMALS 00" string(29) "-999 THOUSAND 999 DECIMALS 00" -string(41) "305 THOUSAND 450 THOUSAND 479 DECIMALS 00" -string(41) "402 THOUSAND 653 THOUSAND 183 DECIMALS 00" -string(41) "123 THOUSAND 456 THOUSAND 789 DECIMALS 00" -string(15) "123 DECIMALS 46" -string(15) "123 DECIMALS 46" -string(13) "1 DECIMALS 00" -string(13) "0 DECIMALS 00" diff --git a/ext/standard/tests/math/number_format_multichar.phpt b/ext/standard/tests/math/number_format_multichar.phpt deleted file mode 100644 index 1ed823042f18e..0000000000000 --- a/ext/standard/tests/math/number_format_multichar.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -Test number_format() - multiple character separator support ---FILE-- - ---EXPECT-- -number_format tests.....multiple character decimal point -string(13) "1 234·57" -string(14) "-1 234·57" -string(18) "12 346 578·00" -string(19) "-12 345 678·90" -string(19) "305 450 479·00" -string(19) "402 653 183·00" -string(19) "123 456 789·00" -string(11) "123·46" -string(11) "123·46" -string(9) "1·00" -string(9) "0·00" - - number_format tests.....multiple character thousand separator -string(15) "1 234.57" -string(16) "-1 234.57" -string(27) "12 346 578.00" -string(28) "-12 345 678.90" -string(28) "305 450 479.00" -string(28) "402 653 183.00" -string(28) "123 456 789.00" -string(6) "123.46" -string(6) "123.46" -string(4) "1.00" -string(4) "0.00" - - number_format tests.....multiple character decimal and thousep -string(20) "1 234·57" -string(21) "-1 234·57" -string(32) "12 346 578·00" -string(33) "-12 345 678·90" -string(33) "305 450 479·00" -string(33) "402 653 183·00" -string(33) "123 456 789·00" -string(11) "123·46" -string(11) "123·46" -string(9) "1·00" -string(9) "0·00" diff --git a/ext/standard/tests/math/octdec_basic.phpt b/ext/standard/tests/math/octdec_basic.phpt index 4c3ffc8b8a91b..f8b0963517a92 100644 --- a/ext/standard/tests/math/octdec_basic.phpt +++ b/ext/standard/tests/math/octdec_basic.phpt @@ -1,59 +1,46 @@ --TEST-- -Test octdec() - basic function test octdec() ---SKIPIF-- - +octdec(): basic --FILE-- ---EXPECTF-- -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(14489) -int(253) +$values = [ + 0o567 => '567', + 0o17777777777 => '17777777777', +]; -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(36947879) +$values_leading = [ + 0o567 => '0567', + 0o17777777777 => '017777777777', +]; -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(4618484) +$values_leading_explicit = [ + 0o567 => '0o567', + 0o17777777777 => '0o17777777777', +]; -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(4104) -int(5349) -int(342391) -int(375) -int(2147483647) -float(2147483648) +foreach ($values as $nb => $value) { + echo "octdec('$value') should be $nb is "; + $res = octdec($value); + var_dump($res); +} -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(668) -int(5349) +foreach ($values_leading as $nb => $value) { + echo "octdec('$value') should be $nb is "; + $res = octdec($value); + var_dump($res); +} + +foreach ($values_leading_explicit as $nb => $value) { + echo "octdec('$value') should be $nb is "; + $res = octdec($value); + var_dump($res); +} -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(102923) -int(823384) -int(1) -int(0) +?> +--EXPECT-- +octdec('567') should be 375 is int(375) +octdec('17777777777') should be 2147483647 is int(2147483647) +octdec('0567') should be 375 is int(375) +octdec('017777777777') should be 2147483647 is int(2147483647) +octdec('0o567') should be 375 is int(375) +octdec('0o17777777777') should be 2147483647 is int(2147483647) diff --git a/ext/standard/tests/math/octdec_basic_64bit.phpt b/ext/standard/tests/math/octdec_basic_64bit.phpt deleted file mode 100644 index 4051d9be63230..0000000000000 --- a/ext/standard/tests/math/octdec_basic_64bit.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -Test octdec() - basic function test octdec() ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -*** Testing octdec() : basic functionality *** - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(14489) -int(253) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(36947879) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(4618484) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(4104) -int(5349) -int(342391) -int(375) -int(2147483647) -int(2147483648) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(668) -int(5349) - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(102923) -int(823384) -int(1) -int(0) diff --git a/ext/standard/tests/math/octdec_invalid.phpt b/ext/standard/tests/math/octdec_invalid.phpt new file mode 100644 index 0000000000000..4edfb47cf6638 --- /dev/null +++ b/ext/standard/tests/math/octdec_invalid.phpt @@ -0,0 +1,25 @@ +--TEST-- +octdec(): invalid chars +--FILE-- + '-567', + 0o177 => '1779', + 0o177 => '177+j', +]; + +foreach ($values as $nb => $value) { + echo "octdec('$value') should be $nb is"; + $res = octdec($value); + var_dump($res); +} + +?> +--EXPECTF-- +octdec('-567') should be -375 is +Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d +int(375) +octdec('177+j') should be 127 is +Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d +int(127) diff --git a/ext/standard/tests/math/octdec_large_32.phpt b/ext/standard/tests/math/octdec_large_32.phpt new file mode 100644 index 0000000000000..41cf53cb6fd47 --- /dev/null +++ b/ext/standard/tests/math/octdec_large_32.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test octdec() with number larger than 32 bit (32bit platform) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +octdec('020000000000') should be 2147483648 is float(2147483648) +octdec('20000000000') should be 2147483648 is float(2147483648) diff --git a/ext/standard/tests/math/octdec_large_64.phpt b/ext/standard/tests/math/octdec_large_64.phpt new file mode 100644 index 0000000000000..2fb63691a721b --- /dev/null +++ b/ext/standard/tests/math/octdec_large_64.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test octdec() with number larger than 32 bit (64bit platform) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +octdec('020000000000') should be 2147483648 is int(2147483648) +octdec('20000000000') should be 2147483648 is int(2147483648) diff --git a/ext/standard/tests/math/octdec_variation1.phpt b/ext/standard/tests/math/octdec_variation1.phpt deleted file mode 100644 index c24d2e8e6beae..0000000000000 --- a/ext/standard/tests/math/octdec_variation1.phpt +++ /dev/null @@ -1,158 +0,0 @@ ---TEST-- -Test octdec() function : usage variations - different data types as $octal_string arg ---INI-- -precision=14 ---FILE-- -getMessage(), "\n"; - } - $iterator++; -}; -fclose($fp); -?> ----Done--- ---EXPECTF-- -*** Testing octdec() : usage variations *** - --- Iteration 1 -- -int(0) - --- Iteration 2 -- -int(1) - --- Iteration 3 -- -int(5349) - --- Iteration 4 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(1253) - --- Iteration 5 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(1134037) - --- Iteration 6 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(1134038) - --- Iteration 7 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(69) - --- Iteration 8 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(69) - --- Iteration 9 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(175304192) - --- Iteration 10 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(342391) - --- Iteration 11 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(5) - --- Iteration 12 -- -int(1) - --- Iteration 13 -- -int(0) - --- Iteration 14 -- -int(1) - --- Iteration 15 -- -int(0) - --- Iteration 16 -- -int(0) - --- Iteration 17 -- -int(0) - --- Iteration 18 -- -octdec(): Argument #1 ($octal_string) must be of type string, array given - --- Iteration 19 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - --- Iteration 20 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - --- Iteration 21 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) - --- Iteration 22 -- -octdec(): Argument #1 ($octal_string) must be of type string, resource given ----Done--- diff --git a/ext/standard/tests/math/rad2deg_variation.phpt b/ext/standard/tests/math/rad2deg_variation.phpt index 3cc1317ea8357..3aa55ca3f5705 100644 --- a/ext/standard/tests/math/rad2deg_variation.phpt +++ b/ext/standard/tests/math/rad2deg_variation.phpt @@ -4,28 +4,11 @@ Test variations in usage of rad2deg() precision = 10 --FILE-- "; +$values = [ + 123456789, + 123.456789, + -4.5679123, + 1.23E4, + -4.567E3, +]; + +$precisions = [ + 2, + 8, + -2, + -8, +]; + +foreach ($values as $value) { + echo "round: $value\n"; + foreach ($precisions as $precision) { + echo "....with precision $precision: "; + $res = round($value, $precision); var_dump($res); } } ?> ---EXPECTF-- +--EXPECT-- *** Testing round() : basic functionality *** round: 123456789 -...with precision 2-> float(123456789) -...with precision 8-> float(123456789) -...with precision 3-> float(123456789) -...with precision 4-> float(123456789) - -Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d -...with precision 3.6-> float(123456789) -...with precision 2-> float(123456789) -...with precision 04-> float(123456789) - -Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d -...with precision 3.6-> float(123456789) -...with precision 2.1e1-> float(123456789) -...with precision 1-> float(123456789) -...with precision -> float(123456789) +....with precision 2: float(123456789) +....with precision 8: float(123456789) +....with precision -2: float(123456800) +....with precision -8: float(100000000) round: 123.456789 -...with precision 2-> float(123.46) -...with precision 8-> float(123.456789) -...with precision 3-> float(123.457) -...with precision 4-> float(123.4568) - -Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d -...with precision 3.6-> float(123.457) -...with precision 2-> float(123.46) -...with precision 04-> float(123.4568) - -Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d -...with precision 3.6-> float(123.457) -...with precision 2.1e1-> float(123.456789) -...with precision 1-> float(123.5) -...with precision -> float(123) +....with precision 2: float(123.46) +....with precision 8: float(123.456789) +....with precision -2: float(100) +....with precision -8: float(0) round: -4.5679123 -...with precision 2-> float(-4.57) -...with precision 8-> float(-4.5679123) -...with precision 3-> float(-4.568) -...with precision 4-> float(-4.5679) - -Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d -...with precision 3.6-> float(-4.568) -...with precision 2-> float(-4.57) -...with precision 04-> float(-4.5679) - -Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d -...with precision 3.6-> float(-4.568) -...with precision 2.1e1-> float(-4.5679123) -...with precision 1-> float(-4.6) -...with precision -> float(-5) +....with precision 2: float(-4.57) +....with precision 8: float(-4.5679123) +....with precision -2: float(-0) +....with precision -8: float(-0) round: 12300 -...with precision 2-> float(12300) -...with precision 8-> float(12300) -...with precision 3-> float(12300) -...with precision 4-> float(12300) - -Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d -...with precision 3.6-> float(12300) -...with precision 2-> float(12300) -...with precision 04-> float(12300) - -Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d -...with precision 3.6-> float(12300) -...with precision 2.1e1-> float(12300) -...with precision 1-> float(12300) -...with precision -> float(12300) +....with precision 2: float(12300) +....with precision 8: float(12300) +....with precision -2: float(12300) +....with precision -8: float(0) round: -4567 -...with precision 2-> float(-4567) -...with precision 8-> float(-4567) -...with precision 3-> float(-4567) -...with precision 4-> float(-4567) - -Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d -...with precision 3.6-> float(-4567) -...with precision 2-> float(-4567) -...with precision 04-> float(-4567) - -Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d -...with precision 3.6-> float(-4567) -...with precision 2.1e1-> float(-4567) -...with precision 1-> float(-4567) -...with precision -> float(-4567) -round: 2311527 -...with precision 2-> float(2311527) -...with precision 8-> float(2311527) -...with precision 3-> float(2311527) -...with precision 4-> float(2311527) - -Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d -...with precision 3.6-> float(2311527) -...with precision 2-> float(2311527) -...with precision 04-> float(2311527) - -Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d -...with precision 3.6-> float(2311527) -...with precision 2.1e1-> float(2311527) -...with precision 1-> float(2311527) -...with precision -> float(2311527) -round: 14680063 -...with precision 2-> float(14680063) -...with precision 8-> float(14680063) -...with precision 3-> float(14680063) -...with precision 4-> float(14680063) - -Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d -...with precision 3.6-> float(14680063) -...with precision 2-> float(14680063) -...with precision 04-> float(14680063) - -Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d -...with precision 3.6-> float(14680063) -...with precision 2.1e1-> float(14680063) -...with precision 1-> float(14680063) -...with precision -> float(14680063) -round: 1.234567 -...with precision 2-> float(1.23) -...with precision 8-> float(1.234567) -...with precision 3-> float(1.235) -...with precision 4-> float(1.2346) - -Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d -...with precision 3.6-> float(1.235) -...with precision 2-> float(1.23) -...with precision 04-> float(1.2346) - -Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d -...with precision 3.6-> float(1.235) -...with precision 2.1e1-> float(1.234567) -...with precision 1-> float(1.2) -...with precision -> float(1) -round: 2.3456789e8 -...with precision 2-> float(234567890) -...with precision 8-> float(234567890) -...with precision 3-> float(234567890) -...with precision 4-> float(234567890) - -Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d -...with precision 3.6-> float(234567890) -...with precision 2-> float(234567890) -...with precision 04-> float(234567890) - -Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d -...with precision 3.6-> float(234567890) -...with precision 2.1e1-> float(234567890) -...with precision 1-> float(234567890) -...with precision -> float(234567890) +....with precision 2: float(-4567) +....with precision 8: float(-4567) +....with precision -2: float(-4600) +....with precision -8: float(-0) diff --git a/ext/standard/tests/math/round_variation1.phpt b/ext/standard/tests/math/round_variation1.phpt deleted file mode 100644 index 2a2adf27cae09..0000000000000 --- a/ext/standard/tests/math/round_variation1.phpt +++ /dev/null @@ -1,175 +0,0 @@ ---TEST-- -Test round() function : usage variations - different data types as $val argument ---INI-- -precision=14 ---FILE-- -getMessage(), "\n"; - } - $iterator++; -}; -fclose($fp); -?> ---EXPECTF-- -*** Testing round() : usage variations *** - --- Iteration 1 -- -float(0) - --- Iteration 2 -- -float(1) - --- Iteration 3 -- -float(12345) - --- Iteration 4 -- -float(-2345) - --- Iteration 5 -- -float(2147483647) - --- Iteration 6 -- -float(10.5) - --- Iteration 7 -- -float(-10.5) - --- Iteration 8 -- -float(123456789000) - --- Iteration 9 -- -float(1.23457E-9) - --- Iteration 10 -- -float(0.5) - --- Iteration 11 -- - -Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) - --- Iteration 12 -- - -Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) - --- Iteration 13 -- -float(1) - --- Iteration 14 -- -float(0) - --- Iteration 15 -- -float(1) - --- Iteration 16 -- -float(0) - --- Iteration 17 -- -round(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 18 -- -round(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 19 -- -round(): Argument #1 ($num) must be of type int|float, array given - --- Iteration 20 -- -round(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 21 -- -round(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 22 -- -round(): Argument #1 ($num) must be of type int|float, string given - --- Iteration 23 -- -round(): Argument #1 ($num) must be of type int|float, classA given - --- Iteration 24 -- - -Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) - --- Iteration 25 -- - -Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d -float(0) - --- Iteration 26 -- -round(): Argument #1 ($num) must be of type int|float, resource given diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt index 6cca50a167730..bbf4866ca0179 100644 --- a/ext/standard/tests/math/sin_variation.phpt +++ b/ext/standard/tests/math/sin_variation.phpt @@ -1,45 +1,24 @@ --TEST-- Test variations in usage of sin() --INI-- -serialize_precision = 10 +precision=14 --FILE-- --EXPECT-- -float(-0.8462204042) -float(0.8462204042) -float(-0.9937407102) -float(0.9937407102) -float(-0.8462204042) -float(-0.8462204042) -float(-0.8462204042) -float(-0.9937407102) -float(-0.9937407102) -float(0.8268795405) -float(0.8414709848) -float(0) +float(-0.8462204041751706) +float(0.8462204041751706) +float(-0.9937407101726596) +float(-0.9937407101726596) +float(0.9937407101726596) +float(-0.5440211108893698) +float(-0.7676858097635825) +float(-0.9986084143974419) diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt index f053e58144ee1..8632f331cd3d7 100644 --- a/ext/standard/tests/math/sinh_variation.phpt +++ b/ext/standard/tests/math/sinh_variation.phpt @@ -1,45 +1,24 @@ --TEST-- Test variations in usage of sinh() --INI-- -serialize_precision = 10 +precision=14 --FILE-- --EXPECT-- -float(4872401723) -float(-4872401723) -float(7641446995) -float(-7641446995) -float(4872401723) -float(4872401723) -float(4872401723) -float(7641446995) -float(7641446995) +float(4872401723.124452) +float(-4872401723.124452) +float(7641446994.979367) +float(7641446994.979367) +float(-7641446994.979367) +float(11013.232874703393) +float(14866.30940962917) float(INF) -float(1.175201194) -float(0) diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt index eb73870d1fc3c..461c70d440349 100644 --- a/ext/standard/tests/math/sqrt_variation.phpt +++ b/ext/standard/tests/math/sqrt_variation.phpt @@ -1,47 +1,24 @@ --TEST-- Test variations in usage of sqrt() --INI-- -precision = 14 +precision=14 --FILE-- --EXPECT-- -*** Testing sqrt() : usage variations *** float(4.795831523312719) float(NAN) float(4.8425200051213) -float(NAN) -float(4.795831523312719) -float(4.795831523312719) -float(4.795831523312719) -float(4.8425200051213) float(4.8425200051213) -float(31.622776601683793) -float(1) -float(0) +float(NAN) +float(3.1622776601683795) +float(3.2093613071762426) +float(62.853003110432205) diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt index 4394ddcd57a83..b08e185303683 100644 --- a/ext/standard/tests/math/tan_variation.phpt +++ b/ext/standard/tests/math/tan_variation.phpt @@ -1,45 +1,24 @@ --TEST-- Test variations in usage of tan() --INI-- -serialize_precision = 10 +precision=14 --FILE-- --EXPECT-- -float(1.588153083) -float(-1.588153083) -float(8.895619796) -float(-8.895619796) -float(1.588153083) -float(1.588153083) -float(1.588153083) -float(8.895619796) -float(8.895619796) -float(1.470324156) -float(1.557407725) -float(0) +float(1.5881530833912738) +float(-1.5881530833912738) +float(8.895619796255806) +float(8.895619796255806) +float(-8.895619796255806) +float(0.6483608274590866) +float(1.1979621761610415) +float(18.935483633520395) diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt index d2011f4745727..a8268bed581b0 100644 --- a/ext/standard/tests/math/tanh_variation.phpt +++ b/ext/standard/tests/math/tanh_variation.phpt @@ -1,31 +1,13 @@ --TEST-- Test variations in usage of tanh() --INI-- -precision = 10 +precision=14 --FILE-- --EXPECTF-- diff --git a/ext/standard/tests/network/inet_ipv6.phpt b/ext/standard/tests/network/inet_ipv6.phpt index 7b894ad703728..0832e1dfec549 100644 --- a/ext/standard/tests/network/inet_ipv6.phpt +++ b/ext/standard/tests/network/inet_ipv6.phpt @@ -12,23 +12,25 @@ if (stristr(PHP_OS, "darwin") !== false) die("skip MacOS has broken inet_*() fun --FILE-- --EXPECT-- @@ -37,8 +39,9 @@ string(3) "::2" string(4) "::35" string(5) "::255" string(6) "::1024" -bool(false) string(36) "2001:db8:85a3:8d3:1319:8a2e:370:7344" string(15) "2001:db8:1234::" string(38) "2001:db8:1234:ffff:ffff:ffff:ffff:ffff" +bool(false) +bool(false) Done diff --git a/ext/standard/tests/streams/bug70198.phpt b/ext/standard/tests/streams/bug70198.phpt index 0e122b66e8e7d..93283cb680828 100644 --- a/ext/standard/tests/streams/bug70198.phpt +++ b/ext/standard/tests/streams/bug70198.phpt @@ -45,7 +45,7 @@ $fp = stream_socket_client($srv_addr, $errno, $errstr, 2); if (!$fp) { echo "$errstr ($errno)\n"; } else { - stream_set_blocking($fp, 0); + stream_set_blocking($fp, false); sleep(2); while (!feof($fp)) { ++$i; diff --git a/ext/standard/tests/streams/proc_open_bug69900.phpt b/ext/standard/tests/streams/proc_open_bug69900.phpt index 323fc4a079cc6..ab5303a94b591 100644 --- a/ext/standard/tests/streams/proc_open_bug69900.phpt +++ b/ext/standard/tests/streams/proc_open_bug69900.phpt @@ -32,9 +32,9 @@ for($i = 0; $i < 10; $i++){ fwrite($pipes[0], "hello$i\r\n"); fflush($pipes[0]); - $t0 = microtime(1); + $t0 = microtime(true); $s = fgets($pipes[1]); - $t1 = microtime(1); + $t1 = microtime(true); echo $s; diff --git a/ext/standard/tests/streams/stream_get_line_nb.phpt b/ext/standard/tests/streams/stream_get_line_nb.phpt index 40a609537442f..c5614057dd438 100644 --- a/ext/standard/tests/streams/stream_get_line_nb.phpt +++ b/ext/standard/tests/streams/stream_get_line_nb.phpt @@ -18,7 +18,7 @@ fclose($sockets[1]); $sockets = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0); var_dump($sockets); -stream_set_blocking($sockets[1], 0); +stream_set_blocking($sockets[1], false); $eol = ''; 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 4413312b7eb46..6cf5012ca0215 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 @@ -18,11 +18,11 @@ $socket = stream_socket_accept($server); var_dump(stream_get_meta_data($client)); echo "\n\nSet blocking to false:\n"; -var_dump(socket_set_blocking($client, 0)); +var_dump(socket_set_blocking($client, false)); var_dump(stream_get_meta_data($client)); echo "\n\nSet blocking to true:\n"; -var_dump(socket_set_blocking($client, 1)); +var_dump(socket_set_blocking($client, true)); var_dump(stream_get_meta_data($client)); fclose($client); diff --git a/ext/standard/tests/streams/stream_socket_pair.phpt b/ext/standard/tests/streams/stream_socket_pair.phpt index b926c9d9f4387..90cc71a9dcad7 100644 --- a/ext/standard/tests/streams/stream_socket_pair.phpt +++ b/ext/standard/tests/streams/stream_socket_pair.phpt @@ -2,7 +2,7 @@ stream_socket_pair() --FILE-- --EXPECT-- Length of original string: 130 diff --git a/ext/standard/tests/strings/bug33605.phpt b/ext/standard/tests/strings/bug33605.phpt index 94b57b20dcd08..befbcf2b685c1 100644 --- a/ext/standard/tests/strings/bug33605.phpt +++ b/ext/standard/tests/strings/bug33605.phpt @@ -3,7 +3,7 @@ Bug #33605 (substr_compare crashes) --FILE-- getMessage(); } diff --git a/ext/standard/tests/strings/chop_variation5.phpt b/ext/standard/tests/strings/chop_variation5.phpt index 2b86a9713b77f..5c5a6328f748a 100644 --- a/ext/standard/tests/strings/chop_variation5.phpt +++ b/ext/standard/tests/strings/chop_variation5.phpt @@ -10,7 +10,6 @@ echo "*** Testing chop() : with miscellaneous arguments ***\n"; var_dump ( chop("chop test \t\0 ") ); /* without second Argument */ var_dump ( chop("chop test " , "") ); /* no characters in second Argument */ - var_dump ( chop("chop test ", true) ); /* with boolean value as second Argument */ var_dump ( chop("chop test ", " ") ); /* with single space as second Argument */ var_dump ( chop("chop test \t\n\r\0\x0B", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */ var_dump ( chop("chop testABCXYZ", "A..Z") ); /* with characters range as second Argument */ @@ -23,7 +22,6 @@ echo "Done\n"; *** Testing chop() : with miscellaneous arguments *** string(9) "chop test" string(12) "chop test " -string(17) "chop test " string(9) "chop test" string(10) "chop test " string(9) "chop test" diff --git a/ext/standard/tests/strings/chr_variation1.phpt b/ext/standard/tests/strings/chr_variation1.phpt deleted file mode 100644 index f045fdb54a005..0000000000000 --- a/ext/standard/tests/strings/chr_variation1.phpt +++ /dev/null @@ -1,77 +0,0 @@ ---TEST-- -Test chr() function : usage variations - test values for $ascii argument ---FILE-- - ---EXPECTF-- -*** Testing chr() function: with unexpected inputs for 'ascii' argument *** --- Iteration 1 -- -string(2) "00" --- Iteration 2 -- -string(2) "01" --- Iteration 3 -- -string(2) "ff" --- Iteration 4 -- -string(2) "00" --- Iteration 5 -- - -Deprecated: Implicit conversion from float 10.5 to int loses precision in %s on line %d -string(2) "0a" --- Iteration 6 -- - -Deprecated: Implicit conversion from float -20.5 to int loses precision in %s on line %d -string(2) "ec" --- Iteration 7 -- -string(2) "48" --- Iteration 8 -- -string(2) "01" --- Iteration 9 -- -string(2) "00" --- Iteration 10 -- -string(2) "01" --- Iteration 11 -- -string(2) "00" diff --git a/ext/standard/tests/strings/join_variation1.phpt b/ext/standard/tests/strings/join_variation1.phpt deleted file mode 100644 index 256f361460b24..0000000000000 --- a/ext/standard/tests/strings/join_variation1.phpt +++ /dev/null @@ -1,133 +0,0 @@ ---TEST-- -Test join() function : usage variations - unexpected values for 'glue' argument ---FILE-- - 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new test(), - - // empty string - "", - '', - - // resource variable - $fp, -); - - -// loop through each element of the array and check the working of join() -// when $glue argument is supplied with different values -echo "\n--- Testing join() by supplying different values for 'glue' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $glue = $values [$index]; - - try { - var_dump(join($glue, $pieces)); - } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; - } - - $counter++; -} - -echo "Done\n"; -?> ---EXPECT-- -*** Testing join() : usage variations *** - ---- Testing join() by supplying different values for 'glue' argument --- --- Iteration 1 -- -string(17) "element10element2" --- Iteration 2 -- -string(17) "element11element2" --- Iteration 3 -- -string(21) "element112345element2" --- Iteration 4 -- -string(21) "element1-2345element2" --- Iteration 5 -- -string(20) "element110.5element2" --- Iteration 6 -- -string(21) "element1-10.5element2" --- Iteration 7 -- -string(28) "element1101234567000element2" --- Iteration 8 -- -string(29) "element11.07654321E-9element2" --- Iteration 9 -- -string(19) "element10.5element2" --- Iteration 10 -- -join(): Argument #1 ($separator) must be of type string, array given --- Iteration 11 -- -join(): Argument #1 ($separator) must be of type string, array given --- Iteration 12 -- -join(): Argument #1 ($separator) must be of type string, array given --- Iteration 13 -- -join(): Argument #1 ($separator) must be of type string, array given --- Iteration 14 -- -join(): Argument #1 ($separator) must be of type string, array given --- Iteration 15 -- -string(17) "element11element2" --- Iteration 16 -- -string(16) "element1element2" --- Iteration 17 -- -string(17) "element11element2" --- Iteration 18 -- -string(16) "element1element2" --- Iteration 19 -- -string(26) "element1testObjectelement2" --- Iteration 20 -- -string(16) "element1element2" --- Iteration 21 -- -string(16) "element1element2" --- Iteration 22 -- -join(): Argument #1 ($separator) must be of type array|string, resource given -Done diff --git a/ext/standard/tests/strings/join_variation4.phpt b/ext/standard/tests/strings/join_variation4.phpt deleted file mode 100644 index 21774b4bca2e2..0000000000000 --- a/ext/standard/tests/strings/join_variation4.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -Test join() function : usage variations - different values for 'glue' argument ---FILE-- -getMessage() . "\n"; - } - $counter++; -} - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing join() : usage variations *** --- Iteration 1 -- -string(87) "2TRUE0TRUE-639TRUE-1.3444TRUE1TRUEPHPTRUETRUETRUE TRUE6999.99999999TRUEstring%0with%0...%0" --- Iteration 2 -- -string(57) "2101-6391-1.3444111PHP111 16999.999999991string%0with%0...%0" --- Iteration 3 -- -string(47) "20-639-1.34441PHP 6999.99999999string%0with%0...%0" --- Iteration 4 -- -join(): Argument #1 ($separator) must be of type string, array given --- Iteration 5 -- -string(47) "20-639-1.34441PHP 6999.99999999string%0with%0...%0" --- Iteration 6 -- -string(57) "2 0 -639 -1.3444 1 PHP 6999.99999999 string%0with%0...%0" --- Iteration 7 -- -string(187) "2string%0between0string%0between-639string%0between-1.3444string%0between1string%0betweenPHPstring%0betweenstring%0betweenstring%0between string%0between6999.99999999string%0betweenstring%0with%0...%0" --- Iteration 8 -- -string(117) "2-1.56660-1.5666-639-1.5666-1.3444-1.56661-1.5666PHP-1.5666-1.5666-1.5666 -1.56666999.99999999-1.5666string%0with%0...%0" --- Iteration 9 -- -string(57) "2000-6390-1.3444010PHP000 06999.999999990string%0with%0...%0" --- Iteration 10 -- -string(67) "2\00\0-639\0-1.3444\01\0PHP\0\0\0 \06999.99999999\0string%0with%0...%0" -Done diff --git a/ext/standard/tests/strings/number_format_basic.phpt b/ext/standard/tests/strings/number_format_basic.phpt deleted file mode 100644 index 2e54eb1f0d5ae..0000000000000 --- a/ext/standard/tests/strings/number_format_basic.phpt +++ /dev/null @@ -1,96 +0,0 @@ ---TEST-- -Test number_format() - basic function test number_format() ---FILE-- - ---EXPECT-- -*** Testing number_format() : basic functionality *** - --- number_format tests.....default -- -string(5) "1,235" -string(6) "-1,235" -string(10) "12,346,578" -string(11) "-12,345,679" -string(11) "305,450,479" -string(11) "402,653,183" -string(11) "123,456,789" -string(3) "123" -string(3) "123" -string(1) "1" -string(1) "0" - --- number_format tests.....with two dp -- -string(8) "1,234.57" -string(9) "-1,234.57" -string(13) "12,346,578.00" -string(14) "-12,345,678.90" -string(14) "305,450,479.00" -string(14) "402,653,183.00" -string(14) "123,456,789.00" -string(6) "123.46" -string(6) "123.46" -string(4) "1.00" -string(4) "0.00" - --- number_format tests.....English format -- -string(8) "1 234.57" -string(9) "-1 234.57" -string(13) "12 346 578.00" -string(14) "-12 345 678.90" -string(14) "305 450 479.00" -string(14) "402 653 183.00" -string(14) "123 456 789.00" -string(6) "123.46" -string(6) "123.46" -string(4) "1.00" -string(4) "0.00" - --- number_format tests.....French format -- -string(8) "1 234,57" -string(9) "-1 234,57" -string(13) "12 346 578,00" -string(14) "-12 345 678,90" -string(14) "305 450 479,00" -string(14) "402 653 183,00" -string(14) "123 456 789,00" -string(6) "123,46" -string(6) "123,46" -string(4) "1,00" -string(4) "0,00" diff --git a/ext/standard/tests/strings/quoted_printable_encode_001.phpt b/ext/standard/tests/strings/quoted_printable_encode_001.phpt index a1e0ec1338aa2..5d436014334ff 100644 --- a/ext/standard/tests/strings/quoted_printable_encode_001.phpt +++ b/ext/standard/tests/strings/quoted_printable_encode_001.phpt @@ -6,14 +6,9 @@ quoted_printable_encode() tests - 1 var_dump(quoted_printable_encode("")); var_dump(quoted_printable_encode("test")); -var_dump(quoted_printable_encode(1)); -var_dump(quoted_printable_encode(false)); - echo "Done\n"; ?> --EXPECT-- string(0) "" string(4) "test" -string(1) "1" -string(0) "" Done diff --git a/ext/standard/tests/strings/rtrim.phpt b/ext/standard/tests/strings/rtrim.phpt index 21e91c1ac361c..09dd8f82dc60f 100644 --- a/ext/standard/tests/strings/rtrim.phpt +++ b/ext/standard/tests/strings/rtrim.phpt @@ -8,24 +8,12 @@ Testing rtrim() function echo "\n *** Output for Normal Behaviour ***\n"; var_dump ( rtrim("rtrim test \t\0 ") ); /* without second Argument */ var_dump ( rtrim("rtrim test " , "") ); /* no characters in second Argument */ - var_dump ( rtrim("rtrim test ", true) ); /* with boolean value as second Argument */ var_dump ( rtrim("rtrim test ", " ") ); /* with single space as second Argument */ var_dump ( rtrim("rtrim test \t\n\r\0\x0B", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */ var_dump ( rtrim("rtrim testABCXYZ", "A..Z") ); /* with characters range as second Argument */ var_dump ( rtrim("rtrim test0123456789", "0..9") ); /* with numbers range as second Argument */ var_dump ( rtrim("rtrim test$#@", "#@$") ); /* with some special characters as second Argument */ - -/* Use of class and objects */ -echo "\n*** Checking with OBJECTS ***\n"; -class string1 { - public function __toString() { - return "Object"; - } -} -$obj = new string1; -var_dump( rtrim($obj, "tc") ); - /* String with embedded NULL */ echo "\n*** String with embedded NULL ***\n"; var_dump( rtrim("234\x0005678\x0000efgh\xijkl\x0n1", "\x0n1") ); @@ -45,7 +33,6 @@ echo "Done\n"; *** Output for Normal Behaviour *** string(10) "rtrim test" string(13) "rtrim test " -string(18) "rtrim test " string(10) "rtrim test" string(11) "rtrim test " string(10) "rtrim test" diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt index 51d093a65fa22..18b384e026963 100644 --- a/ext/standard/tests/strings/substr_compare.phpt +++ b/ext/standard/tests/strings/substr_compare.phpt @@ -20,7 +20,7 @@ try { } catch (\ValueError $e) { echo $e->getMessage() . "\n"; } -var_dump(substr_compare("abcde", "abc", -1, NULL, -5) > 0); +var_dump(substr_compare("abcde", "abc", -1, NULL, true) > 0); ?> --EXPECT-- bool(true) diff --git a/ext/standard/tests/strings/substr_replace.phpt b/ext/standard/tests/strings/substr_replace.phpt index 852c014b50242..009a69b5c8ff6 100644 --- a/ext/standard/tests/strings/substr_replace.phpt +++ b/ext/standard/tests/strings/substr_replace.phpt @@ -34,10 +34,10 @@ $str = "try this"; $repl = array("bala "); $start = 4; $len = 3; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1)."")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).", ".var_export($start, true)."")."\n"; var_dump(substr_replace($str, $repl, $start))."\n"; echo "\n"; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1)."")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).", ".var_export($start, true)."")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -51,22 +51,22 @@ $str = array("ala portokala"); $repl = array("bala "); $start = array(4); $len = array(3); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1)."")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).", ".var_export($start, true)."")."\n"; var_dump(substr_replace($str, $repl, $start))."\n"; echo "\n"; $len = array(3); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).", ".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; $len = array(0); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).", ".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; $len = array(-2); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).", ".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -79,7 +79,7 @@ $str = array("ala portokala"); $repl = "bala "; $start = 4; $len = 3; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).")")."\n"; var_dump(substr_replace($str, $repl, $start))."\n"; echo "\n"; echo "\n"; @@ -90,7 +90,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = 4; $len = 3; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -100,7 +100,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = 4; $len = 3; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -109,7 +109,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = 4; $len = 0; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -119,7 +119,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = 4; $len = 0; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -127,7 +127,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = 4; $len = -2; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -137,7 +137,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = 4; $len = -2; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -153,7 +153,7 @@ $str = array("ala portokala"); $repl = "bala "; $start = array(4); $len = 3; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).")")."\n"; var_dump(substr_replace($str, $repl, $start))."\n"; echo "\n"; echo "\n"; @@ -164,7 +164,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = array(4); $len = 3; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -174,7 +174,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = array(4); $len = 3; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -183,7 +183,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = array(4); $len = 0; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -193,7 +193,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = array(4); $len = 0; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -201,7 +201,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = array(4); $len = -2; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -211,7 +211,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = array(4); $len = -2; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -228,7 +228,7 @@ $str = array("ala portokala"); $repl = "bala "; $start = array(4,2); $len = 3; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).")")."\n"; var_dump(substr_replace($str, $repl, $start))."\n"; echo "\n"; echo "\n"; @@ -239,7 +239,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = array(4,2); $len = 3; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -249,7 +249,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = array(4,2); $len = 3; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -258,7 +258,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = array(4,2); $len = 0; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -268,7 +268,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = array(4,2); $len = 0; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -276,7 +276,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = array(4,2); $len = -2; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -286,7 +286,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = array(4,2); $len = -2; -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -304,7 +304,7 @@ $str = array("ala portokala"); $repl = "bala "; $start = array(4,2); $len = array(3); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).")")."\n"; var_dump(substr_replace($str, $repl, $start))."\n"; echo "\n"; echo "\n"; @@ -315,7 +315,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = array(4,2); $len = array(3); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -325,7 +325,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = array(4,2); $len = array(3); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -334,7 +334,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = array(4,2); $len = array(0); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -344,7 +344,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = array(4,2); $len = array(0); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -352,7 +352,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = array(4,2); $len = array(-2); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -362,7 +362,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = array(4,2); $len = array(-2); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -379,7 +379,7 @@ $str = array("ala portokala"); $repl = "bala "; $start = array(4,2); $len = array(3,2); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).")")."\n"; var_dump(substr_replace($str, $repl, $start))."\n"; echo "\n"; echo "\n"; @@ -390,7 +390,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = array(4,2); $len = array(3,2); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -400,7 +400,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = array(4,2); $len = array(3,2); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -409,7 +409,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = array(4,2); $len = array(0,0); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -419,7 +419,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = array(4,2); $len = array(0,0); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; @@ -427,7 +427,7 @@ $str = array("ala portokala", "try this"); $repl = array("bala "); $start = array(4,2); $len = array(-2,-3); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; echo "\n"; @@ -437,7 +437,7 @@ $str = array("ala portokala", "try this"); $repl = "bala "; $start = array(4,2); $len = array(-2,-3); -echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n"; +echo str_replace("\n","","substr_replace(".var_export($str, true).", ".var_export($repl, true).",".var_export($start, true).", ".var_export($len, true).")")."\n"; var_dump(substr_replace($str, $repl, $start, $len))."\n"; echo "\n"; diff --git a/ext/standard/tests/strings/wordwrap.phpt b/ext/standard/tests/strings/wordwrap.phpt index efa12bef18dd6..bf6bb91bfaa50 100644 --- a/ext/standard/tests/strings/wordwrap.phpt +++ b/ext/standard/tests/strings/wordwrap.phpt @@ -14,17 +14,17 @@ var_dump("123ab 123ab123" === wordwrap("123 123ab123", 3, "ab")); var_dump("123ab123ab123" === wordwrap("123 123ab123", 5, "ab")); var_dump("123 123ab123" === wordwrap("123 123 123", 10, "ab")); -var_dump("123ab123ab123" === wordwrap("123ab123ab123", 3, "ab", 1)); -var_dump("123ab123ab123" === wordwrap("123ab123ab123", 5, "ab", 1)); -var_dump("123ab 12ab3ab123" === wordwrap("123 123ab123", 3, "ab", 1)); -var_dump("123 ab123ab123" === wordwrap("123 123ab123", 5, "ab", 1)); -var_dump("123 123ab 123" === wordwrap("123 123 123", 8, "ab", 1)); -var_dump("123 ab12345 ab123" === wordwrap("123 12345 123", 8, "ab", 1)); -var_dump("1ab2ab3ab4" === wordwrap("1234", 1, "ab", 1)); +var_dump("123ab123ab123" === wordwrap("123ab123ab123", 3, "ab", true)); +var_dump("123ab123ab123" === wordwrap("123ab123ab123", 5, "ab", true)); +var_dump("123ab 12ab3ab123" === wordwrap("123 123ab123", 3, "ab", true)); +var_dump("123 ab123ab123" === wordwrap("123 123ab123", 5, "ab", true)); +var_dump("123 123ab 123" === wordwrap("123 123 123", 8, "ab", true)); +var_dump("123 ab12345 ab123" === wordwrap("123 12345 123", 8, "ab", true)); +var_dump("1ab2ab3ab4" === wordwrap("1234", 1, "ab", true)); -var_dump("12345|12345|67890" === wordwrap("12345 1234567890", 5, "|", 1)); +var_dump("12345|12345|67890" === wordwrap("12345 1234567890", 5, "|", true)); -var_dump("123|==1234567890|==123" === wordwrap("123 1234567890 123", 10, "|==", 1)); +var_dump("123|==1234567890|==123" === wordwrap("123 1234567890 123", 10, "|==", true)); try { diff --git a/ext/standard/tests/url/get_headers_error_003.phpt b/ext/standard/tests/url/get_headers_error_003.phpt index 7ee0b9e210d6a..011e0fbc38ec7 100644 --- a/ext/standard/tests/url/get_headers_error_003.phpt +++ b/ext/standard/tests/url/get_headers_error_003.phpt @@ -13,11 +13,11 @@ $opts = array( ); $context = stream_context_create($opts); -$headers = get_headers("http://".PHP_CLI_SERVER_ADDRESS, 1, $context); +$headers = get_headers("http://".PHP_CLI_SERVER_ADDRESS, true, $context); echo $headers["X-Request-Method"]."\n"; stream_context_set_default($opts); -$headers = get_headers("http://".PHP_CLI_SERVER_ADDRESS, 1); +$headers = get_headers("http://".PHP_CLI_SERVER_ADDRESS, true); echo $headers["X-Request-Method"]."\n"; echo "Done"; diff --git a/ext/tidy/tests/019.phpt b/ext/tidy/tests/019.phpt index 9bf6cf6349a3f..1e1bb41d4f9be 100644 --- a/ext/tidy/tests/019.phpt +++ b/ext/tidy/tests/019.phpt @@ -13,17 +13,17 @@ tidy_repair_string($s, $s, $s); tidy_repair_string($l, $l, $l); try { - tidy_repair_file($s, $l, $l, $l); + tidy_repair_file($s, $l, $l); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } try { - tidy_repair_file($s, $s, $s, $s); + tidy_repair_file($s, $s, $s); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } -tidy_repair_file($l, $l, $l ,$l); // This doesn't emit any warning, TODO look into +tidy_repair_file($l, $l, $l); // This doesn't emit any warning, TODO look into echo "Done\n"; ?> diff --git a/ext/xmlreader/tests/bug81521.phpt b/ext/xmlreader/tests/bug81521.phpt index 2789a16e21bb2..12ea6c9f1127b 100644 --- a/ext/xmlreader/tests/bug81521.phpt +++ b/ext/xmlreader/tests/bug81521.phpt @@ -6,7 +6,7 @@ xmlreader setParserProperty(XMLReader::LOADDTD, 1)); + var_dump($reader->setParserProperty(XMLReader::LOADDTD, true)); } catch (Error $e) { echo $e->getMessage(), "\n"; } diff --git a/ext/xmlwriter/tests/bug39504.phpt b/ext/xmlwriter/tests/bug39504.phpt index 0cb509d37dd5b..35d05d5fecc78 100644 --- a/ext/xmlwriter/tests/bug39504.phpt +++ b/ext/xmlwriter/tests/bug39504.phpt @@ -19,7 +19,7 @@ $xw = new XMLWriter(); $xw->openMemory(); $xw->startDocument(NULL, "UTF-8"); $xw->startDtd("root"); -$xw->writeDtdEntity("c", "", 0, "-//W3C//TEXT copyright//EN", "http://www.w3.org/xmlspec/copyright.xml"); +$xw->writeDtdEntity("c", "", false, "-//W3C//TEXT copyright//EN", "http://www.w3.org/xmlspec/copyright.xml"); $xw->endDtd(); $xw->startElement("root"); $xw->endDocument(); diff --git a/tests/classes/iterators_008.phpt b/tests/classes/iterators_008.phpt index 679bcc384b291..5e94a8dd4ad33 100644 --- a/tests/classes/iterators_008.phpt +++ b/tests/classes/iterators_008.phpt @@ -10,7 +10,7 @@ class D extends C implements Iterator { public function valid(): bool { echo __METHOD__ . "($this->counter)\n"; - return $this->counter; + return (bool)$this->counter; } public function next(): void { diff --git a/tests/output/bug46897.phpt b/tests/output/bug46897.phpt index 0e77938e4752f..5f154a28bb6e2 100644 --- a/tests/output/bug46897.phpt +++ b/tests/output/bug46897.phpt @@ -8,7 +8,7 @@ function callback($string) { return "[callback:$callback_invocations]$string\n"; } -ob_start('callback', 0, false); +ob_start('callback', 0, 0); echo "Attempt to flush unerasable buffer - should fail..."; var_dump(ob_flush()); diff --git a/tests/output/ob_start_basic_unerasable_001.phpt b/tests/output/ob_start_basic_unerasable_001.phpt index 658bee21633fe..ad3ed36f8746f 100644 --- a/tests/output/ob_start_basic_unerasable_001.phpt +++ b/tests/output/ob_start_basic_unerasable_001.phpt @@ -8,7 +8,7 @@ function callback($string) { return "[callback:$callback_invocations]$string\n"; } -ob_start('callback', 0, false); +ob_start('callback', 0, 0); echo "This call will obtain the content:\n"; $str = ob_get_contents(); diff --git a/tests/output/ob_start_basic_unerasable_002.phpt b/tests/output/ob_start_basic_unerasable_002.phpt index 1afe3efbc56e5..b1d45c8eeb362 100644 --- a/tests/output/ob_start_basic_unerasable_002.phpt +++ b/tests/output/ob_start_basic_unerasable_002.phpt @@ -8,7 +8,7 @@ function callback($string) { return "[callback:$callback_invocations]$string\n"; } -ob_start('callback', 0, false); +ob_start('callback', 0, 0); echo "All of the following calls will fail to clean/remove the topmost buffer:\n"; var_dump(ob_clean()); diff --git a/tests/output/ob_start_basic_unerasable_003.phpt b/tests/output/ob_start_basic_unerasable_003.phpt index b3b76da6503c4..4073b9d7e1567 100644 --- a/tests/output/ob_start_basic_unerasable_003.phpt +++ b/tests/output/ob_start_basic_unerasable_003.phpt @@ -8,7 +8,7 @@ function callback($string) { return "[callback:$callback_invocations]$string\n"; } -ob_start('callback', 0, false); +ob_start('callback', 0, 0); echo "This call will obtain the content, but will not clean the buffer."; $str = ob_get_clean(); diff --git a/tests/output/ob_start_basic_unerasable_004.phpt b/tests/output/ob_start_basic_unerasable_004.phpt index 442462462cd4c..411c09a661c6d 100644 --- a/tests/output/ob_start_basic_unerasable_004.phpt +++ b/tests/output/ob_start_basic_unerasable_004.phpt @@ -8,7 +8,7 @@ function callback($string) { return "[callback:$callback_invocations]$string\n"; } -ob_start('callback', 0, false); +ob_start('callback', 0, 0); echo "This call will obtain the content, but will not flush the buffer."; $str = ob_get_flush(); diff --git a/tests/output/ob_start_basic_unerasable_005.phpt b/tests/output/ob_start_basic_unerasable_005.phpt index 7f99b72dd1c58..0155afb423076 100644 --- a/tests/output/ob_start_basic_unerasable_005.phpt +++ b/tests/output/ob_start_basic_unerasable_005.phpt @@ -8,7 +8,7 @@ function callback($string) { return "[callback:$callback_invocations]$string\n"; } -ob_start('callback', 0, false); +ob_start('callback', 0, 0); echo "Attempt to flush unerasable buffer - should fail..."; var_dump(ob_flush());