ID: 21310 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Feedback Bug Type: *Directory/Filesystem functions Operating System: Solaris 8 PHP Version: 4.3.0 New Comment:
Please use the latest stable snapshot from snaps.php.net. Previous Comments: ------------------------------------------------------------------------ [2003-02-13 04:54:59] [EMAIL PROTECTED] Should I apply this patch to the latest "Stable (4.3.x-dev)" version or to 4.3.0 version? ------------------------------------------------------------------------ [2003-02-13 03:24:25] [EMAIL PROTECTED] Testing the patch should not be a problem if it fixes the problem you already described... Don't forget, you can always run a test server on another port for a short while without affecting your main server. Feedback means that we need to know if the proposed solution fixes it for you. Our access to Solaris is quite limited, so we rely on feedback to tell us if things are working. If you can't provide feedback, and we don't have a way of testing it ourselves, then this report will just get suspended. ------------------------------------------------------------------------ [2003-02-13 02:29:56] [EMAIL PROTECTED] To: [EMAIL PROTECTED] Perhaps I don't understand "Feedback" status. Do you expect more information concerning bug or do you expect that users will test new patches on production servers? ("Oxford dictionary": "feedback: return of part of the output of a system to its source".) ------------------------------------------------------------------------ [2003-02-12 14:19:34] [EMAIL PROTECTED] Try the patch below. Solaris has issues with getcwd() needing read perms on directories (instead of just execute). This patch lets PHP open files even if it cannot get the cwd, or resolve the realpath() of a file. Index: TSRM/tsrm_virtual_cwd.c =================================================================== RCS file: /repository/TSRM/tsrm_virtual_cwd.c,v retrieving revision 1.41 diff -u -b -u -r1.41 tsrm_virtual_cwd.c --- TSRM/tsrm_virtual_cwd.c 6 Nov 2002 18:07:22 -0000 1.41 +++ TSRM/tsrm_virtual_cwd.c 12 Feb 2003 04:39:11 -0000 @@ -303,7 +303,7 @@ return (0); #if !defined(TSRM_WIN32) && !defined(NETWARE) - if (IS_ABSOLUTE_PATH(path, path_length)) { + if (IS_ABSOLUTE_PATH(path, path_length) || (state->cwd_length < 1)) { if (use_realpath && realpath(path, resolved_path)) { path = resolved_path; path_length = strlen(path); @@ -363,6 +363,7 @@ } + if (state->cwd_length > 0 || IS_ABSOLUTE_PATH(path, path_length)) { ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok); while (ptr) { ptr_length = strlen(ptr); @@ -416,6 +417,11 @@ state->cwd[state->cwd_length+1] = '\0'; state->cwd_length++; } + } else { + state->cwd = (char *) realloc(state->cwd, path_length+1); + memcpy(state->cwd, path, path_length+1); + state->cwd_length = path_length; + } if (verify_path && verify_path(state)) { CWD_STATE_FREE(state); Index: main/main.c =================================================================== RCS file: /repository/php4/main/main.c,v retrieving revision 1.512.2.5 diff -u -b -u -r1.512.2.5 main.c --- main/main.c 16 Dec 2002 15:44:06 -0000 1.512.2.5 +++ main/main.c 12 Feb 2003 04:39:12 -0000 @@ -1507,7 +1507,11 @@ { zend_file_handle *prepend_file_p, *append_file_p; zend_file_handle prepend_file, append_file; +#ifdef VIRTUAL_DIR char *old_cwd; +#else + int old_cwd_fd; +#endif char *old_primary_file_path = NULL; int retval = 0; @@ -1515,9 +1519,11 @@ if (php_handle_special_queries(TSRMLS_C)) { return 0; } +#ifdef VIRTUAL_DIR #define OLD_CWD_SIZE 4096 old_cwd = do_alloca(OLD_CWD_SIZE); old_cwd[0] = '\0'; +#endif zend_try { #ifdef PHP_WIN32 @@ -1528,7 +1534,11 @@ if (primary_file->type == ZEND_HANDLE_FILENAME && primary_file->filename) { +#ifdef VIRTUAL_DIR VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1); +#else + old_cwd_fd = open(".", 0); +#endif VCWD_CHDIR_FILE(primary_file->filename); } @@ -1578,10 +1588,14 @@ } zend_end_try(); +#ifdef VIRTUAL_DIR if (old_cwd[0] != '\0') { VCWD_CHDIR(old_cwd); } free_alloca(old_cwd); +#else + fchdir(old_cwd_fd); +#endif return retval; } /* }}} */ Index: main/safe_mode.c =================================================================== RCS file: /repository/php4/main/safe_mode.c,v retrieving revision 1.51 diff -u -b -u -r1.51 safe_mode.c --- main/safe_mode.c 6 Nov 2002 18:07:23 -0000 1.51 +++ main/safe_mode.c 12 Feb 2003 04:39:12 -0000 @@ -121,6 +121,8 @@ VCWD_REALPATH(filename, path); *s = DEFAULT_SLASH; } else { + path[0] = '.'; + path[1] = '\0'; VCWD_GETCWD(path, sizeof(path)); } } /* end CHECKUID_ALLOW_ONLY_DIR */ ------------------------------------------------------------------------ [2003-02-06 12:37:26] [EMAIL PROTECTED] Have you checked ALL directories permissions (especially permission to read for HTTP server) from / to directory with included file? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/21310 -- Edit this bug report at http://bugs.php.net/?id=21310&edit=1