]> granicus.if.org Git - php/commitdiff
- Added opened_path to php_fopen_wrapper() and the URL fopen wrapper (it's not
authorAndi Gutmans <andi@php.net>
Tue, 30 Nov 1999 20:18:11 +0000 (20:18 +0000)
committerAndi Gutmans <andi@php.net>
Tue, 30 Nov 1999 20:18:11 +0000 (20:18 +0000)
  always properly set, it's a TODO for all of us).  This enables us to implement
  true 'use' support.
@- Added support for the 'use' keyword - behaves like 'require', but will not
@  use the same file more than once (Andi & Zeev, Zend library)

ext/gd/gd.c
ext/standard/basic_functions.c
ext/standard/file.c
main/fopen_wrappers.c
main/fopen_wrappers.h
main/main.c
php4dllts.dsp

index b1f40ccddd59e471a8287ac923ea01cadca85deb..632489f3ca783ac08046af6e892f60372036afe1 100644 (file)
@@ -312,7 +312,7 @@ PHP_FUNCTION(imageloadfont) {
 #if WIN32|WINNT
        fp = fopen(file->value.str.val, "rb");
 #else
-       fp = php3_fopen_wrapper(file->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd);
+       fp = php3_fopen_wrapper(file->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
 #endif
        if (fp == NULL) {
                php_error(E_WARNING, "ImageFontLoad: unable to open file");
@@ -416,7 +416,7 @@ void php3_imagecreatefrompng (INTERNAL_FUNCTION_PARAMETERS) {
 #if WIN32|WINNT
       fp = fopen(file->value.str.val, "rb");
 #else
-      fp = php3_fopen_wrapper(file->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd);
+      fp = php3_fopen_wrapper(file->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
 #endif
       if (!fp) {
               php3_strip_url_passwd(fn);
@@ -526,7 +526,7 @@ PHP_FUNCTION(imagecreatefromgif )
 #if WIN32|WINNT
        fp = fopen(file->value.str.val, "rb");
 #else
-       fp = php3_fopen_wrapper(file->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd);
+       fp = php3_fopen_wrapper(file->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
 #endif
        if (!fp) {
                php3_strip_url_passwd(fn);
index 2b51c2025bf0f86f2a8d09d7aa8d06400ec3c92f..6227f706cdd2c67b54803f06bbc0fb62d059d878 100644 (file)
@@ -925,7 +925,7 @@ PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers){
        case 1: /*send an email*/
                {
 #if HAVE_SENDMAIL
-               if (!_php3_mail(opt,"PHP3 error_log message",message,headers)){
+               if (!_php3_mail(opt,"PHP error_log message",message,headers)){
                        return FAILURE;
                }
 #else
@@ -939,7 +939,7 @@ PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers){
                return FAILURE;
                break;
        case 3: /*save to a file*/
-               logfile=php3_fopen_wrapper(opt,"a", (IGNORE_URL|ENFORCE_SAFE_MODE), &issock, &socketd);
+               logfile=php3_fopen_wrapper(opt,"a", (IGNORE_URL|ENFORCE_SAFE_MODE), &issock, &socketd, NULL);
                if(!logfile) {
                        php_error(E_WARNING,"error_log: Unable to write to %s",opt);
                        return FAILURE;
index 12c6b0bef65a7d2336b4d4725236406a5a2f68c5..506ef1ecd5840b46ae705df65a072f0554ebccff 100644 (file)
@@ -411,7 +411,7 @@ PHP_FUNCTION(get_meta_tags)
        }
        convert_to_string_ex(filename);
        
-       fp = php3_fopen_wrapper((*filename)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd);
+       fp = php3_fopen_wrapper((*filename)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
        if (!fp && !socketd) {
                if (issock != BAD_URL) {
                        char *tmp = estrdup((*filename)->value.str.val);
@@ -535,7 +535,7 @@ PHP_FUNCTION(file)
        }
        convert_to_string_ex(filename);
        
-       fp = php3_fopen_wrapper((*filename)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd);
+       fp = php3_fopen_wrapper((*filename)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
        if (!fp && !socketd) {
                if (issock != BAD_URL) {
                        char *tmp = estrdup((*filename)->value.str.val);
@@ -652,7 +652,7 @@ PHP_FUNCTION(fopen)
         * We need a better way of returning error messages from
         * php3_fopen__wrapper().
         */
-       fp = php3_fopen_wrapper((*arg1)->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd);
+       fp = php3_fopen_wrapper((*arg1)->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
        if (!fp && !socketd) {
                if (issock != BAD_URL) {
                        char *tmp = estrdup((*arg1)->value.str.val);
@@ -1320,7 +1320,7 @@ PHP_FUNCTION(readfile)
         * We need a better way of returning error messages from
         * php3_fopen_wrapper().
         */
-       fp = php3_fopen_wrapper((*arg1)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd);
+       fp = php3_fopen_wrapper((*arg1)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
        if (!fp && !socketd){
                if (issock != BAD_URL) {
                        char *tmp = estrdup((*arg1)->value.str.val);
index f296a7efc391ae5180cd43c1292a5f3322b28d57..dfa084a0c06700c181d38973a58762c57d39500e 100644 (file)
@@ -79,7 +79,7 @@
 #include <sys/un.h>
 #endif
 
-static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, int *issock, int *socketd);
+static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path);
 
 int _php3_getftpresult(int socketd);
 
@@ -181,7 +181,7 @@ PHPAPI int _php3_check_open_basedir(char *path)
        return 0;
 }
 
-PHPAPI FILE *php3_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd)
+PHPAPI FILE *php3_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
 {
        int cm=2;  /* checkuid mode: 2 = if file does not exist, check directory */
        PLS_FETCH();
@@ -190,12 +190,12 @@ PHPAPI FILE *php3_fopen_wrapper(char *path, char *mode, int options, int *issock
           be runtime enabled, NOT compile time. */
 #if PHP3_URL_FOPEN
        if (!(options & IGNORE_URL)) {
-               return php3_fopen_url_wrapper(path, mode, options, issock, socketd);
+               return php3_fopen_url_wrapper(path, mode, options, issock, socketd, opened_path);
        }
 #endif
 
        if (options & USE_PATH && PG(include_path) != NULL) {
-               return php3_fopen_with_path(path, mode, PG(include_path), NULL);
+               return php3_fopen_with_path(path, mode, PG(include_path), opened_path);
        } else {
                if(!strcmp(mode,"r") || !strcmp(mode,"r+")) cm=0;
                if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!_php3_checkuid(path, cm))) {
@@ -427,7 +427,7 @@ PHPAPI FILE *php3_fopen_with_path(char *filename, char *mode, char *path, char *
  * Otherwise, fopen is called as usual and the file pointer is returned.
  */
 
-static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, int *issock, int *socketd)
+static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
 {
        url *resource;
        int result;
@@ -590,7 +590,7 @@ static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, i
                        *socketd = 0;
                        free_url(resource);
                        if (location[0] != '\0') {
-                               return php3_fopen_url_wrapper(location, mode, options, issock, socketd);
+                               return php3_fopen_url_wrapper(location, mode, options, issock, socketd, opened_path);
                        } else {
                                return NULL;
                        }
@@ -883,12 +883,11 @@ static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, i
                free_url(resource);
                *issock = 1;
                return (fp);
-
        } else {
                PLS_FETCH();
 
                if (options & USE_PATH) {
-                       fp = php3_fopen_with_path((char *) path, mode, PG(include_path), NULL);
+                       fp = php3_fopen_with_path((char *) path, mode, PG(include_path), opened_path);
                } else {
                        int cm=2;
                        if(!strcmp(mode,"r") || !strcmp(mode,"r+")) cm=0;
index cd8eaf284ebde986931abd27828230aefdc9c30c..e92bd83a88fad9007f2545a1b66c4da5e2d031f5 100644 (file)
@@ -66,7 +66,7 @@
 #define IS_SOCKET              1
 #define BAD_URL                        2
 
-extern PHPAPI FILE *php3_fopen_wrapper(char *filename, char *mode, int options, int *issock, int *socketd);
+extern PHPAPI FILE *php3_fopen_wrapper(char *filename, char *mode, int options, int *issock, int *socketd, char **opened_path);
 
 PHPAPI FILE *php3_fopen_for_parser(void);
 
index ea358d7ce7df19af2a1273131b633cf758723cab..27c12fc795202b20a8bc7573a83513fd221b0e83 100644 (file)
@@ -573,14 +573,14 @@ PHP_FUNCTION(set_time_limit)
 }
 
 
-static FILE *php_fopen_wrapper_for_zend(const char *filename)
+static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path)
 {
        int issock=0, socketd=0;
        int old_chunk_size;
        FILE *retval;
        
        old_chunk_size = _php3_sock_set_def_chunk_size(1);
-       retval=php3_fopen_wrapper((char *) filename, "r", USE_PATH|IGNORE_URL_WIN, &issock, &socketd);
+       retval=php3_fopen_wrapper((char *) filename, "r", USE_PATH|IGNORE_URL_WIN, &issock, &socketd, opened_path);
        _php3_sock_set_def_chunk_size(old_chunk_size);
        
        if (issock) {
index ca4d1eb900d91fcc10b9ec33f37c56198879d28a..efa09db1bd10569bd9a1d63a9b2b373c621cf692 100644 (file)
@@ -893,6 +893,10 @@ SOURCE=.\NEWS
 \r
 SOURCE=".\php.ini-dist"\r
 # End Source File\r
+# Begin Source File\r
+\r
+SOURCE=".\README.CVS-RULES"\r
+# End Source File\r
 # End Group\r
 # End Target\r
 # End Project\r