Hoo man has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/74186


Change subject: Fix the calculation of fss_resource_t->replace_size
......................................................................

Fix the calculation of fss_resource_t->replace_size

While this seems sane and certainly fixes the bug noted below
I'm not sure about the implications of this change although
it seems to work locally (I've never touched a PHP extension
before).

Tested with PHP 5.4.16

Bug: 51551
Change-Id: I49827fc0e671e86d8fd66677bf7f1b5fbf9baad1
---
M fss.c
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/php/FastStringSearch 
refs/changes/86/74186/1

diff --git a/fss.c b/fss.c
index 33767dc..dc22e3b 100644
--- a/fss.c
+++ b/fss.c
@@ -206,12 +206,13 @@
           header plus all the array elements, plus one extra element for good 
measure */
        res = safe_emalloc(sizeof(zval*), hash->nNumOfElements, 
sizeof(fss_resource_t));
        res->set = kwsalloc(NULL);
-       res->replace_size = hash->nNumOfElements;
+       res->replace_size = 0;
        
        for (zend_hash_internal_pointer_reset_ex(hash, &hpos), i = 0; 
                        zend_hash_get_current_data_ex(hash, (void**)&value, 
&hpos) == SUCCESS;
                        zend_hash_move_forward_ex(hash, &hpos), ++i)
        {
+               res->replace_size++;
                /* Convert numeric keys to string */
                if (zend_hash_get_current_key_ex(hash, &string_key, 
&string_key_len, &num_key, 0, 
                                        &hpos) == HASH_KEY_IS_LONG) 

-- 
To view, visit https://gerrit.wikimedia.org/r/74186
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I49827fc0e671e86d8fd66677bf7f1b5fbf9baad1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/php/FastStringSearch
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to