php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76747 Opcache treats path containing "test.pharma.tld" as a phar file
Submitted: 2018-08-15 12:55 UTC Modified: 2018-08-16 04:26 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: michael dot stucki at typo3 dot org Assigned:
Status: Closed Package: opcache
PHP Version: 7.2.8 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: michael dot stucki at typo3 dot org
New email:
PHP Version: OS:

 

 [2018-08-15 12:55 UTC] michael dot stucki at typo3 dot org
Description:
------------
My website is stored in /var/www/test.pharma.tld. At some point I'm trying to replace the "phar" stream wrapper with a custom version. From then on, any file inclusion with "require" fails:

Warning: require(): Unable to find the wrapper "phar" - did you forget to enable it when you configured PHP? in /var/www/test.pharma.tld/test.php on line 5

Now if you rename the folder to "test.blabla.tld", the error is gone.

It seems like the opcache is treating the path as a phar file just because it contains "test.phar".

Background: I'm using TYPO3 CMS where this became a problem after the latest update:
https://github.com/TYPO3/TYPO3.CMS/commit/a5d6bfab15ab2190576ee1b279c30d5988c2b2b2
However, I've fully isolated the problem, so it's not related to TYPO3.


Test script:
---------------
<?php

// Unregister the "phar" stream wrapper
stream_wrapper_unregister('phar');

// The process fails while trying to register my custom stream wrapper.
// To reproduce the problem, registering is not even needed, so it's
// commented out here:
//stream_wrapper_register('phara', \TYPO3\CMS\Core\IO\PharStreamWrapper::class);

// Include any (empty) file
require 'info.php';


Actual result:
--------------
Warning: require(): Unable to find the wrapper "phar" - did you forget to enable it when you configured PHP? in /var/www/test.pharma.tld/test.php on line 5


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-08-15 13:11 UTC] michael dot stucki at typo3 dot org
I've added a test case using Docker to Github: https://github.com/stucki/php-bug-76747
 [2018-08-16 04:26 UTC] requinix@php.net
-Status: Open +Status: Verified
 [2018-08-16 06:02 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8c92442b4988a07f683439401da8372af0eba2b3
Log: Fixed bug #76747 (Opcache treats path containing &quot;test.pharma.tld&quot; as a phar file)
 [2018-08-16 06:02 UTC] laruence@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 06 14:01:27 2024 UTC