summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/file.c6
-rw-r--r--ext/standard/ftp_fopen_wrapper.c6
-rw-r--r--ext/standard/http_fopen_wrapper.c4
-rw-r--r--ext/standard/php_fopen_wrapper.c3
-rw-r--r--ext/standard/php_fopen_wrappers.h4
-rw-r--r--ext/standard/streamsfuncs.c8
6 files changed, 14 insertions, 17 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 3599313a71..dae4235a99 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -802,7 +802,7 @@ PHP_FUNCTION(tempnam)
{
char *dir, *prefix;
size_t dir_len, prefix_len;
- char *opened_path;
+ zend_string *opened_path;
int fd;
zend_string *p;
@@ -823,9 +823,7 @@ PHP_FUNCTION(tempnam)
if ((fd = php_open_temporary_fd_ex(dir, p->val, &opened_path, 1)) >= 0) {
close(fd);
- // TODO: avoid reallocation ???
- RETVAL_STRING(opened_path);
- efree(opened_path);
+ RETVAL_STR(opened_path);
}
zend_string_release(p);
}
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index 1c83a9434c..b003ffda0f 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -131,7 +131,7 @@ static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper, php_stream *
/* {{{ php_ftp_fopen_connect
*/
static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char *path, const char *mode, int options,
- char **opened_path, php_stream_context *context, php_stream **preuseid,
+ zend_string **opened_path, php_stream_context *context, php_stream **preuseid,
php_url **presource, int *puse_ssl, int *puse_ssl_on_data)
{
php_stream *stream = NULL, *reuseid = NULL;
@@ -412,7 +412,7 @@ static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, size_t ip_
/* {{{ php_fopen_url_wrap_ftp
*/
php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *path, const char *mode,
- int options, char **opened_path, php_stream_context *context STREAMS_DC)
+ int options, zend_string **opened_path, php_stream_context *context STREAMS_DC)
{
php_stream *stream = NULL, *datastream = NULL;
php_url *resource = NULL;
@@ -684,7 +684,7 @@ static php_stream_ops php_ftp_dirstream_ops = {
/* {{{ php_stream_ftp_opendir
*/
php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options,
- char **opened_path, php_stream_context *context STREAMS_DC)
+ zend_string **opened_path, php_stream_context *context STREAMS_DC)
{
php_stream *stream, *reuseid, *datastream = NULL;
php_ftp_dirstream_data *dirsdata;
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 6e0ea812a4..1f54f62c6c 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -110,7 +110,7 @@ static inline void strip_header(char *header_bag, char *lc_header_bag,
}
php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
- const char *path, const char *mode, int options, char **opened_path,
+ const char *path, const char *mode, int options, zend_string **opened_path,
php_stream_context *context, int redirect_max, int flags STREAMS_DC) /* {{{ */
{
php_stream *stream = NULL;
@@ -933,7 +933,7 @@ out:
}
/* }}} */
-php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC) /* {{{ */
+php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC) /* {{{ */
{
return php_stream_url_wrap_http_ex(wrapper, path, mode, options, opened_path, context, PHP_URL_REDIRECT_MAX, HTTP_WRAPPER_HEADER_INIT STREAMS_CC);
}
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index 5e85d4dc43..1dc6a21cf5 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -172,7 +172,7 @@ static void php_stream_apply_filter_list(php_stream *stream, char *filterlist, i
/* }}} */
php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *path, const char *mode, int options,
- char **opened_path, php_stream_context *context STREAMS_DC) /* {{{ */
+ zend_string **opened_path, php_stream_context *context STREAMS_DC) /* {{{ */
{
int fd = -1;
int mode_rw = 0;
@@ -345,6 +345,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
efree(pathdup);
return NULL;
}
+
if (!(stream = php_stream_open_wrapper(p + 10, mode, options, opened_path))) {
efree(pathdup);
return NULL;
diff --git a/ext/standard/php_fopen_wrappers.h b/ext/standard/php_fopen_wrappers.h
index 5217144755..3773edbc5d 100644
--- a/ext/standard/php_fopen_wrappers.h
+++ b/ext/standard/php_fopen_wrappers.h
@@ -23,8 +23,8 @@
#ifndef PHP_FOPEN_WRAPPERS_H
#define PHP_FOPEN_WRAPPERS_H
-php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC);
-php_stream *php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC);
+php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
+php_stream *php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
extern PHPAPI php_stream_wrapper php_stream_http_wrapper;
extern PHPAPI php_stream_wrapper php_stream_ftp_wrapper;
extern PHPAPI php_stream_wrapper php_stream_php_wrapper;
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 46c2aaa9a1..a86aae25f0 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -1489,8 +1489,9 @@ PHP_FUNCTION(stream_socket_enable_crypto)
Determine what file will be opened by calls to fopen() with a relative path */
PHP_FUNCTION(stream_resolve_include_path)
{
- char *filename, *resolved_path;
+ char *filename;
size_t filename_len;
+ zend_string *resolved_path;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &filename, &filename_len) == FAILURE) {
return;
@@ -1499,10 +1500,7 @@ PHP_FUNCTION(stream_resolve_include_path)
resolved_path = zend_resolve_path(filename, (int)filename_len);
if (resolved_path) {
- // TODO: avoid reallocation ???
- RETVAL_STRING(resolved_path);
- efree(resolved_path);
- return;
+ RETURN_STR(resolved_path);
}
RETURN_FALSE;
}