Skip to content

Commit

Permalink
Merge branch 'PHP-5.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
laruence committed Oct 30, 2012
2 parents a87a6bf + 3342e72 commit cc1caf9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ext/libxml/libxml.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
22 changes: 11 additions & 11 deletions ext/libxml/tests/004.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
bool(true)
Warning: libxml_set_streams_context() expects parameter 1 to be resource, null given in %s004.php on line %d
NULL

Warning: DOMDocument::load(): supplied argument is not a valid Stream-Context resource in %s004.php on line 18
bool(true)
NULL

Warning: DOMDocument::load(): supplied argument is not a valid Stream-Context resource in %s004.php on line 18
bool(true)
Warning: libxml_set_streams_context() expects parameter 1 to be resource, string given in %s004.php on line %d
NULL
bool(true)

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)

Warning: libxml_set_streams_context() expects parameter 1 to be resource, object given in %s004.php on line %d
NULL
bool(true)

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)
Expand Down
14 changes: 14 additions & 0 deletions ext/libxml/tests/bug63389.phpt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cc1caf9

Please sign in to comment.