mirror of
https://github.com/php/php-src.git
synced 2024-12-16 05:15:03 +08:00
b2248789ed
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
32 lines
406 B
PHP
32 lines
406 B
PHP
--TEST--
|
|
shifting strings right
|
|
--FILE--
|
|
<?php
|
|
|
|
$s = "123";
|
|
$s1 = "test";
|
|
$s2 = "45345some";
|
|
|
|
$s >>= 2;
|
|
var_dump($s);
|
|
|
|
try {
|
|
$s1 >>= 1;
|
|
var_dump($s1);
|
|
} catch (\TypeError $e) {
|
|
echo $e->getMessage() . \PHP_EOL;
|
|
}
|
|
|
|
$s2 >>= 3;
|
|
var_dump($s2);
|
|
|
|
echo "Done\n";
|
|
?>
|
|
--EXPECTF--
|
|
int(30)
|
|
Unsupported operand types: string >> int
|
|
|
|
Warning: A non-numeric value encountered in %s on line %d
|
|
int(5668)
|
|
Done
|