php-src/Zend/tests/short_echo_as_identifier.phpt
Nikita Popov 5571765609 Forbid use of <?= as a semi-reserved identifier
One of the weirdest pieces of PHP code I've ever seen. In terms
of tokens, this gets internally translated to

    use x as y; echo as my_echo;

On master it crashes because this "echo" does not have attached
identifier metadata. Make sure it is added and then reject the
use of "<?=" as an identifier inside zend_lex_tstring.

Fixes oss-fuzz #23547.
2020-06-19 09:29:58 +02:00

16 lines
240 B
PHP

--TEST--
<?= cannot be used as an identifier
--FILE--
<?php
trait T {
public function x() {}
}
class C {
use T {
x as y?><?= as my_echo;
}
}
?>
--EXPECTF--
Parse error: Cannot use "<?=" as an identifier in %s on line %d