[php-src] Issue #10741: Loading a .phar permanently changes require

From: Date: Wed, 01 Mar 2023 11:14:17 +0000
Subject: [php-src] Issue #10741: Loading a .phar permanently changes require
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243828@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10741 Author: Sainan ### Description When loading a .phar file, require is hooked so that .php files within the phar archive can be loaded transparently. However, this hook is never removed, so attempting to include a file with a relative path (absolute path is not affected) may result in the loaded file actually being one from the phar archive, this then snowballs into very confusing "Cannot redeclare" errors, etc. Reproducing this is a bit more complex than a single script, so here's a repro bundle: [repro.zip](https://github.com/php/php-src/files/10860141/repro.zip) Just run the test.php in there and you will see "Cannot redeclare libraryFunc()" because it indeed loads repro.phar/base.php twice, which contains the following code: ```php <?php function libraryFunc() { } ``` ### PHP Version PHP 8.2.3 ### Operating System Windows 10

« previous php.bugs (#243828) next »