Bug #78138 [Opn->Csd]: Opcache incorrectly handles PHAR files when validate_permission option enabled
Edit report at https://bugs.php.net/bug.php?id=78138&edit=1
ID: 78138
Updated by: nikic@php.net
Reported by: alex at cgi-central dot net
Summary: Opcache incorrectly handles PHAR files when
validate_permission option enabled
-Status: Open
+Status: Closed
Type: Bug
Package: opcache
Operating System: Linux
PHP Version: 7.3.6
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of alex@cgi-central.net
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a4acff3e21778e8d1f635cf74611b1c13de5ee2a
Log: Fix bug #78138: opcache.validate_permission incorrectly works with PHAR files
Previous Comments:
------------------------------------------------------------------------
[2019-06-11 14:50:36] alex at cgi-central dot net
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
------------------------------------------------------------------------
[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
Thread (4 messages)