php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72308 fastcgi_finish_request and logging environment variables
Submitted: 2016-06-01 08:37 UTC Modified: 2016-06-02 06:20 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: max at bitrix dot ru Assigned: laruence (profile)
Status: Closed Package: FPM related
PHP Version: 7.0.7 OS: Ubuntu 14.04
Private report: No CVE-ID: None
 [2016-06-01 08:37 UTC] max at bitrix dot ru
Description:
------------
In php-fpm.conf we have:
access.format = "%{REMOTE_ADDR}e # %{HTTP_HOST}e # %{HTTP_USER_AGENT}e pid=%pid # %t # %m # %r # %Q%q # %s # %f # %{mili}d # %{kilo}M # %{user}C # %{system}C # "

If we make hit without fastcgi_finish_request() we get all %{...}e positions with right information.

If fastcgi_finish_request() call is there, then we get nothing.

This is because of change in sapi/fpm/fpm/fpm_main.c in function PHP_FUNCTION(fastcgi_finish_request)
There was fcgi_close call with third paramters set to "0".
Now there is "1".
So when it comes to write into the log an environment variable, the hash is  already destroyed.




Test script:
---------------
<?php
if (isset($_GET["no_fastcgi_finish_request"]))
    echo "no_fastcgi_finish_request";
else
    fastcgi_finish_request();



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-01 09:07 UTC] max at bitrix dot ru
This is because of fix of bug
https://bugs.php.net/bug.php?id=70279
 [2016-06-01 14:46 UTC] tony2001@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: laruence
 [2016-06-01 14:46 UTC] tony2001@php.net
Xinchen, could you take a look?
 [2016-06-02 06:17 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=31ce3a661a04ec8addd8b0ede4af2d336646d0ec
Log: Fixed bug #72308 (fastcgi_finish_request and logging environment variables)
 [2016-06-02 06:17 UTC] laruence@php.net
-Status: Assigned +Status: Closed
 [2016-06-02 06:20 UTC] laruence@php.net
should be fixed now, I have to make the cleanup at the request startup phase :<
 [2016-06-02 06:48 UTC] inefedor at gmail dot com
@laruence I'd guess you could have called fpm_log_write() in fastcgi_finish_request() instead? You wouldn't need to clean up the request in the beginning of a new one
 [2016-07-20 11:30 UTC] davey@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=31ce3a661a04ec8addd8b0ede4af2d336646d0ec
Log: Fixed bug #72308 (fastcgi_finish_request and logging environment variables)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC