mirror of
https://github.com/php/php-src.git
synced 2025-01-24 20:53:37 +08:00
- Re-fix stream_is_local() memory leaks
This commit is contained in:
parent
952a193f94
commit
1648ab5750
1
NEWS
1
NEWS
@ -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)
|
||||
|
@ -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(©_tmp);
|
||||
}
|
||||
|
||||
if(!wrapper) {
|
||||
|
17
ext/standard/tests/streams/stream_is_local.phpt
Normal file
17
ext/standard/tests/streams/stream_is_local.phpt
Normal 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)
|
Loading…
Reference in New Issue
Block a user