From c0c08719117ee6116073a2c65a6840213403e65b Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 21 Apr 2017 21:20:00 +0200 Subject: 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. --- ext/phar/phar_object.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 1799268297..b363fd01a9 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; } -- cgit v1.2.1