negotiation test & fixes
[m6w6/ext-http] / php_http_negotiate.c
index 928a31df18a81eaa4d4cbd26bd23dcacea6cca0a..69c73934b02e9dbec810236bd0a5b99bed8895d4 100644 (file)
@@ -12,8 +12,6 @@
 
 #include "php_http_api.h"
 
-#include <ext/standard/php_string.h>
-
 static int php_http_negotiate_sort(const void *a, const void *b TSRMLS_DC)
 {
        zval result, *first, *second;
@@ -76,6 +74,11 @@ PHP_HTTP_API HashTable *php_http_negotiate(const char *value_str, size_t value_l
 
                                q = Z_DVAL_P(tmp);
                                zval_ptr_dtor(&tmp);
+
+                               if (!q) {
+                                       STR_FREE(key.str);
+                                       continue;
+                               }
                        } else {
                                q = 1.0 - ++i / 100.0;
                        }