Skip to content

Errors after fastcgi_finish_requests are not logged to error_log #12486

@php4fan

Description

@php4fan

Description

Consider code with PHP-FPM:

<?php

echo "Hi!";
fastcgi_finish_request();

sleep(10);
file_put_contents("test.log",  date('c') . "\n\n", FILE_APPEND);

ksbkdbsd();

Expected result

10 seconds after the response has been sent to the client, this should write the current time to the file test.log, and also this should result in an error being logged, because the script is calling a function that doesn't exist.

Observed result

The client immediately receives the response, and the current time is written to the file test.log, demonstrating that fastcgi_finish_request() is working, and that script execution is continuing as expected after it.

However, no error is logged to the error log (in my case ./logs/error_log).

If I remove the line fastcgi_finish_request(), then I do see the error logged : "Fatal error: Uncaught Error: Call to undefined function ksbkdbsd()". This demonstrates that it's not an issue with my error reporting configuration.

PHP Version

PHP 7.4.11

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions