mirror of
https://github.com/php/php-src.git
synced 2024-12-17 13:59:28 +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
48 lines
825 B
PHP
48 lines
825 B
PHP
--TEST--
|
|
Test edge-cases for negative num strings in interpolated string offsets
|
|
--FILE--
|
|
<?php
|
|
|
|
$a = [
|
|
"0" => 1,
|
|
"-0" => 2,
|
|
"1" => 3,
|
|
"-1" => 4,
|
|
"0x0" => 5,
|
|
"-0x0" => 6,
|
|
"00" => 7,
|
|
"-00" => 8,
|
|
"9223372036854775808" => 9,
|
|
"-9223372036854775808" => 10,
|
|
"2147483648" => 11,
|
|
"-2147483648" => 12,
|
|
];
|
|
|
|
var_dump("$a[0]");
|
|
var_dump("$a[-0]");
|
|
var_dump("$a[1]");
|
|
var_dump("$a[-1]");
|
|
var_dump("$a[0x0]");
|
|
var_dump("$a[-0x0]");
|
|
var_dump("$a[00]");
|
|
var_dump("$a[-00]");
|
|
var_dump("$a[9223372036854775808]");
|
|
var_dump("$a[-9223372036854775808]");
|
|
var_dump("$a[2147483648]");
|
|
var_dump("$a[-2147483648]");
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(1) "1"
|
|
string(1) "2"
|
|
string(1) "3"
|
|
string(1) "4"
|
|
string(1) "5"
|
|
string(1) "6"
|
|
string(1) "7"
|
|
string(1) "8"
|
|
string(1) "9"
|
|
string(2) "10"
|
|
string(2) "11"
|
|
string(2) "12"
|