Merge branch 'PHP-5.4'

This commit is contained in:
Xinchen Hui 2012-10-30 11:11:22 +08:00
commit cc1caf92ea
3 changed files with 26 additions and 12 deletions

View File

@ -918,7 +918,7 @@ static PHP_FUNCTION(libxml_set_streams_context)
{
zval *arg;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg) == FAILURE) {
return;
}
if (LIBXML(stream_context)) {

View File

@ -27,26 +27,26 @@ echo "Done\n";
?>
--EXPECTF--
Warning: stream_context_create(): options should have the form ["wrappername"]["optionname"] = $value in %s004.php on line 10
NULL
Warning: stream_context_create(): options should have the form ["wrappername"]["optionname"] = $value in %s004.php on line %d
Warning: DOMDocument::load(): supplied argument is not a valid Stream-Context resource in %s004.php on line 18
Warning: libxml_set_streams_context() expects parameter 1 to be resource, null given in %s004.php on line %d
NULL
bool(true)
NULL
Warning: DOMDocument::load(): supplied argument is not a valid Stream-Context resource in %s004.php on line 18
Warning: libxml_set_streams_context() expects parameter 1 to be resource, string given in %s004.php on line %d
NULL
bool(true)
NULL
Warning: DOMDocument::load(): supplied argument is not a valid Stream-Context resource in %s004.php on line 18
Warning: libxml_set_streams_context() expects parameter 1 to be resource, integer given in %s004.php on line %d
NULL
bool(true)
NULL
Warning: DOMDocument::load(): supplied argument is not a valid Stream-Context resource in %s004.php on line 18
Warning: libxml_set_streams_context() expects parameter 1 to be resource, object given in %s004.php on line %d
NULL
bool(true)
NULL
Warning: DOMDocument::load(): supplied argument is not a valid Stream-Context resource in %s004.php on line 18
Warning: libxml_set_streams_context() expects parameter 1 to be resource, array given in %s004.php on line %d
NULL
bool(true)
NULL
bool(true)

View File

@ -0,0 +1,14 @@
--TEST--
Bug #63389 (Missing context check on libxml_set_streams_context() causes memleak)
--SKIPIF--
<?php if (!extension_loaded('libxml')) die('skip'); ?>
--FILE--
<?php
$fp = fopen("php://input", "r");
libxml_set_streams_context($fp);
libxml_set_streams_context("a");
echo "okey";
?>
--EXPECTF--
Warning: libxml_set_streams_context() expects parameter 1 to be resource, string given in %sbug63389.php on line %d
okey