@@ -390,16 +390,18 @@ STD_PHP_INI_ENTRY("soap.wsdl_cache_limit", "5", PHP_INI_ALL, OnUpdateLong,
390390 cache_limit , zend_soap_globals , soap_globals )
391391PHP_INI_END ()
392392
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 ;
394396
395397static void php_soap_prepare_globals (void )
396398{
397399 int i ;
398400 encode * enc ;
399401
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 );
403405
404406 i = 0 ;
405407 do {
@@ -412,35 +414,32 @@ static void php_soap_prepare_globals(void)
412414 size_t clark_notation_len = spprintf (& clark_notation , 0 , "{%s}%s" , enc -> details .ns , enc -> details .type_str );
413415 enc -> details .clark_notation = zend_string_init (clark_notation , clark_notation_len , true);
414416 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 );
416418 efree (clark_notation );
417419 efree (ns_type );
418420 } 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 );
420422 }
421423 }
422424 /* 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 );
424426 i ++ ;
425427 } while (defaultEncoding [i ].details .type != END_KNOWN_TYPES );
426428
427429 /* 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 );
434436}
435437
436438static void php_soap_init_globals (zend_soap_globals * soap_globals )
437439{
438440#if defined(COMPILE_DL_SOAP ) && defined(ZTS )
439441 ZEND_TSRMLS_CACHE_UPDATE ();
440442#endif
441- soap_globals -> defEnc = defEnc ;
442- soap_globals -> defEncIndex = defEncIndex ;
443- soap_globals -> defEncNs = defEncNs ;
444443 soap_globals -> typemap = NULL ;
445444 soap_globals -> use_soap_error_handler = 0 ;
446445 soap_globals -> error_code = NULL ;
@@ -461,9 +460,9 @@ PHP_MSHUTDOWN_FUNCTION(soap)
461460 i ++ ;
462461 } while (defaultEncoding [i ].details .type != END_KNOWN_TYPES );
463462 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 );
467466 if (SOAP_GLOBAL (mem_cache )) {
468467 zend_hash_destroy (SOAP_GLOBAL (mem_cache ));
469468 free (SOAP_GLOBAL (mem_cache ));
@@ -765,7 +764,7 @@ PHP_METHOD(SoapVar, __construct)
765764 if (type_is_null ) {
766765 ZVAL_LONG (Z_VAR_ENC_TYPE_P (this_ptr ), UNKNOWN_TYPE );
767766 } else {
768- if (zend_hash_index_exists (& SOAP_GLOBAL ( defEncIndex ) , type )) {
767+ if (zend_hash_index_exists (& php_soap_defEncIndex , type )) {
769768 ZVAL_LONG (Z_VAR_ENC_TYPE_P (this_ptr ), type );
770769 } else {
771770 zend_argument_value_error (2 , "is not a valid encoding" );
0 commit comments