summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2020-07-29 02:51:09 +0100
committerGeorge Peter Banyard <girgias@php.net>2020-07-29 02:51:09 +0100
commitb2248789ed21300aaf356336bf43b6b065183fcb (patch)
treec61dba0a43f72d27904e956318f911c7dc719dda
parentf759936591c08d9bff6ab707f2f8c192f61b5bf1 (diff)
downloadphp-git-b2248789ed21300aaf356336bf43b6b065183fcb.tar.gz
Implement 'Saner Numeric Strings' RFC:
RFC: https://wiki.php.net/rfc/saner-numeric-strings This removes the -1 allow_error mode from is_numeric_string functions and replaces it by a trailing boolean out argument to preserve BC in a couple of places. Most of the changes can be resumed to "numeric" strings which emitted a E_NOTICE now emit a E_WARNING and "numeric" strings which emitted a E_WARNING now throw a TypeError. This mostly affects: - String offsets - Arithmetic operations - Bitwise operations Closes GH-5762
-rw-r--r--UPGRADING21
-rw-r--r--Zend/tests/add_006.phpt26
-rw-r--r--Zend/tests/bug24773.phpt2
-rw-r--r--Zend/tests/bug31098.phpt25
-rw-r--r--Zend/tests/bug39018_2.phpt7
-rw-r--r--Zend/tests/bug53432.phpt10
-rw-r--r--Zend/tests/bug64578.phpt4
-rw-r--r--Zend/tests/bug72057.phpt19
-rw-r--r--Zend/tests/bug73792.phpt4
-rw-r--r--Zend/tests/bug76534.phpt4
-rw-r--r--Zend/tests/const_dereference_002.phpt6
-rw-r--r--Zend/tests/constant_expressions_dynamic.phpt2
-rw-r--r--Zend/tests/indexing_001.phpt14
-rw-r--r--Zend/tests/int_conversion_exponents.phpt8
-rw-r--r--Zend/tests/non_well_formed_param_exception.phpt22
-rw-r--r--Zend/tests/numeric_strings/array_offset.phpt86
-rw-r--r--Zend/tests/numeric_strings/explicit_cast_leading_numeric_must_work.phpt16
-rw-r--r--Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt (renamed from Zend/tests/numeric_string_errors_assign.phpt)235
-rw-r--r--Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt (renamed from Zend/tests/numeric_string_errors.phpt)206
-rw-r--r--Zend/tests/numeric_strings/neg_num_string.phpt (renamed from Zend/tests/neg_num_string.phpt)0
-rw-r--r--Zend/tests/numeric_strings/string_offset.phpt72
-rw-r--r--Zend/tests/offset_assign.phpt6
-rw-r--r--Zend/tests/offset_string.phpt28
-rw-r--r--Zend/tests/operator_unsupported_types.phpt579
-rw-r--r--Zend/tests/self_and.phpt12
-rw-r--r--Zend/tests/self_mod.phpt12
-rw-r--r--Zend/tests/self_or.phpt12
-rw-r--r--Zend/tests/self_xor.phpt12
-rw-r--r--Zend/tests/shift_001.phpt12
-rw-r--r--Zend/tests/shift_002.phpt12
-rw-r--r--Zend/tests/type_declarations/scalar_basic.phpt6
-rw-r--r--Zend/tests/type_declarations/scalar_return_basic.phpt6
-rw-r--r--Zend/tests/type_declarations/scalar_return_basic_64bit.phpt6
-rw-r--r--Zend/tests/type_declarations/union_types/type_checking_weak.phpt10
-rw-r--r--Zend/zend_API.c6
-rw-r--r--Zend/zend_execute.c75
-rw-r--r--Zend/zend_ini_scanner.l2
-rw-r--r--Zend/zend_operators.c71
-rw-r--r--Zend/zend_operators.h12
-rw-r--r--ext/opcache/jit/zend_jit_helpers.c60
-rw-r--r--ext/opcache/tests/bug71843.phpt7
-rw-r--r--ext/opcache/tests/jit/fetch_dim_r_003.phpt24
-rw-r--r--ext/opcache/tests/jit/fetch_dim_r_004.phpt18
-rw-r--r--ext/pdo/pdo_stmt.c8
-rw-r--r--ext/reflection/tests/bug76536.phpt2
-rw-r--r--ext/standard/tests/general_functions/floatval.phpt12
-rw-r--r--ext/standard/tests/general_functions/floatval_variation1.phpt12
-rw-r--r--ext/standard/tests/math/pow_variation1.phpt22
-rw-r--r--ext/standard/tests/math/pow_variation1_64bit.phpt24
-rw-r--r--ext/standard/tests/math/pow_variation2.phpt24
-rw-r--r--ext/standard/tests/strings/bug55871.phpt4
-rw-r--r--tests/lang/bug19943.phpt4
-rw-r--r--tests/lang/bug28800.phpt30
-rw-r--r--tests/lang/bug29566.phpt4
-rw-r--r--tests/lang/operators/add_variationStr.phpt117
-rw-r--r--tests/lang/operators/bitwiseShiftLeft_variationStr.phpt154
-rw-r--r--tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt156
-rw-r--r--tests/lang/operators/bitwiseShiftRight_variationStr.phpt156
-rw-r--r--tests/lang/operators/divide_variationStr.phpt508
-rw-r--r--tests/lang/operators/modulus_variationStr.phpt132
-rw-r--r--tests/lang/operators/multiply_variationStr.phpt117
-rw-r--r--tests/lang/operators/negate_variationStr.phpt29
-rw-r--r--tests/lang/operators/subtract_variationStr.phpt117
-rw-r--r--tests/strings/offsets_chaining_5.phpt10
-rw-r--r--tests/strings/offsets_general.phpt12
65 files changed, 2088 insertions, 1343 deletions
diff --git a/UPGRADING b/UPGRADING
index 6eca850664..28aa584862 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -217,6 +217,27 @@ PHP 8.0 UPGRADE NOTES
. debug_backtrace() and Exception::getTrace() will no longer provide
references to arguments. It will not be possible to change function
arguments through the backtrace.
+ . The concept of numeric-string has been altered to be less error prone.
+ Trailing whitespaces are now allowed in numeric strings making it symmetric
+ with how leading whitespaces were treated.
+ This mostly affects:
+ - The is_numeric() function
+ - String-to-string comparisons
+ - Type declarations
+ - Increment and Decrement operations
+ The concept of "leading-numeric string" has been mostly dropped, the cases
+ where this concept remains is in order to ease migration.
+ String which emitted an E_NOTICE "A non well formed numeric value encountered"
+ will now emit an E_WARNING "A non-numeric value encountered"
+ and all strings which emitted an E_WARNING "A non-numeric value encountered"
+ will now throw a TypeError.
+ This mostly affects:
+ - Arithmetic operations
+ - Bitwise operations
+ This E_WARNING to TypeError change also affects the E_WARNING
+ "Illegal string offset 'string'" for illegal string offsets.
+ This does not change the behaviour of explicit casts to int/float from strings.
+ RFC: https://wiki.php.net/rfc/saner-numeric-strings
- COM:
. Removed the ability to import case-insensitive constants from type
diff --git a/Zend/tests/add_006.phpt b/Zend/tests/add_006.phpt
index 2e7f76b4ee..09945f3fce 100644
--- a/Zend/tests/add_006.phpt
+++ b/Zend/tests/add_006.phpt
@@ -11,9 +11,12 @@ $s2 = "876222numeric";
$s3 = "48474874";
$s4 = "25.68";
-$c = $i + $s1;
-var_dump($c);
-
+try {
+ $c = $i + $s1;
+ var_dump($c);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$c = $i + $s2;
var_dump($c);
@@ -23,8 +26,12 @@ var_dump($c);
$c = $i + $s4;
var_dump($c);
-$c = $s1 + $i;
-var_dump($c);
+try {
+ $c = $s1 + $i;
+ var_dump($c);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$c = $s2 + $i;
var_dump($c);
@@ -38,18 +45,15 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Warning: A non-numeric value encountered in %s on line %d
-int(75636)
+Unsupported operand types: int + string
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(951858)
int(48550510)
float(75661.68)
+Unsupported operand types: string + int
Warning: A non-numeric value encountered in %s on line %d
-int(75636)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(951858)
int(48550510)
float(75661.68)
diff --git a/Zend/tests/bug24773.phpt b/Zend/tests/bug24773.phpt
index 1a73b3df1b..4c73fd0dd0 100644
--- a/Zend/tests/bug24773.phpt
+++ b/Zend/tests/bug24773.phpt
@@ -6,7 +6,7 @@ Bug #24773 (unset() of integers treated as arrays causes a crash)
unset($array["lvl1"]["lvl2"]["b"]);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot use string offset as an array in %s:%d
+Fatal error: Uncaught TypeError: Cannot access offset of type string on string in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/bug31098.phpt b/Zend/tests/bug31098.phpt
index f9ea43a93a..1cad1108c0 100644
--- a/Zend/tests/bug31098.phpt
+++ b/Zend/tests/bug31098.phpt
@@ -17,16 +17,28 @@ var_dump(isset($a['b']));
$simpleString = "Bogus String Text";
echo isset($simpleString->wrong)?"bug\n":"ok\n";
-echo isset($simpleString["wrong"])?"bug\n":"ok\n";
+try {
+ echo isset($simpleString["wrong"])?"bug\n":"ok\n";
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo isset($simpleString[-20])?"bug\n":"ok\n";
echo isset($simpleString[0])?"ok\n":"bug\n";
echo isset($simpleString["0"])?"ok\n":"bug\n";
echo isset($simpleString["16"])?"ok\n":"bug\n";
echo isset($simpleString["17"])?"bug\n":"ok\n";
echo $simpleString->wrong === null?"ok\n":"bug\n";
-echo $simpleString["wrong"] === "B"?"ok\n":"bug\n";
+try {
+ echo $simpleString["wrong"] === "B"?"ok\n":"bug\n";
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo $simpleString["0"] === "B"?"ok\n":"bug\n";
-$simpleString["wrong"] = "f";
+try {
+ $simpleString["wrong"] = "f";
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo $simpleString["0"] === "f"?"ok\n":"bug\n";
?>
--EXPECTF--
@@ -46,10 +58,7 @@ ok
Warning: Attempt to read property "wrong" on string in %s on line %d
ok
-
-Warning: Illegal string offset "wrong" in %s on line %d
-ok
+Cannot access offset of type string on string
ok
-
-Warning: Illegal string offset "wrong" in %s on line %d
+Cannot access offset of type string on string
ok
diff --git a/Zend/tests/bug39018_2.phpt b/Zend/tests/bug39018_2.phpt
index 81831d51e0..5d45f0700b 100644
--- a/Zend/tests/bug39018_2.phpt
+++ b/Zend/tests/bug39018_2.phpt
@@ -8,11 +8,8 @@ error_reporting(E_ALL);
$foo = 'test';
$x = @$foo[6];
-print @($foo[100] + $foo[130]);
-
-print "\nDone\n";
+var_dump(@($foo[100] . $foo[130]));
?>
--EXPECT--
-0
-Done
+string(0) ""
diff --git a/Zend/tests/bug53432.phpt b/Zend/tests/bug53432.phpt
index 68ce0e3583..fb6b80857a 100644
--- a/Zend/tests/bug53432.phpt
+++ b/Zend/tests/bug53432.phpt
@@ -16,7 +16,11 @@ var_dump($str[-1] = 'a');
var_dump($str);
$str = '';
-var_dump($str['foo'] = 'a');
+try {
+ var_dump($str['foo'] = 'a');
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump($str);
$str = '';
@@ -53,9 +57,7 @@ string(6) " a"
Warning: Illegal string offset -1 in %s on line %d
NULL
string(0) ""
-
-Warning: Illegal string offset "foo" in %s on line %d
-string(1) "a"
+Cannot access offset of type string on string
string(1) "a"
Error: [] operator not supported for strings
string(0) ""
diff --git a/Zend/tests/bug64578.phpt b/Zend/tests/bug64578.phpt
index e16f8ea4ba..d0d69995ad 100644
--- a/Zend/tests/bug64578.phpt
+++ b/Zend/tests/bug64578.phpt
@@ -5,10 +5,10 @@ Bug #64578 (debug_backtrace in set_error_handler corrupts zend heap: segfault)
set_error_handler(function($no, $err) { var_dump($err); });
-function x($s) { $s['a'] = 1; };
+function x($s) { $s['2a'] = 1; };
$y = '1';
x($y);
print_r($y);
--EXPECT--
-string(25) "Illegal string offset "a""
+string(26) "Illegal string offset "2a""
1
diff --git a/Zend/tests/bug72057.phpt b/Zend/tests/bug72057.phpt
deleted file mode 100644
index a518d82948..0000000000
--- a/Zend/tests/bug72057.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Bug #72057 (PHP hangs when user error handler throws exception after Notice from type coercion)
---FILE--
-<?php
-
-set_error_handler(
- function() {
- throw new Exception("My custom error");
- }
-);
-
-(function (int $i) { bar(); })("7as");
---EXPECTF--
-Fatal error: Uncaught Exception: My custom error in %s:%d
-Stack trace:
-#0 %s(%d): {closure}(8, 'A non well form...', '%s', %d)
-#1 %s(%d): {closure}('7as')
-#2 {main}
- thrown in %s on line %d
diff --git a/Zend/tests/bug73792.phpt b/Zend/tests/bug73792.phpt
index dfcd9bb499..39e45f1367 100644
--- a/Zend/tests/bug73792.phpt
+++ b/Zend/tests/bug73792.phpt
@@ -4,7 +4,7 @@ Bug #73792 (invalid foreach loop hangs script)
<?php
$a = 'aaa';
-foreach ($a['bbb'] as &$value) {
+foreach ($a['2bbb'] as &$value) {
echo 'loop';
}
@@ -12,7 +12,7 @@ unset($value);
echo 'done';
?>
--EXPECTF--
-Warning: Illegal string offset "bbb" in %s on line %d
+Warning: Illegal string offset "2bbb" in %s on line %d
Fatal error: Uncaught Error: Cannot iterate on string offsets by reference in %sbug73792.php:4
Stack trace:
diff --git a/Zend/tests/bug76534.phpt b/Zend/tests/bug76534.phpt
index b0149e47a4..f544d964c4 100644
--- a/Zend/tests/bug76534.phpt
+++ b/Zend/tests/bug76534.phpt
@@ -7,10 +7,10 @@ set_error_handler(function ($severity, $message, $file, $line) {
});
$x = "foo";
-$y = &$x["bar"];
+$y = &$x["2bar"];
?>
--EXPECTF--
-Fatal error: Uncaught Exception: Illegal string offset "bar" in %s:%d
+Fatal error: Uncaught Exception: Illegal string offset "2bar" in %s:%d
Stack trace:
#0 %sbug76534.php(%d): {closure}(2, 'Illegal string ...', '%s', %d)
#1 {main}
diff --git a/Zend/tests/const_dereference_002.phpt b/Zend/tests/const_dereference_002.phpt
index 5d3c6e5842..d7195dd282 100644
--- a/Zend/tests/const_dereference_002.phpt
+++ b/Zend/tests/const_dereference_002.phpt
@@ -6,12 +6,12 @@ error_reporting(E_ALL);
var_dump("foobar"[3]);
var_dump("foobar"[2][0]);
-var_dump("foobar"["foo"]["bar"]);
+var_dump("foobar"["0foo"]["0bar"]);
--EXPECTF--
string(1) "b"
string(1) "o"
-Warning: Illegal string offset "foo" in %s on line %d
+Warning: Illegal string offset "0foo" in %s on line %d
-Warning: Illegal string offset "bar" in %s on line %d
+Warning: Illegal string offset "0bar" in %s on line %d
string(1) "f"
diff --git a/Zend/tests/constant_expressions_dynamic.phpt b/Zend/tests/constant_expressions_dynamic.phpt
index 79f8c772e3..fff9f74e52 100644
--- a/Zend/tests/constant_expressions_dynamic.phpt
+++ b/Zend/tests/constant_expressions_dynamic.phpt
@@ -5,7 +5,7 @@ Dynamic Constant Expressions
const C_0 = 0;
const C_1 = 1;
-const C_foo = "foo";
+const C_foo = "0foo";
const C_arr = [0 => 0, "foo" => "foo"];
const T_1 = C_1 | 2;
diff --git a/Zend/tests/indexing_001.phpt b/Zend/tests/indexing_001.phpt
index 156df07f0c..c712b09802 100644
--- a/Zend/tests/indexing_001.phpt
+++ b/Zend/tests/indexing_001.phpt
@@ -75,19 +75,13 @@ array(1) {
}
}
-Warning: Illegal string offset "foo" in %s on line %d
-
Warning: Array to string conversion in %s on line %d
-
-Warning: Only the first byte will be assigned to the string offset in %s on line %d
-string(1) "A"
-
-Warning: Illegal string offset "foo" in %s on line %d
+Cannot access offset of type string on string
+string(0) ""
Warning: Array to string conversion in %s on line %d
-
-Warning: Only the first byte will be assigned to the string offset in %s on line %d
-string(1) "A"
+Cannot access offset of type string on string
+string(1) " "
Cannot use a scalar value as an array
float(0.1)
array(1) {
diff --git a/Zend/tests/int_conversion_exponents.phpt b/Zend/tests/int_conversion_exponents.phpt
index d924cb7b81..1e4ce72cee 100644
--- a/Zend/tests/int_conversion_exponents.phpt
+++ b/Zend/tests/int_conversion_exponents.phpt
@@ -39,14 +39,14 @@ int(-1234500000)
int(1234500000)
int(-1234500000)
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(1234500000)
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(-1234500000)
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(1234500000)
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(-1234500000)
diff --git a/Zend/tests/non_well_formed_param_exception.phpt b/Zend/tests/non_well_formed_param_exception.phpt
deleted file mode 100644
index d688375f9f..0000000000
--- a/Zend/tests/non_well_formed_param_exception.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-A "non well formed" notice converted to exception should result in a ZPP failure
---FILE--
-<?php
-
-set_error_handler(function($_, $msg) {
- throw new Exception($msg);
-}, E_NOTICE);
-
-try {
- wordwrap("foo", "123foo", "");
-} catch (Exception $e) {
- echo $e, "\n";
-}
-
-?>
---EXPECTF--
-Exception: A non well formed numeric value encountered in %s:%d
-Stack trace:
-#0 [internal function]: {closure}(%s)
-#1 %s(%d): wordwrap('foo', '123foo', '')
-#2 {main}
diff --git a/Zend/tests/numeric_strings/array_offset.phpt b/Zend/tests/numeric_strings/array_offset.phpt
new file mode 100644
index 0000000000..6522faea24
--- /dev/null
+++ b/Zend/tests/numeric_strings/array_offset.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Using different sorts of numerical strings as an array offset
+--FILE--
+<?php
+
+$arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
+
+var_dump($arr["7"]);
+var_dump($arr["7.5"]);
+var_dump($arr[" 7"]);
+var_dump($arr[" 7.5"]);
+var_dump($arr[" 7 "]);
+var_dump($arr[" 7.5 "]);
+var_dump($arr["7 "]);
+var_dump($arr["7.5 "]);
+var_dump($arr["7str"]);
+var_dump($arr["7.5str"]);
+var_dump($arr[" 7str"]);
+var_dump($arr[" 7.5str"]);
+var_dump($arr[" 7 str"]);
+var_dump($arr[" 7.5 str"]);
+var_dump($arr["7 str"]);
+var_dump($arr["7.5 str"]);
+var_dump($arr["0xA"]);
+var_dump($arr["0b10"]);
+var_dump($arr["07"]);
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(7)
+
+Notice: Undefined array key "7.5" in %s on line 6
+NULL
+
+Notice: Undefined array key " 7" in %s on line 7
+NULL
+
+Notice: Undefined array key " 7.5" in %s on line 8
+NULL
+
+Notice: Undefined array key " 7 " in %s on line 9
+NULL
+
+Notice: Undefined array key " 7.5 " in %s on line 10
+NULL
+
+Notice: Undefined array key "7 " in %s on line 11
+NULL
+
+Notice: Undefined array key "7.5 " in %s on line 12
+NULL
+
+Notice: Undefined array key "7str" in %s on line 13
+NULL
+
+Notice: Undefined array key "7.5str" in %s on line 14
+NULL
+
+Notice: Undefined array key " 7str" in %s on line 15
+NULL
+
+Notice: Undefined array key " 7.5str" in %s on line 16
+NULL
+
+Notice: Undefined array key " 7 str" in %s on line 17
+NULL
+
+Notice: Undefined array key " 7.5 str" in %s on line 18
+NULL
+
+Notice: Undefined array key "7 str" in %s on line 19
+NULL
+
+Notice: Undefined array key "7.5 str" in %s on line 20
+NULL
+
+Notice: Undefined array key "0xA" in %s on line 21
+NULL
+
+Notice: Undefined array key "0b10" in %s on line 22
+NULL
+
+Notice: Undefined array key "07" in %s on line 23
+NULL
+Done
diff --git a/Zend/tests/numeric_strings/explicit_cast_leading_numeric_must_work.phpt b/Zend/tests/numeric_strings/explicit_cast_leading_numeric_must_work.phpt
new file mode 100644
index 0000000000..8c906e8f81
--- /dev/null
+++ b/Zend/tests/numeric_strings/explicit_cast_leading_numeric_must_work.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Explicit cast of leading numeric strings should still work without warning
+--FILE--
+<?php
+
+var_dump((int) "2px");
+var_dump((float) "2px");
+var_dump((int) "2.5px");
+var_dump((float) "2.5px");
+
+?>
+--EXPECT--
+int(2)
+float(2)
+int(2)
+float(2.5)
diff --git a/Zend/tests/numeric_string_errors_assign.phpt b/Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt
index 69be0c114d..51df226348 100644
--- a/Zend/tests/numeric_string_errors_assign.phpt
+++ b/Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt
@@ -1,5 +1,5 @@
--TEST--
-Invalid numeric string E_WARNINGs and E_NOTICEs, combined assignment operations
+Invalid numeric string TypeErrors and E_WARNINGs, combined assignment operations
--FILE--
<?php
@@ -11,37 +11,57 @@ function foxcache($val) {
$a = foxcache("2 Lorem");
$a += "3 ipsum";
var_dump($a);
-$a = foxcache("dolor");
-$a += "sit";
-var_dump($a);
+try {
+ $a = foxcache("dolor");
+ $a += "sit";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("5 amet,");
$a -= "7 consectetur";
var_dump($a);
-$a = foxcache("adipiscing");
-$a -= "elit,";
-var_dump($a);
+try {
+ $a = foxcache("adipiscing");
+ $a -= "elit,";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("11 sed");
$a *= "13 do";
var_dump($a);
-$a = foxcache("eiusmod");
-$a *= "tempor";
-var_dump($a);
+try {
+ $a = foxcache("eiusmod");
+ $a *= "tempor";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("17 incididunt");
$a /= "19 ut";
var_dump($a);
-$a = foxcache("labore");
-$a /= "et";
-var_dump($a);
+try {
+ $a = foxcache("labore");
+ $a /= "et";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("23 dolore");
$a **= "29 magna";
var_dump($a);
-$a = foxcache("aliqua.");
-$a **= "Ut";
-var_dump($a);
+try {
+ $a = foxcache("aliqua.");
+ $a **= "Ut";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("31 enim");
$a %= "37 ad";
@@ -50,22 +70,31 @@ try {
$a = foxcache("minim");
$a %= "veniam,";
var_dump($a);
-} catch (DivisionByZeroError $e) {
+} catch (\TypeError $e) {
+ echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL;
}
echo "---", PHP_EOL;
$a = foxcache("41 minim");
$a <<= "43 veniam,";
-var_dump($a);
-$a = foxcache("quis");
-$a <<= "nostrud";
+try {
+ var_dump($a);
+ $a = foxcache("quis");
+ $a <<= "nostrud";
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump($a);
echo "---", PHP_EOL;
$a = foxcache("47 exercitation");
$a >>= "53 ullamco";
var_dump($a);
-$a = foxcache("laboris");
-$a >>= "nisi";
-var_dump($a);
+try {
+ $a = foxcache("laboris");
+ $a >>= "nisi";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("59 ut");
$a |= 61;
@@ -73,12 +102,20 @@ var_dump($a);
$a = foxcache(67);
$a |= "71 aliquip";
var_dump($a);
-$a = foxcache("ex");
-$a |= 73;
-var_dump($a);
-$a = foxcache(79);
-$a |= "ea";
-var_dump($a);
+try {
+ $a = foxcache("ex");
+ $a |= 73;
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ $a = foxcache(79);
+ $a |= "ea";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("83 commodo");
$a &= 89;
@@ -86,12 +123,20 @@ var_dump($a);
$a = foxcache(97);
$a &= "101 consequat.";
var_dump($a);
-$a = foxcache("Duis");
-$a &= 103;
-var_dump($a);
-$a = foxcache(107);
-$a &= "aute";
-var_dump($a);
+try {
+ $a = foxcache("Duis");
+ $a &= 103;
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ $a = foxcache(107);
+ $a &= "aute";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("109 irure");
$a ^= 113;
@@ -99,137 +144,101 @@ var_dump($a);
$a = foxcache(127);
$a ^= "131 dolor";
var_dump($a);
-$a = foxcache("in");
-$a ^= 137;
-var_dump($a);
-$a = foxcache(139);
-$a ^= "reprehenderit";
-var_dump($a);
+try {
+ $a = foxcache("in");
+ $a ^= 137;
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ $a = foxcache(139);
+ $a ^= "reprehenderit";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
--EXPECTF--
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(5)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(5)
+Unsupported operand types: string + string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(-2)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(-2)
+Unsupported operand types: string - string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(143)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(143)
+Unsupported operand types: string * string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-float(0.8947368421052632)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-
-Warning: Division by zero in %s on line %d
-float(NAN)
+float(0.8947368421052632)
+Unsupported operand types: string / string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-float(3.0910586430935376E+39)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(1)
+float(3.0910586430935376E+39)
+Unsupported operand types: string ** string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(31)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
+int(31)
+TypeError: Unsupported operand types: string % string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(%d)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(%d)
+Unsupported operand types: string << string
+string(4) "quis"
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(0)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(0)
+Unsupported operand types: string >> string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(63)
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(71)
-
Warning: A non-numeric value encountered in %s on line %d
-int(73)
+int(63)
Warning: A non-numeric value encountered in %s on line %d
-int(79)
+int(71)
+Unsupported operand types: string | int
+Unsupported operand types: int | string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(81)
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(97)
-
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(81)
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(97)
+Unsupported operand types: string & int
+Unsupported operand types: int & string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(28)
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(252)
-
Warning: A non-numeric value encountered in %s on line %d
-int(137)
+int(28)
Warning: A non-numeric value encountered in %s on line %d
-int(139)
+int(252)
+Unsupported operand types: string ^ int
+Unsupported operand types: int ^ string
diff --git a/Zend/tests/numeric_string_errors.phpt b/Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt
index 83c948981b..3ffe78a119 100644
--- a/Zend/tests/numeric_string_errors.phpt
+++ b/Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt
@@ -1,194 +1,206 @@
--TEST--
-Invalid numeric string E_WARNINGs and E_NOTICEs
+Invalid numeric string TypeErrors and E_WARNINGs
--FILE--
<?php
var_dump("2 Lorem" + "3 ipsum");
-var_dump("dolor" + "sit");
+try {
+ var_dump("dolor" + "sit");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("5 amet," - "7 consectetur");
-var_dump("adipiscing" - "elit,");
+try {
+ var_dump("adipiscing" - "elit,");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("11 sed" * "13 do");
-var_dump("eiusmod" * "tempor");
+try {
+ var_dump("eiusmod" * "tempor");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("17 incididunt" / "19 ut");
-var_dump("labore" / "et");
+try {
+ var_dump("labore" / "et");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("23 dolore" ** "29 magna");
-var_dump("aliqua." ** "Ut");
+try {
+ var_dump("aliqua." ** "Ut");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("31 enim" % "37 ad");
try {
var_dump("minim" % "veniam,");
-} catch (DivisionByZeroError $e) {
+} catch (\TypeError $e) {
+ echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL;
}
echo "---", PHP_EOL;
var_dump("41 minim" << "43 veniam,");
-var_dump("quis" << "nostrud");
+try {
+ var_dump("quis" << "nostrud");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("47 exercitation" >> "53 ullamco");
-var_dump("laboris" >> "nisi");
+try {
+ var_dump("laboris" >> "nisi");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("59 ut" | 61);
var_dump(67 | "71 aliquip");
-var_dump("ex" | 73);
-var_dump(79 | "ea");
+try {
+ var_dump("ex" | 73);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(79 | "ea");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("83 commodo" & 89);
var_dump(97 & "101 consequat.");
-var_dump("Duis" & 103);
-var_dump(107 & "aute");
+try {
+ var_dump("Duis" & 103);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(107 & "aute");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("109 irure" ^ 113);
var_dump(127 ^ "131 dolor");
-var_dump("in" ^ 137);
-var_dump(139 ^ "reprehenderit");
+try {
+ var_dump("in" ^ 137);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(139 ^ "reprehenderit");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump(+"149 in");
-var_dump(+"voluptate");
+try {
+ var_dump(+"voluptate");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump(-"151 velit");
-var_dump(-"esse");
+try {
+ var_dump(-"esse");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
--EXPECTF--
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(5)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(5)
+Unsupported operand types: string + string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(-2)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(-2)
+Unsupported operand types: string - string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(143)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(143)
+Unsupported operand types: string * string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-float(0.8947368421052632)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-
-Warning: Division by zero in %s on line %d
-float(NAN)
+float(0.8947368421052632)
+Unsupported operand types: string / string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-float(3.0910586430935376E+39)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(1)
+float(3.0910586430935376E+39)
+Unsupported operand types: string ** string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(31)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
+int(31)
+TypeError: Unsupported operand types: string % string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(%d)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(%d)
+Unsupported operand types: string << string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(0)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(0)
+Unsupported operand types: string >> string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(63)
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(71)
-
Warning: A non-numeric value encountered in %s on line %d
-int(73)
+int(63)
Warning: A non-numeric value encountered in %s on line %d
-int(79)
+int(71)
+Unsupported operand types: string | int
+Unsupported operand types: int | string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(81)
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(97)
-
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(81)
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(97)
+Unsupported operand types: string & int
+Unsupported operand types: int & string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(28)
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(252)
-
Warning: A non-numeric value encountered in %s on line %d
-int(137)
+int(28)
Warning: A non-numeric value encountered in %s on line %d
-int(139)
+int(252)
+Unsupported operand types: string ^ int
+Unsupported operand types: int ^ string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(149)
-
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(149)
+Unsupported operand types: int * string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(-151)
-
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(-151)
+Unsupported operand types: int * string
diff --git a/Zend/tests/neg_num_string.phpt b/Zend/tests/numeric_strings/neg_num_string.phpt
index 018568adea..018568adea 100644
--- a/Zend/tests/neg_num_string.phpt
+++ b/Zend/tests/numeric_strings/neg_num_string.phpt
diff --git a/Zend/tests/numeric_strings/string_offset.phpt b/Zend/tests/numeric_strings/string_offset.phpt
new file mode 100644
index 0000000000..0c43bc1512
--- /dev/null
+++ b/Zend/tests/numeric_strings/string_offset.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Using different sorts of numerical strings as a string offset
+--FILE--
+<?php
+
+$str = "The world is fun";
+
+$keys = [
+ "7",
+ "7.5",
+ " 7",
+ " 7.5",
+ " 7 ",
+ " 7.5 ",
+ "7 ",
+ "7.5 ",
+ "7str",
+ "7.5str",
+ " 7str",
+ " 7.5str",
+ " 7 str",
+ " 7.5 str",
+ "7 str",
+ "7.5 str",
+ "0xC",
+ "0b10",
+ "07",
+];
+
+foreach ($keys as $key) {
+ try {
+ var_dump($str[$key]);
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(1) "l"
+Cannot access offset of type string on string
+string(1) "l"
+Cannot access offset of type string on string
+string(1) "l"
+Cannot access offset of type string on string
+string(1) "l"
+Cannot access offset of type string on string
+
+Warning: Illegal string offset "7str" in %s on line %d
+string(1) "l"
+Cannot access offset of type string on string
+
+Warning: Illegal string offset " 7str" in %s on line %d
+string(1) "l"
+Cannot access offset of type string on string
+
+Warning: Illegal string offset " 7 str" in %s on line %d
+string(1) "l"
+Cannot access offset of type string on string
+
+Warning: Illegal string offset "7 str" in %s on line %d
+string(1) "l"
+Cannot access offset of type string on string
+
+Warning: Illegal string offset "0xC" in %s on line %d
+string(1) "T"
+
+Warning: Illegal string offset "0b10" in %s on line %d
+string(1) "T"
+string(1) "l"
+Done
diff --git a/Zend/tests/offset_assign.phpt b/Zend/tests/offset_assign.phpt
index d4c56b30c8..d2e33cafbf 100644
--- a/Zend/tests/offset_assign.phpt
+++ b/Zend/tests/offset_assign.phpt
@@ -1,14 +1,14 @@
--TEST--
-Crash on $x['x']['y'] += 1 when $x is string
+Crash on $x['2x']['y'] += 1 when $x is string
--FILE--
<?php
$x = "a";
-$x['x']['y'] += 1;
+$x['2x']['y'] += 1;
echo "Done\n";
?>
--EXPECTF--
-Warning: Illegal string offset "x" in %s on line %d
+Warning: Illegal string offset "2x" in %s on line %d
Fatal error: Uncaught Error: Cannot use string offset as an array in %soffset_assign.php:%d
Stack trace:
diff --git a/Zend/tests/offset_string.phpt b/Zend/tests/offset_string.phpt
index 4c7debcaa9..36481dccce 100644
--- a/Zend/tests/offset_string.phpt
+++ b/Zend/tests/offset_string.phpt
@@ -8,9 +8,17 @@ $str = "Sitting on a corner all alone, staring from the bottom of his soul";
var_dump($str[1]);
var_dump($str[0.0836]);
var_dump($str[NULL]);
-var_dump($str["run away"]);
+try {
+ var_dump($str["run away"]);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump($str["13"]);
-var_dump($str["14.5"]);
+try {
+ var_dump($str["14.5"]);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump($str["15 and then some"]);
var_dump($str[TRUE]);
@@ -47,15 +55,11 @@ string(1) "S"
Warning: String offset cast occurred in %s on line %d
string(1) "S"
-
-Warning: Illegal string offset "run away" in %s on line %d
-string(1) "S"
+Cannot access offset of type string on string
string(1) "c"
+Cannot access offset of type string on string
-Warning: Illegal string offset "14.5" in %s on line %d
-string(1) "o"
-
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: Illegal string offset "15 and then some" in %s on line %d
string(1) "r"
Warning: String offset cast occurred in %s on line %d
@@ -63,9 +67,9 @@ string(1) "i"
Warning: String offset cast occurred in %s on line %d
string(1) "S"
-Illegal offset type
+Cannot access offset of type resource on string
Notice: Object of class stdClass could not be converted to int in %s on line %d
-Illegal offset type
-Illegal offset type
+Cannot access offset of type stdClass on string
+Cannot access offset of type array on string
Done
diff --git a/Zend/tests/operator_unsupported_types.phpt b/Zend/tests/operator_unsupported_types.phpt
index 4b27f722d7..94e23ec603 100644
--- a/Zend/tests/operator_unsupported_types.phpt
+++ b/Zend/tests/operator_unsupported_types.phpt
@@ -24,6 +24,7 @@ $illegalValues = [
'[]',
'new stdClass',
'STDOUT',
+ '"foo"',
];
$legalValues = [
'null',
@@ -32,7 +33,7 @@ $legalValues = [
'2',
'3.5',
'"123"',
- '"foo"', // Semi-legal.
+ '"123foo"', // Semi-legal
];
set_error_handler(function($errno, $errstr) {
@@ -128,12 +129,19 @@ BINARY OP:
No error for [] + []
Unsupported operand types: array + stdClass
Unsupported operand types: array + resource
+Unsupported operand types: array + string
Unsupported operand types: stdClass + array
Unsupported operand types: stdClass + stdClass
Unsupported operand types: stdClass + resource
+Unsupported operand types: stdClass + string
Unsupported operand types: resource + array
Unsupported operand types: resource + stdClass
Unsupported operand types: resource + resource
+Unsupported operand types: resource + string
+Unsupported operand types: string + array
+Unsupported operand types: string + stdClass
+Unsupported operand types: string + resource
+Unsupported operand types: string + string
Unsupported operand types: array + null
Unsupported operand types: null + array
Unsupported operand types: array + bool
@@ -179,15 +187,37 @@ Unsupported operand types: string + resource
Unsupported operand types: resource + string
Warning: A non-numeric value encountered
Unsupported operand types: string + resource
+Unsupported operand types: string + null
+Unsupported operand types: null + string
+Unsupported operand types: string + bool
+Unsupported operand types: bool + string
+Unsupported operand types: string + bool
+Unsupported operand types: bool + string
+Unsupported operand types: string + int
+Unsupported operand types: int + string
+Unsupported operand types: string + float
+Unsupported operand types: float + string
+Unsupported operand types: string + string
+Unsupported operand types: string + string
+Unsupported operand types: string + string
+Warning: A non-numeric value encountered
+Unsupported operand types: string + string
Unsupported operand types: array - array
Unsupported operand types: array - stdClass
Unsupported operand types: array - resource
+Unsupported operand types: array - string
Unsupported operand types: stdClass - array
Unsupported operand types: stdClass - stdClass
Unsupported operand types: stdClass - resource
+Unsupported operand types: stdClass - string
Unsupported operand types: resource - array
Unsupported operand types: resource - stdClass
Unsupported operand types: resource - resource
+Unsupported operand types: resource - string
+Unsupported operand types: string - array
+Unsupported operand types: string - stdClass
+Unsupported operand types: string - resource
+Unsupported operand types: string - string
Unsupported operand types: array - null
Unsupported operand types: null - array
Unsupported operand types: array - bool
@@ -233,15 +263,37 @@ Unsupported operand types: string - resource
Unsupported operand types: resource - string
Warning: A non-numeric value encountered
Unsupported operand types: string - resource
+Unsupported operand types: string - null
+Unsupported operand types: null - string
+Unsupported operand types: string - bool
+Unsupported operand types: bool - string
+Unsupported operand types: string - bool
+Unsupported operand types: bool - string
+Unsupported operand types: string - int
+Unsupported operand types: int - string
+Unsupported operand types: string - float
+Unsupported operand types: float - string
+Unsupported operand types: string - string
+Unsupported operand types: string - string
+Unsupported operand types: string - string
+Warning: A non-numeric value encountered
+Unsupported operand types: string - string
Unsupported operand types: array * array
Unsupported operand types: stdClass * array
Unsupported operand types: resource * array
+Unsupported operand types: array * string
Unsupported operand types: stdClass * array
Unsupported operand types: stdClass * stdClass
Unsupported operand types: stdClass * resource
+Unsupported operand types: stdClass * string
Unsupported operand types: resource * array
Unsupported operand types: stdClass * resource
Unsupported operand types: resource * resource
+Unsupported operand types: resource * string
+Unsupported operand types: string * array
+Unsupported operand types: stdClass * string
+Unsupported operand types: resource * string
+Unsupported operand types: string * string
Unsupported operand types: array * null
Unsupported operand types: null * array
Unsupported operand types: array * bool
@@ -285,15 +337,37 @@ Unsupported operand types: resource * string
Unsupported operand types: resource * string
Unsupported operand types: resource * string
Unsupported operand types: resource * string
+Unsupported operand types: string * null
+Unsupported operand types: null * string
+Unsupported operand types: string * bool
+Unsupported operand types: bool * string
+Unsupported operand types: string * bool
+Unsupported operand types: bool * string
+Unsupported operand types: string * int
+Unsupported operand types: int * string
+Unsupported operand types: string * float
+Unsupported operand types: float * string
+Unsupported operand types: string * string
+Unsupported operand types: string * string
+Unsupported operand types: string * string
+Warning: A non-numeric value encountered
+Unsupported operand types: string * string
Unsupported operand types: array / array
Unsupported operand types: array / stdClass
Unsupported operand types: array / resource
+Unsupported operand types: array / string
Unsupported operand types: stdClass / array
Unsupported operand types: stdClass / stdClass
Unsupported operand types: stdClass / resource
+Unsupported operand types: stdClass / string
Unsupported operand types: resource / array
Unsupported operand types: resource / stdClass
Unsupported operand types: resource / resource
+Unsupported operand types: resource / string
+Unsupported operand types: string / array
+Unsupported operand types: string / stdClass
+Unsupported operand types: string / resource
+Unsupported operand types: string / string
Unsupported operand types: array / null
Unsupported operand types: null / array
Unsupported operand types: array / bool
@@ -339,15 +413,37 @@ Unsupported operand types: string / resource
Unsupported operand types: resource / string
Warning: A non-numeric value encountered
Unsupported operand types: string / resource
+Unsupported operand types: string / null
+Unsupported operand types: null / string
+Unsupported operand types: string / bool
+Unsupported operand types: bool / string
+Unsupported operand types: string / bool
+Unsupported operand types: bool / string
+Unsupported operand types: string / int
+Unsupported operand types: int / string
+Unsupported operand types: string / float
+Unsupported operand types: float / string
+Unsupported operand types: string / string
+Unsupported operand types: string / string
+Unsupported operand types: string / string
+Warning: A non-numeric value encountered
+Unsupported operand types: string / string
Unsupported operand types: array % array
Unsupported operand types: array % stdClass
Unsupported operand types: array % resource
+Unsupported operand types: array % string
Unsupported operand types: stdClass % array
Unsupported operand types: stdClass % stdClass
Unsupported operand types: stdClass % resource
+Unsupported operand types: stdClass % string
Unsupported operand types: resource % array
Unsupported operand types: resource % stdClass
Unsupported operand types: resource % resource
+Unsupported operand types: resource % string
+Unsupported operand types: string % array
+Unsupported operand types: string % stdClass
+Unsupported operand types: string % resource
+Unsupported operand types: string % string
Unsupported operand types: array % null
Unsupported operand types: null % array
Unsupported operand types: array % bool
@@ -393,15 +489,37 @@ Unsupported operand types: string % resource
Unsupported operand types: resource % string
Warning: A non-numeric value encountered
Unsupported operand types: string % resource
+Unsupported operand types: string % null
+Unsupported operand types: null % string
+Unsupported operand types: string % bool
+Unsupported operand types: bool % string
+Unsupported operand types: string % bool
+Unsupported operand types: bool % string
+Unsupported operand types: string % int
+Unsupported operand types: int % string
+Unsupported operand types: string % float
+Unsupported operand types: float % string
+Unsupported operand types: string % string
+Unsupported operand types: string % string
+Unsupported operand types: string % string
+Warning: A non-numeric value encountered
+Unsupported operand types: string % string
Unsupported operand types: array ** array
Unsupported operand types: array ** stdClass
Unsupported operand types: array ** resource
+Unsupported operand types: array ** string
Unsupported operand types: stdClass ** array
Unsupported operand types: stdClass ** stdClass
Unsupported operand types: stdClass ** resource
+Unsupported operand types: stdClass ** string
Unsupported operand types: resource ** array
Unsupported operand types: resource ** stdClass
Unsupported operand types: resource ** resource
+Unsupported operand types: resource ** string
+Unsupported operand types: string ** array
+Unsupported operand types: string ** stdClass
+Unsupported operand types: string ** resource
+Unsupported operand types: string ** string
Unsupported operand types: array ** null
Unsupported operand types: null ** array
Unsupported operand types: array ** bool
@@ -447,15 +565,37 @@ Unsupported operand types: string ** resource
Unsupported operand types: resource ** string
Warning: A non-numeric value encountered
Unsupported operand types: string ** resource
+Unsupported operand types: string ** null
+Unsupported operand types: null ** string
+Unsupported operand types: string ** bool
+Unsupported operand types: bool ** string
+Unsupported operand types: string ** bool
+Unsupported operand types: bool ** string
+Unsupported operand types: string ** int
+Unsupported operand types: int ** string
+Unsupported operand types: string ** float
+Unsupported operand types: float ** string
+Unsupported operand types: string ** string
+Unsupported operand types: string ** string
+Unsupported operand types: string ** string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ** string
Unsupported operand types: array << array
Unsupported operand types: array << stdClass
Unsupported operand types: array << resource
+Unsupported operand types: array << string
Unsupported operand types: stdClass << array
Unsupported operand types: stdClass << stdClass
Unsupported operand types: stdClass << resource
+Unsupported operand types: stdClass << string
Unsupported operand types: resource << array
Unsupported operand types: resource << stdClass
Unsupported operand types: resource << resource
+Unsupported operand types: resource << string
+Unsupported operand types: string << array
+Unsupported operand types: string << stdClass
+Unsupported operand types: string << resource
+Unsupported operand types: string << string
Unsupported operand types: array << null
Unsupported operand types: null << array
Unsupported operand types: array << bool
@@ -501,15 +641,37 @@ Unsupported operand types: string << resource
Unsupported operand types: resource << string
Warning: A non-numeric value encountered
Unsupported operand types: string << resource
+Unsupported operand types: string << null
+Unsupported operand types: null << string
+Unsupported operand types: string << bool
+Unsupported operand types: bool << string
+Unsupported operand types: string << bool
+Unsupported operand types: bool << string
+Unsupported operand types: string << int
+Unsupported operand types: int << string
+Unsupported operand types: string << float
+Unsupported operand types: float << string
+Unsupported operand types: string << string
+Unsupported operand types: string << string
+Unsupported operand types: string << string
+Warning: A non-numeric value encountered
+Unsupported operand types: string << string
Unsupported operand types: array >> array
Unsupported operand types: array >> stdClass
Unsupported operand types: array >> resource
+Unsupported operand types: array >> string
Unsupported operand types: stdClass >> array
Unsupported operand types: stdClass >> stdClass
Unsupported operand types: stdClass >> resource
+Unsupported operand types: stdClass >> string
Unsupported operand types: resource >> array
Unsupported operand types: resource >> stdClass
Unsupported operand types: resource >> resource
+Unsupported operand types: resource >> string
+Unsupported operand types: string >> array
+Unsupported operand types: string >> stdClass
+Unsupported operand types: string >> resource
+Unsupported operand types: string >> string
Unsupported operand types: array >> null
Unsupported operand types: null >> array
Unsupported operand types: array >> bool
@@ -555,15 +717,37 @@ Unsupported operand types: string >> resource
Unsupported operand types: resource >> string
Warning: A non-numeric value encountered
Unsupported operand types: string >> resource
+Unsupported operand types: string >> null
+Unsupported operand types: null >> string
+Unsupported operand types: string >> bool
+Unsupported operand types: bool >> string
+Unsupported operand types: string >> bool
+Unsupported operand types: bool >> string
+Unsupported operand types: string >> int
+Unsupported operand types: int >> string
+Unsupported operand types: string >> float
+Unsupported operand types: float >> string
+Unsupported operand types: string >> string
+Unsupported operand types: string >> string
+Unsupported operand types: string >> string
+Warning: A non-numeric value encountered
+Unsupported operand types: string >> string
Unsupported operand types: array & array
Unsupported operand types: stdClass & array
Unsupported operand types: resource & array
+Unsupported operand types: array & string
Unsupported operand types: stdClass & array
Unsupported operand types: stdClass & stdClass
Unsupported operand types: stdClass & resource
+Unsupported operand types: stdClass & string
Unsupported operand types: resource & array
Unsupported operand types: stdClass & resource
Unsupported operand types: resource & resource
+Unsupported operand types: resource & string
+Unsupported operand types: string & array
+Unsupported operand types: stdClass & string
+Unsupported operand types: resource & string
+No error for "foo" & "foo"
Unsupported operand types: array & null
Unsupported operand types: null & array
Unsupported operand types: array & bool
@@ -607,15 +791,36 @@ Unsupported operand types: resource & string
Unsupported operand types: resource & string
Unsupported operand types: resource & string
Unsupported operand types: resource & string
+Unsupported operand types: string & null
+Unsupported operand types: null & string
+Unsupported operand types: string & bool
+Unsupported operand types: bool & string
+Unsupported operand types: string & bool
+Unsupported operand types: bool & string
+Unsupported operand types: string & int
+Unsupported operand types: int & string
+Unsupported operand types: string & float
+Unsupported operand types: float & string
+No error for "foo" & "123"
+No error for "123" & "foo"
+No error for "foo" & "123foo"
+No error for "123foo" & "foo"
Unsupported operand types: array | array
Unsupported operand types: stdClass | array
Unsupported operand types: resource | array
+Unsupported operand types: array | string
Unsupported operand types: stdClass | array
Unsupported operand types: stdClass | stdClass
Unsupported operand types: stdClass | resource
+Unsupported operand types: stdClass | string
Unsupported operand types: resource | array
Unsupported operand types: stdClass | resource
Unsupported operand types: resource | resource
+Unsupported operand types: resource | string
+Unsupported operand types: string | array
+Unsupported operand types: stdClass | string
+Unsupported operand types: resource | string
+No error for "foo" | "foo"
Unsupported operand types: array | null
Unsupported operand types: null | array
Unsupported operand types: array | bool
@@ -659,15 +864,36 @@ Unsupported operand types: resource | string
Unsupported operand types: resource | string
Unsupported operand types: resource | string
Unsupported operand types: resource | string
+Unsupported operand types: string | null
+Unsupported operand types: null | string
+Unsupported operand types: string | bool
+Unsupported operand types: bool | string
+Unsupported operand types: string | bool
+Unsupported operand types: bool | string
+Unsupported operand types: string | int
+Unsupported operand types: int | string
+Unsupported operand types: string | float
+Unsupported operand types: float | string
+No error for "foo" | "123"
+No error for "123" | "foo"
+No error for "foo" | "123foo"
+No error for "123foo" | "foo"
Unsupported operand types: array ^ array
Unsupported operand types: stdClass ^ array
Unsupported operand types: resource ^ array
+Unsupported operand types: array ^ string
Unsupported operand types: stdClass ^ array
Unsupported operand types: stdClass ^ stdClass
Unsupported operand types: stdClass ^ resource
+Unsupported operand types: stdClass ^ string
Unsupported operand types: resource ^ array
Unsupported operand types: stdClass ^ resource
Unsupported operand types: resource ^ resource
+Unsupported operand types: resource ^ string
+Unsupported operand types: string ^ array
+Unsupported operand types: stdClass ^ string
+Unsupported operand types: resource ^ string
+No error for "foo" ^ "foo"
Unsupported operand types: array ^ null
Unsupported operand types: null ^ array
Unsupported operand types: array ^ bool
@@ -711,15 +937,36 @@ Unsupported operand types: resource ^ string
Unsupported operand types: resource ^ string
Unsupported operand types: resource ^ string
Unsupported operand types: resource ^ string
+Unsupported operand types: string ^ null
+Unsupported operand types: null ^ string
+Unsupported operand types: string ^ bool
+Unsupported operand types: bool ^ string
+Unsupported operand types: string ^ bool
+Unsupported operand types: bool ^ string
+Unsupported operand types: string ^ int
+Unsupported operand types: int ^ string
+Unsupported operand types: string ^ float
+Unsupported operand types: float ^ string
+No error for "foo" ^ "123"
+No error for "123" ^ "foo"
+No error for "foo" ^ "123foo"
+No error for "123foo" ^ "foo"
No error for [] xor []
No error for [] xor new stdClass
No error for [] xor STDOUT
+No error for [] xor "foo"
No error for new stdClass xor []
No error for new stdClass xor new stdClass
No error for new stdClass xor STDOUT
+No error for new stdClass xor "foo"
No error for STDOUT xor []
No error for STDOUT xor new stdClass
No error for STDOUT xor STDOUT
+No error for STDOUT xor "foo"
+No error for "foo" xor []
+No error for "foo" xor new stdClass
+No error for "foo" xor STDOUT
+No error for "foo" xor "foo"
No error for [] xor null
No error for null xor []
No error for [] xor true
@@ -732,8 +979,8 @@ No error for [] xor 3.5
No error for 3.5 xor []
No error for [] xor "123"
No error for "123" xor []
-No error for [] xor "foo"
-No error for "foo" xor []
+No error for [] xor "123foo"
+No error for "123foo" xor []
No error for new stdClass xor null
No error for null xor new stdClass
No error for new stdClass xor true
@@ -746,8 +993,8 @@ No error for new stdClass xor 3.5
No error for 3.5 xor new stdClass
No error for new stdClass xor "123"
No error for "123" xor new stdClass
-No error for new stdClass xor "foo"
-No error for "foo" xor new stdClass
+No error for new stdClass xor "123foo"
+No error for "123foo" xor new stdClass
No error for STDOUT xor null
No error for null xor STDOUT
No error for STDOUT xor true
@@ -760,8 +1007,22 @@ No error for STDOUT xor 3.5
No error for 3.5 xor STDOUT
No error for STDOUT xor "123"
No error for "123" xor STDOUT
-No error for STDOUT xor "foo"
-No error for "foo" xor STDOUT
+No error for STDOUT xor "123foo"
+No error for "123foo" xor STDOUT
+No error for "foo" xor null
+No error for null xor "foo"
+No error for "foo" xor true
+No error for true xor "foo"
+No error for "foo" xor false
+No error for false xor "foo"
+No error for "foo" xor 2
+No error for 2 xor "foo"
+No error for "foo" xor 3.5
+No error for 3.5 xor "foo"
+No error for "foo" xor "123"
+No error for "123" xor "foo"
+No error for "foo" xor "123foo"
+No error for "123foo" xor "foo"
Warning: Array to string conversion
Warning: Array to string conversion
No error for [] . []
@@ -770,6 +1031,9 @@ Object of class stdClass could not be converted to string
Warning: Array to string conversion
No error for [] . STDOUT
Warning: Array to string conversion
+No error for [] . "foo"
+Warning: Array to string conversion
+Object of class stdClass could not be converted to string
Object of class stdClass could not be converted to string
Object of class stdClass could not be converted to string
Object of class stdClass could not be converted to string
@@ -777,6 +1041,12 @@ Warning: Array to string conversion
No error for STDOUT . []
Object of class stdClass could not be converted to string
No error for STDOUT . STDOUT
+No error for STDOUT . "foo"
+Warning: Array to string conversion
+No error for "foo" . []
+Object of class stdClass could not be converted to string
+No error for "foo" . STDOUT
+No error for "foo" . "foo"
Warning: Array to string conversion
No error for [] . null
Warning: Array to string conversion
@@ -802,9 +1072,9 @@ No error for [] . "123"
Warning: Array to string conversion
No error for "123" . []
Warning: Array to string conversion
-No error for [] . "foo"
+No error for [] . "123foo"
Warning: Array to string conversion
-No error for "foo" . []
+No error for "123foo" . []
Object of class stdClass could not be converted to string
Object of class stdClass could not be converted to string
Object of class stdClass could not be converted to string
@@ -831,20 +1101,41 @@ No error for STDOUT . 3.5
No error for 3.5 . STDOUT
No error for STDOUT . "123"
No error for "123" . STDOUT
-No error for STDOUT . "foo"
-No error for "foo" . STDOUT
+No error for STDOUT . "123foo"
+No error for "123foo" . STDOUT
+No error for "foo" . null
+No error for null . "foo"
+No error for "foo" . true
+No error for true . "foo"
+No error for "foo" . false
+No error for false . "foo"
+No error for "foo" . 2
+No error for 2 . "foo"
+No error for "foo" . 3.5
+No error for 3.5 . "foo"
+No error for "foo" . "123"
+No error for "123" . "foo"
+No error for "foo" . "123foo"
+No error for "123foo" . "foo"
ASSIGN OP:
No error for [] += []
Unsupported operand types: array + stdClass
Unsupported operand types: array + resource
+Unsupported operand types: array + string
Unsupported operand types: stdClass + array
Unsupported operand types: stdClass + stdClass
Unsupported operand types: stdClass + resource
+Unsupported operand types: stdClass + string
Unsupported operand types: resource + array
Unsupported operand types: resource + stdClass
Unsupported operand types: resource + resource
+Unsupported operand types: resource + string
+Unsupported operand types: string + array
+Unsupported operand types: string + stdClass
+Unsupported operand types: string + resource
+Unsupported operand types: string + string
Unsupported operand types: array + null
Unsupported operand types: null + array
Unsupported operand types: array + bool
@@ -890,15 +1181,37 @@ Unsupported operand types: string + resource
Unsupported operand types: resource + string
Warning: A non-numeric value encountered
Unsupported operand types: string + resource
+Unsupported operand types: string + null
+Unsupported operand types: null + string
+Unsupported operand types: string + bool
+Unsupported operand types: bool + string
+Unsupported operand types: string + bool
+Unsupported operand types: bool + string
+Unsupported operand types: string + int
+Unsupported operand types: int + string
+Unsupported operand types: string + float
+Unsupported operand types: float + string
+Unsupported operand types: string + string
+Unsupported operand types: string + string
+Unsupported operand types: string + string
+Warning: A non-numeric value encountered
+Unsupported operand types: string + string
Unsupported operand types: array - array
Unsupported operand types: array - stdClass
Unsupported operand types: array - resource
+Unsupported operand types: array - string
Unsupported operand types: stdClass - array
Unsupported operand types: stdClass - stdClass
Unsupported operand types: stdClass - resource
+Unsupported operand types: stdClass - string
Unsupported operand types: resource - array
Unsupported operand types: resource - stdClass
Unsupported operand types: resource - resource
+Unsupported operand types: resource - string
+Unsupported operand types: string - array
+Unsupported operand types: string - stdClass
+Unsupported operand types: string - resource
+Unsupported operand types: string - string
Unsupported operand types: array - null
Unsupported operand types: null - array
Unsupported operand types: array - bool
@@ -944,15 +1257,37 @@ Unsupported operand types: string - resource
Unsupported operand types: resource - string
Warning: A non-numeric value encountered
Unsupported operand types: string - resource
+Unsupported operand types: string - null
+Unsupported operand types: null - string
+Unsupported operand types: string - bool
+Unsupported operand types: bool - string
+Unsupported operand types: string - bool
+Unsupported operand types: bool - string
+Unsupported operand types: string - int
+Unsupported operand types: int - string
+Unsupported operand types: string - float
+Unsupported operand types: float - string
+Unsupported operand types: string - string
+Unsupported operand types: string - string
+Unsupported operand types: string - string
+Warning: A non-numeric value encountered
+Unsupported operand types: string - string
Unsupported operand types: array * array
Unsupported operand types: array * stdClass
Unsupported operand types: array * resource
+Unsupported operand types: array * string
Unsupported operand types: stdClass * array
Unsupported operand types: stdClass * stdClass
Unsupported operand types: stdClass * resource
+Unsupported operand types: stdClass * string
Unsupported operand types: resource * array
Unsupported operand types: resource * stdClass
Unsupported operand types: resource * resource
+Unsupported operand types: resource * string
+Unsupported operand types: string * array
+Unsupported operand types: string * stdClass
+Unsupported operand types: string * resource
+Unsupported operand types: string * string
Unsupported operand types: array * null
Unsupported operand types: null * array
Unsupported operand types: array * bool
@@ -998,15 +1333,37 @@ Unsupported operand types: string * resource
Unsupported operand types: resource * string
Warning: A non-numeric value encountered
Unsupported operand types: string * resource
+Unsupported operand types: string * null
+Unsupported operand types: null * string
+Unsupported operand types: string * bool
+Unsupported operand types: bool * string
+Unsupported operand types: string * bool
+Unsupported operand types: bool * string
+Unsupported operand types: string * int
+Unsupported operand types: int * string
+Unsupported operand types: string * float
+Unsupported operand types: float * string
+Unsupported operand types: string * string
+Unsupported operand types: string * string
+Unsupported operand types: string * string
+Warning: A non-numeric value encountered
+Unsupported operand types: string * string
Unsupported operand types: array / array
Unsupported operand types: array / stdClass
Unsupported operand types: array / resource
+Unsupported operand types: array / string
Unsupported operand types: stdClass / array
Unsupported operand types: stdClass / stdClass
Unsupported operand types: stdClass / resource
+Unsupported operand types: stdClass / string
Unsupported operand types: resource / array
Unsupported operand types: resource / stdClass
Unsupported operand types: resource / resource
+Unsupported operand types: resource / string
+Unsupported operand types: string / array
+Unsupported operand types: string / stdClass
+Unsupported operand types: string / resource
+Unsupported operand types: string / string
Unsupported operand types: array / null
Unsupported operand types: null / array
Unsupported operand types: array / bool
@@ -1052,15 +1409,37 @@ Unsupported operand types: string / resource
Unsupported operand types: resource / string
Warning: A non-numeric value encountered
Unsupported operand types: string / resource
+Unsupported operand types: string / null
+Unsupported operand types: null / string
+Unsupported operand types: string / bool
+Unsupported operand types: bool / string
+Unsupported operand types: string / bool
+Unsupported operand types: bool / string
+Unsupported operand types: string / int
+Unsupported operand types: int / string
+Unsupported operand types: string / float
+Unsupported operand types: float / string
+Unsupported operand types: string / string
+Unsupported operand types: string / string
+Unsupported operand types: string / string
+Warning: A non-numeric value encountered
+Unsupported operand types: string / string
Unsupported operand types: array % array
Unsupported operand types: array % stdClass
Unsupported operand types: array % resource
+Unsupported operand types: array % string
Unsupported operand types: stdClass % array
Unsupported operand types: stdClass % stdClass
Unsupported operand types: stdClass % resource
+Unsupported operand types: stdClass % string
Unsupported operand types: resource % array
Unsupported operand types: resource % stdClass
Unsupported operand types: resource % resource
+Unsupported operand types: resource % string
+Unsupported operand types: string % array
+Unsupported operand types: string % stdClass
+Unsupported operand types: string % resource
+Unsupported operand types: string % string
Unsupported operand types: array % null
Unsupported operand types: null % array
Unsupported operand types: array % bool
@@ -1106,15 +1485,37 @@ Unsupported operand types: string % resource
Unsupported operand types: resource % string
Warning: A non-numeric value encountered
Unsupported operand types: string % resource
+Unsupported operand types: string % null
+Unsupported operand types: null % string
+Unsupported operand types: string % bool
+Unsupported operand types: bool % string
+Unsupported operand types: string % bool
+Unsupported operand types: bool % string
+Unsupported operand types: string % int
+Unsupported operand types: int % string
+Unsupported operand types: string % float
+Unsupported operand types: float % string
+Unsupported operand types: string % string
+Unsupported operand types: string % string
+Unsupported operand types: string % string
+Warning: A non-numeric value encountered
+Unsupported operand types: string % string
Unsupported operand types: array ** array
Unsupported operand types: array ** stdClass
Unsupported operand types: array ** resource
+Unsupported operand types: array ** string
Unsupported operand types: stdClass ** array
Unsupported operand types: stdClass ** stdClass
Unsupported operand types: stdClass ** resource
+Unsupported operand types: stdClass ** string
Unsupported operand types: resource ** array
Unsupported operand types: resource ** stdClass
Unsupported operand types: resource ** resource
+Unsupported operand types: resource ** string
+Unsupported operand types: string ** array
+Unsupported operand types: string ** stdClass
+Unsupported operand types: string ** resource
+Unsupported operand types: string ** string
Unsupported operand types: array ** null
Unsupported operand types: null ** array
Unsupported operand types: array ** bool
@@ -1160,15 +1561,37 @@ Unsupported operand types: string ** resource
Unsupported operand types: resource ** string
Warning: A non-numeric value encountered
Unsupported operand types: string ** resource
+Unsupported operand types: string ** null
+Unsupported operand types: null ** string
+Unsupported operand types: string ** bool
+Unsupported operand types: bool ** string
+Unsupported operand types: string ** bool
+Unsupported operand types: bool ** string
+Unsupported operand types: string ** int
+Unsupported operand types: int ** string
+Unsupported operand types: string ** float
+Unsupported operand types: float ** string
+Unsupported operand types: string ** string
+Unsupported operand types: string ** string
+Unsupported operand types: string ** string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ** string
Unsupported operand types: array << array
Unsupported operand types: array << stdClass
Unsupported operand types: array << resource
+Unsupported operand types: array << string
Unsupported operand types: stdClass << array
Unsupported operand types: stdClass << stdClass
Unsupported operand types: stdClass << resource
+Unsupported operand types: stdClass << string
Unsupported operand types: resource << array
Unsupported operand types: resource << stdClass
Unsupported operand types: resource << resource
+Unsupported operand types: resource << string
+Unsupported operand types: string << array
+Unsupported operand types: string << stdClass
+Unsupported operand types: string << resource
+Unsupported operand types: string << string
Unsupported operand types: array << null
Unsupported operand types: null << array
Unsupported operand types: array << bool
@@ -1214,15 +1637,37 @@ Unsupported operand types: string << resource
Unsupported operand types: resource << string
Warning: A non-numeric value encountered
Unsupported operand types: string << resource
+Unsupported operand types: string << null
+Unsupported operand types: null << string
+Unsupported operand types: string << bool
+Unsupported operand types: bool << string
+Unsupported operand types: string << bool
+Unsupported operand types: bool << string
+Unsupported operand types: string << int
+Unsupported operand types: int << string
+Unsupported operand types: string << float
+Unsupported operand types: float << string
+Unsupported operand types: string << string
+Unsupported operand types: string << string
+Unsupported operand types: string << string
+Warning: A non-numeric value encountered
+Unsupported operand types: string << string
Unsupported operand types: array >> array
Unsupported operand types: array >> stdClass
Unsupported operand types: array >> resource
+Unsupported operand types: array >> string
Unsupported operand types: stdClass >> array
Unsupported operand types: stdClass >> stdClass
Unsupported operand types: stdClass >> resource
+Unsupported operand types: stdClass >> string
Unsupported operand types: resource >> array
Unsupported operand types: resource >> stdClass
Unsupported operand types: resource >> resource
+Unsupported operand types: resource >> string
+Unsupported operand types: string >> array
+Unsupported operand types: string >> stdClass
+Unsupported operand types: string >> resource
+Unsupported operand types: string >> string
Unsupported operand types: array >> null
Unsupported operand types: null >> array
Unsupported operand types: array >> bool
@@ -1268,15 +1713,37 @@ Unsupported operand types: string >> resource
Unsupported operand types: resource >> string
Warning: A non-numeric value encountered
Unsupported operand types: string >> resource
+Unsupported operand types: string >> null
+Unsupported operand types: null >> string
+Unsupported operand types: string >> bool
+Unsupported operand types: bool >> string
+Unsupported operand types: string >> bool
+Unsupported operand types: bool >> string
+Unsupported operand types: string >> int
+Unsupported operand types: int >> string
+Unsupported operand types: string >> float
+Unsupported operand types: float >> string
+Unsupported operand types: string >> string
+Unsupported operand types: string >> string
+Unsupported operand types: string >> string
+Warning: A non-numeric value encountered
+Unsupported operand types: string >> string
Unsupported operand types: array & array
Unsupported operand types: array & stdClass
Unsupported operand types: array & resource
+Unsupported operand types: array & string
Unsupported operand types: stdClass & array
Unsupported operand types: stdClass & stdClass
Unsupported operand types: stdClass & resource
+Unsupported operand types: stdClass & string
Unsupported operand types: resource & array
Unsupported operand types: resource & stdClass
Unsupported operand types: resource & resource
+Unsupported operand types: resource & string
+Unsupported operand types: string & array
+Unsupported operand types: string & stdClass
+Unsupported operand types: string & resource
+No error for "foo" &= "foo"
Unsupported operand types: array & null
Unsupported operand types: null & array
Unsupported operand types: array & bool
@@ -1322,15 +1789,36 @@ Unsupported operand types: string & resource
Unsupported operand types: resource & string
Warning: A non-numeric value encountered
Unsupported operand types: string & resource
+Unsupported operand types: string & null
+Unsupported operand types: null & string
+Unsupported operand types: string & bool
+Unsupported operand types: bool & string
+Unsupported operand types: string & bool
+Unsupported operand types: bool & string
+Unsupported operand types: string & int
+Unsupported operand types: int & string
+Unsupported operand types: string & float
+Unsupported operand types: float & string
+No error for "foo" &= "123"
+No error for "123" &= "foo"
+No error for "foo" &= "123foo"
+No error for "123foo" &= "foo"
Unsupported operand types: array | array
Unsupported operand types: array | stdClass
Unsupported operand types: array | resource
+Unsupported operand types: array | string
Unsupported operand types: stdClass | array
Unsupported operand types: stdClass | stdClass
Unsupported operand types: stdClass | resource
+Unsupported operand types: stdClass | string
Unsupported operand types: resource | array
Unsupported operand types: resource | stdClass
Unsupported operand types: resource | resource
+Unsupported operand types: resource | string
+Unsupported operand types: string | array
+Unsupported operand types: string | stdClass
+Unsupported operand types: string | resource
+No error for "foo" |= "foo"
Unsupported operand types: array | null
Unsupported operand types: null | array
Unsupported operand types: array | bool
@@ -1376,15 +1864,36 @@ Unsupported operand types: string | resource
Unsupported operand types: resource | string
Warning: A non-numeric value encountered
Unsupported operand types: string | resource
+Unsupported operand types: string | null
+Unsupported operand types: null | string
+Unsupported operand types: string | bool
+Unsupported operand types: bool | string
+Unsupported operand types: string | bool
+Unsupported operand types: bool | string
+Unsupported operand types: string | int
+Unsupported operand types: int | string
+Unsupported operand types: string | float
+Unsupported operand types: float | string
+No error for "foo" |= "123"
+No error for "123" |= "foo"
+No error for "foo" |= "123foo"
+No error for "123foo" |= "foo"
Unsupported operand types: array ^ array
Unsupported operand types: array ^ stdClass
Unsupported operand types: array ^ resource
+Unsupported operand types: array ^ string
Unsupported operand types: stdClass ^ array
Unsupported operand types: stdClass ^ stdClass
Unsupported operand types: stdClass ^ resource
+Unsupported operand types: stdClass ^ string
Unsupported operand types: resource ^ array
Unsupported operand types: resource ^ stdClass
Unsupported operand types: resource ^ resource
+Unsupported operand types: resource ^ string
+Unsupported operand types: string ^ array
+Unsupported operand types: string ^ stdClass
+Unsupported operand types: string ^ resource
+No error for "foo" ^= "foo"
Unsupported operand types: array ^ null
Unsupported operand types: null ^ array
Unsupported operand types: array ^ bool
@@ -1430,6 +1939,20 @@ Unsupported operand types: string ^ resource
Unsupported operand types: resource ^ string
Warning: A non-numeric value encountered
Unsupported operand types: string ^ resource
+Unsupported operand types: string ^ null
+Unsupported operand types: null ^ string
+Unsupported operand types: string ^ bool
+Unsupported operand types: bool ^ string
+Unsupported operand types: string ^ bool
+Unsupported operand types: bool ^ string
+Unsupported operand types: string ^ int
+Unsupported operand types: int ^ string
+Unsupported operand types: string ^ float
+Unsupported operand types: float ^ string
+No error for "foo" ^= "123"
+No error for "123" ^= "foo"
+No error for "foo" ^= "123foo"
+No error for "123foo" ^= "foo"
Warning: Array to string conversion
Warning: Array to string conversion
No error for [] .= []
@@ -1437,6 +1960,9 @@ Warning: Array to string conversion
Object of class stdClass could not be converted to string
Warning: Array to string conversion
No error for [] .= STDOUT
+Warning: Array to string conversion
+No error for [] .= "foo"
+Object of class stdClass could not be converted to string
Object of class stdClass could not be converted to string
Object of class stdClass could not be converted to string
Object of class stdClass could not be converted to string
@@ -1444,6 +1970,12 @@ Warning: Array to string conversion
No error for STDOUT .= []
Object of class stdClass could not be converted to string
No error for STDOUT .= STDOUT
+No error for STDOUT .= "foo"
+Warning: Array to string conversion
+No error for "foo" .= []
+Object of class stdClass could not be converted to string
+No error for "foo" .= STDOUT
+No error for "foo" .= "foo"
Warning: Array to string conversion
No error for [] .= null
Warning: Array to string conversion
@@ -1469,9 +2001,9 @@ No error for [] .= "123"
Warning: Array to string conversion
No error for "123" .= []
Warning: Array to string conversion
-No error for [] .= "foo"
+No error for [] .= "123foo"
Warning: Array to string conversion
-No error for "foo" .= []
+No error for "123foo" .= []
Object of class stdClass could not be converted to string
Object of class stdClass could not be converted to string
Object of class stdClass could not be converted to string
@@ -1498,14 +2030,29 @@ No error for STDOUT .= 3.5
No error for 3.5 .= STDOUT
No error for STDOUT .= "123"
No error for "123" .= STDOUT
-No error for STDOUT .= "foo"
-No error for "foo" .= STDOUT
+No error for STDOUT .= "123foo"
+No error for "123foo" .= STDOUT
+No error for "foo" .= null
+No error for null .= "foo"
+No error for "foo" .= true
+No error for true .= "foo"
+No error for "foo" .= false
+No error for false .= "foo"
+No error for "foo" .= 2
+No error for 2 .= "foo"
+No error for "foo" .= 3.5
+No error for 3.5 .= "foo"
+No error for "foo" .= "123"
+No error for "123" .= "foo"
+No error for "foo" .= "123foo"
+No error for "123foo" .= "foo"
UNARY OP:
Cannot perform bitwise not on array
Cannot perform bitwise not on stdClass
Cannot perform bitwise not on resource
+No error for ~"foo"
INCDEC:
@@ -1515,3 +2062,5 @@ Cannot increment stdClass
Cannot decrement stdClass
Cannot increment resource
Cannot decrement resource
+No error for fop++
+No error for foo--
diff --git a/Zend/tests/self_and.phpt b/Zend/tests/self_and.phpt
index 26b86e5125..f3662c575c 100644
--- a/Zend/tests/self_and.phpt
+++ b/Zend/tests/self_and.phpt
@@ -12,8 +12,12 @@ $s4 = str_repeat("f", 2);
$s &= 22;
var_dump($s);
-$s1 &= 11;
-var_dump($s1);
+try {
+ $s1 &= 11;
+ var_dump($s1);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$s2 &= 33;
var_dump($s2);
@@ -28,11 +32,9 @@ echo "Done\n";
?>
--EXPECTF--
int(18)
+Unsupported operand types: string & int
Warning: A non-numeric value encountered in %s on line %d
-int(0)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(33)
string(1) " "
string(2) " "
diff --git a/Zend/tests/self_mod.phpt b/Zend/tests/self_mod.phpt
index 0b10987aeb..7d469f8002 100644
--- a/Zend/tests/self_mod.phpt
+++ b/Zend/tests/self_mod.phpt
@@ -10,8 +10,12 @@ $s2 = "45345some";
$s %= 22;
var_dump($s);
-$s1 %= 11;
-var_dump($s1);
+try {
+ $s1 %= 11;
+ var_dump($s1);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$s2 %= 33;
var_dump($s2);
@@ -20,10 +24,8 @@ echo "Done\n";
?>
--EXPECTF--
int(13)
+Unsupported operand types: string % int
Warning: A non-numeric value encountered in %s on line %d
-int(0)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(3)
Done
diff --git a/Zend/tests/self_or.phpt b/Zend/tests/self_or.phpt
index cecf70d795..61f1f4203b 100644
--- a/Zend/tests/self_or.phpt
+++ b/Zend/tests/self_or.phpt
@@ -12,8 +12,12 @@ $s4 = str_repeat("f", 2);
$s |= 22;
var_dump($s);
-$s1 |= 11;
-var_dump($s1);
+try {
+ $s1 |= 11;
+ var_dump($s1);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$s2 |= 33;
var_dump($s2);
@@ -28,11 +32,9 @@ echo "Done\n";
?>
--EXPECTF--
int(127)
+Unsupported operand types: string | int
Warning: A non-numeric value encountered in %s on line %d
-int(11)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(45345)
string(1) "f"
string(2) "ff"
diff --git a/Zend/tests/self_xor.phpt b/Zend/tests/self_xor.phpt
index e36a315b10..4bff3f6d50 100644
--- a/Zend/tests/self_xor.phpt
+++ b/Zend/tests/self_xor.phpt
@@ -12,8 +12,12 @@ $s4 = str_repeat("f", 2);
$s ^= 22;
var_dump($s);
-$s1 ^= 11;
-var_dump($s1);
+try {
+ $s1 ^= 11;
+ var_dump($s1);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$s2 ^= 33;
var_dump($s2);
@@ -28,11 +32,9 @@ echo "Done\n";
?>
--EXPECTF--
int(109)
+Unsupported operand types: string ^ int
Warning: A non-numeric value encountered in %s on line %d
-int(11)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(45312)
string(1) "F"
string(2) "FF"
diff --git a/Zend/tests/shift_001.phpt b/Zend/tests/shift_001.phpt
index fba24f5fd0..f441cf2dcf 100644
--- a/Zend/tests/shift_001.phpt
+++ b/Zend/tests/shift_001.phpt
@@ -10,8 +10,12 @@ $s2 = "45345some";
$s <<= 2;
var_dump($s);
-$s1 <<= 1;
-var_dump($s1);
+try {
+ $s1 <<= 1;
+ var_dump($s1);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$s2 <<= 3;
var_dump($s2);
@@ -20,10 +24,8 @@ echo "Done\n";
?>
--EXPECTF--
int(492)
+Unsupported operand types: string << int
Warning: A non-numeric value encountered in %s on line %d
-int(0)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(362760)
Done
diff --git a/Zend/tests/shift_002.phpt b/Zend/tests/shift_002.phpt
index fa068e1a90..0bdc9b3eeb 100644
--- a/Zend/tests/shift_002.phpt
+++ b/Zend/tests/shift_002.phpt
@@ -10,8 +10,12 @@ $s2 = "45345some";
$s >>= 2;
var_dump($s);
-$s1 >>= 1;
-var_dump($s1);
+try {
+ $s1 >>= 1;
+ var_dump($s1);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$s2 >>= 3;
var_dump($s2);
@@ -20,10 +24,8 @@ echo "Done\n";
?>
--EXPECTF--
int(30)
+Unsupported operand types: string >> int
Warning: A non-numeric value encountered in %s on line %d
-int(0)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(5668)
Done
diff --git a/Zend/tests/type_declarations/scalar_basic.phpt b/Zend/tests/type_declarations/scalar_basic.phpt
index 002cab6042..908f1a18b2 100644
--- a/Zend/tests/type_declarations/scalar_basic.phpt
+++ b/Zend/tests/type_declarations/scalar_basic.phpt
@@ -74,8 +74,7 @@ int(1)
int(1)
*** Trying string(2) "1a"
-E_NOTICE: A non well formed numeric value encountered on line %d
-int(1)
+*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying string(1) "a"
*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
@@ -128,8 +127,7 @@ float(1)
float(1.5)
*** Trying string(2) "1a"
-E_NOTICE: A non well formed numeric value encountered on line %d
-float(1)
+*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying string(1) "a"
*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_return_basic.phpt b/Zend/tests/type_declarations/scalar_return_basic.phpt
index 5ecd533840..deb4289f25 100644
--- a/Zend/tests/type_declarations/scalar_return_basic.phpt
+++ b/Zend/tests/type_declarations/scalar_return_basic.phpt
@@ -72,8 +72,7 @@ int(1)
*** Trying float(1.5)
int(1)
*** Trying string(2) "1a"
-E_NOTICE: A non well formed numeric value encountered on line %d
-int(1)
+*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
*** Trying string(1) "a"
*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
*** Trying string(0) ""
@@ -110,8 +109,7 @@ float(1)
*** Trying float(1.5)
float(1.5)
*** Trying string(2) "1a"
-E_NOTICE: A non well formed numeric value encountered on line %d
-float(1)
+*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
*** Trying string(1) "a"
*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
*** Trying string(0) ""
diff --git a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt
index 0fbccb1b69..e49b9f5b2a 100644
--- a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt
+++ b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt
@@ -72,8 +72,7 @@ int(1)
*** Trying float(1.5)
int(1)
*** Trying string(2) "1a"
-E_NOTICE: A non well formed numeric value encountered on line %d
-int(1)
+*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
*** Trying string(1) "a"
*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
*** Trying string(0) ""
@@ -110,8 +109,7 @@ float(1)
*** Trying float(1.5)
float(1.5)
*** Trying string(2) "1a"
-E_NOTICE: A non well formed numeric value encountered on line %d
-float(1)
+*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
*** Trying string(1) "a"
*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
*** Trying string(0) ""
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 5675828953..351a3e9e78 100644
--- a/Zend/tests/type_declarations/union_types/type_checking_weak.phpt
+++ b/Zend/tests/type_declarations/union_types/type_checking_weak.phpt
@@ -66,7 +66,7 @@ Type int|float:
INF => INF
"42" => 42
"42.0" => 42.0
-"42x" => 42 (A non well formed numeric value encountered)
+"42x" => Argument ... must be of type int|float, string given
"x" => Argument ... must be of type int|float, string given
"" => Argument ... must be of type int|float, string given
true => 1
@@ -82,7 +82,7 @@ Type int|float|false:
INF => INF
"42" => 42
"42.0" => 42.0
-"42x" => 42 (A non well formed numeric value encountered)
+"42x" => Argument ... must be of type int|float|false, string given
"x" => Argument ... must be of type int|float|false, string given
"" => Argument ... must be of type int|float|false, string given
true => 1
@@ -98,7 +98,7 @@ Type int|float|bool:
INF => INF
"42" => 42
"42.0" => 42.0
-"42x" => 42 (A non well formed numeric value encountered)
+"42x" => true
"x" => true
"" => false
true => true
@@ -114,7 +114,7 @@ Type int|bool:
INF => true
"42" => 42
"42.0" => 42
-"42x" => 42 (A non well formed numeric value encountered)
+"42x" => true
"x" => true
"" => false
true => true
@@ -162,7 +162,7 @@ Type float|array:
INF => INF
"42" => 42.0
"42.0" => 42.0
-"42x" => 42.0 (A non well formed numeric value encountered)
+"42x" => Argument ... must be of type array|float, string given
"x" => Argument ... must be of type array|float, string given
"" => Argument ... must be of type array|float, string given
true => 1.0
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 7a8816b5cf..c6e4b03dfc 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -420,7 +420,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest)
}
} else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
double d;
- int type;
+ zend_uchar type;
if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) {
if (EXPECTED(type != 0)) {
@@ -465,7 +465,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest) /
*dest = (double)Z_LVAL_P(arg);
} else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
zend_long l;
- int type;
+ zend_uchar type;
if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), &l, dest)) != IS_DOUBLE)) {
if (EXPECTED(type != 0)) {
@@ -509,7 +509,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest) /*
zend_string *str = Z_STR_P(arg);
zend_long lval;
double dval;
- zend_uchar type = is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &lval, &dval, -1);
+ zend_uchar type = is_numeric_str_function(str, &lval, &dval);
if (type == IS_LONG) {
ZVAL_LONG(arg, lval);
} else if (type == IS_DOUBLE) {
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index efb2d008a8..51d4a0d003 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -728,7 +728,7 @@ static zend_bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg
/* For an int|float union type and string value,
* determine chosen type by is_numeric_string() semantics. */
if ((type_mask & MAY_BE_DOUBLE) && Z_TYPE_P(arg) == IS_STRING) {
- zend_uchar type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &lval, &dval, -1);
+ zend_uchar type = is_numeric_str_function(Z_STR_P(arg), &lval, &dval);
if (type == IS_LONG) {
zend_string_release(Z_STR_P(arg));
ZVAL_LONG(arg, lval);
@@ -770,35 +770,11 @@ static zend_bool zend_verify_weak_scalar_type_hint_no_sideeffect(uint32_t type_m
double dval;
zend_bool bval;
- if (type_mask & MAY_BE_LONG) {
- if (Z_TYPE_P(arg) == IS_STRING) {
- /* Handle this case separately to avoid the "non well-formed" warning */
- zend_uchar type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, &dval, 1);
- if (type == IS_LONG) {
- return 1;
- }
- if (type == IS_DOUBLE) {
- if ((type_mask & MAY_BE_DOUBLE)
- || (!zend_isnan(dval) && ZEND_DOUBLE_FITS_LONG(dval))) {
- return 1;
- }
-
- }
- }
- if (zend_parse_arg_long_weak(arg, &lval)) {
- return 1;
- }
+ if ((type_mask & MAY_BE_LONG) && zend_parse_arg_long_weak(arg, &lval)) {
+ return 1;
}
- if (type_mask & MAY_BE_DOUBLE) {
- if (Z_TYPE_P(arg) == IS_STRING) {
- /* Handle this case separately to avoid the "non well-formed" warning */
- if (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, NULL, 1) != 0) {
- return 1;
- }
- }
- if (zend_parse_arg_double_weak(arg, &dval)) {
- return 1;
- }
+ if ((type_mask & MAY_BE_DOUBLE) && zend_parse_arg_double_weak(arg, &dval)) {
+ return 1;
}
/* We don't call cast_object here, because this check must be side-effect free. As this
* is only used for a sanity check of arginfo/zpp consistency, it's okay if we accept
@@ -1271,6 +1247,11 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_illegal_offset(void)
zend_type_error("Illegal offset type");
}
+static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_illegal_string_offset(const zval *offset)
+{
+ zend_type_error("Cannot access offset of type %s on string", zend_zval_type_name(offset));
+}
+
static zend_never_inline void zend_assign_to_object_dim(zval *object, zval *dim, zval *value OPLINE_DC EXECUTE_DATA_DC)
{
Z_OBJ_HT_P(object)->write_dimension(Z_OBJ_P(object), dim, value);
@@ -1364,13 +1345,19 @@ try_again:
if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
switch(Z_TYPE_P(dim)) {
case IS_STRING:
- if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
- break;
- }
- if (type != BP_VAR_UNSET) {
- zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
+ {
+ bool trailing_data = false;
+ /* For BC reasons we allow errors so that we can warn on leading numeric string */
+ if (IS_LONG == is_numeric_string_ex(Z_STRVAL_P(dim), Z_STRLEN_P(dim), &offset, NULL,
+ /* allow errors */ true, NULL, &trailing_data)) {
+ if (UNEXPECTED(trailing_data) && type != BP_VAR_UNSET) {
+ zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
+ }
+ return offset;
}
+ zend_illegal_string_offset(dim);
break;
+ }
case IS_UNDEF:
ZVAL_UNDEFINED_OP2();
case IS_DOUBLE:
@@ -1383,7 +1370,7 @@ try_again:
dim = Z_REFVAL_P(dim);
goto try_again;
default:
- zend_illegal_offset();
+ zend_illegal_string_offset(dim);
break;
}
@@ -2349,17 +2336,24 @@ try_array:
try_string_offset:
if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
switch (Z_TYPE_P(dim)) {
- /* case IS_LONG: */
case IS_STRING:
- if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
- break;
+ {
+ bool trailing_data = false;
+ /* For BC reasons we allow errors so that we can warn on leading numeric string */
+ if (IS_LONG == is_numeric_string_ex(Z_STRVAL_P(dim), Z_STRLEN_P(dim), &offset,
+ NULL, /* allow errors */ true, NULL, &trailing_data)) {
+ if (UNEXPECTED(trailing_data)) {
+ zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
+ }
+ goto out;
}
if (type == BP_VAR_IS) {
ZVAL_NULL(result);
return;
}
- zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
+ zend_illegal_string_offset(dim);
break;
+ }
case IS_UNDEF:
ZVAL_UNDEFINED_OP2();
case IS_DOUBLE:
@@ -2374,7 +2368,7 @@ try_string_offset:
dim = Z_REFVAL_P(dim);
goto try_string_offset;
default:
- zend_illegal_offset();
+ zend_illegal_string_offset(dim);
break;
}
@@ -2382,6 +2376,7 @@ try_string_offset:
} else {
offset = Z_LVAL_P(dim);
}
+ out:
if (UNEXPECTED(Z_STRLEN_P(container) < ((offset < 0) ? -(size_t)offset : ((size_t)offset + 1)))) {
if (type != BP_VAR_IS) {
diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
index e8641faa49..c8efb1f144 100644
--- a/Zend/zend_ini_scanner.l
+++ b/Zend/zend_ini_scanner.l
@@ -158,7 +158,7 @@ static inline int convert_to_number(zval *retval, const char *str, const int str
zend_long lval;
double dval;
- if ((type = is_numeric_string_ex(str, str_len, &lval, &dval, 0, &overflow)) != 0) {
+ if ((type = is_numeric_string_ex(str, str_len, &lval, &dval, 0, &overflow, NULL)) != 0) {
if (type == IS_LONG) {
ZVAL_LONG(retval, lval);
return SUCCESS;
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index f0c17ea0d3..fba6c6337a 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -243,14 +243,22 @@ static zend_never_inline int ZEND_FASTCALL _zendi_try_convert_scalar_to_number(z
ZVAL_LONG(holder, 1);
return SUCCESS;
case IS_STRING:
- if ((Z_TYPE_INFO_P(holder) = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL_P(holder), &Z_DVAL_P(holder), -1)) == 0) {
- ZVAL_LONG(holder, 0);
+ {
+ bool trailing_data = false;
+ /* For BC reasons we allow errors so that we can warn on leading numeric string */
+ if (0 == (Z_TYPE_INFO_P(holder) = is_numeric_string_ex(Z_STRVAL_P(op), Z_STRLEN_P(op),
+ &Z_LVAL_P(holder), &Z_DVAL_P(holder), /* allow errors */ true, NULL, &trailing_data))) {
+ /* Will lead to invalid OP type error */
+ return FAILURE;
+ }
+ if (UNEXPECTED(trailing_data)) {
zend_error(E_WARNING, "A non-numeric value encountered");
if (UNEXPECTED(EG(exception))) {
return FAILURE;
}
}
return SUCCESS;
+ }
case IS_OBJECT:
if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), holder, _IS_NUMBER) == FAILURE
|| EG(exception)) {
@@ -293,13 +301,22 @@ static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(zval *op, ze
zend_uchar type;
zend_long lval;
double dval;
- if (0 == (type = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval, -1))) {
+ bool trailing_data = false;
+
+ /* For BC reasons we allow errors so that we can warn on leading numeric string */
+ type = is_numeric_string_ex(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval,
+ /* allow errors */ true, NULL, &trailing_data);
+ if (type == 0) {
+ *failed = 1;
+ return 0;
+ }
+ if (UNEXPECTED(trailing_data)) {
zend_error(E_WARNING, "A non-numeric value encountered");
if (UNEXPECTED(EG(exception))) {
*failed = 1;
}
- return 0;
- } else if (EXPECTED(type == IS_LONG)) {
+ }
+ if (EXPECTED(type == IS_LONG)) {
return lval;
} else {
/* Previously we used strtol here, not is_numeric_string,
@@ -771,7 +788,7 @@ try_again:
}
/* }}} */
-static zend_always_inline zend_long ZEND_FASTCALL _zval_get_long_func_ex(zval *op, zend_bool silent) /* {{{ */
+ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(zval *op) /* {{{ */
{
try_again:
switch (Z_TYPE_P(op)) {
@@ -792,10 +809,7 @@ try_again:
zend_uchar type;
zend_long lval;
double dval;
- if (0 == (type = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval, silent ? 1 : -1))) {
- if (!silent) {
- zend_error(E_WARNING, "A non-numeric value encountered");
- }
+ if (0 == (type = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval, true))) {
return 0;
} else if (EXPECTED(type == IS_LONG)) {
return lval;
@@ -829,12 +843,6 @@ try_again:
}
/* }}} */
-ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(zval *op) /* {{{ */
-{
- return _zval_get_long_func_ex(op, 1);
-}
-/* }}} */
-
ZEND_API double ZEND_FASTCALL zval_get_double_func(zval *op) /* {{{ */
{
try_again:
@@ -2404,7 +2412,7 @@ try_again:
zend_long lval;
double dval;
- switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) {
+ switch (is_numeric_str_function(Z_STR_P(op1), &lval, &dval)) {
case IS_LONG:
zval_ptr_dtor_str(op1);
if (lval == ZEND_LONG_MAX) {
@@ -2471,7 +2479,7 @@ try_again:
ZVAL_LONG(op1, -1);
break;
}
- switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) {
+ switch (is_numeric_str_function(Z_STR_P(op1), &lval, &dval)) {
case IS_LONG:
zval_ptr_dtor_str(op1);
if (lval == ZEND_LONG_MIN) {
@@ -2816,8 +2824,8 @@ ZEND_API int ZEND_FASTCALL zendi_smart_streq(zend_string *s1, zend_string *s2) /
zend_long lval1 = 0, lval2 = 0;
double dval1 = 0.0, dval2 = 0.0;
- if ((ret1 = is_numeric_string_ex(s1->val, s1->len, &lval1, &dval1, 0, &oflow1)) &&
- (ret2 = is_numeric_string_ex(s2->val, s2->len, &lval2, &dval2, 0, &oflow2))) {
+ if ((ret1 = is_numeric_string_ex(s1->val, s1->len, &lval1, &dval1, false, &oflow1, NULL)) &&
+ (ret2 = is_numeric_string_ex(s2->val, s2->len, &lval2, &dval2, false, &oflow2, NULL))) {
#if ZEND_ULONG_MAX == 0xFFFFFFFF
if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. &&
((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/)
@@ -2864,8 +2872,8 @@ ZEND_API int ZEND_FASTCALL zendi_smart_strcmp(zend_string *s1, zend_string *s2)
zend_long lval1 = 0, lval2 = 0;
double dval1 = 0.0, dval2 = 0.0;
- if ((ret1 = is_numeric_string_ex(s1->val, s1->len, &lval1, &dval1, 0, &oflow1)) &&
- (ret2 = is_numeric_string_ex(s2->val, s2->len, &lval2, &dval2, 0, &oflow2))) {
+ if ((ret1 = is_numeric_string_ex(s1->val, s1->len, &lval1, &dval1, false, &oflow1, NULL)) &&
+ (ret2 = is_numeric_string_ex(s2->val, s2->len, &lval2, &dval2, false, &oflow2, NULL))) {
#if ZEND_ULONG_MAX == 0xFFFFFFFF
if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. &&
((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/)
@@ -2962,11 +2970,12 @@ ZEND_API zend_string* ZEND_FASTCALL zend_long_to_str(zend_long num) /* {{{ */
/* }}} */
ZEND_API zend_uchar ZEND_FASTCALL is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval) /* {{{ */ {
- return is_numeric_string_ex(ZSTR_VAL(str), ZSTR_LEN(str), lval, dval, -1, NULL);
+ return is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), lval, dval, false);
}
/* }}} */
-ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info) /* {{{ */
+ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t length, zend_long *lval,
+ double *dval, bool allow_errors, int *oflow_info, bool *trailing_data) /* {{{ */
{
const char *ptr;
int digits = 0, dp_or_e = 0;
@@ -2982,6 +2991,9 @@ ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t
if (oflow_info != NULL) {
*oflow_info = 0;
}
+ if (trailing_data != NULL) {
+ *trailing_data = false;
+ }
/* Skip any whitespace
* This is much faster than the isspace() function */
@@ -3007,7 +3019,7 @@ ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t
/* Count the number of digits. If a decimal point/exponent is found,
* it's a double. Otherwise, if there's a dval or no need to check for
* a full match, stop when there are too many digits for a long */
- for (type = IS_LONG; !(digits >= MAX_LENGTH_OF_LONG && (dval || allow_errors == 1)); digits++, ptr++) {
+ for (type = IS_LONG; !(digits >= MAX_LENGTH_OF_LONG && (dval || allow_errors)); digits++, ptr++) {
check_digits:
if (ZEND_IS_DIGIT(*ptr)) {
tmp_lval = tmp_lval * 10 + (*ptr) - '0';
@@ -3043,7 +3055,7 @@ process_double:
* the digits if we need to check for a full match */
if (dval) {
local_dval = zend_strtod(str, &ptr);
- } else if (allow_errors != 1 && dp_or_e != -1) {
+ } else if (!allow_errors && dp_or_e != -1) {
dp_or_e = (*ptr++ == '.') ? 1 : 2;
goto check_digits;
}
@@ -3061,11 +3073,8 @@ process_double:
if (!allow_errors) {
return 0;
}
- if (allow_errors == -1) {
- zend_error(E_NOTICE, "A non well formed numeric value encountered");
- }
- if (EG(exception)) {
- return 0;
+ if (trailing_data != NULL) {
+ *trailing_data = true;
}
}
}
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index 2664514709..9eb064b125 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -86,7 +86,8 @@ static zend_always_inline zend_bool instanceof_function(
* could not be represented as such due to overflow. It writes 1 to oflow_info
* if the integer is larger than ZEND_LONG_MAX and -1 if it's smaller than ZEND_LONG_MIN.
*/
-ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info);
+ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t length, zend_long *lval,
+ double *dval, bool allow_errors, int *oflow_info, bool *trailing_data);
ZEND_API const char* ZEND_FASTCALL zend_memnstr_ex(const char *haystack, const char *needle, size_t needle_len, const char *end);
ZEND_API const char* ZEND_FASTCALL zend_memnrstr_ex(const char *haystack, const char *needle, size_t needle_len, const char *end);
@@ -135,16 +136,17 @@ static zend_always_inline zend_long zend_dval_to_lval_cap(double d)
#define ZEND_IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
#define ZEND_IS_XDIGIT(c) (((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f'))
-static zend_always_inline zend_uchar is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info)
+static zend_always_inline zend_uchar is_numeric_string_ex(const char *str, size_t length, zend_long *lval,
+ double *dval, bool allow_errors, int *oflow_info, bool *trailing_data)
{
if (*str > '9') {
return 0;
}
- return _is_numeric_string_ex(str, length, lval, dval, allow_errors, oflow_info);
+ return _is_numeric_string_ex(str, length, lval, dval, allow_errors, oflow_info, trailing_data);
}
-static zend_always_inline zend_uchar is_numeric_string(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors) {
- return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL);
+static zend_always_inline zend_uchar is_numeric_string(const char *str, size_t length, zend_long *lval, double *dval, bool allow_errors) {
+ return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL, NULL);
}
ZEND_API zend_uchar ZEND_FASTCALL is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval);
diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c
index e42fd196aa..7ae956f177 100644
--- a/ext/opcache/jit/zend_jit_helpers.c
+++ b/ext/opcache/jit/zend_jit_helpers.c
@@ -27,6 +27,12 @@ static ZEND_COLD void undef_result_after_exception() {
}
}
+static ZEND_COLD void zend_jit_illegal_string_offset(zval *offset)
+{
+ zend_type_error("Cannot access offset of type %s on string", zend_zval_type_name(offset));
+}
+
+
static zend_never_inline zend_function* ZEND_FASTCALL _zend_jit_init_func_run_time_cache(const zend_op_array *op_array) /* {{{ */
{
void **run_time_cache;
@@ -350,8 +356,8 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_r_helper(zend_array *ht, zval *dim,
hval = 1;
goto num_index;
default:
- zend_type_error("Illegal offset type");
- ZVAL_NULL(result);
+ zend_jit_illegal_string_offset(dim);
+ undef_result_after_exception();
return;
}
@@ -422,8 +428,8 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_is_helper(zend_array *ht, zval *dim
hval = 1;
goto num_index;
default:
- zend_type_error("Illegal offset type");
- ZVAL_NULL(result);
+ zend_jit_illegal_string_offset(dim);
+ undef_result_after_exception();
return;
}
@@ -560,7 +566,7 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_rw_helper(zend_array *ht, zval *di
hval = 1;
goto num_index;
default:
- zend_type_error("Illegal offset type");
+ zend_jit_illegal_string_offset(dim);
undef_result_after_exception();
return NULL;
}
@@ -641,7 +647,7 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim
hval = 1;
goto num_index;
default:
- zend_type_error("Illegal offset type");
+ zend_jit_illegal_string_offset(dim);
undef_result_after_exception();
return NULL;
}
@@ -677,13 +683,20 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_str_r_helper(zval *container, zval
try_string_offset:
if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
switch (Z_TYPE_P(dim)) {
- /* case IS_LONG: */
case IS_STRING:
- if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
- break;
+ {
+ bool trailing_data = false;
+ /* For BC reasons we allow errors so that we can warn on leading numeric string */
+ if (IS_LONG == is_numeric_string_ex(Z_STRVAL_P(dim), Z_STRLEN_P(dim), &offset, NULL,
+ /* allow errors */ true, NULL, &trailing_data)) {
+ if (UNEXPECTED(trailing_data)) {
+ zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
+ }
+ goto out;
}
- zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
+ zend_jit_illegal_string_offset(dim);
break;
+ }
case IS_UNDEF:
zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
case IS_DOUBLE:
@@ -696,7 +709,7 @@ try_string_offset:
dim = Z_REFVAL_P(dim);
goto try_string_offset;
default:
- zend_type_error("Illegal offset type");
+ zend_jit_illegal_string_offset(dim);
break;
}
@@ -704,6 +717,7 @@ try_string_offset:
} else {
offset = Z_LVAL_P(dim);
}
+ out:
if (UNEXPECTED(Z_STRLEN_P(container) < ((offset < 0) ? -(size_t)offset : ((size_t)offset + 1)))) {
zend_error(E_WARNING, "Uninitialized string offset " ZEND_LONG_FMT, offset);
@@ -728,7 +742,7 @@ try_string_offset:
switch (Z_TYPE_P(dim)) {
/* case IS_LONG: */
case IS_STRING:
- if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
+ if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, false)) {
break;
}
ZVAL_NULL(result);
@@ -744,7 +758,7 @@ try_string_offset:
dim = Z_REFVAL_P(dim);
goto try_string_offset;
default:
- zend_type_error("Illegal offset type");
+ zend_jit_illegal_string_offset(dim);
break;
}
@@ -818,13 +832,19 @@ try_again:
if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
switch(Z_TYPE_P(dim)) {
case IS_STRING:
- if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
- break;
- }
- if (type != BP_VAR_UNSET) {
- zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
+ {
+ bool trailing_data = false;
+ /* For BC reasons we allow errors so that we can warn on leading numeric string */
+ if (IS_LONG == is_numeric_string_ex(Z_STRVAL_P(dim), Z_STRLEN_P(dim), &offset, NULL,
+ /* allow errors */ true, NULL, &trailing_data)) {
+ if (UNEXPECTED(trailing_data) && type != BP_VAR_UNSET) {
+ zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
+ }
+ return offset;
}
+ zend_jit_illegal_string_offset(dim);
break;
+ }
case IS_UNDEF:
zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
case IS_DOUBLE:
@@ -837,7 +857,7 @@ try_again:
dim = Z_REFVAL_P(dim);
goto try_again;
default:
- zend_type_error("Illegal offset type");
+ zend_jit_illegal_string_offset(dim);
break;
}
@@ -1173,7 +1193,7 @@ isset_str_offset:
ZVAL_DEREF(offset);
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, false))) {
lval = zval_get_long(offset);
goto isset_str_offset;
}
diff --git a/ext/opcache/tests/bug71843.phpt b/ext/opcache/tests/bug71843.phpt
index 0a193425dd..28b36f7371 100644
--- a/ext/opcache/tests/bug71843.phpt
+++ b/ext/opcache/tests/bug71843.phpt
@@ -11,12 +11,9 @@ opcache.optimization_level=0xFFFFBFFF
define('E', 'E');
define('R', 'R');
define('See', 'See');
-0 & ~E & ~R;
+"0" & ~E & ~R;
6 && ~See
?>
okey
---EXPECTF--
-Warning: A non-numeric value encountered in %s on line %d
-
-Warning: A non-numeric value encountered in %s on line %d
+--EXPECT--
okey
diff --git a/ext/opcache/tests/jit/fetch_dim_r_003.phpt b/ext/opcache/tests/jit/fetch_dim_r_003.phpt
index c71b13ec12..e0fb75ee48 100644
--- a/ext/opcache/tests/jit/fetch_dim_r_003.phpt
+++ b/ext/opcache/tests/jit/fetch_dim_r_003.phpt
@@ -20,10 +20,18 @@ function foo() {
var_dump($a[false]);
var_dump($a[true]);
var_dump($a[null]);
- var_dump($a["ab"]);
+ try {
+ var_dump($a["ab"]);
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
$x = "a";
$y = "b";
- var_dump($a[$x . $y]);
+ try {
+ var_dump($a[$x . $y]);
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
var_dump($a["2x"]);
$x = "2";
$y = "x";
@@ -47,15 +55,11 @@ string(1) "B"
Warning: String offset cast occurred in %s on line %d
string(1) "A"
+Cannot access offset of type string on string
+Cannot access offset of type string on string
-Warning: Illegal string offset "ab" in %sfetch_dim_r_003.php on line 12
-string(1) "A"
-
-Warning: Illegal string offset "ab" in %sfetch_dim_r_003.php on line 15
-string(1) "A"
-
-Notice: A non well formed numeric value encountered in %sfetch_dim_r_003.php on line 16
+Warning: Illegal string offset "2x" in %sfetch_dim_r_003.php on line 24
string(1) "C"
-Notice: A non well formed numeric value encountered in %sfetch_dim_r_003.php on line 19
+Warning: Illegal string offset "2x" in %sfetch_dim_r_003.php on line 27
string(1) "C"
diff --git a/ext/opcache/tests/jit/fetch_dim_r_004.phpt b/ext/opcache/tests/jit/fetch_dim_r_004.phpt
index b781dc2cc4..23c6bf4d0f 100644
--- a/ext/opcache/tests/jit/fetch_dim_r_004.phpt
+++ b/ext/opcache/tests/jit/fetch_dim_r_004.phpt
@@ -12,7 +12,11 @@ opcache.jit_buffer_size=1M
<?php
function foo($n) {
$a = "ABCDEF";
- var_dump($a[$n]);
+ try {
+ var_dump($a[$n]);
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
foo(0);
foo(2);
@@ -47,15 +51,11 @@ string(1) "B"
Warning: String offset cast occurred in %s on line %d
string(1) "A"
+Cannot access offset of type string on string
+Cannot access offset of type string on string
-Warning: Illegal string offset "ab" in %sfetch_dim_r_004.php on line 4
-string(1) "A"
-
-Warning: Illegal string offset "ab" in %sfetch_dim_r_004.php on line 4
-string(1) "A"
-
-Notice: A non well formed numeric value encountered in %sfetch_dim_r_004.php on line 4
+Warning: Illegal string offset "2x" in %sfetch_dim_r_004.php on line 5
string(1) "C"
-Notice: A non well formed numeric value encountered in %sfetch_dim_r_004.php on line 4
+Warning: Illegal string offset "2x" in %sfetch_dim_r_004.php on line 5
string(1) "C"
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 6bb7ca7322..ce008d09c7 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -2302,7 +2302,7 @@ static zval *row_prop_read(zend_object *object, zend_string *name, int type, voi
ZVAL_NULL(rv);
if (stmt) {
- if (is_numeric_string_ex(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0, NULL) == IS_LONG) {
+ if (is_numeric_string(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0) == IS_LONG) {
if (lval >= 0 && lval < stmt->column_count) {
fetch_value(stmt, rv, lval, NULL);
}
@@ -2340,7 +2340,7 @@ static zval *row_dim_read(zend_object *object, zval *member, int type, zval *rv)
fetch_value(stmt, rv, Z_LVAL_P(member), NULL);
}
} else if (Z_TYPE_P(member) == IS_STRING
- && is_numeric_string_ex(Z_STRVAL_P(member), Z_STRLEN_P(member), &lval, NULL, 0, NULL) == IS_LONG) {
+ && is_numeric_string(Z_STRVAL_P(member), Z_STRLEN_P(member), &lval, NULL, 0) == IS_LONG) {
if (lval >= 0 && lval < stmt->column_count) {
fetch_value(stmt, rv, lval, NULL);
}
@@ -2387,7 +2387,7 @@ static int row_prop_exists(zend_object *object, zend_string *name, int check_emp
zend_long lval;
if (stmt) {
- if (is_numeric_string_ex(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0, NULL) == IS_LONG) {
+ if (is_numeric_string(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0) == IS_LONG) {
return lval >=0 && lval < stmt->column_count;
}
@@ -2422,7 +2422,7 @@ static int row_dim_exists(zend_object *object, zval *member, int check_empty)
if (Z_TYPE_P(member) == IS_LONG) {
return Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count;
} else if (Z_TYPE_P(member) == IS_STRING) {
- if (is_numeric_string_ex(Z_STRVAL_P(member), Z_STRLEN_P(member), &lval, NULL, 0, NULL) == IS_LONG) {
+ if (is_numeric_string(Z_STRVAL_P(member), Z_STRLEN_P(member), &lval, NULL, 0) == IS_LONG) {
return lval >=0 && lval < stmt->column_count;
}
} else {
diff --git a/ext/reflection/tests/bug76536.phpt b/ext/reflection/tests/bug76536.phpt
index aa32781e16..d6b22ada21 100644
--- a/ext/reflection/tests/bug76536.phpt
+++ b/ext/reflection/tests/bug76536.phpt
@@ -2,7 +2,7 @@
Bug #76536 (PHP crashes with core dump when throwing exception in error handler)
--FILE--
<?php
-class SomeConstants {const SOME_CONSTANT = "foo" % 5; }
+class SomeConstants {const SOME_CONSTANT = "0foo" % 5; }
function handleError() {throw new ErrorException();}
diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt
index 73075c8163..f9aa74e342 100644
--- a/ext/standard/tests/general_functions/floatval.phpt
+++ b/ext/standard/tests/general_functions/floatval.phpt
@@ -140,13 +140,13 @@ float(-5000000)
*** Testing floatval() on non floating types ***
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
float(-2147483648)
float(2147483648)
-float(%d)
-float(%d)
+float(5)
+float(6)
float(0)
float(1)
float(-1300)
@@ -163,8 +163,8 @@ float(0)
*** Testing doubleval() on non floating types ***
float(-2147483648)
float(2147483648)
-float(%d)
-float(%d)
+float(5)
+float(6)
float(0)
float(1)
float(-1300)
diff --git a/ext/standard/tests/general_functions/floatval_variation1.phpt b/ext/standard/tests/general_functions/floatval_variation1.phpt
index 2f184a53e7..856e4e31eb 100644
--- a/ext/standard/tests/general_functions/floatval_variation1.phpt
+++ b/ext/standard/tests/general_functions/floatval_variation1.phpt
@@ -45,9 +45,9 @@ foreach ($not_float_types as $key => $type ) {
}
?>
--EXPECTF--
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
*** Testing floatval() on non floating types ***
@@ -58,10 +58,10 @@ float(-2147483648)
float(2147483648)
-- Iteration : file resoruce --
-float(%d)
+float(5)
-- Iteration : directory resource --
-float(%d)
+float(6)
-- Iteration : "0.0" --
float(0)
@@ -108,10 +108,10 @@ float(-2147483648)
float(2147483648)
-- Iteration : file resoruce --
-float(%d)
+float(5)
-- Iteration : directory resource --
-float(%d)
+float(6)
-- Iteration : "0.0" --
float(0)
diff --git a/ext/standard/tests/math/pow_variation1.phpt b/ext/standard/tests/math/pow_variation1.phpt
index d141ddd787..a4283a4ac9 100644
--- a/ext/standard/tests/math/pow_variation1.phpt
+++ b/ext/standard/tests/math/pow_variation1.phpt
@@ -141,32 +141,22 @@ int(1)
int(0)
-- Iteration 17 --
-
-Warning: A non-numeric value encountered in %s on line %d
-int(0)
+Unsupported operand types: string ** int
-- Iteration 18 --
-
-Warning: A non-numeric value encountered in %s on line %d
-int(0)
+Unsupported operand types: string ** int
-- Iteration 19 --
Unsupported operand types: array ** int
-- Iteration 20 --
-
-Warning: A non-numeric value encountered in %s on line %d
-int(0)
+Unsupported operand types: string ** int
-- Iteration 21 --
-
-Warning: A non-numeric value encountered in %s on line %d
-int(0)
+Unsupported operand types: string ** int
-- Iteration 22 --
-
-Warning: A non-numeric value encountered in %s on line %d
-int(0)
+Unsupported operand types: string ** int
-- Iteration 23 --
Unsupported operand types: classA ** int
@@ -178,4 +168,4 @@ int(0)
int(0)
-- Iteration 26 --
-%s
+Unsupported operand types: resource ** int
diff --git a/ext/standard/tests/math/pow_variation1_64bit.phpt b/ext/standard/tests/math/pow_variation1_64bit.phpt
index 64ef1e20f2..5869e905f0 100644
--- a/ext/standard/tests/math/pow_variation1_64bit.phpt
+++ b/ext/standard/tests/math/pow_variation1_64bit.phpt
@@ -89,7 +89,7 @@ foreach($inputs as $input) {
};
fclose($fp);
?>
---EXPECTF--
+--EXPECT--
*** Testing pow() : usage variations ***
-- Iteration 1 --
@@ -141,32 +141,22 @@ int(1)
int(0)
-- Iteration 17 --
-
-Warning: A non-numeric value encountered in %s on line %d
-int(0)
+Unsupported operand types: string ** int
-- Iteration 18 --
-
-Warning: A non-numeric value encountered in %s on line %d
-int(0)
+Unsupported operand types: string ** int
-- Iteration 19 --
Unsupported operand types: array ** int
-- Iteration 20 --
-
-Warning: A non-numeric value encountered in %s on line %d
-int(0)
+Unsupported operand types: string ** int
-- Iteration 21 --
-
-Warning: A non-numeric value encountered in %s on line %d
-int(0)
+Unsupported operand types: string ** int
-- Iteration 22 --
-
-Warning: A non-numeric value encountered in %s on line %d
-int(0)
+Unsupported operand types: string ** int
-- Iteration 23 --
Unsupported operand types: classA ** int
@@ -178,4 +168,4 @@ int(0)
int(0)
-- Iteration 26 --
-%s
+Unsupported operand types: resource ** int
diff --git a/ext/standard/tests/math/pow_variation2.phpt b/ext/standard/tests/math/pow_variation2.phpt
index c5fc862de4..9351dbd4ce 100644
--- a/ext/standard/tests/math/pow_variation2.phpt
+++ b/ext/standard/tests/math/pow_variation2.phpt
@@ -85,7 +85,7 @@ foreach($inputs as $input) {
};
fclose($fp);
?>
---EXPECTF--
+--EXPECT--
*** Testing pow() : usage variations ***
-- Iteration 1 --
@@ -137,32 +137,22 @@ float(20.3)
float(1)
-- Iteration 17 --
-
-Warning: A non-numeric value encountered in %s on line %d
-float(1)
+Unsupported operand types: float ** string
-- Iteration 18 --
-
-Warning: A non-numeric value encountered in %s on line %d
-float(1)
+Unsupported operand types: float ** string
-- Iteration 19 --
Unsupported operand types: float ** array
-- Iteration 20 --
-
-Warning: A non-numeric value encountered in %s on line %d
-float(1)
+Unsupported operand types: float ** string
-- Iteration 21 --
-
-Warning: A non-numeric value encountered in %s on line %d
-float(1)
+Unsupported operand types: float ** string
-- Iteration 22 --
-
-Warning: A non-numeric value encountered in %s on line %d
-float(1)
+Unsupported operand types: float ** string
-- Iteration 23 --
Unsupported operand types: float ** classA
@@ -174,4 +164,4 @@ float(1)
float(1)
-- Iteration 26 --
-%s
+Unsupported operand types: float ** resource
diff --git a/ext/standard/tests/strings/bug55871.phpt b/ext/standard/tests/strings/bug55871.phpt
index 60a857ec67..47e52e9bf7 100644
--- a/ext/standard/tests/strings/bug55871.phpt
+++ b/ext/standard/tests/strings/bug55871.phpt
@@ -26,7 +26,7 @@ class test3 {
$my_var = str_repeat('A', 40);
$out = substr_replace(array(&$my_var), array(new test1), 40, 0);
var_dump($out, $my_var);
-$my_var = str_repeat('A', 40);
+$my_var = '0' . str_repeat('A', 39);
$out = substr_replace(array(&$my_var), array(new test2), 40, 0);
var_dump($out, $my_var);
$my_var = str_repeat('A', 40);
@@ -45,7 +45,7 @@ array(1) {
Warning: A non-numeric value encountered in %s on line %d
array(1) {
[0]=>
- string(40) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
+ string(40) "0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
int(134512640)
array(1) {
diff --git a/tests/lang/bug19943.phpt b/tests/lang/bug19943.phpt
index 2266e09165..10d2740319 100644
--- a/tests/lang/bug19943.phpt
+++ b/tests/lang/bug19943.phpt
@@ -5,11 +5,11 @@ Bug #19943 (memleaks)
$ar = array();
for ($count = 0; $count < 10; $count++) {
$ar[$count] = "$count";
- @$ar[$count]['idx'] = "$count";
+ @$ar[$count]['0idx'] = "$count";
}
for ($count = 0; $count < 10; $count++) {
- echo $ar[$count]." -- ".@$ar[$count]['idx']."\n";
+ echo $ar[$count]." -- ".@$ar[$count]['0idx']."\n";
}
$a = "0123456789";
$a[9] = $a[0];
diff --git a/tests/lang/bug28800.phpt b/tests/lang/bug28800.phpt
index 2845ca7c88..487c57d24e 100644
--- a/tests/lang/bug28800.phpt
+++ b/tests/lang/bug28800.phpt
@@ -4,24 +4,18 @@ Bug #28800 (Incorrect string to number conversion for strings starting with 'inf
<?php
$strings = array('into', 'info', 'inf', 'infinity', 'infin', 'inflammable');
foreach ($strings as $v) {
- echo ($v+0)."\n";
+ try {
+ echo ($v+0)."\n";
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
?>
---EXPECTF--
-Warning: A non-numeric value encountered in %s on line %d
-0
+--EXPECT--
+Unsupported operand types: string + int
+Unsupported operand types: string + int
+Unsupported operand types: string + int
+Unsupported operand types: string + int
+Unsupported operand types: string + int
+Unsupported operand types: string + int
-Warning: A non-numeric value encountered in %s on line %d
-0
-
-Warning: A non-numeric value encountered in %s on line %d
-0
-
-Warning: A non-numeric value encountered in %s on line %d
-0
-
-Warning: A non-numeric value encountered in %s on line %d
-0
-
-Warning: A non-numeric value encountered in %s on line %d
-0
diff --git a/tests/lang/bug29566.phpt b/tests/lang/bug29566.phpt
index c80d1af28f..9548e47875 100644
--- a/tests/lang/bug29566.phpt
+++ b/tests/lang/bug29566.phpt
@@ -7,10 +7,10 @@ $var="This is a string";
$dummy="";
unset($dummy);
-foreach($var['nosuchkey'] as $v) {
+foreach($var['0nosuchkey'] as $v) {
}
?>
--EXPECTF--
-Warning: Illegal string offset "nosuchkey" in %s on line %d
+Warning: Illegal string offset "0nosuchkey" in %s on line %d
Warning: foreach() argument must be of type array|object, string given in %sbug29566.php on line %d
diff --git a/tests/lang/operators/add_variationStr.phpt b/tests/lang/operators/add_variationStr.phpt
index 69dd870dcc..9f8f19dadb 100644
--- a/tests/lang/operators/add_variationStr.phpt
+++ b/tests/lang/operators/add_variationStr.phpt
@@ -11,13 +11,16 @@ $strVals = array(
error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
- foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' + '$otherVal' ---\n";
- var_dump($strVal+$otherVal);
- }
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' + '$otherVal' ---\n";
+ try {
+ var_dump($strVal+$otherVal);
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ }
}
-
?>
--EXPECT--
--- testing: '0' + '0' ---
@@ -31,7 +34,7 @@ float(1.2)
--- testing: '0' + '-7.7' ---
float(-7.7)
--- testing: '0' + 'abc' ---
-int(0)
+Unsupported operand types: string + string
--- testing: '0' + '123abc' ---
int(123)
--- testing: '0' + '123e5' ---
@@ -47,7 +50,7 @@ int(123)
--- testing: '0' + '3.4a' ---
float(3.4)
--- testing: '0' + 'a5.9' ---
-int(0)
+Unsupported operand types: string + string
--- testing: '65' + '0' ---
int(65)
--- testing: '65' + '65' ---
@@ -59,7 +62,7 @@ float(66.2)
--- testing: '65' + '-7.7' ---
float(57.3)
--- testing: '65' + 'abc' ---
-int(65)
+Unsupported operand types: string + string
--- testing: '65' + '123abc' ---
int(188)
--- testing: '65' + '123e5' ---
@@ -75,7 +78,7 @@ int(188)
--- testing: '65' + '3.4a' ---
float(68.4)
--- testing: '65' + 'a5.9' ---
-int(65)
+Unsupported operand types: string + string
--- testing: '-44' + '0' ---
int(-44)
--- testing: '-44' + '65' ---
@@ -87,7 +90,7 @@ float(-42.8)
--- testing: '-44' + '-7.7' ---
float(-51.7)
--- testing: '-44' + 'abc' ---
-int(-44)
+Unsupported operand types: string + string
--- testing: '-44' + '123abc' ---
int(79)
--- testing: '-44' + '123e5' ---
@@ -103,7 +106,7 @@ int(79)
--- testing: '-44' + '3.4a' ---
float(-40.6)
--- testing: '-44' + 'a5.9' ---
-int(-44)
+Unsupported operand types: string + string
--- testing: '1.2' + '0' ---
float(1.2)
--- testing: '1.2' + '65' ---
@@ -115,7 +118,7 @@ float(2.4)
--- testing: '1.2' + '-7.7' ---
float(-6.5)
--- testing: '1.2' + 'abc' ---
-float(1.2)
+Unsupported operand types: string + string
--- testing: '1.2' + '123abc' ---
float(124.2)
--- testing: '1.2' + '123e5' ---
@@ -131,7 +134,7 @@ float(124.2)
--- testing: '1.2' + '3.4a' ---
float(4.6)
--- testing: '1.2' + 'a5.9' ---
-float(1.2)
+Unsupported operand types: string + string
--- testing: '-7.7' + '0' ---
float(-7.7)
--- testing: '-7.7' + '65' ---
@@ -143,7 +146,7 @@ float(-6.5)
--- testing: '-7.7' + '-7.7' ---
float(-15.4)
--- testing: '-7.7' + 'abc' ---
-float(-7.7)
+Unsupported operand types: string + string
--- testing: '-7.7' + '123abc' ---
float(115.3)
--- testing: '-7.7' + '123e5' ---
@@ -159,35 +162,35 @@ float(115.3)
--- testing: '-7.7' + '3.4a' ---
float(-4.300000000000001)
--- testing: '-7.7' + 'a5.9' ---
-float(-7.7)
+Unsupported operand types: string + string
--- testing: 'abc' + '0' ---
-int(0)
+Unsupported operand types: string + string
--- testing: 'abc' + '65' ---
-int(65)
+Unsupported operand types: string + string
--- testing: 'abc' + '-44' ---
-int(-44)
+Unsupported operand types: string + string
--- testing: 'abc' + '1.2' ---
-float(1.2)
+Unsupported operand types: string + string
--- testing: 'abc' + '-7.7' ---
-float(-7.7)
+Unsupported operand types: string + string
--- testing: 'abc' + 'abc' ---
-int(0)
+Unsupported operand types: string + string
--- testing: 'abc' + '123abc' ---
-int(123)
+Unsupported operand types: string + string
--- testing: 'abc' + '123e5' ---
-float(12300000)
+Unsupported operand types: string + string
--- testing: 'abc' + '123e5xyz' ---
-float(12300000)
+Unsupported operand types: string + string
--- testing: 'abc' + ' 123abc' ---
-int(123)
+Unsupported operand types: string + string
--- testing: 'abc' + '123 abc' ---
-int(123)
+Unsupported operand types: string + string
--- testing: 'abc' + '123abc ' ---
-int(123)
+Unsupported operand types: string + string
--- testing: 'abc' + '3.4a' ---
-float(3.4)
+Unsupported operand types: string + string
--- testing: 'abc' + 'a5.9' ---
-int(0)
+Unsupported operand types: string + string
--- testing: '123abc' + '0' ---
int(123)
--- testing: '123abc' + '65' ---
@@ -199,7 +202,7 @@ float(124.2)
--- testing: '123abc' + '-7.7' ---
float(115.3)
--- testing: '123abc' + 'abc' ---
-int(123)
+Unsupported operand types: string + string
--- testing: '123abc' + '123abc' ---
int(246)
--- testing: '123abc' + '123e5' ---
@@ -215,7 +218,7 @@ int(246)
--- testing: '123abc' + '3.4a' ---
float(126.4)
--- testing: '123abc' + 'a5.9' ---
-int(123)
+Unsupported operand types: string + string
--- testing: '123e5' + '0' ---
float(12300000)
--- testing: '123e5' + '65' ---
@@ -227,7 +230,7 @@ float(12300001.2)
--- testing: '123e5' + '-7.7' ---
float(12299992.3)
--- testing: '123e5' + 'abc' ---
-float(12300000)
+Unsupported operand types: string + string
--- testing: '123e5' + '123abc' ---
float(12300123)
--- testing: '123e5' + '123e5' ---
@@ -243,7 +246,7 @@ float(12300123)
--- testing: '123e5' + '3.4a' ---
float(12300003.4)
--- testing: '123e5' + 'a5.9' ---
-float(12300000)
+Unsupported operand types: string + string
--- testing: '123e5xyz' + '0' ---
float(12300000)
--- testing: '123e5xyz' + '65' ---
@@ -255,7 +258,7 @@ float(12300001.2)
--- testing: '123e5xyz' + '-7.7' ---
float(12299992.3)
--- testing: '123e5xyz' + 'abc' ---
-float(12300000)
+Unsupported operand types: string + string
--- testing: '123e5xyz' + '123abc' ---
float(12300123)
--- testing: '123e5xyz' + '123e5' ---
@@ -271,7 +274,7 @@ float(12300123)
--- testing: '123e5xyz' + '3.4a' ---
float(12300003.4)
--- testing: '123e5xyz' + 'a5.9' ---
-float(12300000)
+Unsupported operand types: string + string
--- testing: ' 123abc' + '0' ---
int(123)
--- testing: ' 123abc' + '65' ---
@@ -283,7 +286,7 @@ float(124.2)
--- testing: ' 123abc' + '-7.7' ---
float(115.3)
--- testing: ' 123abc' + 'abc' ---
-int(123)
+Unsupported operand types: string + string
--- testing: ' 123abc' + '123abc' ---
int(246)
--- testing: ' 123abc' + '123e5' ---
@@ -299,7 +302,7 @@ int(246)
--- testing: ' 123abc' + '3.4a' ---
float(126.4)
--- testing: ' 123abc' + 'a5.9' ---
-int(123)
+Unsupported operand types: string + string
--- testing: '123 abc' + '0' ---
int(123)
--- testing: '123 abc' + '65' ---
@@ -311,7 +314,7 @@ float(124.2)
--- testing: '123 abc' + '-7.7' ---
float(115.3)
--- testing: '123 abc' + 'abc' ---
-int(123)
+Unsupported operand types: string + string
--- testing: '123 abc' + '123abc' ---
int(246)
--- testing: '123 abc' + '123e5' ---
@@ -327,7 +330,7 @@ int(246)
--- testing: '123 abc' + '3.4a' ---
float(126.4)
--- testing: '123 abc' + 'a5.9' ---
-int(123)
+Unsupported operand types: string + string
--- testing: '123abc ' + '0' ---
int(123)
--- testing: '123abc ' + '65' ---
@@ -339,7 +342,7 @@ float(124.2)
--- testing: '123abc ' + '-7.7' ---
float(115.3)
--- testing: '123abc ' + 'abc' ---
-int(123)
+Unsupported operand types: string + string
--- testing: '123abc ' + '123abc' ---
int(246)
--- testing: '123abc ' + '123e5' ---
@@ -355,7 +358,7 @@ int(246)
--- testing: '123abc ' + '3.4a' ---
float(126.4)
--- testing: '123abc ' + 'a5.9' ---
-int(123)
+Unsupported operand types: string + string
--- testing: '3.4a' + '0' ---
float(3.4)
--- testing: '3.4a' + '65' ---
@@ -367,7 +370,7 @@ float(4.6)
--- testing: '3.4a' + '-7.7' ---
float(-4.300000000000001)
--- testing: '3.4a' + 'abc' ---
-float(3.4)
+Unsupported operand types: string + string
--- testing: '3.4a' + '123abc' ---
float(126.4)
--- testing: '3.4a' + '123e5' ---
@@ -383,32 +386,32 @@ float(126.4)
--- testing: '3.4a' + '3.4a' ---
float(6.8)
--- testing: '3.4a' + 'a5.9' ---
-float(3.4)
+Unsupported operand types: string + string
--- testing: 'a5.9' + '0' ---
-int(0)
+Unsupported operand types: string + string
--- testing: 'a5.9' + '65' ---
-int(65)
+Unsupported operand types: string + string
--- testing: 'a5.9' + '-44' ---
-int(-44)
+Unsupported operand types: string + string
--- testing: 'a5.9' + '1.2' ---
-float(1.2)
+Unsupported operand types: string + string
--- testing: 'a5.9' + '-7.7' ---
-float(-7.7)
+Unsupported operand types: string + string
--- testing: 'a5.9' + 'abc' ---
-int(0)
+Unsupported operand types: string + string
--- testing: 'a5.9' + '123abc' ---
-int(123)
+Unsupported operand types: string + string
--- testing: 'a5.9' + '123e5' ---
-float(12300000)
+Unsupported operand types: string + string
--- testing: 'a5.9' + '123e5xyz' ---
-float(12300000)
+Unsupported operand types: string + string
--- testing: 'a5.9' + ' 123abc' ---
-int(123)
+Unsupported operand types: string + string
--- testing: 'a5.9' + '123 abc' ---
-int(123)
+Unsupported operand types: string + string
--- testing: 'a5.9' + '123abc ' ---
-int(123)
+Unsupported operand types: string + string
--- testing: 'a5.9' + '3.4a' ---
-float(3.4)
+Unsupported operand types: string + string
--- testing: 'a5.9' + 'a5.9' ---
-int(0)
+Unsupported operand types: string + string
diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt
index 49de21f64b..cf227ddf8f 100644
--- a/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt
+++ b/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt
@@ -16,7 +16,7 @@ foreach ($strVals as $strVal) {
try {
var_dump($strVal<<$otherVal);
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo get_class($e) . ': ' . $e->getMessage() . "\n";
}
}
}
@@ -28,13 +28,13 @@ int(0)
--- testing: '0' << '65' ---
int(0)
--- testing: '0' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '0' << '1.2' ---
int(0)
--- testing: '0' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '0' << 'abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: '0' << '123abc' ---
int(0)
--- testing: '0' << '123e5' ---
@@ -50,19 +50,19 @@ int(0)
--- testing: '0' << '3.4a' ---
int(0)
--- testing: '0' << 'a5.9' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: '65' << '0' ---
int(65)
--- testing: '65' << '65' ---
int(0)
--- testing: '65' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '65' << '1.2' ---
int(130)
--- testing: '65' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '65' << 'abc' ---
-int(65)
+TypeError: Unsupported operand types: string << string
--- testing: '65' << '123abc' ---
int(0)
--- testing: '65' << '123e5' ---
@@ -78,19 +78,19 @@ int(0)
--- testing: '65' << '3.4a' ---
int(520)
--- testing: '65' << 'a5.9' ---
-int(65)
+TypeError: Unsupported operand types: string << string
--- testing: '-44' << '0' ---
int(-44)
--- testing: '-44' << '65' ---
int(0)
--- testing: '-44' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '-44' << '1.2' ---
int(-88)
--- testing: '-44' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '-44' << 'abc' ---
-int(-44)
+TypeError: Unsupported operand types: string << string
--- testing: '-44' << '123abc' ---
int(0)
--- testing: '-44' << '123e5' ---
@@ -106,19 +106,19 @@ int(0)
--- testing: '-44' << '3.4a' ---
int(-352)
--- testing: '-44' << 'a5.9' ---
-int(-44)
+TypeError: Unsupported operand types: string << string
--- testing: '1.2' << '0' ---
int(1)
--- testing: '1.2' << '65' ---
int(0)
--- testing: '1.2' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '1.2' << '1.2' ---
int(2)
--- testing: '1.2' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '1.2' << 'abc' ---
-int(1)
+TypeError: Unsupported operand types: string << string
--- testing: '1.2' << '123abc' ---
int(0)
--- testing: '1.2' << '123e5' ---
@@ -134,19 +134,19 @@ int(0)
--- testing: '1.2' << '3.4a' ---
int(8)
--- testing: '1.2' << 'a5.9' ---
-int(1)
+TypeError: Unsupported operand types: string << string
--- testing: '-7.7' << '0' ---
int(-7)
--- testing: '-7.7' << '65' ---
int(0)
--- testing: '-7.7' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '-7.7' << '1.2' ---
int(-14)
--- testing: '-7.7' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '-7.7' << 'abc' ---
-int(-7)
+TypeError: Unsupported operand types: string << string
--- testing: '-7.7' << '123abc' ---
int(0)
--- testing: '-7.7' << '123e5' ---
@@ -162,47 +162,47 @@ int(0)
--- testing: '-7.7' << '3.4a' ---
int(-56)
--- testing: '-7.7' << 'a5.9' ---
-int(-7)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '0' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '65' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '-44' ---
-Exception: Bit shift by negative number
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '1.2' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '-7.7' ---
-Exception: Bit shift by negative number
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << 'abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '123abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '123e5' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '123e5xyz' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << ' 123abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '123 abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '123abc ' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '3.4a' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << 'a5.9' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: '123abc' << '0' ---
int(123)
--- testing: '123abc' << '65' ---
int(0)
--- testing: '123abc' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123abc' << '1.2' ---
int(246)
--- testing: '123abc' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123abc' << 'abc' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '123abc' << '123abc' ---
int(0)
--- testing: '123abc' << '123e5' ---
@@ -218,19 +218,19 @@ int(0)
--- testing: '123abc' << '3.4a' ---
int(984)
--- testing: '123abc' << 'a5.9' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '123e5' << '0' ---
int(12300000)
--- testing: '123e5' << '65' ---
int(0)
--- testing: '123e5' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123e5' << '1.2' ---
int(24600000)
--- testing: '123e5' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123e5' << 'abc' ---
-int(12300000)
+TypeError: Unsupported operand types: string << string
--- testing: '123e5' << '123abc' ---
int(0)
--- testing: '123e5' << '123e5' ---
@@ -246,19 +246,19 @@ int(0)
--- testing: '123e5' << '3.4a' ---
int(98400000)
--- testing: '123e5' << 'a5.9' ---
-int(12300000)
+TypeError: Unsupported operand types: string << string
--- testing: '123e5xyz' << '0' ---
int(12300000)
--- testing: '123e5xyz' << '65' ---
int(0)
--- testing: '123e5xyz' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123e5xyz' << '1.2' ---
int(24600000)
--- testing: '123e5xyz' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123e5xyz' << 'abc' ---
-int(12300000)
+TypeError: Unsupported operand types: string << string
--- testing: '123e5xyz' << '123abc' ---
int(0)
--- testing: '123e5xyz' << '123e5' ---
@@ -274,19 +274,19 @@ int(0)
--- testing: '123e5xyz' << '3.4a' ---
int(98400000)
--- testing: '123e5xyz' << 'a5.9' ---
-int(12300000)
+TypeError: Unsupported operand types: string << string
--- testing: ' 123abc' << '0' ---
int(123)
--- testing: ' 123abc' << '65' ---
int(0)
--- testing: ' 123abc' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: ' 123abc' << '1.2' ---
int(246)
--- testing: ' 123abc' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: ' 123abc' << 'abc' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: ' 123abc' << '123abc' ---
int(0)
--- testing: ' 123abc' << '123e5' ---
@@ -302,19 +302,19 @@ int(0)
--- testing: ' 123abc' << '3.4a' ---
int(984)
--- testing: ' 123abc' << 'a5.9' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '123 abc' << '0' ---
int(123)
--- testing: '123 abc' << '65' ---
int(0)
--- testing: '123 abc' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123 abc' << '1.2' ---
int(246)
--- testing: '123 abc' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123 abc' << 'abc' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '123 abc' << '123abc' ---
int(0)
--- testing: '123 abc' << '123e5' ---
@@ -330,19 +330,19 @@ int(0)
--- testing: '123 abc' << '3.4a' ---
int(984)
--- testing: '123 abc' << 'a5.9' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '123abc ' << '0' ---
int(123)
--- testing: '123abc ' << '65' ---
int(0)
--- testing: '123abc ' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123abc ' << '1.2' ---
int(246)
--- testing: '123abc ' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123abc ' << 'abc' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '123abc ' << '123abc' ---
int(0)
--- testing: '123abc ' << '123e5' ---
@@ -358,19 +358,19 @@ int(0)
--- testing: '123abc ' << '3.4a' ---
int(984)
--- testing: '123abc ' << 'a5.9' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '3.4a' << '0' ---
int(3)
--- testing: '3.4a' << '65' ---
int(0)
--- testing: '3.4a' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '3.4a' << '1.2' ---
int(6)
--- testing: '3.4a' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '3.4a' << 'abc' ---
-int(3)
+TypeError: Unsupported operand types: string << string
--- testing: '3.4a' << '123abc' ---
int(0)
--- testing: '3.4a' << '123e5' ---
@@ -386,32 +386,32 @@ int(0)
--- testing: '3.4a' << '3.4a' ---
int(24)
--- testing: '3.4a' << 'a5.9' ---
-int(3)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '0' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '65' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '-44' ---
-Exception: Bit shift by negative number
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '1.2' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '-7.7' ---
-Exception: Bit shift by negative number
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << 'abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '123abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '123e5' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '123e5xyz' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << ' 123abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '123 abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '123abc ' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '3.4a' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << 'a5.9' ---
-int(0)
+TypeError: Unsupported operand types: string << string
diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt
index b3ca624abb..c3e7af9892 100644
--- a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt
+++ b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt
@@ -19,8 +19,8 @@ foreach ($strVals as $strVal) {
echo "--- testing: '$strVal' << '$otherVal' ---\n";
try {
var_dump($strVal<<$otherVal);
- } catch (ArithmeticError $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ } catch (\Throwable $e) {
+ echo get_class($e) . ': ' . $e->getMessage() . "\n";
}
}
}
@@ -33,13 +33,13 @@ int(0)
--- testing: '0' << '65' ---
int(0)
--- testing: '0' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '0' << '1.2' ---
int(0)
--- testing: '0' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '0' << 'abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: '0' << '123abc' ---
int(0)
--- testing: '0' << '123e5' ---
@@ -55,19 +55,19 @@ int(0)
--- testing: '0' << '3.4a' ---
int(0)
--- testing: '0' << 'a5.9' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: '65' << '0' ---
int(65)
--- testing: '65' << '65' ---
int(0)
--- testing: '65' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '65' << '1.2' ---
int(130)
--- testing: '65' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '65' << 'abc' ---
-int(65)
+TypeError: Unsupported operand types: string << string
--- testing: '65' << '123abc' ---
int(0)
--- testing: '65' << '123e5' ---
@@ -83,19 +83,19 @@ int(0)
--- testing: '65' << '3.4a' ---
int(520)
--- testing: '65' << 'a5.9' ---
-int(65)
+TypeError: Unsupported operand types: string << string
--- testing: '-44' << '0' ---
int(-44)
--- testing: '-44' << '65' ---
int(0)
--- testing: '-44' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '-44' << '1.2' ---
int(-88)
--- testing: '-44' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '-44' << 'abc' ---
-int(-44)
+TypeError: Unsupported operand types: string << string
--- testing: '-44' << '123abc' ---
int(0)
--- testing: '-44' << '123e5' ---
@@ -111,19 +111,19 @@ int(0)
--- testing: '-44' << '3.4a' ---
int(-352)
--- testing: '-44' << 'a5.9' ---
-int(-44)
+TypeError: Unsupported operand types: string << string
--- testing: '1.2' << '0' ---
int(1)
--- testing: '1.2' << '65' ---
int(0)
--- testing: '1.2' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '1.2' << '1.2' ---
int(2)
--- testing: '1.2' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '1.2' << 'abc' ---
-int(1)
+TypeError: Unsupported operand types: string << string
--- testing: '1.2' << '123abc' ---
int(0)
--- testing: '1.2' << '123e5' ---
@@ -139,19 +139,19 @@ int(0)
--- testing: '1.2' << '3.4a' ---
int(8)
--- testing: '1.2' << 'a5.9' ---
-int(1)
+TypeError: Unsupported operand types: string << string
--- testing: '-7.7' << '0' ---
int(-7)
--- testing: '-7.7' << '65' ---
int(0)
--- testing: '-7.7' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '-7.7' << '1.2' ---
int(-14)
--- testing: '-7.7' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '-7.7' << 'abc' ---
-int(-7)
+TypeError: Unsupported operand types: string << string
--- testing: '-7.7' << '123abc' ---
int(0)
--- testing: '-7.7' << '123e5' ---
@@ -167,47 +167,47 @@ int(0)
--- testing: '-7.7' << '3.4a' ---
int(-56)
--- testing: '-7.7' << 'a5.9' ---
-int(-7)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '0' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '65' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '-44' ---
-Exception: Bit shift by negative number
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '1.2' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '-7.7' ---
-Exception: Bit shift by negative number
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << 'abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '123abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '123e5' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '123e5xyz' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << ' 123abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '123 abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '123abc ' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << '3.4a' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'abc' << 'a5.9' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: '123abc' << '0' ---
int(123)
--- testing: '123abc' << '65' ---
int(0)
--- testing: '123abc' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123abc' << '1.2' ---
int(246)
--- testing: '123abc' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123abc' << 'abc' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '123abc' << '123abc' ---
int(0)
--- testing: '123abc' << '123e5' ---
@@ -223,19 +223,19 @@ int(0)
--- testing: '123abc' << '3.4a' ---
int(984)
--- testing: '123abc' << 'a5.9' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '123e5' << '0' ---
int(12300000)
--- testing: '123e5' << '65' ---
int(0)
--- testing: '123e5' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123e5' << '1.2' ---
int(24600000)
--- testing: '123e5' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123e5' << 'abc' ---
-int(12300000)
+TypeError: Unsupported operand types: string << string
--- testing: '123e5' << '123abc' ---
int(0)
--- testing: '123e5' << '123e5' ---
@@ -251,19 +251,19 @@ int(0)
--- testing: '123e5' << '3.4a' ---
int(98400000)
--- testing: '123e5' << 'a5.9' ---
-int(12300000)
+TypeError: Unsupported operand types: string << string
--- testing: '123e5xyz' << '0' ---
int(12300000)
--- testing: '123e5xyz' << '65' ---
int(0)
--- testing: '123e5xyz' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123e5xyz' << '1.2' ---
int(24600000)
--- testing: '123e5xyz' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123e5xyz' << 'abc' ---
-int(12300000)
+TypeError: Unsupported operand types: string << string
--- testing: '123e5xyz' << '123abc' ---
int(0)
--- testing: '123e5xyz' << '123e5' ---
@@ -279,19 +279,19 @@ int(0)
--- testing: '123e5xyz' << '3.4a' ---
int(98400000)
--- testing: '123e5xyz' << 'a5.9' ---
-int(12300000)
+TypeError: Unsupported operand types: string << string
--- testing: ' 123abc' << '0' ---
int(123)
--- testing: ' 123abc' << '65' ---
int(0)
--- testing: ' 123abc' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: ' 123abc' << '1.2' ---
int(246)
--- testing: ' 123abc' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: ' 123abc' << 'abc' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: ' 123abc' << '123abc' ---
int(0)
--- testing: ' 123abc' << '123e5' ---
@@ -307,19 +307,19 @@ int(0)
--- testing: ' 123abc' << '3.4a' ---
int(984)
--- testing: ' 123abc' << 'a5.9' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '123 abc' << '0' ---
int(123)
--- testing: '123 abc' << '65' ---
int(0)
--- testing: '123 abc' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123 abc' << '1.2' ---
int(246)
--- testing: '123 abc' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123 abc' << 'abc' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '123 abc' << '123abc' ---
int(0)
--- testing: '123 abc' << '123e5' ---
@@ -335,19 +335,19 @@ int(0)
--- testing: '123 abc' << '3.4a' ---
int(984)
--- testing: '123 abc' << 'a5.9' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '123abc ' << '0' ---
int(123)
--- testing: '123abc ' << '65' ---
int(0)
--- testing: '123abc ' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123abc ' << '1.2' ---
int(246)
--- testing: '123abc ' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123abc ' << 'abc' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '123abc ' << '123abc' ---
int(0)
--- testing: '123abc ' << '123e5' ---
@@ -363,19 +363,19 @@ int(0)
--- testing: '123abc ' << '3.4a' ---
int(984)
--- testing: '123abc ' << 'a5.9' ---
-int(123)
+TypeError: Unsupported operand types: string << string
--- testing: '3.4a' << '0' ---
int(3)
--- testing: '3.4a' << '65' ---
int(0)
--- testing: '3.4a' << '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '3.4a' << '1.2' ---
int(6)
--- testing: '3.4a' << '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '3.4a' << 'abc' ---
-int(3)
+TypeError: Unsupported operand types: string << string
--- testing: '3.4a' << '123abc' ---
int(0)
--- testing: '3.4a' << '123e5' ---
@@ -391,32 +391,32 @@ int(0)
--- testing: '3.4a' << '3.4a' ---
int(24)
--- testing: '3.4a' << 'a5.9' ---
-int(3)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '0' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '65' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '-44' ---
-Exception: Bit shift by negative number
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '1.2' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '-7.7' ---
-Exception: Bit shift by negative number
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << 'abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '123abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '123e5' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '123e5xyz' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << ' 123abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '123 abc' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '123abc ' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << '3.4a' ---
-int(0)
+TypeError: Unsupported operand types: string << string
--- testing: 'a5.9' << 'a5.9' ---
-int(0)
+TypeError: Unsupported operand types: string << string
diff --git a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt
index 525f951a51..d1f124933c 100644
--- a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt
+++ b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt
@@ -15,8 +15,8 @@ foreach ($strVals as $strVal) {
echo "--- testing: '$strVal' >> '$otherVal' ---\n";
try {
var_dump($strVal>>$otherVal);
- } catch (ArithmeticError $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ } catch (\Throwable $e) {
+ echo get_class($e) . ': ' . $e->getMessage() . "\n";
}
}
}
@@ -29,13 +29,13 @@ int(0)
--- testing: '0' >> '65' ---
int(0)
--- testing: '0' >> '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '0' >> '1.2' ---
int(0)
--- testing: '0' >> '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '0' >> 'abc' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: '0' >> '123abc' ---
int(0)
--- testing: '0' >> '123e5' ---
@@ -51,19 +51,19 @@ int(0)
--- testing: '0' >> '3.4a' ---
int(0)
--- testing: '0' >> 'a5.9' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: '65' >> '0' ---
int(65)
--- testing: '65' >> '65' ---
int(0)
--- testing: '65' >> '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '65' >> '1.2' ---
int(32)
--- testing: '65' >> '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '65' >> 'abc' ---
-int(65)
+TypeError: Unsupported operand types: string >> string
--- testing: '65' >> '123abc' ---
int(0)
--- testing: '65' >> '123e5' ---
@@ -79,19 +79,19 @@ int(0)
--- testing: '65' >> '3.4a' ---
int(8)
--- testing: '65' >> 'a5.9' ---
-int(65)
+TypeError: Unsupported operand types: string >> string
--- testing: '-44' >> '0' ---
int(-44)
--- testing: '-44' >> '65' ---
int(-1)
--- testing: '-44' >> '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '-44' >> '1.2' ---
int(-22)
--- testing: '-44' >> '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '-44' >> 'abc' ---
-int(-44)
+TypeError: Unsupported operand types: string >> string
--- testing: '-44' >> '123abc' ---
int(-1)
--- testing: '-44' >> '123e5' ---
@@ -107,19 +107,19 @@ int(-1)
--- testing: '-44' >> '3.4a' ---
int(-6)
--- testing: '-44' >> 'a5.9' ---
-int(-44)
+TypeError: Unsupported operand types: string >> string
--- testing: '1.2' >> '0' ---
int(1)
--- testing: '1.2' >> '65' ---
int(0)
--- testing: '1.2' >> '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '1.2' >> '1.2' ---
int(0)
--- testing: '1.2' >> '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '1.2' >> 'abc' ---
-int(1)
+TypeError: Unsupported operand types: string >> string
--- testing: '1.2' >> '123abc' ---
int(0)
--- testing: '1.2' >> '123e5' ---
@@ -135,19 +135,19 @@ int(0)
--- testing: '1.2' >> '3.4a' ---
int(0)
--- testing: '1.2' >> 'a5.9' ---
-int(1)
+TypeError: Unsupported operand types: string >> string
--- testing: '-7.7' >> '0' ---
int(-7)
--- testing: '-7.7' >> '65' ---
int(-1)
--- testing: '-7.7' >> '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '-7.7' >> '1.2' ---
int(-4)
--- testing: '-7.7' >> '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '-7.7' >> 'abc' ---
-int(-7)
+TypeError: Unsupported operand types: string >> string
--- testing: '-7.7' >> '123abc' ---
int(-1)
--- testing: '-7.7' >> '123e5' ---
@@ -163,47 +163,47 @@ int(-1)
--- testing: '-7.7' >> '3.4a' ---
int(-1)
--- testing: '-7.7' >> 'a5.9' ---
-int(-7)
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> '0' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> '65' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> '-44' ---
-Exception: Bit shift by negative number
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> '1.2' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> '-7.7' ---
-Exception: Bit shift by negative number
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> 'abc' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> '123abc' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> '123e5' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> '123e5xyz' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> ' 123abc' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> '123 abc' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> '123abc ' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> '3.4a' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'abc' >> 'a5.9' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: '123abc' >> '0' ---
int(123)
--- testing: '123abc' >> '65' ---
int(0)
--- testing: '123abc' >> '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123abc' >> '1.2' ---
int(61)
--- testing: '123abc' >> '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123abc' >> 'abc' ---
-int(123)
+TypeError: Unsupported operand types: string >> string
--- testing: '123abc' >> '123abc' ---
int(0)
--- testing: '123abc' >> '123e5' ---
@@ -219,19 +219,19 @@ int(0)
--- testing: '123abc' >> '3.4a' ---
int(15)
--- testing: '123abc' >> 'a5.9' ---
-int(123)
+TypeError: Unsupported operand types: string >> string
--- testing: '123e5' >> '0' ---
int(12300000)
--- testing: '123e5' >> '65' ---
int(0)
--- testing: '123e5' >> '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123e5' >> '1.2' ---
int(6150000)
--- testing: '123e5' >> '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123e5' >> 'abc' ---
-int(12300000)
+TypeError: Unsupported operand types: string >> string
--- testing: '123e5' >> '123abc' ---
int(0)
--- testing: '123e5' >> '123e5' ---
@@ -247,19 +247,19 @@ int(0)
--- testing: '123e5' >> '3.4a' ---
int(1537500)
--- testing: '123e5' >> 'a5.9' ---
-int(12300000)
+TypeError: Unsupported operand types: string >> string
--- testing: '123e5xyz' >> '0' ---
int(12300000)
--- testing: '123e5xyz' >> '65' ---
int(0)
--- testing: '123e5xyz' >> '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123e5xyz' >> '1.2' ---
int(6150000)
--- testing: '123e5xyz' >> '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123e5xyz' >> 'abc' ---
-int(12300000)
+TypeError: Unsupported operand types: string >> string
--- testing: '123e5xyz' >> '123abc' ---
int(0)
--- testing: '123e5xyz' >> '123e5' ---
@@ -275,19 +275,19 @@ int(0)
--- testing: '123e5xyz' >> '3.4a' ---
int(1537500)
--- testing: '123e5xyz' >> 'a5.9' ---
-int(12300000)
+TypeError: Unsupported operand types: string >> string
--- testing: ' 123abc' >> '0' ---
int(123)
--- testing: ' 123abc' >> '65' ---
int(0)
--- testing: ' 123abc' >> '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: ' 123abc' >> '1.2' ---
int(61)
--- testing: ' 123abc' >> '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: ' 123abc' >> 'abc' ---
-int(123)
+TypeError: Unsupported operand types: string >> string
--- testing: ' 123abc' >> '123abc' ---
int(0)
--- testing: ' 123abc' >> '123e5' ---
@@ -303,19 +303,19 @@ int(0)
--- testing: ' 123abc' >> '3.4a' ---
int(15)
--- testing: ' 123abc' >> 'a5.9' ---
-int(123)
+TypeError: Unsupported operand types: string >> string
--- testing: '123 abc' >> '0' ---
int(123)
--- testing: '123 abc' >> '65' ---
int(0)
--- testing: '123 abc' >> '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123 abc' >> '1.2' ---
int(61)
--- testing: '123 abc' >> '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123 abc' >> 'abc' ---
-int(123)
+TypeError: Unsupported operand types: string >> string
--- testing: '123 abc' >> '123abc' ---
int(0)
--- testing: '123 abc' >> '123e5' ---
@@ -331,19 +331,19 @@ int(0)
--- testing: '123 abc' >> '3.4a' ---
int(15)
--- testing: '123 abc' >> 'a5.9' ---
-int(123)
+TypeError: Unsupported operand types: string >> string
--- testing: '123abc ' >> '0' ---
int(123)
--- testing: '123abc ' >> '65' ---
int(0)
--- testing: '123abc ' >> '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123abc ' >> '1.2' ---
int(61)
--- testing: '123abc ' >> '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '123abc ' >> 'abc' ---
-int(123)
+TypeError: Unsupported operand types: string >> string
--- testing: '123abc ' >> '123abc' ---
int(0)
--- testing: '123abc ' >> '123e5' ---
@@ -359,19 +359,19 @@ int(0)
--- testing: '123abc ' >> '3.4a' ---
int(15)
--- testing: '123abc ' >> 'a5.9' ---
-int(123)
+TypeError: Unsupported operand types: string >> string
--- testing: '3.4a' >> '0' ---
int(3)
--- testing: '3.4a' >> '65' ---
int(0)
--- testing: '3.4a' >> '-44' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '3.4a' >> '1.2' ---
int(1)
--- testing: '3.4a' >> '-7.7' ---
-Exception: Bit shift by negative number
+ArithmeticError: Bit shift by negative number
--- testing: '3.4a' >> 'abc' ---
-int(3)
+TypeError: Unsupported operand types: string >> string
--- testing: '3.4a' >> '123abc' ---
int(0)
--- testing: '3.4a' >> '123e5' ---
@@ -387,32 +387,32 @@ int(0)
--- testing: '3.4a' >> '3.4a' ---
int(0)
--- testing: '3.4a' >> 'a5.9' ---
-int(3)
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> '0' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> '65' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> '-44' ---
-Exception: Bit shift by negative number
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> '1.2' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> '-7.7' ---
-Exception: Bit shift by negative number
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> 'abc' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> '123abc' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> '123e5' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> '123e5xyz' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> ' 123abc' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> '123 abc' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> '123abc ' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> '3.4a' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
--- testing: 'a5.9' >> 'a5.9' ---
-int(0)
+TypeError: Unsupported operand types: string >> string
diff --git a/tests/lang/operators/divide_variationStr.phpt b/tests/lang/operators/divide_variationStr.phpt
index b3a11591ed..be7118edbd 100644
--- a/tests/lang/operators/divide_variationStr.phpt
+++ b/tests/lang/operators/divide_variationStr.phpt
@@ -11,404 +11,408 @@ $strVals = array(
error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
- foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' / '$otherVal' ---\n";
- var_dump($strVal/$otherVal);
- }
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal'/'$otherVal' ---\n";
+ try {
+ var_dump($strVal/$otherVal);
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ }
}
?>
--EXPECT--
---- testing: '0' / '0' ---
+--- testing: '0'/'0' ---
float(NAN)
---- testing: '0' / '65' ---
+--- testing: '0'/'65' ---
int(0)
---- testing: '0' / '-44' ---
+--- testing: '0'/'-44' ---
int(0)
---- testing: '0' / '1.2' ---
+--- testing: '0'/'1.2' ---
float(0)
---- testing: '0' / '-7.7' ---
+--- testing: '0'/'-7.7' ---
float(-0)
---- testing: '0' / 'abc' ---
-float(NAN)
---- testing: '0' / '123abc' ---
+--- testing: '0'/'abc' ---
+Unsupported operand types: string / string
+--- testing: '0'/'123abc' ---
int(0)
---- testing: '0' / '123e5' ---
+--- testing: '0'/'123e5' ---
float(0)
---- testing: '0' / '123e5xyz' ---
+--- testing: '0'/'123e5xyz' ---
float(0)
---- testing: '0' / ' 123abc' ---
+--- testing: '0'/' 123abc' ---
int(0)
---- testing: '0' / '123 abc' ---
+--- testing: '0'/'123 abc' ---
int(0)
---- testing: '0' / '123abc ' ---
+--- testing: '0'/'123abc ' ---
int(0)
---- testing: '0' / '3.4a' ---
+--- testing: '0'/'3.4a' ---
float(0)
---- testing: '0' / 'a5.9' ---
-float(NAN)
---- testing: '65' / '0' ---
+--- testing: '0'/'a5.9' ---
+Unsupported operand types: string / string
+--- testing: '65'/'0' ---
float(INF)
---- testing: '65' / '65' ---
+--- testing: '65'/'65' ---
int(1)
---- testing: '65' / '-44' ---
+--- testing: '65'/'-44' ---
float(-1.4772727272727273)
---- testing: '65' / '1.2' ---
+--- testing: '65'/'1.2' ---
float(54.16666666666667)
---- testing: '65' / '-7.7' ---
+--- testing: '65'/'-7.7' ---
float(-8.441558441558442)
---- testing: '65' / 'abc' ---
-float(INF)
---- testing: '65' / '123abc' ---
+--- testing: '65'/'abc' ---
+Unsupported operand types: string / string
+--- testing: '65'/'123abc' ---
float(0.5284552845528455)
---- testing: '65' / '123e5' ---
+--- testing: '65'/'123e5' ---
float(5.2845528455284555E-6)
---- testing: '65' / '123e5xyz' ---
+--- testing: '65'/'123e5xyz' ---
float(5.2845528455284555E-6)
---- testing: '65' / ' 123abc' ---
+--- testing: '65'/' 123abc' ---
float(0.5284552845528455)
---- testing: '65' / '123 abc' ---
+--- testing: '65'/'123 abc' ---
float(0.5284552845528455)
---- testing: '65' / '123abc ' ---
+--- testing: '65'/'123abc ' ---
float(0.5284552845528455)
---- testing: '65' / '3.4a' ---
+--- testing: '65'/'3.4a' ---
float(19.11764705882353)
---- testing: '65' / 'a5.9' ---
-float(INF)
---- testing: '-44' / '0' ---
+--- testing: '65'/'a5.9' ---
+Unsupported operand types: string / string
+--- testing: '-44'/'0' ---
float(-INF)
---- testing: '-44' / '65' ---
+--- testing: '-44'/'65' ---
float(-0.676923076923077)
---- testing: '-44' / '-44' ---
+--- testing: '-44'/'-44' ---
int(1)
---- testing: '-44' / '1.2' ---
+--- testing: '-44'/'1.2' ---
float(-36.66666666666667)
---- testing: '-44' / '-7.7' ---
+--- testing: '-44'/'-7.7' ---
float(5.714285714285714)
---- testing: '-44' / 'abc' ---
-float(-INF)
---- testing: '-44' / '123abc' ---
+--- testing: '-44'/'abc' ---
+Unsupported operand types: string / string
+--- testing: '-44'/'123abc' ---
float(-0.35772357723577236)
---- testing: '-44' / '123e5' ---
+--- testing: '-44'/'123e5' ---
float(-3.5772357723577236E-6)
---- testing: '-44' / '123e5xyz' ---
+--- testing: '-44'/'123e5xyz' ---
float(-3.5772357723577236E-6)
---- testing: '-44' / ' 123abc' ---
+--- testing: '-44'/' 123abc' ---
float(-0.35772357723577236)
---- testing: '-44' / '123 abc' ---
+--- testing: '-44'/'123 abc' ---
float(-0.35772357723577236)
---- testing: '-44' / '123abc ' ---
+--- testing: '-44'/'123abc ' ---
float(-0.35772357723577236)
---- testing: '-44' / '3.4a' ---
+--- testing: '-44'/'3.4a' ---
float(-12.941176470588236)
---- testing: '-44' / 'a5.9' ---
-float(-INF)
---- testing: '1.2' / '0' ---
+--- testing: '-44'/'a5.9' ---
+Unsupported operand types: string / string
+--- testing: '1.2'/'0' ---
float(INF)
---- testing: '1.2' / '65' ---
+--- testing: '1.2'/'65' ---
float(0.01846153846153846)
---- testing: '1.2' / '-44' ---
+--- testing: '1.2'/'-44' ---
float(-0.02727272727272727)
---- testing: '1.2' / '1.2' ---
+--- testing: '1.2'/'1.2' ---
float(1)
---- testing: '1.2' / '-7.7' ---
+--- testing: '1.2'/'-7.7' ---
float(-0.15584415584415584)
---- testing: '1.2' / 'abc' ---
-float(INF)
---- testing: '1.2' / '123abc' ---
+--- testing: '1.2'/'abc' ---
+Unsupported operand types: string / string
+--- testing: '1.2'/'123abc' ---
float(0.00975609756097561)
---- testing: '1.2' / '123e5' ---
+--- testing: '1.2'/'123e5' ---
float(9.75609756097561E-8)
---- testing: '1.2' / '123e5xyz' ---
+--- testing: '1.2'/'123e5xyz' ---
float(9.75609756097561E-8)
---- testing: '1.2' / ' 123abc' ---
+--- testing: '1.2'/' 123abc' ---
float(0.00975609756097561)
---- testing: '1.2' / '123 abc' ---
+--- testing: '1.2'/'123 abc' ---
float(0.00975609756097561)
---- testing: '1.2' / '123abc ' ---
+--- testing: '1.2'/'123abc ' ---
float(0.00975609756097561)
---- testing: '1.2' / '3.4a' ---
+--- testing: '1.2'/'3.4a' ---
float(0.35294117647058826)
---- testing: '1.2' / 'a5.9' ---
-float(INF)
---- testing: '-7.7' / '0' ---
+--- testing: '1.2'/'a5.9' ---
+Unsupported operand types: string / string
+--- testing: '-7.7'/'0' ---
float(-INF)
---- testing: '-7.7' / '65' ---
+--- testing: '-7.7'/'65' ---
float(-0.11846153846153847)
---- testing: '-7.7' / '-44' ---
+--- testing: '-7.7'/'-44' ---
float(0.17500000000000002)
---- testing: '-7.7' / '1.2' ---
+--- testing: '-7.7'/'1.2' ---
float(-6.416666666666667)
---- testing: '-7.7' / '-7.7' ---
+--- testing: '-7.7'/'-7.7' ---
float(1)
---- testing: '-7.7' / 'abc' ---
-float(-INF)
---- testing: '-7.7' / '123abc' ---
+--- testing: '-7.7'/'abc' ---
+Unsupported operand types: string / string
+--- testing: '-7.7'/'123abc' ---
float(-0.06260162601626017)
---- testing: '-7.7' / '123e5' ---
+--- testing: '-7.7'/'123e5' ---
float(-6.260162601626017E-7)
---- testing: '-7.7' / '123e5xyz' ---
+--- testing: '-7.7'/'123e5xyz' ---
float(-6.260162601626017E-7)
---- testing: '-7.7' / ' 123abc' ---
+--- testing: '-7.7'/' 123abc' ---
float(-0.06260162601626017)
---- testing: '-7.7' / '123 abc' ---
+--- testing: '-7.7'/'123 abc' ---
float(-0.06260162601626017)
---- testing: '-7.7' / '123abc ' ---
+--- testing: '-7.7'/'123abc ' ---
float(-0.06260162601626017)
---- testing: '-7.7' / '3.4a' ---
+--- testing: '-7.7'/'3.4a' ---
float(-2.264705882352941)
---- testing: '-7.7' / 'a5.9' ---
-float(-INF)
---- testing: 'abc' / '0' ---
-float(NAN)
---- testing: 'abc' / '65' ---
-int(0)
---- testing: 'abc' / '-44' ---
-int(0)
---- testing: 'abc' / '1.2' ---
-float(0)
---- testing: 'abc' / '-7.7' ---
-float(-0)
---- testing: 'abc' / 'abc' ---
-float(NAN)
---- testing: 'abc' / '123abc' ---
-int(0)
---- testing: 'abc' / '123e5' ---
-float(0)
---- testing: 'abc' / '123e5xyz' ---
-float(0)
---- testing: 'abc' / ' 123abc' ---
-int(0)
---- testing: 'abc' / '123 abc' ---
-int(0)
---- testing: 'abc' / '123abc ' ---
-int(0)
---- testing: 'abc' / '3.4a' ---
-float(0)
---- testing: 'abc' / 'a5.9' ---
-float(NAN)
---- testing: '123abc' / '0' ---
+--- testing: '-7.7'/'a5.9' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/'0' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/'65' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/'-44' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/'1.2' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/'-7.7' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/'abc' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/'123abc' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/'123e5' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/'123e5xyz' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/' 123abc' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/'123 abc' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/'123abc ' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/'3.4a' ---
+Unsupported operand types: string / string
+--- testing: 'abc'/'a5.9' ---
+Unsupported operand types: string / string
+--- testing: '123abc'/'0' ---
float(INF)
---- testing: '123abc' / '65' ---
+--- testing: '123abc'/'65' ---
float(1.8923076923076922)
---- testing: '123abc' / '-44' ---
+--- testing: '123abc'/'-44' ---
float(-2.7954545454545454)
---- testing: '123abc' / '1.2' ---
+--- testing: '123abc'/'1.2' ---
float(102.5)
---- testing: '123abc' / '-7.7' ---
+--- testing: '123abc'/'-7.7' ---
float(-15.974025974025974)
---- testing: '123abc' / 'abc' ---
-float(INF)
---- testing: '123abc' / '123abc' ---
+--- testing: '123abc'/'abc' ---
+Unsupported operand types: string / string
+--- testing: '123abc'/'123abc' ---
int(1)
---- testing: '123abc' / '123e5' ---
+--- testing: '123abc'/'123e5' ---
float(1.0E-5)
---- testing: '123abc' / '123e5xyz' ---
+--- testing: '123abc'/'123e5xyz' ---
float(1.0E-5)
---- testing: '123abc' / ' 123abc' ---
+--- testing: '123abc'/' 123abc' ---
int(1)
---- testing: '123abc' / '123 abc' ---
+--- testing: '123abc'/'123 abc' ---
int(1)
---- testing: '123abc' / '123abc ' ---
+--- testing: '123abc'/'123abc ' ---
int(1)
---- testing: '123abc' / '3.4a' ---
+--- testing: '123abc'/'3.4a' ---
float(36.1764705882353)
---- testing: '123abc' / 'a5.9' ---
-float(INF)
---- testing: '123e5' / '0' ---
+--- testing: '123abc'/'a5.9' ---
+Unsupported operand types: string / string
+--- testing: '123e5'/'0' ---
float(INF)
---- testing: '123e5' / '65' ---
+--- testing: '123e5'/'65' ---
float(189230.76923076922)
---- testing: '123e5' / '-44' ---
+--- testing: '123e5'/'-44' ---
float(-279545.45454545453)
---- testing: '123e5' / '1.2' ---
+--- testing: '123e5'/'1.2' ---
float(10250000)
---- testing: '123e5' / '-7.7' ---
+--- testing: '123e5'/'-7.7' ---
float(-1597402.5974025973)
---- testing: '123e5' / 'abc' ---
-float(INF)
---- testing: '123e5' / '123abc' ---
+--- testing: '123e5'/'abc' ---
+Unsupported operand types: string / string
+--- testing: '123e5'/'123abc' ---
float(100000)
---- testing: '123e5' / '123e5' ---
+--- testing: '123e5'/'123e5' ---
float(1)
---- testing: '123e5' / '123e5xyz' ---
+--- testing: '123e5'/'123e5xyz' ---
float(1)
---- testing: '123e5' / ' 123abc' ---
+--- testing: '123e5'/' 123abc' ---
float(100000)
---- testing: '123e5' / '123 abc' ---
+--- testing: '123e5'/'123 abc' ---
float(100000)
---- testing: '123e5' / '123abc ' ---
+--- testing: '123e5'/'123abc ' ---
float(100000)
---- testing: '123e5' / '3.4a' ---
+--- testing: '123e5'/'3.4a' ---
float(3617647.0588235296)
---- testing: '123e5' / 'a5.9' ---
-float(INF)
---- testing: '123e5xyz' / '0' ---
+--- testing: '123e5'/'a5.9' ---
+Unsupported operand types: string / string
+--- testing: '123e5xyz'/'0' ---
float(INF)
---- testing: '123e5xyz' / '65' ---
+--- testing: '123e5xyz'/'65' ---
float(189230.76923076922)
---- testing: '123e5xyz' / '-44' ---
+--- testing: '123e5xyz'/'-44' ---
float(-279545.45454545453)
---- testing: '123e5xyz' / '1.2' ---
+--- testing: '123e5xyz'/'1.2' ---
float(10250000)
---- testing: '123e5xyz' / '-7.7' ---
+--- testing: '123e5xyz'/'-7.7' ---
float(-1597402.5974025973)
---- testing: '123e5xyz' / 'abc' ---
-float(INF)
---- testing: '123e5xyz' / '123abc' ---
+--- testing: '123e5xyz'/'abc' ---
+Unsupported operand types: string / string
+--- testing: '123e5xyz'/'123abc' ---
float(100000)
---- testing: '123e5xyz' / '123e5' ---
+--- testing: '123e5xyz'/'123e5' ---
float(1)
---- testing: '123e5xyz' / '123e5xyz' ---
+--- testing: '123e5xyz'/'123e5xyz' ---
float(1)
---- testing: '123e5xyz' / ' 123abc' ---
+--- testing: '123e5xyz'/' 123abc' ---
float(100000)
---- testing: '123e5xyz' / '123 abc' ---
+--- testing: '123e5xyz'/'123 abc' ---
float(100000)
---- testing: '123e5xyz' / '123abc ' ---
+--- testing: '123e5xyz'/'123abc ' ---
float(100000)
---- testing: '123e5xyz' / '3.4a' ---
+--- testing: '123e5xyz'/'3.4a' ---
float(3617647.0588235296)
---- testing: '123e5xyz' / 'a5.9' ---
-float(INF)
---- testing: ' 123abc' / '0' ---
+--- testing: '123e5xyz'/'a5.9' ---
+Unsupported operand types: string / string
+--- testing: ' 123abc'/'0' ---
float(INF)
---- testing: ' 123abc' / '65' ---
+--- testing: ' 123abc'/'65' ---
float(1.8923076923076922)
---- testing: ' 123abc' / '-44' ---
+--- testing: ' 123abc'/'-44' ---
float(-2.7954545454545454)
---- testing: ' 123abc' / '1.2' ---
+--- testing: ' 123abc'/'1.2' ---
float(102.5)
---- testing: ' 123abc' / '-7.7' ---
+--- testing: ' 123abc'/'-7.7' ---
float(-15.974025974025974)
---- testing: ' 123abc' / 'abc' ---
-float(INF)
---- testing: ' 123abc' / '123abc' ---
+--- testing: ' 123abc'/'abc' ---
+Unsupported operand types: string / string
+--- testing: ' 123abc'/'123abc' ---
int(1)
---- testing: ' 123abc' / '123e5' ---
+--- testing: ' 123abc'/'123e5' ---
float(1.0E-5)
---- testing: ' 123abc' / '123e5xyz' ---
+--- testing: ' 123abc'/'123e5xyz' ---
float(1.0E-5)
---- testing: ' 123abc' / ' 123abc' ---
+--- testing: ' 123abc'/' 123abc' ---
int(1)
---- testing: ' 123abc' / '123 abc' ---
+--- testing: ' 123abc'/'123 abc' ---
int(1)
---- testing: ' 123abc' / '123abc ' ---
+--- testing: ' 123abc'/'123abc ' ---
int(1)
---- testing: ' 123abc' / '3.4a' ---
+--- testing: ' 123abc'/'3.4a' ---
float(36.1764705882353)
---- testing: ' 123abc' / 'a5.9' ---
-float(INF)
---- testing: '123 abc' / '0' ---
+--- testing: ' 123abc'/'a5.9' ---
+Unsupported operand types: string / string
+--- testing: '123 abc'/'0' ---
float(INF)
---- testing: '123 abc' / '65' ---
+--- testing: '123 abc'/'65' ---
float(1.8923076923076922)
---- testing: '123 abc' / '-44' ---
+--- testing: '123 abc'/'-44' ---
float(-2.7954545454545454)
---- testing: '123 abc' / '1.2' ---
+--- testing: '123 abc'/'1.2' ---
float(102.5)
---- testing: '123 abc' / '-7.7' ---
+--- testing: '123 abc'/'-7.7' ---
float(-15.974025974025974)
---- testing: '123 abc' / 'abc' ---
-float(INF)
---- testing: '123 abc' / '123abc' ---
+--- testing: '123 abc'/'abc' ---
+Unsupported operand types: string / string
+--- testing: '123 abc'/'123abc' ---
int(1)
---- testing: '123 abc' / '123e5' ---
+--- testing: '123 abc'/'123e5' ---
float(1.0E-5)
---- testing: '123 abc' / '123e5xyz' ---
+--- testing: '123 abc'/'123e5xyz' ---
float(1.0E-5)
---- testing: '123 abc' / ' 123abc' ---
+--- testing: '123 abc'/' 123abc' ---
int(1)
---- testing: '123 abc' / '123 abc' ---
+--- testing: '123 abc'/'123 abc' ---
int(1)
---- testing: '123 abc' / '123abc ' ---
+--- testing: '123 abc'/'123abc ' ---
int(1)
---- testing: '123 abc' / '3.4a' ---
+--- testing: '123 abc'/'3.4a' ---
float(36.1764705882353)
---- testing: '123 abc' / 'a5.9' ---
+--- testing: '123 abc'/'a5.9' ---
+Unsupported operand types: string / string
+--- testing: '123abc '/'0' ---
float(INF)
---- testing: '123abc ' / '0' ---
-float(INF)
---- testing: '123abc ' / '65' ---
+--- testing: '123abc '/'65' ---
float(1.8923076923076922)
---- testing: '123abc ' / '-44' ---
+--- testing: '123abc '/'-44' ---
float(-2.7954545454545454)
---- testing: '123abc ' / '1.2' ---
+--- testing: '123abc '/'1.2' ---
float(102.5)
---- testing: '123abc ' / '-7.7' ---
+--- testing: '123abc '/'-7.7' ---
float(-15.974025974025974)
---- testing: '123abc ' / 'abc' ---
-float(INF)
---- testing: '123abc ' / '123abc' ---
+--- testing: '123abc '/'abc' ---
+Unsupported operand types: string / string
+--- testing: '123abc '/'123abc' ---
int(1)
---- testing: '123abc ' / '123e5' ---
+--- testing: '123abc '/'123e5' ---
float(1.0E-5)
---- testing: '123abc ' / '123e5xyz' ---
+--- testing: '123abc '/'123e5xyz' ---
float(1.0E-5)
---- testing: '123abc ' / ' 123abc' ---
+--- testing: '123abc '/' 123abc' ---
int(1)
---- testing: '123abc ' / '123 abc' ---
+--- testing: '123abc '/'123 abc' ---
int(1)
---- testing: '123abc ' / '123abc ' ---
+--- testing: '123abc '/'123abc ' ---
int(1)
---- testing: '123abc ' / '3.4a' ---
+--- testing: '123abc '/'3.4a' ---
float(36.1764705882353)
---- testing: '123abc ' / 'a5.9' ---
-float(INF)
---- testing: '3.4a' / '0' ---
+--- testing: '123abc '/'a5.9' ---
+Unsupported operand types: string / string
+--- testing: '3.4a'/'0' ---
float(INF)
---- testing: '3.4a' / '65' ---
+--- testing: '3.4a'/'65' ---
float(0.052307692307692305)
---- testing: '3.4a' / '-44' ---
+--- testing: '3.4a'/'-44' ---
float(-0.07727272727272727)
---- testing: '3.4a' / '1.2' ---
+--- testing: '3.4a'/'1.2' ---
float(2.8333333333333335)
---- testing: '3.4a' / '-7.7' ---
+--- testing: '3.4a'/'-7.7' ---
float(-0.44155844155844154)
---- testing: '3.4a' / 'abc' ---
-float(INF)
---- testing: '3.4a' / '123abc' ---
+--- testing: '3.4a'/'abc' ---
+Unsupported operand types: string / string
+--- testing: '3.4a'/'123abc' ---
float(0.027642276422764227)
---- testing: '3.4a' / '123e5' ---
+--- testing: '3.4a'/'123e5' ---
float(2.764227642276423E-7)
---- testing: '3.4a' / '123e5xyz' ---
+--- testing: '3.4a'/'123e5xyz' ---
float(2.764227642276423E-7)
---- testing: '3.4a' / ' 123abc' ---
+--- testing: '3.4a'/' 123abc' ---
float(0.027642276422764227)
---- testing: '3.4a' / '123 abc' ---
+--- testing: '3.4a'/'123 abc' ---
float(0.027642276422764227)
---- testing: '3.4a' / '123abc ' ---
+--- testing: '3.4a'/'123abc ' ---
float(0.027642276422764227)
---- testing: '3.4a' / '3.4a' ---
+--- testing: '3.4a'/'3.4a' ---
float(1)
---- testing: '3.4a' / 'a5.9' ---
-float(INF)
---- testing: 'a5.9' / '0' ---
-float(NAN)
---- testing: 'a5.9' / '65' ---
-int(0)
---- testing: 'a5.9' / '-44' ---
-int(0)
---- testing: 'a5.9' / '1.2' ---
-float(0)
---- testing: 'a5.9' / '-7.7' ---
-float(-0)
---- testing: 'a5.9' / 'abc' ---
-float(NAN)
---- testing: 'a5.9' / '123abc' ---
-int(0)
---- testing: 'a5.9' / '123e5' ---
-float(0)
---- testing: 'a5.9' / '123e5xyz' ---
-float(0)
---- testing: 'a5.9' / ' 123abc' ---
-int(0)
---- testing: 'a5.9' / '123 abc' ---
-int(0)
---- testing: 'a5.9' / '123abc ' ---
-int(0)
---- testing: 'a5.9' / '3.4a' ---
-float(0)
---- testing: 'a5.9' / 'a5.9' ---
-float(NAN)
+--- testing: '3.4a'/'a5.9' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/'0' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/'65' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/'-44' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/'1.2' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/'-7.7' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/'abc' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/'123abc' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/'123e5' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/'123e5xyz' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/' 123abc' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/'123 abc' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/'123abc ' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/'3.4a' ---
+Unsupported operand types: string / string
+--- testing: 'a5.9'/'a5.9' ---
+Unsupported operand types: string / string
diff --git a/tests/lang/operators/modulus_variationStr.phpt b/tests/lang/operators/modulus_variationStr.phpt
index 8d31c3ec91..1f9aae88a4 100644
--- a/tests/lang/operators/modulus_variationStr.phpt
+++ b/tests/lang/operators/modulus_variationStr.phpt
@@ -15,8 +15,8 @@ foreach ($strVals as $strVal) {
echo "--- testing: '$strVal' % '$otherVal' ---\n";
try {
var_dump($strVal%$otherVal);
- } catch (DivisionByZeroError $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ } catch (\Throwable $e) {
+ echo get_class($e) . ': ' . $e->getMessage() . "\n";
}
}
}
@@ -25,7 +25,7 @@ foreach ($strVals as $strVal) {
?>
--EXPECT--
--- testing: '0' % '0' ---
-Exception: Modulo by zero
+DivisionByZeroError: Modulo by zero
--- testing: '0' % '65' ---
int(0)
--- testing: '0' % '-44' ---
@@ -35,7 +35,7 @@ int(0)
--- testing: '0' % '-7.7' ---
int(0)
--- testing: '0' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '0' % '123abc' ---
int(0)
--- testing: '0' % '123e5' ---
@@ -51,9 +51,9 @@ int(0)
--- testing: '0' % '3.4a' ---
int(0)
--- testing: '0' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '65' % '0' ---
-Exception: Modulo by zero
+DivisionByZeroError: Modulo by zero
--- testing: '65' % '65' ---
int(0)
--- testing: '65' % '-44' ---
@@ -63,7 +63,7 @@ int(0)
--- testing: '65' % '-7.7' ---
int(2)
--- testing: '65' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '65' % '123abc' ---
int(65)
--- testing: '65' % '123e5' ---
@@ -79,9 +79,9 @@ int(65)
--- testing: '65' % '3.4a' ---
int(2)
--- testing: '65' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '-44' % '0' ---
-Exception: Modulo by zero
+DivisionByZeroError: Modulo by zero
--- testing: '-44' % '65' ---
int(-44)
--- testing: '-44' % '-44' ---
@@ -91,7 +91,7 @@ int(0)
--- testing: '-44' % '-7.7' ---
int(-2)
--- testing: '-44' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '-44' % '123abc' ---
int(-44)
--- testing: '-44' % '123e5' ---
@@ -107,9 +107,9 @@ int(-44)
--- testing: '-44' % '3.4a' ---
int(-2)
--- testing: '-44' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '1.2' % '0' ---
-Exception: Modulo by zero
+DivisionByZeroError: Modulo by zero
--- testing: '1.2' % '65' ---
int(1)
--- testing: '1.2' % '-44' ---
@@ -119,7 +119,7 @@ int(0)
--- testing: '1.2' % '-7.7' ---
int(1)
--- testing: '1.2' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '1.2' % '123abc' ---
int(1)
--- testing: '1.2' % '123e5' ---
@@ -135,9 +135,9 @@ int(1)
--- testing: '1.2' % '3.4a' ---
int(1)
--- testing: '1.2' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '-7.7' % '0' ---
-Exception: Modulo by zero
+DivisionByZeroError: Modulo by zero
--- testing: '-7.7' % '65' ---
int(-7)
--- testing: '-7.7' % '-44' ---
@@ -147,7 +147,7 @@ int(0)
--- testing: '-7.7' % '-7.7' ---
int(0)
--- testing: '-7.7' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '-7.7' % '123abc' ---
int(-7)
--- testing: '-7.7' % '123e5' ---
@@ -163,37 +163,37 @@ int(-7)
--- testing: '-7.7' % '3.4a' ---
int(-1)
--- testing: '-7.7' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % '0' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % '65' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % '-44' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % '1.2' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % '-7.7' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % '123abc' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % '123e5' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % '123e5xyz' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % ' 123abc' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % '123 abc' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % '123abc ' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % '3.4a' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'abc' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '123abc' % '0' ---
-Exception: Modulo by zero
+DivisionByZeroError: Modulo by zero
--- testing: '123abc' % '65' ---
int(58)
--- testing: '123abc' % '-44' ---
@@ -203,7 +203,7 @@ int(0)
--- testing: '123abc' % '-7.7' ---
int(4)
--- testing: '123abc' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '123abc' % '123abc' ---
int(0)
--- testing: '123abc' % '123e5' ---
@@ -219,9 +219,9 @@ int(0)
--- testing: '123abc' % '3.4a' ---
int(0)
--- testing: '123abc' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '123e5' % '0' ---
-Exception: Modulo by zero
+DivisionByZeroError: Modulo by zero
--- testing: '123e5' % '65' ---
int(50)
--- testing: '123e5' % '-44' ---
@@ -231,7 +231,7 @@ int(0)
--- testing: '123e5' % '-7.7' ---
int(6)
--- testing: '123e5' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '123e5' % '123abc' ---
int(0)
--- testing: '123e5' % '123e5' ---
@@ -247,9 +247,9 @@ int(0)
--- testing: '123e5' % '3.4a' ---
int(0)
--- testing: '123e5' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '123e5xyz' % '0' ---
-Exception: Modulo by zero
+DivisionByZeroError: Modulo by zero
--- testing: '123e5xyz' % '65' ---
int(50)
--- testing: '123e5xyz' % '-44' ---
@@ -259,7 +259,7 @@ int(0)
--- testing: '123e5xyz' % '-7.7' ---
int(6)
--- testing: '123e5xyz' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '123e5xyz' % '123abc' ---
int(0)
--- testing: '123e5xyz' % '123e5' ---
@@ -275,9 +275,9 @@ int(0)
--- testing: '123e5xyz' % '3.4a' ---
int(0)
--- testing: '123e5xyz' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: ' 123abc' % '0' ---
-Exception: Modulo by zero
+DivisionByZeroError: Modulo by zero
--- testing: ' 123abc' % '65' ---
int(58)
--- testing: ' 123abc' % '-44' ---
@@ -287,7 +287,7 @@ int(0)
--- testing: ' 123abc' % '-7.7' ---
int(4)
--- testing: ' 123abc' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: ' 123abc' % '123abc' ---
int(0)
--- testing: ' 123abc' % '123e5' ---
@@ -303,9 +303,9 @@ int(0)
--- testing: ' 123abc' % '3.4a' ---
int(0)
--- testing: ' 123abc' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '123 abc' % '0' ---
-Exception: Modulo by zero
+DivisionByZeroError: Modulo by zero
--- testing: '123 abc' % '65' ---
int(58)
--- testing: '123 abc' % '-44' ---
@@ -315,7 +315,7 @@ int(0)
--- testing: '123 abc' % '-7.7' ---
int(4)
--- testing: '123 abc' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '123 abc' % '123abc' ---
int(0)
--- testing: '123 abc' % '123e5' ---
@@ -331,9 +331,9 @@ int(0)
--- testing: '123 abc' % '3.4a' ---
int(0)
--- testing: '123 abc' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '123abc ' % '0' ---
-Exception: Modulo by zero
+DivisionByZeroError: Modulo by zero
--- testing: '123abc ' % '65' ---
int(58)
--- testing: '123abc ' % '-44' ---
@@ -343,7 +343,7 @@ int(0)
--- testing: '123abc ' % '-7.7' ---
int(4)
--- testing: '123abc ' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '123abc ' % '123abc' ---
int(0)
--- testing: '123abc ' % '123e5' ---
@@ -359,9 +359,9 @@ int(0)
--- testing: '123abc ' % '3.4a' ---
int(0)
--- testing: '123abc ' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '3.4a' % '0' ---
-Exception: Modulo by zero
+DivisionByZeroError: Modulo by zero
--- testing: '3.4a' % '65' ---
int(3)
--- testing: '3.4a' % '-44' ---
@@ -371,7 +371,7 @@ int(0)
--- testing: '3.4a' % '-7.7' ---
int(3)
--- testing: '3.4a' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: '3.4a' % '123abc' ---
int(3)
--- testing: '3.4a' % '123e5' ---
@@ -387,32 +387,32 @@ int(3)
--- testing: '3.4a' % '3.4a' ---
int(0)
--- testing: '3.4a' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % '0' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % '65' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % '-44' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % '1.2' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % '-7.7' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % 'abc' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % '123abc' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % '123e5' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % '123e5xyz' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % ' 123abc' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % '123 abc' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % '123abc ' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % '3.4a' ---
-int(0)
+TypeError: Unsupported operand types: string % string
--- testing: 'a5.9' % 'a5.9' ---
-Exception: Modulo by zero
+TypeError: Unsupported operand types: string % string
diff --git a/tests/lang/operators/multiply_variationStr.phpt b/tests/lang/operators/multiply_variationStr.phpt
index a9f73c6bda..af650ae993 100644
--- a/tests/lang/operators/multiply_variationStr.phpt
+++ b/tests/lang/operators/multiply_variationStr.phpt
@@ -11,13 +11,16 @@ $strVals = array(
error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
- foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' * '$otherVal' ---\n";
- var_dump($strVal*$otherVal);
- }
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' * '$otherVal' ---\n";
+ try {
+ var_dump($strVal*$otherVal);
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ }
}
-
?>
--EXPECT--
--- testing: '0' * '0' ---
@@ -31,7 +34,7 @@ float(0)
--- testing: '0' * '-7.7' ---
float(-0)
--- testing: '0' * 'abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '0' * '123abc' ---
int(0)
--- testing: '0' * '123e5' ---
@@ -47,7 +50,7 @@ int(0)
--- testing: '0' * '3.4a' ---
float(0)
--- testing: '0' * 'a5.9' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '65' * '0' ---
int(0)
--- testing: '65' * '65' ---
@@ -59,7 +62,7 @@ float(78)
--- testing: '65' * '-7.7' ---
float(-500.5)
--- testing: '65' * 'abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '65' * '123abc' ---
int(7995)
--- testing: '65' * '123e5' ---
@@ -75,7 +78,7 @@ int(7995)
--- testing: '65' * '3.4a' ---
float(221)
--- testing: '65' * 'a5.9' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '-44' * '0' ---
int(0)
--- testing: '-44' * '65' ---
@@ -87,7 +90,7 @@ float(-52.8)
--- testing: '-44' * '-7.7' ---
float(338.8)
--- testing: '-44' * 'abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '-44' * '123abc' ---
int(-5412)
--- testing: '-44' * '123e5' ---
@@ -103,7 +106,7 @@ int(-5412)
--- testing: '-44' * '3.4a' ---
float(-149.6)
--- testing: '-44' * 'a5.9' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '1.2' * '0' ---
float(0)
--- testing: '1.2' * '65' ---
@@ -115,7 +118,7 @@ float(1.44)
--- testing: '1.2' * '-7.7' ---
float(-9.24)
--- testing: '1.2' * 'abc' ---
-float(0)
+Unsupported operand types: string * string
--- testing: '1.2' * '123abc' ---
float(147.6)
--- testing: '1.2' * '123e5' ---
@@ -131,7 +134,7 @@ float(147.6)
--- testing: '1.2' * '3.4a' ---
float(4.08)
--- testing: '1.2' * 'a5.9' ---
-float(0)
+Unsupported operand types: string * string
--- testing: '-7.7' * '0' ---
float(-0)
--- testing: '-7.7' * '65' ---
@@ -143,7 +146,7 @@ float(-9.24)
--- testing: '-7.7' * '-7.7' ---
float(59.290000000000006)
--- testing: '-7.7' * 'abc' ---
-float(-0)
+Unsupported operand types: string * string
--- testing: '-7.7' * '123abc' ---
float(-947.1)
--- testing: '-7.7' * '123e5' ---
@@ -159,35 +162,35 @@ float(-947.1)
--- testing: '-7.7' * '3.4a' ---
float(-26.18)
--- testing: '-7.7' * 'a5.9' ---
-float(-0)
+Unsupported operand types: string * string
--- testing: 'abc' * '0' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'abc' * '65' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'abc' * '-44' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'abc' * '1.2' ---
-float(0)
+Unsupported operand types: string * string
--- testing: 'abc' * '-7.7' ---
-float(-0)
+Unsupported operand types: string * string
--- testing: 'abc' * 'abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'abc' * '123abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'abc' * '123e5' ---
-float(0)
+Unsupported operand types: string * string
--- testing: 'abc' * '123e5xyz' ---
-float(0)
+Unsupported operand types: string * string
--- testing: 'abc' * ' 123abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'abc' * '123 abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'abc' * '123abc ' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'abc' * '3.4a' ---
-float(0)
+Unsupported operand types: string * string
--- testing: 'abc' * 'a5.9' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '123abc' * '0' ---
int(0)
--- testing: '123abc' * '65' ---
@@ -199,7 +202,7 @@ float(147.6)
--- testing: '123abc' * '-7.7' ---
float(-947.1)
--- testing: '123abc' * 'abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '123abc' * '123abc' ---
int(15129)
--- testing: '123abc' * '123e5' ---
@@ -215,7 +218,7 @@ int(15129)
--- testing: '123abc' * '3.4a' ---
float(418.2)
--- testing: '123abc' * 'a5.9' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '123e5' * '0' ---
float(0)
--- testing: '123e5' * '65' ---
@@ -227,7 +230,7 @@ float(14760000)
--- testing: '123e5' * '-7.7' ---
float(-94710000)
--- testing: '123e5' * 'abc' ---
-float(0)
+Unsupported operand types: string * string
--- testing: '123e5' * '123abc' ---
float(1512900000)
--- testing: '123e5' * '123e5' ---
@@ -243,7 +246,7 @@ float(1512900000)
--- testing: '123e5' * '3.4a' ---
float(41820000)
--- testing: '123e5' * 'a5.9' ---
-float(0)
+Unsupported operand types: string * string
--- testing: '123e5xyz' * '0' ---
float(0)
--- testing: '123e5xyz' * '65' ---
@@ -255,7 +258,7 @@ float(14760000)
--- testing: '123e5xyz' * '-7.7' ---
float(-94710000)
--- testing: '123e5xyz' * 'abc' ---
-float(0)
+Unsupported operand types: string * string
--- testing: '123e5xyz' * '123abc' ---
float(1512900000)
--- testing: '123e5xyz' * '123e5' ---
@@ -271,7 +274,7 @@ float(1512900000)
--- testing: '123e5xyz' * '3.4a' ---
float(41820000)
--- testing: '123e5xyz' * 'a5.9' ---
-float(0)
+Unsupported operand types: string * string
--- testing: ' 123abc' * '0' ---
int(0)
--- testing: ' 123abc' * '65' ---
@@ -283,7 +286,7 @@ float(147.6)
--- testing: ' 123abc' * '-7.7' ---
float(-947.1)
--- testing: ' 123abc' * 'abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: ' 123abc' * '123abc' ---
int(15129)
--- testing: ' 123abc' * '123e5' ---
@@ -299,7 +302,7 @@ int(15129)
--- testing: ' 123abc' * '3.4a' ---
float(418.2)
--- testing: ' 123abc' * 'a5.9' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '123 abc' * '0' ---
int(0)
--- testing: '123 abc' * '65' ---
@@ -311,7 +314,7 @@ float(147.6)
--- testing: '123 abc' * '-7.7' ---
float(-947.1)
--- testing: '123 abc' * 'abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '123 abc' * '123abc' ---
int(15129)
--- testing: '123 abc' * '123e5' ---
@@ -327,7 +330,7 @@ int(15129)
--- testing: '123 abc' * '3.4a' ---
float(418.2)
--- testing: '123 abc' * 'a5.9' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '123abc ' * '0' ---
int(0)
--- testing: '123abc ' * '65' ---
@@ -339,7 +342,7 @@ float(147.6)
--- testing: '123abc ' * '-7.7' ---
float(-947.1)
--- testing: '123abc ' * 'abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '123abc ' * '123abc' ---
int(15129)
--- testing: '123abc ' * '123e5' ---
@@ -355,7 +358,7 @@ int(15129)
--- testing: '123abc ' * '3.4a' ---
float(418.2)
--- testing: '123abc ' * 'a5.9' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '3.4a' * '0' ---
float(0)
--- testing: '3.4a' * '65' ---
@@ -367,7 +370,7 @@ float(4.08)
--- testing: '3.4a' * '-7.7' ---
float(-26.18)
--- testing: '3.4a' * 'abc' ---
-float(0)
+Unsupported operand types: string * string
--- testing: '3.4a' * '123abc' ---
float(418.2)
--- testing: '3.4a' * '123e5' ---
@@ -383,32 +386,32 @@ float(418.2)
--- testing: '3.4a' * '3.4a' ---
float(11.559999999999999)
--- testing: '3.4a' * 'a5.9' ---
-float(0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * '0' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * '65' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * '-44' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * '1.2' ---
-float(0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * '-7.7' ---
-float(-0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * 'abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * '123abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * '123e5' ---
-float(0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * '123e5xyz' ---
-float(0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * ' 123abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * '123 abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * '123abc ' ---
-int(0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * '3.4a' ---
-float(0)
+Unsupported operand types: string * string
--- testing: 'a5.9' * 'a5.9' ---
-int(0)
+Unsupported operand types: string * string
diff --git a/tests/lang/operators/negate_variationStr.phpt b/tests/lang/operators/negate_variationStr.phpt
index 3b70349026..43b2f6a52a 100644
--- a/tests/lang/operators/negate_variationStr.phpt
+++ b/tests/lang/operators/negate_variationStr.phpt
@@ -8,10 +8,13 @@ $strVals = array(
"a5.9"
);
-
foreach ($strVals as $strVal) {
- echo "--- testing: '$strVal' ---\n";
- var_dump(-$strVal);
+ echo "--- testing: '$strVal' ---\n";
+ try {
+ var_dump(-$strVal);
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
?>
@@ -27,36 +30,32 @@ float(-1.2)
--- testing: '-7.7' ---
float(7.7)
--- testing: 'abc' ---
-
-Warning: A non-numeric value encountered in %s on line %d
-int(0)
+Unsupported operand types: string * int
--- testing: '123abc' ---
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(-123)
--- testing: '123e5' ---
float(-12300000)
--- testing: '123e5xyz' ---
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
float(-12300000)
--- testing: ' 123abc' ---
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(-123)
--- testing: '123 abc' ---
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(-123)
--- testing: '123abc ' ---
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(-123)
--- testing: '3.4a' ---
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
float(-3.4)
--- testing: 'a5.9' ---
-
-Warning: A non-numeric value encountered in %s on line %d
-int(0)
+Unsupported operand types: string * int
diff --git a/tests/lang/operators/subtract_variationStr.phpt b/tests/lang/operators/subtract_variationStr.phpt
index 2c4667c114..6df852498d 100644
--- a/tests/lang/operators/subtract_variationStr.phpt
+++ b/tests/lang/operators/subtract_variationStr.phpt
@@ -11,13 +11,16 @@ $strVals = array(
error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
- foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' - '$otherVal' ---\n";
- var_dump($strVal-$otherVal);
- }
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' - '$otherVal' ---\n";
+ try {
+ var_dump($strVal-$otherVal);
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ }
}
-
?>
--EXPECT--
--- testing: '0' - '0' ---
@@ -31,7 +34,7 @@ float(-1.2)
--- testing: '0' - '-7.7' ---
float(7.7)
--- testing: '0' - 'abc' ---
-int(0)
+Unsupported operand types: string - string
--- testing: '0' - '123abc' ---
int(-123)
--- testing: '0' - '123e5' ---
@@ -47,7 +50,7 @@ int(-123)
--- testing: '0' - '3.4a' ---
float(-3.4)
--- testing: '0' - 'a5.9' ---
-int(0)
+Unsupported operand types: string - string
--- testing: '65' - '0' ---
int(65)
--- testing: '65' - '65' ---
@@ -59,7 +62,7 @@ float(63.8)
--- testing: '65' - '-7.7' ---
float(72.7)
--- testing: '65' - 'abc' ---
-int(65)
+Unsupported operand types: string - string
--- testing: '65' - '123abc' ---
int(-58)
--- testing: '65' - '123e5' ---
@@ -75,7 +78,7 @@ int(-58)
--- testing: '65' - '3.4a' ---
float(61.6)
--- testing: '65' - 'a5.9' ---
-int(65)
+Unsupported operand types: string - string
--- testing: '-44' - '0' ---
int(-44)
--- testing: '-44' - '65' ---
@@ -87,7 +90,7 @@ float(-45.2)
--- testing: '-44' - '-7.7' ---
float(-36.3)
--- testing: '-44' - 'abc' ---
-int(-44)
+Unsupported operand types: string - string
--- testing: '-44' - '123abc' ---
int(-167)
--- testing: '-44' - '123e5' ---
@@ -103,7 +106,7 @@ int(-167)
--- testing: '-44' - '3.4a' ---
float(-47.4)
--- testing: '-44' - 'a5.9' ---
-int(-44)
+Unsupported operand types: string - string
--- testing: '1.2' - '0' ---
float(1.2)
--- testing: '1.2' - '65' ---
@@ -115,7 +118,7 @@ float(0)
--- testing: '1.2' - '-7.7' ---
float(8.9)
--- testing: '1.2' - 'abc' ---
-float(1.2)
+Unsupported operand types: string - string
--- testing: '1.2' - '123abc' ---
float(-121.8)
--- testing: '1.2' - '123e5' ---
@@ -131,7 +134,7 @@ float(-121.8)
--- testing: '1.2' - '3.4a' ---
float(-2.2)
--- testing: '1.2' - 'a5.9' ---
-float(1.2)
+Unsupported operand types: string - string
--- testing: '-7.7' - '0' ---
float(-7.7)
--- testing: '-7.7' - '65' ---
@@ -143,7 +146,7 @@ float(-8.9)
--- testing: '-7.7' - '-7.7' ---
float(0)
--- testing: '-7.7' - 'abc' ---
-float(-7.7)
+Unsupported operand types: string - string
--- testing: '-7.7' - '123abc' ---
float(-130.7)
--- testing: '-7.7' - '123e5' ---
@@ -159,35 +162,35 @@ float(-130.7)
--- testing: '-7.7' - '3.4a' ---
float(-11.1)
--- testing: '-7.7' - 'a5.9' ---
-float(-7.7)
+Unsupported operand types: string - string
--- testing: 'abc' - '0' ---
-int(0)
+Unsupported operand types: string - string
--- testing: 'abc' - '65' ---
-int(-65)
+Unsupported operand types: string - string
--- testing: 'abc' - '-44' ---
-int(44)
+Unsupported operand types: string - string
--- testing: 'abc' - '1.2' ---
-float(-1.2)
+Unsupported operand types: string - string
--- testing: 'abc' - '-7.7' ---
-float(7.7)
+Unsupported operand types: string - string
--- testing: 'abc' - 'abc' ---
-int(0)
+Unsupported operand types: string - string
--- testing: 'abc' - '123abc' ---
-int(-123)
+Unsupported operand types: string - string
--- testing: 'abc' - '123e5' ---
-float(-12300000)
+Unsupported operand types: string - string
--- testing: 'abc' - '123e5xyz' ---
-float(-12300000)
+Unsupported operand types: string - string
--- testing: 'abc' - ' 123abc' ---
-int(-123)
+Unsupported operand types: string - string
--- testing: 'abc' - '123 abc' ---
-int(-123)
+Unsupported operand types: string - string
--- testing: 'abc' - '123abc ' ---
-int(-123)
+Unsupported operand types: string - string
--- testing: 'abc' - '3.4a' ---
-float(-3.4)
+Unsupported operand types: string - string
--- testing: 'abc' - 'a5.9' ---
-int(0)
+Unsupported operand types: string - string
--- testing: '123abc' - '0' ---
int(123)
--- testing: '123abc' - '65' ---
@@ -199,7 +202,7 @@ float(121.8)
--- testing: '123abc' - '-7.7' ---
float(130.7)
--- testing: '123abc' - 'abc' ---
-int(123)
+Unsupported operand types: string - string
--- testing: '123abc' - '123abc' ---
int(0)
--- testing: '123abc' - '123e5' ---
@@ -215,7 +218,7 @@ int(0)
--- testing: '123abc' - '3.4a' ---
float(119.6)
--- testing: '123abc' - 'a5.9' ---
-int(123)
+Unsupported operand types: string - string
--- testing: '123e5' - '0' ---
float(12300000)
--- testing: '123e5' - '65' ---
@@ -227,7 +230,7 @@ float(12299998.8)
--- testing: '123e5' - '-7.7' ---
float(12300007.7)
--- testing: '123e5' - 'abc' ---
-float(12300000)
+Unsupported operand types: string - string
--- testing: '123e5' - '123abc' ---
float(12299877)
--- testing: '123e5' - '123e5' ---
@@ -243,7 +246,7 @@ float(12299877)
--- testing: '123e5' - '3.4a' ---
float(12299996.6)
--- testing: '123e5' - 'a5.9' ---
-float(12300000)
+Unsupported operand types: string - string
--- testing: '123e5xyz' - '0' ---
float(12300000)
--- testing: '123e5xyz' - '65' ---
@@ -255,7 +258,7 @@ float(12299998.8)
--- testing: '123e5xyz' - '-7.7' ---
float(12300007.7)
--- testing: '123e5xyz' - 'abc' ---
-float(12300000)
+Unsupported operand types: string - string
--- testing: '123e5xyz' - '123abc' ---
float(12299877)
--- testing: '123e5xyz' - '123e5' ---
@@ -271,7 +274,7 @@ float(12299877)
--- testing: '123e5xyz' - '3.4a' ---
float(12299996.6)
--- testing: '123e5xyz' - 'a5.9' ---
-float(12300000)
+Unsupported operand types: string - string
--- testing: ' 123abc' - '0' ---
int(123)
--- testing: ' 123abc' - '65' ---
@@ -283,7 +286,7 @@ float(121.8)
--- testing: ' 123abc' - '-7.7' ---
float(130.7)
--- testing: ' 123abc' - 'abc' ---
-int(123)
+Unsupported operand types: string - string
--- testing: ' 123abc' - '123abc' ---
int(0)
--- testing: ' 123abc' - '123e5' ---
@@ -299,7 +302,7 @@ int(0)
--- testing: ' 123abc' - '3.4a' ---
float(119.6)
--- testing: ' 123abc' - 'a5.9' ---
-int(123)
+Unsupported operand types: string - string
--- testing: '123 abc' - '0' ---
int(123)
--- testing: '123 abc' - '65' ---
@@ -311,7 +314,7 @@ float(121.8)
--- testing: '123 abc' - '-7.7' ---
float(130.7)
--- testing: '123 abc' - 'abc' ---
-int(123)
+Unsupported operand types: string - string
--- testing: '123 abc' - '123abc' ---
int(0)
--- testing: '123 abc' - '123e5' ---
@@ -327,7 +330,7 @@ int(0)
--- testing: '123 abc' - '3.4a' ---
float(119.6)
--- testing: '123 abc' - 'a5.9' ---
-int(123)
+Unsupported operand types: string - string
--- testing: '123abc ' - '0' ---
int(123)
--- testing: '123abc ' - '65' ---
@@ -339,7 +342,7 @@ float(121.8)
--- testing: '123abc ' - '-7.7' ---
float(130.7)
--- testing: '123abc ' - 'abc' ---
-int(123)
+Unsupported operand types: string - string
--- testing: '123abc ' - '123abc' ---
int(0)
--- testing: '123abc ' - '123e5' ---
@@ -355,7 +358,7 @@ int(0)
--- testing: '123abc ' - '3.4a' ---
float(119.6)
--- testing: '123abc ' - 'a5.9' ---
-int(123)
+Unsupported operand types: string - string
--- testing: '3.4a' - '0' ---
float(3.4)
--- testing: '3.4a' - '65' ---
@@ -367,7 +370,7 @@ float(2.2)
--- testing: '3.4a' - '-7.7' ---
float(11.1)
--- testing: '3.4a' - 'abc' ---
-float(3.4)
+Unsupported operand types: string - string
--- testing: '3.4a' - '123abc' ---
float(-119.6)
--- testing: '3.4a' - '123e5' ---
@@ -383,32 +386,32 @@ float(-119.6)
--- testing: '3.4a' - '3.4a' ---
float(0)
--- testing: '3.4a' - 'a5.9' ---
-float(3.4)
+Unsupported operand types: string - string
--- testing: 'a5.9' - '0' ---
-int(0)
+Unsupported operand types: string - string
--- testing: 'a5.9' - '65' ---
-int(-65)
+Unsupported operand types: string - string
--- testing: 'a5.9' - '-44' ---
-int(44)
+Unsupported operand types: string - string
--- testing: 'a5.9' - '1.2' ---
-float(-1.2)
+Unsupported operand types: string - string
--- testing: 'a5.9' - '-7.7' ---
-float(7.7)
+Unsupported operand types: string - string
--- testing: 'a5.9' - 'abc' ---
-int(0)
+Unsupported operand types: string - string
--- testing: 'a5.9' - '123abc' ---
-int(-123)
+Unsupported operand types: string - string
--- testing: 'a5.9' - '123e5' ---
-float(-12300000)
+Unsupported operand types: string - string
--- testing: 'a5.9' - '123e5xyz' ---
-float(-12300000)
+Unsupported operand types: string - string
--- testing: 'a5.9' - ' 123abc' ---
-int(-123)
+Unsupported operand types: string - string
--- testing: 'a5.9' - '123 abc' ---
-int(-123)
+Unsupported operand types: string - string
--- testing: 'a5.9' - '123abc ' ---
-int(-123)
+Unsupported operand types: string - string
--- testing: 'a5.9' - '3.4a' ---
-float(-3.4)
+Unsupported operand types: string - string
--- testing: 'a5.9' - 'a5.9' ---
-int(0)
+Unsupported operand types: string - string
diff --git a/tests/strings/offsets_chaining_5.phpt b/tests/strings/offsets_chaining_5.phpt
index 42cb1f2721..49f062463f 100644
--- a/tests/strings/offsets_chaining_5.phpt
+++ b/tests/strings/offsets_chaining_5.phpt
@@ -6,20 +6,20 @@ $array = array('expected_array' => "foobar");
var_dump(isset($array['expected_array']));
var_dump($array['expected_array']);
var_dump(isset($array['expected_array']['foo']));
-var_dump($array['expected_array']['foo']);
+var_dump($array['expected_array']['0foo']);
var_dump(isset($array['expected_array']['foo']['bar']));
-var_dump($array['expected_array']['foo']['bar']);
+var_dump($array['expected_array']['0foo']['0bar']);
?>
--EXPECTF--
bool(true)
string(6) "foobar"
bool(false)
-Warning: Illegal string offset "foo" in %s on line %d
+Warning: Illegal string offset "0foo" in %s on line %d
string(1) "f"
bool(false)
-Warning: Illegal string offset "foo" in %s on line %d
+Warning: Illegal string offset "0foo" in %s on line %d
-Warning: Illegal string offset "bar" in %s on line %d
+Warning: Illegal string offset "0bar" in %s on line %d
string(1) "f"
diff --git a/tests/strings/offsets_general.phpt b/tests/strings/offsets_general.phpt
index 64d51457d7..16960eac95 100644
--- a/tests/strings/offsets_general.phpt
+++ b/tests/strings/offsets_general.phpt
@@ -9,17 +9,19 @@ var_dump($string[0]);
var_dump($string[1]);
var_dump(isset($string[0]));
var_dump(isset($string[0][0]));
-var_dump($string["foo"]);
+try {
+ var_dump($string["foo"]);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump(isset($string["foo"]["bar"]));
?>
---EXPECTF--
+--EXPECT--
string(1) "B"
string(1) "f"
string(1) "o"
bool(true)
bool(true)
-
-Warning: Illegal string offset "foo" in %s on line %d
-string(1) "f"
+Cannot access offset of type string on string
bool(false)