summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/file.c2
-rw-r--r--ext/standard/file.h1
-rw-r--r--ext/standard/ftp_fopen_wrapper.c5
-rw-r--r--ext/standard/http_fopen_wrapper.c9
4 files changed, 10 insertions, 7 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index fc60cac1df..953ca7928d 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -170,7 +170,7 @@ static void file_globals_dtor(php_file_globals *file_globals_p TSRMLS_DC)
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("user_agent", NULL, PHP_INI_ALL, OnUpdateString, user_agent, php_file_globals, file_globals)
- STD_PHP_INI_ENTRY("from", NULL, PHP_INI_ALL, OnUpdateString, from_address, php_file_globals, file_globals)
+ PHP_INI_ENTRY("from", NULL, PHP_INI_ALL, NULL)
STD_PHP_INI_ENTRY("default_socket_timeout", "60", PHP_INI_ALL, OnUpdateLong, default_socket_timeout, php_file_globals, file_globals)
STD_PHP_INI_ENTRY("auto_detect_line_endings", "0", PHP_INI_ALL, OnUpdateLong, auto_detect_line_endings, php_file_globals, file_globals)
PHP_INI_END()
diff --git a/ext/standard/file.h b/ext/standard/file.h
index 7b4b22c936..fc04709d90 100644
--- a/ext/standard/file.h
+++ b/ext/standard/file.h
@@ -119,7 +119,6 @@ typedef struct {
long auto_detect_line_endings;
long default_socket_timeout;
char *user_agent; /* for the http wrapper */
- char *from_address; /* for the ftp and http wrappers */
char *user_stream_current_filename; /* for simple recursion protection */
php_stream_context *default_context;
HashTable *stream_wrappers; /* per-request copy of url_stream_wrappers_hash */
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index 6b858b6aed..6b418157df 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -249,8 +249,9 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, char *path
} else {
/* if the user has configured who they are,
send that as the password */
- if (FG(from_address)) {
- php_stream_printf(stream TSRMLS_CC, "PASS %s\r\n", FG(from_address));
+ char *from_address = php_ini_string("from", sizeof("from"), 0);
+ if (from_address[0] != '\0') {
+ php_stream_printf(stream TSRMLS_CC, "PASS %s\r\n", from_address);
} else {
php_stream_write_string(stream, "PASS anonymous\r\n");
}
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 931c8e6ce8..afddc6282e 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -443,9 +443,12 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
}
/* if the user has configured who they are, send a From: line */
- if (((have_header & HTTP_HEADER_FROM) == 0) && FG(from_address)) {
- if (snprintf(scratch, scratch_len, "From: %s\r\n", FG(from_address)) > 0)
- php_stream_write(stream, scratch, strlen(scratch));
+ {
+ char *from_address = php_ini_string("from", sizeof("from"), 0);
+ if (((have_header & HTTP_HEADER_FROM) == 0) && from_address[0] != '\0') {
+ if (snprintf(scratch, scratch_len, "From: %s\r\n", from_address) > 0)
+ php_stream_write(stream, scratch, strlen(scratch));
+ }
}
/* Send Host: header so name-based virtual hosts work */