diff --git a/Zend/tests/scalar_to_bool/explicit_casts_should_not_warn.phpt b/Zend/tests/scalar_to_bool/explicit_casts_should_not_warn.phpt new file mode 100644 index 0000000000000..65cbaf5637044 --- /dev/null +++ b/Zend/tests/scalar_to_bool/explicit_casts_should_not_warn.phpt @@ -0,0 +1,28 @@ +--TEST-- +Explicit (bool) cast must not warn +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/Zend/tests/scalar_to_bool/no_warning_compatible_float.phpt b/Zend/tests/scalar_to_bool/no_warning_compatible_float.phpt new file mode 100644 index 0000000000000..1eb64eca6751e --- /dev/null +++ b/Zend/tests/scalar_to_bool/no_warning_compatible_float.phpt @@ -0,0 +1,38 @@ +--TEST-- +Compatible float to bool conversions with values 0 or 1 +--FILE-- +a = -0.0; +var_dump($instance->a); + +?> +--EXPECTF-- +Function calls: +bool(true) +bool(false) +bool(false) +Function returns: +bool(false) +Typed property assignment: +bool(false) diff --git a/Zend/tests/scalar_to_bool/no_warning_compatible_int.phpt b/Zend/tests/scalar_to_bool/no_warning_compatible_int.phpt new file mode 100644 index 0000000000000..82d4339aeaa39 --- /dev/null +++ b/Zend/tests/scalar_to_bool/no_warning_compatible_int.phpt @@ -0,0 +1,38 @@ +--TEST-- +Compatible int to bool conversions with values 0 or 1 +--FILE-- +a = 1; +var_dump($instance->a); + +?> +--EXPECTF-- +Function calls: +bool(true) +bool(false) +bool(false) +Function returns: +bool(false) +Typed property assignment: +bool(true) diff --git a/Zend/tests/scalar_to_bool/no_warning_compatible_string.phpt b/Zend/tests/scalar_to_bool/no_warning_compatible_string.phpt new file mode 100644 index 0000000000000..d4356d2899f56 --- /dev/null +++ b/Zend/tests/scalar_to_bool/no_warning_compatible_string.phpt @@ -0,0 +1,38 @@ +--TEST-- +Compatible string to bool conversions with values "", "0" or "1" +--FILE-- +a = "1"; +var_dump($instance->a); + +?> +--EXPECTF-- +Function calls: +bool(false) +bool(true) +bool(false) +Function returns: +bool(false) +Typed property assignment: +bool(true) diff --git a/Zend/tests/scalar_to_bool/warnings_float_non_zero_or_one.phpt b/Zend/tests/scalar_to_bool/warnings_float_non_zero_or_one.phpt new file mode 100644 index 0000000000000..85495ed171b3d --- /dev/null +++ b/Zend/tests/scalar_to_bool/warnings_float_non_zero_or_one.phpt @@ -0,0 +1,40 @@ +--TEST-- +Implicit float to bool conversions with values other than 0 or 1 should warn for variables +--FILE-- +a = 13.0; +var_dump($instance->a); + +?> +--EXPECTF-- +Function calls: + +Deprecated: Implicit conversion from float 1.1 to true, only 0 or 1 are allowed in %s on line %d +bool(true) +Function returns: + +Deprecated: Implicit conversion from float -0.3 to true, only 0 or 1 are allowed in %s on line %d +bool(true) +Typed property assignment: + +Deprecated: Implicit conversion from float 13 to true, only 0 or 1 are allowed in %s on line %d +bool(true) diff --git a/Zend/tests/scalar_to_bool/warnings_int_non_zero_or_one.phpt b/Zend/tests/scalar_to_bool/warnings_int_non_zero_or_one.phpt new file mode 100644 index 0000000000000..7db0468be63bb --- /dev/null +++ b/Zend/tests/scalar_to_bool/warnings_int_non_zero_or_one.phpt @@ -0,0 +1,40 @@ +--TEST-- +Implicit int to bool conversions with values other than 0 or 1 should warn for variables +--FILE-- +a = 13; +var_dump($instance->a); + +?> +--EXPECTF-- +Function calls: + +Deprecated: Implicit conversion from int 5 to true, only 0 or 1 are allowed in %s on line %d +bool(true) +Function returns: + +Deprecated: Implicit conversion from int 3 to true, only 0 or 1 are allowed in %s on line %d +bool(true) +Typed property assignment: + +Deprecated: Implicit conversion from int 13 to true, only 0 or 1 are allowed in %s on line %d +bool(true) diff --git a/Zend/tests/scalar_to_bool/warnings_string_non_zero_or_one.phpt b/Zend/tests/scalar_to_bool/warnings_string_non_zero_or_one.phpt new file mode 100644 index 0000000000000..edb2d94690be3 --- /dev/null +++ b/Zend/tests/scalar_to_bool/warnings_string_non_zero_or_one.phpt @@ -0,0 +1,40 @@ +--TEST-- +Implicit string to bool conversions with values other than empty string, "0" or "1" should warn for variables +--FILE-- +a = "0.0"; +var_dump($instance->a); + +?> +--EXPECTF-- +Function calls: + +Deprecated: Implicit conversion from string "on" to true, only "", "0" or "1" are allowed in %s on line %d +bool(true) +Function returns: + +Deprecated: Implicit conversion from string "inactive" to true, only "", "0" or "1" are allowed in %s on line %d +bool(true) +Typed property assignment: + +Deprecated: Implicit conversion from string "0.0" to true, only "", "0" or "1" are allowed 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 c69d17c8c7004..9498eee275714 100644 --- a/Zend/tests/type_declarations/scalar_basic.phpt +++ b/Zend/tests/type_declarations/scalar_basic.phpt @@ -232,21 +232,26 @@ bool(true) bool(true) *** Trying float(1.5) +E_DEPRECATED: Implicit conversion from float 1.5 to true, only 0 or 1 are allowed on line %d bool(true) *** Trying string(2) "1a" +E_DEPRECATED: Implicit conversion from string "1a" to true, only "", "0" or "1" are allowed on line %d bool(true) *** Trying string(1) "a" +E_DEPRECATED: Implicit conversion from string "a" to true, only "", "0" or "1" are allowed on line %d bool(true) *** Trying string(0) "" bool(false) *** Trying int(%d) +E_DEPRECATED: Implicit conversion from int %d to true, only 0 or 1 are allowed on line %d bool(true) *** Trying float(NAN) +E_DEPRECATED: Implicit conversion from float NAN to true, only 0 or 1 are allowed on line %d bool(true) *** Trying bool(true) diff --git a/Zend/tests/type_declarations/scalar_return_basic.phpt b/Zend/tests/type_declarations/scalar_return_basic.phpt index 0cdce348c580c..3c1d4df43bf99 100644 --- a/Zend/tests/type_declarations/scalar_return_basic.phpt +++ b/Zend/tests/type_declarations/scalar_return_basic.phpt @@ -183,16 +183,21 @@ bool(true) *** Trying float(1) bool(true) *** Trying float(1.5) +E_DEPRECATED: Implicit conversion from float 1.5 to true, only 0 or 1 are allowed on line %d bool(true) *** Trying string(2) "1a" +E_DEPRECATED: Implicit conversion from string "1a" to true, only "", "0" or "1" are allowed on line %d bool(true) *** Trying string(1) "a" +E_DEPRECATED: Implicit conversion from string "a" to true, only "", "0" or "1" are allowed on line %d bool(true) *** Trying string(0) "" bool(false) *** Trying int(2147483647) +E_DEPRECATED: Implicit conversion from int 2147483647 to true, only 0 or 1 are allowed on line %d bool(true) *** Trying float(NAN) +E_DEPRECATED: Implicit conversion from float NAN to true, only 0 or 1 are allowed on line %d bool(true) *** Trying bool(true) 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 644ff58299440..f34c841937c91 100644 --- a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt +++ b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt @@ -183,16 +183,21 @@ bool(true) *** Trying float(1) bool(true) *** Trying float(1.5) +E_DEPRECATED: Implicit conversion from float 1.5 to true, only 0 or 1 are allowed on line %d bool(true) *** Trying string(2) "1a" +E_DEPRECATED: Implicit conversion from string "1a" to true, only "", "0" or "1" are allowed on line %d bool(true) *** Trying string(1) "a" +E_DEPRECATED: Implicit conversion from string "a" to true, only "", "0" or "1" are allowed on line %d bool(true) *** Trying string(0) "" bool(false) *** Trying int(9223372036854775807) +E_DEPRECATED: Implicit conversion from int 9223372036854775807 to true, only 0 or 1 are allowed on line %d bool(true) *** Trying float(NAN) +E_DEPRECATED: Implicit conversion from float NAN to true, only 0 or 1 are allowed on line %d bool(true) *** Trying bool(true) 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 351a3e9e78ede..838e4374375d8 100644 --- a/Zend/tests/type_declarations/union_types/type_checking_weak.phpt +++ b/Zend/tests/type_declarations/union_types/type_checking_weak.phpt @@ -98,8 +98,8 @@ Type int|float|bool: INF => INF "42" => 42 "42.0" => 42.0 -"42x" => true -"x" => true +"42x" => true (Implicit conversion from string "42x" to true, only "", "0" or "1" are allowed) +"x" => true (Implicit conversion from string "x" to true, only "", "0" or "1" are allowed) "" => false true => true false => false @@ -111,11 +111,11 @@ new WithToString => Argument ... must be of type int|float|bool, WithToString gi Type int|bool: 42 => 42 42.0 => 42 -INF => true +INF => true (Implicit conversion from float INF to true, only 0 or 1 are allowed) "42" => 42 "42.0" => 42 -"42x" => true -"x" => true +"42x" => true (Implicit conversion from string "42x" to true, only "", "0" or "1" are allowed) +"x" => true (Implicit conversion from string "x" to true, only "", "0" or "1" are allowed) "" => false true => true false => false @@ -189,13 +189,13 @@ new stdClass => Argument ... 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 +42 => true (Implicit conversion from int 42 to true, only 0 or 1 are allowed) +42.0 => true (Implicit conversion from float 42 to true, only 0 or 1 are allowed) +INF => true (Implicit conversion from float INF to true, only 0 or 1 are allowed) +"42" => true (Implicit conversion from string "42" to true, only "", "0" or "1" are allowed) +"42.0" => true (Implicit conversion from string "42.0" to true, only "", "0" or "1" are allowed) +"42x" => true (Implicit conversion from string "42x" to true, only "", "0" or "1" are allowed) +"x" => true (Implicit conversion from string "x" to true, only "", "0" or "1" are allowed) "" => false true => true false => false diff --git a/Zend/zend_API.c b/Zend/zend_API.c index bfcbe2e5f3e17..dad6faa9c41b2 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -473,6 +473,16 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, bool *dest, uint if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("bool", arg_num)) { return 0; } + if (UNEXPECTED(!zend_scalar_is_valid_bool(arg))) { + /* Check arg_num is not (uint32_t)-1, as otherwise its called by + * zend_verify_weak_scalar_type_hint_no_sideeffect() */ + if (arg_num != (uint32_t)-1) { + zend_incompatible_scalar_to_bool_error(arg); + } + if (UNEXPECTED(EG(exception))) { + return 0; + } + } *dest = zend_is_true(arg); } else { return 0; diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 8a0cc8131be44..6e304230d3732 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -836,6 +836,17 @@ ZEND_API void ZEND_COLD zend_incompatible_string_to_long_error(const zend_string zend_error(E_DEPRECATED, "Implicit conversion from float-string \"%s\" to int loses precision", ZSTR_VAL(s)); } +ZEND_API void ZEND_COLD zend_incompatible_scalar_to_bool_error(zval *arg) +{ + if (Z_TYPE_P(arg) == IS_DOUBLE) { + zend_error_unchecked(E_DEPRECATED, "Implicit conversion from float %.*H to true, only 0 or 1 are allowed", -1, Z_DVAL_P(arg)); + } else if (Z_TYPE_P(arg) == IS_LONG) { + zend_error(E_DEPRECATED, "Implicit conversion from int %ld to true, only 0 or 1 are allowed", (long)Z_LVAL_P(arg)); + } else if (Z_TYPE_P(arg) == IS_STRING) { + zend_error(E_DEPRECATED, "Implicit conversion from string \"%s\" to true, only \"\", \"0\" or \"1\" are allowed", ZSTR_VAL(Z_STR_P(arg))); + } +} + ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(zval *op, bool is_strict) /* {{{ */ { try_again: diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 346706d22beae..ecccaed6da6b8 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -138,9 +138,36 @@ static zend_always_inline bool zend_is_long_compatible(double d, zend_long l) { return (double)l == d; } +static zend_always_inline bool zend_scalar_is_valid_bool(zval *arg) { + switch (Z_TYPE_P(arg)) { + case IS_TRUE: + case IS_FALSE: + return true; + break; + case IS_LONG: + if (Z_LVAL_P(arg) == 0 || Z_LVAL_P(arg) == 1) { + return true; + } + break; + case IS_DOUBLE: + if (Z_DVAL_P(arg) == 0.0 || Z_DVAL_P(arg) == 1.0) { + return true; + } + break; + case IS_STRING: + if (Z_STRLEN_P(arg) == 0 || (Z_STRLEN_P(arg) == 1 && (Z_STRVAL_P(arg)[0] == '0' || Z_STRVAL_P(arg)[0] == '1'))) { + return true; + } + break; + } + return false; +} + ZEND_API void zend_incompatible_double_to_long_error(double d); ZEND_API void zend_incompatible_string_to_long_error(const zend_string *s); +ZEND_API void zend_incompatible_scalar_to_bool_error(zval *arg); + static zend_always_inline zend_long zend_dval_to_lval_safe(double d) { zend_long l = zend_dval_to_lval(d); diff --git a/ext/gd/tests/imageantialias_error2.phpt b/ext/gd/tests/imageantialias_error2.phpt deleted file mode 100644 index 40f4d64a12b6e..0000000000000 --- 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/gmp/tests/gmp_setbit.phpt b/ext/gmp/tests/gmp_setbit.phpt index b00393faf97b4..e0a181baa9fdc 100644 --- a/ext/gmp/tests/gmp_setbit.phpt +++ b/ext/gmp/tests/gmp_setbit.phpt @@ -6,27 +6,27 @@ gmp getMessage() . \PHP_EOL; } var_dump(gmp_strval($n)); $n = gmp_init(5); -gmp_setbit($n, 2, 0); +gmp_setbit($n, 2, false); var_dump(gmp_strval($n)); $n = gmp_init(5); -gmp_setbit($n, 1, 1); +gmp_setbit($n, 1, true); var_dump(gmp_strval($n)); $n = gmp_init("100000000000"); -gmp_setbit($n, 23, 1); +gmp_setbit($n, 23, true); var_dump(gmp_strval($n)); gmp_setbit($n, 23, 0); diff --git a/ext/imap/tests/imap_bodystruct_basic.phpt b/ext/imap/tests/imap_bodystruct_basic.phpt index 84a6edc7e37a4..3c98bed23ec7c 100644 --- a/ext/imap/tests/imap_bodystruct_basic.phpt +++ b/ext/imap/tests/imap_bodystruct_basic.phpt @@ -12,7 +12,7 @@ echo "*** Testing string imap_bodystruct : basic functionality ***\n"; require_once(__DIR__.'/setup/imap_include.inc'); echo "Create a new mailbox for test and add a multipart msgs\n"; -$imap_stream = setup_test_mailbox("imapbodystructbasic", 1, $mailbox, "multipart"); +$imap_stream = setup_test_mailbox("imapbodystructbasic", 1, $mailbox, true); echo "\nGet and validate structure of body part 1\n"; diff --git a/ext/intl/tests/rbbiter___construct_basic.phpt b/ext/intl/tests/rbbiter___construct_basic.phpt index 6d2361f667b32..572f1ef03f8b2 100644 --- a/ext/intl/tests/rbbiter___construct_basic.phpt +++ b/ext/intl/tests/rbbiter___construct_basic.phpt @@ -23,7 +23,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->getMessage(), "\n"; } diff --git a/ext/mysqli/tests/write_property.phpt b/ext/mysqli/tests/write_property.phpt index e54f7387281c0..678029cdecfa0 100644 --- a/ext/mysqli/tests/write_property.phpt +++ b/ext/mysqli/tests/write_property.phpt @@ -15,9 +15,7 @@ try { $driver->reconnect = 0; var_dump($driver->reconnect); -$str = '4'; -$str .= '2'; -$driver->reconnect = $str; +$driver->reconnect = 1; var_dump($driver->reconnect); try { $driver->reconnect = []; diff --git a/ext/phar/tests/phar_buildfromiterator4.phpt b/ext/phar/tests/phar_buildfromiterator4.phpt index e7bccc27c956e..a412b2a2938b1 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 4e4f09f74aa7a..2b9de5156d91c 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 646bcdac2a5c9..cd4b980fd3471 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 8fa55768b082f..c15e40127074c 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 918203697998f..fd265d9b067d7 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 297b40b5eedda..d480d42d6b4a6 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 8c1096754bf25..690cb2c092722 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 9d9140bc3433a..fb8ffe4d785fe 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 f62be404a1e08..a5e48617d2c14 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/snmp/tests/snmp-object-properties.phpt b/ext/snmp/tests/snmp-object-properties.phpt index a8fccd406b7e3..45ab73900dd5f 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/standard/tests/misc/get_browser_error.phpt b/ext/standard/tests/misc/get_browser_error.phpt index f1d645b0263fd..f296ee063d68e 100644 --- a/ext/standard/tests/misc/get_browser_error.phpt +++ b/ext/standard/tests/misc/get_browser_error.phpt @@ -88,5 +88,7 @@ array(34) { string(1) "0" } +Deprecated: Implicit conversion from string "foobar" to true, only "", "0" or "1" are allowed in %s on line %d + Warning: get_browser(): HTTP_USER_AGENT variable is not set, cannot determine user agent name in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt index 0d4065b54fb2b..87880b3ea9bd5 100644 --- a/ext/standard/tests/strings/strstr.phpt +++ b/ext/standard/tests/strings/strstr.phpt @@ -353,6 +353,8 @@ abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789" + +Deprecated: Implicit conversion from string "c" to true, only "", "0" or "1" are allowed in %s on line %d bool(false) DONE diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt index 51d093a65fa22..21fd57c006ca7 100644 --- a/ext/standard/tests/strings/substr_compare.phpt +++ b/ext/standard/tests/strings/substr_compare.phpt @@ -20,7 +20,7 @@ try { } catch (\ValueError $e) { echo $e->getMessage() . "\n"; } -var_dump(substr_compare("abcde", "abc", -1, NULL, -5) > 0); +var_dump(substr_compare("abcde", "abc", -1, NULL) > 0); ?> --EXPECT-- bool(true) diff --git a/run-tests.php b/run-tests.php index 8b4061e1c84b8..d7b6a9a0310b6 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1150,7 +1150,7 @@ function test_sort($a, $b): int // Send Email to QA Team // -function mail_qa_team(string $data, bool $status = false): bool +function mail_qa_team(string $data, string $status = 'failed'): bool { $url_bits = parse_url(QA_SUBMISSION_PAGE); diff --git a/tests/classes/iterators_008.phpt b/tests/classes/iterators_008.phpt index 679bcc384b291..f39259588a535 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 {