diff options
Diffstat (limited to '0002-Fix-type-check-for-setContentDownload.patch')
-rw-r--r-- | 0002-Fix-type-check-for-setContentDownload.patch | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/0002-Fix-type-check-for-setContentDownload.patch b/0002-Fix-type-check-for-setContentDownload.patch deleted file mode 100644 index aa3c7cf..0000000 --- a/0002-Fix-type-check-for-setContentDownload.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 309da4c0c107c0c32b500db53339fe266bd8b678 Mon Sep 17 00:00:00 2001 -From: John Boehr <jbboehr@gmail.com> -Date: Thu, 15 Jun 2017 11:25:52 -0700 -Subject: [PATCH 2/3] Fix type check for setContentDownload - -* Change exception thrown to InvalidArgumentException ---- - serverresponse.c | 8 +++++++- - tests/response/setContentDownload_notResource.phpt | 6 +----- - userland/src/ServerResponse.php | 2 +- - 3 files changed, 9 insertions(+), 7 deletions(-) - -diff --git a/serverresponse.c b/serverresponse.c -index 2e912f7..02853e1 100644 ---- a/serverresponse.c -+++ b/serverresponse.c -@@ -648,13 +648,19 @@ PHP_METHOD(ServerResponse, setContentDownload) - smart_str buf2 = {0}; - - ZEND_PARSE_PARAMETERS_START(2, 4) -- Z_PARAM_RESOURCE(zstream) -+ Z_PARAM_ZVAL(zstream) - Z_PARAM_STR(name) - Z_PARAM_OPTIONAL - Z_PARAM_STR(disposition) - Z_PARAM_ARRAY(params) - ZEND_PARSE_PARAMETERS_END(); - -+ // Check type of resource parameter -+ if( Z_TYPE_P(zstream) != IS_RESOURCE ) { -+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Argument 1 passed to ServerResponse::setContentDownload() must be of the type resource, string given"); -+ return; -+ } -+ - // Initialize params - if( !params || Z_TYPE_P(params) != IS_ARRAY ) { - params = &_params; -diff --git a/tests/response/setContentDownload_notResource.phpt b/tests/response/setContentDownload_notResource.phpt -index 1e9cb45..0688334 100644 ---- a/tests/response/setContentDownload_notResource.phpt -+++ b/tests/response/setContentDownload_notResource.phpt -@@ -14,11 +14,7 @@ json - $response = new ServerResponse(); - try { - $response->setContentDownload('not-a-resource', 'disposition'); --} catch( TypeError $e ) { -- // php 7 (extension) -- var_dump($e->getMessage()); --} catch( RuntimeException $e ) { -- // php 5 (userland) -+} catch( InvalidArgumentException $e ) { - var_dump($e->getMessage()); - } - --EXPECT-- --- -2.9.4 - |