Fix bug #63947 $_POST set as NULL for GET when Content-Type is set as application...
[m6w6/ext-http] / php_http_client_factory.c
index a7052115b8ef6205310a043f544de87c3918d25e..d97f68640f10c3076962cdc0ac4cdc3d01214726 100644 (file)
@@ -38,10 +38,8 @@ PHP_HTTP_API STATUS php_http_client_factory_get_driver(const char *name_str, siz
 static zend_class_entry *php_http_client_factory_find_class_entry(zval *this_ptr, const char *for_str, size_t for_len TSRMLS_DC)
 {
        /* stupid non-const api */
-       char *sc = estrndup(for_str, for_len);
-       zval *cn = zend_read_property(Z_OBJCE_P(getThis()), getThis(), sc, for_len, 0 TSRMLS_CC);
+       zval *cn = zend_read_property(Z_OBJCE_P(getThis()), getThis(), for_str, for_len, 0 TSRMLS_CC);
 
-       efree(sc);
        if (Z_TYPE_P(cn) == IS_STRING && Z_STRLEN_P(cn)) {
                return zend_fetch_class(Z_STRVAL_P(cn), Z_STRLEN_P(cn), 0 TSRMLS_CC);
        }
@@ -174,10 +172,10 @@ PHP_METHOD(HttpClientFactory, createClient)
 PHP_METHOD(HttpClientFactory, createPool)
 {
        int argc = 0;
-       zval ***argv;
+       zval ***argv = NULL;
 
        with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
-               if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|*", &argv, &argc)) {
+               if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "*", &argv, &argc)) {
                        with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
                                int i;
                                zval *zdriver;
@@ -228,6 +226,10 @@ PHP_METHOD(HttpClientFactory, createPool)
                                        php_http_error(HE_WARNING, PHP_HTTP_E_REQUEST_FACTORY, "pools are not supported by this driver");
                                }
                        } end_error_handling();
+                       
+                       if (argv) {
+                               efree(argv);
+                       }
                }
        } end_error_handling();
 }
@@ -235,10 +237,10 @@ PHP_METHOD(HttpClientFactory, createPool)
 PHP_METHOD(HttpClientFactory, createDataShare)
 {
        int argc = 0;
-       zval ***argv;
+       zval ***argv = NULL;
 
        with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
-               if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|*", &argv, &argc)) {
+               if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "*", &argv, &argc)) {
                        with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
                                int i;
                                zval *zdriver;
@@ -289,6 +291,9 @@ PHP_METHOD(HttpClientFactory, createDataShare)
                                        php_http_error(HE_WARNING, PHP_HTTP_E_REQUEST_FACTORY, "datashares are not supported by this driver");
                                }
                        } end_error_handling();
+                       if (argv) {
+                               efree(argv);
+                       }
                }
        } end_error_handling();
 }