php-src/Zend/tests/self_or.phpt
George Peter Banyard b2248789ed 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
2020-07-29 02:51:09 +01:00

42 lines
536 B
PHP

--TEST--
ORing strings
--FILE--
<?php
$s = "123";
$s1 = "test";
$s2 = "45345some";
$s3 = str_repeat("f", 1);
$s4 = str_repeat("f", 2);
$s |= 22;
var_dump($s);
try {
$s1 |= 11;
var_dump($s1);
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
$s2 |= 33;
var_dump($s2);
$s3 |= " ";
var_dump($s3);
$s4 |= " ";
var_dump($s4);
echo "Done\n";
?>
--EXPECTF--
int(127)
Unsupported operand types: string | int
Warning: A non-numeric value encountered in %s on line %d
int(45345)
string(1) "f"
string(2) "ff"
Done