mirror of
https://github.com/php/php-src.git
synced 2026-04-27 18:23:26 +02:00
Implement 'Saner Numeric Strings' RFC:
RFC: https://wiki.php.net/rfc/saner-numeric-strings This removes the -1 allow_error mode from is_numeric_string functions and replaces it by a trailing boolean out argument to preserve BC in a couple of places. Most of the changes can be resumed to "numeric" strings which emitted a E_NOTICE now emit a E_WARNING and "numeric" strings which emitted a E_WARNING now throw a TypeError. This mostly affects: - String offsets - Arithmetic operations - Bitwise operations Closes GH-5762
This commit is contained in:
@@ -217,6 +217,27 @@ PHP 8.0 UPGRADE NOTES
|
||||
. debug_backtrace() and Exception::getTrace() will no longer provide
|
||||
references to arguments. It will not be possible to change function
|
||||
arguments through the backtrace.
|
||||
. The concept of numeric-string has been altered to be less error prone.
|
||||
Trailing whitespaces are now allowed in numeric strings making it symmetric
|
||||
with how leading whitespaces were treated.
|
||||
This mostly affects:
|
||||
- The is_numeric() function
|
||||
- String-to-string comparisons
|
||||
- Type declarations
|
||||
- Increment and Decrement operations
|
||||
The concept of "leading-numeric string" has been mostly dropped, the cases
|
||||
where this concept remains is in order to ease migration.
|
||||
String which emitted an E_NOTICE "A non well formed numeric value encountered"
|
||||
will now emit an E_WARNING "A non-numeric value encountered"
|
||||
and all strings which emitted an E_WARNING "A non-numeric value encountered"
|
||||
will now throw a TypeError.
|
||||
This mostly affects:
|
||||
- Arithmetic operations
|
||||
- Bitwise operations
|
||||
This E_WARNING to TypeError change also affects the E_WARNING
|
||||
"Illegal string offset 'string'" for illegal string offsets.
|
||||
This does not change the behaviour of explicit casts to int/float from strings.
|
||||
RFC: https://wiki.php.net/rfc/saner-numeric-strings
|
||||
|
||||
- COM:
|
||||
. Removed the ability to import case-insensitive constants from type
|
||||
|
||||
+15
-11
@@ -11,9 +11,12 @@ $s2 = "876222numeric";
|
||||
$s3 = "48474874";
|
||||
$s4 = "25.68";
|
||||
|
||||
$c = $i + $s1;
|
||||
var_dump($c);
|
||||
|
||||
try {
|
||||
$c = $i + $s1;
|
||||
var_dump($c);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
$c = $i + $s2;
|
||||
var_dump($c);
|
||||
|
||||
@@ -23,8 +26,12 @@ var_dump($c);
|
||||
$c = $i + $s4;
|
||||
var_dump($c);
|
||||
|
||||
$c = $s1 + $i;
|
||||
var_dump($c);
|
||||
try {
|
||||
$c = $s1 + $i;
|
||||
var_dump($c);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
|
||||
$c = $s2 + $i;
|
||||
var_dump($c);
|
||||
@@ -38,18 +45,15 @@ var_dump($c);
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(75636)
|
||||
Unsupported operand types: int + string
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(951858)
|
||||
int(48550510)
|
||||
float(75661.68)
|
||||
Unsupported operand types: string + int
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(75636)
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
int(951858)
|
||||
int(48550510)
|
||||
float(75661.68)
|
||||
|
||||
@@ -6,7 +6,7 @@ Bug #24773 (unset() of integers treated as arrays causes a crash)
|
||||
unset($array["lvl1"]["lvl2"]["b"]);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot use string offset as an array in %s:%d
|
||||
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
||||
@@ -17,16 +17,28 @@ var_dump(isset($a['b']));
|
||||
|
||||
$simpleString = "Bogus String Text";
|
||||
echo isset($simpleString->wrong)?"bug\n":"ok\n";
|
||||
echo isset($simpleString["wrong"])?"bug\n":"ok\n";
|
||||
try {
|
||||
echo isset($simpleString["wrong"])?"bug\n":"ok\n";
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo isset($simpleString[-20])?"bug\n":"ok\n";
|
||||
echo isset($simpleString[0])?"ok\n":"bug\n";
|
||||
echo isset($simpleString["0"])?"ok\n":"bug\n";
|
||||
echo isset($simpleString["16"])?"ok\n":"bug\n";
|
||||
echo isset($simpleString["17"])?"bug\n":"ok\n";
|
||||
echo $simpleString->wrong === null?"ok\n":"bug\n";
|
||||
echo $simpleString["wrong"] === "B"?"ok\n":"bug\n";
|
||||
try {
|
||||
echo $simpleString["wrong"] === "B"?"ok\n":"bug\n";
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo $simpleString["0"] === "B"?"ok\n":"bug\n";
|
||||
$simpleString["wrong"] = "f";
|
||||
try {
|
||||
$simpleString["wrong"] = "f";
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo $simpleString["0"] === "f"?"ok\n":"bug\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
@@ -46,10 +58,7 @@ ok
|
||||
|
||||
Warning: Attempt to read property "wrong" on string in %s on line %d
|
||||
ok
|
||||
|
||||
Warning: Illegal string offset "wrong" in %s on line %d
|
||||
Cannot access offset of type string on string
|
||||
ok
|
||||
ok
|
||||
|
||||
Warning: Illegal string offset "wrong" in %s on line %d
|
||||
Cannot access offset of type string on string
|
||||
ok
|
||||
|
||||
@@ -8,11 +8,8 @@ error_reporting(E_ALL);
|
||||
$foo = 'test';
|
||||
$x = @$foo[6];
|
||||
|
||||
print @($foo[100] + $foo[130]);
|
||||
|
||||
print "\nDone\n";
|
||||
var_dump(@($foo[100] . $foo[130]));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
0
|
||||
Done
|
||||
string(0) ""
|
||||
|
||||
@@ -16,7 +16,11 @@ var_dump($str[-1] = 'a');
|
||||
var_dump($str);
|
||||
|
||||
$str = '';
|
||||
var_dump($str['foo'] = 'a');
|
||||
try {
|
||||
var_dump($str['foo'] = 'a');
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
var_dump($str);
|
||||
|
||||
$str = '';
|
||||
@@ -53,9 +57,7 @@ string(6) " a"
|
||||
Warning: Illegal string offset -1 in %s on line %d
|
||||
NULL
|
||||
string(0) ""
|
||||
|
||||
Warning: Illegal string offset "foo" in %s on line %d
|
||||
string(1) "a"
|
||||
Cannot access offset of type string on string
|
||||
string(1) "a"
|
||||
Error: [] operator not supported for strings
|
||||
string(0) ""
|
||||
|
||||
@@ -5,10 +5,10 @@ Bug #64578 (debug_backtrace in set_error_handler corrupts zend heap: segfault)
|
||||
|
||||
set_error_handler(function($no, $err) { var_dump($err); });
|
||||
|
||||
function x($s) { $s['a'] = 1; };
|
||||
function x($s) { $s['2a'] = 1; };
|
||||
$y = '1';
|
||||
x($y);
|
||||
print_r($y);
|
||||
--EXPECT--
|
||||
string(25) "Illegal string offset "a""
|
||||
string(26) "Illegal string offset "2a""
|
||||
1
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Bug #72057 (PHP hangs when user error handler throws exception after Notice from type coercion)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_error_handler(
|
||||
function() {
|
||||
throw new Exception("My custom error");
|
||||
}
|
||||
);
|
||||
|
||||
(function (int $i) { bar(); })("7as");
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Exception: My custom error in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): {closure}(8, 'A non well form...', '%s', %d)
|
||||
#1 %s(%d): {closure}('7as')
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -4,7 +4,7 @@ Bug #73792 (invalid foreach loop hangs script)
|
||||
<?php
|
||||
$a = 'aaa';
|
||||
|
||||
foreach ($a['bbb'] as &$value) {
|
||||
foreach ($a['2bbb'] as &$value) {
|
||||
echo 'loop';
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ unset($value);
|
||||
echo 'done';
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Illegal string offset "bbb" in %s on line %d
|
||||
Warning: Illegal string offset "2bbb" in %s on line %d
|
||||
|
||||
Fatal error: Uncaught Error: Cannot iterate on string offsets by reference in %sbug73792.php:4
|
||||
Stack trace:
|
||||
|
||||
@@ -7,10 +7,10 @@ set_error_handler(function ($severity, $message, $file, $line) {
|
||||
});
|
||||
|
||||
$x = "foo";
|
||||
$y = &$x["bar"];
|
||||
$y = &$x["2bar"];
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Exception: Illegal string offset "bar" in %s:%d
|
||||
Fatal error: Uncaught Exception: Illegal string offset "2bar" in %s:%d
|
||||
Stack trace:
|
||||
#0 %sbug76534.php(%d): {closure}(2, 'Illegal string ...', '%s', %d)
|
||||
#1 {main}
|
||||
|
||||
@@ -6,12 +6,12 @@ error_reporting(E_ALL);
|
||||
|
||||
var_dump("foobar"[3]);
|
||||
var_dump("foobar"[2][0]);
|
||||
var_dump("foobar"["foo"]["bar"]);
|
||||
var_dump("foobar"["0foo"]["0bar"]);
|
||||
--EXPECTF--
|
||||
string(1) "b"
|
||||
string(1) "o"
|
||||
|
||||
Warning: Illegal string offset "foo" in %s on line %d
|
||||
Warning: Illegal string offset "0foo" in %s on line %d
|
||||
|
||||
Warning: Illegal string offset "bar" in %s on line %d
|
||||
Warning: Illegal string offset "0bar" in %s on line %d
|
||||
string(1) "f"
|
||||
|
||||
@@ -5,7 +5,7 @@ Dynamic Constant Expressions
|
||||
|
||||
const C_0 = 0;
|
||||
const C_1 = 1;
|
||||
const C_foo = "foo";
|
||||
const C_foo = "0foo";
|
||||
const C_arr = [0 => 0, "foo" => "foo"];
|
||||
|
||||
const T_1 = C_1 | 2;
|
||||
|
||||
@@ -75,19 +75,13 @@ array(1) {
|
||||
}
|
||||
}
|
||||
|
||||
Warning: Illegal string offset "foo" in %s on line %d
|
||||
Warning: Array to string conversion in %s on line %d
|
||||
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"
|
||||
|
||||
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"
|
||||
Cannot access offset of type string on string
|
||||
string(1) " "
|
||||
Cannot use a scalar value as an array
|
||||
float(0.1)
|
||||
array(1) {
|
||||
|
||||
@@ -39,14 +39,14 @@ int(-1234500000)
|
||||
int(1234500000)
|
||||
int(-1234500000)
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(1234500000)
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(-1234500000)
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(1234500000)
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(-1234500000)
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
A "non well formed" notice converted to exception should result in a ZPP failure
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_error_handler(function($_, $msg) {
|
||||
throw new Exception($msg);
|
||||
}, E_NOTICE);
|
||||
|
||||
try {
|
||||
wordwrap("foo", "123foo", "");
|
||||
} catch (Exception $e) {
|
||||
echo $e, "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Exception: A non well formed numeric value encountered in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: {closure}(%s)
|
||||
#1 %s(%d): wordwrap('foo', '123foo', '')
|
||||
#2 {main}
|
||||
@@ -0,0 +1,86 @@
|
||||
--TEST--
|
||||
Using different sorts of numerical strings as an array offset
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
|
||||
|
||||
var_dump($arr["7"]);
|
||||
var_dump($arr["7.5"]);
|
||||
var_dump($arr[" 7"]);
|
||||
var_dump($arr[" 7.5"]);
|
||||
var_dump($arr[" 7 "]);
|
||||
var_dump($arr[" 7.5 "]);
|
||||
var_dump($arr["7 "]);
|
||||
var_dump($arr["7.5 "]);
|
||||
var_dump($arr["7str"]);
|
||||
var_dump($arr["7.5str"]);
|
||||
var_dump($arr[" 7str"]);
|
||||
var_dump($arr[" 7.5str"]);
|
||||
var_dump($arr[" 7 str"]);
|
||||
var_dump($arr[" 7.5 str"]);
|
||||
var_dump($arr["7 str"]);
|
||||
var_dump($arr["7.5 str"]);
|
||||
var_dump($arr["0xA"]);
|
||||
var_dump($arr["0b10"]);
|
||||
var_dump($arr["07"]);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(7)
|
||||
|
||||
Notice: Undefined array key "7.5" in %s on line 6
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key " 7" in %s on line 7
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key " 7.5" in %s on line 8
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key " 7 " in %s on line 9
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key " 7.5 " in %s on line 10
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key "7 " in %s on line 11
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key "7.5 " in %s on line 12
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key "7str" in %s on line 13
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key "7.5str" in %s on line 14
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key " 7str" in %s on line 15
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key " 7.5str" in %s on line 16
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key " 7 str" in %s on line 17
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key " 7.5 str" in %s on line 18
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key "7 str" in %s on line 19
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key "7.5 str" in %s on line 20
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key "0xA" in %s on line 21
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key "0b10" in %s on line 22
|
||||
NULL
|
||||
|
||||
Notice: Undefined array key "07" in %s on line 23
|
||||
NULL
|
||||
Done
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Explicit cast of leading numeric strings should still work without warning
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump((int) "2px");
|
||||
var_dump((float) "2px");
|
||||
var_dump((int) "2.5px");
|
||||
var_dump((float) "2.5px");
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
float(2)
|
||||
int(2)
|
||||
float(2.5)
|
||||
+129
-120
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Invalid numeric string E_WARNINGs and E_NOTICEs, combined assignment operations
|
||||
Invalid numeric string TypeErrors and E_WARNINGs, combined assignment operations
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -11,37 +11,57 @@ function foxcache($val) {
|
||||
$a = foxcache("2 Lorem");
|
||||
$a += "3 ipsum";
|
||||
var_dump($a);
|
||||
$a = foxcache("dolor");
|
||||
$a += "sit";
|
||||
var_dump($a);
|
||||
try {
|
||||
$a = foxcache("dolor");
|
||||
$a += "sit";
|
||||
var_dump($a);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
$a = foxcache("5 amet,");
|
||||
$a -= "7 consectetur";
|
||||
var_dump($a);
|
||||
$a = foxcache("adipiscing");
|
||||
$a -= "elit,";
|
||||
var_dump($a);
|
||||
try {
|
||||
$a = foxcache("adipiscing");
|
||||
$a -= "elit,";
|
||||
var_dump($a);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
$a = foxcache("11 sed");
|
||||
$a *= "13 do";
|
||||
var_dump($a);
|
||||
$a = foxcache("eiusmod");
|
||||
$a *= "tempor";
|
||||
var_dump($a);
|
||||
try {
|
||||
$a = foxcache("eiusmod");
|
||||
$a *= "tempor";
|
||||
var_dump($a);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
$a = foxcache("17 incididunt");
|
||||
$a /= "19 ut";
|
||||
var_dump($a);
|
||||
$a = foxcache("labore");
|
||||
$a /= "et";
|
||||
var_dump($a);
|
||||
try {
|
||||
$a = foxcache("labore");
|
||||
$a /= "et";
|
||||
var_dump($a);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
$a = foxcache("23 dolore");
|
||||
$a **= "29 magna";
|
||||
var_dump($a);
|
||||
$a = foxcache("aliqua.");
|
||||
$a **= "Ut";
|
||||
var_dump($a);
|
||||
try {
|
||||
$a = foxcache("aliqua.");
|
||||
$a **= "Ut";
|
||||
var_dump($a);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
$a = foxcache("31 enim");
|
||||
$a %= "37 ad";
|
||||
@@ -50,22 +70,31 @@ try {
|
||||
$a = foxcache("minim");
|
||||
$a %= "veniam,";
|
||||
var_dump($a);
|
||||
} catch (DivisionByZeroError $e) {
|
||||
} catch (\TypeError $e) {
|
||||
echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
$a = foxcache("41 minim");
|
||||
$a <<= "43 veniam,";
|
||||
var_dump($a);
|
||||
$a = foxcache("quis");
|
||||
$a <<= "nostrud";
|
||||
try {
|
||||
var_dump($a);
|
||||
$a = foxcache("quis");
|
||||
$a <<= "nostrud";
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
var_dump($a);
|
||||
echo "---", PHP_EOL;
|
||||
$a = foxcache("47 exercitation");
|
||||
$a >>= "53 ullamco";
|
||||
var_dump($a);
|
||||
$a = foxcache("laboris");
|
||||
$a >>= "nisi";
|
||||
var_dump($a);
|
||||
try {
|
||||
$a = foxcache("laboris");
|
||||
$a >>= "nisi";
|
||||
var_dump($a);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
$a = foxcache("59 ut");
|
||||
$a |= 61;
|
||||
@@ -73,12 +102,20 @@ var_dump($a);
|
||||
$a = foxcache(67);
|
||||
$a |= "71 aliquip";
|
||||
var_dump($a);
|
||||
$a = foxcache("ex");
|
||||
$a |= 73;
|
||||
var_dump($a);
|
||||
$a = foxcache(79);
|
||||
$a |= "ea";
|
||||
var_dump($a);
|
||||
try {
|
||||
$a = foxcache("ex");
|
||||
$a |= 73;
|
||||
var_dump($a);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
try {
|
||||
$a = foxcache(79);
|
||||
$a |= "ea";
|
||||
var_dump($a);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
$a = foxcache("83 commodo");
|
||||
$a &= 89;
|
||||
@@ -86,12 +123,20 @@ var_dump($a);
|
||||
$a = foxcache(97);
|
||||
$a &= "101 consequat.";
|
||||
var_dump($a);
|
||||
$a = foxcache("Duis");
|
||||
$a &= 103;
|
||||
var_dump($a);
|
||||
$a = foxcache(107);
|
||||
$a &= "aute";
|
||||
var_dump($a);
|
||||
try {
|
||||
$a = foxcache("Duis");
|
||||
$a &= 103;
|
||||
var_dump($a);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
try {
|
||||
$a = foxcache(107);
|
||||
$a &= "aute";
|
||||
var_dump($a);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
$a = foxcache("109 irure");
|
||||
$a ^= 113;
|
||||
@@ -99,137 +144,101 @@ var_dump($a);
|
||||
$a = foxcache(127);
|
||||
$a ^= "131 dolor";
|
||||
var_dump($a);
|
||||
$a = foxcache("in");
|
||||
$a ^= 137;
|
||||
var_dump($a);
|
||||
$a = foxcache(139);
|
||||
$a ^= "reprehenderit";
|
||||
var_dump($a);
|
||||
try {
|
||||
$a = foxcache("in");
|
||||
$a ^= 137;
|
||||
var_dump($a);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
try {
|
||||
$a = foxcache(139);
|
||||
$a ^= "reprehenderit";
|
||||
var_dump($a);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
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
|
||||
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)
|
||||
Unsupported operand types: string + 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
|
||||
|
||||
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(-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)
|
||||
Unsupported operand types: string - 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
|
||||
|
||||
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(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)
|
||||
Unsupported operand types: string * 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
|
||||
|
||||
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(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)
|
||||
Unsupported operand types: string / 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
|
||||
|
||||
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.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)
|
||||
Unsupported operand types: string ** 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
|
||||
|
||||
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(31)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
TypeError: Unsupported operand types: string % 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
|
||||
|
||||
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(%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)
|
||||
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
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(63)
|
||||
|
||||
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(71)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(73)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(79)
|
||||
Unsupported operand types: string | int
|
||||
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(81)
|
||||
|
||||
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(97)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string & int
|
||||
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(28)
|
||||
|
||||
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(252)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(137)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(139)
|
||||
Unsupported operand types: string ^ int
|
||||
Unsupported operand types: int ^ string
|
||||
+116
-104
@@ -1,194 +1,206 @@
|
||||
--TEST--
|
||||
Invalid numeric string E_WARNINGs and E_NOTICEs
|
||||
Invalid numeric string TypeErrors and E_WARNINGs
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump("2 Lorem" + "3 ipsum");
|
||||
var_dump("dolor" + "sit");
|
||||
try {
|
||||
var_dump("dolor" + "sit");
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
var_dump("5 amet," - "7 consectetur");
|
||||
var_dump("adipiscing" - "elit,");
|
||||
try {
|
||||
var_dump("adipiscing" - "elit,");
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
var_dump("11 sed" * "13 do");
|
||||
var_dump("eiusmod" * "tempor");
|
||||
try {
|
||||
var_dump("eiusmod" * "tempor");
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
var_dump("17 incididunt" / "19 ut");
|
||||
var_dump("labore" / "et");
|
||||
try {
|
||||
var_dump("labore" / "et");
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
var_dump("23 dolore" ** "29 magna");
|
||||
var_dump("aliqua." ** "Ut");
|
||||
try {
|
||||
var_dump("aliqua." ** "Ut");
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
var_dump("31 enim" % "37 ad");
|
||||
try {
|
||||
var_dump("minim" % "veniam,");
|
||||
} catch (DivisionByZeroError $e) {
|
||||
} catch (\TypeError $e) {
|
||||
echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
var_dump("41 minim" << "43 veniam,");
|
||||
var_dump("quis" << "nostrud");
|
||||
try {
|
||||
var_dump("quis" << "nostrud");
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
var_dump("47 exercitation" >> "53 ullamco");
|
||||
var_dump("laboris" >> "nisi");
|
||||
try {
|
||||
var_dump("laboris" >> "nisi");
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
var_dump("59 ut" | 61);
|
||||
var_dump(67 | "71 aliquip");
|
||||
var_dump("ex" | 73);
|
||||
var_dump(79 | "ea");
|
||||
try {
|
||||
var_dump("ex" | 73);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
try {
|
||||
var_dump(79 | "ea");
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
var_dump("83 commodo" & 89);
|
||||
var_dump(97 & "101 consequat.");
|
||||
var_dump("Duis" & 103);
|
||||
var_dump(107 & "aute");
|
||||
try {
|
||||
var_dump("Duis" & 103);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
try {
|
||||
var_dump(107 & "aute");
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
var_dump("109 irure" ^ 113);
|
||||
var_dump(127 ^ "131 dolor");
|
||||
var_dump("in" ^ 137);
|
||||
var_dump(139 ^ "reprehenderit");
|
||||
try {
|
||||
var_dump("in" ^ 137);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
try {
|
||||
var_dump(139 ^ "reprehenderit");
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
var_dump(+"149 in");
|
||||
var_dump(+"voluptate");
|
||||
try {
|
||||
var_dump(+"voluptate");
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo "---", PHP_EOL;
|
||||
var_dump(-"151 velit");
|
||||
var_dump(-"esse");
|
||||
try {
|
||||
var_dump(-"esse");
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
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
|
||||
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)
|
||||
Unsupported operand types: string + 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
|
||||
|
||||
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(-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)
|
||||
Unsupported operand types: string - 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
|
||||
|
||||
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(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)
|
||||
Unsupported operand types: string * 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
|
||||
|
||||
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(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)
|
||||
Unsupported operand types: string / 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
|
||||
|
||||
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.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)
|
||||
Unsupported operand types: string ** 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
|
||||
|
||||
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(31)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
TypeError: Unsupported operand types: string % 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
|
||||
|
||||
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(%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)
|
||||
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
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(63)
|
||||
|
||||
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(71)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(73)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(79)
|
||||
Unsupported operand types: string | int
|
||||
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(81)
|
||||
|
||||
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(97)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string & int
|
||||
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(28)
|
||||
|
||||
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(252)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(137)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(139)
|
||||
Unsupported operand types: string ^ int
|
||||
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(149)
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
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
|
||||
@@ -0,0 +1,72 @@
|
||||
--TEST--
|
||||
Using different sorts of numerical strings as a string offset
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$str = "The world is fun";
|
||||
|
||||
$keys = [
|
||||
"7",
|
||||
"7.5",
|
||||
" 7",
|
||||
" 7.5",
|
||||
" 7 ",
|
||||
" 7.5 ",
|
||||
"7 ",
|
||||
"7.5 ",
|
||||
"7str",
|
||||
"7.5str",
|
||||
" 7str",
|
||||
" 7.5str",
|
||||
" 7 str",
|
||||
" 7.5 str",
|
||||
"7 str",
|
||||
"7.5 str",
|
||||
"0xC",
|
||||
"0b10",
|
||||
"07",
|
||||
];
|
||||
|
||||
foreach ($keys as $key) {
|
||||
try {
|
||||
var_dump($str[$key]);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(1) "l"
|
||||
Cannot access offset of type string on string
|
||||
string(1) "l"
|
||||
Cannot access offset of type string on string
|
||||
string(1) "l"
|
||||
Cannot access offset of type string on string
|
||||
string(1) "l"
|
||||
Cannot access offset of type string on string
|
||||
|
||||
Warning: Illegal string offset "7str" in %s on line %d
|
||||
string(1) "l"
|
||||
Cannot access offset of type string on string
|
||||
|
||||
Warning: Illegal string offset " 7str" in %s on line %d
|
||||
string(1) "l"
|
||||
Cannot access offset of type string on string
|
||||
|
||||
Warning: Illegal string offset " 7 str" in %s on line %d
|
||||
string(1) "l"
|
||||
Cannot access offset of type string on string
|
||||
|
||||
Warning: Illegal string offset "7 str" in %s on line %d
|
||||
string(1) "l"
|
||||
Cannot access offset of type string on string
|
||||
|
||||
Warning: Illegal string offset "0xC" in %s on line %d
|
||||
string(1) "T"
|
||||
|
||||
Warning: Illegal string offset "0b10" in %s on line %d
|
||||
string(1) "T"
|
||||
string(1) "l"
|
||||
Done
|
||||
@@ -1,14 +1,14 @@
|
||||
--TEST--
|
||||
Crash on $x['x']['y'] += 1 when $x is string
|
||||
Crash on $x['2x']['y'] += 1 when $x is string
|
||||
--FILE--
|
||||
<?php
|
||||
$x = "a";
|
||||
$x['x']['y'] += 1;
|
||||
$x['2x']['y'] += 1;
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Illegal string offset "x" in %s on line %d
|
||||
Warning: Illegal string offset "2x" in %s on line %d
|
||||
|
||||
Fatal error: Uncaught Error: Cannot use string offset as an array in %soffset_assign.php:%d
|
||||
Stack trace:
|
||||
|
||||
@@ -8,9 +8,17 @@ $str = "Sitting on a corner all alone, staring from the bottom of his soul";
|
||||
var_dump($str[1]);
|
||||
var_dump($str[0.0836]);
|
||||
var_dump($str[NULL]);
|
||||
var_dump($str["run away"]);
|
||||
try {
|
||||
var_dump($str["run away"]);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
var_dump($str["13"]);
|
||||
var_dump($str["14.5"]);
|
||||
try {
|
||||
var_dump($str["14.5"]);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
var_dump($str["15 and then some"]);
|
||||
|
||||
var_dump($str[TRUE]);
|
||||
@@ -47,15 +55,11 @@ string(1) "S"
|
||||
|
||||
Warning: String offset cast occurred in %s on line %d
|
||||
string(1) "S"
|
||||
|
||||
Warning: Illegal string offset "run away" in %s on line %d
|
||||
string(1) "S"
|
||||
Cannot access offset of type string on string
|
||||
string(1) "c"
|
||||
Cannot access offset of type string on string
|
||||
|
||||
Warning: Illegal string offset "14.5" in %s on line %d
|
||||
string(1) "o"
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: Illegal string offset "15 and then some" in %s on line %d
|
||||
string(1) "r"
|
||||
|
||||
Warning: String offset cast occurred in %s on line %d
|
||||
@@ -63,9 +67,9 @@ string(1) "i"
|
||||
|
||||
Warning: String offset cast occurred in %s on line %d
|
||||
string(1) "S"
|
||||
Illegal offset type
|
||||
Cannot access offset of type resource on string
|
||||
|
||||
Notice: Object of class stdClass could not be converted to int in %s on line %d
|
||||
Illegal offset type
|
||||
Illegal offset type
|
||||
Cannot access offset of type stdClass on string
|
||||
Cannot access offset of type array on string
|
||||
Done
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,8 +12,12 @@ $s4 = str_repeat("f", 2);
|
||||
$s &= 22;
|
||||
var_dump($s);
|
||||
|
||||
$s1 &= 11;
|
||||
var_dump($s1);
|
||||
try {
|
||||
$s1 &= 11;
|
||||
var_dump($s1);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
|
||||
$s2 &= 33;
|
||||
var_dump($s2);
|
||||
@@ -28,11 +32,9 @@ echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(18)
|
||||
Unsupported operand types: string & int
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
int(33)
|
||||
string(1) " "
|
||||
string(2) " "
|
||||
|
||||
@@ -10,8 +10,12 @@ $s2 = "45345some";
|
||||
$s %= 22;
|
||||
var_dump($s);
|
||||
|
||||
$s1 %= 11;
|
||||
var_dump($s1);
|
||||
try {
|
||||
$s1 %= 11;
|
||||
var_dump($s1);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
|
||||
$s2 %= 33;
|
||||
var_dump($s2);
|
||||
@@ -20,10 +24,8 @@ echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(13)
|
||||
Unsupported operand types: string % int
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
int(3)
|
||||
Done
|
||||
|
||||
@@ -12,8 +12,12 @@ $s4 = str_repeat("f", 2);
|
||||
$s |= 22;
|
||||
var_dump($s);
|
||||
|
||||
$s1 |= 11;
|
||||
var_dump($s1);
|
||||
try {
|
||||
$s1 |= 11;
|
||||
var_dump($s1);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
|
||||
$s2 |= 33;
|
||||
var_dump($s2);
|
||||
@@ -28,11 +32,9 @@ echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(127)
|
||||
Unsupported operand types: string | int
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(11)
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
int(45345)
|
||||
string(1) "f"
|
||||
string(2) "ff"
|
||||
|
||||
@@ -12,8 +12,12 @@ $s4 = str_repeat("f", 2);
|
||||
$s ^= 22;
|
||||
var_dump($s);
|
||||
|
||||
$s1 ^= 11;
|
||||
var_dump($s1);
|
||||
try {
|
||||
$s1 ^= 11;
|
||||
var_dump($s1);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
|
||||
$s2 ^= 33;
|
||||
var_dump($s2);
|
||||
@@ -28,11 +32,9 @@ echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(109)
|
||||
Unsupported operand types: string ^ int
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(11)
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
int(45312)
|
||||
string(1) "F"
|
||||
string(2) "FF"
|
||||
|
||||
@@ -10,8 +10,12 @@ $s2 = "45345some";
|
||||
$s <<= 2;
|
||||
var_dump($s);
|
||||
|
||||
$s1 <<= 1;
|
||||
var_dump($s1);
|
||||
try {
|
||||
$s1 <<= 1;
|
||||
var_dump($s1);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
|
||||
$s2 <<= 3;
|
||||
var_dump($s2);
|
||||
@@ -20,10 +24,8 @@ echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(492)
|
||||
Unsupported operand types: string << int
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
int(362760)
|
||||
Done
|
||||
|
||||
@@ -10,8 +10,12 @@ $s2 = "45345some";
|
||||
$s >>= 2;
|
||||
var_dump($s);
|
||||
|
||||
$s1 >>= 1;
|
||||
var_dump($s1);
|
||||
try {
|
||||
$s1 >>= 1;
|
||||
var_dump($s1);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
|
||||
$s2 >>= 3;
|
||||
var_dump($s2);
|
||||
@@ -20,10 +24,8 @@ echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(30)
|
||||
Unsupported operand types: string >> int
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
int(5668)
|
||||
Done
|
||||
|
||||
@@ -74,8 +74,7 @@ int(1)
|
||||
int(1)
|
||||
|
||||
*** Trying string(2) "1a"
|
||||
E_NOTICE: A non well formed numeric value encountered on line %d
|
||||
int(1)
|
||||
*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
|
||||
|
||||
*** Trying string(1) "a"
|
||||
*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
|
||||
@@ -128,8 +127,7 @@ float(1)
|
||||
float(1.5)
|
||||
|
||||
*** Trying string(2) "1a"
|
||||
E_NOTICE: A non well formed numeric value encountered on line %d
|
||||
float(1)
|
||||
*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
|
||||
|
||||
*** Trying string(1) "a"
|
||||
*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
|
||||
|
||||
@@ -72,8 +72,7 @@ int(1)
|
||||
*** Trying float(1.5)
|
||||
int(1)
|
||||
*** Trying string(2) "1a"
|
||||
E_NOTICE: A non well formed numeric value encountered on line %d
|
||||
int(1)
|
||||
*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
|
||||
*** Trying string(1) "a"
|
||||
*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
|
||||
*** Trying string(0) ""
|
||||
@@ -110,8 +109,7 @@ float(1)
|
||||
*** Trying float(1.5)
|
||||
float(1.5)
|
||||
*** Trying string(2) "1a"
|
||||
E_NOTICE: A non well formed numeric value encountered on line %d
|
||||
float(1)
|
||||
*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
|
||||
*** Trying string(1) "a"
|
||||
*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
|
||||
*** Trying string(0) ""
|
||||
|
||||
@@ -72,8 +72,7 @@ int(1)
|
||||
*** Trying float(1.5)
|
||||
int(1)
|
||||
*** Trying string(2) "1a"
|
||||
E_NOTICE: A non well formed numeric value encountered on line %d
|
||||
int(1)
|
||||
*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
|
||||
*** Trying string(1) "a"
|
||||
*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
|
||||
*** Trying string(0) ""
|
||||
@@ -110,8 +109,7 @@ float(1)
|
||||
*** Trying float(1.5)
|
||||
float(1.5)
|
||||
*** Trying string(2) "1a"
|
||||
E_NOTICE: A non well formed numeric value encountered on line %d
|
||||
float(1)
|
||||
*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
|
||||
*** Trying string(1) "a"
|
||||
*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
|
||||
*** Trying string(0) ""
|
||||
|
||||
@@ -66,7 +66,7 @@ Type int|float:
|
||||
INF => INF
|
||||
"42" => 42
|
||||
"42.0" => 42.0
|
||||
"42x" => 42 (A non well formed numeric value encountered)
|
||||
"42x" => Argument ... must be of type int|float, string given
|
||||
"x" => Argument ... must be of type int|float, string given
|
||||
"" => Argument ... must be of type int|float, string given
|
||||
true => 1
|
||||
@@ -82,7 +82,7 @@ Type int|float|false:
|
||||
INF => INF
|
||||
"42" => 42
|
||||
"42.0" => 42.0
|
||||
"42x" => 42 (A non well formed numeric value encountered)
|
||||
"42x" => Argument ... must be of type int|float|false, string given
|
||||
"x" => Argument ... must be of type int|float|false, string given
|
||||
"" => Argument ... must be of type int|float|false, string given
|
||||
true => 1
|
||||
@@ -98,7 +98,7 @@ Type int|float|bool:
|
||||
INF => INF
|
||||
"42" => 42
|
||||
"42.0" => 42.0
|
||||
"42x" => 42 (A non well formed numeric value encountered)
|
||||
"42x" => true
|
||||
"x" => true
|
||||
"" => false
|
||||
true => true
|
||||
@@ -114,7 +114,7 @@ Type int|bool:
|
||||
INF => true
|
||||
"42" => 42
|
||||
"42.0" => 42
|
||||
"42x" => 42 (A non well formed numeric value encountered)
|
||||
"42x" => true
|
||||
"x" => true
|
||||
"" => false
|
||||
true => true
|
||||
@@ -162,7 +162,7 @@ Type float|array:
|
||||
INF => INF
|
||||
"42" => 42.0
|
||||
"42.0" => 42.0
|
||||
"42x" => 42.0 (A non well formed numeric value encountered)
|
||||
"42x" => Argument ... must be of type array|float, string given
|
||||
"x" => Argument ... must be of type array|float, string given
|
||||
"" => Argument ... must be of type array|float, string given
|
||||
true => 1.0
|
||||
|
||||
+3
-3
@@ -420,7 +420,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest)
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
|
||||
double d;
|
||||
int type;
|
||||
zend_uchar type;
|
||||
|
||||
if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) {
|
||||
if (EXPECTED(type != 0)) {
|
||||
@@ -465,7 +465,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest) /
|
||||
*dest = (double)Z_LVAL_P(arg);
|
||||
} else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
|
||||
zend_long l;
|
||||
int type;
|
||||
zend_uchar type;
|
||||
|
||||
if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), &l, dest)) != IS_DOUBLE)) {
|
||||
if (EXPECTED(type != 0)) {
|
||||
@@ -509,7 +509,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest) /*
|
||||
zend_string *str = Z_STR_P(arg);
|
||||
zend_long lval;
|
||||
double dval;
|
||||
zend_uchar type = is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &lval, &dval, -1);
|
||||
zend_uchar type = is_numeric_str_function(str, &lval, &dval);
|
||||
if (type == IS_LONG) {
|
||||
ZVAL_LONG(arg, lval);
|
||||
} else if (type == IS_DOUBLE) {
|
||||
|
||||
+35
-40
@@ -728,7 +728,7 @@ static zend_bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg
|
||||
/* For an int|float union type and string value,
|
||||
* determine chosen type by is_numeric_string() semantics. */
|
||||
if ((type_mask & MAY_BE_DOUBLE) && Z_TYPE_P(arg) == IS_STRING) {
|
||||
zend_uchar type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &lval, &dval, -1);
|
||||
zend_uchar type = is_numeric_str_function(Z_STR_P(arg), &lval, &dval);
|
||||
if (type == IS_LONG) {
|
||||
zend_string_release(Z_STR_P(arg));
|
||||
ZVAL_LONG(arg, lval);
|
||||
@@ -770,35 +770,11 @@ static zend_bool zend_verify_weak_scalar_type_hint_no_sideeffect(uint32_t type_m
|
||||
double dval;
|
||||
zend_bool bval;
|
||||
|
||||
if (type_mask & MAY_BE_LONG) {
|
||||
if (Z_TYPE_P(arg) == IS_STRING) {
|
||||
/* Handle this case separately to avoid the "non well-formed" warning */
|
||||
zend_uchar type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, &dval, 1);
|
||||
if (type == IS_LONG) {
|
||||
return 1;
|
||||
}
|
||||
if (type == IS_DOUBLE) {
|
||||
if ((type_mask & MAY_BE_DOUBLE)
|
||||
|| (!zend_isnan(dval) && ZEND_DOUBLE_FITS_LONG(dval))) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (zend_parse_arg_long_weak(arg, &lval)) {
|
||||
return 1;
|
||||
}
|
||||
if ((type_mask & MAY_BE_LONG) && zend_parse_arg_long_weak(arg, &lval)) {
|
||||
return 1;
|
||||
}
|
||||
if (type_mask & MAY_BE_DOUBLE) {
|
||||
if (Z_TYPE_P(arg) == IS_STRING) {
|
||||
/* Handle this case separately to avoid the "non well-formed" warning */
|
||||
if (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, NULL, 1) != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (zend_parse_arg_double_weak(arg, &dval)) {
|
||||
return 1;
|
||||
}
|
||||
if ((type_mask & MAY_BE_DOUBLE) && zend_parse_arg_double_weak(arg, &dval)) {
|
||||
return 1;
|
||||
}
|
||||
/* We don't call cast_object here, because this check must be side-effect free. As this
|
||||
* is only used for a sanity check of arginfo/zpp consistency, it's okay if we accept
|
||||
@@ -1271,6 +1247,11 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_illegal_offset(void)
|
||||
zend_type_error("Illegal offset type");
|
||||
}
|
||||
|
||||
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_illegal_string_offset(const zval *offset)
|
||||
{
|
||||
zend_type_error("Cannot access offset of type %s on string", zend_zval_type_name(offset));
|
||||
}
|
||||
|
||||
static zend_never_inline void zend_assign_to_object_dim(zval *object, zval *dim, zval *value OPLINE_DC EXECUTE_DATA_DC)
|
||||
{
|
||||
Z_OBJ_HT_P(object)->write_dimension(Z_OBJ_P(object), dim, value);
|
||||
@@ -1364,13 +1345,19 @@ try_again:
|
||||
if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
|
||||
switch(Z_TYPE_P(dim)) {
|
||||
case IS_STRING:
|
||||
if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
|
||||
break;
|
||||
}
|
||||
if (type != BP_VAR_UNSET) {
|
||||
zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
|
||||
{
|
||||
bool trailing_data = false;
|
||||
/* For BC reasons we allow errors so that we can warn on leading numeric string */
|
||||
if (IS_LONG == is_numeric_string_ex(Z_STRVAL_P(dim), Z_STRLEN_P(dim), &offset, NULL,
|
||||
/* allow errors */ true, NULL, &trailing_data)) {
|
||||
if (UNEXPECTED(trailing_data) && type != BP_VAR_UNSET) {
|
||||
zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
zend_illegal_string_offset(dim);
|
||||
break;
|
||||
}
|
||||
case IS_UNDEF:
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
case IS_DOUBLE:
|
||||
@@ -1383,7 +1370,7 @@ try_again:
|
||||
dim = Z_REFVAL_P(dim);
|
||||
goto try_again;
|
||||
default:
|
||||
zend_illegal_offset();
|
||||
zend_illegal_string_offset(dim);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2349,17 +2336,24 @@ try_array:
|
||||
try_string_offset:
|
||||
if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
|
||||
switch (Z_TYPE_P(dim)) {
|
||||
/* case IS_LONG: */
|
||||
case IS_STRING:
|
||||
if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
|
||||
break;
|
||||
{
|
||||
bool trailing_data = false;
|
||||
/* For BC reasons we allow errors so that we can warn on leading numeric string */
|
||||
if (IS_LONG == is_numeric_string_ex(Z_STRVAL_P(dim), Z_STRLEN_P(dim), &offset,
|
||||
NULL, /* allow errors */ true, NULL, &trailing_data)) {
|
||||
if (UNEXPECTED(trailing_data)) {
|
||||
zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
if (type == BP_VAR_IS) {
|
||||
ZVAL_NULL(result);
|
||||
return;
|
||||
}
|
||||
zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
|
||||
zend_illegal_string_offset(dim);
|
||||
break;
|
||||
}
|
||||
case IS_UNDEF:
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
case IS_DOUBLE:
|
||||
@@ -2374,7 +2368,7 @@ try_string_offset:
|
||||
dim = Z_REFVAL_P(dim);
|
||||
goto try_string_offset;
|
||||
default:
|
||||
zend_illegal_offset();
|
||||
zend_illegal_string_offset(dim);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2382,6 +2376,7 @@ try_string_offset:
|
||||
} else {
|
||||
offset = Z_LVAL_P(dim);
|
||||
}
|
||||
out:
|
||||
|
||||
if (UNEXPECTED(Z_STRLEN_P(container) < ((offset < 0) ? -(size_t)offset : ((size_t)offset + 1)))) {
|
||||
if (type != BP_VAR_IS) {
|
||||
|
||||
@@ -158,7 +158,7 @@ static inline int convert_to_number(zval *retval, const char *str, const int str
|
||||
zend_long lval;
|
||||
double dval;
|
||||
|
||||
if ((type = is_numeric_string_ex(str, str_len, &lval, &dval, 0, &overflow)) != 0) {
|
||||
if ((type = is_numeric_string_ex(str, str_len, &lval, &dval, 0, &overflow, NULL)) != 0) {
|
||||
if (type == IS_LONG) {
|
||||
ZVAL_LONG(retval, lval);
|
||||
return SUCCESS;
|
||||
|
||||
+40
-31
@@ -243,14 +243,22 @@ static zend_never_inline int ZEND_FASTCALL _zendi_try_convert_scalar_to_number(z
|
||||
ZVAL_LONG(holder, 1);
|
||||
return SUCCESS;
|
||||
case IS_STRING:
|
||||
if ((Z_TYPE_INFO_P(holder) = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL_P(holder), &Z_DVAL_P(holder), -1)) == 0) {
|
||||
ZVAL_LONG(holder, 0);
|
||||
{
|
||||
bool trailing_data = false;
|
||||
/* For BC reasons we allow errors so that we can warn on leading numeric string */
|
||||
if (0 == (Z_TYPE_INFO_P(holder) = is_numeric_string_ex(Z_STRVAL_P(op), Z_STRLEN_P(op),
|
||||
&Z_LVAL_P(holder), &Z_DVAL_P(holder), /* allow errors */ true, NULL, &trailing_data))) {
|
||||
/* Will lead to invalid OP type error */
|
||||
return FAILURE;
|
||||
}
|
||||
if (UNEXPECTED(trailing_data)) {
|
||||
zend_error(E_WARNING, "A non-numeric value encountered");
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
case IS_OBJECT:
|
||||
if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), holder, _IS_NUMBER) == FAILURE
|
||||
|| EG(exception)) {
|
||||
@@ -293,13 +301,22 @@ static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(zval *op, ze
|
||||
zend_uchar type;
|
||||
zend_long lval;
|
||||
double dval;
|
||||
if (0 == (type = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval, -1))) {
|
||||
bool trailing_data = false;
|
||||
|
||||
/* For BC reasons we allow errors so that we can warn on leading numeric string */
|
||||
type = is_numeric_string_ex(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval,
|
||||
/* allow errors */ true, NULL, &trailing_data);
|
||||
if (type == 0) {
|
||||
*failed = 1;
|
||||
return 0;
|
||||
}
|
||||
if (UNEXPECTED(trailing_data)) {
|
||||
zend_error(E_WARNING, "A non-numeric value encountered");
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
*failed = 1;
|
||||
}
|
||||
return 0;
|
||||
} else if (EXPECTED(type == IS_LONG)) {
|
||||
}
|
||||
if (EXPECTED(type == IS_LONG)) {
|
||||
return lval;
|
||||
} else {
|
||||
/* Previously we used strtol here, not is_numeric_string,
|
||||
@@ -771,7 +788,7 @@ try_again:
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zend_always_inline zend_long ZEND_FASTCALL _zval_get_long_func_ex(zval *op, zend_bool silent) /* {{{ */
|
||||
ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(zval *op) /* {{{ */
|
||||
{
|
||||
try_again:
|
||||
switch (Z_TYPE_P(op)) {
|
||||
@@ -792,10 +809,7 @@ try_again:
|
||||
zend_uchar type;
|
||||
zend_long lval;
|
||||
double dval;
|
||||
if (0 == (type = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval, silent ? 1 : -1))) {
|
||||
if (!silent) {
|
||||
zend_error(E_WARNING, "A non-numeric value encountered");
|
||||
}
|
||||
if (0 == (type = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval, true))) {
|
||||
return 0;
|
||||
} else if (EXPECTED(type == IS_LONG)) {
|
||||
return lval;
|
||||
@@ -829,12 +843,6 @@ try_again:
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(zval *op) /* {{{ */
|
||||
{
|
||||
return _zval_get_long_func_ex(op, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API double ZEND_FASTCALL zval_get_double_func(zval *op) /* {{{ */
|
||||
{
|
||||
try_again:
|
||||
@@ -2404,7 +2412,7 @@ try_again:
|
||||
zend_long lval;
|
||||
double dval;
|
||||
|
||||
switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) {
|
||||
switch (is_numeric_str_function(Z_STR_P(op1), &lval, &dval)) {
|
||||
case IS_LONG:
|
||||
zval_ptr_dtor_str(op1);
|
||||
if (lval == ZEND_LONG_MAX) {
|
||||
@@ -2471,7 +2479,7 @@ try_again:
|
||||
ZVAL_LONG(op1, -1);
|
||||
break;
|
||||
}
|
||||
switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) {
|
||||
switch (is_numeric_str_function(Z_STR_P(op1), &lval, &dval)) {
|
||||
case IS_LONG:
|
||||
zval_ptr_dtor_str(op1);
|
||||
if (lval == ZEND_LONG_MIN) {
|
||||
@@ -2816,8 +2824,8 @@ ZEND_API int ZEND_FASTCALL zendi_smart_streq(zend_string *s1, zend_string *s2) /
|
||||
zend_long lval1 = 0, lval2 = 0;
|
||||
double dval1 = 0.0, dval2 = 0.0;
|
||||
|
||||
if ((ret1 = is_numeric_string_ex(s1->val, s1->len, &lval1, &dval1, 0, &oflow1)) &&
|
||||
(ret2 = is_numeric_string_ex(s2->val, s2->len, &lval2, &dval2, 0, &oflow2))) {
|
||||
if ((ret1 = is_numeric_string_ex(s1->val, s1->len, &lval1, &dval1, false, &oflow1, NULL)) &&
|
||||
(ret2 = is_numeric_string_ex(s2->val, s2->len, &lval2, &dval2, false, &oflow2, NULL))) {
|
||||
#if ZEND_ULONG_MAX == 0xFFFFFFFF
|
||||
if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. &&
|
||||
((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/)
|
||||
@@ -2864,8 +2872,8 @@ ZEND_API int ZEND_FASTCALL zendi_smart_strcmp(zend_string *s1, zend_string *s2)
|
||||
zend_long lval1 = 0, lval2 = 0;
|
||||
double dval1 = 0.0, dval2 = 0.0;
|
||||
|
||||
if ((ret1 = is_numeric_string_ex(s1->val, s1->len, &lval1, &dval1, 0, &oflow1)) &&
|
||||
(ret2 = is_numeric_string_ex(s2->val, s2->len, &lval2, &dval2, 0, &oflow2))) {
|
||||
if ((ret1 = is_numeric_string_ex(s1->val, s1->len, &lval1, &dval1, false, &oflow1, NULL)) &&
|
||||
(ret2 = is_numeric_string_ex(s2->val, s2->len, &lval2, &dval2, false, &oflow2, NULL))) {
|
||||
#if ZEND_ULONG_MAX == 0xFFFFFFFF
|
||||
if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. &&
|
||||
((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/)
|
||||
@@ -2962,11 +2970,12 @@ ZEND_API zend_string* ZEND_FASTCALL zend_long_to_str(zend_long num) /* {{{ */
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zend_uchar ZEND_FASTCALL is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval) /* {{{ */ {
|
||||
return is_numeric_string_ex(ZSTR_VAL(str), ZSTR_LEN(str), lval, dval, -1, NULL);
|
||||
return is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), lval, dval, false);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info) /* {{{ */
|
||||
ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t length, zend_long *lval,
|
||||
double *dval, bool allow_errors, int *oflow_info, bool *trailing_data) /* {{{ */
|
||||
{
|
||||
const char *ptr;
|
||||
int digits = 0, dp_or_e = 0;
|
||||
@@ -2982,6 +2991,9 @@ ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t
|
||||
if (oflow_info != NULL) {
|
||||
*oflow_info = 0;
|
||||
}
|
||||
if (trailing_data != NULL) {
|
||||
*trailing_data = false;
|
||||
}
|
||||
|
||||
/* Skip any whitespace
|
||||
* This is much faster than the isspace() function */
|
||||
@@ -3007,7 +3019,7 @@ ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t
|
||||
/* Count the number of digits. If a decimal point/exponent is found,
|
||||
* it's a double. Otherwise, if there's a dval or no need to check for
|
||||
* a full match, stop when there are too many digits for a long */
|
||||
for (type = IS_LONG; !(digits >= MAX_LENGTH_OF_LONG && (dval || allow_errors == 1)); digits++, ptr++) {
|
||||
for (type = IS_LONG; !(digits >= MAX_LENGTH_OF_LONG && (dval || allow_errors)); digits++, ptr++) {
|
||||
check_digits:
|
||||
if (ZEND_IS_DIGIT(*ptr)) {
|
||||
tmp_lval = tmp_lval * 10 + (*ptr) - '0';
|
||||
@@ -3043,7 +3055,7 @@ process_double:
|
||||
* the digits if we need to check for a full match */
|
||||
if (dval) {
|
||||
local_dval = zend_strtod(str, &ptr);
|
||||
} else if (allow_errors != 1 && dp_or_e != -1) {
|
||||
} else if (!allow_errors && dp_or_e != -1) {
|
||||
dp_or_e = (*ptr++ == '.') ? 1 : 2;
|
||||
goto check_digits;
|
||||
}
|
||||
@@ -3061,11 +3073,8 @@ process_double:
|
||||
if (!allow_errors) {
|
||||
return 0;
|
||||
}
|
||||
if (allow_errors == -1) {
|
||||
zend_error(E_NOTICE, "A non well formed numeric value encountered");
|
||||
}
|
||||
if (EG(exception)) {
|
||||
return 0;
|
||||
if (trailing_data != NULL) {
|
||||
*trailing_data = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,8 @@ static zend_always_inline zend_bool instanceof_function(
|
||||
* could not be represented as such due to overflow. It writes 1 to oflow_info
|
||||
* if the integer is larger than ZEND_LONG_MAX and -1 if it's smaller than ZEND_LONG_MIN.
|
||||
*/
|
||||
ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info);
|
||||
ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t length, zend_long *lval,
|
||||
double *dval, bool allow_errors, int *oflow_info, bool *trailing_data);
|
||||
|
||||
ZEND_API const char* ZEND_FASTCALL zend_memnstr_ex(const char *haystack, const char *needle, size_t needle_len, const char *end);
|
||||
ZEND_API const char* ZEND_FASTCALL zend_memnrstr_ex(const char *haystack, const char *needle, size_t needle_len, const char *end);
|
||||
@@ -135,16 +136,17 @@ static zend_always_inline zend_long zend_dval_to_lval_cap(double d)
|
||||
#define ZEND_IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
|
||||
#define ZEND_IS_XDIGIT(c) (((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f'))
|
||||
|
||||
static zend_always_inline zend_uchar is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info)
|
||||
static zend_always_inline zend_uchar is_numeric_string_ex(const char *str, size_t length, zend_long *lval,
|
||||
double *dval, bool allow_errors, int *oflow_info, bool *trailing_data)
|
||||
{
|
||||
if (*str > '9') {
|
||||
return 0;
|
||||
}
|
||||
return _is_numeric_string_ex(str, length, lval, dval, allow_errors, oflow_info);
|
||||
return _is_numeric_string_ex(str, length, lval, dval, allow_errors, oflow_info, trailing_data);
|
||||
}
|
||||
|
||||
static zend_always_inline zend_uchar is_numeric_string(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors) {
|
||||
return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL);
|
||||
static zend_always_inline zend_uchar is_numeric_string(const char *str, size_t length, zend_long *lval, double *dval, bool allow_errors) {
|
||||
return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL, NULL);
|
||||
}
|
||||
|
||||
ZEND_API zend_uchar ZEND_FASTCALL is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval);
|
||||
|
||||
@@ -27,6 +27,12 @@ static ZEND_COLD void undef_result_after_exception() {
|
||||
}
|
||||
}
|
||||
|
||||
static ZEND_COLD void zend_jit_illegal_string_offset(zval *offset)
|
||||
{
|
||||
zend_type_error("Cannot access offset of type %s on string", zend_zval_type_name(offset));
|
||||
}
|
||||
|
||||
|
||||
static zend_never_inline zend_function* ZEND_FASTCALL _zend_jit_init_func_run_time_cache(const zend_op_array *op_array) /* {{{ */
|
||||
{
|
||||
void **run_time_cache;
|
||||
@@ -350,8 +356,8 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_r_helper(zend_array *ht, zval *dim,
|
||||
hval = 1;
|
||||
goto num_index;
|
||||
default:
|
||||
zend_type_error("Illegal offset type");
|
||||
ZVAL_NULL(result);
|
||||
zend_jit_illegal_string_offset(dim);
|
||||
undef_result_after_exception();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -422,8 +428,8 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_is_helper(zend_array *ht, zval *dim
|
||||
hval = 1;
|
||||
goto num_index;
|
||||
default:
|
||||
zend_type_error("Illegal offset type");
|
||||
ZVAL_NULL(result);
|
||||
zend_jit_illegal_string_offset(dim);
|
||||
undef_result_after_exception();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -560,7 +566,7 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_rw_helper(zend_array *ht, zval *di
|
||||
hval = 1;
|
||||
goto num_index;
|
||||
default:
|
||||
zend_type_error("Illegal offset type");
|
||||
zend_jit_illegal_string_offset(dim);
|
||||
undef_result_after_exception();
|
||||
return NULL;
|
||||
}
|
||||
@@ -641,7 +647,7 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim
|
||||
hval = 1;
|
||||
goto num_index;
|
||||
default:
|
||||
zend_type_error("Illegal offset type");
|
||||
zend_jit_illegal_string_offset(dim);
|
||||
undef_result_after_exception();
|
||||
return NULL;
|
||||
}
|
||||
@@ -677,13 +683,20 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_str_r_helper(zval *container, zval
|
||||
try_string_offset:
|
||||
if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
|
||||
switch (Z_TYPE_P(dim)) {
|
||||
/* case IS_LONG: */
|
||||
case IS_STRING:
|
||||
if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
|
||||
break;
|
||||
{
|
||||
bool trailing_data = false;
|
||||
/* For BC reasons we allow errors so that we can warn on leading numeric string */
|
||||
if (IS_LONG == is_numeric_string_ex(Z_STRVAL_P(dim), Z_STRLEN_P(dim), &offset, NULL,
|
||||
/* allow errors */ true, NULL, &trailing_data)) {
|
||||
if (UNEXPECTED(trailing_data)) {
|
||||
zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
|
||||
zend_jit_illegal_string_offset(dim);
|
||||
break;
|
||||
}
|
||||
case IS_UNDEF:
|
||||
zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
|
||||
case IS_DOUBLE:
|
||||
@@ -696,7 +709,7 @@ try_string_offset:
|
||||
dim = Z_REFVAL_P(dim);
|
||||
goto try_string_offset;
|
||||
default:
|
||||
zend_type_error("Illegal offset type");
|
||||
zend_jit_illegal_string_offset(dim);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -704,6 +717,7 @@ try_string_offset:
|
||||
} else {
|
||||
offset = Z_LVAL_P(dim);
|
||||
}
|
||||
out:
|
||||
|
||||
if (UNEXPECTED(Z_STRLEN_P(container) < ((offset < 0) ? -(size_t)offset : ((size_t)offset + 1)))) {
|
||||
zend_error(E_WARNING, "Uninitialized string offset " ZEND_LONG_FMT, offset);
|
||||
@@ -728,7 +742,7 @@ try_string_offset:
|
||||
switch (Z_TYPE_P(dim)) {
|
||||
/* case IS_LONG: */
|
||||
case IS_STRING:
|
||||
if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
|
||||
if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, false)) {
|
||||
break;
|
||||
}
|
||||
ZVAL_NULL(result);
|
||||
@@ -744,7 +758,7 @@ try_string_offset:
|
||||
dim = Z_REFVAL_P(dim);
|
||||
goto try_string_offset;
|
||||
default:
|
||||
zend_type_error("Illegal offset type");
|
||||
zend_jit_illegal_string_offset(dim);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -818,13 +832,19 @@ try_again:
|
||||
if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
|
||||
switch(Z_TYPE_P(dim)) {
|
||||
case IS_STRING:
|
||||
if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
|
||||
break;
|
||||
}
|
||||
if (type != BP_VAR_UNSET) {
|
||||
zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
|
||||
{
|
||||
bool trailing_data = false;
|
||||
/* For BC reasons we allow errors so that we can warn on leading numeric string */
|
||||
if (IS_LONG == is_numeric_string_ex(Z_STRVAL_P(dim), Z_STRLEN_P(dim), &offset, NULL,
|
||||
/* allow errors */ true, NULL, &trailing_data)) {
|
||||
if (UNEXPECTED(trailing_data) && type != BP_VAR_UNSET) {
|
||||
zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim));
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
zend_jit_illegal_string_offset(dim);
|
||||
break;
|
||||
}
|
||||
case IS_UNDEF:
|
||||
zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
|
||||
case IS_DOUBLE:
|
||||
@@ -837,7 +857,7 @@ try_again:
|
||||
dim = Z_REFVAL_P(dim);
|
||||
goto try_again;
|
||||
default:
|
||||
zend_type_error("Illegal offset type");
|
||||
zend_jit_illegal_string_offset(dim);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1173,7 +1193,7 @@ isset_str_offset:
|
||||
ZVAL_DEREF(offset);
|
||||
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|
||||
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
|
||||
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
|
||||
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, false))) {
|
||||
lval = zval_get_long(offset);
|
||||
goto isset_str_offset;
|
||||
}
|
||||
|
||||
@@ -11,12 +11,9 @@ opcache.optimization_level=0xFFFFBFFF
|
||||
define('E', 'E');
|
||||
define('R', 'R');
|
||||
define('See', 'See');
|
||||
0 & ~E & ~R;
|
||||
"0" & ~E & ~R;
|
||||
6 && ~See
|
||||
?>
|
||||
okey
|
||||
--EXPECTF--
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
--EXPECT--
|
||||
okey
|
||||
|
||||
@@ -20,10 +20,18 @@ function foo() {
|
||||
var_dump($a[false]);
|
||||
var_dump($a[true]);
|
||||
var_dump($a[null]);
|
||||
var_dump($a["ab"]);
|
||||
try {
|
||||
var_dump($a["ab"]);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
$x = "a";
|
||||
$y = "b";
|
||||
var_dump($a[$x . $y]);
|
||||
try {
|
||||
var_dump($a[$x . $y]);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
var_dump($a["2x"]);
|
||||
$x = "2";
|
||||
$y = "x";
|
||||
@@ -47,15 +55,11 @@ string(1) "B"
|
||||
|
||||
Warning: String offset cast occurred in %s on line %d
|
||||
string(1) "A"
|
||||
Cannot access offset of type string on string
|
||||
Cannot access offset of type string on string
|
||||
|
||||
Warning: Illegal string offset "ab" in %sfetch_dim_r_003.php on line 12
|
||||
string(1) "A"
|
||||
|
||||
Warning: Illegal string offset "ab" in %sfetch_dim_r_003.php on line 15
|
||||
string(1) "A"
|
||||
|
||||
Notice: A non well formed numeric value encountered in %sfetch_dim_r_003.php on line 16
|
||||
Warning: Illegal string offset "2x" in %sfetch_dim_r_003.php on line 24
|
||||
string(1) "C"
|
||||
|
||||
Notice: A non well formed numeric value encountered in %sfetch_dim_r_003.php on line 19
|
||||
Warning: Illegal string offset "2x" in %sfetch_dim_r_003.php on line 27
|
||||
string(1) "C"
|
||||
|
||||
@@ -12,7 +12,11 @@ opcache.jit_buffer_size=1M
|
||||
<?php
|
||||
function foo($n) {
|
||||
$a = "ABCDEF";
|
||||
var_dump($a[$n]);
|
||||
try {
|
||||
var_dump($a[$n]);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
}
|
||||
foo(0);
|
||||
foo(2);
|
||||
@@ -47,15 +51,11 @@ string(1) "B"
|
||||
|
||||
Warning: String offset cast occurred in %s on line %d
|
||||
string(1) "A"
|
||||
Cannot access offset of type string on string
|
||||
Cannot access offset of type string on string
|
||||
|
||||
Warning: Illegal string offset "ab" in %sfetch_dim_r_004.php on line 4
|
||||
string(1) "A"
|
||||
|
||||
Warning: Illegal string offset "ab" in %sfetch_dim_r_004.php on line 4
|
||||
string(1) "A"
|
||||
|
||||
Notice: A non well formed numeric value encountered in %sfetch_dim_r_004.php on line 4
|
||||
Warning: Illegal string offset "2x" in %sfetch_dim_r_004.php on line 5
|
||||
string(1) "C"
|
||||
|
||||
Notice: A non well formed numeric value encountered in %sfetch_dim_r_004.php on line 4
|
||||
Warning: Illegal string offset "2x" in %sfetch_dim_r_004.php on line 5
|
||||
string(1) "C"
|
||||
|
||||
+4
-4
@@ -2302,7 +2302,7 @@ static zval *row_prop_read(zend_object *object, zend_string *name, int type, voi
|
||||
|
||||
ZVAL_NULL(rv);
|
||||
if (stmt) {
|
||||
if (is_numeric_string_ex(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0, NULL) == IS_LONG) {
|
||||
if (is_numeric_string(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0) == IS_LONG) {
|
||||
if (lval >= 0 && lval < stmt->column_count) {
|
||||
fetch_value(stmt, rv, lval, NULL);
|
||||
}
|
||||
@@ -2340,7 +2340,7 @@ static zval *row_dim_read(zend_object *object, zval *member, int type, zval *rv)
|
||||
fetch_value(stmt, rv, Z_LVAL_P(member), NULL);
|
||||
}
|
||||
} else if (Z_TYPE_P(member) == IS_STRING
|
||||
&& is_numeric_string_ex(Z_STRVAL_P(member), Z_STRLEN_P(member), &lval, NULL, 0, NULL) == IS_LONG) {
|
||||
&& is_numeric_string(Z_STRVAL_P(member), Z_STRLEN_P(member), &lval, NULL, 0) == IS_LONG) {
|
||||
if (lval >= 0 && lval < stmt->column_count) {
|
||||
fetch_value(stmt, rv, lval, NULL);
|
||||
}
|
||||
@@ -2387,7 +2387,7 @@ static int row_prop_exists(zend_object *object, zend_string *name, int check_emp
|
||||
zend_long lval;
|
||||
|
||||
if (stmt) {
|
||||
if (is_numeric_string_ex(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0, NULL) == IS_LONG) {
|
||||
if (is_numeric_string(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0) == IS_LONG) {
|
||||
return lval >=0 && lval < stmt->column_count;
|
||||
}
|
||||
|
||||
@@ -2422,7 +2422,7 @@ static int row_dim_exists(zend_object *object, zval *member, int check_empty)
|
||||
if (Z_TYPE_P(member) == IS_LONG) {
|
||||
return Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count;
|
||||
} else if (Z_TYPE_P(member) == IS_STRING) {
|
||||
if (is_numeric_string_ex(Z_STRVAL_P(member), Z_STRLEN_P(member), &lval, NULL, 0, NULL) == IS_LONG) {
|
||||
if (is_numeric_string(Z_STRVAL_P(member), Z_STRLEN_P(member), &lval, NULL, 0) == IS_LONG) {
|
||||
return lval >=0 && lval < stmt->column_count;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Bug #76536 (PHP crashes with core dump when throwing exception in error handler)
|
||||
--FILE--
|
||||
<?php
|
||||
class SomeConstants {const SOME_CONSTANT = "foo" % 5; }
|
||||
class SomeConstants {const SOME_CONSTANT = "0foo" % 5; }
|
||||
|
||||
function handleError() {throw new ErrorException();}
|
||||
|
||||
|
||||
@@ -140,13 +140,13 @@ float(-5000000)
|
||||
|
||||
*** Testing floatval() on non floating types ***
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
float(-2147483648)
|
||||
float(2147483648)
|
||||
float(%d)
|
||||
float(%d)
|
||||
float(5)
|
||||
float(6)
|
||||
float(0)
|
||||
float(1)
|
||||
float(-1300)
|
||||
@@ -163,8 +163,8 @@ float(0)
|
||||
*** Testing doubleval() on non floating types ***
|
||||
float(-2147483648)
|
||||
float(2147483648)
|
||||
float(%d)
|
||||
float(%d)
|
||||
float(5)
|
||||
float(6)
|
||||
float(0)
|
||||
float(1)
|
||||
float(-1300)
|
||||
|
||||
@@ -45,9 +45,9 @@ foreach ($not_float_types as $key => $type ) {
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
|
||||
*** Testing floatval() on non floating types ***
|
||||
|
||||
@@ -58,10 +58,10 @@ float(-2147483648)
|
||||
float(2147483648)
|
||||
|
||||
-- Iteration : file resoruce --
|
||||
float(%d)
|
||||
float(5)
|
||||
|
||||
-- Iteration : directory resource --
|
||||
float(%d)
|
||||
float(6)
|
||||
|
||||
-- Iteration : "0.0" --
|
||||
float(0)
|
||||
@@ -108,10 +108,10 @@ float(-2147483648)
|
||||
float(2147483648)
|
||||
|
||||
-- Iteration : file resoruce --
|
||||
float(%d)
|
||||
float(5)
|
||||
|
||||
-- Iteration : directory resource --
|
||||
float(%d)
|
||||
float(6)
|
||||
|
||||
-- Iteration : "0.0" --
|
||||
float(0)
|
||||
|
||||
@@ -141,32 +141,22 @@ int(1)
|
||||
int(0)
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string ** int
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string ** int
|
||||
|
||||
-- Iteration 19 --
|
||||
Unsupported operand types: array ** int
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string ** int
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string ** int
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string ** int
|
||||
|
||||
-- Iteration 23 --
|
||||
Unsupported operand types: classA ** int
|
||||
@@ -178,4 +168,4 @@ int(0)
|
||||
int(0)
|
||||
|
||||
-- Iteration 26 --
|
||||
%s
|
||||
Unsupported operand types: resource ** int
|
||||
|
||||
@@ -89,7 +89,7 @@ foreach($inputs as $input) {
|
||||
};
|
||||
fclose($fp);
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
*** Testing pow() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
@@ -141,32 +141,22 @@ int(1)
|
||||
int(0)
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string ** int
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string ** int
|
||||
|
||||
-- Iteration 19 --
|
||||
Unsupported operand types: array ** int
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string ** int
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string ** int
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string ** int
|
||||
|
||||
-- Iteration 23 --
|
||||
Unsupported operand types: classA ** int
|
||||
@@ -178,4 +168,4 @@ int(0)
|
||||
int(0)
|
||||
|
||||
-- Iteration 26 --
|
||||
%s
|
||||
Unsupported operand types: resource ** int
|
||||
|
||||
@@ -85,7 +85,7 @@ foreach($inputs as $input) {
|
||||
};
|
||||
fclose($fp);
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
*** Testing pow() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
@@ -137,32 +137,22 @@ float(20.3)
|
||||
float(1)
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
float(1)
|
||||
Unsupported operand types: float ** string
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
float(1)
|
||||
Unsupported operand types: float ** string
|
||||
|
||||
-- Iteration 19 --
|
||||
Unsupported operand types: float ** array
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
float(1)
|
||||
Unsupported operand types: float ** string
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
float(1)
|
||||
Unsupported operand types: float ** string
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
float(1)
|
||||
Unsupported operand types: float ** string
|
||||
|
||||
-- Iteration 23 --
|
||||
Unsupported operand types: float ** classA
|
||||
@@ -174,4 +164,4 @@ float(1)
|
||||
float(1)
|
||||
|
||||
-- Iteration 26 --
|
||||
%s
|
||||
Unsupported operand types: float ** resource
|
||||
|
||||
@@ -26,7 +26,7 @@ class test3 {
|
||||
$my_var = str_repeat('A', 40);
|
||||
$out = substr_replace(array(&$my_var), array(new test1), 40, 0);
|
||||
var_dump($out, $my_var);
|
||||
$my_var = str_repeat('A', 40);
|
||||
$my_var = '0' . str_repeat('A', 39);
|
||||
$out = substr_replace(array(&$my_var), array(new test2), 40, 0);
|
||||
var_dump($out, $my_var);
|
||||
$my_var = str_repeat('A', 40);
|
||||
@@ -45,7 +45,7 @@ array(1) {
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(40) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
string(40) "0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
}
|
||||
int(134512640)
|
||||
array(1) {
|
||||
|
||||
@@ -5,11 +5,11 @@ Bug #19943 (memleaks)
|
||||
$ar = array();
|
||||
for ($count = 0; $count < 10; $count++) {
|
||||
$ar[$count] = "$count";
|
||||
@$ar[$count]['idx'] = "$count";
|
||||
@$ar[$count]['0idx'] = "$count";
|
||||
}
|
||||
|
||||
for ($count = 0; $count < 10; $count++) {
|
||||
echo $ar[$count]." -- ".@$ar[$count]['idx']."\n";
|
||||
echo $ar[$count]." -- ".@$ar[$count]['0idx']."\n";
|
||||
}
|
||||
$a = "0123456789";
|
||||
$a[9] = $a[0];
|
||||
|
||||
+12
-18
@@ -4,24 +4,18 @@ Bug #28800 (Incorrect string to number conversion for strings starting with 'inf
|
||||
<?php
|
||||
$strings = array('into', 'info', 'inf', 'infinity', 'infin', 'inflammable');
|
||||
foreach ($strings as $v) {
|
||||
echo ($v+0)."\n";
|
||||
try {
|
||||
echo ($v+0)."\n";
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
0
|
||||
--EXPECT--
|
||||
Unsupported operand types: string + int
|
||||
Unsupported operand types: string + int
|
||||
Unsupported operand types: string + int
|
||||
Unsupported operand types: string + int
|
||||
Unsupported operand types: string + int
|
||||
Unsupported operand types: string + int
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
0
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
0
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
0
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
0
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
0
|
||||
|
||||
@@ -7,10 +7,10 @@ $var="This is a string";
|
||||
$dummy="";
|
||||
unset($dummy);
|
||||
|
||||
foreach($var['nosuchkey'] as $v) {
|
||||
foreach($var['0nosuchkey'] as $v) {
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Illegal string offset "nosuchkey" in %s on line %d
|
||||
Warning: Illegal string offset "0nosuchkey" in %s on line %d
|
||||
|
||||
Warning: foreach() argument must be of type array|object, string given in %sbug29566.php on line %d
|
||||
|
||||
@@ -11,13 +11,16 @@ $strVals = array(
|
||||
error_reporting(E_ERROR);
|
||||
|
||||
foreach ($strVals as $strVal) {
|
||||
foreach($strVals as $otherVal) {
|
||||
echo "--- testing: '$strVal' + '$otherVal' ---\n";
|
||||
var_dump($strVal+$otherVal);
|
||||
}
|
||||
foreach($strVals as $otherVal) {
|
||||
echo "--- testing: '$strVal' + '$otherVal' ---\n";
|
||||
try {
|
||||
var_dump($strVal+$otherVal);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--- testing: '0' + '0' ---
|
||||
@@ -31,7 +34,7 @@ float(1.2)
|
||||
--- testing: '0' + '-7.7' ---
|
||||
float(-7.7)
|
||||
--- testing: '0' + 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '0' + '123abc' ---
|
||||
int(123)
|
||||
--- testing: '0' + '123e5' ---
|
||||
@@ -47,7 +50,7 @@ int(123)
|
||||
--- testing: '0' + '3.4a' ---
|
||||
float(3.4)
|
||||
--- testing: '0' + 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '65' + '0' ---
|
||||
int(65)
|
||||
--- testing: '65' + '65' ---
|
||||
@@ -59,7 +62,7 @@ float(66.2)
|
||||
--- testing: '65' + '-7.7' ---
|
||||
float(57.3)
|
||||
--- testing: '65' + 'abc' ---
|
||||
int(65)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '65' + '123abc' ---
|
||||
int(188)
|
||||
--- testing: '65' + '123e5' ---
|
||||
@@ -75,7 +78,7 @@ int(188)
|
||||
--- testing: '65' + '3.4a' ---
|
||||
float(68.4)
|
||||
--- testing: '65' + 'a5.9' ---
|
||||
int(65)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '-44' + '0' ---
|
||||
int(-44)
|
||||
--- testing: '-44' + '65' ---
|
||||
@@ -87,7 +90,7 @@ float(-42.8)
|
||||
--- testing: '-44' + '-7.7' ---
|
||||
float(-51.7)
|
||||
--- testing: '-44' + 'abc' ---
|
||||
int(-44)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '-44' + '123abc' ---
|
||||
int(79)
|
||||
--- testing: '-44' + '123e5' ---
|
||||
@@ -103,7 +106,7 @@ int(79)
|
||||
--- testing: '-44' + '3.4a' ---
|
||||
float(-40.6)
|
||||
--- testing: '-44' + 'a5.9' ---
|
||||
int(-44)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '1.2' + '0' ---
|
||||
float(1.2)
|
||||
--- testing: '1.2' + '65' ---
|
||||
@@ -115,7 +118,7 @@ float(2.4)
|
||||
--- testing: '1.2' + '-7.7' ---
|
||||
float(-6.5)
|
||||
--- testing: '1.2' + 'abc' ---
|
||||
float(1.2)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '1.2' + '123abc' ---
|
||||
float(124.2)
|
||||
--- testing: '1.2' + '123e5' ---
|
||||
@@ -131,7 +134,7 @@ float(124.2)
|
||||
--- testing: '1.2' + '3.4a' ---
|
||||
float(4.6)
|
||||
--- testing: '1.2' + 'a5.9' ---
|
||||
float(1.2)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '-7.7' + '0' ---
|
||||
float(-7.7)
|
||||
--- testing: '-7.7' + '65' ---
|
||||
@@ -143,7 +146,7 @@ float(-6.5)
|
||||
--- testing: '-7.7' + '-7.7' ---
|
||||
float(-15.4)
|
||||
--- testing: '-7.7' + 'abc' ---
|
||||
float(-7.7)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '-7.7' + '123abc' ---
|
||||
float(115.3)
|
||||
--- testing: '-7.7' + '123e5' ---
|
||||
@@ -159,35 +162,35 @@ float(115.3)
|
||||
--- testing: '-7.7' + '3.4a' ---
|
||||
float(-4.300000000000001)
|
||||
--- testing: '-7.7' + 'a5.9' ---
|
||||
float(-7.7)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + '0' ---
|
||||
int(0)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + '65' ---
|
||||
int(65)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + '-44' ---
|
||||
int(-44)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + '1.2' ---
|
||||
float(1.2)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + '-7.7' ---
|
||||
float(-7.7)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + '123abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + '123e5' ---
|
||||
float(12300000)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + '123e5xyz' ---
|
||||
float(12300000)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + ' 123abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + '123 abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + '123abc ' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + '3.4a' ---
|
||||
float(3.4)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'abc' + 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '123abc' + '0' ---
|
||||
int(123)
|
||||
--- testing: '123abc' + '65' ---
|
||||
@@ -199,7 +202,7 @@ float(124.2)
|
||||
--- testing: '123abc' + '-7.7' ---
|
||||
float(115.3)
|
||||
--- testing: '123abc' + 'abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '123abc' + '123abc' ---
|
||||
int(246)
|
||||
--- testing: '123abc' + '123e5' ---
|
||||
@@ -215,7 +218,7 @@ int(246)
|
||||
--- testing: '123abc' + '3.4a' ---
|
||||
float(126.4)
|
||||
--- testing: '123abc' + 'a5.9' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '123e5' + '0' ---
|
||||
float(12300000)
|
||||
--- testing: '123e5' + '65' ---
|
||||
@@ -227,7 +230,7 @@ float(12300001.2)
|
||||
--- testing: '123e5' + '-7.7' ---
|
||||
float(12299992.3)
|
||||
--- testing: '123e5' + 'abc' ---
|
||||
float(12300000)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '123e5' + '123abc' ---
|
||||
float(12300123)
|
||||
--- testing: '123e5' + '123e5' ---
|
||||
@@ -243,7 +246,7 @@ float(12300123)
|
||||
--- testing: '123e5' + '3.4a' ---
|
||||
float(12300003.4)
|
||||
--- testing: '123e5' + 'a5.9' ---
|
||||
float(12300000)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '123e5xyz' + '0' ---
|
||||
float(12300000)
|
||||
--- testing: '123e5xyz' + '65' ---
|
||||
@@ -255,7 +258,7 @@ float(12300001.2)
|
||||
--- testing: '123e5xyz' + '-7.7' ---
|
||||
float(12299992.3)
|
||||
--- testing: '123e5xyz' + 'abc' ---
|
||||
float(12300000)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '123e5xyz' + '123abc' ---
|
||||
float(12300123)
|
||||
--- testing: '123e5xyz' + '123e5' ---
|
||||
@@ -271,7 +274,7 @@ float(12300123)
|
||||
--- testing: '123e5xyz' + '3.4a' ---
|
||||
float(12300003.4)
|
||||
--- testing: '123e5xyz' + 'a5.9' ---
|
||||
float(12300000)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: ' 123abc' + '0' ---
|
||||
int(123)
|
||||
--- testing: ' 123abc' + '65' ---
|
||||
@@ -283,7 +286,7 @@ float(124.2)
|
||||
--- testing: ' 123abc' + '-7.7' ---
|
||||
float(115.3)
|
||||
--- testing: ' 123abc' + 'abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: ' 123abc' + '123abc' ---
|
||||
int(246)
|
||||
--- testing: ' 123abc' + '123e5' ---
|
||||
@@ -299,7 +302,7 @@ int(246)
|
||||
--- testing: ' 123abc' + '3.4a' ---
|
||||
float(126.4)
|
||||
--- testing: ' 123abc' + 'a5.9' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '123 abc' + '0' ---
|
||||
int(123)
|
||||
--- testing: '123 abc' + '65' ---
|
||||
@@ -311,7 +314,7 @@ float(124.2)
|
||||
--- testing: '123 abc' + '-7.7' ---
|
||||
float(115.3)
|
||||
--- testing: '123 abc' + 'abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '123 abc' + '123abc' ---
|
||||
int(246)
|
||||
--- testing: '123 abc' + '123e5' ---
|
||||
@@ -327,7 +330,7 @@ int(246)
|
||||
--- testing: '123 abc' + '3.4a' ---
|
||||
float(126.4)
|
||||
--- testing: '123 abc' + 'a5.9' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '123abc ' + '0' ---
|
||||
int(123)
|
||||
--- testing: '123abc ' + '65' ---
|
||||
@@ -339,7 +342,7 @@ float(124.2)
|
||||
--- testing: '123abc ' + '-7.7' ---
|
||||
float(115.3)
|
||||
--- testing: '123abc ' + 'abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '123abc ' + '123abc' ---
|
||||
int(246)
|
||||
--- testing: '123abc ' + '123e5' ---
|
||||
@@ -355,7 +358,7 @@ int(246)
|
||||
--- testing: '123abc ' + '3.4a' ---
|
||||
float(126.4)
|
||||
--- testing: '123abc ' + 'a5.9' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '3.4a' + '0' ---
|
||||
float(3.4)
|
||||
--- testing: '3.4a' + '65' ---
|
||||
@@ -367,7 +370,7 @@ float(4.6)
|
||||
--- testing: '3.4a' + '-7.7' ---
|
||||
float(-4.300000000000001)
|
||||
--- testing: '3.4a' + 'abc' ---
|
||||
float(3.4)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: '3.4a' + '123abc' ---
|
||||
float(126.4)
|
||||
--- testing: '3.4a' + '123e5' ---
|
||||
@@ -383,32 +386,32 @@ float(126.4)
|
||||
--- testing: '3.4a' + '3.4a' ---
|
||||
float(6.8)
|
||||
--- testing: '3.4a' + 'a5.9' ---
|
||||
float(3.4)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + '0' ---
|
||||
int(0)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + '65' ---
|
||||
int(65)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + '-44' ---
|
||||
int(-44)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + '1.2' ---
|
||||
float(1.2)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + '-7.7' ---
|
||||
float(-7.7)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + '123abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + '123e5' ---
|
||||
float(12300000)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + '123e5xyz' ---
|
||||
float(12300000)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + ' 123abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + '123 abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + '123abc ' ---
|
||||
int(123)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + '3.4a' ---
|
||||
float(3.4)
|
||||
Unsupported operand types: string + string
|
||||
--- testing: 'a5.9' + 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string + string
|
||||
|
||||
@@ -16,7 +16,7 @@ foreach ($strVals as $strVal) {
|
||||
try {
|
||||
var_dump($strVal<<$otherVal);
|
||||
} catch (Throwable $e) {
|
||||
echo "Exception: " . $e->getMessage() . "\n";
|
||||
echo get_class($e) . ': ' . $e->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,13 +28,13 @@ int(0)
|
||||
--- testing: '0' << '65' ---
|
||||
int(0)
|
||||
--- testing: '0' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '0' << '1.2' ---
|
||||
int(0)
|
||||
--- testing: '0' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '0' << 'abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '0' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '0' << '123e5' ---
|
||||
@@ -50,19 +50,19 @@ int(0)
|
||||
--- testing: '0' << '3.4a' ---
|
||||
int(0)
|
||||
--- testing: '0' << 'a5.9' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '65' << '0' ---
|
||||
int(65)
|
||||
--- testing: '65' << '65' ---
|
||||
int(0)
|
||||
--- testing: '65' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '65' << '1.2' ---
|
||||
int(130)
|
||||
--- testing: '65' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '65' << 'abc' ---
|
||||
int(65)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '65' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '65' << '123e5' ---
|
||||
@@ -78,19 +78,19 @@ int(0)
|
||||
--- testing: '65' << '3.4a' ---
|
||||
int(520)
|
||||
--- testing: '65' << 'a5.9' ---
|
||||
int(65)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '-44' << '0' ---
|
||||
int(-44)
|
||||
--- testing: '-44' << '65' ---
|
||||
int(0)
|
||||
--- testing: '-44' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '-44' << '1.2' ---
|
||||
int(-88)
|
||||
--- testing: '-44' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '-44' << 'abc' ---
|
||||
int(-44)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '-44' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '-44' << '123e5' ---
|
||||
@@ -106,19 +106,19 @@ int(0)
|
||||
--- testing: '-44' << '3.4a' ---
|
||||
int(-352)
|
||||
--- testing: '-44' << 'a5.9' ---
|
||||
int(-44)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '1.2' << '0' ---
|
||||
int(1)
|
||||
--- testing: '1.2' << '65' ---
|
||||
int(0)
|
||||
--- testing: '1.2' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '1.2' << '1.2' ---
|
||||
int(2)
|
||||
--- testing: '1.2' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '1.2' << 'abc' ---
|
||||
int(1)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '1.2' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '1.2' << '123e5' ---
|
||||
@@ -134,19 +134,19 @@ int(0)
|
||||
--- testing: '1.2' << '3.4a' ---
|
||||
int(8)
|
||||
--- testing: '1.2' << 'a5.9' ---
|
||||
int(1)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '-7.7' << '0' ---
|
||||
int(-7)
|
||||
--- testing: '-7.7' << '65' ---
|
||||
int(0)
|
||||
--- testing: '-7.7' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '-7.7' << '1.2' ---
|
||||
int(-14)
|
||||
--- testing: '-7.7' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '-7.7' << 'abc' ---
|
||||
int(-7)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '-7.7' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '-7.7' << '123e5' ---
|
||||
@@ -162,47 +162,47 @@ int(0)
|
||||
--- testing: '-7.7' << '3.4a' ---
|
||||
int(-56)
|
||||
--- testing: '-7.7' << 'a5.9' ---
|
||||
int(-7)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '0' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '65' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '1.2' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << 'abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '123e5' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '123e5xyz' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << ' 123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '123 abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '123abc ' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '3.4a' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << 'a5.9' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123abc' << '0' ---
|
||||
int(123)
|
||||
--- testing: '123abc' << '65' ---
|
||||
int(0)
|
||||
--- testing: '123abc' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123abc' << '1.2' ---
|
||||
int(246)
|
||||
--- testing: '123abc' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123abc' << 'abc' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123abc' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123abc' << '123e5' ---
|
||||
@@ -218,19 +218,19 @@ int(0)
|
||||
--- testing: '123abc' << '3.4a' ---
|
||||
int(984)
|
||||
--- testing: '123abc' << 'a5.9' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123e5' << '0' ---
|
||||
int(12300000)
|
||||
--- testing: '123e5' << '65' ---
|
||||
int(0)
|
||||
--- testing: '123e5' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123e5' << '1.2' ---
|
||||
int(24600000)
|
||||
--- testing: '123e5' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123e5' << 'abc' ---
|
||||
int(12300000)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123e5' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123e5' << '123e5' ---
|
||||
@@ -246,19 +246,19 @@ int(0)
|
||||
--- testing: '123e5' << '3.4a' ---
|
||||
int(98400000)
|
||||
--- testing: '123e5' << 'a5.9' ---
|
||||
int(12300000)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123e5xyz' << '0' ---
|
||||
int(12300000)
|
||||
--- testing: '123e5xyz' << '65' ---
|
||||
int(0)
|
||||
--- testing: '123e5xyz' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123e5xyz' << '1.2' ---
|
||||
int(24600000)
|
||||
--- testing: '123e5xyz' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123e5xyz' << 'abc' ---
|
||||
int(12300000)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123e5xyz' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123e5xyz' << '123e5' ---
|
||||
@@ -274,19 +274,19 @@ int(0)
|
||||
--- testing: '123e5xyz' << '3.4a' ---
|
||||
int(98400000)
|
||||
--- testing: '123e5xyz' << 'a5.9' ---
|
||||
int(12300000)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: ' 123abc' << '0' ---
|
||||
int(123)
|
||||
--- testing: ' 123abc' << '65' ---
|
||||
int(0)
|
||||
--- testing: ' 123abc' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: ' 123abc' << '1.2' ---
|
||||
int(246)
|
||||
--- testing: ' 123abc' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: ' 123abc' << 'abc' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: ' 123abc' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: ' 123abc' << '123e5' ---
|
||||
@@ -302,19 +302,19 @@ int(0)
|
||||
--- testing: ' 123abc' << '3.4a' ---
|
||||
int(984)
|
||||
--- testing: ' 123abc' << 'a5.9' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123 abc' << '0' ---
|
||||
int(123)
|
||||
--- testing: '123 abc' << '65' ---
|
||||
int(0)
|
||||
--- testing: '123 abc' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123 abc' << '1.2' ---
|
||||
int(246)
|
||||
--- testing: '123 abc' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123 abc' << 'abc' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123 abc' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123 abc' << '123e5' ---
|
||||
@@ -330,19 +330,19 @@ int(0)
|
||||
--- testing: '123 abc' << '3.4a' ---
|
||||
int(984)
|
||||
--- testing: '123 abc' << 'a5.9' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123abc ' << '0' ---
|
||||
int(123)
|
||||
--- testing: '123abc ' << '65' ---
|
||||
int(0)
|
||||
--- testing: '123abc ' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123abc ' << '1.2' ---
|
||||
int(246)
|
||||
--- testing: '123abc ' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123abc ' << 'abc' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123abc ' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123abc ' << '123e5' ---
|
||||
@@ -358,19 +358,19 @@ int(0)
|
||||
--- testing: '123abc ' << '3.4a' ---
|
||||
int(984)
|
||||
--- testing: '123abc ' << 'a5.9' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '3.4a' << '0' ---
|
||||
int(3)
|
||||
--- testing: '3.4a' << '65' ---
|
||||
int(0)
|
||||
--- testing: '3.4a' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '3.4a' << '1.2' ---
|
||||
int(6)
|
||||
--- testing: '3.4a' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '3.4a' << 'abc' ---
|
||||
int(3)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '3.4a' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '3.4a' << '123e5' ---
|
||||
@@ -386,32 +386,32 @@ int(0)
|
||||
--- testing: '3.4a' << '3.4a' ---
|
||||
int(24)
|
||||
--- testing: '3.4a' << 'a5.9' ---
|
||||
int(3)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '0' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '65' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '1.2' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << 'abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '123e5' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '123e5xyz' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << ' 123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '123 abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '123abc ' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '3.4a' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << 'a5.9' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
|
||||
@@ -19,8 +19,8 @@ foreach ($strVals as $strVal) {
|
||||
echo "--- testing: '$strVal' << '$otherVal' ---\n";
|
||||
try {
|
||||
var_dump($strVal<<$otherVal);
|
||||
} catch (ArithmeticError $e) {
|
||||
echo "Exception: " . $e->getMessage() . "\n";
|
||||
} catch (\Throwable $e) {
|
||||
echo get_class($e) . ': ' . $e->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,13 +33,13 @@ int(0)
|
||||
--- testing: '0' << '65' ---
|
||||
int(0)
|
||||
--- testing: '0' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '0' << '1.2' ---
|
||||
int(0)
|
||||
--- testing: '0' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '0' << 'abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '0' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '0' << '123e5' ---
|
||||
@@ -55,19 +55,19 @@ int(0)
|
||||
--- testing: '0' << '3.4a' ---
|
||||
int(0)
|
||||
--- testing: '0' << 'a5.9' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '65' << '0' ---
|
||||
int(65)
|
||||
--- testing: '65' << '65' ---
|
||||
int(0)
|
||||
--- testing: '65' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '65' << '1.2' ---
|
||||
int(130)
|
||||
--- testing: '65' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '65' << 'abc' ---
|
||||
int(65)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '65' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '65' << '123e5' ---
|
||||
@@ -83,19 +83,19 @@ int(0)
|
||||
--- testing: '65' << '3.4a' ---
|
||||
int(520)
|
||||
--- testing: '65' << 'a5.9' ---
|
||||
int(65)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '-44' << '0' ---
|
||||
int(-44)
|
||||
--- testing: '-44' << '65' ---
|
||||
int(0)
|
||||
--- testing: '-44' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '-44' << '1.2' ---
|
||||
int(-88)
|
||||
--- testing: '-44' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '-44' << 'abc' ---
|
||||
int(-44)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '-44' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '-44' << '123e5' ---
|
||||
@@ -111,19 +111,19 @@ int(0)
|
||||
--- testing: '-44' << '3.4a' ---
|
||||
int(-352)
|
||||
--- testing: '-44' << 'a5.9' ---
|
||||
int(-44)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '1.2' << '0' ---
|
||||
int(1)
|
||||
--- testing: '1.2' << '65' ---
|
||||
int(0)
|
||||
--- testing: '1.2' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '1.2' << '1.2' ---
|
||||
int(2)
|
||||
--- testing: '1.2' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '1.2' << 'abc' ---
|
||||
int(1)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '1.2' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '1.2' << '123e5' ---
|
||||
@@ -139,19 +139,19 @@ int(0)
|
||||
--- testing: '1.2' << '3.4a' ---
|
||||
int(8)
|
||||
--- testing: '1.2' << 'a5.9' ---
|
||||
int(1)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '-7.7' << '0' ---
|
||||
int(-7)
|
||||
--- testing: '-7.7' << '65' ---
|
||||
int(0)
|
||||
--- testing: '-7.7' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '-7.7' << '1.2' ---
|
||||
int(-14)
|
||||
--- testing: '-7.7' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '-7.7' << 'abc' ---
|
||||
int(-7)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '-7.7' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '-7.7' << '123e5' ---
|
||||
@@ -167,47 +167,47 @@ int(0)
|
||||
--- testing: '-7.7' << '3.4a' ---
|
||||
int(-56)
|
||||
--- testing: '-7.7' << 'a5.9' ---
|
||||
int(-7)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '0' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '65' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '1.2' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << 'abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '123e5' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '123e5xyz' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << ' 123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '123 abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '123abc ' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << '3.4a' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'abc' << 'a5.9' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123abc' << '0' ---
|
||||
int(123)
|
||||
--- testing: '123abc' << '65' ---
|
||||
int(0)
|
||||
--- testing: '123abc' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123abc' << '1.2' ---
|
||||
int(246)
|
||||
--- testing: '123abc' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123abc' << 'abc' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123abc' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123abc' << '123e5' ---
|
||||
@@ -223,19 +223,19 @@ int(0)
|
||||
--- testing: '123abc' << '3.4a' ---
|
||||
int(984)
|
||||
--- testing: '123abc' << 'a5.9' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123e5' << '0' ---
|
||||
int(12300000)
|
||||
--- testing: '123e5' << '65' ---
|
||||
int(0)
|
||||
--- testing: '123e5' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123e5' << '1.2' ---
|
||||
int(24600000)
|
||||
--- testing: '123e5' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123e5' << 'abc' ---
|
||||
int(12300000)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123e5' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123e5' << '123e5' ---
|
||||
@@ -251,19 +251,19 @@ int(0)
|
||||
--- testing: '123e5' << '3.4a' ---
|
||||
int(98400000)
|
||||
--- testing: '123e5' << 'a5.9' ---
|
||||
int(12300000)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123e5xyz' << '0' ---
|
||||
int(12300000)
|
||||
--- testing: '123e5xyz' << '65' ---
|
||||
int(0)
|
||||
--- testing: '123e5xyz' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123e5xyz' << '1.2' ---
|
||||
int(24600000)
|
||||
--- testing: '123e5xyz' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123e5xyz' << 'abc' ---
|
||||
int(12300000)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123e5xyz' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123e5xyz' << '123e5' ---
|
||||
@@ -279,19 +279,19 @@ int(0)
|
||||
--- testing: '123e5xyz' << '3.4a' ---
|
||||
int(98400000)
|
||||
--- testing: '123e5xyz' << 'a5.9' ---
|
||||
int(12300000)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: ' 123abc' << '0' ---
|
||||
int(123)
|
||||
--- testing: ' 123abc' << '65' ---
|
||||
int(0)
|
||||
--- testing: ' 123abc' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: ' 123abc' << '1.2' ---
|
||||
int(246)
|
||||
--- testing: ' 123abc' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: ' 123abc' << 'abc' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: ' 123abc' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: ' 123abc' << '123e5' ---
|
||||
@@ -307,19 +307,19 @@ int(0)
|
||||
--- testing: ' 123abc' << '3.4a' ---
|
||||
int(984)
|
||||
--- testing: ' 123abc' << 'a5.9' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123 abc' << '0' ---
|
||||
int(123)
|
||||
--- testing: '123 abc' << '65' ---
|
||||
int(0)
|
||||
--- testing: '123 abc' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123 abc' << '1.2' ---
|
||||
int(246)
|
||||
--- testing: '123 abc' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123 abc' << 'abc' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123 abc' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123 abc' << '123e5' ---
|
||||
@@ -335,19 +335,19 @@ int(0)
|
||||
--- testing: '123 abc' << '3.4a' ---
|
||||
int(984)
|
||||
--- testing: '123 abc' << 'a5.9' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123abc ' << '0' ---
|
||||
int(123)
|
||||
--- testing: '123abc ' << '65' ---
|
||||
int(0)
|
||||
--- testing: '123abc ' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123abc ' << '1.2' ---
|
||||
int(246)
|
||||
--- testing: '123abc ' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123abc ' << 'abc' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '123abc ' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123abc ' << '123e5' ---
|
||||
@@ -363,19 +363,19 @@ int(0)
|
||||
--- testing: '123abc ' << '3.4a' ---
|
||||
int(984)
|
||||
--- testing: '123abc ' << 'a5.9' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '3.4a' << '0' ---
|
||||
int(3)
|
||||
--- testing: '3.4a' << '65' ---
|
||||
int(0)
|
||||
--- testing: '3.4a' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '3.4a' << '1.2' ---
|
||||
int(6)
|
||||
--- testing: '3.4a' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '3.4a' << 'abc' ---
|
||||
int(3)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: '3.4a' << '123abc' ---
|
||||
int(0)
|
||||
--- testing: '3.4a' << '123e5' ---
|
||||
@@ -391,32 +391,32 @@ int(0)
|
||||
--- testing: '3.4a' << '3.4a' ---
|
||||
int(24)
|
||||
--- testing: '3.4a' << 'a5.9' ---
|
||||
int(3)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '0' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '65' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '1.2' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << 'abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '123e5' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '123e5xyz' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << ' 123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '123 abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '123abc ' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << '3.4a' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
--- testing: 'a5.9' << 'a5.9' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string << string
|
||||
|
||||
@@ -15,8 +15,8 @@ foreach ($strVals as $strVal) {
|
||||
echo "--- testing: '$strVal' >> '$otherVal' ---\n";
|
||||
try {
|
||||
var_dump($strVal>>$otherVal);
|
||||
} catch (ArithmeticError $e) {
|
||||
echo "Exception: " . $e->getMessage() . "\n";
|
||||
} catch (\Throwable $e) {
|
||||
echo get_class($e) . ': ' . $e->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,13 +29,13 @@ int(0)
|
||||
--- testing: '0' >> '65' ---
|
||||
int(0)
|
||||
--- testing: '0' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '0' >> '1.2' ---
|
||||
int(0)
|
||||
--- testing: '0' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '0' >> 'abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '0' >> '123abc' ---
|
||||
int(0)
|
||||
--- testing: '0' >> '123e5' ---
|
||||
@@ -51,19 +51,19 @@ int(0)
|
||||
--- testing: '0' >> '3.4a' ---
|
||||
int(0)
|
||||
--- testing: '0' >> 'a5.9' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '65' >> '0' ---
|
||||
int(65)
|
||||
--- testing: '65' >> '65' ---
|
||||
int(0)
|
||||
--- testing: '65' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '65' >> '1.2' ---
|
||||
int(32)
|
||||
--- testing: '65' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '65' >> 'abc' ---
|
||||
int(65)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '65' >> '123abc' ---
|
||||
int(0)
|
||||
--- testing: '65' >> '123e5' ---
|
||||
@@ -79,19 +79,19 @@ int(0)
|
||||
--- testing: '65' >> '3.4a' ---
|
||||
int(8)
|
||||
--- testing: '65' >> 'a5.9' ---
|
||||
int(65)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '-44' >> '0' ---
|
||||
int(-44)
|
||||
--- testing: '-44' >> '65' ---
|
||||
int(-1)
|
||||
--- testing: '-44' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '-44' >> '1.2' ---
|
||||
int(-22)
|
||||
--- testing: '-44' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '-44' >> 'abc' ---
|
||||
int(-44)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '-44' >> '123abc' ---
|
||||
int(-1)
|
||||
--- testing: '-44' >> '123e5' ---
|
||||
@@ -107,19 +107,19 @@ int(-1)
|
||||
--- testing: '-44' >> '3.4a' ---
|
||||
int(-6)
|
||||
--- testing: '-44' >> 'a5.9' ---
|
||||
int(-44)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '1.2' >> '0' ---
|
||||
int(1)
|
||||
--- testing: '1.2' >> '65' ---
|
||||
int(0)
|
||||
--- testing: '1.2' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '1.2' >> '1.2' ---
|
||||
int(0)
|
||||
--- testing: '1.2' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '1.2' >> 'abc' ---
|
||||
int(1)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '1.2' >> '123abc' ---
|
||||
int(0)
|
||||
--- testing: '1.2' >> '123e5' ---
|
||||
@@ -135,19 +135,19 @@ int(0)
|
||||
--- testing: '1.2' >> '3.4a' ---
|
||||
int(0)
|
||||
--- testing: '1.2' >> 'a5.9' ---
|
||||
int(1)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '-7.7' >> '0' ---
|
||||
int(-7)
|
||||
--- testing: '-7.7' >> '65' ---
|
||||
int(-1)
|
||||
--- testing: '-7.7' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '-7.7' >> '1.2' ---
|
||||
int(-4)
|
||||
--- testing: '-7.7' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '-7.7' >> 'abc' ---
|
||||
int(-7)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '-7.7' >> '123abc' ---
|
||||
int(-1)
|
||||
--- testing: '-7.7' >> '123e5' ---
|
||||
@@ -163,47 +163,47 @@ int(-1)
|
||||
--- testing: '-7.7' >> '3.4a' ---
|
||||
int(-1)
|
||||
--- testing: '-7.7' >> 'a5.9' ---
|
||||
int(-7)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> '0' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> '65' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> '1.2' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> 'abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> '123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> '123e5' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> '123e5xyz' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> ' 123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> '123 abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> '123abc ' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> '3.4a' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'abc' >> 'a5.9' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '123abc' >> '0' ---
|
||||
int(123)
|
||||
--- testing: '123abc' >> '65' ---
|
||||
int(0)
|
||||
--- testing: '123abc' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123abc' >> '1.2' ---
|
||||
int(61)
|
||||
--- testing: '123abc' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123abc' >> 'abc' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '123abc' >> '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123abc' >> '123e5' ---
|
||||
@@ -219,19 +219,19 @@ int(0)
|
||||
--- testing: '123abc' >> '3.4a' ---
|
||||
int(15)
|
||||
--- testing: '123abc' >> 'a5.9' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '123e5' >> '0' ---
|
||||
int(12300000)
|
||||
--- testing: '123e5' >> '65' ---
|
||||
int(0)
|
||||
--- testing: '123e5' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123e5' >> '1.2' ---
|
||||
int(6150000)
|
||||
--- testing: '123e5' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123e5' >> 'abc' ---
|
||||
int(12300000)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '123e5' >> '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123e5' >> '123e5' ---
|
||||
@@ -247,19 +247,19 @@ int(0)
|
||||
--- testing: '123e5' >> '3.4a' ---
|
||||
int(1537500)
|
||||
--- testing: '123e5' >> 'a5.9' ---
|
||||
int(12300000)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '123e5xyz' >> '0' ---
|
||||
int(12300000)
|
||||
--- testing: '123e5xyz' >> '65' ---
|
||||
int(0)
|
||||
--- testing: '123e5xyz' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123e5xyz' >> '1.2' ---
|
||||
int(6150000)
|
||||
--- testing: '123e5xyz' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123e5xyz' >> 'abc' ---
|
||||
int(12300000)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '123e5xyz' >> '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123e5xyz' >> '123e5' ---
|
||||
@@ -275,19 +275,19 @@ int(0)
|
||||
--- testing: '123e5xyz' >> '3.4a' ---
|
||||
int(1537500)
|
||||
--- testing: '123e5xyz' >> 'a5.9' ---
|
||||
int(12300000)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: ' 123abc' >> '0' ---
|
||||
int(123)
|
||||
--- testing: ' 123abc' >> '65' ---
|
||||
int(0)
|
||||
--- testing: ' 123abc' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: ' 123abc' >> '1.2' ---
|
||||
int(61)
|
||||
--- testing: ' 123abc' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: ' 123abc' >> 'abc' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: ' 123abc' >> '123abc' ---
|
||||
int(0)
|
||||
--- testing: ' 123abc' >> '123e5' ---
|
||||
@@ -303,19 +303,19 @@ int(0)
|
||||
--- testing: ' 123abc' >> '3.4a' ---
|
||||
int(15)
|
||||
--- testing: ' 123abc' >> 'a5.9' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '123 abc' >> '0' ---
|
||||
int(123)
|
||||
--- testing: '123 abc' >> '65' ---
|
||||
int(0)
|
||||
--- testing: '123 abc' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123 abc' >> '1.2' ---
|
||||
int(61)
|
||||
--- testing: '123 abc' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123 abc' >> 'abc' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '123 abc' >> '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123 abc' >> '123e5' ---
|
||||
@@ -331,19 +331,19 @@ int(0)
|
||||
--- testing: '123 abc' >> '3.4a' ---
|
||||
int(15)
|
||||
--- testing: '123 abc' >> 'a5.9' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '123abc ' >> '0' ---
|
||||
int(123)
|
||||
--- testing: '123abc ' >> '65' ---
|
||||
int(0)
|
||||
--- testing: '123abc ' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123abc ' >> '1.2' ---
|
||||
int(61)
|
||||
--- testing: '123abc ' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '123abc ' >> 'abc' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '123abc ' >> '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123abc ' >> '123e5' ---
|
||||
@@ -359,19 +359,19 @@ int(0)
|
||||
--- testing: '123abc ' >> '3.4a' ---
|
||||
int(15)
|
||||
--- testing: '123abc ' >> 'a5.9' ---
|
||||
int(123)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '3.4a' >> '0' ---
|
||||
int(3)
|
||||
--- testing: '3.4a' >> '65' ---
|
||||
int(0)
|
||||
--- testing: '3.4a' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '3.4a' >> '1.2' ---
|
||||
int(1)
|
||||
--- testing: '3.4a' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
ArithmeticError: Bit shift by negative number
|
||||
--- testing: '3.4a' >> 'abc' ---
|
||||
int(3)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: '3.4a' >> '123abc' ---
|
||||
int(0)
|
||||
--- testing: '3.4a' >> '123e5' ---
|
||||
@@ -387,32 +387,32 @@ int(0)
|
||||
--- testing: '3.4a' >> '3.4a' ---
|
||||
int(0)
|
||||
--- testing: '3.4a' >> 'a5.9' ---
|
||||
int(3)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> '0' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> '65' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> '-44' ---
|
||||
Exception: Bit shift by negative number
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> '1.2' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> '-7.7' ---
|
||||
Exception: Bit shift by negative number
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> 'abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> '123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> '123e5' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> '123e5xyz' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> ' 123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> '123 abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> '123abc ' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> '3.4a' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
--- testing: 'a5.9' >> 'a5.9' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string >> string
|
||||
|
||||
@@ -11,404 +11,408 @@ $strVals = array(
|
||||
error_reporting(E_ERROR);
|
||||
|
||||
foreach ($strVals as $strVal) {
|
||||
foreach($strVals as $otherVal) {
|
||||
echo "--- testing: '$strVal' / '$otherVal' ---\n";
|
||||
var_dump($strVal/$otherVal);
|
||||
}
|
||||
foreach($strVals as $otherVal) {
|
||||
echo "--- testing: '$strVal'/'$otherVal' ---\n";
|
||||
try {
|
||||
var_dump($strVal/$otherVal);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--- testing: '0' / '0' ---
|
||||
--- testing: '0'/'0' ---
|
||||
float(NAN)
|
||||
--- testing: '0' / '65' ---
|
||||
--- testing: '0'/'65' ---
|
||||
int(0)
|
||||
--- testing: '0' / '-44' ---
|
||||
--- testing: '0'/'-44' ---
|
||||
int(0)
|
||||
--- testing: '0' / '1.2' ---
|
||||
--- testing: '0'/'1.2' ---
|
||||
float(0)
|
||||
--- testing: '0' / '-7.7' ---
|
||||
--- testing: '0'/'-7.7' ---
|
||||
float(-0)
|
||||
--- testing: '0' / 'abc' ---
|
||||
float(NAN)
|
||||
--- testing: '0' / '123abc' ---
|
||||
--- testing: '0'/'abc' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '0'/'123abc' ---
|
||||
int(0)
|
||||
--- testing: '0' / '123e5' ---
|
||||
--- testing: '0'/'123e5' ---
|
||||
float(0)
|
||||
--- testing: '0' / '123e5xyz' ---
|
||||
--- testing: '0'/'123e5xyz' ---
|
||||
float(0)
|
||||
--- testing: '0' / ' 123abc' ---
|
||||
--- testing: '0'/' 123abc' ---
|
||||
int(0)
|
||||
--- testing: '0' / '123 abc' ---
|
||||
--- testing: '0'/'123 abc' ---
|
||||
int(0)
|
||||
--- testing: '0' / '123abc ' ---
|
||||
--- testing: '0'/'123abc ' ---
|
||||
int(0)
|
||||
--- testing: '0' / '3.4a' ---
|
||||
--- testing: '0'/'3.4a' ---
|
||||
float(0)
|
||||
--- testing: '0' / 'a5.9' ---
|
||||
float(NAN)
|
||||
--- testing: '65' / '0' ---
|
||||
--- testing: '0'/'a5.9' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '65'/'0' ---
|
||||
float(INF)
|
||||
--- testing: '65' / '65' ---
|
||||
--- testing: '65'/'65' ---
|
||||
int(1)
|
||||
--- testing: '65' / '-44' ---
|
||||
--- testing: '65'/'-44' ---
|
||||
float(-1.4772727272727273)
|
||||
--- testing: '65' / '1.2' ---
|
||||
--- testing: '65'/'1.2' ---
|
||||
float(54.16666666666667)
|
||||
--- testing: '65' / '-7.7' ---
|
||||
--- testing: '65'/'-7.7' ---
|
||||
float(-8.441558441558442)
|
||||
--- testing: '65' / 'abc' ---
|
||||
float(INF)
|
||||
--- testing: '65' / '123abc' ---
|
||||
--- testing: '65'/'abc' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '65'/'123abc' ---
|
||||
float(0.5284552845528455)
|
||||
--- testing: '65' / '123e5' ---
|
||||
--- testing: '65'/'123e5' ---
|
||||
float(5.2845528455284555E-6)
|
||||
--- testing: '65' / '123e5xyz' ---
|
||||
--- testing: '65'/'123e5xyz' ---
|
||||
float(5.2845528455284555E-6)
|
||||
--- testing: '65' / ' 123abc' ---
|
||||
--- testing: '65'/' 123abc' ---
|
||||
float(0.5284552845528455)
|
||||
--- testing: '65' / '123 abc' ---
|
||||
--- testing: '65'/'123 abc' ---
|
||||
float(0.5284552845528455)
|
||||
--- testing: '65' / '123abc ' ---
|
||||
--- testing: '65'/'123abc ' ---
|
||||
float(0.5284552845528455)
|
||||
--- testing: '65' / '3.4a' ---
|
||||
--- testing: '65'/'3.4a' ---
|
||||
float(19.11764705882353)
|
||||
--- testing: '65' / 'a5.9' ---
|
||||
float(INF)
|
||||
--- testing: '-44' / '0' ---
|
||||
--- testing: '65'/'a5.9' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '-44'/'0' ---
|
||||
float(-INF)
|
||||
--- testing: '-44' / '65' ---
|
||||
--- testing: '-44'/'65' ---
|
||||
float(-0.676923076923077)
|
||||
--- testing: '-44' / '-44' ---
|
||||
--- testing: '-44'/'-44' ---
|
||||
int(1)
|
||||
--- testing: '-44' / '1.2' ---
|
||||
--- testing: '-44'/'1.2' ---
|
||||
float(-36.66666666666667)
|
||||
--- testing: '-44' / '-7.7' ---
|
||||
--- testing: '-44'/'-7.7' ---
|
||||
float(5.714285714285714)
|
||||
--- testing: '-44' / 'abc' ---
|
||||
float(-INF)
|
||||
--- testing: '-44' / '123abc' ---
|
||||
--- testing: '-44'/'abc' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '-44'/'123abc' ---
|
||||
float(-0.35772357723577236)
|
||||
--- testing: '-44' / '123e5' ---
|
||||
--- testing: '-44'/'123e5' ---
|
||||
float(-3.5772357723577236E-6)
|
||||
--- testing: '-44' / '123e5xyz' ---
|
||||
--- testing: '-44'/'123e5xyz' ---
|
||||
float(-3.5772357723577236E-6)
|
||||
--- testing: '-44' / ' 123abc' ---
|
||||
--- testing: '-44'/' 123abc' ---
|
||||
float(-0.35772357723577236)
|
||||
--- testing: '-44' / '123 abc' ---
|
||||
--- testing: '-44'/'123 abc' ---
|
||||
float(-0.35772357723577236)
|
||||
--- testing: '-44' / '123abc ' ---
|
||||
--- testing: '-44'/'123abc ' ---
|
||||
float(-0.35772357723577236)
|
||||
--- testing: '-44' / '3.4a' ---
|
||||
--- testing: '-44'/'3.4a' ---
|
||||
float(-12.941176470588236)
|
||||
--- testing: '-44' / 'a5.9' ---
|
||||
float(-INF)
|
||||
--- testing: '1.2' / '0' ---
|
||||
--- testing: '-44'/'a5.9' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '1.2'/'0' ---
|
||||
float(INF)
|
||||
--- testing: '1.2' / '65' ---
|
||||
--- testing: '1.2'/'65' ---
|
||||
float(0.01846153846153846)
|
||||
--- testing: '1.2' / '-44' ---
|
||||
--- testing: '1.2'/'-44' ---
|
||||
float(-0.02727272727272727)
|
||||
--- testing: '1.2' / '1.2' ---
|
||||
--- testing: '1.2'/'1.2' ---
|
||||
float(1)
|
||||
--- testing: '1.2' / '-7.7' ---
|
||||
--- testing: '1.2'/'-7.7' ---
|
||||
float(-0.15584415584415584)
|
||||
--- testing: '1.2' / 'abc' ---
|
||||
float(INF)
|
||||
--- testing: '1.2' / '123abc' ---
|
||||
--- testing: '1.2'/'abc' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '1.2'/'123abc' ---
|
||||
float(0.00975609756097561)
|
||||
--- testing: '1.2' / '123e5' ---
|
||||
--- testing: '1.2'/'123e5' ---
|
||||
float(9.75609756097561E-8)
|
||||
--- testing: '1.2' / '123e5xyz' ---
|
||||
--- testing: '1.2'/'123e5xyz' ---
|
||||
float(9.75609756097561E-8)
|
||||
--- testing: '1.2' / ' 123abc' ---
|
||||
--- testing: '1.2'/' 123abc' ---
|
||||
float(0.00975609756097561)
|
||||
--- testing: '1.2' / '123 abc' ---
|
||||
--- testing: '1.2'/'123 abc' ---
|
||||
float(0.00975609756097561)
|
||||
--- testing: '1.2' / '123abc ' ---
|
||||
--- testing: '1.2'/'123abc ' ---
|
||||
float(0.00975609756097561)
|
||||
--- testing: '1.2' / '3.4a' ---
|
||||
--- testing: '1.2'/'3.4a' ---
|
||||
float(0.35294117647058826)
|
||||
--- testing: '1.2' / 'a5.9' ---
|
||||
float(INF)
|
||||
--- testing: '-7.7' / '0' ---
|
||||
--- testing: '1.2'/'a5.9' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '-7.7'/'0' ---
|
||||
float(-INF)
|
||||
--- testing: '-7.7' / '65' ---
|
||||
--- testing: '-7.7'/'65' ---
|
||||
float(-0.11846153846153847)
|
||||
--- testing: '-7.7' / '-44' ---
|
||||
--- testing: '-7.7'/'-44' ---
|
||||
float(0.17500000000000002)
|
||||
--- testing: '-7.7' / '1.2' ---
|
||||
--- testing: '-7.7'/'1.2' ---
|
||||
float(-6.416666666666667)
|
||||
--- testing: '-7.7' / '-7.7' ---
|
||||
--- testing: '-7.7'/'-7.7' ---
|
||||
float(1)
|
||||
--- testing: '-7.7' / 'abc' ---
|
||||
float(-INF)
|
||||
--- testing: '-7.7' / '123abc' ---
|
||||
--- testing: '-7.7'/'abc' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '-7.7'/'123abc' ---
|
||||
float(-0.06260162601626017)
|
||||
--- testing: '-7.7' / '123e5' ---
|
||||
--- testing: '-7.7'/'123e5' ---
|
||||
float(-6.260162601626017E-7)
|
||||
--- testing: '-7.7' / '123e5xyz' ---
|
||||
--- testing: '-7.7'/'123e5xyz' ---
|
||||
float(-6.260162601626017E-7)
|
||||
--- testing: '-7.7' / ' 123abc' ---
|
||||
--- testing: '-7.7'/' 123abc' ---
|
||||
float(-0.06260162601626017)
|
||||
--- testing: '-7.7' / '123 abc' ---
|
||||
--- testing: '-7.7'/'123 abc' ---
|
||||
float(-0.06260162601626017)
|
||||
--- testing: '-7.7' / '123abc ' ---
|
||||
--- testing: '-7.7'/'123abc ' ---
|
||||
float(-0.06260162601626017)
|
||||
--- testing: '-7.7' / '3.4a' ---
|
||||
--- testing: '-7.7'/'3.4a' ---
|
||||
float(-2.264705882352941)
|
||||
--- testing: '-7.7' / 'a5.9' ---
|
||||
float(-INF)
|
||||
--- testing: 'abc' / '0' ---
|
||||
float(NAN)
|
||||
--- testing: 'abc' / '65' ---
|
||||
int(0)
|
||||
--- testing: 'abc' / '-44' ---
|
||||
int(0)
|
||||
--- testing: 'abc' / '1.2' ---
|
||||
float(0)
|
||||
--- testing: 'abc' / '-7.7' ---
|
||||
float(-0)
|
||||
--- testing: 'abc' / 'abc' ---
|
||||
float(NAN)
|
||||
--- testing: 'abc' / '123abc' ---
|
||||
int(0)
|
||||
--- testing: 'abc' / '123e5' ---
|
||||
float(0)
|
||||
--- testing: 'abc' / '123e5xyz' ---
|
||||
float(0)
|
||||
--- testing: 'abc' / ' 123abc' ---
|
||||
int(0)
|
||||
--- testing: 'abc' / '123 abc' ---
|
||||
int(0)
|
||||
--- testing: 'abc' / '123abc ' ---
|
||||
int(0)
|
||||
--- testing: 'abc' / '3.4a' ---
|
||||
float(0)
|
||||
--- testing: 'abc' / 'a5.9' ---
|
||||
float(NAN)
|
||||
--- testing: '123abc' / '0' ---
|
||||
--- testing: '-7.7'/'a5.9' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/'0' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/'65' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/'-44' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/'1.2' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/'-7.7' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/'abc' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/'123abc' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/'123e5' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/'123e5xyz' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/' 123abc' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/'123 abc' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/'123abc ' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/'3.4a' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: 'abc'/'a5.9' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '123abc'/'0' ---
|
||||
float(INF)
|
||||
--- testing: '123abc' / '65' ---
|
||||
--- testing: '123abc'/'65' ---
|
||||
float(1.8923076923076922)
|
||||
--- testing: '123abc' / '-44' ---
|
||||
--- testing: '123abc'/'-44' ---
|
||||
float(-2.7954545454545454)
|
||||
--- testing: '123abc' / '1.2' ---
|
||||
--- testing: '123abc'/'1.2' ---
|
||||
float(102.5)
|
||||
--- testing: '123abc' / '-7.7' ---
|
||||
--- testing: '123abc'/'-7.7' ---
|
||||
float(-15.974025974025974)
|
||||
--- testing: '123abc' / 'abc' ---
|
||||
float(INF)
|
||||
--- testing: '123abc' / '123abc' ---
|
||||
--- testing: '123abc'/'abc' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '123abc'/'123abc' ---
|
||||
int(1)
|
||||
--- testing: '123abc' / '123e5' ---
|
||||
--- testing: '123abc'/'123e5' ---
|
||||
float(1.0E-5)
|
||||
--- testing: '123abc' / '123e5xyz' ---
|
||||
--- testing: '123abc'/'123e5xyz' ---
|
||||
float(1.0E-5)
|
||||
--- testing: '123abc' / ' 123abc' ---
|
||||
--- testing: '123abc'/' 123abc' ---
|
||||
int(1)
|
||||
--- testing: '123abc' / '123 abc' ---
|
||||
--- testing: '123abc'/'123 abc' ---
|
||||
int(1)
|
||||
--- testing: '123abc' / '123abc ' ---
|
||||
--- testing: '123abc'/'123abc ' ---
|
||||
int(1)
|
||||
--- testing: '123abc' / '3.4a' ---
|
||||
--- testing: '123abc'/'3.4a' ---
|
||||
float(36.1764705882353)
|
||||
--- testing: '123abc' / 'a5.9' ---
|
||||
--- testing: '123abc'/'a5.9' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '123e5'/'0' ---
|
||||
float(INF)
|
||||
--- 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' ---
|
||||
--- testing: '123e5'/'a5.9' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '123e5xyz'/'0' ---
|
||||
float(INF)
|
||||
--- 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' ---
|
||||
--- testing: '123e5xyz'/'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' ---
|
||||
--- testing: ' 123abc'/'a5.9' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '123 abc'/'0' ---
|
||||
float(INF)
|
||||
--- 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' ---
|
||||
--- testing: '123abc '/'a5.9' ---
|
||||
Unsupported operand types: string / string
|
||||
--- testing: '3.4a'/'0' ---
|
||||
float(INF)
|
||||
--- 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
|
||||
|
||||
@@ -15,8 +15,8 @@ foreach ($strVals as $strVal) {
|
||||
echo "--- testing: '$strVal' % '$otherVal' ---\n";
|
||||
try {
|
||||
var_dump($strVal%$otherVal);
|
||||
} catch (DivisionByZeroError $e) {
|
||||
echo "Exception: " . $e->getMessage() . "\n";
|
||||
} catch (\Throwable $e) {
|
||||
echo get_class($e) . ': ' . $e->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ foreach ($strVals as $strVal) {
|
||||
?>
|
||||
--EXPECT--
|
||||
--- testing: '0' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
DivisionByZeroError: Modulo by zero
|
||||
--- testing: '0' % '65' ---
|
||||
int(0)
|
||||
--- testing: '0' % '-44' ---
|
||||
@@ -35,7 +35,7 @@ int(0)
|
||||
--- testing: '0' % '-7.7' ---
|
||||
int(0)
|
||||
--- testing: '0' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '0' % '123abc' ---
|
||||
int(0)
|
||||
--- testing: '0' % '123e5' ---
|
||||
@@ -51,9 +51,9 @@ int(0)
|
||||
--- testing: '0' % '3.4a' ---
|
||||
int(0)
|
||||
--- testing: '0' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '65' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
DivisionByZeroError: Modulo by zero
|
||||
--- testing: '65' % '65' ---
|
||||
int(0)
|
||||
--- testing: '65' % '-44' ---
|
||||
@@ -63,7 +63,7 @@ int(0)
|
||||
--- testing: '65' % '-7.7' ---
|
||||
int(2)
|
||||
--- testing: '65' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '65' % '123abc' ---
|
||||
int(65)
|
||||
--- testing: '65' % '123e5' ---
|
||||
@@ -79,9 +79,9 @@ int(65)
|
||||
--- testing: '65' % '3.4a' ---
|
||||
int(2)
|
||||
--- testing: '65' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '-44' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
DivisionByZeroError: Modulo by zero
|
||||
--- testing: '-44' % '65' ---
|
||||
int(-44)
|
||||
--- testing: '-44' % '-44' ---
|
||||
@@ -91,7 +91,7 @@ int(0)
|
||||
--- testing: '-44' % '-7.7' ---
|
||||
int(-2)
|
||||
--- testing: '-44' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '-44' % '123abc' ---
|
||||
int(-44)
|
||||
--- testing: '-44' % '123e5' ---
|
||||
@@ -107,9 +107,9 @@ int(-44)
|
||||
--- testing: '-44' % '3.4a' ---
|
||||
int(-2)
|
||||
--- testing: '-44' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '1.2' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
DivisionByZeroError: Modulo by zero
|
||||
--- testing: '1.2' % '65' ---
|
||||
int(1)
|
||||
--- testing: '1.2' % '-44' ---
|
||||
@@ -119,7 +119,7 @@ int(0)
|
||||
--- testing: '1.2' % '-7.7' ---
|
||||
int(1)
|
||||
--- testing: '1.2' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '1.2' % '123abc' ---
|
||||
int(1)
|
||||
--- testing: '1.2' % '123e5' ---
|
||||
@@ -135,9 +135,9 @@ int(1)
|
||||
--- testing: '1.2' % '3.4a' ---
|
||||
int(1)
|
||||
--- testing: '1.2' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '-7.7' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
DivisionByZeroError: Modulo by zero
|
||||
--- testing: '-7.7' % '65' ---
|
||||
int(-7)
|
||||
--- testing: '-7.7' % '-44' ---
|
||||
@@ -147,7 +147,7 @@ int(0)
|
||||
--- testing: '-7.7' % '-7.7' ---
|
||||
int(0)
|
||||
--- testing: '-7.7' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '-7.7' % '123abc' ---
|
||||
int(-7)
|
||||
--- testing: '-7.7' % '123e5' ---
|
||||
@@ -163,37 +163,37 @@ int(-7)
|
||||
--- testing: '-7.7' % '3.4a' ---
|
||||
int(-1)
|
||||
--- testing: '-7.7' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % '65' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % '-44' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % '1.2' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % '-7.7' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % '123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % '123e5' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % '123e5xyz' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % ' 123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % '123 abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % '123abc ' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % '3.4a' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'abc' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '123abc' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
DivisionByZeroError: Modulo by zero
|
||||
--- testing: '123abc' % '65' ---
|
||||
int(58)
|
||||
--- testing: '123abc' % '-44' ---
|
||||
@@ -203,7 +203,7 @@ int(0)
|
||||
--- testing: '123abc' % '-7.7' ---
|
||||
int(4)
|
||||
--- testing: '123abc' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '123abc' % '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123abc' % '123e5' ---
|
||||
@@ -219,9 +219,9 @@ int(0)
|
||||
--- testing: '123abc' % '3.4a' ---
|
||||
int(0)
|
||||
--- testing: '123abc' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '123e5' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
DivisionByZeroError: Modulo by zero
|
||||
--- testing: '123e5' % '65' ---
|
||||
int(50)
|
||||
--- testing: '123e5' % '-44' ---
|
||||
@@ -231,7 +231,7 @@ int(0)
|
||||
--- testing: '123e5' % '-7.7' ---
|
||||
int(6)
|
||||
--- testing: '123e5' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '123e5' % '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123e5' % '123e5' ---
|
||||
@@ -247,9 +247,9 @@ int(0)
|
||||
--- testing: '123e5' % '3.4a' ---
|
||||
int(0)
|
||||
--- testing: '123e5' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '123e5xyz' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
DivisionByZeroError: Modulo by zero
|
||||
--- testing: '123e5xyz' % '65' ---
|
||||
int(50)
|
||||
--- testing: '123e5xyz' % '-44' ---
|
||||
@@ -259,7 +259,7 @@ int(0)
|
||||
--- testing: '123e5xyz' % '-7.7' ---
|
||||
int(6)
|
||||
--- testing: '123e5xyz' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '123e5xyz' % '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123e5xyz' % '123e5' ---
|
||||
@@ -275,9 +275,9 @@ int(0)
|
||||
--- testing: '123e5xyz' % '3.4a' ---
|
||||
int(0)
|
||||
--- testing: '123e5xyz' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: ' 123abc' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
DivisionByZeroError: Modulo by zero
|
||||
--- testing: ' 123abc' % '65' ---
|
||||
int(58)
|
||||
--- testing: ' 123abc' % '-44' ---
|
||||
@@ -287,7 +287,7 @@ int(0)
|
||||
--- testing: ' 123abc' % '-7.7' ---
|
||||
int(4)
|
||||
--- testing: ' 123abc' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: ' 123abc' % '123abc' ---
|
||||
int(0)
|
||||
--- testing: ' 123abc' % '123e5' ---
|
||||
@@ -303,9 +303,9 @@ int(0)
|
||||
--- testing: ' 123abc' % '3.4a' ---
|
||||
int(0)
|
||||
--- testing: ' 123abc' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '123 abc' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
DivisionByZeroError: Modulo by zero
|
||||
--- testing: '123 abc' % '65' ---
|
||||
int(58)
|
||||
--- testing: '123 abc' % '-44' ---
|
||||
@@ -315,7 +315,7 @@ int(0)
|
||||
--- testing: '123 abc' % '-7.7' ---
|
||||
int(4)
|
||||
--- testing: '123 abc' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '123 abc' % '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123 abc' % '123e5' ---
|
||||
@@ -331,9 +331,9 @@ int(0)
|
||||
--- testing: '123 abc' % '3.4a' ---
|
||||
int(0)
|
||||
--- testing: '123 abc' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '123abc ' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
DivisionByZeroError: Modulo by zero
|
||||
--- testing: '123abc ' % '65' ---
|
||||
int(58)
|
||||
--- testing: '123abc ' % '-44' ---
|
||||
@@ -343,7 +343,7 @@ int(0)
|
||||
--- testing: '123abc ' % '-7.7' ---
|
||||
int(4)
|
||||
--- testing: '123abc ' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '123abc ' % '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123abc ' % '123e5' ---
|
||||
@@ -359,9 +359,9 @@ int(0)
|
||||
--- testing: '123abc ' % '3.4a' ---
|
||||
int(0)
|
||||
--- testing: '123abc ' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '3.4a' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
DivisionByZeroError: Modulo by zero
|
||||
--- testing: '3.4a' % '65' ---
|
||||
int(3)
|
||||
--- testing: '3.4a' % '-44' ---
|
||||
@@ -371,7 +371,7 @@ int(0)
|
||||
--- testing: '3.4a' % '-7.7' ---
|
||||
int(3)
|
||||
--- testing: '3.4a' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: '3.4a' % '123abc' ---
|
||||
int(3)
|
||||
--- testing: '3.4a' % '123e5' ---
|
||||
@@ -387,32 +387,32 @@ int(3)
|
||||
--- testing: '3.4a' % '3.4a' ---
|
||||
int(0)
|
||||
--- testing: '3.4a' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % '0' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % '65' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % '-44' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % '1.2' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % '-7.7' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % 'abc' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % '123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % '123e5' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % '123e5xyz' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % ' 123abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % '123 abc' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % '123abc ' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % '3.4a' ---
|
||||
int(0)
|
||||
TypeError: Unsupported operand types: string % string
|
||||
--- testing: 'a5.9' % 'a5.9' ---
|
||||
Exception: Modulo by zero
|
||||
TypeError: Unsupported operand types: string % string
|
||||
|
||||
@@ -11,13 +11,16 @@ $strVals = array(
|
||||
error_reporting(E_ERROR);
|
||||
|
||||
foreach ($strVals as $strVal) {
|
||||
foreach($strVals as $otherVal) {
|
||||
echo "--- testing: '$strVal' * '$otherVal' ---\n";
|
||||
var_dump($strVal*$otherVal);
|
||||
}
|
||||
foreach($strVals as $otherVal) {
|
||||
echo "--- testing: '$strVal' * '$otherVal' ---\n";
|
||||
try {
|
||||
var_dump($strVal*$otherVal);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--- testing: '0' * '0' ---
|
||||
@@ -31,7 +34,7 @@ float(0)
|
||||
--- testing: '0' * '-7.7' ---
|
||||
float(-0)
|
||||
--- testing: '0' * 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '0' * '123abc' ---
|
||||
int(0)
|
||||
--- testing: '0' * '123e5' ---
|
||||
@@ -47,7 +50,7 @@ int(0)
|
||||
--- testing: '0' * '3.4a' ---
|
||||
float(0)
|
||||
--- testing: '0' * 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '65' * '0' ---
|
||||
int(0)
|
||||
--- testing: '65' * '65' ---
|
||||
@@ -59,7 +62,7 @@ float(78)
|
||||
--- testing: '65' * '-7.7' ---
|
||||
float(-500.5)
|
||||
--- testing: '65' * 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '65' * '123abc' ---
|
||||
int(7995)
|
||||
--- testing: '65' * '123e5' ---
|
||||
@@ -75,7 +78,7 @@ int(7995)
|
||||
--- testing: '65' * '3.4a' ---
|
||||
float(221)
|
||||
--- testing: '65' * 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '-44' * '0' ---
|
||||
int(0)
|
||||
--- testing: '-44' * '65' ---
|
||||
@@ -87,7 +90,7 @@ float(-52.8)
|
||||
--- testing: '-44' * '-7.7' ---
|
||||
float(338.8)
|
||||
--- testing: '-44' * 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '-44' * '123abc' ---
|
||||
int(-5412)
|
||||
--- testing: '-44' * '123e5' ---
|
||||
@@ -103,7 +106,7 @@ int(-5412)
|
||||
--- testing: '-44' * '3.4a' ---
|
||||
float(-149.6)
|
||||
--- testing: '-44' * 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '1.2' * '0' ---
|
||||
float(0)
|
||||
--- testing: '1.2' * '65' ---
|
||||
@@ -115,7 +118,7 @@ float(1.44)
|
||||
--- testing: '1.2' * '-7.7' ---
|
||||
float(-9.24)
|
||||
--- testing: '1.2' * 'abc' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '1.2' * '123abc' ---
|
||||
float(147.6)
|
||||
--- testing: '1.2' * '123e5' ---
|
||||
@@ -131,7 +134,7 @@ float(147.6)
|
||||
--- testing: '1.2' * '3.4a' ---
|
||||
float(4.08)
|
||||
--- testing: '1.2' * 'a5.9' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '-7.7' * '0' ---
|
||||
float(-0)
|
||||
--- testing: '-7.7' * '65' ---
|
||||
@@ -143,7 +146,7 @@ float(-9.24)
|
||||
--- testing: '-7.7' * '-7.7' ---
|
||||
float(59.290000000000006)
|
||||
--- testing: '-7.7' * 'abc' ---
|
||||
float(-0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '-7.7' * '123abc' ---
|
||||
float(-947.1)
|
||||
--- testing: '-7.7' * '123e5' ---
|
||||
@@ -159,35 +162,35 @@ float(-947.1)
|
||||
--- testing: '-7.7' * '3.4a' ---
|
||||
float(-26.18)
|
||||
--- testing: '-7.7' * 'a5.9' ---
|
||||
float(-0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * '0' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * '65' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * '-44' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * '1.2' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * '-7.7' ---
|
||||
float(-0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * '123abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * '123e5' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * '123e5xyz' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * ' 123abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * '123 abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * '123abc ' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * '3.4a' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'abc' * 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '123abc' * '0' ---
|
||||
int(0)
|
||||
--- testing: '123abc' * '65' ---
|
||||
@@ -199,7 +202,7 @@ float(147.6)
|
||||
--- testing: '123abc' * '-7.7' ---
|
||||
float(-947.1)
|
||||
--- testing: '123abc' * 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '123abc' * '123abc' ---
|
||||
int(15129)
|
||||
--- testing: '123abc' * '123e5' ---
|
||||
@@ -215,7 +218,7 @@ int(15129)
|
||||
--- testing: '123abc' * '3.4a' ---
|
||||
float(418.2)
|
||||
--- testing: '123abc' * 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '123e5' * '0' ---
|
||||
float(0)
|
||||
--- testing: '123e5' * '65' ---
|
||||
@@ -227,7 +230,7 @@ float(14760000)
|
||||
--- testing: '123e5' * '-7.7' ---
|
||||
float(-94710000)
|
||||
--- testing: '123e5' * 'abc' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '123e5' * '123abc' ---
|
||||
float(1512900000)
|
||||
--- testing: '123e5' * '123e5' ---
|
||||
@@ -243,7 +246,7 @@ float(1512900000)
|
||||
--- testing: '123e5' * '3.4a' ---
|
||||
float(41820000)
|
||||
--- testing: '123e5' * 'a5.9' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '123e5xyz' * '0' ---
|
||||
float(0)
|
||||
--- testing: '123e5xyz' * '65' ---
|
||||
@@ -255,7 +258,7 @@ float(14760000)
|
||||
--- testing: '123e5xyz' * '-7.7' ---
|
||||
float(-94710000)
|
||||
--- testing: '123e5xyz' * 'abc' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '123e5xyz' * '123abc' ---
|
||||
float(1512900000)
|
||||
--- testing: '123e5xyz' * '123e5' ---
|
||||
@@ -271,7 +274,7 @@ float(1512900000)
|
||||
--- testing: '123e5xyz' * '3.4a' ---
|
||||
float(41820000)
|
||||
--- testing: '123e5xyz' * 'a5.9' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: ' 123abc' * '0' ---
|
||||
int(0)
|
||||
--- testing: ' 123abc' * '65' ---
|
||||
@@ -283,7 +286,7 @@ float(147.6)
|
||||
--- testing: ' 123abc' * '-7.7' ---
|
||||
float(-947.1)
|
||||
--- testing: ' 123abc' * 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: ' 123abc' * '123abc' ---
|
||||
int(15129)
|
||||
--- testing: ' 123abc' * '123e5' ---
|
||||
@@ -299,7 +302,7 @@ int(15129)
|
||||
--- testing: ' 123abc' * '3.4a' ---
|
||||
float(418.2)
|
||||
--- testing: ' 123abc' * 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '123 abc' * '0' ---
|
||||
int(0)
|
||||
--- testing: '123 abc' * '65' ---
|
||||
@@ -311,7 +314,7 @@ float(147.6)
|
||||
--- testing: '123 abc' * '-7.7' ---
|
||||
float(-947.1)
|
||||
--- testing: '123 abc' * 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '123 abc' * '123abc' ---
|
||||
int(15129)
|
||||
--- testing: '123 abc' * '123e5' ---
|
||||
@@ -327,7 +330,7 @@ int(15129)
|
||||
--- testing: '123 abc' * '3.4a' ---
|
||||
float(418.2)
|
||||
--- testing: '123 abc' * 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '123abc ' * '0' ---
|
||||
int(0)
|
||||
--- testing: '123abc ' * '65' ---
|
||||
@@ -339,7 +342,7 @@ float(147.6)
|
||||
--- testing: '123abc ' * '-7.7' ---
|
||||
float(-947.1)
|
||||
--- testing: '123abc ' * 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '123abc ' * '123abc' ---
|
||||
int(15129)
|
||||
--- testing: '123abc ' * '123e5' ---
|
||||
@@ -355,7 +358,7 @@ int(15129)
|
||||
--- testing: '123abc ' * '3.4a' ---
|
||||
float(418.2)
|
||||
--- testing: '123abc ' * 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '3.4a' * '0' ---
|
||||
float(0)
|
||||
--- testing: '3.4a' * '65' ---
|
||||
@@ -367,7 +370,7 @@ float(4.08)
|
||||
--- testing: '3.4a' * '-7.7' ---
|
||||
float(-26.18)
|
||||
--- testing: '3.4a' * 'abc' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: '3.4a' * '123abc' ---
|
||||
float(418.2)
|
||||
--- testing: '3.4a' * '123e5' ---
|
||||
@@ -383,32 +386,32 @@ float(418.2)
|
||||
--- testing: '3.4a' * '3.4a' ---
|
||||
float(11.559999999999999)
|
||||
--- testing: '3.4a' * 'a5.9' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * '0' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * '65' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * '-44' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * '1.2' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * '-7.7' ---
|
||||
float(-0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * '123abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * '123e5' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * '123e5xyz' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * ' 123abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * '123 abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * '123abc ' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * '3.4a' ---
|
||||
float(0)
|
||||
Unsupported operand types: string * string
|
||||
--- testing: 'a5.9' * 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string * string
|
||||
|
||||
@@ -8,10 +8,13 @@ $strVals = array(
|
||||
"a5.9"
|
||||
);
|
||||
|
||||
|
||||
foreach ($strVals as $strVal) {
|
||||
echo "--- testing: '$strVal' ---\n";
|
||||
var_dump(-$strVal);
|
||||
echo "--- testing: '$strVal' ---\n";
|
||||
try {
|
||||
var_dump(-$strVal);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -27,36 +30,32 @@ float(-1.2)
|
||||
--- testing: '-7.7' ---
|
||||
float(7.7)
|
||||
--- testing: 'abc' ---
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string * int
|
||||
--- testing: '123abc' ---
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(-123)
|
||||
--- testing: '123e5' ---
|
||||
float(-12300000)
|
||||
--- testing: '123e5xyz' ---
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
float(-12300000)
|
||||
--- testing: ' 123abc' ---
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(-123)
|
||||
--- testing: '123 abc' ---
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(-123)
|
||||
--- testing: '123abc ' ---
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(-123)
|
||||
--- testing: '3.4a' ---
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
float(-3.4)
|
||||
--- testing: 'a5.9' ---
|
||||
|
||||
Warning: A non-numeric value encountered in %s on line %d
|
||||
int(0)
|
||||
Unsupported operand types: string * int
|
||||
|
||||
@@ -11,13 +11,16 @@ $strVals = array(
|
||||
error_reporting(E_ERROR);
|
||||
|
||||
foreach ($strVals as $strVal) {
|
||||
foreach($strVals as $otherVal) {
|
||||
echo "--- testing: '$strVal' - '$otherVal' ---\n";
|
||||
var_dump($strVal-$otherVal);
|
||||
}
|
||||
foreach($strVals as $otherVal) {
|
||||
echo "--- testing: '$strVal' - '$otherVal' ---\n";
|
||||
try {
|
||||
var_dump($strVal-$otherVal);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--- testing: '0' - '0' ---
|
||||
@@ -31,7 +34,7 @@ float(-1.2)
|
||||
--- testing: '0' - '-7.7' ---
|
||||
float(7.7)
|
||||
--- testing: '0' - 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '0' - '123abc' ---
|
||||
int(-123)
|
||||
--- testing: '0' - '123e5' ---
|
||||
@@ -47,7 +50,7 @@ int(-123)
|
||||
--- testing: '0' - '3.4a' ---
|
||||
float(-3.4)
|
||||
--- testing: '0' - 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '65' - '0' ---
|
||||
int(65)
|
||||
--- testing: '65' - '65' ---
|
||||
@@ -59,7 +62,7 @@ float(63.8)
|
||||
--- testing: '65' - '-7.7' ---
|
||||
float(72.7)
|
||||
--- testing: '65' - 'abc' ---
|
||||
int(65)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '65' - '123abc' ---
|
||||
int(-58)
|
||||
--- testing: '65' - '123e5' ---
|
||||
@@ -75,7 +78,7 @@ int(-58)
|
||||
--- testing: '65' - '3.4a' ---
|
||||
float(61.6)
|
||||
--- testing: '65' - 'a5.9' ---
|
||||
int(65)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '-44' - '0' ---
|
||||
int(-44)
|
||||
--- testing: '-44' - '65' ---
|
||||
@@ -87,7 +90,7 @@ float(-45.2)
|
||||
--- testing: '-44' - '-7.7' ---
|
||||
float(-36.3)
|
||||
--- testing: '-44' - 'abc' ---
|
||||
int(-44)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '-44' - '123abc' ---
|
||||
int(-167)
|
||||
--- testing: '-44' - '123e5' ---
|
||||
@@ -103,7 +106,7 @@ int(-167)
|
||||
--- testing: '-44' - '3.4a' ---
|
||||
float(-47.4)
|
||||
--- testing: '-44' - 'a5.9' ---
|
||||
int(-44)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '1.2' - '0' ---
|
||||
float(1.2)
|
||||
--- testing: '1.2' - '65' ---
|
||||
@@ -115,7 +118,7 @@ float(0)
|
||||
--- testing: '1.2' - '-7.7' ---
|
||||
float(8.9)
|
||||
--- testing: '1.2' - 'abc' ---
|
||||
float(1.2)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '1.2' - '123abc' ---
|
||||
float(-121.8)
|
||||
--- testing: '1.2' - '123e5' ---
|
||||
@@ -131,7 +134,7 @@ float(-121.8)
|
||||
--- testing: '1.2' - '3.4a' ---
|
||||
float(-2.2)
|
||||
--- testing: '1.2' - 'a5.9' ---
|
||||
float(1.2)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '-7.7' - '0' ---
|
||||
float(-7.7)
|
||||
--- testing: '-7.7' - '65' ---
|
||||
@@ -143,7 +146,7 @@ float(-8.9)
|
||||
--- testing: '-7.7' - '-7.7' ---
|
||||
float(0)
|
||||
--- testing: '-7.7' - 'abc' ---
|
||||
float(-7.7)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '-7.7' - '123abc' ---
|
||||
float(-130.7)
|
||||
--- testing: '-7.7' - '123e5' ---
|
||||
@@ -159,35 +162,35 @@ float(-130.7)
|
||||
--- testing: '-7.7' - '3.4a' ---
|
||||
float(-11.1)
|
||||
--- testing: '-7.7' - 'a5.9' ---
|
||||
float(-7.7)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - '0' ---
|
||||
int(0)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - '65' ---
|
||||
int(-65)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - '-44' ---
|
||||
int(44)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - '1.2' ---
|
||||
float(-1.2)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - '-7.7' ---
|
||||
float(7.7)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - '123abc' ---
|
||||
int(-123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - '123e5' ---
|
||||
float(-12300000)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - '123e5xyz' ---
|
||||
float(-12300000)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - ' 123abc' ---
|
||||
int(-123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - '123 abc' ---
|
||||
int(-123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - '123abc ' ---
|
||||
int(-123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - '3.4a' ---
|
||||
float(-3.4)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'abc' - 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '123abc' - '0' ---
|
||||
int(123)
|
||||
--- testing: '123abc' - '65' ---
|
||||
@@ -199,7 +202,7 @@ float(121.8)
|
||||
--- testing: '123abc' - '-7.7' ---
|
||||
float(130.7)
|
||||
--- testing: '123abc' - 'abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '123abc' - '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123abc' - '123e5' ---
|
||||
@@ -215,7 +218,7 @@ int(0)
|
||||
--- testing: '123abc' - '3.4a' ---
|
||||
float(119.6)
|
||||
--- testing: '123abc' - 'a5.9' ---
|
||||
int(123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '123e5' - '0' ---
|
||||
float(12300000)
|
||||
--- testing: '123e5' - '65' ---
|
||||
@@ -227,7 +230,7 @@ float(12299998.8)
|
||||
--- testing: '123e5' - '-7.7' ---
|
||||
float(12300007.7)
|
||||
--- testing: '123e5' - 'abc' ---
|
||||
float(12300000)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '123e5' - '123abc' ---
|
||||
float(12299877)
|
||||
--- testing: '123e5' - '123e5' ---
|
||||
@@ -243,7 +246,7 @@ float(12299877)
|
||||
--- testing: '123e5' - '3.4a' ---
|
||||
float(12299996.6)
|
||||
--- testing: '123e5' - 'a5.9' ---
|
||||
float(12300000)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '123e5xyz' - '0' ---
|
||||
float(12300000)
|
||||
--- testing: '123e5xyz' - '65' ---
|
||||
@@ -255,7 +258,7 @@ float(12299998.8)
|
||||
--- testing: '123e5xyz' - '-7.7' ---
|
||||
float(12300007.7)
|
||||
--- testing: '123e5xyz' - 'abc' ---
|
||||
float(12300000)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '123e5xyz' - '123abc' ---
|
||||
float(12299877)
|
||||
--- testing: '123e5xyz' - '123e5' ---
|
||||
@@ -271,7 +274,7 @@ float(12299877)
|
||||
--- testing: '123e5xyz' - '3.4a' ---
|
||||
float(12299996.6)
|
||||
--- testing: '123e5xyz' - 'a5.9' ---
|
||||
float(12300000)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: ' 123abc' - '0' ---
|
||||
int(123)
|
||||
--- testing: ' 123abc' - '65' ---
|
||||
@@ -283,7 +286,7 @@ float(121.8)
|
||||
--- testing: ' 123abc' - '-7.7' ---
|
||||
float(130.7)
|
||||
--- testing: ' 123abc' - 'abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: ' 123abc' - '123abc' ---
|
||||
int(0)
|
||||
--- testing: ' 123abc' - '123e5' ---
|
||||
@@ -299,7 +302,7 @@ int(0)
|
||||
--- testing: ' 123abc' - '3.4a' ---
|
||||
float(119.6)
|
||||
--- testing: ' 123abc' - 'a5.9' ---
|
||||
int(123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '123 abc' - '0' ---
|
||||
int(123)
|
||||
--- testing: '123 abc' - '65' ---
|
||||
@@ -311,7 +314,7 @@ float(121.8)
|
||||
--- testing: '123 abc' - '-7.7' ---
|
||||
float(130.7)
|
||||
--- testing: '123 abc' - 'abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '123 abc' - '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123 abc' - '123e5' ---
|
||||
@@ -327,7 +330,7 @@ int(0)
|
||||
--- testing: '123 abc' - '3.4a' ---
|
||||
float(119.6)
|
||||
--- testing: '123 abc' - 'a5.9' ---
|
||||
int(123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '123abc ' - '0' ---
|
||||
int(123)
|
||||
--- testing: '123abc ' - '65' ---
|
||||
@@ -339,7 +342,7 @@ float(121.8)
|
||||
--- testing: '123abc ' - '-7.7' ---
|
||||
float(130.7)
|
||||
--- testing: '123abc ' - 'abc' ---
|
||||
int(123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '123abc ' - '123abc' ---
|
||||
int(0)
|
||||
--- testing: '123abc ' - '123e5' ---
|
||||
@@ -355,7 +358,7 @@ int(0)
|
||||
--- testing: '123abc ' - '3.4a' ---
|
||||
float(119.6)
|
||||
--- testing: '123abc ' - 'a5.9' ---
|
||||
int(123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '3.4a' - '0' ---
|
||||
float(3.4)
|
||||
--- testing: '3.4a' - '65' ---
|
||||
@@ -367,7 +370,7 @@ float(2.2)
|
||||
--- testing: '3.4a' - '-7.7' ---
|
||||
float(11.1)
|
||||
--- testing: '3.4a' - 'abc' ---
|
||||
float(3.4)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: '3.4a' - '123abc' ---
|
||||
float(-119.6)
|
||||
--- testing: '3.4a' - '123e5' ---
|
||||
@@ -383,32 +386,32 @@ float(-119.6)
|
||||
--- testing: '3.4a' - '3.4a' ---
|
||||
float(0)
|
||||
--- testing: '3.4a' - 'a5.9' ---
|
||||
float(3.4)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - '0' ---
|
||||
int(0)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - '65' ---
|
||||
int(-65)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - '-44' ---
|
||||
int(44)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - '1.2' ---
|
||||
float(-1.2)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - '-7.7' ---
|
||||
float(7.7)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - 'abc' ---
|
||||
int(0)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - '123abc' ---
|
||||
int(-123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - '123e5' ---
|
||||
float(-12300000)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - '123e5xyz' ---
|
||||
float(-12300000)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - ' 123abc' ---
|
||||
int(-123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - '123 abc' ---
|
||||
int(-123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - '123abc ' ---
|
||||
int(-123)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - '3.4a' ---
|
||||
float(-3.4)
|
||||
Unsupported operand types: string - string
|
||||
--- testing: 'a5.9' - 'a5.9' ---
|
||||
int(0)
|
||||
Unsupported operand types: string - string
|
||||
|
||||
@@ -6,20 +6,20 @@ $array = array('expected_array' => "foobar");
|
||||
var_dump(isset($array['expected_array']));
|
||||
var_dump($array['expected_array']);
|
||||
var_dump(isset($array['expected_array']['foo']));
|
||||
var_dump($array['expected_array']['foo']);
|
||||
var_dump($array['expected_array']['0foo']);
|
||||
var_dump(isset($array['expected_array']['foo']['bar']));
|
||||
var_dump($array['expected_array']['foo']['bar']);
|
||||
var_dump($array['expected_array']['0foo']['0bar']);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
string(6) "foobar"
|
||||
bool(false)
|
||||
|
||||
Warning: Illegal string offset "foo" in %s on line %d
|
||||
Warning: Illegal string offset "0foo" in %s on line %d
|
||||
string(1) "f"
|
||||
bool(false)
|
||||
|
||||
Warning: Illegal string offset "foo" in %s on line %d
|
||||
Warning: Illegal string offset "0foo" in %s on line %d
|
||||
|
||||
Warning: Illegal string offset "bar" in %s on line %d
|
||||
Warning: Illegal string offset "0bar" in %s on line %d
|
||||
string(1) "f"
|
||||
|
||||
@@ -9,17 +9,19 @@ var_dump($string[0]);
|
||||
var_dump($string[1]);
|
||||
var_dump(isset($string[0]));
|
||||
var_dump(isset($string[0][0]));
|
||||
var_dump($string["foo"]);
|
||||
try {
|
||||
var_dump($string["foo"]);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
var_dump(isset($string["foo"]["bar"]));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
string(1) "B"
|
||||
string(1) "f"
|
||||
string(1) "o"
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
Warning: Illegal string offset "foo" in %s on line %d
|
||||
string(1) "f"
|
||||
Cannot access offset of type string on string
|
||||
bool(false)
|
||||
|
||||
Reference in New Issue
Block a user