negotiation test & fixes
[m6w6/ext-http] / php_http_negotiate.c
index 9365ce6c4d437e0de344afc2f449f603962e9fb5..69c73934b02e9dbec810236bd0a5b99bed8895d4 100644 (file)
@@ -10,9 +10,7 @@
     +--------------------------------------------------------------------+
 */
 
-#include "php_http.h"
-
-#include <ext/standard/php_string.h>
+#include "php_http_api.h"
 
 static int php_http_negotiate_sort(const void *a, const void *b TSRMLS_DC)
 {
@@ -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;
                        }