From: Dmitry Stogov Date: Mon, 13 Mar 2006 09:35:45 +0000 (+0000) Subject: Fixed realpath() cache for main script with FastCGI SAPI X-Git-Tag: php-5.1.3RC2~123 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d21669fc807a85aba09e4ebec0591f38a0d1674b;p=php Fixed realpath() cache for main script with FastCGI SAPI --- diff --git a/main/main.c b/main/main.c index 4c9c4bc508..0626b5c047 100644 --- a/main/main.c +++ b/main/main.c @@ -1647,7 +1647,6 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) #else char *old_cwd; #endif - char *old_primary_file_path = NULL; int retval = 0; EG(exit_status) = 0; @@ -1684,16 +1683,15 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) /* Only lookup the real file path and add it to the included_files list if already opened * otherwise it will get opened and added to the included_files list in zend_execute_scripts */ - if (primary_file->filename && primary_file->type != ZEND_HANDLE_FILENAME) { + if (primary_file->filename && + primary_file->opened_path == NULL && + primary_file->type != ZEND_HANDLE_FILENAME) { int realfile_len; int dummy = 1; - if (VCWD_REALPATH(primary_file->filename, realfile)) { + + if (expand_filepath(primary_file->filename, realfile TSRMLS_CC)) { realfile_len = strlen(realfile); zend_hash_add(&EG(included_files), realfile, realfile_len+1, (void *)&dummy, sizeof(int), NULL); - if (strncmp(realfile, primary_file->filename, realfile_len)) { - old_primary_file_path = primary_file->filename; - primary_file->filename = realfile; - } } } @@ -1722,10 +1720,6 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) zend_set_timeout(INI_INT("max_execution_time")); retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS); - if (old_primary_file_path) { - primary_file->filename = old_primary_file_path; - } - } zend_end_try(); #if HAVE_BROKEN_GETCWD