mirror of
https://github.com/php/php-src.git
synced 2024-12-04 23:34:25 +08:00
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Revert "Fix #80852: Stack-overflow when json_encode()'ing SimpleXMLElement"
This commit is contained in:
commit
2b3346208a
@ -1211,7 +1211,7 @@ static HashTable *sxe_get_prop_hash(zval *object, int is_debug) /* {{{ */
|
||||
}
|
||||
}
|
||||
|
||||
if (node->type == XML_ELEMENT_NODE && (! match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix)) || node->type == XML_ENTITY_DECL) {
|
||||
if (node->type == XML_ELEMENT_NODE && (! match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix))) {
|
||||
goto next_iter;
|
||||
}
|
||||
|
||||
@ -1908,7 +1908,7 @@ static int sxe_object_cast_ex(zval *readobj, zval *writeobj, int type)
|
||||
|
||||
if (sxe->node && sxe->node->node) {
|
||||
if (sxe->node->node->children) {
|
||||
contents = xmlNodeListGetRawString((xmlDocPtr) sxe->document->ptr, sxe->node->node->children, 1);
|
||||
contents = xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, sxe->node->node->children, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80852 (Stack-overflow when json_encode()'ing SimpleXMLElement)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
|
||||
if (!extension_loaded('json')) die('skip json extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xml = '<!DOCTYPE foo [<!ENTITY xee1 "aaa"> <!ENTITY xee2 "&xee1;&xee1;"> ]><a>b&xee2;</a>';
|
||||
$sxe = simplexml_load_string($xml);
|
||||
var_dump(json_encode($sxe));
|
||||
var_dump($sxe);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(11) "{"xee2":{}}"
|
||||
object(SimpleXMLElement)#1 (1) {
|
||||
["xee2"]=>
|
||||
object(SimpleXMLElement)#3 (0) {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user