]> granicus.if.org Git - php/commitdiff
Implement 'Saner Numeric Strings' RFC:
authorGeorge Peter Banyard <girgias@php.net>
Wed, 29 Jul 2020 01:51:09 +0000 (02:51 +0100)
committerGeorge Peter Banyard <girgias@php.net>
Wed, 29 Jul 2020 01:51:09 +0000 (02:51 +0100)
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

65 files changed:
UPGRADING
Zend/tests/add_006.phpt
Zend/tests/bug24773.phpt
Zend/tests/bug31098.phpt
Zend/tests/bug39018_2.phpt
Zend/tests/bug53432.phpt
Zend/tests/bug64578.phpt
Zend/tests/bug72057.phpt [deleted file]
Zend/tests/bug73792.phpt
Zend/tests/bug76534.phpt
Zend/tests/const_dereference_002.phpt
Zend/tests/constant_expressions_dynamic.phpt
Zend/tests/indexing_001.phpt
Zend/tests/int_conversion_exponents.phpt
Zend/tests/non_well_formed_param_exception.phpt [deleted file]
Zend/tests/numeric_strings/array_offset.phpt [new file with mode: 0644]
Zend/tests/numeric_strings/explicit_cast_leading_numeric_must_work.phpt [new file with mode: 0644]
Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt [moved from Zend/tests/numeric_string_errors_assign.phpt with 51% similarity]
Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt [moved from Zend/tests/numeric_string_errors.phpt with 51% similarity]
Zend/tests/numeric_strings/neg_num_string.phpt [moved from Zend/tests/neg_num_string.phpt with 100% similarity]
Zend/tests/numeric_strings/string_offset.phpt [new file with mode: 0644]
Zend/tests/offset_assign.phpt
Zend/tests/offset_string.phpt
Zend/tests/operator_unsupported_types.phpt
Zend/tests/self_and.phpt
Zend/tests/self_mod.phpt
Zend/tests/self_or.phpt
Zend/tests/self_xor.phpt
Zend/tests/shift_001.phpt
Zend/tests/shift_002.phpt
Zend/tests/type_declarations/scalar_basic.phpt
Zend/tests/type_declarations/scalar_return_basic.phpt
Zend/tests/type_declarations/scalar_return_basic_64bit.phpt
Zend/tests/type_declarations/union_types/type_checking_weak.phpt
Zend/zend_API.c
Zend/zend_execute.c
Zend/zend_ini_scanner.l
Zend/zend_operators.c
Zend/zend_operators.h
ext/opcache/jit/zend_jit_helpers.c
ext/opcache/tests/bug71843.phpt
ext/opcache/tests/jit/fetch_dim_r_003.phpt
ext/opcache/tests/jit/fetch_dim_r_004.phpt
ext/pdo/pdo_stmt.c
ext/reflection/tests/bug76536.phpt
ext/standard/tests/general_functions/floatval.phpt
ext/standard/tests/general_functions/floatval_variation1.phpt
ext/standard/tests/math/pow_variation1.phpt
ext/standard/tests/math/pow_variation1_64bit.phpt
ext/standard/tests/math/pow_variation2.phpt
ext/standard/tests/strings/bug55871.phpt
tests/lang/bug19943.phpt
tests/lang/bug28800.phpt
tests/lang/bug29566.phpt
tests/lang/operators/add_variationStr.phpt
tests/lang/operators/bitwiseShiftLeft_variationStr.phpt
tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt
tests/lang/operators/bitwiseShiftRight_variationStr.phpt
tests/lang/operators/divide_variationStr.phpt
tests/lang/operators/modulus_variationStr.phpt
tests/lang/operators/multiply_variationStr.phpt
tests/lang/operators/negate_variationStr.phpt
tests/lang/operators/subtract_variationStr.phpt
tests/strings/offsets_chaining_5.phpt
tests/strings/offsets_general.phpt

index 6eca850664d91cab7f403e634b35d24eb5e9a133..28aa58486283d1924f15b6759e30a7aefa82407c 100644 (file)
--- 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
index 2e7f76b4eef060a7dfe5ddb775a19f79fbad20be..09945f3fce6c11aa442b9667cb5739b7a1a80493 100644 (file)
@@ -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)
index 1a73b3df1b245dac927b68a6488c41f0360c51e1..4c73fd0dd00f2b9effa9ac7f461e757dfd13ba3f 100644 (file)
@@ -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
index f9ea43a93a910501c9c97f087aa952283a45ea00..1cad1108c08da491aa8a37bf66d2f98f1f3a440d 100644 (file)
@@ -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
index 81831d51e06f323ffd671aa15871160e3680c683..5d45f0700bfa98a6ac0f0c3d765bd8303d6bc5d4 100644 (file)
@@ -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) ""
index 68ce0e358327add226c50226f1bcd7a435d2f58e..fb6b80857aa0d031da46ed0e090a0bc1b0620577 100644 (file)
@@ -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) ""
index e16f8ea4baa841e4fb95e30848e61306374b3a2a..d0d69995ad0ef1e450b92d027a1917067d6cbc6e 100644 (file)
@@ -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 (file)
index a518d82..0000000
+++ /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
index dfcd9bb4998845b293c121b215bf16543b5cf772..39e45f1367fdaa89197633712dcee1779ed3cbea 100644 (file)
@@ -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:
index b0149e47a4223e7f35afbaeeeb4f7f5094bcf837..f544d964c414086f0a3381618ac65f6490b68f8a 100644 (file)
@@ -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}
index 5d3c6e584248bc293904db8c3538019725517d51..d7195dd2825d74f7c1abdc052cf23880982f6d6a 100644 (file)
@@ -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"
index 79f8c772e37a32ab17ed6616c88b0579780b6f28..fff9f74e524d1c0a4a62c42b34c43bdea7aa8bd9 100644 (file)
@@ -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;
index 156df07f0c8f90429f93c7edcb6c892c242738a1..c712b09802359685fc1465261e3d3e911f5db14b 100644 (file)
@@ -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) {
index d924cb7b81ee8741ba4ebaa2ae6a7031a15e2ca1..1e4ce72cee0ada19a753e5bfa827a6fa2e814254 100644 (file)
@@ -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 (file)
index d688375..0000000
+++ /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 (file)
index 0000000..6522fae
--- /dev/null
@@ -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 (file)
index 0000000..8c906e8
--- /dev/null
@@ -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)
similarity index 51%
rename from Zend/tests/numeric_string_errors_assign.phpt
rename to Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt
index 69be0c114dd846945551aefd9fe712808376bb44..51df22634869c062bcb69595739470e31e275cdb 100644 (file)
@@ -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
similarity index 51%
rename from Zend/tests/numeric_string_errors.phpt
rename to Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt
index 83c948981b8bd1893f82669a546fa45576bf950b..3ffe78a119e9697a1e9c1278175953f5678617e4 100644 (file)
 --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/numeric_strings/string_offset.phpt b/Zend/tests/numeric_strings/string_offset.phpt
new file mode 100644 (file)
index 0000000..0c43bc1
--- /dev/null
@@ -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
index d4c56b30c8b442c7891fae677701ca2d070fe9ca..d2e33cafbf0ee1867b891b13b8445dcb8e6ae784 100644 (file)
@@ -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:
index 4c7debcaa9bb50abb85eb1d6d06295511c01a747..36481dccce7c1422e4aab3bc6a87b8a02e7fc81d 100644 (file)
@@ -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
index 4b27f722d7a71925cf007be9558d956505289361..94e23ec60376a4e8180ef35d005c888dafb644f9 100644 (file)
@@ -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--
index 26b86e512586e419eaa79f95f74cc5bf80739a91..f3662c575c48a5084155307ee019b35c389413fd 100644 (file)
@@ -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) "  "
index 0b10987aeb86cadeb0bdb9a0d2363639fa87bc24..7d469f80023993a48ef6e75aaee3d778888fe725 100644 (file)
@@ -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
index cecf70d795db9ceaca92fe68e62a90992c1ed187..61f1f4203b080e1099f124cfca9aad498fbbf179 100644 (file)
@@ -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"
index e36a315b10d0a9deb121a751b13a2855dce5f7aa..4bff3f6d508e26da0233a646615098343c9c3f90 100644 (file)
@@ -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"
index fba24f5fd019e457a47d5ba7b3958f89e96a5981..f441cf2dcf8ba777099b6ca5d5e58584e047b310 100644 (file)
@@ -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
index fa068e1a90268d7cc121bc11c86f61f07b581508..0bdc9b3eeb3ce76e08e93a0bdf985f30e21407d8 100644 (file)
@@ -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
index 002cab6042aee6cdb8bb62c378bc3f6f29645471..908f1a18b248ebaffea1a7fcc5e9de67d5321ebb 100644 (file)
@@ -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
index 5ecd533840563d16fac564411c45c2ef9aa0a5da..deb4289f2544503ab96985d3133353dd4c2f18a2 100644 (file)
@@ -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) ""
index 0fbccb1b69098293bdd710f2a752a09dc93a78cd..e49b9f5b2ad3648ba7c5c3491fe9367e697e33e8 100644 (file)
@@ -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) ""
index 56758289534236deed3819aa8ac41661cd5122a0..351a3e9e78ede2add183694457da8d0a8f15f0e6 100644 (file)
@@ -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
index 7a8816b5cfef53d10ff2ca9d90275a7cdc338468..c6e4b03dfcf28fad343767f3fef3ffecf51b7a5a 100644 (file)
@@ -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) {
index efb2d008a87ffe5a58ae17eb03d3fad0a3bf9ffa..51d4a0d00388ed07adb8dcff90cfe141fd453b6d 100644 (file)
@@ -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) {
index e8641faa4958485c5622921eec2b4b58cdb27deb..c8efb1f144d958c950ab2eec18a8934af4be7ec3 100644 (file)
@@ -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;
index f0c17ea0d3d08dd94512c08f75c12cc03a91628e..fba6c6337a7eb136157162648102ffd77a725457 100644 (file)
@@ -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;
                        }
                }
        }
index 2664514709c7ac552ef7219dc335cc8602d09486..9eb064b125d7a5f7ea6c3f2c3917c5358ed6e7d3 100644 (file)
@@ -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);
index e42fd196aa93f1c96e16510772b4986f4db28f78..7ae956f1774b43e19f22cea28327e4210ab3d475 100644 (file)
@@ -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;
                        }
index 0a193425dd4f4233498fdaf539c4200acfb20b97..28b36f7371dc8e9a2cba5255a07a2c4ed93a9c97 100644 (file)
@@ -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
index c71b13ec12da332c6864d3ce1c723550c301d5ed..e0fb75ee484747276dbc2605321ec3d3f9634590 100644 (file)
@@ -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"
index b781dc2cc4b42da01553f0a0dbb151f54acbe6ed..23c6bf4d0ff94b354924d2b010af26da4c18c811 100644 (file)
@@ -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"
index 6bb7ca73227255f2bb7bcfffa7098eb4f83d80d5..ce008d09c7f87a7c197228c06f9258e5dac133f6 100644 (file)
@@ -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 {
index aa32781e16a1abf4e566a2ddecb42bf4c7e508d8..d6b22ada21868aaa822eb5da4e44f2975f64197b 100644 (file)
@@ -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();}
 
index 73075c8163fa4c7986a88920ee4cb39712216082..f9aa74e342d5645762a5191f7cfacfd72669fd91 100644 (file)
@@ -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)
index 2f184a53e7aee9e4f6f5eb127040b25f5e76a448..856e4e31ebb0d610d9c2cd69e97d0154b21e7457 100644 (file)
@@ -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)
index d141ddd787db8334c42f90c1050f0d8716cf7f20..a4283a4ac946400ecbc2d34eb32fb7f32ad096dd 100644 (file)
@@ -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
index 64ef1e20f27d6227c6c596036046d9e46f54f29d..5869e905f067c15c164debe618e9f3985d3ebd23 100644 (file)
@@ -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
index c5fc862de466bf21bc67684f38585d664d9ddaea..9351dbd4ce7385de55f168b66005f4314f7e98df 100644 (file)
@@ -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
index 60a857ec67a64e0c3fa75be514d4e6aa62699d48..47e52e9bf724898d836e3ccdef1d017fb350dd03 100644 (file)
@@ -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) {
index 2266e09165965b60eb0584613a3face6e5948523..10d274031972985beed169e1ef1056bf751a4722 100644 (file)
@@ -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];
index 2845ca7c88d79e56e28c717e4a05a0ed5b4320fa..487c57d24e4aae33fa627e7e29a7cdc84ebe6845 100644 (file)
@@ -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
index c80d1af28f938097bf8d18221325c66ccafff707..9548e47875f0f187f7fd282c9e791dcedfb67d6f 100644 (file)
@@ -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
index 69dd870dcc360be7ea17c3d04cefcf0a419c756e..9f8f19dadbdd7edad8c5f879b2d0b2629a742c9d 100644 (file)
@@ -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
index 49de21f64bcc4d37020d93f1e9ab7e145c4369a8..cf227ddf8f8f63981a5cbffad7bd12d8f8d07c0b 100644 (file)
@@ -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
index b3ca624abb2c17c6f240a1298666c434a2bbcb6a..c3e7af98928a1d68605bb44a303ce078ce8c61ec 100644 (file)
@@ -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
index 525f951a5170fe0c80ea501b53df837ce4cff189..d1f124933c853828acf44175668f990c6ac162c7 100644 (file)
@@ -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
index b3a11591eddef9853658fd8eba0b54a95109f053..be7118edbda4f55f8c923cb5b137f2fd1742b31e 100644 (file)
@@ -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
index 8d31c3ec91912034f76d1acb27ad9f61fa636ec8..1f9aae88a4d87f57253d62100b264010b3abf1a3 100644 (file)
@@ -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
index a9f73c6bda5df534d86064b54606475969c4b7b2..af650ae993555602a384e46461a4025a1d9b714c 100644 (file)
@@ -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
index 3b70349026c02053fc15c1660770f6e25d7c5f55..43b2f6a52a60e1e4fbd5136ae2f7359c7fb122f4 100644 (file)
@@ -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
index 2c4667c114122a6508c75ebcf475b3103ba979fa..6df852498df19ffbd8e73c0936a9814f8ac6f291 100644 (file)
@@ -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
index 42cb1f272187d19d9ce5e5c5c96601534ea21a77..49f062463f1e65b009753625c7898d9b6dbe9088 100644 (file)
@@ -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"
index 64d51457d770b7395160fb82e86358b7cf43363a..16960eac95228728f0b8cb56fb70f061cfd90429 100644 (file)
@@ -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)