php / php/php-src

[Feature] get where "exit" was called/shutdown started

Open
#17,505 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

There currently is no simple way to figure out what/where exit was called.

Since PHP 8.4 PHP is a proper function, however it seems it's xdebug won't break on it, even if set (besides the fact, there's tons of bugs with IDEs/xdebug when breaking on built-in functions, e.g. defined()

Stepping through the code until exit; is reached isn't feasible in all cases (it happens in a long running process, this might take a day...)

It would be great if there were a magic constant similar to __COMPILER_HALT_OFFSET__ that is available in shutdown function callbacks, which includes the last executed file + line in the main thread before shutdown started. But that's just a simple first suggestion, I'm open to everything that makes identifying/debugging this easier.

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

The issue names no files, tests, or implementation entry points. Start by tracing how exit and shutdown function callbacks are handled in the PHP interpreter, then define a feasible way to expose the last executed file and line; done means the behavior is specified, implemented, and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
developer-experience, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.