diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 9f5d1d1585d..d6a90590d64 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -298,6 +298,10 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { } if (attr) { id = (char*)attr->children->content; + smart_str_appendc(&prefix, '#'); + smart_str_appends(&prefix, id); + smart_str_0(&prefix); + id = prefix.c; } else { SOAP_GLOBAL(cur_uniq_ref)++; smart_str_appendl(&prefix, "#ref", 4); @@ -311,6 +315,10 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { attr = get_attribute_ex(attr, "id", SOAP_1_2_ENC_NAMESPACE); if (attr) { id = (char*)attr->children->content; + smart_str_appendc(&prefix, '#'); + smart_str_appends(&prefix, id); + smart_str_0(&prefix); + id = prefix.c; } else { SOAP_GLOBAL(cur_uniq_ref)++; smart_str_appendl(&prefix, "#ref", 4); diff --git a/ext/soap/tests/bugs/bug41566.phpt b/ext/soap/tests/bugs/bug41566.phpt new file mode 100755 index 00000000000..03ecdde043d --- /dev/null +++ b/ext/soap/tests/bugs/bug41566.phpt @@ -0,0 +1,65 @@ +--TEST-- +Bug #41566 (SOAP Server not properly generating href attributes) +--SKIPIF-- + +--FILE-- +sName = 'newUser'; + + $aUsers = Array(); + $aUsers[] = $aUser; + $aUsers[] = $aUser; + $aUsers[] = $aUser; + $aUsers[] = $aUser; + return $aUsers; +} + +/* Simple User definition */ +Class User { + /** @var string */ + public $sName; +} + +$server = new soapserver(null,array('uri'=>"http://testuri.org", 'soap_version'=>SOAP_1_2)); +$server->addfunction("test"); + +$HTTP_RAW_POST_DATA = << + + + + + +EOF; +ob_start(); +$server->handle($HTTP_RAW_POST_DATA); +echo "ok\n"; + +$HTTP_RAW_POST_DATA = << + + + + + +EOF; +$server->handle($HTTP_RAW_POST_DATA); +echo "ok\n"; +ob_flush(); +--EXPECT-- + +newUser +ok + +returnnewUser +ok