php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch php-trunk-substr_replace-array-keys for Strings related Bug #55366

Patch version 2011-08-05 09:45 UTC

Return to Bug #55366 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions: 2011-08-05 10:20 UTC | 2011-08-05 09:45 UTC

Developer: arpad@php.net



  +
   		array_init(return_value);
   
   		if (Z_TYPE_PP(from) == IS_ARRAY) {
 @@ -2533,7 +2537,13 @@
 @@ -2414,6 +2418,8 @@
  
  		zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(str), &pos_str);
  		while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(str), (void **) &tmp_str, &pos_str) == SUCCESS) {
 +			zend_hash_get_current_key_ex(Z_ARRVAL_PP(str), &str_index, &str_index_len, &num_index, 0, &pos_str);
 +
  			zval *orig_str;
  			zval dummy;
  			if(Z_TYPE_PP(tmp_str) != IS_STRING) {
 @@ -2533,7 +2539,13 @@
   			}
   
   			result[result_len] = '\0';
  -			add_next_index_stringl(return_value, result, result_len, 0);
  +
 +			if (zend_hash_get_current_key_ex(Z_ARRVAL_PP(str), &str_index, &str_index_len, &num_index, 0, &pos_str) == HASH_KEY_IS_STRING) {
 +			if (zend_hash_get_current_key_type_ex(Z_ARRVAL_PP(str), &pos_str) == HASH_KEY_IS_STRING) {
  +				add_assoc_stringl_ex(return_value, str_index, str_index_len, result, result_len, 0);
  +			} else {
  +				add_index_stringl(return_value, num_index, result, result_len, 0);
  +			}
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 08:02:55 2014 UTC