summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>1999-11-30 20:18:11 +0000
committerAndi Gutmans <andi@php.net>1999-11-30 20:18:11 +0000
commit2337d110f91ddf02dede5b91ce22fd69bc3df8fb (patch)
tree622dabbd3eb1192382e253af403362050197b230
parent5463dd5b387298a84736e590e5d213f5bafe9435 (diff)
downloadphp-git-2337d110f91ddf02dede5b91ce22fd69bc3df8fb.tar.gz
- Added opened_path to php_fopen_wrapper() and the URL fopen wrapper (it's not
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)
-rw-r--r--ext/gd/gd.c6
-rw-r--r--ext/standard/basic_functions.c4
-rw-r--r--ext/standard/file.c8
-rw-r--r--main/fopen_wrappers.c15
-rw-r--r--main/fopen_wrappers.h2
-rw-r--r--main/main.c4
-rw-r--r--php4dllts.dsp4
7 files changed, 23 insertions, 20 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index b1f40ccddd..632489f3ca 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -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);
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 2b51c2025b..6227f706cd 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -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;
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 12c6b0bef6..506ef1ecd5 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -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);
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index f296a7efc3..dfa084a0c0 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -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;
diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h
index cd8eaf284e..e92bd83a88 100644
--- a/main/fopen_wrappers.h
+++ b/main/fopen_wrappers.h
@@ -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);
diff --git a/main/main.c b/main/main.c
index ea358d7ce7..27c12fc795 100644
--- a/main/main.c
+++ b/main/main.c
@@ -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) {
diff --git a/php4dllts.dsp b/php4dllts.dsp
index ca4d1eb900..efa09db1bd 100644
--- a/php4dllts.dsp
+++ b/php4dllts.dsp
@@ -893,6 +893,10 @@ SOURCE=.\NEWS
SOURCE=".\php.ini-dist"
# End Source File
+# Begin Source File
+
+SOURCE=".\README.CVS-RULES"
+# End Source File
# End Group
# End Target
# End Project