@@ -1600,16 +1600,19 @@ NR_INNER_WRAPPER(memcached_add_servers) {
1600
1600
if (SUCCESS
1601
1601
== zend_parse_parameters_ex (
1602
1602
ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "a" , & servers )) {
1603
- ZEND_HASH_FOREACH_VAL (Z_ARRVAL_P (servers ), server ) {
1604
- zval * host = nr_php_zend_hash_index_find (Z_ARRVAL_P (server ), 0 );
1605
- zval * port = nr_php_zend_hash_index_find (Z_ARRVAL_P (server ), 1 );
1606
- if (NULL != host && NULL != port ) {
1607
- instance = nr_php_memcached_create_datastore_instance (Z_STRVAL_P (host ), Z_LVAL_P (port ));
1608
- nr_php_instrument_datastore_operation (NR_DATASTORE_MEMCACHE ,
1609
- NULL , instance , true);
1603
+ if (Z_TYPE_P (servers ) == IS_ARRAY ) {
1604
+ ZEND_HASH_FOREACH_VAL (Z_ARRVAL_P (servers ), server ) {
1605
+ zval * host = nr_php_zend_hash_index_find (Z_ARRVAL_P (server ), 0 );
1606
+ zval * port = nr_php_zend_hash_index_find (Z_ARRVAL_P (server ), 1 );
1607
+ if (NULL != host && NULL != port &&
1608
+ Z_TYPE_P (host ) == IS_STRING && Z_TYPE_P (port ) == IS_LONG ) {
1609
+ instance = nr_php_memcached_create_datastore_instance (Z_STRVAL_P (host ), Z_LVAL_P (port ));
1610
+ nr_php_instrument_datastore_operation (NR_DATASTORE_MEMCACHE ,
1611
+ NULL , instance , true);
1612
+ }
1610
1613
}
1614
+ ZEND_HASH_FOREACH_END ();
1611
1615
}
1612
- ZEND_HASH_FOREACH_END ();
1613
1616
}
1614
1617
zcaught = nr_zend_call_old_handler (nr_wrapper -> oldhandler ,
1615
1618
INTERNAL_FUNCTION_PARAM_PASSTHRU );
0 commit comments