summaryrefslogtreecommitdiff
path: root/ext/xml
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2010-03-09 11:57:54 +0100
committerOndřej Surý <ondrej@sury.org>2010-03-09 11:57:54 +0100
commit855a09f4eded707941180c9d90acd17c25e29447 (patch)
treea40947efaa9876f31b6ee3956c3f3775768143bb /ext/xml
parentc852c28a88fccf6e34a2cb091fdfa72bce2b59c7 (diff)
downloadphp-855a09f4eded707941180c9d90acd17c25e29447.tar.gz
Imported Upstream version 5.3.2upstream/5.3.2
Diffstat (limited to 'ext/xml')
-rw-r--r--ext/xml/compat.c2
-rw-r--r--ext/xml/expat_compat.h4
-rw-r--r--ext/xml/php_xml.h4
-rwxr-xr-xext/xml/tests/bug32001b.phpt4
-rw-r--r--ext/xml/tests/bug50576.phpt133
-rw-r--r--ext/xml/xml.c12
6 files changed, 144 insertions, 15 deletions
diff --git a/ext/xml/compat.c b/ext/xml/compat.c
index 878b9214a..9c8761ba4 100644
--- a/ext/xml/compat.c
+++ b/ext/xml/compat.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
+ | Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/xml/expat_compat.h b/ext/xml/expat_compat.h
index 83c79ed4f..7b4bc4087 100644
--- a/ext/xml/expat_compat.h
+++ b/ext/xml/expat_compat.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
+ | Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: expat_compat.h 272370 2008-12-31 11:15:49Z sebastian $ */
+/* $Id: expat_compat.h 293036 2010-01-03 09:23:27Z sebastian $ */
#ifndef PHP_EXPAT_COMPAT_H
#define PHP_EXPAT_COMPAT_H
diff --git a/ext/xml/php_xml.h b/ext/xml/php_xml.h
index db2d79290..cd6ebec61 100644
--- a/ext/xml/php_xml.h
+++ b/ext/xml/php_xml.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
+ | Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xml.h 272370 2008-12-31 11:15:49Z sebastian $ */
+/* $Id: php_xml.h 293036 2010-01-03 09:23:27Z sebastian $ */
#ifndef PHP_XML_H
#define PHP_XML_H
diff --git a/ext/xml/tests/bug32001b.phpt b/ext/xml/tests/bug32001b.phpt
index f4aea08e5..ddf26ce3c 100755
--- a/ext/xml/tests/bug32001b.phpt
+++ b/ext/xml/tests/bug32001b.phpt
@@ -95,9 +95,7 @@ $suite = array(
);
if (XML_SAX_IMPL == 'libxml') {
- $php = getenv('TEST_PHP_EXECUTABLE');
- preg_match("/^libxml2 Version.*\$/im", `$php -i`, $match);
- echo $match[0], "\n";
+ echo "libxml2 Version => " . LIBXML_DOTTED_VERSION. "\n";
} else {
echo "libxml2 Version => NONE\n";
}
diff --git a/ext/xml/tests/bug50576.phpt b/ext/xml/tests/bug50576.phpt
new file mode 100644
index 000000000..fd3d0cbb4
--- /dev/null
+++ b/ext/xml/tests/bug50576.phpt
@@ -0,0 +1,133 @@
+--TEST--
+Bug #50576 (XML_OPTION_SKIP_TAGSTART option has no effect)
+--SKIPIF--
+<?php
+require_once("skipif.inc");
+?>
+--FILE--
+<?php
+
+$XML = <<<XML
+<?xml version="1.0"?>
+<ns1:listOfAwards xmlns:ns1="http://www.fpdsng.com/FPDS">
+<ns1:count>
+<ns1:total>867</ns1:total>
+</ns1:count>
+</ns1:listOfAwards>
+XML;
+
+$xml_parser = xml_parser_create();
+xml_parser_set_option($xml_parser, XML_OPTION_SKIP_TAGSTART, 4);
+xml_parse_into_struct($xml_parser, $XML, $vals, $index);
+echo 'Index array' . PHP_EOL;
+print_r($index);
+echo 'Vals array' . PHP_EOL;
+print_r($vals);
+xml_parser_free($xml_parser);
+
+function startElement($parser, $name, $attribs) { echo $name . PHP_EOL; }
+function endElement($parser, $name) { echo $name . PHP_EOL; }
+$xml_parser = xml_parser_create();
+xml_set_element_handler($xml_parser, 'startElement', 'endElement');
+xml_parser_set_option($xml_parser, XML_OPTION_SKIP_TAGSTART, 4);
+xml_parse($xml_parser, $XML);
+xml_parser_free($xml_parser);
+
+?>
+--EXPECTF--
+Index array
+Array
+(
+ [LISTOFAWARDS] => Array
+ (
+ [0] => 0
+ [1] => 5
+ [2] => 6
+ )
+
+ [COUNT] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 4
+ )
+
+ [TOTAL] => Array
+ (
+ [0] => 2
+ )
+
+)
+Vals array
+Array
+(
+ [0] => Array
+ (
+ [tag] => LISTOFAWARDS
+ [type] => open
+ [level] => 1
+ [attributes] => Array
+ (
+ [XMLNS:NS1] => http://www.fpdsng.com/FPDS
+ )
+
+ [value] =>
+
+ )
+
+ [1] => Array
+ (
+ [tag] => COUNT
+ [type] => open
+ [level] => 2
+ [value] =>
+
+ )
+
+ [2] => Array
+ (
+ [tag] => TOTAL
+ [type] => complete
+ [level] => 3
+ [value] => 867
+ )
+
+ [3] => Array
+ (
+ [tag] => COUNT
+ [value] =>
+
+ [type] => cdata
+ [level] => 2
+ )
+
+ [4] => Array
+ (
+ [tag] => COUNT
+ [type] => close
+ [level] => 2
+ )
+
+ [5] => Array
+ (
+ [tag] => LISTOFAWARDS
+ [value] =>
+
+ [type] => cdata
+ [level] => 1
+ )
+
+ [6] => Array
+ (
+ [tag] => LISTOFAWARDS
+ [type] => close
+ [level] => 1
+ )
+
+)
+LISTOFAWARDS
+COUNT
+TOTAL
+TOTAL
+COUNT
+LISTOFAWARDS
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index 2a9240e6c..5dd532a26 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
+ | Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xml.c 287790 2009-08-27 05:05:42Z rasmus $ */
+/* $Id: xml.c 294434 2010-02-03 18:35:58Z pajoye $ */
#define IS_EXT_MODULE
@@ -804,7 +804,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch
if (parser->startElementHandler) {
args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_string_zval(tag_name);
+ args[1] = _xml_string_zval(((char *) tag_name) + parser->toffset);
MAKE_STD_ZVAL(args[2]);
array_init(args[2]);
@@ -884,7 +884,7 @@ void _xml_endElementHandler(void *userData, const XML_Char *name)
if (parser->endElementHandler) {
args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_string_zval(tag_name);
+ args[1] = _xml_string_zval(((char *) tag_name) + parser->toffset);
if ((retval = xml_call_handler(parser, parser->endElementHandler, parser->endElementPtr, 2, args))) {
zval_ptr_dtor(&retval);
@@ -1270,9 +1270,7 @@ PHP_FUNCTION(xml_set_object)
#endif */
ALLOC_ZVAL(parser->object);
- *parser->object = *mythis;
- zval_copy_ctor(parser->object);
- INIT_PZVAL(parser->object);
+ MAKE_COPY_ZVAL(&mythis, parser->object);
RETVAL_TRUE;
}