]> granicus.if.org Git - php/commitdiff
Fixed chdir() into requested file directory inconsistencies
authorDmitry Stogov <dmitry@php.net>
Mon, 21 Jul 2008 08:43:36 +0000 (08:43 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 21 Jul 2008 08:43:36 +0000 (08:43 +0000)
main/fopen_wrappers.c
main/main.c
sapi/caudium/caudium.c

index 4acc47e4f2602221b0d339bf5ff527f79cbd72e5..21a6a599503219ac172b1330e6b445800d3c63bc 100644 (file)
@@ -425,9 +425,6 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC)
 
        file_handle->opened_path = expand_filepath(filename, NULL TSRMLS_CC);
 
-       if (!(SG(options) & SAPI_OPTION_NO_CHDIR)) {
-               VCWD_CHDIR_FILE(filename);
-       }
        SG(request_info).path_translated = filename;
 
        file_handle->filename = SG(request_info).path_translated;
index 2e083712a5cb1ec9226cbe8c60638d5931bd5f1a..ea7ed5d83712ef9749f026fba1c2358961002e89 100644 (file)
@@ -2027,7 +2027,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
 
                PG(during_request_startup) = 0;
 
-               if ((primary_file->type == ZEND_HANDLE_FILENAME || primary_file->type == ZEND_HANDLE_STREAM) && primary_file->filename) {
+               if (primary_file->filename && !(SG(options) & SAPI_OPTION_NO_CHDIR)) {
 #if HAVE_BROKEN_GETCWD
                        /* this looks nasty to me */
                        old_cwd_fd = open(".", 0);
@@ -2117,7 +2117,7 @@ PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval **ret
 
                PG(during_request_startup) = 0;
 
-               if (primary_file->type == ZEND_HANDLE_FILENAME && primary_file->filename) {
+               if (primary_file->filename && !(SG(options) & SAPI_OPTION_NO_CHDIR)) {
                        VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1);
                        VCWD_CHDIR_FILE(primary_file->filename);
                }
index 9bbd4190508a193db32486bde80084cfa70d72b5..fb77c7d3ddb42093ed06328ae377a1201af09764 100644 (file)
@@ -639,15 +639,6 @@ static void php_caudium_module_main(php_caudium_request *ureq)
   THREADS_ALLOW();
 #endif
 
-#ifdef VIRTUAL_DIR
-  /* Change virtual directory, if the feature is enabled, which is
-   * (almost) a requirement for PHP in Caudium. Might want to fail if it
-   * isn't. Not a problem though, since it's on by default when using ZTS
-   * which we require.
-   */
-  VCWD_CHDIR_FILE(THIS->filename->str);
-#endif
-  
   file_handle.type = ZEND_HANDLE_FILENAME;
   file_handle.filename = THIS->filename->str;
   file_handle.opened_path = NULL;