`restore_xxx_handler()` does silently return even if there is no handler to restore
Open
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
The following code:
repro: https://3v4l.org/DDulh
<?php
restore_error_handler();
restore_error_handler();
restore_error_handler();
restore_exception_handler();
restore_exception_handler();
restore_exception_handler();
Resulted in this output:
But I expected this output instead:
php warning for each restore_xxx_handler() call if there is no handler to restore
The warnings are important to be inform the developer the operation is probably not wanted (ie. handler was never added).
PHP Version
any
Operating System
any
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the implementations of restore_error_handler() and restore_exception_handler() in the PHP source, then inspect how repeated calls are currently handled. Reproduce the reported sequence and add coverage for calls made without a handler to restore. Done means each such call emits the expected PHP warning without breaking normal handler restoration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100