php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59951 APC & unnecessary stat() calls with dynamic include()
Submitted: 2011-09-14 09:36 UTC Modified: 2016-11-18 21:36 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: gwillem at gmail dot com Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: 5.3.6 OS: linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-09-14 09:36 UTC] gwillem at gmail dot com
Description:
------------
APC uses a stat64() call if the argument to include() is a 
variable.

It doesn't, if the argument is a string. 

In both cases the opcode cache works fine. 

In applications with many include()s and slow storage, it 
would be nice to eliminate this.

Reproduce code:
---------------
<?php
$file = "a.php";
include $file;
include "b.php";
?>


Expected result:
----------------
No stat64() calls

Actual result:
--------------
open("/home/willem/index.php", O_RDONLY|O_LARGEFILE) = 5 
fstat64(5, {st_mode=S_IFREG|0644, st_size=58, ...}) = 0 
getcwd("/", 4095) = 2 
chdir("/home/willem") = 0 
close(5)  = 0 
stat64("./a.php", {st_mode=S_IFREG|0644, st_size=2, ...}) = 0 
getcwd("/home/willem", 4096)


Patches

apc-stat-patch (last revision 2011-10-22 06:50 UTC by noda dot yoshikazu at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-22 07:04 UTC] noda dot yoshikazu at gmail dot com
A note for the apc-stat-patch:

It is for APC-3.1.9. Not tested with older versions.

Yoshi
 [2016-11-18 21:36 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-11-18 21:36 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 21:01:23 2020 UTC