Skip to content

Commit

Permalink
fix xml re-entry
Browse files Browse the repository at this point in the history
Summary: Before we dive into the XML library, we need to save the JIT state incase we need it later (for example, to raise a warning).

Reviewed By: @alexmalyshev

Differential Revision: D1321974
  • Loading branch information
ptarjan authored and JoelMarcey committed May 10, 2014
1 parent c740ae1 commit 9512a32
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions hphp/runtime/ext/ext_xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ int64_t f_xml_parse(const Resource& parser, const String& data, bool is_final /*
int64_t f_xml_parse_into_struct(const Resource& parser, const String& data, VRefParam values,
VRefParam index /* = null */) {
int ret;
JIT::VMRegAnchor _;
XmlParser * p = parser.getTyped<XmlParser>();
values = Array::Create();
p->data.assignRef(values);
Expand Down
16 changes: 10 additions & 6 deletions hphp/test/slow/ext_xml/depth_limit.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<?php
$a = array();
$res = xml_parse_into_struct(
xml_parser_create_ns(),
str_repeat("<blah>", 100000),
$a);
var_dump(count(array_keys($a)));

function main() {
$a = array();
$res = xml_parse_into_struct(
xml_parser_create_ns(),
str_repeat("<blah>", 100000),
$a);
var_dump(count(array_keys($a)));
}
main();
2 changes: 1 addition & 1 deletion hphp/test/slow/ext_xml/depth_limit.php.expectf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Warning: Maximum depth exceeded - Results truncated in %s on line 6
Warning: Maximum depth exceeded - Results truncated in %s on line 8
int(255)

0 comments on commit 9512a32

Please sign in to comment.