summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-09-21 11:07:42 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-09-21 17:04:39 +0200
commitfb4554e431e4f4063917c1a80ad2e929e6768d0b (patch)
tree1441e0a2b1a68232eb3d970d80ac699d6ab49f62 /ext
parentd60c43e397f45c3c92e2a980aa8bee2235bff8be (diff)
downloadphp-git-fb4554e431e4f4063917c1a80ad2e929e6768d0b.tar.gz
Throw warning for failed object to int/float conversion
We previously couldn't increase the error level here because it was coupled to comparison handling. This is no longer the case in PHP 8.
Diffstat (limited to 'ext')
-rw-r--r--ext/gd/tests/bug67248.phpt6
-rw-r--r--ext/posix/tests/posix_ttyname_variation6.phpt18
-rw-r--r--ext/spl/tests/countable_count_variation1.phpt2
-rw-r--r--ext/standard/tests/array/array_multisort_variation9.phpt8
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_basic.phpt8
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation2.phpt12
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation3.phpt12
-rw-r--r--ext/standard/tests/general_functions/intval_variation1.phpt15
-rw-r--r--ext/standard/tests/strings/sprintf_variation54.phptbin2174 -> 2179 bytes
-rw-r--r--ext/xml/tests/xml_parser_set_option_variation3.phpt2
10 files changed, 33 insertions, 50 deletions
diff --git a/ext/gd/tests/bug67248.phpt b/ext/gd/tests/bug67248.phpt
index 5b5e0e8bae..c48512e281 100644
--- a/ext/gd/tests/bug67248.phpt
+++ b/ext/gd/tests/bug67248.phpt
@@ -19,7 +19,7 @@ for($i=0;$i<7;$i++) {
!! [TypeError] imageaffinematrixget(): Argument #1 ($type) must be of type array when using translate or scale
!! [TypeError] imageaffinematrixget(): Argument #1 ($type) must be of type array when using translate or scale
-Notice: Object of class stdClass could not be converted to float in %s on line %d
+Warning: Object of class stdClass could not be converted to float in %s on line %d
array(6) {
[0]=>
float(%f)
@@ -35,7 +35,7 @@ array(6) {
float(0)
}
-Notice: Object of class stdClass could not be converted to float in %s on line %d
+Warning: Object of class stdClass could not be converted to float in %s on line %d
array(6) {
[0]=>
float(1)
@@ -51,7 +51,7 @@ array(6) {
float(0)
}
-Notice: Object of class stdClass could not be converted to float in %s on line %d
+Warning: Object of class stdClass could not be converted to float in %s on line %d
array(6) {
[0]=>
float(1)
diff --git a/ext/posix/tests/posix_ttyname_variation6.phpt b/ext/posix/tests/posix_ttyname_variation6.phpt
index 691c5eea7e..4af6334b2f 100644
--- a/ext/posix/tests/posix_ttyname_variation6.phpt
+++ b/ext/posix/tests/posix_ttyname_variation6.phpt
@@ -16,18 +16,6 @@ if (!extension_loaded('posix')) {
echo "*** Test substituting argument 1 with object values ***\n";
-
-
-function test_error_handler($err_no, $err_msg, $filename, $linenum) {
- if (error_reporting() != 0) {
- // report non-silenced errors
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
- }
-}
-set_error_handler('test_error_handler');
-
-
-
class classWithToString
{
public function __toString() {
@@ -51,7 +39,9 @@ foreach ( $variation_array as $var ) {
?>
--EXPECTF--
*** Test substituting argument 1 with object values ***
-Error: 8 - Object of class classWithToString could not be converted to int, %s(%d)
+
+Warning: Object of class classWithToString could not be converted to int in %s on line %d
bool(false)
-Error: 8 - Object of class classWithoutToString could not be converted to int, %s(%d)
+
+Warning: Object of class classWithoutToString could not be converted to int in %s on line %d
bool(false)
diff --git a/ext/spl/tests/countable_count_variation1.phpt b/ext/spl/tests/countable_count_variation1.phpt
index 8ce29410d9..0e17eccbe6 100644
--- a/ext/spl/tests/countable_count_variation1.phpt
+++ b/ext/spl/tests/countable_count_variation1.phpt
@@ -60,7 +60,7 @@ Count returns a string:
int(0)
Count returns an object:
-Notice: Object of class returnObject could not be converted to int in %s on line 40
+Warning: Object of class returnObject could not be converted to int in %s on line %d
int(1)
Count returns an array:
int(1)
diff --git a/ext/standard/tests/array/array_multisort_variation9.phpt b/ext/standard/tests/array/array_multisort_variation9.phpt
index 0451daca33..d7203c335b 100644
--- a/ext/standard/tests/array/array_multisort_variation9.phpt
+++ b/ext/standard/tests/array/array_multisort_variation9.phpt
@@ -33,13 +33,13 @@ var_dump($inputs);
--EXPECTF--
*** Testing array_multisort() : usage variation - test sort order of all types***
-Notice: Object of class classWithToString could not be converted to float in %sarray_multisort_variation9.php on line %d
+Warning: Object of class classWithToString could not be converted to float in %s on line %d
-Notice: Object of class classWithToString could not be converted to float in %sarray_multisort_variation9.php on line %d
+Warning: Object of class classWithToString could not be converted to float in %s on line %d
-Notice: Object of class classWithoutToString could not be converted to float in %sarray_multisort_variation9.php on line %d
+Warning: Object of class classWithoutToString could not be converted to float in %s on line %d
-Notice: Object of class classWithoutToString could not be converted to float in %sarray_multisort_variation9.php on line %d
+Warning: Object of class classWithoutToString could not be converted to float in %s on line %d
bool(true)
array(10) {
["float -10.5"]=>
diff --git a/ext/standard/tests/general_functions/gettype_settype_basic.phpt b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
index 0c336f8a23..a5e1a0b5bf 100644
--- a/ext/standard/tests/general_functions/gettype_settype_basic.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
@@ -237,7 +237,7 @@ bool(true)
int(%d)
string(7) "integer"
-- Iteration 14 --
-8: Object of class point could not be converted to int
+2: Object of class point could not be converted to int
bool(true)
int(1)
string(7) "integer"
@@ -296,7 +296,7 @@ bool(true)
int(%d)
string(7) "integer"
-- Iteration 14 --
-8: Object of class point could not be converted to int
+2: Object of class point could not be converted to int
bool(true)
int(1)
string(7) "integer"
@@ -355,7 +355,7 @@ bool(true)
float(%f)
string(6) "double"
-- Iteration 14 --
-8: Object of class point could not be converted to float
+2: Object of class point could not be converted to float
bool(true)
float(1)
string(6) "double"
@@ -414,7 +414,7 @@ bool(true)
float(%f)
string(6) "double"
-- Iteration 14 --
-8: Object of class point could not be converted to float
+2: Object of class point could not be converted to float
bool(true)
float(1)
string(6) "double"
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
index 91561715ac..12f001e924 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
@@ -554,19 +554,19 @@ int(-512000)
string(7) "integer"
-- Iteration 76 --
string(6) "object"
-8: Object of class point could not be converted to int
+2: Object of class point could not be converted to int
bool(true)
int(1)
string(7) "integer"
-- Iteration 77 --
string(6) "object"
-8: Object of class point could not be converted to int
+2: Object of class point could not be converted to int
bool(true)
int(1)
string(7) "integer"
-- Iteration 78 --
string(6) "object"
-8: Object of class point could not be converted to int
+2: Object of class point could not be converted to int
bool(true)
int(1)
string(7) "integer"
@@ -949,19 +949,19 @@ int(-512000)
string(7) "integer"
-- Iteration 76 --
string(6) "object"
-8: Object of class point could not be converted to int
+2: Object of class point could not be converted to int
bool(true)
int(1)
string(7) "integer"
-- Iteration 77 --
string(6) "object"
-8: Object of class point could not be converted to int
+2: Object of class point could not be converted to int
bool(true)
int(1)
string(7) "integer"
-- Iteration 78 --
string(6) "object"
-8: Object of class point could not be converted to int
+2: Object of class point could not be converted to int
bool(true)
int(1)
string(7) "integer"
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation3.phpt b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
index 75e01cfccf..16cc2b8dfd 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
@@ -548,19 +548,19 @@ float(-512000)
string(6) "double"
-- Iteration 76 --
string(6) "object"
-8: Object of class point could not be converted to float
+2: Object of class point could not be converted to float
bool(true)
float(1)
string(6) "double"
-- Iteration 77 --
string(6) "object"
-8: Object of class point could not be converted to float
+2: Object of class point could not be converted to float
bool(true)
float(1)
string(6) "double"
-- Iteration 78 --
string(6) "object"
-8: Object of class point could not be converted to float
+2: Object of class point could not be converted to float
bool(true)
float(1)
string(6) "double"
@@ -943,19 +943,19 @@ float(-512000)
string(6) "double"
-- Iteration 76 --
string(6) "object"
-8: Object of class point could not be converted to float
+2: Object of class point could not be converted to float
bool(true)
float(1)
string(6) "double"
-- Iteration 77 --
string(6) "object"
-8: Object of class point could not be converted to float
+2: Object of class point could not be converted to float
bool(true)
float(1)
string(6) "double"
-- Iteration 78 --
string(6) "object"
-8: Object of class point could not be converted to float
+2: Object of class point could not be converted to float
bool(true)
float(1)
string(6) "double"
diff --git a/ext/standard/tests/general_functions/intval_variation1.phpt b/ext/standard/tests/general_functions/intval_variation1.phpt
index f2e3db9f10..c18910a1d8 100644
--- a/ext/standard/tests/general_functions/intval_variation1.phpt
+++ b/ext/standard/tests/general_functions/intval_variation1.phpt
@@ -4,15 +4,6 @@ Test intval() function : usage variation
<?php
echo "*** Testing intval() : usage variation ***\n";
-// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum) {
- if (error_reporting() & $err_no) {
- // report non-silenced errors
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
- }
-}
-set_error_handler('test_error_handler');
-
// Initialise function arguments not being substituted (if any)
$base = 10;
@@ -181,11 +172,13 @@ int(0)
int(0)
--instance of classWithToString--
-Error: 8 - Object of class classWithToString could not be converted to int, %s(%d)
+
+Warning: Object of class classWithToString could not be converted to int in %s on line %d
int(1)
--instance of classWithoutToString--
-Error: 8 - Object of class classWithoutToString could not be converted to int, %s(%d)
+
+Warning: Object of class classWithoutToString could not be converted to int in %s on line %d
int(1)
--undefined var--
diff --git a/ext/standard/tests/strings/sprintf_variation54.phpt b/ext/standard/tests/strings/sprintf_variation54.phpt
index 82efde8d7f..51a4e48827 100644
--- a/ext/standard/tests/strings/sprintf_variation54.phpt
+++ b/ext/standard/tests/strings/sprintf_variation54.phpt
Binary files differ
diff --git a/ext/xml/tests/xml_parser_set_option_variation3.phpt b/ext/xml/tests/xml_parser_set_option_variation3.phpt
index d1163de356..a6b3a9b6ec 100644
--- a/ext/xml/tests/xml_parser_set_option_variation3.phpt
+++ b/ext/xml/tests/xml_parser_set_option_variation3.phpt
@@ -162,7 +162,7 @@ bool(true)
Arg value Some Ascii Data
-Notice: Object of class aClass could not be converted to int in %s on line %d
+Warning: Object of class aClass could not be converted to int in %s on line %d
bool(true)
Arg value Resource id %s