summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/simplexml/config.m42
-rw-r--r--ext/simplexml/config.w322
-rw-r--r--ext/simplexml/simplexml.c11
-rwxr-xr-xext/simplexml/sxe.c (renamed from ext/spl/spl_sxe.c)78
-rwxr-xr-xext/simplexml/sxe.h (renamed from ext/spl/spl_sxe.h)11
-rw-r--r--ext/simplexml/tests/bug42259.phpt (renamed from ext/spl/tests/bug42259.phpt)0
-rwxr-xr-xext/simplexml/tests/sxe_001.phpt (renamed from ext/spl/tests/sxe_001.phpt)0
-rwxr-xr-xext/simplexml/tests/sxe_002.phpt (renamed from ext/spl/tests/sxe_002.phpt)0
-rwxr-xr-xext/simplexml/tests/sxe_003.phpt (renamed from ext/spl/tests/sxe_003.phpt)0
-rwxr-xr-xext/simplexml/tests/sxe_004.phpt (renamed from ext/spl/tests/sxe_004.phpt)0
-rwxr-xr-xext/simplexml/tests/sxe_005.phpt (renamed from ext/spl/tests/sxe_005.phpt)0
-rwxr-xr-xext/spl/config.m44
-rw-r--r--ext/spl/config.w322
-rwxr-xr-xext/spl/package.xml2
-rwxr-xr-xext/spl/php_spl.c16
15 files changed, 47 insertions, 81 deletions
diff --git a/ext/simplexml/config.m4 b/ext/simplexml/config.m4
index 7bc8644..2145e23 100644
--- a/ext/simplexml/config.m4
+++ b/ext/simplexml/config.m4
@@ -17,7 +17,7 @@ if test "$PHP_SIMPLEXML" != "no"; then
PHP_SETUP_LIBXML(SIMPLEXML_SHARED_LIBADD, [
AC_DEFINE(HAVE_SIMPLEXML,1,[ ])
- PHP_NEW_EXTENSION(simplexml, simplexml.c, $ext_shared)
+ PHP_NEW_EXTENSION(simplexml, simplexml.c sxe.c, $ext_shared)
PHP_SUBST(SIMPLEXML_SHARED_LIBADD)
], [
AC_MSG_ERROR([xml2-config not found. Please check your libxml2 installation.])
diff --git a/ext/simplexml/config.w32 b/ext/simplexml/config.w32
index a16b842..52eeb0c 100644
--- a/ext/simplexml/config.w32
+++ b/ext/simplexml/config.w32
@@ -5,7 +5,7 @@ ARG_WITH("simplexml", "Simple XML support", "yes");
if (PHP_SIMPLEXML == "yes" && PHP_LIBXML == "yes"
&& ADD_EXTENSION_DEP('simplexml', 'libxml')) {
- EXTENSION("simplexml", "simplexml.c");
+ EXTENSION("simplexml", "simplexml.c sxe.c");
AC_DEFINE("HAVE_SIMPLEXML", 1, "Simple XML support");
if (!PHP_SIMPLEXML_SHARED) {
ADD_FLAG("CFLAGS_SIMPLEXML", "/D LIBXML_STATIC");
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 0820b0e..d191220 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -34,9 +34,7 @@
#include "php_simplexml_exports.h"
#include "zend_exceptions.h"
#include "zend_interfaces.h"
-#ifdef HAVE_SPL
-#include "ext/spl/spl_sxe.h"
-#endif
+#include "sxe.h"
#define SXE_ELEMENT_BY_NAME 0
@@ -2535,14 +2533,11 @@ PHP_MINIT_FUNCTION(simplexml)
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;
-#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);
+ PHP_MINIT(sxe)(INIT_FUNC_ARGS_PASSTHRU);
+
return SUCCESS;
}
/* }}} */
diff --git a/ext/spl/spl_sxe.c b/ext/simplexml/sxe.c
index 5670ab6..4911853 100755
--- a/ext/spl/spl_sxe.c
+++ b/ext/simplexml/sxe.c
@@ -27,34 +27,29 @@
#include "ext/standard/info.h"
#include "zend_interfaces.h"
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-#include "spl_iterators.h"
-#include "spl_sxe.h"
-#include "spl_array.h"
+#include "ext/spl/php_spl.h"
+#include "ext/spl/spl_iterators.h"
+#include "sxe.h"
-zend_class_entry *spl_ce_SimpleXMLIterator = NULL;
-zend_class_entry *spl_ce_SimpleXMLElement;
+zend_class_entry *ce_SimpleXMLIterator = NULL;
+zend_class_entry *ce_SimpleXMLElement;
-#if HAVE_LIBXML && HAVE_SIMPLEXML
-
-#include "ext/simplexml/php_simplexml_exports.h"
+#include "php_simplexml_exports.h"
/* {{{ proto void SimpleXMLIterator::rewind()
Rewind to first element */
-SPL_METHOD(SimpleXMLIterator, rewind)
+PHP_METHOD(ce_SimpleXMLIterator, rewind)
{
php_sxe_iterator iter;
iter.sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
- spl_ce_SimpleXMLElement->iterator_funcs.funcs->rewind((zend_object_iterator*)&iter TSRMLS_CC);
+ ce_SimpleXMLElement->iterator_funcs.funcs->rewind((zend_object_iterator*)&iter TSRMLS_CC);
}
/* }}} */
/* {{{ proto bool SimpleXMLIterator::valid()
Check whether iteration is valid */
-SPL_METHOD(SimpleXMLIterator, valid)
+PHP_METHOD(ce_SimpleXMLIterator, valid)
{
php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
@@ -64,7 +59,7 @@ SPL_METHOD(SimpleXMLIterator, valid)
/* {{{ proto SimpleXMLIterator SimpleXMLIterator::current()
Get current element */
-SPL_METHOD(SimpleXMLIterator, current)
+PHP_METHOD(ce_SimpleXMLIterator, current)
{
php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
@@ -78,7 +73,7 @@ SPL_METHOD(SimpleXMLIterator, current)
/* {{{ proto string SimpleXMLIterator::key()
Get name of current child element */
-SPL_METHOD(SimpleXMLIterator, key)
+PHP_METHOD(ce_SimpleXMLIterator, key)
{
xmlNodePtr curnode;
php_sxe_object *intern;
@@ -100,18 +95,18 @@ SPL_METHOD(SimpleXMLIterator, key)
/* {{{ proto void SimpleXMLIterator::next()
Move to next element */
-SPL_METHOD(SimpleXMLIterator, next)
+PHP_METHOD(ce_SimpleXMLIterator, next)
{
php_sxe_iterator iter;
iter.sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
- spl_ce_SimpleXMLElement->iterator_funcs.funcs->move_forward((zend_object_iterator*)&iter TSRMLS_CC);
+ ce_SimpleXMLElement->iterator_funcs.funcs->move_forward((zend_object_iterator*)&iter TSRMLS_CC);
}
/* }}} */
/* {{{ proto bool SimpleXMLIterator::hasChildren()
Check whether element has children (elements) */
-SPL_METHOD(SimpleXMLIterator, hasChildren)
+PHP_METHOD(ce_SimpleXMLIterator, hasChildren)
{
php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
php_sxe_object *child;
@@ -135,7 +130,7 @@ SPL_METHOD(SimpleXMLIterator, hasChildren)
/* {{{ proto SimpleXMLIterator SimpleXMLIterator::getChildren()
Get child element iterator */
-SPL_METHOD(SimpleXMLIterator, getChildren)
+PHP_METHOD(ce_SimpleXMLIterator, getChildren)
{
php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
@@ -145,46 +140,41 @@ SPL_METHOD(SimpleXMLIterator, getChildren)
RETURN_ZVAL(sxe->iter.data, 1, 0);
}
-static const zend_function_entry spl_funcs_SimpleXMLIterator[] = {
- SPL_ME(SimpleXMLIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(SimpleXMLIterator, valid, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(SimpleXMLIterator, current, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(SimpleXMLIterator, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(SimpleXMLIterator, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(SimpleXMLIterator, hasChildren, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(SimpleXMLIterator, getChildren, NULL, ZEND_ACC_PUBLIC)
+static const zend_function_entry funcs_SimpleXMLIterator[] = {
+ PHP_ME(ce_SimpleXMLIterator, rewind, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, valid, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, current, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, key, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, next, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, hasChildren, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, getChildren, NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
/* }}} */
-SPL_API PHP_MINIT_FUNCTION(spl_sxe) /* {{{ */
+PHP_MINIT_FUNCTION(sxe) /* {{{ */
{
zend_class_entry **pce;
+ zend_class_entry sxi;
if (zend_hash_find(CG(class_table), "simplexmlelement", sizeof("SimpleXMLElement"), (void **) &pce) == FAILURE) {
- spl_ce_SimpleXMLElement = NULL;
- spl_ce_SimpleXMLIterator = NULL;
+ ce_SimpleXMLElement = NULL;
+ ce_SimpleXMLIterator = NULL;
return SUCCESS; /* SimpleXML must be initialized before */
}
- spl_ce_SimpleXMLElement = *pce;
-
- REGISTER_SPL_SUB_CLASS_EX(SimpleXMLIterator, SimpleXMLElement, spl_ce_SimpleXMLElement->create_object, spl_funcs_SimpleXMLIterator);
- REGISTER_SPL_IMPLEMENTS(SimpleXMLIterator, RecursiveIterator);
- REGISTER_SPL_IMPLEMENTS(SimpleXMLIterator, Countable);
+ ce_SimpleXMLElement = *pce;
- return SUCCESS;
-}
-/* }}} */
+ INIT_CLASS_ENTRY_EX(sxi, "SimpleXMLIterator", strlen("SimpleXMLIterator"), funcs_SimpleXMLIterator);
+ ce_SimpleXMLIterator = zend_register_internal_class_ex(&sxi, ce_SimpleXMLElement, NULL TSRMLS_CC);
+ ce_SimpleXMLIterator->create_object = ce_SimpleXMLElement->create_object;
-#else /* HAVE_LIBXML && HAVE_SIMPLEXML */
+ zend_class_implements(ce_SimpleXMLIterator TSRMLS_CC, 1, spl_ce_RecursiveIterator);
+ zend_class_implements(ce_SimpleXMLIterator TSRMLS_CC, 1, spl_ce_Countable);
-SPL_API PHP_MINIT_FUNCTION(spl_sxe) /* {{{ */
-{
return SUCCESS;
}
-
-#endif /* HAVE_LIBXML && HAVE_SIMPLEXML */
+/* }}} */
/*
* Local variables:
diff --git a/ext/spl/spl_sxe.h b/ext/simplexml/sxe.h
index eca993e..439e451 100755
--- a/ext/spl/spl_sxe.h
+++ b/ext/simplexml/sxe.h
@@ -18,17 +18,16 @@
/* $Id$ */
-#ifndef SPL_SXE_H
-#define SPL_SXE_H
+#ifndef SXE_H
+#define SXE_H
#include "php.h"
-#include "php_spl.h"
-extern zend_class_entry *spl_ce_SimpleXMLIterator;
+extern zend_class_entry *ce_SimpleXMLIterator;
-SPL_API PHP_MINIT_FUNCTION(spl_sxe);
+PHP_MINIT_FUNCTION(sxe);
-#endif /* SPL_SXE_H */
+#endif /* SXE_H */
/*
* Local Variables:
diff --git a/ext/spl/tests/bug42259.phpt b/ext/simplexml/tests/bug42259.phpt
index 19c02a5..19c02a5 100644
--- a/ext/spl/tests/bug42259.phpt
+++ b/ext/simplexml/tests/bug42259.phpt
diff --git a/ext/spl/tests/sxe_001.phpt b/ext/simplexml/tests/sxe_001.phpt
index bb93eea..bb93eea 100755
--- a/ext/spl/tests/sxe_001.phpt
+++ b/ext/simplexml/tests/sxe_001.phpt
diff --git a/ext/spl/tests/sxe_002.phpt b/ext/simplexml/tests/sxe_002.phpt
index b937b01..b937b01 100755
--- a/ext/spl/tests/sxe_002.phpt
+++ b/ext/simplexml/tests/sxe_002.phpt
diff --git a/ext/spl/tests/sxe_003.phpt b/ext/simplexml/tests/sxe_003.phpt
index 58c7523..58c7523 100755
--- a/ext/spl/tests/sxe_003.phpt
+++ b/ext/simplexml/tests/sxe_003.phpt
diff --git a/ext/spl/tests/sxe_004.phpt b/ext/simplexml/tests/sxe_004.phpt
index 20431de..20431de 100755
--- a/ext/spl/tests/sxe_004.phpt
+++ b/ext/simplexml/tests/sxe_004.phpt
diff --git a/ext/spl/tests/sxe_005.phpt b/ext/simplexml/tests/sxe_005.phpt
index 183d351..183d351 100755
--- a/ext/spl/tests/sxe_005.phpt
+++ b/ext/simplexml/tests/sxe_005.phpt
diff --git a/ext/spl/config.m4 b/ext/spl/config.m4
index f4e9b5b..a0f0d1a 100755
--- a/ext/spl/config.m4
+++ b/ext/spl/config.m4
@@ -22,6 +22,6 @@ int main(int argc, char **argv) {
CPPFLAGS=$old_CPPFLAGS
AC_DEFINE_UNQUOTED(HAVE_PACKED_OBJECT_VALUE, $ac_result, [Whether struct _zend_object_value is packed])
AC_DEFINE(HAVE_SPL, 1, [Whether you want SPL (Standard PHP Library) support])
- PHP_NEW_EXTENSION(spl, php_spl.c spl_functions.c spl_engine.c spl_iterators.c spl_array.c spl_directory.c spl_sxe.c spl_exceptions.c spl_observer.c spl_dllist.c spl_heap.c spl_fixedarray.c, no)
- PHP_INSTALL_HEADERS([ext/spl], [php_spl.h spl_array.h spl_directory.h spl_engine.h spl_exceptions.h spl_functions.h spl_iterators.h spl_observer.h spl_sxe.h spl_dllist.h spl_heap.h spl_fixedarray.h])
+ PHP_NEW_EXTENSION(spl, php_spl.c spl_functions.c spl_engine.c spl_iterators.c spl_array.c spl_directory.c spl_exceptions.c spl_observer.c spl_dllist.c spl_heap.c spl_fixedarray.c, no)
+ PHP_INSTALL_HEADERS([ext/spl], [php_spl.h spl_array.h spl_directory.h spl_engine.h spl_exceptions.h spl_functions.h spl_iterators.h spl_observer.h spl_dllist.h spl_heap.h spl_fixedarray.h])
PHP_ADD_EXTENSION_DEP(spl, pcre, true)
diff --git a/ext/spl/config.w32 b/ext/spl/config.w32
index eeaec58..e594b0e 100644
--- a/ext/spl/config.w32
+++ b/ext/spl/config.w32
@@ -1,6 +1,6 @@
// $Id$
// vim:ft=javascript
-EXTENSION("spl", "php_spl.c spl_functions.c spl_engine.c spl_iterators.c spl_array.c spl_directory.c spl_sxe.c spl_exceptions.c spl_observer.c spl_dllist.c spl_heap.c spl_fixedarray.c", false /*never shared */);
+EXTENSION("spl", "php_spl.c spl_functions.c spl_engine.c spl_iterators.c spl_array.c spl_directory.c spl_exceptions.c spl_observer.c spl_dllist.c spl_heap.c spl_fixedarray.c", false /*never shared */);
AC_DEFINE('HAVE_SPL', 1);
PHP_SPL="yes";
diff --git a/ext/spl/package.xml b/ext/spl/package.xml
index f99cd7c..372aaec 100755
--- a/ext/spl/package.xml
+++ b/ext/spl/package.xml
@@ -34,8 +34,6 @@ standard problems.
<file role="src" name="spl_functions.h"/>
<file role="src" name="spl_iterators.c"/>
<file role="src" name="spl_iterators.h"/>
- <file role="src" name="spl_sxe.c"/>
- <file role="src" name="spl_sxe.h"/>
<file role="doc" name="CREDITS"/>
<file role="doc" name="README"/>
<file role="doc" name="TODO"/>
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 22a264b..8039ed1 100755
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -32,7 +32,6 @@
#include "spl_array.h"
#include "spl_directory.h"
#include "spl_iterators.h"
-#include "spl_sxe.h"
#include "spl_exceptions.h"
#include "spl_observer.h"
#include "spl_dllist.h"
@@ -191,7 +190,6 @@ PHP_FUNCTION(class_implements)
SPL_ADD_CLASS(RegexIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(RuntimeException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SeekableIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(SimpleXMLIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplDoublyLinkedList, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplFileInfo, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplFileObject, z_list, sub, allow, ce_flags); \
@@ -844,7 +842,6 @@ PHP_MINIT_FUNCTION(spl)
PHP_MINIT(spl_iterators)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_array)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_directory)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(spl_sxe)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_dllist)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_heap)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_fixedarray)(INIT_FUNC_ARGS_PASSTHRU);
@@ -877,23 +874,10 @@ PHP_RSHUTDOWN_FUNCTION(spl) /* {{{ */
return SUCCESS;
} /* }}} */
-#ifdef HAVE_SIMPLEXML
-static const zend_module_dep spl_deps[] = {
- ZEND_MOD_REQUIRED("libxml")
- ZEND_MOD_REQUIRED("simplexml")
- {NULL, NULL, NULL}
-};
-#endif
-
/* {{{ spl_module_entry
*/
zend_module_entry spl_module_entry = {
-#ifdef HAVE_SIMPLEXML
- STANDARD_MODULE_HEADER_EX, NULL,
- spl_deps,
-#else
STANDARD_MODULE_HEADER,
-#endif
"SPL",
spl_functions,
PHP_MINIT(spl),