php / php/doc-en

Error handler callback has return type bool but allows others

Open
#1,206 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

https://www.php.net/manual/en/function.set-error-handler.php

The handler callback passed to set_error_handler is documented with return type bool. The description for the callback includes:

If the function returns false then the normal error handler continues.

However, this function can return more than just boolean values. It seems to ignore anything returned except false.

I'm not sure this is an actual bug, but I wanted to clarify that it can be confusing when discussing complicated error handler flows where some developers returned boolean values, some returned nothing and so on.

Will the callback ever error on non-boolean values? Should we explain that any other value has no effect?

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 with the set-error-handler manual entry linked in the issue and review the callback return-type declaration and its description. Done means the documentation clearly explains how non-boolean return values are handled, including whether they affect continuation or produce an error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.