dmitry Thu Mar 18 04:48:46 2004 EDT Modified files: /php-src/ext/standard string.c Log: BUG #27457 was fixed (using temporary hash table with string keys only) http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.412&r2=1.413&ty=u Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.412 php-src/ext/standard/string.c:1.413 --- php-src/ext/standard/string.c:1.412 Wed Feb 25 15:16:26 2004 +++ php-src/ext/standard/string.c Thu Mar 18 04:48:37 2004 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.412 2004/02/25 20:16:26 abies Exp $ */ +/* $Id: string.c,v 1.413 2004/03/18 09:48:37 dmitry Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -2301,15 +2301,19 @@ char *key; HashPosition hpos; smart_str result = {0}; + HashTable tmp_hash; + zend_hash_init(&tmp_hash, 0, NULL, NULL, 0); zend_hash_internal_pointer_reset_ex(hash, &hpos); while (zend_hash_get_current_data_ex(hash, (void **)&entry, &hpos) == SUCCESS) { switch (zend_hash_get_current_key_ex(hash, &string_key, &string_key_len, &num_key, 0, &hpos)) { case HASH_KEY_IS_STRING: len = string_key_len-1; if (len < 1) { + zend_hash_destroy(&tmp_hash); RETURN_FALSE; } + zend_hash_add(&tmp_hash, string_key, string_key_len, entry, sizeof(zval*), NULL); if (len > maxlen) { maxlen = len; } @@ -2324,6 +2328,7 @@ convert_to_string(&ctmp); len = Z_STRLEN(ctmp); + zend_hash_add(&tmp_hash, Z_STRVAL(ctmp), len+1, entry, sizeof(zval*), NULL); zval_dtor(&ctmp); if (len > maxlen) { @@ -2351,7 +2356,7 @@ for (len = maxlen; len >= minlen; len--) { key[len] = 0; - if (zend_hash_find(hash, key, len+1, (void**)&trans) == SUCCESS) { + if (zend_hash_find(&tmp_hash, key, len+1, (void**)&trans) == SUCCESS) { char *tval; int tlen; zval tmp; @@ -2384,6 +2389,7 @@ } efree(key); + zend_hash_destroy(&tmp_hash); smart_str_0(&result); RETVAL_STRINGL(result.c, result.len, 0); }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php