Bug #68133 [Opn->Csd]: Fatal error: require_once/include_once when using reference
| From: | nikic@php.net | Date: | Fri, 03 Oct 2014 19:09:29 +0000 |
| Subject: | Bug #68133 [Opn->Csd]: Fatal error: require_once/include_once when using reference | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187824@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68133&edit=1
ID: 68133
Updated by: nikic@php.net
Reported by: pegasus at vaultwiki dot org
Summary: Fatal error: require_once/include_once when using
reference
-Status: Open
+Status: Closed
Type: Bug
Package: *General Issues
Operating System: Centos 6
PHP Version: master-Git-2014-10-02 (Git)
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e7623f470f3c43396db4adcceeb63bd7029bc5ff
Log: Fix bug #68133 and bug #68135
Previous Comments:
------------------------------------------------------------------------
[2014-10-02 17:38:00] pegasus at vaultwiki dot org
Updated title
------------------------------------------------------------------------
[2014-10-02 17:31:16] pegasus at vaultwiki dot org
Description:
------------
When require_once($x) is used inside a method that takes $x as an argument by reference, the
following error occurs:
Fatal Error: require_once(): Failed opening '0`^,' ...
If ZendOpcache is enabled, only:
Fatal Error: require_once
Checking the value of $x on the preceding line shows the correct value, and file_exists($x) on the
proceeding line shows that PHP can find the file.
If we do $y = $x; require_once($y); instead, or remove the reference, then the fatal error is
bypassed.
However, there are cases in the full use case where it is useful to change the required file within
the method, and then have external access to the new filename thanks to the reference.
Some notes: In the particular cases I've tested, the files have all been inside a symlinked
directory, but I doubt that is related since it works if the reference is removed.
Test script:
---------------
class Test
{
public static function load(&$file)
{
require_once($file);
}
}
$file = '/path/through/symlinked/directory/to/file';
// symlink is owned by root:root with 777 permissions
// target directory is owned by PHP-run-as user
Test::load($file);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68133&edit=1