[php-src] Issue #20442: __halt_compiler case-sensitiv?

From: Date: Mon, 10 Nov 2025 12:50:10 +0000
Subject: [php-src] Issue #20442: __halt_compiler case-sensitiv?
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251200@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/20442 Author: shyim ### Description The following code: stub.php ```php <?php echo "Hello World!"; __halt_compiler(); ``` build.php ```php <?php $phar = new Phar('output.phar'); $phar->startBuffering(); $phar->setStub(file_get_contents('stub.php')); $phar->addEmptyDir('src'); $phar->stopBuffering(); ``` Resulted in this output: ``` ~/Downloads/foo via 🐘 v8.4.14 ❯ php -dphar.readonly=0 build.php ~/Downloads/foo via 🐘 v8.4.14 ❯ php -dphar.readonly=0 build.php PHP Fatal error: Uncaught UnexpectedValueException: internal corruption of phar "/Users/shyim/Downloads/foo/output.phar" (__HALT_COMPILER(); not found) in /Users/shyim/Downloads/foo/build.php:3 Stack trace: #0 /Users/shyim/Downloads/foo/build.php(3): Phar->__construct('output.phar') #1 {main} thrown in /Users/shyim/Downloads/foo/build.php on line 3 Fatal error: Uncaught UnexpectedValueException: internal corruption of phar "/Users/shyim/Downloads/foo/output.phar" (__HALT_COMPILER(); not found) in /Users/shyim/Downloads/foo/build.php:3 Stack trace: #0 /Users/shyim/Downloads/foo/build.php(3): Phar->__construct('output.phar') #1 {main} thrown in /Users/shyim/Downloads/foo/build.php on line 3 ``` But when I write __HALT_COMPILER in UPPER case it works always. I normally write it always upper-case but saw in docs other mentioned, just copy pasted. https://www.php.net/manual/en/function.halt-compiler.php it looks like it's hard-code to upper-case: https://github.com/php/php-src/blob/e97c0dc340be7387498b92b182b9356b960a3bd0/ext/phar/zip.c#L1230 Are the docs just wrong, should this be changed in php idk 😂 ### PHP Version ```plain PHP 8.4.14 (cli) (built: Oct 21 2025 19:23:55) (NTS) Copyright (c) The PHP Group Built by Shivam Mathur Zend Engine v4.4.14, Copyright (c) Zend Technologies with Zend OPcache v8.4.14, Copyright (c), by Zend Technologies ``` ### Operating System _No response_

« previous php.bugs (#251200) next »