|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-12-12 01:15 UTC] gopalv82 at yahoo dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 05:00:01 2025 UTC |
Description: ------------ The attached patch changes the behaviour of apc.filters to always match on the absolute path of the file, instead of the one passed to include/require. The patch first asserts that opened_path is set, possibly by calling expand_filepath in the same fashion that php_fopen_and_set_opened_path does. Subsequently, apc_regex_match_array uses h->opened_path instead of h->filename to match on the regex array. The patch is against 3.0.19. Kind regards, Michel Reproduce code: --------------- --- a/apc_main.c Wed Dec 10 11:48:59 2008 +0100 +++ b/apc_main.c Wed Dec 10 15:57:47 2008 +0100 @@ -310,7 +310,10 @@ /* check our regular expression filters */ if (APCG(filters) && apc_compiled_filters) { - int ret = apc_regex_match_array(apc_compiled_filters, h->filename); + if(!h->opened_path){ + h->opened_path = expand_filepath(h->filename, NULL TSRMLS_CC); + } + int ret = apc_regex_match_array(apc_compiled_filters, h->opened_path); if(ret == APC_NEGATIVE_MATCH || (ret != APC_POSITIVE_MATCH && !APCG(cache_by_default))) { return old_compile_file(h, type TSRMLS_CC); } Expected result: ---------------- E.g., setting apc.filters="/foo/bar" causes APC to never cache files anywhere in the /foo/bar tree, regardless of the incidental path and filename used to include/require those files.