Bug #68133 [NEW]: Fatal error: require_once/include_once
| From: | pegasus at vaultwiki dot org | Date: | Thu, 02 Oct 2014 17:31:17 +0000 |
| Subject: | Bug #68133 [NEW]: Fatal error: require_once/include_once | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-187797@lists.php.net to get a copy of this message | ||
From: pegasus at vaultwiki dot org
Operating system: Centos 6
PHP version: master-Git-2014-10-02 (Git)
Package: *General Issues
Bug Type: Bug
Bug description:Fatal error: require_once/include_once
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 bug report at https://bugs.php.net/bug.php?id=68133&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68133&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68133&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68133&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68133&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68133&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68133&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68133&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68133&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68133&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68133&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68133&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68133&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68133&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68133&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68133&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68133&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68133&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68133&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68133&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68133&r=mysqlcfg