diff --git a/UPGRADING b/UPGRADING index a5024d5a7b6b..5e90cf3d42a6 100644 --- a/UPGRADING +++ b/UPGRADING @@ -135,6 +135,14 @@ PHP 8.7 UPGRADE NOTES 4. Deprecated Functionality ======================================== +- Core: + . Lossy implicit conversions to and from bool for parameter, return, and + property types in coercive typing mode are now deprecated. Converting an + int other than 0 or 1, any float, or a string other than "0" or "1" to + bool emits a deprecation, as does converting a bool to int, float, or + string. + RFC: https://wiki.php.net/rfc/deprecate-lossy-bool-coercion + ======================================== 5. Changed Functions ======================================== diff --git a/Zend/Optimizer/dfa_pass.c b/Zend/Optimizer/dfa_pass.c index 93dae48a03ef..6d725a1dfa29 100644 --- a/Zend/Optimizer/dfa_pass.c +++ b/Zend/Optimizer/dfa_pass.c @@ -407,8 +407,12 @@ static uint32_t zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa) do { zend_op *op = call_info->caller_init_opline; + /* Only a bool $strict can be evaluated here. Other values are left to the + * runtime call, which reports lossy coercions and strict_types errors. */ if ((op->opcode == ZEND_FRAMELESS_ICALL_2 - || (op->opcode == ZEND_FRAMELESS_ICALL_3 && (op + 1)->op1_type == IS_CONST)) + || (op->opcode == ZEND_FRAMELESS_ICALL_3 && (op + 1)->op1_type == IS_CONST + && (Z_TYPE_P(CT_CONSTANT_EX(op_array, (op + 1)->op1.constant)) == IS_TRUE + || Z_TYPE_P(CT_CONSTANT_EX(op_array, (op + 1)->op1.constant)) == IS_FALSE))) && call_info->callee_func && zend_string_equals_literal_ci(call_info->callee_func->common.function_name, "in_array")) { bool strict = false; @@ -416,9 +420,7 @@ static uint32_t zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa) ZEND_ASSERT(!call_info->is_prototype); if (has_opdata) { - if (zend_is_true(CT_CONSTANT_EX(op_array, (op + 1)->op1.constant))) { - strict = true; - } + strict = Z_TYPE_P(CT_CONSTANT_EX(op_array, (op + 1)->op1.constant)) == IS_TRUE; } if (op->op2_type == IS_CONST diff --git a/Zend/tests/arrow_functions/007.phpt b/Zend/tests/arrow_functions/007.phpt index 7b63b1ba1520..1d51a6760e6d 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): ?bool => $args[0])(0)); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -20,4 +20,4 @@ try { ?> --EXPECT-- AssertionError: assert((fn() => false)()) -AssertionError: assert((fn&(int ...$args): ?bool => $args[0])(false)) +AssertionError: assert((fn&(int ...$args): ?bool => $args[0])(0)) diff --git a/Zend/tests/backtrace/debug_backtrace_options.phpt b/Zend/tests/backtrace/debug_backtrace_options.phpt index 460bbe3936ff..d204fbf6bfbe 100644 --- a/Zend/tests/backtrace/debug_backtrace_options.phpt +++ b/Zend/tests/backtrace/debug_backtrace_options.phpt @@ -16,10 +16,8 @@ function doit($a, $b, $how) { echo "==default\n"; $how(); - echo "==true\n"; - $how(true); - echo "==false\n"; - $how(false); + echo "==0\n"; + $how(0); echo "==DEBUG_BACKTRACE_PROVIDE_OBJECT\n"; $how(DEBUG_BACKTRACE_PROVIDE_OBJECT); echo "==DEBUG_BACKTRACE_IGNORE_ARGS\n"; @@ -48,11 +46,7 @@ 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 #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...') @@ -131,7 +125,7 @@ Array ) ) -==true +==0 Array ( [0] => Array @@ -141,71 +135,7 @@ Array [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] => + [0] => 0 ) ) @@ -261,7 +191,7 @@ Array [0] => Array ( [file] => %sdebug_backtrace_options.php - [line] => 21 + [line] => 19 [function] => backtrace_print [args] => Array ( @@ -325,7 +255,7 @@ Array [0] => Array ( [file] => %sdebug_backtrace_options.php - [line] => 23 + [line] => 21 [function] => backtrace_print ) @@ -361,7 +291,7 @@ Array [0] => Array ( [file] => %sdebug_backtrace_options.php - [line] => 25 + [line] => 23 [function] => backtrace_print ) diff --git a/Zend/tests/builtin_functions/builtin_functions_basic.phpt b/Zend/tests/builtin_functions/builtin_functions_basic.phpt index 619365cbce17..4e87dfaa037a 100644 --- a/Zend/tests/builtin_functions/builtin_functions_basic.phpt +++ b/Zend/tests/builtin_functions/builtin_functions_basic.phpt @@ -28,7 +28,7 @@ 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(get_extension_funcs("1")); var_dump(gettype(get_extension_funcs("standard"))); var_dump(count(get_extension_funcs("standard"))); var_dump(gettype(get_extension_funcs("zend"))); diff --git a/Zend/tests/call_user_functions/call_user_func_strict_arginfo_check.phpt b/Zend/tests/call_user_functions/call_user_func_strict_arginfo_check.phpt index 1f21ee989dd5..18e968b3ef23 100644 --- a/Zend/tests/call_user_functions/call_user_func_strict_arginfo_check.phpt +++ b/Zend/tests/call_user_functions/call_user_func_strict_arginfo_check.phpt @@ -7,8 +7,8 @@ declare(strict_types=1); namespace Foo; // strlen() will be called with strict_types=0, so this is legal. -var_dump(call_user_func('strlen', false)); +var_dump(call_user_func('strlen', 25)); ?> --EXPECT-- -int(0) +int(2) diff --git a/Zend/tests/constants/bug79919.phpt b/Zend/tests/constants/bug79919.phpt index 4407bdc1b8ea..3bf68166db65 100644 --- a/Zend/tests/constants/bug79919.phpt +++ b/Zend/tests/constants/bug79919.phpt @@ -10,5 +10,7 @@ $b = error_log(0); $b = simplexml_load_string('', null, $b); define(0, $b); ?> ---EXPECT-- +--EXPECTF-- 0 + +Deprecated: Implicit conversion from true to int in %s on line %d diff --git a/Zend/tests/dynamic_call/bug47880.phpt b/Zend/tests/dynamic_call/bug47880.phpt index bf2022c8094d..8c363a5b5b22 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); } set { } } @@ -32,5 +32,5 @@ object(Test)#1 (1) { ["prop"]=> int(20) ["prop2"]=> - uninitialized(int) + uninitialized(bool) } diff --git a/Zend/tests/type_coercion/gh22112.phpt b/Zend/tests/type_coercion/gh22112.phpt index 68e097894b56..d7a2f384eef1 100644 --- a/Zend/tests/type_coercion/gh22112.phpt +++ b/Zend/tests/type_coercion/gh22112.phpt @@ -4,6 +4,10 @@ GH-22112 (Assertion failure when error handler throws during NaN to bool/string +--EXPECT-- +bool(true) +bool(true) +bool(false) +string(3) "yes" +bool(true) +bool(true) +bool(true) +bool(false) +string(3) "yes" +bool(true) +bool(true) +bool(true) +bool(false) +string(3) "yes" +bool(true) +bool(false) +bool(false) +bool(true) +string(2) "no" +bool(false) +string(1) "1" +string(0) "" +float(1) +float(0) +string(2) "x1" +1 +string(5) "false" diff --git a/Zend/tests/type_coercion/lossy_bool/deprecation_to_exception.phpt b/Zend/tests/type_coercion/lossy_bool/deprecation_to_exception.phpt new file mode 100644 index 000000000000..bef007961639 --- /dev/null +++ b/Zend/tests/type_coercion/lossy_bool/deprecation_to_exception.phpt @@ -0,0 +1,55 @@ +--TEST-- +Lossy bool coercion deprecations promoted to exceptions +--FILE-- + to_bool('yes'), + fn() => float_string(true), + fn() => int_string(true), + fn() => ret(), + fn() => str_repeat(false, 1), + fn() => str_repeat('a', true), + fn() => array_column([['a', 'b']], true), + fn() => range(false, 1), + fn() => in_array(1, [1], 2), + function () { $c = new C; $c->b = 2; return $c; }, + function () { $c = new C; $c->s = true; return $c; }, + function () { $c = new C; $c->i = false; return $c; }, +]; + +foreach ($tests as $test) { + try { + var_dump($test()); + } catch (Throwable $e) { + do { + echo get_class($e), ': ', $e->getMessage(), "\n"; + } while ($e = $e->getPrevious()); + } +} + +?> +--EXPECT-- +Exception: Implicit conversion from string "yes" to bool +Exception: Implicit conversion from true to float +Exception: Implicit conversion from true to int +TypeError: ret(): Return value must be of type bool, int returned +Exception: Implicit conversion from int 2 to bool +Exception: Implicit conversion from false to string +Exception: Implicit conversion from true to int +Exception: Implicit conversion from true to int +Exception: Implicit conversion from false to int +Exception: Implicit conversion from int 2 to bool +Exception: Implicit conversion from int 2 to bool +Exception: Implicit conversion from true to string +Exception: Implicit conversion from false to int diff --git a/Zend/tests/type_coercion/lossy_bool/from_bool_userland.phpt b/Zend/tests/type_coercion/lossy_bool/from_bool_userland.phpt new file mode 100644 index 000000000000..879280bd22d5 --- /dev/null +++ b/Zend/tests/type_coercion/lossy_bool/from_bool_userland.phpt @@ -0,0 +1,88 @@ +--TEST-- +Lossy coercion from bool for userland arguments, returns, and typed properties +--FILE-- +i = $value; + $c->f = $value; + $c->s = $value; + var_dump($c->i, $c->f, $c->s); +} + +?> +--EXPECTF-- + +false: + +Deprecated: Implicit conversion from false to int in %s on line %d +int(0) + +Deprecated: Implicit conversion from false to float in %s on line %d +float(0) + +Deprecated: Implicit conversion from false to string in %s on line %d +string(0) "" + +Deprecated: Implicit conversion from false to int in %s on line %d +int(0) + +Deprecated: Implicit conversion from false to float in %s on line %d +float(0) + +Deprecated: Implicit conversion from false to string in %s on line %d +string(0) "" + +Deprecated: Implicit conversion from false to int in %s on line %d + +Deprecated: Implicit conversion from false to float in %s on line %d + +Deprecated: Implicit conversion from false to string in %s on line %d +int(0) +float(0) +string(0) "" + +true: + +Deprecated: Implicit conversion from true to int in %s on line %d +int(1) + +Deprecated: Implicit conversion from true to float in %s on line %d +float(1) + +Deprecated: Implicit conversion from true to string in %s on line %d +string(1) "1" + +Deprecated: Implicit conversion from true to int in %s on line %d +int(1) + +Deprecated: Implicit conversion from true to float in %s on line %d +float(1) + +Deprecated: Implicit conversion from true to string in %s on line %d +string(1) "1" + +Deprecated: Implicit conversion from true to int in %s on line %d + +Deprecated: Implicit conversion from true to float in %s on line %d + +Deprecated: Implicit conversion from true to string in %s on line %d +int(1) +float(1) +string(1) "1" diff --git a/Zend/tests/type_coercion/lossy_bool/internal_functions.phpt b/Zend/tests/type_coercion/lossy_bool/internal_functions.phpt new file mode 100644 index 000000000000..223bd3e9b2d0 --- /dev/null +++ b/Zend/tests/type_coercion/lossy_bool/internal_functions.phpt @@ -0,0 +1,93 @@ +--TEST-- +Lossy bool coercion for internal function parameters +--FILE-- + 1], 1, 0.0)); + +// string parameters +var_dump(strlen(false)); +var_dump(str_repeat(true, 2)); + +// float parameters +var_dump(sqrt(true)); +var_dump(fdiv(1, false)); + +// int parameters +var_dump(str_repeat('a', true)); +var_dump(substr('abc', 0, false)); + +// int|float parameters +var_dump(round(true)); + +// int|string parameters +var_dump(array_column([['a', 'b']], true)); + +// int|float|string parameters +var_dump(range(false, 1)); + +// mixed parameters are unaffected +var_dump(max(false, 0)); + +?> +--EXPECTF-- +bool(true) +bool(false) + +Deprecated: Implicit conversion from int 2 to bool in %s on line %d +bool(false) + +Deprecated: Implicit conversion from string "yes" to bool in %s on line %d +bool(false) + +Deprecated: Implicit conversion from string "yes" to bool in %s on line %d +bool(false) + +Deprecated: Implicit conversion from float 0 to bool in %s on line %d +array(1) { + [0]=> + string(1) "a" +} + +Deprecated: Implicit conversion from false to string in %s on line %d +int(0) + +Deprecated: Implicit conversion from true to string in %s on line %d +string(2) "11" + +Deprecated: Implicit conversion from true to float in %s on line %d +float(1) + +Deprecated: Implicit conversion from false to float in %s on line %d +float(INF) + +Deprecated: Implicit conversion from true to int in %s on line %d +string(1) "a" + +Deprecated: Implicit conversion from false to int in %s on line %d +string(0) "" + +Deprecated: Implicit conversion from true to int in %s on line %d +float(1) + +Deprecated: Implicit conversion from true to int in %s on line %d +array(1) { + [0]=> + string(1) "b" +} + +Deprecated: Implicit conversion from false to int in %s on line %d +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} +bool(false) diff --git a/Zend/tests/type_coercion/lossy_bool/nan.phpt b/Zend/tests/type_coercion/lossy_bool/nan.phpt new file mode 100644 index 000000000000..f9405ad328c5 --- /dev/null +++ b/Zend/tests/type_coercion/lossy_bool/nan.phpt @@ -0,0 +1,37 @@ +--TEST-- +NAN coerced to bool emits both the lossy coercion deprecation and the NAN warning +--FILE-- +getMessage(), "\n"; +} + +?> +--EXPECTF-- +Deprecated: Implicit conversion from float NAN to bool in %s on line %d + +Warning: unexpected NAN value was coerced to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from float NAN to bool in %s on line %d + +Warning: unexpected NAN value was coerced to bool in %s on line %d +bool(true) + +Warning: unexpected NAN value was coerced to bool in %s on line %d +bool(true) +Implicit conversion from float NAN to bool diff --git a/Zend/tests/type_coercion/lossy_bool/strict_types.phpt b/Zend/tests/type_coercion/lossy_bool/strict_types.phpt new file mode 100644 index 000000000000..fb00a7839163 --- /dev/null +++ b/Zend/tests/type_coercion/lossy_bool/strict_types.phpt @@ -0,0 +1,23 @@ +--TEST-- +Lossy bool coercions are TypeErrors with strict_types +--FILE-- + to_bool(2), fn() => to_bool('1'), fn() => to_string(true), fn() => in_array(1, [1], 1)] as $fn) { + try { + $fn(); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } +} + +?> +--EXPECTF-- +to_bool(): Argument #1 ($v) must be of type bool, int given, called in %s on line %d +to_bool(): Argument #1 ($v) must be of type bool, string given, called in %s on line %d +to_string(): Argument #1 ($v) must be of type string, true given, called in %s on line %d +in_array(): Argument #3 ($strict) must be of type bool, int given diff --git a/Zend/tests/type_coercion/lossy_bool/to_bool_userland.phpt b/Zend/tests/type_coercion/lossy_bool/to_bool_userland.phpt new file mode 100644 index 000000000000..4528ef480fcb --- /dev/null +++ b/Zend/tests/type_coercion/lossy_bool/to_bool_userland.phpt @@ -0,0 +1,229 @@ +--TEST-- +Lossy coercion to bool for userland arguments, returns, and typed properties +--FILE-- +b = $value; + var_dump($c->b); +} + +?> +--EXPECTF-- + +0: +bool(false) +bool(false) +bool(false) + +1: +bool(true) +bool(true) +bool(true) + +'0': +bool(false) +bool(false) +bool(false) + +'1': +bool(true) +bool(true) +bool(true) + +2: + +Deprecated: Implicit conversion from int 2 to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from int 2 to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from int 2 to bool in %s on line %d +bool(true) + +-1: + +Deprecated: Implicit conversion from int -1 to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from int -1 to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from int -1 to bool in %s on line %d +bool(true) + +0.0: + +Deprecated: Implicit conversion from float 0 to bool in %s on line %d +bool(false) + +Deprecated: Implicit conversion from float 0 to bool in %s on line %d +bool(false) + +Deprecated: Implicit conversion from float 0 to bool in %s on line %d +bool(false) + +-0.0: + +Deprecated: Implicit conversion from float -0 to bool in %s on line %d +bool(false) + +Deprecated: Implicit conversion from float -0 to bool in %s on line %d +bool(false) + +Deprecated: Implicit conversion from float -0 to bool in %s on line %d +bool(false) + +1.0: + +Deprecated: Implicit conversion from float 1 to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from float 1 to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from float 1 to bool in %s on line %d +bool(true) + +0.5: + +Deprecated: Implicit conversion from float 0.5 to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from float 0.5 to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from float 0.5 to bool in %s on line %d +bool(true) + +INF: + +Deprecated: Implicit conversion from float INF to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from float INF to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from float INF to bool in %s on line %d +bool(true) + +-INF: + +Deprecated: Implicit conversion from float -INF to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from float -INF to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from float -INF to bool in %s on line %d +bool(true) + +'': + +Deprecated: Implicit conversion from string "" to bool in %s on line %d +bool(false) + +Deprecated: Implicit conversion from string "" to bool in %s on line %d +bool(false) + +Deprecated: Implicit conversion from string "" to bool in %s on line %d +bool(false) + +' ': + +Deprecated: Implicit conversion from string " " to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string " " to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string " " to bool in %s on line %d +bool(true) + +'0 ': + +Deprecated: Implicit conversion from string "0 " to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string "0 " to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string "0 " to bool in %s on line %d +bool(true) + +' 1': + +Deprecated: Implicit conversion from string " 1" to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string " 1" to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string " 1" to bool in %s on line %d +bool(true) + +'00': + +Deprecated: Implicit conversion from string "00" to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string "00" to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string "00" to bool in %s on line %d +bool(true) + +'0.0': + +Deprecated: Implicit conversion from string "0.0" to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string "0.0" to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string "0.0" to bool in %s on line %d +bool(true) + +'1.0': + +Deprecated: Implicit conversion from string "1.0" to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string "1.0" to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string "1.0" to bool in %s on line %d +bool(true) + +'false': + +Deprecated: Implicit conversion from string "false" to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string "false" to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string "false" to bool in %s on line %d +bool(true) + +'off': + +Deprecated: Implicit conversion from string "off" to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string "off" to bool in %s on line %d +bool(true) + +Deprecated: Implicit conversion from string "off" to bool in %s on line %d +bool(true) diff --git a/Zend/tests/type_coercion/lossy_bool/union_types.phpt b/Zend/tests/type_coercion/lossy_bool/union_types.phpt new file mode 100644 index 000000000000..85df72cfc5f0 --- /dev/null +++ b/Zend/tests/type_coercion/lossy_bool/union_types.phpt @@ -0,0 +1,47 @@ +--TEST-- +Lossy bool coercion with union types +--FILE-- + +--EXPECTF-- + +Deprecated: Implicit conversion from string "yes" to bool in %s on line %d +bool(true) +int(2) + +Deprecated: Implicit conversion from float 1.5 to int loses precision in %s on line %d +int(1) + +Deprecated: Implicit conversion from string "yes" to bool in %s on line %d +bool(true) +float(1) +string(1) "2" +bool(true) + +Deprecated: Implicit conversion from false to float in %s on line %d +float(0) + +Deprecated: Implicit conversion from true to int in %s on line %d +int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d +int(1) diff --git a/Zend/tests/type_coercion/nan_to_other.phpt b/Zend/tests/type_coercion/nan_to_other.phpt index 2918d1a8ccf4..1a366745a4ad 100644 --- a/Zend/tests/type_coercion/nan_to_other.phpt +++ b/Zend/tests/type_coercion/nan_to_other.phpt @@ -41,6 +41,8 @@ foreach ($types as $type) { --EXPECTF-- float(NAN) +Deprecated: Implicit conversion from float NAN to bool in %s on line %d + Warning: unexpected NAN value was coerced to bool in %s on line %d bool(true) diff --git a/Zend/tests/type_declarations/scalar_basic.phpt b/Zend/tests/type_declarations/scalar_basic.phpt index e6559a941742..421d7ac5f9fd 100644 --- a/Zend/tests/type_declarations/scalar_basic.phpt +++ b/Zend/tests/type_declarations/scalar_basic.phpt @@ -91,9 +91,11 @@ int(%d) TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d *** Trying bool(true) +E_DEPRECATED: Implicit conversion from true to int on line 14 int(1) *** Trying bool(false) +E_DEPRECATED: Implicit conversion from false to int on line 14 int(0) *** Trying NULL @@ -144,9 +146,11 @@ float(%s) float(NAN) *** Trying bool(true) +E_DEPRECATED: Implicit conversion from true to float on line 15 float(1) *** Trying bool(false) +E_DEPRECATED: Implicit conversion from false to float on line 15 float(0) *** Trying NULL @@ -198,9 +202,11 @@ E_WARNING: unexpected NAN value was coerced to string on line %d string(3) "NAN" *** Trying bool(true) +E_DEPRECATED: Implicit conversion from true to string on line 16 string(1) "1" *** Trying bool(false) +E_DEPRECATED: Implicit conversion from false to string on line 16 string(0) "" *** Trying NULL @@ -230,24 +236,31 @@ bool(true) bool(true) *** Trying float(1) +E_DEPRECATED: Implicit conversion from float 1 to bool on line 17 bool(true) *** Trying float(1.5) +E_DEPRECATED: Implicit conversion from float 1.5 to bool on line 17 bool(true) *** Trying string(2) "1a" +E_DEPRECATED: Implicit conversion from string "1a" to bool on line 17 bool(true) *** Trying string(1) "a" +E_DEPRECATED: Implicit conversion from string "a" to bool on line 17 bool(true) *** Trying string(0) "" +E_DEPRECATED: Implicit conversion from string "" to bool on line 17 bool(false) *** Trying int(%d) +E_DEPRECATED: Implicit conversion from int %d to bool on line 17 bool(true) *** Trying float(NAN) +E_DEPRECATED: Implicit conversion from float NAN to bool on line 17 E_WARNING: unexpected NAN value was coerced to bool on line %d bool(true) diff --git a/Zend/tests/type_declarations/scalar_return_basic.phpt b/Zend/tests/type_declarations/scalar_return_basic.phpt index 67af304ec2c6..d4375279f09e 100644 --- a/Zend/tests/type_declarations/scalar_return_basic.phpt +++ b/Zend/tests/type_declarations/scalar_return_basic.phpt @@ -84,8 +84,10 @@ int(2147483647) *** 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: Implicit conversion from true to int on line 14 int(1) *** Trying bool(false) +E_DEPRECATED: Implicit conversion from false to int on line 14 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(2147483647) *** Trying float(NAN) float(NAN) *** Trying bool(true) +E_DEPRECATED: Implicit conversion from true to float on line 15 float(1) *** Trying bool(false) +E_DEPRECATED: Implicit conversion from false to float on line 15 float(0) *** Trying NULL *** Caught {closure:%s:%d}(): Return value must be of type float, null returned in %s on line %d @@ -159,8 +163,10 @@ string(10) "2147483647" E_WARNING: unexpected NAN value was coerced to string on line %d string(3) "NAN" *** Trying bool(true) +E_DEPRECATED: Implicit conversion from true to string on line 16 string(1) "1" *** Trying bool(false) +E_DEPRECATED: Implicit conversion from false to string on line 16 string(0) "" *** Trying NULL *** Caught {closure:%s:%d}(): Return value must be of type string, null returned in %s on line %d @@ -182,18 +188,25 @@ bool(true) *** Trying string(1) "1" bool(true) *** Trying float(1) +E_DEPRECATED: Implicit conversion from float 1 to bool on line 17 bool(true) *** Trying float(1.5) +E_DEPRECATED: Implicit conversion from float 1.5 to bool on line 17 bool(true) *** Trying string(2) "1a" +E_DEPRECATED: Implicit conversion from string "1a" to bool on line 17 bool(true) *** Trying string(1) "a" +E_DEPRECATED: Implicit conversion from string "a" to bool on line 17 bool(true) *** Trying string(0) "" +E_DEPRECATED: Implicit conversion from string "" to bool on line 17 bool(false) *** Trying int(2147483647) +E_DEPRECATED: Implicit conversion from int 2147483647 to bool on line 17 bool(true) *** Trying float(NAN) +E_DEPRECATED: Implicit conversion from float NAN to bool on line 17 E_WARNING: unexpected NAN value was coerced to bool on line %d bool(true) *** Trying bool(true) diff --git a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt index e3cf8927662a..7a96fee7ffea 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) TypeError: {closure:%s:%d}(): Return value must be of type int, float returned in %s on line %d *** Trying bool(true) +E_DEPRECATED: Implicit conversion from true to int on line 14 int(1) *** Trying bool(false) +E_DEPRECATED: Implicit conversion from false to int on line 14 int(0) *** Trying NULL TypeError: {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: Implicit conversion from true to float on line 15 float(1) *** Trying bool(false) +E_DEPRECATED: Implicit conversion from false to float on line 15 float(0) *** Trying NULL TypeError: {closure:%s:%d}(): Return value must be of type float, null returned in %s on line %d @@ -159,8 +163,10 @@ string(19) "9223372036854775807" E_WARNING: unexpected NAN value was coerced to string on line %d string(3) "NAN" *** Trying bool(true) +E_DEPRECATED: Implicit conversion from true to string on line 16 string(1) "1" *** Trying bool(false) +E_DEPRECATED: Implicit conversion from false to string on line 16 string(0) "" *** Trying NULL TypeError: {closure:%s:%d}(): Return value must be of type string, null returned in %s on line %d @@ -182,18 +188,25 @@ bool(true) *** Trying string(1) "1" bool(true) *** Trying float(1) +E_DEPRECATED: Implicit conversion from float 1 to bool on line 17 bool(true) *** Trying float(1.5) +E_DEPRECATED: Implicit conversion from float 1.5 to bool on line 17 bool(true) *** Trying string(2) "1a" +E_DEPRECATED: Implicit conversion from string "1a" to bool on line 17 bool(true) *** Trying string(1) "a" +E_DEPRECATED: Implicit conversion from string "a" to bool on line 17 bool(true) *** Trying string(0) "" +E_DEPRECATED: Implicit conversion from string "" to bool on line 17 bool(false) *** Trying int(9223372036854775807) +E_DEPRECATED: Implicit conversion from int 9223372036854775807 to bool on line 17 bool(true) *** Trying float(NAN) +E_DEPRECATED: Implicit conversion from float NAN to bool on line 17 E_WARNING: unexpected NAN value was coerced to bool on line %d bool(true) *** Trying 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 9031b002b2a0..cd943d3635a8 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 (Implicit conversion from true to int) +false => 0 (Implicit conversion from false to int) 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 (Implicit conversion from true to int) 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 (Implicit conversion from string "42x" to bool) +"x" => true (Implicit conversion from string "x" to bool) +"" => false (Implicit conversion from string "" to bool) 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 (Implicit conversion from float INF to bool) "42" => 42 "42.0" => 42 -"42x" => true -"x" => true -"" => false +"42x" => true (Implicit conversion from string "42x" to bool) +"x" => true (Implicit conversion from string "x" to bool) +"" => false (Implicit conversion from string "" to bool) 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 (Implicit conversion from true to int) +false => 0 (Implicit conversion from false to int) 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 (Implicit conversion from true to float) +false => 0.0 (Implicit conversion from false to float) 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" (Implicit conversion from true to string) +false => "" (Implicit conversion from false to string) 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 (Implicit conversion from int 42 to bool) +42.0 => true (Implicit conversion from float 42 to bool) +INF => true (Implicit conversion from float INF to bool) +"42" => true (Implicit conversion from string "42" to bool) +"42.0" => true (Implicit conversion from string "42.0" to bool) +"42x" => true (Implicit conversion from string "42x" to bool) +"x" => true (Implicit conversion from string "x" to bool) +"" => false (Implicit conversion from string "" to bool) true => true false => false null => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, null given diff --git a/Zend/tests/zpp/bool_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/bool_zpp_specifier_weak_mode.phpt index 705487f8ba73..4fbb92cd3099 100644 --- a/Zend/tests/zpp/bool_zpp_specifier_weak_mode.phpt +++ b/Zend/tests/zpp/bool_zpp_specifier_weak_mode.phpt @@ -90,67 +90,179 @@ bool(true) bool(true) bool(true) Using 42: + +Deprecated: Implicit conversion from int 42 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from int 42 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from int 42 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from int 42 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from int 42 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from int 42 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from int 42 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from int 42 to bool in %s on line %d bool(true) Using 73.5: + +Deprecated: Implicit conversion from float 73.5 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from float 73.5 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from float 73.5 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from float 73.5 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from float 73.5 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from float 73.5 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from float 73.5 to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from float 73.5 to bool in %s on line %d bool(true) Using 'string': + +Deprecated: Implicit conversion from string "string" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "string" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "string" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "string" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "string" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "string" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "string" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "string" to bool in %s on line %d bool(true) Using '15': + +Deprecated: Implicit conversion from string "15" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "15" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "15" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "15" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "15" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "15" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "15" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "15" to bool in %s on line %d bool(true) Using '56.7': + +Deprecated: Implicit conversion from string "56.7" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "56.7" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "56.7" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "56.7" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "56.7" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "56.7" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "56.7" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "56.7" to bool in %s on line %d bool(true) Using 'stdClass': + +Deprecated: Implicit conversion from string "stdClass" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "stdClass" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "stdClass" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "stdClass" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "stdClass" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "stdClass" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "stdClass" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "stdClass" to bool in %s on line %d bool(true) Using anon class name: + +Deprecated: Implicit conversion from string "class@anonymous%s" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "class@anonymous%s" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "class@anonymous%s" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "class@anonymous%s" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "class@anonymous%s" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "class@anonymous%s" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "class@anonymous%s" to bool in %s on line %d bool(true) + +Deprecated: Implicit conversion from string "class@anonymous%s" to bool in %s on line %d bool(true) Using []: TypeError: zend_bool(): Argument #1 ($param) must be of type bool, array given diff --git a/Zend/tests/zpp/float_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/float_zpp_specifier_weak_mode.phpt index 1520e8055bd3..1e5485143add 100644 --- a/Zend/tests/zpp/float_zpp_specifier_weak_mode.phpt +++ b/Zend/tests/zpp/float_zpp_specifier_weak_mode.phpt @@ -72,22 +72,54 @@ Deprecated: zend_float_slow_zpp(): Passing null to parameter #1 ($param) of type float(0) NULL Using false: + +Deprecated: Implicit conversion from false to float in %s on line %d float(0) + +Deprecated: Implicit conversion from false to float in %s on line %d float(0) + +Deprecated: Implicit conversion from false to float in %s on line %d float(0) + +Deprecated: Implicit conversion from false to float in %s on line %d float(0) + +Deprecated: Implicit conversion from false to float in %s on line %d float(0) + +Deprecated: Implicit conversion from false to float in %s on line %d float(0) + +Deprecated: Implicit conversion from false to float in %s on line %d float(0) + +Deprecated: Implicit conversion from false to float in %s on line %d float(0) Using true: + +Deprecated: Implicit conversion from true to float in %s on line %d float(1) + +Deprecated: Implicit conversion from true to float in %s on line %d float(1) + +Deprecated: Implicit conversion from true to float in %s on line %d float(1) + +Deprecated: Implicit conversion from true to float in %s on line %d float(1) + +Deprecated: Implicit conversion from true to float in %s on line %d float(1) + +Deprecated: Implicit conversion from true to float in %s on line %d float(1) + +Deprecated: Implicit conversion from true to float in %s on line %d float(1) + +Deprecated: Implicit conversion from true to float in %s on line %d float(1) Using 42: float(42) diff --git a/Zend/tests/zpp/int_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/int_zpp_specifier_weak_mode.phpt index 9258d6864355..aeb1c1f0cdae 100644 --- a/Zend/tests/zpp/int_zpp_specifier_weak_mode.phpt +++ b/Zend/tests/zpp/int_zpp_specifier_weak_mode.phpt @@ -72,22 +72,54 @@ Deprecated: zend_int_slow_zpp(): Passing null to parameter #1 ($param) of type i int(0) NULL Using false: + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) Using true: + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) Using 42: int(42) diff --git a/Zend/tests/zpp/number_or_str_zpp_weak_mode.phpt b/Zend/tests/zpp/number_or_str_zpp_weak_mode.phpt index f0a8985297fe..8af08d5ec5b5 100644 --- a/Zend/tests/zpp/number_or_str_zpp_weak_mode.phpt +++ b/Zend/tests/zpp/number_or_str_zpp_weak_mode.phpt @@ -29,10 +29,18 @@ Deprecated: zend_number_or_string(): Passing null to parameter #1 ($param) of ty int(0) NULL Using false: + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) Using true: + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) Using 42: int(42) diff --git a/Zend/tests/zpp/number_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/number_zpp_specifier_weak_mode.phpt index 2cdc710405ab..30e04d147755 100644 --- a/Zend/tests/zpp/number_zpp_specifier_weak_mode.phpt +++ b/Zend/tests/zpp/number_zpp_specifier_weak_mode.phpt @@ -72,22 +72,54 @@ Deprecated: zend_number_slow_zpp(): Passing null to parameter #1 ($param) of typ int(0) NULL Using false: + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) Using true: + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) Using 42: int(42) diff --git a/Zend/tests/zpp/obj_of_class_or_int_zpp_weak_mode.phpt b/Zend/tests/zpp/obj_of_class_or_int_zpp_weak_mode.phpt index 6322c56ddf6a..3b43c81cb347 100644 --- a/Zend/tests/zpp/obj_of_class_or_int_zpp_weak_mode.phpt +++ b/Zend/tests/zpp/obj_of_class_or_int_zpp_weak_mode.phpt @@ -29,10 +29,18 @@ Deprecated: zend_obj_stdclass_or_int(): Passing null to parameter #1 ($param) of int(0) NULL Using false: + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) + +Deprecated: Implicit conversion from false to int in %s on line %d int(0) Using true: + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) + +Deprecated: Implicit conversion from true to int in %s on line %d int(1) Using 42: int(42) diff --git a/Zend/tests/zpp/obj_of_class_or_str_zpp_weak_mode.phpt b/Zend/tests/zpp/obj_of_class_or_str_zpp_weak_mode.phpt index be0dcbc74969..118b14741b61 100644 --- a/Zend/tests/zpp/obj_of_class_or_str_zpp_weak_mode.phpt +++ b/Zend/tests/zpp/obj_of_class_or_str_zpp_weak_mode.phpt @@ -29,10 +29,18 @@ Deprecated: zend_obj_stdclass_or_string(): Passing null to parameter #1 ($param) string(0) "" NULL Using false: + +Deprecated: Implicit conversion from false to string in %s on line %d string(0) "" + +Deprecated: Implicit conversion from false to string in %s on line %d string(0) "" Using true: + +Deprecated: Implicit conversion from true to string in %s on line %d string(1) "1" + +Deprecated: Implicit conversion from true to string in %s on line %d string(1) "1" Using 42: string(2) "42" diff --git a/Zend/tests/zpp/obj_or_str_zpp_weak_mode.phpt b/Zend/tests/zpp/obj_or_str_zpp_weak_mode.phpt index 76198926ffe8..9a8086a64fe6 100644 --- a/Zend/tests/zpp/obj_or_str_zpp_weak_mode.phpt +++ b/Zend/tests/zpp/obj_or_str_zpp_weak_mode.phpt @@ -29,10 +29,18 @@ Deprecated: zend_string_or_object(): Passing null to parameter #1 ($param) of ty string(0) "" NULL Using false: + +Deprecated: Implicit conversion from false to string in %s on line %d string(0) "" + +Deprecated: Implicit conversion from false to string in %s on line %d string(0) "" Using true: + +Deprecated: Implicit conversion from true to string in %s on line %d string(1) "1" + +Deprecated: Implicit conversion from true to string in %s on line %d string(1) "1" Using 42: string(2) "42" diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 81991a1e8385..96cfe2412f8e 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -582,12 +582,59 @@ static ZEND_COLD bool zend_null_arg_deprecated(const char *fallback_type, uint32 return !EG(exception); } +/* int 0/1 and string "0"/"1" are the only scalars with a canonical bool representation. */ +static zend_always_inline bool zend_is_lossy_bool_coercion(const zval *arg) +{ + switch (Z_TYPE_P(arg)) { + case IS_LONG: + return Z_LVAL_P(arg) != 0 && Z_LVAL_P(arg) != 1; + case IS_DOUBLE: + return true; + case IS_STRING: + return Z_STRLEN_P(arg) != 1 || (Z_STRVAL_P(arg)[0] != '0' && Z_STRVAL_P(arg)[0] != '1'); + default: + return false; + } +} + +static ZEND_COLD bool zend_lossy_to_bool_coercion_deprecated(const zval *arg) +{ + switch (Z_TYPE_P(arg)) { + case IS_LONG: + zend_error(E_DEPRECATED, "Implicit conversion from int " ZEND_LONG_FMT " to bool", Z_LVAL_P(arg)); + break; + case IS_DOUBLE: + zend_error_unchecked(E_DEPRECATED, "Implicit conversion from float %.*H to bool", -1, Z_DVAL_P(arg)); + break; + case IS_STRING: + zend_error(E_DEPRECATED, "Implicit conversion from string \"%pS\" to bool", Z_STR_P(arg)); + break; + default: ZEND_UNREACHABLE(); + } + return !EG(exception); +} + +static ZEND_COLD bool zend_lossy_from_bool_coercion_deprecated(const zval *arg, const char *target_type) +{ + ZEND_ASSERT(Z_TYPE_P(arg) == IS_FALSE || Z_TYPE_P(arg) == IS_TRUE); + zend_error(E_DEPRECATED, "Implicit conversion from %s to %s", + Z_TYPE_P(arg) == IS_TRUE ? "true" : "false", target_type); + return !EG(exception); +} + ZEND_API zpp_parse_bool_status ZEND_FASTCALL zend_parse_arg_bool_weak(const zval *arg, 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)) { return ZPP_PARSE_BOOL_STATUS_ERROR; } + /* Check arg_num is not (uint32_t)-1, as otherwise its called by + * zend_verify_weak_scalar_type_hint_no_sideeffect() */ + if (UNEXPECTED(zend_is_lossy_bool_coercion(arg)) && arg_num != (uint32_t)-1) { + if (!zend_lossy_to_bool_coercion_deprecated(arg)) { + return ZPP_PARSE_BOOL_STATUS_ERROR; + } + } bool result = zend_is_true(arg); if (UNEXPECTED(EG(exception))) { return ZPP_PARSE_BOOL_STATUS_ERROR; @@ -669,11 +716,18 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long } } } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) { - if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("int", arg_num)) { + if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) { + if (!zend_null_arg_deprecated("int", arg_num)) { + return 0; + } + } else if (arg_num != (uint32_t)-1 && !zend_lossy_from_bool_coercion_deprecated(arg, "int")) { return 0; } *dest = 0; } else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) { + if (arg_num != (uint32_t)-1 && !zend_lossy_from_bool_coercion_deprecated(arg, "int")) { + return 0; + } *dest = 1; } else { return 0; @@ -718,11 +772,18 @@ ZEND_API double ZEND_FASTCALL zend_parse_arg_double_weak(const zval *arg, uint32 return dval; } } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) { - if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("float", arg_num)) { + if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) { + if (!zend_null_arg_deprecated("float", arg_num)) { + return NAN; + } + } else if (arg_num != (uint32_t)-1 && !zend_lossy_from_bool_coercion_deprecated(arg, "float")) { return NAN; } return 0.0; } else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) { + if (arg_num != (uint32_t)-1 && !zend_lossy_from_bool_coercion_deprecated(arg, "float")) { + return NAN; + } return 1.0; } else { return NAN; @@ -761,11 +822,18 @@ 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)) { + if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) { + if (!zend_null_arg_deprecated("int|float", arg_num)) { + return 0; + } + } else if (!zend_lossy_from_bool_coercion_deprecated(arg, "int")) { return 0; } ZVAL_LONG(arg, 0); } else if (Z_TYPE_P(arg) == IS_TRUE) { + if (!zend_lossy_from_bool_coercion_deprecated(arg, "int")) { + return 0; + } ZVAL_LONG(arg, 1); } else { return 0; @@ -782,11 +850,18 @@ 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)) { + if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) { + if (!zend_null_arg_deprecated("string|int|float", arg_num)) { + return false; + } + } else if (!zend_lossy_from_bool_coercion_deprecated(arg, "int")) { return false; } ZVAL_LONG(arg, 0); } else if (Z_TYPE_P(arg) == IS_TRUE) { + if (!zend_lossy_from_bool_coercion_deprecated(arg, "int")) { + return false; + } ZVAL_LONG(arg, 1); } else if (UNEXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) { zend_object *zobj = Z_OBJ_P(arg); @@ -808,7 +883,12 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_or_str_slow(zval *arg, zval ** ZEND_API zend_string* ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, uint32_t arg_num) /* {{{ */ { if (EXPECTED(Z_TYPE_P(arg) < IS_STRING)) { - if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("string", arg_num)) { + if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) { + if (!zend_null_arg_deprecated("string", arg_num)) { + return NULL; + } + } else if (UNEXPECTED(Z_TYPE_P(arg) == IS_FALSE || Z_TYPE_P(arg) == IS_TRUE) + && !zend_lossy_from_bool_coercion_deprecated(arg, "string")) { return NULL; } convert_to_string(arg); @@ -857,6 +937,9 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_stri if (zend_parse_arg_long_weak(arg, dest_long, arg_num)) { *dest_str = NULL; return 1; + } else if (UNEXPECTED(EG(exception))) { + /* A deprecation for the int conversion was promoted to an exception */ + return 0; } else if ((str = zend_parse_arg_str_weak(arg, arg_num)) != NULL) { *dest_long = 0; *dest_str = str; diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index c4fc6ee15b66..7db693109f73 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4770,8 +4770,14 @@ static zend_result zend_compile_func_in_array(znode *result, zend_ast_list *args zend_op *opline; if (args->children == 3) { + /* Only bool constants can be evaluated here. Other values are left to the + * runtime call, which reports lossy coercions and strict_types errors. */ if (args->child[2]->kind == ZEND_AST_ZVAL) { - strict = zend_is_true(zend_ast_get_zval(args->child[2])); + const zval *value = zend_ast_get_zval(args->child[2]); + if (Z_TYPE_P(value) != IS_TRUE && Z_TYPE_P(value) != IS_FALSE) { + return FAILURE; + } + strict = Z_TYPE_P(value) == IS_TRUE; } else if (args->child[2]->kind == ZEND_AST_CONST) { zval value; zend_ast *name_ast = args->child[2]->child[0]; @@ -4785,8 +4791,11 @@ static zend_result zend_compile_func_in_array(znode *result, zend_ast_list *args } zend_string_release_ex(resolved_name, 0); - strict = zend_is_true(&value); - zval_ptr_dtor(&value); + if (Z_TYPE(value) != IS_TRUE && Z_TYPE(value) != IS_FALSE) { + zval_ptr_dtor(&value); + return FAILURE; + } + strict = Z_TYPE(value) == IS_TRUE; } else { return FAILURE; } diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 7d270c3e249d..51f92c93b29b 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -777,11 +777,17 @@ static bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg) zval_ptr_dtor(arg); ZVAL_DOUBLE(arg, dval); return true; + } else if (UNEXPECTED(EG(exception))) { + return false; } } - if ((type_mask & MAY_BE_STRING) && zend_parse_arg_str_weak(arg, 0)) { - /* on success "arg" is converted to IS_STRING */ - return true; + if (type_mask & MAY_BE_STRING) { + if (zend_parse_arg_str_weak(arg, 0)) { + /* on success "arg" is converted to IS_STRING */ + return true; + } else if (UNEXPECTED(EG(exception))) { + return false; + } } if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL) { zpp_parse_bool_status bval = zend_parse_arg_bool_weak(arg, 0); diff --git a/ext/curl/tests/curl_setopt_ssl.phpt b/ext/curl/tests/curl_setopt_ssl.phpt index 3831e1a72655..7950a15d3bf1 100644 --- a/ext/curl/tests/curl_setopt_ssl.phpt +++ b/ext/curl/tests/curl_setopt_ssl.phpt @@ -29,7 +29,7 @@ function check_error(CurlHandle $ch, $expected = null) { } function check_response($response, $clientCertSubject) { - if (strpos($response, $clientCertSubject) === false) { + if ($response === false || strpos($response, $clientCertSubject) === false) { echo "client cert subject not in response\n"; } else { echo "client cert subject in response\n"; diff --git a/ext/date/tests/gmdate_variation12.phpt b/ext/date/tests/gmdate_variation12.phpt index dab866967aea..b6e4f5079dfd 100644 --- a/ext/date/tests/gmdate_variation12.phpt +++ b/ext/date/tests/gmdate_variation12.phpt @@ -17,7 +17,7 @@ var_dump( gmdate(DATE_ISO8601, $timestamp) ); echo "\n-- Testing gmdate() function with less than the range of timestamp --\n"; $timestamp = mktime(20, 45, 50, 12, 13, 1901); -var_dump( gmdate(DATE_ISO8601, $timestamp) ); +var_dump( $timestamp ); echo "\n-- Testing gmdate() function with maximum range of timestamp --\n"; $timestamp = mktime(03, 14, 07, 1, 19, 2038); @@ -25,7 +25,7 @@ var_dump( gmdate(DATE_ISO8601, $timestamp) ); echo "\n-- Testing gmdate() function with greater than the range of timestamp --\n"; $timestamp = mktime(03, 14, 10, 1, 19, 2038); -var_dump( gmdate(DATE_ISO8601, $timestamp) ); +var_dump( $timestamp ); ?> --EXPECTF-- @@ -37,7 +37,7 @@ string(24) "1901-12-13T20:45:54+0000" -- Testing gmdate() function with less than the range of timestamp -- Warning: mktime(): Epoch doesn't fit in a PHP integer in %s on line %d -string(24) "1970-01-01T00:00:00+0000" +bool(false) -- Testing gmdate() function with maximum range of timestamp -- string(24) "2038-01-19T03:14:07+0000" @@ -45,4 +45,4 @@ string(24) "2038-01-19T03:14:07+0000" -- Testing gmdate() function with greater than the range of timestamp -- Warning: mktime(): Epoch doesn't fit in a PHP integer in %s on line %d -string(24) "1970-01-01T00:00:00+0000" +bool(false) diff --git a/ext/gd/tests/imageaffinematrixget_zpp_weak_mode.phpt b/ext/gd/tests/imageaffinematrixget_zpp_weak_mode.phpt index ffd5523fb83b..823bcf8bcf83 100644 --- a/ext/gd/tests/imageaffinematrixget_zpp_weak_mode.phpt +++ b/ext/gd/tests/imageaffinematrixget_zpp_weak_mode.phpt @@ -45,8 +45,12 @@ null: Deprecated: imageaffinematrixget(): Passing null to parameter #2 ($options) of type array|float is deprecated in %s on line %d accepted false: + +Deprecated: Implicit conversion from false to float in %s on line %d accepted true: + +Deprecated: Implicit conversion from true to float in %s on line %d accepted int: accepted diff --git a/ext/gd/tests/imageantialias_error2.phpt b/ext/gd/tests/imageantialias_error2.phpt deleted file mode 100644 index 40f4d64a12b6..000000000000 --- a/ext/gd/tests/imageantialias_error2.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Testing wrong parameter passing in imageantialias() of GD library ---CREDITS-- -Guilherme Blanco -#testfest PHPSP on 2009-06-20 ---EXTENSIONS-- -gd ---FILE-- - ---EXPECT-- -bool(true) diff --git a/ext/gd/tests/imageloadfont_invalid.phpt b/ext/gd/tests/imageloadfont_invalid.phpt index 9d9ff7d60144..e63e4a517e2f 100644 --- a/ext/gd/tests/imageloadfont_invalid.phpt +++ b/ext/gd/tests/imageloadfont_invalid.phpt @@ -10,10 +10,8 @@ $fp = fopen($filename, 'wb'); fwrite($fp, $bin); fclose($fp); -$image = imagecreatetruecolor(50, 20); $font = imageloadfont($filename); -$black = imagecolorallocate($image, 0, 0, 0); -imagestring($image, $font, 0, 0, "Hello", $black); +var_dump($font); unlink($filename); ?> --EXPECTF-- @@ -21,3 +19,4 @@ Warning: imageloadfont(): Product of memory allocation multiplication would exce in %simageloadfont_invalid.php on line %d Warning: imageloadfont(): Error reading font, invalid font header in %simageloadfont_invalid.php on line %d +bool(false) diff --git a/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt b/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt index 15149deb40a6..21c73e343d38 100644 --- a/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt +++ b/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt @@ -5,7 +5,7 @@ gettext --FILE-- getMessage(), "\n"; } diff --git a/ext/iconv/tests/iconv_mime_decode.phpt b/ext/iconv/tests/iconv_mime_decode.phpt index 00d8b2244bf6..52543c534d57 100644 --- a/ext/iconv/tests/iconv_mime_decode.phpt +++ b/ext/iconv/tests/iconv_mime_decode.phpt @@ -17,6 +17,10 @@ function do_single_test($header) global $mode; $result = iconv_mime_decode($header, $mode, "UTF-8"); + if ($result === false) { + echo "false\n"; + return; + } printf("(%d) \"%s\"\n", iconv_strlen($result, "UTF-8"), $result); } @@ -70,13 +74,13 @@ do_regression_test(); (32) "Subject: Prüfung PrüfungkůÔńÓlet" (31) "Subject: PrüfungPrüfungkůÔńÓlet" 2: iconv_mime_decode(): Malformed string -(0) "" +false (27) "From: サンプル文字列サンプル文字列日本語テキスト" (31) "Subject: PrüfungPrüfungkůÔńÓlet" (32) "Subject: Prüfung PrüfungkůÔńÓlet" (100) "Subject: =?ISO-8859-1?Q?Pr=FCfung?==?ISO-8859-1*de_DE?Q?Pr=FCfung?==?ISO-8859-2?Q?k=F9=D4=F1=D3let?=" 2: iconv_mime_decode(): Malformed string -(0) "" +false (27) "From: サンプル文字列サンプル文字列日本語テキスト" (31) "Subject: PrüfungPrüfungkůÔńÓlet" (32) "Subject: Prüfung PrüfungkůÔńÓlet" diff --git a/ext/iconv/tests/iconv_stream_filter.phpt b/ext/iconv/tests/iconv_stream_filter.phpt index 1d642a751425..b81dde448f16 100644 --- a/ext/iconv/tests/iconv_stream_filter.phpt +++ b/ext/iconv/tests/iconv_stream_filter.phpt @@ -22,7 +22,7 @@ fclose($fp); $fp = fopen(__DIR__.'/iconv_stream_filter.txt', 'rb'); stream_filter_append($fp, 'string.rot13'); // this will make conversion fail. stream_filter_append($fp, 'convert.iconv.ISO-2022-JP/EUC-JP'); -var_dump(bin2hex(@fread($fp, 10)) != "a4b3a4f3a4cba4c1a4cf"); +var_dump(@fread($fp, 10) !== hex2bin("a4b3a4f3a4cba4c1a4cf")); var_dump(bin2hex(fread($fp, 5)) != "69636f6e76"); var_dump(bin2hex(fread($fp, 1)) != "0a"); fclose($fp); diff --git a/ext/intl/tests/intltz_get_canonical_id_refs.phpt b/ext/intl/tests/intltz_get_canonical_id_refs.phpt index 973b7006c7d1..859fbe6ca872 100644 --- a/ext/intl/tests/intltz_get_canonical_id_refs.phpt +++ b/ext/intl/tests/intltz_get_canonical_id_refs.phpt @@ -12,7 +12,8 @@ $ref =& $test->prop; print_R(intltz_get_canonical_id('Portugal', $ref)); var_dump($test); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Implicit conversion from true to string in %s on line %d Europe/Lisbonobject(Test)#1 (1) { ["prop"]=> &string(1) "1" diff --git a/ext/intl/tests/locale_bug66289.phpt b/ext/intl/tests/locale_bug66289.phpt index a8939a2d7823..41c413b31b24 100644 --- a/ext/intl/tests/locale_bug66289.phpt +++ b/ext/intl/tests/locale_bug66289.phpt @@ -7,15 +7,15 @@ intl ini_set("intl.default_locale", "en-US"); $availableLocales = array('fr_FR', 'de', 'es_ES', 'es_419', 'en_US'); -var_dump(locale_lookup($availableLocales, false, true, 'fr_FR')); -var_dump(locale_lookup($availableLocales, false, true, null)); +var_dump(locale_lookup($availableLocales, '', true, 'fr_FR')); +var_dump(locale_lookup($availableLocales, '', true, null)); $availableLocales = array('fr_FR', 'de', 'es_ES', 'es_419'); -var_dump(locale_lookup($availableLocales, false, true, 'fr_FR')); +var_dump(locale_lookup($availableLocales, '', true, 'fr_FR')); ini_set("intl.default_locale", "de-DE"); $availableLocales = array(Locale::getDefault()); -var_dump(locale_lookup($availableLocales, false, true)); +var_dump(locale_lookup($availableLocales, '', true)); ?> --EXPECT-- diff --git a/ext/intl/tests/locale_get_display_name5.phpt b/ext/intl/tests/locale_get_display_name5.phpt index e7f14a4be7a3..b04bef6ad423 100644 --- a/ext/intl/tests/locale_get_display_name5.phpt +++ b/ext/intl/tests/locale_get_display_name5.phpt @@ -90,7 +90,7 @@ function ut_main() foreach( $disp_locales as $disp_locale ) { $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); + $scr = $scr === false ? 'false' : str_replace(array('(', ')'), '#', $scr); $res_str .= "disp_locale=$disp_locale : display_name=$scr"; $res_str .= "\n"; } @@ -162,9 +162,9 @@ disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=eu disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro# ----------------- locale='uk-ua_CALIFORNIA@currency=;currency=GRN' -disp_locale=en : display_name= -disp_locale=fr : display_name= -disp_locale=de : display_name= +disp_locale=en : display_name=false +disp_locale=fr : display_name=false +disp_locale=de : display_name=false ----------------- locale='root' disp_locale=en : display_name=Root diff --git a/ext/intl/tests/locale_get_display_name6.phpt b/ext/intl/tests/locale_get_display_name6.phpt index 7a34c64e82bf..0a253b1a9160 100644 --- a/ext/intl/tests/locale_get_display_name6.phpt +++ b/ext/intl/tests/locale_get_display_name6.phpt @@ -91,7 +91,7 @@ function ut_main() foreach( $disp_locales as $disp_locale ) { $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); + $scr = $scr === false ? 'false' : str_replace(array('(', ')'), '#', $scr); $res_str .= "disp_locale=$disp_locale : display_name=$scr"; $res_str .= "\n"; } @@ -163,9 +163,9 @@ disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=eu disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro# ----------------- locale='uk-ua_CALIFORNIA@currency=;currency=GRN' -disp_locale=en : display_name= -disp_locale=fr : display_name= -disp_locale=de : display_name= +disp_locale=en : display_name=false +disp_locale=fr : display_name=false +disp_locale=de : display_name=false ----------------- locale='root' disp_locale=en : display_name=Unknown language diff --git a/ext/intl/tests/locale_get_display_name7.phpt b/ext/intl/tests/locale_get_display_name7.phpt index 26926d7f7060..f74e95aaa4c8 100644 --- a/ext/intl/tests/locale_get_display_name7.phpt +++ b/ext/intl/tests/locale_get_display_name7.phpt @@ -91,7 +91,7 @@ function ut_main() foreach( $disp_locales as $disp_locale ) { $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); + $scr = $scr === false ? 'false' : str_replace(array('(', ')'), '#', $scr); $res_str .= "disp_locale=$disp_locale : display_name=$scr"; $res_str .= "\n"; } @@ -163,9 +163,9 @@ disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=eu disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro# ----------------- locale='uk-ua_CALIFORNIA@currency=;currency=GRN' -disp_locale=en : display_name= -disp_locale=fr : display_name= -disp_locale=de : display_name= +disp_locale=en : display_name=false +disp_locale=fr : display_name=false +disp_locale=de : display_name=false ----------------- locale='root' disp_locale=en : display_name=Unknown language diff --git a/ext/intl/tests/locale_get_display_name8.phpt b/ext/intl/tests/locale_get_display_name8.phpt index 7fa2e61d0648..2f34befa4ab0 100644 --- a/ext/intl/tests/locale_get_display_name8.phpt +++ b/ext/intl/tests/locale_get_display_name8.phpt @@ -90,7 +90,7 @@ function ut_main() foreach( $disp_locales as $disp_locale ) { $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); + $scr = $scr === false ? 'false' : str_replace(array('(', ')'), '#', $scr); $res_str .= "disp_locale=$disp_locale : display_name=$scr"; $res_str .= "\n"; } @@ -162,9 +162,9 @@ disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=eu disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro# ----------------- locale='uk-ua_CALIFORNIA@currency=;currency=GRN' -disp_locale=en : display_name= -disp_locale=fr : display_name= -disp_locale=de : display_name= +disp_locale=en : display_name=false +disp_locale=fr : display_name=false +disp_locale=de : display_name=false ----------------- locale='root' disp_locale=en : display_name=Unknown language diff --git a/ext/intl/tests/rbbiter___construct_basic.phpt b/ext/intl/tests/rbbiter___construct_basic.phpt index 25f12c0a8dbb..aba3dcd3d2ec 100644 --- a/ext/intl/tests/rbbiter___construct_basic.phpt +++ b/ext/intl/tests/rbbiter___construct_basic.phpt @@ -24,7 +24,7 @@ $rbbi = new IntlRuleBasedBreakIterator($rules); var_dump(get_class($rbbi)); try { - $obj = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+', 'aoeu'); + $obj = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+', true); } catch (IntlException $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/json/tests/bug69187.phpt b/ext/json/tests/bug69187.phpt index 4d076c4b50b1..433177ab4e0e 100644 --- a/ext/json/tests/bug69187.phpt +++ b/ext/json/tests/bug69187.phpt @@ -2,8 +2,6 @@ Bug #69187 json_last_error return BC in PHP7 --FILE-- [\w]+@ism", $line, $matches)) { diff --git a/ext/mysqli/tests/mysqli_prepare_no_object.phpt b/ext/mysqli/tests/mysqli_prepare_no_object.phpt index 7ef3728535fe..2173f8a93219 100644 --- a/ext/mysqli/tests/mysqli_prepare_no_object.phpt +++ b/ext/mysqli/tests/mysqli_prepare_no_object.phpt @@ -10,10 +10,6 @@ require_once 'skipifconnectfailure.inc'; prepare(false))) - printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true)); - printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error); - if (false !== ($tmp = $mysqli->prepare(''))) printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true)); printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error); @@ -37,8 +29,6 @@ require_once 'skipifconnectfailure.inc'; require_once 'clean_table.inc'; ?> --EXPECT-- -a) [1065] Query was empty b) [1065] Query was empty c) [1065] Query was empty -c) [1065] Query was empty done! diff --git a/ext/opcache/tests/jit/assign_obj_008.phpt b/ext/opcache/tests/jit/assign_obj_008.phpt new file mode 100644 index 000000000000..33cfbbf45bbe --- /dev/null +++ b/ext/opcache/tests/jit/assign_obj_008.phpt @@ -0,0 +1,67 @@ +--TEST-- +JIT ASSIGN_OBJ: lossy bool coercion deprecation converted to an exception +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.jit_buffer_size=1M +opcache.jit=tracing +opcache.jit_hot_loop=1 +opcache.jit_hot_func=1 +opcache.jit_hot_return=1 +opcache.jit_hot_side_exit=1 +--FILE-- +b = 2; +} +function assign_int() { + $test = new Test; + $test->i = true; +} +function assign_string() { + $test = new Test; + $test->s = false; +} + +/* The values are allowed until the last one. */ +function assign_in_loop(Test $test, array $values) { + foreach ($values as $value) { + $test->b = $value; + } +} + +foreach (['assign_bool', 'assign_int', 'assign_string'] as $function) { + try { + $function(); + } catch (Exception $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +$test = new Test; +try { + assign_in_loop($test, [0, 1, 0, 1, 0, 1, 2]); +} catch (Exception $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} +var_dump($test->b); +?> +--EXPECT-- +Exception: Implicit conversion from int 2 to bool +Exception: Implicit conversion from true to int +Exception: Implicit conversion from false to string +Exception: Implicit conversion from int 2 to bool +bool(true) diff --git a/ext/openssl/tests/bug38261.phpt b/ext/openssl/tests/bug38261.phpt index 582ebac054a8..e739876d52d4 100644 --- a/ext/openssl/tests/bug38261.phpt +++ b/ext/openssl/tests/bug38261.phpt @@ -4,7 +4,7 @@ openssl key from zval leaks openssl --FILE-- --EXPECTF-- Warning: openssl_decrypt(): IV passed is only 4 bytes long, cipher expects an IV of precisely 16 bytes, padding with \0 in %s on line %d diff --git a/ext/openssl/tests/session_resumption_get_cb_no_ticket.phpt b/ext/openssl/tests/session_resumption_get_cb_no_ticket.phpt index 74db2f3474ba..0bd7ada829be 100644 --- a/ext/openssl/tests/session_resumption_get_cb_no_ticket.phpt +++ b/ext/openssl/tests/session_resumption_get_cb_no_ticket.phpt @@ -58,9 +58,6 @@ $clientCode = <<<'CODE' if ($client === false) { echo "Connection failed as expected\n"; } - - $result = phpt_wait(); - echo trim($result) . "\n"; CODE; include 'CertificateGenerator.inc'; diff --git a/ext/openssl/tests/session_resumption_new_cb_no_context.phpt b/ext/openssl/tests/session_resumption_new_cb_no_context.phpt index ee2852c54ad7..b1e16b84e507 100644 --- a/ext/openssl/tests/session_resumption_new_cb_no_context.phpt +++ b/ext/openssl/tests/session_resumption_new_cb_no_context.phpt @@ -56,9 +56,6 @@ $clientCode = <<<'CODE' ]]); $client = @stream_socket_client("tls://{{ ADDR }}", $errno, $errstr, 30, $flags, $ctx); - - $result = phpt_wait(); - echo trim($result) . "\n"; CODE; include 'CertificateGenerator.inc'; diff --git a/ext/openssl/tests/session_resumption_require_new_cb.phpt b/ext/openssl/tests/session_resumption_require_new_cb.phpt index a08408e2d90b..a68445cba7e6 100644 --- a/ext/openssl/tests/session_resumption_require_new_cb.phpt +++ b/ext/openssl/tests/session_resumption_require_new_cb.phpt @@ -53,9 +53,6 @@ $clientCode = <<<'CODE' if ($client === false) { echo "Connection failed as expected\n"; } - - $result = phpt_wait(); - echo trim($result) . "\n"; CODE; include 'CertificateGenerator.inc'; diff --git a/ext/pdo_dblib/tests/pdo_dblib_quote.phpt b/ext/pdo_dblib/tests/pdo_dblib_quote.phpt index 05d1bbf82dd8..0c908174636b 100644 --- a/ext/pdo_dblib/tests/pdo_dblib_quote.phpt +++ b/ext/pdo_dblib/tests/pdo_dblib_quote.phpt @@ -33,7 +33,10 @@ var_dump($db->getAttribute(PDO::ATTR_DEFAULT_STR_PARAM) === PDO::PARAM_STR_NATL) ?> --EXPECTF-- +Deprecated: Implicit conversion from true to string in %s on line %d string(3) "'1'" + +Deprecated: Implicit conversion from false to string in %s on line %d string(2) "''" string(4) "'42'" diff --git a/ext/pdo_odbc/tests/pdoodbc_001.phpt b/ext/pdo_odbc/tests/pdoodbc_001.phpt index a35db27b54f7..654aa9b5b0b8 100644 --- a/ext/pdo_odbc/tests/pdoodbc_001.phpt +++ b/ext/pdo_odbc/tests/pdoodbc_001.phpt @@ -12,7 +12,7 @@ PDOTest::skip(); require 'ext/pdo/tests/pdo_test.inc'; $config = PDOTest::get_config(__DIR__ . "/common.phpt"); -$db = new Pdo\Odbc($config['ENV']['PDOTEST_DSN'], $config['ENV']['PDOTEST_USER'], $config['ENV']['PDOTEST_PASS']); +$db = new Pdo\Odbc($config['ENV']['PDOTEST_DSN'], $config['ENV']['PDOTEST_USER'] ?: null, $config['ENV']['PDOTEST_PASS'] ?: null); $db->query("CREATE TABLE pdoodbc_001 (id INT, name TEXT)"); $db->query("INSERT INTO pdoodbc_001 VALUES (NULL, 'PHP'), (NULL, 'PHP6')"); diff --git a/ext/pdo_odbc/tests/pdoodbc_002.phpt b/ext/pdo_odbc/tests/pdoodbc_002.phpt index bd02f57fd8e3..5ce91190d058 100644 --- a/ext/pdo_odbc/tests/pdoodbc_002.phpt +++ b/ext/pdo_odbc/tests/pdoodbc_002.phpt @@ -12,7 +12,7 @@ PDOTest::skip(); require 'ext/pdo/tests/pdo_test.inc'; $config = PDOTest::get_config(__DIR__ . "/common.phpt"); -$db = Pdo\Odbc::connect($config['ENV']['PDOTEST_DSN'], $config['ENV']['PDOTEST_USER'], $config['ENV']['PDOTEST_PASS']); +$db = Pdo\Odbc::connect($config['ENV']['PDOTEST_DSN'], $config['ENV']['PDOTEST_USER'] ?: null, $config['ENV']['PDOTEST_PASS'] ?: null); if (!$db instanceof Pdo\Odbc) { echo "Wrong class type. Should be Pdo\Odbc but is " . get_class($db) . "\n"; } diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_failed_execute.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_failed_execute.phpt index b711855e2afe..c4d5d2b8a000 100644 --- a/ext/pdo_sqlite/tests/pdo_sqlite_failed_execute.phpt +++ b/ext/pdo_sqlite/tests/pdo_sqlite_failed_execute.phpt @@ -28,17 +28,20 @@ $db->sqliteCreateFunction('fail_execute', function (bool $fail): string { return 'first'; }); $stmt = $db->prepare('SELECT fail_execute(?) AS value UNION ALL SELECT 2'); -$stmt->execute([false]); +$stmt->bindValue(1, false, PDO::PARAM_BOOL); +$stmt->execute(); var_dump($stmt->fetchColumn()); try { - $stmt->execute([true]); + $stmt->bindValue(1, true, PDO::PARAM_BOOL); + $stmt->execute(); } catch (RuntimeException $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } var_dump($stmt->fetchColumn()); -$stmt->execute([false]); +$stmt->bindValue(1, false, PDO::PARAM_BOOL); +$stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_COLUMN)); $db->exec('CREATE TABLE failed_execute (value INTEGER UNIQUE)'); diff --git a/ext/phar/tests/phar_buildfromiterator4.phpt b/ext/phar/tests/phar_buildfromiterator4.phpt index 30c73cd670c6..571fde98a756 100644 --- a/ext/phar/tests/phar_buildfromiterator4.phpt +++ b/ext/phar/tests/phar_buildfromiterator4.phpt @@ -28,7 +28,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return current($this->a) !== false; } function rewind(): void { echo "rewind\n"; diff --git a/ext/phar/tests/phar_buildfromiterator6.phpt b/ext/phar/tests/phar_buildfromiterator6.phpt index 2ff938c8c68c..48c433f1ab51 100644 --- a/ext/phar/tests/phar_buildfromiterator6.phpt +++ b/ext/phar/tests/phar_buildfromiterator6.phpt @@ -28,7 +28,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return current($this->a) !== false; } function rewind(): void { echo "rewind\n"; diff --git a/ext/phar/tests/phar_buildfromiterator7.phpt b/ext/phar/tests/phar_buildfromiterator7.phpt index 662cbdfe09ad..81c3de265323 100644 --- a/ext/phar/tests/phar_buildfromiterator7.phpt +++ b/ext/phar/tests/phar_buildfromiterator7.phpt @@ -28,7 +28,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return current($this->a) !== false; } function rewind(): void { echo "rewind\n"; diff --git a/ext/phar/tests/tar/phar_buildfromiterator4.phpt b/ext/phar/tests/tar/phar_buildfromiterator4.phpt index 8fa55768b082..c15e40127074 100644 --- a/ext/phar/tests/tar/phar_buildfromiterator4.phpt +++ b/ext/phar/tests/tar/phar_buildfromiterator4.phpt @@ -28,7 +28,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return current($this->a) !== false; } 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 0408c0be6117..376a3d9a5662 100644 --- a/ext/phar/tests/tar/phar_buildfromiterator6.phpt +++ b/ext/phar/tests/tar/phar_buildfromiterator6.phpt @@ -28,7 +28,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return current($this->a) !== false; } 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 8549a182ea18..e2bb44f0bf9c 100644 --- a/ext/phar/tests/tar/phar_buildfromiterator7.phpt +++ b/ext/phar/tests/tar/phar_buildfromiterator7.phpt @@ -28,7 +28,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return current($this->a) !== false; } function rewind(): void { echo "rewind\n"; diff --git a/ext/phar/tests/zip/phar_buildfromiterator4.phpt b/ext/phar/tests/zip/phar_buildfromiterator4.phpt index 8c1096754bf2..690cb2c09272 100644 --- a/ext/phar/tests/zip/phar_buildfromiterator4.phpt +++ b/ext/phar/tests/zip/phar_buildfromiterator4.phpt @@ -28,7 +28,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return current($this->a) !== false; } 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 99387bf7dc77..be78c1df412e 100644 --- a/ext/phar/tests/zip/phar_buildfromiterator6.phpt +++ b/ext/phar/tests/zip/phar_buildfromiterator6.phpt @@ -28,7 +28,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return current($this->a) !== false; } 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 59ee896b003c..19ee74b1d57b 100644 --- a/ext/phar/tests/zip/phar_buildfromiterator7.phpt +++ b/ext/phar/tests/zip/phar_buildfromiterator7.phpt @@ -28,7 +28,7 @@ class myIterator implements Iterator } function valid(): bool { echo "valid\n"; - return current($this->a); + return current($this->a) !== false; } function rewind(): void { echo "rewind\n"; diff --git a/ext/posix/tests/posix_isatty_manual_zpp.phpt b/ext/posix/tests/posix_isatty_manual_zpp.phpt index 11843189f3d6..702dd05cd988 100644 --- a/ext/posix/tests/posix_isatty_manual_zpp.phpt +++ b/ext/posix/tests/posix_isatty_manual_zpp.phpt @@ -38,8 +38,12 @@ foreach ($types as $description => $type) { null: Deprecated: posix_isatty(): Passing null to parameter #1 ($file_descriptor) of type int is deprecated in %s on line %d bool(false) -false:bool(false) -true:bool(false) +false: +Deprecated: Implicit conversion from false to int in %s on line %d +bool(false) +true: +Deprecated: Implicit conversion from true to int in %s on line %d +bool(false) int:bool(false) float no decimal:bool(false) float decimal: diff --git a/ext/posix/tests/posix_ttyname_manual_zpp.phpt b/ext/posix/tests/posix_ttyname_manual_zpp.phpt index 0fd24efd8f81..71e753e9ce60 100644 --- a/ext/posix/tests/posix_ttyname_manual_zpp.phpt +++ b/ext/posix/tests/posix_ttyname_manual_zpp.phpt @@ -38,8 +38,12 @@ foreach ($types as $description => $type) { null: Deprecated: posix_ttyname(): Passing null to parameter #1 ($file_descriptor) of type int is deprecated in %s on line %d bool(false) -false:bool(false) -true:bool(false) +false: +Deprecated: Implicit conversion from false to int in %s on line %d +bool(false) +true: +Deprecated: Implicit conversion from true to int in %s on line %d +bool(false) int:bool(false) float no decimal:bool(false) float decimal: diff --git a/ext/reflection/tests/005.phpt b/ext/reflection/tests/005.phpt index 58411f98c847..b6ffe6af8a5b 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 adb378434737..62f44eec49f2 100644 --- a/ext/reflection/tests/ReflectionClass_constructor_002.phpt +++ b/ext/reflection/tests/ReflectionClass_constructor_002.phpt @@ -14,12 +14,6 @@ try { echo $e->getMessage() . "\n"; } -try { - var_dump(new ReflectionClass(true)); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; -} - try { var_dump(new ReflectionClass(1)); } catch (Exception $e) { @@ -51,7 +45,6 @@ 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 caadf2e3713f..000000000000 --- a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -ReflectionClass::getConstant() - bad params ---FILE-- -getConstant(1)); -var_dump($rc->getConstant(1.5)); -var_dump($rc->getConstant(true)); -?> ---EXPECTF-- -Check invalid params: - -Deprecated: ReflectionClass::getConstant() for a non-existent constant is deprecated, use ReflectionClass::hasConstant() to check if the constant exists in %s on line %d -bool(false) - -Deprecated: ReflectionClass::getConstant() for a non-existent constant is deprecated, use ReflectionClass::hasConstant() to check if the constant exists in %s on line %d -bool(false) - -Deprecated: ReflectionClass::getConstant() for a non-existent constant is deprecated, use ReflectionClass::hasConstant() to check if the constant exists in %s on line %d -bool(false) diff --git a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt index 9278b4787544..60b17d58b27a 100644 --- a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt @@ -36,11 +36,6 @@ 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) { @@ -63,6 +58,5 @@ Deprecated: ReflectionClass::getMethod(): Passing null to parameter #1 ($name) o 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 c2f8419a1ea7..4ddae0023951 100644 --- a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt @@ -36,11 +36,6 @@ 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) { @@ -61,6 +56,5 @@ Deprecated: ReflectionClass::getProperty(): Passing null to parameter #1 ($name) 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 4e4c206ac23e..000000000000 --- 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 5e175fbb7e5d..000000000000 --- 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 14b4520e07ef..000000000000 --- 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 9a1e340d83a3..2074da7816eb 100644 --- a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt +++ b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt @@ -14,8 +14,8 @@ class TestClass try { - echo "\nWrong type of argument (bool):\n"; - $methodInfo = new ReflectionMethod(true); + echo "\nWrong type of argument (numeric string):\n"; + $methodInfo = new ReflectionMethod("1"); } catch (Exception $e) { print $e->__toString(); } @@ -26,14 +26,14 @@ try { print $e->__toString(); } try { - echo "\nWrong type of argument (bool, string):\n"; - $methodInfo = new ReflectionMethod(true, "foo"); + echo "\nWrong type of argument (numeric string, string):\n"; + $methodInfo = new ReflectionMethod("1", "foo"); } catch (Exception $e) { print $e->__toString(); } try { - echo "\nWrong type of argument (string, bool):\n"; - $methodInfo = new ReflectionMethod('TestClass', true); + echo "\nWrong type of argument (string, numeric string):\n"; + $methodInfo = new ReflectionMethod('TestClass', "1"); } catch (Exception $e) { print $e->__toString(); } @@ -64,7 +64,7 @@ try { ?> --EXPECTF-- -Wrong type of argument (bool): +Wrong type of argument (numeric string): 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 @@ -78,12 +78,12 @@ ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMeth Stack trace: #0 %s ReflectionMethod->__construct('3') #1 {main} -Wrong type of argument (bool, string): +Wrong type of argument (numeric string, string): ReflectionException: Class "1" does not exist in %s:%d Stack trace: #0 %s ReflectionMethod->__construct('1', 'foo') #1 {main} -Wrong type of argument (string, bool): +Wrong type of argument (string, numeric string): ReflectionException: Method TestClass::1() does not exist in %s:%d Stack trace: #0 %s ReflectionMethod->__construct('TestClass', '1') diff --git a/ext/reflection/tests/bug64936.phpt b/ext/reflection/tests/bug64936.phpt index 537876d1c60c..b96b186fcf46 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/session/tests/user_session_module/bug60634_error_2.phpt b/ext/session/tests/user_session_module/bug60634_error_2.phpt index 7aea0f6a35b1..85361b17ea06 100644 --- a/ext/session/tests/user_session_module/bug60634_error_2.phpt +++ b/ext/session/tests/user_session_module/bug60634_error_2.phpt @@ -35,7 +35,7 @@ class MySessionHandler implements SessionHandlerInterface { } function gc($maxlifetime): int { - return true; + return 0; } private int $id = 0; diff --git a/ext/session/tests/user_session_module/bug71162.phpt b/ext/session/tests/user_session_module/bug71162.phpt index 54679973dc31..c2530c90ad72 100644 --- a/ext/session/tests/user_session_module/bug71162.phpt +++ b/ext/session/tests/user_session_module/bug71162.phpt @@ -30,7 +30,7 @@ class MySessionHandler extends SessionHandler implements SessionUpdateTimestampH } public function gc($maxlifetime): int|false { - return TRUE; + return 0; } public function create_sid(): string { diff --git a/ext/session/tests/user_session_module/bug79091.phpt b/ext/session/tests/user_session_module/bug79091.phpt index 643b936fa9d0..a8d520595569 100644 --- a/ext/session/tests/user_session_module/bug79091.phpt +++ b/ext/session/tests/user_session_module/bug79091.phpt @@ -18,7 +18,7 @@ class MySessionHandler implements SessionHandlerInterface, SessionIdInterface, S public function gc($maxlifetime): int|false { - return true; + return 0; } public function open($save_path, $session_name): bool diff --git a/ext/session/tests/user_session_module/gh7787.phpt b/ext/session/tests/user_session_module/gh7787.phpt index ee62e8f04963..db30495f9384 100644 --- a/ext/session/tests/user_session_module/gh7787.phpt +++ b/ext/session/tests/user_session_module/gh7787.phpt @@ -29,7 +29,7 @@ class MySessionHandler extends SessionHandler implements SessionUpdateTimestampH } public function gc($maxlifetime): int|false { - return true; + return 0; } public function create_sid(): string { diff --git a/ext/session/tests/user_session_module/session_set_save_handler_class_002.phpt b/ext/session/tests/user_session_module/session_set_save_handler_class_002.phpt index 92d176ddcf3f..f7c5b9165511 100644 --- a/ext/session/tests/user_session_module/session_set_save_handler_class_002.phpt +++ b/ext/session/tests/user_session_module/session_set_save_handler_class_002.phpt @@ -41,12 +41,15 @@ class MySession2 extends SessionHandler { } public function gc($maxlifetime): int|false { + $deleted = 0; foreach (glob($this->path . '*') as $filename) { if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); + if (@unlink($filename)) { + $deleted++; + } } } - return true; + return $deleted; } private int $id = 0; diff --git a/ext/session/tests/user_session_module/session_set_save_handler_class_016.phpt b/ext/session/tests/user_session_module/session_set_save_handler_class_016.phpt index c31ffd935e32..b43383ac0d47 100644 --- a/ext/session/tests/user_session_module/session_set_save_handler_class_016.phpt +++ b/ext/session/tests/user_session_module/session_set_save_handler_class_016.phpt @@ -40,12 +40,15 @@ class MySession2 extends SessionHandler { } public function gc($maxlifetime): int|false { + $deleted = 0; foreach (glob($this->path . '*') as $filename) { if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); + if (@unlink($filename)) { + $deleted++; + } } } - return true; + return $deleted; } public function create_sid(): string { diff --git a/ext/session/tests/user_session_module/session_set_save_handler_class_017.phpt b/ext/session/tests/user_session_module/session_set_save_handler_class_017.phpt index 4556c5f26ad0..b26bc5f4fd81 100644 --- a/ext/session/tests/user_session_module/session_set_save_handler_class_017.phpt +++ b/ext/session/tests/user_session_module/session_set_save_handler_class_017.phpt @@ -40,12 +40,15 @@ class MySession2 extends SessionHandler { } public function gc($maxlifetime): int|false { + $deleted = 0; foreach (glob($this->path . '*') as $filename) { if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); + if (@unlink($filename)) { + $deleted++; + } } } - return true; + return $deleted; } public function create_sid(): string { diff --git a/ext/session/tests/user_session_module/session_set_save_handler_class_018.phpt b/ext/session/tests/user_session_module/session_set_save_handler_class_018.phpt index c1d15a2a4609..da322e07d9a9 100644 --- a/ext/session/tests/user_session_module/session_set_save_handler_class_018.phpt +++ b/ext/session/tests/user_session_module/session_set_save_handler_class_018.phpt @@ -40,12 +40,15 @@ class MySession2 extends SessionHandler { } public function gc($maxlifetime): int|false { + $deleted = 0; foreach (glob($this->path . '*') as $filename) { if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); + if (@unlink($filename)) { + $deleted++; + } } } - return true; + return $deleted; } public function create_sid(): string { diff --git a/ext/session/tests/user_session_module/session_set_save_handler_iface_001.phpt b/ext/session/tests/user_session_module/session_set_save_handler_iface_001.phpt index 023680c4a5d4..e8e101357ef9 100644 --- a/ext/session/tests/user_session_module/session_set_save_handler_iface_001.phpt +++ b/ext/session/tests/user_session_module/session_set_save_handler_iface_001.phpt @@ -37,12 +37,15 @@ class MySession2 implements SessionHandlerInterface { } public function gc($maxlifetime): int|false { + $deleted = 0; foreach (glob($this->path . '*') as $filename) { if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); + if (@unlink($filename)) { + $deleted++; + } } } - return true; + return $deleted; } } diff --git a/ext/session/tests/user_session_module/session_set_save_handler_iface_002.phpt b/ext/session/tests/user_session_module/session_set_save_handler_iface_002.phpt index f8417ec9766f..aa4d301d7bc1 100644 --- a/ext/session/tests/user_session_module/session_set_save_handler_iface_002.phpt +++ b/ext/session/tests/user_session_module/session_set_save_handler_iface_002.phpt @@ -48,13 +48,16 @@ class MySession2 implements MySessionHandlerInterface { } public function gc($maxlifetime): int|false { + $deleted = 0; foreach (glob($this->path . '*') as $filename) { if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); + if (@unlink($filename)) { + $deleted++; + } } } - return true; + return $deleted; } } diff --git a/ext/session/tests/user_session_module/session_set_save_handler_iface_003.phpt b/ext/session/tests/user_session_module/session_set_save_handler_iface_003.phpt index 66a813fa6637..c9a62bf3e677 100644 --- a/ext/session/tests/user_session_module/session_set_save_handler_iface_003.phpt +++ b/ext/session/tests/user_session_module/session_set_save_handler_iface_003.phpt @@ -38,13 +38,16 @@ class MySession2 implements SessionHandlerInterface, SessionIdInterface { } public function gc($maxlifetime): int|false { + $deleted = 0; foreach (glob($this->path . '*') as $filename) { if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); + if (@unlink($filename)) { + $deleted++; + } } } - return true; + return $deleted; } public function create_sid(): string { diff --git a/ext/session/tests/user_session_module/session_set_save_handler_sid_001.phpt b/ext/session/tests/user_session_module/session_set_save_handler_sid_001.phpt index c4538c8cc025..8ff26112d655 100644 --- a/ext/session/tests/user_session_module/session_set_save_handler_sid_001.phpt +++ b/ext/session/tests/user_session_module/session_set_save_handler_sid_001.phpt @@ -38,12 +38,15 @@ class MySession2 { } public function gc($maxlifetime): int|false { + $deleted = 0; foreach (glob($this->path . '*') as $filename) { if (filemtime($filename) + $maxlifetime < time()) { - @unlink($filename); + if (@unlink($filename)) { + $deleted++; + } } } - return true; + return $deleted; } public function create_sid(): string { diff --git a/ext/snmp/tests/snmp-object-properties.phpt b/ext/snmp/tests/snmp-object-properties.phpt index 76060aaba482..e0b51d181be7 100644 --- a/ext/snmp/tests/snmp-object-properties.phpt +++ b/ext/snmp/tests/snmp-object-properties.phpt @@ -37,7 +37,7 @@ $session->enum_print = "1"; $session->quick_print = "1"; $session->valueretrieval = "1"; $session->oid_output_format = "3"; -$session->oid_increasing_check = "45"; +$session->oid_increasing_check = "1"; var_dump($session); diff --git a/ext/soap/tests/bugs/GHSA-cj93-vc83-wgqv.phpt b/ext/soap/tests/bugs/GHSA-cj93-vc83-wgqv.phpt index c96b67bb77fa..69111275c367 100644 --- a/ext/soap/tests/bugs/GHSA-cj93-vc83-wgqv.phpt +++ b/ext/soap/tests/bugs/GHSA-cj93-vc83-wgqv.phpt @@ -24,8 +24,8 @@ if (!file_exists('/proc/meminfo')) { * swapping, which is what makes this test time out on constrained machines. */ $free_ram = 0; if ($f = fopen("/proc/meminfo","r")) { - while (!feof($f)) { - if (preg_match('/MemFree[^\d]*(\d+)/i', fgets($f), $m)) { + while (($line = fgets($f)) !== false) { + if (preg_match('/MemFree[^\d]*(\d+)/i', $line, $m)) { $free_ram = max($free_ram, $m[1]/1024/1024); if ($free_ram > 6) { $enough_free_ram = true; diff --git a/ext/standard/tests/array/array_filter_variation10.phpt b/ext/standard/tests/array/array_filter_variation10.phpt index 9e69da73f4ff..278685a89631 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') ); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/standard/tests/array/count_invalid_mode.phpt b/ext/standard/tests/array/count_invalid_mode.phpt index dd4c1e4bc267..6ce28a1bfe61 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) ValueError: count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE ValueError: count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE -int(0) -int(0) diff --git a/ext/standard/tests/array/find/array_all_trampoline.phpt b/ext/standard/tests/array/find/array_all_trampoline.phpt index 89d25b26097b..5e973ea0cd66 100644 --- a/ext/standard/tests/array/find/array_all_trampoline.phpt +++ b/ext/standard/tests/array/find/array_all_trampoline.phpt @@ -11,7 +11,7 @@ $array = [ ]; class TrampolineTest { - public function __call(string $name, array $arguments): string { + public function __call(string $name, array $arguments): bool { echo 'Trampoline for ', $name, PHP_EOL; return $arguments[0] % 2 === 0; } diff --git a/ext/standard/tests/array/find/array_any_trampoline.phpt b/ext/standard/tests/array/find/array_any_trampoline.phpt index 4a06ffd88d22..0995450f5878 100644 --- a/ext/standard/tests/array/find/array_any_trampoline.phpt +++ b/ext/standard/tests/array/find/array_any_trampoline.phpt @@ -11,7 +11,7 @@ $array = [ ]; class TrampolineTest { - public function __call(string $name, array $arguments): string { + public function __call(string $name, array $arguments): bool { echo 'Trampoline for ', $name, PHP_EOL; return $arguments[0] % 2 === 0; } diff --git a/ext/standard/tests/array/find/array_find_key_trampoline.phpt b/ext/standard/tests/array/find/array_find_key_trampoline.phpt index 0152d9506cb1..ad8f9fef31e7 100644 --- a/ext/standard/tests/array/find/array_find_key_trampoline.phpt +++ b/ext/standard/tests/array/find/array_find_key_trampoline.phpt @@ -11,7 +11,7 @@ $array = [ ]; class TrampolineTest { - public function __call(string $name, array $arguments): string { + public function __call(string $name, array $arguments): bool { echo 'Trampoline for ', $name, PHP_EOL; return $arguments[0] % 2 === 0; } diff --git a/ext/standard/tests/array/find/array_find_trampoline.phpt b/ext/standard/tests/array/find/array_find_trampoline.phpt index 2c0e10ac39ff..375552427a02 100644 --- a/ext/standard/tests/array/find/array_find_trampoline.phpt +++ b/ext/standard/tests/array/find/array_find_trampoline.phpt @@ -11,7 +11,7 @@ $array = [ ]; class TrampolineTest { - public function __call(string $name, array $arguments): string { + public function __call(string $name, array $arguments): bool { echo 'Trampoline for ', $name, PHP_EOL; return $arguments[0] % 2 === 0; } diff --git a/ext/standard/tests/file/005_basic.phpt b/ext/standard/tests/file/005_basic.phpt index 3f68e0102e62..1cfdc3b7ef35 100644 --- a/ext/standard/tests/file/005_basic.phpt +++ b/ext/standard/tests/file/005_basic.phpt @@ -7,13 +7,15 @@ echo "*** Testing the basic functionality with file ***\n"; print( @date('Y:M:D:H:i:s', fileatime(__FILE__)) )."\n"; print( @date('Y:M:D:H:i:s', filemtime(__FILE__)) )."\n"; print( @date('Y:M:D:H:i:s', filectime(__FILE__)) )."\n"; -print( @date('Y:M:D:H:i:s', touch(__DIR__."/005_basic.tmp")) )."\n"; +touch(__DIR__."/005_basic.tmp"); +print( @date('Y:M:D:H:i:s', filemtime(__DIR__."/005_basic.tmp")) )."\n"; echo "*** Testing the basic functionality with dir ***\n"; print( @date('Y:M:D:H:i:s', fileatime(".")) )."\n"; print( @date('Y:M:D:H:i:s', filemtime(".")) )."\n"; print( @date('Y:M:D:H:i:s', filectime(".")) )."\n"; -print( @date('Y:M:D:H:i:s', touch(__DIR__."/005_basic")) )."\n"; +touch(__DIR__."/005_basic"); +print( @date('Y:M:D:H:i:s', filemtime(__DIR__."/005_basic")) )."\n"; echo "\n*** Done ***\n"; ?> diff --git a/ext/standard/tests/file/005_variation2-win32.phpt b/ext/standard/tests/file/005_variation2-win32.phpt index 9f5b7ba6795d..0f26f66cbed0 100644 --- a/ext/standard/tests/file/005_variation2-win32.phpt +++ b/ext/standard/tests/file/005_variation2-win32.phpt @@ -28,12 +28,10 @@ function stat_fn( $filename ) { echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n"; echo "\n*** testing file info ***"; -stat_fn(false); stat_fn(''); stat_fn(' '); stat_fn('|'); echo "\n*** testing touch ***\n"; -var_dump(touch(false)); var_dump(touch('')); //php generates permission denied, we generate No such file or dir. @@ -52,11 +50,6 @@ echo "Done"; -- 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 => Warning: fileatime(): stat failed for in %s on line %d @@ -81,7 +74,6 @@ Warning: filectime(): stat failed for | in %s on line %d *** testing touch *** bool(false) -bool(false) Warning: touch(): %s in %s on line %d bool(false) diff --git a/ext/standard/tests/file/005_variation2.phpt b/ext/standard/tests/file/005_variation2.phpt index 42b0fd1904d7..15f604f8ba5b 100644 --- a/ext/standard/tests/file/005_variation2.phpt +++ b/ext/standard/tests/file/005_variation2.phpt @@ -33,19 +33,16 @@ $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('|'); @@ -65,7 +62,6 @@ echo "Done"; Warning: Undefined variable $a in %s on line %d NULL bool(false) -bool(false) bool(true) bool(true) @@ -75,11 +71,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 446e7fac16a0..01cd63a353b6 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 -1, - "TRUE" => TRUE, - "FALSE" => FALSE, + "\"1\"" => "1", "\"\"" => "", "\" \"" => " ", "\\0" => "\0", @@ -49,14 +48,11 @@ foreach($names_arr as $key =>$value) { Warning: file_get_contents(): Failed to open stream: No such file or directory in %s on line %d bool(false) --- Filename: TRUE -- +-- Filename: "1" -- Warning: file_get_contents(): Failed to open stream: No such file or directory in %s on line %d bool(false) --- Filename: FALSE -- -ValueError: Path must not be empty - -- Filename: "" -- ValueError: Path must not be empty diff --git a/ext/standard/tests/file/file_get_contents_variation8.phpt b/ext/standard/tests/file/file_get_contents_variation8.phpt index d56249675667..35ba69d50cf3 100644 --- a/ext/standard/tests/file/file_get_contents_variation8.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8.phpt @@ -17,8 +17,7 @@ echo "*** Testing file_get_contents() : variation ***\n"; $names_arr = array( /* Invalid args */ -1, - TRUE, - FALSE, + "1", "", " ", "\0", @@ -54,20 +53,18 @@ 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 -- +-- Iteration 4 -- ValueError: file_get_contents(): Argument #1 ($filename) must not contain any null bytes --- Iteration 6 -- +-- Iteration 5 -- TypeError: file_get_contents(): Argument #1 ($filename) must be of type string, array given --- Iteration 7 -- +-- Iteration 6 -- Warning: file_get_contents(): Failed to open stream: No such file or directory in %s on line %d bool(false) --- Iteration 8 -- +-- Iteration 7 -- Warning: file_get_contents(): 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-win32.phpt b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt index 221bffc54db0..8911d8c47941 100644 --- a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt @@ -16,8 +16,7 @@ echo "*** Testing file_put_contents() : usage variation ***\n"; /* An array of filenames */ $names_arr = array( "-1" => -1, - "TRUE" => TRUE, - "FALSE" => FALSE, + "\"1\"" => "1", "\"\"" => "", "\" \"" => " ", "\\0" => "\0", @@ -51,12 +50,9 @@ foreach($names_arr as $key =>$value) { -- Filename: -1 -- 9 bytes written to: '-1' --- Filename: TRUE -- +-- Filename: "1" -- 9 bytes written to: '1' --- Filename: FALSE -- -ValueError: Path must not be empty - -- Filename: "" -- ValueError: Path must not be empty diff --git a/ext/standard/tests/file/file_put_contents_variation8.phpt b/ext/standard/tests/file/file_put_contents_variation8.phpt index 7f1ad5c4a66a..74c68849229c 100644 --- a/ext/standard/tests/file/file_put_contents_variation8.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8.phpt @@ -20,8 +20,7 @@ chdir($dir); /* An array of filenames */ $names_arr = array( -1, - TRUE, - FALSE, + "1", "", " ", //this one also generates a java message rather than our own so we don't replicate php message @@ -66,18 +65,16 @@ rmdir($dir); -- Iteration 2 -- ValueError: Path must not be empty -- Iteration 3 -- -ValueError: Path must not be empty --- Iteration 4 -- 9 bytes written to: ' ' --- Iteration 5 -- +-- Iteration 4 -- ValueError: file_put_contents(): Argument #1 ($filename) must not contain any null bytes --- Iteration 6 -- +-- Iteration 5 -- TypeError: file_put_contents(): Argument #1 ($filename) must be of type string, array given --- Iteration 7 -- +-- Iteration 6 -- Warning: file_put_contents(): Failed to open stream: %s in %s on line %d Failed to write data to: '%sir' --- Iteration 8 -- +-- Iteration 7 -- Warning: file_put_contents(): 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 eeff71fa61ba..4006d7749436 100644 --- a/ext/standard/tests/file/filegroup_variation2.phpt +++ b/ext/standard/tests/file/filegroup_variation2.phpt @@ -6,7 +6,7 @@ Dave Kelsey obscure_filename --FILE-- obscure_filename --FILE-- obscure_filename --FILE-- diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt index 8f1e92eb5d1c..5869a9b57001 100644 --- a/ext/standard/tests/file/fnmatch_variation.phpt +++ b/ext/standard/tests/file/fnmatch_variation.phpt @@ -111,19 +111,15 @@ $str_arr = array( ); match_($str_arr, $str_arr); -echo "\n--- With booleans ---\n"; -$bool_arr = array( - TRUE, - true, +echo "\n--- With mixed integers and strings ---\n"; +$mixed_arr = array( 1, 10, - FALSE, - false, 0, "", "string" ); -match_($bool_arr, $bool_arr); +match_($mixed_arr, $mixed_arr); echo "\n--- With NULL ---\n"; $null_arr = array( @@ -302,35 +298,23 @@ ValueError: fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(true) ---- With booleans --- +--- With mixed integers and strings --- -- 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(true) bool(false) bool(false) bool(false) -- Iteration 2 -- -bool(true) -bool(true) -bool(true) -bool(false) -bool(false) bool(false) bool(false) +bool(true) bool(false) bool(false) -- Iteration 3 -- @@ -339,60 +323,12 @@ 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 -- diff --git a/ext/standard/tests/file/fread_variation2.phpt b/ext/standard/tests/file/fread_variation2.phpt index 1fee493c4b69..520dac9e2c6e 100644 --- a/ext/standard/tests/file/fread_variation2.phpt +++ b/ext/standard/tests/file/fread_variation2.phpt @@ -24,11 +24,12 @@ function check_read($file_handle, $read_size, $expect_size) { echo "Reading $read_size bytes from file, expecting $expect_size bytes ... "; $data_from_file = fread($file_handle, $read_size); - // check if data read is of expected size - if ( strlen($data_from_file) == $expect_size) + // check if data read is of expected size (fread() returns false on failure) + $bytes_read = $data_from_file === false ? 0 : strlen($data_from_file); + if ( $bytes_read == $expect_size) echo "OK\n"; else - echo "Error reading file, total number of bytes read = ".strlen($data_from_file)."\n"; + echo "Error reading file, total number of bytes read = ".$bytes_read."\n"; // file pointer position after read var_dump( ftell($file_handle) ); diff --git a/ext/standard/tests/file/fread_variation4.phpt b/ext/standard/tests/file/fread_variation4.phpt index 1ed43464f88f..80c243c3a0f9 100644 --- a/ext/standard/tests/file/fread_variation4.phpt +++ b/ext/standard/tests/file/fread_variation4.phpt @@ -22,11 +22,12 @@ function check_read($file_handle, $read_size, $expect_size) { echo "Reading $read_size bytes from file, expecting $expect_size bytes ... "; $data_from_file = fread($file_handle, $read_size); - // check if data read is of expected size - if ( strlen($data_from_file) == $expect_size) + // check if data read is of expected size (fread() returns false on failure) + $bytes_read = $data_from_file === false ? 0 : strlen($data_from_file); + if ( $bytes_read == $expect_size) echo "OK\n"; else - echo "Error reading file, total number of bytes read = ".strlen($data_from_file)."\n"; + echo "Error reading file, total number of bytes read = ".$bytes_read."\n"; // file pointer position after read var_dump( ftell($file_handle) ); diff --git a/ext/standard/tests/file/fscanf_variation13.phpt b/ext/standard/tests/file/fscanf_variation13.phpt index 7dbff56b5c1f..c5482abf9142 100644 --- a/ext/standard/tests/file/fscanf_variation13.phpt +++ b/ext/standard/tests/file/fscanf_variation13.phpt @@ -29,7 +29,7 @@ $counter = 1; // writing to the file foreach($bool_types as $value) { - @fprintf($file_handle, $value); + @fprintf($file_handle, (string) $value); @fprintf($file_handle, "\n"); } // closing the file diff --git a/ext/standard/tests/file/fscanf_variation19.phpt b/ext/standard/tests/file/fscanf_variation19.phpt index 00d60ee31ce5..da1478ff2bc4 100644 --- a/ext/standard/tests/file/fscanf_variation19.phpt +++ b/ext/standard/tests/file/fscanf_variation19.phpt @@ -33,7 +33,7 @@ $counter = 1; // writing to the file foreach($bool_types as $value) { - @fprintf($file_handle, $value); + @fprintf($file_handle, (string) $value); @fprintf($file_handle, "\n"); } // closing the file diff --git a/ext/standard/tests/file/fscanf_variation25.phpt b/ext/standard/tests/file/fscanf_variation25.phpt index 1a2b9f2a3d05..2d473e508535 100644 --- a/ext/standard/tests/file/fscanf_variation25.phpt +++ b/ext/standard/tests/file/fscanf_variation25.phpt @@ -33,7 +33,7 @@ $counter = 1; // writing to the file foreach($bool_types as $value) { - @fprintf($file_handle, $value); + @fprintf($file_handle, (string) $value); @fprintf($file_handle, "\n"); } // closing the file diff --git a/ext/standard/tests/file/fscanf_variation32.phpt b/ext/standard/tests/file/fscanf_variation32.phpt index 0b0351c10f2a..5b08276994f7 100644 --- a/ext/standard/tests/file/fscanf_variation32.phpt +++ b/ext/standard/tests/file/fscanf_variation32.phpt @@ -34,7 +34,7 @@ $counter = 1; // writing to the file foreach($bool_types as $value) { - @fprintf($file_handle, $value); + @fprintf($file_handle, (string) $value); @fprintf($file_handle, "\n"); } // closing the file diff --git a/ext/standard/tests/file/fscanf_variation38.phpt b/ext/standard/tests/file/fscanf_variation38.phpt index 28563727effd..826bcbb6d6fc 100644 --- a/ext/standard/tests/file/fscanf_variation38.phpt +++ b/ext/standard/tests/file/fscanf_variation38.phpt @@ -29,7 +29,7 @@ $counter = 1; // writing to the file foreach($bool_types as $value) { - @fprintf($file_handle, $value); + @fprintf($file_handle, (string) $value); @fprintf($file_handle, "\n"); } // closing the file diff --git a/ext/standard/tests/file/fscanf_variation44.phpt b/ext/standard/tests/file/fscanf_variation44.phpt index 5e58ad2df68a..ea0ff92413e8 100644 --- a/ext/standard/tests/file/fscanf_variation44.phpt +++ b/ext/standard/tests/file/fscanf_variation44.phpt @@ -29,7 +29,7 @@ $counter = 1; // writing to the file foreach($bool_types as $value) { - @fprintf($file_handle, $value); + @fprintf($file_handle, (string) $value); @fprintf($file_handle, "\n"); } // closing the file diff --git a/ext/standard/tests/file/fscanf_variation50.phpt b/ext/standard/tests/file/fscanf_variation50.phpt index c52f5a571d73..c467f66c23b4 100644 --- a/ext/standard/tests/file/fscanf_variation50.phpt +++ b/ext/standard/tests/file/fscanf_variation50.phpt @@ -29,7 +29,7 @@ $counter = 1; // writing to the file foreach($bool_types as $value) { - @fprintf($file_handle, $value); + @fprintf($file_handle, (string) $value); @fprintf($file_handle, "\n"); } // closing the file diff --git a/ext/standard/tests/file/fscanf_variation7.phpt b/ext/standard/tests/file/fscanf_variation7.phpt index 36af4e193da7..e1ac62ebae8b 100644 --- a/ext/standard/tests/file/fscanf_variation7.phpt +++ b/ext/standard/tests/file/fscanf_variation7.phpt @@ -29,7 +29,7 @@ $counter = 1; // writing to the file foreach($bool_types as $value) { - @fprintf($file_handle, $value); + @fprintf($file_handle, (string) $value); @fprintf($file_handle, "\n"); } // closing the file diff --git a/ext/standard/tests/file/glob_variation-win32-mb.phpt b/ext/standard/tests/file/glob_variation-win32-mb.phpt index f34563db4b68..30a260f48aa0 100644 --- a/ext/standard/tests/file/glob_variation-win32-mb.phpt +++ b/ext/standard/tests/file/glob_variation-win32-mb.phpt @@ -35,7 +35,7 @@ $patterns = array ( '$file_path/glob_variation私はガラスを食べられます/wonder5', "$file_path/glob_variation私はガラスを食べられます/?wonder?", "$file_path/glob_variation私はガラスを食べられます/wonder?", - TRUE // boolean true + "1" // boolean true ); $counter = 1; /* loop through $patterns to match each $pattern with the files created diff --git a/ext/standard/tests/file/glob_variation-win32.phpt b/ext/standard/tests/file/glob_variation-win32.phpt index 74a1c3e5c7e4..e574781814c2 100644 --- a/ext/standard/tests/file/glob_variation-win32.phpt +++ b/ext/standard/tests/file/glob_variation-win32.phpt @@ -34,7 +34,7 @@ $patterns = array ( '$file_path/glob_variation/wonder5', "$file_path/glob_variation/?wonder?", "$file_path/glob_variation/wonder?", - TRUE // boolean true + "1" // boolean true ); $counter = 1; /* loop through $patterns to match each $pattern with the files created diff --git a/ext/standard/tests/file/glob_variation.phpt b/ext/standard/tests/file/glob_variation.phpt index b36793d3f3e0..43e3e26df221 100644 --- a/ext/standard/tests/file/glob_variation.phpt +++ b/ext/standard/tests/file/glob_variation.phpt @@ -37,7 +37,7 @@ $patterns = array ( '$file_path/glob_variation/wonder5', "$file_path/glob_variation/?wonder?", "$file_path/glob_variation/wonder?", - TRUE // boolean true + "1" // boolean true ); $counter = 1; /* loop through $patterns to match each $pattern with the files created diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt index 730a2bcfea4d..ad8688f22ecf 100644 --- a/ext/standard/tests/file/is_dir_variation3.phpt +++ b/ext/standard/tests/file/is_dir_variation3.phpt @@ -10,8 +10,8 @@ echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n"; $dirnames = array( /* Invalid dirnames */ -2.34555, - TRUE, - FALSE, + "1", + "", " ", /* scalars */ diff --git a/ext/standard/tests/file/is_executable_variation3.phpt b/ext/standard/tests/file/is_executable_variation3.phpt index b9b3a98e5c62..0e1707734938 100644 --- a/ext/standard/tests/file/is_executable_variation3.phpt +++ b/ext/standard/tests/file/is_executable_variation3.phpt @@ -21,8 +21,8 @@ $invalid_files = array( 0, 1234, -2.34555, - TRUE, - FALSE, + "1", + "", " ", ); /* loop through to test each element in the above array diff --git a/ext/standard/tests/file/is_readable_variation3.phpt b/ext/standard/tests/file/is_readable_variation3.phpt index e4a576676282..31bfb5c1c5b1 100644 --- a/ext/standard/tests/file/is_readable_variation3.phpt +++ b/ext/standard/tests/file/is_readable_variation3.phpt @@ -15,8 +15,8 @@ $misc_files = array( 0, 1234, -2.34555, - TRUE, - FALSE, + "1", + "", " ", ); /* loop through to test each element in the above array diff --git a/ext/standard/tests/file/is_writable_variation3.phpt b/ext/standard/tests/file/is_writable_variation3.phpt index 021d6e564541..e4de54cb157e 100644 --- a/ext/standard/tests/file/is_writable_variation3.phpt +++ b/ext/standard/tests/file/is_writable_variation3.phpt @@ -17,8 +17,8 @@ $misc_files = array( 0, 1234, -2.34555, - TRUE, - FALSE, + "1", + "", " ", ); /* loop through to test each element in the above array diff --git a/ext/standard/tests/file/lstat_stat_variation22.phpt b/ext/standard/tests/file/lstat_stat_variation22.phpt index 9efb23fc4178..4b8aae576046 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(0) "" - ["filename"]=> - string(0) "" -} -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 7 -- array(3) { ["dirname"]=> string(1) "." @@ -166,7 +152,7 @@ string(1) "." string(11) "array(1, 2)" string(0) "" string(11) "array(1, 2)" --- Iteration 8 -- +-- Iteration 7 -- array(3) { ["dirname"]=> string(1) "." @@ -179,7 +165,7 @@ string(1) "." string(21) "array( array(), null)" string(0) "" string(21) "array( array(), null)" --- Iteration 9 -- +-- Iteration 8 -- array(3) { ["dirname"]=> string(1) "." @@ -192,7 +178,7 @@ string(1) "." string(1) " " string(0) "" string(1) " " --- Iteration 10 -- +-- Iteration 9 -- array(3) { ["dirname"]=> string(1) "." @@ -205,7 +191,7 @@ string(1) "." string(1) " " string(0) "" string(1) " " --- Iteration 11 -- +-- Iteration 10 -- array(2) { ["basename"]=> string(0) "" @@ -216,7 +202,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 12 -- +-- Iteration 11 -- array(2) { ["basename"]=> string(0) "" @@ -227,7 +213,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 13 -- +-- Iteration 12 -- array(4) { ["dirname"]=> string(1) "." @@ -242,7 +228,7 @@ string(1) "." string(11) "www.foo.com" string(3) "com" string(7) "www.foo" --- Iteration 14 -- +-- Iteration 13 -- array(4) { ["dirname"]=> string(17) "/var/html/testdir" @@ -257,7 +243,7 @@ string(17) "/var/html/testdir" string(12) "example.html" string(4) "html" string(7) "example" --- Iteration 15 -- +-- Iteration 14 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -270,7 +256,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 16 -- +-- Iteration 15 -- array(4) { ["dirname"]=> string(4) "/foo" @@ -285,7 +271,7 @@ string(4) "/foo" string(12) "symlink.link" string(4) "link" string(7) "symlink" --- Iteration 17 -- +-- Iteration 16 -- array(3) { ["dirname"]=> string(1) "." @@ -298,7 +284,7 @@ string(1) "." string(5) "12345" string(0) "" string(5) "12345" --- Iteration 18 -- +-- Iteration 17 -- array(4) { ["dirname"]=> string(1) "." @@ -313,7 +299,7 @@ string(1) "." string(15) "www.example.com" string(3) "com" string(11) "www.example" --- Iteration 19 -- +-- Iteration 18 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -326,7 +312,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 20 -- +-- Iteration 19 -- array(4) { ["dirname"]=> string(6) "../foo" @@ -341,7 +327,7 @@ string(6) "../foo" string(9) "test.link" string(4) "link" string(4) "test" --- Iteration 21 -- +-- Iteration 20 -- array(4) { ["dirname"]=> string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6" @@ -356,7 +342,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 21 -- array(4) { ["dirname"]=> string(1) "." diff --git a/ext/standard/tests/file/readfile_error.phpt b/ext/standard/tests/file/readfile_error.phpt index cc47ca7560e2..10e4d4e2520c 100644 --- a/ext/standard/tests/file/readfile_error.phpt +++ b/ext/standard/tests/file/readfile_error.phpt @@ -13,11 +13,6 @@ try { } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } -try { - var_dump( readfile(false) ); // boolean false as $filename -} catch (Throwable $e) { - echo $e::class, ': ', $e->getMessage(), "\n"; -} 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 -- ValueError: Path must not be empty -ValueError: Path must not be empty -- Testing readfile() with non-existent file -- diff --git a/ext/standard/tests/file/readfile_variation10-win32.phpt b/ext/standard/tests/file/readfile_variation10-win32.phpt index 1dbb896fbc8c..9eaeec3a1b9e 100644 --- a/ext/standard/tests/file/readfile_variation10-win32.phpt +++ b/ext/standard/tests/file/readfile_variation10-win32.phpt @@ -17,8 +17,7 @@ echo "*** Testing readfile() : variation ***\n"; $names_arr = array( /* Invalid args */ "-1" => -1, - "TRUE" => TRUE, - "FALSE" => FALSE, + "\"1\"" => "1", "\"\"" => "", "\" \"" => " ", "\\0" => "\0", @@ -46,13 +45,10 @@ foreach($names_arr as $key => $value) { Warning: readfile(): Failed to open stream: No such file or directory in %s on line %d --- Filename: TRUE -- +-- Filename: "1" -- Warning: readfile(): Failed to open stream: No such file or directory in %s on line %d --- Filename: FALSE -- -ValueError: Path must not be empty - -- Filename: "" -- ValueError: Path must not be empty diff --git a/ext/standard/tests/file/readfile_variation10.phpt b/ext/standard/tests/file/readfile_variation10.phpt index 90910ebc65d6..275bd182dbb1 100644 --- a/ext/standard/tests/file/readfile_variation10.phpt +++ b/ext/standard/tests/file/readfile_variation10.phpt @@ -18,8 +18,7 @@ echo "*** Testing readfile() : variation ***\n"; $names_arr = array( /* Invalid args */ -1, - TRUE, - FALSE, + "1", "", " ", "\0", @@ -50,8 +49,6 @@ Warning: readfile(): Failed to open stream: %s in %s on line %d Warning: readfile(): Failed to open stream: %s in %s on line %d -- testing '' -- ValueError: Path must not be empty --- testing '' -- -ValueError: Path must not be empty -- testing ' ' -- Warning: readfile(): Failed to open stream: %s in %s on line %d diff --git a/ext/standard/tests/file/readlink_variation1.phpt b/ext/standard/tests/file/readlink_variation1.phpt index b3d6fc9a44ef..bf9895863111 100644 --- a/ext/standard/tests/file/readlink_variation1.phpt +++ b/ext/standard/tests/file/readlink_variation1.phpt @@ -6,7 +6,7 @@ Dave Kelsey obscure_filename --FILE-- "1" */ - FALSE, + "1", "", // I think both p8 and php are wrong on the messages here //p8 generates different messages to php, php is probably wrong //php has either "File Exists" or "Permission Denied". @@ -67,40 +66,33 @@ bool(true) Warning: rename(): The system cannot find the file specified (code: 2) in %srename_variation13-win32.php on line %d bool(false) --- 1 testing '1' boolean -- +-- 1 testing '1' string -- bool(true) Warning: rename(): The system cannot find the file specified (code: 2) in %srename_variation13-win32.php on line %d bool(false) --- 2 testing '' boolean -- +-- 2 testing '' string -- Warning: rename(): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d bool(false) Warning: rename(): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d bool(false) --- 3 testing '' string -- - -Warning: rename(): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d -bool(false) - -Warning: rename(): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d -bool(false) --- 4 testing ' ' string -- +-- 3 testing ' ' string -- Warning: rename(): The filename, directory name, or volume label syntax is incorrect (code: 123) in %srename_variation13-win32.php on line %d bool(false) Warning: rename(): The filename, directory name, or volume label syntax is incorrect (code: 123) in %srename_variation13-win32.php on line %d bool(false) --- 5 testing '/no/such/file/dir' string -- +-- 4 testing '/no/such/file/dir' string -- Warning: rename(): The system cannot find the path specified (code: 3) in %srename_variation13-win32.php on line %d bool(false) Warning: rename(): The system cannot find the path specified (code: 3) in %srename_variation13-win32.php on line %d bool(false) --- 6 testing 'php/php' string -- +-- 5 testing 'php/php' string -- Warning: rename(): The system cannot find the path specified (code: 3) in %srename_variation13-win32.php on line %d bool(false) diff --git a/ext/standard/tests/file/rename_variation13.phpt b/ext/standard/tests/file/rename_variation13.phpt index e53cf86f16bb..b6a199d96f19 100644 --- a/ext/standard/tests/file/rename_variation13.phpt +++ b/ext/standard/tests/file/rename_variation13.phpt @@ -24,8 +24,7 @@ mkdir($file_path); $names_arr = array( /* Invalid args */ -1, - TRUE, - FALSE, + "1", "", " ", @@ -71,13 +70,6 @@ bool(false) Warning: rename('%s/renameVar13/afile.tmp', ''): %s in %s on line %d bool(false) -Warning: rename('', '%s/renameVar13/afile.tmp'): %s in %s on line %d -bool(false) --- testing '' -- - -Warning: rename('%s/renameVar13/afile.tmp', ''): %s in %s on line %d -bool(false) - Warning: rename('', '%s/renameVar13/afile.tmp'): %s in %s on line %d bool(false) -- testing ' ' -- diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt index a247967823c3..b5c2c084ab6b 100644 --- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt +++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt @@ -20,9 +20,7 @@ echo "*** Testing symlink() for error conditions ***\n"; //invalid arguments var_dump( symlink('', $linkname) ); // empty string as filename -var_dump( symlink(false, $linkname) ); // boolean false as filename var_dump( symlink($filename, '') ); // '' as linkname -var_dump( symlink($filename, false) ); // false as linkname echo "\n*** Testing linkinfo() for error conditions ***\n"; @@ -49,12 +47,6 @@ 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 *** ValueError: linkinfo(): Argument #1 ($path) must not be empty 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 fcc64d409849..2319168a8d7d 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-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt index 5bc4f5ec884d..b4813e973f3a 100644 --- a/ext/standard/tests/file/tempnam_variation3-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt @@ -24,8 +24,7 @@ $file_path = realpath($file_path); $names_arr = array( /* Valid args (casting)*/ -1, - TRUE, - FALSE, + "1", "", " ", "\0", @@ -45,7 +44,6 @@ $res_arr = array( true, true, true, - true, false, /* prefix with path separator of a non existing directory*/ @@ -61,6 +59,10 @@ for( $i=0; $igetMessage(), "\n"; continue; } + if ($file_name === false) { + echo "tempnam() returned false\n"; + continue; + } /* creating the files in existing dir */ if (file_exists($file_name) && !$res_arr[$i]) { @@ -95,17 +97,14 @@ OK -- Iteration 2 -- OK -- Iteration 3 -- -OK --- Iteration 4 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation3-win32.php on line %d -Failed, not created in the correct directory %s vs %s -0 --- Iteration 5 -- +tempnam() returned false +-- Iteration 4 -- tempnam(): Argument #2 ($prefix) must not contain any null bytes --- Iteration 6 -- +-- Iteration 5 -- tempnam(): Argument #2 ($prefix) must be of type string, array given --- Iteration 7 -- +-- Iteration 6 -- OK --- Iteration 8 -- +-- Iteration 7 -- OK diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt index 0512c472b976..637e7dfc555f 100644 --- a/ext/standard/tests/file/tempnam_variation3.phpt +++ b/ext/standard/tests/file/tempnam_variation3.phpt @@ -19,8 +19,7 @@ mkdir($file_path); $names_arr = array( /* Invalid args */ -1, - TRUE, - FALSE, + "1", "", " ", /* prefix with path separator of a non existing directory*/ @@ -85,14 +84,10 @@ 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 -- File name is => %s/dir%s File permissions are => 100600 File created in => directory specified --- Iteration 6 -- +-- 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-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt index b731c7644912..19f6f545299d 100644 --- a/ext/standard/tests/file/tempnam_variation7-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt @@ -17,8 +17,7 @@ echo "*** Testing tempnam() with invalid/non-existing directory names ***\n"; $names_arr = array( /* Invalid args */ -1, - TRUE, - FALSE, + "1", "", " ", "\0", @@ -81,26 +80,22 @@ File name is => %s%et%s File permissions are => 100666 File created in => temp dir -- Iteration 3 -- -File name is => %s%et%s -File permissions are => 100666 -File created in => temp dir --- Iteration 4 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d File name is => %s%et%s File permissions are => 100666 File created in => temp dir --- Iteration 5 -- +-- Iteration 4 -- tempnam(): Argument #1 ($directory) must not contain any null bytes --- Iteration 6 -- +-- Iteration 5 -- tempnam(): Argument #1 ($directory) must be of type string, array given --- Iteration 7 -- +-- Iteration 6 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d File name is => %s%et%s File permissions are => 100666 File created in => temp dir --- Iteration 8 -- +-- Iteration 7 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d File name is => %s%et%s diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt index 300673db321a..00aef379cf21 100644 --- a/ext/standard/tests/file/tempnam_variation7.phpt +++ b/ext/standard/tests/file/tempnam_variation7.phpt @@ -17,8 +17,7 @@ echo "*** Testing tempnam() with invalid/non-existing directory names ***\n"; $names_arr = array( /* Invalid args */ -1, - TRUE, - FALSE, + "1", "", " ", /* Non-existing dirs */ @@ -78,22 +77,18 @@ 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 --- Iteration 4 -- 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 5 -- +-- Iteration 4 -- 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 6 -- +-- Iteration 5 -- 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 diff --git a/ext/standard/tests/file/unlink_error-win32-mb.phpt b/ext/standard/tests/file/unlink_error-win32-mb.phpt index a62114fe7dab..14a1cfc6d39b 100644 --- a/ext/standard/tests/file/unlink_error-win32-mb.phpt +++ b/ext/standard/tests/file/unlink_error-win32-mb.phpt @@ -27,9 +27,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") ); @@ -59,10 +56,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(): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/unlink_error-win32.phpt b/ext/standard/tests/file/unlink_error-win32.phpt index 1e4500d2b7e8..1f22c63f47d2 100644 --- a/ext/standard/tests/file/unlink_error-win32.phpt +++ b/ext/standard/tests/file/unlink_error-win32.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") ); @@ -56,10 +53,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(): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/unlink_error.phpt b/ext/standard/tests/file/unlink_error.phpt index 8174f1b01268..8c4694cc0ed6 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(): No such file or directory in %s on line %d 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 195affe4fc68..000000000000 --- 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/get_cfg_var_variation7.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation7.phpt index d6bdf693e8d7..96f50dec4e59 100644 --- a/ext/standard/tests/general_functions/get_cfg_var_variation7.phpt +++ b/ext/standard/tests/general_functions/get_cfg_var_variation7.phpt @@ -23,7 +23,8 @@ $variation_array = array( 'string DQ' => "string", 'string SQ' => 'string', 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc + 'heredoc' => $heredoc, + 'empty string' => '' ); @@ -37,3 +38,4 @@ bool(false) 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 c54b39ac3325..1bb13e5d784b 100644 --- a/ext/standard/tests/general_functions/ini_get_all.phpt +++ b/ext/standard/tests/general_functions/ini_get_all.phpt @@ -17,8 +17,6 @@ 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("", "")); - echo "Done\n"; ?> --EXPECTF-- @@ -76,7 +74,4 @@ array(3) { } array(0) { } - -Warning: ini_get_all(): Extension "" cannot be found in %s on line %d -bool(false) Done 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 f1f93be221ef..000000000000 --- 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 408f72bfdbaa..fb9af7ead282 100644 --- a/ext/standard/tests/general_functions/uniqid_basic.phpt +++ b/ext/standard/tests/general_functions/uniqid_basic.phpt @@ -17,8 +17,7 @@ $prefix = array ( 99999, "99999", 10.5e2, - true, - false + "1" ); for ($i = 0; $i < count($prefix); $i++) { @@ -54,7 +53,3 @@ 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 a8786d15a6de..2abe25201e72 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_get_last_response_headers()); CODE; @@ -47,7 +47,7 @@ Found the mime-type: text/html; Redirected: string(8000) "%s" Warning: file_get_contents(): 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 b6df1099a097..6972b1bfc5f5 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_get_last_response_headers()); CODE; @@ -46,7 +46,7 @@ ServerClientTestCase::getInstance()->run($clientCode, $serverCode); Found the mime-type: text/html; Warning: file_get_contents(): 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 2b4957b996a8..6a826177e22e 100644 --- a/ext/standard/tests/math/abs_basic.phpt +++ b/ext/standard/tests/math/abs_basic.phpt @@ -18,8 +18,8 @@ $values = array(23, "2.345e1", "-2.345e1", null, - true, - false); + 1, + 0); for ($i = 0; $i < count($values); $i++) { $res = abs($values[$i]); diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt index 1fac4ccc246d..d7f66e6a46b9 100644 --- a/ext/standard/tests/math/acos_variation.phpt +++ b/ext/standard/tests/math/acos_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = acos($values[$i]); diff --git a/ext/standard/tests/math/acosh_variation.phpt b/ext/standard/tests/math/acosh_variation.phpt index 9335961e637d..0e8f2343d7db 100644 --- a/ext/standard/tests/math/acosh_variation.phpt +++ b/ext/standard/tests/math/acosh_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = acosh($values[$i]); diff --git a/ext/standard/tests/math/asin_variation.phpt b/ext/standard/tests/math/asin_variation.phpt index d0286894396e..1545ea15b3c9 100644 --- a/ext/standard/tests/math/asin_variation.phpt +++ b/ext/standard/tests/math/asin_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = asin($values[$i]); diff --git a/ext/standard/tests/math/asinh_variation.phpt b/ext/standard/tests/math/asinh_variation.phpt index e7b9fd9c543b..73331bce301e 100644 --- a/ext/standard/tests/math/asinh_variation.phpt +++ b/ext/standard/tests/math/asinh_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = asinh($values[$i]); diff --git a/ext/standard/tests/math/atan2_basic.phpt b/ext/standard/tests/math/atan2_basic.phpt index 1c89cfa1c2fc..bf119f6a73b3 100644 --- a/ext/standard/tests/math/atan2_basic.phpt +++ b/ext/standard/tests/math/atan2_basic.phpt @@ -13,8 +13,8 @@ $valuesy = array(23, "23", "23.45", "2.345e1", - true, - false); + 1.0, + 0.0); $valuesx = array(23, -23, @@ -25,8 +25,8 @@ $valuesx = array(23, "23", "23.45", "2.345e1", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($valuesy); $i++) { for ($j = 0; $j < count($valuesx); $j++) { @@ -47,7 +47,7 @@ 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:0 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) @@ -58,7 +58,7 @@ 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:0 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) @@ -69,7 +69,7 @@ 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:0 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) @@ -80,7 +80,7 @@ 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:0 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) @@ -91,7 +91,7 @@ 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:0 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) @@ -102,7 +102,7 @@ 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:0 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) @@ -113,7 +113,7 @@ 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:0 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) @@ -124,7 +124,7 @@ 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:0 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) @@ -135,7 +135,7 @@ 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:2.345e1 X:0 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) @@ -146,15 +146,15 @@ 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:1 X:0 float(1.5707963267949) +Y:0 X:23 float(0) +Y:0 X:-23 float(3.1415926535898) +Y:0 X:23.45 float(0) +Y:0 X:-23.45 float(3.1415926535898) +Y:0 X:23 float(0) +Y:0 X:23 float(0) +Y:0 X:23 float(0) +Y:0 X:23.45 float(0) +Y:0 X:2.345e1 float(0) +Y:0 X:1 float(0) +Y:0 X:0 float(0) diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt index abd3831dddc6..0725b619d4e1 100644 --- a/ext/standard/tests/math/atan_variation.phpt +++ b/ext/standard/tests/math/atan_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = atan($values[$i]); diff --git a/ext/standard/tests/math/atanh_variation.phpt b/ext/standard/tests/math/atanh_variation.phpt index f740c1ccc00a..9a7b53f2d990 100644 --- a/ext/standard/tests/math/atanh_variation.phpt +++ b/ext/standard/tests/math/atanh_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = atanh($values[$i]); diff --git a/ext/standard/tests/math/base_convert_variation1.phpt b/ext/standard/tests/math/base_convert_variation1.phpt index c191f8103735..e567fe6563c8 100644 --- a/ext/standard/tests/math/base_convert_variation1.phpt +++ b/ext/standard/tests/math/base_convert_variation1.phpt @@ -25,17 +25,11 @@ $inputs = array( 1.234567E-2, .5, - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - // empty data -/*17*/ "", +/*13*/ "", '', // string data -/*20*/ "abcxyz", +/*16*/ "abcxyz", 'abcxyz', $heredoc, ); @@ -86,28 +80,16 @@ Exception: Invalid characters passed for attempted conversion Exception: Invalid characters passed for attempted conversion -- Iteration 11 -- -string(1) "1" +string(1) "0" -- 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 -- Exception: Invalid characters passed for attempted conversion --- Iteration 18 -- +-- Iteration 14 -- Exception: Invalid characters passed for attempted conversion --- Iteration 19 -- +-- Iteration 15 -- Exception: Invalid characters passed for attempted conversion diff --git a/ext/standard/tests/math/bindec_basic.phpt b/ext/standard/tests/math/bindec_basic.phpt index 47c6453dec5f..a2795eb7a148 100644 --- a/ext/standard/tests/math/bindec_basic.phpt +++ b/ext/standard/tests/math/bindec_basic.phpt @@ -24,8 +24,8 @@ $values = array(111000111, 31.1013e5, 0x111ABC, 011237, - true, - false, + "1", + "", ); for ($i = 0; $i < count($values); $i++) { diff --git a/ext/standard/tests/math/bindec_basic_64bit.phpt b/ext/standard/tests/math/bindec_basic_64bit.phpt index 7bbab6f85ff2..8e9f758ca859 100644 --- a/ext/standard/tests/math/bindec_basic_64bit.phpt +++ b/ext/standard/tests/math/bindec_basic_64bit.phpt @@ -24,8 +24,8 @@ $values = array(111000111, 31.1013e5, 0x111ABC, 011237, - true, - false, + "1", + "", ); for ($i = 0; $i < count($values); $i++) { diff --git a/ext/standard/tests/math/bindec_variation1.phpt b/ext/standard/tests/math/bindec_variation1.phpt index 1ce32f066536..d76b250648aa 100644 --- a/ext/standard/tests/math/bindec_variation1.phpt +++ b/ext/standard/tests/math/bindec_variation1.phpt @@ -31,24 +31,18 @@ $inputs = array( 12.3456789000E-10, .5, - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - // empty data -/*16*/ "", +/*12*/ "", '', array(), // string data -/*19*/ "abcxyz", +/*15*/ "abcxyz", 'abcxyz', $heredoc, // resource variable -/*24*/ $fp +/*20*/ $fp ); // loop through each element of $inputs to check the behaviour of bindec() @@ -95,34 +89,22 @@ Exception: Invalid characters passed for attempted conversion Exception: Invalid characters passed for attempted conversion -- Iteration 10 -- -int(1) +int(0) -- Iteration 11 -- int(0) -- Iteration 12 -- -int(1) - --- Iteration 13 -- -int(0) - --- Iteration 14 -- -int(0) - --- Iteration 15 -- -int(0) - --- Iteration 16 -- TypeError: bindec(): Argument #1 ($binary_string) must be of type string, array given --- Iteration 17 -- +-- Iteration 13 -- Exception: Invalid characters passed for attempted conversion --- Iteration 18 -- +-- Iteration 14 -- Exception: Invalid characters passed for attempted conversion --- Iteration 19 -- +-- Iteration 15 -- Exception: Invalid characters passed for attempted conversion --- Iteration 20 -- +-- Iteration 16 -- TypeError: 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 index 417c751654f1..641d675402aa 100644 --- a/ext/standard/tests/math/bindec_variation1_64bit.phpt +++ b/ext/standard/tests/math/bindec_variation1_64bit.phpt @@ -28,18 +28,12 @@ $inputs = array( 12.3456789000E-10, .5, - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - // empty data -/*16*/ "", +/*12*/ "", '', // string data -/*19*/ "abcxyz", +/*15*/ "abcxyz", 'abcxyz', $heredoc, ); @@ -87,28 +81,16 @@ Exception: Invalid characters passed for attempted conversion Exception: Invalid characters passed for attempted conversion -- Iteration 10 -- -int(1) +int(0) -- Iteration 11 -- int(0) -- Iteration 12 -- -int(1) - --- Iteration 13 -- -int(0) - --- Iteration 14 -- -int(0) - --- Iteration 15 -- -int(0) - --- Iteration 16 -- Exception: Invalid characters passed for attempted conversion --- Iteration 17 -- +-- Iteration 13 -- Exception: Invalid characters passed for attempted conversion --- Iteration 18 -- +-- Iteration 14 -- Exception: Invalid characters passed for attempted conversion diff --git a/ext/standard/tests/math/ceil_basic.phpt b/ext/standard/tests/math/ceil_basic.phpt index 7bdc87d16eaf..66b519deafd1 100644 --- a/ext/standard/tests/math/ceil_basic.phpt +++ b/ext/standard/tests/math/ceil_basic.phpt @@ -22,8 +22,6 @@ $values = array(0, "3.95E3", "-3.95E3", "039", - true, - false, null, ); @@ -52,8 +50,6 @@ 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) diff --git a/ext/standard/tests/math/cos_variation.phpt b/ext/standard/tests/math/cos_variation.phpt index 19d72f60a795..54a72d6a0544 100644 --- a/ext/standard/tests/math/cos_variation.phpt +++ b/ext/standard/tests/math/cos_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = cos($values[$i]); diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt index 475c19fd50d6..a5760d4ce998 100644 --- a/ext/standard/tests/math/cosh_variation.phpt +++ b/ext/standard/tests/math/cosh_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = cosh($values[$i]); diff --git a/ext/standard/tests/math/decbin_basic.phpt b/ext/standard/tests/math/decbin_basic.phpt index 91cf9aa13360..56cf95733154 100644 --- a/ext/standard/tests/math/decbin_basic.phpt +++ b/ext/standard/tests/math/decbin_basic.phpt @@ -11,8 +11,8 @@ $values = array(10, "3950.5", "3.9505e3", "039", - true, - false, + 1, + 0, ); foreach ($values as $value) { diff --git a/ext/standard/tests/math/decbin_variation1.phpt b/ext/standard/tests/math/decbin_variation1.phpt index b2744bb1b6bf..d605497c7183 100644 --- a/ext/standard/tests/math/decbin_variation1.phpt +++ b/ext/standard/tests/math/decbin_variation1.phpt @@ -22,14 +22,8 @@ $inputs = [ // float data /* 7*/ 12.3456789000e10, - // boolean data -/* 8*/ true, - false, - TRUE, - FALSE, - // empty data -/*12*/ "", +/* 8*/ "", '', ]; @@ -70,19 +64,7 @@ decbin(): Argument #1 ($num) must be of type int, float given 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 -- +-- Iteration 9 -- 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 index e34fdd68d25a..4e0820153db7 100644 --- a/ext/standard/tests/math/decbin_variation1_64bit.phpt +++ b/ext/standard/tests/math/decbin_variation1_64bit.phpt @@ -19,12 +19,6 @@ $inputs = [ // float data /* 7*/ 12.3456789000e10, - - // boolean data -/* 8*/ true, - false, - TRUE, - FALSE, ]; // loop through each element of $inputs to check the behaviour of decbin() @@ -52,15 +46,3 @@ string(64) "1111111111111111111111111111111111111111111111111111011011010111" -- Iteration 5 -- string(37) "1110010111110100110010001101000001000" - --- Iteration 6 -- -string(1) "1" - --- Iteration 7 -- -string(1) "0" - --- Iteration 8 -- -string(1) "1" - --- Iteration 9 -- -string(1) "0" diff --git a/ext/standard/tests/math/dechex_basic.phpt b/ext/standard/tests/math/dechex_basic.phpt index e39086dfd5ce..fa5e52a92919 100644 --- a/ext/standard/tests/math/dechex_basic.phpt +++ b/ext/standard/tests/math/dechex_basic.phpt @@ -11,8 +11,8 @@ $values = array(10, "3950.5", "3.9505e3", "039", - true, - false, + 1, + 0, ); foreach ($values as $value) { diff --git a/ext/standard/tests/math/dechex_variation1.phpt b/ext/standard/tests/math/dechex_variation1.phpt index 4e014f35b760..e1756c48303b 100644 --- a/ext/standard/tests/math/dechex_variation1.phpt +++ b/ext/standard/tests/math/dechex_variation1.phpt @@ -22,14 +22,8 @@ $inputs = [ // float data /* 7*/ 12.3456789000e10, - // boolean data -/* 8*/ true, - false, - TRUE, - FALSE, - // empty data -/*12*/ "", +/* 8*/ "", '', ]; @@ -70,19 +64,7 @@ dechex(): Argument #1 ($num) must be of type int, float given 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 -- +-- Iteration 9 -- 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 index 24d36d0e15bc..3345283475de 100644 --- a/ext/standard/tests/math/dechex_variation1_64bit.phpt +++ b/ext/standard/tests/math/dechex_variation1_64bit.phpt @@ -19,12 +19,6 @@ $inputs = [ // float data /* 7*/ 12.3456789000e10, - - // boolean data -/* 8*/ true, - false, - TRUE, - FALSE, ]; // loop through each element of $inputs to check the behaviour of dechex() @@ -52,15 +46,3 @@ string(16) "fffffffffffff6d7" -- Iteration 5 -- string(10) "1cbe991a08" - --- Iteration 6 -- -string(1) "1" - --- Iteration 7 -- -string(1) "0" - --- Iteration 8 -- -string(1) "1" - --- Iteration 9 -- -string(1) "0" diff --git a/ext/standard/tests/math/decoct_basic.phpt b/ext/standard/tests/math/decoct_basic.phpt index 31bfa96a49f5..aa1ab7987702 100644 --- a/ext/standard/tests/math/decoct_basic.phpt +++ b/ext/standard/tests/math/decoct_basic.phpt @@ -12,8 +12,8 @@ $values = array(10, "3.9505e3", "039", "0x5F", - true, - false, + 1, + 0, ); foreach ($values as $value) { diff --git a/ext/standard/tests/math/decoct_variation1.phpt b/ext/standard/tests/math/decoct_variation1.phpt index 1936464fd4b3..f797a1af0f1b 100644 --- a/ext/standard/tests/math/decoct_variation1.phpt +++ b/ext/standard/tests/math/decoct_variation1.phpt @@ -22,14 +22,8 @@ $inputs = [ // float data /* 7*/ 12.3456789000e10, - // boolean data -/* 8*/ true, - false, - TRUE, - FALSE, - // empty data -/*12*/ "", +/* 8*/ "", '', ]; @@ -70,19 +64,7 @@ decoct(): Argument #1 ($num) must be of type int, float given 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 -- +-- Iteration 9 -- 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 index 56e468a72ef5..3e5ff7ed0d8e 100644 --- a/ext/standard/tests/math/decoct_variation1_64bit.phpt +++ b/ext/standard/tests/math/decoct_variation1_64bit.phpt @@ -22,14 +22,8 @@ $inputs = [ // float data /* 7*/ 12.3456789000e10, - // boolean data -/* 8*/ true, - false, - TRUE, - FALSE, - // empty data -/*12*/ "", +/* 8*/ "", '', ]; @@ -70,19 +64,7 @@ TypeError: decoct(): Argument #1 ($num) must be of type int, float given 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 -- TypeError: decoct(): Argument #1 ($num) must be of type int, string given --- Iteration 13 -- +-- Iteration 9 -- TypeError: 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 47a5a893679a..8d2c74997f23 100644 --- a/ext/standard/tests/math/deg2rad_variation.phpt +++ b/ext/standard/tests/math/deg2rad_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = deg2rad($values[$i]); diff --git a/ext/standard/tests/math/exp_basic.phpt b/ext/standard/tests/math/exp_basic.phpt index b10ab493a884..63b52d65b55a 100644 --- a/ext/standard/tests/math/exp_basic.phpt +++ b/ext/standard/tests/math/exp_basic.phpt @@ -13,8 +13,8 @@ $values = array(10, "3950.5", "3.9505e3", "039", - true, - false, + 1.0, + 0.0, ); $iterator = 1; diff --git a/ext/standard/tests/math/expm1_basic.phpt b/ext/standard/tests/math/expm1_basic.phpt index ea4c165da2c4..b77b8b4076ee 100644 --- a/ext/standard/tests/math/expm1_basic.phpt +++ b/ext/standard/tests/math/expm1_basic.phpt @@ -14,8 +14,8 @@ $values = array(10, "3950.5", "3.9505e3", "039", - true, - false, + 1.0, + 0.0, ); // loop through each element of $values to check the behaviour of expm1() diff --git a/ext/standard/tests/math/floor_basic.phpt b/ext/standard/tests/math/floor_basic.phpt index 308a055f808a..c9ce581b6028 100644 --- a/ext/standard/tests/math/floor_basic.phpt +++ b/ext/standard/tests/math/floor_basic.phpt @@ -22,8 +22,6 @@ $values = array(0, "3.95E3", "-3.95E3", "039", - true, - false, null, ); @@ -87,12 +85,6 @@ 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 diff --git a/ext/standard/tests/math/fmod_basic.phpt b/ext/standard/tests/math/fmod_basic.phpt index 84cd27125c41..959e91f69db4 100644 --- a/ext/standard/tests/math/fmod_basic.phpt +++ b/ext/standard/tests/math/fmod_basic.phpt @@ -13,8 +13,8 @@ $values1 = array(234, "234", "234.5", "23.45e1", - true, - false); + 1.0, + 0.0); $values2 = array(2, -2, @@ -25,8 +25,8 @@ $values2 = array(2, "2", "2.3", "2.3e1", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values1); $i++) { echo "\niteration ", $i, "\n"; diff --git a/ext/standard/tests/math/hexdec_basic.phpt b/ext/standard/tests/math/hexdec_basic.phpt index f518b74ad860..2f523642b365 100644 --- a/ext/standard/tests/math/hexdec_basic.phpt +++ b/ext/standard/tests/math/hexdec_basic.phpt @@ -21,8 +21,8 @@ $values = array(0x123abc, 31.1013e5, 011237, '011237', - true, - false, + "1", + "", ); for ($i = 0; $i < count($values); $i++) { try { diff --git a/ext/standard/tests/math/hexdec_basic_64bit.phpt b/ext/standard/tests/math/hexdec_basic_64bit.phpt index e011bce1c2af..180a04b7c0e9 100644 --- a/ext/standard/tests/math/hexdec_basic_64bit.phpt +++ b/ext/standard/tests/math/hexdec_basic_64bit.phpt @@ -23,8 +23,8 @@ $values = array(0x123abc, 31.1013e5, 011237, '011237', - true, - false, + "1", + "", ); foreach($values as $value) { diff --git a/ext/standard/tests/math/hexdec_variation1.phpt b/ext/standard/tests/math/hexdec_variation1.phpt index da22d403a18c..b6b9d999f693 100644 --- a/ext/standard/tests/math/hexdec_variation1.phpt +++ b/ext/standard/tests/math/hexdec_variation1.phpt @@ -35,24 +35,18 @@ $inputs = array( 12.3456789000E-10, .5, - // boolean data -/*14*/ true, - false, - TRUE, - FALSE, - // empty data -/*18*/ "", +/*14*/ "", '', array(), // string data -/*21*/ "abcxyz", +/*17*/ "abcxyz", 'abcxyz', $heredoc, // resource variable -/*26*/ $fp +/*22*/ $fp ); // loop through each element of $inputs to check the behaviour of hexdec() @@ -111,34 +105,22 @@ Exception: Invalid characters passed for attempted conversion Exception: Invalid characters passed for attempted conversion -- Iteration 12 -- -int(1) +int(0) -- Iteration 13 -- int(0) -- Iteration 14 -- -int(1) - --- Iteration 15 -- -int(0) - --- Iteration 16 -- -int(0) - --- Iteration 17 -- -int(0) - --- Iteration 18 -- TypeError: hexdec(): Argument #1 ($hex_string) must be of type string, array given --- Iteration 19 -- +-- Iteration 15 -- Exception: Invalid characters passed for attempted conversion --- Iteration 20 -- +-- Iteration 16 -- Exception: Invalid characters passed for attempted conversion --- Iteration 21 -- +-- Iteration 17 -- Exception: Invalid characters passed for attempted conversion --- Iteration 22 -- +-- Iteration 18 -- TypeError: 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 index 70d89ba69eb1..37463d118824 100644 --- a/ext/standard/tests/math/hexdec_variation1_64bit.phpt +++ b/ext/standard/tests/math/hexdec_variation1_64bit.phpt @@ -35,24 +35,18 @@ $inputs = array( 12.3456789000E-10, .5, - // boolean data -/*14*/ true, - false, - TRUE, - FALSE, - // empty data -/*18*/ "", +/*14*/ "", '', array(), // string data -/*21*/ "abcxyz", +/*17*/ "abcxyz", 'abcxyz', $heredoc, // resource variable -/*26*/ $fp +/*22*/ $fp ); // loop through each element of $inputs to check the behaviour of hexdec() @@ -105,34 +99,22 @@ Exception: Invalid characters passed for attempted conversion Exception: Invalid characters passed for attempted conversion -- Iteration 12 -- -int(1) +int(0) -- Iteration 13 -- int(0) -- Iteration 14 -- -int(1) - --- Iteration 15 -- -int(0) - --- Iteration 16 -- -int(0) - --- Iteration 17 -- -int(0) - --- Iteration 18 -- TypeError: hexdec(): Argument #1 ($hex_string) must be of type string, array given --- Iteration 19 -- +-- Iteration 15 -- Exception: Invalid characters passed for attempted conversion --- Iteration 20 -- +-- Iteration 16 -- Exception: Invalid characters passed for attempted conversion --- Iteration 21 -- +-- Iteration 17 -- Exception: Invalid characters passed for attempted conversion --- Iteration 22 -- +-- Iteration 18 -- TypeError: 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 750d688a1705..6acba907a787 100644 --- a/ext/standard/tests/math/hypot_basic.phpt +++ b/ext/standard/tests/math/hypot_basic.phpt @@ -16,8 +16,8 @@ $valuesy = array(23, "23", "23.45", "2.345e1", - true, - false); + 1.0, + 0.0); $valuesx = array(33, -33, @@ -28,8 +28,8 @@ $valuesx = array(33, "33", "43.45", "1.345e1", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($valuesy); $i++) { for ($j = 0; $j < count($valuesx); $j++) { @@ -62,7 +62,7 @@ Y:23 X:1.345e1 float(26.6439955712352) Y:23 X:1 float(23.0217288664427) -Y:23 X: float(23) +Y:23 X:0 float(23) Y:-23 X:33 float(40.2243707222375) @@ -84,7 +84,7 @@ Y:-23 X:1.345e1 float(26.6439955712352) Y:-23 X:1 float(23.0217288664427) -Y:-23 X: float(23) +Y:-23 X:0 float(23) Y:23.45 X:33 float(40.483360779461) @@ -106,7 +106,7 @@ 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:0 float(23.45) Y:-23.45 X:33 float(40.483360779461) @@ -128,7 +128,7 @@ 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:0 float(23.45) Y:23 X:33 float(40.2243707222375) @@ -150,7 +150,7 @@ Y:23 X:1.345e1 float(26.6439955712352) Y:23 X:1 float(23.0217288664427) -Y:23 X: float(23) +Y:23 X:0 float(23) Y:23 X:33 float(40.2243707222375) @@ -172,7 +172,7 @@ Y:23 X:1.345e1 float(26.6439955712352) Y:23 X:1 float(23.0217288664427) -Y:23 X: float(23) +Y:23 X:0 float(23) Y:23 X:33 float(40.2243707222375) @@ -194,7 +194,7 @@ Y:23 X:1.345e1 float(26.6439955712352) Y:23 X:1 float(23.0217288664427) -Y:23 X: float(23) +Y:23 X:0 float(23) Y:23.45 X:33 float(40.483360779461) @@ -216,7 +216,7 @@ 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:0 float(23.45) Y:2.345e1 X:33 float(40.483360779461) @@ -238,7 +238,7 @@ 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:2.345e1 X:0 float(23.45) Y:1 X:33 float(33.0151480384384) @@ -260,26 +260,26 @@ Y:1 X:1.345e1 float(13.4871234887206) Y:1 X:1 float(1.4142135623731) -Y:1 X: float(1) +Y:1 X:0 float(1) -Y: X:33 float(33) +Y:0 X:33 float(33) -Y: X:-33 float(33) +Y:0 X:-33 float(33) -Y: X:33.45 float(33.45) +Y:0 X:33.45 float(33.45) -Y: X:-33.45 float(33.45) +Y:0 X:-33.45 float(33.45) -Y: X:39 float(39) +Y:0 X:39 float(39) -Y: X:31 float(31) +Y:0 X:31 float(31) -Y: X:33 float(33) +Y:0 X:33 float(33) -Y: X:43.45 float(43.45) +Y:0 X:43.45 float(43.45) -Y: X:1.345e1 float(13.45) +Y:0 X:1.345e1 float(13.45) -Y: X:1 float(1) +Y:0 X:1 float(1) -Y: X: float(0) +Y:0 X:0 float(0) diff --git a/ext/standard/tests/math/is_finite_basic.phpt b/ext/standard/tests/math/is_finite_basic.phpt index 99af66be4e78..cdd5974fd676 100644 --- a/ext/standard/tests/math/is_finite_basic.phpt +++ b/ext/standard/tests/math/is_finite_basic.phpt @@ -11,8 +11,8 @@ $values = array(234, "234", "234.5", "23.45e1", - true, - false, + 1.0, + 0.0, pow(0, -2), acos(1.01)); ; diff --git a/ext/standard/tests/math/is_infinite_basic.phpt b/ext/standard/tests/math/is_infinite_basic.phpt index 599bdd635fba..353158c09b33 100644 --- a/ext/standard/tests/math/is_infinite_basic.phpt +++ b/ext/standard/tests/math/is_infinite_basic.phpt @@ -11,8 +11,8 @@ $values = array(234, "234", "234.5", "23.45e1", - true, - false, + 1.0, + 0.0, pow(0, -2), acos(1.01)); ; diff --git a/ext/standard/tests/math/is_nan_basic.phpt b/ext/standard/tests/math/is_nan_basic.phpt index f0111e00e979..e7e34081e906 100644 --- a/ext/standard/tests/math/is_nan_basic.phpt +++ b/ext/standard/tests/math/is_nan_basic.phpt @@ -11,8 +11,8 @@ $values = array(234, "234", "234.5", "23.45e1", - true, - false, + 1.0, + 0.0, pow(0, -2), acos(1.01)); diff --git a/ext/standard/tests/math/log10_variation.phpt b/ext/standard/tests/math/log10_variation.phpt index 9da765d5ae16..16b72f5fd062 100644 --- a/ext/standard/tests/math/log10_variation.phpt +++ b/ext/standard/tests/math/log10_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = log10($values[$i]); diff --git a/ext/standard/tests/math/log1p_basic.phpt b/ext/standard/tests/math/log1p_basic.phpt index 7b19c3f9f425..ce71f046e78a 100644 --- a/ext/standard/tests/math/log1p_basic.phpt +++ b/ext/standard/tests/math/log1p_basic.phpt @@ -15,8 +15,8 @@ $values = array(23, "23", "23.45", "2.345e1", - true, - false); + 1.0, + 0.0); echo "\n LOG1p tests\n"; @@ -62,5 +62,5 @@ float(3.196630215920881) -- log1p 1 -- float(0.6931471805599453) --- log1p -- +-- log1p 0 -- float(0) diff --git a/ext/standard/tests/math/log_basic.phpt b/ext/standard/tests/math/log_basic.phpt index ae2e790bcceb..dfba6cef9d99 100644 --- a/ext/standard/tests/math/log_basic.phpt +++ b/ext/standard/tests/math/log_basic.phpt @@ -13,8 +13,8 @@ $values = array(23, "23", "23.45", "2.345e1", - true, - false); + 1.0, + 0.0); echo "\n LOG tests...no base\n"; for ($i = 0; $i < count($values); $i++) { diff --git a/ext/standard/tests/math/number_format_basic.phpt b/ext/standard/tests/math/number_format_basic.phpt index 40b00d1a4f63..faf2ae24a2fd 100644 --- a/ext/standard/tests/math/number_format_basic.phpt +++ b/ext/standard/tests/math/number_format_basic.phpt @@ -15,8 +15,8 @@ $values = array(1234.5678, "123456789", "123.456789", "12.3456789e1", - true, - false); + 1.0, + 0.0); echo "\n number_format tests.....default\n"; for ($i = 0; $i < count($values); $i++) { diff --git a/ext/standard/tests/math/number_format_multichar.phpt b/ext/standard/tests/math/number_format_multichar.phpt index 1ed823042f18..28bebe498e33 100644 --- a/ext/standard/tests/math/number_format_multichar.phpt +++ b/ext/standard/tests/math/number_format_multichar.phpt @@ -11,8 +11,8 @@ $values = array(1234.5678, "123456789", "123.456789", "12.3456789e1", - true, - false); + 1.0, + 0.0); echo " number_format tests.....multiple character decimal point\n"; for ($i = 0; $i < count($values); $i++) { diff --git a/ext/standard/tests/math/octdec_basic.phpt b/ext/standard/tests/math/octdec_basic.phpt index e2414e7f509f..d6e1307f2354 100644 --- a/ext/standard/tests/math/octdec_basic.phpt +++ b/ext/standard/tests/math/octdec_basic.phpt @@ -20,8 +20,8 @@ $values = array(01234567, '12345', 31101.3, 31.1013e5, - true, - false, + "1", + "", ); for ($i = 0; $i < count($values); $i++) { diff --git a/ext/standard/tests/math/octdec_basic_64bit.phpt b/ext/standard/tests/math/octdec_basic_64bit.phpt index 886cc317fa52..7ffa8d9a7df8 100644 --- a/ext/standard/tests/math/octdec_basic_64bit.phpt +++ b/ext/standard/tests/math/octdec_basic_64bit.phpt @@ -23,8 +23,8 @@ $values = array(01234567, '12345', 31101.3, 31.1013e5, - true, - false, + "1", + "", ); for ($i = 0; $i < count($values); $i++) { diff --git a/ext/standard/tests/math/octdec_variation1.phpt b/ext/standard/tests/math/octdec_variation1.phpt index d3a8a80093a2..7133aa509340 100644 --- a/ext/standard/tests/math/octdec_variation1.phpt +++ b/ext/standard/tests/math/octdec_variation1.phpt @@ -31,24 +31,18 @@ $inputs = array( 12.3456789000E-10, .5, - // boolean data -/*14*/ true, - false, - TRUE, - FALSE, - // empty data -/*18*/ "", +/*14*/ "", '', array(), // string data -/*21*/ "abcxyz", +/*17*/ "abcxyz", 'abcxyz', $heredoc, // resource variable -/*26*/ $fp +/*22*/ $fp ); // loop through each element of $inputs to check the behaviour of octdec() @@ -102,35 +96,23 @@ Exception: Invalid characters passed for attempted conversion Exception: Invalid characters passed for attempted conversion -- Iteration 12 -- -int(1) +int(0) -- Iteration 13 -- int(0) -- Iteration 14 -- -int(1) - --- Iteration 15 -- -int(0) - --- Iteration 16 -- -int(0) - --- Iteration 17 -- -int(0) - --- Iteration 18 -- TypeError: octdec(): Argument #1 ($octal_string) must be of type string, array given --- Iteration 19 -- +-- Iteration 15 -- Exception: Invalid characters passed for attempted conversion --- Iteration 20 -- +-- Iteration 16 -- Exception: Invalid characters passed for attempted conversion --- Iteration 21 -- +-- Iteration 17 -- Exception: Invalid characters passed for attempted conversion --- Iteration 22 -- +-- Iteration 18 -- TypeError: 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 3cc1317ea835..bbe5ec70f149 100644 --- a/ext/standard/tests/math/rad2deg_variation.phpt +++ b/ext/standard/tests/math/rad2deg_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = rad2deg($values[$i]); diff --git a/ext/standard/tests/math/round_basic.phpt b/ext/standard/tests/math/round_basic.phpt index f2a7447a3747..a78700108a1d 100644 --- a/ext/standard/tests/math/round_basic.phpt +++ b/ext/standard/tests/math/round_basic.phpt @@ -25,8 +25,8 @@ $precision = array(2, "04", "3.6", "2.1e1", - true, - false); + 1, + 0); for ($i = 0; $i < count($values); $i++) { echo "round: $values[$i]\n"; @@ -54,7 +54,7 @@ Deprecated: Implicit conversion from float-string "3.6" to int loses precision i ...with precision 3.6-> float(123456789) ...with precision 2.1e1-> float(123456789) ...with precision 1-> float(123456789) -...with precision -> float(123456789) +...with precision 0-> float(123456789) round: 123.456789 ...with precision 2-> float(123.46) ...with precision 8-> float(123.456789) @@ -70,7 +70,7 @@ Deprecated: Implicit conversion from float-string "3.6" to int loses precision i ...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 0-> float(123) round: -4.5679123 ...with precision 2-> float(-4.57) ...with precision 8-> float(-4.5679123) @@ -86,7 +86,7 @@ Deprecated: Implicit conversion from float-string "3.6" to int loses precision i ...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 0-> float(-5) round: 12300 ...with precision 2-> float(12300) ...with precision 8-> float(12300) @@ -102,7 +102,7 @@ Deprecated: Implicit conversion from float-string "3.6" to int loses precision i ...with precision 3.6-> float(12300) ...with precision 2.1e1-> float(12300) ...with precision 1-> float(12300) -...with precision -> float(12300) +...with precision 0-> float(12300) round: -4567 ...with precision 2-> float(-4567) ...with precision 8-> float(-4567) @@ -118,7 +118,7 @@ Deprecated: Implicit conversion from float-string "3.6" to int loses precision i ...with precision 3.6-> float(-4567) ...with precision 2.1e1-> float(-4567) ...with precision 1-> float(-4567) -...with precision -> float(-4567) +...with precision 0-> float(-4567) round: 2311527 ...with precision 2-> float(2311527) ...with precision 8-> float(2311527) @@ -134,7 +134,7 @@ Deprecated: Implicit conversion from float-string "3.6" to int loses precision i ...with precision 3.6-> float(2311527) ...with precision 2.1e1-> float(2311527) ...with precision 1-> float(2311527) -...with precision -> float(2311527) +...with precision 0-> float(2311527) round: 14680063 ...with precision 2-> float(14680063) ...with precision 8-> float(14680063) @@ -150,7 +150,7 @@ Deprecated: Implicit conversion from float-string "3.6" to int loses precision i ...with precision 3.6-> float(14680063) ...with precision 2.1e1-> float(14680063) ...with precision 1-> float(14680063) -...with precision -> float(14680063) +...with precision 0-> float(14680063) round: 1.234567 ...with precision 2-> float(1.23) ...with precision 8-> float(1.234567) @@ -166,7 +166,7 @@ Deprecated: Implicit conversion from float-string "3.6" to int loses precision i ...with precision 3.6-> float(1.235) ...with precision 2.1e1-> float(1.234567) ...with precision 1-> float(1.2) -...with precision -> float(1) +...with precision 0-> float(1) round: 2.3456789e8 ...with precision 2-> float(234567890) ...with precision 8-> float(234567890) @@ -182,4 +182,4 @@ Deprecated: Implicit conversion from float-string "3.6" to int loses precision i ...with precision 3.6-> float(234567890) ...with precision 2.1e1-> float(234567890) ...with precision 1-> float(234567890) -...with precision -> float(234567890) +...with precision 0-> float(234567890) diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt index 6cca50a16773..c2226fe4e246 100644 --- a/ext/standard/tests/math/sin_variation.phpt +++ b/ext/standard/tests/math/sin_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = sin($values[$i]); diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt index f053e58144ee..ada35aa9d9f9 100644 --- a/ext/standard/tests/math/sinh_variation.phpt +++ b/ext/standard/tests/math/sinh_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = sinh($values[$i]); diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt index eb73870d1fc3..b6d886a7ddca 100644 --- a/ext/standard/tests/math/sqrt_variation.phpt +++ b/ext/standard/tests/math/sqrt_variation.phpt @@ -22,8 +22,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = sqrt($values[$i]); diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt index 4394ddcd57a8..702cff700edb 100644 --- a/ext/standard/tests/math/tan_variation.phpt +++ b/ext/standard/tests/math/tan_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = tan($values[$i]); diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt index d2011f474572..7bd24640f869 100644 --- a/ext/standard/tests/math/tanh_variation.phpt +++ b/ext/standard/tests/math/tanh_variation.phpt @@ -21,8 +21,8 @@ $values = array(23, "23.45", "2.345e1", "1000", - true, - false); + 1.0, + 0.0); for ($i = 0; $i < count($values); $i++) { $res = tanh($values[$i]); diff --git a/ext/standard/tests/misc/get_browser_error.phpt b/ext/standard/tests/misc/get_browser_error.phpt index f1d645b0263f..e10ba148949c 100644 --- a/ext/standard/tests/misc/get_browser_error.phpt +++ b/ext/standard/tests/misc/get_browser_error.phpt @@ -11,8 +11,8 @@ echo "*** Testing get_browser() : error functionality ***\n"; /* Unknown browser uses defaults. */ var_dump( get_browser( 'foobar', true ) ); -/* Some wrong parameters, no HTTP_USER_AGENT set */ -var_dump( get_browser( null, 'foobar' ) ); +/* No HTTP_USER_AGENT set */ +var_dump( get_browser( null, true ) ); ?> --EXPECTF-- diff --git a/ext/standard/tests/network/inet_ipv6.phpt b/ext/standard/tests/network/inet_ipv6.phpt index 7b894ad70372..e813b7b1835e 100644 --- a/ext/standard/tests/network/inet_ipv6.phpt +++ b/ext/standard/tests/network/inet_ipv6.phpt @@ -26,6 +26,10 @@ $a = array( foreach ($a as $address) { $packed = inet_pton($address); + if ($packed === false) { + var_dump($packed); + continue; + } var_dump(inet_ntop($packed)); } diff --git a/ext/standard/tests/network/shutdown.phpt b/ext/standard/tests/network/shutdown.phpt index 64373596a275..fd528587a956 100644 --- a/ext/standard/tests/network/shutdown.phpt +++ b/ext/standard/tests/network/shutdown.phpt @@ -43,8 +43,12 @@ if (!$server) { if (!$socket) { die('Unable to accept connection'); } - @fwrite($socket, fgets($socket)); - @fwrite($socket, fgets($socket)); + if (($line = fgets($socket)) !== false) { + @fwrite($socket, $line); + } + if (($line = fgets($socket)) !== false) { + @fwrite($socket, $line); + } fclose($socket); /* Read Response 1 */ @@ -56,8 +60,12 @@ if (!$server) { if (!$socket) { die('Unable to accept connection'); } - @fwrite($socket, fgets($socket)); - @fwrite($socket, fgets($socket)); + if (($line = fgets($socket)) !== false) { + @fwrite($socket, $line); + } + if (($line = fgets($socket)) !== false) { + @fwrite($socket, $line); + } fclose($socket); /* Read Response 2 */ diff --git a/ext/standard/tests/poll/poll.inc b/ext/standard/tests/poll/poll.inc index ce001220bbac..96d6fc4f1d25 100644 --- a/ext/standard/tests/poll/poll.inc +++ b/ext/standard/tests/poll/poll.inc @@ -34,7 +34,7 @@ function pt_skip_for_backend($backend, $msg): void { } function pt_new_socket_pair(): array { - $domain = (strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? STREAM_PF_INET : STREAM_PF_UNIX); + $domain = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' ? STREAM_PF_INET : STREAM_PF_UNIX); $sockets = stream_socket_pair($domain, STREAM_SOCK_STREAM, 0); if ($sockets === false) { die("Cannot create socket pair\n"); diff --git a/ext/standard/tests/streams/proc_open_bug69900.phpt b/ext/standard/tests/streams/proc_open_bug69900.phpt index 323fc4a079cc..29febbfc63d7 100644 --- a/ext/standard/tests/streams/proc_open_bug69900.phpt +++ b/ext/standard/tests/streams/proc_open_bug69900.phpt @@ -16,7 +16,9 @@ $in = fopen("php://stdin", "rb", false, stream_context_create(array("pipe" => ar while(!feof($in)){ $s = fgets($in); - fwrite(STDOUT, $s); + if ($s !== false) { + fwrite(STDOUT, $s); + } } ?>'; diff --git a/ext/standard/tests/streams/stream_select_filtered_base64_buffered.phpt b/ext/standard/tests/streams/stream_select_filtered_base64_buffered.phpt index 4d11bf718a1b..95fa8161a752 100644 --- a/ext/standard/tests/streams/stream_select_filtered_base64_buffered.phpt +++ b/ext/standard/tests/streams/stream_select_filtered_base64_buffered.phpt @@ -2,7 +2,7 @@ stream_select() base64-decode filter buffered data usage --FILE-- string(28) "1234NULL23abcd00000TRUEFALSE" @@ -226,7 +220,7 @@ array(2) { [1]=> string(27) "1.234444true-11.24%PHP%ZEND" } --- Iteration 9 -- +-- Iteration 8 -- array(1) { [0]=> string(28) "1234NULL23abcd00000TRUEFALSE" @@ -245,7 +239,7 @@ array(2) { [1]=> string(23) "4444true-11.24%PHP%ZEND" } --- Iteration 10 -- +-- Iteration 9 -- array(6) { [0]=> string(3) "123" @@ -274,7 +268,7 @@ array(2) { [1]=> string(53) "NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" } --- Iteration 11 -- +-- Iteration 10 -- array(2) { [0]=> string(48) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24" diff --git a/ext/standard/tests/strings/implode_variation.phpt b/ext/standard/tests/strings/implode_variation.phpt index e721447c2eb0..e3e191e7c878 100644 --- a/ext/standard/tests/strings/implode_variation.phpt +++ b/ext/standard/tests/strings/implode_variation.phpt @@ -33,8 +33,7 @@ $pieces = array( ); $glues = array( "TRUE", - true, - false, + "1", array("key1", "key2"), "", " ", @@ -183,18 +182,16 @@ string(59) "2TRUE0TRUE-639TRUE1TRUEPHPTRUETRUETRUE TRUEstring%0with%0...%0" -- Iteration 2 -- string(35) "2101-639111PHP111 1string%0with%0...%0" -- Iteration 3 -- -string(27) "20-6391PHP string%0with%0...%0" --- Iteration 4 -- TypeError: implode(): Argument #1 ($separator) must be of type string, array given --- Iteration 5 -- +-- Iteration 4 -- string(27) "20-6391PHP string%0with%0...%0" --- Iteration 6 -- +-- Iteration 5 -- string(35) "2 0 -639 1 PHP string%0with%0...%0" --- Iteration 7 -- +-- Iteration 6 -- string(139) "2string%0between0string%0between-639string%0between1string%0betweenPHPstring%0betweenstring%0betweenstring%0between string%0betweenstring%0with%0...%0" --- Iteration 8 -- +-- Iteration 7 -- string(35) "2000-639010PHP000 0string%0with%0...%0" --- Iteration 9 -- +-- Iteration 8 -- string(43) "2\00\0-639\01\0PHP\0\0\0 \0string%0with%0...%0" *** Testing implode() on empty string *** diff --git a/ext/standard/tests/strings/join_variation4.phpt b/ext/standard/tests/strings/join_variation4.phpt index 786047b602e3..4181d982fd35 100644 --- a/ext/standard/tests/strings/join_variation4.phpt +++ b/ext/standard/tests/strings/join_variation4.phpt @@ -10,8 +10,7 @@ echo "*** Testing join() : usage variations ***\n"; $glues = array ( "TRUE", - true, - false, + "1", array("key1", "key2"), "", " ", @@ -55,19 +54,17 @@ string(87) "2TRUE0TRUE-639TRUE-1.3444TRUE1TRUEPHPTRUETRUETRUE TRUE6999.99999999T -- 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 -- TypeError: join(): Argument #1 ($separator) must be of type string, array given --- Iteration 5 -- +-- Iteration 4 -- string(47) "20-639-1.34441PHP 6999.99999999string%0with%0...%0" --- Iteration 6 -- +-- Iteration 5 -- string(57) "2 0 -639 -1.3444 1 PHP 6999.99999999 string%0with%0...%0" --- Iteration 7 -- +-- Iteration 6 -- string(187) "2string%0between0string%0between-639string%0between-1.3444string%0between1string%0betweenPHPstring%0betweenstring%0betweenstring%0between string%0between6999.99999999string%0betweenstring%0with%0...%0" --- Iteration 8 -- +-- Iteration 7 -- 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 -- +-- Iteration 8 -- string(57) "2000-6390-1.3444010PHP000 06999.999999990string%0with%0...%0" --- Iteration 10 -- +-- Iteration 9 -- 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/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt index 1abc31d0b3b5..9e372c9856b8 100644 --- a/ext/standard/tests/strings/lcfirst.phpt +++ b/ext/standard/tests/strings/lcfirst.phpt @@ -24,12 +24,11 @@ $str_array = array( "NULL", "0", 0, - TRUE, // bool type "TRUE", "1", 1, 1.234444, - FALSE, + "", "FALSE", " ", " ", @@ -148,7 +147,6 @@ string(6) "-3.344" string(4) "nULL" string(1) "0" string(1) "0" -string(1) "1" string(4) "tRUE" string(1) "1" string(1) "1" diff --git a/ext/standard/tests/strings/ltrim.phpt b/ext/standard/tests/strings/ltrim.phpt index 952ad282c6fe..53855f2ac802 100644 --- a/ext/standard/tests/strings/ltrim.phpt +++ b/ext/standard/tests/strings/ltrim.phpt @@ -23,7 +23,7 @@ var_dump( ltrim($str, "\nusi") ); echo "\n *** Output for Normal Behaviour ***\n"; var_dump ( ltrim(" \t\0 ltrim test") ); /* without second Argument */ var_dump ( ltrim(" ltrim test" , "") ); /* no characters in second Argument */ - var_dump ( ltrim(" ltrim test", true) ); /* with boolean value as second Argument */ + var_dump ( ltrim(" ltrim test", "1") ); /* with "1" as second Argument */ var_dump ( ltrim(" ltrim test", " ") ); /* with single space as second Argument */ var_dump ( ltrim("\t\n\r\0\x0B ltrim test", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */ var_dump ( ltrim("ABCXYZltrim test", "A..Z") ); /* with characters range as second Argument */ diff --git a/ext/standard/tests/strings/number_format_basic.phpt b/ext/standard/tests/strings/number_format_basic.phpt index 2e54eb1f0d5a..fc7e9cabb948 100644 --- a/ext/standard/tests/strings/number_format_basic.phpt +++ b/ext/standard/tests/strings/number_format_basic.phpt @@ -13,8 +13,8 @@ $values = array(1234.5678, "123456789", "123.456789", "12.3456789e1", - true, - false); + 1.0, + 0.0); echo "\n-- number_format tests.....default --\n"; for ($i = 0; $i < count($values); $i++) { diff --git a/ext/standard/tests/strings/quoted_printable_encode_001.phpt b/ext/standard/tests/strings/quoted_printable_encode_001.phpt index a1e0ec1338aa..03ce17734953 100644 --- a/ext/standard/tests/strings/quoted_printable_encode_001.phpt +++ b/ext/standard/tests/strings/quoted_printable_encode_001.phpt @@ -7,7 +7,6 @@ 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"; ?> @@ -15,5 +14,4 @@ echo "Done\n"; 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 21e91c1ac361..7c234d889abc 100644 --- a/ext/standard/tests/strings/rtrim.phpt +++ b/ext/standard/tests/strings/rtrim.phpt @@ -8,7 +8,7 @@ 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 ", "1") ); /* with "1" 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 */ diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt index e5b6030b44ce..15db106cb979 100644 --- a/ext/standard/tests/strings/str_pad.phpt +++ b/ext/standard/tests/strings/str_pad.phpt @@ -21,7 +21,7 @@ echo "\n#### variations with input string and pad-length ####\n"; $input_strings = array( "variation", // normal string "", // empty string - true, // boolean + "1", // numeric string 15, // numeric 15.55, // numeric "2990" // numeric string @@ -50,7 +50,7 @@ foreach ($input_strings as $input_string ) { } echo "\n#### variation with pad string ####\n"; -$pad_strings = array ("=", 1, true, "string_pad", 1.5, "\t", '\t'); +$pad_strings = array ("=", 1, "string_pad", 1.5, "\t", '\t'); $input_string="variation"; $pad_length = 16; foreach ( $pad_strings as $pad_string ) { @@ -278,10 +278,6 @@ string(16) "variation1111111" string(16) "1111111variation" string(16) "variation1111111" string(16) "111variation1111" -string(16) "variation1111111" -string(16) "1111111variation" -string(16) "variation1111111" -string(16) "111variation1111" string(16) "variationstring_" string(16) "string_variation" string(16) "variationstring_" diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt index 0d5ca207d290..7ea21bea46c2 100644 --- a/ext/standard/tests/strings/str_repeat.phpt +++ b/ext/standard/tests/strings/str_repeat.phpt @@ -11,7 +11,7 @@ $variations = array( 'barbazbax', "\x00", '\0', - TRUE, + "1", 4, 1.23, "", diff --git a/ext/standard/tests/strings/str_replace_variation1.phpt b/ext/standard/tests/strings/str_replace_variation1.phpt index 00ed1a8babe3..95c43a1de52f 100644 --- a/ext/standard/tests/strings/str_replace_variation1.phpt +++ b/ext/standard/tests/strings/str_replace_variation1.phpt @@ -5,7 +5,7 @@ precision=14 --FILE-- string(5) "FOUND" [1]=> - string(0) "" - [2]=> - string(5) "FOUND" - [3]=> string(1) "0" - [4]=> + [2]=> string(6) "-FOUND" - [5]=> + [3]=> string(5) "FOUND" - [6]=> + [4]=> string(1) "0" - [7]=> + [5]=> string(6) "-FOUND" - [8]=> + [6]=> string(0) "" - [9]=> + [7]=> string(5) "Array" - [10]=> + [8]=> string(3) "php" - [11]=> + [9]=> string(0) "" } -int(5) +int(4) -- Iteration 1 -- Warning: Array to string conversion in %s on line %d -array(12) { +array(10) { [0]=> string(1) "1" [1]=> - string(0) "" + string(5) "FOUND" [2]=> - string(1) "1" + string(2) "-1" [3]=> - string(1) "0" + string(1) "1" [4]=> - string(2) "-1" + string(5) "FOUND" [5]=> - string(1) "1" - [6]=> - string(1) "0" - [7]=> string(2) "-1" - [8]=> + [6]=> string(0) "" - [9]=> + [7]=> string(5) "Array" - [10]=> + [8]=> string(3) "php" - [11]=> + [9]=> string(0) "" } -int(0) +int(2) -- Iteration 2 -- Warning: Array to string conversion in %s on line %d -array(12) { +array(10) { [0]=> - string(5) "FOUND" + string(1) "1" [1]=> - string(0) "" + string(1) "0" [2]=> string(5) "FOUND" [3]=> - string(1) "0" + string(1) "1" [4]=> - string(6) "-FOUND" + string(1) "0" [5]=> string(5) "FOUND" [6]=> - string(1) "0" - [7]=> - string(6) "-FOUND" - [8]=> string(0) "" - [9]=> + [7]=> string(5) "Array" - [10]=> + [8]=> string(3) "php" - [11]=> + [9]=> string(0) "" } -int(5) +int(2) -- Iteration 3 -- Warning: Array to string conversion in %s on line %d -array(12) { +array(10) { [0]=> - string(1) "1" + string(5) "FOUND" [1]=> - string(0) "" + string(1) "0" [2]=> - string(1) "1" + string(6) "-FOUND" [3]=> string(5) "FOUND" [4]=> - string(2) "-1" + string(1) "0" [5]=> - string(1) "1" + string(6) "-FOUND" [6]=> - string(5) "FOUND" - [7]=> - string(2) "-1" - [8]=> string(0) "" - [9]=> + [7]=> string(5) "Array" - [10]=> + [8]=> string(3) "php" - [11]=> + [9]=> string(0) "" } -int(2) +int(4) -- Iteration 4 -- Warning: Array to string conversion in %s on line %d -array(12) { +array(10) { [0]=> string(1) "1" [1]=> - string(0) "" + string(5) "FOUND" [2]=> - string(1) "1" + string(2) "-1" [3]=> - string(1) "0" + string(1) "1" [4]=> string(5) "FOUND" [5]=> - string(1) "1" + string(2) "-1" [6]=> - string(1) "0" - [7]=> - string(5) "FOUND" - [8]=> string(0) "" - [9]=> + [7]=> string(5) "Array" - [10]=> + [8]=> string(3) "php" - [11]=> + [9]=> string(0) "" } int(2) @@ -179,218 +159,136 @@ int(2) -- Iteration 5 -- Warning: Array to string conversion in %s on line %d -array(12) { +array(10) { [0]=> - string(5) "FOUND" + string(1) "1" [1]=> - string(0) "" + string(1) "0" [2]=> string(5) "FOUND" [3]=> - string(1) "0" + string(1) "1" [4]=> - string(6) "-FOUND" + string(1) "0" [5]=> string(5) "FOUND" [6]=> - string(1) "0" - [7]=> - string(6) "-FOUND" - [8]=> string(0) "" - [9]=> - string(5) "Array" - [10]=> - string(3) "php" - [11]=> - string(0) "" -} -int(5) - --- Iteration 6 -- - -Warning: Array to string conversion in %s on line %d -array(12) { - [0]=> - string(1) "1" - [1]=> - string(0) "" - [2]=> - string(1) "1" - [3]=> - string(5) "FOUND" - [4]=> - string(2) "-1" - [5]=> - string(1) "1" - [6]=> - string(5) "FOUND" [7]=> - string(2) "-1" - [8]=> - string(0) "" - [9]=> string(5) "Array" - [10]=> - string(3) "php" - [11]=> - string(0) "" -} -int(2) - --- Iteration 7 -- - -Warning: Array to string conversion in %s on line %d -array(12) { - [0]=> - string(1) "1" - [1]=> - string(0) "" - [2]=> - string(1) "1" - [3]=> - string(1) "0" - [4]=> - string(5) "FOUND" - [5]=> - string(1) "1" - [6]=> - string(1) "0" - [7]=> - string(5) "FOUND" [8]=> - string(0) "" - [9]=> - string(5) "Array" - [10]=> string(3) "php" - [11]=> + [9]=> string(0) "" } int(2) --- Iteration 8 -- +-- Iteration 6 -- Deprecated: str_replace(): Passing null to parameter #1 ($search) of type array|string is deprecated in %s on line %d Warning: Array to string conversion in %s on line %d -array(12) { +array(10) { [0]=> string(1) "1" [1]=> - string(0) "" - [2]=> - string(1) "1" - [3]=> string(1) "0" - [4]=> + [2]=> string(2) "-1" - [5]=> + [3]=> string(1) "1" - [6]=> + [4]=> string(1) "0" - [7]=> + [5]=> string(2) "-1" - [8]=> + [6]=> string(0) "" - [9]=> + [7]=> string(5) "Array" - [10]=> + [8]=> string(3) "php" - [11]=> + [9]=> string(0) "" } int(0) --- Iteration 9 -- +-- Iteration 7 -- Warning: Array to string conversion in %s on line %d -array(12) { +array(10) { [0]=> string(1) "1" [1]=> - string(0) "" - [2]=> - string(1) "1" - [3]=> string(1) "0" - [4]=> + [2]=> string(2) "-1" - [5]=> + [3]=> string(1) "1" - [6]=> + [4]=> string(1) "0" - [7]=> + [5]=> string(2) "-1" - [8]=> + [6]=> string(0) "" - [9]=> + [7]=> string(5) "Array" - [10]=> + [8]=> string(3) "php" - [11]=> + [9]=> string(0) "" } int(0) --- Iteration 10 -- +-- Iteration 8 -- Warning: Array to string conversion in %s on line %d -array(12) { +array(10) { [0]=> string(1) "1" [1]=> - string(0) "" - [2]=> - string(1) "1" - [3]=> string(1) "0" - [4]=> + [2]=> string(2) "-1" - [5]=> + [3]=> string(1) "1" - [6]=> + [4]=> string(1) "0" - [7]=> + [5]=> string(2) "-1" - [8]=> + [6]=> string(0) "" - [9]=> + [7]=> string(5) "Array" - [10]=> + [8]=> string(5) "FOUND" - [11]=> + [9]=> string(0) "" } int(1) --- Iteration 11 -- +-- Iteration 9 -- Warning: Array to string conversion in %s on line %d -array(12) { +array(10) { [0]=> string(1) "1" [1]=> - string(0) "" - [2]=> - string(1) "1" - [3]=> string(1) "0" - [4]=> + [2]=> string(2) "-1" - [5]=> + [3]=> string(1) "1" - [6]=> + [4]=> string(1) "0" - [7]=> + [5]=> string(2) "-1" - [8]=> + [6]=> string(0) "" - [9]=> + [7]=> string(5) "Array" - [10]=> + [8]=> string(3) "php" - [11]=> + [9]=> string(0) "" } int(0) diff --git a/ext/standard/tests/strings/str_replace_variation2.phpt b/ext/standard/tests/strings/str_replace_variation2.phpt index d8dcd58e1b60..4aa53508ab69 100644 --- a/ext/standard/tests/strings/str_replace_variation2.phpt +++ b/ext/standard/tests/strings/str_replace_variation2.phpt @@ -37,11 +37,9 @@ $search_str = array ( "\x5AC", "\0000", ".3", - TRUE, "TRUE", "1", 1, - FALSE, "FALSE", " ", " ", @@ -212,89 +210,75 @@ string(196) "Hello, world,0120333FOUND445-1.234567 NULL TRUE FALSE%0 --- Iteration 21 --- -- String after replacing the search value is => -- -string(205) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE%0 - %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World - ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(0)" --- search string has found '3' times - ---- Iteration 22 --- --- String after replacing the search value is => -- string(194) "Hello, world,0120333.3445-1.234567 NULL FOUND FALSE%0 %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" -- search string has found '1' times ---- Iteration 23 --- +--- Iteration 22 --- -- String after replacing the search value is => -- string(205) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE%0 %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(0)" -- search string has found '3' times ---- Iteration 24 --- +--- Iteration 23 --- -- String after replacing the search value is => -- string(205) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE%0 %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(0)" -- search string has found '3' times ---- Iteration 25 --- --- String after replacing the search value is => -- -string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 - %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World - ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" --- search string has found '0' times - ---- Iteration 26 --- +--- Iteration 24 --- -- String after replacing the search value is => -- string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FOUND%0 %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" -- search string has found '1' times ---- Iteration 27 --- +--- Iteration 25 --- -- String after replacing the search value is => -- string(333) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE%0 FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUND%00ZCD%0abcdFOUND\xXYZ abcdFOUND$$@#%^&*!~,.:;?:FOUND!!Hello,FOUNDWorld FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" -- search string has found '35' times ---- Iteration 28 --- +--- Iteration 26 --- -- String after replacing the search value is => -- string(188) "Hello, world,0120333.3445-1.234567FOUNDNULL TRUE FALSE%0 %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" -- search string has found '1' times ---- Iteration 29 --- +--- Iteration 27 --- -- String after replacing the search value is => -- string(201) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 %00ZCD%0aFOUNDcd \xXYZ aFOUNDcd $$@#%^&*!~,.:;?: !!Hello, World ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" -- search string has found '2' times ---- Iteration 30 --- +--- Iteration 28 --- -- String after replacing the search value is => -- string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" -- search string has found '0' times ---- Iteration 31 --- +--- Iteration 29 --- -- String after replacing the search value is => -- string(197) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 %00ZCD%0abcd \xXYZFOUNDabcd $$@#%^&*!~,.:;?: !!Hello, World ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" -- search string has found '1' times ---- Iteration 32 --- +--- Iteration 30 --- -- String after replacing the search value is => -- string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" -- search string has found '0' times ---- Iteration 33 --- +--- Iteration 31 --- -- String after replacing the search value is => -- string(5) "FOUND" -- search string has found '1' times diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt index 1136774b38ac..4ff9ee4ecf96 100644 --- a/ext/standard/tests/strings/strcasecmp.phpt +++ b/ext/standard/tests/strings/strcasecmp.phpt @@ -11,7 +11,7 @@ echo "#### Basic and Possible operations ####"; $arrays = array( array("a", 'A', chr(128), chr(255), chr(0)), array("acc", "Acc", 'aC', "acCc", 'acd', "?acc", 'Acc!', "$!acc", ";acc"), - array("1", "0", 0, "-1", -1, "", TRUE, true, FALSE, "string"), + array("1", "0", 0, "-1", -1, "", "string"), array(10.5, 1.5, 9.5, 11.5, 100.5, 10.5E1, -10.5, 10, 0.5) ); @@ -282,10 +282,7 @@ Array [3] => -1 [4] => -1 [5] => - [6] => 1 - [7] => 1 - [8] => - [9] => string + [6] => string ) Iteration 0 @@ -295,9 +292,6 @@ Iteration 0 - strcasecmp of '1' and '-1' is => int(%d) - strcasecmp of '1' and '-1' is => int(%d) - strcasecmp of '1' and '' is => int(%d) -- strcasecmp of '1' and '1' is => int(0) -- strcasecmp of '1' and '1' is => int(0) -- strcasecmp of '1' and '' is => int(%d) - strcasecmp of '1' and 'string' is => int(-%d) Iteration 1 @@ -307,9 +301,6 @@ Iteration 1 - strcasecmp of '0' and '-1' is => int(%d) - strcasecmp of '0' and '-1' is => int(%d) - strcasecmp of '0' and '' is => int(%d) -- strcasecmp of '0' and '1' is => int(-%d) -- strcasecmp of '0' and '1' is => int(-%d) -- strcasecmp of '0' and '' is => int(%d) - strcasecmp of '0' and 'string' is => int(-%d) Iteration 2 @@ -319,9 +310,6 @@ Iteration 2 - strcasecmp of '0' and '-1' is => int(%d) - strcasecmp of '0' and '-1' is => int(%d) - strcasecmp of '0' and '' is => int(%d) -- strcasecmp of '0' and '1' is => int(-%d) -- strcasecmp of '0' and '1' is => int(-%d) -- strcasecmp of '0' and '' is => int(%d) - strcasecmp of '0' and 'string' is => int(-%d) Iteration 3 @@ -331,9 +319,6 @@ Iteration 3 - strcasecmp of '-1' and '-1' is => int(0) - strcasecmp of '-1' and '-1' is => int(0) - strcasecmp of '-1' and '' is => int(%d) -- strcasecmp of '-1' and '1' is => int(-%d) -- strcasecmp of '-1' and '1' is => int(-%d) -- strcasecmp of '-1' and '' is => int(%d) - strcasecmp of '-1' and 'string' is => int(-%d) Iteration 4 @@ -343,9 +328,6 @@ Iteration 4 - strcasecmp of '-1' and '-1' is => int(0) - strcasecmp of '-1' and '-1' is => int(0) - strcasecmp of '-1' and '' is => int(%d) -- strcasecmp of '-1' and '1' is => int(-%d) -- strcasecmp of '-1' and '1' is => int(-%d) -- strcasecmp of '-1' and '' is => int(%d) - strcasecmp of '-1' and 'string' is => int(-%d) Iteration 5 @@ -355,57 +337,15 @@ Iteration 5 - strcasecmp of '' and '-1' is => int(-%d) - strcasecmp of '' and '-1' is => int(-%d) - strcasecmp of '' and '' is => int(0) -- strcasecmp of '' and '1' is => int(-%d) -- strcasecmp of '' and '1' is => int(-%d) -- strcasecmp of '' and '' is => int(0) - strcasecmp of '' and 'string' is => int(-%d) Iteration 6 -- strcasecmp of '1' and '1' is => int(0) -- strcasecmp of '1' and '0' is => int(%d) -- strcasecmp of '1' and '0' is => int(%d) -- strcasecmp of '1' and '-1' is => int(%d) -- strcasecmp of '1' and '-1' is => int(%d) -- strcasecmp of '1' and '' is => int(%d) -- strcasecmp of '1' and '1' is => int(0) -- strcasecmp of '1' and '1' is => int(0) -- strcasecmp of '1' and '' is => int(%d) -- strcasecmp of '1' and 'string' is => int(-%d) - -Iteration 7 -- strcasecmp of '1' and '1' is => int(0) -- strcasecmp of '1' and '0' is => int(%d) -- strcasecmp of '1' and '0' is => int(%d) -- strcasecmp of '1' and '-1' is => int(%d) -- strcasecmp of '1' and '-1' is => int(%d) -- strcasecmp of '1' and '' is => int(%d) -- strcasecmp of '1' and '1' is => int(0) -- strcasecmp of '1' and '1' is => int(0) -- strcasecmp of '1' and '' is => int(%d) -- strcasecmp of '1' and 'string' is => int(-%d) - -Iteration 8 -- strcasecmp of '' and '1' is => int(-%d) -- strcasecmp of '' and '0' is => int(-%d) -- strcasecmp of '' and '0' is => int(-%d) -- strcasecmp of '' and '-1' is => int(-%d) -- strcasecmp of '' and '-1' is => int(-%d) -- strcasecmp of '' and '' is => int(0) -- strcasecmp of '' and '1' is => int(-%d) -- strcasecmp of '' and '1' is => int(-%d) -- strcasecmp of '' and '' is => int(0) -- strcasecmp of '' and 'string' is => int(-%d) - -Iteration 9 - strcasecmp of 'string' and '1' is => int(%d) - strcasecmp of 'string' and '0' is => int(%d) - strcasecmp of 'string' and '0' is => int(%d) - strcasecmp of 'string' and '-1' is => int(%d) - strcasecmp of 'string' and '-1' is => int(%d) - strcasecmp of 'string' and '' is => int(%d) -- strcasecmp of 'string' and '1' is => int(%d) -- strcasecmp of 'string' and '1' is => int(%d) -- strcasecmp of 'string' and '' is => int(%d) - strcasecmp of 'string' and 'string' is => int(0) *** comparing the strings in an diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt index fa94a9cc3a01..e6b07e7ae819 100644 --- a/ext/standard/tests/strings/strcmp.phpt +++ b/ext/standard/tests/strings/strcmp.phpt @@ -11,7 +11,7 @@ echo "#### Basic and Possible operations ####"; $arrays = array( array("a", "A", 'a', 'A', chr(128), chr(255), chr(0)), array("acc", "Acc", 'ac', "accc", 'acd', "?acc", 'acc!', "$!acc", ";acc"), - array("1", "0", 0, "-1", -1, "", TRUE, FALSE, "string"), + array("1", "0", 0, "-1", -1, "", "string"), array(10.5, 1.5, 9.5, 11.5, 100.5, 10.5E1, -10.5, 10, 0.5) ); @@ -312,9 +312,7 @@ Array [3] => -1 [4] => -1 [5] => - [6] => 1 - [7] => - [8] => string + [6] => string ) Iteration 0 @@ -324,8 +322,6 @@ Iteration 0 - strcmp of '1' and '-1' is => int(%d) - strcmp of '1' and '-1' is => int(%d) - strcmp of '1' and '' is => int(%d) -- strcmp of '1' and '1' is => int(0) -- strcmp of '1' and '' is => int(%d) - strcmp of '1' and 'string' is => int(-%d) Iteration 1 @@ -335,8 +331,6 @@ Iteration 1 - strcmp of '0' and '-1' is => int(%d) - strcmp of '0' and '-1' is => int(%d) - strcmp of '0' and '' is => int(%d) -- strcmp of '0' and '1' is => int(-%d) -- strcmp of '0' and '' is => int(%d) - strcmp of '0' and 'string' is => int(-%d) Iteration 2 @@ -346,8 +340,6 @@ Iteration 2 - strcmp of '0' and '-1' is => int(%d) - strcmp of '0' and '-1' is => int(%d) - strcmp of '0' and '' is => int(%d) -- strcmp of '0' and '1' is => int(-%d) -- strcmp of '0' and '' is => int(%d) - strcmp of '0' and 'string' is => int(-%d) Iteration 3 @@ -357,8 +349,6 @@ Iteration 3 - strcmp of '-1' and '-1' is => int(0) - strcmp of '-1' and '-1' is => int(0) - strcmp of '-1' and '' is => int(%d) -- strcmp of '-1' and '1' is => int(-%d) -- strcmp of '-1' and '' is => int(%d) - strcmp of '-1' and 'string' is => int(-%d) Iteration 4 @@ -368,8 +358,6 @@ Iteration 4 - strcmp of '-1' and '-1' is => int(0) - strcmp of '-1' and '-1' is => int(0) - strcmp of '-1' and '' is => int(%d) -- strcmp of '-1' and '1' is => int(-%d) -- strcmp of '-1' and '' is => int(%d) - strcmp of '-1' and 'string' is => int(-%d) Iteration 5 @@ -379,41 +367,15 @@ Iteration 5 - strcmp of '' and '-1' is => int(-%d) - strcmp of '' and '-1' is => int(-%d) - strcmp of '' and '' is => int(0) -- strcmp of '' and '1' is => int(-%d) -- strcmp of '' and '' is => int(0) - strcmp of '' and 'string' is => int(-%d) Iteration 6 -- strcmp of '1' and '1' is => int(0) -- strcmp of '1' and '0' is => int(%d) -- strcmp of '1' and '0' is => int(%d) -- strcmp of '1' and '-1' is => int(%d) -- strcmp of '1' and '-1' is => int(%d) -- strcmp of '1' and '' is => int(%d) -- strcmp of '1' and '1' is => int(0) -- strcmp of '1' and '' is => int(%d) -- strcmp of '1' and 'string' is => int(-%d) - -Iteration 7 -- strcmp of '' and '1' is => int(-%d) -- strcmp of '' and '0' is => int(-%d) -- strcmp of '' and '0' is => int(-%d) -- strcmp of '' and '-1' is => int(-%d) -- strcmp of '' and '-1' is => int(-%d) -- strcmp of '' and '' is => int(0) -- strcmp of '' and '1' is => int(-%d) -- strcmp of '' and '' is => int(0) -- strcmp of '' and 'string' is => int(-%d) - -Iteration 8 - strcmp of 'string' and '1' is => int(%d) - strcmp of 'string' and '0' is => int(%d) - strcmp of 'string' and '0' is => int(%d) - strcmp of 'string' and '-1' is => int(%d) - strcmp of 'string' and '-1' is => int(%d) - strcmp of 'string' and '' is => int(%d) -- strcmp of 'string' and '1' is => int(%d) -- strcmp of 'string' and '' is => int(%d) - strcmp of 'string' and 'string' is => int(0) *** comparing the strings in an diff --git a/ext/standard/tests/strings/strip_tags_variation2.phpt b/ext/standard/tests/strings/strip_tags_variation2.phpt index 009124c9cca9..e375a75a22bf 100644 --- a/ext/standard/tests/strings/strip_tags_variation2.phpt +++ b/ext/standard/tests/strings/strip_tags_variation2.phpt @@ -42,12 +42,6 @@ $values = array( NULL, null, - // boolean data - true, - false, - TRUE, - FALSE, - // empty data "", '', @@ -106,12 +100,4 @@ string(10) "helloworld" string(10) "helloworld" -- Iteration 16 -- string(10) "helloworld" --- Iteration 17 -- -string(10) "helloworld" --- Iteration 18 -- -string(10) "helloworld" --- Iteration 19 -- -string(10) "helloworld" --- Iteration 20 -- -string(10) "helloworld" Done diff --git a/ext/standard/tests/strings/stripos.phpt b/ext/standard/tests/strings/stripos.phpt index f56d38d3de7b..80cbb77772d5 100644 --- a/ext/standard/tests/strings/stripos.phpt +++ b/ext/standard/tests/strings/stripos.phpt @@ -16,14 +16,9 @@ stripos() function test var_dump(stripos("a", " ")); var_dump(stripos("a", "a")); var_dump(stripos("", 1)); - var_dump(stripos("", false)); - var_dump(stripos("", true)); var_dump(stripos("a", 1)); - var_dump(stripos("a", false)); - var_dump(stripos("a", true)); var_dump(stripos("1", 1)); - var_dump(stripos("0", false)); - var_dump(stripos("1", true)); + var_dump(stripos("0", "")); var_dump(stripos("\\\\a", "\\a")); ?> @@ -43,13 +38,8 @@ bool(false) bool(false) int(0) bool(false) -int(0) -bool(false) bool(false) int(0) -bool(false) -int(0) -int(0) int(0) int(1) diff --git a/ext/standard/tests/strings/stripos_variation1.phpt b/ext/standard/tests/strings/stripos_variation1.phpt index e205913fcfb0..cd6f95882c85 100644 --- a/ext/standard/tests/strings/stripos_variation1.phpt +++ b/ext/standard/tests/strings/stripos_variation1.phpt @@ -25,10 +25,6 @@ $needle = array( //nulls "\0", - //boolean false - FALSE, - false, - //empty string "", @@ -113,93 +109,87 @@ bool(false) int(0) int(11) -- Iteration 13 -- -int(0) -int(12) --- Iteration 14 -- -int(0) -int(13) --- Iteration 15 -- int(10) int(47) --- Iteration 16 -- +-- Iteration 14 -- int(12) bool(false) --- Iteration 17 -- +-- Iteration 15 -- int(11) bool(false) --- Iteration 18 -- +-- Iteration 16 -- int(13) bool(false) --- Iteration 19 -- +-- Iteration 17 -- int(14) bool(false) --- Iteration 20 -- +-- Iteration 18 -- int(16) bool(false) --- Iteration 21 -- +-- Iteration 19 -- int(17) bool(false) --- Iteration 22 -- +-- Iteration 20 -- int(20) -bool(false) --- Iteration 23 -- +int(20) +-- Iteration 21 -- int(22) int(22) --- Iteration 24 -- +-- Iteration 22 -- int(23) int(23) --- Iteration 25 -- +-- Iteration 23 -- int(24) int(24) --- Iteration 26 -- +-- Iteration 24 -- int(25) int(25) --- Iteration 27 -- +-- Iteration 25 -- bool(false) bool(false) --- Iteration 28 -- +-- Iteration 26 -- int(27) int(27) --- Iteration 29 -- +-- Iteration 27 -- int(28) int(28) --- Iteration 30 -- +-- Iteration 28 -- int(29) int(29) --- Iteration 31 -- +-- Iteration 29 -- int(31) int(31) --- Iteration 32 -- +-- Iteration 30 -- int(30) -bool(false) --- Iteration 33 -- +int(30) +-- Iteration 31 -- int(32) int(32) --- Iteration 34 -- +-- Iteration 32 -- int(33) int(33) --- Iteration 35 -- +-- Iteration 33 -- int(33) -bool(false) --- Iteration 36 -- +int(33) +-- Iteration 34 -- int(39) int(39) --- Iteration 37 -- +-- Iteration 35 -- int(15) int(48) --- Iteration 38 -- +-- Iteration 36 -- int(15) int(48) --- Iteration 39 -- +-- Iteration 37 -- int(51) int(51) --- Iteration 40 -- +-- Iteration 38 -- int(51) int(51) --- Iteration 41 -- +-- Iteration 39 -- bool(false) bool(false) --- Iteration 42 -- +-- Iteration 40 -- int(0) bool(false) *** Done *** diff --git a/ext/standard/tests/strings/stripos_variation2.phpt b/ext/standard/tests/strings/stripos_variation2.phpt index 2f95822645bf..6a599a860932 100644 --- a/ext/standard/tests/strings/stripos_variation2.phpt +++ b/ext/standard/tests/strings/stripos_variation2.phpt @@ -25,10 +25,6 @@ $needle = array( //nulls '\0', - //boolean false - FALSE, - false, - //empty string '', @@ -115,99 +111,93 @@ int(10) int(0) int(11) -- Iteration 13 -- -int(0) -int(12) --- Iteration 14 -- -int(0) -int(13) --- Iteration 15 -- int(14) int(14) --- Iteration 16 -- +-- Iteration 14 -- int(16) int(16) --- Iteration 17 -- +-- Iteration 15 -- int(15) -bool(false) --- Iteration 18 -- +int(15) +-- Iteration 16 -- int(17) int(17) --- Iteration 19 -- +-- Iteration 17 -- int(18) int(18) --- Iteration 20 -- +-- Iteration 18 -- int(20) int(20) --- Iteration 21 -- +-- Iteration 19 -- int(21) int(21) --- Iteration 22 -- +-- Iteration 20 -- int(24) int(24) --- Iteration 23 -- +-- Iteration 21 -- int(26) int(26) --- Iteration 24 -- +-- Iteration 22 -- int(27) int(27) --- Iteration 25 -- +-- Iteration 23 -- int(28) int(28) --- Iteration 26 -- +-- Iteration 24 -- int(29) int(29) --- Iteration 27 -- +-- Iteration 25 -- bool(false) bool(false) --- Iteration 28 -- +-- Iteration 26 -- bool(false) bool(false) --- Iteration 29 -- +-- Iteration 27 -- int(31) int(31) --- Iteration 30 -- +-- Iteration 28 -- int(32) int(32) --- Iteration 31 -- +-- Iteration 29 -- int(33) int(33) --- Iteration 32 -- +-- Iteration 30 -- int(35) int(35) --- Iteration 33 -- +-- Iteration 31 -- int(34) int(34) --- Iteration 34 -- +-- Iteration 32 -- int(36) int(36) --- Iteration 35 -- +-- Iteration 33 -- int(37) int(37) --- Iteration 36 -- +-- Iteration 34 -- int(37) int(37) --- Iteration 37 -- +-- Iteration 35 -- int(43) int(43) --- Iteration 38 -- +-- Iteration 36 -- int(52) int(52) --- Iteration 39 -- +-- Iteration 37 -- int(19) bool(false) --- Iteration 40 -- +-- Iteration 38 -- int(58) int(58) --- Iteration 41 -- +-- Iteration 39 -- bool(false) bool(false) --- Iteration 42 -- +-- Iteration 40 -- bool(false) bool(false) --- Iteration 43 -- +-- Iteration 41 -- bool(false) bool(false) --- Iteration 44 -- +-- Iteration 42 -- int(0) bool(false) *** Done *** diff --git a/ext/standard/tests/strings/stristr_variation2.phpt b/ext/standard/tests/strings/stristr_variation2.phpt index 44a9e6a71ac6..c5e371cf6793 100644 --- a/ext/standard/tests/strings/stristr_variation2.phpt +++ b/ext/standard/tests/strings/stristr_variation2.phpt @@ -26,12 +26,11 @@ $inputs = array ( -20.5, 10.1234567e10, - // boolean values -/*8*/ true, - false, + // empty string +/*8*/ "", // objects -/*10*/ new sample(), +/*9*/ new sample(), ); //defining '$pad_length' argument @@ -63,8 +62,6 @@ bool(false) -- Iteration 7 -- bool(false) -- Iteration 8 -- -bool(false) --- Iteration 9 -- string(11) "Hello World" --- Iteration 10 -- +-- Iteration 9 -- bool(false) diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt index b1ff4f4e74d9..0926936d8fbf 100644 --- a/ext/standard/tests/strings/strlen.phpt +++ b/ext/standard/tests/strings/strlen.phpt @@ -26,8 +26,7 @@ $strings = array( "Hello, World", 0, "\t", // len = 1 '\t', // len = 2 - TRUE, - FALSE, + "1", "Hello, World\0", "Hello\0World", 'Hello, World\0', @@ -144,7 +143,6 @@ String length of '0' is => int(1) String length of ' ' is => int(1) String length of '\t' is => int(2) String length of '1' is => int(1) -String length of '' is => int(0) String length of 'Hello, World%0' is => int(13) String length of 'Hello%0World' is => int(11) String length of 'Hello, World\0' is => int(14) diff --git a/ext/standard/tests/strings/strnatcasecmp_variation1.phpt b/ext/standard/tests/strings/strnatcasecmp_variation1.phpt index dff57b337208..6cb9e37eb147 100644 --- a/ext/standard/tests/strings/strnatcasecmp_variation1.phpt +++ b/ext/standard/tests/strings/strnatcasecmp_variation1.phpt @@ -30,7 +30,7 @@ function str_dump($a, $b) { echo "*** Testing strnatcasecmp() : variation ***\n"; -str_dump('0', false); +str_dump('0', ''); str_dump('fooBar', ''); str_dump('', -1); str_dump("Hello\0world", "Helloworld"); diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt index 739d9d86721d..3fe84490ee12 100644 --- a/ext/standard/tests/strings/strpos.phpt +++ b/ext/standard/tests/strings/strpos.phpt @@ -41,11 +41,10 @@ $needles = array( "NULL", "0", 0, - TRUE, "TRUE", "1", 1, - FALSE, + "", "FALSE", " ", " ", @@ -68,8 +67,6 @@ echo "\n*** Testing strpos() with possible variations in offset ***\n"; $offset_values = array ( 1, // offset = 1 "0", - TRUE, - FALSE, -10, // Not found -15, // Found -strlen($string), @@ -199,7 +196,6 @@ Position of '-3.344' is => int(19) Position of 'NULL' is => int(31) Position of '0' is => int(12) Position of '0' is => int(12) -Position of '1' is => int(13) Position of 'TRUE' is => int(36) Position of '1' is => int(13) Position of '1' is => int(13) @@ -220,8 +216,6 @@ abcd$:Hello world' is => int(0) *** Testing strpos() with possible variations in offset *** Position of 'Hello' with offset '1' is => int(74) Position of 'Hello' with offset '0' is => int(0) -Position of 'Hello' with offset '1' is => int(74) -Position of 'Hello' with offset '' is => int(0) Position of 'Hello' with offset '-10' is => bool(false) Position of 'Hello' with offset '-15' is => int(74) Position of 'Hello' with offset '-85' is => int(0) diff --git a/ext/standard/tests/strings/strrchr_variation1.phpt b/ext/standard/tests/strings/strrchr_variation1.phpt index 3e71728ef880..f0a25c9395d6 100644 --- a/ext/standard/tests/strings/strrchr_variation1.phpt +++ b/ext/standard/tests/strings/strrchr_variation1.phpt @@ -26,10 +26,6 @@ $needle = array( //nulls "\0", - //boolean false - FALSE, - false, - //empty string "", @@ -124,98 +120,90 @@ string(45) "%0 $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " -- Iteration 13 -- -string(45) "%0 - $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " +string(1) " " -- Iteration 14 -- -string(45) "%0 - $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " +string(41) "$&!#%\o,()*+-./:;<=>?@hello123456he #4 A " -- Iteration 15 -- string(1) " " -- Iteration 16 -- -string(41) "$&!#%\o,()*+-./:;<=>?@hello123456he #4 A " - --- Iteration 17 -- -string(1) " " - --- Iteration 18 -- string(40) "&!#%\o,()*+-./:;<=>?@hello123456he #4 A " --- Iteration 19 -- +-- Iteration 17 -- string(39) "!#%\o,()*+-./:;<=>?@hello123456he #4 A " --- Iteration 20 -- +-- Iteration 18 -- string(37) "%\o,()*+-./:;<=>?@hello123456he #4 A " --- Iteration 21 -- +-- Iteration 19 -- string(36) "\o,()*+-./:;<=>?@hello123456he #4 A " --- Iteration 22 -- +-- Iteration 20 -- string(33) "()*+-./:;<=>?@hello123456he #4 A " --- Iteration 23 -- +-- Iteration 21 -- string(31) "*+-./:;<=>?@hello123456he #4 A " --- Iteration 24 -- +-- Iteration 22 -- string(30) "+-./:;<=>?@hello123456he #4 A " --- Iteration 25 -- +-- Iteration 23 -- string(29) "-./:;<=>?@hello123456he #4 A " --- Iteration 26 -- +-- Iteration 24 -- string(28) "./:;<=>?@hello123456he #4 A " --- Iteration 27 -- +-- Iteration 25 -- string(28) "./:;<=>?@hello123456he #4 A " --- Iteration 28 -- +-- Iteration 26 -- string(26) ":;<=>?@hello123456he #4 A " --- Iteration 29 -- +-- Iteration 27 -- string(25) ";<=>?@hello123456he #4 A " --- Iteration 30 -- +-- Iteration 28 -- string(24) "<=>?@hello123456he #4 A " --- Iteration 31 -- +-- Iteration 29 -- string(22) ">?@hello123456he #4 A " --- Iteration 32 -- +-- Iteration 30 -- string(23) "=>?@hello123456he #4 A " --- Iteration 33 -- +-- Iteration 31 -- string(21) "?@hello123456he #4 A " --- Iteration 34 -- +-- Iteration 32 -- string(20) "@hello123456he #4 A " --- Iteration 35 -- +-- Iteration 33 -- string(20) "@hello123456he #4 A " --- Iteration 36 -- +-- Iteration 34 -- string(14) "123456he #4 A " --- Iteration 37 -- +-- Iteration 35 -- string(5) "#4 A " --- Iteration 38 -- +-- Iteration 36 -- string(5) "#4 A " --- Iteration 39 -- +-- Iteration 37 -- string(2) "A " --- Iteration 40 -- +-- Iteration 38 -- string(2) "A " --- Iteration 41 -- +-- Iteration 39 -- string(4) "4 A " --- Iteration 42 -- +-- Iteration 40 -- string(4) "4 A " --- Iteration 43 -- +-- Iteration 41 -- string(53) "Hello, %0 $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " diff --git a/ext/standard/tests/strings/strrchr_variation2.phpt b/ext/standard/tests/strings/strrchr_variation2.phpt index 646f13a702e4..30f2600c6678 100644 --- a/ext/standard/tests/strings/strrchr_variation2.phpt +++ b/ext/standard/tests/strings/strrchr_variation2.phpt @@ -25,10 +25,6 @@ $needle = array( //nulls '\0', - //boolean false - FALSE, - false, - //empty string '', @@ -113,95 +109,89 @@ string(5) "\101 " bool(false) -- Iteration 13 -- -bool(false) +string(1) " " -- Iteration 14 -- -bool(false) +string(47) "$&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 15 -- string(1) " " -- Iteration 16 -- -string(47) "$&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " +string(46) "&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 17 -- -string(1) " " +string(45) "!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 18 -- -string(46) "&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " +string(43) "%\o,()*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 19 -- -string(45) "!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " +string(5) "\101 " -- Iteration 20 -- -string(43) "%\o,()*+-./:;<=>?@hello123456he \x234 \101 " +string(39) "()*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 21 -- -string(5) "\101 " +string(37) "*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 22 -- -string(39) "()*+-./:;<=>?@hello123456he \x234 \101 " +string(36) "+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 23 -- -string(37) "*+-./:;<=>?@hello123456he \x234 \101 " +string(35) "-./:;<=>?@hello123456he \x234 \101 " -- Iteration 24 -- -string(36) "+-./:;<=>?@hello123456he \x234 \101 " +string(34) "./:;<=>?@hello123456he \x234 \101 " -- Iteration 25 -- -string(35) "-./:;<=>?@hello123456he \x234 \101 " +string(34) "./:;<=>?@hello123456he \x234 \101 " -- Iteration 26 -- -string(34) "./:;<=>?@hello123456he \x234 \101 " +string(32) ":;<=>?@hello123456he \x234 \101 " -- Iteration 27 -- -string(34) "./:;<=>?@hello123456he \x234 \101 " +string(31) ";<=>?@hello123456he \x234 \101 " -- Iteration 28 -- -string(32) ":;<=>?@hello123456he \x234 \101 " +string(30) "<=>?@hello123456he \x234 \101 " -- Iteration 29 -- -string(31) ";<=>?@hello123456he \x234 \101 " +string(28) ">?@hello123456he \x234 \101 " -- Iteration 30 -- -string(30) "<=>?@hello123456he \x234 \101 " +string(29) "=>?@hello123456he \x234 \101 " -- Iteration 31 -- -string(28) ">?@hello123456he \x234 \101 " +string(27) "?@hello123456he \x234 \101 " -- Iteration 32 -- -string(29) "=>?@hello123456he \x234 \101 " +string(26) "@hello123456he \x234 \101 " -- Iteration 33 -- -string(27) "?@hello123456he \x234 \101 " +string(26) "@hello123456he \x234 \101 " -- Iteration 34 -- -string(26) "@hello123456he \x234 \101 " +string(2) "1 " -- Iteration 35 -- -string(26) "@hello123456he \x234 \101 " +string(5) "\101 " -- Iteration 36 -- -string(2) "1 " +string(44) "#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 37 -- string(5) "\101 " -- Iteration 38 -- -string(44) "#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " - --- Iteration 39 -- -string(5) "\101 " - --- Iteration 40 -- bool(false) --- Iteration 41 -- +-- Iteration 39 -- string(7) "4 \101 " --- Iteration 42 -- +-- Iteration 40 -- string(7) "4 \101 " --- Iteration 43 -- +-- Iteration 41 -- string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " *** Done *** diff --git a/ext/standard/tests/strings/strripos_variation1.phpt b/ext/standard/tests/strings/strripos_variation1.phpt index 57ae8dd11a65..7ae5a88724c9 100644 --- a/ext/standard/tests/strings/strripos_variation1.phpt +++ b/ext/standard/tests/strings/strripos_variation1.phpt @@ -25,10 +25,6 @@ $needles = array( //nulls /*11*/ "\0", - //boolean false -/*14*/ FALSE, - false, - //empty string /*16*/ "", @@ -129,106 +125,96 @@ int(44) int(44) int(43) -- Iteration 13 -- -int(44) -int(44) -int(44) -int(43) --- Iteration 14 -- -int(44) -int(44) -int(44) -int(43) --- Iteration 15 -- int(43) int(43) int(43) int(43) --- Iteration 16 -- +-- Iteration 14 -- int(12) int(12) bool(false) int(12) --- Iteration 17 -- +-- Iteration 15 -- int(11) int(11) bool(false) int(11) --- Iteration 18 -- +-- Iteration 16 -- int(13) int(13) bool(false) int(13) --- Iteration 19 -- +-- Iteration 17 -- int(14) int(14) bool(false) int(14) --- Iteration 20 -- +-- Iteration 18 -- int(17) int(17) bool(false) int(17) --- Iteration 21 -- +-- Iteration 19 -- int(20) int(20) int(20) int(20) --- Iteration 22 -- +-- Iteration 20 -- int(22) int(22) int(22) int(22) --- Iteration 23 -- +-- Iteration 21 -- int(21) int(21) int(21) int(21) --- Iteration 24 -- +-- Iteration 22 -- int(23) int(23) int(23) int(23) --- Iteration 25 -- +-- Iteration 23 -- int(24) int(24) int(24) int(24) --- Iteration 26 -- +-- Iteration 24 -- int(24) int(24) int(24) int(24) --- Iteration 27 -- +-- Iteration 25 -- int(30) int(30) int(30) int(30) --- Iteration 28 -- +-- Iteration 26 -- int(39) int(39) int(39) int(39) --- Iteration 29 -- +-- Iteration 27 -- int(39) int(39) int(39) int(39) --- Iteration 30 -- +-- Iteration 28 -- int(42) int(42) int(42) int(42) --- Iteration 31 -- +-- Iteration 29 -- int(42) int(42) int(42) int(42) --- Iteration 32 -- +-- Iteration 30 -- bool(false) bool(false) bool(false) bool(false) --- Iteration 33 -- +-- Iteration 31 -- int(0) bool(false) bool(false) diff --git a/ext/standard/tests/strings/strripos_variation2.phpt b/ext/standard/tests/strings/strripos_variation2.phpt index 12bcc2d22bb6..ade0b271b629 100644 --- a/ext/standard/tests/strings/strripos_variation2.phpt +++ b/ext/standard/tests/strings/strripos_variation2.phpt @@ -25,10 +25,6 @@ $needles = array( //nulls /*11*/ '\0', - //boolean false -/*14*/ FALSE, - false, - //empty string /*16*/ '', @@ -130,111 +126,101 @@ int(54) int(54) int(53) -- Iteration 13 -- -int(54) -int(54) -int(54) -int(53) --- Iteration 14 -- -int(54) -int(54) -int(54) -int(53) --- Iteration 15 -- int(53) int(53) int(53) int(53) --- Iteration 16 -- +-- Iteration 14 -- int(16) int(16) bool(false) int(16) --- Iteration 17 -- +-- Iteration 15 -- int(15) int(15) bool(false) int(15) --- Iteration 18 -- +-- Iteration 16 -- int(17) int(17) bool(false) int(17) --- Iteration 19 -- +-- Iteration 17 -- int(18) int(18) bool(false) int(18) --- Iteration 20 -- +-- Iteration 18 -- int(21) int(21) int(21) int(21) --- Iteration 21 -- +-- Iteration 19 -- int(24) int(24) int(24) int(24) --- Iteration 22 -- +-- Iteration 20 -- int(26) int(26) int(26) int(26) --- Iteration 23 -- +-- Iteration 21 -- int(25) int(25) int(25) int(25) --- Iteration 24 -- +-- Iteration 22 -- int(27) int(27) int(27) int(27) --- Iteration 25 -- +-- Iteration 23 -- int(28) int(28) int(28) int(28) --- Iteration 26 -- +-- Iteration 24 -- int(28) int(28) int(28) int(28) --- Iteration 27 -- +-- Iteration 25 -- int(34) int(34) int(34) int(34) --- Iteration 28 -- +-- Iteration 26 -- int(43) int(43) int(43) int(43) --- Iteration 29 -- +-- Iteration 27 -- int(19) int(19) bool(false) int(19) --- Iteration 30 -- +-- Iteration 28 -- int(49) int(49) int(49) int(49) --- Iteration 31 -- +-- Iteration 29 -- bool(false) bool(false) bool(false) bool(false) --- Iteration 32 -- +-- Iteration 30 -- bool(false) bool(false) bool(false) bool(false) --- Iteration 33 -- +-- Iteration 31 -- bool(false) bool(false) bool(false) bool(false) --- Iteration 34 -- +-- Iteration 32 -- int(0) bool(false) bool(false) diff --git a/ext/standard/tests/strings/strrpos_variation2.phpt b/ext/standard/tests/strings/strrpos_variation2.phpt index 0022d0e2c3f3..61aa98b7b000 100644 --- a/ext/standard/tests/strings/strrpos_variation2.phpt +++ b/ext/standard/tests/strings/strrpos_variation2.phpt @@ -25,10 +25,6 @@ $needle = array( //nulls '\0', - //boolean false - FALSE, - false, - //empty string '', @@ -105,69 +101,63 @@ int(10) int(54) int(54) -- Iteration 13 -- -int(54) -int(54) --- Iteration 14 -- -int(54) -int(54) --- Iteration 15 -- int(53) int(53) --- Iteration 16 -- +-- Iteration 14 -- int(16) int(16) --- Iteration 17 -- +-- Iteration 15 -- int(15) -bool(false) --- Iteration 18 -- +int(15) +-- Iteration 16 -- int(17) int(17) --- Iteration 19 -- +-- Iteration 17 -- int(18) int(18) --- Iteration 20 -- +-- Iteration 18 -- int(21) int(21) --- Iteration 21 -- +-- Iteration 19 -- int(24) int(24) --- Iteration 22 -- +-- Iteration 20 -- int(26) int(26) --- Iteration 23 -- +-- Iteration 21 -- int(25) int(25) --- Iteration 24 -- +-- Iteration 22 -- int(27) int(27) --- Iteration 25 -- +-- Iteration 23 -- int(28) int(28) --- Iteration 26 -- +-- Iteration 24 -- bool(false) bool(false) --- Iteration 27 -- +-- Iteration 25 -- int(34) int(34) --- Iteration 28 -- +-- Iteration 26 -- int(43) int(43) --- Iteration 29 -- +-- Iteration 27 -- int(19) bool(false) --- Iteration 30 -- +-- Iteration 28 -- int(49) int(49) --- Iteration 31 -- +-- Iteration 29 -- bool(false) bool(false) --- Iteration 32 -- +-- Iteration 30 -- bool(false) bool(false) --- Iteration 33 -- +-- Iteration 31 -- bool(false) bool(false) --- Iteration 34 -- +-- Iteration 32 -- int(0) bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation7.phpt b/ext/standard/tests/strings/strrpos_variation7.phpt index 01d8996b57b2..577b172f2ff6 100644 --- a/ext/standard/tests/strings/strrpos_variation7.phpt +++ b/ext/standard/tests/strings/strrpos_variation7.phpt @@ -16,7 +16,6 @@ try { } catch (Throwable $exception) { echo $exception::class, ': ', $exception->getMessage(), "\n"; } -var_dump( strrpos($empty_string, FALSE) ); echo "*** Done ***"; ?> @@ -25,5 +24,4 @@ echo "*** Done ***"; -- With empty heredoc string -- int(0) ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) -int(0) *** Done *** diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt index 0d4065b54fb2..9a78bd8e4ef3 100644 --- a/ext/standard/tests/strings/strstr.phpt +++ b/ext/standard/tests/strings/strstr.phpt @@ -38,11 +38,10 @@ $needles = array( "NULL", "0", 0, - TRUE, "TRUE", "1", 1, - FALSE, + "", "FALSE", " ", " ", @@ -130,7 +129,7 @@ var_dump( strstr("Hello, worldS", "{$needle}S") ); // works echo "\n*** Testing error conditions ***"; var_dump( strstr($string, "")); -var_dump( strstr("a", "b", "c") ); // args > expected +var_dump( strstr("a", "b", true) ); ?> @@ -225,12 +224,12 @@ string(73) "012033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal abcd$:Hello world" -- Iteration 15 -- -string(72) "12033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal +string(49) "TRUE FALSE%0 abcd\xxyz %00 octal abcd$:Hello world" -- Iteration 16 -- -string(49) "TRUE FALSE%0 abcd\xxyz %00 octal +string(72) "12033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal abcd$:Hello world" @@ -240,52 +239,47 @@ string(72) "12033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal abcd$:Hello world" -- Iteration 18 -- -string(72) "12033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal - -abcd$:Hello world" - --- Iteration 19 -- string(85) "Hello world,012033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal abcd$:Hello world" --- Iteration 20 -- +-- Iteration 19 -- string(44) "FALSE%0 abcd\xxyz %00 octal abcd$:Hello world" --- Iteration 21 -- +-- Iteration 20 -- string(80) " world,012033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal abcd$:Hello world" --- Iteration 22 -- +-- Iteration 21 -- string(59) " NULL TRUE FALSE%0 abcd\xxyz %00 octal abcd$:Hello world" --- Iteration 23 -- +-- Iteration 22 -- string(36) "bcd\xxyz %00 octal abcd$:Hello world" --- Iteration 24 -- +-- Iteration 23 -- bool(false) --- Iteration 25 -- +-- Iteration 24 -- string(19) " abcd$:Hello world" --- Iteration 26 -- +-- Iteration 25 -- string(72) "12033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal abcd$:Hello world" --- Iteration 27 -- +-- Iteration 26 -- bool(false) --- Iteration 28 -- +-- Iteration 27 -- string(85) "Hello world,012033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal abcd$:Hello world" diff --git a/ext/standard/tests/strings/strstr2.phpt b/ext/standard/tests/strings/strstr2.phpt index fadeb10ce30d..dccd65cbc20a 100644 --- a/ext/standard/tests/strings/strstr2.phpt +++ b/ext/standard/tests/strings/strstr2.phpt @@ -21,7 +21,7 @@ var_dump(strstr($email, 'e', 1)); var_dump(strstr($email, 'E')); var_dump(strstr($email, 'E', 1)); -var_dump(strstr('', ' ', '')); +var_dump(strstr('', ' ', false)); ?> --EXPECT-- diff --git a/ext/standard/tests/strings/strtolower.phpt b/ext/standard/tests/strings/strtolower.phpt index 1abe45a8a052..498279ed303b 100644 --- a/ext/standard/tests/strings/strtolower.phpt +++ b/ext/standard/tests/strings/strtolower.phpt @@ -22,8 +22,7 @@ $strings = array ( "1.233.344StrinG12333", "$$$$$$!!!!@@@@@@@ ABCDEF !!!***", "ABCD\0abcdABCD", - TRUE, - FALSE, + "1", /* Check for off-by-one errors in the SSE implementation */ "AAAAAAAAAAAAAAAAAAAA", @@ -334,21 +333,18 @@ string(13) "abcd%0abcdabcd" string(1) "1" -- Iteration 7 -- -string(0) "" - --- Iteration 8 -- string(20) "aaaaaaaaaaaaaaaaaaaa" --- Iteration 9 -- +-- Iteration 8 -- string(20) "zzzzzzzzzzzzzzzzzzzz" --- Iteration 10 -- +-- Iteration 9 -- string(20) "@@@@@@@@@@@@@@@@@@@@" --- Iteration 11 -- +-- Iteration 10 -- string(20) "[[[[[[[[[[[[[[[[[[[[" --- Iteration 12 -- +-- Iteration 11 -- string(62) "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz" *** Testing strtolower() with two different case strings *** diff --git a/ext/standard/tests/strings/strtoupper1.phpt b/ext/standard/tests/strings/strtoupper1.phpt index 220906a5ba53..9bb7888cdcad 100644 --- a/ext/standard/tests/strings/strtoupper1.phpt +++ b/ext/standard/tests/strings/strtoupper1.phpt @@ -21,8 +21,7 @@ $strings = array ( "1.233.344StrinG12333", "$$$$$$!!!!@@@@@@@ ABCDEF !!!***", "ABCD\0abcdABCD", - TRUE, - FALSE, + "1", /* Check for off-by-one errors in the SSE implementation */ "aaaaaaaaaaaaaaaaaaaa", "zzzzzzzzzzzzzzzzzzzz", @@ -338,33 +337,30 @@ string(13) "ABCD%0ABCDABCD" string(1) "1" -- Iteration 7 -- -string(0) "" - --- Iteration 8 -- string(20) "AAAAAAAAAAAAAAAAAAAA" --- Iteration 9 -- +-- Iteration 8 -- string(20) "ZZZZZZZZZZZZZZZZZZZZ" --- Iteration 10 -- +-- Iteration 9 -- string(20) "````````````````````" --- Iteration 11 -- +-- Iteration 10 -- string(20) "{{{{{{{{{{{{{{{{{{{{" --- Iteration 12 -- +-- Iteration 11 -- string(40) "{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{" --- Iteration 13 -- +-- Iteration 12 -- string(31) "ABCDEFGHIJKLMNOPQRSTUVWXYZ01234" --- Iteration 14 -- +-- Iteration 13 -- string(32) "ABCDEFGHIJKLMNOPQRSTUVWXYZ012345" --- Iteration 15 -- +-- Iteration 14 -- string(33) "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456" --- Iteration 16 -- +-- Iteration 15 -- string(62) "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" *** Testing strtoupper() with two different case strings *** diff --git a/ext/standard/tests/strings/strtr_variation4.phpt b/ext/standard/tests/strings/strtr_variation4.phpt index f89ff654a186..639ed99507ba 100644 --- a/ext/standard/tests/strings/strtr_variation4.phpt +++ b/ext/standard/tests/strings/strtr_variation4.phpt @@ -19,8 +19,6 @@ EOD; $str_arr = array( "", '', - FALSE, - false, $heredoc_str ); @@ -56,10 +54,4 @@ string(0) "" -- Iteration 3 -- string(0) "" string(0) "" --- Iteration 4 -- -string(0) "" -string(0) "" --- Iteration 5 -- -string(0) "" -string(0) "" *** Done *** diff --git a/ext/standard/tests/strings/strtr_variation6.phpt b/ext/standard/tests/strings/strtr_variation6.phpt index 90ef75370eb2..81810b863ee0 100644 --- a/ext/standard/tests/strings/strtr_variation6.phpt +++ b/ext/standard/tests/strings/strtr_variation6.phpt @@ -31,18 +31,15 @@ $from_arr = array ( -20.5, 10.1234567e10, - // boolean values -/*7*/ true, - false, - TRUE, - FALSE, + // empty string +/*7*/ "", // null values -/*14*/ NULL, +/*8*/ NULL, null, // objects -/*13*/ new sample(), +/*10*/ new sample(), ); //defining 'to' argument @@ -73,20 +70,14 @@ string(6) "m1tatm" -- Iteration 6 -- string(6) "tm0atm" -- Iteration 7 -- -string(6) "0a2atm" --- Iteration 8 -- string(6) "012atm" --- Iteration 9 -- -string(6) "0a2atm" --- Iteration 10 -- -string(6) "012atm" --- Iteration 11 -- +-- Iteration 8 -- Deprecated: strtr(): Passing null to parameter #2 ($from) of type array|string is deprecated in %s on line %d string(6) "012atm" --- Iteration 12 -- +-- Iteration 9 -- Deprecated: strtr(): Passing null to parameter #2 ($from) of type array|string is deprecated in %s on line %d string(6) "012atm" --- Iteration 13 -- +-- Iteration 10 -- string(6) "012ttm" diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt index a44f1fe18e3a..4693633ca87c 100644 --- a/ext/standard/tests/strings/substr_compare.phpt +++ b/ext/standard/tests/strings/substr_compare.phpt @@ -20,7 +20,7 @@ try { } catch (Throwable $e) { echo $e::class, ': ', $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/trim1.phpt b/ext/standard/tests/strings/trim1.phpt index e0cdbea1c899..68bcdb1f19be 100644 --- a/ext/standard/tests/strings/trim1.phpt +++ b/ext/standard/tests/strings/trim1.phpt @@ -13,7 +13,7 @@ var_dump( trim($null_var) ); /* second argument charlist as empty - does not trim any white spaces */ var_dump( trim("\ttesting trim", "") ); -var_dump( trim("\ttesting trim ", true) ); +var_dump( trim("\ttesting trim ", "1") ); /* Use of class and objects */ echo "\n*** Testing with OBJECTS ***\n"; diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt index 5389579eb2f3..705c963c7531 100644 --- a/ext/standard/tests/strings/ucfirst.phpt +++ b/ext/standard/tests/strings/ucfirst.phpt @@ -24,12 +24,11 @@ $str_array = array( "NULL", "0", 0, - TRUE, // bool type "TRUE", "1", 1, 1.234444, - FALSE, + "", "FALSE", " ", " ", @@ -119,7 +118,6 @@ string(6) "-3.344" string(4) "NULL" string(1) "0" string(1) "0" -string(1) "1" string(4) "TRUE" string(1) "1" string(1) "1" diff --git a/ext/tidy/tests/019.phpt b/ext/tidy/tests/019.phpt index 411719cce25e..65db8781a5fb 100644 --- a/ext/tidy/tests/019.phpt +++ b/ext/tidy/tests/019.phpt @@ -18,7 +18,7 @@ try { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { - tidy_repair_file($s, $s, $s, $s); + tidy_repair_file($s, $s, $s, false); } catch (\ValueError $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } diff --git a/run-tests.php b/run-tests.php index 6a3c2d012201..84582c4c9c50 100755 --- a/run-tests.php +++ b/run-tests.php @@ -897,8 +897,8 @@ function write_information(array $user_tests, $phpdbg): void PHP_VERSION : " , phpversion() , " ZEND_VERSION: " , zend_version() , " PHP_OS : " , PHP_OS , " - " , php_uname() , " -INI actual : " , realpath(get_cfg_var("cfg_file_path")) , " -More .INIs : " , (function_exists(\'php_ini_scanned_files\') ? str_replace("\n","", php_ini_scanned_files()) : "** not determined **"); ?>'; +INI actual : " , (($ini = get_cfg_var("cfg_file_path")) !== false ? realpath($ini) : "(none)") , " +More .INIs : " , (function_exists(\'php_ini_scanned_files\') ? str_replace("\n","", php_ini_scanned_files() ?: "") : "** not determined **"); ?>'; save_text($info_file, $php_info); $info_params = []; settings2array($ini_overwrites, $info_params); diff --git a/sapi/cli/tests/bug61977.phpt b/sapi/cli/tests/bug61977.phpt index e804e0dfce55..8be6e79d88b2 100644 --- a/sapi/cli/tests/bug61977.phpt +++ b/sapi/cli/tests/bug61977.phpt @@ -29,7 +29,7 @@ HEADER; if (fwrite($fp, $header)) { while (!feof($fp)) { $text = fgets($fp); - if (strncasecmp("Content-type:", $text, 13) == 0) { + if ($text !== false && strncasecmp("Content-type:", $text, 13) == 0) { echo "foo.{$mimetype} => ", $text; } } diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt index 651f21f79417..71e84e2cb230 100644 --- a/sapi/cli/tests/upload_2G.phpt +++ b/sapi/cli/tests/upload_2G.phpt @@ -18,8 +18,8 @@ if (!file_exists('/proc/meminfo')) { $free_ram = 0; if ($f = fopen("/proc/meminfo","r")) { - while (!feof($f)) { - if (preg_match('/MemFree[^\d]*(\d+)/i', fgets($f), $m)) { + while (($line = fgets($f)) !== false) { + if (preg_match('/MemFree[^\d]*(\d+)/i', $line, $m)) { $free_ram = max($free_ram, $m[1]/1024/1024); if ($free_ram > 3) { $enough_free_ram = true; diff --git a/sapi/fpm/tests/logreader.inc b/sapi/fpm/tests/logreader.inc index 8d742d0bba64..a7123a46ffef 100644 --- a/sapi/fpm/tests/logreader.inc +++ b/sapi/fpm/tests/logreader.inc @@ -285,7 +285,10 @@ class LogStreamSource extends LogSource $write = null; $except = null; if (stream_select($read, $write, $except, $timeoutSeconds, $timeoutMicroseconds)) { - $line = fgets($this->stream); + $line = fgets($this->stream); + if ($line === false) { + return null; + } $this->lines[] = $line; return $line; diff --git a/tests/classes/iterators_008.phpt b/tests/classes/iterators_008.phpt index 679bcc384b29..f39259588a53 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 $this->counter > 0; } public function next(): void { diff --git a/tests/output/bug46897.phpt b/tests/output/bug46897.phpt index 0e77938e4752..5f154a28bb6e 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 658bee21633f..ad3ed36f8746 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 1afe3efbc56e..b1d45c8eeb36 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 b3b76da6503c..4073b9d7e156 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 442462462cd4..411c09a661c6 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 7f99b72dd1c5..0155afb42307 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());