Created
May 5, 2018 03:34
-
-
Save laruence/fbd376dee88e117e399aac93fd031c5e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c | |
index 1d6519e..26d6448 100644 | |
--- a/Zend/zend_hash.c | |
+++ b/Zend/zend_hash.c | |
@@ -40,6 +40,12 @@ | |
#define HT_POISONED_PTR ((HashTable *) (intptr_t) -1) | |
+static void record_conflicts() { | |
+ FILE *fp = fopen("/tmp/conflicts.log", "a"); | |
+ fprintf(fp, "1\n"); | |
+ fclose(fp); | |
+} | |
+ | |
#if ZEND_DEBUG | |
#define HT_OK 0x00 | |
@@ -690,6 +696,9 @@ add_to_hash: | |
p->h = h = ZSTR_H(key); | |
nIndex = h | ht->nTableMask; | |
Z_NEXT(p->val) = HT_HASH_EX(arData, nIndex); | |
+ if (UNEXPECTED(Z_NEXT(p->val) != HT_INVALID_IDX)) { | |
+ record_conflicts(); | |
+ } | |
HT_HASH_EX(arData, nIndex) = HT_IDX_TO_HASH(idx); | |
ZVAL_COPY_VALUE(&p->val, pData); | |
@@ -758,6 +767,9 @@ add_to_hash: | |
ZVAL_COPY_VALUE(&p->val, pData); | |
nIndex = h | ht->nTableMask; | |
Z_NEXT(p->val) = HT_HASH(ht, nIndex); | |
+ if (UNEXPECTED(Z_NEXT(p->val) != HT_INVALID_IDX)) { | |
+ record_conflicts(); | |
+ } | |
HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx); | |
return &p->val; | |
@@ -947,6 +959,9 @@ add_to_hash: | |
nIndex = h | ht->nTableMask; | |
ZVAL_COPY_VALUE(&p->val, pData); | |
Z_NEXT(p->val) = HT_HASH(ht, nIndex); | |
+ if (UNEXPECTED(Z_NEXT(p->val) != HT_INVALID_IDX)) { | |
+ record_conflicts(); | |
+ } | |
HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx); | |
return &p->val; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment