33
33
#include "zend_interfaces.h"
34
34
#include "ext/spl/spl_iterators.h"
35
35
36
- zend_class_entry * sxe_class_entry = NULL ;
37
36
PHP_SXE_API zend_class_entry * ce_SimpleXMLIterator ;
38
37
PHP_SXE_API zend_class_entry * ce_SimpleXMLElement ;
39
38
40
39
PHP_SXE_API zend_class_entry * sxe_get_element_class_entry (void ) /* {{{ */
41
40
{
42
- return sxe_class_entry ;
41
+ return ce_SimpleXMLElement ;
43
42
}
44
43
/* }}} */
45
44
@@ -471,7 +470,7 @@ static zval *sxe_prop_dim_write(zend_object *object, zval *member, zval *value,
471
470
value_str = zval_get_string (value );
472
471
break ;
473
472
case IS_OBJECT :
474
- if (Z_OBJCE_P (value ) == sxe_class_entry ) {
473
+ if (Z_OBJCE_P (value ) == ce_SimpleXMLElement ) {
475
474
zval zval_copy ;
476
475
if (sxe_object_cast_ex (Z_OBJ_P (value ), & zval_copy , IS_STRING ) == FAILURE ) {
477
476
zend_throw_error (NULL , "Unable to cast node to string" );
@@ -2184,7 +2183,7 @@ static zend_function* php_sxe_find_fptr_count(zend_class_entry *ce)
2184
2183
int inherited = 0 ;
2185
2184
2186
2185
while (parent ) {
2187
- if (parent == sxe_class_entry ) {
2186
+ if (parent == ce_SimpleXMLElement ) {
2188
2187
break ;
2189
2188
}
2190
2189
parent = parent -> parent ;
@@ -2242,7 +2241,7 @@ PHP_FUNCTION(simplexml_load_file)
2242
2241
char * ns = NULL ;
2243
2242
size_t ns_len = 0 ;
2244
2243
zend_long options = 0 ;
2245
- zend_class_entry * ce = sxe_class_entry ;
2244
+ zend_class_entry * ce = ce_SimpleXMLElement ;
2246
2245
zend_function * fptr_count ;
2247
2246
bool isprefix = 0 ;
2248
2247
@@ -2262,7 +2261,7 @@ PHP_FUNCTION(simplexml_load_file)
2262
2261
}
2263
2262
2264
2263
if (!ce ) {
2265
- ce = sxe_class_entry ;
2264
+ ce = ce_SimpleXMLElement ;
2266
2265
fptr_count = NULL ;
2267
2266
} else {
2268
2267
fptr_count = php_sxe_find_fptr_count (ce );
@@ -2287,7 +2286,7 @@ PHP_FUNCTION(simplexml_load_string)
2287
2286
char * ns = NULL ;
2288
2287
size_t ns_len = 0 ;
2289
2288
zend_long options = 0 ;
2290
- zend_class_entry * ce = sxe_class_entry ;
2289
+ zend_class_entry * ce = ce_SimpleXMLElement ;
2291
2290
zend_function * fptr_count ;
2292
2291
bool isprefix = 0 ;
2293
2292
@@ -2315,7 +2314,7 @@ PHP_FUNCTION(simplexml_load_string)
2315
2314
}
2316
2315
2317
2316
if (!ce ) {
2318
- ce = sxe_class_entry ;
2317
+ ce = ce_SimpleXMLElement ;
2319
2318
fptr_count = NULL ;
2320
2319
} else {
2321
2320
fptr_count = php_sxe_find_fptr_count (ce );
@@ -2589,7 +2588,7 @@ PHP_FUNCTION(simplexml_import_dom)
2589
2588
zval * node ;
2590
2589
php_libxml_node_object * object ;
2591
2590
xmlNodePtr nodep = NULL ;
2592
- zend_class_entry * ce = sxe_class_entry ;
2591
+ zend_class_entry * ce = ce_SimpleXMLElement ;
2593
2592
zend_function * fptr_count ;
2594
2593
2595
2594
if (zend_parse_parameters (ZEND_NUM_ARGS (), "o|C!" , & node , & ce ) == FAILURE ) {
@@ -2614,7 +2613,7 @@ PHP_FUNCTION(simplexml_import_dom)
2614
2613
2615
2614
if (nodep && nodep -> type == XML_ELEMENT_NODE ) {
2616
2615
if (!ce ) {
2617
- ce = sxe_class_entry ;
2616
+ ce = ce_SimpleXMLElement ;
2618
2617
fptr_count = NULL ;
2619
2618
} else {
2620
2619
fptr_count = php_sxe_find_fptr_count (ce );
@@ -2664,10 +2663,10 @@ ZEND_GET_MODULE(simplexml)
2664
2663
/* {{{ PHP_MINIT_FUNCTION(simplexml) */
2665
2664
PHP_MINIT_FUNCTION (simplexml )
2666
2665
{
2667
- sxe_class_entry = register_class_SimpleXMLElement (zend_ce_stringable , zend_ce_countable , spl_ce_RecursiveIterator );
2668
- sxe_class_entry -> create_object = sxe_object_new ;
2669
- sxe_class_entry -> default_object_handlers = & sxe_object_handlers ;
2670
- sxe_class_entry -> get_iterator = php_sxe_get_iterator ;
2666
+ ce_SimpleXMLElement = register_class_SimpleXMLElement (zend_ce_stringable , zend_ce_countable , spl_ce_RecursiveIterator );
2667
+ ce_SimpleXMLElement -> create_object = sxe_object_new ;
2668
+ ce_SimpleXMLElement -> default_object_handlers = & sxe_object_handlers ;
2669
+ ce_SimpleXMLElement -> get_iterator = php_sxe_get_iterator ;
2671
2670
2672
2671
memcpy (& sxe_object_handlers , & std_object_handlers , sizeof (zend_object_handlers ));
2673
2672
sxe_object_handlers .offset = XtOffsetOf (php_sxe_object , zo );
@@ -2690,12 +2689,9 @@ PHP_MINIT_FUNCTION(simplexml)
2690
2689
sxe_object_handlers .get_closure = NULL ;
2691
2690
sxe_object_handlers .get_gc = sxe_get_gc ;
2692
2691
2693
- /* TODO: Why do we have two variables for this? */
2694
- ce_SimpleXMLElement = sxe_class_entry ;
2695
-
2696
2692
ce_SimpleXMLIterator = register_class_SimpleXMLIterator (ce_SimpleXMLElement );
2697
2693
2698
- php_libxml_register_export (sxe_class_entry , simplexml_export_node );
2694
+ php_libxml_register_export (ce_SimpleXMLElement , simplexml_export_node );
2699
2695
2700
2696
return SUCCESS ;
2701
2697
}
@@ -2704,7 +2700,7 @@ PHP_MINIT_FUNCTION(simplexml)
2704
2700
/* {{{ PHP_MSHUTDOWN_FUNCTION(simplexml) */
2705
2701
PHP_MSHUTDOWN_FUNCTION (simplexml )
2706
2702
{
2707
- sxe_class_entry = NULL ;
2703
+ ce_SimpleXMLElement = NULL ;
2708
2704
return SUCCESS ;
2709
2705
}
2710
2706
/* }}} */
0 commit comments