|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78402 Converting null to string in error message is bad DX
Submitted: 2019-08-11 20:29 UTC Modified: -
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: Assigned:
Status: Closed Package: *General Issues
PHP Version: 7.3.8 OS:
Private report: No CVE-ID: None
 [2019-08-11 20:29 UTC]
When pcntl_signal is passed a null variable instead of a callable, the error message should make it clear that the variable is not allowed to be null. Currently the error message given is:

> 'pcntl_signal(): is not a callable function name error'

Presumably because it is converting the variable null to be a string of ''. 

Which means the developer needs to work backwards from a zero length string being present in the error message, to the fact that they passed in null.

Test script:
static $fnSignalHandler = null;

// $fnSignalHandler is meant to be initialised here but isn't

pcntl_signal(SIGINT, $fnSignalHandler, false);

Expected result:
A clear error message that says I've passed null.

Actual result:
Me spending 15 minutes trying to figure out why pcntl_signal is not callable.


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-12-17 18:19 UTC] kentaro at ranvis dot com
The following pull request has been associated:

Patch Name: Fix #78402: pcntl_signal() misleading error message
On GitHub:
 [2019-12-20 10:03 UTC]
Automatic comment on behalf of
Log: Fix #78402: pcntl_signal() misleading error message
 [2019-12-20 10:03 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 17:01:31 2024 UTC