com php-src: Fixed bug #51918 Phar::webPhar() does not handle requests sent through PUT and DELETE method: ext/phar/phar_object.c
[email protected] (Anatol Belski)
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: c0c08719117ee6116073a2c65a6840213403e65b Author: Christian Weiske <[email protected]> Fri, 21 Apr 2017 21:20:00 +0200 Committer: Anatol Belski <[email protected]> Tue, 2 May 2017 14:44:47 +0200 Parents: 36c53036e7176b603dab2d6b70433bf42f7ee203 Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c0c08719117ee6116073a2c65a6840213403e65b Log: Fixed bug #51918 Phar::webPhar() does not handle requests sent through PUT and DELETE method phar: Support DELETE, HEAD and PUT HTTP methods in Phar::webPhar Up to now only GET and POST requests could be handled with Phar::webPhar(), which is insufficient for today's REST APIs. This patch expands the list of supported HTTP methods. Bugs: https://bugs.php.net/51918 Changed paths: M ext/phar/phar_object.c Diff: diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 1799268..b363fd0 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -582,7 +582,18 @@ PHP_METHOD(Phar, webPhar) } /* retrieve requested file within phar */ - if (!(SG(request_info).request_method && SG(request_info).request_uri && (!strcmp(SG(request_info).request_method, "GET") || !strcmp(SG(request_info).request_method, "POST")))) { + if (!(SG(request_info).request_method + && SG(request_info).request_uri + && (!strcmp(SG(request_info).request_method, "GET") + || !strcmp(SG(request_info).request_method, "POST") + || !strcmp(SG(request_info).request_method, "DELETE") + || !strcmp(SG(request_info).request_method, "HEAD") + || !strcmp(SG(request_info).request_method, "OPTIONS") + || !strcmp(SG(request_info).request_method, "PATCH") + || !strcmp(SG(request_info).request_method, "PUT") + ) + ) + ) { return; }