php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64063 relative path search bug in no-stat mode
Submitted: 2013-01-24 14:09 UTC Modified: 2016-11-18 21:19 UTC
Votes:2
Avg. Score:4.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: iliya at polihronov dot com Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: 5.4.11 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-01-24 14:09 UTC] iliya at polihronov dot com
Description:
------------
I no-stat mode,the canonicalization code doesn't consider the currently executed 
filename when searching for relative paths.

I reported this bug before in this bug report - https://bugs.php.net/bug.php?
id=59749 but it wasn't really discussed, because there was a more serious 
problem 
there. 

I also know it has been discussed before and that you know about this 
problem(/feature), but not sure if a patch has been submitted. It would be nice 
if 
we get this committed as we have been porting patch from version to version of 
APC 
on WordPress.com where we run over 40 million WordPress sites and seems to work 
fine and might be useful to others. Converting paths to absolute isn't really a 
solution for everyone (us included) and obviously people want apc.canonicalize.


Test script:
---------------
apc.stat = 0

cat index.php 
<?php include_once("a/test.php"); ?>

cat a/test.php
<?php include_once('b/include1.php'); ?>


cat a/b/include1.php 
<?php include_once('include2.php'); ?>

cat a/include2.php 
<?php echo "Wrong file"; ?>

cat a/b/include2.php 
<?php echo "Correct file"; ?>

Expected result:
----------------
"Correct file"

Actual result:
--------------
On the first execution, I get "Correct file". On the second execution and after I 
get "Wrong file".

Patches

Fix-includes-relative-path-search (last revision 2013-01-24 14:10 UTC by iliya at polihronov dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-18 23:49 UTC] gopalv@php.net
Interesting patch, I need to think over this one. 

The exec_fname has different meanings during execution vs compile here.
 [2013-02-19 00:15 UTC] iliya at polihronov dot com
It is passed only during the compilation of the entry in apc_compile.c. Otherwise 
it would use zend_get_executed_filename(). What is your concern? 
It's also somewhat well tested as we use this patch in production for more than a 
year, with millions of lines of code and all kinds of use cases.
 [2016-11-18 21:19 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-11-18 21:19 UTC] kalle@php.net
APC is no longer supported in favor of opcache that comes bundled with PHP, if you wish to use the user cache, then look at PECL/APCu.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Nov 24 16:01:24 2020 UTC