]> granicus.if.org Git - php/commitdiff
- MFB spl/simplexml integration (when sxe is shared)
authorMarcus Boerger <helly@php.net>
Sat, 1 Oct 2005 15:55:27 +0000 (15:55 +0000)
committerMarcus Boerger <helly@php.net>
Sat, 1 Oct 2005 15:55:27 +0000 (15:55 +0000)
ext/simplexml/config.m4
ext/spl/config.m4
ext/spl/spl_sxe.c

index e4983504662d9e3bdc6ce6fb0975c7a186f230e1..7bc864409e58109838476ed188506f2b5450de54 100644 (file)
@@ -23,4 +23,5 @@ if test "$PHP_SIMPLEXML" != "no"; then
     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
index eea80921666f0bcd371eeaed0fc6c4537b419c8b..8f0b19084bb78d2ef11ca1e28cf69c63209f84e0 100755 (executable)
@@ -10,5 +10,4 @@ if test "$PHP_SPL" != "no"; then
   fi
   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, $ext_shared)
-  PHP_ADD_EXTENSION_DEP(spl, simplexml)
 fi
index 4120f640aaceacf91457fc6af64c69a12864d480..3f5ff4fa8c2fe7ff5c9f990bf024b92fc08202a4 100755 (executable)
@@ -146,13 +146,16 @@ static zend_function_entry spl_funcs_SimpleXMLIterator[] = {
 
 SPL_API PHP_MINIT_FUNCTION(spl_sxe) /* {{{ */
 {
-       zend_class_entry *spl_ce_SimpleXML_Element = sxe_get_element_class_entry(TSRMLS_C);
+       zend_class_entry **pce, *spl_ce_SimpleXMLElement;
 
-       if (!spl_ce_SimpleXML_Element) {
+       if (zend_hash_find(CG(class_table), "simplexmlelement", sizeof("SimpleXMLElement"), (void **) &pce) == FAILURE) {
+               spl_ce_SimpleXMLIterator = NULL;
                return SUCCESS; /* SimpleXML must be initialized before */
        }
 
-       REGISTER_SPL_SUB_CLASS_EX(SimpleXMLIterator, SimpleXML_Element, sxe_object_new, spl_funcs_SimpleXMLIterator);
+       spl_ce_SimpleXMLElement = *pce;
+
+       REGISTER_SPL_SUB_CLASS_EX(SimpleXMLIterator, SimpleXMLElement, sxe_object_new, spl_funcs_SimpleXMLIterator);
        REGISTER_SPL_IMPLEMENTS(SimpleXMLIterator, RecursiveIterator);
 
        return SUCCESS;