|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81496 CLI server logs wrong request method
Submitted: 2021-10-03 09:25 UTC Modified: -
From: lauri dot kentta at gmail dot com Assigned:
Status: Closed Package: Built-in web server
PHP Version: 8.0.11 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: lauri dot kentta at gmail dot com
New email:
PHP Version: OS:


 [2021-10-03 09:25 UTC] lauri dot kentta at gmail dot com
In the CLI server, request_info is populated only for scripts. If you start by fetching a static file, the server logs request_method as "(null)", and later it logs whatever method was used for latest script. 404 response is also affected.

There's two ways to fix this, either populate request_info for all requests or simply change logging to use client->request.request_method instead.

Test script:
<!DOCTYPE html>
(async function() {
  await fetch("static.html");
  await fetch("script.php", {method: "POST"});
  await fetch("static.html");

Expected result:
Server log with methods GET, POST, GET.

Actual result:
Server log with methods (null), POST, POST, if the files exist.
Server log with methods (null), (null), (null), if files do NOT exist (404).


0001-Fix-81496-CLI-server-logs-wrong-request-method.txt (last revision 2021-10-03 09:28 UTC by lauri dot kentta at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-10-03 09:28 UTC] lauri dot kentta at gmail dot com
The following patch has been added/updated:

Patch Name: 0001-Fix-81496-CLI-server-logs-wrong-request-method.txt
Revision:   1633253329
 [2021-10-05 06:44 UTC]
Automatic comment on behalf of Metabolix (author) and krakjoe (committer)
Log: Fix #81496: CLI server logs wrong request method
 [2021-10-05 06:44 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jan 26 16:03:34 2022 UTC