Re: [RFC] Pure-code source files via the .phpc extension

From: Date: Tue, 16 Jun 2026 09:44:01 +0000
Subject: Re: [RFC] Pure-code source files via the .phpc extension
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-131318@lists.php.net to get a copy of this message
Le 16/06/2026 à 10:47, Hendrik Mennen a écrit :
Adding meaning to a specific extension is a BC break when no extensions have meaning prior.
Mostly conceded, with one nuance: .phar already carries filename-aware semantics in the engine (the phar:// stream wrapper resolves entries against the .phar filename, and the archive opens differently from a regular file). It is not a clean precedent for "extension drives lexer mode at file-open time", but PHP does not have //zero// precedent for filenames mattering to the engine.
Wong: the ".phar" extension is just a reminder. A PHAR file is "just" a PHP file that contains the "__HALT_COMPILER(); ?>" statement that tells the engine and extension "where" to look to decompress the archive into code, with an internal filesystem covered under the "phar://" stream. Any PHAR file could use any extension, and ".phar" is just indicative. It runs natively with PHP without needing an extension to be considered as an archive. I'm also camp-3, I think this feature doesn't add anything to PHP, and breaks BC by introducing file extension as a constraint for conditional parsing methods.

« previous php.internals (#131318) next »