mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
99fa740acb
This merges all usages of emitting an offset TypeError into a new ZEND_API function zend_illegal_container_offset(const zend_string* container, const zval *offset, int type); Where the container should represent the type on which the access is attempted (e.g. string, array) The offset zval that is used, where the error message will display its type The type of access, which should be a BP_VAR_* constant, to get special message for isset/empty/unset
23 lines
396 B
PHP
23 lines
396 B
PHP
--TEST--
|
|
GH-8821: Fix reported line number of constant expression
|
|
--FILE--
|
|
<?php
|
|
|
|
enum Alpha {
|
|
case Foo;
|
|
}
|
|
|
|
class Bravo {
|
|
public const C = [Alpha::Foo => 3];
|
|
}
|
|
|
|
new Bravo();
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Fatal error: Uncaught TypeError: Cannot access offset of type Alpha on array in %sgh8821.php:8
|
|
Stack trace:
|
|
#0 %sgh8821.php(11): [constant expression]()
|
|
#1 {main}
|
|
thrown in %sgh8821.php on line 8
|