diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-21 11:07:42 +0200 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-21 17:04:39 +0200 |
| commit | fb4554e431e4f4063917c1a80ad2e929e6768d0b (patch) | |
| tree | 1441e0a2b1a68232eb3d970d80ac699d6ab49f62 /Zend | |
| parent | d60c43e397f45c3c92e2a980aa8bee2235bff8be (diff) | |
| download | php-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 'Zend')
| -rw-r--r-- | Zend/tests/bug33999.phpt | 4 | ||||
| -rw-r--r-- | Zend/tests/cast_to_double.phpt | 2 | ||||
| -rw-r--r-- | Zend/tests/cast_to_int.phpt | 2 | ||||
| -rw-r--r-- | Zend/tests/offset_string.phpt | 2 | ||||
| -rw-r--r-- | Zend/tests/settype_double.phpt | 2 | ||||
| -rw-r--r-- | Zend/tests/settype_int.phpt | 2 | ||||
| -rw-r--r-- | Zend/zend_operators.c | 2 |
7 files changed, 8 insertions, 8 deletions
diff --git a/Zend/tests/bug33999.phpt b/Zend/tests/bug33999.phpt index 7460815441..2b03c3124a 100644 --- a/Zend/tests/bug33999.phpt +++ b/Zend/tests/bug33999.phpt @@ -23,8 +23,8 @@ object(Foo)#1 (1) { string(3) "bat" } -Notice: Object of class Foo could not be converted to int in %sbug33999.php on line 9 +Warning: Object of class Foo could not be converted to int in %s on line %d int(1) -Notice: Object of class Foo could not be converted to float in %sbug33999.php on line 12 +Warning: Object of class Foo could not be converted to float in %s on line %d float(1) diff --git a/Zend/tests/cast_to_double.phpt b/Zend/tests/cast_to_double.phpt index 58286436bd..2972fbbe80 100644 --- a/Zend/tests/cast_to_double.phpt +++ b/Zend/tests/cast_to_double.phpt @@ -52,6 +52,6 @@ float(1) float(0) float(%f) -Notice: Object of class test could not be converted to float in %s on line %d +Warning: Object of class test could not be converted to float in %s on line %d float(1) Done diff --git a/Zend/tests/cast_to_int.phpt b/Zend/tests/cast_to_int.phpt index 5dbab23fd2..6451c4a2f7 100644 --- a/Zend/tests/cast_to_int.phpt +++ b/Zend/tests/cast_to_int.phpt @@ -50,6 +50,6 @@ int(1) int(0) int(%d) -Notice: Object of class test could not be converted to int in %s on line %d +Warning: Object of class test could not be converted to int in %s on line %d int(1) Done diff --git a/Zend/tests/offset_string.phpt b/Zend/tests/offset_string.phpt index 36481dccce..f14c63af5d 100644 --- a/Zend/tests/offset_string.phpt +++ b/Zend/tests/offset_string.phpt @@ -69,7 +69,7 @@ Warning: String offset cast occurred in %s on line %d string(1) "S" Cannot access offset of type resource on string -Notice: Object of class stdClass could not be converted to int in %s on line %d +Warning: Object of class stdClass could not be converted to int in %s on line %d Cannot access offset of type stdClass on string Cannot access offset of type array on string Done diff --git a/Zend/tests/settype_double.phpt b/Zend/tests/settype_double.phpt index d5b2f0e42e..6bbe773d0c 100644 --- a/Zend/tests/settype_double.phpt +++ b/Zend/tests/settype_double.phpt @@ -52,6 +52,6 @@ float(1) float(0) float(%f) -Notice: Object of class test could not be converted to float in %s on line %d +Warning: Object of class test could not be converted to float in %s on line %d float(1) Done diff --git a/Zend/tests/settype_int.phpt b/Zend/tests/settype_int.phpt index 9dac9c5b8f..e5eb098a67 100644 --- a/Zend/tests/settype_int.phpt +++ b/Zend/tests/settype_int.phpt @@ -50,6 +50,6 @@ int(1) int(0) int(%d) -Notice: Object of class test could not be converted to int in %s on line %d +Warning: Object of class test could not be converted to int in %s on line %d int(1) Done diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 0923741723..5f9dbe3d3c 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -142,7 +142,7 @@ ZEND_API zend_long ZEND_FASTCALL zend_atol(const char *str, size_t str_len) /* { #define convert_object_to_type(op, dst, ctype) \ ZVAL_UNDEF(dst); \ if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), dst, ctype) == FAILURE) { \ - zend_error(E_NOTICE, \ + zend_error(E_WARNING, \ "Object of class %s could not be converted to %s", ZSTR_VAL(Z_OBJCE_P(op)->name),\ zend_get_type_by_const(ctype)); \ } \ |
