@@ -930,6 +930,18 @@ static HashTable* soap_create_typemap(sdlPtr sdl, HashTable *ht) /* {{{ */
930930}
931931/* }}} */
932932
933+ static bool soap_class_map_is_valid (const HashTable * class_map )
934+ {
935+ zend_string * key ;
936+ ZEND_HASH_FOREACH_STR_KEY (class_map , key ) {
937+ if (UNEXPECTED (key == NULL )) {
938+ return false;
939+ }
940+ } ZEND_HASH_FOREACH_END ();
941+
942+ return true;
943+ }
944+
933945/* {{{ SoapServer constructor */
934946PHP_METHOD (SoapServer , __construct )
935947{
@@ -1007,8 +1019,7 @@ PHP_METHOD(SoapServer, __construct)
10071019 zend_argument_type_error (2 , "\"classmap\" option must be of type array, %s given" , zend_zval_type_name (class_map_zv ));
10081020 goto cleanup ;
10091021 }
1010- // TODO: this still accepts mixed keys arrays and not all numerically indexed arrays are packed
1011- if (UNEXPECTED (HT_IS_PACKED (Z_ARRVAL_P (class_map_zv )))) {
1022+ if (UNEXPECTED (!soap_class_map_is_valid (Z_ARRVAL_P (class_map_zv )))) {
10121023 zend_argument_value_error (2 , "\"classmap\" option must be an associative array" );
10131024 goto cleanup ;
10141025 }
@@ -2233,7 +2244,7 @@ PHP_METHOD(SoapClient, __construct)
22332244 }
22342245 if ((tmp = zend_hash_str_find (ht , "classmap" , sizeof ("classmap" )- 1 )) != NULL &&
22352246 Z_TYPE_P (tmp ) == IS_ARRAY ) {
2236- if (UNEXPECTED (HT_IS_PACKED (Z_ARRVAL_P (tmp )))) {
2247+ if (UNEXPECTED (! soap_class_map_is_valid (Z_ARRVAL_P (tmp )))) {
22372248 php_error_docref (NULL , E_ERROR , "'classmap' option must be an associative array" );
22382249 }
22392250 ZVAL_COPY (Z_CLIENT_CLASSMAP_P (this_ptr ), tmp );
0 commit comments