php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #50816
Patch bug50816.patch revision 2011-07-30 16:06 UTC by laruence@php.net
revision 2011-07-30 15:24 UTC by laruence@php.net
Patch 50816-2.diff revision 2011-07-29 14:30 UTC by pierrick@php.net
revision 2011-07-29 04:14 UTC by pierrick@php.net
Patch 50816.diff revision 2011-07-29 00:54 UTC by pierrick@php.net

Patch bug50816.patch for Scripting Engine problem Bug #50816

Patch version 2011-07-30 16:06 UTC

Return to Bug #50816 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions: 2011-07-30 16:06 UTC | 2011-07-30 15:24 UTC

Developer: laruence@php.net



  Index: Zend/zend_hash.c
  ===================================================================
  --- Zend/zend_hash.c	(revision 313966)
  +++ Zend/zend_hash.c	(working copy)
 @@ -1187,14 +1187,25 @@
 @@ -1187,14 +1187,26 @@
   			}
   
   			if (mode != HASH_UPDATE_KEY_ANYWAY) {
  -				Bucket *q = ht->arBuckets[num_index & ht->nTableMask];
  -				int found = 0;
  +				Bucket *q, *t;
  +				int before = 0;
   
 +				q = ht->arBuckets[num_index & ht->nTableMask];
  +				t = ht->pListHead;
  +				while (t) {
 +					if (t == q) {
 +					if (!t->nKeyLength && t->h == num_index) {
  +						before = 1;
  +						break;
  +					}
  +					if (t == p) {
  +						break;
  +					}
  +					t = t->pListNext;
  +				}
 +
 +				q = ht->arBuckets[num_index & ht->nTableMask];
  +
   				while (q != NULL) {
  -					if (q == p) {
  -						found = 1;


  +						if (before) {
   							if (mode & HASH_UPDATE_KEY_IF_BEFORE) {
   								break;
   							} else {
 @@ -1230,16 +1241,27 @@
 @@ -1230,16 +1242,29 @@
   			}
   
   			if (mode != HASH_UPDATE_KEY_ANYWAY) {
  +				Bucket *q, *t;


   				ulong h = zend_inline_hash_func(str_index, str_length);
  -				Bucket *q = ht->arBuckets[h & ht->nTableMask];
  -				int found = 0;
   
 +				q = ht->arBuckets[h & ht->nTableMask];
  +				t = ht->pListHead;
  +				while (t) {
 +					if (t == q) {
 +					if (t->h == h && t->nKeyLength == str_length &&
 +							memcmp(t->arKey, str_index, str_length) == 0) {
  +						before = 1;
  +						break;
  +					}
  +					if (t == p) {
  +						break;
  +					}
  +					t = t->pListNext;
  +				}
 +
 +				q = ht->arBuckets[h & ht->nTableMask];
  +
   				while (q != NULL) {
  -					if (q == p) {
  -						found = 1;
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 18:01:58 2014 UTC