Bug #72619 [Com]: Support for custom HTTP methods not working
| From: | nazar at mokrynskyi dot com | Date: | Thu, 21 Jul 2016 20:05:27 +0000 |
| Subject: | Bug #72619 [Com]: Support for custom HTTP methods not working | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202488@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72619&edit=1
ID: 72619
Comment by: nazar at mokrynskyi dot com
Reported by: nazar at mokrynskyi dot com
Summary: Support for custom HTTP methods not working
Status: Not a bug
Type: Bug
Package: Built-in web server
Operating System: Linux
PHP Version: 7.0.8
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I saw documentation. I do not return FALSE and do output something, yet getting errors for custom
HTTP methods, like XYZ_METHOD_ALSO_ALLOWED
I've prepared simple repository for reproducing an issue:
https://github.com/nazar-pc/php-bug-72619
Previous Comments:
------------------------------------------------------------------------
[2016-07-21 14:12:15] cmb@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
In particular, read about the meaning of router scripts:
| If a PHP file is given on the command line when the web server
| is started it is treated as a "router" script. The script is run
| at the start of each HTTP request. If this script returns FALSE,
| then the requested resource is returned as-is. Otherwise the
| script's output is returned to the browser.
------------------------------------------------------------------------
[2016-07-19 04:56:25] nazar at mokrynskyi dot com
Description:
------------
Similar to https://bugs.php.net/bug.php?id=61679, but with
non-existing file path (handled by index.php).
1) > touch index.php
2) > php -S localhost:1234 index.php
3) Execute test script in another terminal
Test script:
---------------
<?php
file_get_contents(
'http://localhost:1234/some-path',
null,
stream_context_create(
[
'http' => [
'method' => 'PATCH'
]
]
)
);
file_get_contents(
'http://localhost:1234/some-path',
null,
stream_context_create(
[
'http' => [
'method' => 'XYZ_METHOD_ALSO_ALLOWED'
]
]
)
);
Expected result:
----------------
Empty output both in test script and PHP server
Actual result:
--------------
Test script:
PHP Warning: file_get_contents(http://localhost:1234/some-path): failed to open stream: HTTP
request failed! HTTP/1.0 501 Not Implemented
in %s/test.php on line 10
PHP Warning: file_get_contents(http://localhost:1234/some-path): failed to open stream: HTTP
request failed! HTTP/1.0 501 Not Implemented
in %s/test.php on line 21
PHP server:
[%s] 127.0.0.1:%d [501]: /some-path - No such file or directory
Note that PHP server doesn't print anything for PATCH method (for whatever reason, but it is a
part of issue anyway).
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72619&edit=1