summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2009-08-03 13:26:15 +0000
committerFelipe Pena <felipe@php.net>2009-08-03 13:26:15 +0000
commit1e21fd1777372705ca1fdddf419360575e6e8b9b (patch)
tree89871dc10be1b1e7b9e7c58ad116447c3e9322b5
parentc46c584f9753c9baf659cebfa291d0d1aca26f04 (diff)
downloadphp-git-1e21fd1777372705ca1fdddf419360575e6e8b9b.tar.gz
- Improved. No ugly copy. (Tony)
-rw-r--r--NEWS2
-rw-r--r--ext/standard/streamsfuncs.c20
2 files changed, 7 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index 093e642342..c80b7a4071 100644
--- a/NEWS
+++ b/NEWS
@@ -3,7 +3,7 @@ PHP NEWS
?? ??? 2009, PHP 5.2.11
- Fixed regression in cURL extension that prevented flush of data to output
defined as a file handle. (Ilia)
-- Fixed memory leak in stream_is_local(). (Felipe)
+- Fixed memory leak in stream_is_local(). (Felipe, Tony)
- Fixed bug #49132 (posix_times returns false without error).
(phpbugs at gunnu dot us)
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index f3b333b390..979453d17f 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -1382,32 +1382,24 @@ PHP_FUNCTION(stream_socket_enable_crypto)
*/
PHP_FUNCTION(stream_is_local)
{
- zval *zstream;
+ zval **zstream;
php_stream *stream = NULL;
php_stream_wrapper *wrapper = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zstream) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &zstream) == FAILURE) {
RETURN_FALSE;
}
- if(Z_TYPE_P(zstream) == IS_RESOURCE) {
- php_stream_from_zval(stream, &zstream);
+ if(Z_TYPE_PP(zstream) == IS_RESOURCE) {
+ php_stream_from_zval(stream, zstream);
if(stream == NULL) {
RETURN_FALSE;
}
wrapper = stream->wrapper;
} else {
- zval *copy_tmp;
-
- ALLOC_ZVAL(copy_tmp);
- *copy_tmp = *zstream;
- zval_copy_ctor(copy_tmp);
- INIT_PZVAL(copy_tmp);
- convert_to_string(copy_tmp);
-
- wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(copy_tmp), NULL, 0 TSRMLS_CC);
+ convert_to_string_ex(zstream);
- zval_ptr_dtor(&copy_tmp);
+ wrapper = php_stream_locate_url_wrapper(Z_STRVAL_PP(zstream), NULL, 0 TSRMLS_CC);
}
if(!wrapper) {