summaryrefslogtreecommitdiff
path: root/ext/xml
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2018-10-16 18:48:36 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2018-10-16 18:49:17 +0200
commit310b95d7eb1d10723d6bc4fa4781a7d852100f1d (patch)
tree10a52e5b6c81459228ce6a946945c5e2b39be1cf /ext/xml
parentf1d7e3ca0b70f910fcecef0278de9c15440ca3c0 (diff)
parentb33124239af07c9349cba42a516b9f00e8357445 (diff)
downloadphp-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.phpt29
-rw-r--r--ext/xml/xml.c6
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;