diff --git a/UPGRADING b/UPGRADING
index fcff11aabf0b..e25fb6f2fb9f 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -133,6 +133,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..955dcc703848 100644
--- a/Zend/tests/backtrace/debug_backtrace_options.phpt
+++ b/Zend/tests/backtrace/debug_backtrace_options.phpt
@@ -16,10 +16,6 @@ function doit($a, $b, $how)
{
echo "==default\n";
$how();
- echo "==true\n";
- $how(true);
- echo "==false\n";
- $how(false);
echo "==DEBUG_BACKTRACE_PROVIDE_OBJECT\n";
$how(DEBUG_BACKTRACE_PROVIDE_OBJECT);
echo "==DEBUG_BACKTRACE_IGNORE_ARGS\n";
@@ -48,14 +44,6 @@ foo::statCall("doit", "backtrace_print");
#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
#2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
-==true
-#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
-#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
-#2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
-==false
-#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
-#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
-#2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
==DEBUG_BACKTRACE_PROVIDE_OBJECT
#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
@@ -130,130 +118,6 @@ Array
)
-)
-==true
-Array
-(
- [0] => Array
- (
- [file] => %sdebug_backtrace_options.php
- [line] => 17
- [function] => backtrace_print
- [args] => Array
- (
- [0] => 1
- )
-
- )
-
- [1] => Array
- (
- [file] => %sdebug_backtrace_options.php
- [line] => %d
- [function] => doit
- [args] => Array
- (
- [0] => a
- [1] => b
- [2] => backtrace_print
- )
-
- )
-
- [2] => Array
- (
- [file] => %sdebug_backtrace_options.php
- [line] => %d
- [function] => doCall
- [class] => foo
- [object] => foo Object
- (
- )
-
- [type] => ->
- [args] => Array
- (
- [0] => doit
- [1] => backtrace_print
- )
-
- )
-
- [3] => Array
- (
- [file] => %sdebug_backtrace_options.php
- [line] => %d
- [function] => statCall
- [class] => foo
- [type] => ::
- [args] => Array
- (
- [0] => doit
- [1] => backtrace_print
- )
-
- )
-
-)
-==false
-Array
-(
- [0] => Array
- (
- [file] => %sdebug_backtrace_options.php
- [line] => 19
- [function] => backtrace_print
- [args] => Array
- (
- [0] =>
- )
-
- )
-
- [1] => Array
- (
- [file] => %sdebug_backtrace_options.php
- [line] => %d
- [function] => doit
- [args] => Array
- (
- [0] => a
- [1] => b
- [2] => backtrace_print
- )
-
- )
-
- [2] => Array
- (
- [file] => %sdebug_backtrace_options.php
- [line] => %d
- [function] => doCall
- [class] => foo
- [type] => ->
- [args] => Array
- (
- [0] => doit
- [1] => backtrace_print
- )
-
- )
-
- [3] => Array
- (
- [file] => %sdebug_backtrace_options.php
- [line] => %d
- [function] => statCall
- [class] => foo
- [type] => ::
- [args] => Array
- (
- [0] => doit
- [1] => backtrace_print
- )
-
- )
-
)
==DEBUG_BACKTRACE_PROVIDE_OBJECT
Array
@@ -261,7 +125,7 @@ Array
[0] => Array
(
[file] => %sdebug_backtrace_options.php
- [line] => 21
+ [line] => 17
[function] => backtrace_print
[args] => Array
(
@@ -325,7 +189,7 @@ Array
[0] => Array
(
[file] => %sdebug_backtrace_options.php
- [line] => 23
+ [line] => 19
[function] => backtrace_print
)
@@ -361,7 +225,7 @@ Array
[0] => Array
(
[file] => %sdebug_backtrace_options.php
- [line] => 25
+ [line] => 21
[function] => backtrace_print
)
diff --git a/Zend/tests/builtin_functions/builtin_functions_basic.phpt b/Zend/tests/builtin_functions/builtin_functions_basic.phpt
index 619365cbce17..1c4407c69ef6 100644
--- a/Zend/tests/builtin_functions/builtin_functions_basic.phpt
+++ b/Zend/tests/builtin_functions/builtin_functions_basic.phpt
@@ -28,7 +28,6 @@ var_dump(count(get_defined_functions()));
var_dump(gettype(get_declared_interfaces()));
var_dump(count(get_declared_interfaces()));
-var_dump(get_extension_funcs(true));
var_dump(gettype(get_extension_funcs("standard")));
var_dump(count(get_extension_funcs("standard")));
var_dump(gettype(get_extension_funcs("zend")));
@@ -51,7 +50,6 @@ string(5) "array"
int(%d)
string(5) "array"
int(%d)
-bool(false)
string(5) "array"
int(%d)
string(5) "array"
diff --git a/Zend/tests/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..c9561bd694ee 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 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)
diff --git a/Zend/tests/type_declarations/scalar_return_basic.phpt b/Zend/tests/type_declarations/scalar_return_basic.phpt
index 67af304ec2c6..cb8f351d17b4 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 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/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/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 0758ed6a5cf8..9d50dcf53236 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/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/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--
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/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..d8875dc0b224 100644
--- a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt
+++ b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt
@@ -13,30 +13,12 @@ class TestClass
}
-try {
- echo "\nWrong type of argument (bool):\n";
- $methodInfo = new ReflectionMethod(true);
-} catch (Exception $e) {
- print $e->__toString();
-}
try {
echo "\nWrong type of argument (int):\n";
$methodInfo = new ReflectionMethod(3);
} catch (Exception $e) {
print $e->__toString();
}
-try {
- echo "\nWrong type of argument (bool, string):\n";
- $methodInfo = new ReflectionMethod(true, "foo");
-} catch (Exception $e) {
- print $e->__toString();
-}
-try {
- echo "\nWrong type of argument (string, bool):\n";
- $methodInfo = new ReflectionMethod('TestClass', true);
-} catch (Exception $e) {
- print $e->__toString();
-}
try {
echo "\nNo method given:\n";
$methodInfo = new ReflectionMethod("TestClass");
@@ -64,13 +46,6 @@ try {
?>
--EXPECTF--
-Wrong type of argument (bool):
-
-Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
-ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name in %s:%d
-Stack trace:
-#0 %s ReflectionMethod->__construct('1')
-#1 {main}
Wrong type of argument (int):
Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
@@ -78,16 +53,6 @@ ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMeth
Stack trace:
#0 %s ReflectionMethod->__construct('3')
#1 {main}
-Wrong type of argument (bool, string):
-ReflectionException: Class "1" does not exist in %s:%d
-Stack trace:
-#0 %s ReflectionMethod->__construct('1', 'foo')
-#1 {main}
-Wrong type of argument (string, bool):
-ReflectionException: Method TestClass::1() does not exist in %s:%d
-Stack trace:
-#0 %s ReflectionMethod->__construct('TestClass', '1')
-#1 {main}
No method given:
Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
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/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,
"\"\"" => "",
"\" \"" => " ",
"\\0" => "\0",
@@ -49,14 +47,6 @@ 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 --
-
-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..e07984ce7d1d 100644
--- a/ext/standard/tests/file/file_get_contents_variation8.phpt
+++ b/ext/standard/tests/file/file_get_contents_variation8.phpt
@@ -17,8 +17,6 @@ echo "*** Testing file_get_contents() : variation ***\n";
$names_arr = array(
/* Invalid args */
-1,
- TRUE,
- FALSE,
"",
" ",
"\0",
@@ -48,26 +46,20 @@ echo "\n*** Done ***\n";
Warning: file_get_contents(): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 1 --
-
-Warning: file_get_contents(): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
--- Iteration 2 --
ValueError: Path must not be empty
--- Iteration 3 --
-ValueError: Path must not be empty
--- Iteration 4 --
+-- Iteration 2 --
Warning: file_get_contents(): Failed to open stream: No such file or directory in %s on line %d
bool(false)
--- Iteration 5 --
+-- Iteration 3 --
ValueError: file_get_contents(): Argument #1 ($filename) must not contain any null bytes
--- Iteration 6 --
+-- Iteration 4 --
TypeError: file_get_contents(): Argument #1 ($filename) must be of type string, array given
--- Iteration 7 --
+-- Iteration 5 --
Warning: file_get_contents(): Failed to open stream: No such file or directory in %s on line %d
bool(false)
--- Iteration 8 --
+-- Iteration 6 --
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..2cd3fd2b71db 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,6 @@ echo "*** Testing file_put_contents() : usage variation ***\n";
/* An array of filenames */
$names_arr = array(
"-1" => -1,
- "TRUE" => TRUE,
- "FALSE" => FALSE,
"\"\"" => "",
"\" \"" => " ",
"\\0" => "\0",
@@ -51,12 +49,6 @@ foreach($names_arr as $key =>$value) {
-- Filename: -1 --
9 bytes written to: '-1'
--- Filename: TRUE --
-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..ef424b804ebe 100644
--- a/ext/standard/tests/file/file_put_contents_variation8.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation8.phpt
@@ -20,8 +20,6 @@ chdir($dir);
/* An array of filenames */
$names_arr = array(
-1,
- TRUE,
- FALSE,
"",
" ",
//this one also generates a java message rather than our own so we don't replicate php message
@@ -62,22 +60,18 @@ rmdir($dir);
-- Iteration 0 --
9 bytes written to: '-1'
-- Iteration 1 --
-9 bytes written to: '1'
--- Iteration 2 --
-ValueError: Path must not be empty
--- Iteration 3 --
ValueError: Path must not be empty
--- Iteration 4 --
+-- Iteration 2 --
9 bytes written to: ' '
--- Iteration 5 --
+-- Iteration 3 --
ValueError: file_put_contents(): Argument #1 ($filename) must not contain any null bytes
--- Iteration 6 --
+-- Iteration 4 --
TypeError: file_put_contents(): Argument #1 ($filename) must be of type string, array given
--- Iteration 7 --
+-- Iteration 5 --
Warning: file_put_contents(): Failed to open stream: %s in %s on line %d
Failed to write data to: '%sir'
--- Iteration 8 --
+-- Iteration 6 --
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..7a2994e36ff5 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--
@@ -37,7 +35,5 @@ bool(false)
*** Testing fnmatch() with other than file ***
bool(true)
bool(true)
-bool(true)
-bool(true)
*** Done ***
diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt
index 8f1e92eb5d1c..d765a37d78df 100644
--- a/ext/standard/tests/file/fnmatch_variation.phpt
+++ b/ext/standard/tests/file/fnmatch_variation.phpt
@@ -111,20 +111,6 @@ $str_arr = array(
);
match_($str_arr, $str_arr);
-echo "\n--- With booleans ---\n";
-$bool_arr = array(
- TRUE,
- true,
- 1,
- 10,
- FALSE,
- false,
- 0,
- "",
- "string"
-);
-match_($bool_arr, $bool_arr);
-
echo "\n--- With NULL ---\n";
$null_arr = array(
"",
@@ -302,98 +288,6 @@ ValueError: fnmatch(): Argument #2 ($filename) must not contain any null bytes
bool(false)
bool(true)
---- With booleans ---
--- Iteration 0 --
-bool(true)
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
--- Iteration 1 --
-bool(true)
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
--- Iteration 2 --
-bool(true)
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
--- Iteration 3 --
-bool(false)
-bool(false)
-bool(false)
-bool(true)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
--- Iteration 4 --
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(true)
-bool(true)
-bool(false)
-bool(true)
-bool(false)
--- Iteration 5 --
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(true)
-bool(true)
-bool(false)
-bool(true)
-bool(false)
--- Iteration 6 --
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(true)
-bool(false)
-bool(false)
--- Iteration 7 --
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(true)
-bool(true)
-bool(false)
-bool(true)
-bool(false)
--- Iteration 8 --
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(true)
-
--- With NULL ---
-- Iteration 0 --
bool(true)
diff --git a/ext/standard/tests/file/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..0e9b3aaabc24 100644
--- a/ext/standard/tests/file/glob_variation-win32-mb.phpt
+++ b/ext/standard/tests/file/glob_variation-win32-mb.phpt
@@ -35,7 +35,6 @@ $patterns = array (
'$file_path/glob_variation私はガラスを食べられます/wonder5',
"$file_path/glob_variation私はガラスを食べられます/?wonder?",
"$file_path/glob_variation私はガラスを食べられます/wonder?",
- TRUE // boolean true
);
$counter = 1;
/* loop through $patterns to match each $pattern with the files created
@@ -380,22 +379,6 @@ array(0) {
array(0) {
}
--- Iteration 12 --
-array(0) {
-}
-array(0) {
-}
-array(0) {
-}
-array(1) {
- [0]=>
- string(%d) "1"
-}
-array(0) {
-}
-array(0) {
-}
-
*** Testing glob() with pattern within braces ***
array(1) {
[0]=>
@@ -445,7 +428,4 @@ array(1) {
[0]=>
string(%d) "%s/glob_variation私はガラスを食べられます/wonder1"
}
--- Iteration 12 --
-array(0) {
-}
Done
diff --git a/ext/standard/tests/file/glob_variation-win32.phpt b/ext/standard/tests/file/glob_variation-win32.phpt
index 74a1c3e5c7e4..56a9797c9178 100644
--- a/ext/standard/tests/file/glob_variation-win32.phpt
+++ b/ext/standard/tests/file/glob_variation-win32.phpt
@@ -34,7 +34,6 @@ $patterns = array (
'$file_path/glob_variation/wonder5',
"$file_path/glob_variation/?wonder?",
"$file_path/glob_variation/wonder?",
- TRUE // boolean true
);
$counter = 1;
/* loop through $patterns to match each $pattern with the files created
@@ -379,22 +378,6 @@ array(0) {
array(0) {
}
--- Iteration 12 --
-array(0) {
-}
-array(0) {
-}
-array(0) {
-}
-array(1) {
- [0]=>
- string(%d) "1"
-}
-array(0) {
-}
-array(0) {
-}
-
*** Testing glob() with pattern within braces ***
array(1) {
[0]=>
@@ -444,7 +427,4 @@ array(1) {
[0]=>
string(%d) "%s/glob_variation/wonder1"
}
--- Iteration 12 --
-array(0) {
-}
Done
diff --git a/ext/standard/tests/file/glob_variation.phpt b/ext/standard/tests/file/glob_variation.phpt
index b36793d3f3e0..adc9fc77c066 100644
--- a/ext/standard/tests/file/glob_variation.phpt
+++ b/ext/standard/tests/file/glob_variation.phpt
@@ -37,7 +37,6 @@ $patterns = array (
'$file_path/glob_variation/wonder5',
"$file_path/glob_variation/?wonder?",
"$file_path/glob_variation/wonder?",
- TRUE // boolean true
);
$counter = 1;
/* loop through $patterns to match each $pattern with the files created
@@ -382,22 +381,6 @@ array(0) {
array(0) {
}
--- Iteration 12 --
-array(0) {
-}
-array(0) {
-}
-array(0) {
-}
-array(1) {
- [0]=>
- string(%d) "1"
-}
-array(0) {
-}
-array(0) {
-}
-
*** Testing glob() with pattern within braces ***
array(1) {
[0]=>
@@ -447,7 +430,4 @@ array(1) {
[0]=>
string(%d) "%s/glob_variation/wonder1"
}
--- Iteration 12 --
-array(0) {
-}
Done
diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt
index 730a2bcfea4d..be0d982284d6 100644
--- a/ext/standard/tests/file/is_dir_variation3.phpt
+++ b/ext/standard/tests/file/is_dir_variation3.phpt
@@ -10,8 +10,6 @@ echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n";
$dirnames = array(
/* Invalid dirnames */
-2.34555,
- TRUE,
- FALSE,
" ",
/* scalars */
@@ -30,5 +28,3 @@ bool(false)
bool(false)
bool(false)
bool(false)
-bool(false)
-bool(false)
diff --git a/ext/standard/tests/file/pathinfo_variaton.phpt b/ext/standard/tests/file/pathinfo_variaton.phpt
index 04e1f15c6935..bfe0abbe0897 100644
--- a/ext/standard/tests/file/pathinfo_variaton.phpt
+++ b/ext/standard/tests/file/pathinfo_variaton.phpt
@@ -28,10 +28,6 @@ $paths = array (
-1234,
2.3456,
- /* pathname as boolean */
- TRUE,
- FALSE,
-
/* pathname as an array */
"./array(1, 2)",
"array( array(), null)",
@@ -130,30 +126,6 @@ string(6) "2.3456"
string(4) "3456"
string(1) "2"
-- Iteration 5 --
-array(3) {
- ["dirname"]=>
- string(1) "."
- ["basename"]=>
- string(1) "1"
- ["filename"]=>
- string(1) "1"
-}
-string(1) "."
-string(1) "1"
-string(0) ""
-string(1) "1"
--- Iteration 6 --
-array(2) {
- ["basename"]=>
- string(0) ""
- ["filename"]=>
- string(0) ""
-}
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
--- Iteration 7 --
array(3) {
["dirname"]=>
string(1) "."
@@ -166,7 +138,7 @@ string(1) "."
string(11) "array(1, 2)"
string(0) ""
string(11) "array(1, 2)"
--- Iteration 8 --
+-- Iteration 6 --
array(3) {
["dirname"]=>
string(1) "."
@@ -179,7 +151,7 @@ string(1) "."
string(21) "array( array(), null)"
string(0) ""
string(21) "array( array(), null)"
--- Iteration 9 --
+-- Iteration 7 --
array(3) {
["dirname"]=>
string(1) "."
@@ -192,7 +164,7 @@ string(1) "."
string(1) " "
string(0) ""
string(1) " "
--- Iteration 10 --
+-- Iteration 8 --
array(3) {
["dirname"]=>
string(1) "."
@@ -205,7 +177,7 @@ string(1) "."
string(1) " "
string(0) ""
string(1) " "
--- Iteration 11 --
+-- Iteration 9 --
array(2) {
["basename"]=>
string(0) ""
@@ -216,7 +188,7 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
--- Iteration 12 --
+-- Iteration 10 --
array(2) {
["basename"]=>
string(0) ""
@@ -227,7 +199,7 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
--- Iteration 13 --
+-- Iteration 11 --
array(4) {
["dirname"]=>
string(1) "."
@@ -242,7 +214,7 @@ string(1) "."
string(11) "www.foo.com"
string(3) "com"
string(7) "www.foo"
--- Iteration 14 --
+-- Iteration 12 --
array(4) {
["dirname"]=>
string(17) "/var/html/testdir"
@@ -257,7 +229,7 @@ string(17) "/var/html/testdir"
string(12) "example.html"
string(4) "html"
string(7) "example"
--- Iteration 15 --
+-- Iteration 13 --
array(3) {
["dirname"]=>
string(12) "/testdir/foo"
@@ -270,7 +242,7 @@ string(12) "/testdir/foo"
string(4) "test"
string(0) ""
string(4) "test"
--- Iteration 16 --
+-- Iteration 14 --
array(4) {
["dirname"]=>
string(4) "/foo"
@@ -285,7 +257,7 @@ string(4) "/foo"
string(12) "symlink.link"
string(4) "link"
string(7) "symlink"
--- Iteration 17 --
+-- Iteration 15 --
array(3) {
["dirname"]=>
string(1) "."
@@ -298,7 +270,7 @@ string(1) "."
string(5) "12345"
string(0) ""
string(5) "12345"
--- Iteration 18 --
+-- Iteration 16 --
array(4) {
["dirname"]=>
string(1) "."
@@ -313,7 +285,7 @@ string(1) "."
string(15) "www.example.com"
string(3) "com"
string(11) "www.example"
--- Iteration 19 --
+-- Iteration 17 --
array(3) {
["dirname"]=>
string(12) "/testdir/foo"
@@ -326,7 +298,7 @@ string(12) "/testdir/foo"
string(4) "test"
string(0) ""
string(4) "test"
--- Iteration 20 --
+-- Iteration 18 --
array(4) {
["dirname"]=>
string(6) "../foo"
@@ -341,7 +313,7 @@ string(6) "../foo"
string(9) "test.link"
string(4) "link"
string(4) "test"
--- Iteration 21 --
+-- Iteration 19 --
array(4) {
["dirname"]=>
string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6"
@@ -356,7 +328,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 20 --
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..d19ab84bb8cd 100644
--- a/ext/standard/tests/file/readfile_variation10-win32.phpt
+++ b/ext/standard/tests/file/readfile_variation10-win32.phpt
@@ -17,8 +17,6 @@ echo "*** Testing readfile() : variation ***\n";
$names_arr = array(
/* Invalid args */
"-1" => -1,
- "TRUE" => TRUE,
- "FALSE" => FALSE,
"\"\"" => "",
"\" \"" => " ",
"\\0" => "\0",
@@ -46,13 +44,6 @@ foreach($names_arr as $key => $value) {
Warning: readfile(): Failed to open stream: No such file or directory in %s on line %d
--- Filename: TRUE --
-
-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..44f4d714697a 100644
--- a/ext/standard/tests/file/readfile_variation10.phpt
+++ b/ext/standard/tests/file/readfile_variation10.phpt
@@ -18,8 +18,6 @@ echo "*** Testing readfile() : variation ***\n";
$names_arr = array(
/* Invalid args */
-1,
- TRUE,
- FALSE,
"",
" ",
"\0",
@@ -45,11 +43,6 @@ for( $i=0; $i
obscure_filename
--FILE--
"1" */
- FALSE,
"", // 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 +65,28 @@ 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 --
-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 --
-
-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 --
+-- 1 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 --
+-- 2 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 --
+-- 3 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 --
+-- 4 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..575cbe767911 100644
--- a/ext/standard/tests/file/rename_variation13.phpt
+++ b/ext/standard/tests/file/rename_variation13.phpt
@@ -24,8 +24,6 @@ mkdir($file_path);
$names_arr = array(
/* Invalid args */
-1,
- TRUE,
- FALSE,
"",
" ",
@@ -61,18 +59,6 @@ bool(true)
Warning: rename('-1', '%s/renameVar13/afile.tmp'): No such file or directory in %s on line %d
bool(false)
--- testing '1' --
-bool(true)
-
-Warning: rename('1', '%s/renameVar13/afile.tmp'): No such file or directory 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 '' --
Warning: rename('%s/renameVar13/afile.tmp', ''): %s in %s on line %d
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..14930e2ad085 100644
--- a/ext/standard/tests/file/tempnam_variation3-win32.phpt
+++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt
@@ -24,8 +24,6 @@ $file_path = realpath($file_path);
$names_arr = array(
/* Valid args (casting)*/
-1,
- TRUE,
- FALSE,
"",
" ",
"\0",
@@ -44,8 +42,6 @@ $res_arr = array(
true,
true,
true,
- true,
- true,
false,
/* prefix with path separator of a non existing directory*/
@@ -61,6 +57,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]) {
@@ -93,19 +93,14 @@ OK
-- Iteration 1 --
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 3 --
tempnam(): Argument #2 ($prefix) must not contain any null bytes
--- Iteration 6 --
+-- Iteration 4 --
tempnam(): Argument #2 ($prefix) must be of type string, array given
--- Iteration 7 --
+-- Iteration 5 --
OK
--- Iteration 8 --
+-- Iteration 6 --
OK
diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt
index 008b7f6dc468..e5d5386622cc 100644
--- a/ext/standard/tests/file/tempnam_variation3.phpt
+++ b/ext/standard/tests/file/tempnam_variation3.phpt
@@ -19,8 +19,6 @@ mkdir($file_path);
$names_arr = array(
/* Invalid args */
-1,
- TRUE,
- FALSE,
"",
" ",
"\0",
@@ -89,22 +87,14 @@ File name is => %s/%s
File permissions are => 100600
File created in => directory specified
-- Iteration 3 --
-File name is => %s/%s
-File permissions are => 100600
-File created in => directory specified
--- Iteration 4 --
-File name is => %s/%s
-File permissions are => 100600
-File created in => directory specified
--- Iteration 5 --
ValueError: tempnam(): Argument #2 ($prefix) must not contain any null bytes
--- Iteration 6 --
+-- Iteration 4 --
TypeError: tempnam(): Argument #2 ($prefix) must be of type string, array given
--- Iteration 7 --
+-- Iteration 5 --
File name is => %s/dir%s
File permissions are => 100600
File created in => directory specified
--- Iteration 8 --
+-- Iteration 6 --
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..6c6b4ce484d2 100644
--- a/ext/standard/tests/file/tempnam_variation7-win32.phpt
+++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt
@@ -17,8 +17,6 @@ echo "*** Testing tempnam() with invalid/non-existing directory names ***\n";
$names_arr = array(
/* Invalid args */
-1,
- TRUE,
- FALSE,
"",
" ",
"\0",
@@ -71,36 +69,26 @@ File name is => %s%et%s
File permissions are => 100666
File created in => temp dir
-- Iteration 1 --
-
-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 2 --
-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 3 --
tempnam(): Argument #1 ($directory) must not contain any null bytes
--- Iteration 6 --
+-- Iteration 4 --
tempnam(): Argument #1 ($directory) must be of type string, array given
--- Iteration 7 --
+-- Iteration 5 --
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 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
diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt
index 6e8baec0d66a..7b9d54d0c8d6 100644
--- a/ext/standard/tests/file/tempnam_variation7.phpt
+++ b/ext/standard/tests/file/tempnam_variation7.phpt
@@ -17,8 +17,6 @@ echo "*** Testing tempnam() with invalid/non-existing directory names ***\n";
$names_arr = array(
/* Invalid args */
-1,
- TRUE,
- FALSE,
"",
" ",
"\0",
@@ -76,36 +74,26 @@ File name is => %s%etempnam_variation3.tmp%s
File permissions are => 100600
File created in => temp dir
-- Iteration 1 --
-
-Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d
File name is => %s%etempnam_variation3.tmp%s
File permissions are => 100600
File created in => temp dir
-- Iteration 2 --
-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 3 --
ValueError: tempnam(): Argument #1 ($directory) must not contain any null bytes
--- Iteration 6 --
+-- Iteration 4 --
TypeError: tempnam(): Argument #1 ($directory) must be of type string, array given
--- Iteration 7 --
+-- 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
File permissions are => 100600
File created in => temp dir
--- Iteration 8 --
+-- Iteration 6 --
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/ini_get_all.phpt b/ext/standard/tests/general_functions/ini_get_all.phpt
index c54b39ac3325..740ad3b282ab 100644
--- a/ext/standard/tests/general_functions/ini_get_all.phpt
+++ b/ext/standard/tests/general_functions/ini_get_all.phpt
@@ -17,7 +17,7 @@ var_dump(ini_get_all("pcre"));
var_dump(ini_get_all("pcre", false));
var_dump(ini_get_all("reflection", false));
-var_dump(ini_get_all("", ""));
+var_dump(ini_get_all("", false));
echo "Done\n";
?>
diff --git a/ext/standard/tests/general_functions/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..5e2f03dd9900 100644
--- a/ext/standard/tests/general_functions/uniqid_basic.phpt
+++ b/ext/standard/tests/general_functions/uniqid_basic.phpt
@@ -17,8 +17,6 @@ $prefix = array (
99999,
"99999",
10.5e2,
- true,
- false
);
for ($i = 0; $i < count($prefix); $i++) {
@@ -50,11 +48,3 @@ string(18) "99999%s"
string(17) "1050%s"
string(27) "1050%s.%s"
string(17) "1050%s"
-
-string(14) "1%s"
-string(24) "1%s.%s"
-string(14) "1%s"
-
-string(13) "%s"
-string(23) "%s.%s"
-string(13) "%s"
diff --git a/ext/standard/tests/http/ghsa-52jp-hrpf-2jff-001.phpt b/ext/standard/tests/http/ghsa-52jp-hrpf-2jff-001.phpt
index 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..9eb9499edf9d 100644
--- a/ext/standard/tests/math/abs_basic.phpt
+++ b/ext/standard/tests/math/abs_basic.phpt
@@ -18,8 +18,7 @@ $values = array(23,
"2.345e1",
"-2.345e1",
null,
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = abs($values[$i]);
@@ -42,5 +41,3 @@ float(23.45)
Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
int(0)
-int(1)
-int(0)
diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt
index 1fac4ccc246d..bcb66af0bdd3 100644
--- a/ext/standard/tests/math/acos_variation.phpt
+++ b/ext/standard/tests/math/acos_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = acos($values[$i]);
@@ -41,5 +40,3 @@ float(NAN)
float(NAN)
float(NAN)
float(NAN)
-float(0)
-float(1.5707963267948966)
diff --git a/ext/standard/tests/math/acosh_variation.phpt b/ext/standard/tests/math/acosh_variation.phpt
index 9335961e637d..9f3086b9b064 100644
--- a/ext/standard/tests/math/acosh_variation.phpt
+++ b/ext/standard/tests/math/acosh_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = acosh($values[$i]);
@@ -41,5 +40,3 @@ float(3.8281684713331012)
float(3.8475627390640357)
float(3.8475627390640357)
float(7.600902209541989)
-float(0)
-float(NAN)
diff --git a/ext/standard/tests/math/asin_variation.phpt b/ext/standard/tests/math/asin_variation.phpt
index d0286894396e..c8eee31ac474 100644
--- a/ext/standard/tests/math/asin_variation.phpt
+++ b/ext/standard/tests/math/asin_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = asin($values[$i]);
@@ -41,5 +40,3 @@ float(NAN)
float(NAN)
float(NAN)
float(NAN)
-float(1.5707963267948966)
-float(0)
diff --git a/ext/standard/tests/math/asinh_variation.phpt b/ext/standard/tests/math/asinh_variation.phpt
index e7b9fd9c543b..841b14bfc1ff 100644
--- a/ext/standard/tests/math/asinh_variation.phpt
+++ b/ext/standard/tests/math/asinh_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = asinh($values[$i]);
@@ -41,5 +40,3 @@ float(3.829113652)
float(3.848471992)
float(3.848471992)
float(7.60090271)
-float(0.881373587)
-float(0)
diff --git a/ext/standard/tests/math/atan2_basic.phpt b/ext/standard/tests/math/atan2_basic.phpt
index 1c89cfa1c2fc..a7ddbe59cf8a 100644
--- a/ext/standard/tests/math/atan2_basic.phpt
+++ b/ext/standard/tests/math/atan2_basic.phpt
@@ -13,8 +13,7 @@ $valuesy = array(23,
"23",
"23.45",
"2.345e1",
- true,
- false);
+ );
$valuesx = array(23,
-23,
@@ -25,8 +24,7 @@ $valuesx = array(23,
"23",
"23.45",
"2.345e1",
- true,
- false);
+ );
for ($i = 0; $i < count($valuesy); $i++) {
for ($j = 0; $j < count($valuesx); $j++) {
@@ -46,8 +44,6 @@ Y:23 X:23 float(0.78539816339745)
Y:23 X:23 float(0.78539816339745)
Y:23 X:23.45 float(0.77571063007847)
Y:23 X:2.345e1 float(0.77571063007847)
-Y:23 X:1 float(1.5273454314034)
-Y:23 X: float(1.5707963267949)
Y:-23 X:23 float(-0.78539816339745)
Y:-23 X:-23 float(-2.3561944901923)
Y:-23 X:23.45 float(-0.77571063007847)
@@ -57,8 +53,6 @@ Y:-23 X:23 float(-0.78539816339745)
Y:-23 X:23 float(-0.78539816339745)
Y:-23 X:23.45 float(-0.77571063007847)
Y:-23 X:2.345e1 float(-0.77571063007847)
-Y:-23 X:1 float(-1.5273454314034)
-Y:-23 X: float(-1.5707963267949)
Y:23.45 X:23 float(0.79508569671643)
Y:23.45 X:-23 float(2.3465069568734)
Y:23.45 X:23.45 float(0.78539816339745)
@@ -68,8 +62,6 @@ Y:23.45 X:23 float(0.79508569671643)
Y:23.45 X:23 float(0.79508569671643)
Y:23.45 X:23.45 float(0.78539816339745)
Y:23.45 X:2.345e1 float(0.78539816339745)
-Y:23.45 X:1 float(1.5281782247706)
-Y:23.45 X: float(1.5707963267949)
Y:-23.45 X:23 float(-0.79508569671643)
Y:-23.45 X:-23 float(-2.3465069568734)
Y:-23.45 X:23.45 float(-0.78539816339745)
@@ -79,8 +71,6 @@ Y:-23.45 X:23 float(-0.79508569671643)
Y:-23.45 X:23 float(-0.79508569671643)
Y:-23.45 X:23.45 float(-0.78539816339745)
Y:-23.45 X:2.345e1 float(-0.78539816339745)
-Y:-23.45 X:1 float(-1.5281782247706)
-Y:-23.45 X: float(-1.5707963267949)
Y:23 X:23 float(0.78539816339745)
Y:23 X:-23 float(2.3561944901923)
Y:23 X:23.45 float(0.77571063007847)
@@ -90,8 +80,6 @@ Y:23 X:23 float(0.78539816339745)
Y:23 X:23 float(0.78539816339745)
Y:23 X:23.45 float(0.77571063007847)
Y:23 X:2.345e1 float(0.77571063007847)
-Y:23 X:1 float(1.5273454314034)
-Y:23 X: float(1.5707963267949)
Y:23 X:23 float(0.78539816339745)
Y:23 X:-23 float(2.3561944901923)
Y:23 X:23.45 float(0.77571063007847)
@@ -101,8 +89,6 @@ Y:23 X:23 float(0.78539816339745)
Y:23 X:23 float(0.78539816339745)
Y:23 X:23.45 float(0.77571063007847)
Y:23 X:2.345e1 float(0.77571063007847)
-Y:23 X:1 float(1.5273454314034)
-Y:23 X: float(1.5707963267949)
Y:23 X:23 float(0.78539816339745)
Y:23 X:-23 float(2.3561944901923)
Y:23 X:23.45 float(0.77571063007847)
@@ -112,8 +98,6 @@ Y:23 X:23 float(0.78539816339745)
Y:23 X:23 float(0.78539816339745)
Y:23 X:23.45 float(0.77571063007847)
Y:23 X:2.345e1 float(0.77571063007847)
-Y:23 X:1 float(1.5273454314034)
-Y:23 X: float(1.5707963267949)
Y:23.45 X:23 float(0.79508569671643)
Y:23.45 X:-23 float(2.3465069568734)
Y:23.45 X:23.45 float(0.78539816339745)
@@ -123,8 +107,6 @@ Y:23.45 X:23 float(0.79508569671643)
Y:23.45 X:23 float(0.79508569671643)
Y:23.45 X:23.45 float(0.78539816339745)
Y:23.45 X:2.345e1 float(0.78539816339745)
-Y:23.45 X:1 float(1.5281782247706)
-Y:23.45 X: float(1.5707963267949)
Y:2.345e1 X:23 float(0.79508569671643)
Y:2.345e1 X:-23 float(2.3465069568734)
Y:2.345e1 X:23.45 float(0.78539816339745)
@@ -134,27 +116,3 @@ Y:2.345e1 X:23 float(0.79508569671643)
Y:2.345e1 X:23 float(0.79508569671643)
Y:2.345e1 X:23.45 float(0.78539816339745)
Y:2.345e1 X:2.345e1 float(0.78539816339745)
-Y:2.345e1 X:1 float(1.5281782247706)
-Y:2.345e1 X: float(1.5707963267949)
-Y:1 X:23 float(0.043450895391531)
-Y:1 X:-23 float(3.0981417581983)
-Y:1 X:23.45 float(0.042618102024328)
-Y:1 X:-23.45 float(3.0989745515655)
-Y:1 X:23 float(0.043450895391531)
-Y:1 X:23 float(0.043450895391531)
-Y:1 X:23 float(0.043450895391531)
-Y:1 X:23.45 float(0.042618102024328)
-Y:1 X:2.345e1 float(0.042618102024328)
-Y:1 X:1 float(0.78539816339745)
-Y:1 X: float(1.5707963267949)
-Y: X:23 float(0)
-Y: X:-23 float(3.1415926535898)
-Y: X:23.45 float(0)
-Y: X:-23.45 float(3.1415926535898)
-Y: X:23 float(0)
-Y: X:23 float(0)
-Y: X:23 float(0)
-Y: X:23.45 float(0)
-Y: X:2.345e1 float(0)
-Y: X:1 float(0)
-Y: X: float(0)
diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt
index abd3831dddc6..8b2a8d674f8c 100644
--- a/ext/standard/tests/math/atan_variation.phpt
+++ b/ext/standard/tests/math/atan_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = atan($values[$i]);
@@ -41,5 +40,3 @@ float(1.5273454314033659)
float(1.528178224770569)
float(1.528178224770569)
float(1.5697963271282298)
-float(0.7853981633974483)
-float(0)
diff --git a/ext/standard/tests/math/atanh_variation.phpt b/ext/standard/tests/math/atanh_variation.phpt
index f740c1ccc00a..f6bfe9b8b464 100644
--- a/ext/standard/tests/math/atanh_variation.phpt
+++ b/ext/standard/tests/math/atanh_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = atanh($values[$i]);
@@ -41,5 +40,3 @@ float(NAN)
float(NAN)
float(NAN)
float(NAN)
-float(INF)
-float(0)
diff --git a/ext/standard/tests/math/base_convert_variation1.phpt b/ext/standard/tests/math/base_convert_variation1.phpt
deleted file mode 100644
index bcc18bfa2c04..000000000000
--- a/ext/standard/tests/math/base_convert_variation1.phpt
+++ /dev/null
@@ -1,128 +0,0 @@
---TEST--
-Test base_convert() function : usage variations - different data types as $number argument
---FILE--
-getMessage(), "\n";
- }
- $iterator++;
-}
-fclose($fp);
-?>
---EXPECTF--
-*** Testing base_convert() : usage variations ***
-
--- Iteration 1 --
-string(1) "0"
-
--- Iteration 2 --
-string(1) "1"
-
--- Iteration 3 --
-string(2) "14"
-
--- Iteration 4 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 5 --
-string(11) "17777777777"
-
--- Iteration 6 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 7 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 8 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 9 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 10 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 11 --
-string(1) "1"
-
--- Iteration 12 --
-string(1) "0"
-
--- Iteration 13 --
-string(1) "1"
-
--- Iteration 14 --
-string(1) "0"
-
--- Iteration 15 --
-string(1) "0"
-
--- Iteration 16 --
-string(1) "0"
-
--- Iteration 17 --
-TypeError: base_convert(): Argument #1 ($num) must be of type string, array given
-
--- Iteration 18 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 19 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 20 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 21 --
-TypeError: base_convert(): Argument #1 ($num) must be of type string, resource given
diff --git a/ext/standard/tests/math/bindec_basic.phpt b/ext/standard/tests/math/bindec_basic.phpt
index 47c6453dec5f..3690542e5b05 100644
--- a/ext/standard/tests/math/bindec_basic.phpt
+++ b/ext/standard/tests/math/bindec_basic.phpt
@@ -24,8 +24,6 @@ $values = array(111000111,
31.1013e5,
0x111ABC,
011237,
- true,
- false,
);
for ($i = 0; $i < count($values); $i++) {
@@ -56,5 +54,3 @@ Exception: Invalid characters passed for attempted conversion
Exception: Invalid characters passed for attempted conversion
Exception: Invalid characters passed for attempted conversion
Exception: Invalid characters passed for attempted conversion
-int(1)
-int(0)
diff --git a/ext/standard/tests/math/bindec_basic_64bit.phpt b/ext/standard/tests/math/bindec_basic_64bit.phpt
index 7bbab6f85ff2..48be3cf797be 100644
--- a/ext/standard/tests/math/bindec_basic_64bit.phpt
+++ b/ext/standard/tests/math/bindec_basic_64bit.phpt
@@ -24,8 +24,6 @@ $values = array(111000111,
31.1013e5,
0x111ABC,
011237,
- true,
- false,
);
for ($i = 0; $i < count($values); $i++) {
@@ -54,5 +52,3 @@ Exception: Invalid characters passed for attempted conversion
Exception: Invalid characters passed for attempted conversion
Exception: Invalid characters passed for attempted conversion
Exception: Invalid characters passed for attempted conversion
-int(1)
-int(0)
diff --git a/ext/standard/tests/math/bindec_variation1.phpt b/ext/standard/tests/math/bindec_variation1.phpt
deleted file mode 100644
index 1ce32f066536..000000000000
--- a/ext/standard/tests/math/bindec_variation1.phpt
+++ /dev/null
@@ -1,128 +0,0 @@
---TEST--
-Test bindec() function : usage variations - different data types as $binary_string arg
---SKIPIF--
-
---FILE--
-getMessage() . "\n";
- }
- $iterator++;
-};
-fclose($fp);
-?>
---EXPECTF--
-*** Testing bindec() : usage variations ***
-
--- Iteration 1 --
-int(0)
-
--- Iteration 2 --
-int(1)
-
--- Iteration 3 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 4 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 5 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 6 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 7 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 8 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 9 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 10 --
-int(1)
-
--- Iteration 11 --
-int(0)
-
--- Iteration 12 --
-int(1)
-
--- Iteration 13 --
-int(0)
-
--- Iteration 14 --
-int(0)
-
--- Iteration 15 --
-int(0)
-
--- Iteration 16 --
-TypeError: bindec(): Argument #1 ($binary_string) must be of type string, array given
-
--- Iteration 17 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 18 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 19 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 20 --
-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
deleted file mode 100644
index 746cc12503ea..000000000000
--- a/ext/standard/tests/math/bindec_variation1_64bit.phpt
+++ /dev/null
@@ -1,128 +0,0 @@
---TEST--
-Test bindec() function : usage variations - different data types as $binary_string arg
---SKIPIF--
-
---FILE--
-getMessage(), "\n";
- }
- $iterator++;
-};
-fclose($fp);
-?>
---EXPECTF--
-*** Testing bindec() : usage variations ***
-
--- Iteration 1 --
-int(0)
-
--- Iteration 2 --
-int(1)
-
--- Iteration 3 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 4 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 5 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 6 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 7 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 8 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 9 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 10 --
-int(1)
-
--- Iteration 11 --
-int(0)
-
--- Iteration 12 --
-int(1)
-
--- Iteration 13 --
-int(0)
-
--- Iteration 14 --
-int(0)
-
--- Iteration 15 --
-int(0)
-
--- Iteration 16 --
-TypeError: bindec(): Argument #1 ($binary_string) must be of type string, array given
-
--- Iteration 17 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 18 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 19 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 20 --
-TypeError: bindec(): Argument #1 ($binary_string) must be of type string, resource given
diff --git a/ext/standard/tests/math/ceil_basic.phpt b/ext/standard/tests/math/ceil_basic.phpt
index 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..bfc949808daf 100644
--- a/ext/standard/tests/math/cos_variation.phpt
+++ b/ext/standard/tests/math/cos_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = cos($values[$i]);
@@ -41,5 +40,3 @@ float(-0.5328330203)
float(-0.1117112391)
float(-0.1117112391)
float(0.5623790763)
-float(0.5403023059)
-float(1)
diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt
index 475c19fd50d6..7293ccd2fc34 100644
--- a/ext/standard/tests/math/cosh_variation.phpt
+++ b/ext/standard/tests/math/cosh_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = cosh($values[$i]);
@@ -41,5 +40,3 @@ float(4872401723)
float(7641446995)
float(7641446995)
float(INF)
-float(1.543080635)
-float(1)
diff --git a/ext/standard/tests/math/decbin_basic.phpt b/ext/standard/tests/math/decbin_basic.phpt
index 26e1dd2f1c55..c1b81e0e6af4 100644
--- a/ext/standard/tests/math/decbin_basic.phpt
+++ b/ext/standard/tests/math/decbin_basic.phpt
@@ -12,8 +12,6 @@ $values = array(10,
"3.9505e3",
"039",
"0x5F",
- true,
- false,
);
foreach ($values as $value) {
@@ -44,5 +42,3 @@ Deprecated: Implicit conversion from float-string "3.9505e3" to int loses precis
string(12) "111101101110"
string(6) "100111"
TypeError: decbin(): Argument #1 ($num) must be of type int, string given
-string(1) "1"
-string(1) "0"
diff --git a/ext/standard/tests/math/decbin_variation1.phpt b/ext/standard/tests/math/decbin_variation1.phpt
deleted file mode 100644
index b2744bb1b6bf..000000000000
--- a/ext/standard/tests/math/decbin_variation1.phpt
+++ /dev/null
@@ -1,88 +0,0 @@
---TEST--
-Test decbin() function : usage variations - different data types as $num arg
---INI--
-precision=14
---SKIPIF--
-
---FILE--
- $input) {
- $iterator = $i + 1;
- echo "\n-- Iteration $iterator --\n";
- try {
- var_dump(decbin($input));
- } catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
- }
-}
-
-?>
---EXPECT--
-*** Testing decbin() : usage variations ***
-
--- Iteration 1 --
-string(1) "0"
-
--- Iteration 2 --
-string(1) "1"
-
--- Iteration 3 --
-string(14) "11000000111001"
-
--- Iteration 4 --
-string(32) "11111111111111111111011011010111"
-
--- Iteration 5 --
-decbin(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 6 --
-decbin(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 7 --
-decbin(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 8 --
-string(1) "1"
-
--- Iteration 9 --
-string(1) "0"
-
--- Iteration 10 --
-string(1) "1"
-
--- Iteration 11 --
-string(1) "0"
-
--- Iteration 12 --
-decbin(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 13 --
-decbin(): Argument #1 ($num) must be of type int, string given
diff --git a/ext/standard/tests/math/decbin_variation1_64bit.phpt b/ext/standard/tests/math/decbin_variation1_64bit.phpt
deleted file mode 100644
index 46b6e4af9fbc..000000000000
--- a/ext/standard/tests/math/decbin_variation1_64bit.phpt
+++ /dev/null
@@ -1,88 +0,0 @@
---TEST--
-Test decbin() function : usage variations - different data types as $number arg
---INI--
-precision=14
---SKIPIF--
-
---FILE--
- $input) {
- $iterator = $i + 1;
- echo "\n-- Iteration $iterator --\n";
- try {
- var_dump(decbin($input));
- } catch (Throwable $exception) {
- echo $exception::class, ': ', $exception->getMessage(), "\n";
- }
-}
-
-?>
---EXPECT--
-*** Testing decbin() : usage variations ***
-
--- Iteration 1 --
-string(1) "0"
-
--- Iteration 2 --
-string(1) "1"
-
--- Iteration 3 --
-string(14) "11000000111001"
-
--- Iteration 4 --
-string(64) "1111111111111111111111111111111111111111111111111111011011010111"
-
--- Iteration 5 --
-TypeError: decbin(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 6 --
-TypeError: decbin(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 7 --
-string(37) "1110010111110100110010001101000001000"
-
--- Iteration 8 --
-string(1) "1"
-
--- Iteration 9 --
-string(1) "0"
-
--- Iteration 10 --
-string(1) "1"
-
--- Iteration 11 --
-string(1) "0"
-
--- Iteration 12 --
-TypeError: decbin(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 13 --
-TypeError: decbin(): Argument #1 ($num) must be of type int, string given
diff --git a/ext/standard/tests/math/dechex_basic.phpt b/ext/standard/tests/math/dechex_basic.phpt
index 61f3b6a85857..f704a959c7f8 100644
--- a/ext/standard/tests/math/dechex_basic.phpt
+++ b/ext/standard/tests/math/dechex_basic.phpt
@@ -12,8 +12,6 @@ $values = array(10,
"3.9505e3",
"039",
"0x5F",
- true,
- false,
);
foreach ($values as $value) {
@@ -44,5 +42,3 @@ Deprecated: Implicit conversion from float-string "3.9505e3" to int loses precis
string(3) "f6e"
string(2) "27"
TypeError: dechex(): Argument #1 ($num) must be of type int, string given
-string(1) "1"
-string(1) "0"
diff --git a/ext/standard/tests/math/dechex_variation1.phpt b/ext/standard/tests/math/dechex_variation1.phpt
deleted file mode 100644
index 4e014f35b760..000000000000
--- a/ext/standard/tests/math/dechex_variation1.phpt
+++ /dev/null
@@ -1,88 +0,0 @@
---TEST--
-Test dechex() function : usage variations - different data types as $num arg
---INI--
-precision=14
---SKIPIF--
-
---FILE--
- $input) {
- $iterator = $i + 1;
- echo "\n-- Iteration $iterator --\n";
- try {
- var_dump(dechex($input));
- } catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
- }
-}
-
-?>
---EXPECT--
-*** Testing dechex() : usage variations ***
-
--- Iteration 1 --
-string(1) "0"
-
--- Iteration 2 --
-string(1) "1"
-
--- Iteration 3 --
-string(4) "3039"
-
--- Iteration 4 --
-string(8) "fffff6d7"
-
--- Iteration 5 --
-dechex(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 6 --
-dechex(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 7 --
-dechex(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 8 --
-string(1) "1"
-
--- Iteration 9 --
-string(1) "0"
-
--- Iteration 10 --
-string(1) "1"
-
--- Iteration 11 --
-string(1) "0"
-
--- Iteration 12 --
-dechex(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 13 --
-dechex(): Argument #1 ($num) must be of type int, string given
diff --git a/ext/standard/tests/math/dechex_variation1_64bit.phpt b/ext/standard/tests/math/dechex_variation1_64bit.phpt
deleted file mode 100644
index 6f63d31dde57..000000000000
--- a/ext/standard/tests/math/dechex_variation1_64bit.phpt
+++ /dev/null
@@ -1,88 +0,0 @@
---TEST--
-Test dechex() function : usage variations - different data types as $number arg
---INI--
-precision=14
---SKIPIF--
-
---FILE--
- $input) {
- $iterator = $i + 1;
- echo "\n-- Iteration $iterator --\n";
- try {
- var_dump(dechex($input));
- } catch (Throwable $exception) {
- echo $exception::class, ': ', $exception->getMessage(), "\n";
- }
-}
-
-?>
---EXPECT--
-*** Testing dechex() : usage variations ***
-
--- Iteration 1 --
-string(1) "0"
-
--- Iteration 2 --
-string(1) "1"
-
--- Iteration 3 --
-string(4) "3039"
-
--- Iteration 4 --
-string(16) "fffffffffffff6d7"
-
--- Iteration 5 --
-TypeError: dechex(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 6 --
-TypeError: dechex(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 7 --
-string(10) "1cbe991a08"
-
--- Iteration 8 --
-string(1) "1"
-
--- Iteration 9 --
-string(1) "0"
-
--- Iteration 10 --
-string(1) "1"
-
--- Iteration 11 --
-string(1) "0"
-
--- Iteration 12 --
-TypeError: dechex(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 13 --
-TypeError: dechex(): Argument #1 ($num) must be of type int, string given
diff --git a/ext/standard/tests/math/decoct_basic.phpt b/ext/standard/tests/math/decoct_basic.phpt
index 31bfa96a49f5..e46a75bde36b 100644
--- a/ext/standard/tests/math/decoct_basic.phpt
+++ b/ext/standard/tests/math/decoct_basic.phpt
@@ -12,8 +12,6 @@ $values = array(10,
"3.9505e3",
"039",
"0x5F",
- true,
- false,
);
foreach ($values as $value) {
@@ -44,5 +42,3 @@ Deprecated: Implicit conversion from float-string "3.9505e3" to int loses precis
string(4) "7556"
string(2) "47"
TypeError: decoct(): Argument #1 ($num) must be of type int, string given
-string(1) "1"
-string(1) "0"
diff --git a/ext/standard/tests/math/decoct_variation1.phpt b/ext/standard/tests/math/decoct_variation1.phpt
deleted file mode 100644
index 1936464fd4b3..000000000000
--- a/ext/standard/tests/math/decoct_variation1.phpt
+++ /dev/null
@@ -1,88 +0,0 @@
---TEST--
-Test decoct() function : usage variations - different data types as $num arg
---INI--
-precision=14
---SKIPIF--
-
---FILE--
- $input) {
- $iterator = $i + 1;
- echo "\n-- Iteration $iterator --\n";
- try {
- var_dump(decoct($input));
- } catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
- }
-}
-
-?>
---EXPECT--
-*** Testing decoct() : usage variations ***
-
--- Iteration 1 --
-string(1) "0"
-
--- Iteration 2 --
-string(1) "1"
-
--- Iteration 3 --
-string(5) "30071"
-
--- Iteration 4 --
-string(11) "37777773327"
-
--- Iteration 5 --
-decoct(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 6 --
-decoct(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 7 --
-decoct(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 8 --
-string(1) "1"
-
--- Iteration 9 --
-string(1) "0"
-
--- Iteration 10 --
-string(1) "1"
-
--- Iteration 11 --
-string(1) "0"
-
--- Iteration 12 --
-decoct(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 13 --
-decoct(): Argument #1 ($num) must be of type int, string given
diff --git a/ext/standard/tests/math/decoct_variation1_64bit.phpt b/ext/standard/tests/math/decoct_variation1_64bit.phpt
deleted file mode 100644
index 56e468a72ef5..000000000000
--- a/ext/standard/tests/math/decoct_variation1_64bit.phpt
+++ /dev/null
@@ -1,88 +0,0 @@
---TEST--
-Test decoct() function : usage variations - different data types as $number arg
---INI--
-precision=14
---SKIPIF--
-
---FILE--
- $input) {
- $iterator = $i + 1;
- echo "\n-- Iteration $iterator --\n";
- try {
- var_dump(decoct($input));
- } catch (Throwable $exception) {
- echo $exception::class, ': ', $exception->getMessage(), "\n";
- }
-}
-
-?>
---EXPECT--
-*** Testing decoct() : usage variations ***
-
--- Iteration 1 --
-string(1) "0"
-
--- Iteration 2 --
-string(1) "1"
-
--- Iteration 3 --
-string(5) "30071"
-
--- Iteration 4 --
-string(22) "1777777777777777773327"
-
--- Iteration 5 --
-TypeError: decoct(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 6 --
-TypeError: decoct(): Argument #1 ($num) must be of type int, float given
-
--- Iteration 7 --
-string(13) "1627646215010"
-
--- Iteration 8 --
-string(1) "1"
-
--- Iteration 9 --
-string(1) "0"
-
--- Iteration 10 --
-string(1) "1"
-
--- Iteration 11 --
-string(1) "0"
-
--- Iteration 12 --
-TypeError: decoct(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 13 --
-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..32b9a3af8fd9 100644
--- a/ext/standard/tests/math/deg2rad_variation.phpt
+++ b/ext/standard/tests/math/deg2rad_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = deg2rad($values[$i]);
@@ -41,5 +40,3 @@ float(0.40142572795869574)
float(0.40927970959267024)
float(0.40927970959267024)
float(17.453292519943293)
-float(0.017453292519943295)
-float(0)
diff --git a/ext/standard/tests/math/exp_basic.phpt b/ext/standard/tests/math/exp_basic.phpt
index b10ab493a884..134d4aa8cd1a 100644
--- a/ext/standard/tests/math/exp_basic.phpt
+++ b/ext/standard/tests/math/exp_basic.phpt
@@ -13,8 +13,6 @@ $values = array(10,
"3950.5",
"3.9505e3",
"039",
- true,
- false,
);
$iterator = 1;
@@ -52,9 +50,3 @@ float(INF)
-- Iteration 9 --
float(8.6593400423994E+16)
-
--- Iteration 10 --
-float(2.718281828459)
-
--- Iteration 11 --
-float(1)
diff --git a/ext/standard/tests/math/expm1_basic.phpt b/ext/standard/tests/math/expm1_basic.phpt
index ea4c165da2c4..1e107a15a02b 100644
--- a/ext/standard/tests/math/expm1_basic.phpt
+++ b/ext/standard/tests/math/expm1_basic.phpt
@@ -14,8 +14,6 @@ $values = array(10,
"3950.5",
"3.9505e3",
"039",
- true,
- false,
);
// loop through each element of $values to check the behaviour of expm1()
@@ -55,9 +53,3 @@ float(INF)
-- Iteration 9 --
float(8.6593400423994E+16)
-
--- Iteration 10 --
-float(1.718281828459)
-
--- Iteration 11 --
-float(0)
diff --git a/ext/standard/tests/math/floor_basic.phpt b/ext/standard/tests/math/floor_basic.phpt
index 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..9ed06658f00a 100644
--- a/ext/standard/tests/math/fmod_basic.phpt
+++ b/ext/standard/tests/math/fmod_basic.phpt
@@ -13,8 +13,7 @@ $values1 = array(234,
"234",
"234.5",
"23.45e1",
- true,
- false);
+ );
$values2 = array(2,
-2,
@@ -25,8 +24,7 @@ $values2 = array(2,
"2",
"2.3",
"2.3e1",
- true,
- false);
+ );
for ($i = 0; $i < count($values1); $i++) {
echo "\niteration ", $i, "\n";
@@ -47,8 +45,6 @@ float(0)
float(0)
float(1.700000000000018)
float(4)
-float(0)
-float(NAN)
iteration 1
float(-0)
@@ -60,8 +56,6 @@ float(-0)
float(-0)
float(-1.700000000000018)
float(-4)
-float(-0)
-float(NAN)
iteration 2
float(0.5)
@@ -73,8 +67,6 @@ float(0.5)
float(0.5)
float(2.200000000000018)
float(4.5)
-float(0.5)
-float(NAN)
iteration 3
float(-0.5)
@@ -86,8 +78,6 @@ float(-0.5)
float(-0.5)
float(-2.200000000000018)
float(-4.5)
-float(-0.5)
-float(NAN)
iteration 4
float(0)
@@ -99,8 +89,6 @@ float(0)
float(0)
float(1.700000000000018)
float(4)
-float(0)
-float(NAN)
iteration 5
float(0)
@@ -112,8 +100,6 @@ float(0)
float(0)
float(1.700000000000018)
float(4)
-float(0)
-float(NAN)
iteration 6
float(0)
@@ -125,8 +111,6 @@ float(0)
float(0)
float(1.700000000000018)
float(4)
-float(0)
-float(NAN)
iteration 7
float(0.5)
@@ -138,8 +122,6 @@ float(0.5)
float(0.5)
float(2.200000000000018)
float(4.5)
-float(0.5)
-float(NAN)
iteration 8
float(0.5)
@@ -151,31 +133,3 @@ float(0.5)
float(0.5)
float(2.200000000000018)
float(4.5)
-float(0.5)
-float(NAN)
-
-iteration 9
-float(1)
-float(1)
-float(1)
-float(1)
-float(1)
-float(1)
-float(1)
-float(1)
-float(1)
-float(0)
-float(NAN)
-
-iteration 10
-float(0)
-float(0)
-float(0)
-float(0)
-float(0)
-float(0)
-float(0)
-float(0)
-float(0)
-float(0)
-float(NAN)
diff --git a/ext/standard/tests/math/hexdec_basic.phpt b/ext/standard/tests/math/hexdec_basic.phpt
index f518b74ad860..37fb4e9f6399 100644
--- a/ext/standard/tests/math/hexdec_basic.phpt
+++ b/ext/standard/tests/math/hexdec_basic.phpt
@@ -21,8 +21,6 @@ $values = array(0x123abc,
31.1013e5,
011237,
'011237',
- true,
- false,
);
for ($i = 0; $i < count($values); $i++) {
try {
@@ -55,5 +53,3 @@ Exception: Invalid characters passed for attempted conversion
int(51446064)
int(18279)
int(70199)
-int(1)
-int(0)
diff --git a/ext/standard/tests/math/hexdec_basic_64bit.phpt b/ext/standard/tests/math/hexdec_basic_64bit.phpt
index e011bce1c2af..6ef2086d130b 100644
--- a/ext/standard/tests/math/hexdec_basic_64bit.phpt
+++ b/ext/standard/tests/math/hexdec_basic_64bit.phpt
@@ -23,8 +23,6 @@ $values = array(0x123abc,
31.1013e5,
011237,
'011237',
- true,
- false,
);
foreach($values as $value) {
@@ -84,9 +82,3 @@ int(18279)
-- hexdec 011237 --
int(70199)
-
--- hexdec 1 --
-int(1)
-
--- hexdec --
-int(0)
diff --git a/ext/standard/tests/math/hexdec_variation1.phpt b/ext/standard/tests/math/hexdec_variation1.phpt
deleted file mode 100644
index da22d403a18c..000000000000
--- a/ext/standard/tests/math/hexdec_variation1.phpt
+++ /dev/null
@@ -1,144 +0,0 @@
---TEST--
-Test hexdec() function : usage variations - different data types as $number arg
---INI--
-precision=14
---SKIPIF--
-
---FILE--
-getMessage() . "\n";
- }
- $iterator++;
-};
-fclose($fp);
-?>
---EXPECTF--
-*** Testing hexdec() : usage variations ***
-
--- Iteration 1 --
-int(0)
-
--- Iteration 2 --
-int(1)
-
--- Iteration 3 --
-int(74565)
-
--- Iteration 4 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 5 --
-
-Notice: Input number is larger than PHP_INT_MAX, precision has been lost in conversion in %s on line %d
-float(285960729237)
-
--- Iteration 6 --
-
-Notice: Input number is larger than PHP_INT_MAX, precision has been lost in conversion in %s on line %d
-float(285960729238)
-
--- Iteration 7 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 8 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 9 --
-
-Notice: Input number is larger than PHP_INT_MAX, precision has been lost in conversion in %s on line %d
-float(20015998341120)
-
--- Iteration 10 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 11 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 12 --
-int(1)
-
--- Iteration 13 --
-int(0)
-
--- Iteration 14 --
-int(1)
-
--- Iteration 15 --
-int(0)
-
--- Iteration 16 --
-int(0)
-
--- Iteration 17 --
-int(0)
-
--- Iteration 18 --
-TypeError: hexdec(): Argument #1 ($hex_string) must be of type string, array given
-
--- Iteration 19 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 20 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 21 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 22 --
-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
deleted file mode 100644
index 70d89ba69eb1..000000000000
--- a/ext/standard/tests/math/hexdec_variation1_64bit.phpt
+++ /dev/null
@@ -1,138 +0,0 @@
---TEST--
-Test hexdec() function : usage variations - different data types as $number arg
---INI--
-precision=14
---SKIPIF--
-
---FILE--
-getMessage(), "\n";
- }
- $iterator++;
-};
-fclose($fp);
-?>
---EXPECTF--
-*** Testing hexdec() : usage variations ***
-
--- Iteration 1 --
-int(0)
-
--- Iteration 2 --
-int(1)
-
--- Iteration 3 --
-int(74565)
-
--- Iteration 4 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 5 --
-int(285960729237)
-
--- Iteration 6 --
-int(285960729238)
-
--- Iteration 7 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 8 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 9 --
-int(20015998341120)
-
--- Iteration 10 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 11 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 12 --
-int(1)
-
--- Iteration 13 --
-int(0)
-
--- Iteration 14 --
-int(1)
-
--- Iteration 15 --
-int(0)
-
--- Iteration 16 --
-int(0)
-
--- Iteration 17 --
-int(0)
-
--- Iteration 18 --
-TypeError: hexdec(): Argument #1 ($hex_string) must be of type string, array given
-
--- Iteration 19 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 20 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 21 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 22 --
-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..101357b42d77 100644
--- a/ext/standard/tests/math/hypot_basic.phpt
+++ b/ext/standard/tests/math/hypot_basic.phpt
@@ -16,8 +16,7 @@ $valuesy = array(23,
"23",
"23.45",
"2.345e1",
- true,
- false);
+ );
$valuesx = array(33,
-33,
@@ -28,8 +27,7 @@ $valuesx = array(33,
"33",
"43.45",
"1.345e1",
- true,
- false);
+ );
for ($i = 0; $i < count($valuesy); $i++) {
for ($j = 0; $j < count($valuesx); $j++) {
@@ -60,10 +58,6 @@ Y:23 X:43.45 float(49.1620026036369)
Y:23 X:1.345e1 float(26.6439955712352)
-Y:23 X:1 float(23.0217288664427)
-
-Y:23 X: float(23)
-
Y:-23 X:33 float(40.2243707222375)
Y:-23 X:-33 float(40.2243707222375)
@@ -82,10 +76,6 @@ Y:-23 X:43.45 float(49.1620026036369)
Y:-23 X:1.345e1 float(26.6439955712352)
-Y:-23 X:1 float(23.0217288664427)
-
-Y:-23 X: float(23)
-
Y:23.45 X:33 float(40.483360779461)
Y:23.45 X:-33 float(40.483360779461)
@@ -104,10 +94,6 @@ Y:23.45 X:43.45 float(49.3741329037787)
Y:23.45 X:1.345e1 float(27.033405260899)
-Y:23.45 X:1 float(23.4713122769052)
-
-Y:23.45 X: float(23.45)
-
Y:-23.45 X:33 float(40.483360779461)
Y:-23.45 X:-33 float(40.483360779461)
@@ -126,10 +112,6 @@ Y:-23.45 X:43.45 float(49.3741329037787)
Y:-23.45 X:1.345e1 float(27.033405260899)
-Y:-23.45 X:1 float(23.4713122769052)
-
-Y:-23.45 X: float(23.45)
-
Y:23 X:33 float(40.2243707222375)
Y:23 X:-33 float(40.2243707222375)
@@ -148,10 +130,6 @@ Y:23 X:43.45 float(49.1620026036369)
Y:23 X:1.345e1 float(26.6439955712352)
-Y:23 X:1 float(23.0217288664427)
-
-Y:23 X: float(23)
-
Y:23 X:33 float(40.2243707222375)
Y:23 X:-33 float(40.2243707222375)
@@ -170,10 +148,6 @@ Y:23 X:43.45 float(49.1620026036369)
Y:23 X:1.345e1 float(26.6439955712352)
-Y:23 X:1 float(23.0217288664427)
-
-Y:23 X: float(23)
-
Y:23 X:33 float(40.2243707222375)
Y:23 X:-33 float(40.2243707222375)
@@ -192,10 +166,6 @@ Y:23 X:43.45 float(49.1620026036369)
Y:23 X:1.345e1 float(26.6439955712352)
-Y:23 X:1 float(23.0217288664427)
-
-Y:23 X: float(23)
-
Y:23.45 X:33 float(40.483360779461)
Y:23.45 X:-33 float(40.483360779461)
@@ -214,10 +184,6 @@ Y:23.45 X:43.45 float(49.3741329037787)
Y:23.45 X:1.345e1 float(27.033405260899)
-Y:23.45 X:1 float(23.4713122769052)
-
-Y:23.45 X: float(23.45)
-
Y:2.345e1 X:33 float(40.483360779461)
Y:2.345e1 X:-33 float(40.483360779461)
@@ -235,51 +201,3 @@ Y:2.345e1 X:33 float(40.483360779461)
Y:2.345e1 X:43.45 float(49.3741329037787)
Y:2.345e1 X:1.345e1 float(27.033405260899)
-
-Y:2.345e1 X:1 float(23.4713122769052)
-
-Y:2.345e1 X: float(23.45)
-
-Y:1 X:33 float(33.0151480384384)
-
-Y:1 X:-33 float(33.0151480384384)
-
-Y:1 X:33.45 float(33.4649443447916)
-
-Y:1 X:-33.45 float(33.4649443447916)
-
-Y:1 X:39 float(39.0128184062623)
-
-Y:1 X:31 float(31.0161248385416)
-
-Y:1 X:33 float(33.0151480384384)
-
-Y:1 X:43.45 float(43.4615059564208)
-
-Y:1 X:1.345e1 float(13.4871234887206)
-
-Y:1 X:1 float(1.4142135623731)
-
-Y:1 X: float(1)
-
-Y: X:33 float(33)
-
-Y: X:-33 float(33)
-
-Y: X:33.45 float(33.45)
-
-Y: X:-33.45 float(33.45)
-
-Y: X:39 float(39)
-
-Y: X:31 float(31)
-
-Y: X:33 float(33)
-
-Y: X:43.45 float(43.45)
-
-Y: X:1.345e1 float(13.45)
-
-Y: X:1 float(1)
-
-Y: X: float(0)
diff --git a/ext/standard/tests/math/is_finite_basic.phpt b/ext/standard/tests/math/is_finite_basic.phpt
index 99af66be4e78..5d64b7fb9cd9 100644
--- a/ext/standard/tests/math/is_finite_basic.phpt
+++ b/ext/standard/tests/math/is_finite_basic.phpt
@@ -11,8 +11,6 @@ $values = array(234,
"234",
"234.5",
"23.45e1",
- true,
- false,
pow(0, -2),
acos(1.01));
;
@@ -32,7 +30,5 @@ bool(true)
bool(true)
bool(true)
bool(true)
-bool(true)
-bool(true)
bool(false)
bool(false)
diff --git a/ext/standard/tests/math/is_infinite_basic.phpt b/ext/standard/tests/math/is_infinite_basic.phpt
index 599bdd635fba..332759375dc4 100644
--- a/ext/standard/tests/math/is_infinite_basic.phpt
+++ b/ext/standard/tests/math/is_infinite_basic.phpt
@@ -11,8 +11,6 @@ $values = array(234,
"234",
"234.5",
"23.45e1",
- true,
- false,
pow(0, -2),
acos(1.01));
;
@@ -32,7 +30,5 @@ bool(false)
bool(false)
bool(false)
bool(false)
-bool(false)
-bool(false)
bool(true)
bool(false)
diff --git a/ext/standard/tests/math/is_nan_basic.phpt b/ext/standard/tests/math/is_nan_basic.phpt
index f0111e00e979..bf280ce447b9 100644
--- a/ext/standard/tests/math/is_nan_basic.phpt
+++ b/ext/standard/tests/math/is_nan_basic.phpt
@@ -11,8 +11,6 @@ $values = array(234,
"234",
"234.5",
"23.45e1",
- true,
- false,
pow(0, -2),
acos(1.01));
@@ -35,6 +33,4 @@ bool(false)
bool(false)
bool(false)
bool(false)
-bool(false)
-bool(false)
bool(true)
diff --git a/ext/standard/tests/math/log10_variation.phpt b/ext/standard/tests/math/log10_variation.phpt
index 9da765d5ae16..d5ff2af2d633 100644
--- a/ext/standard/tests/math/log10_variation.phpt
+++ b/ext/standard/tests/math/log10_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = log10($values[$i]);
@@ -41,5 +40,3 @@ float(1.3617278360175928)
float(1.3701428470511021)
float(1.3701428470511021)
float(3)
-float(0)
-float(-INF)
diff --git a/ext/standard/tests/math/log1p_basic.phpt b/ext/standard/tests/math/log1p_basic.phpt
index 7b19c3f9f425..940d6a0a4236 100644
--- a/ext/standard/tests/math/log1p_basic.phpt
+++ b/ext/standard/tests/math/log1p_basic.phpt
@@ -15,8 +15,7 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- true,
- false);
+ );
echo "\n LOG1p tests\n";
@@ -58,9 +57,3 @@ float(3.196630215920881)
-- log1p 2.345e1 --
float(3.196630215920881)
-
--- log1p 1 --
-float(0.6931471805599453)
-
--- log1p --
-float(0)
diff --git a/ext/standard/tests/math/log_basic.phpt b/ext/standard/tests/math/log_basic.phpt
index ae2e790bcceb..2b3dff6e9600 100644
--- a/ext/standard/tests/math/log_basic.phpt
+++ b/ext/standard/tests/math/log_basic.phpt
@@ -13,8 +13,7 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- true,
- false);
+ );
echo "\n LOG tests...no base\n";
for ($i = 0; $i < count($values); $i++) {
@@ -39,8 +38,6 @@ float(3.1354942159291497)
float(3.1354942159291497)
float(3.1548704948922883)
float(3.1548704948922883)
-float(0)
-float(-INF)
LOG tests...base
float(2.2617809780285065)
@@ -52,5 +49,3 @@ float(2.2617809780285065)
float(2.2617809780285065)
float(2.275758008814007)
float(2.275758008814007)
-float(0)
-float(-INF)
diff --git a/ext/standard/tests/math/number_format_basic.phpt b/ext/standard/tests/math/number_format_basic.phpt
index 40b00d1a4f63..ae6591d0b39d 100644
--- a/ext/standard/tests/math/number_format_basic.phpt
+++ b/ext/standard/tests/math/number_format_basic.phpt
@@ -15,8 +15,7 @@ $values = array(1234.5678,
"123456789",
"123.456789",
"12.3456789e1",
- true,
- false);
+ );
echo "\n number_format tests.....default\n";
for ($i = 0; $i < count($values); $i++) {
@@ -63,8 +62,6 @@ string(11) "402,653,183"
string(11) "123,456,789"
string(3) "123"
string(3) "123"
-string(1) "1"
-string(1) "0"
number_format tests.....with two dp
string(8) "1,234.57"
@@ -80,8 +77,6 @@ string(14) "402,653,183.00"
string(14) "123,456,789.00"
string(6) "123.46"
string(6) "123.46"
-string(4) "1.00"
-string(4) "0.00"
number_format tests.....English format
string(8) "1 234.57"
@@ -97,8 +92,6 @@ string(14) "402 653 183.00"
string(14) "123 456 789.00"
string(6) "123.46"
string(6) "123.46"
-string(4) "1.00"
-string(4) "0.00"
number_format tests.....French format
string(8) "1 234,57"
@@ -114,8 +107,6 @@ string(14) "402 653 183,00"
string(14) "123 456 789,00"
string(6) "123,46"
string(6) "123,46"
-string(4) "1,00"
-string(4) "0,00"
number_format tests.....multichar format
string(26) "1 THOUSAND 234 DECIMALS 57"
@@ -131,5 +122,3 @@ string(41) "402 THOUSAND 653 THOUSAND 183 DECIMALS 00"
string(41) "123 THOUSAND 456 THOUSAND 789 DECIMALS 00"
string(15) "123 DECIMALS 46"
string(15) "123 DECIMALS 46"
-string(13) "1 DECIMALS 00"
-string(13) "0 DECIMALS 00"
diff --git a/ext/standard/tests/math/number_format_multichar.phpt b/ext/standard/tests/math/number_format_multichar.phpt
index 1ed823042f18..2fc7ba5e4c2a 100644
--- a/ext/standard/tests/math/number_format_multichar.phpt
+++ b/ext/standard/tests/math/number_format_multichar.phpt
@@ -11,8 +11,7 @@ $values = array(1234.5678,
"123456789",
"123.456789",
"12.3456789e1",
- true,
- false);
+ );
echo " number_format tests.....multiple character decimal point\n";
for ($i = 0; $i < count($values); $i++) {
@@ -43,8 +42,6 @@ string(19) "402 653 183·00"
string(19) "123 456 789·00"
string(11) "123·46"
string(11) "123·46"
-string(9) "1·00"
-string(9) "0·00"
number_format tests.....multiple character thousand separator
string(15) "1 234.57"
@@ -56,8 +53,6 @@ string(28) "402 653 183.00"
string(28) "123 456 789.00"
string(6) "123.46"
string(6) "123.46"
-string(4) "1.00"
-string(4) "0.00"
number_format tests.....multiple character decimal and thousep
string(20) "1 234·57"
@@ -69,5 +64,3 @@ string(33) "402 653 183·00"
string(33) "123 456 789·00"
string(11) "123·46"
string(11) "123·46"
-string(9) "1·00"
-string(9) "0·00"
diff --git a/ext/standard/tests/math/octdec_basic.phpt b/ext/standard/tests/math/octdec_basic.phpt
index e2414e7f509f..e3a1669cd2e6 100644
--- a/ext/standard/tests/math/octdec_basic.phpt
+++ b/ext/standard/tests/math/octdec_basic.phpt
@@ -20,8 +20,6 @@ $values = array(01234567,
'12345',
31101.3,
31.1013e5,
- true,
- false,
);
for ($i = 0; $i < count($values); $i++) {
@@ -50,5 +48,3 @@ Exception: Invalid characters passed for attempted conversion
int(5349)
Exception: Invalid characters passed for attempted conversion
int(823384)
-int(1)
-int(0)
diff --git a/ext/standard/tests/math/octdec_basic_64bit.phpt b/ext/standard/tests/math/octdec_basic_64bit.phpt
index 886cc317fa52..fd78f8ad8857 100644
--- a/ext/standard/tests/math/octdec_basic_64bit.phpt
+++ b/ext/standard/tests/math/octdec_basic_64bit.phpt
@@ -23,8 +23,6 @@ $values = array(01234567,
'12345',
31101.3,
31.1013e5,
- true,
- false,
);
for ($i = 0; $i < count($values); $i++) {
@@ -52,5 +50,3 @@ Exception: Invalid characters passed for attempted conversion
int(5349)
Exception: Invalid characters passed for attempted conversion
int(823384)
-int(1)
-int(0)
diff --git a/ext/standard/tests/math/octdec_variation1.phpt b/ext/standard/tests/math/octdec_variation1.phpt
deleted file mode 100644
index d3a8a80093a2..000000000000
--- a/ext/standard/tests/math/octdec_variation1.phpt
+++ /dev/null
@@ -1,136 +0,0 @@
---TEST--
-Test octdec() function : usage variations - different data types as $octal_string arg
---INI--
-precision=14
---FILE--
-getMessage(), "\n";
- }
- $iterator++;
-};
-fclose($fp);
-?>
----Done---
---EXPECTF--
-*** Testing octdec() : usage variations ***
-
--- Iteration 1 --
-int(0)
-
--- Iteration 2 --
-int(1)
-
--- Iteration 3 --
-int(5349)
-
--- Iteration 4 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 5 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 6 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 7 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 8 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 9 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 10 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 11 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 12 --
-int(1)
-
--- Iteration 13 --
-int(0)
-
--- Iteration 14 --
-int(1)
-
--- Iteration 15 --
-int(0)
-
--- Iteration 16 --
-int(0)
-
--- Iteration 17 --
-int(0)
-
--- Iteration 18 --
-TypeError: octdec(): Argument #1 ($octal_string) must be of type string, array given
-
--- Iteration 19 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 20 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 21 --
-Exception: Invalid characters passed for attempted conversion
-
--- Iteration 22 --
-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..b321adaaac4e 100644
--- a/ext/standard/tests/math/rad2deg_variation.phpt
+++ b/ext/standard/tests/math/rad2deg_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = rad2deg($values[$i]);
@@ -41,5 +40,3 @@ float(1317.8029288008934)
float(1343.5860295817804)
float(1343.5860295817804)
float(57295.77951308232)
-float(57.29577951308232)
-float(0)
diff --git a/ext/standard/tests/math/round_basic.phpt b/ext/standard/tests/math/round_basic.phpt
index f2a7447a3747..dac476996f47 100644
--- a/ext/standard/tests/math/round_basic.phpt
+++ b/ext/standard/tests/math/round_basic.phpt
@@ -25,8 +25,7 @@ $precision = array(2,
"04",
"3.6",
"2.1e1",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
echo "round: $values[$i]\n";
@@ -53,8 +52,6 @@ Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on l
Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
...with precision 3.6-> float(123456789)
...with precision 2.1e1-> float(123456789)
-...with precision 1-> float(123456789)
-...with precision -> float(123456789)
round: 123.456789
...with precision 2-> float(123.46)
...with precision 8-> float(123.456789)
@@ -69,8 +66,6 @@ Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on l
Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
...with precision 3.6-> float(123.457)
...with precision 2.1e1-> float(123.456789)
-...with precision 1-> float(123.5)
-...with precision -> float(123)
round: -4.5679123
...with precision 2-> float(-4.57)
...with precision 8-> float(-4.5679123)
@@ -85,8 +80,6 @@ Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on l
Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
...with precision 3.6-> float(-4.568)
...with precision 2.1e1-> float(-4.5679123)
-...with precision 1-> float(-4.6)
-...with precision -> float(-5)
round: 12300
...with precision 2-> float(12300)
...with precision 8-> float(12300)
@@ -101,8 +94,6 @@ Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on l
Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
...with precision 3.6-> float(12300)
...with precision 2.1e1-> float(12300)
-...with precision 1-> float(12300)
-...with precision -> float(12300)
round: -4567
...with precision 2-> float(-4567)
...with precision 8-> float(-4567)
@@ -117,8 +108,6 @@ Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on l
Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
...with precision 3.6-> float(-4567)
...with precision 2.1e1-> float(-4567)
-...with precision 1-> float(-4567)
-...with precision -> float(-4567)
round: 2311527
...with precision 2-> float(2311527)
...with precision 8-> float(2311527)
@@ -133,8 +122,6 @@ Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on l
Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
...with precision 3.6-> float(2311527)
...with precision 2.1e1-> float(2311527)
-...with precision 1-> float(2311527)
-...with precision -> float(2311527)
round: 14680063
...with precision 2-> float(14680063)
...with precision 8-> float(14680063)
@@ -149,8 +136,6 @@ Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on l
Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
...with precision 3.6-> float(14680063)
...with precision 2.1e1-> float(14680063)
-...with precision 1-> float(14680063)
-...with precision -> float(14680063)
round: 1.234567
...with precision 2-> float(1.23)
...with precision 8-> float(1.234567)
@@ -165,8 +150,6 @@ Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on l
Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
...with precision 3.6-> float(1.235)
...with precision 2.1e1-> float(1.234567)
-...with precision 1-> float(1.2)
-...with precision -> float(1)
round: 2.3456789e8
...with precision 2-> float(234567890)
...with precision 8-> float(234567890)
@@ -181,5 +164,3 @@ Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on l
Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
...with precision 3.6-> float(234567890)
...with precision 2.1e1-> float(234567890)
-...with precision 1-> float(234567890)
-...with precision -> float(234567890)
diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt
index 6cca50a16773..a8f0506e9d6a 100644
--- a/ext/standard/tests/math/sin_variation.phpt
+++ b/ext/standard/tests/math/sin_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = sin($values[$i]);
@@ -41,5 +40,3 @@ float(-0.8462204042)
float(-0.9937407102)
float(-0.9937407102)
float(0.8268795405)
-float(0.8414709848)
-float(0)
diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt
index f053e58144ee..bdef3e13a493 100644
--- a/ext/standard/tests/math/sinh_variation.phpt
+++ b/ext/standard/tests/math/sinh_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = sinh($values[$i]);
@@ -41,5 +40,3 @@ float(4872401723)
float(7641446995)
float(7641446995)
float(INF)
-float(1.175201194)
-float(0)
diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt
index eb73870d1fc3..85c053f00549 100644
--- a/ext/standard/tests/math/sqrt_variation.phpt
+++ b/ext/standard/tests/math/sqrt_variation.phpt
@@ -22,8 +22,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = sqrt($values[$i]);
@@ -43,5 +42,3 @@ float(4.795831523312719)
float(4.8425200051213)
float(4.8425200051213)
float(31.622776601683793)
-float(1)
-float(0)
diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt
index 4394ddcd57a8..e0b4e6a78d92 100644
--- a/ext/standard/tests/math/tan_variation.phpt
+++ b/ext/standard/tests/math/tan_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = tan($values[$i]);
@@ -41,5 +40,3 @@ float(1.588153083)
float(8.895619796)
float(8.895619796)
float(1.470324156)
-float(1.557407725)
-float(0)
diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt
index d2011f474572..1998e447d86c 100644
--- a/ext/standard/tests/math/tanh_variation.phpt
+++ b/ext/standard/tests/math/tanh_variation.phpt
@@ -21,8 +21,7 @@ $values = array(23,
"23.45",
"2.345e1",
"1000",
- true,
- false);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = tanh($values[$i]);
@@ -41,5 +40,3 @@ float(1)
float(1)
float(1)
float(1)
-float(0.7615941559557649)
-float(0)
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--
---EXPECTF--
-*** Testing chr() function: with unexpected inputs for 'ascii' argument ***
--- Iteration 1 --
-string(2) "00"
--- Iteration 2 --
-string(2) "01"
--- Iteration 3 --
-string(2) "ff"
--- Iteration 4 --
-
-Deprecated: Implicit conversion from float 10.5 to int loses precision in %s on line %d
-string(2) "0a"
--- Iteration 5 --
-string(2) "01"
--- Iteration 6 --
-string(2) "00"
diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt
index 2acd74bee094..28ea705cea3f 100644
--- a/ext/standard/tests/strings/explode1.phpt
+++ b/ext/standard/tests/strings/explode1.phpt
@@ -12,8 +12,6 @@ $delimiters = array (
"abcd", // string
0, // zero
"0",
- TRUE, // boolean value
- FALSE,
-1, // negative integer
-11.23, // double
4, // positive integer
@@ -174,38 +172,6 @@ array(2) {
string(42) "0000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
}
-- Iteration 6 --
-array(5) {
- [0]=>
- string(0) ""
- [1]=>
- string(28) "234NULL23abcd00000TRUEFALSE-"
- [2]=>
- string(0) ""
- [3]=>
- string(12) ".234444true-"
- [4]=>
- string(0) ""
-}
-array(1) {
- [0]=>
- string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
-}
-array(1) {
- [0]=>
- string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
-}
-array(2) {
- [0]=>
- string(0) ""
- [1]=>
- string(56) "234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
-}
--- Iteration 7 --
-ValueError: explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters
-ValueError: explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters
-ValueError: explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters
-ValueError: explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters
--- Iteration 8 --
array(2) {
[0]=>
string(28) "1234NULL23abcd00000TRUEFALSE"
@@ -226,7 +192,7 @@ array(2) {
[1]=>
string(27) "1.234444true-11.24%PHP%ZEND"
}
--- Iteration 9 --
+-- Iteration 7 --
array(1) {
[0]=>
string(28) "1234NULL23abcd00000TRUEFALSE"
@@ -245,7 +211,7 @@ array(2) {
[1]=>
string(23) "4444true-11.24%PHP%ZEND"
}
--- Iteration 10 --
+-- Iteration 8 --
array(6) {
[0]=>
string(3) "123"
@@ -274,7 +240,7 @@ array(2) {
[1]=>
string(53) "NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
}
--- Iteration 11 --
+-- Iteration 9 --
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..d874eff74620 100644
Binary files a/ext/standard/tests/strings/implode_variation.phpt and b/ext/standard/tests/strings/implode_variation.phpt differ
diff --git a/ext/standard/tests/strings/join_variation4.phpt b/ext/standard/tests/strings/join_variation4.phpt
deleted file mode 100644
index 786047b602e3..000000000000
--- a/ext/standard/tests/strings/join_variation4.phpt
+++ /dev/null
@@ -1,73 +0,0 @@
---TEST--
-Test join() function : usage variations - different values for 'glue' argument
---FILE--
-getMessage(), "\n";
- }
- $counter++;
-}
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing join() : usage variations ***
--- Iteration 1 --
-string(87) "2TRUE0TRUE-639TRUE-1.3444TRUE1TRUEPHPTRUETRUETRUE TRUE6999.99999999TRUEstring%0with%0...%0"
--- Iteration 2 --
-string(57) "2101-6391-1.3444111PHP111 16999.999999991string%0with%0...%0"
--- Iteration 3 --
-string(47) "20-639-1.34441PHP 6999.99999999string%0with%0...%0"
--- Iteration 4 --
-TypeError: join(): Argument #1 ($separator) must be of type string, array given
--- Iteration 5 --
-string(47) "20-639-1.34441PHP 6999.99999999string%0with%0...%0"
--- Iteration 6 --
-string(57) "2 0 -639 -1.3444 1 PHP 6999.99999999 string%0with%0...%0"
--- Iteration 7 --
-string(187) "2string%0between0string%0between-639string%0between-1.3444string%0between1string%0betweenPHPstring%0betweenstring%0betweenstring%0between string%0between6999.99999999string%0betweenstring%0with%0...%0"
--- Iteration 8 --
-string(117) "2-1.56660-1.5666-639-1.5666-1.3444-1.56661-1.5666PHP-1.5666-1.5666-1.5666 -1.56666999.99999999-1.5666string%0with%0...%0"
--- Iteration 9 --
-string(57) "2000-6390-1.3444010PHP000 06999.999999990string%0with%0...%0"
--- Iteration 10 --
-string(67) "2\00\0-639\0-1.3444\01\0PHP\0\0\0 \06999.99999999\0string%0with%0...%0"
-Done
diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt
index 1abc31d0b3b5..88c57e9c9dbe 100644
--- a/ext/standard/tests/strings/lcfirst.phpt
+++ b/ext/standard/tests/strings/lcfirst.phpt
@@ -24,12 +24,10 @@ $str_array = array(
"NULL",
"0",
0,
- TRUE, // bool type
"TRUE",
"1",
1,
1.234444,
- FALSE,
"FALSE",
" ",
" ",
@@ -148,12 +146,10 @@ 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"
string(8) "1.234444"
-string(0) ""
string(5) "fALSE"
string(1) " "
string(5) " "
diff --git a/ext/standard/tests/strings/ltrim.phpt b/ext/standard/tests/strings/ltrim.phpt
index 952ad282c6fe..40979e127afa 100644
--- a/ext/standard/tests/strings/ltrim.phpt
+++ b/ext/standard/tests/strings/ltrim.phpt
@@ -23,7 +23,6 @@ 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", " ") ); /* 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 */
@@ -46,7 +45,6 @@ string(17) "ng heredoc string"
*** Output for Normal Behaviour ***
string(10) "ltrim test"
string(13) " ltrim test"
-string(18) " ltrim test"
string(10) "ltrim test"
string(11) " ltrim test"
string(10) "ltrim test"
diff --git a/ext/standard/tests/strings/number_format_basic.phpt b/ext/standard/tests/strings/number_format_basic.phpt
index 2e54eb1f0d5a..fc6543a301f1 100644
--- a/ext/standard/tests/strings/number_format_basic.phpt
+++ b/ext/standard/tests/strings/number_format_basic.phpt
@@ -13,8 +13,7 @@ $values = array(1234.5678,
"123456789",
"123.456789",
"12.3456789e1",
- true,
- false);
+ );
echo "\n-- number_format tests.....default --\n";
for ($i = 0; $i < count($values); $i++) {
@@ -53,8 +52,6 @@ string(11) "402,653,183"
string(11) "123,456,789"
string(3) "123"
string(3) "123"
-string(1) "1"
-string(1) "0"
-- number_format tests.....with two dp --
string(8) "1,234.57"
@@ -66,8 +63,6 @@ string(14) "402,653,183.00"
string(14) "123,456,789.00"
string(6) "123.46"
string(6) "123.46"
-string(4) "1.00"
-string(4) "0.00"
-- number_format tests.....English format --
string(8) "1 234.57"
@@ -79,8 +74,6 @@ string(14) "402 653 183.00"
string(14) "123 456 789.00"
string(6) "123.46"
string(6) "123.46"
-string(4) "1.00"
-string(4) "0.00"
-- number_format tests.....French format --
string(8) "1 234,57"
@@ -92,5 +85,3 @@ string(14) "402 653 183,00"
string(14) "123 456 789,00"
string(6) "123,46"
string(6) "123,46"
-string(4) "1,00"
-string(4) "0,00"
diff --git a/ext/standard/tests/strings/quoted_printable_encode_001.phpt b/ext/standard/tests/strings/quoted_printable_encode_001.phpt
index 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..7a5f8a4a5c65 100644
--- a/ext/standard/tests/strings/rtrim.phpt
+++ b/ext/standard/tests/strings/rtrim.phpt
@@ -8,7 +8,6 @@ Testing rtrim() function
echo "\n *** Output for Normal Behaviour ***\n";
var_dump ( rtrim("rtrim test \t\0 ") ); /* without second Argument */
var_dump ( rtrim("rtrim test " , "") ); /* no characters in second Argument */
- var_dump ( rtrim("rtrim test ", true) ); /* with boolean value as second Argument */
var_dump ( rtrim("rtrim test ", " ") ); /* with single space as second Argument */
var_dump ( rtrim("rtrim test \t\n\r\0\x0B", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */
var_dump ( rtrim("rtrim testABCXYZ", "A..Z") ); /* with characters range as second Argument */
@@ -45,7 +44,6 @@ echo "Done\n";
*** Output for Normal Behaviour ***
string(10) "rtrim test"
string(13) "rtrim test "
-string(18) "rtrim test "
string(10) "rtrim test"
string(11) "rtrim test "
string(10) "rtrim test"
diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt
index e5b6030b44ce..89a8340ab647 100644
--- a/ext/standard/tests/strings/str_pad.phpt
+++ b/ext/standard/tests/strings/str_pad.phpt
@@ -21,7 +21,6 @@ echo "\n#### variations with input string and pad-length ####\n";
$input_strings = array(
"variation", // normal string
"", // empty string
- true, // boolean
15, // numeric
15.55, // numeric
"2990" // numeric string
@@ -50,7 +49,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 ) {
@@ -148,36 +147,6 @@ string(16) "================"
string(16) "================"
string(16) "================"
string(16) "================"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(9) "1 "
-string(9) "1========"
-string(9) "========1"
-string(9) "1========"
-string(9) "====1===="
-string(10) "1 "
-string(10) "1========="
-string(10) "=========1"
-string(10) "1========="
-string(10) "====1====="
-string(16) "1 "
-string(16) "1==============="
-string(16) "===============1"
-string(16) "1==============="
-string(16) "=======1========"
string(2) "15"
string(2) "15"
string(2) "15"
@@ -278,10 +247,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..30858cf03537 100644
--- a/ext/standard/tests/strings/str_repeat.phpt
+++ b/ext/standard/tests/strings/str_repeat.phpt
@@ -11,7 +11,6 @@ $variations = array(
'barbazbax',
"\x00",
'\0',
- TRUE,
4,
1.23,
"",
@@ -68,12 +67,6 @@ try {
-- after repeating 2 times is => \0\0
-- after repeating 3 times is => \0\0\0
---- str_repeat() of '1' ---
--- after repeating 0 times is =>
--- after repeating 1 times is => 1
--- after repeating 2 times is => 11
--- after repeating 3 times is => 111
-
--- str_repeat() of '4' ---
-- after repeating 0 times is =>
-- after repeating 1 times is => 4
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
deleted file mode 100644
index 2bf2de0ac825..000000000000
--- a/ext/standard/tests/strings/strip_tags_variation2.phpt
+++ /dev/null
@@ -1,129 +0,0 @@
---TEST--
-Test strip_tags() function : usage variations - unexpected values for 'allowable_tags'
---FILE--
-hello