php / php/php-src

Destructors not invoked after a fatal error

Open
#18,418 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

This behavior is caused by https://github.com/php/php-src/blob/9306c9584b01f29d2986460a13a7a34b991a9063/main/main.c#L1477 and is causing a few issues in our code.

Granted, the application state after a fatal error (mainly execution timeout/memory limit) may not be consistent, however shutdown handlers are executed anyway after a fatal: thus, to match the behavior of shutdown handlers, I'd like to submit a PR to re-enable execution of destructors, opening this issue to gauge the mood.

PHP Version

8.4.6

Operating System

Ubuntu 24.04

Contributor guide

Open the contributing guide

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

Read main/main.c at the linked line and compare fatal-error handling with the shutdown-handler path. Reproduce the behavior on PHP 8.4.6 under Ubuntu 24.04 using an execution timeout or memory limit; done means destructors are invoked after the fatal error in the intended cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.