php / php/doc-en

Shutdown callback is affected by max execution time, but documentation says otherwise.

Open
#2,683 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug Category: Engine Status: Verified
Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

Description

It is reproducible here:
https://www.tehplayground.com/PwpR764URQYi79Lj

Resulted in this output:

Fatal error: Maximum execution time of 1 second exceeded in Standard input code on line 20
Start of shutdown

Fatal error: Maximum execution time of 1 second exceeded in Standard input code on line 37

But I expected this output instead:

Fatal error: Maximum execution time of 1 second exceeded in Standard input code on line 20
Start of shutdown
End of shutdown

As per the documentation we would expect the shutdown callback to not be affected by any limits set.
As documented here:
https://www.php.net/manual/en/function.register-shutdown-function.php#:~:text=to%20end%20cleanly.-,Note%3A,while%20a%20shutdown%20function%20is%20running%20it%20will%20not%20be%20terminated.,-See%20Also%20%C2%B6

This is a problem for my usecase where if there is a Fatal error , in this case due to timeout, we want to run the shutdown function and not run into a timeout.

PHP Version

PHP Latest

Operating System

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the register_shutdown_function() note in the linked PHP manual page with the reproducible example and reported output. Determine whether the documentation or the described behavior needs correction, then update the relevant documentation accordingly and verify that the documented expectation matches the observed result.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.