From b33124239af07c9349cba42a516b9f00e8357445 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Tue, 16 Oct 2018 18:47:31 +0200 Subject: Add support for getting SKIP_TAGSTART and SKIP_WHITE options When `XML_OPTION_SKIP_TAGSTART` and `XML_OPTION_SKIP_WHITE` had been introduced[1], it had been overlooked to also support them for `xml_parser_get_option()`. We catch up on that. [1] --- NEWS | 1 + .../tests/xml_parser_get_option_variation3.phpt | 29 ++++++++++++++++++++++ ext/xml/xml.c | 6 +++++ 3 files changed, 36 insertions(+) create mode 100644 ext/xml/tests/xml_parser_get_option_variation3.phpt diff --git a/NEWS b/NEWS index 3da21a1c5c..4652c6657f 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,7 @@ PHP NEWS - XML: . Fixed bug #30875 (xml_parse_into_struct() does not resolve entities). (cmb) + . Add support for getting SKIP_TAGSTART and SKIP_WHITE options. (cmb) 11 Oct 2018, PHP 7.1.23 diff --git a/ext/xml/tests/xml_parser_get_option_variation3.phpt b/ext/xml/tests/xml_parser_get_option_variation3.phpt new file mode 100644 index 0000000000..839daa96dd --- /dev/null +++ b/ext/xml/tests/xml_parser_get_option_variation3.phpt @@ -0,0 +1,29 @@ +--TEST-- +xml_parser_get_option() with XML_OPTION_SKIP_TAGSTART and XML_OPTION_SKIP_WHITE +--SKIPIF-- + +--FILE-- + +--EXPECT-- +defaults: +int(0) +int(0) +setting: +bool(true) +bool(true) +getting: +int(7) +int(1) diff --git a/ext/xml/xml.c b/ext/xml/xml.c index b1f8cc5bd9..373330f035 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -1653,6 +1653,12 @@ PHP_FUNCTION(xml_parser_get_option) case PHP_XML_OPTION_CASE_FOLDING: RETURN_LONG(parser->case_folding); break; + case PHP_XML_OPTION_SKIP_TAGSTART: + RETURN_LONG(parser->toffset); + break; + case PHP_XML_OPTION_SKIP_WHITE: + RETURN_LONG(parser->skipwhite); + break; case PHP_XML_OPTION_TARGET_ENCODING: RETURN_STRING((char *)parser->target_encoding); break; -- cgit v1.2.1