mirror of
https://github.com/php/php-src.git
synced 2026-03-24 16:22:37 +01:00
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
28 lines
504 B
PHP
28 lines
504 B
PHP
--TEST--
|
|
testing the behavior of string offsets
|
|
--FILE--
|
|
<?php
|
|
$string = "foobar";
|
|
const FOO = "BAR"[0];
|
|
var_dump(FOO);
|
|
var_dump($string[0]);
|
|
var_dump($string[1]);
|
|
var_dump(isset($string[0]));
|
|
var_dump(isset($string[0][0]));
|
|
try {
|
|
var_dump($string["foo"]);
|
|
} catch (\TypeError $e) {
|
|
echo $e->getMessage() . \PHP_EOL;
|
|
}
|
|
var_dump(isset($string["foo"]["bar"]));
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(1) "B"
|
|
string(1) "f"
|
|
string(1) "o"
|
|
bool(true)
|
|
bool(true)
|
|
Cannot access offset of type string on string
|
|
bool(false)
|