php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #63180
Patch interned_keys.patch revision 2012-09-28 16:20 UTC by vesselin dot atanasov at gmail dot com

Patch interned_keys.patch for Scripting Engine problem Bug #63180

Patch version 2012-09-28 16:20 UTC

Return to Bug #63180 | Download this patch
Patch Revisions:

Developer: vesselin.atanasov@gmail.com

--- php-5.4.5/Zend/zend_hash.c.interned_keys	2012-07-18 09:19:16.000000000 +0300
+++ php-5.4.5/Zend/zend_hash.c	2012-09-28 06:42:14.000000000 +0300
@@ -243,8 +243,8 @@
 		p = p->pNext;
 	}
 	
-	if (IS_INTERNED(arKey)) {
-		p = (Bucket *) pemalloc(sizeof(Bucket), ht->persistent);
+	if (!ht->persistent && IS_INTERNED(arKey)) {
+		p = (Bucket *) emalloc(sizeof(Bucket));
 		if (!p) {
 			return FAILURE;
 		}
@@ -320,8 +320,8 @@
 		p = p->pNext;
 	}
 	
-	if (IS_INTERNED(arKey)) {
-		p = (Bucket *) pemalloc(sizeof(Bucket), ht->persistent);
+	if (!ht->persistent && IS_INTERNED(arKey)) {
+		p = (Bucket *) emalloc(sizeof(Bucket));
 		if (!p) {
 			return FAILURE;
 		}
@@ -1360,8 +1360,8 @@
 		    (!IS_INTERNED(p->arKey) && p->nKeyLength != str_length)) {
 			Bucket *q;
 
-			if (IS_INTERNED(str_index)) {
-				q = (Bucket *) pemalloc(sizeof(Bucket), ht->persistent);
+			if (!ht->persistent && IS_INTERNED(str_index)) {
+				q = (Bucket *) emalloc(sizeof(Bucket));
 			} else {
 				q = (Bucket *) pemalloc(sizeof(Bucket) + str_length, ht->persistent);
 			}
@@ -1400,7 +1400,7 @@
 		} else {
 			p->h = h;
 			p->nKeyLength = str_length;
-			if (IS_INTERNED(str_index)) {
+			if (!ht->persistent && IS_INTERNED(str_index)) {
 				p->arKey = str_index;
 			} else {
 				p->arKey = (const char*)(p+1);
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sun Apr 20 10:02:06 2014 UTC