@@ -390,16 +390,18 @@ STD_PHP_INI_ENTRY("soap.wsdl_cache_limit", "5", PHP_INI_ALL, OnUpdateLong,
390
390
cache_limit , zend_soap_globals , soap_globals )
391
391
PHP_INI_END ()
392
392
393
- static HashTable defEnc , defEncIndex , defEncNs ;
393
+ /* Real globals shared for the entire processes across threads, only written during init. */
394
+ HashTable php_soap_defEncNs ; /* mapping of default namespaces to prefixes */
395
+ HashTable php_soap_defEnc , php_soap_defEncIndex ;
394
396
395
397
static void php_soap_prepare_globals (void )
396
398
{
397
399
int i ;
398
400
encode * enc ;
399
401
400
- zend_hash_init (& defEnc , 0 , NULL , NULL , 1 );
401
- zend_hash_init (& defEncIndex , 0 , NULL , NULL , 1 );
402
- zend_hash_init (& defEncNs , 0 , NULL , NULL , 1 );
402
+ zend_hash_init (& php_soap_defEnc , 0 , NULL , NULL , 1 );
403
+ zend_hash_init (& php_soap_defEncIndex , 0 , NULL , NULL , 1 );
404
+ zend_hash_init (& php_soap_defEncNs , 0 , NULL , NULL , 1 );
403
405
404
406
i = 0 ;
405
407
do {
@@ -412,35 +414,32 @@ static void php_soap_prepare_globals(void)
412
414
size_t clark_notation_len = spprintf (& clark_notation , 0 , "{%s}%s" , enc -> details .ns , enc -> details .type_str );
413
415
enc -> details .clark_notation = zend_string_init (clark_notation , clark_notation_len , true);
414
416
size_t ns_type_len = spprintf (& ns_type , 0 , "%s:%s" , enc -> details .ns , enc -> details .type_str );
415
- zend_hash_str_add_ptr (& defEnc , ns_type , ns_type_len , (void * )enc );
417
+ zend_hash_str_add_ptr (& php_soap_defEnc , ns_type , ns_type_len , (void * )enc );
416
418
efree (clark_notation );
417
419
efree (ns_type );
418
420
} else {
419
- zend_hash_str_add_ptr (& defEnc , defaultEncoding [i ].details .type_str , strlen (defaultEncoding [i ].details .type_str ), (void * )enc );
421
+ zend_hash_str_add_ptr (& php_soap_defEnc , defaultEncoding [i ].details .type_str , strlen (defaultEncoding [i ].details .type_str ), (void * )enc );
420
422
}
421
423
}
422
424
/* Index everything by number */
423
- zend_hash_index_add_ptr (& defEncIndex , defaultEncoding [i ].details .type , (void * )enc );
425
+ zend_hash_index_add_ptr (& php_soap_defEncIndex , defaultEncoding [i ].details .type , (void * )enc );
424
426
i ++ ;
425
427
} while (defaultEncoding [i ].details .type != END_KNOWN_TYPES );
426
428
427
429
/* hash by namespace */
428
- zend_hash_str_add_ptr (& defEncNs , XSD_1999_NAMESPACE , sizeof (XSD_1999_NAMESPACE )- 1 , XSD_NS_PREFIX );
429
- zend_hash_str_add_ptr (& defEncNs , XSD_NAMESPACE , sizeof (XSD_NAMESPACE )- 1 , XSD_NS_PREFIX );
430
- zend_hash_str_add_ptr (& defEncNs , XSI_NAMESPACE , sizeof (XSI_NAMESPACE )- 1 , XSI_NS_PREFIX );
431
- zend_hash_str_add_ptr (& defEncNs , XML_NAMESPACE , sizeof (XML_NAMESPACE )- 1 , XML_NS_PREFIX );
432
- zend_hash_str_add_ptr (& defEncNs , SOAP_1_1_ENC_NAMESPACE , sizeof (SOAP_1_1_ENC_NAMESPACE )- 1 , SOAP_1_1_ENC_NS_PREFIX );
433
- zend_hash_str_add_ptr (& defEncNs , SOAP_1_2_ENC_NAMESPACE , sizeof (SOAP_1_2_ENC_NAMESPACE )- 1 , SOAP_1_2_ENC_NS_PREFIX );
430
+ zend_hash_str_add_ptr (& php_soap_defEncNs , XSD_1999_NAMESPACE , sizeof (XSD_1999_NAMESPACE )- 1 , XSD_NS_PREFIX );
431
+ zend_hash_str_add_ptr (& php_soap_defEncNs , XSD_NAMESPACE , sizeof (XSD_NAMESPACE )- 1 , XSD_NS_PREFIX );
432
+ zend_hash_str_add_ptr (& php_soap_defEncNs , XSI_NAMESPACE , sizeof (XSI_NAMESPACE )- 1 , XSI_NS_PREFIX );
433
+ zend_hash_str_add_ptr (& php_soap_defEncNs , XML_NAMESPACE , sizeof (XML_NAMESPACE )- 1 , XML_NS_PREFIX );
434
+ zend_hash_str_add_ptr (& php_soap_defEncNs , SOAP_1_1_ENC_NAMESPACE , sizeof (SOAP_1_1_ENC_NAMESPACE )- 1 , SOAP_1_1_ENC_NS_PREFIX );
435
+ zend_hash_str_add_ptr (& php_soap_defEncNs , SOAP_1_2_ENC_NAMESPACE , sizeof (SOAP_1_2_ENC_NAMESPACE )- 1 , SOAP_1_2_ENC_NS_PREFIX );
434
436
}
435
437
436
438
static void php_soap_init_globals (zend_soap_globals * soap_globals )
437
439
{
438
440
#if defined(COMPILE_DL_SOAP ) && defined(ZTS )
439
441
ZEND_TSRMLS_CACHE_UPDATE ();
440
442
#endif
441
- soap_globals -> defEnc = defEnc ;
442
- soap_globals -> defEncIndex = defEncIndex ;
443
- soap_globals -> defEncNs = defEncNs ;
444
443
soap_globals -> typemap = NULL ;
445
444
soap_globals -> use_soap_error_handler = 0 ;
446
445
soap_globals -> error_code = NULL ;
@@ -461,9 +460,9 @@ PHP_MSHUTDOWN_FUNCTION(soap)
461
460
i ++ ;
462
461
} while (defaultEncoding [i ].details .type != END_KNOWN_TYPES );
463
462
zend_error_cb = old_error_handler ;
464
- zend_hash_destroy (& SOAP_GLOBAL ( defEnc ) );
465
- zend_hash_destroy (& SOAP_GLOBAL ( defEncIndex ) );
466
- zend_hash_destroy (& SOAP_GLOBAL ( defEncNs ) );
463
+ zend_hash_destroy (& php_soap_defEnc );
464
+ zend_hash_destroy (& php_soap_defEncIndex );
465
+ zend_hash_destroy (& php_soap_defEncNs );
467
466
if (SOAP_GLOBAL (mem_cache )) {
468
467
zend_hash_destroy (SOAP_GLOBAL (mem_cache ));
469
468
free (SOAP_GLOBAL (mem_cache ));
@@ -765,7 +764,7 @@ PHP_METHOD(SoapVar, __construct)
765
764
if (type_is_null ) {
766
765
ZVAL_LONG (Z_VAR_ENC_TYPE_P (this_ptr ), UNKNOWN_TYPE );
767
766
} else {
768
- if (zend_hash_index_exists (& SOAP_GLOBAL ( defEncIndex ) , type )) {
767
+ if (zend_hash_index_exists (& php_soap_defEncIndex , type )) {
769
768
ZVAL_LONG (Z_VAR_ENC_TYPE_P (this_ptr ), type );
770
769
} else {
771
770
zend_argument_value_error (2 , "is not a valid encoding" );
0 commit comments