diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2018-10-16 18:48:36 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2018-10-16 18:49:17 +0200 |
commit | 310b95d7eb1d10723d6bc4fa4781a7d852100f1d (patch) | |
tree | 10a52e5b6c81459228ce6a946945c5e2b39be1cf /ext/xml | |
parent | f1d7e3ca0b70f910fcecef0278de9c15440ca3c0 (diff) | |
parent | b33124239af07c9349cba42a516b9f00e8357445 (diff) | |
download | php-git-310b95d7eb1d10723d6bc4fa4781a7d852100f1d.tar.gz |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Add support for getting SKIP_TAGSTART and SKIP_WHITE options
Diffstat (limited to 'ext/xml')
-rw-r--r-- | ext/xml/tests/xml_parser_get_option_variation3.phpt | 29 | ||||
-rw-r--r-- | ext/xml/xml.c | 6 |
2 files changed, 35 insertions, 0 deletions
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-- +<?php +if (!extension_loaded('xml')) die('skip xml extension not available'); +?> +--FILE-- +<?php +$parser = xml_parser_create(); +echo "defaults:\n"; +var_dump(xml_parser_get_option($parser, XML_OPTION_SKIP_TAGSTART)); +var_dump(xml_parser_get_option($parser, XML_OPTION_SKIP_WHITE)); +echo "setting:\n"; +var_dump(xml_parser_set_option($parser, XML_OPTION_SKIP_TAGSTART, 7)); +var_dump(xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1)); +echo "getting:\n"; +var_dump(xml_parser_get_option($parser, XML_OPTION_SKIP_TAGSTART)); +var_dump(xml_parser_get_option($parser, XML_OPTION_SKIP_WHITE)); +?> +--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 da635fd706..588d00870e 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -1643,6 +1643,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; |