|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-04-27 23:07 UTC] simpcl2008 at gmail dot com
Description: ------------ In my_compile_file of apc_main.c, the filename of opcode array should be updated when opcode array is found in apc caches. There are two php script files a.php & b.php, and one is the hard link of the other. They have the same inode value, the same file content, and the different file names. When APC is working with (apc.stat = 1) mode, the inode is as the hash key. Assume there is nothing in APC cache, and the script a.php need to be compiled for the first time. The filename field of opcode array generated is "a.php". When b.php need to be executed, opcode array cache hit because of b.php has the same inode with a.php. If the filename field of the found opcode array is not updated, zend_get_executed_filename will return "a.php" but not "b.php" during the execute time of b.php. zend_get_executed_filename can only get the compiled php script file name, but not the executed php script file name. Reproduce code: --------------- apply the following patch file to php 5.3.5: http://bugs.php.net/patch-display.php?bug_id=45421&patch=apc_auto_hardlinks_for_php_5.3.5.diff&revision=1303892859&download=1 php.ini: apc.stat = 1 test php scripts: 1.php <?php> echo executed_filename . PHP_EOL; <?> cp -l 1.php 2.php php 1.php php 2.php Expected result: ---------------- 1.php 2.php Actual result: -------------- 1.php 1.php PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 09:00:01 2025 UTC |
Attach the patch for APC 3.1.6: --- APC-3.1.6/apc_main.c 2010-11-30 18:18:31.000000000 +0800 +++ APC-3.1.6-sae/apc_main.c 2011-04-27 15:56:34.000000000 +0800 @@ -559,6 +559,7 @@ static zend_op_array* my_compile_file(ze if (h->type != ZEND_HANDLE_FILENAME) { zend_llist_add_element(&CG(open_files), h); } + op_array->filename = filename;//estrdup(filename); return op_array; } if(APCG(report_autofilter)) {