Bug #78138 [PATCH]: Opcache incorrectly handles PHAR files when validate_permission option enabled

From: Date: Tue, 11 Jun 2019 14:50:36 +0000
Subject: Bug #78138 [PATCH]: Opcache incorrectly handles PHAR files when validate_permission option enabled
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221222@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78138&edit=1 ID: 78138 Patch added by: alex@cgi-central.net Reported by: alex at cgi-central dot net Summary: Opcache incorrectly handles PHAR files when validate_permission option enabled Status: Open Type: Bug Package: opcache Operating System: Linux PHP Version: 7.3.6 Block user comment: N Private report: N New Comment: The following pull request has been associated: Patch Name: Fix for Bug #78138 - opcache.validate_permission incorrectly handles PHAR On GitHub: https://github.com/php/php-src/pull/4252 Patch: https://github.com/php/php-src/pull/4252.patch Previous Comments: ------------------------------------------------------------------------ [2019-06-11 10:55:07] alex at cgi-central dot net I've found a possible workaround, but anyway it is important to get this problem solved. If file is included like this Phar::loadPhar(__DIR__ . '/33.phar', 'phar33'); include 'phar://phar33/test.php'; instead of usual include ('phar://' . __DIR__ . '/33.phar/test.php'); Then it works without any issues. ------------------------------------------------------------------------ [2019-06-10 15:18:57] alex at cgi-central dot net Description: ------------ When option opcache.validate_permission is enabled, only first access to a file inside PHAR archive is succesfull. All the following attempts to include or require a file from PHAR archive fail with error -- Warning: include(): Failed opening 'phar:///var/www/html/33.phar/test.php' for inclusion -- In same time, file_get_contents('phar:///var/www/html/33.phar/test.php') works fine as expected, so that is definitely an opcache issue. It happens even with "opcache.enable" is set to "off", so there is no quick workaround. Test script: --------------- There is a short test script: https://github.com/alex-scott/php-phar-bug Expected result: ---------------- The index.php file expected to output "OK" on each run. Actual result: -------------- Only first-run displays "OK", the following runs display error Warning: include(): Failed opening 'phar:///var/www/html/33.phar/test.php' for inclusion ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78138&edit=1

« previous php.bugs (#221222) next »