[php-src] Issue #22292: AST pretty printing does not correctly handle invalid variable names

From: Date: Sat, 13 Jun 2026 13:13:57 +0000
Subject: [php-src] Issue #22292: AST pretty printing does not correctly handle invalid variable names
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-252192@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/22292 Author: TimWolla ### Description The following code: ```php <?php class Foo { public function __get($name) { return $name; } } ${'---'} = 'foo'; try { assert(!${'---'}); } catch (Error $e) { echo $e->getMessage(), PHP_EOL; } $f = new Foo(); try { assert(!$f->{'---'}); } catch (Error $e) { echo $e->getMessage(), PHP_EOL; } ``` Resulted in this output: ``` assert(!${---}) assert(!$f->{---}) ``` But I expected this output instead: ``` assert(!${'---'}) assert(!$f->{'---'}) ``` ### PHP Version ```plain PHP 8.4.23-dev (cli) (built: Jun 13 2026 14:48:42) (NTS DEBUG) Copyright (c) The PHP Group Zend Engine v4.4.23-dev, Copyright (c) Zend Technologies ``` ### Operating System _No response_

« previous php.bugs (#252192) next »