php.net |  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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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
Description:
------------
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>
<script>
(async function() {
  await fetch("static.html");
  await fetch("script.php", {method: "POST"});
  await fetch("static.html");
})();
</script>


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).

Patches

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)

Pull Requests

History

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
URL:        https://bugs.php.net/patch-display.php?bug=81496&patch=0001-Fix-81496-CLI-server-logs-wrong-request-method.txt&revision=1633253329
 [2021-10-05 06:44 UTC] git@php.net
Automatic comment on behalf of Metabolix (author) and krakjoe (committer)
Revision: https://github.com/php/php-src/commit/cdcdb3308024d6b15d566d34767590fb8608a785
Log: Fix #81496: CLI server logs wrong request method
 [2021-10-05 06:44 UTC] git@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC