From: Michael Wallner Date: Wed, 22 Jul 2015 05:18:21 +0000 (+0200) Subject: Fix gh-issue #7 X-Git-Tag: RELEASE_2_5_1~2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=bc3a439b3ae1617da6d17aca43dac9d0b62757ff;p=m6w6%2Fext-http Fix gh-issue #7 Fix crash on returning from a sub-call to querystring from env_request after an exception. Closes gh-issue #7 --- diff --git a/package.xml b/package.xml index 922589a..eecfe7e 100644 --- a/package.xml +++ b/package.xml @@ -49,6 +49,7 @@ http://dev.iworks.at/ext-http/lcov/ext/http/ * Fixed VC11 build (Jan Erhardt) * Fixed gh-issue #2: comparison of obsolete pointers in the header parser (xiaoyjy) * Fixed gh-issue #6: allow RFC1738 unsafe characters in query/fragment +* Fixed gh-issue #7: crash with querystring and exception from error handler + SSL certinfo is available for libcurl >= 7.42 with gnutls (openssl has already been since 7.19.1) + Added "falsestart" SSL request option (available with libcurl >= 7.42 and darwinssl/NSS) + Added "service_name" and "proxy_service_name" request options for SPNEGO (available with libcurl >= 7.43) @@ -248,6 +249,7 @@ http://dev.iworks.at/ext-http/lcov/ext/http/ + diff --git a/php_http_env_request.c b/php_http_env_request.c index ac0a5e4..a884d2f 100644 --- a/php_http_env_request.c +++ b/php_http_env_request.c @@ -172,7 +172,7 @@ static PHP_METHOD(HttpEnvRequest, __construct) do {\ zend_fcall_info fci; \ zend_fcall_info_cache fcc; \ - zval *rv, mn, ***args = ecalloc(sizeof(zval **), ZEND_NUM_ARGS()); \ + zval *rv = NULL, mn, ***args = ecalloc(sizeof(zval **), ZEND_NUM_ARGS()); \ zval *qs = zend_read_property(Z_OBJCE_P(getThis()), getThis(), ZEND_STRL(prop), 0 TSRMLS_CC); \ \ INIT_PZVAL(&mn); \ @@ -187,7 +187,9 @@ static PHP_METHOD(HttpEnvRequest, __construct) zend_fcall_info_args_clear(&fci, 1); \ efree(args); \ zval_dtor(&mn); \ - RETVAL_ZVAL(rv, 0, 1); \ + if (rv) { \ + RETVAL_ZVAL(rv, 0, 1); \ + } \ } while(0); ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvRequest_getForm, 0, 0, 0) diff --git a/tests/gh-issue7.phpt b/tests/gh-issue7.phpt new file mode 100644 index 0000000..38e597c --- /dev/null +++ b/tests/gh-issue7.phpt @@ -0,0 +1,32 @@ +--TEST-- +crash with querystring and exception from error handler +--SKIPIF-- + +--GET-- +q[]=1&r[]=2 +--FILE-- +get("q","s")); +} catch (\Exception $e) { + echo $e->getMessage(),"\n"; +} +try { + $r = new http\Env\Request; + var_dump($r->getQuery("r", "s")); +} catch (\Exception $e) { + echo $e->getMessage(),"\n"; +} + +?> +===DONE=== +--EXPECT-- +Test +Array to string conversion +Array to string conversion +===DONE===