diff options
author | George Peter Banyard <girgias@php.net> | 2020-07-29 02:51:09 +0100 |
---|---|---|
committer | George Peter Banyard <girgias@php.net> | 2020-07-29 02:51:09 +0100 |
commit | b2248789ed21300aaf356336bf43b6b065183fcb (patch) | |
tree | c61dba0a43f72d27904e956318f911c7dc719dda /tests | |
parent | f759936591c08d9bff6ab707f2f8c192f61b5bf1 (diff) | |
download | php-git-b2248789ed21300aaf356336bf43b6b065183fcb.tar.gz |
Implement 'Saner Numeric Strings' RFC:
RFC: https://wiki.php.net/rfc/saner-numeric-strings
This removes the -1 allow_error mode from is_numeric_string functions and replaces it by
a trailing boolean out argument to preserve BC in a couple of places.
Most of the changes can be resumed to "numeric" strings which emitted a E_NOTICE now emit
a E_WARNING and "numeric" strings which emitted a E_WARNING now throw a TypeError.
This mostly affects:
- String offsets
- Arithmetic operations
- Bitwise operations
Closes GH-5762
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lang/bug19943.phpt | 4 | ||||
-rw-r--r-- | tests/lang/bug28800.phpt | 30 | ||||
-rw-r--r-- | tests/lang/bug29566.phpt | 4 | ||||
-rw-r--r-- | tests/lang/operators/add_variationStr.phpt | 117 | ||||
-rw-r--r-- | tests/lang/operators/bitwiseShiftLeft_variationStr.phpt | 154 | ||||
-rw-r--r-- | tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt | 156 | ||||
-rw-r--r-- | tests/lang/operators/bitwiseShiftRight_variationStr.phpt | 156 | ||||
-rw-r--r-- | tests/lang/operators/divide_variationStr.phpt | 508 | ||||
-rw-r--r-- | tests/lang/operators/modulus_variationStr.phpt | 132 | ||||
-rw-r--r-- | tests/lang/operators/multiply_variationStr.phpt | 117 | ||||
-rw-r--r-- | tests/lang/operators/negate_variationStr.phpt | 29 | ||||
-rw-r--r-- | tests/lang/operators/subtract_variationStr.phpt | 117 | ||||
-rw-r--r-- | tests/strings/offsets_chaining_5.phpt | 10 | ||||
-rw-r--r-- | tests/strings/offsets_general.phpt | 12 |
14 files changed, 777 insertions, 769 deletions
diff --git a/tests/lang/bug19943.phpt b/tests/lang/bug19943.phpt index 2266e09165..10d2740319 100644 --- a/tests/lang/bug19943.phpt +++ b/tests/lang/bug19943.phpt @@ -5,11 +5,11 @@ Bug #19943 (memleaks) $ar = array(); for ($count = 0; $count < 10; $count++) { $ar[$count] = "$count"; - @$ar[$count]['idx'] = "$count"; + @$ar[$count]['0idx'] = "$count"; } for ($count = 0; $count < 10; $count++) { - echo $ar[$count]." -- ".@$ar[$count]['idx']."\n"; + echo $ar[$count]." -- ".@$ar[$count]['0idx']."\n"; } $a = "0123456789"; $a[9] = $a[0]; diff --git a/tests/lang/bug28800.phpt b/tests/lang/bug28800.phpt index 2845ca7c88..487c57d24e 100644 --- a/tests/lang/bug28800.phpt +++ b/tests/lang/bug28800.phpt @@ -4,24 +4,18 @@ Bug #28800 (Incorrect string to number conversion for strings starting with 'inf <?php $strings = array('into', 'info', 'inf', 'infinity', 'infin', 'inflammable'); foreach ($strings as $v) { - echo ($v+0)."\n"; + try { + echo ($v+0)."\n"; + } catch (\TypeError $e) { + echo $e->getMessage() . \PHP_EOL; + } } ?> ---EXPECTF-- -Warning: A non-numeric value encountered in %s on line %d -0 +--EXPECT-- +Unsupported operand types: string + int +Unsupported operand types: string + int +Unsupported operand types: string + int +Unsupported operand types: string + int +Unsupported operand types: string + int +Unsupported operand types: string + int -Warning: A non-numeric value encountered in %s on line %d -0 - -Warning: A non-numeric value encountered in %s on line %d -0 - -Warning: A non-numeric value encountered in %s on line %d -0 - -Warning: A non-numeric value encountered in %s on line %d -0 - -Warning: A non-numeric value encountered in %s on line %d -0 diff --git a/tests/lang/bug29566.phpt b/tests/lang/bug29566.phpt index c80d1af28f..9548e47875 100644 --- a/tests/lang/bug29566.phpt +++ b/tests/lang/bug29566.phpt @@ -7,10 +7,10 @@ $var="This is a string"; $dummy=""; unset($dummy); -foreach($var['nosuchkey'] as $v) { +foreach($var['0nosuchkey'] as $v) { } ?> --EXPECTF-- -Warning: Illegal string offset "nosuchkey" in %s on line %d +Warning: Illegal string offset "0nosuchkey" in %s on line %d Warning: foreach() argument must be of type array|object, string given in %sbug29566.php on line %d diff --git a/tests/lang/operators/add_variationStr.phpt b/tests/lang/operators/add_variationStr.phpt index 69dd870dcc..9f8f19dadb 100644 --- a/tests/lang/operators/add_variationStr.phpt +++ b/tests/lang/operators/add_variationStr.phpt @@ -11,13 +11,16 @@ $strVals = array( error_reporting(E_ERROR); foreach ($strVals as $strVal) { - foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' + '$otherVal' ---\n"; - var_dump($strVal+$otherVal); - } + foreach($strVals as $otherVal) { + echo "--- testing: '$strVal' + '$otherVal' ---\n"; + try { + var_dump($strVal+$otherVal); + } catch (\TypeError $e) { + echo $e->getMessage() . \PHP_EOL; + } + } } - ?> --EXPECT-- --- testing: '0' + '0' --- @@ -31,7 +34,7 @@ float(1.2) --- testing: '0' + '-7.7' --- float(-7.7) --- testing: '0' + 'abc' --- -int(0) +Unsupported operand types: string + string --- testing: '0' + '123abc' --- int(123) --- testing: '0' + '123e5' --- @@ -47,7 +50,7 @@ int(123) --- testing: '0' + '3.4a' --- float(3.4) --- testing: '0' + 'a5.9' --- -int(0) +Unsupported operand types: string + string --- testing: '65' + '0' --- int(65) --- testing: '65' + '65' --- @@ -59,7 +62,7 @@ float(66.2) --- testing: '65' + '-7.7' --- float(57.3) --- testing: '65' + 'abc' --- -int(65) +Unsupported operand types: string + string --- testing: '65' + '123abc' --- int(188) --- testing: '65' + '123e5' --- @@ -75,7 +78,7 @@ int(188) --- testing: '65' + '3.4a' --- float(68.4) --- testing: '65' + 'a5.9' --- -int(65) +Unsupported operand types: string + string --- testing: '-44' + '0' --- int(-44) --- testing: '-44' + '65' --- @@ -87,7 +90,7 @@ float(-42.8) --- testing: '-44' + '-7.7' --- float(-51.7) --- testing: '-44' + 'abc' --- -int(-44) +Unsupported operand types: string + string --- testing: '-44' + '123abc' --- int(79) --- testing: '-44' + '123e5' --- @@ -103,7 +106,7 @@ int(79) --- testing: '-44' + '3.4a' --- float(-40.6) --- testing: '-44' + 'a5.9' --- -int(-44) +Unsupported operand types: string + string --- testing: '1.2' + '0' --- float(1.2) --- testing: '1.2' + '65' --- @@ -115,7 +118,7 @@ float(2.4) --- testing: '1.2' + '-7.7' --- float(-6.5) --- testing: '1.2' + 'abc' --- -float(1.2) +Unsupported operand types: string + string --- testing: '1.2' + '123abc' --- float(124.2) --- testing: '1.2' + '123e5' --- @@ -131,7 +134,7 @@ float(124.2) --- testing: '1.2' + '3.4a' --- float(4.6) --- testing: '1.2' + 'a5.9' --- -float(1.2) +Unsupported operand types: string + string --- testing: '-7.7' + '0' --- float(-7.7) --- testing: '-7.7' + '65' --- @@ -143,7 +146,7 @@ float(-6.5) --- testing: '-7.7' + '-7.7' --- float(-15.4) --- testing: '-7.7' + 'abc' --- -float(-7.7) +Unsupported operand types: string + string --- testing: '-7.7' + '123abc' --- float(115.3) --- testing: '-7.7' + '123e5' --- @@ -159,35 +162,35 @@ float(115.3) --- testing: '-7.7' + '3.4a' --- float(-4.300000000000001) --- testing: '-7.7' + 'a5.9' --- -float(-7.7) +Unsupported operand types: string + string --- testing: 'abc' + '0' --- -int(0) +Unsupported operand types: string + string --- testing: 'abc' + '65' --- -int(65) +Unsupported operand types: string + string --- testing: 'abc' + '-44' --- -int(-44) +Unsupported operand types: string + string --- testing: 'abc' + '1.2' --- -float(1.2) +Unsupported operand types: string + string --- testing: 'abc' + '-7.7' --- -float(-7.7) +Unsupported operand types: string + string --- testing: 'abc' + 'abc' --- -int(0) +Unsupported operand types: string + string --- testing: 'abc' + '123abc' --- -int(123) +Unsupported operand types: string + string --- testing: 'abc' + '123e5' --- -float(12300000) +Unsupported operand types: string + string --- testing: 'abc' + '123e5xyz' --- -float(12300000) +Unsupported operand types: string + string --- testing: 'abc' + ' 123abc' --- -int(123) +Unsupported operand types: string + string --- testing: 'abc' + '123 abc' --- -int(123) +Unsupported operand types: string + string --- testing: 'abc' + '123abc ' --- -int(123) +Unsupported operand types: string + string --- testing: 'abc' + '3.4a' --- -float(3.4) +Unsupported operand types: string + string --- testing: 'abc' + 'a5.9' --- -int(0) +Unsupported operand types: string + string --- testing: '123abc' + '0' --- int(123) --- testing: '123abc' + '65' --- @@ -199,7 +202,7 @@ float(124.2) --- testing: '123abc' + '-7.7' --- float(115.3) --- testing: '123abc' + 'abc' --- -int(123) +Unsupported operand types: string + string --- testing: '123abc' + '123abc' --- int(246) --- testing: '123abc' + '123e5' --- @@ -215,7 +218,7 @@ int(246) --- testing: '123abc' + '3.4a' --- float(126.4) --- testing: '123abc' + 'a5.9' --- -int(123) +Unsupported operand types: string + string --- testing: '123e5' + '0' --- float(12300000) --- testing: '123e5' + '65' --- @@ -227,7 +230,7 @@ float(12300001.2) --- testing: '123e5' + '-7.7' --- float(12299992.3) --- testing: '123e5' + 'abc' --- -float(12300000) +Unsupported operand types: string + string --- testing: '123e5' + '123abc' --- float(12300123) --- testing: '123e5' + '123e5' --- @@ -243,7 +246,7 @@ float(12300123) --- testing: '123e5' + '3.4a' --- float(12300003.4) --- testing: '123e5' + 'a5.9' --- -float(12300000) +Unsupported operand types: string + string --- testing: '123e5xyz' + '0' --- float(12300000) --- testing: '123e5xyz' + '65' --- @@ -255,7 +258,7 @@ float(12300001.2) --- testing: '123e5xyz' + '-7.7' --- float(12299992.3) --- testing: '123e5xyz' + 'abc' --- -float(12300000) +Unsupported operand types: string + string --- testing: '123e5xyz' + '123abc' --- float(12300123) --- testing: '123e5xyz' + '123e5' --- @@ -271,7 +274,7 @@ float(12300123) --- testing: '123e5xyz' + '3.4a' --- float(12300003.4) --- testing: '123e5xyz' + 'a5.9' --- -float(12300000) +Unsupported operand types: string + string --- testing: ' 123abc' + '0' --- int(123) --- testing: ' 123abc' + '65' --- @@ -283,7 +286,7 @@ float(124.2) --- testing: ' 123abc' + '-7.7' --- float(115.3) --- testing: ' 123abc' + 'abc' --- -int(123) +Unsupported operand types: string + string --- testing: ' 123abc' + '123abc' --- int(246) --- testing: ' 123abc' + '123e5' --- @@ -299,7 +302,7 @@ int(246) --- testing: ' 123abc' + '3.4a' --- float(126.4) --- testing: ' 123abc' + 'a5.9' --- -int(123) +Unsupported operand types: string + string --- testing: '123 abc' + '0' --- int(123) --- testing: '123 abc' + '65' --- @@ -311,7 +314,7 @@ float(124.2) --- testing: '123 abc' + '-7.7' --- float(115.3) --- testing: '123 abc' + 'abc' --- -int(123) +Unsupported operand types: string + string --- testing: '123 abc' + '123abc' --- int(246) --- testing: '123 abc' + '123e5' --- @@ -327,7 +330,7 @@ int(246) --- testing: '123 abc' + '3.4a' --- float(126.4) --- testing: '123 abc' + 'a5.9' --- -int(123) +Unsupported operand types: string + string --- testing: '123abc ' + '0' --- int(123) --- testing: '123abc ' + '65' --- @@ -339,7 +342,7 @@ float(124.2) --- testing: '123abc ' + '-7.7' --- float(115.3) --- testing: '123abc ' + 'abc' --- -int(123) +Unsupported operand types: string + string --- testing: '123abc ' + '123abc' --- int(246) --- testing: '123abc ' + '123e5' --- @@ -355,7 +358,7 @@ int(246) --- testing: '123abc ' + '3.4a' --- float(126.4) --- testing: '123abc ' + 'a5.9' --- -int(123) +Unsupported operand types: string + string --- testing: '3.4a' + '0' --- float(3.4) --- testing: '3.4a' + '65' --- @@ -367,7 +370,7 @@ float(4.6) --- testing: '3.4a' + '-7.7' --- float(-4.300000000000001) --- testing: '3.4a' + 'abc' --- -float(3.4) +Unsupported operand types: string + string --- testing: '3.4a' + '123abc' --- float(126.4) --- testing: '3.4a' + '123e5' --- @@ -383,32 +386,32 @@ float(126.4) --- testing: '3.4a' + '3.4a' --- float(6.8) --- testing: '3.4a' + 'a5.9' --- -float(3.4) +Unsupported operand types: string + string --- testing: 'a5.9' + '0' --- -int(0) +Unsupported operand types: string + string --- testing: 'a5.9' + '65' --- -int(65) +Unsupported operand types: string + string --- testing: 'a5.9' + '-44' --- -int(-44) +Unsupported operand types: string + string --- testing: 'a5.9' + '1.2' --- -float(1.2) +Unsupported operand types: string + string --- testing: 'a5.9' + '-7.7' --- -float(-7.7) +Unsupported operand types: string + string --- testing: 'a5.9' + 'abc' --- -int(0) +Unsupported operand types: string + string --- testing: 'a5.9' + '123abc' --- -int(123) +Unsupported operand types: string + string --- testing: 'a5.9' + '123e5' --- -float(12300000) +Unsupported operand types: string + string --- testing: 'a5.9' + '123e5xyz' --- -float(12300000) +Unsupported operand types: string + string --- testing: 'a5.9' + ' 123abc' --- -int(123) +Unsupported operand types: string + string --- testing: 'a5.9' + '123 abc' --- -int(123) +Unsupported operand types: string + string --- testing: 'a5.9' + '123abc ' --- -int(123) +Unsupported operand types: string + string --- testing: 'a5.9' + '3.4a' --- -float(3.4) +Unsupported operand types: string + string --- testing: 'a5.9' + 'a5.9' --- -int(0) +Unsupported operand types: string + string diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt index 49de21f64b..cf227ddf8f 100644 --- a/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt +++ b/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt @@ -16,7 +16,7 @@ foreach ($strVals as $strVal) { try { var_dump($strVal<<$otherVal); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo get_class($e) . ': ' . $e->getMessage() . "\n"; } } } @@ -28,13 +28,13 @@ int(0) --- testing: '0' << '65' --- int(0) --- testing: '0' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '0' << '1.2' --- int(0) --- testing: '0' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '0' << 'abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: '0' << '123abc' --- int(0) --- testing: '0' << '123e5' --- @@ -50,19 +50,19 @@ int(0) --- testing: '0' << '3.4a' --- int(0) --- testing: '0' << 'a5.9' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: '65' << '0' --- int(65) --- testing: '65' << '65' --- int(0) --- testing: '65' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '65' << '1.2' --- int(130) --- testing: '65' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '65' << 'abc' --- -int(65) +TypeError: Unsupported operand types: string << string --- testing: '65' << '123abc' --- int(0) --- testing: '65' << '123e5' --- @@ -78,19 +78,19 @@ int(0) --- testing: '65' << '3.4a' --- int(520) --- testing: '65' << 'a5.9' --- -int(65) +TypeError: Unsupported operand types: string << string --- testing: '-44' << '0' --- int(-44) --- testing: '-44' << '65' --- int(0) --- testing: '-44' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '-44' << '1.2' --- int(-88) --- testing: '-44' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '-44' << 'abc' --- -int(-44) +TypeError: Unsupported operand types: string << string --- testing: '-44' << '123abc' --- int(0) --- testing: '-44' << '123e5' --- @@ -106,19 +106,19 @@ int(0) --- testing: '-44' << '3.4a' --- int(-352) --- testing: '-44' << 'a5.9' --- -int(-44) +TypeError: Unsupported operand types: string << string --- testing: '1.2' << '0' --- int(1) --- testing: '1.2' << '65' --- int(0) --- testing: '1.2' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '1.2' << '1.2' --- int(2) --- testing: '1.2' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '1.2' << 'abc' --- -int(1) +TypeError: Unsupported operand types: string << string --- testing: '1.2' << '123abc' --- int(0) --- testing: '1.2' << '123e5' --- @@ -134,19 +134,19 @@ int(0) --- testing: '1.2' << '3.4a' --- int(8) --- testing: '1.2' << 'a5.9' --- -int(1) +TypeError: Unsupported operand types: string << string --- testing: '-7.7' << '0' --- int(-7) --- testing: '-7.7' << '65' --- int(0) --- testing: '-7.7' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '-7.7' << '1.2' --- int(-14) --- testing: '-7.7' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '-7.7' << 'abc' --- -int(-7) +TypeError: Unsupported operand types: string << string --- testing: '-7.7' << '123abc' --- int(0) --- testing: '-7.7' << '123e5' --- @@ -162,47 +162,47 @@ int(0) --- testing: '-7.7' << '3.4a' --- int(-56) --- testing: '-7.7' << 'a5.9' --- -int(-7) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '0' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '65' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '-44' --- -Exception: Bit shift by negative number +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '1.2' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '-7.7' --- -Exception: Bit shift by negative number +TypeError: Unsupported operand types: string << string --- testing: 'abc' << 'abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '123abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '123e5' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '123e5xyz' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << ' 123abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '123 abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '123abc ' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '3.4a' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << 'a5.9' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: '123abc' << '0' --- int(123) --- testing: '123abc' << '65' --- int(0) --- testing: '123abc' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123abc' << '1.2' --- int(246) --- testing: '123abc' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123abc' << 'abc' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '123abc' << '123abc' --- int(0) --- testing: '123abc' << '123e5' --- @@ -218,19 +218,19 @@ int(0) --- testing: '123abc' << '3.4a' --- int(984) --- testing: '123abc' << 'a5.9' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '123e5' << '0' --- int(12300000) --- testing: '123e5' << '65' --- int(0) --- testing: '123e5' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123e5' << '1.2' --- int(24600000) --- testing: '123e5' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123e5' << 'abc' --- -int(12300000) +TypeError: Unsupported operand types: string << string --- testing: '123e5' << '123abc' --- int(0) --- testing: '123e5' << '123e5' --- @@ -246,19 +246,19 @@ int(0) --- testing: '123e5' << '3.4a' --- int(98400000) --- testing: '123e5' << 'a5.9' --- -int(12300000) +TypeError: Unsupported operand types: string << string --- testing: '123e5xyz' << '0' --- int(12300000) --- testing: '123e5xyz' << '65' --- int(0) --- testing: '123e5xyz' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123e5xyz' << '1.2' --- int(24600000) --- testing: '123e5xyz' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123e5xyz' << 'abc' --- -int(12300000) +TypeError: Unsupported operand types: string << string --- testing: '123e5xyz' << '123abc' --- int(0) --- testing: '123e5xyz' << '123e5' --- @@ -274,19 +274,19 @@ int(0) --- testing: '123e5xyz' << '3.4a' --- int(98400000) --- testing: '123e5xyz' << 'a5.9' --- -int(12300000) +TypeError: Unsupported operand types: string << string --- testing: ' 123abc' << '0' --- int(123) --- testing: ' 123abc' << '65' --- int(0) --- testing: ' 123abc' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: ' 123abc' << '1.2' --- int(246) --- testing: ' 123abc' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: ' 123abc' << 'abc' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: ' 123abc' << '123abc' --- int(0) --- testing: ' 123abc' << '123e5' --- @@ -302,19 +302,19 @@ int(0) --- testing: ' 123abc' << '3.4a' --- int(984) --- testing: ' 123abc' << 'a5.9' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '123 abc' << '0' --- int(123) --- testing: '123 abc' << '65' --- int(0) --- testing: '123 abc' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123 abc' << '1.2' --- int(246) --- testing: '123 abc' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123 abc' << 'abc' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '123 abc' << '123abc' --- int(0) --- testing: '123 abc' << '123e5' --- @@ -330,19 +330,19 @@ int(0) --- testing: '123 abc' << '3.4a' --- int(984) --- testing: '123 abc' << 'a5.9' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '123abc ' << '0' --- int(123) --- testing: '123abc ' << '65' --- int(0) --- testing: '123abc ' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123abc ' << '1.2' --- int(246) --- testing: '123abc ' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123abc ' << 'abc' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '123abc ' << '123abc' --- int(0) --- testing: '123abc ' << '123e5' --- @@ -358,19 +358,19 @@ int(0) --- testing: '123abc ' << '3.4a' --- int(984) --- testing: '123abc ' << 'a5.9' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '3.4a' << '0' --- int(3) --- testing: '3.4a' << '65' --- int(0) --- testing: '3.4a' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '3.4a' << '1.2' --- int(6) --- testing: '3.4a' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '3.4a' << 'abc' --- -int(3) +TypeError: Unsupported operand types: string << string --- testing: '3.4a' << '123abc' --- int(0) --- testing: '3.4a' << '123e5' --- @@ -386,32 +386,32 @@ int(0) --- testing: '3.4a' << '3.4a' --- int(24) --- testing: '3.4a' << 'a5.9' --- -int(3) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '0' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '65' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '-44' --- -Exception: Bit shift by negative number +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '1.2' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '-7.7' --- -Exception: Bit shift by negative number +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << 'abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '123abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '123e5' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '123e5xyz' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << ' 123abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '123 abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '123abc ' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '3.4a' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << 'a5.9' --- -int(0) +TypeError: Unsupported operand types: string << string diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt index b3ca624abb..c3e7af9892 100644 --- a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt +++ b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt @@ -19,8 +19,8 @@ foreach ($strVals as $strVal) { echo "--- testing: '$strVal' << '$otherVal' ---\n"; try { var_dump($strVal<<$otherVal); - } catch (ArithmeticError $e) { - echo "Exception: " . $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo get_class($e) . ': ' . $e->getMessage() . "\n"; } } } @@ -33,13 +33,13 @@ int(0) --- testing: '0' << '65' --- int(0) --- testing: '0' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '0' << '1.2' --- int(0) --- testing: '0' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '0' << 'abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: '0' << '123abc' --- int(0) --- testing: '0' << '123e5' --- @@ -55,19 +55,19 @@ int(0) --- testing: '0' << '3.4a' --- int(0) --- testing: '0' << 'a5.9' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: '65' << '0' --- int(65) --- testing: '65' << '65' --- int(0) --- testing: '65' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '65' << '1.2' --- int(130) --- testing: '65' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '65' << 'abc' --- -int(65) +TypeError: Unsupported operand types: string << string --- testing: '65' << '123abc' --- int(0) --- testing: '65' << '123e5' --- @@ -83,19 +83,19 @@ int(0) --- testing: '65' << '3.4a' --- int(520) --- testing: '65' << 'a5.9' --- -int(65) +TypeError: Unsupported operand types: string << string --- testing: '-44' << '0' --- int(-44) --- testing: '-44' << '65' --- int(0) --- testing: '-44' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '-44' << '1.2' --- int(-88) --- testing: '-44' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '-44' << 'abc' --- -int(-44) +TypeError: Unsupported operand types: string << string --- testing: '-44' << '123abc' --- int(0) --- testing: '-44' << '123e5' --- @@ -111,19 +111,19 @@ int(0) --- testing: '-44' << '3.4a' --- int(-352) --- testing: '-44' << 'a5.9' --- -int(-44) +TypeError: Unsupported operand types: string << string --- testing: '1.2' << '0' --- int(1) --- testing: '1.2' << '65' --- int(0) --- testing: '1.2' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '1.2' << '1.2' --- int(2) --- testing: '1.2' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '1.2' << 'abc' --- -int(1) +TypeError: Unsupported operand types: string << string --- testing: '1.2' << '123abc' --- int(0) --- testing: '1.2' << '123e5' --- @@ -139,19 +139,19 @@ int(0) --- testing: '1.2' << '3.4a' --- int(8) --- testing: '1.2' << 'a5.9' --- -int(1) +TypeError: Unsupported operand types: string << string --- testing: '-7.7' << '0' --- int(-7) --- testing: '-7.7' << '65' --- int(0) --- testing: '-7.7' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '-7.7' << '1.2' --- int(-14) --- testing: '-7.7' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '-7.7' << 'abc' --- -int(-7) +TypeError: Unsupported operand types: string << string --- testing: '-7.7' << '123abc' --- int(0) --- testing: '-7.7' << '123e5' --- @@ -167,47 +167,47 @@ int(0) --- testing: '-7.7' << '3.4a' --- int(-56) --- testing: '-7.7' << 'a5.9' --- -int(-7) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '0' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '65' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '-44' --- -Exception: Bit shift by negative number +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '1.2' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '-7.7' --- -Exception: Bit shift by negative number +TypeError: Unsupported operand types: string << string --- testing: 'abc' << 'abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '123abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '123e5' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '123e5xyz' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << ' 123abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '123 abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '123abc ' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << '3.4a' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'abc' << 'a5.9' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: '123abc' << '0' --- int(123) --- testing: '123abc' << '65' --- int(0) --- testing: '123abc' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123abc' << '1.2' --- int(246) --- testing: '123abc' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123abc' << 'abc' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '123abc' << '123abc' --- int(0) --- testing: '123abc' << '123e5' --- @@ -223,19 +223,19 @@ int(0) --- testing: '123abc' << '3.4a' --- int(984) --- testing: '123abc' << 'a5.9' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '123e5' << '0' --- int(12300000) --- testing: '123e5' << '65' --- int(0) --- testing: '123e5' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123e5' << '1.2' --- int(24600000) --- testing: '123e5' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123e5' << 'abc' --- -int(12300000) +TypeError: Unsupported operand types: string << string --- testing: '123e5' << '123abc' --- int(0) --- testing: '123e5' << '123e5' --- @@ -251,19 +251,19 @@ int(0) --- testing: '123e5' << '3.4a' --- int(98400000) --- testing: '123e5' << 'a5.9' --- -int(12300000) +TypeError: Unsupported operand types: string << string --- testing: '123e5xyz' << '0' --- int(12300000) --- testing: '123e5xyz' << '65' --- int(0) --- testing: '123e5xyz' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123e5xyz' << '1.2' --- int(24600000) --- testing: '123e5xyz' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123e5xyz' << 'abc' --- -int(12300000) +TypeError: Unsupported operand types: string << string --- testing: '123e5xyz' << '123abc' --- int(0) --- testing: '123e5xyz' << '123e5' --- @@ -279,19 +279,19 @@ int(0) --- testing: '123e5xyz' << '3.4a' --- int(98400000) --- testing: '123e5xyz' << 'a5.9' --- -int(12300000) +TypeError: Unsupported operand types: string << string --- testing: ' 123abc' << '0' --- int(123) --- testing: ' 123abc' << '65' --- int(0) --- testing: ' 123abc' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: ' 123abc' << '1.2' --- int(246) --- testing: ' 123abc' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: ' 123abc' << 'abc' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: ' 123abc' << '123abc' --- int(0) --- testing: ' 123abc' << '123e5' --- @@ -307,19 +307,19 @@ int(0) --- testing: ' 123abc' << '3.4a' --- int(984) --- testing: ' 123abc' << 'a5.9' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '123 abc' << '0' --- int(123) --- testing: '123 abc' << '65' --- int(0) --- testing: '123 abc' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123 abc' << '1.2' --- int(246) --- testing: '123 abc' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123 abc' << 'abc' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '123 abc' << '123abc' --- int(0) --- testing: '123 abc' << '123e5' --- @@ -335,19 +335,19 @@ int(0) --- testing: '123 abc' << '3.4a' --- int(984) --- testing: '123 abc' << 'a5.9' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '123abc ' << '0' --- int(123) --- testing: '123abc ' << '65' --- int(0) --- testing: '123abc ' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123abc ' << '1.2' --- int(246) --- testing: '123abc ' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123abc ' << 'abc' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '123abc ' << '123abc' --- int(0) --- testing: '123abc ' << '123e5' --- @@ -363,19 +363,19 @@ int(0) --- testing: '123abc ' << '3.4a' --- int(984) --- testing: '123abc ' << 'a5.9' --- -int(123) +TypeError: Unsupported operand types: string << string --- testing: '3.4a' << '0' --- int(3) --- testing: '3.4a' << '65' --- int(0) --- testing: '3.4a' << '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '3.4a' << '1.2' --- int(6) --- testing: '3.4a' << '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '3.4a' << 'abc' --- -int(3) +TypeError: Unsupported operand types: string << string --- testing: '3.4a' << '123abc' --- int(0) --- testing: '3.4a' << '123e5' --- @@ -391,32 +391,32 @@ int(0) --- testing: '3.4a' << '3.4a' --- int(24) --- testing: '3.4a' << 'a5.9' --- -int(3) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '0' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '65' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '-44' --- -Exception: Bit shift by negative number +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '1.2' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '-7.7' --- -Exception: Bit shift by negative number +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << 'abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '123abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '123e5' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '123e5xyz' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << ' 123abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '123 abc' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '123abc ' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << '3.4a' --- -int(0) +TypeError: Unsupported operand types: string << string --- testing: 'a5.9' << 'a5.9' --- -int(0) +TypeError: Unsupported operand types: string << string diff --git a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt index 525f951a51..d1f124933c 100644 --- a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt +++ b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt @@ -15,8 +15,8 @@ foreach ($strVals as $strVal) { echo "--- testing: '$strVal' >> '$otherVal' ---\n"; try { var_dump($strVal>>$otherVal); - } catch (ArithmeticError $e) { - echo "Exception: " . $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo get_class($e) . ': ' . $e->getMessage() . "\n"; } } } @@ -29,13 +29,13 @@ int(0) --- testing: '0' >> '65' --- int(0) --- testing: '0' >> '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '0' >> '1.2' --- int(0) --- testing: '0' >> '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '0' >> 'abc' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: '0' >> '123abc' --- int(0) --- testing: '0' >> '123e5' --- @@ -51,19 +51,19 @@ int(0) --- testing: '0' >> '3.4a' --- int(0) --- testing: '0' >> 'a5.9' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: '65' >> '0' --- int(65) --- testing: '65' >> '65' --- int(0) --- testing: '65' >> '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '65' >> '1.2' --- int(32) --- testing: '65' >> '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '65' >> 'abc' --- -int(65) +TypeError: Unsupported operand types: string >> string --- testing: '65' >> '123abc' --- int(0) --- testing: '65' >> '123e5' --- @@ -79,19 +79,19 @@ int(0) --- testing: '65' >> '3.4a' --- int(8) --- testing: '65' >> 'a5.9' --- -int(65) +TypeError: Unsupported operand types: string >> string --- testing: '-44' >> '0' --- int(-44) --- testing: '-44' >> '65' --- int(-1) --- testing: '-44' >> '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '-44' >> '1.2' --- int(-22) --- testing: '-44' >> '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '-44' >> 'abc' --- -int(-44) +TypeError: Unsupported operand types: string >> string --- testing: '-44' >> '123abc' --- int(-1) --- testing: '-44' >> '123e5' --- @@ -107,19 +107,19 @@ int(-1) --- testing: '-44' >> '3.4a' --- int(-6) --- testing: '-44' >> 'a5.9' --- -int(-44) +TypeError: Unsupported operand types: string >> string --- testing: '1.2' >> '0' --- int(1) --- testing: '1.2' >> '65' --- int(0) --- testing: '1.2' >> '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '1.2' >> '1.2' --- int(0) --- testing: '1.2' >> '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '1.2' >> 'abc' --- -int(1) +TypeError: Unsupported operand types: string >> string --- testing: '1.2' >> '123abc' --- int(0) --- testing: '1.2' >> '123e5' --- @@ -135,19 +135,19 @@ int(0) --- testing: '1.2' >> '3.4a' --- int(0) --- testing: '1.2' >> 'a5.9' --- -int(1) +TypeError: Unsupported operand types: string >> string --- testing: '-7.7' >> '0' --- int(-7) --- testing: '-7.7' >> '65' --- int(-1) --- testing: '-7.7' >> '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '-7.7' >> '1.2' --- int(-4) --- testing: '-7.7' >> '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '-7.7' >> 'abc' --- -int(-7) +TypeError: Unsupported operand types: string >> string --- testing: '-7.7' >> '123abc' --- int(-1) --- testing: '-7.7' >> '123e5' --- @@ -163,47 +163,47 @@ int(-1) --- testing: '-7.7' >> '3.4a' --- int(-1) --- testing: '-7.7' >> 'a5.9' --- -int(-7) +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> '0' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> '65' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> '-44' --- -Exception: Bit shift by negative number +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> '1.2' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> '-7.7' --- -Exception: Bit shift by negative number +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> 'abc' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> '123abc' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> '123e5' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> '123e5xyz' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> ' 123abc' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> '123 abc' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> '123abc ' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> '3.4a' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'abc' >> 'a5.9' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: '123abc' >> '0' --- int(123) --- testing: '123abc' >> '65' --- int(0) --- testing: '123abc' >> '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123abc' >> '1.2' --- int(61) --- testing: '123abc' >> '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123abc' >> 'abc' --- -int(123) +TypeError: Unsupported operand types: string >> string --- testing: '123abc' >> '123abc' --- int(0) --- testing: '123abc' >> '123e5' --- @@ -219,19 +219,19 @@ int(0) --- testing: '123abc' >> '3.4a' --- int(15) --- testing: '123abc' >> 'a5.9' --- -int(123) +TypeError: Unsupported operand types: string >> string --- testing: '123e5' >> '0' --- int(12300000) --- testing: '123e5' >> '65' --- int(0) --- testing: '123e5' >> '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123e5' >> '1.2' --- int(6150000) --- testing: '123e5' >> '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123e5' >> 'abc' --- -int(12300000) +TypeError: Unsupported operand types: string >> string --- testing: '123e5' >> '123abc' --- int(0) --- testing: '123e5' >> '123e5' --- @@ -247,19 +247,19 @@ int(0) --- testing: '123e5' >> '3.4a' --- int(1537500) --- testing: '123e5' >> 'a5.9' --- -int(12300000) +TypeError: Unsupported operand types: string >> string --- testing: '123e5xyz' >> '0' --- int(12300000) --- testing: '123e5xyz' >> '65' --- int(0) --- testing: '123e5xyz' >> '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123e5xyz' >> '1.2' --- int(6150000) --- testing: '123e5xyz' >> '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123e5xyz' >> 'abc' --- -int(12300000) +TypeError: Unsupported operand types: string >> string --- testing: '123e5xyz' >> '123abc' --- int(0) --- testing: '123e5xyz' >> '123e5' --- @@ -275,19 +275,19 @@ int(0) --- testing: '123e5xyz' >> '3.4a' --- int(1537500) --- testing: '123e5xyz' >> 'a5.9' --- -int(12300000) +TypeError: Unsupported operand types: string >> string --- testing: ' 123abc' >> '0' --- int(123) --- testing: ' 123abc' >> '65' --- int(0) --- testing: ' 123abc' >> '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: ' 123abc' >> '1.2' --- int(61) --- testing: ' 123abc' >> '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: ' 123abc' >> 'abc' --- -int(123) +TypeError: Unsupported operand types: string >> string --- testing: ' 123abc' >> '123abc' --- int(0) --- testing: ' 123abc' >> '123e5' --- @@ -303,19 +303,19 @@ int(0) --- testing: ' 123abc' >> '3.4a' --- int(15) --- testing: ' 123abc' >> 'a5.9' --- -int(123) +TypeError: Unsupported operand types: string >> string --- testing: '123 abc' >> '0' --- int(123) --- testing: '123 abc' >> '65' --- int(0) --- testing: '123 abc' >> '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123 abc' >> '1.2' --- int(61) --- testing: '123 abc' >> '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123 abc' >> 'abc' --- -int(123) +TypeError: Unsupported operand types: string >> string --- testing: '123 abc' >> '123abc' --- int(0) --- testing: '123 abc' >> '123e5' --- @@ -331,19 +331,19 @@ int(0) --- testing: '123 abc' >> '3.4a' --- int(15) --- testing: '123 abc' >> 'a5.9' --- -int(123) +TypeError: Unsupported operand types: string >> string --- testing: '123abc ' >> '0' --- int(123) --- testing: '123abc ' >> '65' --- int(0) --- testing: '123abc ' >> '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123abc ' >> '1.2' --- int(61) --- testing: '123abc ' >> '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '123abc ' >> 'abc' --- -int(123) +TypeError: Unsupported operand types: string >> string --- testing: '123abc ' >> '123abc' --- int(0) --- testing: '123abc ' >> '123e5' --- @@ -359,19 +359,19 @@ int(0) --- testing: '123abc ' >> '3.4a' --- int(15) --- testing: '123abc ' >> 'a5.9' --- -int(123) +TypeError: Unsupported operand types: string >> string --- testing: '3.4a' >> '0' --- int(3) --- testing: '3.4a' >> '65' --- int(0) --- testing: '3.4a' >> '-44' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '3.4a' >> '1.2' --- int(1) --- testing: '3.4a' >> '-7.7' --- -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number --- testing: '3.4a' >> 'abc' --- -int(3) +TypeError: Unsupported operand types: string >> string --- testing: '3.4a' >> '123abc' --- int(0) --- testing: '3.4a' >> '123e5' --- @@ -387,32 +387,32 @@ int(0) --- testing: '3.4a' >> '3.4a' --- int(0) --- testing: '3.4a' >> 'a5.9' --- -int(3) +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> '0' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> '65' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> '-44' --- -Exception: Bit shift by negative number +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> '1.2' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> '-7.7' --- -Exception: Bit shift by negative number +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> 'abc' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> '123abc' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> '123e5' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> '123e5xyz' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> ' 123abc' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> '123 abc' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> '123abc ' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> '3.4a' --- -int(0) +TypeError: Unsupported operand types: string >> string --- testing: 'a5.9' >> 'a5.9' --- -int(0) +TypeError: Unsupported operand types: string >> string diff --git a/tests/lang/operators/divide_variationStr.phpt b/tests/lang/operators/divide_variationStr.phpt index b3a11591ed..be7118edbd 100644 --- a/tests/lang/operators/divide_variationStr.phpt +++ b/tests/lang/operators/divide_variationStr.phpt @@ -11,404 +11,408 @@ $strVals = array( error_reporting(E_ERROR); foreach ($strVals as $strVal) { - foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' / '$otherVal' ---\n"; - var_dump($strVal/$otherVal); - } + foreach($strVals as $otherVal) { + echo "--- testing: '$strVal'/'$otherVal' ---\n"; + try { + var_dump($strVal/$otherVal); + } catch (\TypeError $e) { + echo $e->getMessage() . \PHP_EOL; + } + } } ?> --EXPECT-- ---- testing: '0' / '0' --- +--- testing: '0'/'0' --- float(NAN) ---- testing: '0' / '65' --- +--- testing: '0'/'65' --- int(0) ---- testing: '0' / '-44' --- +--- testing: '0'/'-44' --- int(0) ---- testing: '0' / '1.2' --- +--- testing: '0'/'1.2' --- float(0) ---- testing: '0' / '-7.7' --- +--- testing: '0'/'-7.7' --- float(-0) ---- testing: '0' / 'abc' --- -float(NAN) ---- testing: '0' / '123abc' --- +--- testing: '0'/'abc' --- +Unsupported operand types: string / string +--- testing: '0'/'123abc' --- int(0) ---- testing: '0' / '123e5' --- +--- testing: '0'/'123e5' --- float(0) ---- testing: '0' / '123e5xyz' --- +--- testing: '0'/'123e5xyz' --- float(0) ---- testing: '0' / ' 123abc' --- +--- testing: '0'/' 123abc' --- int(0) ---- testing: '0' / '123 abc' --- +--- testing: '0'/'123 abc' --- int(0) ---- testing: '0' / '123abc ' --- +--- testing: '0'/'123abc ' --- int(0) ---- testing: '0' / '3.4a' --- +--- testing: '0'/'3.4a' --- float(0) ---- testing: '0' / 'a5.9' --- -float(NAN) ---- testing: '65' / '0' --- +--- testing: '0'/'a5.9' --- +Unsupported operand types: string / string +--- testing: '65'/'0' --- float(INF) ---- testing: '65' / '65' --- +--- testing: '65'/'65' --- int(1) ---- testing: '65' / '-44' --- +--- testing: '65'/'-44' --- float(-1.4772727272727273) ---- testing: '65' / '1.2' --- +--- testing: '65'/'1.2' --- float(54.16666666666667) ---- testing: '65' / '-7.7' --- +--- testing: '65'/'-7.7' --- float(-8.441558441558442) ---- testing: '65' / 'abc' --- -float(INF) ---- testing: '65' / '123abc' --- +--- testing: '65'/'abc' --- +Unsupported operand types: string / string +--- testing: '65'/'123abc' --- float(0.5284552845528455) ---- testing: '65' / '123e5' --- +--- testing: '65'/'123e5' --- float(5.2845528455284555E-6) ---- testing: '65' / '123e5xyz' --- +--- testing: '65'/'123e5xyz' --- float(5.2845528455284555E-6) ---- testing: '65' / ' 123abc' --- +--- testing: '65'/' 123abc' --- float(0.5284552845528455) ---- testing: '65' / '123 abc' --- +--- testing: '65'/'123 abc' --- float(0.5284552845528455) ---- testing: '65' / '123abc ' --- +--- testing: '65'/'123abc ' --- float(0.5284552845528455) ---- testing: '65' / '3.4a' --- +--- testing: '65'/'3.4a' --- float(19.11764705882353) ---- testing: '65' / 'a5.9' --- -float(INF) ---- testing: '-44' / '0' --- +--- testing: '65'/'a5.9' --- +Unsupported operand types: string / string +--- testing: '-44'/'0' --- float(-INF) ---- testing: '-44' / '65' --- +--- testing: '-44'/'65' --- float(-0.676923076923077) ---- testing: '-44' / '-44' --- +--- testing: '-44'/'-44' --- int(1) ---- testing: '-44' / '1.2' --- +--- testing: '-44'/'1.2' --- float(-36.66666666666667) ---- testing: '-44' / '-7.7' --- +--- testing: '-44'/'-7.7' --- float(5.714285714285714) ---- testing: '-44' / 'abc' --- -float(-INF) ---- testing: '-44' / '123abc' --- +--- testing: '-44'/'abc' --- +Unsupported operand types: string / string +--- testing: '-44'/'123abc' --- float(-0.35772357723577236) ---- testing: '-44' / '123e5' --- +--- testing: '-44'/'123e5' --- float(-3.5772357723577236E-6) ---- testing: '-44' / '123e5xyz' --- +--- testing: '-44'/'123e5xyz' --- float(-3.5772357723577236E-6) ---- testing: '-44' / ' 123abc' --- +--- testing: '-44'/' 123abc' --- float(-0.35772357723577236) ---- testing: '-44' / '123 abc' --- +--- testing: '-44'/'123 abc' --- float(-0.35772357723577236) ---- testing: '-44' / '123abc ' --- +--- testing: '-44'/'123abc ' --- float(-0.35772357723577236) ---- testing: '-44' / '3.4a' --- +--- testing: '-44'/'3.4a' --- float(-12.941176470588236) ---- testing: '-44' / 'a5.9' --- -float(-INF) ---- testing: '1.2' / '0' --- +--- testing: '-44'/'a5.9' --- +Unsupported operand types: string / string +--- testing: '1.2'/'0' --- float(INF) ---- testing: '1.2' / '65' --- +--- testing: '1.2'/'65' --- float(0.01846153846153846) ---- testing: '1.2' / '-44' --- +--- testing: '1.2'/'-44' --- float(-0.02727272727272727) ---- testing: '1.2' / '1.2' --- +--- testing: '1.2'/'1.2' --- float(1) ---- testing: '1.2' / '-7.7' --- +--- testing: '1.2'/'-7.7' --- float(-0.15584415584415584) ---- testing: '1.2' / 'abc' --- -float(INF) ---- testing: '1.2' / '123abc' --- +--- testing: '1.2'/'abc' --- +Unsupported operand types: string / string +--- testing: '1.2'/'123abc' --- float(0.00975609756097561) ---- testing: '1.2' / '123e5' --- +--- testing: '1.2'/'123e5' --- float(9.75609756097561E-8) ---- testing: '1.2' / '123e5xyz' --- +--- testing: '1.2'/'123e5xyz' --- float(9.75609756097561E-8) ---- testing: '1.2' / ' 123abc' --- +--- testing: '1.2'/' 123abc' --- float(0.00975609756097561) ---- testing: '1.2' / '123 abc' --- +--- testing: '1.2'/'123 abc' --- float(0.00975609756097561) ---- testing: '1.2' / '123abc ' --- +--- testing: '1.2'/'123abc ' --- float(0.00975609756097561) ---- testing: '1.2' / '3.4a' --- +--- testing: '1.2'/'3.4a' --- float(0.35294117647058826) ---- testing: '1.2' / 'a5.9' --- -float(INF) ---- testing: '-7.7' / '0' --- +--- testing: '1.2'/'a5.9' --- +Unsupported operand types: string / string +--- testing: '-7.7'/'0' --- float(-INF) ---- testing: '-7.7' / '65' --- +--- testing: '-7.7'/'65' --- float(-0.11846153846153847) ---- testing: '-7.7' / '-44' --- +--- testing: '-7.7'/'-44' --- float(0.17500000000000002) ---- testing: '-7.7' / '1.2' --- +--- testing: '-7.7'/'1.2' --- float(-6.416666666666667) ---- testing: '-7.7' / '-7.7' --- +--- testing: '-7.7'/'-7.7' --- float(1) ---- testing: '-7.7' / 'abc' --- -float(-INF) ---- testing: '-7.7' / '123abc' --- +--- testing: '-7.7'/'abc' --- +Unsupported operand types: string / string +--- testing: '-7.7'/'123abc' --- float(-0.06260162601626017) ---- testing: '-7.7' / '123e5' --- +--- testing: '-7.7'/'123e5' --- float(-6.260162601626017E-7) ---- testing: '-7.7' / '123e5xyz' --- +--- testing: '-7.7'/'123e5xyz' --- float(-6.260162601626017E-7) ---- testing: '-7.7' / ' 123abc' --- +--- testing: '-7.7'/' 123abc' --- float(-0.06260162601626017) ---- testing: '-7.7' / '123 abc' --- +--- testing: '-7.7'/'123 abc' --- float(-0.06260162601626017) ---- testing: '-7.7' / '123abc ' --- +--- testing: '-7.7'/'123abc ' --- float(-0.06260162601626017) ---- testing: '-7.7' / '3.4a' --- +--- testing: '-7.7'/'3.4a' --- float(-2.264705882352941) ---- testing: '-7.7' / 'a5.9' --- -float(-INF) ---- testing: 'abc' / '0' --- -float(NAN) ---- testing: 'abc' / '65' --- -int(0) ---- testing: 'abc' / '-44' --- -int(0) ---- testing: 'abc' / '1.2' --- -float(0) ---- testing: 'abc' / '-7.7' --- -float(-0) ---- testing: 'abc' / 'abc' --- -float(NAN) ---- testing: 'abc' / '123abc' --- -int(0) ---- testing: 'abc' / '123e5' --- -float(0) ---- testing: 'abc' / '123e5xyz' --- -float(0) ---- testing: 'abc' / ' 123abc' --- -int(0) ---- testing: 'abc' / '123 abc' --- -int(0) ---- testing: 'abc' / '123abc ' --- -int(0) ---- testing: 'abc' / '3.4a' --- -float(0) ---- testing: 'abc' / 'a5.9' --- -float(NAN) ---- testing: '123abc' / '0' --- +--- testing: '-7.7'/'a5.9' --- +Unsupported operand types: string / string +--- testing: 'abc'/'0' --- +Unsupported operand types: string / string +--- testing: 'abc'/'65' --- +Unsupported operand types: string / string +--- testing: 'abc'/'-44' --- +Unsupported operand types: string / string +--- testing: 'abc'/'1.2' --- +Unsupported operand types: string / string +--- testing: 'abc'/'-7.7' --- +Unsupported operand types: string / string +--- testing: 'abc'/'abc' --- +Unsupported operand types: string / string +--- testing: 'abc'/'123abc' --- +Unsupported operand types: string / string +--- testing: 'abc'/'123e5' --- +Unsupported operand types: string / string +--- testing: 'abc'/'123e5xyz' --- +Unsupported operand types: string / string +--- testing: 'abc'/' 123abc' --- +Unsupported operand types: string / string +--- testing: 'abc'/'123 abc' --- +Unsupported operand types: string / string +--- testing: 'abc'/'123abc ' --- +Unsupported operand types: string / string +--- testing: 'abc'/'3.4a' --- +Unsupported operand types: string / string +--- testing: 'abc'/'a5.9' --- +Unsupported operand types: string / string +--- testing: '123abc'/'0' --- float(INF) ---- testing: '123abc' / '65' --- +--- testing: '123abc'/'65' --- float(1.8923076923076922) ---- testing: '123abc' / '-44' --- +--- testing: '123abc'/'-44' --- float(-2.7954545454545454) ---- testing: '123abc' / '1.2' --- +--- testing: '123abc'/'1.2' --- float(102.5) ---- testing: '123abc' / '-7.7' --- +--- testing: '123abc'/'-7.7' --- float(-15.974025974025974) ---- testing: '123abc' / 'abc' --- -float(INF) ---- testing: '123abc' / '123abc' --- +--- testing: '123abc'/'abc' --- +Unsupported operand types: string / string +--- testing: '123abc'/'123abc' --- int(1) ---- testing: '123abc' / '123e5' --- +--- testing: '123abc'/'123e5' --- float(1.0E-5) ---- testing: '123abc' / '123e5xyz' --- +--- testing: '123abc'/'123e5xyz' --- float(1.0E-5) ---- testing: '123abc' / ' 123abc' --- +--- testing: '123abc'/' 123abc' --- int(1) ---- testing: '123abc' / '123 abc' --- +--- testing: '123abc'/'123 abc' --- int(1) ---- testing: '123abc' / '123abc ' --- +--- testing: '123abc'/'123abc ' --- int(1) ---- testing: '123abc' / '3.4a' --- +--- testing: '123abc'/'3.4a' --- float(36.1764705882353) ---- testing: '123abc' / 'a5.9' --- -float(INF) ---- testing: '123e5' / '0' --- +--- testing: '123abc'/'a5.9' --- +Unsupported operand types: string / string +--- testing: '123e5'/'0' --- float(INF) ---- testing: '123e5' / '65' --- +--- testing: '123e5'/'65' --- float(189230.76923076922) ---- testing: '123e5' / '-44' --- +--- testing: '123e5'/'-44' --- float(-279545.45454545453) ---- testing: '123e5' / '1.2' --- +--- testing: '123e5'/'1.2' --- float(10250000) ---- testing: '123e5' / '-7.7' --- +--- testing: '123e5'/'-7.7' --- float(-1597402.5974025973) ---- testing: '123e5' / 'abc' --- -float(INF) ---- testing: '123e5' / '123abc' --- +--- testing: '123e5'/'abc' --- +Unsupported operand types: string / string +--- testing: '123e5'/'123abc' --- float(100000) ---- testing: '123e5' / '123e5' --- +--- testing: '123e5'/'123e5' --- float(1) ---- testing: '123e5' / '123e5xyz' --- +--- testing: '123e5'/'123e5xyz' --- float(1) ---- testing: '123e5' / ' 123abc' --- +--- testing: '123e5'/' 123abc' --- float(100000) ---- testing: '123e5' / '123 abc' --- +--- testing: '123e5'/'123 abc' --- float(100000) ---- testing: '123e5' / '123abc ' --- +--- testing: '123e5'/'123abc ' --- float(100000) ---- testing: '123e5' / '3.4a' --- +--- testing: '123e5'/'3.4a' --- float(3617647.0588235296) ---- testing: '123e5' / 'a5.9' --- -float(INF) ---- testing: '123e5xyz' / '0' --- +--- testing: '123e5'/'a5.9' --- +Unsupported operand types: string / string +--- testing: '123e5xyz'/'0' --- float(INF) ---- testing: '123e5xyz' / '65' --- +--- testing: '123e5xyz'/'65' --- float(189230.76923076922) ---- testing: '123e5xyz' / '-44' --- +--- testing: '123e5xyz'/'-44' --- float(-279545.45454545453) ---- testing: '123e5xyz' / '1.2' --- +--- testing: '123e5xyz'/'1.2' --- float(10250000) ---- testing: '123e5xyz' / '-7.7' --- +--- testing: '123e5xyz'/'-7.7' --- float(-1597402.5974025973) ---- testing: '123e5xyz' / 'abc' --- -float(INF) ---- testing: '123e5xyz' / '123abc' --- +--- testing: '123e5xyz'/'abc' --- +Unsupported operand types: string / string +--- testing: '123e5xyz'/'123abc' --- float(100000) ---- testing: '123e5xyz' / '123e5' --- +--- testing: '123e5xyz'/'123e5' --- float(1) ---- testing: '123e5xyz' / '123e5xyz' --- +--- testing: '123e5xyz'/'123e5xyz' --- float(1) ---- testing: '123e5xyz' / ' 123abc' --- +--- testing: '123e5xyz'/' 123abc' --- float(100000) ---- testing: '123e5xyz' / '123 abc' --- +--- testing: '123e5xyz'/'123 abc' --- float(100000) ---- testing: '123e5xyz' / '123abc ' --- +--- testing: '123e5xyz'/'123abc ' --- float(100000) ---- testing: '123e5xyz' / '3.4a' --- +--- testing: '123e5xyz'/'3.4a' --- float(3617647.0588235296) ---- testing: '123e5xyz' / 'a5.9' --- -float(INF) ---- testing: ' 123abc' / '0' --- +--- testing: '123e5xyz'/'a5.9' --- +Unsupported operand types: string / string +--- testing: ' 123abc'/'0' --- float(INF) ---- testing: ' 123abc' / '65' --- +--- testing: ' 123abc'/'65' --- float(1.8923076923076922) ---- testing: ' 123abc' / '-44' --- +--- testing: ' 123abc'/'-44' --- float(-2.7954545454545454) ---- testing: ' 123abc' / '1.2' --- +--- testing: ' 123abc'/'1.2' --- float(102.5) ---- testing: ' 123abc' / '-7.7' --- +--- testing: ' 123abc'/'-7.7' --- float(-15.974025974025974) ---- testing: ' 123abc' / 'abc' --- -float(INF) ---- testing: ' 123abc' / '123abc' --- +--- testing: ' 123abc'/'abc' --- +Unsupported operand types: string / string +--- testing: ' 123abc'/'123abc' --- int(1) ---- testing: ' 123abc' / '123e5' --- +--- testing: ' 123abc'/'123e5' --- float(1.0E-5) ---- testing: ' 123abc' / '123e5xyz' --- +--- testing: ' 123abc'/'123e5xyz' --- float(1.0E-5) ---- testing: ' 123abc' / ' 123abc' --- +--- testing: ' 123abc'/' 123abc' --- int(1) ---- testing: ' 123abc' / '123 abc' --- +--- testing: ' 123abc'/'123 abc' --- int(1) ---- testing: ' 123abc' / '123abc ' --- +--- testing: ' 123abc'/'123abc ' --- int(1) ---- testing: ' 123abc' / '3.4a' --- +--- testing: ' 123abc'/'3.4a' --- float(36.1764705882353) ---- testing: ' 123abc' / 'a5.9' --- -float(INF) ---- testing: '123 abc' / '0' --- +--- testing: ' 123abc'/'a5.9' --- +Unsupported operand types: string / string +--- testing: '123 abc'/'0' --- float(INF) ---- testing: '123 abc' / '65' --- +--- testing: '123 abc'/'65' --- float(1.8923076923076922) ---- testing: '123 abc' / '-44' --- +--- testing: '123 abc'/'-44' --- float(-2.7954545454545454) ---- testing: '123 abc' / '1.2' --- +--- testing: '123 abc'/'1.2' --- float(102.5) ---- testing: '123 abc' / '-7.7' --- +--- testing: '123 abc'/'-7.7' --- float(-15.974025974025974) ---- testing: '123 abc' / 'abc' --- -float(INF) ---- testing: '123 abc' / '123abc' --- +--- testing: '123 abc'/'abc' --- +Unsupported operand types: string / string +--- testing: '123 abc'/'123abc' --- int(1) ---- testing: '123 abc' / '123e5' --- +--- testing: '123 abc'/'123e5' --- float(1.0E-5) ---- testing: '123 abc' / '123e5xyz' --- +--- testing: '123 abc'/'123e5xyz' --- float(1.0E-5) ---- testing: '123 abc' / ' 123abc' --- +--- testing: '123 abc'/' 123abc' --- int(1) ---- testing: '123 abc' / '123 abc' --- +--- testing: '123 abc'/'123 abc' --- int(1) ---- testing: '123 abc' / '123abc ' --- +--- testing: '123 abc'/'123abc ' --- int(1) ---- testing: '123 abc' / '3.4a' --- +--- testing: '123 abc'/'3.4a' --- float(36.1764705882353) ---- testing: '123 abc' / 'a5.9' --- +--- testing: '123 abc'/'a5.9' --- +Unsupported operand types: string / string +--- testing: '123abc '/'0' --- float(INF) ---- testing: '123abc ' / '0' --- -float(INF) ---- testing: '123abc ' / '65' --- +--- testing: '123abc '/'65' --- float(1.8923076923076922) ---- testing: '123abc ' / '-44' --- +--- testing: '123abc '/'-44' --- float(-2.7954545454545454) ---- testing: '123abc ' / '1.2' --- +--- testing: '123abc '/'1.2' --- float(102.5) ---- testing: '123abc ' / '-7.7' --- +--- testing: '123abc '/'-7.7' --- float(-15.974025974025974) ---- testing: '123abc ' / 'abc' --- -float(INF) ---- testing: '123abc ' / '123abc' --- +--- testing: '123abc '/'abc' --- +Unsupported operand types: string / string +--- testing: '123abc '/'123abc' --- int(1) ---- testing: '123abc ' / '123e5' --- +--- testing: '123abc '/'123e5' --- float(1.0E-5) ---- testing: '123abc ' / '123e5xyz' --- +--- testing: '123abc '/'123e5xyz' --- float(1.0E-5) ---- testing: '123abc ' / ' 123abc' --- +--- testing: '123abc '/' 123abc' --- int(1) ---- testing: '123abc ' / '123 abc' --- +--- testing: '123abc '/'123 abc' --- int(1) ---- testing: '123abc ' / '123abc ' --- +--- testing: '123abc '/'123abc ' --- int(1) ---- testing: '123abc ' / '3.4a' --- +--- testing: '123abc '/'3.4a' --- float(36.1764705882353) ---- testing: '123abc ' / 'a5.9' --- -float(INF) ---- testing: '3.4a' / '0' --- +--- testing: '123abc '/'a5.9' --- +Unsupported operand types: string / string +--- testing: '3.4a'/'0' --- float(INF) ---- testing: '3.4a' / '65' --- +--- testing: '3.4a'/'65' --- float(0.052307692307692305) ---- testing: '3.4a' / '-44' --- +--- testing: '3.4a'/'-44' --- float(-0.07727272727272727) ---- testing: '3.4a' / '1.2' --- +--- testing: '3.4a'/'1.2' --- float(2.8333333333333335) ---- testing: '3.4a' / '-7.7' --- +--- testing: '3.4a'/'-7.7' --- float(-0.44155844155844154) ---- testing: '3.4a' / 'abc' --- -float(INF) ---- testing: '3.4a' / '123abc' --- +--- testing: '3.4a'/'abc' --- +Unsupported operand types: string / string +--- testing: '3.4a'/'123abc' --- float(0.027642276422764227) ---- testing: '3.4a' / '123e5' --- +--- testing: '3.4a'/'123e5' --- float(2.764227642276423E-7) ---- testing: '3.4a' / '123e5xyz' --- +--- testing: '3.4a'/'123e5xyz' --- float(2.764227642276423E-7) ---- testing: '3.4a' / ' 123abc' --- +--- testing: '3.4a'/' 123abc' --- float(0.027642276422764227) ---- testing: '3.4a' / '123 abc' --- +--- testing: '3.4a'/'123 abc' --- float(0.027642276422764227) ---- testing: '3.4a' / '123abc ' --- +--- testing: '3.4a'/'123abc ' --- float(0.027642276422764227) ---- testing: '3.4a' / '3.4a' --- +--- testing: '3.4a'/'3.4a' --- float(1) ---- testing: '3.4a' / 'a5.9' --- -float(INF) ---- testing: 'a5.9' / '0' --- -float(NAN) ---- testing: 'a5.9' / '65' --- -int(0) ---- testing: 'a5.9' / '-44' --- -int(0) ---- testing: 'a5.9' / '1.2' --- -float(0) ---- testing: 'a5.9' / '-7.7' --- -float(-0) ---- testing: 'a5.9' / 'abc' --- -float(NAN) ---- testing: 'a5.9' / '123abc' --- -int(0) ---- testing: 'a5.9' / '123e5' --- -float(0) ---- testing: 'a5.9' / '123e5xyz' --- -float(0) ---- testing: 'a5.9' / ' 123abc' --- -int(0) ---- testing: 'a5.9' / '123 abc' --- -int(0) ---- testing: 'a5.9' / '123abc ' --- -int(0) ---- testing: 'a5.9' / '3.4a' --- -float(0) ---- testing: 'a5.9' / 'a5.9' --- -float(NAN) +--- testing: '3.4a'/'a5.9' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/'0' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/'65' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/'-44' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/'1.2' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/'-7.7' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/'abc' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/'123abc' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/'123e5' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/'123e5xyz' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/' 123abc' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/'123 abc' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/'123abc ' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/'3.4a' --- +Unsupported operand types: string / string +--- testing: 'a5.9'/'a5.9' --- +Unsupported operand types: string / string diff --git a/tests/lang/operators/modulus_variationStr.phpt b/tests/lang/operators/modulus_variationStr.phpt index 8d31c3ec91..1f9aae88a4 100644 --- a/tests/lang/operators/modulus_variationStr.phpt +++ b/tests/lang/operators/modulus_variationStr.phpt @@ -15,8 +15,8 @@ foreach ($strVals as $strVal) { echo "--- testing: '$strVal' % '$otherVal' ---\n"; try { var_dump($strVal%$otherVal); - } catch (DivisionByZeroError $e) { - echo "Exception: " . $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo get_class($e) . ': ' . $e->getMessage() . "\n"; } } } @@ -25,7 +25,7 @@ foreach ($strVals as $strVal) { ?> --EXPECT-- --- testing: '0' % '0' --- -Exception: Modulo by zero +DivisionByZeroError: Modulo by zero --- testing: '0' % '65' --- int(0) --- testing: '0' % '-44' --- @@ -35,7 +35,7 @@ int(0) --- testing: '0' % '-7.7' --- int(0) --- testing: '0' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '0' % '123abc' --- int(0) --- testing: '0' % '123e5' --- @@ -51,9 +51,9 @@ int(0) --- testing: '0' % '3.4a' --- int(0) --- testing: '0' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '65' % '0' --- -Exception: Modulo by zero +DivisionByZeroError: Modulo by zero --- testing: '65' % '65' --- int(0) --- testing: '65' % '-44' --- @@ -63,7 +63,7 @@ int(0) --- testing: '65' % '-7.7' --- int(2) --- testing: '65' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '65' % '123abc' --- int(65) --- testing: '65' % '123e5' --- @@ -79,9 +79,9 @@ int(65) --- testing: '65' % '3.4a' --- int(2) --- testing: '65' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '-44' % '0' --- -Exception: Modulo by zero +DivisionByZeroError: Modulo by zero --- testing: '-44' % '65' --- int(-44) --- testing: '-44' % '-44' --- @@ -91,7 +91,7 @@ int(0) --- testing: '-44' % '-7.7' --- int(-2) --- testing: '-44' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '-44' % '123abc' --- int(-44) --- testing: '-44' % '123e5' --- @@ -107,9 +107,9 @@ int(-44) --- testing: '-44' % '3.4a' --- int(-2) --- testing: '-44' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '1.2' % '0' --- -Exception: Modulo by zero +DivisionByZeroError: Modulo by zero --- testing: '1.2' % '65' --- int(1) --- testing: '1.2' % '-44' --- @@ -119,7 +119,7 @@ int(0) --- testing: '1.2' % '-7.7' --- int(1) --- testing: '1.2' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '1.2' % '123abc' --- int(1) --- testing: '1.2' % '123e5' --- @@ -135,9 +135,9 @@ int(1) --- testing: '1.2' % '3.4a' --- int(1) --- testing: '1.2' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '-7.7' % '0' --- -Exception: Modulo by zero +DivisionByZeroError: Modulo by zero --- testing: '-7.7' % '65' --- int(-7) --- testing: '-7.7' % '-44' --- @@ -147,7 +147,7 @@ int(0) --- testing: '-7.7' % '-7.7' --- int(0) --- testing: '-7.7' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '-7.7' % '123abc' --- int(-7) --- testing: '-7.7' % '123e5' --- @@ -163,37 +163,37 @@ int(-7) --- testing: '-7.7' % '3.4a' --- int(-1) --- testing: '-7.7' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: 'abc' % '0' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: 'abc' % '65' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'abc' % '-44' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'abc' % '1.2' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'abc' % '-7.7' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'abc' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: 'abc' % '123abc' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'abc' % '123e5' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'abc' % '123e5xyz' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'abc' % ' 123abc' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'abc' % '123 abc' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'abc' % '123abc ' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'abc' % '3.4a' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'abc' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '123abc' % '0' --- -Exception: Modulo by zero +DivisionByZeroError: Modulo by zero --- testing: '123abc' % '65' --- int(58) --- testing: '123abc' % '-44' --- @@ -203,7 +203,7 @@ int(0) --- testing: '123abc' % '-7.7' --- int(4) --- testing: '123abc' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '123abc' % '123abc' --- int(0) --- testing: '123abc' % '123e5' --- @@ -219,9 +219,9 @@ int(0) --- testing: '123abc' % '3.4a' --- int(0) --- testing: '123abc' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '123e5' % '0' --- -Exception: Modulo by zero +DivisionByZeroError: Modulo by zero --- testing: '123e5' % '65' --- int(50) --- testing: '123e5' % '-44' --- @@ -231,7 +231,7 @@ int(0) --- testing: '123e5' % '-7.7' --- int(6) --- testing: '123e5' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '123e5' % '123abc' --- int(0) --- testing: '123e5' % '123e5' --- @@ -247,9 +247,9 @@ int(0) --- testing: '123e5' % '3.4a' --- int(0) --- testing: '123e5' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '123e5xyz' % '0' --- -Exception: Modulo by zero +DivisionByZeroError: Modulo by zero --- testing: '123e5xyz' % '65' --- int(50) --- testing: '123e5xyz' % '-44' --- @@ -259,7 +259,7 @@ int(0) --- testing: '123e5xyz' % '-7.7' --- int(6) --- testing: '123e5xyz' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '123e5xyz' % '123abc' --- int(0) --- testing: '123e5xyz' % '123e5' --- @@ -275,9 +275,9 @@ int(0) --- testing: '123e5xyz' % '3.4a' --- int(0) --- testing: '123e5xyz' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: ' 123abc' % '0' --- -Exception: Modulo by zero +DivisionByZeroError: Modulo by zero --- testing: ' 123abc' % '65' --- int(58) --- testing: ' 123abc' % '-44' --- @@ -287,7 +287,7 @@ int(0) --- testing: ' 123abc' % '-7.7' --- int(4) --- testing: ' 123abc' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: ' 123abc' % '123abc' --- int(0) --- testing: ' 123abc' % '123e5' --- @@ -303,9 +303,9 @@ int(0) --- testing: ' 123abc' % '3.4a' --- int(0) --- testing: ' 123abc' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '123 abc' % '0' --- -Exception: Modulo by zero +DivisionByZeroError: Modulo by zero --- testing: '123 abc' % '65' --- int(58) --- testing: '123 abc' % '-44' --- @@ -315,7 +315,7 @@ int(0) --- testing: '123 abc' % '-7.7' --- int(4) --- testing: '123 abc' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '123 abc' % '123abc' --- int(0) --- testing: '123 abc' % '123e5' --- @@ -331,9 +331,9 @@ int(0) --- testing: '123 abc' % '3.4a' --- int(0) --- testing: '123 abc' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '123abc ' % '0' --- -Exception: Modulo by zero +DivisionByZeroError: Modulo by zero --- testing: '123abc ' % '65' --- int(58) --- testing: '123abc ' % '-44' --- @@ -343,7 +343,7 @@ int(0) --- testing: '123abc ' % '-7.7' --- int(4) --- testing: '123abc ' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '123abc ' % '123abc' --- int(0) --- testing: '123abc ' % '123e5' --- @@ -359,9 +359,9 @@ int(0) --- testing: '123abc ' % '3.4a' --- int(0) --- testing: '123abc ' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '3.4a' % '0' --- -Exception: Modulo by zero +DivisionByZeroError: Modulo by zero --- testing: '3.4a' % '65' --- int(3) --- testing: '3.4a' % '-44' --- @@ -371,7 +371,7 @@ int(0) --- testing: '3.4a' % '-7.7' --- int(3) --- testing: '3.4a' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: '3.4a' % '123abc' --- int(3) --- testing: '3.4a' % '123e5' --- @@ -387,32 +387,32 @@ int(3) --- testing: '3.4a' % '3.4a' --- int(0) --- testing: '3.4a' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % '0' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % '65' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % '-44' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % '1.2' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % '-7.7' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % 'abc' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % '123abc' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % '123e5' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % '123e5xyz' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % ' 123abc' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % '123 abc' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % '123abc ' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % '3.4a' --- -int(0) +TypeError: Unsupported operand types: string % string --- testing: 'a5.9' % 'a5.9' --- -Exception: Modulo by zero +TypeError: Unsupported operand types: string % string diff --git a/tests/lang/operators/multiply_variationStr.phpt b/tests/lang/operators/multiply_variationStr.phpt index a9f73c6bda..af650ae993 100644 --- a/tests/lang/operators/multiply_variationStr.phpt +++ b/tests/lang/operators/multiply_variationStr.phpt @@ -11,13 +11,16 @@ $strVals = array( error_reporting(E_ERROR); foreach ($strVals as $strVal) { - foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' * '$otherVal' ---\n"; - var_dump($strVal*$otherVal); - } + foreach($strVals as $otherVal) { + echo "--- testing: '$strVal' * '$otherVal' ---\n"; + try { + var_dump($strVal*$otherVal); + } catch (\TypeError $e) { + echo $e->getMessage() . \PHP_EOL; + } + } } - ?> --EXPECT-- --- testing: '0' * '0' --- @@ -31,7 +34,7 @@ float(0) --- testing: '0' * '-7.7' --- float(-0) --- testing: '0' * 'abc' --- -int(0) +Unsupported operand types: string * string --- testing: '0' * '123abc' --- int(0) --- testing: '0' * '123e5' --- @@ -47,7 +50,7 @@ int(0) --- testing: '0' * '3.4a' --- float(0) --- testing: '0' * 'a5.9' --- -int(0) +Unsupported operand types: string * string --- testing: '65' * '0' --- int(0) --- testing: '65' * '65' --- @@ -59,7 +62,7 @@ float(78) --- testing: '65' * '-7.7' --- float(-500.5) --- testing: '65' * 'abc' --- -int(0) +Unsupported operand types: string * string --- testing: '65' * '123abc' --- int(7995) --- testing: '65' * '123e5' --- @@ -75,7 +78,7 @@ int(7995) --- testing: '65' * '3.4a' --- float(221) --- testing: '65' * 'a5.9' --- -int(0) +Unsupported operand types: string * string --- testing: '-44' * '0' --- int(0) --- testing: '-44' * '65' --- @@ -87,7 +90,7 @@ float(-52.8) --- testing: '-44' * '-7.7' --- float(338.8) --- testing: '-44' * 'abc' --- -int(0) +Unsupported operand types: string * string --- testing: '-44' * '123abc' --- int(-5412) --- testing: '-44' * '123e5' --- @@ -103,7 +106,7 @@ int(-5412) --- testing: '-44' * '3.4a' --- float(-149.6) --- testing: '-44' * 'a5.9' --- -int(0) +Unsupported operand types: string * string --- testing: '1.2' * '0' --- float(0) --- testing: '1.2' * '65' --- @@ -115,7 +118,7 @@ float(1.44) --- testing: '1.2' * '-7.7' --- float(-9.24) --- testing: '1.2' * 'abc' --- -float(0) +Unsupported operand types: string * string --- testing: '1.2' * '123abc' --- float(147.6) --- testing: '1.2' * '123e5' --- @@ -131,7 +134,7 @@ float(147.6) --- testing: '1.2' * '3.4a' --- float(4.08) --- testing: '1.2' * 'a5.9' --- -float(0) +Unsupported operand types: string * string --- testing: '-7.7' * '0' --- float(-0) --- testing: '-7.7' * '65' --- @@ -143,7 +146,7 @@ float(-9.24) --- testing: '-7.7' * '-7.7' --- float(59.290000000000006) --- testing: '-7.7' * 'abc' --- -float(-0) +Unsupported operand types: string * string --- testing: '-7.7' * '123abc' --- float(-947.1) --- testing: '-7.7' * '123e5' --- @@ -159,35 +162,35 @@ float(-947.1) --- testing: '-7.7' * '3.4a' --- float(-26.18) --- testing: '-7.7' * 'a5.9' --- -float(-0) +Unsupported operand types: string * string --- testing: 'abc' * '0' --- -int(0) +Unsupported operand types: string * string --- testing: 'abc' * '65' --- -int(0) +Unsupported operand types: string * string --- testing: 'abc' * '-44' --- -int(0) +Unsupported operand types: string * string --- testing: 'abc' * '1.2' --- -float(0) +Unsupported operand types: string * string --- testing: 'abc' * '-7.7' --- -float(-0) +Unsupported operand types: string * string --- testing: 'abc' * 'abc' --- -int(0) +Unsupported operand types: string * string --- testing: 'abc' * '123abc' --- -int(0) +Unsupported operand types: string * string --- testing: 'abc' * '123e5' --- -float(0) +Unsupported operand types: string * string --- testing: 'abc' * '123e5xyz' --- -float(0) +Unsupported operand types: string * string --- testing: 'abc' * ' 123abc' --- -int(0) +Unsupported operand types: string * string --- testing: 'abc' * '123 abc' --- -int(0) +Unsupported operand types: string * string --- testing: 'abc' * '123abc ' --- -int(0) +Unsupported operand types: string * string --- testing: 'abc' * '3.4a' --- -float(0) +Unsupported operand types: string * string --- testing: 'abc' * 'a5.9' --- -int(0) +Unsupported operand types: string * string --- testing: '123abc' * '0' --- int(0) --- testing: '123abc' * '65' --- @@ -199,7 +202,7 @@ float(147.6) --- testing: '123abc' * '-7.7' --- float(-947.1) --- testing: '123abc' * 'abc' --- -int(0) +Unsupported operand types: string * string --- testing: '123abc' * '123abc' --- int(15129) --- testing: '123abc' * '123e5' --- @@ -215,7 +218,7 @@ int(15129) --- testing: '123abc' * '3.4a' --- float(418.2) --- testing: '123abc' * 'a5.9' --- -int(0) +Unsupported operand types: string * string --- testing: '123e5' * '0' --- float(0) --- testing: '123e5' * '65' --- @@ -227,7 +230,7 @@ float(14760000) --- testing: '123e5' * '-7.7' --- float(-94710000) --- testing: '123e5' * 'abc' --- -float(0) +Unsupported operand types: string * string --- testing: '123e5' * '123abc' --- float(1512900000) --- testing: '123e5' * '123e5' --- @@ -243,7 +246,7 @@ float(1512900000) --- testing: '123e5' * '3.4a' --- float(41820000) --- testing: '123e5' * 'a5.9' --- -float(0) +Unsupported operand types: string * string --- testing: '123e5xyz' * '0' --- float(0) --- testing: '123e5xyz' * '65' --- @@ -255,7 +258,7 @@ float(14760000) --- testing: '123e5xyz' * '-7.7' --- float(-94710000) --- testing: '123e5xyz' * 'abc' --- -float(0) +Unsupported operand types: string * string --- testing: '123e5xyz' * '123abc' --- float(1512900000) --- testing: '123e5xyz' * '123e5' --- @@ -271,7 +274,7 @@ float(1512900000) --- testing: '123e5xyz' * '3.4a' --- float(41820000) --- testing: '123e5xyz' * 'a5.9' --- -float(0) +Unsupported operand types: string * string --- testing: ' 123abc' * '0' --- int(0) --- testing: ' 123abc' * '65' --- @@ -283,7 +286,7 @@ float(147.6) --- testing: ' 123abc' * '-7.7' --- float(-947.1) --- testing: ' 123abc' * 'abc' --- -int(0) +Unsupported operand types: string * string --- testing: ' 123abc' * '123abc' --- int(15129) --- testing: ' 123abc' * '123e5' --- @@ -299,7 +302,7 @@ int(15129) --- testing: ' 123abc' * '3.4a' --- float(418.2) --- testing: ' 123abc' * 'a5.9' --- -int(0) +Unsupported operand types: string * string --- testing: '123 abc' * '0' --- int(0) --- testing: '123 abc' * '65' --- @@ -311,7 +314,7 @@ float(147.6) --- testing: '123 abc' * '-7.7' --- float(-947.1) --- testing: '123 abc' * 'abc' --- -int(0) +Unsupported operand types: string * string --- testing: '123 abc' * '123abc' --- int(15129) --- testing: '123 abc' * '123e5' --- @@ -327,7 +330,7 @@ int(15129) --- testing: '123 abc' * '3.4a' --- float(418.2) --- testing: '123 abc' * 'a5.9' --- -int(0) +Unsupported operand types: string * string --- testing: '123abc ' * '0' --- int(0) --- testing: '123abc ' * '65' --- @@ -339,7 +342,7 @@ float(147.6) --- testing: '123abc ' * '-7.7' --- float(-947.1) --- testing: '123abc ' * 'abc' --- -int(0) +Unsupported operand types: string * string --- testing: '123abc ' * '123abc' --- int(15129) --- testing: '123abc ' * '123e5' --- @@ -355,7 +358,7 @@ int(15129) --- testing: '123abc ' * '3.4a' --- float(418.2) --- testing: '123abc ' * 'a5.9' --- -int(0) +Unsupported operand types: string * string --- testing: '3.4a' * '0' --- float(0) --- testing: '3.4a' * '65' --- @@ -367,7 +370,7 @@ float(4.08) --- testing: '3.4a' * '-7.7' --- float(-26.18) --- testing: '3.4a' * 'abc' --- -float(0) +Unsupported operand types: string * string --- testing: '3.4a' * '123abc' --- float(418.2) --- testing: '3.4a' * '123e5' --- @@ -383,32 +386,32 @@ float(418.2) --- testing: '3.4a' * '3.4a' --- float(11.559999999999999) --- testing: '3.4a' * 'a5.9' --- -float(0) +Unsupported operand types: string * string --- testing: 'a5.9' * '0' --- -int(0) +Unsupported operand types: string * string --- testing: 'a5.9' * '65' --- -int(0) +Unsupported operand types: string * string --- testing: 'a5.9' * '-44' --- -int(0) +Unsupported operand types: string * string --- testing: 'a5.9' * '1.2' --- -float(0) +Unsupported operand types: string * string --- testing: 'a5.9' * '-7.7' --- -float(-0) +Unsupported operand types: string * string --- testing: 'a5.9' * 'abc' --- -int(0) +Unsupported operand types: string * string --- testing: 'a5.9' * '123abc' --- -int(0) +Unsupported operand types: string * string --- testing: 'a5.9' * '123e5' --- -float(0) +Unsupported operand types: string * string --- testing: 'a5.9' * '123e5xyz' --- -float(0) +Unsupported operand types: string * string --- testing: 'a5.9' * ' 123abc' --- -int(0) +Unsupported operand types: string * string --- testing: 'a5.9' * '123 abc' --- -int(0) +Unsupported operand types: string * string --- testing: 'a5.9' * '123abc ' --- -int(0) +Unsupported operand types: string * string --- testing: 'a5.9' * '3.4a' --- -float(0) +Unsupported operand types: string * string --- testing: 'a5.9' * 'a5.9' --- -int(0) +Unsupported operand types: string * string diff --git a/tests/lang/operators/negate_variationStr.phpt b/tests/lang/operators/negate_variationStr.phpt index 3b70349026..43b2f6a52a 100644 --- a/tests/lang/operators/negate_variationStr.phpt +++ b/tests/lang/operators/negate_variationStr.phpt @@ -8,10 +8,13 @@ $strVals = array( "a5.9" ); - foreach ($strVals as $strVal) { - echo "--- testing: '$strVal' ---\n"; - var_dump(-$strVal); + echo "--- testing: '$strVal' ---\n"; + try { + var_dump(-$strVal); + } catch (\TypeError $e) { + echo $e->getMessage() . \PHP_EOL; + } } ?> @@ -27,36 +30,32 @@ float(-1.2) --- testing: '-7.7' --- float(7.7) --- testing: 'abc' --- - -Warning: A non-numeric value encountered in %s on line %d -int(0) +Unsupported operand types: string * int --- testing: '123abc' --- -Notice: A non well formed numeric value encountered in %s on line %d +Warning: A non-numeric value encountered in %s on line %d int(-123) --- testing: '123e5' --- float(-12300000) --- testing: '123e5xyz' --- -Notice: A non well formed numeric value encountered in %s on line %d +Warning: A non-numeric value encountered in %s on line %d float(-12300000) --- testing: ' 123abc' --- -Notice: A non well formed numeric value encountered in %s on line %d +Warning: A non-numeric value encountered in %s on line %d int(-123) --- testing: '123 abc' --- -Notice: A non well formed numeric value encountered in %s on line %d +Warning: A non-numeric value encountered in %s on line %d int(-123) --- testing: '123abc ' --- -Notice: A non well formed numeric value encountered in %s on line %d +Warning: A non-numeric value encountered in %s on line %d int(-123) --- testing: '3.4a' --- -Notice: A non well formed numeric value encountered in %s on line %d +Warning: A non-numeric value encountered in %s on line %d float(-3.4) --- testing: 'a5.9' --- - -Warning: A non-numeric value encountered in %s on line %d -int(0) +Unsupported operand types: string * int diff --git a/tests/lang/operators/subtract_variationStr.phpt b/tests/lang/operators/subtract_variationStr.phpt index 2c4667c114..6df852498d 100644 --- a/tests/lang/operators/subtract_variationStr.phpt +++ b/tests/lang/operators/subtract_variationStr.phpt @@ -11,13 +11,16 @@ $strVals = array( error_reporting(E_ERROR); foreach ($strVals as $strVal) { - foreach($strVals as $otherVal) { - echo "--- testing: '$strVal' - '$otherVal' ---\n"; - var_dump($strVal-$otherVal); - } + foreach($strVals as $otherVal) { + echo "--- testing: '$strVal' - '$otherVal' ---\n"; + try { + var_dump($strVal-$otherVal); + } catch (\TypeError $e) { + echo $e->getMessage() . \PHP_EOL; + } + } } - ?> --EXPECT-- --- testing: '0' - '0' --- @@ -31,7 +34,7 @@ float(-1.2) --- testing: '0' - '-7.7' --- float(7.7) --- testing: '0' - 'abc' --- -int(0) +Unsupported operand types: string - string --- testing: '0' - '123abc' --- int(-123) --- testing: '0' - '123e5' --- @@ -47,7 +50,7 @@ int(-123) --- testing: '0' - '3.4a' --- float(-3.4) --- testing: '0' - 'a5.9' --- -int(0) +Unsupported operand types: string - string --- testing: '65' - '0' --- int(65) --- testing: '65' - '65' --- @@ -59,7 +62,7 @@ float(63.8) --- testing: '65' - '-7.7' --- float(72.7) --- testing: '65' - 'abc' --- -int(65) +Unsupported operand types: string - string --- testing: '65' - '123abc' --- int(-58) --- testing: '65' - '123e5' --- @@ -75,7 +78,7 @@ int(-58) --- testing: '65' - '3.4a' --- float(61.6) --- testing: '65' - 'a5.9' --- -int(65) +Unsupported operand types: string - string --- testing: '-44' - '0' --- int(-44) --- testing: '-44' - '65' --- @@ -87,7 +90,7 @@ float(-45.2) --- testing: '-44' - '-7.7' --- float(-36.3) --- testing: '-44' - 'abc' --- -int(-44) +Unsupported operand types: string - string --- testing: '-44' - '123abc' --- int(-167) --- testing: '-44' - '123e5' --- @@ -103,7 +106,7 @@ int(-167) --- testing: '-44' - '3.4a' --- float(-47.4) --- testing: '-44' - 'a5.9' --- -int(-44) +Unsupported operand types: string - string --- testing: '1.2' - '0' --- float(1.2) --- testing: '1.2' - '65' --- @@ -115,7 +118,7 @@ float(0) --- testing: '1.2' - '-7.7' --- float(8.9) --- testing: '1.2' - 'abc' --- -float(1.2) +Unsupported operand types: string - string --- testing: '1.2' - '123abc' --- float(-121.8) --- testing: '1.2' - '123e5' --- @@ -131,7 +134,7 @@ float(-121.8) --- testing: '1.2' - '3.4a' --- float(-2.2) --- testing: '1.2' - 'a5.9' --- -float(1.2) +Unsupported operand types: string - string --- testing: '-7.7' - '0' --- float(-7.7) --- testing: '-7.7' - '65' --- @@ -143,7 +146,7 @@ float(-8.9) --- testing: '-7.7' - '-7.7' --- float(0) --- testing: '-7.7' - 'abc' --- -float(-7.7) +Unsupported operand types: string - string --- testing: '-7.7' - '123abc' --- float(-130.7) --- testing: '-7.7' - '123e5' --- @@ -159,35 +162,35 @@ float(-130.7) --- testing: '-7.7' - '3.4a' --- float(-11.1) --- testing: '-7.7' - 'a5.9' --- -float(-7.7) +Unsupported operand types: string - string --- testing: 'abc' - '0' --- -int(0) +Unsupported operand types: string - string --- testing: 'abc' - '65' --- -int(-65) +Unsupported operand types: string - string --- testing: 'abc' - '-44' --- -int(44) +Unsupported operand types: string - string --- testing: 'abc' - '1.2' --- -float(-1.2) +Unsupported operand types: string - string --- testing: 'abc' - '-7.7' --- -float(7.7) +Unsupported operand types: string - string --- testing: 'abc' - 'abc' --- -int(0) +Unsupported operand types: string - string --- testing: 'abc' - '123abc' --- -int(-123) +Unsupported operand types: string - string --- testing: 'abc' - '123e5' --- -float(-12300000) +Unsupported operand types: string - string --- testing: 'abc' - '123e5xyz' --- -float(-12300000) +Unsupported operand types: string - string --- testing: 'abc' - ' 123abc' --- -int(-123) +Unsupported operand types: string - string --- testing: 'abc' - '123 abc' --- -int(-123) +Unsupported operand types: string - string --- testing: 'abc' - '123abc ' --- -int(-123) +Unsupported operand types: string - string --- testing: 'abc' - '3.4a' --- -float(-3.4) +Unsupported operand types: string - string --- testing: 'abc' - 'a5.9' --- -int(0) +Unsupported operand types: string - string --- testing: '123abc' - '0' --- int(123) --- testing: '123abc' - '65' --- @@ -199,7 +202,7 @@ float(121.8) --- testing: '123abc' - '-7.7' --- float(130.7) --- testing: '123abc' - 'abc' --- -int(123) +Unsupported operand types: string - string --- testing: '123abc' - '123abc' --- int(0) --- testing: '123abc' - '123e5' --- @@ -215,7 +218,7 @@ int(0) --- testing: '123abc' - '3.4a' --- float(119.6) --- testing: '123abc' - 'a5.9' --- -int(123) +Unsupported operand types: string - string --- testing: '123e5' - '0' --- float(12300000) --- testing: '123e5' - '65' --- @@ -227,7 +230,7 @@ float(12299998.8) --- testing: '123e5' - '-7.7' --- float(12300007.7) --- testing: '123e5' - 'abc' --- -float(12300000) +Unsupported operand types: string - string --- testing: '123e5' - '123abc' --- float(12299877) --- testing: '123e5' - '123e5' --- @@ -243,7 +246,7 @@ float(12299877) --- testing: '123e5' - '3.4a' --- float(12299996.6) --- testing: '123e5' - 'a5.9' --- -float(12300000) +Unsupported operand types: string - string --- testing: '123e5xyz' - '0' --- float(12300000) --- testing: '123e5xyz' - '65' --- @@ -255,7 +258,7 @@ float(12299998.8) --- testing: '123e5xyz' - '-7.7' --- float(12300007.7) --- testing: '123e5xyz' - 'abc' --- -float(12300000) +Unsupported operand types: string - string --- testing: '123e5xyz' - '123abc' --- float(12299877) --- testing: '123e5xyz' - '123e5' --- @@ -271,7 +274,7 @@ float(12299877) --- testing: '123e5xyz' - '3.4a' --- float(12299996.6) --- testing: '123e5xyz' - 'a5.9' --- -float(12300000) +Unsupported operand types: string - string --- testing: ' 123abc' - '0' --- int(123) --- testing: ' 123abc' - '65' --- @@ -283,7 +286,7 @@ float(121.8) --- testing: ' 123abc' - '-7.7' --- float(130.7) --- testing: ' 123abc' - 'abc' --- -int(123) +Unsupported operand types: string - string --- testing: ' 123abc' - '123abc' --- int(0) --- testing: ' 123abc' - '123e5' --- @@ -299,7 +302,7 @@ int(0) --- testing: ' 123abc' - '3.4a' --- float(119.6) --- testing: ' 123abc' - 'a5.9' --- -int(123) +Unsupported operand types: string - string --- testing: '123 abc' - '0' --- int(123) --- testing: '123 abc' - '65' --- @@ -311,7 +314,7 @@ float(121.8) --- testing: '123 abc' - '-7.7' --- float(130.7) --- testing: '123 abc' - 'abc' --- -int(123) +Unsupported operand types: string - string --- testing: '123 abc' - '123abc' --- int(0) --- testing: '123 abc' - '123e5' --- @@ -327,7 +330,7 @@ int(0) --- testing: '123 abc' - '3.4a' --- float(119.6) --- testing: '123 abc' - 'a5.9' --- -int(123) +Unsupported operand types: string - string --- testing: '123abc ' - '0' --- int(123) --- testing: '123abc ' - '65' --- @@ -339,7 +342,7 @@ float(121.8) --- testing: '123abc ' - '-7.7' --- float(130.7) --- testing: '123abc ' - 'abc' --- -int(123) +Unsupported operand types: string - string --- testing: '123abc ' - '123abc' --- int(0) --- testing: '123abc ' - '123e5' --- @@ -355,7 +358,7 @@ int(0) --- testing: '123abc ' - '3.4a' --- float(119.6) --- testing: '123abc ' - 'a5.9' --- -int(123) +Unsupported operand types: string - string --- testing: '3.4a' - '0' --- float(3.4) --- testing: '3.4a' - '65' --- @@ -367,7 +370,7 @@ float(2.2) --- testing: '3.4a' - '-7.7' --- float(11.1) --- testing: '3.4a' - 'abc' --- -float(3.4) +Unsupported operand types: string - string --- testing: '3.4a' - '123abc' --- float(-119.6) --- testing: '3.4a' - '123e5' --- @@ -383,32 +386,32 @@ float(-119.6) --- testing: '3.4a' - '3.4a' --- float(0) --- testing: '3.4a' - 'a5.9' --- -float(3.4) +Unsupported operand types: string - string --- testing: 'a5.9' - '0' --- -int(0) +Unsupported operand types: string - string --- testing: 'a5.9' - '65' --- -int(-65) +Unsupported operand types: string - string --- testing: 'a5.9' - '-44' --- -int(44) +Unsupported operand types: string - string --- testing: 'a5.9' - '1.2' --- -float(-1.2) +Unsupported operand types: string - string --- testing: 'a5.9' - '-7.7' --- -float(7.7) +Unsupported operand types: string - string --- testing: 'a5.9' - 'abc' --- -int(0) +Unsupported operand types: string - string --- testing: 'a5.9' - '123abc' --- -int(-123) +Unsupported operand types: string - string --- testing: 'a5.9' - '123e5' --- -float(-12300000) +Unsupported operand types: string - string --- testing: 'a5.9' - '123e5xyz' --- -float(-12300000) +Unsupported operand types: string - string --- testing: 'a5.9' - ' 123abc' --- -int(-123) +Unsupported operand types: string - string --- testing: 'a5.9' - '123 abc' --- -int(-123) +Unsupported operand types: string - string --- testing: 'a5.9' - '123abc ' --- -int(-123) +Unsupported operand types: string - string --- testing: 'a5.9' - '3.4a' --- -float(-3.4) +Unsupported operand types: string - string --- testing: 'a5.9' - 'a5.9' --- -int(0) +Unsupported operand types: string - string diff --git a/tests/strings/offsets_chaining_5.phpt b/tests/strings/offsets_chaining_5.phpt index 42cb1f2721..49f062463f 100644 --- a/tests/strings/offsets_chaining_5.phpt +++ b/tests/strings/offsets_chaining_5.phpt @@ -6,20 +6,20 @@ $array = array('expected_array' => "foobar"); var_dump(isset($array['expected_array'])); var_dump($array['expected_array']); var_dump(isset($array['expected_array']['foo'])); -var_dump($array['expected_array']['foo']); +var_dump($array['expected_array']['0foo']); var_dump(isset($array['expected_array']['foo']['bar'])); -var_dump($array['expected_array']['foo']['bar']); +var_dump($array['expected_array']['0foo']['0bar']); ?> --EXPECTF-- bool(true) string(6) "foobar" bool(false) -Warning: Illegal string offset "foo" in %s on line %d +Warning: Illegal string offset "0foo" in %s on line %d string(1) "f" bool(false) -Warning: Illegal string offset "foo" in %s on line %d +Warning: Illegal string offset "0foo" in %s on line %d -Warning: Illegal string offset "bar" in %s on line %d +Warning: Illegal string offset "0bar" in %s on line %d string(1) "f" diff --git a/tests/strings/offsets_general.phpt b/tests/strings/offsets_general.phpt index 64d51457d7..16960eac95 100644 --- a/tests/strings/offsets_general.phpt +++ b/tests/strings/offsets_general.phpt @@ -9,17 +9,19 @@ var_dump($string[0]); var_dump($string[1]); var_dump(isset($string[0])); var_dump(isset($string[0][0])); -var_dump($string["foo"]); +try { + var_dump($string["foo"]); +} catch (\TypeError $e) { + echo $e->getMessage() . \PHP_EOL; +} var_dump(isset($string["foo"]["bar"])); ?> ---EXPECTF-- +--EXPECT-- string(1) "B" string(1) "f" string(1) "o" bool(true) bool(true) - -Warning: Illegal string offset "foo" in %s on line %d -string(1) "f" +Cannot access offset of type string on string bool(false) |