Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

possible fix
Tuesday, October 31st, 2006 at 11:19:47am UTC 

  1. --- zend_hash.old       2006-08-24 12:30:56.000000000 +0100
  2. +++ zend_hash.new       2006-10-31 10:05:16.102177000 +0000
  3. @@ -656,18 +656,24 @@
  4.  ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
  5.  {
  6.         Bucket *p;
  7. -
  8. +       int retval;
  9. +   
  10.         IS_CONSISTENT(ht);
  11.  
  12.         HASH_PROTECT_RECURSION(ht);
  13.         p = ht->pListHead;
  14.         while (p != NULL) {
  15. -              if (apply_func(p->pData TSRMLS_CC)) {
  16. +              retval = apply_func(p->pData TSRMLS_CC);
  17. +
  18. +              if (ZEND_HASH_APPLY_STOP == retval) {
  19. +                     break;
  20. +              } else if (retval == ZEND_HASH_APPLY_REMOVE) {
  21.                       p = zend_hash_apply_deleter(ht, p);
  22.                } else {
  23.                       p = p->pListNext;
  24.                }
  25.         }
  26. +
  27.         HASH_UNPROTECT_RECURSION(ht);
  28.  }
  29.  
  30. @@ -675,13 +681,18 @@
  31.  ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC)
  32.  {
  33.         Bucket *p;
  34. +       int retval;
  35.  
  36.         IS_CONSISTENT(ht);
  37.  
  38.         HASH_PROTECT_RECURSION(ht);
  39.         p = ht->pListHead;
  40.         while (p != NULL) {
  41. -              if (apply_func(p->pData, argument TSRMLS_CC)) {
  42. +              retval = apply_func(p->pData, argument TSRMLS_CC);
  43. +
  44. +              if (ZEND_HASH_APPLY_STOP == retval) {
  45. +                     break;
  46. +              } else if (retval == ZEND_HASH_APPLY_REMOVE) {
  47.                       p = zend_hash_apply_deleter(ht, p);
  48.                } else {
  49.                       p = p->pListNext;
  50. @@ -691,11 +702,12 @@
  51.  }
  52.  
  53.  
  54. -ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t destruct, int num_args, ...)
  55. +ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int num_args, ...)
  56.  {
  57.         Bucket *p;
  58.         va_list args;
  59.         zend_hash_key hash_key;
  60. +       int retval;
  61.  
  62.         IS_CONSISTENT(ht);
  63.  
  64. @@ -707,11 +719,17 @@
  65.                hash_key.arKey = p->arKey;
  66.                hash_key.nKeyLength = p->nKeyLength;
  67.                hash_key.h = p->h;
  68. -              if (destruct(p->pData, num_args, args, &hash_key)) {
  69. +
  70. +              retval =  apply_func(p->pData, num_args, args, &hash_key);
  71. +
  72. +              if (ZEND_HASH_APPLY_STOP == retval) {
  73. +                     break;
  74. +              } else if (retval == ZEND_HASH_APPLY_REMOVE) {
  75.                       p = zend_hash_apply_deleter(ht, p);
  76.                } else {
  77.                       p = p->pListNext;
  78.                }
  79. +
  80.                va_end(args);
  81.         }
  82.  

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right worth-right