summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/ftp_fopen_wrapper.c7
-rw-r--r--ext/standard/http_fopen_wrapper.c14
2 files changed, 14 insertions, 7 deletions
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index 9bbdbedee4..b5d3ccdc16 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -115,6 +115,11 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch
int i;
char *tpath, *ttpath;
size_t file_size = 0;
+
+ if (strchr(mode, 'a') || strchr(mode, '+')) {
+ php_stream_wrapper_log_error(wrapper, options, "FTP does not support simultaneous read/write connections.");
+ return NULL;
+ }
resource = php_url_parse((char *) path);
if (resource == NULL || resource->path == NULL)
@@ -314,7 +319,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch
php_stream_close(stream);
}
if (tmp_line[0] != '\0')
- zend_error(E_WARNING, "FTP server reports %s", tmp_line);
+ php_stream_wrapper_log_error(wrapper, options, "FTP server reports %s", tmp_line);
return NULL;
}
/* }}} */
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 3a2aa8e57e..c06dc6210c 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -86,11 +86,16 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, ch
char tmp_line[128];
size_t chunk_size = 0, file_size = 0;
+ if (strchr(mode, 'a') || strchr(mode, '+') || strchr(mode, 'w')) {
+ php_stream_wrapper_log_error(wrapper, options, "HTTP wrapper does not writeable connections.");
+ return NULL;
+ }
+
resource = php_url_parse(path);
if (resource == NULL)
return NULL;
- use_ssl = resource->scheme && resource->scheme[4] == 's';
+ use_ssl = resource->scheme && (strlen(resource->scheme) > 4) && resource->scheme[4] == 's';
/* choose default ports */
if (use_ssl && resource->port == 0)
@@ -113,9 +118,7 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, ch
#if HAVE_OPENSSL_EXT
if (use_ssl) {
if (php_stream_sock_ssl_activate(stream, 1) == FAILURE) {
- if (options & REPORT_ERRORS) {
- zend_error(E_WARNING, "Unable to activate SSL mode");
- }
+ php_stream_wrapper_log_error(wrapper, options, "Unable to activate SSL mode");
php_stream_close(stream);
stream = NULL;
goto out;
@@ -323,8 +326,7 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, ch
FREE_ZVAL(stream->wrapperdata);
}
} else {
- if (options & REPORT_ERRORS)
- zend_error(E_WARNING, "HTTP request failed! %s", tmp_line);
+ php_stream_wrapper_log_error(wrapper, options, "HTTP request failed! %s", tmp_line);
}
}
out: