X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=php_http_request_factory.c;h=e739f53701ef0e345177c526adc873c29dfa3138;hb=737776929a44884a24c3e584162d771ada71f7e9;hp=79e348f15a95b5f1ec15d6945b92b5455062e650;hpb=8c69d38f5215bf073ff0a563b65c6ac067937de4;p=m6w6%2Fext-http diff --git a/php_http_request_factory.c b/php_http_request_factory.c index 79e348f..e739f53 100644 --- a/php_http_request_factory.c +++ b/php_http_request_factory.c @@ -113,13 +113,12 @@ PHP_METHOD(HttpRequestFactory, __construct) PHP_METHOD(HttpRequestFactory, createRequest) { - char *url_str = NULL; - int url_len; - long meth = -1; + char *meth_str = NULL, *url_str = NULL; + int meth_len, url_len; zval *options = NULL; with_error_handling(EH_THROW, php_http_exception_class_entry) { - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!la!", &url_str, &url_len, &meth, &options)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!a!", &url_str, &url_len, &meth_str, &meth_len, &options)) { with_error_handling(EH_THROW, php_http_exception_class_entry) { zval *zdriver, *os; zend_object_value ov; @@ -166,8 +165,8 @@ PHP_METHOD(HttpRequestFactory, createRequest) if (url_str) { zend_update_property_stringl(php_http_request_class_entry, return_value, ZEND_STRL("url"), url_str, url_len TSRMLS_CC); } - if (meth > 0) { - zend_update_property_long(php_http_request_class_entry, return_value, ZEND_STRL("method"), meth TSRMLS_CC); + if (meth_str) { + zend_update_property_stringl(php_http_request_class_entry, return_value, ZEND_STRL("method"), meth_str, meth_len TSRMLS_CC); } if (options) { zend_call_method_with_1_params(&return_value, Z_OBJCE_P(return_value), NULL, "setoptions", NULL, options);