- Re-fix stream_is_local() memory leaks

This commit is contained in:
Felipe Pena 2009-08-03 13:16:24 +00:00
parent 952a193f94
commit 1648ab5750
3 changed files with 29 additions and 2 deletions

1
NEWS
View File

@ -6,6 +6,7 @@ PHP NEWS
- Fixed open_basedir circumvention for mail.log. (Maksymilian Arciemowicz,
Stas)
- Fixed signature generation/validation for zip archives in ext/phar. (Greg)
- Fixed memory leak in stream_is_local(). (Felipe)
- Fixed bug #49132 (posix_times returns false without error).
(phpbugs at gunnu dot us)

View File

@ -1463,8 +1463,17 @@ PHP_FUNCTION(stream_is_local)
}
wrapper = stream->wrapper;
} else {
convert_to_string_ex(&zstream);
wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(zstream), NULL, 0 TSRMLS_CC);
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);
zval_ptr_dtor(&copy_tmp);
}
if(!wrapper) {

View File

@ -0,0 +1,17 @@
--TEST--
Testing stream_is_local()
--FILE--
<?php
$a = 1;
$b = $a;
var_dump(stream_is_local($b));
var_dump($b);
var_dump(stream_is_local(fopen(__FILE__, 'r')));
?>
--EXPECT--
bool(true)
int(1)
bool(true)