summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2017-04-21 21:20:00 +0200
committerAnatol Belski <ab@php.net>2017-05-02 14:44:47 +0200
commitc0c08719117ee6116073a2c65a6840213403e65b (patch)
treeb43efa63f171548c46710ae83fe97327aaddeb3b
parent36c53036e7176b603dab2d6b70433bf42f7ee203 (diff)
downloadphp-git-c0c08719117ee6116073a2c65a6840213403e65b.tar.gz
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.
-rw-r--r--ext/phar/phar_object.c13
1 files changed, 12 insertions, 1 deletions
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;
}