[php-src] Issue #18850: PHP Warning: Constant already defined when processing multiple sources with __halt_compiler()
| From: | ProgerXP | Date: | Sat, 14 Jun 2025 12:05:26 +0000 |
| Subject: | [php-src] Issue #18850: PHP Warning: Constant already defined when processing multiple sources with __halt_compiler() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250262@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/18850
Author: ProgerXP
### Description
Whenever PHP processes more then one
__halt_compiler() statement in one session, it
emits this cryptic warning:
```
PHP Warning: Constant already defined in ...
```
Note the empty constant name.
There are several ways to trigger this. Here's one:
```
# echo '<?php __halt_compiler();' >inc.php
# php -a
php > include('inc.php');
php > include('inc.php');
PHP Warning: Constant already defined in /tmp/inc.php on line 1
```
here's another:
```
# php -r "eval('?><?php __halt_compiler();'); eval('?><?php
__halt_compiler();');"
```
### PHP Version
```plain
PHP 8.4.5 (cli) (built: Mar 12 2025 16:58:15) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.5, Copyright (c) Zend Technologies
```
### Operating System
_No response_