summaryrefslogtreecommitdiff
path: root/ext/simplexml
diff options
context:
space:
mode:
Diffstat (limited to 'ext/simplexml')
-rw-r--r--ext/simplexml/CREDITS2
-rwxr-xr-xext/simplexml/README34
-rw-r--r--ext/simplexml/config.m427
-rw-r--r--ext/simplexml/config.w3216
-rw-r--r--ext/simplexml/examples/book.php8
-rw-r--r--ext/simplexml/examples/book.xml10
-rw-r--r--ext/simplexml/examples/interop.php27
-rw-r--r--ext/simplexml/examples/security.php6
-rw-r--r--ext/simplexml/examples/security.xml4
-rw-r--r--ext/simplexml/examples/xpath.php9
-rw-r--r--ext/simplexml/php_simplexml.h97
-rwxr-xr-xext/simplexml/php_simplexml_exports.h67
-rw-r--r--ext/simplexml/simplexml.c2355
-rw-r--r--ext/simplexml/simplexml.dsp111
-rwxr-xr-xext/simplexml/tests/000.phpt254
-rwxr-xr-xext/simplexml/tests/000.xml16
-rw-r--r--ext/simplexml/tests/001.phpt43
-rw-r--r--ext/simplexml/tests/002.phpt64
-rwxr-xr-xext/simplexml/tests/003.phpt69
-rwxr-xr-xext/simplexml/tests/004.phpt68
-rwxr-xr-xext/simplexml/tests/005.phpt40
-rwxr-xr-xext/simplexml/tests/006.phpt80
-rwxr-xr-xext/simplexml/tests/007.phpt97
-rw-r--r--ext/simplexml/tests/008.phpt39
-rwxr-xr-xext/simplexml/tests/009.phpt45
-rwxr-xr-xext/simplexml/tests/009b.phpt35
-rw-r--r--ext/simplexml/tests/010.phpt64
-rwxr-xr-xext/simplexml/tests/011.phpt47
-rwxr-xr-xext/simplexml/tests/012.phpt40
-rwxr-xr-xext/simplexml/tests/013.phpt23
-rw-r--r--ext/simplexml/tests/014.phpt60
-rwxr-xr-xext/simplexml/tests/014a.phpt56
-rwxr-xr-xext/simplexml/tests/014b.phpt55
-rw-r--r--ext/simplexml/tests/015.phpt56
-rw-r--r--ext/simplexml/tests/016.phpt57
-rwxr-xr-xext/simplexml/tests/016a.phpt29
-rw-r--r--ext/simplexml/tests/017.phpt86
-rw-r--r--ext/simplexml/tests/018.phpt65
-rwxr-xr-xext/simplexml/tests/019.phpt80
-rwxr-xr-xext/simplexml/tests/020.phpt21
-rw-r--r--ext/simplexml/tests/021.phpt25
-rwxr-xr-xext/simplexml/tests/022.phpt62
-rwxr-xr-xext/simplexml/tests/023.phpt36
-rwxr-xr-xext/simplexml/tests/024.phpt175
-rwxr-xr-xext/simplexml/tests/025.phpt92
-rwxr-xr-xext/simplexml/tests/026.phpt40
-rwxr-xr-xext/simplexml/tests/027.phpt74
-rwxr-xr-xext/simplexml/tests/028.phpt42
-rwxr-xr-xext/simplexml/tests/029.phpt40
-rw-r--r--ext/simplexml/tests/030.phpt44
-rw-r--r--ext/simplexml/tests/031.phpt57
-rwxr-xr-xext/simplexml/tests/032.phpt45
-rwxr-xr-xext/simplexml/tests/033.phpt137
-rw-r--r--ext/simplexml/tests/book.xml10
-rw-r--r--ext/simplexml/tests/bug24392.phpt22
-rw-r--r--ext/simplexml/tests/bug24392.xml76
-rw-r--r--ext/simplexml/tests/bug25756.xsd24
-rw-r--r--ext/simplexml/tests/bug25756_1.xml13
-rw-r--r--ext/simplexml/tests/bug25756_2.xml13
-rw-r--r--ext/simplexml/tests/bug26976.phpt28
-rwxr-xr-xext/simplexml/tests/bug27010.phpt34
-rwxr-xr-xext/simplexml/tests/bug35785.phpt28
-rw-r--r--ext/simplexml/tests/bug36611.phpt30
-rwxr-xr-xext/simplexml/tests/bug37565.phpt31
-rw-r--r--ext/simplexml/tests/bug38347.phpt28
-rw-r--r--ext/simplexml/tests/bug38354.phpt28
-rw-r--r--ext/simplexml/tests/bug38424.phpt26
-rw-r--r--ext/simplexml/tests/profile01.phpt18
-rw-r--r--ext/simplexml/tests/profile02.phpt21
-rw-r--r--ext/simplexml/tests/profile03.phpt18
-rw-r--r--ext/simplexml/tests/profile04.phpt18
-rw-r--r--ext/simplexml/tests/profile05.phpt18
-rw-r--r--ext/simplexml/tests/profile06.phpt20
-rw-r--r--ext/simplexml/tests/profile07.phpt23
-rw-r--r--ext/simplexml/tests/profile08.phpt18
-rw-r--r--ext/simplexml/tests/profile09.phpt19
-rw-r--r--ext/simplexml/tests/profile10.phpt25
-rw-r--r--ext/simplexml/tests/profile11.phpt35
-rwxr-xr-xext/simplexml/tests/profile12.phpt74
-rwxr-xr-xext/simplexml/tests/profile13.phpt75
-rwxr-xr-xext/simplexml/tests/simplexml_import_dom.phpt22
-rwxr-xr-xext/simplexml/tests/sxe.dtd34
-rwxr-xr-xext/simplexml/tests/sxe.ent1
-rwxr-xr-xext/simplexml/tests/sxe.xml17
84 files changed, 0 insertions, 6078 deletions
diff --git a/ext/simplexml/CREDITS b/ext/simplexml/CREDITS
deleted file mode 100644
index bff168d767..0000000000
--- a/ext/simplexml/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-SimpleXML
-Sterling Hughes, Marcus Boerger, Rob Richards
diff --git a/ext/simplexml/README b/ext/simplexml/README
deleted file mode 100755
index bb9240d103..0000000000
--- a/ext/simplexml/README
+++ /dev/null
@@ -1,34 +0,0 @@
-SimpleXML is meant to be an easy way to access XML data.
-
-SimpleXML objects follow four basic rules:
-
-1) properties denote element iterators
-2) numeric indices denote elements
-3) non numeric indices denote attributes
-4) string conversion allows to access TEXT data
-
-When iterating properties then the extension always iterates over
-all nodes with that element name. Thus method children() must be
-called to iterate over subnodes. But also doing the following:
-foreach ($obj->node_name as $elem) {
- // do something with $elem
-}
-always results in iteration of 'node_name' elements. So no further
-check is needed to distinguish the number of nodes of that type.
-
-When an elements TEXT data is being accessed through a property
-then the result does not include the TEXT data of subelements.
-
-Known issues
-============
-
-Due to engine problems it is currently not possible to access
-a subelement by index 0: $object->property[0].
-
-TODO
-====
-
-At the moment property access to multiple elements of the same
-name returns an array of SimpleXML objects. This should be an
-object of a new type instead so that all kinds of linkage,
-assignment and deleting would work.
diff --git a/ext/simplexml/config.m4 b/ext/simplexml/config.m4
deleted file mode 100644
index 7bc864409e..0000000000
--- a/ext/simplexml/config.m4
+++ /dev/null
@@ -1,27 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension simplexml
-
-PHP_ARG_ENABLE(simplexml, whether to enable SimpleXML support,
-[ --disable-simplexml Disable SimpleXML support], yes)
-
-if test -z "$PHP_LIBXML_DIR"; then
- PHP_ARG_WITH(libxml-dir, libxml2 install dir,
- [ --with-libxml-dir=DIR SimpleXML: libxml2 install prefix], no, no)
-fi
-
-if test "$PHP_SIMPLEXML" != "no"; then
-
- if test "$PHP_LIBXML" = "no"; then
- AC_MSG_ERROR([SimpleXML extension requires LIBXML extension, add --enable-libxml])
- fi
-
- PHP_SETUP_LIBXML(SIMPLEXML_SHARED_LIBADD, [
- AC_DEFINE(HAVE_SIMPLEXML,1,[ ])
- PHP_NEW_EXTENSION(simplexml, simplexml.c, $ext_shared)
- PHP_SUBST(SIMPLEXML_SHARED_LIBADD)
- ], [
- AC_MSG_ERROR([xml2-config not found. Please check your libxml2 installation.])
- ])
- PHP_ADD_EXTENSION_DEP(simplexml, libxml)
- PHP_ADD_EXTENSION_DEP(simplexml, spl, true)
-fi
diff --git a/ext/simplexml/config.w32 b/ext/simplexml/config.w32
deleted file mode 100644
index 26a87f1c14..0000000000
--- a/ext/simplexml/config.w32
+++ /dev/null
@@ -1,16 +0,0 @@
-// $Id$
-// vim:ft=javascript
-
-ARG_WITH("simplexml", "Simple XML support", "yes");
-
-if (PHP_SIMPLEXML == "yes" && PHP_LIBXML == "yes") {
- EXTENSION("simplexml", "simplexml.c");
- AC_DEFINE("HAVE_SIMPLEXML", 1, "Simple XML support");
- if (!PHP_SIMPLEXML_SHARED) {
- ADD_FLAG("CFLAGS_SIMPLEXML", "/D LIBXML_STATIC");
- }
- ADD_EXTENSION_DEP('simplexml', 'libxml');
- ADD_EXTENSION_DEP('simplexml', 'spl', true);
-}
-
-
diff --git a/ext/simplexml/examples/book.php b/ext/simplexml/examples/book.php
deleted file mode 100644
index 0416df861b..0000000000
--- a/ext/simplexml/examples/book.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-$books = simplexml_load_file('book.xml');
-//var_dump($books);
-$books = $books->book;
-foreach ($books as $book) {
- echo "{$book->title} was written by {$book->author}\n";
-}
-?>
diff --git a/ext/simplexml/examples/book.xml b/ext/simplexml/examples/book.xml
deleted file mode 100644
index ea40508e01..0000000000
--- a/ext/simplexml/examples/book.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<books>
- <book>
- <title>The Grapes of Wrath</title>
- <author>John Steinbeck</author>
- </book>
- <book>
- <title>The Pearl</title>
- <author>John Steinbeck</author>
- </book>
-</books>
diff --git a/ext/simplexml/examples/interop.php b/ext/simplexml/examples/interop.php
deleted file mode 100644
index 9e38ec1110..0000000000
--- a/ext/simplexml/examples/interop.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-$dom = new domDocument;
-$dom->load("book.xml");
-if(!$dom) {
- echo "Error while parsing the document\n";
- exit;
-}
-print "As SimpleXML\n";
-
-$s = simplexml_import_dom($dom);
-$books = $s->book;
-foreach ($books as $book) {
- echo "{$book->title} was written by {$book->author}\n";
-}
-
-print "As DOM \n";
-
-$dom = dom_import_simplexml($s);
-$books = $dom->getElementsByTagName("book");
-foreach ($books as $book) {
- $title = $book->getElementsByTagName("title");
- $author = $book->getElementsByTagName("author");
- echo $title[0]->firstChild->data . " was written by ". $author[0]->firstChild->data . "\n";
-}
-
-
-?>
diff --git a/ext/simplexml/examples/security.php b/ext/simplexml/examples/security.php
deleted file mode 100644
index 17897b3fd7..0000000000
--- a/ext/simplexml/examples/security.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-$s = simplexml_load_file('security.xml');
-echo $s->id;
-$s->id = 20;
-$s->asXML('security.new.xml');
-?>
diff --git a/ext/simplexml/examples/security.xml b/ext/simplexml/examples/security.xml
deleted file mode 100644
index d954a02335..0000000000
--- a/ext/simplexml/examples/security.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<security>
- <id>15</id>
-</security>
diff --git a/ext/simplexml/examples/xpath.php b/ext/simplexml/examples/xpath.php
deleted file mode 100644
index 8fcd9878ab..0000000000
--- a/ext/simplexml/examples/xpath.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-$books = simplexml_load_file('book.xml');
-
-$xpath_result = $books->xpath("/books/book/title");
-foreach($xpath_result as $entry ) {
- print "$entry \n";
-}
-
-?>
diff --git a/ext/simplexml/php_simplexml.h b/ext/simplexml/php_simplexml.h
deleted file mode 100644
index dee6bdc1fe..0000000000
--- a/ext/simplexml/php_simplexml.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 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 |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SIMPLEXML_H
-#define PHP_SIMPLEXML_H
-
-extern zend_module_entry simplexml_module_entry;
-#define phpext_simplexml_ptr &simplexml_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_SIMPLEXML_API __declspec(dllexport)
-#else
-#define PHP_SIMPLEXML_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#include "ext/libxml/php_libxml.h"
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/tree.h>
-#include <libxml/uri.h>
-#include <libxml/xmlerror.h>
-#include <libxml/xinclude.h>
-#include <libxml/xpath.h>
-#include <libxml/xpathInternals.h>
-#include <libxml/xpointer.h>
-#include <libxml/xmlschemas.h>
-
-PHP_MINIT_FUNCTION(simplexml);
-PHP_MSHUTDOWN_FUNCTION(simplexml);
-#ifdef HAVE_SPL
-PHP_RINIT_FUNCTION(simplexml);
-#endif
-PHP_MINFO_FUNCTION(simplexml);
-
-typedef enum {
- SXE_ITER_NONE = 0,
- SXE_ITER_ELEMENT = 1,
- SXE_ITER_CHILD = 2,
- SXE_ITER_ATTRLIST = 3
-} SXE_ITER;
-
-typedef struct {
- zend_object zo;
- php_libxml_node_ptr *node;
- php_libxml_ref_obj *document;
- HashTable *properties;
- xmlXPathContextPtr xpath;
- struct {
- xmlChar *name;
- xmlChar *nsprefix;
- int isprefix;
- SXE_ITER type;
- zval *data;
- } iter;
- zval *tmp;
-} php_sxe_object;
-
-#ifdef ZTS
-#define SIMPLEXML_G(v) TSRMG(simplexml_globals_id, zend_simplexml_globals *, v)
-#else
-#define SIMPLEXML_G(v) (simplexml_globals.v)
-#endif
-
-ZEND_API zend_class_entry *sxe_get_element_class_entry();
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/simplexml/php_simplexml_exports.h b/ext/simplexml/php_simplexml_exports.h
deleted file mode 100755
index 2bb6370953..0000000000
--- a/ext/simplexml/php_simplexml_exports.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 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 |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- | Marcus Boerger <helly@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SIMPLEXML_EXPORTS_H
-#define PHP_SIMPLEXML_EXPORTS_H
-
-#include "php_simplexml.h"
-
-#define SKIP_TEXT(__p) \
- if ((__p)->type == XML_TEXT_NODE) { \
- goto next_iter; \
- }
-
-#define GET_NODE(__s, __n) { \
- if ((__s)->node && (__s)->node->node) { \
- __n = (__s)->node->node; \
- } else { \
- __n = NULL; \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Node no longer exists"); \
- } \
-}
-
-ZEND_API zend_object_value sxe_object_new(zend_class_entry *ce TSRMLS_DC);
-/* {{{ php_sxe_fetch_object()
- */
-static inline php_sxe_object *
-php_sxe_fetch_object(zval *object TSRMLS_DC)
-{
- return (php_sxe_object *) zend_object_store_get_object(object TSRMLS_CC);
-}
-/* }}} */
-
-typedef struct {
- zend_object_iterator intern;
- php_sxe_object *sxe;
-} php_sxe_iterator;
-
-#endif /* PHP_SIMPLEXML_EXPORTS_H */
-
-/**
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: t
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
deleted file mode 100644
index 3a00fc909a..0000000000
--- a/ext/simplexml/simplexml.c
+++ /dev/null
@@ -1,2355 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 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 |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- | Marcus Boerger <helly@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_SIMPLEXML
-
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-#include "php_simplexml.h"
-#include "php_simplexml_exports.h"
-#include "zend_exceptions.h"
-#include "zend_interfaces.h"
-#ifdef HAVE_SPL
-#include "ext/spl/spl_sxe.h"
-#endif
-
-#define SXE_ELEMENT_BY_NAME 0
-
-zend_class_entry *sxe_class_entry = NULL;
-
-ZEND_API zend_class_entry *sxe_get_element_class_entry()
-{
- return sxe_class_entry;
-}
-
-#define SXE_ME(func, arg_info, flags) PHP_ME(simplexml_element, func, arg_info, flags)
-#define SXE_MALIAS(func, alias, arg_info, flags) PHP_MALIAS(simplexml_element, func, alias, arg_info, flags)
-
-#define SXE_METHOD(func) PHP_METHOD(simplexml_element, func)
-
-static php_sxe_object* php_sxe_object_new(zend_class_entry *ce TSRMLS_DC);
-static zend_object_value php_sxe_register_object(php_sxe_object * TSRMLS_DC);
-static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data TSRMLS_DC);
-static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data TSRMLS_DC);
-
-/* {{{ _node_as_zval()
- */
-static void _node_as_zval(php_sxe_object *sxe, xmlNodePtr node, zval *value, SXE_ITER itertype, char *name, xmlChar *nsprefix, int isprefix TSRMLS_DC)
-{
- php_sxe_object *subnode;
-
- subnode = php_sxe_object_new(sxe->zo.ce TSRMLS_CC);
- subnode->document = sxe->document;
- subnode->document->refcount++;
- subnode->iter.type = itertype;
- if (name) {
- subnode->iter.name = xmlStrdup((xmlChar *)name);
- }
- if (nsprefix && *nsprefix) {
- subnode->iter.nsprefix = xmlStrdup((xmlChar *)nsprefix);
- subnode->iter.isprefix = isprefix;
- }
-
- php_libxml_increment_node_ptr((php_libxml_node_object *)subnode, node, NULL TSRMLS_CC);
-
- value->type = IS_OBJECT;
- value->value.obj = php_sxe_register_object(subnode TSRMLS_CC);
-}
-/* }}} */
-
-#define APPEND_PREV_ELEMENT(__c, __v) \
- if ((__c) == 1) { \
- array_init(return_value); \
- add_next_index_zval(return_value, __v); \
- }
-
-#define APPEND_CUR_ELEMENT(__c, __v) \
- if (++(__c) > 1) { \
- add_next_index_zval(return_value, __v); \
- }
-
-#define GET_NODE(__s, __n) { \
- if ((__s)->node && (__s)->node->node) { \
- __n = (__s)->node->node; \
- } else { \
- __n = NULL; \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Node no longer exists"); \
- } \
-}
-
-static xmlNodePtr php_sxe_get_first_node(php_sxe_object *sxe, xmlNodePtr node TSRMLS_DC) {
- php_sxe_object *intern;
- xmlNodePtr retnode = NULL;
-
- if (sxe && sxe->iter.type != SXE_ITER_NONE) {
- php_sxe_reset_iterator(sxe, 1 TSRMLS_CC);
- if (sxe->iter.data) {
- intern = (php_sxe_object *)zend_object_store_get_object(sxe->iter.data TSRMLS_CC);
- GET_NODE(intern, retnode)
- }
- return retnode;
- } else {
- return node;
- }
-}
-
-static inline int match_ns(php_sxe_object *sxe, xmlNodePtr node, xmlChar *name, int prefix) /* {{{ */
-{
- if (name == NULL && (node->ns == NULL || node->ns->prefix == NULL)) {
- return 1;
- }
-
- if (node->ns && !xmlStrcmp(prefix ? node->ns->prefix : node->ns->href, name)) {
- return 1;
- }
-
- return 0;
-}
-/* }}} */
-
-static xmlNodePtr sxe_get_element_by_offset(php_sxe_object *sxe, long offset, xmlNodePtr node, long *cnt) /* {{{ */
-{
- long nodendx = 0;
-
- if (sxe->iter.type == SXE_ITER_NONE) {
- return NULL;
- }
- while (node && nodendx <= offset) {
- SKIP_TEXT(node)
- if (node->type == XML_ELEMENT_NODE && match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- if (sxe->iter.type == SXE_ITER_CHILD || (
- sxe->iter.type == SXE_ITER_ELEMENT && !xmlStrcmp(node->name, sxe->iter.name))) {
- if (nodendx == offset) {
- break;
- }
- nodendx++;
- }
- }
-next_iter:
- node = node->next;
- }
-
- if (cnt) {
- *cnt = nodendx;
- }
-
- return node;
-}
-/* }}} */
-
-static xmlNodePtr sxe_find_element_by_name(php_sxe_object *sxe, xmlNodePtr node, xmlChar *name TSRMLS_DC) /* {{{ */
-{
- while (node) {
- SKIP_TEXT(node)
- if (node->type == XML_ELEMENT_NODE && match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- if (!xmlStrcmp(node->name, name)) {
- return node;
- }
- }
-next_iter:
- node = node->next;
- }
- return NULL;
-} /* }}} */
-
-static xmlNodePtr sxe_get_element_by_name(php_sxe_object *sxe, xmlNodePtr node, char **name, SXE_ITER *type TSRMLS_DC) /* {{{ */
-{
- int orgtype;
- xmlNodePtr orgnode = node;
- xmlNodePtr retnode = NULL;
-
- if (sxe->iter.type != SXE_ITER_ATTRLIST)
- {
- orgtype = sxe->iter.type;
- if (sxe->iter.type == SXE_ITER_NONE) {
- sxe->iter.type = SXE_ITER_CHILD;
- }
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- sxe->iter.type = orgtype;
- }
-
- if (sxe->iter.type == SXE_ITER_ELEMENT) {
- orgnode = sxe_find_element_by_name(sxe, node, sxe->iter.name TSRMLS_CC);
- if (!orgnode) {
- return NULL;
- }
- node = orgnode->children;
- }
-
- while (node) {
- SKIP_TEXT(node)
- if (node->type == XML_ELEMENT_NODE && match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- if (!xmlStrcmp(node->name, (xmlChar *)*name)) {
- if (1||retnode)
- {
- *type = SXE_ITER_ELEMENT;
- return orgnode;
- }
- retnode = node;
- }
- }
-next_iter:
- node = node->next;
- }
-
- if (retnode)
- {
- *type = SXE_ITER_NONE;
- *name = NULL;
- return retnode;
- }
-
- return NULL;
-}
-/* }}} */
-
-/* {{{ sxe_prop_dim_read()
- */
-static zval * sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, zend_bool attribs, zend_bool silent TSRMLS_DC)
-{
- zval *return_value;
- php_sxe_object *sxe;
- char *name;
- xmlNodePtr node;
- xmlAttrPtr attr = NULL;
- zval tmp_zv;
- int nodendx = 0;
- int test = 0;
-
- sxe = php_sxe_fetch_object(object TSRMLS_CC);
-
- if (Z_TYPE_P(member) == IS_LONG) {
- if (sxe->iter.type != SXE_ITER_ATTRLIST) {
- attribs = 0;
- elements = 1;
- }
- name = NULL;
- } else {
- if (Z_TYPE_P(member) != IS_STRING) {
- tmp_zv = *member;
- zval_copy_ctor(&tmp_zv);
- member = &tmp_zv;
- convert_to_string(member);
- }
- name = Z_STRVAL_P(member);
- }
-
- MAKE_STD_ZVAL(return_value);
- ZVAL_NULL(return_value);
-
- GET_NODE(sxe, node);
-
- if (sxe->iter.type == SXE_ITER_ATTRLIST) {
- attribs = 1;
- elements = 0;
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- attr = (xmlAttrPtr)node;
- test = sxe->iter.name != NULL;
- } else if (sxe->iter.type != SXE_ITER_CHILD) {
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- attr = node ? node->properties : NULL;
- test = 0;
- }
-
- if (node) {
- if (attribs) {
- if (Z_TYPE_P(member) != IS_LONG || sxe->iter.type == SXE_ITER_ATTRLIST) {
- if (Z_TYPE_P(member) == IS_LONG) {
- while (attr && nodendx <= Z_LVAL_P(member)) {
- if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- if (nodendx == Z_LVAL_P(member)) {
- _node_as_zval(sxe, (xmlNodePtr) attr, return_value, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC);
- break;
- }
- nodendx++;
- }
- attr = attr->next;
- }
- } else {
- while (attr) {
- if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, (xmlChar *)name) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- _node_as_zval(sxe, (xmlNodePtr) attr, return_value, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC);
- break;
- }
- attr = attr->next;
- }
- }
- }
- }
-
- if (elements) {
- if (!sxe->node) {
- php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, node, NULL TSRMLS_CC);
- }
- if (Z_TYPE_P(member) == IS_LONG) {
- if (sxe->iter.type == SXE_ITER_CHILD) {
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- }
- node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL);
- if (node) {
- _node_as_zval(sxe, node, return_value, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC);
- }
- } else {
-#if SXE_ELEMENT_BY_NAME
- int newtype;
-
- GET_NODE(sxe, node);
- node = sxe_get_element_by_name(sxe, node, &name, &newtype TSRMLS_CC);
- if (node) {
- _node_as_zval(sxe, node, return_value, newtype, name, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC);
- }
-#else
- _node_as_zval(sxe, node, return_value, SXE_ITER_ELEMENT, name, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC);
-#endif
- }
- }
- }
-
- return_value->refcount = 0;
- return_value->is_ref = 0;
-
- if (member == &tmp_zv) {
- zval_dtor(&tmp_zv);
- }
- if (Z_TYPE_P(return_value) == IS_NULL) {
- FREE_ZVAL(return_value);
- return_value = &EG(uninitialized_zval);
- }
-
- return return_value;
-}
-/* }}} */
-
-/* {{{ sxe_property_read()
- */
-static zval * sxe_property_read(zval *object, zval *member, int type TSRMLS_DC)
-{
- return sxe_prop_dim_read(object, member, 1, 0, type == BP_VAR_IS TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ sxe_dimension_read()
- */
-static zval * sxe_dimension_read(zval *object, zval *offset, int type TSRMLS_DC)
-{
- return sxe_prop_dim_read(object, offset, 0, 1, 0 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ change_node_zval()
- */
-static void change_node_zval(xmlNodePtr node, zval *value TSRMLS_DC)
-{
- zval value_copy;
- xmlChar *buffer;
- int buffer_len;
-
- if (!value)
- {
- xmlNodeSetContentLen(node, (xmlChar *)"", 0);
- return;
- }
- switch (Z_TYPE_P(value)) {
- case IS_LONG:
- case IS_BOOL:
- case IS_DOUBLE:
- case IS_NULL:
- if (value->refcount > 1) {
- value_copy = *value;
- zval_copy_ctor(&value_copy);
- value = &value_copy;
- }
- convert_to_string(value);
- /* break missing intentionally */
- case IS_STRING:
- if (node->type == XML_ATTRIBUTE_NODE) {
- buffer = xmlEncodeEntitiesReentrant(node->doc, (xmlChar *)Z_STRVAL_P(value));
- buffer_len = xmlStrlen(buffer);
- } else {
- buffer = (xmlChar *)Z_STRVAL_P(value);
- buffer_len = Z_STRLEN_P(value);
- }
- /* check for NULL buffer in case of memory error in xmlEncodeEntitiesReentrant */
- if (buffer) {
- xmlNodeSetContentLen(node, buffer, buffer_len);
- if (node->type == XML_ATTRIBUTE_NODE) {
- xmlFree(buffer);
- }
- }
- if (value == &value_copy) {
- zval_dtor(value);
- }
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "It is not possible to assign complex types to nodes");
- break;
- }
-}
-/* }}} */
-
-/* {{{ sxe_property_write()
- */
-static void sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool elements, zend_bool attribs, xmlNodePtr *pnewnode TSRMLS_DC)
-{
- php_sxe_object *sxe;
- char *name;
- xmlNodePtr node;
- xmlNodePtr newnode = NULL;
- xmlNodePtr mynode;
- xmlNodePtr tempnode;
- xmlAttrPtr attr = NULL;
- int counter = 0;
- int is_attr = 0;
- int nodendx = 0;
- int test = 0;
- long cnt;
- zval tmp_zv, trim_zv, value_copy;
-
- if (!member) {
- /* This happens when the user did: $sxe[] = $value
- * and could also be E_PARSE, but we use this only during parsing
- * and this is during runtime.
- */
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot create unnamed attribute");
- return;
- }
-
-
- sxe = php_sxe_fetch_object(object TSRMLS_CC);
-
- if (Z_TYPE_P(member) == IS_LONG) {
- if (sxe->iter.type != SXE_ITER_ATTRLIST) {
- attribs = 0;
- elements = 1;
- }
- } else {
- if (Z_TYPE_P(member) != IS_STRING) {
- trim_zv = *member;
- zval_copy_ctor(&trim_zv);
- convert_to_string(&trim_zv);
- php_trim(Z_STRVAL(trim_zv), Z_STRLEN(trim_zv), NULL, 0, &tmp_zv, 3 TSRMLS_CC);
- zval_dtor(&trim_zv);
- member = &tmp_zv;
- }
-
- if (!Z_STRLEN_P(member)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write or create unnamed %s", attribs ? "attribute" : "element");
- if (member == &tmp_zv) {
- zval_dtor(&tmp_zv);
- }
- return;
- }
- }
-
- name = Z_STRVAL_P(member);
-
- GET_NODE(sxe, node);
-
- if (sxe->iter.type == SXE_ITER_ATTRLIST) {
- attribs = 1;
- elements = 0;
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- attr = (xmlAttrPtr)node;
- test = sxe->iter.name != NULL;
- } else if (sxe->iter.type != SXE_ITER_CHILD) {
- mynode = node;
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- attr = node ? node->properties : NULL;
- test = 0;
- if (attribs && !node && sxe->iter.type == SXE_ITER_ELEMENT) {
- node = xmlNewChild(mynode, mynode->ns, sxe->iter.name, NULL);
- attr = node->properties;
- }
- }
-
- mynode = node;
-
- if (value) {
- switch (Z_TYPE_P(value)) {
- case IS_LONG:
- case IS_BOOL:
- case IS_DOUBLE:
- case IS_NULL:
- if (value->refcount > 1) {
- value_copy = *value;
- zval_copy_ctor(&value_copy);
- value = &value_copy;
- }
- convert_to_string(value);
- break;
- case IS_STRING:
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "It is not yet possible to assign complex types to %s", attribs ? "attributes" : "properties");
- }
- }
-
- if (node) {
- if (attribs) {
- if (Z_TYPE_P(member) == IS_LONG) {
- while (attr && nodendx <= Z_LVAL_P(member)) {
- if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- if (nodendx == Z_LVAL_P(member)) {
- is_attr = 1;
- ++counter;
- break;
- }
- nodendx++;
- }
- attr = attr->next;
- }
- } else {
- while (attr) {
- if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, (xmlChar *)name) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- is_attr = 1;
- ++counter;
- break;
- }
- attr = attr->next;
- }
- }
-
- }
-
- if (elements) {
- if (Z_TYPE_P(member) == IS_LONG) {
- newnode = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, &cnt);
- if (newnode) {
- ++counter;
- }
- } else {
- node = node->children;
- while (node) {
- SKIP_TEXT(node);
-
- if (!xmlStrcmp(node->name, (xmlChar *)name)) {
- newnode = node;
- ++counter;
- }
-
-next_iter:
- node = node->next;
- }
- }
- }
-
- if (counter == 1) {
- if (is_attr) {
- newnode = (xmlNodePtr) attr;
- }
- if (value) {
- while ((tempnode = (xmlNodePtr) newnode->children)) {
- xmlUnlinkNode(tempnode);
- php_libxml_node_free_resource((xmlNodePtr) tempnode TSRMLS_CC);
- }
- change_node_zval(newnode, value TSRMLS_CC);
- }
- } else if (counter > 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot assign to an array of nodes (duplicate subnodes or attr detected)");
- } else if (elements) {
- if (!node) {
- newnode = xmlNewTextChild(mynode, mynode->ns, (xmlChar *)name, value ? (xmlChar *)Z_STRVAL_P(value) : NULL);
- } else if (Z_TYPE_P(member) == IS_LONG) {
- if (cnt < Z_LVAL_P(member)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %ld when only %ld such elements exist", mynode->name, Z_LVAL_P(member), cnt);
- }
- newnode = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, value ? (xmlChar *)Z_STRVAL_P(value) : NULL);
- }
- } else if (attribs) {
- newnode = (xmlNodePtr)xmlNewProp(node, (xmlChar *)name, value ? (xmlChar *)Z_STRVAL_P(value) : NULL);
- }
- }
-
- if (member == &tmp_zv) {
- zval_dtor(&tmp_zv);
- }
- if (pnewnode) {
- *pnewnode = newnode;
- }
- if (value && value == &value_copy) {
- zval_dtor(value);
- }
-}
-/* }}} */
-
-/* {{{ sxe_property_write()
- */
-static void sxe_property_write(zval *object, zval *member, zval *value TSRMLS_DC)
-{
- sxe_prop_dim_write(object, member, value, 1, 0, NULL TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ sxe_dimension_write()
- */
-static void sxe_dimension_write(zval *object, zval *offset, zval *value TSRMLS_DC)
-{
- sxe_prop_dim_write(object, offset, value, 0, 1, NULL TSRMLS_CC);
-}
-/* }}} */
-
-static zval** sxe_property_get_adr(zval *object, zval *member TSRMLS_DC) /* {{{ */
-{
- php_sxe_object *sxe;
- xmlNodePtr node;
- zval *return_value;
- char *name;
- SXE_ITER type;
-
- sxe = php_sxe_fetch_object(object TSRMLS_CC);
-
- GET_NODE(sxe, node);
- convert_to_string(member);
- name = Z_STRVAL_P(member);
- node = sxe_get_element_by_name(sxe, node, &name, &type TSRMLS_CC);
- if (!node) {
- sxe_prop_dim_write(object, member, NULL, 1, 0, &node TSRMLS_CC);
- type = SXE_ITER_NONE;
- name = NULL;
- }
- MAKE_STD_ZVAL(return_value);
- _node_as_zval(sxe, node, return_value, type, name, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC);
-
- sxe = php_sxe_fetch_object(return_value TSRMLS_CC);
- sxe->tmp = return_value;
- return_value->is_ref = 1;
-
- return &sxe->tmp;
-}
-/* }}} */
-
-/* {{{ sxe_prop_dim_exists()
- */
-static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend_bool elements, zend_bool attribs TSRMLS_DC)
-{
- php_sxe_object *sxe;
- xmlNodePtr node;
- xmlAttrPtr attr = NULL;
- int exists = 0;
- int test = 0;
- zval tmp_zv;
-
- if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) {
- tmp_zv = *member;
- zval_copy_ctor(&tmp_zv);
- member = &tmp_zv;
- convert_to_string(member);
- }
-
- sxe = php_sxe_fetch_object(object TSRMLS_CC);
-
- GET_NODE(sxe, node);
-
- if (Z_TYPE_P(member) == IS_LONG) {
- if (sxe->iter.type != SXE_ITER_ATTRLIST) {
- attribs = 0;
- elements = 1;
- if (sxe->iter.type == SXE_ITER_CHILD) {
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- }
- }
- }
-
- if (sxe->iter.type == SXE_ITER_ATTRLIST) {
- attribs = 1;
- elements = 0;
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- attr = (xmlAttrPtr)node;
- test = sxe->iter.name != NULL;
- } else if (sxe->iter.type != SXE_ITER_CHILD) {
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- attr = node ? node->properties : NULL;
- test = 0;
- }
-
- if (node) {
- if (attribs) {
- if (Z_TYPE_P(member) == IS_LONG) {
- int nodendx = 0;
-
- while (attr && nodendx <= Z_LVAL_P(member)) {
- if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- if (nodendx == Z_LVAL_P(member)) {
- exists = 1;
- break;
- }
- nodendx++;
- }
- attr = attr->next;
- }
- } else {
- while (attr) {
- if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, (xmlChar *)Z_STRVAL_P(member)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- exists = 1;
- break;
- }
-
- attr = attr->next;
- }
- }
- }
-
- if (elements) {
- if (Z_TYPE_P(member) == IS_LONG) {
- if (sxe->iter.type == SXE_ITER_CHILD) {
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- }
- node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL);
- }
- else {
- node = node->children;
- while (node) {
- xmlNodePtr nnext;
- nnext = node->next;
- if (!xmlStrcmp(node->name, (xmlChar *)Z_STRVAL_P(member))) {
- break;
- }
- node = nnext;
- }
- }
- if (node) {
- exists = 1;
- }
- }
- }
-
- if (member == &tmp_zv) {
- zval_dtor(&tmp_zv);
- }
-
- return exists;
-}
-/* }}} */
-
-/* {{{ sxe_property_exists()
- */
-static int sxe_property_exists(zval *object, zval *member, int check_empty TSRMLS_DC)
-{
- return sxe_prop_dim_exists(object, member, check_empty, 1, 0 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ sxe_property_exists()
- */
-static int sxe_dimension_exists(zval *object, zval *member, int check_empty TSRMLS_DC)
-{
- return sxe_prop_dim_exists(object, member, check_empty, 0, 1 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ sxe_prop_dim_delete()
- */
-static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, zend_bool attribs TSRMLS_DC)
-{
- php_sxe_object *sxe;
- xmlNodePtr node;
- xmlNodePtr nnext;
- xmlAttrPtr attr = NULL;
- xmlAttrPtr anext;
- zval tmp_zv;
- int test = 0;
-
- if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) {
- tmp_zv = *member;
- zval_copy_ctor(&tmp_zv);
- member = &tmp_zv;
- convert_to_string(member);
- }
-
- sxe = php_sxe_fetch_object(object TSRMLS_CC);
-
- GET_NODE(sxe, node);
-
- if (Z_TYPE_P(member) == IS_LONG) {
- if (sxe->iter.type != SXE_ITER_ATTRLIST) {
- attribs = 0;
- elements = 1;
- if (sxe->iter.type == SXE_ITER_CHILD) {
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- }
- }
- }
-
- if (sxe->iter.type == SXE_ITER_ATTRLIST) {
- attribs = 1;
- elements = 0;
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- attr = (xmlAttrPtr)node;
- test = sxe->iter.name != NULL;
- } else if (sxe->iter.type != SXE_ITER_CHILD) {
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- attr = node ? node->properties : NULL;
- test = 0;
- }
-
- if (node) {
- if (attribs) {
- if (Z_TYPE_P(member) == IS_LONG) {
- int nodendx = 0;
-
- while (attr && nodendx <= Z_LVAL_P(member)) {
- if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- if (nodendx == Z_LVAL_P(member)) {
- xmlUnlinkNode((xmlNodePtr) attr);
- php_libxml_node_free_resource((xmlNodePtr) attr TSRMLS_CC);
- break;
- }
- nodendx++;
- }
- attr = attr->next;
- }
- } else {
- while (attr) {
- anext = attr->next;
- if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, (xmlChar *)Z_STRVAL_P(member)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- xmlUnlinkNode((xmlNodePtr) attr);
- php_libxml_node_free_resource((xmlNodePtr) attr TSRMLS_CC);
- break;
- }
- attr = anext;
- }
- }
- }
-
- if (elements) {
- if (Z_TYPE_P(member) == IS_LONG) {
- if (sxe->iter.type == SXE_ITER_CHILD) {
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- }
- node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL);
- if (node) {
- xmlUnlinkNode(node);
- php_libxml_node_free_resource(node TSRMLS_CC);
- }
- } else {
- node = node->children;
- while (node) {
- nnext = node->next;
-
- SKIP_TEXT(node);
-
- if (!xmlStrcmp(node->name, (xmlChar *)Z_STRVAL_P(member))) {
- xmlUnlinkNode(node);
- php_libxml_node_free_resource(node TSRMLS_CC);
- }
-
-next_iter:
- node = nnext;
- }
- }
- }
- }
-
- if (member == &tmp_zv) {
- zval_dtor(&tmp_zv);
- }
-}
-/* }}} */
-
-/* {{{ sxe_property_delete()
- */
-static void sxe_property_delete(zval *object, zval *member TSRMLS_DC)
-{
- sxe_prop_dim_delete(object, member, 1, 0 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ sxe_dimension_unset()
- */
-static void sxe_dimension_delete(zval *object, zval *offset TSRMLS_DC)
-{
- sxe_prop_dim_delete(object, offset, 0, 1 TSRMLS_CC);
-}
-/* }}} */
-
-static inline char * sxe_xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list, int inLine)
-{
- xmlChar *tmp = xmlNodeListGetString(doc, list, inLine);
- char *res = estrdup((char*)tmp);
-
- xmlFree(tmp);
-
- return res;
-}
-
-/* {{{ _get_base_node_value()
- */
-static void _get_base_node_value(php_sxe_object *sxe_ref, xmlNodePtr node, zval **value, xmlChar *nsprefix, int isprefix TSRMLS_DC)
-{
- php_sxe_object *subnode;
- xmlChar *contents;
-
- MAKE_STD_ZVAL(*value);
-
- if (node->children && node->children->type == XML_TEXT_NODE && !xmlIsBlankNode(node->children)) {
- contents = xmlNodeListGetString(node->doc, node->children, 1);
- if (contents) {
- ZVAL_STRING(*value, (char *)contents, 1);
- xmlFree(contents);
- }
- } else {
- subnode = php_sxe_object_new(sxe_ref->zo.ce TSRMLS_CC);
- subnode->document = sxe_ref->document;
- subnode->document->refcount++;
- if (nsprefix && *nsprefix) {
- subnode->iter.nsprefix = xmlStrdup((xmlChar *)nsprefix);
- subnode->iter.isprefix = isprefix;
- }
- php_libxml_increment_node_ptr((php_libxml_node_object *)subnode, node, NULL TSRMLS_CC);
-
- (*value)->type = IS_OBJECT;
- (*value)->value.obj = php_sxe_register_object(subnode TSRMLS_CC);
- /*zval_add_ref(value);*/
- }
-}
-/* }}} */
-
-static void sxe_properties_add(HashTable *rv, char *name, int namelen, zval *value TSRMLS_DC)
-{
- zval **data_ptr;
- zval *newptr;
- ulong h = zend_hash_func(name, namelen);
-
- if (zend_hash_quick_find(rv, name, namelen, h, (void **) &data_ptr) == SUCCESS) {
- if (Z_TYPE_PP(data_ptr) == IS_ARRAY) {
- zend_hash_next_index_insert(Z_ARRVAL_PP(data_ptr), &value, sizeof(zval *), NULL);
- } else {
- MAKE_STD_ZVAL(newptr);
- array_init(newptr);
-
- zval_add_ref(data_ptr);
- zend_hash_next_index_insert(Z_ARRVAL_P(newptr), data_ptr, sizeof(zval *), NULL);
- zend_hash_next_index_insert(Z_ARRVAL_P(newptr), &value, sizeof(zval *), NULL);
-
- zend_hash_quick_update(rv, name, namelen, h, &newptr, sizeof(zval *), NULL);
- }
- } else {
- zend_hash_quick_update(rv, name, namelen, h, &value, sizeof(zval *), NULL);
- }
-}
-
-/* {{{ sxe_properties_get()
- */
-static HashTable * sxe_properties_get(zval *object TSRMLS_DC)
-{
- zval *value;
- zval *zattr;
- HashTable *rv;
- php_sxe_object *sxe;
- char *name;
- xmlNodePtr node;
- xmlAttrPtr attr;
- int namelen;
- int test;
-
- sxe = php_sxe_fetch_object(object TSRMLS_CC);
-
- if (sxe->properties) {
- zend_hash_clean(sxe->properties);
- rv = sxe->properties;
- } else {
- ALLOC_HASHTABLE(rv);
- zend_hash_init(rv, 0, NULL, ZVAL_PTR_DTOR, 0);
- sxe->properties = rv;
- }
-
- GET_NODE(sxe, node);
- if (!node) {
- return rv;
- }
- if (1||sxe->iter.type != SXE_ITER_CHILD) {
- if (sxe->iter.type == SXE_ITER_ELEMENT) {
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- }
- attr = node ? (xmlAttrPtr)node->properties : NULL;
- zattr = NULL;
- test = sxe->iter.name && sxe->iter.type == SXE_ITER_ATTRLIST;
- while (attr) {
- if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr)attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- MAKE_STD_ZVAL(value);
- ZVAL_STRING(value, sxe_xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, attr->children, 1), 0);
- namelen = xmlStrlen(attr->name) + 1;
- if (!zattr) {
- MAKE_STD_ZVAL(zattr);
- array_init(zattr);
- sxe_properties_add(rv, "@attributes", sizeof("@attributes"), zattr TSRMLS_CC);
- }
- add_assoc_zval_ex(zattr, (char*)attr->name, namelen, value);
- }
- attr = attr->next;
- }
- }
-
- GET_NODE(sxe, node);
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
- if (node && sxe->iter.type != SXE_ITER_ATTRLIST) {
- if (node->type == XML_ATTRIBUTE_NODE) {
- MAKE_STD_ZVAL(value);
- ZVAL_STRING(value, sxe_xmlNodeListGetString(node->doc, node->children, 1), 0);
- zend_hash_next_index_insert(rv, &value, sizeof(zval *), NULL);
- node = NULL;
- } else if (sxe->iter.type != SXE_ITER_CHILD) {
- node = node->children;
- }
-
- while (node) {
- if (node->children != NULL || node->prev != NULL || node->next != NULL) {
- SKIP_TEXT(node);
- } else {
- if (node->type == XML_TEXT_NODE) {
- MAKE_STD_ZVAL(value);
- ZVAL_STRING(value, sxe_xmlNodeListGetString(node->doc, node, 1), 0);
- zend_hash_next_index_insert(rv, &value, sizeof(zval *), NULL);
- goto next_iter;
- }
- }
-
- if (node->type == XML_ELEMENT_NODE && (! match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix))) {
- goto next_iter;
- }
-
- name = (char *) node->name;
- if (!name) {
- goto next_iter;
- } else {
- namelen = xmlStrlen(node->name) + 1;
- }
-
- _get_base_node_value(sxe, node, &value, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC);
-
- sxe_properties_add(rv, name, namelen, value TSRMLS_CC);
-next_iter:
- node = node->next;
- }
- }
-
- return rv;
-}
-/* }}} */
-
-static int sxe_objects_compare(zval *object1, zval *object2 TSRMLS_DC) /* {{{ */
-{
- php_sxe_object *sxe1;
- php_sxe_object *sxe2;
-
- sxe1 = php_sxe_fetch_object(object1 TSRMLS_CC);
- sxe2 = php_sxe_fetch_object(object2 TSRMLS_CC);
-
- if (sxe1->node == NULL) {
- if (sxe2->node) {
- return 1;
- } else if (sxe1->document->ptr == sxe2->document->ptr) {
- return 0;
- }
- } else {
- return !(sxe1->node == sxe2->node);
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ proto array SimpleXMLElement::xpath(string path)
- Runs XPath query on the XML data */
-SXE_METHOD(xpath)
-{
- php_sxe_object *sxe;
- zval *value;
- char *query;
- int query_len;
- int i;
- int nsnbr = 0;
- xmlNsPtr *ns = NULL;
- xmlXPathObjectPtr retval;
- xmlNodeSetPtr result;
- xmlNodePtr nodeptr;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &query, &query_len) == FAILURE) {
- return;
- }
-
- sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
-
- if (sxe->iter.type == SXE_ITER_ATTRLIST) {
- return; /* attributes don't have attributes */
- }
-
- if (!sxe->xpath) {
- sxe->xpath = xmlXPathNewContext((xmlDocPtr) sxe->document->ptr);
- }
- if (!sxe->node) {
- php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement((xmlDocPtr) sxe->document->ptr), NULL TSRMLS_CC);
- }
-
- sxe->xpath->node = sxe->node->node;
-
- ns = xmlGetNsList((xmlDocPtr) sxe->document->ptr, (xmlNodePtr) sxe->node->node);
- if (ns != NULL) {
- while (ns[nsnbr] != NULL) {
- nsnbr++;
- }
- }
-
- sxe->xpath->namespaces = ns;
- sxe->xpath->nsNr = nsnbr;
-
- retval = xmlXPathEval((xmlChar *)query, sxe->xpath);
- if (ns != NULL) {
- xmlFree(ns);
- sxe->xpath->namespaces = NULL;
- sxe->xpath->nsNr = 0;
- }
-
- if (!retval) {
- RETURN_FALSE;
- }
-
- result = retval->nodesetval;
- if (!result) {
- xmlXPathFreeObject(retval);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for (i = 0; i < result->nodeNr; ++i) {
- nodeptr = result->nodeTab[i];
- if (nodeptr->type == XML_TEXT_NODE || nodeptr->type == XML_ELEMENT_NODE || nodeptr->type == XML_ATTRIBUTE_NODE) {
- MAKE_STD_ZVAL(value);
- /**
- * Detect the case where the last selector is text(), simplexml
- * always accesses the text() child by default, therefore we assign
- * to the parent node.
- */
- if (nodeptr->type == XML_TEXT_NODE) {
- _node_as_zval(sxe, nodeptr->parent, value, SXE_ITER_NONE, NULL, NULL, 0 TSRMLS_CC);
- } else if (nodeptr->type == XML_ATTRIBUTE_NODE) {
- _node_as_zval(sxe, nodeptr->parent, value, SXE_ITER_ATTRLIST, (char*)nodeptr->name, NULL, 0 TSRMLS_CC);
- } else {
- _node_as_zval(sxe, nodeptr, value, SXE_ITER_NONE, NULL, NULL, 0 TSRMLS_CC);
- }
-
- add_next_index_zval(return_value, value);
- }
- }
-
- xmlXPathFreeObject(retval);
-}
-
-/* {{{ proto bool SimpleXMLElement::registerXPathNamespace(string prefix, string ns)
- Creates a prefix/ns context for the next XPath query */
-SXE_METHOD(registerXPathNamespace)
-{
- php_sxe_object *sxe;
- int prefix_len, ns_uri_len;
- char *prefix, *ns_uri;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) {
- return;
- }
-
- sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
- if (!sxe->xpath) {
- sxe->xpath = xmlXPathNewContext((xmlDocPtr) sxe->document->ptr);
- }
-
- if (xmlXPathRegisterNs(sxe->xpath, (xmlChar *)prefix, (xmlChar *)ns_uri) != 0) {
- RETURN_FALSE
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string SimpleXMLElement::asXML([string filename])
- Return a well-formed XML string based on SimpleXML element */
-SXE_METHOD(asXML)
-{
- php_sxe_object *sxe;
- xmlNodePtr node;
- xmlOutputBufferPtr outbuf;
- xmlChar *strval;
- int strval_len;
- char *filename;
- int filename_len;
-
- if (ZEND_NUM_ARGS() > 1) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
- GET_NODE(sxe, node);
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
-
- if (node) {
- if (XML_DOCUMENT_NODE == node->parent->type) {
- int bytes;
- bytes = xmlSaveFile(filename, (xmlDocPtr) sxe->document->ptr);
- if (bytes == -1) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
- } else {
- outbuf = xmlOutputBufferCreateFilename(filename, NULL, 0);
-
- if (outbuf == NULL) {
- RETURN_FALSE;
- }
-
- xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, NULL);
- xmlOutputBufferClose(outbuf);
- RETURN_TRUE;
- }
- } else {
- RETURN_FALSE;
- }
- }
-
- sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
- GET_NODE(sxe, node);
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
-
- if (node) {
- if (XML_DOCUMENT_NODE == node->parent->type) {
- xmlDocDumpMemory((xmlDocPtr) sxe->document->ptr, &strval, &strval_len);
- RETVAL_STRINGL((char *)strval, strval_len, 1);
- xmlFree(strval);
- } else {
- /* Should we be passing encoding information instead of NULL? */
- outbuf = xmlAllocOutputBuffer(NULL);
-
- if (outbuf == NULL) {
- RETURN_FALSE;
- }
-
- xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding);
- xmlOutputBufferFlush(outbuf);
- RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1);
- xmlOutputBufferClose(outbuf);
- }
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-#define SXE_NS_PREFIX(ns) (ns->prefix ? (char*)ns->prefix : "")
-
-static inline void sxe_add_namespace_name(zval *return_value, xmlNsPtr ns)
-{
- char *prefix = SXE_NS_PREFIX(ns);
- if (zend_hash_exists(Z_ARRVAL_P(return_value), prefix, strlen(prefix) + 1) == 0) {
- add_assoc_string(return_value, prefix, (char*)ns->href, 1);
- }
-}
-
-static void sxe_add_namespaces(php_sxe_object *sxe, xmlNodePtr node, zend_bool recursive, zval *return_value TSRMLS_DC) /* {{{ */
-{
- xmlAttrPtr attr;
-
- if (node->ns) {
- sxe_add_namespace_name(return_value, node->ns);
- }
-
- attr = node->properties;
- while (attr) {
- if (attr->ns) {
- sxe_add_namespace_name(return_value, attr->ns);
- }
- attr = attr->next;
- }
-
- if (recursive) {
- node = node->children;
- while (node) {
- if (node->type == XML_ELEMENT_NODE) {
- sxe_add_namespaces(sxe, node, recursive, return_value TSRMLS_CC);
- }
- node = node->next;
- }
- }
-} /* }}} */
-
-/* {{{ proto string SimpleXMLElement::getNamespaces([bool recursve])
- Return all namespaces in use */
-SXE_METHOD(getNamespaces)
-{
- zend_bool recursive = 0;
- php_sxe_object *sxe;
- xmlNodePtr node;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &recursive) == FAILURE) {
- return;
- }
-
- array_init(return_value);
-
- sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
- GET_NODE(sxe, node);
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
-
- while (node) {
- SKIP_TEXT(node)
- if (node->type == XML_ELEMENT_NODE) {
- sxe_add_namespaces(sxe, node, recursive, return_value TSRMLS_CC);
- } else if (node->type == XML_ATTRIBUTE_NODE && node->ns) {
- sxe_add_namespace_name(return_value, node->ns);
- }
-next_iter:
- node = node->next;
- }
-}
-/* }}} */
-
-static void sxe_add_registered_namespaces(php_sxe_object *sxe, xmlNodePtr node, zend_bool recursive, zval *return_value TSRMLS_DC) /* {{{ */
-{
- xmlNsPtr ns;
-
- if (node->type == XML_ELEMENT_NODE) {
- ns = node->nsDef;
- while (ns != NULL) {
- sxe_add_namespace_name(return_value, ns);
- ns = ns->next;
- }
- if (recursive) {
- node = node->children;
- while (node) {
- sxe_add_registered_namespaces(sxe, node, recursive, return_value TSRMLS_CC);
- node = node->next;
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string SimpleXMLElement::getDocNamespaces([bool recursive])
- Return all namespaces registered with document */
-SXE_METHOD(getDocNamespaces)
-{
- zend_bool recursive = 0;
- php_sxe_object *sxe;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &recursive) == FAILURE) {
- return;
- }
-
- array_init(return_value);
-
- sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
-
- sxe_add_registered_namespaces(sxe, xmlDocGetRootElement((xmlDocPtr)sxe->document->ptr), recursive, return_value TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto object SimpleXMLElement::children([string ns [, bool is_prefix]])
- Finds children of given node */
-SXE_METHOD(children)
-{
- php_sxe_object *sxe;
- char *nsprefix = NULL;
- int nsprefix_len;
- xmlNodePtr node;
- zend_bool isprefix = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!b", &nsprefix, &nsprefix_len, &isprefix) == FAILURE) {
- return;
- }
-
- sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
-
- if (sxe->iter.type == SXE_ITER_ATTRLIST) {
- return; /* attributes don't have attributes */
- }
-
- GET_NODE(sxe, node);
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
-
- _node_as_zval(sxe, node, return_value, SXE_ITER_CHILD, NULL, (xmlChar *)nsprefix, isprefix TSRMLS_CC);
-
-}
-/* }}} */
-
-/* {{{ proto object SimpleXMLElement::getName()
- Finds children of given node */
-SXE_METHOD(getName)
-{
- php_sxe_object *sxe;
- xmlNodePtr node;
- int namelen;
-
- sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
-
- GET_NODE(sxe, node);
-
- namelen = xmlStrlen(node->name);
- RETURN_STRINGL((char*)node->name, namelen, 1);
-}
-/* }}} */
-
-/* {{{ proto array SimpleXMLElement::attributes([string ns [, bool is_prefix]])
- Identifies an element's attributes */
-SXE_METHOD(attributes)
-{
- php_sxe_object *sxe;
- char *nsprefix = NULL;
- int nsprefix_len;
- xmlNodePtr node;
- zend_bool isprefix = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!b", &nsprefix, &nsprefix_len, &isprefix) == FAILURE) {
- return;
- }
-
- sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
- GET_NODE(sxe, node);
-
- if (sxe->iter.type == SXE_ITER_ATTRLIST) {
- return; /* attributes don't have attributes */
- }
-
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
-
- _node_as_zval(sxe, node, return_value, SXE_ITER_ATTRLIST, NULL, (xmlChar *)nsprefix, isprefix TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto void SimpleXMLElement::addChild(string qName [, string value [, string ns]])
- Add Element with optional namespace information */
-SXE_METHOD(addChild)
-{
- php_sxe_object *sxe;
- char *qname, *value = NULL, *nsuri = NULL;
- int qname_len, value_len = 0, nsuri_len = 0;
- xmlNodePtr node, newnode;
- xmlNsPtr nsptr = NULL;
- xmlChar *localname, *prefix = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!s!",
- &qname, &qname_len, &value, &value_len, &nsuri, &nsuri_len) == FAILURE) {
- return;
- }
-
- if (qname_len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Element name is required");
- return;
- }
-
- sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
- GET_NODE(sxe, node);
-
- if (sxe->iter.type == SXE_ITER_ATTRLIST) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element to attributes");
- return;
- }
-
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
-
- localname = xmlSplitQName2((xmlChar *)qname, &prefix);
- if (localname == NULL) {
- localname = xmlStrdup((xmlChar *)qname);
- }
-
- newnode = xmlNewChild(node, NULL, localname, (xmlChar *)value);
-
- if (nsuri != NULL) {
- nsptr = xmlSearchNsByHref(node->doc, node, (xmlChar *)nsuri);
- if (nsptr == NULL) {
- nsptr = xmlNewNs(newnode, (xmlChar *)nsuri, prefix);
- }
- newnode->ns = nsptr;
- }
-
- _node_as_zval(sxe, newnode, return_value, SXE_ITER_NONE, (char *)localname, prefix, 0 TSRMLS_CC);
-
- xmlFree(localname);
- if (prefix != NULL) {
- xmlFree(prefix);
- }
-}
-/* }}} */
-
-/* {{{ proto void SimpleXMLElement::addAttribute(string qName, string value [,string ns])
- Add Attribute with optional namespace information */
-SXE_METHOD(addAttribute)
-{
- php_sxe_object *sxe;
- char *qname, *value = NULL, *nsuri = NULL;
- int qname_len, value_len = 0, nsuri_len = 0;
- xmlNodePtr node;
- xmlAttrPtr attrp = NULL;
- xmlNsPtr nsptr = NULL;
- xmlChar *localname, *prefix = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s!",
- &qname, &qname_len, &value, &value_len, &nsuri, &nsuri_len) == FAILURE) {
- return;
- }
-
- if (qname_len == 0 || value_len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute name and value are required");
- return;
- }
-
- sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
- GET_NODE(sxe, node);
-
- node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
-
- if (node->type != XML_ELEMENT_NODE) {
- node = node->parent;
- }
-
- if (node == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate parent Element");
- return;
- }
-
- localname = xmlSplitQName2((xmlChar *)qname, &prefix);
- if (localname == NULL) {
- localname = xmlStrdup((xmlChar *)qname);
- }
-
- attrp = xmlHasNsProp(node, localname, (xmlChar *)nsuri);
- if (attrp != NULL && attrp->type != XML_ATTRIBUTE_DECL) {
- xmlFree(localname);
- if (prefix != NULL) {
- xmlFree(prefix);
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute already exists");
- return;
- }
-
- if (nsuri != NULL) {
- nsptr = xmlSearchNsByHref(node->doc, node, (xmlChar *)nsuri);
- if (nsptr == NULL) {
- nsptr = xmlNewNs(node, (xmlChar *)nsuri, prefix);
- }
- }
-
- attrp = xmlNewNsProp(node, nsptr, localname, (xmlChar *)value);
-
- xmlFree(localname);
- if (prefix != NULL) {
- xmlFree(prefix);
- }
-}
-/* }}} */
-
-/* {{{ cast_object()
- */
-static int cast_object(zval *object, int type, char *contents TSRMLS_DC)
-{
- if (contents) {
- ZVAL_STRINGL(object, contents, strlen(contents), 1);
- } else {
- ZVAL_NULL(object);
- }
- object->refcount = 1;
- object->is_ref = 0;
-
- switch (type) {
- case IS_STRING:
- convert_to_string(object);
- break;
- case IS_BOOL:
- convert_to_boolean(object);
- break;
- case IS_LONG:
- convert_to_long(object);
- break;
- case IS_DOUBLE:
- convert_to_double(object);
- break;
- default:
- return FAILURE;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ sxe_object_cast()
- */
-static int sxe_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
-{
- php_sxe_object *sxe;
- xmlChar *contents = NULL;
- xmlNodePtr node;
- int rv;
-
- sxe = php_sxe_fetch_object(readobj TSRMLS_CC);
-
- if (type == IS_BOOL) {
- node = php_sxe_get_first_node(sxe, NULL TSRMLS_CC);
- INIT_PZVAL(writeobj);
- ZVAL_BOOL(writeobj, node != NULL || zend_hash_num_elements(sxe_properties_get(readobj TSRMLS_CC)) > 0);
- return SUCCESS;
- }
-
- if (sxe->iter.type != SXE_ITER_NONE) {
- node = php_sxe_get_first_node(sxe, NULL TSRMLS_CC);
- if (node) {
- contents = xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, node->children, 1);
- }
- } else {
- if (!sxe->node) {
- if (sxe->document) {
- php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement((xmlDocPtr) sxe->document->ptr), NULL TSRMLS_CC);
- }
- }
-
- if (sxe->node && sxe->node->node) {
- if (sxe->node->node->children) {
- contents = xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, sxe->node->node->children, 1);
- }
- }
- }
-
- rv = cast_object(writeobj, type, (char *)contents TSRMLS_CC);
-
- if (contents) {
- xmlFree(contents);
- }
- return rv;
-}
-/* }}} */
-
-static int sxe_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */
-{
- php_sxe_object *sxe;
- xmlNodePtr node;
- zval *data;
-
- *count = 0;
- sxe = php_sxe_fetch_object(object TSRMLS_CC);
-
- data = sxe->iter.data;
- sxe->iter.data = NULL;
-
- node = php_sxe_reset_iterator(sxe, 0 TSRMLS_CC);
-
- while (node)
- {
- (*count)++;
- node = php_sxe_iterator_fetch(sxe, node->next, 0 TSRMLS_CC);
- }
-
- if (sxe->iter.data) {
- zval_ptr_dtor(&sxe->iter.data);
- }
- sxe->iter.data = data;
-
- return SUCCESS;
-}
-/* }}} */
-
-static zval *sxe_get_value(zval *z TSRMLS_DC)
-{
- zval *retval;
-
- MAKE_STD_ZVAL(retval);
-
- if (sxe_object_cast(z, retval, IS_STRING TSRMLS_CC)==FAILURE) {
- zend_error(E_ERROR, "Unable to cast node to string");
- /* FIXME: Should not be fatal */
- }
-
- retval->refcount = 0;
- return retval;
-}
-
-
-static zend_object_handlers sxe_object_handlers = {
- ZEND_OBJECTS_STORE_HANDLERS,
- sxe_property_read,
- sxe_property_write,
- sxe_dimension_read,
- sxe_dimension_write,
- sxe_property_get_adr,
- sxe_get_value, /* get */
- NULL,
- sxe_property_exists,
- sxe_property_delete,
- sxe_dimension_exists,
- sxe_dimension_delete,
- sxe_properties_get,
- NULL, /* zend_get_std_object_handlers()->get_method,*/
- NULL, /* zend_get_std_object_handlers()->call_method,*/
- NULL, /* zend_get_std_object_handlers()->get_constructor, */
- NULL, /* zend_get_std_object_handlers()->get_class_entry,*/
- NULL, /* zend_get_std_object_handlers()->get_class_name,*/
- sxe_objects_compare,
- sxe_object_cast,
- sxe_count_elements
-};
-
-static zend_object_handlers sxe_ze1_object_handlers = {
- ZEND_OBJECTS_STORE_HANDLERS,
- sxe_property_read,
- sxe_property_write,
- sxe_dimension_read,
- sxe_dimension_write,
- sxe_property_get_adr,
- sxe_get_value, /* get */
- NULL,
- sxe_property_exists,
- sxe_property_delete,
- sxe_dimension_exists,
- sxe_dimension_delete,
- sxe_properties_get,
- NULL, /* zend_get_std_object_handlers()->get_method,*/
- NULL, /* zend_get_std_object_handlers()->call_method,*/
- NULL, /* zend_get_std_object_handlers()->get_constructor, */
- NULL, /* zend_get_std_object_handlers()->get_class_entry,*/
- NULL, /* zend_get_std_object_handlers()->get_class_name,*/
- sxe_objects_compare,
- sxe_object_cast,
- sxe_count_elements
-};
-
-static zend_object_value sxe_object_ze1_clone(zval *zobject TSRMLS_DC)
-{
- php_error(E_ERROR, "Cannot clone object of class %s due to 'zend.ze1_compatibility_mode'", Z_OBJCE_P(zobject)->name);
- /* Return zobject->value.obj just to satisfy compiler */
- /* FIXME: Should not be a fatal */
- return zobject->value.obj;
-}
-
-/* {{{ sxe_object_clone()
- */
-static void
-sxe_object_clone(void *object, void **clone_ptr TSRMLS_DC)
-{
- php_sxe_object *sxe = (php_sxe_object *) object;
- php_sxe_object *clone;
- xmlNodePtr nodep = NULL;
- xmlDocPtr docp = NULL;
-
- clone = php_sxe_object_new(sxe->zo.ce TSRMLS_CC);
- clone->document = sxe->document;
- if (clone->document) {
- clone->document->refcount++;
- docp = clone->document->ptr;
- }
- if (sxe->node) {
- nodep = xmlDocCopyNode(sxe->node->node, docp, 1);
- }
-
- php_libxml_increment_node_ptr((php_libxml_node_object *)clone, nodep, NULL TSRMLS_CC);
-
- *clone_ptr = (void *) clone;
-}
-/* }}} */
-
-/* {{{ sxe_object_dtor()
- */
-static void sxe_object_dtor(void *object, zend_object_handle handle TSRMLS_DC)
-{
- /* dtor required to cleanup iterator related data properly */
-
- php_sxe_object *sxe;
-
- sxe = (php_sxe_object *) object;
-
- if (sxe->iter.data) {
- zval_ptr_dtor(&sxe->iter.data);
- sxe->iter.data = NULL;
- }
-
- if (sxe->iter.name) {
- xmlFree(sxe->iter.name);
- sxe->iter.name = NULL;
- }
- if (sxe->iter.nsprefix) {
- xmlFree(sxe->iter.nsprefix);
- sxe->iter.nsprefix = NULL;
- }
- if (sxe->tmp) {
- zval_ptr_dtor(&sxe->tmp);
- sxe->tmp = NULL;
- }
-}
-/* }}} */
-
-/* {{{ sxe_object_free_storage()
- */
-static void sxe_object_free_storage(void *object TSRMLS_DC)
-{
- php_sxe_object *sxe;
-
- sxe = (php_sxe_object *) object;
-
-#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 && PHP_RELEASE_VERSION > 2) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
- zend_object_std_dtor(&sxe->zo TSRMLS_CC);
-#else
- if (sxe->zo.guards) {
- zend_hash_destroy(sxe->zo.guards);
- FREE_HASHTABLE(sxe->zo.guards);
- }
-
- if (sxe->zo.properties) {
- zend_hash_destroy(sxe->zo.properties);
- FREE_HASHTABLE(sxe->zo.properties);
- }
-#endif
-
- php_libxml_node_decrement_resource((php_libxml_node_object *)sxe TSRMLS_CC);
-
- if (sxe->xpath) {
- xmlXPathFreeContext(sxe->xpath);
- }
-
- if (sxe->properties) {
- zend_hash_destroy(sxe->properties);
- FREE_HASHTABLE(sxe->properties);
- }
-
- efree(object);
-}
-/* }}} */
-
-/* {{{ php_sxe_object_new()
- */
-static php_sxe_object* php_sxe_object_new(zend_class_entry *ce TSRMLS_DC)
-{
- php_sxe_object *intern;
-
- intern = ecalloc(1, sizeof(php_sxe_object));
-
- intern->iter.type = SXE_ITER_NONE;
- intern->iter.nsprefix = NULL;
- intern->iter.name = NULL;
-
-#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 && PHP_RELEASE_VERSION > 2) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
- zend_object_std_init(&intern->zo, ce TSRMLS_CC);
-#else
- ALLOC_HASHTABLE(intern->zo.properties);
- zend_hash_init(intern->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- intern->zo.ce = ce;
- intern->zo.guards = NULL;
-#endif
-
- return intern;
-}
-/* }}} */
-
-/* {{{ php_sxe_register_object
- */
-static zend_object_value
-php_sxe_register_object(php_sxe_object *intern TSRMLS_DC)
-{
- zend_object_value rv;
-
- rv.handle = zend_objects_store_put(intern, sxe_object_dtor, (zend_objects_free_object_storage_t)sxe_object_free_storage, sxe_object_clone TSRMLS_CC);
- if (EG(ze1_compatibility_mode)) {
- rv.handlers = (zend_object_handlers *) &sxe_ze1_object_handlers;
- } else {
- rv.handlers = (zend_object_handlers *) &sxe_object_handlers;
- }
-
- return rv;
-}
-/* }}} */
-
-/* {{{ sxe_object_new()
- */
-ZEND_API zend_object_value
-sxe_object_new(zend_class_entry *ce TSRMLS_DC)
-{
- php_sxe_object *intern;
-
- intern = php_sxe_object_new(ce TSRMLS_CC);
- return php_sxe_register_object(intern TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto simplemxml_element simplexml_load_file(string filename [, string class_name [, int options [, string ns [, bool is_prefix]]]])
- Load a filename and return a simplexml_element object to allow for processing */
-PHP_FUNCTION(simplexml_load_file)
-{
- php_sxe_object *sxe;
- char *filename;
- int filename_len;
- xmlDocPtr docp;
- char *ns = NULL;
- int ns_len = 0;
- long options = 0;
- zend_class_entry *ce= sxe_class_entry;
- zend_bool isprefix = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|C!lsb", &filename, &filename_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) {
- return;
- }
-
- docp = xmlReadFile(filename, NULL, options);
-
- if (! docp) {
- RETURN_FALSE;
- }
-
- if (!ce) {
- ce = sxe_class_entry;
- }
- sxe = php_sxe_object_new(ce TSRMLS_CC);
- sxe->iter.nsprefix = ns_len ? xmlStrdup((xmlChar *)ns) : NULL;
- sxe->iter.isprefix = isprefix;
- php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp TSRMLS_CC);
- php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement(docp), NULL TSRMLS_CC);
-
- return_value->type = IS_OBJECT;
- return_value->value.obj = php_sxe_register_object(sxe TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto simplemxml_element simplexml_load_string(string data [, string class_name [, int options [, string ns [, bool is_prefix]]]])
- Load a string and return a simplexml_element object to allow for processing */
-PHP_FUNCTION(simplexml_load_string)
-{
- php_sxe_object *sxe;
- char *data;
- int data_len;
- xmlDocPtr docp;
- char *ns = NULL;
- int ns_len = 0;
- long options = 0;
- zend_class_entry *ce= sxe_class_entry;
- zend_bool isprefix = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|C!lsb", &data, &data_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) {
- return;
- }
-
- docp = xmlReadMemory(data, data_len, NULL, NULL, options);
-
- if (! docp) {
- RETURN_FALSE;
- }
-
- if (!ce) {
- ce = sxe_class_entry;
- }
- sxe = php_sxe_object_new(ce TSRMLS_CC);
- sxe->iter.nsprefix = ns_len ? xmlStrdup((xmlChar *)ns) : NULL;
- sxe->iter.isprefix = isprefix;
- php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp TSRMLS_CC);
- php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement(docp), NULL TSRMLS_CC);
-
- return_value->type = IS_OBJECT;
- return_value->value.obj = php_sxe_register_object(sxe TSRMLS_CC);
-}
-/* }}} */
-
-
-/* {{{ proto SimpleXMLElement::__construct(string data [, int options [, bool data_is_url [, string ns [, bool is_prefix]]]])
- SimpleXMLElement constructor */
-SXE_METHOD(__construct)
-{
- php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
- char *data, *ns = NULL;
- int data_len, ns_len = 0;
- xmlDocPtr docp;
- long options = 0;
- zend_bool is_url = 0, isprefix = 0;
-
- php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lbsb", &data, &data_len, &options, &is_url, &ns, &ns_len, &isprefix) == FAILURE) {
- php_std_error_handling();
- return;
- }
-
- php_std_error_handling();
-
- docp = is_url ? xmlReadFile(data, NULL, options) : xmlReadMemory(data, data_len, NULL, NULL, options);
-
- if (!docp) {
- ((php_libxml_node_object *)sxe)->document = NULL;
- zend_throw_exception(zend_exception_get_default(TSRMLS_C), "String could not be parsed as XML", 0 TSRMLS_CC);
- return;
- }
-
- sxe->iter.nsprefix = ns_len ? xmlStrdup((xmlChar *)ns) : NULL;
- sxe->iter.isprefix = isprefix;
- php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp TSRMLS_CC);
- php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement(docp), NULL TSRMLS_CC);
-}
-/* }}} */
-
-
-static void php_sxe_iterator_dtor(zend_object_iterator *iter TSRMLS_DC);
-static int php_sxe_iterator_valid(zend_object_iterator *iter TSRMLS_DC);
-static void php_sxe_iterator_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC);
-static int php_sxe_iterator_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC);
-static void php_sxe_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC);
-static void php_sxe_iterator_rewind(zend_object_iterator *iter TSRMLS_DC);
-
-zend_object_iterator_funcs php_sxe_iterator_funcs = {
- php_sxe_iterator_dtor,
- php_sxe_iterator_valid,
- php_sxe_iterator_current_data,
- php_sxe_iterator_current_key,
- php_sxe_iterator_move_forward,
- php_sxe_iterator_rewind,
-};
-
-static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data TSRMLS_DC)
-{
- xmlChar *prefix = sxe->iter.nsprefix;
- int isprefix = sxe->iter.isprefix;
- int test_elem = sxe->iter.type == SXE_ITER_ELEMENT && sxe->iter.name;
- int test_attr = sxe->iter.type == SXE_ITER_ATTRLIST && sxe->iter.name;
-
- while (node) {
- SKIP_TEXT(node);
- if (sxe->iter.type != SXE_ITER_ATTRLIST && node->type == XML_ELEMENT_NODE) {
- if ((!test_elem || !xmlStrcmp(node->name, sxe->iter.name)) && match_ns(sxe, node, prefix, isprefix)) {
- break;
- }
- } else if (node->type == XML_ATTRIBUTE_NODE) {
- if ((!test_attr || !xmlStrcmp(node->name, sxe->iter.name)) && match_ns(sxe, node, prefix, isprefix)) {
- break;
- }
- }
-next_iter:
- node = node->next;
- }
-
- if (node && use_data) {
- ALLOC_INIT_ZVAL(sxe->iter.data);
- _node_as_zval(sxe, node, sxe->iter.data, SXE_ITER_NONE, NULL, prefix, isprefix TSRMLS_CC);
- }
-
- return node;
-}
-
-static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data TSRMLS_DC)
-{
- xmlNodePtr node;
-
- if (sxe->iter.data) {
- zval_ptr_dtor(&sxe->iter.data);
- sxe->iter.data = NULL;
- }
-
- GET_NODE(sxe, node)
-
- if (node) {
- switch (sxe->iter.type) {
- case SXE_ITER_ELEMENT:
- case SXE_ITER_CHILD:
- case SXE_ITER_NONE:
- node = node->children;
- break;
- case SXE_ITER_ATTRLIST:
- node = (xmlNodePtr) node->properties;
- }
- return php_sxe_iterator_fetch(sxe, node, use_data TSRMLS_CC);
- }
- return NULL;
-}
-
-zend_object_iterator *php_sxe_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC)
-{
- php_sxe_iterator *iterator;
-
- if (by_ref) {
- zend_error(E_ERROR, "An iterator cannot be used with foreach by reference");
- }
- iterator = emalloc(sizeof(php_sxe_iterator));
-
- object->refcount++;
- iterator->intern.data = (void*)object;
- iterator->intern.funcs = &php_sxe_iterator_funcs;
- iterator->sxe = php_sxe_fetch_object(object TSRMLS_CC);
-
- return (zend_object_iterator*)iterator;
-}
-
-static void php_sxe_iterator_dtor(zend_object_iterator *iter TSRMLS_DC)
-{
- php_sxe_iterator *iterator = (php_sxe_iterator *)iter;
-
- /* cleanup handled in sxe_object_dtor as we dont always have an iterator wrapper */
- if (iterator->intern.data) {
- zval_ptr_dtor((zval**)&iterator->intern.data);
- }
-
- efree(iterator);
-}
-
-static int php_sxe_iterator_valid(zend_object_iterator *iter TSRMLS_DC)
-{
- php_sxe_iterator *iterator = (php_sxe_iterator *)iter;
-
- return iterator->sxe->iter.data ? SUCCESS : FAILURE;
-}
-
-static void php_sxe_iterator_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
-{
- php_sxe_iterator *iterator = (php_sxe_iterator *)iter;
-
- *data = &iterator->sxe->iter.data;
-}
-
-static int php_sxe_iterator_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
-{
- zval *curobj;
- xmlNodePtr curnode = NULL;
- php_sxe_object *intern;
- int namelen;
-
- php_sxe_iterator *iterator = (php_sxe_iterator *)iter;
- curobj = iterator->sxe->iter.data;
-
- intern = (php_sxe_object *)zend_object_store_get_object(curobj TSRMLS_CC);
- if (intern != NULL && intern->node != NULL) {
- curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->node)->node;
- }
- if (!curnode) {
- return HASH_KEY_NON_EXISTANT;
- }
-
- namelen = xmlStrlen(curnode->name);
- *str_key = estrndup((char *)curnode->name, namelen);
- *str_key_len = namelen + 1;
- return HASH_KEY_IS_STRING;
-
-}
-
-ZEND_API void php_sxe_move_forward_iterator(php_sxe_object *sxe TSRMLS_DC)
-{
- xmlNodePtr node = NULL;
- php_sxe_object *intern;
-
- if (sxe->iter.data) {
- intern = (php_sxe_object *)zend_object_store_get_object(sxe->iter.data TSRMLS_CC);
- GET_NODE(intern, node)
- zval_ptr_dtor(&sxe->iter.data);
- sxe->iter.data = NULL;
- }
-
- if (node) {
- php_sxe_iterator_fetch(sxe, node->next, 1 TSRMLS_CC);
- }
-}
-
-static void php_sxe_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
-{
- php_sxe_iterator *iterator = (php_sxe_iterator *)iter;
- php_sxe_move_forward_iterator(iterator->sxe TSRMLS_CC);
-}
-
-static void php_sxe_iterator_rewind(zend_object_iterator *iter TSRMLS_DC)
-{
- php_sxe_object *sxe;
-
- php_sxe_iterator *iterator = (php_sxe_iterator *)iter;
- sxe = iterator->sxe;
-
- php_sxe_reset_iterator(sxe, 1 TSRMLS_CC);
-}
-
-void *simplexml_export_node(zval *object TSRMLS_DC)
-{
- php_sxe_object *sxe;
- xmlNodePtr node;
-
- sxe = php_sxe_fetch_object(object TSRMLS_CC);
- GET_NODE(sxe, node);
- return php_sxe_get_first_node(sxe, node TSRMLS_CC);
-}
-
-/* {{{ proto simplemxml_element simplexml_import_dom(domNode node [, string class_name])
- Get a simplexml_element object from dom to allow for processing */
-PHP_FUNCTION(simplexml_import_dom)
-{
- php_sxe_object *sxe;
- zval *node;
- php_libxml_node_object *object;
- xmlNodePtr nodep = NULL;
- zend_class_entry *ce= sxe_class_entry;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|C!", &node, &ce) == FAILURE) {
- return;
- }
-
- object = (php_libxml_node_object *)zend_object_store_get_object(node TSRMLS_CC);
-
- nodep = php_libxml_import_node(node TSRMLS_CC);
-
- if (nodep) {
- if (nodep->doc == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Imported Node must have associated Document");
- RETURN_NULL();
- }
- if (nodep->type == XML_DOCUMENT_NODE || nodep->type == XML_HTML_DOCUMENT_NODE) {
- nodep = xmlDocGetRootElement((xmlDocPtr) nodep);
- }
- }
-
- if (nodep && nodep->type == XML_ELEMENT_NODE) {
- if (!ce) {
- ce = sxe_class_entry;
- }
- sxe = php_sxe_object_new(ce TSRMLS_CC);
- sxe->document = object->document;
- php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, nodep->doc TSRMLS_CC);
- php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, nodep, NULL TSRMLS_CC);
-
- return_value->type = IS_OBJECT;
- return_value->value.obj = php_sxe_register_object(sxe TSRMLS_CC);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Nodetype to import");
- RETVAL_NULL();
- }
-}
-/* }}} */
-
-zend_function_entry simplexml_functions[] = {
- PHP_FE(simplexml_load_file, NULL)
- PHP_FE(simplexml_load_string, NULL)
- PHP_FE(simplexml_import_dom, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_module_dep simplexml_deps[] = {
- ZEND_MOD_REQUIRED("libxml")
- {NULL, NULL, NULL}
-};
-
-zend_module_entry simplexml_module_entry = {
- STANDARD_MODULE_HEADER_EX, NULL,
- simplexml_deps,
- "SimpleXML",
- simplexml_functions,
- PHP_MINIT(simplexml),
- PHP_MSHUTDOWN(simplexml),
- NULL,
- NULL,
- PHP_MINFO(simplexml),
- "0.1",
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_SIMPLEXML
-ZEND_GET_MODULE(simplexml)
-#endif
-
-/* the method table */
-/* each method can have its own parameters and visibility */
-static zend_function_entry sxe_functions[] = {
- SXE_ME(__construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) /* must be called */
- SXE_ME(asXML, NULL, ZEND_ACC_PUBLIC)
- SXE_MALIAS(saveXML, asXML, NULL, ZEND_ACC_PUBLIC)
- SXE_ME(xpath, NULL, ZEND_ACC_PUBLIC)
- SXE_ME(registerXPathNamespace, NULL, ZEND_ACC_PUBLIC)
- SXE_ME(attributes, NULL, ZEND_ACC_PUBLIC)
- SXE_ME(children, NULL, ZEND_ACC_PUBLIC)
- SXE_ME(getNamespaces, NULL, ZEND_ACC_PUBLIC)
- SXE_ME(getDocNamespaces, NULL, ZEND_ACC_PUBLIC)
- SXE_ME(getName, NULL, ZEND_ACC_PUBLIC)
- SXE_ME(addChild, NULL, ZEND_ACC_PUBLIC)
- SXE_ME(addAttribute, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-/* {{{ PHP_MINIT_FUNCTION(simplexml)
- */
-PHP_MINIT_FUNCTION(simplexml)
-{
- zend_class_entry sxe;
-
- INIT_CLASS_ENTRY(sxe, "SimpleXMLElement", sxe_functions);
- sxe.create_object = sxe_object_new;
- sxe_class_entry = zend_register_internal_class(&sxe TSRMLS_CC);
- sxe_class_entry->get_iterator = php_sxe_get_iterator;
- sxe_class_entry->iterator_funcs.funcs = &php_sxe_iterator_funcs;
- zend_class_implements(sxe_class_entry TSRMLS_CC, 1, zend_ce_traversable);
- sxe_object_handlers.get_method = zend_get_std_object_handlers()->get_method;
- sxe_object_handlers.get_constructor = zend_get_std_object_handlers()->get_constructor;
- sxe_object_handlers.get_class_entry = zend_get_std_object_handlers()->get_class_entry;
- sxe_object_handlers.get_class_name = zend_get_std_object_handlers()->get_class_name;
-
- sxe_ze1_object_handlers.get_method = zend_get_std_object_handlers()->get_method;
- sxe_ze1_object_handlers.get_constructor = zend_get_std_object_handlers()->get_constructor;
- sxe_ze1_object_handlers.get_class_entry = zend_get_std_object_handlers()->get_class_entry;
- sxe_ze1_object_handlers.get_class_name = zend_get_std_object_handlers()->get_class_name;
- sxe_ze1_object_handlers.clone_obj = sxe_object_ze1_clone;
-
-#ifdef HAVE_SPL
- if (zend_get_module_started("spl") == SUCCESS) {
- PHP_MINIT(spl_sxe)(INIT_FUNC_ARGS_PASSTHRU);
- }
-#endif /* HAVE_SPL */
-
- php_libxml_register_export(sxe_class_entry, simplexml_export_node);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION(simplexml)
- */
-PHP_MSHUTDOWN_FUNCTION(simplexml)
-{
- sxe_class_entry = NULL;
- return SUCCESS;
-}
-/* }}} */
-/* {{{ PHP_MINFO_FUNCTION(simplexml)
- */
-PHP_MINFO_FUNCTION(simplexml)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "Simplexml support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision$");
- php_info_print_table_row(2, "Schema support",
-#ifdef LIBXML_SCHEMAS_ENABLED
- "enabled");
-#else
- "not available");
-#endif
- php_info_print_table_end();
-}
-/* }}} */
-
-#endif
-
-/**
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: t
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/simplexml/simplexml.dsp b/ext/simplexml/simplexml.dsp
deleted file mode 100644
index 79df918703..0000000000
--- a/ext/simplexml/simplexml.dsp
+++ /dev/null
@@ -1,111 +0,0 @@
-# Microsoft Developer Studio Project File - Name="simplexml" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=simplexml - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "simplexml.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "simplexml.mak" CFG="simplexml - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "simplexml - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "simplexml - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "simplexml - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "c:\php\5d\extensions"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SIMPLEXML_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\php5" /I "..\..\..\php5\main" /I "..\..\..\php5\Zend" /I "..\..\..\php5\TSRM" /D ZEND_DEBUG=1 /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D COMPILE_DL_SIMPLEXML=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SIMPLEXML_EXPORTS" /D "LIBXML_THREAD_ENABLED" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\php5\Debug_TS"
-
-!ELSEIF "$(CFG)" == "simplexml - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SIMPLEXML_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\php5\main" /I "..\..\..\php5\Zend" /I "..\..\..\php5\TSRM" /I "..\..\..\php5\win32" /I "..\..\..\php5" /D ZTS=1 /D ZEND_DEBUG=0 /D "ZEND_WIN32" /D "PHP_WIN32" /D COMPILE_DL_SIMPLEXML=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SIMPLEXML_EXPORTS" /D "LIBXML_THREAD_ENABLED" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /libpath:"..\..\..\php5\Release_TS" /libpath:"..\..\..\php5\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "simplexml - Win32 Debug_TS"
-# Name "simplexml - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\simplexml.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_simplexml.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/simplexml/tests/000.phpt b/ext/simplexml/tests/000.phpt
deleted file mode 100755
index 51dbe3b5ec..0000000000
--- a/ext/simplexml/tests/000.phpt
+++ /dev/null
@@ -1,254 +0,0 @@
---TEST--
-SimpleXML: var_dump()
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$sxe = simplexml_load_file(dirname(__FILE__).'/000.xml');
-
-function test($what)
-{
- global $sxe;
- echo "===$what\n";
- eval("var_dump(isset(\$$what));");
- eval("var_dump((bool)\$$what);");
- eval("var_dump(count(\$$what));");
- eval("var_dump(\$$what);");
-}
-
-test('sxe');
-test('sxe->elem1');
-test('sxe->elem1[0]');
-test('sxe->elem1[0]->elem2');
-test('sxe->elem1[0]->elem2->bla');
-if (!ini_get("unicode_semantics")) test('sxe->elem1[0]["attr1"]');
-test('sxe->elem1[0]->attr1');
-test('sxe->elem1[1]');
-test('sxe->elem1[2]');
-test('sxe->elem11');
-test('sxe->elem11->elem111');
-test('sxe->elem11->elem111->elem1111');
-test('sxe->elem22');
-test('sxe->elem22->elem222');
-test('sxe->elem22->attr22');
-test('sxe->elem22["attr22"]');
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-===sxe
-bool(true)
-bool(true)
-int(3)
-object(SimpleXMLElement)#%d (3) {
- ["@attributes"]=>
- array(1) {
- ["id"]=>
- string(3) "123"
- }
- ["elem1"]=>
- array(2) {
- [0]=>
- string(36) "There is some text.Here is some more"
- [1]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(2) {
- ["attr1"]=>
- string(2) "11"
- ["attr2"]=>
- string(2) "12"
- }
- }
- }
- ["elem11"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem111"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem1111"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- }
- }
-}
-===sxe->elem1
-bool(true)
-bool(true)
-int(2)
-object(SimpleXMLElement)#%d (3) {
- ["@attributes"]=>
- array(2) {
- ["attr1"]=>
- string(5) "first"
- ["attr2"]=>
- string(6) "second"
- }
- ["comment"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- ["elem2"]=>
- object(SimpleXMLElement)#%d (2) {
- ["@attributes"]=>
- array(2) {
- ["att25"]=>
- string(2) "25"
- ["att42"]=>
- string(2) "42"
- }
- ["elem3"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem4"]=>
- object(SimpleXMLElement)#%d (1) {
- ["test"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- }
- }
- }
-}
-===sxe->elem1[0]
-bool(true)
-bool(true)
-int(1)
-object(SimpleXMLElement)#%d (3) {
- ["@attributes"]=>
- array(2) {
- ["attr1"]=>
- string(5) "first"
- ["attr2"]=>
- string(6) "second"
- }
- ["comment"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- ["elem2"]=>
- object(SimpleXMLElement)#%d (2) {
- ["@attributes"]=>
- array(2) {
- ["att25"]=>
- string(2) "25"
- ["att42"]=>
- string(2) "42"
- }
- ["elem3"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem4"]=>
- object(SimpleXMLElement)#%d (1) {
- ["test"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- }
- }
- }
-}
-===sxe->elem1[0]->elem2
-bool(true)
-bool(true)
-int(1)
-object(SimpleXMLElement)#%d (2) {
- ["@attributes"]=>
- array(2) {
- ["att25"]=>
- string(2) "25"
- ["att42"]=>
- string(2) "42"
- }
- ["elem3"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem4"]=>
- object(SimpleXMLElement)#%d (1) {
- ["test"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- }
- }
-}
-===sxe->elem1[0]->elem2->bla
-bool(false)
-bool(false)
-int(0)
-object(SimpleXMLElement)#%d (0) {
-}
-===sxe->elem1[0]["attr1"]
-bool(true)
-bool(true)
-int(0)
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(5) "first"
-}
-===sxe->elem1[0]->attr1
-bool(false)
-bool(false)
-int(0)
-object(SimpleXMLElement)#%d (0) {
-}
-===sxe->elem1[1]
-bool(true)
-bool(true)
-int(0)
-object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(2) {
- ["attr1"]=>
- string(2) "11"
- ["attr2"]=>
- string(2) "12"
- }
-}
-===sxe->elem1[2]
-bool(false)
-bool(false)
-int(0)
-NULL
-===sxe->elem11
-bool(true)
-bool(true)
-int(1)
-object(SimpleXMLElement)#%d (1) {
- ["elem111"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem1111"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- }
-}
-===sxe->elem11->elem111
-bool(true)
-bool(true)
-int(1)
-object(SimpleXMLElement)#%d (1) {
- ["elem1111"]=>
- object(SimpleXMLElement)#%d (0) {
- }
-}
-===sxe->elem11->elem111->elem1111
-bool(true)
-bool(true)
-int(1)
-object(SimpleXMLElement)#%d (0) {
-}
-===sxe->elem22
-bool(false)
-bool(false)
-int(0)
-object(SimpleXMLElement)#%d (0) {
-}
-===sxe->elem22->elem222
-bool(false)
-bool(false)
-int(0)
-NULL
-===sxe->elem22->attr22
-bool(false)
-bool(false)
-int(0)
-NULL
-===sxe->elem22["attr22"]
-bool(false)
-bool(false)
-int(0)
-NULL
-===DONE===
diff --git a/ext/simplexml/tests/000.xml b/ext/simplexml/tests/000.xml
deleted file mode 100755
index b0f2785463..0000000000
--- a/ext/simplexml/tests/000.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "sxe.dtd" [
-<!ENTITY % incent SYSTEM "sxe.ent">
-%incent;
-]>
-<sxe id="123">
- <elem1 attr1='first' attr2='second'>There is some text.<!-- comment --><elem2 att25='25' att42='42'>
- <elem3>
- <elem4>
- <?test processing instruction ?>
- </elem4>
- </elem3>
- </elem2>Here is some more</elem1>
- <elem1 attr1='11' attr2='12'/>
- <elem11><elem111><elem1111/></elem111></elem11>
-</sxe> \ No newline at end of file
diff --git a/ext/simplexml/tests/001.phpt b/ext/simplexml/tests/001.phpt
deleted file mode 100644
index 0be77710e5..0000000000
--- a/ext/simplexml/tests/001.phpt
+++ /dev/null
@@ -1,43 +0,0 @@
---TEST--
-SimpleXML: Simple document
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-var_dump(simplexml_load_file(dirname(__FILE__).'/sxe.xml'));
-
-?>
-===DONE===
---EXPECTF--
-object(SimpleXMLElement)#%d (2) {
- ["@attributes"]=>
- array(1) {
- ["id"]=>
- string(5) "elem1"
- }
- ["elem1"]=>
- object(SimpleXMLElement)#%d (3) {
- ["@attributes"]=>
- array(1) {
- ["attr1"]=>
- string(5) "first"
- }
- ["comment"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- ["elem2"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem3"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem4"]=>
- object(SimpleXMLElement)#%d (1) {
- ["test"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- }
- }
- }
- }
-}
-===DONE===
diff --git a/ext/simplexml/tests/002.phpt b/ext/simplexml/tests/002.phpt
deleted file mode 100644
index 4f1f6b6224..0000000000
--- a/ext/simplexml/tests/002.phpt
+++ /dev/null
@@ -1,64 +0,0 @@
---TEST--
-SimpleXML: clone
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- <elem1 attr1='first'>
- <!-- comment -->
- <elem2>
- <elem3>
- <elem4>
- <?test processing instruction ?>
- </elem4>
- </elem3>
- </elem2>
- </elem1>
-</sxe>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-$copy = clone $sxe;
-
-var_dump($copy);
-
-?>
-===DONE===
---EXPECTF--
-object(SimpleXMLElement)#%d (2) {
- ["@attributes"]=>
- array(1) {
- ["id"]=>
- string(5) "elem1"
- }
- ["elem1"]=>
- object(SimpleXMLElement)#%d (3) {
- ["@attributes"]=>
- array(1) {
- ["attr1"]=>
- string(5) "first"
- }
- ["comment"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- ["elem2"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem3"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem4"]=>
- object(SimpleXMLElement)#%d (1) {
- ["test"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- }
- }
- }
- }
-}
-===DONE===
diff --git a/ext/simplexml/tests/003.phpt b/ext/simplexml/tests/003.phpt
deleted file mode 100755
index 105f616d60..0000000000
--- a/ext/simplexml/tests/003.phpt
+++ /dev/null
@@ -1,69 +0,0 @@
---TEST--
-SimpleXML: Entities
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd" [
-<!ENTITY included-entity "This is text included from an entity">
-]>
-<sxe id="elem1">
- Plain text.
- <elem1 attr1='first'>
- <!-- comment -->
- <elem2>
- <elem3>
- &included-entity;
- <elem4>
- <?test processing instruction ?>
- </elem4>
- </elem3>
- </elem2>
- </elem1>
-</sxe>
-EOF;
-
-var_dump(simplexml_load_string($xml));
-
-?>
-===DONE===
---EXPECTF--
-object(SimpleXMLElement)#%d (2) {
- ["@attributes"]=>
- array(1) {
- ["id"]=>
- string(5) "elem1"
- }
- ["elem1"]=>
- object(SimpleXMLElement)#%d (3) {
- ["@attributes"]=>
- array(1) {
- ["attr1"]=>
- string(5) "first"
- }
- ["comment"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- ["elem2"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem3"]=>
- object(SimpleXMLElement)#%d (2) {
- ["included-entity"]=>
- object(SimpleXMLElement)#%d (1) {
- ["included-entity"]=>
- string(36) "This is text included from an entity"
- }
- ["elem4"]=>
- object(SimpleXMLElement)#%d (1) {
- ["test"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- }
- }
- }
- }
-}
-===DONE===
diff --git a/ext/simplexml/tests/004.phpt b/ext/simplexml/tests/004.phpt
deleted file mode 100755
index 21cb5469e0..0000000000
--- a/ext/simplexml/tests/004.phpt
+++ /dev/null
@@ -1,68 +0,0 @@
---TEST--
-SimpleXML: CDATA
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$sxe = simplexml_load_string(<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- Plain text.
- <elem1 attr1='first'>
- <!-- comment -->
- <elem2>
- <![CDATA[CDATA block]]>
- <elem3>
- <elem4>
- <?test processing instruction ?>
- </elem4>
- </elem3>
- </elem2>
- </elem1>
-</sxe>
-EOF
-);
-
-var_dump($sxe);
-
-$elem1 = $sxe->elem1;
-$elem2 = $elem1->elem2;
-var_dump(trim((string)$elem2));
-
-?>
-===DONE===
---EXPECTF--
-object(SimpleXMLElement)#%d (2) {
- ["@attributes"]=>
- array(1) {
- ["id"]=>
- string(5) "elem1"
- }
- ["elem1"]=>
- object(SimpleXMLElement)#%d (3) {
- ["@attributes"]=>
- array(1) {
- ["attr1"]=>
- string(5) "first"
- }
- ["comment"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- ["elem2"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem3"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem4"]=>
- object(SimpleXMLElement)#%d (1) {
- ["test"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- }
- }
- }
- }
-}
-string(11) "CDATA block"
-===DONE===
diff --git a/ext/simplexml/tests/005.phpt b/ext/simplexml/tests/005.phpt
deleted file mode 100755
index 1411065435..0000000000
--- a/ext/simplexml/tests/005.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-SimpleXML: Text data
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$sxe = simplexml_load_string(<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- Plain text.
- <elem1 attr1='first'>
- <!-- comment -->
- <elem2>
- Here we have some text data.
- <elem3>
- And here some more.
- <elem4>
- Wow once again.
- </elem4>
- </elem3>
- </elem2>
- </elem1>
-</sxe>
-EOF
-);
-
-var_dump(trim($sxe->elem1->elem2));
-var_dump(trim($sxe->elem1->elem2->elem3));
-var_dump(trim($sxe->elem1->elem2->elem3->elem4));
-
-echo "---Done---\n";
-
-?>
---EXPECT--
-string(28) "Here we have some text data."
-string(19) "And here some more."
-string(15) "Wow once again."
----Done---
diff --git a/ext/simplexml/tests/006.phpt b/ext/simplexml/tests/006.phpt
deleted file mode 100755
index 72ad0c8089..0000000000
--- a/ext/simplexml/tests/006.phpt
+++ /dev/null
@@ -1,80 +0,0 @@
---TEST--
-SimpleXML: foreach
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$sxe = simplexml_load_string(<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- Plain text.
- <elem1 attr1='first'>
- Bla bla 1.
- <!-- comment -->
- <elem2>
- Here we have some text data.
- <elem3>
- And here some more.
- <elem4>
- Wow once again.
- </elem4>
- </elem3>
- </elem2>
- </elem1>
- <elem11 attr2='second'>
- Bla bla 2.
- <elem111>
- Foo Bar
- </elem111>
- </elem11>
-</sxe>
-EOF
-);
-
-foreach($sxe as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
-}
-
-echo "===CLONE===\n";
-
-foreach(clone $sxe as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
-}
-
-echo "===ELEMENT===\n";
-
-foreach($sxe->elem11 as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
-}
-
-echo "===COMMENT===\n";
-
-foreach($sxe->elem1 as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
-}
-
-?>
-===DONE===
---EXPECT--
-string(5) "elem1"
-string(10) "Bla bla 1."
-string(6) "elem11"
-string(10) "Bla bla 2."
-===CLONE===
-string(5) "elem1"
-string(10) "Bla bla 1."
-string(6) "elem11"
-string(10) "Bla bla 2."
-===ELEMENT===
-string(6) "elem11"
-string(10) "Bla bla 2."
-===COMMENT===
-string(5) "elem1"
-string(10) "Bla bla 1."
-===DONE===
diff --git a/ext/simplexml/tests/007.phpt b/ext/simplexml/tests/007.phpt
deleted file mode 100755
index 51d7a847f7..0000000000
--- a/ext/simplexml/tests/007.phpt
+++ /dev/null
@@ -1,97 +0,0 @@
---TEST--
-SimpleXML: Attributes
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- <elem1 attr1='first'>
- <!-- comment -->
- <elem2>
- <elem3>
- <elem4>
- <?test processing instruction ?>
- </elem4>
- </elem3>
- </elem2>
- </elem1>
-</sxe>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-echo "===Property===\n";
-var_dump($sxe->elem1);
-echo "===Array===\n";
-var_dump($sxe['id']);
-var_dump($sxe->elem1['attr1']);
-echo "===Set===\n";
-$sxe['id'] = "Changed1";
-var_dump($sxe['id']);
-$sxe->elem1['attr1'] = 12;
-var_dump($sxe->elem1['attr1']);
-echo "===Unset===\n";
-unset($sxe['id']);
-var_dump($sxe['id']);
-unset($sxe->elem1['attr1']);
-var_dump($sxe->elem1['attr1']);
-echo "===Misc.===\n";
-$a = 4;
-var_dump($a);
-$dummy = $sxe->elem1[$a];
-var_dump($a);
-?>
-===Done===
---EXPECTF--
-===Property===
-object(SimpleXMLElement)#%d (3) {
- ["@attributes"]=>
- array(1) {
- ["attr1"]=>
- string(5) "first"
- }
- ["comment"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- ["elem2"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem3"]=>
- object(SimpleXMLElement)#%d (1) {
- ["elem4"]=>
- object(SimpleXMLElement)#%d (1) {
- ["test"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- }
- }
- }
-}
-===Array===
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(5) "elem1"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(5) "first"
-}
-===Set===
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(8) "Changed1"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(2) "12"
-}
-===Unset===
-NULL
-NULL
-===Misc.===
-int(4)
-int(4)
-===Done===
diff --git a/ext/simplexml/tests/008.phpt b/ext/simplexml/tests/008.phpt
deleted file mode 100644
index 4fda204a2f..0000000000
--- a/ext/simplexml/tests/008.phpt
+++ /dev/null
@@ -1,39 +0,0 @@
---TEST--
-SimpleXML: XPath
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- <elem1 attr1='first'>
- <!-- comment -->
- <elem2>
- <elem3>
- <elem4>
- <?test processing instruction ?>
- </elem4>
- </elem3>
- </elem2>
- </elem1>
-</sxe>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-var_dump($sxe->xpath("elem1/elem2/elem3/elem4"));
-var_dump($sxe->xpath("***"));
-?>
---EXPECTF--
-array(1) {
- [0]=>
- object(SimpleXMLElement)#%d (1) {
- ["test"]=>
- object(SimpleXMLElement)#%d (0) {
- }
- }
-}
-bool(false)
diff --git a/ext/simplexml/tests/009.phpt b/ext/simplexml/tests/009.phpt
deleted file mode 100755
index a76f3d1116..0000000000
--- a/ext/simplexml/tests/009.phpt
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-SimpleXML: foreach
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$sxe = simplexml_load_string(<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- Plain text.
- <elem1 attr1='first'>
- Bla bla 1.
- <!-- comment -->
- <elem2>
- Here we have some text data.
- <elem3>
- And here some more.
- <elem4>
- Wow once again.
- </elem4>
- </elem3>
- </elem2>
- </elem1>
- <elem11 attr2='second'>
- Bla bla 2.
- </elem11>
-</sxe>
-EOF
-);
-foreach($sxe->children() as $name=>$val) {
- var_dump($name);
- var_dump(get_class($val));
- var_dump(trim($val));
-}
-?>
-===DONE===
---EXPECT--
-string(5) "elem1"
-string(16) "SimpleXMLElement"
-string(10) "Bla bla 1."
-string(6) "elem11"
-string(16) "SimpleXMLElement"
-string(10) "Bla bla 2."
-===DONE===
diff --git a/ext/simplexml/tests/009b.phpt b/ext/simplexml/tests/009b.phpt
deleted file mode 100755
index dba300c72f..0000000000
--- a/ext/simplexml/tests/009b.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-SimpleXML: foreach
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$sxe = simplexml_load_string(<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- Plain text.
- <elem1 attr1='first'>Bla bla 1.<!-- comment --><elem2>
- Here we have some text data.
- </elem2></elem1>
- <elem11 attr2='second'>Bla bla 2.</elem11>
-</sxe>
-EOF
-);
-var_dump($sxe->children());
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-object(SimpleXMLElement)#%d (3) {
- ["@attributes"]=>
- array(1) {
- ["id"]=>
- string(5) "elem1"
- }
- ["elem1"]=>
- string(10) "Bla bla 1."
- ["elem11"]=>
- string(10) "Bla bla 2."
-}
-===DONE===
diff --git a/ext/simplexml/tests/010.phpt b/ext/simplexml/tests/010.phpt
deleted file mode 100644
index 267780905b..0000000000
--- a/ext/simplexml/tests/010.phpt
+++ /dev/null
@@ -1,64 +0,0 @@
---TEST--
-SimpleXML: Simple Inheritance
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-class simplexml_inherited extends SimpleXMLElement
-{
-}
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- <elem1 attr1='first'>
- <!-- comment -->
- <elem2>
- <elem3>
- <elem4>
- <?test processing instruction ?>
- </elem4>
- </elem3>
- </elem2>
- </elem1>
-</sxe>
-EOF;
-
-var_dump(simplexml_load_string($xml, 'simplexml_inherited'));
-
-?>
-===DONE===
---EXPECTF--
-object(simplexml_inherited)#%d (2) {
- ["@attributes"]=>
- array(1) {
- ["id"]=>
- string(5) "elem1"
- }
- ["elem1"]=>
- object(simplexml_inherited)#%d (3) {
- ["@attributes"]=>
- array(1) {
- ["attr1"]=>
- string(5) "first"
- }
- ["comment"]=>
- object(simplexml_inherited)#%d (0) {
- }
- ["elem2"]=>
- object(simplexml_inherited)#%d (1) {
- ["elem3"]=>
- object(simplexml_inherited)#%d (1) {
- ["elem4"]=>
- object(simplexml_inherited)#%d (1) {
- ["test"]=>
- object(simplexml_inherited)#%d (0) {
- }
- }
- }
- }
- }
-}
-===DONE===
diff --git a/ext/simplexml/tests/011.phpt b/ext/simplexml/tests/011.phpt
deleted file mode 100755
index 74ea4705ca..0000000000
--- a/ext/simplexml/tests/011.phpt
+++ /dev/null
@@ -1,47 +0,0 @@
---TEST--
-SimpleXML: echo/print
---SKIPIF--
-<?php
- if (!extension_loaded('simplexml')) print 'skip';
-?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<foo>
- <bar>bar</bar>
- <baz>baz1</baz>
- <baz>baz2</baz>
-</foo>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-echo "===BAR===\n";
-echo $sxe->bar;
-echo "\n";
-
-echo "===BAZ===\n";
-echo $sxe->baz;
-echo "\n";
-
-echo "===BAZ0===\n";
-echo $sxe->baz[0];
-echo "\n";
-
-echo "===BAZ1===\n";
-print $sxe->baz[1];
-echo "\n";
-?>
-===DONE===
---EXPECT--
-===BAR===
-bar
-===BAZ===
-baz1
-===BAZ0===
-baz1
-===BAZ1===
-baz2
-===DONE===
diff --git a/ext/simplexml/tests/012.phpt b/ext/simplexml/tests/012.phpt
deleted file mode 100755
index 2fc9bec41e..0000000000
--- a/ext/simplexml/tests/012.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-SimpleXML: Attribute creation
---SKIPIF--
-<?php
- if (!extension_loaded('simplexml')) print 'skip';
-?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<foo/>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-
-$sxe[""] = "warning";
-$sxe["attr"] = "value";
-
-echo $sxe->asXML();
-
-$sxe["attr"] = "new value";
-
-echo $sxe->asXML();
-
-$sxe[] = "error";
-
-__HALT_COMPILER();
-?>
-===DONE===
---EXPECTF--
-
-Warning: main(): Cannot write or create unnamed attribute in %s012.php on line %d
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<foo attr="value"/>
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<foo attr="new value"/>
-
-Fatal error: main(): Cannot create unnamed attribute in %s012.php on line %d
diff --git a/ext/simplexml/tests/013.phpt b/ext/simplexml/tests/013.phpt
deleted file mode 100755
index 56c57dfbc2..0000000000
--- a/ext/simplexml/tests/013.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-SimpleXML: Split text content
---SKIPIF--
-<?php
- if (!extension_loaded('simplexml')) print 'skip';
-?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<foo>bar<baz/>bar</foo>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-var_dump((string)$sxe);
-
-?>
-===DONE===
---EXPECT--
-string(6) "barbar"
-===DONE===
diff --git a/ext/simplexml/tests/014.phpt b/ext/simplexml/tests/014.phpt
deleted file mode 100644
index d1d736e7b5..0000000000
--- a/ext/simplexml/tests/014.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-SimpleXML: adding/removing attributes (direct)
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<people>
- <person name="Joe"></person>
-</people>
-EOF;
-
-$people = simplexml_load_string($xml);
-var_dump($people->person['name']);
-var_dump($people->person['age']);
-$person = $people->person;
-$person['name'] = "XXX";
-var_dump($people->person['name']);
-$people->person['age'] = 30;
-var_dump($people->person['age']);
-echo "---Unset:---\n";
-unset($people->person['age']);
-echo "---Unset?---\n";
-var_dump($people->person['age']);
-var_dump(isset($people->person['age']));
-$people->person['age'] = 30;
-echo "---Unsupported---\n";
-var_dump($people->person['age']);
-$people->person['age'] += 5;
-var_dump($people->person['age']);
-?>
-===DONE===
---EXPECTF--
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(3) "Joe"
-}
-NULL
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(3) "XXX"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(2) "30"
-}
----Unset:---
----Unset?---
-NULL
-bool(false)
----Unsupported---
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(2) "30"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(2) "35"
-}
-===DONE===
diff --git a/ext/simplexml/tests/014a.phpt b/ext/simplexml/tests/014a.phpt
deleted file mode 100755
index 649828b4dd..0000000000
--- a/ext/simplexml/tests/014a.phpt
+++ /dev/null
@@ -1,56 +0,0 @@
---TEST--
-SimpleXML: adding/removing attributes (single)
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<people>
- <person name="Joe"></person>
-</people>
-EOF;
-
-$people = simplexml_load_string($xml);
-var_dump($people->person[0]['name']);
-var_dump($people->person[0]['age']);
-$person = $people->person[0];
-$person['name'] = "XXX";
-var_dump($people->person[0]['name']);
-$people->person[0]['age'] = 30;
-var_dump($people->person[0]['age']);
-echo "---Unset:---\n";
-unset($people->person[0]['age']);
-echo "---Unset?---\n";
-var_dump($people->person[0]['age']);
-var_dump(isset($people->person[0]['age']));
-echo "---Unsupported---\n";
-var_dump($people->person[0]['age']);
-$people->person['age'] += 5;
-var_dump($people->person[0]['age']);
-?>
-===DONE===
---EXPECTF--
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(3) "Joe"
-}
-NULL
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(3) "XXX"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(2) "30"
-}
----Unset:---
----Unset?---
-NULL
-bool(false)
----Unsupported---
-NULL
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(1) "5"
-}
-===DONE===
diff --git a/ext/simplexml/tests/014b.phpt b/ext/simplexml/tests/014b.phpt
deleted file mode 100755
index 034396751a..0000000000
--- a/ext/simplexml/tests/014b.phpt
+++ /dev/null
@@ -1,55 +0,0 @@
---TEST--
-SimpleXML: adding/removing attributes (second)
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<people>
- <person name="Joe"></person>
- <person name="Boe"></person>
-</people>
-EOF;
-
-$people = simplexml_load_string($xml);
-var_dump($people->person[0]['name']);
-var_dump($people->person[1]['age']);
-$person = $people->person[1];
-$person['name'] = "XXX";
-var_dump($people->person[1]['name']);
-$people->person[1]['age'] = 30;
-var_dump($people->person[1]['age']);
-echo "---Unset:---\n";
-unset($people->person[1]['age']);
-echo "---Unset?---\n";
-var_dump($people->person[1]['age']);
-var_dump(isset($people->person[1]['age']));
-echo "---Unsupported---\n";
-$people->person[1]['age'] += 5;
-var_dump($people->person[1]['age']);
-?>
-===DONE===
---EXPECTF--
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(3) "Joe"
-}
-NULL
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(3) "XXX"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(2) "30"
-}
----Unset:---
----Unset?---
-NULL
-bool(false)
----Unsupported---
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(1) "5"
-}
-===DONE===
diff --git a/ext/simplexml/tests/015.phpt b/ext/simplexml/tests/015.phpt
deleted file mode 100644
index 11e9cd55cd..0000000000
--- a/ext/simplexml/tests/015.phpt
+++ /dev/null
@@ -1,56 +0,0 @@
---TEST--
-SimpleXML: accessing singular subnode as array
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<people>
- <person name="Joe"></person>
-</people>
-EOF;
-
-$xml2 =<<<EOF
-<people>
- <person name="Joe"></person>
- <person name="Boe"></person>
-</people>
-EOF;
-
-$people = simplexml_load_string($xml);
-var_dump($people->person['name']);
-var_dump($people->person[0]['name']);
-//$people->person['name'] = "XXX";
-//var_dump($people->person['name']);
-//var_dump($people->person[0]['name']);
-//$people->person[0]['name'] = "YYY";
-//var_dump($people->person['name']);
-//var_dump($people->person[0]['name']);
-//unset($people->person[0]['name']);
-//var_dump($people->person['name']);
-//var_dump($people->person[0]['name']);
-//var_dump(isset($people->person['name']));
-//var_dump(isset($people->person[0]['name']));
-$people = simplexml_load_string($xml2);
-var_dump($people->person[0]['name']);
-var_dump($people->person[1]['name']);
-?>
-===DONE===
---EXPECTF--
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(3) "Joe"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(3) "Joe"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(3) "Joe"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(3) "Boe"
-}
-===DONE===
diff --git a/ext/simplexml/tests/016.phpt b/ext/simplexml/tests/016.phpt
deleted file mode 100644
index ab80a7a19a..0000000000
--- a/ext/simplexml/tests/016.phpt
+++ /dev/null
@@ -1,57 +0,0 @@
---TEST--
-SimpleXML: modifying attributes of singular subnode
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<people>
- <person name="Joe"></person>
-</people>
-EOF;
-
-$people = simplexml_load_string($xml);
-var_dump($people->person['name']);
-$people->person['name'] = $people->person['name'] . 'Foo';
-var_dump($people->person['name']);
-$people->person['name'] .= 'Bar';
-var_dump($people->person['name']);
-
-echo "---[0]---\n";
-
-$people = simplexml_load_string($xml);
-var_dump($people->person[0]['name']);
-$people->person[0]['name'] = $people->person[0]['name'] . 'Foo';
-var_dump($people->person[0]['name']);
-$people->person[0]['name'] .= 'Bar';
-var_dump($people->person[0]['name']);
-
-?>
-===DONE===
---EXPECTF--
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(3) "Joe"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(6) "JoeFoo"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(9) "JoeFooBar"
-}
----[0]---
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(3) "Joe"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(6) "JoeFoo"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(9) "JoeFooBar"
-}
-===DONE===
diff --git a/ext/simplexml/tests/016a.phpt b/ext/simplexml/tests/016a.phpt
deleted file mode 100755
index 9797e29305..0000000000
--- a/ext/simplexml/tests/016a.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-SimpleXML: concatenating attributes
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<people>
- <person name="Foo"></person>
-</people>
-EOF;
-
-$people = simplexml_load_string($xml);
-var_dump($people->person['name']);
-$people->person['name'] .= 'Bar';
-var_dump($people->person['name']);
-
-?>
-===DONE===
---EXPECTF--
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(3) "Foo"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(6) "FooBar"
-}
-===DONE===
diff --git a/ext/simplexml/tests/017.phpt b/ext/simplexml/tests/017.phpt
deleted file mode 100644
index 776b00c785..0000000000
--- a/ext/simplexml/tests/017.phpt
+++ /dev/null
@@ -1,86 +0,0 @@
---TEST--
-SimpleXML: iteration through subnodes
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<people>
- <person name="Joe">
- <child name="Ann" />
- <child name="Marray" />
- </person>
- <person name="Boe">
- <child name="Joe" />
- <child name="Ann" />
- </person>
-</people>
-EOF;
-$xml1 =<<<EOF
-<people>
- <person name="Joe">
- <child name="Ann" />
- </person>
-</people>
-EOF;
-
-function print_xml($xml) {
- foreach($xml->children() as $person) {
- echo "person: ".$person['name']."\n";
- foreach($person->children() as $child) {
- echo " child: ".$child['name']."\n";
- }
- }
-}
-
-function print_xml2($xml) {
- $persons = 2;
- for ($i=0;$i<$persons;$i++) {
- echo "person: ".$xml->person[$i]['name']."\n";
- $children = 2;
- for ($j=0;$j<$children;$j++) {
- echo " child: ".$xml->person[$i]->child[$j]['name']."\n";
- }
- }
-}
-
-echo "---11---\n";
-print_xml(simplexml_load_string($xml));
-echo "---12---\n";
-print_xml(simplexml_load_string($xml1));
-echo "---21---\n";
-print_xml2(simplexml_load_string($xml));
-echo "---22---\n";
-print_xml2(simplexml_load_string($xml1));
-?>
-===DONE===
---EXPECTF--
----11---
-person: Joe
- child: Ann
- child: Marray
-person: Boe
- child: Joe
- child: Ann
----12---
-person: Joe
- child: Ann
----21---
-person: Joe
- child: Ann
- child: Marray
-person: Boe
- child: Joe
- child: Ann
----22---
-person: Joe
- child: Ann
- child:
-person:
-
-Notice: Trying to get property of non-object in %s017.php on line %d
- child:
-
-Notice: Trying to get property of non-object in %s017.php on line %d
- child:
-===DONE===
diff --git a/ext/simplexml/tests/018.phpt b/ext/simplexml/tests/018.phpt
deleted file mode 100644
index e5c810944e..0000000000
--- a/ext/simplexml/tests/018.phpt
+++ /dev/null
@@ -1,65 +0,0 @@
---TEST--
-SimpleXML: iteration through subnodes and attributes
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<people>
- <person name="Joe">
- Text1
- <child name="Ann" />
- Text2
- <child name="Marray" />
- Text3
- </person>
- <person name="Boe">
- <child name="Joe" />
- <child name="Ann" />
- </person>
-</people>
-EOF;
-$xml1 =<<<EOF
-<people>
- <person name="Joe">
- <child />
- </person>
-</people>
-EOF;
-
-function traverse_xml($pad,$xml) {
- foreach($xml->children() as $name => $node) {
- echo $pad."<$name";
- foreach($node->attributes() as $attr => $value) {
- echo " $attr=\"$value\"";
- }
- echo ">\n";
- traverse_xml($pad." ",$node);
- echo $pad."</$name>\n";
- }
-}
-
-traverse_xml("",simplexml_load_string($xml));
-echo "----------\n";
-traverse_xml("",simplexml_load_string($xml1));
-echo "---Done---\n";
-?>
---EXPECT--
-<person name="Joe">
- <child name="Ann">
- </child>
- <child name="Marray">
- </child>
-</person>
-<person name="Boe">
- <child name="Joe">
- </child>
- <child name="Ann">
- </child>
-</person>
-----------
-<person name="Joe">
- <child>
- </child>
-</person>
----Done--- \ No newline at end of file
diff --git a/ext/simplexml/tests/019.phpt b/ext/simplexml/tests/019.phpt
deleted file mode 100755
index aec74ba42e..0000000000
--- a/ext/simplexml/tests/019.phpt
+++ /dev/null
@@ -1,80 +0,0 @@
---TEST--
-SimpleXML: foreach with children()
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$sxe = simplexml_load_string(<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- Plain text.
- <elem1 attr1='first'>
- Bla bla 1.
- <!-- comment -->
- <elem2>
- Here we have some text data.
- <elem3>
- And here some more.
- <elem4>
- Wow once again.
- </elem4>
- </elem3>
- </elem2>
- </elem1>
- <elem11 attr2='second'>
- Bla bla 2.
- <elem111>
- Foo Bar
- </elem111>
- </elem11>
-</sxe>
-EOF
-);
-
-foreach($sxe->children() as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
-}
-
-echo "===CLONE===\n";
-
-foreach(clone $sxe->children() as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
-}
-
-echo "===ELEMENT===\n";
-
-foreach($sxe->elem11->children() as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
-}
-
-echo "===COMMENT===\n";
-
-foreach($sxe->elem1->children() as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
-}
-
-?>
-===DONE===
---EXPECT--
-string(5) "elem1"
-string(10) "Bla bla 1."
-string(6) "elem11"
-string(10) "Bla bla 2."
-===CLONE===
-string(5) "elem1"
-string(10) "Bla bla 1."
-string(6) "elem11"
-string(10) "Bla bla 2."
-===ELEMENT===
-string(7) "elem111"
-string(7) "Foo Bar"
-===COMMENT===
-string(5) "elem2"
-string(28) "Here we have some text data."
-===DONE===
diff --git a/ext/simplexml/tests/020.phpt b/ext/simplexml/tests/020.phpt
deleted file mode 100755
index 9e91b5ac3a..0000000000
--- a/ext/simplexml/tests/020.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-SimpleXML: Attribute compared to string
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$doc = simplexml_load_string('<root><name attr="foo">bar</name></root>');
-print $doc->name["attr"];
-print "\n";
-if ($doc->name["attr"] == "foo") {
- print "Works\n";
-} else {
- print "Error\n";
-}
-?>
-===DONE===
---EXPECT--
-foo
-Works
-===DONE===
diff --git a/ext/simplexml/tests/021.phpt b/ext/simplexml/tests/021.phpt
deleted file mode 100644
index d5138685f5..0000000000
--- a/ext/simplexml/tests/021.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-SimpleXML: Element check
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$ok = 1;
-$doc = simplexml_load_string('<root><exists>foo</exists></root>');
-if(!isset($doc->exists)) {
- $ok *= 0;
-}
-if(isset($doc->doesnotexist)) {
- $ok *= 0;
-}
-if ($ok) {
- print "Works\n";
-} else {
- print "Error\n";
-}
-?>
-===DONE===
---EXPECT--
-Works
-===DONE===
diff --git a/ext/simplexml/tests/022.phpt b/ext/simplexml/tests/022.phpt
deleted file mode 100755
index 2af4a1dd28..0000000000
--- a/ext/simplexml/tests/022.phpt
+++ /dev/null
@@ -1,62 +0,0 @@
---TEST--
-SimpleXML: Attributes inside foreach
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<pres><content><file glob="slide_*.xml"/></content></pres>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-echo "===CONTENT===\n";
-var_dump($sxe->content);
-
-echo "===FILE===\n";
-var_dump($sxe->content->file);
-
-echo "===FOREACH===\n";
-foreach($sxe->content->file as $file)
-{
- var_dump($file);
- var_dump($file['glob']);
-}
-
-?>
-===DONE===
---EXPECTF--
-===CONTENT===
-object(SimpleXMLElement)#%d (1) {
- ["file"]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["glob"]=>
- string(11) "slide_*.xml"
- }
- }
-}
-===FILE===
-object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["glob"]=>
- string(11) "slide_*.xml"
- }
-}
-===FOREACH===
-object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["glob"]=>
- string(11) "slide_*.xml"
- }
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(11) "slide_*.xml"
-}
-===DONE===
diff --git a/ext/simplexml/tests/023.phpt b/ext/simplexml/tests/023.phpt
deleted file mode 100755
index 515a1460c9..0000000000
--- a/ext/simplexml/tests/023.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-SimpleXML: Attributes with entities
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE talks SYSTEM "nbsp.dtd" [
-<!ELEMENT root EMPTY>
-<!ATTLIST root attr1 CDATA #IMPLIED>
-<!ENTITY nbsp "&#38;#x00A0;">
-]>
-<root attr='foo&nbsp;bar&nbsp;baz'></root>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-var_dump($sxe);
-var_dump($sxe['attr']);
-?>
-===DONE===
---EXPECTF--
-object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr"]=>
- string(%d) "foo%sbar%sbaz"
- }
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(%d) "foo%sbar%sbaz"
-}
-===DONE===
diff --git a/ext/simplexml/tests/024.phpt b/ext/simplexml/tests/024.phpt
deleted file mode 100755
index 9f31fd5e93..0000000000
--- a/ext/simplexml/tests/024.phpt
+++ /dev/null
@@ -1,175 +0,0 @@
---TEST--
-SimpleXML: XPath and attributes
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<root>
-<elem attr1='11' attr2='12' attr3='13'/>
-<elem attr1='21' attr2='22' attr3='23'/>
-<elem attr1='31' attr2='32' attr3='33'/>
-</root>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-function test($xpath)
-{
- global $sxe;
-
- echo "===$xpath===\n";
- var_dump($sxe->xpath($xpath));
-}
-
-test('elem/@attr2');
-test('//@attr2');
-test('//@*');
-test('elem[2]/@attr2');
-
-?>
-===DONE===
---EXPECTF--
-===elem/@attr2===
-array(3) {
- [0]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr2"]=>
- string(2) "12"
- }
- }
- [1]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr2"]=>
- string(2) "22"
- }
- }
- [2]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr2"]=>
- string(2) "32"
- }
- }
-}
-===//@attr2===
-array(3) {
- [0]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr2"]=>
- string(2) "12"
- }
- }
- [1]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr2"]=>
- string(2) "22"
- }
- }
- [2]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr2"]=>
- string(2) "32"
- }
- }
-}
-===//@*===
-array(9) {
- [0]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr1"]=>
- string(2) "11"
- }
- }
- [1]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr2"]=>
- string(2) "12"
- }
- }
- [2]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr3"]=>
- string(2) "13"
- }
- }
- [3]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr1"]=>
- string(2) "21"
- }
- }
- [4]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr2"]=>
- string(2) "22"
- }
- }
- [5]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr3"]=>
- string(2) "23"
- }
- }
- [6]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr1"]=>
- string(2) "31"
- }
- }
- [7]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr2"]=>
- string(2) "32"
- }
- }
- [8]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr3"]=>
- string(2) "33"
- }
- }
-}
-===elem[2]/@attr2===
-array(1) {
- [0]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["attr2"]=>
- string(2) "22"
- }
- }
-}
-===DONE===
diff --git a/ext/simplexml/tests/025.phpt b/ext/simplexml/tests/025.phpt
deleted file mode 100755
index b9e3bbb0dc..0000000000
--- a/ext/simplexml/tests/025.phpt
+++ /dev/null
@@ -1,92 +0,0 @@
---TEST--
-SimpleXML: getting namespaces
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<xhtml:html xmlns:html='http://www.w3.org/1999/xhtml' xmlns:xhtml='http://www.w3.org/TR/REC-html40'>
-<xhtml:head><xhtml:title xmlns:xhtml='http://www.w3.org/TR/REC-html401'>bla</xhtml:title></xhtml:head>
-<xhtml:body html:title="b">
-<html:h1>bla</html:h1>
-<foo:bar xmlns:foo='foobar' xmlns:baz='foobarbaz'/>
-</xhtml:body>
-</xhtml:html>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-var_dump($sxe->getNamespaces());
-var_dump($sxe->getNamespaces(true));
-var_dump($sxe->getDocNamespaces());
-var_dump($sxe->getDocNamespaces(true));
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<html xmlns='http://www.w3.org/1999/xhtml'>
-<head><title xmlns='http://www.w3.org/TR/REC-html40'>bla</title></head>
-</html>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-var_dump($sxe->getNamespaces());
-var_dump($sxe->getDocNamespaces());
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<root/>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-var_dump($sxe->getNamespaces());
-var_dump($sxe->getDocNamespaces());
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-array(1) {
- ["xhtml"]=>
- string(31) "http://www.w3.org/TR/REC-html40"
-}
-array(3) {
- ["xhtml"]=>
- string(31) "http://www.w3.org/TR/REC-html40"
- ["html"]=>
- string(28) "http://www.w3.org/1999/xhtml"
- ["foo"]=>
- string(6) "foobar"
-}
-array(2) {
- ["html"]=>
- string(28) "http://www.w3.org/1999/xhtml"
- ["xhtml"]=>
- string(31) "http://www.w3.org/TR/REC-html40"
-}
-array(4) {
- ["html"]=>
- string(28) "http://www.w3.org/1999/xhtml"
- ["xhtml"]=>
- string(31) "http://www.w3.org/TR/REC-html40"
- ["foo"]=>
- string(6) "foobar"
- ["baz"]=>
- string(9) "foobarbaz"
-}
-array(1) {
- [""]=>
- string(28) "http://www.w3.org/1999/xhtml"
-}
-array(1) {
- [""]=>
- string(28) "http://www.w3.org/1999/xhtml"
-}
-array(0) {
-}
-array(0) {
-}
-===DONE===
diff --git a/ext/simplexml/tests/026.phpt b/ext/simplexml/tests/026.phpt
deleted file mode 100755
index d6de94be3d..0000000000
--- a/ext/simplexml/tests/026.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-SimpleXML: getName()
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<people>
- <person>Jane</person>
-</people>
-EOF;
-
-function traverse_xml($xml, $pad = '')
-{
- $name = $xml->getName();
- echo "$pad<$name";
- foreach($xml->attributes() as $attr => $value)
- {
- echo " $attr=\"$value\"";
- }
- echo ">" . trim($xml) . "\n";
- foreach($xml->children() as $node)
- {
- traverse_xml($node, $pad.' ');
- }
- echo $pad."</$name>\n";
-}
-
-
-$people = simplexml_load_string($xml);
-traverse_xml($people);
-
-?>
-===DONE===
---EXPECTF--
-<people>
- <person>Jane
- </person>
-</people>
-===DONE===
diff --git a/ext/simplexml/tests/027.phpt b/ext/simplexml/tests/027.phpt
deleted file mode 100755
index f32786c7cc..0000000000
--- a/ext/simplexml/tests/027.phpt
+++ /dev/null
@@ -1,74 +0,0 @@
---TEST--
-SimpleXML: Adding an elements
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<people></people>
-EOF;
-
-function traverse_xml($xml, $pad = '')
-{
- $name = $xml->getName();
- echo "$pad<$name";
- foreach($xml->attributes() as $attr => $value)
- {
- echo " $attr=\"$value\"";
- }
- echo ">" . trim($xml) . "\n";
- foreach($xml->children() as $node)
- {
- traverse_xml($node, $pad.' ');
- }
- echo $pad."</$name>\n";
-}
-
-
-$people = simplexml_load_string($xml);
-traverse_xml($people);
-$people->person = 'Joe';
-$people->person['gender'] = 'male';
-traverse_xml($people);
-$people->person = 'Jane';
-traverse_xml($people);
-$people->person['gender'] = 'female';
-$people->person[1] = 'Joe';
-$people->person[1]['gender'] = 'male';
-traverse_xml($people);
-$people->person[3] = 'Minni-me';
-$people->person[2]['gender'] = 'male';
-traverse_xml($people);
-$people->person[3]['gender'] = 'error';
-
-?>
-===DONE===
---EXPECTF--
-<people>
-</people>
-<people>
- <person gender="male">Joe
- </person>
-</people>
-<people>
- <person gender="male">Jane
- </person>
-</people>
-<people>
- <person gender="female">Jane
- </person>
- <person gender="male">Joe
- </person>
-</people>
-
-Warning: main(): Cannot add element person number 3 when only 2 such elements exist in %s027.php on line %d
-<people>
- <person gender="female">Jane
- </person>
- <person gender="male">Joe
- </person>
- <person gender="male">Minni-me
- </person>
-</people>
-
-Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %s027.php on line %d
diff --git a/ext/simplexml/tests/028.phpt b/ext/simplexml/tests/028.phpt
deleted file mode 100755
index 753056b9ad..0000000000
--- a/ext/simplexml/tests/028.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-SimpleXML: Adding an elements without text
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<people></people>
-EOF;
-
-function traverse_xml($xml, $pad = '')
-{
- $name = $xml->getName();
- echo "$pad<$name";
- foreach($xml->attributes() as $attr => $value)
- {
- echo " $attr=\"$value\"";
- }
- echo ">" . trim($xml) . "\n";
- foreach($xml->children() as $node)
- {
- traverse_xml($node, $pad.' ');
- }
- echo $pad."</$name>\n";
-}
-
-
-$people = simplexml_load_string($xml);
-traverse_xml($people);
-$people->person['name'] = 'John';
-traverse_xml($people);
-
-?>
-===DONE===
---EXPECTF--
-<people>
-</people>
-<people>
- <person name="John">
- </person>
-</people>
-===DONE===
diff --git a/ext/simplexml/tests/029.phpt b/ext/simplexml/tests/029.phpt
deleted file mode 100755
index 86a4f308e3..0000000000
--- a/ext/simplexml/tests/029.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-SimpleXML: foreach and count
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<people>
- <person name="Joe"/>
- <person name="John">
- <children>
- <person name="Joe"/>
- </children>
- </person>
- <person name="Jane"/>
-</people>
-EOF;
-
-$people = simplexml_load_string($xml);
-
-foreach($people as $person)
-{
- var_dump((string)$person['name']);
- var_dump(count($people));
- var_dump(count($person));
-}
-
-?>
-===DONE===
---EXPECTF--
-string(3) "Joe"
-int(3)
-int(0)
-string(4) "John"
-int(3)
-int(1)
-string(4) "Jane"
-int(3)
-int(0)
-===DONE===
diff --git a/ext/simplexml/tests/030.phpt b/ext/simplexml/tests/030.phpt
deleted file mode 100644
index 774a5f1459..0000000000
--- a/ext/simplexml/tests/030.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-SimpleXML: isset and unset by offset
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<root s:att1="b" att1="a"
- xmlns:s="urn::test" xmlns:t="urn::test-t">
- <child1>test</child1>
- <child1>test 2</child1>
- <s:child3 />
-</root>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-echo $sxe->child1[0]."\n";
-echo $sxe->child1[1]."\n\n";
-
-var_dump(isset($sxe->child1[1]));
-unset($sxe->child1[1]);
-var_dump(isset($sxe->child1[1]));
-echo "\n";
-
-$atts = $sxe->attributes("urn::test");
-var_dump(isset($atts[0]));
-unset($atts[0]);
-var_dump(isset($atts[0]));
-var_dump(isset($atts[TRUE]));
-
-?>
-===DONE===
---EXPECT--
-test
-test 2
-
-bool(true)
-bool(false)
-
-bool(true)
-bool(false)
-bool(false)
-===DONE===
diff --git a/ext/simplexml/tests/031.phpt b/ext/simplexml/tests/031.phpt
deleted file mode 100644
index cd2d266ba1..0000000000
--- a/ext/simplexml/tests/031.phpt
+++ /dev/null
@@ -1,57 +0,0 @@
---TEST--
-SimpleXML: addChild and addAttribute
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<root s:att1="b" att1="a"
- xmlns:s="urn::test" xmlns:t="urn::test-t">
- <child1>test</child1>
- <child1>test 2</child1>
- <s:child3 />
-</root>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-/* Add new attribute in a new namespace */
-$sxe->addAttribute('v:att11', 'xxx', 'urn::test-v');
-
-/* Try to add attribute again -> display warning as method is for new Attr only */
-$sxe->addAttribute('v:att11', 'xxx', 'urn::test-v');
-
-/* Add new attribute w/o namespace */
-$sxe->addAttribute('att2', 'no-ns');
-
-$d = $sxe->attributes();
-/* Try to add element to attribute -> display warning and do not add */
-$d->addChild('m:test', 'myval', 'urn::test');
-
-
-/* Test adding elements in various configurations */
-$sxe->addChild('m:test1', 'myval', 'urn::test');
-
-/* New namespace test */
-$n = $sxe->addChild('m:test2', 'myval', 'urn::testnew');
-
-$sxe->addChild('test3', 'myval', 'urn::testnew');
-$sxe->addChild('test4', 'myval');
-
-/* Does not add prefix here although name is valid (but discouraged) - change behavior? */
-$sxe->addChild('s:test5', 'myval');
-
-echo $sxe->asXML();
-?>
-===DONE===
---EXPECTF--
-Warning: SimpleXMLElement::addAttribute(): Attribute already exists in %s031.php on line %d
-
-Warning: SimpleXMLElement::addChild(): Cannot add element to attributes in %s031.php on line %d
-<?xml version="1.0"?>
-<root xmlns:s="urn::test" xmlns:t="urn::test-t" xmlns:v="urn::test-v" s:att1="b" att1="a" v:att11="xxx" att2="no-ns">
- <child1>test</child1>
- <child1>test 2</child1>
- <s:child3/>
-<s:test1>myval</s:test1><m:test2 xmlns:m="urn::testnew">myval</m:test2><test3 xmlns="urn::testnew">myval</test3><test4>myval</test4><test5>myval</test5></root>
-===DONE===
diff --git a/ext/simplexml/tests/032.phpt b/ext/simplexml/tests/032.phpt
deleted file mode 100755
index 48bc887ecc..0000000000
--- a/ext/simplexml/tests/032.phpt
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-SimpleXML: comparing instances
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$xml =<<<EOF
-<people>
- <person name="Joe"/>
- <person name="John">
- <children>
- <person name="Joe"/>
- </children>
- </person>
- <person name="Jane"/>
-</people>
-EOF;
-
-$xml1 =<<<EOF
-<people>
- <person name="John">
- <children>
- <person name="Joe"/>
- </children>
- </person>
- <person name="Jane"/>
-</people>
-EOF;
-
-
-$people = simplexml_load_string($xml);
-$people1 = simplexml_load_string($xml);
-$people2 = simplexml_load_string($xml1);
-
-var_dump($people1 == $people);
-var_dump($people2 == $people);
-var_dump($people2 == $people1);
-
-?>
-===DONE===
---EXPECTF--
-bool(false)
-bool(false)
-bool(false)
-===DONE===
diff --git a/ext/simplexml/tests/033.phpt b/ext/simplexml/tests/033.phpt
deleted file mode 100755
index ba01b21555..0000000000
--- a/ext/simplexml/tests/033.phpt
+++ /dev/null
@@ -1,137 +0,0 @@
---TEST--
-SimpleXML: casting instances
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<people>
-test
- <person name="Joe"/>
- <person name="John">
- <children>
- <person name="Joe"/>
- </children>
- </person>
- <person name="Jane"/>
-</people>
-EOF;
-
-$foo = simplexml_load_string( "<foo />" );
-$people = simplexml_load_string($xml);
-
-var_dump((bool)$foo);
-var_dump((bool)$people);
-var_dump((int)$foo);
-var_dump((int)$people);
-var_dump((double)$foo);
-var_dump((double)$people);
-var_dump((string)$foo);
-var_dump((string)$people);
-var_dump((array)$foo);
-var_dump((array)$people);
-var_dump((object)$foo);
-var_dump((object)$people);
-
-?>
-===DONE===
---EXPECTF--
-bool(false)
-bool(true)
-int(0)
-int(0)
-float(0)
-float(0)
-string(0) ""
-string(15) "
-test
-
-
-
-"
-array(0) {
-}
-array(1) {
- ["person"]=>
- array(3) {
- [0]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["name"]=>
- string(3) "Joe"
- }
- }
- [1]=>
- object(SimpleXMLElement)#%d (2) {
- ["@attributes"]=>
- array(1) {
- ["name"]=>
- string(4) "John"
- }
- ["children"]=>
- object(SimpleXMLElement)#%d (1) {
- ["person"]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["name"]=>
- string(3) "Joe"
- }
- }
- }
- }
- [2]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["name"]=>
- string(4) "Jane"
- }
- }
- }
-}
-object(SimpleXMLElement)#%d (0) {
-}
-object(SimpleXMLElement)#%d (1) {
- ["person"]=>
- array(3) {
- [0]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["name"]=>
- string(3) "Joe"
- }
- }
- [1]=>
- object(SimpleXMLElement)#%d (2) {
- ["@attributes"]=>
- array(1) {
- ["name"]=>
- string(4) "John"
- }
- ["children"]=>
- object(SimpleXMLElement)#%d (1) {
- ["person"]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["name"]=>
- string(3) "Joe"
- }
- }
- }
- }
- [2]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["name"]=>
- string(4) "Jane"
- }
- }
- }
-}
-===DONE===
diff --git a/ext/simplexml/tests/book.xml b/ext/simplexml/tests/book.xml
deleted file mode 100644
index ea40508e01..0000000000
--- a/ext/simplexml/tests/book.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<books>
- <book>
- <title>The Grapes of Wrath</title>
- <author>John Steinbeck</author>
- </book>
- <book>
- <title>The Pearl</title>
- <author>John Steinbeck</author>
- </book>
-</books>
diff --git a/ext/simplexml/tests/bug24392.phpt b/ext/simplexml/tests/bug24392.phpt
deleted file mode 100644
index 0a462e5770..0000000000
--- a/ext/simplexml/tests/bug24392.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Bug #24392 (empty namespaces causing confusion)
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip simplexml extension is not loaded"; ?>
---FILE--
-<?php
-$s = simplexml_load_file(dirname(__FILE__).'/bug24392.xml');
-foreach ($s->item as $item) {
- echo $item->title . "\n";
-}
-?>
---EXPECT--
-EU Parliament to Vote on New Patent Rules
-Most Powerful Amateur Rocket in Canada
-GF FX 5900 Ultra vs. ATi Radeon 9800 Pro
-PHP 5 Beta 1
-Engaging with the OSS Community
-Pure Math, Pure Joy
-Windows Tech Writer Looks at Linux
-US Cell Phone Users Discover SMS Spam
-Verizon Sues Nextel For Espionage
-Introduction to Debian
diff --git a/ext/simplexml/tests/bug24392.xml b/ext/simplexml/tests/bug24392.xml
deleted file mode 100644
index d669f1df41..0000000000
--- a/ext/simplexml/tests/bug24392.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0"?>
-
-<rdf:RDF
-xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-xmlns="http://my.netscape.com/rdf/simple/0.9/">
-
-<channel>
-<title>Slashdot</title>
-<link>http://slashdot.org/</link>
-<description>News for nerds, stuff that matters</description>
-</channel>
-
-<image>
-<title>Slashdot</title>
-<url>http://images.slashdot.org/topics/topicslashdot.gif</url>
-<link>http://slashdot.org/</link>
-</image>
-
-<item>
-<title>EU Parliament to Vote on New Patent Rules</title>
-<link>http://slashdot.org/article.pl?sid=03/06/30/002211</link>
-</item>
-
-<item>
-<title>Most Powerful Amateur Rocket in Canada</title>
-<link>http://slashdot.org/article.pl?sid=03/06/29/2121211</link>
-</item>
-
-<item>
-<title>GF FX 5900 Ultra vs. ATi Radeon 9800 Pro</title>
-<link>http://slashdot.org/article.pl?sid=03/06/29/202218</link>
-</item>
-
-<item>
-<title>PHP 5 Beta 1</title>
-<link>http://slashdot.org/article.pl?sid=03/06/29/1957253</link>
-</item>
-
-<item>
-<title>Engaging with the OSS Community</title>
-<link>http://slashdot.org/article.pl?sid=03/06/29/1913235</link>
-</item>
-
-<item>
-<title>Pure Math, Pure Joy</title>
-<link>http://slashdot.org/article.pl?sid=03/06/29/183258</link>
-</item>
-
-<item>
-<title>Windows Tech Writer Looks at Linux</title>
-<link>http://slashdot.org/article.pl?sid=03/06/29/1554201</link>
-</item>
-
-<item>
-<title>US Cell Phone Users Discover SMS Spam</title>
-<link>http://slashdot.org/article.pl?sid=03/06/29/1542249</link>
-</item>
-
-<item>
-<title>Verizon Sues Nextel For Espionage</title>
-<link>http://slashdot.org/article.pl?sid=03/06/29/1443230</link>
-</item>
-
-<item>
-<title>Introduction to Debian</title>
-<link>http://slashdot.org/article.pl?sid=03/06/29/1424213</link>
-</item>
-
-<textinput>
-<title>Search Slashdot</title>
-<description>Search Slashdot stories</description>
-<name>query</name>
-<link>http://slashdot.org/search.pl</link>
-</textinput>
-
-</rdf:RDF> \ No newline at end of file
diff --git a/ext/simplexml/tests/bug25756.xsd b/ext/simplexml/tests/bug25756.xsd
deleted file mode 100644
index 427b7a1a14..0000000000
--- a/ext/simplexml/tests/bug25756.xsd
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:element name="foo" type="foo-type" />
- <xsd:complexType name="item-type">
- <xsd:all>
- <xsd:element name="product-name" type="xsd:string"
- minOccurs="1" maxOccurs="1"/>
- <xsd:element name="quantity" type="xsd:decimal"
- minOccurs="1" maxOccurs="1"/>
- </xsd:all>
- </xsd:complexType>
- <xsd:complexType name="foo-type">
- <xsd:sequence>
- <xsd:element name="items" minoccurs="1" maxOccurs="1">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="item" type="item-type"
- minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
-</xsd:schema>
diff --git a/ext/simplexml/tests/bug25756_1.xml b/ext/simplexml/tests/bug25756_1.xml
deleted file mode 100644
index 33ab30be10..0000000000
--- a/ext/simplexml/tests/bug25756_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<foo>
- <items>
- <item>
- <product-name>abc</product-name>
- <quantity>123</quantity>
- </item>
- <item>
- <product-name>def</product-name>
- <quantity>456</quantity>
- </item>
- </items>
-</foo>
diff --git a/ext/simplexml/tests/bug25756_2.xml b/ext/simplexml/tests/bug25756_2.xml
deleted file mode 100644
index 53037ef769..0000000000
--- a/ext/simplexml/tests/bug25756_2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<foo>
- <items>
- <item>
- <product-name>abc</product-name>
- <quantity>abc</quantity>
- </item>
- <item>
- <product-name>abc</product-name>
- <quantity>123</quantity>
- </item>
- </items>
-</foo>
diff --git a/ext/simplexml/tests/bug26976.phpt b/ext/simplexml/tests/bug26976.phpt
deleted file mode 100644
index 657c229737..0000000000
--- a/ext/simplexml/tests/bug26976.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-Bug #26976 (Can not access array elements using array indices)
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip simplexml extension is not loaded"; ?>
---FILE--
-<?php
-
-$root = simplexml_load_string(
-'<?xml version="1.0"?>
-<root>
- <child>a</child>
- <child>b</child>
- <child>c</child>
- <child>d</child>
-</root>
-');
-
-echo $root->child[0], "\n";
-echo $root->child[1], "\n";
-echo $root->child[2], "\n";
-echo $root->child[3], "\n";
-
-?>
---EXPECT--
-a
-b
-c
-d
diff --git a/ext/simplexml/tests/bug27010.phpt b/ext/simplexml/tests/bug27010.phpt
deleted file mode 100755
index 364ca4675f..0000000000
--- a/ext/simplexml/tests/bug27010.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-Bug #27010 (segfault and node text not displayed when returned from children())
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml=<<<EOF
-<drinks xmlns:hot="http://www.example.com/hot">
- <hot:drink><hot:name>Coffee</hot:name></hot:drink>
- <hot:drink><hot:name>Tea</hot:name></hot:drink>
- <drink><name>Cola</name></drink>
- <drink><name>Juice</name></drink>
-</drinks>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-
-foreach ($sxe as $element_name => $element) {
- print "$element_name is $element->name\n";
-}
-
-foreach ($sxe->children('http://www.example.com/hot') as $element_name => $element) {
- print "$element_name is $element->name\n";
-}
-
-?>
-===DONE===
---EXPECT--
-drink is Cola
-drink is Juice
-drink is Coffee
-drink is Tea
-===DONE===
diff --git a/ext/simplexml/tests/bug35785.phpt b/ext/simplexml/tests/bug35785.phpt
deleted file mode 100755
index 096ab7a681..0000000000
--- a/ext/simplexml/tests/bug35785.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-Bug #35785 (SimpleXML memory read error)
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml = simplexml_load_string("<root></root>");
-$xml->bla->posts->name = "FooBar";
-echo $xml->asXML();
-
-echo "===FAIL===\n";
-
-$xml = simplexml_load_string("<root></root>");
-$count = count($xml->bla->posts);
-var_dump($count);
-$xml->bla->posts[++$count]->name = "FooBar";
-echo $xml->asXML();
-?>
-===DONE===
-<?php exit(0); __halt_compiler(); ?>
---EXPECTF--
-<?xml version="1.0"?>
-<root><bla><posts><name>FooBar</name></posts></bla></root>
-===FAIL===
-int(0)
-
-Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %sbug35785.php on line %d
diff --git a/ext/simplexml/tests/bug36611.phpt b/ext/simplexml/tests/bug36611.phpt
deleted file mode 100644
index 835e926fe5..0000000000
--- a/ext/simplexml/tests/bug36611.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Bug #36611 (assignment to SimpleXML object attribute changes argument type to string)
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml_str = <<<EOD
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<c_fpobel >
- <pos >
- <pos/>
- </pos>
-</c_fpobel>
-EOD;
-
-$xml = simplexml_load_string ($xml_str) ;
-
-$val = 1;
-
-var_dump($val);
-$obj->pos["act_idx"] = $val;
-var_dump($val) ;
-
-echo "Done\n";
-?>
---EXPECT--
-int(1)
-int(1)
-Done
diff --git a/ext/simplexml/tests/bug37565.phpt b/ext/simplexml/tests/bug37565.phpt
deleted file mode 100755
index e04f9577f1..0000000000
--- a/ext/simplexml/tests/bug37565.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Bug #37565 Using reflection::export with simplexml causing a crash
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-function my_error_handler($errno, $errstr, $errfile, $errline) {
- echo "Error: $errstr\n";
-}
-
-set_error_handler('my_error_handler');
-
-class Setting extends ReflectionObject
-{
-}
-
-Reflection::export(simplexml_load_string('<test/>', 'Setting'));
-
-Reflection::export(simplexml_load_file('data:,<test/>', 'Setting'));
-
-?>
-===DONE===
---EXPECTF--
-Error: simplexml_load_string() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
-Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
-Error: Reflection::export() expects parameter 1 to be Reflector, null given
-Error: simplexml_load_file() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
-Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
-Error: Reflection::export() expects parameter 1 to be Reflector, null given
-===DONE===
diff --git a/ext/simplexml/tests/bug38347.phpt b/ext/simplexml/tests/bug38347.phpt
deleted file mode 100644
index c25fccea24..0000000000
--- a/ext/simplexml/tests/bug38347.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-Bug #38347 (Segmentation fault when using foreach with an unknown/empty SimpleXMLElement)
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-function iterate($xml)
-{
- print_r($xml);
- foreach ($xml->item as $item) {
- echo "This code will crash!";
- }
-}
-
-$xmlstr = "<xml><item>Item 1</item><item>Item 2</item></xml>";
-$xml = simplexml_load_string($xmlstr);
-iterate($xml->unknown);
-
-echo "Done\n";
-?>
---EXPECTF--
-SimpleXMLElement Object
-(
-)
-
-Warning: iterate(): Node no longer exists in %s on line %d
-Done
diff --git a/ext/simplexml/tests/bug38354.phpt b/ext/simplexml/tests/bug38354.phpt
deleted file mode 100644
index d2fcde11c2..0000000000
--- a/ext/simplexml/tests/bug38354.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-Bug #38354 (Unwanted reformatting of XML when using AsXML)
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml = simplexml_load_string(
-'<code>
- <a href="javascript:alert(\'1\');"><strong>Item Two</strong></a>
-</code>'
-);
-
-foreach ($xml->xpath("//*") as $element) {
- var_dump($element->asXML());
-}
-
-echo "Done\n";
-?>
---EXPECTF--
-string(101) "<?xml version="1.0"?>
-<code>
- <a href="javascript:alert('1');"><strong>Item Two</strong></a>
-</code>
-"
-string(62) "<a href="javascript:alert('1');"><strong>Item Two</strong></a>"
-string(25) "<strong>Item Two</strong>"
-Done
diff --git a/ext/simplexml/tests/bug38424.phpt b/ext/simplexml/tests/bug38424.phpt
deleted file mode 100644
index baab45fe54..0000000000
--- a/ext/simplexml/tests/bug38424.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Bug #38424 (Different attribute assignment if new or exists)
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml = simplexml_load_string('<xml></xml>');
-
-$str = "abc & def" ;
-
-$xml["a1"] = "" ;
-$xml["a1"] = htmlspecialchars($str,ENT_NOQUOTES) ;
-
-$xml["a2"] = htmlspecialchars($str,ENT_NOQUOTES) ;
-
-$xml["a3"] = "" ;
-$xml["a3"] = $str ;
-
-$xml["a4"] = $str ;
-
-echo $xml->asXML();
-?>
---EXPECT--
-<?xml version="1.0"?>
-<xml a1="abc &amp;amp; def" a2="abc &amp;amp; def" a3="abc &amp; def" a4="abc &amp; def"/>
diff --git a/ext/simplexml/tests/profile01.phpt b/ext/simplexml/tests/profile01.phpt
deleted file mode 100644
index 91b9544f66..0000000000
--- a/ext/simplexml/tests/profile01.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-SimpleXML [profile]: Accessing a simple node
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$root = simplexml_load_string('<?xml version="1.0"?>
-<root>
- <child>Hello</child>
-</root>
-');
-
-echo $root->child;
-echo "\n---Done---\n";
-?>
---EXPECT--
-Hello
----Done---
diff --git a/ext/simplexml/tests/profile02.phpt b/ext/simplexml/tests/profile02.phpt
deleted file mode 100644
index 14b5bb86b2..0000000000
--- a/ext/simplexml/tests/profile02.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-SimpleXML [profile]: Accessing an array of subnodes
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$root = simplexml_load_string('<?xml version="1.0"?>
-<root>
- <child>Hello</child>
- <child>World</child>
-</root>
-');
-
-foreach ($root->child as $child) {
- echo "$child ";
-}
-echo "\n---Done---\n";
-?>
---EXPECT--
-Hello World
----Done---
diff --git a/ext/simplexml/tests/profile03.phpt b/ext/simplexml/tests/profile03.phpt
deleted file mode 100644
index 14f1c5fe88..0000000000
--- a/ext/simplexml/tests/profile03.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-SimpleXML [profile]: Accessing an attribute
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$root = simplexml_load_string('<?xml version="1.0"?>
-<root>
- <child attribute="Sample" />
-</root>
-');
-
-echo $root->child['attribute'];
-echo "\n---Done---\n";
-?>
---EXPECT--
-Sample
----Done---
diff --git a/ext/simplexml/tests/profile04.phpt b/ext/simplexml/tests/profile04.phpt
deleted file mode 100644
index 27714e9927..0000000000
--- a/ext/simplexml/tests/profile04.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-SimpleXML [profile]: Accessing a namespaced element
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-$root = simplexml_load_string('<?xml version="1.0"?>
-<root xmlns:reserved="reserved-ns">
- <reserved:child>Hello</reserved:child>
-</root>
-');
-
-echo $root->children('reserved-ns')->child;
-echo "\n---Done---\n";
-?>
---EXPECT--
-Hello
----Done---
diff --git a/ext/simplexml/tests/profile05.phpt b/ext/simplexml/tests/profile05.phpt
deleted file mode 100644
index f69622118a..0000000000
--- a/ext/simplexml/tests/profile05.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-SimpleXML [profile]: Accessing an aliased namespaced element
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
-<root xmlns:reserved="reserved-ns">
- <reserved:child>Hello</reserved:child>
-</root>
-');
-
-echo $root->children('reserved')->child;
-echo "\n---Done---\n";
-?>
---EXPECT--
----Done---
diff --git a/ext/simplexml/tests/profile06.phpt b/ext/simplexml/tests/profile06.phpt
deleted file mode 100644
index e519fa9d64..0000000000
--- a/ext/simplexml/tests/profile06.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-SimpleXML [profile]: Accessing a namespaced attribute
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
-<root xmlns:reserved="reserved-ns">
- <child reserved:attribute="Sample" />
-</root>
-');
-
-$attr = $root->child->attributes('reserved-ns');
-echo $attr['attribute'];
-echo "\n---Done---\n";
-?>
---EXPECT--
-Sample
----Done---
diff --git a/ext/simplexml/tests/profile07.phpt b/ext/simplexml/tests/profile07.phpt
deleted file mode 100644
index c8a4269274..0000000000
--- a/ext/simplexml/tests/profile07.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-SimpleXML [profile]: Accessing an aliased namespaced attribute
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
-<root xmlns:reserved="reserved-ns">
- <child reserved:attribute="Sample" />
-</root>
-');
-
-$rsattr = $root->child->attributes('reserved');
-$myattr = $root->child->attributes('reserved-ns');
-
-echo $rsattr['attribute'];
-echo $myattr['attribute'];
-echo "\n---Done---\n";
-?>
---EXPECT--
-Sample
----Done---
diff --git a/ext/simplexml/tests/profile08.phpt b/ext/simplexml/tests/profile08.phpt
deleted file mode 100644
index bbb69b75a8..0000000000
--- a/ext/simplexml/tests/profile08.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-SimpleXML [profile]: Accessing a namespaced attribute without a namespace
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
-<root xmlns:reserved="reserved-ns">
- <child reserved:attribute="Sample" />
-</root>
-');
-
-echo $root->child['attribute'];
-echo "\n---Done---\n";
-?>
---EXPECT--
----Done---
diff --git a/ext/simplexml/tests/profile09.phpt b/ext/simplexml/tests/profile09.phpt
deleted file mode 100644
index 714572df1e..0000000000
--- a/ext/simplexml/tests/profile09.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-SimpleXML [profile]: Accessing a namespaced element without a namespace
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
-<root xmlns:reserved="reserved-ns">
- <reserved:child>Hello</reserved:child>
-</root>
-');
-
-echo $root->child;
-echo "\n---Done---\n";
-?>
---EXPECT--
-
----Done---
diff --git a/ext/simplexml/tests/profile10.phpt b/ext/simplexml/tests/profile10.phpt
deleted file mode 100644
index 6ef7456c51..0000000000
--- a/ext/simplexml/tests/profile10.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-SimpleXML [profile]: Accessing two attributes with the same name, but different namespaces
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
-<root xmlns:reserved="reserved-ns" xmlns:special="special-ns">
- <child reserved:attribute="Sample" special:attribute="Test" />
-</root>
-');
-
-$rsattr = $root->child->attributes('reserved-ns');
-$spattr = $root->child->attributes('special-ns');
-
-echo $rsattr['attribute'];
-echo "\n";
-echo $spattr['attribute'];
-echo "\n---Done---\n";
-?>
---EXPECT--
-Sample
-Test
----Done---
diff --git a/ext/simplexml/tests/profile11.phpt b/ext/simplexml/tests/profile11.phpt
deleted file mode 100644
index 54c31bf710..0000000000
--- a/ext/simplexml/tests/profile11.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-SimpleXML [profile]: Accessing two elements with the same name, but different namespaces
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
-<root xmlns:reserved="reserved-ns" xmlns:special="special-ns">
- <reserved:child>Hello</reserved:child>
- <special:child>World</special:child>
-</root>
-');
-
-var_dump($root->children('reserved-ns')->child);
-var_dump($root->children('special-ns')->child);
-var_dump((string)$root->children('reserved-ns')->child);
-var_dump((string)$root->children('special-ns')->child);
-var_dump($root->child);
-?>
-===DONE===
---EXPECTF--
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(5) "Hello"
-}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(5) "World"
-}
-string(5) "Hello"
-string(5) "World"
-object(SimpleXMLElement)#%d (0) {
-}
-===DONE===
diff --git a/ext/simplexml/tests/profile12.phpt b/ext/simplexml/tests/profile12.phpt
deleted file mode 100755
index 51a0d35531..0000000000
--- a/ext/simplexml/tests/profile12.phpt
+++ /dev/null
@@ -1,74 +0,0 @@
---TEST--
-SimpleXML [profile]: Accessing namespaced root and non namespaced children
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<soap:Envelope
-xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xmlns:xsd="http://www.w3.org/2001/XMLSchema"
->
-<soap:Body>
-<businessList foo="bar">
-<businessInfo businessKey="bla"/>
-</businessList>
-</soap:Body>
-</soap:Envelope>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-$nsl = $sxe->getNamespaces();
-var_dump($nsl);
-
-$sxe = simplexml_load_string($xml, NULL, 0, $nsl['soap']);
-var_dump($sxe->Body);
-var_dump($sxe->Body->children(''));
-var_dump($sxe->Body->children('')->businessList);
-
-?>
-===DONE===
---EXPECTF--
-array(1) {
- ["soap"]=>
- string(41) "http://schemas.xmlsoap.org/soap/envelope/"
-}
-object(SimpleXMLElement)#%s (0) {
-}
-object(SimpleXMLElement)#%s (1) {
- ["businessList"]=>
- object(SimpleXMLElement)#%s (2) {
- ["@attributes"]=>
- array(1) {
- ["foo"]=>
- string(3) "bar"
- }
- ["businessInfo"]=>
- object(SimpleXMLElement)#%s (1) {
- ["@attributes"]=>
- array(1) {
- ["businessKey"]=>
- string(3) "bla"
- }
- }
- }
-}
-object(SimpleXMLElement)#%s (2) {
- ["@attributes"]=>
- array(1) {
- ["foo"]=>
- string(3) "bar"
- }
- ["businessInfo"]=>
- object(SimpleXMLElement)#%s (1) {
- ["@attributes"]=>
- array(1) {
- ["businessKey"]=>
- string(3) "bla"
- }
- }
-}
-===DONE===
diff --git a/ext/simplexml/tests/profile13.phpt b/ext/simplexml/tests/profile13.phpt
deleted file mode 100755
index 2ae89e7449..0000000000
--- a/ext/simplexml/tests/profile13.phpt
+++ /dev/null
@@ -1,75 +0,0 @@
---TEST--
-SimpleXML [profile]: Accessing by namespace prefix
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<soap:Envelope
-xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xmlns:xsd="http://www.w3.org/2001/XMLSchema"
->
-<soap:Body>
-<businessList foo="bar">
-<businessInfo businessKey="bla"/>
-</businessList>
-</soap:Body>
-</soap:Envelope>
-EOF;
-
-$sxe = simplexml_load_string($xml);
-var_dump($sxe->children('soap', 1));
-
-$sxe = simplexml_load_string($xml, NULL, 0, 'soap', 1);
-var_dump($sxe->Body);
-var_dump($sxe->Body->children(''));
-var_dump($sxe->Body->children('')->businessList);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-object(SimpleXMLElement)#%d (1) {
- ["Body"]=>
- object(SimpleXMLElement)#%d (0) {
- }
-}
-object(SimpleXMLElement)#%d (0) {
-}
-object(SimpleXMLElement)#%d (1) {
- ["businessList"]=>
- object(SimpleXMLElement)#%d (2) {
- ["@attributes"]=>
- array(1) {
- ["foo"]=>
- string(3) "bar"
- }
- ["businessInfo"]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["businessKey"]=>
- string(3) "bla"
- }
- }
- }
-}
-object(SimpleXMLElement)#%d (2) {
- ["@attributes"]=>
- array(1) {
- ["foo"]=>
- string(3) "bar"
- }
- ["businessInfo"]=>
- object(SimpleXMLElement)#%d (1) {
- ["@attributes"]=>
- array(1) {
- ["businessKey"]=>
- string(3) "bla"
- }
- }
-}
-===DONE===
diff --git a/ext/simplexml/tests/simplexml_import_dom.phpt b/ext/simplexml/tests/simplexml_import_dom.phpt
deleted file mode 100755
index e108e0554d..0000000000
--- a/ext/simplexml/tests/simplexml_import_dom.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-SimpleXML [interop]: simplexml_import_dom
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) die("skip"); ?>
-<?php if (!extension_loaded("dom")) die("skip dom extension not loaded"); ?>
---FILE--
-<?php
-$dom = new domDocument;
-$dom->load(dirname(__FILE__)."/book.xml");
-if(!$dom) {
- echo "Error while parsing the document\n";
- exit;
-}
-$s = simplexml_import_dom($dom);
-$books = $s->book;
-foreach ($books as $book) {
- echo "{$book->title} was written by {$book->author}\n";
-}
-?>
---EXPECT--
-The Grapes of Wrath was written by John Steinbeck
-The Pearl was written by John Steinbeck
diff --git a/ext/simplexml/tests/sxe.dtd b/ext/simplexml/tests/sxe.dtd
deleted file mode 100755
index b75a7922b0..0000000000
--- a/ext/simplexml/tests/sxe.dtd
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml encoding='US-ASCII'?>
-
-<!ELEMENT sxe (elem1+, elem11, elem22*)>
-<!ATTLIST sxe id CDATA #implied>
-
-<!ELEMENT elem1 elem2*>
-<!ATTLIST elem1 attr1 CDATA #required
- attr2 CDATA "default>
-
-<!ELEMENT elem2 elem3*>
-<!ATTLIST elem2 att25 CDATA #implied
- att42 CDATA #implied>
-
-<!ELEMENT elem3 elem4*>
-<!ATTLIST elem3>
-
-<!ELEMENT elem4 EMPTY>
-<!ATTLIST elem4>
-
-<!ELEMENT elem11 elem111*>
-<!ATTLIST elem11>
-
-<!ELEMNET elem111 elem1111*>
-<!ATTLIST elem111>
-
-<!ELEMENT elem1111 EMPTY>
-<!ATTLIST elem1111>
-
-<!ELEMENT elem22 elem222*>
-<!ATTLIST elem22 attr22 CDATA #implied>
-
-<!ELEMENT elem222 EMPTY>
-<!ATTLIST elem222>
-
diff --git a/ext/simplexml/tests/sxe.ent b/ext/simplexml/tests/sxe.ent
deleted file mode 100755
index 8f86465c2a..0000000000
--- a/ext/simplexml/tests/sxe.ent
+++ /dev/null
@@ -1 +0,0 @@
-<!ENTITY included-entity "This is text included from an entity">
diff --git a/ext/simplexml/tests/sxe.xml b/ext/simplexml/tests/sxe.xml
deleted file mode 100755
index 909b4e652c..0000000000
--- a/ext/simplexml/tests/sxe.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd" [
-<!ENTITY % incent SYSTEM "sxe.ent">
-%incent;
-]>
-<sxe id="elem1">
- <elem1 attr1='first'>
- <!-- comment -->
- <elem2>
- <elem3>
- <elem4>
- <?test processing instruction ?>
- </elem4>
- </elem3>
- </elem2>
- </elem1>
-</sxe> \ No newline at end of file