. 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
$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);
$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);
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)
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
$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--
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
$foo = 'test';
$x = @$foo[6];
-print @($foo[100] + $foo[130]);
-
-print "\nDone\n";
+var_dump(@($foo[100] . $foo[130]));
?>
--EXPECT--
-0
-Done
+string(0) ""
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 = '';
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) ""
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
+++ /dev/null
---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
<?php
$a = 'aaa';
-foreach ($a['bbb'] as &$value) {
+foreach ($a['2bbb'] as &$value) {
echo 'loop';
}
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:
});
$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}
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"
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;
}
}
-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) {
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)
+++ /dev/null
---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}
--- /dev/null
+--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
--- /dev/null
+--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)
--TEST--
-Invalid numeric string E_WARNINGs and E_NOTICEs, combined assignment operations
+Invalid numeric string TypeErrors and E_WARNINGs, combined assignment operations
--FILE--
<?php
$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";
$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;
$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;
$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;
$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
--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
--- /dev/null
+--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
--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:
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]);
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
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
'[]',
'new stdClass',
'STDOUT',
+ '"foo"',
];
$legalValues = [
'null',
'2',
'3.5',
'"123"',
- '"foo"', // Semi-legal.
+ '"123foo"', // Semi-legal
];
set_error_handler(function($errno, $errstr) {
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 [] . []
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 [] .= []
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
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
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
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:
Cannot decrement stdClass
Cannot increment resource
Cannot decrement resource
+No error for fop++
+No error for foo--
$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);
?>
--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) " "
$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);
?>
--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
$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);
?>
--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"
$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);
?>
--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"
$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);
?>
--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
$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);
?>
--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
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
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
*** 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) ""
*** 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) ""
*** 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) ""
*** 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) ""
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
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
INF => INF
"42" => 42
"42.0" => 42.0
-"42x" => 42 (A non well formed numeric value encountered)
+"42x" => true
"x" => true
"" => false
true => true
INF => true
"42" => 42
"42.0" => 42
-"42x" => 42 (A non well formed numeric value encountered)
+"42x" => true
"x" => true
"" => false
true => true
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
}
} 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)) {
*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)) {
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) {
/* 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);
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
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);
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:
dim = Z_REFVAL_P(dim);
goto try_again;
default:
- zend_illegal_offset();
+ zend_illegal_string_offset(dim);
break;
}
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:
dim = Z_REFVAL_P(dim);
goto try_string_offset;
default:
- zend_illegal_offset();
+ zend_illegal_string_offset(dim);
break;
}
} 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) {
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;
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)) {
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,
}
/* }}} */
-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)) {
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;
}
/* }}} */
-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:
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) {
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) {
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*/)
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*/)
/* }}} */
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;
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 */
/* 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';
* 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;
}
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;
}
}
}
* 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);
#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);
}
}
+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;
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;
}
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;
}
hval = 1;
goto num_index;
default:
- zend_type_error("Illegal offset type");
+ zend_jit_illegal_string_offset(dim);
undef_result_after_exception();
return NULL;
}
hval = 1;
goto num_index;
default:
- zend_type_error("Illegal offset type");
+ zend_jit_illegal_string_offset(dim);
undef_result_after_exception();
return NULL;
}
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:
dim = Z_REFVAL_P(dim);
goto try_string_offset;
default:
- zend_type_error("Illegal offset type");
+ zend_jit_illegal_string_offset(dim);
break;
}
} 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);
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);
dim = Z_REFVAL_P(dim);
goto try_string_offset;
default:
- zend_type_error("Illegal offset type");
+ zend_jit_illegal_string_offset(dim);
break;
}
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:
dim = Z_REFVAL_P(dim);
goto try_again;
default:
- zend_type_error("Illegal offset type");
+ zend_jit_illegal_string_offset(dim);
break;
}
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;
}
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
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";
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"
<?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);
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"
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);
}
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);
}
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;
}
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 {
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();}
*** 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)
*** Testing doubleval() on non floating types ***
float(-2147483648)
float(2147483648)
-float(%d)
-float(%d)
+float(5)
+float(6)
float(0)
float(1)
float(-1300)
}
?>
--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 ***
float(2147483648)
-- Iteration : file resoruce --
-float(%d)
+float(5)
-- Iteration : directory resource --
-float(%d)
+float(6)
-- Iteration : "0.0" --
float(0)
float(2147483648)
-- Iteration : file resoruce --
-float(%d)
+float(5)
-- Iteration : directory resource --
-float(%d)
+float(6)
-- Iteration : "0.0" --
float(0)
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
int(0)
-- Iteration 26 --
-%s
+Unsupported operand types: resource ** int
};
fclose($fp);
?>
---EXPECTF--
+--EXPECT--
*** Testing pow() : usage variations ***
-- Iteration 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
int(0)
-- Iteration 26 --
-%s
+Unsupported operand types: resource ** int
};
fclose($fp);
?>
---EXPECTF--
+--EXPECT--
*** Testing pow() : usage variations ***
-- Iteration 1 --
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
float(1)
-- Iteration 26 --
-%s
+Unsupported operand types: float ** resource
$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);
Warning: A non-numeric value encountered in %s on line %d
array(1) {
[0]=>
- string(40) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
+ string(40) "0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
int(134512640)
array(1) {
$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];
<?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
$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
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' + '-7.7' ---
float(-7.7)
--- testing: '0' + 'abc' ---
-int(0)
+Unsupported operand types: string + string
--- testing: '0' + '123abc' ---
int(123)
--- testing: '0' + '123e5' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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
try {
var_dump($strVal<<$otherVal);
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo get_class($e) . ': ' . $e->getMessage() . "\n";
}
}
}
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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
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";
}
}
}
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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
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";
}
}
}
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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
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
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";
}
}
}
?>
--EXPECT--
--- testing: '0' % '0' ---
-Exception: Modulo by zero
+DivisionByZeroError: Modulo by zero
--- testing: '0' % '65' ---
int(0)
--- testing: '0' % '-44' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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
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' * '-7.7' ---
float(-0)
--- testing: '0' * 'abc' ---
-int(0)
+Unsupported operand types: string * string
--- testing: '0' * '123abc' ---
int(0)
--- testing: '0' * '123e5' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- testing: '123e5' * '-7.7' ---
float(-94710000)
--- testing: '123e5' * 'abc' ---
-float(0)
+Unsupported operand types: string * string
--- testing: '123e5' * '123abc' ---
float(1512900000)
--- testing: '123e5' * '123e5' ---
--- 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' ---
--- testing: '123e5xyz' * '-7.7' ---
float(-94710000)
--- testing: '123e5xyz' * 'abc' ---
-float(0)
+Unsupported operand types: string * string
--- testing: '123e5xyz' * '123abc' ---
float(1512900000)
--- testing: '123e5xyz' * '123e5' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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
"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;
+ }
}
?>
--- 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
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' - '-7.7' ---
float(7.7)
--- testing: '0' - 'abc' ---
-int(0)
+Unsupported operand types: string - string
--- testing: '0' - '123abc' ---
int(-123)
--- testing: '0' - '123e5' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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' ---
--- 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
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"
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)