cvs: php4 /main main.c

From: Date: Sun, 27 Aug 2000 19:38:18 +0000
Subject: cvs: php4 /main main.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-1419@lists.php.net to get a copy of this message
sas Sun Aug 27 12:38:18 2000 EDT Modified files: /php4/main main.c Log: If a SAPI module does not pass an absolute path as primary_file to php_execute_script(), we will now change the filename to point to the absolute path. Index: php4/main/main.c diff -u php4/main/main.c:1.298 php4/main/main.c:1.299 --- php4/main/main.c:1.298 Sun Aug 27 11:01:17 2000 +++ php4/main/main.c Sun Aug 27 12:38:18 2000 @@ -19,7 +19,7 @@ */ -/* $Id: main.c,v 1.298 2000/08/27 18:01:17 andi Exp $ */ +/* $Id: main.c,v 1.299 2000/08/27 19:38:18 sas Exp $ */ #include <stdio.h> @@ -1105,9 +1105,11 @@ { zend_file_handle *prepend_file_p, *append_file_p; zend_file_handle prepend_file, append_file; - char old_cwd[4096] = ""; + char old_cwd[4096]; + char new_path[4096] = ""; SLS_FETCH(); + old_cwd[0] = new_path[0] = '\0'; php_hash_environment(ELS_C SLS_CC PLS_CC); zend_activate_modules(); @@ -1147,6 +1149,13 @@ if (primary_file->type == ZEND_HANDLE_FILENAME && primary_file->filename) { V_GETCWD(old_cwd, sizeof(old_cwd)-1); + + if (!IS_ABSOLUTE_PATH(primary_file->filename, strlen(primary_file->filename))) { + snprintf(new_path, sizeof(new_path), "%s%c%s", old_cwd, PHP_DIR_SEPARATOR, primary_file->filename); + new_path[sizeof(new_path)-1] = '\0'; + primary_file->filename = new_path; + } + V_CHDIR_FILE(primary_file->filename); }

« previous php.cvs (#1419) next »