Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ext/soap/php_encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -2210,8 +2210,8 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod

iter = ce->get_iterator(ce, data, 0);

if (EG(exception)) {
goto iterator_done;
if (!iter) {
goto iterator_failed_to_get;
}

if (iter->funcs->rewind) {
Expand Down Expand Up @@ -2251,6 +2251,7 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod
}
iterator_done:
OBJ_RELEASE(&iter->std);
iterator_failed_to_get:
if (EG(exception)) {
zval_ptr_dtor(&array_copy);
ZVAL_UNDEF(&array_copy);
Expand Down
22 changes: 22 additions & 0 deletions ext/soap/tests/bugs/gh16429.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
GH-16429 (Segmentation fault (access null pointer) in SoapClient)
--EXTENSIONS--
soap
--FILE--
<?php
function gen() {
var_dump(str_repeat("x", yield));
}
$gen = gen();
$gen->send(10);
$fusion = $gen;
$client = new SoapClient(__DIR__."/../interop/Round2/GroupB/round2_groupB.wsdl",array("trace"=>1,"exceptions"=>0));
try {
$client->echo2DStringArray($fusion);
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
string(10) "xxxxxxxxxx"
Cannot traverse an already closed generator
Loading